[SeaBIOS] [PATCH] rtc: Support disabling the RTC timer irq support

Kevin O'Connor kevin at koconnor.net
Mon Aug 17 16:23:31 CET 2015


Add a build time config option to remove support for RTC timer
interrupts along with the associated bios calls requiring that
support.

Signed-off-by: Kevin O'Connor <kevin at koconnor.net>
---
 src/Kconfig  |  9 +++++++++
 src/clock.c  | 13 ++++++++++++-
 src/hw/rtc.c |  6 ++++++
 src/stacks.c |  2 +-
 4 files changed, 28 insertions(+), 2 deletions(-)

diff --git a/src/Kconfig b/src/Kconfig
index 6256242..56a1b2f 100644
--- a/src/Kconfig
+++ b/src/Kconfig
@@ -299,6 +299,15 @@ menu "Hardware support"
         default y
         help
             Support parallel ports. This also enables int 17 parallel port calls.
+    config RTC_TIMER
+        bool "Real Time Clock (RTC) scheduling"
+        default y
+        help
+            Support MC146818 Real Time Clock chip timer
+            interrupts. This also enables int 1583 and int 1586 calls.
+
+            Disabling this support does not disable access to the RTC
+            cmos registers.
 
     config USE_SMM
         depends on QEMU
diff --git a/src/clock.c b/src/clock.c
index ee2b53f..2bb5209 100644
--- a/src/clock.c
+++ b/src/clock.c
@@ -56,7 +56,8 @@ clock_setup(void)
     }
 
     enable_hwirq(0, FUNC16(entry_08));
-    enable_hwirq(8, FUNC16(entry_70));
+    if (CONFIG_RTC_TIMER)
+        enable_hwirq(8, FUNC16(entry_70));
 }
 
 
@@ -374,6 +375,10 @@ clear_usertimer(void)
 void
 handle_1586(struct bregs *regs)
 {
+    if (!CONFIG_RTC_TIMER) {
+        set_code_unimplemented(regs, RET_EUNSUPPORTED);
+        return;
+    }
     // Use the rtc to wait for the specified time.
     u8 statusflag = 0;
     u32 count = (regs->cx << 16) | regs->dx;
@@ -417,6 +422,10 @@ handle_1583XX(struct bregs *regs)
 void
 handle_1583(struct bregs *regs)
 {
+    if (!CONFIG_RTC_TIMER) {
+        handle_1583XX(regs);
+        return;
+    }
     switch (regs->al) {
     case 0x00: handle_158300(regs); break;
     case 0x01: handle_158301(regs); break;
@@ -430,6 +439,8 @@ handle_1583(struct bregs *regs)
 void VISIBLE16
 handle_70(void)
 {
+    if (!CONFIG_RTC_TIMER)
+        return;
     debug_isr(DEBUG_ISR_70);
 
     // Check which modes are enabled and have occurred.
diff --git a/src/hw/rtc.c b/src/hw/rtc.c
index 628d542..570a3ad 100644
--- a/src/hw/rtc.c
+++ b/src/hw/rtc.c
@@ -62,6 +62,8 @@ rtc_updating(void)
 void
 rtc_setup(void)
 {
+    if (!CONFIG_RTC_TIMER)
+        return;
     rtc_write(CMOS_STATUS_A, 0x26);    // 32,768Khz src, 976.5625us updates
     rtc_mask(CMOS_STATUS_B, ~RTC_B_DSE, RTC_B_24HR);
     rtc_read(CMOS_STATUS_C);
@@ -73,6 +75,8 @@ int RTCusers VARLOW;
 void
 rtc_use(void)
 {
+    if (!CONFIG_RTC_TIMER)
+        return;
     int count = GET_LOW(RTCusers);
     SET_LOW(RTCusers, count+1);
     if (count)
@@ -84,6 +88,8 @@ rtc_use(void)
 void
 rtc_release(void)
 {
+    if (!CONFIG_RTC_TIMER)
+        return;
     int count = GET_LOW(RTCusers);
     SET_LOW(RTCusers, count-1);
     if (count != 1)
diff --git a/src/stacks.c b/src/stacks.c
index 0c5f79a..e67aeb6 100644
--- a/src/stacks.c
+++ b/src/stacks.c
@@ -574,7 +574,7 @@ thread_setup(void)
 int
 threads_during_optionroms(void)
 {
-    return CONFIG_THREADS && ThreadControl == 2 && in_post();
+    return CONFIG_THREADS && CONFIG_RTC_TIMER && ThreadControl == 2 && in_post();
 }
 
 // Switch to next thread stack.
-- 
1.9.3




More information about the SeaBIOS mailing list