xref: /freebsd/sys/dev/viawd/viawd.h (revision 61af1d13936ec56808f62d13dd8698f73b440dc1)
1*61af1d13SFabien Thomas /*-
2*61af1d13SFabien Thomas  * Copyright (c) 2011 Fabien Thomas <fthomas@FreeBSD.org>
3*61af1d13SFabien Thomas  * All rights reserved.
4*61af1d13SFabien Thomas  *
5*61af1d13SFabien Thomas  * Redistribution and use in source and binary forms, with or without
6*61af1d13SFabien Thomas  * modification, are permitted provided that the following conditions
7*61af1d13SFabien Thomas  * are met:
8*61af1d13SFabien Thomas  * 1. Redistributions of source code must retain the above copyright
9*61af1d13SFabien Thomas  *    notice, this list of conditions and the following disclaimer.
10*61af1d13SFabien Thomas  * 2. Redistributions in binary form must reproduce the above copyright
11*61af1d13SFabien Thomas  *    notice, this list of conditions and the following disclaimer in the
12*61af1d13SFabien Thomas  *    documentation and/or other materials provided with the distribution.
13*61af1d13SFabien Thomas  *
14*61af1d13SFabien Thomas  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
15*61af1d13SFabien Thomas  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16*61af1d13SFabien Thomas  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
17*61af1d13SFabien Thomas  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
18*61af1d13SFabien Thomas  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19*61af1d13SFabien Thomas  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20*61af1d13SFabien Thomas  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21*61af1d13SFabien Thomas  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22*61af1d13SFabien Thomas  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23*61af1d13SFabien Thomas  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24*61af1d13SFabien Thomas  * SUCH DAMAGE.
25*61af1d13SFabien Thomas  *
26*61af1d13SFabien Thomas  * $FreeBSD$
27*61af1d13SFabien Thomas  */
28*61af1d13SFabien Thomas 
29*61af1d13SFabien Thomas #ifndef _VIAWD_H_
30*61af1d13SFabien Thomas #define _VIAWD_H_
31*61af1d13SFabien Thomas 
32*61af1d13SFabien Thomas struct viawd_device {
33*61af1d13SFabien Thomas 	uint16_t		device;
34*61af1d13SFabien Thomas 	char			*desc;
35*61af1d13SFabien Thomas };
36*61af1d13SFabien Thomas 
37*61af1d13SFabien Thomas struct viawd_softc {
38*61af1d13SFabien Thomas 	device_t		dev;
39*61af1d13SFabien Thomas 	device_t		sb_dev;
40*61af1d13SFabien Thomas 
41*61af1d13SFabien Thomas 	int			wd_rid;
42*61af1d13SFabien Thomas 	struct resource		*wd_res;
43*61af1d13SFabien Thomas 	bus_space_tag_t		wd_bst;
44*61af1d13SFabien Thomas 	bus_space_handle_t	wd_bsh;
45*61af1d13SFabien Thomas 
46*61af1d13SFabien Thomas 	eventhandler_tag	ev_tag;
47*61af1d13SFabien Thomas 	unsigned int		timeout;
48*61af1d13SFabien Thomas };
49*61af1d13SFabien Thomas 
50*61af1d13SFabien Thomas #define VENDORID_VIA		0x1106
51*61af1d13SFabien Thomas #define DEVICEID_VT8251		0x3287
52*61af1d13SFabien Thomas #define DEVICEID_CX700		0x8324
53*61af1d13SFabien Thomas #define DEVICEID_VX800		0x8353
54*61af1d13SFabien Thomas #define DEVICEID_VX855		0x8409
55*61af1d13SFabien Thomas #define DEVICEID_VX900		0x8410
56*61af1d13SFabien Thomas 
57*61af1d13SFabien Thomas #define VIAWD_CONFIG_BASE	0xE8
58*61af1d13SFabien Thomas 
59*61af1d13SFabien Thomas #define VIAWD_MEM_LEN		8
60*61af1d13SFabien Thomas 
61*61af1d13SFabien Thomas #define VIAWD_MEM_CTRL		0x00
62*61af1d13SFabien Thomas #define VIAWD_MEM_CTRL_TRIGGER	0x000000080
63*61af1d13SFabien Thomas #define VIAWD_MEM_CTRL_DISABLE	0x000000008
64*61af1d13SFabien Thomas #define VIAWD_MEM_CTRL_POWEROFF	0x000000004
65*61af1d13SFabien Thomas #define VIAWD_MEM_CTRL_FIRED	0x000000002
66*61af1d13SFabien Thomas #define VIAWD_MEM_CTRL_ENABLE	0x000000001
67*61af1d13SFabien Thomas 
68*61af1d13SFabien Thomas #define VIAWD_MEM_COUNT		0x04
69*61af1d13SFabien Thomas 
70*61af1d13SFabien Thomas #define VIAWD_MEM_COUNT_MIN	1
71*61af1d13SFabien Thomas #define VIAWD_MEM_COUNT_MAX	1023
72*61af1d13SFabien Thomas 
73*61af1d13SFabien Thomas #define VIAWD_TIMEOUT_SHUTDOWN	(5 * 60)
74*61af1d13SFabien Thomas 
75*61af1d13SFabien Thomas #endif
76