Deleted Added
full compact
aac.c (133542) aac.c (133606)
1/*-
2 * Copyright (c) 2000 Michael Smith
3 * Copyright (c) 2001 Scott Long
4 * Copyright (c) 2000 BSDi
5 * Copyright (c) 2001 Adaptec, Inc.
6 * All rights reserved.
7 *
8 * Redistribution and use in source and binary forms, with or without

--- 14 unchanged lines hidden (view full) ---

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#include <sys/cdefs.h>
1/*-
2 * Copyright (c) 2000 Michael Smith
3 * Copyright (c) 2001 Scott Long
4 * Copyright (c) 2000 BSDi
5 * Copyright (c) 2001 Adaptec, Inc.
6 * All rights reserved.
7 *
8 * Redistribution and use in source and binary forms, with or without

--- 14 unchanged lines hidden (view full) ---

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#include <sys/cdefs.h>
31__FBSDID("$FreeBSD: head/sys/dev/aac/aac.c 133542 2004-08-12 05:31:17Z scottl $");
31__FBSDID("$FreeBSD: head/sys/dev/aac/aac.c 133606 2004-08-13 01:44:09Z scottl $");
32
33/*
34 * Driver for the Adaptec 'FSA' family of PCI/SCSI RAID adapters.
35 */
36
37#include "opt_aac.h"
38
39/* #include <stddef.h> */

--- 116 unchanged lines hidden (view full) ---

156 aac_rx_qnotify,
157 aac_rx_get_istatus,
158 aac_rx_clear_istatus,
159 aac_rx_set_mailbox,
160 aac_rx_get_mailbox,
161 aac_rx_set_interrupts
162};
163
32
33/*
34 * Driver for the Adaptec 'FSA' family of PCI/SCSI RAID adapters.
35 */
36
37#include "opt_aac.h"
38
39/* #include <stddef.h> */

--- 116 unchanged lines hidden (view full) ---

156 aac_rx_qnotify,
157 aac_rx_get_istatus,
158 aac_rx_clear_istatus,
159 aac_rx_set_mailbox,
160 aac_rx_get_mailbox,
161 aac_rx_set_interrupts
162};
163
164/* Rocket/MIPS interface */
165static int aac_rkt_get_fwstatus(struct aac_softc *sc);
166static void aac_rkt_qnotify(struct aac_softc *sc, int qbit);
167static int aac_rkt_get_istatus(struct aac_softc *sc);
168static void aac_rkt_clear_istatus(struct aac_softc *sc, int mask);
169static void aac_rkt_set_mailbox(struct aac_softc *sc, u_int32_t command,
170 u_int32_t arg0, u_int32_t arg1,
171 u_int32_t arg2, u_int32_t arg3);
172static int aac_rkt_get_mailbox(struct aac_softc *sc, int mb);
173static void aac_rkt_set_interrupts(struct aac_softc *sc, int enable);
174
175struct aac_interface aac_rkt_interface = {
176 aac_rkt_get_fwstatus,
177 aac_rkt_qnotify,
178 aac_rkt_get_istatus,
179 aac_rkt_clear_istatus,
180 aac_rkt_set_mailbox,
181 aac_rkt_get_mailbox,
182 aac_rkt_set_interrupts
183};
184
164/* Debugging and Diagnostics */
165static void aac_describe_controller(struct aac_softc *sc);
166static char *aac_describe_code(struct aac_code_lookup *table,
167 u_int32_t code);
168
169/* Management Interface */
170static d_open_t aac_open;
171static d_close_t aac_close;

--- 1457 unchanged lines hidden (view full) ---

1629
1630 /*
1631 * Do controller-type-specific initialisation
1632 */
1633 switch (sc->aac_hwif) {
1634 case AAC_HWIF_I960RX:
1635 AAC_SETREG4(sc, AAC_RX_ODBR, ~0);
1636 break;
185/* Debugging and Diagnostics */
186static void aac_describe_controller(struct aac_softc *sc);
187static char *aac_describe_code(struct aac_code_lookup *table,
188 u_int32_t code);
189
190/* Management Interface */
191static d_open_t aac_open;
192static d_close_t aac_close;

--- 1457 unchanged lines hidden (view full) ---

1650
1651 /*
1652 * Do controller-type-specific initialisation
1653 */
1654 switch (sc->aac_hwif) {
1655 case AAC_HWIF_I960RX:
1656 AAC_SETREG4(sc, AAC_RX_ODBR, ~0);
1657 break;
1658 case AAC_HWIF_RKT:
1659 AAC_SETREG4(sc, AAC_RKT_ODBR, ~0);
1660 break;
1661 default:
1662 break;
1637 }
1638
1639 /*
1640 * Give the init structure to the controller.
1641 */
1642 if (aac_sync_command(sc, AAC_MONKER_INITSTRUCT,
1643 sc->aac_common_busaddr +
1644 offsetof(struct aac_common, ac_init), 0, 0, 0,

--- 370 unchanged lines hidden (view full) ---

2015 int val;
2016
2017 debug_called(3);
2018
2019 val = AAC_GETREG4(sc, AAC_FA_FWSTATUS);
2020 return (val);
2021}
2022
1663 }
1664
1665 /*
1666 * Give the init structure to the controller.
1667 */
1668 if (aac_sync_command(sc, AAC_MONKER_INITSTRUCT,
1669 sc->aac_common_busaddr +
1670 offsetof(struct aac_common, ac_init), 0, 0, 0,

--- 370 unchanged lines hidden (view full) ---

2041 int val;
2042
2043 debug_called(3);
2044
2045 val = AAC_GETREG4(sc, AAC_FA_FWSTATUS);
2046 return (val);
2047}
2048
2049static int
2050aac_rkt_get_fwstatus(struct aac_softc *sc)
2051{
2052 debug_called(3);
2053
2054 return(AAC_GETREG4(sc, AAC_RKT_FWSTATUS));
2055}
2056
2023/*
2024 * Notify the controller of a change in a given queue
2025 */
2026
2027static void
2028aac_sa_qnotify(struct aac_softc *sc, int qbit)
2029{
2030 debug_called(3);

--- 13 unchanged lines hidden (view full) ---

2044aac_fa_qnotify(struct aac_softc *sc, int qbit)
2045{
2046 debug_called(3);
2047
2048 AAC_SETREG2(sc, AAC_FA_DOORBELL1, qbit);
2049 AAC_FA_HACK(sc);
2050}
2051
2057/*
2058 * Notify the controller of a change in a given queue
2059 */
2060
2061static void
2062aac_sa_qnotify(struct aac_softc *sc, int qbit)
2063{
2064 debug_called(3);

--- 13 unchanged lines hidden (view full) ---

2078aac_fa_qnotify(struct aac_softc *sc, int qbit)
2079{
2080 debug_called(3);
2081
2082 AAC_SETREG2(sc, AAC_FA_DOORBELL1, qbit);
2083 AAC_FA_HACK(sc);
2084}
2085
2086static void
2087aac_rkt_qnotify(struct aac_softc *sc, int qbit)
2088{
2089 debug_called(3);
2090
2091 AAC_SETREG4(sc, AAC_RKT_IDBR, qbit);
2092}
2093
2052/*
2053 * Get the interrupt reason bits
2054 */
2055static int
2056aac_sa_get_istatus(struct aac_softc *sc)
2057{
2058 debug_called(3);
2059

--- 14 unchanged lines hidden (view full) ---

2074 int val;
2075
2076 debug_called(3);
2077
2078 val = AAC_GETREG2(sc, AAC_FA_DOORBELL0);
2079 return (val);
2080}
2081
2094/*
2095 * Get the interrupt reason bits
2096 */
2097static int
2098aac_sa_get_istatus(struct aac_softc *sc)
2099{
2100 debug_called(3);
2101

--- 14 unchanged lines hidden (view full) ---

2116 int val;
2117
2118 debug_called(3);
2119
2120 val = AAC_GETREG2(sc, AAC_FA_DOORBELL0);
2121 return (val);
2122}
2123
2124static int
2125aac_rkt_get_istatus(struct aac_softc *sc)
2126{
2127 debug_called(3);
2128
2129 return(AAC_GETREG4(sc, AAC_RKT_ODBR));
2130}
2131
2082/*
2083 * Clear some interrupt reason bits
2084 */
2085static void
2086aac_sa_clear_istatus(struct aac_softc *sc, int mask)
2087{
2088 debug_called(3);
2089

--- 12 unchanged lines hidden (view full) ---

2102aac_fa_clear_istatus(struct aac_softc *sc, int mask)
2103{
2104 debug_called(3);
2105
2106 AAC_SETREG2(sc, AAC_FA_DOORBELL0_CLEAR, mask);
2107 AAC_FA_HACK(sc);
2108}
2109
2132/*
2133 * Clear some interrupt reason bits
2134 */
2135static void
2136aac_sa_clear_istatus(struct aac_softc *sc, int mask)
2137{
2138 debug_called(3);
2139

--- 12 unchanged lines hidden (view full) ---

2152aac_fa_clear_istatus(struct aac_softc *sc, int mask)
2153{
2154 debug_called(3);
2155
2156 AAC_SETREG2(sc, AAC_FA_DOORBELL0_CLEAR, mask);
2157 AAC_FA_HACK(sc);
2158}
2159
2160static void
2161aac_rkt_clear_istatus(struct aac_softc *sc, int mask)
2162{
2163 debug_called(3);
2164
2165 AAC_SETREG4(sc, AAC_RKT_ODBR, mask);
2166}
2167
2110/*
2111 * Populate the mailbox and set the command word
2112 */
2113static void
2114aac_sa_set_mailbox(struct aac_softc *sc, u_int32_t command,
2115 u_int32_t arg0, u_int32_t arg1, u_int32_t arg2, u_int32_t arg3)
2116{
2117 debug_called(4);

--- 31 unchanged lines hidden (view full) ---

2149 AAC_SETREG4(sc, AAC_FA_MAILBOX + 8, arg1);
2150 AAC_FA_HACK(sc);
2151 AAC_SETREG4(sc, AAC_FA_MAILBOX + 12, arg2);
2152 AAC_FA_HACK(sc);
2153 AAC_SETREG4(sc, AAC_FA_MAILBOX + 16, arg3);
2154 AAC_FA_HACK(sc);
2155}
2156
2168/*
2169 * Populate the mailbox and set the command word
2170 */
2171static void
2172aac_sa_set_mailbox(struct aac_softc *sc, u_int32_t command,
2173 u_int32_t arg0, u_int32_t arg1, u_int32_t arg2, u_int32_t arg3)
2174{
2175 debug_called(4);

--- 31 unchanged lines hidden (view full) ---

2207 AAC_SETREG4(sc, AAC_FA_MAILBOX + 8, arg1);
2208 AAC_FA_HACK(sc);
2209 AAC_SETREG4(sc, AAC_FA_MAILBOX + 12, arg2);
2210 AAC_FA_HACK(sc);
2211 AAC_SETREG4(sc, AAC_FA_MAILBOX + 16, arg3);
2212 AAC_FA_HACK(sc);
2213}
2214
2215static void
2216aac_rkt_set_mailbox(struct aac_softc *sc, u_int32_t command, u_int32_t arg0,
2217 u_int32_t arg1, u_int32_t arg2, u_int32_t arg3)
2218{
2219 debug_called(4);
2220
2221 AAC_SETREG4(sc, AAC_RKT_MAILBOX, command);
2222 AAC_SETREG4(sc, AAC_RKT_MAILBOX + 4, arg0);
2223 AAC_SETREG4(sc, AAC_RKT_MAILBOX + 8, arg1);
2224 AAC_SETREG4(sc, AAC_RKT_MAILBOX + 12, arg2);
2225 AAC_SETREG4(sc, AAC_RKT_MAILBOX + 16, arg3);
2226}
2227
2157/*
2158 * Fetch the immediate command status word
2159 */
2160static int
2161aac_sa_get_mailbox(struct aac_softc *sc, int mb)
2162{
2163 debug_called(4);
2164

--- 14 unchanged lines hidden (view full) ---

2179 int val;
2180
2181 debug_called(4);
2182
2183 val = AAC_GETREG4(sc, AAC_FA_MAILBOX + (mb * 4));
2184 return (val);
2185}
2186
2228/*
2229 * Fetch the immediate command status word
2230 */
2231static int
2232aac_sa_get_mailbox(struct aac_softc *sc, int mb)
2233{
2234 debug_called(4);
2235

--- 14 unchanged lines hidden (view full) ---

2250 int val;
2251
2252 debug_called(4);
2253
2254 val = AAC_GETREG4(sc, AAC_FA_MAILBOX + (mb * 4));
2255 return (val);
2256}
2257
2258static int
2259aac_rkt_get_mailbox(struct aac_softc *sc, int mb)
2260{
2261 debug_called(4);
2262
2263 return(AAC_GETREG4(sc, AAC_RKT_MAILBOX + (mb * 4)));
2264}
2265
2187/*
2188 * Set/clear interrupt masks
2189 */
2190static void
2191aac_sa_set_interrupts(struct aac_softc *sc, int enable)
2192{
2193 debug(2, "%sable interrupts", enable ? "en" : "dis");
2194

--- 25 unchanged lines hidden (view full) ---

2220 AAC_SETREG2((sc), AAC_FA_MASK0_CLEAR, AAC_DB_INTERRUPTS);
2221 AAC_FA_HACK(sc);
2222 } else {
2223 AAC_SETREG2((sc), AAC_FA_MASK0, ~0);
2224 AAC_FA_HACK(sc);
2225 }
2226}
2227
2266/*
2267 * Set/clear interrupt masks
2268 */
2269static void
2270aac_sa_set_interrupts(struct aac_softc *sc, int enable)
2271{
2272 debug(2, "%sable interrupts", enable ? "en" : "dis");
2273

--- 25 unchanged lines hidden (view full) ---

2299 AAC_SETREG2((sc), AAC_FA_MASK0_CLEAR, AAC_DB_INTERRUPTS);
2300 AAC_FA_HACK(sc);
2301 } else {
2302 AAC_SETREG2((sc), AAC_FA_MASK0, ~0);
2303 AAC_FA_HACK(sc);
2304 }
2305}
2306
2307static void
2308aac_rkt_set_interrupts(struct aac_softc *sc, int enable)
2309{
2310 debug(2, "%sable interrupts", enable ? "en" : "dis");
2311
2312 if (enable) {
2313 AAC_SETREG4(sc, AAC_RKT_OIMR, ~AAC_DB_INTERRUPTS);
2314 } else {
2315 AAC_SETREG4(sc, AAC_RKT_OIMR, ~0);
2316 }
2317}
2318
2228/*
2229 * Debugging and Diagnostics
2230 */
2231
2232/*
2233 * Print some information about the controller.
2234 */
2235static void

--- 711 unchanged lines hidden ---
2319/*
2320 * Debugging and Diagnostics
2321 */
2322
2323/*
2324 * Print some information about the controller.
2325 */
2326static void

--- 711 unchanged lines hidden ---