outb(lp->rcv_lower_limit >> 8, ioaddr + RCV_LOWER_LIMIT_REG); outb(lp->rcv_upper_limit >> 8, ioaddr + RCV_UPPER_LIMIT_REG); 
outb(lp->rcv_lower_limit >> 8, ioaddr + RCV_LOWER_LIMIT_REG); outb(lp->rcv_upper_limit >> 8, ioaddr + RCV_UPPER_LIMIT_REG); 
static int eepro_open(struct net_device *dev){	unsigned short temp_reg, old8, old9;	int irqMask;	int i, ioaddr = dev->base_addr;	struct eepro_local *lp = netdev_priv(dev);	if (net_debug > 3)		printk(KERN_DEBUG "%s: entering eepro_open routine.\n", dev->name);	irqMask = lp->word[7];	if (lp->eepro == LAN595FX_10ISA) {		if (net_debug > 3) printk(KERN_DEBUG "p->eepro = 3;\n");	}	else if (irqMask == ee_FX_INT2IRQ) /* INT to IRQ Mask */		{			lp->eepro = 2; /* Yes, an Intel EtherExpress Pro/10+ */			if (net_debug > 3) printk(KERN_DEBUG "p->eepro = 2;\n");		}	else if ((dev->dev_addr[0] == SA_ADDR0 &&			dev->dev_addr[1] == SA_ADDR1 &&			dev->dev_addr[2] == SA_ADDR2))		{			lp->eepro = 1;			if (net_debug > 3) printk(KERN_DEBUG "p->eepro = 1;\n");		}  /* Yes, an Intel EtherExpress Pro/10 */	else lp->eepro = 0; /* No, it is a generic 82585 lan card */	/* Get the interrupt vector for the 82595 */	if (dev->irq < 2 && eepro_grab_irq(dev) == 0) {		printk(KERN_ERR "%s: unable to get IRQ %d.\n", dev->name, dev->irq);		return -EAGAIN;	}	if (request_irq(dev->irq , &eepro_interrupt, 0, dev->name, dev)) {		printk(KERN_ERR "%s: unable to get IRQ %d.\n", dev->name, dev->irq);		return -EAGAIN;	}#ifdef irq2dev_map	if  (((irq2dev_map[dev->irq] != 0)		|| (irq2dev_map[dev->irq] = dev) == 0) &&		(irq2dev_map[dev->irq]!=dev)) {		/* printk("%s: IRQ map wrong\n", dev->name); */	        free_irq(dev->irq, dev);		return -EAGAIN;	}#endif	/* Initialize the 82595. */	eepro_sw2bank2(ioaddr); /* be CAREFUL, BANK 2 now */	temp_reg = inb(ioaddr + lp->eeprom_reg);	lp->stepping = temp_reg >> 5;	/* Get the stepping number of the 595 */	if (net_debug > 3)		printk(KERN_DEBUG "The stepping of the 82595 is %d\n", lp->stepping);	if (temp_reg & 0x10) /* Check the TurnOff Enable bit */		outb(temp_reg & 0xef, ioaddr + lp->eeprom_reg);	for (i=0; i < 6; i++)		outb(dev->dev_addr[i] , ioaddr + I_ADD_REG0 + i);	temp_reg = inb(ioaddr + REG1);    /* Setup Transmit Chaining */	outb(temp_reg | XMT_Chain_Int | XMT_Chain_ErrStop /* and discard bad RCV frames */		| RCV_Discard_BadFrame, ioaddr + REG1);	temp_reg = inb(ioaddr + REG2); /* Match broadcast */	outb(temp_reg | 0x14, ioaddr + REG2);	temp_reg = inb(ioaddr + REG3);	outb(temp_reg & 0x3f, ioaddr + REG3); /* clear test mode */	/* Set the receiving mode */	eepro_sw2bank1(ioaddr); /* be CAREFUL, BANK 1 now */	/* Set the interrupt vector */	temp_reg = inb(ioaddr + INT_NO_REG);	if (lp->eepro == LAN595FX || lp->eepro == LAN595FX_10ISA)		outb((temp_reg & 0xf8) | irqrmap2[dev->irq], ioaddr + INT_NO_REG);	else outb((temp_reg & 0xf8) | irqrmap[dev->irq], ioaddr + INT_NO_REG);	temp_reg = inb(ioaddr + INT_NO_REG);	if (lp->eepro == LAN595FX || lp->eepro == LAN595FX_10ISA)		outb((temp_reg & 0xf0) | irqrmap2[dev->irq] | 0x08,ioaddr+INT_NO_REG);	else outb((temp_reg & 0xf8) | irqrmap[dev->irq], ioaddr + INT_NO_REG);	if (net_debug > 3)		printk(KERN_DEBUG "eepro_open: content of INT Reg is %x\n", temp_reg);	/* Initialize the RCV and XMT upper and lower limits */	outb(lp->rcv_lower_limit >> 8, ioaddr + RCV_LOWER_LIMIT_REG); 	outb(lp->rcv_upper_limit >> 8, ioaddr + RCV_UPPER_LIMIT_REG); 	outb(lp->xmt_lower_limit >> 8, ioaddr + lp->xmt_lower_limit_reg);	outb(lp->xmt_upper_limit >> 8, ioaddr + lp->xmt_upper_limit_reg);	/* Enable the interrupt line. */	eepro_en_intline(ioaddr);	/* Switch back to Bank 0 */	eepro_sw2bank0(ioaddr);	/* Let RX and TX events to interrupt */	eepro_en_int(ioaddr);	/* clear all interrupts */	eepro_clear_int(ioaddr);	/* Initialize RCV */	outw(lp->rcv_lower_limit, ioaddr + RCV_BAR); 	lp->rx_start = lp->rcv_lower_limit;	outw(lp->rcv_upper_limit | 0xfe, ioaddr + RCV_STOP); 	/* Initialize XMT */	outw(lp->xmt_lower_limit, ioaddr + lp->xmt_bar); 	lp->tx_start = lp->tx_end = lp->xmt_lower_limit;	lp->tx_last = 0;	/* Check for the i82595TX and i82595FX */	old8 = inb(ioaddr + 8);	outb(~old8, ioaddr + 8);	if ((temp_reg = inb(ioaddr + 8)) == old8) {		if (net_debug > 3)			printk(KERN_DEBUG "i82595 detected!\n");		lp->version = LAN595;	}	else {		lp->version = LAN595TX;		outb(old8, ioaddr + 8);		old9 = inb(ioaddr + 9);		if (irqMask==ee_FX_INT2IRQ) {			if (net_debug > 3) {				printk(KERN_DEBUG "IrqMask: %#x\n",irqMask);				printk(KERN_DEBUG "i82595FX detected!\n");			}			lp->version = LAN595FX;			outb(old9, ioaddr + 9);			if (dev->if_port != TPE) {	/* Hopefully, this will fix the							problem of using Pentiums and							pro/10 w/ BNC. */				eepro_sw2bank2(ioaddr); /* be CAREFUL, BANK 2 now */				temp_reg = inb(ioaddr + REG13);				/* disable the full duplex mode since it is not				applicable with the 10Base2 cable. */				outb(temp_reg & ~(FDX | A_N_ENABLE), REG13);				eepro_sw2bank0(ioaddr); /* be CAREFUL, BANK 0 now */			}		}		else if (net_debug > 3) {			printk(KERN_DEBUG "temp_reg: %#x  ~old9: %#x\n",temp_reg,((~old9)&0xff));			printk(KERN_DEBUG "i82595TX detected!\n");		}	}	eepro_sel_reset(ioaddr);	netif_start_queue(dev);	if (net_debug > 3)		printk(KERN_DEBUG "%s: exiting eepro_open routine.\n", dev->name);	/* enabling rx */	eepro_en_rx(ioaddr);	return 0;}
10457	/local/tlutelli/issta_data/temp/c/2005_temp/2005/10457/d61780c0d384939ef31c46b47442854d5def4623/eepro.c/buggy/drivers/net/eepro.c