linux-arch.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "H. Peter Anvin" <hpa@zytor.com>
To: linux-kernel@vger.kernel.org, linux-arch@vger.kernel.org,
	andi@firstfloor.org, akpm@linux-foundation.org
Cc: "H. Peter Anvin" <hpa@zytor.com>
Subject: [x86 setup 02/33] hd.c: remove BIOS/CMOS queries
Date: Mon,  9 Jul 2007 19:51:41 -0700	[thread overview]
Message-ID: <11840361432207-git-send-email-hpa@zytor.com> (raw)
Message-ID: <de4df4ebeb6ec1bf47d4adf19f6a388035e2bfec.1184032748.git.hpa@zytor.com> (raw)
In-Reply-To: <11840360383913-git-send-email-hpa@zytor.com>
In-Reply-To: <2034f71d414def30de582fb59573295cadbdabb4.1184032748.git.hpa@zytor.com>

From: H. Peter Anvin <hpa@zytor.com>

An ST-506 disk these days is pretty much someone trying to pull ancient
data using an auxilliary controller.  Pulling data from the BIOS or CMOS
is just plain wrong, since it's likely to be the primary OS disk... and
would be user-entered data anyway.  Instead, require the user enters it
on the command line.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
---
 drivers/ide/legacy/hd.c |   73 ++++++++---------------------------------------
 1 files changed, 12 insertions(+), 61 deletions(-)

diff --git a/drivers/ide/legacy/hd.c b/drivers/ide/legacy/hd.c
index 45ed035..9d7d8aa 100644
--- a/drivers/ide/legacy/hd.c
+++ b/drivers/ide/legacy/hd.c
@@ -718,74 +718,25 @@ static int __init hd_init(void)
 	device_timer.function = hd_times_out;
 	blk_queue_hardsect_size(hd_queue, 512);
 
-#ifdef __i386__
 	if (!NR_HD) {
-		extern struct drive_info drive_info;
-		unsigned char *BIOS = (unsigned char *) &drive_info;
-		unsigned long flags;
-		int cmos_disks;
-
-		for (drive=0 ; drive<2 ; drive++) {
-			hd_info[drive].cyl = *(unsigned short *) BIOS;
-			hd_info[drive].head = *(2+BIOS);
-			hd_info[drive].wpcom = *(unsigned short *) (5+BIOS);
-			hd_info[drive].ctl = *(8+BIOS);
-			hd_info[drive].lzone = *(unsigned short *) (12+BIOS);
-			hd_info[drive].sect = *(14+BIOS);
-#ifdef does_not_work_for_everybody_with_scsi_but_helps_ibm_vp
-			if (hd_info[drive].cyl && NR_HD == drive)
-				NR_HD++;
-#endif
-			BIOS += 16;
-		}
-
-	/*
-		We query CMOS about hard disks : it could be that 
-		we have a SCSI/ESDI/etc controller that is BIOS
-		compatible with ST-506, and thus showing up in our
-		BIOS table, but not register compatible, and therefore
-		not present in CMOS.
-
-		Furthermore, we will assume that our ST-506 drives
-		<if any> are the primary drives in the system, and 
-		the ones reflected as drive 1 or 2.
-
-		The first drive is stored in the high nibble of CMOS
-		byte 0x12, the second in the low nibble.  This will be
-		either a 4 bit drive type or 0xf indicating use byte 0x19 
-		for an 8 bit type, drive 1, 0x1a for drive 2 in CMOS.
-
-		Needless to say, a non-zero value means we have 
-		an AT controller hard disk for that drive.
-
-		Currently the rtc_lock is a bit academic since this
-		driver is non-modular, but someday... ?         Paul G.
-	*/
-
-		spin_lock_irqsave(&rtc_lock, flags);
-		cmos_disks = CMOS_READ(0x12);
-		spin_unlock_irqrestore(&rtc_lock, flags);
-
-		if (cmos_disks & 0xf0) {
-			if (cmos_disks & 0x0f)
-				NR_HD = 2;
-			else
-				NR_HD = 1;
-		}
-	}
-#endif /* __i386__ */
-#ifdef __arm__
-	if (!NR_HD) {
-		/* We don't know anything about the drive.  This means
+		/*
+		 * We don't know anything about the drive.  This means
 		 * that you *MUST* specify the drive parameters to the
 		 * kernel yourself.
+		 *
+		 * If we were on an i386, we used to read this info from
+		 * the BIOS or CMOS.  This doesn't work all that well,
+		 * since this assumes that this is a primary or secondary
+		 * drive, and if we're using this legacy driver, it's
+		 * probably an auxilliary controller added to recover
+		 * legacy data off an ST-506 drive.  Either way, it's
+		 * definitely safest to have the user explicitly specify
+		 * the information.
 		 */
 		printk("hd: no drives specified - use hd=cyl,head,sectors"
 			" on kernel command line\n");
-	}
-#endif
-	if (!NR_HD)
 		goto out;
+	}
 
 	for (drive=0 ; drive < NR_HD ; drive++) {
 		struct gendisk *disk = alloc_disk(64);
-- 
1.5.2.2


  parent reply	other threads:[~2007-07-10  3:02 UTC|newest]

Thread overview: 69+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-07-10  2:51 x86 setup code rewrite in C H. Peter Anvin
     [not found] ` <2034f71d414def30de582fb59573295cadbdabb4.1184032748.git.hpa@zytor.com>
2007-07-10  2:51   ` [x86 setup 01/33] x86 setup: MAINTAINERS: formally take responsibility for the i386 boot code H. Peter Anvin
     [not found]   ` <de4df4ebeb6ec1bf47d4adf19f6a388035e2bfec.1184032748.git.hpa@zytor.com>
2007-07-10  2:51     ` H. Peter Anvin [this message]
     [not found]   ` <38825725eb2e4aac1dd8e312460c5c239466b39a.1184032749.git.hpa@zytor.com>
2007-07-10  2:51     ` [x86 setup 03/33] include/asm-i386/boot.h: This is <asm/boot.h>, not <linux/boot.h> H. Peter Anvin
     [not found]   ` <62f9b07039d6bef798882977f3c8986fc2d2c6c6.1184032749.git.hpa@zytor.com>
2007-07-10  2:51     ` [x86 setup 04/33] Unify the CPU features vectors between i386 and x86-64 H. Peter Anvin
     [not found]   ` <8376b111bbf6bf6c8c884fabcb9c1844950737b0.1184032749.git.hpa@zytor.com>
2007-07-10  2:51     ` [x86 setup 05/33] Change CONFIG_X86_MINIMUM_CPU_MODEL to CONFIG_X86_MINIMUM_CPU_FAMILY H. Peter Anvin
     [not found]   ` <06a26dd135e1fc3b7f8b238c5b1bc8404d23acac.1184032749.git.hpa@zytor.com>
2007-07-10  2:51     ` [x86 setup 06/33] Clean up struct screen_info (<linux/screen_info.h>) H. Peter Anvin
     [not found]   ` <32e7eb05f31e6fbff33ecce6580ee4f7bdf38fef.1184032749.git.hpa@zytor.com>
2007-07-10  2:51     ` [x86 setup 07/33] Use a new CPU feature word to cover all Intel features that are spread around H. Peter Anvin
     [not found]   ` <a8e9d4bffc9fa216d32c930606475fd8d1df9405.1184032749.git.hpa@zytor.com>
2007-07-10  2:51     ` [x86 setup 08/33] Define zero-page offset 0x1e4 as a scratch field, and use it H. Peter Anvin
     [not found]   ` <0ff939788c542b0560ec39668550557dcc134afe.1184032749.git.hpa@zytor.com>
2007-07-10  2:51     ` [x86 setup 10/33] Make struct boot_params a real structure, and remove obsolete fields H. Peter Anvin
     [not found]   ` <bbeadd1995da049cf6880ab58794f84ec8785a08.1184032749.git.hpa@zytor.com>
2007-07-10  2:51     ` [x86 setup 11/33] x86-64: add CONFIG_PHYSICAL_ALIGN for consistency with i386 H. Peter Anvin
     [not found]   ` <e3ff2ad47d4610cdafbe24dcabadef42bb3166fb.1184032749.git.hpa@zytor.com>
2007-07-10  2:51     ` [x86 setup 12/33] x86-64: add symbolic constants for the boot segment selectors H. Peter Anvin
     [not found]   ` <96024b4c88d58a8473deb48a8038f6893b8b6b55.1184032749.git.hpa@zytor.com>
2007-07-10  2:51     ` [x86 setup 13/33] Header file to produce 16-bit code with gcc H. Peter Anvin
2007-07-10 14:16       ` Segher Boessenkool
2007-07-10 15:21         ` Andi Kleen
2007-07-10 15:48           ` H. Peter Anvin
2007-07-10 15:53             ` H. Peter Anvin
2007-07-10 20:08             ` Segher Boessenkool
2007-07-10 20:43               ` H. Peter Anvin
2007-07-10 21:08                 ` Pawel Dziepak
2007-07-10 21:20                   ` H. Peter Anvin
2007-07-11  0:26                   ` Brian Gerst
2007-07-10 19:57           ` Segher Boessenkool
2007-07-10 20:42             ` H. Peter Anvin
2007-07-10 21:10               ` Segher Boessenkool
2007-07-10 21:40                 ` H. Peter Anvin
2007-07-10 22:06                   ` Segher Boessenkool
2007-07-10 21:43               ` Adrian Bunk
2007-07-10 21:46                 ` H. Peter Anvin
2007-07-11  0:30                 ` Brian Gerst
     [not found]   ` <a862328acf06a9587458c615848099f96fbab1ce.1184032749.git.hpa@zytor.com>
2007-07-10  2:51     ` [x86 setup 14/33] Top header file for new x86 setup code H. Peter Anvin
     [not found]   ` <899e4acb1fe3e4313dfdca5398431274808d71ef.1184032749.git.hpa@zytor.com>
2007-07-10  2:51     ` [x86 setup 15/33] Simple bitops for the " H. Peter Anvin
     [not found]   ` <d5bd30fc697149284a73e09efe54884ab178de7e.1184032749.git.hpa@zytor.com>
2007-07-10  2:51     ` [x86 setup 16/33] String-handling functions " H. Peter Anvin
2007-07-10 18:25       ` Jan Engelhardt
2007-07-10 18:35         ` H. Peter Anvin
2007-07-10 20:10           ` Segher Boessenkool
2007-07-10 20:44             ` H. Peter Anvin
2007-07-10 21:14               ` Segher Boessenkool
2007-07-11 12:46                 ` Andi Kleen
     [not found]   ` <17db5b2c8a43cf36b2eb36afc142ce9ca0552282.1184032749.git.hpa@zytor.com>
2007-07-10  2:51     ` [x86 setup 17/33] A20 handling code H. Peter Anvin
2007-07-10 18:27       ` Jan Engelhardt
2007-07-10 18:33         ` H. Peter Anvin
2007-07-10 18:36         ` H. Peter Anvin
     [not found]   ` <c488ae7cd0ddd799b666f55652248be3c346a076.1184032749.git.hpa@zytor.com>
2007-07-10  2:51     ` [x86 setup 18/33] APM probing code H. Peter Anvin
     [not found]   ` <3726c75f36dc97c1fce93835e872bbc814857990.1184032749.git.hpa@zytor.com>
2007-07-10  2:51     ` [x86 setup 19/33] Command-line parsing code for the new x86 setup code H. Peter Anvin
     [not found]   ` <bf3e29f3d8c12230b38cae29ef5b476267d40cd1.1184032749.git.hpa@zytor.com>
2007-07-10  2:51     ` [x86 setup 20/33] Console-writing " H. Peter Anvin
2007-07-10 18:35       ` Jan Engelhardt
2007-07-10 18:48         ` H. Peter Anvin
     [not found]   ` <b4eed00df1889f94e8799ca6c0ce081bc5140688.1184032749.git.hpa@zytor.com>
2007-07-10  2:52     ` [x86 setup 21/33] Version string " H. Peter Anvin
     [not found]   ` <f1626ee0c265de9c41725f61eaee8a9017d8c8ff.1184032749.git.hpa@zytor.com>
2007-07-10  2:52     ` [x86 setup 22/33] CPU features verification " H. Peter Anvin
2007-07-10  7:37       ` Sébastien Dugué
     [not found]   ` <b577403d806edfbb1c17ecfec94971fc757a066c.1184032749.git.hpa@zytor.com>
2007-07-10  2:52     ` [x86 setup 23/33] EDD probing code " H. Peter Anvin
     [not found]   ` <77f7b2e92bb1de0f9d423b6537b8156296bcf931.1184032749.git.hpa@zytor.com>
2007-07-10  2:52     ` [x86 setup 24/33] MCA support for " H. Peter Anvin
     [not found]   ` <75642968817648a7816a4782f76138e4f608f1ab.1184032749.git.hpa@zytor.com>
2007-07-10  2:52     ` [x86 setup 25/33] Memory probing support for the " H. Peter Anvin
     [not found]   ` <dd2fade47882935c137f6d2a3c955eac1f6f8ecf.1184032749.git.hpa@zytor.com>
2007-07-10  2:52     ` [x86 setup 26/33] Voyager " H. Peter Anvin
     [not found]   ` <f8afa57a4934b75080449e8dd3a23d178be77a41.1184032749.git.hpa@zytor.com>
2007-07-10  2:52     ` [x86 setup 27/33] Video mode probing " H. Peter Anvin
     [not found]   ` <ae628cbaed0874c2c552ddbd77d61340438f9820.1184032749.git.hpa@zytor.com>
2007-07-10  2:52     ` [x86 setup 28/33] Code for actual protected-mode entry H. Peter Anvin
     [not found]   ` <26d4ebeefed3e0b1593d4fa2357db6912ee944cb.1184032749.git.hpa@zytor.com>
2007-07-10  2:52     ` [x86 setup 29/33] Assembly header and main routine for new x86 setup code H. Peter Anvin
     [not found]   ` <fd5cf379a91de82890893de655876e39e78c1dc9.1184032749.git.hpa@zytor.com>
2007-07-10  2:52     ` [x86 setup 30/33] Linker script for the " H. Peter Anvin
     [not found]   ` <842bbe280e87886e7a1b187434841c7f7334244c.1184032749.git.hpa@zytor.com>
2007-07-10  2:52     ` [x86 setup 31/33] Use the new x86 setup code for i386 H. Peter Anvin
2007-07-10  7:55       ` Tilman Schmidt
     [not found]   ` <0daaab19675363b0c9126a9b98a8325883bbcfea.1184032749.git.hpa@zytor.com>
2007-07-10  2:52     ` [x86 setup 32/33] Use the new x86 setup code for x86-64; unify with i386 H. Peter Anvin
     [not found]   ` <51664bcb2a5a2f1fe130229d34128a642dc81a4c.1184032749.git.hpa@zytor.com>
2007-07-10  2:52     ` [x86 setup 33/33] Remove old i386 setup code H. Peter Anvin
     [not found]   ` <361d0a8b7b7ea9d41d0c25664b3e2b30fd99e329.1184032749.git.hpa@zytor.com>
2007-07-10  2:51     ` [x86 setup 09/33] Make definitions for struct e820entry and struct e820map consistent H. Peter Anvin
2007-07-10 11:48     ` Andi Kleen
2007-07-10  4:24 ` x86 setup code rewrite in C Yinghai Lu
2007-07-10  4:39   ` H. Peter Anvin
2007-07-10  5:25 ` Jeff Garzik
2007-07-10 16:24 ` Jeremy Fitzhardinge

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=11840361432207-git-send-email-hpa@zytor.com \
    --to=hpa@zytor.com \
    --cc=akpm@linux-foundation.org \
    --cc=andi@firstfloor.org \
    --cc=linux-arch@vger.kernel.org \
    --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;
as well as URLs for NNTP newsgroup(s).