How to access Root device

Hi Everyone,
I am new to Windows KMDF Driver.Actually, am porting a linux driver to KMDF Bus driver in which the pci_dev structure is accessed for the parent device and its capablities.The code is given below.In windows how can i get such parent device structure and capabilities.Is that related to root in windows.If it so how can i get such things.

struct pci_dev *parent;
parent = mydevice->pdev->bus->self;

where mydevice is my device structure , pdev is the linux pci_dev structure.

Can anyone please help me.

Thanks in Advance
Janaki

Actually , I need to access that root device and read its capablities like reading the root complex (port) max payload size and adjusting the max payload size to the supported max payload size of my device.And also check whether my device sets the ATOMIC_OP_REQUESTER_ENABLE bit in it or not.

Thanks

xxxxx@gmail.com wrote:

Actually , I need to access that root device and read its capablities like reading the root complex (port) max payload size and adjusting the max payload size to the supported max payload size of my device.

Two problems here. First, you shouldn’t care about the root complex max
payload size. What you care about is the max payload that was
negotiated by your device. Second, you can’t go around reprogramming
the root complex. That’s a resource you don’t own. The max payload was
set by the BIOS and by the Windows PCI driver, and they had good reasons
for doing so. You don’t get to override it just for your own
convenience. If the negotiation resulted in a max payload that is less
then your maximum, then some component along the line couldn’t handle
your maximum. You can’t just arbitrarily reset it.

And also check whether my device sets the ATOMIC_OP_REQUESTER_ENABLE bit in it or not.

That’s in your PCIe configuration space (assuming you are Gen2 or
better). There are two ways to access that, one using a driver
interface, one using a PnP IRP:
https://msdn.microsoft.com/en-us/library/windows/hardware/ff536890.aspx


Tim Roberts, xxxxx@probo.com
Providenza & Boekelheide, Inc.