mirror of
https://github.com/Rockbox/rockbox.git
synced 2025-12-09 13:15:18 -05:00
iPod Classic storage driver: Fix some implicit casts, typos, ...
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29640 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
688545ea16
commit
26f63070c2
1 changed files with 8 additions and 5 deletions
|
|
@ -68,12 +68,15 @@ static int dma_mode = 0;
|
||||||
|
|
||||||
|
|
||||||
#ifdef ATA_HAVE_BBT
|
#ifdef ATA_HAVE_BBT
|
||||||
char ata_bbtbuf[ATA_BBT_PAGES * 64];
|
char ata_bbt_buf[ATA_BBT_PAGES * 64];
|
||||||
uint16_t (*ata_bbt)[0x20];
|
uint16_t (*ata_bbt)[0x20];
|
||||||
uint64_t ata_virtual_sectors;
|
uint64_t ata_virtual_sectors;
|
||||||
uint32_t ata_last_offset;
|
uint32_t ata_last_offset;
|
||||||
uint64_t ata_last_phys;
|
uint64_t ata_last_phys;
|
||||||
|
|
||||||
|
int ata_rw_sectors_internal(uint64_t sector, uint32_t count,
|
||||||
|
void* buffer, bool write);
|
||||||
|
|
||||||
int ata_bbt_read_sectors(uint32_t sector, uint32_t count, void* buffer)
|
int ata_bbt_read_sectors(uint32_t sector, uint32_t count, void* buffer)
|
||||||
{
|
{
|
||||||
if (ata_last_phys != sector - 1 && ata_last_phys > sector - 64) ata_soft_reset();
|
if (ata_last_phys != sector - 1 && ata_last_phys > sector - 64) ata_soft_reset();
|
||||||
|
|
@ -83,7 +86,7 @@ int ata_bbt_read_sectors(uint32_t sector, uint32_t count, void* buffer)
|
||||||
ata_last_offset = 0;
|
ata_last_offset = 0;
|
||||||
if (IS_ERR(rc))
|
if (IS_ERR(rc))
|
||||||
panicf("ATA: Error %08X while reading BBT (sector %d, count %d)\n",
|
panicf("ATA: Error %08X while reading BBT (sector %d, count %d)\n",
|
||||||
rc, sector, count);
|
(unsigned int)rc, (unsigned int)sector, (unsigned int)count);
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
@ -836,7 +839,7 @@ int ata_bbt_translate(uint64_t sector, uint32_t count, uint64_t* phys, uint32_t*
|
||||||
{
|
{
|
||||||
uint32_t l3idx = sector & 0x1f;
|
uint32_t l3idx = sector & 0x1f;
|
||||||
uint32_t l3data = ata_bbt[l2data & 0x7fff][l3idx];
|
uint32_t l3data = ata_bbt[l2data & 0x7fff][l3idx];
|
||||||
for (*physcount = 1; *physcount < count && l3idx + *physcount < 0x20; *physcount++)
|
for (*physcount = 1; *physcount < count && l3idx + *physcount < 0x20; (*physcount)++)
|
||||||
if (ata_bbt[l2data & 0x7fff][l3idx + *physcount] != l3data)
|
if (ata_bbt[l2data & 0x7fff][l3idx + *physcount] != l3data)
|
||||||
break;
|
break;
|
||||||
offset = l3data + base;
|
offset = l3data + base;
|
||||||
|
|
@ -1023,7 +1026,6 @@ long ata_last_disk_activity(void)
|
||||||
void ata_bbt_disable(void)
|
void ata_bbt_disable(void)
|
||||||
{
|
{
|
||||||
mutex_lock(&ata_mutex);
|
mutex_lock(&ata_mutex);
|
||||||
if (ata_bbt) free(ata_bbt);
|
|
||||||
ata_bbt = NULL;
|
ata_bbt = NULL;
|
||||||
ata_virtual_sectors = ata_total_sectors;
|
ata_virtual_sectors = ata_total_sectors;
|
||||||
mutex_unlock(&ata_mutex);
|
mutex_unlock(&ata_mutex);
|
||||||
|
|
@ -1044,7 +1046,8 @@ void ata_bbt_reload(void)
|
||||||
ata_virtual_sectors = (((uint64_t)buf[0x1fd]) << 32) | buf[0x1fc];
|
ata_virtual_sectors = (((uint64_t)buf[0x1fd]) << 32) | buf[0x1fc];
|
||||||
uint32_t count = buf[0x1ff];
|
uint32_t count = buf[0x1ff];
|
||||||
if (count > ATA_BBT_PAGES / 64)
|
if (count > ATA_BBT_PAGES / 64)
|
||||||
panicf("ATA: BBT too big! (space: %d, size: %d)", ATA_BBT_PAGES, count * 64);
|
panicf("ATA: BBT too big! (space: %d, size: %d)",
|
||||||
|
ATA_BBT_PAGES, (unsigned int)(count * 64));
|
||||||
uint32_t i;
|
uint32_t i;
|
||||||
uint32_t cnt;
|
uint32_t cnt;
|
||||||
ata_bbt = (typeof(ata_bbt))ata_bbt_buf;
|
ata_bbt = (typeof(ata_bbt))ata_bbt_buf;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue