if(((u16 *) db->srom)[0] == 0xffff)		/* SROM absent, so read MAC address from ID Table */ 
if(((u16 *) db->srom)[0] == 0xffff || ((u16 *) db->srom)[0] == 0)		/* SROM absent, so read MAC address from ID Table */ 
static int __devinit uli526x_init_one (struct pci_dev *pdev,				    const struct pci_device_id *ent){	struct uli526x_board_info *db;	/* board information structure */	struct net_device *dev;	int i, err;	u32 configval;	ULI526X_DBUG(0, "uli526x_init_one()", 0);	if (!printed_version++)		printk(version);	/* Init network device */	dev = alloc_etherdev(sizeof(*db));	if (dev == NULL)		return -ENOMEM;	SET_MODULE_OWNER(dev);	SET_NETDEV_DEV(dev, &pdev->dev);	if (pci_set_dma_mask(pdev, 0xffffffff)) {		printk(KERN_WARNING DRV_NAME ": 32-bit PCI DMA not available.\n");		err = -ENODEV;		goto err_out_free;	}	/* Enable Master/IO access, Disable memory access */	err = pci_enable_device(pdev);	if (err)		goto err_out_free;	if (!pci_resource_start(pdev, 0)) {		printk(KERN_ERR DRV_NAME ": I/O base is zero\n");		err = -ENODEV;		goto err_out_disable;	}	if (pci_resource_len(pdev, 0) < (ULI526X_IO_SIZE) ) {		printk(KERN_ERR DRV_NAME ": Allocated I/O size too small\n");		err = -ENODEV;		goto err_out_disable;	}	if (pci_request_regions(pdev, DRV_NAME)) {		printk(KERN_ERR DRV_NAME ": Failed to request PCI regions\n");		err = -ENODEV;		goto err_out_disable;	}	//add by clearzhang 2004/7/8	pci_read_config_dword(pdev,0x0,&configval);	m526x_id = configval;	if(configval == 0x526310b9)	{		//printk("is m5263\n");		pci_read_config_dword(pdev,0x0c,&configval);		configval = ((configval & 0xffff00ff) | 0x8000);		pci_write_config_dword(pdev,0x0c,configval);	}	/* Init system & device */	db = netdev_priv(dev);	/* Allocate Tx/Rx descriptor memory */	db->desc_pool_ptr = pci_alloc_consistent(pdev, sizeof(struct tx_desc) * DESC_ALL_CNT + 0x20, &db->desc_pool_dma_ptr);	db->buf_pool_ptr = pci_alloc_consistent(pdev, TX_BUF_ALLOC * TX_DESC_CNT + 4, &db->buf_pool_dma_ptr);	db->first_tx_desc = (struct tx_desc *) db->desc_pool_ptr;	db->first_tx_desc_dma = db->desc_pool_dma_ptr;	db->buf_pool_start = db->buf_pool_ptr;	db->buf_pool_dma_start = db->buf_pool_dma_ptr;	db->chip_id = ent->driver_data;	db->ioaddr = pci_resource_start(pdev, 0);		db->pdev = pdev;	db->init = 1;		dev->base_addr = db->ioaddr;	dev->irq = pdev->irq;	pci_set_drvdata(pdev, dev);		/* Register some necessary functions */	dev->open = &uli526x_open;	dev->hard_start_xmit = &uli526x_start_xmit;	dev->stop = &uli526x_stop;	dev->get_stats = &uli526x_get_stats;	dev->set_multicast_list = &uli526x_set_filter_mode;	dev->ethtool_ops = &netdev_ethtool_ops;	spin_lock_init(&db->lock);			/* read 64 word srom data */	for (i = 0; i < 64; i++)		((u16 *) db->srom)[i] = cpu_to_le16(read_srom_word(db->ioaddr, i));	/* Set Node address */	if(((u16 *) db->srom)[0] == 0xffff)		/* SROM absent, so read MAC address from ID Table */	{		outl(0x10000, db->ioaddr + DCR0);	//Diagnosis mode		outl(0x1c0, db->ioaddr + DCR13);	//Reset dianostic pointer port		outl(0, db->ioaddr + DCR14);		//Clear reset port		outl(0x10, db->ioaddr + DCR14);		//Reset ID Table pointer		outl(0, db->ioaddr + DCR14);		//Clear reset port		outl(0, db->ioaddr + DCR13);		//Clear CR13		outl(0x1b0, db->ioaddr + DCR13);	//Select ID Table access port		//Read MAC address from CR14		for (i = 0; i < 6; i++)			dev->dev_addr[i] = inl(db->ioaddr + DCR14);		//Read end		outl(0, db->ioaddr + DCR13);	//Clear CR13		outl(0, db->ioaddr + DCR0);		//Clear CR0		udelay(10);	}	else		/*Exist SROM*/	{		for (i = 0; i < 6; i++)			dev->dev_addr[i] = db->srom[20 + i];	}	err = register_netdev (dev);	if (err)		goto err_out_res;	printk(KERN_INFO "%s: ULi M%04lx at pci%s,",dev->name,ent->driver_data >> 16,pci_name(pdev));		for (i = 0; i < 6; i++)		printk("%c%02x", i ? ':' : ' ', dev->dev_addr[i]);	printk(", irq %d.\n", dev->irq);	pci_set_master(pdev);	return 0;err_out_res:	pci_release_regions(pdev);err_out_disable:	pci_disable_device(pdev);err_out_free:	pci_set_drvdata(pdev, NULL);	free_netdev(dev);	return err;}
4520	/local/tlutelli/issta_data/temp/c/2005_temp/2005/4520/945a787675cc5ba362f5d4ce135d2a2c20be5985/uli526x.c/buggy/drivers/net/tulip/uli526x.c