summaryrefslogtreecommitdiff
path: root/firmware/target/arm/s5l8702/ipod6g/storage_ata-6g.c
diff options
context:
space:
mode:
authorSolomon Peachy <pizza@shaftnet.org>2024-07-05 16:00:30 -0400
committerSolomon Peachy <pizza@shaftnet.org>2024-08-12 14:23:44 -0400
commit15e52374698ba7395ff0ece0d3d70435a66406c4 (patch)
tree778f81817b2381decc920b49242e91f994f2d8ee /firmware/target/arm/s5l8702/ipod6g/storage_ata-6g.c
parent9ff308a589f3655453fe047d9b08ca5e2a01f06d (diff)
downloadrockbox-15e52374698ba7395ff0ece0d3d70435a66406c4.tar.gz
rockbox-15e52374698ba7395ff0ece0d3d70435a66406c4.zip
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
Diffstat (limited to 'firmware/target/arm/s5l8702/ipod6g/storage_ata-6g.c')
-rw-r--r--firmware/target/arm/s5l8702/ipod6g/storage_ata-6g.c11
1 files changed, 5 insertions, 6 deletions
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 @@
58#define CEATA_DAT_NONBUSY_TIMEOUT 5000000 58#define CEATA_DAT_NONBUSY_TIMEOUT 5000000
59#define CEATA_MMC_RCA 1 59#define CEATA_MMC_RCA 1
60 60
61
62/** static, private data **/ 61/** static, private data **/
63static uint8_t ceata_taskfile[16] STORAGE_ALIGN_ATTR; 62static uint8_t ceata_taskfile[16] STORAGE_ALIGN_ATTR;
64static uint16_t ata_identify_data[0x100] STORAGE_ALIGN_ATTR; 63static uint16_t ata_identify_data[ATA_IDENTIFY_WORDS] STORAGE_ALIGN_ATTR;
65static bool ceata; 64static bool ceata;
66static bool ata_lba48; 65static bool ata_lba48;
67static bool ata_dma; 66static bool ata_dma;
@@ -510,7 +509,7 @@ static int ata_identify(uint16_t* buf)
510 ata_write_cbr(&ATA_PIO_DVR, 0); 509 ata_write_cbr(&ATA_PIO_DVR, 0);
511 ata_write_cbr(&ATA_PIO_CSD, CMD_IDENTIFY); 510 ata_write_cbr(&ATA_PIO_CSD, CMD_IDENTIFY);
512 PASS_RC(ata_wait_for_start_of_transfer(10000000), 1, 1); 511 PASS_RC(ata_wait_for_start_of_transfer(10000000), 1, 1);
513 for (i = 0; i < 0x100; i++) buf[i] = ata_read_cbr(&ATA_PIO_DTR); 512 for (i = 0; i < ATA_IDENTIFY_WORDS; i++) buf[i] = ata_read_cbr(&ATA_PIO_DTR);
514 } 513 }
515 return 0; 514 return 0;
516} 515}
@@ -701,7 +700,7 @@ static int ata_power_up(void)
701 | (((uint64_t)ata_identify_data[103]) << 48); 700 | (((uint64_t)ata_identify_data[103]) << 48);
702 else 701 else
703 ata_total_sectors = ata_identify_data[60] | (((uint32_t)ata_identify_data[61]) << 16); 702 ata_total_sectors = ata_identify_data[60] | (((uint32_t)ata_identify_data[61]) << 16);
704 ata_total_sectors >>= 3; 703 ata_total_sectors >>= 3; /* ie SECTOR_SIZE/512. */
705 ata_powered = true; 704 ata_powered = true;
706 ata_set_active(); 705 ata_set_active();
707 return 0; 706 return 0;
@@ -966,7 +965,7 @@ static int ata_reset(void)
966 return rc; 965 return rc;
967} 966}
968 967
969int ata_read_sectors(IF_MD(int drive,) unsigned long start, int incount, 968int ata_read_sectors(IF_MD(int drive,) sector_t start, int incount,
970 void* inbuf) 969 void* inbuf)
971{ 970{
972 mutex_lock(&ata_mutex); 971 mutex_lock(&ata_mutex);
@@ -975,7 +974,7 @@ int ata_read_sectors(IF_MD(int drive,) unsigned long start, int incount,
975 return rc; 974 return rc;
976} 975}
977 976
978int ata_write_sectors(IF_MD(int drive,) unsigned long start, int count, 977int ata_write_sectors(IF_MD(int drive,) sector_t start, int count,
979 const void* outbuf) 978 const void* outbuf)
980{ 979{
981 mutex_lock(&ata_mutex); 980 mutex_lock(&ata_mutex);