diff options
author | Solomon Peachy <pizza@shaftnet.org> | 2024-11-13 07:24:59 -0500 |
---|---|---|
committer | Solomon Peachy <pizza@shaftnet.org> | 2024-11-13 07:27:56 -0500 |
commit | d0aaa37d33ce1e64d335d7de4d096895881c6c53 (patch) | |
tree | 286a4d77f208325ed61223db92ad37b2f01d0925 | |
parent | 044ba60bcfbf74c26ba859b8a5ad41832486a707 (diff) | |
download | rockbox-d0aaa37d33.tar.gz rockbox-d0aaa37d33.zip |
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
-rw-r--r-- | firmware/drivers/ata-common.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/firmware/drivers/ata-common.c b/firmware/drivers/ata-common.c index c8af99b60a..e09abd091d 100644 --- a/firmware/drivers/ata-common.c +++ b/firmware/drivers/ata-common.c @@ -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 |