ata: Panic if we get a drive with unaligned logical sectors.

If identify device word 209 is valid, check to see if the drive report
on the alignment of LBA0 with respect to physical sector 0.

If it's not aligned, bail immediately.  Supporting this properly
won't be hard, but it's not someting we want to do unless necessary.

Change-Id: I3d5bb8fad9e32fff43dfb6454393728d7c01b93b
This commit is contained in:
Solomon Peachy 2024-11-13 07:24:59 -05:00
parent 044ba60bcf
commit d0aaa37d33

View file

@ -220,6 +220,15 @@ static int ata_get_phys_sector_mult(void)
DEBUGF("ata: %d logical sectors per phys sector", phys_sector_mult);
if((identify_info[209] & 0xc000) == 0x4000) { /* B14 */
if (identify_info[209] & 0x3fff) {
panicf("ata: Unaligned logical/physical sector mapping");
// XXX we can probably handle this by adding a fixed offset
// to all operations and subtracting this from the reported
// size. But we don't do tihs until we find a real-world need.
}
}
if (phys_sector_mult > 1)
{
/* Check if drive really needs emulation - if we can access