pdc.h 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360
  1. #ifndef _PARISC_PDC_H
  2. #define _PARISC_PDC_H
  3. #include <uapi/asm/pdc.h>
  4. #if !defined(__ASSEMBLY__)
  5. extern int parisc_narrow_firmware;
  6. extern int pdc_type;
  7. extern unsigned long parisc_cell_num; /* cell number the CPU runs on (PAT) */
  8. extern unsigned long parisc_cell_loc; /* cell location of CPU (PAT) */
  9. /* Values for pdc_type */
  10. #define PDC_TYPE_ILLEGAL -1
  11. #define PDC_TYPE_PAT 0 /* 64-bit PAT-PDC */
  12. #define PDC_TYPE_SYSTEM_MAP 1 /* 32-bit, but supports PDC_SYSTEM_MAP */
  13. #define PDC_TYPE_SNAKE 2 /* Doesn't support SYSTEM_MAP */
  14. struct pdc_chassis_info { /* for PDC_CHASSIS_INFO */
  15. unsigned long actcnt; /* actual number of bytes returned */
  16. unsigned long maxcnt; /* maximum number of bytes that could be returned */
  17. };
  18. struct pdc_coproc_cfg { /* for PDC_COPROC_CFG */
  19. unsigned long ccr_functional;
  20. unsigned long ccr_present;
  21. unsigned long revision;
  22. unsigned long model;
  23. };
  24. struct pdc_model { /* for PDC_MODEL */
  25. unsigned long hversion;
  26. unsigned long sversion;
  27. unsigned long hw_id;
  28. unsigned long boot_id;
  29. unsigned long sw_id;
  30. unsigned long sw_cap;
  31. unsigned long arch_rev;
  32. unsigned long pot_key;
  33. unsigned long curr_key;
  34. };
  35. struct pdc_cache_cf { /* for PDC_CACHE (I/D-caches) */
  36. unsigned long
  37. #ifdef CONFIG_64BIT
  38. cc_padW:32,
  39. #endif
  40. cc_alias: 4, /* alias boundaries for virtual addresses */
  41. cc_block: 4, /* to determine most efficient stride */
  42. cc_line : 3, /* maximum amount written back as a result of store (multiple of 16 bytes) */
  43. cc_shift: 2, /* how much to shift cc_block left */
  44. cc_wt : 1, /* 0 = WT-Dcache, 1 = WB-Dcache */
  45. cc_sh : 2, /* 0 = separate I/D-cache, else shared I/D-cache */
  46. cc_cst : 3, /* 0 = incoherent D-cache, 1=coherent D-cache */
  47. cc_pad1 : 10, /* reserved */
  48. cc_hv : 3; /* hversion dependent */
  49. };
  50. struct pdc_tlb_cf { /* for PDC_CACHE (I/D-TLB's) */
  51. unsigned long tc_pad0:12, /* reserved */
  52. #ifdef CONFIG_64BIT
  53. tc_padW:32,
  54. #endif
  55. tc_sh : 2, /* 0 = separate I/D-TLB, else shared I/D-TLB */
  56. tc_hv : 1, /* HV */
  57. tc_page : 1, /* 0 = 2K page-size-machine, 1 = 4k page size */
  58. tc_cst : 3, /* 0 = incoherent operations, else coherent operations */
  59. tc_aid : 5, /* ITLB: width of access ids of processor (encoded!) */
  60. tc_sr : 8; /* ITLB: width of space-registers (encoded) */
  61. };
  62. struct pdc_cache_info { /* main-PDC_CACHE-structure (caches & TLB's) */
  63. /* I-cache */
  64. unsigned long ic_size; /* size in bytes */
  65. struct pdc_cache_cf ic_conf; /* configuration */
  66. unsigned long ic_base; /* base-addr */
  67. unsigned long ic_stride;
  68. unsigned long ic_count;
  69. unsigned long ic_loop;
  70. /* D-cache */
  71. unsigned long dc_size; /* size in bytes */
  72. struct pdc_cache_cf dc_conf; /* configuration */
  73. unsigned long dc_base; /* base-addr */
  74. unsigned long dc_stride;
  75. unsigned long dc_count;
  76. unsigned long dc_loop;
  77. /* Instruction-TLB */
  78. unsigned long it_size; /* number of entries in I-TLB */
  79. struct pdc_tlb_cf it_conf; /* I-TLB-configuration */
  80. unsigned long it_sp_base;
  81. unsigned long it_sp_stride;
  82. unsigned long it_sp_count;
  83. unsigned long it_off_base;
  84. unsigned long it_off_stride;
  85. unsigned long it_off_count;
  86. unsigned long it_loop;
  87. /* data-TLB */
  88. unsigned long dt_size; /* number of entries in D-TLB */
  89. struct pdc_tlb_cf dt_conf; /* D-TLB-configuration */
  90. unsigned long dt_sp_base;
  91. unsigned long dt_sp_stride;
  92. unsigned long dt_sp_count;
  93. unsigned long dt_off_base;
  94. unsigned long dt_off_stride;
  95. unsigned long dt_off_count;
  96. unsigned long dt_loop;
  97. };
  98. #if 0
  99. /* If you start using the next struct, you'll have to adjust it to
  100. * work with 64-bit firmware I think -PB
  101. */
  102. struct pdc_iodc { /* PDC_IODC */
  103. unsigned char hversion_model;
  104. unsigned char hversion;
  105. unsigned char spa;
  106. unsigned char type;
  107. unsigned int sversion_rev:4;
  108. unsigned int sversion_model:19;
  109. unsigned int sversion_opt:8;
  110. unsigned char rev;
  111. unsigned char dep;
  112. unsigned char features;
  113. unsigned char pad1;
  114. unsigned int checksum:16;
  115. unsigned int length:16;
  116. unsigned int pad[15];
  117. } __attribute__((aligned(8))) ;
  118. #endif
  119. #ifndef CONFIG_PA20
  120. /* no BLTBs in pa2.0 processors */
  121. struct pdc_btlb_info_range {
  122. __u8 res00;
  123. __u8 num_i;
  124. __u8 num_d;
  125. __u8 num_comb;
  126. };
  127. struct pdc_btlb_info { /* PDC_BLOCK_TLB, return of PDC_BTLB_INFO */
  128. unsigned int min_size; /* minimum size of BTLB in pages */
  129. unsigned int max_size; /* maximum size of BTLB in pages */
  130. struct pdc_btlb_info_range fixed_range_info;
  131. struct pdc_btlb_info_range variable_range_info;
  132. };
  133. #endif /* !CONFIG_PA20 */
  134. struct pdc_mem_retinfo { /* PDC_MEM/PDC_MEM_MEMINFO (return info) */
  135. unsigned long pdt_size;
  136. unsigned long pdt_entries;
  137. unsigned long pdt_status;
  138. unsigned long first_dbe_loc;
  139. unsigned long good_mem;
  140. };
  141. struct pdc_mem_read_pdt { /* PDC_MEM/PDC_MEM_READ_PDT (return info) */
  142. unsigned long pdt_entries;
  143. };
  144. #ifdef CONFIG_64BIT
  145. struct pdc_memory_table_raddr { /* PDC_MEM/PDC_MEM_TABLE (return info) */
  146. unsigned long entries_returned;
  147. unsigned long entries_total;
  148. };
  149. struct pdc_memory_table { /* PDC_MEM/PDC_MEM_TABLE (arguments) */
  150. unsigned long paddr;
  151. unsigned int pages;
  152. unsigned int reserved;
  153. };
  154. #endif /* CONFIG_64BIT */
  155. struct pdc_system_map_mod_info { /* PDC_SYSTEM_MAP/FIND_MODULE */
  156. unsigned long mod_addr;
  157. unsigned long mod_pgs;
  158. unsigned long add_addrs;
  159. };
  160. struct pdc_system_map_addr_info { /* PDC_SYSTEM_MAP/FIND_ADDRESS */
  161. unsigned long mod_addr;
  162. unsigned long mod_pgs;
  163. };
  164. struct pdc_initiator { /* PDC_INITIATOR */
  165. int host_id;
  166. int factor;
  167. int width;
  168. int mode;
  169. };
  170. struct hardware_path {
  171. char flags; /* see bit definitions below */
  172. char bc[6]; /* Bus Converter routing info to a specific */
  173. /* I/O adaptor (< 0 means none, > 63 resvd) */
  174. char mod; /* fixed field of specified module */
  175. };
  176. /*
  177. * Device path specifications used by PDC.
  178. */
  179. struct pdc_module_path {
  180. struct hardware_path path;
  181. unsigned int layers[6]; /* device-specific info (ctlr #, unit # ...) */
  182. };
  183. #ifndef CONFIG_PA20
  184. /* Only used on some pre-PA2.0 boxes */
  185. struct pdc_memory_map { /* PDC_MEMORY_MAP */
  186. unsigned long hpa; /* mod's register set address */
  187. unsigned long more_pgs; /* number of additional I/O pgs */
  188. };
  189. #endif
  190. struct pdc_tod {
  191. unsigned long tod_sec;
  192. unsigned long tod_usec;
  193. };
  194. /* architected results from PDC_PIM/transfer hpmc on a PA1.1 machine */
  195. struct pdc_hpmc_pim_11 { /* PDC_PIM */
  196. __u32 gr[32];
  197. __u32 cr[32];
  198. __u32 sr[8];
  199. __u32 iasq_back;
  200. __u32 iaoq_back;
  201. __u32 check_type;
  202. __u32 cpu_state;
  203. __u32 rsvd1;
  204. __u32 cache_check;
  205. __u32 tlb_check;
  206. __u32 bus_check;
  207. __u32 assists_check;
  208. __u32 rsvd2;
  209. __u32 assist_state;
  210. __u32 responder_addr;
  211. __u32 requestor_addr;
  212. __u32 path_info;
  213. __u64 fr[32];
  214. };
  215. /*
  216. * architected results from PDC_PIM/transfer hpmc on a PA2.0 machine
  217. *
  218. * Note that PDC_PIM doesn't care whether or not wide mode was enabled
  219. * so the results are different on PA1.1 vs. PA2.0 when in narrow mode.
  220. *
  221. * Note also that there are unarchitected results available, which
  222. * are hversion dependent. Do a "ser pim 0 hpmc" after rebooting, since
  223. * the firmware is probably the best way of printing hversion dependent
  224. * data.
  225. */
  226. struct pdc_hpmc_pim_20 { /* PDC_PIM */
  227. __u64 gr[32];
  228. __u64 cr[32];
  229. __u64 sr[8];
  230. __u64 iasq_back;
  231. __u64 iaoq_back;
  232. __u32 check_type;
  233. __u32 cpu_state;
  234. __u32 cache_check;
  235. __u32 tlb_check;
  236. __u32 bus_check;
  237. __u32 assists_check;
  238. __u32 assist_state;
  239. __u32 path_info;
  240. __u64 responder_addr;
  241. __u64 requestor_addr;
  242. __u64 fr[32];
  243. };
  244. void pdc_console_init(void); /* in pdc_console.c */
  245. void pdc_console_restart(void);
  246. void setup_pdc(void); /* in inventory.c */
  247. /* wrapper-functions from pdc.c */
  248. int pdc_add_valid(unsigned long address);
  249. int pdc_instr(unsigned int *instr);
  250. int pdc_chassis_info(struct pdc_chassis_info *chassis_info, void *led_info, unsigned long len);
  251. int pdc_chassis_disp(unsigned long disp);
  252. int pdc_chassis_warn(unsigned long *warn);
  253. int pdc_coproc_cfg(struct pdc_coproc_cfg *pdc_coproc_info);
  254. int pdc_coproc_cfg_unlocked(struct pdc_coproc_cfg *pdc_coproc_info);
  255. int pdc_iodc_read(unsigned long *actcnt, unsigned long hpa, unsigned int index,
  256. void *iodc_data, unsigned int iodc_data_size);
  257. int pdc_system_map_find_mods(struct pdc_system_map_mod_info *pdc_mod_info,
  258. struct pdc_module_path *mod_path, long mod_index);
  259. int pdc_system_map_find_addrs(struct pdc_system_map_addr_info *pdc_addr_info,
  260. long mod_index, long addr_index);
  261. int pdc_model_info(struct pdc_model *model);
  262. int pdc_model_sysmodel(char *name);
  263. int pdc_model_cpuid(unsigned long *cpu_id);
  264. int pdc_model_versions(unsigned long *versions, int id);
  265. int pdc_model_capabilities(unsigned long *capabilities);
  266. int pdc_cache_info(struct pdc_cache_info *cache);
  267. int pdc_spaceid_bits(unsigned long *space_bits);
  268. #ifndef CONFIG_PA20
  269. int pdc_btlb_info(struct pdc_btlb_info *btlb);
  270. int pdc_mem_map_hpa(struct pdc_memory_map *r_addr, struct pdc_module_path *mod_path);
  271. #endif /* !CONFIG_PA20 */
  272. int pdc_lan_station_id(char *lan_addr, unsigned long net_hpa);
  273. int pdc_stable_read(unsigned long staddr, void *memaddr, unsigned long count);
  274. int pdc_stable_write(unsigned long staddr, void *memaddr, unsigned long count);
  275. int pdc_stable_get_size(unsigned long *size);
  276. int pdc_stable_verify_contents(void);
  277. int pdc_stable_initialize(void);
  278. int pdc_pci_irt_size(unsigned long *num_entries, unsigned long hpa);
  279. int pdc_pci_irt(unsigned long num_entries, unsigned long hpa, void *tbl);
  280. int pdc_get_initiator(struct hardware_path *, struct pdc_initiator *);
  281. int pdc_tod_read(struct pdc_tod *tod);
  282. int pdc_tod_set(unsigned long sec, unsigned long usec);
  283. void pdc_pdt_init(void); /* in pdt.c */
  284. int pdc_mem_pdt_info(struct pdc_mem_retinfo *rinfo);
  285. int pdc_mem_pdt_read_entries(struct pdc_mem_read_pdt *rpdt_read,
  286. unsigned long *pdt_entries_ptr);
  287. #ifdef CONFIG_64BIT
  288. int pdc_mem_mem_table(struct pdc_memory_table_raddr *r_addr,
  289. struct pdc_memory_table *tbl, unsigned long entries);
  290. #endif
  291. void set_firmware_width(void);
  292. void set_firmware_width_unlocked(void);
  293. int pdc_do_firm_test_reset(unsigned long ftc_bitmap);
  294. int pdc_do_reset(void);
  295. int pdc_soft_power_info(unsigned long *power_reg);
  296. int pdc_soft_power_button(int sw_control);
  297. void pdc_io_reset(void);
  298. void pdc_io_reset_devices(void);
  299. int pdc_iodc_getc(void);
  300. int pdc_iodc_print(const unsigned char *str, unsigned count);
  301. void pdc_emergency_unlock(void);
  302. int pdc_sti_call(unsigned long func, unsigned long flags,
  303. unsigned long inptr, unsigned long outputr,
  304. unsigned long glob_cfg);
  305. static inline char * os_id_to_string(u16 os_id) {
  306. switch(os_id) {
  307. case OS_ID_NONE: return "No OS";
  308. case OS_ID_HPUX: return "HP-UX";
  309. case OS_ID_MPEXL: return "MPE-iX";
  310. case OS_ID_OSF: return "OSF";
  311. case OS_ID_HPRT: return "HP-RT";
  312. case OS_ID_NOVEL: return "Novell Netware";
  313. case OS_ID_LINUX: return "Linux";
  314. default: return "Unknown";
  315. }
  316. }
  317. #endif /* !defined(__ASSEMBLY__) */
  318. #endif /* _PARISC_PDC_H */