1/* SPDX-License-Identifier: GPL-2.0 */
2#ifndef _PARISC_PDC_H
3#define _PARISC_PDC_H
4
5#include <uapi/asm/pdc.h>
6
7#if !defined(__ASSEMBLY__)
8
9extern int parisc_narrow_firmware;
10
11extern int pdc_type;
12extern unsigned long parisc_cell_num; /* cell number the CPU runs on (PAT) */
13extern unsigned long parisc_cell_loc; /* cell location of CPU (PAT)	   */
14extern unsigned long parisc_pat_pdc_cap; /* PDC capabilities (PAT) */
15
16/* Values for pdc_type */
17#define PDC_TYPE_ILLEGAL	-1
18#define PDC_TYPE_PAT		 0 /* 64-bit PAT-PDC */
19#define PDC_TYPE_SYSTEM_MAP	 1 /* 32-bit, but supports PDC_SYSTEM_MAP */
20#define PDC_TYPE_SNAKE		 2 /* Doesn't support SYSTEM_MAP */
21
22void pdc_console_init(void);	/* in pdc_console.c */
23void pdc_console_restart(void);
24
25void setup_pdc(void);		/* in inventory.c */
26
27/* wrapper-functions from pdc.c */
28
29int pdc_add_valid(unsigned long address);
30int pdc_instr(unsigned int *instr);
31int pdc_chassis_info(struct pdc_chassis_info *chassis_info, void *led_info, unsigned long len);
32int pdc_chassis_disp(unsigned long disp);
33int pdc_chassis_warn(unsigned long *warn);
34int pdc_coproc_cfg(struct pdc_coproc_cfg *pdc_coproc_info);
35int pdc_coproc_cfg_unlocked(struct pdc_coproc_cfg *pdc_coproc_info);
36int pdc_iodc_read(unsigned long *actcnt, unsigned long hpa, unsigned int index,
37		  void *iodc_data, unsigned int iodc_data_size);
38int pdc_system_map_find_mods(struct pdc_system_map_mod_info *pdc_mod_info,
39			     struct pdc_module_path *mod_path, long mod_index);
40int pdc_system_map_find_addrs(struct pdc_system_map_addr_info *pdc_addr_info,
41			      long mod_index, long addr_index);
42int pdc_model_info(struct pdc_model *model);
43int pdc_model_sysmodel(char *name);
44int pdc_model_cpuid(unsigned long *cpu_id);
45int pdc_model_versions(unsigned long *versions, int id);
46int pdc_model_capabilities(unsigned long *capabilities);
47int pdc_model_platform_info(char *orig_prod_num, char *current_prod_num, char *serial_no);
48int pdc_cache_info(struct pdc_cache_info *cache);
49int pdc_spaceid_bits(unsigned long *space_bits);
50#ifndef CONFIG_PA20
51int pdc_btlb_info(struct pdc_btlb_info *btlb);
52int pdc_mem_map_hpa(struct pdc_memory_map *r_addr, struct pdc_module_path *mod_path);
53#endif /* !CONFIG_PA20 */
54int pdc_pim_toc11(struct pdc_toc_pim_11 *ret);
55int pdc_pim_toc20(struct pdc_toc_pim_20 *ret);
56int pdc_lan_station_id(char *lan_addr, unsigned long net_hpa);
57
58int pdc_stable_read(unsigned long staddr, void *memaddr, unsigned long count);
59int pdc_stable_write(unsigned long staddr, void *memaddr, unsigned long count);
60int pdc_stable_get_size(unsigned long *size);
61int pdc_stable_verify_contents(void);
62int pdc_stable_initialize(void);
63
64int pdc_pci_irt_size(unsigned long *num_entries, unsigned long hpa);
65int pdc_pci_irt(unsigned long num_entries, unsigned long hpa, void *tbl);
66
67int pdc_get_initiator(struct hardware_path *, struct pdc_initiator *);
68int pdc_tod_read(struct pdc_tod *tod);
69int pdc_tod_set(unsigned long sec, unsigned long usec);
70
71void pdc_pdt_init(void);	/* in pdt.c */
72int pdc_mem_pdt_info(struct pdc_mem_retinfo *rinfo);
73int pdc_mem_pdt_read_entries(struct pdc_mem_read_pdt *rpdt_read,
74		unsigned long *pdt_entries_ptr);
75#ifdef CONFIG_64BIT
76int pdc_mem_mem_table(struct pdc_memory_table_raddr *r_addr,
77		struct pdc_memory_table *tbl, unsigned long entries);
78#endif
79
80void set_firmware_width(void);
81void set_firmware_width_unlocked(void);
82int pdc_do_firm_test_reset(unsigned long ftc_bitmap);
83int pdc_do_reset(void);
84int pdc_soft_power_info(unsigned long *power_reg);
85int pdc_soft_power_button(int sw_control);
86void pdc_io_reset(void);
87void pdc_io_reset_devices(void);
88int pdc_iodc_getc(void);
89int pdc_iodc_print(const unsigned char *str, unsigned count);
90
91void pdc_emergency_unlock(void);
92int pdc_sti_call(unsigned long func, unsigned long flags,
93                 unsigned long inptr, unsigned long outputr,
94                 unsigned long glob_cfg);
95
96int __pdc_cpu_rendezvous(void);
97void pdc_cpu_rendezvous_lock(void);
98void pdc_cpu_rendezvous_unlock(void);
99
100static inline char * os_id_to_string(u16 os_id) {
101	switch(os_id) {
102	case OS_ID_NONE:	return "No OS";
103	case OS_ID_HPUX:	return "HP-UX";
104	case OS_ID_MPEXL:	return "MPE-iX";
105	case OS_ID_OSF:		return "OSF";
106	case OS_ID_HPRT:	return "HP-RT";
107	case OS_ID_NOVEL:	return "Novell Netware";
108	case OS_ID_LINUX:	return "Linux";
109	default:	return "Unknown";
110	}
111}
112
113#endif /* !defined(__ASSEMBLY__) */
114#endif /* _PARISC_PDC_H */
115