aic.c (89474) | aic.c (92370) |
---|---|
1/*- 2 * Copyright (c) 1999 Luoqi Chen. 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 9 unchanged lines hidden (view full) --- 18 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 19 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 24 * SUCH DAMAGE. 25 * | 1/*- 2 * Copyright (c) 1999 Luoqi Chen. 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 9 unchanged lines hidden (view full) --- 18 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 19 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 24 * SUCH DAMAGE. 25 * |
26 * $FreeBSD: head/sys/dev/aic/aic.c 89474 2002-01-17 20:34:58Z joerg $ | 26 * $FreeBSD: head/sys/dev/aic/aic.c 92370 2002-03-15 21:30:41Z luoqi $ |
27 */ 28 29#include <sys/param.h> 30#include <sys/systm.h> 31#include <sys/kernel.h> 32#include <sys/bus.h> 33 34#include <machine/bus_pio.h> --- 1363 unchanged lines hidden (view full) --- 1398 ccb_h->status |= CAM_SCSI_BUS_RESET; 1399 aic_done(aic, aic->nexus); 1400 } 1401 1402 aic->state = AIC_IDLE; 1403 aic_outb(aic, DMACNTRL0, INTEN); 1404} 1405 | 27 */ 28 29#include <sys/param.h> 30#include <sys/systm.h> 31#include <sys/kernel.h> 32#include <sys/bus.h> 33 34#include <machine/bus_pio.h> --- 1363 unchanged lines hidden (view full) --- 1398 ccb_h->status |= CAM_SCSI_BUS_RESET; 1399 aic_done(aic, aic->nexus); 1400 } 1401 1402 aic->state = AIC_IDLE; 1403 aic_outb(aic, DMACNTRL0, INTEN); 1404} 1405 |
1406static char *aic_chip_names[] = { 1407 "AIC6260", "AIC6360", "AIC6370", "GM82C700", 1408}; 1409 1410static struct { 1411 int type; 1412 char *idstring; 1413} aic_chip_ids[] = { 1414 { AIC6360, IDSTRING_AIC6360 }, 1415 { AIC6370, IDSTRING_AIC6370 }, 1416 { GM82C700, IDSTRING_GM82C700 }, 1417}; 1418 |
|
1406static void 1407aic_init(struct aic_softc *aic) 1408{ 1409 struct aic_scb *scb; 1410 struct aic_tinfo *ti; 1411 u_int8_t porta, portb; | 1419static void 1420aic_init(struct aic_softc *aic) 1421{ 1422 struct aic_scb *scb; 1423 struct aic_tinfo *ti; 1424 u_int8_t porta, portb; |
1425 char chip_id[33]; |
|
1412 int i; 1413 1414 TAILQ_INIT(&aic->pending_ccbs); 1415 TAILQ_INIT(&aic->nexus_ccbs); 1416 aic->nexus = NULL; 1417 aic->state = AIC_IDLE; 1418 aic->prev_phase = -1; 1419 aic->flags = 0; 1420 1421 aic_chip_reset(aic); 1422 aic_scsi_reset(aic); 1423 | 1426 int i; 1427 1428 TAILQ_INIT(&aic->pending_ccbs); 1429 TAILQ_INIT(&aic->nexus_ccbs); 1430 aic->nexus = NULL; 1431 aic->state = AIC_IDLE; 1432 aic->prev_phase = -1; 1433 aic->flags = 0; 1434 1435 aic_chip_reset(aic); 1436 aic_scsi_reset(aic); 1437 |
1438 /* determine the chip type from its ID string */ 1439 aic->chip_type = AIC6260; 1440 aic_insb(aic, ID, chip_id, sizeof(chip_id) - 1); 1441 chip_id[sizeof(chip_id) - 1] = '\0'; 1442 for (i = 0; i < sizeof(aic_chip_ids) / sizeof(aic_chip_ids[0]); i++) { 1443 if (!strcmp(chip_id, aic_chip_ids[i].idstring)) { 1444 aic->chip_type = aic_chip_ids[i].type; 1445 break; 1446 } 1447 } 1448 |
|
1424 porta = aic_inb(aic, PORTA); 1425 portb = aic_inb(aic, PORTB); 1426 1427 aic->initiator = PORTA_ID(porta); 1428 if (PORTA_PARITY(porta)) 1429 aic->flags |= AIC_PARITY_ENABLE; 1430 if (PORTB_DISC(portb)) 1431 aic->flags |= AIC_DISC_ENABLE; 1432 if (PORTB_DMA(portb)) 1433 aic->flags |= AIC_DMA_ENABLE; 1434 1435 /* 1436 * We can do fast SCSI (10MHz clock rate) if bit 4 of portb 1437 * is set and we've got a 6360. The 6260 can only do standard 1438 * 5MHz SCSI. 1439 */ | 1449 porta = aic_inb(aic, PORTA); 1450 portb = aic_inb(aic, PORTB); 1451 1452 aic->initiator = PORTA_ID(porta); 1453 if (PORTA_PARITY(porta)) 1454 aic->flags |= AIC_PARITY_ENABLE; 1455 if (PORTB_DISC(portb)) 1456 aic->flags |= AIC_DISC_ENABLE; 1457 if (PORTB_DMA(portb)) 1458 aic->flags |= AIC_DMA_ENABLE; 1459 1460 /* 1461 * We can do fast SCSI (10MHz clock rate) if bit 4 of portb 1462 * is set and we've got a 6360. The 6260 can only do standard 1463 * 5MHz SCSI. 1464 */ |
1440 if (aic_inb(aic, REV)) { 1441 if (PORTB_FSYNC(portb)) { 1442 aic->max_period = AIC_FAST_SYNC_PERIOD; | 1465 if (aic->chip_type > AIC6260 || aic_inb(aic, REV)) { 1466 if (PORTB_FSYNC(portb)) |
1443 aic->flags |= AIC_FAST_ENABLE; | 1467 aic->flags |= AIC_FAST_ENABLE; |
1444 } else 1445 aic->max_period = AIC_SYNC_PERIOD; 1446 | |
1447 aic->flags |= AIC_DWIO_ENABLE; | 1468 aic->flags |= AIC_DWIO_ENABLE; |
1448 } else 1449 aic->max_period = AIC_SYNC_PERIOD; | 1469 } |
1450 | 1470 |
1471 if (aic->flags & AIC_FAST_ENABLE) 1472 aic->max_period = AIC_FAST_SYNC_PERIOD; 1473 else 1474 aic->max_period = AIC_SYNC_PERIOD; |
|
1451 aic->min_period = AIC_MIN_SYNC_PERIOD; 1452 1453 free_scbs = NULL; 1454 for (i = 255; i >= 0; i--) { 1455 scb = &aic->scbs[i]; 1456 scb->tag = i; 1457 aic_free_scb(aic, scb); 1458 } --- 69 unchanged lines hidden (view full) --- 1528 CAM_LUN_WILDCARD) != CAM_REQ_CMP) { 1529 xpt_bus_deregister(cam_sim_path(aic->sim)); 1530 cam_sim_free(aic->sim, /*free_devq*/TRUE); 1531 return (ENXIO); 1532 } 1533 1534 aic_init(aic); 1535 | 1475 aic->min_period = AIC_MIN_SYNC_PERIOD; 1476 1477 free_scbs = NULL; 1478 for (i = 255; i >= 0; i--) { 1479 scb = &aic->scbs[i]; 1480 scb->tag = i; 1481 aic_free_scb(aic, scb); 1482 } --- 69 unchanged lines hidden (view full) --- 1552 CAM_LUN_WILDCARD) != CAM_REQ_CMP) { 1553 xpt_bus_deregister(cam_sim_path(aic->sim)); 1554 cam_sim_free(aic->sim, /*free_devq*/TRUE); 1555 return (ENXIO); 1556 } 1557 1558 aic_init(aic); 1559 |
1536 printf("aic%d: %s", aic->unit, 1537 aic_inb(aic, REV) > 0 ? "aic6360" : "aic6260"); | 1560 printf("aic%d: %s", aic->unit, aic_chip_names[aic->chip_type]); |
1538 if (aic->flags & AIC_DMA_ENABLE) 1539 printf(", dma"); 1540 if (aic->flags & AIC_DISC_ENABLE) 1541 printf(", disconnection"); 1542 if (aic->flags & AIC_PARITY_ENABLE) 1543 printf(", parity check"); 1544 if (aic->flags & AIC_FAST_ENABLE) 1545 printf(", fast SCSI"); --- 13 unchanged lines hidden --- | 1561 if (aic->flags & AIC_DMA_ENABLE) 1562 printf(", dma"); 1563 if (aic->flags & AIC_DISC_ENABLE) 1564 printf(", disconnection"); 1565 if (aic->flags & AIC_PARITY_ENABLE) 1566 printf(", parity check"); 1567 if (aic->flags & AIC_FAST_ENABLE) 1568 printf(", fast SCSI"); --- 13 unchanged lines hidden --- |