Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

127 lines
3.8 KiB

  1. /******* Constant *****************/
  2. # define MGA_DEVICE_ID_ATL 0x0518
  3. # define MGA_DEVICE_ID_ATH 0x0D10
  4. # define MATROX_VENDOR_ID 0x102b
  5. # define INTEL_DEVICE_ID 0x0486
  6. # define INTEL_VENDOR_ID 0x8086
  7. /* Error code */
  8. # define SUCCESFUL 0x00
  9. # define FUNC_NOT_SUPPORTED 0x81
  10. # define BAD_VENDOR_ID 0x83
  11. # define DEVICE_NOT_FOUND 0x86
  12. # define BAD_REGISTER_NUMBER 0x87
  13. # define NO_PCI_BIOS 0x01
  14. # define NO_PCI_DEVICE 0x02
  15. # define ERR_READ_REG 0x03
  16. /* Configuration Space Header Register address */
  17. # define PCI_DEVIDE_ID 0x02
  18. # define PCI_VENDOR_ID 0x00
  19. # define PCI_STATUS 0x06
  20. # define PCI_COMMAND 0x04
  21. # define PCI_CLASS_CODE 0x09
  22. # define PCI_REVISION_ID 0x08
  23. # define PCI_BIST 0x0f
  24. # define PCI_HEADER_TYPE 0x0e
  25. # define PCI_LATENCY_TIMER 0x0d
  26. # define PCI_CACHE_LINE_SIZE 0x0c
  27. # define PCI_BASE_ADDRESS 0x10
  28. # define PCI_ROM_BASE 0x30
  29. # define PCI_MAX_LAT 0x3f
  30. # define PCI_MIN_GNT 0x3e
  31. # define PCI_INTERRUPT_PIN 0x3d
  32. # define PCI_INTERRUPT_LINE 0x3c
  33. /* ClassCode */
  34. # define CLASS_MASS_STORAGE 0x01
  35. # define CLASS_NETWORK 0x02
  36. # define CLASS_DISPLAY 0x03
  37. # define CLASS_MULTIMEDIA 0x04
  38. # define CLASS_MEMORY 0x05
  39. # define CLASS_BRIDGE 0x06
  40. # define CLASS_CUSTOM 0xff
  41. /* SUBCLASS */
  42. # define SCLASS_DISPLAY_VGA 0x00
  43. # define SCLASS_DISPLAY_XGA 0x01
  44. # define SCLASS_DISPLAY_OTHER 0x80
  45. /* BIOS FUNCTION CALL */
  46. # define PCI_INTERRUPT 0x1a
  47. # define PCI_FUNCTION_ID 0xb1
  48. # define PCI_BIOS_PRESENT 0x01
  49. # define FIND_PCI_DEVICE 0x02
  50. # define FIND_PCI_CLASS_CODE 0x03
  51. # define GENERATE_SPECIAL_CYCLE 0x06
  52. # define READ_CONFIG_BYTE 0x08
  53. # define READ_CONFIG_WORD 0x09
  54. # define READ_CONFIG_DWORD 0x0a
  55. # define WRITE_CONFIG_BYTE 0x0b
  56. # define WRITE_CONFIG_WORD 0x0c
  57. # define WRITE_CONFIG_DWORD 0x0d
  58. /* COMMAND register fields */
  59. # define PCI_SNOOPING 0x20
  60. # define PCI_FLAG_ATHENA_REV1 0x0001
  61. # define PCI_BIOS_BASE 0x000e0000
  62. # define PCI_BIOS_LENGTH 0x00020000
  63. # define PCI_BIOS_SERVICE_ID 0x49435024 /* "$PCI" */
  64. /* Mechanisme #2 interface */
  65. # define PCI_CSE 0xcf8
  66. # define PCI_FORWARD 0xcfa
  67. # define MAGIC_ID_ATL 0x0518102b
  68. # define MAGIC_ID_ATH 0x0D10102b
  69. /******* Structure PCI *************/
  70. typedef struct
  71. {
  72. word busNumber;
  73. union
  74. {
  75. byte val;
  76. struct {
  77. byte functionNumber:3;
  78. byte deviceNumber:5;
  79. } n;
  80. } devFuncNumber;
  81. } PciDevice;
  82. typedef struct
  83. {
  84. byte hwMecanisme;
  85. word version;
  86. byte lastPciBus;
  87. } PciBiosInfo;
  88. /* Prototype */
  89. extern bool pciBiosPresent( PciBiosInfo *biosInfo);
  90. extern bool pciFindDevice(PciDevice *dev, word deviceId, word vendorId, word index);
  91. extern bool pciFindClassCode(PciDevice *dev, dword classCode, word index);
  92. extern bool pciBusOperation( PciDevice *dev, dword specData );
  93. #if !( defined(OS2) || defined(__MICROSOFTC600__) )
  94. extern bool pciReadConfigByte( PciDevice *dev, word pciRegister, byte *);
  95. extern bool pciReadConfigWord( PciDevice *dev, word pciRegister, word *);
  96. extern bool pciReadConfigDWord( PciDevice *dev, word pciRegister, dword *);
  97. extern bool pciWriteConfigByte( PciDevice *dev, word pciRegister, byte);
  98. extern bool pciWriteConfigWord( PciDevice *dev, word pciRegister, word);
  99. extern bool pciWriteConfigDWord( PciDevice *dev, dword pciRegister, dword);
  100. #endif
  101. extern dword pciFindFirstMGA();
  102. extern dword pciFindNextMGA();
  103. extern dword pciFindFirstMGA_2();
  104. extern dword pciFindNextMGA_2();
  105. extern void disPostedWFeature();
  106. /* GLOBAL VARIABLE */
  107. extern word pciBoardInfo;