Subject: Re: 1.4-beta + adaptec 2940 (was 1.4-beta + syjet)
To: None <port-i386@netbsd.org>
From: Christos Zoulas <christos@zoulas.com>
List: port-i386
Date: 04/29/1999 08:55:38
In article <4.1.19990428213046.00a146f0@pop.iquest.net> russ@iquest.net (Russ Walker) writes:
>Hello again!
>
>Well, nothing like sending an email to millions of people to make you
>realize you asked the wrong question.
>
>I put a fixed hd in the machine, same results. I was also mistaken about
>the 'Support Removable Disks Under BIOS as Fixed Disks' setting.  (Need to
>take better notes when fiddling with settings...) It was disabling the
>'Host Adapter BIOS' that let me do the install, but _of course_ it ain't
>gonna boot that way.
>
>When booting from the install floppies, I get this output:
>
>1544192+1695744+143148+[86484
>Please remove disk 1, insert disk 2, and type return...
>+102251]=0x36806f
>
>and that's it.  Nothing else.  Is the 2940 no longer supported?
>
>Still fiddling, and looking for ideas...

We have patches for the faulty bios on the 2940... I had the same problem
a week ago. They are going to be committed and pulled up shortly. Here's
a preview:
Index: lib/biosdisk_ll.c
===================================================================
RCS file: /cvsroot/src/sys/arch/i386/stand/lib/biosdisk_ll.c,v
retrieving revision 1.7
diff -u -r1.7 biosdisk_ll.c
--- biosdisk_ll.c	1999/03/30 17:55:49	1.7
+++ biosdisk_ll.c	1999/04/26 15:29:47
@@ -67,6 +67,8 @@
 #define BIOSDISK_RETRIES 5
 #endif
 
+#define MAXCHSSEC	(1024 * 255 * 63)
+
 int 
 set_geometry(d, ed)
 	struct biosdisk_ll *d;
@@ -119,7 +121,7 @@
 		int64_t	sec;
 	}		ext;
 
-	if (d->flags & BIOSDISK_EXT13) {
+	if ((d->flags & BIOSDISK_EXT13) && dblk > MAXCHSSEC) {
 		ext.size = sizeof(ext);
 		ext.resvd = 0;
 		ext.cnt = num;
Index: lib/crt/bootsect/start_bootsect.S
===================================================================
RCS file: /cvsroot/src/sys/arch/i386/stand/lib/crt/bootsect/start_bootsect.S,v
retrieving revision 1.12
diff -u -r1.12 start_bootsect.S
--- start_bootsect.S	1999/04/01 19:36:09	1.12
+++ start_bootsect.S	1999/04/26 15:29:52
@@ -78,6 +78,8 @@
 #endif
 BOOTABLE		=	0x80	# value of dp_flag, means bootable partition
 
+#define MAXSECT		(1024 * 255 * 63)
+
 	.text
 _C_LABEL(boot1):
 ENTRY(start)
@@ -219,6 +221,7 @@
 	data32
 	movl	$0xaa55, %edi
 	cmpl	%edi, %eax
+	data32
 	jnz	tradint13
 	testb	$1, %cl
 	data32
@@ -238,11 +241,21 @@
 
 	pushl	%ss
 	popl	%ds
-	data32
-	pushl	$0		/* high 4 bytes of sector = 0 */
+/*
+ * Avoid using the extended calls if we can address the sector with regular
+ * calls since some bios'es don't support everything.
+ */
 	data32
 	addr32
 	movl	%es:8(%ebx), %eax	/* low 4 bytes of sector */
+	addr32
+	data32
+	cmpl 	$MAXSECT, %eax
+	data32
+	jle	tradint13
+
+	data32
+	pushl	$0		/* high 4 bytes of sector = 0 */
 	data32
 	pushl	%eax
 	movl	%es, %ax
Index: mbr/mbr.S
===================================================================
RCS file: /cvsroot/src/sbin/fdisk/mbr/mbr.S,v
retrieving revision 1.3
diff -u -r1.3 mbr.S
--- mbr.S	1999/02/08 21:52:43	1.3
+++ mbr.S	1999/04/26 15:25:42
@@ -40,6 +40,7 @@
 #define	data32	.byte 0x66
 
 #define	BOOTADDR	0x7c00
+#define MAXSECT		(1024 * 255 * 63)
 
 	.text
 /*
@@ -122,7 +123,14 @@
 	jnz	noext
 	testb	$1, %cl
 	jz	noext
-
+/*
+ * Avoid using the extended calls if we can address the sector with regular
+ * calls since some bios'es don't support everything.
+ */
+	addr32
+	data32
+	cmpl 	$MAXSECT, 8(%esi)
+	jle	noext
 /*
  * Modify the partition table entry to look like an int13-extension
  * parameter block.
Index: mbr_bootsel/mbr_bootsel.S
===================================================================
RCS file: /cvsroot/src/sbin/fdisk/mbr_bootsel/mbr_bootsel.S,v
retrieving revision 1.2
diff -u -r1.2 mbr_bootsel.S
--- mbr_bootsel.S	1999/04/17 01:38:00	1.2
+++ mbr_bootsel.S	1999/04/26 15:25:43
@@ -74,7 +74,8 @@
 
 #include <machine/asm.h>
 
-#define data32  .byte 0x66
+#define	addr32	.byte 0x67
+#define	data32  .byte 0x66
 
 /*
  * Gas can't emit 16 bit code. Define each instruction that we need where
@@ -195,6 +196,11 @@
 #define MAXDRV		0x88
 
 /*
+ * Maximum sector we can address as c/h/s
+ */
+#define MAXSECT		(1024 * 255 * 63)
+
+/*
  * Error codes. Done this way to save space.
  */
 #define ERR_INVPART	'1'		/* Invalid partition table */
@@ -225,12 +231,9 @@
  */
 1:
 	cmpb $MINDRV,%dl
-	jb 2f
+	jb bootsel
 	cmpb $MAXDRV,%dl
-	jbe 3f
-2:
-	movb $0x80,%dl
-3:
+	jl bootsel
 	movb_reg_mem(DL,drvno)
 bootsel:
 	movb_mem_al(flags)
@@ -380,7 +383,14 @@
 	jnz	noext
 	testb	$1, %cl
 	jz	noext
-
+/*
+ * Avoid using the extended calls if we can address the sector with regular
+ * calls since some bios'es don't support everything.
+ */
+	addr32
+	data32
+	cmpl 	$MAXSECT, 8(%esi)
+	jle	noext
 /*
  * Modify the partition table entry to look like an int13-extension
  * parameter block, so we can feed it to the extended read call.
@@ -406,7 +416,6 @@
 errhang:
 	movw_imm_reg(err,SI)
 	call16(putasciz)
-	call16(putc)
 hang:
 	sti
 	jmp 	hang
@@ -419,15 +428,14 @@
 	lodsb
 	testb	%al, %al
 	jz	2f
-	call16(putc)
-	jmp	1b
-2:
-	pop	%eax
-	ret
-putc:
+
 	movb	$0xe, %ah
 	movb	$7, %bl
 	int	$0x10
+
+	jmp	1b
+2:
+	pop	%eax
 	ret
 
 /*
@@ -467,9 +475,9 @@
 newline:
 	.asciz	"\r\n"
 prefix:
-	.asciz	"F1: "
+	.asciz	"F1:"
 err:
-	.asciz	"Err "
+	.asciz	"Err"
 /*
  * Fake partition entry used to boot from other disks. First byte is
  * overloaded, it's also used as storage for the drive number. We're