diff options
author | Miod Vallat <miod@cvs.openbsd.org> | 2013-10-28 22:13:14 +0000 |
---|---|---|
committer | Miod Vallat <miod@cvs.openbsd.org> | 2013-10-28 22:13:14 +0000 |
commit | 4fe4ce2f803bc18527e443a2d3b784c9acae8d3f (patch) | |
tree | 9281e12f10590a1d5ca03adffa7c9c39ab012a7a /sys/arch/luna88k | |
parent | 0ea2c368e5940ddbfb27a6ac8fe58c3cb2c3f29b (diff) |
The first steps of a native OpenBSD/luna88k bootloader. Able to boot ELF
kernels with symbols from disk or network.
Based upon the NetBSD/luna68k bootloader which got recently overhauled from
4.3BSD (thanks, tsutsui@ !), updated to match the luna88k hardware layout
and turned into a polling-only binary.
Tested on luna88k (not -2) only so far.
Diffstat (limited to 'sys/arch/luna88k')
41 files changed, 10314 insertions, 0 deletions
diff --git a/sys/arch/luna88k/stand/Makefile b/sys/arch/luna88k/stand/Makefile new file mode 100644 index 00000000000..8ecb9693395 --- /dev/null +++ b/sys/arch/luna88k/stand/Makefile @@ -0,0 +1,8 @@ +# $OpenBSD: Makefile,v 1.1 2013/10/28 22:13:11 miod Exp $ +# $NetBSD: Makefile,v 1.1 2013/01/06 07:04:49 tsutsui Exp $ + +.if ${MACHINE} == "luna88k" +SUBDIR= boot +.endif + +.include <bsd.subdir.mk> diff --git a/sys/arch/luna88k/stand/Makefile.inc b/sys/arch/luna88k/stand/Makefile.inc new file mode 100644 index 00000000000..b94ef519f74 --- /dev/null +++ b/sys/arch/luna88k/stand/Makefile.inc @@ -0,0 +1,7 @@ +# $OpenBSD: Makefile.inc,v 1.1 2013/10/28 22:13:11 miod Exp $ +# $NetBSD: Makefile.inc,v 1.1 2013/01/06 07:04:49 tsutsui Exp $ + +NOPIE= +CFLAGS+= -Wall -Werror -fno-stack-protector +CFLAGS+= -mmemcpy +CFLAGS+= -fno-builtin-printf -fno-builtin-putchar -fno-builtin-vprintf diff --git a/sys/arch/luna88k/stand/boot/Makefile b/sys/arch/luna88k/stand/boot/Makefile new file mode 100644 index 00000000000..4c4f09d75ce --- /dev/null +++ b/sys/arch/luna88k/stand/boot/Makefile @@ -0,0 +1,81 @@ +# $OpenBSD: Makefile,v 1.1 2013/10/28 22:13:12 miod Exp $ +# $NetBSD: Makefile,v 1.9 2013/01/22 15:48:40 tsutsui Exp $ +# @(#)Makefile 8.2 (Berkeley) 8/15/93 + +NOMAN= # defined + +S= ${.CURDIR}/../../../.. +LIBSADIR= ${S}/lib/libsa + +CPPFLAGS+= -nostdinc -D_STANDALONE +CPPFLAGS+= -I${.CURDIR} -I${.OBJDIR} -I${S} -I${S}/arch + +CPPFLAGS+= -DSUPPORT_DISK +CPPFLAGS+= -DSUPPORT_ETHERNET +CPPFLAGS+= -DSUPPORT_BOOTP +#CPPFLAGS+= -DBOOTP_DEBUG -DNETIF_DEBUG -DETHER_DEBUG -DNFS_DEBUG +#CPPFLAGS+= -DRPC_DEBUG -DRARP_DEBUG -DNET_DEBUG -DDEBUG -DPARANOID + +OBJCOPY?= objcopy +TEXTADDR= 0x700000 # 7MB +LDSCRIPT= ${.CURDIR}/boot.ldscript +LINKFORMAT= -static -N -Ttext ${TEXTADDR} -T ${LDSCRIPT} \ + --warn-common -nopie + +SRCS= locore.S +SRCS+= init_main.c autoconf.c ioconf.c +SRCS+= fault.c setjmp.S +SRCS+= bcd.c +SRCS+= devopen.c +SRCS+= conf.c +SRCS+= getline.c parse.c +SRCS+= boot.c +SRCS+= cons.c prf.c awaitkey.c +SRCS+= sio.c +SRCS+= bmc.c bmd.c font.c kbd.c +SRCS+= sc.c sd.c +SRCS+= ufs_disksubr.c + +# netboot support +SRCS+= if_le.c lance.c getsecs.c +SRCS+= dev_net.c + +PROG= boot + +NEWVERSWHAT= "${PROG}" + +### find out what to use for libkern +.PATH: ${S}/lib/libkern +SRCS+= memcpy.c strlen.c +SRCS+= muldi3.c negdi2.c ashrdi3.c + +### find out what to use for libsa +SAREL= +USE_LOADFILE= yes +.include "${S}/lib/libsa/Makefile.inc" + +LIBS= ${SALIB} ${ZLIB} ${KERNLIB} + +${PROG}: ${LDSCRIPT} ${OBJS} ${LIBS} + ${LD} ${LINKFORMAT} -x -o ${PROG}.elf ${OBJS} ${LIBS} + ${OBJCOPY} -S -O a.out-m88k-openbsd --impure ${PROG}.elf ${PROG} + +CLEANFILES+= ${PROG}.elf + +plop: + echo ${OBJS} + +cleandir distclean: cleanlibdir + +cleanlibdir: + -rm -rf lib + +.if ${MACHINE} != "luna88k" +.if !make(obj) +.BEGIN: + @([ -h machine ] || ln -s ${.CURDIR}/../../include machine) + @([ -h m88k ] || ln -s ${.CURDIR}/../../../m88k/include m88k) +.endif +.endif + +.include <bsd.prog.mk> diff --git a/sys/arch/luna88k/stand/boot/autoconf.c b/sys/arch/luna88k/stand/boot/autoconf.c new file mode 100644 index 00000000000..93223a5a2e3 --- /dev/null +++ b/sys/arch/luna88k/stand/boot/autoconf.c @@ -0,0 +1,463 @@ +/* $OpenBSD: autoconf.c,v 1.1 2013/10/28 22:13:12 miod Exp $ */ +/* $NetBSD: autoconf.c,v 1.7 2013/01/22 15:48:40 tsutsui Exp $ */ + +/* + * Copyright (c) 1992 OMRON Corporation. + * + * This code is derived from software contributed to Berkeley by + * OMRON Corporation. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)autoconf.c 8.1 (Berkeley) 6/10/93 + */ +/* + * Copyright (c) 1992, 1993 + * The Regents of the University of California. All rights reserved. + * + * This code is derived from software contributed to Berkeley by + * OMRON Corporation. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)autoconf.c 8.1 (Berkeley) 6/10/93 + */ + +/* + * autoconf.c -- Determine mass storage and memory configuration for a machine. + * by A.Fujita, NOV-30-1991 + * + * Modified by A.Fujita, FEB-04-1992 + */ + + +#include <sys/param.h> +#include <machine/board.h> +#include <lib/libkern/libkern.h> +#include <luna88k/stand/boot/samachdep.h> +#include <luna88k/stand/boot/device.h> + +struct hp_hw sc_table[MAX_CTLR]; + +#ifdef DEBUG +int acdebug = 1; +#endif + +static int find_controller(struct hp_hw *); +static int find_device(struct hp_hw *); +static void find_slaves(struct hp_ctlr *); +static int same_hw_device(struct hp_hw *, struct hp_device *); + +/* + * Determine mass storage and memory configuration for a machine. + */ +void +configure(void) +{ + struct hp_hw *hw; + int found; + + /* + * Look over each hardware device actually found and attempt + * to match it with an ioconf.c table entry. + */ + for (hw = sc_table; hw->hw_type; hw++) { + if (hw->hw_type & CONTROLLER) + found = find_controller(hw); + else + found = find_device(hw); +#ifdef DEBUG + if (!found) { + printf("unconfigured %s ", hw->hw_name); + printf("at 0x%x\n", (u_int)hw->hw_addr); + } +#endif + } + +} + +#define dr_type(d, s) \ + (strcmp((d)->d_name, (s)) == 0) + +#define same_hw_ctlr(hw, hc) \ + ((hw)->hw_type == SCSI && dr_type((hc)->hp_driver, "sc")) + +int +find_controller(struct hp_hw *hw) +{ + struct hp_ctlr *hc; + struct hp_ctlr *match_c; + uint8_t *addr, *oaddr; + +#ifdef DEBUG + if (acdebug) + printf("find_controller: hw: %s at %p, type %x...", + hw->hw_name, hw->hw_addr, hw->hw_type); +#endif + addr = hw->hw_addr; + match_c = NULL; + for (hc = hp_cinit; hc->hp_driver; hc++) { + if (hc->hp_alive) + continue; + /* + * Make sure we are looking at the right + * controller type. + */ + if (!same_hw_ctlr(hw, hc)) + continue; + /* + * Exact match; all done + */ + if (hc->hp_addr == addr) { + match_c = hc; + break; + } + /* + * Wildcard; possible match so remember first instance + * but continue looking for exact match. + */ + if ((int)hc->hp_addr == WILD_CARD_CTLR && match_c == NULL) + match_c = hc; + } +#ifdef DEBUG + if (acdebug) { + if (match_c) + printf("found %s%d\n", + match_c->hp_driver->d_name, + match_c->hp_unit); + else + printf("not found\n"); + } +#endif + /* + * Didn't find an ioconf entry for this piece of hardware, + * just ignore it. + */ + if (match_c == NULL) + return(0); + /* + * Found a match, attempt to initialize and configure all attached + * slaves. Note, we can still fail if HW won't initialize. + */ + hc = match_c; + oaddr = hc->hp_addr; + hc->hp_addr = hw->hw_addr; + if ((*hc->hp_driver->d_init)(hc)) { + hc->hp_alive = 1; + printf("%s%d", hc->hp_driver->d_name, hc->hp_unit); + printf(" at %p,", hc->hp_addr); + if (hc->hp_flags) + printf(" flags 0x%x", hc->hp_flags); + printf("\n"); + find_slaves(hc); + } else + hc->hp_addr = oaddr; + return(1); +} + +int +find_device(struct hp_hw *hw) +{ + struct hp_device *hd; + struct hp_device *match_d; + uint8_t *addr, *oaddr; + +#ifdef DEBUG + if (acdebug) + printf("find_device: hw: %s at %p, type %x...", + hw->hw_name, hw->hw_addr, hw->hw_type); +#endif + match_d = NULL; + for (hd = hp_dinit; hd->hp_driver; hd++) { + if (hd->hp_alive) + continue; + /* Must not be a slave */ + if (hd->hp_cdriver) + continue; + addr = hd->hp_addr; + /* + * Exact match; all done. + */ + if (addr != NULL && addr == hw->hw_addr) { + match_d = hd; + break; + } + /* + * Wildcard; possible match so remember first instance + * but continue looking for exact match. + */ + if (addr == NULL && same_hw_device(hw, hd) && match_d == NULL) + match_d = hd; + } +#ifdef DEBUG + if (acdebug) { + if (match_d) + printf("found %s%d\n", + match_d->hp_driver->d_name, + match_d->hp_unit); + else + printf("not found\n"); + } +#endif + /* + * Didn't find an ioconf entry for this piece + * of hardware, just ignore it. + */ + if (match_d == NULL) + return(0); + /* + * Found a match, attempt to initialize. + * Note, we can still fail if HW won't initialize. + */ + hd = match_d; + oaddr = hd->hp_addr; + hd->hp_addr = hw->hw_addr; + if ((*hd->hp_driver->d_init)(hd)) { + hd->hp_alive = 1; + printf("%s%d", hd->hp_driver->d_name, hd->hp_unit); + printf(" at %p", hd->hp_addr); + if (hd->hp_flags) + printf(", flags 0x%x", hd->hp_flags); + printf("\n"); + } else + hd->hp_addr = oaddr; + return(1); +} + +/* + * Search each BUS controller found for slaves attached to it. + * The bad news is that we don't know how to uniquely identify all slaves + * (e.g. PPI devices on HP-IB). The good news is that we can at least + * differentiate those from slaves we can identify. At worst (a totally + * wildcarded entry) this will cause us to locate such a slave at the first + * unused position instead of where it really is. To save grief, non- + * identifing devices should always be fully qualified. + */ +void +find_slaves(struct hp_ctlr *hc) +{ + int s; + struct hp_device *hd; + struct hp_device *match_s; + int maxslaves = MAXSLAVES-1; + int new_s, new_c, old_s, old_c; + +#ifdef DEBUG + if (acdebug) + printf("find_slaves: for %s%d\n", + hc->hp_driver->d_name, hc->hp_unit); +#endif + new_s = new_c = -1; + for (s = 0; s < maxslaves; s++) { + match_s = NULL; + for (hd = hp_dinit; hd->hp_driver; hd++) { + /* + * Rule out the easy ones: + * 1. slave already assigned or not a slave + * 2. not of the proper type + * 3. controller specified but not this one + * 4. slave specified but not this one + */ + if (hd->hp_alive || hd->hp_cdriver == NULL) + continue; + if (!dr_type(hc->hp_driver, hd->hp_cdriver->d_name)) + continue; + if (hd->hp_ctlr >= 0 && hd->hp_ctlr != hc->hp_unit) + continue; + if (hd->hp_slave >= 0 && hd->hp_slave != s) + continue; + /* + * Case 0: first possible match. + * Remember it and keep looking for better. + */ + if (match_s == NULL) { + match_s = hd; + new_c = hc->hp_unit; + new_s = s; + continue; + } + /* + * Case 1: exact match. + * All done. Note that we do not attempt any other + * matches if this one fails. This allows us to + * "reserve" locations for dynamic addition of + * disk/tape drives by fully qualifing the location. + */ + if (hd->hp_slave == s && hd->hp_ctlr == hc->hp_unit) { + match_s = hd; + break; + } + /* + * Case 2: right controller, wildcarded slave. + * Remember first and keep looking for an exact match. + */ + if (hd->hp_ctlr == hc->hp_unit && + match_s->hp_ctlr < 0) { + match_s = hd; + new_s = s; + continue; + } + /* + * Case 3: right slave, wildcarded controller. + * Remember and keep looking for a better match. + */ + if (hd->hp_slave == s && + match_s->hp_ctlr < 0 && match_s->hp_slave < 0) { + match_s = hd; + new_c = hc->hp_unit; + continue; + } + /* + * OW: we had a totally wildcarded spec. + * If we got this far, we have found a possible + * match already (match_s != NULL) so there is no + * reason to remember this one. + */ + continue; + } + /* + * Found a match. We need to set hp_ctlr/hp_slave properly + * for the init routines but we also need to remember all + * the old values in case this doesn't pan out. + */ + if (match_s) { + hd = match_s; + old_c = hd->hp_ctlr; + old_s = hd->hp_slave; + if (hd->hp_ctlr < 0) + hd->hp_ctlr = new_c; + if (hd->hp_slave < 0) + hd->hp_slave = new_s; +#ifdef DEBUG + if (acdebug) + printf("looking for %s%d at slave %d...", + hd->hp_driver->d_name, + hd->hp_unit, hd->hp_slave); +#endif + + if ((*hd->hp_driver->d_init)(hd)) { +#ifdef DEBUG + if (acdebug) + printf("found\n"); +#endif + printf("%s%d at %s%d, slave %d", + hd->hp_driver->d_name, hd->hp_unit, + hc->hp_driver->d_name, hd->hp_ctlr, + hd->hp_slave); + if (hd->hp_flags) + printf(" flags 0x%x", hd->hp_flags); + printf("\n"); + hd->hp_alive = 1; + } else { +#ifdef DEBUG + if (acdebug) + printf("not found\n"); +#endif + hd->hp_ctlr = old_c; + hd->hp_slave = old_s; + } + } + /* + * Reset bogon alive fields prior to attempting next slave + */ + for (hd = hp_dinit; hd->hp_driver; hd++) + if (hd->hp_alive == -1) + hd->hp_alive = 0; + } +} + +int +same_hw_device(struct hp_hw *hw, struct hp_device *hd) +{ + int found = 0; + + switch (hw->hw_type) { + case NET: + found = dr_type(hd->hp_driver, "le"); + break; + case SCSI: + found = dr_type(hd->hp_driver, "scsi"); + break; + case VME: + case MISC: + break; + } + return(found); +} + +#define setup_hw(hw, addr, type, name) \ + (hw)->hw_addr = addr; \ + (hw)->hw_type = type; \ + (hw)->hw_name = name + +void +find_devs(void) +{ + struct hp_hw *hw = sc_table; + + setup_hw(hw, (uint8_t *)0x51000000, SIO, "uPD7201A (SIO)"); + hw++; + + setup_hw(hw, (uint8_t *)0x51000004, KEYBOARD, "uPD7201A (KBD)"); + hw++; + + setup_hw(hw, (uint8_t *)0xe1000000, SCSI, "MB89352 (SPC)"); + hw++; + + if (machtype == LUNA_88K2 && badaddr((void *)0xe1000040, 4) == 0) { + setup_hw(hw, (uint8_t *)0xe1000040, SCSI, "MB89352 (SPC)"); + hw++; + } + if (badaddr((void *)0xf1000000, 4) == 0) { + setup_hw(hw, (uint8_t *)0xf1000000, NET, "Am7990 (LANCE)"); + hw++; + } +} diff --git a/sys/arch/luna88k/stand/boot/awaitkey.c b/sys/arch/luna88k/stand/boot/awaitkey.c new file mode 100644 index 00000000000..82bb5d4ba90 --- /dev/null +++ b/sys/arch/luna88k/stand/boot/awaitkey.c @@ -0,0 +1,87 @@ +/* $OpenBSD: awaitkey.c,v 1.1 2013/10/28 22:13:12 miod Exp $ */ +/* $NetBSD: awaitkey.c,v 1.1 2013/01/21 11:58:12 tsutsui Exp $ */ + +/*- + * Copyright (c) 2013 Izumi Tsutsui. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include <lib/libkern/libkern.h> +#include <luna88k/stand/boot/samachdep.h> + +static void print_countdown(const char *, int); + +#define FMTLEN 40 + +static void +print_countdown(const char *pfmt, int n) +{ + int len, i; + char fmtbuf[FMTLEN]; + + len = snprintf(fmtbuf, FMTLEN, pfmt, n); + printf("%s", fmtbuf); + for (i = 0; i < len; i++) + putchar('\b'); +} + +/* + * awaitkey(const char *pfmt, int timeout, int tell) + * + * Wait timeout seconds until any input from stdin. + * print countdown message using "pfmt" if tell is nonzero. + * Requires tgetchar(), which returns 0 if there is no input. + */ +char +awaitkey(const char *pfmt, int timeout, int tell) +{ + uint32_t otick; + char c = 0; + + if (timeout <= 0) + goto out; + + if (tell) + print_countdown(pfmt, timeout); + + otick = getsecs(); + + for (;;) { + c = tgetchar(); + if (c != 0) + break; + if (getsecs() != otick) { + otick = getsecs(); + if (--timeout == 0) + break; + if (tell) + print_countdown(pfmt, timeout); + } + } + + out: + if (tell) { + printf(pfmt, 0); + printf("\n"); + } + return c; +} diff --git a/sys/arch/luna88k/stand/boot/bcd.c b/sys/arch/luna88k/stand/boot/bcd.c new file mode 100644 index 00000000000..3cdc8d8ff84 --- /dev/null +++ b/sys/arch/luna88k/stand/boot/bcd.c @@ -0,0 +1,23 @@ +/* $OpenBSD: bcd.c,v 1.1 2013/10/28 22:13:12 miod Exp $ */ +/* $NetBSD: bcd.c,v 1.1 2006/03/11 15:40:07 kleink Exp $ */ + +/* + * Convert a single byte between (unsigned) packed bcd and binary. + * Public domain. + */ + +#include <lib/libkern/libkern.h> + +unsigned int +bcdtobin(unsigned int bcd) +{ + + return (((bcd >> 4) & 0x0f) * 10 + (bcd & 0x0f)); +} + +unsigned int +bintobcd(unsigned int bin) +{ + + return ((((bin / 10) << 4) & 0xf0) | (bin % 10)); +} diff --git a/sys/arch/luna88k/stand/boot/bmc.c b/sys/arch/luna88k/stand/boot/bmc.c new file mode 100644 index 00000000000..f499095a106 --- /dev/null +++ b/sys/arch/luna88k/stand/boot/bmc.c @@ -0,0 +1,137 @@ +/* $OpenBSD: bmc.c,v 1.1 2013/10/28 22:13:12 miod Exp $ */ +/* $NetBSD: bmc.c,v 1.4 2013/01/21 11:58:12 tsutsui Exp $ */ + +/* + * Copyright (c) 1992 OMRON Corporation. + * + * This code is derived from software contributed to Berkeley by + * OMRON Corporation. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)bmc.c 8.1 (Berkeley) 6/10/93 + */ +/* + * Copyright (c) 1992, 1993 + * The Regents of the University of California. All rights reserved. + * + * This code is derived from software contributed to Berkeley by + * OMRON Corporation. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)bmc.c 8.1 (Berkeley) 6/10/93 + */ + +/* + * bmc.c -- bitmap console driver + * by A.Fujita, JUL-06-1992 + */ + +#include <sys/param.h> +#include <luna88k/stand/boot/samachdep.h> +#include <luna88k/stand/boot/rcvbuf.h> + +/* + * Following are all routines needed for SIO to act as console + */ +#include <dev/cons.h> + +void +bmccnprobe(struct consdev *cp) +{ + /* serial console enabled? */ + if ((dipswitch & 0x4000) == 0) { + cp->cn_pri = CN_DEAD; + return; + } + + /* frame buffer missing? */ + if (nplane == 0) { + cp->cn_pri = CN_DEAD; + return; + } + + /* initialize required fields */ + cp->cn_dev = 1; + cp->cn_pri = CN_LOWPRI; +} + +void +bmccninit(struct consdev *cp) +{ + sioinit(); + bmdinit(); +} + +int +bmccngetc(dev_t dev) +{ + int c; + int unit = 1; + + _siointr(); + if (RBUF_EMPTY(unit)) + return 0; + + POP_RBUF(unit, c); + + return(c); +/* + return(siocngetc(dev)); + */ +} + +void +bmccnputc(dev_t dev, int c) +{ + bmdputc(c); +} diff --git a/sys/arch/luna88k/stand/boot/bmd.c b/sys/arch/luna88k/stand/boot/bmd.c new file mode 100644 index 00000000000..cec93aab104 --- /dev/null +++ b/sys/arch/luna88k/stand/boot/bmd.c @@ -0,0 +1,662 @@ +/* $OpenBSD: bmd.c,v 1.1 2013/10/28 22:13:12 miod Exp $ */ +/* $NetBSD: bmd.c,v 1.2 2013/01/20 13:35:43 tsutsui Exp $ */ + +/* + * Copyright (c) 1992 OMRON Corporation. + * + * This code is derived from software contributed to Berkeley by + * OMRON Corporation. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)bmd.c 8.2 (Berkeley) 8/15/93 + */ +/* + * Copyright (c) 1992, 1993 + * The Regents of the University of California. All rights reserved. + * + * This code is derived from software contributed to Berkeley by + * OMRON Corporation. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)bmd.c 8.2 (Berkeley) 8/15/93 + */ +/* + + * bmd.c --- Bitmap-Display raw-level driver routines + * + * by A.Fujita, SEP-09-1992 + */ + + +#include <sys/param.h> +#include <luna88k/stand/boot/samachdep.h> + +#define isprint(c) ( c < 0x20 ? 0 : 1) + +/* + * RFCNT register + */ + +union bmd_rfcnt { + struct { + short rfc_hcnt; + short rfc_vcnt; + } p; + uint32_t u; +}; + + +/* + * Width & Hight + */ + +#define PB_WIDTH 2048 /* Plane Width (Bit) */ +#define PB_HIGHT 1024 /* Plane Hight (Bit) */ +#define PS_WIDTH 128 /* Plane Width (short) */ +#define P_WIDTH 256 /* Plane Width (Byte) */ + +#define SB_WIDTH 1280 /* Screen Width (Bit) */ +#define SB_HIGHT 1024 /* Screen Hight (Bit) */ +#define SS_WIDTH 80 /* Screen Width (short) */ +#define S_WIDTH 160 /* Screen Width (Byte) */ + +#define FB_WIDTH 12 /* Font Width (Bit) */ +#define FB_HIGHT 20 /* Font Hight (Bit) */ + + +#define NEXT_LINE(addr) ( addr + (PS_WIDTH * FB_HIGHT) ) +#define SKIP_NEXT_LINE(addr) ( addr += (PS_WIDTH - SS_WIDTH) ) + + +void bmd_add_new_line(void); + +void bmd_draw_char(char *, char *, int, int, int); +void bmd_reverse_char(char *, char *, int, int); +void bmd_erase_char(char *, char *, int, int); +void bmd_erase_screen(volatile u_short *); +void bmd_scroll_screen(volatile u_short *, volatile u_short *, + int, int, int, int); + + +struct bmd_linec { + struct bmd_linec *bl_next; + struct bmd_linec *bl_prev; + int bl_col; + int bl_end; + u_char bl_line[128]; +}; + +struct bmd_softc { + int bc_stat; + char *bc_raddr; + char *bc_waddr; + int bc_xmin; + int bc_xmax; + int bc_ymin; + int bc_ymax; + int bc_col; + int bc_row; + struct bmd_linec *bc_bl; + char bc_escseq[8]; + char *bc_esc; + void (*bc_escape)(int); +}; + +#define STAT_NORMAL 0x0000 +#define STAT_ESCAPE 0x0001 +#define STAT_INSERT 0x0100 + +struct bmd_softc bmd_softc; +struct bmd_linec bmd_linec[52]; + +void bmd_escape(int); +void bmd_escape_0(int); +void bmd_escape_1(int); + + +/* + * Escape-Sequence + */ + +void +bmd_escape(int c) +{ + struct bmd_softc *bp = &bmd_softc; + + switch (c) { + + case '[': + bp->bc_escape = bmd_escape_0; + break; + + default: + bp->bc_stat &= ~STAT_ESCAPE; + bp->bc_esc = &bp->bc_escseq[0]; + bp->bc_escape = bmd_escape; + break; + } +} + +void +bmd_escape_0(int c) +{ + struct bmd_softc *bp = &bmd_softc; + struct bmd_linec *bq = bp->bc_bl; + + switch (c) { + + case 'A': + if (bp->bc_row > bp->bc_ymin) { + bp->bc_row--; + } + break; + + case 'C': + if (bq->bl_col < bp->bc_xmax - 1) { + bq->bl_col++; + } + break; + + case 'K': + if (bq->bl_col < bp->bc_xmax) { + int col; + for (col = bq->bl_col; col < bp->bc_xmax; col++) + bmd_erase_char(bp->bc_raddr, + bp->bc_waddr, + col, bp->bc_row); + } + bq->bl_end = bq->bl_col; + break; + + case 'H': + bq->bl_col = bq->bl_end = bp->bc_xmin; + bp->bc_row = bp->bc_ymin; + break; + + default: +/* + *bp->bc_esc++ = c; + bp->bc_escape = bmd_escape_1; + return; + */ + break; + } + + bp->bc_stat &= ~STAT_ESCAPE; + bp->bc_esc = &bp->bc_escseq[0]; + bp->bc_escape = bmd_escape; +} + +void +bmd_escape_1(int c) +{ + struct bmd_softc *bp = &bmd_softc; + struct bmd_linec *bq = bp->bc_bl; + int col = 0, row = 0; + char *p; + + switch (c) { + + case 'J': + bp->bc_stat &= ~STAT_ESCAPE; + bp->bc_esc = &bp->bc_escseq[0]; + bp->bc_escape = bmd_escape; + break; + + case 'H': + for (p = &bp->bc_escseq[0]; *p != ';'; p++) + row = (row * 10) + (*p - 0x30); + p++; + for (p = &bp->bc_escseq[0]; p != bp->bc_esc; p++) + col = (col * 10) + (*p - 0x30); + + bq->bl_col = col + bp->bc_xmin; + bp->bc_row = row + bp->bc_ymin; + + bp->bc_stat &= ~STAT_ESCAPE; + bp->bc_esc = &bp->bc_escseq[0]; + bp->bc_escape = bmd_escape; + break; + + default: + *bp->bc_esc++ = c; + break; + } +} + + +/* + * Entry Routine + */ + +void +bmdinit(void) +{ + volatile uint32_t *bmd_rfcnt = (uint32_t *) 0xB1000000; + volatile long *bmd_bmsel = (long *)0xB1040000; + struct bmd_softc *bp = &bmd_softc; + struct bmd_linec *bq; + int i; + union bmd_rfcnt rfcnt; + + /* + * adjust plane position + */ + + bp->bc_raddr = (char *) 0xB10C0008; /* plane-0 hardware address */ + bp->bc_waddr = (char *) 0xB1080008; /* common bitmap hardware address */ + rfcnt.p.rfc_hcnt = 7; /* shift left 16 dot */ + rfcnt.p.rfc_vcnt = -27; /* shift down 1 dot */ + *bmd_rfcnt = rfcnt.u; + + bp->bc_stat = STAT_NORMAL; + + bp->bc_xmin = 8; + bp->bc_xmax = 96; + bp->bc_ymin = 2; + bp->bc_ymax = 48; + + bp->bc_row = bp->bc_ymin; + + for (i = bp->bc_ymin; i < bp->bc_ymax; i++) { + bmd_linec[i].bl_next = &bmd_linec[i+1]; + bmd_linec[i].bl_prev = &bmd_linec[i-1]; + } + bmd_linec[bp->bc_ymax-1].bl_next = &bmd_linec[bp->bc_ymin]; + bmd_linec[bp->bc_ymin].bl_prev = &bmd_linec[bp->bc_ymax-1]; + + bq = bp->bc_bl = &bmd_linec[bp->bc_ymin]; + bq->bl_col = bq->bl_end = bp->bc_xmin; + + bp->bc_col = bp->bc_xmin; + + bp->bc_esc = &bp->bc_escseq[0]; + bp->bc_escape = bmd_escape; + + *bmd_bmsel = 0xff; /* all planes */ + bmd_erase_screen((u_short *) bp->bc_waddr); /* clear screen */ + *bmd_bmsel = 0x01; /* 1 plane */ + + /* turn on cursole */ + bmd_reverse_char(bp->bc_raddr, + bp->bc_waddr, + bq->bl_col, bp->bc_row); +} + +void +bmdadjust(short hcnt, short vcnt) +{ + volatile uint32_t *bmd_rfcnt = (uint32_t *) 0xB1000000; + union bmd_rfcnt rfcnt; + + printf("bmdadjust: hcnt = %d, vcnt = %d\n", hcnt, vcnt); + + rfcnt.p.rfc_hcnt = hcnt; /* shift left 16 dot */ + rfcnt.p.rfc_vcnt = vcnt; /* shift down 1 dot */ + + *bmd_rfcnt = rfcnt.u; +} + +int +bmdputc(int c) +{ + struct bmd_softc *bp = &bmd_softc; + struct bmd_linec *bq = bp->bc_bl; + int i; + + c &= 0x7F; + /* turn off cursole */ + bmd_reverse_char(bp->bc_raddr, + bp->bc_waddr, + bq->bl_col, bp->bc_row); + /* do escape-sequence */ + if (bp->bc_stat & STAT_ESCAPE) { + *bp->bc_esc++ = c; + (*bp->bc_escape)(c); + goto done; + } + + if (isprint(c)) { + bmd_draw_char(bp->bc_raddr, bp->bc_waddr, + bq->bl_col, bp->bc_row, c); + bq->bl_col++; + bq->bl_end++; + if (bq->bl_col >= bp->bc_xmax) { + bq->bl_col = bq->bl_end = bp->bc_xmin; + bp->bc_row++; + if (bp->bc_row >= bp->bc_ymax) { + bmd_scroll_screen((u_short *) bp->bc_raddr, + (u_short *) bp->bc_waddr, + bp->bc_xmin, bp->bc_xmax, + bp->bc_ymin, bp->bc_ymax); + + bp->bc_row = bp->bc_ymax - 1; + } + } + } else { + switch (c) { + case 0x08: /* BS */ + if (bq->bl_col > bp->bc_xmin) { + bq->bl_col--; + } + break; + + case 0x09: /* HT */ + case 0x0B: /* VT */ + i = ((bq->bl_col / 8) + 1) * 8; + if (i < bp->bc_xmax) { + bq->bl_col = bq->bl_end = i; + } + break; + + case 0x0A: /* NL */ + bp->bc_row++; + if (bp->bc_row >= bp->bc_ymax) { + bmd_scroll_screen((u_short *) bp->bc_raddr, + (u_short *) bp->bc_waddr, + bp->bc_xmin, bp->bc_xmax, + bp->bc_ymin, bp->bc_ymax); + + bp->bc_row = bp->bc_ymax - 1; + } + break; + + case 0x0D: /* CR */ + bq->bl_col = bp->bc_xmin; + break; + + case 0x1b: /* ESC */ + bp->bc_stat |= STAT_ESCAPE; + *bp->bc_esc++ = 0x1b; + break; + + case 0x7F: /* DEL */ + if (bq->bl_col > bp->bc_xmin) { + bq->bl_col--; + bmd_erase_char(bp->bc_raddr, + bp->bc_waddr, + bq->bl_col, bp->bc_row); + } + break; + + default: + break; + } + } + + done: + /* turn on cursole */ + bmd_reverse_char(bp->bc_raddr, + bp->bc_waddr, + bq->bl_col, bp->bc_row); + + return(c); +} + +void +bmdclear(void) +{ + struct bmd_softc *bp = &bmd_softc; + struct bmd_linec *bq = bp->bc_bl; + + bmd_erase_screen((u_short *) bp->bc_waddr); /* clear screen */ + + bq->bl_col = bq->bl_end = bp->bc_xmin; + bp->bc_row = bp->bc_ymin; + + bmd_reverse_char(bp->bc_raddr, + bp->bc_waddr, + bq->bl_col, bp->bc_row); /* turn on cursole */ +} + + +/* + * + */ + +void +bmd_add_new_line(void) +{ +} + + +/* + * charactor operation routines + */ + +void +bmd_draw_char(char *raddr, char *waddr, int col, int row, int c) +{ + volatile u_short *p, *q, *fp; + volatile u_short *lp, *lq; + int i; + + fp = &bmdfont[c][0]; + + switch (col % 4) { + + case 0: + p = (u_short *) ( raddr + (( row * FB_HIGHT ) << 8 ) + (( col / 4 ) * 6 )); + q = (u_short *) ( waddr + (( row * FB_HIGHT ) << 8 ) + (( col / 4 ) * 6 )); + for (i = 0; i < FB_HIGHT; i++) { + *q = (*p & 0x000F) | (*fp & 0xFFF0); + p += 128; + q += 128; + fp++; + } + break; + + case 1: + lp = (u_short *) ( raddr + (( row * FB_HIGHT ) << 8 ) + (( col / 4 ) * 6 )); + lq = (u_short *) ( waddr + (( row * FB_HIGHT ) << 8 ) + (( col / 4 ) * 6 )); + for (i = 0; i < FB_HIGHT; i++) { +#if 0 + *lq = (*lp & 0xFFF000FF) | ((u_long)(*fp & 0xFFF0) << 4); +#else + lq[0] = (lp[0] & 0xFFF0) | ((*fp & 0xF000) >> 12); + lq[1] = (lp[1] & 0x00FF) | ((*fp & 0x0FF0) << 4); +#endif + lp += 128; + lq += 128; + fp++; + } + break; + + case 2: + lp = (u_short *) ( raddr + (( row * FB_HIGHT ) << 8 ) + (( col / 4 ) * 6 ) + 2 ); + lq = (u_short *) ( waddr + (( row * FB_HIGHT ) << 8 ) + (( col / 4 ) * 6 ) + 2 ); + for (i = 0; i < FB_HIGHT; i++) { +#if 0 + *lq = (*lp & 0xFF000FFF) | ((u_long)(*fp & 0xFFF0) << 8); +#else + lq[0] = (lp[0] & 0xFF00) | ((*fp & 0xFF00) >> 8); + lq[1] = (lp[1] & 0x0FFF) | ((*fp & 0x00F0) << 8); +#endif + lp += 128; + lq += 128; + fp++; + } + break; + + case 3: + p = (u_short *) ( raddr + (( row * FB_HIGHT ) << 8 ) + (( col / 4 ) * 6 ) + 4 ); + q = (u_short *) ( waddr + (( row * FB_HIGHT ) << 8 ) + (( col / 4 ) * 6 ) + 4 ); + for (i = 0; i < FB_HIGHT; i++) { + *q = (*p & 0xF000) | ((*fp & 0xFFF0) >> 4); + p += 128; + q += 128; + fp++; + } + break; + + default: + break; + } +} + +void +bmd_reverse_char(char *raddr, char *waddr, int col, int row) +{ + volatile u_short *p, *q; + volatile u_short *lp, *lq; + int i; + + switch (col%4) { + + case 0: + p = (u_short *) ( raddr + (( row * FB_HIGHT ) << 8 ) + (( col / 4 ) * 6 )); + q = (u_short *) ( waddr + (( row * FB_HIGHT ) << 8 ) + (( col / 4 ) * 6 )); + for (i = 0; i < FB_HIGHT; i++) { + *q = (*p & 0x000F) | (~(*p) & 0xFFF0); + p += 128; + q += 128; + } + break; + + case 1: + lp = (u_short *) ( raddr + (( row * FB_HIGHT ) << 8 ) + (( col / 4 ) * 6 )); + lq = (u_short *) ( waddr + (( row * FB_HIGHT ) << 8 ) + (( col / 4 ) * 6 )); + for (i = 0; i < FB_HIGHT; i++) { +#if 0 + *lq = (*lp & 0xFFF000FF) | (~(*lp) & 0x000FFF00); +#else + lq[0] = (lp[0] & 0xFFF0) | (~lp[0] & 0x000F); + lq[1] = (lp[1] & 0x00FF) | (~lp[1] & 0xFF00); +#endif + lp += 128; + lq += 128; + } + break; + + case 2: + lp = (u_short *) ( raddr + (( row * FB_HIGHT ) << 8 ) + (( col / 4 ) * 6 ) + 2 ); + lq = (u_short *) ( waddr + (( row * FB_HIGHT ) << 8 ) + (( col / 4 ) * 6 ) + 2 ); + for (i = 0; i < FB_HIGHT; i++) { +#if 0 + *lq = (*lp & 0xFF000FFF) | (~(*lp) & 0x00FFF000); +#else + lq[0] = (lp[0] & 0xFF00) | (~lp[0] & 0x00FF); + lq[1] = (lp[1] & 0x0FFF) | (~lp[1] & 0xF000); +#endif + lp += 128; + lq += 128; + } + break; + + case 3: + p = (u_short *) ( raddr + (( row * FB_HIGHT ) << 8 ) + (( col / 4 ) * 6 ) + 4 ); + q = (u_short *) ( waddr + (( row * FB_HIGHT ) << 8 ) + (( col / 4 ) * 6 ) + 4 ); + for (i = 0; i < FB_HIGHT; i++) { + *q = (*p & 0xF000) | (~(*p) & 0x0FFF); + p += 128; + q += 128; + } + break; + + default: + break; + } +} + +void +bmd_erase_char(char *raddr, char *waddr, int col, int row) +{ + bmd_draw_char(raddr, waddr, col, row, 0); + + return; +} + + +/* + * screen operation routines + */ + +void +bmd_erase_screen(volatile u_short *lp) +{ + int i, j; + + for (i = 0; i < SB_HIGHT; i++) { + for (j = 0; j < SS_WIDTH; j++) + *lp++ = 0; + SKIP_NEXT_LINE(lp); + } + + return; +} + +void +bmd_scroll_screen(volatile u_short *lp, volatile u_short *lq, + int xmin, int xmax, int ymin, int ymax) +{ + int i, j; + + lp += ((PS_WIDTH * FB_HIGHT) * (ymin + 1)); + lq += ((PS_WIDTH * FB_HIGHT) * ymin); + + for (i = 0; i < ((ymax - ymin -1) * FB_HIGHT); i++) { + for (j = 0; j < SS_WIDTH; j++) { + *lq++ = *lp++; + } + lp += (PS_WIDTH - SS_WIDTH); + lq += (PS_WIDTH - SS_WIDTH); + } + + for (i = 0; i < FB_HIGHT; i++) { + for (j = 0; j < SS_WIDTH; j++) { + *lq++ = 0; + } + lq += (PS_WIDTH - SS_WIDTH); + } + +} diff --git a/sys/arch/luna88k/stand/boot/boot.c b/sys/arch/luna88k/stand/boot/boot.c new file mode 100644 index 00000000000..cd6cb3ba650 --- /dev/null +++ b/sys/arch/luna88k/stand/boot/boot.c @@ -0,0 +1,176 @@ +/* $OpenBSD: boot.c,v 1.1 2013/10/28 22:13:12 miod Exp $ */ +/* $NetBSD: boot.c,v 1.3 2013/03/05 15:34:53 tsutsui Exp $ */ + +/* + * Copyright (c) 1992 OMRON Corporation. + * + * This code is derived from software contributed to Berkeley by + * OMRON Corporation. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)boot.c 8.1 (Berkeley) 6/10/93 + */ +/* + * Copyright (c) 1992, 1993 + * The Regents of the University of California. All rights reserved. + * + * This code is derived from software contributed to Berkeley by + * OMRON Corporation. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)boot.c 8.1 (Berkeley) 6/10/93 + */ + +/* + * boot.c -- boot program + * by A.Fujita, MAR-01-1992 + */ + +#include <sys/param.h> +#include <sys/reboot.h> +#include <sys/exec.h> +#include <luna88k/stand/boot/samachdep.h> +#include <luna88k/stand/boot/status.h> +#include <lib/libsa/loadfile.h> + +int howto; + +static int get_boot_device(const char *, int *, int *, int *); + +void (*cpu_boot)(uint32_t, uint32_t); +uint32_t cpu_bootarg1; +uint32_t cpu_bootarg2; + +int +get_boot_device(const char *s, int *devp, int *unitp, int *partp) +{ + const char *p = s; + int unit = 0, part = 0; + + while (*p != '(') { + if (*p == '\0') + goto error; + p++; + } + + while (*++p != ',') { + if (*p == '\0') + goto error; + if (*p >= '0' && *p <= '9') + unit = (unit * 10) + (*p - '0'); + } + + while (*++p != ')') { + if (*p == '\0') + goto error; + if (*p >= '0' && *p <= '9') + part = (part * 10) + (*p - '0'); + } + + *devp = 0; /* XXX not yet */ + *unitp = unit; /* XXX should pass SCSI ID, not logical unit number */ + *partp = part; + + return 0; + +error: + return -1; +} + +int +boot(int argc, char *argv[]) +{ + char *line; + + if (argc < 2) + line = default_file; + else + line = argv[1]; + + printf("Booting %s\n", line); + + return bootunix(line); +} + +int +bootunix(char *line) +{ + int io; + int dev, unit, part; + u_long marks[MARK_MAX]; + + if (get_boot_device(line, &dev, &unit, &part) != 0) { + printf("Bad file name %s\n", line); + return ST_ERROR; + } + + /* Note marks[MARK_START] is passed as an load address offset */ + memset(marks, 0, sizeof(marks)); + + io = loadfile(line, marks, LOAD_KERNEL); + if (io >= 0) { +#ifdef DEBUG + printf("entry = 0x%lx\n", marks[MARK_ENTRY]); + printf("ssym = 0x%lx\n", marks[MARK_SYM]); + printf("esym = 0x%lx\n", marks[MARK_END]); +#endif + + cpu_bootarg1 = BOOT_MAGIC; + cpu_bootarg2 = marks[MARK_END]; + cpu_boot = (void (*)(uint32_t, uint32_t))marks[MARK_ENTRY]; + (*cpu_boot)(cpu_bootarg1, cpu_bootarg2); + } + printf("Booting kernel failed. (%s)\n", strerror(errno)); + + return ST_ERROR; +} diff --git a/sys/arch/luna88k/stand/boot/boot.ldscript b/sys/arch/luna88k/stand/boot/boot.ldscript new file mode 100644 index 00000000000..291be9987d7 --- /dev/null +++ b/sys/arch/luna88k/stand/boot/boot.ldscript @@ -0,0 +1,51 @@ +/* $OpenBSD: boot.ldscript,v 1.1 2013/10/28 22:13:12 miod Exp $ */ + +/* + * Copyright (c) 2012 Miodrag Vallat. + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + +/* + * This linker script is used to merge .rodata into .text and pad .text to + * a page size. This allows objcopy to correctly be able to convert it to + * an OMAGIC binary, suitable to be booted from the PROM. + */ +OUTPUT_FORMAT("elf32-m88k") +OUTPUT_ARCH(m88k) +ENTRY(__start) +SECTIONS +{ + .text : + { + *(.text) + *(.rodata*) + PROVIDE(etext = ABSOLUTE(.)); + FILL(0xf4005800) + . = ALIGN(0x1000); + } + .data : + { + *(.data) + PROVIDE(edata = ABSOLUTE(.)); + } + .bss : + { + *(.bss) + } + PROVIDE(end = ABSOLUTE(.)); + /DISCARD/ : + { + *(.comment) + } +} diff --git a/sys/arch/luna88k/stand/boot/conf.c b/sys/arch/luna88k/stand/boot/conf.c new file mode 100644 index 00000000000..8fdf488d7af --- /dev/null +++ b/sys/arch/luna88k/stand/boot/conf.c @@ -0,0 +1,112 @@ +/* $OpenBSD: conf.c,v 1.1 2013/10/28 22:13:12 miod Exp $ */ +/* $NetBSD: conf.c,v 1.3 2013/01/16 15:46:20 tsutsui Exp $ */ + +/* + * Copyright (c) 1982, 1986, 1990, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)conf.c 8.1 (Berkeley) 6/10/93 + */ + +#include <sys/param.h> +#include <sys/socket.h> + +#include <net/if.h> +#include <netinet/in.h> +#include <netinet/in_systm.h> + +#include <luna88k/stand/boot/samachdep.h> +#include <lib/libsa/nfs.h> +#include <lib/libsa/ufs.h> +#include "dev_net.h" + +#define xxstrategy \ + (int (*)(void *, int, daddr32_t, size_t, void *, size_t *))nullsys +#define xxopen (int (*)(struct open_file *, ...))nodev +#define xxclose (int (*)(struct open_file *))nullsys + +/* + * Device configuration + */ +#ifndef SUPPORT_ETHERNET +#define netstrategy xxstrategy +#define netopen xxopen +#define netclose xxclose +#else +#define netstrategy net_strategy +#define netopen net_open +#define netclose net_close +#endif +#define netioctl noioctl + +#ifndef SUPPORT_DISK +#define sdstrategy xxstrategy +#define sdopen xxopen +#define sdclose xxclose +#endif +#define sdioctl noioctl + +/* + * Note: "le" isn't a major offset. + */ +struct devsw devsw[] = { + { "sd", sdstrategy, sdopen, sdclose, sdioctl }, + { "le", netstrategy, netopen, netclose, netioctl }, +}; +int ndevs = sizeof(devsw) / sizeof(devsw[0]); + +#ifdef SUPPORT_ETHERNET +extern struct netif_driver le_netif_driver; +struct netif_driver *netif_drivers[] = { + &le_netif_driver, +}; +int n_netif_drivers = sizeof(netif_drivers) / sizeof(netif_drivers[0]); +#endif + +/* + * Filesystem configuration + */ +#define FS_OPS(fs) { \ + __CONCAT(fs,_open), \ + __CONCAT(fs,_close), \ + __CONCAT(fs,_read), \ + __CONCAT(fs,_write), \ + __CONCAT(fs,_seek), \ + __CONCAT(fs,_stat) } +#ifdef SUPPORT_DISK +struct fs_ops file_system_disk[] = { + FS_OPS(ufs), +}; +int nfsys_disk = sizeof(file_system_disk) / sizeof(file_system_disk[0]); +#endif +#ifdef SUPPORT_ETHERNET +struct fs_ops file_system_nfs[] = { FS_OPS(nfs) }; +#endif + +#define MAX_NFSYS 5 +struct fs_ops file_system[MAX_NFSYS]; +int nfsys = 1; /* we always know which one we want */ diff --git a/sys/arch/luna88k/stand/boot/cons.c b/sys/arch/luna88k/stand/boot/cons.c new file mode 100644 index 00000000000..723d2352cf5 --- /dev/null +++ b/sys/arch/luna88k/stand/boot/cons.c @@ -0,0 +1,144 @@ +/* $OpenBSD: cons.c,v 1.1 2013/10/28 22:13:12 miod Exp $ */ +/* $NetBSD: cons.c,v 1.1 2013/01/05 17:44:24 tsutsui Exp $ */ + +/* + * Copyright (c) 1992 OMRON Corporation. + * + * This code is derived from software contributed to Berkeley by + * OMRON Corporation. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)cons.c 8.1 (Berkeley) 6/10/93 + */ +/* + * Copyright (c) 1992, 1993 + * The Regents of the University of California. All rights reserved. + * + * This code is derived from software contributed to Berkeley by + * OMRON Corporation. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)cons.c 8.1 (Berkeley) 6/10/93 + */ + +#include <sys/param.h> +#include <dev/cons.h> +#include <luna88k/stand/boot/samachdep.h> + +#define NBMC 1 +#define NSIO 1 +#define NROM 0 /* XXX doesn't work with framebuffer/keyboard? */ + +/* XXX - all this could be autoconfig()ed */ + +struct consdev constab[] = { +#if NBMC > 0 + { bmccnprobe, bmccninit, bmccngetc, bmccnputc }, +#endif +#if NSIO > 0 + { siocnprobe, siocninit, siocngetc, siocnputc }, +#endif +#if NROM > 0 + { romcnprobe, romcninit, romcngetc, romcnputc }, +#endif + { 0 }, +}; +/* end XXX */ + +struct consdev *cn_tab; /* physical console device info */ + +void +cninit(void) +{ + struct consdev *cp; + + /* + * Collect information about all possible consoles + * and find the one with highest priority + */ + for (cp = constab; cp->cn_probe; cp++) { + (*cp->cn_probe)(cp); + if (cp->cn_pri > CN_DEAD && + (cn_tab == NULL || cp->cn_pri > cn_tab->cn_pri)) + cn_tab = cp; + } + /* + * No console, we can handle it + */ + if ((cp = cn_tab) == NULL) + return; + /* + * Turn on console + */ + (*cp->cn_init)(cp); +} + +int +cngetc(void) +{ + if (cn_tab == NULL) + return(0); + return((*cn_tab->cn_getc)(cn_tab->cn_dev)); +} + +void +cnputc(int c) +{ + if (cn_tab == NULL) + return; + if (c) { + (*cn_tab->cn_putc)(cn_tab->cn_dev, c); + if (c == '\n') + (*cn_tab->cn_putc)(cn_tab->cn_dev, '\r'); + } +} diff --git a/sys/arch/luna88k/stand/boot/dev_net.c b/sys/arch/luna88k/stand/boot/dev_net.c new file mode 100644 index 00000000000..4014d72cf9e --- /dev/null +++ b/sys/arch/luna88k/stand/boot/dev_net.c @@ -0,0 +1,284 @@ +/* $OpenBSD: dev_net.c,v 1.1 2013/10/28 22:13:12 miod Exp $ */ +/* $NetBSD: dev_net.c,v 1.26 2011/07/17 20:54:52 joerg Exp $ */ + +/*- + * Copyright (c) 1997 The NetBSD Foundation, Inc. + * All rights reserved. + * + * This code is derived from software contributed to The NetBSD Foundation + * by Gordon W. Ross. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +/* + * This module implements a "raw device" interface suitable for + * use by the stand-alone I/O library NFS code. This interface + * does not support any "block" access, and exists only for the + * purpose of initializing the network interface, getting boot + * parameters, and performing the NFS mount. + * + * At open time, this does: + * + * find interface - netif_open() + * RARP for IP address - rarp_getipaddress() + * RPC/bootparams - callrpc(d, RPC_BOOTPARAMS, ...) + * RPC/mountd - nfs_mount(sock, ip, path) + * + * the root file handle from mountd is saved in a global + * for use by the NFS open code (NFS/lookup). + */ + +#include <sys/param.h> +#include <sys/socket.h> +#include <netinet/in.h> +#include <netinet/in_systm.h> + +#include <lib/libkern/libkern.h> + +#include <lib/libsa/stand.h> +#include <lib/libsa/net.h> +#include <lib/libsa/netif.h> +#include <lib/libsa/nfs.h> +#include <lib/libsa/bootparam.h> +#include "dev_net.h" +#ifdef SUPPORT_BOOTP +#include <lib/libsa/bootp.h> +#endif + +extern int nfs_root_node[]; /* XXX - get from nfs_mount() */ + +static int netdev_sock = -1; +static int netdev_opens; + +static int net_getparams(int); + +/* + * Called by devopen after it sets f->f_dev to our devsw entry. + * This opens the low-level device and sets f->f_devdata. + * This is declared with variable arguments... + */ +int +net_open(struct open_file *f, ...) +{ + va_list ap; + char *devname; /* Device part of file name (or NULL). */ + int error = 0; + + va_start(ap, f); + devname = va_arg(ap, char *); + va_end(ap); + +#ifdef NETIF_DEBUG + if (debug) + printf("%s\n", devname); +#endif + + /* On first open, do netif open, mount, etc. */ + if (netdev_opens == 0) { + /* Find network interface. */ + if (netdev_sock < 0) { + netdev_sock = netif_open(devname); + if (netdev_sock < 0) { + printf("netif_open() failed\n"); + return ENXIO; + } +#ifdef NETIF_DEBUG + if (debug) + printf("netif_open() succeeded\n"); +#endif + } + if (rootip.s_addr == 0) { + /* Get root IP address, and path, etc. */ + error = net_getparams(netdev_sock); + if (error) { + /* getparams makes its own noise */ + goto fail; + } + /* Get the NFS file handle (mountd). */ + error = nfs_mount(netdev_sock, rootip, rootpath); + if (error) { + printf("NFS mount error=%d\n", errno); + rootip.s_addr = 0; + fail: + netif_close(netdev_sock); + netdev_sock = -1; + return error; + } +#ifdef NETIF_DEBUG + if (debug) + printf("NFS mount succeeded\n"); +#endif + } + } + netdev_opens++; + f->f_devdata = nfs_root_node; + return error; +} + +int +net_close(struct open_file *f) +{ + +#ifdef NETIF_DEBUG + if (debug) + printf("net_close: opens=%d\n", netdev_opens); +#endif + + /* On last close, do netif close, etc. */ + f->f_devdata = NULL; + /* Extra close call? */ + if (netdev_opens <= 0) + return 0; + netdev_opens--; + /* Not last close? */ + if (netdev_opens > 0) + return 0; + rootip.s_addr = 0; + if (netdev_sock >= 0) { +#ifdef NETIF_DEBUG + if (debug) + printf("net_close: calling netif_close()\n"); +#endif + netif_close(netdev_sock); + netdev_sock = -1; + } + return 0; +} + +int +net_ioctl(struct open_file *f, u_long cmd, void *data) +{ + + return EIO; +} + +int +net_strategy(void *devdata, int rw, daddr32_t blk, size_t size, void *buf, + size_t *rsize) +{ + + return EIO; +} + + +/* + * Get info for NFS boot: our IP address, our hostname, + * server IP address, and our root path on the server. + * There are two ways to do this: The old, Sun way, + * and the more modern, BOOTP way. (RFC951, RFC1048) + * + * The default is to use the Sun bootparams RPC + * (because that is what the kernel will do). + * MD code can make try_bootp initialied data, + * which will override this common definition. + */ +#ifdef SUPPORT_BOOTP +int try_bootp; +#endif + +static int +net_getparams(int sock) +{ + char buf[MAXHOSTNAMELEN]; + n_long smask; + +#ifdef SUPPORT_BOOTP + /* + * Try to get boot info using BOOTP. If we succeed, then + * the server IP address, gateway, and root path will all + * be initialized. If any remain uninitialized, we will + * use RARP and RPC/bootparam (the Sun way) to get them. + */ + if (try_bootp) + bootp(sock); + if (myip.s_addr != 0) + return 0; +#ifdef NETIF_DEBUG + if (debug) + printf("BOOTP failed, trying RARP/RPC...\n"); +#endif +#endif + + /* + * Use RARP to get our IP address. This also sets our + * netmask to the "natural" default for our address. + */ + if (rarp_getipaddress(sock)) { + printf("RARP failed\n"); + return EIO; + } +#ifdef NETIF_DEBUG + if (debug) + printf("client addr: %s\n", inet_ntoa(myip)); +#endif + + /* Get our hostname, server IP address, gateway. */ + if (bp_whoami(sock)) { + printf("bootparam/whoami RPC failed\n"); + return EIO; + } +#ifdef NETIF_DEBUG + if (debug) + printf("client name: %s\n", hostname); +#endif + + /* + * Ignore the gateway from whoami (unreliable). + * Use the "gateway" parameter instead. + */ + smask = 0; + gateip.s_addr = 0; + if (bp_getfile(sock, "gateway", &gateip, buf)) { + printf("nfs_open: gateway bootparam missing\n"); + } else { + /* Got it! Parse the netmask. */ + smask = inet_addr(buf); + } + if (smask) { + netmask = smask; +#ifdef NETIF_DEBUG + if (debug) + printf("subnet mask: %s\n", intoa(netmask)); +#endif + } +#ifdef NETIF_DEBUG + if (debug) + if (gateip.s_addr) + printf("net gateway: %s\n", inet_ntoa(gateip)); +#endif + + /* Get the root server and pathname. */ + if (bp_getfile(sock, "root", &rootip, rootpath)) { + printf("bootparam/getfile RPC failed\n"); + return EIO; + } + +#ifdef NETIF_DEBUG + if (debug) { + printf("server addr: %s\n", inet_ntoa(rootip)); + printf("server path: %s\n", rootpath); + } +#endif + + return 0; +} diff --git a/sys/arch/luna88k/stand/boot/dev_net.h b/sys/arch/luna88k/stand/boot/dev_net.h new file mode 100644 index 00000000000..e3536c708cc --- /dev/null +++ b/sys/arch/luna88k/stand/boot/dev_net.h @@ -0,0 +1,10 @@ +/* $NetBSD: dev_net.h,v 1.6 2009/01/17 14:00:36 tsutsui Exp $ */ + +int net_open(struct open_file *, ...); +int net_close(struct open_file *); +int net_ioctl(struct open_file *, u_long, void *); +int net_strategy(void *, int , daddr32_t , size_t, void *, size_t *); + +#ifdef SUPPORT_BOOTP +extern int try_bootp; +#endif diff --git a/sys/arch/luna88k/stand/boot/device.h b/sys/arch/luna88k/stand/boot/device.h new file mode 100644 index 00000000000..a233ddf6f85 --- /dev/null +++ b/sys/arch/luna88k/stand/boot/device.h @@ -0,0 +1,144 @@ +/* $OpenBSD: device.h,v 1.1 2013/10/28 22:13:12 miod Exp $ */ +/* $NetBSD: device.h,v 1.5 2013/01/14 12:28:11 tsutsui Exp $ */ + +/* + * Copyright (c) 1992 OMRON Corporation. + * + * This code is derived from software contributed to Berkeley by + * OMRON Corporation. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)device.h 8.1 (Berkeley) 6/10/93 + */ +/* + * Copyright (c) 1992, 1993 + * The Regents of the University of California. All rights reserved. + * + * This code is derived from software contributed to Berkeley by + * OMRON Corporation. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)device.h 8.1 (Berkeley) 6/10/93 + */ + +struct driver { + int (*d_init)(void *); + char *d_name; +}; + +struct hp_ctlr { + struct driver *hp_driver; + int hp_unit; + int hp_alive; + uint8_t *hp_addr; + int hp_flags; +}; + +struct hp_device { + struct driver *hp_driver; + struct driver *hp_cdriver; + int hp_unit; + int hp_ctlr; + int hp_slave; + uint8_t *hp_addr; + int hp_dk; /* XXX */ + int hp_flags; + int hp_alive; +}; + +struct devqueue { + struct devqueue *dq_forw; + struct devqueue *dq_back; + int dq_ctlr; + int dq_unit; + int dq_slave; +}; + +struct hp_hw { + uint8_t *hw_addr; /* physical address of registers */ + short hw_type; /* type (defined below) */ + char *hw_name; /* HP product name */ +}; + +#define MAX_CTLR 16 /* Totally arbitrary */ +#define MAXSLAVES 8 /* Currently the HPIB limit */ + +#define WILD_CARD_CTLR 0 + +/* A controller is a card which can have one or more slaves attached */ +#define CONTROLLER 0x10 +#define HPIB 0x16 +#define SCSI 0x17 +#define VME 0x18 +#define FLINK 0x19 + +/* Slaves are devices which attach to controllers, e.g. disks, tapes */ +#define RD 0x2a +#define PPI 0x2b +#define CT 0x2c + +/* These are not controllers, but may have their own HPIB address */ +#define BITMAP 1 +#define NET 2 +#define FPA 4 +#define MISC 5 +#define KEYBOARD 6 +#define COMMDCA 7 +#define COMMDCM 8 +#define COMMDCL 9 +#define PPORT 10 +#define SIO 11 + +extern struct hp_ctlr hp_cinit[]; +extern struct hp_device hp_dinit[]; +extern struct hp_hw sc_table[]; diff --git a/sys/arch/luna88k/stand/boot/devopen.c b/sys/arch/luna88k/stand/boot/devopen.c new file mode 100644 index 00000000000..cc88d887fb0 --- /dev/null +++ b/sys/arch/luna88k/stand/boot/devopen.c @@ -0,0 +1,190 @@ +/* $OpenBSD: devopen.c,v 1.1 2013/10/28 22:13:12 miod Exp $ */ +/* $NetBSD: devopen.c,v 1.3 2013/01/16 15:46:20 tsutsui Exp $ */ + +/* + * Copyright (c) 1992 OMRON Corporation. + * + * This code is derived from software contributed to Berkeley by + * OMRON Corporation. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)conf.c 8.1 (Berkeley) 6/10/93 + */ +/* + * Copyright (c) 1992, 1993 + * The Regents of the University of California. All rights reserved. + * + * This code is derived from software contributed to Berkeley by + * OMRON Corporation. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)conf.c 8.1 (Berkeley) 6/10/93 + */ + +#include <lib/libkern/libkern.h> +#include <luna88k/stand/boot/samachdep.h> +#include <machine/disklabel.h> + +static int make_device(const char *, int *, int *, int *, char **); + +int +devopen(struct open_file *f, const char *fname, char **file) +{ + int dev, unit, part; + int error; + struct devsw *dp; + int i; + + if (make_device(fname, &dev, &unit, &part, file) != 0) + return ENXIO; + +#ifdef DEBUG + printf("%s: %s(%d,%d)%s\n", __func__, + devsw[dev].dv_name, unit, part, *file); +#endif + dp = &devsw[dev]; + error = (*dp->dv_open)(f, unit, part); + if (error != 0) { +#ifdef DEBUG + printf("%s: open %s(%d,%d)%s failed (%s)\n", __func__, + devsw[dev].dv_name, unit, part, *file, strerror(error)); +#endif + return error; + } + + for (i = 0; i < nfsys_disk; i++) + file_system[i] = file_system_disk[i]; + nfsys = nfsys_disk; + +#ifdef SUPPORT_ETHERNET + if (strcmp(dp->dv_name, "le") == 0) { + /* XXX mixing local fs_ops on netboot could be troublesome */ + file_system[0] = file_system_nfs[0]; + nfsys = 1; + } +#endif + + f->f_dev = dp; + + return 0; +} + +int +make_device(const char *str, int *devp, int *unitp, int *partp, char **fname) +{ + const char *cp; + struct devsw *dp; + int major, unit, part; + int i; + char devname[MAXDEVNAME + 1]; + + /* + * parse path strings + */ + /* find end of dev type name */ + for (cp = str, i = 0; *cp != '\0' && *cp != '(' && i < MAXDEVNAME; i++) + devname[i] = *cp++; + if (*cp != '(') { + return (-1); + } + devname[i] = '\0'; + /* compare dev type name */ + for (dp = devsw; dp->dv_name; dp++) + if (!strcmp(devname, dp->dv_name)) + break; + cp++; + if (dp->dv_name == NULL) { + return (-1); + } + major = dp - devsw; + /* get unit number */ + unit = *cp++ - '0'; + if (*cp >= '0' && *cp <= '9') + unit = unit * 10 + *cp++ - '0'; + if (unit < 0 || unit > 63) { +#ifdef DEBUG + printf("%s: invalid unit number (%d)\n", __func__, unit); +#endif + return (-1); + } + /* get partition offset */ + if (*cp++ != ',') { + return (-1); + } + part = *cp - '0'; + /* check out end of dev spec */ + for (;;) { + if (*cp == ')') + break; + if (*cp++) + continue; + return (-1); + } + if (part < 0 || part > MAXPARTITIONS) { +#ifdef DEBUG + printf("%s: invalid partition number (%d)\n", __func__, part); +#endif + return (-1); + } + + *devp = major; + *unitp = unit; + *partp = part; + *fname = (char *)cp + 1; /* XXX */ +#ifdef DEBUG + printf("%s: major = %d, unit = %d, part = %d, fname = %s\n", + __func__, major, unit, part, *fname); +#endif + + return 0; +} diff --git a/sys/arch/luna88k/stand/boot/fault.c b/sys/arch/luna88k/stand/boot/fault.c new file mode 100644 index 00000000000..24b218a1bc3 --- /dev/null +++ b/sys/arch/luna88k/stand/boot/fault.c @@ -0,0 +1,148 @@ +/* $OpenBSD: fault.c,v 1.1 2013/10/28 22:13:12 miod Exp $ */ + +/* + * Copyright (c) 2013 Miodrag Vallat. + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + +/* + * Standalone code to recover from faults. Allows for hardware detection. + */ + +#include <sys/param.h> + +#include <machine/asm.h> +#include <machine/asm_macro.h> +#include <machine/psl.h> + +typedef struct label_t { + long val[19]; +} label_t; + +extern int setjmp(label_t *); +extern void longjmp(label_t *); + +static label_t badaddr_jmpbuf; +static uint32_t badaddr_psr; + +static uint32_t prom_vbr; +static uint32_t vector_page[512 * 2] __attribute__ ((__aligned__(0x1000))); + +static __inline__ uint32_t +get_vbr() +{ + uint32_t vbr; + __asm__ __volatile__ ("ldcr %0, %%cr7" : "=r"(vbr)); + return vbr; +} + +static __inline__ void +set_vbr(uint32_t vbr) +{ + __asm__ __volatile__ ("stcr %0, %%cr7" :: "r"(vbr)); +} + +/* + * This is an horribly crude logic to recover from data access exceptions + * by longjmp'ing back to badaddr(). We should theoretically at least use + * an `rte' somewhere to unfreeze the scoreboard. But since we restore a + * PSR with interrupts disabled, this turns out to be safe. + */ +static void +libsa_fault_handler(void) +{ + set_psr(badaddr_psr | PSR_IND); /* undo SFRZ */ + flush_pipeline(); + + longjmp(&badaddr_jmpbuf); + /* NOTREACHED */ +} + +static __inline__ uint32_t +br(uint32_t delta) +{ + return 0xc0000000 | (((int32_t)delta >> 2) & 0x03ffffff); +} + +static void +libsa_fault_init() +{ + int vec; + uint32_t *insn; + uint32_t br_insn; + + prom_vbr = get_vbr(); + + insn = vector_page; + br_insn = br(prom_vbr - (uint32_t)&vector_page - 4); + for (vec = 512; vec != 0; vec--) { + *insn++ = 0xf4005800; /* nop */ + *insn++ = br_insn; /* br into prom vbr page */ + } + + /* override data access exception */ + vector_page[3 * 2 + 1] = + br((uint32_t)&libsa_fault_handler - + (uint32_t)&vector_page[3 * 2 + 1]); +} + +int +badaddr(void *addr, int len) +{ + int rc; + + if (vector_page[0] == 0) + libsa_fault_init(); + + badaddr_psr = get_psr(); + set_psr(badaddr_psr | PSR_IND); + + set_vbr((uint32_t)&vector_page); + + if (setjmp(&badaddr_jmpbuf) == 0) { + switch (len) { + case 1: + (void)*(volatile uint8_t *)addr; + rc = 0; + break; + case 2: + if ((uint32_t)addr & 1) + rc = 1; + else { + (void)*(volatile uint16_t *)addr; + rc = 0; + } + break; + case 4: + if ((uint32_t)addr & 3) + rc = 1; + else { + (void)*(volatile uint32_t *)addr; + rc = 0; + } + break; + default: + rc = 1; + break; + } + } else { + rc = 1; + } + + set_vbr(prom_vbr); + flush_pipeline(); + set_psr(badaddr_psr); + + return rc; +} diff --git a/sys/arch/luna88k/stand/boot/font.c b/sys/arch/luna88k/stand/boot/font.c new file mode 100644 index 00000000000..f53211c55f8 --- /dev/null +++ b/sys/arch/luna88k/stand/boot/font.c @@ -0,0 +1,2899 @@ +/* $OpenBSD: font.c,v 1.1 2013/10/28 22:13:12 miod Exp $ */ +/* $NetBSD: font.c,v 1.2 2013/01/20 13:35:43 tsutsui Exp $ */ + +/* + * Copyright (c) 1992 OMRON Corporation. + * + * This code is derived from software contributed to Berkeley by + * OMRON Corporation. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)font.c 8.1 (Berkeley) 6/10/93 + */ +/* + * Copyright (c) 1992, 1993 + * The Regents of the University of California. All rights reserved. + * + * This code is derived from software contributed to Berkeley by + * OMRON Corporation. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)font.c 8.1 (Berkeley) 6/10/93 + */ + +/* + * font.c --- font-image definition + * + * This file is generated by "image2". + */ + +#include <sys/param.h> + +u_short bmdfont[][20] = { + { /* 0x00 */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000 /* ---------------- */ + }, + { /* 0x01 */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000 /* ---------------- */ + }, + { /* 0x02 */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000 /* ---------------- */ + }, + { /* 0x03 */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000 /* ---------------- */ + }, + { /* 0x04 */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000 /* ---------------- */ + }, + { /* 0x05 */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000 /* ---------------- */ + }, + { /* 0x06 */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000 /* ---------------- */ + }, + { /* 0x07 */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000 /* ---------------- */ + }, + { /* 0x08 */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000 /* ---------------- */ + }, + { /* 0x09 */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000 /* ---------------- */ + }, + { /* 0x0A */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000 /* ---------------- */ + }, + { /* 0x0B */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000 /* ---------------- */ + }, + { /* 0x0C */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000 /* ---------------- */ + }, + { /* 0x0D */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000 /* ---------------- */ + }, + { /* 0x0E */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000 /* ---------------- */ + }, + { /* 0x0F */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000 /* ---------------- */ + }, + { /* 0x10 */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000 /* ---------------- */ + }, + { /* 0x11 */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000 /* ---------------- */ + }, + { /* 0x12 */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000 /* ---------------- */ + }, + { /* 0x13 */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000 /* ---------------- */ + }, + { /* 0x14 */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000 /* ---------------- */ + }, + { /* 0x15 */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000 /* ---------------- */ + }, + { /* 0x16 */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000 /* ---------------- */ + }, + { /* 0x17 */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000 /* ---------------- */ + }, + { /* 0x18 */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000 /* ---------------- */ + }, + { /* 0x19 */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000 /* ---------------- */ + }, + { /* 0x1A */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000 /* ---------------- */ + }, + { /* 0x1B */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000 /* ---------------- */ + }, + { /* 0x1C */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000 /* ---------------- */ + }, + { /* 0x1D */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000 /* ---------------- */ + }, + { /* 0x1E */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000 /* ---------------- */ + }, + { /* 0x1F */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000 /* ---------------- */ + }, + { /* 0x20 (' ') */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000 /* ---------------- */ + }, + { /* 0x21 ('!') */ + 0x0C00, /* ----XX---------- */ + 0x1E00, /* ---XXXX--------- */ + 0x1E00, /* ---XXXX--------- */ + 0x1E00, /* ---XXXX--------- */ + 0x1E00, /* ---XXXX--------- */ + 0x1E00, /* ---XXXX--------- */ + 0x0C00, /* ----XX---------- */ + 0x0C00, /* ----XX---------- */ + 0x0C00, /* ----XX---------- */ + 0x0C00, /* ----XX---------- */ + 0x0C00, /* ----XX---------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0C00, /* ----XX---------- */ + 0x1E00, /* ---XXXX--------- */ + 0x0C00, /* ----XX---------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000 /* ---------------- */ + }, + { /* 0x22 ('"') */ + 0x1080, /* ---X----X------- */ + 0x39C0, /* --XXX--XXX------ */ + 0x39C0, /* --XXX--XXX------ */ + 0x18C0, /* ---XX---XX------ */ + 0x1080, /* ---X----X------- */ + 0x2100, /* --X----X-------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000 /* ---------------- */ + }, + { /* 0x23 ('#') */ + 0x0480, /* -----X--X------- */ + 0x0480, /* -----X--X------- */ + 0x0480, /* -----X--X------- */ + 0x0480, /* -----X--X------- */ + 0x3FE0, /* --XXXXXXXXX----- */ + 0x3FE0, /* --XXXXXXXXX----- */ + 0x0900, /* ----X--X-------- */ + 0x0900, /* ----X--X-------- */ + 0x0900, /* ----X--X-------- */ + 0x0900, /* ----X--X-------- */ + 0x7FC0, /* -XXXXXXXXX------ */ + 0x7FC0, /* -XXXXXXXXX------ */ + 0x1200, /* ---X--X--------- */ + 0x1200, /* ---X--X--------- */ + 0x1200, /* ---X--X--------- */ + 0x1200, /* ---X--X--------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000 /* ---------------- */ + }, + { /* 0x24 ('$') */ + 0x0400, /* -----X---------- */ + 0x0400, /* -----X---------- */ + 0x1F80, /* ---XXXXXX------- */ + 0x34C0, /* --XX-X--XX------ */ + 0x6460, /* -XX--X---XX----- */ + 0x64E0, /* -XX--X--XXX----- */ + 0x3440, /* --XX-X---X------ */ + 0x3F00, /* --XXXXXX-------- */ + 0x0FC0, /* ----XXXXXX------ */ + 0x24C0, /* --X--X--XX------ */ + 0x7460, /* -XXX-X---XX----- */ + 0x6460, /* -XX--X---XX----- */ + 0x34C0, /* --XX-X--XX------ */ + 0x1F80, /* ---XXXXXX------- */ + 0x0400, /* -----X---------- */ + 0x0400, /* -----X---------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000 /* ---------------- */ + }, + { /* 0x25 ('%') */ + 0x0000, /* ---------------- */ + 0x3860, /* --XXX----XX----- */ + 0x6CC0, /* -XX-XX--XX------ */ + 0x44C0, /* -X---X--XX------ */ + 0x6D80, /* -XX-XX-XX------- */ + 0x3980, /* --XXX--XX------- */ + 0x0300, /* ------XX-------- */ + 0x0600, /* -----XX--------- */ + 0x0600, /* -----XX--------- */ + 0x0C00, /* ----XX---------- */ + 0x19C0, /* ---XX--XXX------ */ + 0x1B60, /* ---XX-XX-XX----- */ + 0x3220, /* --XX--X---X----- */ + 0x3360, /* --XX--XX-XX----- */ + 0x61C0, /* -XX----XXX------ */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000 /* ---------------- */ + }, + { /* 0x26 ('&') */ + 0x1C00, /* ---XXX---------- */ + 0x3600, /* --XX-XX--------- */ + 0x6300, /* -XX---XX-------- */ + 0x6300, /* -XX---XX-------- */ + 0x6600, /* -XX--XX--------- */ + 0x3600, /* --XX-XX--------- */ + 0x3C00, /* --XXXX---------- */ + 0x3DC0, /* --XXXX-XXX------ */ + 0x6C80, /* -XX-XX--X------- */ + 0x6680, /* -XX--XX-X------- */ + 0xC680, /* XX---XX-X------- */ + 0xC380, /* XX----XXX------- */ + 0xC180, /* XX-----XX------- */ + 0xC3A0, /* XX----XXX-X----- */ + 0x66E0, /* -XX--XX-XXX----- */ + 0x3C40, /* --XXXX---X------ */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000 /* ---------------- */ + }, + { /* 0x27 (''') */ + 0x1800, /* ---XX----------- */ + 0x3C00, /* --XXXX---------- */ + 0x1C00, /* ---XXX---------- */ + 0x0800, /* ----X----------- */ + 0x1000, /* ---X------------ */ + 0x2000, /* --X------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000 /* ---------------- */ + }, + { /* 0x28 ('(') */ + 0x0040, /* ---------X------ */ + 0x0080, /* --------X------- */ + 0x0180, /* -------XX------- */ + 0x0300, /* ------XX-------- */ + 0x0300, /* ------XX-------- */ + 0x0600, /* -----XX--------- */ + 0x0600, /* -----XX--------- */ + 0x0600, /* -----XX--------- */ + 0x0600, /* -----XX--------- */ + 0x0600, /* -----XX--------- */ + 0x0600, /* -----XX--------- */ + 0x0300, /* ------XX-------- */ + 0x0300, /* ------XX-------- */ + 0x0180, /* -------XX------- */ + 0x0080, /* --------X------- */ + 0x0040, /* ---------X------ */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000 /* ---------------- */ + }, + { /* 0x29 (')') */ + 0x2000, /* --X------------- */ + 0x1000, /* ---X------------ */ + 0x1800, /* ---XX----------- */ + 0x0C00, /* ----XX---------- */ + 0x0C00, /* ----XX---------- */ + 0x0600, /* -----XX--------- */ + 0x0600, /* -----XX--------- */ + 0x0600, /* -----XX--------- */ + 0x0600, /* -----XX--------- */ + 0x0600, /* -----XX--------- */ + 0x0600, /* -----XX--------- */ + 0x0C00, /* ----XX---------- */ + 0x0C00, /* ----XX---------- */ + 0x1800, /* ---XX----------- */ + 0x1000, /* ---X------------ */ + 0x2000, /* --X------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000 /* ---------------- */ + }, + { /* 0x2A ('*') */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0400, /* -----X---------- */ + 0x0E00, /* ----XXX--------- */ + 0x0E00, /* ----XXX--------- */ + 0x64C0, /* -XX--X--XX------ */ + 0x64C0, /* -XX--X--XX------ */ + 0x3580, /* --XX-X-XX------- */ + 0x0E00, /* ----XXX--------- */ + 0x1500, /* ---X-X-X-------- */ + 0x75C0, /* -XXX-X-XXX------ */ + 0x64C0, /* -XX--X--XX------ */ + 0x0E00, /* ----XXX--------- */ + 0x0E00, /* ----XXX--------- */ + 0x0400, /* -----X---------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000 /* ---------------- */ + }, + { /* 0x2B ('+') */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0600, /* -----XX--------- */ + 0x0600, /* -----XX--------- */ + 0x0600, /* -----XX--------- */ + 0x0600, /* -----XX--------- */ + 0x0600, /* -----XX--------- */ + 0x7FE0, /* -XXXXXXXXXX----- */ + 0x7FE0, /* -XXXXXXXXXX----- */ + 0x0600, /* -----XX--------- */ + 0x0600, /* -----XX--------- */ + 0x0600, /* -----XX--------- */ + 0x0600, /* -----XX--------- */ + 0x0600, /* -----XX--------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000 /* ---------------- */ + }, + { /* 0x2C (',') */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0C00, /* ----XX---------- */ + 0x1E00, /* ---XXXX--------- */ + 0x0E00, /* ----XXX--------- */ + 0x0400, /* -----X---------- */ + 0x0800, /* ----X----------- */ + 0x1000 /* ---X------------ */ + }, + { /* 0x2D ('-') */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x7FC0, /* -XXXXXXXXX------ */ + 0x7FC0, /* -XXXXXXXXX------ */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000 /* ---------------- */ + }, + { /* 0x2E ('.') */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0400, /* -----X---------- */ + 0x0E00, /* ----XXX--------- */ + 0x0E00, /* ----XXX--------- */ + 0x0400, /* -----X---------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000 /* ---------------- */ + }, + { /* 0x2F ('/') */ + 0x0020, /* ----------X----- */ + 0x0060, /* ---------XX----- */ + 0x0040, /* ---------X------ */ + 0x00C0, /* --------XX------ */ + 0x0180, /* -------XX------- */ + 0x0300, /* ------XX-------- */ + 0x0200, /* ------X--------- */ + 0x0600, /* -----XX--------- */ + 0x0C00, /* ----XX---------- */ + 0x0800, /* ----X----------- */ + 0x1800, /* ---XX----------- */ + 0x3000, /* --XX------------ */ + 0x6000, /* -XX------------- */ + 0x4000, /* -X-------------- */ + 0xC000, /* XX-------------- */ + 0x8000, /* X--------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000 /* ---------------- */ + }, + { /* 0x30 ('0') */ + 0x0F00, /* ----XXXX-------- */ + 0x30C0, /* --XX----XX------ */ + 0x2040, /* --X------X------ */ + 0x6060, /* -XX------XX----- */ + 0x6060, /* -XX------XX----- */ + 0x6060, /* -XX------XX----- */ + 0x6060, /* -XX------XX----- */ + 0x6060, /* -XX------XX----- */ + 0x6060, /* -XX------XX----- */ + 0x6060, /* -XX------XX----- */ + 0x6060, /* -XX------XX----- */ + 0x6060, /* -XX------XX----- */ + 0x6060, /* -XX------XX----- */ + 0x2040, /* --X------X------ */ + 0x30C0, /* --XX----XX------ */ + 0x0F00, /* ----XXXX-------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000 /* ---------------- */ + }, + { /* 0x31 ('1') */ + 0x0200, /* ------X--------- */ + 0x0600, /* -----XX--------- */ + 0x1E00, /* ---XXXX--------- */ + 0x0600, /* -----XX--------- */ + 0x0600, /* -----XX--------- */ + 0x0600, /* -----XX--------- */ + 0x0600, /* -----XX--------- */ + 0x0600, /* -----XX--------- */ + 0x0600, /* -----XX--------- */ + 0x0600, /* -----XX--------- */ + 0x0600, /* -----XX--------- */ + 0x0600, /* -----XX--------- */ + 0x0600, /* -----XX--------- */ + 0x0600, /* -----XX--------- */ + 0x0600, /* -----XX--------- */ + 0x1F80, /* ---XXXXXX------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000 /* ---------------- */ + }, + { /* 0x32 ('2') */ + 0x0F80, /* ----XXXXX------- */ + 0x38C0, /* --XXX---XX------ */ + 0x3060, /* --XX-----XX----- */ + 0x6060, /* -XX------XX----- */ + 0x7060, /* -XXX-----XX----- */ + 0x70C0, /* -XXX----XX------ */ + 0x2180, /* --X----XX------- */ + 0x0300, /* ------XX-------- */ + 0x0600, /* -----XX--------- */ + 0x0C00, /* ----XX---------- */ + 0x1800, /* ---XX----------- */ + 0x3000, /* --XX------------ */ + 0x6020, /* -XX-------X----- */ + 0x6060, /* -XX------XX----- */ + 0x7FC0, /* -XXXXXXXXX------ */ + 0x7FC0, /* -XXXXXXXXX------ */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000 /* ---------------- */ + }, + { /* 0x33 ('3') */ + 0x1F00, /* ---XXXXX-------- */ + 0x31C0, /* --XX---XXX------ */ + 0x60C0, /* -XX-----XX------ */ + 0x6060, /* -XX------XX----- */ + 0x7060, /* -XXX-----XX----- */ + 0x2040, /* --X------X------ */ + 0x00C0, /* --------XX------ */ + 0x0F80, /* ----XXXXX------- */ + 0x00C0, /* --------XX------ */ + 0x0060, /* ---------XX----- */ + 0x2060, /* --X------XX----- */ + 0x7060, /* -XXX-----XX----- */ + 0x6060, /* -XX------XX----- */ + 0x60C0, /* -XX-----XX------ */ + 0x39C0, /* --XXX--XXX------ */ + 0x1F00, /* ---XXXXX-------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000 /* ---------------- */ + }, + { /* 0x34 ('4') */ + 0x0180, /* -------XX------- */ + 0x0380, /* ------XXX------- */ + 0x0380, /* ------XXX------- */ + 0x0580, /* -----X-XX------- */ + 0x0580, /* -----X-XX------- */ + 0x0980, /* ----X--XX------- */ + 0x0980, /* ----X--XX------- */ + 0x1180, /* ---X---XX------- */ + 0x1180, /* ---X---XX------- */ + 0x2180, /* --X----XX------- */ + 0x2180, /* --X----XX------- */ + 0x7FE0, /* -XXXXXXXXXX----- */ + 0x7FE0, /* -XXXXXXXXXX----- */ + 0x0180, /* -------XX------- */ + 0x0180, /* -------XX------- */ + 0x07E0, /* -----XXXXXX----- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000 /* ---------------- */ + }, + { /* 0x35 ('5') */ + 0x3FE0, /* --XXXXXXXXX----- */ + 0x3FC0, /* --XXXXXXXX------ */ + 0x3000, /* --XX------------ */ + 0x3000, /* --XX------------ */ + 0x3700, /* --XX-XXX-------- */ + 0x38C0, /* --XXX---XX------ */ + 0x3040, /* --XX-----X------ */ + 0x3060, /* --XX-----XX----- */ + 0x0060, /* ---------XX----- */ + 0x0060, /* ---------XX----- */ + 0x2060, /* --X------XX----- */ + 0x7060, /* -XXX-----XX----- */ + 0x7040, /* -XXX-----X------ */ + 0x60C0, /* -XX-----XX------ */ + 0x3080, /* --XX----X------- */ + 0x0F00, /* ----XXXX-------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000 /* ---------------- */ + }, + { /* 0x36 ('6') */ + 0x0F00, /* ----XXXX-------- */ + 0x30C0, /* --XX----XX------ */ + 0x2040, /* --X------X------ */ + 0x60E0, /* -XX-----XXX----- */ + 0x6040, /* -XX------X------ */ + 0x6000, /* -XX------------- */ + 0x6000, /* -XX------------- */ + 0x6F00, /* -XX-XXXX-------- */ + 0x70C0, /* -XXX----XX------ */ + 0x6040, /* -XX------X------ */ + 0x6060, /* -XX------XX----- */ + 0x6060, /* -XX------XX----- */ + 0x6060, /* -XX------XX----- */ + 0x2040, /* --X------X------ */ + 0x30C0, /* --XX----XX------ */ + 0x0F00, /* ----XXXX-------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000 /* ---------------- */ + }, + { /* 0x37 ('7') */ + 0x3FE0, /* --XXXXXXXXX----- */ + 0x3FE0, /* --XXXXXXXXX----- */ + 0x3040, /* --XX-----X------ */ + 0x60C0, /* -XX-----XX------ */ + 0x4080, /* -X------X------- */ + 0x0180, /* -------XX------- */ + 0x0300, /* ------XX-------- */ + 0x0300, /* ------XX-------- */ + 0x0600, /* -----XX--------- */ + 0x0600, /* -----XX--------- */ + 0x0600, /* -----XX--------- */ + 0x0600, /* -----XX--------- */ + 0x0600, /* -----XX--------- */ + 0x0600, /* -----XX--------- */ + 0x0600, /* -----XX--------- */ + 0x0600, /* -----XX--------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000 /* ---------------- */ + }, + { /* 0x38 ('8') */ + 0x0F00, /* ----XXXX-------- */ + 0x30C0, /* --XX----XX------ */ + 0x2040, /* --X------X------ */ + 0x6060, /* -XX------XX----- */ + 0x6040, /* -XX------X------ */ + 0x30C0, /* --XX----XX------ */ + 0x3F80, /* --XXXXXXX------- */ + 0x1F80, /* ---XXXXXX------- */ + 0x31C0, /* --XX---XXX------ */ + 0x20C0, /* --X-----XX------ */ + 0x6060, /* -XX------XX----- */ + 0x6060, /* -XX------XX----- */ + 0x6060, /* -XX------XX----- */ + 0x6040, /* -XX------X------ */ + 0x30C0, /* --XX----XX------ */ + 0x0F00, /* ----XXXX-------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000 /* ---------------- */ + }, + { /* 0x39 ('9') */ + 0x0F00, /* ----XXXX-------- */ + 0x30C0, /* --XX----XX------ */ + 0x2040, /* --X------X------ */ + 0x6060, /* -XX------XX----- */ + 0x6060, /* -XX------XX----- */ + 0x6060, /* -XX------XX----- */ + 0x2060, /* --X------XX----- */ + 0x30E0, /* --XX----XXX----- */ + 0x0F60, /* ----XXXX-XX----- */ + 0x0060, /* ---------XX----- */ + 0x0060, /* ---------XX----- */ + 0x2060, /* --X------XX----- */ + 0x7060, /* -XXX-----XX----- */ + 0x6040, /* -XX------X------ */ + 0x30C0, /* --XX----XX------ */ + 0x0F00, /* ----XXXX-------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000 /* ---------------- */ + }, + { /* 0x3A (':') */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0600, /* -----XX--------- */ + 0x0F00, /* ----XXXX-------- */ + 0x0600, /* -----XX--------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0600, /* -----XX--------- */ + 0x0F00, /* ----XXXX-------- */ + 0x0600, /* -----XX--------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000 /* ---------------- */ + }, + { /* 0x3B (';') */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0600, /* -----XX--------- */ + 0x0F00, /* ----XXXX-------- */ + 0x0600, /* -----XX--------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0600, /* -----XX--------- */ + 0x0F00, /* ----XXXX-------- */ + 0x0700, /* -----XXX-------- */ + 0x0200, /* ------X--------- */ + 0x0400, /* -----X---------- */ + 0x0800, /* ----X----------- */ + 0x0000, /* ---------------- */ + 0x0000 /* ---------------- */ + }, + { /* 0x3C ('<') */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x00C0, /* --------XX------ */ + 0x03C0, /* ------XXXX------ */ + 0x0F00, /* ----XXXX-------- */ + 0x3C00, /* --XXXX---------- */ + 0x7000, /* -XXX------------ */ + 0x3C00, /* --XXXX---------- */ + 0x0F00, /* ----XXXX-------- */ + 0x03C0, /* ------XXXX------ */ + 0x00C0, /* --------XX------ */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000 /* ---------------- */ + }, + { /* 0x3D ('=') */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x7FE0, /* -XXXXXXXXXX----- */ + 0x7FE0, /* -XXXXXXXXXX----- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x7FE0, /* -XXXXXXXXXX----- */ + 0x7FE0, /* -XXXXXXXXXX----- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000 /* ---------------- */ + }, + { /* 0x3E ('>') */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x3000, /* --XX------------ */ + 0x3C00, /* --XXXX---------- */ + 0x0F00, /* ----XXXX-------- */ + 0x03C0, /* ------XXXX------ */ + 0x00E0, /* --------XXX----- */ + 0x03C0, /* ------XXXX------ */ + 0x0F00, /* ----XXXX-------- */ + 0x3C00, /* --XXXX---------- */ + 0x3000, /* --XX------------ */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000 /* ---------------- */ + }, + { /* 0x3F ('?') */ + 0x0E00, /* ----XXX--------- */ + 0x3F80, /* --XXXXXXX------- */ + 0x3180, /* --XX---XX------- */ + 0x78C0, /* -XXXX---XX------ */ + 0x30C0, /* --XX----XX------ */ + 0x0180, /* -------XX------- */ + 0x0300, /* ------XX-------- */ + 0x0200, /* ------X--------- */ + 0x0600, /* -----XX--------- */ + 0x0400, /* -----X---------- */ + 0x0400, /* -----X---------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0400, /* -----X---------- */ + 0x0E00, /* ----XXX--------- */ + 0x0400, /* -----X---------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000 /* ---------------- */ + }, + { /* 0x40 ('@') */ + 0x0000, /* ---------------- */ + 0x0E00, /* ----XXX--------- */ + 0x3F80, /* --XXXXXXX------- */ + 0x60C0, /* -XX-----XX------ */ + 0xC060, /* XX-------XX----- */ + 0xC720, /* XX---XXX--X----- */ + 0xCFA0, /* XX--XXXXX-X----- */ + 0xD9A0, /* XX-XX--XX-X----- */ + 0xD9A0, /* XX-XX--XX-X----- */ + 0xD9A0, /* XX-XX--XX-X----- */ + 0xDFE0, /* XX-XXXXXXXX----- */ + 0xCF40, /* XX--XXXX-X------ */ + 0x6000, /* -XX------------- */ + 0x7060, /* -XXX-----XX----- */ + 0x3FC0, /* --XXXXXXXX------ */ + 0x0F00, /* ----XXXX-------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000 /* ---------------- */ + }, + { /* 0x41 ('A') */ + 0x0000, /* ---------------- */ + 0x0400, /* -----X---------- */ + 0x0E00, /* ----XXX--------- */ + 0x0E00, /* ----XXX--------- */ + 0x0A00, /* ----X-X--------- */ + 0x1300, /* ---X--XX-------- */ + 0x1300, /* ---X--XX-------- */ + 0x1300, /* ---X--XX-------- */ + 0x2180, /* --X----XX------- */ + 0x2180, /* --X----XX------- */ + 0x3F80, /* --XXXXXXX------- */ + 0x2180, /* --X----XX------- */ + 0x40C0, /* -X------XX------ */ + 0x40C0, /* -X------XX------ */ + 0x40C0, /* -X------XX------ */ + 0xE1E0, /* XXX----XXXX----- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000 /* ---------------- */ + }, + { /* 0x42 ('B') */ + 0x0000, /* ---------------- */ + 0xFF00, /* XXXXXXXX-------- */ + 0x30C0, /* --XX----XX------ */ + 0x3040, /* --XX-----X------ */ + 0x3060, /* --XX-----XX----- */ + 0x3040, /* --XX-----X------ */ + 0x30C0, /* --XX----XX------ */ + 0x3F80, /* --XXXXXXX------- */ + 0x30C0, /* --XX----XX------ */ + 0x3040, /* --XX-----X------ */ + 0x3060, /* --XX-----XX----- */ + 0x3060, /* --XX-----XX----- */ + 0x3060, /* --XX-----XX----- */ + 0x3040, /* --XX-----X------ */ + 0x30C0, /* --XX----XX------ */ + 0xFF00, /* XXXXXXXX-------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000 /* ---------------- */ + }, + { /* 0x43 ('C') */ + 0x0000, /* ---------------- */ + 0x0F20, /* ----XXXX--X----- */ + 0x30E0, /* --XX----XXX----- */ + 0x2060, /* --X------XX----- */ + 0x6020, /* -XX-------X----- */ + 0x6020, /* -XX-------X----- */ + 0x6000, /* -XX------------- */ + 0x6000, /* -XX------------- */ + 0x6000, /* -XX------------- */ + 0x6000, /* -XX------------- */ + 0x6000, /* -XX------------- */ + 0x6020, /* -XX-------X----- */ + 0x6020, /* -XX-------X----- */ + 0x2040, /* --X------X------ */ + 0x30C0, /* --XX----XX------ */ + 0x0F00, /* ----XXXX-------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000 /* ---------------- */ + }, + { /* 0x44 ('D') */ + 0x0000, /* ---------------- */ + 0xFE00, /* XXXXXXX--------- */ + 0x3180, /* --XX---XX------- */ + 0x30C0, /* --XX----XX------ */ + 0x3040, /* --XX-----X------ */ + 0x3060, /* --XX-----XX----- */ + 0x3060, /* --XX-----XX----- */ + 0x3060, /* --XX-----XX----- */ + 0x3060, /* --XX-----XX----- */ + 0x3060, /* --XX-----XX----- */ + 0x3060, /* --XX-----XX----- */ + 0x3060, /* --XX-----XX----- */ + 0x3040, /* --XX-----X------ */ + 0x30C0, /* --XX----XX------ */ + 0x3180, /* --XX---XX------- */ + 0xFE00, /* XXXXXXX--------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000 /* ---------------- */ + }, + { /* 0x45 ('E') */ + 0x0000, /* ---------------- */ + 0xFFC0, /* XXXXXXXXXX------ */ + 0x3040, /* --XX-----X------ */ + 0x3040, /* --XX-----X------ */ + 0x3000, /* --XX------------ */ + 0x3080, /* --XX----X------- */ + 0x3080, /* --XX----X------- */ + 0x3F80, /* --XXXXXXX------- */ + 0x3080, /* --XX----X------- */ + 0x3080, /* --XX----X------- */ + 0x3000, /* --XX------------ */ + 0x3000, /* --XX------------ */ + 0x3020, /* --XX------X----- */ + 0x3020, /* --XX------X----- */ + 0x3020, /* --XX------X----- */ + 0xFFE0, /* XXXXXXXXXXX----- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000 /* ---------------- */ + }, + { /* 0x46 ('F') */ + 0x0000, /* ---------------- */ + 0xFFE0, /* XXXXXXXXXXX----- */ + 0x3020, /* --XX------X----- */ + 0x3020, /* --XX------X----- */ + 0x3000, /* --XX------------ */ + 0x3080, /* --XX----X------- */ + 0x3080, /* --XX----X------- */ + 0x3F80, /* --XXXXXXX------- */ + 0x3080, /* --XX----X------- */ + 0x3080, /* --XX----X------- */ + 0x3000, /* --XX------------ */ + 0x3000, /* --XX------------ */ + 0x3000, /* --XX------------ */ + 0x3000, /* --XX------------ */ + 0x3000, /* --XX------------ */ + 0xFC00, /* XXXXXX---------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000 /* ---------------- */ + }, + { /* 0x47 ('G') */ + 0x0000, /* ---------------- */ + 0x0F20, /* ----XXXX--X----- */ + 0x30E0, /* --XX----XXX----- */ + 0x2060, /* --X------XX----- */ + 0x6020, /* -XX-------X----- */ + 0x6020, /* -XX-------X----- */ + 0x6000, /* -XX------------- */ + 0x6000, /* -XX------------- */ + 0x61F0, /* -XX----XXXXX---- */ + 0x6060, /* -XX------XX----- */ + 0x6060, /* -XX------XX----- */ + 0x6060, /* -XX------XX----- */ + 0x6060, /* -XX------XX----- */ + 0x20E0, /* --X-----XXX----- */ + 0x3160, /* --XX---X-XX----- */ + 0x0E20, /* ----XXX---X----- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000 /* ---------------- */ + }, + { /* 0x48 ('H') */ + 0x0000, /* ---------------- */ + 0xF0F0, /* XXXX----XXXX---- */ + 0x6060, /* -XX------XX----- */ + 0x6060, /* -XX------XX----- */ + 0x6060, /* -XX------XX----- */ + 0x6060, /* -XX------XX----- */ + 0x6060, /* -XX------XX----- */ + 0x6060, /* -XX------XX----- */ + 0x7FE0, /* -XXXXXXXXXX----- */ + 0x6060, /* -XX------XX----- */ + 0x6060, /* -XX------XX----- */ + 0x6060, /* -XX------XX----- */ + 0x6060, /* -XX------XX----- */ + 0x6060, /* -XX------XX----- */ + 0x6060, /* -XX------XX----- */ + 0xF0F0, /* XXXX----XXXX---- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000 /* ---------------- */ + }, + { /* 0x49 ('I') */ + 0x0000, /* ---------------- */ + 0x1F80, /* ---XXXXXX------- */ + 0x0600, /* -----XX--------- */ + 0x0600, /* -----XX--------- */ + 0x0600, /* -----XX--------- */ + 0x0600, /* -----XX--------- */ + 0x0600, /* -----XX--------- */ + 0x0600, /* -----XX--------- */ + 0x0600, /* -----XX--------- */ + 0x0600, /* -----XX--------- */ + 0x0600, /* -----XX--------- */ + 0x0600, /* -----XX--------- */ + 0x0600, /* -----XX--------- */ + 0x0600, /* -----XX--------- */ + 0x0600, /* -----XX--------- */ + 0x1F80, /* ---XXXXXX------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000 /* ---------------- */ + }, + { /* 0x4A ('J') */ + 0x0000, /* ---------------- */ + 0x07E0, /* -----XXXXXX----- */ + 0x0180, /* -------XX------- */ + 0x0180, /* -------XX------- */ + 0x0180, /* -------XX------- */ + 0x0180, /* -------XX------- */ + 0x0180, /* -------XX------- */ + 0x0180, /* -------XX------- */ + 0x0180, /* -------XX------- */ + 0x0180, /* -------XX------- */ + 0x4180, /* -X-----XX------- */ + 0xE180, /* XXX----XX------- */ + 0xC180, /* XX-----XX------- */ + 0x4100, /* -X-----X-------- */ + 0x6300, /* -XX---XX-------- */ + 0x1C00, /* ---XXX---------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000 /* ---------------- */ + }, + { /* 0x4B ('K') */ + 0x0000, /* ---------------- */ + 0xF1C0, /* XXXX---XXX------ */ + 0x6080, /* -XX-----X------- */ + 0x6100, /* -XX----X-------- */ + 0x6200, /* -XX---X--------- */ + 0x6400, /* -XX--X---------- */ + 0x6C00, /* -XX-XX---------- */ + 0x7C00, /* -XXXXX---------- */ + 0x7600, /* -XXX-XX--------- */ + 0x6600, /* -XX--XX--------- */ + 0x6300, /* -XX---XX-------- */ + 0x6300, /* -XX---XX-------- */ + 0x6180, /* -XX----XX------- */ + 0x6180, /* -XX----XX------- */ + 0x60C0, /* -XX-----XX------ */ + 0xF1E0, /* XXXX---XXXX----- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000 /* ---------------- */ + }, + { /* 0x4C ('L') */ + 0x0000, /* ---------------- */ + 0x7800, /* -XXXX----------- */ + 0x3000, /* --XX------------ */ + 0x3000, /* --XX------------ */ + 0x3000, /* --XX------------ */ + 0x3000, /* --XX------------ */ + 0x3000, /* --XX------------ */ + 0x3000, /* --XX------------ */ + 0x3000, /* --XX------------ */ + 0x3000, /* --XX------------ */ + 0x3000, /* --XX------------ */ + 0x3000, /* --XX------------ */ + 0x3020, /* --XX------X----- */ + 0x3020, /* --XX------X----- */ + 0x3020, /* --XX------X----- */ + 0xFFE0, /* XXXXXXXXXXX----- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000 /* ---------------- */ + }, + { /* 0x4D ('M') */ + 0x0000, /* ---------------- */ + 0xE070, /* XXX------XXX---- */ + 0x6060, /* -XX------XX----- */ + 0x6060, /* -XX------XX----- */ + 0x60E0, /* -XX-----XXX----- */ + 0x70E0, /* -XXX----XXX----- */ + 0x70E0, /* -XXX----XXX----- */ + 0x59E0, /* -X-XX--XXXX----- */ + 0x5960, /* -X-XX--X-XX----- */ + 0x5960, /* -X-XX--X-XX----- */ + 0x4A60, /* -X--X-X--XX----- */ + 0x4E60, /* -X--XXX--XX----- */ + 0x4E60, /* -X--XXX--XX----- */ + 0x4460, /* -X---X---XX----- */ + 0x4460, /* -X---X---XX----- */ + 0xE4F0, /* XXX--X--XXXX---- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000 /* ---------------- */ + }, + { /* 0x4E ('N') */ + 0x0000, /* ---------------- */ + 0x71F0, /* -XXX---XXXXX---- */ + 0x3040, /* --XX-----X------ */ + 0x3040, /* --XX-----X------ */ + 0x3840, /* --XXX----X------ */ + 0x3840, /* --XXX----X------ */ + 0x2C40, /* --X-XX---X------ */ + 0x2C40, /* --X-XX---X------ */ + 0x2640, /* --X--XX--X------ */ + 0x2640, /* --X--XX--X------ */ + 0x2340, /* --X---XX-X------ */ + 0x2340, /* --X---XX-X------ */ + 0x21C0, /* --X----XXX------ */ + 0x21C0, /* --X----XXX------ */ + 0x20C0, /* --X-----XX------ */ + 0xF8C0, /* XXXXX---XX------ */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000 /* ---------------- */ + }, + { /* 0x4F ('O') */ + 0x0000, /* ---------------- */ + 0x0F00, /* ----XXXX-------- */ + 0x39C0, /* --XXX--XXX------ */ + 0x30C0, /* --XX----XX------ */ + 0x6060, /* -XX------XX----- */ + 0x6060, /* -XX------XX----- */ + 0x6060, /* -XX------XX----- */ + 0x6060, /* -XX------XX----- */ + 0x6060, /* -XX------XX----- */ + 0x6060, /* -XX------XX----- */ + 0x6060, /* -XX------XX----- */ + 0x6060, /* -XX------XX----- */ + 0x6060, /* -XX------XX----- */ + 0x30C0, /* --XX----XX------ */ + 0x39C0, /* --XXX--XXX------ */ + 0x0F00, /* ----XXXX-------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000 /* ---------------- */ + }, + { /* 0x50 ('P') */ + 0x0000, /* ---------------- */ + 0xFF00, /* XXXXXXXX-------- */ + 0x30C0, /* --XX----XX------ */ + 0x3040, /* --XX-----X------ */ + 0x3060, /* --XX-----XX----- */ + 0x3060, /* --XX-----XX----- */ + 0x3040, /* --XX-----X------ */ + 0x30C0, /* --XX----XX------ */ + 0x3F00, /* --XXXXXX-------- */ + 0x3000, /* --XX------------ */ + 0x3000, /* --XX------------ */ + 0x3000, /* --XX------------ */ + 0x3000, /* --XX------------ */ + 0x3000, /* --XX------------ */ + 0x3000, /* --XX------------ */ + 0xFC00, /* XXXXXX---------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000 /* ---------------- */ + }, + { /* 0x51 ('Q') */ + 0x0000, /* ---------------- */ + 0x0F00, /* ----XXXX-------- */ + 0x30C0, /* --XX----XX------ */ + 0x2040, /* --X------X------ */ + 0x6060, /* -XX------XX----- */ + 0x6060, /* -XX------XX----- */ + 0x6060, /* -XX------XX----- */ + 0x6060, /* -XX------XX----- */ + 0x6060, /* -XX------XX----- */ + 0x6060, /* -XX------XX----- */ + 0x6060, /* -XX------XX----- */ + 0x6260, /* -XX---X--XX----- */ + 0x6F40, /* -XX-XXXX-X------ */ + 0x29C0, /* --X-X--XXX------ */ + 0x3190, /* --XX---XX--X---- */ + 0x0F90, /* ----XXXXX--X---- */ + 0x00E0, /* --------XXX----- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000 /* ---------------- */ + }, + { /* 0x52 ('R') */ + 0x0000, /* ---------------- */ + 0xFF00, /* XXXXXXXX-------- */ + 0x30C0, /* --XX----XX------ */ + 0x3040, /* --XX-----X------ */ + 0x3060, /* --XX-----XX----- */ + 0x3040, /* --XX-----X------ */ + 0x30C0, /* --XX----XX------ */ + 0x3F00, /* --XXXXXX-------- */ + 0x3180, /* --XX---XX------- */ + 0x30C0, /* --XX----XX------ */ + 0x30C0, /* --XX----XX------ */ + 0x30C0, /* --XX----XX------ */ + 0x30C0, /* --XX----XX------ */ + 0x30C0, /* --XX----XX------ */ + 0x30C0, /* --XX----XX------ */ + 0xFC70, /* XXXXXX---XXX---- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000 /* ---------------- */ + }, + { /* 0x53 ('S') */ + 0x0000, /* ---------------- */ + 0x0F20, /* ----XXXX--X----- */ + 0x31E0, /* --XX---XXXX----- */ + 0x2060, /* --X------XX----- */ + 0x6020, /* -XX-------X----- */ + 0x6000, /* -XX------------- */ + 0x3000, /* --XX------------ */ + 0x3800, /* --XXX----------- */ + 0x0F00, /* ----XXXX-------- */ + 0x01C0, /* -------XXX------ */ + 0x40C0, /* -X------XX------ */ + 0x4060, /* -X-------XX----- */ + 0x6060, /* -XX------XX----- */ + 0x6040, /* -XX------X------ */ + 0x70C0, /* -XXX----XX------ */ + 0x4F00, /* -X--XXXX-------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000 /* ---------------- */ + }, + { /* 0x54 ('T') */ + 0x0000, /* ---------------- */ + 0x7FE0, /* -XXXXXXXXXX----- */ + 0x4620, /* -X---XX---X----- */ + 0x4620, /* -X---XX---X----- */ + 0x0600, /* -----XX--------- */ + 0x0600, /* -----XX--------- */ + 0x0600, /* -----XX--------- */ + 0x0600, /* -----XX--------- */ + 0x0600, /* -----XX--------- */ + 0x0600, /* -----XX--------- */ + 0x0600, /* -----XX--------- */ + 0x0600, /* -----XX--------- */ + 0x0600, /* -----XX--------- */ + 0x0600, /* -----XX--------- */ + 0x0600, /* -----XX--------- */ + 0x1F80, /* ---XXXXXX------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000 /* ---------------- */ + }, + { /* 0x55 ('U') */ + 0x0000, /* ---------------- */ + 0xF0F0, /* XXXX----XXXX---- */ + 0x6060, /* -XX------XX----- */ + 0x6060, /* -XX------XX----- */ + 0x6060, /* -XX------XX----- */ + 0x6060, /* -XX------XX----- */ + 0x6060, /* -XX------XX----- */ + 0x6060, /* -XX------XX----- */ + 0x6060, /* -XX------XX----- */ + 0x6060, /* -XX------XX----- */ + 0x6060, /* -XX------XX----- */ + 0x6060, /* -XX------XX----- */ + 0x6060, /* -XX------XX----- */ + 0x2040, /* --X------X------ */ + 0x30C0, /* --XX----XX------ */ + 0x0F00, /* ----XXXX-------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000 /* ---------------- */ + }, + { /* 0x56 ('V') */ + 0x0000, /* ---------------- */ + 0xF0E0, /* XXXX----XXX----- */ + 0x6040, /* -XX------X------ */ + 0x6040, /* -XX------X------ */ + 0x3080, /* --XX----X------- */ + 0x3080, /* --XX----X------- */ + 0x3080, /* --XX----X------- */ + 0x3100, /* --XX---X-------- */ + 0x1900, /* ---XX--X-------- */ + 0x1900, /* ---XX--X-------- */ + 0x1900, /* ---XX--X-------- */ + 0x0E00, /* ----XXX--------- */ + 0x0E00, /* ----XXX--------- */ + 0x0E00, /* ----XXX--------- */ + 0x0400, /* -----X---------- */ + 0x0400, /* -----X---------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000 /* ---------------- */ + }, + { /* 0x57 ('W') */ + 0x0000, /* ---------------- */ + 0xF770, /* XXXX-XXX-XXX---- */ + 0x6220, /* -XX---X---X----- */ + 0x6220, /* -XX---X---X----- */ + 0x6220, /* -XX---X---X----- */ + 0x6320, /* -XX---XX--X----- */ + 0x3740, /* --XX-XXX-X------ */ + 0x3740, /* --XX-XXX-X------ */ + 0x3740, /* --XX-XXX-X------ */ + 0x3540, /* --XX-X-X-X------ */ + 0x35C0, /* --XX-X-XXX------ */ + 0x35C0, /* --XX-X-XXX------ */ + 0x1980, /* ---XX--XX------- */ + 0x1980, /* ---XX--XX------- */ + 0x1880, /* ---XX---X------- */ + 0x1880, /* ---XX---X------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000 /* ---------------- */ + }, + { /* 0x58 ('X') */ + 0x0000, /* ---------------- */ + 0xF070, /* XXXX-----XXX---- */ + 0x6020, /* -XX-------X----- */ + 0x3040, /* --XX-----X------ */ + 0x3080, /* --XX----X------- */ + 0x1880, /* ---XX---X------- */ + 0x0D00, /* ----XX-X-------- */ + 0x0E00, /* ----XXX--------- */ + 0x0600, /* -----XX--------- */ + 0x0700, /* -----XXX-------- */ + 0x0B00, /* ----X-XX-------- */ + 0x1180, /* ---X---XX------- */ + 0x20C0, /* --X-----XX------ */ + 0x20C0, /* --X-----XX------ */ + 0x4060, /* -X-------XX----- */ + 0xE0F0, /* XXX-----XXXX---- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000 /* ---------------- */ + }, + { /* 0x59 ('Y') */ + 0x0000, /* ---------------- */ + 0xF070, /* XXXX-----XXX---- */ + 0x6020, /* -XX-------X----- */ + 0x3040, /* --XX-----X------ */ + 0x3040, /* --XX-----X------ */ + 0x1880, /* ---XX---X------- */ + 0x1900, /* ---XX--X-------- */ + 0x0D00, /* ----XX-X-------- */ + 0x0E00, /* ----XXX--------- */ + 0x0600, /* -----XX--------- */ + 0x0600, /* -----XX--------- */ + 0x0600, /* -----XX--------- */ + 0x0600, /* -----XX--------- */ + 0x0600, /* -----XX--------- */ + 0x0600, /* -----XX--------- */ + 0x1F80, /* ---XXXXXX------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000 /* ---------------- */ + }, + { /* 0x5A ('Z') */ + 0x0000, /* ---------------- */ + 0x7FE0, /* -XXXXXXXXXX----- */ + 0x4060, /* -X-------XX----- */ + 0x40C0, /* -X------XX------ */ + 0x0180, /* -------XX------- */ + 0x0180, /* -------XX------- */ + 0x0300, /* ------XX-------- */ + 0x0600, /* -----XX--------- */ + 0x0C00, /* ----XX---------- */ + 0x0C00, /* ----XX---------- */ + 0x1800, /* ---XX----------- */ + 0x3000, /* --XX------------ */ + 0x6020, /* -XX-------X----- */ + 0x6020, /* -XX-------X----- */ + 0xC020, /* XX--------X----- */ + 0xFFE0, /* XXXXXXXXXXX----- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000 /* ---------------- */ + }, + { /* 0x5B ('[') */ + 0x07E0, /* -----XXXXXX----- */ + 0x07E0, /* -----XXXXXX----- */ + 0x0600, /* -----XX--------- */ + 0x0600, /* -----XX--------- */ + 0x0600, /* -----XX--------- */ + 0x0600, /* -----XX--------- */ + 0x0600, /* -----XX--------- */ + 0x0600, /* -----XX--------- */ + 0x0600, /* -----XX--------- */ + 0x0600, /* -----XX--------- */ + 0x0600, /* -----XX--------- */ + 0x0600, /* -----XX--------- */ + 0x0600, /* -----XX--------- */ + 0x0600, /* -----XX--------- */ + 0x0600, /* -----XX--------- */ + 0x07E0, /* -----XXXXXX----- */ + 0x07E0, /* -----XXXXXX----- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000 /* ---------------- */ + }, + { /* 0x5C ('\') */ + 0x4000, /* -X-------------- */ + 0x6000, /* -XX------------- */ + 0x2000, /* --X------------- */ + 0x3000, /* --XX------------ */ + 0x1000, /* ---X------------ */ + 0x1800, /* ---XX----------- */ + 0x0C00, /* ----XX---------- */ + 0x0400, /* -----X---------- */ + 0x0600, /* -----XX--------- */ + 0x0200, /* ------X--------- */ + 0x0300, /* ------XX-------- */ + 0x0180, /* -------XX------- */ + 0x0080, /* --------X------- */ + 0x00C0, /* --------XX------ */ + 0x0040, /* ---------X------ */ + 0x0060, /* ---------XX----- */ + 0x0020, /* ----------X----- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000 /* ---------------- */ + }, + { /* 0x5D (']') */ + 0x7E00, /* -XXXXXX--------- */ + 0x7E00, /* -XXXXXX--------- */ + 0x0600, /* -----XX--------- */ + 0x0600, /* -----XX--------- */ + 0x0600, /* -----XX--------- */ + 0x0600, /* -----XX--------- */ + 0x0600, /* -----XX--------- */ + 0x0600, /* -----XX--------- */ + 0x0600, /* -----XX--------- */ + 0x0600, /* -----XX--------- */ + 0x0600, /* -----XX--------- */ + 0x0600, /* -----XX--------- */ + 0x0600, /* -----XX--------- */ + 0x0600, /* -----XX--------- */ + 0x0600, /* -----XX--------- */ + 0x7E00, /* -XXXXXX--------- */ + 0x7E00, /* -XXXXXX--------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000 /* ---------------- */ + }, + { /* 0x5E ('^') */ + 0x0400, /* -----X---------- */ + 0x0E00, /* ----XXX--------- */ + 0x1B00, /* ---XX-XX-------- */ + 0x3180, /* --XX---XX------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000 /* ---------------- */ + }, + { /* 0x5F ('_') */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0xFFF0, /* XXXXXXXXXXXX---- */ + 0xFFF0 /* XXXXXXXXXXXX---- */ + }, + { /* 0x60 ('`') */ + 0x0400, /* -----X---------- */ + 0x0C00, /* ----XX---------- */ + 0x0600, /* -----XX--------- */ + 0x0200, /* ------X--------- */ + 0x0100, /* -------X-------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000 /* ---------------- */ + }, + { /* 0x61 ('a') */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0E00, /* ----XXX--------- */ + 0x3300, /* --XX--XX-------- */ + 0x7180, /* -XXX---XX------- */ + 0x0180, /* -------XX------- */ + 0x0F80, /* ----XXXXX------- */ + 0x3180, /* --XX---XX------- */ + 0x6180, /* -XX----XX------- */ + 0x6180, /* -XX----XX------- */ + 0x6180, /* -XX----XX------- */ + 0x3390, /* --XX--XXX--X---- */ + 0x1CE0, /* ---XXX--XXX----- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000 /* ---------------- */ + }, + { /* 0x62 ('b') */ + 0x0000, /* ---------------- */ + 0x7800, /* -XXXX----------- */ + 0x1800, /* ---XX----------- */ + 0x1800, /* ---XX----------- */ + 0x1800, /* ---XX----------- */ + 0x1800, /* ---XX----------- */ + 0x1B00, /* ---XX-XX-------- */ + 0x1CC0, /* ---XXX--XX------ */ + 0x1840, /* ---XX----X------ */ + 0x1860, /* ---XX----XX----- */ + 0x1860, /* ---XX----XX----- */ + 0x1860, /* ---XX----XX----- */ + 0x1860, /* ---XX----XX----- */ + 0x1840, /* ---XX----X------ */ + 0x1CC0, /* ---XXX--XX------ */ + 0x1300, /* ---X--XX-------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000 /* ---------------- */ + }, + { /* 0x63 ('c') */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0600, /* -----XX--------- */ + 0x1980, /* ---XX--XX------- */ + 0x1080, /* ---X----X------- */ + 0x31C0, /* --XX---XXX------ */ + 0x3080, /* --XX----X------- */ + 0x3000, /* --XX------------ */ + 0x3000, /* --XX------------ */ + 0x3040, /* --XX-----X------ */ + 0x1080, /* ---X----X------- */ + 0x1980, /* ---XX--XX------- */ + 0x0600, /* -----XX--------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000 /* ---------------- */ + }, + { /* 0x64 ('d') */ + 0x0000, /* ---------------- */ + 0x0780, /* -----XXXX------- */ + 0x0180, /* -------XX------- */ + 0x0180, /* -------XX------- */ + 0x0180, /* -------XX------- */ + 0x0180, /* -------XX------- */ + 0x0D80, /* ----XX-XX------- */ + 0x3380, /* --XX--XXX------- */ + 0x2180, /* --X----XX------- */ + 0x6180, /* -XX----XX------- */ + 0x6180, /* -XX----XX------- */ + 0x6180, /* -XX----XX------- */ + 0x6180, /* -XX----XX------- */ + 0x2180, /* --X----XX------- */ + 0x3380, /* --XX--XXX------- */ + 0x0DE0, /* ----XX-XXXX----- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000 /* ---------------- */ + }, + { /* 0x65 ('e') */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0600, /* -----XX--------- */ + 0x1980, /* ---XX--XX------- */ + 0x30C0, /* --XX----XX------ */ + 0x30C0, /* --XX----XX------ */ + 0x30C0, /* --XX----XX------ */ + 0x3FC0, /* --XXXXXXXX------ */ + 0x3000, /* --XX------------ */ + 0x3000, /* --XX------------ */ + 0x3040, /* --XX-----X------ */ + 0x1880, /* ---XX---X------- */ + 0x0700, /* -----XXX-------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000 /* ---------------- */ + }, + { /* 0x66 ('f') */ + 0x0000, /* ---------------- */ + 0x0380, /* ------XXX------- */ + 0x0640, /* -----XX--X------ */ + 0x0660, /* -----XX--XX----- */ + 0x0640, /* -----XX--X------ */ + 0x0600, /* -----XX--------- */ + 0x0600, /* -----XX--------- */ + 0x3FC0, /* --XXXXXXXX------ */ + 0x0600, /* -----XX--------- */ + 0x0600, /* -----XX--------- */ + 0x0600, /* -----XX--------- */ + 0x0600, /* -----XX--------- */ + 0x0600, /* -----XX--------- */ + 0x0600, /* -----XX--------- */ + 0x0600, /* -----XX--------- */ + 0x1F80, /* ---XXXXXX------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000 /* ---------------- */ + }, + { /* 0x67 ('g') */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0060, /* ---------XX----- */ + 0x00E0, /* --------XXX----- */ + 0x0F80, /* ----XXXXX------- */ + 0x1980, /* ---XX--XX------- */ + 0x30C0, /* --XX----XX------ */ + 0x30C0, /* --XX----XX------ */ + 0x3980, /* --XXX--XX------- */ + 0x1F00, /* ---XXXXX-------- */ + 0x3000, /* --XX------------ */ + 0x2000, /* --X------------- */ + 0x3F00, /* --XXXXXX-------- */ + 0x3FC0, /* --XXXXXXXX------ */ + 0x60E0, /* -XX-----XXX----- */ + 0x6060, /* -XX------XX----- */ + 0x30C0, /* --XX----XX------ */ + 0x1F80 /* ---XXXXXX------- */ + }, + { /* 0x68 ('h') */ + 0x0000, /* ---------------- */ + 0x7000, /* -XXX------------ */ + 0x3000, /* --XX------------ */ + 0x3000, /* --XX------------ */ + 0x3000, /* --XX------------ */ + 0x3000, /* --XX------------ */ + 0x3600, /* --XX-XX--------- */ + 0x3980, /* --XXX--XX------- */ + 0x3080, /* --XX----X------- */ + 0x30C0, /* --XX----XX------ */ + 0x30C0, /* --XX----XX------ */ + 0x30C0, /* --XX----XX------ */ + 0x30C0, /* --XX----XX------ */ + 0x30C0, /* --XX----XX------ */ + 0x30C0, /* --XX----XX------ */ + 0x79E0, /* -XXXX--XXXX----- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000 /* ---------------- */ + }, + { /* 0x69 ('i') */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0600, /* -----XX--------- */ + 0x0600, /* -----XX--------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0E00, /* ----XXX--------- */ + 0x0600, /* -----XX--------- */ + 0x0600, /* -----XX--------- */ + 0x0600, /* -----XX--------- */ + 0x0600, /* -----XX--------- */ + 0x0600, /* -----XX--------- */ + 0x0600, /* -----XX--------- */ + 0x0600, /* -----XX--------- */ + 0x0600, /* -----XX--------- */ + 0x0F00, /* ----XXXX-------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000 /* ---------------- */ + }, + { /* 0x6A ('j') */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0300, /* ------XX-------- */ + 0x0300, /* ------XX-------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0700, /* -----XXX-------- */ + 0x0300, /* ------XX-------- */ + 0x0300, /* ------XX-------- */ + 0x0300, /* ------XX-------- */ + 0x0300, /* ------XX-------- */ + 0x0300, /* ------XX-------- */ + 0x0300, /* ------XX-------- */ + 0x0300, /* ------XX-------- */ + 0x2300, /* --X---XX-------- */ + 0x7300, /* -XXX--XX-------- */ + 0x6300, /* -XX---XX-------- */ + 0x3600, /* --XX-XX--------- */ + 0x1C00, /* ---XXX---------- */ + 0x0000 /* ---------------- */ + }, + { /* 0x6B ('k') */ + 0x0000, /* ---------------- */ + 0xF000, /* XXXX------------ */ + 0x3000, /* --XX------------ */ + 0x3000, /* --XX------------ */ + 0x3000, /* --XX------------ */ + 0x31E0, /* --XX---XXXX----- */ + 0x3080, /* --XX----X------- */ + 0x3100, /* --XX---X-------- */ + 0x3600, /* --XX-XX--------- */ + 0x3C00, /* --XXXX---------- */ + 0x3E00, /* --XXXXX--------- */ + 0x3300, /* --XX--XX-------- */ + 0x3300, /* --XX--XX-------- */ + 0x3180, /* --XX---XX------- */ + 0x30C0, /* --XX----XX------ */ + 0x79F0, /* -XXXX--XXXXX---- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000 /* ---------------- */ + }, + { /* 0x6C ('l') */ + 0x0000, /* ---------------- */ + 0x1E00, /* ---XXXX--------- */ + 0x0600, /* -----XX--------- */ + 0x0600, /* -----XX--------- */ + 0x0600, /* -----XX--------- */ + 0x0600, /* -----XX--------- */ + 0x0600, /* -----XX--------- */ + 0x0600, /* -----XX--------- */ + 0x0600, /* -----XX--------- */ + 0x0600, /* -----XX--------- */ + 0x0600, /* -----XX--------- */ + 0x0600, /* -----XX--------- */ + 0x0600, /* -----XX--------- */ + 0x0600, /* -----XX--------- */ + 0x0600, /* -----XX--------- */ + 0x1F80, /* ---XXXXXX------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000 /* ---------------- */ + }, + { /* 0x6D ('m') */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0xECC0, /* XXX-XX--XX------ */ + 0x7760, /* -XXX-XXX-XX----- */ + 0x6660, /* -XX--XX--XX----- */ + 0x6660, /* -XX--XX--XX----- */ + 0x6660, /* -XX--XX--XX----- */ + 0x6660, /* -XX--XX--XX----- */ + 0x6660, /* -XX--XX--XX----- */ + 0x6660, /* -XX--XX--XX----- */ + 0x6660, /* -XX--XX--XX----- */ + 0x6660, /* -XX--XX--XX----- */ + 0xFFF0, /* XXXXXXXXXXXX---- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000 /* ---------------- */ + }, + { /* 0x6E ('n') */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x6600, /* -XX--XX--------- */ + 0x3980, /* --XXX--XX------- */ + 0x3080, /* --XX----X------- */ + 0x30C0, /* --XX----XX------ */ + 0x30C0, /* --XX----XX------ */ + 0x30C0, /* --XX----XX------ */ + 0x30C0, /* --XX----XX------ */ + 0x30C0, /* --XX----XX------ */ + 0x30C0, /* --XX----XX------ */ + 0x30C0, /* --XX----XX------ */ + 0x79E0, /* -XXXX--XXXX----- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000 /* ---------------- */ + }, + { /* 0x6F ('o') */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0600, /* -----XX--------- */ + 0x1980, /* ---XX--XX------- */ + 0x1080, /* ---X----X------- */ + 0x30C0, /* --XX----XX------ */ + 0x30C0, /* --XX----XX------ */ + 0x30C0, /* --XX----XX------ */ + 0x30C0, /* --XX----XX------ */ + 0x30C0, /* --XX----XX------ */ + 0x1080, /* ---X----X------- */ + 0x1980, /* ---XX--XX------- */ + 0x0600, /* -----XX--------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000 /* ---------------- */ + }, + { /* 0x70 ('p') */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x7B00, /* -XXXX-XX-------- */ + 0x1CC0, /* ---XXX--XX------ */ + 0x1840, /* ---XX----X------ */ + 0x1860, /* ---XX----XX----- */ + 0x1860, /* ---XX----XX----- */ + 0x1860, /* ---XX----XX----- */ + 0x1860, /* ---XX----XX----- */ + 0x1840, /* ---XX----X------ */ + 0x1CC0, /* ---XXX--XX------ */ + 0x1B00, /* ---XX-XX-------- */ + 0x1800, /* ---XX----------- */ + 0x1800, /* ---XX----------- */ + 0x1800, /* ---XX----------- */ + 0x1800, /* ---XX----------- */ + 0x7E00 /* -XXXXXX--------- */ + }, + { /* 0x71 ('q') */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0C80, /* ----XX--X------- */ + 0x3380, /* --XX--XXX------- */ + 0x2180, /* --X----XX------- */ + 0x6180, /* -XX----XX------- */ + 0x6180, /* -XX----XX------- */ + 0x6180, /* -XX----XX------- */ + 0x6180, /* -XX----XX------- */ + 0x2180, /* --X----XX------- */ + 0x3380, /* --XX--XXX------- */ + 0x0D80, /* ----XX-XX------- */ + 0x0180, /* -------XX------- */ + 0x0180, /* -------XX------- */ + 0x0180, /* -------XX------- */ + 0x0180, /* -------XX------- */ + 0x07E0 /* -----XXXXXX----- */ + }, + { /* 0x72 ('r') */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x7980, /* -XXXX--XX------- */ + 0x1A40, /* ---XX-X--X------ */ + 0x1A40, /* ---XX-X--X------ */ + 0x1CE0, /* ---XXX--XXX----- */ + 0x1C40, /* ---XXX---X------ */ + 0x1800, /* ---XX----------- */ + 0x1800, /* ---XX----------- */ + 0x1800, /* ---XX----------- */ + 0x1800, /* ---XX----------- */ + 0x1800, /* ---XX----------- */ + 0x7E00, /* -XXXXXX--------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000 /* ---------------- */ + }, + { /* 0x73 ('s') */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x1E40, /* ---XXXX--X------ */ + 0x31C0, /* --XX---XXX------ */ + 0x60C0, /* -XX-----XX------ */ + 0x7040, /* -XXX-----X------ */ + 0x3C00, /* --XXXX---------- */ + 0x1F00, /* ---XXXXX-------- */ + 0x4780, /* -X---XXXX------- */ + 0x41C0, /* -X-----XXX------ */ + 0x60C0, /* -XX-----XX------ */ + 0x7180, /* -XXX---XX------- */ + 0x4F00, /* -X--XXXX-------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000 /* ---------------- */ + }, + { /* 0x74 ('t') */ + 0x0000, /* ---------------- */ + 0x0400, /* -----X---------- */ + 0x0C00, /* ----XX---------- */ + 0x0C00, /* ----XX---------- */ + 0x1C00, /* ---XXX---------- */ + 0x7F80, /* -XXXXXXXX------- */ + 0x0C00, /* ----XX---------- */ + 0x0C00, /* ----XX---------- */ + 0x0C00, /* ----XX---------- */ + 0x0C00, /* ----XX---------- */ + 0x0C00, /* ----XX---------- */ + 0x0C00, /* ----XX---------- */ + 0x0C80, /* ----XX--X------- */ + 0x0C80, /* ----XX--X------- */ + 0x0C80, /* ----XX--X------- */ + 0x0700, /* -----XXX-------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000 /* ---------------- */ + }, + { /* 0x75 ('u') */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0xF3C0, /* XXXX--XXXX------ */ + 0x30C0, /* --XX----XX------ */ + 0x30C0, /* --XX----XX------ */ + 0x30C0, /* --XX----XX------ */ + 0x30C0, /* --XX----XX------ */ + 0x30C0, /* --XX----XX------ */ + 0x30C0, /* --XX----XX------ */ + 0x30C0, /* --XX----XX------ */ + 0x10C0, /* ---X----XX------ */ + 0x19C0, /* ---XX--XXX------ */ + 0x06F0, /* -----XX-XXXX---- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000 /* ---------------- */ + }, + { /* 0x76 ('v') */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0xF9E0, /* XXXXX--XXXX----- */ + 0x3080, /* --XX----X------- */ + 0x3080, /* --XX----X------- */ + 0x1900, /* ---XX--X-------- */ + 0x1900, /* ---XX--X-------- */ + 0x1900, /* ---XX--X-------- */ + 0x0E00, /* ----XXX--------- */ + 0x0E00, /* ----XXX--------- */ + 0x0E00, /* ----XXX--------- */ + 0x0400, /* -----X---------- */ + 0x0400, /* -----X---------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000 /* ---------------- */ + }, + { /* 0x77 ('w') */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0xFFF0, /* XXXXXXXXXXXX---- */ + 0x6660, /* -XX--XX--XX----- */ + 0x6660, /* -XX--XX--XX----- */ + 0x2640, /* --X--XX--X------ */ + 0x3FC0, /* --XXXXXXXX------ */ + 0x39C0, /* --XXX--XXX------ */ + 0x39C0, /* --XXX--XXX------ */ + 0x39C0, /* --XXX--XXX------ */ + 0x1980, /* ---XX--XX------- */ + 0x1080, /* ---X----X------- */ + 0x1080, /* ---X----X------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000 /* ---------------- */ + }, + { /* 0x78 ('x') */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x70F0, /* -XXX----XXXX---- */ + 0x2060, /* --X------XX----- */ + 0x10C0, /* ---X----XX------ */ + 0x0980, /* ----X--XX------- */ + 0x0700, /* -----XXX-------- */ + 0x0600, /* -----XX--------- */ + 0x0D00, /* ----XX-X-------- */ + 0x1880, /* ---XX---X------- */ + 0x3040, /* --XX-----X------ */ + 0x6020, /* -XX-------X----- */ + 0xF070, /* XXXX-----XXX---- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000 /* ---------------- */ + }, + { /* 0x79 ('y') */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x7870, /* -XXXX----XXX---- */ + 0x3020, /* --XX------X----- */ + 0x1820, /* ---XX-----X----- */ + 0x1840, /* ---XX----X------ */ + 0x1840, /* ---XX----X------ */ + 0x0C40, /* ----XX---X------ */ + 0x0C80, /* ----XX--X------- */ + 0x0680, /* -----XX-X------- */ + 0x0780, /* -----XXXX------- */ + 0x0700, /* -----XXX-------- */ + 0x0700, /* -----XXX-------- */ + 0x4600, /* -X---XX--------- */ + 0xE600, /* XXX--XX--------- */ + 0x4C00, /* -X--XX---------- */ + 0x3800 /* --XXX----------- */ + }, + { /* 0x7A ('z') */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x3FC0, /* --XXXXXXXX------ */ + 0x20C0, /* --X-----XX------ */ + 0x2180, /* --X----XX------- */ + 0x0300, /* ------XX-------- */ + 0x0300, /* ------XX-------- */ + 0x0600, /* -----XX--------- */ + 0x0C00, /* ----XX---------- */ + 0x1800, /* ---XX----------- */ + 0x1840, /* ---XX----X------ */ + 0x3040, /* --XX-----X------ */ + 0x7FC0, /* -XXXXXXXXX------ */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000 /* ---------------- */ + }, + { /* 0x7B ('{') */ + 0x00E0, /* --------XXX----- */ + 0x0180, /* -------XX------- */ + 0x0180, /* -------XX------- */ + 0x0180, /* -------XX------- */ + 0x0180, /* -------XX------- */ + 0x0180, /* -------XX------- */ + 0x0180, /* -------XX------- */ + 0x0300, /* ------XX-------- */ + 0x0400, /* -----X---------- */ + 0x0300, /* ------XX-------- */ + 0x0180, /* -------XX------- */ + 0x0180, /* -------XX------- */ + 0x0180, /* -------XX------- */ + 0x0180, /* -------XX------- */ + 0x0180, /* -------XX------- */ + 0x0180, /* -------XX------- */ + 0x00E0, /* --------XXX----- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000 /* ---------------- */ + }, + { /* 0x7C ('|') */ + 0x0600, /* -----XX--------- */ + 0x0600, /* -----XX--------- */ + 0x0600, /* -----XX--------- */ + 0x0600, /* -----XX--------- */ + 0x0600, /* -----XX--------- */ + 0x0600, /* -----XX--------- */ + 0x0600, /* -----XX--------- */ + 0x0600, /* -----XX--------- */ + 0x0600, /* -----XX--------- */ + 0x0600, /* -----XX--------- */ + 0x0600, /* -----XX--------- */ + 0x0600, /* -----XX--------- */ + 0x0600, /* -----XX--------- */ + 0x0600, /* -----XX--------- */ + 0x0600, /* -----XX--------- */ + 0x0600, /* -----XX--------- */ + 0x0600, /* -----XX--------- */ + 0x0600, /* -----XX--------- */ + 0x0600, /* -----XX--------- */ + 0x0600 /* -----XX--------- */ + }, + { /* 0x7D ('}') */ + 0x7000, /* -XXX------------ */ + 0x1800, /* ---XX----------- */ + 0x1800, /* ---XX----------- */ + 0x1800, /* ---XX----------- */ + 0x1800, /* ---XX----------- */ + 0x1800, /* ---XX----------- */ + 0x1800, /* ---XX----------- */ + 0x0C00, /* ----XX---------- */ + 0x0200, /* ------X--------- */ + 0x0C00, /* ----XX---------- */ + 0x1800, /* ---XX----------- */ + 0x1800, /* ---XX----------- */ + 0x1800, /* ---XX----------- */ + 0x1800, /* ---XX----------- */ + 0x1800, /* ---XX----------- */ + 0x1800, /* ---XX----------- */ + 0x7000, /* -XXX------------ */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000 /* ---------------- */ + }, + { /* 0x7E ('~') */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x1810, /* ---XX------X---- */ + 0x3E60, /* --XXXXX--XX----- */ + 0x67C0, /* -XX--XXXXX------ */ + 0x8300, /* X-----XX-------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000 /* ---------------- */ + }, + { /* 0x7F */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000, /* ---------------- */ + 0x0000 /* ---------------- */ + } +}; diff --git a/sys/arch/luna88k/stand/boot/getline.c b/sys/arch/luna88k/stand/boot/getline.c new file mode 100644 index 00000000000..2e400b720a2 --- /dev/null +++ b/sys/arch/luna88k/stand/boot/getline.c @@ -0,0 +1,119 @@ +/* $OpenBSD: getline.c,v 1.1 2013/10/28 22:13:12 miod Exp $ */ +/* $NetBSD: getline.c,v 1.2 2013/01/20 07:32:45 tsutsui Exp $ */ + +/* + * Copyright (c) 1992 OMRON Corporation. + * + * This code is derived from software contributed to Berkeley by + * OMRON Corporation. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)getline.c 8.1 (Berkeley) 6/10/93 + */ +/* + * Copyright (c) 1992, 1993 + * The Regents of the University of California. All rights reserved. + * + * This code is derived from software contributed to Berkeley by + * OMRON Corporation. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)getline.c 8.1 (Berkeley) 6/10/93 + */ + +/* + * getline -- simple getline function + * by A.Fujita, Dec-11-1992 + */ + +#include <lib/libkern/libkern.h> +#include <luna88k/stand/boot/samachdep.h> + +int +getline(char *prompt, char *buff) +{ + int c; + char *p = buff; + + printf("%s", prompt); + + for(;;) { + c = getchar() & 0x7F; + + switch (c) { + case 0x0a: + case 0x0d: + putchar('\n'); + *p = '\0'; + goto outloop; + + case 0x08: + case 0x7f: + if (p > buff) { + putchar(0x08); + putchar(' '); + putchar(0x08); + p--; + } + break; + + default: + *p++ = c; + putchar(c); + break; + } + } + + outloop: + return(strlen(buff)); +} diff --git a/sys/arch/luna88k/stand/boot/getsecs.c b/sys/arch/luna88k/stand/boot/getsecs.c new file mode 100644 index 00000000000..f5adf90bc47 --- /dev/null +++ b/sys/arch/luna88k/stand/boot/getsecs.c @@ -0,0 +1,81 @@ +/* $OpenBSD: getsecs.c,v 1.1 2013/10/28 22:13:12 miod Exp $ */ +/* $NetBSD: getsecs.c,v 1.1 2013/01/13 14:10:55 tsutsui Exp $ */ + +/*- + * Copyright (c) 2004 The NetBSD Foundation, Inc. + * All rights reserved. + * + * This code is derived from software contributed to The NetBSD Foundation + * by UCHIYAMA Yasushi. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#include <luna88k/stand/boot/samachdep.h> +#include <machine/board.h> +#include <luna88k/dev/timekeeper.h> + +#define _DS_GET(off, data) \ + do { *chiptime = (off); (data) = (*chipdata); } while (0) +#define _DS_SET(off, data) \ + do { *chiptime = (off); *chipdata = (u_int8_t)(data); } while (0) + +time_t +getsecs(void) +{ + u_int t; + + if (machtype == LUNA_88K) { + volatile uint32_t *mclock = + (volatile uint32_t *)(0x45000000 + MK_NVRAM_SPACE); + mclock[MK_CSR] |= MK_CSR_READ << 24; + t = bcdtobin(mclock[MK_SEC] >> 24); + t += bcdtobin(mclock[MK_MIN] >> 24) * 60; + t += bcdtobin(mclock[MK_HOUR] >> 24) * 60 * 60; + mclock[MK_CSR] &= ~(MK_CSR_READ << 24); + } else { + volatile uint8_t *chiptime = (volatile uint8_t *)0x45000000; + volatile u_int8_t *chipdata = chiptime + 1; + + uint8_t c; + + /* specify 24hr and BCD mode */ + _DS_GET(DS_REGB, c); + c |= DS_REGB_24HR; + c &= ~DS_REGB_BINARY; + _DS_SET(DS_REGB, c); + + /* update in progress; spin loop */ + *chiptime = DS_REGA; + while (*chipdata & DS_REGA_UIP) + ; + + *chiptime = DS_SEC; + t = bcdtobin(*chipdata); + *chiptime = DS_MIN; + t += bcdtobin(*chipdata) * 60; + *chiptime = DS_HOUR; + t += bcdtobin(*chipdata) * 60 * 60; + } + + return (time_t)t; +} diff --git a/sys/arch/luna88k/stand/boot/if_le.c b/sys/arch/luna88k/stand/boot/if_le.c new file mode 100644 index 00000000000..29fe1e61dc7 --- /dev/null +++ b/sys/arch/luna88k/stand/boot/if_le.c @@ -0,0 +1,287 @@ +/* $OpenBSD: if_le.c,v 1.1 2013/10/28 22:13:12 miod Exp $ */ +/* $NetBSD: if_le.c,v 1.3 2013/01/22 15:48:40 tsutsui Exp $ */ + +/* + * Copyright (c) 2013 Izumi Tsutsui. All rights reserved. + * Copyright (c) 2003 Tetsuya Isaki. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ +/* + * Copyright (c) 1982, 1990, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * from: hp300/dev/if_le.c 7.16 (Berkeley) 3/11/93 + * + * @(#)if_le.c 8.1 (Berkeley) 6/10/93 + */ + +#include <sys/param.h> + +#include <netinet/in.h> +#include <netinet/in_systm.h> + +#include <luna88k/stand/boot/samachdep.h> +#include <machine/board.h> +#include <lib/libsa/net.h> +#include <lib/libsa/netif.h> + +#include <luna88k/stand/boot/device.h> + +/* libsa netif_driver glue functions */ +static int le_match(struct netif *, void *); +static int le_probe(struct netif *, void *); +static void le_init(struct iodesc *, void *); +static int le_get(struct iodesc *, void *, size_t, time_t); +static int le_put(struct iodesc *, void *, size_t); +static void le_end(struct netif *); + +static void myetheraddr(uint8_t *); + +/* luna88k driver glue stuff */ +struct driver ledriver = { + leinit, + "le" +}; + +/* libsa netif glue stuff */ +struct netif_stats le_stats; +struct netif_dif le_ifs[] = { + { 0, 1, &le_stats, 0, 0, }, +}; + +struct netif_driver le_netif_driver = { + "le", + le_match, + le_probe, + le_init, + le_get, + le_put, + le_end, + le_ifs, + sizeof(le_ifs) / sizeof(le_ifs[0]), +}; + +#ifdef DEBUG +int debug; +#endif + +int +leinit(void *arg) +{ + struct hp_device *hd = arg; + void *cookie; + void *reg, *mem; + uint8_t eaddr[6]; + + reg = hd->hp_addr; + mem = (void *)0x71010000; /* XXX */ + + myetheraddr(eaddr); + + cookie = lance_attach(hd->hp_unit, reg, mem, eaddr); + if (cookie == NULL) + return 0; + + printf("%s%d: Am7990 LANCE Ethernet, mem at 0x%x\n", + hd->hp_driver->d_name, hd->hp_unit, (uint32_t)mem); + printf("%s%d: Ethernet address = %s\n", + hd->hp_driver->d_name, hd->hp_unit, + ether_sprintf(eaddr)); + + return 1; +} + +static int +le_match(struct netif *nif, void *machdep_hint) +{ + void *cookie; + uint8_t *eaddr; + + /* XXX should check nif_unit and unit number in machdep_hint path */ + + cookie = lance_cookie(nif->nif_unit); + if (cookie == NULL) + return 0; + + eaddr = lance_eaddr(cookie); + if (eaddr == NULL) + return 0; + + return 1; +} + +static int +le_probe(struct netif *nif, void *machdep_hint) +{ + + /* XXX what should be checked? */ + + return 0; +} + +static void +le_init(struct iodesc *desc, void *machdep_hint) +{ + struct netif *nif = desc->io_netif; + struct netif_dif *dif = &nif->nif_driver->netif_ifs[nif->nif_unit]; + void *cookie; + uint8_t *eaddr; + +#ifdef DEBUG + printf("%s\n", __func__); +#endif + + cookie = lance_cookie(nif->nif_unit); + eaddr = lance_eaddr(cookie); + + lance_init(cookie); + + /* fill glue stuff */ + dif->dif_private = cookie; + memcpy(desc->myea, eaddr, 6); +} + +static int +le_get(struct iodesc *desc, void *pkt, size_t maxlen, time_t timeout) +{ + struct netif *nif = desc->io_netif; + struct netif_dif *dif = &nif->nif_driver->netif_ifs[nif->nif_unit]; + void *cookie = dif->dif_private; + int len = -1; + time_t t; + + t = getsecs() + timeout; + while (getsecs() < t) { + len = lance_get(cookie, pkt, len); + if (len > 0) + break; + } + + return len; +} + +static int +le_put(struct iodesc *desc, void *pkt, size_t len) +{ + struct netif *nif = desc->io_netif; + struct netif_dif *dif = &nif->nif_driver->netif_ifs[nif->nif_unit]; + void *cookie = dif->dif_private; +#ifdef DEBUG + struct ether_header *eh; + + eh = pkt; + printf("dst: %s\n", ether_sprintf(eh->ether_dhost)); + printf("src: %s\n", ether_sprintf(eh->ether_shost)); + printf("type: 0x%x\n", eh->ether_type & 0xffff); +#endif + + return lance_put(cookie, pkt, len) ? len : -1; +} + +static void +le_end(struct netif *nif) +{ + struct netif_dif *dif = &nif->nif_driver->netif_ifs[nif->nif_unit]; + void *cookie = dif->dif_private; + +#ifdef DEBUG + printf("%s\n", __func__); +#endif + lance_end(cookie); +} + +static void +myetheraddr(uint8_t *ether) +{ + unsigned int i, loc; + volatile struct { uint32_t ctl; } *ds1220; + + switch (machtype) { + case LUNA_88K: + /* + * fuse_rom_data[] begins with "ENADDR=00000Axxxxxx" + */ + loc = 7; + for (i = 0; i < 6; i++) { + int u, l; + + u = fuse_rom_data[loc]; + u = (u < 'A') ? u & 0xf : u - 'A' + 10; + l = fuse_rom_data[loc + 1]; + l = (l < 'A') ? l & 0xf : l - 'A' + 10; + + ether[i] = l | (u << 4); + loc += 2; + } + break; + case LUNA_88K2: + ds1220 = (void *)0xF1000008; + loc = 12; + for (i = 0; i < 6; i++) { + unsigned int u, l, hex; + + ds1220->ctl = (loc) << 16; + u = 0xf0 & (ds1220->ctl >> 12); + ds1220->ctl = (loc + 1) << 16; + l = 0x0f & (ds1220->ctl >> 16); + hex = (u < '9') ? l : l + 9; + + ds1220->ctl = (loc + 2) << 16; + u = 0xf0 & (ds1220->ctl >> 12); + ds1220->ctl = (loc + 3) << 16; + l = 0x0f & (ds1220->ctl >> 16); + + ether[i] = ((u < '9') ? l : l + 9) | (hex << 4); + loc += 4; + } + break; + default: + ether[0] = 0x00; ether[1] = 0x00; ether[2] = 0x0a; + ether[3] = 0xDE; ether[4] = 0xAD; ether[5] = 0x00; + break; + } +} diff --git a/sys/arch/luna88k/stand/boot/init_main.c b/sys/arch/luna88k/stand/boot/init_main.c new file mode 100644 index 00000000000..f755848f182 --- /dev/null +++ b/sys/arch/luna88k/stand/boot/init_main.c @@ -0,0 +1,245 @@ +/* $OpenBSD: init_main.c,v 1.1 2013/10/28 22:13:12 miod Exp $ */ +/* $NetBSD: init_main.c,v 1.6 2013/03/05 15:34:53 tsutsui Exp $ */ + +/* + * Copyright (c) 1992 OMRON Corporation. + * + * This code is derived from software contributed to Berkeley by + * OMRON Corporation. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)init_main.c 8.2 (Berkeley) 8/15/93 + */ +/* + * Copyright (c) 1992, 1993 + * The Regents of the University of California. All rights reserved. + * + * This code is derived from software contributed to Berkeley by + * OMRON Corporation. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)init_main.c 8.2 (Berkeley) 8/15/93 + */ + +#include <sys/param.h> +#include <machine/board.h> +#include <luna88k/stand/boot/samachdep.h> +#include <luna88k/stand/boot/status.h> +#include <lib/libsa/loadfile.h> +#include "dev_net.h" + +static void get_fuse_rom_data(void); +static int get_plane_numbers(void); + +int cpuspeed; /* for DELAY() macro */ +int machtype; +char default_file[64]; + +uint16_t dipswitch = 0; +int nplane; + +/* for command parser */ + +#define BUFFSIZE 100 +#define MAXARGS 30 + +char buffer[BUFFSIZE]; + +int argc; +char *argv[MAXARGS]; + +#define BOOT_TIMEOUT 5 +int boot_timeout = BOOT_TIMEOUT; + +char prompt[16] = "boot> "; + +int debug; + +/* + * FUSE ROM and NVRAM data + */ +struct fuse_rom_byte { + u_int32_t h; + u_int32_t l; +}; +#define FUSE_ROM_SPACE 1024 +#define FUSE_ROM_BYTES (FUSE_ROM_SPACE / sizeof(struct fuse_rom_byte)) +char fuse_rom_data[FUSE_ROM_BYTES]; + +int +main(void) +{ + int i, status = 0; + const char *machstr; + int netboot = 0; + int unit, part; + + /* Determine the machine type from FUSE ROM data. */ + get_fuse_rom_data(); + if (strncmp(fuse_rom_data, "MNAME=LUNA88K+", 14) == 0) + machtype = LUNA_88K2; + else + machtype = LUNA_88K; + + /* + * Initialize the console before we print anything out. + */ + if (machtype == LUNA_88K) { + machstr = "LUNA-88K"; + cpuspeed = MHZ_25; + } else { + machstr = "LUNA88K-2"; + cpuspeed = MHZ_33; + } + + nplane = get_plane_numbers(); + + cninit(); + + printf("\nOpenBSD/luna88k boot 0.1\n"); + + i = *((int *)0x1104); + printf("Machine model = %s\n", machstr); + printf("Physical Memory = 0x%x ", i); + i >>= 20; + printf("(%d MB)\n", i); + printf("\n"); + + /* + * IO configuration + */ + +#ifdef SUPPORT_ETHERNET + try_bootp = 1; +#endif + + find_devs(); + configure(); + printf("\n"); + + unit = 0; /* XXX should parse monitor's Boot-file constant */ + part = 0; + snprintf(default_file, sizeof(default_file), + "%s(%d,%d)%s", netboot ? "le" : "sd", unit, part, "bsd"); + + /* auto-boot? (SW1) */ + if ((dipswitch & 0x8000) != 0) { + char c; + + printf("Press return to boot now," + " any other key for boot menu\n"); + printf("booting %s - starting in ", default_file); + c = awaitkey("%d seconds. ", boot_timeout, 1); + if (c == '\r' || c == '\n' || c == 0) { + printf("auto-boot %s\n", default_file); + bootunix(default_file); + } + } + + /* + * Main Loop + */ + + printf("type \"help\" for help.\n"); + + do { + memset(buffer, 0, BUFFSIZE); + if (getline(prompt, buffer) > 0) { + argc = getargs(buffer, argv, sizeof(argv)/sizeof(char *)); + + status = parse(argc, argv); + if (status == ST_NOTFOUND) + printf("Command \"%s\" is not found !!\n", argv[0]); + } + } while(status != ST_EXIT); + + exit(); + /* NOTREACHED */ +} + +int +get_plane_numbers(void) +{ + int r = *((int *)0x1114); + int n = 0; + + for (; r ; r >>= 1) + if (r & 0x1) + n++; + + return(n); +} + +/* Get data from FUSE ROM */ + +void +get_fuse_rom_data(void) +{ + int i; + struct fuse_rom_byte *p = (struct fuse_rom_byte *)FUSE_ROM_ADDR; + + for (i = 0; i < FUSE_ROM_BYTES; i++) { + fuse_rom_data[i] = + (char)((((p->h) >> 24) & 0x000000f0) | + (((p->l) >> 28) & 0x0000000f)); + p++; + } +} + +void +_rtt(void) +{ + *(volatile unsigned int *)0x6d000010 = 0; + for (;;) ; + /* NOTREACHED */ +} diff --git a/sys/arch/luna88k/stand/boot/ioconf.c b/sys/arch/luna88k/stand/boot/ioconf.c new file mode 100644 index 00000000000..9c13a234fb5 --- /dev/null +++ b/sys/arch/luna88k/stand/boot/ioconf.c @@ -0,0 +1,105 @@ +/* $OpenBSD: ioconf.c,v 1.1 2013/10/28 22:13:12 miod Exp $ */ +/* $NetBSD: ioconf.c,v 1.3 2013/01/14 01:37:57 tsutsui Exp $ */ + +/* + * Copyright (c) 1992 OMRON Corporation. + * + * This code is derived from software contributed to Berkeley by + * OMRON Corporation. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)ioconf.c 8.1 (Berkeley) 6/10/93 + */ +/* + * Copyright (c) 1992, 1993 + * The Regents of the University of California. All rights reserved. + * + * This code is derived from software contributed to Berkeley by + * OMRON Corporation. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)ioconf.c 8.1 (Berkeley) 6/10/93 + */ + +#include <sys/param.h> +#include <luna88k/stand/boot/samachdep.h> +#include <luna88k/stand/boot/device.h> + + +#define C (void *) +#define D (struct driver *) + +extern struct driver scdriver; +extern struct driver sddriver; +extern struct driver ledriver; +extern struct driver stdriver; + +struct hp_ctlr hp_cinit[] = { +/* driver, unit, alive, addr, flags */ + { &scdriver, 0, 0, C 0x0, 0x0 }, + { &scdriver, 1, 0, C 0x0, 0x0 }, + {0}, +}; + +struct hp_device hp_dinit[] = { +/*driver, cdriver, unit, ctlr, slave, addr, dk, flags*/ +{ &sddriver, &scdriver, 0, 0, 6, C 0x0, 1, 0x0 }, +{ &sddriver, &scdriver, 1, 0, 5, C 0x0, 1, 0x0 }, +{ &sddriver, &scdriver, 2, 1, 6, C 0x0, 1, 0x0 }, +{ &sddriver, &scdriver, 3, 1, 5, C 0x0, 1, 0x0 }, +{ &ledriver, NULL, 0, 0, 0, C 0x0, 0, 0x0 }, +#ifdef notyet +{ &stdriver, &scdriver, 0, 0, 4, C 0x0, 0, 0x0 }, +#endif +{0} +}; diff --git a/sys/arch/luna88k/stand/boot/kbd.c b/sys/arch/luna88k/stand/boot/kbd.c new file mode 100644 index 00000000000..e642e405427 --- /dev/null +++ b/sys/arch/luna88k/stand/boot/kbd.c @@ -0,0 +1,267 @@ +/* $OpenBSD: kbd.c,v 1.1 2013/10/28 22:13:12 miod Exp $ */ +/* $NetBSD: kbd.c,v 1.1 2013/01/05 17:44:24 tsutsui Exp $ */ + +/* + * Copyright (c) 1992 OMRON Corporation. + * + * This code is derived from software contributed to Berkeley by + * OMRON Corporation. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)kbd.c 8.1 (Berkeley) 6/10/93 + */ +/* + * Copyright (c) 1992, 1993 + * The Regents of the University of California. All rights reserved. + * + * This code is derived from software contributed to Berkeley by + * OMRON Corporation. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)kbd.c 8.1 (Berkeley) 6/10/93 + */ + +/* + * kbd.c -- key-code decoding routine + * by A.Fujita, Dec-12-1992 + */ + +#include <sys/param.h> +#include <luna88k/stand/boot/samachdep.h> +#include <luna88k/stand/boot/kbdreg.h> + +struct kbd_keymap kbd_keymap[] = { + { KC_IGNORE, { 0, 0 } }, /* 0 [0x00] */ + { KC_IGNORE, { 0, 0 } }, /* 1 [0x01] */ + { KC_IGNORE, { 0, 0 } }, /* 2 [0x02] */ + { KC_IGNORE, { 0, 0 } }, /* 3 [0x03] */ + { KC_IGNORE, { 0, 0 } }, /* 4 [0x04] */ + { KC_IGNORE, { 0, 0 } }, /* 5 [0x05] */ + { KC_IGNORE, { 0, 0 } }, /* 6 [0x06] */ + { KC_IGNORE, { 0, 0 } }, /* 7 [0x07] */ + { KC_IGNORE, { 0, 0 } }, /* 8 [0x08] */ + { KC_CODE, { 0x09, 0x09 } }, /* 9 [0x09] TAB */ + { KC_SHIFT, { KS_CTRL, KS_CTRL } }, /* 10 [0x0A] CTRL */ + { KC_IGNORE, { 0, 0 } }, /* 11 [0x0B] */ + { KC_SHIFT, { KS_SHIFT, KS_SHIFT } }, /* 12 [0x0C] SHIFT */ + { KC_SHIFT, { KS_SHIFT, KS_SHIFT } }, /* 13 [0x0D] SHIFT */ + { KC_IGNORE, { 0, 0 } }, /* 14 [0x0E] */ + { KC_SHIFT, { KS_META, KS_META } }, /* 15 [0x0F] META */ + { KC_CODE, { 0x1B, 0x1B } }, /* 16 [0x10] ESC */ + { KC_CODE, { 0x08, 0x08 } }, /* 17 [0x11] BS */ + { KC_CODE, { 0x0D, 0x0D } }, /* 18 [0x12] CR */ + { KC_IGNORE, { 0, 0 } }, /* 19 [0x13] */ + { KC_CODE, { 0x20, 0x20 } }, /* 20 [0x14] SP */ + { KC_CODE, { 0x7F, 0x7F } }, /* 21 [0x15] DEL */ + { KC_IGNORE, { 0, 0 } }, /* 22 [0x16] */ + { KC_IGNORE, { 0, 0 } }, /* 23 [0x17] */ + { KC_IGNORE, { 0, 0 } }, /* 24 [0x18] */ + { KC_IGNORE, { 0, 0 } }, /* 25 [0x19] */ + { KC_IGNORE, { 0, 0 } }, /* 26 [0x1A] */ + { KC_IGNORE, { 0, 0 } }, /* 27 [0x1B] */ + { KC_IGNORE, { 0, 0 } }, /* 28 [0x1C] */ + { KC_IGNORE, { 0, 0 } }, /* 29 [0x1D] */ + { KC_IGNORE, { 0, 0 } }, /* 30 [0x1E] */ + { KC_IGNORE, { 0, 0 } }, /* 31 [0x1F] */ + { KC_IGNORE, { 0, 0 } }, /* 32 [0x20] */ + { KC_IGNORE, { 0, 0 } }, /* 33 [0x21] */ + { KC_CODE, { 0x31, 0x21 } }, /* 34 [0x22] 1 */ + { KC_CODE, { 0x32, 0x22 } }, /* 35 [0x23] 2 */ + { KC_CODE, { 0x33, 0x23 } }, /* 36 [0x24] 3 */ + { KC_CODE, { 0x34, 0x24 } }, /* 37 [0x25] 4 */ + { KC_CODE, { 0x35, 0x25 } }, /* 38 [0x26] 5 */ + { KC_CODE, { 0x36, 0x26 } }, /* 39 [0x27] 6 */ + { KC_CODE, { 0x37, 0x27 } }, /* 40 [0x28] 7 */ + { KC_CODE, { 0x38, 0x28 } }, /* 41 [0x29] 8 */ + { KC_CODE, { 0x39, 0x29 } }, /* 42 [0x2A] 9 */ + { KC_CODE, { 0x30, 0x30 } }, /* 43 [0x2B] 0 */ + { KC_CODE, { 0x2D, 0x3D } }, /* 44 [0x2C] - */ + { KC_CODE, { 0x5E, 0x7E } }, /* 45 [0x2D] ^ */ + { KC_CODE, { 0x5C, 0x7C } }, /* 46 [0x2E] \ */ + { KC_IGNORE, { 0, 0 } }, /* 47 [0x2F] */ + { KC_IGNORE, { 0, 0 } }, /* 48 [0x30] */ + { KC_IGNORE, { 0, 0 } }, /* 49 [0x31] */ + { KC_CODE, { 0x71, 0x51 } }, /* 50 [0x32] q */ + { KC_CODE, { 0x77, 0x57 } }, /* 51 [0x33] w */ + { KC_CODE, { 0x65, 0x45 } }, /* 52 [0x34] e */ + { KC_CODE, { 0x72, 0x52 } }, /* 53 [0x35] r */ + { KC_CODE, { 0x74, 0x54 } }, /* 54 [0x36] t */ + { KC_CODE, { 0x79, 0x59 } }, /* 55 [0x37] y */ + { KC_CODE, { 0x75, 0x55 } }, /* 56 [0x38] u */ + { KC_CODE, { 0x69, 0x49 } }, /* 57 [0x39] i */ + { KC_CODE, { 0x6F, 0x4F } }, /* 58 [0x3A] o */ + { KC_CODE, { 0x70, 0x50 } }, /* 59 [0x3B] p */ + { KC_CODE, { 0x40, 0x60 } }, /* 60 [0x3C] @ */ + { KC_CODE, { 0x5B, 0x7B } }, /* 61 [0x3D] [ */ + { KC_IGNORE, { 0, 0 } }, /* 62 [0x3E] */ + { KC_IGNORE, { 0, 0 } }, /* 63 [0x3F] */ + { KC_IGNORE, { 0, 0 } }, /* 64 [0x40] */ + { KC_IGNORE, { 0, 0 } }, /* 65 [0x41] */ + { KC_CODE, { 0x61, 0x41 } }, /* 66 [0x42] a */ + { KC_CODE, { 0x73, 0x53 } }, /* 67 [0x43] s */ + { KC_CODE, { 0x64, 0x44 } }, /* 68 [0x44] d */ + { KC_CODE, { 0x66, 0x46 } }, /* 69 [0x45] f */ + { KC_CODE, { 0x67, 0x47 } }, /* 70 [0x46] g */ + { KC_CODE, { 0x68, 0x48 } }, /* 71 [0x47] h */ + { KC_CODE, { 0x6A, 0x4A } }, /* 72 [0x48] j */ + { KC_CODE, { 0x6B, 0x4B } }, /* 73 [0x49] k */ + { KC_CODE, { 0x6C, 0x4C } }, /* 74 [0x4A] l */ + { KC_CODE, { 0x3B, 0x2B } }, /* 75 [0x4B] ; */ + { KC_CODE, { 0x3A, 0x2A } }, /* 76 [0x4C] : */ + { KC_CODE, { 0x5D, 0x7D } }, /* 77 [0x4D] ] */ + { KC_IGNORE, { 0, 0 } }, /* 78 [0x4E] */ + { KC_IGNORE, { 0, 0 } }, /* 79 [0x4F] */ + { KC_IGNORE, { 0, 0 } }, /* 80 [0x50] */ + { KC_IGNORE, { 0, 0 } }, /* 81 [0x51] */ + { KC_CODE, { 0x7A, 0x5A } }, /* 82 [0x52] z */ + { KC_CODE, { 0x78, 0x58 } }, /* 83 [0x53] x */ + { KC_CODE, { 0x63, 0x43 } }, /* 84 [0x54] c */ + { KC_CODE, { 0x76, 0x56 } }, /* 85 [0x55] v */ + { KC_CODE, { 0x62, 0x42 } }, /* 86 [0x56] b */ + { KC_CODE, { 0x6E, 0x4E } }, /* 87 [0x57] n */ + { KC_CODE, { 0x6D, 0x4D } }, /* 88 [0x58] m */ + { KC_CODE, { 0x2C, 0x3C } }, /* 89 [0x59] , */ + { KC_CODE, { 0x2E, 0x3E } }, /* 90 [0x5A] . */ + { KC_CODE, { 0x2F, 0x3F } }, /* 91 [0x5B] / */ + { KC_CODE, { 0x5F, 0x5F } }, /* 92 [0x5C] _ */ + { KC_IGNORE, { 0, 0 } }, /* 93 [0x5D] */ + { KC_IGNORE, { 0, 0 } }, /* 94 [0x5E] */ + { KC_IGNORE, { 0, 0 } }, /* 95 [0x5F] */ + { KC_IGNORE, { 0, 0 } }, /* 96 [0x60] */ + { KC_IGNORE, { 0, 0 } }, /* 97 [0x61] */ + { KC_IGNORE, { 0, 0 } }, /* 98 [0x62] */ + { KC_IGNORE, { 0, 0 } }, /* 99 [0x63] */ + { KC_IGNORE, { 0, 0 } }, /* 100 [0x64] */ + { KC_IGNORE, { 0, 0 } }, /* 101 [0x65] */ + { KC_IGNORE, { 0, 0 } }, /* 102 [0x66] */ + { KC_IGNORE, { 0, 0 } }, /* 103 [0x67] */ + { KC_IGNORE, { 0, 0 } }, /* 104 [0x68] */ + { KC_IGNORE, { 0, 0 } }, /* 105 [0x69] */ + { KC_IGNORE, { 0, 0 } }, /* 106 [0x6A] */ + { KC_IGNORE, { 0, 0 } }, /* 107 [0x6B] */ + { KC_IGNORE, { 0, 0 } }, /* 108 [0x6C] */ + { KC_IGNORE, { 0, 0 } }, /* 109 [0x6D] */ + { KC_IGNORE, { 0, 0 } }, /* 110 [0x6E] */ + { KC_IGNORE, { 0, 0 } }, /* 111 [0x6F] */ + { KC_IGNORE, { 0, 0 } }, /* 112 [0x70] */ + { KC_IGNORE, { 0, 0 } }, /* 113 [0x71] */ + { KC_IGNORE, { 0, 0 } }, /* 114 [0x72] */ + { KC_IGNORE, { 0, 0 } }, /* 115 [0x73] */ + { KC_IGNORE, { 0, 0 } }, /* 116 [0x74] */ + { KC_IGNORE, { 0, 0 } }, /* 117 [0x75] */ + { KC_IGNORE, { 0, 0 } }, /* 118 [0x76] */ + { KC_IGNORE, { 0, 0 } }, /* 119 [0x77] */ + { KC_IGNORE, { 0, 0 } }, /* 120 [0x78] */ + { KC_IGNORE, { 0, 0 } }, /* 121 [0x79] */ + { KC_IGNORE, { 0, 0 } }, /* 122 [0x7A] */ + { KC_IGNORE, { 0, 0 } }, /* 123 [0x7B] */ + { KC_IGNORE, { 0, 0 } }, /* 124 [0x7C] */ + { KC_IGNORE, { 0, 0 } }, /* 125 [0x7D] */ + { KC_IGNORE, { 0, 0 } }, /* 126 [0x7E] */ + { KC_IGNORE, { 0, 0 } }, /* 127 [0x7F] */ +}; + +int shift_flag = 0; +int ctrl_flag = 0; +int meta_flag = 0; + +int +kbd_decode(u_char code) +{ + unsigned int c, updown = 0; + + if (code & 0x80) + updown = 1; + + code &= 0x7F; + + c = kbd_keymap[code].km_type; + + if (c == KC_IGNORE) + return(KC_IGNORE); + + if ((c == KC_CODE) && updown) + return(KC_IGNORE); + + if (c == KC_SHIFT) { + switch(kbd_keymap[code].km_code[0]) { + + case KS_SHIFT: + shift_flag = 1 - updown; + break; + + case KS_CTRL: + ctrl_flag = 1 - updown; + break; + + case KS_META: + meta_flag = 1 - updown; + break; + } + + return(KC_IGNORE); + } + + if (shift_flag) + c = kbd_keymap[code].km_code[1]; + else + c = kbd_keymap[code].km_code[0]; + + if (meta_flag) + c |= 0x80; + + if (ctrl_flag) + c &= 0x1F; + + return(c); +} diff --git a/sys/arch/luna88k/stand/boot/kbdreg.h b/sys/arch/luna88k/stand/boot/kbdreg.h new file mode 100644 index 00000000000..58dfcc4ab88 --- /dev/null +++ b/sys/arch/luna88k/stand/boot/kbdreg.h @@ -0,0 +1,92 @@ +/* $OpenBSD: kbdreg.h,v 1.1 2013/10/28 22:13:12 miod Exp $ */ +/* $NetBSD: kbdreg.h,v 1.1 2013/01/05 17:44:24 tsutsui Exp $ */ + +/* + * Copyright (c) 1992 OMRON Corporation. + * + * This code is derived from software contributed to Berkeley by + * OMRON Corporation. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)kbdreg.h 8.1 (Berkeley) 6/10/93 + */ +/* + * Copyright (c) 1992, 1993 + * The Regents of the University of California. All rights reserved. + * + * This code is derived from software contributed to Berkeley by + * OMRON Corporation. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)kbdreg.h 8.1 (Berkeley) 6/10/93 + */ + +/* + * kbdreg.h -- + * + */ + +struct kbd_keymap { + int km_type; + int km_code[2]; +}; + +#define KC_CHAR 0x000000FF +#define KC_TYPE 0x0000FF00 +#define KC_CODE 0x00000000 +#define KC_SHIFT 0x00000100 +#define KC_IGNORE 0x0000FF00 + +#define KS_SHIFT 0 +#define KS_CTRL 1 +#define KS_META 2 diff --git a/sys/arch/luna88k/stand/boot/lance.c b/sys/arch/luna88k/stand/boot/lance.c new file mode 100644 index 00000000000..b939ab82a99 --- /dev/null +++ b/sys/arch/luna88k/stand/boot/lance.c @@ -0,0 +1,366 @@ +/* $OpenBSD: lance.c,v 1.1 2013/10/28 22:13:12 miod Exp $ */ +/* $NetBSD: lance.c,v 1.1 2013/01/13 14:10:55 tsutsui Exp $ */ + +/* + * Copyright (c) 2013 Izumi Tsutsui. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +/*- + * Copyright (c) 2004 The NetBSD Foundation, Inc. + * All rights reserved. + * + * This code is derived from software contributed to The NetBSD Foundation + * by UCHIYAMA Yasushi. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +/* + * LANCE driver for LUNA + * based on sys/arch/ews4800mips/stand/common/lance.c + */ + +#include <luna88k/stand/boot/samachdep.h> + +#include <dev/ic/am7990reg.h> +#include <dev/ic/lancereg.h> + +#include <luna88k/stand/boot/lance.h> + +static void lance_setup(struct le_softc *); +static int lance_set_initblock(struct le_softc *); +static int lance_do_initialize(struct le_softc *); + +#define NLE 1 /* XXX for now */ +static struct le_softc lesc[NLE]; + +void * +lance_attach(int unit, void *reg, void *mem, uint8_t *eaddr) +{ + struct le_softc *sc; + + if (unit >= NLE) { + printf("%s: invalid unit number\n", __func__); + return NULL; + } + sc = &lesc[unit]; + + if (sc->sc_reg != NULL) { + printf("%s: unit %d is already attached\n", __func__, unit); + return NULL; + } + sc->sc_reg = reg; + sc->sc_mem = mem; + memcpy(sc->sc_enaddr, eaddr, 6); + + return sc; +} + +void * +lance_cookie(int unit) +{ + struct le_softc *sc; + + if (unit >= NLE) + return NULL; + + sc = &lesc[unit]; + + if (sc->sc_reg == NULL) + return NULL; + + return sc; +} + +uint8_t * +lance_eaddr(void *cookie) +{ + struct le_softc *sc = cookie; + + if (sc == NULL || sc->sc_reg == NULL) + return NULL; + + return sc->sc_enaddr; +} + +int +lance_init(void *cookie) +{ + struct le_softc *sc = cookie; + + lance_setup(sc); + + if (!lance_set_initblock(sc)) + return 0; + + if (!lance_do_initialize(sc)) + return 0; + + return 1; +} + +int +lance_get(void *cookie, void *data, size_t maxlen) +{ + struct le_softc *sc = cookie; + struct lereg *lereg = sc->sc_reg; + struct lemem *lemem = sc->sc_mem; + struct lermd_v *rmd; + uint16_t csr; + int len = -1; + + lereg->ler_rap = LE_CSR0; + if ((lereg->ler_rdp & LE_C0_RINT) != 0) + lereg->ler_rdp = LE_C0_RINT; + rmd = &lemem->lem_rmd[sc->sc_currmd]; + if ((rmd->rmd1_bits & LE_R1_OWN) != 0) + return -1; + + csr = lereg->ler_rdp; +#if 0 + if ((csr & LE_C0_ERR) != 0) + printf("%s: RX poll error (CSR=0x%x)\n", __func__, csr); +#endif + if ((rmd->rmd1_bits & LE_R1_ERR) != 0) { + printf("%s: RX error (rmd status=0x%x)\n", __func__, + rmd->rmd1_bits); + goto out; + } + + len = rmd->rmd3; + if (len < LEMINSIZE + 4 || len > LEMTU) { + printf("%s: RX error (bad length %d)\n", __func__, len); + goto out; + } + len -= 4; + memcpy(data, (void *)lemem->lem_rbuf[sc->sc_currmd], min(len, maxlen)); + + out: + rmd->rmd2 = -LEMTU; + rmd->rmd1_bits = LE_R1_OWN; /* return to LANCE */ + sc->sc_currmd = LE_NEXTRMD(sc->sc_currmd); + + return len; +} + +int +lance_put(void *cookie, void *data, size_t len) +{ + struct le_softc *sc = cookie; + struct lereg *lereg = sc->sc_reg; + struct lemem *lemem = sc->sc_mem; + struct letmd_v *tmd; + uint16_t stat; + int timeout; + + lereg->ler_rap = LE_CSR0; + stat = lereg->ler_rdp; + lereg->ler_rdp = + stat & (LE_C0_BABL | LE_C0_CERR | LE_C0_MISS | LE_C0_TINT); +#if 0 + if (stat & (LE_C0_BABL | LE_C0_CERR | LE_C0_MISS | LE_C0_MERR)) + printf("%s: TX error before xmit csr0=0x%x\n", + __func__, stat); +#endif + + /* setup TX descriptor */ + tmd = &lemem->lem_tmd[sc->sc_curtmd]; + while (tmd->tmd1_bits & LE_T1_OWN) + continue; + tmd->tmd1_bits = LE_T1_STP | LE_T1_ENP; + memcpy((void *)lemem->lem_tbuf[sc->sc_curtmd], data, len); + tmd->tmd2 = -max(len, LEMINSIZE); + tmd->tmd3 = 0; + + /* start TX */ + tmd->tmd1_bits |= LE_T1_OWN; + lereg->ler_rap = LE_CSR0; + lereg->ler_rdp = LE_C0_TDMD; + + /* check TX complete */ + timeout = 0; + do { + lereg->ler_rap = LE_CSR0; + stat = lereg->ler_rdp; +#if 0 + if (stat & LE_C0_ERR) { + printf("%s: TX error (CSR0=%x)\n", __func__, stat); + if (stat & LE_C0_CERR) { + lereg->ler_rdp = LE_C0_CERR; + } + } +#endif + if (timeout++ > 1000) { + printf("%s: TX timeout (CSR0=%x)\n", __func__, stat); + return 0; + } + } while ((stat & LE_C0_TINT) == 0); + + lereg->ler_rdp = LE_C0_TINT; + + sc->sc_curtmd = LE_NEXTTMD(sc->sc_curtmd); + + return 1; +} + +int +lance_end(void *cookie) +{ + struct le_softc *sc = cookie; + struct lereg *lereg = sc->sc_reg; + + lereg->ler_rap = LE_CSR0; + lereg->ler_rdp = LE_C0_STOP; + + return 1; +} + +static int +lance_set_initblock(struct le_softc *sc) +{ + struct lereg *lereg = sc->sc_reg; + uint32_t addr = (uint32_t)sc->sc_mem; + + lereg->ler_rap = LE_CSR0; + lereg->ler_rdp = LE_C0_STOP; /* disable all external activity */ + DELAY(100); + + /* Set the correct byte swapping mode */ + lereg->ler_rap = LE_CSR3; + lereg->ler_rdp = LE_C3_BSWP; + + /* Low address of init block */ + lereg->ler_rap = LE_CSR1; + lereg->ler_rdp = addr & 0xfffe; + + /* High address of init block */ + lereg->ler_rap = LE_CSR2; + lereg->ler_rdp = (addr >> 16) & 0x00ff; + DELAY(100); + + return 1; +} + +static int +lance_do_initialize(struct le_softc *sc) +{ + struct lereg *lereg = sc->sc_reg; + uint16_t reg; + int timeout; + + sc->sc_curtmd = 0; + sc->sc_currmd = 0; + + /* Initialze LANCE */ + lereg->ler_rap = LE_CSR0; + lereg->ler_rdp = LE_C0_INIT; + + /* Wait interrupt */ + timeout = 1000000; + do { + lereg->ler_rap = LE_CSR0; + reg = lereg->ler_rdp; + if (--timeout == 0) { + printf("le: init timeout (CSR=0x%x)\n", reg); + return 0; + } + DELAY(1); + } while ((reg & LE_C0_IDON) == 0); + + lereg->ler_rap = LE_CSR0; + lereg->ler_rdp = LE_C0_STRT | LE_C0_IDON; + + return 1; +} + +static void +lance_setup(struct le_softc *sc) +{ + struct lereg *lereg = sc->sc_reg; + struct lemem *lemem = sc->sc_mem; + uint32_t addr; + int i; + + /* make sure to stop LANCE chip before setup memory */ + lereg->ler_rap = LE_CSR0; + lereg->ler_rdp = LE_C0_STOP; + + memset(lemem, 0, sizeof *lemem); + + /* Init block */ + lemem->lem_mode = LE_MODE_NORMAL; + lemem->lem_padr[0] = (sc->sc_enaddr[1] << 8) | sc->sc_enaddr[0]; + lemem->lem_padr[1] = (sc->sc_enaddr[3] << 8) | sc->sc_enaddr[2]; + lemem->lem_padr[2] = (sc->sc_enaddr[5] << 8) | sc->sc_enaddr[4]; + /* Logical address filter */ + for (i = 0; i < 4; i++) + lemem->lem_ladrf[i] = 0x0000; + + /* Location of Rx descriptor ring */ + addr = (uint32_t)lemem->lem_rmd; + lemem->lem_rdra = addr & 0xffff; + lemem->lem_rlen = LE_RLEN | ((addr >> 16) & 0xff); + + /* Location of Tx descriptor ring */ + addr = (uint32_t)lemem->lem_tmd; + lemem->lem_tdra = addr & 0xffff; + lemem->lem_tlen = LE_TLEN | ((addr >> 16) & 0xff); + + /* Rx descriptor */ + for (i = 0; i < LERBUF; i++) { + addr = (uint32_t)lemem->lem_rbuf[i]; + lemem->lem_rmd[i].rmd0 = addr & 0xffff; + lemem->lem_rmd[i].rmd1_hadr = (addr >> 16) & 0xff; + lemem->lem_rmd[i].rmd1_bits = LE_R1_OWN; + lemem->lem_rmd[i].rmd2 = LE_XMD2_ONES | -LEMTU; + lemem->lem_rmd[i].rmd3 = 0; + } + + /* Tx descriptor */ + for (i = 0; i < LETBUF; i++) { + addr = (uint32_t)lemem->lem_tbuf[i]; + lemem->lem_tmd[i].tmd0 = addr & 0xffff; + lemem->lem_tmd[i].tmd1_hadr = (addr >> 16) & 0xff; + lemem->lem_tmd[i].tmd1_bits = 0; + lemem->lem_tmd[i].tmd2 = LE_XMD2_ONES | 0; + lemem->lem_tmd[i].tmd3 = 0; + } +} diff --git a/sys/arch/luna88k/stand/boot/lance.h b/sys/arch/luna88k/stand/boot/lance.h new file mode 100644 index 00000000000..a8822a241b9 --- /dev/null +++ b/sys/arch/luna88k/stand/boot/lance.h @@ -0,0 +1,107 @@ +/* $OpenBSD: lance.h,v 1.1 2013/10/28 22:13:12 miod Exp $ */ +/* $NetBSD: lance.h,v 1.1 2013/01/13 14:10:55 tsutsui Exp $ */ + +/*- + * Copyright (c) 1982, 1992, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)if_lereg.h 8.2 (Berkeley) 10/30/93 + */ + +#define LEMTU 1518 +#define LEMINSIZE 60 /* should be 64 if mode DTCR is set */ +#define LERBUF 8 +#define LERBUFLOG2 3 +#define LE_RLEN (LERBUFLOG2 << 13) +#define LE_NEXTRMD(x) (((x) + 1) & (LERBUF - 1)) +#define LETBUF 1 +#define LETBUFLOG2 0 +#define LE_TLEN (LETBUFLOG2 << 13) +#define LE_NEXTTMD(x) (((x) + 1) & (LETBUF - 1)) + +/* Local Area Network Controller for Ethernet (LANCE) registers */ +struct lereg { + volatile uint16_t ler_rdp; /* register data port */ + uint16_t unused; + volatile uint16_t ler_rap; /* register address port */ +}; + +/* + * lance memory + */ + +/* receive message descriptors. bits/hadr are byte order dependent. */ +struct lermd_v { + volatile uint16_t rmd0; /* low address of packet */ +#if BYTE_ORDER == BIG_ENDIAN + volatile uint8_t rmd1_bits; /* descriptor bits */ + volatile uint8_t rmd1_hadr; /* high address of packet */ +#else + volatile uint8_t rmd1_hadr; /* high address of packet */ + volatile uint8_t rmd1_bits; /* descriptor bits */ +#endif + volatile int16_t rmd2; /* buffer byte count */ + volatile uint16_t rmd3; /* message byte count */ +}; + +/* transmit message descriptors */ +struct letmd_v { + volatile uint16_t tmd0; /* low address of packet */ +#if BYTE_ORDER == BIG_ENDIAN + volatile uint8_t tmd1_bits; /* descriptor bits */ + volatile uint8_t tmd1_hadr; /* high address of packet */ +#else + volatile uint8_t tmd1_hadr; /* high address of packet */ + volatile uint8_t tmd1_bits; /* descriptor bits */ +#endif + volatile int16_t tmd2; /* buffer byte count */ + volatile uint16_t tmd3; /* transmit error bits */ +}; + +struct lemem { + /* initialization block */ + volatile uint16_t lem_mode; /* mode */ + volatile uint16_t lem_padr[3]; /* physical address */ + volatile uint16_t lem_ladrf[4]; /* logical address filter */ + volatile uint16_t lem_rdra; /* receive descriptor addr */ + volatile uint16_t lem_rlen; /* rda high and ring size */ + volatile uint16_t lem_tdra; /* transmit descriptor addr */ + volatile uint16_t lem_tlen; /* tda high and ring size */ + uint16_t lem_pad0[4]; + struct lermd_v lem_rmd[LERBUF]; + struct letmd_v lem_tmd[LETBUF]; + volatile uint8_t lem_rbuf[LERBUF][LEMTU]; + volatile uint8_t lem_tbuf[LETBUF][LEMTU]; +}; + +struct le_softc { + struct lereg *sc_reg; + struct lemem *sc_mem; + uint8_t sc_enaddr[6]; + int sc_curtmd; + int sc_currmd; +}; diff --git a/sys/arch/luna88k/stand/boot/locore.S b/sys/arch/luna88k/stand/boot/locore.S new file mode 100644 index 00000000000..708886d6a7b --- /dev/null +++ b/sys/arch/luna88k/stand/boot/locore.S @@ -0,0 +1,148 @@ +/* $OpenBSD: locore.S,v 1.1 2013/10/28 22:13:12 miod Exp $ */ + +/* + * Copyright (c) 2013 Miodrag Vallat. + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ +/* + * Mach Operating System + * Copyright (c) 1993-1991 Carnegie Mellon University + * Copyright (c) 1991 OMRON Corporation + * All Rights Reserved. + * + * Permission to use, copy, modify and distribute this software and its + * documentation is hereby granted, provided that both the copyright + * notice and this permission notice appear in all copies of the + * software, derivative works or modified versions, and any portions + * thereof, and that both notices appear in supporting documentation. + * + * CARNEGIE MELLON AND OMRON ALLOW FREE USE OF THIS SOFTWARE IN ITS "AS IS" + * CONDITION. CARNEGIE MELLON AND OMRON DISCLAIM ANY LIABILITY OF ANY KIND + * FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE. + * + * Carnegie Mellon requests users of this software to return to + * + * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU + * School of Computer Science + * Carnegie Mellon University + * Pittsburgh PA 15213-3890 + * + * any improvements or extensions that they make and grant Carnegie the + * rights to redistribute these changes. + */ + +#define _KERNEL +#define _LOCORE + +#include <machine/asm.h> +#include <machine/psl.h> + + .text + +ASGLOBAL(__start) + NOP + NOP + +ASLOCAL(main_start) + /* + * We want to only run on one processors, but still allow the + * other processors to run the kernel after it is loaded. + * + * To achieve this, we will `park' secondary processors into + * a spin loop, which they will exit once the kernel entry + * point and arguments are known. + * + * They will then proceed to run the kernel, as if the kernel + * had been directly booted from the PROM. + */ + or.u %r3, %r0, %hi16(_ASM_LABEL(cpu_park_address)) + or %r3, %r3, %lo16(_ASM_LABEL(cpu_park_address)) + + or.u %r2, %r0, %hi16(_ASM_LABEL(cpu_park)) + or %r2, %r2, %lo16(_ASM_LABEL(cpu_park)) + FLUSH_PIPELINE + xmem %r2, %r3, %r0 + + bcnd eq0, %r2, 1f /* master! causing all the others to park */ + jmp %r2 /* park ourselves */ + +1: + /* clear BSS */ + or.u %r2, %r0, %hi16(_C_LABEL(edata)) + or %r2, %r2, %lo16(_C_LABEL(edata)) + or.u %r4, %r0, %hi16(_C_LABEL(end)) + or %r4, %r4, %lo16(_C_LABEL(end)) +1: st %r0, %r2, %r0 + addu %r2, %r2, 4 + cmp %r3, %r2, %r4 + bb1 ne, %r3, 1b + + /* setup stack, below our image */ + or.u %r31, %r0, %hi16(_ASM_LABEL(__start)) + or %r31, %r31, %lo16(_ASM_LABEL(__start)) + + /* read dip switch settings */ + or.u %r11, %r0, %hi16(0x49000000) + ld.bu %r10, %r11, %lo16(0x49000000) + mak %r10, %r10, 0<8> + ld.bu %r12, %r11, %lo16(0x49000004) + or %r10, %r10, %r12 + + or.u %r11, %r0, %hi16(_C_LABEL(dipswitch)) + st.h %r10, %r11, %lo16(_C_LABEL(dipswitch)) + + bsr _C_LABEL(main) + bsr _C_LABEL(_rtt) +1: br 1b + +ASLOCAL(cpu_park) + /* spin a while */ + or.u %r2, %r0, 1 +9: + subu %r2, %r2, 1 + bcnd ne0, %r2, 9b + + /* if kernel entry point is known, exit */ + or.u %r1, %r0, %hi16(_C_LABEL(cpu_boot)) + ld %r1, %r1, %lo16(_C_LABEL(cpu_boot)) + bcnd eq0, %r1, _ASM_LABEL(cpu_park) + + or.u %r2, %r0, 1 +9: + subu %r2, %r2, 1 + bcnd ne0, %r2, 9b + + or.u %r2, %r0, %hi16(_C_LABEL(cpu_bootarg1)) + ld %r2, %r2, %lo16(_C_LABEL(cpu_bootarg1)) + or.u %r3, %r0, %hi16(_C_LABEL(cpu_bootarg2)) + ld %r3, %r3, %lo16(_C_LABEL(cpu_bootarg2)) + + jmp %r1 + +GLOBAL(delay) + bcnd eq0, %r2, 2f + or.u %r3, %r0, %hi16(_C_LABEL(cpuspeed)) + ld %r3, %r3, %lo16(_C_LABEL(cpuspeed)) + mul %r4, %r2, %r3 + subu %r4, %r4, 4 +1: + bcnd.n gt0, %r4, 1b + subu %r4, %r4, 2 +2: + jmp %r1 + + .data + +ASLOCAL(cpu_park_address) + .word 0 diff --git a/sys/arch/luna88k/stand/boot/parse.c b/sys/arch/luna88k/stand/boot/parse.c new file mode 100644 index 00000000000..ece0e365748 --- /dev/null +++ b/sys/arch/luna88k/stand/boot/parse.c @@ -0,0 +1,161 @@ +/* $OpenBSD: parse.c,v 1.1 2013/10/28 22:13:13 miod Exp $ */ +/* $NetBSD: parse.c,v 1.4 2013/01/22 15:48:40 tsutsui Exp $ */ + +/* + * Copyright (c) 1992 OMRON Corporation. + * + * This code is derived from software contributed to Berkeley by + * OMRON Corporation. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)parse.c 8.1 (Berkeley) 6/10/93 + */ +/* + * Copyright (c) 1992, 1993 + * The Regents of the University of California. All rights reserved. + * + * This code is derived from software contributed to Berkeley by + * OMRON Corporation. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)parse.c 8.1 (Berkeley) 6/10/93 + */ + +/* + * parse.c -- command parser + * by A.Fujita, JAN-30-1992 + */ + +#include <lib/libkern/libkern.h> +#include <luna88k/stand/boot/samachdep.h> +#include <luna88k/stand/boot/status.h> + +static int cmd_help(int, char *[]); + +int +exit_program(int argc, char *argv[]) +{ + return(ST_EXIT); +} + +static const char helpmsg[] = + "commands are:\n" + "boot [device(unit,part)filename]\n" + " (ex. \"boot sd(0,0)bsd\", \"boot le(0,0)obsd\" etc.)\n" + "help\n" + "exit\n" +; + +static int +cmd_help(int argc, char *argv[]) +{ + + printf(helpmsg); + return ST_NORMAL; +} + +struct command_entry { + char *name; + int (*func)(int, char **); +}; + +struct command_entry entries[] = { + { "b", boot }, + { "boot", boot }, + { "exit", exit_program }, + { "help", cmd_help }, + { "quit", exit_program }, + { 0, 0 } +}; + + +int +parse(int argc, char *argv[]) +{ + int i, status = ST_NOTFOUND; + + for (i = 0; entries[i].name != (char *) 0; i++) { + if (!strcmp(argv[0], entries[i].name)) { + status = (*entries[i].func)(argc, argv); + break; + } + } + + return(status); +} + + + +/* + * getargs -- make argument arrays + */ + +int +getargs(char buffer[], char *argv[], int maxargs) +{ + int n = 0; + char *p = buffer; + + argv[n++] = p; + while (*p != '\0') { + if ( *p == ' ' ) { + *p = '\0'; + } else if (p != buffer && *(p-1) == '\0') { + if ( n < maxargs ) + argv[n++] = p; + } + p++; + } + + return(n); +} diff --git a/sys/arch/luna88k/stand/boot/prf.c b/sys/arch/luna88k/stand/boot/prf.c new file mode 100644 index 00000000000..e0cf6f3ebf6 --- /dev/null +++ b/sys/arch/luna88k/stand/boot/prf.c @@ -0,0 +1,76 @@ +/* $OpenBSD: prf.c,v 1.1 2013/10/28 22:13:13 miod Exp $ */ +/* $NetBSD: prf.c,v 1.3 2013/01/22 15:48:40 tsutsui Exp $ */ + +/* + * Copyright (c) 1982, 1986, 1990, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)prf.c 8.1 (Berkeley) 6/10/93 + */ + +#include <luna88k/stand/boot/samachdep.h> + +int +getchar(void) +{ + int c; + + while ((c = cngetc()) == 0) + ; + if (c == '\r') + c = '\n'; + else if (c == ('c'&037)) { + panic("^C"); + /* NOTREACHED */ + } + return c; +} + +int +tgetchar(void) +{ + int c; + + if ((c = cngetc()) == 0) + return 0; + + if (c == '\r') + c = '\n'; + else if (c == ('c'&037)) { + panic("^C"); + /* NOTREACHED */ + } + return c; +} + +void +putchar(int c) +{ + cnputc(c); + if (c == '\n') + cnputc('\r'); +} diff --git a/sys/arch/luna88k/stand/boot/rcvbuf.h b/sys/arch/luna88k/stand/boot/rcvbuf.h new file mode 100644 index 00000000000..85bcf6d3761 --- /dev/null +++ b/sys/arch/luna88k/stand/boot/rcvbuf.h @@ -0,0 +1,105 @@ +/* $OpenBSD: rcvbuf.h,v 1.1 2013/10/28 22:13:13 miod Exp $ */ +/* $NetBSD: rcvbuf.h,v 1.1 2013/01/05 17:44:24 tsutsui Exp $ */ + +/* + * Copyright (c) 1992 OMRON Corporation. + * + * This code is derived from software contributed to Berkeley by + * OMRON Corporation. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)rcvbuf.h 8.1 (Berkeley) 6/10/93 + */ +/* + * Copyright (c) 1992, 1993 + * The Regents of the University of California. All rights reserved. + * + * This code is derived from software contributed to Berkeley by + * OMRON Corporation. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)rcvbuf.h 8.1 (Berkeley) 6/10/93 + */ + +/* + * rcvbuf.h -- receive buffer control structure definition + * by A.Fujita, Dec-12-1992 + */ + +#define RBUF_SIZE 128 + +struct rcvbuf { + u_char * volatile rb_push; + u_char * volatile rb_pop; + u_char rb_buf[RBUF_SIZE+4]; +}; + +#define RBUF_INIT(n) rcvbuf[n].rb_pop = rcvbuf[n].rb_push = &rcvbuf[n].rb_buf[RBUF_SIZE] + +#define PUSH_RBUF(n, c) \ +do { \ + *(--rcvbuf[n].rb_push) = c ; \ + if (rcvbuf[n].rb_push == rcvbuf[n].rb_buf) \ + rcvbuf[n].rb_push = &rcvbuf[n].rb_buf[RBUF_SIZE]; \ +} while (/* CONSTCOND */0) + +#define POP_RBUF(n, c) \ +do { \ + c= *(--rcvbuf[n].rb_pop); \ + if (rcvbuf[n].rb_pop == rcvbuf[n].rb_buf) \ + rcvbuf[n].rb_pop = &rcvbuf[n].rb_buf[RBUF_SIZE]; \ +} while (0) + +#define RBUF_EMPTY(n) (rcvbuf[n].rb_push == rcvbuf[n].rb_pop ? 1: 0) + +extern struct rcvbuf rcvbuf[]; diff --git a/sys/arch/luna88k/stand/boot/samachdep.h b/sys/arch/luna88k/stand/boot/samachdep.h new file mode 100644 index 00000000000..e3c702ef5fa --- /dev/null +++ b/sys/arch/luna88k/stand/boot/samachdep.h @@ -0,0 +1,166 @@ +/* $OpenBSD: samachdep.h,v 1.1 2013/10/28 22:13:13 miod Exp $ */ +/* $NetBSD: samachdep.h,v 1.10 2013/03/05 15:34:53 tsutsui Exp $ */ + +/* + * Copyright (c) 1982, 1990, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)samachdep.h 8.1 (Berkeley) 6/10/93 + */ + +#include <sys/param.h> +#include <lib/libsa/stand.h> + +#define NSCSI 2 +#define NSD 8 + +#define MHZ_25 25 +#define MHZ_33 33 + +#define MAXDEVNAME 16 + +struct consdev; +typedef struct label_t { + long val[19]; +} label_t; + +/* autoconf.c */ +void configure(void); +void find_devs(void); + +/* awaitkey.c */ +char awaitkey(const char *, int, int); + +/* bcd.c */ +unsigned int bcdtobin(unsigned int); + +/* bmc.c */ +void bmccnprobe(struct consdev *); +void bmccninit(struct consdev *); +int bmccngetc(dev_t); +void bmccnputc(dev_t, int); + +/* bmd.c */ +void bmdinit(void); +int bmdputc(int); +void bmdadjust(short, short); +void bmdclear(void); + +/* boot.c */ +extern int howto; +int boot(int, char **); +int bootunix(char *); + +extern void (*cpu_boot)(uint32_t, uint32_t); +extern uint32_t cpu_bootarg1; +extern uint32_t cpu_bootarg2; +#define BOOT_MAGIC 0xf1abde3f + +/* cons.c */ +void cninit(void); +int cngetc(void); +void cnputc(int); + +/* devopen.c */ +extern u_int opendev; +int atoi(char *); + +/* fault.c */ +int badaddr(void *, int); + +/* font.c */ +extern u_short bmdfont[][20]; + +/* getline.c */ +int getline(char *, char *); + +/* if_le.c */ +int leinit(void *); + +/* init_main.c */ +extern int cpuspeed; +extern int nplane; +extern int machtype; +extern char default_file[]; +extern char fuse_rom_data[]; + +/* kbd.c */ +int kbd_decode(u_char); + +/* lance.c */ +void *lance_attach(int, void *, void *, uint8_t *); +void *lance_cookie(int); +uint8_t *lance_eaddr(void *); +int lance_init(void *); +int lance_get(void *, void *, size_t); +int lance_put(void *, void *, size_t); +int lance_end(void *); + +/* locore.S */ +extern u_int bootdev; +extern uint16_t dipswitch; +extern volatile uint32_t tick; +int setjmp(label_t *); +void delay(int); + +/* prf.c */ +int tgetchar(void); + +/* parse.c */ +int exit_program(int, char **); +int parse(int, char **); +int getargs(char *, char **, int); + +/* sc.c */ +struct scsi_fmt_cdb; +int scsi_immed_command(int, int, int, struct scsi_fmt_cdb *, u_char *, + unsigned int); +int scsi_request_sense(int, int, int, u_char *, unsigned int); +int scsi_test_unit_rdy(int, int, int); +int scintr(void); + +/* sd.c */ +int sdstrategy(void *, int, daddr32_t, size_t, void *, size_t *); +int sdopen(struct open_file *, ...); +int sdclose(struct open_file *); + +/* sio.c */ +void _siointr(void); +void siocnprobe(struct consdev *); +void siocninit(struct consdev *); +int siocngetc(dev_t); +void siocnputc(dev_t, int); +void sioinit(void); + +/* ufs_disklabel.c */ +char *readdisklabel(int, int, struct disklabel *); + +#define DELAY(n) delay(n) + +extern struct fs_ops file_system_disk[]; +extern int nfsys_disk; +extern struct fs_ops file_system_nfs[]; diff --git a/sys/arch/luna88k/stand/boot/sc.c b/sys/arch/luna88k/stand/boot/sc.c new file mode 100644 index 00000000000..d276b4a29fe --- /dev/null +++ b/sys/arch/luna88k/stand/boot/sc.c @@ -0,0 +1,633 @@ +/* $OpenBSD: sc.c,v 1.1 2013/10/28 22:13:13 miod Exp $ */ +/* $NetBSD: sc.c,v 1.4 2013/01/22 15:48:40 tsutsui Exp $ */ + +/* + * Copyright (c) 1992 OMRON Corporation. + * + * This code is derived from software contributed to Berkeley by + * OMRON Corporation. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)sc.c 8.1 (Berkeley) 6/10/93 + */ +/* + * Copyright (c) 1992, 1993 + * The Regents of the University of California. All rights reserved. + * + * This code is derived from software contributed to Berkeley by + * OMRON Corporation. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)sc.c 8.1 (Berkeley) 6/10/93 + */ + +/* + * sc.c -- SCSI Protocole Controller (SPC) driver + * remaked by A.Fujita, MAR-11-199 + */ + + +#define NSC 2 + +#include <sys/param.h> +#include <luna88k/stand/boot/samachdep.h> +#include <luna88k/stand/boot/scsireg.h> +#include <luna88k/stand/boot/device.h> +#include <luna88k/stand/boot/scsivar.h> + +#define SCSI_ID 7 + +static int scinit(void *); +static void screset(int); +static int issue_select(struct scsidevice *, u_char); +static void ixfer_start(struct scsidevice *, int, u_char, int); +static void ixfer_out(struct scsidevice *, int, u_char *); +static void ixfer_in(struct scsidevice *, int, u_char *); +static int scrun(int, int, u_char *, int, u_char *, int, volatile int *); +static int scfinish(int); +static void scabort(struct scsi_softc *, struct scsidevice *); + +struct driver scdriver = { + scinit, "sc" +}; + +struct scsi_softc scsi_softc[NSC]; + +/* + * Initialize SPC & Data Structure + */ + +int +scinit(void *arg) +{ + struct hp_ctlr *hc = arg; + struct scsi_softc *hs; + int unit; + + unit = hc->hp_unit; + if (unit < 0 || unit >= NSC) + return 0; + + hs = &scsi_softc[unit]; + + hs->sc_hc = hc; + + hs->sc_flags = 0; + hs->sc_phase = BUS_FREE_PHASE; + hs->sc_target = SCSI_ID; + + hs->sc_cdb = NULL; + hs->sc_cdblen = 0; + hs->sc_buf = NULL; + hs->sc_len = 0; + hs->sc_lock = NULL; + + hs->sc_stat = 0; + hs->sc_msg[0] = 0; + + screset(hc->hp_unit); + return(1); +} + +void +screset(int unit) +{ + struct scsi_softc *hs = &scsi_softc[unit]; + struct scsidevice *hd = (struct scsidevice *)hs->sc_hc->hp_addr; + + printf("sc%d: ", unit); + + /* + * Disable interrupts then reset the FUJI chip. + */ + + hd->scsi_sctl = SCTL_DISABLE | SCTL_CTRLRST; + hd->scsi_scmd = 0; + hd->scsi_pctl = 0; + hd->scsi_temp = 0; + hd->scsi_tch = 0; + hd->scsi_tcm = 0; + hd->scsi_tcl = 0; + hd->scsi_ints = 0; + + /* We can use Asynchronous Transfer only */ + printf("async"); + + /* + * Configure MB89352 with its SCSI address, all + * interrupts enabled & appropriate parity. + */ + hd->scsi_bdid = SCSI_ID; + hd->scsi_sctl = SCTL_DISABLE | SCTL_ABRT_ENAB| + SCTL_PARITY_ENAB | SCTL_RESEL_ENAB | + SCTL_INTR_ENAB; + printf(", parity"); + + DELAY(400); + hd->scsi_sctl &= ~SCTL_DISABLE; + + printf(", scsi id %d\n", SCSI_ID); +} + + +/* + * SPC Arbitration/Selection routine + */ + +int +issue_select(struct scsidevice *hd, u_char target) +{ + hd->scsi_pctl = 0; + hd->scsi_temp = (1 << SCSI_ID) | (1 << target); + + /* select timeout is hardcoded to 2ms */ + hd->scsi_tch = 0; + hd->scsi_tcm = 32; + hd->scsi_tcl = 4; + + hd->scsi_scmd = SCMD_SELECT; + + return (1); +} + + +/* + * SPC Manual Transfer routines + */ + +/* not yet */ + + +/* + * SPC Program Transfer routines + */ + +void +ixfer_start(struct scsidevice *hd, int len, u_char phase, int wait) +{ + hd->scsi_tch = ((len & 0xff0000) >> 16); + hd->scsi_tcm = ((len & 0x00ff00) >> 8); + hd->scsi_tcl = (len & 0x0000ff); + hd->scsi_pctl = phase; + hd->scsi_scmd = SCMD_XFR | SCMD_PROG_XFR; +} + +void +ixfer_out(struct scsidevice *hd, int len, u_char *buf) +{ + for(; len > 0; len--) { + while (hd->scsi_ssts & SSTS_DREG_FULL) { + DELAY(5); + } + hd->scsi_dreg = *buf++; + } +} + +void +ixfer_in(struct scsidevice *hd, int len, u_char *buf) +{ + for (; len > 0; len--) { + while (hd->scsi_ssts & SSTS_DREG_EMPTY) { + DELAY(5); + } + *buf++ = hd->scsi_dreg; + } +} + + +/* + * SPC drive routines + */ + +int +scrun(int ctlr, int slave, u_char *cdb, int cdblen, u_char *buf, int len, + volatile int *lock) +{ + struct scsi_softc *hs = &scsi_softc[ctlr]; + struct scsidevice *hd = (struct scsidevice *) hs->sc_hc->hp_addr; + + if (hd->scsi_ssts & (SSTS_INITIATOR|SSTS_TARGET|SSTS_BUSY)) + return(0); + + hs->sc_flags = 0; + hs->sc_phase = ARB_SEL_PHASE; + hs->sc_target = slave; + + hs->sc_cdb = cdb; + hs->sc_cdblen = cdblen; + hs->sc_buf = buf; + hs->sc_len = len; + hs->sc_lock = lock; + + hs->sc_stat = 0; + hs->sc_msg[0] = 0; + + *(hs->sc_lock) = SC_IN_PROGRESS; + issue_select(hd, hs->sc_target); + + return(1); +} + +int +scfinish(int ctlr) +{ + struct scsi_softc *hs = &scsi_softc[ctlr]; + int status = hs->sc_stat; + + hs->sc_flags = 0; + hs->sc_phase = BUS_FREE_PHASE; + hs->sc_target = SCSI_ID; + + hs->sc_cdb = NULL; + hs->sc_cdblen = 0; + hs->sc_buf = NULL; + hs->sc_len = 0; + hs->sc_lock = NULL; + + hs->sc_stat = 0; + hs->sc_msg[0] = 0; + + return(status); +} + +void +scabort(struct scsi_softc *hs, struct scsidevice *hd) +{ + int len; + u_char junk; + + printf("sc%d: abort phase=0x%x, ssts=0x%x, ints=0x%x\n", + hs->sc_hc->hp_unit, hd->scsi_psns, hd->scsi_ssts, + hd->scsi_ints); + + if (hd->scsi_ints != 0) + hd->scsi_ints = hd->scsi_ints; + + if (hd->scsi_psns == 0 || (hd->scsi_ssts & SSTS_INITIATOR) == 0) + /* no longer connected to scsi target */ + return; + + /* get the number of bytes remaining in current xfer + fudge */ + len = (hd->scsi_tch << 16) | (hd->scsi_tcm << 8) | hd->scsi_tcl; + + /* for that many bus cycles, try to send an abort msg */ + for (len += 1024; (hd->scsi_ssts & SSTS_INITIATOR) && --len >= 0; ) { + hd->scsi_scmd = SCMD_SET_ATN; + + while ((hd->scsi_psns & PSNS_REQ) == 0) { + if (! (hd->scsi_ssts & SSTS_INITIATOR)) + goto out; + DELAY(1); + } + + if ((hd->scsi_psns & PHASE) == MESG_OUT_PHASE) + hd->scsi_scmd = SCMD_RST_ATN; + hd->scsi_pctl = hs->sc_phase = hd->scsi_psns & PHASE; + + if (hd->scsi_psns & PHASE_IO) { + /* one of the input phases - read & discard a byte */ + hd->scsi_scmd = SCMD_SET_ACK; + while (hd->scsi_psns & PSNS_REQ) + DELAY(1); + junk = hd->scsi_temp; + } else { + /* one of the output phases - send an abort msg */ + hd->scsi_temp = MSG_ABORT; + hd->scsi_scmd = SCMD_SET_ACK; + while (hd->scsi_psns & PSNS_REQ) + DELAY(1); + } + + hd->scsi_scmd = SCMD_RST_ACK; + } +out: + /* + * Either the abort was successful & the bus is disconnected or + * the device didn't listen. If the latter, announce the problem. + * Either way, reset the card & the SPC. + */ + if (len < 0 && hs) + printf("sc%d: abort failed. phase=0x%x, ssts=0x%x\n", + hs->sc_hc->hp_unit, hd->scsi_psns, hd->scsi_ssts); +} + + +/* + * SCSI Command Handler + */ + +int +scsi_test_unit_rdy(int ctlr, int slave, int unit) +{ + static struct scsi_cdb6 cdb = { CMD_TEST_UNIT_READY }; + int status; + volatile int lock; + +#ifdef DEBUG + printf("scsi_test_unit_rdy( %d, %d, %d): Start\n", ctlr, slave, unit); +#endif + + cdb.lun = unit; + + if (!(scrun(ctlr, slave, (void *)&cdb, 6, NULL, 0, &lock))) { +#ifdef DEBUG + printf("scsi_test_unit_rdy: Command Transfer Failed.\n"); +#endif + return(-1); + } + + while ((lock == SC_IN_PROGRESS) || (lock == SC_DISCONNECTED)) { + scintr(); + DELAY(10); + } + + status = scfinish(ctlr); + + if (lock == SC_IO_COMPLETE) { +#ifdef DEBUG + printf("scsi_test_unit_rdy: Status -- 0x%x\n", status); +#endif + return(status); + } else { + return(lock); + } +} + +int +scsi_request_sense(int ctlr, int slave, int unit, u_char *buf, unsigned int len) +{ + static struct scsi_cdb6 cdb = { CMD_REQUEST_SENSE }; + int status; + volatile int lock; + +#ifdef DEBUG + printf("scsi_request_sense: Start\n"); +#endif + + /* Request Sense$N>l9g!"E>Aw$5$l$k%G!<%?D9$O%?!<%2368H$K0MB8$7!" */ + /* %;%s%9%G!<%?$N#8/usr/src/sys/luna68k/stand/SCCS/s.sc.c$%HL\$NAddtional Sens Length$K$h$jF0E*$K7hDj$9$k!#*/ + /* $3$3$G$O%G!<%?!<E>Aw?t$rcdb$NAllocation Length$K:GDcD9$G$"$k#8/usr/src/sys/luna68k/stand/SCCS/s.sc.c$%H */ + /* $r8GDj$7$F!"#S#P#C$N=hM}%7!<%1%s%9$rJx$5$J$$$h$&$K$7$F$$$k!# */ + + /* %F!<@(#)sc.c 8.1f%K373H$N>uBV$rD4$Y$k$?$a!"Addtional Sens Field$r%"%/%;%9$9$k */ + /* I,MW$,$"$k$N$G6/10/93P%$%98.1i%$%PB&$Glen$r7hDj$9$k$3$H$K$9$k */ + + cdb.lun = unit; + cdb.len = len; + + if (!(scrun(ctlr, slave, (void *)&cdb, 6, buf, len, &lock))) { +#ifdef DEBUG + printf("scsi_request_sense: Command Transfer Failed.\n"); +#endif + return(-1); + } + + while ((lock == SC_IN_PROGRESS) || (lock == SC_DISCONNECTED)) { + scintr(); + DELAY(10); + } + + status = scfinish(ctlr); + + if (lock == SC_IO_COMPLETE) { +#ifdef DEBUG + printf("scsi_request_sense: Status -- 0x%x\n", status); +#endif + return(status); + } else { + return(lock); + } +} + +int +scsi_immed_command(int ctlr, int slave, int unit, struct scsi_fmt_cdb *cdb, + u_char *buf, unsigned int len) +{ + int status; + volatile int lock; + +#ifdef DEBUG + printf("scsi_immed_command( %d, %d, %d, cdb(%d), buf, %d): Start\n", + ctlr, slave, unit, cdb->len, len); +#endif + + cdb->cdb[1] |= unit << 5; + + if (!(scrun(ctlr, slave, (void *)&cdb->cdb[0], cdb->len, buf, len, &lock))) { +#ifdef DEBUG + printf("scsi_immed_command: Command Transfer Failed.\n"); +#endif + return(-1); + } + + while ((lock == SC_IN_PROGRESS) || (lock == SC_DISCONNECTED)) { + scintr(); + DELAY(10); + } + + status = scfinish(ctlr); + + if (lock == SC_IO_COMPLETE) { +#ifdef DEBUG + printf("scsi_immed_command: Status -- 0x%x\n", status); +#endif + return(status); + } else { + return(lock); + } +} + +/* + * Interrupt Routine + */ + +int +scintr(void) +{ + struct scsi_softc *hs; + struct scsidevice *hd; + u_char ints, temp; + int i; + u_char *buf; + int len; + + for (i = 0; i < NSC; i++) { + hs = &scsi_softc[i]; + if (hs->sc_hc == NULL) + continue; + hd = (struct scsidevice *) hs->sc_hc->hp_addr; + if ((ints = hd->scsi_ints) != 0) + goto get_intr; + } + + /* Unknown Interrupt occured */ + return -1; + + + /* + * Interrupt + */ + + get_intr: +#ifdef DEBUG + printf("scintr: INTS 0x%x, SSTS 0x%x, PCTL 0x%x, PSNS 0x%x 0x%x\n", + ints, hd->scsi_ssts, hd->scsi_pctl, hd->scsi_psns, + hs->sc_phase); +#endif + if (ints & INTS_RESEL) { + if (hs->sc_phase == BUS_FREE_PHASE) { + temp = hd->scsi_temp & ~(1 << SCSI_ID); + for (i = 0; temp != 1; i++) { + temp >>= 1; + } + hs->sc_target = i; + *(hs->sc_lock) = SC_IN_PROGRESS; + } else + goto abort; + } else if (ints & INTS_DISCON) { + if ((hs->sc_msg[0] == MSG_CMD_COMPLETE) || (hs->sc_msg[0] == MSG_DISCONNECT)) { + hs->sc_phase = BUS_FREE_PHASE; + hs->sc_target = SCSI_ID; + if (hs->sc_msg[0] == MSG_CMD_COMPLETE) + /* SCSI IO complete */ + *(hs->sc_lock) = SC_IO_COMPLETE; + else + /* Cisconnected from Target */ + *(hs->sc_lock) = SC_DISCONNECTED; + hd->scsi_ints = ints; + return 0; + } else + goto abort; + } else if (ints & INTS_CMD_DONE) { + if (hs->sc_phase == BUS_FREE_PHASE) + goto abort; + else if (hs->sc_phase == MESG_IN_PHASE) { + hd->scsi_scmd = SCMD_RST_ACK; + hd->scsi_ints = ints; + hs->sc_phase = hd->scsi_psns & PHASE; + return 0; + } + if (hs->sc_flags & SC_SEL_TIMEOUT) + hs->sc_flags &= ~SC_SEL_TIMEOUT; + } else if (ints & INTS_SRV_REQ) { + if (hs->sc_phase != MESG_IN_PHASE) + goto abort; + } else if (ints & INTS_TIMEOUT) { + if (hs->sc_phase == ARB_SEL_PHASE) { + if (hs->sc_flags & SC_SEL_TIMEOUT) { + hs->sc_flags &= ~SC_SEL_TIMEOUT; + hs->sc_phase = BUS_FREE_PHASE; + hs->sc_target = SCSI_ID; + /* Such SCSI Device is not conected. */ + *(hs->sc_lock) = SC_DEV_NOT_FOUND; + hd->scsi_ints = ints; + return 0; + } else { + /* wait more 250 usec */ + hs->sc_flags |= SC_SEL_TIMEOUT; + hd->scsi_temp = 0; + hd->scsi_tch = 0; + hd->scsi_tcm = 0x06; + hd->scsi_tcl = 0x40; + hd->scsi_ints = ints; + return 0; + } + } else + goto abort; + } else + goto abort; + + hd->scsi_ints = ints; + + /* + * Next SCSI Transfer + */ + + while ((hd->scsi_psns & PSNS_REQ) == 0) { + DELAY(1); + } + + hs->sc_phase = hd->scsi_psns & PHASE; + + if ((hs->sc_phase == DATA_OUT_PHASE) || (hs->sc_phase == DATA_IN_PHASE)) { + len = hs->sc_len; + buf = hs->sc_buf; + } else if (hs->sc_phase == CMD_PHASE) { + len = hs->sc_cdblen; + buf = hs->sc_cdb; + } else if (hs->sc_phase == STATUS_PHASE) { + len = 1; + buf = &hs->sc_stat; + } else { + len = 1; + buf = hs->sc_msg; + } + + ixfer_start(hd, len, hs->sc_phase, 0); + if (hs->sc_phase & PHASE_IO) + ixfer_in(hd, len, buf); + else + ixfer_out(hd, len, buf); + + return 0; + + /* + * SCSI Abort + */ + abort: + /* SCSI IO failed */ + scabort(hs, hd); + hd->scsi_ints = ints; + *(hs->sc_lock) = SC_IO_FAILED; + return -1; +} diff --git a/sys/arch/luna88k/stand/boot/scsireg.h b/sys/arch/luna88k/stand/boot/scsireg.h new file mode 100644 index 00000000000..52b9fca8b21 --- /dev/null +++ b/sys/arch/luna88k/stand/boot/scsireg.h @@ -0,0 +1,427 @@ +/* $OpenBSD: scsireg.h,v 1.1 2013/10/28 22:13:13 miod Exp $ */ +/* $NetBSD: scsireg.h,v 1.2 2013/01/22 15:48:40 tsutsui Exp $ */ + +/* + * Copyright (c) 1990, 1992, 1993 + * The Regents of the University of California. All rights reserved. + * + * This code is derived from software contributed to Berkeley by + * Van Jacobson of Lawrence Berkeley Laboratory. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)scsireg.h 8.1 (Berkeley) 6/10/93 + */ + +/* + * MB89352 SCSI Protocol Controller Hardware Description. + */ + +struct scsidevice { + volatile u_char scsi_bdid, p0, p1, p2; /* 000 */ + volatile u_char scsi_sctl, p3, p4, p5; /* 004 */ +#define SCTL_DISABLE 0x80 +#define SCTL_CTRLRST 0x40 +#define SCTL_DIAG 0x20 +#define SCTL_ABRT_ENAB 0x10 +#define SCTL_PARITY_ENAB 0x08 +#define SCTL_SEL_ENAB 0x04 +#define SCTL_RESEL_ENAB 0x02 +#define SCTL_INTR_ENAB 0x01 + volatile u_char scsi_scmd, p6, p7, p8; /* 008 */ +#define SCMD_RST 0x10 +#define SCMD_ICPT_XFR 0x08 +#define SCMD_PROG_XFR 0x04 +#define SCMD_PAD 0x01 /* if initiator */ +#define SCMD_PERR_STOP 0x01 /* if target */ + /* command codes */ +#define SCMD_BUS_REL 0x00 +#define SCMD_SELECT 0x20 +#define SCMD_RST_ATN 0x40 +#define SCMD_SET_ATN 0x60 +#define SCMD_XFR 0x80 +#define SCMD_XFR_PAUSE 0xa0 +#define SCMD_RST_ACK 0xc0 +#define SCMD_SET_ACK 0xe0 + volatile u_char scsi_tmod, p9, p10, p11; /* 00C */ +#define TMOD_SYNC 0x80 + volatile u_char scsi_ints, p12, p13, p14; /* 010 */ +#define INTS_SEL 0x80 +#define INTS_RESEL 0x40 +#define INTS_DISCON 0x20 +#define INTS_CMD_DONE 0x10 +#define INTS_SRV_REQ 0x08 +#define INTS_TIMEOUT 0x04 +#define INTS_HARD_ERR 0x02 +#define INTS_RST 0x01 + volatile u_char scsi_psns, p15, p16, p17; /* 014 */ +#define PSNS_REQ 0x80 +#define PSNS_ACK 0x40 +#define PSNS_ATN 0x20 +#define PSNS_SEL 0x10 +#define PSNS_BSY 0x08 +#define scsi_sdgc scsi_psns +#define SDGC_XFER_ENAB 0x20 + volatile u_char scsi_ssts, p18, p19, p20; /* 018 */ +#define SSTS_INITIATOR 0x80 +#define SSTS_TARGET 0x40 +#define SSTS_BUSY 0x20 +#define SSTS_XFR 0x10 +#define SSTS_ACTIVE (SSTS_INITIATOR|SSTS_XFR) +#define SSTS_RST 0x08 +#define SSTS_TCZERO 0x04 +#define SSTS_DREG_FULL 0x02 +#define SSTS_DREG_EMPTY 0x01 + volatile u_char scsi_serr, p21, p22, p23; /* 01C */ +#define SERR_SCSI_PAR 0x80 +#define SERR_SPC_PAR 0x40 +#define SERR_XFER_OUT 0x20 +#define SERR_TC_PAR 0x08 +#define SERR_PHASE_ERR 0x04 +#define SERR_SHORT_XFR 0x02 +#define SERR_OFFSET 0x01 + volatile u_char scsi_pctl, p24, p25, p26; /* 020 */ +#define PCTL_BFINT_ENAB 0x80 + volatile u_char scsi_mbc, p27, p28, p29; /* 024 */ + volatile u_char scsi_dreg, p30, p31, p32; /* 028 */ + volatile u_char scsi_temp, p33, p34, p35; /* 02C */ + volatile u_char scsi_tch, p36, p37, p38; /* 030 */ + volatile u_char scsi_tcm, p39, p40, p41; /* 034 */ + volatile u_char scsi_tcl, p42, p43, p44; /* 038 */ + volatile u_char scsi_exbf, p45, p46, p47; /* 03C */ +}; + +/* psns/pctl phase lines as bits */ +#define PHASE_MSG 0x04 +#define PHASE_CD 0x02 /* =1 if 'command' */ +#define PHASE_IO 0x01 /* =1 if data inbound */ +/* Phase lines as values */ +#define PHASE 0x07 /* mask for psns/pctl phase */ +#define DATA_OUT_PHASE 0x00 +#define DATA_IN_PHASE 0x01 +#define CMD_PHASE 0x02 +#define STATUS_PHASE 0x03 +#define BUS_FREE_PHASE 0x04 +#define ARB_SEL_PHASE 0x05 /* Fuji chip combines arbitration with sel. */ +#define MESG_OUT_PHASE 0x06 +#define MESG_IN_PHASE 0x07 + +/* SCSI Messages */ + +#define MSG_CMD_COMPLETE 0x00 +#define MSG_EXT_MESSAGE 0x01 +#define MSG_SAVE_DATA_PTR 0x02 +#define MSG_RESTORE_PTR 0x03 +#define MSG_DISCONNECT 0x04 +#define MSG_INIT_DETECT_ERROR 0x05 +#define MSG_ABORT 0x06 +#define MSG_REJECT 0x07 +#define MSG_NOOP 0x08 +#define MSG_PARITY_ERROR 0x09 +#define MSG_BUS_DEVICE_RESET 0x0C +#define MSG_IDENTIFY 0x80 +#define MSG_IDENTIFY_DR 0xc0 /* (disconnect/reconnect allowed) */ +#define MSG_SYNC_REQ 0x01 + +/* SCSI Commands */ + +#define CMD_TEST_UNIT_READY 0x00 +#define CMD_REQUEST_SENSE 0x03 +#define CMD_INQUIRY 0x12 +#define CMD_SEND_DIAGNOSTIC 0x1D + +#define CMD_REWIND 0x01 +#define CMD_FORMAT_UNIT 0x04 +#define CMD_READ_BLOCK_LIMITS 0x05 +#define CMD_REASSIGN_BLOCKS 0x07 +#define CMD_READ 0x08 +#define CMD_WRITE 0x0A +#define CMD_WRITE_FILEMARK 0x10 +#define CMD_SPACE 0x11 +#define CMD_MODE_SELECT 0x15 +#define CMD_RELEASE_UNIT 0x17 +#define CMD_ERASE 0x19 +#define CMD_MODE_SENSE 0x1A +#define CMD_LOADUNLOAD 0x1B +#define CMD_RECEIVE_DIAG 0x1C +#define CMD_SEND_DIAG 0x1D +#define CMD_P_A_MEDIA_REMOVAL 0x1E +#define CMD_READ_CAPACITY 0x25 +#define CMD_READ_EXT 0x28 +#define CMD_WRITE_EXT 0x2A +#define CMD_READ_DEFECT_DATA 0x37 +#define SD_MANUFAC_DEFECTS 0x14000000 +#define SD_GROWN_DEFECTS 0x0c000000 +#define CMD_READ_BUFFER 0x3B +#define CMD_WRITE_BUFFER 0x3C +#define CMD_READ_FULL 0xF0 +#define CMD_MEDIA_TEST 0xF1 +#define CMD_ACCESS_LOG 0xF2 +#define CMD_WRITE_FULL 0xFC +#define CMD_MANAGE_PRIMARY 0xFD +#define CMD_EXECUTE_DATA 0xFE + +/* SCSI status bits */ + +#define STS_CHECKCOND 0x02 /* Check Condition (ie., read sense) */ +#define STS_CONDMET 0x04 /* Condition Met (ie., search worked) */ +#define STS_BUSY 0x08 +#define STS_INTERMED 0x10 /* Intermediate status sent */ +#define STS_EXT 0x80 /* Extended status valid */ + +/* command descriptor blocks */ + +struct scsi_cdb6 { + u_char cmd; /* command code */ + u_char lun: 3, /* logical unit on ctlr */ + lbah: 5; /* msb of read/write logical block addr */ + u_char lbam; /* middle byte of l.b.a. */ + u_char lbal; /* lsb of l.b.a. */ + u_char len; /* transfer length */ + u_char xtra; +}; + +struct scsi_cdb10 { + u_char cmd; /* command code */ + u_char lun: 3, /* logical unit on ctlr */ + : 4, + rel: 1; /* l.b.a. is relative addr if =1 */ + u_char lbah; /* msb of read/write logical block addr */ + u_char lbahm; /* high middle byte of l.b.a. */ + u_char lbalm; /* low middle byte of l.b.a. */ + u_char lbal; /* lsb of l.b.a. */ + u_char reserved; + u_char lenh; /* msb transfer length */ + u_char lenl; /* lsb transfer length */ + u_char xtra; +}; + +/* basic sense data */ + +struct scsi_sense { + u_char valid: 1, /* l.b.a. is valid */ + class: 3, + code: 4; + u_char vu: 4, /* vendor unique */ + lbah: 4; + u_char lbam; + u_char lbal; +}; + +struct scsi_xsense { + u_char valid: 1, /* l.b.a. is valid */ + class: 3, + code: 4; + u_char segment; + u_char filemark: 1, + eom: 1, + ili: 1, /* illegal length indicator */ + rsvd: 1, + key: 4; + u_char info1; + u_char info2; + u_char info3; + u_char info4; + u_char len; /* additional sense length */ +}; + +/* inquiry data */ +struct scsi_inquiry { + u_char type; + u_char qual; + u_char version; + u_char rsvd; + u_char len; + char class[3]; + char vendor_id[8]; + char product_id[16]; + char rev[4]; +}; + +struct scsi_format_parms { /* physical BFI format */ + u_short reserved; + u_short list_len; + struct defect { + unsigned cyl : 24; + unsigned head : 8; + long bytes_from_index; + } defect[127]; +}; + +struct scsi_reassign_parms { + u_short reserved; + u_short list_len; /* length in bytes of defects only */ + struct new_defect { + unsigned lba; /* logical block address */ + } new_defect[2]; +}; + +struct scsi_modesel_hdr { + u_char rsvd1; + u_char media_type; + u_char rsvd2; + u_char block_desc_len; + u_int density : 8; + u_int number_blocks :24; + u_int rsvd3 : 8; + u_int block_length :24; +}; + +struct scsi_modesense_hdr { + u_char len; + u_char media_type; + u_char wp : 1; + u_char rsvd1 : 7; + u_char block_desc_len; + u_int density : 8; + u_int number_blocks :24; + u_int rsvd2 : 8; + u_int block_length :24; +}; + +/* + * Mode Select / Mode sense "pages" + */ + +/* + * Page One - Error Recovery Parameters + */ +struct scsi_err_recovery { + u_char page_savable : 1; /* save parameters */ + u_char reserved : 1; + u_char page_code : 6; /* = 0x01 */ + u_char page_length; /* = 6 */ + u_char awre : 1; /* auto write realloc enabled */ + u_char arre : 1; /* auto read realloc enabled */ + u_char tb : 1; /* transfer block */ + u_char rc : 1; /* read continuous */ + u_char eec : 1; /* enable early correction */ + u_char per : 1; /* post error */ + u_char dte : 1; /* disable transfer on error */ + u_char dcr : 1; /* disable correction */ + u_char retry_count; + u_char correction_span; + u_char head_offset_count; + u_char strobe_offset_count; + u_char recovery_time_limit; +}; + +/* + * Page Two - Disconnect / Reconnect Control Parameters + */ +struct scsi_disco_reco { + u_char page_savable : 1; /* save parameters */ + u_char rsvd : 1; + u_char page_code : 6; /* = 0x02 */ + u_char page_length; /* = 10 */ + u_char buffer_full_ratio; /* write, how full before reconnect? */ + u_char buffer_empty_ratio; /* read, how full before reconnect? */ + + u_short bus_inactivity_limit; /* how much bus time for busy */ + u_short disconnect_time_limit; /* min to remain disconnected */ + u_short connect_time_limit; /* min to remain connected */ + u_short reserved_1; +}; + +/* + * Page Three - Direct Access Device Format Parameters + */ +struct scsi_format { + u_char page_savable : 1; /* save parameters */ + u_char rsvd : 1; + u_char page_code : 6; /* = 0x03 */ + u_char page_length; /* = 22 */ + u_short tracks_per_zone; /* Handling of Defects Fields */ + u_short alt_sect_zone; + u_short alt_tracks_zone; + u_short alt_tracks_vol; + u_short sect_track; /* Track Format Field */ + u_short data_sect; /* Sector Format Fields */ + u_short interleave; + u_short track_skew_factor; + u_short cyl_skew_factor; + u_char ssec : 1; /* Drive Type Field */ + u_char hsec : 1; + u_char rmb : 1; + u_char surf : 1; + u_char ins : 1; + u_char reserved_1 : 3; + u_char reserved_2; + u_char reserved_3; + u_char reserved_4; +}; + +/* + * Page Four - Rigid Disk Drive Geometry Parameters + */ +struct scsi_geometry { + u_char page_savable : 1; /* save parameters */ + u_char rsvd : 1; + u_char page_code : 6; /* = 0x04 */ + u_char page_length; /* = 18 */ + u_char cyl_ub; /* number of cylinders */ + u_char cyl_mb; + u_char cyl_lb; + u_char heads; /* number of heads */ + u_char precomp_cyl_ub; /* cylinder to start precomp */ + u_char precomp_cyl_mb; + u_char precomp_cyl_lb; + u_char current_cyl_ub; /* cyl to start reduced current */ + u_char current_cyl_mb; + u_char current_cyl_lb; + u_short step_rate; /* drive step rate */ + u_char landing_cyl_ub; /* landing zone cylinder */ + u_char landing_cyl_mb; + u_char landing_cyl_lb; + u_char reserved_1; + u_char reserved_2; + u_char reserved_3; +}; + +/* + * Page 0x38 - Cache Control Parameters + */ +struct scsi_cache { + u_char page_savable : 1; /* save parameters */ + u_char rsvd : 1; + u_char page_code : 6; /* = 0x38 */ + u_char page_length; /* = 14 */ + u_char rsvd_1 : 1; + u_char wie : 1; /* write index enable */ + u_char rsvd_2 : 1; + u_char ce : 1; /* cache enable */ + u_char table_size : 4; + u_char prefetch_threshold; + u_char maximum_threshold; + u_char maximumprefetch_multiplier; + u_char minimum_threshold; + u_char minimum_prefetch_multiplier; + u_char reserved[8]; +}; + +struct scsi_fmt_cdb { + int len; /* cdb length (in bytes) */ + u_char cdb[28]; /* cdb to use on next read/write */ +}; diff --git a/sys/arch/luna88k/stand/boot/scsivar.h b/sys/arch/luna88k/stand/boot/scsivar.h new file mode 100644 index 00000000000..405352e1bc6 --- /dev/null +++ b/sys/arch/luna88k/stand/boot/scsivar.h @@ -0,0 +1,100 @@ +/* $OpenBSD: scsivar.h,v 1.1 2013/10/28 22:13:13 miod Exp $ */ +/* $NetBSD: scsivar.h,v 1.1 2013/01/05 17:44:24 tsutsui Exp $ */ + +/* + * Copyright (c) 1992 OMRON Corporation. + * + * This code is derived from software contributed to Berkeley by + * OMRON Corporation. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)scsivar.h 8.1 (Berkeley) 6/10/93 + */ +/* + * Copyright (c) 1992, 1993 + * The Regents of the University of California. All rights reserved. + * + * This code is derived from software contributed to Berkeley by + * OMRON Corporation. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)scsivar.h 8.1 (Berkeley) 6/10/93 + */ + +struct scsi_softc { + struct hp_ctlr *sc_hc; + u_char *sc_buf; /* Data Buffer Pointor*/ + u_char *sc_cdb; /* CDB Buffer Pointor */ + volatile int *sc_lock; /* Lock Flag addres */ + int sc_flags; /* SPC Status Flags */ + int sc_phase; /* Current SCSI Phase */ + int sc_target; /* Current Target ID */ + int sc_len; /* Buffer Length */ + int sc_cdblen; /* CDB length */ + u_char sc_stat; + u_char sc_msg[7]; +}; + + +/* sc_lock */ + +#define SC_IN_PROGRESS 0 +#define SC_IO_COMPLETE 1 +#define SC_DISCONNECTED 2 + +#define SC_IO_FAILED -1 +#define SC_DEV_NOT_FOUND -2 + +/* sc_flags */ + +#define SC_SEL_TIMEOUT 0x00000001 diff --git a/sys/arch/luna88k/stand/boot/sd.c b/sys/arch/luna88k/stand/boot/sd.c new file mode 100644 index 00000000000..c2b7c78cca3 --- /dev/null +++ b/sys/arch/luna88k/stand/boot/sd.c @@ -0,0 +1,363 @@ +/* $OpenBSD: sd.c,v 1.1 2013/10/28 22:13:13 miod Exp $ */ +/* $NetBSD: sd.c,v 1.5 2013/01/22 15:48:40 tsutsui Exp $ */ + +/* + * Copyright (c) 1992 OMRON Corporation. + * + * This code is derived from software contributed to Berkeley by + * OMRON Corporation. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)sd.c 8.1 (Berkeley) 6/10/93 + */ +/* + * Copyright (c) 1992, 1993 + * The Regents of the University of California. All rights reserved. + * + * This code is derived from software contributed to Berkeley by + * OMRON Corporation. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)sd.c 8.1 (Berkeley) 6/10/93 + */ + +/* + * sd.c -- SCSI DISK device driver + * by A.Fujita, FEB-26-1992 + */ + + +/* + * SCSI CCS (Command Command Set) disk driver. + */ +#include <sys/param.h> +#include <sys/disklabel.h> +#include <luna88k/stand/boot/samachdep.h> +#include <luna88k/stand/boot/scsireg.h> +#include <luna88k/stand/boot/device.h> + +struct disklabel sdlabel[NSD]; + +struct sd_softc { + struct hp_device *sc_hd; + struct devqueue sc_dq; + int sc_format_pid; /* process using "format" mode */ + short sc_flags; + short sc_type; /* drive type */ + short sc_punit; /* physical unit (scsi lun) */ + u_short sc_bshift; /* convert device blocks to DEV_BSIZE blks */ + u_int sc_blks; /* number of blocks on device */ + int sc_blksize; /* device block size in bytes */ + u_int sc_wpms; /* average xfer rate in 16 bit wds/sec. */ +}; + +struct sd_devdata { + int unit; /* drive number */ + int part; /* partition */ +}; + +static int sdinit(void *); +static int sdident(struct sd_softc *, struct hp_device *); + +struct driver sddriver = { + sdinit, "sd" +}; + +struct sd_softc sd_softc[NSD]; +struct sd_devdata sd_devdata[NSD]; + +/* sc_flags values */ +#define SDF_ALIVE 0x1 + +#define sdunit(x) ((minor(x) >> 3) & 0x7) +#define sdpart(x) (minor(x) & 0x7) +#define sdpunit(x) ((x) & 7) + +static struct scsi_inquiry inqbuf; +static struct scsi_fmt_cdb inq = { + 6, + { CMD_INQUIRY, 0, 0, 0, sizeof(inqbuf), 0 } +}; + +static u_long capbuf[2]; +struct scsi_fmt_cdb cap = { + 10, + { CMD_READ_CAPACITY, 0, 0, 0, 0, 0, 0, 0, 0, 0 } +}; + +int +sdident(struct sd_softc *sc, struct hp_device *hd) +{ + char idstr[32]; + int unit; + int ctlr, slave; + int i; + int tries = 10; + + ctlr = hd->hp_ctlr; + slave = hd->hp_slave; + unit = sc->sc_punit; + + /* + * See if unit exists and is a disk then read block size & nblocks. + */ + while ((i = scsi_test_unit_rdy(ctlr, slave, unit)) != 0) { + if (i < 0 || --tries < 0) + return (-1); + if (i == STS_CHECKCOND) { + u_char sensebuf[8]; + struct scsi_xsense *sp = (struct scsi_xsense *)sensebuf; + + scsi_request_sense(ctlr, slave, unit, sensebuf, 8); + if (sp->class == 7 && sp->key == 6) + /* drive doing an RTZ -- give it a while */ + DELAY(1000000); + } + DELAY(1000); + } + if (scsi_immed_command(ctlr, slave, unit, &inq, (u_char *)&inqbuf, + sizeof(inqbuf)) || + scsi_immed_command(ctlr, slave, unit, &cap, (u_char *)&capbuf, + sizeof(capbuf))) + /* doesn't exist or not a CCS device */ + return (-1); + + switch (inqbuf.type) { + case 0: /* disk */ + case 4: /* WORM */ + case 5: /* CD-ROM */ + case 7: /* Magneto-optical */ + break; + default: /* not a disk */ + return (-1); + } + sc->sc_blks = capbuf[0]; + sc->sc_blksize = capbuf[1]; + + memcpy(idstr, &inqbuf.vendor_id, 28); + for (i = 27; i > 23; --i) + if (idstr[i] != ' ') + break; + idstr[i+1] = 0; + for (i = 23; i > 7; --i) + if (idstr[i] != ' ') + break; + idstr[i+1] = 0; + for (i = 7; i >= 0; --i) + if (idstr[i] != ' ') + break; + idstr[i+1] = 0; + printf("sd%d: %s %s rev %s", hd->hp_unit, idstr, &idstr[8], + &idstr[24]); + + printf(", %d bytes/sect x %d sectors\n", sc->sc_blksize, sc->sc_blks); + if (sc->sc_blksize != DEV_BSIZE) { + if (sc->sc_blksize < DEV_BSIZE) { + printf("sd%d: need %d byte blocks - drive ignored\n", + unit, DEV_BSIZE); + return (-1); + } + for (i = sc->sc_blksize; i > DEV_BSIZE; i >>= 1) + ++sc->sc_bshift; + sc->sc_blks <<= sc->sc_bshift; + } + sc->sc_wpms = 32 * (60 * DEV_BSIZE / 2); /* XXX */ + return(inqbuf.type); +} + +int +sdinit(void *arg) +{ + struct hp_device *hd = arg; + struct sd_softc *sc = &sd_softc[hd->hp_unit]; + struct disklabel *lp; + char *msg; + +#ifdef DEBUG + printf("sdinit: hd->hp_unit = %d\n", hd->hp_unit); + printf("sdinit: hd->hp_ctlr = %d, hd->hp_slave = %d\n", + hd->hp_ctlr, hd->hp_slave); +#endif + sc->sc_hd = hd; + sc->sc_punit = sdpunit(hd->hp_flags); + sc->sc_type = sdident(sc, hd); + if (sc->sc_type < 0) + return(0); + + /* + * Use the default sizes until we've read the label, + * or longer if there isn't one there. + */ + lp = &sdlabel[hd->hp_unit]; + + if (lp->d_secpercyl == 0) { + lp->d_secsize = DEV_BSIZE; + lp->d_nsectors = 32; + lp->d_ntracks = 20; + lp->d_secpercyl = 32*20; + lp->d_npartitions = 1; + lp->d_partitions[0].p_offset = 0; + lp->d_partitions[0].p_size = LABELSECTOR + 1; + } + + /* + * read disklabel + */ + msg = readdisklabel(hd->hp_ctlr, hd->hp_slave, lp); + if (msg != NULL) + printf("sd%d: %s\n", hd->hp_unit, msg); + + sc->sc_flags = SDF_ALIVE; + return(1); +} + +int +sdopen(struct open_file *f, ...) +{ + va_list ap; + struct sd_devdata *sd; + int unit, part; + + va_start(ap, f); + unit = va_arg(ap, int); + part = va_arg(ap, int); + va_end(ap); + + if (unit < 0 || unit >= NSD) + return(-1); + if (part < 0 || part >= 8) + return(-1); + + sd = &sd_devdata[unit]; + sd->unit = unit; + sd->part = part; + f->f_devdata = (void *)sd; + + return 0; +} + +int +sdclose(struct open_file *f) +{ + struct sd_devdata *sd = f->f_devdata; + + sd->unit = -1; + sd->part = -1; + f->f_devdata = NULL; + + return 0; +} + +static struct scsi_fmt_cdb cdb_read = { + 10, + { CMD_READ_EXT, 0, 0, 0, 0, 0, 0, 0, 0, 0 } +}; + +static struct scsi_fmt_cdb cdb_write = { + 6, + { CMD_WRITE_EXT, 0, 0, 0, 0, 0, 0, 0, 0, 0 } +}; + +int +sdstrategy(void *devdata, int func, daddr32_t dblk, size_t size, void *v_buf, + size_t *rsize) +{ + struct sd_devdata *sd = devdata; + struct disklabel *lp; + uint8_t *buf = v_buf; + int unit = sd->unit; + int part = sd->part; + struct sd_softc *sc = &sd_softc[unit]; + struct scsi_fmt_cdb *cdb; + daddr32_t blk; + u_int nblk = size >> sc->sc_bshift; + int stat, ctlr, slave; +#ifdef DEBUG + int i; +#endif + + if (unit < 0 || unit >= NSD) + return(-1); + + ctlr = sc->sc_hd->hp_ctlr; + slave = sc->sc_hd->hp_slave; + + lp = &sdlabel[unit]; + blk = dblk + (lp->d_partitions[part].p_offset >> sc->sc_bshift); + + if (func == F_READ) + cdb = &cdb_read; + else + cdb = &cdb_write; + + cdb->cdb[2] = (blk & 0xff000000) >> 24; + cdb->cdb[3] = (blk & 0x00ff0000) >> 16; + cdb->cdb[4] = (blk & 0x0000ff00) >> 8; + cdb->cdb[5] = (blk & 0x000000ff); + + cdb->cdb[7] = ((nblk >> _DEV_BSHIFT) & 0xff00) >> 8; + cdb->cdb[8] = ((nblk >> _DEV_BSHIFT) & 0x00ff); + +#ifdef DEBUG + printf("sdstrategy: unit = %d\n", unit); + printf("sdstrategy: blk = %lu (0x%lx), nblk = %u (0x%x)\n", (u_long)blk, (long)blk, nblk, nblk); + for (i = 0; i < 10; i++) + printf("sdstrategy: cdb[%d] = 0x%x\n", i, cdb->cdb[i]); + printf("sdstrategy: ctlr = %d, slave = %d\n", ctlr, slave); +#endif + stat = scsi_immed_command(ctlr, slave, sc->sc_punit, cdb, buf, size); + if (rsize) + *rsize = size; + + return 0; +} diff --git a/sys/arch/luna88k/stand/boot/setjmp.S b/sys/arch/luna88k/stand/boot/setjmp.S new file mode 100644 index 00000000000..f97fc3cc906 --- /dev/null +++ b/sys/arch/luna88k/stand/boot/setjmp.S @@ -0,0 +1,79 @@ +/* $OpenBSD: setjmp.S,v 1.1 2013/10/28 22:13:13 miod Exp $ */ +/* + * Mach Operating System + * Copyright (c) 1993-1992 Carnegie Mellon University + * Copyright (c) 1991 OMRON Corporation + * Copyright (c) 1996 Nivas Madhur + * Copyright (c) 1998 Steve Murphree, Jr. + * All Rights Reserved. + * + * Permission to use, copy, modify and distribute this software and its + * documentation is hereby granted, provided that both the copyright + * notice and this permission notice appear in all copies of the + * software, derivative works or modified versions, and any portions + * thereof, and that both notices appear in supporting documentation. + * + * CARNEGIE MELLON AND OMRON ALLOW FREE USE OF THIS SOFTWARE IN ITS "AS IS" + * CONDITION. CARNEGIE MELLON AND OMRON DISCLAIM ANY LIABILITY OF ANY KIND + * FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE. + * + * Carnegie Mellon requests users of this software to return to + * + * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU + * School of Computer Science + * Carnegie Mellon University + * Pittsburgh PA 15213-3890 + * + * any improvements or extensions that they make and grant Carnegie the + * rights to redistribute these changes. + */ + +#include <machine/asm.h> + +/* int setjmp(label_t *); */ +ENTRY(setjmp) + st %r1, %r2, 0 + st %r14, %r2, 4 + st %r15, %r2, 2*4 + st %r16, %r2, 3*4 + st %r17, %r2, 4*4 + st %r18, %r2, 5*4 + st %r19, %r2, 6*4 + st %r20, %r2, 7*4 + st %r21, %r2, 8*4 + st %r22, %r2, 9*4 + st %r23, %r2, 10*4 + st %r24, %r2, 11*4 + st %r25, %r2, 12*4 + st %r26, %r2, 13*4 + st %r27, %r2, 14*4 + st %r28, %r2, 15*4 + st %r29, %r2, 16*4 + st %r30, %r2, 17*4 + st %r31, %r2, 18*4 + jmp.n %r1 + or %r2, %r0, %r0 + +/* void longjmp(label_t*); */ +ENTRY(longjmp) + ld %r1, %r2, 0 + ld %r14, %r2, 4 + ld %r15, %r2, 2*4 + ld %r16, %r2, 3*4 + ld %r17, %r2, 4*4 + ld %r18, %r2, 5*4 + ld %r19, %r2, 6*4 + ld %r20, %r2, 7*4 + ld %r21, %r2, 8*4 + ld %r22, %r2, 9*4 + ld %r23, %r2, 10*4 + ld %r24, %r2, 11*4 + ld %r25, %r2, 12*4 + ld %r26, %r2, 13*4 + ld %r27, %r2, 14*4 + ld %r28, %r2, 15*4 + ld %r29, %r2, 16*4 + ld %r30, %r2, 17*4 + ld %r31, %r2, 18*4 + jmp.n %r1 + or %r2, %r0, 1 diff --git a/sys/arch/luna88k/stand/boot/sio.c b/sys/arch/luna88k/stand/boot/sio.c new file mode 100644 index 00000000000..c279fa994f5 --- /dev/null +++ b/sys/arch/luna88k/stand/boot/sio.c @@ -0,0 +1,249 @@ +/* $OpenBSD: sio.c,v 1.1 2013/10/28 22:13:13 miod Exp $ */ +/* $NetBSD: sio.c,v 1.3 2013/01/21 11:58:12 tsutsui Exp $ */ + +/* + * Copyright (c) 1992 OMRON Corporation. + * + * This code is derived from software contributed to Berkeley by + * OMRON Corporation. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)sio.c 8.1 (Berkeley) 6/10/93 + */ +/* + * Copyright (c) 1992, 1993 + * The Regents of the University of California. All rights reserved. + * + * This code is derived from software contributed to Berkeley by + * OMRON Corporation. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)sio.c 8.1 (Berkeley) 6/10/93 + */ + +/* sio.c NOV-25-1991 */ + +#define NSIO 2 + +#include <sys/param.h> +#include <luna88k/stand/boot/samachdep.h> +#include <luna88k/stand/boot/sioreg.h> +#include <luna88k/stand/boot/rcvbuf.h> +#include <luna88k/stand/boot/kbdreg.h> + +static int siointr(int); +static int sioreg(int, int); + +struct rcvbuf rcvbuf[NSIO]; + +int sioconsole = -1; +struct siodevice *sio_addr[2]; +int cur_unit; + + +#define siounit(x) ( x & 0xffff ) +#define isprint(c) ((c >= 0x20) && (c < 0x7F) ? 1 : 0) + + +void +_siointr(void) +{ + int unit; + + for (unit = 0; unit < NSIO; unit++) + while (siointr(unit) != 0) + continue; +} + +int +siointr(int unit) +{ +/* struct siodevice *sio = sio_addr[unit]; */ + int rr0 = sioreg(REG(unit, RR0), 0); + int rr1 = sioreg(REG(unit, RR1), 0); + + if (rr0 & RR0_RXAVAIL) { + if (rr1 & RR1_FRAMING) + return 1; + + if (rr1 & (RR1_PARITY | RR1_OVERRUN)) + sioreg(REG(unit, WR0), WR0_ERRRST); /* Channel-A Error Reset */ + + if (unit == 1) { + int c = kbd_decode(sio_addr[unit]->sio_data); + + if ((c & KC_TYPE) == KC_CODE) + PUSH_RBUF(unit, c); + } else { + PUSH_RBUF(unit, sio_addr[unit]->sio_data); + } + return 1; + } + + return 0; +} + +/* + * Following are all routines needed for SIO to act as console + */ +#include <dev/cons.h> + +void +siocnprobe(struct consdev *cp) +{ + sio_addr[0] = (struct siodevice *) 0x51000000; + sio_addr[1] = (struct siodevice *) 0x51000008; + + /* make sure hardware exists */ + if (badaddr(sio_addr[0], 4) != 0) { + cp->cn_pri = CN_DEAD; + return; + } + + /* locate the major number */ + + /* initialize required fields */ + cp->cn_dev = cur_unit = 0; + cp->cn_pri = CN_LOWPRI; +} + +void +siocninit(struct consdev *cp) +{ + int unit = siounit(cp->cn_dev); + + sioinit(); + sioconsole = unit; +} + +int +siocngetc(dev_t dev) +{ + int c, unit = siounit(dev); + + _siointr(); + if (RBUF_EMPTY(unit)) + return 0; + + POP_RBUF(unit, c); + + return(c); +} + +void +siocnputc(dev_t dev, int c) +{ + int unit = siounit(dev); + + if (sioconsole == -1) { + (void) sioinit(); + sioconsole = unit; + } + + /* wait for any pending transmission to finish */ + while ((sioreg(REG(unit, RR0), 0) & RR0_TXEMPTY) == 0); + + sio_addr[unit]->sio_data = (c & 0xFF); + + /* wait for any pending transmission to finish */ + while ((sioreg(REG(unit, RR0), 0) & RR0_TXEMPTY) == 0); +} + +/* SIO misc routines */ + +void +sioinit(void) +{ + RBUF_INIT(0); + RBUF_INIT(1); + + sioreg(REG(0, WR0), WR0_CHANRST); /* Channel-A Reset */ + + sioreg(WR2A, WR2_VEC86 | WR2_INTR_1); /* Set CPU BUS Interface Mode */ + sioreg(WR2B, 0); /* Set Interrupt Vector */ + + sioreg(REG(0, WR0), WR0_RSTINT); /* Reset E/S Interrupt */ + sioreg(REG(0, WR4), WR4_BAUD96 | WR4_STOP1 | WR4_NPARITY); /* Tx/Rx */ + sioreg(REG(0, WR3), WR3_RX8BIT | WR3_RXENBL); /* Rx */ + sioreg(REG(0, WR5), WR5_TX8BIT | WR5_TXENBL | WR5_DTR | WR5_RTS); /* Tx */ + sioreg(REG(0, WR0), WR0_RSTINT); /* Reset E/S Interrupt */ + sioreg(REG(0, WR1), WR1_RXALLS); /* Interrupted All Char. */ + + sioreg(REG(1, WR0), WR0_CHANRST); /* Channel-A Reset */ + + sioreg(REG(1, WR0), WR0_RSTINT); /* Reset E/S Interrupt */ + sioreg(REG(1, WR4), WR4_BAUD96 | WR4_STOP1 | WR4_NPARITY); /* Tx/Rx */ + sioreg(REG(1, WR3), WR3_RX8BIT | WR3_RXENBL); /* Rx */ + sioreg(REG(1, WR5), WR5_TX8BIT | WR5_TXENBL); /* Tx */ + sioreg(REG(1, WR0), WR0_RSTINT); /* Reset E/S Interrupt */ + sioreg(REG(1, WR1), WR1_RXALLS); /* Interrupted All Char. */ +} + +int +sioreg(int reg, int val) +{ + int chan; + + chan = CHANNEL(reg); + + if (isStatusReg(reg)) { + if (REGNO(reg) != 0) + sio_addr[chan]->sio_cmd = REGNO(reg); + return(sio_addr[chan]->sio_stat); + } else { + if (REGNO(reg) != 0) + sio_addr[chan]->sio_cmd = REGNO(reg); + sio_addr[chan]->sio_cmd = val; + return(val); + } +} diff --git a/sys/arch/luna88k/stand/boot/sioreg.h b/sys/arch/luna88k/stand/boot/sioreg.h new file mode 100644 index 00000000000..73f748055b7 --- /dev/null +++ b/sys/arch/luna88k/stand/boot/sioreg.h @@ -0,0 +1,170 @@ +/* $OpenBSD: sioreg.h,v 1.1 2013/10/28 22:13:13 miod Exp $ */ +/* $NetBSD: sioreg.h,v 1.2 2013/01/12 07:04:57 tsutsui Exp $ */ + +/* + * Copyright (c) 1992 OMRON Corporation. + * + * This code is derived from software contributed to Berkeley by + * OMRON Corporation. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)sioreg.h 8.1 (Berkeley) 6/10/93 + */ +/* + * Copyright (c) 1992, 1993 + * The Regents of the University of California. All rights reserved. + * + * This code is derived from software contributed to Berkeley by + * OMRON Corporation. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)sioreg.h 8.1 (Berkeley) 6/10/93 + */ + +/* sioreg.h NOV-26-1991 */ + +struct siodevice { + volatile u_char sio_data; + u_char sio_pad1[3]; + volatile u_char sio_cmd; + u_char sio_pad2[3]; +}; + +#define sio_stat sio_cmd + +#define REG(u, r) ( (u << 4) | r ) +#define CHANNEL(r) ( r >> 4 ) +#define REGNO(r) ( r & 0x07 ) +#define isStatusReg(r) ( r & 0x08 ) + +#define WR0 0x00 +#define WR1 0x01 +#define WR2 0x02 +#define WR3 0x03 +#define WR4 0x04 +#define WR5 0x05 +#define WR6 0x06 +#define WR7 0x07 + +#define WR2A 0x02 +#define WR2B 0x12 + +#define RR0 0x08 +#define RR1 0x09 +#define RR2 0x0A +#define RR3 0x0B +#define RR4 0x0C + +#define RR2A 0x0A +#define RR2B 0x1A + +#define WR0_NOP 0x00 /* No Operation */ +#define WR0_SNDABRT 0x08 /* Send Abort (HDLC) */ +#define WR0_RSTINT 0x10 /* Reset External/Status Interrupt */ +#define WR0_CHANRST 0x18 /* Channel Reset */ +#define WR0_INTNXT 0x20 /* Enable Interrupt on Next Receive Character */ +#define WR0_RSTPEND 0x28 /* Reset Transmitter Interrput/DMA Pending */ +#define WR0_ERRRST 0x30 /* Error Reset */ +#define WR0_ENDINTR 0x38 /* End of Interrupt */ + +#define WR1_ESENBL 0x01 /* External/Status Interrupt Enable */ +#define WR1_TXENBL 0x02 /* Tx Interrupt/DMA Enable */ +#define WR1_STATVEC 0x04 /* Status Affects Vector (Only Chan-B) */ +#define WR1_RXDSEBL 0x00 /* Rx Interrupt/DMA Disable */ +#define WR1_RXFIRST 0x08 /* Interrupt only First Character Received */ +#define WR1_RXALLS 0x10 /* Interrupt Every Characters Received (with Special Char.) */ +#define WR1_RXALL 0x18 /* Interrupt Every Characters Received (without Special Char.) */ + +#define WR2_INTR_0 0x00 /* Interrupt Priority: RxA TxA RxB TxB E/SA E/SA */ +#define WR2_INTR_1 0x04 /* Interrupt Priority: RxA RxB TxA TxB E/SA E/SA */ +#define WR2_VEC85_1 0x00 /* 8085 Vectored Mode - 1 */ +#define WR2_VEC85_2 0x08 /* 8085 Vectored Mode - 2 */ +#define WR2_VEC86 0x10 /* 8086 Vectored */ +#define WR2_VEC85_3 0x18 /* 8085 Vectored Mode - 3 */ + +#define WR3_RXENBL 0x01 /* Rx Enable */ +#define WR3_RXCRC 0x08 /* Rx CRC Check */ +#define WR3_AUTOEBL 0x20 /* Auto Enable (flow control for MODEM) */ +#define WR3_RX5BIT 0x00 /* Rx Bits/Character: 5 Bits */ +#define WR3_RX7BIT 0x40 /* Rx Bits/Character: 7 Bits */ +#define WR3_RX6BIT 0x80 /* Rx Bits/Character: 6 Bits */ +#define WR3_RX8BIT 0xc0 /* Rx Bits/Character: 8 Bits */ + +#define WR4_NPARITY 0x00 /* No Parity */ +#define WR4_OPARITY 0x01 /* Parity Odd */ +#define WR4_EPARITY 0x02 /* Parity Even */ +#define WR4_STOP1 0x04 /* Stop Bits (1bit) */ +#define WR4_STOP15 0x08 /* Stop Bits (1.5bit) */ +#define WR4_STOP2 0x0c /* Stop Bits (2bit) */ +#define WR4_BAUD96 0x40 /* Clock Rate (9600 BAUD) */ +#define WR4_BAUD48 0x80 /* Clock Rate (4800 BAUD) */ +#define WR4_BAUD24 0xc0 /* Clock Rate (2400 BAUD) */ + +#define WR5_TXCRC 0x01 /* Tx CRC Check */ +#define WR5_RTS 0x02 /* Request To Send [RTS] */ +#define WR5_TXENBL 0x08 /* Transmit Enable */ +#define WR5_BREAK 0x10 /* Send Break */ +#define WR5_TX5BIT 0x00 /* Tx Bits/Character: 5 Bits */ +#define WR5_TX7BIT 0x20 /* Tx Bits/Character: 7 Bits */ +#define WR5_TX6BIT 0x40 /* Tx Bits/Character: 6 Bits */ +#define WR5_TX8BIT 0x60 /* Tx Bits/Character: 8 Bits */ +#define WR5_DTR 0x80 /* Data Terminal Ready [DTR] */ + +#define RR0_RXAVAIL 0x01 /* Rx Character Available */ +#define RR0_INTRPEND 0x02 /* Interrupt Pending (Channel-A Only) */ +#define RR0_TXEMPTY 0x04 /* Tx Buffer Empty */ +#define RR0_BREAK 0x80 /* Break Detected */ + +#define RR1_PARITY 0x10 /* Parity Error */ +#define RR1_OVERRUN 0x20 /* Data Over Run */ +#define RR1_FRAMING 0x40 /* Framing Error */ diff --git a/sys/arch/luna88k/stand/boot/status.h b/sys/arch/luna88k/stand/boot/status.h new file mode 100644 index 00000000000..0783660a9fc --- /dev/null +++ b/sys/arch/luna88k/stand/boot/status.h @@ -0,0 +1,84 @@ +/* $OpenBSD: status.h,v 1.1 2013/10/28 22:13:13 miod Exp $ */ +/* $NetBSD: status.h,v 1.1 2013/01/05 17:44:24 tsutsui Exp $ */ + +/* + * Copyright (c) 1992 OMRON Corporation. + * + * This code is derived from software contributed to Berkeley by + * OMRON Corporation. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)status.h 8.1 (Berkeley) 6/10/93 + */ +/* + * Copyright (c) 1992, 1993 + * The Regents of the University of California. All rights reserved. + * + * This code is derived from software contributed to Berkeley by + * OMRON Corporation. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)status.h 8.1 (Berkeley) 6/10/93 + */ + +/* + * status.h -- status code table for internal commands + * by A.Fujita, FEB-02-1992 + */ + + +#define ST_NORMAL 0 +#define ST_EXIT -1 +#define ST_NOTFOUND -2 + +#define ST_ERROR 1 diff --git a/sys/arch/luna88k/stand/boot/ufs_disksubr.c b/sys/arch/luna88k/stand/boot/ufs_disksubr.c new file mode 100644 index 00000000000..bf7ffa1dc03 --- /dev/null +++ b/sys/arch/luna88k/stand/boot/ufs_disksubr.c @@ -0,0 +1,258 @@ +/* $OpenBSD: ufs_disksubr.c,v 1.1 2013/10/28 22:13:13 miod Exp $ */ +/* $NetBSD: ufs_disksubr.c,v 1.2 2013/01/14 01:37:57 tsutsui Exp $ */ + +/* + * Copyright (c) 1992 OMRON Corporation. + * + * This code is derived from software contributed to Berkeley by + * OMRON Corporation. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)ufs_disksubr.c 8.1 (Berkeley) 6/10/93 + */ +/* + * Copyright (c) 1992, 1993 + * The Regents of the University of California. All rights reserved. + * + * This code is derived from software contributed to Berkeley by + * OMRON Corporation. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)ufs_disksubr.c 8.1 (Berkeley) 6/10/93 + */ + +/* + * ufs_disksubr.c -- disk utility routines + * by A.Fujita, FEB-26-1992 + */ + +#include <sys/param.h> +#include <sys/disklabel.h> +#include <dev/sun/disklabel.h> +#include <luna88k/stand/boot/samachdep.h> +#include <luna88k/stand/boot/scsireg.h> + +#define BBSIZE 8192 +#define LABEL_SIZE BBSIZE +u_char lbl_buff[LABEL_SIZE]; + +/* + * Given a struct sun_disklabel, assume it has an extended partition + * table and compute the correct value for sl_xpsum. + */ +static __inline u_int +sun_extended_sum(struct sun_disklabel *sl, void *end) +{ + u_int sum, *xp, *ep; + + xp = (u_int *)&sl->sl_xpmag; + ep = (u_int *)end; + + sum = 0; + for (; xp < ep; xp++) + sum += *xp; + return (sum); +} + +/* + * Attempt to read a disk label from a device + * using the indicated stategy routine. + * The label must be partly set up before this: + * secpercyl and anything required in the strategy routine + * (e.g., sector size) must be filled in before calling us. + * Returns null on success and an error string on failure. + */ +char * +readdisklabel(int ctlr, int id, struct disklabel *lp) +{ + u_char *bp = lbl_buff; + struct sun_disklabel *slp; + struct partition *npp; + struct sun_dkpart *spp; + u_short cksum = 0, *sp1, *sp2; + int i, secpercyl; + static struct scsi_fmt_cdb cdb = { + 6, + { CMD_READ, 0, 0, 0, 1, 0 } + }; + + if (lp->d_secperunit == 0) + lp->d_secperunit = 0x1fffffff; + lp->d_npartitions = 1; + if (lp->d_partitions[0].p_size == 0) + lp->d_partitions[0].p_size = 0x1fffffff; + lp->d_partitions[0].p_offset = 0; + + if (scsi_immed_command(ctlr, id, 0, &cdb, bp, DEV_BSIZE) != 0) + return "I/O error"; + + slp = (struct sun_disklabel *)bp; + if (slp->sl_magic != SUN_DKMAGIC) + return "no disk label"; + + sp1 = (u_short *)slp; + sp2 = (u_short *)(slp + 1); + while (sp1 < sp2) + cksum ^= *sp1++; + if (cksum != 0) + return "disk label corrupted"; + + lp->d_magic = DISKMAGIC; + lp->d_magic2 = DISKMAGIC; + lp->d_flags = D_VENDOR; + memcpy(lp->d_packname, slp->sl_text, sizeof(lp->d_packname)); + lp->d_nsectors = slp->sl_nsectors; + lp->d_ntracks = slp->sl_ntracks; + lp->d_ncylinders = slp->sl_ncylinders; + + secpercyl = slp->sl_nsectors * slp->sl_ntracks; + lp->d_secpercyl = secpercyl; + if (DL_GETDSIZE(lp) == 0) + DL_SETDSIZE(lp, (daddr_t)secpercyl * slp->sl_ncylinders); + lp->d_version = 1; + + memcpy(&lp->d_uid, &slp->sl_uid, sizeof(slp->sl_uid)); + + lp->d_acylinders = slp->sl_acylinders; + + lp->d_npartitions = MAXPARTITIONS; + /* These are as defined in <ufs/ffs/fs.h> */ + lp->d_bbsize = BBSIZE; /* XXX */ + lp->d_sbsize = BBSIZE; /* XXX */ + + for (i = 0; i < 8; i++) { + spp = &slp->sl_part[i]; + npp = &lp->d_partitions[i]; + /* UniOS label uses blkoffset, not cyloffset */ + DL_SETPOFFSET(npp, spp->sdkp_cyloffset); + DL_SETPSIZE(npp, spp->sdkp_nsectors); + if (DL_GETPSIZE(npp) == 0) { + npp->p_fstype = FS_UNUSED; + } else { + npp->p_fstype = i == 2 ? FS_UNUSED : + i == 1 ? FS_SWAP : FS_BSDFFS; + if (npp->p_fstype == FS_BSDFFS) { + /* + * The sun label does not store the FFS fields, + * so just set them with default values here. + */ + npp->p_fragblock = 8 | 3 + /* DISKLABELV1_FFS_FRAGBLOCK(2048, 8); */ ; + npp->p_cpg = 16; + } + } + } + + /* + * XXX BandAid XXX + * UniOS rootfs sits on part c which don't begin at sect 0, + * and impossible to mount. Thus, make it usable as part b. + * XXX how to setup a swap partition on disks shared with UniOS??? + */ + if (slp->sl_rpm == 0 && DL_GETPOFFSET(&lp->d_partitions[2]) != 0) { + lp->d_partitions[1] = lp->d_partitions[2]; + lp->d_partitions[1].p_fstype = FS_BSDFFS; + } + + /* Clear "extended" partition info, tentatively */ + for (i = 0; i < SUNXPART; i++) { + npp = &lp->d_partitions[i+8]; + DL_SETPOFFSET(npp, 0); + DL_SETPSIZE(npp, 0); + npp->p_fstype = FS_UNUSED; + } + + /* Check to see if there's an "extended" partition table + * SL_XPMAG partitions had checksums up to just before the + * (new) sl_types variable, while SL_XPMAGTYP partitions have + * checksums up to the just before the (new) sl_xxx1 variable. + */ + if ((slp->sl_xpmag == SL_XPMAG && + sun_extended_sum(slp, &slp->sl_types) == slp->sl_xpsum) || + (slp->sl_xpmag == SL_XPMAGTYP && + sun_extended_sum(slp, &slp->sl_xxx1) == slp->sl_xpsum)) { + /* + * There is. Copy over the "extended" partitions. + * This code parallels the loop for partitions a-h. + */ + for (i = 0; i < SUNXPART; i++) { + spp = &slp->sl_xpart[i]; + npp = &lp->d_partitions[i+8]; + DL_SETPOFFSET(npp, spp->sdkp_cyloffset); + DL_SETPSIZE(npp, spp->sdkp_nsectors); + if (DL_GETPSIZE(npp) == 0) { + npp->p_fstype = FS_UNUSED; + continue; + } + npp->p_fstype = FS_BSDFFS; + if (npp->p_fstype == FS_BSDFFS) { + npp->p_fragblock = 8 | 3 + /* DISKLABELV1_FFS_FRAGBLOCK(2048, 8); */ ; + npp->p_cpg = 16; + } + } + if (slp->sl_xpmag == SL_XPMAGTYP) { + for (i = 0; i < MAXPARTITIONS; i++) { + npp = &lp->d_partitions[i]; + npp->p_fstype = slp->sl_types[i]; + npp->p_fragblock = slp->sl_fragblock[i]; + npp->p_cpg = slp->sl_cpg[i]; + } + } + } + + lp->d_checksum = 0; + lp->d_checksum = dkcksum(lp); + + return NULL; +} |