1 /*        $NetBSD: weaselreg.h,v 1.2 2008/04/28 20:23:55 martin Exp $ */
2 
3 /*-
4  * Copyright (c) 2001 The NetBSD Foundation, Inc.
5  * All rights reserved.
6  *
7  * This code is derived from software contributed to The NetBSD Foundation
8  * by Herb Peyerl and Jason Thorpe.
9  *
10  * Redistribution and use in source and binary forms, with or without
11  * modification, are permitted provided that the following conditions
12  * are met:
13  * 1. Redistributions of source code must retain the above copyright
14  *    notice, this list of conditions and the following disclaimer.
15  * 2. Redistributions in binary form must reproduce the above copyright
16  *    notice, this list of conditions and the following disclaimer in the
17  *    documentation and/or other materials provided with the distribution.
18  *
19  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
20  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
21  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
22  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
23  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29  * POSSIBILITY OF SUCH DAMAGE.
30  */
31 
32 
33 #ifndef _DEV_PCI_WEASELREG_H_
34 #define   _DEV_PCI_WEASELREG_H_
35 
36 /*
37  * PCI-Weasel configuration block.
38  */
39 #define   CFG_VERSION_2                 0x02
40 struct weasel_config_block {
41           uint8_t   cfg_version;                  /* version of config */
42           uint8_t   weasel_attn;                  /* attention character */
43           uint8_t debug;                          /* debug level */
44           uint8_t reset_pc_on_boot;     /* reset PC Weasel on boot */
45           uint8_t duart_baud;           /* UART baud rate */
46           uint8_t duart_parity;                   /* 0=none, 1=even, 2=odd */
47           uint8_t duart_bits;           /* 7 or 8 */
48           uint8_t   enable_duart_switching;       /* UART switching mode */
49           uint8_t   wdt_allow;                    /* WDOG is allowed */
50           uint16_t  wdt_msec; /* WDOG period in msec. */
51           uint8_t   duart_flow;                   /* RTS/CTS enabled */
52           uint8_t   break_passthru;               /* BRK passed through to 16550 */
53           uint8_t   serial_number[10];  /* board serial number */
54           uint8_t   default_partition;  /* default Weasel boot image */
55           uint8_t   color;                        /* use color */
56           uint8_t   future_use[229];    /* reserved for future use */
57           uint8_t cksum;                          /* always last element. */
58 };
59 
60 #define   WEASEL_DATA_RD                0x00
61 #define             OS_RET_WDT_ACTIVE   0x01
62 #define             OS_RET_WDT_INACTIVE 0x02
63 #define             OS_RET_PONG                   0x03
64 
65 #define   WEASEL_DATA_WR                0x01
66 #define             OS_CMD_WDT_ENABLE   0x01
67 #define             OS_CMD_WDT_DISABLE  0x02
68 #define             OS_CMD_WDT_QUERY    0x03
69 #define             OS_CMD_SHOW_CONFIG  0x04
70 #define             OS_CMD_QUERY_SW_VER 0x05
71 #define             OS_CMD_QUERY_HW_VER 0x06
72 #define             OS_CMD_QUERY_L_VER  0x07
73 #define             OS_CMD_PING                   0x08
74 #define             OS_CMD_QUERY_VB_VER 0x09
75 #define             OS_CMD_QUERT_BR_VER 0x0a
76 #define             OS_CMD_RESET_SM               0xff
77 
78 #define   WEASEL_STATUS                 0x02
79 #define             OS_WS_HOST_WRITE    0x00
80 #define             OS_WS_HOST_READ               0x01
81 #define             OS_WS_WDT_RDY                 0x02
82 #define             OS_WS_BUSY                    0xff
83 
84 #define   WEASEL_HOST_STATUS  0x03
85 #define             OS_HS_WEASEL_WRITE  0x00
86 #define             OS_HS_WEASEL_READ   0x01
87 #define             OS_HS_WDT_RDY                 0x02
88 
89 #define   WEASEL_CHALLENGE    0x04
90 
91 #define   WEASEL_RESPONSE               0x05
92 
93 #endif /* _DEV_PCI_WEASELREG_H_ */
94