Deleted Added
full compact
aha.c (39852) aha.c (39881)
1/*
2 * Generic register and struct definitions for the Adaptech 154x/164x
3 * SCSI host adapters. Product specific probe and attach routines can
4 * be found in:
5 * aha 1540/1542B/1542C/1542CF/1542CP aha_isa.c
6 *
7 * Copyright (c) 1998 M. Warner Losh.
8 * All Rights Reserved.

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

50 * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
51 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
52 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
53 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
54 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
55 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
56 * SUCH DAMAGE.
57 *
1/*
2 * Generic register and struct definitions for the Adaptech 154x/164x
3 * SCSI host adapters. Product specific probe and attach routines can
4 * be found in:
5 * aha 1540/1542B/1542C/1542CF/1542CP aha_isa.c
6 *
7 * Copyright (c) 1998 M. Warner Losh.
8 * All Rights Reserved.

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

50 * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
51 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
52 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
53 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
54 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
55 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
56 * SUCH DAMAGE.
57 *
58 * $Id: aha.c,v 1.5 1998/09/30 00:10:44 imp Exp $
58 * $Id: aha.c,v 1.6 1998/10/01 04:53:55 imp Exp $
59 */
60
61#include <sys/param.h>
62#include <sys/systm.h>
63#include <sys/malloc.h>
64#include <sys/buf.h>
65#include <sys/kernel.h>
66#include <sys/sysctl.h>

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

80#include <vm/vm.h>
81#include <vm/pmap.h>
82
83#include <dev/aha/ahareg.h>
84
85struct aha_softc *aha_softcs[NAHA];
86
87#define MIN(a, b) ((a) < (b) ? (a) : (b))
59 */
60
61#include <sys/param.h>
62#include <sys/systm.h>
63#include <sys/malloc.h>
64#include <sys/buf.h>
65#include <sys/kernel.h>
66#include <sys/sysctl.h>

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

80#include <vm/vm.h>
81#include <vm/pmap.h>
82
83#include <dev/aha/ahareg.h>
84
85struct aha_softc *aha_softcs[NAHA];
86
87#define MIN(a, b) ((a) < (b) ? (a) : (b))
88#define PRVERBOSE(x) if (bootverbose) printf x
88#define PRVERB(x) if (bootverbose) printf x
89
90/* Macro to determine that a rev is potentially a new valid one
91 * so that the driver doesn't keep breaking on new revs as it
92 * did for the CF and CP.
93 */
94#define PROBABLY_NEW_BOARD(REV) (REV > 0x43 && REV < 0x56)
95
96/* MailBox Management functions */

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

307 /*
308 * Get the board ID. We use this to see if we're dealing with
309 * a buslogic card or a aha card (or clone).
310 */
311 error = aha_cmd(aha, BOP_INQUIRE_BOARD_ID, NULL, /*parmlen*/0,
312 (u_int8_t*)&board_id, sizeof(board_id),
313 DEFAULT_CMD_TIMEOUT);
314 if (error != 0) {
89
90/* Macro to determine that a rev is potentially a new valid one
91 * so that the driver doesn't keep breaking on new revs as it
92 * did for the CF and CP.
93 */
94#define PROBABLY_NEW_BOARD(REV) (REV > 0x43 && REV < 0x56)
95
96/* MailBox Management functions */

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

307 /*
308 * Get the board ID. We use this to see if we're dealing with
309 * a buslogic card or a aha card (or clone).
310 */
311 error = aha_cmd(aha, BOP_INQUIRE_BOARD_ID, NULL, /*parmlen*/0,
312 (u_int8_t*)&board_id, sizeof(board_id),
313 DEFAULT_CMD_TIMEOUT);
314 if (error != 0) {
315 if (bootverbose)
316 printf("%s: INQUIRE failed %x\n", aha_name(aha), error);
315 PRVERB(("%s: INQUIRE failed %x\n", aha_name(aha), error));
317 return (ENXIO);
318 }
319 aha->fw_major = board_id.firmware_rev_major;
320 aha->fw_minor = board_id.firmware_rev_minor;
321 aha->boardid = board_id.board_type;
322
323 /*
324 * The Buslogic cards have an id of either 0x41 or 0x42. So

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

1365 timeout = 5 * 10000;
1366 while (--timeout) {
1367 status = aha_inb(aha, STATUS_REG);
1368 if ((status & DIAG_ACTIVE) != 0)
1369 break;
1370 DELAY(100);
1371 }
1372 if (timeout == 0) {
316 return (ENXIO);
317 }
318 aha->fw_major = board_id.firmware_rev_major;
319 aha->fw_minor = board_id.firmware_rev_minor;
320 aha->boardid = board_id.board_type;
321
322 /*
323 * The Buslogic cards have an id of either 0x41 or 0x42. So

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

1364 timeout = 5 * 10000;
1365 while (--timeout) {
1366 status = aha_inb(aha, STATUS_REG);
1367 if ((status & DIAG_ACTIVE) != 0)
1368 break;
1369 DELAY(100);
1370 }
1371 if (timeout == 0) {
1373 if (bootverbose)
1374 printf("%s: ahareset - Diagnostic Active failed to "
1375 "assert. status = 0x%x\n", aha_name(aha),
1376 status);
1372 PRVERB(("%s: ahareset - Diagnostic Active failed to "
1373 "assert. status = 0x%x\n", aha_name(aha),
1374 status));
1377 return (ETIMEDOUT);
1378 }
1379
1380 /* Wait 10sec. for Diagnostic end */
1381 timeout = 10 * 10000;
1382 while (--timeout) {
1383 status = aha_inb(aha, STATUS_REG);
1384 if ((status & DIAG_ACTIVE) == 0)

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

1560 s = splcam();
1561 aha_intr(aha);
1562 splx(s);
1563
1564 /*
1565 * If the command was rejected by the controller, tell the caller.
1566 */
1567 if ((status & CMD_INVALID) != 0) {
1375 return (ETIMEDOUT);
1376 }
1377
1378 /* Wait 10sec. for Diagnostic end */
1379 timeout = 10 * 10000;
1380 while (--timeout) {
1381 status = aha_inb(aha, STATUS_REG);
1382 if ((status & DIAG_ACTIVE) == 0)

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

1558 s = splcam();
1559 aha_intr(aha);
1560 splx(s);
1561
1562 /*
1563 * If the command was rejected by the controller, tell the caller.
1564 */
1565 if ((status & CMD_INVALID) != 0) {
1568 if (bootverbose)
1569 printf("%s: Invalid Command 0x%x\n", aha_name(aha),
1570 opcode);
1566 PRVERB(("%s: Invalid Command 0x%x\n", aha_name(aha), opcode));
1571 /*
1572 * Some early adapters may not recover properly from
1573 * an invalid command. If it appears that the controller
1574 * has wedged (i.e. status was not cleared by our interrupt
1575 * reset above), perform a soft reset.
1576 */
1577 DELAY(1000);
1578 status = aha_inb(aha, STATUS_REG);

--- 236 unchanged lines hidden ---
1567 /*
1568 * Some early adapters may not recover properly from
1569 * an invalid command. If it appears that the controller
1570 * has wedged (i.e. status was not cleared by our interrupt
1571 * reset above), perform a soft reset.
1572 */
1573 DELAY(1000);
1574 status = aha_inb(aha, STATUS_REG);

--- 236 unchanged lines hidden ---