[zaptel-commits] sruffell: branch sruffell/zaptel-1.4-transcoder r4242 - /team/sruffell/zaptel...
SVN commits to the Zaptel project
zaptel-commits at lists.digium.com
Thu May 8 00:47:32 CDT 2008
Author: sruffell
Date: Thu May 8 00:47:30 2008
New Revision: 4242
URL: http://svn.digium.com/view/zaptel?view=rev&rev=4242
Log:
Some fixes for 64-bit systems.
Modified:
team/sruffell/zaptel-1.4-transcoder/kernel/wctc4xxp/base.c
Modified: team/sruffell/zaptel-1.4-transcoder/kernel/wctc4xxp/base.c
URL: http://svn.digium.com/view/zaptel/team/sruffell/zaptel-1.4-transcoder/kernel/wctc4xxp/base.c?view=diff&rev=4242&r1=4241&r2=4242
==============================================================================
--- team/sruffell/zaptel-1.4-transcoder/kernel/wctc4xxp/base.c (original)
+++ team/sruffell/zaptel-1.4-transcoder/kernel/wctc4xxp/base.c Thu May 8 00:47:30 2008
@@ -452,6 +452,7 @@
spin_lock_irqsave(&dr->lock, flags);
d = dte_descriptor(dr, tail);
+ WARN_ON(!d);
if (d->buffer1) {
spin_unlock_irqrestore(&dr->lock, flags);
/* Do not overwrite a buffer that is still in progress. */
@@ -459,7 +460,7 @@
}
d->des1 &= cpu_to_le32(~(BUFFER1_SIZE_MASK));
d->des1 |= cpu_to_le32(len & BUFFER1_SIZE_MASK);
- d->buffer1 = dma_map_single(&dr->pdev->dev, c->cmd,
+ d->buffer1 = pci_map_single(dr->pdev, &c->cmd[0],
SFRAME_SIZE, dr->direction);
SET_OWNED(d); /* That's it until the hardware is done with it. */
@@ -483,7 +484,7 @@
spin_lock_irqsave(&dr->lock, flags);
d = dte_descriptor(dr, head);
if (d->buffer1 && !OWNED(d)) {
- dma_unmap_single(&dr->pdev->dev, d->buffer1,
+ pci_unmap_single(dr->pdev, d->buffer1,
SFRAME_SIZE, dr->direction);
c = dr->pending[head];
WARN_ON(!c);
@@ -1000,10 +1001,10 @@
}
WARN_ON(compl_ztc->chan_built); /* It shouldn't already have been built... */
compl_ztc->chan_built = 1;
- DTE_DEBUG(wc, DTE_DEBUG_CHANNEL_SETUP, "Marking (%08x)->chan_built = %d\n", (u32)compl_ztc, compl_ztc->chan_built);
+ DTE_DEBUG(wc, DTE_DEBUG_CHANNEL_SETUP, "Marking (%p)->chan_built = %d\n", compl_ztc, compl_ztc->chan_built);
compl_ztc->built_fmts = ztc->dstfmt | ztc->srcfmt;
compl_cpvt = compl_ztc->pvt;
- DTE_DEBUG(wc, DTE_DEBUG_CHANNEL_SETUP, "ztc: %08x is the complement to %08x\n", (u32)compl_ztc, (u32)ztc);
+ DTE_DEBUG(wc, DTE_DEBUG_CHANNEL_SETUP, "ztc: %p is the complement to %p\n", compl_ztc, ztc);
compl_cpvt->chan_in_num = cpvt->chan_out_num;
compl_cpvt->chan_out_num = cpvt->chan_in_num;
wcdte_cleanup_channel_private(wc, compl_cpvt);
@@ -1026,17 +1027,17 @@
BUG_ON(!wc);
- DTE_DEBUG(wc, DTE_DEBUG_CHANNEL_SETUP, "Entering %s for channel %08x.\n", __FUNCTION__, (u32)ztc);
+ DTE_DEBUG(wc, DTE_DEBUG_CHANNEL_SETUP, "Entering %s for channel %p.\n", __FUNCTION__, ztc);
if (down_interruptible(&wc->chansem)) {
HERE();
return -EINTR;
}
/* If the channel is already built then we're done. */
- DTE_DEBUG(wc, DTE_DEBUG_CHANNEL_SETUP, "(%08x)->chan_built = %d\n", (u32)ztc, ztc->chan_built);
+ DTE_DEBUG(wc, DTE_DEBUG_CHANNEL_SETUP, "(%p)->chan_built = %d\n", ztc, ztc->chan_built);
if (ztc->chan_built) {
up(&wc->chansem);
- DTE_DEBUG(wc, DTE_DEBUG_CHANNEL_SETUP, "Allocating channel %08x which is already built.\n", (u32)ztc);
+ DTE_DEBUG(wc, DTE_DEBUG_CHANNEL_SETUP, "Allocating channel %p which is already built.\n", ztc);
LEAVING();
return 0;
}
@@ -1044,7 +1045,7 @@
/* Anything on the rx queue now is old news... */
wcdte_cleanup_channel_private(wc, cpvt);
- DTE_DEBUG(wc, DTE_DEBUG_CHANNEL_SETUP, "Allocating a new channel: %08x.\n", (u32)ztc);
+ DTE_DEBUG(wc, DTE_DEBUG_CHANNEL_SETUP, "Allocating a new channel: %p.\n", ztc);
dte_srcfmt = wcdte_zapfmt_to_dtefmt(ztc->srcfmt);
dte_dstfmt = wcdte_zapfmt_to_dtefmt(ztc->dstfmt);
@@ -1120,17 +1121,17 @@
return res;
}
- DTE_DEBUG(wc, DTE_DEBUG_CHANNEL_SETUP, "Releasing channel: %08x\n", (u32)ztc);
+ DTE_DEBUG(wc, DTE_DEBUG_CHANNEL_SETUP, "Releasing channel: %p\n", ztc);
/* Mark this channel as not built */
ztc->chan_built = 0;
- DTE_DEBUG(wc, DTE_DEBUG_CHANNEL_SETUP, "(%08x)->chan_built = %d\n", (u32)ztc, ztc->chan_built);
+ DTE_DEBUG(wc, DTE_DEBUG_CHANNEL_SETUP, "(%p)->chan_built = %d\n", ztc, ztc->chan_built);
ztc->built_fmts = 0;
cpvt->chan_in_num = INVALID;
cpvt->chan_out_num = INVALID;
/* Mark the channel complement as not built */
compl_ztc->chan_built = 0;
- DTE_DEBUG(wc, DTE_DEBUG_CHANNEL_SETUP, "(%08x)->chan_built = %d\n", (u32)compl_ztc, compl_ztc->chan_built);
+ DTE_DEBUG(wc, DTE_DEBUG_CHANNEL_SETUP, "(%p)->chan_built = %d\n", compl_ztc, compl_ztc->chan_built);
compl_ztc->built_fmts = 0;
compl_cpvt = compl_ztc->pvt;
compl_cpvt->chan_in_num = INVALID;
@@ -1274,7 +1275,7 @@
if (unlikely(count > SFRAME_SIZE - CMD_MSG_IP_UDP_RTP_LEN)) {
DTE_DEBUG(wc, DTE_DEBUG_GENERAL,
- "Cannot transcode packet of %d bytes. This exceeds the " \
+ "Cannot transcode packet of %Zu bytes. This exceeds the " \
"maximum size of %d bytes.\n", count,
SFRAME_SIZE - CMD_MSG_IP_UDP_RTP_LEN);
return -EINVAL;
@@ -1284,7 +1285,7 @@
if (G723_LENGTH != count) {
DTE_DEBUG(wc, DTE_DEBUG_GENERAL,
"Trying to transcode packet into G723 format " \
- "that is %d bytes instead of the expected " \
+ "that is %Zu bytes instead of the expected " \
"%d bytes.\n", count, G723_LENGTH);
return -EINVAL;
}
@@ -1313,7 +1314,7 @@
cmd->cmdlen = CMD_MSG_IP_UDP_RTP_LEN + count;
DTE_DEBUG(wc, DTE_DEBUG_RTP_TX,
- "Sending packet of %d byte on channel (%08x).\n", count, (u32)ztc);
+ "Sending packet of %Zu byte on channel (%p).\n", count, ztc);
dte_transmit_cmd(wc, cmd);
atomic_inc(&cpvt->stats.packets_sent);
LEAVING();
@@ -1445,8 +1446,8 @@
/* Just for debugging purposes. */
rlen = (cmd->cmd[39] | (cmd->cmd[38] << 8)) - 20;
- DTE_DEBUG(wc, DTE_DEBUG_RTP_RX, "Adding RTP packet of length %d to channel: %08x\n",
- rlen, (u32)ztc);
+ DTE_DEBUG(wc, DTE_DEBUG_RTP_RX, "Adding RTP packet of length %d to channel: %p\n",
+ rlen, ztc);
spin_lock_irqsave(&cpvt->lock, flags);
list_add_tail(&cmd->node, &cpvt->rx_queue);
spin_unlock_irqrestore(&cpvt->lock, flags);
@@ -2555,10 +2556,18 @@
/* Keep track of whether we need to free the region */
if (!request_region(wc->iobase, 0xff, wc->board_name)) {
/* \todo put in error message. */
+ DTE_PRINTK(wc, WARNING,
+ "Failed to reserve the I/O ports for this device.\n");
return -EIO;
}
init_waitqueue_head(&wc->regq);
+
+ if (pci_set_dma_mask(wc->pdev, DMA_32BIT_MASK)) {
+ release_region(wc->iobase, 0xff);
+ DTE_PRINTK(wc, WARNING, "No suitable DMA available.\n");
+ return -EIO;
+ }
if ((res = dte_initialize_descriptor_ring(wc->pdev, &wc->txd,
0xe0800000,
More information about the zaptel-commits
mailing list