1*8950e44dSisaki /* $NetBSD: properties.c,v 1.5 2015/09/21 08:04:43 isaki Exp $ */ 212769637Sminoura 312769637Sminoura /*- 412769637Sminoura * Copyright (c) 1999 The NetBSD Foundation, Inc. 512769637Sminoura * All rights reserved. 612769637Sminoura * 712769637Sminoura * This code is derived from software contributed to The NetBSD Foundation 812769637Sminoura * by Minoura Makoto. 912769637Sminoura * 1012769637Sminoura * Redistribution and use in source and binary forms, with or without 1112769637Sminoura * modification, are permitted provided that the following conditions 1212769637Sminoura * are met: 1312769637Sminoura * 1. Redistributions of source code must retain the above copyright 1412769637Sminoura * notice, this list of conditions and the following disclaimer. 1512769637Sminoura * 2. Redistributions in binary form must reproduce the above copyright 1612769637Sminoura * notice, this list of conditions and the following disclaimer in the 1712769637Sminoura * documentation and/or other materials provided with the distribution. 1812769637Sminoura * 1912769637Sminoura * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS 2012769637Sminoura * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 2112769637Sminoura * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 2212769637Sminoura * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS 2312769637Sminoura * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 2412769637Sminoura * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 2512769637Sminoura * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 2612769637Sminoura * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 2712769637Sminoura * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 2812769637Sminoura * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 2912769637Sminoura * POSSIBILITY OF SUCH DAMAGE. 3012769637Sminoura */ 3112769637Sminoura 3212769637Sminoura 3312769637Sminoura #include <sys/types.h> 3412769637Sminoura 3512769637Sminoura #include "memswitch.h" 3612769637Sminoura #include "methods.h" 3712769637Sminoura 3812769637Sminoura 3912769637Sminoura /* 4012769637Sminoura * XXX: gcc extension is used. 4112769637Sminoura */ 4212769637Sminoura struct property properties[] = { 4312769637Sminoura { 4412769637Sminoura "special", "magic1", 4512769637Sminoura 0, 4, 0, {longword:0}, 0, {longword:0}, {longword:MAGIC1}, 4612769637Sminoura parse_dummy, 0, 0, 4712769637Sminoura print_magic, 482844bec4Sminoura fill_ulong, flush_ulong, 492844bec4Sminoura " Magic. Must be 0x82773638\n" 5012769637Sminoura }, 5112769637Sminoura { 5212769637Sminoura "special", "magic2", 5312769637Sminoura 4, 4, 0, {longword:0}, 0, {longword:0}, {longword:MAGIC2}, 5412769637Sminoura parse_dummy, 0, 0, 5512769637Sminoura print_magic, 562844bec4Sminoura fill_ulong, flush_ulong, 5712769637Sminoura " Magic. Must be 0x30303057\n" 5812769637Sminoura }, 5912769637Sminoura { 6012769637Sminoura "alarm", "bootmode", 6112769637Sminoura 30, 4, 0, {longword:0}, 0, {longword:0}, {longword:0}, 6212769637Sminoura parse_ulong, 0, 0xff0000, 6312769637Sminoura print_ulongh, 6412769637Sminoura fill_ulong, flush_ulong, 6512769637Sminoura " What to do on RTC alarm boot.\n" 6612769637Sminoura }, 6712769637Sminoura { 6812769637Sminoura "alarm", "boottime", 6912769637Sminoura 34, 4, 0, {longword:0}, 0, {longword:0}, {longword:0xffff0000}, 7012769637Sminoura parse_ulong, 0, 0xffffffff, 7112769637Sminoura print_ulongh, 7212769637Sminoura fill_ulong, flush_ulong, 7312769637Sminoura " Alarm.\n" 7412769637Sminoura }, 7512769637Sminoura { 7612769637Sminoura "alarm", "enabled", 7712769637Sminoura 38, 1, 0, {byte:{[0] 0}}, 0, {byte:{[0] 0}}, {byte:{[0] 0}}, 7812769637Sminoura parse_uchar, 0, 7, 7912769637Sminoura print_uchar, 8012769637Sminoura fill_uchar, flush_uchar, 8112769637Sminoura " 0 to enable alarm, 7 to disable.\n" 8212769637Sminoura }, 8312769637Sminoura { 8412769637Sminoura "alarm", "timetodown", 8512769637Sminoura 20, 4, 0, {longword:0}, 0, {longword:0}, {longword:-1}, 8612769637Sminoura parse_time, -1, 0x7fffffff, 8712769637Sminoura print_timesec, 8812769637Sminoura fill_ulong, flush_ulong, 8912769637Sminoura " When boot on alarm, time to shutdown is stored in second.\n" 9012769637Sminoura " Can be specified in minite with suffix minute.\n" 9112769637Sminoura }, 9212769637Sminoura { 9312769637Sminoura "boot", "device", 9412769637Sminoura 24, 2, 0, {word:{[0] 0}}, 0, {word:{[0] 0}}, {word:{[0] -1}}, 9512769637Sminoura parse_bootdev, 0, 0, 9612769637Sminoura print_bootdev, 9712769637Sminoura fill_ushort, flush_ushort, 9812769637Sminoura " Boot device.\n" 9912769637Sminoura " STD for standard, HDn for the nth harddisk, FDn for the nth floppy drive,\n" 100271f6f55Sminoura " ROM for the ROM firmware, RAM for the non-volatile SRAM,\n" 101271f6f55Sminoura " INSCSIn for the SCSI device ID n which is attached to the built-in adaptor,\n" 102271f6f55Sminoura " EXSCSIn for the SCSI device ID n which is attached to the external adaptor.\n" 10312769637Sminoura }, 10412769637Sminoura { 10512769637Sminoura "boot", "ramaddr", 10612769637Sminoura 16, 4, 0, {longword:0}, 0, {longword:0}, {longword:0xed0100}, 10712769637Sminoura parse_ulong, 0xed0000, 0xed3fff, 10812769637Sminoura print_ulongh, 10912769637Sminoura fill_ulong, flush_ulong, 11012769637Sminoura " If boot.device specifies to boot from RAM, the start address is stored.\n" 11112769637Sminoura }, 11212769637Sminoura { 11312769637Sminoura "boot", "romaddr", 11412769637Sminoura 12, 4, 0, {longword:0}, 0, {longword:0}, {longword:0xbffffc}, 11512769637Sminoura parse_ulong, 0xe80000, 0xffffff, 11612769637Sminoura print_ulongh, 11712769637Sminoura fill_ulong, flush_ulong, 11812769637Sminoura " If boot.device specifies to boot from ROM, the start address is stored.\n" 11912769637Sminoura }, 12012769637Sminoura { 12112769637Sminoura "display", "contrast", 12212769637Sminoura 40, 1, 0, {byte:{[0] 0}}, 0, {byte:{[0] 0}}, {byte:{[0] 14}}, 123*8950e44dSisaki parse_uchar, 0, 15, 12412769637Sminoura print_uchar, 12512769637Sminoura fill_uchar, flush_uchar, 12612769637Sminoura " Display contrast (0-15).\n" 12712769637Sminoura }, 12812769637Sminoura { 12912769637Sminoura "display", "dentakufont", 13012769637Sminoura 44, 1, 0, {byte:{[0] 0}}, 0, {byte:{[0] 0}}, {byte:{[0] 0}}, 13112769637Sminoura parse_uchar, 0, 1, 13212769637Sminoura print_uchar, 13312769637Sminoura fill_uchar, flush_uchar, 13412769637Sminoura " In-line calculator font. 0 for LCD-like, 1 for normal.\n" 13512769637Sminoura " Note on NetBSD in-line calculator is not supported.\n" 13612769637Sminoura }, 13712769637Sminoura { 13812769637Sminoura "display", "glyphmode", 13912769637Sminoura 89, 1, 0, {byte:{[0] 0}}, 0, {byte:{[0] 0}}, {byte:{[0] 0}}, 14012769637Sminoura parse_uchar, 0, 0x7, 14112769637Sminoura print_ucharh, 14212769637Sminoura fill_uchar, flush_uchar, 14312769637Sminoura " Glyph mode for ASCII/JIS ROMAN characters (bitmap).\n" 14412769637Sminoura " Bit 0 (LSB) is for codepoint 0x5c (\\), bit 1 for 0x7e (~),\n" 14512769637Sminoura " bit 2 for 0x7c (|).\n" 14612769637Sminoura " 0 for JIS ROMAN, 1 for ASCII.\n" 14712769637Sminoura }, 14812769637Sminoura { 14912769637Sminoura "display", "resolution", 15012769637Sminoura 29, 1, 0, {byte:{[0] 0}}, 0, {byte:{[0] 0}}, {byte:{[0] 16}}, 15112769637Sminoura parse_uchar, 0, 18, 15212769637Sminoura print_ucharh, 15312769637Sminoura fill_uchar, flush_uchar, 15412769637Sminoura " Initial display resolution.\n" 15512769637Sminoura }, 15612769637Sminoura { 15712769637Sminoura "display", "tcolor0", 15812769637Sminoura 46, 2, 0, {word:{[0] 0}}, 0, {word:{[0] 0}}, {word:{[0] 0}}, 15912769637Sminoura parse_ushort, 0, 0xffff, 16012769637Sminoura print_ushorth, 16112769637Sminoura fill_ushort, flush_ushort, 16212769637Sminoura " Initial RGB value for color cell #0.\n" 16312769637Sminoura " Note on NetBSD the value is ignored.\n" 16412769637Sminoura }, 16512769637Sminoura { 16612769637Sminoura "display", "tcolor1", 16712769637Sminoura 48, 2, 0, {word:{[0] 0}}, 0, {word:{[0] 0}}, {word:{[0] 0xf83e}}, 16812769637Sminoura parse_ushort, 0, 0xffff, 16912769637Sminoura print_ushorth, 17012769637Sminoura fill_ushort, flush_ushort, 17112769637Sminoura " Initial RGB value for color cell #1.\n" 17212769637Sminoura " Note on NetBSD the value is ignored.\n" 17312769637Sminoura }, 17412769637Sminoura { 17512769637Sminoura "display", "tcolor2", 17612769637Sminoura 50, 2, 0, {word:{[0] 0}}, 0, {word:{[0] 0}}, {word:{[0] 0xffc0}}, 17712769637Sminoura parse_ushort, 0, 0xffff, 17812769637Sminoura print_ushorth, 17912769637Sminoura fill_ushort, flush_ushort, 18012769637Sminoura " Initial RGB value for color cell #2.\n" 18112769637Sminoura " Note on NetBSD the value is ignored.\n" 18212769637Sminoura }, 18312769637Sminoura { 18412769637Sminoura "display", "tcolor3", 18512769637Sminoura 52, 2, 0, {word:{[0] 0}}, 0, {word:{[0] 0}}, {word:{[0] 0xfffe}}, 18612769637Sminoura parse_ushort, 0, 0xffff, 18712769637Sminoura print_ushorth, 18812769637Sminoura fill_ushort, flush_ushort, 18912769637Sminoura " Initial RGB value for color cell #3.\n" 19012769637Sminoura " Note on NetBSD the value is ignored.\n" 19112769637Sminoura }, 19212769637Sminoura { 19312769637Sminoura "display", "tcolor47", 19412769637Sminoura 54, 2, 0, {word:{[0] 0}}, 0, {word:{[0] 0}}, {word:{[0] 0xde6c}}, 19512769637Sminoura parse_ushort, 0, 0xffff, 19612769637Sminoura print_ushorth, 19712769637Sminoura fill_ushort, flush_ushort, 19812769637Sminoura " Initial RGB value for color cell #4-7.\n" 19912769637Sminoura " Note on NetBSD the value is ignored.\n" 20012769637Sminoura }, 20112769637Sminoura { 20212769637Sminoura "display", "tcolor8f", 20312769637Sminoura 56, 2, 0, {word:{[0] 0}}, 0, {word:{[0] 0}}, {word:{[0] 0}}, 20412769637Sminoura parse_ushort, 0, 0xffff, 20512769637Sminoura print_ushorth, 20612769637Sminoura fill_ushort, flush_ushort, 20712769637Sminoura " Initial RGB value for color cell #8-15.\n" 20812769637Sminoura " Note on NetBSD the value is ignored.\n" 20912769637Sminoura }, 21012769637Sminoura { 21112769637Sminoura "hw", "harddrive", 21212769637Sminoura 90, 1, 0, {byte:{[0] 0}}, 0, {byte:{[0] 0}}, {byte:{[0] 0}}, 21312769637Sminoura parse_uchar, 0, 15, 21412769637Sminoura print_ucharh, 21512769637Sminoura fill_uchar, flush_uchar, 21612769637Sminoura " Number of old, SASI-compatible hard disks connected.\n" 21712769637Sminoura " Note they are not supported on NetBSD.\n" 21812769637Sminoura }, 21912769637Sminoura { 22012769637Sminoura "hw", "memory", 22112769637Sminoura 8, 4, 0, {longword:0}, 0, {longword:0}, {longword:1024*1024}, 22212769637Sminoura parse_byte, 1024*1024, 12*1024*1024, 22312769637Sminoura print_ulongh, 22412769637Sminoura fill_ulong, flush_ulong, 22512769637Sminoura " Memory size in byte.\n" 22612769637Sminoura " Can be specified by Kilobyte and Megabyte with suffix KB and MB respectively.\n" 22712769637Sminoura }, 22812769637Sminoura { 22912769637Sminoura "hw", "serial", 23012769637Sminoura 26, 2, 0, {word:{[0] 0}}, 0, {word:{[0] 0}}, {word:{[0] 0x4e07}}, 23112769637Sminoura parse_serial, 0, 0, 23212769637Sminoura print_serial, 23312769637Sminoura fill_ushort, flush_ushort, 2342844bec4Sminoura " Serial mode.\n" 2352844bec4Sminoura " Consist of comma-separated 5 specs. The first value means speed in bps,\n" 2362844bec4Sminoura " second means the bit width (5-8), third means parity (n for non parity,\n" 2372844bec4Sminoura " o for odd parity, e for even parity), fourth means stop bit (2, 1 or 1.5),\n" 2382844bec4Sminoura " fifth for software flow control (`-' or `s').\n" 2392844bec4Sminoura " Note that the value is ignored on NetBSD.\n" 24012769637Sminoura }, 24112769637Sminoura { 24212769637Sminoura "hw", "srammode", 24312769637Sminoura 45, 1, 0, {byte:{[0] 0}}, 0, {byte:{[0] 0}}, {byte:{[0] 0}}, 2442844bec4Sminoura parse_srammode, 0, 1, 2452844bec4Sminoura print_srammode, 24612769637Sminoura fill_uchar, flush_uchar, 24712769637Sminoura " Usage of the user area of non-volatile static RAM.\n" 24812769637Sminoura " 0 for unused, 1 for SRAMDISK, 2 for user program.\n" 24912769637Sminoura }, 25012769637Sminoura { 25112769637Sminoura "hw", "upcount", 25212769637Sminoura 84, 4, 0, {longword:0}, 0, {longword:0}, {longword:0}, 25312769637Sminoura parse_dummy, 0, 0xffffffff, 25412769637Sminoura print_ulong, 25512769637Sminoura fill_ulong, flush_dummy, 25612769637Sminoura " Boot count since the SRAM is initialized.\n" 25712769637Sminoura }, 25812769637Sminoura { 25912769637Sminoura "hw", "uptime", 26012769637Sminoura 76, 4, 0, {longword:0}, 0, {longword:0}, {longword:0}, 26112769637Sminoura parse_dummy, 0, 0xffffffff, 26212769637Sminoura print_ulong, 26312769637Sminoura fill_ulong, flush_dummy, 26412769637Sminoura " Total uptime since the SRAM is initialized.\n" 26512769637Sminoura }, 26612769637Sminoura { 26712769637Sminoura "keyboard", "delay", 26812769637Sminoura 58, 1, 0, {byte:{[0] 0}}, 0, {byte:{[0] 0}}, {byte:{[0] 3}}, 26912769637Sminoura parse_uchar, 0, 0xff, 27012769637Sminoura print_uchar, 27112769637Sminoura fill_uchar, flush_uchar, 27212769637Sminoura " Delay for start keyboard autorepeat. (200+100*n) ms.\n" 27312769637Sminoura }, 27412769637Sminoura { 27512769637Sminoura "keyboard", "kanalayout", 27612769637Sminoura 43, 1, 0, {byte:{[0] 0}}, 0, {byte:{[0] 0}}, {byte:{[0] 0}}, 27712769637Sminoura parse_uchar, 0, 1, 27812769637Sminoura print_uchar, 27912769637Sminoura fill_uchar, flush_uchar, 28012769637Sminoura " Layout of kana keys. 0 for JIS, 1 for AIUEO order.\n" 28112769637Sminoura " Note on NetBSD kana input is not supported.\n" 28212769637Sminoura }, 28312769637Sminoura { 28412769637Sminoura "keyboard", "ledstat", 28512769637Sminoura 28, 1, 0, {byte:{[0] 0}}, 0, {byte:{[0] 0}}, {byte:{[0] 0}}, 28612769637Sminoura parse_uchar, 0, 0x7f, 28712769637Sminoura print_uchar, 28812769637Sminoura fill_uchar, flush_uchar, 28912769637Sminoura " Initial keyboard LED status (bitmap).\n" 29012769637Sminoura " Each bit means KANA, ROMAJI, CODE, CAPS, INS, HIRAGANA, ZENKAKU from LSB.\n" 29112769637Sminoura }, 29212769637Sminoura { 29312769637Sminoura "keyboard", "opt2", 29412769637Sminoura 39, 1, 0, {byte:{[0] 0}}, 0, {byte:{[0] 0}}, {byte:{[0] 0}}, 29512769637Sminoura parse_uchar, 0, 1, 29612769637Sminoura print_uchar, 29712769637Sminoura fill_uchar, flush_uchar, 29812769637Sminoura " 1 for normal, 0 for TV control.\n" 29912769637Sminoura }, 30012769637Sminoura { 30112769637Sminoura "keyboard", "repeat", 30212769637Sminoura 59, 1, 0, {byte:{[0] 0}}, 0, {byte:{[0] 0}}, {byte:{[0] 3}}, 30312769637Sminoura parse_uchar, 0, 0xff, 30412769637Sminoura print_uchar, 30512769637Sminoura fill_uchar, flush_uchar, 30612769637Sminoura " Time elapsed between the keyboard autorepeat. (30+5*n^2 ms.\n" 30712769637Sminoura }, 30812769637Sminoura { 30912769637Sminoura "poweroff", "ejectfloppy", 31012769637Sminoura 41, 1, 0, {byte:{[0] 0}}, 0, {byte:{[0] 0}}, {byte:{[0] 0}}, 31112769637Sminoura parse_uchar, 0, 1, 31212769637Sminoura print_uchar, 31312769637Sminoura fill_uchar, flush_uchar, 31412769637Sminoura " 1 to eject floppy disks at shutdown.\n" 31512769637Sminoura }, 31612769637Sminoura { 31712769637Sminoura "poweroff", "tvctrl", 31812769637Sminoura 42, 1, 0, {byte:{[0] 0}}, 0, {byte:{[0] 0}}, {byte:{[0] 13}}, 31912769637Sminoura parse_uchar, 0, 0xff, 32012769637Sminoura print_uchar, 32112769637Sminoura fill_uchar, flush_uchar, 32212769637Sminoura " What to do at shutdown for display TV.\n" 32312769637Sminoura }, 32412769637Sminoura { 32512769637Sminoura "printer", "timeout", 32612769637Sminoura 60, 4, 0, {longword:0}, 0, {longword:0}, {longword:0x80000}, 32712769637Sminoura parse_ulong, 0, 0xffffffff, 32812769637Sminoura print_ulong, 32912769637Sminoura fill_ulong, flush_ulong, 33012769637Sminoura " Printer timeout in second.\n" 33112769637Sminoura }, 33212769637Sminoura }; 33312769637Sminoura 33412769637Sminoura int number_of_props = sizeof (properties) / sizeof (struct property); 335