static void mpsc_start_rx(struct mpsc_port_info *pi); 
mpsc_rx_intr(struct mpsc_port_info *pi, struct pt_regs *regs){	struct mpsc_rx_desc *rxre;	struct tty_struct *tty = pi->port.info->tty;	u32	cmdstat, bytes_in, i;	int	rc = 0;	u8	*bp;	char	flag = TTY_NORMAL;	static void mpsc_start_rx(struct mpsc_port_info *pi);	pr_debug("mpsc_rx_intr[%d]: Handling Rx intr\n", pi->port.line);	rxre = (struct mpsc_rx_desc *)(pi->rxr + (pi->rxr_posn*MPSC_RXRE_SIZE));	dma_cache_sync((void *)rxre, MPSC_RXRE_SIZE, DMA_FROM_DEVICE);#if defined(CONFIG_PPC32) && !defined(CONFIG_NOT_COHERENT_CACHE)	if (pi->cache_mgmt) /* GT642[46]0 Res #COMM-2 */		invalidate_dcache_range((ulong)rxre,			(ulong)rxre + MPSC_RXRE_SIZE);#endif	/*	 * Loop through Rx descriptors handling ones that have been completed.	 */	while (!((cmdstat = be32_to_cpu(rxre->cmdstat)) & SDMA_DESC_CMDSTAT_O)){		bytes_in = be16_to_cpu(rxre->bytecnt);		/* Following use of tty struct directly is deprecated */		if (unlikely((tty->flip.count + bytes_in) >= TTY_FLIPBUF_SIZE)){			if (tty->low_latency)				tty_flip_buffer_push(tty);			/*			 * If this failed then we will throw awa the bytes			 * but mst do so to clear interrupts.			 */		}		bp = pi->rxb + (pi->rxr_posn * MPSC_RXBE_SIZE);		dma_cache_sync((void *) bp, MPSC_RXBE_SIZE, DMA_FROM_DEVICE);#if defined(CONFIG_PPC32) && !defined(CONFIG_NOT_COHERENT_CACHE)		if (pi->cache_mgmt) /* GT642[46]0 Res #COMM-2 */			invalidate_dcache_range((ulong)bp,				(ulong)bp + MPSC_RXBE_SIZE);#endif		/*		 * Other than for parity error, the manual provides little		 * info on what data will be in a frame flagged by any of		 * these errors.  For parity error, it is the last byte in		 * the buffer that had the error.  As for the rest, I guess		 * we'll assume there is no data in the buffer.		 * If there is...it gets lost.		 */		if (unlikely(cmdstat & (SDMA_DESC_CMDSTAT_BR |			SDMA_DESC_CMDSTAT_FR | SDMA_DESC_CMDSTAT_OR))) {			pi->port.icount.rx++;			if (cmdstat & SDMA_DESC_CMDSTAT_BR) {	/* Break */				pi->port.icount.brk++;				if (uart_handle_break(&pi->port))					goto next_frame;			}			else if (cmdstat & SDMA_DESC_CMDSTAT_FR)/* Framing */				pi->port.icount.frame++;			else if (cmdstat & SDMA_DESC_CMDSTAT_OR) /* Overrun */				pi->port.icount.overrun++;			cmdstat &= pi->port.read_status_mask;			if (cmdstat & SDMA_DESC_CMDSTAT_BR)				flag = TTY_BREAK;			else if (cmdstat & SDMA_DESC_CMDSTAT_FR)				flag = TTY_FRAME;			else if (cmdstat & SDMA_DESC_CMDSTAT_OR)				flag = TTY_OVERRUN;			else if (cmdstat & SDMA_DESC_CMDSTAT_PE)				flag = TTY_PARITY;		}		if (uart_handle_sysrq_char(&pi->port, *bp, regs)) {			bp++;			bytes_in--;			goto next_frame;		}		if ((unlikely(cmdstat & (SDMA_DESC_CMDSTAT_BR |			SDMA_DESC_CMDSTAT_FR | SDMA_DESC_CMDSTAT_OR))) &&			!(cmdstat & pi->port.ignore_status_mask))			tty_insert_flip_char(tty, *bp, flag);		else {			for (i=0; i<bytes_in; i++)				tty_insert_flip_char(tty, *bp++, TTY_NORMAL);			pi->port.icount.rx += bytes_in;		}next_frame:		rxre->bytecnt = cpu_to_be16(0);		wmb();		rxre->cmdstat = cpu_to_be32(SDMA_DESC_CMDSTAT_O |					    SDMA_DESC_CMDSTAT_EI |					    SDMA_DESC_CMDSTAT_F |					    SDMA_DESC_CMDSTAT_L);		wmb();		dma_cache_sync((void *)rxre, MPSC_RXRE_SIZE, DMA_BIDIRECTIONAL);#if defined(CONFIG_PPC32) && !defined(CONFIG_NOT_COHERENT_CACHE)		if (pi->cache_mgmt) /* GT642[46]0 Res #COMM-2 */			flush_dcache_range((ulong)rxre,				(ulong)rxre + MPSC_RXRE_SIZE);#endif		/* Advance to next descriptor */		pi->rxr_posn = (pi->rxr_posn + 1) & (MPSC_RXR_ENTRIES - 1);		rxre = (struct mpsc_rx_desc *)(pi->rxr +			(pi->rxr_posn * MPSC_RXRE_SIZE));		dma_cache_sync((void *)rxre, MPSC_RXRE_SIZE, DMA_FROM_DEVICE);#if defined(CONFIG_PPC32) && !defined(CONFIG_NOT_COHERENT_CACHE)		if (pi->cache_mgmt) /* GT642[46]0 Res #COMM-2 */			invalidate_dcache_range((ulong)rxre,				(ulong)rxre + MPSC_RXRE_SIZE);#endif		rc = 1;	}	/* Restart rx engine, if its stopped */	if ((readl(pi->sdma_base + SDMA_SDCM) & SDMA_SDCM_ERD) == 0)		mpsc_start_rx(pi);	tty_flip_buffer_push(tty);	return rc;}
10457	/local/tlutelli/issta_data/temp/c/2005_temp/2005/10457/4d0145a7deab4027a0f0a7de74c2d103b8f029cf/mpsc.c/buggy/drivers/serial/mpsc.c