20 #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
23 #define DRV_NAME "iTCO_vendor_support"
24 #define DRV_VERSION "1.04"
27 #include <linux/module.h>
29 #include <linux/types.h>
30 #include <linux/errno.h>
31 #include <linux/kernel.h>
40 #define SUPERMICRO_OLD_BOARD 1
42 #define SUPERMICRO_NEW_BOARD 2
44 #define BROKEN_BIOS 911
46 static int vendorsupport;
48 MODULE_PARM_DESC(vendorsupport,
"iTCO vendor specific support mode, default="
49 "0 (none), 1=SuperMicro Pent3, 2=SuperMicro Pent4+, "
50 "911=Broken SMI BIOS");
80 static void supermicro_old_pre_start(
struct resource *smires)
90 static void supermicro_old_pre_stop(
struct resource *smires)
143 #define SM_REGINDEX 0x2e
144 #define SM_DATAIO 0x2f
147 #define SM_CTLPAGESW 0x07
148 #define SM_CTLPAGE 0x08
150 #define SM_WATCHENABLE 0x30
152 #define SM_WATCHPAGE 0x87
154 #define SM_ENDWATCH 0xAA
156 #define SM_COUNTMODE 0xf5
159 #define SM_WATCHTIMER 0xf6
161 #define SM_RESETCONTROL 0xf7
165 static void supermicro_new_unlock_watchdog(
void)
175 static void supermicro_new_lock_watchdog(
void)
180 static void supermicro_new_pre_start(
unsigned int heartbeat)
184 supermicro_new_unlock_watchdog();
208 supermicro_new_lock_watchdog();
211 static void supermicro_new_pre_stop(
void)
215 supermicro_new_unlock_watchdog();
223 supermicro_new_lock_watchdog();
226 static void supermicro_new_pre_set_heartbeat(
unsigned int heartbeat)
228 supermicro_new_unlock_watchdog();
234 supermicro_new_lock_watchdog();
268 static void broken_bios_start(
struct resource *smires)
279 static void broken_bios_stop(
struct resource *smires)
295 unsigned int heartbeat)
297 switch (vendorsupport) {
299 supermicro_old_pre_start(smires);
302 supermicro_new_pre_start(heartbeat);
305 broken_bios_start(smires);
313 switch (vendorsupport) {
315 supermicro_old_pre_stop(smires);
318 supermicro_new_pre_stop();
321 broken_bios_stop(smires);
330 supermicro_new_pre_set_heartbeat(heartbeat);
337 supermicro_new_pre_set_heartbeat(heartbeat);
343 switch (vendorsupport) {
352 static int __init iTCO_vendor_init_module(
void)
354 pr_info(
"vendor-support=%d\n", vendorsupport);
358 static void __exit iTCO_vendor_exit_module(
void)