properties.c revision 1.1 1 /* $NetBSD: properties.c,v 1.1 1999/06/21 15:56:03 minoura Exp $ */
2
3 /*-
4 * Copyright (c) 1999 The NetBSD Foundation, Inc.
5 * All rights reserved.
6 *
7 * This code is derived from software contributed to The NetBSD Foundation
8 * by Minoura Makoto.
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
40 #include <sys/types.h>
41
42 #include "memswitch.h"
43 #include "methods.h"
44
45
46 /*
47 * XXX: gcc extension is used.
48 */
49 struct property properties[] = {
50 {
51 "special", "magic1",
52 0, 4, 0, {longword:0}, 0, {longword:0}, {longword:MAGIC1},
53 parse_dummy, 0, 0,
54 print_magic,
55 fill_ulong, flush_dummy,
56 " Magic. Must be 0xa3d83638\n"
57 },
58 {
59 "special", "magic2",
60 4, 4, 0, {longword:0}, 0, {longword:0}, {longword:MAGIC2},
61 parse_dummy, 0, 0,
62 print_magic,
63 fill_ulong, flush_dummy,
64 " Magic. Must be 0x30303057\n"
65 },
66 {
67 "alarm", "bootmode",
68 30, 4, 0, {longword:0}, 0, {longword:0}, {longword:0},
69 parse_ulong, 0, 0xff0000,
70 print_ulongh,
71 fill_ulong, flush_ulong,
72 " What to do on RTC alarm boot.\n"
73 },
74 {
75 "alarm", "boottime",
76 34, 4, 0, {longword:0}, 0, {longword:0}, {longword:0xffff0000},
77 parse_ulong, 0, 0xffffffff,
78 print_ulongh,
79 fill_ulong, flush_ulong,
80 " Alarm.\n"
81 },
82 {
83 "alarm", "enabled",
84 38, 1, 0, {byte:{[0] 0}}, 0, {byte:{[0] 0}}, {byte:{[0] 0}},
85 parse_uchar, 0, 7,
86 print_uchar,
87 fill_uchar, flush_uchar,
88 " 0 to enable alarm, 7 to disable.\n"
89 },
90 {
91 "alarm", "timetodown",
92 20, 4, 0, {longword:0}, 0, {longword:0}, {longword:-1},
93 parse_time, -1, 0x7fffffff,
94 print_timesec,
95 fill_ulong, flush_ulong,
96 " When boot on alarm, time to shutdown is stored in second.\n"
97 " Can be specified in minite with suffix minute.\n"
98 },
99 {
100 "boot", "device",
101 24, 2, 0, {word:{[0] 0}}, 0, {word:{[0] 0}}, {word:{[0] -1}},
102 parse_bootdev, 0, 0,
103 print_bootdev,
104 fill_ushort, flush_ushort,
105 " Boot device.\n"
106 " STD for standard, HDn for the nth harddisk, FDn for the nth floppy drive,\n"
107 " ROM for ROM, RAM for RAM.\n"
108 },
109 {
110 "boot", "ramaddr",
111 16, 4, 0, {longword:0}, 0, {longword:0}, {longword:0xed0100},
112 parse_ulong, 0xed0000, 0xed3fff,
113 print_ulongh,
114 fill_ulong, flush_ulong,
115 " If boot.device specifies to boot from RAM, the start address is stored.\n"
116 },
117 {
118 "boot", "romaddr",
119 12, 4, 0, {longword:0}, 0, {longword:0}, {longword:0xbffffc},
120 parse_ulong, 0xe80000, 0xffffff,
121 print_ulongh,
122 fill_ulong, flush_ulong,
123 " If boot.device specifies to boot from ROM, the start address is stored.\n"
124 },
125 {
126 "display", "contrast",
127 40, 1, 0, {byte:{[0] 0}}, 0, {byte:{[0] 0}}, {byte:{[0] 14}},
128 parse_uchar, 0, 1,
129 print_uchar,
130 fill_uchar, flush_uchar,
131 " Display contrast (0-15).\n"
132 },
133 {
134 "display", "dentakufont",
135 44, 1, 0, {byte:{[0] 0}}, 0, {byte:{[0] 0}}, {byte:{[0] 0}},
136 parse_uchar, 0, 1,
137 print_uchar,
138 fill_uchar, flush_uchar,
139 " In-line calculator font. 0 for LCD-like, 1 for normal.\n"
140 " Note on NetBSD in-line calculator is not supported.\n"
141 },
142 {
143 "display", "glyphmode",
144 89, 1, 0, {byte:{[0] 0}}, 0, {byte:{[0] 0}}, {byte:{[0] 0}},
145 parse_uchar, 0, 0x7,
146 print_ucharh,
147 fill_uchar, flush_uchar,
148 " Glyph mode for ASCII/JIS ROMAN characters (bitmap).\n"
149 " Bit 0 (LSB) is for codepoint 0x5c (\\), bit 1 for 0x7e (~),\n"
150 " bit 2 for 0x7c (|).\n"
151 " 0 for JIS ROMAN, 1 for ASCII.\n"
152 },
153 {
154 "display", "resolution",
155 29, 1, 0, {byte:{[0] 0}}, 0, {byte:{[0] 0}}, {byte:{[0] 16}},
156 parse_uchar, 0, 18,
157 print_ucharh,
158 fill_uchar, flush_uchar,
159 " Initial display resolution.\n"
160 },
161 {
162 "display", "tcolor0",
163 46, 2, 0, {word:{[0] 0}}, 0, {word:{[0] 0}}, {word:{[0] 0}},
164 parse_ushort, 0, 0xffff,
165 print_ushorth,
166 fill_ushort, flush_ushort,
167 " Initial RGB value for color cell #0.\n"
168 " Note on NetBSD the value is ignored.\n"
169 },
170 {
171 "display", "tcolor1",
172 48, 2, 0, {word:{[0] 0}}, 0, {word:{[0] 0}}, {word:{[0] 0xf83e}},
173 parse_ushort, 0, 0xffff,
174 print_ushorth,
175 fill_ushort, flush_ushort,
176 " Initial RGB value for color cell #1.\n"
177 " Note on NetBSD the value is ignored.\n"
178 },
179 {
180 "display", "tcolor2",
181 50, 2, 0, {word:{[0] 0}}, 0, {word:{[0] 0}}, {word:{[0] 0xffc0}},
182 parse_ushort, 0, 0xffff,
183 print_ushorth,
184 fill_ushort, flush_ushort,
185 " Initial RGB value for color cell #2.\n"
186 " Note on NetBSD the value is ignored.\n"
187 },
188 {
189 "display", "tcolor3",
190 52, 2, 0, {word:{[0] 0}}, 0, {word:{[0] 0}}, {word:{[0] 0xfffe}},
191 parse_ushort, 0, 0xffff,
192 print_ushorth,
193 fill_ushort, flush_ushort,
194 " Initial RGB value for color cell #3.\n"
195 " Note on NetBSD the value is ignored.\n"
196 },
197 {
198 "display", "tcolor47",
199 54, 2, 0, {word:{[0] 0}}, 0, {word:{[0] 0}}, {word:{[0] 0xde6c}},
200 parse_ushort, 0, 0xffff,
201 print_ushorth,
202 fill_ushort, flush_ushort,
203 " Initial RGB value for color cell #4-7.\n"
204 " Note on NetBSD the value is ignored.\n"
205 },
206 {
207 "display", "tcolor8f",
208 56, 2, 0, {word:{[0] 0}}, 0, {word:{[0] 0}}, {word:{[0] 0}},
209 parse_ushort, 0, 0xffff,
210 print_ushorth,
211 fill_ushort, flush_ushort,
212 " Initial RGB value for color cell #8-15.\n"
213 " Note on NetBSD the value is ignored.\n"
214 },
215 {
216 "hw", "harddrive",
217 90, 1, 0, {byte:{[0] 0}}, 0, {byte:{[0] 0}}, {byte:{[0] 0}},
218 parse_uchar, 0, 15,
219 print_ucharh,
220 fill_uchar, flush_uchar,
221 " Number of old, SASI-compatible hard disks connected.\n"
222 " Note they are not supported on NetBSD.\n"
223 },
224 {
225 "hw", "memory",
226 8, 4, 0, {longword:0}, 0, {longword:0}, {longword:1024*1024},
227 parse_byte, 1024*1024, 12*1024*1024,
228 print_ulongh,
229 fill_ulong, flush_ulong,
230 " Memory size in byte.\n"
231 " Can be specified by Kilobyte and Megabyte with suffix KB and MB respectively.\n"
232 },
233 #ifdef notyet
234 {
235 "hw", "serial",
236 26, 2, 0, {word:{[0] 0}}, 0, {word:{[0] 0}}, {word:{[0] 0x4e07}},
237 parse_serial, 0, 0,
238 print_serial,
239 fill_ushort, flush_ushort,
240 " Serial mode."
241 },
242 #endif
243 {
244 "hw", "srammode",
245 45, 1, 0, {byte:{[0] 0}}, 0, {byte:{[0] 0}}, {byte:{[0] 0}},
246 parse_uchar, 0, 1,
247 print_uchar,
248 fill_uchar, flush_uchar,
249 " Usage of the user area of non-volatile static RAM.\n"
250 " 0 for unused, 1 for SRAMDISK, 2 for user program.\n"
251 },
252 {
253 "hw", "upcount",
254 84, 4, 0, {longword:0}, 0, {longword:0}, {longword:0},
255 parse_dummy, 0, 0xffffffff,
256 print_ulong,
257 fill_ulong, flush_dummy,
258 " Boot count since the SRAM is initialized.\n"
259 },
260 {
261 "hw", "uptime",
262 76, 4, 0, {longword:0}, 0, {longword:0}, {longword:0},
263 parse_dummy, 0, 0xffffffff,
264 print_ulong,
265 fill_ulong, flush_dummy,
266 " Total uptime since the SRAM is initialized.\n"
267 },
268 {
269 "keyboard", "delay",
270 58, 1, 0, {byte:{[0] 0}}, 0, {byte:{[0] 0}}, {byte:{[0] 3}},
271 parse_uchar, 0, 0xff,
272 print_uchar,
273 fill_uchar, flush_uchar,
274 " Delay for start keyboard autorepeat. (200+100*n) ms.\n"
275 },
276 {
277 "keyboard", "kanalayout",
278 43, 1, 0, {byte:{[0] 0}}, 0, {byte:{[0] 0}}, {byte:{[0] 0}},
279 parse_uchar, 0, 1,
280 print_uchar,
281 fill_uchar, flush_uchar,
282 " Layout of kana keys. 0 for JIS, 1 for AIUEO order.\n"
283 " Note on NetBSD kana input is not supported.\n"
284 },
285 {
286 "keyboard", "ledstat",
287 28, 1, 0, {byte:{[0] 0}}, 0, {byte:{[0] 0}}, {byte:{[0] 0}},
288 parse_uchar, 0, 0x7f,
289 print_uchar,
290 fill_uchar, flush_uchar,
291 " Initial keyboard LED status (bitmap).\n"
292 " Each bit means KANA, ROMAJI, CODE, CAPS, INS, HIRAGANA, ZENKAKU from LSB.\n"
293 },
294 {
295 "keyboard", "opt2",
296 39, 1, 0, {byte:{[0] 0}}, 0, {byte:{[0] 0}}, {byte:{[0] 0}},
297 parse_uchar, 0, 1,
298 print_uchar,
299 fill_uchar, flush_uchar,
300 " 1 for normal, 0 for TV control.\n"
301 },
302 {
303 "keyboard", "repeat",
304 59, 1, 0, {byte:{[0] 0}}, 0, {byte:{[0] 0}}, {byte:{[0] 3}},
305 parse_uchar, 0, 0xff,
306 print_uchar,
307 fill_uchar, flush_uchar,
308 " Time elapsed between the keyboard autorepeat. (30+5*n^2 ms.\n"
309 },
310 {
311 "poweroff", "ejectfloppy",
312 41, 1, 0, {byte:{[0] 0}}, 0, {byte:{[0] 0}}, {byte:{[0] 0}},
313 parse_uchar, 0, 1,
314 print_uchar,
315 fill_uchar, flush_uchar,
316 " 1 to eject floppy disks at shutdown.\n"
317 },
318 {
319 "poweroff", "tvctrl",
320 42, 1, 0, {byte:{[0] 0}}, 0, {byte:{[0] 0}}, {byte:{[0] 13}},
321 parse_uchar, 0, 0xff,
322 print_uchar,
323 fill_uchar, flush_uchar,
324 " What to do at shutdown for display TV.\n"
325 },
326 {
327 "printer", "timeout",
328 60, 4, 0, {longword:0}, 0, {longword:0}, {longword:0x80000},
329 parse_ulong, 0, 0xffffffff,
330 print_ulong,
331 fill_ulong, flush_ulong,
332 " Printer timeout in second.\n"
333 },
334 };
335
336 int number_of_props = sizeof (properties) / sizeof (struct property);
337