Lines Matching +full:aac +full:- +full:mode
1 /*-
6 * SPDX-License-Identifier: BSD-3-Clause
8 * Copyright (c) 1994-2001 Justin T. Gibbs.
9 * Copyright (c) 2000-2001 Adaptec Inc.
23 * 3. Neither the names of the above-listed copyright holders nor the names
372 /* Ignore all SISL (AAC on MB) based controllers. */
419 "Adaptec AAA-131 Ultra2 RAID adapter",
768 if (entry->full_id == (full_id & entry->id_mask)) {
770 if (entry->name == NULL)
791 error = entry->setup(ahc);
794 ahc->chip |= AHC_PCI;
795 ahc->description = entry->name;
811 devconfig = aic_pci_read_config(ahc->dev_softc, DEVCONFIG, /*bytes*/4);
819 if ((ahc->flags & AHC_39BIT_ADDRESSING) != 0) {
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;
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;
863 if ((ahc->features & AHC_ULTRA2) != 0)
879 if ((ahc->features & AHC_DT) != 0) {
882 /* Perform ALT-Mode Setup */
889 /* Normal mode setup */
896 if ((ahc->features & AHC_ULTRA2) != 0) {
908 if ((ahc->bugs & AHC_CACHETHEN_DIS_BUG) != 0)
911 if ((ahc->bugs & AHC_CACHETHEN_BUG) != 0)
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;
941 /* See if we have a SEEPROM and perform auto-term */
945 * Take the LED out of diagnostic mode
950 if ((ahc->features & AHC_ULTRA2) != 0) {
956 if (ahc->flags & AHC_USEDEFAULTS) {
963 if ((ahc->flags & AHC_NO_BIOS_INIT) == 0
967 ahc->flags &= ~AHC_USEDEFAULTS;
968 ahc->flags |= AHC_BIOS_ENABLED;
979 ahc->our_id = our_id;
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) {
1013 ahc->bus_softc.pci_softc.optionmode = ahc_inb(ahc, OPTIONMODE);
1014 ahc->bus_softc.pci_softc.targcrccnt = ahc_inw(ahc, TARGCRCCNT);
1016 ahc->bus_softc.pci_softc.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);
1058 chip = ahc->chip & AHC_CHIPID_MASK;
1059 devconfig = aic_pci_read_config(ahc->dev_softc,
1063 if ((ahc->features & AHC_ULTRA2) != 0)
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) {
1136 aic_pci_write_config(ahc->dev_softc, DEVCONFIG, devconfig, /*bytes*/4);
1206 if ((ahc->features & AHC_LARGE_SCBS) != 0) {
1219 ahc->flags |= AHC_SCB_BTT;
1259 cmd = aic_pci_read_config(ahc->dev_softc, PCIR_COMMAND, /*bytes*/2);
1260 aic_pci_write_config(ahc->dev_softc, PCIR_COMMAND,
1282 ahc->flags |= AHC_NO_BIOS_INIT;
1299 status1 = aic_pci_read_config(ahc->dev_softc,
1301 aic_pci_write_config(ahc->dev_softc, PCIR_STATUS + 1,
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,
1326 aic_pci_write_config(ahc->dev_softc, PCIR_COMMAND, cmd, /*bytes*/2);
1346 sc = ahc->seep_config;
1349 * For some multi-channel devices, the c46 is simply too
1354 if (ahc->flags & AHC_LARGE_SEEPROM)
1374 start_addr = 32 * (ahc->channel - 'A');
1398 ahc->flags |= AHC_LARGE_SEEPROM;
1427 ahc->flags |= AHC_SCB_CONFIG_USED;
1440 ahc->flags |= AHC_USEDEFAULTS;
1441 free(ahc->seep_config, M_DEVBUF);
1442 ahc->seep_config = NULL;
1451 * necessary for auto-termination control. This assumption
1457 * Some low-cost chips have SEEPROM and auto-term control built
1461 if ((ahc->features & AHC_SPIOCAP) != 0) {
1467 ahc->flags |= AHC_HAS_TERM_LOGIC;
1469 configure_termination(ahc, &sd, sc->adapter_control, sxfrctl1);
1473 if ((sc->adapter_control & CFSTERM) != 0)
1490 int max_targ = sc->max_targets & CFMAXTARG;
1497 if ((sc->adapter_control & CFULTRAEN) != 0) {
1503 if ((sc->device_flags[i] & CFSYNCHISULTRA) != 0) {
1504 ahc->flags |= AHC_NEWEEPROM_FMT;
1515 if (sc->device_flags[i] & CFDISC)
1517 if ((ahc->flags & AHC_NEWEEPROM_FMT) != 0) {
1518 if ((sc->device_flags[i] & CFSYNCHISULTRA) != 0)
1520 } else if ((sc->adapter_control & CFULTRAEN) != 0) {
1523 if ((sc->device_flags[i] & CFXFER) == 0x04
1525 /* Treat 10MHz as a non-ultra speed */
1526 sc->device_flags[i] &= ~CFXFER;
1529 if ((ahc->features & AHC_ULTRA2) != 0) {
1532 if (sc->device_flags[i] & CFSYNCH)
1543 scsirate = (sc->device_flags[i] & CFXFER)
1545 if (sc->device_flags[i] & CFWIDEB)
1548 scsirate = (sc->device_flags[i] & CFXFER) << 4;
1549 if (sc->device_flags[i] & CFSYNCH)
1551 if (sc->device_flags[i] & CFWIDEB)
1556 ahc->our_id = sc->brtime_id & CFSCSIID;
1558 scsi_conf = (ahc->our_id & 0x7);
1559 if (sc->adapter_control & CFSPARITY)
1561 if (sc->adapter_control & CFRESETB)
1564 ahc->flags |= (sc->adapter_control & CFBOOTCHAN) >> CFBOOTCHANSHIFT;
1566 if (sc->bios_control & CFEXTEND)
1567 ahc->flags |= AHC_EXTENDED_TRANS_A;
1569 if (sc->bios_control & CFBIOSEN)
1570 ahc->flags |= AHC_BIOS_ENABLED;
1571 if (ahc->features & AHC_ULTRA
1572 && (ahc->flags & AHC_NEWEEPROM_FMT) == 0) {
1573 /* Should we enable Ultra mode? */
1574 if (!(sc->adapter_control & CFULTRAEN))
1575 /* Treat us as a non-ultra card */
1579 if (sc->signature == CFSIGNATURE
1580 || sc->signature == CFSIGNATURE2) {
1584 devconfig = aic_pci_read_config(ahc->dev_softc,
1587 if ((sc->bios_control & CFSTPWLEVEL) != 0)
1589 aic_pci_write_config(ahc->dev_softc, DEVCONFIG,
1621 SEEPROM_OUTB(sd, sd->sd_MS | sd->sd_CS);
1623 || (ahc->features & AHC_NEW_TERMCTL) != 0) {
1638 if ((ahc->features & AHC_NEW_TERMCTL) != 0) {
1663 } else if ((ahc->features & AHC_SPIOCAP) != 0) {
1676 if ((ahc->features & AHC_WIDE) == 0)
1680 && (ahc->features & AHC_ULTRA2) == 0) {
1685 if ((ahc->features & AHC_WIDE) != 0)
1696 if ((ahc->flags & AHC_INT50_SPEEDFLEX) != 0) {
1715 if ((ahc->features & AHC_ULTRA2) == 0
1734 if ((ahc->features & AHC_WIDE) != 0
1740 if ((ahc->flags & AHC_INT50_SPEEDFLEX) != 0)
1754 if ((ahc->features & AHC_ULTRA2) != 0)
1759 if ((ahc->flags & AHC_INT50_SPEEDFLEX) != 0)
1800 (ahc->features & AHC_ULTRA2) ? "Primary "
1805 && (ahc->features & AHC_WIDE) != 0) {
1810 (ahc->features & AHC_ULTRA2)
1820 if ((ahc->features & AHC_WIDE) != 0)
1823 SEEPROM_OUTB(sd, sd->sd_MS); /* Clear CS */
1917 if ((ahc->features & AHC_SPIOCAP) != 0
1928 SEEPROM_OUTB(sd, sd->sd_MS);
1930 while (--wait && ((SEEPROM_STATUS_INB(sd) & sd->sd_RDY) == 0)) {
1933 if ((SEEPROM_STATUS_INB(sd) & sd->sd_RDY) == 0) {
1952 if ((ahc->chip & AHC_CHIPID_MASK) == AHC_AIC7895) {
1954 if (ahc->channel == 'B')
1956 } else if ((ahc->features & AHC_ULTRA2) != 0) {
1966 if ((ahc->features & AHC_ULTRA2) != 0)
1972 if ((ahc->features & AHC_ULTRA2) != 0)
1985 if ((ahc->chip & AHC_CHIPID_MASK) == AHC_AIC7895) {
1987 if (ahc->channel == 'B')
1989 } else if ((ahc->features & AHC_ULTRA2) != 0) {
2011 status1 = aic_pci_read_config(ahc->dev_softc,
2015 || (ahc->flags & AHC_DISABLE_PCI_PERR) == 0) {
2022 && (ahc->flags & AHC_DISABLE_PCI_PERR) == 0) {
2023 ahc->pci_target_perr_count++;
2045 aic_pci_write_config(ahc->dev_softc, PCIR_STATUS + 1,
2055 if (ahc->pci_target_perr_count > AHC_PCI_TARGET_PERR_THRESH
2056 && (ahc->flags & AHC_DISABLE_PCI_PERR) == 0) {
2067 ahc->seqctl |= FAILDIS;
2068 ahc->flags |= AHC_DISABLE_PCI_PERR;
2069 ahc_outb(ahc, SEQCTL, ahc->seqctl);
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) {
2084 ahc_outb(ahc, OPTIONMODE, ahc->bus_softc.pci_softc.optionmode);
2085 ahc_outw(ahc, TARGCRCCNT, ahc->bus_softc.pci_softc.targcrccnt);
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);
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) {
2135 ahc->seep_config->adapter_control,
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;
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;
2186 ahc->features |= AHC_REMOVABLE;
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;
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;
2260 ahc->flags |= AHC_INT50_SPEEDFLEX;
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;
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;
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;
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;
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;
2411 ahc->features |= AHC_REMOVABLE;
2427 pci = ahc->dev_softc;
2430 ahc->channel = 'A';
2433 ahc->channel = 'B';
2439 ahc->channel = 'A';
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;
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;