defs.h revision 1.1 1 /* $NetBSD: defs.h,v 1.1 1995/07/13 18:08:56 thorpej Exp $ */
2
3 /*
4 * Copyright (c) 1995 Jason R. Thorpe.
5 * All rights reserved.
6 *
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
9 * are met:
10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution.
15 * 3. All advertising materials mentioning features or use of this software
16 * must display the following acknowledgement:
17 * This product includes software developed for the NetBSD Project
18 * by Jason R. Thorpe.
19 * 4. The name of the author may not be used to endorse or promote products
20 * derived from this software without specific prior written permission.
21 *
22 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
23 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
24 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
25 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
26 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
27 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
28 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
29 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
30 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
31 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
32 * SUCH DAMAGE.
33 */
34
35 #undef BUFSIZE
36 #define BUFSIZE 1024
37
38 #define IO_READ 0
39 #define IO_WRITE 1
40
41 #define MAXIMUM(a, b) ((a) > (b) ? (a) : (b))
42
43 /*
44 * Misc. location declarations.
45 */
46 #define EE_SIZE 0x500
47 #define EE_WC_LOC 0x04
48 #define EE_CKSUM_LOC 0x0c
49 #define EE_HWUPDATE_LOC 0x10
50 #define EE_BANNER_ENABLE_LOC 0x20
51
52 /*
53 * Keyword table entry. Contains a pointer to the keyword, the
54 * offset into the prom where the value lives, and a pointer to
55 * the function that handles that value.
56 */
57 struct keytabent {
58 char *kt_keyword; /* keyword for this entry */
59 u_int kt_offset; /* offset into prom of value */
60 void (*kt_handler) __P((struct keytabent *, char *));
61 /* handler function for this entry */
62 };
63
64 /*
65 * String-value table entry. Maps a string to a numeric value and
66 * vice-versa.
67 */
68 struct strvaltabent {
69 char *sv_str; /* the string ... */
70 u_char sv_val; /* ... and the value */
71 };
72
73 #ifdef __sparc__
74 /*
75 * This is an entry in a table which describes a set of `exceptions'.
76 * In other words, these are Openprom fields that we either can't
77 * `just print' or don't know how to deal with.
78 */
79 struct extabent {
80 char *ex_keyword; /* keyword for this entry */
81 void (*ex_handler) __P((struct extabent *,
82 struct opiocdesc *, char *));
83 /* handler function for this entry */
84 };
85 #endif /* __sparc__ */
86
87 /* Sun 3/4 EEPROM handlers. */
88 void ee_hwupdate __P((struct keytabent *, char *));
89 void ee_num8 __P((struct keytabent *, char *));
90 void ee_num16 __P((struct keytabent *, char *));
91 void ee_screensize __P((struct keytabent *, char *));
92 void ee_truefalse __P((struct keytabent *, char *));
93 void ee_bootdev __P((struct keytabent *, char *));
94 void ee_kbdtype __P((struct keytabent *, char *));
95 void ee_constype __P((struct keytabent *, char *));
96 void ee_diagpath __P((struct keytabent *, char *));
97 void ee_banner __P((struct keytabent *, char *));
98 void ee_notsupp __P((struct keytabent *, char *));
99
100 /* Sun 3/4 EEPROM checksum routines. */
101 u_char ee_checksum __P((u_char *, size_t));
102 void ee_updatechecksums __P((void));
103 void ee_verifychecksums __P((void));
104
105 #ifdef __sparc__
106 /* Sparc Openprom handlers. */
107 char *op_handler __P((char *, char *));
108 void op_dump __P((void));
109 #endif /* __sparc__ */
110