Skip to contentSkip to conversation

accessing pci_dev

DISCUSSION Paolo 3 participants 7 messages Aug 6, 2012 – Aug 7, 2012 PCI

lore
Share & tools
lore

Paolo

author
#0 lore raw

My apologies if this is inappropriate, but I really don't know where to go for asking this (eventually, I'd be pleased to be addressed to valuable forums or documents).

Question:
Is there any way to access to the struct pci_dev without registering any driver?

Thanks!

#1 lore raw
Quoted 6 lines · Paolo

My apologies if this is inappropriate, but I really don't know where to go for asking this (eventually, I'd be pleased to be addressed to valuable forums or documents).

Question:
Is there any way to access to the struct pci_dev without registering any driver?

Yes, but why would you?

What problem are you trying to solve?

greg k-h

author
#2 lore raw
Quoted 5 lines · Greg KH <gregkh <at> linuxfoundation.org> writes:

Yes, but why would you?

What problem are you trying to solve?

Thanks for responding!

Basically, I want to check the config registers before and after the driver registration in order to make sure that the driver is not contaminating them.

And, yes, it's the very first time I'm dealing with kernel & drivers.

maintainer
#3 lore raw
Quoted 2 lines · Paolo

Basically, I want to check the config registers before and after the driver registration in order to make sure that the driver is not contaminating them.

The user command "lspci -x" is a good way to see raw config space.

If you don't need the driver for boot, you can build it as a module, make sure it isn't automatically loaded (e.g., rename it temporarily), reboot, run lspci once, load the driver module by hand, and then run lspci again.

If you're on x86, you can also boot with the kernel option "pci=earlydump" to see config space before any drivers touch it, even if they're built into the kernel.

Bjorn

author
#4 lore raw
Quoted 2 lines · Bjorn Helgaas <bhelgaas <at> google.com> writes:

The user command "lspci -x" is a good way to see raw config space.

Sure, Thanks. But I need & want to do everything with the functions pci_read_config_...

They need the struct pci_dev whose pointer is returned by the BIOS (or Kernel?) as parameter of the probe function in the struct pci_driver

There must be a way to get access to each and every pci_dev without resorting to the probe function.

That's what I'm looking fwd to know.

Regards

maintainer
#5 lore raw
Quoted 4 lines · Paolo
Quoted 2 lines · Bjorn Helgaas <bhelgaas <at> google.com> writes:

The user command "lspci -x" is a good way to see raw config space.

Quoted 8 lines

Sure, Thanks. But I need & want to do everything with the functions pci_read_config_...

They need the struct pci_dev whose pointer is returned by the BIOS (or Kernel?) as parameter of the probe function in the struct pci_driver

There must be a way to get access to each and every pci_dev without resorting to the probe function.

pci_get_device(). In arch/mn10300/unit-asb2305/pci-irq.c, pcibios_fixup_irqs() does something similar to what you're asking for.

author
#6 lore raw
Quoted 3 lines · Bjorn Helgaas <bhelgaas <at> google.com> writes:

pci_get_device(). In arch/mn10300/unit-asb2305/pci-irq.c, pcibios_fixup_irqs() does something similar to what you're asking for.

Thanks so much!!