linux-pci.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* accessing pci_dev
@ 2012-08-06 22:19 Paolo
  2012-08-06 22:46 ` Greg KH
  0 siblings, 1 reply; 7+ messages in thread
From: Paolo @ 2012-08-06 22:19 UTC (permalink / raw)
  To: linux-pci

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!


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: accessing pci_dev
  2012-08-06 22:19 accessing pci_dev Paolo
@ 2012-08-06 22:46 ` Greg KH
  2012-08-06 23:16   ` Paolo
  0 siblings, 1 reply; 7+ messages in thread
From: Greg KH @ 2012-08-06 22:46 UTC (permalink / raw)
  To: Paolo; +Cc: linux-pci

On Mon, Aug 06, 2012 at 10:19:55PM +0000, Paolo wrote:
> 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

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: accessing pci_dev
  2012-08-06 22:46 ` Greg KH
@ 2012-08-06 23:16   ` Paolo
  2012-08-06 23:59     ` Bjorn Helgaas
  0 siblings, 1 reply; 7+ messages in thread
From: Paolo @ 2012-08-06 23:16 UTC (permalink / raw)
  To: linux-pci

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.


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: accessing pci_dev
  2012-08-06 23:16   ` Paolo
@ 2012-08-06 23:59     ` Bjorn Helgaas
  2012-08-07  0:13       ` Paolo
  0 siblings, 1 reply; 7+ messages in thread
From: Bjorn Helgaas @ 2012-08-06 23:59 UTC (permalink / raw)
  To: Paolo; +Cc: linux-pci

On Mon, Aug 6, 2012 at 4:16 PM, Paolo <paolopiace@gmail.com> wrote:
> 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

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: accessing pci_dev
  2012-08-06 23:59     ` Bjorn Helgaas
@ 2012-08-07  0:13       ` Paolo
  2012-08-07  4:18         ` Bjorn Helgaas
  0 siblings, 1 reply; 7+ messages in thread
From: Paolo @ 2012-08-07  0:13 UTC (permalink / raw)
  To: linux-pci

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


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: accessing pci_dev
  2012-08-07  0:13       ` Paolo
@ 2012-08-07  4:18         ` Bjorn Helgaas
  2012-08-07  5:34           ` Paolo
  0 siblings, 1 reply; 7+ messages in thread
From: Bjorn Helgaas @ 2012-08-07  4:18 UTC (permalink / raw)
  To: Paolo; +Cc: linux-pci

On Mon, Aug 6, 2012 at 5:13 PM, Paolo <paolopiace@gmail.com> wrote:
> 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.

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

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: accessing pci_dev
  2012-08-07  4:18         ` Bjorn Helgaas
@ 2012-08-07  5:34           ` Paolo
  0 siblings, 0 replies; 7+ messages in thread
From: Paolo @ 2012-08-07  5:34 UTC (permalink / raw)
  To: linux-pci

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!!





^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2012-08-07  5:34 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-08-06 22:19 accessing pci_dev Paolo
2012-08-06 22:46 ` Greg KH
2012-08-06 23:16   ` Paolo
2012-08-06 23:59     ` Bjorn Helgaas
2012-08-07  0:13       ` Paolo
2012-08-07  4:18         ` Bjorn Helgaas
2012-08-07  5:34           ` Paolo

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).