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.

471 lines
15 KiB

4 years ago
  1. #ident "@(#) NEC r98def.h 1.25 95/03/17 11:54:20"
  2. /*++
  3. Copyright (c) 1990 Microsoft Corporation
  4. Module Name:
  5. r98def.h
  6. Abstract:
  7. This module is the header file that describes hardware addresses
  8. for the r98.
  9. Author:
  10. Revision History:
  11. --*/
  12. /*
  13. ***********************************************************************
  14. *
  15. * S001 6/10 T.Samezima
  16. *
  17. * Del Compile err
  18. *
  19. *
  20. ***********************************************************************
  21. *
  22. * S002 7/5 T.Samezima
  23. *
  24. * Chg define miss
  25. *
  26. ***********************************************************************
  27. *
  28. * S003 7/5 T.Samezima
  29. *
  30. * Add define unknown counter buffer length
  31. *
  32. ***********************************************************************
  33. *
  34. * S004 7/5 T.Samezima
  35. *
  36. * Add define err pci and dma in iRSF
  37. * define dummy single read addr
  38. *
  39. ***********************************************************************
  40. *
  41. * S005 7/12 T.Samezima
  42. *
  43. * Chg define miss and define change
  44. *
  45. ***********************************************************************
  46. *
  47. * S006 7/19 T.Samezima
  48. *
  49. * Add define PCI err interrupt vector
  50. *
  51. ***********************************************************************
  52. *
  53. * S007 7/22 T.Samezima
  54. *
  55. * Add define PMC Dummy single read address.
  56. *
  57. ***********************************************************************
  58. *
  59. * S008 7/23 T.Samezima
  60. *
  61. * Add define SIC set0/1 offset
  62. * define value of enable EIF interrupt of SIC CKE0/1 register
  63. *
  64. ***********************************************************************
  65. *
  66. * S009 8/22 T.Samezima on SNES
  67. *
  68. * Chg RTC physical base
  69. *
  70. ***********************************************************************
  71. *
  72. * S00a 8/22 T.Samezima on SNES
  73. *
  74. * Chg PIO, FDC interrupt pending bit on iRSF
  75. *
  76. * S00B 8/29 N.Kugimoto
  77. *
  78. * Bug NVRAM disable logic.
  79. *
  80. * K00C 9/5 N.Kugimoto
  81. * add PCI slot 0 addr
  82. *
  83. * K00D 94/9/22 N.Kugimoto
  84. * -1 chg No Used!
  85. *
  86. * S00E 94/10/13 T.Samezima
  87. * Add define EISA interrupt enable bit
  88. * define all clock interrupt restart command on TCIR in PMC
  89. *
  90. * S00F 94/10/18 T.Samezima
  91. * Add define interrupt enable bit for device only
  92. *
  93. * S010 94/11/21 T.Samezima
  94. * Add correspond SIC3 H/W Bug on R98
  95. * Chg Dummy read address change. because old address is
  96. * break scsi script.
  97. *
  98. * S011 '94.12/06 T.Samezima
  99. * Add define CKE0 disable mask. (Disable Single bit error mask on SIC)
  100. * Chg CKE0 enable mask change. (Disable Single bit error mask on SIC)
  101. * ERRMK enable mask change. (bit 17,22 is must be zero. )
  102. *
  103. * K00E 94/12/06 N.Kugimoto
  104. * Add ESM NVRAM Area
  105. *
  106. * S012 94/12/08 T.Samezima
  107. * Add Disable NMI
  108. *
  109. * S013 '95.01/08 T.Samezima
  110. * Add Enable ECC 1bit error.
  111. *
  112. * S014 '95.01/13 T.Samezima
  113. * Add Define Disable ECC 1bit error.
  114. *
  115. * S015 '95.03/13 T.Samezima
  116. * Add Define LR4360 error.
  117. *
  118. */
  119. #ifndef _R98DEF_
  120. #define _R98DEF_
  121. //
  122. // define address map
  123. //
  124. #define PMC_PHYSICAL_BASE1 0x19900000 // Physical base of PMC registers1
  125. #define PMC_PHYSICAL_BASE2 0x19800000 // Physical base of PMC registers2
  126. #define PMC_LOCAL_OFFSET 0x80000
  127. #define IOB_PHYSICAL_BASE 0x18000000 // Physical base of IOB
  128. #define SIC_PHYSICAL_BASE 0x19000000 // Physical base of SIC registers
  129. #define SIC_ERR_OFFSET 0x2000 // Error registers offset of SIC
  130. #define SIC_DATA_OFFSET 0x3000 // Data registers offset of SIC
  131. #define SIC_SET0_OFFSET 0x0 // Offset SET0 of SIC // S008
  132. #define SIC_SET1_OFFSET 0x20000 // Offset SET1 of SIC // S008
  133. #define SIC_NO0_OFFSET 0x4000 // Offset No.0 of SIC
  134. #define SIC_NO1_OFFSET 0x8000 // Offset No.1 of SIC
  135. // Start S005,S008
  136. #define SIC_NO2_OFFSET (SIC_SET1_OFFSET+SIC_NO0_OFFSET) // Offset No.2 of SIC
  137. #define SIC_NO3_OFFSET (SIC_SET1_OFFSET+SIC_NO1_OFFSET) // Offset No.3 of SIC
  138. // End S005,S008
  139. #define LR_PHYSICAL_CMNBASE1 0x18c08000 // Physical base of LR4360 registers1 // S005
  140. #define LR_PHYSICAL_CMNBASE2 0x18c0a000 // Physical base of LR4360 registers2
  141. #define LR_PHYSICAL_PCI_INT_ACK_BASE 0x18caa000 // Physical base of LR4360 pci interrupt acknowledge
  142. #define LR_PHYSICAL_PCI_DEV_REG_BASE 0x18cbb000 // Physical base of LR4360 pci device registers
  143. // Bbus DMA
  144. #define LR_CHANNEL_BASE 0x18c08000 // LR4360 - Device Channel Register Base
  145. // 0x18Cn0000 : n:channel number
  146. #define LR_CHANNEL_SHIFT 0x10 // LR4360 - channel shift bit
  147. #define SERIAL0_PHYSICAL_BASE 0x18c103f8 // physical base of serial port 0
  148. #define KEYBOARD_PHYSICAL_BASE 0x18c20060 // physical base of keyboard control
  149. #define RTCLOCK_PHYSICAL_BASE 0x18cc0071 // physical base of realtime clock // S005, S009
  150. #define NVRAM_PHYSICAL_BASE 0x18c70000 // physical base of nonvolatile RAM
  151. #define NVRAM_MEMORY_BASE (KSEG1_BASE + NVRAM_PHYSICAL_BASE)
  152. #define NVRAM_NMI_BASE (NVRAM_MEMORY_BASE + 0x1934)
  153. #define NVRAM_ESM_BASE NVRAM_MEMORY_BASE+1024*8 //Start of ESM Area K00E
  154. #define NVRAM_ESM_END NVRAM_MEMORY_BASE+1024*16-1 //End of ESM Area K00E
  155. #define MRC_PHYSICAL_BASE 0x18c80000 // physical base of MRC
  156. #define EISA_MEMORY_PHYSICAL_BASE 0xc0000000 // physical base of EISA memory
  157. #define EISA_CONTROL_PHYSICAL_BASE 0x18cc0000 // physical base of EISA control
  158. #define EISA_CONFIG_REGISTERS_MEMREGN 0x18ca8060 // MEMREG[] register
  159. #define PCI_MEMORY_PHYSICAL_BASE EISA_MEMORY_PHYSICAL_BASE // physical base of PCI memory
  160. #define PCI_MEMORY_SLOT1_PHYSICAL_BASE 0xc4000000 // PCI slot1 memory space
  161. #define PCI_MEMORY_SLOT2_PHYSICAL_BASE 0xc8000000 // PCI slot2 memory space
  162. #define PCI_MEMORY_SLOT3_PHYSICAL_BASE 0xcc000000 // PCI slot3 memory space
  163. #define PCI_CONTROL_SLOT1_PHYSICAL_BASE 0x18cd0000 // PCI slot1 I/O space
  164. #define PCI_CONTROL_SLOT2_PHYSICAL_BASE 0x18ce0000 // PCI slot2 I/O space
  165. #define PCI_CONTROL_SLOT3_PHYSICAL_BASE 0x18cf0000 // PCI slot2 I/O space
  166. #define PCI_LOGICAL_START_ADDRESS 0x00000000 // S001,K00D-1
  167. //
  168. // define IDT vector
  169. //
  170. #define INT0_LEVEL 3 // Define I/O interrupt Low level
  171. #define INT1_LEVEL 4 // Define I/O interrupt High level
  172. #define INT2_LEVEL 5 // Define I/O interrupt level
  173. #define TIMER_LEVEL 6 // Define Timer interrupt level
  174. #define IPI_LEVEL 7 // Define Ipi interrupt level
  175. #define EIF_LEVEL 8 // Define Eif interrupt level
  176. #define CLOCK_VECTOR 14 // Define Clock interrupt vector
  177. #define PROFILE_VECTOR 15 // Define Profile interrupt vector
  178. #define DEVICE_VECTORS 16 // Define starting builtin device and bus vectors
  179. #define EISA_DEVICE_VECTOR (2 + DEVICE_VECTORS) // Define Eisa interrupt vector
  180. #define KBMS_VECTOR (3 + DEVICE_VECTORS)
  181. #define SIO_VECTOR (4 + DEVICE_VECTORS)
  182. #define PIO_VECTOR (5 + DEVICE_VECTORS) // S005, S00a
  183. #define FDC_VECTOR (6 + DEVICE_VECTORS) // S005, S00a
  184. #define SCSI1_VECTOR (7 + DEVICE_VECTORS)
  185. #define SCSI0_VECTOR (8 + DEVICE_VECTORS)
  186. #define ETHER_VECTOR (9 + DEVICE_VECTORS)
  187. #define PCI_DEVICE_VECTOR (10+ DEVICE_VECTORS) // Define PCI interrupt vector
  188. #define LR_ERR_VECTOR (13+ DEVICE_VECTORS) // Define LR4360 err vector // S015
  189. #define PCI_ERR_VECTOR (14+ DEVICE_VECTORS) // Define PCI err vector // S006
  190. #define DMA_VECTOR (15+ DEVICE_VECTORS) // Define Dma interrupt vector
  191. #define EISA_VECTORS 32 // Define EISA Device interrupt vectors
  192. #define PCI_VECTORS 48 // Define Pci Device interrupt vectors
  193. #define MAXIMUM_BUILTIN_VECTOR ETHER_VECTOR // maximum builtin vector
  194. #define MAXIMUM_EISA_VECTORS (15 + EISA_VECTORS) // maximum EISA vector
  195. #define MAXIMUM_PCI_VECTORS (3 + PCI_VECTORS) // maximum PCI vector // S005
  196. //
  197. // define etc
  198. //
  199. #define MAXIMUM_CPU_NUMBER 3 // maximum cpu number
  200. // S003
  201. #define UNKNOWN_COUNT_BUF_LEN 64 // unknown interrupt counter buffer size
  202. /* Start S001 */
  203. //
  204. // define PMC registers value
  205. //
  206. #define PMC_CPU_SHIFT 0xc // S002
  207. #define MKR_DISABLE_ALL_INTERRUPT_HIGH 0x0
  208. #define MKR_DISABLE_ALL_INTERRUPT_LOW 0x0
  209. #define MKR_INT0_ENABLE_HIGH 0x0
  210. // S001
  211. #define MKR_INT0_ENABLE_LOW 0x00000fff
  212. #define MKR_INT1_ENABLE_HIGH 0x0
  213. #define MKR_INT1_ENABLE_LOW 0x00fff000
  214. #define MKR_INT2_ENABLE_HIGH 0x0
  215. #define MKR_INT2_ENABLE_LOW 0xff000000
  216. #define MKR_INT3_ENABLE_HIGH 0x00030000
  217. #define MKR_INT3_ENABLE_LOW 0x0
  218. #define MKR_INT4_ENABLE_HIGH 0x0000ffff
  219. #define MKR_INT4_ENABLE_LOW 0x0
  220. #define MKR_INT5_ENABLE_HIGH 0xff000000
  221. #define MKR_INT5_ENABLE_LOW 0x0
  222. // S00F vvv
  223. #define MKR_INT0_DEVICE_ENABLE_HIGH 0x0
  224. #define MKR_INT0_DEVICE_ENABLE_LOW 0x0
  225. #define MKR_INT1_DEVICE_ENABLE_HIGH 0x0
  226. #define MKR_INT1_DEVICE_ENABLE_LOW 0x00a88000
  227. #define MKR_INT2_DEVICE_ENABLE_HIGH 0x0
  228. #define MKR_INT2_DEVICE_ENABLE_LOW 0xaa000000
  229. // S00F ^^^
  230. #define IPR_EIF_BIT_NO 61
  231. #define IPR_EIF_BIT_HIGH 0x20000000
  232. #define IPR_EIF_BIT_LOW 0x0
  233. #define IPR_CLOCK_BIT_NO 49
  234. #define IPR_CLOCK_BIT_HIGH 0x00020000
  235. #define IPR_CLOCK_BIT_LOW 0x0
  236. #define IPR_PROFILE_BIT_NO 48
  237. #define IPR_PROFILE_BIT_HIGH 0x00010000
  238. #define IPR_PROFILE_BIT_LOW 0x0
  239. #define IPR_IPI0_BIT_NO 47
  240. #define IPR_IPI0_BIT_HIGH 0x00008000
  241. #define IPR_IPI0_BIT_LOW 0x0
  242. #define IPR_IPI1_BIT_NO 46
  243. #define IPR_IPI1_BIT_HIGH 0x00004000
  244. #define IPR_IPI1_BIT_LOW 0x0
  245. #define IPR_IPI2_BIT_NO 45
  246. #define IPR_IPI2_BIT_HIGH 0x00002000
  247. #define IPR_IPI2_BIT_LOW 0x0
  248. #define IPR_IPI3_BIT_NO 44
  249. #define IPR_IPI3_BIT_HIGH 0x00001000
  250. #define IPR_IPI3_BIT_LOW 0x0
  251. #define IPR_SIO_BIT_NO 31
  252. #define IPR_SIO_BIT_HIGH 0x0
  253. #define IPR_SIO_BIT_LOW 0x80000000
  254. #define IPR_FDC_PIO_BIT_NO 29
  255. #define IPR_FDC_PIO_BIT_HIGH 0x0
  256. #define IPR_FDC_PIO_BIT_LOW 0x20000000
  257. #define IPR_DMA_BIT_NO 27
  258. #define IPR_DMA_BIT_HIGH 0x0
  259. #define IPR_DMA_BIT_LOW 0x08000000
  260. #define IPR_KB_MS_BIT_NO 25
  261. #define IPR_KB_MS_BIT_HIGH 0x0
  262. #define IPR_KB_MS_BIT_LOW 0x02000000
  263. #define IPR_ETHER_BIT_NO 23
  264. #define IPR_ETHER_BIT_HIGH 0x0
  265. #define IPR_ETHER_BIT_LOW 0x00800000
  266. #define IPR_SCSI_BIT_NO 21
  267. #define IPR_SCSI_BIT_HIGH 0x0
  268. #define IPR_SCSI_BIT_LOW 0x00200000
  269. #define IPR_PCI_BIT_NO 19
  270. #define IPR_PCI_BIT_HIGH 0x0
  271. #define IPR_PCI_BIT_LOW 0x00080000
  272. #define IPR_EISA_BIT_NO 15
  273. #define IPR_EISA_BIT_HIGH 0x0
  274. #define IPR_EISA_BIT_LOW 0x00008000
  275. #define IntIR_REQUEST_IPI 0x00900000
  276. #define IntIR_CPU3_BIT 12
  277. #define IntIR_CODE_BIT 16
  278. #define TCIR_ALL_CLOCK_RESTART 0x000cf000 // S00E
  279. // S002
  280. #if defined(DISABLE_NMI)
  281. #define STSR_NMI_DISABLE 0x08080000 // S008
  282. #endif
  283. #define STSR_EIF_ENABLE 0x40400000
  284. #define STSR_NVWINH_ENABLE 0x04040000 // S005
  285. #define STSR_NVWINH_DISABLE 0x00040000 // S00B
  286. #define ERRMK_EIF_ENABLE 0xffbdfffe // S011
  287. //
  288. // Define the minimum and maximum system time increment values in 100ns units.
  289. //
  290. // original ntos/inc/duodef.h
  291. #define MAXIMUM_INCREMENT (10 * 1000 * 10)
  292. #define MINIMUM_INCREMENT (1 * 1000 * 10)
  293. //
  294. // Time increment in 1us units
  295. //
  296. #define CLOCK_INTERVAL (MAXIMUM_INCREMENT / 10)
  297. // original ntos/inc/mips.h
  298. #define DEFAULT_PROFILETIMER_COUNT 65000 // = 65 ms
  299. #define DEFAULT_PROFILETIMER_INTERVAL (500 * 10) // = 500 us (100ns units)
  300. #define MAXIMUM_PROFILETIMER_INTERVAL (65000 * 10) // = 65 ms (100ns units)
  301. #define MINIMUM_PROFILETIMER_INTERVAL (40 * 10) // = 40 us (100ns units)
  302. //
  303. // define IOB registers value
  304. //
  305. #define EIMR_DISABLE_ALL_EIF 0x0
  306. #define EIMR_ENABLE_ALL_EIF 0xffe00000 // S002
  307. #define IEMR_ENABLE_ALL_EIF 0xfffffe00 // S002
  308. #define SCFR_CPU0_CONNECT 0x8000
  309. #define SCFR_CPU1_CONNECT 0x4000
  310. #define SCFR_CPU2_CONNECT 0x2000
  311. #define SCFR_CPU3_CONNECT 0x1000
  312. #define SCFR_SIC_SET0_CONNECT 0x0800
  313. #define SCFR_SIC_SET1_CONNECT 0x0400
  314. #define AII_INIT_DATA 0x80008000
  315. // Start S008, S010
  316. //
  317. // define IOB registers value
  318. //
  319. #define CKE0_DISABLE_SBE 0xffffffff // S011, S013
  320. #define DPCM_ENABLE_MASK 0x1fffffff // S013
  321. #define DPCM_ECC1BIT_BIT 0x40000000 // S013, S014
  322. #define SECT_REWRITE_ENABLE 0x0000000f // S013
  323. #if defined(WORKAROUND_SIC3)
  324. //#define CKE0_DISABLE_SBE 0xf7ffffff // S011
  325. //#define CKE0_ENABLE_ALL_EIF 0xf040ff00 // S011 //R98TEMP SIC3 H/W Bug
  326. #define CKE0_ENABLE_ALL_EIF 0xf840ff00 // S011, S013
  327. #define CKE1_ENABLE_ALL_EIF 0xff700000 //R98TEMP SIC3 H/W Bug
  328. #else
  329. //#define CKE0_DISABLE_SBE 0xf7ffffff // S011
  330. #define CKE0_ENABLE_ALL_EIF 0xf8c0ff00 // S011, S013
  331. #define CKE1_ENABLE_ALL_EIF 0xfff00000
  332. #endif
  333. // End S008, S010
  334. //
  335. // Define NABus code
  336. //
  337. #define NACODE_SIO ((0x1f-IPR_SIO_BIT_NO) << 0x2)
  338. #define NACODE_FDC_PIO ((0x1f-IPR_FDC_PIO_BIT_NO) << 0x2)
  339. #define NACODE_DMA ((0x1f-IPR_DMA_BIT_NO) << 0x2)
  340. #define NACODE_KB_MS ((0x1f-IPR_KB_MS_BIT_NO) << 0x2)
  341. #define NACODE_ETHER ((0x1f-IPR_ETHER_BIT_NO) << 0x2)
  342. #define NACODE_SCSI ((0x1f-IPR_SCSI_BIT_NO) << 0x2)
  343. #define NACODE_PCI ((0x1f-IPR_PCI_BIT_NO) << 0x2)
  344. #define NACODE_EISA ((0x1f-IPR_EISA_BIT_NO) << 0x2)
  345. //
  346. // define LR4360 registers value
  347. //
  348. #define ERRS_ERROR_BIT 0x00008000 // S005
  349. #define iREN_DISABLE_ALL_INTERRUPT 0x0
  350. #define iREN_ENABLE_DMA_INTERRUPT 0x00020000
  351. #define iREN_ENABLE_LR_ERR_INTERRUPT 0x00010000 // S015
  352. #define iREN_ENABLE_PCI_INTERRUPT 0x00000200 // S006
  353. #define iREN_ENABLE_PCI_ERR_INTERRUPT 0x00400000 // S006
  354. #define iREN_ENABLE_EISA_INTERRUPT 0x00000002 // S00E
  355. #define iRRE_MASK 0x004203fe
  356. #define iRSF_CLEAR_INTERRUPT 0x000003fe // S005
  357. // Start S004
  358. #define iRSF_ERRPCI_BIT 0x00400000
  359. #define iRSF_DMA_BIT 0x00020000
  360. #define iRSF_LR_ERR_BIT 0x00010000 // S015
  361. // End S004
  362. #define iRSF_PCI_BIT 0x00000200
  363. #define iRSF_ETHER_BIT 0x00000100
  364. #define iRSF_SCSI0_BIT 0x00000080
  365. #define iRSF_SCSI1_BIT 0x00000040
  366. #define iRSF_FDC_BIT 0x00000020 // S005, S00a
  367. #define iRSF_PIO_BIT 0x00000010 // S005, S00a
  368. #define iRSF_SIO_BIT 0x0000008
  369. #define iRSF_KBMS_BIT 0x00000004
  370. #define iRSF_EISA_BIT 0x00000002
  371. #define LR_iRSF_REG_iNSF_SHIFT 0x11
  372. #define LR4360PTSZ4K 0x1
  373. #define LR4360PTSZ8K 0x2
  374. #define LR4360PTSZ16K 0x4
  375. #define LR4360PTSZ32K 0x8
  376. #define LR4360PTSZSHIFT 0xc
  377. #define LR_DMA_MODE_NORMAL 0x00
  378. //
  379. // Define dummy single read address
  380. //
  381. #define SIO_DUMMY_READ_ADDR KSEG1_BASE+0x018c103f1
  382. #define PIO_DUMMY_READ_ADDR KSEG1_BASE+0x018c103f1
  383. #define FDC_DUMMY_READ_ADDR KSEG1_BASE+0x018c103f1
  384. #define DMA_DUMMY_READ_ADDR KSEG1_BASE+0x018c0b000
  385. #define KBMS_DUMMY_READ_ADDR KSEG1_BASE+0x018c103f1
  386. #define ETHER_DUMMY_READ_ADDR KSEG1_BASE+0x018600000
  387. #define SCSI0_DUMMY_READ_ADDR KSEG1_BASE+0x018c0b000 // S010
  388. #define SCSI1_DUMMY_READ_ADDR KSEG1_BASE+0x018c0b000 // S010
  389. #define PCI_DUMMY_READ_ADDR KSEG1_BASE+0x018c0b000
  390. #define EISA_DUMMY_READ_ADDR KSEG1_BASE+0x018cc0023
  391. #define EIF_DUMMY_READ_ADDR KSEG1_BASE+0x018000218 // S005
  392. #define PMC_DUMMY_READ_ADDR KSEG1_BASE+0x018c0b000 // S007
  393. //
  394. // Define cause register bit offset
  395. //
  396. #define CAUSE_INT_PEND_BIT 0x8
  397. //
  398. // Define cause register read macro
  399. //
  400. #define READ_CAUSE_REGISTER(reg) \
  401. .set noreorder; \
  402. .set noat; \
  403. mfc0 reg,cause; \
  404. nop; \
  405. nop; \
  406. .set at; \
  407. .set reorder;
  408. /* End S001 */
  409. #endif _R98DEF_