Lines Matching defs:ahc

678 static int ahc_ext_scbram_present(struct ahc_softc *ahc);
679 static void ahc_scbram_config(struct ahc_softc *ahc, int enable,
681 static void ahc_probe_ext_scbram(struct ahc_softc *ahc);
682 static void check_extport(struct ahc_softc *ahc, u_int *sxfrctl1);
683 static void ahc_parse_pci_eeprom(struct ahc_softc *ahc,
685 static void configure_termination(struct ahc_softc *ahc,
690 static void ahc_new_term_detect(struct ahc_softc *ahc,
696 static void aic787X_cable_detect(struct ahc_softc *ahc, int *internal50_present,
700 static void aic785X_cable_detect(struct ahc_softc *ahc, int *internal50_present,
703 static void write_brdctl(struct ahc_softc *ahc, uint8_t value);
704 static uint8_t read_brdctl(struct ahc_softc *ahc);
705 static void ahc_pci_intr(struct ahc_softc *ahc);
706 static int ahc_pci_chip_init(struct ahc_softc *ahc);
707 static int ahc_pci_suspend(struct ahc_softc *ahc);
708 static int ahc_pci_resume(struct ahc_softc *ahc);
786 ahc_pci_config(struct ahc_softc *ahc, struct ahc_pci_identity *entry)
798 error = entry->setup(ahc);
801 ahc->chip |= AHC_PCI;
802 ahc->description = entry->name;
804 aic_power_state_change(ahc, AIC_POWER_STATE_D0);
806 error = ahc_pci_map_registers(ahc);
816 ahc_intr_enable(ahc, FALSE);
818 devconfig = aic_pci_read_config(ahc->dev_softc, DEVCONFIG, /*bytes*/4);
826 if ((ahc->flags & AHC_39BIT_ADDRESSING) != 0) {
830 ahc_name(ahc));
837 aic_pci_write_config(ahc->dev_softc, DEVCONFIG, devconfig, /*bytes*/4);
840 command = aic_pci_read_config(ahc->dev_softc, PCIR_COMMAND, /*bytes*/2);
843 aic_pci_write_config(ahc->dev_softc, PCIR_COMMAND, command, /*bytes*/2);
846 ahc->flags |= AHC_PAGESCBS;
848 error = ahc_softc_init(ahc);
860 if ((ahc->flags & AHC_DISABLE_PCI_PERR) != 0)
861 ahc->seqctl |= FAILDIS;
863 ahc->bus_intr = ahc_pci_intr;
864 ahc->bus_chip_init = ahc_pci_chip_init;
865 ahc->bus_suspend = ahc_pci_suspend;
866 ahc->bus_resume = ahc_pci_resume;
869 if ((ahc_inb(ahc, HCNTRL) & POWRDN) == 0) {
870 ahc_pause(ahc);
871 if ((ahc->features & AHC_ULTRA2) != 0)
872 our_id = ahc_inb(ahc, SCSIID_ULTRA2) & OID;
874 our_id = ahc_inb(ahc, SCSIID) & OID;
875 sxfrctl1 = ahc_inb(ahc, SXFRCTL1) & STPWEN;
876 scsiseq = ahc_inb(ahc, SCSISEQ);
883 error = ahc_reset(ahc, /*reinit*/FALSE);
887 if ((ahc->features & AHC_DT) != 0) {
891 sfunct = ahc_inb(ahc, SFUNCT) & ~ALT_MODE;
892 ahc_outb(ahc, SFUNCT, sfunct | ALT_MODE);
893 ahc_outb(ahc, OPTIONMODE,
895 ahc_outb(ahc, SFUNCT, sfunct);
898 ahc_outb(ahc, CRCCONTROL1, CRCVALCHKEN|CRCENDCHKEN|CRCREQCHKEN
902 dscommand0 = ahc_inb(ahc, DSCOMMAND0);
904 if ((ahc->features & AHC_ULTRA2) != 0) {
917 if ((ahc->bugs & AHC_CACHETHEN_DIS_BUG) != 0)
920 if ((ahc->bugs & AHC_CACHETHEN_BUG) != 0)
923 ahc_outb(ahc, DSCOMMAND0, dscommand0);
925 ahc->pci_cachesize =
926 aic_pci_read_config(ahc->dev_softc, CSIZE_LATTIME,
928 ahc->pci_cachesize *= 4;
930 if ((ahc->bugs & AHC_PCI_2_1_RETRY_BUG) != 0
931 && ahc->pci_cachesize == 4) {
933 aic_pci_write_config(ahc->dev_softc, CSIZE_LATTIME,
935 ahc->pci_cachesize = 0;
942 if ((ahc->features & AHC_ULTRA) != 0) {
945 devconfig = aic_pci_read_config(ahc->dev_softc,
948 ahc->features &= ~AHC_ULTRA;
952 check_extport(ahc, &sxfrctl1);
957 sblkctl = ahc_inb(ahc, SBLKCTL);
958 ahc_outb(ahc, SBLKCTL, (sblkctl & ~(DIAGLEDEN|DIAGLEDON)));
960 if ((ahc->features & AHC_ULTRA2) != 0) {
961 ahc_outb(ahc, DFF_THRSH, RD_DFTHRSH_MAX|WR_DFTHRSH_MAX);
963 ahc_outb(ahc, DSPCISTATUS, DFTHRSH_100);
966 if (ahc->flags & AHC_USEDEFAULTS) {
973 if ((ahc->flags & AHC_NO_BIOS_INIT) == 0
976 ahc_name(ahc));
977 ahc->flags &= ~AHC_USEDEFAULTS;
978 ahc->flags |= AHC_BIOS_ENABLED;
987 ahc_outb(ahc, SCSICONF, our_id|ENSPCHK|RESET_SCSI);
989 ahc->our_id = our_id;
997 ahc_probe_ext_scbram(ahc);
1004 ahc->flags |= AHC_TERM_ENB_A;
1010 ahc->bus_softc.pci_softc.devconfig =
1011 aic_pci_read_config(ahc->dev_softc, DEVCONFIG, /*bytes*/4);
1012 ahc->bus_softc.pci_softc.command =
1013 aic_pci_read_config(ahc->dev_softc, PCIR_COMMAND, /*bytes*/1);
1014 ahc->bus_softc.pci_softc.csize_lattime =
1015 aic_pci_read_config(ahc->dev_softc, CSIZE_LATTIME, /*bytes*/1);
1016 ahc->bus_softc.pci_softc.dscommand0 = ahc_inb(ahc, DSCOMMAND0);
1017 ahc->bus_softc.pci_softc.dspcistatus = ahc_inb(ahc, DSPCISTATUS);
1018 if ((ahc->features & AHC_DT) != 0) {
1021 sfunct = ahc_inb(ahc, SFUNCT) & ~ALT_MODE;
1022 ahc_outb(ahc, SFUNCT, sfunct | ALT_MODE);
1023 ahc->bus_softc.pci_softc.optionmode = ahc_inb(ahc, OPTIONMODE);
1024 ahc->bus_softc.pci_softc.targcrccnt = ahc_inw(ahc, TARGCRCCNT);
1025 ahc_outb(ahc, SFUNCT, sfunct);
1026 ahc->bus_softc.pci_softc.crccontrol1 =
1027 ahc_inb(ahc, CRCCONTROL1);
1029 if ((ahc->features & AHC_MULTI_FUNC) != 0)
1030 ahc->bus_softc.pci_softc.scbbaddr = ahc_inb(ahc, SCBBADDR);
1032 if ((ahc->features & AHC_ULTRA2) != 0)
1033 ahc->bus_softc.pci_softc.dff_thrsh = ahc_inb(ahc, DFF_THRSH);
1036 error = ahc_init(ahc);
1043 error = ahc_pci_map_int(ahc);
1047 ahc_lock(ahc);
1049 * Link this softc in with all other ahc instances.
1051 ahc_softc_insert(ahc);
1052 ahc_unlock(ahc);
1061 ahc_ext_scbram_present(struct ahc_softc *ahc)
1068 chip = ahc->chip & AHC_CHIPID_MASK;
1069 devconfig = aic_pci_read_config(ahc->dev_softc,
1073 if ((ahc->features & AHC_ULTRA2) != 0)
1074 ramps = (ahc_inb(ahc, DSCOMMAND0) & RAMPS) != 0;
1097 ahc_scbram_config(struct ahc_softc *ahc, int enable, int pcheck,
1102 if (ahc->features & AHC_MULTI_FUNC) {
1107 ahc_outb(ahc, SCBBADDR, aic_get_pci_function(ahc->dev_softc));
1110 ahc->flags &= ~AHC_LSCBS_ENABLED;
1112 ahc->flags |= AHC_LSCBS_ENABLED;
1113 devconfig = aic_pci_read_config(ahc->dev_softc, DEVCONFIG, /*bytes*/4);
1114 if ((ahc->features & AHC_ULTRA2) != 0) {
1117 dscommand0 = ahc_inb(ahc, DSCOMMAND0);
1126 ahc_outb(ahc, DSCOMMAND0, dscommand0);
1146 aic_pci_write_config(ahc->dev_softc, DEVCONFIG, devconfig, /*bytes*/4);
1155 ahc_probe_ext_scbram(struct ahc_softc *ahc)
1170 if (ahc_ext_scbram_present(ahc) == 0)
1176 ahc_scbram_config(ahc, /*enable*/TRUE, pcheck, fast, large);
1177 num_scbs = ahc_probe_scbs(ahc);
1189 ahc_outb(ahc, SEQCTL, 0);
1190 ahc_outb(ahc, CLRINT, CLRPARERR);
1191 ahc_outb(ahc, CLRINT, CLRBRKADRINT);
1194 ahc_scbram_config(ahc, enable, /*pcheck*/TRUE, fast, large);
1195 num_scbs = ahc_probe_scbs(ahc);
1196 if ((ahc_inb(ahc, INTSTAT) & BRKADRINT) == 0
1197 || (ahc_inb(ahc, ERROR) & MPARERR) == 0)
1201 ahc_outb(ahc, CLRINT, CLRPARERR);
1202 ahc_outb(ahc, CLRINT, CLRBRKADRINT);
1205 ahc_scbram_config(ahc, enable, pcheck, /*fast*/TRUE, large);
1206 test_num_scbs = ahc_probe_scbs(ahc);
1208 && ((ahc_inb(ahc, INTSTAT) & BRKADRINT) == 0
1209 || (ahc_inb(ahc, ERROR) & MPARERR) == 0))
1216 if ((ahc->features & AHC_LARGE_SCBS) != 0) {
1217 ahc_scbram_config(ahc, enable, pcheck, fast, /*large*/TRUE);
1218 test_num_scbs = ahc_probe_scbs(ahc);
1229 ahc->flags |= AHC_SCB_BTT;
1238 ahc_outb(ahc, SEQCTL, PERRORDIS|FAILDIS);
1240 ahc_outb(ahc, CLRINT, CLRPARERR);
1241 ahc_outb(ahc, CLRINT, CLRBRKADRINT);
1244 ahc_name(ahc), fast ? "fast" : "slow",
1248 ahc_scbram_config(ahc, enable, pcheck, fast, large);
1256 ahc_pci_test_register_access(struct ahc_softc *ahc)
1269 cmd = aic_pci_read_config(ahc->dev_softc, PCIR_COMMAND, /*bytes*/2);
1270 aic_pci_write_config(ahc->dev_softc, PCIR_COMMAND,
1281 hcntrl = ahc_inb(ahc, HCNTRL);
1292 ahc->flags |= AHC_NO_BIOS_INIT;
1304 ahc_outb(ahc, HCNTRL, hcntrl|PAUSE);
1305 while (ahc_is_paused(ahc) == 0)
1309 status1 = aic_pci_read_config(ahc->dev_softc,
1311 aic_pci_write_config(ahc->dev_softc, PCIR_STATUS + 1,
1313 ahc_outb(ahc, CLRINT, CLRPARERR);
1315 ahc_outb(ahc, SEQCTL, PERRORDIS);
1316 ahc_outb(ahc, SCBPTR, 0);
1317 ahc_outl(ahc, SCB_BASE, 0x5aa555aa);
1318 if (ahc_inl(ahc, SCB_BASE) != 0x5aa555aa)
1321 status1 = aic_pci_read_config(ahc->dev_softc,
1330 status1 = aic_pci_read_config(ahc->dev_softc,
1332 aic_pci_write_config(ahc->dev_softc, PCIR_STATUS + 1,
1334 ahc_outb(ahc, CLRINT, CLRPARERR);
1335 ahc_outb(ahc, SEQCTL, PERRORDIS|FAILDIS);
1336 aic_pci_write_config(ahc->dev_softc, PCIR_COMMAND, cmd, /*bytes*/2);
1345 check_extport(struct ahc_softc *ahc, u_int *sxfrctl1)
1352 sd.sd_ahc = ahc;
1356 sc = ahc->seep_config;
1364 if (ahc->flags & AHC_LARGE_SEEPROM)
1376 have_seeprom = ahc_acquire_seeprom(ahc, &sd);
1380 printf("%s: Reading SEEPROM...", ahc_name(ahc));
1385 start_addr = 32 * (ahc->channel - 'A');
1409 ahc->flags |= AHC_LARGE_SEEPROM;
1420 ahc_outb(ahc, SCBPTR, 2);
1421 if (ahc_inb(ahc, SCB_BASE) == 'A'
1422 && ahc_inb(ahc, SCB_BASE + 1) == 'D'
1423 && ahc_inb(ahc, SCB_BASE + 2) == 'P'
1424 && ahc_inb(ahc, SCB_BASE + 3) == 'T') {
1433 *sc_data = ahc_inb(ahc, SRAM_BASE + j)
1434 | ahc_inb(ahc, SRAM_BASE + j + 1) << 8;
1438 ahc->flags |= AHC_SCB_CONFIG_USED;
1444 ahc_outb(ahc, CLRINT, CLRPARERR);
1445 ahc_outb(ahc, CLRINT, CLRBRKADRINT);
1450 printf("%s: No SEEPROM available.\n", ahc_name(ahc));
1451 ahc->flags |= AHC_USEDEFAULTS;
1452 free(ahc->seep_config, M_DEVBUF);
1453 ahc->seep_config = NULL;
1456 ahc_parse_pci_eeprom(ahc, sc);
1472 if ((ahc->features & AHC_SPIOCAP) != 0) {
1473 if ((ahc_inb(ahc, SPIOCAP) & SSPIOCPS) == 0)
1478 ahc->flags |= AHC_HAS_TERM_LOGIC;
1479 ahc_acquire_seeprom(ahc, &sd);
1480 configure_termination(ahc, &sd, sc->adapter_control, sxfrctl1);
1488 ahc_name(ahc),
1494 ahc_parse_pci_eeprom(struct ahc_softc *ahc, struct seeprom_config *sc)
1515 ahc->flags |= AHC_NEWEEPROM_FMT;
1528 if ((ahc->flags & AHC_NEWEEPROM_FMT) != 0) {
1540 if ((ahc->features & AHC_ULTRA2) != 0) {
1547 ahc_outb(ahc, TARG_OFFSET + i, offset);
1565 ahc_outb(ahc, TARG_SCSIRATE + i, scsirate);
1567 ahc->our_id = sc->brtime_id & CFSCSIID;
1569 scsi_conf = (ahc->our_id & 0x7);
1575 ahc->flags |= (sc->adapter_control & CFBOOTCHAN) >> CFBOOTCHANSHIFT;
1578 ahc->flags |= AHC_EXTENDED_TRANS_A;
1581 ahc->flags |= AHC_BIOS_ENABLED;
1582 if (ahc->features & AHC_ULTRA
1583 && (ahc->flags & AHC_NEWEEPROM_FMT) == 0) {
1595 devconfig = aic_pci_read_config(ahc->dev_softc,
1600 aic_pci_write_config(ahc->dev_softc, DEVCONFIG,
1604 ahc_outb(ahc, SCSICONF, scsi_conf);
1605 ahc_outb(ahc, DISC_DSB, ~(discenable & 0xff));
1606 ahc_outb(ahc, DISC_DSB + 1, ~((discenable >> 8) & 0xff));
1607 ahc_outb(ahc, ULTRA_ENB, ultraenb & 0xff);
1608 ahc_outb(ahc, ULTRA_ENB + 1, (ultraenb >> 8) & 0xff);
1612 configure_termination(struct ahc_softc *ahc,
1634 || (ahc->features & AHC_NEW_TERMCTL) != 0) {
1649 if ((ahc->features & AHC_NEW_TERMCTL) != 0) {
1650 ahc_new_term_detect(ahc, &enableSEC_low,
1658 ahc_name(ahc));
1666 ahc_name(ahc));
1674 } else if ((ahc->features & AHC_SPIOCAP) != 0) {
1675 aic785X_cable_detect(ahc, &internal50_present,
1681 aic787X_cable_detect(ahc, &internal50_present,
1687 if ((ahc->features & AHC_WIDE) == 0)
1691 && (ahc->features & AHC_ULTRA2) == 0) {
1693 ahc_name(ahc),
1696 if ((ahc->features & AHC_WIDE) != 0)
1700 ahc_name(ahc),
1705 ahc_name(ahc), eeprom_present ? "is" : "not");
1707 if ((ahc->flags & AHC_INT50_SPEEDFLEX) != 0) {
1726 if ((ahc->features & AHC_ULTRA2) == 0
1733 "time!\n", ahc_name(ahc));
1745 if ((ahc->features & AHC_WIDE) != 0
1751 if ((ahc->flags & AHC_INT50_SPEEDFLEX) != 0)
1753 "Enabled\n", ahc_name(ahc));
1756 "Enabled\n", ahc_name(ahc),
1765 if ((ahc->features & AHC_ULTRA2) != 0)
1770 if ((ahc->flags & AHC_INT50_SPEEDFLEX) != 0)
1772 "Enabled\n", ahc_name(ahc));
1775 "Enabled\n", ahc_name(ahc),
1785 "Enabled\n", ahc_name(ahc));
1792 ahc_outb(ahc, SXFRCTL1, *sxfrctl1);
1799 ahc_name(ahc));
1802 write_brdctl(ahc, brddat);
1810 ahc_name(ahc),
1811 (ahc->features & AHC_ULTRA2) ? "Primary "
1816 && (ahc->features & AHC_WIDE) != 0) {
1820 ahc_name(ahc),
1821 (ahc->features & AHC_ULTRA2)
1829 ahc_outb(ahc, SXFRCTL1, *sxfrctl1);
1831 if ((ahc->features & AHC_WIDE) != 0)
1832 write_brdctl(ahc, brddat);
1838 ahc_new_term_detect(struct ahc_softc *ahc, int *enableSEC_low,
1851 brdctl = read_brdctl(ahc);
1860 aic787X_cable_detect(struct ahc_softc *ahc, int *internal50_present,
1873 write_brdctl(ahc, 0);
1880 brdctl = read_brdctl(ahc);
1888 write_brdctl(ahc, BRDDAT5);
1895 brdctl = read_brdctl(ahc);
1901 aic785X_cable_detect(struct ahc_softc *ahc, int *internal50_present,
1907 spiocap = ahc_inb(ahc, SPIOCAP);
1910 ahc_outb(ahc, SPIOCAP, spiocap);
1911 ahc_outb(ahc, BRDCTL, BRDRW|BRDCS);
1912 ahc_flush_device_writes(ahc);
1914 ahc_outb(ahc, BRDCTL, 0);
1915 ahc_flush_device_writes(ahc);
1917 brdctl = ahc_inb(ahc, BRDCTL);
1920 *eeprom_present = (ahc_inb(ahc, SPIOCAP) & EEPROM) ? 1 : 0;
1924 ahc_acquire_seeprom(struct ahc_softc *ahc, struct seeprom_descriptor *sd)
1928 if ((ahc->features & AHC_SPIOCAP) != 0
1929 && (ahc_inb(ahc, SPIOCAP) & SEEPROM) == 0)
1959 write_brdctl(struct ahc_softc *ahc, uint8_t value)
1963 if ((ahc->chip & AHC_CHIPID_MASK) == AHC_AIC7895) {
1965 if (ahc->channel == 'B')
1967 } else if ((ahc->features & AHC_ULTRA2) != 0) {
1972 ahc_outb(ahc, BRDCTL, brdctl);
1973 ahc_flush_device_writes(ahc);
1975 ahc_outb(ahc, BRDCTL, brdctl);
1976 ahc_flush_device_writes(ahc);
1977 if ((ahc->features & AHC_ULTRA2) != 0)
1981 ahc_outb(ahc, BRDCTL, brdctl);
1982 ahc_flush_device_writes(ahc);
1983 if ((ahc->features & AHC_ULTRA2) != 0)
1987 ahc_outb(ahc, BRDCTL, brdctl);
1991 read_brdctl(struct ahc_softc *ahc)
1996 if ((ahc->chip & AHC_CHIPID_MASK) == AHC_AIC7895) {
1998 if (ahc->channel == 'B')
2000 } else if ((ahc->features & AHC_ULTRA2) != 0) {
2005 ahc_outb(ahc, BRDCTL, brdctl);
2006 ahc_flush_device_writes(ahc);
2007 value = ahc_inb(ahc, BRDCTL);
2008 ahc_outb(ahc, BRDCTL, 0);
2013 ahc_pci_intr(struct ahc_softc *ahc)
2018 error = ahc_inb(ahc, ERROR);
2022 status1 = aic_pci_read_config(ahc->dev_softc,
2026 || (ahc->flags & AHC_DISABLE_PCI_PERR) == 0) {
2028 ahc_name(ahc),
2029 ahc_inb(ahc, SEQADDR0) | (ahc_inb(ahc, SEQADDR1) << 8));
2033 && (ahc->flags & AHC_DISABLE_PCI_PERR) == 0) {
2034 ahc->pci_target_perr_count++;
2036 "or write data phase\n", ahc_name(ahc));
2039 printf("%s: Signal System Error Detected\n", ahc_name(ahc));
2042 printf("%s: Received a Master Abort\n", ahc_name(ahc));
2045 printf("%s: Received a Target Abort\n", ahc_name(ahc));
2048 printf("%s: Signaled a Target Abort\n", ahc_name(ahc));
2052 ahc_name(ahc));
2056 aic_pci_write_config(ahc->dev_softc, PCIR_STATUS + 1,
2061 "no status bits set\n", ahc_name(ahc));
2063 ahc_outb(ahc, CLRINT, CLRPARERR);
2066 if (ahc->pci_target_perr_count > AHC_PCI_TARGET_PERR_THRESH
2067 && (ahc->flags & AHC_DISABLE_PCI_PERR) == 0) {
2075 ahc_name(ahc), ahc_name(ahc), ahc_name(ahc),
2076 ahc_name(ahc), ahc_name(ahc), ahc_name(ahc),
2077 ahc_name(ahc));
2078 ahc->seqctl |= FAILDIS;
2079 ahc->flags |= AHC_DISABLE_PCI_PERR;
2080 ahc_outb(ahc, SEQCTL, ahc->seqctl);
2082 ahc_unpause(ahc);
2086 ahc_pci_chip_init(struct ahc_softc *ahc)
2088 ahc_outb(ahc, DSCOMMAND0, ahc->bus_softc.pci_softc.dscommand0);
2089 ahc_outb(ahc, DSPCISTATUS, ahc->bus_softc.pci_softc.dspcistatus);
2090 if ((ahc->features & AHC_DT) != 0) {
2093 sfunct = ahc_inb(ahc, SFUNCT) & ~ALT_MODE;
2094 ahc_outb(ahc, SFUNCT, sfunct | ALT_MODE);
2095 ahc_outb(ahc, OPTIONMODE, ahc->bus_softc.pci_softc.optionmode);
2096 ahc_outw(ahc, TARGCRCCNT, ahc->bus_softc.pci_softc.targcrccnt);
2097 ahc_outb(ahc, SFUNCT, sfunct);
2098 ahc_outb(ahc, CRCCONTROL1,
2099 ahc->bus_softc.pci_softc.crccontrol1);
2101 if ((ahc->features & AHC_MULTI_FUNC) != 0)
2102 ahc_outb(ahc, SCBBADDR, ahc->bus_softc.pci_softc.scbbaddr);
2104 if ((ahc->features & AHC_ULTRA2) != 0)
2105 ahc_outb(ahc, DFF_THRSH, ahc->bus_softc.pci_softc.dff_thrsh);
2107 return (ahc_chip_init(ahc));
2111 ahc_pci_suspend(struct ahc_softc *ahc)
2113 return (ahc_suspend(ahc));
2117 ahc_pci_resume(struct ahc_softc *ahc)
2120 aic_power_state_change(ahc, AIC_POWER_STATE_D0);
2128 aic_pci_write_config(ahc->dev_softc, DEVCONFIG,
2129 ahc->bus_softc.pci_softc.devconfig, /*bytes*/4);
2130 aic_pci_write_config(ahc->dev_softc, PCIR_COMMAND,
2131 ahc->bus_softc.pci_softc.command, /*bytes*/1);
2132 aic_pci_write_config(ahc->dev_softc, CSIZE_LATTIME,
2133 ahc->bus_softc.pci_softc.csize_lattime,
2135 if ((ahc->flags & AHC_HAS_TERM_LOGIC) != 0) {
2139 sd.sd_ahc = ahc;
2144 ahc_acquire_seeprom(ahc, &sd);
2145 configure_termination(ahc, &sd,
2146 ahc->seep_config->adapter_control,
2150 return (ahc_resume(ahc));
2154 ahc_aic785X_setup(struct ahc_softc *ahc)
2159 pci = ahc->dev_softc;
2160 ahc->channel = 'A';
2161 ahc->chip = AHC_AIC7850;
2162 ahc->features = AHC_AIC7850_FE;
2163 ahc->bugs |= AHC_TMODE_WIDEODD_BUG|AHC_CACHETHEN_BUG|AHC_PCI_MWI_BUG;
2166 ahc->bugs |= AHC_PCI_2_1_RETRY_BUG;
2167 ahc->instruction_ram_size = 512;
2172 ahc_aic7860_setup(struct ahc_softc *ahc)
2177 pci = ahc->dev_softc;
2178 ahc->channel = 'A';
2179 ahc->chip = AHC_AIC7860;
2180 ahc->features = AHC_AIC7860_FE;
2181 ahc->bugs |= AHC_TMODE_WIDEODD_BUG|AHC_CACHETHEN_BUG|AHC_PCI_MWI_BUG;
2184 ahc->bugs |= AHC_PCI_2_1_RETRY_BUG;
2185 ahc->instruction_ram_size = 512;
2190 ahc_apa1480_setup(struct ahc_softc *ahc)
2194 error = ahc_aic7860_setup(ahc);
2197 ahc->features |= AHC_REMOVABLE;
2202 ahc_aic7870_setup(struct ahc_softc *ahc)
2205 ahc->channel = 'A';
2206 ahc->chip = AHC_AIC7870;
2207 ahc->features = AHC_AIC7870_FE;
2208 ahc->bugs |= AHC_TMODE_WIDEODD_BUG|AHC_CACHETHEN_BUG|AHC_PCI_MWI_BUG;
2209 ahc->instruction_ram_size = 512;
2214 ahc_aha394X_setup(struct ahc_softc *ahc)
2218 error = ahc_aic7870_setup(ahc);
2220 error = ahc_aha394XX_setup(ahc);
2225 ahc_aha398X_setup(struct ahc_softc *ahc)
2229 error = ahc_aic7870_setup(ahc);
2231 error = ahc_aha398XX_setup(ahc);
2236 ahc_aha494X_setup(struct ahc_softc *ahc)
2240 error = ahc_aic7870_setup(ahc);
2242 error = ahc_aha494XX_setup(ahc);
2247 ahc_aic7880_setup(struct ahc_softc *ahc)
2252 pci = ahc->dev_softc;
2253 ahc->channel = 'A';
2254 ahc->chip = AHC_AIC7880;
2255 ahc->features = AHC_AIC7880_FE;
2256 ahc->bugs |= AHC_TMODE_WIDEODD_BUG;
2259 ahc->bugs |= AHC_PCI_2_1_RETRY_BUG;
2261 ahc->bugs |= AHC_CACHETHEN_BUG|AHC_PCI_MWI_BUG;
2263 ahc->instruction_ram_size = 512;
2268 ahc_aha2940Pro_setup(struct ahc_softc *ahc)
2271 ahc->flags |= AHC_INT50_SPEEDFLEX;
2272 return (ahc_aic7880_setup(ahc));
2276 ahc_aha394XU_setup(struct ahc_softc *ahc)
2280 error = ahc_aic7880_setup(ahc);
2282 error = ahc_aha394XX_setup(ahc);
2287 ahc_aha398XU_setup(struct ahc_softc *ahc)
2291 error = ahc_aic7880_setup(ahc);
2293 error = ahc_aha398XX_setup(ahc);
2298 ahc_aic7890_setup(struct ahc_softc *ahc)
2303 pci = ahc->dev_softc;
2304 ahc->channel = 'A';
2305 ahc->chip = AHC_AIC7890;
2306 ahc->features = AHC_AIC7890_FE;
2307 ahc->flags |= AHC_NEWEEPROM_FMT;
2310 ahc->bugs |= AHC_AUTOFLUSH_BUG|AHC_CACHETHEN_BUG;
2311 ahc->instruction_ram_size = 768;
2316 ahc_aic7892_setup(struct ahc_softc *ahc)
2319 ahc->channel = 'A';
2320 ahc->chip = AHC_AIC7892;
2321 ahc->features = AHC_AIC7892_FE;
2322 ahc->flags |= AHC_NEWEEPROM_FMT;
2323 ahc->bugs |= AHC_SCBCHAN_UPLOAD_BUG;
2324 ahc->instruction_ram_size = 1024;
2329 ahc_aic7895_setup(struct ahc_softc *ahc)
2334 pci = ahc->dev_softc;
2335 ahc->channel = aic_get_pci_function(pci) == 1 ? 'B' : 'A';
2341 ahc->chip = AHC_AIC7895C;
2342 ahc->features = AHC_AIC7895C_FE;
2346 ahc->chip = AHC_AIC7895;
2347 ahc->features = AHC_AIC7895_FE;
2358 ahc->bugs |= AHC_PCI_MWI_BUG;
2364 ahc->bugs |= AHC_TMODE_WIDEODD_BUG|AHC_PCI_2_1_RETRY_BUG
2379 ahc->flags |= AHC_NEWEEPROM_FMT;
2380 ahc->instruction_ram_size = 512;
2385 ahc_aic7896_setup(struct ahc_softc *ahc)
2389 pci = ahc->dev_softc;
2390 ahc->channel = aic_get_pci_function(pci) == 1 ? 'B' : 'A';
2391 ahc->chip = AHC_AIC7896;
2392 ahc->features = AHC_AIC7896_FE;
2393 ahc->flags |= AHC_NEWEEPROM_FMT;
2394 ahc->bugs |= AHC_CACHETHEN_DIS_BUG;
2395 ahc->instruction_ram_size = 768;
2400 ahc_aic7899_setup(struct ahc_softc *ahc)
2404 pci = ahc->dev_softc;
2405 ahc->channel = aic_get_pci_function(pci) == 1 ? 'B' : 'A';
2406 ahc->chip = AHC_AIC7899;
2407 ahc->features = AHC_AIC7899_FE;
2408 ahc->flags |= AHC_NEWEEPROM_FMT;
2409 ahc->bugs |= AHC_SCBCHAN_UPLOAD_BUG;
2410 ahc->instruction_ram_size = 1024;
2415 ahc_aha29160C_setup(struct ahc_softc *ahc)
2419 error = ahc_aic7899_setup(ahc);
2422 ahc->features |= AHC_REMOVABLE;
2427 ahc_raid_setup(struct ahc_softc *ahc)
2434 ahc_aha394XX_setup(struct ahc_softc *ahc)
2438 pci = ahc->dev_softc;
2441 ahc->channel = 'A';
2444 ahc->channel = 'B';
2450 ahc->channel = 'A';
2456 ahc_aha398XX_setup(struct ahc_softc *ahc)
2460 pci = ahc->dev_softc;
2463 ahc->channel = 'A';
2466 ahc->channel = 'B';
2469 ahc->channel = 'C';
2475 ahc->channel = 'A';
2478 ahc->flags |= AHC_LARGE_SEEPROM;
2483 ahc_aha494XX_setup(struct ahc_softc *ahc)
2487 pci = ahc->dev_softc;
2490 ahc->channel = 'A';
2493 ahc->channel = 'B';
2496 ahc->channel = 'C';
2499 ahc->channel = 'D';
2505 ahc->channel = 'A';
2507 ahc->flags |= AHC_LARGE_SEEPROM;