diff mbox

[RFC,4/4] Compile mc146818 only once

Message ID AANLkTiko7FlqI2agu7b4Id9vBtyJSE74u2ZeEI5_-94-@mail.gmail.com
State New
Headers show

Commit Message

Blue Swirl May 23, 2010, 12:40 p.m. UTC
8 compilations less for the full build.

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
---
 Makefile.objs                        |    1 +
 Makefile.target                      |    7 +++----
 default-configs/i386-softmmu.mak     |    1 +
 default-configs/mips-softmmu.mak     |    1 +
 default-configs/mips64-softmmu.mak   |    1 +
 default-configs/mips64el-softmmu.mak |    1 +
 default-configs/mipsel-softmmu.mak   |    1 +
 default-configs/ppc-softmmu.mak      |    1 +
 default-configs/ppc64-softmmu.mak    |    1 +
 default-configs/ppcemb-softmmu.mak   |    1 +
 default-configs/sparc64-softmmu.mak  |    1 +
 default-configs/x86_64-softmmu.mak   |    1 +
 hw/mc146818rtc.c                     |   33 ++++++++++++---------------------
 13 files changed, 26 insertions(+), 25 deletions(-)

         next_irq_clock = (cur_clock & ~(period - 1)) + period;
@@ -154,9 +152,7 @@ static void rtc_timer_update(RTCState *s, int64_t
current_time)
             muldiv64(next_irq_clock, get_ticks_per_sec(), 32768) + 1;
         qemu_mod_timer(s->periodic_timer, s->next_periodic_time);
     } else {
-#ifdef TARGET_I386
         s->irq_coalesced = 0;
-#endif
         qemu_del_timer(s->periodic_timer);
     }
 }
@@ -168,7 +164,6 @@ static void rtc_periodic_timer(void *opaque)
     rtc_timer_update(s, s->next_periodic_time);
     if (s->cmos_data[RTC_REG_B] & REG_B_PIE) {
         s->cmos_data[RTC_REG_C] |= 0xc0;
-#ifdef TARGET_I386
         if(rtc_td_hack) {
             uint32_t old_coalesced = s->irq_coalesced;

@@ -179,9 +174,9 @@ static void rtc_periodic_timer(void *opaque)
                 s->irq_coalesced++;
                 rtc_coalesced_timer_update(s);
             }
-        } else
-#endif
-        qemu_irq_raise(s->irq);
+        } else {
+            qemu_irq_raise(s->irq);
+        }
     }
     if (s->cmos_data[RTC_REG_B] & REG_B_SQWE) {
         /* Not square wave at all but we don't want 2048Hz interrupts!
@@ -451,14 +446,12 @@ static uint32_t cmos_ioport_read(void *opaque,
uint32_t addr)
         case RTC_REG_C:
             ret = s->cmos_data[s->cmos_index];
             qemu_irq_lower(s->irq);
-#ifdef TARGET_I386
             if(s->irq_coalesced &&
                     s->irq_reinject_on_ack_count < RTC_REINJECT_ON_ACK_COUNT) {
                 s->irq_reinject_on_ack_count++;
                 qemu_irq_raise(s->irq);
                 break;
             }
-#endif

             s->cmos_data[RTC_REG_C] = 0x00;
             break;
@@ -507,7 +500,6 @@ static void rtc_set_date_from_host(ISADevice *dev)

 static int rtc_post_load(void *opaque, int version_id)
 {
-#ifdef TARGET_I386
     RTCState *s = opaque;

     if (version_id >= 2) {
@@ -515,7 +507,6 @@ static int rtc_post_load(void *opaque, int version_id)
             rtc_coalesced_timer_update(s);
         }
     }
-#endif
     return 0;
 }

@@ -555,10 +546,9 @@ static void rtc_reset(void *opaque)

     qemu_irq_lower(s->irq);

-#ifdef TARGET_I386
-    if (rtc_td_hack)
-	    s->irq_coalesced = 0;
-#endif
+    if (rtc_td_hack) {
+        s->irq_coalesced = 0;
+    }
 }

 static int rtc_initfn(ISADevice *dev)
@@ -577,11 +567,12 @@ static int rtc_initfn(ISADevice *dev)
     rtc_set_date_from_host(dev);

     s->periodic_timer = qemu_new_timer(rtc_clock, rtc_periodic_timer, s);
-#ifdef TARGET_I386
-    if (rtc_td_hack)
+
+    if (rtc_td_hack) {
         s->coalesced_timer =
             qemu_new_timer(rtc_clock, rtc_coalesced_timer, s);
-#endif
+    }
+
     s->second_timer = qemu_new_timer(rtc_clock, rtc_update_second, s);
     s->second_timer2 = qemu_new_timer(rtc_clock, rtc_update_second2, s);

Comments

Jan Kiszka May 24, 2010, 3:31 p.m. UTC | #1
Blue Swirl wrote:
> 8 compilations less for the full build.
> 
> Signed-off-by: Blue Swirl <blauwirbel@gmail.com>

...

> diff --git a/default-configs/sparc64-softmmu.mak
> b/default-configs/sparc64-softmmu.mak
> index 1cc3f13..6ab0cf4 100644
> --- a/default-configs/sparc64-softmmu.mak
> +++ b/default-configs/sparc64-softmmu.mak
> @@ -6,6 +6,7 @@ CONFIG_PTIMER=y
>  CONFIG_VGA_PCI=y
>  CONFIG_SERIAL=y
>  CONFIG_PARALLEL=y
> +CONFIG_MC146818=y
>  CONFIG_PCKBD=y
>  CONFIG_FDC=y
>  CONFIG_IDE_CORE=y

Can be dropped at this chance, sparc64 makes no use of it.

Jan
Blue Swirl May 24, 2010, 8:06 p.m. UTC | #2
On Mon, May 24, 2010 at 3:31 PM, Jan Kiszka <jan.kiszka@web.de> wrote:
> Blue Swirl wrote:
>> 8 compilations less for the full build.
>>
>> Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
>
> ...
>
>> diff --git a/default-configs/sparc64-softmmu.mak
>> b/default-configs/sparc64-softmmu.mak
>> index 1cc3f13..6ab0cf4 100644
>> --- a/default-configs/sparc64-softmmu.mak
>> +++ b/default-configs/sparc64-softmmu.mak
>> @@ -6,6 +6,7 @@ CONFIG_PTIMER=y
>>  CONFIG_VGA_PCI=y
>>  CONFIG_SERIAL=y
>>  CONFIG_PARALLEL=y
>> +CONFIG_MC146818=y
>>  CONFIG_PCKBD=y
>>  CONFIG_FDC=y
>>  CONFIG_IDE_CORE=y
>
> Can be dropped at this chance, sparc64 makes no use of it.

Right, though there some Blade machines (not emulated) with ds1287
(MC146818 compatible).
diff mbox

Patch

diff --git a/Makefile.objs b/Makefile.objs
index b1a6e01..7a234de 100644
--- a/Makefile.objs
+++ b/Makefile.objs
@@ -142,6 +142,7 @@  hw-obj-$(CONFIG_ECC) += ecc.o
 hw-obj-$(CONFIG_NAND) += nand.o
 hw-obj-$(CONFIG_PFLASH_CFI01) += pflash_cfi01.o
 hw-obj-$(CONFIG_PFLASH_CFI02) += pflash_cfi02.o
+hw-obj-$(CONFIG_MC146818) += mc146818rtc.o

 hw-obj-$(CONFIG_M48T59) += m48t59.o
 hw-obj-$(CONFIG_ESCC) += escc.o
diff --git a/Makefile.target b/Makefile.target
index 00e140f..d4d2c7f 100644
--- a/Makefile.target
+++ b/Makefile.target
@@ -189,7 +189,7 @@  obj-y += e1000.o

 # Hardware support
 obj-i386-y += vga.o
-obj-i386-y += mc146818rtc.o i8259.o pc.o
+obj-i386-y += i8259.o pc.o
 obj-i386-y += cirrus_vga.o apic.o ioapic.o piix_pci.o
 obj-i386-y += vmmouse.o vmport.o hpet.o
 obj-i386-y += device-hotplug.o pci-hotplug.o smbios.o wdt_ib700.o
@@ -200,7 +200,7 @@  obj-i386-y += pc_piix.o
 obj-ppc-y = ppc.o
 obj-ppc-y += vga.o
 # PREP target
-obj-ppc-y += i8259.o mc146818rtc.o
+obj-ppc-y += i8259.o
 obj-ppc-y += ppc_prep.o
 # OldWorld PowerMac
 obj-ppc-y += ppc_oldworld.o
@@ -218,7 +218,7 @@  obj-mips-y = mips_r4k.o mips_jazz.o mips_malta.o
mips_mipssim.o
 obj-mips-y += mips_addr.o mips_timer.o mips_int.o
 obj-mips-y += vga.o i8259.o
 obj-mips-y += g364fb.o jazz_led.o
-obj-mips-y += gt64xxx.o mc146818rtc.o
+obj-mips-y += gt64xxx.o
 obj-mips-y += piix4.o cirrus_vga.o

 obj-microblaze-y = petalogix_s3adsp1800_mmu.o
@@ -244,7 +244,6 @@  obj-cris-y += etraxfs_ser.o
 ifeq ($(TARGET_ARCH), sparc64)
 obj-sparc-y = sun4u.o apb_pci.o
 obj-sparc-y += vga.o
-obj-sparc-y += mc146818rtc.o
 obj-sparc-y += cirrus_vga.o
 else
 obj-sparc-y = sun4m.o lance.o tcx.o sun4m_iommu.o slavio_intctl.o
diff --git a/default-configs/i386-softmmu.mak b/default-configs/i386-softmmu.mak
index ed00471..ac222e6 100644
--- a/default-configs/i386-softmmu.mak
+++ b/default-configs/i386-softmmu.mak
@@ -7,6 +7,7 @@  CONFIG_VMWARE_VGA=y
 CONFIG_SERIAL=y
 CONFIG_PARALLEL=y
 CONFIG_I8254=y
+CONFIG_MC146818=y
 CONFIG_PCSPK=y
 CONFIG_PCKBD=y
 CONFIG_USB_UHCI=y
diff --git a/default-configs/mips-softmmu.mak b/default-configs/mips-softmmu.mak
index 29be52e..c8c7fd1 100644
--- a/default-configs/mips-softmmu.mak
+++ b/default-configs/mips-softmmu.mak
@@ -9,6 +9,7 @@  CONFIG_VMWARE_VGA=y
 CONFIG_SERIAL=y
 CONFIG_PARALLEL=y
 CONFIG_I8254=y
+CONFIG_MC146818=y
 CONFIG_PCSPK=y
 CONFIG_PCKBD=y
 CONFIG_USB_UHCI=y
diff --git a/default-configs/mips64-softmmu.mak
b/default-configs/mips64-softmmu.mak
index 9bae8a7..6582ca0 100644
--- a/default-configs/mips64-softmmu.mak
+++ b/default-configs/mips64-softmmu.mak
@@ -9,6 +9,7 @@  CONFIG_VMWARE_VGA=y
 CONFIG_SERIAL=y
 CONFIG_PARALLEL=y
 CONFIG_I8254=y
+CONFIG_MC146818=y
 CONFIG_PCSPK=y
 CONFIG_PCKBD=y
 CONFIG_USB_UHCI=y
diff --git a/default-configs/mips64el-softmmu.mak
b/default-configs/mips64el-softmmu.mak
index b372c1d..01901ee 100644
--- a/default-configs/mips64el-softmmu.mak
+++ b/default-configs/mips64el-softmmu.mak
@@ -9,6 +9,7 @@  CONFIG_VMWARE_VGA=y
 CONFIG_SERIAL=y
 CONFIG_PARALLEL=y
 CONFIG_I8254=y
+CONFIG_MC146818=y
 CONFIG_PCSPK=y
 CONFIG_PCKBD=y
 CONFIG_USB_UHCI=y
diff --git a/default-configs/mipsel-softmmu.mak
b/default-configs/mipsel-softmmu.mak
index 10ef483..e47ba6a 100644
--- a/default-configs/mipsel-softmmu.mak
+++ b/default-configs/mipsel-softmmu.mak
@@ -9,6 +9,7 @@  CONFIG_VMWARE_VGA=y
 CONFIG_SERIAL=y
 CONFIG_PARALLEL=y
 CONFIG_I8254=y
+CONFIG_MC146818=y
 CONFIG_PCSPK=y
 CONFIG_PCKBD=y
 CONFIG_USB_UHCI=y
diff --git a/default-configs/ppc-softmmu.mak b/default-configs/ppc-softmmu.mak
index c026bbb..651a489 100644
--- a/default-configs/ppc-softmmu.mak
+++ b/default-configs/ppc-softmmu.mak
@@ -8,6 +8,7 @@  CONFIG_M48T59=y
 CONFIG_VGA_PCI=y
 CONFIG_SERIAL=y
 CONFIG_I8254=y
+CONFIG_MC146818=y
 CONFIG_PCKBD=y
 CONFIG_FDC=y
 CONFIG_DMA=y
diff --git a/default-configs/ppc64-softmmu.mak
b/default-configs/ppc64-softmmu.mak
index 0101a28..e9bb814 100644
--- a/default-configs/ppc64-softmmu.mak
+++ b/default-configs/ppc64-softmmu.mak
@@ -8,6 +8,7 @@  CONFIG_M48T59=y
 CONFIG_VGA_PCI=y
 CONFIG_SERIAL=y
 CONFIG_I8254=y
+CONFIG_MC146818=y
 CONFIG_PCKBD=y
 CONFIG_FDC=y
 CONFIG_DMA=y
diff --git a/default-configs/ppcemb-softmmu.mak
b/default-configs/ppcemb-softmmu.mak
index 8ba9ac1..2f948c4 100644
--- a/default-configs/ppcemb-softmmu.mak
+++ b/default-configs/ppcemb-softmmu.mak
@@ -8,6 +8,7 @@  CONFIG_M48T59=y
 CONFIG_VGA_PCI=y
 CONFIG_SERIAL=y
 CONFIG_I8254=y
+CONFIG_MC146818=y
 CONFIG_PCKBD=y
 CONFIG_FDC=y
 CONFIG_DMA=y
diff --git a/default-configs/sparc64-softmmu.mak
b/default-configs/sparc64-softmmu.mak
index 1cc3f13..6ab0cf4 100644
--- a/default-configs/sparc64-softmmu.mak
+++ b/default-configs/sparc64-softmmu.mak
@@ -6,6 +6,7 @@  CONFIG_PTIMER=y
 CONFIG_VGA_PCI=y
 CONFIG_SERIAL=y
 CONFIG_PARALLEL=y
+CONFIG_MC146818=y
 CONFIG_PCKBD=y
 CONFIG_FDC=y
 CONFIG_IDE_CORE=y
diff --git a/default-configs/x86_64-softmmu.mak
b/default-configs/x86_64-softmmu.mak
index 5183203..3f1d697 100644
--- a/default-configs/x86_64-softmmu.mak
+++ b/default-configs/x86_64-softmmu.mak
@@ -7,6 +7,7 @@  CONFIG_VMWARE_VGA=y
 CONFIG_SERIAL=y
 CONFIG_PARALLEL=y
 CONFIG_I8254=y
+CONFIG_MC146818=y
 CONFIG_PCSPK=y
 CONFIG_PCKBD=y
 CONFIG_USB_UHCI=y
diff --git a/hw/mc146818rtc.c b/hw/mc146818rtc.c
index 93d72cc..d9e91fd 100644
--- a/hw/mc146818rtc.c
+++ b/hw/mc146818rtc.c
@@ -95,7 +95,6 @@  typedef struct RTCState {
 static void rtc_set_time(RTCState *s);
 static void rtc_copy_date(RTCState *s);

-#ifdef TARGET_I386
 static void rtc_coalesced_timer_update(RTCState *s)
 {
     if (s->irq_coalesced == 0) {
@@ -127,7 +126,6 @@  void rtc_dec_coalesced(ISADevice *dev)

     s->irq_coalesced--;
 }
-#endif

 static void rtc_timer_update(RTCState *s, int64_t current_time)
 {
@@ -142,11 +140,11 @@  static void rtc_timer_update(RTCState *s,
int64_t current_time)
             period_code += 7;
         /* period in 32 Khz cycles */
         period = 1 << (period_code - 1);
-#ifdef TARGET_I386
+
         if(period != s->period)
             s->irq_coalesced = (s->irq_coalesced * s->period) / period;
         s->period = period;
-#endif
+
         /* compute 32 khz clock */
         cur_clock = muldiv64(current_time, 32768, get_ticks_per_sec());