[svn-commits] fjoe: freebsd/trunk r10600 - in /freebsd/trunk: bsd-kmod/dahdi/ bsd-kmod/dahd...
SVN commits to the Digium repositories
svn-commits at lists.digium.com
Mon Mar 26 22:53:25 CDT 2012
Author: fjoe
Date: Mon Mar 26 22:53:20 2012
New Revision: 10600
URL: http://svnview.digium.com/svn/dahdi?view=rev&rev=10600
Log:
- linux/spinlock_types.h, linux/jiffies.h: Add missing includes
- linux/crc32.h: define crc32() (also use it in wct4xxp and wctdm24xxp)
- linux/workqueue.h: implement flush_workqueue() (obtained from OFED)
- dahdi_voicebus: compile-in vpmoct.c
- wcte12xp: #ifdef-in ocassionally ifdef'ed out flush_workqueue() code in detach
- wctdm24xxp: use flush_workqueue() thus reducing diffs to dahdi-linux
Modified:
freebsd/trunk/bsd-kmod/dahdi/bsd-compat.c
freebsd/trunk/bsd-kmod/dahdi_voicebus/Makefile
freebsd/trunk/drivers/dahdi/voicebus/vpmoct.c
freebsd/trunk/drivers/dahdi/wct4xxp/base.c
freebsd/trunk/drivers/dahdi/wctdm24xxp/base.c
freebsd/trunk/drivers/dahdi/wctdm24xxp/xhfc.c
freebsd/trunk/drivers/dahdi/wcte12xp/base.c
freebsd/trunk/include/linux/crc32.h
freebsd/trunk/include/linux/jiffies.h
freebsd/trunk/include/linux/spinlock_types.h
Modified: freebsd/trunk/bsd-kmod/dahdi/bsd-compat.c
URL: http://svnview.digium.com/svn/dahdi/freebsd/trunk/bsd-kmod/dahdi/bsd-compat.c?view=diff&rev=10600&r1=10599&r2=10600
==============================================================================
--- freebsd/trunk/bsd-kmod/dahdi/bsd-compat.c (original)
+++ freebsd/trunk/bsd-kmod/dahdi/bsd-compat.c Mon Mar 26 22:53:20 2012
@@ -356,6 +356,24 @@
{
taskqueue_free(wq->tq);
free(wq, M_DAHDI);
+}
+
+static void
+_flush_workqueue_fn(void *context, int pending)
+{
+ /* nothing to do */
+}
+
+void
+flush_workqueue(struct workqueue_struct *wq)
+{
+ struct task flushtask;
+
+ PHOLD(curproc);
+ TASK_INIT(&flushtask, 0, _flush_workqueue_fn, NULL);
+ taskqueue_enqueue(wq->tq, &flushtask);
+ taskqueue_drain(wq->tq, &flushtask);
+ PRELE(curproc);
}
void
Modified: freebsd/trunk/bsd-kmod/dahdi_voicebus/Makefile
URL: http://svnview.digium.com/svn/dahdi/freebsd/trunk/bsd-kmod/dahdi_voicebus/Makefile?view=diff&rev=10600&r1=10599&r2=10600
==============================================================================
--- freebsd/trunk/bsd-kmod/dahdi_voicebus/Makefile (original)
+++ freebsd/trunk/bsd-kmod/dahdi_voicebus/Makefile Mon Mar 26 22:53:20 2012
@@ -3,7 +3,7 @@
.PATH: ${.CURDIR}/../../drivers/dahdi/voicebus
KMOD= dahdi_voicebus
-SRCS= voicebus.c voicebus_net.c GpakCust.c GpakApi.c
+SRCS= voicebus.c voicebus_net.c vpmoct.c GpakCust.c GpakApi.c
SRCS+= device_if.h bus_if.h pci_if.h
CFLAGS= -I${.CURDIR}/../../drivers/dahdi
Modified: freebsd/trunk/drivers/dahdi/voicebus/vpmoct.c
URL: http://svnview.digium.com/svn/dahdi/freebsd/trunk/drivers/dahdi/voicebus/vpmoct.c?view=diff&rev=10600&r1=10599&r2=10600
==============================================================================
--- freebsd/trunk/drivers/dahdi/voicebus/vpmoct.c (original)
+++ freebsd/trunk/drivers/dahdi/voicebus/vpmoct.c Mon Mar 26 22:53:20 2012
@@ -218,7 +218,7 @@
/* Send the encrypted firmware header */
for (i = 0; i < VPMOCT_FIRM_HEADER_LEN; i++) {
vpmoct_write_byte(vpm, VPMOCT_BOOT_RAM+i,
- fw->data[i + sizeof(struct vpmoct_header)]);
+ ((const char *)fw->data)[i + sizeof(struct vpmoct_header)]);
}
/* Decrypt header */
vpmoct_write_byte(vpm, VPMOCT_BOOT_CMD, VPMOCT_BOOT_DECRYPT);
@@ -234,12 +234,18 @@
unsigned int i, ram_index, flash_index, flash_address;
const u8 *buf;
u8 chunksize;
+ size_t fw_size;
/* Load the body of the firmware */
ram_index = 0;
flash_index = 0;
flash_address = 0;
- for (i = VPMOCT_FIRM_HEADER_LEN*2; i < fw->size;) {
+#if defined(__FreeBSD__)
+ fw_size = fw->datasize;
+#else
+ fw_size = fw->size;
+#endif
+ for (i = VPMOCT_FIRM_HEADER_LEN*2; i < fw->datasize;) {
if (ram_index >= VPMOCT_BOOT_RAM_LEN) {
/* Tell bootloader to load ram buffer into buffer */
vpmoct_write_byte(vpm, VPMOCT_BOOT_CMD,
@@ -268,7 +274,7 @@
if (chunksize > VPMOCT_MAX_CHUNK)
chunksize = VPMOCT_MAX_CHUNK;
- buf = &fw->data[i];
+ buf = (const char *) fw->data + i;
vpmoct_write_chunk(vpm, VPMOCT_BOOT_RAM+ram_index,
buf, chunksize);
ram_index += chunksize;
@@ -434,7 +440,13 @@
{
const struct vpmoct_header *header =
(const struct vpmoct_header *)fw->data;
- u32 crc = crc32(~0, &fw->data[10], fw->size - 10) ^ ~0;
+ size_t fw_size;
+#if defined(__FreeBSD__)
+ fw_size = fw->datasize;
+#else
+ fw_size = fw->size;
+#endif
+ u32 crc = crc32(~0, (const char *) fw->data + 10, fw_size - 10) ^ ~0;
return (!memcmp("DIGIUM", header->header, sizeof(header->header)) &&
(le32_to_cpu(header->chksum) == crc));
}
@@ -463,6 +475,7 @@
int res;
struct vpmoct *const vpm = work->vpm;
const struct firmware *fw;
+ size_t fw_size;
const struct vpmoct_header *header;
char serial[VPMOCT_SERIAL_SIZE+1];
const char *const FIRMWARE_NAME = "dahdi-fw-vpmoct032.bin";
@@ -547,7 +560,12 @@
goto error;
if (vpmoct_send_firmware_body(vpm, fw))
goto error;
- if (vpmoct_check_firmware_crc(vpm, fw->size-VPMOCT_FIRM_HEADER_LEN*2,
+#if defined(__FreeBSD__)
+ fw_size = fw->datasize;
+#else
+ fw_size = fw->size;
+#endif
+ if (vpmoct_check_firmware_crc(vpm, fw_size-VPMOCT_FIRM_HEADER_LEN*2,
header->major, header->minor))
goto error;
release_firmware(fw);
@@ -583,7 +601,7 @@
{
unsigned long flags;
struct vpmoct_cmd *cmd;
- LIST_HEAD(list);
+ _LIST_HEAD(list);
if (!vpm)
return;
Modified: freebsd/trunk/drivers/dahdi/wct4xxp/base.c
URL: http://svnview.digium.com/svn/dahdi/freebsd/trunk/drivers/dahdi/wct4xxp/base.c?view=diff&rev=10600&r1=10599&r2=10600
==============================================================================
--- freebsd/trunk/drivers/dahdi/wct4xxp/base.c (original)
+++ freebsd/trunk/drivers/dahdi/wct4xxp/base.c Mon Mar 26 22:53:20 2012
@@ -38,13 +38,13 @@
#include <linux/version.h>
#include <linux/delay.h>
#include <linux/moduleparam.h>
+#include <linux/crc32.h>
#if defined(__FreeBSD__)
#define cond_resched()
#define pci_save_state(dev) (0)
#define pci_restore_state(dev)
#else
#include <asm/io.h>
-#include <linux/crc32.h>
#endif
#include <stdbool.h>
@@ -4906,6 +4906,7 @@
static int t8_check_firmware(struct t4 *wc, unsigned int version)
{
const struct firmware *fw;
+ size_t fw_size;
static const char t8_firmware[] = "dahdi-fw-te820.bin";
const struct t8_firm_header *header;
int res = 0;
@@ -4922,10 +4923,11 @@
/* Check the crc before anything else */
#if defined(__FreeBSD__)
- crc = crc32((char *) fw->data + 10, fw->datasize);
+ fw_size = fw->datasize;
#else
- crc = crc32(~0, &fw->data[10], fw->size - 10) ^ ~0;
-#endif
+ fw_size = fw->size;
+#endif
+ crc = crc32(~0, (char *) fw->data + 10, fw_size - 10) ^ ~0;
if (memcmp("DIGIUM", header->header, sizeof(header->header)) ||
(le32_to_cpu(header->chksum) != crc)) {
dev_info(&wc->dev->dev,
Modified: freebsd/trunk/drivers/dahdi/wctdm24xxp/base.c
URL: http://svnview.digium.com/svn/dahdi/freebsd/trunk/drivers/dahdi/wctdm24xxp/base.c?view=diff&rev=10600&r1=10599&r2=10600
==============================================================================
--- freebsd/trunk/drivers/dahdi/wctdm24xxp/base.c (original)
+++ freebsd/trunk/drivers/dahdi/wctdm24xxp/base.c Mon Mar 26 22:53:20 2012
@@ -54,12 +54,11 @@
#else
#include <asm/semaphore.h>
#endif
+#include <linux/crc32.h>
#if defined(__FreeBSD__)
#define flush_scheduled_work()
#define fatal_signal_pending(x) 0
#else /* !__FreeBSD__ */
-#include <linux/crc32.h>
-
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 30)
/* Define this if you would like to load the modules in parallel. While this
* can speed up loads when multiple cards handled by this driver are installed,
@@ -5429,11 +5428,7 @@
if ((fw_size != sizeof(*ha8_fw)) ||
(0 != memcmp("DIGIUM", ha8_fw->header, sizeof(ha8_fw->header))) ||
-#if defined(__FreeBSD__)
- (crc32(ha8_fw, sizeof(*ha8_fw) - sizeof(u32)) !=
-#else
- ((crc32(~0, (void *)ha8_fw, sizeof(*ha8_fw) - sizeof(u32)) ^ ~0) !=
-#endif
+ ((crc32(~0, (const void *)ha8_fw, sizeof(*ha8_fw) - sizeof(u32)) ^ ~0) !=
le32_to_cpu(ha8_fw->chksum))) {
dev_warn(dev, "Firmware file is invalid. Skipping load.\n");
ret = 0;
Modified: freebsd/trunk/drivers/dahdi/wctdm24xxp/xhfc.c
URL: http://svnview.digium.com/svn/dahdi/freebsd/trunk/drivers/dahdi/wctdm24xxp/xhfc.c?view=diff&rev=10600&r1=10599&r2=10600
==============================================================================
--- freebsd/trunk/drivers/dahdi/wctdm24xxp/xhfc.c (original)
+++ freebsd/trunk/drivers/dahdi/wctdm24xxp/xhfc.c Mon Mar 26 22:53:20 2012
@@ -2126,11 +2126,7 @@
down(&wc->syncsem);
b4s[i]->shutdown = 1;
up(&wc->syncsem);
-#if defined(__FreeBSD__)
- flush_work(&b4s[i]->xhfc_wq);
-#else
flush_workqueue(b4s[i]->xhfc_ws);
-#endif
}
}
}
Modified: freebsd/trunk/drivers/dahdi/wcte12xp/base.c
URL: http://svnview.digium.com/svn/dahdi/freebsd/trunk/drivers/dahdi/wcte12xp/base.c?view=diff&rev=10600&r1=10599&r2=10600
==============================================================================
--- freebsd/trunk/drivers/dahdi/wcte12xp/base.c (original)
+++ freebsd/trunk/drivers/dahdi/wcte12xp/base.c Mon Mar 26 22:53:20 2012
@@ -2907,7 +2907,6 @@
smp_mb__after_clear_bit();
del_timer_sync(&wc->timer);
-#if !defined(__FreeBSD__)
flush_workqueue(wc->wq);
#ifdef VPM_SUPPORT
if (vpmadt) {
@@ -2917,7 +2916,6 @@
while (t1_wait_for_ready(wc))
schedule();
}
-#endif
#endif
voicebus_release(&wc->vb);
Modified: freebsd/trunk/include/linux/crc32.h
URL: http://svnview.digium.com/svn/dahdi/freebsd/trunk/include/linux/crc32.h?view=diff&rev=10600&r1=10599&r2=10600
==============================================================================
--- freebsd/trunk/include/linux/crc32.h (original)
+++ freebsd/trunk/include/linux/crc32.h Mon Mar 26 22:53:20 2012
@@ -4,5 +4,6 @@
#include <sys/libkern.h>
#define crc32_le(crc, data, len) crc32_raw(data, len, crc)
+#define crc32(crc, data, len) crc32_le(crc, data, len)
#endif /* _LINUX_CRC32_H_ */
Modified: freebsd/trunk/include/linux/jiffies.h
URL: http://svnview.digium.com/svn/dahdi/freebsd/trunk/include/linux/jiffies.h?view=diff&rev=10600&r1=10599&r2=10600
==============================================================================
--- freebsd/trunk/include/linux/jiffies.h (original)
+++ freebsd/trunk/include/linux/jiffies.h Mon Mar 26 22:53:20 2012
@@ -2,6 +2,7 @@
#define _LINUX_JIFFIES_H_
#include <sys/limits.h>
+#include <sys/time.h>
#if 1
/* emulate jiffies */
Modified: freebsd/trunk/include/linux/spinlock_types.h
URL: http://svnview.digium.com/svn/dahdi/freebsd/trunk/include/linux/spinlock_types.h?view=diff&rev=10600&r1=10599&r2=10600
==============================================================================
--- freebsd/trunk/include/linux/spinlock_types.h (original)
+++ freebsd/trunk/include/linux/spinlock_types.h Mon Mar 26 22:53:20 2012
@@ -1,6 +1,7 @@
#ifndef _LINUX_SPINLOCK_TYPES_H_
#define _LINUX_SPINLOCK_TYPES_H_
+#include <sys/param.h>
#include <sys/lock.h>
#include <sys/mutex.h>
#include <linux/rwlock_types.h>
More information about the svn-commits
mailing list