18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */
28c2ecf20Sopenharmony_ci#ifndef __ALPHA_HWRPB_H
38c2ecf20Sopenharmony_ci#define __ALPHA_HWRPB_H
48c2ecf20Sopenharmony_ci
58c2ecf20Sopenharmony_ci#define INIT_HWRPB ((struct hwrpb_struct *) 0x10000000)
68c2ecf20Sopenharmony_ci
78c2ecf20Sopenharmony_ci/*
88c2ecf20Sopenharmony_ci * DEC processor types for Alpha systems.  Found in HWRPB.
98c2ecf20Sopenharmony_ci * These values are architected.
108c2ecf20Sopenharmony_ci */
118c2ecf20Sopenharmony_ci
128c2ecf20Sopenharmony_ci#define EV3_CPU                 1       /* EV3                  */
138c2ecf20Sopenharmony_ci#define EV4_CPU                 2       /* EV4 (21064)          */
148c2ecf20Sopenharmony_ci#define LCA4_CPU                4       /* LCA4 (21066/21068)   */
158c2ecf20Sopenharmony_ci#define EV5_CPU                 5       /* EV5 (21164)          */
168c2ecf20Sopenharmony_ci#define EV45_CPU                6       /* EV4.5 (21064/xxx)    */
178c2ecf20Sopenharmony_ci#define EV56_CPU		7	/* EV5.6 (21164)	*/
188c2ecf20Sopenharmony_ci#define EV6_CPU			8	/* EV6 (21264)		*/
198c2ecf20Sopenharmony_ci#define PCA56_CPU		9	/* PCA56 (21164PC)	*/
208c2ecf20Sopenharmony_ci#define PCA57_CPU		10	/* PCA57 (notyet)	*/
218c2ecf20Sopenharmony_ci#define EV67_CPU		11	/* EV67 (21264A)	*/
228c2ecf20Sopenharmony_ci#define EV68CB_CPU		12	/* EV68CB (21264C)	*/
238c2ecf20Sopenharmony_ci#define EV68AL_CPU		13	/* EV68AL (21264B)	*/
248c2ecf20Sopenharmony_ci#define EV68CX_CPU		14	/* EV68CX (21264D)	*/
258c2ecf20Sopenharmony_ci#define EV7_CPU			15	/* EV7 (21364)		*/
268c2ecf20Sopenharmony_ci#define EV79_CPU		16	/* EV79 (21364??)	*/
278c2ecf20Sopenharmony_ci#define EV69_CPU		17	/* EV69 (21264/EV69A)	*/
288c2ecf20Sopenharmony_ci
298c2ecf20Sopenharmony_ci/*
308c2ecf20Sopenharmony_ci * DEC system types for Alpha systems.  Found in HWRPB.
318c2ecf20Sopenharmony_ci * These values are architected.
328c2ecf20Sopenharmony_ci */
338c2ecf20Sopenharmony_ci
348c2ecf20Sopenharmony_ci#define ST_ADU			  1	/* Alpha ADU systype	*/
358c2ecf20Sopenharmony_ci#define ST_DEC_4000		  2	/* Cobra systype	*/
368c2ecf20Sopenharmony_ci#define ST_DEC_7000		  3	/* Ruby systype		*/
378c2ecf20Sopenharmony_ci#define ST_DEC_3000_500		  4	/* Flamingo systype	*/
388c2ecf20Sopenharmony_ci#define ST_DEC_2000_300		  6	/* Jensen systype	*/
398c2ecf20Sopenharmony_ci#define ST_DEC_3000_300		  7	/* Pelican systype	*/
408c2ecf20Sopenharmony_ci#define ST_DEC_2100_A500	  9	/* Sable systype	*/
418c2ecf20Sopenharmony_ci#define ST_DEC_AXPVME_64	 10	/* AXPvme system type	*/
428c2ecf20Sopenharmony_ci#define ST_DEC_AXPPCI_33	 11	/* NoName system type	*/
438c2ecf20Sopenharmony_ci#define ST_DEC_TLASER		 12	/* Turbolaser systype	*/
448c2ecf20Sopenharmony_ci#define ST_DEC_2100_A50		 13	/* Avanti systype	*/
458c2ecf20Sopenharmony_ci#define ST_DEC_MUSTANG		 14	/* Mustang systype	*/
468c2ecf20Sopenharmony_ci#define ST_DEC_ALCOR		 15	/* Alcor (EV5) systype	*/
478c2ecf20Sopenharmony_ci#define ST_DEC_1000		 17	/* Mikasa systype	*/
488c2ecf20Sopenharmony_ci#define ST_DEC_EB64		 18	/* EB64 systype		*/
498c2ecf20Sopenharmony_ci#define ST_DEC_EB66		 19	/* EB66 systype		*/
508c2ecf20Sopenharmony_ci#define ST_DEC_EB64P		 20	/* EB64+ systype	*/
518c2ecf20Sopenharmony_ci#define ST_DEC_BURNS		 21	/* laptop systype	*/
528c2ecf20Sopenharmony_ci#define ST_DEC_RAWHIDE		 22	/* Rawhide systype	*/
538c2ecf20Sopenharmony_ci#define ST_DEC_K2		 23	/* K2 systype		*/
548c2ecf20Sopenharmony_ci#define ST_DEC_LYNX		 24	/* Lynx systype		*/
558c2ecf20Sopenharmony_ci#define ST_DEC_XL		 25	/* Alpha XL systype	*/
568c2ecf20Sopenharmony_ci#define ST_DEC_EB164		 26	/* EB164 systype	*/
578c2ecf20Sopenharmony_ci#define ST_DEC_NORITAKE		 27	/* Noritake systype	*/
588c2ecf20Sopenharmony_ci#define ST_DEC_CORTEX		 28	/* Cortex systype	*/
598c2ecf20Sopenharmony_ci#define ST_DEC_MIATA		 30	/* Miata systype        */
608c2ecf20Sopenharmony_ci#define ST_DEC_XXM		 31	/* XXM systype		*/
618c2ecf20Sopenharmony_ci#define ST_DEC_TAKARA		 32	/* Takara systype	*/
628c2ecf20Sopenharmony_ci#define ST_DEC_YUKON		 33	/* Yukon systype	*/
638c2ecf20Sopenharmony_ci#define ST_DEC_TSUNAMI		 34	/* Tsunami systype	*/
648c2ecf20Sopenharmony_ci#define ST_DEC_WILDFIRE		 35	/* Wildfire systype	*/
658c2ecf20Sopenharmony_ci#define ST_DEC_CUSCO		 36	/* CUSCO systype	*/
668c2ecf20Sopenharmony_ci#define ST_DEC_EIGER		 37	/* Eiger systype	*/
678c2ecf20Sopenharmony_ci#define ST_DEC_TITAN		 38	/* Titan systype	*/
688c2ecf20Sopenharmony_ci#define ST_DEC_MARVEL		 39	/* Marvel systype	*/
698c2ecf20Sopenharmony_ci
708c2ecf20Sopenharmony_ci/* UNOFFICIAL!!! */
718c2ecf20Sopenharmony_ci#define ST_UNOFFICIAL_BIAS	100
728c2ecf20Sopenharmony_ci#define ST_DTI_RUFFIAN		101	/* RUFFIAN systype	*/
738c2ecf20Sopenharmony_ci
748c2ecf20Sopenharmony_ci/* Alpha Processor, Inc. systems */
758c2ecf20Sopenharmony_ci#define ST_API_BIAS		200
768c2ecf20Sopenharmony_ci#define ST_API_NAUTILUS		201	/* UP1000 systype	*/
778c2ecf20Sopenharmony_ci
788c2ecf20Sopenharmony_cistruct pcb_struct {
798c2ecf20Sopenharmony_ci	unsigned long ksp;
808c2ecf20Sopenharmony_ci	unsigned long usp;
818c2ecf20Sopenharmony_ci	unsigned long ptbr;
828c2ecf20Sopenharmony_ci	unsigned int pcc;
838c2ecf20Sopenharmony_ci	unsigned int asn;
848c2ecf20Sopenharmony_ci	unsigned long unique;
858c2ecf20Sopenharmony_ci	unsigned long flags;
868c2ecf20Sopenharmony_ci	unsigned long res1, res2;
878c2ecf20Sopenharmony_ci};
888c2ecf20Sopenharmony_ci
898c2ecf20Sopenharmony_cistruct percpu_struct {
908c2ecf20Sopenharmony_ci	unsigned long hwpcb[16];
918c2ecf20Sopenharmony_ci	unsigned long flags;
928c2ecf20Sopenharmony_ci	unsigned long pal_mem_size;
938c2ecf20Sopenharmony_ci	unsigned long pal_scratch_size;
948c2ecf20Sopenharmony_ci	unsigned long pal_mem_pa;
958c2ecf20Sopenharmony_ci	unsigned long pal_scratch_pa;
968c2ecf20Sopenharmony_ci	unsigned long pal_revision;
978c2ecf20Sopenharmony_ci	unsigned long type;
988c2ecf20Sopenharmony_ci	unsigned long variation;
998c2ecf20Sopenharmony_ci	unsigned long revision;
1008c2ecf20Sopenharmony_ci	unsigned long serial_no[2];
1018c2ecf20Sopenharmony_ci	unsigned long logout_area_pa;
1028c2ecf20Sopenharmony_ci	unsigned long logout_area_len;
1038c2ecf20Sopenharmony_ci	unsigned long halt_PCBB;
1048c2ecf20Sopenharmony_ci	unsigned long halt_PC;
1058c2ecf20Sopenharmony_ci	unsigned long halt_PS;
1068c2ecf20Sopenharmony_ci	unsigned long halt_arg;
1078c2ecf20Sopenharmony_ci	unsigned long halt_ra;
1088c2ecf20Sopenharmony_ci	unsigned long halt_pv;
1098c2ecf20Sopenharmony_ci	unsigned long halt_reason;
1108c2ecf20Sopenharmony_ci	unsigned long res;
1118c2ecf20Sopenharmony_ci	unsigned long ipc_buffer[21];
1128c2ecf20Sopenharmony_ci	unsigned long palcode_avail[16];
1138c2ecf20Sopenharmony_ci	unsigned long compatibility;
1148c2ecf20Sopenharmony_ci	unsigned long console_data_log_pa;
1158c2ecf20Sopenharmony_ci	unsigned long console_data_log_length;
1168c2ecf20Sopenharmony_ci	unsigned long bcache_info;
1178c2ecf20Sopenharmony_ci};
1188c2ecf20Sopenharmony_ci
1198c2ecf20Sopenharmony_cistruct procdesc_struct {
1208c2ecf20Sopenharmony_ci	unsigned long weird_vms_stuff;
1218c2ecf20Sopenharmony_ci	unsigned long address;
1228c2ecf20Sopenharmony_ci};
1238c2ecf20Sopenharmony_ci
1248c2ecf20Sopenharmony_cistruct vf_map_struct {
1258c2ecf20Sopenharmony_ci	unsigned long va;
1268c2ecf20Sopenharmony_ci	unsigned long pa;
1278c2ecf20Sopenharmony_ci	unsigned long count;
1288c2ecf20Sopenharmony_ci};
1298c2ecf20Sopenharmony_ci
1308c2ecf20Sopenharmony_cistruct crb_struct {
1318c2ecf20Sopenharmony_ci	struct procdesc_struct * dispatch_va;
1328c2ecf20Sopenharmony_ci	struct procdesc_struct * dispatch_pa;
1338c2ecf20Sopenharmony_ci	struct procdesc_struct * fixup_va;
1348c2ecf20Sopenharmony_ci	struct procdesc_struct * fixup_pa;
1358c2ecf20Sopenharmony_ci	/* virtual->physical map */
1368c2ecf20Sopenharmony_ci	unsigned long map_entries;
1378c2ecf20Sopenharmony_ci	unsigned long map_pages;
1388c2ecf20Sopenharmony_ci	struct vf_map_struct map[1];
1398c2ecf20Sopenharmony_ci};
1408c2ecf20Sopenharmony_ci
1418c2ecf20Sopenharmony_cistruct memclust_struct {
1428c2ecf20Sopenharmony_ci	unsigned long start_pfn;
1438c2ecf20Sopenharmony_ci	unsigned long numpages;
1448c2ecf20Sopenharmony_ci	unsigned long numtested;
1458c2ecf20Sopenharmony_ci	unsigned long bitmap_va;
1468c2ecf20Sopenharmony_ci	unsigned long bitmap_pa;
1478c2ecf20Sopenharmony_ci	unsigned long bitmap_chksum;
1488c2ecf20Sopenharmony_ci	unsigned long usage;
1498c2ecf20Sopenharmony_ci};
1508c2ecf20Sopenharmony_ci
1518c2ecf20Sopenharmony_cistruct memdesc_struct {
1528c2ecf20Sopenharmony_ci	unsigned long chksum;
1538c2ecf20Sopenharmony_ci	unsigned long optional_pa;
1548c2ecf20Sopenharmony_ci	unsigned long numclusters;
1558c2ecf20Sopenharmony_ci	struct memclust_struct cluster[0];
1568c2ecf20Sopenharmony_ci};
1578c2ecf20Sopenharmony_ci
1588c2ecf20Sopenharmony_cistruct dsr_struct {
1598c2ecf20Sopenharmony_ci	long smm;			/* SMM nubber used by LMF       */
1608c2ecf20Sopenharmony_ci	unsigned long  lurt_off;	/* offset to LURT table         */
1618c2ecf20Sopenharmony_ci	unsigned long  sysname_off;	/* offset to sysname char count */
1628c2ecf20Sopenharmony_ci};
1638c2ecf20Sopenharmony_ci
1648c2ecf20Sopenharmony_cistruct hwrpb_struct {
1658c2ecf20Sopenharmony_ci	unsigned long phys_addr;	/* check: physical address of the hwrpb */
1668c2ecf20Sopenharmony_ci	unsigned long id;		/* check: "HWRPB\0\0\0" */
1678c2ecf20Sopenharmony_ci	unsigned long revision;
1688c2ecf20Sopenharmony_ci	unsigned long size;		/* size of hwrpb */
1698c2ecf20Sopenharmony_ci	unsigned long cpuid;
1708c2ecf20Sopenharmony_ci	unsigned long pagesize;		/* 8192, I hope */
1718c2ecf20Sopenharmony_ci	unsigned long pa_bits;		/* number of physical address bits */
1728c2ecf20Sopenharmony_ci	unsigned long max_asn;
1738c2ecf20Sopenharmony_ci	unsigned char ssn[16];		/* system serial number: big bother is watching */
1748c2ecf20Sopenharmony_ci	unsigned long sys_type;
1758c2ecf20Sopenharmony_ci	unsigned long sys_variation;
1768c2ecf20Sopenharmony_ci	unsigned long sys_revision;
1778c2ecf20Sopenharmony_ci	unsigned long intr_freq;	/* interval clock frequency * 4096 */
1788c2ecf20Sopenharmony_ci	unsigned long cycle_freq;	/* cycle counter frequency */
1798c2ecf20Sopenharmony_ci	unsigned long vptb;		/* Virtual Page Table Base address */
1808c2ecf20Sopenharmony_ci	unsigned long res1;
1818c2ecf20Sopenharmony_ci	unsigned long tbhb_offset;	/* Translation Buffer Hint Block */
1828c2ecf20Sopenharmony_ci	unsigned long nr_processors;
1838c2ecf20Sopenharmony_ci	unsigned long processor_size;
1848c2ecf20Sopenharmony_ci	unsigned long processor_offset;
1858c2ecf20Sopenharmony_ci	unsigned long ctb_nr;
1868c2ecf20Sopenharmony_ci	unsigned long ctb_size;		/* console terminal block size */
1878c2ecf20Sopenharmony_ci	unsigned long ctbt_offset;	/* console terminal block table offset */
1888c2ecf20Sopenharmony_ci	unsigned long crb_offset;	/* console callback routine block */
1898c2ecf20Sopenharmony_ci	unsigned long mddt_offset;	/* memory data descriptor table */
1908c2ecf20Sopenharmony_ci	unsigned long cdb_offset;	/* configuration data block (or NULL) */
1918c2ecf20Sopenharmony_ci	unsigned long frut_offset;	/* FRU table (or NULL) */
1928c2ecf20Sopenharmony_ci	void (*save_terminal)(unsigned long);
1938c2ecf20Sopenharmony_ci	unsigned long save_terminal_data;
1948c2ecf20Sopenharmony_ci	void (*restore_terminal)(unsigned long);
1958c2ecf20Sopenharmony_ci	unsigned long restore_terminal_data;
1968c2ecf20Sopenharmony_ci	void (*CPU_restart)(unsigned long);
1978c2ecf20Sopenharmony_ci	unsigned long CPU_restart_data;
1988c2ecf20Sopenharmony_ci	unsigned long res2;
1998c2ecf20Sopenharmony_ci	unsigned long res3;
2008c2ecf20Sopenharmony_ci	unsigned long chksum;
2018c2ecf20Sopenharmony_ci	unsigned long rxrdy;
2028c2ecf20Sopenharmony_ci	unsigned long txrdy;
2038c2ecf20Sopenharmony_ci	unsigned long dsr_offset;	/* "Dynamic System Recognition Data Block Table" */
2048c2ecf20Sopenharmony_ci};
2058c2ecf20Sopenharmony_ci
2068c2ecf20Sopenharmony_ci#ifdef __KERNEL__
2078c2ecf20Sopenharmony_ci
2088c2ecf20Sopenharmony_ciextern struct hwrpb_struct *hwrpb;
2098c2ecf20Sopenharmony_ci
2108c2ecf20Sopenharmony_cistatic inline void
2118c2ecf20Sopenharmony_cihwrpb_update_checksum(struct hwrpb_struct *h)
2128c2ecf20Sopenharmony_ci{
2138c2ecf20Sopenharmony_ci	unsigned long sum = 0, *l;
2148c2ecf20Sopenharmony_ci        for (l = (unsigned long *) h; l < (unsigned long *) &h->chksum; ++l)
2158c2ecf20Sopenharmony_ci                sum += *l;
2168c2ecf20Sopenharmony_ci        h->chksum = sum;
2178c2ecf20Sopenharmony_ci}
2188c2ecf20Sopenharmony_ci
2198c2ecf20Sopenharmony_ci#endif /* __KERNEL__ */
2208c2ecf20Sopenharmony_ci
2218c2ecf20Sopenharmony_ci#endif /* __ALPHA_HWRPB_H */
222