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.

366 lines
9.8 KiB

  1. /*++
  2. Copyright (c) 1991 Microsoft Corporation
  3. Module Name:
  4. ixdat.c
  5. Abstract:
  6. Declares various data which is initialize data, or pagable data.
  7. Author:
  8. Environment:
  9. Kernel mode only.
  10. Revision History:
  11. --*/
  12. #include "halp.h"
  13. #include "apic.inc"
  14. #include "pci.h"
  15. #include "pcip.h"
  16. #include "pcmp_nt.inc"
  17. #include "ixsleep.h"
  18. #ifdef ALLOC_DATA_PRAGMA
  19. #pragma data_seg("INIT")
  20. #endif
  21. //
  22. // The following data is only valid during system initialiation
  23. // and the memory will be re-claimed by the system afterwards
  24. //
  25. ADDRESS_USAGE HalpDefaultPcIoSpace = {
  26. NULL, CmResourceTypePort, InternalUsage,
  27. {
  28. #ifndef MCA
  29. 0x000, 0x10, // ISA DMA
  30. 0x0C0, 0x10, // ISA DMA
  31. #else
  32. 0x000, 0x20, // MCA DMA
  33. 0x0C0, 0x20, // MCA DMA
  34. #endif
  35. 0x080, 0x10, // DMA
  36. 0x020, 0x2, // PIC
  37. 0x0A0, 0x2, // Cascaded PIC
  38. 0x040, 0x4, // Timer1, Referesh, Speaker, Control Word
  39. 0x048, 0x4, // Timer2, Failsafe
  40. #if 0 // HACKHACK Remove for now since Intelille mouse software claims it.
  41. 0x061, 0x1, // NMI (system control port B)
  42. #endif
  43. 0x092, 0x1, // system control port A
  44. 0x070, 0x2, // Cmos/NMI enable
  45. #ifdef MCA
  46. 0x074, 0x3, // Extended CMOS
  47. 0x090, 0x2, // Arbritration Control Port, Card Select Feedback
  48. 0x093, 0x2, // Reserved, System board setup
  49. 0x096, 0x2, // POS channel select
  50. #endif
  51. 0x0F0, 0x10, // coprocessor ports
  52. 0xCF8, 0x8, // PCI Config Space Access Pair
  53. 0,0
  54. }
  55. };
  56. ADDRESS_USAGE HalpEisaIoSpace = {
  57. NULL, CmResourceTypePort, InternalUsage,
  58. {
  59. 0x0D0, 0x10, // DMA
  60. 0x400, 0x10, // DMA
  61. 0x480, 0x10, // DMA
  62. 0x4C2, 0xE, // DMA
  63. 0x4D4, 0x2C, // DMA
  64. 0x461, 0x2, // Extended NMI
  65. 0x464, 0x2, // Last Eisa Bus Muster granted
  66. 0x4D0, 0x2, // edge/level control registers
  67. 0xC84, 0x1, // System board enable
  68. 0, 0
  69. }
  70. };
  71. #ifndef ACPI_HAL
  72. ADDRESS_USAGE HalpDetectedROM = {
  73. NULL,
  74. CmResourceTypeMemory,
  75. InternalUsage | RomResource,
  76. {
  77. 0,0, // 32 ROM blocks, get initialized in ixusage.c
  78. 0,0,
  79. 0,0,
  80. 0,0,
  81. 0,0,
  82. 0,0,
  83. 0,0,
  84. 0,0,
  85. 0,0,
  86. 0,0,
  87. 0,0,
  88. 0,0,
  89. 0,0,
  90. 0,0,
  91. 0,0,
  92. 0,0,
  93. 0,0,
  94. 0,0,
  95. 0,0,
  96. 0,0,
  97. 0,0,
  98. 0,0,
  99. 0,0,
  100. 0,0,
  101. 0,0,
  102. 0,0,
  103. 0,0,
  104. 0,0,
  105. 0,0,
  106. 0,0,
  107. 0,0,
  108. 0,0,
  109. 0,0
  110. }
  111. };
  112. #endif
  113. ADDRESS_USAGE HalpImcrIoSpace = {
  114. NULL, CmResourceTypeMemory, InternalUsage,
  115. {
  116. 0x022, 0x02, // ICMR ports
  117. 0, 0
  118. }
  119. };
  120. //
  121. // From usage.c
  122. //
  123. WCHAR HalpSzSystem[] = L"\\Registry\\Machine\\Hardware\\Description\\System";
  124. WCHAR HalpSzSerialNumber[] = L"Serial Number";
  125. ADDRESS_USAGE *HalpAddressUsageList = NULL;
  126. //
  127. // From ixpcibus.c
  128. //
  129. WCHAR rgzMultiFunctionAdapter[] = L"\\Registry\\Machine\\Hardware\\Description\\System\\MultifunctionAdapter";
  130. WCHAR rgzConfigurationData[] = L"Configuration Data";
  131. WCHAR rgzIdentifier[] = L"Identifier";
  132. WCHAR rgzPCIIdentifier[] = L"PCI";
  133. WCHAR rgzPCICardList[] = L"\\Registry\\Machine\\System\\CurrentControlSet\\Control\\PnP\\PCI\\CardList";
  134. //
  135. // From ixpcibrd.c
  136. //
  137. WCHAR rgzReservedResources[] = L"\\Registry\\Machine\\System\\CurrentControlSet\\Control\\SystemResources\\ReservedResources";
  138. //
  139. // From ixinfo.c
  140. //
  141. WCHAR rgzSuspendCallbackName[] = L"\\Callback\\SuspendHibernateSystem";
  142. //
  143. // Strings used for boot.ini options
  144. // from mphal.c
  145. //
  146. UCHAR HalpSzBreak[] = "BREAK";
  147. UCHAR HalpSzOneCpu[] = "ONECPU";
  148. UCHAR HalpSzPciLock[] = "PCILOCK";
  149. UCHAR HalpSzTimerRes[] = "TIMERES";
  150. UCHAR HalpSzClockLevel[]= "CLKLVL";
  151. UCHAR HalpSzUse8254[] = "USE8254";
  152. UCHAR HalpSzInterruptAffinity[]= "INTAFFINITY";
  153. UCHAR HalpSzForceClusterMode[]= "MAXPROCSPERCLUSTER";
  154. //
  155. // From ixcmos.asm
  156. //
  157. UCHAR HalpSerialLen = 0;
  158. UCHAR HalpSerialNumber[31] = {0};
  159. //
  160. // Copy of floating structure
  161. // from detection code
  162. //
  163. struct FloatPtrStruct HalpFloatStruct;
  164. UCHAR rgzBadHal[] = "\n\n" \
  165. "HAL: This HAL.DLL requires an MPS version 1.1 system\n" \
  166. "Replace HAL.DLL with the correct hal for this system\n" \
  167. "The system is halting";
  168. UCHAR rgzRTCNotFound[] = "HAL: No RTC device interrupt\n";
  169. //
  170. // Table to translate PCMP BusType to NT INTERFACE_TYPEs
  171. // All Eisa, Isa, VL buses are squashed onto one space
  172. // from mpsys.c
  173. //
  174. NTSTATUS
  175. HalpAddEisaBus (
  176. PBUS_HANDLER Bus
  177. );
  178. NTSTATUS
  179. HalpAddPciBus (
  180. PBUS_HANDLER Bus
  181. );
  182. //
  183. // From ixmca.c
  184. //
  185. UCHAR MsgMCEPending[] = MSG_MCE_PENDING;
  186. WCHAR rgzSessionManager[] = L"Session Manager";
  187. WCHAR rgzEnableMCE[] = L"EnableMCE";
  188. WCHAR rgzEnableMCA[] = L"EnableMCA";
  189. WCHAR rgzEnableCMC[] = L"EnableCMC";
  190. WCHAR rgzNoMCABugCheck[] = L"NoMCABugCheck";
  191. //
  192. // Timers
  193. //
  194. ULONGLONG HalpProc0TSCHz;
  195. #ifdef ALLOC_DATA_PRAGMA
  196. #pragma data_seg()
  197. #endif
  198. UCHAR HalpAuthenticAMD[]= "AuthenticAMD";
  199. UCHAR HalpGenuineIntel[]= "GenuineIntel";
  200. ULONG HalpFeatureBits = 0;
  201. UCHAR HalpDevPolarity [4][2] = {
  202. //
  203. // Edge Level
  204. { CFG_HIGH, CFG_LOW }, // 00 - bus def
  205. { CFG_HIGH, CFG_HIGH }, // 01 - high
  206. { CFG_HIGH, CFG_LOW }, // 10 - undefined
  207. { CFG_LOW, CFG_LOW } // 11 - low
  208. };
  209. UCHAR HalpDevLevel [2][4] = {
  210. // must-be must-be
  211. // edge level edge level
  212. { CFG_EDGE, CFG_EDGE, CFG_EDGE, CFG_ERR_LEVEL }, // 0 - edge
  213. { CFG_LEVEL, CFG_LEVEL, CFG_ERR_EDGE, CFG_LEVEL } // 1 - level
  214. };
  215. //
  216. // Stuff for sleep or hibernate.
  217. //
  218. MOTHERBOARD_CONTEXT HalpMotherboardState = {0};
  219. BOOLEAN HalpOwnedDisplayBeforeSleep = FALSE;
  220. volatile BOOLEAN HalpHiberInProgress = FALSE;
  221. BOOLEAN HalpDisableHibernate = FALSE;
  222. USHORT HalpPciIrqMask = 0;
  223. USHORT HalpEisaIrqMask = 0;
  224. USHORT HalpEisaIrqIgnore = 0x1000;
  225. //
  226. // from mpdetect.c (needed because we reparse MPS table on hibernate resume)
  227. //
  228. UCHAR rgzNoMpsTable[] = "HAL: No MPS Table Found\n";
  229. UCHAR rgzNoApic[] = "HAL: No IO APIC Found\n";
  230. UCHAR rgzBadApicVersion[] = "HAL: Bad APIC Version\n";
  231. UCHAR rgzApicNotVerified[] = "HAL: APIC not verified\n";
  232. UCHAR rgzMPPTRCheck[] = "HAL: MP_PTR invalid checksum\n";
  233. UCHAR rgzNoMPTable[] = "HAL: MPS MP structure not found\n";
  234. UCHAR rgzMPSBadSig[] = "HAL: MPS table invalid signature\n";
  235. UCHAR rgzMPSBadCheck[] = "HAL: MPS table invalid checksum\n";
  236. UCHAR rgzBadDefault[] = "HAL: MPS default configuration unknown\n";
  237. UCHAR rgzNoMem[] = "HAL: Out of Memory\n";
  238. //
  239. // PAGELK handle
  240. //
  241. PVOID HalpSleepPageLock = NULL;
  242. PVOID HalpSleepPage16Lock = NULL;
  243. //
  244. // Timer watchdog variables
  245. //
  246. ULONG HalpTimerWatchdogEnabled = 0;
  247. ULONG HalpTimerWatchdogStorageOverflow = 0;
  248. PVOID HalpTimerWatchdogCurFrame;
  249. PVOID HalpTimerWatchdogLastFrame;
  250. PCHAR HalpTimerWatchdogStorage;
  251. #ifndef ACPI_HAL
  252. PCMPBUSTRANS HalpTypeTranslation[] = {
  253. // "INTERN", can't be interface_type internal
  254. "CBUS ", FALSE, CFG_EDGE, CBus, NULL, 0, 0,
  255. "CBUSII", FALSE, CFG_EDGE, CBus, NULL, 0, 0,
  256. "EISA ", FALSE, CFG_EDGE, Eisa, HalpAddEisaBus, EisaConfiguration, 0,
  257. "ISA ", FALSE, CFG_EDGE, Eisa, HalpAddEisaBus, EisaConfiguration, 0,
  258. "MCA ", FALSE, CFG_MB_LEVEL, MicroChannel, NULL, 0, 0,
  259. "MPI ", FALSE, CFG_EDGE, MPIBus, NULL, 0, 0,
  260. "MPSA ", FALSE, CFG_EDGE, MPSABus, NULL, 0, 0,
  261. "NUBUS ", FALSE, CFG_EDGE, NuBus, NULL, 0, 0,
  262. "PCI ", TRUE, CFG_MB_LEVEL, PCIBus, HalpAddPciBus, PCIConfiguration, sizeof (PCIPBUSDATA),
  263. "PCMCIA", FALSE, CFG_EDGE, PCMCIABus, NULL, 0, 0,
  264. "TC ", FALSE, CFG_EDGE, TurboChannel, NULL, 0, 0,
  265. "VL ", FALSE, CFG_EDGE, Eisa, HalpAddEisaBus, EisaConfiguration, 0,
  266. "VME ", FALSE, CFG_EDGE, VMEBus, NULL, 0, 0,
  267. "NEC98 ", FALSE, CFG_EDGE, Isa, HalpAddEisaBus, EisaConfiguration, 0,
  268. NULL, FALSE, CFG_EDGE, MaximumInterfaceType, NULL, 0, 0
  269. } ;
  270. #endif
  271. UCHAR HalpInitLevel [4][4] = {
  272. // must-be must-be
  273. // edge level edge level
  274. { CFG_EDGE, CFG_LEVEL, CFG_MB_EDGE, CFG_MB_LEVEL }, // 00 - bus def
  275. { CFG_MB_EDGE, CFG_MB_EDGE, CFG_MB_EDGE, CFG_ERR_MB_LEVEL }, // 01 - edge
  276. { CFG_ERR_EDGE, CFG_ERR_LEVEL, CFG_ERR_MB_EDGE, CFG_ERR_MB_LEVEL }, // 10 - undefined
  277. { CFG_MB_LEVEL, CFG_MB_LEVEL, CFG_ERR_MB_EDGE, CFG_MB_LEVEL } // 11 - level
  278. };
  279. BOOLEAN HalpELCRChecked;
  280. //
  281. // From mpaddr.c
  282. //
  283. USHORT HalpIoCompatibleRangeList0[] = {
  284. 0x0100, 0x03ff, 0x0500, 0x07FF, 0x0900, 0x0BFF, 0x0D00, 0x0FFF,
  285. 0, 0
  286. };
  287. USHORT HalpIoCompatibleRangeList1[] = {
  288. 0x03B0, 0x03BB, 0x03C0, 0x03DF, 0x07B0, 0x07BB, 0x07C0, 0x07DF,
  289. 0x0BB0, 0x0BBB, 0x0BC0, 0x0BDF, 0x0FB0, 0x0FBB, 0x0FC0, 0x0FDF,
  290. 0, 0
  291. };