• Home
  • History
  • Annotate
  • Raw
  • Download
  • only in /freebsd-12-stable/sys/dev/aic7xxx/

Lines Matching refs:ahd

282 static int	ahd_check_extport(struct ahd_softc *ahd);
283 static void ahd_configure_termination(struct ahd_softc *ahd,
285 static void ahd_pci_split_intr(struct ahd_softc *ahd, u_int intstat);
337 ahd_pci_config(struct ahd_softc *ahd, struct ahd_pci_identity *entry)
345 ahd->description = entry->name;
349 device = aic_pci_read_config(ahd->dev_softc,
352 ahd->flags |= AHD_HOSTRAID_BOARD;
357 subvendor = aic_pci_read_config(ahd->dev_softc,
360 ahd->flags |= AHD_HP_BOARD;
362 error = entry->setup(ahd);
370 pci_find_cap(ahd->dev_softc, PCIY_PCIX, &ahd->pcix_ptr);
371 devconfig = aic_pci_read_config(ahd->dev_softc, DEVCONFIG, /*bytes*/4);
373 ahd->chip |= AHD_PCI;
375 ahd->bugs &= ~AHD_PCIX_BUG_MASK;
377 ahd->chip |= AHD_PCIX;
378 if (ahd->pcix_ptr == 0)
381 ahd->bus_description = pci_bus_modes[PCI_BUS_MODES_INDEX(devconfig)];
383 aic_power_state_change(ahd, AIC_POWER_STATE_D0);
385 error = ahd_pci_map_registers(ahd);
395 if ((ahd->flags & (AHD_39BIT_ADDRESSING|AHD_64BIT_ADDRESSING)) != 0) {
400 ahd_name(ahd));
401 devconfig = aic_pci_read_config(ahd->dev_softc,
404 aic_pci_write_config(ahd->dev_softc, DEVCONFIG,
409 command = aic_pci_read_config(ahd->dev_softc, PCIR_COMMAND, /*bytes*/2);
411 aic_pci_write_config(ahd->dev_softc, PCIR_COMMAND, command, /*bytes*/2);
413 error = ahd_softc_init(ahd);
417 ahd->bus_intr = ahd_pci_intr;
419 error = ahd_reset(ahd, /*reinit*/FALSE);
423 ahd->pci_cachesize =
424 aic_pci_read_config(ahd->dev_softc, CSIZE_LATTIME,
426 ahd->pci_cachesize *= 4;
428 ahd_set_modes(ahd, AHD_MODE_SCSI, AHD_MODE_SCSI);
430 error = ahd_check_extport(ahd);
435 error = ahd_init(ahd);
442 error = ahd_pci_map_int(ahd);
446 ahd_lock(ahd);
448 * Link this softc in with all other ahd instances.
450 ahd_softc_insert(ahd);
451 ahd_unlock(ahd);
460 ahd_pci_test_register_access(struct ahd_softc *ahd)
474 cmd = aic_pci_read_config(ahd->dev_softc, PCIR_COMMAND, /*bytes*/2);
475 aic_pci_write_config(ahd->dev_softc, PCIR_COMMAND,
486 hcntrl = ahd_inb(ahd, HCNTRL);
499 ahd_outb(ahd, HCNTRL, hcntrl|PAUSE);
500 while (ahd_is_paused(ahd) == 0)
504 ahd_set_modes(ahd, AHD_MODE_CFG, AHD_MODE_CFG);
505 targpcistat = ahd_inb(ahd, TARGPCISTAT);
506 ahd_outb(ahd, TARGPCISTAT, targpcistat);
507 pci_status1 = aic_pci_read_config(ahd->dev_softc,
509 aic_pci_write_config(ahd->dev_softc, PCIR_STATUS + 1,
511 ahd_set_modes(ahd, AHD_MODE_SCSI, AHD_MODE_SCSI);
512 ahd_outb(ahd, CLRINT, CLRPCIINT);
514 ahd_outb(ahd, SEQCTL0, PERRORDIS);
515 ahd_outl(ahd, SRAM_BASE, 0x5aa555aa);
516 if (ahd_inl(ahd, SRAM_BASE) != 0x5aa555aa)
519 if ((ahd_inb(ahd, INTSTAT) & PCIINT) != 0) {
522 ahd_set_modes(ahd, AHD_MODE_CFG, AHD_MODE_CFG);
523 targpcistat = ahd_inb(ahd, TARGPCISTAT);
531 if ((ahd_inb(ahd, INTSTAT) & PCIINT) != 0) {
533 ahd_set_modes(ahd, AHD_MODE_CFG, AHD_MODE_CFG);
534 targpcistat = ahd_inb(ahd, TARGPCISTAT);
537 ahd_outb(ahd, TARGPCISTAT, targpcistat);
538 pci_status1 = aic_pci_read_config(ahd->dev_softc,
540 aic_pci_write_config(ahd->dev_softc, PCIR_STATUS + 1,
542 ahd_outb(ahd, CLRINT, CLRPCIINT);
544 ahd_outb(ahd, SEQCTL0, PERRORDIS|FAILDIS);
545 aic_pci_write_config(ahd->dev_softc, PCIR_COMMAND, cmd, /*bytes*/2);
554 ahd_check_extport(struct ahd_softc *ahd)
562 sc = ahd->seep_config;
563 have_seeprom = ahd_acquire_seeprom(ahd);
572 ahd_name(ahd));
576 + (sizeof(vpd) * (ahd->channel - 'A'))) / 2;
578 error = ahd_read_seeprom(ahd, (uint16_t *)&vpd,
582 error = ahd_parse_vpddata(ahd, &vpd);
585 ahd_name(ahd),
589 printf("%s: Reading SEEPROM...", ahd_name(ahd));
592 start_addr = (sizeof(*sc) / 2) * (ahd->channel - 'A');
594 error = ahd_read_seeprom(ahd, (uint16_t *)sc,
611 ahd_release_seeprom(ahd);
624 ahd_set_scbptr(ahd, 0xFF);
625 nvram_scb = ahd_inb_scbram(ahd, SCB_BASE + NVRAM_SCB_OFFSET);
627 && ((ahd_inb_scbram(ahd, SCB_BASE + 0) == 'A'
628 && ahd_inb_scbram(ahd, SCB_BASE + 1) == 'D'
629 && ahd_inb_scbram(ahd, SCB_BASE + 2) == 'P'
630 && ahd_inb_scbram(ahd, SCB_BASE + 3) == 'T')
631 || (ahd_inb_scbram(ahd, SCB_BASE + 0) == 'B'
632 && ahd_inb_scbram(ahd, SCB_BASE + 1) == 'I'
633 && ahd_inb_scbram(ahd, SCB_BASE + 2) == 'O'
634 && ahd_inb_scbram(ahd, SCB_BASE + 3) == 'S')
635 || (ahd_inb_scbram(ahd, SCB_BASE + 0) == 'A'
636 && ahd_inb_scbram(ahd, SCB_BASE + 1) == 'S'
637 && ahd_inb_scbram(ahd, SCB_BASE + 2) == 'P'
638 && ahd_inb_scbram(ahd, SCB_BASE + 3) == 'I'))) {
642 ahd_set_scbptr(ahd, nvram_scb);
645 *sc_data++ = ahd_inw_scbram(ahd, SCB_BASE+i);
648 ahd->flags |= AHD_SCB_CONFIG_USED;
658 printf("%s: Seeprom Contents:", ahd_name(ahd));
668 printf("%s: No SEEPROM available.\n", ahd_name(ahd));
669 ahd->flags |= AHD_USEDEFAULTS;
670 error = ahd_default_config(ahd);
672 free(ahd->seep_config, M_DEVBUF);
673 ahd->seep_config = NULL;
675 error = ahd_parse_cfgdata(ahd, sc);
681 ahd_configure_termination(ahd, adapter_control);
687 ahd_configure_termination(struct ahd_softc *ahd, u_int adapter_control)
694 devconfig = aic_pci_read_config(ahd->dev_softc, DEVCONFIG, /*bytes*/4);
696 if ((ahd->flags & AHD_STPWLEVEL_A) != 0)
700 ahd_name(ahd), (devconfig & STPWLEVEL) ? "on" : "off");
701 aic_pci_write_config(ahd->dev_softc, DEVCONFIG, devconfig, /*bytes*/4);
704 if ((ahd->flags & AHD_CURRENT_SENSING) != 0) {
705 (void)ahd_write_flexport(ahd, FLXADDR_ROMSTAT_CURSENSECTL, 0);
711 error = ahd_read_flexport(ahd, FLXADDR_TERMCTL, &termctl);
715 ahd_name(ahd));
723 "Using Defaults.\n", ahd_name(ahd));
730 ahd_name(ahd));
738 "Using Defaults.\n", ahd_name(ahd));
745 sxfrctl1 = ahd_inb(ahd, SXFRCTL1) & ~STPWEN;
746 ahd->flags &= ~AHD_TERM_ENB_A;
748 ahd->flags |= AHD_TERM_ENB_A;
752 ahd_outb(ahd, SXFRCTL1, sxfrctl1|STPWEN);
753 ahd_outb(ahd, SXFRCTL1, sxfrctl1);
755 error = ahd_write_flexport(ahd, FLXADDR_TERMCTL, termctl);
758 ahd_name(ahd));
761 ahd_name(ahd),
765 ahd_name(ahd),
769 ahd_name(ahd),
773 ahd_name(ahd),
831 ahd_pci_intr(struct ahd_softc *ahd)
840 intstat = ahd_inb(ahd, INTSTAT);
843 ahd_pci_split_intr(ahd, intstat);
848 printf("%s: PCI error Interrupt\n", ahd_name(ahd));
849 saved_modes = ahd_save_modes(ahd);
850 ahd_dump_card_state(ahd);
851 ahd_set_modes(ahd, AHD_MODE_CFG, AHD_MODE_CFG);
856 pci_status[i] = ahd_inb(ahd, reg);
858 ahd_outb(ahd, reg, pci_status[i]);
875 printf(s, ahd_name(ahd), pci_status_source[i]);
879 pci_status1 = aic_pci_read_config(ahd->dev_softc,
881 aic_pci_write_config(ahd->dev_softc, PCIR_STATUS + 1,
883 ahd_restore_modes(ahd, saved_modes);
884 ahd_outb(ahd, CLRINT, CLRPCIINT);
885 ahd_unpause(ahd);
889 ahd_pci_split_intr(struct ahd_softc *ahd, u_int intstat)
903 pcix_status = aic_pci_read_config(ahd->dev_softc,
904 ahd->pcix_ptr + PCIXR_STATUS, /*bytes*/ 4);
906 ahd_name(ahd), pcix_status >> 16);
907 saved_modes = ahd_save_modes(ahd);
909 ahd_set_modes(ahd, i, i);
911 split_status[i] = ahd_inb(ahd, DCHSPLTSTAT0);
912 split_status1[i] = ahd_inb(ahd, DCHSPLTSTAT1);
914 ahd_outb(ahd, DCHSPLTSTAT0, split_status[i]);
915 ahd_outb(ahd, DCHSPLTSTAT1, split_status1[i]);
918 sg_split_status[i] = ahd_inb(ahd, SGSPLTSTAT0);
919 sg_split_status1[i] = ahd_inb(ahd, SGSPLTSTAT1);
921 ahd_outb(ahd, SGSPLTSTAT0, sg_split_status[i]);
922 ahd_outb(ahd, SGSPLTSTAT1, sg_split_status1[i]);
934 printf(s, ahd_name(ahd),
945 printf(s, ahd_name(ahd), "SG");
952 aic_pci_write_config(ahd->dev_softc, ahd->pcix_ptr + PCIXR_STATUS,
954 ahd_outb(ahd, CLRINT, CLRSPLTINT);
955 ahd_restore_modes(ahd, saved_modes);
959 ahd_aic7901_setup(struct ahd_softc *ahd)
962 ahd->chip = AHD_AIC7901;
963 ahd->features = AHD_AIC7901_FE;
964 return (ahd_aic790X_setup(ahd));
968 ahd_aic7901A_setup(struct ahd_softc *ahd)
971 ahd->chip = AHD_AIC7901A;
972 ahd->features = AHD_AIC7901A_FE;
973 return (ahd_aic790X_setup(ahd));
977 ahd_aic7902_setup(struct ahd_softc *ahd)
979 ahd->chip = AHD_AIC7902;
980 ahd->features = AHD_AIC7902_FE;
981 return (ahd_aic790X_setup(ahd));
985 ahd_aic790X_setup(struct ahd_softc *ahd)
990 pci = ahd->dev_softc;
994 ahd_name(ahd), rev);
998 ahd->channel = aic_get_pci_function(pci) + 'A';
1003 ahd->bugs |= AHD_SENT_SCB_UPDATE_BUG|AHD_ABORT_LQI_BUG
1018 AHD_SET_PRECOMP(ahd, AHD_PRECOMP_CUTBACK_29);
1020 if ((ahd->flags & AHD_HP_BOARD) == 0)
1021 AHD_SET_SLEWRATE(ahd, AHD_SLEWRATE_DEF_REVA);
1025 ahd->features |= AHD_RTI|AHD_NEW_IOCELL_OPTS
1027 ahd->bugs |= AHD_LQOOVERRUN_BUG|AHD_EARLY_REQ_BUG;
1032 if ((ahd->features & AHD_MULTI_FUNC) != 0)
1033 ahd->bugs |= AHD_INTCOLLISION_BUG|AHD_ABORT_LQI_BUG
1039 AHD_SET_PRECOMP(ahd, AHD_PRECOMP_CUTBACK_29);
1040 AHD_SET_SLEWRATE(ahd, AHD_SLEWRATE_DEF_REVB);
1041 AHD_SET_AMPLITUDE(ahd, AHD_AMPLITUDE_DEF);