defs.h revision 1.2 1 /* $NetBSD: defs.h,v 1.2 1996/02/28 01:13:20 thorpej 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 REGENTS OR CONTRIBUTORS BE
30 * 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 /*
79 * This is an entry in a table which describes a set of `exceptions'.
80 * In other words, these are Openprom fields that we either can't
81 * `just print' or don't know how to deal with.
82 */
83 struct extabent {
84 char *ex_keyword; /* keyword for this entry */
85 void (*ex_handler) __P((struct extabent *,
86 struct opiocdesc *, char *));
87 /* handler function for this entry */
88 };
89 #endif /* __sparc__ */
90
91 /* Sun 3/4 EEPROM handlers. */
92 void ee_hwupdate __P((struct keytabent *, char *));
93 void ee_num8 __P((struct keytabent *, char *));
94 void ee_num16 __P((struct keytabent *, char *));
95 void ee_screensize __P((struct keytabent *, char *));
96 void ee_truefalse __P((struct keytabent *, char *));
97 void ee_bootdev __P((struct keytabent *, char *));
98 void ee_kbdtype __P((struct keytabent *, char *));
99 void ee_constype __P((struct keytabent *, char *));
100 void ee_diagpath __P((struct keytabent *, char *));
101 void ee_banner __P((struct keytabent *, char *));
102 void ee_notsupp __P((struct keytabent *, char *));
103
104 /* Sun 3/4 EEPROM checksum routines. */
105 u_char ee_checksum __P((u_char *, size_t));
106 void ee_updatechecksums __P((void));
107 void ee_verifychecksums __P((void));
108
109 #ifdef __sparc__
110 /* Sparc Openprom handlers. */
111 char *op_handler __P((char *, char *));
112 void op_dump __P((void));
113 #endif /* __sparc__ */
114