aboutsummaryrefslogtreecommitdiff
path: root/hw/ide.c
diff options
context:
space:
mode:
authorbellard <bellard@c046a42c-6fe2-441c-8c8c-71466251a162>2004-04-25 22:09:16 +0000
committerbellard <bellard@c046a42c-6fe2-441c-8c8c-71466251a162>2004-04-25 22:09:16 +0000
commit0c4ad8dc2aa144a6269b9c19200c40b67c873d5b (patch)
tree969a3c8a1e77a2aec1217ab3512ac912016bfda8 /hw/ide.c
parent165c6fc8ce3026eeeef2e8a1235b0bd08b51f03e (diff)
ide endianness fixes
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@760 c046a42c-6fe2-441c-8c8c-71466251a162
Diffstat (limited to 'hw/ide.c')
-rw-r--r--hw/ide.c16
1 files changed, 6 insertions, 10 deletions
diff --git a/hw/ide.c b/hw/ide.c
index 0bef2888e3..9bd32e097f 100644
--- a/hw/ide.c
+++ b/hw/ide.c
@@ -352,11 +352,7 @@ static void padstr8(uint8_t *buf, int buf_size, const char *src)
static void put_le16(uint16_t *p, unsigned int v)
{
-#ifdef WORDS_BIGENDIAN
- *p = bswap16(v);
-#else
- *p = v;
-#endif
+ *p = cpu_to_le16(v);
}
static void ide_identify(IDEState *s)
@@ -1328,7 +1324,7 @@ static void ide_data_writew(void *opaque, uint32_t addr, uint32_t val)
uint8_t *p;
p = s->data_ptr;
- *(uint16_t *)p = tswap16(val);
+ *(uint16_t *)p = le16_to_cpu(val);
p += 2;
s->data_ptr = p;
if (p >= s->data_end)
@@ -1341,7 +1337,7 @@ static uint32_t ide_data_readw(void *opaque, uint32_t addr)
uint8_t *p;
int ret;
p = s->data_ptr;
- ret = tswap16(*(uint16_t *)p);
+ ret = cpu_to_le16(*(uint16_t *)p);
p += 2;
s->data_ptr = p;
if (p >= s->data_end)
@@ -1355,7 +1351,7 @@ static void ide_data_writel(void *opaque, uint32_t addr, uint32_t val)
uint8_t *p;
p = s->data_ptr;
- *(uint32_t *)p = tswap32(val);
+ *(uint32_t *)p = le32_to_cpu(val);
p += 4;
s->data_ptr = p;
if (p >= s->data_end)
@@ -1369,7 +1365,7 @@ static uint32_t ide_data_readl(void *opaque, uint32_t addr)
int ret;
p = s->data_ptr;
- ret = tswap32(*(uint32_t *)p);
+ ret = cpu_to_le32(*(uint32_t *)p);
p += 4;
s->data_ptr = p;
if (p >= s->data_end)
@@ -1417,7 +1413,7 @@ static void ide_guess_geometry(IDEState *s)
return;
for(i = 0; i < 4; i++) {
p = ((struct partition *)(buf + 0x1be)) + i;
- nr_sects = tswap32(p->nr_sects);
+ nr_sects = le32_to_cpu(p->nr_sects);
if (nr_sects && p->end_head) {
/* We make the assumption that the partition terminates on
a cylinder boundary */