Source code of Windows XP (NT5)
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.

506 lines
12 KiB

  1. /*++
  2. Copyright (c) 1994 NEC Corporation
  3. Copyright (c) 1994 NEC Software, Ltd.
  4. Module Name:
  5. nec98.h (cf. eisa.h)
  6. Abstract:
  7. The module defines the structures, and defines for the NEC PC98 chip set.
  8. Author:
  9. Michio Nakamura 20-Sep-1994
  10. Revision History:
  11. Takaaki Tochizawa 13-Mar-1998 Add 2nd DMA for FIR.
  12. --*/
  13. #ifndef _EISA_
  14. #define _EISA_
  15. //
  16. // Define the DMA page register structure.
  17. //
  18. #define DMA_BANK_A31_A24_DR0 0xe05
  19. #define DMA_BANK_A31_A24_DR1 0xe07
  20. #define DMA_BANK_A31_A24_DR2 0xe09
  21. #define DMA_BANK_A31_A24_DR3 0xe0b
  22. #define DMA_INC_ENABLE_A31_A24 0xe0f
  23. //
  24. // Define the DMA 2 page register structure.
  25. //
  26. #define DMA2_BANK_A31_A24_DR5 0xf07
  27. #define DMA2_BANK_A31_A24_DR6 0xf09
  28. #define DMA2_BANK_A31_A24_DR7 0xf0b
  29. #define DMA2_INC_ENABLE_A31_A24 0xf0f
  30. //
  31. // Define the DMA 2 mode change register
  32. //
  33. #define DMA2_MODE_CHANGE 0xf4
  34. #define DMA2_MODE_8237_COMP 0x0
  35. #define DMA2_MODE_71037_A 0x1
  36. #define DMA2_MODE_71037_B 0x2
  37. #define DMA2_MODE_71037_C 0x3
  38. #define DMA_STATUS 0xc8
  39. #define DMA_COMMAND 0xc8
  40. #define SINGLE_MASK 0xca
  41. #define MODE 0xcb
  42. #define CLEAR_BYTE_POINTER 0xcc
  43. #define CLEAR_MASK 0xce
  44. typedef struct _DMA_PAGE{
  45. UCHAR Reserved1; // offset 0x20
  46. UCHAR Channel1; // offset 0x21
  47. UCHAR Reserved2;
  48. UCHAR Channel2; // offset 0x23
  49. UCHAR Reserved3;
  50. UCHAR Channel3; // offset 0x25
  51. UCHAR Reserved4;
  52. UCHAR Channel0; // offset 0x27
  53. UCHAR Reserved5[0x120-0x27];// offset 0x120
  54. UCHAR Channel5; // offset 0x121
  55. UCHAR Reserved6;
  56. UCHAR Channel6; // offset 0x123
  57. UCHAR Reserved7;
  58. UCHAR Channel7; // offset 0x125
  59. UCHAR Reserved8[4];
  60. }DMA_PAGE, *PDMA_PAGE;
  61. //
  62. // Define the DMA stop register structure.
  63. //
  64. typedef struct _DMA_CHANNEL_STOP {
  65. UCHAR ChannelLsb;
  66. UCHAR ChannelMsb;
  67. UCHAR ChannelHsb;
  68. UCHAR Reserved;
  69. }DMA_CHANNEL_STOP, *PDMA_CHANNEL_STOP;
  70. //
  71. // Define DMA 1 address and count structure.
  72. //
  73. typedef struct _DMA1_ADDRESS_COUNT {
  74. UCHAR Reserved1;
  75. UCHAR DmaBaseAddress;
  76. UCHAR Reserved2;
  77. UCHAR DmaBaseCount;
  78. }DMA1_ADDRESS_COUNT, *PDMA1_ADDRESS_COUNT;
  79. //
  80. // Define DMA 2 address and count structure.
  81. //
  82. typedef struct _DMA2_ADDRESS_COUNT {
  83. UCHAR Reserved1;
  84. UCHAR DmaBaseAddress;
  85. UCHAR Reserved2;
  86. UCHAR DmaBaseCount;
  87. }DMA2_ADDRESS_COUNT, *PDMA2_ADDRESS_COUNT;
  88. //
  89. // Define DMA 1 control register structure.
  90. //
  91. typedef struct _DMA1_CONTROL {
  92. DMA1_ADDRESS_COUNT DmaAddressCount[4];
  93. UCHAR Reserved1;
  94. UCHAR DmaStatus; //offset 0x11
  95. UCHAR Reserved2;
  96. UCHAR DmaRequest; //offset 0x13
  97. UCHAR Reserved3;
  98. UCHAR SingleMask; //offset 0x15
  99. UCHAR Reserved4;
  100. UCHAR Mode; //offset 0x17
  101. UCHAR Reserved5;
  102. UCHAR ClearBytePointer; //offset 0x19
  103. UCHAR Reserved6;
  104. UCHAR MasterClear; //offset 0x1b
  105. UCHAR Reserved7;
  106. UCHAR ClearMask; //offset 0x1d
  107. UCHAR Reserved;
  108. UCHAR AllMask; //offset 0x1f
  109. }DMA1_CONTROL, *PDMA1_CONTROL;
  110. //
  111. // Define DMA 2 control register structure.
  112. //
  113. typedef struct _DMA2_CONTROL {
  114. UCHAR Reserved8[0x100-0x20];//offset 0x20
  115. DMA2_ADDRESS_COUNT DmaAddressCount[4]; //offset 0x100
  116. UCHAR Reserved1;
  117. UCHAR DmaStatus; //offset 0x111
  118. UCHAR Reserved2;
  119. UCHAR DmaRequest; //offset 0x113
  120. UCHAR Reserved3;
  121. UCHAR SingleMask; //offset 0x115
  122. UCHAR Reserved4;
  123. UCHAR Mode; //offset 0x117
  124. UCHAR Reserved5;
  125. UCHAR ClearBytePointer; //offset 0x119
  126. UCHAR Reserved6;
  127. UCHAR MasterClear; //offset 0x11b
  128. UCHAR Reserved7;
  129. UCHAR ClearMask; //offset 0x11d
  130. UCHAR Reserved;
  131. UCHAR AllMask; //offset 0x11f
  132. UCHAR Reserved9[10]; //offset 0x120
  133. }DMA2_CONTROL, *PDMA2_CONTROL;
  134. //
  135. // Define Timer control register structure.
  136. //
  137. typedef struct _TIMER_CONTROL {
  138. UCHAR BcdMode : 1;
  139. UCHAR Mode : 3;
  140. UCHAR SelectByte : 2;
  141. UCHAR SelectCounter : 2;
  142. }TIMER_CONTROL, *PTIMER_CONTROL;
  143. //
  144. // Define Timer status register structure.
  145. //
  146. typedef struct _TIMER_STATUS {
  147. UCHAR BcdMode : 1;
  148. UCHAR Mode : 3;
  149. UCHAR SelectByte : 2;
  150. UCHAR CrContentsMoved : 1;
  151. UCHAR OutPin : 1;
  152. }TIMER_STATUS, *PTIMER_STATUS;
  153. //
  154. // Define Mode values.
  155. //
  156. #define TM_SIGNAL_END_OF_COUNT 0
  157. #define TM_ONE_SHOT 1
  158. #define TM_RATE_GENERATOR 2
  159. #define TM_SQUARE_WAVE 3
  160. #define TM_SOFTWARE_STROBE 4
  161. #define TM_HARDWARE_STROBE 5
  162. //
  163. // Define SelectByte values
  164. //
  165. #define SB_COUNTER_LATCH 0
  166. #define SB_LSB_BYTE 1
  167. #define SB_MSB_BYTE 2
  168. #define SB_LSB_THEN_MSB 3
  169. //
  170. // Define SelectCounter values.
  171. //
  172. #define SELECT_COUNTER_0 0
  173. #define SELECT_COUNTER_1 1
  174. #define SELECT_COUNTER_2 2
  175. #define SELECT_READ_BACK 3
  176. //
  177. // Define Timer clock for speaker.
  178. //
  179. #define TIMER_CLOCK_IN 1193167 // 1.193Mhz
  180. //
  181. // Define NMI Status/Control register structure.
  182. //
  183. typedef struct _NMI_STATUS {
  184. UCHAR SpeakerGate : 1;
  185. UCHAR SpeakerData : 1;
  186. UCHAR DisableEisaParity : 1;
  187. UCHAR DisableNmi : 1;
  188. UCHAR RefreshToggle : 1;
  189. UCHAR SpeakerTimer : 1;
  190. UCHAR IochkNmi : 1;
  191. UCHAR ParityNmi : 1;
  192. }NMI_STATUS, *PNMI_STATUS;
  193. //
  194. // Define NMI Enable register structure.
  195. //
  196. typedef struct _NMI_ENABLE {
  197. UCHAR RtClockAddress : 7;
  198. UCHAR NmiDisable : 1;
  199. }NMI_ENABLE, *PNMI_ENABLE;
  200. //
  201. // Define the NMI extended status and control register structure.
  202. //
  203. typedef struct _NMI_EXTENDED_CONTROL {
  204. UCHAR BusReset : 1;
  205. UCHAR EnableNmiPort : 1;
  206. UCHAR EnableFailSafeNmi : 1;
  207. UCHAR EnableBusMasterTimeout : 1;
  208. UCHAR Reserved1 : 1;
  209. UCHAR PendingPortNmi : 1;
  210. UCHAR PendingBusMasterTimeout : 1;
  211. UCHAR PendingFailSafeNmi : 1;
  212. }NMI_EXTENDED_CONTROL, *PNMI_EXTENDED_CONTROL;
  213. //
  214. // Define 82357 register structure.
  215. //
  216. typedef struct _EISA_CONTROL {
  217. union {
  218. DMA1_CONTROL Dma1BasePort; // Offset 0x00
  219. struct {
  220. UCHAR Interrupt1ControlPort0; // Offset 0x00
  221. UCHAR Reserved1;
  222. UCHAR Interrupt1ControlPort1; // Offset 0x02
  223. UCHAR Reserved2[5];
  224. UCHAR Interrupt2ControlPort0; // Offset 0x08
  225. UCHAR Reserved3;
  226. UCHAR Interrupt2ControlPort1; // Offset 0x0A
  227. UCHAR Reserved4[sizeof(DMA1_CONTROL)-11];
  228. };
  229. };
  230. union {
  231. DMA_PAGE DmaPageLowPort; // Offset 0x20
  232. DMA2_CONTROL Dma2BasePort; // Offset 0x20
  233. struct {
  234. UCHAR Reserved20[9]; // Offset 0x20
  235. UCHAR PageIncrementMode; // Offset 0x29
  236. UCHAR Reserved21;
  237. UCHAR InDirectAddress; // Offset 0x2b
  238. UCHAR Reserved22;
  239. UCHAR InDirectData; // Offset 0x2d
  240. UCHAR Reserved23[0x7f - 0x2e];
  241. UCHAR PageIncrementMode2; // Offset 0x7f
  242. UCHAR Reserved24[0x129 - 0x80];
  243. UCHAR DMA2PageIncrementMode; // Offset 0x129
  244. };
  245. };
  246. UCHAR Reserved25[0xfffc - 0x130]; // Offset 0x130
  247. //
  248. // No NEC PC98 have 2nd DMA controller. But PC/AT has one. Therefore there are some valuable
  249. // refer to 2nd DMA in ixisasup.c.
  250. // I add it following valuable so that HAL builds. HAL of NEC PC98 doesn't use it.
  251. //
  252. UCHAR Dma1ExtendedModePort;
  253. UCHAR Dma2ExtendedModePort;
  254. UCHAR DmaPageHighPort;
  255. UCHAR Interrupt1EdgeLevel;
  256. UCHAR Interrupt2EdgeLevel;
  257. } EISA_CONTROL, *PEISA_CONTROL;
  258. //
  259. // Define initialization command word 1 structure.
  260. //
  261. typedef struct _INITIALIZATION_COMMAND_1 {
  262. UCHAR Icw4Needed : 1;
  263. UCHAR CascadeMode : 1;
  264. UCHAR Unused1 : 2;
  265. UCHAR InitializationFlag : 1;
  266. UCHAR Unused2 : 3;
  267. }INITIALIZATION_COMMAND_1, *PINITIALIZATION_COMMAND_1;
  268. //
  269. // Define initialization command word 4 structure.
  270. //
  271. typedef struct _INITIALIZATION_COMMAND_4 {
  272. UCHAR I80x86Mode : 1;
  273. UCHAR AutoEndOfInterruptMode : 1;
  274. UCHAR Unused1 : 2;
  275. UCHAR SpecialFullyNested : 1;
  276. UCHAR Unused2 : 3;
  277. }INITIALIZATION_COMMAND_4, *PINITIALIZATION_COMMAND_4;
  278. //
  279. // Define EISA interrupt controller operational command values.
  280. // Define operation control word 2 commands.
  281. //
  282. #define NONSPECIFIC_END_OF_INTERRUPT 0x20
  283. #define SPECIFIC_END_OF_INTERRUPT 0x60
  284. //
  285. // Define external EISA interupts
  286. //
  287. #define EISA_EXTERNAL_INTERRUPTS_1 0xf8
  288. #define EISA_EXTERNAL_INTERRUPTS_2 0xbe
  289. //
  290. // Define the DMA mode register structure.
  291. //
  292. typedef struct _DMA_EISA_MODE {
  293. UCHAR Channel : 2;
  294. UCHAR TransferType : 2;
  295. UCHAR AutoInitialize : 1;
  296. UCHAR AddressDecrement : 1;
  297. UCHAR RequestMode : 2;
  298. }DMA_EISA_MODE, *PDMA_EISA_MODE;
  299. //
  300. // Define TransferType values.
  301. //
  302. #define VERIFY_TRANSFER 0x00
  303. #define READ_TRANSFER 0x01 // Read from the device.
  304. #define WRITE_TRANSFER 0x02 // Write to the device.
  305. //
  306. // Define RequestMode values.
  307. //
  308. #define DEMAND_REQUEST_MODE 0x00
  309. #define SINGLE_REQUEST_MODE 0x01
  310. #define BLOCK_REQUEST_MODE 0x02
  311. #define CASCADE_REQUEST_MODE 0x03
  312. //
  313. // Define the DMA extended mode register structure.
  314. //
  315. typedef struct _DMA_EXTENDED_MODE {
  316. UCHAR ChannelNumber : 2;
  317. UCHAR TransferSize : 2;
  318. UCHAR TimingMode : 2;
  319. UCHAR EndOfPacketInput : 1;
  320. UCHAR StopRegisterEnabled : 1;
  321. }DMA_EXTENDED_MODE, *PDMA_EXTENDED_MODE;
  322. //
  323. // Define the DMA extended mode register transfer size values.
  324. //
  325. #define BY_BYTE_8_BITS 0
  326. #define BY_WORD_16_BITS 1
  327. #define BY_BYTE_32_BITS 2
  328. #define BY_BYTE_16_BITS 3
  329. //
  330. // Define the DMA extended mode timing mode values.
  331. //
  332. #define COMPATIBLITY_TIMING 0
  333. #define TYPE_A_TIMING 1
  334. #define TYPE_B_TIMING 2
  335. #define BURST_TIMING 3
  336. #ifndef DMA1_COMMAND_STATUS
  337. //
  338. // Define constants used by Intel 8237A DMA chip
  339. //
  340. #define DMA_SETMASK 4
  341. #define DMA_CLEARMASK 0
  342. #define DMA_READ 4 // These two appear backwards, but I think
  343. #define DMA_WRITE 8 // the DMA docs have them mixed up
  344. #define DMA_SINGLE_TRANSFER 0x40
  345. #define DMA_AUTO_INIT 0x10 // Auto initialization mode
  346. #endif
  347. //
  348. // This structure is drive layout and partition information
  349. // for NEC PC-98xx series.
  350. //
  351. typedef struct _PARTITION_INFORMATION_NEC {
  352. UCHAR PartitionType;
  353. BOOLEAN RecognizedPartition;
  354. BOOLEAN RewritePartition;
  355. ULONG PartitionNumber;
  356. LARGE_INTEGER IplStartOffset;
  357. LARGE_INTEGER StartingOffset;
  358. LARGE_INTEGER PartitionLength;
  359. UCHAR BootableFlag;
  360. UCHAR PartitionName[16];
  361. } PARTITION_INFORMATION_NEC, *PPARTITION_INFORMATION_NEC;
  362. typedef struct _DRIVE_LAYOUT_INFORMATION_NEC {
  363. ULONG PartitionCount;
  364. ULONG Signature;
  365. UCHAR BootRecordNec[8];
  366. PARTITION_INFORMATION_NEC PartitionEntry[1];
  367. } DRIVE_LAYOUT_INFORMATION_NEC, *PDRIVE_LAYOUT_INFORMATION_NEC;
  368. //
  369. // The system has memory over 16MB ?
  370. //
  371. extern UCHAR Over16MBMemoryFlag;
  372. //
  373. // We can't use DMA between 15MB and 16MB.
  374. //
  375. #define NOTDMA_MINIMUM_PHYSICAL_ADDRESS 0x0f00000
  376. //
  377. //
  378. //
  379. VOID
  380. FASTCALL
  381. xHalExamineMBR(
  382. IN PDEVICE_OBJECT DeviceObject,
  383. IN ULONG SectorSize,
  384. IN ULONG MBRTypeIdentifier,
  385. OUT PVOID *Buffer
  386. );
  387. VOID
  388. FASTCALL
  389. xHalIoAssignDriveLetters(
  390. IN struct _LOADER_PARAMETER_BLOCK *LoaderBlock,
  391. IN PSTRING NtDeviceName,
  392. OUT PUCHAR NtSystemPath,
  393. OUT PSTRING NtSystemPathString
  394. );
  395. NTSTATUS
  396. FASTCALL
  397. xHalIoReadPartitionTable(
  398. IN PDEVICE_OBJECT DeviceObject,
  399. IN ULONG SectorSize,
  400. IN BOOLEAN ReturnRecognizedPartitions,
  401. OUT struct _DRIVE_LAYOUT_INFORMATION **PartitionBuffer
  402. );
  403. NTSTATUS
  404. FASTCALL
  405. xHalIoSetPartitionInformation(
  406. IN PDEVICE_OBJECT DeviceObject,
  407. IN ULONG SectorSize,
  408. IN ULONG PartitionNumber,
  409. IN ULONG PartitionType
  410. );
  411. NTSTATUS
  412. FASTCALL
  413. xHalIoWritePartitionTable(
  414. IN PDEVICE_OBJECT DeviceObject,
  415. IN ULONG SectorSize,
  416. IN ULONG SectorsPerTrack,
  417. IN ULONG NumberOfHeads,
  418. IN struct _DRIVE_LAYOUT_INFORMATION *PartitionBuffer
  419. );
  420. #endif //_EISA_