From a8c52b1bfb8fd4333cffc6a1d9eff830bd35dba5 Mon Sep 17 00:00:00 2001 From: Solomon Peachy Date: Sat, 2 Nov 2024 09:41:26 -0400 Subject: disk: Support a non-fixed (logical) SECTOR_SIZE This allows a single build to support ATA drives with (eg) 512B and 4K logical sector sizes. This is needed because ATA drives are user- replaceable and we don't know what could get plugged in. * Add disk_get_log_sector_size() API (no-op for non-ATA storage) * Mostly a no-op if MAX_LOG_SECTOR_SIZE is not enabled * Sanity-check that storage's logical sector size is not larger than what we're built for NOTE: Other layers (eg ATA, FAT, etc) still need to be made aware of this. Change-Id: Id6183ef0573cb0778fa9a91302e600c3e710eebd --- firmware/export/disk.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'firmware/export/disk.h') diff --git a/firmware/export/disk.h b/firmware/export/disk.h index a19e011170..4f11438b1b 100644 --- a/firmware/export/disk.h +++ b/firmware/export/disk.h @@ -47,10 +47,12 @@ int disk_mount(int drive); int disk_unmount_all(void); int disk_unmount(int drive); -/* The number of 512-byte sectors in a "logical" sector. Needed for ipod 5.5G */ +/* Used when the drive's logical sector size is smaller than the sector size used by the partition table and filesystem. Notably needed for ipod 5.5G/6G. */ #ifdef MAX_LOG_SECTOR_SIZE int disk_get_sector_multiplier(IF_MD_NONVOID(int drive)); #endif +/* The size of the drive's smallest addressible unit */ +int disk_get_log_sector_size(IF_MD_NONVOID(int drive)); bool disk_present(IF_MD_NONVOID(int drive)); -- cgit v1.2.3