xref: /netbsd-src/sys/arch/hppa/include/pdc.h (revision 95f94af30137064a6d8123b816fa7a480569ab55)
1*95f94af3Sandvar /*	$NetBSD: pdc.h,v 1.2 2023/03/26 19:10:33 andvar Exp $	*/
26d3ceb1dSskrll 
36d3ceb1dSskrll /*	$OpenBSD: pdc.h,v 1.35 2007/07/15 20:03:48 kettenis Exp $	*/
46d3ceb1dSskrll 
56d3ceb1dSskrll /*
66d3ceb1dSskrll  * Copyright (c) 1990 mt Xinu, Inc.  All rights reserved.
76d3ceb1dSskrll  * Copyright (c) 1990,1991,1992,1994 University of Utah.  All rights reserved.
86d3ceb1dSskrll  *
96d3ceb1dSskrll  * Permission to use, copy, modify and distribute this software is hereby
106d3ceb1dSskrll  * granted provided that (1) source code retains these copyright, permission,
116d3ceb1dSskrll  * and disclaimer notices, and (2) redistributions including binaries
126d3ceb1dSskrll  * reproduce the notices in supporting documentation, and (3) all advertising
136d3ceb1dSskrll  * materials mentioning features or use of this software display the following
146d3ceb1dSskrll  * acknowledgement: ``This product includes software developed by the
156d3ceb1dSskrll  * Computer Systems Laboratory at the University of Utah.''
166d3ceb1dSskrll  *
176d3ceb1dSskrll  * Copyright (c) 1990 mt Xinu, Inc.
186d3ceb1dSskrll  * This file may be freely distributed in any form as long as
196d3ceb1dSskrll  * this copyright notice is included.
206d3ceb1dSskrll  * MTXINU, THE UNIVERSITY OF UTAH, AND CSL PROVIDE THIS SOFTWARE ``AS
216d3ceb1dSskrll  * IS'' AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING,
226d3ceb1dSskrll  * WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND
236d3ceb1dSskrll  * FITNESS FOR A PARTICULAR PURPOSE.
246d3ceb1dSskrll  *
256d3ceb1dSskrll  * CSL requests users of this software to return to csl-dist@cs.utah.edu any
266d3ceb1dSskrll  * improvements that they make and grant CSL redistribution rights.
276d3ceb1dSskrll  *
286d3ceb1dSskrll  *	Utah $Hdr: pdc.h 1.12 94/12/14$
296d3ceb1dSskrll  *	Author: Jeff Forys (CSS), Dave Slattengren (mtXinu)
306d3ceb1dSskrll  */
316d3ceb1dSskrll 
326d3ceb1dSskrll #ifndef	_MACHINE_PDC_H_
336d3ceb1dSskrll #define _MACHINE_PDC_H_
346d3ceb1dSskrll 
356d3ceb1dSskrll /*
366d3ceb1dSskrll  * Definitions for interaction with "Processor Dependent Code",
376d3ceb1dSskrll  * which is a set of ROM routines used to provide information to the OS.
386d3ceb1dSskrll  * Also includes definitions for the layout of "Page Zero" memory when
396d3ceb1dSskrll  * boot code is invoked.
406d3ceb1dSskrll  *
416d3ceb1dSskrll  * Glossary:
426d3ceb1dSskrll  *	PDC:	Processor Dependent Code (ROM or copy of ROM).
436d3ceb1dSskrll  *	IODC:	I/O Dependent Code (module-type dependent code).
446d3ceb1dSskrll  *	IPL:	Boot program (loaded into memory from boot device).
456d3ceb1dSskrll  *	HPA:	Hard Physical Address (hardwired address).
466d3ceb1dSskrll  *	SPA:	Soft Physical Address (reconfigurable address).
476d3ceb1dSskrll  *
486d3ceb1dSskrll  *
496d3ceb1dSskrll  *
506d3ceb1dSskrll  *
516d3ceb1dSskrll  * Definitions for talking to IODC (I/O Dependent Code).
526d3ceb1dSskrll  *
536d3ceb1dSskrll  * The PDC is used to load I/O Dependent Code from a particular module.
546d3ceb1dSskrll  * I/O Dependent Code is module-type dependent software which provides
556d3ceb1dSskrll  * a uniform way to identify, initialize, and access a module (and in
566d3ceb1dSskrll  * some cases, their devices).
576d3ceb1dSskrll  */
586d3ceb1dSskrll 
596d3ceb1dSskrll /*
606d3ceb1dSskrll  * Our Initial Memory Module is laid out as follows.
616d3ceb1dSskrll  *
626d3ceb1dSskrll  *	0x000		+--------------------+
636d3ceb1dSskrll  *			| Page Zero (iomod.h)|
646d3ceb1dSskrll  *	0x800		+--------------------+
656d3ceb1dSskrll  *			|                    |
666d3ceb1dSskrll  *			|                    |
676d3ceb1dSskrll  *			|        PDC         |
686d3ceb1dSskrll  *			|                    |
696d3ceb1dSskrll  *			|                    |
706d3ceb1dSskrll  *	MEM_FREE	+--------------------+
716d3ceb1dSskrll  *			|                    |
726d3ceb1dSskrll  *              	|    Console IODC    |
736d3ceb1dSskrll  *			|                    |
746d3ceb1dSskrll  *	MEM_FREE+64k	+--------------------+
756d3ceb1dSskrll  *			|                    |
766d3ceb1dSskrll  *              	|  Boot Device IODC  |
776d3ceb1dSskrll  *			|                    |
786d3ceb1dSskrll  *	IPL_START	+--------------------+
796d3ceb1dSskrll  *			|                    |
806d3ceb1dSskrll  *			| IPL Code or Kernel |
816d3ceb1dSskrll  *			|                    |
826d3ceb1dSskrll  *			+--------------------+
836d3ceb1dSskrll  *
846d3ceb1dSskrll  * Restrictions:
856d3ceb1dSskrll  *	MEM_FREE (pagezero.mem_free) can be no greater than 32K.
866d3ceb1dSskrll  *	The PDC may use up to MEM_FREE + 32K (for Console & Boot IODC).
876d3ceb1dSskrll  *	IPL_START must be less than or equal to 64K.
886d3ceb1dSskrll  *
896d3ceb1dSskrll  * The IPL (boot) Code is immediately relocated to RELOC (check
906d3ceb1dSskrll  * "../stand/Makefile") to make way for the Kernel.
916d3ceb1dSskrll  */
926d3ceb1dSskrll 
936d3ceb1dSskrll #define	IODC_MAXSIZE	(64 * 1024)	/* maximum size of IODC */
946d3ceb1dSskrll #define	IODC_MINIOSIZ	64		/* minimum buffer size for IODC call */
956d3ceb1dSskrll #define	IODC_MAXIOSIZ	(64 * 1024)	/* maximum buffer size for IODC call */
966d3ceb1dSskrll 
976d3ceb1dSskrll #define	PDC_ALIGNMENT	__attribute__ ((__aligned__(64)))
986d3ceb1dSskrll #define	PDC_STACKSIZE	(2*NBPG)	/* PDC spec says 7K. */
996d3ceb1dSskrll 
1006d3ceb1dSskrll 
1016d3ceb1dSskrll /*
1026d3ceb1dSskrll  * The PDC Entry Points and their arguments...
1036d3ceb1dSskrll  */
1046d3ceb1dSskrll 
1056d3ceb1dSskrll #define	PDC_POW_FAIL	1	/* prepare for power failure */
1066d3ceb1dSskrll #define PDC_POW_FAIL_DFLT	0
1076d3ceb1dSskrll 
1086d3ceb1dSskrll #define	PDC_CHASSIS	2	/* update chassis display (see below) */
1096d3ceb1dSskrll #define	PDC_CHASSIS_DISP	0	/* update display */
1106d3ceb1dSskrll #define	PDC_CHASSIS_WARN	1	/* return warnings */
1116d3ceb1dSskrll #define	PDC_CHASSIS_ALL		2	/* update display & return warnings */
1126d3ceb1dSskrll #define	PDC_CHASSIS_INFO	128	/* return led/lcd info */
1136d3ceb1dSskrll 
1146d3ceb1dSskrll #define	PDC_PIM		3	/* access Processor Internal Memory */
1156d3ceb1dSskrll #define	PDC_PIM_HPMC		0	/* read High Pri Mach Chk data */
1166d3ceb1dSskrll #define	PDC_PIM_SIZE		1	/* return size */
1176d3ceb1dSskrll #define	PDC_PIM_LPMC		2	/* read Low Pri Mach Chk data */
1186d3ceb1dSskrll #define	PDC_PIM_SBD		3	/* read soft boot data */
1196d3ceb1dSskrll #define	PDC_PIM_TOC		4	/* read TOC data (used to use HPMC) */
1206d3ceb1dSskrll 
1216d3ceb1dSskrll #define	PDC_MODEL	4	/* processor model number info */
1226d3ceb1dSskrll #define	PDC_MODEL_INFO		0	/* processor model number info */
1236d3ceb1dSskrll #define	PDC_MODEL_BOOTID	1	/* set BOOT_ID of processor */
1246d3ceb1dSskrll #define	PDC_MODEL_COMP		2	/* return component version numbers */
1256d3ceb1dSskrll #define	PDC_MODEL_MODEL		3	/* return system model information */
1266d3ceb1dSskrll #define	PDC_MODEL_ENSPEC	4	/* enable product-specific instrs */
1276d3ceb1dSskrll #define	PDC_MODEL_DISPEC	5	/* disable product-specific instrs */
1286d3ceb1dSskrll #define	PDC_MODEL_CPUID		6	/* return CPU versions */
1296d3ceb1dSskrll #define	PDC_MODEL_CAPABILITIES	7	/* return capabilities */
1306d3ceb1dSskrll #define	PDC_MODEL_GETBOOTSTOPTS	8	/* return boot test options */
1316d3ceb1dSskrll #define	PDC_MODEL_SETBOOTSTOPTS	9	/* set boot test options */
1326d3ceb1dSskrll 
1336d3ceb1dSskrll #define	PDC_CACHE	5	/* return cache and TLB params */
1346d3ceb1dSskrll #define	PDC_CACHE_DFLT		0	/* return parameters */
1356d3ceb1dSskrll #define	PDC_CACHE_SETCS		1	/* set coherence state */
1366d3ceb1dSskrll #define	PDC_CACHE_GETSPIDB	2	/* get space-id bits */
1376d3ceb1dSskrll 
1386d3ceb1dSskrll #define	PDC_HPA		6	/* return HPA of processor */
1396d3ceb1dSskrll #define	PDC_HPA_DFLT		0
1406d3ceb1dSskrll #define	PDC_HPA_MODULES		1
1416d3ceb1dSskrll 
1426d3ceb1dSskrll #define	PDC_COPROC	7	/* return co-processor configuration */
1436d3ceb1dSskrll #define	PDC_COPROC_DFLT		0
1446d3ceb1dSskrll 
1456d3ceb1dSskrll #define	PDC_IODC	8	/* talk to IODC */
1466d3ceb1dSskrll #define	PDC_IODC_READ		0	/* read IODC entry point */
1476d3ceb1dSskrll #define		IODC_DATA	0	/* get first 16 bytes from mod IODC */
1486d3ceb1dSskrll #define		IODC_INIT	3	/* initialize (see options below) */
1496d3ceb1dSskrll #define		IODC_INIT_FIRST	2	/* find first device on module */
1506d3ceb1dSskrll #define		IODC_INIT_NEXT	3	/* find subsequent devices on module */
1516d3ceb1dSskrll #define		IODC_INIT_ALL	4	/* initialize module and device */
1526d3ceb1dSskrll #define		IODC_INIT_DEV	5	/* initialize device */
1536d3ceb1dSskrll #define		IODC_INIT_MOD	6	/* initialize module */
1546d3ceb1dSskrll #define		IODC_INIT_MSG	9	/* return error message(s) */
1556d3ceb1dSskrll #define		IODC_INIT_STR	20	/* find device w/ spec in string */
1566d3ceb1dSskrll #define		IODC_IO		4	/* perform I/O (see options below) */
1576d3ceb1dSskrll #define		IODC_IO_READ	0	/* read from boot device */
1586d3ceb1dSskrll #define		IODC_IO_WRITE	1	/* write to boot device */
1596d3ceb1dSskrll #define		IODC_IO_CONSIN	2	/* read from console */
1606d3ceb1dSskrll #define		IODC_IO_CONSOUT	3	/* write to conosle */
1616d3ceb1dSskrll #define		IODC_IO_CLOSE	4	/* close device */
1626d3ceb1dSskrll #define		IODC_IO_MSG	9	/* return error message(s) */
1636d3ceb1dSskrll #define		IODC_SPA	5	/* get extended SPA information */
1646d3ceb1dSskrll #define		IODC_SPA_DFLT	0	/* return SPA information */
1656d3ceb1dSskrll #define		IODC_TEST	8	/* perform self tests */
1666d3ceb1dSskrll #define		IODC_TEST_INFO	0	/* return test information */
1676d3ceb1dSskrll #define		IODC_TEST_STEP	1	/* execute a particular test */
1686d3ceb1dSskrll #define		IODC_TEST_TEST	2	/* describe a test section */
1696d3ceb1dSskrll #define		IODC_TEST_MSG	9	/* return error message(s) */
1706d3ceb1dSskrll #define	PDC_IODC_NINIT		2	/* non-destructive init */
1716d3ceb1dSskrll #define	PDC_IODC_DINIT		3	/* destructive init */
1726d3ceb1dSskrll #define	PDC_IODC_MEMERR		4	/* check for memory errors */
1736d3ceb1dSskrll #define	PDC_IODC_IMEMMASTER	5	/* interlieved memory master ID */
1746d3ceb1dSskrll 
1756d3ceb1dSskrll #define	PDC_TOD		9	/* access time-of-day clock */
1766d3ceb1dSskrll #define	PDC_TOD_READ		0	/* read TOD clock */
1776d3ceb1dSskrll #define	PDC_TOD_WRITE		1	/* write TOD clock */
1786d3ceb1dSskrll #define	PDC_TOD_ITIMER		2	/* calibrate Interval Timer (CR16) */
1796d3ceb1dSskrll 
1806d3ceb1dSskrll #define	PDC_STABLE	10	/* access Stable Storage (SS) */
1816d3ceb1dSskrll #define	PDC_STABLE_READ		0	/* read SS */
1826d3ceb1dSskrll #define	PDC_STABLE_WRITE	1	/* write SS */
1836d3ceb1dSskrll #define	PDC_STABLE_SIZE		2	/* return size of SS */
1846d3ceb1dSskrll #define	PDC_STABLE_VRFY		3	/* verify contents of SS */
1856d3ceb1dSskrll #define	PDC_STABLE_INIT		4	/* initialize SS */
1866d3ceb1dSskrll 
1876d3ceb1dSskrll #define	PDC_NVM		11	/* access Non-Volatile Memory (NVM) */
1886d3ceb1dSskrll #define	PDC_NVM_READ		0	/* read NVM */
1896d3ceb1dSskrll #define	PDC_NVM_WRITE		1	/* write NVM */
1906d3ceb1dSskrll #define	PDC_NVM_SIZE		2	/* return size of NVM */
1916d3ceb1dSskrll #define	PDC_NVM_VRFY		3	/* verify contents of NVM */
1926d3ceb1dSskrll #define	PDC_NVM_INIT		4	/* initialize NVM */
1936d3ceb1dSskrll 
1946d3ceb1dSskrll #define	PDC_ADD_VALID	12	/* check address for validity */
1956d3ceb1dSskrll #define	PDC_ADD_VALID_DFLT	0
1966d3ceb1dSskrll 
1976d3ceb1dSskrll #define	PDC_BUS_BAD	13	/* verify Error Detection Circuitry (EDC) */
1986d3ceb1dSskrll #define	PDC_BUS_BAD_DLFT	0
1996d3ceb1dSskrll 
2006d3ceb1dSskrll #define	PDC_DEBUG	14	/* return address of PDC debugger */
2016d3ceb1dSskrll #define	PDC_DEBUG_DFLT		0
2026d3ceb1dSskrll 
2036d3ceb1dSskrll #define	PDC_INSTR	15	/* return instr that invokes PDCE_CHECK */
2046d3ceb1dSskrll #define	PDC_INSTR_DFLT		0
2056d3ceb1dSskrll 
2066d3ceb1dSskrll #define	PDC_PROC	16	/* stop currently executing processor */
2076d3ceb1dSskrll #define	PDC_PROC_STOP		0
2086d3ceb1dSskrll #define	PDC_PROC_RENDEZVOUS	1
2096d3ceb1dSskrll 
2106d3ceb1dSskrll #define	PDC_CONF	17	/* (de)configure a module */
2116d3ceb1dSskrll #define	PDC_CONF_DECONF		0	/* deconfigure module */
2126d3ceb1dSskrll #define	PDC_CONF_RECONF		1	/* reconfigure module */
213*95f94af3Sandvar #define	PDC_CONF_INFO		2	/* get config information */
2146d3ceb1dSskrll 
2156d3ceb1dSskrll #define PDC_BLOCK_TLB	18	/* Manage Block TLB entries (BTLB) */
2166d3ceb1dSskrll #define PDC_BTLB_DEFAULT	0	/* Return BTLB configuration info  */
2176d3ceb1dSskrll #define PDC_BTLB_INSERT		1	/* Insert a BTLB entry             */
2186d3ceb1dSskrll #define PDC_BTLB_PURGE		2	/* Purge a BTLB entry              */
2196d3ceb1dSskrll #define PDC_BTLB_PURGE_ALL	3	/* Purge all BTLB entries          */
2206d3ceb1dSskrll 
2216d3ceb1dSskrll #define PDC_TLB		19	/* Manage Hardware TLB handling */
2226d3ceb1dSskrll #define PDC_TLB_INFO		0	/* Return HW-TLB configuration info  */
2236d3ceb1dSskrll #define PDC_TLB_CONFIG		1	/* Set HW-TLB pdir base and size */
2246d3ceb1dSskrll 
2256d3ceb1dSskrll #define PDC_TLB_CURRPDE		1	/* cr28 points to current pde on miss */
2266d3ceb1dSskrll #define PDC_TLB_RESERVD		3	/* reserved */
2276d3ceb1dSskrll #define PDC_TLB_NEXTPDE		5	/* cr28 points to next pde on miss */
2286d3ceb1dSskrll #define PDC_TLB_WORD3		7	/* cr28 is word 3 of 16 byte pde */
2296d3ceb1dSskrll 
2306d3ceb1dSskrll #define	PDC_PSW		21	/* manage default values of configurable psw bits */
2316d3ceb1dSskrll #define	PDC_PSW_GETMASK		0	/* get mask */
2326d3ceb1dSskrll #define	PDC_PSW_DEFAULTS	1	/* get default bits values */
2336d3ceb1dSskrll #define	PDC_PSW_SETDEFAULTS	2	/* set default bits values */
2346d3ceb1dSskrll 
2356d3ceb1dSskrll #define	PDC_SYSTEM_MAP		22	/* map system modules */
2366d3ceb1dSskrll #define	PDC_SYSTEM_MAP_FIND_MOD 0	/* find module by index */
2376d3ceb1dSskrll #define	PDC_SYSTEM_MAP_FIND_ADDR	1	/* fetch list of addresses */
2386d3ceb1dSskrll #define	PDC_SYSTEM_MAP_TRANS_PATH	2	/* get hpa from devpath */
2396d3ceb1dSskrll 
2406d3ceb1dSskrll #define	PDC_SOFT_POWER		23	/* support for soft power switch */
2416d3ceb1dSskrll #define	PDC_SOFT_POWER_INFO	0	/* get info about soft power switch */
2426d3ceb1dSskrll #define	PDC_SOFT_POWER_ENABLE	1	/* enable/disable soft power switch */
2436d3ceb1dSskrll 
2446d3ceb1dSskrll #define	PDC_PAT_CELL	64	/* cell operations */
2456d3ceb1dSskrll #define	PDC_PAT_CELL_GETID	0	/* get cell id number */
2466d3ceb1dSskrll #define	PDC_PAT_CELL_GETINFO	1	/* get cell info */
2476d3ceb1dSskrll #define	PDC_PAT_CELL_MODULE	2	/* get module info */
2486d3ceb1dSskrll #define		PDC_PAT_IOVIEW	0
2496d3ceb1dSskrll #define		PDC_PAT_PAVIEW	1
2506d3ceb1dSskrll 
2516d3ceb1dSskrll #define	PDC_PAT_CHASSIS	65	/* chassis log ops */
2526d3ceb1dSskrll #define	PDC_PAT_CHASSIS_WRITE	0
2536d3ceb1dSskrll #define	PDC_PAT_CHASSIS_READ	1
2546d3ceb1dSskrll 
2556d3ceb1dSskrll #define	PDC_PAT_CPU	67
2566d3ceb1dSskrll 
2576d3ceb1dSskrll #define	PDC_PAT_EVENT	68
2586d3ceb1dSskrll 
2596d3ceb1dSskrll #define	PDC_PAT_HPMC	70
2606d3ceb1dSskrll 
2616d3ceb1dSskrll #define	PDC_PAT_IO		71	/* online services for IO modules */
2626d3ceb1dSskrll #define	PDC_PAT_IO_GET_PCI_RTSZ	15
2636d3ceb1dSskrll #define	PDC_PAT_IO_GET_PCI_RT	16
2646d3ceb1dSskrll 
2656d3ceb1dSskrll #define	PDC_PAT_MEM	72
2666d3ceb1dSskrll 
2676d3ceb1dSskrll #define	PDC_PAT_NVRAM	73
2686d3ceb1dSskrll 
2696d3ceb1dSskrll #define	PDC_PAT_PROTDOM	74
2706d3ceb1dSskrll 
2716d3ceb1dSskrll #define	PDC_MEMMAP		128	/* hppa: return page information */
2726d3ceb1dSskrll #define	PDC_MEMMAP_HPA		0	/* map module # to HPA */
2736d3ceb1dSskrll 
2746d3ceb1dSskrll #define	PDC_EEPROM		129	/* Hversion dependent */
2756d3ceb1dSskrll #define	PDC_EEPROM_READ_WORD	0
2766d3ceb1dSskrll #define	PDC_EEPROM_WRITE_WORD	1
2776d3ceb1dSskrll #define	PDC_EEPROM_READ_BYTE	2
2786d3ceb1dSskrll #define	PDC_EEPROM_WRITE_BYTE	3
2796d3ceb1dSskrll 
2806d3ceb1dSskrll #define	PDC_IO		135
2816d3ceb1dSskrll #define	PDC_IO_READ_AND_CLEAR_ERRORS	0
2826d3ceb1dSskrll #define	PDC_IO_RESET			1
2836d3ceb1dSskrll #define	PDC_IO_RESET_DEVICES		2
2846d3ceb1dSskrll 
2856d3ceb1dSskrll #define	PDC_BROADCAST_RESET	136
2866d3ceb1dSskrll #define	PDC_DO_RESET		0
2876d3ceb1dSskrll #define	PDC_DO_FIRM_TEST_RESET	1
2886d3ceb1dSskrll #define	PDC_BR_RECONFIGURATION	2
2896d3ceb1dSskrll 
2906d3ceb1dSskrll #define	PDC_LAN_STATION_ID	138     /* Hversion dependent mechanism for */
2916d3ceb1dSskrll #define	PDC_LAN_STATION_ID_READ	0       /* getting the lan station address  */
2926d3ceb1dSskrll 
2936d3ceb1dSskrll #define	PDC_PCI_INDEX		147	/* PCI rt access */
2946d3ceb1dSskrll #define	PDC_PCI_GET_INT_TBL_SZ	13
2956d3ceb1dSskrll #define	PDC_PCI_GET_INT_TBL	14
2966d3ceb1dSskrll 
2976d3ceb1dSskrll #define	PDC_ERR_OK		0	/* operation complete */
2986d3ceb1dSskrll #define	PDC_ERR_WARNING		3	/* OK, but warning */
2996d3ceb1dSskrll #define	PDC_ERR_NOPROC		-1	/* no such procedure */
3006d3ceb1dSskrll #define	PDC_ERR_NOPT		-2	/* no such option */
3016d3ceb1dSskrll #define	PDC_ERR_COMPL		-3	/* unable to complete w/o error */
3026d3ceb1dSskrll #define	PDC_ERR_NMOD		-5	/* module not found */
3036d3ceb1dSskrll #define	PDC_ERR_EOD		-9	/* end of device list */
3046d3ceb1dSskrll #define	PDC_ERR_INVAL		-10	/* invalid argument */
3056d3ceb1dSskrll #define	PDC_ERR_PFAIL		-12	/* aborted by powerfail */
3066d3ceb1dSskrll 
3076d3ceb1dSskrll #if !defined(_LOCORE)
3086d3ceb1dSskrll 
3096d3ceb1dSskrll struct iomod;
3106d3ceb1dSskrll 
3116d3ceb1dSskrll typedef int (*pdcio_t)(int, int, ...);
3126d3ceb1dSskrll typedef int (*iodcio_t)(struct iomod *, int, ...);
3136d3ceb1dSskrll 
3146d3ceb1dSskrll /*
3156d3ceb1dSskrll  * Commonly used PDC calls and the structures they return.
3166d3ceb1dSskrll  */
3176d3ceb1dSskrll 
3186d3ceb1dSskrll /*
3196d3ceb1dSskrll  * Device path specifications used by PDC.
3206d3ceb1dSskrll  */
3216d3ceb1dSskrll struct device_path {
3226d3ceb1dSskrll 	u_char	dp_flags;	/* see bit definitions below */
3236d3ceb1dSskrll #define	PZF_AUTOBOOT	0x80	/* These two are PDC flags for how to locate */
3246d3ceb1dSskrll #define	PZF_AUTOSEARCH	0x40	/*	the "boot device" */
3256d3ceb1dSskrll #define	PZF_TIMER	0x0f	/* power of 2 # secs "boot timer" (0 == dflt) */
3266d3ceb1dSskrll #define	PZF_BITS	"\020\010autoboot\07autosearch"
3276d3ceb1dSskrll 
3286d3ceb1dSskrll 	char	dp_bc[6];	/* Bus Converter routing info to a specific */
3296d3ceb1dSskrll 				/* I/O adaptor (< 0 means none, > 63 resvd) */
3306d3ceb1dSskrll 	char	dp_mod;		/* fixed field of specified module */
3316d3ceb1dSskrll 	int	dp_layers[6];	/* device-specific info (ctlr #, unit # ...) */
3326d3ceb1dSskrll #define	PZL_BITS(l)	(((l) & 0x03) + 5)
3336d3ceb1dSskrll #define	PZL_PARITY(l)	(((l) & 0x18) >> 3)
3346d3ceb1dSskrll #define	PZL_SPEED(l)	(((l) & 0x3c0) >> 6)
3356d3ceb1dSskrll #define	PZL_ENCODE(bits, parity, speed) \
3366d3ceb1dSskrll 	(((bits) - 5) & 0x03) | (((parity) & 0x3) << 3) | \
3376d3ceb1dSskrll 	(((speed) & 0x0f) << 6)
3386d3ceb1dSskrll };
3396d3ceb1dSskrll 
3406d3ceb1dSskrll struct pdc_result {	/* general result buffer */
3416d3ceb1dSskrll 	u_int	result[32];
3426d3ceb1dSskrll };
3436d3ceb1dSskrll 
3446d3ceb1dSskrll struct pdc_pim {	/* PDC_PIM */
3456d3ceb1dSskrll 	u_int	count;		/* actual (HPMC, LPMC) or total (SIZE) count */
3466d3ceb1dSskrll 	u_int	archsize;	/* size of architected regions (see "pim.h") */
3476d3ceb1dSskrll };
3486d3ceb1dSskrll 
3496d3ceb1dSskrll struct pdc_model {	/* PDC_MODEL */
3506d3ceb1dSskrll 	u_int	res1 : 16;	/* reserved */
3516d3ceb1dSskrll 	u_int	hwmodel : 12;	/* hardware model. */
3526d3ceb1dSskrll 	u_int	hv : 4;
3536d3ceb1dSskrll 	u_int	rev : 4;	/* zero for all native processors */
3546d3ceb1dSskrll 	u_int	model : 20;	/* 4 for all native processors */
3556d3ceb1dSskrll 	u_int	sh : 1;		/* shadow registers are present */
3566d3ceb1dSskrll 	u_int	reserved : 2;	/* reserved */
3576d3ceb1dSskrll 	u_int	mc : 1;		/* module category (A - 0, B - 1) */
3586d3ceb1dSskrll 	u_int	reserved1 : 2;	/* reserved */
3596d3ceb1dSskrll 	u_int	pa_lvl : 2;	/* PA-RISC level */
3606d3ceb1dSskrll 	u_int	hw_id;		/* unique processor hardware identifier */
3616d3ceb1dSskrll 	u_int	boot_id;	/* same as hw_id */
3626d3ceb1dSskrll 	u_int	sw_id;		/* software security and licensing */
3636d3ceb1dSskrll 	u_int	sw_cap;		/* OS capabilities of processor */
3646d3ceb1dSskrll 	u_int	arch_rev;	/* architecture revision */
3656d3ceb1dSskrll 	u_int	pot_key;	/* potential key */
3666d3ceb1dSskrll 	u_int	curr_key;	/* current key */
3676d3ceb1dSskrll };
3686d3ceb1dSskrll 
3696d3ceb1dSskrll struct pdc_cpuid {	/* PDC_MODEL, PDC_CPUID */
3706d3ceb1dSskrll 	u_int	reserved : 20;
3716d3ceb1dSskrll 	u_int	version  :  7;	/* CPU version */
3726d3ceb1dSskrll 	u_int	revision :  5;	/* CPU revision */
3736d3ceb1dSskrll };
3746d3ceb1dSskrll 
3756d3ceb1dSskrll struct pdc_getbootopts {	/* PDC_MODEL_GETBOOTOPTS */
3766d3ceb1dSskrll 	u_int	cur_test;	/* current enabled tests */
3776d3ceb1dSskrll 	u_int	sup_test;	/* supported tests */
3786d3ceb1dSskrll 	u_int	def_test;	/* default enabled tests */
3796d3ceb1dSskrll };
3806d3ceb1dSskrll 
3816d3ceb1dSskrll struct cache_cf {	/* PDC_CACHE (for "struct pdc_cache") */
3826d3ceb1dSskrll 	u_int	cc_alias: 4,	/* virtual address aliasing boundary */
3836d3ceb1dSskrll 		cc_block: 4,	/* used to determine most efficient stride */
3846d3ceb1dSskrll 		cc_line	: 3,	/* max data written by store (16-byte mults) */
3856d3ceb1dSskrll 		cc_resv1: 2,	/* (reserved) */
3866d3ceb1dSskrll 		cc_wt	: 1,	/* D-cache: write-to = 0, write-through = 1 */
3876d3ceb1dSskrll 		cc_fsel	: 2,	/* Both (00) / only D/I (01/10) / either (11) F[DI]C  */
3886d3ceb1dSskrll 		cc_cst  : 3,	/* D-cache: incoherent = 0, coherent = 1 */
3896d3ceb1dSskrll 		cc_resv2:11,	/* (reserved) */
3906d3ceb1dSskrll 		cc_hvers: 2;	/* H-VERSION dependent */
3916d3ceb1dSskrll };
3926d3ceb1dSskrll 
3936d3ceb1dSskrll struct itlb_cf {		/* PDC_CACHE (for "struct pdc_cache") */
3946d3ceb1dSskrll 	u_int	tc_resv1:12,	/* (reserved) */
3956d3ceb1dSskrll 		tc_sh	: 2,	/* separate I and D = 0, shared I and D = 1 */
3966d3ceb1dSskrll 		tc_hvers: 1,	/* H-VERSION dependent */
3976d3ceb1dSskrll 		tc_page : 1,	/* 2K page size = 0, 4k page size = 1 */
3986d3ceb1dSskrll 		tc_cst  : 3,	/* incoherent = 0, coherent = 1 */
3996d3ceb1dSskrll 		tc_aid  : 5,	/* access id width = 15 + aid */
4006d3ceb1dSskrll 		tc_sr   : 6,	/* space id width */
4016d3ceb1dSskrll 		tc_hv2  : 2;	/* H-VERSION dependent */
4026d3ceb1dSskrll };
4036d3ceb1dSskrll 
4046d3ceb1dSskrll struct dtlb_cf {		/* PDC_CACHE (for "struct pdc_cache") */
4056d3ceb1dSskrll 	u_int	tc_resv1:12,	/* (reserved) */
4066d3ceb1dSskrll 		tc_sh	: 2,	/* separate I and D = 0, shared I and D = 1 */
4076d3ceb1dSskrll 		tc_hvers: 1,	/* H-VERSION dependent */
4086d3ceb1dSskrll 		tc_u    : 1,	/* TLB U bit implemented  */
4096d3ceb1dSskrll 		tc_cst  : 3,	/* incoherent = 0, coherent = 1 */
4106d3ceb1dSskrll 		tc_resv2: 11,	/* (reserved) */
4116d3ceb1dSskrll 		tc_hv2  : 2;	/* H-VERSION dependent */
4126d3ceb1dSskrll };
4136d3ceb1dSskrll 
4146d3ceb1dSskrll struct pdc_cache {	/* PDC_CACHE */
4156d3ceb1dSskrll /* Instruction cache */
4166d3ceb1dSskrll 	u_int	ic_size;	/* size of I-cache (in bytes) */
4176d3ceb1dSskrll 	struct cache_cf ic_conf;/* cache configuration (see above) */
4186d3ceb1dSskrll 	u_int	ic_base;	/* start addr of I-cache (for FICE flush) */
4196d3ceb1dSskrll 	u_int	ic_stride;	/* addr incr per i_count iteration (flush) */
4206d3ceb1dSskrll 	u_int	ic_count;	/* number of i_loop iterations (flush) */
4216d3ceb1dSskrll 	u_int	ic_loop;	/* number of FICE's per addr stride (flush) */
4226d3ceb1dSskrll /* Data cache */
4236d3ceb1dSskrll 	u_int	dc_size;	/* size of D-cache (in bytes) */
4246d3ceb1dSskrll 	struct cache_cf dc_conf;/* cache configuration (see above) */
4256d3ceb1dSskrll 	u_int	dc_base;	/* start addr of D-cache (for FDCE flush) */
4266d3ceb1dSskrll 	u_int	dc_stride;	/* addr incr per d_count iteration (flush) */
4276d3ceb1dSskrll 	u_int	dc_count;	/* number of d_loop iterations (flush) */
4286d3ceb1dSskrll 	u_int	dc_loop;	/* number of FDCE's per addr stride (flush) */
4296d3ceb1dSskrll /* Instruction TLB */
4306d3ceb1dSskrll 	u_int	it_size;	/* number of entries in I-TLB */
4316d3ceb1dSskrll 	struct itlb_cf it_conf;	/* I-TLB configuration (see above) */
4326d3ceb1dSskrll 	u_int	it_sp_base;	/* start space of I-TLB (for PITLBE flush) */
4336d3ceb1dSskrll 	u_int	it_sp_stride;	/* space incr per sp_count iteration (flush) */
4346d3ceb1dSskrll 	u_int	it_sp_count;	/* number of off_count iterations (flush) */
4356d3ceb1dSskrll 	u_int	it_off_base;	/* start offset of I-TLB (for PITLBE flush) */
4366d3ceb1dSskrll 	u_int	it_off_stride;	/* offset incr per off_count iteration (flush)*/
4376d3ceb1dSskrll 	u_int	it_off_count;	/* number of it_loop iterations/space (flush) */
4386d3ceb1dSskrll 	u_int	it_loop;	/* number of PITLBE's per off_stride (flush) */
4396d3ceb1dSskrll /* Data TLB */
4406d3ceb1dSskrll 	u_int	dt_size;	/* number of entries in D-TLB */
4416d3ceb1dSskrll 	struct dtlb_cf dt_conf;	/* D-TLB configuration (see above) */
4426d3ceb1dSskrll 	u_int	dt_sp_base;	/* start space of D-TLB (for PDTLBE flush) */
4436d3ceb1dSskrll 	u_int	dt_sp_stride;	/* space incr per sp_count iteration (flush) */
4446d3ceb1dSskrll 	u_int	dt_sp_count;	/* number of off_count iterations (flush) */
4456d3ceb1dSskrll 	u_int	dt_off_base;	/* start offset of D-TLB (for PDTLBE flush) */
4466d3ceb1dSskrll 	u_int	dt_off_stride;	/* offset incr per off_count iteration (flush)*/
4476d3ceb1dSskrll 	u_int	dt_off_count;	/* number of dt_loop iterations/space (flush) */
4486d3ceb1dSskrll 	u_int	dt_loop;	/* number of PDTLBE's per off_stride (flush) */
4496d3ceb1dSskrll };
4506d3ceb1dSskrll 
4516d3ceb1dSskrll struct pdc_spidb {	/* PDC_CACHE, PDC_CACHE_GETSPIDB */
4526d3ceb1dSskrll 	u_int	spidR1   : 4;
4536d3ceb1dSskrll 	u_int	spidbits : 12;
4546d3ceb1dSskrll 	u_int	spidR2   : 16;
4556d3ceb1dSskrll };
4566d3ceb1dSskrll 
4576d3ceb1dSskrll struct pdc_cst {
4586d3ceb1dSskrll 	u_int	cstR1  : 16;
4596d3ceb1dSskrll 	u_int	cst    :  3;
4606d3ceb1dSskrll 	u_int	cstR2  : 13;
4616d3ceb1dSskrll };
4626d3ceb1dSskrll 
4636d3ceb1dSskrll struct pdc_coherence {	/* PDC_CACHE, PDC_CACHE_SETCS */
4646d3ceb1dSskrll 	struct pdc_cst	ia;
4656d3ceb1dSskrll #define	ia_cst ia.cst
4666d3ceb1dSskrll 	struct pdc_cst	da;
4676d3ceb1dSskrll #define	da_cst da.cst
4686d3ceb1dSskrll 	struct pdc_cst	ita;
4696d3ceb1dSskrll #define	ita_cst ita.cst
4706d3ceb1dSskrll 	struct pdc_cst	dta;
4716d3ceb1dSskrll #define	dta_cst dta.cst
4726d3ceb1dSskrll };
4736d3ceb1dSskrll 
4746d3ceb1dSskrll struct pdc_hpa {	/* PDC_HPA */
4756d3ceb1dSskrll 	hppa_hpa_t hpa;	/* HPA of processor */
4766d3ceb1dSskrll };
4776d3ceb1dSskrll 
4786d3ceb1dSskrll struct pdc_coproc {	/* PDC_COPROC */
4796d3ceb1dSskrll 	u_int	ccr_enable;	/* same format as CCR (CR 10) */
4806d3ceb1dSskrll 	u_int	ccr_present;	/* which co-proc's are present (bitset) */
4816d3ceb1dSskrll 	u_int	pad[15];
4826d3ceb1dSskrll 	u_int	fpu_revision;
4836d3ceb1dSskrll 	u_int	fpu_model;
4846d3ceb1dSskrll };
4856d3ceb1dSskrll 
4866d3ceb1dSskrll struct pdc_tod {	/* PDC_TOD, PDC_TOD_READ */
4876d3ceb1dSskrll 	u_int	sec;		/* elapsed time since 00:00:00 GMT, 1/1/70 */
4886d3ceb1dSskrll 	u_int	usec;		/* accurate to microseconds */
4896d3ceb1dSskrll };
4906d3ceb1dSskrll 
4916d3ceb1dSskrll struct pdc_itimer {	/* PDC_TOD_ITIMER */
4926d3ceb1dSskrll 	u_int	calib0;		/* double giving itmr freq */
4936d3ceb1dSskrll 	u_int	calib1;
4946d3ceb1dSskrll 	u_int	tod_acc;	/* TOD accuracy in 1e-9 part */
4956d3ceb1dSskrll 	u_int	cr_acc;		/* itmr accuracy in 1e-9 parts */
4966d3ceb1dSskrll };
4976d3ceb1dSskrll 
4986d3ceb1dSskrll struct pdc_nvm {	/* PDC_NVM */
4996d3ceb1dSskrll 	u_int	hv[9];		/* 0x00: HV dependent */
5006d3ceb1dSskrll 	struct device_path bootpath;	/* 0x24: boot path */
5016d3ceb1dSskrll 	u_int	isl_ver;	/* 0x44: ISL revision */
5026d3ceb1dSskrll 	u_int	timestamp;	/* 0x48: timestamp */
5036d3ceb1dSskrll 	u_int	lif_ue[12];	/* 0x4c: LIF utility entries */
5046d3ceb1dSskrll 	u_int	eptr;		/* 0x7c: entry pointer */
5056d3ceb1dSskrll 	u_int	os_panic[32];	/* 0x80: OS panic info */
5066d3ceb1dSskrll };
5076d3ceb1dSskrll 
5086d3ceb1dSskrll struct pdc_instr {	/* PDC_INSTR */
5096d3ceb1dSskrll 	u_int	instr;		/* instruction that invokes PDC mchk entry pt */
5106d3ceb1dSskrll };
5116d3ceb1dSskrll 
5126d3ceb1dSskrll struct pdc_iodc_read {	/* PDC_IODC, PDC_IODC_READ */
5136d3ceb1dSskrll 	int	size;		/* number of bytes in selected entry point */
5146d3ceb1dSskrll 	int	filler1;
5156d3ceb1dSskrll 	u_int	filler2[30];
5166d3ceb1dSskrll };
5176d3ceb1dSskrll 
5186d3ceb1dSskrll struct pdc_iodc_minit {	/* PDC_IODC, PDC_IODC_NINIT or PDC_IODC_DINIT */
5196d3ceb1dSskrll 	u_int	stat;		/* HPA.io_status style error returns */
5206d3ceb1dSskrll 	u_int	max_spa;	/* size of SPA (in bytes) > max_mem+map_mem */
5216d3ceb1dSskrll 	u_int	max_mem;	/* size of "implemented" memory (in bytes) */
5226d3ceb1dSskrll 	u_int	map_mem;	/* size of "mappable-only" memory (in bytes) */
5236d3ceb1dSskrll };
5246d3ceb1dSskrll 
5256d3ceb1dSskrll struct btlb_info {		/* for "struct pdc_btlb" (PDC_BTLB) */
5266d3ceb1dSskrll 	u_int	resv0: 8,	/* (reserved) */
5276d3ceb1dSskrll 		num_i: 8,	/* Number of instruction slots */
5286d3ceb1dSskrll 		num_d: 8,	/* Number of data slots */
5296d3ceb1dSskrll 		num_c: 8;	/* Number of combined slots */
5306d3ceb1dSskrll };
5316d3ceb1dSskrll 
5326d3ceb1dSskrll struct pdc_btlb {	/* PDC_BLOCK_TLB */
5336d3ceb1dSskrll 	u_int	min_size;	/* Min size in pages */
5346d3ceb1dSskrll 	u_int	max_size;	/* Max size in pages */
5356d3ceb1dSskrll 	struct btlb_info finfo;	/* Fixed range info */
5366d3ceb1dSskrll 	struct btlb_info vinfo; /* Variable range info */
5376d3ceb1dSskrll };
5386d3ceb1dSskrll 
5396d3ceb1dSskrll struct pdc_hwtlb {	/* PDC_TLB */
5406d3ceb1dSskrll 	u_int	min_size;	/* What do these mean? */
5416d3ceb1dSskrll 	u_int	max_size;
5426d3ceb1dSskrll };
5436d3ceb1dSskrll 
5446d3ceb1dSskrll struct pdc_power_info {		/* PDC_SOFT_POWER_INFO */
5456d3ceb1dSskrll 	u_int	addr;		/* power register address */
5466d3ceb1dSskrll };
5476d3ceb1dSskrll 
5486d3ceb1dSskrll struct pdc_pat_cell_id {	/* PDC_PAT_CELL_GETID */
5496d3ceb1dSskrll 	u_long	id;		/* cell id */
5506d3ceb1dSskrll 	u_long	loc;		/* cell location */
5516d3ceb1dSskrll };
5526d3ceb1dSskrll 
5536d3ceb1dSskrll struct pdc_pat_cell_module {	/* PDC_PAT_CELL_MODULE */
5546d3ceb1dSskrll 	u_long	chpa;		/* config space HPA */
5556d3ceb1dSskrll 	u_long	info;		/* module info */
5566d3ceb1dSskrll #define	PDC_PAT_CELL_MODTYPE(t)	(((t) >> 56) & 0xff)
5576d3ceb1dSskrll #define	PDC_PAT_CELL_MODDVI(t)	(((t) >> 48) & 0xff)
5586d3ceb1dSskrll #define	PDC_PAT_CELL_MODIOC(t)	(((t) >> 40) & 0xff)
5596d3ceb1dSskrll #define	PDC_PAT_CELL_MODSIZE(t)	(((t) & 0xffffff) << PAGE_SHIFT)
5606d3ceb1dSskrll 	u_long	loc;		/* module location */
5616d3ceb1dSskrll 	struct device_path dp;	/* module path */
5626d3ceb1dSskrll 	u_long	pad[508];	/* cell module gedoens */
5636d3ceb1dSskrll };
5646d3ceb1dSskrll 
5656d3ceb1dSskrll struct pdc_pat_io_num {	/* PDC_PAT_IO */
5666d3ceb1dSskrll 	u_int	num;
5676d3ceb1dSskrll };
5686d3ceb1dSskrll 
5696d3ceb1dSskrll struct pdc_pat_pci_rt {	/* PDC_PAT_IO_GET_PCI_RT */
5706d3ceb1dSskrll 	uint8_t		type;		/* 0x8b */
5716d3ceb1dSskrll 	uint8_t		len;
5726d3ceb1dSskrll 	uint8_t		itype;		/* 0 -- vectored int */
5736d3ceb1dSskrll 	uint8_t		trigger;	/* polarity/level */
5746d3ceb1dSskrll 	uint8_t		pin;		/* PCI pin number */
5756d3ceb1dSskrll 	uint8_t		bus;
5766d3ceb1dSskrll 	uint8_t		seg;		/* reserved */
5776d3ceb1dSskrll 	uint8_t		line;
5786d3ceb1dSskrll 	uint64_t	addr;		/* io sapic address */
5796d3ceb1dSskrll };
5806d3ceb1dSskrll 
5816d3ceb1dSskrll struct pdc_memmap {	/* PDC_MEMMAP */
5826d3ceb1dSskrll 	u_int	hpa;		/* HPA for module */
5836d3ceb1dSskrll 	u_int	morepages;	/* additional IO pages */
5846d3ceb1dSskrll };
5856d3ceb1dSskrll 
5866d3ceb1dSskrll struct pdc_system_map_find_mod {	/* PDC_SYSTEM_MAP_FIND_MOD */
5876d3ceb1dSskrll 	u_int	hpa;
5886d3ceb1dSskrll 	u_int	size;		/* pages */
5896d3ceb1dSskrll 	u_int	naddrs;
5906d3ceb1dSskrll 	u_int	mod_index;
5916d3ceb1dSskrll };
5926d3ceb1dSskrll 
5936d3ceb1dSskrll struct pdc_system_map_find_addr {	/* PDC_SYSTEM_MAP_FIND_ADDR */
5946d3ceb1dSskrll 	u_int	hpa;
5956d3ceb1dSskrll 	u_int	size;		/* pages */
5966d3ceb1dSskrll };
5976d3ceb1dSskrll 
5986d3ceb1dSskrll struct pdc_lan_station_id {	/* PDC_LAN_STATION_ID */
5996d3ceb1dSskrll 	uint8_t	addr[6];
6006d3ceb1dSskrll };
6016d3ceb1dSskrll 
6026d3ceb1dSskrll /*
6036d3ceb1dSskrll  * The PDC_CHASSIS is a strange bird.  The format for updating the display
6046d3ceb1dSskrll  * is as follows:
6056d3ceb1dSskrll  *
6066d3ceb1dSskrll  *	0     11 12      14    15   16    19 20    23 24    27 28    31
6076d3ceb1dSskrll  *	+-------+----------+-------+--------+--------+--------+--------+
6086d3ceb1dSskrll  *	|   R   | OS State | Blank |  Hex1  |  Hex2  |  Hex3  |  Hex4  |
6096d3ceb1dSskrll  *	+-------+----------+-------+--------+--------+--------+--------+
6106d3ceb1dSskrll  *
6116d3ceb1dSskrll  * Unfortunately, someone forgot to tell the hardware designers that
6126d3ceb1dSskrll  * there was supposed to be a hex display somewhere.  The result is,
6136d3ceb1dSskrll  * you can only toggle 5 LED's and the fault light.
6146d3ceb1dSskrll  *
6156d3ceb1dSskrll  * Interesting values for Hex1-Hex4 and the resulting LED displays:
6166d3ceb1dSskrll  *
6176d3ceb1dSskrll  *	FnFF			CnFF:
6186d3ceb1dSskrll  *	 0	- - - - -		Counts in binary from 0x0 - 0xF
6196d3ceb1dSskrll  *	 2	o - - - -		for corresponding values of `n'.
6206d3ceb1dSskrll  *	 4	o o - - -
6216d3ceb1dSskrll  *	 6	o o o - -
6226d3ceb1dSskrll  *	 8	o o o o -
6236d3ceb1dSskrll  *	 A	o o o o o
6246d3ceb1dSskrll  *
6256d3ceb1dSskrll  * If the "Blank" bit is set, the display should be made blank.
6266d3ceb1dSskrll  * The values for "OS State" are defined below.
6276d3ceb1dSskrll  */
6286d3ceb1dSskrll 
6296d3ceb1dSskrll #define	PDC_CHASSIS_BAR	0xF0FF	/* create a bar graph with LEDs */
6306d3ceb1dSskrll #define	PDC_CHASSIS_CNT	0xC0FF	/* count with LEDs */
6316d3ceb1dSskrll 
6326d3ceb1dSskrll #define	PDC_OSTAT(os)	(((os) & 0x7) << 17)
6336d3ceb1dSskrll #define	PDC_OSTAT_OFF	0x0	/* all off */
6346d3ceb1dSskrll #define	PDC_OSTAT_FAULT	0x1	/* the red LED of death */
6356d3ceb1dSskrll #define	PDC_OSTAT_TEST	0x2	/* self test */
6366d3ceb1dSskrll #define	PDC_OSTAT_BOOT	0x3	/* boot program running */
6376d3ceb1dSskrll #define	PDC_OSTAT_SHUT	0x4	/* shutdown in progress */
6386d3ceb1dSskrll #define	PDC_OSTAT_WARN	0x5	/* battery dying, etc */
6396d3ceb1dSskrll #define	PDC_OSTAT_RUN	0x6	/* OS running */
6406d3ceb1dSskrll #define	PDC_OSTAT_ON	0x7	/* all on */
6416d3ceb1dSskrll 
6426d3ceb1dSskrll struct pdc_chassis_info {
6436d3ceb1dSskrll 	u_int	size;
6446d3ceb1dSskrll 	u_int	max_size;
6456d3ceb1dSskrll };
6466d3ceb1dSskrll 
6476d3ceb1dSskrll struct pdc_chassis_lcd {
6486d3ceb1dSskrll 	u_int	model : 16,
6496d3ceb1dSskrll 		width : 16;
6506d3ceb1dSskrll 	u_int	cmd_addr;
6516d3ceb1dSskrll 	u_int	data_addr;
6526d3ceb1dSskrll 	u_int	delay;
6536d3ceb1dSskrll 	uint8_t	line[2];
6546d3ceb1dSskrll 	uint8_t	enabled;
6556d3ceb1dSskrll 	uint8_t	heartbeat[3];
6566d3ceb1dSskrll 	uint8_t disk[3];
6576d3ceb1dSskrll };
6586d3ceb1dSskrll 
6596d3ceb1dSskrll /*
6606d3ceb1dSskrll  * A processors Stable Storage is accessed through the PDC.  There are
6616d3ceb1dSskrll  * at least 96 bytes of stable storage (the device path information may
6626d3ceb1dSskrll  * or may not exist).  However, as far as I know, processors provide at
6636d3ceb1dSskrll  * least 192 bytes of stable storage.
6646d3ceb1dSskrll  */
6656d3ceb1dSskrll struct stable_storage {
6666d3ceb1dSskrll 	struct device_path ss_pri_boot;	/* (see above) */
6676d3ceb1dSskrll 	char	ss_filenames[32];
6686d3ceb1dSskrll 	u_short	ss_os_version;	/* 0 == none, 1 == HP-UX, 2 == MPE-XL */
6696d3ceb1dSskrll 	char	ss_os[22];	/* OS-dependent information */
6706d3ceb1dSskrll 	char	ss_pdc[7];	/* reserved */
6716d3ceb1dSskrll 	char	ss_fast_size;	/* how much memory to test.  0xf == all, or */
6726d3ceb1dSskrll 				/*	else it's (256KB << ss_fast_size) */
6736d3ceb1dSskrll 	struct device_path ss_console;
6746d3ceb1dSskrll 	struct device_path ss_alt_boot;
6756d3ceb1dSskrll 	struct device_path ss_keyboard;
6766d3ceb1dSskrll };
6776d3ceb1dSskrll 
6786d3ceb1dSskrll /*
6796d3ceb1dSskrll  * Recoverable error indications provided to boot code by the PDC.
6806d3ceb1dSskrll  * Any non-zero value indicates error.
6816d3ceb1dSskrll  */
6826d3ceb1dSskrll struct boot_err {
6836d3ceb1dSskrll 	u_int	be_resv : 10,	/* (reserved) */
6846d3ceb1dSskrll 		be_fixed : 6,	/* module that produced error */
6856d3ceb1dSskrll 		be_chas : 16;	/* error code (interpret as 4 hex digits) */
6866d3ceb1dSskrll };
6876d3ceb1dSskrll 
6886d3ceb1dSskrll #define	HPBE_HBOOT_CORRECTABLE	0	/* hard-boot corrctable error */
6896d3ceb1dSskrll #define	HPBE_HBOOT_UNCORRECTBL	1	/* hard-boot uncorrectable error */
6906d3ceb1dSskrll #define	HPBE_SBOOT_CORRECTABLE	2	/* soft-boot correctable error */
6916d3ceb1dSskrll #define	HPBE_SBOOT_UNCORRECTBL	3	/* soft-boot uncorrectable error */
6926d3ceb1dSskrll #define	HPBE_ETEST_MODUNUSABLE	4	/* ENTRY_TEST err: module's unusable */
6936d3ceb1dSskrll #define	HPBE_ETEST_MODDEGRADED	5	/* ENTRY_TEST err: module in degraded mode */
6946d3ceb1dSskrll 
6956d3ceb1dSskrll 
6966d3ceb1dSskrll /*
6976d3ceb1dSskrll  * The PDC uses the following structure to completely define an I/O
6986d3ceb1dSskrll  * module and the interface to its IODC.
6996d3ceb1dSskrll  */
7006d3ceb1dSskrll typedef
7016d3ceb1dSskrll struct pz_device {
7026d3ceb1dSskrll 	struct device_path pz_dp;
7036d3ceb1dSskrll #define	pz_flags	pz_dp.dp_flags
7046d3ceb1dSskrll #define	pz_bc		pz_dp.dp_bc
7056d3ceb1dSskrll #define	pz_mod		pz_dp.dp_mod
7066d3ceb1dSskrll #define	pz_layers	pz_dp.dp_layers
7076d3ceb1dSskrll 	struct iomod *pz_hpa;	/* HPA base address of device */
7086d3ceb1dSskrll 	void *	pz_spa;		/* SPA base address (zero if no SPA exists) */
7096d3ceb1dSskrll 	iodcio_t pz_iodc_io;	/* entry point of device's driver routines */
7106d3ceb1dSskrll 	short	pz_resv;	/* (reserved) */
7116d3ceb1dSskrll 	u_short	pz_class;	/* (see below) */
7126d3ceb1dSskrll } pz_device_t;
7136d3ceb1dSskrll 
7146d3ceb1dSskrll /* pz_class */
7156d3ceb1dSskrll #define	PCL_NULL	0	/* illegal */
7166d3ceb1dSskrll #define	PCL_RANDOM	1	/* random access (disk) */
7176d3ceb1dSskrll #define	PCL_SEQU	2	/* sequential access (tape) */
7186d3ceb1dSskrll #define	PCL_DUPLEX	7	/* full-duplex point-to-point (RS-232, Net) */
7196d3ceb1dSskrll #define	PCL_KEYBD	8	/* half-duplex input (HIL Keyboard) */
7206d3ceb1dSskrll #define	PCL_DISPL	9	/* half-duplex ouptput (display) */
7216d3ceb1dSskrll #define	PCL_FC		10	/* fibre channel access media */
7226d3ceb1dSskrll #define	PCL_CLASS_MASK	0xf	/* XXX class mask */
7236d3ceb1dSskrll #define	PCL_NET_MASK	0x1000	/* mask for bootp/tftp device */
7246d3ceb1dSskrll 
7256d3ceb1dSskrll /*
7266d3ceb1dSskrll  * The following structure defines what a particular IODC returns when
7276d3ceb1dSskrll  * given the IODC_DATA argument.
7286d3ceb1dSskrll  */
7296d3ceb1dSskrll struct iodc_data {
7306d3ceb1dSskrll 	u_int	iodc_model: 8,		/* hardware model number */
7316d3ceb1dSskrll 		iodc_revision:8,	/* software revision */
7326d3ceb1dSskrll 		iodc_spa_io: 1,		/* 0:memory, 1:device */
7336d3ceb1dSskrll 		iodc_spa_pack:1,	/* 1:packed multiplexor */
7346d3ceb1dSskrll 		iodc_spa_enb:1,		/* 1:has an spa */
7356d3ceb1dSskrll 		iodc_spa_shift:5,	/* power of two # bytes in SPA space */
7366d3ceb1dSskrll 		iodc_more: 1,		/* iodc_data is: 0:8-byte, 1:16-byte */
7376d3ceb1dSskrll 		iodc_word: 1,		/* iodc_data is: 0:byte, 1:word */
7386d3ceb1dSskrll 		iodc_pf: 1,		/* 1:supports powerfail */
7396d3ceb1dSskrll 		iodc_type: 5;		/* see below */
7406d3ceb1dSskrll 	u_int	iodc_sv_rev: 4,		/* software version revision number */
7416d3ceb1dSskrll 		iodc_sv_model:20,	/* software interface model # */
7426d3ceb1dSskrll 		iodc_sv_opt: 8;		/* type-specific options */
7436d3ceb1dSskrll 	u_char	iodc_rev;		/* revision number of IODC code */
7446d3ceb1dSskrll 	u_char	iodc_dep;		/* module-dependent information */
7456d3ceb1dSskrll 	u_char	iodc_rsv[2];		/* reserved */
7466d3ceb1dSskrll 	u_short	iodc_cksum;		/* 16-bit checksum of whole IODC */
7476d3ceb1dSskrll 	u_short	iodc_length;		/* number of entry points in IODC */
7486d3ceb1dSskrll 		/* IODC entry points follow... */
7496d3ceb1dSskrll };
7506d3ceb1dSskrll 
7516d3ceb1dSskrll extern pdcio_t pdc;
7526d3ceb1dSskrll 
7536d3ceb1dSskrll #ifdef _KERNEL
7546d3ceb1dSskrll struct consdev;
7556d3ceb1dSskrll 
7566d3ceb1dSskrll extern int kernelmapped;
7576d3ceb1dSskrll 
7586d3ceb1dSskrll enum pdc_type {
7596d3ceb1dSskrll         PDC_TYPE_UNKNOWN,
7606d3ceb1dSskrll         PDC_TYPE_SNAKE
7616d3ceb1dSskrll };
7626d3ceb1dSskrll 
7636d3ceb1dSskrll void pdc_init(void);
7646d3ceb1dSskrll void pdc_settype(int);
7656d3ceb1dSskrll enum pdc_type pdc_gettype(void);
7666d3ceb1dSskrll 
7676d3ceb1dSskrll int pdc_call(iodcio_t, int, ...);
7686d3ceb1dSskrll 
7696d3ceb1dSskrll void pdccnprobe(struct consdev *);
7706d3ceb1dSskrll void pdccninit(struct consdev *);
7716d3ceb1dSskrll int pdccngetc(dev_t);
7726d3ceb1dSskrll void pdccnputc(dev_t, int);
7736d3ceb1dSskrll void pdccnpollc(dev_t, int);
7746d3ceb1dSskrll 
7756d3ceb1dSskrll int pdcproc_chassis_display(unsigned long);
7766d3ceb1dSskrll int pdcproc_chassis_info(struct pdc_chassis_info *, struct pdc_chassis_lcd *);
7776d3ceb1dSskrll 
7786d3ceb1dSskrll int pdcproc_pim(int, struct pdc_pim *, void **, size_t *);
7796d3ceb1dSskrll 
7806d3ceb1dSskrll int pdcproc_model_info(struct pdc_model *);
7816d3ceb1dSskrll int pdcproc_model_cpuid(struct pdc_cpuid *);
7826d3ceb1dSskrll 
7836d3ceb1dSskrll int pdcproc_cache(struct pdc_cache *);
7846d3ceb1dSskrll int pdcproc_cache_coherence(struct pdc_coherence *);
7856d3ceb1dSskrll int pdcproc_cache_spidbits(struct pdc_spidb *);
7866d3ceb1dSskrll 
7876d3ceb1dSskrll int pdcproc_hpa_processor(hppa_hpa_t *);
7886d3ceb1dSskrll 
7896d3ceb1dSskrll int pdcproc_coproc(struct pdc_coproc *);
7906d3ceb1dSskrll 
7916d3ceb1dSskrll int pdcproc_iodc_read(hppa_hpa_t, int, int *, struct pdc_iodc_read *, size_t,
7926d3ceb1dSskrll     struct iodc_data *, size_t);
7936d3ceb1dSskrll int pdcproc_iodc_ninit(struct pdc_iodc_minit *, hppa_hpa_t, int);
7946d3ceb1dSskrll 
7956d3ceb1dSskrll int pdcproc_instr(unsigned int *);
7966d3ceb1dSskrll 
7976d3ceb1dSskrll int pdcproc_block_tlb(struct pdc_btlb *);
7986d3ceb1dSskrll int pdcproc_btlb_insert(pa_space_t, vaddr_t, paddr_t, vsize_t, u_int, int);
7996d3ceb1dSskrll int pdcproc_btlb_purge(pa_space_t, vaddr_t, paddr_t, vsize_t);
8006d3ceb1dSskrll int pdcproc_btlb_purgeall(void);
8016d3ceb1dSskrll 
8026d3ceb1dSskrll int pdcproc_tlb_info(struct pdc_hwtlb *);
8036d3ceb1dSskrll int pdcproc_tlb_config(struct pdc_hwtlb *, vaddr_t, vsize_t, unsigned long);
8046d3ceb1dSskrll 
8056d3ceb1dSskrll int pdcproc_system_map_find_mod(struct pdc_system_map_find_mod *,
8066d3ceb1dSskrll     struct device_path *, int);
8076d3ceb1dSskrll int pdcproc_system_map_find_addr(struct pdc_system_map_find_addr *, int, int);
8086d3ceb1dSskrll int pdcproc_system_map_trans_path(struct pdc_memmap *, struct device_path *);
8096d3ceb1dSskrll 
8106d3ceb1dSskrll int pdcproc_soft_power_enable(int);
8116d3ceb1dSskrll int pdcproc_soft_power_info(struct pdc_power_info *);
8126d3ceb1dSskrll 
8136d3ceb1dSskrll int pdcproc_memmap(struct pdc_memmap *, struct device_path *);
8146d3ceb1dSskrll 
8156d3ceb1dSskrll int pdcproc_ioclrerrors(void);
8166d3ceb1dSskrll int pdcproc_ioreset(void);
8176d3ceb1dSskrll 
8186d3ceb1dSskrll int pdcproc_doreset(void);
8196d3ceb1dSskrll 
8206d3ceb1dSskrll int pdcproc_lan_station_id(char *, size_t, hppa_hpa_t);
8216d3ceb1dSskrll 
8226d3ceb1dSskrll int pdcproc_pci_inttblsz(int *);
8236d3ceb1dSskrll int pdcproc_pci_gettable(int, size_t, void *);
8246d3ceb1dSskrll 
8256d3ceb1dSskrll #endif
8266d3ceb1dSskrll 
8276d3ceb1dSskrll #endif	/* !(_LOCORE) */
8286d3ceb1dSskrll 
8296d3ceb1dSskrll #endif	/* _MACHINE_PDC_H_ */
830