Subversion Repositories Kolibri OS

Rev

Rev 808 | Blame | Last modification | View Log | Download | RSS feed

  1.  
  2.  
  3. #pragma pack(push, 1)
  4. typedef struct
  5. {
  6.      u16_t device;
  7.      u16_t ChipSet;
  8. }PciChipset_t;
  9. #pragma pack(pop)
  10.  
  11. #define VENDOR_ATI 0x1002
  12.  
  13.  
  14. #define PCI_MAP_REG_START             0x10
  15. #define PCI_MAP_REG_END               0x28
  16. #define PCI_MAP_ROM_REG               0x30
  17.  
  18. #define PCI_MAP_MEMORY                0x00000000
  19. #define PCI_MAP_IO                    0x00000001
  20.  
  21. #define PCI_MAP_MEMORY_TYPE           0x00000007
  22. #define PCI_MAP_IO_TYPE               0x00000003
  23.  
  24. #define PCI_MAP_MEMORY_TYPE_32BIT     0x00000000
  25. #define PCI_MAP_MEMORY_TYPE_32BIT_1M    0x00000002
  26. #define PCI_MAP_MEMORY_TYPE_64BIT     0x00000004
  27. #define PCI_MAP_MEMORY_TYPE_MASK      0x00000006
  28. #define PCI_MAP_MEMORY_CACHABLE       0x00000008
  29. #define PCI_MAP_MEMORY_ATTR_MASK      0x0000000e
  30. #define PCI_MAP_MEMORY_ADDRESS_MASK   0xfffffff0
  31.  
  32. #define PCI_MAP_IO_ATTR_MASK          0x00000003
  33.  
  34. #define PCI_MAP_IS_IO(b)  ((b) & PCI_MAP_IO)
  35. #define PCI_MAP_IS_MEM(b)       (!PCI_MAP_IS_IO(b))
  36.  
  37. #define PCI_MAP_IS64BITMEM(b)   \
  38.         (((b) & PCI_MAP_MEMORY_TYPE_MASK) == PCI_MAP_MEMORY_TYPE_64BIT)
  39.  
  40. #define PCIGETMEMORY(b)   ((b) & PCI_MAP_MEMORY_ADDRESS_MASK)
  41. #define PCIGETMEMORY64HIGH(b)   (*((CARD32*)&b + 1))
  42. #define PCIGETMEMORY64(b)       \
  43.         (PCIGETMEMORY(b) | ((CARD64)PCIGETMEMORY64HIGH(b) << 32))
  44.  
  45. #define PCI_MAP_IO_ADDRESS_MASK       0xfffffffc
  46.  
  47. #define PCIGETIO(b)             ((b) & PCI_MAP_IO_ADDRESS_MASK)
  48.  
  49. #define PCI_MAP_ROM_DECODE_ENABLE     0x00000001
  50. #define PCI_MAP_ROM_ADDRESS_MASK      0xfffff800
  51.  
  52. #define PCIGETROM(b)            ((b) & PCI_MAP_ROM_ADDRESS_MASK)
  53.  
  54.  
  55. #ifndef PCI_DOM_MASK
  56. # define PCI_DOM_MASK 0x0ffu
  57. #endif
  58. #define PCI_DOMBUS_MASK (((PCI_DOM_MASK) << 8) | 0x0ffu)
  59.  
  60. #define PCI_MAKE_TAG(b,d,f)  ((((b) & (PCI_DOMBUS_MASK)) << 16) | \
  61.                               (((d) & 0x00001fu) << 11) | \
  62.                               (((f) & 0x000007u) << 8))
  63.  
  64. #define PCI_BUS_FROM_TAG(tag)  (((tag) >> 16) & (PCI_DOMBUS_MASK))
  65. #define PCI_DEV_FROM_TAG(tag)  (((tag) & 0x0000f800u) >> 11)
  66. #define PCI_FUNC_FROM_TAG(tag) (((tag) & 0x00000700u) >> 8)
  67. #define PCI_DFN_FROM_TAG(tag)  (((tag) & 0x0000ff00u) >> 8)
  68.  
  69.  
  70. typedef unsigned int PCITAG;
  71.  
  72. extern inline PCITAG
  73. pciTag(int busnum, int devnum, int funcnum)
  74. {
  75.         return(PCI_MAKE_TAG(busnum,devnum,funcnum));
  76. }
  77.  
  78. const PciChipset_t *PciDevMatch(u16_t dev,const PciChipset_t *list);
  79. u32_t pciGetBaseSize(int bus, int devfn, int index, Bool destructive, Bool *min);
  80.