Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions inc/windows/switchtec_public.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,9 @@

#endif

DEFINE_GUID(SWITCHTEC_INTERFACE_GUID,
0xC94C2F2B, 0xF574, 0x4CFE, 0xA5, 0x5B, 0x5C, 0xEF, 0xEE, 0x68, 0xB4, 0x62);
// Management EP Windows Driver GUID - {C1553ECB-6C75-4A14-A6FC-DC62443B1216}
DEFINE_GUID(MCHP_PCIE_MNGT_EP_INTERFACE_GUID,
0xC1553ECB, 0x6C75, 0x4A14, 0xA6, 0xFC, 0xDC, 0x62, 0x44, 0x3B, 0x12, 0x16);

DEFINE_DEVPROPKEY(SWITCHTEC_PROP_DEVICE_VERSION,
0xC26DF34B, 0x0A46, 0x4942, 0x8E, 0x6B, 0xF8, 0x92, 0x4E, 0xB7, 0x32, 0x84, 2);
Expand Down Expand Up @@ -91,4 +92,4 @@ struct switchtec_mrpc_result {
#define IOCTL_SWITCHTEC_WAIT_FOR_EVENT \
CTL_CODE(FILE_DEVICE_UNKNOWN, 0x3, METHOD_BUFFERED, FILE_ANY_ACCESS)

#endif
#endif
18 changes: 9 additions & 9 deletions lib/platform/windows.c
Original file line number Diff line number Diff line change
Expand Up @@ -78,14 +78,14 @@ static int count_devices(void)
DWORD count = 0;
SP_DEVICE_INTERFACE_DATA deviface;

devinfo = SetupDiGetClassDevs(&SWITCHTEC_INTERFACE_GUID,
devinfo = SetupDiGetClassDevs(&MCHP_PCIE_MNGT_EP_INTERFACE_GUID,
NULL, NULL, DIGCF_DEVICEINTERFACE |
DIGCF_PRESENT);

deviface.cbSize = sizeof(SP_DEVICE_INTERFACE_DATA);

while (SetupDiEnumDeviceInterfaces(devinfo, NULL,
&SWITCHTEC_INTERFACE_GUID,
&MCHP_PCIE_MNGT_EP_INTERFACE_GUID,
count++, &deviface));

return count - 1;
Expand Down Expand Up @@ -284,7 +284,7 @@ int switchtec_list(struct switchtec_device_info **devlist)
return -errno;
}

devinfo = SetupDiGetClassDevs(&SWITCHTEC_INTERFACE_GUID,
devinfo = SetupDiGetClassDevs(&MCHP_PCIE_MNGT_EP_INTERFACE_GUID,
NULL, NULL, DIGCF_DEVICEINTERFACE |
DIGCF_PRESENT);
if (devinfo == INVALID_HANDLE_VALUE)
Expand All @@ -293,7 +293,7 @@ int switchtec_list(struct switchtec_device_info **devlist)
deviface.cbSize = sizeof(SP_DEVICE_INTERFACE_DATA);

while (SetupDiEnumDeviceInterfaces(devinfo, NULL,
&SWITCHTEC_INTERFACE_GUID,
&MCHP_PCIE_MNGT_EP_INTERFACE_GUID,
idx, &deviface))
{
snprintf(dl[cnt].name, sizeof(dl[cnt].name),
Expand Down Expand Up @@ -466,7 +466,7 @@ struct switchtec_dev *switchtec_open_by_path(const char *path)
return NULL;

append_guid(path, path_with_guid, sizeof(path_with_guid),
&SWITCHTEC_INTERFACE_GUID);
&MCHP_PCIE_MNGT_EP_INTERFACE_GUID);

wdev->hdl = CreateFile(path_with_guid, GENERIC_READ | GENERIC_WRITE,
FILE_SHARE_READ | FILE_SHARE_WRITE,
Expand Down Expand Up @@ -500,7 +500,7 @@ struct switchtec_dev *switchtec_open_by_index(int index)
struct switchtec_dev *dev = NULL;
BOOL status;

devinfo = SetupDiGetClassDevs(&SWITCHTEC_INTERFACE_GUID,
devinfo = SetupDiGetClassDevs(&MCHP_PCIE_MNGT_EP_INTERFACE_GUID,
NULL, NULL, DIGCF_DEVICEINTERFACE |
DIGCF_PRESENT);
if (devinfo == INVALID_HANDLE_VALUE)
Expand All @@ -509,7 +509,7 @@ struct switchtec_dev *switchtec_open_by_index(int index)
deviface.cbSize = sizeof(SP_DEVICE_INTERFACE_DATA);

status = SetupDiEnumDeviceInterfaces(devinfo, NULL,
&SWITCHTEC_INTERFACE_GUID,
&MCHP_PCIE_MNGT_EP_INTERFACE_GUID,
index, &deviface);
if (!status) {
errno = ENODEV;
Expand Down Expand Up @@ -540,7 +540,7 @@ struct switchtec_dev *switchtec_open_by_pci_addr(int domain, int bus,
int dbus, ddevice, dfunc;
int idx = 0;

devinfo = SetupDiGetClassDevs(&SWITCHTEC_INTERFACE_GUID,
devinfo = SetupDiGetClassDevs(&MCHP_PCIE_MNGT_EP_INTERFACE_GUID,
NULL, NULL, DIGCF_DEVICEINTERFACE |
DIGCF_PRESENT);
if (devinfo == INVALID_HANDLE_VALUE)
Expand All @@ -549,7 +549,7 @@ struct switchtec_dev *switchtec_open_by_pci_addr(int domain, int bus,
deviface.cbSize = sizeof(SP_DEVICE_INTERFACE_DATA);

while (SetupDiEnumDeviceInterfaces(devinfo, NULL,
&SWITCHTEC_INTERFACE_GUID,
&MCHP_PCIE_MNGT_EP_INTERFACE_GUID,
idx++, &deviface))
{
status = get_path(devinfo, &deviface, &devdata,
Expand Down