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