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