aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ide
diff options
context:
space:
mode:
authorH. Peter Anvin <hpa@zytor.com>2007-07-11 15:18:27 -0400
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-07-12 13:55:54 -0400
commit48dd643c3b02544994fa091573c2242441a7733f (patch)
treea24dfd78310b5182ce2ad314023cd13b16c717bb /drivers/ide
parent7f1291f2caa536c441507b459f91770a5280fb5d (diff)
hd.c: remove BIOS/CMOS queries
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> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/ide')
-rw-r--r--drivers/ide/legacy/hd.c73
1 files changed, 12 insertions, 61 deletions
diff --git a/drivers/ide/legacy/hd.c b/drivers/ide/legacy/hd.c
index 7f4c0a5050a1..8f2db8dd35f7 100644
--- a/drivers/ide/legacy/hd.c
+++ b/drivers/ide/legacy/hd.c
@@ -719,74 +719,25 @@ static int __init hd_init(void)
719 device_timer.function = hd_times_out; 719 device_timer.function = hd_times_out;
720 blk_queue_hardsect_size(hd_queue, 512); 720 blk_queue_hardsect_size(hd_queue, 512);
721 721
722#ifdef __i386__
723 if (!NR_HD) { 722 if (!NR_HD) {
724 extern struct drive_info drive_info; 723 /*
725 unsigned char *BIOS = (unsigned char *) &drive_info; 724 * We don't know anything about the drive. This means
726 unsigned long flags;
727 int cmos_disks;
728
729 for (drive=0 ; drive<2 ; drive++) {
730 hd_info[drive].cyl = *(unsigned short *) BIOS;
731 hd_info[drive].head = *(2+BIOS);
732 hd_info[drive].wpcom = *(unsigned short *) (5+BIOS);
733 hd_info[drive].ctl = *(8+BIOS);
734 hd_info[drive].lzone = *(unsigned short *) (12+BIOS);
735 hd_info[drive].sect = *(14+BIOS);
736#ifdef does_not_work_for_everybody_with_scsi_but_helps_ibm_vp
737 if (hd_info[drive].cyl && NR_HD == drive)
738 NR_HD++;
739#endif
740 BIOS += 16;
741 }
742
743 /*
744 We query CMOS about hard disks : it could be that
745 we have a SCSI/ESDI/etc controller that is BIOS
746 compatible with ST-506, and thus showing up in our
747 BIOS table, but not register compatible, and therefore
748 not present in CMOS.
749
750 Furthermore, we will assume that our ST-506 drives
751 <if any> are the primary drives in the system, and
752 the ones reflected as drive 1 or 2.
753
754 The first drive is stored in the high nibble of CMOS
755 byte 0x12, the second in the low nibble. This will be
756 either a 4 bit drive type or 0xf indicating use byte 0x19
757 for an 8 bit type, drive 1, 0x1a for drive 2 in CMOS.
758
759 Needless to say, a non-zero value means we have
760 an AT controller hard disk for that drive.
761
762 Currently the rtc_lock is a bit academic since this
763 driver is non-modular, but someday... ? Paul G.
764 */
765
766 spin_lock_irqsave(&rtc_lock, flags);
767 cmos_disks = CMOS_READ(0x12);
768 spin_unlock_irqrestore(&rtc_lock, flags);
769
770 if (cmos_disks & 0xf0) {
771 if (cmos_disks & 0x0f)
772 NR_HD = 2;
773 else
774 NR_HD = 1;
775 }
776 }
777#endif /* __i386__ */
778#ifdef __arm__
779 if (!NR_HD) {
780 /* We don't know anything about the drive. This means
781 * that you *MUST* specify the drive parameters to the 725 * that you *MUST* specify the drive parameters to the
782 * kernel yourself. 726 * kernel yourself.
727 *
728 * If we were on an i386, we used to read this info from
729 * the BIOS or CMOS. This doesn't work all that well,
730 * since this assumes that this is a primary or secondary
731 * drive, and if we're using this legacy driver, it's
732 * probably an auxilliary controller added to recover
733 * legacy data off an ST-506 drive. Either way, it's
734 * definitely safest to have the user explicitly specify
735 * the information.
783 */ 736 */
784 printk("hd: no drives specified - use hd=cyl,head,sectors" 737 printk("hd: no drives specified - use hd=cyl,head,sectors"
785 " on kernel command line\n"); 738 " on kernel command line\n");
786 }
787#endif
788 if (!NR_HD)
789 goto out; 739 goto out;
740 }
790 741
791 for (drive=0 ; drive < NR_HD ; drive++) { 742 for (drive=0 ; drive < NR_HD ; drive++) {
792 struct gendisk *disk = alloc_disk(64); 743 struct gendisk *disk = alloc_disk(64);