pci-direct.h
上传用户:jlfgdled
上传日期:2013-04-10
资源大小:33168k
文件大小:1k
源码类别:

Linux/Unix编程

开发平台:

Unix_Linux

  1. #ifndef ASM_PCI_DIRECT_H
  2. #define ASM_PCI_DIRECT_H 1
  3. #include <linux/types.h>
  4. #include <asm/io.h>
  5. /* Direct PCI access. This is used for PCI accesses in early boot before
  6.    the PCI subsystem works. */ 
  7. #define PDprintk(x...)
  8. static inline u32 read_pci_config(u8 bus, u8 slot, u8 func, u8 offset)
  9. {
  10. u32 v; 
  11. outl(0x80000000 | (bus<<16) | (slot<<11) | (func<<8) | offset, 0xcf8);
  12. v = inl(0xcfc); 
  13. PDprintk("%x reading from %x: %xn", slot, offset, v);
  14. return v;
  15. }
  16. static inline void write_pci_config(u8 bus, u8 slot, u8 func, u8 offset,
  17.     u32 val)
  18. {
  19. PDprintk("%x writing to %x: %xn", slot, offset, val); 
  20. outl(0x80000000 | (bus<<16) | (slot<<11) | (func<<8) | offset, 0xcf8);
  21. outl(val, 0xcfc); 
  22. }
  23. #endif