summaryrefslogtreecommitdiff
path: root/sys/arch/socppc/stand/boot
diff options
context:
space:
mode:
Diffstat (limited to 'sys/arch/socppc/stand/boot')
-rw-r--r--sys/arch/socppc/stand/boot/Makefile73
-rw-r--r--sys/arch/socppc/stand/boot/boot.8285
-rw-r--r--sys/arch/socppc/stand/boot/clock.c48
-rw-r--r--sys/arch/socppc/stand/boot/cmd_socppc.c40
-rw-r--r--sys/arch/socppc/stand/boot/conf.c69
-rw-r--r--sys/arch/socppc/stand/boot/dev_socppc.c67
-rw-r--r--sys/arch/socppc/stand/boot/devopen.c122
-rw-r--r--sys/arch/socppc/stand/boot/exec.c74
-rw-r--r--sys/arch/socppc/stand/boot/fdt.c415
-rw-r--r--sys/arch/socppc/stand/boot/fdt.h59
-rw-r--r--sys/arch/socppc/stand/boot/libsa.h42
-rw-r--r--sys/arch/socppc/stand/boot/machdep.c155
-rw-r--r--sys/arch/socppc/stand/boot/ns16550.c136
-rw-r--r--sys/arch/socppc/stand/boot/pciide.c103
-rw-r--r--sys/arch/socppc/stand/boot/start.S21
-rw-r--r--sys/arch/socppc/stand/boot/time.c13
-rw-r--r--sys/arch/socppc/stand/boot/wd.c311
-rw-r--r--sys/arch/socppc/stand/boot/wdc.c379
-rw-r--r--sys/arch/socppc/stand/boot/wdc_obio.c99
-rw-r--r--sys/arch/socppc/stand/boot/wdvar.h138
20 files changed, 0 insertions, 2649 deletions
diff --git a/sys/arch/socppc/stand/boot/Makefile b/sys/arch/socppc/stand/boot/Makefile
deleted file mode 100644
index ea8c0af367a..00000000000
--- a/sys/arch/socppc/stand/boot/Makefile
+++ /dev/null
@@ -1,73 +0,0 @@
-# $OpenBSD: Makefile,v 1.18 2016/11/06 16:42:00 tb Exp $
-
-.include "${.CURDIR}/../Makefile.inc"
-
-MAN= boot.8
-
-.if ${MACHINE} == "socppc"
-PROG= boot
-S= ${.CURDIR}/../../../..
-
-.PATH: ${S}/stand/boot
-.PATH: ${S}/lib/libsa
-
-CPPFLAGS+= -D_STANDALONE
-CPPFLAGS+= -nostdinc -I../.. -I. -I${.CURDIR} -I${S}
-CPPFLAGS+= -DCONADDR=0xe0004500UL -DCONSPEED=115200
-CPPFLAGS+= -DNS16550_FREQ=266000000 -DMACHINE_CMD=cmd_machine
-
-COPTS+= -ffreestanding -fno-stack-protector -ffixed-r29 -msoft-float
-COPTS+= -fno-pie
-
-SRCS= start.S
-SRCS+= boot.c cmd.c vars.c
-SRCS+= conf.c devopen.c exec.c machdep.c dev_socppc.c time.c
-SRCS+= clock.c ns16550.c wd.c wdc.c pciide.c wdc_obio.c fdt.c
-SRCS+= ctime.c strtol.c cmd_socppc.c
-
-.PATH: ${S}/lib/libkern/arch/powerpc ${S}/lib/libkern
-SRCS+= getchar.c putchar.c strlcpy.c strlen.c ashrdi3.c moddi3.c
-
-### find out what to use for libz
-Z_AS= library
-.include "${S}/lib/libz/Makefile.inc"
-LIBZ= ${ZLIB}
-
-### find out what to use for libsa
-SA_AS= library
-SAREL=
-SA_ZLIB= yes
-USE_LOADFILE= yes
-.include "${S}/lib/libsa/Makefile.inc"
-LIBSA= ${SALIB}
-
-STANDIR= ${.CURDIR}/..
-
-RELOC= 0x100000
-LDFLAGS= -Ttext ${RELOC} -nopie -znorelro
-OBJCOPY?= objcopy
-
-${PROG}: ${OBJS} ${LIBSA} ${LIBZ}
- ${LD} ${LDFLAGS} -o ${PROG}.elf ${OBJS} ${LIBSA} ${LIBZ}
- ${OBJCOPY} -O binary ${PROG}.elf ${PROG}.bin
- ${MKBOOT} -e ${RELOC} -l ${RELOC} ${PROG}.bin ${PROG}
-
-realinstall:
- ${INSTALL} ${INSTALL_COPY} -o ${BINOWN} -g ${BINGRP} \
- -m ${BINMODE} ${PROG} ${DESTDIR}${BINDIR}/${PROG}
- ${INSTALL} ${INSTALL_COPY} ${INSTALL_STRIP} -o ${BINOWN} -g ${BINGRP} \
- -m ${BINMODE} ${PROG}.elf ${DESTDIR}${BINDIR}/${PROG}.elf
-
-.if !make(clean) && !make(cleandir) && !make(includes) && !make(obj)
-.BEGIN:
- @([ -h machine ] || ln -s ${.CURDIR}/../../../${MACHINE}/include machine)
- @([ -h powerpc ] || ln -s ${.CURDIR}/../../../powerpc/include powerpc)
-.NOPATH: machine powerpc
-CLEANFILES+= machine powerpc
-.endif
-
-.else
-NOPROG=
-.endif
-
-.include <bsd.prog.mk>
diff --git a/sys/arch/socppc/stand/boot/boot.8 b/sys/arch/socppc/stand/boot/boot.8
deleted file mode 100644
index 5d286b402ff..00000000000
--- a/sys/arch/socppc/stand/boot/boot.8
+++ /dev/null
@@ -1,285 +0,0 @@
-.\" $OpenBSD: boot.8,v 1.9 2019/01/02 21:20:41 anton Exp $
-.\"
-.\" Copyright (c) 1997-2001 Michael Shalayeff
-.\" 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 OR HIS RELATIVES 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 MIND, 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.
-.\"
-.\"
-.Dd $Mdocdate: January 2 2019 $
-.Dt BOOT 8 socppc
-.Os
-.Sh NAME
-.Nm boot ,
-.Nm boot.conf
-.Nd socppc-specific bootstrap
-.Sh DESCRIPTION
-The main purpose of this program is to load the system kernel.
-.Pp
-This program is loaded by the
-firmware
-and provides a convenient way to load the kernel.
-This program acts as an enhanced boot monitor for socppc systems, providing
-a common interface for the kernel to start from.
-.Pp
-Basic operations include:
-.Pp
-.Bl -bullet -compact
-.It
-Loading kernels from hard disk.
-.It
-Loading kernels compressed by
-.Xr gzip 1 .
-.It
-Providing an interactive command line.
-.El
-.Pp
-The sequence of its operation is as follows: initialization,
-parsing the configuration file, then an interactive command line.
-While at the command line you have 5 seconds to type any commands, if needed.
-If time expires, the kernel will be loaded according to
-the current variable settings (see the
-.Ic set
-command).
-Each time a kernel load fails, the timeout is increased by one second.
-The sequence of
-.Nm
-operations is as follows:
-.Bl -enum
-.It
-If the file
-.Pa /etc/boot.conf
-.\" XXX BEWARE! wd0 only, so text change...
-.\" exists on the filesystem
-.\" .Nm
-.\" was loaded from, open and parse it.
-exists on the filesystem in slice
-.Sq a
-on the first disk drive
-.Pq wd0 ,
-open and parse it.
-Lines beginning with the
-.Sq #
-character,
-as well as whitespace at the beginning of lines,
-are ignored.
-The file may contain any commands
-.Nm
-accepts at the interactive prompt.
-Though default settings usually suffice, they can be changed here.
-.\" XXX CHECK_SKIP_CONF is not defined...
-.\" .Pp
-.\" .Pa boot.conf
-.\" processing can be skipped by holding down either Control key as
-.\" .Nm
-.\" starts.
-.It
-The header line
-.Pp
-.Dl >> OpenBSD/socppc BOOT [x.xx]
-.Pp
-is displayed to the active console, where
-.Ar x.xx
-is the version number of the
-.Nm
-program, followed by the
-.Pp
-.Dl boot>
-.Pp
-prompt, which means you are in interactive mode and may enter commands.
-If you do not,
-.Nm
-will proceed to load the kernel with the current parameters after the
-timeout period has expired.
-.El
-.Pp
-By default,
-.Nm
-attempts to load the kernel executable
-.Pa /bsd .
-If it fails to find the kernel and no alternative kernel image has
-been specified, the system will be unable to boot.
-.Sh COMMANDS
-The following commands are accepted at the
-.Nm
-prompt:
-.Bl -tag -width shorten
-.It Ic boot Oo Oo Ar device : Oc Ns Ar image Oc Op Fl acds
-Boots the specified kernel image
-with any options given.
-If
-.Ar device
-or
-.Ar image
-are omitted, values from
-.Nm
-variables will be used.
-.Pp
-The only bootable devices, at the moment, are IDE devices connected to
-the internal controller;
-they are detected as
-.Sq wd
-devices.
-Therefore, to boot kernel
-.Pa /bsd
-from slice
-.Sq a
-on the first hard drive,
-specify
-.Dq boot wd0a:/bsd .
-.Bl -tag -width _a_
-.It Fl a
-Causes the kernel to ask for the
-.Nm root
-device to use.
-.It Fl c
-Causes the kernel to go into
-.Xr boot_config 8
-before performing
-.Xr autoconf 4
-procedures.
-.It Fl d
-Causes the kernel to drop into
-.Xr ddb 4
-at the earliest convenient point.
-.It Fl s
-Causes the kernel to boot single-user.
-.El
-.It Ic echo Op Ar args
-Displays
-.Ar args
-on the console device.
-.It Ic help
-Prints a list of available commands.
-.It Ic ls Op Ar directory
-Prints contents of the specified
-.Ar directory
-in long format including: attributes and file type, owner, group,
-size, filename.
-.It Ic reboot
-Reboots the machine by initiating a warm boot procedure.
-.It Ic set Op Ar varname Op Ar value
-If invoked without arguments, prints a list of variables and their values.
-If only
-.Ar varname
-is specified, displays contents of that variable.
-If
-.Ar varname
-and
-.Ar value
-are both specified, sets that variable to the given value.
-Variables include:
-.Pp
-.Bl -tag -compact -width boothow
-.It Ic addr
-Address at which to load the kernel.
-.It Ic debug
-Debug flag if
-.Nm
-was compiled with DEBUG defined.
-.It Ic device
-Boot device name (e.g.,
-.Li wd0a ,
-.Li wd1a ) .
-.It Ic howto
-Options to pass to the loaded kernel.
-.It Ic image
-File name containing the kernel image.
-.It Ic timeout
-Number of seconds boot will wait for human intervention before
-booting the default kernel image.
-.\" .It Nm tty
-.\" Active console device name (e.g.,
-.\" .Li com0 ) .
-.\" Currently, only the first serial port
-.\" .Pq Li com0
-.\" is supported for console on socppc.
-.El
-.\" XXX ignored, so don't document it.
-.\" .It stty Op Ar device Op Ar speed
-.\" Displays or sets the
-.\" .Ar speed
-.\" for a console
-.\" .Ar device .
-.\" If changing the baudrate for the currently active console,
-.\" .Nm
-.\" offers you five seconds of grace time before committing the change
-.\" to allow you to change your terminal's speed to match.
-.\" If changing speed
-.\" .Em not
-.\" for the active console, the baudrate is set for the
-.\" .Em next
-.\" time you switch to a serial console.
-.\" .Pp
-.\" The default baudrate is 9600bps.
-.It Ic time
-Displays system time and date.
-.El
-.Sh FILES
-.Bl -tag -width /etc/boot.conf -compact
-.It Pa /usr/mdec/boot
-system bootstrap
-.It Pa /etc/boot.conf
-system bootstrap's startup file
-.It Pa /bsd
-kernel image
-.It Pa /bsd.rd
-kernel image for installation/recovery
-.El
-.Sh EXAMPLES
-Boot the default kernel:
-.Pp
-.Dl boot> boot
-.Pp
-Remove the 5 second pause at boot-time permanently, causing
-.Nm
-to load the kernel immediately without prompting:
-.Pp
-.Dl # echo \&"boot\&" > /etc/boot.conf
-.Pp
-Boot the kernel named
-.Pa /bsd
-from the second hard disk in
-.Dq User Kernel Configuration
-mode (see
-.Xr boot_config 8 ) .
-This mechanism allows for the explicit enabling and disabling of devices
-during the current boot sequence, as well as the modification
-of device parameters.
-Once booted, such changes can be made permanent by using
-.Xr config 8 Ns 's
-.Fl e
-option.
-.Pp
-.Dl boot> boot wd1a:/bsd -c
-.Sh SEE ALSO
-.Xr gzip 1 ,
-.Xr autoconf 4 ,
-.Xr ddb 4 ,
-.Xr boot_config 8 ,
-.Xr fdisk 8 ,
-.Xr reboot 8
-.Sh HISTORY
-This program was written by Michael Shalayeff for
-.Ox 2.1
-on the i386 platform, and was later ported to the socppc platform for
-.Ox 4.4 .
diff --git a/sys/arch/socppc/stand/boot/clock.c b/sys/arch/socppc/stand/boot/clock.c
deleted file mode 100644
index e3a43be295e..00000000000
--- a/sys/arch/socppc/stand/boot/clock.c
+++ /dev/null
@@ -1,48 +0,0 @@
-/* $OpenBSD: clock.c,v 1.2 2008/06/26 05:42:13 ray Exp $ */
-/* $NetBSD: clock.c,v 1.1 2003/06/25 17:24:22 cdi Exp $ */
-
-/*-
- * Copyright (c) 2003 The NetBSD Foundation, Inc.
- * All rights reserved.
- *
- * This code is derived from software contributed to The NetBSD Foundation
- * by Manuel Bouyer.
- *
- * 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 <sys/types.h>
-
-#include "libsa.h"
-
-#define DELAY_CALIBRATE 1000
-
-void
-delay(int ms)
-{
- /*
- * XXX need *real* clock calibration.
- */
- volatile register int N = ms * DELAY_CALIBRATE;
- for (; --N;)
- ;
-}
diff --git a/sys/arch/socppc/stand/boot/cmd_socppc.c b/sys/arch/socppc/stand/boot/cmd_socppc.c
deleted file mode 100644
index 3060f6e68bc..00000000000
--- a/sys/arch/socppc/stand/boot/cmd_socppc.c
+++ /dev/null
@@ -1,40 +0,0 @@
-/* $OpenBSD: cmd_socppc.c,v 1.1 2009/09/11 17:45:01 dms Exp $ */
-
-/*
- * Copyright (c) 2009 Dariusz Swiderski <sfires@sfires.net>
- *
- * 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.
- */
-
-#include <sys/param.h>
-#include "fdt.h"
-#include "stand/boot/cmd.h"
-
-int Xfdt(void);
-int Xbats(void);
-
-const struct cmd_table cmd_machine[] = {
- { "fdt", CMDT_CMD, Xfdt },
- { NULL, 0 }
-};
-
-int
-Xfdt(void)
-{
- extern int fdtaddrsave;
- if (fdtaddrsave)
- fdt_print_tree();
- else
- printf("FDT blob not available\n");
- return 0;
-}
diff --git a/sys/arch/socppc/stand/boot/conf.c b/sys/arch/socppc/stand/boot/conf.c
deleted file mode 100644
index e4d2ee06fda..00000000000
--- a/sys/arch/socppc/stand/boot/conf.c
+++ /dev/null
@@ -1,69 +0,0 @@
-/* $OpenBSD: conf.c,v 1.10 2019/04/10 04:19:32 deraadt Exp $ */
-/* $NetBSD: conf.c,v 1.4 2005/12/11 12:17:06 christos 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 <dev/cons.h>
-
-#include "libsa.h"
-#include <lib/libsa/ufs.h>
-
-const char version[] = "1.4";
-int debug = 0;
-
-/*
- * Device configuration
- */
-struct devsw devsw[] = {
- { "wd", wdstrategy, wdopen, wdclose, noioctl },
-};
-int ndevs = nitems(devsw);
-
-/*
- * Filesystem configuration
- */
-struct fs_ops file_system[] = {
- { ufs_open, ufs_close, ufs_read, ufs_write, ufs_seek,
- ufs_stat, ufs_readdir }
-};
-int nfsys = nitems(file_system);
-
-/*
- * Console configuration
- */
-struct consdev constab[] = {
- { com_probe, com_init, com_getc, com_putc },
- { NULL }
-};
-struct consdev *cn_tab;
diff --git a/sys/arch/socppc/stand/boot/dev_socppc.c b/sys/arch/socppc/stand/boot/dev_socppc.c
deleted file mode 100644
index 7cf9401c51e..00000000000
--- a/sys/arch/socppc/stand/boot/dev_socppc.c
+++ /dev/null
@@ -1,67 +0,0 @@
-/* $OpenBSD: dev_socppc.c,v 1.4 2014/07/13 09:26:08 jasper Exp $ */
-
-/*
- * Copyright (c) 2008 Mark Kettenis
- *
- * 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.
- */
-
-#include <sys/param.h>
-#include <dev/cons.h>
-
-#include "libsa.h"
-
-const char cdevs[][4] = {
- "cn", "", "", "", "", "", "", "",
- "", "", "", "", "com"
-};
-const int ncdevs = nitems(cdevs);
-
-void
-devboot(dev_t dev, char *p)
-{
- strlcpy(p, "wd0a", 5);
-}
-
-int
-cnspeed(dev_t dev, int sp)
-{
- return CONSPEED;
-}
-
-char ttyname_buf[8];
-
-char *
-ttyname(int fd)
-{
- snprintf(ttyname_buf, sizeof ttyname_buf, "%s%d",
- cdevs[major(cn_tab->cn_dev)], minor(cn_tab->cn_dev));
-
- return ttyname_buf;
-}
-
-dev_t
-ttydev(char *name)
-{
- int i, unit = -1;
- char *no = name + strlen(name) - 1;
-
- while (no >= name && *no >= '0' && *no <= '9')
- unit = (unit < 0 ? 0 : (unit * 10)) + *no-- - '0';
- if (no < name || unit < 0)
- return NODEV;
- for (i = 0; i < ncdevs; i++)
- if (strncmp(name, cdevs[i], no - name + 1) == 0)
- return (makedev(i, unit));
- return NODEV;
-}
diff --git a/sys/arch/socppc/stand/boot/devopen.c b/sys/arch/socppc/stand/boot/devopen.c
deleted file mode 100644
index 801f390ec73..00000000000
--- a/sys/arch/socppc/stand/boot/devopen.c
+++ /dev/null
@@ -1,122 +0,0 @@
-/* $OpenBSD: devopen.c,v 1.2 2008/06/26 05:42:13 ray Exp $ */
-/* $NetBSD: devopen.c,v 1.1 2003/06/25 17:24:22 cdi Exp $ */
-
-/*-
- * Copyright (c) 2003 The NetBSD Foundation, Inc.
- * All rights reserved.
- *
- * This code is derived from software contributed to The NetBSD Foundation
- * by Rolf Grossmann.
- *
- * 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 "libsa.h"
-
-#define MAXDEVNAME 16
-
-/*
- * Parse a device spec.
- *
- * [A-Za-z]*[0-9]*[A-Za-z]:file
- * dev uint part
- */
-int
-devparse(const char *fname, int *dev, int *unit, int *part, const char **file)
-{
- const char *s;
-
- *unit = 0; /* default to wd0a */
- *part = 0;
- *dev = 0;
-
- s = strchr(fname, ':');
- if (s != NULL) {
- int devlen;
- int i, u, p;
- struct devsw *dp;
- char devname[MAXDEVNAME];
-
- devlen = s - fname;
- if (devlen > MAXDEVNAME)
- return (EINVAL);
-
- /* extract device name */
- for (i = 0; isalpha(fname[i]) && (i < devlen); i++)
- devname[i] = fname[i];
- devname[i] = 0;
-
- if (!isdigit(fname[i]))
- return (EUNIT);
-
- /* device number */
- for (u = 0; isdigit(fname[i]) && (i < devlen); i++)
- u = u * 10 + (fname[i] - '0');
-
- if (!isalpha(fname[i]))
- return (EPART);
-
- /* partition number */
- if (i < devlen)
- p = fname[i++] - 'a';
-
- if (i != devlen)
- return (ENXIO);
-
- /* check device name */
- for (dp = devsw, i = 0; i < ndevs; dp++, i++) {
- if (dp->dv_name && !strcmp(devname, dp->dv_name))
- break;
- }
-
- if (i >= ndevs)
- return (ENXIO);
-
- *unit = u;
- *part = p;
- *dev = i;
- fname = ++s;
- }
-
- *file = fname;
-
- return (0);
-}
-
-int
-devopen(struct open_file *f, const char *fname, char **file)
-{
- struct devsw *dp;
- int dev, unit, part, error;
-
- error = devparse(fname, &dev, &unit, &part, (const char **)file);
- if (error)
- return (error);
-
- dp = &devsw[dev];
- if ((void *)dp->dv_open == (void *)nodev)
- return (ENXIO);
-
- f->f_dev = dp;
-
- return (*dp->dv_open)(f, unit, part);
-}
diff --git a/sys/arch/socppc/stand/boot/exec.c b/sys/arch/socppc/stand/boot/exec.c
deleted file mode 100644
index 5f41774587a..00000000000
--- a/sys/arch/socppc/stand/boot/exec.c
+++ /dev/null
@@ -1,74 +0,0 @@
-/* $OpenBSD: exec.c,v 1.4 2019/04/10 04:17:37 deraadt Exp $ */
-
-/*
- * Copyright (c) 2006 Mark Kettenis
- *
- * 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.
- */
-
-#include <sys/param.h>
-
-#include <lib/libsa/stand.h>
-#include <lib/libsa/loadfile.h>
-
-#include <sys/reboot.h>
-#include <stand/boot/cmd.h>
-
-typedef void (*startfuncp)(int, int, u_int32_t, char *, int) __dead;
-
-void
-run_loadfile(uint64_t *marks, int howto)
-{
- char args[512]; /* Should check size? */
- u_int32_t entry;
- char *cp;
- void *ssym, *esym;
- int l;
-
- snprintf(args, sizeof(args), "%s:%s -", cmd.bootdev, cmd.image);
- cp = args + strlen(args);
-
- *cp++ = ' ';
- *cp = '-';
- if (howto & RB_ASKNAME)
- *++cp = 'a';
- if (howto & RB_CONFIG)
- *++cp = 'c';
- if (howto & RB_SINGLE)
- *++cp = 's';
- if (howto & RB_KDB)
- *++cp = 'd';
- if (*cp == '-')
- *--cp = 0;
- else
- *++cp = 0;
-
- entry = marks[MARK_ENTRY];
- ssym = (void *)marks[MARK_SYM];
- esym = (void *)marks[MARK_END];
-
- /*
- * Stash pointer to end of symbol table after the argument
- * strings.
- */
- l = strlen(args) + 1;
- bcopy(&ssym, args + l, sizeof(ssym));
- l += sizeof(ssym);
- bcopy(&esym, args + l, sizeof(esym));
- l += sizeof(esym);
- extern int fdtaddrsave;
-
- (*(startfuncp)(marks[MARK_ENTRY]))(fdtaddrsave, 0, entry, args, l);
-
- /* NOTREACHED */
-}
diff --git a/sys/arch/socppc/stand/boot/fdt.c b/sys/arch/socppc/stand/boot/fdt.c
deleted file mode 100644
index f788e3d5094..00000000000
--- a/sys/arch/socppc/stand/boot/fdt.c
+++ /dev/null
@@ -1,415 +0,0 @@
-/* $OpenBSD: fdt.c,v 1.7 2017/09/08 05:36:52 deraadt Exp $ */
-
-/*
- * Copyright (c) 2009 Dariusz Swiderski <sfires@sfires.net>
- *
- * 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.
- */
-
-
-#include <sys/param.h>
-
-#include "fdt.h"
-#include "libsa.h"
-
-
-unsigned int fdt_check_head(void *);
-char *fdt_get_str(u_int32_t);
-void *skip_property(u_int32_t *);
-void *skip_props(u_int32_t *);
-void *skip_node_name(u_int32_t *);
-void *fdt_parent_node_recurse(void *, void *);
-void *fdt_find_node_recurse(void *, char *);
-void fdt_print_node_recurse(void *, int);
-
-static int tree_inited = 0;
-static struct fdt tree;
-
-unsigned int
-fdt_check_head(void *fdt)
-{
- struct fdt_head *fh;
- u_int32_t *ptr;
-
- fh = fdt;
- ptr = (u_int32_t *)fdt;
-
- if (fh->fh_magic != FDT_MAGIC)
- return 0;
-
- if (fh->fh_version > FDT_CODE_VERSION)
- return 0;
-
- if (*(ptr + (fh->fh_struct_off / 4)) != FDT_NODE_BEGIN)
- return 0;
-
- /* check for end signature on version 17 blob */
- if ((fh->fh_version >= 17) & (*(ptr + fh->fh_struct_size) != FDT_END))
- return 0;
-
- return fh->fh_version;
-}
-
-/*
- * Initializes internal structures of module.
- * Has to be called once, preferably in machdep.c.
- */
-int
-fdt_init(void *fdt)
-{
- int version;
-
- bzero(&tree, sizeof(struct fdt));
- tree_inited = 0;
-
- if (!fdt)
- return 0;
-
- if (!(version = fdt_check_head(fdt)))
- return 0;
-
- tree.header = (struct fdt_head *)fdt;
- tree.tree = (char *)fdt + tree.header->fh_struct_off;
- tree.strings = (char *)fdt + tree.header->fh_strings_off;
- tree.memory = (char *)fdt + tree.header->fh_reserve_off;
- tree.version = version;
-
- if (version < 3) {
- if ((tree.strings < tree.tree) && (tree.tree < tree.memory))
- tree.strings_size = tree.tree - tree.strings;
- else if ((tree.strings < tree.memory) && (tree.memory <
- tree.tree))
- tree.strings_size = tree.memory - tree.strings;
- else if ((tree.strings < tree.tree) && (tree.memory <
- tree.strings))
- tree.strings_size = tree.tree - tree.strings;
- else if ((tree.strings < tree.memory) && (tree.tree <
- tree.strings))
- tree.strings_size = tree.memory - tree.strings;
- else
- tree.strings_size = tree.header->fh_size -
- (int)tree.strings;
- } else
- tree.strings_size = tree.header->fh_strings_size;
-
- tree.strings_size = tree.header->fh_strings_size;
- tree_inited = 1;
-
- return version;
-}
-
-/*
- * Retrieve string pointer from srtings table.
- */
-char *
-fdt_get_str(u_int32_t num)
-{
- if (num > tree.strings_size)
- return NULL;
- return (tree.strings) ? (tree.strings + num) : NULL;
-}
-
-/*
- * Utility functions for skipping parts of tree.
- */
-void *
-skip_property(u_int32_t *ptr)
-{
- u_int32_t size;
-
- size = *(ptr + 1);
- /* move forward by magic + size + nameid + rounded up property size */
- ptr += 3 + roundup(size, sizeof(u_int32_t)) / sizeof(u_int32_t);
-
- return ptr;
-}
-
-void *
-skip_props(u_int32_t *ptr)
-{
- while (*ptr == FDT_PROPERTY) {
- ptr = skip_property(ptr);
- }
- return ptr;
-}
-
-void *
-skip_node_name(u_int32_t *ptr)
-{
- /* skip name, aligned to 4 bytes, this is NULL term., so must add 1 */
- return ptr + roundup(strlen((char *)ptr) + 1,
- sizeof(u_int32_t)) / sizeof(u_int32_t);
-}
-
-/*
- * Retrieves node property, the returned pointer is inside the fdt tree,
- * so we should not modify content pointed by it directly.
- */
-int
-fdt_node_property(void *node, char *name, char **out)
-{
- u_int32_t *ptr;
- u_int32_t nameid;
- char *tmp;
-
- if (!tree_inited)
- return 0;
-
- ptr = (u_int32_t *)node;
-
- if (*ptr != FDT_NODE_BEGIN)
- return 0;
-
- ptr = skip_node_name(ptr + 1);
-
- while (*ptr == FDT_PROPERTY) {
- nameid = *(ptr + 2); /* id of name in strings table */
- tmp = fdt_get_str(nameid);
- if (!strcmp(name, tmp)) {
- *out = (char *)(ptr + 3); /* beginning of the value */
- return *(ptr + 1); /* size of value */
- }
- ptr = skip_property(ptr);
- }
- return 0;
-}
-
-/*
- * Retrieves next node, skipping all the children nodes of the pointed node
- * if passed 0 wil return first node of the tree (root)
- */
-void *
-fdt_next_node(void *node)
-{
- u_int32_t *ptr;
-
- if (!tree_inited)
- return NULL;
-
- ptr = node;
-
- if (!node) {
- ptr = tree.tree;
- return (*ptr == FDT_NODE_BEGIN) ? ptr : NULL;
- }
-
- if (*ptr != FDT_NODE_BEGIN)
- return NULL;
-
- ptr++;
-
- ptr = skip_node_name(ptr);
- ptr = skip_props(ptr);
-
- /* skip children */
- while (*ptr == FDT_NODE_BEGIN)
- ptr = fdt_next_node(ptr);
-
- return (*ptr == FDT_NODE_END) ? (ptr + 1) : NULL;
-}
-
-/*
- * Retrieves next node, skipping all the children nodes of the pointed node
- */
-void *
-fdt_child_node(void *node)
-{
- u_int32_t *ptr;
-
- if (!tree_inited)
- return NULL;
-
- ptr = node;
-
- if (*ptr != FDT_NODE_BEGIN)
- return NULL;
-
- ptr++;
-
- ptr = skip_node_name(ptr);
- ptr = skip_props(ptr);
- /* check if there is a child node */
- return (*ptr == FDT_NODE_BEGIN) ? (ptr) : NULL;
-}
-
-/*
- * Retrieves node name.
- */
-char *
-fdt_node_name(void *node)
-{
- u_int32_t *ptr;
-
- if (!tree_inited)
- return NULL;
-
- ptr = node;
-
- if (*ptr != FDT_NODE_BEGIN)
- return NULL;
-
- return (char *)(ptr + 1);
-}
-
-void *
-fdt_find_node(char *name)
-{
- void *node = fdt_next_node(0);
- const char *p = name;
-
- if (!tree_inited)
- return NULL;
-
- if (*p != '/')
- return NULL;
-
- while (*p) {
- void *child;
- const char *q;
-
- while (*p == '/')
- p++;
- if (*p == 0)
- return node;
- q = strchr(p, '/');
- if (q == NULL)
- q = p + strlen(p);
-
- for (child = fdt_child_node(node); child;
- child = fdt_next_node(child)) {
- if (strncmp(p, fdt_node_name(child), q - p) == 0) {
- node = child;
- break;
- }
- }
-
- p = q;
- }
-
- return node;
-}
-
-void *
-fdt_parent_node_recurse(void *pnode, void *child)
-{
- void *node = fdt_child_node(pnode);
- void *tmp;
-
- while (node && (node != child)) {
- if ((tmp = fdt_parent_node_recurse(node, child)))
- return tmp;
- node = fdt_next_node(node);
- }
- return (node) ? pnode : NULL;
-}
-
-void *
-fdt_parent_node(void *node)
-{
- void *pnode = fdt_next_node(0);
-
- if (!tree_inited)
- return NULL;
-
- return fdt_parent_node_recurse(pnode, node);
-}
-
-/*
- * Debug methods for printing whole tree, particular odes and properies
- */
-void *
-fdt_print_property(void *node, int level)
-{
- u_int32_t *ptr;
- char *tmp, *value;
- int cnt;
- u_int32_t nameid, size;
-
- ptr = (u_int32_t *)node;
-
- if (!tree_inited)
- return NULL;
-
- if (*ptr != FDT_PROPERTY)
- return ptr; /* should never happen */
-
- /* extract property name_id and size */
- size = *++ptr;
- nameid = *++ptr;
-
- for (cnt = 0; cnt < level; cnt++)
- printf("\t");
-
- tmp = fdt_get_str(nameid);
- printf("\t%s : ", tmp ? tmp : "NO_NAME");
-
- ptr++;
- value = (char *)ptr;
-
- if (!strcmp(tmp, "device_type") || !strcmp(tmp, "compatible") ||
- !strcmp(tmp, "model") || !strcmp(tmp, "bootargs") ||
- !strcmp(tmp, "linux,stdout-path")) {
- printf("%s", value);
- } else if (!strcmp(tmp, "clock-frequency") ||
- !strcmp(tmp, "timebase-frequency")) {
- printf("%d", *((unsigned int *)value));
- } else {
- for (cnt = 0; cnt < size; cnt++) {
- if ((cnt % sizeof(u_int32_t)) == 0)
- printf(" ");
- printf("%x", value[cnt]);
- }
- }
- ptr += roundup(size, sizeof(u_int32_t)) / sizeof(u_int32_t);
- printf("\n");
-
- return ptr;
-}
-
-void
-fdt_print_node(void *node, int level)
-{
- u_int32_t *ptr;
- int cnt;
-
- ptr = (u_int32_t *)node;
-
- if (*ptr != FDT_NODE_BEGIN)
- return;
-
- ptr++;
-
- for (cnt = 0; cnt < level; cnt++)
- printf("\t");
- printf("%s :\n", fdt_node_name(node));
- ptr = skip_node_name(ptr);
-
- while (*ptr == FDT_PROPERTY)
- ptr = fdt_print_property(ptr, level);
-}
-
-void
-fdt_print_node_recurse(void *node, int level)
-{
- void *child;
-
- fdt_print_node(node, level);
- for (child = fdt_child_node(node); child; child = fdt_next_node(child))
- fdt_print_node_recurse(child, level + 1);
-}
-
-void
-fdt_print_tree(void)
-{
- fdt_print_node_recurse(fdt_next_node(0), 0);
-}
diff --git a/sys/arch/socppc/stand/boot/fdt.h b/sys/arch/socppc/stand/boot/fdt.h
deleted file mode 100644
index 88927157997..00000000000
--- a/sys/arch/socppc/stand/boot/fdt.h
+++ /dev/null
@@ -1,59 +0,0 @@
-/* $OpenBSD: fdt.h,v 1.3 2009/10/01 20:21:05 dms Exp $ */
-
-/*
- * Copyright (c) 2009 Dariusz Swiderski <sfires@sfires.net>
- *
- * 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.
- */
-
-struct fdt_head {
- u_int32_t fh_magic;
- u_int32_t fh_size;
- u_int32_t fh_struct_off;
- u_int32_t fh_strings_off;
- u_int32_t fh_reserve_off;
- u_int32_t fh_version;
- u_int32_t fh_comp_ver; /* last compatible version */
- u_int32_t fh_boot_cpu_id; /* fh_version >=2 */
- u_int32_t fh_strings_size; /* fh_version >=3 */
- u_int32_t fh_struct_size; /* fh_version >=17 */
-};
-
-struct fdt {
- struct fdt_head *header;
- void * tree;
- void * strings;
- void * memory;
- int version;
- int strings_size;
-};
-
-#define FDT_MAGIC 0xd00dfeed
-#define FDT_NODE_BEGIN 0x01
-#define FDT_NODE_END 0x02
-#define FDT_PROPERTY 0x03
-#define FDT_NOP 0x04
-#define FDT_END 0x09
-
-#define FDT_CODE_VERSION 0x11
-
-int fdt_init(void *);
-void *fdt_next_node(void *);
-void *fdt_child_node(void *);
-char *fdt_node_name(void *);
-void *fdt_find_node(char *);
-int fdt_node_property(void *, char *, char **);
-void *fdt_parent_node(void *);
-void *fdt_print_property(void *, int);
-void fdt_print_node(void *, int);
-void fdt_print_tree(void);
diff --git a/sys/arch/socppc/stand/boot/libsa.h b/sys/arch/socppc/stand/boot/libsa.h
deleted file mode 100644
index e283b7d71a7..00000000000
--- a/sys/arch/socppc/stand/boot/libsa.h
+++ /dev/null
@@ -1,42 +0,0 @@
-/* $OpenBSD: libsa.h,v 1.2 2011/03/13 00:13:53 deraadt Exp $ */
-
-/*
- * Copyright (c) 2008 Mark Kettenis
- *
- * 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.
- */
-
-#include <lib/libsa/stand.h>
-
-#define DEFAULT_KERNEL_ADDRESS 0
-
-#ifdef DEBUG
-#define DPRINTF(x) printf x;
-#else
-#define DPRINTF(x)
-#endif
-
-/*
- * com
- */
-void com_probe(struct consdev *);
-void com_init(struct consdev *);
-int com_getc(dev_t);
-void com_putc(dev_t, int);
-
-/*
- * wd
- */
-int wdstrategy(void *, int, daddr32_t, size_t, void *, size_t *);
-int wdopen(struct open_file *, ...);
-int wdclose(struct open_file *);
diff --git a/sys/arch/socppc/stand/boot/machdep.c b/sys/arch/socppc/stand/boot/machdep.c
deleted file mode 100644
index 71980f8a73c..00000000000
--- a/sys/arch/socppc/stand/boot/machdep.c
+++ /dev/null
@@ -1,155 +0,0 @@
-/* $OpenBSD: machdep.c,v 1.7 2016/10/09 11:25:40 tom Exp $ */
-
-/*
- * Copyright (c) 2008 Mark Kettenis
- *
- * 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.
- */
-
-#include <sys/types.h>
-
-#include "libsa.h"
-#include "wdvar.h"
-#include "fdt.h"
-
-/*
- * RouterBOOT firmware puts its FDT at an address that is low enough
- * to conflict with bsd.rd. So we need to relocate the FDT. As long
- * as we have at least 32MB of memory, the 16MB boundary should be
- * fine, and leave us plenty of room for future kernel growth.
- */
-#define FDTADDRSTART 0x01000000
-
-#define RPR 0xe0000918
-#define RPR_RSTE 0x52535445
-#define RCR 0xe000091c
-#define RCR_SWSR 0x00000001
-#define RCR_SWHR 0x00000002
-
-/* defines from pciide.c and wdc_obio.c */
-int pciide_init (struct wdc_channel*, u_int);
-int wdc_obio_init (struct wdc_channel*, u_int);
-
-void
-machdep(void)
-{
- void *node;
- char *tmp;
- int len;
-
- extern int consfreq;
- extern uint8_t *consaddr;
-
- /* set default values */
- consfreq = NS16550_FREQ;
- consaddr = (uint8_t *)CONADDR;
-
- /* lookup FTD for informations about console */
- node = fdt_find_node("/chosen");
- if (node) {
- char *console;
- fdt_node_property(node, "linux,stdout-path", &console);
- node = fdt_find_node(console);
- if (node) {
- len = fdt_node_property(node, "clock-frequency", &tmp);
- if (len == 4)
- consfreq = *(int *)tmp;
-
- len = fdt_node_property(node, "reg", &tmp);
- if (len == 8)
- consaddr = (uint8_t *)*(int *)tmp;
- }
- if (node = fdt_parent_node(node)) {
- fdt_node_property(node, "device_type", &tmp);
- if (strncmp(tmp, "soc", 3) == 0) {
- /* we are on a soc */
- len = fdt_node_property(node, "reg", &tmp);
- if (len == 8)
- consaddr += *(int *)tmp;
- }
- }
- }
-
- cninit();
-{
- extern int (*controller_init)(struct wdc_channel *chp, u_int chan);
- extern u_int32_t pciide_base_addr;
- extern u_int32_t wdc_base_addr[];
- int *addr;
- int chnum;
-
- /* Thecus defaults */
- controller_init = pciide_init;
- pciide_base_addr = 0xe2000000;
-
- /* lookup the FDT, may have some CF there */
- chnum = 0;
- wdc_base_addr[0] = 0;
- wdc_base_addr[1] = 0;
- node = fdt_find_node("/");
- for (node = fdt_child_node(node); node; node = fdt_next_node(node)) {
- len = fdt_node_property(node, "device_type", &tmp);
- if (len && (strcmp(tmp, "rb,cf") == 0) && (chnum < 2)) {
- len = fdt_node_property(node, "reg", (char **)&addr);
- if (len == 8) {
- wdc_base_addr[chnum] = *addr;
- chnum++;
- }
- }
- }
- if (chnum)
- controller_init = wdc_obio_init;
-}
-
-}
-
-int
-main(void)
-{
- extern char __bss_start[], _end[];
- extern int fdtaddrsave;
-
- bzero(__bss_start, _end - __bss_start);
-
- /* initialize FDT if the blob is available */
- if (fdtaddrsave) {
- if (fdt_init((void *)fdtaddrsave) == 0)
- fdtaddrsave = 0; /* no usable blob there */
- }
-
- /* relocate FDT */
- if (fdtaddrsave && fdtaddrsave < FDTADDRSTART) {
- struct fdt_head *fh = (void *)fdtaddrsave;
-
- bcopy((void *)fdtaddrsave, (void *)FDTADDRSTART, fh->fh_size);
- fdtaddrsave = FDTADDRSTART;
- }
-
- boot(0);
- return 0;
-}
-
-void
-_rtt(void)
-{
- uint32_t v;
-
- *((volatile uint32_t *)(RPR)) = RPR_RSTE;
- __asm volatile("eieio");
- *((volatile uint32_t *)(RCR)) = RCR_SWHR;
-
- printf("RESET FAILED\n");
- for (;;)
- continue;
- /* NOTREACHED */
-}
diff --git a/sys/arch/socppc/stand/boot/ns16550.c b/sys/arch/socppc/stand/boot/ns16550.c
deleted file mode 100644
index 5345cccb878..00000000000
--- a/sys/arch/socppc/stand/boot/ns16550.c
+++ /dev/null
@@ -1,136 +0,0 @@
-/* $OpenBSD: ns16550.c,v 1.2 2009/09/07 21:16:57 dms Exp $ */
-/* $NetBSD: ns16550.c,v 1.3 2005/12/24 20:07:03 perry Exp $ */
-
-/*
- * Copyright (c) 2002 Wasabi Systems, Inc.
- * All rights reserved.
- *
- * Written by Jason R. Thorpe for Wasabi Systems, Inc.
- *
- * 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 for the NetBSD Project by
- * Wasabi Systems, Inc.
- * 4. The name of Wasabi Systems, Inc. may not be used to endorse
- * or promote products derived from this software without specific prior
- * written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY WASABI SYSTEMS, INC. ``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 WASABI SYSTEMS, INC
- * 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 file provides console I/O routines for boards that use
- * 16550-compatible UARTs.
- */
-
-#include <sys/types.h>
-
-#include <dev/cons.h>
-#include <dev/ic/comreg.h>
-
-#include "libsa.h"
-
-uint8_t *consaddr;
-uint32_t consspeed;
-uint32_t consfreq;
-
-#define INB(x) *((volatile uint8_t *) (consaddr + (x)))
-#define OUTB(x, v) *((volatile uint8_t *) (consaddr + (x))) = (v)
-#define ISSET(t,f) ((t) & (f))
-
-static int
-comspeed(int speed)
-{
-#define divrnd(n, q) (((n)*2/(q)+1)/2) /* divide and round off */
-
- int x, err;
-
- if (speed <= 0)
- return (-1);
- x = divrnd((consfreq / 16), speed);
- if (x <= 0)
- return (-1);
- err = divrnd((((quad_t)consfreq) / 16) * 1000, speed * x) - 1000;
- if (err < 0)
- err = -err;
- if (err > COM_TOLERANCE)
- return (-1);
- return (x);
-#undef divrnd
-}
-
-void
-com_probe(struct consdev *cn)
-{
- cn->cn_pri = CN_LOWPRI;
- cn->cn_dev = makedev(12, 0);
-}
-
-void
-com_init(struct consdev *cn)
-{
- int rate;
-
- OUTB(com_cfcr, LCR_DLAB);
- rate = comspeed(CONSPEED);
- OUTB(com_dlbl, rate);
- OUTB(com_dlbh, rate >> 8);
- OUTB(com_cfcr, LCR_8BITS);
- OUTB(com_mcr, MCR_DTR | MCR_RTS);
- OUTB(com_fifo,
- FIFO_ENABLE | FIFO_RCV_RST | FIFO_XMT_RST | FIFO_TRIGGER_1);
- OUTB(com_ier, 0);
-}
-
-int
-com_getc(dev_t dev)
-{
- uint8_t stat;
-
- if (dev & 0x80)
- return ISSET(stat = INB(com_lsr), LSR_RXRDY);
-
- while (!ISSET(stat = INB(com_lsr), LSR_RXRDY))
- /* spin */ ;
- return (INB(com_data));
-}
-
-void
-com_putc(dev_t dev, int c)
-{
- uint8_t stat;
- int timo;
-
- /* Wait for any pending transmission to finish. */
- timo = 50000;
- while (!ISSET(stat = INB(com_lsr), LSR_TXRDY) && --timo)
- /* spin */ ;
-
- OUTB(com_data, c);
-
- /* Wait for this transmission to complete. */
- timo = 1500000;
- while (!ISSET(stat = INB(com_lsr), LSR_TXRDY) && --timo)
- /* spin */ ;
-
- /* Clear any interrupts generated by this transmission. */
- (void) INB(com_iir);
-}
diff --git a/sys/arch/socppc/stand/boot/pciide.c b/sys/arch/socppc/stand/boot/pciide.c
deleted file mode 100644
index 7b3ffb7dda6..00000000000
--- a/sys/arch/socppc/stand/boot/pciide.c
+++ /dev/null
@@ -1,103 +0,0 @@
-/* $OpenBSD: pciide.c,v 1.3 2009/09/07 21:16:57 dms Exp $ */
-/* $NetBSD: pciide.c,v 1.5 2005/12/11 12:17:06 christos Exp $ */
-
-/*-
- * Copyright (c) 2003 The NetBSD Foundation, Inc.
- * 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 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 <sys/types.h>
-
-#include "libsa.h"
-#include "wdvar.h"
-
-u_int8_t pciide_read_cmdreg(struct wdc_channel *, u_int8_t);
-void pciide_write_cmdreg(struct wdc_channel *, u_int8_t, u_int8_t);
-u_int8_t pciide_read_ctlreg(struct wdc_channel *, u_int8_t);
-void pciide_write_ctlreg(struct wdc_channel *, u_int8_t, u_int8_t);
-
-u_int32_t pciide_base_addr = 0;
-
-int
-pciide_init(struct wdc_channel *chp, u_int chan)
-{
- u_int32_t cmdreg, ctlreg;
- int i;
-
- /*
- * two channels per chip, one drive per channel
- */
- if (chan >= PCIIDE_NUM_CHANNELS || pciide_base_addr == 0)
- return (ENXIO);
- chp->ndrives = 1;
-
- DPRINTF(("[pciide] channel: %d\n", chan));
-
- /*
- * XXX map?
- */
- cmdreg = pciide_base_addr + chan * 0x10;
- ctlreg = pciide_base_addr+0x8 + chan * 0x10;
-
- /* set up cmd regsiters */
- chp->c_cmdbase = (u_int8_t *)cmdreg;
- chp->c_data = (u_int16_t *)(cmdreg + wd_data);
- for (i = 0; i < WDC_NPORTS; i++)
- chp->c_cmdreg[i] = chp->c_cmdbase + i;
- /* set up shadow registers */
- chp->c_cmdreg[wd_status] = chp->c_cmdreg[wd_command];
- chp->c_cmdreg[wd_features] = chp->c_cmdreg[wd_precomp];
- /* set up ctl registers */
- chp->c_ctlbase = (u_int8_t *)ctlreg;
-
- chp->read_cmdreg = pciide_read_cmdreg;
- chp->write_cmdreg = pciide_write_cmdreg;
- chp->read_ctlreg = pciide_read_ctlreg;
- chp->write_ctlreg = pciide_write_ctlreg;
- return (0);
-}
-
-u_int8_t
-pciide_read_cmdreg(struct wdc_channel *chp, u_int8_t reg)
-{
- return *chp->c_cmdreg[reg];
-}
-
-void
-pciide_write_cmdreg(struct wdc_channel *chp, u_int8_t reg, u_int8_t val)
-{
- *chp->c_cmdreg[reg] = val;
-}
-
-u_int8_t
-pciide_read_ctlreg(struct wdc_channel *chp, u_int8_t reg)
-{
- return chp->c_ctlbase[reg];
-}
-
-void
-pciide_write_ctlreg(struct wdc_channel *chp, u_int8_t reg, u_int8_t val)
-{
- chp->c_ctlbase[reg] = val;
-}
diff --git a/sys/arch/socppc/stand/boot/start.S b/sys/arch/socppc/stand/boot/start.S
deleted file mode 100644
index 94b44424ae3..00000000000
--- a/sys/arch/socppc/stand/boot/start.S
+++ /dev/null
@@ -1,21 +0,0 @@
-#include <machine/asm.h>
-
-#define STACKSIZE 8192
-
- .globl _C_LABEL(fdtaddrsave)
- .type _C_LABEL(fdtaddrsave),@object
- .data
-_C_LABEL(fdtaddrsave): .long 0
-
-ENTRY(_start)
- lis %r1, fdtaddrsave@ha
- stw %r3, fdtaddrsave@l(%r1)
-
- lis %r1, stack@ha
- addi %r1, %r1, stack@l
- addi %r1, %r1, STACKSIZE
-
- b _C_LABEL(main)
-
- .data
-.lcomm stack,STACKSIZE,8
diff --git a/sys/arch/socppc/stand/boot/time.c b/sys/arch/socppc/stand/boot/time.c
deleted file mode 100644
index 18c702193cc..00000000000
--- a/sys/arch/socppc/stand/boot/time.c
+++ /dev/null
@@ -1,13 +0,0 @@
-/* $OpenBSD: time.c,v 1.3 2015/01/20 04:41:01 krw Exp $ */
-#include <sys/types.h>
-
-#include "libsa.h"
-
-time_t
-getsecs(void)
-{
- uint32_t count;
-
- __asm volatile ("mftb %0" : "=r" (count));
- return (count / 66666666);
-}
diff --git a/sys/arch/socppc/stand/boot/wd.c b/sys/arch/socppc/stand/boot/wd.c
deleted file mode 100644
index 1a5369aafda..00000000000
--- a/sys/arch/socppc/stand/boot/wd.c
+++ /dev/null
@@ -1,311 +0,0 @@
-/* $OpenBSD: wd.c,v 1.10 2017/09/08 05:36:52 deraadt Exp $ */
-/* $NetBSD: wd.c,v 1.5 2005/12/11 12:17:06 christos Exp $ */
-
-/*-
- * Copyright (c) 2003 The NetBSD Foundation, Inc.
- * All rights reserved.
- *
- * This code is derived from software contributed to The NetBSD Foundation
- * by Manuel Bouyer.
- *
- * 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 <sys/param.h>
-#include <sys/stdint.h>
-
-#include "libsa.h"
-#include "wdvar.h"
-
-void wdprobe(void);
-int wd_get_params(struct wd_softc *wd);
-int wdgetdisklabel(struct wd_softc *wd);
-void wdgetdefaultlabel(struct wd_softc *wd, struct disklabel *lp);
-
-struct wd_softc wd_devs[NUNITS];
-int wd_ndevs = -1;
-
-void
-wdprobe(void)
-{
- struct wd_softc *wd = wd_devs;
- u_int chan, drive, unit = 0;
-
- for (chan = 0; chan < PCIIDE_NUM_CHANNELS; chan++) {
- if (wdc_init(wd, chan) != 0)
- continue;
- for (drive = 0; drive < wd->sc_channel.ndrives; drive++) {
- wd->sc_unit = unit;
- wd->sc_drive = drive;
-
- if (wd_get_params(wd) != 0)
- continue;
-
- DPRINTF(("wd%d: channel %d drive %d\n",
- unit, chan, drive));
- unit++;
- wd++;
- }
- }
-
- wd_ndevs = unit;
-}
-
-/*
- * Get drive parameters through 'device identify' command.
- */
-int
-wd_get_params(wd)
- struct wd_softc *wd;
-{
- int error;
- unsigned char buf[DEV_BSIZE];
-
- if ((error = wdc_exec_identify(wd, buf)) != 0)
- return (error);
-
-#if BYTE_ORDER == BIG_ENDIAN
- /*
- * All the fields in the params structure are 16-bit integers
- * except for the ID strings which are char strings. The
- * 16-bit integers are currently in memory in little-endian,
- * regardless of architecture. So, they need to be swapped on
- * big-endian architectures before they are accessed through
- * the ataparams structure.
- *
- * The swaps below avoid touching the char strings.
- */
- swap16_multi((u_int16_t *)buf, 10);
- swap16_multi((u_int16_t *)buf + 20, 3);
- swap16_multi((u_int16_t *)buf + 47, DEV_BSIZE / 2 - 47);
-#endif
-
- wd->sc_params = *(struct ataparams *)buf;
-
- /* 48-bit LBA addressing */
- if ((wd->sc_params.atap_cmd2_en & ATAPI_CMD2_48AD) != 0) {
- DPRINTF(("Drive supports LBA48.\n"));
-#if defined(_ENABLE_LBA48)
- wd->sc_flags |= WDF_LBA48;
-#endif
- }
-
- /* Prior to ATA-4, LBA was optional. */
- if ((wd->sc_params.atap_capabilities1 & WDC_CAP_LBA) != 0) {
- DPRINTF(("Drive supports LBA.\n"));
- wd->sc_flags |= WDF_LBA;
- }
-
- return (0);
-}
-
-/*
- * Initialize disk label to the default value.
- */
-void
-wdgetdefaultlabel(wd, lp)
- struct wd_softc *wd;
- struct disklabel *lp;
-{
- memset(lp, 0, sizeof(struct disklabel));
-
- lp->d_secsize = DEV_BSIZE;
- lp->d_ntracks = wd->sc_params.atap_heads;
- lp->d_nsectors = wd->sc_params.atap_sectors;
- lp->d_ncylinders = wd->sc_params.atap_cylinders;
- lp->d_secpercyl = lp->d_ntracks * lp->d_nsectors;
-
- if (strcmp(wd->sc_params.atap_model, "ST506") == 0)
- lp->d_type = DTYPE_ST506;
- else
- lp->d_type = DTYPE_ESDI;
-
- strncpy(lp->d_typename, wd->sc_params.atap_model, 16);
- strncpy(lp->d_packname, "fictitious", 16);
- if (wd->sc_capacity > UINT32_MAX)
- DL_SETDSIZE(lp, UINT32_MAX);
- else
- DL_SETDSIZE(lp, wd->sc_capacity);
- lp->d_flags = 0;
-
- DL_SETPOFFSET(&lp->d_partitions[RAW_PART], 0);
- DL_SETPSIZE(&lp->d_partitions[RAW_PART], DL_GETDSIZE(lp));
- lp->d_partitions[RAW_PART].p_fstype = FS_UNUSED;
- lp->d_npartitions = MAXPARTITIONS;
-
- lp->d_magic = DISKMAGIC;
- lp->d_magic2 = DISKMAGIC;
- lp->d_checksum = dkcksum(lp);
-}
-
-/*
- * Read disk label from the device.
- */
-int
-wdgetdisklabel(wd)
- struct wd_softc *wd;
-{
- char *msg;
- int sector;
- size_t rsize;
- struct disklabel *lp;
- unsigned char buf[DEV_BSIZE];
- u_int16_t sig;
-
- wdgetdefaultlabel(wd, &wd->sc_label);
-
- /*
- * Find OpenBSD Partition in DOS partition table.
- */
- sector = 0;
- if (wdstrategy(wd, F_READ, DOSBBSECTOR, DEV_BSIZE, buf, &rsize))
- return EOFFSET;
-
- sig = letoh16(*(u_int16_t *)&buf[DOSMBR_SIGNATURE_OFF]);
- if (sig == DOSMBR_SIGNATURE) {
- int i;
- struct dos_partition *dp = (struct dos_partition *)buf;
-
- /*
- * Lookup OpenBSD slice. If there is none, go ahead
- * and try to read the disklabel off sector #0.
- */
-
- memcpy(dp, &buf[DOSPARTOFF], NDOSPART * sizeof(*dp));
- for (i = 0; i < NDOSPART; i++) {
- if (dp[i].dp_typ == DOSPTYP_OPENBSD) {
- sector = letoh32(dp[i].dp_start);
- break;
- }
- }
- }
-
- if (wdstrategy(wd, F_READ, sector + DOS_LABELSECTOR, DEV_BSIZE,
- buf, &rsize))
- return EOFFSET;
-
- if ((msg = getdisklabel(buf + LABELOFFSET, &wd->sc_label)))
- printf("wd%d: getdisklabel: %s\n", wd->sc_unit, msg);
-
- lp = &wd->sc_label;
-
- /* check partition */
- if ((wd->sc_part >= lp->d_npartitions) ||
- (lp->d_partitions[wd->sc_part].p_fstype == FS_UNUSED)) {
- DPRINTF(("illegal partition\n"));
- return (EPART);
- }
-
- DPRINTF(("label info: d_secsize %d, d_nsectors %d, d_ncylinders %d,"
- "d_ntracks %d, d_secpercyl %d\n",
- wd->sc_label.d_secsize,
- wd->sc_label.d_nsectors,
- wd->sc_label.d_ncylinders,
- wd->sc_label.d_ntracks,
- wd->sc_label.d_secpercyl));
-
- return (0);
-}
-
-/*
- * Open device (read drive parameters and disklabel)
- */
-int
-wdopen(struct open_file *f, ...)
-{
- int error;
- va_list ap;
- u_int unit, part, drive;
- struct wd_softc *wd;
-
- va_start(ap, f);
- unit = va_arg(ap, u_int);
- part = va_arg(ap, u_int);
- va_end(ap);
-
- DPRINTF(("wdopen: wd%d%c\n", unit, 'a' + part));
-
- if (unit < 0 || unit >= NUNITS)
- return (ENXIO);
-
- if (wd_ndevs == -1)
- wdprobe();
-
- if (unit >= wd_ndevs)
- return (ENXIO);
-
- wd = &wd_devs[unit];
- wd->sc_part = part;
-
- if ((error = wdgetdisklabel(wd)) != 0)
- return (error);
-
- f->f_devdata = wd;
- return (0);
-}
-
-/*
- * Close device.
- */
-int
-wdclose(struct open_file *f)
-{
- return 0;
-}
-
-/*
- * Read some data.
- */
-int
-wdstrategy(f, rw, dblk, size, buf, rsize)
- void *f;
- int rw;
- daddr32_t dblk;
- size_t size;
- void *buf;
- size_t *rsize;
-{
- int i, nsect;
- daddr32_t blkno;
- struct wd_softc *wd = f;
-
- if (size == 0)
- return (0);
-
- if (rw != F_READ)
- return EOPNOTSUPP;
-
- nsect = howmany(size, wd->sc_label.d_secsize);
- blkno = dblk + wd->sc_label.d_partitions[wd->sc_part].p_offset;
-
- for (i = 0; i < nsect; i++, blkno++) {
- int error;
-
- if ((error = wdc_exec_read(wd, WDCC_READ, blkno, buf)) != 0)
- return (error);
-
- buf += wd->sc_label.d_secsize;
- }
-
- *rsize = size;
- return (0);
-}
diff --git a/sys/arch/socppc/stand/boot/wdc.c b/sys/arch/socppc/stand/boot/wdc.c
deleted file mode 100644
index e584d55ce84..00000000000
--- a/sys/arch/socppc/stand/boot/wdc.c
+++ /dev/null
@@ -1,379 +0,0 @@
-/* $OpenBSD: wdc.c,v 1.5 2013/03/24 18:43:47 deraadt Exp $ */
-/* $NetBSD: wdc.c,v 1.7 2005/12/11 12:17:06 christos Exp $ */
-
-/*-
- * Copyright (c) 2003 The NetBSD Foundation, Inc.
- * All rights reserved.
- *
- * This code is derived from software contributed to The NetBSD Foundation
- * by Manuel Bouyer.
- *
- * 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 <sys/param.h>
-
-#include "libsa.h"
-#include "wdvar.h"
-
-#define WDCDELAY 100
-#define WDCNDELAY_RST 31000 * 10
-
-static int wdcprobe(struct wdc_channel *chp);
-static int wdc_wait_for_ready(struct wdc_channel *chp);
-static int wdc_read_block(struct wd_softc *sc, struct wdc_command *wd_c);
-static int __wdcwait_reset(struct wdc_channel *chp, int drv_mask);
-
-int (*controller_init)(struct wdc_channel *, u_int) = 0;
-
-/*
- * Reset the controller.
- */
-static int
-__wdcwait_reset(chp, drv_mask)
- struct wdc_channel *chp;
- int drv_mask;
-{
- int timeout;
- u_int8_t st0, st1;
-
- /* wait for BSY to deassert */
- for (timeout = 0; timeout < WDCNDELAY_RST; timeout++) {
- WDC_WRITE_REG(chp, wd_sdh, WDSD_IBM); /* master */
- delay(10);
- st0 = WDC_READ_REG(chp, wd_status);
- WDC_WRITE_REG(chp, wd_sdh, WDSD_IBM | 0x10); /* slave */
- delay(10);
- st1 = WDC_READ_REG(chp, wd_status);
-
- if ((drv_mask & 0x01) == 0) {
- /* no master */
- if ((drv_mask & 0x02) != 0 && (st1 & WDCS_BSY) == 0) {
- /* No master, slave is ready, it's done */
- goto end;
- }
- } else if ((drv_mask & 0x02) == 0) {
- /* no slave */
- if ((drv_mask & 0x01) != 0 && (st0 & WDCS_BSY) == 0) {
- /* No slave, master is ready, it's done */
- goto end;
- }
- } else {
- /* Wait for both master and slave to be ready */
- if ((st0 & WDCS_BSY) == 0 && (st1 & WDCS_BSY) == 0) {
- goto end;
- }
- }
-
- delay(WDCDELAY);
- }
-
- /* Reset timed out. Maybe it's because drv_mask was not right */
- if (st0 & WDCS_BSY)
- drv_mask &= ~0x01;
- if (st1 & WDCS_BSY)
- drv_mask &= ~0x02;
-
-end:
- return (drv_mask);
-}
-
-/* Test to see controller with at last one attached drive is there.
- * Returns a bit for each possible drive found (0x01 for drive 0,
- * 0x02 for drive 1).
- * Logic:
- * - If a status register is at 0xff, assume there is no drive here
- * (ISA has pull-up resistors). Similarly if the status register has
- * the value we last wrote to the bus (for IDE interfaces without pullups).
- * If no drive at all -> return.
- * - reset the controller, wait for it to complete (may take up to 31s !).
- * If timeout -> return.
- */
-static int
-wdcprobe(chp)
- struct wdc_channel *chp;
-{
- u_int8_t st0, st1, sc, sn, cl, ch;
- u_int8_t ret_value = 0x03;
- u_int8_t drive;
- int found;
-
- /*
- * Sanity check to see if the wdc channel responds at all.
- */
- WDC_WRITE_REG(chp, wd_sdh, WDSD_IBM);
- delay(10);
- st0 = WDC_READ_REG(chp, wd_status);
- WDC_WRITE_REG(chp, wd_sdh, WDSD_IBM | 0x10);
- delay(10);
- st1 = WDC_READ_REG(chp, wd_status);
-
- if (st0 == 0xff || st0 == WDSD_IBM)
- ret_value &= ~0x01;
- if (st1 == 0xff || st1 == (WDSD_IBM | 0x10))
- ret_value &= ~0x02;
- if (ret_value == 0)
- return (ENXIO);
-
- /* assert SRST, wait for reset to complete */
- WDC_WRITE_REG(chp, wd_sdh, WDSD_IBM);
- delay(10);
- WDC_WRITE_CTLREG(chp, wd_aux_ctlr, WDCTL_RST | WDCTL_IDS);
- delay(1000);
- WDC_WRITE_CTLREG(chp, wd_aux_ctlr, WDCTL_IDS);
- delay(1000);
- (void) WDC_READ_REG(chp, wd_error);
- WDC_WRITE_CTLREG(chp, wd_aux_ctlr, WDCTL_4BIT);
- delay(10);
-
- ret_value = __wdcwait_reset(chp, ret_value);
-
- /* if reset failed, there's nothing here */
- if (ret_value == 0)
- return (ENXIO);
-
- /*
- * Test presence of drives. First test register signatures looking for
- * ATAPI devices. If it's not an ATAPI and reset said there may be
- * something here assume it's ATA or OLD. Ghost will be killed later in
- * attach routine.
- */
- found = 0;
- for (drive = 0; drive < 2; drive++) {
- if ((ret_value & (0x01 << drive)) == 0)
- continue;
- return (0);
- }
- return (ENXIO);
-}
-
-/*
- * Initialize the device.
- */
-int
-wdc_init(sc, unit)
- struct wd_softc *sc;
- u_int unit;
-{
- if (!controller_init)
- return (ENXIO);
- if ((*controller_init)(&sc->sc_channel, unit) != 0)
- return (ENXIO);
- if (wdcprobe(&sc->sc_channel) != 0)
- return (ENXIO);
- return (0);
-}
-
-/*
- * Wait until the device is ready.
- */
-int
-wdc_wait_for_ready(chp)
- struct wdc_channel *chp;
-{
- u_int timeout;
- for (timeout = WDC_TIMEOUT; timeout > 0; --timeout) {
- if ((WDC_READ_REG(chp, wd_status) & (WDCS_BSY | WDCS_DRDY))
- == WDCS_DRDY)
- return (0);
- }
- return (ENXIO);
-}
-
-/*
- * Read one block off the device.
- */
-int
-wdc_read_block(sc, wd_c)
- struct wd_softc *sc;
- struct wdc_command *wd_c;
-{
- int i;
- struct wdc_channel *chp = &sc->sc_channel;
- u_int16_t *ptr = (u_int16_t*)wd_c->data;
-
- if (ptr == NULL)
- return (0);
-
- for (i = wd_c->bcount; i > 0; i -= sizeof(u_int16_t))
- *ptr++ = WDC_READ_DATA(chp);
-
- return (0);
-}
-
-/*
- * Send a command to the device (CHS and LBA addressing).
- */
-int
-wdccommand(wd, wd_c)
- struct wd_softc *wd;
- struct wdc_command *wd_c;
-{
- u_int8_t err;
- struct wdc_channel *chp = &wd->sc_channel;
-
-#if 0
- DPRINTF(("wdccommand(%d, %d, %d, %d, %d, %d, %d)\n",
- wd_c->drive, wd_c->r_command, wd_c->r_cyl,
- wd_c->r_head, wd_c->r_sector, wd_c->bcount,
- wd_c->r_precomp));
-#endif
-
- WDC_WRITE_REG(chp, wd_precomp, wd_c->r_precomp);
- WDC_WRITE_REG(chp, wd_seccnt, wd_c->r_count);
- WDC_WRITE_REG(chp, wd_sector, wd_c->r_sector);
- WDC_WRITE_REG(chp, wd_cyl_lo, wd_c->r_cyl);
- WDC_WRITE_REG(chp, wd_cyl_hi, wd_c->r_cyl >> 8);
- WDC_WRITE_REG(chp, wd_sdh,
- WDSD_IBM | (wd_c->drive << 4) | wd_c->r_head);
- WDC_WRITE_REG(chp, wd_command, wd_c->r_command);
-
- if (wdc_wait_for_ready(chp) != 0)
- return (ENXIO);
-
- if (WDC_READ_REG(chp, wd_status) & WDCS_ERR) {
- DPRINTF(("wd%d: error %x\n", wd->sc_unit,
- WDC_READ_REG(chp, wd_error)));
- return (ENXIO);
- }
-
- return (0);
-}
-
-/*
- * Send a command to the device (LBA48 addressing).
- */
-int
-wdccommandext(wd, wd_c)
- struct wd_softc *wd;
- struct wdc_command *wd_c;
-{
- u_int8_t err;
- struct wdc_channel *chp = &wd->sc_channel;
-
- /* Select drive, head, and addressing mode. */
- WDC_WRITE_REG(chp, wd_sdh, (wd_c->drive << 4) | WDSD_LBA);
-
- /* previous */
- WDC_WRITE_REG(chp, wd_features, 0);
- WDC_WRITE_REG(chp, wd_seccnt, wd_c->r_count >> 8);
- WDC_WRITE_REG(chp, wd_lba_hi, wd_c->r_blkno >> 40);
- WDC_WRITE_REG(chp, wd_lba_mi, wd_c->r_blkno >> 32);
- WDC_WRITE_REG(chp, wd_lba_lo, wd_c->r_blkno >> 24);
-
- /* current */
- WDC_WRITE_REG(chp, wd_features, 0);
- WDC_WRITE_REG(chp, wd_seccnt, wd_c->r_count);
- WDC_WRITE_REG(chp, wd_lba_hi, wd_c->r_blkno >> 16);
- WDC_WRITE_REG(chp, wd_lba_mi, wd_c->r_blkno >> 8);
- WDC_WRITE_REG(chp, wd_lba_lo, wd_c->r_blkno);
-
- /* Send command. */
- WDC_WRITE_REG(chp, wd_command, wd_c->r_command);
-
- if (wdc_wait_for_ready(chp) != 0)
- return (ENXIO);
-
- if (WDC_READ_REG(chp, wd_status) & WDCS_ERR) {
- DPRINTF(("wd%d: error %x\n", wd->sc_unit,
- WDC_READ_REG(chp, wd_error)));
- return (ENXIO);
- }
-
- return (0);
-}
-
-/*
- * Issue 'device identify' command.
- */
-int
-wdc_exec_identify(wd, data)
- struct wd_softc *wd;
- void *data;
-{
- int error;
- struct wdc_command wd_c;
-
- memset(&wd_c, 0, sizeof(wd_c));
-
- wd_c.drive = wd->sc_drive;
- wd_c.r_command = WDCC_IDENTIFY;
- wd_c.bcount = DEV_BSIZE;
- wd_c.data = data;
-
- if ((error = wdccommand(wd, &wd_c)) != 0)
- return (error);
-
- return wdc_read_block(wd, &wd_c);
-}
-
-/*
- * Issue 'read' command.
- */
-int
-wdc_exec_read(wd, cmd, blkno, data)
- struct wd_softc *wd;
- u_int8_t cmd;
- daddr32_t blkno;
- void *data;
-{
- int error;
- struct wdc_command wd_c;
-
- memset(&wd_c, 0, sizeof(wd_c));
-
- if (wd->sc_flags & WDF_LBA48) {
- /* LBA48 */
- wd_c.r_blkno = blkno;
- } else if (wd->sc_flags & WDF_LBA) {
- /* LBA */
- wd_c.r_sector = (blkno >> 0) & 0xff;
- wd_c.r_cyl = (blkno >> 8) & 0xffff;
- wd_c.r_head = (blkno >> 24) & 0x0f;
- wd_c.r_head |= WDSD_LBA;
- } else {
- /* LHS */
- wd_c.r_sector = blkno % wd->sc_label.d_nsectors;
- wd_c.r_sector++; /* Sectors begin with 1, not 0. */
- blkno /= wd->sc_label.d_nsectors;
- wd_c.r_head = blkno % wd->sc_label.d_ntracks;
- blkno /= wd->sc_label.d_ntracks;
- wd_c.r_cyl = blkno;
- wd_c.r_head |= WDSD_CHS;
- }
-
- wd_c.data = data;
- wd_c.r_count = 1;
- wd_c.drive = wd->sc_drive;
- wd_c.r_command = cmd;
- wd_c.bcount = wd->sc_label.d_secsize;
-
- if (wd->sc_flags & WDF_LBA48)
- error = wdccommandext(wd, &wd_c);
- else
- error = wdccommand(wd, &wd_c);
-
- if (error != 0)
- return (error);
-
- return wdc_read_block(wd, &wd_c);
-}
diff --git a/sys/arch/socppc/stand/boot/wdc_obio.c b/sys/arch/socppc/stand/boot/wdc_obio.c
deleted file mode 100644
index 480e83731ab..00000000000
--- a/sys/arch/socppc/stand/boot/wdc_obio.c
+++ /dev/null
@@ -1,99 +0,0 @@
-/* $OpenBSD: wdc_obio.c,v 1.1 2009/09/07 21:16:57 dms Exp $ */
-
-/*
- * Copyright (c) 2009 Dariusz Swiderski <sfires@sfires.net>
- *
- * 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.
- */
-
-#include <sys/types.h>
-
-#include "libsa.h"
-#include "wdvar.h"
-
-#define WDC_OBIO_REG_OFFSET (8 << 17)
-#define WDC_OBIO_AUXREG_OFFSET (6 << 16)
-
-u_int8_t wdc_read_cmdreg(struct wdc_channel *, u_int8_t);
-void wdc_write_cmdreg(struct wdc_channel *, u_int8_t, u_int8_t);
-u_int8_t wdc_read_ctlreg(struct wdc_channel *, u_int8_t);
-void wdc_write_ctlreg(struct wdc_channel *, u_int8_t, u_int8_t);
-
-u_int32_t wdc_base_addr[2];
-
-int
-wdc_obio_init(struct wdc_channel *chp, u_int chan)
-{
- u_int32_t cmdreg, ctlreg;
- int i;
-
- /*
- * two channels per chip, one drive per channel
- */
- if (chan >= 2 || !wdc_base_addr[chan])
- return (ENXIO);
- chp->ndrives = 1;
-
- cmdreg = wdc_base_addr[chan] + WDC_OBIO_REG_OFFSET;
- ctlreg = wdc_base_addr[chan] + WDC_OBIO_AUXREG_OFFSET;
-
- /* set up cmd regsiters */
- chp->c_cmdbase = (u_int8_t *)cmdreg;
- chp->c_data = (u_int16_t *)(cmdreg + wd_data);
- for (i = 0; i < WDC_NPORTS; i++)
- chp->c_cmdreg[i] = chp->c_cmdbase + (i<<16);
- /* set up shadow registers */
- chp->c_cmdreg[wd_status] = chp->c_cmdreg[wd_command];
- chp->c_cmdreg[wd_features] = chp->c_cmdreg[wd_precomp];
- /* set up ctl registers */
- chp->c_ctlbase = (u_int8_t *)ctlreg;
-
- chp->read_cmdreg = wdc_read_cmdreg;
- chp->write_cmdreg = wdc_write_cmdreg;
- chp->read_ctlreg = wdc_read_ctlreg;
- chp->write_ctlreg = wdc_write_ctlreg;
-
- return (0);
-}
-
-u_int8_t
-wdc_read_cmdreg(struct wdc_channel *chp, u_int8_t reg)
-{
- u_int8_t val;
- val = *chp->c_cmdreg[reg];
- if (val == 0xf9 && reg == wd_status)
- val = 0x7f;
- return val;
-}
-
-void
-wdc_write_cmdreg(struct wdc_channel *chp, u_int8_t reg, u_int8_t val)
-{
- *chp->c_cmdreg[reg] = val;
-}
-
-u_int8_t
-wdc_read_ctlreg(struct wdc_channel *chp, u_int8_t reg)
-{
- u_int8_t val;
- val = chp->c_ctlbase[reg];
- if (val == 0xf9 && reg == wd_aux_altsts)
- val = 0x7f;
- return val;
-}
-
-void
-wdc_write_ctlreg(struct wdc_channel *chp, u_int8_t reg, u_int8_t val)
-{
- chp->c_ctlbase[reg] = val;
-}
diff --git a/sys/arch/socppc/stand/boot/wdvar.h b/sys/arch/socppc/stand/boot/wdvar.h
deleted file mode 100644
index aa7b997df71..00000000000
--- a/sys/arch/socppc/stand/boot/wdvar.h
+++ /dev/null
@@ -1,138 +0,0 @@
-/* $OpenBSD: wdvar.h,v 1.3 2011/03/13 00:13:53 deraadt Exp $ */
-/* $NetBSD: wdvar.h,v 1.6 2005/12/11 12:17:06 christos Exp $ */
-
-/*-
- * Copyright (c) 2003 The NetBSD Foundation, Inc.
- * Copyright (c) 2001 Dynarc AB, Sweden. All rights reserved.
- *
- * This code is derived from software written by Anders Magnusson,
- * ragge@ludd.luth.se
- *
- * 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. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission
- *
- * 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.
- */
-
-#ifndef _STAND_WDVAR_H
-#define _STAND_WDVAR_H
-
-#include <sys/disklabel.h>
-
-#include <dev/ic/wdcreg.h>
-#include <dev/ata/atareg.h>
-#include <dev/pci/pciidereg.h>
-
-/*
- * WD1003 / ATA Disk Controller register definitions.
- */
-
-/* offsets of registers in the 'regular' register region */
-#define wd_data 0 /* data register (R/W - 16 bits) */
-#define wd_error 1 /* error register (R) */
-#define wd_precomp 1 /* write precompensation (W) */
-#define wd_seccnt 2 /* sector count (R/W) */
-#define wd_ireason 2 /* interrupt reason (R/W) (for atapi) */
-#define wd_sector 3 /* first sector number (R/W) */
-#define wd_cyl_lo 4 /* cylinder address, low byte (R/W) */
-#define wd_cyl_hi 5 /* cylinder address, high byte (R/W) */
-#define wd_sdh 6 /* sector size/drive/head (R/W) */
-#define wd_command 7 /* command register (W) */
-#define wd_lba_lo 3 /* lba address, low byte (RW) */
-#define wd_lba_mi 4 /* lba address, middle byte (RW) */
-#define wd_lba_hi 5 /* lba address, high byte (RW) */
-
-/* "shadow" registers; these may or may not overlap regular registers */
-#define wd_status 8 /* immediate status (R) */
-#define wd_features 9 /* features (W) */
-
-/* offsets of registers in the auxiliary register region */
-#define wd_aux_altsts 0 /* alternate fixed disk status (R) */
-#define wd_aux_ctlr 0 /* fixed disk controller control (W) */
-#define WDCTL_4BIT 0x08 /* use four head bits (wd1003) */
-#define WDCTL_RST 0x04 /* reset the controller */
-#define WDCTL_IDS 0x02 /* disable controller interrupts */
-
-#define WDC_TIMEOUT 2000000
-#define PCIIDE_CHANNEL_NDEV 2
-#define NUNITS (PCIIDE_CHANNEL_NDEV * PCIIDE_NUM_CHANNELS)
-#define WDC_NPORTS 8 /* XXX */
-#define WDC_NSHADOWREG 2 /* XXX */
-
-struct wdc_channel {
- volatile u_int8_t *c_cmdbase;
- volatile u_int8_t *c_ctlbase;
- volatile u_int8_t *c_cmdreg[WDC_NPORTS + WDC_NSHADOWREG];
- volatile u_int16_t *c_data;
-
- u_int8_t ndrives;
-
- u_int8_t (*read_cmdreg)(struct wdc_channel *chp, u_int8_t reg);
- void (*write_cmdreg)(struct wdc_channel *chp, u_int8_t reg, u_int8_t val);
- u_int8_t (*read_ctlreg)(struct wdc_channel *chp, u_int8_t reg);
- void (*write_ctlreg)(struct wdc_channel *chp, u_int8_t reg, u_int8_t val);
-};
-
-#define WDC_READ_REG(chp, reg) (chp)->read_cmdreg(chp, reg)
-#define WDC_WRITE_REG(chp, reg, val) (chp)->write_cmdreg(chp, reg, val)
-#define WDC_READ_CTLREG(chp, reg) (chp)->read_ctlreg(chp, reg)
-#define WDC_WRITE_CTLREG(chp, reg, val) (chp)->write_ctlreg(chp, reg, val)
-#define WDC_READ_DATA(chp) *(chp)->c_data
-
-struct wd_softc {
-#define WDF_LBA 0x0001
-#define WDF_LBA48 0x0002
- u_int16_t sc_flags;
-
- u_int sc_part;
- u_int sc_unit;
-
- u_int64_t sc_capacity;
-
- struct ataparams sc_params;
- struct disklabel sc_label;
- struct wdc_channel sc_channel;
- u_int sc_drive;
-};
-
-struct wdc_command {
- u_int8_t drive; /* drive id */
-
- u_int8_t r_command; /* Parameters to upload to registers */
- u_int8_t r_head;
- u_int16_t r_cyl;
- u_int8_t r_sector;
- u_int8_t r_count;
- u_int8_t r_precomp;
-
- u_int16_t bcount;
- void *data;
-
- u_int64_t r_blkno;
-};
-
-int wdc_init (struct wd_softc*, u_int);
-int wdccommand (struct wd_softc*, struct wdc_command*);
-int wdccommandext (struct wd_softc*, struct wdc_command*);
-int wdc_exec_read (struct wd_softc*, u_int8_t, daddr32_t, void*);
-int wdc_exec_identify (struct wd_softc*, void*);
-
-
-#endif /* _STAND_WDVAR_H */