Answered by:
Tying PLX PCIe Enumeration to WMI Win32_DiskDrive

Question
-
Is there a way to bind a disk drive visible via PCIe device enumeration using one of the PCIe enumerable properties, such as the memory mapped IO address, to the WMI Win32_DiskDrive properties?
Here is a visual of the PCIe tree using the PLX Editor (Broadcom). I hovered the mouse over the Samsung (vendor ID 0x144D) NVMe SSD located on Bus 6 of the PLX (8724) downstream port. You can see the device ID 0xA804 (the 960 model) in the box.
I am able to enumerate all my PCIe devices using the PLX SDK, which gives the same view as what you can see with the PLX Editor.
Int32 iPcieDevice; Int32 NumDevices; Boolean bAddDevice; Boolean isPreviousSlot = false; PLX_STATUS_CODE rc = PLX_STATUS_CODE.PLX_STATUS_FAILED; PLX_PORT_PROP PortProp = new PLX_PORT_PROP(); PLX_DEVICE_KEY DevKey = new PLX_DEVICE_KEY(); PLX_DEVICE_KEY[] DevKey_US = new PLX_DEVICE_KEY[PlxInit.MAX_DEVICES_TO_LIST]; PLX_DRIVER_PROP DriverProp = new PLX_DRIVER_PROP(); PLX_DEVICE_OBJECT Device = new PLX_DEVICE_OBJECT(); iPcieDevice = 0; NumDevices = 0; do { // Setup for next device DevKey.Reset(); // Check if device exists int sizeStruct = Marshal.SizeOf(typeof(PLX_DEVICE_KEY)); rc = (PLX_STATUS_CODE)PlxApi.PlxPci_DeviceFind(ref DevKey, (UInt16)iPcieDevice); if (PLX_STATUS_CODE.PLX_STATUS_OK == rc) { // Default to add device bAddDevice = true; // Verify supported chip type if (((DevKey.PlxChip & 0xFF00) != 0x2300) && ((DevKey.PlxChip & 0xFF00) != 0x3300) && ((DevKey.PlxChip & 0xFF00) != 0x8600) && ((DevKey.PlxChip & 0xFF00) != 0x8700) && ((DevKey.PlxChip & 0xFF00) != 0x9700)) { bAddDevice = false; } // Open device to get its properties. if (bAddDevice) { ... } } while ((rc == PLX_STATUS_CODE.PLX_STATUS_OK) && (NumDevices < PlxInit.MAX_DEVICES_TO_LIST)); ...
I can use WMI to show all the disk drives. `Win32_DiskDrive` does the job here. There is a nice page showing the code and output.
string mosQuery = "SELECT * FROM Win32_DiskDrive"; System.Management.ManagementObjectSearcher query = new System.Management.ManagementObjectSearcher(mosQuery); foreach (System.Management.ManagementObject mObj in query.Get()) { foreach (System.Management.PropertyData property in mObj.Properties) { System.Console.WriteLine(property.Name + "__::" + property.Value); } }
I did notice one overlap. Hardware enumeration shows the memory mapped IO address for the PCIe device, which I also see if I use `WMI` using `Win32_DeviceMemoryAddress`. Sadly, I do not see any overlap in properties between Win32_DiskDrive and the properties with Win32_DeviceMemoryAddress.
I know that WMI can get complicated using searches and ACCESSOROF and the like. I am a beginner with WMI, so I might just be missing things.
How do I get the Win32_DeviceMemoryAddress from Win32_DiskDrive or vice-versa?
I am thinking that there is a nice multi-depth WMI search, where the output of one search pipes into another search. I presume that there are many possible answers using different methods. I just need to go from point A to point B, namely equating the hardware node (which the obvious here is the memory mapped IO address) to the Win32_DiskDrive.
- Moved by 宝宝徐 Thursday, August 24, 2017 9:03 AM
Wednesday, August 23, 2017 10:27 PM
Answers
-
I'd ask for help over here.
https://social.msdn.microsoft.com/Forums/windowsdesktop/en-US/home?category=windowsdesktopdev
Regards, Dave Patrick ....
Microsoft Certified Professional
Microsoft MVP [Windows Server] Datacenter Management
Disclaimer: This posting is provided "AS IS" with no warranties or guarantees, and confers no rights.- Proposed as answer by Richard MuellerMVP, Banned Friday, August 25, 2017 12:44 AM
- Marked as answer by Richard MuellerMVP, Banned Thursday, August 31, 2017 2:17 PM
Thursday, August 24, 2017 12:39 PM
All replies
-
Hi Sarah,
Thank you for posting in MSDN forum.
This forum is about Visual Studio WPF/SL Designer, Visual Studio Guidance Automation Toolkit, Developer Documentation and Help System, and Visual Studio Editor.
As your issue is related to PCIe device , I help you guide this case to a more appropriate forum for dedicated support.
Thank you for your understanding,
Best Regards,
MSDN Community Support
Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.Thursday, August 24, 2017 9:03 AM -
I'd ask for help over here.
https://social.msdn.microsoft.com/Forums/windowsdesktop/en-US/home?category=windowsdesktopdev
Regards, Dave Patrick ....
Microsoft Certified Professional
Microsoft MVP [Windows Server] Datacenter Management
Disclaimer: This posting is provided "AS IS" with no warranties or guarantees, and confers no rights.- Proposed as answer by Richard MuellerMVP, Banned Friday, August 25, 2017 12:44 AM
- Marked as answer by Richard MuellerMVP, Banned Thursday, August 31, 2017 2:17 PM
Thursday, August 24, 2017 12:39 PM