diff options
author | Alan Cox <alan@redhat.com> | 2008-05-19 09:06:25 -0400 |
---|---|---|
committer | Wim Van Sebroeck <wim@iguana.be> | 2008-05-28 07:51:32 -0400 |
commit | 0e6fa3fb38e2c89ba9abce9a8b74867f07d20d19 (patch) | |
tree | e99f14944b49e494fa0222bcd69db7e4dfbb680a /drivers/watchdog/iTCO_vendor_support.c | |
parent | 30abcec14573e3462f18d63f4a8f154a23689f1b (diff) |
[WATCHDOG 18/57] iTCO: unlocked_ioctl, coding style and cleanup
Review and switch to unlocked_ioctl
Signed-off-by: Alan Cox <alan@redhat.com>
Signed-off-by: Wim Van Sebroeck <wim@iguana.be>
Diffstat (limited to 'drivers/watchdog/iTCO_vendor_support.c')
-rw-r--r-- | drivers/watchdog/iTCO_vendor_support.c | 53 |
1 files changed, 29 insertions, 24 deletions
diff --git a/drivers/watchdog/iTCO_vendor_support.c b/drivers/watchdog/iTCO_vendor_support.c index cafc465f2ae3..09e9534ac2e4 100644 --- a/drivers/watchdog/iTCO_vendor_support.c +++ b/drivers/watchdog/iTCO_vendor_support.c | |||
@@ -32,7 +32,9 @@ | |||
32 | #include <linux/init.h> /* For __init/__exit/... */ | 32 | #include <linux/init.h> /* For __init/__exit/... */ |
33 | #include <linux/ioport.h> /* For io-port access */ | 33 | #include <linux/ioport.h> /* For io-port access */ |
34 | 34 | ||
35 | #include <asm/io.h> /* For inb/outb/... */ | 35 | #include <linux/io.h> /* For inb/outb/... */ |
36 | |||
37 | #include "iTCO_vendor.h" | ||
36 | 38 | ||
37 | /* iTCO defines */ | 39 | /* iTCO defines */ |
38 | #define SMI_EN acpibase + 0x30 /* SMI Control and Enable Register */ | 40 | #define SMI_EN acpibase + 0x30 /* SMI Control and Enable Register */ |
@@ -40,10 +42,12 @@ | |||
40 | #define TCO1_STS TCOBASE + 0x04 /* TCO1 Status Register */ | 42 | #define TCO1_STS TCOBASE + 0x04 /* TCO1 Status Register */ |
41 | 43 | ||
42 | /* List of vendor support modes */ | 44 | /* List of vendor support modes */ |
43 | #define SUPERMICRO_OLD_BOARD 1 /* SuperMicro Pentium 3 Era 370SSE+-OEM1/P3TSSE */ | 45 | /* SuperMicro Pentium 3 Era 370SSE+-OEM1/P3TSSE */ |
44 | #define SUPERMICRO_NEW_BOARD 2 /* SuperMicro Pentium 4 / Xeon 4 / EMT64T Era Systems */ | 46 | #define SUPERMICRO_OLD_BOARD 1 |
47 | /* SuperMicro Pentium 4 / Xeon 4 / EMT64T Era Systems */ | ||
48 | #define SUPERMICRO_NEW_BOARD 2 | ||
45 | 49 | ||
46 | static int vendorsupport = 0; | 50 | static int vendorsupport; |
47 | module_param(vendorsupport, int, 0); | 51 | module_param(vendorsupport, int, 0); |
48 | MODULE_PARM_DESC(vendorsupport, "iTCO vendor specific support mode, default=0 (none), 1=SuperMicro Pent3, 2=SuperMicro Pent4+"); | 52 | MODULE_PARM_DESC(vendorsupport, "iTCO vendor specific support mode, default=0 (none), 1=SuperMicro Pent3, 2=SuperMicro Pent4+"); |
49 | 53 | ||
@@ -143,34 +147,35 @@ static void supermicro_old_pre_keepalive(unsigned long acpibase) | |||
143 | */ | 147 | */ |
144 | 148 | ||
145 | /* I/O Port's */ | 149 | /* I/O Port's */ |
146 | #define SM_REGINDEX 0x2e /* SuperMicro ICH4+ Register Index */ | 150 | #define SM_REGINDEX 0x2e /* SuperMicro ICH4+ Register Index */ |
147 | #define SM_DATAIO 0x2f /* SuperMicro ICH4+ Register Data I/O */ | 151 | #define SM_DATAIO 0x2f /* SuperMicro ICH4+ Register Data I/O */ |
148 | 152 | ||
149 | /* Control Register's */ | 153 | /* Control Register's */ |
150 | #define SM_CTLPAGESW 0x07 /* SuperMicro ICH4+ Control Page Switch */ | 154 | #define SM_CTLPAGESW 0x07 /* SuperMicro ICH4+ Control Page Switch */ |
151 | #define SM_CTLPAGE 0x08 /* SuperMicro ICH4+ Control Page Num */ | 155 | #define SM_CTLPAGE 0x08 /* SuperMicro ICH4+ Control Page Num */ |
152 | 156 | ||
153 | #define SM_WATCHENABLE 0x30 /* Watchdog enable: Bit 0: 0=off, 1=on */ | 157 | #define SM_WATCHENABLE 0x30 /* Watchdog enable: Bit 0: 0=off, 1=on */ |
154 | 158 | ||
155 | #define SM_WATCHPAGE 0x87 /* Watchdog unlock control page */ | 159 | #define SM_WATCHPAGE 0x87 /* Watchdog unlock control page */ |
156 | 160 | ||
157 | #define SM_ENDWATCH 0xAA /* Watchdog lock control page */ | 161 | #define SM_ENDWATCH 0xAA /* Watchdog lock control page */ |
158 | 162 | ||
159 | #define SM_COUNTMODE 0xf5 /* Watchdog count mode select */ | 163 | #define SM_COUNTMODE 0xf5 /* Watchdog count mode select */ |
160 | /* (Bit 3: 0 = seconds, 1 = minutes */ | 164 | /* (Bit 3: 0 = seconds, 1 = minutes */ |
161 | 165 | ||
162 | #define SM_WATCHTIMER 0xf6 /* 8-bits, Watchdog timer counter (RW) */ | 166 | #define SM_WATCHTIMER 0xf6 /* 8-bits, Watchdog timer counter (RW) */ |
163 | 167 | ||
164 | #define SM_RESETCONTROL 0xf7 /* Watchdog reset control */ | 168 | #define SM_RESETCONTROL 0xf7 /* Watchdog reset control */ |
165 | /* Bit 6: timer is reset by kbd interrupt */ | 169 | /* Bit 6: timer is reset by kbd interrupt */ |
166 | /* Bit 7: timer is reset by mouse interrupt */ | 170 | /* Bit 7: timer is reset by mouse interrupt */ |
167 | 171 | ||
168 | static void supermicro_new_unlock_watchdog(void) | 172 | static void supermicro_new_unlock_watchdog(void) |
169 | { | 173 | { |
170 | outb(SM_WATCHPAGE, SM_REGINDEX); /* Write 0x87 to port 0x2e twice */ | 174 | /* Write 0x87 to port 0x2e twice */ |
171 | outb(SM_WATCHPAGE, SM_REGINDEX); | 175 | outb(SM_WATCHPAGE, SM_REGINDEX); |
172 | 176 | outb(SM_WATCHPAGE, SM_REGINDEX); | |
173 | outb(SM_CTLPAGESW, SM_REGINDEX); /* Switch to watchdog control page */ | 177 | /* Switch to watchdog control page */ |
178 | outb(SM_CTLPAGESW, SM_REGINDEX); | ||
174 | outb(SM_CTLPAGE, SM_DATAIO); | 179 | outb(SM_CTLPAGE, SM_DATAIO); |
175 | } | 180 | } |
176 | 181 | ||
@@ -192,7 +197,7 @@ static void supermicro_new_pre_start(unsigned int heartbeat) | |||
192 | outb(val, SM_DATAIO); | 197 | outb(val, SM_DATAIO); |
193 | 198 | ||
194 | /* Write heartbeat interval to WDOG */ | 199 | /* Write heartbeat interval to WDOG */ |
195 | outb (SM_WATCHTIMER, SM_REGINDEX); | 200 | outb(SM_WATCHTIMER, SM_REGINDEX); |
196 | outb((heartbeat & 255), SM_DATAIO); | 201 | outb((heartbeat & 255), SM_DATAIO); |
197 | 202 | ||
198 | /* Make sure keyboard/mouse interrupts don't interfere */ | 203 | /* Make sure keyboard/mouse interrupts don't interfere */ |
@@ -277,7 +282,7 @@ EXPORT_SYMBOL(iTCO_vendor_pre_set_heartbeat); | |||
277 | 282 | ||
278 | int iTCO_vendor_check_noreboot_on(void) | 283 | int iTCO_vendor_check_noreboot_on(void) |
279 | { | 284 | { |
280 | switch(vendorsupport) { | 285 | switch (vendorsupport) { |
281 | case SUPERMICRO_OLD_BOARD: | 286 | case SUPERMICRO_OLD_BOARD: |
282 | return 0; | 287 | return 0; |
283 | default: | 288 | default: |
@@ -288,13 +293,13 @@ EXPORT_SYMBOL(iTCO_vendor_check_noreboot_on); | |||
288 | 293 | ||
289 | static int __init iTCO_vendor_init_module(void) | 294 | static int __init iTCO_vendor_init_module(void) |
290 | { | 295 | { |
291 | printk (KERN_INFO PFX "vendor-support=%d\n", vendorsupport); | 296 | printk(KERN_INFO PFX "vendor-support=%d\n", vendorsupport); |
292 | return 0; | 297 | return 0; |
293 | } | 298 | } |
294 | 299 | ||
295 | static void __exit iTCO_vendor_exit_module(void) | 300 | static void __exit iTCO_vendor_exit_module(void) |
296 | { | 301 | { |
297 | printk (KERN_INFO PFX "Module Unloaded\n"); | 302 | printk(KERN_INFO PFX "Module Unloaded\n"); |
298 | } | 303 | } |
299 | 304 | ||
300 | module_init(iTCO_vendor_init_module); | 305 | module_init(iTCO_vendor_init_module); |