freemyipod r813 - Code Review

Jump to: navigation, search
Repository:freemyipod
Revision:r812‎ | r813 | r814 >
Date:22:34, 22 November 2011
Author:theseven
Status:new
Tags:
Comment:
emCORE: Fix cache coherency bug in iPod Classic ATA driver
Modified paths:
  • /emcore/trunk/target/ipodclassic/storage_ata.c (modified) (history)

Diff [purge]

Index: emcore/trunk/target/ipodclassic/storage_ata.c
@@ -24,6 +24,7 @@
2525 #include "storage.h"
2626 #include "storage_ata-target.h"
2727 #include "timer.h"
 28+#include "malloc.h"
2829 #include "constants/mmc.h"
2930 #include "../ipodnano3g/s5l8702.h"
3031
@@ -474,6 +475,7 @@
475476 cmdtype = SDCI_CMD_CMD_TYPE_ADTC | SDCI_CMD_CMD_RD_WR;
476477 responsetype = SDCI_CMD_RES_TYPE_R1 | SDCI_CMD_RES_BUSY;
477478 direction = MMC_CMD_CEATA_RW_MULTIPLE_BLOCK_DIRECTION_WRITE;
 479+ clean_dcache();
478480 }
479481 else
480482 {
@@ -480,12 +482,12 @@
481483 cmdtype = SDCI_CMD_CMD_TYPE_ADTC;
482484 responsetype = SDCI_CMD_RES_TYPE_R1;
483485 direction = MMC_CMD_CEATA_RW_MULTIPLE_BLOCK_DIRECTION_READ;
 486+ invalidate_dcache();
484487 }
485488 SDCI_DMASIZE = 0x200;
486489 SDCI_DMAADDR = buf;
487490 SDCI_DMACOUNT = count;
488491 SDCI_DCTRL = SDCI_DCTRL_TXFIFORST | SDCI_DCTRL_RXFIFORST;
489 - invalidate_dcache();
490492 PASS_RC(mmc_send_command(SDCI_CMD_CMD_NUM(MMC_CMD_CEATA_RW_MULTIPLE_BLOCK)
491493 | SDCI_CMD_CMD_TYPE_ADTC | cmdtype | responsetype
492494 | SDCI_CMD_RES_SIZE_48 | SDCI_CMD_NCR_NID_NCR,
@@ -746,6 +748,7 @@
747749 PASS_RC(ata_wait_for_start_of_transfer(500000), 2, 1);
748750 if (write)
749751 {
 752+ clean_dcache();
750753 ATA_SBUF_START = buffer;
751754 ATA_SBUF_SIZE = SECTOR_SIZE * cnt;
752755 ATA_CFG |= BIT(4);
@@ -752,6 +755,7 @@
753756 }
754757 else
755758 {
 759+ invalidate_dcache();
756760 ATA_TBUF_START = buffer;
757761 ATA_TBUF_SIZE = SECTOR_SIZE * cnt;
758762 ATA_CFG &= ~BIT(4);