Add power button handler (and test SCI) for ACPI

This commit is contained in:
Mark
2020-02-03 15:00:40 +02:00
parent 9cc94a4d81
commit 897bf87843
5 changed files with 15 additions and 187 deletions
+1 -1
View File
@@ -69,5 +69,5 @@ ACPI_STATUS AcpiOsWritePciConfiguration(ACPI_PCI_ID *PciId, UINT32 Reg, UINT64 V
}
UINT64 AcpiOsGetTimer(void) {
return 0;
return system_time;
}
-2
View File
@@ -5,12 +5,10 @@
static ACPI_OSD_HANDLER sci_wrapped;
uint32_t sci_wrapper(void *ctx) {
kdebug("!!! SCI WRAPPER !!!\n");
return sci_wrapped(ctx);
}
ACPI_STATUS AcpiOsInstallInterruptHandler(UINT32 InterruptNumber, ACPI_OSD_HANDLER ServiceRoutine, void *Context) {
kwarn("ACPI ISR INSTALL STUB\n");
sci_wrapped = ServiceRoutine;
irq_add_leg_handler(InterruptNumber, sci_wrapper, Context);
return AE_OK;
+11
View File
@@ -18,6 +18,11 @@ static uint8_t checksum(const void *ptr, size_t size) {
return v;
}
static uint32_t acpi_power_button_handler(void *ctx) {
kinfo("Power button was pressed\n");
return 0;
}
static ACPI_STATUS acpica_init(void) {
ACPI_STATUS ret;
ACPI_OBJECT arg1;
@@ -67,6 +72,12 @@ static ACPI_STATUS acpica_init(void) {
return ret;
}
if (ACPI_FAILURE(ret = AcpiInstallFixedEventHandler(ACPI_EVENT_POWER_BUTTON,
acpi_power_button_handler,
NULL))) {
kwarn("Failed to install ACPI power button handler: %s\n", AcpiFormatException(ret));
}
return AE_OK;
}
+2
View File
@@ -153,6 +153,8 @@ void sched_debug_cycle(uint64_t delta_ms) {
struct amd64_phys_stat phys_st;
struct amd64_pool_stat pool_st;
return;
kdebug("--- DEBUG_CYCLE ---\n");
debugs(DEBUG_DEFAULT, "Process tree:\n");