Mercurial > vordog
annotate vordog.c @ 0:71475f5afa92
Watchdog for Vortex86 6071 on FreeBSD
author | Thinker K.F. Li <thinker@branda.to> |
---|---|
date | Tue, 08 Jul 2008 09:57:54 +0800 |
parents | |
children | 0b9854adb86c |
rev | line source |
---|---|
0
71475f5afa92
Watchdog for Vortex86 6071 on FreeBSD
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
1 #include <sys/param.h> |
71475f5afa92
Watchdog for Vortex86 6071 on FreeBSD
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
2 #include <sys/bus.h> |
71475f5afa92
Watchdog for Vortex86 6071 on FreeBSD
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
3 #include <sys/conf.h> |
71475f5afa92
Watchdog for Vortex86 6071 on FreeBSD
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
4 #include <sys/kernel.h> |
71475f5afa92
Watchdog for Vortex86 6071 on FreeBSD
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
5 #include <sys/module.h> |
71475f5afa92
Watchdog for Vortex86 6071 on FreeBSD
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
6 #include <sys/systm.h> |
71475f5afa92
Watchdog for Vortex86 6071 on FreeBSD
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
7 #include <sys/proc.h> |
71475f5afa92
Watchdog for Vortex86 6071 on FreeBSD
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
8 #include <sys/ioccom.h> |
71475f5afa92
Watchdog for Vortex86 6071 on FreeBSD
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
9 #include <sys/types.h> |
71475f5afa92
Watchdog for Vortex86 6071 on FreeBSD
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
10 #include <sys/malloc.h> |
71475f5afa92
Watchdog for Vortex86 6071 on FreeBSD
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
11 #include "vordog.h" |
71475f5afa92
Watchdog for Vortex86 6071 on FreeBSD
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
12 |
71475f5afa92
Watchdog for Vortex86 6071 on FreeBSD
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
13 #if 1 |
71475f5afa92
Watchdog for Vortex86 6071 on FreeBSD
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
14 #undef __FreeBSD_version |
71475f5afa92
Watchdog for Vortex86 6071 on FreeBSD
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
15 #define __FreeBSD_version 800029 |
71475f5afa92
Watchdog for Vortex86 6071 on FreeBSD
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
16 #endif |
71475f5afa92
Watchdog for Vortex86 6071 on FreeBSD
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
17 |
71475f5afa92
Watchdog for Vortex86 6071 on FreeBSD
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
18 #define VD_STATUS 0x841 |
71475f5afa92
Watchdog for Vortex86 6071 on FreeBSD
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
19 #define VD_INITVAL 0x84a |
71475f5afa92
Watchdog for Vortex86 6071 on FreeBSD
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
20 #define VD_CTR 0x84b |
71475f5afa92
Watchdog for Vortex86 6071 on FreeBSD
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
21 |
71475f5afa92
Watchdog for Vortex86 6071 on FreeBSD
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
22 typedef struct vd_softc { |
71475f5afa92
Watchdog for Vortex86 6071 on FreeBSD
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
23 struct cdev *_cdev; |
71475f5afa92
Watchdog for Vortex86 6071 on FreeBSD
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
24 device_t dev; |
71475f5afa92
Watchdog for Vortex86 6071 on FreeBSD
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
25 int open_cnt; |
71475f5afa92
Watchdog for Vortex86 6071 on FreeBSD
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
26 int init_val; |
71475f5afa92
Watchdog for Vortex86 6071 on FreeBSD
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
27 } *vd_softc_t; |
71475f5afa92
Watchdog for Vortex86 6071 on FreeBSD
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
28 |
71475f5afa92
Watchdog for Vortex86 6071 on FreeBSD
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
29 #define CDEV_2_SOFTC(_cdev) ((_cdev)->si_drv1) |
71475f5afa92
Watchdog for Vortex86 6071 on FreeBSD
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
30 |
71475f5afa92
Watchdog for Vortex86 6071 on FreeBSD
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
31 static int |
71475f5afa92
Watchdog for Vortex86 6071 on FreeBSD
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
32 vordog_open(struct cdev *dev, int oflags, int devtype, struct thread *td) { |
71475f5afa92
Watchdog for Vortex86 6071 on FreeBSD
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
33 vd_softc_t sc; |
71475f5afa92
Watchdog for Vortex86 6071 on FreeBSD
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
34 |
71475f5afa92
Watchdog for Vortex86 6071 on FreeBSD
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
35 printf("vordog_open\n"); |
71475f5afa92
Watchdog for Vortex86 6071 on FreeBSD
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
36 sc = CDEV_2_SOFTC(dev); |
71475f5afa92
Watchdog for Vortex86 6071 on FreeBSD
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
37 sc->open_cnt++; |
71475f5afa92
Watchdog for Vortex86 6071 on FreeBSD
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
38 |
71475f5afa92
Watchdog for Vortex86 6071 on FreeBSD
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
39 return 0; |
71475f5afa92
Watchdog for Vortex86 6071 on FreeBSD
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
40 } |
71475f5afa92
Watchdog for Vortex86 6071 on FreeBSD
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
41 |
71475f5afa92
Watchdog for Vortex86 6071 on FreeBSD
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
42 static int |
71475f5afa92
Watchdog for Vortex86 6071 on FreeBSD
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
43 vordog_close(struct cdev *dev, int fflag, int devtype, struct thread *td) { |
71475f5afa92
Watchdog for Vortex86 6071 on FreeBSD
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
44 vd_softc_t sc; |
71475f5afa92
Watchdog for Vortex86 6071 on FreeBSD
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
45 |
71475f5afa92
Watchdog for Vortex86 6071 on FreeBSD
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
46 printf("vordog_close\n"); |
71475f5afa92
Watchdog for Vortex86 6071 on FreeBSD
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
47 sc = CDEV_2_SOFTC(dev); |
71475f5afa92
Watchdog for Vortex86 6071 on FreeBSD
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
48 sc->open_cnt--; |
71475f5afa92
Watchdog for Vortex86 6071 on FreeBSD
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
49 |
71475f5afa92
Watchdog for Vortex86 6071 on FreeBSD
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
50 return 0; |
71475f5afa92
Watchdog for Vortex86 6071 on FreeBSD
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
51 } |
71475f5afa92
Watchdog for Vortex86 6071 on FreeBSD
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
52 |
71475f5afa92
Watchdog for Vortex86 6071 on FreeBSD
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
53 static int |
71475f5afa92
Watchdog for Vortex86 6071 on FreeBSD
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
54 vordog_go_detach(void) { |
71475f5afa92
Watchdog for Vortex86 6071 on FreeBSD
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
55 devclass_t vd_dc; |
71475f5afa92
Watchdog for Vortex86 6071 on FreeBSD
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
56 device_t vd_dev, nexus_dev; |
71475f5afa92
Watchdog for Vortex86 6071 on FreeBSD
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
57 int r; |
71475f5afa92
Watchdog for Vortex86 6071 on FreeBSD
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
58 |
71475f5afa92
Watchdog for Vortex86 6071 on FreeBSD
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
59 printf("go_detach 1\n"); |
71475f5afa92
Watchdog for Vortex86 6071 on FreeBSD
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
60 vd_dc = devclass_find("vordog"); |
71475f5afa92
Watchdog for Vortex86 6071 on FreeBSD
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
61 if(vd_dc == NULL) |
71475f5afa92
Watchdog for Vortex86 6071 on FreeBSD
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
62 return EINVAL; |
71475f5afa92
Watchdog for Vortex86 6071 on FreeBSD
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
63 |
71475f5afa92
Watchdog for Vortex86 6071 on FreeBSD
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
64 printf("go_detach 2\n"); |
71475f5afa92
Watchdog for Vortex86 6071 on FreeBSD
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
65 vd_dev = devclass_get_device(vd_dc, 0); |
71475f5afa92
Watchdog for Vortex86 6071 on FreeBSD
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
66 if(vd_dev == NULL) |
71475f5afa92
Watchdog for Vortex86 6071 on FreeBSD
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
67 return EINVAL; |
71475f5afa92
Watchdog for Vortex86 6071 on FreeBSD
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
68 |
71475f5afa92
Watchdog for Vortex86 6071 on FreeBSD
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
69 printf("go_detach 3\n"); |
71475f5afa92
Watchdog for Vortex86 6071 on FreeBSD
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
70 nexus_dev = device_get_parent(vd_dev); |
71475f5afa92
Watchdog for Vortex86 6071 on FreeBSD
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
71 if(nexus_dev == NULL) |
71475f5afa92
Watchdog for Vortex86 6071 on FreeBSD
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
72 return EINVAL; |
71475f5afa92
Watchdog for Vortex86 6071 on FreeBSD
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
73 |
71475f5afa92
Watchdog for Vortex86 6071 on FreeBSD
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
74 printf("go_detach 4\n"); |
71475f5afa92
Watchdog for Vortex86 6071 on FreeBSD
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
75 r = device_delete_child(nexus_dev, vd_dev); |
71475f5afa92
Watchdog for Vortex86 6071 on FreeBSD
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
76 return r; |
71475f5afa92
Watchdog for Vortex86 6071 on FreeBSD
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
77 } |
71475f5afa92
Watchdog for Vortex86 6071 on FreeBSD
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
78 |
71475f5afa92
Watchdog for Vortex86 6071 on FreeBSD
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
79 static void |
71475f5afa92
Watchdog for Vortex86 6071 on FreeBSD
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
80 setup_timer(vordog_cfg_t cfg) { |
71475f5afa92
Watchdog for Vortex86 6071 on FreeBSD
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
81 int val; |
71475f5afa92
Watchdog for Vortex86 6071 on FreeBSD
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
82 #define VD_TIMER_RST 0xc |
71475f5afa92
Watchdog for Vortex86 6071 on FreeBSD
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
83 |
71475f5afa92
Watchdog for Vortex86 6071 on FreeBSD
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
84 #if 0 |
71475f5afa92
Watchdog for Vortex86 6071 on FreeBSD
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
85 outb(VD_STATUS, 0xc0); /* Clear events or it would be reset |
71475f5afa92
Watchdog for Vortex86 6071 on FreeBSD
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
86 * immediately, since it is setted |
71475f5afa92
Watchdog for Vortex86 6071 on FreeBSD
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
87 * by last timeout before PCIRST. |
71475f5afa92
Watchdog for Vortex86 6071 on FreeBSD
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
88 */ |
71475f5afa92
Watchdog for Vortex86 6071 on FreeBSD
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
89 #endif |
71475f5afa92
Watchdog for Vortex86 6071 on FreeBSD
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
90 val = cfg->init_val & 0xff; |
71475f5afa92
Watchdog for Vortex86 6071 on FreeBSD
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
91 printf("setup_timer 1 (%x)\n", val); |
71475f5afa92
Watchdog for Vortex86 6071 on FreeBSD
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
92 pause("vordog setup", hz); |
71475f5afa92
Watchdog for Vortex86 6071 on FreeBSD
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
93 outb(VD_INITVAL, val); |
71475f5afa92
Watchdog for Vortex86 6071 on FreeBSD
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
94 printf("setup_timer 2\n"); |
71475f5afa92
Watchdog for Vortex86 6071 on FreeBSD
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
95 val = 0x80 | ((cfg->unit & 0x3) << 4) | VD_TIMER_RST; |
71475f5afa92
Watchdog for Vortex86 6071 on FreeBSD
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
96 printf("setup_timer 3 (%x)\n", val); |
71475f5afa92
Watchdog for Vortex86 6071 on FreeBSD
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
97 pause("vordog setup", hz); |
71475f5afa92
Watchdog for Vortex86 6071 on FreeBSD
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
98 outb(VD_CTR, val); |
71475f5afa92
Watchdog for Vortex86 6071 on FreeBSD
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
99 printf("setup_timer 4\n"); |
71475f5afa92
Watchdog for Vortex86 6071 on FreeBSD
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
100 } |
71475f5afa92
Watchdog for Vortex86 6071 on FreeBSD
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
101 |
71475f5afa92
Watchdog for Vortex86 6071 on FreeBSD
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
102 static void |
71475f5afa92
Watchdog for Vortex86 6071 on FreeBSD
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
103 reset_timer(int init_val) { |
71475f5afa92
Watchdog for Vortex86 6071 on FreeBSD
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
104 #if 0 |
71475f5afa92
Watchdog for Vortex86 6071 on FreeBSD
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
105 printf("reset_timer 1\n"); |
71475f5afa92
Watchdog for Vortex86 6071 on FreeBSD
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
106 pause("vordog setup", hz); |
71475f5afa92
Watchdog for Vortex86 6071 on FreeBSD
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
107 outb(VD_INITVAL, init_val); |
71475f5afa92
Watchdog for Vortex86 6071 on FreeBSD
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
108 #endif |
71475f5afa92
Watchdog for Vortex86 6071 on FreeBSD
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
109 printf("reset_timer 2\n"); |
71475f5afa92
Watchdog for Vortex86 6071 on FreeBSD
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
110 pause("vordog setup", hz); |
71475f5afa92
Watchdog for Vortex86 6071 on FreeBSD
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
111 outb(VD_STATUS, 0xc0); |
71475f5afa92
Watchdog for Vortex86 6071 on FreeBSD
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
112 printf("reset_timer 3\n"); |
71475f5afa92
Watchdog for Vortex86 6071 on FreeBSD
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
113 pause("vordog setup", hz); |
71475f5afa92
Watchdog for Vortex86 6071 on FreeBSD
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
114 } |
71475f5afa92
Watchdog for Vortex86 6071 on FreeBSD
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
115 |
71475f5afa92
Watchdog for Vortex86 6071 on FreeBSD
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
116 static void |
71475f5afa92
Watchdog for Vortex86 6071 on FreeBSD
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
117 disable_timer(void) { |
71475f5afa92
Watchdog for Vortex86 6071 on FreeBSD
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
118 outb(VD_CTR, 0); |
71475f5afa92
Watchdog for Vortex86 6071 on FreeBSD
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
119 outb(VD_STATUS, 0xc0); |
71475f5afa92
Watchdog for Vortex86 6071 on FreeBSD
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
120 } |
71475f5afa92
Watchdog for Vortex86 6071 on FreeBSD
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
121 |
71475f5afa92
Watchdog for Vortex86 6071 on FreeBSD
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
122 static int |
71475f5afa92
Watchdog for Vortex86 6071 on FreeBSD
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
123 vordog_ioctl(struct cdev *dev, u_long cmd, caddr_t data, |
71475f5afa92
Watchdog for Vortex86 6071 on FreeBSD
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
124 int fflag, struct thread *td) { |
71475f5afa92
Watchdog for Vortex86 6071 on FreeBSD
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
125 int r = 0; |
71475f5afa92
Watchdog for Vortex86 6071 on FreeBSD
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
126 vd_softc_t sc; |
71475f5afa92
Watchdog for Vortex86 6071 on FreeBSD
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
127 vordog_cfg_t cfg; |
71475f5afa92
Watchdog for Vortex86 6071 on FreeBSD
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
128 |
71475f5afa92
Watchdog for Vortex86 6071 on FreeBSD
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
129 sc = CDEV_2_SOFTC(dev); |
71475f5afa92
Watchdog for Vortex86 6071 on FreeBSD
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
130 switch(cmd) { |
71475f5afa92
Watchdog for Vortex86 6071 on FreeBSD
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
131 case VDCTL_ENABLE: |
71475f5afa92
Watchdog for Vortex86 6071 on FreeBSD
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
132 printf("VDCTL_ENABLE\n"); |
71475f5afa92
Watchdog for Vortex86 6071 on FreeBSD
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
133 cfg = (vordog_cfg_t)data; |
71475f5afa92
Watchdog for Vortex86 6071 on FreeBSD
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
134 sc->init_val = cfg->init_val & 0xff; |
71475f5afa92
Watchdog for Vortex86 6071 on FreeBSD
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
135 setup_timer(cfg); |
71475f5afa92
Watchdog for Vortex86 6071 on FreeBSD
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
136 break; |
71475f5afa92
Watchdog for Vortex86 6071 on FreeBSD
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
137 case VDCTL_RESET: |
71475f5afa92
Watchdog for Vortex86 6071 on FreeBSD
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
138 printf("VDCTL_RESET\n"); |
71475f5afa92
Watchdog for Vortex86 6071 on FreeBSD
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
139 reset_timer(sc->init_val); |
71475f5afa92
Watchdog for Vortex86 6071 on FreeBSD
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
140 break; |
71475f5afa92
Watchdog for Vortex86 6071 on FreeBSD
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
141 case VDCTL_DISABLE: |
71475f5afa92
Watchdog for Vortex86 6071 on FreeBSD
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
142 printf("VDCTL_DISABLE\n"); |
71475f5afa92
Watchdog for Vortex86 6071 on FreeBSD
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
143 disable_timer(); |
71475f5afa92
Watchdog for Vortex86 6071 on FreeBSD
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
144 break; |
71475f5afa92
Watchdog for Vortex86 6071 on FreeBSD
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
145 default: |
71475f5afa92
Watchdog for Vortex86 6071 on FreeBSD
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
146 r = EINVAL; |
71475f5afa92
Watchdog for Vortex86 6071 on FreeBSD
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
147 } |
71475f5afa92
Watchdog for Vortex86 6071 on FreeBSD
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
148 return r; |
71475f5afa92
Watchdog for Vortex86 6071 on FreeBSD
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
149 } |
71475f5afa92
Watchdog for Vortex86 6071 on FreeBSD
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
150 |
71475f5afa92
Watchdog for Vortex86 6071 on FreeBSD
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
151 struct cdevsw vordog_cdevsw = { |
71475f5afa92
Watchdog for Vortex86 6071 on FreeBSD
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
152 .d_version = D_VERSION, |
71475f5afa92
Watchdog for Vortex86 6071 on FreeBSD
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
153 .d_open = vordog_open, |
71475f5afa92
Watchdog for Vortex86 6071 on FreeBSD
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
154 .d_close = vordog_close, |
71475f5afa92
Watchdog for Vortex86 6071 on FreeBSD
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
155 .d_ioctl = vordog_ioctl, |
71475f5afa92
Watchdog for Vortex86 6071 on FreeBSD
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
156 .d_name = "vordog", |
71475f5afa92
Watchdog for Vortex86 6071 on FreeBSD
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
157 }; |
71475f5afa92
Watchdog for Vortex86 6071 on FreeBSD
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
158 |
71475f5afa92
Watchdog for Vortex86 6071 on FreeBSD
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
159 static void vordog_identify(driver_t *driver, device_t parent) { |
71475f5afa92
Watchdog for Vortex86 6071 on FreeBSD
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
160 device_t vordog; |
71475f5afa92
Watchdog for Vortex86 6071 on FreeBSD
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
161 |
71475f5afa92
Watchdog for Vortex86 6071 on FreeBSD
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
162 /* make sure vordog device is not in the bus. */ |
71475f5afa92
Watchdog for Vortex86 6071 on FreeBSD
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
163 vordog = device_find_child(parent, "vordog", 0); |
71475f5afa92
Watchdog for Vortex86 6071 on FreeBSD
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
164 if(vordog != NULL) { |
71475f5afa92
Watchdog for Vortex86 6071 on FreeBSD
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
165 printf("vordog is still existing!"); |
71475f5afa92
Watchdog for Vortex86 6071 on FreeBSD
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
166 return; |
71475f5afa92
Watchdog for Vortex86 6071 on FreeBSD
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
167 } |
71475f5afa92
Watchdog for Vortex86 6071 on FreeBSD
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
168 vordog = BUS_ADD_CHILD(parent, 10, "vordog", 0); |
71475f5afa92
Watchdog for Vortex86 6071 on FreeBSD
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
169 printf("vordog_identify\n"); |
71475f5afa92
Watchdog for Vortex86 6071 on FreeBSD
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
170 } |
71475f5afa92
Watchdog for Vortex86 6071 on FreeBSD
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
171 |
71475f5afa92
Watchdog for Vortex86 6071 on FreeBSD
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
172 static int vordog_probe(device_t dev) { |
71475f5afa92
Watchdog for Vortex86 6071 on FreeBSD
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
173 int b; |
71475f5afa92
Watchdog for Vortex86 6071 on FreeBSD
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
174 |
71475f5afa92
Watchdog for Vortex86 6071 on FreeBSD
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
175 printf("vordog_probe\n"); |
71475f5afa92
Watchdog for Vortex86 6071 on FreeBSD
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
176 b = inb(VD_INITVAL); |
71475f5afa92
Watchdog for Vortex86 6071 on FreeBSD
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
177 printf("init val: %x\n", b); |
71475f5afa92
Watchdog for Vortex86 6071 on FreeBSD
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
178 b = inb(VD_CTR); |
71475f5afa92
Watchdog for Vortex86 6071 on FreeBSD
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
179 printf("ctr: %x\n", b); |
71475f5afa92
Watchdog for Vortex86 6071 on FreeBSD
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
180 b = inb(VD_STATUS); |
71475f5afa92
Watchdog for Vortex86 6071 on FreeBSD
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
181 printf("status: %x\n", b); |
71475f5afa92
Watchdog for Vortex86 6071 on FreeBSD
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
182 return 0; |
71475f5afa92
Watchdog for Vortex86 6071 on FreeBSD
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
183 } |
71475f5afa92
Watchdog for Vortex86 6071 on FreeBSD
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
184 |
71475f5afa92
Watchdog for Vortex86 6071 on FreeBSD
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
185 static int vordog_attach(device_t dev) { |
71475f5afa92
Watchdog for Vortex86 6071 on FreeBSD
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
186 vd_softc_t sc; |
71475f5afa92
Watchdog for Vortex86 6071 on FreeBSD
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
187 struct cdev *_cdev; |
71475f5afa92
Watchdog for Vortex86 6071 on FreeBSD
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
188 |
71475f5afa92
Watchdog for Vortex86 6071 on FreeBSD
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
189 printf("vordog_attach 1\n"); |
71475f5afa92
Watchdog for Vortex86 6071 on FreeBSD
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
190 |
71475f5afa92
Watchdog for Vortex86 6071 on FreeBSD
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
191 sc = (vd_softc_t)malloc(sizeof(struct vd_softc), M_TEMP, M_WAITOK); |
71475f5afa92
Watchdog for Vortex86 6071 on FreeBSD
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
192 if(sc == NULL) |
71475f5afa92
Watchdog for Vortex86 6071 on FreeBSD
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
193 return ENOMEM; |
71475f5afa92
Watchdog for Vortex86 6071 on FreeBSD
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
194 |
71475f5afa92
Watchdog for Vortex86 6071 on FreeBSD
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
195 printf("vordog_attach 2\n"); |
71475f5afa92
Watchdog for Vortex86 6071 on FreeBSD
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
196 _cdev = make_dev(&vordog_cdevsw, 0, UID_ROOT, GID_WHEEL, 0600, "vordog0"); |
71475f5afa92
Watchdog for Vortex86 6071 on FreeBSD
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
197 if(_cdev == NULL) { |
71475f5afa92
Watchdog for Vortex86 6071 on FreeBSD
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
198 free(sc, M_TEMP); |
71475f5afa92
Watchdog for Vortex86 6071 on FreeBSD
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
199 return EINVAL; |
71475f5afa92
Watchdog for Vortex86 6071 on FreeBSD
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
200 } |
71475f5afa92
Watchdog for Vortex86 6071 on FreeBSD
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
201 |
71475f5afa92
Watchdog for Vortex86 6071 on FreeBSD
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
202 sc->_cdev = _cdev; |
71475f5afa92
Watchdog for Vortex86 6071 on FreeBSD
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
203 sc->dev = dev; |
71475f5afa92
Watchdog for Vortex86 6071 on FreeBSD
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
204 |
71475f5afa92
Watchdog for Vortex86 6071 on FreeBSD
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
205 printf("vordog_attach 3\n"); |
71475f5afa92
Watchdog for Vortex86 6071 on FreeBSD
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
206 device_set_softc(dev, sc); |
71475f5afa92
Watchdog for Vortex86 6071 on FreeBSD
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
207 CDEV_2_SOFTC(_cdev) = sc; |
71475f5afa92
Watchdog for Vortex86 6071 on FreeBSD
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
208 |
71475f5afa92
Watchdog for Vortex86 6071 on FreeBSD
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
209 sc->open_cnt = 0; |
71475f5afa92
Watchdog for Vortex86 6071 on FreeBSD
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
210 sc->init_val = 0; |
71475f5afa92
Watchdog for Vortex86 6071 on FreeBSD
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
211 |
71475f5afa92
Watchdog for Vortex86 6071 on FreeBSD
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
212 return 0; |
71475f5afa92
Watchdog for Vortex86 6071 on FreeBSD
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
213 } |
71475f5afa92
Watchdog for Vortex86 6071 on FreeBSD
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
214 |
71475f5afa92
Watchdog for Vortex86 6071 on FreeBSD
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
215 static int vordog_detach(device_t dev) { |
71475f5afa92
Watchdog for Vortex86 6071 on FreeBSD
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
216 vd_softc_t sc; |
71475f5afa92
Watchdog for Vortex86 6071 on FreeBSD
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
217 struct cdev *_cdev; |
71475f5afa92
Watchdog for Vortex86 6071 on FreeBSD
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
218 |
71475f5afa92
Watchdog for Vortex86 6071 on FreeBSD
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
219 printf("vordog_detach 1\n"); |
71475f5afa92
Watchdog for Vortex86 6071 on FreeBSD
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
220 sc = device_get_softc(dev); |
71475f5afa92
Watchdog for Vortex86 6071 on FreeBSD
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
221 if(sc->open_cnt != 0) |
71475f5afa92
Watchdog for Vortex86 6071 on FreeBSD
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
222 return EBUSY; |
71475f5afa92
Watchdog for Vortex86 6071 on FreeBSD
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
223 |
71475f5afa92
Watchdog for Vortex86 6071 on FreeBSD
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
224 printf("vordog_detach 2\n"); |
71475f5afa92
Watchdog for Vortex86 6071 on FreeBSD
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
225 _cdev = sc->_cdev; |
71475f5afa92
Watchdog for Vortex86 6071 on FreeBSD
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
226 |
71475f5afa92
Watchdog for Vortex86 6071 on FreeBSD
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
227 printf("vordog_detach 3\n"); |
71475f5afa92
Watchdog for Vortex86 6071 on FreeBSD
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
228 destroy_dev(_cdev); |
71475f5afa92
Watchdog for Vortex86 6071 on FreeBSD
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
229 printf("vordog_detach 4\n"); |
71475f5afa92
Watchdog for Vortex86 6071 on FreeBSD
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
230 |
71475f5afa92
Watchdog for Vortex86 6071 on FreeBSD
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
231 free(sc, M_TEMP); |
71475f5afa92
Watchdog for Vortex86 6071 on FreeBSD
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
232 |
71475f5afa92
Watchdog for Vortex86 6071 on FreeBSD
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
233 return 0; |
71475f5afa92
Watchdog for Vortex86 6071 on FreeBSD
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
234 } |
71475f5afa92
Watchdog for Vortex86 6071 on FreeBSD
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
235 |
71475f5afa92
Watchdog for Vortex86 6071 on FreeBSD
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
236 static device_method_t vordog_methods[] = { |
71475f5afa92
Watchdog for Vortex86 6071 on FreeBSD
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
237 DEVMETHOD(device_identify, vordog_identify), |
71475f5afa92
Watchdog for Vortex86 6071 on FreeBSD
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
238 DEVMETHOD(device_probe, vordog_probe), |
71475f5afa92
Watchdog for Vortex86 6071 on FreeBSD
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
239 DEVMETHOD(device_attach, vordog_attach), |
71475f5afa92
Watchdog for Vortex86 6071 on FreeBSD
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
240 DEVMETHOD(device_detach, vordog_detach), |
71475f5afa92
Watchdog for Vortex86 6071 on FreeBSD
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
241 {0, 0} |
71475f5afa92
Watchdog for Vortex86 6071 on FreeBSD
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
242 }; |
71475f5afa92
Watchdog for Vortex86 6071 on FreeBSD
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
243 |
71475f5afa92
Watchdog for Vortex86 6071 on FreeBSD
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
244 static driver_t vordog_driver = { |
71475f5afa92
Watchdog for Vortex86 6071 on FreeBSD
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
245 "vordog", |
71475f5afa92
Watchdog for Vortex86 6071 on FreeBSD
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
246 vordog_methods, |
71475f5afa92
Watchdog for Vortex86 6071 on FreeBSD
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
247 0, |
71475f5afa92
Watchdog for Vortex86 6071 on FreeBSD
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
248 }; |
71475f5afa92
Watchdog for Vortex86 6071 on FreeBSD
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
249 |
71475f5afa92
Watchdog for Vortex86 6071 on FreeBSD
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
250 static int |
71475f5afa92
Watchdog for Vortex86 6071 on FreeBSD
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
251 vordog_evh(module_t mod, int cmd, void *arg) { |
71475f5afa92
Watchdog for Vortex86 6071 on FreeBSD
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
252 int r = 0; |
71475f5afa92
Watchdog for Vortex86 6071 on FreeBSD
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
253 |
71475f5afa92
Watchdog for Vortex86 6071 on FreeBSD
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
254 switch(cmd) { |
71475f5afa92
Watchdog for Vortex86 6071 on FreeBSD
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
255 case MOD_LOAD: |
71475f5afa92
Watchdog for Vortex86 6071 on FreeBSD
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
256 printf("MOD_LOAD\n"); |
71475f5afa92
Watchdog for Vortex86 6071 on FreeBSD
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
257 break; |
71475f5afa92
Watchdog for Vortex86 6071 on FreeBSD
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
258 case MOD_UNLOAD: |
71475f5afa92
Watchdog for Vortex86 6071 on FreeBSD
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
259 printf("MOD_UNLOAD\n"); |
71475f5afa92
Watchdog for Vortex86 6071 on FreeBSD
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
260 vordog_go_detach(); /* remove device from parent */ |
71475f5afa92
Watchdog for Vortex86 6071 on FreeBSD
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
261 break; |
71475f5afa92
Watchdog for Vortex86 6071 on FreeBSD
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
262 case MOD_SHUTDOWN: |
71475f5afa92
Watchdog for Vortex86 6071 on FreeBSD
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
263 printf("MOD_SHUTDOWN\n"); |
71475f5afa92
Watchdog for Vortex86 6071 on FreeBSD
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
264 break; |
71475f5afa92
Watchdog for Vortex86 6071 on FreeBSD
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
265 default: |
71475f5afa92
Watchdog for Vortex86 6071 on FreeBSD
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
266 r = EINVAL; |
71475f5afa92
Watchdog for Vortex86 6071 on FreeBSD
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
267 break; |
71475f5afa92
Watchdog for Vortex86 6071 on FreeBSD
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
268 } |
71475f5afa92
Watchdog for Vortex86 6071 on FreeBSD
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
269 return r; |
71475f5afa92
Watchdog for Vortex86 6071 on FreeBSD
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
270 } |
71475f5afa92
Watchdog for Vortex86 6071 on FreeBSD
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
271 |
71475f5afa92
Watchdog for Vortex86 6071 on FreeBSD
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
272 static devclass_t vordog_devclass; |
71475f5afa92
Watchdog for Vortex86 6071 on FreeBSD
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
273 |
71475f5afa92
Watchdog for Vortex86 6071 on FreeBSD
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
274 DRIVER_MODULE(vordog, nexus, vordog_driver, vordog_devclass, |
71475f5afa92
Watchdog for Vortex86 6071 on FreeBSD
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
275 vordog_evh, NULL); |