Re: Question regarding pci_bus_read_config_byte

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Nov 02, 2006 at 01:20:56PM -0600, Jes?s Velazquez wrote:
> I have another question:
> 
> Is it possible to use the raw_pci_ops structure inside a module?. Inside
> arch/i386/pci/pcbios.c, arch/i386/pci/direct.c and arch/i386/pci/mmconfig
> the following structure is defined:
> 
> struct pci_raw_ops {
>        int (*read)(unsigned int domain, unsigned int bus, unsigned int
> devfn,
>                    int reg, int len, u32 *val);
>        int (*write)(unsigned int domain, unsigned int bus, unsigned int
> devfn,
>                     int reg, int len, u32 val);
> };
> 
> In the case of pcbios.c (For BIOS access):
> 
> static struct pci_raw_ops pci_bios_access = {
>        .read =         pci_bios_read,
>        .write =        pci_bios_write
> };
> 
> For direct.c (For cfc/cf8 IO ports access):
> 
> static struct pci_raw_ops pci_direct_conf2 = {
>        .read =         pci_conf2_read,
>        .write =        pci_conf2_write,
> };
> 
> struct pci_raw_ops pci_direct_conf1 = {
>        .read =         pci_conf1_read,
>        .write =        pci_conf1_write,
> };
> 
> And for mmconfig.c (for memory mapped devices)
> 
> static struct pci_raw_ops pci_mmcfg = {
>        .read =         pci_mmcfg_read,
>        .write =        pci_mmcfg_write,
> };
> 
> At the end of each file, the raw_pci_ops points to each of them, I suppose
> that this is done  at compile time depending on the PCI access mode option:
> BIOS, Direct, MMConfig. But, if the kernel is compiled using Any, is it
> enough to specify as kernel parameter pci=mmconfig option to use mmconfig
> mode?
> 
> On the other hand, is this structure available to device drivers?. I create
> a kernel module which uses it, inside include/linux/pci.h the structure is
> defined:
> 
> extern struct pci_raw_ops *raw_pci_ops;
> 
> The module compiles but when I insert the module it says:
> 
> insmod: error inserting './mpcie.ko': -1 Unknown symbol in module
> 
> During the compilation a warning appears:
> 
> ****Warning: "raw_pci_ops" [....../mpcie.ko] undefined!.
> 
> 
> What are the missing steps?, Is it possible to use that structure inside a
> kernel module?, the raw_pci_ops symbol is defined in the System.map file.

No, raw_pci_ops is not availble for your driver to use.  Please use the
proper PCI wrapper functions.

The PCI core will properly switch between the different operations
depending on the build options, the run-time options, and the hardware
present (BIOS options).  In the future, it might even be different per
different PCI device (I have had requests to do this at times for odd
platforms...)

So just stick with the proper read and write config calls, you get the
correct locking and all the nasty hardware interactions are taken care
of for you.

thanks,

greg k-h

--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive:       http://mail.nl.linux.org/kernelnewbies/
FAQ:           http://kernelnewbies.org/faq/


[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux