defs.h revision 1.6 1 /* $NetBSD: defs.h,v 1.6 2000/11/28 22:31:37 mrg 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) (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) (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 (char *, struct timeb *);
95
96 /* Sun 3/4 EEPROM handlers. */
97 void ee_action (char *, char *);
98 void ee_dump (void);
99 void ee_hwupdate (struct keytabent *, char *);
100 void ee_num8 (struct keytabent *, char *);
101 void ee_num16 (struct keytabent *, char *);
102 void ee_screensize (struct keytabent *, char *);
103 void ee_truefalse (struct keytabent *, char *);
104 void ee_bootdev (struct keytabent *, char *);
105 void ee_kbdtype (struct keytabent *, char *);
106 void ee_constype (struct keytabent *, char *);
107 void ee_diagpath (struct keytabent *, char *);
108 void ee_banner (struct keytabent *, char *);
109 void ee_notsupp (struct keytabent *, char *);
110
111 /* Sun 3/4 EEPROM checksum routines. */
112 u_char ee_checksum (u_char *, size_t);
113 void ee_updatechecksums (void);
114 void ee_verifychecksums (void);
115
116 #ifdef __sparc__
117 /* Sparc Openprom handlers. */
118 char *op_handler (char *, char *);
119 void op_action (char *, char *);
120 void op_dump (void);
121 int check_for_openprom (void);
122 #endif /* __sparc__ */
123