promif.h revision e7cbe64f7a72dae5cb44f100db60ca88f3313c65
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright 2008 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#ifndef _SYS_PROMIF_H
#define _SYS_PROMIF_H
#pragma ident "%Z%%M% %I% %E% SMI"
#endif
#ifdef __cplusplus
extern "C" {
#endif
/*
* These are for V0 ops only. We sometimes have to specify
* to promif which type of operation we need to perform
* and since we can't get such a property from a V0 prom, we
* sometimes just assume it. V2 and later proms do the right thing.
*/
#define BLOCK 0
#define NETWORK 1
#define BYTE 2
#if !defined(_BOOT)
/*
* Due to FCode on sun4u machines running in a pseudo-32-bit environment
* we need to enable code in several of the promif routines to ensure
* that 64-bit pointers from the kernel are not passed through the CIF
* to OpenBoot.
*
* Client programs defining this token need to provide two callbacks to
* allow the promif routines to allocate and free memory allocated from
* the bottom 32-bits of the 64-bit address space:
*
* void *promplat_alloc(size_t);
* void promplat_free(void *, size_t);
*
* The alloc function should guarantee that it will never return an
* invalid pointer.
*/
#define PROM_32BIT_ADDRS
#endif /* _BOOT */
typedef void promif_preprom_f(void);
typedef void promif_postprom_f(void);
/*
* resource allocation group: OBP and IEEE 1275-1994.
* prom_alloc is platform dependent on SPARC.
*/
/*
* Device tree and property group: OBP and IEEE 1275-1994.
*/
extern pnode_t prom_rootnode(void);
extern pnode_t prom_chosennode(void);
extern pnode_t prom_alias_node(void);
extern pnode_t prom_optionsnode(void);
extern int prom_asr_list_keys_len();
extern int prom_asr_export_len();
char *reason, int reason_len);
extern char *prom_decode_composite_string(void *buf,
/*
* Device tree and property group: IEEE 1275-1994 Only.
*/
/*
* Device pathnames and pathname conversion: OBP and IEEE 1275-1994.
*/
extern char *prom_path_options(char *pathname);
extern void prom_pathname(char *pathname);
/*
* Device pathnames and pathname conversion: IEEE 1275-1994 only.
*/
/*
* Special device nodes: OBP and IEEE 1275-1994.
*/
extern ihandle_t prom_stdin_ihandle(void);
extern ihandle_t prom_stdout_ihandle(void);
extern pnode_t prom_stdin_node(void);
extern pnode_t prom_stdout_node(void);
extern char *prom_stdinpath(void);
extern char *prom_stdoutpath(void);
extern int prom_stdin_devname(char *buffer);
extern int prom_stdout_devname(char *buffer);
extern int prom_stdin_is_keyboard(void);
extern int prom_stdout_is_framebuffer(void);
extern int prom_stdin_stdout_equivalence(void);
extern void prom_get_tem_inverses(int *, int *);
extern void prom_get_term_font_size(int *, int *);
extern void prom_hide_cursor(void);
/*
* Special device nodes: IEEE 1275-1994 only.
*/
extern ihandle_t prom_memory_ihandle(void);
extern ihandle_t prom_mmu_ihandle(void);
/*
* Administrative group: OBP and IEEE 1275-1994.
*/
extern void prom_enter_mon(void);
extern void prom_exit_to_mon(void)
extern void prom_reboot(char *bootstr);
extern void prom_panic(char *string)
extern int prom_getversion(void);
extern int prom_is_openprom(void);
extern int prom_is_p1275(void);
extern void *prom_mon_id(void); /* SMCC/OBP platform centric */
extern uint_t prom_gettime(void);
extern char *prom_bootpath(void);
extern char *prom_bootargs(void);
/*
* Return code values from prom_version_check:
*
* This routine uses past-prediction mode to determine if the firmware
* on the current system is 64-bit ready.
*
* return code 2 could happen on a board-based server with a slave CPU board
* running down-rev firmware and the current master running adequate fw.
*/
#define PROM_VER64_OK 0 /* Prom is 64-bit ready (or n/a) */
/* .. but not currently active */
/*
* Administrative group: OBP only.
*/
extern struct bootparam *prom_bootparam(void);
/*
* Administrative group: IEEE 1275-1994 only.
*/
extern void *prom_set_callback(void *handler);
/*
* Administrative group: IEEE 1275 only.
*/
/*
* Promif support group: Generic.
*/
extern void prom_set_preprom(promif_preprom_f *);
extern void prom_set_postprom(promif_postprom_f *);
typedef struct __promif_redir_arg *promif_redir_arg_t;
extern void prom_set_stdout_redirect(promif_redir_t,
extern void prom_suspend_prepost(void);
extern void prom_resume_prepost(void);
extern void (*prom_set_nextprop_preprom(void (*)(void)))(void);
extern void (*prom_set_nextprop_postprom(void (*)(void)))(void);
extern void prom_montrap(void (*funcptr)());
typedef uint_t prom_generation_cookie_t;
int has_changed), void *arg,
/*
* I/O Group: OBP and IEEE 1275.
*/
extern uchar_t prom_getchar(void);
extern void prom_putchar(char c);
extern int prom_mayget(void);
extern int prom_mayput(char c);
extern int prom_close(int fd);
extern void prom_pnode_to_pathname(pnode_t, char *);
/*PRINTFLIKE1*/
extern void prom_printf(const char *fmt, ...)
__PRINTFLIKE(1);
#pragma rarely_called(prom_printf)
__VPRINTFLIKE(1);
#pragma rarely_called(prom_vprintf)
/*PRINTFLIKE2*/
extern char *prom_sprintf(char *s, const char *fmt, ...)
__PRINTFLIKE(2);
__VPRINTFLIKE(2);
#define PROM_WALK_CONTINUE 0 /* keep walking to next node */
int (*f)(pnode_t, void *, void *),
#define PROM_STOP { \
prom_enter_mon(); \
}
/*
* file IO
*/
extern int prom_fopen(ihandle_t, char *);
extern int prom_volopen(ihandle_t, char *);
extern int prom_fseek(ihandle_t, int, unsigned long long);
extern int prom_compinfo(ihandle_t, int, int *,
extern void prom_fclose(ihandle_t, int);
#endif /* _KERNEL || _KMDB */
#ifdef _KERNEL
/*
* Used by wrappers which bring up console frame buffer before prom_printf()
* and other prom calls that may output to the console. Struct is filled in
* in prom_env.c and in sunpm.c
*/
typedef struct promif_owrap {
void (*preout)(void);
void (*postout)(void);
/*
* WAN boot key storage interface
*/
int *status);
int *status);
#endif /* _KERNEL */
#ifdef __cplusplus
}
#endif
#endif /* _SYS_PROMIF_H */