All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] 2.5.30 IDE 112
@ 2002-08-06  8:50 Marcin Dalecki
  2002-08-06 10:27 ` Andries Brouwer
  2002-08-06 19:22 ` Linus Torvalds
  0 siblings, 2 replies; 8+ messages in thread
From: Marcin Dalecki @ 2002-08-06  8:50 UTC (permalink / raw)
  To: Kernel Mailing List, Linus Torvalds

[-- Attachment #1: Type: text/plain, Size: 47 bytes --]

- Just removaing dead obscure xlate_1024 code.

[-- Attachment #2: ide-112.diff --]
[-- Type: text/plain, Size: 12928 bytes --]

diff -durNp -X /tmp/diff.uRHk8V linux-2.5.30/drivers/ide/cs5530.c linux/drivers/ide/cs5530.c
--- linux-2.5.30/drivers/ide/cs5530.c	2002-08-03 15:03:26.000000000 +0200
+++ linux/drivers/ide/cs5530.c	2002-08-02 02:24:32.000000000 +0200
@@ -204,8 +204,6 @@ static unsigned int __init pci_init_cs55
 {
 	struct pci_dev *master_0 = NULL;
 	struct pci_dev *cs5530_0 = NULL;
-	unsigned short pcicmd = 0;
-	unsigned long flags;
 
 	pci_for_each_dev(dev) {
 		if (dev->vendor == PCI_VENDOR_ID_CYRIX) {
@@ -233,7 +231,7 @@ static unsigned int __init pci_init_cs55
 	 * Enable BusMaster and MemoryWriteAndInvalidate for the cs5530:
 	 * -->  OR 0x14 into 16-bit PCI COMMAND reg of function 0 of the cs5530
 	 */
-	 
+
 	pci_set_master(cs5530_0);
 	pci_set_mwi(cs5530_0);
 
diff -durNp -X /tmp/diff.uRHk8V linux-2.5.30/drivers/ide/ide.c linux/drivers/ide/ide.c
--- linux-2.5.30/drivers/ide/ide.c	2002-08-03 15:03:26.000000000 +0200
+++ linux/drivers/ide/ide.c	2002-08-02 10:58:52.000000000 +0200
@@ -251,7 +251,7 @@ static struct ata_bit_messages ata_statu
 
 static struct ata_bit_messages ata_error_msgs[] = {
 	{ ICRC_ERR|ABRT_ERR,	ABRT_ERR,		"drive status error"	},
-	{ ICRC_ERR|ABRT_ERR,	ICRC_ERR,		"bad sectorr"		},
+	{ ICRC_ERR|ABRT_ERR,	ICRC_ERR,		"bad sector"		},
 	{ ICRC_ERR|ABRT_ERR,	ICRC_ERR|ABRT_ERR,	"invalid checksum"	},
 	{ ECC_ERR,		ECC_ERR,		"uncorrectable error"	},
 	{ ID_ERR,		ID_ERR,			"sector id not found"   },
diff -durNp -X /tmp/diff.uRHk8V linux-2.5.30/drivers/ide/Makefile linux/drivers/ide/Makefile
--- linux-2.5.30/drivers/ide/Makefile	2002-08-03 15:03:26.000000000 +0200
+++ linux/drivers/ide/Makefile	2002-08-02 02:28:01.000000000 +0200
@@ -1,15 +1,12 @@
 #
-# Makefile for the kernel ata, atapi, and ide block device drivers.
+# Makefile for the kernel ata and atapi block device drivers.
 #
-# 12 September 2000, Bartlomiej Zolnierkiewicz <bkz@linux-ide.org>
+# 12 September 2000, Bartłomiej Żołnierkiewicz <bkz@linux-ide.org>
 # Rewritten to use lists instead of if-statements.
 #
-# Note : at this point, these files are compiled on all systems.
-# In the future, some of these should be built conditionally.
-#
 
-export-objs	:= device.o ide-taskfile.o main.o ide.o probe.o quirks.o pcidma.o tcq.o \
-		   atapi.o ataraid.o
+export-objs :=	device.o ide-taskfile.o main.o ide.o probe.o quirks.o \
+		pcidma.o tcq.o atapi.o ataraid.o
 
 obj-$(CONFIG_BLK_DEV_HD)	+= hd.o
 obj-$(CONFIG_BLK_DEV_IDE)       += ide-mod.o
diff -durNp -X /tmp/diff.uRHk8V linux-2.5.30/drivers/ide/probe.c linux/drivers/ide/probe.c
--- linux-2.5.30/drivers/ide/probe.c	2002-08-03 15:03:26.000000000 +0200
+++ linux/drivers/ide/probe.c	2002-08-02 02:20:34.000000000 +0200
@@ -41,115 +41,6 @@
 extern struct ata_device * get_info_ptr(kdev_t);
 
 /*
- * This is called from the partition-table code in pt/msdos.c
- * to invent a translated geometry.
- *
- * This is suppressed if the user specifies an explicit geometry.
- *
- * The ptheads parameter is either 0 or tells about the number of
- * heads shown by the end of the first nonempty partition.
- * If this is either 16, 32, 64, 128, 240 or 255 we'll believe it.
- *
- * The xparm parameter has the following meaning:
- *	 0 = convert to CHS with fewer than 1024 cyls
- *	     using the same method as Ontrack DiskManager.
- *	 1 = same as "0", plus offset everything by 63 sectors.
- *	-1 = similar to "0", plus redirect sector 0 to sector 1.
- *	 2 = convert to a CHS geometry with "ptheads" heads.
- *
- * Returns 0 if the translation was not possible, if the device was not
- * an IDE disk drive, or if a geometry was "forced" on the commandline.
- * Returns 1 if the geometry translation was successful.
- */
-int ide_xlate_1024(kdev_t i_rdev, int xparm, int ptheads, const char *msg)
-{
-	struct ata_device *drive;
-	const char *msg1 = "";
-	int heads = 0;
-	int c, h, s;
-	int transl = 1;		/* try translation */
-	int ret = 0;
-
-	drive = get_info_ptr(i_rdev);
-	if (!drive)
-		return 0;
-
-	/* There used to be code here that assigned drive->id->CHS to
-	 * drive->CHS and that to drive->bios_CHS. However, some disks have
-	 * id->C/H/S = 4092/16/63 but are larger than 2.1 GB.  In such cases
-	 * that code was wrong.  Moreover, there seems to be no reason to do
-	 * any of these things.
-	 *
-	 * Please note that recent RedHat changes to the disk utils are bogous
-	 * and will report spurious errors.
-	 */
-
-	/* translate? */
-	if (drive->forced_geom)
-		transl = 0;
-
-	/* does ptheads look reasonable? */
-	if (ptheads == 32 || ptheads == 64 || ptheads == 128 ||
-	    ptheads == 240 || ptheads == 255)
-		heads = ptheads;
-
-	if (xparm == 2) {
-		if (!heads ||
-		   (drive->bios_head >= heads && drive->bios_sect == 63))
-			transl = 0;
-	}
-	if (xparm == -1) {
-		if (drive->bios_head > 16)
-			transl = 0;     /* we already have a translation */
-	}
-
-	if (transl) {
-		static const u8 dm_head_vals[] = {4, 8, 16, 32, 64, 128, 255, 0};
-		const u8 *headp = dm_head_vals;
-		unsigned long total;
-
-		/*
-		 * If heads is nonzero: find a translation with this many heads
-		 * and S=63.  Otherwise: find out how OnTrack Disk Manager
-		 * would translate the disk.
-		 *
-		 * The specs say: take geometry as obtained from Identify,
-		 * compute total capacity C*H*S from that, and truncate to
-		 * 1024*255*63. Now take S=63, H the first in the sequence 4,
-		 * 8, 16, 32, 64, 128, 255 such that 63*H*1024 >= total.
-		 * [Please tell aeb@cwi.nl in case this computes a geometry
-		 * different from what OnTrack uses.]
-		 */
-
-		total = ata_capacity(drive);
-
-		s = 63;
-
-		if (heads) {
-			h = heads;
-			c = total / (63 * heads);
-		} else {
-			while (63 * headp[0] * 1024 < total && headp[1] != 0)
-				headp++;
-			h = headp[0];
-			c = total / (63 * headp[0]);
-		}
-
-		drive->bios_cyl = c;
-		drive->bios_head = h;
-		drive->bios_sect = s;
-		ret = 1;
-	}
-
-	drive->part[0].nr_sects = ata_capacity(drive);
-
-	if (ret)
-		printk("%s%s [%d/%d/%d]", msg, msg1,
-		       drive->bios_cyl, drive->bios_head, drive->bios_sect);
-	return ret;
-}
-
-/*
  * Drive ID data come as little endian, it needs to be converted on big endian
  * machines.
  */
diff -durNp -X /tmp/diff.uRHk8V linux-2.5.30/drivers/ide/qd65xx.c linux/drivers/ide/qd65xx.c
--- linux-2.5.30/drivers/ide/qd65xx.c	2002-08-03 15:03:26.000000000 +0200
+++ linux/drivers/ide/qd65xx.c	2002-08-02 02:37:07.000000000 +0200
@@ -103,7 +103,7 @@ static void qd_select(struct ata_device 
  *	upper nibble represents recovery time, in count of VLB clocks
  */
 
-static u8 qd6500_compute_timing(struct ata_channel *hwif, int active_time, int recovery_time)
+static u8 qd6500_compute_timing(struct ata_channel *ch, int active_time, int recovery_time)
 {
 	u8 active_cycle,recovery_cycle;
 
@@ -172,15 +172,15 @@ static int qd_timing_ok(struct ata_devic
 
 static void qd_set_timing(struct ata_device *drive, u8 timing)
 {
-	struct ata_channel *hwif = drive->channel;
+	struct ata_channel *ch = drive->channel;
 
 	drive->drive_data &= 0xff00;
 	drive->drive_data |= timing;
-	if (qd_timing_ok(hwif->drives)) {
+	if (qd_timing_ok(ch->drives)) {
 		qd_select(drive); /* selects once */
-		hwif->selectproc = NULL;
+		ch->selectproc = NULL;
 	} else
-		hwif->selectproc = &qd_select;
+		ch->selectproc = &qd_select;
 
 	printk(KERN_DEBUG "%s: %#x\n", drive->name, timing);
 }
@@ -279,61 +279,64 @@ static int __init qd_testreg(int port)
 }
 
 /*
- * called to setup an ata channel : adjusts attributes & links for tuning
+ * Adjusts attributes & links for tuning.
  */
 
-void __init qd_setup(int unit, int base, int config, unsigned int data0, unsigned int data1, void (*tuneproc) (struct ata_device *, u8 pio))
+static void __init qd_setup(int unit, int base, int config, unsigned int data0, unsigned int data1, void (*tuneproc) (struct ata_device *, u8 pio))
 {
-	struct ata_channel *hwif = &ide_hwifs[unit];
+	struct ata_channel *ch = &ide_hwifs[unit];
 
-	hwif->chipset = ide_qd65xx;
-	hwif->unit = unit;
-	hwif->select_data = base;
-	hwif->config_data = config;
-	hwif->drives[0].drive_data = data0;
-	hwif->drives[1].drive_data = data1;
-	hwif->io_32bit = 1;
-	hwif->tuneproc = tuneproc;
+	ch->chipset = ide_qd65xx;
+	ch->unit = unit;
+	ch->select_data = base;
+	ch->config_data = config;
+	ch->drives[0].drive_data = data0;
+	ch->drives[1].drive_data = data1;
+	ch->io_32bit = 1;
+	ch->tuneproc = tuneproc;
 }
 
+#ifdef MODULE
 /*
- * called to unsetup an ata channel : back to default values, unlinks tuning
+ * Called to unsetup an ata channel : back to default values, unlinks tuning.
  */
-void __init qd_unsetup(int unit) {
-	struct ata_channel *hwif = &ide_hwifs[unit];
-	u8 config = hwif->config_data;
-	int base = hwif->select_data;
-	void *tuneproc = (void *) hwif->tuneproc;
+static void __init qd_unsetup(int unit) {
+	struct ata_channel *ch = &ide_hwifs[unit];
+	u8 config = ch->config_data;
+	int base = ch->select_data;
+	void *tuneproc = (void *) ch->tuneproc;
 
-	if (!(hwif->chipset == ide_qd65xx)) return;
+	if (ch->chipset != ide_qd65xx)
+		return;
 
-	printk(KERN_NOTICE "%s: back to defaults\n", hwif->name);
+	printk(KERN_NOTICE "%s: back to defaults\n", ch->name);
 
-	hwif->selectproc = NULL;
-	hwif->tuneproc = NULL;
+	ch->selectproc = NULL;
+	ch->tuneproc = NULL;
 
 	if (tuneproc == (void *) qd6500_tune_drive) {
 		// will do it for both
-		outb(QD6500_DEF_DATA, QD_TIMREG(&hwif->drives[0]));
+		outb(QD6500_DEF_DATA, QD_TIMREG(&ch->drives[0]));
 	} else if (tuneproc == (void *) qd6580_tune_drive) {
-		if (QD_CONTROL(hwif) & QD_CONTR_SEC_DISABLED) {
-			outb(QD6580_DEF_DATA, QD_TIMREG(&hwif->drives[0]));
-			outb(QD6580_DEF_DATA2, QD_TIMREG(&hwif->drives[1]));
+		if (QD_CONTROL(ch) & QD_CONTR_SEC_DISABLED) {
+			outb(QD6580_DEF_DATA, QD_TIMREG(&ch->drives[0]));
+			outb(QD6580_DEF_DATA2, QD_TIMREG(&ch->drives[1]));
 		} else {
-			outb(unit ? QD6580_DEF_DATA2 : QD6580_DEF_DATA, QD_TIMREG(&hwif->drives[0]));
+			outb(unit ? QD6580_DEF_DATA2 : QD6580_DEF_DATA, QD_TIMREG(&ch->drives[0]));
 		}
 	} else {
 		printk(KERN_WARNING "Unknown qd65xx tuning fonction !\n");
 		printk(KERN_WARNING "keeping settings !\n");
 	}
 }
+#endif
 
 /*
- * looks at the specified baseport, and if qd found, registers & initialises it
- * return 1 if another qd may be probed
+ * Looks at the specified baseport, and if qd found, registers & initialises it
+ * return 1 if another qd may be probed.
  */
 
-int __init qd_probe(int base)
+static int __init qd_probe(int base)
 {
 	u8 config;
 	int unit;
@@ -397,13 +400,10 @@ int __init qd_probe(int base)
 }
 
 #ifndef MODULE
-/*
- * called by ide.c when parsing command line
- */
-
 void __init init_qd65xx(void)
 {
-	if (qd_probe(0x30)) qd_probe(0xb0);
+	if (qd_probe(0x30))
+		qd_probe(0xb0);
 }
 
 #else
@@ -414,8 +414,12 @@ MODULE_LICENSE("GPL");
 
 int __init qd65xx_mod_init(void)
 {
-	if (qd_probe(0x30)) qd_probe(0xb0);
-	if (ide_hwifs[0].chipset != ide_qd65xx && ide_hwifs[1].chipset != ide_qd65xx) return -ENODEV;
+	if (qd_probe(0x30))
+		qd_probe(0xb0);
+	if (ide_hwifs[0].chipset != ide_qd65xx
+	 && ide_hwifs[1].chipset != ide_qd65xx)
+		return -ENODEV;
+
 	return 0;
 }
 module_init(qd65xx_mod_init);
diff -durNp -X /tmp/diff.uRHk8V linux-2.5.30/fs/partitions/Makefile linux/fs/partitions/Makefile
--- linux-2.5.30/fs/partitions/Makefile	2002-08-03 15:03:26.000000000 +0200
+++ linux/fs/partitions/Makefile	2002-08-02 02:22:20.000000000 +0200
@@ -2,7 +2,7 @@
 # Makefile for the linux kernel.
 #
 
-export-objs := check.o msdos.o
+export-objs := check.o
 
 obj-y := check.o
 
diff -durNp -X /tmp/diff.uRHk8V linux-2.5.30/fs/partitions/msdos.c linux/fs/partitions/msdos.c
--- linux-2.5.30/fs/partitions/msdos.c	2002-08-03 15:03:26.000000000 +0200
+++ linux/fs/partitions/msdos.c	2002-08-02 02:22:25.000000000 +0200
@@ -22,17 +22,6 @@
 #include <linux/config.h>
 #include <linux/buffer_head.h>		/* for invalidate_bdev() */
 
-#ifdef CONFIG_BLK_DEV_IDE
-#include <linux/hdreg.h>
-#include <linux/ide.h>	/* IDE xlate */
-#elif defined(CONFIG_BLK_DEV_IDE_MODULE)
-#include <linux/module.h>
-
-int (*ide_xlate_1024_hook)(kdev_t, int, int, const char *);
-EXPORT_SYMBOL(ide_xlate_1024_hook);
-#define ide_xlate_1024 ide_xlate_1024_hook
-#endif
-
 #include "check.h"
 #include "msdos.h"
 #include "efi.h"
diff -durNp -X /tmp/diff.uRHk8V linux-2.5.30/include/linux/ide.h linux/include/linux/ide.h
--- linux-2.5.30/include/linux/ide.h	2002-08-03 15:03:26.000000000 +0200
+++ linux/include/linux/ide.h	2002-08-02 02:21:00.000000000 +0200
@@ -1091,12 +1091,6 @@ extern ide_startstop_t ata_error(struct 
 extern void ide_fixstring(char *s, const int bytecount, const int byteswap);
 
 /*
- * This routine is called from the partition-table code in genhd.c
- * to "convert" a drive to a logical geometry with fewer than 1024 cyls.
- */
-int ide_xlate_1024(kdev_t, int, int, const char *);
-
-/*
  * Convert kdev_t structure into struct ata_device * one.
  */
 struct ata_device *get_info_ptr(kdev_t i_rdev);

^ permalink raw reply	[flat|nested] 8+ messages in thread
* Re: [PATCH] 2.5.30 IDE 112
@ 2002-08-06 12:19 Petr Vandrovec
  2002-08-06 12:23 ` Marcin Dalecki
  2002-08-06 14:10 ` Andries Brouwer
  0 siblings, 2 replies; 8+ messages in thread
From: Petr Vandrovec @ 2002-08-06 12:19 UTC (permalink / raw)
  To: Andries Brouwer; +Cc: Kernel Mailing List, Linus Torvalds, martin

On  6 Aug 02 at 12:27, Andries Brouwer wrote:
> On Tue, Aug 06, 2002 at 10:50:42AM +0200, Marcin Dalecki wrote:
> > - Just removaing dead obscure xlate_1024 code.
> 
> Command line options must be added to ask for what this
> xlate_1024 code did earlier. So, some fragments of what you remove
> in this patch will have to come back in some form.

FYI I had to use hda=cyls,255,63 to repartition my HDD. BIOS refused
to report proper size (120GB) when partition table was empty, or when
it contained partitions created for xxx/16/63 geometry. It reported
size ~600MB, and actively refused to allow access above this limit...

With removed (either completely, or just disabling as it is now) xlate_1024 
code please talk to [cs]fdisk maintainer (and other) to print big fat
warning and to allow specify BIOS heads/sectors, otherwise partitioning
of empty disk in the way compatible with non-Linux OSes (Netware, Windows)
is not an easy task.
                                                        Petr Vandrovec
                                                        
# lilo
Warning: Int 0x13 function 8 and function 0x48 return different
head/sector geometries for BIOS drive 0x81
    fn 08: 788 cylinders, 255 heads, 63 sectors
    fn 48: 13424 cylinders, 15 heads, 63 sectors
Warning: Kernel & BIOS return differing head/sector geometries for device 0x80
    Kernel: 35973 cylinders, 16 heads, 63 sectors
      BIOS: 1023 cylinders, 255 heads, 63 sectors

^ permalink raw reply	[flat|nested] 8+ messages in thread
* Re: [PATCH] 2.5.30 IDE 112
@ 2002-08-06 16:06 Petr Vandrovec
  0 siblings, 0 replies; 8+ messages in thread
From: Petr Vandrovec @ 2002-08-06 16:06 UTC (permalink / raw)
  To: Andries Brouwer; +Cc: Kernel Mailing List, martin

On  6 Aug 02 at 16:10, Andries Brouwer wrote:
> > BIOS refused to report proper size (120GB) when partition table
> > was empty, or when it contained partitions created for xxx/16/63
> > geometry. It reported size ~600MB, and actively refused to allow
> > access above this limit...
> 
> Funny. Do you mean that your BIOS used SETMAX ?

No. It miscalculated something somewhere. Only BIOS INT13h interface
was affected. But it is problem if it is your boot disk, and BIOS
is willing to load only MBR and first few sectors from disk, while your
LILO lives at ~60GB from disk start.
 
> Yes. I already advised this maintainer to add -C,-H,-S options to fdisk
> (cfdisk and sfdisk already have them), and he did so immediately.
> Visible one of these weeks in util-linux-2.11v.

Thanks. I'm still using fdisk...
 
> So, I have two questions:
> 1. What precisely do you mean with "actively refused" ?
> 2. Is there a Windows or Netware reason to prefer extended translation
> above no translation?

When that one BIOS (Award in 6BTM from Chaintech) found 120GB disk
with partition table saying that it is partitioned as 16heads/63sectors,
depending on LBA/LARGE/NORMAL setting it reported size 20MB/600MB/30GB
(if you want exact numbers/geometries, I can obtain them on saturday),
and code in the BIOS checked that OS does not try to access data above 
limit BIOS (mis)calculated when using INT13 interface (so windows98 rescue 
diskette was not able to create partition > 30GB, and PartitionMagic 
refused to operate at all with partition error #110 (or 108 or 109)).

I first thought that BIOS does not support disks over 30GB, but after
I rebuilt partition table with xxx/255/63 geometry, disk was correctly 
recognized and reported as 120GB by BIOS regardless of setting in the BIOS.

Some Netware drivers use geometry reported by the BIOS internally, and
if BIOS reports 16heads/63sectors, code doing blocknr -> CHS -> LBA can
overflow. But it is fixed for some years, so it should not be problem
for existing systems, and new (NW5/NW6) systems should cope with this.
                                                Petr Vandrovec
                                                vandrove@vc.cvut.cz
                                                

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2002-08-06 19:17 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-08-06  8:50 [PATCH] 2.5.30 IDE 112 Marcin Dalecki
2002-08-06 10:27 ` Andries Brouwer
2002-08-06 19:22 ` Linus Torvalds
  -- strict thread matches above, loose matches on Subject: below --
2002-08-06 12:19 Petr Vandrovec
2002-08-06 12:23 ` Marcin Dalecki
2002-08-06 18:17   ` Andre Hedrick
2002-08-06 14:10 ` Andries Brouwer
2002-08-06 16:06 Petr Vandrovec

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.