summaryrefslogtreecommitdiffstats
path: root/sys
diff options
context:
space:
mode:
authorrahnds <rahnds@openbsd.org>1997-02-06 04:36:38 +0000
committerrahnds <rahnds@openbsd.org>1997-02-06 04:36:38 +0000
commit3fc28b5769d7ff0569c7d815db1ad40e911dfb83 (patch)
tree5461bfd0ce6d303d860dceeb42bf547a146b2f2f /sys
parentChanges to ramdisk driver to support disklabels. Work done by Theo. (diff)
downloadwireguard-openbsd-3fc28b5769d7ff0569c7d815db1ad40e911dfb83.tar.xz
wireguard-openbsd-3fc28b5769d7ff0569c7d815db1ad40e911dfb83.zip
PowerPC pieces for ramdisk (rd) changes this is adds majors,
rd_root pieces, config file to generate MINIROOT with rdroot and MAKEDEV changes as well as adding the rd device to known device types.
Diffstat (limited to 'sys')
-rw-r--r--sys/arch/powerpc/conf/DDB2
-rw-r--r--sys/arch/powerpc/conf/MINI10
-rw-r--r--sys/arch/powerpc/conf/files.powerpc5
-rw-r--r--sys/arch/powerpc/powerpc/conf.c40
-rw-r--r--sys/arch/powerpc/powerpc/rd_root.c79
5 files changed, 125 insertions, 11 deletions
diff --git a/sys/arch/powerpc/conf/DDB b/sys/arch/powerpc/conf/DDB
index 0ed083ae4ae..a8ce76d5158 100644
--- a/sys/arch/powerpc/conf/DDB
+++ b/sys/arch/powerpc/conf/DDB
@@ -68,3 +68,5 @@ ofrtc* at openfirm?
pseudo-device loop
pseudo-device pty 64
pseudo-device random 1
+pseudo-device rd
+pseudo-device vnd 1
diff --git a/sys/arch/powerpc/conf/MINI b/sys/arch/powerpc/conf/MINI
index 5b5bb1a6364..df0b6c1141a 100644
--- a/sys/arch/powerpc/conf/MINI
+++ b/sys/arch/powerpc/conf/MINI
@@ -20,7 +20,7 @@ options FIREPOWERBUGS
#options DDB
#options KTRACE
-options SYSCALL_DEBUG
+#options SYSCALL_DEBUG
options TCP_COMPAT_42
options COMPAT_43
options COMPAT_09
@@ -50,7 +50,12 @@ options NMBCLUSTERS=1024
options MAXUSERS=20
#options TARGET_ELF
-config bsd swap generic
+# needed for rd miniroot support
+options MINIROOTSIZE=4096
+options RAMDISK_HOOKS
+
+
+config bsd swap on ofdisk0 and ofdisk1 and ofdisk2 root rd0a
ofroot* at root
@@ -68,3 +73,4 @@ ofrtc* at openfirm?
pseudo-device loop
pseudo-device pty 64
pseudo-device random 1
+pseudo-device rd
diff --git a/sys/arch/powerpc/conf/files.powerpc b/sys/arch/powerpc/conf/files.powerpc
index 55e0e95de36..3de19114146 100644
--- a/sys/arch/powerpc/conf/files.powerpc
+++ b/sys/arch/powerpc/conf/files.powerpc
@@ -45,6 +45,11 @@ file arch/powerpc/powerpc/db_disasm.c ddb
file arch/powerpc/powerpc/db_interface.c ddb
file arch/powerpc/powerpc/db_trace.c ddb
+pseudo-device rd
+file dev/ramdisk.c rd needs-flag
+file arch/powerpc/powerpc/rd_root.c ramdisk_hooks
+major {rd = 17}
+
# FirePower specific code
#device firepower: openfirm
#attach firepower at root
diff --git a/sys/arch/powerpc/powerpc/conf.c b/sys/arch/powerpc/powerpc/conf.c
index eefeaff4d0a..da0983d3c5a 100644
--- a/sys/arch/powerpc/powerpc/conf.c
+++ b/sys/arch/powerpc/powerpc/conf.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: conf.c,v 1.2 1996/12/28 06:21:41 rahnds Exp $ */
+/* $OpenBSD: conf.c,v 1.3 1997/02/06 04:36:41 rahnds Exp $ */
/* $NetBSD: conf.c,v 1.2 1996/10/16 17:26:19 ws Exp $ */
/*
@@ -43,12 +43,34 @@
bdev_decl(ofd);
bdev_decl(sw);
+#include "rd.h"
+bdev_decl(rd);
+
+#include "vnd.h"
+bdev_decl(vnd);
+#include "ccd.h"
+bdev_decl(ccd);
+
struct bdevsw bdevsw[] = {
bdev_notdef(), /* 0 */
bdev_swap_init(1,sw), /* 1: swap pseudo device */
bdev_notdef(), /* 2 SCSI tape */
bdev_notdef(), /* 3 SCSI CD-ROM */
bdev_disk_init(NOFDISK,ofd), /* 4: Openfirmware disk */
+ bdev_notdef(), /* 5 unknown*/
+ bdev_notdef(), /* 6 unknown*/
+ bdev_notdef(), /* 7 unknown*/
+ bdev_lkm_dummy(), /* 8 */
+ bdev_lkm_dummy(), /* 9 */
+ bdev_lkm_dummy(), /* 10 */
+ bdev_lkm_dummy(), /* 11 */
+ bdev_lkm_dummy(), /* 12 */
+ bdev_lkm_dummy(), /* 13 */
+ bdev_disk_init(NVND,vnd), /* 14 vnode disk driver*/
+ bdev_notdef(), /* 15 unknown*/
+ bdev_disk_init(NCCD,ccd), /* 16 concatenated disk driver*/
+ bdev_disk_init(NRD,rd), /* 17 ram disk driver*/
+ bdev_notdef(), /* 18 unknown*/
};
int nblkdev = sizeof bdevsw / sizeof bdevsw[0];
@@ -75,12 +97,12 @@ cdev_decl(ofrtc);
#include <sd.h>
#include <st.h>
#include <cd.h>
-#include <vnd.h>
cdev_decl(st);
cdev_decl(sd);
cdev_decl(cd);
cdev_decl(vnd);
cdev_decl(ccd);
+cdev_decl(rd);
dev_decl(filedesc,open);
@@ -131,8 +153,8 @@ struct cdevsw cdevsw[] = {
cdev_notdef(), /* 14 */
cdev_notdef(), /* 15 */
cdev_notdef(), /* 16 */
- cdev_rtc_init(NOFRTC,ofrtc), /* 17: Openfirmware RTC */
- cdev_notdef(), /* 18 */
+ cdev_disk_init(NRD,rd), /* 17 ram disk driver*/
+ cdev_rtc_init(NOFRTC,ofrtc), /* 18: Openfirmware RTC */
cdev_disk_init(NVND,vnd), /* 19: vnode disk */
cdev_tape_init(NST,st), /* 20: SCSI tape */
cdev_fd_init(1,filedesc), /* 21: file descriptor pseudo-dev */
@@ -205,11 +227,11 @@ static int chrtoblktbl[] = {
/* 14 */ NODEV,
/* 15 */ NODEV,
/* 16 */ NODEV,
- /* 10 */ NODEV,
- /* 10 */ NODEV,
- /* 10 */ NODEV,
- /* 10 */ NODEV,
- /* 10 */ NODEV,
+ /* 17 */ 17,
+ /* 18 */ NODEV,
+ /* 19 */ NODEV,
+ /* 20 */ NODEV,
+ /* 21 */ NODEV,
};
/*
diff --git a/sys/arch/powerpc/powerpc/rd_root.c b/sys/arch/powerpc/powerpc/rd_root.c
new file mode 100644
index 00000000000..4120f4641a6
--- /dev/null
+++ b/sys/arch/powerpc/powerpc/rd_root.c
@@ -0,0 +1,79 @@
+/* $NetBSD: rd_root.c,v 1.2 1996/03/27 16:38:33 perry Exp $ */
+
+/*
+ * Copyright (c) 1995 Gordon W. Ross
+ * 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. 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.
+ */
+
+#include <sys/param.h>
+#include <sys/reboot.h>
+
+#include <dev/ramdisk.h>
+
+extern int boothowto;
+
+#ifndef MINIROOTSIZE
+#define MINIROOTSIZE 512
+#endif
+
+#define ROOTBYTES (MINIROOTSIZE << DEV_BSHIFT)
+
+/*
+ * This array will be patched to contain a file-system image.
+ * See the program: src/distrib/sun3/common/rdsetroot.c
+ */
+int rd_root_size = ROOTBYTES;
+char rd_root_image[ROOTBYTES] = "|This is the root ramdisk!\n";
+
+/*
+ * This is called during autoconfig.
+ */
+void
+rd_attach_hook(unit, rd)
+ int unit;
+ struct rd_conf *rd;
+{
+ if (unit == 0) {
+ /* Setup root ramdisk */
+ rd->rd_addr = (caddr_t) rd_root_image;
+ rd->rd_size = (size_t) rd_root_size;
+ rd->rd_type = RD_KMEM_FIXED;
+ printf(" fixed, %d blocks", MINIROOTSIZE);
+ }
+}
+
+/*
+ * This is called during open (i.e. mountroot)
+ */
+void
+rd_open_hook(unit, rd)
+ int unit;
+ struct rd_conf *rd;
+{
+ if (unit == 0) {
+ /* The root ramdisk only works single-user. */
+ boothowto |= RB_SINGLE;
+ }
+}