(void *)hw->dpmbase = ioremap((unsigned long)S514_mem_base_addr, 
hw->dpmbase = ioremap((unsigned long)S514_mem_base_addr, 
static int detect_s514 (sdlahw_t* hw){	unsigned char CPU_no, slot_no, auto_slot_cfg;	int number_S514_cards = 0;	u32 S514_mem_base_addr = 0;	u32 ut_u32;	struct pci_dev *pci_dev;#ifndef CONFIG_PCI        printk(KERN_INFO "%s: Linux not compiled for PCI usage!\n", modname);        return 0;#endif	/*	The 'setup()' procedure in 'sdlamain.c' passes the CPU number and the	slot number defined in 'router.conf' via the 'port' definition.	*/	CPU_no = hw->S514_cpu_no[0];	slot_no = hw->S514_slot_no;	auto_slot_cfg = hw->auto_pci_cfg;	if (auto_slot_cfg){		printk(KERN_INFO "%s: srch... S514 card, CPU %c, Slot=Auto\n",		modname, CPU_no);	}else{		printk(KERN_INFO "%s: srch... S514 card, CPU %c, Slot #%d\n",		modname, CPU_no, slot_no);	}		/* check to see that CPU A or B has been selected in 'router.conf' */	switch(CPU_no) {		case S514_CPU_A:		case S514_CPU_B:			break;			default:			printk(KERN_INFO "%s: S514 CPU definition invalid.\n", 				modname);			printk(KERN_INFO "Must be 'A' or 'B'\n");			return 0;	}	number_S514_cards = find_s514_adapter(hw, 0);	if(!number_S514_cards)		return 0;	/* we are using a single S514 adapter with a slot of 0 so re-read the */		/* location of this adapter */	if((number_S514_cards == 1) && auto_slot_cfg) {	        	number_S514_cards = find_s514_adapter(hw, 1);		if(!number_S514_cards) {			printk(KERN_INFO "%s: Error finding PCI card\n",				modname);			return 0;		}	}	pci_dev = hw->pci_dev;	/* read the physical memory base address */	S514_mem_base_addr = (CPU_no == S514_CPU_A) ? 		(pci_dev->resource[1].start) :		(pci_dev->resource[2].start);		printk(KERN_INFO "%s: S514 PCI memory at 0x%X\n",		modname, S514_mem_base_addr);	if(!S514_mem_base_addr) {		if(CPU_no == S514_CPU_B)			printk(KERN_INFO "%s: CPU #B not present on the card\n", 				modname);		else			printk(KERN_INFO "%s: No PCI memory allocated to card\n",				modname);		return 0;	}	/* enable the PCI memory */	pci_read_config_dword(pci_dev, 		(CPU_no == S514_CPU_A) ? PCI_MAP0_DWORD : PCI_MAP1_DWORD,		&ut_u32);	pci_write_config_dword(pci_dev,		(CPU_no == S514_CPU_A) ? PCI_MAP0_DWORD : PCI_MAP1_DWORD,		(ut_u32 | PCI_MEMORY_ENABLE));	/* check the IRQ allocated and enable IRQ usage */	if(!(hw->irq = pci_dev->irq)) {		printk(KERN_INFO "%s: IRQ not allocated to S514 adapter\n",			modname);                return 0;	}	/* BUG FIX : Mar 6 2000 	 * On a initial loading of the card, we must check         * and clear PCI interrupt bits, due to a reset         * problem on some other boards.  i.e. An interrupt         * might be pending, even after system bootup,          * in which case, when starting wanrouter the machine         * would crash. 	 */	if (init_pci_slot(hw))		return 0;        pci_read_config_dword(pci_dev, PCI_INT_CONFIG, &ut_u32);        ut_u32 |= (CPU_no == S514_CPU_A) ?                PCI_ENABLE_IRQ_CPU_A : PCI_ENABLE_IRQ_CPU_B;        pci_write_config_dword(pci_dev, PCI_INT_CONFIG, ut_u32);	printk(KERN_INFO "%s: IRQ %d allocated to the S514 card\n",		modname, hw->irq);	/* map the physical PCI memory to virtual memory */	(void *)hw->dpmbase = ioremap((unsigned long)S514_mem_base_addr,		(unsigned long)MAX_SIZEOF_S514_MEMORY);    	/* map the physical control register memory to virtual memory */	hw->vector = (unsigned long)ioremap(		(unsigned long)(S514_mem_base_addr + S514_CTRL_REG_BYTE),		(unsigned long)16);             if(!hw->dpmbase || !hw->vector) {		printk(KERN_INFO "%s: PCI virtual memory allocation failed\n",			modname);                return 0;	}	/* halt the adapter */	writeb (S514_CPU_HALT, hw->vector);		return 1;}
10457	/local/tlutelli/issta_data/temp/c/2005_temp/2005/10457/09071e35f9f0b308c37c9853766de573591589ea/sdladrv.c/buggy/drivers/net/wan/sdladrv.c