Skip to contentSkip to conversation

2.4.x kernels, big ide disks and old bios

DISCUSSION Josep Lladonosa i Capell 10 participants 14 messages Dec 25, 2001 – Dec 30, 2001

lore
Share & tools
lore
#0 lore raw

Hello,

the problem is this:

bios only supports disks up to 32 Gb.

hard disk is 60 Gb.

kernel is 2.4.17

hard disk reports its correct size when reading parameters from the disk, not from the bios

verd:/proc/ide/hdc# cat geometry
physical     65530/16/63
logical      119150/16/63

when booting (dmesg):

hdc: IC35L060AVER07-0, ATA DISK drive
hdc: 66055247 sectors (33820 MB) w/1916KiB Cache, CHS=119150/16/63, UDMA(33)

Linux adopts the 'false' geometry (65530/16/63) ) to bypass the bios boot.

I know that there are patches for 2.2 kernels and 2.3 kernels, so as linux adopts the logical geometry (a kiddy trick with lba size). They are very simple (a line), but 2.4 ide implementation is (a little more) complicated. Any patch?

Bon Nadal - Merry Christmas

--
Salutacions...Josep
http://www.geocities.com/SiliconValley/Horizon/1065/
--

#1 lore raw
Quoted 2 lines

bios only supports disks up to 32 Gb.
hard disk is 60 Gb.

What I'm using is change the geometry after the boot and before any partition besides root is mounted, I do this at the beginning of checkroot.sh by calling "/sbin/setmax -d 0 /dev/hda" but you can do it on your own script or where ever you want, just taking care that it is done befor any FS that goes above the 32gigs is accessed.

Setmax is a small program that I downloaded from the net, sorry, I don't remember where did I download it from or his author, but it was posted to this list some time ago, I have a version for the 2.4 kernel at ftp.manty.net/linux/programs/setmax.c

This works ok for me, of course you can have other solutions.

Regards...

Signature · 1 line
Manty/BestiaTester -> http://manty.net
#2 lore raw
In reply to Josep Lladonosa i Capell

Hi

i have the same problem weith a 40GB disk
its not a linux problem but a bios / disk problem

my workaround:

dont set the jumper on the disk to make it look smaller. this however will stop it working in the bios so you need to disable the disk in the bios completly and turn off the ide auto detection process in the bios this is because it will probably hang if you try to use it :)

linux will then pick the disk up from the ide controller.

----- Original Message -----
From: "Josep Lladonosa i Capell" <[email protected]>
To: <[email protected]>
Sent: Tuesday, December 25, 2001 10:56 AM
Subject: 2.4.x kernels, big ide disks and old bios

Quoted 49 lines

Hello,

the problem is this:

bios only supports disks up to 32 Gb.

hard disk is 60 Gb.

kernel is 2.4.17

hard disk reports its correct size when reading parameters from the disk, not from the bios

verd:/proc/ide/hdc# cat geometry
physical     65530/16/63
logical      119150/16/63

when booting (dmesg):

hdc: IC35L060AVER07-0, ATA DISK drive
hdc: 66055247 sectors (33820 MB) w/1916KiB Cache, CHS=119150/16/63, UDMA(33)

Linux adopts the 'false' geometry (65530/16/63) ) to bypass the bios boot.

I know that there are patches for 2.2 kernels and 2.3 kernels, so as linux adopts the logical geometry (a kiddy trick with lba size). They are very simple (a line), but 2.4 ide implementation is (a little more) complicated. Any patch?

Bon Nadal - Merry Christmas

--
Salutacions...Josep
http://www.geocities.com/SiliconValley/Horizon/1065/
--

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

#3 lore raw
Quoted 7 lines · On Tue, 25 Dec 2001 19:09:22 -0000 "James Stevenson" <[email protected]>…

Hi

i have the same problem weith a 40GB disk
its not a linux problem but a bios / disk problem

my workaround:

Quoted 7 lines

dont set the jumper on the disk to make it look smaller. this however will stop it working in the bios so you need to disable the disk in the bios completly and turn off the ide auto detection process in the bios this is because it will probably hang if you try to use it :)

linux will then pick the disk up from the ide controller.

I tried this one some time ago, and had to find out, that I was not able to write to the upper cylinders of the disk. You can check this out _before_ using the drive via dd from /dev/zero to your /dev/drive and look at the results.

Regards,
Stephan

#4 lore raw
In reply to Josep Lladonosa i Capell
Quoted 10 lines
Quoted 10 lines

my workaround:

dont set the jumper on the disk to make it look smaller. this however will stop it working in the bios so you need to disable the disk in the bios completly and turn off the ide auto detection process in the bios this is because it will probably hang if you try to use it :)

Quoted 3 lines
Quoted 1 line

linux will then pick the disk up from the ide controller.

I tried this one some time ago, and had to find out, that I was not able

to

Quoted 1 line

write to the upper cylinders of the disk. You can check this out _before_

using

Quoted 1 line

the drive via dd from /dev/zero to your /dev/drive and look at the

results.

it seems to work fine for me.
could it be possible that the chipset that you are using does not support disks bigger than 32GB ?

#5 lore raw
Quoted 10 lines · On Thu, 27 Dec 2001 13:14:43 -0000 "James Stevenson" <[email protected]> wrote:
Quoted 1 line

I tried this one some time ago, and had to find out, that I was not able

to

Quoted 1 line

write to the upper cylinders of the disk. You can check this out _before_

using

Quoted 1 line

the drive via dd from /dev/zero to your /dev/drive and look at the

results.

it seems to work fine for me.
could it be possible that the chipset that you are using does not support disks bigger than 32GB ?

I don't know. I tried once with

00:01.1 IDE interface: Silicon Integrated Systems [SiS] 5513 [IDE] (rev d0)

and it did not work. I could definitely not write beyond the 32 GB border. I replaced the mobo then.

Regards,
Stephan

#6 lore raw

Hi,

I am having an old Pentium 120, with an old BIOS.
I got new 40GB hard disk, and in order to make it readable, I needed to use the cable-select jumper in order to make the hard disk look smaller for the bios.
The only problem is that the linux recognizes my hard drive as 33GB (maybe its 32 as you said). will what you said about disabling the hard disk recognision at the BIOS help me?
I don't want to play with the BIOS for nothing, so please let me know.

Thanks,
Ido

Quoted 30 lines · Stephan von Krawczynski
Quoted 10 lines · On Thu, 27 Dec 2001 13:14:43 -0000 "James Stevenson" <[email protected]> wrote:
Quoted 1 line

I tried this one some time ago, and had to find out, that I was not able

to

Quoted 1 line

write to the upper cylinders of the disk. You can check this out _before_

using

Quoted 1 line

the drive via dd from /dev/zero to your /dev/drive and look at the

results.

it seems to work fine for me.
could it be possible that the chipset that you are using does not support disks bigger than 32GB ?

I don't know. I tried once with

00:01.1 IDE interface: Silicon Integrated Systems [SiS] 5513 [IDE] (rev d0)

and it did not work. I could definitely not write beyond the 32 GB border. I replaced the mobo then.

Regards,
Stephan

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

#7 lore raw
In reply to Josep Lladonosa i Capell
Quoted 6 lines · Stephan von Krawczynski

I don't know. I tried once with

00:01.1 IDE interface: Silicon Integrated Systems [SiS] 5513 [IDE] (rev d0)

and it did not work. I could definitely not write beyond the 32 GB border. I replaced the mobo then.

Did you try setmax?

#8 lore raw
Quoted 1 line

On Thu, Dec 27, 2001 at 07:51:01PM +0100, Stephan von Krawczynski

Quoted 4 lines · wrote:
Quoted 4 lines

I don't know. I tried once with

00:01.1 IDE interface: Silicon Integrated Systems [SiS] 5513 [IDE]

(rev d0)

Quoted 2 lines
Quoted 2 lines

and it did not work. I could definitely not write beyond the 32 GB

border. I

Quoted 3 lines
Quoted 1 line

replaced the mobo then.

Did you try setmax?

unfortunately not, I did not even know it existed before this thread. I must admit I have still not had a look at it, but on the other hand:
if it makes big IDE drives work on old mobo & bios, it may be a good idea to include its intelligence into the kernel, or not? Yes, I know that people nowadays tend to strip down _old_ stuff from the current sources, but I guess it is not a big loss in code size either, is it?
knock, knock .. hello IDE maintainer, how about a Xmas present ? :-)

Regards,
Stephan

#9 lore raw
Quoted 3 lines · Stephan von Krawczynski

I must admit I have still not had a look at it, but on the other hand:
if it makes big IDE drives work on old mobo & bios, it may be a good idea to include its intelligence into the kernel, or not?

I cleaned up the patch a bit (see below). It now performs the SET_MAX command only when needed, and is far less verbose (only prints 1 line when unclipping). It applies against 2.4.18pre1 and 2.5.2pre2.

I've tested it with a Maxtor 96147U8 (60Gb), Maxtor 98196H8 (80Gb) and WDC WD300BB (30Gb) (the last one just for testing, and I had to use ibmsetmax instead of setmax to make the drive remember it). It also worked with some 2.5" IBM hdd a while back (don't remember the exact model).

Jens, please consider this patch for inclusion into 2.4 and/or 2.5. (or should I talk to someone else?)

Eric

drivers/ide/ide-disk.c renamed from drivers/ide/ide-disk.c.orig +74 -0
@@ -500,6 +500,78 @@
 			current_capacity(drive));
 }
 
+
+/*
+ * Queries for true maximum capacity of the drive and (if needed) sets
+ * maximum virtual LBA address accordingly. Also updates drive->*
+ * settings.
+ */
+static void idedisk_unclip(ide_drive_t *drive)
+{
+	byte args[7];
+	unsigned long addr = 0;
+
+	if(!(drive->id->command_set_1 & 0x0400)) {
+		/* drive does not support Host Protected Area feature. */
+		return;
+	}
+
+	/* create IDE/ATA command request structure */
+	args[0] = 0xf8; /* READ_NATIVE_MAX - see ATA spec */
+	args[IDE_FEATURE_OFFSET] = 0x00;
+	args[IDE_NSECTOR_OFFSET] = 0x00;
+	args[IDE_SECTOR_OFFSET] = 0x00;
+	args[IDE_LCYL_OFFSET] = 0x00;
+	args[IDE_HCYL_OFFSET] = 0x00;
+	args[IDE_SELECT_OFFSET] = 0x40;
+
+	if(ide_wait_cmd_task(drive, args) != 0 || (args[0] & 0x01) != 0) {
+		/* silently ignore failed command */
+		return;
+	}
+
+	/* read max LBA value */
+	addr = ((args[IDE_SELECT_OFFSET] & 0x0f) << 24) |
+	       (args[IDE_HCYL_OFFSET] << 16) |
+	       (args[IDE_LCYL_OFFSET] << 8) |
+	       (args[IDE_SECTOR_OFFSET]);
+
+	/* sanity check */
+	if(addr == 0) return;
+
+	if(drive->capacity == (addr + 1)) {
+		/* no unclipping needed */
+		return;
+	}
+
+	printk("%s: unclipping drive from %lu sectors to %lu sectors\n",
+		drive->name, drive->capacity, addr + 1);
+
+	/* create IDE/ATA command request structure */
+	args[0] = 0xf9; /* SET_MAX - see ATA spec */
+	args[IDE_FEATURE_OFFSET] = 0x00;
+	args[IDE_NSECTOR_OFFSET] = 0x00;
+	args[IDE_SECTOR_OFFSET] = addr & 0xff;
+	args[IDE_LCYL_OFFSET] = (addr >> 8) & 0xff;
+	args[IDE_HCYL_OFFSET] = (addr >> 16) & 0xff;
+	args[IDE_SELECT_OFFSET] = ((addr >> 24) & 0x0f) | 0x40;
+
+	/* submit command request - if OK, read new max LBA value */
+	if(ide_wait_cmd_task(drive, args) == 0 && (args[0] & 0x01) == 0) {
+		addr = ((args[IDE_SELECT_OFFSET] & 0x0f) << 24) |
+		       (args[IDE_HCYL_OFFSET] << 16) |
+		       (args[IDE_LCYL_OFFSET] << 8) |
+		       (args[IDE_SECTOR_OFFSET]);
+
+		drive->select.b.lba = 1;
+		drive->capacity = addr + 1;
+		drive->cyl = drive->capacity / (drive->head * drive->sect);
+	} else {
+		printk("%s: unclipping drive failed\n", drive->name);
+	}
+}
+
+
 /*
  * Compute drive->capacity, the full capacity of the drive
  * Called with drive->id != NULL.
@@ -518,6 +590,8 @@
 		drive->select.b.lba = 1;
 	}
 	drive->capacity = capacity;
+
+	idedisk_unclip(drive);
 }
 
 static unsigned long idedisk_capacity (ide_drive_t  *drive)
#10 lore raw
In reply to Stephan von Krawczynski

You have it called "STROKE".

Use a patch and execute a soft-clip operation to the device and you are fixed. To bad the kernel maintainers do not see value in this or any other driver that follows the standards for the physical layers.

Regards,

Quoted 28 lines · Stephan von Krawczynski
Quoted 1 line

On Thu, Dec 27, 2001 at 07:51:01PM +0100, Stephan von Krawczynski

Quoted 4 lines · wrote:
Quoted 4 lines

I don't know. I tried once with

00:01.1 IDE interface: Silicon Integrated Systems [SiS] 5513 [IDE]

(rev d0)

Quoted 2 lines
Quoted 2 lines

and it did not work. I could definitely not write beyond the 32 GB

border. I

Quoted 3 lines
Quoted 1 line

replaced the mobo then.

Did you try setmax?

unfortunately not, I did not even know it existed before this thread. I must admit I have still not had a look at it, but on the other hand:
if it makes big IDE drives work on old mobo & bios, it may be a good idea to include its intelligence into the kernel, or not? Yes, I know that people nowadays tend to strip down _old_ stuff from the current sources, but I guess it is not a big loss in code size either, is it?
knock, knock .. hello IDE maintainer, how about a Xmas present ? :-)

Regards,
Stephan

Quoted 6 lines

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

Andre Hedrick
CEO/President, LAD Storage Consulting Group
Linux ATA Development
Linux Disk Certification Project

#12 lore raw
In reply to Josep Lladonosa i Capell
Quoted 5 lines · Josep Lladonosa i Capell

Hello,

the problem is this:

bios only supports disks up to 32 Gb.

I have a 486, bios (as i remember) does not even see the disk.

Quoted 2 lines

hard disk is 60 Gb.

HD is 40Gb

Quoted 3 lines

kernel is 2.4.17

2.4.15-pre9 + tux2 patches

Quoted 7 lines

hard disk reports its correct size when reading parameters from the disk, not from the bios

verd:/proc/ide/hdc# cat geometry
physical     65530/16/63
logical      119150/16/63

[root@head (22:45:56) ~]# cat /proc/ide/hda/geometry
physical 77545/16/63
logical 77545/16/63
[root@head (22:46:07) ~]#

Quoted 8 lines

when booting (dmesg):

hdc: IC35L060AVER07-0, ATA DISK drive
hdc: 66055247 sectors (33820 MB) w/1916KiB Cache, CHS=119150/16/63, UDMA(33)

hda: 78165360 sectors (40021 MB) w/1024KiB Cache, CHS=77545/16/63

Quoted 4 lines

Linux adopts the 'false' geometry (65530/16/63) ) to bypass the bios boot.

All I can say is that I have a /boot partition of about 64 Megs, because I have / formated as reiser so /boot is ext2 because it's from the time that you cannot boot from reiser without notail.

Quoted 6 lines

I know that there are patches for 2.2 kernels and 2.3 kernels, so as linux adopts the logical geometry (a kiddy trick with lba size). They are very simple (a line), but 2.4 ide implementation is (a little more) complicated. Any patch?

Well, it works for me, and as I have said, I have a 486, I'm not sure if the bios supports this size, but I seem to remember that it even does not detect it at boot, or perhaps it detects it as a strange size such as 8Gb or 32Gb, just don't remember.

Linux boots and works for me with no problem in this system.

Quoted 2 lines

Bon Nadal - Merry Christmas

Feliz Navidad.

Quoted 3 lines

--
Salutacions...Josep
http://www.geocities.com/SiliconValley/Horizon/1065/

Signature · 2 lines
Jorge Nerin
<[email protected]>
#11 lore raw
In reply to Andre Hedrick
Quoted 4 lines · Andre Hedrick

You have it called "STROKE".

Use a patch and execute a soft-clip operation to the device and you are fixed.

...depends. I want the big disk to be /dev/hda, and bootable (an unattended boot).

Disk is 119150/16/63. I soft (un)clipped it to max capacity (60Gb) with setmax .

Configured it in the bios (32Gb limit) as a smaller disk, bios complained, telling an error, asking to press F1 to continue. The LBA mode (4111/255/63, LBA, for example) told the error, and asking for F1, as well. With (65530/16/63, NORM), it booted well.
Kernel (2.4.17, patched) corrected the geometry while booting, but mke2fs generated many io-errors, I suspect beyond the 32Gb.

Finally, a bios upgrade (unfortunately not for sizes beyond 32Gb), let me to configure the setup with
the LBA mode, and boot works well, and mke2fs doesn't complain.

I don't need to use setmax to clip-unclip when booting.

What's the meaning of the 65535 max limit in bios_cyl? *

*I don't think it is a kernel limit.
*Is it the max value accepted by the physical disk, and that's why lba is used?

*Was that the problem with the io-errors?

# cat /proc/ide/hdc/settings
name                    value           min             max             mode
----                    -----           ---             ---             ----
bios_cyl                119150          0               65535           rw
bios_head               16              0               255             rw
bios_sect               63              0               63              rw

--
Salutacions...Josep
http://www.geocities.com/SiliconValley/Horizon/1065/
--