Lines Matching refs:ahc
599 static int ahc_ext_scbram_present(struct ahc_softc *ahc);
600 static void ahc_scbram_config(struct ahc_softc *ahc, int enable,
602 static void ahc_probe_ext_scbram(struct ahc_softc *ahc);
603 static void check_extport(struct ahc_softc *ahc, u_int *sxfrctl1);
604 static void ahc_parse_pci_eeprom(struct ahc_softc *ahc,
606 static void configure_termination(struct ahc_softc *ahc,
611 static void ahc_new_term_detect(struct ahc_softc *ahc,
617 static void aic787X_cable_detect(struct ahc_softc *ahc, int *internal50_present,
621 static void aic785X_cable_detect(struct ahc_softc *ahc, int *internal50_present,
624 static void write_brdctl(struct ahc_softc *ahc, uint8_t value);
625 static uint8_t read_brdctl(struct ahc_softc *ahc);
626 static void ahc_pci_intr(struct ahc_softc *ahc);
627 static int ahc_pci_chip_init(struct ahc_softc *ahc);
705 ahc_pci_config(struct ahc_softc *ahc, const struct ahc_pci_identity *entry) in ahc_pci_config() argument
717 error = entry->setup(ahc); in ahc_pci_config()
720 ahc->chip |= AHC_PCI; in ahc_pci_config()
721 ahc->description = entry->name; in ahc_pci_config()
723 pci_set_power_state(ahc->dev_softc, AHC_POWER_STATE_D0); in ahc_pci_config()
725 error = ahc_pci_map_registers(ahc); in ahc_pci_config()
735 ahc_intr_enable(ahc, FALSE); in ahc_pci_config()
737 devconfig = ahc_pci_read_config(ahc->dev_softc, DEVCONFIG, /*bytes*/4); in ahc_pci_config()
745 if ((ahc->flags & AHC_39BIT_ADDRESSING) != 0) { in ahc_pci_config()
749 ahc_name(ahc)); in ahc_pci_config()
756 ahc_pci_write_config(ahc->dev_softc, DEVCONFIG, devconfig, /*bytes*/4); in ahc_pci_config()
759 command = ahc_pci_read_config(ahc->dev_softc, PCIR_COMMAND, /*bytes*/2); in ahc_pci_config()
762 ahc_pci_write_config(ahc->dev_softc, PCIR_COMMAND, command, /*bytes*/2); in ahc_pci_config()
765 ahc->flags |= AHC_PAGESCBS; in ahc_pci_config()
767 error = ahc_softc_init(ahc); in ahc_pci_config()
779 if ((ahc->flags & AHC_DISABLE_PCI_PERR) != 0) in ahc_pci_config()
780 ahc->seqctl |= FAILDIS; in ahc_pci_config()
782 ahc->bus_intr = ahc_pci_intr; in ahc_pci_config()
783 ahc->bus_chip_init = ahc_pci_chip_init; in ahc_pci_config()
786 if ((ahc_inb(ahc, HCNTRL) & POWRDN) == 0) { in ahc_pci_config()
787 ahc_pause(ahc); in ahc_pci_config()
788 if ((ahc->features & AHC_ULTRA2) != 0) in ahc_pci_config()
789 our_id = ahc_inb(ahc, SCSIID_ULTRA2) & OID; in ahc_pci_config()
791 our_id = ahc_inb(ahc, SCSIID) & OID; in ahc_pci_config()
792 sxfrctl1 = ahc_inb(ahc, SXFRCTL1) & STPWEN; in ahc_pci_config()
793 scsiseq = ahc_inb(ahc, SCSISEQ); in ahc_pci_config()
800 error = ahc_reset(ahc, /*reinit*/FALSE); in ahc_pci_config()
804 if ((ahc->features & AHC_DT) != 0) { in ahc_pci_config()
808 sfunct = ahc_inb(ahc, SFUNCT) & ~ALT_MODE; in ahc_pci_config()
809 ahc_outb(ahc, SFUNCT, sfunct | ALT_MODE); in ahc_pci_config()
810 ahc_outb(ahc, OPTIONMODE, in ahc_pci_config()
812 ahc_outb(ahc, SFUNCT, sfunct); in ahc_pci_config()
815 ahc_outb(ahc, CRCCONTROL1, CRCVALCHKEN|CRCENDCHKEN|CRCREQCHKEN in ahc_pci_config()
819 dscommand0 = ahc_inb(ahc, DSCOMMAND0); in ahc_pci_config()
821 if ((ahc->features & AHC_ULTRA2) != 0) { in ahc_pci_config()
834 if ((ahc->bugs & AHC_CACHETHEN_DIS_BUG) != 0) in ahc_pci_config()
837 if ((ahc->bugs & AHC_CACHETHEN_BUG) != 0) in ahc_pci_config()
840 ahc_outb(ahc, DSCOMMAND0, dscommand0); in ahc_pci_config()
842 ahc->pci_cachesize = in ahc_pci_config()
843 ahc_pci_read_config(ahc->dev_softc, CSIZE_LATTIME, in ahc_pci_config()
845 ahc->pci_cachesize *= 4; in ahc_pci_config()
847 if ((ahc->bugs & AHC_PCI_2_1_RETRY_BUG) != 0 in ahc_pci_config()
848 && ahc->pci_cachesize == 4) { in ahc_pci_config()
850 ahc_pci_write_config(ahc->dev_softc, CSIZE_LATTIME, in ahc_pci_config()
852 ahc->pci_cachesize = 0; in ahc_pci_config()
859 if ((ahc->features & AHC_ULTRA) != 0) { in ahc_pci_config()
862 devconfig = ahc_pci_read_config(ahc->dev_softc, in ahc_pci_config()
865 ahc->features &= ~AHC_ULTRA; in ahc_pci_config()
869 check_extport(ahc, &sxfrctl1); in ahc_pci_config()
874 sblkctl = ahc_inb(ahc, SBLKCTL); in ahc_pci_config()
875 ahc_outb(ahc, SBLKCTL, (sblkctl & ~(DIAGLEDEN|DIAGLEDON))); in ahc_pci_config()
877 if ((ahc->features & AHC_ULTRA2) != 0) { in ahc_pci_config()
878 ahc_outb(ahc, DFF_THRSH, RD_DFTHRSH_MAX|WR_DFTHRSH_MAX); in ahc_pci_config()
880 ahc_outb(ahc, DSPCISTATUS, DFTHRSH_100); in ahc_pci_config()
883 if (ahc->flags & AHC_USEDEFAULTS) { in ahc_pci_config()
890 if ((ahc->flags & AHC_NO_BIOS_INIT) == 0 in ahc_pci_config()
893 ahc_name(ahc)); in ahc_pci_config()
894 ahc->flags &= ~AHC_USEDEFAULTS; in ahc_pci_config()
895 ahc->flags |= AHC_BIOS_ENABLED; in ahc_pci_config()
904 ahc_outb(ahc, SCSICONF, our_id|ENSPCHK|RESET_SCSI); in ahc_pci_config()
906 ahc->our_id = our_id; in ahc_pci_config()
914 ahc_probe_ext_scbram(ahc); in ahc_pci_config()
921 ahc->flags |= AHC_TERM_ENB_A; in ahc_pci_config()
927 ahc->bus_softc.pci_softc.devconfig = in ahc_pci_config()
928 ahc_pci_read_config(ahc->dev_softc, DEVCONFIG, /*bytes*/4); in ahc_pci_config()
929 ahc->bus_softc.pci_softc.command = in ahc_pci_config()
930 ahc_pci_read_config(ahc->dev_softc, PCIR_COMMAND, /*bytes*/1); in ahc_pci_config()
931 ahc->bus_softc.pci_softc.csize_lattime = in ahc_pci_config()
932 ahc_pci_read_config(ahc->dev_softc, CSIZE_LATTIME, /*bytes*/1); in ahc_pci_config()
933 ahc->bus_softc.pci_softc.dscommand0 = ahc_inb(ahc, DSCOMMAND0); in ahc_pci_config()
934 ahc->bus_softc.pci_softc.dspcistatus = ahc_inb(ahc, DSPCISTATUS); in ahc_pci_config()
935 if ((ahc->features & AHC_DT) != 0) { in ahc_pci_config()
938 sfunct = ahc_inb(ahc, SFUNCT) & ~ALT_MODE; in ahc_pci_config()
939 ahc_outb(ahc, SFUNCT, sfunct | ALT_MODE); in ahc_pci_config()
940 ahc->bus_softc.pci_softc.optionmode = ahc_inb(ahc, OPTIONMODE); in ahc_pci_config()
941 ahc->bus_softc.pci_softc.targcrccnt = ahc_inw(ahc, TARGCRCCNT); in ahc_pci_config()
942 ahc_outb(ahc, SFUNCT, sfunct); in ahc_pci_config()
943 ahc->bus_softc.pci_softc.crccontrol1 = in ahc_pci_config()
944 ahc_inb(ahc, CRCCONTROL1); in ahc_pci_config()
946 if ((ahc->features & AHC_MULTI_FUNC) != 0) in ahc_pci_config()
947 ahc->bus_softc.pci_softc.scbbaddr = ahc_inb(ahc, SCBBADDR); in ahc_pci_config()
949 if ((ahc->features & AHC_ULTRA2) != 0) in ahc_pci_config()
950 ahc->bus_softc.pci_softc.dff_thrsh = ahc_inb(ahc, DFF_THRSH); in ahc_pci_config()
953 error = ahc_init(ahc); in ahc_pci_config()
956 ahc->init_level++; in ahc_pci_config()
961 return ahc_pci_map_int(ahc); in ahc_pci_config()
969 ahc_ext_scbram_present(struct ahc_softc *ahc) in ahc_ext_scbram_present() argument
976 chip = ahc->chip & AHC_CHIPID_MASK; in ahc_ext_scbram_present()
977 devconfig = ahc_pci_read_config(ahc->dev_softc, in ahc_ext_scbram_present()
981 if ((ahc->features & AHC_ULTRA2) != 0) in ahc_ext_scbram_present()
982 ramps = (ahc_inb(ahc, DSCOMMAND0) & RAMPS) != 0; in ahc_ext_scbram_present()
1005 ahc_scbram_config(struct ahc_softc *ahc, int enable, int pcheck, in ahc_scbram_config() argument
1010 if (ahc->features & AHC_MULTI_FUNC) { in ahc_scbram_config()
1015 ahc_outb(ahc, SCBBADDR, ahc_get_pci_function(ahc->dev_softc)); in ahc_scbram_config()
1018 ahc->flags &= ~AHC_LSCBS_ENABLED; in ahc_scbram_config()
1020 ahc->flags |= AHC_LSCBS_ENABLED; in ahc_scbram_config()
1021 devconfig = ahc_pci_read_config(ahc->dev_softc, DEVCONFIG, /*bytes*/4); in ahc_scbram_config()
1022 if ((ahc->features & AHC_ULTRA2) != 0) { in ahc_scbram_config()
1025 dscommand0 = ahc_inb(ahc, DSCOMMAND0); in ahc_scbram_config()
1034 ahc_outb(ahc, DSCOMMAND0, dscommand0); in ahc_scbram_config()
1054 ahc_pci_write_config(ahc->dev_softc, DEVCONFIG, devconfig, /*bytes*/4); in ahc_scbram_config()
1063 ahc_probe_ext_scbram(struct ahc_softc *ahc) in ahc_probe_ext_scbram() argument
1078 if (ahc_ext_scbram_present(ahc) == 0) in ahc_probe_ext_scbram()
1084 ahc_scbram_config(ahc, /*enable*/TRUE, pcheck, fast, large); in ahc_probe_ext_scbram()
1085 num_scbs = ahc_probe_scbs(ahc); in ahc_probe_ext_scbram()
1097 ahc_outb(ahc, SEQCTL, 0); in ahc_probe_ext_scbram()
1098 ahc_outb(ahc, CLRINT, CLRPARERR); in ahc_probe_ext_scbram()
1099 ahc_outb(ahc, CLRINT, CLRBRKADRINT); in ahc_probe_ext_scbram()
1102 ahc_scbram_config(ahc, enable, /*pcheck*/TRUE, fast, large); in ahc_probe_ext_scbram()
1103 num_scbs = ahc_probe_scbs(ahc); in ahc_probe_ext_scbram()
1104 if ((ahc_inb(ahc, INTSTAT) & BRKADRINT) == 0 in ahc_probe_ext_scbram()
1105 || (ahc_inb(ahc, ERROR) & MPARERR) == 0) in ahc_probe_ext_scbram()
1109 ahc_outb(ahc, CLRINT, CLRPARERR); in ahc_probe_ext_scbram()
1110 ahc_outb(ahc, CLRINT, CLRBRKADRINT); in ahc_probe_ext_scbram()
1113 ahc_scbram_config(ahc, enable, pcheck, /*fast*/TRUE, large); in ahc_probe_ext_scbram()
1114 test_num_scbs = ahc_probe_scbs(ahc); in ahc_probe_ext_scbram()
1116 && ((ahc_inb(ahc, INTSTAT) & BRKADRINT) == 0 in ahc_probe_ext_scbram()
1117 || (ahc_inb(ahc, ERROR) & MPARERR) == 0)) in ahc_probe_ext_scbram()
1124 if ((ahc->features & AHC_LARGE_SCBS) != 0) { in ahc_probe_ext_scbram()
1125 ahc_scbram_config(ahc, enable, pcheck, fast, /*large*/TRUE); in ahc_probe_ext_scbram()
1126 test_num_scbs = ahc_probe_scbs(ahc); in ahc_probe_ext_scbram()
1137 ahc->flags |= AHC_SCB_BTT; in ahc_probe_ext_scbram()
1146 ahc_outb(ahc, SEQCTL, PERRORDIS|FAILDIS); in ahc_probe_ext_scbram()
1148 ahc_outb(ahc, CLRINT, CLRPARERR); in ahc_probe_ext_scbram()
1149 ahc_outb(ahc, CLRINT, CLRBRKADRINT); in ahc_probe_ext_scbram()
1152 ahc_name(ahc), fast ? "fast" : "slow", in ahc_probe_ext_scbram()
1156 ahc_scbram_config(ahc, enable, pcheck, fast, large); in ahc_probe_ext_scbram()
1164 ahc_pci_test_register_access(struct ahc_softc *ahc) in ahc_pci_test_register_access() argument
1177 cmd = ahc_pci_read_config(ahc->dev_softc, PCIR_COMMAND, /*bytes*/2); in ahc_pci_test_register_access()
1178 ahc_pci_write_config(ahc->dev_softc, PCIR_COMMAND, in ahc_pci_test_register_access()
1189 hcntrl = ahc_inb(ahc, HCNTRL); in ahc_pci_test_register_access()
1200 ahc->flags |= AHC_NO_BIOS_INIT; in ahc_pci_test_register_access()
1212 ahc_outb(ahc, HCNTRL, hcntrl|PAUSE); in ahc_pci_test_register_access()
1213 while (ahc_is_paused(ahc) == 0) in ahc_pci_test_register_access()
1217 status1 = ahc_pci_read_config(ahc->dev_softc, in ahc_pci_test_register_access()
1219 ahc_pci_write_config(ahc->dev_softc, PCIR_STATUS + 1, in ahc_pci_test_register_access()
1221 ahc_outb(ahc, CLRINT, CLRPARERR); in ahc_pci_test_register_access()
1223 ahc_outb(ahc, SEQCTL, PERRORDIS); in ahc_pci_test_register_access()
1224 ahc_outb(ahc, SCBPTR, 0); in ahc_pci_test_register_access()
1225 ahc_outl(ahc, SCB_BASE, 0x5aa555aa); in ahc_pci_test_register_access()
1226 if (ahc_inl(ahc, SCB_BASE) != 0x5aa555aa) in ahc_pci_test_register_access()
1229 status1 = ahc_pci_read_config(ahc->dev_softc, in ahc_pci_test_register_access()
1238 status1 = ahc_pci_read_config(ahc->dev_softc, in ahc_pci_test_register_access()
1240 ahc_pci_write_config(ahc->dev_softc, PCIR_STATUS + 1, in ahc_pci_test_register_access()
1242 ahc_outb(ahc, CLRINT, CLRPARERR); in ahc_pci_test_register_access()
1243 ahc_outb(ahc, SEQCTL, PERRORDIS|FAILDIS); in ahc_pci_test_register_access()
1244 ahc_pci_write_config(ahc->dev_softc, PCIR_COMMAND, cmd, /*bytes*/2); in ahc_pci_test_register_access()
1253 check_extport(struct ahc_softc *ahc, u_int *sxfrctl1) in check_extport() argument
1260 sd.sd_ahc = ahc; in check_extport()
1264 sc = ahc->seep_config; in check_extport()
1272 if (ahc->flags & AHC_LARGE_SEEPROM) in check_extport()
1284 have_seeprom = ahc_acquire_seeprom(ahc, &sd); in check_extport()
1288 printk("%s: Reading SEEPROM...", ahc_name(ahc)); in check_extport()
1293 start_addr = 32 * (ahc->channel - 'A'); in check_extport()
1317 ahc->flags |= AHC_LARGE_SEEPROM; in check_extport()
1328 ahc_outb(ahc, SCBPTR, 2); in check_extport()
1329 if (ahc_inb(ahc, SCB_BASE) == 'A' in check_extport()
1330 && ahc_inb(ahc, SCB_BASE + 1) == 'D' in check_extport()
1331 && ahc_inb(ahc, SCB_BASE + 2) == 'P' in check_extport()
1332 && ahc_inb(ahc, SCB_BASE + 3) == 'T') { in check_extport()
1341 *sc_data = ahc_inb(ahc, SRAM_BASE + j) in check_extport()
1342 | ahc_inb(ahc, SRAM_BASE + j + 1) << 8; in check_extport()
1346 ahc->flags |= AHC_SCB_CONFIG_USED; in check_extport()
1352 ahc_outb(ahc, CLRINT, CLRPARERR); in check_extport()
1353 ahc_outb(ahc, CLRINT, CLRBRKADRINT); in check_extport()
1358 printk("%s: No SEEPROM available.\n", ahc_name(ahc)); in check_extport()
1359 ahc->flags |= AHC_USEDEFAULTS; in check_extport()
1360 kfree(ahc->seep_config); in check_extport()
1361 ahc->seep_config = NULL; in check_extport()
1364 ahc_parse_pci_eeprom(ahc, sc); in check_extport()
1380 if ((ahc->features & AHC_SPIOCAP) != 0) { in check_extport()
1381 if ((ahc_inb(ahc, SPIOCAP) & SSPIOCPS) == 0) in check_extport()
1386 ahc->flags |= AHC_HAS_TERM_LOGIC; in check_extport()
1387 ahc_acquire_seeprom(ahc, &sd); in check_extport()
1388 configure_termination(ahc, &sd, sc->adapter_control, sxfrctl1); in check_extport()
1396 ahc_name(ahc), in check_extport()
1402 ahc_parse_pci_eeprom(struct ahc_softc *ahc, struct seeprom_config *sc) in ahc_parse_pci_eeprom() argument
1423 ahc->flags |= AHC_NEWEEPROM_FMT; in ahc_parse_pci_eeprom()
1436 if ((ahc->flags & AHC_NEWEEPROM_FMT) != 0) { in ahc_parse_pci_eeprom()
1448 if ((ahc->features & AHC_ULTRA2) != 0) { in ahc_parse_pci_eeprom()
1455 ahc_outb(ahc, TARG_OFFSET + i, offset); in ahc_parse_pci_eeprom()
1473 ahc_outb(ahc, TARG_SCSIRATE + i, scsirate); in ahc_parse_pci_eeprom()
1475 ahc->our_id = sc->brtime_id & CFSCSIID; in ahc_parse_pci_eeprom()
1477 scsi_conf = (ahc->our_id & 0x7); in ahc_parse_pci_eeprom()
1483 ahc->flags |= (sc->adapter_control & CFBOOTCHAN) >> CFBOOTCHANSHIFT; in ahc_parse_pci_eeprom()
1486 ahc->flags |= AHC_EXTENDED_TRANS_A; in ahc_parse_pci_eeprom()
1489 ahc->flags |= AHC_BIOS_ENABLED; in ahc_parse_pci_eeprom()
1490 if (ahc->features & AHC_ULTRA in ahc_parse_pci_eeprom()
1491 && (ahc->flags & AHC_NEWEEPROM_FMT) == 0) { in ahc_parse_pci_eeprom()
1503 devconfig = ahc_pci_read_config(ahc->dev_softc, in ahc_parse_pci_eeprom()
1508 ahc_pci_write_config(ahc->dev_softc, DEVCONFIG, in ahc_parse_pci_eeprom()
1512 ahc_outb(ahc, SCSICONF, scsi_conf); in ahc_parse_pci_eeprom()
1513 ahc_outb(ahc, DISC_DSB, ~(discenable & 0xff)); in ahc_parse_pci_eeprom()
1514 ahc_outb(ahc, DISC_DSB + 1, ~((discenable >> 8) & 0xff)); in ahc_parse_pci_eeprom()
1515 ahc_outb(ahc, ULTRA_ENB, ultraenb & 0xff); in ahc_parse_pci_eeprom()
1516 ahc_outb(ahc, ULTRA_ENB + 1, (ultraenb >> 8) & 0xff); in ahc_parse_pci_eeprom()
1520 configure_termination(struct ahc_softc *ahc, in configure_termination() argument
1542 || (ahc->features & AHC_NEW_TERMCTL) != 0) { in configure_termination()
1557 if ((ahc->features & AHC_NEW_TERMCTL) != 0) { in configure_termination()
1558 ahc_new_term_detect(ahc, &enableSEC_low, in configure_termination()
1566 ahc_name(ahc)); in configure_termination()
1574 ahc_name(ahc)); in configure_termination()
1582 } else if ((ahc->features & AHC_SPIOCAP) != 0) { in configure_termination()
1583 aic785X_cable_detect(ahc, &internal50_present, in configure_termination()
1589 aic787X_cable_detect(ahc, &internal50_present, in configure_termination()
1595 if ((ahc->features & AHC_WIDE) == 0) in configure_termination()
1599 && (ahc->features & AHC_ULTRA2) == 0) { in configure_termination()
1601 ahc_name(ahc), in configure_termination()
1604 if ((ahc->features & AHC_WIDE) != 0) in configure_termination()
1608 ahc_name(ahc), in configure_termination()
1613 ahc_name(ahc), eeprom_present ? "is" : "not"); in configure_termination()
1615 if ((ahc->flags & AHC_INT50_SPEEDFLEX) != 0) { in configure_termination()
1634 if ((ahc->features & AHC_ULTRA2) == 0 in configure_termination()
1641 "time!\n", ahc_name(ahc)); in configure_termination()
1653 if ((ahc->features & AHC_WIDE) != 0 in configure_termination()
1659 if ((ahc->flags & AHC_INT50_SPEEDFLEX) != 0) in configure_termination()
1661 "Enabled\n", ahc_name(ahc)); in configure_termination()
1664 "Enabled\n", ahc_name(ahc), in configure_termination()
1673 if ((ahc->features & AHC_ULTRA2) != 0) in configure_termination()
1678 if ((ahc->flags & AHC_INT50_SPEEDFLEX) != 0) in configure_termination()
1680 "Enabled\n", ahc_name(ahc)); in configure_termination()
1683 "Enabled\n", ahc_name(ahc), in configure_termination()
1693 "Enabled\n", ahc_name(ahc)); in configure_termination()
1700 ahc_outb(ahc, SXFRCTL1, *sxfrctl1); in configure_termination()
1707 ahc_name(ahc)); in configure_termination()
1710 write_brdctl(ahc, brddat); in configure_termination()
1718 ahc_name(ahc), in configure_termination()
1719 (ahc->features & AHC_ULTRA2) ? "Primary " in configure_termination()
1724 && (ahc->features & AHC_WIDE) != 0) { in configure_termination()
1728 ahc_name(ahc), in configure_termination()
1729 (ahc->features & AHC_ULTRA2) in configure_termination()
1737 ahc_outb(ahc, SXFRCTL1, *sxfrctl1); in configure_termination()
1739 if ((ahc->features & AHC_WIDE) != 0) in configure_termination()
1740 write_brdctl(ahc, brddat); in configure_termination()
1746 ahc_new_term_detect(struct ahc_softc *ahc, int *enableSEC_low, in ahc_new_term_detect() argument
1759 brdctl = read_brdctl(ahc); in ahc_new_term_detect()
1768 aic787X_cable_detect(struct ahc_softc *ahc, int *internal50_present, in aic787X_cable_detect() argument
1781 write_brdctl(ahc, 0); in aic787X_cable_detect()
1788 brdctl = read_brdctl(ahc); in aic787X_cable_detect()
1796 write_brdctl(ahc, BRDDAT5); in aic787X_cable_detect()
1803 brdctl = read_brdctl(ahc); in aic787X_cable_detect()
1809 aic785X_cable_detect(struct ahc_softc *ahc, int *internal50_present, in aic785X_cable_detect() argument
1815 spiocap = ahc_inb(ahc, SPIOCAP); in aic785X_cable_detect()
1818 ahc_outb(ahc, SPIOCAP, spiocap); in aic785X_cable_detect()
1819 ahc_outb(ahc, BRDCTL, BRDRW|BRDCS); in aic785X_cable_detect()
1820 ahc_flush_device_writes(ahc); in aic785X_cable_detect()
1822 ahc_outb(ahc, BRDCTL, 0); in aic785X_cable_detect()
1823 ahc_flush_device_writes(ahc); in aic785X_cable_detect()
1825 brdctl = ahc_inb(ahc, BRDCTL); in aic785X_cable_detect()
1828 *eeprom_present = (ahc_inb(ahc, SPIOCAP) & EEPROM) ? 1 : 0; in aic785X_cable_detect()
1832 ahc_acquire_seeprom(struct ahc_softc *ahc, struct seeprom_descriptor *sd) in ahc_acquire_seeprom() argument
1836 if ((ahc->features & AHC_SPIOCAP) != 0 in ahc_acquire_seeprom()
1837 && (ahc_inb(ahc, SPIOCAP) & SEEPROM) == 0) in ahc_acquire_seeprom()
1867 write_brdctl(struct ahc_softc *ahc, uint8_t value) in write_brdctl() argument
1871 if ((ahc->chip & AHC_CHIPID_MASK) == AHC_AIC7895) { in write_brdctl()
1873 if (ahc->channel == 'B') in write_brdctl()
1875 } else if ((ahc->features & AHC_ULTRA2) != 0) { in write_brdctl()
1880 ahc_outb(ahc, BRDCTL, brdctl); in write_brdctl()
1881 ahc_flush_device_writes(ahc); in write_brdctl()
1883 ahc_outb(ahc, BRDCTL, brdctl); in write_brdctl()
1884 ahc_flush_device_writes(ahc); in write_brdctl()
1885 if ((ahc->features & AHC_ULTRA2) != 0) in write_brdctl()
1889 ahc_outb(ahc, BRDCTL, brdctl); in write_brdctl()
1890 ahc_flush_device_writes(ahc); in write_brdctl()
1891 if ((ahc->features & AHC_ULTRA2) != 0) in write_brdctl()
1895 ahc_outb(ahc, BRDCTL, brdctl); in write_brdctl()
1899 read_brdctl(struct ahc_softc *ahc) in read_brdctl() argument
1904 if ((ahc->chip & AHC_CHIPID_MASK) == AHC_AIC7895) { in read_brdctl()
1906 if (ahc->channel == 'B') in read_brdctl()
1908 } else if ((ahc->features & AHC_ULTRA2) != 0) { in read_brdctl()
1913 ahc_outb(ahc, BRDCTL, brdctl); in read_brdctl()
1914 ahc_flush_device_writes(ahc); in read_brdctl()
1915 value = ahc_inb(ahc, BRDCTL); in read_brdctl()
1916 ahc_outb(ahc, BRDCTL, 0); in read_brdctl()
1921 ahc_pci_intr(struct ahc_softc *ahc) in ahc_pci_intr() argument
1926 error = ahc_inb(ahc, ERROR); in ahc_pci_intr()
1930 status1 = ahc_pci_read_config(ahc->dev_softc, in ahc_pci_intr()
1934 ahc_name(ahc), in ahc_pci_intr()
1935 ahc_inb(ahc, SEQADDR0) | (ahc_inb(ahc, SEQADDR1) << 8)); in ahc_pci_intr()
1938 ahc->pci_target_perr_count++; in ahc_pci_intr()
1940 "or write data phase\n", ahc_name(ahc)); in ahc_pci_intr()
1943 printk("%s: Signal System Error Detected\n", ahc_name(ahc)); in ahc_pci_intr()
1946 printk("%s: Received a Master Abort\n", ahc_name(ahc)); in ahc_pci_intr()
1949 printk("%s: Received a Target Abort\n", ahc_name(ahc)); in ahc_pci_intr()
1952 printk("%s: Signaled a Target Abort\n", ahc_name(ahc)); in ahc_pci_intr()
1956 ahc_name(ahc)); in ahc_pci_intr()
1960 ahc_pci_write_config(ahc->dev_softc, PCIR_STATUS + 1, in ahc_pci_intr()
1965 "no status bits set\n", ahc_name(ahc)); in ahc_pci_intr()
1967 ahc_outb(ahc, CLRINT, CLRPARERR); in ahc_pci_intr()
1970 if (ahc->pci_target_perr_count > AHC_PCI_TARGET_PERR_THRESH) { in ahc_pci_intr()
1978 ahc_name(ahc), ahc_name(ahc), ahc_name(ahc), in ahc_pci_intr()
1979 ahc_name(ahc), ahc_name(ahc), ahc_name(ahc)); in ahc_pci_intr()
1980 ahc->seqctl |= FAILDIS; in ahc_pci_intr()
1981 ahc_outb(ahc, SEQCTL, ahc->seqctl); in ahc_pci_intr()
1983 ahc_unpause(ahc); in ahc_pci_intr()
1987 ahc_pci_chip_init(struct ahc_softc *ahc) in ahc_pci_chip_init() argument
1989 ahc_outb(ahc, DSCOMMAND0, ahc->bus_softc.pci_softc.dscommand0); in ahc_pci_chip_init()
1990 ahc_outb(ahc, DSPCISTATUS, ahc->bus_softc.pci_softc.dspcistatus); in ahc_pci_chip_init()
1991 if ((ahc->features & AHC_DT) != 0) { in ahc_pci_chip_init()
1994 sfunct = ahc_inb(ahc, SFUNCT) & ~ALT_MODE; in ahc_pci_chip_init()
1995 ahc_outb(ahc, SFUNCT, sfunct | ALT_MODE); in ahc_pci_chip_init()
1996 ahc_outb(ahc, OPTIONMODE, ahc->bus_softc.pci_softc.optionmode); in ahc_pci_chip_init()
1997 ahc_outw(ahc, TARGCRCCNT, ahc->bus_softc.pci_softc.targcrccnt); in ahc_pci_chip_init()
1998 ahc_outb(ahc, SFUNCT, sfunct); in ahc_pci_chip_init()
1999 ahc_outb(ahc, CRCCONTROL1, in ahc_pci_chip_init()
2000 ahc->bus_softc.pci_softc.crccontrol1); in ahc_pci_chip_init()
2002 if ((ahc->features & AHC_MULTI_FUNC) != 0) in ahc_pci_chip_init()
2003 ahc_outb(ahc, SCBBADDR, ahc->bus_softc.pci_softc.scbbaddr); in ahc_pci_chip_init()
2005 if ((ahc->features & AHC_ULTRA2) != 0) in ahc_pci_chip_init()
2006 ahc_outb(ahc, DFF_THRSH, ahc->bus_softc.pci_softc.dff_thrsh); in ahc_pci_chip_init()
2008 return (ahc_chip_init(ahc)); in ahc_pci_chip_init()
2012 ahc_pci_resume(struct ahc_softc *ahc) in ahc_pci_resume() argument
2020 ahc_pci_write_config(ahc->dev_softc, DEVCONFIG, in ahc_pci_resume()
2021 ahc->bus_softc.pci_softc.devconfig, /*bytes*/4); in ahc_pci_resume()
2022 ahc_pci_write_config(ahc->dev_softc, PCIR_COMMAND, in ahc_pci_resume()
2023 ahc->bus_softc.pci_softc.command, /*bytes*/1); in ahc_pci_resume()
2024 ahc_pci_write_config(ahc->dev_softc, CSIZE_LATTIME, in ahc_pci_resume()
2025 ahc->bus_softc.pci_softc.csize_lattime, /*bytes*/1); in ahc_pci_resume()
2026 if ((ahc->flags & AHC_HAS_TERM_LOGIC) != 0) { in ahc_pci_resume()
2030 sd.sd_ahc = ahc; in ahc_pci_resume()
2035 ahc_acquire_seeprom(ahc, &sd); in ahc_pci_resume()
2036 configure_termination(ahc, &sd, in ahc_pci_resume()
2037 ahc->seep_config->adapter_control, in ahc_pci_resume()
2044 ahc_aic785X_setup(struct ahc_softc *ahc) in ahc_aic785X_setup() argument
2049 pci = ahc->dev_softc; in ahc_aic785X_setup()
2050 ahc->channel = 'A'; in ahc_aic785X_setup()
2051 ahc->chip = AHC_AIC7850; in ahc_aic785X_setup()
2052 ahc->features = AHC_AIC7850_FE; in ahc_aic785X_setup()
2053 ahc->bugs |= AHC_TMODE_WIDEODD_BUG|AHC_CACHETHEN_BUG|AHC_PCI_MWI_BUG; in ahc_aic785X_setup()
2056 ahc->bugs |= AHC_PCI_2_1_RETRY_BUG; in ahc_aic785X_setup()
2057 ahc->instruction_ram_size = 512; in ahc_aic785X_setup()
2062 ahc_aic7860_setup(struct ahc_softc *ahc) in ahc_aic7860_setup() argument
2067 pci = ahc->dev_softc; in ahc_aic7860_setup()
2068 ahc->channel = 'A'; in ahc_aic7860_setup()
2069 ahc->chip = AHC_AIC7860; in ahc_aic7860_setup()
2070 ahc->features = AHC_AIC7860_FE; in ahc_aic7860_setup()
2071 ahc->bugs |= AHC_TMODE_WIDEODD_BUG|AHC_CACHETHEN_BUG|AHC_PCI_MWI_BUG; in ahc_aic7860_setup()
2074 ahc->bugs |= AHC_PCI_2_1_RETRY_BUG; in ahc_aic7860_setup()
2075 ahc->instruction_ram_size = 512; in ahc_aic7860_setup()
2080 ahc_apa1480_setup(struct ahc_softc *ahc) in ahc_apa1480_setup() argument
2084 error = ahc_aic7860_setup(ahc); in ahc_apa1480_setup()
2087 ahc->features |= AHC_REMOVABLE; in ahc_apa1480_setup()
2092 ahc_aic7870_setup(struct ahc_softc *ahc) in ahc_aic7870_setup() argument
2095 ahc->channel = 'A'; in ahc_aic7870_setup()
2096 ahc->chip = AHC_AIC7870; in ahc_aic7870_setup()
2097 ahc->features = AHC_AIC7870_FE; in ahc_aic7870_setup()
2098 ahc->bugs |= AHC_TMODE_WIDEODD_BUG|AHC_CACHETHEN_BUG|AHC_PCI_MWI_BUG; in ahc_aic7870_setup()
2099 ahc->instruction_ram_size = 512; in ahc_aic7870_setup()
2104 ahc_aic7870h_setup(struct ahc_softc *ahc) in ahc_aic7870h_setup() argument
2106 int error = ahc_aic7870_setup(ahc); in ahc_aic7870h_setup()
2108 ahc->features |= AHC_HVD; in ahc_aic7870h_setup()
2114 ahc_aha394X_setup(struct ahc_softc *ahc) in ahc_aha394X_setup() argument
2118 error = ahc_aic7870_setup(ahc); in ahc_aha394X_setup()
2120 error = ahc_aha394XX_setup(ahc); in ahc_aha394X_setup()
2125 ahc_aha394Xh_setup(struct ahc_softc *ahc) in ahc_aha394Xh_setup() argument
2127 int error = ahc_aha394X_setup(ahc); in ahc_aha394Xh_setup()
2129 ahc->features |= AHC_HVD; in ahc_aha394Xh_setup()
2135 ahc_aha398X_setup(struct ahc_softc *ahc) in ahc_aha398X_setup() argument
2139 error = ahc_aic7870_setup(ahc); in ahc_aha398X_setup()
2141 error = ahc_aha398XX_setup(ahc); in ahc_aha398X_setup()
2146 ahc_aha494X_setup(struct ahc_softc *ahc) in ahc_aha494X_setup() argument
2150 error = ahc_aic7870_setup(ahc); in ahc_aha494X_setup()
2152 error = ahc_aha494XX_setup(ahc); in ahc_aha494X_setup()
2157 ahc_aha494Xh_setup(struct ahc_softc *ahc) in ahc_aha494Xh_setup() argument
2159 int error = ahc_aha494X_setup(ahc); in ahc_aha494Xh_setup()
2161 ahc->features |= AHC_HVD; in ahc_aha494Xh_setup()
2167 ahc_aic7880_setup(struct ahc_softc *ahc) in ahc_aic7880_setup() argument
2172 pci = ahc->dev_softc; in ahc_aic7880_setup()
2173 ahc->channel = 'A'; in ahc_aic7880_setup()
2174 ahc->chip = AHC_AIC7880; in ahc_aic7880_setup()
2175 ahc->features = AHC_AIC7880_FE; in ahc_aic7880_setup()
2176 ahc->bugs |= AHC_TMODE_WIDEODD_BUG; in ahc_aic7880_setup()
2179 ahc->bugs |= AHC_PCI_2_1_RETRY_BUG; in ahc_aic7880_setup()
2181 ahc->bugs |= AHC_CACHETHEN_BUG|AHC_PCI_MWI_BUG; in ahc_aic7880_setup()
2183 ahc->instruction_ram_size = 512; in ahc_aic7880_setup()
2188 ahc_aic7880h_setup(struct ahc_softc *ahc) in ahc_aic7880h_setup() argument
2190 int error = ahc_aic7880_setup(ahc); in ahc_aic7880h_setup()
2192 ahc->features |= AHC_HVD; in ahc_aic7880h_setup()
2199 ahc_aha2940Pro_setup(struct ahc_softc *ahc) in ahc_aha2940Pro_setup() argument
2202 ahc->flags |= AHC_INT50_SPEEDFLEX; in ahc_aha2940Pro_setup()
2203 return (ahc_aic7880_setup(ahc)); in ahc_aha2940Pro_setup()
2207 ahc_aha394XU_setup(struct ahc_softc *ahc) in ahc_aha394XU_setup() argument
2211 error = ahc_aic7880_setup(ahc); in ahc_aha394XU_setup()
2213 error = ahc_aha394XX_setup(ahc); in ahc_aha394XU_setup()
2218 ahc_aha394XUh_setup(struct ahc_softc *ahc) in ahc_aha394XUh_setup() argument
2220 int error = ahc_aha394XU_setup(ahc); in ahc_aha394XUh_setup()
2222 ahc->features |= AHC_HVD; in ahc_aha394XUh_setup()
2228 ahc_aha398XU_setup(struct ahc_softc *ahc) in ahc_aha398XU_setup() argument
2232 error = ahc_aic7880_setup(ahc); in ahc_aha398XU_setup()
2234 error = ahc_aha398XX_setup(ahc); in ahc_aha398XU_setup()
2239 ahc_aic7890_setup(struct ahc_softc *ahc) in ahc_aic7890_setup() argument
2244 pci = ahc->dev_softc; in ahc_aic7890_setup()
2245 ahc->channel = 'A'; in ahc_aic7890_setup()
2246 ahc->chip = AHC_AIC7890; in ahc_aic7890_setup()
2247 ahc->features = AHC_AIC7890_FE; in ahc_aic7890_setup()
2248 ahc->flags |= AHC_NEWEEPROM_FMT; in ahc_aic7890_setup()
2251 ahc->bugs |= AHC_AUTOFLUSH_BUG|AHC_CACHETHEN_BUG; in ahc_aic7890_setup()
2252 ahc->instruction_ram_size = 768; in ahc_aic7890_setup()
2257 ahc_aic7892_setup(struct ahc_softc *ahc) in ahc_aic7892_setup() argument
2260 ahc->channel = 'A'; in ahc_aic7892_setup()
2261 ahc->chip = AHC_AIC7892; in ahc_aic7892_setup()
2262 ahc->features = AHC_AIC7892_FE; in ahc_aic7892_setup()
2263 ahc->flags |= AHC_NEWEEPROM_FMT; in ahc_aic7892_setup()
2264 ahc->bugs |= AHC_SCBCHAN_UPLOAD_BUG; in ahc_aic7892_setup()
2265 ahc->instruction_ram_size = 1024; in ahc_aic7892_setup()
2270 ahc_aic7895_setup(struct ahc_softc *ahc) in ahc_aic7895_setup() argument
2275 pci = ahc->dev_softc; in ahc_aic7895_setup()
2276 ahc->channel = ahc_get_pci_function(pci) == 1 ? 'B' : 'A'; in ahc_aic7895_setup()
2282 ahc->chip = AHC_AIC7895C; in ahc_aic7895_setup()
2283 ahc->features = AHC_AIC7895C_FE; in ahc_aic7895_setup()
2287 ahc->chip = AHC_AIC7895; in ahc_aic7895_setup()
2288 ahc->features = AHC_AIC7895_FE; in ahc_aic7895_setup()
2299 ahc->bugs |= AHC_PCI_MWI_BUG; in ahc_aic7895_setup()
2305 ahc->bugs |= AHC_TMODE_WIDEODD_BUG|AHC_PCI_2_1_RETRY_BUG in ahc_aic7895_setup()
2320 ahc->flags |= AHC_NEWEEPROM_FMT; in ahc_aic7895_setup()
2321 ahc->instruction_ram_size = 512; in ahc_aic7895_setup()
2326 ahc_aic7895h_setup(struct ahc_softc *ahc) in ahc_aic7895h_setup() argument
2328 int error = ahc_aic7895_setup(ahc); in ahc_aic7895h_setup()
2330 ahc->features |= AHC_HVD; in ahc_aic7895h_setup()
2336 ahc_aic7896_setup(struct ahc_softc *ahc) in ahc_aic7896_setup() argument
2340 pci = ahc->dev_softc; in ahc_aic7896_setup()
2341 ahc->channel = ahc_get_pci_function(pci) == 1 ? 'B' : 'A'; in ahc_aic7896_setup()
2342 ahc->chip = AHC_AIC7896; in ahc_aic7896_setup()
2343 ahc->features = AHC_AIC7896_FE; in ahc_aic7896_setup()
2344 ahc->flags |= AHC_NEWEEPROM_FMT; in ahc_aic7896_setup()
2345 ahc->bugs |= AHC_CACHETHEN_DIS_BUG; in ahc_aic7896_setup()
2346 ahc->instruction_ram_size = 768; in ahc_aic7896_setup()
2351 ahc_aic7899_setup(struct ahc_softc *ahc) in ahc_aic7899_setup() argument
2355 pci = ahc->dev_softc; in ahc_aic7899_setup()
2356 ahc->channel = ahc_get_pci_function(pci) == 1 ? 'B' : 'A'; in ahc_aic7899_setup()
2357 ahc->chip = AHC_AIC7899; in ahc_aic7899_setup()
2358 ahc->features = AHC_AIC7899_FE; in ahc_aic7899_setup()
2359 ahc->flags |= AHC_NEWEEPROM_FMT; in ahc_aic7899_setup()
2360 ahc->bugs |= AHC_SCBCHAN_UPLOAD_BUG; in ahc_aic7899_setup()
2361 ahc->instruction_ram_size = 1024; in ahc_aic7899_setup()
2366 ahc_aha29160C_setup(struct ahc_softc *ahc) in ahc_aha29160C_setup() argument
2370 error = ahc_aic7899_setup(ahc); in ahc_aha29160C_setup()
2373 ahc->features |= AHC_REMOVABLE; in ahc_aha29160C_setup()
2378 ahc_raid_setup(struct ahc_softc *ahc) in ahc_raid_setup() argument
2385 ahc_aha394XX_setup(struct ahc_softc *ahc) in ahc_aha394XX_setup() argument
2389 pci = ahc->dev_softc; in ahc_aha394XX_setup()
2392 ahc->channel = 'A'; in ahc_aha394XX_setup()
2395 ahc->channel = 'B'; in ahc_aha394XX_setup()
2401 ahc->channel = 'A'; in ahc_aha394XX_setup()
2407 ahc_aha398XX_setup(struct ahc_softc *ahc) in ahc_aha398XX_setup() argument
2411 pci = ahc->dev_softc; in ahc_aha398XX_setup()
2414 ahc->channel = 'A'; in ahc_aha398XX_setup()
2417 ahc->channel = 'B'; in ahc_aha398XX_setup()
2420 ahc->channel = 'C'; in ahc_aha398XX_setup()
2426 ahc->channel = 'A'; in ahc_aha398XX_setup()
2429 ahc->flags |= AHC_LARGE_SEEPROM; in ahc_aha398XX_setup()
2434 ahc_aha494XX_setup(struct ahc_softc *ahc) in ahc_aha494XX_setup() argument
2438 pci = ahc->dev_softc; in ahc_aha494XX_setup()
2441 ahc->channel = 'A'; in ahc_aha494XX_setup()
2444 ahc->channel = 'B'; in ahc_aha494XX_setup()
2447 ahc->channel = 'C'; in ahc_aha494XX_setup()
2450 ahc->channel = 'D'; in ahc_aha494XX_setup()
2456 ahc->channel = 'A'; in ahc_aha494XX_setup()
2458 ahc->flags |= AHC_LARGE_SEEPROM; in ahc_aha494XX_setup()