[RFT][PATCH 2.6.13-rc] EDD: edd=skipmbr necessity fix

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a request for testers, specifically people whose i386 or
x86_64 systems won't boot properly if CONFIG_EDD=[ym] without the use
of edd=skipmbr.  If you're currently using edd=skipmbr, I'd really
appreciate knowing about it, and your results of booting with this
patch.

This patch uses an int13 Get Disk Type call before using a Read
Sectors call to read the MBR.  If Get Disk Type fails, this is a good
indication that the BIOS doesn't believe there's a disk there, without
actually trying to do I/O to the disk.

arch/i386/boot/edd.S |   15 ++++++++++++++-
 include/linux/edd.h  |    2 ++
 2 files changed, 16 insertions, 1 deletion

Signed-off-by: Matt Domsch <[email protected]>

Thanks,
Matt

-- 
Matt Domsch
Software Architect
Dell Linux Solutions linux.dell.com & www.dell.com/linux
Linux on Dell mailing lists @ http://lists.us.dell.com

diff --git a/arch/i386/boot/edd.S b/arch/i386/boot/edd.S
--- a/arch/i386/boot/edd.S
+++ b/arch/i386/boot/edd.S
@@ -55,6 +55,19 @@ done_cl:
 # Read the first sector of each BIOS disk device and store the 4-byte signature
 edd_mbr_sig_start:
 	movb	$0x80, %dl			# from device 80
+edd_get_disk_type:
+	movw	$GET_DISK_TYPE, %ax
+	pushw	%cx				# this clobbers cx and dx
+	pushw	%dx				# 
+	stc					# work around buggy BIOSes
+	int	$0x13
+	sti					# work around buggy BIOSes
+	popw	%dx
+	popw	%cx
+	jc	edd_mbr_sig_done
+	cmpb	$GET_DISK_TYPE_DISK, %ah	# is this a disk?
+	jne	edd_mbr_sig_done
+
 	movw	$EDD_MBR_SIG_BUF, %bx		# store buffer ptr in bx
 edd_mbr_sig_read:
 	movl	$0xFFFFFFFF, %eax
@@ -82,7 +95,7 @@ edd_mbr_sig_read:
 	incb	%dl				# increment to next device
 	addw	$4, %bx				# increment sig buffer ptr
 	cmpb	$EDD_MBR_SIG_MAX, (EDD_MBR_SIG_NR_BUF)	# Out of space?
-	jb	edd_mbr_sig_read		# keep looping
+	jb	edd_get_disk_type		# keep looping
 edd_mbr_sig_done:
 
 # Do the BIOS Enhanced Disk Drive calls
diff --git a/include/linux/edd.h b/include/linux/edd.h
--- a/include/linux/edd.h
+++ b/include/linux/edd.h
@@ -39,6 +39,8 @@
 #define CHECKEXTENSIONSPRESENT 0x41
 #define GETDEVICEPARAMETERS 0x48
 #define LEGACYGETDEVICEPARAMETERS 0x08
+#define GET_DISK_TYPE 0x1500
+#define GET_DISK_TYPE_DISK 0x03
 #define EDDMAGIC1 0x55AA
 #define EDDMAGIC2 0xAA55
 
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]
  Powered by Linux