Same HD, same settings, different geometry

Luca Montecchiani (m.luca@iname.com)
Sat, 19 Jun 1999 01:30:30 +0200


Hi all,
in my Pc I've two IDE, hda ( primary on 1ide ) and hdc ( primary on 2ide ) the
bios settings on the motherboard is auto/LBA for all 4 ide channels.

The facts on kernel 2.x.x
-------------------------
When linux boots hda show the "bios" geometry (LBA), and hdc show the physical
geometry. This worry me, but everything work fine and /proc/ide/hd*/geometry
is my friend. Seeing those difference, especially in my office machine where
hda and hdc are the same models make me unhappy :(
I started to look in the code ( 2.2.10 ) to understand why...
In short only hd's on the primary ide interface will showed with their bios/cmos
geometry.

The upatch against 2.2.10
-------------------------
The upatch I've write to make me happy add a new "nocmosgeom" parameter that
skip bios/cmos query to retrieve the geometry for the specified HD.

hdx=nocmosgeom

--- ide.c.ori Sat Jun 19 00:22:28 1999
+++ ide.c Sat Jun 19 01:04:39 1999
@@ -2412,7 +2412,7 @@
if (s[0] == 'h' && s[1] == 'd' && s[2] >= 'a' && s[2] <= max_drive) {
const char *hd_words[] = {"none", "noprobe", "nowerr", "cdrom",
"serialize", "autotune", "noautotune",
- "slow", "swapdata", "bswap", NULL};
+ "slow", "swapdata", "bswap","nocmosgeom", NULL};
unit = s[2] - 'a';
hw = unit / MAX_DRIVES;
unit = unit % MAX_DRIVES;
@@ -2452,6 +2452,9 @@
case -9: /* swapdata or bswap */
case -10:
drive->bswap = 1;
+ goto done;
+ case -11: /* "nocmosgeom" */
+ drive->present = 1;
goto done;
case 3: /* cyl,head,sect */
drive->media = ide_disk;

Comment
-------
Maybe nowadays an inverted logic is better , query the bios/cmos only when
is absolutely necessary, think about "usecmosgeom" parameter...
What the plans for 2.3.x ??

Screenshots
-----------
2.0.36 / 2.2.10
hda: Maxtor 84320D4, 4028MB w/256kB Cache, CHS=1023/128/63, UDMA
hdc: WDC AC24300L, 4112MB w/256kB Cache, CHS=8912/15/63, UDMA
Partition check:
hda: hda1 hda2 hda3 hda4
hdc: [PTBL] [524/255/63] hdc1 hdc2

2.3.5
hda: Maxtor 84320D4, 4028MB w/256kB Cache, CHS=1023/128/63, UDMA(33)
hdc: WDC AC24300L, 4112MB w/256kB Cache, CHS=8912/15/63, UDMA(33)
Partition check:
hda: hda1 hda2 hda3 hda4
hdc: [PTBL] [524/255/63] hdc1 hdc2

2.2.10 hda=nocmosgeom
hda: Maxtor 84320D4, 4028MB w/256kB Cache, CHS=8184/16/63, UDMA
hdc: WDC AC24300L, 4112MB w/256kB Cache, CHS=8912/15/63, UDMA
Partition check:
hda: [PTBL] [1023/128/63] hda1 hda2 hda3 hda4
hdc: [PTBL] [524/255/63] hdc1 hdc2

Disclamier
----------
WARNING ! I'm totally aware from IDE/ATA/bios things so my words/code can be
totally wrong !! Be carfully and wait for real guru reply ;)

Biography
---------
>From ide.txt
:
Drives are normally found by auto-probing and/or examining the CMOS/BIOS data.
For really weird situations, the apparent (fdisk) geometry can also be
specified.....
:
Neither of these limitations affects Linux itself, as it (1) does not use the
BIOS for disk access, and it (2) is clever enough to use the "sector count"
fields of the partition table instead of the physical CHS geometry fields.
:
>From ide-probe.c
:
/*
* 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
* Furthermore, we will assume that our ST-506 drives <if any> are the primary
* drives in the system -- 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. A non-zero value
* means we have an AT controller hard disk for that drive.
*
* Of course, there is no guarantee that either drive is actually on the
* "primary" IDE interface, but we don't bother trying to sort that out here.
* If a drive is not actually on the primary interface, then these parameters
* will be ignored. This results in the user having to supply the logical
* drive geometry as a boot parameter for each drive not on the primary i/f.
*
* The only "perfect" way to handle this would be to modify the setup.[cS] code
* to do BIOS calls Int13h/Fn08h and Int13h/Fn48h to get all of the drive info
* for us during initialization. I have the necessary docs -- any takers? -ml
*/
static void probe_cmos_for_drives (ide_hwif_t *hwif)
{
:

any comments ?

luca
_______________________________________________________________
Aiem...: Luca Montecchiani W.W.W.: http://i.am/m.luca
E-mail.: m.luca@iname.com Kernel: 2.2
I.R.C..: defrag (#linux-it) I.C.Q.: 17655604
PGP5.0i: available on my home page Lime98: io c'ero ;)
_______________________________________________________________

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/