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.

296 lines
7.7 KiB

  1. /*++
  2. Copyright (c) Microsoft Corporation. All rights reserved.
  3. Module Name:
  4. local.h
  5. Abstract:
  6. This contains the private header information (function prototypes,
  7. data and type declarations) for the PCI IRQ Miniport library.
  8. Author:
  9. Santosh Jodh (santoshj) 09-June-1998
  10. Revision History:
  11. --*/
  12. #include "nthal.h"
  13. #include "hal.h"
  14. #include "pci.h"
  15. #include "pciirqmp.h"
  16. #if DBG
  17. #define PCIIRQMPPRINT(x) { \
  18. DbgPrint("PCIIRQMP: "); \
  19. DbgPrint x; \
  20. DbgPrint("\n"); \
  21. }
  22. #else
  23. #define PCIIRQMPPRINT(x)
  24. #endif
  25. //
  26. // Function prototypes for functions that every chipset module
  27. // has to provide.
  28. //
  29. typedef
  30. NTSTATUS
  31. (*PIRQMINI_VALIDATE_TABLE) (
  32. PPCI_IRQ_ROUTING_TABLE PciIrqRoutingTable,
  33. ULONG Flags
  34. );
  35. typedef
  36. NTSTATUS
  37. (*PIRQMINI_GET_IRQ) (
  38. OUT PUCHAR Irq,
  39. IN UCHAR Link
  40. );
  41. typedef
  42. NTSTATUS
  43. (*PIRQMINI_SET_IRQ) (
  44. IN UCHAR Irq,
  45. IN UCHAR Link
  46. );
  47. typedef
  48. NTSTATUS
  49. (*PIRQMINI_GET_TRIGGER) (
  50. OUT PULONG Trigger
  51. );
  52. typedef
  53. NTSTATUS
  54. (*PIRQMINI_SET_TRIGGER) (
  55. IN ULONG Trigger
  56. );
  57. //
  58. // Chipset specific data contains a table of function pointers
  59. // to program the chipset.
  60. //
  61. typedef struct _CHIPSET_DATA {
  62. PIRQMINI_VALIDATE_TABLE ValidateTable;
  63. PIRQMINI_GET_IRQ GetIrq;
  64. PIRQMINI_SET_IRQ SetIrq;
  65. PIRQMINI_GET_TRIGGER GetTrigger;
  66. PIRQMINI_SET_TRIGGER SetTrigger;
  67. } CHIPSET_DATA, *PCHIPSET_DATA;
  68. //
  69. // Typedefs to keep source level compatibility with W9x
  70. //
  71. typedef PCI_IRQ_ROUTING_TABLE IRQINFOHEADER;
  72. typedef PPCI_IRQ_ROUTING_TABLE PIRQINFOHEADER;
  73. typedef SLOT_INFO IRQINFO;
  74. typedef PSLOT_INFO PIRQINFO;
  75. #define CDECL
  76. #define LOCAL_DATA static
  77. #define GLOBAL_DATA
  78. #define IO_Delay()
  79. #define CATENATE(x, y) x ## y
  80. #define XCATENATE(x, y) CATENATE(x, y)
  81. #define DECLARE_MINIPORT_FUNCTION(x, y) XCATENATE(x, y)
  82. //
  83. // Macro to declare a table of function pointers for the chipset
  84. // module.
  85. //
  86. #define DECLARE_CHIPSET(x) \
  87. { DECLARE_MINIPORT_FUNCTION(x, ValidateTable), \
  88. DECLARE_MINIPORT_FUNCTION(x, GetIRQ), \
  89. DECLARE_MINIPORT_FUNCTION(x, SetIRQ), \
  90. DECLARE_MINIPORT_FUNCTION(x, GetTrigger), \
  91. DECLARE_MINIPORT_FUNCTION(x, SetTrigger) \
  92. }
  93. //
  94. // Macro to declare a table of function pointers for EISA
  95. // compatible chipset module.
  96. //
  97. #define DECLARE_EISA_CHIPSET(x) \
  98. { DECLARE_MINIPORT_FUNCTION(x, ValidateTable), \
  99. DECLARE_MINIPORT_FUNCTION(x, GetIRQ), \
  100. DECLARE_MINIPORT_FUNCTION(x, SetIRQ), \
  101. EisaGetTrigger, \
  102. EisaSetTrigger \
  103. }
  104. //
  105. // Macro to declare the functions to be provided by the chipset
  106. // module.
  107. //
  108. #define DECLARE_IRQ_MINIPORT(x) \
  109. NTSTATUS \
  110. DECLARE_MINIPORT_FUNCTION(x, ValidateTable) ( \
  111. IN PPCI_IRQ_ROUTING_TABLE PciIrqRoutingTable, \
  112. IN ULONG Flags \
  113. ); \
  114. NTSTATUS \
  115. DECLARE_MINIPORT_FUNCTION(x, GetIRQ) ( \
  116. OUT PUCHAR Irq, \
  117. IN UCHAR Link \
  118. ); \
  119. NTSTATUS \
  120. DECLARE_MINIPORT_FUNCTION( x, SetIRQ) ( \
  121. IN UCHAR Irq, \
  122. IN UCHAR Link \
  123. ); \
  124. NTSTATUS \
  125. DECLARE_MINIPORT_FUNCTION(x, GetTrigger) ( \
  126. OUT PULONG Trigger \
  127. ); \
  128. NTSTATUS \
  129. DECLARE_MINIPORT_FUNCTION(x, SetTrigger) ( \
  130. IN ULONG Trigger \
  131. );
  132. //
  133. // Macro to declare the functions to be provided by the EISA
  134. // compatible chipset.
  135. //
  136. #define DECLARE_EISA_IRQ_MINIPORT(x) \
  137. NTSTATUS \
  138. DECLARE_MINIPORT_FUNCTION(x, ValidateTable) ( \
  139. IN PPCI_IRQ_ROUTING_TABLE PciIrqRoutingTable, \
  140. IN ULONG Flags \
  141. ); \
  142. NTSTATUS \
  143. DECLARE_MINIPORT_FUNCTION(x, GetIRQ) ( \
  144. OUT PUCHAR Irq, \
  145. IN UCHAR Link \
  146. ); \
  147. NTSTATUS \
  148. DECLARE_MINIPORT_FUNCTION( x, SetIRQ) ( \
  149. IN UCHAR Irq, \
  150. IN UCHAR Link \
  151. );
  152. //
  153. // Declare all miniports here.
  154. //
  155. DECLARE_EISA_IRQ_MINIPORT(Mercury)
  156. DECLARE_EISA_IRQ_MINIPORT(Triton)
  157. DECLARE_IRQ_MINIPORT(VLSI)
  158. DECLARE_IRQ_MINIPORT(OptiViper)
  159. DECLARE_EISA_IRQ_MINIPORT(SiS5503)
  160. DECLARE_IRQ_MINIPORT(VLSIEagle)
  161. DECLARE_EISA_IRQ_MINIPORT(M1523)
  162. DECLARE_IRQ_MINIPORT(NS87560)
  163. DECLARE_EISA_IRQ_MINIPORT(Compaq3)
  164. DECLARE_EISA_IRQ_MINIPORT(M1533)
  165. DECLARE_IRQ_MINIPORT(OptiFireStar)
  166. DECLARE_EISA_IRQ_MINIPORT(VT586)
  167. DECLARE_EISA_IRQ_MINIPORT(CPQOSB)
  168. DECLARE_EISA_IRQ_MINIPORT(CPQ1000)
  169. DECLARE_EISA_IRQ_MINIPORT(Cx5520)
  170. DECLARE_IRQ_MINIPORT(Toshiba)
  171. DECLARE_IRQ_MINIPORT(NEC)
  172. DECLARE_IRQ_MINIPORT(VESUVIUS)
  173. //
  174. // Prototype for misc utility functions.
  175. //
  176. NTSTATUS
  177. EisaGetTrigger (
  178. OUT PULONG Trigger
  179. );
  180. NTSTATUS
  181. EisaSetTrigger (
  182. IN ULONG Trigger
  183. );
  184. UCHAR
  185. ReadConfigUchar (
  186. IN ULONG BusNumber,
  187. IN ULONG DevFunc,
  188. IN UCHAR Offset
  189. );
  190. USHORT
  191. ReadConfigUshort (
  192. IN ULONG BusNumber,
  193. IN ULONG DevFunc,
  194. IN UCHAR Offset
  195. );
  196. ULONG
  197. ReadConfigUlong (
  198. IN ULONG BusNumber,
  199. IN ULONG DevFunc,
  200. IN UCHAR Offset
  201. );
  202. VOID
  203. WriteConfigUchar (
  204. IN ULONG BusNumber,
  205. IN ULONG DevFunc,
  206. IN UCHAR Offset,
  207. IN UCHAR Data
  208. );
  209. VOID
  210. WriteConfigUshort (
  211. IN ULONG BusNumber,
  212. IN ULONG DevFunc,
  213. IN UCHAR Offset,
  214. IN USHORT Data
  215. );
  216. VOID
  217. WriteConfigUlong (
  218. IN ULONG BusNumber,
  219. IN ULONG DevFunc,
  220. IN UCHAR Offset,
  221. IN ULONG Data
  222. );
  223. UCHAR
  224. GetMinLink (
  225. IN PPCI_IRQ_ROUTING_TABLE PciIrqRoutingTable
  226. );
  227. UCHAR
  228. GetMaxLink (
  229. IN PPCI_IRQ_ROUTING_TABLE PciIrqRoutingTable
  230. );
  231. VOID
  232. NormalizeLinks (
  233. IN PPCI_IRQ_ROUTING_TABLE PciIrqRoutingTable,
  234. IN UCHAR Adjustment
  235. );
  236. //
  237. // Bus number of the Pci Irq Router device.
  238. //
  239. extern ULONG bBusPIC;
  240. //
  241. // Slot number of Pci Irq Router device (Bits 7:3 Dev, 2:0 Func).
  242. //
  243. extern ULONG bDevFuncPIC;