From 73fb9b4cd8d1b1722077985594e50dd38893ca5f Mon Sep 17 00:00:00 2001 From: Joshua Wise Date: Thu, 25 Sep 2008 21:41:58 -0400 Subject: [PATCH] Add gbl_rls handler --- aseg/counter.c | 9 +++++++++ aseg/firstrun.c | 4 ++++ ich2/smi.c | 15 ++++++++++++++- include/smi.h | 1 + 4 files changed, 28 insertions(+), 1 deletion(-) diff --git a/aseg/counter.c b/aseg/counter.c index 3c22c05..4c53b59 100644 --- a/aseg/counter.c +++ b/aseg/counter.c @@ -65,6 +65,15 @@ void kbc_handler(smi_event_t ev) pci_dump(); } +void gbl_rls_handler(smi_event_t ev) +{ + unsigned long ecx; + + ecx = *(unsigned char*)0xAFFD4; + dologf("ECX was %08x", ecx); + *(unsigned long*)0xAFFD4 = 0x2BADD00D; +} + void smi_entry(void) { char statstr[512]; diff --git a/aseg/firstrun.c b/aseg/firstrun.c index ec09a82..e0e2904 100644 --- a/aseg/firstrun.c +++ b/aseg/firstrun.c @@ -9,6 +9,7 @@ extern int _bss, _bssend; extern void timer_handler(smi_event_t ev); extern void kbc_handler(smi_event_t ev); +extern void gbl_rls_handler(smi_event_t ev); void __firstrun_start() { unsigned char *bp; @@ -36,6 +37,9 @@ void __firstrun_start() { smi_register_handler(SMI_EVENT_DEVTRAP_KBC, kbc_handler); smi_enable_event(SMI_EVENT_DEVTRAP_KBC); + + smi_register_handler(SMI_EVENT_GBL_RLS, gbl_rls_handler); + smi_enable_event(SMI_EVENT_GBL_RLS); smi_enable(); diff --git a/ich2/smi.c b/ich2/smi.c index 0a0ddf4..7f96421 100644 --- a/ich2/smi.c +++ b/ich2/smi.c @@ -42,7 +42,10 @@ void smi_poll() if (sts & ICH2_SMI_STS_BIOS_STS) { - output("Unhandled: BIOS_STS"); + if (_handlers[SMI_EVENT_GBL_RLS] == SMI_HANDLER_NONE) + output("Unhandled: BIOS_STS"); + else if (_handlers[SMI_EVENT_GBL_RLS] != SMI_HANDLER_IGNORE) + _handlers[SMI_EVENT_GBL_RLS](SMI_EVENT_GBL_RLS); outl(_get_PMBASE() + ICH2_PMBASE_SMI_STS, ICH2_SMI_STS_BIOS_STS); } @@ -205,6 +208,11 @@ int smi_enable_event(smi_event_t ev) inl(_get_PMBASE() + ICH2_PMBASE_DEVTRAP_EN) | ICH2_DEVTRAP_EN_KBC_TRP_EN); return 0; + case SMI_EVENT_GBL_RLS: + outl(_get_PMBASE() + ICH2_PMBASE_SMI_EN, + inl(_get_PMBASE() + ICH2_PMBASE_SMI_EN) | + ICH2_SMI_EN_BIOS_EN); + return 0; default: return -1; } @@ -224,6 +232,11 @@ int smi_disable_event(smi_event_t ev) inl(_get_PMBASE() + ICH2_PMBASE_DEVTRAP_EN) & ~ICH2_DEVTRAP_EN_KBC_TRP_EN); return 0; + case SMI_EVENT_GBL_RLS: + outl(_get_PMBASE() + ICH2_PMBASE_SMI_EN, + inl(_get_PMBASE() + ICH2_PMBASE_SMI_EN) & + ~ICH2_SMI_EN_BIOS_EN); + return 0; default: return -1; } diff --git a/include/smi.h b/include/smi.h index e0fd0a0..69fd7ef 100644 --- a/include/smi.h +++ b/include/smi.h @@ -10,6 +10,7 @@ extern unsigned long smi_status(); /* Architecturally defined; for debugging onl typedef enum { SMI_EVENT_FAST_TIMER = 0, SMI_EVENT_DEVTRAP_KBC, + SMI_EVENT_GBL_RLS, SMI_EVENT_MAX } smi_event_t; -- 2.43.0