mpt(4): Sync with FreeBSD.
[dragonfly.git] / sys / dev / disk / mpt / mpt_reg.h
CommitLineData
4c42baf4 1/* $FreeBSD: src/sys/dev/mpt/mpt_reg.h,v 1.5 2012/02/11 12:03:44 marius Exp $ */
2545bca0
MD
2/*-
3 * Generic defines for LSI '909 FC adapters.
4 * FreeBSD Version.
5 *
6 * Copyright (c) 2000, 2001 by Greg Ansley
7 *
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions
10 * are met:
11 * 1. Redistributions of source code must retain the above copyright
12 * notice immediately at the beginning of the file, without modification,
13 * this list of conditions, and the following disclaimer.
14 * 2. The name of the author may not be used to endorse or promote products
15 * derived from this software without specific prior written permission.
16 *
17 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
18 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR
21 * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
23 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
24 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
25 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27 * SUCH DAMAGE.
28 */
29/*-
30 * Copyright (c) 2002, 2006 by Matthew Jacob
31 * All rights reserved.
32 *
33 * Redistribution and use in source and binary forms, with or without
34 * modification, are permitted provided that the following conditions are
35 * met:
36 * 1. Redistributions of source code must retain the above copyright
37 * notice, this list of conditions and the following disclaimer.
38 * 2. Redistributions in binary form must reproduce at minimum a disclaimer
39 * substantially similar to the "NO WARRANTY" disclaimer below
40 * ("Disclaimer") and any redistribution must be conditioned upon including
41 * a substantially similar Disclaimer requirement for further binary
42 * redistribution.
43 * 3. Neither the names of the above listed copyright holders nor the names
44 * of any contributors may be used to endorse or promote products derived
45 * from this software without specific prior written permission.
46 *
47 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
48 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
49 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
50 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
51 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
52 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
53 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
54 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
55 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
56 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF THE COPYRIGHT
57 * OWNER OR CONTRIBUTOR IS ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
58 *
59 * Support from Chris Ellsworth in order to make SAS adapters work
60 * is gratefully acknowledged.
61 *
62 * Support from LSI-Logic has also gone a great deal toward making this a
63 * workable subsystem and is gratefully acknowledged.
64 */
65#ifndef _MPT_REG_H_
66#define _MPT_REG_H_
67
68#define MPT_OFFSET_DOORBELL 0x00
69#define MPT_OFFSET_SEQUENCE 0x04
70#define MPT_OFFSET_DIAGNOSTIC 0x08
71#define MPT_OFFSET_TEST 0x0C
72#define MPT_OFFSET_DIAG_DATA 0x10
73#define MPT_OFFSET_DIAG_ADDR 0x14
74#define MPT_OFFSET_INTR_STATUS 0x30
75#define MPT_OFFSET_INTR_MASK 0x34
76#define MPT_OFFSET_REQUEST_Q 0x40
77#define MPT_OFFSET_REPLY_Q 0x44
78#define MPT_OFFSET_HOST_INDEX 0x50
79#define MPT_OFFSET_FUBAR 0x90
4c42baf4 80#define MPT_OFFSET_RESET_1078 0x10fc
2545bca0
MD
81
82/* Bit Maps for DOORBELL register */
83enum DB_STATE_BITS {
84 MPT_DB_STATE_RESET = 0x00000000,
85 MPT_DB_STATE_READY = 0x10000000,
86 MPT_DB_STATE_RUNNING = 0x20000000,
87 MPT_DB_STATE_FAULT = 0x40000000,
88 MPT_DB_STATE_MASK = 0xf0000000
89};
90
91#define MPT_STATE(v) ((enum DB_STATE_BITS)((v) & MPT_DB_STATE_MASK))
92
93#define MPT_DB_LENGTH_SHIFT (16)
94#define MPT_DB_DATA_MASK (0xffff)
95
96#define MPT_DB_DB_USED 0x08000000
97#define MPT_DB_IS_IN_USE(v) (((v) & MPT_DB_DB_USED) != 0)
98
99/*
100 * "Whom" initializor values
101 */
102#define MPT_DB_INIT_NOONE 0x00
103#define MPT_DB_INIT_BIOS 0x01
104#define MPT_DB_INIT_ROMBIOS 0x02
105#define MPT_DB_INIT_PCIPEER 0x03
106#define MPT_DB_INIT_HOST 0x04
107#define MPT_DB_INIT_MANUFACTURE 0x05
108
109#define MPT_WHO(v) \
110 ((v & MPI_DOORBELL_WHO_INIT_MASK) >> MPI_DOORBELL_WHO_INIT_SHIFT)
111
112/* Function Maps for DOORBELL register */
113enum DB_FUNCTION_BITS {
114 MPT_FUNC_IOC_RESET = 0x40000000,
115 MPT_FUNC_UNIT_RESET = 0x41000000,
116 MPT_FUNC_HANDSHAKE = 0x42000000,
117 MPT_FUNC_REPLY_REMOVE = 0x43000000,
118 MPT_FUNC_MASK = 0xff000000
119};
120
121/* Function Maps for INTERRUPT request register */
122enum _MPT_INTR_REQ_BITS {
123 MPT_INTR_DB_BUSY = 0x80000000,
124 MPT_INTR_REPLY_READY = 0x00000008,
125 MPT_INTR_DB_READY = 0x00000001
126};
127
128#define MPT_DB_IS_BUSY(v) (((v) & MPT_INTR_DB_BUSY) != 0)
129#define MPT_DB_INTR(v) (((v) & MPT_INTR_DB_READY) != 0)
130#define MPT_REPLY_INTR(v) (((v) & MPT_INTR_REPLY_READY) != 0)
131
132/* Function Maps for INTERRUPT mask register */
133enum _MPT_INTR_MASK_BITS {
134 MPT_INTR_REPLY_MASK = 0x00000008,
135 MPT_INTR_DB_MASK = 0x00000001
136};
137
138/* Magic addresses in diagnostic memory space */
139#define MPT_DIAG_IOP_BASE (0x00000000)
140#define MPT_DIAG_IOP_SIZE (0x00002000)
141#define MPT_DIAG_GPIO (0x00030010)
142#define MPT_DIAG_IOPQ_REG_BASE0 (0x00050004)
143#define MPT_DIAG_IOPQ_REG_BASE1 (0x00051004)
144#define MPT_DIAG_CTX0_BASE (0x000E0000)
145#define MPT_DIAG_CTX0_SIZE (0x00002000)
146#define MPT_DIAG_CTX1_BASE (0x001E0000)
147#define MPT_DIAG_CTX1_SIZE (0x00002000)
148#define MPT_DIAG_FLASH_BASE (0x00800000)
149#define MPT_DIAG_RAM_BASE (0x01000000)
150#define MPT_DIAG_RAM_SIZE (0x00400000)
151#define MPT_DIAG_MEM_CFG_BASE (0x3F000000)
152#define MPT_DIAG_MEM_CFG_BADFL (0x04000000)
153
154/* GPIO bit assignments */
155#define MPT_DIAG_GPIO_SCL (0x00010000)
156#define MPT_DIAG_GPIO_SDA_OUT (0x00008000)
157#define MPT_DIAG_GPIO_SDA_IN (0x00004000)
158
159#define MPT_REPLY_EMPTY (0xFFFFFFFF) /* Reply Queue Empty Symbol */
160#endif /* _MPT_REG_H_ */