mirror of
https://git.FreeBSD.org/ports.git
synced 2024-11-27 00:57:50 +00:00
Update to 2.4.0-rc4. Most notable changes are:
- OSLEC echo canceller - experimental wcb1xxp (zaphfc) port for CCD HFC-S single-port PCI ISDN cards Sponsored by: The FreeBSD Foundation (this and all previous commits to this port)
This commit is contained in:
parent
8340c20a02
commit
da90049c53
Notes:
svn2git
2021-03-31 03:12:20 +00:00
svn path=/head/; revision=260303
@ -12,6 +12,10 @@ CATEGORIES= misc kld
|
||||
MASTER_SITES= ${MASTER_SITE_LOCAL}
|
||||
MASTER_SITE_SUBDIR= fjoe
|
||||
DISTNAME= ${PORTNAME}-freebsd-complete-${DAHDI_VERSION}+${DAHDI_TOOLS_VERSION}
|
||||
DISTFILES= ${DISTNAME}${EXTRACT_SUFX}\
|
||||
oslec-linux-${OSLEC_VERSION}${EXTRACT_SUFX}\
|
||||
zaphfc-${ZAPHFC_VERSION}${EXTRACT_SUFX}
|
||||
EXTRA_PATCHES= ${WRKDIR}/zaphfc-${ZAPHFC_VERSION}
|
||||
|
||||
MAINTAINER= fjoe@FreeBSD.org
|
||||
COMMENT= Digium/Asterisk Hardware Device Interface
|
||||
@ -19,8 +23,10 @@ COMMENT= Digium/Asterisk Hardware Device Interface
|
||||
BUILD_DEPENDS= gmake:${PORTSDIR}/devel/gmake
|
||||
LIB_DEPENDS= newt.52:${PORTSDIR}/devel/newt
|
||||
|
||||
DAHDI_VERSION= 2.4.0-rc3
|
||||
DAHDI_VERSION= 2.4.0-rc4
|
||||
DAHDI_TOOLS_VERSION= 2.4.0-rc1
|
||||
OSLEC_VERSION= 2.6.35.4
|
||||
ZAPHFC_VERSION= r5
|
||||
|
||||
NO_PACKAGE= Should be in sync with the kernel to work correctly
|
||||
GNU_CONFIGURE= yes
|
||||
@ -28,6 +34,7 @@ CONFIGURE_ARGS= --with-dahdi=../freebsd --sysconfdir=${PREFIX}/etc --with-newt=$
|
||||
CONFIGURE_ENV= WGET=/usr/bin/fetch
|
||||
USE_LDCONFIG= yes
|
||||
USE_RC_SUBR= dahdi
|
||||
MAKE_ARGS= ADDITIONAL_DRIVERS="wcb1xxp"
|
||||
|
||||
ONLY_FOR_ARCHS= i386 amd64 sparc64
|
||||
CONFLICTS= zaptel-[0-9]*
|
||||
@ -58,6 +65,10 @@ pre-everything::
|
||||
${FALSE}; \
|
||||
fi
|
||||
|
||||
post-extract:
|
||||
@${LN} -s ../../../linux-${OSLEC_VERSION}/drivers/staging ${WRKSRC}/freebsd/drivers
|
||||
@${REINPLACE_CMD} -E -e 's,(new|old)/,freebsd/,g' ${WRKDIR}/zaphfc-${ZAPHFC_VERSION}
|
||||
|
||||
post-patch:
|
||||
@${REINPLACE_CMD} -e 's,/etc,${PREFIX}/etc,g'\
|
||||
${WRKSRC}/tools/dahdi_cfg.c ${WRKSRC}/tools/fxotune.c\
|
||||
|
@ -1,3 +1,9 @@
|
||||
MD5 (dahdi-freebsd-complete-2.4.0-rc3+2.4.0-rc1.tar.gz) = 72f236f905c6f8ac66e3bb4d781cffaa
|
||||
SHA256 (dahdi-freebsd-complete-2.4.0-rc3+2.4.0-rc1.tar.gz) = fb31f1ca76fa89568ba9590a4d65f7e26ab69e45e09587bd0e3b2a97b93ade60
|
||||
SIZE (dahdi-freebsd-complete-2.4.0-rc3+2.4.0-rc1.tar.gz) = 2048903
|
||||
MD5 (dahdi-freebsd-complete-2.4.0-rc4+2.4.0-rc1.tar.gz) = 4246fd70cb196cbfd6eba16a9ce0e434
|
||||
SHA256 (dahdi-freebsd-complete-2.4.0-rc4+2.4.0-rc1.tar.gz) = 17530a885626ded8fb8d8dd6f04dbf3366e90bceda5a6a02a948d49a29ef8b4c
|
||||
SIZE (dahdi-freebsd-complete-2.4.0-rc4+2.4.0-rc1.tar.gz) = 2049406
|
||||
MD5 (oslec-linux-2.6.35.4.tar.gz) = e63e8e7cc4d7338bcb8e526594a34495
|
||||
SHA256 (oslec-linux-2.6.35.4.tar.gz) = 01cfaa1ca64056c822d1a3ebf4f7b3c81127cd7b308ad5b0738ff4eb2026e261
|
||||
SIZE (oslec-linux-2.6.35.4.tar.gz) = 12057
|
||||
MD5 (zaphfc-r5.tar.gz) = 5fbc6110c01b60e6795b5e8424bb4790
|
||||
SHA256 (zaphfc-r5.tar.gz) = 7e809b62dcc2bd3caf2e5a882390051b881eb08d37fea1733d7fb55e80bc6756
|
||||
SIZE (zaphfc-r5.tar.gz) = 15639
|
||||
|
@ -1,3 +1,8 @@
|
||||
# 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)
|
||||
|
12
misc/dahdi-kmod/files/patch-freebsd-freebsd-Makefile
Normal file
12
misc/dahdi-kmod/files/patch-freebsd-freebsd-Makefile
Normal file
@ -0,0 +1,12 @@
|
||||
--- freebsd/freebsd/Makefile.orig 2010-09-01 01:13:18.000000000 +0700
|
||||
+++ freebsd/freebsd/Makefile 2010-09-01 01:13:33.000000000 +0700
|
||||
@@ -51,6 +51,9 @@
|
||||
wctc4xxp\
|
||||
dahdi-fw-tc400m.bin
|
||||
|
||||
+# Additional drivers
|
||||
+SUBDIR+= ${ADDITIONAL_DRIVERS}
|
||||
+
|
||||
.if ${MACHINE_ARCH} == "i386" || ${MACHINE_ARCH} == "amd64"
|
||||
_dahdi_vpmadt032_loader= dahdi_vpmadt032_loader
|
||||
.endif
|
29
misc/dahdi-kmod/files/patch-oslec
Normal file
29
misc/dahdi-kmod/files/patch-oslec
Normal file
@ -0,0 +1,29 @@
|
||||
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__ */
|
744
misc/dahdi-kmod/files/patch-zaphfc
Normal file
744
misc/dahdi-kmod/files/patch-zaphfc
Normal file
@ -0,0 +1,744 @@
|
||||
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-01 03:03:20.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,7 @@
|
||||
}
|
||||
|
||||
chan->open_by_zaptel = TRUE;
|
||||
- try_module_get(THIS_MODULE);
|
||||
+ (void) try_module_get(THIS_MODULE);
|
||||
spin_unlock(&chan->lock);
|
||||
|
||||
switch (chan->number) {
|
||||
@@ -509,12 +580,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 +609,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);
|
||||
@@ -591,7 +662,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 +713,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 +740,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 +756,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 +835,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);
|
||||
@@ -1179,7 +1252,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 +1304,7 @@
|
||||
break;
|
||||
}
|
||||
|
||||
+#if !defined(__FreeBSD__)
|
||||
skb = dev_alloc_skb(frame_size - 3);
|
||||
|
||||
if (!skb) {
|
||||
@@ -1254,6 +1330,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 +1338,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 +1372,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 +1385,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 +1400,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 +1534,7 @@
|
||||
card->cardnum);
|
||||
goto err_request_irq;
|
||||
}
|
||||
+#endif /* !__FreeBSD__ */
|
||||
|
||||
card->nt_mode = FALSE;
|
||||
|
||||
@@ -1419,7 +1551,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 +1592,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 +1634,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 +1687,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 +1705,103 @@
|
||||
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);
|
||||
+
|
||||
+ 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, 0, 0);
|
||||
+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 +1881,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 +1889,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>
|
@ -14,6 +14,7 @@ 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_oslec.ko
|
||||
lib/dahdi/dahdi_echocan_mg2.ko
|
||||
lib/dahdi/dahdi_echocan_sec.ko
|
||||
lib/dahdi/dahdi_echocan_sec2.ko
|
||||
@ -22,6 +23,7 @@ lib/dahdi/dahdi_voicebus.ko
|
||||
%%X86%%lib/dahdi/dahdi_vpmadt032_loader.ko
|
||||
lib/dahdi/linker.hints
|
||||
lib/dahdi/ng_dahdi_netdev.ko
|
||||
lib/dahdi/wcb1xxp.ko
|
||||
lib/dahdi/wcb4xxp.ko
|
||||
lib/dahdi/wcfxo.ko
|
||||
lib/dahdi/wct4xxp.ko
|
||||
|
@ -12,6 +12,10 @@ CATEGORIES= misc kld
|
||||
MASTER_SITES= ${MASTER_SITE_LOCAL}
|
||||
MASTER_SITE_SUBDIR= fjoe
|
||||
DISTNAME= ${PORTNAME}-freebsd-complete-${DAHDI_VERSION}+${DAHDI_TOOLS_VERSION}
|
||||
DISTFILES= ${DISTNAME}${EXTRACT_SUFX}\
|
||||
oslec-linux-${OSLEC_VERSION}${EXTRACT_SUFX}\
|
||||
zaphfc-${ZAPHFC_VERSION}${EXTRACT_SUFX}
|
||||
EXTRA_PATCHES= ${WRKDIR}/zaphfc-${ZAPHFC_VERSION}
|
||||
|
||||
MAINTAINER= fjoe@FreeBSD.org
|
||||
COMMENT= Digium/Asterisk Hardware Device Interface
|
||||
@ -19,8 +23,10 @@ COMMENT= Digium/Asterisk Hardware Device Interface
|
||||
BUILD_DEPENDS= gmake:${PORTSDIR}/devel/gmake
|
||||
LIB_DEPENDS= newt.52:${PORTSDIR}/devel/newt
|
||||
|
||||
DAHDI_VERSION= 2.4.0-rc3
|
||||
DAHDI_VERSION= 2.4.0-rc4
|
||||
DAHDI_TOOLS_VERSION= 2.4.0-rc1
|
||||
OSLEC_VERSION= 2.6.35.4
|
||||
ZAPHFC_VERSION= r5
|
||||
|
||||
NO_PACKAGE= Should be in sync with the kernel to work correctly
|
||||
GNU_CONFIGURE= yes
|
||||
@ -28,6 +34,7 @@ CONFIGURE_ARGS= --with-dahdi=../freebsd --sysconfdir=${PREFIX}/etc --with-newt=$
|
||||
CONFIGURE_ENV= WGET=/usr/bin/fetch
|
||||
USE_LDCONFIG= yes
|
||||
USE_RC_SUBR= dahdi
|
||||
MAKE_ARGS= ADDITIONAL_DRIVERS="wcb1xxp"
|
||||
|
||||
ONLY_FOR_ARCHS= i386 amd64 sparc64
|
||||
CONFLICTS= zaptel-[0-9]*
|
||||
@ -58,6 +65,10 @@ pre-everything::
|
||||
${FALSE}; \
|
||||
fi
|
||||
|
||||
post-extract:
|
||||
@${LN} -s ../../../linux-${OSLEC_VERSION}/drivers/staging ${WRKSRC}/freebsd/drivers
|
||||
@${REINPLACE_CMD} -E -e 's,(new|old)/,freebsd/,g' ${WRKDIR}/zaphfc-${ZAPHFC_VERSION}
|
||||
|
||||
post-patch:
|
||||
@${REINPLACE_CMD} -e 's,/etc,${PREFIX}/etc,g'\
|
||||
${WRKSRC}/tools/dahdi_cfg.c ${WRKSRC}/tools/fxotune.c\
|
||||
|
@ -1,3 +1,9 @@
|
||||
MD5 (dahdi-freebsd-complete-2.4.0-rc3+2.4.0-rc1.tar.gz) = 72f236f905c6f8ac66e3bb4d781cffaa
|
||||
SHA256 (dahdi-freebsd-complete-2.4.0-rc3+2.4.0-rc1.tar.gz) = fb31f1ca76fa89568ba9590a4d65f7e26ab69e45e09587bd0e3b2a97b93ade60
|
||||
SIZE (dahdi-freebsd-complete-2.4.0-rc3+2.4.0-rc1.tar.gz) = 2048903
|
||||
MD5 (dahdi-freebsd-complete-2.4.0-rc4+2.4.0-rc1.tar.gz) = 4246fd70cb196cbfd6eba16a9ce0e434
|
||||
SHA256 (dahdi-freebsd-complete-2.4.0-rc4+2.4.0-rc1.tar.gz) = 17530a885626ded8fb8d8dd6f04dbf3366e90bceda5a6a02a948d49a29ef8b4c
|
||||
SIZE (dahdi-freebsd-complete-2.4.0-rc4+2.4.0-rc1.tar.gz) = 2049406
|
||||
MD5 (oslec-linux-2.6.35.4.tar.gz) = e63e8e7cc4d7338bcb8e526594a34495
|
||||
SHA256 (oslec-linux-2.6.35.4.tar.gz) = 01cfaa1ca64056c822d1a3ebf4f7b3c81127cd7b308ad5b0738ff4eb2026e261
|
||||
SIZE (oslec-linux-2.6.35.4.tar.gz) = 12057
|
||||
MD5 (zaphfc-r5.tar.gz) = 5fbc6110c01b60e6795b5e8424bb4790
|
||||
SHA256 (zaphfc-r5.tar.gz) = 7e809b62dcc2bd3caf2e5a882390051b881eb08d37fea1733d7fb55e80bc6756
|
||||
SIZE (zaphfc-r5.tar.gz) = 15639
|
||||
|
@ -1,3 +1,8 @@
|
||||
# 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)
|
||||
|
12
misc/dahdi/files/patch-freebsd-freebsd-Makefile
Normal file
12
misc/dahdi/files/patch-freebsd-freebsd-Makefile
Normal file
@ -0,0 +1,12 @@
|
||||
--- freebsd/freebsd/Makefile.orig 2010-09-01 01:13:18.000000000 +0700
|
||||
+++ freebsd/freebsd/Makefile 2010-09-01 01:13:33.000000000 +0700
|
||||
@@ -51,6 +51,9 @@
|
||||
wctc4xxp\
|
||||
dahdi-fw-tc400m.bin
|
||||
|
||||
+# Additional drivers
|
||||
+SUBDIR+= ${ADDITIONAL_DRIVERS}
|
||||
+
|
||||
.if ${MACHINE_ARCH} == "i386" || ${MACHINE_ARCH} == "amd64"
|
||||
_dahdi_vpmadt032_loader= dahdi_vpmadt032_loader
|
||||
.endif
|
29
misc/dahdi/files/patch-oslec
Normal file
29
misc/dahdi/files/patch-oslec
Normal file
@ -0,0 +1,29 @@
|
||||
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__ */
|
744
misc/dahdi/files/patch-zaphfc
Normal file
744
misc/dahdi/files/patch-zaphfc
Normal file
@ -0,0 +1,744 @@
|
||||
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-01 03:03:20.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,7 @@
|
||||
}
|
||||
|
||||
chan->open_by_zaptel = TRUE;
|
||||
- try_module_get(THIS_MODULE);
|
||||
+ (void) try_module_get(THIS_MODULE);
|
||||
spin_unlock(&chan->lock);
|
||||
|
||||
switch (chan->number) {
|
||||
@@ -509,12 +580,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 +609,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);
|
||||
@@ -591,7 +662,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 +713,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 +740,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 +756,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 +835,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);
|
||||
@@ -1179,7 +1252,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 +1304,7 @@
|
||||
break;
|
||||
}
|
||||
|
||||
+#if !defined(__FreeBSD__)
|
||||
skb = dev_alloc_skb(frame_size - 3);
|
||||
|
||||
if (!skb) {
|
||||
@@ -1254,6 +1330,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 +1338,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 +1372,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 +1385,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 +1400,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 +1534,7 @@
|
||||
card->cardnum);
|
||||
goto err_request_irq;
|
||||
}
|
||||
+#endif /* !__FreeBSD__ */
|
||||
|
||||
card->nt_mode = FALSE;
|
||||
|
||||
@@ -1419,7 +1551,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 +1592,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 +1634,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 +1687,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 +1705,103 @@
|
||||
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);
|
||||
+
|
||||
+ 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, 0, 0);
|
||||
+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 +1881,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 +1889,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>
|
@ -14,6 +14,7 @@ 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_oslec.ko
|
||||
lib/dahdi/dahdi_echocan_mg2.ko
|
||||
lib/dahdi/dahdi_echocan_sec.ko
|
||||
lib/dahdi/dahdi_echocan_sec2.ko
|
||||
@ -22,6 +23,7 @@ lib/dahdi/dahdi_voicebus.ko
|
||||
%%X86%%lib/dahdi/dahdi_vpmadt032_loader.ko
|
||||
lib/dahdi/linker.hints
|
||||
lib/dahdi/ng_dahdi_netdev.ko
|
||||
lib/dahdi/wcb1xxp.ko
|
||||
lib/dahdi/wcb4xxp.ko
|
||||
lib/dahdi/wcfxo.ko
|
||||
lib/dahdi/wct4xxp.ko
|
||||
|
Loading…
Reference in New Issue
Block a user