Re: [hatari-devel] Small IDE drive image, wrong physical parameters? |
[ Thread Index |
Date Index
| More lists.tuxfamily.org/hatari-devel Archives
]
- To: hatari-devel@xxxxxxxxxxxxxxxxxxx
- Subject: Re: [hatari-devel] Small IDE drive image, wrong physical parameters?
- From: Uwe Seimet <Uwe.Seimet@xxxxxxxxx>
- Date: Sun, 29 May 2016 22:22:08 +0200
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; t=1464553332; l=1849; s=domk; d=seimet.de; h=In-Reply-To:Content-Disposition:Content-Type:MIME-Version: References:Subject:To:From:Date; bh=qSM9Cr/MiDagm86rBxf+1Gz/9eFC9W2vCXWpFLHy5fg=; b=dmlbHfX2q+i3DUTtUK2ooebj5sK440X7L+KV/PdiWcxl7wlKgSgWif8ke1s9qizHa4l W23LsLYJADc9Oxv6cqvQTOPcoYueN8QK6ZKJZNT472pNEBJ/ChjVJ26tVczn7gtKzak+w nKRhUlKyKh5KvKqWGbjvtPelaR45V1tSxcQ=
Hi Thomas,
I see, but in this case in my opinion Hatari should prevent IDE (but not
ACSI, because they work fine) images < 1 MB to be used, because they do
not work and result in errors when relying on the capacity reported for
them.
Take care
Uwe
> Am Sun, 29 May 2016 19:13:16 +0200
> schrieb Uwe Seimet <Uwe.Seimet@xxxxxxxxx>:
>
> > Hi,
> >
> > I wonder whether Hatari correctly sets the physical drive parameters
> > of small IDE drives. With an IDE image file size of 524288 bytes the
> > result according to my calculation is 2016 sectors. This is how I
> > calculate: In case LBA is supported I just use the LBA sector count,
> > if LBA is not supported (LBA sector count is 0) I multiply the nubmer
> > of heads, sectors per track and cylinders.
> >
> > For an image file size of 410009600 bytes the values appear to be
> > correct. Can it be that the values are wrong for the non-LBA case?
>
> Have a look at the following code in ide.c:
>
> /* if no geometry, use a standard physical disk geometry */
> cylinders = nb_sectors / (16 * 63);
> if (cylinders > 16383)
> cylinders = 16383;
> else if (cylinders < 2)
> cylinders = 2;
> s->cylinders = cylinders;
> s->heads = 16;
> s->sectors = 63;
>
> For a file with 524288 bytes, nb_sectors is 524288 / 512 = 1024, so
> cylinders are first calculated to 1. Since 1 is < 2, it is set to 2
> instead. Then you get 2 * 16 * 63 = 2016 sectors instead.
>
> Not sure why there is a limitation to 2 cylinders, but I guess there is
> a reason for this, current QEMU also still has this code.
>
> So I think the it likely simply does not make sense to use IDE hard
> disks with a size less than 1 MB ... even the very first IDE hard disk
> already had 10 MB, so this interface was likely never invented for
> something smaller...
>
> Thomas
>
>