18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */
28c2ecf20Sopenharmony_ci#ifndef _PARISC_PDC_H
38c2ecf20Sopenharmony_ci#define _PARISC_PDC_H
48c2ecf20Sopenharmony_ci
58c2ecf20Sopenharmony_ci#include <uapi/asm/pdc.h>
68c2ecf20Sopenharmony_ci
78c2ecf20Sopenharmony_ci#if !defined(__ASSEMBLY__)
88c2ecf20Sopenharmony_ci
98c2ecf20Sopenharmony_ciextern int parisc_narrow_firmware;
108c2ecf20Sopenharmony_ci
118c2ecf20Sopenharmony_ciextern int pdc_type;
128c2ecf20Sopenharmony_ciextern unsigned long parisc_cell_num; /* cell number the CPU runs on (PAT) */
138c2ecf20Sopenharmony_ciextern unsigned long parisc_cell_loc; /* cell location of CPU (PAT)	   */
148c2ecf20Sopenharmony_ciextern unsigned long parisc_pat_pdc_cap; /* PDC capabilities (PAT) */
158c2ecf20Sopenharmony_ci
168c2ecf20Sopenharmony_ci/* Values for pdc_type */
178c2ecf20Sopenharmony_ci#define PDC_TYPE_ILLEGAL	-1
188c2ecf20Sopenharmony_ci#define PDC_TYPE_PAT		 0 /* 64-bit PAT-PDC */
198c2ecf20Sopenharmony_ci#define PDC_TYPE_SYSTEM_MAP	 1 /* 32-bit, but supports PDC_SYSTEM_MAP */
208c2ecf20Sopenharmony_ci#define PDC_TYPE_SNAKE		 2 /* Doesn't support SYSTEM_MAP */
218c2ecf20Sopenharmony_ci
228c2ecf20Sopenharmony_civoid pdc_console_init(void);	/* in pdc_console.c */
238c2ecf20Sopenharmony_civoid pdc_console_restart(void);
248c2ecf20Sopenharmony_ci
258c2ecf20Sopenharmony_civoid setup_pdc(void);		/* in inventory.c */
268c2ecf20Sopenharmony_ci
278c2ecf20Sopenharmony_ci/* wrapper-functions from pdc.c */
288c2ecf20Sopenharmony_ci
298c2ecf20Sopenharmony_ciint pdc_add_valid(unsigned long address);
308c2ecf20Sopenharmony_ciint pdc_instr(unsigned int *instr);
318c2ecf20Sopenharmony_ciint pdc_chassis_info(struct pdc_chassis_info *chassis_info, void *led_info, unsigned long len);
328c2ecf20Sopenharmony_ciint pdc_chassis_disp(unsigned long disp);
338c2ecf20Sopenharmony_ciint pdc_chassis_warn(unsigned long *warn);
348c2ecf20Sopenharmony_ciint pdc_coproc_cfg(struct pdc_coproc_cfg *pdc_coproc_info);
358c2ecf20Sopenharmony_ciint pdc_coproc_cfg_unlocked(struct pdc_coproc_cfg *pdc_coproc_info);
368c2ecf20Sopenharmony_ciint pdc_iodc_read(unsigned long *actcnt, unsigned long hpa, unsigned int index,
378c2ecf20Sopenharmony_ci		  void *iodc_data, unsigned int iodc_data_size);
388c2ecf20Sopenharmony_ciint pdc_system_map_find_mods(struct pdc_system_map_mod_info *pdc_mod_info,
398c2ecf20Sopenharmony_ci			     struct pdc_module_path *mod_path, long mod_index);
408c2ecf20Sopenharmony_ciint pdc_system_map_find_addrs(struct pdc_system_map_addr_info *pdc_addr_info,
418c2ecf20Sopenharmony_ci			      long mod_index, long addr_index);
428c2ecf20Sopenharmony_ciint pdc_model_info(struct pdc_model *model);
438c2ecf20Sopenharmony_ciint pdc_model_sysmodel(char *name);
448c2ecf20Sopenharmony_ciint pdc_model_cpuid(unsigned long *cpu_id);
458c2ecf20Sopenharmony_ciint pdc_model_versions(unsigned long *versions, int id);
468c2ecf20Sopenharmony_ciint pdc_model_capabilities(unsigned long *capabilities);
478c2ecf20Sopenharmony_ciint pdc_model_platform_info(char *orig_prod_num, char *current_prod_num, char *serial_no);
488c2ecf20Sopenharmony_ciint pdc_cache_info(struct pdc_cache_info *cache);
498c2ecf20Sopenharmony_ciint pdc_spaceid_bits(unsigned long *space_bits);
508c2ecf20Sopenharmony_ci#ifndef CONFIG_PA20
518c2ecf20Sopenharmony_ciint pdc_btlb_info(struct pdc_btlb_info *btlb);
528c2ecf20Sopenharmony_ciint pdc_mem_map_hpa(struct pdc_memory_map *r_addr, struct pdc_module_path *mod_path);
538c2ecf20Sopenharmony_ci#endif /* !CONFIG_PA20 */
548c2ecf20Sopenharmony_ciint pdc_lan_station_id(char *lan_addr, unsigned long net_hpa);
558c2ecf20Sopenharmony_ci
568c2ecf20Sopenharmony_ciint pdc_stable_read(unsigned long staddr, void *memaddr, unsigned long count);
578c2ecf20Sopenharmony_ciint pdc_stable_write(unsigned long staddr, void *memaddr, unsigned long count);
588c2ecf20Sopenharmony_ciint pdc_stable_get_size(unsigned long *size);
598c2ecf20Sopenharmony_ciint pdc_stable_verify_contents(void);
608c2ecf20Sopenharmony_ciint pdc_stable_initialize(void);
618c2ecf20Sopenharmony_ci
628c2ecf20Sopenharmony_ciint pdc_pci_irt_size(unsigned long *num_entries, unsigned long hpa);
638c2ecf20Sopenharmony_ciint pdc_pci_irt(unsigned long num_entries, unsigned long hpa, void *tbl);
648c2ecf20Sopenharmony_ci
658c2ecf20Sopenharmony_ciint pdc_get_initiator(struct hardware_path *, struct pdc_initiator *);
668c2ecf20Sopenharmony_ciint pdc_tod_read(struct pdc_tod *tod);
678c2ecf20Sopenharmony_ciint pdc_tod_set(unsigned long sec, unsigned long usec);
688c2ecf20Sopenharmony_ci
698c2ecf20Sopenharmony_civoid pdc_pdt_init(void);	/* in pdt.c */
708c2ecf20Sopenharmony_ciint pdc_mem_pdt_info(struct pdc_mem_retinfo *rinfo);
718c2ecf20Sopenharmony_ciint pdc_mem_pdt_read_entries(struct pdc_mem_read_pdt *rpdt_read,
728c2ecf20Sopenharmony_ci		unsigned long *pdt_entries_ptr);
738c2ecf20Sopenharmony_ci#ifdef CONFIG_64BIT
748c2ecf20Sopenharmony_ciint pdc_mem_mem_table(struct pdc_memory_table_raddr *r_addr,
758c2ecf20Sopenharmony_ci		struct pdc_memory_table *tbl, unsigned long entries);
768c2ecf20Sopenharmony_ci#endif
778c2ecf20Sopenharmony_ci
788c2ecf20Sopenharmony_civoid set_firmware_width(void);
798c2ecf20Sopenharmony_civoid set_firmware_width_unlocked(void);
808c2ecf20Sopenharmony_ciint pdc_do_firm_test_reset(unsigned long ftc_bitmap);
818c2ecf20Sopenharmony_ciint pdc_do_reset(void);
828c2ecf20Sopenharmony_ciint pdc_soft_power_info(unsigned long *power_reg);
838c2ecf20Sopenharmony_ciint pdc_soft_power_button(int sw_control);
848c2ecf20Sopenharmony_civoid pdc_io_reset(void);
858c2ecf20Sopenharmony_civoid pdc_io_reset_devices(void);
868c2ecf20Sopenharmony_ciint pdc_iodc_getc(void);
878c2ecf20Sopenharmony_ciint pdc_iodc_print(const unsigned char *str, unsigned count);
888c2ecf20Sopenharmony_ci
898c2ecf20Sopenharmony_civoid pdc_emergency_unlock(void);
908c2ecf20Sopenharmony_ciint pdc_sti_call(unsigned long func, unsigned long flags,
918c2ecf20Sopenharmony_ci                 unsigned long inptr, unsigned long outputr,
928c2ecf20Sopenharmony_ci                 unsigned long glob_cfg);
938c2ecf20Sopenharmony_ci
948c2ecf20Sopenharmony_ciint __pdc_cpu_rendezvous(void);
958c2ecf20Sopenharmony_cistatic inline char * os_id_to_string(u16 os_id) {
968c2ecf20Sopenharmony_ci	switch(os_id) {
978c2ecf20Sopenharmony_ci	case OS_ID_NONE:	return "No OS";
988c2ecf20Sopenharmony_ci	case OS_ID_HPUX:	return "HP-UX";
998c2ecf20Sopenharmony_ci	case OS_ID_MPEXL:	return "MPE-iX";
1008c2ecf20Sopenharmony_ci	case OS_ID_OSF:		return "OSF";
1018c2ecf20Sopenharmony_ci	case OS_ID_HPRT:	return "HP-RT";
1028c2ecf20Sopenharmony_ci	case OS_ID_NOVEL:	return "Novell Netware";
1038c2ecf20Sopenharmony_ci	case OS_ID_LINUX:	return "Linux";
1048c2ecf20Sopenharmony_ci	default:	return "Unknown";
1058c2ecf20Sopenharmony_ci	}
1068c2ecf20Sopenharmony_ci}
1078c2ecf20Sopenharmony_ci
1088c2ecf20Sopenharmony_ci#endif /* !defined(__ASSEMBLY__) */
1098c2ecf20Sopenharmony_ci#endif /* _PARISC_PDC_H */
110