diff options
author | Cástor Muñoz <cmvidal@gmail.com> | 2016-02-12 01:06:31 +0100 |
---|---|---|
committer | Cástor Muñoz <cmvidal@gmail.com> | 2016-02-14 15:19:31 +0100 |
commit | 929be521d4dd8a0ed3b3a42cd22e1659407ce83a (patch) | |
tree | 63fb57d90cef4f5d1908b39a09345865aeb61a64 | |
parent | 3216f390c55d9970079b785a41aae5e7582b4a54 (diff) | |
download | rockbox-929be521d4dd8a0ed3b3a42cd22e1659407ce83a.tar.gz rockbox-929be521d4dd8a0ed3b3a42cd22e1659407ce83a.zip |
iPod Classic: fix buffer alignment on HDD driver
Read/write buffers who are aligned to 16 were not re-aligned to 32 as
it should be. Althrough USB storage and buffering are always passing
buffers aligned to 32, a few unaligned buffers are being received from
other tasks, so this patch could solve some rare random issues.
Also fixes DMA configuration for HDDs that support any MDMA mode but
only UDMA0 (probably will never happen).
Change-Id: I00219ae434205681c69293fc563e0526224c9adf
-rw-r--r-- | firmware/target/arm/s5l8702/ipod6g/storage_ata-ipod6g.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/firmware/target/arm/s5l8702/ipod6g/storage_ata-ipod6g.c b/firmware/target/arm/s5l8702/ipod6g/storage_ata-ipod6g.c index 7f5a19b9d0..a924b82959 100644 --- a/firmware/target/arm/s5l8702/ipod6g/storage_ata-ipod6g.c +++ b/firmware/target/arm/s5l8702/ipod6g/storage_ata-ipod6g.c | |||
@@ -74,7 +74,7 @@ static int ata_reset(void); | |||
74 | static void ata_power_down(void); | 74 | static void ata_power_down(void); |
75 | 75 | ||
76 | #ifdef ATA_HAVE_BBT | 76 | #ifdef ATA_HAVE_BBT |
77 | char ata_bbt_buf[ATA_BBT_PAGES * 64]; | 77 | char ata_bbt_buf[ATA_BBT_PAGES * 64] STORAGE_ALIGN_ATTR; |
78 | uint16_t (*ata_bbt)[0x20]; | 78 | uint16_t (*ata_bbt)[0x20]; |
79 | uint64_t ata_virtual_sectors; | 79 | uint64_t ata_virtual_sectors; |
80 | uint32_t ata_last_offset; | 80 | uint32_t ata_last_offset; |
@@ -679,10 +679,13 @@ static int ata_power_up(void) | |||
679 | udmatime = 0x3050a52; | 679 | udmatime = 0x3050a52; |
680 | param = 0x41; | 680 | param = 0x41; |
681 | } | 681 | } |
682 | else if (ata_identify_data[88] & BIT(0)) | ||
683 | { | ||
684 | param = 0x40; | ||
685 | } | ||
682 | if (ata_identify_data[88] & BITRANGE(0, 4)) | 686 | if (ata_identify_data[88] & BITRANGE(0, 4)) |
683 | { | 687 | { |
684 | ata_dma_flags = BIT(2) | BIT(3) | BIT(9) | BIT(10); | 688 | ata_dma_flags = BIT(2) | BIT(3) | BIT(9) | BIT(10); |
685 | param |= 0x40; | ||
686 | } | 689 | } |
687 | } | 690 | } |
688 | ata_dma = param ? true : false; | 691 | ata_dma = param ? true : false; |
@@ -907,7 +910,7 @@ int ata_bbt_translate(uint64_t sector, uint32_t count, uint64_t* phys, uint32_t* | |||
907 | 910 | ||
908 | static int ata_rw_sectors(uint64_t sector, uint32_t count, void* buffer, bool write) | 911 | static int ata_rw_sectors(uint64_t sector, uint32_t count, void* buffer, bool write) |
909 | { | 912 | { |
910 | if (((uint32_t)buffer) & 0xf) | 913 | if (STORAGE_OVERLAP((uint32_t)buffer)) |
911 | { | 914 | { |
912 | while (count) | 915 | while (count) |
913 | { | 916 | { |