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()
381 ahd_pci_suspend(struct ahd_softc *ahd) in ahd_pci_suspend() argument
387 ahd->suspend_state.pci_state.devconfig = in ahd_pci_suspend()
388 ahd_pci_read_config(ahd->dev_softc, DEVCONFIG, /*bytes*/4); in ahd_pci_suspend()
389 ahd->suspend_state.pci_state.command = in ahd_pci_suspend()
390 ahd_pci_read_config(ahd->dev_softc, PCIR_COMMAND, /*bytes*/1); in ahd_pci_suspend()
391 ahd->suspend_state.pci_state.csize_lattime = in ahd_pci_suspend()
392 ahd_pci_read_config(ahd->dev_softc, CSIZE_LATTIME, /*bytes*/1); in ahd_pci_suspend()
397 ahd_pci_resume(struct ahd_softc *ahd) in ahd_pci_resume() argument
399 ahd_pci_write_config(ahd->dev_softc, DEVCONFIG, in ahd_pci_resume()
400 ahd->suspend_state.pci_state.devconfig, /*bytes*/4); in ahd_pci_resume()
401 ahd_pci_write_config(ahd->dev_softc, PCIR_COMMAND, in ahd_pci_resume()
402 ahd->suspend_state.pci_state.command, /*bytes*/1); in ahd_pci_resume()
403 ahd_pci_write_config(ahd->dev_softc, CSIZE_LATTIME, in ahd_pci_resume()
404 ahd->suspend_state.pci_state.csize_lattime, /*bytes*/1); in ahd_pci_resume()
412 ahd_pci_test_register_access(struct ahd_softc *ahd) in ahd_pci_test_register_access() argument
426 cmd = ahd_pci_read_config(ahd->dev_softc, PCIR_COMMAND, /*bytes*/2); in ahd_pci_test_register_access()
427 ahd_pci_write_config(ahd->dev_softc, PCIR_COMMAND, in ahd_pci_test_register_access()
438 hcntrl = ahd_inb(ahd, HCNTRL); in ahd_pci_test_register_access()
451 ahd_outb(ahd, HCNTRL, hcntrl|PAUSE); in ahd_pci_test_register_access()
452 while (ahd_is_paused(ahd) == 0) in ahd_pci_test_register_access()
456 ahd_set_modes(ahd, AHD_MODE_CFG, AHD_MODE_CFG); in ahd_pci_test_register_access()
457 targpcistat = ahd_inb(ahd, TARGPCISTAT); in ahd_pci_test_register_access()
458 ahd_outb(ahd, TARGPCISTAT, targpcistat); in ahd_pci_test_register_access()
459 pci_status1 = ahd_pci_read_config(ahd->dev_softc, in ahd_pci_test_register_access()
461 ahd_pci_write_config(ahd->dev_softc, PCIR_STATUS + 1, in ahd_pci_test_register_access()
463 ahd_set_modes(ahd, AHD_MODE_SCSI, AHD_MODE_SCSI); in ahd_pci_test_register_access()
464 ahd_outb(ahd, CLRINT, CLRPCIINT); in ahd_pci_test_register_access()
466 ahd_outb(ahd, SEQCTL0, PERRORDIS); in ahd_pci_test_register_access()
467 ahd_outl(ahd, SRAM_BASE, 0x5aa555aa); in ahd_pci_test_register_access()
468 if (ahd_inl(ahd, SRAM_BASE) != 0x5aa555aa) in ahd_pci_test_register_access()
471 if ((ahd_inb(ahd, INTSTAT) & PCIINT) != 0) { in ahd_pci_test_register_access()
472 ahd_set_modes(ahd, AHD_MODE_CFG, AHD_MODE_CFG); in ahd_pci_test_register_access()
473 targpcistat = ahd_inb(ahd, TARGPCISTAT); in ahd_pci_test_register_access()
481 if ((ahd_inb(ahd, INTSTAT) & PCIINT) != 0) { in ahd_pci_test_register_access()
483 ahd_set_modes(ahd, AHD_MODE_CFG, AHD_MODE_CFG); in ahd_pci_test_register_access()
484 targpcistat = ahd_inb(ahd, TARGPCISTAT); in ahd_pci_test_register_access()
487 ahd_outb(ahd, TARGPCISTAT, targpcistat); in ahd_pci_test_register_access()
488 pci_status1 = ahd_pci_read_config(ahd->dev_softc, in ahd_pci_test_register_access()
490 ahd_pci_write_config(ahd->dev_softc, PCIR_STATUS + 1, in ahd_pci_test_register_access()
492 ahd_outb(ahd, CLRINT, CLRPCIINT); in ahd_pci_test_register_access()
494 ahd_outb(ahd, SEQCTL0, PERRORDIS|FAILDIS); in ahd_pci_test_register_access()
495 ahd_pci_write_config(ahd->dev_softc, PCIR_COMMAND, cmd, /*bytes*/2); in ahd_pci_test_register_access()
504 ahd_check_extport(struct ahd_softc *ahd) in ahd_check_extport() argument
512 sc = ahd->seep_config; in ahd_check_extport()
513 have_seeprom = ahd_acquire_seeprom(ahd); in ahd_check_extport()
522 ahd_name(ahd)); in ahd_check_extport()
526 + (sizeof(vpd) * (ahd->channel - 'A'))) / 2; in ahd_check_extport()
528 error = ahd_read_seeprom(ahd, (uint16_t *)&vpd, in ahd_check_extport()
532 error = ahd_parse_vpddata(ahd, &vpd); in ahd_check_extport()
535 ahd_name(ahd), in ahd_check_extport()
539 printk("%s: Reading SEEPROM...", ahd_name(ahd)); in ahd_check_extport()
542 start_addr = (sizeof(*sc) / 2) * (ahd->channel - 'A'); in ahd_check_extport()
544 error = ahd_read_seeprom(ahd, (uint16_t *)sc, in ahd_check_extport()
561 ahd_release_seeprom(ahd); in ahd_check_extport()
574 ahd_set_scbptr(ahd, 0xFF); in ahd_check_extport()
575 nvram_scb = ahd_inb_scbram(ahd, SCB_BASE + NVRAM_SCB_OFFSET); in ahd_check_extport()
577 && ((ahd_inb_scbram(ahd, SCB_BASE + 0) == 'A' in ahd_check_extport()
578 && ahd_inb_scbram(ahd, SCB_BASE + 1) == 'D' in ahd_check_extport()
579 && ahd_inb_scbram(ahd, SCB_BASE + 2) == 'P' in ahd_check_extport()
580 && ahd_inb_scbram(ahd, SCB_BASE + 3) == 'T') in ahd_check_extport()
581 || (ahd_inb_scbram(ahd, SCB_BASE + 0) == 'B' in ahd_check_extport()
582 && ahd_inb_scbram(ahd, SCB_BASE + 1) == 'I' in ahd_check_extport()
583 && ahd_inb_scbram(ahd, SCB_BASE + 2) == 'O' in ahd_check_extport()
584 && ahd_inb_scbram(ahd, SCB_BASE + 3) == 'S') in ahd_check_extport()
585 || (ahd_inb_scbram(ahd, SCB_BASE + 0) == 'A' in ahd_check_extport()
586 && ahd_inb_scbram(ahd, SCB_BASE + 1) == 'S' in ahd_check_extport()
587 && ahd_inb_scbram(ahd, SCB_BASE + 2) == 'P' in ahd_check_extport()
588 && ahd_inb_scbram(ahd, SCB_BASE + 3) == 'I'))) { in ahd_check_extport()
592 ahd_set_scbptr(ahd, nvram_scb); in ahd_check_extport()
595 *sc_data++ = ahd_inw_scbram(ahd, SCB_BASE+i); in ahd_check_extport()
598 ahd->flags |= AHD_SCB_CONFIG_USED; in ahd_check_extport()
608 printk("%s: Seeprom Contents:", ahd_name(ahd)); in ahd_check_extport()
618 printk("%s: No SEEPROM available.\n", ahd_name(ahd)); in ahd_check_extport()
619 ahd->flags |= AHD_USEDEFAULTS; in ahd_check_extport()
620 error = ahd_default_config(ahd); in ahd_check_extport()
622 kfree(ahd->seep_config); in ahd_check_extport()
623 ahd->seep_config = NULL; in ahd_check_extport()
625 error = ahd_parse_cfgdata(ahd, sc); in ahd_check_extport()
631 ahd_configure_termination(ahd, adapter_control); in ahd_check_extport()
637 ahd_configure_termination(struct ahd_softc *ahd, u_int adapter_control) in ahd_configure_termination() argument
644 devconfig = ahd_pci_read_config(ahd->dev_softc, DEVCONFIG, /*bytes*/4); in ahd_configure_termination()
646 if ((ahd->flags & AHD_STPWLEVEL_A) != 0) in ahd_configure_termination()
650 ahd_name(ahd), (devconfig & STPWLEVEL) ? "on" : "off"); in ahd_configure_termination()
651 ahd_pci_write_config(ahd->dev_softc, DEVCONFIG, devconfig, /*bytes*/4); in ahd_configure_termination()
654 if ((ahd->flags & AHD_CURRENT_SENSING) != 0) { in ahd_configure_termination()
655 (void)ahd_write_flexport(ahd, FLXADDR_ROMSTAT_CURSENSECTL, 0); in ahd_configure_termination()
661 error = ahd_read_flexport(ahd, FLXADDR_TERMCTL, &termctl); in ahd_configure_termination()
665 ahd_name(ahd)); in ahd_configure_termination()
673 "Using Defaults.\n", ahd_name(ahd)); in ahd_configure_termination()
680 ahd_name(ahd)); in ahd_configure_termination()
688 "Using Defaults.\n", ahd_name(ahd)); in ahd_configure_termination()
695 sxfrctl1 = ahd_inb(ahd, SXFRCTL1) & ~STPWEN; in ahd_configure_termination()
696 ahd->flags &= ~AHD_TERM_ENB_A; in ahd_configure_termination()
698 ahd->flags |= AHD_TERM_ENB_A; in ahd_configure_termination()
702 ahd_outb(ahd, SXFRCTL1, sxfrctl1|STPWEN); in ahd_configure_termination()
703 ahd_outb(ahd, SXFRCTL1, sxfrctl1); in ahd_configure_termination()
705 error = ahd_write_flexport(ahd, FLXADDR_TERMCTL, termctl); in ahd_configure_termination()
708 ahd_name(ahd)); in ahd_configure_termination()
711 ahd_name(ahd), in ahd_configure_termination()
715 ahd_name(ahd), in ahd_configure_termination()
719 ahd_name(ahd), in ahd_configure_termination()
723 ahd_name(ahd), in ahd_configure_termination()
781 ahd_pci_intr(struct ahd_softc *ahd) in ahd_pci_intr() argument
790 intstat = ahd_inb(ahd, INTSTAT); in ahd_pci_intr()
793 ahd_pci_split_intr(ahd, intstat); in ahd_pci_intr()
798 printk("%s: PCI error Interrupt\n", ahd_name(ahd)); in ahd_pci_intr()
799 saved_modes = ahd_save_modes(ahd); in ahd_pci_intr()
800 ahd_dump_card_state(ahd); in ahd_pci_intr()
801 ahd_set_modes(ahd, AHD_MODE_CFG, AHD_MODE_CFG); in ahd_pci_intr()
806 pci_status[i] = ahd_inb(ahd, reg); in ahd_pci_intr()
808 ahd_outb(ahd, reg, pci_status[i]); in ahd_pci_intr()
825 printk(s, ahd_name(ahd), pci_status_source[i]); in ahd_pci_intr()
829 pci_status1 = ahd_pci_read_config(ahd->dev_softc, in ahd_pci_intr()
831 ahd_pci_write_config(ahd->dev_softc, PCIR_STATUS + 1, in ahd_pci_intr()
833 ahd_restore_modes(ahd, saved_modes); in ahd_pci_intr()
834 ahd_outb(ahd, CLRINT, CLRPCIINT); in ahd_pci_intr()
835 ahd_unpause(ahd); in ahd_pci_intr()
839 ahd_pci_split_intr(struct ahd_softc *ahd, u_int intstat) in ahd_pci_split_intr() argument
853 pcix_status = ahd_pci_read_config(ahd->dev_softc, PCIXR_STATUS, in ahd_pci_split_intr()
856 ahd_name(ahd), pcix_status); in ahd_pci_split_intr()
857 saved_modes = ahd_save_modes(ahd); in ahd_pci_split_intr()
859 ahd_set_modes(ahd, i, i); in ahd_pci_split_intr()
861 split_status[i] = ahd_inb(ahd, DCHSPLTSTAT0); in ahd_pci_split_intr()
862 split_status1[i] = ahd_inb(ahd, DCHSPLTSTAT1); in ahd_pci_split_intr()
864 ahd_outb(ahd, DCHSPLTSTAT0, split_status[i]); in ahd_pci_split_intr()
865 ahd_outb(ahd, DCHSPLTSTAT1, split_status1[i]); in ahd_pci_split_intr()
868 sg_split_status[i] = ahd_inb(ahd, SGSPLTSTAT0); in ahd_pci_split_intr()
869 sg_split_status1[i] = ahd_inb(ahd, SGSPLTSTAT1); in ahd_pci_split_intr()
871 ahd_outb(ahd, SGSPLTSTAT0, sg_split_status[i]); in ahd_pci_split_intr()
872 ahd_outb(ahd, SGSPLTSTAT1, sg_split_status1[i]); in ahd_pci_split_intr()
881 printk(split_status_strings[bit], ahd_name(ahd), in ahd_pci_split_intr()
888 printk(split_status_strings[bit], ahd_name(ahd), "SG"); in ahd_pci_split_intr()
894 ahd_pci_write_config(ahd->dev_softc, PCIXR_STATUS, in ahd_pci_split_intr()
896 ahd_outb(ahd, CLRINT, CLRSPLTINT); in ahd_pci_split_intr()
897 ahd_restore_modes(ahd, saved_modes); in ahd_pci_split_intr()
901 ahd_aic7901_setup(struct ahd_softc *ahd) in ahd_aic7901_setup() argument
904 ahd->chip = AHD_AIC7901; in ahd_aic7901_setup()
905 ahd->features = AHD_AIC7901_FE; in ahd_aic7901_setup()
906 return (ahd_aic790X_setup(ahd)); in ahd_aic7901_setup()
910 ahd_aic7901A_setup(struct ahd_softc *ahd) in ahd_aic7901A_setup() argument
913 ahd->chip = AHD_AIC7901A; in ahd_aic7901A_setup()
914 ahd->features = AHD_AIC7901A_FE; in ahd_aic7901A_setup()
915 return (ahd_aic790X_setup(ahd)); in ahd_aic7901A_setup()
919 ahd_aic7902_setup(struct ahd_softc *ahd) in ahd_aic7902_setup() argument
921 ahd->chip = AHD_AIC7902; in ahd_aic7902_setup()
922 ahd->features = AHD_AIC7902_FE; in ahd_aic7902_setup()
923 return (ahd_aic790X_setup(ahd)); in ahd_aic7902_setup()
927 ahd_aic790X_setup(struct ahd_softc *ahd) in ahd_aic790X_setup() argument
932 pci = ahd->dev_softc; in ahd_aic790X_setup()
936 ahd_name(ahd), rev); in ahd_aic790X_setup()
940 ahd->channel = ahd_get_pci_function(pci) + 'A'; in ahd_aic790X_setup()
945 ahd->bugs |= AHD_SENT_SCB_UPDATE_BUG|AHD_ABORT_LQI_BUG in ahd_aic790X_setup()
960 AHD_SET_PRECOMP(ahd, AHD_PRECOMP_CUTBACK_29); in ahd_aic790X_setup()
962 if ((ahd->flags & AHD_HP_BOARD) == 0) in ahd_aic790X_setup()
963 AHD_SET_SLEWRATE(ahd, AHD_SLEWRATE_DEF_REVA); in ahd_aic790X_setup()
969 ahd->features |= AHD_RTI|AHD_NEW_IOCELL_OPTS in ahd_aic790X_setup()
972 ahd->bugs |= AHD_LQOOVERRUN_BUG|AHD_EARLY_REQ_BUG; in ahd_aic790X_setup()
976 ahd->features |= AHD_AIC79XXB_SLOWCRC; in ahd_aic790X_setup()
981 if ((ahd->features & AHD_MULTI_FUNC) != 0) in ahd_aic790X_setup()
982 ahd->bugs |= AHD_INTCOLLISION_BUG|AHD_ABORT_LQI_BUG; in ahd_aic790X_setup()
987 AHD_SET_PRECOMP(ahd, AHD_PRECOMP_CUTBACK_29); in ahd_aic790X_setup()
988 AHD_SET_SLEWRATE(ahd, AHD_SLEWRATE_DEF_REVB); in ahd_aic790X_setup()
989 AHD_SET_AMPLITUDE(ahd, AHD_AMPLITUDE_DEF); in ahd_aic790X_setup()