diff options
author | Michael Knudsen <mk@cvs.openbsd.org> | 2006-06-11 10:56:40 +0000 |
---|---|---|
committer | Michael Knudsen <mk@cvs.openbsd.org> | 2006-06-11 10:56:40 +0000 |
commit | c707e589a9996bacb9bc6c00142807870174750d (patch) | |
tree | 384f91d05fb43fae529570ee556658e3bb3a6eef /sys | |
parent | c2838634d72b7c7a7efbdf4d4de197397c33e5f8 (diff) |
Get rid of the wdt(4) char device. We have watchdog(4) and
watchdogd(4), so there's no point in supporting old, unused,
non-generic interfaces.
Tested by < jg , rilk - com>.
The sensors available on the WDT501 model will be supported later using
the sensors framework.
ok mickey markus
Diffstat (limited to 'sys')
-rw-r--r-- | sys/arch/amd64/amd64/conf.c | 12 | ||||
-rw-r--r-- | sys/arch/i386/i386/conf.c | 12 | ||||
-rw-r--r-- | sys/dev/pci/wdt.c | 203 |
3 files changed, 5 insertions, 222 deletions
diff --git a/sys/arch/amd64/amd64/conf.c b/sys/arch/amd64/amd64/conf.c index 431b3c3c931..dbccf5114e0 100644 --- a/sys/arch/amd64/amd64/conf.c +++ b/sys/arch/amd64/amd64/conf.c @@ -1,4 +1,4 @@ -/* $OpenBSD: conf.c,v 1.8 2005/07/31 06:39:06 dlg Exp $ */ +/* $OpenBSD: conf.c,v 1.9 2006/06/11 10:56:39 mk Exp $ */ /* * Copyright (c) 1994, 1995 Charles M. Hannum. All rights reserved. @@ -112,12 +112,6 @@ int nblkdev = sizeof(bdevsw) / sizeof(bdevsw[0]); (dev_type_stop((*))) enodev, 0, dev_init(c,n,select), \ (dev_type_mmap((*))) enodev, 0 } -/* open, close, read, ioctl */ -#define cdev_wdt_init(c, n) { \ - dev_init(c,n,open), dev_init(c,n,close), (dev_type_read((*))) enodev, \ - (dev_type_write((*))) enodev, dev_init(c,n,ioctl), \ - (dev_type_stop((*))) enodev, 0, seltrue, (dev_type_mmap((*))) enodev } - #define mmread mmrw #define mmwrite mmrw @@ -165,8 +159,6 @@ cdev_decl(music); cdev_decl(xfs_dev); #endif #include "bktr.h" -#include "wdt.h" -cdev_decl(wdt); #include "ksyms.h" #include "usb.h" #include "uhid.h" @@ -262,7 +254,7 @@ struct cdevsw cdevsw[] = cdev_midi_init(NMIDI,midi), /* 52: MIDI I/O */ cdev_midi_init(NSEQUENCER,sequencer), /* 53: sequencer I/O */ cdev_disk_init(NRAID,raid), /* 54: RAIDframe disk driver */ - cdev_wdt_init(NWDT,wdt), /* 55: WDT50x watchdog timer */ + cdev_notdef(), /* 55: */ /* The following slots are reserved for isdn4bsd. */ cdev_notdef(), /* 56: i4b main device */ cdev_notdef(), /* 57: i4b control device */ diff --git a/sys/arch/i386/i386/conf.c b/sys/arch/i386/i386/conf.c index c2323d3d89f..a156071731e 100644 --- a/sys/arch/i386/i386/conf.c +++ b/sys/arch/i386/i386/conf.c @@ -1,4 +1,4 @@ -/* $OpenBSD: conf.c,v 1.112 2005/12/31 22:40:37 miod Exp $ */ +/* $OpenBSD: conf.c,v 1.113 2006/06/11 10:56:39 mk Exp $ */ /* $NetBSD: conf.c,v 1.75 1996/05/03 19:40:20 christos Exp $ */ /* @@ -113,12 +113,6 @@ int nblkdev = sizeof(bdevsw) / sizeof(bdevsw[0]); (dev_type_stop((*))) enodev, 0, dev_init(c,n,poll), \ (dev_type_mmap((*))) enodev, 0 } -/* open, close, read, ioctl */ -#define cdev_wdt_init(c, n) { \ - dev_init(c,n,open), dev_init(c,n,close), (dev_type_read((*))) enodev, \ - (dev_type_write((*))) enodev, dev_init(c,n,ioctl), \ - (dev_type_stop((*))) enodev, 0, seltrue, (dev_type_mmap((*))) enodev } - /* open, close, read */ #define cdev_nvram_init(c,n) { \ dev_init(c,n,open), dev_init(c,n,close), dev_init(c,n,read), \ @@ -177,8 +171,6 @@ cdev_decl(music); cdev_decl(xfs_dev); #endif #include "bktr.h" -#include "wdt.h" -cdev_decl(wdt); #include "ksyms.h" #include "usb.h" #include "uhid.h" @@ -287,7 +279,7 @@ struct cdevsw cdevsw[] = cdev_midi_init(NMIDI,midi), /* 52: MIDI I/O */ cdev_midi_init(NSEQUENCER,sequencer), /* 53: sequencer I/O */ cdev_disk_init(NRAID,raid), /* 54: RAIDframe disk driver */ - cdev_wdt_init(NWDT,wdt), /* 55: WDT50x watchdog timer */ + cdev_notdef(), /* 55: */ /* The following slots are reserved for isdn4bsd. */ cdev_notdef(), /* 56: i4b main device */ cdev_notdef(), /* 57: i4b control device */ diff --git a/sys/dev/pci/wdt.c b/sys/dev/pci/wdt.c index 2a6a31a51a9..7d6134ef627 100644 --- a/sys/dev/pci/wdt.c +++ b/sys/dev/pci/wdt.c @@ -1,4 +1,4 @@ -/* $OpenBSD: wdt.c,v 1.8 2006/05/31 01:40:40 mk Exp $ */ +/* $OpenBSD: wdt.c,v 1.9 2006/06/11 10:56:39 mk Exp $ */ /*- * Copyright (c) 1998,1999 Alex Nash @@ -53,12 +53,6 @@ struct wdt_softc { /* unit number (unlikely more than one would be present though) */ int unit; - /* how many processes are in WIOCSCHED */ - unsigned procs; - - /* watchdog timeout */ - unsigned timeout_secs; - /* device access through bus space */ bus_space_tag_t iot; bus_space_handle_t ioh; @@ -67,9 +61,6 @@ struct wdt_softc { /* externally visible functions */ int wdtprobe(struct device *, void *, void *); void wdtattach(struct device *, struct device *, void *); -int wdtopen(dev_t, int, int, struct proc *); -int wdtclose(dev_t, int, int, struct proc *); -int wdtioctl(dev_t, u_long, caddr_t, int, struct proc *); /* static functions */ static int wdt_is501(struct wdt_softc *wdt); @@ -78,17 +69,8 @@ static void wdt_8254_mode(struct wdt_softc *wdt, int counter, int mode); static int wdt_set_timeout(void *wdt, int seconds); static void wdt_init_timer(struct wdt_softc *wdt); static void wdt_buzzer_off(struct wdt_softc *wdt); -static int wdt_read_temperature(struct wdt_softc *wdt); -static int wdt_read_status(struct wdt_softc *wdt); -static void wdt_display_status(struct wdt_softc *wdt); -static int wdt_get_state(struct wdt_softc *wdt, struct wdt_state *state); -static int wdt_sched(struct wdt_softc *wdt, struct proc *p); static void wdt_timer_disable(struct wdt_softc *wdt); -#if WDT_DISABLE_BUZZER -static void wdt_buzzer_disable(struct wdt_softc *wdt); -#else static void wdt_buzzer_enable(struct wdt_softc *wdt); -#endif struct cfattach wdt_ca = { sizeof(struct wdt_softc), wdtprobe, wdtattach @@ -164,8 +146,6 @@ wdtattach (parent, self, aux) /* initialize the watchdog timer structure */ wdt->unit = unit; - wdt->procs = 0; - wdt->timeout_secs = 0; /* check the feature set available */ if (wdt_is501(wdt)) @@ -180,11 +160,7 @@ wdtattach (parent, self, aux) */ wdt_buzzer_off(wdt); -#ifdef WDT_DISABLE_BUZZER - wdt_buzzer_disable(wdt); -#else wdt_buzzer_enable(wdt); -#endif } /* initialize the timer modes and the lower 16-bit counter */ @@ -199,51 +175,6 @@ wdtattach (parent, self, aux) * register with the watchdog framework */ wdog_register(wdt, wdt_set_timeout); - - printf("\n"); - wdt_display_status(wdt); -} - -int -wdtopen (dev_t dev, int flags, int fmt, struct proc *p) -{ - if (UNIT(dev) >= wdt_cd.cd_ndevs || wdt_cd.cd_devs[UNIT(dev)] == NULL) - return (ENXIO); - - return(0); -} - -int -wdtclose (dev_t dev, int flags, int fmt, struct proc *p) -{ - return(0); -} - -int -wdtioctl (dev_t dev, u_long cmd, caddr_t arg, int flag, struct proc *p) -{ - struct wdt_softc *wdt = wdt_cd.cd_devs[UNIT(dev)]; - int error; - - switch (cmd) { - case WIOCSCHED: - error = wdt_sched(wdt, p); - break; - - case WIOCGETSTATE: - if (wdt->features) - error = wdt_get_state(wdt, - (struct wdt_state *)arg); - else - error = ENXIO; - break; - - default: - error = ENXIO; - break; - } - - return(error); } /* @@ -312,7 +243,6 @@ wdt_set_timeout (void *self, int seconds) wdt_timer_disable(wdt); if (seconds == 0) { - wdt->timeout_secs = 0; splx(s); return (0); } else if (seconds < 2) @@ -329,8 +259,6 @@ wdt_set_timeout (void *self, int seconds) /* enable the timer */ bus_space_write_1(wdt->iot, wdt->ioh, WDT_ENABLE_TIMER, 0); - wdt->timeout_secs = seconds; - splx(s); return (seconds); @@ -403,132 +331,3 @@ wdt_buzzer_disable (struct wdt_softc *wdt) wdt_8254_mode(wdt, WDT_8254_BUZZER, 0); } #endif - -/* - * wdt_read_temperature - * - * Returns the temperature (in Fahrenheit) from the board. - */ -static int -wdt_read_temperature (struct wdt_softc *wdt) -{ - unsigned v = bus_space_read_1(wdt->iot, wdt->ioh, WDT_TEMPERATURE); - - return((v * 11) / 15 + 7); -} - -/* - * wdt_read_status - * - * Returns the status register bits minus the counter refresh - * and IRQ generated bits. - */ -static int -wdt_read_status (struct wdt_softc *wdt) -{ - /* mask off counter refresh & IRQ generated bits */ - return(bus_space_read_1(wdt->iot, wdt->ioh, WDT_STATUS_REG) & 0x7E); -} - -/* - * wdt_display_status - * - * Displays the current timeout, temperature, and power supply - * over/undervoltages to the console. - */ -static void -wdt_display_status (struct wdt_softc *wdt) -{ - if (wdt->features) { - int status = wdt_read_status(wdt); - int temp = wdt_read_temperature(wdt); - - printf("wdt%d: WDT501 timeout %d secs, temp %d F", - wdt->unit, wdt->timeout_secs, temp); - - /* overvoltage bit is active low */ - if ((status & WDT_SR_PS_OVER) == 0) - printf(" <PS overvoltage>"); - - /* undervoltage bit is active low */ - if ((status & WDT_SR_PS_UNDER) == 0) - printf(" <PS undervoltage>"); - } else { - printf("wdt%d: WDT500 timeout %d secs", - wdt->unit, wdt->timeout_secs); - } - - printf("\n"); -} - -/* - * wdt_get_state - * - * Returns the temperature and status bits. - */ -static int -wdt_get_state (struct wdt_softc *wdt, struct wdt_state *state) -{ - state->temperature = wdt_read_temperature(wdt); - state->status = wdt_read_status(wdt); - - return(0); -} - -/* - * wdt_sched - * - * Put the process into an infinite loop in which: - * - * - The process sleeps, waiting for a wakeup() from the tsleep() - * handler. - * - When awakened, the process reloads the watchdog counter and - * repeats the loop. - * - * The only way the loop can be broken is if the process is interrupted - * via a signal. - * - * The whole point of this is to cause a watchdog timeout to be - * generated if processes are no longer being scheduled. - */ -static int -wdt_sched (struct wdt_softc *wdt, struct proc *p) -{ - int error; - int s; - - /* - * Regardless of the device permissions, you must be - * root to do this -- a process which is STOPPED - * while in this function can cause a reboot to occur - * if the counters aren't reloaded within wdt->timeout_secs - * seconds. - */ - if ((error = suser(p, 0))) - return(error); - - /* block out the timeout handler */ - s = splclock(); - - /* indicate that we are sleeping */ - ++wdt->procs; - - /* loop until the process is signaled */ - while (1) { - error = tsleep(wdt, PCATCH | PSWP, "wdtsch", 0); - - wdt_set_timeout(wdt, wdt->timeout_secs); - - if (error != 0) - break; - } - - /* remove sleeping indication */ - --wdt->procs; - - /* re-enable timeout handler */ - splx(s); - - return(error); -} - |