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.

358 lines
14 KiB

  1. /*++
  2. Copyright (c) 1997-2000 Microsoft Corporation
  3. Module Name:
  4. data.c
  5. Abstract:
  6. Data definitions for discardable/pageable data
  7. Author:
  8. Ravisankar Pudipeddi (ravisp) - 1 Feb 1997
  9. Neil Sandlin (neilsa) June 1 1999
  10. Environment:
  11. Kernel mode
  12. Revision History :
  13. --*/
  14. #include "pch.h"
  15. #ifdef ALLOC_DATA_PRAGMA
  16. #pragma data_seg ("INIT")
  17. #endif
  18. //
  19. // Beginning of Init Data
  20. //
  21. //
  22. // Global registry values (in pcmcia\\parameters)
  23. //
  24. #define PCMCIA_REGISTRY_INTERRUPT_MASK_VALUE L"ForcedInterruptMask"
  25. #define PCMCIA_REGISTRY_INTERRUPT_FILTER_VALUE L"FilterInterruptMask"
  26. #define PCMCIA_REGISTRY_ATTRIBUTE_MEMORY_LO_VALUE L"AttributeMemoryLow"
  27. #define PCMCIA_REGISTRY_ATTRIBUTE_MEMORY_HI_VALUE L"AttributeMemoryHigh"
  28. #define PCMCIA_REGISTRY_ATTRIBUTE_MEMORY_SIZE_VALUE L"AttributeMemorySize"
  29. #define PCMCIA_REGISTRY_POWER_POLICY_VALUE L"PowerPolicy"
  30. #define PCMCIA_REGISTRY_FORCE_CTLR_DEVICE_WAKE L"ForceControllerDeviceWake"
  31. #define PCMCIA_REGISTRY_USE_POLLED_CSC_VALUE L"ForcePolledMode"
  32. #define PCMCIA_REGISTRY_DISABLE_ISA_PCI_ROUTING L"DisableIsaToPciRouting"
  33. #define PCMCIA_REGISTRY_DEFAULT_ROUTE_R2_TO_ISA L"DefaultRouteToIsa"
  34. #define PCMCIA_REGISTRY_DISABLE_ACPI_NAMESPACE_CHK L"DisableAcpiNameSpaceCheck"
  35. #define PCMCIA_REGISTRY_IRQ_ROUTE_PCI_CTLR L"IrqRouteToPciController"
  36. #define PCMCIA_REGISTRY_IRQ_ROUTE_ISA_CTLR L"IrqRouteToIsaController"
  37. #define PCMCIA_REGISTRY_IRQ_ROUTE_PCI_LOC L"IrqRouteToPciLocation"
  38. #define PCMCIA_REGISTRY_IRQ_ROUTE_ISA_LOC L"IrqRouteToIsaLocation"
  39. #define PCMCIA_REGISTRY_REPORT_MTD0002_AS_ERROR L"ReportMTD0002AsError"
  40. #define PCMCIA_REGISTRY_DEBUG_MASK L"DebugMask"
  41. #define PCMCIA_REGISTRY_EVENT_DPC_DELAY L"EventDpcDelay"
  42. #define PCMCIA_REGISTRY_IOCTL_INTERFACE L"IoctlInterface"
  43. //
  44. // Table which defines global registry settings
  45. //
  46. // RegistryName Internal Variable Default Value
  47. // ------------ ----------------- -------------
  48. GLOBAL_REGISTRY_INFORMATION GlobalRegistryInfo[] = {
  49. #if DBG
  50. PCMCIA_REGISTRY_DEBUG_MASK, &PcmciaDebugMask, 1,
  51. #endif
  52. PCMCIA_REGISTRY_INTERRUPT_MASK_VALUE, &globalOverrideIrqMask, 0,
  53. PCMCIA_REGISTRY_INTERRUPT_FILTER_VALUE, &globalFilterIrqMask, 0,
  54. PCMCIA_REGISTRY_ATTRIBUTE_MEMORY_LO_VALUE, &globalAttributeMemoryLow, PCMCIA_DEFAULT_ATTRIBUTE_MEMORY_LOW,
  55. PCMCIA_REGISTRY_ATTRIBUTE_MEMORY_HI_VALUE, &globalAttributeMemoryHigh, PCMCIA_DEFAULT_ATTRIBUTE_MEMORY_HIGH,
  56. PCMCIA_REGISTRY_ATTRIBUTE_MEMORY_SIZE_VALUE, &globalAttributeMemorySize, 0,
  57. PCMCIA_REGISTRY_POWER_POLICY_VALUE, &PcmciaPowerPolicy, PCMCIA_PP_WAKE_FROM_D0,
  58. PCMCIA_REGISTRY_FORCE_CTLR_DEVICE_WAKE, &PcmciaControllerDeviceWake, 0,
  59. PCMCIA_REGISTRY_USE_POLLED_CSC_VALUE, &initUsePolledCsc, 0,
  60. PCMCIA_REGISTRY_DISABLE_ISA_PCI_ROUTING, &pcmciaDisableIsaPciRouting, 0,
  61. PCMCIA_REGISTRY_ISA_IRQ_RESCAN_COMPLETE, &pcmciaIsaIrqRescanComplete, 0,
  62. PCMCIA_REGISTRY_IRQ_ROUTE_PCI_CTLR, &pcmciaIrqRouteToPciController, 0,
  63. PCMCIA_REGISTRY_IRQ_ROUTE_ISA_CTLR, &pcmciaIrqRouteToIsaController, 0,
  64. PCMCIA_REGISTRY_IRQ_ROUTE_PCI_LOC, &pcmciaIrqRouteToPciLocation, 0,
  65. PCMCIA_REGISTRY_IRQ_ROUTE_ISA_LOC, &pcmciaIrqRouteToIsaLocation, 0,
  66. PCMCIA_REGISTRY_DISABLE_ACPI_NAMESPACE_CHK, &initDisableAcpiNameSpaceCheck, 0,
  67. PCMCIA_REGISTRY_DEFAULT_ROUTE_R2_TO_ISA, &initDefaultRouteR2ToIsa, 0,
  68. PCMCIA_REGISTRY_EVENT_DPC_DELAY, &EventDpcDelay, PCMCIA_DEFAULT_EVENT_DPC_DELAY,
  69. PCMCIA_REGISTRY_REPORT_MTD0002_AS_ERROR, &pcmciaReportMTD0002AsError, 1,
  70. PCMCIA_REGISTRY_IOCTL_INTERFACE, &pcmciaIoctlInterface, 0
  71. };
  72. ULONG GlobalInfoCount = sizeof(GlobalRegistryInfo) / sizeof(GLOBAL_REGISTRY_INFORMATION);
  73. ULONG initUsePolledCsc;
  74. ULONG initDisableAcpiNameSpaceCheck;
  75. ULONG initDefaultRouteR2ToIsa;
  76. //
  77. // end of Init Data
  78. //
  79. #ifdef ALLOC_DATA_PRAGMA
  80. #pragma data_seg ()
  81. #endif
  82. #ifdef ALLOC_DATA_PRAGMA
  83. #pragma data_seg()
  84. #endif
  85. //
  86. // Non-Paged global variables
  87. //
  88. //
  89. // List of FDOs managed by this driver
  90. //
  91. PDEVICE_OBJECT FdoList;
  92. //
  93. // GLobal Flags
  94. //
  95. ULONG PcmciaGlobalFlags = 0;
  96. //
  97. // Event used by PcmciaWait
  98. //
  99. KEVENT PcmciaDelayTimerEvent;
  100. KSPIN_LOCK PcmciaGlobalLock;
  101. PPCMCIA_NTDETECT_DATA pNtDetectDataList = NULL;
  102. //
  103. // Various values set by PcmciaLoadGlobalRegistryValues
  104. //
  105. ULONG EventDpcDelay;
  106. ULONG PcmciaPowerPolicy;
  107. LONG PcmciaControllerDeviceWake;
  108. ULONG globalOverrideIrqMask;
  109. ULONG globalFilterIrqMask;
  110. ULONG globalAttributeMemoryLow;
  111. ULONG globalAttributeMemoryHigh;
  112. ULONG globalAttributeMemorySize;
  113. ULONG pcmciaDisableIsaPciRouting;
  114. ULONG pcmciaIsaIrqRescanComplete;
  115. ULONG pcmciaIrqRouteToPciController;
  116. ULONG pcmciaIrqRouteToIsaController;
  117. ULONG pcmciaIrqRouteToPciLocation;
  118. ULONG pcmciaIrqRouteToIsaLocation;
  119. ULONG pcmciaReportMTD0002AsError;
  120. ULONG pcmciaIoctlInterface;
  121. #if DBG
  122. ULONG PcmciaDebugMask;
  123. #endif
  124. #ifdef ALLOC_DATA_PRAGMA
  125. #pragma data_seg("PAGE")
  126. #endif
  127. //
  128. // Paged const tables
  129. //
  130. const
  131. PCI_CONTROLLER_INFORMATION PciControllerInformation[] = {
  132. // Vendor id Device Id Controller type
  133. // -------------------------------------------------------------------------------
  134. PCI_CIRRUSLOGIC_VENDORID, PCI_CLPD6729_DEVICEID, PcmciaCLPD6729,
  135. PCI_CIRRUSLOGIC_VENDORID, PCI_CLPD6832_DEVICEID, PcmciaCLPD6832,
  136. PCI_CIRRUSLOGIC_VENDORID, PCI_CLPD6834_DEVICEID, PcmciaCLPD6834,
  137. PCI_TI_VENDORID, PCI_TI1031_DEVICEID, PcmciaTI1031,
  138. PCI_TI_VENDORID, PCI_TI1130_DEVICEID, PcmciaTI1130,
  139. PCI_TI_VENDORID, PCI_TI1131_DEVICEID, PcmciaTI1131,
  140. PCI_TI_VENDORID, PCI_TI1250_DEVICEID, PcmciaTI1250,
  141. PCI_TI_VENDORID, PCI_TI1220_DEVICEID, PcmciaTI1220,
  142. PCI_TI_VENDORID, PCI_TI1251B_DEVICEID, PcmciaTI1251B,
  143. PCI_TI_VENDORID, PCI_TI1450_DEVICEID, PcmciaTI1450,
  144. PCI_TOSHIBA_VENDORID, PCI_TOPIC95_DEVICEID, PcmciaTopic95,
  145. PCI_RICOH_VENDORID, PCI_RL5C465_DEVICEID, PcmciaRL5C465,
  146. PCI_RICOH_VENDORID, PCI_RL5C466_DEVICEID, PcmciaRL5C466,
  147. PCI_RICOH_VENDORID, PCI_RL5C475_DEVICEID, PcmciaRL5C475,
  148. PCI_RICOH_VENDORID, PCI_RL5C476_DEVICEID, PcmciaRL5C476,
  149. PCI_RICOH_VENDORID, PCI_RL5C478_DEVICEID, PcmciaRL5C478,
  150. PCI_DATABOOK_VENDORID, PCI_DB87144_DEVICEID, PcmciaDB87144,
  151. PCI_OPTI_VENDORID, PCI_OPTI82C814_DEVICEID, PcmciaOpti82C814,
  152. PCI_OPTI_VENDORID, PCI_OPTI82C824_DEVICEID, PcmciaOpti82C824,
  153. PCI_TRIDENT_VENDORID, PCI_TRID82C194_DEVICEID, PcmciaTrid82C194,
  154. PCI_NEC_VENDORID, PCI_NEC66369_DEVICEID, PcmciaNEC66369,
  155. // --------------------------------------------------------------------
  156. // Additional database entries go above this line
  157. //
  158. PCI_INVALID_VENDORID, 0, 0,
  159. };
  160. const
  161. PCI_VENDOR_INFORMATION PciVendorInformation[] = {
  162. PCI_TI_VENDORID, PcmciaTI,
  163. PCI_TOSHIBA_VENDORID, PcmciaTopic,
  164. PCI_RICOH_VENDORID, PcmciaRicoh,
  165. PCI_O2MICRO_VENDORID, PcmciaO2Micro,
  166. PCI_NEC_VENDORID, PcmciaNEC,
  167. PCI_DATABOOK_VENDORID, PcmciaDatabook,
  168. PCI_OPTI_VENDORID, PcmciaOpti,
  169. PCI_TRIDENT_VENDORID, PcmciaTrid,
  170. PCI_INVALID_VENDORID, 0
  171. };
  172. const
  173. DEVICE_DISPATCH_TABLE DeviceDispatchTable[] = {
  174. {PcmciaIntelCompatible, NULL, PcicSetPower, NULL, NULL, NULL},
  175. {PcmciaPciPcmciaBridge, NULL, PcicSetPower, NULL, NULL, NULL},
  176. {PcmciaElcController, NULL, PcicSetPower, NULL, NULL, NULL},
  177. {PcmciaCardBusCompatible, NULL, CBSetPower, NULL, NULL, CBSetWindowPage},
  178. {PcmciaDatabook, NULL, TcicSetPower, NULL, NULL, NULL},
  179. {PcmciaTI, TIInitialize, CBSetPower, NULL, TISetZV, TISetWindowPage},
  180. {PcmciaCirrusLogic,CLInitialize, CLSetPower, NULL, CLSetZV, CBSetWindowPage},
  181. {PcmciaTopic, TopicInitialize, TopicSetPower, TopicSetAudio, TopicSetZV, CBSetWindowPage},
  182. {PcmciaRicoh, RicohInitialize, CBSetPower, NULL, RicohSetZV, CBSetWindowPage},
  183. {PcmciaDatabookCB, DBInitialize, CBSetPower, NULL, DBSetZV, CBSetWindowPage},
  184. {PcmciaOpti, OptiInitialize, OptiSetPower, NULL, OptiSetZV, NULL},
  185. {PcmciaTrid, NULL, CBSetPower, NULL, NULL, NULL},
  186. {PcmciaO2Micro, O2MInitialize, O2MSetPower, NULL, O2MSetZV, CBSetWindowPage},
  187. {PcmciaNEC_98, NULL, PcicSetPower, NULL, NULL, NULL},
  188. {PcmciaNEC, NULL, CBSetPower, NULL, NULL, NULL},
  189. //------------------------------------------------------------------
  190. // Additional dispatch table entries go above this line
  191. //
  192. {PcmciaInvalidControllerClass, NULL, NULL, NULL, NULL}
  193. };
  194. const
  195. PCMCIA_ID_ENTRY PcmciaAdapterHardwareIds[] = {
  196. PcmciaIntelCompatible, "*PNP0E00",
  197. PcmciaElcController, "*PNP0E02",
  198. PcmciaDatabook, "*DBK0000",
  199. PcmciaCLPD6729, "*PNP0E01",
  200. PcmciaNEC98, "*nEC1E01",
  201. PcmciaNEC98102, "*nEC8091",
  202. PcmciaInvalidControllerType, 0
  203. };
  204. const
  205. PCMCIA_REGISTER_INIT PcicRegisterInitTable[] = {
  206. PCIC_INTERRUPT, IGC_PCCARD_RESETLO,
  207. PCIC_CARD_CHANGE, 0x00,
  208. PCIC_CARD_INT_CONFIG, 0x00,
  209. PCIC_ADD_WIN_ENA, 0x00,
  210. PCIC_IO_CONTROL, 0x00,
  211. //
  212. // Init the 2 I/O windows
  213. //
  214. PCIC_IO_ADD0_STRT_L, 0x00,
  215. PCIC_IO_ADD0_STRT_H, 0x00,
  216. PCIC_IO_ADD0_STOP_L, 0x00,
  217. PCIC_IO_ADD0_STOP_H, 0x00,
  218. PCIC_IO_ADD1_STRT_L, 0x00,
  219. PCIC_IO_ADD1_STRT_H, 0x00,
  220. PCIC_IO_ADD1_STOP_L, 0x00,
  221. PCIC_IO_ADD1_STOP_H, 0x00,
  222. //
  223. // Init all 5 memory windows
  224. //
  225. PCIC_MEM_ADD0_STRT_L, 0xFF,
  226. PCIC_MEM_ADD0_STRT_H, 0x0F,
  227. PCIC_MEM_ADD0_STOP_L, 0xFF,
  228. PCIC_MEM_ADD0_STOP_H, 0x0F,
  229. PCIC_CRDMEM_OFF_ADD0_L, 0x00,
  230. PCIC_CRDMEM_OFF_ADD0_H, 0x00,
  231. PCIC_MEM_ADD1_STRT_L, 0xFF,
  232. PCIC_MEM_ADD1_STRT_H, 0x0F,
  233. PCIC_MEM_ADD1_STOP_L, 0xFF,
  234. PCIC_MEM_ADD1_STOP_H, 0x0F,
  235. PCIC_CRDMEM_OFF_ADD1_L, 0x00,
  236. PCIC_CRDMEM_OFF_ADD1_H, 0x00,
  237. PCIC_MEM_ADD2_STRT_L, 0xFF,
  238. PCIC_MEM_ADD2_STRT_H, 0x0F,
  239. PCIC_MEM_ADD2_STOP_L, 0xFF,
  240. PCIC_MEM_ADD2_STOP_H, 0x0F,
  241. PCIC_CRDMEM_OFF_ADD2_L, 0x00,
  242. PCIC_CRDMEM_OFF_ADD2_H, 0x00,
  243. PCIC_MEM_ADD3_STRT_L, 0xFF,
  244. PCIC_MEM_ADD3_STRT_H, 0x0F,
  245. PCIC_MEM_ADD3_STOP_L, 0xFF,
  246. PCIC_MEM_ADD3_STOP_H, 0x0F,
  247. PCIC_CRDMEM_OFF_ADD3_L, 0x00,
  248. PCIC_CRDMEM_OFF_ADD3_H, 0x00,
  249. PCIC_MEM_ADD4_STRT_L, 0xFF,
  250. PCIC_MEM_ADD4_STRT_H, 0x0F,
  251. PCIC_MEM_ADD4_STOP_L, 0xFF,
  252. PCIC_MEM_ADD4_STOP_H, 0x0F,
  253. PCIC_CRDMEM_OFF_ADD4_L, 0x00,
  254. PCIC_CRDMEM_OFF_ADD4_H, 0x00,
  255. //
  256. // Any other registers go here
  257. //
  258. 0xFFFFFFFF, 0x00
  259. };
  260. #ifdef ALLOC_DATA_PRAGMA
  261. #pragma data_seg()
  262. #endif
  263. //
  264. // Non-paged const tables
  265. //
  266. //
  267. // This should be non-pageable since it is referenced by the
  268. // Power management code - most of which runs at raised IRQL
  269. // This represents the default set of registers that need to be
  270. // saved/restored on a cardbus controller power-down/power-up
  271. //
  272. //
  273. // Register context for the pcmcia controller
  274. //
  275. const
  276. PCMCIA_CONTEXT_RANGE DefaultPciContextSave[] = {
  277. CFGSPACE_BRIDGE_CTRL, 2,
  278. CFGSPACE_LEGACY_MODE_BASE_ADDR, 4,
  279. // CFGSPACE_CB_LATENCY_TIMER, 1,
  280. 0, 0
  281. };
  282. //
  283. // cardbus socket registers required to be saved
  284. //
  285. const
  286. PCMCIA_CONTEXT_RANGE DefaultCardbusContextSave[] = {
  287. 0, 0
  288. };
  289. //
  290. // cardbus socket registers excluded from context save
  291. //
  292. const
  293. PCMCIA_CONTEXT_RANGE ExcludeCardbusContextRange[] = {
  294. CARDBUS_SOCKET_EVENT_REG, 0x4,
  295. CARDBUS_SOCKET_PRESENT_STATE_REG, 0xc,
  296. 0, 0
  297. };
  298. //
  299. // The following table defines any devices that need special
  300. // attention during configuration. Note that values of 0xffff
  301. // mean "don't care". The table is scanned until a match is made
  302. // for the current device.
  303. //
  304. // Values are:
  305. // validentry, devicetype, manufacturer, code, crc, configdelay1, configdelay2, configdelay3, configflags
  306. //
  307. // delay values are in milliseconds
  308. //
  309. const
  310. PCMCIA_DEVICE_CONFIG_PARAMS DeviceConfigParams[] = {
  311. 1, PCCARD_TYPE_MODEM, 0x109, 0x505, 0xD293, 3100, 900, 0, CONFIG_WORKER_APPLY_MODEM_HACK, // motorola BitSurfr 56k
  312. 1, PCCARD_TYPE_MODEM, 0xffff, 0xffff, 0xffff, 0, 1800, 0, 0, // any other modem
  313. 1, PCCARD_TYPE_ATA, 0xffff, 0xffff, 0xffff, 0, 0, 2000, 0, // any ata device
  314. 0
  315. };