Yang Huang wrote:
refer /usr/src/linux/drivers/pci/access.c
--
Hiran
yes, i found it. but still in access.c i can only see
EXPORT_SYMBOL(pci_bus_read_config_word) without any code of
implementation...
i know the question may be a bit stupid, but any more hints would be
really appreciated.
justin
See the piece of code from access.c from 2.6.13. ( i assume this has not
been changed from 2.6.10)
#define PCI_OP_READ(size,type,len) \
int pci_bus_read_config_##size \
(struct pci_bus *bus, unsigned int devfn, int pos, type *value) \
{ \
int res; \
unsigned long flags; \
u32 data = 0; \
if (PCI_##size##_BAD) return PCIBIOS_BAD_REGISTER_NUMBER; \
spin_lock_irqsave(&pci_lock, flags); \
res = bus->ops->read(bus, devfn, pos, len, &data); \
*value = (type)data; \
spin_unlock_irqrestore(&pci_lock, flags); \
return res; \
}
The macro defines a function
int pci_bus_read_config_##size
and then calls
PCI_OP_READ(byte, u8, 1)
PCI_OP_READ(word, u16, 2)
PCI_OP_READ(dword, u32, 4)
'##size' is replaced by 'byte', 'word' and 'dword' respectively.
--
Hiran
--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive: http://mail.nl.linux.org/kernelnewbies/
FAQ: http://kernelnewbies.org/faq/