mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Matt Domsch <Matt_Domsch@dell.com>
To: linux-kernel@vger.kernel.org
Subject: [RFT][PATCH 2.6.13-rc] EDD: edd=skipmbr necessity fix
Date: Sat, 13 Aug 2005 21:27:43 -0500	[thread overview]
Message-ID: <20050814022743.GA19095@humbolt.us.dell.com> (raw)

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 <Matt_Domsch@dell.com>

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
 

                 reply	other threads:[~2005-08-14  2:27 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20050814022743.GA19095@humbolt.us.dell.com \
    --to=matt_domsch@dell.com \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®