Re: Question regarding pci_bus_read_config_byte

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

 



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.

Thanks and regards,

Jesus


On 11/1/06, Jesús Velazquez <jesus.velazquez@xxxxxxxxx> wrote:
Ok, I will gather the details and I will report to libpci developers!

Thanks!



On 11/1/06, Greg KH <greg@xxxxxxxxx > wrote:
On Wed, Nov 01, 2006 at 04:35:27PM -0600, Jes?s Velazquez wrote:
> >Then I would suggest not doing it from within kernel space :)
> >You should be able to do all of this from userspace using libpci, right?
> >You don't need to write kernel code to get to PCI config space for any
> device.
>
> In fact, I tried to do it using libpci  but I found some issues. Some
> registers (Extended Configuration Space of PCI Express) are not found using
> libpci (I used the latest). Using libpci, some registers (I'm sure that they
> exists in the current hw) reported 0xfffffffff values, so they look as there
> do not exists. That is why I want to access them from the kernel. I was told
> that those functions rely on the correct low level functions, I mean kernel
> knows when use cfc/cf8 IO ports and when memory mapped registers (using
> ACPI  MCFG).

Hm, using libpci should cause the same thing to happen (correct access
modes.)  I'd suggest bringing this up with the libpci developers, as you
should not be forced to do this within the kernel.

thanks,

greg k-h



--
Simple Mortal!



--
Simple Mortal!

[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