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: Thomas Huth <th.huth@xxxxxxxxx>
- Date: Sun, 20 Oct 2019 14:00:12 +0200
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.de; s=2017; t=1571573027; bh=WpDBUhmGIP96t+JNYU2AuAvJ0/xvyYCt+Tuo9YG55Bo=; h=Date:From:To:Subject:From; b=I+vRLunHOWdA/SKMaioh/39cELhlIutiZbBS1sH0xqkwAef20JcHUF9nYnDquZOtx 3N92PzSRgCGZ4r7AiFaiGi8qzcrkIy8Y0LqUVw3rLbACGWpSLCi3E9hmJH6klB31Fm eeALqPija6cg2t6mU2VNyGD+riy8uEId/i1tQ9CtwieuuSygLNFzq/YS7+w0kKqSw8 y5pLIJgvy3DfvuzS4gJncNHo6VTquqGeeb6FBUXpdriwedGvH7wS9er2a3Ek+5mwEJ wjJrjcEMFMAL6ybAoOPkowROw4EUqEZG0P4DAi8IWL7w2KYg2Q+Jty4fXFWTkSMDxm H0f+qud6/34Dw==
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