aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBlue Swirl <blauwirbel@gmail.com>2010-03-29 19:23:59 +0000
committerBlue Swirl <blauwirbel@gmail.com>2010-03-29 19:23:59 +0000
commit5c4532ee7894277d8d54db108e891c4204d15f1d (patch)
treee986f88f2ac6e45a4548aaf2e6c62e95842d25d1
parent02c7c992f0036bca8f1256e8a1f0d80a81e173f0 (diff)
Compile openpic 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>
-rw-r--r--Makefile.objs1
-rw-r--r--Makefile.target2
-rw-r--r--default-configs/ppc-softmmu.mak1
-rw-r--r--default-configs/ppc64-softmmu.mak1
-rw-r--r--default-configs/ppcemb-softmmu.mak1
-rw-r--r--hw/openpic.c34
6 files changed, 15 insertions, 25 deletions
diff --git a/Makefile.objs b/Makefile.objs
index 1752402efe..c02f9d5ff9 100644
--- a/Makefile.objs
+++ b/Makefile.objs
@@ -149,6 +149,7 @@ hw-obj-$(CONFIG_USB_UHCI) += usb-uhci.o
hw-obj-$(CONFIG_USB_OHCI) += usb-ohci.o
hw-obj-$(CONFIG_FDC) += fdc.o
hw-obj-$(CONFIG_ACPI) += acpi.o
+hw-obj-$(CONFIG_OPENPIC) += openpic.o
# PCI watchdog devices
hw-obj-y += wdt_i6300esb.o
diff --git a/Makefile.target b/Makefile.target
index ee2cff06ce..5ed20ec461 100644
--- a/Makefile.target
+++ b/Makefile.target
@@ -191,7 +191,7 @@ obj-i386-y += debugcon.o multiboot.o
# shared objects
obj-ppc-y = ppc.o
-obj-ppc-y += vga.o dma.o openpic.o
+obj-ppc-y += vga.o dma.o
# PREP target
obj-ppc-y += pckbd.o i8259.o mc146818rtc.o
obj-ppc-y += prep_pci.o ppc_prep.o
diff --git a/default-configs/ppc-softmmu.mak b/default-configs/ppc-softmmu.mak
index 88e238a011..ca7e228ba7 100644
--- a/default-configs/ppc-softmmu.mak
+++ b/default-configs/ppc-softmmu.mak
@@ -9,6 +9,7 @@ CONFIG_VGA_PCI=y
CONFIG_SERIAL=y
CONFIG_I8254=y
CONFIG_FDC=y
+CONFIG_OPENPIC=y
CONFIG_IDE_CORE=y
CONFIG_IDE_QDEV=y
CONFIG_IDE_PCI=y
diff --git a/default-configs/ppc64-softmmu.mak b/default-configs/ppc64-softmmu.mak
index aabc877ac7..1987f44148 100644
--- a/default-configs/ppc64-softmmu.mak
+++ b/default-configs/ppc64-softmmu.mak
@@ -9,6 +9,7 @@ CONFIG_VGA_PCI=y
CONFIG_SERIAL=y
CONFIG_I8254=y
CONFIG_FDC=y
+CONFIG_OPENPIC=y
CONFIG_IDE_CORE=y
CONFIG_IDE_QDEV=y
CONFIG_IDE_PCI=y
diff --git a/default-configs/ppcemb-softmmu.mak b/default-configs/ppcemb-softmmu.mak
index f7fa1e0547..18eac993c6 100644
--- a/default-configs/ppcemb-softmmu.mak
+++ b/default-configs/ppcemb-softmmu.mak
@@ -9,6 +9,7 @@ CONFIG_VGA_PCI=y
CONFIG_SERIAL=y
CONFIG_I8254=y
CONFIG_FDC=y
+CONFIG_OPENPIC=y
CONFIG_IDE_CORE=y
CONFIG_IDE_QDEV=y
CONFIG_IDE_PCI=y
diff --git a/hw/openpic.c b/hw/openpic.c
index aa244ee65b..ac21993bc8 100644
--- a/hw/openpic.c
+++ b/hw/openpic.c
@@ -141,6 +141,8 @@ enum mpic_ide_bits {
#error "Please select which OpenPic implementation is to be emulated"
#endif
+#define OPENPIC_PAGE_SIZE 4096
+
#define BF_WIDTH(_bits_) \
(((_bits_) + (sizeof(uint32_t) * 8) - 1) / (sizeof(uint32_t) * 8))
@@ -597,9 +599,7 @@ static void openpic_gbl_write (void *opaque, target_phys_addr_t addr, uint32_t v
DPRINTF("%s: addr " TARGET_FMT_plx " <= %08x\n", __func__, addr, val);
if (addr & 0xF)
return;
-#if defined TARGET_WORDS_BIGENDIAN
val = openpic_swap32(opp, val);
-#endif
addr &= 0xFF;
switch (addr) {
case 0x00: /* FREP */
@@ -693,9 +693,7 @@ static uint32_t openpic_gbl_read (void *opaque, target_phys_addr_t addr)
break;
}
DPRINTF("%s: => %08x\n", __func__, retval);
-#if defined TARGET_WORDS_BIGENDIAN
retval = openpic_swap32(opp, retval);
-#endif
return retval;
}
@@ -708,9 +706,7 @@ static void openpic_timer_write (void *opaque, uint32_t addr, uint32_t val)
DPRINTF("%s: addr %08x <= %08x\n", __func__, addr, val);
if (addr & 0xF)
return;
-#if defined TARGET_WORDS_BIGENDIAN
val = openpic_swap32(opp, val);
-#endif
addr -= 0x1100;
addr &= 0xFFFF;
idx = (addr & 0xFFF0) >> 6;
@@ -763,9 +759,7 @@ static uint32_t openpic_timer_read (void *opaque, uint32_t addr)
break;
}
DPRINTF("%s: => %08x\n", __func__, retval);
-#if defined TARGET_WORDS_BIGENDIAN
retval = openpic_swap32(opp, retval);
-#endif
return retval;
}
@@ -778,9 +772,7 @@ static void openpic_src_write (void *opaque, uint32_t addr, uint32_t val)
DPRINTF("%s: addr %08x <= %08x\n", __func__, addr, val);
if (addr & 0xF)
return;
-#if defined TARGET_WORDS_BIGENDIAN
val = openpic_swap32(opp, val);
-#endif
addr = addr & 0xFFF0;
idx = addr >> 5;
if (addr & 0x10) {
@@ -812,9 +804,7 @@ static uint32_t openpic_src_read (void *opaque, uint32_t addr)
retval = read_IRQreg(opp, idx, IRQ_IPVP);
}
DPRINTF("%s: => %08x\n", __func__, retval);
-#if defined TARGET_WORDS_BIGENDIAN
retval = openpic_swap32(opp, retval);
-#endif
return retval;
}
@@ -829,9 +819,7 @@ static void openpic_cpu_write (void *opaque, target_phys_addr_t addr, uint32_t v
DPRINTF("%s: addr " TARGET_FMT_plx " <= %08x\n", __func__, addr, val);
if (addr & 0xF)
return;
-#if defined TARGET_WORDS_BIGENDIAN
val = openpic_swap32(opp, val);
-#endif
addr &= 0x1FFF0;
idx = addr / 0x1000;
dst = &opp->dst[idx];
@@ -949,9 +937,7 @@ static uint32_t openpic_cpu_read (void *opaque, target_phys_addr_t addr)
break;
}
DPRINTF("%s: => %08x\n", __func__, retval);
-#if defined TARGET_WORDS_BIGENDIAN
retval = openpic_swap32(opp, retval);
-#endif
return retval;
}
@@ -1384,7 +1370,7 @@ static void mpic_src_ext_write (void *opaque, target_phys_addr_t addr,
if (addr & 0xF)
return;
- addr -= MPIC_EXT_REG_START & (TARGET_PAGE_SIZE - 1);
+ addr -= MPIC_EXT_REG_START & (OPENPIC_PAGE_SIZE - 1);
if (addr < MPIC_EXT_REG_SIZE) {
idx += (addr & 0xFFF0) >> 5;
if (addr & 0x10) {
@@ -1408,7 +1394,7 @@ static uint32_t mpic_src_ext_read (void *opaque, target_phys_addr_t addr)
if (addr & 0xF)
return retval;
- addr -= MPIC_EXT_REG_START & (TARGET_PAGE_SIZE - 1);
+ addr -= MPIC_EXT_REG_START & (OPENPIC_PAGE_SIZE - 1);
if (addr < MPIC_EXT_REG_SIZE) {
idx += (addr & 0xFFF0) >> 5;
if (addr & 0x10) {
@@ -1434,7 +1420,7 @@ static void mpic_src_int_write (void *opaque, target_phys_addr_t addr,
if (addr & 0xF)
return;
- addr -= MPIC_INT_REG_START & (TARGET_PAGE_SIZE - 1);
+ addr -= MPIC_INT_REG_START & (OPENPIC_PAGE_SIZE - 1);
if (addr < MPIC_INT_REG_SIZE) {
idx += (addr & 0xFFF0) >> 5;
if (addr & 0x10) {
@@ -1458,7 +1444,7 @@ static uint32_t mpic_src_int_read (void *opaque, target_phys_addr_t addr)
if (addr & 0xF)
return retval;
- addr -= MPIC_INT_REG_START & (TARGET_PAGE_SIZE - 1);
+ addr -= MPIC_INT_REG_START & (OPENPIC_PAGE_SIZE - 1);
if (addr < MPIC_INT_REG_SIZE) {
idx += (addr & 0xFFF0) >> 5;
if (addr & 0x10) {
@@ -1484,7 +1470,7 @@ static void mpic_src_msg_write (void *opaque, target_phys_addr_t addr,
if (addr & 0xF)
return;
- addr -= MPIC_MSG_REG_START & (TARGET_PAGE_SIZE - 1);
+ addr -= MPIC_MSG_REG_START & (OPENPIC_PAGE_SIZE - 1);
if (addr < MPIC_MSG_REG_SIZE) {
idx += (addr & 0xFFF0) >> 5;
if (addr & 0x10) {
@@ -1508,7 +1494,7 @@ static uint32_t mpic_src_msg_read (void *opaque, target_phys_addr_t addr)
if (addr & 0xF)
return retval;
- addr -= MPIC_MSG_REG_START & (TARGET_PAGE_SIZE - 1);
+ addr -= MPIC_MSG_REG_START & (OPENPIC_PAGE_SIZE - 1);
if (addr < MPIC_MSG_REG_SIZE) {
idx += (addr & 0xFFF0) >> 5;
if (addr & 0x10) {
@@ -1534,7 +1520,7 @@ static void mpic_src_msi_write (void *opaque, target_phys_addr_t addr,
if (addr & 0xF)
return;
- addr -= MPIC_MSI_REG_START & (TARGET_PAGE_SIZE - 1);
+ addr -= MPIC_MSI_REG_START & (OPENPIC_PAGE_SIZE - 1);
if (addr < MPIC_MSI_REG_SIZE) {
idx += (addr & 0xFFF0) >> 5;
if (addr & 0x10) {
@@ -1557,7 +1543,7 @@ static uint32_t mpic_src_msi_read (void *opaque, target_phys_addr_t addr)
if (addr & 0xF)
return retval;
- addr -= MPIC_MSI_REG_START & (TARGET_PAGE_SIZE - 1);
+ addr -= MPIC_MSI_REG_START & (OPENPIC_PAGE_SIZE - 1);
if (addr < MPIC_MSI_REG_SIZE) {
idx += (addr & 0xFFF0) >> 5;
if (addr & 0x10) {