 sis_priv->mii_info.dev = net_dev; sis_priv->mii_info.mdio_read = mdio_read; sis_priv->mii_info.mdio_write = mdio_write; sis_priv->mii_info.phy_id_mask = 0x1f; sis_priv->mii_info.reg_num_mask = 0x1f;  
static int __devinit sis900_probe(struct pci_dev *pci_dev,				const struct pci_device_id *pci_id){	struct sis900_private *sis_priv;	struct net_device *net_dev;	struct pci_dev *dev;	dma_addr_t ring_dma;	void *ring_space;	long ioaddr;	int i, ret;	char *card_name = card_names[pci_id->driver_data];	const char *dev_name = pci_name(pci_dev);/* when built into the kernel, we only print version if device is found */#ifndef MODULE	static int printed_version;	if (!printed_version++)		printk(version);#endif	/* setup various bits in PCI command register */	ret = pci_enable_device(pci_dev);	if(ret) return ret;		i = pci_set_dma_mask(pci_dev, SIS900_DMA_MASK);	if(i){		printk(KERN_ERR "sis900.c: architecture does not support"			"32bit PCI busmaster DMA\n");		return i;	}		pci_set_master(pci_dev);		net_dev = alloc_etherdev(sizeof(struct sis900_private));	if (!net_dev)		return -ENOMEM;	SET_MODULE_OWNER(net_dev);	SET_NETDEV_DEV(net_dev, &pci_dev->dev);	/* We do a request_region() to register /proc/ioports info. */	ioaddr = pci_resource_start(pci_dev, 0);		ret = pci_request_regions(pci_dev, "sis900");	if (ret)		goto err_out;	sis_priv = net_dev->priv;	net_dev->base_addr = ioaddr;	net_dev->irq = pci_dev->irq;	sis_priv->pci_dev = pci_dev;	spin_lock_init(&sis_priv->lock);	pci_set_drvdata(pci_dev, net_dev);	ring_space = pci_alloc_consistent(pci_dev, TX_TOTAL_SIZE, &ring_dma);	if (!ring_space) {		ret = -ENOMEM;		goto err_out_cleardev;	}	sis_priv->tx_ring = (BufferDesc *)ring_space;	sis_priv->tx_ring_dma = ring_dma;	ring_space = pci_alloc_consistent(pci_dev, RX_TOTAL_SIZE, &ring_dma);	if (!ring_space) {		ret = -ENOMEM;		goto err_unmap_tx;	}	sis_priv->rx_ring = (BufferDesc *)ring_space;	sis_priv->rx_ring_dma = ring_dma;			/* The SiS900-specific entries in the device structure. */	net_dev->open = &sis900_open;	net_dev->hard_start_xmit = &sis900_start_xmit;	net_dev->stop = &sis900_close;	net_dev->get_stats = &sis900_get_stats;	net_dev->set_config = &sis900_set_config;	net_dev->set_multicast_list = &set_rx_mode;	net_dev->do_ioctl = &mii_ioctl;	net_dev->tx_timeout = sis900_tx_timeout;	net_dev->watchdog_timeo = TX_TIMEOUT;	net_dev->ethtool_ops = &sis900_ethtool_ops;#ifdef CONFIG_NET_POLL_CONTROLLER        net_dev->poll_controller = &sis900_poll;#endif	if (sis900_debug > 0)		sis_priv->msg_enable = sis900_debug;	else		sis_priv->msg_enable = SIS900_DEF_MSG;			/* Get Mac address according to the chip revision */	pci_read_config_byte(pci_dev, PCI_CLASS_REVISION, &(sis_priv->chipset_rev));	if(netif_msg_probe(sis_priv))		printk(KERN_DEBUG "%s: detected revision %2.2x, "				"trying to get MAC address...\n",				dev_name, sis_priv->chipset_rev);		ret = 0;	if (sis_priv->chipset_rev == SIS630E_900_REV)		ret = sis630e_get_mac_addr(pci_dev, net_dev);	else if ((sis_priv->chipset_rev > 0x81) && (sis_priv->chipset_rev <= 0x90) )		ret = sis635_get_mac_addr(pci_dev, net_dev);	else if (sis_priv->chipset_rev == SIS96x_900_REV)		ret = sis96x_get_mac_addr(pci_dev, net_dev);	else		ret = sis900_get_mac_addr(pci_dev, net_dev);	if (ret == 0) {		printk(KERN_WARNING "%s: Cannot read MAC address.\n", dev_name);		ret = -ENODEV;		goto err_unmap_rx;	}		/* 630ET : set the mii access mode as software-mode */	if (sis_priv->chipset_rev == SIS630ET_900_REV)		outl(ACCESSMODE | inl(ioaddr + cr), ioaddr + cr);	/* probe for mii transceiver */	if (sis900_mii_probe(net_dev) == 0) {		printk(KERN_WARNING "%s: Error probing MII device.\n",		       dev_name);		ret = -ENODEV;		goto err_unmap_rx;	}	/* save our host bridge revision */	dev = pci_get_device(PCI_VENDOR_ID_SI, PCI_DEVICE_ID_SI_630, NULL);	if (dev) {		pci_read_config_byte(dev, PCI_CLASS_REVISION, &sis_priv->host_bridge_rev);		pci_dev_put(dev);	}	ret = register_netdev(net_dev);	if (ret)		goto err_unmap_rx;	/* print some information about our NIC */	printk(KERN_INFO "%s: %s at %#lx, IRQ %d, ", net_dev->name,	       card_name, ioaddr, net_dev->irq);	for (i = 0; i < 5; i++)		printk("%2.2x:", (u8)net_dev->dev_addr[i]);	printk("%2.2x.\n", net_dev->dev_addr[i]);	return 0; err_unmap_rx:	pci_free_consistent(pci_dev, RX_TOTAL_SIZE, sis_priv->rx_ring,		sis_priv->rx_ring_dma); err_unmap_tx:	pci_free_consistent(pci_dev, TX_TOTAL_SIZE, sis_priv->tx_ring,		sis_priv->tx_ring_dma); err_out_cleardev: 	pci_set_drvdata(pci_dev, NULL);	pci_release_regions(pci_dev); err_out:	free_netdev(net_dev);	return ret;}
4520	/local/tlutelli/issta_data/temp/c/2005_temp/2005/4520/da369b01d49b34803265096eb92a2d6da61cf0d0/sis900.c/clean/drivers/net/sis900.c