lp->rba_laddr = (unsigned int)lp->rba; 
/* Now set up the pointers to point to the appropriate places */ lp->cda = lp->descriptors; lp->tda = lp->cda + (SIZEOF_SONIC_CDA * SONIC_BUS_SCALE(lp->dma_bitmode)); lp->rda = lp->tda + (SIZEOF_SONIC_TD * SONIC_NUM_TDS * SONIC_BUS_SCALE(lp->dma_bitmode)); lp->rra = lp->rda + (SIZEOF_SONIC_RD * SONIC_NUM_RDS * SONIC_BUS_SCALE(lp->dma_bitmode)); 
int __init macsonic_init(struct net_device* dev){	struct sonic_local* lp = NULL;	int i;	/* Allocate the entire chunk of memory for the descriptors.           Note that this cannot cross a 64K boundary. */	for (i = 0; i < 20; i++) {		unsigned long desc_base, desc_top;		if((lp = kmalloc(sizeof(struct sonic_local), GFP_KERNEL | GFP_DMA)) == NULL) {			printk(KERN_ERR "%s: couldn't allocate descriptor buffers\n", dev->name);			return -ENOMEM;		}		desc_base = (unsigned long) lp;		desc_top = desc_base + sizeof(struct sonic_local);		if ((desc_top & 0xffff) >= (desc_base & 0xffff))			break;		/* Hmm. try again (FIXME: does this actually work?) */		kfree(lp);		printk(KERN_DEBUG		       "%s: didn't get continguous chunk [%08lx - %08lx], trying again\n",		       dev->name, desc_base, desc_top);	}	if (lp == NULL) {		printk(KERN_ERR "%s: tried 20 times to allocate descriptor buffers, giving up.\n",		       dev->name);		return -ENOMEM;	}		       	dev->priv = lp;#if 0	/* this code is only here as a curiousity...   mainly, where the 	   fuck did SONIC_BUS_SCALE come from, and what was it supposed	   to do?  the normal allocation works great for 32 bit stuffs..  */	/* Now set up the pointers to point to the appropriate places */	lp->cda = lp->sonic_desc;	lp->tda = lp->cda + (SIZEOF_SONIC_CDA * SONIC_BUS_SCALE(lp->dma_bitmode));	lp->rda = lp->tda + (SIZEOF_SONIC_TD * SONIC_NUM_TDS			     * SONIC_BUS_SCALE(lp->dma_bitmode));	lp->rra = lp->rda + (SIZEOF_SONIC_RD * SONIC_NUM_RDS			     * SONIC_BUS_SCALE(lp->dma_bitmode));#endif		memset(lp, 0, sizeof(struct sonic_local));	lp->cda_laddr = (unsigned int)&(lp->cda);	lp->tda_laddr = (unsigned int)lp->tda;	lp->rra_laddr = (unsigned int)lp->rra;	lp->rda_laddr = (unsigned int)lp->rda;	/* FIXME, maybe we should use skbs */	if ((lp->rba = (char *)	     kmalloc(SONIC_NUM_RRS * SONIC_RBSIZE, GFP_KERNEL | GFP_DMA)) == NULL) {		printk(KERN_ERR "%s: couldn't allocate receive buffers\n", dev->name);		dev->priv = NULL;		kfree(lp);		return -ENOMEM;	}	lp->rba_laddr = (unsigned int)lp->rba;	{		int rs, ds;		/* almost always 12*4096, but let's not take chances */		rs = ((SONIC_NUM_RRS * SONIC_RBSIZE + 4095) / 4096) * 4096;		/* almost always under a page, but let's not take chances */		ds = ((sizeof(struct sonic_local) + 4095) / 4096) * 4096;		kernel_set_cachemode(lp->rba, rs, IOMAP_NOCACHE_SER);		kernel_set_cachemode(lp, ds, IOMAP_NOCACHE_SER);	}	#if 0	flush_cache_all();#endif	dev->open = sonic_open;	dev->stop = sonic_close;	dev->hard_start_xmit = sonic_send_packet;	dev->get_stats = sonic_get_stats;	dev->set_multicast_list = &sonic_multicast_list;	/*	 * clear tally counter	 */	sonic_write(dev, SONIC_CRCT, 0xffff);	sonic_write(dev, SONIC_FAET, 0xffff);	sonic_write(dev, SONIC_MPT, 0xffff);	return 0;}
10457	/local/tlutelli/issta_data/temp/c/2005_temp/2005/10457/efcce839360fb3a7b6dedeacaec80f68b0f2d052/macsonic.c/clean/drivers/net/macsonic.c