Compile ide/macio only once
Replace TARGET_PAGE_SIZE with 4096. Make byte swapping unconditional
since PPC is big endian.
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
diff --git a/Makefile.objs b/Makefile.objs
index fe5b4d9..1752402 100644
--- a/Makefile.objs
+++ b/Makefile.objs
@@ -171,6 +171,7 @@
hw-obj-$(CONFIG_IDE_ISA) += ide/isa.o
hw-obj-$(CONFIG_IDE_PIIX) += ide/piix.o
hw-obj-$(CONFIG_IDE_CMD646) += ide/cmd646.o
+hw-obj-$(CONFIG_IDE_MACIO) += ide/macio.o
# SCSI layer
hw-obj-y += lsi53c895a.o
diff --git a/Makefile.target b/Makefile.target
index 51ddbb9..ee2cff0 100644
--- a/Makefile.target
+++ b/Makefile.target
@@ -190,7 +190,7 @@
obj-i386-y += debugcon.o multiboot.o
# shared objects
-obj-ppc-y = ppc.o ide/macio.o
+obj-ppc-y = ppc.o
obj-ppc-y += vga.o dma.o openpic.o
# PREP target
obj-ppc-y += pckbd.o i8259.o mc146818rtc.o
diff --git a/default-configs/ppc-softmmu.mak b/default-configs/ppc-softmmu.mak
index 15530be..88e238a 100644
--- a/default-configs/ppc-softmmu.mak
+++ b/default-configs/ppc-softmmu.mak
@@ -14,6 +14,7 @@
CONFIG_IDE_PCI=y
CONFIG_IDE_ISA=y
CONFIG_IDE_CMD646=y
+CONFIG_IDE_MACIO=y
CONFIG_NE2000_ISA=y
CONFIG_SOUND=y
CONFIG_VIRTIO_PCI=y
diff --git a/default-configs/ppc64-softmmu.mak b/default-configs/ppc64-softmmu.mak
index 6b90525..aabc877 100644
--- a/default-configs/ppc64-softmmu.mak
+++ b/default-configs/ppc64-softmmu.mak
@@ -14,6 +14,7 @@
CONFIG_IDE_PCI=y
CONFIG_IDE_ISA=y
CONFIG_IDE_CMD646=y
+CONFIG_IDE_MACIO=y
CONFIG_NE2000_ISA=y
CONFIG_SOUND=y
CONFIG_VIRTIO_PCI=y
diff --git a/default-configs/ppcemb-softmmu.mak b/default-configs/ppcemb-softmmu.mak
index ceb67b3..f7fa1e0 100644
--- a/default-configs/ppcemb-softmmu.mak
+++ b/default-configs/ppcemb-softmmu.mak
@@ -14,6 +14,7 @@
CONFIG_IDE_PCI=y
CONFIG_IDE_ISA=y
CONFIG_IDE_CMD646=y
+CONFIG_IDE_MACIO=y
CONFIG_NE2000_ISA=y
CONFIG_SOUND=y
CONFIG_VIRTIO_PCI=y
diff --git a/hw/ide/macio.c b/hw/ide/macio.c
index d1bdb49..639f3f6 100644
--- a/hw/ide/macio.c
+++ b/hw/ide/macio.c
@@ -40,6 +40,8 @@
BlockDriverAIOCB *aiocb;
} MACIOIDEState;
+#define MACIO_PAGE_SIZE 4096
+
static void pmac_ide_atapi_transfer_cb(void *opaque, int ret)
{
DBDMA_io *io = opaque;
@@ -77,7 +79,7 @@
s->io_buffer_size = io->len;
- qemu_sglist_init(&s->sg, io->len / TARGET_PAGE_SIZE + 1);
+ qemu_sglist_init(&s->sg, io->len / MACIO_PAGE_SIZE + 1);
qemu_sglist_add(&s->sg, io->addr, io->len);
io->addr += io->len;
io->len = 0;
@@ -139,7 +141,7 @@
s->io_buffer_index = 0;
s->io_buffer_size = io->len;
- qemu_sglist_init(&s->sg, io->len / TARGET_PAGE_SIZE + 1);
+ qemu_sglist_init(&s->sg, io->len / MACIO_PAGE_SIZE + 1);
qemu_sglist_add(&s->sg, io->addr, io->len);
io->addr += io->len;
io->len = 0;
@@ -223,9 +225,7 @@
MACIOIDEState *d = opaque;
addr = (addr & 0xFFF) >> 4;
-#ifdef TARGET_WORDS_BIGENDIAN
val = bswap16(val);
-#endif
if (addr == 0) {
ide_data_writew(&d->bus, 0, val);
}
@@ -242,9 +242,7 @@
} else {
retval = 0xFFFF;
}
-#ifdef TARGET_WORDS_BIGENDIAN
retval = bswap16(retval);
-#endif
return retval;
}
@@ -254,9 +252,7 @@
MACIOIDEState *d = opaque;
addr = (addr & 0xFFF) >> 4;
-#ifdef TARGET_WORDS_BIGENDIAN
val = bswap32(val);
-#endif
if (addr == 0) {
ide_data_writel(&d->bus, 0, val);
}
@@ -273,9 +269,7 @@
} else {
retval = 0xFFFFFFFF;
}
-#ifdef TARGET_WORDS_BIGENDIAN
retval = bswap32(retval);
-#endif
return retval;
}