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