Lines Matching refs:ahd
250 static int ahd_check_extport(struct ahd_softc *ahd);
251 static void ahd_configure_termination(struct ahd_softc *ahd,
253 static void ahd_pci_split_intr(struct ahd_softc *ahd, u_int intstat);
254 static void ahd_pci_intr(struct ahd_softc *ahd);
295 ahd_pci_config(struct ahd_softc *ahd, const struct ahd_pci_identity *entry) in ahd_pci_config() argument
304 ahd->description = entry->name; in ahd_pci_config()
308 subvendor = ahd_pci_read_config(ahd->dev_softc, in ahd_pci_config()
311 ahd->flags |= AHD_HP_BOARD; in ahd_pci_config()
313 error = entry->setup(ahd); in ahd_pci_config()
317 devconfig = ahd_pci_read_config(ahd->dev_softc, DEVCONFIG, /*bytes*/4); in ahd_pci_config()
319 ahd->chip |= AHD_PCI; in ahd_pci_config()
321 ahd->bugs &= ~AHD_PCIX_BUG_MASK; in ahd_pci_config()
323 ahd->chip |= AHD_PCIX; in ahd_pci_config()
325 ahd->bus_description = pci_bus_modes[PCI_BUS_MODES_INDEX(devconfig)]; in ahd_pci_config()
327 ahd_power_state_change(ahd, AHD_POWER_STATE_D0); in ahd_pci_config()
329 error = ahd_pci_map_registers(ahd); in ahd_pci_config()
339 if ((ahd->flags & (AHD_39BIT_ADDRESSING|AHD_64BIT_ADDRESSING)) != 0) { in ahd_pci_config()
342 ahd_name(ahd)); in ahd_pci_config()
343 devconfig = ahd_pci_read_config(ahd->dev_softc, in ahd_pci_config()
346 ahd_pci_write_config(ahd->dev_softc, DEVCONFIG, in ahd_pci_config()
351 command = ahd_pci_read_config(ahd->dev_softc, PCIR_COMMAND, /*bytes*/2); in ahd_pci_config()
353 ahd_pci_write_config(ahd->dev_softc, PCIR_COMMAND, command, /*bytes*/2); in ahd_pci_config()
355 error = ahd_softc_init(ahd); in ahd_pci_config()
359 ahd->bus_intr = ahd_pci_intr; in ahd_pci_config()
361 error = ahd_reset(ahd, /*reinit*/FALSE); in ahd_pci_config()
365 ahd->pci_cachesize = in ahd_pci_config()
366 ahd_pci_read_config(ahd->dev_softc, CSIZE_LATTIME, in ahd_pci_config()
368 ahd->pci_cachesize *= 4; in ahd_pci_config()
370 ahd_set_modes(ahd, AHD_MODE_SCSI, AHD_MODE_SCSI); in ahd_pci_config()
372 error = ahd_check_extport(ahd); in ahd_pci_config()
377 error = ahd_init(ahd); in ahd_pci_config()
380 ahd->init_level++; in ahd_pci_config()
385 return ahd_pci_map_int(ahd); in ahd_pci_config()
390 ahd_pci_suspend(struct ahd_softc *ahd) in ahd_pci_suspend() argument
396 ahd->suspend_state.pci_state.devconfig = in ahd_pci_suspend()
397 ahd_pci_read_config(ahd->dev_softc, DEVCONFIG, /*bytes*/4); in ahd_pci_suspend()
398 ahd->suspend_state.pci_state.command = in ahd_pci_suspend()
399 ahd_pci_read_config(ahd->dev_softc, PCIR_COMMAND, /*bytes*/1); in ahd_pci_suspend()
400 ahd->suspend_state.pci_state.csize_lattime = in ahd_pci_suspend()
401 ahd_pci_read_config(ahd->dev_softc, CSIZE_LATTIME, /*bytes*/1); in ahd_pci_suspend()
406 ahd_pci_resume(struct ahd_softc *ahd) in ahd_pci_resume() argument
408 ahd_pci_write_config(ahd->dev_softc, DEVCONFIG, in ahd_pci_resume()
409 ahd->suspend_state.pci_state.devconfig, /*bytes*/4); in ahd_pci_resume()
410 ahd_pci_write_config(ahd->dev_softc, PCIR_COMMAND, in ahd_pci_resume()
411 ahd->suspend_state.pci_state.command, /*bytes*/1); in ahd_pci_resume()
412 ahd_pci_write_config(ahd->dev_softc, CSIZE_LATTIME, in ahd_pci_resume()
413 ahd->suspend_state.pci_state.csize_lattime, /*bytes*/1); in ahd_pci_resume()
422 ahd_pci_test_register_access(struct ahd_softc *ahd) in ahd_pci_test_register_access() argument
436 cmd = ahd_pci_read_config(ahd->dev_softc, PCIR_COMMAND, /*bytes*/2); in ahd_pci_test_register_access()
437 ahd_pci_write_config(ahd->dev_softc, PCIR_COMMAND, in ahd_pci_test_register_access()
448 hcntrl = ahd_inb(ahd, HCNTRL); in ahd_pci_test_register_access()
461 ahd_outb(ahd, HCNTRL, hcntrl|PAUSE); in ahd_pci_test_register_access()
462 while (ahd_is_paused(ahd) == 0) in ahd_pci_test_register_access()
466 ahd_set_modes(ahd, AHD_MODE_CFG, AHD_MODE_CFG); in ahd_pci_test_register_access()
467 targpcistat = ahd_inb(ahd, TARGPCISTAT); in ahd_pci_test_register_access()
468 ahd_outb(ahd, TARGPCISTAT, targpcistat); in ahd_pci_test_register_access()
469 pci_status1 = ahd_pci_read_config(ahd->dev_softc, in ahd_pci_test_register_access()
471 ahd_pci_write_config(ahd->dev_softc, PCIR_STATUS + 1, in ahd_pci_test_register_access()
473 ahd_set_modes(ahd, AHD_MODE_SCSI, AHD_MODE_SCSI); in ahd_pci_test_register_access()
474 ahd_outb(ahd, CLRINT, CLRPCIINT); in ahd_pci_test_register_access()
476 ahd_outb(ahd, SEQCTL0, PERRORDIS); in ahd_pci_test_register_access()
477 ahd_outl(ahd, SRAM_BASE, 0x5aa555aa); in ahd_pci_test_register_access()
478 if (ahd_inl(ahd, SRAM_BASE) != 0x5aa555aa) in ahd_pci_test_register_access()
481 if ((ahd_inb(ahd, INTSTAT) & PCIINT) != 0) { in ahd_pci_test_register_access()
482 ahd_set_modes(ahd, AHD_MODE_CFG, AHD_MODE_CFG); in ahd_pci_test_register_access()
483 targpcistat = ahd_inb(ahd, TARGPCISTAT); in ahd_pci_test_register_access()
491 if ((ahd_inb(ahd, INTSTAT) & PCIINT) != 0) { in ahd_pci_test_register_access()
493 ahd_set_modes(ahd, AHD_MODE_CFG, AHD_MODE_CFG); in ahd_pci_test_register_access()
494 targpcistat = ahd_inb(ahd, TARGPCISTAT); in ahd_pci_test_register_access()
497 ahd_outb(ahd, TARGPCISTAT, targpcistat); in ahd_pci_test_register_access()
498 pci_status1 = ahd_pci_read_config(ahd->dev_softc, in ahd_pci_test_register_access()
500 ahd_pci_write_config(ahd->dev_softc, PCIR_STATUS + 1, in ahd_pci_test_register_access()
502 ahd_outb(ahd, CLRINT, CLRPCIINT); in ahd_pci_test_register_access()
504 ahd_outb(ahd, SEQCTL0, PERRORDIS|FAILDIS); in ahd_pci_test_register_access()
505 ahd_pci_write_config(ahd->dev_softc, PCIR_COMMAND, cmd, /*bytes*/2); in ahd_pci_test_register_access()
514 ahd_check_extport(struct ahd_softc *ahd) in ahd_check_extport() argument
522 sc = ahd->seep_config; in ahd_check_extport()
523 have_seeprom = ahd_acquire_seeprom(ahd); in ahd_check_extport()
532 ahd_name(ahd)); in ahd_check_extport()
536 + (sizeof(vpd) * (ahd->channel - 'A'))) / 2; in ahd_check_extport()
538 error = ahd_read_seeprom(ahd, (uint16_t *)&vpd, in ahd_check_extport()
542 error = ahd_parse_vpddata(ahd, &vpd); in ahd_check_extport()
545 ahd_name(ahd), in ahd_check_extport()
549 printk("%s: Reading SEEPROM...", ahd_name(ahd)); in ahd_check_extport()
552 start_addr = (sizeof(*sc) / 2) * (ahd->channel - 'A'); in ahd_check_extport()
554 error = ahd_read_seeprom(ahd, (uint16_t *)sc, in ahd_check_extport()
571 ahd_release_seeprom(ahd); in ahd_check_extport()
584 ahd_set_scbptr(ahd, 0xFF); in ahd_check_extport()
585 nvram_scb = ahd_inb_scbram(ahd, SCB_BASE + NVRAM_SCB_OFFSET); in ahd_check_extport()
587 && ((ahd_inb_scbram(ahd, SCB_BASE + 0) == 'A' in ahd_check_extport()
588 && ahd_inb_scbram(ahd, SCB_BASE + 1) == 'D' in ahd_check_extport()
589 && ahd_inb_scbram(ahd, SCB_BASE + 2) == 'P' in ahd_check_extport()
590 && ahd_inb_scbram(ahd, SCB_BASE + 3) == 'T') in ahd_check_extport()
591 || (ahd_inb_scbram(ahd, SCB_BASE + 0) == 'B' in ahd_check_extport()
592 && ahd_inb_scbram(ahd, SCB_BASE + 1) == 'I' in ahd_check_extport()
593 && ahd_inb_scbram(ahd, SCB_BASE + 2) == 'O' in ahd_check_extport()
594 && ahd_inb_scbram(ahd, SCB_BASE + 3) == 'S') in ahd_check_extport()
595 || (ahd_inb_scbram(ahd, SCB_BASE + 0) == 'A' in ahd_check_extport()
596 && ahd_inb_scbram(ahd, SCB_BASE + 1) == 'S' in ahd_check_extport()
597 && ahd_inb_scbram(ahd, SCB_BASE + 2) == 'P' in ahd_check_extport()
598 && ahd_inb_scbram(ahd, SCB_BASE + 3) == 'I'))) { in ahd_check_extport()
602 ahd_set_scbptr(ahd, nvram_scb); in ahd_check_extport()
605 *sc_data++ = ahd_inw_scbram(ahd, SCB_BASE+i); in ahd_check_extport()
608 ahd->flags |= AHD_SCB_CONFIG_USED; in ahd_check_extport()
618 printk("%s: Seeprom Contents:", ahd_name(ahd)); in ahd_check_extport()
628 printk("%s: No SEEPROM available.\n", ahd_name(ahd)); in ahd_check_extport()
629 ahd->flags |= AHD_USEDEFAULTS; in ahd_check_extport()
630 error = ahd_default_config(ahd); in ahd_check_extport()
632 kfree(ahd->seep_config); in ahd_check_extport()
633 ahd->seep_config = NULL; in ahd_check_extport()
635 error = ahd_parse_cfgdata(ahd, sc); in ahd_check_extport()
641 ahd_configure_termination(ahd, adapter_control); in ahd_check_extport()
647 ahd_configure_termination(struct ahd_softc *ahd, u_int adapter_control) in ahd_configure_termination() argument
654 devconfig = ahd_pci_read_config(ahd->dev_softc, DEVCONFIG, /*bytes*/4); in ahd_configure_termination()
656 if ((ahd->flags & AHD_STPWLEVEL_A) != 0) in ahd_configure_termination()
660 ahd_name(ahd), (devconfig & STPWLEVEL) ? "on" : "off"); in ahd_configure_termination()
661 ahd_pci_write_config(ahd->dev_softc, DEVCONFIG, devconfig, /*bytes*/4); in ahd_configure_termination()
664 if ((ahd->flags & AHD_CURRENT_SENSING) != 0) { in ahd_configure_termination()
665 (void)ahd_write_flexport(ahd, FLXADDR_ROMSTAT_CURSENSECTL, 0); in ahd_configure_termination()
671 error = ahd_read_flexport(ahd, FLXADDR_TERMCTL, &termctl); in ahd_configure_termination()
675 ahd_name(ahd)); in ahd_configure_termination()
683 "Using Defaults.\n", ahd_name(ahd)); in ahd_configure_termination()
690 ahd_name(ahd)); in ahd_configure_termination()
698 "Using Defaults.\n", ahd_name(ahd)); in ahd_configure_termination()
705 sxfrctl1 = ahd_inb(ahd, SXFRCTL1) & ~STPWEN; in ahd_configure_termination()
706 ahd->flags &= ~AHD_TERM_ENB_A; in ahd_configure_termination()
708 ahd->flags |= AHD_TERM_ENB_A; in ahd_configure_termination()
712 ahd_outb(ahd, SXFRCTL1, sxfrctl1|STPWEN); in ahd_configure_termination()
713 ahd_outb(ahd, SXFRCTL1, sxfrctl1); in ahd_configure_termination()
715 error = ahd_write_flexport(ahd, FLXADDR_TERMCTL, termctl); in ahd_configure_termination()
718 ahd_name(ahd)); in ahd_configure_termination()
721 ahd_name(ahd), in ahd_configure_termination()
725 ahd_name(ahd), in ahd_configure_termination()
729 ahd_name(ahd), in ahd_configure_termination()
733 ahd_name(ahd), in ahd_configure_termination()
791 ahd_pci_intr(struct ahd_softc *ahd) in ahd_pci_intr() argument
800 intstat = ahd_inb(ahd, INTSTAT); in ahd_pci_intr()
803 ahd_pci_split_intr(ahd, intstat); in ahd_pci_intr()
808 printk("%s: PCI error Interrupt\n", ahd_name(ahd)); in ahd_pci_intr()
809 saved_modes = ahd_save_modes(ahd); in ahd_pci_intr()
810 ahd_dump_card_state(ahd); in ahd_pci_intr()
811 ahd_set_modes(ahd, AHD_MODE_CFG, AHD_MODE_CFG); in ahd_pci_intr()
816 pci_status[i] = ahd_inb(ahd, reg); in ahd_pci_intr()
818 ahd_outb(ahd, reg, pci_status[i]); in ahd_pci_intr()
835 printk(s, ahd_name(ahd), pci_status_source[i]); in ahd_pci_intr()
839 pci_status1 = ahd_pci_read_config(ahd->dev_softc, in ahd_pci_intr()
841 ahd_pci_write_config(ahd->dev_softc, PCIR_STATUS + 1, in ahd_pci_intr()
843 ahd_restore_modes(ahd, saved_modes); in ahd_pci_intr()
844 ahd_outb(ahd, CLRINT, CLRPCIINT); in ahd_pci_intr()
845 ahd_unpause(ahd); in ahd_pci_intr()
849 ahd_pci_split_intr(struct ahd_softc *ahd, u_int intstat) in ahd_pci_split_intr() argument
863 pcix_status = ahd_pci_read_config(ahd->dev_softc, PCIXR_STATUS, in ahd_pci_split_intr()
866 ahd_name(ahd), pcix_status); in ahd_pci_split_intr()
867 saved_modes = ahd_save_modes(ahd); in ahd_pci_split_intr()
869 ahd_set_modes(ahd, i, i); in ahd_pci_split_intr()
871 split_status[i] = ahd_inb(ahd, DCHSPLTSTAT0); in ahd_pci_split_intr()
872 split_status1[i] = ahd_inb(ahd, DCHSPLTSTAT1); in ahd_pci_split_intr()
874 ahd_outb(ahd, DCHSPLTSTAT0, split_status[i]); in ahd_pci_split_intr()
875 ahd_outb(ahd, DCHSPLTSTAT1, split_status1[i]); in ahd_pci_split_intr()
878 sg_split_status[i] = ahd_inb(ahd, SGSPLTSTAT0); in ahd_pci_split_intr()
879 sg_split_status1[i] = ahd_inb(ahd, SGSPLTSTAT1); in ahd_pci_split_intr()
881 ahd_outb(ahd, SGSPLTSTAT0, sg_split_status[i]); in ahd_pci_split_intr()
882 ahd_outb(ahd, SGSPLTSTAT1, sg_split_status1[i]); in ahd_pci_split_intr()
891 printk(split_status_strings[bit], ahd_name(ahd), in ahd_pci_split_intr()
898 printk(split_status_strings[bit], ahd_name(ahd), "SG"); in ahd_pci_split_intr()
904 ahd_pci_write_config(ahd->dev_softc, PCIXR_STATUS, in ahd_pci_split_intr()
906 ahd_outb(ahd, CLRINT, CLRSPLTINT); in ahd_pci_split_intr()
907 ahd_restore_modes(ahd, saved_modes); in ahd_pci_split_intr()
911 ahd_aic7901_setup(struct ahd_softc *ahd) in ahd_aic7901_setup() argument
914 ahd->chip = AHD_AIC7901; in ahd_aic7901_setup()
915 ahd->features = AHD_AIC7901_FE; in ahd_aic7901_setup()
916 return (ahd_aic790X_setup(ahd)); in ahd_aic7901_setup()
920 ahd_aic7901A_setup(struct ahd_softc *ahd) in ahd_aic7901A_setup() argument
923 ahd->chip = AHD_AIC7901A; in ahd_aic7901A_setup()
924 ahd->features = AHD_AIC7901A_FE; in ahd_aic7901A_setup()
925 return (ahd_aic790X_setup(ahd)); in ahd_aic7901A_setup()
929 ahd_aic7902_setup(struct ahd_softc *ahd) in ahd_aic7902_setup() argument
931 ahd->chip = AHD_AIC7902; in ahd_aic7902_setup()
932 ahd->features = AHD_AIC7902_FE; in ahd_aic7902_setup()
933 return (ahd_aic790X_setup(ahd)); in ahd_aic7902_setup()
937 ahd_aic790X_setup(struct ahd_softc *ahd) in ahd_aic790X_setup() argument
942 pci = ahd->dev_softc; in ahd_aic790X_setup()
946 ahd_name(ahd), rev); in ahd_aic790X_setup()
950 ahd->channel = ahd_get_pci_function(pci) + 'A'; in ahd_aic790X_setup()
955 ahd->bugs |= AHD_SENT_SCB_UPDATE_BUG|AHD_ABORT_LQI_BUG in ahd_aic790X_setup()
970 AHD_SET_PRECOMP(ahd, AHD_PRECOMP_CUTBACK_29); in ahd_aic790X_setup()
972 if ((ahd->flags & AHD_HP_BOARD) == 0) in ahd_aic790X_setup()
973 AHD_SET_SLEWRATE(ahd, AHD_SLEWRATE_DEF_REVA); in ahd_aic790X_setup()
979 ahd->features |= AHD_RTI|AHD_NEW_IOCELL_OPTS in ahd_aic790X_setup()
982 ahd->bugs |= AHD_LQOOVERRUN_BUG|AHD_EARLY_REQ_BUG; in ahd_aic790X_setup()
986 ahd->features |= AHD_AIC79XXB_SLOWCRC; in ahd_aic790X_setup()
991 if ((ahd->features & AHD_MULTI_FUNC) != 0) in ahd_aic790X_setup()
992 ahd->bugs |= AHD_INTCOLLISION_BUG|AHD_ABORT_LQI_BUG; in ahd_aic790X_setup()
997 AHD_SET_PRECOMP(ahd, AHD_PRECOMP_CUTBACK_29); in ahd_aic790X_setup()
998 AHD_SET_SLEWRATE(ahd, AHD_SLEWRATE_DEF_REVB); in ahd_aic790X_setup()
999 AHD_SET_AMPLITUDE(ahd, AHD_AMPLITUDE_DEF); in ahd_aic790X_setup()