1 /* $NetBSD: defs.h,v 1.4 1997/07/30 22:54:17 jtc 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 #undef BUFSIZE 40 #define BUFSIZE 1024 41 42 #define IO_READ 0 43 #define IO_WRITE 1 44 45 #define MAXIMUM(a, b) ((a) > (b) ? (a) : (b)) 46 47 /* 48 * Misc. location declarations. 49 */ 50 #define EE_SIZE 0x500 51 #define EE_WC_LOC 0x04 52 #define EE_CKSUM_LOC 0x0c 53 #define EE_HWUPDATE_LOC 0x10 54 #define EE_BANNER_ENABLE_LOC 0x20 55 56 /* 57 * Keyword table entry. Contains a pointer to the keyword, the 58 * offset into the prom where the value lives, and a pointer to 59 * the function that handles that value. 60 */ 61 struct keytabent { 62 char *kt_keyword; /* keyword for this entry */ 63 u_int kt_offset; /* offset into prom of value */ 64 void (*kt_handler) __P((struct keytabent *, char *)); 65 /* handler function for this entry */ 66 }; 67 68 /* 69 * String-value table entry. Maps a string to a numeric value and 70 * vice-versa. 71 */ 72 struct strvaltabent { 73 char *sv_str; /* the string ... */ 74 u_char sv_val; /* ... and the value */ 75 }; 76 77 #ifdef __sparc__ 78 struct opiocdesc; 79 /* 80 * This is an entry in a table which describes a set of `exceptions'. 81 * In other words, these are Openprom fields that we either can't 82 * `just print' or don't know how to deal with. 83 */ 84 struct extabent { 85 char *ex_keyword; /* keyword for this entry */ 86 void (*ex_handler) __P((struct extabent *, 87 struct opiocdesc *, char *)); 88 /* handler function for this entry */ 89 }; 90 #endif /* __sparc__ */ 91 92 /* date parser */ 93 struct timeb; 94 time_t get_date __P((char *, struct timeb *)); 95 96 /* Sun 3/4 EEPROM handlers. */ 97 void ee_hwupdate __P((struct keytabent *, char *)); 98 void ee_num8 __P((struct keytabent *, char *)); 99 void ee_num16 __P((struct keytabent *, char *)); 100 void ee_screensize __P((struct keytabent *, char *)); 101 void ee_truefalse __P((struct keytabent *, char *)); 102 void ee_bootdev __P((struct keytabent *, char *)); 103 void ee_kbdtype __P((struct keytabent *, char *)); 104 void ee_constype __P((struct keytabent *, char *)); 105 void ee_diagpath __P((struct keytabent *, char *)); 106 void ee_banner __P((struct keytabent *, char *)); 107 void ee_notsupp __P((struct keytabent *, char *)); 108 109 /* Sun 3/4 EEPROM checksum routines. */ 110 u_char ee_checksum __P((u_char *, size_t)); 111 void ee_updatechecksums __P((void)); 112 void ee_verifychecksums __P((void)); 113 114 #ifdef __sparc__ 115 /* Sparc Openprom handlers. */ 116 char *op_handler __P((char *, char *)); 117 void op_dump __P((void)); 118 #endif /* __sparc__ */ 119