Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch/newsmips/stand Add ustarfs support and changedisk_h...
details: https://anonhg.NetBSD.org/src/rev/a534c6851f0e
branches: trunk
changeset: 525576:a534c6851f0e
user: tsutsui <tsutsui%NetBSD.org@localhost>
date: Sat Apr 13 08:04:41 2002 +0000
description:
Add ustarfs support and changedisk_hook().
diffstat:
sys/arch/newsmips/stand/boot/Makefile | 3 +-
sys/arch/newsmips/stand/boot/devopen.c | 73 ++++++++++++++++++++++++--------
sys/arch/newsmips/stand/boot/promdev.h | 1 +
sys/arch/newsmips/stand/common/Makefile | 3 +-
4 files changed, 60 insertions(+), 20 deletions(-)
diffs (176 lines):
diff -r 1a22dd1f2531 -r a534c6851f0e sys/arch/newsmips/stand/boot/Makefile
--- a/sys/arch/newsmips/stand/boot/Makefile Sat Apr 13 07:56:02 2002 +0000
+++ b/sys/arch/newsmips/stand/boot/Makefile Sat Apr 13 08:04:41 2002 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.12 2002/04/13 02:29:08 tsutsui Exp $
+# $NetBSD: Makefile,v 1.13 2002/04/13 08:04:41 tsutsui Exp $
S= ${.CURDIR}/../../../..
@@ -20,6 +20,7 @@
LDFLAGS= -x -N -Ttext a0700000 -e _start
CFLAGS= -Os -mmemcpy -mno-abicalls -G 0 -Wall
+CPPFLAGS+= -DSUPPORT_USTARFS -DHAVE_CHANGEDISK_HOOK
CPPFLAGS+= -DSUN_BOOTPARAMS
CPPFLAGS+= -D_STANDALONE #-DBOOT_DEBUG
CPPFLAGS+= -I${.CURDIR} -I${COMMON} -I${S}
diff -r 1a22dd1f2531 -r a534c6851f0e sys/arch/newsmips/stand/boot/devopen.c
--- a/sys/arch/newsmips/stand/boot/devopen.c Sat Apr 13 07:56:02 2002 +0000
+++ b/sys/arch/newsmips/stand/boot/devopen.c Sat Apr 13 08:04:41 2002 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: devopen.c,v 1.2 1999/12/22 05:54:41 tsubai Exp $ */
+/* $NetBSD: devopen.c,v 1.3 2002/04/13 08:04:41 tsutsui Exp $ */
/*-
* Copyright (C) 1999 Tsubai Masanari. All rights reserved.
@@ -29,6 +29,7 @@
#include <lib/libkern/libkern.h>
#include <lib/libsa/stand.h>
#include <lib/libsa/ufs.h>
+#include <lib/libsa/ustarfs.h>
#include <netinet/in.h>
#include <lib/libsa/nfs.h>
@@ -51,14 +52,22 @@
};
int ndevs = sizeof(devsw) / sizeof(devsw[0]);
-struct fs_ops file_system_ufs[] = {
- { ufs_open, ufs_close, ufs_read, ufs_write, ufs_seek, ufs_stat }
+struct fs_ops file_system_ufs = {
+ ufs_open, ufs_close, ufs_read, ufs_write, ufs_seek, ufs_stat
+};
+struct fs_ops file_system_nfs = {
+ nfs_open, nfs_close, nfs_read, nfs_write, nfs_seek, nfs_stat
};
-struct fs_ops file_system_nfs[] = {
- { nfs_open, nfs_close, nfs_read, nfs_write, nfs_seek, nfs_stat },
+#ifdef SUPPORT_USTARFS
+struct fs_ops file_system_ustarfs = {
+ ustarfs_open, ustarfs_close, ustarfs_read, ustarfs_write,
+ ustarfs_seek, ustarfs_stat
};
+struct fs_ops file_system[2];
+#else
struct fs_ops file_system[1];
-int nfsys = sizeof(file_system) / sizeof(file_system[0]);
+#endif
+int nfsys;
struct romdev romdev;
@@ -71,26 +80,25 @@
char **file; /* out */
{
int fd;
- char devname[32];
char *cp;
int error = 0;
DPRINTF("devopen: %s\n", fname);
- strcpy(devname, fname);
- cp = strchr(devname, ')') + 1;
+ strcpy(romdev.devname, fname);
+ cp = strchr(romdev.devname, ')') + 1;
*cp = 0;
if (apbus)
- fd = apcall_open(devname, 2);
+ fd = apcall_open(romdev.devname, 2);
else
- fd = rom_open(devname, 2);
+ fd = rom_open(romdev.devname, 2);
- DPRINTF("devname = %s, fd = %d\n", devname, fd);
+ DPRINTF("devname = %s, fd = %d\n", romdev.devname, fd);
if (fd == -1)
return -1;
romdev.fd = fd;
- if (strncmp(devname, "sonic", 5) == 0)
+ if (strncmp(romdev.devname, "sonic", 5) == 0)
romdev.devtype = DT_NET;
else
romdev.devtype = DT_BLOCK;
@@ -99,14 +107,21 @@
f->f_devdata = &romdev;
*file = strchr(fname, ')') + 1;
- if (romdev.devtype == DT_BLOCK)
- bcopy(file_system_ufs, file_system, sizeof(file_system));
- else { /* DT_NET */
- bcopy(file_system_nfs, file_system, sizeof(file_system));
+ if (romdev.devtype == DT_BLOCK) {
+ file_system[0] = file_system_ufs;
+#ifdef SUPPORT_USTARFS
+ file_system[1] = file_system_ustarfs;
+ nfsys = 2;
+#else
+ nfsys = 1;
+#endif
+ } else { /* DT_NET */
+ file_system[0] = file_system_nfs;
+ nfsys = 1;
if ((error = net_open(&romdev)) != 0) {
printf("Can't open NFS network connection on `%s'\n",
- devname);
+ romdev.devname);
return error;
}
}
@@ -159,3 +174,25 @@
*rsize = size; /* XXX */
return 0;
}
+
+#ifdef HAVE_CHANGEDISK_HOOK
+void
+changedisk_hook(f)
+ struct open_file *f;
+{
+ struct romdev *dev = f->f_devdata;
+
+ if (apbus) {
+ apcall_ioctl(dev->fd, APIOCEJECT, NULL);
+ apcall_close(dev->fd);
+ getchar();
+ dev->fd = apcall_open(dev->devname, 2);
+ } else {
+ rom_ioctl(dev->fd, SYSIOCEJECT, NULL);
+ rom_close(dev->fd);
+ getchar();
+ dev->fd = rom_open(dev->devname, 2);
+ }
+
+}
+#endif
diff -r 1a22dd1f2531 -r a534c6851f0e sys/arch/newsmips/stand/boot/promdev.h
--- a/sys/arch/newsmips/stand/boot/promdev.h Sat Apr 13 07:56:02 2002 +0000
+++ b/sys/arch/newsmips/stand/boot/promdev.h Sat Apr 13 08:04:41 2002 +0000
@@ -1,6 +1,7 @@
struct romdev {
int fd;
int devtype;
+ char devname[32];
};
#define DT_BLOCK 1
diff -r 1a22dd1f2531 -r a534c6851f0e sys/arch/newsmips/stand/common/Makefile
--- a/sys/arch/newsmips/stand/common/Makefile Sat Apr 13 07:56:02 2002 +0000
+++ b/sys/arch/newsmips/stand/common/Makefile Sat Apr 13 08:04:41 2002 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.3 2002/04/13 02:30:30 tsutsui Exp $
+# $NetBSD: Makefile,v 1.4 2002/04/13 08:04:42 tsutsui Exp $
S= ${.CURDIR}/../../../..
@@ -7,6 +7,7 @@
CFLAGS= -Os -mmemcpy -mno-abicalls -G 0 -Wall
CPPFLAGS+= -D_STANDALONE #-DBOOT_DEBUG
+CPPFLAGS+= -DHAVE_CHANGEDISK_HOOK
CPPFLAGS+= -DLIBSA_USE_MEMSET -DLIBSA_USE_MEMCPY
CPPFLAGS+= -I. -I${S}
Home |
Main Index |
Thread Index |
Old Index