of it. Crank version to 0.8.
ok aoyama@
-# $OpenBSD: Makefile,v 1.12 2019/12/10 11:28:13 aoyama Exp $
+# $OpenBSD: Makefile,v 1.13 2023/01/10 17:10:57 miod Exp $
# $NetBSD: Makefile,v 1.9 2013/01/22 15:48:40 tsutsui Exp $
# @(#)Makefile 8.2 (Berkeley) 8/15/93
SRCS= locore.S
SRCS+= init_main.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+= exec.c
SRCS+= sio.c
SRCS+= bmc.c bmd.c font.c kbd.c
SRCS+= sc.c sd.c
### find out what to use for libkern
.PATH: ${S}/lib/libkern
SRCS+= memcpy.c memmove.c strlcat.c strlcpy.c strlen.c
-SRCS+= muldi3.c negdi2.c ashldi3.c ashrdi3.c
+SRCS+= muldi3.c negdi2.c ashldi3.c ashrdi3.c moddi3.c
### find out what to use for libsa
.PATH: ${S}/lib/libsa
-SRCS+= arc4.c strtol.c
+SRCS+= arc4.c ctime.c hexdump.c strtol.c strtoll.c
+
+### MI boot code
+.PATH: ${S}/stand/boot
+SRCS+= boot.c cmd.c vars.c
SAREL=
SADST= ${.CURDIR}/${__objdir}
+++ /dev/null
-/* $OpenBSD: awaitkey.c,v 1.2 2013/10/29 21:49:07 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, timeout);
- printf("\n");
- }
- return c;
-}
-/* $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));
-}
-/* $OpenBSD: bmc.c,v 1.1 2013/10/28 22:13:12 miod Exp $ */
+/* $OpenBSD: bmc.c,v 1.2 2023/01/10 17:10:57 miod Exp $ */
/* $NetBSD: bmc.c,v 1.4 2013/01/21 11:58:12 tsutsui Exp $ */
/*
int
bmccngetc(dev_t dev)
{
- int c;
- int unit = 1;
+ int c, unit = 1, poll = (dev & 0x80) != 0;
- _siointr();
- if (RBUF_EMPTY(unit))
- return 0;
+ siointr(unit);
- POP_RBUF(unit, c);
+ if (poll) {
+ if (RBUF_EMPTY(unit))
+ return 0;
+ PEEK_RBUF(unit, c);
+ return c;
+ }
- return(c);
-/*
- return(siocngetc(dev));
- */
+ while (RBUF_EMPTY(unit)) {
+ DELAY(1);
+ siointr(unit);
+ }
+
+ POP_RBUF(unit, c);
+ return c;
}
void
+++ /dev/null
-/* $OpenBSD: boot.c,v 1.12 2022/12/31 02:42:01 aoyama 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/stat.h>
-#define _KERNEL
-#include <sys/fcntl.h>
-#undef _KERNEL
-
-#include <lib/libkern/libkern.h>
-#include <luna88k/stand/boot/samachdep.h>
-#include <luna88k/stand/boot/status.h>
-#include <lib/libsa/loadfile.h>
-#include <lib/libsa/arc4.h>
-
-int howto;
-
-int loadrandom(const char *, char *, size_t);
-#if 0
-static int get_boot_device(const char *, int *, int *, int *);
-#endif
-
-void (*cpu_boot)(uint32_t, uint32_t, uint32_t, uint32_t);
-uint32_t cpu_bootarg1;
-uint32_t cpu_bootarg2;
-uint32_t cpu_bootarg3; /* set at devopen() */
-uint32_t cpu_bootarg4 = RB_AUTOBOOT;
-
-char rnddata[BOOTRANDOM_MAX];
-struct rc4_ctx randomctx;
-
-#if 0
-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++;
- }
-
- p++;
- for (; *p != ',' && *p != ')'; p++) {
- if (*p == '\0')
- goto error;
- if (*p >= '0' && *p <= '9')
- unit = (unit * 10) + (*p - '0');
- }
-
- if (*p == ',')
- p++;
- for (; *p != ')'; 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;
-}
-#endif
-
-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;
-#if 0
- int dev, unit, part;
-#endif
- uint64_t marks[MARK_MAX];
- char *lparen, *rparen;
- char rndpath[MAXPATHLEN];
- static int rnd_loaded = 0;
-
-#if 0
- if (get_boot_device(line, &dev, &unit, &part) != 0) {
- printf("Bad file name %s\n", line);
- return ST_ERROR;
- }
-#endif
-
- /*
- * Try and load randomness from the boot device.
- */
- if (rnd_loaded == 0) {
- lparen = strchr(line, '(');
- if (lparen != NULL)
- rparen = strchr(line, ')');
- else
- rparen = NULL;
- if (rparen != NULL &&
- rparen + 1 - line < sizeof rndpath) {
- rparen++;
- memcpy(rndpath, line, rparen - line);
- rndpath[rparen - line] = '\0';
- strlcat(rndpath, BOOTRANDOM, sizeof rndpath);
- } else
- strlcpy(rndpath, BOOTRANDOM, sizeof rndpath);
-
- rnd_loaded = loadrandom(rndpath, rnddata, sizeof(rnddata));
- if (rnd_loaded == 0)
- cpu_bootarg4 |= RB_GOODRANDOM;
- }
-
- rc4_keysetup(&randomctx, rnddata, sizeof rnddata);
- rc4_skip(&randomctx, 1536);
-
- /* 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 = (uint32_t)marks[MARK_END];
-#ifdef DEBUG
- printf("bootarg: 0x%08x, 0x%08x, 0x%08x, 0x%08x\n",
- cpu_bootarg1, cpu_bootarg2, cpu_bootarg3, cpu_bootarg4);
-#endif
- cpu_boot = (void (*)(uint32_t, uint32_t, uint32_t, uint32_t))
- (uint32_t)marks[MARK_ENTRY];
- (*cpu_boot)(cpu_bootarg1, cpu_bootarg2, cpu_bootarg3,
- cpu_bootarg4);
- }
- printf("Booting kernel failed. (%s)\n", strerror(errno));
-
- return ST_ERROR;
-}
-
-int
-loadrandom(const char *name, char *buf, size_t buflen)
-{
- struct stat sb;
- int fd, error = 0;
-
- fd = open(name, O_RDONLY);
- if (fd == -1) {
- if (errno != EPERM)
- printf("cannot open %s: %s\n", name, strerror(errno));
- return -1;
- }
- if (fstat(fd, &sb) == -1) {
- error = -1;
- goto done;
- }
- if (read(fd, buf, buflen) != buflen) {
- error = -1;
- goto done;
- }
- if (sb.st_mode & S_ISTXT) {
- printf("NOTE: random seed is being reused.\n");
- error = -1;
- goto done;
- }
- fchmod(fd, sb.st_mode | S_ISTXT);
-done:
- close(fd);
- return (error);
-}
-/* $OpenBSD: boot.ldscript,v 1.2 2013/10/30 18:40:38 miod Exp $ */
+/* $OpenBSD: boot.ldscript,v 1.3 2023/01/10 17:10:57 miod Exp $ */
/*
* Copyright (c) 2012 Miodrag Vallat.
*/
/*
- * 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.
+ * This linker script is used to merge .rodata into .text. 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)
-/* $OpenBSD: dev_net.c,v 1.5 2021/03/11 11:16:58 jsg Exp $ */
+/* $OpenBSD: dev_net.c,v 1.6 2023/01/10 17:10:57 miod Exp $ */
/* $NetBSD: dev_net.c,v 1.26 2011/07/17 20:54:52 joerg Exp $ */
/*-
static int net_getparams(int);
#ifdef DEBUG
-int debug;
+extern int debug;
#endif
/*
+/* $OpenBSD: dev_net.h,v 1.3 2023/01/10 17:10:57 miod Exp $ */
/* $NetBSD: dev_net.h,v 1.6 2009/01/17 14:00:36 tsutsui Exp $ */
int net_open(struct open_file *, ...);
-/* $OpenBSD: devopen.c,v 1.3 2022/10/14 20:53:18 aoyama Exp $ */
+/* $OpenBSD: devopen.c,v 1.4 2023/01/10 17:10:57 miod Exp $ */
/* $NetBSD: devopen.c,v 1.3 2013/01/16 15:46:20 tsutsui Exp $ */
/*
return ENXIO;
#ifdef DEBUG
- printf("%s: %s(%d,%d)%s\n", __func__,
+ 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__,
+ printf("%s: open %s(%d,%d):%s failed (%s)\n", __func__,
devsw[dev].dv_name, unit, part, *file, strerror(error));
#endif
return error;
f->f_dev = dp;
/* Save boot device information to pass to the kernel */
- cpu_bootarg3 = MAKEBOOTDEV(dev, 0, unit / 10, 6 - unit % 10, part);
+ bootdev = MAKEBOOTDEV(dev, 0, unit / 10, 6 - unit % 10, part);
return 0;
}
*unitp = unit;
*partp = part;
cp++;
+ if (*cp == ':')
+ cp++;
if (*cp == '\0')
*fname = "bsd";
else
*fname = (char *)cp; /* XXX */
#ifdef DEBUG
- printf("%s: major = %d, unit = %d, part = %d, fname = %s\n",
- __func__, major, unit, part, *fname);
+ printf("%s(%s): major = %d, unit = %d, part = %d, fname = %s\n",
+ __func__, str, major, unit, part, *fname);
#endif
return 0;
--- /dev/null
+/* $OpenBSD: exec.c,v 1.1 2023/01/10 17:10:57 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
+ */
+
+#include <sys/param.h>
+#include <sys/reboot.h>
+
+#include <luna88k/stand/boot/samachdep.h>
+#include <lib/libsa/loadfile.h>
+
+#define BOOT_MAGIC 0xf1abde3f
+
+void (*cpu_boot)(uint32_t, uint32_t, uint32_t, uint32_t);
+uint32_t cpu_bootarg1;
+uint32_t cpu_bootarg2;
+uint32_t cpu_bootarg3;
+uint32_t cpu_bootarg4;
+
+void
+run_loadfile(uint64_t *marks, int howto)
+{
+#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 = (uint32_t)marks[MARK_END];
+ cpu_bootarg3 = bootdev; /* set by devopen */
+ cpu_bootarg4 = howto;
+#ifdef DEBUG
+ printf("bootarg: 0x%08x, 0x%08x, 0x%08x, 0x%08x\n",
+ cpu_bootarg1, cpu_bootarg2, cpu_bootarg3, howto);
+#endif
+ cpu_boot = (void (*)(uint32_t, uint32_t, uint32_t, uint32_t))
+ (uint32_t)marks[MARK_ENTRY];
+ (*cpu_boot)(cpu_bootarg1, cpu_bootarg2, cpu_bootarg3, cpu_bootarg4);
+}
+++ /dev/null
-/* $OpenBSD: getline.c,v 1.3 2013/10/30 18:22:07 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(const char *prompt, char *buff)
-{
- int c;
- char *p, *lp = buff;
-
- printf("%s", prompt);
-
- for (;;) {
- c = getchar() & 0x7f;
-
- switch (c) {
- case '\n':
- case '\r':
- *lp = '\0';
- putchar('\n');
- goto outloop;
-
- case '\b':
- case 0x7f:
- if (lp > buff) {
- lp--;
- putchar('\b');
- putchar(' ');
- putchar('\b');
- }
- break;
-
- case 'r' & 0x1f:
- putchar('\n');
- printf("%s", prompt);
- for (p = buff; p < lp; ++p)
- putchar(*p);
- break;
-
- case 'u' & 0x1f:
- case 'w' & 0x1f:
- lp = buff;
- printf("\n%s", prompt);
- break;
-
- default:
- *lp++ = c;
- putchar(c);
- break;
- }
- }
-
- outloop:
- *lp = '\0';
- return lp - buff;
-}
-/* $OpenBSD: getsecs.c,v 1.3 2013/11/12 13:56:23 aoyama Exp $ */
+/* $OpenBSD: getsecs.c,v 1.4 2023/01/10 17:10:57 miod Exp $ */
/* $NetBSD: getsecs.c,v 1.1 2013/01/13 14:10:55 tsutsui Exp $ */
/*-
#define _DS_SET(off, data) \
do { *chiptime = (off); *chipdata = (u_int8_t)(data); } while (0)
+/*
+ * Convert a single byte between (unsigned) packed bcd and binary.
+ * Public domain.
+ */
+unsigned int
+bcdtobin(unsigned int bcd)
+{
+
+ return (((bcd >> 4) & 0x0f) * 10 + (bcd & 0x0f));
+}
+
time_t
getsecs(void)
{
-/* $OpenBSD: if_le.c,v 1.4 2014/08/21 14:24:08 mpi Exp $ */
+/* $OpenBSD: if_le.c,v 1.5 2023/01/10 17:10:57 miod Exp $ */
/* $NetBSD: if_le.c,v 1.3 2013/01/22 15:48:40 tsutsui Exp $ */
/*
#include <sys/param.h>
#include <netinet/in.h>
+#ifdef DEBUG
+#include <sys/socket.h>
+#include <net/if_arp.h>
+#include <netinet/if_ether.h>
+#endif
#include <luna88k/stand/boot/samachdep.h>
#include <machine/board.h>
-/* $OpenBSD: init_main.c,v 1.9 2022/10/14 20:53:19 aoyama Exp $ */
+/* $OpenBSD: init_main.c,v 1.10 2023/01/10 17:10:57 miod Exp $ */
/* $NetBSD: init_main.c,v 1.6 2013/03/05 15:34:53 tsutsui Exp $ */
/*
* rights to redistribute these changes.
*/
+const char version[] = "0.8";
+
#include <sys/param.h>
-#define _KERNEL
-#include <sys/fcntl.h>
-#undef _KERNEL
#include <lib/libkern/libkern.h>
#include <machine/board.h>
#include <luna88k/stand/boot/samachdep.h>
-#include <luna88k/stand/boot/status.h>
-#include <lib/libsa/loadfile.h>
+#include <stand/boot/cmd.h>
+
#include "dev_net.h"
static void get_fuse_rom_data(void);
int cpuspeed; /* for DELAY() macro */
int machtype;
-char default_file[64];
-char upgrade_file[64];
+
+uint32_t bootdev;
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;
-
-static const char prompt[] = "boot> ";
-
+#ifdef DEBUG
int debug;
-
-int exist(const char *);
+#endif
/*
* FUSE ROM and NVRAM data
int
main(void)
{
- int status = ST_NORMAL;
- const char *machstr;
- const char *nvv;
- int unit, part;
+ extern char *progname; /* boot.c */
+ extern int boottimeout; /* boot.c */
/* Determine the machine type from FUSE ROM data. */
get_fuse_rom_data();
* Initialize the console before we print anything out.
*/
if (machtype == LUNA_88K) {
- machstr = "LUNA-88K";
+ progname = "LUNA-88K BOOT";
cpuspeed = MHZ_25;
} else {
- machstr = "LUNA-88K2";
+ progname = "LUNA-88K2 BOOT";
cpuspeed = MHZ_33;
}
nplane = get_plane_numbers();
cninit();
- printf("\nOpenBSD/" MACHINE " (%s) boot 0.7\n\n", machstr);
-
#ifdef SUPPORT_ETHERNET
try_bootp = 1;
#endif
- /* Determine the 'auto-boot' device from NVRAM data */
get_nvram_data();
- nvv = nvram_by_symbol("boot_unit");
- if (nvv != NULL)
- unit = (int)strtol(nvv, NULL, 10);
- else
- unit = 0;
- nvv = nvram_by_symbol("boot_partition");
- if (nvv != NULL)
- part = (int)strtol(nvv, NULL, 10);
- else
- part = 0;
-
- nvv = nvram_by_symbol("boot_device");
-
- snprintf(default_file, sizeof(default_file),
- "%s(%d,%d)%s", nvv != NULL ? nvv : "sd", unit, part, "bsd");
- snprintf(upgrade_file, sizeof(upgrade_file),
- "%s(%d,%d)%s", nvv != NULL ? nvv : "sd", unit, part, "bsd.upgrade");
-
- if (exist(upgrade_file)) {
- strlcpy(default_file, upgrade_file, sizeof(default_file));
- printf("upgrade detected: switching to %s\n", default_file);
+ /* disable timeout if requested */
+ if ((dipswitch & 0x8000) == 0) {
+ boottimeout = 0;
}
- /* 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("unknown command \"%s\"\n", argv[0]);
- }
- } while (status != ST_EXIT);
+ boot(0);
_rtt();
/* NOTREACHED */
}
-/* Check file existence with "device(unit, part)filename" format */
-
-int
-exist(const char *name)
-{
- int fd;
-
- fd = open(name, O_RDONLY);
- if (fd == -1)
- return 0;
- close(fd);
- return 1;
-}
-
int
get_plane_numbers(void)
{
fuse_rom_data[i] =
(char)((((p->h) >> 24) & 0x000000f0) |
(((p->l) >> 28) & 0x0000000f));
- p++;
+ p++;
}
}
for (;;) ;
/* NOTREACHED */
}
+
+
+/*
+ * "machine tty" command to select a different console is not supported,
+ * console device selection is performed using the DIP switches.
+ */
+
+int
+cnspeed(dev_t dev, int sp)
+{
+ return 9600;
+}
+
+char *
+ttyname(int fd)
+{
+ return "console";
+}
+
+dev_t
+ttydev(char *name)
+{
+ return NODEV;
+}
+
+/*
+ * Return the default boot device.
+ */
+void
+devboot(dev_t dev, char *path)
+{
+ const char *nvv;
+ int unit, part;
+
+ /* Determine the 'auto-boot' device from NVRAM data */
+ nvv = nvram_by_symbol("boot_unit");
+ if (nvv != NULL)
+ unit = (int)strtol(nvv, NULL, 10);
+ else
+ unit = 0;
+ nvv = nvram_by_symbol("boot_partition");
+ if (nvv != NULL)
+ part = (int)strtol(nvv, NULL, 10);
+ else
+ part = 0;
+
+ nvv = nvram_by_symbol("boot_device");
+
+ snprintf(path, BOOTDEVLEN, "%s(%d,%d)",
+ nvv != NULL ? nvv : "sd", unit, part);
+}
+
+void
+machdep()
+{
+ /* Nothing to do - everything done in main() already */
+}
-/* $OpenBSD: kbd.c,v 1.1 2013/10/28 22:13:12 miod Exp $ */
+/* $OpenBSD: kbd.c,v 1.2 2023/01/10 17:10:57 miod Exp $ */
/* $NetBSD: kbd.c,v 1.1 2013/01/05 17:44:24 tsutsui Exp $ */
/*
#include <luna88k/stand/boot/samachdep.h>
#include <luna88k/stand/boot/kbdreg.h>
-struct kbd_keymap kbd_keymap[] = {
+const struct kbd_keymap kbd_keymap[] = {
{ KC_IGNORE, { 0, 0 } }, /* 0 [0x00] */
{ KC_IGNORE, { 0, 0 } }, /* 1 [0x01] */
{ KC_IGNORE, { 0, 0 } }, /* 2 [0x02] */
-/* $OpenBSD: lance.c,v 1.3 2021/03/11 11:16:58 jsg Exp $ */
+/* $OpenBSD: lance.c,v 1.4 2023/01/10 17:10:57 miod Exp $ */
/* $NetBSD: lance.c,v 1.1 2013/01/13 14:10:55 tsutsui Exp $ */
/*
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)
}
DELAY(1);
} while ((reg & LE_C0_IDON) == 0);
-
+
lereg->ler_rap = LE_CSR0;
lereg->ler_rdp = LE_C0_STRT | LE_C0_IDON;
--- /dev/null
+/* $OpenBSD: libsa.h,v 1.1 2023/01/10 17:10:57 miod Exp $ */
+
+/* public domain */
+
+#include <lib/libsa/stand.h>
+
+#define DEFAULT_KERNEL_ADDRESS 0
+
+void devboot(dev_t, char *);
+void machdep(void);
+void run_loadfile(uint64_t *, int);
+++ /dev/null
-/* $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);
-}
+++ /dev/null
-/* $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');
-}
-/* $OpenBSD: rcvbuf.h,v 1.1 2013/10/28 22:13:13 miod Exp $ */
+/* $OpenBSD: rcvbuf.h,v 1.2 2023/01/10 17:10:57 miod Exp $ */
/* $NetBSD: rcvbuf.h,v 1.1 2013/01/05 17:44:24 tsutsui Exp $ */
/*
rcvbuf[n].rb_pop = &rcvbuf[n].rb_buf[RBUF_SIZE]; \
} while (0)
+#define PEEK_RBUF(n, c) \
+do { \
+ c= *(rcvbuf[n].rb_pop - 1); \
+} while (0)
+
#define RBUF_EMPTY(n) (rcvbuf[n].rb_push == rcvbuf[n].rb_pop ? 1: 0)
extern struct rcvbuf rcvbuf[];
-/* $OpenBSD: samachdep.h,v 1.5 2022/10/14 20:53:19 aoyama Exp $ */
+/* $OpenBSD: samachdep.h,v 1.6 2023/01/10 17:10:57 miod Exp $ */
/* $NetBSD: samachdep.h,v 1.10 2013/03/05 15:34:53 tsutsui Exp $ */
/*
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 *);
void bmdclear(void);
/* boot.c */
-extern int howto;
-int boot(int, char **);
-int bootunix(char *);
-
-extern void (*cpu_boot)(uint32_t, uint32_t, uint32_t, uint32_t);
-extern uint32_t cpu_bootarg1;
-extern uint32_t cpu_bootarg2;
-extern uint32_t cpu_bootarg3;
-extern uint32_t cpu_bootarg4;
-#define BOOT_MAGIC 0xf1abde3f
-
-/* cons.c */
-void cninit(void);
-int cngetc(void);
-void cnputc(int);
+extern uint32_t bootdev;
+
+/* conf.c */
+extern struct fs_ops file_system_disk[];
+extern int nfsys_disk;
+extern struct fs_ops file_system_nfs[];
+
+/* exec.c */
+void run_loadfile(uint64_t *, int);
/* fault.c */
int badaddr(void *, int);
/* font.c */
extern const u_short bmdfont[][20];
-/* getline.c */
-int getline(const char *, char *);
-
/* init_main.c */
extern int cpuspeed;
extern int nplane;
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_softc;
int scinit(struct scsi_softc *, uint);
int sdclose(struct open_file *);
/* sio.c */
-void _siointr(void);
+int siointr(int);
void siocnprobe(struct consdev *);
void siocninit(struct consdev *);
int siocngetc(dev_t);
char *readdisklabel(struct scsi_softc *, uint, 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[];
-/* $OpenBSD: sc.c,v 1.4 2021/03/11 11:16:58 jsg Exp $ */
+/* $OpenBSD: sc.c,v 1.5 2023/01/10 17:10:57 miod Exp $ */
/* $NetBSD: sc.c,v 1.4 2013/01/22 15:48:40 tsutsui Exp $ */
/*
*/
/*
- * sc.c -- SCSI Protocole Controller (SPC) driver
+ * sc.c -- SCSI Protocol Controller (SPC) driver
* remaked by A.Fujita, MAR-11-199
*/
-/* $OpenBSD: sio.c,v 1.3 2013/10/29 21:49:07 miod Exp $ */
+/* $OpenBSD: sio.c,v 1.4 2023/01/10 17:10:57 miod Exp $ */
/* $NetBSD: sio.c,v 1.3 2013/01/21 11:58:12 tsutsui Exp $ */
/*
#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];
-void
-_siointr(void)
-{
- int unit;
-
- for (unit = 0; unit < NSIO; unit++)
- while (siointr(unit) != 0)
- continue;
-}
-
int
siointr(int unit)
{
int
siocngetc(dev_t dev)
{
- int c, unit = dev;
+ int c, unit = dev & ~0x80, poll = (dev & 0x80) != 0;
- _siointr();
- if (RBUF_EMPTY(unit))
- return 0;
+ siointr(unit);
- POP_RBUF(unit, c);
+ if (poll) {
+ if (RBUF_EMPTY(unit))
+ return 0;
+ PEEK_RBUF(unit, c);
+ return c;
- return(c);
+ }
+
+ while (RBUF_EMPTY(unit)) {
+ DELAY(1);
+ siointr(unit);
+ }
+
+ POP_RBUF(unit, c);
+ return c;
}
void