Sync usage with man page.
[netbsd-mini2440.git] / usr.sbin / eeprom / defs.h
blob7c8ba7292f16901ef691b6e7a3b55680bd5ee2f5
1 /* $NetBSD: defs.h,v 1.12 2009/04/26 01:51:07 lukem Exp $ */
3 /*-
4 * Copyright (c) 1996 The NetBSD Foundation, Inc.
5 * All rights reserved.
7 * This code is derived from software contributed to The NetBSD Foundation
8 * by Jason R. Thorpe.
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.
19 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
20 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
21 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
22 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
23 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29 * POSSIBILITY OF SUCH DAMAGE.
32 #ifdef USE_OPENFIRM
33 #include <dev/ofw/openfirmio.h>
34 #endif
36 #ifdef USE_PREPNVRAM
37 #include <machine/nvram.h>
38 #endif
40 #undef BUFSIZE
41 #define BUFSIZE 1024
43 #define IO_READ 0
44 #define IO_WRITE 1
46 #define MAXIMUM(a, b) ((a) > (b) ? (a) : (b))
49 * Misc. location declarations.
51 #define EE_SIZE 0x500
52 #define EE_WC_LOC 0x04
53 #define EE_CKSUM_LOC 0x0c
54 #define EE_HWUPDATE_LOC 0x10
55 #define EE_BANNER_ENABLE_LOC 0x20
58 * Keyword table entry. Contains a pointer to the keyword, the
59 * offset into the prom where the value lives, and a pointer to
60 * the function that handles that value.
62 struct keytabent {
63 const char *kt_keyword; /* keyword for this entry */
64 u_int kt_offset; /* offset into prom of value */
65 void (*kt_handler) (struct keytabent *, char *);
66 /* handler function for this entry */
70 * String-value table entry. Maps a string to a numeric value and
71 * vice-versa.
73 struct strvaltabent {
74 const char *sv_str; /* the string ... */
75 u_char sv_val; /* ... and the value */
78 #ifdef __sparc__
79 struct opiocdesc;
81 * This is an entry in a table which describes a set of `exceptions'.
82 * In other words, these are Openprom fields that we either can't
83 * `just print' or don't know how to deal with.
85 struct extabent {
86 const char *ex_keyword; /* keyword for this entry */
87 void (*ex_handler) (struct extabent *,
88 struct opiocdesc *, char *);
89 /* handler function for this entry */
91 #endif /* __sparc__ */
93 #ifdef USE_OPENFIRM
94 struct extabent {
95 const char *ex_keyword; /* keyword for this entry */
96 void (*ex_handler) (struct extabent *,
97 struct ofiocdesc *, char *);
98 /* handler function for this entry */
100 #endif
102 #ifdef USE_PREPNVRAM
103 struct extabent {
104 const char *ex_keyword; /* keyword for this entry */
105 void (*ex_handler) (struct extabent *,
106 struct pnviocdesc *, char *);
107 /* handler function for this entry */
109 #endif
112 /* Sun 3/4 EEPROM handlers. */
113 void ee_action (char *, char *);
114 void ee_dump (void);
115 void ee_hwupdate (struct keytabent *, char *);
116 void ee_num8 (struct keytabent *, char *);
117 void ee_num16 (struct keytabent *, char *);
118 void ee_screensize (struct keytabent *, char *);
119 void ee_truefalse (struct keytabent *, char *);
120 void ee_bootdev (struct keytabent *, char *);
121 void ee_kbdtype (struct keytabent *, char *);
122 void ee_constype (struct keytabent *, char *);
123 void ee_diagpath (struct keytabent *, char *);
124 void ee_banner (struct keytabent *, char *);
125 void ee_notsupp (struct keytabent *, char *);
127 /* Sun 3/4 EEPROM checksum routines. */
128 u_char ee_checksum (u_char *, size_t);
129 void ee_updatechecksums (void);
130 void ee_verifychecksums (void);
132 #ifdef __sparc__
133 /* Sparc Openprom handlers. */
134 char *op_handler (char *, char *);
135 void op_action (char *, char *);
136 void op_dump (void);
137 int check_for_openprom (void);
138 #endif /* __sparc__ */
140 /* OpenFirmware handlers. */
141 char *of_handler (char *, char *);
142 void of_action (char *, char *);
143 void of_dump (void);
145 /* PReP nvram handlers. */
146 char *prep_handler (char *, char *);
147 void prep_action (char *, char *);
148 void prep_dump (void);