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>
diff --git a/hw/openpic.c b/hw/openpic.c
index aa244ee..ac21993 100644
--- a/hw/openpic.c
+++ b/hw/openpic.c
@@ -141,6 +141,8 @@
#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 @@
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 @@
break;
}
DPRINTF("%s: => %08x\n", __func__, retval);
-#if defined TARGET_WORDS_BIGENDIAN
retval = openpic_swap32(opp, retval);
-#endif
return retval;
}
@@ -708,9 +706,7 @@
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 @@
break;
}
DPRINTF("%s: => %08x\n", __func__, retval);
-#if defined TARGET_WORDS_BIGENDIAN
retval = openpic_swap32(opp, retval);
-#endif
return retval;
}
@@ -778,9 +772,7 @@
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 @@
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 @@
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 @@
break;
}
DPRINTF("%s: => %08x\n", __func__, retval);
-#if defined TARGET_WORDS_BIGENDIAN
retval = openpic_swap32(opp, retval);
-#endif
return retval;
}
@@ -1384,7 +1370,7 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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) {