freemyipod r920 - Code Review

Jump to: navigation, search
Repository:freemyipod
Revision:r919‎ | r920 | r921 >
Date:21:37, 6 May 2014
Author:theseven
Status:new
Tags:
Comment:
emCORE: Don't silently ignore ATA errors on iPod Classic
Modified paths:
  • /emcore/trunk/target/ipodclassic/storage_ata-target.h (modified) (history)
  • /emcore/trunk/target/ipodclassic/storage_ata.c (modified) (history)

Diff [purge]

Index: emcore/trunk/target/ipodclassic/storage_ata.c
@@ -879,7 +879,7 @@
880880 {
881881 #endif
882882 if (sector + count > ata_total_sectors) RET_ERR(0);
883 - if (!ata_powered) ata_power_up();
 883+ if (!ata_powered) PASS_RC(ata_power_up(), 2, 1);
884884 ata_set_active();
885885 if (ata_dma && write) clean_dcache();
886886 else if (ata_dma) invalidate_dcache();
@@ -907,7 +907,7 @@
908908 buf += SECTOR_SIZE;
909909 }
910910 }
911 - PASS_RC(rc, 1, 1);
 911+ PASS_RC(rc, 2, 2);
912912 buffer += SECTOR_SIZE * cnt;
913913 sector += cnt;
914914 count -= cnt;
@@ -933,7 +933,7 @@
934934 {
935935 int rc;
936936 mutex_lock(&ata_mutex, TIMEOUT_BLOCK);
937 - if (!ata_powered) ata_power_up();
 937+ if (!ata_powered) PASS_RC(ata_power_up(), 1, 0);
938938 ata_set_active();
939939 if (ceata) rc = ceata_soft_reset();
940940 else
@@ -951,7 +951,7 @@
952952 }
953953 ata_set_active();
954954 mutex_unlock(&ata_mutex);
955 - return rc;
 955+ PASS_RC(rc, 1, 1);
956956 }
957957
958958 int ata_read_sectors(IF_MD2(int drive,) unsigned long start, int incount,
@@ -1028,11 +1028,11 @@
10291029 mutex_unlock(&ata_mutex);
10301030 }
10311031
1032 -void ata_bbt_reload()
 1032+int ata_bbt_reload()
10331033 {
10341034 mutex_lock(&ata_mutex, TIMEOUT_BLOCK);
10351035 ata_bbt_disable();
1036 - ata_power_up();
 1036+ PASS_RC(ata_power_up(), 0, 0);
10371037 uint32_t* buf = (uint32_t*)memalign(0x10, 0x1000);
10381038 if (buf)
10391039 {
@@ -1104,7 +1104,7 @@
11051105 ata_powered = false;
11061106 ata_total_sectors = 0;
11071107 #ifdef ATA_HAVE_BBT
1108 - ata_bbt_reload();
 1108+ PASS_RC(ata_bbt_reload(), 0, 0);
11091109 #endif
11101110 thread_create(&ata_thread_handle, "ATA idle monitor", ata_thread, ata_stack,
11111111 sizeof(ata_stack), OS_THREAD, 1, true, NULL, NULL, NULL, NULL);
Index: emcore/trunk/target/ipodclassic/storage_ata-target.h
@@ -32,7 +32,7 @@
3333 void (*srst_after_error)(bool enable);
3434 void (*set_retries)(int retries);
3535 int (*bbt_translate)(uint64_t sector, uint32_t count, uint64_t* phys, uint32_t* physcount);
36 - void (*bbt_reload)();
 36+ int (*bbt_reload)();
3737 void (*bbt_disable)();
3838 };
3939
@@ -49,7 +49,7 @@
5050 extern uint64_t ata_virtual_sectors;
5151
5252 int ata_bbt_translate(uint64_t sector, uint32_t count, uint64_t* phys, uint32_t* physcount);
53 -void ata_bbt_reload();
 53+int ata_bbt_reload();
5454 void ata_bbt_disable();
5555 int ata_rw_sectors_internal(uint64_t sector, uint32_t count, void* buffer, bool write);
5656 #endif