Lines Matching refs:ahd

244 static int	ahd_check_extport(struct ahd_softc *ahd);
245 static void ahd_configure_termination(struct ahd_softc *ahd,
247 static void ahd_pci_split_intr(struct ahd_softc *ahd, u_int intstat);
248 static void ahd_pci_intr(struct ahd_softc *ahd);
289 ahd_pci_config(struct ahd_softc *ahd, const struct ahd_pci_identity *entry) in ahd_pci_config() argument
296 ahd->description = entry->name; in ahd_pci_config()
300 subvendor = ahd_pci_read_config(ahd->dev_softc, in ahd_pci_config()
303 ahd->flags |= AHD_HP_BOARD; in ahd_pci_config()
305 error = entry->setup(ahd); in ahd_pci_config()
309 devconfig = ahd_pci_read_config(ahd->dev_softc, DEVCONFIG, /*bytes*/4); in ahd_pci_config()
311 ahd->chip |= AHD_PCI; in ahd_pci_config()
313 ahd->bugs &= ~AHD_PCIX_BUG_MASK; in ahd_pci_config()
315 ahd->chip |= AHD_PCIX; in ahd_pci_config()
317 ahd->bus_description = pci_bus_modes[PCI_BUS_MODES_INDEX(devconfig)]; in ahd_pci_config()
319 ahd_power_state_change(ahd, AHD_POWER_STATE_D0); in ahd_pci_config()
321 error = ahd_pci_map_registers(ahd); in ahd_pci_config()
331 if ((ahd->flags & (AHD_39BIT_ADDRESSING|AHD_64BIT_ADDRESSING)) != 0) { in ahd_pci_config()
334 ahd_name(ahd)); in ahd_pci_config()
335 devconfig = ahd_pci_read_config(ahd->dev_softc, in ahd_pci_config()
338 ahd_pci_write_config(ahd->dev_softc, DEVCONFIG, in ahd_pci_config()
343 command = ahd_pci_read_config(ahd->dev_softc, PCIR_COMMAND, /*bytes*/2); in ahd_pci_config()
345 ahd_pci_write_config(ahd->dev_softc, PCIR_COMMAND, command, /*bytes*/2); in ahd_pci_config()
347 error = ahd_softc_init(ahd); in ahd_pci_config()
351 ahd->bus_intr = ahd_pci_intr; in ahd_pci_config()
353 error = ahd_reset(ahd, /*reinit*/FALSE); in ahd_pci_config()
357 ahd->pci_cachesize = in ahd_pci_config()
358 ahd_pci_read_config(ahd->dev_softc, CSIZE_LATTIME, in ahd_pci_config()
360 ahd->pci_cachesize *= 4; in ahd_pci_config()
362 ahd_set_modes(ahd, AHD_MODE_SCSI, AHD_MODE_SCSI); in ahd_pci_config()
364 error = ahd_check_extport(ahd); in ahd_pci_config()
369 error = ahd_init(ahd); in ahd_pci_config()
372 ahd->init_level++; in ahd_pci_config()
377 return ahd_pci_map_int(ahd); in ahd_pci_config()
382 ahd_pci_suspend(struct ahd_softc *ahd) in ahd_pci_suspend() argument
388 ahd->suspend_state.pci_state.devconfig = in ahd_pci_suspend()
389 ahd_pci_read_config(ahd->dev_softc, DEVCONFIG, /*bytes*/4); in ahd_pci_suspend()
390 ahd->suspend_state.pci_state.command = in ahd_pci_suspend()
391 ahd_pci_read_config(ahd->dev_softc, PCIR_COMMAND, /*bytes*/1); in ahd_pci_suspend()
392 ahd->suspend_state.pci_state.csize_lattime = in ahd_pci_suspend()
393 ahd_pci_read_config(ahd->dev_softc, CSIZE_LATTIME, /*bytes*/1); in ahd_pci_suspend()
398 ahd_pci_resume(struct ahd_softc *ahd) in ahd_pci_resume() argument
400 ahd_pci_write_config(ahd->dev_softc, DEVCONFIG, in ahd_pci_resume()
401 ahd->suspend_state.pci_state.devconfig, /*bytes*/4); in ahd_pci_resume()
402 ahd_pci_write_config(ahd->dev_softc, PCIR_COMMAND, in ahd_pci_resume()
403 ahd->suspend_state.pci_state.command, /*bytes*/1); in ahd_pci_resume()
404 ahd_pci_write_config(ahd->dev_softc, CSIZE_LATTIME, in ahd_pci_resume()
405 ahd->suspend_state.pci_state.csize_lattime, /*bytes*/1); in ahd_pci_resume()
414 ahd_pci_test_register_access(struct ahd_softc *ahd) in ahd_pci_test_register_access() argument
428 cmd = ahd_pci_read_config(ahd->dev_softc, PCIR_COMMAND, /*bytes*/2); in ahd_pci_test_register_access()
429 ahd_pci_write_config(ahd->dev_softc, PCIR_COMMAND, in ahd_pci_test_register_access()
440 hcntrl = ahd_inb(ahd, HCNTRL); in ahd_pci_test_register_access()
453 ahd_outb(ahd, HCNTRL, hcntrl|PAUSE); in ahd_pci_test_register_access()
454 while (ahd_is_paused(ahd) == 0) in ahd_pci_test_register_access()
458 ahd_set_modes(ahd, AHD_MODE_CFG, AHD_MODE_CFG); in ahd_pci_test_register_access()
459 targpcistat = ahd_inb(ahd, TARGPCISTAT); in ahd_pci_test_register_access()
460 ahd_outb(ahd, TARGPCISTAT, targpcistat); in ahd_pci_test_register_access()
461 pci_status1 = ahd_pci_read_config(ahd->dev_softc, in ahd_pci_test_register_access()
463 ahd_pci_write_config(ahd->dev_softc, PCIR_STATUS + 1, in ahd_pci_test_register_access()
465 ahd_set_modes(ahd, AHD_MODE_SCSI, AHD_MODE_SCSI); in ahd_pci_test_register_access()
466 ahd_outb(ahd, CLRINT, CLRPCIINT); in ahd_pci_test_register_access()
468 ahd_outb(ahd, SEQCTL0, PERRORDIS); in ahd_pci_test_register_access()
469 ahd_outl(ahd, SRAM_BASE, 0x5aa555aa); in ahd_pci_test_register_access()
470 if (ahd_inl(ahd, SRAM_BASE) != 0x5aa555aa) in ahd_pci_test_register_access()
473 if ((ahd_inb(ahd, INTSTAT) & PCIINT) != 0) { in ahd_pci_test_register_access()
474 ahd_set_modes(ahd, AHD_MODE_CFG, AHD_MODE_CFG); in ahd_pci_test_register_access()
475 targpcistat = ahd_inb(ahd, TARGPCISTAT); in ahd_pci_test_register_access()
483 if ((ahd_inb(ahd, INTSTAT) & PCIINT) != 0) { in ahd_pci_test_register_access()
485 ahd_set_modes(ahd, AHD_MODE_CFG, AHD_MODE_CFG); in ahd_pci_test_register_access()
486 targpcistat = ahd_inb(ahd, TARGPCISTAT); in ahd_pci_test_register_access()
489 ahd_outb(ahd, TARGPCISTAT, targpcistat); in ahd_pci_test_register_access()
490 pci_status1 = ahd_pci_read_config(ahd->dev_softc, in ahd_pci_test_register_access()
492 ahd_pci_write_config(ahd->dev_softc, PCIR_STATUS + 1, in ahd_pci_test_register_access()
494 ahd_outb(ahd, CLRINT, CLRPCIINT); in ahd_pci_test_register_access()
496 ahd_outb(ahd, SEQCTL0, PERRORDIS|FAILDIS); in ahd_pci_test_register_access()
497 ahd_pci_write_config(ahd->dev_softc, PCIR_COMMAND, cmd, /*bytes*/2); in ahd_pci_test_register_access()
506 ahd_check_extport(struct ahd_softc *ahd) in ahd_check_extport() argument
514 sc = ahd->seep_config; in ahd_check_extport()
515 have_seeprom = ahd_acquire_seeprom(ahd); in ahd_check_extport()
524 ahd_name(ahd)); in ahd_check_extport()
528 + (sizeof(vpd) * (ahd->channel - 'A'))) / 2; in ahd_check_extport()
530 error = ahd_read_seeprom(ahd, (uint16_t *)&vpd, in ahd_check_extport()
534 error = ahd_parse_vpddata(ahd, &vpd); in ahd_check_extport()
537 ahd_name(ahd), in ahd_check_extport()
541 printk("%s: Reading SEEPROM...", ahd_name(ahd)); in ahd_check_extport()
544 start_addr = (sizeof(*sc) / 2) * (ahd->channel - 'A'); in ahd_check_extport()
546 error = ahd_read_seeprom(ahd, (uint16_t *)sc, in ahd_check_extport()
563 ahd_release_seeprom(ahd); in ahd_check_extport()
576 ahd_set_scbptr(ahd, 0xFF); in ahd_check_extport()
577 nvram_scb = ahd_inb_scbram(ahd, SCB_BASE + NVRAM_SCB_OFFSET); in ahd_check_extport()
579 && ((ahd_inb_scbram(ahd, SCB_BASE + 0) == 'A' in ahd_check_extport()
580 && ahd_inb_scbram(ahd, SCB_BASE + 1) == 'D' in ahd_check_extport()
581 && ahd_inb_scbram(ahd, SCB_BASE + 2) == 'P' in ahd_check_extport()
582 && ahd_inb_scbram(ahd, SCB_BASE + 3) == 'T') in ahd_check_extport()
583 || (ahd_inb_scbram(ahd, SCB_BASE + 0) == 'B' in ahd_check_extport()
584 && ahd_inb_scbram(ahd, SCB_BASE + 1) == 'I' in ahd_check_extport()
585 && ahd_inb_scbram(ahd, SCB_BASE + 2) == 'O' in ahd_check_extport()
586 && ahd_inb_scbram(ahd, SCB_BASE + 3) == 'S') 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) == 'S' 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) == 'I'))) { in ahd_check_extport()
594 ahd_set_scbptr(ahd, nvram_scb); in ahd_check_extport()
597 *sc_data++ = ahd_inw_scbram(ahd, SCB_BASE+i); in ahd_check_extport()
600 ahd->flags |= AHD_SCB_CONFIG_USED; in ahd_check_extport()
610 printk("%s: Seeprom Contents:", ahd_name(ahd)); in ahd_check_extport()
620 printk("%s: No SEEPROM available.\n", ahd_name(ahd)); in ahd_check_extport()
621 ahd->flags |= AHD_USEDEFAULTS; in ahd_check_extport()
622 error = ahd_default_config(ahd); in ahd_check_extport()
624 kfree(ahd->seep_config); in ahd_check_extport()
625 ahd->seep_config = NULL; in ahd_check_extport()
627 error = ahd_parse_cfgdata(ahd, sc); in ahd_check_extport()
633 ahd_configure_termination(ahd, adapter_control); in ahd_check_extport()
639 ahd_configure_termination(struct ahd_softc *ahd, u_int adapter_control) in ahd_configure_termination() argument
646 devconfig = ahd_pci_read_config(ahd->dev_softc, DEVCONFIG, /*bytes*/4); in ahd_configure_termination()
648 if ((ahd->flags & AHD_STPWLEVEL_A) != 0) in ahd_configure_termination()
652 ahd_name(ahd), (devconfig & STPWLEVEL) ? "on" : "off"); in ahd_configure_termination()
653 ahd_pci_write_config(ahd->dev_softc, DEVCONFIG, devconfig, /*bytes*/4); in ahd_configure_termination()
656 if ((ahd->flags & AHD_CURRENT_SENSING) != 0) { in ahd_configure_termination()
657 (void)ahd_write_flexport(ahd, FLXADDR_ROMSTAT_CURSENSECTL, 0); in ahd_configure_termination()
663 error = ahd_read_flexport(ahd, FLXADDR_TERMCTL, &termctl); in ahd_configure_termination()
667 ahd_name(ahd)); in ahd_configure_termination()
675 "Using Defaults.\n", ahd_name(ahd)); in ahd_configure_termination()
682 ahd_name(ahd)); in ahd_configure_termination()
690 "Using Defaults.\n", ahd_name(ahd)); in ahd_configure_termination()
697 sxfrctl1 = ahd_inb(ahd, SXFRCTL1) & ~STPWEN; in ahd_configure_termination()
698 ahd->flags &= ~AHD_TERM_ENB_A; in ahd_configure_termination()
700 ahd->flags |= AHD_TERM_ENB_A; in ahd_configure_termination()
704 ahd_outb(ahd, SXFRCTL1, sxfrctl1|STPWEN); in ahd_configure_termination()
705 ahd_outb(ahd, SXFRCTL1, sxfrctl1); in ahd_configure_termination()
707 error = ahd_write_flexport(ahd, FLXADDR_TERMCTL, termctl); in ahd_configure_termination()
710 ahd_name(ahd)); in ahd_configure_termination()
713 ahd_name(ahd), in ahd_configure_termination()
717 ahd_name(ahd), in ahd_configure_termination()
721 ahd_name(ahd), in ahd_configure_termination()
725 ahd_name(ahd), in ahd_configure_termination()
783 ahd_pci_intr(struct ahd_softc *ahd) in ahd_pci_intr() argument
792 intstat = ahd_inb(ahd, INTSTAT); in ahd_pci_intr()
795 ahd_pci_split_intr(ahd, intstat); in ahd_pci_intr()
800 printk("%s: PCI error Interrupt\n", ahd_name(ahd)); in ahd_pci_intr()
801 saved_modes = ahd_save_modes(ahd); in ahd_pci_intr()
802 ahd_dump_card_state(ahd); in ahd_pci_intr()
803 ahd_set_modes(ahd, AHD_MODE_CFG, AHD_MODE_CFG); in ahd_pci_intr()
808 pci_status[i] = ahd_inb(ahd, reg); in ahd_pci_intr()
810 ahd_outb(ahd, reg, pci_status[i]); in ahd_pci_intr()
827 printk(s, ahd_name(ahd), pci_status_source[i]); in ahd_pci_intr()
831 pci_status1 = ahd_pci_read_config(ahd->dev_softc, in ahd_pci_intr()
833 ahd_pci_write_config(ahd->dev_softc, PCIR_STATUS + 1, in ahd_pci_intr()
835 ahd_restore_modes(ahd, saved_modes); in ahd_pci_intr()
836 ahd_outb(ahd, CLRINT, CLRPCIINT); in ahd_pci_intr()
837 ahd_unpause(ahd); in ahd_pci_intr()
841 ahd_pci_split_intr(struct ahd_softc *ahd, u_int intstat) in ahd_pci_split_intr() argument
855 pcix_status = ahd_pci_read_config(ahd->dev_softc, PCIXR_STATUS, in ahd_pci_split_intr()
858 ahd_name(ahd), pcix_status); in ahd_pci_split_intr()
859 saved_modes = ahd_save_modes(ahd); in ahd_pci_split_intr()
861 ahd_set_modes(ahd, i, i); in ahd_pci_split_intr()
863 split_status[i] = ahd_inb(ahd, DCHSPLTSTAT0); in ahd_pci_split_intr()
864 split_status1[i] = ahd_inb(ahd, DCHSPLTSTAT1); in ahd_pci_split_intr()
866 ahd_outb(ahd, DCHSPLTSTAT0, split_status[i]); in ahd_pci_split_intr()
867 ahd_outb(ahd, DCHSPLTSTAT1, split_status1[i]); in ahd_pci_split_intr()
870 sg_split_status[i] = ahd_inb(ahd, SGSPLTSTAT0); in ahd_pci_split_intr()
871 sg_split_status1[i] = ahd_inb(ahd, SGSPLTSTAT1); in ahd_pci_split_intr()
873 ahd_outb(ahd, SGSPLTSTAT0, sg_split_status[i]); in ahd_pci_split_intr()
874 ahd_outb(ahd, SGSPLTSTAT1, sg_split_status1[i]); in ahd_pci_split_intr()
883 printk(split_status_strings[bit], ahd_name(ahd), in ahd_pci_split_intr()
890 printk(split_status_strings[bit], ahd_name(ahd), "SG"); in ahd_pci_split_intr()
896 ahd_pci_write_config(ahd->dev_softc, PCIXR_STATUS, in ahd_pci_split_intr()
898 ahd_outb(ahd, CLRINT, CLRSPLTINT); in ahd_pci_split_intr()
899 ahd_restore_modes(ahd, saved_modes); in ahd_pci_split_intr()
903 ahd_aic7901_setup(struct ahd_softc *ahd) in ahd_aic7901_setup() argument
906 ahd->chip = AHD_AIC7901; in ahd_aic7901_setup()
907 ahd->features = AHD_AIC7901_FE; in ahd_aic7901_setup()
908 return (ahd_aic790X_setup(ahd)); in ahd_aic7901_setup()
912 ahd_aic7901A_setup(struct ahd_softc *ahd) in ahd_aic7901A_setup() argument
915 ahd->chip = AHD_AIC7901A; in ahd_aic7901A_setup()
916 ahd->features = AHD_AIC7901A_FE; in ahd_aic7901A_setup()
917 return (ahd_aic790X_setup(ahd)); in ahd_aic7901A_setup()
921 ahd_aic7902_setup(struct ahd_softc *ahd) in ahd_aic7902_setup() argument
923 ahd->chip = AHD_AIC7902; in ahd_aic7902_setup()
924 ahd->features = AHD_AIC7902_FE; in ahd_aic7902_setup()
925 return (ahd_aic790X_setup(ahd)); in ahd_aic7902_setup()
929 ahd_aic790X_setup(struct ahd_softc *ahd) in ahd_aic790X_setup() argument
934 pci = ahd->dev_softc; in ahd_aic790X_setup()
938 ahd_name(ahd), rev); in ahd_aic790X_setup()
942 ahd->channel = ahd_get_pci_function(pci) + 'A'; in ahd_aic790X_setup()
947 ahd->bugs |= AHD_SENT_SCB_UPDATE_BUG|AHD_ABORT_LQI_BUG in ahd_aic790X_setup()
962 AHD_SET_PRECOMP(ahd, AHD_PRECOMP_CUTBACK_29); in ahd_aic790X_setup()
964 if ((ahd->flags & AHD_HP_BOARD) == 0) in ahd_aic790X_setup()
965 AHD_SET_SLEWRATE(ahd, AHD_SLEWRATE_DEF_REVA); in ahd_aic790X_setup()
971 ahd->features |= AHD_RTI|AHD_NEW_IOCELL_OPTS in ahd_aic790X_setup()
974 ahd->bugs |= AHD_LQOOVERRUN_BUG|AHD_EARLY_REQ_BUG; in ahd_aic790X_setup()
978 ahd->features |= AHD_AIC79XXB_SLOWCRC; in ahd_aic790X_setup()
983 if ((ahd->features & AHD_MULTI_FUNC) != 0) in ahd_aic790X_setup()
984 ahd->bugs |= AHD_INTCOLLISION_BUG|AHD_ABORT_LQI_BUG; in ahd_aic790X_setup()
989 AHD_SET_PRECOMP(ahd, AHD_PRECOMP_CUTBACK_29); in ahd_aic790X_setup()
990 AHD_SET_SLEWRATE(ahd, AHD_SLEWRATE_DEF_REVB); in ahd_aic790X_setup()
991 AHD_SET_AMPLITUDE(ahd, AHD_AMPLITUDE_DEF); in ahd_aic790X_setup()