aboutsummaryrefslogtreecommitdiff
path: root/misc
diff options
context:
space:
mode:
authorMuhammad Moinur Rahman <bofh@FreeBSD.org>2023-03-20 23:24:49 +0000
committerMuhammad Moinur Rahman <bofh@FreeBSD.org>2023-03-21 00:01:38 +0000
commitec6f10e0cc6c6befdb0489f0b301ec68c1af7faf (patch)
tree06f3edbed9ee635e0369c6c04fdeb8e275fdb3bf /misc
parentc06842b264e47e5e5ab6fb0c2bfef95440aaa26c (diff)
downloadports-ec6f10e0cc6c6befdb0489f0b301ec68c1af7faf.tar.gz
ports-ec6f10e0cc6c6befdb0489f0b301ec68c1af7faf.zip
misc/dahdi-kmod: Remove expired port:
2023-03-21 misc/dahdi-kmod: Broken since 2021
Diffstat (limited to 'misc')
-rw-r--r--misc/Makefile1
-rw-r--r--misc/dahdi-kmod/Makefile79
-rw-r--r--misc/dahdi-kmod/distinfo16
-rw-r--r--misc/dahdi-kmod/files/dahdi.in79
-rw-r--r--misc/dahdi-kmod/files/patch-bchan170
-rw-r--r--misc/dahdi-kmod/files/patch-clang18
-rw-r--r--misc/dahdi-kmod/files/patch-dahdi-iface939
-rw-r--r--misc/dahdi-kmod/files/patch-flush_workqueue91
-rw-r--r--misc/dahdi-kmod/files/patch-freebsd-drivers-dahdi-dahdi-base.c45
-rw-r--r--misc/dahdi-kmod/files/patch-freebsd-drivers-dahdi-dahdi_dynamic_ethmf.c11
-rw-r--r--misc/dahdi-kmod/files/patch-freebsd-drivers-dahdi-wctc4xxp-base.c55
-rw-r--r--misc/dahdi-kmod/files/patch-freebsd-drivers-dahdi-wcte12xp-base.c14
-rw-r--r--misc/dahdi-kmod/files/patch-freebsd-freebsd-dahdi-Makefile14
-rw-r--r--misc/dahdi-kmod/files/patch-freebsd-freebsd-dahdi-bsd-compat.c14
-rw-r--r--misc/dahdi-kmod/files/patch-freebsd-freebsd-dahdi-ng_dahdi_iface.c17
-rw-r--r--misc/dahdi-kmod/files/patch-freebsd-include-dahdi-compat-bsd.h34
-rw-r--r--misc/dahdi-kmod/files/patch-freebsd-include-stdbool.h20
-rw-r--r--misc/dahdi-kmod/files/patch-freebsd__freebsd__Makefile.inc8
-rw-r--r--misc/dahdi-kmod/files/patch-include_dahdi_compat_bsd.h11
-rw-r--r--misc/dahdi-kmod/files/patch-ithread26
-rw-r--r--misc/dahdi-kmod/files/patch-mbuf49
-rw-r--r--misc/dahdi-kmod/files/patch-oslec29
-rw-r--r--misc/dahdi-kmod/files/patch-zaphfc883
-rw-r--r--misc/dahdi-kmod/pkg-descr3
-rw-r--r--misc/dahdi-kmod/pkg-plist28
25 files changed, 0 insertions, 2654 deletions
diff --git a/misc/Makefile b/misc/Makefile
index 21d1f1cc12cd..27a2f973e5b8 100644
--- a/misc/Makefile
+++ b/misc/Makefile
@@ -71,7 +71,6 @@
SUBDIR += ctm
SUBDIR += cuttlefish
SUBDIR += dahdi
- SUBDIR += dahdi-kmod
SUBDIR += dahdi-kmod26
SUBDIR += darknet
SUBDIR += dartsim
diff --git a/misc/dahdi-kmod/Makefile b/misc/dahdi-kmod/Makefile
deleted file mode 100644
index 4066f8ba3bdd..000000000000
--- a/misc/dahdi-kmod/Makefile
+++ /dev/null
@@ -1,79 +0,0 @@
-PORTNAME= dahdi-kmod
-PORTVERSION= ${DAHDI_VERSION:S/-//g}
-PORTREVISION= 7
-CATEGORIES= misc
-MASTER_SITES= LOCAL/fjoe \
- http://downloads.digium.com/pub/telephony/firmware/releases/:firmware
-DISTNAME= dahdi-freebsd-complete-${DAHDI_VERSION}+${DAHDI_TOOLS_VERSION}
-DISTFILES= ${DISTNAME}${EXTRACT_SUFX}\
- oslec-linux-${OSLEC_VERSION}${EXTRACT_SUFX}\
- zaphfc-${ZAPHFC_VERSION}${EXTRACT_SUFX}
-
-MAINTAINER= dgilbert@eicat.ca
-COMMENT= Digium/Asterisk Hardware Device Interface
-WWW= https://svn.digium.com/svn/dahdi/freebsd/
-
-BROKEN= does not compile: use of undeclared identifier 'SX_NOADAPTIVE'
-DEPRECATED= Broken since 2021
-EXPIRATION_DATE= 2023-03-21
-
-RUN_DEPENDS= ${LOCALBASE}/sbin/dahdi_cfg:misc/dahdi
-
-ONLY_FOR_ARCHS= amd64 i386 powerpc64 sparc64
-
-DAHDI_VERSION= 2.4.0-rc5
-DAHDI_TOOLS_VERSION= 2.4.0-rc1
-OSLEC_VERSION= 2.6.35.4
-ZAPHFC_VERSION= r5
-
-FIRMWARES= OCT6114_064 OCT6114_128 TC400M HX8 ${_vpmadt032}
-OCT6114_064_VERSION= 1.05.01
-OCT6114_128_VERSION= 1.05.01
-TC400M_VERSION= MR6.12
-HX8_VERSION= 2.06
-VPMADT032_NAME= dahdi-fwload-vpmadt032
-VPMADT032_DIR= dahdi_vpmadt032_loader
-VPMADT032_VERSION= 1.25.0
-
-WRKSRC= ${WRKDIR}/${DISTNAME}/freebsd
-EXTRA_PATCHES= ${WRKDIR}/zaphfc-${ZAPHFC_VERSION}
-PATCH_STRIP= -p1
-MAKEFILE= BSDmakefile
-USE_RC_SUBR= dahdi
-MAKE_ARGS= ADDITIONAL_DRIVERS="wcb1xxp" NO_FETCH=yes DEPEND_MP= WERROR=
-GROUPS= dahdi
-
-CONFLICTS= zaptel dahdi-kmod26
-
-USES= kmod uidfix
-
-KMODDIR= ${PREFIX}/lib/dahdi
-
-.include <bsd.port.pre.mk>
-
-.if ${ARCH} == "amd64" || ${ARCH} == "i386"
-PLIST_SUB+= X86=""
-_vpmadt032= VPMADT032
-.else
-PLIST_SUB+= X86="@comment "
-.endif
-
-.for _f in ${FIRMWARES}
-${_f}_NAME?= dahdi-fw-${_f:tl:S/_/-/g}
-${_f}_DIR?= ${${_f}_NAME}.bin
-${_f}_DISTFILE= ${${_f}_NAME}-${${_f}_VERSION}.tar.gz
-DISTFILES+= ${${_f}_DISTFILE}:firmware
-.endfor
-
-post-extract:
- @${LN} -s ../../../linux-${OSLEC_VERSION}/drivers/staging ${WRKSRC}/drivers
-.for _f in ${FIRMWARES}
- ${CP} ${DISTDIR}/${${_f}_DISTFILE} ${WRKSRC}/freebsd/${${_f}_DIR}
-.endfor
-
-fw-versions: extract
-.for _v in ${FIRMWARES:=_VERSION}
- @${ECHO_CMD} "${_v}=`${MAKE} -V ${_v} -f ${WRKSRC}/firmware.mk`"
-.endfor
-
-.include <bsd.port.post.mk>
diff --git a/misc/dahdi-kmod/distinfo b/misc/dahdi-kmod/distinfo
deleted file mode 100644
index bca62c47438e..000000000000
--- a/misc/dahdi-kmod/distinfo
+++ /dev/null
@@ -1,16 +0,0 @@
-SHA256 (dahdi-freebsd-complete-2.4.0-rc5+2.4.0-rc1.tar.gz) = f364a13d10aa67ac26eb68babfcd4aa2a789f6ce074a923e20192f12fa02e3d2
-SIZE (dahdi-freebsd-complete-2.4.0-rc5+2.4.0-rc1.tar.gz) = 2049189
-SHA256 (oslec-linux-2.6.35.4.tar.gz) = 01cfaa1ca64056c822d1a3ebf4f7b3c81127cd7b308ad5b0738ff4eb2026e261
-SIZE (oslec-linux-2.6.35.4.tar.gz) = 12057
-SHA256 (zaphfc-r5.tar.gz) = 7e809b62dcc2bd3caf2e5a882390051b881eb08d37fea1733d7fb55e80bc6756
-SIZE (zaphfc-r5.tar.gz) = 15639
-SHA256 (dahdi-fw-oct6114-064-1.05.01.tar.gz) = 56bac1f2024c76ecf9b6f40992eeea29a1fbee676bb2a37a058179bacfbb1c91
-SIZE (dahdi-fw-oct6114-064-1.05.01.tar.gz) = 165869
-SHA256 (dahdi-fw-oct6114-128-1.05.01.tar.gz) = e1146749d205c41603b9b76852c3f8104dac233d0025d700db24504d10c99775
-SIZE (dahdi-fw-oct6114-128-1.05.01.tar.gz) = 165849
-SHA256 (dahdi-fw-tc400m-MR6.12.tar.gz) = 11dd8d009809e41fc9a3a36766f59ff73d29075eede5b8724331d9a6e5259774
-SIZE (dahdi-fw-tc400m-MR6.12.tar.gz) = 1750035
-SHA256 (dahdi-fw-hx8-2.06.tar.gz) = 449ab3fd03d55d808e999efb7677cd04de202b92c9fcb039539a7e48a39a80f5
-SIZE (dahdi-fw-hx8-2.06.tar.gz) = 29252
-SHA256 (dahdi-fwload-vpmadt032-1.25.0.tar.gz) = 3ff26cf80555fd7470b43a87c51d03c1db2a75abcd4561d79f69b6c48298e4a1
-SIZE (dahdi-fwload-vpmadt032-1.25.0.tar.gz) = 149360
diff --git a/misc/dahdi-kmod/files/dahdi.in b/misc/dahdi-kmod/files/dahdi.in
deleted file mode 100644
index 6122bba0f387..000000000000
--- a/misc/dahdi-kmod/files/dahdi.in
+++ /dev/null
@@ -1,79 +0,0 @@
-#!/bin/sh
-
-# PROVIDE: dahdi
-# REQUIRE: NETWORKING
-# KEYWORD: shutdown
-# BEFORE: asterisk
-#
-# Add the following lines to /etc/rc.conf.local or /etc/rc.conf
-# to enable this service:
-#
-# dahdi_enable (bool): YES/NO (default: NO)
-# dahdi_modules (list of strings): dahdi modules to load at boot (default: dahdi)
-#
-# Valid modules are:
-# - dahdi
-# - dahdi_transcode
-# - wcb4xxp
-# - wcfxo
-# - wct4xxp
-# - wctc4xxp
-# - wctdm
-# - wctdm24xxp
-# - wcte11xp
-# - wcte12xp
-#
-# Example:
-#
-# dahdi_enable="YES"
-# dahdi_modules="wct4xxp"
-#
-
-. /etc/rc.subr
-
-name="dahdi"
-rcvar=dahdi_enable
-
-start_cmd="dahdi_start"
-stop_cmd="dahdi_stop"
-load_rc_config $name
-: ${dahdi_enable="NO"}
-: ${dahdi_modules="dahdi"}
-
-kmod_dir=%%PREFIX%%/lib/dahdi
-# reverse list
-for m in ${dahdi_modules}; do
- dahdi_modules_unload="$m ${dahdi_modules_unload}"
-done
-
-dahdi_start()
-{
- echo "Starting ${name}."
-
- # load kernel modules
- kldconfig -mf ${kmod_dir}
- for m in ${dahdi_modules}; do
- kldload $m || exit 1
- done
-
- # configure devfs
- devfs rule apply path 'dahdi/*' mode 0664 user root group dahdi
-
- # run configuration utilities
- /bin/sleep 5
- %%PREFIX%%/sbin/dahdi_cfg
- if [ -r %%PREFIX%%/etc/fxotune.conf ]; then
- echo "Starting fxotune."
- %%PREFIX%%/sbin/fxotune -s
- fi
-}
-
-dahdi_stop()
-{
- echo -n " ${name}"
- for m in ${dahdi_modules_unload}; do
- kldunload $m
- done
-}
-
-run_rc_command "$1"
diff --git a/misc/dahdi-kmod/files/patch-bchan b/misc/dahdi-kmod/files/patch-bchan
deleted file mode 100644
index 4aa35a8b8163..000000000000
--- a/misc/dahdi-kmod/files/patch-bchan
+++ /dev/null
@@ -1,170 +0,0 @@
-# Translate the D channels to a standard channel data.
-# The HFC chipset provides us the D channel as data, but
-# Zaptel expects it as a standard channel with 1000 samples
-# per second.
-
-Index: freebsd/include/dahdi/dahdi_config.h
-===================================================================
---- freebsd/include/dahdi/dahdi_config.h (revision 8781)
-+++ freebsd/include/dahdi/dahdi_config.h (working copy)
-@@ -180,7 +180,13 @@
- */
- /* #define OPTIMIZE_CHANMUTE */
-
-+/*
-+ * Uncomment the following for BRI D channels
-+ *
-+ */
-+#define CONFIG_DAHDI_BRI_DCHANS
-
-+
- /*
- * Pass DAHDI_AUDIOMODE to channel driver as well
- */
-Index: freebsd/include/dahdi/kernel.h
-===================================================================
---- freebsd/include/dahdi/kernel.h (revision 8781)
-+++ freebsd/include/dahdi/kernel.h (working copy)
-@@ -426,6 +426,13 @@
- int statcount;
- int lastnumbufs;
- #endif
-+#ifdef CONFIG_DAHDI_BRI_DCHANS
-+ int bytes2receive;
-+ int maxbytes2transmit; /* size of the tx buffer in the card driver */
-+ int bytes2transmit;
-+ int eofrx;
-+ int eoftx;
-+#endif
- spinlock_t lock;
- char name[40];
- /* Specified by DAHDI */
-@@ -738,6 +745,9 @@
- DAHDI_FLAGBIT_LOOPED = 18, /*!< Loopback the receive data from the channel to the transmit */
- DAHDI_FLAGBIT_MTP2 = 19, /*!< Repeats last message in buffer and also discards repeating messages sent to us */
- DAHDI_FLAGBIT_HDLC56 = 20, /*!< Sets the given channel (if in HDLC mode) to use 56K HDLC instead of 64K */
-+#if defined(CONFIG_DAHDI_BRI_DCHANS)
-+ DAHDI_FLAGBIT_BRIDCHAN = 21, /*!< hardhdlc-like handling of the D channel */
-+#endif
- };
-
- struct dahdi_count {
-@@ -788,6 +798,7 @@
- #define DAHDI_FLAG_LOOPED DAHDI_FLAG(LOOPED)
- #define DAHDI_FLAG_MTP2 DAHDI_FLAG(MTP2)
- #define DAHDI_FLAG_HDLC56 DAHDI_FLAG(HDLC56)
-+#define DAHDI_FLAG_BRIDCHAN DAHDI_FLAG(BRIDCHAN)
-
- struct dahdi_span {
- spinlock_t lock;
-Index: freebsd/drivers/dahdi/dahdi-base.c
-===================================================================
---- freebsd/drivers/dahdi/dahdi-base.c (revision 8860)
-+++ freebsd/drivers/dahdi/dahdi-base.c (working copy)
-@@ -6884,11 +6881,40 @@
- *(txb++) = fasthdlc_tx_run_nocheck(&ms->txhdlc);
- }
- bytes -= left;
-+#ifdef CONFIG_DAHDI_BRI_DCHANS
-+ } else if (test_bit(DAHDI_FLAGBIT_BRIDCHAN, &ms->flags)) {
-+ /*
-+ * Let's get this right, we want to transmit complete frames only.
-+ * The card driver will do the dirty HDLC work for us.
-+ * txb (transmit buffer) is supposed to be big enough to store one frame
-+ * we will make this as big as the D fifo (1KB or 2KB)
-+ */
-+
-+ /* there are 'left' bytes in the user buffer left to transmit */
-+ left = ms->writen[ms->outwritebuf] - ms->writeidx[ms->outwritebuf] - 2;
-+ if (left > ms->maxbytes2transmit) {
-+ memcpy(txb, buf + ms->writeidx[ms->outwritebuf], ms->maxbytes2transmit);
-+ ms->writeidx[ms->outwritebuf] += ms->maxbytes2transmit;
-+ txb += ms->maxbytes2transmit;
-+ ms->bytes2transmit = ms->maxbytes2transmit;
-+ ms->eoftx = 0;
-+ } else {
-+ memcpy(txb, buf + ms->writeidx[ms->outwritebuf], left);
-+ ms->writeidx[ms->outwritebuf] += left + 2;
-+ txb += left + 2;
-+ ms->bytes2transmit = left;
-+ ms->eoftx = 1;
-+ }
-+ bytes = 0;
-+#endif
- } else {
- memcpy(txb, buf + ms->writeidx[ms->outwritebuf], left);
- ms->writeidx[ms->outwritebuf]+=left;
- txb += left;
- bytes -= left;
-+#if defined(CONFIG_DAHDI_BRI_DCHANS)
-+ ms->bytes2transmit=DAHDI_CHUNKSIZE;
-+#endif
- }
- /* Check buffer status */
- if (ms->writeidx[ms->outwritebuf] >= ms->writen[ms->outwritebuf]) {
-@@ -6947,6 +6973,17 @@
- /* Transmit a flag if this is an HDLC channel */
- if (ms->flags & DAHDI_FLAG_HDLC)
- fasthdlc_tx_frame_nocheck(&ms->txhdlc);
-+#if defined(CONFIG_DAHDI_BRI_DCHANS)
-+ if (test_bit(DAHDI_FLAGBIT_BRIDCHAN, &ms->flags)) {
-+ // if (ms->bytes2transmit > 0) {
-+ // txb += 2;
-+ // ms->bytes2transmit -= 2;
-+ bytes=0;
-+ ms->eoftx = 1;
-+// printk(KERN_CRIT "zaptel EOF(%d) bytes2transmit %d\n",ms->eoftx,ms->bytes2transmit);
-+ // }
-+ }
-+#endif
- #ifdef CONFIG_DAHDI_NET
- if (ms->flags & DAHDI_FLAG_NETDEV)
- netif_wake_queue(ztchan_to_dev(ms));
-@@ -7007,6 +7044,12 @@
- memset(txb, 0xFF, bytes);
- }
- bytes = 0;
-+#if defined(CONFIG_DAHDI_BRI_DCHANS)
-+ } else if (test_bit(DAHDI_FLAGBIT_BRIDCHAN, &ms->flags)) {
-+ ms->bytes2transmit = 0;
-+ ms->eoftx = 0;
-+ bytes = 0;
-+#endif
- } else {
- memset(txb, DAHDI_LIN2X(0, ms), bytes); /* Lastly we use silence on telephony channels */
- bytes = 0;
-@@ -7905,6 +7948,14 @@
- int left, x;
-
-
-+#if defined(CONFIG_DAHDI_BRI_DCHANS)
-+ if (test_bit(DAHDI_FLAGBIT_BRIDCHAN, &ms->flags)) {
-+ bytes = ms->bytes2receive;
-+ if (bytes < 1) return;
-+// printk(KERN_CRIT "bytes2receive %d\n",ms->bytes2receive);
-+ }
-+#endif
-+
- while(bytes) {
- #if defined(CONFIG_DAHDI_NET) || defined(CONFIG_DAHDI_PPP)
- skb = NULL;
-@@ -7962,6 +8013,19 @@
- }
- }
- }
-+#ifdef CONFIG_DAHDI_BRI_DCHANS
-+ } else if (test_bit(DAHDI_FLAGBIT_BRIDCHAN, &ms->flags)) {
-+ memcpy(buf + ms->readidx[ms->inreadbuf], rxb, left);
-+ rxb += left;
-+ ms->readidx[ms->inreadbuf] += left;
-+ bytes -= left;
-+ if (ms->eofrx == 1) {
-+ eof=1;
-+ }
-+// printk(KERN_CRIT "receiving %d bytes\n",ms->bytes2receive);
-+ ms->bytes2receive = 0;
-+ ms->eofrx = 0;
-+#endif
- } else {
- /* Not HDLC */
- memcpy(buf + ms->readidx[ms->inreadbuf], rxb, left);
diff --git a/misc/dahdi-kmod/files/patch-clang b/misc/dahdi-kmod/files/patch-clang
deleted file mode 100644
index a93238716a13..000000000000
--- a/misc/dahdi-kmod/files/patch-clang
+++ /dev/null
@@ -1,18 +0,0 @@
---- freebsd/freebsd/wcb4xxp/Makefile.orig 2015-01-28 06:35:48.000000000 +0600
-+++ freebsd/freebsd/wcb4xxp/Makefile 2015-01-28 06:44:25.000000000 +0600
-@@ -5,5 +5,6 @@
- KMOD= wcb4xxp
- SRCS= base.c
- SRCS+= device_if.h bus_if.h pci_if.h
-+CFLAGS.clang= -Wno-unused-command-line-argument
-
- .include <bsd.kmod.mk>
---- freebsd/freebsd/wcte11xp/Makefile.orig 2015-01-28 06:44:53.000000000 +0600
-+++ freebsd/freebsd/wcte11xp/Makefile 2015-01-28 06:53:29.000000000 +0600
-@@ -6,5 +6,6 @@
- SRCS= wcte11xp.c
- SRCS+= device_if.h bus_if.h pci_if.h
- CFLAGS= --param inline-unit-growth=100
-+CFLAGS.clang= -Wno-unused-command-line-argument
-
- .include <bsd.kmod.mk>
diff --git a/misc/dahdi-kmod/files/patch-dahdi-iface b/misc/dahdi-kmod/files/patch-dahdi-iface
deleted file mode 100644
index 86501da5bfe7..000000000000
--- a/misc/dahdi-kmod/files/patch-dahdi-iface
+++ /dev/null
@@ -1,939 +0,0 @@
-Index: freebsd/include/dahdi/kernel.h
-===================================================================
---- freebsd/include/dahdi/kernel.h (revision 10321)
-+++ freebsd/include/dahdi/kernel.h (working copy)
-@@ -468,6 +468,7 @@
- struct cdev *dev; /*!< Device structure */
- struct cdev *file; /*!< File structure */
- int file_flags;
-+ struct dahdi_iface *iface;
- #else
- struct file *file; /*!< File structure */
- #endif
-@@ -1361,4 +1362,8 @@
-
- void dahdi_poll_wait(struct file *file, struct pollinfo *sel, struct poll_table_struct *wait_table);
-
-+int dahdi_net_chan_init(struct dahdi_chan *chan, int numbufs);
-+void dahdi_net_chan_destroy(struct dahdi_chan *chan);
-+void dahdi_net_chan_xmit(struct dahdi_chan *chan);
-+
- #endif /* _DAHDI_KERNEL_H */
-Index: freebsd/freebsd/dahdi/ng_dahdi_iface.c
-===================================================================
---- freebsd/freebsd/dahdi/ng_dahdi_iface.c (revision 0)
-+++ freebsd/freebsd/dahdi/ng_dahdi_iface.c (revision 10329)
-@@ -0,0 +1,605 @@
-+/*-
-+ * Copyright (c) 2011 The FreeBSD Foundation
-+ * All rights reserved.
-+ *
-+ * This software was developed by Max Khon.
-+ *
-+ * Redistribution and use in source and binary forms, with or without
-+ * modification, are permitted provided that the following conditions
-+ * are met:
-+ * 1. Redistributions of source code must retain the above copyright
-+ * notice, this list of conditions and the following disclaimer.
-+ * 2. Redistributions in binary form must reproduce the above copyright
-+ * notice, this list of conditions and the following disclaimer in the
-+ * documentation and/or other materials provided with the distribution.
-+ *
-+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
-+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
-+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-+ * SUCH DAMAGE.
-+ *
-+ * $Id$
-+ */
-+
-+#include <sys/types.h>
-+#include <sys/mbuf.h>
-+#include <sys/linker.h>
-+#include <sys/syscallsubr.h>
-+#include <sys/taskqueue.h>
-+
-+#include <netgraph/ng_message.h>
-+#include <netgraph/netgraph.h>
-+
-+#include <netinet/in.h>
-+#include <netgraph/ng_cisco.h>
-+#include <netgraph/ng_iface.h>
-+
-+#include <dahdi/kernel.h>
-+
-+#include "ng_dahdi_iface.h"
-+
-+#define module_printk(level, fmt, args...) printk(level "%s: " fmt, THIS_MODULE->name, ## args)
-+
-+#if __FreeBSD_version < 800000
-+struct ng_node *ng_name2noderef(struct ng_node *node, const char *name);
-+#endif
-+
-+#define DAHDI_IFACE_HOOK_UPPER "upper"
-+
-+static ng_rcvmsg_t ng_dahdi_iface_rcvmsg;
-+static ng_shutdown_t ng_dahdi_iface_shutdown;
-+static ng_newhook_t ng_dahdi_iface_newhook;
-+static ng_disconnect_t ng_dahdi_iface_disconnect;
-+static ng_rcvdata_t ng_dahdi_iface_rcvdata;
-+
-+static struct ng_type ng_dahdi_iface_typestruct = {
-+ .version = NG_ABI_VERSION,
-+ .name = "ng_dahdi_iface",
-+ .rcvmsg = ng_dahdi_iface_rcvmsg,
-+ .shutdown = ng_dahdi_iface_shutdown,
-+ .newhook = ng_dahdi_iface_newhook,
-+ .rcvdata = ng_dahdi_iface_rcvdata,
-+ .disconnect = ng_dahdi_iface_disconnect,
-+};
-+NETGRAPH_INIT(dahdi_iface, &ng_dahdi_iface_typestruct);
-+
-+static void dahdi_iface_rx_task(void *context, int pending);
-+
-+/**
-+ * iface struct
-+ */
-+struct dahdi_iface {
-+ struct dahdi_chan *chan; /**< dahdi master channel associated with the iface */
-+ struct taskqueue *rx_taskqueue; /**< rx task queue */
-+ struct task rx_task; /**< rx task */
-+ struct ng_node *node; /**< our netgraph node */
-+ struct ng_hook *upper; /**< our upper hook */
-+ char path[64]; /**< iface node path */
-+};
-+
-+/**
-+ * Create iface struct
-+ */
-+static struct dahdi_iface *
-+dahdi_iface_alloc(struct dahdi_chan *chan)
-+{
-+ struct dahdi_iface *iface;
-+
-+ iface = malloc(sizeof(*iface), M_DAHDI, M_WAITOK | M_ZERO);
-+ iface->chan = chan;
-+ iface->rx_taskqueue = taskqueue_create_fast("dahdi_iface_taskq", M_WAITOK,
-+ taskqueue_thread_enqueue, &iface->rx_taskqueue);
-+ taskqueue_start_threads(&iface->rx_taskqueue, 1, PI_NET, "%s taskq", chan->name);
-+ TASK_INIT(&iface->rx_task, 0, dahdi_iface_rx_task, chan);
-+ return iface;
-+}
-+
-+/**
-+ * Free iface struct
-+ */
-+static void
-+dahdi_iface_free(struct dahdi_iface *iface)
-+{
-+ taskqueue_free(iface->rx_taskqueue);
-+ free(iface, M_DAHDI);
-+}
-+
-+/**
-+ * Ensure that specified netgraph type is available
-+ */
-+static int
-+ng_ensure_type(const char *type)
-+{
-+ int error;
-+ int fileid;
-+ char filename[NG_TYPESIZ + 3];
-+
-+ if (ng_findtype(type) != NULL)
-+ return (0);
-+
-+ /* Not found, try to load it as a loadable module. */
-+ snprintf(filename, sizeof(filename), "ng_%s", type);
-+ error = kern_kldload(curthread, filename, &fileid);
-+ if (error != 0)
-+ return (-1);
-+
-+ /* See if type has been loaded successfully. */
-+ if (ng_findtype(type) == NULL) {
-+ (void)kern_kldunload(curthread, fileid, LINKER_UNLOAD_NORMAL);
-+ return (-1);
-+ }
-+
-+ return (0);
-+}
-+
-+/**
-+ * Connect hooks
-+ */
-+static void
-+dahdi_iface_connect_node_path(struct ng_node *node, const char *ourpath,
-+ const char *path, const char *ourhook, const char *peerhook)
-+{
-+ int error;
-+ struct ng_mesg *msg;
-+ struct ngm_connect *nc;
-+
-+ NG_MKMESSAGE(msg, NGM_GENERIC_COOKIE, NGM_CONNECT, sizeof(*nc), M_WAITOK);
-+ if (msg == NULL) {
-+ printf("dahdi_iface(%s): Error: can not allocate NGM_CONNECT message (ignored)\n",
-+ NG_NODE_NAME(node));
-+ return;
-+ }
-+ nc = (struct ngm_connect *) msg->data;
-+ strlcpy(nc->path, path, sizeof(nc->path));
-+ strlcpy(nc->ourhook, ourhook, sizeof(nc->ourhook));
-+ strlcpy(nc->peerhook, peerhook, sizeof(nc->peerhook));
-+ NG_SEND_MSG_PATH(error, node, msg, __DECONST(char *, ourpath), NG_NODE_ID(node));
-+ if (error) {
-+ printf("dahdi_iface(%s): Error: NGM_CONNECT(%s<->%s): error %d (ignored)\n",
-+ NG_NODE_NAME(node), ourhook, peerhook, error);
-+ return;
-+ }
-+}
-+
-+/**
-+ * Shutdown node specified by path
-+ */
-+static void
-+dahdi_iface_shutdown_node_path(struct ng_node *node, const char *path)
-+{
-+ int error;
-+ struct ng_mesg *msg;
-+
-+ if (path[0] == '\0')
-+ return;
-+
-+ NG_MKMESSAGE(msg, NGM_GENERIC_COOKIE, NGM_SHUTDOWN, 0, M_WAITOK);
-+ NG_SEND_MSG_PATH(error, node, msg, __DECONST(char *, path), NG_NODE_ID(node));
-+ if (error) {
-+ printf("dahdi_iface(%s): Error: NGM_SHUTDOWN: error %d (ignored)\n",
-+ NG_NODE_NAME(node), error);
-+ return;
-+ }
-+}
-+
-+/**
-+ * Create a netgraph node and connect it to ng_iface instance
-+ *
-+ * @return 0 on success, -1 on error
-+ */
-+int
-+dahdi_iface_create(struct dahdi_chan *chan)
-+{
-+ struct dahdi_iface *iface = NULL;
-+ struct ng_node *node;
-+ struct ng_mesg *msg;
-+ char node_name[64];
-+ int error;
-+ struct ngm_mkpeer *ngm_mkpeer;
-+
-+ /* check if DAHDI netgraph node for that device already exists */
-+ snprintf(node_name, sizeof(node_name), "dahdi@%s", chan->name);
-+ node = ng_name2noderef(NULL, node_name);
-+ if (node != NULL) {
-+ printf("dahdi_iface(%s): existing netgraph node\n", NG_NODE_NAME(node));
-+ NG_NODE_UNREF(node);
-+ return (0);
-+ }
-+
-+ /* create new network device */
-+ iface = dahdi_iface_alloc(chan);
-+ if (iface == NULL) {
-+ printf("dahdi_iface(%s): Error: Failed to create iface struct\n",
-+ node_name);
-+ return (0);
-+ }
-+ chan->iface = iface;
-+
-+ /* create new DAHDI netgraph node */
-+ if (ng_make_node_common(&ng_dahdi_iface_typestruct, &node) != 0) {
-+ printf("dahdi_iface(%s): Error: Failed to create netgraph node\n",
-+ node_name);
-+ goto error;
-+ }
-+ iface->node = node;
-+ NG_NODE_SET_PRIVATE(node, iface);
-+ if (ng_name_node(node, node_name) != 0) {
-+ printf("dahdi_iface(%s): Error: Failed to set netgraph node name\n",
-+ node_name);
-+ goto error;
-+ }
-+
-+ /* create HDLC encapsulation layer peer node */
-+ if (ng_ensure_type(NG_CISCO_NODE_TYPE) < 0) {
-+ printf("dahdi_iface(%s): Error: Failed to load %s netgraph type\n",
-+ NG_NODE_NAME(node), NG_CISCO_NODE_TYPE);
-+ goto error;
-+ }
-+
-+ NG_MKMESSAGE(msg, NGM_GENERIC_COOKIE, NGM_MKPEER, sizeof(*ngm_mkpeer), M_WAITOK);
-+ ngm_mkpeer = (struct ngm_mkpeer *) msg->data;
-+ strlcpy(ngm_mkpeer->type, NG_CISCO_NODE_TYPE, sizeof(ngm_mkpeer->type));
-+ strlcpy(ngm_mkpeer->ourhook, DAHDI_IFACE_HOOK_UPPER, sizeof(ngm_mkpeer->ourhook));
-+ strlcpy(ngm_mkpeer->peerhook, NG_CISCO_HOOK_DOWNSTREAM, sizeof(ngm_mkpeer->peerhook));
-+ NG_SEND_MSG_ID(error, node, msg, NG_NODE_ID(node), NG_NODE_ID(node));
-+ if (error) {
-+ printf("dahdi_iface(%s): Error: NGM_MKPEER: error %d (%s)\n",
-+ NG_NODE_NAME(node), error, NG_CISCO_NODE_TYPE);
-+ goto error;
-+ }
-+
-+ /* create network iface peer node */
-+ if (ng_ensure_type(NG_IFACE_NODE_TYPE) < 0) {
-+ printf("dahdi_iface(%s): Error: Failed to load %s netgraph type\n",
-+ NG_NODE_NAME(node), NG_IFACE_NODE_TYPE);
-+ goto error;
-+ }
-+
-+ NG_MKMESSAGE(msg, NGM_GENERIC_COOKIE, NGM_MKPEER, sizeof(*ngm_mkpeer), M_WAITOK);
-+ ngm_mkpeer = (struct ngm_mkpeer *) msg->data;
-+ strlcpy(ngm_mkpeer->type, NG_IFACE_NODE_TYPE, sizeof(ngm_mkpeer->type));
-+ strlcpy(ngm_mkpeer->ourhook, NG_CISCO_HOOK_INET, sizeof(ngm_mkpeer->ourhook));
-+ strlcpy(ngm_mkpeer->peerhook, NG_IFACE_HOOK_INET, sizeof(ngm_mkpeer->peerhook));
-+ NG_SEND_MSG_PATH(error, node, msg, DAHDI_IFACE_HOOK_UPPER, NG_NODE_ID(node));
-+ if (error) {
-+ printf("dahdi_iface(%s): Error: NGM_MKPEER: error %d (%s)\n",
-+ NG_NODE_NAME(node), error, NG_IFACE_NODE_TYPE);
-+ goto error;
-+ }
-+ snprintf(iface->path, sizeof(iface->path), "%s.%s",
-+ DAHDI_IFACE_HOOK_UPPER, NG_CISCO_HOOK_INET);
-+
-+ /* connect other hooks */
-+ dahdi_iface_connect_node_path(node, DAHDI_IFACE_HOOK_UPPER,
-+ NG_CISCO_HOOK_INET, NG_CISCO_HOOK_INET6, NG_IFACE_HOOK_INET6);
-+ dahdi_iface_connect_node_path(node, DAHDI_IFACE_HOOK_UPPER,
-+ NG_CISCO_HOOK_INET, NG_CISCO_HOOK_APPLETALK, NG_IFACE_HOOK_ATALK);
-+ dahdi_iface_connect_node_path(node, DAHDI_IFACE_HOOK_UPPER,
-+ NG_CISCO_HOOK_INET, NG_CISCO_HOOK_IPX, NG_IFACE_HOOK_IPX);
-+
-+ /* get iface name */
-+ NG_MKMESSAGE(msg, NGM_IFACE_COOKIE, NGM_IFACE_GET_IFNAME, 0, M_WAITOK);
-+ NG_SEND_MSG_PATH(error, node, msg, iface->path, NG_NODE_ID(node));
-+ if (error) {
-+ printf("dahdi_iface(%s): Error: NGM_MKPEER: error %d (%s)\n",
-+ NG_NODE_NAME(node), error, NG_IFACE_NODE_TYPE);
-+ goto error;
-+ }
-+
-+ printf("dahdi_iface(%s): new netgraph node\n",
-+ NG_NODE_NAME(node));
-+
-+ /* setup channel */
-+ if (dahdi_net_chan_init(chan, DAHDI_DEFAULT_NUM_BUFS * 8)) {
-+ printf("dahdi_iface(%s): Error: Failed to initialize channel\n",
-+ NG_NODE_NAME(node));
-+ goto error;
-+ }
-+
-+ return (0);
-+
-+error:
-+ if (iface != NULL) {
-+ if (iface->node != NULL) {
-+ dahdi_iface_shutdown_node_path(iface->node, iface->path);
-+ NG_NODE_UNREF(iface->node);
-+ iface->node = NULL;
-+ }
-+
-+ dahdi_iface_free(iface);
-+ chan->iface = NULL;
-+ }
-+ return (-1);
-+}
-+
-+/**
-+ * Destroy a netgraph node and ng_iface instance associated with it
-+ */
-+void
-+dahdi_iface_destroy(struct dahdi_chan *chan)
-+{
-+ struct dahdi_iface *iface;
-+
-+ if ((iface = chan->iface) == NULL || iface->node == NULL)
-+ return;
-+
-+ /* shutdown HDLC encapsulation layer peer node */
-+ if (iface->upper != NULL) {
-+ dahdi_iface_shutdown_node_path(iface->node, iface->path);
-+ dahdi_iface_shutdown_node_path(iface->node, DAHDI_IFACE_HOOK_UPPER);
-+ }
-+
-+ NG_NODE_REALLY_DIE(iface->node); /* Force real removal of node */
-+ ng_rmnode_self(iface->node);
-+
-+ dahdi_net_chan_destroy(chan);
-+ chan->iface = NULL;
-+ chan->flags &= ~DAHDI_FLAG_NETDEV;
-+}
-+
-+/**
-+ * Enqueues a task to receive the data frame from the synchronous line
-+ *
-+ * It is not possible to send the received data frame from dahdi_receive()
-+ * context because it can be run in the filter thread context and mbuf
-+ * allocation is not possible because of that.
-+ */
-+void
-+dahdi_iface_rx(struct dahdi_chan *chan)
-+{
-+ struct dahdi_iface *iface;
-+ int oldreadbuf;
-+
-+ if ((iface = chan->iface) == NULL)
-+ return;
-+
-+ /* switch buffers */
-+ if ((oldreadbuf = chan->inreadbuf) >= 0) {
-+ chan->inreadbuf = (chan->inreadbuf + 1) % chan->numbufs;
-+ if (chan->inreadbuf == chan->outreadbuf)
-+ chan->inreadbuf = -1; /* no more buffers to receive to */
-+ if (chan->outreadbuf < 0)
-+ chan->outreadbuf = oldreadbuf; /* new buffer to read from */
-+ }
-+
-+ taskqueue_enqueue_fast(iface->rx_taskqueue, &iface->rx_task);
-+}
-+
-+/**
-+ * Receive data frame from the synchronous line
-+ *
-+ * Receives data frame from the synchronous line and sends it up to the upstream.
-+ */
-+static void
-+dahdi_iface_rx_task(void *context, int pending)
-+{
-+ struct dahdi_chan *chan = context;
-+ struct dahdi_iface *iface;
-+ unsigned long flags;
-+ int oldreadbuf;
-+
-+ if ((iface = chan->iface) == NULL)
-+ return;
-+
-+ spin_lock_irqsave(&chan->lock, flags);
-+ while ((oldreadbuf = chan->outreadbuf) >= 0) {
-+ struct mbuf *m = NULL;
-+
-+ /* read frame */
-+ if (iface->upper != NULL && chan->readn[chan->outreadbuf] > 1) {
-+
-+ /* Drop the FCS */
-+ chan->readn[chan->outreadbuf] -= 2;
-+
-+ MGETHDR(m, M_NOWAIT, MT_DATA);
-+ if (m != NULL) {
-+ if (chan->readn[chan->outreadbuf] >= MINCLSIZE) {
-+ MCLGET(m, M_NOWAIT);
-+ }
-+
-+ /* copy data */
-+ m_append(m, chan->readn[chan->outreadbuf], chan->readbuf[chan->outreadbuf]);
-+ }
-+ }
-+
-+ /* switch buffers */
-+ chan->readn[chan->outreadbuf] = 0;
-+ chan->readidx[chan->outreadbuf] = 0;
-+ chan->outreadbuf = (chan->outreadbuf + 1) % chan->numbufs;
-+ if (chan->outreadbuf == chan->inreadbuf)
-+ chan->outreadbuf = -1; /* no more buffers to read from */
-+ if (chan->inreadbuf < 0)
-+ chan->inreadbuf = oldreadbuf; /* new buffer to read to */
-+
-+ if (m != NULL) {
-+ int error;
-+
-+ spin_unlock_irqrestore(&chan->lock, flags);
-+ NG_SEND_DATA_ONLY(error, iface->upper, m);
-+ spin_lock_irqsave(&chan->lock, flags);
-+ }
-+ }
-+ spin_unlock_irqrestore(&chan->lock, flags);
-+}
-+
-+/**
-+ * Abort receiving a data frame
-+ */
-+void
-+dahdi_iface_abort(struct dahdi_chan *chan, int event)
-+{
-+ /* nothing to do */
-+#if 0
-+ module_printk(KERN_DEBUG, "%s: event %d\n", __func__, event);
-+#endif
-+}
-+
-+/**
-+ * Wake up transmitter
-+ */
-+void
-+dahdi_iface_wakeup_tx(struct dahdi_chan *chan)
-+{
-+ /* XXX not implemented */
-+}
-+
-+/**
-+ * Receive an incoming control message
-+ */
-+static int
-+ng_dahdi_iface_rcvmsg(struct ng_node *node, struct ng_item *item, struct ng_hook *lasthook)
-+{
-+ /* struct dahdi_iface *iface = NG_NODE_PRIVATE(node); */
-+ struct ng_mesg *msg, *resp = NULL;
-+ int error = 0;
-+
-+ NGI_GET_MSG(item, msg);
-+ switch (msg->header.typecookie) {
-+ case NGM_IFACE_COOKIE:
-+ switch (msg->header.cmd) {
-+ case NGM_IFACE_GET_IFNAME:
-+ printf("dahdi_iface(%s): interface %s\n",
-+ NG_NODE_NAME(node), msg->data);
-+ break;
-+ default:
-+ error = EINVAL;
-+ break;
-+ }
-+ break;
-+ default:
-+ error = EINVAL;
-+ break;
-+ }
-+ NG_RESPOND_MSG(error, node, item, resp);
-+ NG_FREE_MSG(msg);
-+ return (error);
-+}
-+
-+/**
-+ * Shutdown node
-+ *
-+ * Reset the node but does not remove it unless the REALLY_DIE flag is set.
-+ */
-+static int
-+ng_dahdi_iface_shutdown(struct ng_node *node)
-+{
-+ struct dahdi_iface *iface = NG_NODE_PRIVATE(node);
-+
-+ if (node->nd_flags & NGF_REALLY_DIE) {
-+ /* destroy the node itself */
-+ printf("dahdi_iface(%s): destroying netgraph node\n",
-+ NG_NODE_NAME(node));
-+ NG_NODE_SET_PRIVATE(node, NULL);
-+ NG_NODE_UNREF(node);
-+
-+ /* destroy the iface */
-+ dahdi_iface_free(iface);
-+ return (0);
-+ }
-+
-+ NG_NODE_REVIVE(node); /* Tell ng_rmnode we are persistent */
-+ return (0);
-+}
-+
-+/*
-+ * Check for attaching a new hook
-+ */
-+static int
-+ng_dahdi_iface_newhook(struct ng_node *node, struct ng_hook *hook, const char *name)
-+{
-+ struct dahdi_iface *iface = NG_NODE_PRIVATE(node);
-+ struct ng_hook **hookptr;
-+
-+ if (strcmp(name, DAHDI_IFACE_HOOK_UPPER) == 0) {
-+ hookptr = &iface->upper;
-+ } else {
-+ printf("dahdi_iface(%s): unsupported hook %s\n",
-+ NG_NODE_NAME(iface->node), name);
-+ return (EINVAL);
-+ }
-+
-+ if (*hookptr != NULL) {
-+ printf("dahdi_iface(%s): %s hook is already connected\n",
-+ NG_NODE_NAME(iface->node), name);
-+ return (EISCONN);
-+ }
-+
-+ *hookptr = hook;
-+ return (0);
-+}
-+
-+/*
-+ * Hook disconnection
-+ */
-+static int
-+ng_dahdi_iface_disconnect(struct ng_hook *hook)
-+{
-+ struct ng_node *node = NG_HOOK_NODE(hook);
-+ struct dahdi_iface *iface = NG_NODE_PRIVATE(node);
-+
-+ if (hook == iface->upper) {
-+ iface->upper = NULL;
-+ } else {
-+ panic("dahdi_iface(%s): %s: weird hook", NG_NODE_NAME(iface->node), __func__);
-+ }
-+
-+ return (0);
-+}
-+
-+/**
-+ * Receive data
-+ *
-+ * Receives data frame from the upstream and sends it down to the synchronous line.
-+ */
-+static int
-+ng_dahdi_iface_rcvdata(struct ng_hook *hook, struct ng_item *item)
-+{
-+ struct ng_node *node = NG_HOOK_NODE(hook);
-+ struct dahdi_iface *iface = NG_NODE_PRIVATE(node);
-+ struct dahdi_chan *ss = iface->chan;
-+ struct mbuf *m;
-+ int retval = 0;
-+ unsigned long flags;
-+ unsigned char *data;
-+ int data_len;
-+
-+ /* get mbuf */
-+ NGI_GET_M(item, m);
-+ NG_FREE_ITEM(item);
-+ data_len = m_length(m, NULL);
-+
-+ /* see if we have any buffers */
-+ spin_lock_irqsave(&ss->lock, flags);
-+ if (data_len > ss->blocksize - 2) {
-+ printf("dahdi_iface(%s): mbuf is too large (%d > %d)",
-+ NG_NODE_NAME(iface->node), data_len, ss->blocksize - 2);
-+ /* stats->tx_dropped++ */
-+ retval = EINVAL;
-+ goto out;
-+ }
-+ if (ss->inwritebuf < 0) {
-+ /* no space */
-+ retval = ENOBUFS;
-+ goto out;
-+ }
-+
-+ /* we have a place to put this packet */
-+ data = ss->writebuf[ss->inwritebuf];
-+ m_copydata(m, 0, data_len, data);
-+ ss->writen[ss->inwritebuf] = data_len;
-+ dahdi_net_chan_xmit(ss);
-+
-+out:
-+ spin_unlock_irqrestore(&ss->lock, flags);
-+
-+ /* free memory */
-+ NG_FREE_M(m);
-+ return (retval);
-+}
-
-Index: freebsd/freebsd/dahdi/ng_dahdi_iface.h
-===================================================================
---- freebsd/freebsd/dahdi/ng_dahdi_iface.h (revision 0)
-+++ freebsd/freebsd/dahdi/ng_dahdi_iface.h (revision 10329)
-@@ -0,0 +1,61 @@
-+/*-
-+ * Copyright (c) 2011 The FreeBSD Foundation
-+ * All rights reserved.
-+ *
-+ * This software was developed by Max Khon under sponsorship from UniqueSec HB.
-+ *
-+ * Redistribution and use in source and binary forms, with or without
-+ * modification, are permitted provided that the following conditions
-+ * are met:
-+ * 1. Redistributions of source code must retain the above copyright
-+ * notice, this list of conditions and the following disclaimer.
-+ * 2. Redistributions in binary form must reproduce the above copyright
-+ * notice, this list of conditions and the following disclaimer in the
-+ * documentation and/or other materials provided with the distribution.
-+ *
-+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
-+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
-+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-+ * SUCH DAMAGE.
-+ *
-+ * $Id$
-+ */
-+
-+#ifndef _NG_DAHDI_IFACE_H_
-+#define _NG_DAHDI_IFACE_H_
-+
-+/**
-+ * Create a netgraph node and connect it to ng_iface instance
-+ *
-+ * @return 0 on success, -1 on error
-+ */
-+int dahdi_iface_create(struct dahdi_chan *chan);
-+
-+/**
-+ * Destroy a netgraph node and ng_iface instance associated with it
-+ */
-+void dahdi_iface_destroy(struct dahdi_chan *chan);
-+
-+/**
-+ * Process data frame received from the synchronous line
-+ */
-+void dahdi_iface_rx(struct dahdi_chan *chan);
-+
-+/**
-+ * Abort receiving a data frame
-+ */
-+void dahdi_iface_abort(struct dahdi_chan *chan, int event);
-+
-+/**
-+ * Wake up transmitter
-+ */
-+void dahdi_iface_wakeup_tx(struct dahdi_chan *chan);
-+
-+#endif /* _NG_DAHDI_IFACE_H_ */
-
-Index: freebsd/freebsd/dahdi/Makefile
-===================================================================
---- freebsd/freebsd/dahdi/Makefile (revision 10321)
-+++ freebsd/freebsd/dahdi/Makefile (working copy)
-@@ -3,7 +3,7 @@
- .PATH: ${.CURDIR}/../../drivers/dahdi
-
- KMOD= dahdi
--SRCS= dahdi-base.c bsd-compat.c version.h
-+SRCS= dahdi-base.c ng_dahdi_iface.c bsd-compat.c version.h
- SRCS+= device_if.h bus_if.h pci_if.h
- CLEANFILES= version.h
- INCS= user.h wctdm_user.h compat/types.h
-Index: freebsd/drivers/dahdi/dahdi-base.c
-===================================================================
---- freebsd/drivers/dahdi/dahdi-base.c (revision 10321)
-+++ freebsd/drivers/dahdi/dahdi-base.c (working copy)
-@@ -137,6 +137,8 @@
- } ;
-
- #if defined(__FreeBSD__)
-+#include "ng_dahdi_iface.h"
-+
- MALLOC_DEFINE(M_DAHDI, "dahdi", "DAHDI interface data structures");
-
- /*
-@@ -2009,6 +2011,62 @@
- }
- #endif
-
-+int dahdi_net_chan_init(struct dahdi_chan *ms, int numbufs)
-+{
-+ int res;
-+
-+ ms->txbufpolicy = DAHDI_POLICY_IMMEDIATE;
-+ ms->rxbufpolicy = DAHDI_POLICY_IMMEDIATE;
-+
-+ res = dahdi_reallocbufs(ms, DAHDI_DEFAULT_MTU_MRU, numbufs);
-+ if (res)
-+ return res;
-+
-+ fasthdlc_init(&ms->rxhdlc, (ms->flags & DAHDI_FLAG_HDLC56) ? FASTHDLC_MODE_56 : FASTHDLC_MODE_64);
-+ fasthdlc_init(&ms->txhdlc, (ms->flags & DAHDI_FLAG_HDLC56) ? FASTHDLC_MODE_56 : FASTHDLC_MODE_64);
-+ ms->infcs = PPP_INITFCS;
-+ return 0;
-+}
-+
-+void dahdi_net_chan_destroy(struct dahdi_chan *ms)
-+{
-+ dahdi_reallocbufs(ms, 0, 0);
-+}
-+
-+void dahdi_net_chan_xmit(struct dahdi_chan *ss)
-+{
-+ int x, oldbuf;
-+ unsigned int fcs;
-+ unsigned char *data = ss->writebuf[ss->inwritebuf];
-+
-+ ss->writeidx[ss->inwritebuf] = 0;
-+ /* Calculate the FCS */
-+ fcs = PPP_INITFCS;
-+ for (x=0;x<ss->writen[ss->inwritebuf];x++)
-+ fcs = PPP_FCS(fcs, data[x]);
-+ /* Invert it */
-+ fcs ^= 0xffff;
-+ /* Send it out LSB first */
-+ data[ss->writen[ss->inwritebuf]++] = (fcs & 0xff);
-+ data[ss->writen[ss->inwritebuf]++] = (fcs >> 8) & 0xff;
-+ /* Advance to next window */
-+ oldbuf = ss->inwritebuf;
-+ ss->inwritebuf = (ss->inwritebuf + 1) % ss->numbufs;
-+
-+ if (ss->inwritebuf == ss->outwritebuf) {
-+ /* Whoops, no more space. */
-+ ss->inwritebuf = -1;
-+#if !defined(__FreeBSD__)
-+ netif_stop_queue(ztchan_to_dev(ss));
-+#endif
-+ }
-+ if (ss->outwritebuf < 0) {
-+ /* Let the interrupt handler know there's
-+ some space for us */
-+ ss->outwritebuf = oldbuf;
-+ }
-+}
-+
- #ifdef CONFIG_DAHDI_NET
- #ifdef NEW_HDLC_INTERFACE
- static int dahdi_net_open(struct net_device *dev)
-@@ -2037,17 +2095,11 @@
- module_printk(KERN_NOTICE, "%s is not a net device!\n", ms->name);
- return -EINVAL;
- }
-- ms->txbufpolicy = DAHDI_POLICY_IMMEDIATE;
-- ms->rxbufpolicy = DAHDI_POLICY_IMMEDIATE;
-
-- res = dahdi_reallocbufs(ms, DAHDI_DEFAULT_MTU_MRU, DAHDI_DEFAULT_NUM_BUFS);
-+ res = dahdi_net_chan_init(ms);
- if (res)
- return res;
-
-- fasthdlc_init(&ms->rxhdlc, (ms->flags & DAHDI_FLAG_HDLC56) ? FASTHDLC_MODE_56 : FASTHDLC_MODE_64);
-- fasthdlc_init(&ms->txhdlc, (ms->flags & DAHDI_FLAG_HDLC56) ? FASTHDLC_MODE_56 : FASTHDLC_MODE_64);
-- ms->infcs = PPP_INITFCS;
--
- netif_start_queue(ztchan_to_dev(ms));
-
- #ifdef CONFIG_DAHDI_DEBUG
-@@ -2105,7 +2157,7 @@
- }
- /* Not much to do here. Just deallocate the buffers */
- netif_stop_queue(ztchan_to_dev(ms));
-- dahdi_reallocbufs(ms, 0, 0);
-+ dahdi_net_chan_destroy(ms);
- hdlc_close(dev);
- #ifdef NEW_HDLC_INTERFACE
- return 0;
-@@ -2165,8 +2217,6 @@
- struct net_device_stats *stats = &ss->hdlcnetdev->netdev.stats;
- #endif
- int retval = 1;
-- int x,oldbuf;
-- unsigned int fcs;
- unsigned char *data;
- unsigned long flags;
- /* See if we have any buffers */
-@@ -2181,31 +2231,7 @@
- data = ss->writebuf[ss->inwritebuf];
- memcpy(data, skb->data, skb->len);
- ss->writen[ss->inwritebuf] = skb->len;
-- ss->writeidx[ss->inwritebuf] = 0;
-- /* Calculate the FCS */
-- fcs = PPP_INITFCS;
-- for (x=0;x<skb->len;x++)
-- fcs = PPP_FCS(fcs, data[x]);
-- /* Invert it */
-- fcs ^= 0xffff;
-- /* Send it out LSB first */
-- data[ss->writen[ss->inwritebuf]++] = (fcs & 0xff);
-- data[ss->writen[ss->inwritebuf]++] = (fcs >> 8) & 0xff;
-- /* Advance to next window */
-- oldbuf = ss->inwritebuf;
-- ss->inwritebuf = (ss->inwritebuf + 1) % ss->numbufs;
--
-- if (ss->inwritebuf == ss->outwritebuf) {
-- /* Whoops, no more space. */
-- ss->inwritebuf = -1;
--
-- netif_stop_queue(ztchan_to_dev(ss));
-- }
-- if (ss->outwritebuf < 0) {
-- /* Let the interrupt handler know there's
-- some space for us */
-- ss->outwritebuf = oldbuf;
-- }
-+ dahdi_net_chan_xmit(ss);
- dev->trans_start = jiffies;
- stats->tx_packets++;
- stats->tx_bytes += ss->writen[oldbuf];
-@@ -2347,6 +2373,10 @@
- kfree(chan->hdlcnetdev);
- chan->hdlcnetdev = NULL;
- }
-+#elif defined(__FreeBSD__)
-+ if (chan->flags & DAHDI_FLAG_NETDEV) {
-+ dahdi_iface_destroy(chan);
-+ }
- #endif
- write_lock_irqsave(&chan_lock, flags);
- if (test_bit(DAHDI_FLAGBIT_REGISTERED, &chan->flags)) {
-@@ -4649,6 +4679,12 @@
- chans[ch.chan]->hdlcnetdev = NULL;
- chans[ch.chan]->flags &= ~DAHDI_FLAG_NETDEV;
- }
-+#elif defined(__FreeBSD__)
-+ if (chans[ch.chan]->flags & DAHDI_FLAG_NETDEV) {
-+ spin_unlock_irqrestore(&chans[ch.chan]->lock, flags);
-+ dahdi_iface_destroy(chans[ch.chan]);
-+ spin_lock_irqsave(&chans[ch.chan]->lock, flags);
-+ }
- #else
- if (ch.sigtype == DAHDI_SIG_HDLCNET) {
- spin_unlock_irqrestore(&chans[ch.chan]->lock, flags);
-@@ -4774,6 +4808,16 @@
- res = -1;
- }
- }
-+#elif defined(__FreeBSD__)
-+ if (!res &&
-+ newmaster == chans[ch.chan] &&
-+ chans[ch.chan]->sig == DAHDI_SIG_HDLCNET) {
-+ spin_unlock_irqrestore(&chans[ch.chan]->lock, flags);
-+ /* Briefly restore interrupts while we register the device */
-+ if ((res = dahdi_iface_create(chans[ch.chan])) == 0)
-+ chans[ch.chan]->flags |= DAHDI_FLAG_NETDEV;
-+ spin_lock_irqsave(&chans[ch.chan]->lock, flags);
-+ }
- #endif
- if ((chans[ch.chan]->sig == DAHDI_SIG_HDLCNET) &&
- (chans[ch.chan] == newmaster) &&
-@@ -7003,6 +7047,9 @@
- #ifdef CONFIG_DAHDI_NET
- if (ms->flags & DAHDI_FLAG_NETDEV)
- netif_wake_queue(ztchan_to_dev(ms));
-+#elif defined(__FreeBSD__)
-+ if (ms->flags & DAHDI_FLAG_NETDEV)
-+ dahdi_iface_wakeup_tx(ms);
- #endif
- #ifdef CONFIG_DAHDI_PPP
- if (ms->flags & DAHDI_FLAG_PPP) {
-@@ -8088,6 +8135,10 @@
- ms->readn[ms->inreadbuf] = 0;
- ms->readidx[ms->inreadbuf] = 0;
- } else
-+#elif defined(__FreeBSD__)
-+ if (ms->flags & DAHDI_FLAG_NETDEV) {
-+ dahdi_iface_rx(ms);
-+ } else
- #endif
- {
- /* This logic might confuse and astound. Basically we need to find
-@@ -8173,6 +8224,10 @@
- if (abort == DAHDI_EVENT_ABORT)
- stats->rx_frame_errors++;
- } else
-+#elif defined(__FreeBSD__)
-+ if (ms->flags & DAHDI_FLAG_NETDEV) {
-+ dahdi_iface_abort(ms, abort);
-+ } else
- #endif
- #ifdef CONFIG_DAHDI_PPP
- if (ms->flags & DAHDI_FLAG_PPP) {
-@@ -9351,6 +9406,7 @@
- DAHDI_DEV_MODULE(dahdi);
- MODULE_VERSION(dahdi, 1);
- MODULE_DEPEND(dahdi, firmware, 1, 1, 1);
-+
- #ifdef CONFIG_DAHDI_CORE_TIMER
- static int
- dahdi_dummy_modevent(module_t mod, int cmd, void *arg)
diff --git a/misc/dahdi-kmod/files/patch-flush_workqueue b/misc/dahdi-kmod/files/patch-flush_workqueue
deleted file mode 100644
index b5033b27a81f..000000000000
--- a/misc/dahdi-kmod/files/patch-flush_workqueue
+++ /dev/null
@@ -1,91 +0,0 @@
-Index: freebsd/include/dahdi/compat/bsd.h
-===================================================================
---- freebsd/include/dahdi/compat/bsd.h (revision 10598)
-+++ freebsd/include/dahdi/compat/bsd.h (working copy)
-@@ -330,6 +330,7 @@
-
- struct workqueue_struct *create_singlethread_workqueue(const char *name);
- void destroy_workqueue(struct workqueue_struct *wq);
-+void flush_workqueue(struct workqueue_struct *wq);
- void queue_work(struct workqueue_struct *wq, struct work_struct *work);
-
- /*
-Index: freebsd/freebsd/dahdi/bsd-compat.c
-===================================================================
---- freebsd/freebsd/dahdi/bsd-compat.c (revision 10598)
-+++ freebsd/freebsd/dahdi/bsd-compat.c (working copy)
-@@ -33,6 +33,8 @@
- #include <sys/bus.h>
- #include <sys/callout.h>
- #include <sys/firmware.h>
-+#include <sys/param.h>
-+#include <sys/proc.h>
- #include <sys/syscallsubr.h>
- #include <sys/systm.h>
- #include <sys/taskqueue.h>
-@@ -324,7 +326,31 @@
- free(wq, M_DAHDI);
- }
-
-+static void
-+_flush_workqueue_fn(void *context, int pending)
-+{
-+ /* nothing to do */
-+}
-+
-+static void
-+_flush_taskqueue(struct taskqueue **tq)
-+{
-+ struct task flushtask;
-+
-+ PHOLD(curproc);
-+ TASK_INIT(&flushtask, 0, _flush_workqueue_fn, NULL);
-+ taskqueue_enqueue_fast(*tq, &flushtask);
-+ taskqueue_drain(*tq, &flushtask);
-+ PRELE(curproc);
-+}
-+
- void
-+flush_workqueue(struct workqueue_struct *wq)
-+{
-+ _flush_taskqueue(&wq->tq);
-+}
-+
-+void
- queue_work(struct workqueue_struct *wq, struct work_struct *work)
- {
- work->tq = wq->tq;
-Index: freebsd/drivers/dahdi/wcte12xp/base.c
-===================================================================
---- freebsd/drivers/dahdi/wcte12xp/base.c (revision 10598)
-+++ freebsd/drivers/dahdi/wcte12xp/base.c (working copy)
-@@ -2441,13 +2441,11 @@
- clear_bit(INITIALIZED, &wc->bit_flags);
-
- del_timer_sync(&wc->timer);
--#if !defined(__FreeBSD__)
- flush_workqueue(wc->wq);
- #ifdef VPM_SUPPORT
- if (vpm)
- flush_workqueue(vpm->wq);
- #endif
--#endif
-
- voicebus_release(&wc->vb);
-
-Index: freebsd/drivers/dahdi/wctdm24xxp/xhfc.c
-===================================================================
---- freebsd/drivers/dahdi/wctdm24xxp/xhfc.c (revision 10598)
-+++ freebsd/drivers/dahdi/wctdm24xxp/xhfc.c (working copy)
-@@ -2129,11 +2129,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
- }
- }
- }
diff --git a/misc/dahdi-kmod/files/patch-freebsd-drivers-dahdi-dahdi-base.c b/misc/dahdi-kmod/files/patch-freebsd-drivers-dahdi-dahdi-base.c
deleted file mode 100644
index feebe1d03720..000000000000
--- a/misc/dahdi-kmod/files/patch-freebsd-drivers-dahdi-dahdi-base.c
+++ /dev/null
@@ -1,45 +0,0 @@
---- freebsd/drivers/dahdi/dahdi-base.c.orig 2021-11-09 20:52:37 UTC
-+++ freebsd/drivers/dahdi/dahdi-base.c
-@@ -48,6 +48,7 @@
- #include <sys/module.h>
- #include <sys/poll.h>
- #include <net/ppp_defs.h>
-+#include <sys/eventhandler.h>
-
- #include "version.h"
-
-@@ -4344,8 +4345,7 @@ static int dahdi_common_ioctl(struct file *file, unsig
- if (spans[i]->manufacturer)
- dahdi_copy_string(stack.spaninfo.manufacturer, spans[i]->manufacturer,
- sizeof(stack.spaninfo.manufacturer));
-- if (spans[i]->devicetype)
-- dahdi_copy_string(stack.spaninfo.devicetype, spans[i]->devicetype, sizeof(stack.spaninfo.devicetype));
-+ dahdi_copy_string(stack.spaninfo.devicetype, spans[i]->devicetype, sizeof(stack.spaninfo.devicetype));
- dahdi_copy_string(stack.spaninfo.location, spans[i]->location, sizeof(stack.spaninfo.location));
- if (spans[i]->spantype)
- dahdi_copy_string(stack.spaninfo.spantype, spans[i]->spantype, sizeof(stack.spaninfo.spantype));
-@@ -4406,10 +4406,9 @@ static int dahdi_common_ioctl(struct file *file, unsig
- dahdi_copy_string(stack.spaninfo_v1.manufacturer,
- spans[i]->manufacturer,
- sizeof(stack.spaninfo_v1.manufacturer));
-- if (spans[i]->devicetype)
-- dahdi_copy_string(stack.spaninfo_v1.devicetype,
-- spans[i]->devicetype,
-- sizeof(stack.spaninfo_v1.devicetype));
-+ dahdi_copy_string(stack.spaninfo_v1.devicetype,
-+ spans[i]->devicetype,
-+ sizeof(stack.spaninfo_v1.devicetype));
- dahdi_copy_string(stack.spaninfo_v1.location,
- spans[i]->location,
- sizeof(stack.spaninfo_v1.location));
-@@ -9263,7 +9262,9 @@ static struct cdevsw dahdi_devsw = {
- .d_poll = dahdi_device_poll,
- .d_mmap = dahdi_device_mmap,
- .d_name = "dahdi",
--#if __FreeBSD_version >= 800039
-+#if __FreeBSD_version >= 1000000
-+ .d_flags = D_TRACKCLOSE | D_NEEDMINOR,
-+#elif __FreeBSD_version >= 800039
- .d_flags = D_PSEUDO | D_TRACKCLOSE | D_NEEDMINOR
- #else
- .d_flags = D_PSEUDO | D_TRACKCLOSE
diff --git a/misc/dahdi-kmod/files/patch-freebsd-drivers-dahdi-dahdi_dynamic_ethmf.c b/misc/dahdi-kmod/files/patch-freebsd-drivers-dahdi-dahdi_dynamic_ethmf.c
deleted file mode 100644
index 9dac4c1c0a08..000000000000
--- a/misc/dahdi-kmod/files/patch-freebsd-drivers-dahdi-dahdi_dynamic_ethmf.c
+++ /dev/null
@@ -1,11 +0,0 @@
---- freebsd/drivers/dahdi/dahdi_dynamic_ethmf.c.orig 2010-09-02 01:11:41.000000000 +0700
-+++ freebsd/drivers/dahdi/dahdi_dynamic_ethmf.c 2015-03-22 00:52:55.655191000 +0600
-@@ -689,7 +690,7 @@
- kfree(z);
- module_put(THIS_MODULE);
- } else {
-- if (z && z->span && z->span->name) {
-+ if (z && z->span) {
- printk(KERN_ERR "Cannot find interface for %s\n",
- z->span->name);
- }
diff --git a/misc/dahdi-kmod/files/patch-freebsd-drivers-dahdi-wctc4xxp-base.c b/misc/dahdi-kmod/files/patch-freebsd-drivers-dahdi-wctc4xxp-base.c
deleted file mode 100644
index 7abe29f17e0f..000000000000
--- a/misc/dahdi-kmod/files/patch-freebsd-drivers-dahdi-wctc4xxp-base.c
+++ /dev/null
@@ -1,55 +0,0 @@
---- freebsd/drivers/dahdi/wctc4xxp/base.c.orig 2013-10-31 18:14:10.000000000 +0700
-+++ freebsd/drivers/dahdi/wctc4xxp/base.c 2013-10-31 18:23:01.000000000 +0700
-@@ -2456,9 +2456,9 @@
-
- if (unlikely(count > SFRAME_SIZE - sizeof(struct rtp_packet))) {
- DTE_DEBUG(DTE_DEBUG_GENERAL,
-- "Cannot transcode packet of %Zu bytes. This exceeds the " \
-- "maximum size of %Zu bytes.\n", count,
-+ "Cannot transcode packet of %zu bytes. This exceeds the " \
-+ "maximum size of %zu bytes.\n", count,
- SFRAME_SIZE - sizeof(struct rtp_packet));
- return -EINVAL;
- }
-
-@@ -2466,8 +2466,8 @@
- if ((G723_5K_BYTES != count) && (G723_6K_BYTES != count)) {
- DTE_DEBUG(DTE_DEBUG_GENERAL,
- "Trying to transcode packet into G723 format " \
-- "that is %Zu bytes instead of the expected " \
-+ "that is %zu bytes instead of the expected " \
- "%d/%d bytes.\n", count, G723_5K_BYTES,
- G723_6K_BYTES);
- return -EINVAL;
- }
-@@ -2496,7 +2496,7 @@
- cpvt->seqno += 1;
-
- DTE_DEBUG(DTE_DEBUG_RTP_TX,
-- "Sending packet of %Zu byte on channel (%p).\n", count, dtc);
-+ "Sending packet of %zu byte on channel (%p).\n", count, dtc);
-
- atomic_inc(&cpvt->stats.packets_sent);
- wctc4xxp_transmit_cmd(wc, cmd);
-@@ -3355,10 +3355,6 @@
- complicated = temp;
- }
-
-- DTE_DEBUG(DTE_DEBUG_CHANNEL_SETUP,
-- "DTE is using the following channels encoder_channel: " \
-- "%d decoder_channel: %d\n", encoder_channel, decoder_channel);
--
- BUG_ON(encoder_timeslot/2 >= wc->numchannels);
- BUG_ON(decoder_timeslot/2 >= wc->numchannels);
- encoder_pvt = wc->uencode->channels[encoder_timeslot/2].pvt;
-@@ -3377,6 +3373,10 @@
- &decoder_channel))
- goto error_exit;
-
-+ DTE_DEBUG(DTE_DEBUG_CHANNEL_SETUP,
-+ "DTE is using the following channels encoder_channel: " \
-+ "%d decoder_channel: %d\n", encoder_channel, decoder_channel);
-+
- length = (DTE_FORMAT_G729A == complicated) ? G729_LENGTH :
- (DTE_FORMAT_G723_1 == complicated) ? G723_LENGTH : 0;
-
diff --git a/misc/dahdi-kmod/files/patch-freebsd-drivers-dahdi-wcte12xp-base.c b/misc/dahdi-kmod/files/patch-freebsd-drivers-dahdi-wcte12xp-base.c
deleted file mode 100644
index 75ae08cde6b9..000000000000
--- a/misc/dahdi-kmod/files/patch-freebsd-drivers-dahdi-wcte12xp-base.c
+++ /dev/null
@@ -1,14 +0,0 @@
---- freebsd/drivers/dahdi/wcte12xp/base.c.orig 2010-09-02 16:16:05.000000000 +0700
-+++ freebsd/drivers/dahdi/wcte12xp/base.c 2013-10-31 18:13:29.000000000 +0700
-@@ -1626,7 +1626,11 @@
-
- t4_serial_setup(wc);
-
-+#if defined(__FreeBSD__)
-+ num = device_get_unit(pdev->dev) + 1;
-+#else
- num = x;
-+#endif
- sprintf(wc->span.name, "WCT1/%d", num);
- snprintf(wc->span.desc, sizeof(wc->span.desc) - 1, "%s Card %d", wc->variety, num);
- wc->span.manufacturer = "Digium";
diff --git a/misc/dahdi-kmod/files/patch-freebsd-freebsd-dahdi-Makefile b/misc/dahdi-kmod/files/patch-freebsd-freebsd-dahdi-Makefile
deleted file mode 100644
index 69250ba41d57..000000000000
--- a/misc/dahdi-kmod/files/patch-freebsd-freebsd-dahdi-Makefile
+++ /dev/null
@@ -1,14 +0,0 @@
---- freebsd/freebsd/dahdi/Makefile.orig 2011-04-19 00:31:03.000000000 +0700
-+++ freebsd/freebsd/dahdi/Makefile 2011-04-19 00:31:29.000000000 +0700
-@@ -14,11 +14,5 @@
- @if ! cmp -s ${.TARGET}.tmp ${.TARGET}; then echo "Updating ${.TARGET}"; mv ${.TARGET}.tmp ${.TARGET}; fi
- @rm -f ${.TARGET}.tmp
-
--afterinstall:
-- ${MKDIR} ${PREFIX}/include/dahdi/compat
--.for _h in ${INCS}
-- ${INSTALL_DATA} ${INCLUDEDIR}/dahdi/${_h} ${PREFIX}/include/dahdi/${_h:H}
--.endfor
--
- .include <bsd.kmod.mk>
- .include <bsd.own.mk>
diff --git a/misc/dahdi-kmod/files/patch-freebsd-freebsd-dahdi-bsd-compat.c b/misc/dahdi-kmod/files/patch-freebsd-freebsd-dahdi-bsd-compat.c
deleted file mode 100644
index 0a960c9451b4..000000000000
--- a/misc/dahdi-kmod/files/patch-freebsd-freebsd-dahdi-bsd-compat.c
+++ /dev/null
@@ -1,14 +0,0 @@
---- freebsd/freebsd/dahdi/bsd-compat.c.orig 2014-09-13 19:10:00.000000000 +0700
-+++ freebsd/freebsd/dahdi/bsd-compat.c 2014-09-13 19:10:59.000000000 +0700
-@@ -45,7 +45,11 @@
-
- #include <dahdi/compat/bsd.h>
-
-+#if __FreeBSD_version >= 1100024
-+SYSCTL_ROOT_NODE(OID_AUTO, dahdi, CTLFLAG_RW, 0, "DAHDI");
-+#else
- SYSCTL_NODE(, OID_AUTO, dahdi, CTLFLAG_RW, 0, "DAHDI");
-+#endif
- SYSCTL_NODE(_dahdi, OID_AUTO, echocan, CTLFLAG_RW, 0, "DAHDI Echo Cancelers");
-
- /*
diff --git a/misc/dahdi-kmod/files/patch-freebsd-freebsd-dahdi-ng_dahdi_iface.c b/misc/dahdi-kmod/files/patch-freebsd-freebsd-dahdi-ng_dahdi_iface.c
deleted file mode 100644
index 108c0eb9caf8..000000000000
--- a/misc/dahdi-kmod/files/patch-freebsd-freebsd-dahdi-ng_dahdi_iface.c
+++ /dev/null
@@ -1,17 +0,0 @@
---- freebsd/freebsd/dahdi/ng_dahdi_iface.c (revision 10746)
-+++ freebsd/freebsd/dahdi/ng_dahdi_iface.c (revision 10747)
-@@ -281,10 +281,14 @@
- /* connect other hooks */
- dahdi_iface_connect_node_path(node, DAHDI_IFACE_HOOK_UPPER,
- NG_CISCO_HOOK_INET, NG_CISCO_HOOK_INET6, NG_IFACE_HOOK_INET6);
-+#if __FreeBSD_version < 1100013
- dahdi_iface_connect_node_path(node, DAHDI_IFACE_HOOK_UPPER,
- NG_CISCO_HOOK_INET, NG_CISCO_HOOK_APPLETALK, NG_IFACE_HOOK_ATALK);
-+#endif
-+#if __FreeBSD_version < 1100012
- dahdi_iface_connect_node_path(node, DAHDI_IFACE_HOOK_UPPER,
- NG_CISCO_HOOK_INET, NG_CISCO_HOOK_IPX, NG_IFACE_HOOK_IPX);
-+#endif
-
- /* get iface name */
- NG_MKMESSAGE(msg, NGM_IFACE_COOKIE, NGM_IFACE_GET_IFNAME, 0, M_WAITOK);
diff --git a/misc/dahdi-kmod/files/patch-freebsd-include-dahdi-compat-bsd.h b/misc/dahdi-kmod/files/patch-freebsd-include-dahdi-compat-bsd.h
deleted file mode 100644
index 3038b1f9a6ef..000000000000
--- a/misc/dahdi-kmod/files/patch-freebsd-include-dahdi-compat-bsd.h
+++ /dev/null
@@ -1,34 +0,0 @@
---- freebsd/include/dahdi/compat/bsd.h.orig 2016-03-11 06:59:31.516533000 +0000
-+++ freebsd/include/dahdi/compat/bsd.h 2016-03-11 07:05:34.327218000 +0000
-@@ -45,6 +45,10 @@
- #include <machine/atomic.h>
- #include <machine/bus.h>
-
-+#if __FreeBSD_version >= 1100101
-+#define taskqueue_enqueue_fast(queue, task) taskqueue_enqueue(queue, task)
-+#endif
-+
- #define D_VERSION_LINEAR (((D_VERSION & 0xffff) << 16) | (((D_VERSION >> 16) & 0xff) << 8) | ((D_VERSION >> 24) & 0xff))
-
- #define LINUX_VERSION_CODE KERNEL_VERSION(2, 6, 32)
-@@ -66,9 +70,11 @@
- #define __be32 u_int32_t
-
- #if _BYTE_ORDER == _LITTLE_ENDIAN
-+#define __LITTLE_ENDIAN
- #define __LITTLE_ENDIAN_BITFIELD
- #define __constant_htons(x) ((uint16_t) (((uint16_t) (x)) << 8 | ((uint16_t) (x)) >> 8))
- #elif _BYTE_ORDER == _BIG_ENDIAN
-+#define __BIG_ENDIAN
- #define __BIG_ENDIAN_BITFIELD
- #define __constant_htons(x) (x)
- #endif
-@@ -454,7 +460,7 @@
- #define _module_ptr_args __CONCAT(_module_ptr_args_, __LINE__)
- #define _module_ptr_init(field, val) \
- static struct module_ptr_args _module_ptr_args = { \
-- (const void **) &(THIS_MODULE->field), val \
-+ (const void **) (uintptr_t) &(THIS_MODULE->field), val \
- }; \
- SYSINIT(__CONCAT(_module_ptr_args, _init), \
- SI_SUB_KLD, SI_ORDER_FIRST, \
diff --git a/misc/dahdi-kmod/files/patch-freebsd-include-stdbool.h b/misc/dahdi-kmod/files/patch-freebsd-include-stdbool.h
deleted file mode 100644
index 01de10205263..000000000000
--- a/misc/dahdi-kmod/files/patch-freebsd-include-stdbool.h
+++ /dev/null
@@ -1,20 +0,0 @@
-Index: freebsd/include/stdbool.h
-===================================================================
---- freebsd/include/stdbool.h.orig (revision 10467)
-+++ freebsd/include/stdbool.h (revision 10468)
-@@ -1,11 +1,15 @@
- #ifndef _STDBOOL_H_
- #define _STDBOOL_H_
-
-+#include <sys/types.h>
-+
-+#ifndef __bool_true_false_are_defined
- typedef int bool;
-
- enum {
- false,
- true
- };
-+#endif
-
- #endif /* _STDBOOL_H_ */
diff --git a/misc/dahdi-kmod/files/patch-freebsd__freebsd__Makefile.inc b/misc/dahdi-kmod/files/patch-freebsd__freebsd__Makefile.inc
deleted file mode 100644
index 824581e6322e..000000000000
--- a/misc/dahdi-kmod/files/patch-freebsd__freebsd__Makefile.inc
+++ /dev/null
@@ -1,8 +0,0 @@
---- freebsd/freebsd/Makefile.inc.orig 2010-09-01 08:54:06.000000000 +0200
-+++ freebsd/freebsd/Makefile.inc 2014-01-26 19:12:09.000000000 +0100
-@@ -19,4 +19,4 @@
- TOUCH?= touch
-
- beforeinstall:
-- ${MKDIR} ${KMODDIR}
-+ ${MKDIR} ${DESTDIR}${KMODDIR}
diff --git a/misc/dahdi-kmod/files/patch-include_dahdi_compat_bsd.h b/misc/dahdi-kmod/files/patch-include_dahdi_compat_bsd.h
deleted file mode 100644
index cfbfa5706e38..000000000000
--- a/misc/dahdi-kmod/files/patch-include_dahdi_compat_bsd.h
+++ /dev/null
@@ -1,11 +0,0 @@
---- freebsd/include/dahdi/compat/bsd.h.orig 2010-09-02 09:16:05 UTC
-+++ freebsd/include/dahdi/compat/bsd.h
-@@ -218,7 +218,7 @@ typedef struct sx rwlock_t;
- #define DEFINE_RWLOCK(name) \
- struct sx name; \
- SX_SYSINIT(name, &name, #name)
--#define rwlock_init(rwlock) sx_init_flags(rwlock, "DAHDI rwlock", SX_NOADAPTIVE)
-+#define rwlock_init(rwlock) sx_init(rwlock, "DAHDI rwlock")
- #define read_lock(rwlock) sx_slock(rwlock)
- #define read_unlock(rwlock) sx_sunlock(rwlock)
-
diff --git a/misc/dahdi-kmod/files/patch-ithread b/misc/dahdi-kmod/files/patch-ithread
deleted file mode 100644
index 590adc1d19c9..000000000000
--- a/misc/dahdi-kmod/files/patch-ithread
+++ /dev/null
@@ -1,26 +0,0 @@
-Index: freebsd/drivers/dahdi/wct4xxp/base.c
-===================================================================
---- freebsd/drivers/dahdi/wct4xxp/base.c (revision 10453)
-+++ freebsd/drivers/dahdi/wct4xxp/base.c (working copy)
-@@ -4132,7 +4132,7 @@
- #endif
- if (unlikely(test_bit(T4_CHANGE_LATENCY, &wc->checkflag) || test_bit(T4_CHECK_VPM, &wc->checkflag))) {
- #if defined(__FreeBSD__)
-- res |= FILTER_SCHEDULE_THREAD;
-+ res = FILTER_SCHEDULE_THREAD;
- #else
- tasklet_schedule(&wc->t4_tlet);
- #endif
-Index: freebsd/drivers/dahdi/wctc4xxp/base.c
-===================================================================
---- freebsd/drivers/dahdi/wctc4xxp/base.c (revision 10453)
-+++ freebsd/drivers/dahdi/wctc4xxp/base.c (working copy)
-@@ -2931,7 +2931,7 @@
- #if DEFERRED_PROCESSING == WORKQUEUE
- schedule_work(&wc->deferred_work);
- #elif DEFERRED_PROCESSING == ITHREAD
-- res |= FILTER_SCHEDULE_THREAD;
-+ res = FILTER_SCHEDULE_THREAD;
- #elif DEFERRED_PROCESSING == INTERRUPT
- #error "You will need to change the locks if you want to run the processing " \
- "in the interrupt handler."
diff --git a/misc/dahdi-kmod/files/patch-mbuf b/misc/dahdi-kmod/files/patch-mbuf
deleted file mode 100644
index a991b7b9577a..000000000000
--- a/misc/dahdi-kmod/files/patch-mbuf
+++ /dev/null
@@ -1,49 +0,0 @@
---- freebsd/drivers/dahdi/dahdi_dynamic_eth.c.orig 2014-02-09 12:58:15.000000000 +0700
-+++ freebsd/drivers/dahdi/dahdi_dynamic_eth.c 2014-02-09 12:58:57.000000000 +0700
-@@ -27,6 +27,7 @@
- #include <sys/param.h>
- #include <sys/conf.h>
- #include <sys/module.h>
-+#include <sys/mbuf.h>
-
- #include "ng_dahdi_netdev.h"
- #else /* !__FreeBSD__ */
-@@ -204,10 +205,10 @@
- dev = z->dev;
- spin_unlock_irqrestore(&zlock, flags);
- #if defined(__FreeBSD__)
-- MGETHDR(m, M_DONTWAIT, MT_DATA);
-+ MGETHDR(m, M_NOWAIT, MT_DATA);
- if (m != NULL) {
- if (sizeof(eh) + sizeof(zh) + msglen >= MINCLSIZE) {
-- MCLGET(m, M_DONTWAIT);
-+ MCLGET(m, M_NOWAIT);
- }
-
- /* copy ethernet header */
---- freebsd/drivers/dahdi/dahdi_dynamic_ethmf.c.orig 2014-02-09 12:59:17.000000000 +0700
-+++ freebsd/drivers/dahdi/dahdi_dynamic_ethmf.c 2014-02-09 12:59:47.000000000 +0700
-@@ -28,6 +28,7 @@
- #include <sys/param.h>
- #include <sys/conf.h>
- #include <sys/module.h>
-+#include <sys/mbuf.h>
-
- #include "ng_dahdi_netdev.h"
- #else /* !__FreeBSD__ */
-@@ -522,13 +523,13 @@
- }
-
- #if defined(__FreeBSD__)
-- MGETHDR(m, M_DONTWAIT, MT_DATA);
-+ MGETHDR(m, M_NOWAIT, MT_DATA);
- if (m == NULL) {
- rcu_read_unlock();
- ethmf_errors_inc();
- return 0;
- }
-- MCLGET(m, M_DONTWAIT);
-+ MCLGET(m, M_NOWAIT);
-
- /* copy ethernet header and reserve space for ztdeth header */
- bcopy(dev->dev_addr, &eh.ether_shost, sizeof(eh.ether_shost));
diff --git a/misc/dahdi-kmod/files/patch-oslec b/misc/dahdi-kmod/files/patch-oslec
deleted file mode 100644
index 56eb68b89584..000000000000
--- a/misc/dahdi-kmod/files/patch-oslec
+++ /dev/null
@@ -1,29 +0,0 @@
-diff -ru freebsd/drivers/staging/echo/echo.c.orig freebsd/drivers/staging/echo/echo.c.orig
---- freebsd/drivers/staging/echo/echo.c.orig 2010-08-27 06:47:12.000000000 +0700
-+++ freebsd/drivers/staging/echo/echo.c 2010-08-31 14:45:48.000000000 +0700
-@@ -102,9 +102,15 @@
- Mark, Pawel, and Pavel.
- */
-
-+#if defined(__FreeBSD__)
-+#include <sys/types.h>
-+#include <sys/libkern.h>
-+#include <dahdi/compat/bsd.h>
-+#else
- #include <linux/kernel.h>
- #include <linux/module.h>
- #include <linux/slab.h>
-+#endif /* !__FreeBSD__ */
-
- #include "echo.h"
-
-@@ -656,7 +662,9 @@
- }
- EXPORT_SYMBOL_GPL(oslec_hpf_tx);
-
-+#if !defined(__FreeBSD__)
- MODULE_LICENSE("GPL");
- MODULE_AUTHOR("David Rowe");
- MODULE_DESCRIPTION("Open Source Line Echo Canceller");
- MODULE_VERSION("0.3.0");
-+#endif /* !__FreeBSD__ */
diff --git a/misc/dahdi-kmod/files/patch-zaphfc b/misc/dahdi-kmod/files/patch-zaphfc
deleted file mode 100644
index fd8b72d1bca2..000000000000
--- a/misc/dahdi-kmod/files/patch-zaphfc
+++ /dev/null
@@ -1,883 +0,0 @@
-diff -ruN freebsd/drivers/dahdi/zaphfc.orig/base.c freebsd/drivers/dahdi/zaphfc/base.c
---- freebsd/drivers/dahdi/zaphfc.orig/base.c 2010-09-01 00:55:30.000000000 +0700
-+++ freebsd/drivers/dahdi/zaphfc/base.c 2010-09-02 19:19:45.000000000 +0700
-@@ -23,6 +23,50 @@
- * Please read the README file for important infos.
- */
-
-+#if defined(__FreeBSD__)
-+#include <sys/types.h>
-+#include <sys/bus.h>
-+#include <sys/module.h>
-+#include <dev/pci/pcireg.h>
-+#include <dev/pci/pcivar.h>
-+
-+#define PCI_VENDOR_ID_CCD 0x1397
-+
-+#define PCI_DEVICE_ID_CCD_2BD0 0x2bd0
-+#define PCI_DEVICE_ID_CCD_B000 0xb000
-+#define PCI_DEVICE_ID_CCD_B006 0xb006
-+#define PCI_DEVICE_ID_CCD_B007 0xb007
-+#define PCI_DEVICE_ID_CCD_B008 0xb008
-+#define PCI_DEVICE_ID_CCD_B009 0xb009
-+#define PCI_DEVICE_ID_CCD_B00A 0xb00a
-+#define PCI_DEVICE_ID_CCD_B00B 0xb00b
-+#define PCI_DEVICE_ID_CCD_B00C 0xb00c
-+#define PCI_DEVICE_ID_CCD_B100 0xb100
-+
-+#define PCI_VENDOR_ID_ABOCOM 0x13D1
-+#define PCI_DEVICE_ID_ABOCOM_2BD1 0x2BD1
-+
-+#define PCI_VENDOR_ID_ANIGMA 0x1051
-+#define PCI_DEVICE_ID_ANIGMA_MC145575 0x0100
-+
-+#define PCI_VENDOR_ID_ASUSTEK 0x1043
-+#define PCI_DEVICE_ID_ASUSTEK_0675 0x0675
-+
-+#define PCI_VENDOR_ID_BERKOM 0x0871
-+#define PCI_DEVICE_ID_BERKOM_A1T 0xffa1
-+#define PCI_DEVICE_ID_BERKOM_T_CONCEPT 0xffa2
-+
-+#define PCI_VENDOR_ID_DIGI 0x114f
-+#define PCI_DEVICE_ID_DIGI_DF_M_IOM2_E 0x0070
-+#define PCI_DEVICE_ID_DIGI_DF_M_E 0x0071
-+#define PCI_DEVICE_ID_DIGI_DF_M_IOM2_A 0x0072
-+#define PCI_DEVICE_ID_DIGI_DF_M_A 0x0073
-+
-+#define PCI_VENDOR_ID_ZOLTRIX 0x15b0
-+#define PCI_DEVICE_ID_ZOLTRIX_2BD0 0x2bd0
-+
-+#define set_current_state(x)
-+#else /* !__FreeBSD__ */
- #include <linux/spinlock.h>
- #include <linux/init.h>
- #include <linux/pci.h>
-@@ -34,14 +78,13 @@
- #include <linux/delay.h>
- #include <linux/proc_fs.h>
- #include <linux/if_arp.h>
-+#endif /* !__FreeBSD__ */
-
- #include <dahdi/kernel.h>
-
- #include "zaphfc.h"
- #include "fifo.h"
-
--#if CONFIG_PCI
--
- #define DAHDI_B1 0
- #define DAHDI_B2 1
- #define DAHDI_D 2
-@@ -57,7 +100,9 @@
- static int nt_modes[hfc_MAX_BOARDS];
- static int nt_modes_count;
- static int force_l1_up;
-+#if !defined(__FreeBSD__)
- static struct proc_dir_entry *hfc_proc_zaphfc_dir;
-+#endif
-
- #ifdef DEBUG
- int debug_level;
-@@ -122,6 +167,31 @@
- {0,}
- };
-
-+#if defined(__FreeBSD__)
-+static void
-+hfc_release_resources(struct hfc_card *card)
-+{
-+ /* disconnect the interrupt handler */
-+ if (card->irq_handle != NULL) {
-+ bus_teardown_intr(card->pcidev->dev, card->irq_res, card->irq_handle);
-+ card->irq_handle = NULL;
-+ }
-+
-+ if (card->irq_res != NULL) {
-+ bus_release_resource(card->pcidev->dev, SYS_RES_IRQ, card->irq_rid, card->irq_res);
-+ card->irq_res = NULL;
-+ }
-+
-+ /* release DMA resources */
-+ dahdi_dma_free(&card->dma_tag, &card->dma_map, (void **) &card->fifos, &card->dma_addr);
-+
-+ /* release I/O range */
-+ if (card->mem_res != NULL) {
-+ bus_release_resource(card->pcidev->dev, SYS_RES_MEMORY, card->mem_rid, card->mem_res);
-+ card->mem_res = NULL;
-+ }
-+}
-+#else
- MODULE_DEVICE_TABLE(pci, hfc_pci_ids);
-
- static int __devinit hfc_probe(struct pci_dev *dev
-@@ -134,6 +204,7 @@
- .probe = hfc_probe,
- .remove = hfc_remove,
- };
-+#endif /* !__FreeBSD__ */
-
- /******************************************
- * HW routines
-@@ -418,7 +489,7 @@
-
- switch (chan->number) {
- case D:
-- if (chan->status != free &&
-+ if (chan->status != chan_free &&
- chan->status != open_framed) {
- spin_unlock(&chan->lock);
- return -EBUSY;
-@@ -428,7 +499,7 @@
-
- case B1:
- case B2:
-- if (chan->status != free) {
-+ if (chan->status != chan_free) {
- spin_unlock(&chan->lock);
- return -EBUSY;
- }
-@@ -437,7 +508,6 @@
- }
-
- chan->open_by_zaptel = TRUE;
-- try_module_get(THIS_MODULE);
- spin_unlock(&chan->lock);
-
- switch (chan->number) {
-@@ -484,7 +554,13 @@
- hfc_outb(card, hfc_SCTRL, card->regs.sctrl);
- hfc_outb(card, hfc_SCTRL_R, card->regs.sctrl_r);
-
-+#if defined(__FreeBSD__)
-+ bus_dmamap_sync(card->dma_tag, card->dma_map, BUS_DMASYNC_POSTREAD);
-+#endif
- hfc_update_fifo_state(card);
-+#if defined(__FreeBSD__)
-+ bus_dmamap_sync(card->dma_tag, card->dma_map, BUS_DMASYNC_PREWRITE);
-+#endif
-
- printk(KERN_INFO hfc_DRIVER_PREFIX
- "card %d: "
-@@ -509,12 +585,12 @@
-
- spin_lock(&chan->lock);
-
-- if (chan->status == free) {
-+ if (chan->status == chan_free) {
- spin_unlock(&chan->lock);
- return -EINVAL;
- }
-
-- chan->status = free;
-+ chan->status = chan_free;
- chan->open_by_zaptel = FALSE;
-
- spin_unlock(&chan->lock);
-@@ -538,8 +614,8 @@
- break;
- }
-
-- if (card->chans[B1].status == free &&
-- card->chans[B2].status == free)
-+ if (card->chans[B1].status == chan_free &&
-+ card->chans[B2].status == chan_free)
- card->regs.m2 &= ~hfc_M2_PROC_TRANS;
-
- hfc_outb(card, hfc_INT_M2, card->regs.m2);
-@@ -548,9 +624,13 @@
- hfc_outb(card, hfc_SCTRL, card->regs.sctrl);
- hfc_outb(card, hfc_SCTRL_R, card->regs.sctrl_r);
-
-+#if defined(__FreeBSD__)
-+ bus_dmamap_sync(card->dma_tag, card->dma_map, BUS_DMASYNC_POSTREAD);
-+#endif
- hfc_update_fifo_state(card);
--
-- module_put(THIS_MODULE);
-+#if defined(__FreeBSD__)
-+ bus_dmamap_sync(card->dma_tag, card->dma_map, BUS_DMASYNC_PREWRITE);
-+#endif
-
- printk(KERN_INFO hfc_DRIVER_PREFIX
- "card %d: "
-@@ -591,7 +671,7 @@
-
- static int hfc_zap_startup(struct dahdi_span *span)
- {
-- struct dahdi_hfc *zthfc = span->pvt;
-+ struct dahdi_hfc *zthfc = container_of(span, struct dahdi_hfc, span);
- struct hfc_card *hfctmp = zthfc->card;
- int alreadyrunning;
-
-@@ -642,6 +722,20 @@
- return 0;
- }
-
-+static const struct dahdi_span_ops hfc_zap_span_ops = {
-+ .owner = THIS_MODULE,
-+ .startup = hfc_zap_startup,
-+ .shutdown = hfc_zap_shutdown,
-+ .rbsbits = hfc_zap_rbsbits,
-+ .maint = hfc_zap_maint,
-+ .open = hfc_zap_open,
-+ .close = hfc_zap_close,
-+ .spanconfig = hfc_zap_spanconfig,
-+ .chanconfig = hfc_zap_chanconfig,
-+ .ioctl = hfc_zap_ioctl,
-+ .hdlc_hard_xmit = hfc_hdlc_hard_xmit,
-+};
-+
- static int hfc_zap_initialize(struct dahdi_hfc *hfccard)
- {
- struct hfc_card *hfctmp = hfccard->card;
-@@ -655,23 +749,14 @@
- hfctmp->nt_mode ? "NT" : "TE");
- hfccard->span.spantype = hfctmp->nt_mode ? "NT" : "TE";
- hfccard->span.manufacturer = "Cologne Chips";
-- hfccard->span.spanconfig = hfc_zap_spanconfig;
-- hfccard->span.chanconfig = hfc_zap_chanconfig;
-- hfccard->span.startup = hfc_zap_startup;
-- hfccard->span.shutdown = hfc_zap_shutdown;
-- hfccard->span.maint = hfc_zap_maint;
-- hfccard->span.rbsbits = hfc_zap_rbsbits;
-- hfccard->span.open = hfc_zap_open;
-- hfccard->span.close = hfc_zap_close;
-- hfccard->span.ioctl = hfc_zap_ioctl;
-- hfccard->span.hdlc_hard_xmit = hfc_hdlc_hard_xmit;
-+ hfccard->span.ops = &hfc_zap_span_ops;
- hfccard->span.flags = 0;
-- hfccard->span.irq = hfctmp->pcidev->irq;
-+ hfccard->span.irq = dahdi_pci_get_irq(hfctmp->pcidev);
- dahdi_copy_string(hfccard->span.devicetype, "HFC-S PCI-A ISDN",
- sizeof(hfccard->span.devicetype));
- sprintf(hfccard->span.location, "PCI Bus %02d Slot %02d",
-- hfctmp->pcidev->bus->number,
-- PCI_SLOT(hfctmp->pcidev->devfn) + 1);
-+ dahdi_pci_get_bus(hfctmp->pcidev),
-+ dahdi_pci_get_slot(hfctmp->pcidev));
- hfccard->span.chans = hfccard->_chans;
- hfccard->span.channels = 3;
- for (i = 0; i < hfccard->span.channels; i++)
-@@ -680,7 +765,6 @@
- hfccard->span.linecompat = DAHDI_CONFIG_AMI | DAHDI_CONFIG_CCS;
- hfccard->span.offset = 0;
- init_waitqueue_head(&hfccard->span.maintq);
-- hfccard->span.pvt = hfccard;
-
- for (i = 0; i < hfccard->span.channels; i++) {
- memset(&hfccard->chans[i], 0x0, sizeof(struct dahdi_chan));
-@@ -760,22 +844,20 @@
- static void hfc_frame_arrived(struct hfc_chan_duplex *chan);
- static void hfc_handle_voice(struct hfc_card *card);
-
--#if (KERNEL_VERSION(2, 6, 24) < LINUX_VERSION_CODE)
--static irqreturn_t hfc_interrupt(int irq, void *dev_id)
--#else
--static irqreturn_t hfc_interrupt(int irq, void *dev_id, struct pt_regs *regs)
--#endif
-+DAHDI_IRQ_HANDLER(hfc_interrupt)
- {
- struct hfc_card *card = dev_id;
- unsigned long flags;
- u8 status, s1, s2;
-
-+#if !defined(__FreeBSD__)
- if (!card) {
- printk(KERN_CRIT hfc_DRIVER_PREFIX
- "spurious interrupt (IRQ %d)\n",
- irq);
- return IRQ_NONE;
- }
-+#endif /* !__FreeBSD__ */
-
- spin_lock_irqsave(&card->lock, flags);
- status = hfc_inb(card, hfc_STATUS);
-@@ -832,21 +914,40 @@
- /*
- * D chan RX (bit 5)
- */
-+#if defined(__FreeBSD__)
-+ bus_dmamap_sync(card->dma_tag, card->dma_map, BUS_DMASYNC_POSTREAD);
-+#endif
- hfc_frame_arrived(&card->chans[D]);
-+
-+#if defined(__FreeBSD__)
-+ bus_dmamap_sync(card->dma_tag, card->dma_map, BUS_DMASYNC_PREWRITE);
-+#endif
- }
-
- if (s1 & hfc_INTS_B1REC) {
- /*
- * B1 chan RX (bit 3)
- */
-+#if defined(__FreeBSD__)
-+ bus_dmamap_sync(card->dma_tag, card->dma_map, BUS_DMASYNC_POSTREAD);
-+#endif
- hfc_frame_arrived(&card->chans[B1]);
-+#if defined(__FreeBSD__)
-+ bus_dmamap_sync(card->dma_tag, card->dma_map, BUS_DMASYNC_PREWRITE);
-+#endif
- }
-
- if (s1 & hfc_INTS_B2REC) {
- /*
- * B2 chan RX (bit 4)
- */
-+#if defined(__FreeBSD__)
-+ bus_dmamap_sync(card->dma_tag, card->dma_map, BUS_DMASYNC_POSTREAD);
-+#endif
- hfc_frame_arrived(&card->chans[B2]);
-+#if defined(__FreeBSD__)
-+ bus_dmamap_sync(card->dma_tag, card->dma_map, BUS_DMASYNC_PREWRITE);
-+#endif
- }
-
- if (s1 & hfc_INTS_DTRANS) {
-@@ -940,7 +1041,13 @@
- card->regs.ctmt &= ~hfc_CTMT_TIMER_MASK;
- hfc_outb(card, hfc_CTMT, card->regs.ctmt);
-
-+#if defined(__FreeBSD__)
-+ bus_dmamap_sync(card->dma_tag, card->dma_map, BUS_DMASYNC_POSTREAD);
-+#endif
- hfc_resume_fifo(card);
-+#if defined(__FreeBSD__)
-+ bus_dmamap_sync(card->dma_tag, card->dma_map, BUS_DMASYNC_PREWRITE);
-+#endif
- }
- }
-
-@@ -971,11 +1078,17 @@
- hfc_outb(card, hfc_STATES, hfc_STATES_LOAD_STATE | 3);
- }
-
-+#if defined(__FreeBSD__)
-+ bus_dmamap_sync(card->dma_tag, card->dma_map, BUS_DMASYNC_POSTREAD);
-+#endif
- if (new_state == 3 && card->l1_state != 3)
- hfc_resume_fifo(card);
-
- if (new_state != 3 && card->l1_state == 3)
- hfc_suspend_fifo(card);
-+#if defined(__FreeBSD__)
-+ bus_dmamap_sync(card->dma_tag, card->dma_map, BUS_DMASYNC_PREWRITE);
-+#endif
-
- } else {
- if (new_state == 3) {
-@@ -1015,7 +1128,13 @@
- /*
- * TE has become inactive, disable FIFO
- */
-+#if defined(__FreeBSD__)
-+ bus_dmamap_sync(card->dma_tag, card->dma_map, BUS_DMASYNC_POSTREAD);
-+#endif
- hfc_suspend_fifo(card);
-+#if defined(__FreeBSD__)
-+ bus_dmamap_sync(card->dma_tag, card->dma_map, BUS_DMASYNC_PREWRITE);
-+#endif
- }
- }
-
-@@ -1040,6 +1159,9 @@
- available_bytes >= DAHDI_CHUNKSIZE + hfc_RX_FIFO_PRELOAD) {
- card->ticks = 0;
-
-+#if defined(__FreeBSD__)
-+ bus_dmamap_sync(card->dma_tag, card->dma_map, BUS_DMASYNC_POSTREAD);
-+#endif
- if (available_bytes > DAHDI_CHUNKSIZE*2 + hfc_RX_FIFO_PRELOAD) {
- card->late_irqs++;
- /*
-@@ -1064,6 +1186,9 @@
- } else {
- hfc_handle_voice(card);
- }
-+#if defined(__FreeBSD__)
-+ bus_dmamap_sync(card->dma_tag, card->dma_map, BUS_DMASYNC_PREWRITE);
-+#endif
- }
-
- card->ticks++;
-@@ -1179,7 +1304,9 @@
- {
- struct hfc_card *card = chan->card;
- int antiloop = 16;
-+#if !defined(__FreeBSD__)
- struct sk_buff *skb;
-+#endif
-
- while (hfc_fifo_has_frames(&chan->rx) && --antiloop) {
- int frame_size = hfc_fifo_get_frame_size(&chan->rx);
-@@ -1229,6 +1356,7 @@
- break;
- }
-
-+#if !defined(__FreeBSD__)
- skb = dev_alloc_skb(frame_size - 3);
-
- if (!skb) {
-@@ -1254,6 +1382,7 @@
- #else
- skb->ip_summed = CHECKSUM_HW;
- #endif
-+#endif /* !__FreeBSD__ */
-
- if (chan->open_by_zaptel) {
- card->chans[D].rx.ugly_framebuf_size = frame_size - 1;
-@@ -1261,20 +1390,26 @@
- if (hfc_fifo_get_frame(&card->chans[D].rx,
- card->chans[D].rx.ugly_framebuf,
- frame_size - 1) == -1) {
-+#if !defined(__FreeBSD__)
- dev_kfree_skb(skb);
-+#endif
- continue;
- }
-
-+#if !defined(__FreeBSD__)
- memcpy(skb_put(skb, frame_size - 3),
- card->chans[D].rx.ugly_framebuf,
- frame_size - 3);
-+#endif
- } else {
-+#if !defined(__FreeBSD__)
- if (hfc_fifo_get_frame(&chan->rx,
- skb_put(skb, frame_size - 3),
- frame_size - 3) == -1) {
- dev_kfree_skb(skb);
- continue;
- }
-+#endif
- }
- }
-
-@@ -1289,8 +1424,12 @@
- * Module initialization and cleanup
- ******************************************/
-
-+#if defined(__FreeBSD__)
-+static int hfc_probe(device_t dev)
-+#else
- static int __devinit hfc_probe(struct pci_dev *pci_dev,
- const struct pci_device_id *ent)
-+#endif
- {
- static int cardnum;
- int err;
-@@ -1298,6 +1437,12 @@
-
- struct hfc_card *card = NULL;
- struct dahdi_hfc *zthfc = NULL;
-+
-+#if defined(__FreeBSD__)
-+ card = device_get_softc(dev);
-+ card->pcidev = &card->_dev;
-+ card->pcidev->dev = dev;
-+#else
- card = kmalloc(sizeof(struct hfc_card), GFP_KERNEL);
- if (!card) {
- printk(KERN_CRIT hfc_DRIVER_PREFIX
-@@ -1307,10 +1452,48 @@
- }
-
- memset(card, 0x00, sizeof(struct hfc_card));
-- card->cardnum = cardnum;
- card->pcidev = pci_dev;
-+#endif /* !__FreeBSD__ */
-+ card->cardnum = cardnum;
- spin_lock_init(&card->lock);
-
-+#if defined(__FreeBSD__)
-+ /* allocate IO resource */
-+ card->mem_rid = PCIR_BAR(1);
-+ card->mem_res = bus_alloc_resource_any(card->pcidev->dev, SYS_RES_MEMORY, &card->mem_rid, RF_ACTIVE);
-+ if (card->mem_res == NULL) {
-+ device_printf(dev, "Can't allocate memory resource\n");
-+ err = -ENXIO;
-+ goto err_pci_request_regions;
-+ }
-+
-+ /* enable bus mastering */
-+ pci_enable_busmaster(dev);
-+
-+ /* allocate DMA memory */
-+ err = dahdi_dma_allocate(card->pcidev->dev, hfc_FIFO_SIZE, &card->dma_tag, &card->dma_map,
-+ (void **) &card->fifos, &card->dma_addr);
-+ if (err)
-+ goto err_alloc_fifo;
-+
-+ /* setup interrupt */
-+ card->irq_res = bus_alloc_resource_any(
-+ card->pcidev->dev, SYS_RES_IRQ, &card->irq_rid, RF_SHAREABLE | RF_ACTIVE);
-+ if (card->irq_res == NULL) {
-+ device_printf(card->pcidev->dev, "Can't allocate irq resource\n");
-+ err = -ENXIO;
-+ goto err_request_irq;
-+ }
-+
-+ err = bus_setup_intr(
-+ card->pcidev->dev, card->irq_res, INTR_TYPE_CLK | INTR_MPSAFE,
-+ hfc_interrupt, NULL, card, &card->irq_handle);
-+ if (err) {
-+ device_printf(card->pcidev->dev, "Can't setup interrupt handler (error %d)\n", err);
-+ err = -ENXIO;
-+ goto err_request_irq;
-+ }
-+#else
- pci_set_drvdata(pci_dev, card);
-
- err = pci_enable_device(pci_dev);
-@@ -1403,6 +1586,7 @@
- card->cardnum);
- goto err_request_irq;
- }
-+#endif /* !__FreeBSD__ */
-
- card->nt_mode = FALSE;
-
-@@ -1419,7 +1603,7 @@
- */
- card->chans[D].card = card;
- card->chans[D].name = "D";
-- card->chans[D].status = free;
-+ card->chans[D].status = chan_free;
- card->chans[D].number = D;
- spin_lock_init(&card->chans[D].lock);
-
-@@ -1460,7 +1644,7 @@
- */
- card->chans[B1].card = card;
- card->chans[B1].name = "B1";
-- card->chans[B1].status = free;
-+ card->chans[B1].status = chan_free;
- card->chans[B1].number = B1;
- card->chans[B1].protocol = 0;
- spin_lock_init(&card->chans[B1].lock);
-@@ -1502,7 +1686,7 @@
- */
- card->chans[B2].card = card;
- card->chans[B2].name = "B2";
-- card->chans[B2].status = free;
-+ card->chans[B2].status = chan_free;
- card->chans[B2].number = B2;
- card->chans[B2].protocol = 0;
- spin_lock_init(&card->chans[B2].lock);
-@@ -1555,14 +1739,17 @@
- hfc_zap_initialize(zthfc);
- card->ztdev = zthfc;
-
-+#if !defined(__FreeBSD__)
- snprintf(card->proc_dir_name,
- sizeof(card->proc_dir_name),
- "%d", card->cardnum);
- card->proc_dir = proc_mkdir(card->proc_dir_name, hfc_proc_zaphfc_dir);
- SET_PROC_DIRENTRY_OWNER(card->proc_dir);
-+#endif /* !__FreeBSD__ */
-
- hfc_resetCard(card);
-
-+#if !defined(__FreeBSD__)
- printk(KERN_INFO hfc_DRIVER_PREFIX
- "card %d configured for %s mode at mem %#lx (0x%p) IRQ %u\n",
- card->cardnum,
-@@ -1570,28 +1757,106 @@
- card->io_bus_mem,
- card->io_mem,
- card->pcidev->irq);
-+#endif /* !__FreeBSD__ */
-
- cardnum++;
-
- return 0;
-
- err_request_irq:
-+#if !defined(__FreeBSD__)
- pci_free_consistent(pci_dev, hfc_FIFO_SIZE,
- card->fifo_mem, card->fifo_bus_mem);
-+#endif
- err_alloc_fifo:
-+#if !defined(__FreeBSD__)
- iounmap(card->io_mem);
- err_ioremap:
- err_noiobase:
- err_noirq:
- pci_release_regions(pci_dev);
-+#endif
- err_pci_request_regions:
-+#if defined(__FreeBSD__)
-+ hfc_release_resources(card);
-+#else
- err_pci_set_dma_mask:
- err_pci_enable_device:
- kfree(card);
- err_alloc_hfccard:
-+#endif
- return err;
- }
-
-+#if defined(__FreeBSD__)
-+SYSCTL_NODE(_dahdi, OID_AUTO, wcb1xxp, CTLFLAG_RW, 0, "DAHDI wcb1xxp");
-+#define MODULE_PARAM_PREFIX "dahdi.wcb1xxp"
-+#define MODULE_PARAM_PARENT _dahdi_wcb1xxp
-+
-+static int
-+wcb1xxp_device_probe(device_t dev)
-+{
-+ struct pci_device_id *id;
-+
-+ id = dahdi_pci_device_id_lookup(dev, hfc_pci_ids);
-+ if (id == NULL)
-+ return (ENXIO);
-+
-+ /* found device */
-+ device_printf(dev, "vendor=%x device=%x subvendor=%x\n",
-+ id->vendor, id->device, id->subvendor);
-+ device_set_desc(dev, "CCD HFC-S");
-+ return (0);
-+}
-+
-+static int
-+wcb1xxp_device_attach(device_t dev)
-+{
-+ int res;
-+ struct pci_device_id *id;
-+
-+ id = dahdi_pci_device_id_lookup(dev, hfc_pci_ids);
-+ if (id == NULL)
-+ return (ENXIO);
-+
-+ res = hfc_probe(dev);
-+ return (-res);
-+}
-+
-+static int
-+wcb1xxp_device_detach(device_t dev)
-+{
-+ struct hfc_card *card = device_get_softc(dev);
-+
-+ if (dahdi_module_usecount(THIS_MODULE) > 0)
-+ return (EBUSY);
-+
-+ hfc_softreset(card);
-+ dahdi_unregister(&card->ztdev->span);
-+ hfc_release_resources(card);
-+
-+ return (0);
-+}
-+
-+static device_method_t wcb1xxp_methods[] = {
-+ DEVMETHOD(device_probe, wcb1xxp_device_probe),
-+ DEVMETHOD(device_attach, wcb1xxp_device_attach),
-+ DEVMETHOD(device_detach, wcb1xxp_device_detach),
-+ { 0, 0 }
-+};
-+
-+static driver_t wcb1xxp_pci_driver = {
-+ "wcb1xxp",
-+ wcb1xxp_methods,
-+ sizeof(struct hfc_card)
-+};
-+
-+static devclass_t wcb1xxp_devclass;
-+
-+DAHDI_DRIVER_MODULE(wcb1xxp, pci, wcb1xxp_pci_driver, wcb1xxp_devclass);
-+MODULE_DEPEND(wcb1xxp, pci, 1, 1, 1);
-+MODULE_DEPEND(wcb1xxp, dahdi, 1, 1, 1);
-+#else
- static void __devexit hfc_remove(struct pci_dev *pci_dev)
- {
- struct hfc_card *card = pci_get_drvdata(pci_dev);
-@@ -1671,8 +1936,6 @@
-
- module_exit(hfc_module_exit);
-
--#endif
--
- MODULE_DESCRIPTION(hfc_DRIVER_DESCR);
- MODULE_AUTHOR("Jens Wilke <jw_vzaphfc@headissue.com>, "
- "Daniele (Vihai) Orlandi <daniele@orlandi.com>, "
-@@ -1681,15 +1944,18 @@
- #ifdef MODULE_LICENSE
- MODULE_LICENSE("GPL");
- #endif
-+#endif /* !__FreeBSD__ */
-
-
- module_param(modes, int, 0444);
-
-+#if !defined(__FreeBSD__)
- #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 10)
- module_param_array(nt_modes, int, &nt_modes_count, 0444);
- #else
- module_param_array(nt_modes, int, nt_modes_count, 0444);
- #endif
-+#endif /* !__FreeBSD__ */
-
- module_param(force_l1_up, int, 0444);
- #ifdef DEBUG
-diff -ruN freebsd/drivers/dahdi/zaphfc.orig/fifo.c freebsd/drivers/dahdi/zaphfc/fifo.c
---- freebsd/drivers/dahdi/zaphfc.orig/fifo.c 2010-09-01 00:55:30.000000000 +0700
-+++ freebsd/drivers/dahdi/zaphfc/fifo.c 2010-09-01 01:09:07.000000000 +0700
-@@ -13,7 +13,9 @@
- *
- */
-
-+#if !defined(__FreeBSD__)
- #include <linux/kernel.h>
-+#endif
-
- #include <dahdi/kernel.h>
-
-@@ -36,7 +38,7 @@
- chan->z_base + z_start,
- bytes_to_boundary);
-
-- memcpy(data + bytes_to_boundary,
-+ memcpy((char *) data + bytes_to_boundary,
- chan->fifo_base,
- size - bytes_to_boundary);
- }
-@@ -60,7 +62,7 @@
- bytes_to_boundary);
-
- memcpy(chan->fifo_base,
-- data + bytes_to_boundary,
-+ (char *) data + bytes_to_boundary,
- size - bytes_to_boundary);
- }
- }
-diff -ruN freebsd/drivers/dahdi/zaphfc.orig/fifo.h freebsd/drivers/dahdi/zaphfc/fifo.h
---- freebsd/drivers/dahdi/zaphfc.orig/fifo.h 2010-09-01 00:55:30.000000000 +0700
-+++ freebsd/drivers/dahdi/zaphfc/fifo.h 2010-07-07 04:24:55.000000000 +0700
-@@ -21,22 +21,22 @@
-
- static inline u16 *Z1_F1(struct hfc_chan_simplex *chan)
- {
-- return chan->z1_base + (*chan->f1 * 4);
-+ return (u16 *) (chan->z1_base + (*chan->f1 * 4));
- }
-
- static inline u16 *Z2_F1(struct hfc_chan_simplex *chan)
- {
-- return chan->z2_base + (*chan->f1 * 4);
-+ return (u16 *) (chan->z2_base + (*chan->f1 * 4));
- }
-
- static inline u16 *Z1_F2(struct hfc_chan_simplex *chan)
- {
-- return chan->z1_base + (*chan->f2 * 4);
-+ return (u16 *) (chan->z1_base + (*chan->f2 * 4));
- }
-
- static inline u16 *Z2_F2(struct hfc_chan_simplex *chan)
- {
-- return chan->z2_base + (*chan->f2 * 4);
-+ return (u16 *) (chan->z2_base + (*chan->f2 * 4));
- }
-
- static inline u16 Z_inc(struct hfc_chan_simplex *chan, u16 z, u16 inc)
-diff -ruN freebsd/drivers/dahdi/zaphfc.orig/zaphfc.h freebsd/drivers/dahdi/zaphfc/zaphfc.h
---- freebsd/drivers/dahdi/zaphfc.orig/zaphfc.h 2010-09-01 00:55:30.000000000 +0700
-+++ freebsd/drivers/dahdi/zaphfc/zaphfc.h 2010-08-31 23:57:30.000000000 +0700
-@@ -24,7 +24,12 @@
- #ifndef _HFC_ZAPHFC_H
- #define _HFC_ZAPHFC_H
-
-+#if defined(__FreeBSD__)
-+#include <sys/rman.h>
-+#include <machine/bus.h>
-+#else
- #include <asm/io.h>
-+#endif
-
- #define hfc_DRIVER_NAME "vzaphfc"
- #define hfc_DRIVER_PREFIX hfc_DRIVER_NAME ": "
-@@ -273,9 +278,9 @@
- int ugly_framebuf_size;
- u16 ugly_framebuf_off;
-
-- void *z1_base, *z2_base;
-+ char *z1_base, *z2_base;
- void *fifo_base;
-- void *z_base;
-+ char *z_base;
- u16 z_min;
- u16 z_max;
- u16 fifo_size;
-@@ -293,7 +298,7 @@
- };
-
- enum hfc_chan_status {
-- free,
-+ chan_free,
- open_framed,
- open_voice,
- sniff_aux,
-@@ -330,12 +335,27 @@
- struct proc_dir_entry *proc_fifos;
- struct proc_dir_entry *proc_bufs;
-
-+#if defined(__FreeBSD__)
-+ struct pci_dev _dev;
-+
-+ struct resource *mem_res; /* resource for I/O range */
-+ int mem_rid;
-+
-+ struct resource *irq_res; /* resource for irq */
-+ int irq_rid;
-+ void *irq_handle;
-+
-+ uint32_t dma_addr;
-+ bus_dma_tag_t dma_tag;
-+ bus_dmamap_t dma_map;
-+#else
- unsigned long io_bus_mem;
- void __iomem *io_mem;
-
- dma_addr_t fifo_bus_mem;
-+#endif /* !__FreeBSD__ */
- void *fifo_mem;
-- void *fifos;
-+ char *fifos;
-
- int nt_mode;
- int sync_loss_reported;
-@@ -403,12 +423,24 @@
-
- static inline u8 hfc_inb(struct hfc_card *card, int offset)
- {
-+#if defined(__FreeBSD__)
-+ return bus_space_read_1(
-+ rman_get_bustag(card->mem_res), rman_get_bushandle(card->mem_res),
-+ offset);
-+#else
- return readb(card->io_mem + offset);
-+#endif
- }
-
- static inline void hfc_outb(struct hfc_card *card, int offset, u8 value)
- {
-+#if defined(__FreeBSD__)
-+ bus_space_write_1(
-+ rman_get_bustag(card->mem_res), rman_get_bushandle(card->mem_res),
-+ offset, value);
-+#else
- writeb(value, card->io_mem + offset);
-+#endif
- }
-
- #endif
-diff -ruN freebsd/freebsd/wcb1xxp.orig/Makefile freebsd/freebsd/wcb1xxp/Makefile
---- freebsd/freebsd/wcb1xxp.orig/Makefile 1970-01-01 07:00:00.000000000 +0700
-+++ freebsd/freebsd/wcb1xxp/Makefile 2010-09-01 01:00:49.000000000 +0700
-@@ -0,0 +1,9 @@
-+# $Id: Makefile 7432 2009-10-28 21:34:15Z fjoe $
-+
-+.PATH: ${.CURDIR}/../../drivers/dahdi/zaphfc
-+
-+KMOD= wcb1xxp
-+SRCS= base.c fifo.c
-+SRCS+= device_if.h bus_if.h pci_if.h
-+
-+.include <bsd.kmod.mk>
diff --git a/misc/dahdi-kmod/pkg-descr b/misc/dahdi-kmod/pkg-descr
deleted file mode 100644
index 458e1153be57..000000000000
--- a/misc/dahdi-kmod/pkg-descr
+++ /dev/null
@@ -1,3 +0,0 @@
-DAHDi (Digium/Asterisk Hardware Device Interface) is the open source
-device interface technology used to control Digium and other telephony
-interface cards.
diff --git a/misc/dahdi-kmod/pkg-plist b/misc/dahdi-kmod/pkg-plist
deleted file mode 100644
index 4dc776341d4f..000000000000
--- a/misc/dahdi-kmod/pkg-plist
+++ /dev/null
@@ -1,28 +0,0 @@
-lib/dahdi/dahdi-fw-hx8.bin.ko
-lib/dahdi/dahdi-fw-oct6114-064.bin.ko
-lib/dahdi/dahdi-fw-oct6114-128.bin.ko
-lib/dahdi/dahdi-fw-tc400m.bin.ko
-lib/dahdi/dahdi.ko
-lib/dahdi/dahdi_dynamic.ko
-lib/dahdi/dahdi_dynamic_eth.ko
-lib/dahdi/dahdi_dynamic_ethmf.ko
-lib/dahdi/dahdi_dynamic_loc.ko
-lib/dahdi/dahdi_echocan_jpah.ko
-lib/dahdi/dahdi_echocan_kb1.ko
-lib/dahdi/dahdi_echocan_mg2.ko
-lib/dahdi/dahdi_echocan_oslec.ko
-lib/dahdi/dahdi_echocan_sec.ko
-lib/dahdi/dahdi_echocan_sec2.ko
-lib/dahdi/dahdi_transcode.ko
-lib/dahdi/dahdi_voicebus.ko
-%%X86%%lib/dahdi/dahdi_vpmadt032_loader.ko
-lib/dahdi/ng_dahdi_netdev.ko
-lib/dahdi/wcb1xxp.ko
-lib/dahdi/wcb4xxp.ko
-lib/dahdi/wcfxo.ko
-lib/dahdi/wct4xxp.ko
-lib/dahdi/wctc4xxp.ko
-lib/dahdi/wctdm.ko
-lib/dahdi/wctdm24xxp.ko
-lib/dahdi/wcte11xp.ko
-lib/dahdi/wcte12xp.ko