diff options
author | Solomon Peachy <pizza@shaftnet.org> | 2024-07-05 16:00:30 -0400 |
---|---|---|
committer | Solomon Peachy <pizza@shaftnet.org> | 2024-08-12 14:23:44 -0400 |
commit | 15e52374698ba7395ff0ece0d3d70435a66406c4 (patch) | |
tree | 778f81817b2381decc920b49242e91f994f2d8ee /firmware/target/arm/tms320dm320/creative-zvm | |
parent | 9ff308a589f3655453fe047d9b08ca5e2a01f06d (diff) | |
download | rockbox-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/tms320dm320/creative-zvm')
-rw-r--r-- | firmware/target/arm/tms320dm320/creative-zvm/ata-creativezvm.c | 22 | ||||
-rw-r--r-- | firmware/target/arm/tms320dm320/creative-zvm/ata-target.h | 4 |
2 files changed, 14 insertions, 12 deletions
diff --git a/firmware/target/arm/tms320dm320/creative-zvm/ata-creativezvm.c b/firmware/target/arm/tms320dm320/creative-zvm/ata-creativezvm.c index a1985472a0..76929e603e 100644 --- a/firmware/target/arm/tms320dm320/creative-zvm/ata-creativezvm.c +++ b/firmware/target/arm/tms320dm320/creative-zvm/ata-creativezvm.c | |||
@@ -126,8 +126,10 @@ void GIO2(void) | |||
126 | 126 | ||
127 | #define VFAT_SECTOR_SIZE(x) ( (x)/0x8000 ) /* 1GB array requires 80kB of RAM */ | 127 | #define VFAT_SECTOR_SIZE(x) ( (x)/0x8000 ) /* 1GB array requires 80kB of RAM */ |
128 | 128 | ||
129 | extern int ata_read_sectors(IF_MD(int drive,) unsigned long start, int count, void* buf); | 129 | extern int ata_read_sectors(IF_MD(int drive,) sector_t start, int count, void* buf); |
130 | extern int ata_write_sectors(IF_MD(int drive,) unsigned long start, int count, const void* buf); | 130 | extern int ata_write_sectors(IF_MD(int drive,) sector_t start, int count, const void* buf); |
131 | |||
132 | // XXX 64-bit: Due to this it's not likely that this target will ever handle 64-bit storage. | ||
131 | 133 | ||
132 | struct main_header | 134 | struct main_header |
133 | { | 135 | { |
@@ -253,9 +255,9 @@ static void cfs_init(void) | |||
253 | /* Read root inode */ | 255 | /* Read root inode */ |
254 | _ata_read_sectors(CFS_CLUSTER2CLUSTER(cfs->first_inode), 64, §or2); | 256 | _ata_read_sectors(CFS_CLUSTER2CLUSTER(cfs->first_inode), 64, §or2); |
255 | root_inode = (struct cfs_inode*)§or2; | 257 | root_inode = (struct cfs_inode*)§or2; |
256 | 258 | ||
257 | logf("Root inode = 0x%x", root_inode); | 259 | logf("Root inode = 0x%x", root_inode); |
258 | 260 | ||
259 | logf("0x%x 0x%x", CFS_CLUSTER2CLUSTER(root_inode->first_class_chain[0]), root_inode->first_class_chain[0]); | 261 | logf("0x%x 0x%x", CFS_CLUSTER2CLUSTER(root_inode->first_class_chain[0]), root_inode->first_class_chain[0]); |
260 | 262 | ||
261 | /* Read root inode's first sector */ | 263 | /* Read root inode's first sector */ |
@@ -277,9 +279,9 @@ static void cfs_init(void) | |||
277 | vfat_inode_nr = root_direntry_items[i].inode_number; | 279 | vfat_inode_nr = root_direntry_items[i].inode_number; |
278 | } | 280 | } |
279 | } | 281 | } |
280 | 282 | ||
281 | logf("VFAT inode = 0x%x", vfat_inode_nr); | 283 | logf("VFAT inode = 0x%x", vfat_inode_nr); |
282 | 284 | ||
283 | if(vfat_inode_nr != 0) | 285 | if(vfat_inode_nr != 0) |
284 | { | 286 | { |
285 | /* Read VFAT inode */ | 287 | /* Read VFAT inode */ |
@@ -384,19 +386,19 @@ static void cfs_init(void) | |||
384 | cfs_inited = true; | 386 | cfs_inited = true; |
385 | } | 387 | } |
386 | 388 | ||
387 | static inline unsigned long map_sector(unsigned long sector) | 389 | static inline sector_t map_sector(sector_t sector) |
388 | { | 390 | { |
389 | /* | 391 | /* |
390 | * Sector mapping: start of CFS + FAT_SECTOR2CFS_SECTOR(sector) + missing part | 392 | * Sector mapping: start of CFS + FAT_SECTOR2CFS_SECTOR(sector) + missing part |
391 | * FAT works with sectors of 0x200 bytes, CFS with sectors of 0x8000 bytes. | 393 | * FAT works with sectors of 0x200 bytes, CFS with sectors of 0x8000 bytes. |
392 | */ | 394 | */ |
393 | #ifndef BOOTLOADER | 395 | #ifndef BOOTLOADER |
394 | unsigned long *sectors = core_get_data(sectors_handle); | 396 | sector_t *sectors = core_get_data(sectors_handle); |
395 | #endif | 397 | #endif |
396 | return cfs_start+sectors[sector/64]*64+sector%64; | 398 | return cfs_start+sectors[sector/64]*64+sector%64; |
397 | } | 399 | } |
398 | 400 | ||
399 | int ata_read_sectors(IF_MD(int drive,) unsigned long start, int count, void* buf) | 401 | int ata_read_sectors(IF_MD(int drive,) sector_t start, int count, void* buf) |
400 | { | 402 | { |
401 | if(!cfs_inited) | 403 | if(!cfs_inited) |
402 | cfs_init(); | 404 | cfs_init(); |
@@ -423,7 +425,7 @@ int ata_read_sectors(IF_MD(int drive,) unsigned long start, int count, void* buf | |||
423 | } | 425 | } |
424 | } | 426 | } |
425 | 427 | ||
426 | int ata_write_sectors(IF_MD(int drive,) unsigned long start, int count, const void* buf) | 428 | int ata_write_sectors(IF_MD(int drive,) sector_t start, int count, const void* buf) |
427 | { | 429 | { |
428 | if(!cfs_inited) | 430 | if(!cfs_inited) |
429 | cfs_init(); | 431 | cfs_init(); |
diff --git a/firmware/target/arm/tms320dm320/creative-zvm/ata-target.h b/firmware/target/arm/tms320dm320/creative-zvm/ata-target.h index d0aa12e040..41b8e73ad4 100644 --- a/firmware/target/arm/tms320dm320/creative-zvm/ata-target.h +++ b/firmware/target/arm/tms320dm320/creative-zvm/ata-target.h | |||
@@ -36,8 +36,8 @@ | |||
36 | /* Nasty hack, but Creative is nasty... */ | 36 | /* Nasty hack, but Creative is nasty... */ |
37 | #define ata_read_sectors _ata_read_sectors | 37 | #define ata_read_sectors _ata_read_sectors |
38 | #define ata_write_sectors _ata_write_sectors | 38 | #define ata_write_sectors _ata_write_sectors |
39 | extern int _ata_read_sectors(IF_MD(int drive,) unsigned long start, int count, void* buf); | 39 | extern int _ata_read_sectors(IF_MD(int drive,) sector_t start, int count, void* buf); |
40 | extern int _ata_write_sectors(IF_MD(int drive,) unsigned long start, int count, const void* buf); | 40 | extern int _ata_write_sectors(IF_MD(int drive,) sector_t start, int count, const void* buf); |
41 | 41 | ||
42 | /* General purpose memory region #1 */ | 42 | /* General purpose memory region #1 */ |
43 | #define ATA_IOBASE 0x50FEE000 | 43 | #define ATA_IOBASE 0x50FEE000 |