2 * First-run SMI C entry point
3 * NetWatch system management mode administration console
5 * Copyright (c) 2008 Jacob Potter and Joshua Wise. All rights reserved.
6 * This program is free software; you can redistribute and/or modify it under
7 * the terms found in the file LICENSE in the root of this source tree.
13 #include <video_defines.h>
16 #include <pci-bother.h>
21 #include "../net/net.h"
22 #include "vga-overlay.h"
24 unsigned int counter = 0;
25 unsigned long pcisave = 0;
26 unsigned char vgasave = 0;
32 /* Reenable caching on SMRAM. */
33 WRMSR(0x202, (RDMSR(0x202) & ~(0xFFULL)) | 0x06ULL);
42 fb->getvmode(fb->priv);
45 if (!fb || fb->curmode.text)
47 sprintf(statstr, "NetWatch! %08x %08x", smi_status(), counter);
48 strblit(statstr, 0, 0, 0);
53 if (inl(0x840) & 0x1000)
69 /* Disable caching on SMRAM again, to prevent the user from whacking us. */
70 WRMSR(0x202, RDMSR(0x202) & ~(0xFFULL));
73 extern void timer_handler(smi_event_t ev);
74 extern void kbc_handler(smi_event_t ev);
75 extern void gbl_rls_handler(smi_event_t ev);
77 void __firstrun_stub()
79 /* Turn on the SMIs we want */
82 smi_register_handler(SMI_EVENT_FAST_TIMER, timer_handler);
83 smi_enable_event(SMI_EVENT_FAST_TIMER);
85 smi_register_handler(SMI_EVENT_DEVTRAP_KBC, kbc_handler);
86 smi_enable_event(SMI_EVENT_DEVTRAP_KBC);
88 smi_register_handler(SMI_EVENT_GBL_RLS, gbl_rls_handler);
89 smi_enable_event(SMI_EVENT_GBL_RLS);