Leaked source code of windows server 2003
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.

198 lines
4.0 KiB

  1. /*++
  2. Copyright (c) 1989 Microsoft Corporation
  3. Module Name:
  4. pccard.h
  5. Abstract:
  6. This module contains the C code to set up PcCard (pcmcia, cardbus)
  7. configuration data.
  8. Author:
  9. Neil Sandlin (neilsa) 16-Dec-1998
  10. Revision History:
  11. --*/
  12. #define PCCARD_POSSIBLE_IRQS 0xCEB8
  13. //
  14. // PIC hardware
  15. //
  16. #define PIC1_IMR 0x21
  17. #define PIC2_IMR 0xa1
  18. #define PIC1_OCW3 0x20
  19. #define PIC2_OCW3 0xa0
  20. #define PIC_RD_IR 0x0a
  21. #define SYSCTRL_B 0x61
  22. //
  23. // Internal defs
  24. //
  25. #define DEVTYPE_GENERIC_PCIC 0
  26. #define DEVTYPE_GENERIC_CARDBUS 1
  27. #define DEVTYPE_CL_PD6832 2
  28. #define DEVTYPE_CL_PD6834 3
  29. #define DEVTYPE_CL_PD6833 4
  30. #define DEVTYPE_TI_PCI1130 5
  31. #define DEVTYPE_TI_PCI1131 6
  32. #define DEVTYPE_TI_PCI1031 7
  33. #define BCTRL_CL_CSCIRQROUTING_ENABLE 0x0800
  34. #define CDGC_SW_DET_INT 0x20
  35. #define CFGSPACE_VENDOR_ID 0x00
  36. #define CFGSPACE_DEVICE_ID 0x02
  37. #define CFGSPACE_COMMAND 0x04
  38. #define CFGSPACE_HEADER_TYPE 0x0e
  39. #define CFGSPACE_SECONDARY_BUS 0x19
  40. #define CFGSPACE_SUBORDINATE_BUS 0x1a
  41. #define CFGSPACE_BRIDGE_CTRL 0x3e
  42. #define CFGSPACE_LEGACY_MODE_BASE_ADDR 0x44
  43. #define CFGSPACE_CL_CFGMISC1 0x98
  44. #define CFGSPACE_TI_DEV_CTRL 0x92
  45. #define CL_CFGMISC1_ISACSC 0x02
  46. #define CSCFG_CD_ENABLE 0x08
  47. #define DEVCTRL_INTMODE_COMPAQ 0x04
  48. #define DEVCTRL_INTMODE_MASK 0x06
  49. #define EXCAREG_IDREV 0x00
  50. #define EXCAREG_INT_GENCTRL 0x03
  51. #define EXCAREG_CARD_STATUS 0x04
  52. #define EXCAREG_CSC_CFG 0x05
  53. #define EXCAREG_CARDDET_GENCTRL 0x16
  54. #define IGC_PCCARD_RESETLO 0x40
  55. #define PCIC_REVISION 0x82
  56. #define PCIC_REVISION2 0x83
  57. #define PCIC_REVISION3 0x84
  58. #define PCI_TYPE1_ADDR_PORT ((PULONG) 0xCF8)
  59. #define PCI_TYPE1_DATA_PORT 0xCFC
  60. #define PCI_MAX_DEVICES 32
  61. #define PCI_MAX_FUNCTION 8
  62. #define PCI_BRIDGE_TYPE 0x01
  63. #define PCI_CARDBUS_BRIDGE_TYPE 0x02
  64. typedef struct _PCI_TYPE1_CFG_BITS {
  65. union {
  66. struct {
  67. ULONG Reserved1:2;
  68. ULONG RegisterNumber:6;
  69. ULONG FunctionNumber:3;
  70. ULONG DeviceNumber:5;
  71. ULONG BusNumber:8;
  72. ULONG Reserved2:7;
  73. ULONG Enable:1;
  74. } bits;
  75. ULONG AsULONG;
  76. } u;
  77. } PCI_TYPE1_CFG_BITS, *PPCI_TYPE1_CFG_BITS;
  78. typedef struct _PCCARD_INFORMATION {
  79. PCI_TYPE1_CFG_BITS PciCfg1;
  80. ULONG DeviceId;
  81. UCHAR Flags;
  82. UCHAR ErrorCode;
  83. UCHAR bDevType;
  84. UCHAR Reserved;
  85. USHORT IoBase;
  86. USHORT wValidIRQs;
  87. UCHAR abIRQMap[16];
  88. } PCCARD_INFORMATION, *PPCCARD_INFORMATION;
  89. typedef struct _CARDBUS_BRIDGE_DEVTYPE {
  90. ULONG DeviceId;
  91. UCHAR bDevType;
  92. } CARDBUS_BRIDGE_DEVTYPE, *PCARDBUS_BRIDGE_DEVTYPE;
  93. //
  94. // Prototypes
  95. //
  96. USHORT
  97. DetectIRQMap(
  98. PPCCARD_INFORMATION pa
  99. );
  100. USHORT
  101. GetPICIRR(
  102. VOID
  103. );
  104. USHORT
  105. ToggleIRQLine(
  106. PPCCARD_INFORMATION pa,
  107. UCHAR bIRQ
  108. );
  109. UCHAR
  110. PcicReadSocket(
  111. PPCCARD_INFORMATION pa,
  112. USHORT Offset
  113. );
  114. VOID
  115. PcicWriteSocket(
  116. PPCCARD_INFORMATION pa,
  117. USHORT Offset,
  118. UCHAR value
  119. );
  120. VOID
  121. GetPciConfigSpace(
  122. PPCCARD_INFORMATION pa,
  123. USHORT Offset,
  124. PVOID Buffer,
  125. USHORT Length
  126. );
  127. VOID
  128. SetPciConfigSpace(
  129. PPCCARD_INFORMATION pa,
  130. USHORT Offset,
  131. PVOID Buffer,
  132. USHORT Length
  133. );
  134. VOID
  135. Clear_IR_Bits(
  136. USHORT BitMask
  137. );
  138. VOID
  139. GetPCIType1Data(
  140. ULONG address,
  141. USHORT IoOffset,
  142. PVOID Buffer,
  143. USHORT Size
  144. );
  145. VOID
  146. SetPCIType1Data(
  147. ULONG address,
  148. USHORT IoOffset,
  149. PVOID Buffer,
  150. USHORT Size
  151. );
  152. VOID
  153. TimeOut(
  154. USHORT Ticks
  155. );