aic7xxx_osm.c (72811) | aic7xxx_osm.c (74094) |
---|---|
1/* 2 * Bus independent FreeBSD shim for the aic7xxx based adaptec SCSI controllers 3 * 4 * Copyright (c) 1994-2001 Justin T. Gibbs. 5 * All rights reserved. 6 * 7 * Redistribution and use in source and binary forms, with or without 8 * modification, are permitted provided that the following conditions --- 16 unchanged lines hidden (view full) --- 25 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 26 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 27 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 28 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 29 * SUCH DAMAGE. 30 * 31 * $Id$ 32 * | 1/* 2 * Bus independent FreeBSD shim for the aic7xxx based adaptec SCSI controllers 3 * 4 * Copyright (c) 1994-2001 Justin T. Gibbs. 5 * All rights reserved. 6 * 7 * Redistribution and use in source and binary forms, with or without 8 * modification, are permitted provided that the following conditions --- 16 unchanged lines hidden (view full) --- 25 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 26 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 27 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 28 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 29 * SUCH DAMAGE. 30 * 31 * $Id$ 32 * |
33 * $FreeBSD: head/sys/dev/aic7xxx/aic7xxx_osm.c 72811 2001-02-21 20:50:36Z gibbs $ | 33 * $FreeBSD: head/sys/dev/aic7xxx/aic7xxx_osm.c 74094 2001-03-11 06:34:17Z gibbs $ |
34 */ 35 36#include <dev/aic7xxx/aic7xxx_freebsd.h> 37#include <dev/aic7xxx/aic7xxx_inline.h> 38 39#ifndef AHC_TMODE_ENABLE 40#define AHC_TMODE_ENABLE 0 41#endif --- 76 unchanged lines hidden (view full) --- 118 goto fail; 119 } 120 121 /* 122 * Attach secondary channel first if the user has 123 * declared it the primary channel. 124 */ 125 if ((ahc->features & AHC_TWIN) != 0 | 34 */ 35 36#include <dev/aic7xxx/aic7xxx_freebsd.h> 37#include <dev/aic7xxx/aic7xxx_inline.h> 38 39#ifndef AHC_TMODE_ENABLE 40#define AHC_TMODE_ENABLE 0 41#endif --- 76 unchanged lines hidden (view full) --- 118 goto fail; 119 } 120 121 /* 122 * Attach secondary channel first if the user has 123 * declared it the primary channel. 124 */ 125 if ((ahc->features & AHC_TWIN) != 0 |
126 && (ahc->flags & AHC_CHANNEL_B_PRIMARY) != 0) { | 126 && (ahc->flags & AHC_PRIMARY_CHANNEL) != 0) { |
127 bus_id = 1; 128 bus_id2 = 0; 129 } else { 130 bus_id = 0; 131 bus_id2 = 1; 132 } 133 134 /* --- 74 unchanged lines hidden (view full) --- 209 csa.callback = ahc_async; 210 csa.callback_arg = sim2; 211 xpt_action((union ccb *)&csa); 212 count++; 213 } 214 215fail: 216 if ((ahc->features & AHC_TWIN) != 0 | 127 bus_id = 1; 128 bus_id2 = 0; 129 } else { 130 bus_id = 0; 131 bus_id2 = 1; 132 } 133 134 /* --- 74 unchanged lines hidden (view full) --- 209 csa.callback = ahc_async; 210 csa.callback_arg = sim2; 211 xpt_action((union ccb *)&csa); 212 count++; 213 } 214 215fail: 216 if ((ahc->features & AHC_TWIN) != 0 |
217 && (ahc->flags & AHC_CHANNEL_B_PRIMARY) != 0) { | 217 && (ahc->flags & AHC_PRIMARY_CHANNEL) != 0) { |
218 ahc->platform_data->sim_b = sim; 219 ahc->platform_data->path_b = path; 220 ahc->platform_data->sim = sim2; 221 ahc->platform_data->path = path2; 222 } else { 223 ahc->platform_data->sim = sim; 224 ahc->platform_data->path = path; 225 ahc->platform_data->sim_b = sim2; --- 1008 unchanged lines hidden (view full) --- 1234 if (TAILQ_FIRST(untagged_q) != scb) { 1235 ahc_unlock(ahc, &s); 1236 return; 1237 } 1238 } 1239 scb->flags |= SCB_ACTIVE; 1240 1241 if ((scb->flags & SCB_TARGET_IMMEDIATE) != 0) { | 218 ahc->platform_data->sim_b = sim; 219 ahc->platform_data->path_b = path; 220 ahc->platform_data->sim = sim2; 221 ahc->platform_data->path = path2; 222 } else { 223 ahc->platform_data->sim = sim; 224 ahc->platform_data->path = path; 225 ahc->platform_data->sim_b = sim2; --- 1008 unchanged lines hidden (view full) --- 1234 if (TAILQ_FIRST(untagged_q) != scb) { 1235 ahc_unlock(ahc, &s); 1236 return; 1237 } 1238 } 1239 scb->flags |= SCB_ACTIVE; 1240 1241 if ((scb->flags & SCB_TARGET_IMMEDIATE) != 0) { |
1242 pause_sequencer(ahc); | 1242 ahc_pause(ahc); |
1243 if ((ahc->flags & AHC_PAGESCBS) == 0) 1244 ahc_outb(ahc, SCBPTR, scb->hscb->tag); 1245 ahc_outb(ahc, SCB_TAG, scb->hscb->tag); 1246 ahc_outb(ahc, RETURN_1, CONT_MSG_LOOP); | 1243 if ((ahc->flags & AHC_PAGESCBS) == 0) 1244 ahc_outb(ahc, SCBPTR, scb->hscb->tag); 1245 ahc_outb(ahc, SCB_TAG, scb->hscb->tag); 1246 ahc_outb(ahc, RETURN_1, CONT_MSG_LOOP); |
1247 unpause_sequencer(ahc); | 1247 ahc_unpause(ahc); |
1248 } else { 1249 ahc_queue_scb(ahc, scb); 1250 } 1251 1252 ahc_unlock(ahc, &s); 1253} 1254 1255static void --- 162 unchanged lines hidden (view full) --- 1418 ahc_lock(ahc, &s); 1419 1420 ahc_pause_and_flushwork(ahc); 1421 1422 if ((scb->flags & SCB_ACTIVE) == 0) { 1423 /* Previous timeout took care of me already */ 1424 printf("%s: Timedout SCB already complete. " 1425 "Interrupts may not be functioning.\n", ahc_name(ahc)); | 1248 } else { 1249 ahc_queue_scb(ahc, scb); 1250 } 1251 1252 ahc_unlock(ahc, &s); 1253} 1254 1255static void --- 162 unchanged lines hidden (view full) --- 1418 ahc_lock(ahc, &s); 1419 1420 ahc_pause_and_flushwork(ahc); 1421 1422 if ((scb->flags & SCB_ACTIVE) == 0) { 1423 /* Previous timeout took care of me already */ 1424 printf("%s: Timedout SCB already complete. " 1425 "Interrupts may not be functioning.\n", ahc_name(ahc)); |
1426 unpause_sequencer(ahc); | 1426 ahc_unpause(ahc); |
1427 ahc_unlock(ahc, &s); 1428 return; 1429 } 1430 1431 target = SCB_GET_TARGET(ahc, scb); 1432 channel = SCB_GET_CHANNEL(ahc, scb); 1433 lun = SCB_GET_LUN(scb); 1434 1435 ahc_print_path(ahc, scb); 1436 printf("SCB 0x%x - timed out ", scb->hscb->tag); 1437 /* 1438 * Take a snapshot of the bus state and print out 1439 * some information so we can track down driver bugs. 1440 */ 1441 last_phase = ahc_inb(ahc, LASTPHASE); 1442 | 1427 ahc_unlock(ahc, &s); 1428 return; 1429 } 1430 1431 target = SCB_GET_TARGET(ahc, scb); 1432 channel = SCB_GET_CHANNEL(ahc, scb); 1433 lun = SCB_GET_LUN(scb); 1434 1435 ahc_print_path(ahc, scb); 1436 printf("SCB 0x%x - timed out ", scb->hscb->tag); 1437 /* 1438 * Take a snapshot of the bus state and print out 1439 * some information so we can track down driver bugs. 1440 */ 1441 last_phase = ahc_inb(ahc, LASTPHASE); 1442 |
1443 for (i = 0; i < num_phases; i++) { 1444 if (last_phase == phase_table[i].phase) 1445 break; 1446 } 1447 printf("%s", phase_table[i].phasemsg); | 1443 printf("%s", ahc_lookup_phase_entry(last_phase)->phasemsg); |
1448 1449 printf(", SEQADDR == 0x%x\n", 1450 ahc_inb(ahc, SEQADDR0) | (ahc_inb(ahc, SEQADDR1) << 8)); 1451 1452 printf("STACK == 0x%x, 0x%x, 0x%x, 0x%x\n", 1453 ahc_inb(ahc, STACK) | (ahc_inb(ahc, STACK) << 8), 1454 ahc_inb(ahc, STACK) | (ahc_inb(ahc, STACK) << 8), 1455 ahc_inb(ahc, STACK) | (ahc_inb(ahc, STACK) << 8), --- 73 unchanged lines hidden (view full) --- 1529 newtimeout = 1530 MAX(active_scb->io_ctx->ccb_h.timeout, 1531 scb->io_ctx->ccb_h.timeout); 1532 newtimeout *= hz; 1533 newtimeout /= 1000; 1534 ccbh = &scb->io_ctx->ccb_h; 1535 scb->io_ctx->ccb_h.timeout_ch = 1536 timeout(ahc_timeout, scb, newtimeout); | 1444 1445 printf(", SEQADDR == 0x%x\n", 1446 ahc_inb(ahc, SEQADDR0) | (ahc_inb(ahc, SEQADDR1) << 8)); 1447 1448 printf("STACK == 0x%x, 0x%x, 0x%x, 0x%x\n", 1449 ahc_inb(ahc, STACK) | (ahc_inb(ahc, STACK) << 8), 1450 ahc_inb(ahc, STACK) | (ahc_inb(ahc, STACK) << 8), 1451 ahc_inb(ahc, STACK) | (ahc_inb(ahc, STACK) << 8), --- 73 unchanged lines hidden (view full) --- 1525 newtimeout = 1526 MAX(active_scb->io_ctx->ccb_h.timeout, 1527 scb->io_ctx->ccb_h.timeout); 1528 newtimeout *= hz; 1529 newtimeout /= 1000; 1530 ccbh = &scb->io_ctx->ccb_h; 1531 scb->io_ctx->ccb_h.timeout_ch = 1532 timeout(ahc_timeout, scb, newtimeout); |
1533 ahc_unpause(ahc); |
|
1537 ahc_unlock(ahc, &s); 1538 return; 1539 } 1540 1541 /* It's us */ 1542 if ((scb->hscb->control & TARGET_SCB) != 0) { 1543 1544 /* 1545 * Send back any queued up transactions 1546 * and properly record the error condition. 1547 */ 1548 ahc_freeze_devq(ahc, scb); 1549 ahc_set_transaction_status(scb, 1550 CAM_CMD_TIMEOUT); 1551 ahc_freeze_scb(scb); 1552 ahc_done(ahc, scb); 1553 1554 /* Will clear us from the bus */ | 1534 ahc_unlock(ahc, &s); 1535 return; 1536 } 1537 1538 /* It's us */ 1539 if ((scb->hscb->control & TARGET_SCB) != 0) { 1540 1541 /* 1542 * Send back any queued up transactions 1543 * and properly record the error condition. 1544 */ 1545 ahc_freeze_devq(ahc, scb); 1546 ahc_set_transaction_status(scb, 1547 CAM_CMD_TIMEOUT); 1548 ahc_freeze_scb(scb); 1549 ahc_done(ahc, scb); 1550 1551 /* Will clear us from the bus */ |
1555 restart_sequencer(ahc); | 1552 ahc_restart(ahc); |
1556 ahc_unlock(ahc, &s); 1557 return; 1558 } 1559 1560 ahc_set_recoveryscb(ahc, active_scb); 1561 ahc_outb(ahc, MSG_OUT, HOST_MSG); 1562 ahc_outb(ahc, SCSISIGO, last_phase|ATNO); 1563 ahc_print_path(ahc, active_scb); 1564 printf("BDR message in message buffer\n"); 1565 active_scb->flags |= SCB_DEVICE_RESET; 1566 active_scb->io_ctx->ccb_h.timeout_ch = 1567 timeout(ahc_timeout, (caddr_t)active_scb, 2 * hz); | 1553 ahc_unlock(ahc, &s); 1554 return; 1555 } 1556 1557 ahc_set_recoveryscb(ahc, active_scb); 1558 ahc_outb(ahc, MSG_OUT, HOST_MSG); 1559 ahc_outb(ahc, SCSISIGO, last_phase|ATNO); 1560 ahc_print_path(ahc, active_scb); 1561 printf("BDR message in message buffer\n"); 1562 active_scb->flags |= SCB_DEVICE_RESET; 1563 active_scb->io_ctx->ccb_h.timeout_ch = 1564 timeout(ahc_timeout, (caddr_t)active_scb, 2 * hz); |
1568 unpause_sequencer(ahc); | 1565 ahc_unpause(ahc); |
1569 } else { 1570 int disconnected; 1571 1572 /* XXX Shouldn't panic. Just punt instead */ 1573 if ((scb->hscb->control & TARGET_SCB) != 0) 1574 panic("Timed-out target SCB but bus idle"); 1575 1576 if (last_phase != P_BUSFREE 1577 && (ahc_inb(ahc, SSTAT0) & TARGET) != 0) { 1578 /* XXX What happened to the SCB? */ 1579 /* Hung target selection. Goto busfree */ 1580 printf("%s: Hung target selection\n", 1581 ahc_name(ahc)); | 1566 } else { 1567 int disconnected; 1568 1569 /* XXX Shouldn't panic. Just punt instead */ 1570 if ((scb->hscb->control & TARGET_SCB) != 0) 1571 panic("Timed-out target SCB but bus idle"); 1572 1573 if (last_phase != P_BUSFREE 1574 && (ahc_inb(ahc, SSTAT0) & TARGET) != 0) { 1575 /* XXX What happened to the SCB? */ 1576 /* Hung target selection. Goto busfree */ 1577 printf("%s: Hung target selection\n", 1578 ahc_name(ahc)); |
1582 restart_sequencer(ahc); | 1579 ahc_restart(ahc); |
1583 ahc_unlock(ahc, &s); 1584 return; 1585 } 1586 1587 if (ahc_search_qinfifo(ahc, target, channel, lun, 1588 scb->hscb->tag, ROLE_INITIATOR, 1589 /*status*/0, SEARCH_COUNT) > 0) { 1590 disconnected = FALSE; --- 63 unchanged lines hidden (view full) --- 1654 CAM_REQUEUE_REQ, 1655 SEARCH_COMPLETE); 1656 ahc_print_path(ahc, scb); 1657 printf("Queuing a BDR SCB\n"); 1658 ahc_qinfifo_requeue_tail(ahc, scb); 1659 ahc_outb(ahc, SCBPTR, saved_scbptr); 1660 scb->io_ctx->ccb_h.timeout_ch = 1661 timeout(ahc_timeout, (caddr_t)scb, 2 * hz); | 1580 ahc_unlock(ahc, &s); 1581 return; 1582 } 1583 1584 if (ahc_search_qinfifo(ahc, target, channel, lun, 1585 scb->hscb->tag, ROLE_INITIATOR, 1586 /*status*/0, SEARCH_COUNT) > 0) { 1587 disconnected = FALSE; --- 63 unchanged lines hidden (view full) --- 1651 CAM_REQUEUE_REQ, 1652 SEARCH_COMPLETE); 1653 ahc_print_path(ahc, scb); 1654 printf("Queuing a BDR SCB\n"); 1655 ahc_qinfifo_requeue_tail(ahc, scb); 1656 ahc_outb(ahc, SCBPTR, saved_scbptr); 1657 scb->io_ctx->ccb_h.timeout_ch = 1658 timeout(ahc_timeout, (caddr_t)scb, 2 * hz); |
1662 unpause_sequencer(ahc); | 1659 ahc_unpause(ahc); |
1663 } else { 1664 /* Go "immediatly" to the bus reset */ 1665 /* This shouldn't happen */ 1666 ahc_set_recoveryscb(ahc, scb); 1667 ahc_print_path(ahc, scb); 1668 printf("SCB %d: Immediate reset. " 1669 "Flags = 0x%x\n", scb->hscb->tag, 1670 scb->flags); --- 232 unchanged lines hidden --- | 1660 } else { 1661 /* Go "immediatly" to the bus reset */ 1662 /* This shouldn't happen */ 1663 ahc_set_recoveryscb(ahc, scb); 1664 ahc_print_path(ahc, scb); 1665 printf("SCB %d: Immediate reset. " 1666 "Flags = 0x%x\n", scb->hscb->tag, 1667 scb->flags); --- 232 unchanged lines hidden --- |