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