switch (PCI_PRODUCT(pa->pa_id)) { case PCI_PRODUCT_SCHNEIDERKOCH_GE:
skc_attach(struct device *parent, struct device *self, void *aux){	struct sk_softc *sc = (struct sk_softc *)self;	struct pci_attach_args *pa = aux;	struct skc_attach_args skca;	pci_chipset_tag_t pc = pa->pa_pc;	pci_intr_handle_t ih;	const char *intrstr = NULL;	bus_addr_t iobase;	bus_size_t iosize;	int s;	u_int32_t command;	DPRINTFN(2, ("begin skc_attach\n"));	s = splimp();	/*	 * Handle power management nonsense.	 */	command = pci_conf_read(pc, pa->pa_tag, SK_PCI_CAPID) & 0x000000FF;	if (command == 0x01) {		command = pci_conf_read(pc, pa->pa_tag, SK_PCI_PWRMGMTCTRL);		if (command & SK_PSTATE_MASK) {			u_int32_t		iobase, membase, irq;			/* Save important PCI config data. */			iobase = pci_conf_read(pc, pa->pa_tag, SK_PCI_LOIO);			membase = pci_conf_read(pc, pa->pa_tag, SK_PCI_LOMEM);			irq = pci_conf_read(pc, pa->pa_tag, SK_PCI_INTLINE);			/* Reset the power state. */			printf("%s chip is in D%d power mode "			    "-- setting to D0\n", sc->sk_dev.dv_xname,			    command & SK_PSTATE_MASK);			command &= 0xFFFFFFFC;			pci_conf_write(pc, pa->pa_tag,			    SK_PCI_PWRMGMTCTRL, command);			/* Restore PCI config data. */			pci_conf_write(pc, pa->pa_tag, SK_PCI_LOIO, iobase);			pci_conf_write(pc, pa->pa_tag, SK_PCI_LOMEM, membase);			pci_conf_write(pc, pa->pa_tag, SK_PCI_INTLINE, irq);		}	}	/*	 * Map control/status registers.	 */	command = pci_conf_read(pc, pa->pa_tag, PCI_COMMAND_STATUS_REG);	switch (PCI_PRODUCT(pa->pa_id)) {	case PCI_PRODUCT_SCHNEIDERKOCH_GE:		sc->sk_type = SK_GENESIS;		break;	case PCI_PRODUCT_SCHNEIDERKOCH_SK9821v2:	case PCI_PRODUCT_3COM_3C940:	case PCI_PRODUCT_DLINK_DGE530T:	case PCI_PRODUCT_LINKSYS_EG1032:	case PCI_PRODUCT_LINKSYS_EG1064:		sc->sk_type = SK_YUKON;		break;	default:		printf(": unknown device!\n");		goto fail;	}#ifdef SK_USEIOSPACE	if (!(command & PCI_COMMAND_IO_ENABLE)) {		printf(": failed to enable I/O ports!\n");		goto fail;	}	/*	 * Map control/status registers.	 */	if (pci_io_find(pc, pa->pa_tag, SK_PCI_LOIO, &iobase, &iosize)) {		printf(": can't find i/o space\n");		goto fail;	}	if (bus_space_map(pa->pa_iot, iobase, iosize, 0, &sc->sk_bhandle)) {		printf(": can't map i/o space\n");		goto fail;	}	sc->sk_btag = pa->pa_iot;#else	if (!(command & PCI_COMMAND_MEM_ENABLE)) {		printf(": failed to enable memory mapping!\n");		goto fail;	}	if (pci_mem_find(pc, pa->pa_tag, SK_PCI_LOMEM, &iobase, &iosize, NULL)){		printf(": can't find mem space\n");		goto fail;	}	if (bus_space_map(pa->pa_memt, iobase, iosize, 0, &sc->sk_bhandle)) {		printf(": can't map mem space\n");		goto fail;	}	sc->sk_btag = pa->pa_memt;	DPRINTFN(2, ("skc_attach: iobase=%#x, iosize=%#x\n", iobase, iosize));#endif	sc->sc_dmatag = pa->pa_dmat;	DPRINTFN(2, ("skc_attach: allocate interrupt\n"));	/* Allocate interrupt */	if (pci_intr_map(pa, &ih)) {		printf(": couldn't map interrupt\n");		goto fail;	}	intrstr = pci_intr_string(pc, ih);	sc->sk_intrhand = pci_intr_establish(pc, ih, IPL_NET, sk_intr, sc,	    self->dv_xname);	if (sc->sk_intrhand == NULL) {		printf(": couldn't establish interrupt");		if (intrstr != NULL)			printf(" at %s", intrstr);		goto fail;	}	printf(": %s\n", intrstr);	/* Reset the adapter. */	sk_reset(sc);	/* Read and save vital product data from EEPROM. */	sk_vpd_read(sc);	if (sc->sk_type == SK_GENESIS) {		u_int8_t val = sk_win_read_1(sc, SK_EPROM0);		/* Read and save RAM size and RAMbuffer offset */		switch(val) {		case SK_RAMSIZE_512K_64:			sc->sk_ramsize = 0x80000;			sc->sk_rboff = SK_RBOFF_0;			break;		case SK_RAMSIZE_1024K_64:			sc->sk_ramsize = 0x100000;			sc->sk_rboff = SK_RBOFF_80000;			break;		case SK_RAMSIZE_1024K_128:			sc->sk_ramsize = 0x100000;			sc->sk_rboff = SK_RBOFF_0;			break;		case SK_RAMSIZE_2048K_128:			sc->sk_ramsize = 0x200000;			sc->sk_rboff = SK_RBOFF_0;			break;		default:			printf("%s: unknown ram size: %d\n",			       sc->sk_dev.dv_xname, val);			goto fail;			break;		}		DPRINTFN(2, ("skc_attach: ramsize=%d(%dk), rboff=%d\n",			     sc->sk_ramsize, sc->sk_ramsize / 1024,			     sc->sk_rboff));	} else {		sc->sk_ramsize = 0x20000;		sc->sk_rboff = SK_RBOFF_0;		DPRINTFN(2, ("skc_attach: ramsize=%dk (%d), rboff=%d\n",			     sc->sk_ramsize / 1024, sc->sk_ramsize,			     sc->sk_rboff));	}	/* Read and save physical media type */	switch(sk_win_read_1(sc, SK_PMDTYPE)) {	case SK_PMD_1000BASESX:		sc->sk_pmd = IFM_1000_SX;		break;	case SK_PMD_1000BASELX:		sc->sk_pmd = IFM_1000_LX;		break;	case SK_PMD_1000BASECX:		sc->sk_pmd = IFM_1000_CX;		break;	case SK_PMD_1000BASETX:		sc->sk_pmd = IFM_1000_T;		break;	default:		printf("%s: unknown media type: 0x%x\n",		    sc->sk_dev.dv_xname, sk_win_read_1(sc, SK_PMDTYPE));		goto fail;	}	/* Announce the product name. */	printf("%s: %s\n", sc->sk_dev.dv_xname, sc->sk_vpd_prodname);	skca.skc_port = SK_PORT_A;	(void)config_found(&sc->sk_dev, &skca, skcprint);	if (!(sk_win_read_1(sc, SK_CONFIG) & SK_CONFIG_SINGLEMAC)) {		skca.skc_port = SK_PORT_B;		(void)config_found(&sc->sk_dev, &skca, skcprint);	}	/* Turn on the 'driver is loaded' LED. */	CSR_WRITE_2(sc, SK_LED, SK_LED_GREEN_ON);fail:	splx(s);}