diff options
Diffstat (limited to 'firmware/drivers')
-rw-r--r-- | firmware/drivers/ata.c | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/firmware/drivers/ata.c b/firmware/drivers/ata.c index 29d2851875..9d5e02dc34 100644 --- a/firmware/drivers/ata.c +++ b/firmware/drivers/ata.c | |||
@@ -145,6 +145,8 @@ int ata_read_sectors(unsigned long start, | |||
145 | int i; | 145 | int i; |
146 | int ret = 0; | 146 | int ret = 0; |
147 | 147 | ||
148 | DEBUGF("ata_read(%X,%d,%X)\n",start,count,buf); | ||
149 | |||
148 | #ifndef USE_STANDBY | 150 | #ifndef USE_STANDBY |
149 | if ( sleeping ) { | 151 | if ( sleeping ) { |
150 | #ifdef USE_POWEROFF | 152 | #ifdef USE_POWEROFF |
@@ -184,8 +186,19 @@ int ata_read_sectors(unsigned long start, | |||
184 | return -1; | 186 | return -1; |
185 | } | 187 | } |
186 | 188 | ||
187 | for (j=0; j<SECTOR_SIZE/2; j++) | 189 | /* if destination address is odd, use byte copying, |
188 | ((unsigned short*)buf)[j] = SWAB16(ATA_DATA); | 190 | otherwise use word copying */ |
191 | if ( (unsigned int)buf & 1 ) { | ||
192 | for (j=0; j<SECTOR_SIZE/2; j++) { | ||
193 | unsigned short tmp = SWAB16(ATA_DATA); | ||
194 | ((unsigned char*)buf)[j*2] = tmp >> 8; | ||
195 | ((unsigned char*)buf)[j*2+1] = tmp & 0xff; | ||
196 | } | ||
197 | } | ||
198 | else { | ||
199 | for (j=0; j<SECTOR_SIZE/2; j++) | ||
200 | ((unsigned short*)buf)[j] = SWAB16(ATA_DATA); | ||
201 | } | ||
189 | 202 | ||
190 | #ifdef USE_INTERRUPT | 203 | #ifdef USE_INTERRUPT |
191 | /* reading the status register clears the interrupt */ | 204 | /* reading the status register clears the interrupt */ |