 #endif 
static void __init de21041_get_srom_info (struct de_private *de){	unsigned i, sa_offset = 0, ofs;	u8 ee_data[DE_EEPROM_SIZE + 6] = {};	unsigned ee_addr_size = tulip_read_eeprom(de->regs, 0xff, 8) & 0x40000 ? 8 : 6;	struct de_srom_info_leaf *il;	void *bufp;	/* download entire eeprom */	for (i = 0; i < DE_EEPROM_WORDS; i++)		((u16 *)ee_data)[i] =			le16_to_cpu(tulip_read_eeprom(de->regs, i, ee_addr_size));	/* DEC now has a specification but early board makers	   just put the address in the first EEPROM locations. */	/* This does  memcmp(eedata, eedata+16, 8) */	for (i = 0; i < 8; i ++)		if (ee_data[i] != ee_data[16+i])			sa_offset = 20;	/* store MAC address */	for (i = 0; i < 6; i ++)		de->dev->dev_addr[i] = ee_data[i + sa_offset];	/* get offset of controller 0 info leaf.  ignore 2nd byte. */	ofs = ee_data[SROMC0InfoLeaf];	if (ofs >= (sizeof(ee_data) - sizeof(struct de_srom_info_leaf) - sizeof(struct de_srom_media_block)))		goto bad_srom;	/* get pointer to info leaf */	il = (struct de_srom_info_leaf *) &ee_data[ofs];	/* paranoia checks */	if (il->n_blocks == 0)		goto bad_srom;	if ((sizeof(ee_data) - ofs) <	    (sizeof(struct de_srom_info_leaf) + (sizeof(struct de_srom_media_block) * il->n_blocks)))		goto bad_srom;	/* get default media type */	switch (DE_UNALIGNED_16(&il->default_media)) {	case 0x0001:  de->media_type = DE_MEDIA_BNC; break;	case 0x0002:  de->media_type = DE_MEDIA_AUI; break;	case 0x0204:  de->media_type = DE_MEDIA_TP_FD; break;	default: de->media_type = DE_MEDIA_TP_AUTO; break;	}		if (netif_msg_probe(de))		printk(KERN_INFO "de%d: SROM leaf offset %u, default media %s\n",		       de->board_idx, ofs,		       media_name[de->media_type]);	/* init SIA register values to defaults */	for (i = 0; i < DE_MAX_MEDIA; i++) {		de->media[i].type = DE_MEDIA_INVALID;		de->media[i].csr13 = 0xffff;		de->media[i].csr14 = 0xffff;		de->media[i].csr15 = 0xffff;	}	/* parse media blocks to see what medias are supported,	 * and if any custom CSR values are provided	 */	bufp = ((void *)il) + sizeof(*il);	for (i = 0; i < il->n_blocks; i++) {		struct de_srom_media_block *ib = bufp;		unsigned idx;		/* index based on media type in media block */		switch(ib->opts & MediaBlockMask) {		case 0: /* 10baseT */			de->media_supported |= SUPPORTED_TP | SUPPORTED_10baseT_Half					  | SUPPORTED_Autoneg;			idx = DE_MEDIA_TP;			de->media[DE_MEDIA_TP_AUTO].type = DE_MEDIA_TP_AUTO;			break;		case 1: /* BNC */			de->media_supported |= SUPPORTED_BNC;			idx = DE_MEDIA_BNC;			break;		case 2: /* AUI */			de->media_supported |= SUPPORTED_AUI;			idx = DE_MEDIA_AUI;			break;		case 4: /* 10baseT-FD */			de->media_supported |= SUPPORTED_TP | SUPPORTED_10baseT_Full					  | SUPPORTED_Autoneg;			idx = DE_MEDIA_TP_FD;			de->media[DE_MEDIA_TP_AUTO].type = DE_MEDIA_TP_AUTO;			break;		default:			goto bad_srom;		}		de->media[idx].type = idx;		if (netif_msg_probe(de))			printk(KERN_INFO "de%d:   media block #%u: %s",			       de->board_idx, i,			       media_name[de->media[idx].type]);		bufp += sizeof (ib->opts);		if (ib->opts & MediaCustomCSRs) {			de->media[idx].csr13 = DE_UNALIGNED_16(&ib->csr13);			de->media[idx].csr14 = DE_UNALIGNED_16(&ib->csr14);			de->media[idx].csr15 = DE_UNALIGNED_16(&ib->csr15);			bufp += sizeof(ib->csr13) + sizeof(ib->csr14) +				sizeof(ib->csr15);			if (netif_msg_probe(de))				printk(" (%x,%x,%x)\n",				       de->media[idx].csr13,				       de->media[idx].csr14,				       de->media[idx].csr15);				       		} else if (netif_msg_probe(de))			printk("\n");		if (bufp > ((void *)&ee_data[DE_EEPROM_SIZE - 3]))			break;	}	de->media_advertise = de->media_supported;fill_defaults:	/* fill in defaults, for cases where custom CSRs not used */	for (i = 0; i < DE_MAX_MEDIA; i++) {		if (de->media[i].csr13 == 0xffff)			de->media[i].csr13 = t21041_csr13[i];		if (de->media[i].csr14 == 0xffff)			de->media[i].csr14 = t21041_csr14[i];		if (de->media[i].csr15 == 0xffff)			de->media[i].csr15 = t21041_csr15[i];	}	de->ee_data = kmalloc(DE_EEPROM_SIZE, GFP_KERNEL);	if (de->ee_data)		memcpy(de->ee_data, &ee_data[0], DE_EEPROM_SIZE);	return;bad_srom:	/* for error cases, it's ok to assume we support all these */	for (i = 0; i < DE_MAX_MEDIA; i++)		de->media[i].type = i;	de->media_supported =		SUPPORTED_10baseT_Half |		SUPPORTED_10baseT_Full |		SUPPORTED_Autoneg |		SUPPORTED_TP |		SUPPORTED_AUI |		SUPPORTED_BNC;	goto fill_defaults;}
10457	/local/tlutelli/issta_data/temp/c/2005_temp/2005/10457/bc053d45cb0ca5daeaa69ae9ac43cdea42693f60/de2104x.c/buggy/drivers/net/tulip/de2104x.c