0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016 #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
0017
0018
0019 #define DRV_NAME "iTCO_vendor_support"
0020 #define DRV_VERSION "1.04"
0021
0022
0023 #include <linux/module.h> /* For module specific items */
0024 #include <linux/moduleparam.h> /* For new moduleparam's */
0025 #include <linux/types.h> /* For standard types (like size_t) */
0026 #include <linux/errno.h> /* For the -ENODEV/... values */
0027 #include <linux/kernel.h> /* For printk/panic/... */
0028 #include <linux/init.h> /* For __init/__exit/... */
0029 #include <linux/ioport.h> /* For io-port access */
0030 #include <linux/io.h> /* For inb/outb/... */
0031
0032 #include "iTCO_vendor.h"
0033
0034
0035
0036 #define SUPERMICRO_OLD_BOARD 1
0037
0038 #define SUPERMICRO_NEW_BOARD 2
0039
0040 #define BROKEN_BIOS 911
0041
0042 int iTCO_vendorsupport;
0043 EXPORT_SYMBOL(iTCO_vendorsupport);
0044
0045 module_param_named(vendorsupport, iTCO_vendorsupport, int, 0);
0046 MODULE_PARM_DESC(vendorsupport, "iTCO vendor specific support mode, default="
0047 "0 (none), 1=SuperMicro Pent3, 911=Broken SMI BIOS");
0048
0049
0050
0051
0052
0053
0054
0055
0056
0057
0058
0059
0060
0061
0062
0063
0064
0065
0066
0067
0068
0069
0070
0071
0072
0073
0074
0075
0076
0077 static void supermicro_old_pre_start(struct resource *smires)
0078 {
0079 unsigned long val32;
0080
0081
0082 val32 = inl(smires->start);
0083 val32 &= 0xffffdfff;
0084 outl(val32, smires->start);
0085 }
0086
0087 static void supermicro_old_pre_stop(struct resource *smires)
0088 {
0089 unsigned long val32;
0090
0091
0092 val32 = inl(smires->start);
0093 val32 |= 0x00002000;
0094 outl(val32, smires->start);
0095 }
0096
0097
0098
0099
0100
0101
0102
0103
0104
0105
0106
0107
0108
0109
0110
0111
0112
0113
0114
0115
0116
0117
0118
0119
0120
0121
0122
0123
0124
0125
0126
0127
0128 static void broken_bios_start(struct resource *smires)
0129 {
0130 unsigned long val32;
0131
0132 val32 = inl(smires->start);
0133
0134
0135 val32 &= 0xffffdffe;
0136 outl(val32, smires->start);
0137 }
0138
0139 static void broken_bios_stop(struct resource *smires)
0140 {
0141 unsigned long val32;
0142
0143 val32 = inl(smires->start);
0144
0145
0146 val32 |= 0x00002001;
0147 outl(val32, smires->start);
0148 }
0149
0150
0151
0152
0153
0154 void iTCO_vendor_pre_start(struct resource *smires,
0155 unsigned int heartbeat)
0156 {
0157 switch (iTCO_vendorsupport) {
0158 case SUPERMICRO_OLD_BOARD:
0159 supermicro_old_pre_start(smires);
0160 break;
0161 case BROKEN_BIOS:
0162 broken_bios_start(smires);
0163 break;
0164 }
0165 }
0166 EXPORT_SYMBOL(iTCO_vendor_pre_start);
0167
0168 void iTCO_vendor_pre_stop(struct resource *smires)
0169 {
0170 switch (iTCO_vendorsupport) {
0171 case SUPERMICRO_OLD_BOARD:
0172 supermicro_old_pre_stop(smires);
0173 break;
0174 case BROKEN_BIOS:
0175 broken_bios_stop(smires);
0176 break;
0177 }
0178 }
0179 EXPORT_SYMBOL(iTCO_vendor_pre_stop);
0180
0181 int iTCO_vendor_check_noreboot_on(void)
0182 {
0183 switch (iTCO_vendorsupport) {
0184 case SUPERMICRO_OLD_BOARD:
0185 return 0;
0186 default:
0187 return 1;
0188 }
0189 }
0190 EXPORT_SYMBOL(iTCO_vendor_check_noreboot_on);
0191
0192 static int __init iTCO_vendor_init_module(void)
0193 {
0194 if (iTCO_vendorsupport == SUPERMICRO_NEW_BOARD) {
0195 pr_warn("Option vendorsupport=%d is no longer supported, "
0196 "please use the w83627hf_wdt driver instead\n",
0197 SUPERMICRO_NEW_BOARD);
0198 return -EINVAL;
0199 }
0200 pr_info("vendor-support=%d\n", iTCO_vendorsupport);
0201 return 0;
0202 }
0203
0204 static void __exit iTCO_vendor_exit_module(void)
0205 {
0206 pr_info("Module Unloaded\n");
0207 }
0208
0209 module_init(iTCO_vendor_init_module);
0210 module_exit(iTCO_vendor_exit_module);
0211
0212 MODULE_AUTHOR("Wim Van Sebroeck <wim@iguana.be>, "
0213 "R. Seretny <lkpatches@paypc.com>");
0214 MODULE_DESCRIPTION("Intel TCO Vendor Specific WatchDog Timer Driver Support");
0215 MODULE_VERSION(DRV_VERSION);
0216 MODULE_LICENSE("GPL");