From 15e52374698ba7395ff0ece0d3d70435a66406c4 Mon Sep 17 00:00:00 2001 From: Solomon Peachy Date: Fri, 5 Jul 2024 16:00:30 -0400 Subject: storage: 64-bit sector offsets * Create new 'sector_t' type alias: * uint64_t for all targets with HAVE_LBA48 or HAVE_SDUC * unsigned long for the everything else * Alter all storage APIs to use sector_t instead of 'unsigned long' * Alter Volume/Partition/storage info structures to use sector_t * Disk cache converted to sector_t * ATA Core: * convert to using sector_t for sector addresses and drive sizes * Always fill out upper 16 bits of LBA48 addresses * IDENTIFY INFO is fixed at 512 bytes, not SECTOR_SIZE * USB mass storage: * convert to using sector_t for sector addesses and drive sizes * Implement READ_16/WRITE_16 for LBA48 addresses * Convert FAT code to use sector_t for all sector references * output_dyn_value() now accepts int64_t instead of 'int' * Corrected "rockbox info" to work for (MULTIVOLUME & !MULTIDRIVE) * Better reporting of disk and (logical+physical) sector sizes in debug info * Detect SDUC cards and report on storage debug_info screen To-do: SDUC * Refactor SD core to remove duplicate code in every driver * Card probe and init state machine * Implement core SDUC support * SD2.0 needs to be 2.0+ (fixed for jz47xx and x1000) * Host and Card ID (ACMD41) * 32-bit addressing for all read/write/erase operations (CMD22) * ADD SDUC to target device drivers, defining HAVE_SDUC as appropriate Change-Id: Ib0138781a0081664d11511037685503df1b93608 --- firmware/target/arm/s5l8702/ipod6g/storage_ata-6g.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) (limited to 'firmware/target/arm/s5l8702/ipod6g/storage_ata-6g.c') diff --git a/firmware/target/arm/s5l8702/ipod6g/storage_ata-6g.c b/firmware/target/arm/s5l8702/ipod6g/storage_ata-6g.c index 7a3be20577..9629b3e30f 100644 --- a/firmware/target/arm/s5l8702/ipod6g/storage_ata-6g.c +++ b/firmware/target/arm/s5l8702/ipod6g/storage_ata-6g.c @@ -58,10 +58,9 @@ #define CEATA_DAT_NONBUSY_TIMEOUT 5000000 #define CEATA_MMC_RCA 1 - /** static, private data **/ static uint8_t ceata_taskfile[16] STORAGE_ALIGN_ATTR; -static uint16_t ata_identify_data[0x100] STORAGE_ALIGN_ATTR; +static uint16_t ata_identify_data[ATA_IDENTIFY_WORDS] STORAGE_ALIGN_ATTR; static bool ceata; static bool ata_lba48; static bool ata_dma; @@ -510,7 +509,7 @@ static int ata_identify(uint16_t* buf) ata_write_cbr(&ATA_PIO_DVR, 0); ata_write_cbr(&ATA_PIO_CSD, CMD_IDENTIFY); PASS_RC(ata_wait_for_start_of_transfer(10000000), 1, 1); - for (i = 0; i < 0x100; i++) buf[i] = ata_read_cbr(&ATA_PIO_DTR); + for (i = 0; i < ATA_IDENTIFY_WORDS; i++) buf[i] = ata_read_cbr(&ATA_PIO_DTR); } return 0; } @@ -701,7 +700,7 @@ static int ata_power_up(void) | (((uint64_t)ata_identify_data[103]) << 48); else ata_total_sectors = ata_identify_data[60] | (((uint32_t)ata_identify_data[61]) << 16); - ata_total_sectors >>= 3; + ata_total_sectors >>= 3; /* ie SECTOR_SIZE/512. */ ata_powered = true; ata_set_active(); return 0; @@ -966,7 +965,7 @@ static int ata_reset(void) return rc; } -int ata_read_sectors(IF_MD(int drive,) unsigned long start, int incount, +int ata_read_sectors(IF_MD(int drive,) sector_t start, int incount, void* inbuf) { mutex_lock(&ata_mutex); @@ -975,7 +974,7 @@ int ata_read_sectors(IF_MD(int drive,) unsigned long start, int incount, return rc; } -int ata_write_sectors(IF_MD(int drive,) unsigned long start, int count, +int ata_write_sectors(IF_MD(int drive,) sector_t start, int count, const void* outbuf) { mutex_lock(&ata_mutex); -- cgit v1.2.3