xref: /illumos-gate/usr/src/uts/sun4v/sys/promif_impl.h (revision 1b83305c)
11ae08745Sheppo /*
21ae08745Sheppo  * CDDL HEADER START
31ae08745Sheppo  *
41ae08745Sheppo  * The contents of this file are subject to the terms of the
51ae08745Sheppo  * Common Development and Distribution License (the "License").
61ae08745Sheppo  * You may not use this file except in compliance with the License.
71ae08745Sheppo  *
81ae08745Sheppo  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
91ae08745Sheppo  * or http://www.opensolaris.org/os/licensing.
101ae08745Sheppo  * See the License for the specific language governing permissions
111ae08745Sheppo  * and limitations under the License.
121ae08745Sheppo  *
131ae08745Sheppo  * When distributing Covered Code, include this CDDL HEADER in each
141ae08745Sheppo  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
151ae08745Sheppo  * If applicable, add the following below this CDDL HEADER, with the
161ae08745Sheppo  * fields enclosed by brackets "[]" replaced with your own identifying
171ae08745Sheppo  * information: Portions Copyright [yyyy] [name of copyright owner]
181ae08745Sheppo  *
191ae08745Sheppo  * CDDL HEADER END
201ae08745Sheppo  */
221ae08745Sheppo /*
23*1b83305cSjm  * Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
241ae08745Sheppo  * Use is subject to license terms.
251ae08745Sheppo  */
271ae08745Sheppo #ifndef	_SYS_PROMIF_IMPL_H
281ae08745Sheppo #define	_SYS_PROMIF_IMPL_H
301ae08745Sheppo #pragma ident	"%Z%%M%	%I%	%E% SMI"
321ae08745Sheppo #ifdef	__cplusplus
331ae08745Sheppo extern "C" {
341ae08745Sheppo #endif
361ae08745Sheppo #include <sys/types.h>
371ae08745Sheppo #ifdef _KERNEL
381ae08745Sheppo #include <sys/promimpl.h>
391ae08745Sheppo #endif
401ae08745Sheppo #include <sys/obpdefs.h>
411ae08745Sheppo #include <sys/cmn_err.h>
421ae08745Sheppo #include <sys/note.h>
441ae08745Sheppo /*
451ae08745Sheppo  * CIF handler functions
461ae08745Sheppo  */
471ae08745Sheppo typedef int (*cif_func_t) (void *);
481ae08745Sheppo extern int promif_getprop(void *p);
491ae08745Sheppo extern int promif_getproplen(void *p);
501ae08745Sheppo extern int promif_nextprop(void *p);
511ae08745Sheppo extern int promif_nextnode(void *p);
521ae08745Sheppo extern int promif_childnode(void *p);
531ae08745Sheppo extern int promif_parentnode(void *p);
541ae08745Sheppo extern int promif_enter_mon(void *p);
551ae08745Sheppo extern int promif_exit_to_mon(void *p);
561ae08745Sheppo extern int promif_reboot(void *p);
571ae08745Sheppo extern int promif_write(void *p);
581ae08745Sheppo extern int promif_read(void *p);
591ae08745Sheppo extern int promif_interpret(void *p);
601ae08745Sheppo extern int promif_finddevice(void *p);
611ae08745Sheppo extern int promif_instance_to_package(void *p);
621ae08745Sheppo #ifndef _KMDB
631ae08745Sheppo extern int promif_setprop(void *p);
641ae08745Sheppo extern int promif_test(void *p);
651ae08745Sheppo extern int promif_instance_to_path(void *p);
661ae08745Sheppo extern int promif_power_off(void *p);
671ae08745Sheppo extern int promif_asr_list_keys_len(void *p);
681ae08745Sheppo extern int promif_asr_list_keys(void *p);
691ae08745Sheppo extern int promif_asr_export_len(void *p);
701ae08745Sheppo extern int promif_asr_export(void *p);
711ae08745Sheppo extern int promif_set_security_key(void *p);
721ae08745Sheppo extern int promif_get_security_key(void *p);
731ae08745Sheppo extern int promif_start_cpu(void *p);
741ae08745Sheppo extern int promif_set_mmfsa_traptable(void *p);
751ae08745Sheppo extern int promif_set_sun4v_api_version(void *p);
761ae08745Sheppo extern int promif_get_sun4v_api_version(void *p);
771ae08745Sheppo #endif
791ae08745Sheppo /*
801ae08745Sheppo  * Shadow device tree access functions
811ae08745Sheppo  */
821ae08745Sheppo extern pnode_t promif_stree_nextnode(pnode_t nodeid);
831ae08745Sheppo extern pnode_t promif_stree_childnode(pnode_t nodeid);
841ae08745Sheppo extern pnode_t promif_stree_parentnode(pnode_t nodeid);
851ae08745Sheppo extern int promif_stree_getproplen(pnode_t, char *name);
861ae08745Sheppo extern int promif_stree_getprop(pnode_t, char *name, void *value);
871ae08745Sheppo extern int promif_stree_setprop(pnode_t, char *name, void *value, int len);
881ae08745Sheppo extern char *promif_stree_nextprop(pnode_t nodeid, char *name, char *next);
901ae08745Sheppo /*
911ae08745Sheppo  * Hooks for kmdb to get and set a pointer to the PROM shadow tree
921ae08745Sheppo  */
931ae08745Sheppo #ifdef _KMDB
941ae08745Sheppo extern void promif_stree_setroot(void *root);
951ae08745Sheppo extern caddr_t promif_stree_getroot(void);
961ae08745Sheppo #endif
981ae08745Sheppo /*
991ae08745Sheppo  * Miscellaneous functions
1001ae08745Sheppo  */
1011ae08745Sheppo extern cif_func_t promif_find_cif_callback(char *opname);
1021ae08745Sheppo extern int promif_ldom_setprop(char *name, void *value, int valuelen);
103*1b83305cSjm extern char promif_getchar(void);
1051ae08745Sheppo /*
1061ae08745Sheppo  * Initialization functions
1071ae08745Sheppo  */
1081ae08745Sheppo #ifdef _KMDB
1091ae08745Sheppo extern void cif_init(char *, caddr_t, ihandle_t, ihandle_t,
1101ae08745Sheppo     phandle_t, phandle_t, pnode_t, pnode_t);
1111ae08745Sheppo extern void promif_io_init(ihandle_t, ihandle_t, phandle_t, phandle_t);
1121ae08745Sheppo extern void promif_set_nodes(pnode_t, pnode_t);
1131ae08745Sheppo #else
1141ae08745Sheppo extern void promif_io_init(void);
1151ae08745Sheppo extern void promif_stree_init(void);
1161ae08745Sheppo extern void promif_prop_init(void);
1171ae08745Sheppo #endif
1191ae08745Sheppo /*
1201ae08745Sheppo  * Debugging support
1211ae08745Sheppo  */
1221ae08745Sheppo #ifdef DEBUG
1241ae08745Sheppo extern uint_t cif_debug;
1261ae08745Sheppo #define	CIF_DBG_FLAG_NODE		0x01
1271ae08745Sheppo #define	CIF_DBG_FLAG_REBOOT		0x02
1291ae08745Sheppo #define	CIF_DBG_ALL	if (cif_debug)				prom_printf
1301ae08745Sheppo #define	CIF_DBG_NODE	if (cif_debug & CIF_DBG_FLAG_NODE)	prom_printf
1311ae08745Sheppo #define	CIF_DBG_REBOOT	if (cif_debug & CIF_DBG_FLAG_REBOOT)	prom_printf
1331ae08745Sheppo #else /* DEBUG */
1351ae08745Sheppo #define	CIF_DBG_ALL	_NOTE(CONSTCOND) if (0)	prom_printf
1361ae08745Sheppo #define	CIF_DBG_NODE	CIF_DBG_ALL
1371ae08745Sheppo #define	CIF_DBG_REBOOT	CIF_DBG_ALL
1391ae08745Sheppo #endif /* DEBUG */
1411ae08745Sheppo #ifdef	__cplusplus
1421ae08745Sheppo }
1431ae08745Sheppo #endif
1451ae08745Sheppo #endif /* _SYS_PROMIF_IMPL_H */