sc->sc_poll = ami_quartz_poll;
ami_pci_attach(parent, self, aux)	struct device *parent, *self;	void *aux;{	struct ami_softc *sc = (struct ami_softc *)self;	struct pci_attach_args *pa = aux;	pci_intr_handle_t ih;	const char *intrstr, *model = NULL, *lhc;	const struct ami_pci_subsys *ssp;	bus_size_t size;	pcireg_t csr;	int i;#if 0	/* reset */	pci_conf_write(pa->pa_pc, pa->pa_tag, PCI_EBCR,	    pci_conf_read(pa->pa_pc, pa->pa_tag, PCI_EBCR) | 0x20);	pci_conf_write(pa->pa_pc, pa->pa_tag, AMI_WAKEUP, 0);#endif	csr = pci_mapreg_type(pa->pa_pc, pa->pa_tag, AMI_BAR);	csr |= PCI_MAPREG_MEM_TYPE_32BIT;	if (pci_mapreg_map(pa, AMI_BAR, csr, 0,	    &sc->iot, &sc->ioh, NULL, &size, AMI_PCI_MEMSIZE)) {		printf(": can't map controller pci space\n");		return;	}	if (csr == PCI_MAPREG_TYPE_IO) {		sc->sc_init = ami_schwartz_init;		sc->sc_exec = ami_schwartz_exec;		sc->sc_done = ami_schwartz_done;	} else {		sc->sc_init = ami_quartz_init;		sc->sc_exec = ami_quartz_exec;		sc->sc_done = ami_quartz_done;	}	sc->dmat = pa->pa_dmat;	/* enable bus mastering (should not it be mi?) */	csr = pci_conf_read(pa->pa_pc, pa->pa_tag, PCI_COMMAND_STATUS_REG);	pci_conf_write(pa->pa_pc, pa->pa_tag, PCI_COMMAND_STATUS_REG,	    csr | PCI_COMMAND_MASTER_ENABLE);	if (pci_intr_map(pa, &ih)) {		printf(": can't map interrupt\n");		bus_space_unmap(sc->iot, sc->ioh, size);		return;	}	intrstr = pci_intr_string(pa->pa_pc, ih);	sc->sc_ih = pci_intr_establish(pa->pa_pc, ih, IPL_BIO, ami_intr, sc,	    sc->sc_dev.dv_xname);	if (!sc->sc_ih) {		printf(": can't establish interrupt");		if (intrstr)			printf(" at %s", intrstr);		printf("\n");		bus_space_unmap(sc->iot, sc->ioh, size);	}	printf(": %s", intrstr);	csr = pci_conf_read(pa->pa_pc, pa->pa_tag, PCI_SUBSYS_ID_REG);	for (ssp = ami_pci_subsys; ssp->id; ssp++)		if (ssp->id == csr) {			model = ssp->name;			break;		}	if (!model && PCI_VENDOR(pa->pa_id) == PCI_VENDOR_AMI)		switch (PCI_PRODUCT(pa->pa_id)) {		case PCI_PRODUCT_AMI_MEGARAID428:			model = "AMI 428";			break;		case PCI_PRODUCT_AMI_MEGARAID434:			model = "AMI 434";			break;		}	/* XXX 438 is netraid 3si for hp cards, but we get to know	   they are hp too late in md code */	if (!model) {		const struct ami_pci_vendor *vp;		static char modelbuf[32];		for (vp = ami_pci_vendors;		     vp->id && vp->id != (csr & 0xffff); vp++);		if (vp->id)			snprintf(modelbuf, sizeof modelbuf, "%s %x", vp->name,			    (csr >> 16) & 0xffff);		else			snprintf(modelbuf, sizeof modelbuf, "unknown 0x%08x",			    csr);		model = modelbuf;	}	switch (pci_conf_read(pa->pa_pc, pa->pa_tag, AMI_PCI_SGL)) {	case AMI_SGL_LHC:	lhc = "64b/lhc";	break;	case AMI_SGL_HLC:	lhc = "64b/hlc";	break;	default:		lhc = "32b";	}	if ((i = ami_pci_find_device(aux)) != -1) {		if (ami_pci_devices[i].flags & AMI_BROKEN)			sc->sc_flags = AMI_BROKEN;		else			sc->sc_flags = 0x0000;	}	else {		/* this device existed at _match() should never happen */		panic("ami device dissapeared between match() and attach()\n");	}	printf(" %s/%s\n%s", model, lhc, sc->sc_dev.dv_xname);	if (ami_attach(sc)) {		pci_intr_disestablish(pa->pa_pc, sc->sc_ih);		sc->sc_ih = NULL;		bus_space_unmap(sc->iot, sc->ioh, size);	}}