From: Andre Hedrick <andre@linuxdiskcert.org>
To: Andries.Brouwer@cwi.nl
Cc: Alan Cox <alan@lxorguk.ukuu.org.uk>, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] tiny IDE fixes
Date: Sat, 9 Feb 2002 18:53:44 -0800 (PST) [thread overview]
Message-ID: <Pine.LNX.4.10.10202091853120.20733-100000@master.linux-ide.org> (raw)
In-Reply-To: <UTC200202100120.BAA52437.aeb@cwi.nl>
Yep, fixed that a few nights ago ...
On Sun, 10 Feb 2002 Andries.Brouwer@cwi.nl wrote:
> In order to use all of my 160 GB disk, I booted linux-2.4.18-pre7-ac3
> and was told that it had geometry 317632/255/63, a disk of terabyte size.
> Moving the assignment to cyls two lines this becomes 19929/255/63,
> as expected.
>
> The deleted part in the first hunk is dead code.
>
> As remarked earlier, all addr++ should be done only when
> something was assigned to addr. Maybe there are more such places.
>
> Apart from such tiny flaws, everything works beautifully.
>
> Andre, in this geometry stuff more than half of the code can be
> deleted. For example, drive->CHS is used when talking CHS with
> the drive; no use assigning very large values to drive->C; nobody
> will ever use such values. Then again, bios_CHS is what the BIOS
> tells us, which is to be used by fdisk and lilo.
> Again, no use assigning very large values to bios_cyl.
> fdisk has only 10 bits to write these values in,
> lilo cannot use more than 16 bits.
> In particular, the ioctl HDIO_GETGEO_BIG is superfluous.
>
> I said it before and I repeat: I really hope that you remove
> all occurrences of HDIO_GETGEO_BIG. The values returned by it
> are not used by fdisk, or by lilo, or by the kernel, or by
> the disk drive, they are just nonsense numbers.
>
> The convention for the use of HDIO_GETGEO is:
> Get heads and sectors from HDIO_GETGEO. In case one wants
> cylinders, ask for total size with BLKGETSIZE and divide by
> heads*sectors. Consider the cyls field of the struct returned
> by HDIO_GETGEO to be undefined.
>
> Andries
>
>
> diff -u --recursive --new-file ../linux-2.4.18-pre7-ac3/linux/drivers/ide/ide-disk.c ./linux/drivers/ide/ide-disk.c
> --- ../linux-2.4.18-pre7-ac3/linux/drivers/ide/ide-disk.c Mon Feb 11 02:53:28 2002
> +++ ./linux/drivers/ide/ide-disk.c Mon Feb 11 02:28:09 2002
> @@ -111,11 +111,6 @@
> {
> unsigned long lba_sects, chs_sects, head, tail;
>
> - if ((id->command_set_2 & 0x0400) && (id->cfs_enable_2 & 0x0400)) {
> - printk("48-bit Drive: %llu \n", id->lba_capacity_2);
> - return 1;
> - }
> -
> /*
> * The ATA spec tells large drives to return
> * C/H/S = 16383/16/63 independent of their size.
> @@ -789,8 +784,8 @@
> | ((args.tfRegister[ IDE_HCYL_OFFSET] ) << 16)
> | ((args.tfRegister[ IDE_LCYL_OFFSET] ) << 8)
> | ((args.tfRegister[IDE_SECTOR_OFFSET] ));
> + addr++; /* since the return value is (maxlba - 1), we add 1 */
> }
> - addr++; /* since the return value is (maxlba - 1), we add 1 */
> return addr;
> }
>
> @@ -818,8 +813,8 @@
> ((args.tfRegister[IDE_LCYL_OFFSET])<<8) |
> (args.tfRegister[IDE_SECTOR_OFFSET]);
> addr = ((__u64)high << 24) | low;
> + addr++; /* since the return value is (maxlba - 1), we add 1 */
> }
> - addr++; /* since the return value is (maxlba - 1), we add 1 */
> return addr;
> }
>
> @@ -850,8 +845,8 @@
> | ((args.tfRegister[ IDE_HCYL_OFFSET] ) << 16)
> | ((args.tfRegister[ IDE_LCYL_OFFSET] ) << 8)
> | ((args.tfRegister[IDE_SECTOR_OFFSET] ));
> + addr_set++;
> }
> - addr_set++;
> return addr_set;
> }
>
> @@ -929,9 +924,9 @@
>
> if (id->cfs_enable_2 & 0x0400) {
> capacity_2 = id->lba_capacity_2;
> - drive->cyl = (unsigned int) capacity_2 / (drive->head * drive->sect);
> drive->head = drive->bios_head = 255;
> drive->sect = drive->bios_sect = 63;
> + drive->cyl = (unsigned int) capacity_2 / (drive->head * drive->sect);
> drive->select.b.lba = 1;
> set_max_ext = idedisk_read_native_max_address_ext(drive);
> if (set_max_ext > capacity_2) {
> -
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at http://www.tux.org/lkml/
>
Andre Hedrick
Linux Disk Certification Project Linux ATA Development
prev parent reply other threads:[~2002-02-10 3:04 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-02-10 1:20 Andries.Brouwer
2002-02-10 2:53 ` Andre Hedrick [this message]
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=Pine.LNX.4.10.10202091853120.20733-100000@master.linux-ide.org \
--to=andre@linuxdiskcert.org \
--cc=Andries.Brouwer@cwi.nl \
--cc=alan@lxorguk.ukuu.org.uk \
--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
all inboxes | Powered by JetHome®