voyager.h 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517
  1. /* Copyright (C) 1999,2001
  2. *
  3. * Author: J.E.J.Bottomley@HansenPartnership.com
  4. *
  5. * Standard include definitions for the NCR Voyager system */
  6. #undef VOYAGER_DEBUG
  7. #undef VOYAGER_CAT_DEBUG
  8. #ifdef VOYAGER_DEBUG
  9. #define VDEBUG(x) printk x
  10. #else
  11. #define VDEBUG(x)
  12. #endif
  13. /* There are three levels of voyager machine: 3,4 and 5. The rule is
  14. * if it's less than 3435 it's a Level 3 except for a 3360 which is
  15. * a level 4. A 3435 or above is a Level 5 */
  16. #define VOYAGER_LEVEL5_AND_ABOVE 0x3435
  17. #define VOYAGER_LEVEL4 0x3360
  18. /* The L4 DINO ASIC */
  19. #define VOYAGER_DINO 0x43
  20. /* voyager ports in standard I/O space */
  21. #define VOYAGER_MC_SETUP 0x96
  22. #define VOYAGER_CAT_CONFIG_PORT 0x97
  23. # define VOYAGER_CAT_DESELECT 0xff
  24. #define VOYAGER_SSPB_RELOCATION_PORT 0x98
  25. /* Valid CAT controller commands */
  26. /* start instruction register cycle */
  27. #define VOYAGER_CAT_IRCYC 0x01
  28. /* start data register cycle */
  29. #define VOYAGER_CAT_DRCYC 0x02
  30. /* move to execute state */
  31. #define VOYAGER_CAT_RUN 0x0F
  32. /* end operation */
  33. #define VOYAGER_CAT_END 0x80
  34. /* hold in idle state */
  35. #define VOYAGER_CAT_HOLD 0x90
  36. /* single step an "intest" vector */
  37. #define VOYAGER_CAT_STEP 0xE0
  38. /* return cat controller to CLEMSON mode */
  39. #define VOYAGER_CAT_CLEMSON 0xFF
  40. /* the default cat command header */
  41. #define VOYAGER_CAT_HEADER 0x7F
  42. /* the range of possible CAT module ids in the system */
  43. #define VOYAGER_MIN_MODULE 0x10
  44. #define VOYAGER_MAX_MODULE 0x1f
  45. /* The voyager registers per asic */
  46. #define VOYAGER_ASIC_ID_REG 0x00
  47. #define VOYAGER_ASIC_TYPE_REG 0x01
  48. /* the sub address registers can be made auto incrementing on reads */
  49. #define VOYAGER_AUTO_INC_REG 0x02
  50. # define VOYAGER_AUTO_INC 0x04
  51. # define VOYAGER_NO_AUTO_INC 0xfb
  52. #define VOYAGER_SUBADDRDATA 0x03
  53. #define VOYAGER_SCANPATH 0x05
  54. # define VOYAGER_CONNECT_ASIC 0x01
  55. # define VOYAGER_DISCONNECT_ASIC 0xfe
  56. #define VOYAGER_SUBADDRLO 0x06
  57. #define VOYAGER_SUBADDRHI 0x07
  58. #define VOYAGER_SUBMODSELECT 0x08
  59. #define VOYAGER_SUBMODPRESENT 0x09
  60. #define VOYAGER_SUBADDR_LO 0xff
  61. #define VOYAGER_SUBADDR_HI 0xffff
  62. /* the maximum size of a scan path -- used to form instructions */
  63. #define VOYAGER_MAX_SCAN_PATH 0x100
  64. /* the biggest possible register size (in bytes) */
  65. #define VOYAGER_MAX_REG_SIZE 4
  66. /* Total number of possible modules (including submodules) */
  67. #define VOYAGER_MAX_MODULES 16
  68. /* Largest number of asics per module */
  69. #define VOYAGER_MAX_ASICS_PER_MODULE 7
  70. /* the CAT asic of each module is always the first one */
  71. #define VOYAGER_CAT_ID 0
  72. #define VOYAGER_PSI 0x1a
  73. /* voyager instruction operations and registers */
  74. #define VOYAGER_READ_CONFIG 0x1
  75. #define VOYAGER_WRITE_CONFIG 0x2
  76. #define VOYAGER_BYPASS 0xff
  77. typedef struct voyager_asic
  78. {
  79. __u8 asic_addr; /* ASIC address; Level 4 */
  80. __u8 asic_type; /* ASIC type */
  81. __u8 asic_id; /* ASIC id */
  82. __u8 jtag_id[4]; /* JTAG id */
  83. __u8 asic_location; /* Location within scan path; start w/ 0 */
  84. __u8 bit_location; /* Location within bit stream; start w/ 0 */
  85. __u8 ireg_length; /* Instruction register length */
  86. __u16 subaddr; /* Amount of sub address space */
  87. struct voyager_asic *next; /* Next asic in linked list */
  88. } voyager_asic_t;
  89. typedef struct voyager_module {
  90. __u8 module_addr; /* Module address */
  91. __u8 scan_path_connected; /* Scan path connected */
  92. __u16 ee_size; /* Size of the EEPROM */
  93. __u16 num_asics; /* Number of Asics */
  94. __u16 inst_bits; /* Instruction bits in the scan path */
  95. __u16 largest_reg; /* Largest register in the scan path */
  96. __u16 smallest_reg; /* Smallest register in the scan path */
  97. voyager_asic_t *asic; /* First ASIC in scan path (CAT_I) */
  98. struct voyager_module *submodule; /* Submodule pointer */
  99. struct voyager_module *next; /* Next module in linked list */
  100. } voyager_module_t;
  101. typedef struct voyager_eeprom_hdr {
  102. __u8 module_id[4];
  103. __u8 version_id;
  104. __u8 config_id;
  105. __u16 boundry_id; /* boundary scan id */
  106. __u16 ee_size; /* size of EEPROM */
  107. __u8 assembly[11]; /* assembly # */
  108. __u8 assembly_rev; /* assembly rev */
  109. __u8 tracer[4]; /* tracer number */
  110. __u16 assembly_cksum; /* asm checksum */
  111. __u16 power_consump; /* pwr requirements */
  112. __u16 num_asics; /* number of asics */
  113. __u16 bist_time; /* min. bist time */
  114. __u16 err_log_offset; /* error log offset */
  115. __u16 scan_path_offset;/* scan path offset */
  116. __u16 cct_offset;
  117. __u16 log_length; /* length of err log */
  118. __u16 xsum_end; /* offset to end of
  119. checksum */
  120. __u8 reserved[4];
  121. __u8 sflag; /* starting sentinal */
  122. __u8 part_number[13]; /* prom part number */
  123. __u8 version[10]; /* version number */
  124. __u8 signature[8];
  125. __u16 eeprom_chksum;
  126. __u32 data_stamp_offset;
  127. __u8 eflag ; /* ending sentinal */
  128. } __attribute__((packed)) voyager_eprom_hdr_t;
  129. #define VOYAGER_EPROM_SIZE_OFFSET ((__u16)(&(((voyager_eprom_hdr_t *)0)->ee_size)))
  130. #define VOYAGER_XSUM_END_OFFSET 0x2a
  131. /* the following three definitions are for internal table layouts
  132. * in the module EPROMs. We really only care about the IDs and
  133. * offsets */
  134. typedef struct voyager_sp_table {
  135. __u8 asic_id;
  136. __u8 bypass_flag;
  137. __u16 asic_data_offset;
  138. __u16 config_data_offset;
  139. } __attribute__((packed)) voyager_sp_table_t;
  140. typedef struct voyager_jtag_table {
  141. __u8 icode[4];
  142. __u8 runbist[4];
  143. __u8 intest[4];
  144. __u8 samp_preld[4];
  145. __u8 ireg_len;
  146. } __attribute__((packed)) voyager_jtt_t;
  147. typedef struct voyager_asic_data_table {
  148. __u8 jtag_id[4];
  149. __u16 length_bsr;
  150. __u16 length_bist_reg;
  151. __u32 bist_clk;
  152. __u16 subaddr_bits;
  153. __u16 seed_bits;
  154. __u16 sig_bits;
  155. __u16 jtag_offset;
  156. } __attribute__((packed)) voyager_at_t;
  157. /* Voyager Interrupt Controller (VIC) registers */
  158. /* Base to add to Cross Processor Interrupts (CPIs) when triggering
  159. * the CPU IRQ line */
  160. /* register defines for the WCBICs (one per processor) */
  161. #define VOYAGER_WCBIC0 0x41 /* bus A node P1 processor 0 */
  162. #define VOYAGER_WCBIC1 0x49 /* bus A node P1 processor 1 */
  163. #define VOYAGER_WCBIC2 0x51 /* bus A node P2 processor 0 */
  164. #define VOYAGER_WCBIC3 0x59 /* bus A node P2 processor 1 */
  165. #define VOYAGER_WCBIC4 0x61 /* bus B node P1 processor 0 */
  166. #define VOYAGER_WCBIC5 0x69 /* bus B node P1 processor 1 */
  167. #define VOYAGER_WCBIC6 0x71 /* bus B node P2 processor 0 */
  168. #define VOYAGER_WCBIC7 0x79 /* bus B node P2 processor 1 */
  169. /* top of memory registers */
  170. #define VOYAGER_WCBIC_TOM_L 0x4
  171. #define VOYAGER_WCBIC_TOM_H 0x5
  172. /* register defines for Voyager Memory Contol (VMC)
  173. * these are present on L4 machines only */
  174. #define VOYAGER_VMC1 0x81
  175. #define VOYAGER_VMC2 0x91
  176. #define VOYAGER_VMC3 0xa1
  177. #define VOYAGER_VMC4 0xb1
  178. /* VMC Ports */
  179. #define VOYAGER_VMC_MEMORY_SETUP 0x9
  180. # define VMC_Interleaving 0x01
  181. # define VMC_4Way 0x02
  182. # define VMC_EvenCacheLines 0x04
  183. # define VMC_HighLine 0x08
  184. # define VMC_Start0_Enable 0x20
  185. # define VMC_Start1_Enable 0x40
  186. # define VMC_Vremap 0x80
  187. #define VOYAGER_VMC_BANK_DENSITY 0xa
  188. # define VMC_BANK_EMPTY 0
  189. # define VMC_BANK_4MB 1
  190. # define VMC_BANK_16MB 2
  191. # define VMC_BANK_64MB 3
  192. # define VMC_BANK0_MASK 0x03
  193. # define VMC_BANK1_MASK 0x0C
  194. # define VMC_BANK2_MASK 0x30
  195. # define VMC_BANK3_MASK 0xC0
  196. /* Magellan Memory Controller (MMC) defines - present on L5 */
  197. #define VOYAGER_MMC_ASIC_ID 1
  198. /* the two memory modules corresponding to memory cards in the system */
  199. #define VOYAGER_MMC_MEMORY0_MODULE 0x14
  200. #define VOYAGER_MMC_MEMORY1_MODULE 0x15
  201. /* the Magellan Memory Address (MMA) defines */
  202. #define VOYAGER_MMA_ASIC_ID 2
  203. /* Submodule number for the Quad Baseboard */
  204. #define VOYAGER_QUAD_BASEBOARD 1
  205. /* ASIC defines for the Quad Baseboard */
  206. #define VOYAGER_QUAD_QDATA0 1
  207. #define VOYAGER_QUAD_QDATA1 2
  208. #define VOYAGER_QUAD_QABC 3
  209. /* Useful areas in extended CMOS */
  210. #define VOYAGER_PROCESSOR_PRESENT_MASK 0x88a
  211. #define VOYAGER_MEMORY_CLICKMAP 0xa23
  212. #define VOYAGER_DUMP_LOCATION 0xb1a
  213. /* SUS In Control bit - used to tell SUS that we don't need to be
  214. * babysat anymore */
  215. #define VOYAGER_SUS_IN_CONTROL_PORT 0x3ff
  216. # define VOYAGER_IN_CONTROL_FLAG 0x80
  217. /* Voyager PSI defines */
  218. #define VOYAGER_PSI_STATUS_REG 0x08
  219. # define PSI_DC_FAIL 0x01
  220. # define PSI_MON 0x02
  221. # define PSI_FAULT 0x04
  222. # define PSI_ALARM 0x08
  223. # define PSI_CURRENT 0x10
  224. # define PSI_DVM 0x20
  225. # define PSI_PSCFAULT 0x40
  226. # define PSI_STAT_CHG 0x80
  227. #define VOYAGER_PSI_SUPPLY_REG 0x8000
  228. /* read */
  229. # define PSI_FAIL_DC 0x01
  230. # define PSI_FAIL_AC 0x02
  231. # define PSI_MON_INT 0x04
  232. # define PSI_SWITCH_OFF 0x08
  233. # define PSI_HX_OFF 0x10
  234. # define PSI_SECURITY 0x20
  235. # define PSI_CMOS_BATT_LOW 0x40
  236. # define PSI_CMOS_BATT_FAIL 0x80
  237. /* write */
  238. # define PSI_CLR_SWITCH_OFF 0x13
  239. # define PSI_CLR_HX_OFF 0x14
  240. # define PSI_CLR_CMOS_BATT_FAIL 0x17
  241. #define VOYAGER_PSI_MASK 0x8001
  242. # define PSI_MASK_MASK 0x10
  243. #define VOYAGER_PSI_AC_FAIL_REG 0x8004
  244. #define AC_FAIL_STAT_CHANGE 0x80
  245. #define VOYAGER_PSI_GENERAL_REG 0x8007
  246. /* read */
  247. # define PSI_SWITCH_ON 0x01
  248. # define PSI_SWITCH_ENABLED 0x02
  249. # define PSI_ALARM_ENABLED 0x08
  250. # define PSI_SECURE_ENABLED 0x10
  251. # define PSI_COLD_RESET 0x20
  252. # define PSI_COLD_START 0x80
  253. /* write */
  254. # define PSI_POWER_DOWN 0x10
  255. # define PSI_SWITCH_DISABLE 0x01
  256. # define PSI_SWITCH_ENABLE 0x11
  257. # define PSI_CLEAR 0x12
  258. # define PSI_ALARM_DISABLE 0x03
  259. # define PSI_ALARM_ENABLE 0x13
  260. # define PSI_CLEAR_COLD_RESET 0x05
  261. # define PSI_SET_COLD_RESET 0x15
  262. # define PSI_CLEAR_COLD_START 0x07
  263. # define PSI_SET_COLD_START 0x17
  264. struct voyager_bios_info {
  265. __u8 len;
  266. __u8 major;
  267. __u8 minor;
  268. __u8 debug;
  269. __u8 num_classes;
  270. __u8 class_1;
  271. __u8 class_2;
  272. };
  273. /* The following structures and definitions are for the Kernel/SUS
  274. * interface these are needed to find out how SUS initialised any Quad
  275. * boards in the system */
  276. #define NUMBER_OF_MC_BUSSES 2
  277. #define SLOTS_PER_MC_BUS 8
  278. #define MAX_CPUS 16 /* 16 way CPU system */
  279. #define MAX_PROCESSOR_BOARDS 4 /* 4 processor slot system */
  280. #define MAX_CACHE_LEVELS 4 /* # of cache levels supported */
  281. #define MAX_SHARED_CPUS 4 /* # of CPUs that can share a LARC */
  282. #define NUMBER_OF_POS_REGS 8
  283. typedef struct {
  284. __u8 MC_Slot;
  285. __u8 POS_Values[NUMBER_OF_POS_REGS];
  286. } __attribute__((packed)) MC_SlotInformation_t;
  287. struct QuadDescription {
  288. __u8 Type; /* for type 0 (DYADIC or MONADIC) all fields
  289. * will be zero except for slot */
  290. __u8 StructureVersion;
  291. __u32 CPI_BaseAddress;
  292. __u32 LARC_BankSize;
  293. __u32 LocalMemoryStateBits;
  294. __u8 Slot; /* Processor slots 1 - 4 */
  295. } __attribute__((packed));
  296. struct ProcBoardInfo {
  297. __u8 Type;
  298. __u8 StructureVersion;
  299. __u8 NumberOfBoards;
  300. struct QuadDescription QuadData[MAX_PROCESSOR_BOARDS];
  301. } __attribute__((packed));
  302. struct CacheDescription {
  303. __u8 Level;
  304. __u32 TotalSize;
  305. __u16 LineSize;
  306. __u8 Associativity;
  307. __u8 CacheType;
  308. __u8 WriteType;
  309. __u8 Number_CPUs_SharedBy;
  310. __u8 Shared_CPUs_Hardware_IDs[MAX_SHARED_CPUS];
  311. } __attribute__((packed));
  312. struct CPU_Description {
  313. __u8 CPU_HardwareId;
  314. char *FRU_String;
  315. __u8 NumberOfCacheLevels;
  316. struct CacheDescription CacheLevelData[MAX_CACHE_LEVELS];
  317. } __attribute__((packed));
  318. struct CPU_Info {
  319. __u8 Type;
  320. __u8 StructureVersion;
  321. __u8 NumberOf_CPUs;
  322. struct CPU_Description CPU_Data[MAX_CPUS];
  323. } __attribute__((packed));
  324. /*
  325. * This structure will be used by SUS and the OS.
  326. * The assumption about this structure is that no blank space is
  327. * packed in it by our friend the compiler.
  328. */
  329. typedef struct {
  330. __u8 Mailbox_SUS; /* Written to by SUS to give commands/response to the OS */
  331. __u8 Mailbox_OS; /* Written to by the OS to give commands/response to SUS */
  332. __u8 SUS_MailboxVersion; /* Tells the OS which iteration of the interface SUS supports */
  333. __u8 OS_MailboxVersion; /* Tells SUS which iteration of the interface the OS supports */
  334. __u32 OS_Flags; /* Flags set by the OS as info for SUS */
  335. __u32 SUS_Flags; /* Flags set by SUS as info for the OS */
  336. __u32 WatchDogPeriod; /* Watchdog period (in seconds) which the DP uses to see if the OS is dead */
  337. __u32 WatchDogCount; /* Updated by the OS on every tic. */
  338. __u32 MemoryFor_SUS_ErrorLog; /* Flat 32 bit address which tells SUS where to stuff the SUS error log on a dump */
  339. MC_SlotInformation_t MC_SlotInfo[NUMBER_OF_MC_BUSSES*SLOTS_PER_MC_BUS]; /* Storage for MCA POS data */
  340. /* All new SECOND_PASS_INTERFACE fields added from this point */
  341. struct ProcBoardInfo *BoardData;
  342. struct CPU_Info *CPU_Data;
  343. /* All new fields must be added from this point */
  344. } Voyager_KernelSUS_Mbox_t;
  345. /* structure for finding the right memory address to send a QIC CPI to */
  346. struct voyager_qic_cpi {
  347. /* Each cache line (32 bytes) can trigger a cpi. The cpi
  348. * read/write may occur anywhere in the cache line---pick the
  349. * middle to be safe */
  350. struct {
  351. __u32 pad1[3];
  352. __u32 cpi;
  353. __u32 pad2[4];
  354. } qic_cpi[8];
  355. };
  356. struct voyager_status {
  357. __u32 power_fail:1;
  358. __u32 switch_off:1;
  359. __u32 request_from_kernel:1;
  360. };
  361. struct voyager_psi_regs {
  362. __u8 cat_id;
  363. __u8 cat_dev;
  364. __u8 cat_control;
  365. __u8 subaddr;
  366. __u8 dummy4;
  367. __u8 checkbit;
  368. __u8 subaddr_low;
  369. __u8 subaddr_high;
  370. __u8 intstatus;
  371. __u8 stat1;
  372. __u8 stat3;
  373. __u8 fault;
  374. __u8 tms;
  375. __u8 gen;
  376. __u8 sysconf;
  377. __u8 dummy15;
  378. };
  379. struct voyager_psi_subregs {
  380. __u8 supply;
  381. __u8 mask;
  382. __u8 present;
  383. __u8 DCfail;
  384. __u8 ACfail;
  385. __u8 fail;
  386. __u8 UPSfail;
  387. __u8 genstatus;
  388. };
  389. struct voyager_psi {
  390. struct voyager_psi_regs regs;
  391. struct voyager_psi_subregs subregs;
  392. };
  393. struct voyager_SUS {
  394. #define VOYAGER_DUMP_BUTTON_NMI 0x1
  395. #define VOYAGER_SUS_VALID 0x2
  396. #define VOYAGER_SYSINT_COMPLETE 0x3
  397. __u8 SUS_mbox;
  398. #define VOYAGER_NO_COMMAND 0x0
  399. #define VOYAGER_IGNORE_DUMP 0x1
  400. #define VOYAGER_DO_DUMP 0x2
  401. #define VOYAGER_SYSINT_HANDSHAKE 0x3
  402. #define VOYAGER_DO_MEM_DUMP 0x4
  403. #define VOYAGER_SYSINT_WAS_RECOVERED 0x5
  404. __u8 kernel_mbox;
  405. #define VOYAGER_MAILBOX_VERSION 0x10
  406. __u8 SUS_version;
  407. __u8 kernel_version;
  408. #define VOYAGER_OS_HAS_SYSINT 0x1
  409. #define VOYAGER_OS_IN_PROGRESS 0x2
  410. #define VOYAGER_UPDATING_WDPERIOD 0x4
  411. __u32 kernel_flags;
  412. #define VOYAGER_SUS_BOOTING 0x1
  413. #define VOYAGER_SUS_IN_PROGRESS 0x2
  414. __u32 SUS_flags;
  415. __u32 watchdog_period;
  416. __u32 watchdog_count;
  417. __u32 SUS_errorlog;
  418. /* lots of system configuration stuff under here */
  419. };
  420. /* Variables exported by voyager_smp */
  421. extern __u32 voyager_extended_vic_processors;
  422. extern __u32 voyager_allowed_boot_processors;
  423. extern __u32 voyager_quad_processors;
  424. extern struct voyager_qic_cpi *voyager_quad_cpi_addr[NR_CPUS];
  425. extern struct voyager_SUS *voyager_SUS;
  426. /* variables exported always */
  427. extern struct task_struct *voyager_thread;
  428. extern int voyager_level;
  429. extern struct voyager_status voyager_status;
  430. /* functions exported by the voyager and voyager_smp modules */
  431. extern int voyager_cat_readb(__u8 module, __u8 asic, int reg);
  432. extern void voyager_cat_init(void);
  433. extern void voyager_detect(struct voyager_bios_info *);
  434. extern void voyager_trap_init(void);
  435. extern void voyager_setup_irqs(void);
  436. extern int voyager_memory_detect(int region, __u32 *addr, __u32 *length);
  437. extern void voyager_smp_intr_init(void);
  438. extern __u8 voyager_extended_cmos_read(__u16 cmos_address);
  439. extern void voyager_smp_dump(void);
  440. extern void voyager_timer_interrupt(void);
  441. extern void smp_local_timer_interrupt(void);
  442. extern void voyager_power_off(void);
  443. extern void smp_voyager_power_off(void *dummy);
  444. extern void voyager_restart(void);
  445. extern void voyager_cat_power_off(void);
  446. extern void voyager_cat_do_common_interrupt(void);
  447. extern void voyager_handle_nmi(void);
  448. /* Commands for the following are */
  449. #define VOYAGER_PSI_READ 0
  450. #define VOYAGER_PSI_WRITE 1
  451. #define VOYAGER_PSI_SUBREAD 2
  452. #define VOYAGER_PSI_SUBWRITE 3
  453. extern void voyager_cat_psi(__u8, __u16, __u8 *);