Lines Matching defs:ahc

672 static int ahc_ext_scbram_present(struct ahc_softc *ahc);
673 static void ahc_scbram_config(struct ahc_softc *ahc, int enable,
675 static void ahc_probe_ext_scbram(struct ahc_softc *ahc);
676 static void check_extport(struct ahc_softc *ahc, u_int *sxfrctl1);
677 static void ahc_parse_pci_eeprom(struct ahc_softc *ahc,
679 static void configure_termination(struct ahc_softc *ahc,
684 static void ahc_new_term_detect(struct ahc_softc *ahc,
690 static void aic787X_cable_detect(struct ahc_softc *ahc, int *internal50_present,
694 static void aic785X_cable_detect(struct ahc_softc *ahc, int *internal50_present,
697 static void write_brdctl(struct ahc_softc *ahc, uint8_t value);
698 static uint8_t read_brdctl(struct ahc_softc *ahc);
699 static void ahc_pci_intr(struct ahc_softc *ahc);
700 static int ahc_pci_chip_init(struct ahc_softc *ahc);
701 static int ahc_pci_suspend(struct ahc_softc *ahc);
702 static int ahc_pci_resume(struct ahc_softc *ahc);
779 ahc_pci_config(struct ahc_softc *ahc, struct ahc_pci_identity *entry)
791 error = entry->setup(ahc);
794 ahc->chip |= AHC_PCI;
795 ahc->description = entry->name;
797 aic_power_state_change(ahc, AIC_POWER_STATE_D0);
799 error = ahc_pci_map_registers(ahc);
809 ahc_intr_enable(ahc, FALSE);
811 devconfig = aic_pci_read_config(ahc->dev_softc, DEVCONFIG, /*bytes*/4);
819 if ((ahc->flags & AHC_39BIT_ADDRESSING) != 0) {
822 ahc_name(ahc));
829 aic_pci_write_config(ahc->dev_softc, DEVCONFIG, devconfig, /*bytes*/4);
832 command = aic_pci_read_config(ahc->dev_softc, PCIR_COMMAND, /*bytes*/2);
835 aic_pci_write_config(ahc->dev_softc, PCIR_COMMAND, command, /*bytes*/2);
838 ahc->flags |= AHC_PAGESCBS;
840 error = ahc_softc_init(ahc);
852 if ((ahc->flags & AHC_DISABLE_PCI_PERR) != 0)
853 ahc->seqctl |= FAILDIS;
855 ahc->bus_intr = ahc_pci_intr;
856 ahc->bus_chip_init = ahc_pci_chip_init;
857 ahc->bus_suspend = ahc_pci_suspend;
858 ahc->bus_resume = ahc_pci_resume;
861 if ((ahc_inb(ahc, HCNTRL) & POWRDN) == 0) {
862 ahc_pause(ahc);
863 if ((ahc->features & AHC_ULTRA2) != 0)
864 our_id = ahc_inb(ahc, SCSIID_ULTRA2) & OID;
866 our_id = ahc_inb(ahc, SCSIID) & OID;
867 sxfrctl1 = ahc_inb(ahc, SXFRCTL1) & STPWEN;
868 scsiseq = ahc_inb(ahc, SCSISEQ);
875 error = ahc_reset(ahc, /*reinit*/FALSE);
879 if ((ahc->features & AHC_DT) != 0) {
883 sfunct = ahc_inb(ahc, SFUNCT) & ~ALT_MODE;
884 ahc_outb(ahc, SFUNCT, sfunct | ALT_MODE);
885 ahc_outb(ahc, OPTIONMODE,
887 ahc_outb(ahc, SFUNCT, sfunct);
890 ahc_outb(ahc, CRCCONTROL1, CRCVALCHKEN|CRCENDCHKEN|CRCREQCHKEN
894 dscommand0 = ahc_inb(ahc, DSCOMMAND0);
896 if ((ahc->features & AHC_ULTRA2) != 0) {
908 if ((ahc->bugs & AHC_CACHETHEN_DIS_BUG) != 0)
911 if ((ahc->bugs & AHC_CACHETHEN_BUG) != 0)
914 ahc_outb(ahc, DSCOMMAND0, dscommand0);
916 ahc->pci_cachesize =
917 aic_pci_read_config(ahc->dev_softc, CSIZE_LATTIME,
919 ahc->pci_cachesize *= 4;
921 if ((ahc->bugs & AHC_PCI_2_1_RETRY_BUG) != 0
922 && ahc->pci_cachesize == 4) {
923 aic_pci_write_config(ahc->dev_softc, CSIZE_LATTIME,
925 ahc->pci_cachesize = 0;
932 if ((ahc->features & AHC_ULTRA) != 0) {
935 devconfig = aic_pci_read_config(ahc->dev_softc,
938 ahc->features &= ~AHC_ULTRA;
942 check_extport(ahc, &sxfrctl1);
947 sblkctl = ahc_inb(ahc, SBLKCTL);
948 ahc_outb(ahc, SBLKCTL, (sblkctl & ~(DIAGLEDEN|DIAGLEDON)));
950 if ((ahc->features & AHC_ULTRA2) != 0) {
951 ahc_outb(ahc, DFF_THRSH, RD_DFTHRSH_MAX|WR_DFTHRSH_MAX);
953 ahc_outb(ahc, DSPCISTATUS, DFTHRSH_100);
956 if (ahc->flags & AHC_USEDEFAULTS) {
963 if ((ahc->flags & AHC_NO_BIOS_INIT) == 0
966 ahc_name(ahc));
967 ahc->flags &= ~AHC_USEDEFAULTS;
968 ahc->flags |= AHC_BIOS_ENABLED;
977 ahc_outb(ahc, SCSICONF, our_id|ENSPCHK|RESET_SCSI);
979 ahc->our_id = our_id;
987 ahc_probe_ext_scbram(ahc);
994 ahc->flags |= AHC_TERM_ENB_A;
1000 ahc->bus_softc.pci_softc.devconfig =
1001 aic_pci_read_config(ahc->dev_softc, DEVCONFIG, /*bytes*/4);
1002 ahc->bus_softc.pci_softc.command =
1003 aic_pci_read_config(ahc->dev_softc, PCIR_COMMAND, /*bytes*/1);
1004 ahc->bus_softc.pci_softc.csize_lattime =
1005 aic_pci_read_config(ahc->dev_softc, CSIZE_LATTIME, /*bytes*/1);
1006 ahc->bus_softc.pci_softc.dscommand0 = ahc_inb(ahc, DSCOMMAND0);
1007 ahc->bus_softc.pci_softc.dspcistatus = ahc_inb(ahc, DSPCISTATUS);
1008 if ((ahc->features & AHC_DT) != 0) {
1011 sfunct = ahc_inb(ahc, SFUNCT) & ~ALT_MODE;
1012 ahc_outb(ahc, SFUNCT, sfunct | ALT_MODE);
1013 ahc->bus_softc.pci_softc.optionmode = ahc_inb(ahc, OPTIONMODE);
1014 ahc->bus_softc.pci_softc.targcrccnt = ahc_inw(ahc, TARGCRCCNT);
1015 ahc_outb(ahc, SFUNCT, sfunct);
1016 ahc->bus_softc.pci_softc.crccontrol1 =
1017 ahc_inb(ahc, CRCCONTROL1);
1019 if ((ahc->features & AHC_MULTI_FUNC) != 0)
1020 ahc->bus_softc.pci_softc.scbbaddr = ahc_inb(ahc, SCBBADDR);
1022 if ((ahc->features & AHC_ULTRA2) != 0)
1023 ahc->bus_softc.pci_softc.dff_thrsh = ahc_inb(ahc, DFF_THRSH);
1026 error = ahc_init(ahc);
1033 error = ahc_pci_map_int(ahc);
1037 ahc_lock(ahc);
1039 * Link this softc in with all other ahc instances.
1041 ahc_softc_insert(ahc);
1042 ahc_unlock(ahc);
1051 ahc_ext_scbram_present(struct ahc_softc *ahc)
1058 chip = ahc->chip & AHC_CHIPID_MASK;
1059 devconfig = aic_pci_read_config(ahc->dev_softc,
1063 if ((ahc->features & AHC_ULTRA2) != 0)
1064 ramps = (ahc_inb(ahc, DSCOMMAND0) & RAMPS) != 0;
1087 ahc_scbram_config(struct ahc_softc *ahc, int enable, int pcheck,
1092 if (ahc->features & AHC_MULTI_FUNC) {
1097 ahc_outb(ahc, SCBBADDR, aic_get_pci_function(ahc->dev_softc));
1100 ahc->flags &= ~AHC_LSCBS_ENABLED;
1102 ahc->flags |= AHC_LSCBS_ENABLED;
1103 devconfig = aic_pci_read_config(ahc->dev_softc, DEVCONFIG, /*bytes*/4);
1104 if ((ahc->features & AHC_ULTRA2) != 0) {
1107 dscommand0 = ahc_inb(ahc, DSCOMMAND0);
1116 ahc_outb(ahc, DSCOMMAND0, dscommand0);
1136 aic_pci_write_config(ahc->dev_softc, DEVCONFIG, devconfig, /*bytes*/4);
1145 ahc_probe_ext_scbram(struct ahc_softc *ahc)
1160 if (ahc_ext_scbram_present(ahc) == 0)
1166 ahc_scbram_config(ahc, /*enable*/TRUE, pcheck, fast, large);
1167 num_scbs = ahc_probe_scbs(ahc);
1179 ahc_outb(ahc, SEQCTL, 0);
1180 ahc_outb(ahc, CLRINT, CLRPARERR);
1181 ahc_outb(ahc, CLRINT, CLRBRKADRINT);
1184 ahc_scbram_config(ahc, enable, /*pcheck*/TRUE, fast, large);
1185 num_scbs = ahc_probe_scbs(ahc);
1186 if ((ahc_inb(ahc, INTSTAT) & BRKADRINT) == 0
1187 || (ahc_inb(ahc, ERROR) & MPARERR) == 0)
1191 ahc_outb(ahc, CLRINT, CLRPARERR);
1192 ahc_outb(ahc, CLRINT, CLRBRKADRINT);
1195 ahc_scbram_config(ahc, enable, pcheck, /*fast*/TRUE, large);
1196 test_num_scbs = ahc_probe_scbs(ahc);
1198 && ((ahc_inb(ahc, INTSTAT) & BRKADRINT) == 0
1199 || (ahc_inb(ahc, ERROR) & MPARERR) == 0))
1206 if ((ahc->features & AHC_LARGE_SCBS) != 0) {
1207 ahc_scbram_config(ahc, enable, pcheck, fast, /*large*/TRUE);
1208 test_num_scbs = ahc_probe_scbs(ahc);
1219 ahc->flags |= AHC_SCB_BTT;
1228 ahc_outb(ahc, SEQCTL, PERRORDIS|FAILDIS);
1230 ahc_outb(ahc, CLRINT, CLRPARERR);
1231 ahc_outb(ahc, CLRINT, CLRBRKADRINT);
1234 ahc_name(ahc), fast ? "fast" : "slow",
1238 ahc_scbram_config(ahc, enable, pcheck, fast, large);
1246 ahc_pci_test_register_access(struct ahc_softc *ahc)
1259 cmd = aic_pci_read_config(ahc->dev_softc, PCIR_COMMAND, /*bytes*/2);
1260 aic_pci_write_config(ahc->dev_softc, PCIR_COMMAND,
1271 hcntrl = ahc_inb(ahc, HCNTRL);
1282 ahc->flags |= AHC_NO_BIOS_INIT;
1294 ahc_outb(ahc, HCNTRL, hcntrl|PAUSE);
1295 while (ahc_is_paused(ahc) == 0)
1299 status1 = aic_pci_read_config(ahc->dev_softc,
1301 aic_pci_write_config(ahc->dev_softc, PCIR_STATUS + 1,
1303 ahc_outb(ahc, CLRINT, CLRPARERR);
1305 ahc_outb(ahc, SEQCTL, PERRORDIS);
1306 ahc_outb(ahc, SCBPTR, 0);
1307 ahc_outl(ahc, SCB_BASE, 0x5aa555aa);
1308 if (ahc_inl(ahc, SCB_BASE) != 0x5aa555aa)
1311 status1 = aic_pci_read_config(ahc->dev_softc,
1320 status1 = aic_pci_read_config(ahc->dev_softc,
1322 aic_pci_write_config(ahc->dev_softc, PCIR_STATUS + 1,
1324 ahc_outb(ahc, CLRINT, CLRPARERR);
1325 ahc_outb(ahc, SEQCTL, PERRORDIS|FAILDIS);
1326 aic_pci_write_config(ahc->dev_softc, PCIR_COMMAND, cmd, /*bytes*/2);
1335 check_extport(struct ahc_softc *ahc, u_int *sxfrctl1)
1342 sd.sd_ahc = ahc;
1346 sc = ahc->seep_config;
1354 if (ahc->flags & AHC_LARGE_SEEPROM)
1366 have_seeprom = ahc_acquire_seeprom(ahc, &sd);
1369 printf("%s: Reading SEEPROM...", ahc_name(ahc));
1374 start_addr = 32 * (ahc->channel - 'A');
1398 ahc->flags |= AHC_LARGE_SEEPROM;
1409 ahc_outb(ahc, SCBPTR, 2);
1410 if (ahc_inb(ahc, SCB_BASE) == 'A'
1411 && ahc_inb(ahc, SCB_BASE + 1) == 'D'
1412 && ahc_inb(ahc, SCB_BASE + 2) == 'P'
1413 && ahc_inb(ahc, SCB_BASE + 3) == 'T') {
1422 *sc_data = ahc_inb(ahc, SRAM_BASE + j)
1423 | ahc_inb(ahc, SRAM_BASE + j + 1) << 8;
1427 ahc->flags |= AHC_SCB_CONFIG_USED;
1433 ahc_outb(ahc, CLRINT, CLRPARERR);
1434 ahc_outb(ahc, CLRINT, CLRBRKADRINT);
1439 printf("%s: No SEEPROM available.\n", ahc_name(ahc));
1440 ahc->flags |= AHC_USEDEFAULTS;
1441 free(ahc->seep_config, M_DEVBUF);
1442 ahc->seep_config = NULL;
1445 ahc_parse_pci_eeprom(ahc, sc);
1461 if ((ahc->features & AHC_SPIOCAP) != 0) {
1462 if ((ahc_inb(ahc, SPIOCAP) & SSPIOCPS) == 0)
1467 ahc->flags |= AHC_HAS_TERM_LOGIC;
1468 ahc_acquire_seeprom(ahc, &sd);
1469 configure_termination(ahc, &sd, sc->adapter_control, sxfrctl1);
1477 ahc_name(ahc),
1483 ahc_parse_pci_eeprom(struct ahc_softc *ahc, struct seeprom_config *sc)
1504 ahc->flags |= AHC_NEWEEPROM_FMT;
1517 if ((ahc->flags & AHC_NEWEEPROM_FMT) != 0) {
1529 if ((ahc->features & AHC_ULTRA2) != 0) {
1536 ahc_outb(ahc, TARG_OFFSET + i, offset);
1554 ahc_outb(ahc, TARG_SCSIRATE + i, scsirate);
1556 ahc->our_id = sc->brtime_id & CFSCSIID;
1558 scsi_conf = (ahc->our_id & 0x7);
1564 ahc->flags |= (sc->adapter_control & CFBOOTCHAN) >> CFBOOTCHANSHIFT;
1567 ahc->flags |= AHC_EXTENDED_TRANS_A;
1570 ahc->flags |= AHC_BIOS_ENABLED;
1571 if (ahc->features & AHC_ULTRA
1572 && (ahc->flags & AHC_NEWEEPROM_FMT) == 0) {
1584 devconfig = aic_pci_read_config(ahc->dev_softc,
1589 aic_pci_write_config(ahc->dev_softc, DEVCONFIG,
1593 ahc_outb(ahc, SCSICONF, scsi_conf);
1594 ahc_outb(ahc, DISC_DSB, ~(discenable & 0xff));
1595 ahc_outb(ahc, DISC_DSB + 1, ~((discenable >> 8) & 0xff));
1596 ahc_outb(ahc, ULTRA_ENB, ultraenb & 0xff);
1597 ahc_outb(ahc, ULTRA_ENB + 1, (ultraenb >> 8) & 0xff);
1601 configure_termination(struct ahc_softc *ahc,
1623 || (ahc->features & AHC_NEW_TERMCTL) != 0) {
1638 if ((ahc->features & AHC_NEW_TERMCTL) != 0) {
1639 ahc_new_term_detect(ahc, &enableSEC_low,
1647 ahc_name(ahc));
1655 ahc_name(ahc));
1663 } else if ((ahc->features & AHC_SPIOCAP) != 0) {
1664 aic785X_cable_detect(ahc, &internal50_present,
1670 aic787X_cable_detect(ahc, &internal50_present,
1676 if ((ahc->features & AHC_WIDE) == 0)
1680 && (ahc->features & AHC_ULTRA2) == 0) {
1682 ahc_name(ahc),
1685 if ((ahc->features & AHC_WIDE) != 0)
1689 ahc_name(ahc),
1694 ahc_name(ahc), eeprom_present ? "is" : "not");
1696 if ((ahc->flags & AHC_INT50_SPEEDFLEX) != 0) {
1715 if ((ahc->features & AHC_ULTRA2) == 0
1722 "time!\n", ahc_name(ahc));
1734 if ((ahc->features & AHC_WIDE) != 0
1740 if ((ahc->flags & AHC_INT50_SPEEDFLEX) != 0)
1742 "Enabled\n", ahc_name(ahc));
1745 "Enabled\n", ahc_name(ahc),
1754 if ((ahc->features & AHC_ULTRA2) != 0)
1759 if ((ahc->flags & AHC_INT50_SPEEDFLEX) != 0)
1761 "Enabled\n", ahc_name(ahc));
1764 "Enabled\n", ahc_name(ahc),
1774 "Enabled\n", ahc_name(ahc));
1781 ahc_outb(ahc, SXFRCTL1, *sxfrctl1);
1788 ahc_name(ahc));
1791 write_brdctl(ahc, brddat);
1799 ahc_name(ahc),
1800 (ahc->features & AHC_ULTRA2) ? "Primary "
1805 && (ahc->features & AHC_WIDE) != 0) {
1809 ahc_name(ahc),
1810 (ahc->features & AHC_ULTRA2)
1818 ahc_outb(ahc, SXFRCTL1, *sxfrctl1);
1820 if ((ahc->features & AHC_WIDE) != 0)
1821 write_brdctl(ahc, brddat);
1827 ahc_new_term_detect(struct ahc_softc *ahc, int *enableSEC_low,
1840 brdctl = read_brdctl(ahc);
1849 aic787X_cable_detect(struct ahc_softc *ahc, int *internal50_present,
1862 write_brdctl(ahc, 0);
1869 brdctl = read_brdctl(ahc);
1877 write_brdctl(ahc, BRDDAT5);
1884 brdctl = read_brdctl(ahc);
1890 aic785X_cable_detect(struct ahc_softc *ahc, int *internal50_present,
1896 spiocap = ahc_inb(ahc, SPIOCAP);
1899 ahc_outb(ahc, SPIOCAP, spiocap);
1900 ahc_outb(ahc, BRDCTL, BRDRW|BRDCS);
1901 ahc_flush_device_writes(ahc);
1903 ahc_outb(ahc, BRDCTL, 0);
1904 ahc_flush_device_writes(ahc);
1906 brdctl = ahc_inb(ahc, BRDCTL);
1909 *eeprom_present = (ahc_inb(ahc, SPIOCAP) & EEPROM) ? 1 : 0;
1913 ahc_acquire_seeprom(struct ahc_softc *ahc, struct seeprom_descriptor *sd)
1917 if ((ahc->features & AHC_SPIOCAP) != 0
1918 && (ahc_inb(ahc, SPIOCAP) & SEEPROM) == 0)
1948 write_brdctl(struct ahc_softc *ahc, uint8_t value)
1952 if ((ahc->chip & AHC_CHIPID_MASK) == AHC_AIC7895) {
1954 if (ahc->channel == 'B')
1956 } else if ((ahc->features & AHC_ULTRA2) != 0) {
1961 ahc_outb(ahc, BRDCTL, brdctl);
1962 ahc_flush_device_writes(ahc);
1964 ahc_outb(ahc, BRDCTL, brdctl);
1965 ahc_flush_device_writes(ahc);
1966 if ((ahc->features & AHC_ULTRA2) != 0)
1970 ahc_outb(ahc, BRDCTL, brdctl);
1971 ahc_flush_device_writes(ahc);
1972 if ((ahc->features & AHC_ULTRA2) != 0)
1976 ahc_outb(ahc, BRDCTL, brdctl);
1980 read_brdctl(struct ahc_softc *ahc)
1985 if ((ahc->chip & AHC_CHIPID_MASK) == AHC_AIC7895) {
1987 if (ahc->channel == 'B')
1989 } else if ((ahc->features & AHC_ULTRA2) != 0) {
1994 ahc_outb(ahc, BRDCTL, brdctl);
1995 ahc_flush_device_writes(ahc);
1996 value = ahc_inb(ahc, BRDCTL);
1997 ahc_outb(ahc, BRDCTL, 0);
2002 ahc_pci_intr(struct ahc_softc *ahc)
2007 error = ahc_inb(ahc, ERROR);
2011 status1 = aic_pci_read_config(ahc->dev_softc,
2015 || (ahc->flags & AHC_DISABLE_PCI_PERR) == 0) {
2017 ahc_name(ahc),
2018 ahc_inb(ahc, SEQADDR0) | (ahc_inb(ahc, SEQADDR1) << 8));
2022 && (ahc->flags & AHC_DISABLE_PCI_PERR) == 0) {
2023 ahc->pci_target_perr_count++;
2025 "or write data phase\n", ahc_name(ahc));
2028 printf("%s: Signal System Error Detected\n", ahc_name(ahc));
2031 printf("%s: Received a Master Abort\n", ahc_name(ahc));
2034 printf("%s: Received a Target Abort\n", ahc_name(ahc));
2037 printf("%s: Signaled a Target Abort\n", ahc_name(ahc));
2041 ahc_name(ahc));
2045 aic_pci_write_config(ahc->dev_softc, PCIR_STATUS + 1,
2050 "no status bits set\n", ahc_name(ahc));
2052 ahc_outb(ahc, CLRINT, CLRPARERR);
2055 if (ahc->pci_target_perr_count > AHC_PCI_TARGET_PERR_THRESH
2056 && (ahc->flags & AHC_DISABLE_PCI_PERR) == 0) {
2064 ahc_name(ahc), ahc_name(ahc), ahc_name(ahc),
2065 ahc_name(ahc), ahc_name(ahc), ahc_name(ahc),
2066 ahc_name(ahc));
2067 ahc->seqctl |= FAILDIS;
2068 ahc->flags |= AHC_DISABLE_PCI_PERR;
2069 ahc_outb(ahc, SEQCTL, ahc->seqctl);
2071 ahc_unpause(ahc);
2075 ahc_pci_chip_init(struct ahc_softc *ahc)
2077 ahc_outb(ahc, DSCOMMAND0, ahc->bus_softc.pci_softc.dscommand0);
2078 ahc_outb(ahc, DSPCISTATUS, ahc->bus_softc.pci_softc.dspcistatus);
2079 if ((ahc->features & AHC_DT) != 0) {
2082 sfunct = ahc_inb(ahc, SFUNCT) & ~ALT_MODE;
2083 ahc_outb(ahc, SFUNCT, sfunct | ALT_MODE);
2084 ahc_outb(ahc, OPTIONMODE, ahc->bus_softc.pci_softc.optionmode);
2085 ahc_outw(ahc, TARGCRCCNT, ahc->bus_softc.pci_softc.targcrccnt);
2086 ahc_outb(ahc, SFUNCT, sfunct);
2087 ahc_outb(ahc, CRCCONTROL1,
2088 ahc->bus_softc.pci_softc.crccontrol1);
2090 if ((ahc->features & AHC_MULTI_FUNC) != 0)
2091 ahc_outb(ahc, SCBBADDR, ahc->bus_softc.pci_softc.scbbaddr);
2093 if ((ahc->features & AHC_ULTRA2) != 0)
2094 ahc_outb(ahc, DFF_THRSH, ahc->bus_softc.pci_softc.dff_thrsh);
2096 return (ahc_chip_init(ahc));
2100 ahc_pci_suspend(struct ahc_softc *ahc)
2102 return (ahc_suspend(ahc));
2106 ahc_pci_resume(struct ahc_softc *ahc)
2109 aic_power_state_change(ahc, AIC_POWER_STATE_D0);
2117 aic_pci_write_config(ahc->dev_softc, DEVCONFIG,
2118 ahc->bus_softc.pci_softc.devconfig, /*bytes*/4);
2119 aic_pci_write_config(ahc->dev_softc, PCIR_COMMAND,
2120 ahc->bus_softc.pci_softc.command, /*bytes*/1);
2121 aic_pci_write_config(ahc->dev_softc, CSIZE_LATTIME,
2122 ahc->bus_softc.pci_softc.csize_lattime,
2124 if ((ahc->flags & AHC_HAS_TERM_LOGIC) != 0) {
2128 sd.sd_ahc = ahc;
2133 ahc_acquire_seeprom(ahc, &sd);
2134 configure_termination(ahc, &sd,
2135 ahc->seep_config->adapter_control,
2139 return (ahc_resume(ahc));
2143 ahc_aic785X_setup(struct ahc_softc *ahc)
2148 pci = ahc->dev_softc;
2149 ahc->channel = 'A';
2150 ahc->chip = AHC_AIC7850;
2151 ahc->features = AHC_AIC7850_FE;
2152 ahc->bugs |= AHC_TMODE_WIDEODD_BUG|AHC_CACHETHEN_BUG|AHC_PCI_MWI_BUG;
2155 ahc->bugs |= AHC_PCI_2_1_RETRY_BUG;
2156 ahc->instruction_ram_size = 512;
2161 ahc_aic7860_setup(struct ahc_softc *ahc)
2166 pci = ahc->dev_softc;
2167 ahc->channel = 'A';
2168 ahc->chip = AHC_AIC7860;
2169 ahc->features = AHC_AIC7860_FE;
2170 ahc->bugs |= AHC_TMODE_WIDEODD_BUG|AHC_CACHETHEN_BUG|AHC_PCI_MWI_BUG;
2173 ahc->bugs |= AHC_PCI_2_1_RETRY_BUG;
2174 ahc->instruction_ram_size = 512;
2179 ahc_apa1480_setup(struct ahc_softc *ahc)
2183 error = ahc_aic7860_setup(ahc);
2186 ahc->features |= AHC_REMOVABLE;
2191 ahc_aic7870_setup(struct ahc_softc *ahc)
2194 ahc->channel = 'A';
2195 ahc->chip = AHC_AIC7870;
2196 ahc->features = AHC_AIC7870_FE;
2197 ahc->bugs |= AHC_TMODE_WIDEODD_BUG|AHC_CACHETHEN_BUG|AHC_PCI_MWI_BUG;
2198 ahc->instruction_ram_size = 512;
2203 ahc_aha394X_setup(struct ahc_softc *ahc)
2207 error = ahc_aic7870_setup(ahc);
2209 error = ahc_aha394XX_setup(ahc);
2214 ahc_aha398X_setup(struct ahc_softc *ahc)
2218 error = ahc_aic7870_setup(ahc);
2220 error = ahc_aha398XX_setup(ahc);
2225 ahc_aha494X_setup(struct ahc_softc *ahc)
2229 error = ahc_aic7870_setup(ahc);
2231 error = ahc_aha494XX_setup(ahc);
2236 ahc_aic7880_setup(struct ahc_softc *ahc)
2241 pci = ahc->dev_softc;
2242 ahc->channel = 'A';
2243 ahc->chip = AHC_AIC7880;
2244 ahc->features = AHC_AIC7880_FE;
2245 ahc->bugs |= AHC_TMODE_WIDEODD_BUG;
2248 ahc->bugs |= AHC_PCI_2_1_RETRY_BUG;
2250 ahc->bugs |= AHC_CACHETHEN_BUG|AHC_PCI_MWI_BUG;
2252 ahc->instruction_ram_size = 512;
2257 ahc_aha2940Pro_setup(struct ahc_softc *ahc)
2260 ahc->flags |= AHC_INT50_SPEEDFLEX;
2261 return (ahc_aic7880_setup(ahc));
2265 ahc_aha394XU_setup(struct ahc_softc *ahc)
2269 error = ahc_aic7880_setup(ahc);
2271 error = ahc_aha394XX_setup(ahc);
2276 ahc_aha398XU_setup(struct ahc_softc *ahc)
2280 error = ahc_aic7880_setup(ahc);
2282 error = ahc_aha398XX_setup(ahc);
2287 ahc_aic7890_setup(struct ahc_softc *ahc)
2292 pci = ahc->dev_softc;
2293 ahc->channel = 'A';
2294 ahc->chip = AHC_AIC7890;
2295 ahc->features = AHC_AIC7890_FE;
2296 ahc->flags |= AHC_NEWEEPROM_FMT;
2299 ahc->bugs |= AHC_AUTOFLUSH_BUG|AHC_CACHETHEN_BUG;
2300 ahc->instruction_ram_size = 768;
2305 ahc_aic7892_setup(struct ahc_softc *ahc)
2308 ahc->channel = 'A';
2309 ahc->chip = AHC_AIC7892;
2310 ahc->features = AHC_AIC7892_FE;
2311 ahc->flags |= AHC_NEWEEPROM_FMT;
2312 ahc->bugs |= AHC_SCBCHAN_UPLOAD_BUG;
2313 ahc->instruction_ram_size = 1024;
2318 ahc_aic7895_setup(struct ahc_softc *ahc)
2323 pci = ahc->dev_softc;
2324 ahc->channel = aic_get_pci_function(pci) == 1 ? 'B' : 'A';
2330 ahc->chip = AHC_AIC7895C;
2331 ahc->features = AHC_AIC7895C_FE;
2335 ahc->chip = AHC_AIC7895;
2336 ahc->features = AHC_AIC7895_FE;
2347 ahc->bugs |= AHC_PCI_MWI_BUG;
2353 ahc->bugs |= AHC_TMODE_WIDEODD_BUG|AHC_PCI_2_1_RETRY_BUG
2368 ahc->flags |= AHC_NEWEEPROM_FMT;
2369 ahc->instruction_ram_size = 512;
2374 ahc_aic7896_setup(struct ahc_softc *ahc)
2378 pci = ahc->dev_softc;
2379 ahc->channel = aic_get_pci_function(pci) == 1 ? 'B' : 'A';
2380 ahc->chip = AHC_AIC7896;
2381 ahc->features = AHC_AIC7896_FE;
2382 ahc->flags |= AHC_NEWEEPROM_FMT;
2383 ahc->bugs |= AHC_CACHETHEN_DIS_BUG;
2384 ahc->instruction_ram_size = 768;
2389 ahc_aic7899_setup(struct ahc_softc *ahc)
2393 pci = ahc->dev_softc;
2394 ahc->channel = aic_get_pci_function(pci) == 1 ? 'B' : 'A';
2395 ahc->chip = AHC_AIC7899;
2396 ahc->features = AHC_AIC7899_FE;
2397 ahc->flags |= AHC_NEWEEPROM_FMT;
2398 ahc->bugs |= AHC_SCBCHAN_UPLOAD_BUG;
2399 ahc->instruction_ram_size = 1024;
2404 ahc_aha29160C_setup(struct ahc_softc *ahc)
2408 error = ahc_aic7899_setup(ahc);
2411 ahc->features |= AHC_REMOVABLE;
2416 ahc_raid_setup(struct ahc_softc *ahc)
2423 ahc_aha394XX_setup(struct ahc_softc *ahc)
2427 pci = ahc->dev_softc;
2430 ahc->channel = 'A';
2433 ahc->channel = 'B';
2439 ahc->channel = 'A';
2445 ahc_aha398XX_setup(struct ahc_softc *ahc)
2449 pci = ahc->dev_softc;
2452 ahc->channel = 'A';
2455 ahc->channel = 'B';
2458 ahc->channel = 'C';
2464 ahc->channel = 'A';
2467 ahc->flags |= AHC_LARGE_SEEPROM;
2472 ahc_aha494XX_setup(struct ahc_softc *ahc)
2476 pci = ahc->dev_softc;
2479 ahc->channel = 'A';
2482 ahc->channel = 'B';
2485 ahc->channel = 'C';
2488 ahc->channel = 'D';
2494 ahc->channel = 'A';
2496 ahc->flags |= AHC_LARGE_SEEPROM;