Commit 0c4ad8dc2aa144a6269b9c19200c40b67c873d5b
1 parent
165c6fc8
ide endianness fixes
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@760 c046a42c-6fe2-441c-8c8c-71466251a162
Showing
1 changed file
with
6 additions
and
10 deletions
hw/ide.c
... | ... | @@ -352,11 +352,7 @@ static void padstr8(uint8_t *buf, int buf_size, const char *src) |
352 | 352 | |
353 | 353 | static void put_le16(uint16_t *p, unsigned int v) |
354 | 354 | { |
355 | -#ifdef WORDS_BIGENDIAN | |
356 | - *p = bswap16(v); | |
357 | -#else | |
358 | - *p = v; | |
359 | -#endif | |
355 | + *p = cpu_to_le16(v); | |
360 | 356 | } |
361 | 357 | |
362 | 358 | static void ide_identify(IDEState *s) |
... | ... | @@ -1328,7 +1324,7 @@ static void ide_data_writew(void *opaque, uint32_t addr, uint32_t val) |
1328 | 1324 | uint8_t *p; |
1329 | 1325 | |
1330 | 1326 | p = s->data_ptr; |
1331 | - *(uint16_t *)p = tswap16(val); | |
1327 | + *(uint16_t *)p = le16_to_cpu(val); | |
1332 | 1328 | p += 2; |
1333 | 1329 | s->data_ptr = p; |
1334 | 1330 | if (p >= s->data_end) |
... | ... | @@ -1341,7 +1337,7 @@ static uint32_t ide_data_readw(void *opaque, uint32_t addr) |
1341 | 1337 | uint8_t *p; |
1342 | 1338 | int ret; |
1343 | 1339 | p = s->data_ptr; |
1344 | - ret = tswap16(*(uint16_t *)p); | |
1340 | + ret = cpu_to_le16(*(uint16_t *)p); | |
1345 | 1341 | p += 2; |
1346 | 1342 | s->data_ptr = p; |
1347 | 1343 | if (p >= s->data_end) |
... | ... | @@ -1355,7 +1351,7 @@ static void ide_data_writel(void *opaque, uint32_t addr, uint32_t val) |
1355 | 1351 | uint8_t *p; |
1356 | 1352 | |
1357 | 1353 | p = s->data_ptr; |
1358 | - *(uint32_t *)p = tswap32(val); | |
1354 | + *(uint32_t *)p = le32_to_cpu(val); | |
1359 | 1355 | p += 4; |
1360 | 1356 | s->data_ptr = p; |
1361 | 1357 | if (p >= s->data_end) |
... | ... | @@ -1369,7 +1365,7 @@ static uint32_t ide_data_readl(void *opaque, uint32_t addr) |
1369 | 1365 | int ret; |
1370 | 1366 | |
1371 | 1367 | p = s->data_ptr; |
1372 | - ret = tswap32(*(uint32_t *)p); | |
1368 | + ret = cpu_to_le32(*(uint32_t *)p); | |
1373 | 1369 | p += 4; |
1374 | 1370 | s->data_ptr = p; |
1375 | 1371 | if (p >= s->data_end) |
... | ... | @@ -1417,7 +1413,7 @@ static void ide_guess_geometry(IDEState *s) |
1417 | 1413 | return; |
1418 | 1414 | for(i = 0; i < 4; i++) { |
1419 | 1415 | p = ((struct partition *)(buf + 0x1be)) + i; |
1420 | - nr_sects = tswap32(p->nr_sects); | |
1416 | + nr_sects = le32_to_cpu(p->nr_sects); | |
1421 | 1417 | if (nr_sects && p->end_head) { |
1422 | 1418 | /* We make the assumption that the partition terminates on |
1423 | 1419 | a cylinder boundary */ | ... | ... |