• Home
  • Raw
  • Download

Lines Matching refs:ahc

606 static int ahc_ext_scbram_present(struct ahc_softc *ahc);
607 static void ahc_scbram_config(struct ahc_softc *ahc, int enable,
609 static void ahc_probe_ext_scbram(struct ahc_softc *ahc);
610 static void check_extport(struct ahc_softc *ahc, u_int *sxfrctl1);
611 static void ahc_parse_pci_eeprom(struct ahc_softc *ahc,
613 static void configure_termination(struct ahc_softc *ahc,
618 static void ahc_new_term_detect(struct ahc_softc *ahc,
624 static void aic787X_cable_detect(struct ahc_softc *ahc, int *internal50_present,
628 static void aic785X_cable_detect(struct ahc_softc *ahc, int *internal50_present,
631 static void write_brdctl(struct ahc_softc *ahc, uint8_t value);
632 static uint8_t read_brdctl(struct ahc_softc *ahc);
633 static void ahc_pci_intr(struct ahc_softc *ahc);
634 static int ahc_pci_chip_init(struct ahc_softc *ahc);
712 ahc_pci_config(struct ahc_softc *ahc, const struct ahc_pci_identity *entry) in ahc_pci_config() argument
724 error = entry->setup(ahc); in ahc_pci_config()
727 ahc->chip |= AHC_PCI; in ahc_pci_config()
728 ahc->description = entry->name; in ahc_pci_config()
730 pci_set_power_state(ahc->dev_softc, AHC_POWER_STATE_D0); in ahc_pci_config()
732 error = ahc_pci_map_registers(ahc); in ahc_pci_config()
742 ahc_intr_enable(ahc, FALSE); in ahc_pci_config()
744 devconfig = ahc_pci_read_config(ahc->dev_softc, DEVCONFIG, /*bytes*/4); in ahc_pci_config()
752 if ((ahc->flags & AHC_39BIT_ADDRESSING) != 0) { in ahc_pci_config()
756 ahc_name(ahc)); in ahc_pci_config()
763 ahc_pci_write_config(ahc->dev_softc, DEVCONFIG, devconfig, /*bytes*/4); in ahc_pci_config()
766 command = ahc_pci_read_config(ahc->dev_softc, PCIR_COMMAND, /*bytes*/2); in ahc_pci_config()
769 ahc_pci_write_config(ahc->dev_softc, PCIR_COMMAND, command, /*bytes*/2); in ahc_pci_config()
772 ahc->flags |= AHC_PAGESCBS; in ahc_pci_config()
774 error = ahc_softc_init(ahc); in ahc_pci_config()
786 if ((ahc->flags & AHC_DISABLE_PCI_PERR) != 0) in ahc_pci_config()
787 ahc->seqctl |= FAILDIS; in ahc_pci_config()
789 ahc->bus_intr = ahc_pci_intr; in ahc_pci_config()
790 ahc->bus_chip_init = ahc_pci_chip_init; in ahc_pci_config()
793 if ((ahc_inb(ahc, HCNTRL) & POWRDN) == 0) { in ahc_pci_config()
794 ahc_pause(ahc); in ahc_pci_config()
795 if ((ahc->features & AHC_ULTRA2) != 0) in ahc_pci_config()
796 our_id = ahc_inb(ahc, SCSIID_ULTRA2) & OID; in ahc_pci_config()
798 our_id = ahc_inb(ahc, SCSIID) & OID; in ahc_pci_config()
799 sxfrctl1 = ahc_inb(ahc, SXFRCTL1) & STPWEN; in ahc_pci_config()
800 scsiseq = ahc_inb(ahc, SCSISEQ); in ahc_pci_config()
807 error = ahc_reset(ahc, /*reinit*/FALSE); in ahc_pci_config()
811 if ((ahc->features & AHC_DT) != 0) { in ahc_pci_config()
815 sfunct = ahc_inb(ahc, SFUNCT) & ~ALT_MODE; in ahc_pci_config()
816 ahc_outb(ahc, SFUNCT, sfunct | ALT_MODE); in ahc_pci_config()
817 ahc_outb(ahc, OPTIONMODE, in ahc_pci_config()
819 ahc_outb(ahc, SFUNCT, sfunct); in ahc_pci_config()
822 ahc_outb(ahc, CRCCONTROL1, CRCVALCHKEN|CRCENDCHKEN|CRCREQCHKEN in ahc_pci_config()
826 dscommand0 = ahc_inb(ahc, DSCOMMAND0); in ahc_pci_config()
828 if ((ahc->features & AHC_ULTRA2) != 0) { in ahc_pci_config()
841 if ((ahc->bugs & AHC_CACHETHEN_DIS_BUG) != 0) in ahc_pci_config()
844 if ((ahc->bugs & AHC_CACHETHEN_BUG) != 0) in ahc_pci_config()
847 ahc_outb(ahc, DSCOMMAND0, dscommand0); in ahc_pci_config()
849 ahc->pci_cachesize = in ahc_pci_config()
850 ahc_pci_read_config(ahc->dev_softc, CSIZE_LATTIME, in ahc_pci_config()
852 ahc->pci_cachesize *= 4; in ahc_pci_config()
854 if ((ahc->bugs & AHC_PCI_2_1_RETRY_BUG) != 0 in ahc_pci_config()
855 && ahc->pci_cachesize == 4) { in ahc_pci_config()
857 ahc_pci_write_config(ahc->dev_softc, CSIZE_LATTIME, in ahc_pci_config()
859 ahc->pci_cachesize = 0; in ahc_pci_config()
866 if ((ahc->features & AHC_ULTRA) != 0) { in ahc_pci_config()
869 devconfig = ahc_pci_read_config(ahc->dev_softc, in ahc_pci_config()
872 ahc->features &= ~AHC_ULTRA; in ahc_pci_config()
876 check_extport(ahc, &sxfrctl1); in ahc_pci_config()
881 sblkctl = ahc_inb(ahc, SBLKCTL); in ahc_pci_config()
882 ahc_outb(ahc, SBLKCTL, (sblkctl & ~(DIAGLEDEN|DIAGLEDON))); in ahc_pci_config()
884 if ((ahc->features & AHC_ULTRA2) != 0) { in ahc_pci_config()
885 ahc_outb(ahc, DFF_THRSH, RD_DFTHRSH_MAX|WR_DFTHRSH_MAX); in ahc_pci_config()
887 ahc_outb(ahc, DSPCISTATUS, DFTHRSH_100); in ahc_pci_config()
890 if (ahc->flags & AHC_USEDEFAULTS) { in ahc_pci_config()
897 if ((ahc->flags & AHC_NO_BIOS_INIT) == 0 in ahc_pci_config()
900 ahc_name(ahc)); in ahc_pci_config()
901 ahc->flags &= ~AHC_USEDEFAULTS; in ahc_pci_config()
902 ahc->flags |= AHC_BIOS_ENABLED; in ahc_pci_config()
911 ahc_outb(ahc, SCSICONF, our_id|ENSPCHK|RESET_SCSI); in ahc_pci_config()
913 ahc->our_id = our_id; in ahc_pci_config()
921 ahc_probe_ext_scbram(ahc); in ahc_pci_config()
928 ahc->flags |= AHC_TERM_ENB_A; in ahc_pci_config()
934 ahc->bus_softc.pci_softc.devconfig = in ahc_pci_config()
935 ahc_pci_read_config(ahc->dev_softc, DEVCONFIG, /*bytes*/4); in ahc_pci_config()
936 ahc->bus_softc.pci_softc.command = in ahc_pci_config()
937 ahc_pci_read_config(ahc->dev_softc, PCIR_COMMAND, /*bytes*/1); in ahc_pci_config()
938 ahc->bus_softc.pci_softc.csize_lattime = in ahc_pci_config()
939 ahc_pci_read_config(ahc->dev_softc, CSIZE_LATTIME, /*bytes*/1); in ahc_pci_config()
940 ahc->bus_softc.pci_softc.dscommand0 = ahc_inb(ahc, DSCOMMAND0); in ahc_pci_config()
941 ahc->bus_softc.pci_softc.dspcistatus = ahc_inb(ahc, DSPCISTATUS); in ahc_pci_config()
942 if ((ahc->features & AHC_DT) != 0) { in ahc_pci_config()
945 sfunct = ahc_inb(ahc, SFUNCT) & ~ALT_MODE; in ahc_pci_config()
946 ahc_outb(ahc, SFUNCT, sfunct | ALT_MODE); in ahc_pci_config()
947 ahc->bus_softc.pci_softc.optionmode = ahc_inb(ahc, OPTIONMODE); in ahc_pci_config()
948 ahc->bus_softc.pci_softc.targcrccnt = ahc_inw(ahc, TARGCRCCNT); in ahc_pci_config()
949 ahc_outb(ahc, SFUNCT, sfunct); in ahc_pci_config()
950 ahc->bus_softc.pci_softc.crccontrol1 = in ahc_pci_config()
951 ahc_inb(ahc, CRCCONTROL1); in ahc_pci_config()
953 if ((ahc->features & AHC_MULTI_FUNC) != 0) in ahc_pci_config()
954 ahc->bus_softc.pci_softc.scbbaddr = ahc_inb(ahc, SCBBADDR); in ahc_pci_config()
956 if ((ahc->features & AHC_ULTRA2) != 0) in ahc_pci_config()
957 ahc->bus_softc.pci_softc.dff_thrsh = ahc_inb(ahc, DFF_THRSH); in ahc_pci_config()
960 error = ahc_init(ahc); in ahc_pci_config()
963 ahc->init_level++; in ahc_pci_config()
968 return ahc_pci_map_int(ahc); in ahc_pci_config()
976 ahc_ext_scbram_present(struct ahc_softc *ahc) in ahc_ext_scbram_present() argument
983 chip = ahc->chip & AHC_CHIPID_MASK; in ahc_ext_scbram_present()
984 devconfig = ahc_pci_read_config(ahc->dev_softc, in ahc_ext_scbram_present()
988 if ((ahc->features & AHC_ULTRA2) != 0) in ahc_ext_scbram_present()
989 ramps = (ahc_inb(ahc, DSCOMMAND0) & RAMPS) != 0; in ahc_ext_scbram_present()
1012 ahc_scbram_config(struct ahc_softc *ahc, int enable, int pcheck, in ahc_scbram_config() argument
1017 if (ahc->features & AHC_MULTI_FUNC) { in ahc_scbram_config()
1022 ahc_outb(ahc, SCBBADDR, ahc_get_pci_function(ahc->dev_softc)); in ahc_scbram_config()
1025 ahc->flags &= ~AHC_LSCBS_ENABLED; in ahc_scbram_config()
1027 ahc->flags |= AHC_LSCBS_ENABLED; in ahc_scbram_config()
1028 devconfig = ahc_pci_read_config(ahc->dev_softc, DEVCONFIG, /*bytes*/4); in ahc_scbram_config()
1029 if ((ahc->features & AHC_ULTRA2) != 0) { in ahc_scbram_config()
1032 dscommand0 = ahc_inb(ahc, DSCOMMAND0); in ahc_scbram_config()
1041 ahc_outb(ahc, DSCOMMAND0, dscommand0); in ahc_scbram_config()
1061 ahc_pci_write_config(ahc->dev_softc, DEVCONFIG, devconfig, /*bytes*/4); in ahc_scbram_config()
1070 ahc_probe_ext_scbram(struct ahc_softc *ahc) in ahc_probe_ext_scbram() argument
1085 if (ahc_ext_scbram_present(ahc) == 0) in ahc_probe_ext_scbram()
1091 ahc_scbram_config(ahc, /*enable*/TRUE, pcheck, fast, large); in ahc_probe_ext_scbram()
1092 num_scbs = ahc_probe_scbs(ahc); in ahc_probe_ext_scbram()
1104 ahc_outb(ahc, SEQCTL, 0); in ahc_probe_ext_scbram()
1105 ahc_outb(ahc, CLRINT, CLRPARERR); in ahc_probe_ext_scbram()
1106 ahc_outb(ahc, CLRINT, CLRBRKADRINT); in ahc_probe_ext_scbram()
1109 ahc_scbram_config(ahc, enable, /*pcheck*/TRUE, fast, large); in ahc_probe_ext_scbram()
1110 num_scbs = ahc_probe_scbs(ahc); in ahc_probe_ext_scbram()
1111 if ((ahc_inb(ahc, INTSTAT) & BRKADRINT) == 0 in ahc_probe_ext_scbram()
1112 || (ahc_inb(ahc, ERROR) & MPARERR) == 0) in ahc_probe_ext_scbram()
1116 ahc_outb(ahc, CLRINT, CLRPARERR); in ahc_probe_ext_scbram()
1117 ahc_outb(ahc, CLRINT, CLRBRKADRINT); in ahc_probe_ext_scbram()
1120 ahc_scbram_config(ahc, enable, pcheck, /*fast*/TRUE, large); in ahc_probe_ext_scbram()
1121 test_num_scbs = ahc_probe_scbs(ahc); in ahc_probe_ext_scbram()
1123 && ((ahc_inb(ahc, INTSTAT) & BRKADRINT) == 0 in ahc_probe_ext_scbram()
1124 || (ahc_inb(ahc, ERROR) & MPARERR) == 0)) in ahc_probe_ext_scbram()
1131 if ((ahc->features & AHC_LARGE_SCBS) != 0) { in ahc_probe_ext_scbram()
1132 ahc_scbram_config(ahc, enable, pcheck, fast, /*large*/TRUE); in ahc_probe_ext_scbram()
1133 test_num_scbs = ahc_probe_scbs(ahc); in ahc_probe_ext_scbram()
1144 ahc->flags |= AHC_SCB_BTT; in ahc_probe_ext_scbram()
1153 ahc_outb(ahc, SEQCTL, PERRORDIS|FAILDIS); in ahc_probe_ext_scbram()
1155 ahc_outb(ahc, CLRINT, CLRPARERR); in ahc_probe_ext_scbram()
1156 ahc_outb(ahc, CLRINT, CLRBRKADRINT); in ahc_probe_ext_scbram()
1159 ahc_name(ahc), fast ? "fast" : "slow", in ahc_probe_ext_scbram()
1163 ahc_scbram_config(ahc, enable, pcheck, fast, large); in ahc_probe_ext_scbram()
1171 ahc_pci_test_register_access(struct ahc_softc *ahc) in ahc_pci_test_register_access() argument
1184 cmd = ahc_pci_read_config(ahc->dev_softc, PCIR_COMMAND, /*bytes*/2); in ahc_pci_test_register_access()
1185 ahc_pci_write_config(ahc->dev_softc, PCIR_COMMAND, in ahc_pci_test_register_access()
1196 hcntrl = ahc_inb(ahc, HCNTRL); in ahc_pci_test_register_access()
1207 ahc->flags |= AHC_NO_BIOS_INIT; in ahc_pci_test_register_access()
1219 ahc_outb(ahc, HCNTRL, hcntrl|PAUSE); in ahc_pci_test_register_access()
1220 while (ahc_is_paused(ahc) == 0) in ahc_pci_test_register_access()
1224 status1 = ahc_pci_read_config(ahc->dev_softc, in ahc_pci_test_register_access()
1226 ahc_pci_write_config(ahc->dev_softc, PCIR_STATUS + 1, in ahc_pci_test_register_access()
1228 ahc_outb(ahc, CLRINT, CLRPARERR); in ahc_pci_test_register_access()
1230 ahc_outb(ahc, SEQCTL, PERRORDIS); in ahc_pci_test_register_access()
1231 ahc_outb(ahc, SCBPTR, 0); in ahc_pci_test_register_access()
1232 ahc_outl(ahc, SCB_BASE, 0x5aa555aa); in ahc_pci_test_register_access()
1233 if (ahc_inl(ahc, SCB_BASE) != 0x5aa555aa) in ahc_pci_test_register_access()
1236 status1 = ahc_pci_read_config(ahc->dev_softc, in ahc_pci_test_register_access()
1245 status1 = ahc_pci_read_config(ahc->dev_softc, in ahc_pci_test_register_access()
1247 ahc_pci_write_config(ahc->dev_softc, PCIR_STATUS + 1, in ahc_pci_test_register_access()
1249 ahc_outb(ahc, CLRINT, CLRPARERR); in ahc_pci_test_register_access()
1250 ahc_outb(ahc, SEQCTL, PERRORDIS|FAILDIS); in ahc_pci_test_register_access()
1251 ahc_pci_write_config(ahc->dev_softc, PCIR_COMMAND, cmd, /*bytes*/2); in ahc_pci_test_register_access()
1260 check_extport(struct ahc_softc *ahc, u_int *sxfrctl1) in check_extport() argument
1267 sd.sd_ahc = ahc; in check_extport()
1271 sc = ahc->seep_config; in check_extport()
1279 if (ahc->flags & AHC_LARGE_SEEPROM) in check_extport()
1291 have_seeprom = ahc_acquire_seeprom(ahc, &sd); in check_extport()
1295 printk("%s: Reading SEEPROM...", ahc_name(ahc)); in check_extport()
1300 start_addr = 32 * (ahc->channel - 'A'); in check_extport()
1324 ahc->flags |= AHC_LARGE_SEEPROM; in check_extport()
1335 ahc_outb(ahc, SCBPTR, 2); in check_extport()
1336 if (ahc_inb(ahc, SCB_BASE) == 'A' in check_extport()
1337 && ahc_inb(ahc, SCB_BASE + 1) == 'D' in check_extport()
1338 && ahc_inb(ahc, SCB_BASE + 2) == 'P' in check_extport()
1339 && ahc_inb(ahc, SCB_BASE + 3) == 'T') { in check_extport()
1348 *sc_data = ahc_inb(ahc, SRAM_BASE + j) in check_extport()
1349 | ahc_inb(ahc, SRAM_BASE + j + 1) << 8; in check_extport()
1353 ahc->flags |= AHC_SCB_CONFIG_USED; in check_extport()
1359 ahc_outb(ahc, CLRINT, CLRPARERR); in check_extport()
1360 ahc_outb(ahc, CLRINT, CLRBRKADRINT); in check_extport()
1365 printk("%s: No SEEPROM available.\n", ahc_name(ahc)); in check_extport()
1366 ahc->flags |= AHC_USEDEFAULTS; in check_extport()
1367 kfree(ahc->seep_config); in check_extport()
1368 ahc->seep_config = NULL; in check_extport()
1371 ahc_parse_pci_eeprom(ahc, sc); in check_extport()
1387 if ((ahc->features & AHC_SPIOCAP) != 0) { in check_extport()
1388 if ((ahc_inb(ahc, SPIOCAP) & SSPIOCPS) == 0) in check_extport()
1393 ahc->flags |= AHC_HAS_TERM_LOGIC; in check_extport()
1394 ahc_acquire_seeprom(ahc, &sd); in check_extport()
1395 configure_termination(ahc, &sd, sc->adapter_control, sxfrctl1); in check_extport()
1403 ahc_name(ahc), in check_extport()
1409 ahc_parse_pci_eeprom(struct ahc_softc *ahc, struct seeprom_config *sc) in ahc_parse_pci_eeprom() argument
1430 ahc->flags |= AHC_NEWEEPROM_FMT; in ahc_parse_pci_eeprom()
1443 if ((ahc->flags & AHC_NEWEEPROM_FMT) != 0) { in ahc_parse_pci_eeprom()
1455 if ((ahc->features & AHC_ULTRA2) != 0) { in ahc_parse_pci_eeprom()
1462 ahc_outb(ahc, TARG_OFFSET + i, offset); in ahc_parse_pci_eeprom()
1480 ahc_outb(ahc, TARG_SCSIRATE + i, scsirate); in ahc_parse_pci_eeprom()
1482 ahc->our_id = sc->brtime_id & CFSCSIID; in ahc_parse_pci_eeprom()
1484 scsi_conf = (ahc->our_id & 0x7); in ahc_parse_pci_eeprom()
1490 ahc->flags |= (sc->adapter_control & CFBOOTCHAN) >> CFBOOTCHANSHIFT; in ahc_parse_pci_eeprom()
1493 ahc->flags |= AHC_EXTENDED_TRANS_A; in ahc_parse_pci_eeprom()
1496 ahc->flags |= AHC_BIOS_ENABLED; in ahc_parse_pci_eeprom()
1497 if (ahc->features & AHC_ULTRA in ahc_parse_pci_eeprom()
1498 && (ahc->flags & AHC_NEWEEPROM_FMT) == 0) { in ahc_parse_pci_eeprom()
1510 devconfig = ahc_pci_read_config(ahc->dev_softc, in ahc_parse_pci_eeprom()
1515 ahc_pci_write_config(ahc->dev_softc, DEVCONFIG, in ahc_parse_pci_eeprom()
1519 ahc_outb(ahc, SCSICONF, scsi_conf); in ahc_parse_pci_eeprom()
1520 ahc_outb(ahc, DISC_DSB, ~(discenable & 0xff)); in ahc_parse_pci_eeprom()
1521 ahc_outb(ahc, DISC_DSB + 1, ~((discenable >> 8) & 0xff)); in ahc_parse_pci_eeprom()
1522 ahc_outb(ahc, ULTRA_ENB, ultraenb & 0xff); in ahc_parse_pci_eeprom()
1523 ahc_outb(ahc, ULTRA_ENB + 1, (ultraenb >> 8) & 0xff); in ahc_parse_pci_eeprom()
1527 configure_termination(struct ahc_softc *ahc, in configure_termination() argument
1549 || (ahc->features & AHC_NEW_TERMCTL) != 0) { in configure_termination()
1564 if ((ahc->features & AHC_NEW_TERMCTL) != 0) { in configure_termination()
1565 ahc_new_term_detect(ahc, &enableSEC_low, in configure_termination()
1573 ahc_name(ahc)); in configure_termination()
1581 ahc_name(ahc)); in configure_termination()
1589 } else if ((ahc->features & AHC_SPIOCAP) != 0) { in configure_termination()
1590 aic785X_cable_detect(ahc, &internal50_present, in configure_termination()
1596 aic787X_cable_detect(ahc, &internal50_present, in configure_termination()
1602 if ((ahc->features & AHC_WIDE) == 0) in configure_termination()
1606 && (ahc->features & AHC_ULTRA2) == 0) { in configure_termination()
1608 ahc_name(ahc), in configure_termination()
1611 if ((ahc->features & AHC_WIDE) != 0) in configure_termination()
1615 ahc_name(ahc), in configure_termination()
1620 ahc_name(ahc), eeprom_present ? "is" : "not"); in configure_termination()
1622 if ((ahc->flags & AHC_INT50_SPEEDFLEX) != 0) { in configure_termination()
1641 if ((ahc->features & AHC_ULTRA2) == 0 in configure_termination()
1648 "time!\n", ahc_name(ahc)); in configure_termination()
1660 if ((ahc->features & AHC_WIDE) != 0 in configure_termination()
1666 if ((ahc->flags & AHC_INT50_SPEEDFLEX) != 0) in configure_termination()
1668 "Enabled\n", ahc_name(ahc)); in configure_termination()
1671 "Enabled\n", ahc_name(ahc), in configure_termination()
1680 if ((ahc->features & AHC_ULTRA2) != 0) in configure_termination()
1685 if ((ahc->flags & AHC_INT50_SPEEDFLEX) != 0) in configure_termination()
1687 "Enabled\n", ahc_name(ahc)); in configure_termination()
1690 "Enabled\n", ahc_name(ahc), in configure_termination()
1700 "Enabled\n", ahc_name(ahc)); in configure_termination()
1707 ahc_outb(ahc, SXFRCTL1, *sxfrctl1); in configure_termination()
1714 ahc_name(ahc)); in configure_termination()
1717 write_brdctl(ahc, brddat); in configure_termination()
1725 ahc_name(ahc), in configure_termination()
1726 (ahc->features & AHC_ULTRA2) ? "Primary " in configure_termination()
1731 && (ahc->features & AHC_WIDE) != 0) { in configure_termination()
1735 ahc_name(ahc), in configure_termination()
1736 (ahc->features & AHC_ULTRA2) in configure_termination()
1744 ahc_outb(ahc, SXFRCTL1, *sxfrctl1); in configure_termination()
1746 if ((ahc->features & AHC_WIDE) != 0) in configure_termination()
1747 write_brdctl(ahc, brddat); in configure_termination()
1753 ahc_new_term_detect(struct ahc_softc *ahc, int *enableSEC_low, in ahc_new_term_detect() argument
1766 brdctl = read_brdctl(ahc); in ahc_new_term_detect()
1775 aic787X_cable_detect(struct ahc_softc *ahc, int *internal50_present, in aic787X_cable_detect() argument
1788 write_brdctl(ahc, 0); in aic787X_cable_detect()
1795 brdctl = read_brdctl(ahc); in aic787X_cable_detect()
1803 write_brdctl(ahc, BRDDAT5); in aic787X_cable_detect()
1810 brdctl = read_brdctl(ahc); in aic787X_cable_detect()
1816 aic785X_cable_detect(struct ahc_softc *ahc, int *internal50_present, in aic785X_cable_detect() argument
1822 spiocap = ahc_inb(ahc, SPIOCAP); in aic785X_cable_detect()
1825 ahc_outb(ahc, SPIOCAP, spiocap); in aic785X_cable_detect()
1826 ahc_outb(ahc, BRDCTL, BRDRW|BRDCS); in aic785X_cable_detect()
1827 ahc_flush_device_writes(ahc); in aic785X_cable_detect()
1829 ahc_outb(ahc, BRDCTL, 0); in aic785X_cable_detect()
1830 ahc_flush_device_writes(ahc); in aic785X_cable_detect()
1832 brdctl = ahc_inb(ahc, BRDCTL); in aic785X_cable_detect()
1835 *eeprom_present = (ahc_inb(ahc, SPIOCAP) & EEPROM) ? 1 : 0; in aic785X_cable_detect()
1839 ahc_acquire_seeprom(struct ahc_softc *ahc, struct seeprom_descriptor *sd) in ahc_acquire_seeprom() argument
1843 if ((ahc->features & AHC_SPIOCAP) != 0 in ahc_acquire_seeprom()
1844 && (ahc_inb(ahc, SPIOCAP) & SEEPROM) == 0) in ahc_acquire_seeprom()
1874 write_brdctl(struct ahc_softc *ahc, uint8_t value) in write_brdctl() argument
1878 if ((ahc->chip & AHC_CHIPID_MASK) == AHC_AIC7895) { in write_brdctl()
1880 if (ahc->channel == 'B') in write_brdctl()
1882 } else if ((ahc->features & AHC_ULTRA2) != 0) { in write_brdctl()
1887 ahc_outb(ahc, BRDCTL, brdctl); in write_brdctl()
1888 ahc_flush_device_writes(ahc); in write_brdctl()
1890 ahc_outb(ahc, BRDCTL, brdctl); in write_brdctl()
1891 ahc_flush_device_writes(ahc); in write_brdctl()
1892 if ((ahc->features & AHC_ULTRA2) != 0) in write_brdctl()
1896 ahc_outb(ahc, BRDCTL, brdctl); in write_brdctl()
1897 ahc_flush_device_writes(ahc); in write_brdctl()
1898 if ((ahc->features & AHC_ULTRA2) != 0) in write_brdctl()
1902 ahc_outb(ahc, BRDCTL, brdctl); in write_brdctl()
1906 read_brdctl(struct ahc_softc *ahc) in read_brdctl() argument
1911 if ((ahc->chip & AHC_CHIPID_MASK) == AHC_AIC7895) { in read_brdctl()
1913 if (ahc->channel == 'B') in read_brdctl()
1915 } else if ((ahc->features & AHC_ULTRA2) != 0) { in read_brdctl()
1920 ahc_outb(ahc, BRDCTL, brdctl); in read_brdctl()
1921 ahc_flush_device_writes(ahc); in read_brdctl()
1922 value = ahc_inb(ahc, BRDCTL); in read_brdctl()
1923 ahc_outb(ahc, BRDCTL, 0); in read_brdctl()
1928 ahc_pci_intr(struct ahc_softc *ahc) in ahc_pci_intr() argument
1933 error = ahc_inb(ahc, ERROR); in ahc_pci_intr()
1937 status1 = ahc_pci_read_config(ahc->dev_softc, in ahc_pci_intr()
1941 ahc_name(ahc), in ahc_pci_intr()
1942 ahc_inb(ahc, SEQADDR0) | (ahc_inb(ahc, SEQADDR1) << 8)); in ahc_pci_intr()
1945 ahc->pci_target_perr_count++; in ahc_pci_intr()
1947 "or write data phase\n", ahc_name(ahc)); in ahc_pci_intr()
1950 printk("%s: Signal System Error Detected\n", ahc_name(ahc)); in ahc_pci_intr()
1953 printk("%s: Received a Master Abort\n", ahc_name(ahc)); in ahc_pci_intr()
1956 printk("%s: Received a Target Abort\n", ahc_name(ahc)); in ahc_pci_intr()
1959 printk("%s: Signaled a Target Abort\n", ahc_name(ahc)); in ahc_pci_intr()
1963 ahc_name(ahc)); in ahc_pci_intr()
1967 ahc_pci_write_config(ahc->dev_softc, PCIR_STATUS + 1, in ahc_pci_intr()
1972 "no status bits set\n", ahc_name(ahc)); in ahc_pci_intr()
1974 ahc_outb(ahc, CLRINT, CLRPARERR); in ahc_pci_intr()
1977 if (ahc->pci_target_perr_count > AHC_PCI_TARGET_PERR_THRESH) { in ahc_pci_intr()
1985 ahc_name(ahc), ahc_name(ahc), ahc_name(ahc), in ahc_pci_intr()
1986 ahc_name(ahc), ahc_name(ahc), ahc_name(ahc)); in ahc_pci_intr()
1987 ahc->seqctl |= FAILDIS; in ahc_pci_intr()
1988 ahc_outb(ahc, SEQCTL, ahc->seqctl); in ahc_pci_intr()
1990 ahc_unpause(ahc); in ahc_pci_intr()
1994 ahc_pci_chip_init(struct ahc_softc *ahc) in ahc_pci_chip_init() argument
1996 ahc_outb(ahc, DSCOMMAND0, ahc->bus_softc.pci_softc.dscommand0); in ahc_pci_chip_init()
1997 ahc_outb(ahc, DSPCISTATUS, ahc->bus_softc.pci_softc.dspcistatus); in ahc_pci_chip_init()
1998 if ((ahc->features & AHC_DT) != 0) { in ahc_pci_chip_init()
2001 sfunct = ahc_inb(ahc, SFUNCT) & ~ALT_MODE; in ahc_pci_chip_init()
2002 ahc_outb(ahc, SFUNCT, sfunct | ALT_MODE); in ahc_pci_chip_init()
2003 ahc_outb(ahc, OPTIONMODE, ahc->bus_softc.pci_softc.optionmode); in ahc_pci_chip_init()
2004 ahc_outw(ahc, TARGCRCCNT, ahc->bus_softc.pci_softc.targcrccnt); in ahc_pci_chip_init()
2005 ahc_outb(ahc, SFUNCT, sfunct); in ahc_pci_chip_init()
2006 ahc_outb(ahc, CRCCONTROL1, in ahc_pci_chip_init()
2007 ahc->bus_softc.pci_softc.crccontrol1); in ahc_pci_chip_init()
2009 if ((ahc->features & AHC_MULTI_FUNC) != 0) in ahc_pci_chip_init()
2010 ahc_outb(ahc, SCBBADDR, ahc->bus_softc.pci_softc.scbbaddr); in ahc_pci_chip_init()
2012 if ((ahc->features & AHC_ULTRA2) != 0) in ahc_pci_chip_init()
2013 ahc_outb(ahc, DFF_THRSH, ahc->bus_softc.pci_softc.dff_thrsh); in ahc_pci_chip_init()
2015 return (ahc_chip_init(ahc)); in ahc_pci_chip_init()
2020 ahc_pci_resume(struct ahc_softc *ahc) in ahc_pci_resume() argument
2028 ahc_pci_write_config(ahc->dev_softc, DEVCONFIG, in ahc_pci_resume()
2029 ahc->bus_softc.pci_softc.devconfig, /*bytes*/4); in ahc_pci_resume()
2030 ahc_pci_write_config(ahc->dev_softc, PCIR_COMMAND, in ahc_pci_resume()
2031 ahc->bus_softc.pci_softc.command, /*bytes*/1); in ahc_pci_resume()
2032 ahc_pci_write_config(ahc->dev_softc, CSIZE_LATTIME, in ahc_pci_resume()
2033 ahc->bus_softc.pci_softc.csize_lattime, /*bytes*/1); in ahc_pci_resume()
2034 if ((ahc->flags & AHC_HAS_TERM_LOGIC) != 0) { in ahc_pci_resume()
2038 sd.sd_ahc = ahc; in ahc_pci_resume()
2043 ahc_acquire_seeprom(ahc, &sd); in ahc_pci_resume()
2044 configure_termination(ahc, &sd, in ahc_pci_resume()
2045 ahc->seep_config->adapter_control, in ahc_pci_resume()
2053 ahc_aic785X_setup(struct ahc_softc *ahc) in ahc_aic785X_setup() argument
2058 pci = ahc->dev_softc; in ahc_aic785X_setup()
2059 ahc->channel = 'A'; in ahc_aic785X_setup()
2060 ahc->chip = AHC_AIC7850; in ahc_aic785X_setup()
2061 ahc->features = AHC_AIC7850_FE; in ahc_aic785X_setup()
2062 ahc->bugs |= AHC_TMODE_WIDEODD_BUG|AHC_CACHETHEN_BUG|AHC_PCI_MWI_BUG; in ahc_aic785X_setup()
2065 ahc->bugs |= AHC_PCI_2_1_RETRY_BUG; in ahc_aic785X_setup()
2066 ahc->instruction_ram_size = 512; in ahc_aic785X_setup()
2071 ahc_aic7860_setup(struct ahc_softc *ahc) in ahc_aic7860_setup() argument
2076 pci = ahc->dev_softc; in ahc_aic7860_setup()
2077 ahc->channel = 'A'; in ahc_aic7860_setup()
2078 ahc->chip = AHC_AIC7860; in ahc_aic7860_setup()
2079 ahc->features = AHC_AIC7860_FE; in ahc_aic7860_setup()
2080 ahc->bugs |= AHC_TMODE_WIDEODD_BUG|AHC_CACHETHEN_BUG|AHC_PCI_MWI_BUG; in ahc_aic7860_setup()
2083 ahc->bugs |= AHC_PCI_2_1_RETRY_BUG; in ahc_aic7860_setup()
2084 ahc->instruction_ram_size = 512; in ahc_aic7860_setup()
2089 ahc_apa1480_setup(struct ahc_softc *ahc) in ahc_apa1480_setup() argument
2093 error = ahc_aic7860_setup(ahc); in ahc_apa1480_setup()
2096 ahc->features |= AHC_REMOVABLE; in ahc_apa1480_setup()
2101 ahc_aic7870_setup(struct ahc_softc *ahc) in ahc_aic7870_setup() argument
2104 ahc->channel = 'A'; in ahc_aic7870_setup()
2105 ahc->chip = AHC_AIC7870; in ahc_aic7870_setup()
2106 ahc->features = AHC_AIC7870_FE; in ahc_aic7870_setup()
2107 ahc->bugs |= AHC_TMODE_WIDEODD_BUG|AHC_CACHETHEN_BUG|AHC_PCI_MWI_BUG; in ahc_aic7870_setup()
2108 ahc->instruction_ram_size = 512; in ahc_aic7870_setup()
2113 ahc_aic7870h_setup(struct ahc_softc *ahc) in ahc_aic7870h_setup() argument
2115 int error = ahc_aic7870_setup(ahc); in ahc_aic7870h_setup()
2117 ahc->features |= AHC_HVD; in ahc_aic7870h_setup()
2123 ahc_aha394X_setup(struct ahc_softc *ahc) in ahc_aha394X_setup() argument
2127 error = ahc_aic7870_setup(ahc); in ahc_aha394X_setup()
2129 error = ahc_aha394XX_setup(ahc); in ahc_aha394X_setup()
2134 ahc_aha394Xh_setup(struct ahc_softc *ahc) in ahc_aha394Xh_setup() argument
2136 int error = ahc_aha394X_setup(ahc); in ahc_aha394Xh_setup()
2138 ahc->features |= AHC_HVD; in ahc_aha394Xh_setup()
2144 ahc_aha398X_setup(struct ahc_softc *ahc) in ahc_aha398X_setup() argument
2148 error = ahc_aic7870_setup(ahc); in ahc_aha398X_setup()
2150 error = ahc_aha398XX_setup(ahc); in ahc_aha398X_setup()
2155 ahc_aha494X_setup(struct ahc_softc *ahc) in ahc_aha494X_setup() argument
2159 error = ahc_aic7870_setup(ahc); in ahc_aha494X_setup()
2161 error = ahc_aha494XX_setup(ahc); in ahc_aha494X_setup()
2166 ahc_aha494Xh_setup(struct ahc_softc *ahc) in ahc_aha494Xh_setup() argument
2168 int error = ahc_aha494X_setup(ahc); in ahc_aha494Xh_setup()
2170 ahc->features |= AHC_HVD; in ahc_aha494Xh_setup()
2176 ahc_aic7880_setup(struct ahc_softc *ahc) in ahc_aic7880_setup() argument
2181 pci = ahc->dev_softc; in ahc_aic7880_setup()
2182 ahc->channel = 'A'; in ahc_aic7880_setup()
2183 ahc->chip = AHC_AIC7880; in ahc_aic7880_setup()
2184 ahc->features = AHC_AIC7880_FE; in ahc_aic7880_setup()
2185 ahc->bugs |= AHC_TMODE_WIDEODD_BUG; in ahc_aic7880_setup()
2188 ahc->bugs |= AHC_PCI_2_1_RETRY_BUG; in ahc_aic7880_setup()
2190 ahc->bugs |= AHC_CACHETHEN_BUG|AHC_PCI_MWI_BUG; in ahc_aic7880_setup()
2192 ahc->instruction_ram_size = 512; in ahc_aic7880_setup()
2197 ahc_aic7880h_setup(struct ahc_softc *ahc) in ahc_aic7880h_setup() argument
2199 int error = ahc_aic7880_setup(ahc); in ahc_aic7880h_setup()
2201 ahc->features |= AHC_HVD; in ahc_aic7880h_setup()
2208 ahc_aha2940Pro_setup(struct ahc_softc *ahc) in ahc_aha2940Pro_setup() argument
2211 ahc->flags |= AHC_INT50_SPEEDFLEX; in ahc_aha2940Pro_setup()
2212 return (ahc_aic7880_setup(ahc)); in ahc_aha2940Pro_setup()
2216 ahc_aha394XU_setup(struct ahc_softc *ahc) in ahc_aha394XU_setup() argument
2220 error = ahc_aic7880_setup(ahc); in ahc_aha394XU_setup()
2222 error = ahc_aha394XX_setup(ahc); in ahc_aha394XU_setup()
2227 ahc_aha394XUh_setup(struct ahc_softc *ahc) in ahc_aha394XUh_setup() argument
2229 int error = ahc_aha394XU_setup(ahc); in ahc_aha394XUh_setup()
2231 ahc->features |= AHC_HVD; in ahc_aha394XUh_setup()
2237 ahc_aha398XU_setup(struct ahc_softc *ahc) in ahc_aha398XU_setup() argument
2241 error = ahc_aic7880_setup(ahc); in ahc_aha398XU_setup()
2243 error = ahc_aha398XX_setup(ahc); in ahc_aha398XU_setup()
2248 ahc_aic7890_setup(struct ahc_softc *ahc) in ahc_aic7890_setup() argument
2253 pci = ahc->dev_softc; in ahc_aic7890_setup()
2254 ahc->channel = 'A'; in ahc_aic7890_setup()
2255 ahc->chip = AHC_AIC7890; in ahc_aic7890_setup()
2256 ahc->features = AHC_AIC7890_FE; in ahc_aic7890_setup()
2257 ahc->flags |= AHC_NEWEEPROM_FMT; in ahc_aic7890_setup()
2260 ahc->bugs |= AHC_AUTOFLUSH_BUG|AHC_CACHETHEN_BUG; in ahc_aic7890_setup()
2261 ahc->instruction_ram_size = 768; in ahc_aic7890_setup()
2266 ahc_aic7892_setup(struct ahc_softc *ahc) in ahc_aic7892_setup() argument
2269 ahc->channel = 'A'; in ahc_aic7892_setup()
2270 ahc->chip = AHC_AIC7892; in ahc_aic7892_setup()
2271 ahc->features = AHC_AIC7892_FE; in ahc_aic7892_setup()
2272 ahc->flags |= AHC_NEWEEPROM_FMT; in ahc_aic7892_setup()
2273 ahc->bugs |= AHC_SCBCHAN_UPLOAD_BUG; in ahc_aic7892_setup()
2274 ahc->instruction_ram_size = 1024; in ahc_aic7892_setup()
2279 ahc_aic7895_setup(struct ahc_softc *ahc) in ahc_aic7895_setup() argument
2284 pci = ahc->dev_softc; in ahc_aic7895_setup()
2285 ahc->channel = ahc_get_pci_function(pci) == 1 ? 'B' : 'A'; in ahc_aic7895_setup()
2291 ahc->chip = AHC_AIC7895C; in ahc_aic7895_setup()
2292 ahc->features = AHC_AIC7895C_FE; in ahc_aic7895_setup()
2296 ahc->chip = AHC_AIC7895; in ahc_aic7895_setup()
2297 ahc->features = AHC_AIC7895_FE; in ahc_aic7895_setup()
2308 ahc->bugs |= AHC_PCI_MWI_BUG; in ahc_aic7895_setup()
2314 ahc->bugs |= AHC_TMODE_WIDEODD_BUG|AHC_PCI_2_1_RETRY_BUG in ahc_aic7895_setup()
2329 ahc->flags |= AHC_NEWEEPROM_FMT; in ahc_aic7895_setup()
2330 ahc->instruction_ram_size = 512; in ahc_aic7895_setup()
2335 ahc_aic7895h_setup(struct ahc_softc *ahc) in ahc_aic7895h_setup() argument
2337 int error = ahc_aic7895_setup(ahc); in ahc_aic7895h_setup()
2339 ahc->features |= AHC_HVD; in ahc_aic7895h_setup()
2345 ahc_aic7896_setup(struct ahc_softc *ahc) in ahc_aic7896_setup() argument
2349 pci = ahc->dev_softc; in ahc_aic7896_setup()
2350 ahc->channel = ahc_get_pci_function(pci) == 1 ? 'B' : 'A'; in ahc_aic7896_setup()
2351 ahc->chip = AHC_AIC7896; in ahc_aic7896_setup()
2352 ahc->features = AHC_AIC7896_FE; in ahc_aic7896_setup()
2353 ahc->flags |= AHC_NEWEEPROM_FMT; in ahc_aic7896_setup()
2354 ahc->bugs |= AHC_CACHETHEN_DIS_BUG; in ahc_aic7896_setup()
2355 ahc->instruction_ram_size = 768; in ahc_aic7896_setup()
2360 ahc_aic7899_setup(struct ahc_softc *ahc) in ahc_aic7899_setup() argument
2364 pci = ahc->dev_softc; in ahc_aic7899_setup()
2365 ahc->channel = ahc_get_pci_function(pci) == 1 ? 'B' : 'A'; in ahc_aic7899_setup()
2366 ahc->chip = AHC_AIC7899; in ahc_aic7899_setup()
2367 ahc->features = AHC_AIC7899_FE; in ahc_aic7899_setup()
2368 ahc->flags |= AHC_NEWEEPROM_FMT; in ahc_aic7899_setup()
2369 ahc->bugs |= AHC_SCBCHAN_UPLOAD_BUG; in ahc_aic7899_setup()
2370 ahc->instruction_ram_size = 1024; in ahc_aic7899_setup()
2375 ahc_aha29160C_setup(struct ahc_softc *ahc) in ahc_aha29160C_setup() argument
2379 error = ahc_aic7899_setup(ahc); in ahc_aha29160C_setup()
2382 ahc->features |= AHC_REMOVABLE; in ahc_aha29160C_setup()
2387 ahc_raid_setup(struct ahc_softc *ahc) in ahc_raid_setup() argument
2394 ahc_aha394XX_setup(struct ahc_softc *ahc) in ahc_aha394XX_setup() argument
2398 pci = ahc->dev_softc; in ahc_aha394XX_setup()
2401 ahc->channel = 'A'; in ahc_aha394XX_setup()
2404 ahc->channel = 'B'; in ahc_aha394XX_setup()
2410 ahc->channel = 'A'; in ahc_aha394XX_setup()
2416 ahc_aha398XX_setup(struct ahc_softc *ahc) in ahc_aha398XX_setup() argument
2420 pci = ahc->dev_softc; in ahc_aha398XX_setup()
2423 ahc->channel = 'A'; in ahc_aha398XX_setup()
2426 ahc->channel = 'B'; in ahc_aha398XX_setup()
2429 ahc->channel = 'C'; in ahc_aha398XX_setup()
2435 ahc->channel = 'A'; in ahc_aha398XX_setup()
2438 ahc->flags |= AHC_LARGE_SEEPROM; in ahc_aha398XX_setup()
2443 ahc_aha494XX_setup(struct ahc_softc *ahc) in ahc_aha494XX_setup() argument
2447 pci = ahc->dev_softc; in ahc_aha494XX_setup()
2450 ahc->channel = 'A'; in ahc_aha494XX_setup()
2453 ahc->channel = 'B'; in ahc_aha494XX_setup()
2456 ahc->channel = 'C'; in ahc_aha494XX_setup()
2459 ahc->channel = 'D'; in ahc_aha494XX_setup()
2465 ahc->channel = 'A'; in ahc_aha494XX_setup()
2467 ahc->flags |= AHC_LARGE_SEEPROM; in ahc_aha494XX_setup()