pdc.h 9.9 KB

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