EDD: edd=skipmbr necessity fix
PATCH 1/1 EDD: edd=skipmbr necessity fix
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
Signature · 4 lines
Matt Domsch Software Architect Dell Linux Solutions linux.dell.com & www.dell.com/linux Linux on Dell mailing lists @ http://lists.us.dell.com
arch/i386/boot/edd.S +14 -1
@@ -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
include/linux/edd.h +2 -0
@@ -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