Lines Matching refs:pB

116 fatality(i2eBordStrPtr pB )  in fatality()  argument
163 iiSendPendingMail(i2eBordStrPtr pB) in iiSendPendingMail() argument
165 if (pB->i2eOutMailWaiting && (!pB->i2eWaitingForEmptyFifo) ) in iiSendPendingMail()
167 if (iiTrySendMail(pB, pB->i2eOutMailWaiting)) in iiSendPendingMail()
174 pB->i2eWaitingForEmptyFifo |= in iiSendPendingMail()
175 (pB->i2eOutMailWaiting & MB_OUT_STUFFED); in iiSendPendingMail()
176 pB->i2eOutMailWaiting = 0; in iiSendPendingMail()
177 if( pB->SendPendingRetry ) { in iiSendPendingMail()
178 printk( KERN_DEBUG "IP2: iiSendPendingMail: busy board pickup on %d\n", pB->SendPendingRetry ); in iiSendPendingMail()
180 pB->SendPendingRetry = 0; in iiSendPendingMail()
190 if( ++pB->SendPendingRetry < 16 ) { in iiSendPendingMail()
192 init_timer( &(pB->SendPendingTimer) ); in iiSendPendingMail()
193 pB->SendPendingTimer.expires = jiffies + 1; in iiSendPendingMail()
194 pB->SendPendingTimer.function = (void*)(unsigned long)iiSendPendingMail; in iiSendPendingMail()
195 pB->SendPendingTimer.data = (unsigned long)pB; in iiSendPendingMail()
196 add_timer( &(pB->SendPendingTimer) ); in iiSendPendingMail()
201 pB->SendPendingRetry++; in iiSendPendingMail()
202 if( 0 == ( pB->SendPendingRetry % 8 ) ) { in iiSendPendingMail()
203 printk( KERN_ERR "IP2: iiSendPendingMail: board busy, retry %d\n", pB->SendPendingRetry ); in iiSendPendingMail()
229 i2InitChannels ( i2eBordStrPtr pB, int nChannels, i2ChanStrPtr pCh) in i2InitChannels() argument
234 if (pB->i2eValid != I2E_MAGIC) { in i2InitChannels()
235 COMPLETE(pB, I2EE_BADMAGIC); in i2InitChannels()
237 if (pB->i2eState != II_STATE_STDLOADED) { in i2InitChannels()
238 COMPLETE(pB, I2EE_BADSTATE); in i2InitChannels()
241 LOCK_INIT(&pB->read_fifo_spinlock); in i2InitChannels()
242 LOCK_INIT(&pB->write_fifo_spinlock); in i2InitChannels()
243 LOCK_INIT(&pB->Dbuf_spinlock); in i2InitChannels()
244 LOCK_INIT(&pB->Bbuf_spinlock); in i2InitChannels()
245 LOCK_INIT(&pB->Fbuf_spinlock); in i2InitChannels()
249 pB->i2eChannelPtr = pCh; in i2InitChannels()
250 pB->i2eChannelCnt = nChannels; in i2InitChannels()
252 pB->i2Fbuf_strip = pB->i2Fbuf_stuff = 0; in i2InitChannels()
253 pB->i2Dbuf_strip = pB->i2Dbuf_stuff = 0; in i2InitChannels()
254 pB->i2Bbuf_strip = pB->i2Bbuf_stuff = 0; in i2InitChannels()
256 pB->SendPendingRetry = 0; in i2InitChannels()
260 for (index = stuffIndex = 0, ppCh = (i2ChanStrPtr *)(pB->i2Fbuf); in i2InitChannels()
264 if ( !(pB->i2eChannelMap[index >> 4] & (1 << (index & 0xf)) ) ) { in i2InitChannels()
273 if (pB->i2eGoodMap[index >> 4] & (1 << (index & 0xf)) ) { in i2InitChannels()
278 pCh->pMyBord = pB; /* Back-pointer */ in i2InitChannels()
358 pB->i2Fbuf_stuff = stuffIndex; in i2InitChannels()
359 COMPLETE(pB, I2EE_GOOD); in i2InitChannels()
375 i2DeQueueNeeds(i2eBordStrPtr pB, int type) in i2DeQueueNeeds() argument
386 WRITE_LOCK_IRQSAVE(&pB->Dbuf_spinlock,flags); in i2DeQueueNeeds()
387 if ( pB->i2Dbuf_stuff != pB->i2Dbuf_strip) in i2DeQueueNeeds()
389 queueIndex = pB->i2Dbuf_strip; in i2DeQueueNeeds()
390 pCh = pB->i2Dbuf[queueIndex]; in i2DeQueueNeeds()
395 pB->i2Dbuf_strip = queueIndex; in i2DeQueueNeeds()
398 WRITE_UNLOCK_IRQRESTORE(&pB->Dbuf_spinlock,flags); in i2DeQueueNeeds()
403 WRITE_LOCK_IRQSAVE(&pB->Bbuf_spinlock,flags); in i2DeQueueNeeds()
404 if (pB->i2Bbuf_stuff != pB->i2Bbuf_strip) in i2DeQueueNeeds()
406 queueIndex = pB->i2Bbuf_strip; in i2DeQueueNeeds()
407 pCh = pB->i2Bbuf[queueIndex]; in i2DeQueueNeeds()
412 pB->i2Bbuf_strip = queueIndex; in i2DeQueueNeeds()
415 WRITE_UNLOCK_IRQRESTORE(&pB->Bbuf_spinlock,flags); in i2DeQueueNeeds()
420 WRITE_LOCK_IRQSAVE(&pB->Fbuf_spinlock,flags); in i2DeQueueNeeds()
421 if (pB->i2Fbuf_stuff != pB->i2Fbuf_strip) in i2DeQueueNeeds()
423 queueIndex = pB->i2Fbuf_strip; in i2DeQueueNeeds()
424 pCh = pB->i2Fbuf[queueIndex]; in i2DeQueueNeeds()
429 pB->i2Fbuf_strip = queueIndex; in i2DeQueueNeeds()
432 WRITE_UNLOCK_IRQRESTORE(&pB->Fbuf_spinlock,flags); in i2DeQueueNeeds()
453 i2QueueNeeds(i2eBordStrPtr pB, i2ChanStrPtr pCh, int type) in i2QueueNeeds() argument
465 WRITE_LOCK_IRQSAVE(&pB->Dbuf_spinlock,flags); in i2QueueNeeds()
469 queueIndex = pB->i2Dbuf_stuff; in i2QueueNeeds()
470 pB->i2Dbuf[queueIndex++] = pCh; in i2QueueNeeds()
473 pB->i2Dbuf_stuff = queueIndex; in i2QueueNeeds()
475 WRITE_UNLOCK_IRQRESTORE(&pB->Dbuf_spinlock,flags); in i2QueueNeeds()
480 WRITE_LOCK_IRQSAVE(&pB->Bbuf_spinlock,flags); in i2QueueNeeds()
484 queueIndex = pB->i2Bbuf_stuff; in i2QueueNeeds()
485 pB->i2Bbuf[queueIndex++] = pCh; in i2QueueNeeds()
488 pB->i2Bbuf_stuff = queueIndex; in i2QueueNeeds()
490 WRITE_UNLOCK_IRQRESTORE(&pB->Bbuf_spinlock,flags); in i2QueueNeeds()
495 WRITE_LOCK_IRQSAVE(&pB->Fbuf_spinlock,flags); in i2QueueNeeds()
499 queueIndex = pB->i2Fbuf_stuff; in i2QueueNeeds()
500 pB->i2Fbuf[queueIndex++] = pCh; in i2QueueNeeds()
503 pB->i2Fbuf_stuff = queueIndex; in i2QueueNeeds()
505 WRITE_UNLOCK_IRQRESTORE(&pB->Fbuf_spinlock,flags); in i2QueueNeeds()
550 i2eBordStrPtr pB; in i2QueueCommands() local
571 pB = pCh->pMyBord; in i2QueueCommands()
574 if (pB->i2eValid != I2E_MAGIC || pB->i2eUsingIrq == IRQ_UNDEFINED) { in i2QueueCommands()
579 if (pB->i2eFatal) { in i2QueueCommands()
580 if ( pB->i2eFatalTrap ) { in i2QueueCommands()
581 (*(pB)->i2eFatalTrap)(pB); in i2QueueCommands()
662 serviceOutgoingFifo(pB); // Dump what we got in i2QueueCommands()
762 pB->debugInlineQueued++; in i2QueueCommands()
765 i2QueueNeeds(pB, pCh, NEED_INLINE); in i2QueueCommands()
772 pB->debugBypassQueued++; in i2QueueCommands()
775 i2QueueNeeds(pB, pCh, NEED_BYPASS); in i2QueueCommands()
801 i2eBordStrPtr pB; in i2GetStatus() local
809 pB = pCh->pMyBord; in i2GetStatus()
1026 i2eBordStrPtr pB; in i2Output() local
1044 pB = pCh->pMyBord; in i2Output()
1049 if (pB->i2eFatal) { in i2Output()
1050 if (pB->i2eFatalTrap) { in i2Output()
1051 (*(pB)->i2eFatalTrap)(pB); in i2Output()
1132 amountToMove, pB->i2eFifoRemains, in i2Output()
1133 pB->i2eWaitingForEmptyFifo ); in i2Output()
1137 i2QueueNeeds(pB, pCh, NEED_INLINE); in i2Output()
1139 if ( pB->i2eWaitingForEmptyFifo ) { in i2Output()
1165 else if ( pB->i2eFifoRemains < 32 && !pB->i2eTxMailEmpty ( pB ) ) in i2Output()
1168 pB->i2eFifoRemains, in i2Output()
1169 pB->i2eTxMailEmpty ); in i2Output()
1184 serviceOutgoingFifo(pB); in i2Output()
1188 pB->i2eFifoRemains, in i2Output()
1189 pB->i2eOutMailWaiting, in i2Output()
1190 pB->i2eWaitingForEmptyFifo ); in i2Output()
1197 i2QueueNeeds(pB, pCh, NEED_INLINE); in i2Output()
1205 serviceOutgoingFifo( pB ); in i2Output()
1301 i2eBordStrPtr pB; in i2DrainOutput() local
1305 pB = pCh->pMyBord; in i2DrainOutput()
1308 if (pB->i2eFatal) { in i2DrainOutput()
1309 if (pB->i2eFatalTrap) { in i2DrainOutput()
1310 (*(pB)->i2eFatalTrap)(pB); in i2DrainOutput()
1332 serviceOutgoingFifo( pB ); in i2DrainOutput()
1404 set_baud_params(i2eBordStrPtr pB) in set_baud_params() argument
1409 pCh = (i2ChanStrPtr *) pB->i2eChannelPtr; in set_baud_params()
1412 if (pB->channelBtypes.bid_value[i]) { in set_baud_params()
1413 if (BID_HAS_654(pB->channelBtypes.bid_value[i])) { in set_baud_params()
1473 i2StripFifo(i2eBordStrPtr pB) in i2StripFifo() argument
1487 while (HAS_INPUT(pB)) { in i2StripFifo()
1491 WRITE_LOCK_IRQSAVE(&pB->read_fifo_spinlock,bflags); in i2StripFifo()
1495 pB->i2eLeadoffWord[0] = iiReadWord(pB); in i2StripFifo()
1497 switch(PTYPE_OF(pB->i2eLeadoffWord)) in i2StripFifo()
1500 pB->got_input = 1; in i2StripFifo()
1504 channel = CHANNEL_OF(pB->i2eLeadoffWord); /* Store channel */ in i2StripFifo()
1505 count = iiReadWord(pB); /* Count is in the next word */ in i2StripFifo()
1512 pB->i2eFatal = 2; in i2StripFifo()
1513 WRITE_UNLOCK_IRQRESTORE(&pB->read_fifo_spinlock,bflags); in i2StripFifo()
1517 if ((channel >= pB->i2eChannelCnt) || in i2StripFifo()
1518 (NULL==(pCh = ((i2ChanStrPtr*)pB->i2eChannelPtr)[channel]))) in i2StripFifo()
1520 iiReadBuf(pB, junkBuffer, count); in i2StripFifo()
1521 WRITE_UNLOCK_IRQRESTORE(&pB->read_fifo_spinlock,bflags); in i2StripFifo()
1532 if(ID_OF(pB->i2eLeadoffWord) == ID_HOT_KEY) in i2StripFifo()
1534 pCh->hotKeyIn = iiReadWord(pB) & 0xff; in i2StripFifo()
1535 WRITE_UNLOCK_IRQRESTORE(&pB->read_fifo_spinlock,bflags); in i2StripFifo()
1553 iiReadBuf(pB, &(pCh->Ibuf[stuffIndex]), amountToRead); in i2StripFifo()
1578 iiReadBuf(pB, &(pCh->Ibuf[stuffIndex]), amountToRead); in i2StripFifo()
1586 WRITE_UNLOCK_IRQRESTORE(&pB->read_fifo_spinlock,bflags); in i2StripFifo()
1605 count = CMD_COUNT_OF(pB->i2eLeadoffWord); in i2StripFifo()
1607 iiReadBuf(pB, cmdBuffer, count); in i2StripFifo()
1609 WRITE_UNLOCK_IRQRESTORE(&pB->read_fifo_spinlock,bflags); in i2StripFifo()
1620 if (channel < pB->i2eChannelCnt in i2StripFifo()
1622 (pCh = (((i2ChanStrPtr*)pB->i2eChannelPtr)[channel])) != NULL in i2StripFifo()
1751 i2QueueNeeds(pB, pCh, NEED_INLINE); in i2StripFifo()
1783 pB->channelBtypes = *((bidStatPtr)pc); in i2StripFifo()
1785 set_baud_params(pB); in i2StripFifo()
1854 PTYPE_OF(pB->i2eLeadoffWord) ); in i2StripFifo()
1863 pB->i2eOutMailWaiting |= MB_IN_STRIPPED; in i2StripFifo()
1877 i2Write2Fifo(i2eBordStrPtr pB, unsigned char *source, int count,int reserve) in i2Write2Fifo() argument
1881 WRITE_LOCK_IRQSAVE(&pB->write_fifo_spinlock,flags); in i2Write2Fifo()
1882 if (!pB->i2eWaitingForEmptyFifo) { in i2Write2Fifo()
1883 if (pB->i2eFifoRemains > (count+reserve)) { in i2Write2Fifo()
1884 pB->i2eFifoRemains -= count; in i2Write2Fifo()
1885 iiWriteBuf(pB, source, count); in i2Write2Fifo()
1886 pB->i2eOutMailWaiting |= MB_OUT_STUFFED; in i2Write2Fifo()
1890 WRITE_UNLOCK_IRQRESTORE(&pB->write_fifo_spinlock,flags); in i2Write2Fifo()
1904 i2StuffFifoBypass(i2eBordStrPtr pB) in i2StuffFifoBypass() argument
1919 (NULL != (pCh = i2DeQueueNeeds(pB,NEED_BYPASS)))) in i2StuffFifoBypass()
1932 if ( 0 == i2Write2Fifo(pB, pRemove, paddedSize,0)) { in i2StuffFifoBypass()
1934 i2QueueNeeds(pB, pCh, NEED_BYPASS); // Put back on queue in i2StuffFifoBypass()
1941 pB->debugBypassCount++; in i2StuffFifoBypass()
1974 i2StuffFifoFlow(i2eBordStrPtr pB) in i2StuffFifoFlow() argument
1980 pB->i2eFifoRemains, paddedSize ); in i2StuffFifoFlow()
1984 while ( (NULL != (pCh = i2DeQueueNeeds(pB,NEED_FLOW)))) { in i2StuffFifoFlow()
1985 pB->debugFlowCount++; in i2StuffFifoFlow()
1988 if ( 0 == i2Write2Fifo(pB,(unsigned char *)&(pCh->infl),paddedSize,0)) { in i2StuffFifoFlow()
2011 i2StuffFifoInline(i2eBordStrPtr pB) in i2StuffFifoInline() argument
2025 ip2trace (ITRC_NO_PORT, ITRC_SICMD, ITRC_ENTER, 3, pB->i2eFifoRemains, in i2StuffFifoInline()
2026 pB->i2Dbuf_strip, pB->i2Dbuf_stuff ); in i2StuffFifoInline()
2031 (NULL != (pCh = i2DeQueueNeeds(pB,NEED_INLINE))) ) in i2StuffFifoInline()
2056 ip2trace (CHANN, ITRC_SICMD, 4, 2, pB->i2eFifoRemains, paddedSize ); in i2StuffFifoInline()
2067 i2QueueNeeds(pB, pCh, NEED_CREDIT); in i2StuffFifoInline()
2072 && ( 0 == i2Write2Fifo(pB, pRemove, paddedSize, 128))) { in i2StuffFifoInline()
2075 i2QueueNeeds(pB, pCh, NEED_INLINE); in i2StuffFifoInline()
2081 pB->debugInlineCount++; in i2StuffFifoInline()
2125 ip2trace (ITRC_NO_PORT, ITRC_SICMD, ITRC_RETURN, 1,pB->i2Dbuf_strip); in i2StuffFifoInline()
2142 serviceOutgoingFifo(i2eBordStrPtr pB) in serviceOutgoingFifo() argument
2147 if ( ! pB->i2eWaitingForEmptyFifo ) in serviceOutgoingFifo()
2149 i2StuffFifoFlow(pB); in serviceOutgoingFifo()
2150 i2StuffFifoBypass(pB); in serviceOutgoingFifo()
2151 i2StuffFifoInline(pB); in serviceOutgoingFifo()
2153 iiSendPendingMail(pB); in serviceOutgoingFifo()
2183 i2ServiceBoard ( i2eBordStrPtr pB ) in i2ServiceBoard() argument
2190 if (NO_MAIL_HERE == ( inmail = pB->i2eStartMail ) ) { in i2ServiceBoard()
2191 inmail = iiGetMail(pB); in i2ServiceBoard()
2193 pB->i2eStartMail = NO_MAIL_HERE; in i2ServiceBoard()
2201 pB->i2eFatal = 1; in i2ServiceBoard()
2207 pB->i2eFifoInInts++; in i2ServiceBoard()
2208 i2StripFifo(pB); /* There might be incoming packets */ in i2ServiceBoard()
2212 pB->i2eFifoOutInts++; in i2ServiceBoard()
2213 WRITE_LOCK_IRQSAVE(&pB->write_fifo_spinlock,flags); in i2ServiceBoard()
2214 pB->i2eFifoRemains = pB->i2eFifoSize; in i2ServiceBoard()
2215 pB->i2eWaitingForEmptyFifo = 0; in i2ServiceBoard()
2216 WRITE_UNLOCK_IRQRESTORE(&pB->write_fifo_spinlock,flags); in i2ServiceBoard()
2218 ip2trace (ITRC_NO_PORT, ITRC_INTR, 30, 1, pB->i2eFifoRemains ); in i2ServiceBoard()
2221 serviceOutgoingFifo(pB); in i2ServiceBoard()