From 9644bb5d9d441597eb28036eabae4c7c1fb9c414 Mon Sep 17 00:00:00 2001 From: Solomon Peachy Date: Tue, 16 Sep 2025 14:59:01 -0400 Subject: [PATCH] ipod6g: CE-ATA uses a 4K block size at minimum Therefore, turn on MAX_VARIABLE_LOG_SECTOR so we can support 512B and 4K sector sizes. Additionally, correct the interpretation of identify info word 106 in CE-ATA mode. Change-Id: I24dc7dd4a8617fcb60ed87c0c1be98d00dbdfa30 --- firmware/export/config/ipod6g.h | 2 +- firmware/target/arm/s5l8702/ipod6g/storage_ata-6g.c | 10 ++++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/firmware/export/config/ipod6g.h b/firmware/export/config/ipod6g.h index e84c5a0951..d1cb511bb5 100644 --- a/firmware/export/config/ipod6g.h +++ b/firmware/export/config/ipod6g.h @@ -203,7 +203,7 @@ #define MAX_PHYS_SECTOR_SIZE 4096 /* define this if we want to support 512n and 4Kn drives */ -//#define MAX_VARIABLE_LOG_SECTOR 4096 +#define MAX_VARIABLE_LOG_SECTOR 4096 #define HAVE_HARDWARE_CLICK diff --git a/firmware/target/arm/s5l8702/ipod6g/storage_ata-6g.c b/firmware/target/arm/s5l8702/ipod6g/storage_ata-6g.c index 73806c7303..9f91398bda 100644 --- a/firmware/target/arm/s5l8702/ipod6g/storage_ata-6g.c +++ b/firmware/target/arm/s5l8702/ipod6g/storage_ata-6g.c @@ -1170,9 +1170,19 @@ int ata_init(void) /* Logical sector size */ if ((identify_info[106] & 0xd000) == 0x5000) /* B14, B12 */ log_sector_size = (identify_info[117] | (identify_info[118] << 16)) * 2; + else if (ceata) + log_sector_size = 1 << identify_info[106]; else log_sector_size = 512; +#ifndef MAX_VARIABLE_LOG_SECTOR + if (log_sector_size != SECTOR_SIZE) + panicf("Bad logical sector size (%ld)", log_sector_size); +#else + if (log_sector_size > MAX_VARIABLE_LOG_SECTOR) + panicf("Logical sector size too large (%ld)", log_sector_size); +#endif + #ifdef MAX_PHYS_SECTOR_SIZE rc = ata_get_phys_sector_mult(); if (IS_ERR(rc))