Add md (memory disk) hooks for pmax. ecoff kernel with 2MB ramdisk

tftp-boots on new PROMs. (3MB is too large).
This commit is contained in:
jonathan 1998-11-17 22:41:05 +00:00
parent 4d216414cf
commit fe83804dea
4 changed files with 102 additions and 8 deletions

View File

@ -1,4 +1,4 @@
# $NetBSD: files.pmax,v 1.56 1998/09/26 21:02:56 drochner Exp $
# $NetBSD: files.pmax,v 1.57 1998/11/17 22:41:05 jonathan Exp $
# DECstation-specific configuration info
# maxpartitions must be first item in files.${ARCH}.
@ -117,6 +117,10 @@ include "dev/scsipi/files.scsipi"
major { tz = 10 }
major { rz = 21 }
# Memory Disk
file arch/pmax/pmax/md_root.c memory_disk_hooks
major { md = 17 }
#
# Old 4.4bsd pmax-specific scsi driver (deprecated).
#

View File

@ -1,4 +1,4 @@
/* $NetBSD: autoconf.c,v 1.31 1998/03/26 03:12:05 thorpej Exp $ */
/* $NetBSD: autoconf.c,v 1.32 1998/11/17 22:41:06 jonathan Exp $ */
/*
* Copyright (c) 1988 University of Utah.
@ -43,7 +43,7 @@
*/
#include <sys/cdefs.h> /* RCS ID & Copyright macro defns */
__KERNEL_RCSID(0, "$NetBSD: autoconf.c,v 1.31 1998/03/26 03:12:05 thorpej Exp $");
__KERNEL_RCSID(0, "$NetBSD: autoconf.c,v 1.32 1998/11/17 22:41:06 jonathan Exp $");
/*
* Setup the system to run on the current machine.
@ -92,9 +92,7 @@ void findroot __P((struct device **, int *));
struct devnametobdevmaj pmax_nam2blk[] = {
{ "rz", 21 },
#ifdef notyet
{ "md", XXX },
#endif
{ "md", 17 },
{ NULL, 0 },
};

View File

@ -1,4 +1,4 @@
/* $NetBSD: conf.c,v 1.30 1998/11/13 04:47:08 oster Exp $ */
/* $NetBSD: conf.c,v 1.31 1998/11/17 22:41:05 jonathan Exp $ */
/*
* Copyright (c) 1992, 1993
@ -64,6 +64,8 @@ bdev_decl(ccd);
bdev_decl(raid);
#include "vnd.h"
bdev_decl(vnd);
#include "md.h"
bdev_decl(md);
struct bdevsw bdevsw[] =
{
@ -84,7 +86,7 @@ struct bdevsw bdevsw[] =
bdev_notdef(), /* 14: rl */
bdev_notdef(), /* 15: tmscp */
bdev_notdef(), /* 16: cs */
bdev_notdef(), /* 17: md */
bdev_disk_init(NMD,md), /* 17: memory disk driver */
bdev_tape_init(NST,st), /* 18: st */
bdev_disk_init(NSD,sd), /* 19: sd */
bdev_tape_init(NTZ, tz), /* 20: tz */
@ -136,6 +138,7 @@ cdev_decl(log);
cdev_decl(fd);
cdev_decl(sd);
cdev_decl(st);
cdev_decl(md);
#include "ss.h"
cdev_decl(ss);
#include "uk.h"
@ -295,6 +298,7 @@ struct cdevsw cdevsw[] =
cdev_lkm_init(NLKM,lkm), /* 94: loadable module driver */
cdev_scsibus_init(NSCSIBUS,scsibus), /* 95: SCSI bus */
cdev_disk_init(NRAID,raid), /* 96: RAIDframe disk driver */
cdev_disk_init(NMD,md), /* 97: memory disk driver */
};
int nchrdev = sizeof(cdevsw) / sizeof(cdevsw[0]);
@ -430,6 +434,7 @@ static int chrtoblktbl[] = {
/* 94 */ NODEV,
/* 95 */ NODEV,
/* 96 */ 32,
/* 97 */ 17,
};
/*

View File

@ -0,0 +1,87 @@
/* $NetBSD: md_root.c,v 1.1 1998/11/17 22:41:06 jonathan Exp $ */
/*
* Copyright (c) 1996 Christopher G. Demetriou. All rights reserved.
* 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/cdefs.h> /* RCS ID & Copyright macro defns */
__KERNEL_RCSID(0, "$NetBSD: md_root.c,v 1.1 1998/11/17 22:41:06 jonathan Exp $");
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/reboot.h>
#include <dev/md.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.
*/
u_int32_t md_root_size = ROOTBYTES;
char md_root_image[ROOTBYTES] = "|This is the root ramdisk!\n";
/*
* This is called during autoconfig.
*/
void
md_attach_hook(unit, md)
int unit;
struct md_conf *md;
{
if (unit == 0) {
/* Setup root ramdisk */
md->md_addr = (caddr_t)md_root_image;
md->md_size = (size_t)md_root_size;
md->md_type = MD_KMEM_FIXED;
printf("md%d: internal %dK image area\n", unit,
ROOTBYTES / 1024);
}
}
/*
* This is called during open (i.e. mountroot)
*/
void
md_open_hook(unit, md)
int unit;
struct md_conf *md;
{
if (unit == 0) {
/* The root ramdisk only works single-user. */
boothowto |= RB_SINGLE;
}
}