Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 6 Jan 2003 08:09:27 -0800 (PST)
From:      Peter Wemm <peter@FreeBSD.org>
To:        Perforce Change Reviews <perforce@freebsd.org>
Subject:   PERFORCE change 23273 for review
Message-ID:  <200301061609.h06G9R1I002765@repoman.freebsd.org>

next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=23273

Change 23273 by peter@peter_overcee on 2003/01/06 08:09:09

	IFC @23272
	*kick* trhodes

Affected files ...

.. //depot/projects/ia64/share/man/man5/Makefile#9 integrate
.. //depot/projects/ia64/sys/boot/pc98/boot2/bios.S#2 integrate
.. //depot/projects/ia64/sys/boot/pc98/boot2/boot.c#3 integrate
.. //depot/projects/ia64/sys/boot/pc98/boot2/disk.c#5 integrate
.. //depot/projects/ia64/sys/boot/pc98/boot2/sys.c#2 integrate
.. //depot/projects/ia64/sys/boot/pc98/libpc98/biosdisk.c#5 integrate
.. //depot/projects/ia64/sys/kern/kern_descrip.c#42 integrate
.. //depot/projects/ia64/sys/kern/vfs_syscalls.c#33 integrate
.. //depot/projects/ia64/sys/security/mac_lomac/mac_lomac.c#5 integrate

Differences ...

==== //depot/projects/ia64/share/man/man5/Makefile#9 (text+ko) ====

@@ -1,5 +1,5 @@
 #	@(#)Makefile	8.1 (Berkeley) 6/5/93
-#	$FreeBSD: src/share/man/man5/Makefile,v 1.45 2003/01/06 05:18:42 trhodes Exp $
+#	$FreeBSD: src/share/man/man5/Makefile,v 1.46 2003/01/06 15:30:55 trhodes Exp $
 
 #MISSING: dump.5 plot.5
 MAN=	a.out.5 acct.5 core.5 devfs.5 device.hints.5 \
@@ -16,7 +16,7 @@
 	services.5 shells.5 stab.5 sysctl.conf.5 utmp.5
 
 MLINKS= a.out.5 aout.5
-MLINKS=+dir.5 dirent.5
+MLINKS+=dir.5 dirent.5
 MLINKS+=fs.5 inode.5
 MLINKS+=hosts.equiv.5 rhosts.5
 MLINKS+=msdosfs.5 msdos.5

==== //depot/projects/ia64/sys/boot/pc98/boot2/bios.S#2 (text+ko) ====

@@ -24,7 +24,7 @@
  * the rights to redistribute these changes.
  *
  *	from: Mach, Revision 2.2  92/04/04  11:34:26  rpd
- * $FreeBSD: src/sys/boot/pc98/boot2/bios.S,v 1.3 2001/05/24 11:18:32 nyan Exp $
+ * $FreeBSD: src/sys/boot/pc98/boot2/bios.S,v 1.4 2003/01/06 13:43:13 nyan Exp $
  */
 
 /*
@@ -94,6 +94,26 @@
 #ifndef CDBOOT
 
 /*
+ *  PC-9801/PC-9821 SCSI MO booting
+ *    2002/06/05-07/03 Kawanobe Koh <kawanobe@st.rim.or.jp>
+ *
+ */
+scsi_hd:
+	.code16
+	push	%cx
+	push	%ds
+	mov	%bl, %cl		/* UA */
+	and	$0x0F, %cl
+	xor	%ax, %ax
+	mov	%ax, %ds
+	mov	(0x0482), %al		/* SCSI HD equipment bits */
+	shr	%cl, %al
+	pop	%ds
+	pop	%cx
+	test	$1, %al
+	ret
+
+/*
  * biosread(dev, cyl, head, sec, nsec, offset)
  *	Read "nsec" sectors from disk to offset "offset" in boot segment
  * BIOS call "INT 0x1B Function 0xn6" to read sectors from disk into memory
@@ -118,54 +138,58 @@
 	push	%esi
 	push	%edi
 
-	movb	0x14(%ebp), %dl		/* sector */
-	movb	0x10(%ebp), %dh		/* head */
-	movw	0x0c(%ebp), %cx		/* cylinder */
-	movb	0x08(%ebp), %al		/* DA/UA */
-	movb	$0x06, %ah
-	andb	$0xf0, %al
-	cmpb	$0x30, %al
-	jz	fd
-	cmpb	$0x90, %al
-	jnz	1f
-fd:
-	incb	%dl
-	movb	$0x02, %ch
-	movb	$0xd6, %ah
-1:
-	movb	0x08(%ebp), %al
-	movl	%eax, %ebx
+	mov	0x08(%ebp), %bl		/* (byte) DA/UA */
+	mov	0x0C(%ebp), %ecx	/* (word) cylinder */
+	mov	0x10(%ebp), %dh		/* (byte) head */
+	mov	0x14(%ebp), %dl		/* (byte) sector */
+	mov	0x18(%ebp), %esi	/* (byte) number of sectors */
+	mov	0x1C(%ebp), %edi	/* (word) destination offset */
 
 	/* prot_to_real will set %es to BOOTSEG */
 	call	EXT(prot_to_real)	/* enter real mode */
-	mov	%ebx, %eax
-	xor	%ebx, %ebx
-	addr32
-	movb	0x18(%ebp), %bl		/* number of sectors */
 	.code16
-	shl	$9, %ebx
-	push	%ebx
-	.code32
-	addr32
-	data32
-	mov	0x1c(%ebp), %ebx
-	.code16
-	mov	%ebx, %ebp
-	pop	%ebx
+	mov	$0x06, %bh		/* read data function */
+	mov	%bl, %al		/* DA */
+	and	$0xF0, %al
+	cmp	$0x30, %al		/* 1440KB FD */
+	jz	read_floppy
+	cmp	$0x90, %al		/* 1200KB FD */
+	jz	read_floppy
+	cmp	$0xA0, %al		/* SCSI HD or MO */
+	jnz	read_next
+	call	scsi_hd
+	jnz	read_next
+read_linear:
+	mov	%dh, %al		/* change to linear sector */
+	shl	$5, %al			/* multiply by 32 sector per track */
+	add	%dl, %al
+	xor	%dh, %dh		/* higher 16 bits into %dx */
+	mov	%ch, %dl
+	mov	%cl, %ch		/* lower 16 bits into %cx */
+	mov	%al, %cl
+	and	$0x7F, %bl		/* linear access DA/UA */
+	jmp	read_next
+read_floppy:
+	inc	%dx			/* sector address begins from one */
+	mov	$0x02, %ch		/* 512 bytes sector */
+	mov	$0xD6, %bh		/* MT MFM retry seek */
+read_next:
+	mov	%si, %ax		/* number of sectors */
+	shl	$9, %ax			/* multiply by 512 bytes */
+	xchg	%bx, %ax
+	mov	%di, %bp		/* destination offset */
+	int	$0x1B			/* disk bios call */
+	jc	read_end
+	xor	%ax, %ax
+read_end:
+	mov	%ax, %bx		/* save return value */
 
-	int	$0x1b
-	jc	1f
 	.code32
-	xor	%eax, %eax
-1:
-	/* save return value (actually movw %ax, %bx) */
-	mov	%eax, %ebx
-
 	data32
 	call	EXT(real_to_prot)	/* back to protected mode */
 
 	xor	%eax, %eax
-	movb	%bh, %al		/* return value in %ax */
+	mov	%bh, %al		/* return value in %eax */
 
 	pop	%edi
 	pop	%esi
@@ -360,46 +384,61 @@
 	push	%ebp
 	mov	%esp, %ebp
 	push	%ebx
-	push	%esi
-	push    %edi
+
+	mov	0x08(%ebp), %bl		/* (byte) DA/UA */
 
-	movb	0x8(%ebp), %dl		/* diskinfo(drive #) */
 	call	EXT(prot_to_real)	/* enter real mode */
 	.code16
+	mov	%bl, %al		/* DA */
+	and	$0xf0, %al
+	mov	$18, %dl		/* 1440KB FD sectors per track */
+	cmp	$0x30, %al
+	jz	floppy
+	mov	$15, %dl		/* 1200KB FD sectors per track */
+	cmp	$0x90, %al
+	jz	floppy
+	cmp	$0xA0, %al		/* SCSI HD or MO */
+	jnz	sense
+	call	scsi_hd
+	jnz	sense
 
-	movb	%dl, %al		/* ask for disk info */
-	andb	$0xf0, %al
-	cmpb	$0x30, %al
-	jz	fdd4
-	cmpb	$0x90, %al
-	jz	fdd
+	push	%ds			/* SCSI MO or CD ? */
+	xor	%ax, %ax
+	mov	%ax, %ds
+	and	$0x0F, %bx		/* UA */
+	shl	$2, %bx			/* parameter offset */
+	add	$0x0460, %bx
+	mov	(%bx), %al		/* SCSI equipment parameter[0] */
+	and	$0x1F, %al		/* peripheral device type */
+	cmp	$7, %al			/* SCSI MO */
+	jnz	good
+	add	$3, %bx
+	mov	(%bx), %al		/* SCSI equipment parameter[3] */
+	test	$0x30, %al		/* sector length from 256 to 2048 */
+	jnz	good
+	or	$0x10, %al		/* forced set 512 bytes sector */
+	mov	%al, (%bx)
+	mov	$0xA100, %dx		/* refered by C language */
+	mov	%dx, %ds
+	mov	%al, (%bx)
+good:
+	pop	%ds
 
-	movb	%dl, %al
-	movb	$0x84, %ah
-
+	mov	$0xFFFE, %cx		/* virtual 65535 cylinders setting */
+	mov	$0x0820, %dx		/* standard 8 heads and 32 sectors */
+	jmp	ok
+sense:
+	mov	$0x84, %ah		/* ask for disk info */
+	mov	%bl, %al
 	int	$0x1b
-
-	jnc	ok
+	jnc	ok			/* use %cx and %dx after */
 	/*
 	 * Urk.  Call failed.  It is not supported for floppies by old BIOS's.
 	 * Guess it's a 15-sector floppy.
 	 */
-fdd4:
-	movb	$18, %dl
-	jmp	1f
-fdd:
-	movb	$15, %dl		/* max sector */
-1:
-	subb	%ah, %ah		/* %ax = 0 */
-	movb	%al, %al
-	movb	%ah, %bh		/* %bh = 0 */
-	movb	$2, %bl			/* %bl	bits 0-3 = drive type,
-						bit    2 = 1.2M */
-	movb	$79, %ch		/* max track */
-	movb	$1, %cl			/* # floppy drives installed */
-	movb	$2, %dh			/* max head */
-	/* es:di = parameter table */
-	/* carry = 0 */
+floppy:
+	mov	$79, %cx		/* 80 cylinders 1200K and 1440K FD */
+	mov	$2, %dh			/* 2 heads as double side */
 ok:
 	.code32
 	data32
@@ -412,12 +451,9 @@
 	 *	 8 bit sector
 	 */
 	mov	%ecx, %eax
-	sall	$16,%eax		/* << 16 */
-	movb	%dh, %ah		/* max head */
-	movb	%dl, %al		/* max sector (and # sectors) */
+	sal	$16, %eax		/* max cylinder number from zero */
+	mov	%dx, %ax		/* number of heads and sectors */
 
-	pop	%edi
-	pop	%esi
 	pop	%ebx
 	pop	%ebp
 	ret

==== //depot/projects/ia64/sys/boot/pc98/boot2/boot.c#3 (text+ko) ====

@@ -24,7 +24,7 @@
  * the rights to redistribute these changes.
  *
  *	from: Mach, [92/04/03  16:51:14  rvb]
- * $FreeBSD: src/sys/boot/pc98/boot2/boot.c,v 1.9 2002/10/03 16:20:14 nyan Exp $
+ * $FreeBSD: src/sys/boot/pc98/boot2/boot.c,v 1.10 2003/01/06 13:43:13 nyan Exp $
  */
 
 
@@ -118,11 +118,16 @@
 	dosdev = drive;
 #ifdef PC98
 	maj = (drive&0x70) >> 3;		/* a good first bet */
-	if (maj == 4) {		/* sd */
+	if (maj == 4) {	/* da */
 		disk_equips = *(unsigned char *)V(0xA1482);
 		unit = 0;
 		for (i=0; i<(drive&0x0f); i++) {
-			unit += (disk_equips >> i) & 1;
+			int media = ((unsigned *)V(0xA1460))[i] & 0x1F;
+
+			if ((disk_equips >> i) & 1)	/* HD */
+				unit++;
+			else if (media == 7)		/* MO */
+				unit++;
 		}
 	} else {
 		unit = drive & 0x0f;

==== //depot/projects/ia64/sys/boot/pc98/boot2/disk.c#5 (text+ko) ====

@@ -24,7 +24,7 @@
  * the rights to redistribute these changes.
  *
  *	from: Mach, Revision 2.2  92/04/04  11:35:49  rpd
- * $FreeBSD: src/sys/boot/pc98/boot2/disk.c,v 1.7 2003/01/04 08:50:48 nyan Exp $
+ * $FreeBSD: src/sys/boot/pc98/boot2/disk.c,v 1.8 2003/01/06 13:43:13 nyan Exp $
  */
 
 /*
@@ -129,17 +129,6 @@
 			printf("bad disklabel\n");
 			return 1;
 		}
-		if( (maj == 4) || (maj == 0) || (maj == 1))
-		{
-			if (dl->d_type == DTYPE_SCSI)
-			{
-				maj = 4; /* use scsi as boot dev */
-			}
-			else
-			{
-				maj = 0; /* must be ESDI/IDE */
-			}
-		}
 		/* This little trick is for OnTrack DiskManager disks */
 		boff = dl->d_partitions[part].p_offset -
 			dl->d_partitions[2].p_offset + sector;

==== //depot/projects/ia64/sys/boot/pc98/boot2/sys.c#2 (text+ko) ====

@@ -24,7 +24,7 @@
  * the rights to redistribute these changes.
  *
  *	from: Mach, Revision 2.2  92/04/04  11:36:34  rpd
- * $FreeBSD: src/sys/boot/pc98/boot2/sys.c,v 1.2 1999/08/28 00:40:26 peter Exp $
+ * $FreeBSD: src/sys/boot/pc98/boot2/sys.c,v 1.3 2003/01/06 13:43:14 nyan Exp $
  */
 
 /*
@@ -275,8 +275,8 @@
 	switch(maj)
 	{
 #ifdef PC98
-	case 4: /* sd */
-		dosdev_copy = biosdrive | 0xa0;
+	case 4:	/* da */
+		dosdev_copy = biosdrive | 0xA0; /* SCSI HD or MO */
 #else	/* IBM-PC */
 	case 0:
 	case 4:
@@ -284,8 +284,8 @@
 #endif
 		break;
 #ifdef PC98
-	case 0:
-	case 2:
+	case 0:	/* wd */
+	case 2:	/* 1200KB fd */
 		dosdev_copy = (maj << 3) | unit | 0x80;
 #else
 	case 2:
@@ -293,7 +293,7 @@
 #endif
 		break;
 #ifdef PC98
-	case 6:/* 1.44MB FD */
+	case 6:	/* 1440KB fd */
 		dosdev_copy = (maj << 3) | unit;
 		break;
 #endif

==== //depot/projects/ia64/sys/boot/pc98/libpc98/biosdisk.c#5 (text+ko) ====

@@ -23,7 +23,7 @@
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  *
- * $FreeBSD: src/sys/boot/pc98/libpc98/biosdisk.c,v 1.20 2003/01/04 08:50:48 nyan Exp $
+ * $FreeBSD: src/sys/boot/pc98/libpc98/biosdisk.c,v 1.21 2003/01/06 13:43:15 nyan Exp $
  */
 
 /*
@@ -81,6 +81,9 @@
 #define BD_FLOPPY		0x0004
 #define BD_LABELOK		0x0008
 #define BD_PARTTABOK		0x0010
+#ifdef PC98
+#define BD_OPTICAL		0x0020
+#endif
     struct disklabel		od_disklabel;
     int				od_nslices;	/* slice count */
     struct pc98_partition	od_slicetab[MAX_SLICES];
@@ -198,7 +201,7 @@
 		}
 	    }
 	    else {
-		if ((unit & 0xa0) == 0xa0)
+		if ((unit & 0xF0) == 0xA0)	/* SCSI HD or MO */
 		    bdinfo[nbdinfo].bd_da_unit = da_drive++;
 	    }
 	    /* XXX we need "disk aliases" to make this simpler */
@@ -257,6 +260,14 @@
 	bd->bd_flags |= BD_MODEINT13;
 	return(1);
     }
+    if ((bd->bd_unit & 0xF0) == 0xA0) {
+	int media = ((unsigned *)PTOV(0xA1460))[bd->bd_unit & 0x0F] & 0x1F;
+
+	if (media == 7) { /* MO */
+	    bd->bd_flags |= BD_MODEINT13 | BD_OPTICAL;
+	    return(1);
+	}
+    }
     return(0);
 #else
     v86.ctl = V86_FLAGS;
@@ -1081,7 +1092,13 @@
 	        v86.eax = 0x0600 | od->od_unit;
 		v86.ecx = cyl;
 	    }
-	    v86.edx = (hd << 8) | sec;
+	    if (od->od_flags & BD_OPTICAL) {
+		v86.eax &= 0xFF7F;
+		v86.ecx = dblk & 0xFFFF;
+		v86.edx = dblk >> 16;
+	    } else {
+	    	v86.edx = (hd << 8) | sec;
+	    }
 	    v86.ebx = x * BIOSDISK_SECSIZE;
 	    v86.es = VTOPSEG(xp);
 	    v86.ebp = VTOPOFF(xp);
@@ -1362,6 +1379,10 @@
 	od->od_cyl = 79;
 	od->od_hds = 2;
 	od->od_sec = (od->od_unit & 0xf0) == 0x30 ? 18 : 15;
+    } else if (od->od_flags & BD_OPTICAL) {
+	od->od_cyl = 0xFFFE;
+	od->od_hds = 8;
+	od->od_sec = 32;
     } else {
 	v86.ctl = V86_FLAGS;
 	v86.addr = 0x1b;
@@ -1423,19 +1444,26 @@
 	if (*(u_char *)PTOV(addr) & (1 << (unit & 0x0f)))
 	    if (hds++ == bunit)
 		break;
+
+	if (unit >= 0xA0) {
+	    int  media = ((unsigned *)PTOV(0xA1460))[unit & 0x0F] & 0x1F;
+
+	    if (media == 7 && hds++ == bunit)	/* SCSI MO */
+		return(0xFFFE0820); /* C:65535 H:8 S:32 */
+	}
 	if (++unit == 0x84) {
-	    unit = 0xa0;	/* SCSI HDD */
+	    unit = 0xA0;	/* SCSI HDD */
 	    addr = 0xA1482;
 	}
     }
     if (unit == 0xa7)
-	return 0x4f010f;
+	return 0x4F020F;	/* 1200KB FD C:80 H:2 S:15 */
     v86.ctl = V86_FLAGS;
     v86.addr = 0x1b;
     v86.eax = 0x8400 | unit;
     v86int();
     if (v86.efl & 0x1)
-	return 0x4f010f;
+	return 0x4F020F;	/* 1200KB FD C:80 H:2 S:15 */
     return ((v86.ecx & 0xffff) << 16) | (v86.edx & 0xffff);
 #else
     v86.ctl = V86_FLAGS;

==== //depot/projects/ia64/sys/kern/kern_descrip.c#42 (text+ko) ====

@@ -36,7 +36,7 @@
  * SUCH DAMAGE.
  *
  *	@(#)kern_descrip.c	8.6 (Berkeley) 4/19/94
- * $FreeBSD: src/sys/kern/kern_descrip.c,v 1.177 2003/01/01 01:19:31 alfred Exp $
+ * $FreeBSD: src/sys/kern/kern_descrip.c,v 1.178 2003/01/06 13:19:05 nectar Exp $
  */
 
 #include "opt_compat.h"
@@ -483,6 +483,7 @@
 		error = fdalloc(td, new, &newfd);
 		if (error) {
 			FILEDESC_UNLOCK(fdp);
+			fdrop(fp, td);
 			return (error);
 		}
 	}

==== //depot/projects/ia64/sys/kern/vfs_syscalls.c#33 (text+ko) ====

@@ -36,7 +36,7 @@
  * SUCH DAMAGE.
  *
  *	@(#)vfs_syscalls.c	8.13 (Berkeley) 4/15/94
- * $FreeBSD: src/sys/kern/vfs_syscalls.c,v 1.302 2002/12/14 08:18:06 alfred Exp $
+ * $FreeBSD: src/sys/kern/vfs_syscalls.c,v 1.303 2003/01/06 13:19:05 nectar Exp $
  */
 
 /* For 4.3 integer FS ID compatibility */
@@ -1326,8 +1326,10 @@
 	case L_INCR:
 		if (noneg &&
 		    (fp->f_offset < 0 ||
-		     (offset > 0 && fp->f_offset > OFF_MAX - offset)))
-			return (EOVERFLOW);
+		    (offset > 0 && fp->f_offset > OFF_MAX - offset))) {
+			error = EOVERFLOW;
+			break;
+		}
 		offset += fp->f_offset;
 		break;
 	case L_XTND:
@@ -1335,21 +1337,26 @@
 		error = VOP_GETATTR(vp, &vattr, cred, td);
 		VOP_UNLOCK(vp, 0, td);
 		if (error)
-			return (error);
+			break;
 		if (noneg &&
 		    (vattr.va_size > OFF_MAX ||
-		     (offset > 0 && vattr.va_size > OFF_MAX - offset)))
-			return (EOVERFLOW);
+		    (offset > 0 && vattr.va_size > OFF_MAX - offset))) {
+			error = EOVERFLOW;
+			break;
+		}
 		offset += vattr.va_size;
 		break;
 	case L_SET:
 		break;
 	default:
+		error = EINVAL;
+	}
+	if (error == 0 && noneg && offset < 0)
+		error = EINVAL;
+	if (error != 0) {
 		fdrop(fp, td);
-		return (EINVAL);
+		return (error);
 	}
-	if (noneg && offset < 0)
-		return (EINVAL);
 	fp->f_offset = offset;
 	*(off_t *)(td->td_retval) = fp->f_offset;
 	fdrop(fp, td);

==== //depot/projects/ia64/sys/security/mac_lomac/mac_lomac.c#5 (text+ko) ====

@@ -31,7 +31,7 @@
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  *
- * $FreeBSD: src/sys/security/mac_lomac/mac_lomac.c,v 1.6 2002/12/10 16:20:33 rwatson Exp $
+ * $FreeBSD: src/sys/security/mac_lomac/mac_lomac.c,v 1.7 2003/01/06 12:07:38 mux Exp $
  */
 
 /*
@@ -1057,8 +1057,7 @@
     struct vnode *vp, struct label *vlabel)
 {
 	struct mac_lomac temp, *source, *dest;
-	size_t buflen;
-	int error;
+	int buflen, error;
 
 	source = SLOT(fslabel);
 	dest = SLOT(vlabel);

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe p4-projects" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200301061609.h06G9R1I002765>