Home | History | Annotate | Download | only in sys
      1 /*
      2  * CDDL HEADER START
      3  *
      4  * The contents of this file are subject to the terms of the
      5  * Common Development and Distribution License (the "License").
      6  * You may not use this file except in compliance with the License.
      7  *
      8  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
      9  * or http://www.opensolaris.org/os/licensing.
     10  * See the License for the specific language governing permissions
     11  * and limitations under the License.
     12  *
     13  * When distributing Covered Code, include this CDDL HEADER in each
     14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
     15  * If applicable, add the following below this CDDL HEADER, with the
     16  * fields enclosed by brackets "[]" replaced with your own identifying
     17  * information: Portions Copyright [yyyy] [name of copyright owner]
     18  *
     19  * CDDL HEADER END
     20  */
     21 
     22 /*
     23  * Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
     24  * Use is subject to license terms.
     25  */
     26 
     27 #ifndef	_SYS_PROMIF_IMPL_H
     28 #define	_SYS_PROMIF_IMPL_H
     29 
     30 #pragma ident	"%Z%%M%	%I%	%E% SMI"
     31 
     32 #ifdef	__cplusplus
     33 extern "C" {
     34 #endif
     35 
     36 #include <sys/types.h>
     37 #ifdef _KERNEL
     38 #include <sys/promimpl.h>
     39 #endif
     40 #include <sys/obpdefs.h>
     41 #include <sys/cmn_err.h>
     42 #include <sys/note.h>
     43 
     44 /*
     45  * CIF handler functions
     46  */
     47 typedef int (*cif_func_t) (void *);
     48 extern int promif_getprop(void *p);
     49 extern int promif_getproplen(void *p);
     50 extern int promif_nextprop(void *p);
     51 extern int promif_nextnode(void *p);
     52 extern int promif_childnode(void *p);
     53 extern int promif_parentnode(void *p);
     54 extern int promif_enter_mon(void *p);
     55 extern int promif_exit_to_mon(void *p);
     56 extern int promif_reboot(void *p);
     57 extern int promif_write(void *p);
     58 extern int promif_read(void *p);
     59 extern int promif_interpret(void *p);
     60 extern int promif_finddevice(void *p);
     61 extern int promif_instance_to_package(void *p);
     62 #ifndef _KMDB
     63 extern int promif_setprop(void *p);
     64 extern int promif_test(void *p);
     65 extern int promif_instance_to_path(void *p);
     66 extern int promif_power_off(void *p);
     67 extern int promif_asr_list_keys_len(void *p);
     68 extern int promif_asr_list_keys(void *p);
     69 extern int promif_asr_export_len(void *p);
     70 extern int promif_asr_export(void *p);
     71 extern int promif_set_security_key(void *p);
     72 extern int promif_get_security_key(void *p);
     73 extern int promif_start_cpu(void *p);
     74 extern int promif_set_mmfsa_traptable(void *p);
     75 extern int promif_set_sun4v_api_version(void *p);
     76 extern int promif_get_sun4v_api_version(void *p);
     77 #endif
     78 
     79 /*
     80  * Shadow device tree access functions
     81  */
     82 extern pnode_t promif_stree_nextnode(pnode_t nodeid);
     83 extern pnode_t promif_stree_childnode(pnode_t nodeid);
     84 extern pnode_t promif_stree_parentnode(pnode_t nodeid);
     85 extern int promif_stree_getproplen(pnode_t, char *name);
     86 extern int promif_stree_getprop(pnode_t, char *name, void *value);
     87 extern int promif_stree_setprop(pnode_t, char *name, void *value, int len);
     88 extern char *promif_stree_nextprop(pnode_t nodeid, char *name, char *next);
     89 
     90 /*
     91  * Hooks for kmdb to get and set a pointer to the PROM shadow tree
     92  */
     93 #ifdef _KMDB
     94 extern void promif_stree_setroot(void *root);
     95 extern caddr_t promif_stree_getroot(void);
     96 #endif
     97 
     98 /*
     99  * Miscellaneous functions
    100  */
    101 extern cif_func_t promif_find_cif_callback(char *opname);
    102 extern int promif_ldom_setprop(char *name, void *value, int valuelen);
    103 extern char promif_getchar(void);
    104 
    105 /*
    106  * Initialization functions
    107  */
    108 #ifdef _KMDB
    109 extern void cif_init(char *, caddr_t, ihandle_t, ihandle_t,
    110     phandle_t, phandle_t, pnode_t, pnode_t);
    111 extern void promif_io_init(ihandle_t, ihandle_t, phandle_t, phandle_t);
    112 extern void promif_set_nodes(pnode_t, pnode_t);
    113 #else
    114 extern void promif_io_init(void);
    115 extern void promif_stree_init(void);
    116 extern void promif_prop_init(void);
    117 #endif
    118 
    119 /*
    120  * Debugging support
    121  */
    122 #ifdef DEBUG
    123 
    124 extern uint_t cif_debug;
    125 
    126 #define	CIF_DBG_FLAG_NODE		0x01
    127 #define	CIF_DBG_FLAG_REBOOT		0x02
    128 
    129 #define	CIF_DBG_ALL	if (cif_debug)				prom_printf
    130 #define	CIF_DBG_NODE	if (cif_debug & CIF_DBG_FLAG_NODE)	prom_printf
    131 #define	CIF_DBG_REBOOT	if (cif_debug & CIF_DBG_FLAG_REBOOT)	prom_printf
    132 
    133 #else /* DEBUG */
    134 
    135 #define	CIF_DBG_ALL	_NOTE(CONSTCOND) if (0)	prom_printf
    136 #define	CIF_DBG_NODE	CIF_DBG_ALL
    137 #define	CIF_DBG_REBOOT	CIF_DBG_ALL
    138 
    139 #endif /* DEBUG */
    140 
    141 #ifdef	__cplusplus
    142 }
    143 #endif
    144 
    145 #endif /* _SYS_PROMIF_IMPL_H */
    146