From: downsj Date: Sun, 16 Feb 1997 10:42:14 +0000 (+0000) Subject: Add initial ram disk support. X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=59dd836a79e2c2e106a737340eeeb3946390d00b;p=openbsd Add initial ram disk support. --- diff --git a/sys/arch/hp300/conf/DISKLESS b/sys/arch/hp300/conf/DISKLESS index 6a1e6f312ad..1921913c03e 100644 --- a/sys/arch/hp300/conf/DISKLESS +++ b/sys/arch/hp300/conf/DISKLESS @@ -1,4 +1,4 @@ -# $OpenBSD: DISKLESS,v 1.11 1997/02/10 06:43:26 downsj Exp $ +# $OpenBSD: DISKLESS,v 1.12 1997/02/16 10:42:14 downsj Exp $ # $NetBSD: GENERIC,v 1.23 1997/01/31 06:12:57 thorpej Exp $ # # Generic kernel - one size fits all. @@ -6,7 +6,7 @@ machine hp300 m68k -# Include all GENERIC option +# Include all GENERIC options include "../../../conf/GENERIC" # Support for various CPU types diff --git a/sys/arch/hp300/conf/GENERIC b/sys/arch/hp300/conf/GENERIC index d9058bc4a06..5b1c8d7b699 100644 --- a/sys/arch/hp300/conf/GENERIC +++ b/sys/arch/hp300/conf/GENERIC @@ -1,4 +1,4 @@ -# $OpenBSD: GENERIC,v 1.15 1997/02/10 06:43:28 downsj Exp $ +# $OpenBSD: GENERIC,v 1.16 1997/02/16 10:42:16 downsj Exp $ # $NetBSD: GENERIC,v 1.23 1997/01/31 06:12:57 thorpej Exp $ # # Generic kernel - one size fits all. @@ -6,7 +6,7 @@ machine hp300 m68k -# Include all GENERIC option +# Include all GENERIC options include "../../../conf/GENERIC" # Support for various CPU types diff --git a/sys/arch/hp300/conf/MINIROOT b/sys/arch/hp300/conf/MINIROOT new file mode 100644 index 00000000000..6492918cf38 --- /dev/null +++ b/sys/arch/hp300/conf/MINIROOT @@ -0,0 +1,113 @@ +# $OpenBSD: MINIROOT,v 1.1 1997/02/16 10:42:17 downsj Exp $ +# +# Ram disk kernel for the miniroot. +# + +machine hp300 m68k + +# Include all GENERIC options +include "../../../conf/GENERIC" + +# Support for various CPU types +option HP320 +option HP330 # includes 318, 319 +option HP340 +option HP350 +option HP360 +option HP370 +option HP375 # includes 345, 400t, 400s +option HP380 # includes 425t, 425s, 433s + +# Need to set locally +maxusers 16 + +# Options for HP hardware +option FPSP # floating point interface for 68040 +option USELEDS # make the lights twinkle +#option PANICBUTTON # two fast s on HIL dump kernel +#option CONSCODE="9" # force console at this select code +option UK_KEYBOARD # include United Kingdom HIL keymap +option SE_KEYBOARD # include Swedish HIL keymap + +# This option enables a different copyin/copyout that uses page +# mapping for large copies. +#option MAPPEDCOPY # different copyin/copyout for large copies + +# +# HP-UX binary compatibility. +# NOTE: THIS IS STILL VERY EXPERIMENTAL. YOUR MILEAGE MAY VARY. +# +#option COMPAT_HPUX # HP-UX binary compatibility + +#option COMPAT_M68K4K # compat. with NetBSD/m68k4k binaries + +# Verbose descriptions of unconfigured DIO devices +# (Warning: this compiles in a large string table) +option DIOVERBOSE # recognize "unknown" DIO devices + +config bsd swap generic + +mainbus0 at root # root "bus" + +intio0 at mainbus0 # internal i/o space +dio0 at mainbus0 # DIO/DIO-II bus + +# Davinci framebuffer +dvbox* at intio? +dvbox* at dio? scode ? + +# Gatorbox framebuffer +gbox* at intio? +gbox* at dio? scode ? + +# Hyperion framebuffer +hyper* at dio? scode ? + +# Renaissance framebuffer +rbox* at intio? +rbox* at dio? scode ? + +# Topcat/catseye framebuffers +topcat* at intio? +topcat* at dio? scode ? + +# Framebuffer abstraction +grf* at dvbox? +grf* at gbox? +grf* at hyper? +grf* at rbox? +grf* at topcat? + +# Internal Terminal Emulator +ite* at grf? + +dca0 at dio? scode 9 flags 1 # DCA serial interfaces +dca* at dio? scode ? + +dcm* at dio? scode ? flags 0xe # DCM 4- or 8-port serial interfaces + +le* at dio? scode ? # LANCE ethernet interfaces + +nhpib0 at dio? scode 7 # slow internal HP-IB +nhpib* at dio? scode ? + +fhpib* at dio? scode ? # `fast' HP-IB + +hpibbus0 at nhpib0 +hpibbus* at nhpib? +hpibbus* at fhpib? + +hd* at hpibbus? slave ? punit ? # HP-IB disks +ct* at hpibbus? slave ? punit ? # HP-IB cartridge tapes +mt* at hpibbus? slave ? punit ? # HP-IB 9-track tape +ppi0 at hpibbus0 slave 5 punit 0 # HP-IB plotter + +oscsi* at dio? scode ? # Old HP SCSI + +sd* at oscsi? target ? lun ? # SCSI disks +st* at oscsi? target ? lun ? # SCSI tapes +ac* at oscsi? target ? lun ? # SCSI changers + +option MINIROOTSIZE=4096 +option RAMDISK_HOOKS +pseudo-device rd 2 diff --git a/sys/arch/hp300/conf/files.hp300 b/sys/arch/hp300/conf/files.hp300 index 712a3259069..8619240ecc3 100644 --- a/sys/arch/hp300/conf/files.hp300 +++ b/sys/arch/hp300/conf/files.hp300 @@ -1,4 +1,4 @@ -# $OpenBSD: files.hp300,v 1.5 1997/02/10 06:43:29 downsj Exp $ +# $OpenBSD: files.hp300,v 1.6 1997/02/16 10:42:18 downsj Exp $ # $NetBSD: files.hp300,v 1.22 1997/01/30 22:11:19 scottr Exp $ # # hp300-specific configuration info @@ -128,6 +128,12 @@ device ppi attach ppi at hpibbus file arch/hp300/dev/ppi.c ppi needs-flag +# RAM disk +pseudo-device rd +file dev/ramdisk.c rd needs-flag +file arch/hp300/dev/rd_root.c ramdisk_hooks +major {rd = 8} + # Old HP SCSI layer device oscsi { target = -1, lun = -1 } attach oscsi at dio diff --git a/sys/arch/hp300/dev/rd_root.c b/sys/arch/hp300/dev/rd_root.c new file mode 100644 index 00000000000..036f1f262bc --- /dev/null +++ b/sys/arch/hp300/dev/rd_root.c @@ -0,0 +1,80 @@ +/* $OpenBSD: rd_root.c,v 1.1 1997/02/16 10:42:20 downsj Exp $ */ +/* $NetBSD: rd_root.c,v 1.1 1996/05/20 01:17:31 chuck 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 +#include + +#include + +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; + } +} diff --git a/sys/arch/hp300/hp300/conf.c b/sys/arch/hp300/hp300/conf.c index 52d17b69d9a..9ae5b68d210 100644 --- a/sys/arch/hp300/hp300/conf.c +++ b/sys/arch/hp300/hp300/conf.c @@ -1,4 +1,4 @@ -/* $OpenBSD: conf.c,v 1.12 1997/02/03 08:12:00 downsj Exp $ */ +/* $OpenBSD: conf.c,v 1.13 1997/02/16 10:42:22 downsj Exp $ */ /* $NetBSD: conf.c,v 1.34 1996/12/17 08:41:20 thorpej Exp $ */ /*- @@ -59,6 +59,8 @@ bdev_decl(ccd); bdev_decl(vnd); #include "st.h" bdev_decl(st); +#include "rd.h" +bdev_decl(rd); struct bdevsw bdevsw[] = { @@ -70,12 +72,13 @@ struct bdevsw bdevsw[] = bdev_disk_init(NCCD,ccd), /* 5: concatenated disk driver */ bdev_disk_init(NVND,vnd), /* 6: vnode disk driver */ bdev_tape_init(NST,st), /* 7: SCSI tape */ - bdev_lkm_dummy(), /* 8 */ + bdev_disk_init(NRD,rd), /* 8: RAM disk */ bdev_lkm_dummy(), /* 9 */ bdev_lkm_dummy(), /* 10 */ bdev_lkm_dummy(), /* 11 */ bdev_lkm_dummy(), /* 12 */ bdev_lkm_dummy(), /* 13 */ + bdev_lkm_dummy(), /* 14 */ }; int nblkdev = sizeof(bdevsw) / sizeof(bdevsw[0]); @@ -139,6 +142,7 @@ cdev_decl(bpf); #include "tun.h" cdev_decl(tun); cdev_decl(random); +cdev_decl(rd); cdev_decl(ipl); #ifdef IPFILTER @@ -183,6 +187,7 @@ struct cdevsw cdevsw[] = cdev_lkm_dummy(), /* 31 */ cdev_random_init(1,random), /* 32: random generator */ cdev_gen_ipf(NIPF,ipl), /* 33: ip filtering */ + cdev_disk_init(NRD,rd), /* 34: RAM disk */ }; int nchrdev = sizeof(cdevsw) / sizeof(cdevsw[0]);