Re: [hatari-devel] Patch: IDE support for sector sizes > 512 bytes |
[ Thread Index |
Date Index
| More lists.tuxfamily.org/hatari-devel Archives
]
- To: hatari-devel@xxxxxxxxxxxxxxxxxxx
- Subject: Re: [hatari-devel] Patch: IDE support for sector sizes > 512 bytes
- From: Uwe Seimet <Uwe.Seimet@xxxxxxxxx>
- Date: Sun, 20 Oct 2019 18:50:19 +0200
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; t=1571590219; s=strato-dkim-0002; d=seimet.de; h=In-Reply-To:References:Message-ID:Subject:To:From:Date: X-RZG-CLASS-ID:X-RZG-AUTH:From:Subject:Sender; bh=kBIcLs/6ZZkRXzsnnFtsYgIchULflH4oHKL/DCgQnjU=; b=dQ1kBiG7ZWBRiBHVkJKVA9TmAtcHiNiE7VQxiejbCNGWL6TdIeS+kc1btgoRmGSoVo 3SP1vsFDpC0z++RbpHRku8xZqkqlkYkyBejRaNNQBAjiNERlHETNjy2LTcbwLLGqaHOv WeKZMk+g4SzDoDPbUcCM3/u1vDID/GMOicd8KlvDK4JO91lAigDcvTUgteKKGPTuF5bE hovtlbGyYeMb8wMQuldh8ns6sfIxPTREkB71xZFqvo0Nod2HRPqGQPNRYEn++AKwrkoc FGjw1AcndVPGWob0AHjD/93s7zNFh4RLu2e26fKRiCtrUGPdSflM/Y7yNjsEr50gfSjR 6laQ==
Yes, this patch fixes it, thank you.
> Am Sun, 20 Oct 2019 09:25:00 +0200
> schrieb Uwe Seimet <Uwe.Seimet@xxxxxxxxx>:
>
> > Hi,
> >
> > > Ok, it took a little bit longer (sorry!), but I've now finally
> > > checked the QEMU sources more closely to see whether it's also
> > > wrong there. It's not. QEMU's bdrv_get_geometry() function is
> > > simply always calculating with 512 byte sectors, no matter whether
> > > it's an CD-ROM drive or a normal hard disk. That's why they've got
> > > the "total_sectors
> > > >>= 2" shifts there. But since we're calculating with 2048 byte
> > > >>sectors
> > > in Hatari, we can remove these shifts indeed.
> > >
> > > I've pushed a fix to the repository now. Uwe, could you please check
> > > whether it's working as expected?
> >
> > It's almost working. I was able to successfully use an image
> > configured with 4096 bytes per sector just like a regular 4KN SATA
> > drive. What's not yet correct is the capacity displayed by Hatari in
> > the drive name, see attached screenshot. Hatari does not yet use the
> > right sector size for the capacity calculation.
>
> Does that patch fix the problem:
>
> diff --git a/src/ide.c b/src/ide.c
> --- a/src/ide.c
> +++ b/src/ide.c
> @@ -983,7 +983,8 @@ static void ide_identify(IDEState *s)
> padstr((char *)(p + 23), FW_VERSION, 8); /* firmware version */
> /* Use the same convention for the name as SCSI disks are using: The
> * first 8 characters should be the vendor, i.e. use 2 spaces here */
> - snprintf(buf, sizeof(buf), "Hatari IDE disk %liM", (long)(s->nb_sectors / 2048));
> + snprintf(buf, sizeof(buf), "Hatari IDE disk %liM",
> + (long)(s->nb_sectors / (1024 * 1024 / s->bs->sector_size)));
> padstr((char *)(p + 27), buf, 40);
> #if MAX_MULT_SECTORS > 1
> put_le16(p + 47, 0x8000 | MAX_MULT_SECTORS);
>
> ?
>
> Thomas
>
>