Lines Matching refs:ahc
705 static int ahc_ext_scbram_present(struct ahc_softc *ahc);
706 static void ahc_scbram_config(struct ahc_softc *ahc, int enable,
708 static void ahc_probe_ext_scbram(struct ahc_softc *ahc);
760 struct ahc_softc *ahc = device_private(self);
785 ahc->sc_dev = self;
786 ahc_set_name(ahc, device_xname(ahc->sc_dev));
787 ahc->parent_dmat = pa->pa_dmat;
805 ahc->bd = bd;
807 ahc->description = entry->name;
809 error = entry->setup(ahc);
834 ahc_name(ahc), (u_long)memt, (u_long)memh, (u_long)iot,
851 ahc->tag = st;
852 ahc->bsh = sh;
854 ahc->chip |= AHC_PCI;
861 ahc_intr_enable(ahc, FALSE);
877 if ((ahc->flags & AHC_39BIT_ADDRESSING) != 0) {
881 ahc_name(ahc));
900 if ((ahc->flags & AHC_DISABLE_PCI_PERR) != 0)
905 ahc->flags |= AHC_PAGESCBS;
906 error = ahc_softc_init(ahc);
910 ahc->bus_intr = ahc_pci_intr;
913 if ((ahc_inb(ahc, HCNTRL) & POWRDN) == 0) {
914 ahc_pause(ahc);
915 if ((ahc->features & AHC_ULTRA2) != 0)
916 our_id = ahc_inb(ahc, SCSIID_ULTRA2) & OID;
918 our_id = ahc_inb(ahc, SCSIID) & OID;
919 sxfrctl1 = ahc_inb(ahc, SXFRCTL1) & STPWEN;
920 scsiseq = ahc_inb(ahc, SCSISEQ);
927 error = ahc_reset(ahc);
931 if ((ahc->features & AHC_DT) != 0) {
935 sfunct = ahc_inb(ahc, SFUNCT) & ~ALT_MODE;
936 ahc_outb(ahc, SFUNCT, sfunct | ALT_MODE);
937 ahc_outb(ahc, OPTIONMODE,
939 ahc_outb(ahc, SFUNCT, sfunct);
942 ahc_outb(ahc, CRCCONTROL1, CRCVALCHKEN|CRCENDCHKEN|CRCREQCHKEN
947 aprint_error("%s: couldn't map interrupt\n", ahc_name(ahc));
948 ahc_free(ahc);
952 ahc->ih = pci_intr_establish_xname(pa->pa_pc, ih, IPL_BIO, ahc_intr,
953 ahc, device_xname(self));
954 if (ahc->ih == NULL) {
955 aprint_error_dev(ahc->sc_dev,
960 ahc_free(ahc);
964 aprint_normal("%s: interrupting at %s\n", ahc_name(ahc),
967 dscommand0 = ahc_inb(ahc, DSCOMMAND0);
969 if ((ahc->features & AHC_ULTRA2) != 0) {
982 if ((ahc->bugs & AHC_CACHETHEN_DIS_BUG) != 0)
985 if ((ahc->bugs & AHC_CACHETHEN_BUG) != 0)
988 ahc_outb(ahc, DSCOMMAND0, dscommand0);
990 ahc->pci_cachesize =
992 ahc->pci_cachesize *= 4;
994 if ((ahc->bugs & AHC_PCI_2_1_RETRY_BUG) != 0
995 && ahc->pci_cachesize == 4) {
997 ahc->pci_cachesize = 0;
1003 * Allow override for the SGI O2 though, which has two onboard ahc
1007 if (((ahc->features & AHC_ULTRA) != 0) && (!override_ultra)) {
1012 ahc->features &= ~AHC_ULTRA;
1015 ahc->seep_config = malloc(sizeof(*ahc->seep_config),
1019 ahc_check_extport(ahc, &sxfrctl1);
1024 sblkctl = ahc_inb(ahc, SBLKCTL);
1025 ahc_outb(ahc, SBLKCTL, (sblkctl & ~(DIAGLEDEN|DIAGLEDON)));
1027 if ((ahc->features & AHC_ULTRA2) != 0) {
1028 ahc_outb(ahc, DFF_THRSH, RD_DFTHRSH_MAX|WR_DFTHRSH_MAX);
1030 ahc_outb(ahc, DSPCISTATUS, DFTHRSH_100);
1033 if (ahc->flags & AHC_USEDEFAULTS) {
1040 if ((ahc->flags & AHC_NO_BIOS_INIT) == 0
1043 ahc_name(ahc));
1044 ahc->flags &= ~AHC_USEDEFAULTS;
1052 if (device_getprop_bool(ahc->sc_dev,
1054 ahc->flags |= AHC_USETARGETDEFAULTS;
1056 ahc->flags |= AHC_BIOS_ENABLED;
1065 ahc_outb(ahc, SCSICONF, our_id|ENSPCHK|RESET_SCSI);
1067 ahc->our_id = our_id;
1075 ahc_probe_ext_scbram(ahc);
1082 ahc->flags |= AHC_TERM_ENB_A;
1084 if (ahc_init(ahc))
1087 ahc_attach(ahc);
1092 ahc_free(ahc);
1139 ahc_ext_scbram_present(struct ahc_softc *ahc)
1146 chip = ahc->chip & AHC_CHIPID_MASK;
1147 devconfig = pci_conf_read(ahc->bd->pc, ahc->bd->tag, DEVCONFIG);
1150 if ((ahc->features & AHC_ULTRA2) != 0)
1151 ramps = (ahc_inb(ahc, DSCOMMAND0) & RAMPS) != 0;
1174 ahc_scbram_config(struct ahc_softc *ahc, int enable, int pcheck,
1179 if (ahc->features & AHC_MULTI_FUNC) {
1184 ahc_outb(ahc, SCBBADDR, ahc->bd->func);
1187 ahc->flags &= ~AHC_LSCBS_ENABLED;
1189 ahc->flags |= AHC_LSCBS_ENABLED;
1190 devconfig = pci_conf_read(ahc->bd->pc, ahc->bd->tag, DEVCONFIG);
1191 if ((ahc->features & AHC_ULTRA2) != 0) {
1194 dscommand0 = ahc_inb(ahc, DSCOMMAND0);
1203 ahc_outb(ahc, DSCOMMAND0, dscommand0);
1223 pci_conf_write(ahc->bd->pc, ahc->bd->tag, DEVCONFIG, devconfig);
1232 ahc_probe_ext_scbram(struct ahc_softc *ahc)
1247 if (ahc_ext_scbram_present(ahc) == 0)
1253 ahc_scbram_config(ahc, /*enable*/TRUE, pcheck, fast, large);
1254 num_scbs = ahc_probe_scbs(ahc);
1266 ahc_outb(ahc, SEQCTL, 0);
1267 ahc_outb(ahc, CLRINT, CLRPARERR);
1268 ahc_outb(ahc, CLRINT, CLRBRKADRINT);
1271 ahc_scbram_config(ahc, enable, /*pcheck*/TRUE, fast, large);
1272 num_scbs = ahc_probe_scbs(ahc);
1273 if ((ahc_inb(ahc, INTSTAT) & BRKADRINT) == 0
1274 || (ahc_inb(ahc, ERROR) & MPARERR) == 0)
1278 ahc_outb(ahc, CLRINT, CLRPARERR);
1279 ahc_outb(ahc, CLRINT, CLRBRKADRINT);
1282 ahc_scbram_config(ahc, enable, pcheck, /*fast*/TRUE, large);
1283 test_num_scbs = ahc_probe_scbs(ahc);
1285 && ((ahc_inb(ahc, INTSTAT) & BRKADRINT) == 0
1286 || (ahc_inb(ahc, ERROR) & MPARERR) == 0))
1293 if ((ahc->features & AHC_LARGE_SCBS) != 0) {
1294 ahc_scbram_config(ahc, enable, pcheck, fast, /*large*/TRUE);
1295 test_num_scbs = ahc_probe_scbs(ahc);
1306 ahc->flags |= AHC_SCB_BTT;
1315 ahc_outb(ahc, SEQCTL, PERRORDIS|FAILDIS);
1317 ahc_outb(ahc, CLRINT, CLRPARERR);
1318 ahc_outb(ahc, CLRINT, CLRBRKADRINT);
1321 ahc_name(ahc), fast ? "fast" : "slow",
1325 ahc_scbram_config(ahc, enable, pcheck, fast, large);
1334 ahc_pci_test_register_access(struct ahc_softc *ahc)
1347 cmd = pci_conf_read(ahc->bd->pc, ahc->bd->tag, PCIR_COMMAND);
1348 pci_conf_write(ahc->bd->pc, ahc->bd->tag, PCIR_COMMAND,
1359 hcntrl = ahc_inb(ahc, HCNTRL);
1370 ahc_outb(ahc, HCNTRL, hcntrl|PAUSE);
1371 while (ahc_is_paused(ahc) == 0)
1373 ahc_outb(ahc, SEQCTL, PERRORDIS);
1374 ahc_outb(ahc, SCBPTR, 0);
1375 ahc_outl(ahc, SCB_BASE, 0x5aa555aa);
1376 if (ahc_inl(ahc, SCB_BASE) != 0x5aa555aa)
1379 status1 = pci_conf_read(ahc->bd->pc, ahc->bd->tag,
1388 status1 = pci_conf_read(ahc->bd->pc, ahc->bd->tag,
1390 ahc_pci_write_config(ahc->dev_softc, PCIR_STATUS + 1,
1392 ahc_outb(ahc, CLRINT, CLRPARERR);
1393 ahc_outb(ahc, SEQCTL, PERRORDIS|FAILDIS);
1394 ahc_pci_write_config(ahc->dev_softc, PCIR_COMMAND, cmd, /*bytes*/2);
1400 ahc_pci_intr(struct ahc_softc *ahc)
1405 error = ahc_inb(ahc, ERROR);
1409 status1 = pci_conf_read(ahc->bd->pc, ahc->bd->tag,
1413 ahc_name(ahc),
1414 ahc_inb(ahc, SEQADDR0) | (ahc_inb(ahc, SEQADDR1) << 8));
1418 "or write data phase\n", ahc_name(ahc));
1421 printf("%s: Signal System Error Detected\n", ahc_name(ahc));
1424 printf("%s: Received a Master Abort\n", ahc_name(ahc));
1427 printf("%s: Received a Target Abort\n", ahc_name(ahc));
1430 printf("%s: Signaled a Target Abort\n", ahc_name(ahc));
1434 ahc_name(ahc));
1438 pci_conf_write(ahc->bd->pc, ahc->bd->tag, PCI_COMMAND_STATUS_REG,
1443 "no status bits set\n", ahc_name(ahc));
1445 ahc_outb(ahc, CLRINT, CLRPARERR);
1448 ahc_unpause(ahc);
1452 ahc_aic785X_setup(struct ahc_softc *ahc)
1456 ahc->channel = 'A';
1457 ahc->chip = AHC_AIC7850;
1458 ahc->features = AHC_AIC7850_FE;
1459 ahc->bugs |= AHC_TMODE_WIDEODD_BUG|AHC_CACHETHEN_BUG|AHC_PCI_MWI_BUG;
1460 rev = PCI_REVISION(ahc->bd->class);
1462 ahc->bugs |= AHC_PCI_2_1_RETRY_BUG;
1467 ahc_aic7860_setup(struct ahc_softc *ahc)
1471 ahc->channel = 'A';
1472 ahc->chip = AHC_AIC7860;
1473 ahc->features = AHC_AIC7860_FE;
1474 ahc->bugs |= AHC_TMODE_WIDEODD_BUG|AHC_CACHETHEN_BUG|AHC_PCI_MWI_BUG;
1475 rev = PCI_REVISION(ahc->bd->class);
1477 ahc->bugs |= AHC_PCI_2_1_RETRY_BUG;
1482 ahc_apa1480_setup(struct ahc_softc *ahc)
1486 error = ahc_aic7860_setup(ahc);
1489 ahc->features |= AHC_REMOVABLE;
1494 ahc_aic7870_setup(struct ahc_softc *ahc)
1497 ahc->channel = 'A';
1498 ahc->chip = AHC_AIC7870;
1499 ahc->features = AHC_AIC7870_FE;
1500 ahc->bugs |= AHC_TMODE_WIDEODD_BUG|AHC_CACHETHEN_BUG|AHC_PCI_MWI_BUG;
1505 ahc_aha394X_setup(struct ahc_softc *ahc)
1509 error = ahc_aic7870_setup(ahc);
1511 error = ahc_aha394XX_setup(ahc);
1516 ahc_aha398X_setup(struct ahc_softc *ahc)
1520 error = ahc_aic7870_setup(ahc);
1522 error = ahc_aha398XX_setup(ahc);
1527 ahc_aha494X_setup(struct ahc_softc *ahc)
1531 error = ahc_aic7870_setup(ahc);
1533 error = ahc_aha494XX_setup(ahc);
1538 ahc_aic7880_setup(struct ahc_softc *ahc)
1542 ahc->channel = 'A';
1543 ahc->chip = AHC_AIC7880;
1544 ahc->features = AHC_AIC7880_FE;
1545 ahc->bugs |= AHC_TMODE_WIDEODD_BUG;
1546 rev = PCI_REVISION(ahc->bd->class);
1548 ahc->bugs |= AHC_PCI_2_1_RETRY_BUG;
1550 ahc->bugs |= AHC_CACHETHEN_BUG|AHC_PCI_MWI_BUG;
1556 ahc_aha2940Pro_setup(struct ahc_softc *ahc)
1559 ahc->flags |= AHC_INT50_SPEEDFLEX;
1560 return (ahc_aic7880_setup(ahc));
1564 ahc_aha394XU_setup(struct ahc_softc *ahc)
1568 error = ahc_aic7880_setup(ahc);
1570 error = ahc_aha394XX_setup(ahc);
1575 ahc_aha398XU_setup(struct ahc_softc *ahc)
1579 error = ahc_aic7880_setup(ahc);
1581 error = ahc_aha398XX_setup(ahc);
1586 ahc_aic7890_setup(struct ahc_softc *ahc)
1590 ahc->channel = 'A';
1591 ahc->chip = AHC_AIC7890;
1592 ahc->features = AHC_AIC7890_FE;
1593 ahc->flags |= AHC_NEWEEPROM_FMT;
1594 rev = PCI_REVISION(ahc->bd->class);
1596 ahc->bugs |= AHC_AUTOFLUSH_BUG|AHC_CACHETHEN_BUG;
1601 ahc_aic7892_setup(struct ahc_softc *ahc)
1604 ahc->channel = 'A';
1605 ahc->chip = AHC_AIC7892;
1606 ahc->features = AHC_AIC7892_FE;
1607 ahc->flags |= AHC_NEWEEPROM_FMT;
1608 ahc->bugs |= AHC_SCBCHAN_UPLOAD_BUG;
1613 ahc_aic7895_setup(struct ahc_softc *ahc)
1617 ahc->channel = (ahc->bd->func == 1) ? 'B' : 'A';
1621 rev = PCI_REVISION(ahc->bd->class);
1623 ahc->chip = AHC_AIC7895C;
1624 ahc->features = AHC_AIC7895C_FE;
1628 ahc->chip = AHC_AIC7895;
1629 ahc->features = AHC_AIC7895_FE;
1637 command = pci_conf_read(ahc->bd->pc, ahc->bd->tag,
1640 pci_conf_write(ahc->bd->pc, ahc->bd->tag,
1642 ahc->bugs |= AHC_PCI_MWI_BUG;
1648 ahc->bugs |= AHC_TMODE_WIDEODD_BUG|AHC_PCI_2_1_RETRY_BUG
1658 pci_conf_write(ahc->bd->pc, ahc->bd->tag, CSIZE_LATTIME, 0);
1659 devconfig = pci_conf_read(ahc->bd->pc, ahc->bd->tag, DEVCONFIG);
1661 pci_conf_write(ahc->bd->pc, ahc->bd->tag, DEVCONFIG, devconfig);
1663 ahc->flags |= AHC_NEWEEPROM_FMT;
1668 ahc_aic7896_setup(struct ahc_softc *ahc)
1670 ahc->channel = (ahc->bd->func == 1) ? 'B' : 'A';
1671 ahc->chip = AHC_AIC7896;
1672 ahc->features = AHC_AIC7896_FE;
1673 ahc->flags |= AHC_NEWEEPROM_FMT;
1674 ahc->bugs |= AHC_CACHETHEN_DIS_BUG;
1679 ahc_aic7899_setup(struct ahc_softc *ahc)
1681 ahc->channel = (ahc->bd->func == 1) ? 'B' : 'A';
1682 ahc->chip = AHC_AIC7899;
1683 ahc->features = AHC_AIC7899_FE;
1684 ahc->flags |= AHC_NEWEEPROM_FMT;
1685 ahc->bugs |= AHC_SCBCHAN_UPLOAD_BUG;
1690 ahc_aha29160C_setup(struct ahc_softc *ahc)
1694 error = ahc_aic7899_setup(ahc);
1697 ahc->features |= AHC_REMOVABLE;
1702 ahc_raid_setup(struct ahc_softc *ahc)
1704 aprint_normal_dev(ahc->sc_dev, "RAID functionality unsupported\n");
1709 ahc_aha394XX_setup(struct ahc_softc *ahc)
1712 switch (ahc->bd->dev) {
1714 ahc->channel = 'A';
1717 ahc->channel = 'B';
1722 ahc->bd->dev);
1723 ahc->channel = 'A';
1729 ahc_aha398XX_setup(struct ahc_softc *ahc)
1732 switch (ahc->bd->dev) {
1734 ahc->channel = 'A';
1737 ahc->channel = 'B';
1740 ahc->channel = 'C';
1745 ahc->bd->dev);
1746 ahc->channel = 'A';
1749 ahc->flags |= AHC_LARGE_SEEPROM;
1754 ahc_aha494XX_setup(struct ahc_softc *ahc)
1757 switch (ahc->bd->dev) {
1759 ahc->channel = 'A';
1762 ahc->channel = 'B';
1765 ahc->channel = 'C';
1768 ahc->channel = 'D';
1773 ahc->bd->dev);
1774 ahc->channel = 'A';
1776 ahc->flags |= AHC_LARGE_SEEPROM;