Date: Mon, 30 Jul 2001 18:03:39 -0700 (PDT) From: Matthew Jacob <mjacob@feral.com> To: <alpha@FreeBSD.ORG> Subject: MFC'ing cdrom/floppy changes? Message-ID: <20010730180224.P57563-100000@wonky.feral.com>
index | next in thread | raw e-mail
All I could actually chase down were 3 file changes- does anyone have any
objection to having this committed and us doing testing over the next 2-3
weeks?
Index: alpha/cdboot/Makefile
===================================================================
RCS file: /home/ncvs/src/sys/boot/alpha/cdboot/Makefile,v
retrieving revision 1.3.2.1
diff -u -r1.3.2.1 Makefile
--- alpha/cdboot/Makefile 2000/11/27 02:16:39 1.3.2.1
+++ alpha/cdboot/Makefile 2001/07/31 00:42:55
@@ -1,12 +1,11 @@
-# $FreeBSD: src/sys/boot/alpha/cdboot/Makefile,v 1.3.2.1 2000/11/27 02:16:39 obrien Exp $
+# $FreeBSD: src/sys/boot/alpha/cdboot/Makefile,v 1.5 2001/04/07 23:52:31 gallatin Exp $
-BINDIR= /boot
BASE= cdboot
PROG= ${BASE}
NOMAN=
-STRIP=
+NEWVERSWHAT= "SRM CD9660 boot" alpha
+LOAD_ADDRESS= ${PRIMARY_LOAD_ADDRESS}
-${BASE}: ${BASE}-4.0R.gz.uu
- uudecode -p ${.CURDIR}/${BASE}-4.0R.gz.uu | gunzip > ${BASE}
+CFLAGS+= -DLOADER_CDROM_SUPPORT
-.include <bsd.prog.mk>
+.include <${.CURDIR}/../common/Makefile.common>
Index: alpha/libalpha/srmdisk.c
===================================================================
RCS file: /home/ncvs/src/sys/boot/alpha/libalpha/srmdisk.c,v
retrieving revision 1.8.2.1
diff -u -r1.8.2.1 srmdisk.c
--- alpha/libalpha/srmdisk.c 2000/03/16 18:13:25 1.8.2.1
+++ alpha/libalpha/srmdisk.c 2001/07/31 00:49:10
@@ -96,6 +96,8 @@
int bd_unit; /* SRM unit number */
int bd_namelen;
int bd_flags;
+ int bd_fd;
+ int bd_opencount;
} bdinfo [MAXBDDEV];
static int nbdinfo = 0;
@@ -113,6 +115,8 @@
ret.bits = prom_getenv(PROM_E_BOOTED_DEV,
bdinfo[0].bd_name, sizeof(bdinfo[0].bd_name));
bdinfo[0].bd_namelen = ret.u.retval;
+ bdinfo[0].bd_fd = -1;
+ bdinfo[0].bd_opencount = 0;
nbdinfo++;
return (0);
@@ -155,7 +159,7 @@
struct disklabel *lp;
int sector, slice, i;
int error;
- int unit;
+ int unit, fd;
prom_return_t ret;
va_start(args, f);
@@ -169,11 +173,17 @@
}
/* Call the prom to open the disk. */
- ret.bits = prom_open(bdinfo[unit].bd_name, bdinfo[unit].bd_namelen);
- if (ret.u.status == 2)
- return (ENXIO);
- if (ret.u.status == 3)
- return (EIO);
+ if (bdinfo[unit].bd_fd < 0) {
+ ret.bits = prom_open(bdinfo[unit].bd_name, bdinfo[unit].bd_namelen);
+ if (ret.u.status == 2)
+ return (ENXIO);
+ if (ret.u.status == 3)
+ return (EIO);
+ bdinfo[unit].bd_fd = fd = ret.u.retval;
+ } else {
+ fd = bdinfo[unit].bd_fd;
+ }
+ bdinfo[unit].bd_opencount++;
od = (struct open_disk *) malloc(sizeof(struct open_disk));
if (!od) {
@@ -182,7 +192,7 @@
}
/* Look up SRM unit number, intialise open_disk structure */
- od->od_fd = ret.u.retval;
+ od->od_fd = fd;
od->od_unit = dev->d_kind.srmdisk.unit;
od->od_flags = bdinfo[od->od_unit].bd_flags;
od->od_boff = 0;
@@ -321,7 +331,11 @@
{
struct open_disk *od = f->f_devdata;
- (void)prom_close(od->od_fd);
+ bdinfo[od->od_unit].bd_opencount--;
+ if (bdinfo[od->od_unit].bd_opencount == 0) {
+ (void)prom_close(od->od_fd);
+ bdinfo[od->od_unit].bd_fd = -1;
+ }
free(od);
f->f_devdata = NULL;
To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-alpha" in the body of the message
home |
help
Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20010730180224.P57563-100000>
