1 /* $NetBSD: defs.h,v 1.9 2006/11/17 22:13:08 christos Exp $ */ 2 3 /*- 4 * Copyright (c) 1996 The NetBSD Foundation, Inc. 5 * All rights reserved. 6 * 7 * This code is derived from software contributed to The NetBSD Foundation 8 * by Jason R. Thorpe. 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 #ifdef USE_OPENFIRM 40 #include <dev/ofw/openfirmio.h> 41 #endif 42 43 #undef BUFSIZE 44 #define BUFSIZE 1024 45 46 #define IO_READ 0 47 #define IO_WRITE 1 48 49 #define MAXIMUM(a, b) ((a) > (b) ? (a) : (b)) 50 51 /* 52 * Misc. location declarations. 53 */ 54 #define EE_SIZE 0x500 55 #define EE_WC_LOC 0x04 56 #define EE_CKSUM_LOC 0x0c 57 #define EE_HWUPDATE_LOC 0x10 58 #define EE_BANNER_ENABLE_LOC 0x20 59 60 /* 61 * Keyword table entry. Contains a pointer to the keyword, the 62 * offset into the prom where the value lives, and a pointer to 63 * the function that handles that value. 64 */ 65 struct keytabent { 66 char *kt_keyword; /* keyword for this entry */ 67 u_int kt_offset; /* offset into prom of value */ 68 void (*kt_handler) (struct keytabent *, char *); 69 /* handler function for this entry */ 70 }; 71 72 /* 73 * String-value table entry. Maps a string to a numeric value and 74 * vice-versa. 75 */ 76 struct strvaltabent { 77 char *sv_str; /* the string ... */ 78 u_char sv_val; /* ... and the value */ 79 }; 80 81 #ifdef __sparc__ 82 struct opiocdesc; 83 /* 84 * This is an entry in a table which describes a set of `exceptions'. 85 * In other words, these are Openprom fields that we either can't 86 * `just print' or don't know how to deal with. 87 */ 88 struct extabent { 89 char *ex_keyword; /* keyword for this entry */ 90 void (*ex_handler) (struct extabent *, 91 struct opiocdesc *, char *); 92 /* handler function for this entry */ 93 }; 94 #endif /* __sparc__ */ 95 96 #ifdef USE_OPENFIRM 97 struct extabent { 98 char *ex_keyword; /* keyword for this entry */ 99 void (*ex_handler) (struct extabent *, 100 struct ofiocdesc *, char *); 101 /* handler function for this entry */ 102 }; 103 #endif 104 105 /* Sun 3/4 EEPROM handlers. */ 106 void ee_action (char *, char *); 107 void ee_dump (void); 108 void ee_hwupdate (struct keytabent *, char *); 109 void ee_num8 (struct keytabent *, char *); 110 void ee_num16 (struct keytabent *, char *); 111 void ee_screensize (struct keytabent *, char *); 112 void ee_truefalse (struct keytabent *, char *); 113 void ee_bootdev (struct keytabent *, char *); 114 void ee_kbdtype (struct keytabent *, char *); 115 void ee_constype (struct keytabent *, char *); 116 void ee_diagpath (struct keytabent *, char *); 117 void ee_banner (struct keytabent *, char *); 118 void ee_notsupp (struct keytabent *, char *); 119 120 /* Sun 3/4 EEPROM checksum routines. */ 121 u_char ee_checksum (u_char *, size_t); 122 void ee_updatechecksums (void); 123 void ee_verifychecksums (void); 124 125 #ifdef __sparc__ 126 /* Sparc Openprom handlers. */ 127 char *op_handler (char *, char *); 128 void op_action (char *, char *); 129 void op_dump (void); 130 int check_for_openprom (void); 131 #endif /* __sparc__ */ 132 133 /* OpenFirmware handlers. */ 134 char *of_handler (char *, char *); 135 void of_action (char *, char *); 136 void of_dump (void); 137