Lines Matching defs:ahd
269 static int ahd_check_extport(struct ahd_softc *ahd);
270 static void ahd_configure_termination(struct ahd_softc *ahd,
272 static void ahd_pci_split_intr(struct ahd_softc *ahd, u_int intstat);
312 struct ahd_softc *ahd = device_private(self);
329 ahd->sc_dev = self;
330 ahd_set_name(ahd, device_xname(self));
331 ahd->parent_dmat = pa->pa_dmat;
346 ahd->bus_data = bd;
348 ahd->description = entry->name;
350 ahd->seep_config = malloc(sizeof(*ahd->seep_config),
353 LIST_INIT(&ahd->pending_scbs);
354 ahd_timer_init(&ahd->reset_timer);
355 ahd_timer_init(&ahd->stat_timer);
356 ahd->flags = AHD_SPCHK_ENB_A|AHD_RESET_BUS_A|AHD_TERM_ENB_A
358 ahd->int_coalescing_timer = AHD_INT_COALESCING_TIMER_DEFAULT;
359 ahd->int_coalescing_maxcmds = AHD_INT_COALESCING_MAXCMDS_DEFAULT;
360 ahd->int_coalescing_mincmds = AHD_INT_COALESCING_MINCMDS_DEFAULT;
361 ahd->int_coalescing_threshold = AHD_INT_COALESCING_THRESHOLD_DEFAULT;
362 ahd->int_coalescing_stop_threshold =
365 if (ahd_platform_alloc(ahd, NULL) != 0) {
366 ahd_free(ahd);
375 ahd->flags |= AHD_HP_BOARD;
377 error = entry->setup(ahd, pa);
383 ahd->chip |= AHD_PCI;
385 ahd->bugs &= ~AHD_PCIX_BUG_MASK;
387 ahd->chip |= AHD_PCIX;
389 ahd->bus_description = pci_bus_modes[PCI_BUS_MODES_INDEX(devconfig)];
395 if (ahd->chip & AHD_PCIX)
398 ahd->chip &= ~AHD_PCIX;
399 ahd->chip |= AHD_PCI;
400 ahd->bugs &= ~AHD_PCIX_BUG_MASK;
406 if ((ahd->bugs & AHD_PCIX_MMAPIO_BUG) == 0) {
413 memtype, 0, &ahd->tags[0],
414 &ahd->bshs[0],
417 ahd->tags[1] = ahd->tags[0];
418 bus_space_subregion(ahd->tags[0], ahd->bshs[0],
421 &ahd->bshs[1]);
422 if (ahd_pci_test_register_access(ahd) != 0)
429 ahd_name(ahd), memtype);
440 ahd_name(ahd), ahd->bshs[0], ahd->bshs[1]);
448 &ahd->tags[0], &ahd->bshs[0],
454 &ahd->tags[1], &ahd->bshs[1],
465 ahd_name(ahd), ahd->bshs[0], ahd->bshs[1]);
471 aprint_error("%s: unable to map registers\n", ahd_name(ahd));
489 ahd->flags |= AHD_39BIT_ADDRESSING;
497 if ((ahd->flags & (AHD_39BIT_ADDRESSING|AHD_64BIT_ADDRESSING)) != 0) {
500 aprint_normal("%s: Enabling 39Bit Addressing\n", ahd_name(ahd));
511 ahd_softc_init(ahd);
516 ahd->bus_intr = ahd_pci_intr;
518 error = ahd_reset(ahd, /*reinit*/FALSE);
520 ahd_free(ahd);
525 aprint_error("%s: couldn't map interrupt\n", ahd_name(ahd));
526 ahd_free(ahd);
530 ahd->ih = pci_intr_establish_xname(pa->pa_pc, ih, IPL_BIO, ahd_intr,
531 ahd, device_xname(self));
532 if (ahd->ih == NULL) {
534 ahd_name(ahd));
538 ahd_free(ahd);
542 aprint_normal("%s: interrupting at %s\n", ahd_name(ahd),
546 ahd->pci_cachesize = pci_conf_read(pa->pa_pc, pa->pa_tag, PCI_BHLC_REG);
547 ahd->pci_cachesize *= 4;
549 ahd_set_modes(ahd, AHD_MODE_SCSI, AHD_MODE_SCSI);
551 error = ahd_check_extport(ahd);
556 error = ahd_init(ahd);
561 * Link this softc in with all other ahd instances.
563 ahd_attach(ahd);
574 ahd_pci_test_register_access(struct ahd_softc *ahd)
577 struct ahd_pci_busdata *bd = ahd->bus_data;
601 hcntrl = ahd_inb(ahd, HCNTRL);
614 ahd_outb(ahd, HCNTRL, hcntrl|PAUSE);
615 while (ahd_is_paused(ahd) == 0)
619 ahd_set_modes(ahd, AHD_MODE_CFG, AHD_MODE_CFG);
620 targpcistat = ahd_inb(ahd, TARGPCISTAT);
621 ahd_outb(ahd, TARGPCISTAT, targpcistat);
624 ahd_set_modes(ahd, AHD_MODE_SCSI, AHD_MODE_SCSI);
625 ahd_outb(ahd, CLRINT, CLRPCIINT);
627 ahd_outb(ahd, SEQCTL0, PERRORDIS);
628 ahd_outl(ahd, SRAM_BASE, 0x5aa555aa);
629 if (ahd_inl(ahd, SRAM_BASE) != 0x5aa555aa)
632 if ((ahd_inb(ahd, INTSTAT) & PCIINT) != 0) {
635 ahd_set_modes(ahd, AHD_MODE_CFG, AHD_MODE_CFG);
636 trgpcistat = ahd_inb(ahd, TARGPCISTAT);
644 if ((ahd_inb(ahd, INTSTAT) & PCIINT) != 0) {
646 ahd_set_modes(ahd, AHD_MODE_CFG, AHD_MODE_CFG);
647 targpcistat = ahd_inb(ahd, TARGPCISTAT);
650 ahd_outb(ahd, TARGPCISTAT, targpcistat);
655 ahd_outb(ahd, CLRINT, CLRPCIINT);
657 ahd_outb(ahd, SEQCTL0, PERRORDIS|FAILDIS);
667 ahd_check_extport(struct ahd_softc *ahd)
675 sc = ahd->seep_config;
676 have_seeprom = ahd_acquire_seeprom(ahd);
685 ahd_name(ahd));
689 + (sizeof(vpd) * (ahd->channel - 'A'))) / 2;
691 error = ahd_read_seeprom(ahd, (uint16_t *)&vpd,
695 error = ahd_parse_vpddata(ahd, &vpd);
698 ahd_name(ahd),
703 printf("%s: Reading SEEPROM...", ahd_name(ahd));
707 start_addr = (sizeof(*sc) / 2) * (ahd->channel - 'A');
709 error = ahd_read_seeprom(ahd, (uint16_t *)sc,
727 ahd_release_seeprom(ahd);
740 ahd_set_scbptr(ahd, 0xFF);
741 nvram_scb = ahd_inb_scbram(ahd, SCB_BASE + NVRAM_SCB_OFFSET);
743 && ((ahd_inb_scbram(ahd, SCB_BASE + 0) == 'A'
744 && ahd_inb_scbram(ahd, SCB_BASE + 1) == 'D'
745 && ahd_inb_scbram(ahd, SCB_BASE + 2) == 'P'
746 && ahd_inb_scbram(ahd, SCB_BASE + 3) == 'T')
747 || (ahd_inb_scbram(ahd, SCB_BASE + 0) == 'B'
748 && ahd_inb_scbram(ahd, SCB_BASE + 1) == 'I'
749 && ahd_inb_scbram(ahd, SCB_BASE + 2) == 'O'
750 && ahd_inb_scbram(ahd, SCB_BASE + 3) == 'S')
751 || (ahd_inb_scbram(ahd, SCB_BASE + 0) == 'A'
752 && ahd_inb_scbram(ahd, SCB_BASE + 1) == 'S'
753 && ahd_inb_scbram(ahd, SCB_BASE + 2) == 'P'
754 && ahd_inb_scbram(ahd, SCB_BASE + 3) == 'I'))) {
758 ahd_set_scbptr(ahd, nvram_scb);
761 *sc_data++ = ahd_inw_scbram(ahd, SCB_BASE+i);
764 ahd->flags |= AHD_SCB_CONFIG_USED;
773 printf("%s: Seeprom Contents:", ahd_name(ahd));
782 aprint_error("%s: No SEEPROM available.\n", ahd_name(ahd));
783 ahd->flags |= AHD_USEDEFAULTS;
784 error = ahd_default_config(ahd);
786 free(ahd->seep_config, M_DEVBUF);
787 ahd->seep_config = NULL;
789 error = ahd_parse_cfgdata(ahd, sc);
795 ahd_configure_termination(ahd, adapter_control);
801 ahd_configure_termination(struct ahd_softc *ahd, u_int adapter_control)
807 struct ahd_pci_busdata *bd = ahd->bus_data;
811 if ((ahd->flags & AHD_STPWLEVEL_A) != 0)
815 ahd_name(ahd), (devconfig & STPWLEVEL) ? "on" : "off");
820 if ((ahd->flags & AHD_CURRENT_SENSING) != 0) {
821 (void)ahd_write_flexport(ahd, FLXADDR_ROMSTAT_CURSENSECTL, 0);
827 error = ahd_read_flexport(ahd, FLXADDR_TERMCTL, &termctl);
831 ahd_name(ahd));
840 "Using Defaults.\n", ahd_name(ahd));
847 ahd_name(ahd));
856 "Using Defaults.\n", ahd_name(ahd));
863 sxfrctl1 = ahd_inb(ahd, SXFRCTL1) & ~STPWEN;
865 ahd->flags |= AHD_TERM_ENB_A;
869 ahd_outb(ahd, SXFRCTL1, sxfrctl1|STPWEN);
870 ahd_outb(ahd, SXFRCTL1, sxfrctl1);
872 error = ahd_write_flexport(ahd, FLXADDR_TERMCTL, termctl);
875 ahd_name(ahd));
879 ahd_name(ahd),
883 ahd_name(ahd),
887 ahd_name(ahd),
891 ahd_name(ahd),
950 ahd_pci_intr(struct ahd_softc *ahd)
958 struct ahd_pci_busdata *bd = ahd->bus_data;
960 intstat = ahd_inb(ahd, INTSTAT);
963 ahd_pci_split_intr(ahd, intstat);
968 printf("%s: PCI error Interrupt\n", ahd_name(ahd));
969 saved_modes = ahd_save_modes(ahd);
970 ahd_dump_card_state(ahd);
971 ahd_set_modes(ahd, AHD_MODE_CFG, AHD_MODE_CFG);
976 pci_status[i] = ahd_inb(ahd, reg);
978 ahd_outb(ahd, reg, pci_status[i]);
995 printf(s, ahd_name(ahd), pci_status_source[i]);
1002 ahd_restore_modes(ahd, saved_modes);
1003 ahd_outb(ahd, CLRINT, CLRPCIINT);
1004 ahd_unpause(ahd);
1010 ahd_pci_split_intr(struct ahd_softc *ahd, u_int intstat)
1019 struct ahd_pci_busdata *bd = ahd->bus_data;
1028 ahd_name(ahd), pcix_status);
1030 saved_modes = ahd_save_modes(ahd);
1032 ahd_set_modes(ahd, i, i);
1034 split_status[i] = ahd_inb(ahd, DCHSPLTSTAT0);
1035 split_status1[i] = ahd_inb(ahd, DCHSPLTSTAT1);
1037 ahd_outb(ahd, DCHSPLTSTAT0, split_status[i]);
1038 ahd_outb(ahd, DCHSPLTSTAT1, split_status1[i]);
1041 sg_split_status[i] = ahd_inb(ahd, SGSPLTSTAT0);
1042 sg_split_status1[i] = ahd_inb(ahd, SGSPLTSTAT1);
1044 ahd_outb(ahd, SGSPLTSTAT0, sg_split_status[i]);
1045 ahd_outb(ahd, SGSPLTSTAT1, sg_split_status1[i]);
1057 printf(s, ahd_name(ahd),
1068 printf(s, ahd_name(ahd), "SG");
1077 ahd_outb(ahd, CLRINT, CLRSPLTINT);
1078 ahd_restore_modes(ahd, saved_modes);
1082 ahd_aic7901_setup(struct ahd_softc *ahd, struct pci_attach_args *pa)
1085 ahd->chip = AHD_AIC7901;
1086 ahd->features = AHD_AIC7901_FE;
1087 return (ahd_aic790X_setup(ahd, pa));
1091 ahd_aic7901A_setup(struct ahd_softc *ahd, struct pci_attach_args *pa)
1094 ahd->chip = AHD_AIC7901A;
1095 ahd->features = AHD_AIC7901A_FE;
1096 return (ahd_aic790X_setup(ahd, pa));
1100 ahd_aic7902_setup(struct ahd_softc *ahd, struct pci_attach_args *pa)
1103 ahd->chip = AHD_AIC7902;
1104 ahd->features = AHD_AIC7902_FE;
1105 return (ahd_aic790X_setup(ahd, pa));
1109 ahd_aic790X_setup(struct ahd_softc *ahd, struct pci_attach_args *pa)
1115 printf("\n%s: aic7902 chip revision 0x%x\n", ahd_name(ahd), rev);
1119 "unsupported chip revision %d\n", ahd_name(ahd), rev);
1125 ahd->channel = (pa->pa_function == 1) ? 'B' : 'A';
1130 ahd->bugs |= AHD_SENT_SCB_UPDATE_BUG|AHD_ABORT_LQI_BUG
1146 AHD_SET_PRECOMP(ahd, AHD_PRECOMP_CUTBACK_29);
1148 if ((ahd->flags & AHD_HP_BOARD) == 0)
1149 AHD_SET_SLEWRATE(ahd, AHD_SLEWRATE_DEF_REVA);
1153 ahd->features |= AHD_RTI|AHD_NEW_IOCELL_OPTS
1155 ahd->bugs |= AHD_LQOOVERRUN_BUG|AHD_EARLY_REQ_BUG;
1160 if ((ahd->features & AHD_MULTI_FUNC) != 0)
1161 ahd->bugs |= AHD_INTCOLLISION_BUG|AHD_ABORT_LQI_BUG;
1166 AHD_SET_PRECOMP(ahd, AHD_PRECOMP_CUTBACK_29);
1167 AHD_SET_SLEWRATE(ahd, AHD_SLEWRATE_DEF_REVB);
1168 AHD_SET_AMPLITUDE(ahd, AHD_AMPLITUDE_DEF);