int rio_open_outb_mbox(struct rio_mport *mport, int mbox, int entries) 
int rio_open_outb_mbox(struct rio_mport *mport, void *dev_id, int mbox, int entries) 
int rio_open_outb_mbox(struct rio_mport *mport, int mbox, int entries){	int i, j, rc = 0;	if ((entries < RIO_MIN_TX_RING_SIZE) ||	    (entries > RIO_MAX_TX_RING_SIZE) || (!is_power_of_2(entries))) {		rc = -EINVAL;		goto out;	}	/* Initialize shadow copy ring */	msg_tx_ring.size = entries;	for (i = 0; i < msg_tx_ring.size; i++) {		if (!		    (msg_tx_ring.virt_buffer[i] =		     dma_alloc_coherent(NULL, RIO_MSG_BUFFER_SIZE,					&msg_tx_ring.phys_buffer[i],					GFP_KERNEL))) {			rc = -ENOMEM;			for (j = 0; j < msg_tx_ring.size; j++)				if (msg_tx_ring.virt_buffer[j])					dma_free_coherent(NULL,							  RIO_MSG_BUFFER_SIZE,							  msg_tx_ring.							  virt_buffer[j],							  msg_tx_ring.							  phys_buffer[j]);			goto out;		}	}	/* Initialize outbound message descriptor ring */	if (!(msg_tx_ring.virt = dma_alloc_coherent(NULL,						    msg_tx_ring.size *						    RIO_MSG_DESC_SIZE,						    &msg_tx_ring.phys,						    GFP_KERNEL))) {		rc = -ENOMEM;		goto out_dma;	}	memset(msg_tx_ring.virt, 0, msg_tx_ring.size * RIO_MSG_DESC_SIZE);	msg_tx_ring.tx_slot = 0;	/* Point dequeue/enqueue pointers at first entry in ring */	out_be32((void *)&msg_regs->odqdpar, msg_tx_ring.phys);	out_be32((void *)&msg_regs->odqepar, msg_tx_ring.phys);	/* Configure for snooping */	out_be32((void *)&msg_regs->osar, 0x00000004);	/* Clear interrupt status */	out_be32((void *)&msg_regs->osr, 0x000000b3);	/* Hook up outbound message handler */	if ((rc =	     request_irq(MPC85xx_IRQ_RIO_TX, mpc85xx_rio_tx_handler, 0,			 "msg_tx", (void *)mport)) < 0)		goto out_irq;	/*	 * Configure outbound message unit	 *      Snooping	 *      Interrupts (all enabled, except QEIE)	 *      Chaining mode	 *      Disable	 */	out_be32((void *)&msg_regs->omr, 0x00100220);	/* Set number of entries */	out_be32((void *)&msg_regs->omr,		 in_be32((void *)&msg_regs->omr) |		 ((get_bitmask_order(entries) - 2) << 12));	/* Now enable the unit */	out_be32((void *)&msg_regs->omr, in_be32((void *)&msg_regs->omr) | 0x1);      out:	return rc;      out_irq:	dma_free_coherent(NULL, msg_tx_ring.size * RIO_MSG_DESC_SIZE,			  msg_tx_ring.virt, msg_tx_ring.phys);      out_dma:	for (i = 0; i < msg_tx_ring.size; i++)		dma_free_coherent(NULL, RIO_MSG_BUFFER_SIZE,				  msg_tx_ring.virt_buffer[i],				  msg_tx_ring.phys_buffer[i]);	return rc;}
4520	/local/tlutelli/issta_data/temp/c/2005_temp/2005/4520/6978bbc097c2f665c336927a9d56ae39ef75fa56/ppc85xx_rio.c/buggy/arch/ppc/syslib/ppc85xx_rio.c