Commit graph

8 commits

Author SHA1 Message Date
Solomon Peachy
dfbbfb12d4 storage: Misc corrections and cleanups
* Make the partial sector logic a little clearer (no functional change)
 * Corrections for debugging messages
 * Also use MAX_VIRT_SECTOR_SIZE in BOUNCE_BUFFER calculations

Change-Id: I89363824b092b2e3bddd5e0f75bf81200c9bc513
2024-11-26 08:37:55 -05:00
Solomon Peachy
9bf033dd66 ata: Prefer using "virtual" sector size where possible
Normally, if a device uses larger physical sector size than the logical
size and supports so-called "512e" mode, we let the device deal with
partial sector reads/writes.

However, if MAX_VIRT_SECTOR_SIZE is defined, we support
partitioning/filesystems that use a larger "virtual" sector than the
logical sector.  typically this matches the physical sector size of the
drive, which means that despite a small logical sector size, all I/O
is done in terms of the physical sector size.

Therefore, when MAX_VIRT_SECTOR_SIZE and MAX_PHYS_SECTOR_SIZE are
enabled (currently only ipod5g and ipod6g), prefer software-based
partial sector I/O.

Change-Id: I0815ad0a2f987b89bb2debfbf3d0ed64cdf85525
2024-11-15 07:24:08 -05:00
Solomon Peachy
120906dc8b ata: Ensure that the bounce buffer is minimum 32-bit aligned
Basically, if STORAGE_ALIGN_ATTR isn't defined, define it to be
sizeof(uint32_t) in the ATA code.

Change-Id: I13de61788cb71e3e8d3a956ab5f2e251471ce76d
2024-11-15 07:24:08 -05:00
Solomon Peachy
d0aaa37d33 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
2024-11-13 07:27:56 -05:00
Solomon Peachy
c61ad40812 storage: Wrap runtime variable sector size with MAX_VARIABLE_LOG_SECTOR
When enabled this allows 512n and 4Kn drives to be used with a single build.
(So far all ATA SSDs use 512 byte logical sectors)

Change-Id: I902d2318ca8abb581699c0bca68d6e3ec227d064
2024-11-09 16:34:06 -05:00
Solomon Peachy
bc6c189dcb storage: rename MAX_LOG_SECTOR_SIZE to MAX_VIRT_SECTOR_SIZE
Change-Id: I34f00748c1b0935d65af5f0fc6bdd13356ff31e1
2024-11-09 16:32:40 -05:00
Solomon Peachy
e29ddfb6be ata: Support for ATA logical sector sizes > 512B
Basically this requires un-hardcoding SECTOR_SIZE everywhere, in
favor of using a variable containing what was reported in IDENTIFY INFO.

Note that the rest of the storage subsystem still needs to be fixed up!

Change-Id: I7f2dbd54ff2bc16b15010721e011949cbf308e12
2024-11-07 07:48:17 -05:00
Solomon Peachy
2824bd5f16 ipod6g: Support MAX_PHYS_SECTOR_SIZE of 4K
This lets us *natively* handle varying physical sector sizes
without playing games and lying about the logical sector size.

(The original drives use 4K _physical_ sectors with 512B logical
 sectors, but you have to access everything in 4K blocks...)

Achieve this by splitting the MAX_PHYS_SECTOR_SIZE code out
of the main ATA driver and re-using it.

Change-Id: I0bc615ab4562f1e3e83171a8633c74fb60c7da1f
2024-11-04 07:33:26 -05:00