Windows NT 4.0 source code leak
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.

192 lines
7.0 KiB

5 years ago
  1. /*++
  2. Copyright (c) 1993 Microsoft Corporation
  3. Copyright (c) 1994 Digital Equipment Corporation
  4. Module Name:
  5. pintolin.h
  6. Abstract:
  7. This file includes the platform-dependent Pin To Line Table
  8. for EB66 and Mustang.
  9. Author:
  10. Environment:
  11. Kernel mode
  12. Revision History:
  13. James Livingston (Digital) 23-June-1994
  14. Extracted these tables from ebintsup.c for EB66.
  15. Anonymous (Digital) date uncertain
  16. Combined tables for EB66 and Mustang to go with combined
  17. ebintsup.c
  18. Dick Bissen [DEC] 12-May-1994
  19. Removed all support of the EB66 pass1 module from the code.
  20. --*/
  21. //
  22. // These tables represent the mapping from slot number and interrupt pin
  23. // into a PCI Interrupt Vector.
  24. // On Mustang and EB66, the interrupt vector is Interrupt Request Register bit
  25. // representing that interrupt + 1.
  26. // On EB66, the value also represents the Interrupt Mask Register Bit,
  27. // since it is identical to the Interrupt Read Register. On Mustang,
  28. // the Interrupt Mask Register only allows masking of all interrupts
  29. // from the two plug-in slots.
  30. //
  31. // Formally, these mappings can be expressed as:
  32. //
  33. // PCIPinToLine:
  34. // SlotNumber.DeviceNumber x InterruptPin -> InterruptLine
  35. //
  36. // LineToVector:
  37. // InterruptLine -> InterruptVector
  38. //
  39. // VectorToIRRBit:
  40. // InterruptVector -> InterruptRequestRegisterBit
  41. //
  42. // VectorToIMRBit:
  43. // InterruptVector -> InterruptMaskRegisterBit
  44. //
  45. // SlotNumberToIDSEL:
  46. // SlotNumber.DeviceNumber -> IDSEL
  47. //
  48. // subject to following invariants (predicates must always be true):
  49. //
  50. // Slot.DeviceNumber in {0,...,15}
  51. //
  52. // InterruptPin in {1, 2, 3, 4}
  53. //
  54. // InterruptRequestRegisterBit in {0,...,15}
  55. //
  56. // InterruptMaskRegisterBit in {0,...,15}
  57. //
  58. // PCIPinToLine(SlotNumber.DeviceNumber, InterruptPin) =
  59. // PCIPinToLineTable[SlotNumber.DeviceNumber, InterruptPin]
  60. // (Table-lookup function initialized below)
  61. //
  62. // LineToVector(InterruptLine) = PCI_VECTORS + InterruptLine
  63. //
  64. // VectorToIRRBit(InterruptVector) = InterruptVector - 1
  65. //
  66. // VectorToIMRBit(InterruptVector) [see below]
  67. //
  68. // SlotNumberToIDSEL(SlotNumber.DeviceNumber) = (1 << (Slot.DeviceNumber + 11))
  69. //
  70. // where:
  71. //
  72. // SlotNumber.DeviceNumber:
  73. // Alpha AXP Platforms receive interrupts on local PCI buses only, which
  74. // are limited to 16 devices (PCI AD[11]-AD[26]). (We loose AD[17]-AD[31]
  75. // since PCI Config space is a sparse space, requiring a five-bit shift.)
  76. //
  77. // InterruptPin:
  78. // Each virtual slot has up to four interrupt pins INTA#, INTB#, INTC#, INTD#,
  79. // as per the PCI Spec. V2.0, Section 2.2.6. (FYI, only multifunction devices
  80. // use INTB#, INTC#, INTD#.)
  81. //
  82. // PCI configuration space indicates which interrupt pin a device will use
  83. // in the InterruptPin register, which has the values:
  84. //
  85. // INTA# = 1, INTB#=2, INTC#=3, INTD# = 4
  86. //
  87. // Note that there may be up to 8 functions/device on a PCI multifunction
  88. // device plugged into the option slots, e.g., Slot #0.
  89. // Each function has its own PCI configuration space, addressed
  90. // by the SlotNumber.FunctionNumber field, and will identify which
  91. // interrput pin of the four it will use in its own InterruptPin register.
  92. //
  93. // If the option is a PCI-PCI bridge, interrupts across the bridge will
  94. // somehow be combined to appear on some combination of the four
  95. // interrupt pins that the bridge plugs into.
  96. //
  97. // InterruptLine:
  98. // This PCI Configuration register, unlike x86 PC's, is maintained by
  99. // software and represents offset into PCI interrupt vectors.
  100. // Whenever HalGetBusData or HalGetBusDataByOffset is called,
  101. // HalpPCIPinToLine() computes the correct InterruptLine register value
  102. // by using the HalpPCIPinToLineTable mapping.
  103. //
  104. // InterruptRequestRegisterBit:
  105. // 0xff is used to mark an invalid IRR bit, hence an invalid request
  106. // for a vector. Also, note that the 16 bits of the EB66 IRR must
  107. // be access as two 8-bit reads.
  108. //
  109. // InterruptMaskRegisterBit:
  110. // On EB66, the PinToLine table may also be find the to write the
  111. // InterruptMaskRegister. Formally, we can express this invariant as
  112. //
  113. // VectorToIMRBit(InterrruptVector) = InterruptVector - 1
  114. //
  115. // On Mustang, the table is useless. The InterruptMaskRegister has
  116. // only two bits the completely mask all interrupts from either
  117. // Slot #0 or Slot#1 (PCI AD[17] and AD[18]):
  118. //
  119. // InterruptVector in {3,4,5,6} then VectorToIMRBit(InterruptVector) = 0
  120. // InterruptVector in {7,8,9,10} then VectorToIMRBit(InterruptVector) = 1
  121. //
  122. // IDSEL:
  123. // For accessing PCI configuration space on a local PCI bus (as opposed
  124. // to over a PCI-PCI bridge), type 0 configuration cycles must be generated.
  125. // In this case, the IDSEL pin of the device to be accessed is tied to one
  126. // of the PCI Address lines AD[11] - AD[26]. (The function field in the
  127. // PCI address is used should we be accessing a multifunction device.)
  128. // Anyway, virtual slot 0 represents the device with IDSEL = AD[11], and
  129. // so on.
  130. //
  131. //
  132. // Interrupt Vector Table Mapping for EB66
  133. //
  134. // You can limit init table to MAX_PCI_LOCAL_DEVICES entries.
  135. // The highest virtual slot between EB66 and Mustang is 9, so
  136. // MAX_PCI_LOCAL_DEVICE is defined as 9 in the platform dependent
  137. // header file (MUSTDEF.H). HalpValidPCISlot assures us that
  138. // we won't ever try to set an InterruptLine register of a slot
  139. // greater than Virtual slot 9 = PCI_AD[20].
  140. //
  141. ULONG *HalpPCIPinToLineTable;
  142. ULONG EB66PCIPinToLineTable[][4]=
  143. {
  144. { 0xff, 0xff, 0xff, 0xff }, // Virtual Slot 0 = PCI_AD[11]
  145. { 0xff, 0xff, 0xff, 0xff }, // Virtual Slot 1 = PCI_AD[12]
  146. { 0xff, 0xff, 0xff, 0xff }, // Virtual Slot 2 = PCI_AD[13]
  147. { 0xff, 0xff, 0xff, 0xff }, // Virtual Slot 3 = PCI_AD[14]
  148. { 0xff, 0xff, 0xff, 0xff }, // Virtual Slot 4 = PCI_AD[15]
  149. { 0x8, 0xff, 0xff, 0xff }, // Virtual Slot 5 = PCI_AD[16] SCSI
  150. { 0x1, 0x3, 0x5, 0xa }, // Virtual Slot 6 = PCI_AD[17] Slot #0
  151. { 0x2, 0x4, 0x9, 0xb }, // Virtual Slot 7 = PCI_AD[18] Slot #1
  152. { 0x6, 0xff, 0xff, 0xff }, // Virtual Slot 8 = PCI_AD[19] SIO
  153. { 0x7, 0xff, 0xff, 0xff } // Virtual Slot 9 = PCI_AD[20] Tulip
  154. };
  155. //
  156. // Interrupt Vector Table Mapping for EB66p
  157. //
  158. ULONG EB66PPCIPinToLineTable[][4]=
  159. {
  160. // Pin 1 Pin 2 Pin 3 Pin 4
  161. // ----- ----- ----- -----
  162. { 0xff, 0xff, 0xff, 0xff }, // Virtual Slot 0 = PCI_AD[11]
  163. { 0xff, 0xff, 0xff, 0xff }, // Virtual Slot 1 = PCI_AD[12]
  164. { 0xff, 0xff, 0xff, 0xff }, // Virtual Slot 2 = PCI_AD[13]
  165. { 0xff, 0xff, 0xff, 0xff }, // Virtual Slot 3 = PCI_AD[14]
  166. { 0xff, 0xff, 0xff, 0xff }, // Virtual Slot 4 = PCI_AD[15]
  167. { 0xff, 0xff, 0xff, 0xff }, // Virtual Slot 5 = PCI_AD[16]
  168. { 0x1, 0x6, 0xa, 0xe }, // Virtual Slot 6 = PCI_AD[17] Slot #0
  169. { 0x2, 0x7, 0xb, 0xf }, // Virtual Slot 7 = PCI_AD[18] Slot #1
  170. { 0xff, 0xff, 0xff, 0xff }, // Virtual Slot 8 = PCI_AD[19] SIO
  171. { 0x3, 0x8, 0xc, 0x10 }, // Virtual Slot 9 = PCI_AD[20] Slot #2
  172. { 0x4, 0x9, 0xd, 0x11 } // Virtual Slot 10 = PCI_AD[21] Slot #3
  173. };