int retval;
switch (PCI_PRODUCT(pa->pa_id)) { case PCI_PRODUCT_ADVSYS_WIDE: sc->chip_type = ADV_CHIP_ASC3550; break;  case PCI_PRODUCT_ADVSYS_U2W: sc->chip_type = ADV_CHIP_ASC38C0800; break;  default: printf("\n%s: unknown model: %d\n", sc->sc_dev.dv_xname, PCI_PRODUCT(pa->pa_id)); return; }   command = pci_conf_read(pa->pa_pc, pa->pa_tag, PCI_COMMAND_STATUS_REG); if ((command & (PCI_COMMAND_IO_ENABLE | PCI_COMMAND_MEM_ENABLE | PCI_COMMAND_MASTER_ENABLE)) != (PCI_COMMAND_IO_ENABLE | PCI_COMMAND_MEM_ENABLE | PCI_COMMAND_MASTER_ENABLE)) { pci_conf_write(pa->pa_pc, pa->pa_tag, PCI_COMMAND_STATUS_REG, command | (PCI_COMMAND_IO_ENABLE | PCI_COMMAND_MEM_ENABLE | PCI_COMMAND_MASTER_ENABLE)); }
adw_pci_attach(parent, self, aux)	struct device  *parent, *self;	void           *aux;{	struct pci_attach_args *pa = aux;	ADW_SOFTC      *sc = (void *) self;	bus_space_handle_t ioh;	bus_addr_t adwbase;	bus_size_t adwsize;	pci_intr_handle_t ih;	pci_chipset_tag_t pc = pa->pa_pc;	u_int32_t       command;	const char     *intrstr;	int retval;	/*	 * Latency timer settings.	 */	{		u_int32_t       bhlcr;		bhlcr = pci_conf_read(pa->pa_pc, pa->pa_tag, PCI_BHLC_REG);		if( ((PCI_PRODUCT(pa->pa_id) == PCI_PRODUCT_ADVSYS_WIDE) ||		     (PCI_PRODUCT(pa->pa_id) == PCI_PRODUCT_ADVSYS_U2W)) &&		     (PCI_LATTIMER(bhlcr) < 0x20)) {			bhlcr &= 0xFFFF00FFUL;			bhlcr |= 0x00002000UL;			pci_conf_write(pa->pa_pc, pa->pa_tag,				       PCI_BHLC_REG, bhlcr);		}	}	if (((PCI_PRODUCT(pa->pa_id) == PCI_PRODUCT_ADVSYS_WIDE) ||	     (PCI_PRODUCT(pa->pa_id) == PCI_PRODUCT_ADVSYS_U2W)) &&	     (command & PCI_COMMAND_PARITY_ENABLE) == 0) {		sc->cfg.control_flag |= CONTROL_FLAG_IGNORE_PERR;	}	/*	 * Map Device Registers for I/O	 */	retval = pci_io_find(pc, pa->pa_tag, PCI_CBIO, &adwbase, &adwsize);	if (retval == 0)		retval = bus_space_map(pa->pa_iot, adwbase, adwsize, 0, &ioh);	if (retval) {		printf("\n%s: unable to map device registers\n",		       sc->sc_dev.dv_xname);		return;	}	sc->sc_iot = pa->pa_iot;	sc->sc_ioh = ioh;	sc->sc_dmat = pa->pa_dmat;	/*	 * Initialize the board	 */	if (adw_init(sc))		panic("adw_pci_attach: adw_init failed");	/*	 * Map Interrupt line	 */	if (pci_intr_map(pc, pa->pa_intrtag, pa->pa_intrpin,			 pa->pa_intrline, &ih)) {		printf("%s: couldn't map interrupt\n", sc->sc_dev.dv_xname);		return;	}	intrstr = pci_intr_string(pc, ih);	/*	 * Establish Interrupt handler	 */	sc->sc_ih = pci_intr_establish(pc, ih, IPL_BIO, adw_intr, sc,				       sc->sc_dev.dv_xname);	if (sc->sc_ih == NULL) {		printf("%s: couldn't establish interrupt", sc->sc_dev.dv_xname);		if (intrstr != NULL)			printf(" at %s", intrstr);		printf("\n");		return;	}	printf(": %s\n", intrstr);	/*	 * Attach all the sub-devices we can find	 */	adw_attach(sc);}