Commit a89bb38a authored by Ariadne Conill's avatar Ariadne Conill

main/dahdi-linux-vanilla: new aport (replacing dahdi-linux-hardened)

parent 4815c171
# Contributor: Timo Teras <timo.teras@iki.fi>
# Maintainer: Timo Teras <timo.teras@iki.fi>
_flavor=vanilla
_kpkg=linux-$_flavor
_kver=4.14.16
_kpkgrel=0
_mypkgrel=0
_kpkgver="$_kver-r$_kpkgrel"
_abi_release=${_kver}-${_kpkgrel}-${_flavor}
_realname=dahdi-linux
pkgname=${_realname}-${_flavor}
pkgver=$_kver
# when chaning _dahdiver we *must* bump _mypkgrel
_dahdiver=2.11.1
pkgrel=$(( $_kpkgrel + $_mypkgrel ))
pkgdesc="Digium Asterisk Hardware Device Interface drivers $_dahdiver"
url="http://www.asterisk.org"
arch="x86 x86_64"
license="GPL"
depends="dahdi-linux linux-${_flavor}=${_kpkgver}"
# we need wget and tar because make install downloads firmware and uses fancy
# options for tar and wget.
makedepends="linux-${_flavor}-dev=${_kpkgver} wget tar perl"
install=
subpackages="$pkgname-dev"
provides="${_realname}-grsec=${pkgver}-r${pkgrel}"
source="http://downloads.digium.com/pub/telephony/dahdi-linux/releases/${_realname}-$_dahdiver.tar.gz
dahdi-depmod.patch
dahdi-bri_dchan.patch
dahdi-zaphfc.patch
zaphfc-dahdi-flortz.diff
zaphfc-dahdi-2.4.0.patch
zaphfc-dahdi-2.5.0.patch
zaphfc-dahdi-2.6.0.patch
zaphfc-dahdi-2.7.0.patch
linux-3.13.patch
linux-4.4.patch
linux-4.11.patch
linux-4.13.patch
"
prepare() {
cd "$srcdir/$_realname-$_dahdiver"
# verify the kernel version
(
if [ -f "$startdir"/../linux-${_flavor}/APKBUILD ]; then
. "$startdir"/../linux-${_flavor}/APKBUILD
if [ "$_kver" != "$pkgver" ]; then
die "dahdi-linux-grsec: please update _kver to $pkgver"
fi
if [ "$_kpkgrel" != "$pkgrel" ]; then
die "dahdi-linux-grsec: please update _kpkgrel to $pkgrel"
fi
fi
) || return 1
for i in $source; do
case $i in
*.patch|*.diff)
msg "Applying $i"
patch -p1 -i "$srcdir"/$i || return 1
;;
esac
done
}
build() {
cd "$srcdir/$_realname-$_dahdiver"
make KVERS="${_abi_release}" DYNFS="yes" MODULES_EXTRA="zaphfc" \
|| return 1
}
package() {
cd "$srcdir/$_realname-$_dahdiver"
make KVERS="${_abi_release}" DYNFS="yes" MODULES_EXTRA="zaphfc" \
DESTDIR="$pkgdir" install-modules || return 1
rm -rf "$pkgdir"/lib/firmware "$pkgdir"/usr/lib/hotplug/firmware \
"$pkgdir"/usr/include
}
# since we sourced the APKBUILD above we got the dev() function there to
# so we override it again.
depends_dev="dahdi-linux-dev"
dev() {
default_dev
local dir="$subpkgdir"/usr/src/dahdi-headers-${_abi_release}
install -D "$srcdir"/$_realname-$_dahdiver/drivers/dahdi/Module.symvers \
"$dir"/drivers/dahdi/Module.symvers
ln -s /usr/include "$dir"/include
}
sha512sums="db15d9237f157b5349de8f4cdb45573ed42e1dd25c83f900835c7e15637a19e1e95c7c990dc786c1e3f37f32419f3d009e179d27b5d16421789ff9bc76f54224 dahdi-linux-2.11.1.tar.gz
aba01eb90d9db1c595ff22078c76aadb20900486b5794d38b7ee61fa30d2fb51be318a4d059246017640447aee03fb09bb5514c818e3caa1cd98e331ec065173 dahdi-depmod.patch
fa2fa9e96eefc0f31a1a4a8f8f44e77936f6da0d7b74fe3c3d1f0de085621744ae4367932ac97a10b7f96b7d0954843b0bfe07a251b85434079cc6da29e243ba dahdi-bri_dchan.patch
8ef31c9723237da83954832df5aee1f5daa23f8fefe07a1a191a2c5da2c2308001d68cee83500f7ef43166bfc0d65552b0ca5362789c5c82a7217e09362fd5fe dahdi-zaphfc.patch
f18043fd18a05be7e49daa9d8c96c8a8c45936b14e82e30523e4d88b1620a73147f765d24d2038c4ec0855901e36e8e2b188d596f94437dfb80f6d76ab699d9d zaphfc-dahdi-flortz.diff
8068fcbba81b819bbd14a1a324457d0febd5350d16c6443be035c50f7759010376bd92d3c7ea69b47309e02603e587387b643f64663652e162853515371a6da5 zaphfc-dahdi-2.4.0.patch
95811d56f5567bbab1e6fac89fdc7a4d78252a54a416e884903ae2709f8922f5cd02c492de0bad5c35fdfd52250ec231ed11457e36ba33f8747c3226491882de zaphfc-dahdi-2.5.0.patch
7533c640817f71789c922bb9a5a3b6132b5b47958770929b1c9a50a1e2e6de914e278f466a85ef99759e291e5907c56d60926c74075f4e731a9910a46c1be3ea zaphfc-dahdi-2.6.0.patch
daca74da31c655265164a854987d45ca5ee3af1defbe2d49a9f1a70a48a43dc2bc3ceba724781ae29e3a9078b827f641d2e29809fb25101986f2f69c767d1382 zaphfc-dahdi-2.7.0.patch
dfc2b0357dc3d2a37c45f1fcc503009cf35e99c8b174d0dd7c91ac4c2c9bb3428f9a19a3f264446069fd751441833f43e11b3b55a060865c6daca9bef74008be linux-3.13.patch
18cc299c9b9ab05b93769c0aa68595d3b3b640b97c6ee546b9cbe551f08679557c7e2a5a8255577ab6ae7036c2210550b45066b03d04ebbe7adad1a59aba5866 linux-4.4.patch
1ce44a927607e04013f03af7655687098397b68c0e857beb5b4d6ae09e92cac59974fd69b5be6bf6d2e4d8e5643f2ce54d9e05661da656d943b5f30c4696ef41 linux-4.11.patch
ded7386794abad54fb9f7106e4dc0cc62da1a6b32baaed35a15820f935fe65128e9639bf27eaca392fec0750fd0ee13dbb0cbbf95b8d749085d491361a2b3da2 linux-4.13.patch"
--- ./drivers/dahdi/voicebus/voicebus.h.orig
+++ ./drivers/dahdi/voicebus/voicebus.h
@@ -89,7 +89,7 @@
void (*handle_receive)(struct voicebus *vb, struct list_head *buffers);
void (*handle_transmit)(struct voicebus *vb, struct list_head *buffers);
void (*handle_error)(struct voicebus *vb);
-};
+} __no_const;
/**
* struct voicebus_descriptor_list - A single descriptor list.
--- ./drivers/dahdi/wctc4xxp/base.c.orig
+++ ./drivers/dahdi/wctc4xxp/base.c
@@ -3193,7 +3193,7 @@
return ret;
}
-static void wctc4xxp_setup_file_operations(struct file_operations *fops)
+static void wctc4xxp_setup_file_operations(file_operations_no_const *fops)
{
fops->owner = THIS_MODULE;
fops->read = wctc4xxp_read;
Index: dahdi-linux-2.5.0/drivers/dahdi/xpp/card_bri.c
===================================================================
--- dahdi-linux-2.5.0.orig/drivers/dahdi/xpp/card_bri.c 2011-08-15 14:42:29.000000000 +0300
+++ dahdi-linux-2.5.0/drivers/dahdi/xpp/card_bri.c 2011-08-15 14:51:37.000000000 +0300
@@ -274,7 +274,6 @@
int frame_begin;
priv = xpd->priv;
- BUG_ON(!priv);
if(transmit) {
direction = "TX";
frame_begin = priv->txframe_begin;
@@ -312,9 +311,7 @@
{
struct BRI_priv_data *priv;
- BUG_ON(!xpd);
priv = xpd->priv;
- BUG_ON(!priv);
if(priv->dchan_alive == up)
return;
if(up) {
@@ -332,9 +329,7 @@
{
struct BRI_priv_data *priv;
- BUG_ON(!xpd);
priv = xpd->priv;
- BUG_ON(!priv);
if(priv->layer1_up == up)
return;
priv->layer1_up = up;
@@ -348,9 +343,7 @@
struct BRI_priv_data *priv;
byte curr_state;
- BUG_ON(!xpd);
priv = xpd->priv;
- BUG_ON(!priv);
curr_state = priv->state_register.bits.v_su_sta;
XPD_DBG(SIGNAL, xpd, "%s\n", (on)?"ON":"OFF");
if(on) {
@@ -391,9 +384,7 @@
struct BRI_priv_data *priv;
byte curr_state;
- BUG_ON(!xpd);
priv = xpd->priv;
- BUG_ON(!priv);
curr_state = priv->state_register.bits.v_su_sta;
XPD_DBG(SIGNAL, xpd, "%s\n", (on)?"ON":"OFF");
if(on) {
@@ -443,7 +434,6 @@
struct BRI_priv_data *priv;
priv = xpd->priv;
- BUG_ON(!priv);
#ifdef CONFIG_DAHDI_BRI_DCHANS
if(debug & DBG_COMMANDS)
dump_hex_buf(xpd, "D-Chan(abort) RX: dchan_rbuf",
@@ -460,7 +450,6 @@
byte status;
priv = xpd->priv;
- BUG_ON(!priv);
#ifdef CONFIG_DAHDI_BRI_DCHANS
if(priv->dchan_r_idx < 4) {
XPD_NOTICE(xpd, "D-Chan RX short frame (dchan_r_idx=%d)\n",
@@ -503,7 +492,6 @@
int idx;
priv = xpd->priv;
- BUG_ON(!priv);
dchan_buf = dchan->readchunk;
idx = priv->dchan_r_idx;
if(idx + len >= DCHAN_BUFSIZE) {
@@ -527,7 +515,6 @@
struct BRI_priv_data *priv;
priv = xpd->priv;
- BUG_ON(!priv);
#ifdef CONFIG_DAHDI_BRI_DCHANS
dchan->bytes2receive = priv->dchan_r_idx - 1;
dchan->eofrx = 1;
@@ -556,10 +543,7 @@
return 0;
if(!SPAN_REGISTERED(xpd)) /* Nowhere to copy data */
return 0;
- BUG_ON(!xpd);
priv = xpd->priv;
- BUG_ON(!priv);
- xbus = xpd->xbus;
dchan = XPD_CHAN(xpd, 2);
if(!IS_OFFHOOK(xpd, 2)) { /* D-chan is used? */
static int rate_limit;
@@ -629,9 +613,7 @@
return 0;
if(!SPAN_REGISTERED(xpd)) /* Nowhere to copy data */
return 0;
- BUG_ON(!xpd);
priv = xpd->priv;
- BUG_ON(!priv);
dchan = XPD_CHAN(xpd, 2);
if(!IS_OFFHOOK(xpd, 2)) { /* D-chan is used? */
static int rate_limit;
@@ -677,7 +659,6 @@
struct BRI_priv_data *priv;
priv = xpd->priv;
- BUG_ON(!priv);
dchan = XPD_CHAN(xpd, 2);
if (dchan == chan) {
atomic_inc(&priv->hdlc_pending);
@@ -716,7 +697,6 @@
int ret;
priv = xpd->priv;
- BUG_ON(!priv);
#ifndef CONFIG_DAHDI_BRI_DCHANS
if(atomic_read(&priv->hdlc_pending) == 0)
return 0;
@@ -769,7 +749,6 @@
{
struct BRI_priv_data *priv;
- BUG_ON(!xpd);
priv = xpd->priv;
XPD_DBG(PROC, xpd, "\n");
#ifdef CONFIG_PROC_FS
@@ -784,7 +763,6 @@
{
struct BRI_priv_data *priv;
- BUG_ON(!xpd);
priv = xpd->priv;
XPD_DBG(PROC, xpd, "\n");
#ifdef CONFIG_PROC_FS
@@ -828,7 +806,6 @@
{
struct BRI_priv_data *priv;
- BUG_ON(!xpd);
XPD_DBG(GENERAL, xpd, "\n");
priv = xpd->priv;
DO_LED(xpd, GREEN_LED, BRI_LED_OFF);
@@ -841,7 +818,6 @@
static int BRI_card_remove(xbus_t *xbus, xpd_t *xpd)
{
- BUG_ON(!xpd);
XPD_DBG(GENERAL, xpd, "\n");
bri_proc_remove(xbus, xpd);
return 0;
@@ -877,10 +853,8 @@
struct BRI_priv_data *priv;
int i;
- BUG_ON(!xpd);
xbus = xpd->xbus;
priv = xpd->priv;
- BUG_ON(!xbus);
XPD_DBG(GENERAL, xpd, "%s\n", (on)?"on":"off");
if(!on) {
/* Nothing to do yet */
@@ -927,11 +901,6 @@
static int BRI_card_dahdi_postregistration(xpd_t *xpd, bool on)
{
- xbus_t *xbus;
-
- BUG_ON(!xpd);
- xbus = xpd->xbus;
- BUG_ON(!xbus);
XPD_DBG(GENERAL, xpd, "%s\n", (on)?"on":"off");
return(0);
}
@@ -956,7 +925,6 @@
int other_led;
int mod;
- BUG_ON(!xpd);
if(IS_NT(xpd)) {
which_led = RED_LED;
other_led = GREEN_LED;
@@ -965,7 +933,6 @@
other_led = RED_LED;
}
priv = xpd->priv;
- BUG_ON(!priv);
timer_count = xpd->timer_count;
if(xpd->blink_mode) {
if((timer_count % DEFAULT_LED_PERIOD) == 0) {
@@ -1014,9 +981,7 @@
{
struct BRI_priv_data *priv;
- BUG_ON(!xpd);
priv = xpd->priv;
- BUG_ON(!priv);
if(IS_NT(xpd)) {
if (priv->t1 > HFC_TIMER_OFF) {
if (--priv->t1 == 0) {
@@ -1053,9 +1018,7 @@
{
struct BRI_priv_data *priv;
- BUG_ON(!xpd);
priv = xpd->priv;
- BUG_ON(!priv);
if(!priv->initialized || !xbus->self_ticking)
return 0;
if(poll_interval != 0 && (priv->tick_counter % poll_interval) == 0) {
@@ -1111,7 +1074,6 @@
static int BRI_card_ioctl(xpd_t *xpd, int pos, unsigned int cmd, unsigned long arg)
{
- BUG_ON(!xpd);
if(!XBUS_IS(xpd->xbus, READY))
return -ENODEV;
switch (cmd) {
@@ -1131,7 +1093,6 @@
static int BRI_card_open(xpd_t *xpd, lineno_t pos)
{
- BUG_ON(!xpd);
if(pos == 2) {
LINE_DBG(SIGNAL, xpd, pos, "OFFHOOK the whole span\n");
BIT_SET(PHONEDEV(xpd).offhook_state, 0);
@@ -1230,12 +1191,8 @@
{
struct phonedev *phonedev = container_of(span, struct phonedev, span);
xpd_t *xpd = container_of(phonedev, struct xpd, phonedev);
- struct BRI_priv_data *priv;
struct dahdi_chan *dchan;
- BUG_ON(!xpd);
- priv = xpd->priv;
- BUG_ON(!priv);
if(!XBUS_IS(xpd->xbus, READY)) {
XPD_DBG(GENERAL, xpd, "Startup called by dahdi. No Hardware. Ignored\n");
return -ENODEV;
@@ -1267,11 +1224,7 @@
{
struct phonedev *phonedev = container_of(span, struct phonedev, span);
xpd_t *xpd = container_of(phonedev, struct xpd, phonedev);
- struct BRI_priv_data *priv;
- BUG_ON(!xpd);
- priv = xpd->priv;
- BUG_ON(!priv);
if(!XBUS_IS(xpd->xbus, READY)) {
XPD_DBG(GENERAL, xpd, "Shutdown called by dahdi. No Hardware. Ignored\n");
return -ENODEV;
@@ -1292,7 +1245,6 @@
xpd_t *main_xpd;
unsigned long flags;
- BUG_ON(!xpd);
main_xpd = xpd_byaddr(xpd->xbus, xpd->addr.unit, 0);
if(!main_xpd) {
XPD_DBG(DEVICES, xpd, "Unit 0 is already gone. Ignore request\n");
@@ -1350,8 +1302,6 @@
xpp_line_t wanted_lines;
- BUG_ON(!xpd);
- BUG_ON(!pack);
pcm = RPACKET_FIELD(pack, GLOBAL, PCM_WRITE, pcm);
for(subunit = 0; subunit < MAX_SUBUNIT; subunit++) {
xpd_t *tmp_xpd;
@@ -1435,12 +1385,8 @@
static int BRI_echocancel_setmask(xpd_t *xpd, xpp_line_t ec_mask)
{
- struct BRI_priv_data *priv;
int i;
- BUG_ON(!xpd);
- priv = xpd->priv;
- BUG_ON(!priv);
XPD_DBG(GENERAL, xpd, "0x%8X\n", ec_mask);
if (!ECHOOPS(xpd->xbus)) {
XPD_DBG(GENERAL, xpd,
@@ -1466,9 +1412,7 @@
struct bri_leds *bri_leds;
struct BRI_priv_data *priv;
- BUG_ON(!xbus);
priv = xpd->priv;
- BUG_ON(!priv);
XPD_DBG(LEDS, xpd, "%s -> %d\n",
(which_led)?"RED":"GREEN",
to_led_state);
@@ -1507,9 +1451,7 @@
struct BRI_priv_data *priv;
su_rd_sta_t new_state;
- BUG_ON(!xpd);
priv = xpd->priv;
- BUG_ON(!priv);
if(!priv->initialized) {
XPD_ERR(xpd, "%s called on uninitialized AB\n", __FUNCTION__);
return;
@@ -1621,7 +1563,6 @@
}
spin_lock_irqsave(&xpd->lock, flags);
priv = xpd->priv;
- BUG_ON(!priv);
if(REG_FIELD(info, do_subreg)) {
XPD_DBG(REGS, xpd, "RI %02X %02X %02X\n",
REG_FIELD(info, regnum), REG_FIELD(info, subreg), REG_FIELD(info, data_low));
@@ -1665,7 +1606,6 @@
{
struct BRI_priv_data *priv;
- BUG_ON(!xpd);
priv = xpd->priv;
XPD_DBG(GENERAL, xpd, "%s\n", (on)?"ON":"OFF");
if(on) {
@@ -1745,7 +1685,6 @@
return -ENODEV;
spin_lock_irqsave(&xpd->lock, flags);
priv = xpd->priv;
- BUG_ON(!priv);
len += sprintf(page + len, "%05d Layer 1: ", priv->poll_counter);
if(priv->reg30_good) {
len += sprintf(page + len, "%-5s ", (priv->layer1_up) ? "UP" : "DOWN");
# 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: dahdi-linux-2.5.0/include/dahdi/kernel.h
===================================================================
--- dahdi-linux-2.5.0.orig/include/dahdi/kernel.h 2011-06-29 18:32:40.000000000 +0300
+++ dahdi-linux-2.5.0/include/dahdi/kernel.h 2011-08-15 14:14:26.000000000 +0300
@@ -413,6 +413,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 */
@@ -723,6 +730,9 @@
DAHDI_FLAGBIT_TXUNDERRUN = 22, /*!< Transmit underrun condition */
DAHDI_FLAGBIT_RXOVERRUN = 23, /*!< Receive overrun condition */
DAHDI_FLAGBIT_DEVFILE = 25, /*!< Channel has a sysfs dev file */
+#if defined(CONFIG_DAHDI_BRI_DCHANS)
+ DAHDI_FLAGBIT_BRIDCHAN = 26, /*!< hardhdlc-like handling of the D channel */
+#endif
};
#ifdef CONFIG_DAHDI_NET
@@ -789,6 +799,7 @@
#define DAHDI_FLAG_BUFEVENTS DAHDI_FLAG(BUFEVENTS)
#define DAHDI_FLAG_TXUNDERRUN DAHDI_FLAG(TXUNDERRUN)
#define DAHDI_FLAG_RXOVERRUN DAHDI_FLAG(RXOVERRUN)
+#define DAHDI_FLAG_BRIDCHAN DAHDI_FLAG(BRIDCHAN)
struct file;
Index: dahdi-linux-2.5.0/include/dahdi/dahdi_config.h
===================================================================
--- dahdi-linux-2.5.0.orig/include/dahdi/dahdi_config.h 2011-01-05 17:52:03.000000000 +0200
+++ dahdi-linux-2.5.0/include/dahdi/dahdi_config.h 2011-08-15 14:13:01.000000000 +0300
@@ -195,4 +195,10 @@
*/
/* #define CONFIG_DAHDI_MIRROR */
+/*
+ * Uncomment the following for BRI D channels
+ *
+ */
+#define CONFIG_DAHDI_BRI_DCHANS
+
#endif
Index: dahdi-linux-2.5.0/drivers/dahdi/dahdi-base.c
===================================================================
--- dahdi-linux-2.5.0.orig/drivers/dahdi/dahdi-base.c 2011-07-21 19:26:31.000000000 +0300
+++ dahdi-linux-2.5.0/drivers/dahdi/dahdi-base.c 2011-08-15 14:13:01.000000000 +0300
@@ -7224,11 +7224,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]) {
@@ -7285,6 +7314,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 (dahdi_have_netdev(ms))
netif_wake_queue(chan_to_netdev(ms));
@@ -7346,6 +7386,12 @@
}
needtxunderrun += 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 */
needtxunderrun += bytes;
@@ -8267,6 +8313,14 @@
int res;
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;
@@ -8324,6 +8378,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);
Index: dahdi-linux-2.0.0-rc4/Makefile
===================================================================
--- dahdi-linux-2.0.0-rc4.orig/Makefile 2008-09-09 14:07:23.000000000 +0300
+++ dahdi-linux-2.0.0-rc4/Makefile 2008-09-09 14:12:31.000000000 +0300
@@ -190,7 +190,7 @@
build_tools/uninstall-modules dahdi $(KVERS)
endif
$(KMAKE) INSTALL_MOD_PATH=$(DESTDIR) INSTALL_MOD_DIR=dahdi modules_install
- [ `id -u` = 0 ] && /sbin/depmod -a $(KVERS) || :
+ [ -z "$(DESTDIR)" -a `id -u` = 0 ] && /sbin/depmod -a $(KVERS) || :
uninstall-modules:
ifdef DESTDIR
@@ -203,7 +203,7 @@
rm -rf /lib/modules/$(KVERS)/dahdi; \
echo "done."; \
fi
- [ `id -u` = 0 ] && /sbin/depmod -a $(KVERS) || :
+ [ -z "$(DESTDIR)" -a `id -u` = 0 ] && /sbin/depmod -a $(KVERS) || :
endif
update:
Index: dahdi-linux-2.1.0/drivers/dahdi/zaphfc.c
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ dahdi-linux-2.1.0/drivers/dahdi/zaphfc.c 2008-12-10 12:46:14.000000000 +0200
@@ -0,0 +1,1129 @@
+/*
+ * zaphfc.c - Zaptel driver for HFC-S PCI A based ISDN BRI cards
+ *
+ * kernel module inspired by HFC PCI ISDN4Linux and Zaptel drivers
+ *
+ * Copyright (C) 2002, 2003, 2004, 2005 Junghanns.NET GmbH
+ *
+ * Klaus-Peter Junghanns <kpj@junghanns.net>
+ *
+ * This program is free software and may be modified and
+ * distributed under the terms of the GNU Public License.
+ *
+ */
+
+#include <linux/kernel.h>
+#include <linux/module.h>
+#ifdef RTAITIMING
+#include <asm/io.h>
+#include <rtai.h>
+#include <rtai_sched.h>
+#include <rtai_fifos.h>
+#endif
+#include <linux/pci.h>
+#include <linux/init.h>
+#include <linux/interrupt.h>
+#include <linux/delay.h>
+#include <dahdi/kernel.h>
+#include "zaphfc.h"
+
+#include <linux/moduleparam.h>
+
+#if CONFIG_PCI
+
+#define CLKDEL_TE 0x0f /* CLKDEL in TE mode */
+#define CLKDEL_NT 0x6c /* CLKDEL in NT mode */
+
+typedef struct {
+ int vendor_id;
+ int device_id;
+ char *vendor_name;
+ char *card_name;
+} PCI_ENTRY;
+
+static const PCI_ENTRY id_list[] =
+{
+ {PCI_VENDOR_ID_CCD, PCI_DEVICE_ID_CCD_2BD0, "CCD/Billion/Asuscom", "2BD0"},
+ {PCI_VENDOR_ID_CCD, PCI_DEVICE_ID_CCD_B000, "Billion", "B000"},
+ {PCI_VENDOR_ID_CCD, PCI_DEVICE_ID_CCD_B006, "Billion", "B006"},
+ {PCI_VENDOR_ID_CCD, PCI_DEVICE_ID_CCD_B007, "Billion", "B007"},
+ {PCI_VENDOR_ID_CCD, PCI_DEVICE_ID_CCD_B008, "Billion", "B008"},
+ {PCI_VENDOR_ID_CCD, PCI_DEVICE_ID_CCD_B009, "Billion", "B009"},
+ {PCI_VENDOR_ID_CCD, PCI_DEVICE_ID_CCD_B00A, "Billion", "B00A"},
+ {PCI_VENDOR_ID_CCD, PCI_DEVICE_ID_CCD_B00B, "Billion", "B00B"},
+ {PCI_VENDOR_ID_CCD, PCI_DEVICE_ID_CCD_B00C, "Billion", "B00C"},
+ {PCI_VENDOR_ID_CCD, PCI_DEVICE_ID_CCD_B100, "Seyeon", "B100"},
+ {PCI_VENDOR_ID_ABOCOM, PCI_DEVICE_ID_ABOCOM_2BD1, "Abocom/Magitek", "2BD1"},
+ {PCI_VENDOR_ID_ASUSTEK, PCI_DEVICE_ID_ASUSTEK_0675, "Asuscom/Askey", "675"},
+ {PCI_VENDOR_ID_BERKOM, PCI_DEVICE_ID_BERKOM_T_CONCEPT, "German telekom", "T-Concept"},
+ {PCI_VENDOR_ID_BERKOM, PCI_DEVICE_ID_BERKOM_A1T, "German telekom", "A1T"},
+ {PCI_VENDOR_ID_ANIGMA, PCI_DEVICE_ID_ANIGMA_MC145575, "Motorola MC145575", "MC145575"},
+ {PCI_VENDOR_ID_ZOLTRIX, PCI_DEVICE_ID_ZOLTRIX_2BD0, "Zoltrix", "2BD0"},
+ {PCI_VENDOR_ID_DIGI, PCI_DEVICE_ID_DIGI_DF_M_IOM2_E,"Digi International", "Digi DataFire Micro V IOM2 (Europe)"},
+ {PCI_VENDOR_ID_DIGI, PCI_DEVICE_ID_DIGI_DF_M_E,"Digi International", "Digi DataFire Micro V (Europe)"},
+ {PCI_VENDOR_ID_DIGI, PCI_DEVICE_ID_DIGI_DF_M_IOM2_A,"Digi International", "Digi DataFire Micro V IOM2 (North America)"},
+ {PCI_VENDOR_ID_DIGI, PCI_DEVICE_ID_DIGI_DF_M_A,"Digi International", "Digi DataFire Micro V (North America)"},
+ {0x182d, 0x3069,"Sitecom","Isdn 128 PCI"},
+ {0, 0, NULL, NULL},
+};
+
+static struct hfc_card *hfc_dev_list = NULL;
+static int hfc_dev_count = 0;
+static int modes = 0; // all TE
+static int debug = 0;
+static struct pci_dev *multi_hfc = NULL;
+static DEFINE_SPINLOCK(registerlock);
+
+void hfc_shutdownCard(struct hfc_card *hfctmp) {
+ unsigned long flags;
+
+ if (hfctmp == NULL) {
+ return;
+ }
+
+ if (hfctmp->pci_io == NULL) {
+ return;
+ }
+
+ spin_lock_irqsave(&hfctmp->lock,flags);
+
+ printk(KERN_INFO "zaphfc: shutting down card at %p.\n",hfctmp->pci_io);