xref: /freebsd/sys/dev/viawd/viawd.h (revision 95ee2897e98f5d444f26ed2334cc7c439f9c16c6)
161af1d13SFabien Thomas /*-
2*4d846d26SWarner Losh  * SPDX-License-Identifier: BSD-2-Clause
3718cf2ccSPedro F. Giffuni  *
4a7c3afc3SFabien Thomas  * Copyright (c) 2011 Fabien Thomas <fabient@FreeBSD.org>
561af1d13SFabien Thomas  * All rights reserved.
661af1d13SFabien Thomas  *
761af1d13SFabien Thomas  * Redistribution and use in source and binary forms, with or without
861af1d13SFabien Thomas  * modification, are permitted provided that the following conditions
961af1d13SFabien Thomas  * are met:
1061af1d13SFabien Thomas  * 1. Redistributions of source code must retain the above copyright
1161af1d13SFabien Thomas  *    notice, this list of conditions and the following disclaimer.
1261af1d13SFabien Thomas  * 2. Redistributions in binary form must reproduce the above copyright
1361af1d13SFabien Thomas  *    notice, this list of conditions and the following disclaimer in the
1461af1d13SFabien Thomas  *    documentation and/or other materials provided with the distribution.
1561af1d13SFabien Thomas  *
1661af1d13SFabien Thomas  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
1761af1d13SFabien Thomas  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
1861af1d13SFabien Thomas  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
1961af1d13SFabien Thomas  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
2061af1d13SFabien Thomas  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
2161af1d13SFabien Thomas  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
2261af1d13SFabien Thomas  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
2361af1d13SFabien Thomas  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
2461af1d13SFabien Thomas  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
2561af1d13SFabien Thomas  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
2661af1d13SFabien Thomas  * SUCH DAMAGE.
2761af1d13SFabien Thomas  */
2861af1d13SFabien Thomas 
2961af1d13SFabien Thomas #ifndef _VIAWD_H_
3061af1d13SFabien Thomas #define _VIAWD_H_
3161af1d13SFabien Thomas 
3261af1d13SFabien Thomas struct viawd_device {
3361af1d13SFabien Thomas 	uint16_t		device;
3461af1d13SFabien Thomas 	char			*desc;
3561af1d13SFabien Thomas };
3661af1d13SFabien Thomas 
3761af1d13SFabien Thomas struct viawd_softc {
3861af1d13SFabien Thomas 	device_t		dev;
3961af1d13SFabien Thomas 	device_t		sb_dev;
4061af1d13SFabien Thomas 
4161af1d13SFabien Thomas 	int			wd_rid;
4261af1d13SFabien Thomas 	struct resource		*wd_res;
4361af1d13SFabien Thomas 
4461af1d13SFabien Thomas 	eventhandler_tag	ev_tag;
4561af1d13SFabien Thomas 	unsigned int		timeout;
4661af1d13SFabien Thomas };
4761af1d13SFabien Thomas 
4861af1d13SFabien Thomas #define VENDORID_VIA		0x1106
4961af1d13SFabien Thomas #define DEVICEID_VT8251		0x3287
5061af1d13SFabien Thomas #define DEVICEID_CX700		0x8324
5161af1d13SFabien Thomas #define DEVICEID_VX800		0x8353
5261af1d13SFabien Thomas #define DEVICEID_VX855		0x8409
5361af1d13SFabien Thomas #define DEVICEID_VX900		0x8410
5461af1d13SFabien Thomas 
5561af1d13SFabien Thomas #define VIAWD_CONFIG_BASE	0xE8
5661af1d13SFabien Thomas 
5761af1d13SFabien Thomas #define VIAWD_MEM_LEN		8
5861af1d13SFabien Thomas 
5961af1d13SFabien Thomas #define VIAWD_MEM_CTRL		0x00
6061af1d13SFabien Thomas #define VIAWD_MEM_CTRL_TRIGGER	0x000000080
6161af1d13SFabien Thomas #define VIAWD_MEM_CTRL_DISABLE	0x000000008
6261af1d13SFabien Thomas #define VIAWD_MEM_CTRL_POWEROFF	0x000000004
6361af1d13SFabien Thomas #define VIAWD_MEM_CTRL_FIRED	0x000000002
6461af1d13SFabien Thomas #define VIAWD_MEM_CTRL_ENABLE	0x000000001
6561af1d13SFabien Thomas 
6661af1d13SFabien Thomas #define VIAWD_MEM_COUNT		0x04
6761af1d13SFabien Thomas 
6861af1d13SFabien Thomas #define VIAWD_MEM_COUNT_MIN	1
6961af1d13SFabien Thomas #define VIAWD_MEM_COUNT_MAX	1023
7061af1d13SFabien Thomas 
7161af1d13SFabien Thomas #define VIAWD_TIMEOUT_SHUTDOWN	(5 * 60)
7261af1d13SFabien Thomas 
7361af1d13SFabien Thomas #endif
74