Only allow CONFIG_XEN when not CONFIG_COREBOOT.
[seabios.git] / src / apm.c
index 2ca2c640edc446c6df425f48835b6cf23e65a3f3..2029ae2487519d68ae4e1d4c44bc4c929a008cf5 100644 (file)
--- a/src/apm.c
+++ b/src/apm.c
@@ -53,8 +53,8 @@ handle_155301(struct bregs *regs)
 }
 
 // Assembler entry points defined in romlayout.S
-extern void apm16protected_entry();
-extern void apm32protected_entry();
+extern void apm16protected_entry(void);
+extern void apm32protected_entry(void);
 
 // APM 16 bit protected mode interface connect
 static void
@@ -105,6 +105,15 @@ handle_155306(struct bregs *regs)
     set_success(regs);
 }
 
+void
+apm_shutdown(void)
+{
+    irq_disable();
+    out_str("Shutdown");
+    for (;;)
+        hlt();
+}
+
 // APM Set Power State
 static void
 handle_155307(struct bregs *regs)
@@ -121,10 +130,7 @@ handle_155307(struct bregs *regs)
         out_str("Suspend");
         break;
     case 3:
-        irq_disable();
-        out_str("Shutdown");
-        for (;;)
-            hlt();
+        apm_shutdown();
         break;
     }
     set_success(regs);
@@ -155,7 +161,7 @@ handle_15530a(struct bregs *regs)
 static void
 handle_15530b(struct bregs *regs)
 {
-    set_code_fail_silent(regs, RET_ENOEVENT);
+    set_code_invalid_silent(regs, RET_ENOEVENT);
 }
 
 // APM Driver Version
@@ -186,14 +192,14 @@ handle_155310(struct bregs *regs)
 static void
 handle_1553XX(struct bregs *regs)
 {
-    set_fail(regs);
+    set_unimplemented(regs);
 }
 
-void VISIBLE16
+void
 handle_1553(struct bregs *regs)
 {
     if (! CONFIG_APMBIOS) {
-        set_code_fail(regs, RET_EUNSUPPORTED);
+        set_code_invalid(regs, RET_EUNSUPPORTED);
         return;
     }
 
@@ -216,3 +222,17 @@ handle_1553(struct bregs *regs)
     default:   handle_1553XX(regs); break;
     }
 }
+
+void VISIBLE16
+handle_apm16(struct bregs *regs)
+{
+    debug_enter(regs, DEBUG_HDL_apm);
+    handle_1553(regs);
+}
+
+void VISIBLE32SEG
+handle_apm32(struct bregs *regs)
+{
+    debug_enter(regs, DEBUG_HDL_apm);
+    handle_1553(regs);
+}