Home | History | Annotate | Line # | Download | only in include
prom.h revision 1.1
      1 /*	$NetBSD: prom.h,v 1.1 2000/08/19 12:13:47 wdk Exp $	*/
      2 
      3 /*
      4  * Copyright (c) 2000 The NetBSD Foundation, Inc.
      5  * All rights reserved.
      6  *
      7  * This code is derived from software contributed to The NetBSD Foundation
      8  * by Wayne Knowles
      9  *
     10  * Redistribution and use in source and binary forms, with or without
     11  * modification, are permitted provided that the following conditions
     12  * are met:
     13  * 1. Redistributions of source code must retain the above copyright
     14  *    notice, this list of conditions and the following disclaimer.
     15  * 2. Redistributions in binary form must reproduce the above copyright
     16  *    notice, this list of conditions and the following disclaimer in the
     17  *    documentation and/or other materials provided with the distribution.
     18  * 3. All advertising materials mentioning features or use of this software
     19  *    must display the following acknowledgement:
     20  *        This product includes software developed by the NetBSD
     21  *        Foundation, Inc. and its contributors.
     22  * 4. Neither the name of The NetBSD Foundation nor the names of its
     23  *    contributors may be used to endorse or promote products derived
     24  *    from this software without specific prior written permission.
     25  *
     26  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
     27  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
     28  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
     29  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
     30  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
     31  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
     32  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
     33  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
     34  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
     35  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
     36  * POSSIBILITY OF SUCH DAMAGE.
     37  */
     38 
     39 /*
     40  * Entry points into PROM firmware functions for MIPS machines
     41  */
     42 
     43 #ifndef _MIPSCO_FIRMWARE_H
     44 #define _MIPSCO_FIRMWARE_H
     45 
     46 struct mips_prom {
     47 
     48 	/*
     49 	 * transferred to on hardware reset, configures MIPS boards,
     50 	 * runs diags, check for appropriate auto boot action in
     51 	 * "bootmode" environment variable and performs that action.
     52 	 */
     53 	void	(*prom_reset)	__P((void)) __attribute__((__noreturn__));
     54 
     55 	/*
     56 	 * called to utilize prom to boot new image.  After the booted
     57 	 * program returns control can either be returned to the
     58 	 * original caller of the exec routine or to the prom monitor.
     59 	 * (to return to the original caller, the new program must
     60 	 * not destroy any text, data, or stack of the parent.  the
     61 	 * new programs stack continues on the parents stack.
     62 	 */
     63 	int	(*prom_exec)	__P((void));
     64 
     65 	/* re-enter the prom command parser, do not reset prom state	*/
     66 	void	(*prom_restart) __P((void)) __attribute__((__noreturn__));
     67 
     68 	/* reinitialize prom state and re-enter the prom command parser */
     69 	void	(*prom_reinit)	__P((void)) __attribute__((__noreturn__));
     70 
     71 	/* reboot machine using current bootmode setting.  No diags */
     72 	void	(*prom_reboot)	__P((void)) __attribute__((__noreturn__));
     73 
     74 	/* perform an autoboot sequence, no configuration or diags run */
     75 	void	(*prom_autoboot) __P((void)) __attribute__((__noreturn__));
     76 
     77 	/*
     78 	 * these routines access prom "saio" routines, and may be used
     79 	 * by standalone programs that would like to use prom io
     80 	 */
     81 	int	(*prom_open)		__P((char *, int, ...));
     82 	int	(*prom_read)		__P((int, void *, int));
     83 	int	(*prom_write)		__P((int, void *, int));
     84 	int	(*prom_ioctl)		__P((int));
     85 	int	(*prom_close)		__P((int));
     86 	int	(*prom_getchar)		__P((void));
     87 	int	(*prom_putchar)		__P((int c));
     88 	void	(*prom_showchar)	__P((int c));
     89 	char * 	(*prom_gets)		__P((char *s));
     90 	void	(*prom_puts)		__P((const char *));
     91 	int	(*prom_printf)		__P((const char *, ...));
     92 
     93 	/* prom protocol entry points */
     94 	void	(*prom_initproto)	__P((void)); /* ??? */
     95 	void	(*prom_protoenable)	__P((void)); /* ??? */
     96 	void	(*prom_protodisable)	__P((void)); /* ??? */
     97 	void	(*prom_getpkt)		__P((void)); /* ??? */
     98 	void	(*prom_putpkt)		__P((void)); /* ??? */
     99 
    100 	/*
    101 	 * read-modify-write routine use special cpu board circuitry to
    102 	 * accomplish vme bus r-m-w cycles.
    103 	 */
    104 	void	(*prom_orw_rmw)		__P((void));
    105 	void	(*prom_orh_rmw)		__P((void));
    106 	void	(*prom_orb_rmw)		__P((void));
    107 	void	(*prom_andw_rmw)	__P((void));
    108 	void	(*prom_andh_rmw)	__P((void));
    109 	void	(*prom_andb_rmw)	__P((void));
    110 
    111 	/*
    112 	 * cache control entry points
    113 	 * flushcache is called without arguments and invalidates entire
    114 	 *      contents of both i and d caches
    115 	 * clearcache is called with a base address and length (where
    116 	 *      address is either K0, K1, or physical) and clears both
    117 	 *      i and d cache for entries that alias to specified address
    118 	 *      range.
    119 	 */
    120 	void	(*prom_flushcache)	__P((void));
    121 	void	(*prom_clearcache)	__P((void));
    122 
    123 	/*
    124 	 * Libc compatible functions
    125 	 */
    126 	void	(*prom_setjmp)		__P((void));
    127 	void	(*prom_longjmp)		__P((void));
    128 	void	(*prom_bevutlb)		__P((void));
    129 	char *	(*prom_getenv)		__P((char *name));
    130 	int	(*prom_setenv)		__P((char *name, char *val));
    131 	int	(*prom_atob)		__P((char *s));
    132 	int	(*prom_strcmp)		__P((char *s1, char *s2));
    133 	int	(*prom_strlen)		__P((char *s));
    134 	char *	(*prom_strcpy)		__P((char *s1, char *s2));
    135 	char *	(*prom_strcat)		__P((char *s1, char *s2));
    136 
    137 	/*
    138 	 * command parser entry points
    139 	 */
    140 	void	(*prom_parser)		__P((void)); /* ??? */
    141 	void	(*prom_range)		__P((void)); /* ??? */
    142 	void	(*prom_argvize)		__P((void)); /* ??? */
    143 	void	(*prom_help)		__P((void));
    144 
    145 	/*
    146 	 * prom commands
    147 	 */
    148 	void	(*prom_dumpcmd)		__P((void));
    149 	void	(*prom_setenvcmd)	__P((void));
    150 	void	(*prom_unsetenvcmd)	__P((void));
    151 	void	(*prom_bevexcept)	__P((void));
    152 	void	(*prom_enablecmd)	__P((void));
    153 	void	(*prom_disablecmd)	__P((void));
    154 
    155 	/*
    156 	 * clear existing fault handlers
    157 	 * used by clients that link to prom on situations where client has
    158 	 * interrupted out of prom code and wish to reenter without being
    159 	 * tripped up by any pending prom timers set earlier.
    160 	 */
    161 	void	(*prom_clearnofault)	__P((void));
    162 
    163 	void	(*prom_notimpl)		__P((void));
    164 
    165 	/*
    166 	 * PROM_NVGET, PROM_NVSET will get/set information in the NVRAM.
    167 	 * Both of these routines take indexes as opposed to addresses
    168 	 * to guarantee portability between various platforms
    169 	 */
    170 	void	(*prom_nvget)		__P((void));
    171 	void	(*prom_nv_set)		__P((void));
    172 };
    173 
    174 extern struct mips_prom *callv;
    175 
    176 /*
    177  * Macro to help call a prom function
    178  */
    179 #define MIPS_PROM(func)		(callv->prom_##func)
    180 
    181 /*
    182  * Return the address for a given prom function number */
    183 #define	PROM_ENTRY(x)		(0xbfc00000+((x)*8))
    184 
    185 #endif /* ! _MIPSCO_FIRMWARE_H */
    186