summaryrefslogtreecommitdiffstats
path: root/sys/i4b/layer1
diff options
context:
space:
mode:
authorhm <hm@FreeBSD.org>1999-03-07 16:08:20 +0000
committerhm <hm@FreeBSD.org>1999-03-07 16:08:20 +0000
commit7e46cf5dd7cad6e069e50c85ee9a31ca260848fb (patch)
tree03a43e3e3e7f8598823a4548c687c6e4558751c8 /sys/i4b/layer1
parente2549f2539bc2e4543d92ba29f33e4313595b4d4 (diff)
downloadFreeBSD-src-7e46cf5dd7cad6e069e50c85ee9a31ca260848fb.zip
FreeBSD-src-7e46cf5dd7cad6e069e50c85ee9a31ca260848fb.tar.gz
update the i4b kernel part to i4b release 0.71.00
Diffstat (limited to 'sys/i4b/layer1')
-rw-r--r--sys/i4b/layer1/i4b_avm_a1.c6
-rw-r--r--sys/i4b/layer1/i4b_avm_fritz_pci.c1288
-rw-r--r--sys/i4b/layer1/i4b_avm_fritz_pcmcia.c4
-rw-r--r--sys/i4b/layer1/i4b_bchan.c8
-rw-r--r--sys/i4b/layer1/i4b_ctx_s0P.c6
-rw-r--r--sys/i4b/layer1/i4b_drn_ngo.c6
-rw-r--r--sys/i4b/layer1/i4b_dynalink.c4
-rw-r--r--sys/i4b/layer1/i4b_elsa_isdnmc.c26
-rw-r--r--sys/i4b/layer1/i4b_elsa_mcall.c4
-rw-r--r--sys/i4b/layer1/i4b_elsa_qs1i.c15
-rw-r--r--sys/i4b/layer1/i4b_elsa_qs1p.c6
-rw-r--r--sys/i4b/layer1/i4b_hscx.c8
-rw-r--r--sys/i4b/layer1/i4b_hscx.h4
-rw-r--r--sys/i4b/layer1/i4b_ipac.h6
-rw-r--r--sys/i4b/layer1/i4b_isac.c8
-rw-r--r--sys/i4b/layer1/i4b_isac.h4
-rw-r--r--sys/i4b/layer1/i4b_isic.c50
-rw-r--r--sys/i4b/layer1/i4b_isic_isa.c82
-rw-r--r--sys/i4b/layer1/i4b_isic_pci.c67
-rw-r--r--sys/i4b/layer1/i4b_isic_pcmcia.c35
-rw-r--r--sys/i4b/layer1/i4b_isic_pnp.c8
-rw-r--r--sys/i4b/layer1/i4b_itk_ix1.c113
-rw-r--r--sys/i4b/layer1/i4b_l1.c8
-rw-r--r--sys/i4b/layer1/i4b_l1.h98
-rw-r--r--sys/i4b/layer1/i4b_l1fsm.c10
-rw-r--r--sys/i4b/layer1/i4b_sws.c4
-rw-r--r--sys/i4b/layer1/i4b_tel_s016.c6
-rw-r--r--sys/i4b/layer1/i4b_tel_s0163.c191
-rw-r--r--sys/i4b/layer1/i4b_tel_s08.c6
-rw-r--r--sys/i4b/layer1/i4b_tel_s0P.c6
-rw-r--r--sys/i4b/layer1/i4b_usr_sti.c6
-rw-r--r--sys/i4b/layer1/isa_isic.c4
-rw-r--r--sys/i4b/layer1/isapnp_isic.c4
-rw-r--r--sys/i4b/layer1/isic_supio.c4
-rw-r--r--sys/i4b/layer1/pci_isic.c4
-rw-r--r--sys/i4b/layer1/pcmcia_isic.c4
-rw-r--r--sys/i4b/layer1/pcmcia_isic.h4
37 files changed, 1944 insertions, 173 deletions
diff --git a/sys/i4b/layer1/i4b_avm_a1.c b/sys/i4b/layer1/i4b_avm_a1.c
index bb55979..0d20156 100644
--- a/sys/i4b/layer1/i4b_avm_a1.c
+++ b/sys/i4b/layer1/i4b_avm_a1.c
@@ -1,7 +1,7 @@
/*
* Copyright (c) 1996 Andrew Gordon. All rights reserved.
*
- * Copyright (c) 1997, 1998 Hellmuth Michaelis. All rights reserved.
+ * Copyright (c) 1997, 1999 Hellmuth Michaelis. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -35,9 +35,9 @@
* i4b_avm_a1.c - AVM A1/Fritz passive card driver for isdn4bsd
* ------------------------------------------------------------
*
- * $Id: i4b_avm_a1.c,v 1.20 1998/12/16 13:57:21 hm Exp $
+ * $Id: i4b_avm_a1.c,v 1.21 1999/02/14 09:44:58 hm Exp $
*
- * last edit-date: [Wed Dec 16 14:59:59 1998]
+ * last edit-date: [Sun Feb 14 10:25:11 1999]
*
*---------------------------------------------------------------------------*/
diff --git a/sys/i4b/layer1/i4b_avm_fritz_pci.c b/sys/i4b/layer1/i4b_avm_fritz_pci.c
new file mode 100644
index 0000000..da910b6
--- /dev/null
+++ b/sys/i4b/layer1/i4b_avm_fritz_pci.c
@@ -0,0 +1,1288 @@
+/*
+ * Copyright (c) 1999 Gary Jennejohn. All rights reserved.
+ *
+ * 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.
+ * 3. Neither the name of the author nor the names of any co-contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ * 4. Altered versions must be plainly marked as such, and must not be
+ * misrepresented as being the original software and/or documentation.
+ *
+ * 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.
+ *
+ *---------------------------------------------------------------------------
+ *
+ * Fritz!Card PCI specific routines for isic driver
+ * ------------------------------------------------
+ *
+ * $Id: i4b_avm_fritz_pci.c,v 1.1 1999/02/17 14:31:42 hm Exp $
+ *
+ * last edit-date: [Wed Feb 17 15:23:28 1999]
+ *
+ *---------------------------------------------------------------------------*/
+
+#include "isic.h"
+#include "opt_i4b.h"
+
+#if NISIC > 0 && defined(AVM_A1_PCI)
+
+#include <sys/param.h>
+#if defined(__FreeBSD__) && __FreeBSD__ >= 3
+#include <sys/ioccom.h>
+#else
+#include <sys/ioctl.h>
+#endif
+#include <sys/kernel.h>
+#include <sys/systm.h>
+#include <sys/mbuf.h>
+
+#include <machine/clock.h>
+#include <i386/isa/isa_device.h>
+#include <pci/pcivar.h> /* for pcici_t */
+
+#include <sys/socket.h>
+#include <net/if.h>
+
+#include <machine/i4b_debug.h>
+#include <machine/i4b_ioctl.h>
+
+#include <i4b/include/i4b_global.h>
+#include <i4b/include/i4b_l1l2.h>
+#include <i4b/include/i4b_mbuf.h>
+
+#include <i4b/layer1/i4b_l1.h>
+#include <i4b/layer1/i4b_isac.h>
+#include <i4b/layer1/i4b_hscx.h>
+
+/* prototypes */
+static void avma1pp_intr(struct isic_softc *);
+static void avma1pp_disable(struct isic_softc *);
+void avma1pp_map_int(pcici_t , void *, unsigned *);
+static void hscx_write_reg(int, u_int, u_int, struct isic_softc *);
+static u_char hscx_read_reg(int, u_int, struct isic_softc *);
+static u_int hscx_read_reg_int(int, u_int, struct isic_softc *);
+static void hscx_read_fifo(int, void *, size_t, struct isic_softc *);
+static void hscx_write_fifo(int, const void *, size_t, struct isic_softc *);
+static void avma1pp_hscx_int_handler(struct isic_softc *);
+static void avma1pp_hscx_intr(int, u_int, struct isic_softc *);
+static void avma1pp_init_linktab(struct isic_softc *);
+static void avma1pp_bchannel_setup(int, int, int, int);
+static void avma1pp_bchannel_start(int, int);
+static void avma1pp_hscx_init(struct isic_softc *, int, int);
+static void avma1pp_bchannel_stat(int, int, bchan_statistics_t *);
+static void avma1pp_fifo(isic_Bchan_t *, struct isic_softc *);
+static void avma1pp_set_linktab(int, int, drvr_link_t *);
+static isdn_link_t * avma1pp_ret_linktab(int, int);
+extern void isicintr_sc(struct isic_softc *);
+
+/*---------------------------------------------------------------------------*
+ * AVM PCI Fritz!Card special registers
+ *---------------------------------------------------------------------------*/
+
+/*
+ * register offsets from i/o base
+ */
+#define STAT0_OFFSET 0x02
+#define STAT1_OFFSET 0x03
+#define ADDR_REG_OFFSET 0x04
+/*#define MODREG_OFFSET 0x06
+#define VERREG_OFFSET 0x07*/
+/* these 2 are used to select an ISAC register set */
+#define ISAC_LO_REG_OFFSET 0x04
+#define ISAC_HI_REG_OFFSET 0x06
+/* offset higher than this goes to the HI register set */
+#define MAX_LO_REG_OFFSET 0x2f
+/* mask for the offset */
+#define ISAC_REGSET_MASK 0x0f
+/* the offset from the base to the ISAC registers */
+#define ISAC_REG_OFFSET 0x10
+/* the offset from the base to the ISAC FIFO */
+#define ISAC_FIFO 0x02
+/* not really the HSCX, but sort of */
+#define HSCX_FIFO 0x00
+#define HSCX_STAT 0x04
+/*
+ * AVM PCI Status Latch 0 read only bits
+ */
+#define ASL_IRQ_ISAC 0x01 /* ISAC interrupt, active low */
+#define ASL_IRQ_HSCX 0x02 /* HSX interrupt, active low */
+#define ASL_IRQ_TIMER 0x04 /* Timer interrupt, active low */
+#define ASL_IRQ_BCHAN ASL_IRQ_HSCX
+/* actually active LOW */
+#define ASL_IRQ_Pending (ASL_IRQ_ISAC | ASL_IRQ_HSCX | ASL_IRQ_TIMER)
+/*
+ * AVM Status Latch 0 write only bits
+ */
+#define ASL_RESET_ALL 0x01 /* reset siemens IC's, active 1 */
+#define ASL_TIMERDISABLE 0x02 /* active high */
+#define ASL_TIMERRESET 0x04 /* active high */
+#define ASL_ENABLE_INT 0x08 /* active high */
+#define ASL_TESTBIT 0x10 /* active high */
+/*
+ * AVM Status Latch 1 write only bits
+ */
+#define ASL1_INTSEL 0x0f /* active high */
+#define ASL1_ENABLE_IOM 0x80 /* active high */
+
+/*
+ * "HSCX" mode bits
+ */
+#define HSCX_MODE_ITF_FLG 0x01
+#define HSCX_MODE_TRANS 0x02
+#define HSCX_MODE_CCR_7 0x04
+#define HSCX_MODE_CCR_16 0x08
+#define HSCX_MODE_TESTLOOP 0x80
+
+/*
+ * "HSCX" status bits
+ */
+#define HSCX_STAT_RME 0x01
+#define HSCX_STAT_RDO 0x10
+#define HSCX_STAT_CRCVFRRAB 0x0E
+#define HSCX_STAT_CRCVFR 0x06
+#define HSCX_STAT_RML_MASK 0x3f00
+
+/*
+ * "HSCX" interrupt bits
+ */
+#define HSCX_INT_XPR 0x80
+#define HSCX_INT_XDU 0x40
+#define HSCX_INT_RPR 0x20
+#define HSCX_INT_MASK 0xE0
+
+/*
+ * "HSCX" command bits
+ */
+#define HSCX_CMD_XRS 0x80
+#define HSCX_CMD_XME 0x01
+#define HSCX_CMD_RRS 0x20
+#define HSCX_CMD_XML_MASK 0x3f00
+
+/*
+ * Commands and parameters are sent to the "HSCX" as a long, but the
+ * fields are handled as bytes.
+ *
+ * The long contains:
+ * (prot << 16)|(txl << 8)|cmd
+ *
+ * where:
+ * prot = protocol to use
+ * txl = transmit length
+ * cmd = the command to be executed
+ *
+ * The fields are defined as u_char in struct isic_softc.
+ *
+ * Macro to coalesce the byte fields into a u_int
+ */
+#define AVMA1PPSETCMDLONG(f) (f) = ((sc->avma1pp_cmd) | (sc->avma1pp_txl << 8) \
+ | (sc->avma1pp_prot << 16))
+
+/* "fake" addresses for the non-existent HSCX */
+/* note: the unit number is in the lower byte for both the ISAC and "HSCX" */
+#define HSCX0FAKE 0xfa000 /* read: fake0 */
+#define HSCX1FAKE 0xfa100 /* read: fake1 */
+#define IS_HSCX_MASK 0xfff00
+
+/*
+ * to prevent deactivating the "HSCX" when both channels are active we
+ * define an HSCX_ACTIVE flag which is or'd into the channel's state
+ * flag in avma1pp_bchannel_setup upon active and cleared upon deactivation.
+ * It is set high to allow room for new flags.
+ */
+#define HSCX_AVMA1PP_ACTIVE 0x1000
+
+/*---------------------------------------------------------------------------*
+ * AVM read fifo routines
+ *---------------------------------------------------------------------------*/
+static void
+avma1pp_read_fifo(void *buf, const void *base, size_t len)
+{
+ int unit;
+ struct isic_softc *sc;
+
+ unit = (int)base & 0xff;
+ sc = &isic_sc[unit];
+
+ /* check whether the target is an HSCX */
+ if (((int)base & IS_HSCX_MASK) == HSCX0FAKE)
+ {
+ hscx_read_fifo(0, buf, len, sc);
+ return;
+ }
+ if (((int)base & IS_HSCX_MASK) == HSCX1FAKE)
+ {
+ hscx_read_fifo(1, buf, len, sc);
+ return;
+ }
+ /* tell the board to access the ISAC fifo */
+ outb(sc->sc_port + ADDR_REG_OFFSET, ISAC_FIFO);
+ insb(sc->sc_port + ISAC_REG_OFFSET, (u_char *)buf, len);
+}
+
+static void
+hscx_read_fifo(int chan, void *buf, size_t len, struct isic_softc *sc)
+{
+ u_int *ip;
+ size_t cnt;
+
+ outl(sc->sc_port + ADDR_REG_OFFSET, chan);
+ ip = (u_int *)buf;
+ cnt = 0;
+ /* what if len isn't a multiple of sizeof(int) and buf is */
+ /* too small ???? */
+ while (cnt < len)
+ {
+ *ip++ = inl(sc->sc_port + ISAC_REG_OFFSET);
+ cnt += 4;
+ }
+}
+
+/*---------------------------------------------------------------------------*
+ * AVM write fifo routines
+ *---------------------------------------------------------------------------*/
+static void
+avma1pp_write_fifo(void *base, const void *buf, size_t len)
+{
+ int unit;
+ struct isic_softc *sc;
+
+ unit = (int)base & 0xff;
+ sc = &isic_sc[unit];
+
+ /* check whether the target is an HSCX */
+ if (((int)base & IS_HSCX_MASK) == HSCX0FAKE)
+ {
+ hscx_write_fifo(0, buf, len, sc);
+ return;
+ }
+ if (((int)base & IS_HSCX_MASK) == HSCX1FAKE)
+ {
+ hscx_write_fifo(1, buf, len, sc);
+ return;
+ }
+ /* tell the board to use the ISAC fifo */
+ outb(sc->sc_port + ADDR_REG_OFFSET, ISAC_FIFO);
+ outsb(sc->sc_port + ISAC_REG_OFFSET, (u_char *)buf, len);
+}
+
+static void
+hscx_write_fifo(int chan, const void *buf, size_t len, struct isic_softc *sc)
+{
+ register u_int *ip;
+ register size_t cnt;
+ isic_Bchan_t *Bchan = &sc->sc_chan[chan];
+
+ sc->avma1pp_cmd &= ~HSCX_CMD_XME;
+ sc->avma1pp_txl = 0;
+ if (len != sc->sc_bfifolen)
+ {
+ if (Bchan->bprot != BPROT_NONE)
+ sc->avma1pp_cmd |= HSCX_CMD_XME;
+ sc->avma1pp_txl = len;
+ }
+
+ cnt = 0; /* borrow cnt */
+ AVMA1PPSETCMDLONG(cnt);
+ hscx_write_reg(chan, HSCX_STAT, cnt, sc);
+
+ ip = (u_int *)buf;
+ cnt = 0;
+ while (cnt < len)
+ {
+ outl(sc->sc_port + ISAC_REG_OFFSET, *ip++);
+ cnt += 4;
+ }
+}
+
+/*---------------------------------------------------------------------------*
+ * AVM write register routines
+ *---------------------------------------------------------------------------*/
+static void
+avma1pp_write_reg(u_char *base, u_int offset, u_int v)
+{
+ int unit;
+ struct isic_softc *sc;
+ u_char reg_bank;
+
+ unit = (int)base & 0xff;
+ sc = &isic_sc[unit];
+
+ /* check whether the target is an HSCX */
+ if (((int)base & IS_HSCX_MASK) == HSCX0FAKE)
+ {
+ hscx_write_reg(0, offset, v, sc);
+ return;
+ }
+ if (((int)base & IS_HSCX_MASK) == HSCX0FAKE)
+ {
+ hscx_write_reg(1, offset, v, sc);
+ return;
+ }
+ /* must be the ISAC */
+ reg_bank = (offset > MAX_LO_REG_OFFSET) ? ISAC_HI_REG_OFFSET:ISAC_LO_REG_OFFSET;
+#ifdef AVMA1PCI_DEBUG
+ printf("write_reg bank %d off %d.. ", reg_bank, offset);
+#endif
+ /* set the register bank */
+ outb(sc->sc_port + ADDR_REG_OFFSET, reg_bank);
+ outb(sc->sc_port + ISAC_REG_OFFSET + (offset & ISAC_REGSET_MASK), v);
+}
+
+static void
+hscx_write_reg(int chan, u_int off, u_int val, struct isic_softc *sc)
+{
+ /* HACK */
+ if (off == H_MASK)
+ return;
+ /* point at the correct channel */
+ outl(sc->sc_port + ADDR_REG_OFFSET, chan);
+ outl(sc->sc_port + ISAC_REG_OFFSET + off, val);
+}
+
+/*---------------------------------------------------------------------------*
+ * AVM read register routines
+ *---------------------------------------------------------------------------*/
+static u_char
+avma1pp_read_reg(u_char *base, u_int offset)
+{
+ int unit;
+ struct isic_softc *sc;
+ u_char reg_bank;
+
+ unit = (int)base & 0xff;
+ sc = &isic_sc[unit];
+
+ /* check whether the target is an HSCX */
+ if (((int)base & IS_HSCX_MASK) == HSCX0FAKE)
+ return(hscx_read_reg(0, offset, sc));
+ if (((int)base & IS_HSCX_MASK) == HSCX1FAKE)
+ return(hscx_read_reg(1, offset, sc));
+ /* must be the ISAC */
+ reg_bank = (offset > MAX_LO_REG_OFFSET) ? ISAC_HI_REG_OFFSET:ISAC_LO_REG_OFFSET;
+#ifdef AVMA1PCI_DEBUG
+ printf("read_reg bank %d off %d.. ", reg_bank, offset);
+#endif
+ /* set the register bank */
+ outb(sc->sc_port + ADDR_REG_OFFSET, reg_bank);
+ return(inb(sc->sc_port + ISAC_REG_OFFSET +
+ (offset & ISAC_REGSET_MASK)));
+}
+
+static u_char
+hscx_read_reg(int chan, u_int off, struct isic_softc *sc)
+{
+ return(hscx_read_reg_int(chan, off, sc) & 0xff);
+}
+
+/*
+ * need to be able to reeturn an int because the RBCH is in the 2nd
+ * byte.
+ */
+static u_int
+hscx_read_reg_int(int chan, u_int off, struct isic_softc *sc)
+{
+ /* HACK */
+ if (off == H_ISTA)
+ return(0);
+ /* point at the correct channel */
+ outl(sc->sc_port + ADDR_REG_OFFSET, chan);
+ return(inl(sc->sc_port + ISAC_REG_OFFSET + off));
+}
+
+/*---------------------------------------------------------------------------*
+ * isic_attach_avma1pp - attach Fritz!Card PCI
+ *---------------------------------------------------------------------------*/
+int
+isic_attach_avma1pp(int unit, u_int iobase1, u_int iobase2)
+{
+ struct isic_softc *sc = &isic_sc[unit];
+ u_int v;
+
+ /* check max unit range */
+
+ if(unit >= ISIC_MAXUNIT)
+ {
+ printf("isic%d: Error, unit %d >= ISIC_MAXUNIT for AVM FRITZ/PCI!\n",
+ unit, unit);
+ return(0);
+ }
+ sc->sc_unit = unit;
+
+ /* setup iobase */
+
+ if((iobase1 <= 0) || (iobase1 > 0xffff))
+ {
+ printf("isic%d: Error, invalid iobase 0x%x specified for AVM FRITZ/PCI!\n",
+ unit, iobase1);
+ return(0);
+ }
+ sc->sc_port = iobase1;
+
+ /* the ISAC lives at offset 0x10, but we can't use that. */
+ /* instead, put the unit number into the lower byte - HACK */
+ sc->sc_isac = (caddr_t)((int)(iobase1 & ~0xff) + unit);
+
+ /* this thing doesn't have an HSCX, so fake the base addresses */
+ /* put the unit number into the lower byte - HACK */
+ HSCX_A_BASE = (caddr_t)(HSCX0FAKE + unit);
+ HSCX_B_BASE = (caddr_t)(HSCX1FAKE + unit);
+
+ /* setup access routines */
+
+ sc->clearirq = NULL;
+ sc->readreg = avma1pp_read_reg;
+ sc->writereg = avma1pp_write_reg;
+
+ sc->readfifo = avma1pp_read_fifo;
+ sc->writefifo = avma1pp_write_fifo;
+
+ /* setup card type */
+
+ sc->sc_cardtyp = CARD_TYPEP_AVMA1PCI;
+
+ /* setup IOM bus type */
+
+ sc->sc_bustyp = BUS_TYPE_IOM2;
+
+ /* set up some other miscellaneous things */
+ sc->sc_ipac = 0;
+ sc->sc_bfifolen = HSCX_FIFO_LEN;
+
+ /* reset the card */
+ /* the Linux driver does this to clear any pending ISAC interrupts */
+ /* see if it helps any - XXXX */
+ v = 0;
+ v = ISAC_READ(I_STAR);
+#ifdef AVMA1PCI_DEBUG
+ printf("avma1pp_attach: I_STAR %x...", v);
+#endif
+ v = ISAC_READ(I_MODE);
+#ifdef AVMA1PCI_DEBUG
+ printf("avma1pp_attach: I_MODE %x...", v);
+#endif
+ v = ISAC_READ(I_ADF2);
+#ifdef AVMA1PCI_DEBUG
+ printf("avma1pp_attach: I_ADF2 %x...", v);
+#endif
+ v = ISAC_READ(I_ISTA);
+#ifdef AVMA1PCI_DEBUG
+ printf("avma1pp_attach: I_ISTA %x...", v);
+#endif
+ if (v & ISAC_ISTA_EXI)
+ {
+ v = ISAC_READ(I_EXIR);
+#ifdef AVMA1PCI_DEBUG
+ printf("avma1pp_attach: I_EXIR %x...", v);
+#endif
+ }
+ v = ISAC_READ(I_CIRR);
+#ifdef AVMA1PCI_DEBUG
+ printf("avma1pp_attach: I_CIRR %x...", v);
+#endif
+ ISAC_WRITE(I_MASK, 0xff);
+ /* the Linux driver does this to clear any pending HSCX interrupts */
+ v = hscx_read_reg_int(0, HSCX_STAT, sc);
+#ifdef AVMA1PCI_DEBUG
+ printf("avma1pp_attach: 0 HSCX_STAT %x...", v);
+#endif
+ v = hscx_read_reg_int(1, HSCX_STAT, sc);
+#ifdef AVMA1PCI_DEBUG
+ printf("avma1pp_attach: 1 HSCX_STAT %x\n", v);
+#endif
+
+ outb(sc->sc_port + STAT0_OFFSET, ASL_RESET_ALL|ASL_TIMERDISABLE);
+ DELAY(SEC_DELAY/100); /* 10 ms */
+ outb(sc->sc_port + STAT0_OFFSET, ASL_TIMERRESET|ASL_ENABLE_INT|ASL_TIMERDISABLE);
+ DELAY(SEC_DELAY/100); /* 10 ms */
+#ifdef AVMA1PCI_DEBUG
+ outb(sc->sc_port + STAT1_OFFSET, ASL1_ENABLE_IOM|sc->sc_irq);
+ DELAY(SEC_DELAY/100); /* 10 ms */
+ printf("after reset: S1 %#x\n", inb(sc->sc_port + STAT1_OFFSET));
+
+ v = inl(sc->sc_port);
+ printf("isic_attach_avma1pp: v %#x\n", v);
+#endif
+
+ /* from here to the end would normally be done in isic_pciattach */
+
+ /* sc->sc_isac_version = ((ISAC_READ(I_RBCH)) >> 5) & 0x03; */
+ printf("isic%d: ISAC %s (IOM-%c)\n", unit,
+ "2085 Version A1/A2 or 2086/2186 Version 1.1",
+ sc->sc_bustyp == BUS_TYPE_IOM1 ? '1' : '2');
+
+ /* init the ISAC */
+ isic_isac_init(sc);
+
+ /* init the "HSCX" */
+ avma1pp_bchannel_setup(sc->sc_unit, HSCX_CH_A, BPROT_NONE, 0);
+
+ avma1pp_bchannel_setup(sc->sc_unit, HSCX_CH_B, BPROT_NONE, 0);
+
+ /* XXXX - try it here too */
+ /* outb(sc->sc_port + STAT1_OFFSET, ASL1_ENABLE_IOM|sc->sc_irq);
+ DELAY(SEC_DELAY/100); */ /* 10 ms */
+
+ /* can't use the normal B-Channel stuff */
+ avma1pp_init_linktab(sc);
+
+ /* set trace level */
+
+ sc->sc_trace = TRACE_OFF;
+
+ sc->sc_state = ISAC_IDLE;
+
+ sc->sc_ibuf = NULL;
+ sc->sc_ib = NULL;
+ sc->sc_ilen = 0;
+
+ sc->sc_obuf = NULL;
+ sc->sc_op = NULL;
+ sc->sc_ol = 0;
+ sc->sc_freeflag = 0;
+
+ sc->sc_obuf2 = NULL;
+ sc->sc_freeflag2 = 0;
+
+#if defined(__FreeBSD__) && __FreeBSD__ >=3
+ callout_handle_init(&sc->sc_T3_callout);
+ callout_handle_init(&sc->sc_T4_callout);
+#endif
+
+ /* init higher protocol layers */
+
+ MPH_Status_Ind(sc->sc_unit, STI_ATTACH, sc->sc_cardtyp);
+
+ return(1);
+}
+
+/*
+ * this is the real interrupt routine
+ */
+static void
+avma1pp_hscx_intr(int h_chan, u_int stat, struct isic_softc *sc)
+{
+ register isic_Bchan_t *chan = &sc->sc_chan[h_chan];
+ int activity = -1;
+ u_int param = 0;
+
+ DBGL1(L1_H_IRQ, "avma1pp_hscx_intr", ("%#x\n", stat));
+
+ if((stat & HSCX_INT_XDU) && (chan->bprot != BPROT_NONE))/* xmit data underrun */
+ {
+ chan->stat_XDU++;
+ DBGL1(L1_H_XFRERR, "avma1pp_hscx_intr", ("xmit data underrun\n"));
+ /* abort the transmission */
+ sc->avma1pp_txl = 0;
+ sc->avma1pp_cmd |= HSCX_CMD_XRS;
+ AVMA1PPSETCMDLONG(param);
+ hscx_write_reg(h_chan, HSCX_STAT, param, sc);
+ sc->avma1pp_cmd &= ~HSCX_CMD_XRS;
+ AVMA1PPSETCMDLONG(param);
+ hscx_write_reg(h_chan, HSCX_STAT, param, sc);
+
+ if (chan->out_mbuf_head != NULL) /* don't continue to transmit this buffer */
+ {
+ i4b_Bfreembuf(chan->out_mbuf_head);
+ chan->out_mbuf_cur = chan->out_mbuf_head = NULL;
+ }
+ }
+
+ /*
+ * The following is based on examination of the Linux driver. Who
+ * knows whether it's entirely correct ?
+ *
+ * The logic here is different than with a "real" HSCX; all kinds
+ * of information (interrupt/status bits) are in stat.
+ * HSCX_INT_RPR indicates a receive interrupt
+ * HSCX_STAT_RDO indicates an overrun condition, abort -
+ * otherwise read the bytes ((stat & HSCX_STZT_RML_MASK) >> 8)
+ * HSCX_STAT_RME indicates end-of-frame and apparently any
+ * CRC/framing errors are only reported in this state.
+ * if ((stat & HSCX_STAT_CRCVFRRAB) != HSCX_STAT_CRCVFR)
+ * CRC/framing error
+ */
+
+ if(stat & HSCX_INT_RPR)
+ {
+ register int fifo_data_len;
+ int error = 0;
+ /* always have to read the FIFO, so use a scratch buffer */
+ u_char scrbuf[HSCX_FIFO_LEN];
+
+ if(stat & HSCX_STAT_RDO)
+ {
+ chan->stat_RDO++;
+ DBGL1(L1_H_XFRERR, "avma1pp_hscx_intr", ("receive data overflow\n"));
+ error++;
+ }
+
+ fifo_data_len = ((stat & HSCX_STAT_RML_MASK) >> 8);
+
+ if(fifo_data_len == 0)
+ fifo_data_len = sc->sc_bfifolen;
+
+ /* ALWAYS read data from HSCX fifo */
+
+ HSCX_RDFIFO(h_chan, scrbuf, fifo_data_len);
+ chan->rxcount += fifo_data_len;
+
+ /* all error conditions checked, now decide and take action */
+
+ if(error == 0)
+ {
+ if(chan->in_mbuf == NULL)
+ {
+ if((chan->in_mbuf = i4b_Bgetmbuf(BCH_MAX_DATALEN)) == NULL)
+ panic("L1 avma1pp_hscx_intr: RME, cannot allocate mbuf!\n");
+ chan->in_cbptr = chan->in_mbuf->m_data;
+ chan->in_len = 0;
+ }
+
+ if((chan->in_len + fifo_data_len) <= BCH_MAX_DATALEN)
+ {
+ /* OK to copy the data */
+ bcopy(scrbuf, chan->in_cbptr, fifo_data_len);
+ chan->in_cbptr += fifo_data_len;
+ chan->in_len += fifo_data_len;
+
+ /* setup mbuf data length */
+
+ chan->in_mbuf->m_len = chan->in_len;
+ chan->in_mbuf->m_pkthdr.len = chan->in_len;
+
+ if(sc->sc_trace & TRACE_B_RX)
+ {
+ i4b_trace_hdr_t hdr;
+ hdr.unit = sc->sc_unit;
+ hdr.type = (h_chan == HSCX_CH_A ? TRC_CH_B1 : TRC_CH_B2);
+ hdr.dir = FROM_NT;
+ hdr.count = ++sc->sc_trace_bcount;
+ MICROTIME(hdr.time);
+ MPH_Trace_Ind(&hdr, chan->in_mbuf->m_len, chan->in_mbuf->m_data);
+ }
+
+ if (stat & HSCX_STAT_RME)
+ {
+ if((stat & HSCX_STAT_CRCVFRRAB) == HSCX_STAT_CRCVFR)
+ {
+ (*chan->drvr_linktab->bch_rx_data_ready)(chan->drvr_linktab->unit);
+ activity = ACT_RX;
+
+ /* mark buffer ptr as unused */
+
+ chan->in_mbuf = NULL;
+ chan->in_cbptr = NULL;
+ chan->in_len = 0;
+ }
+ else
+ {
+ chan->stat_CRC++;
+ DBGL1(L1_H_XFRERR, "avma1pp_hscx_intr", ("CRC/RAB\n"));
+ if (chan->in_mbuf != NULL)
+ {
+ i4b_Bfreembuf(chan->in_mbuf);
+ chan->in_mbuf = NULL;
+ chan->in_cbptr = NULL;
+ chan->in_len = 0;
+ }
+ }
+ }
+ } /* END enough space in mbuf */
+ else
+ {
+ if(chan->bprot == BPROT_NONE)
+ {
+ /* setup mbuf data length */
+
+ chan->in_mbuf->m_len = chan->in_len;
+ chan->in_mbuf->m_pkthdr.len = chan->in_len;
+
+ if(sc->sc_trace & TRACE_B_RX)
+ {
+ i4b_trace_hdr_t hdr;
+ hdr.unit = sc->sc_unit;
+ hdr.type = (h_chan == HSCX_CH_A ? TRC_CH_B1 : TRC_CH_B2);
+ hdr.dir = FROM_NT;
+ hdr.count = ++sc->sc_trace_bcount;
+ MICROTIME(hdr.time);
+ MPH_Trace_Ind(&hdr, chan->in_mbuf->m_len, chan->in_mbuf->m_data);
+ }
+
+ /* move rx'd data to rx queue */
+
+ IF_ENQUEUE(&chan->rx_queue, chan->in_mbuf);
+
+ (*chan->drvr_linktab->bch_rx_data_ready)(chan->drvr_linktab->unit);
+
+ if(!(isic_hscx_silence(chan->in_mbuf->m_data, chan->in_mbuf->m_len)))
+ activity = ACT_RX;
+
+ /* alloc new buffer */
+
+ if((chan->in_mbuf = i4b_Bgetmbuf(BCH_MAX_DATALEN)) == NULL)
+ panic("L1 avma1pp_hscx_intr: RPF, cannot allocate new mbuf!\n");
+
+ /* setup new data ptr */
+
+ chan->in_cbptr = chan->in_mbuf->m_data;
+
+ /* OK to copy the data */
+ bcopy(scrbuf, chan->in_cbptr, fifo_data_len);
+
+ chan->in_cbptr += fifo_data_len;
+ chan->in_len = fifo_data_len;
+
+ chan->rxcount += fifo_data_len;
+ }
+ else
+ {
+ DBGL1(L1_H_XFRERR, "avma1pp_hscx_intr", ("RAWHDLC rx buffer overflow in RPF, in_len=%d\n", chan->in_len));
+ chan->in_cbptr = chan->in_mbuf->m_data;
+ chan->in_len = 0;
+ }
+ }
+ } /* if(error == 0) */
+ else
+ {
+ /* land here for RDO */
+ if (chan->in_mbuf != NULL)
+ {
+ i4b_Bfreembuf(chan->in_mbuf);
+ chan->in_mbuf = NULL;
+ chan->in_cbptr = NULL;
+ chan->in_len = 0;
+ }
+ sc->avma1pp_txl = 0;
+ sc->avma1pp_cmd |= HSCX_CMD_RRS;
+ AVMA1PPSETCMDLONG(param);
+ hscx_write_reg(h_chan, HSCX_STAT, param, sc);
+ sc->avma1pp_cmd &= ~HSCX_CMD_RRS;
+ AVMA1PPSETCMDLONG(param);
+ hscx_write_reg(h_chan, HSCX_STAT, param, sc);
+ }
+ }
+
+
+ /* transmit fifo empty, new data can be written to fifo */
+
+ if(stat & HSCX_INT_XPR)
+ {
+ /*
+ * for a description what is going on here, please have
+ * a look at isic_bchannel_start() in i4b_bchan.c !
+ */
+
+ /* int len;
+ int nextlen; */
+
+ DBGL1(L1_H_IRQ, "avma1pp_hscx_intr", ("unit %d, chan %d - XPR, Tx Fifo Empty!\n", sc->sc_unit, h_chan));
+
+ if(chan->out_mbuf_cur == NULL) /* last frame is transmitted */
+ {
+ IF_DEQUEUE(&chan->tx_queue, chan->out_mbuf_head);
+
+ if(chan->out_mbuf_head == NULL)
+ {
+ chan->state &= ~HSCX_TX_ACTIVE;
+ (*chan->drvr_linktab->bch_tx_queue_empty)(chan->drvr_linktab->unit);
+ }
+ else
+ {
+ chan->state |= HSCX_TX_ACTIVE;
+ chan->out_mbuf_cur = chan->out_mbuf_head;
+ chan->out_mbuf_cur_ptr = chan->out_mbuf_cur->m_data;
+ chan->out_mbuf_cur_len = chan->out_mbuf_cur->m_len;
+
+ if(sc->sc_trace & TRACE_B_TX)
+ {
+ i4b_trace_hdr_t hdr;
+ hdr.unit = sc->sc_unit;
+ hdr.type = (h_chan == HSCX_CH_A ? TRC_CH_B1 : TRC_CH_B2);
+ hdr.dir = FROM_TE;
+ hdr.count = ++sc->sc_trace_bcount;
+ MICROTIME(hdr.time);
+ MPH_Trace_Ind(&hdr, chan->out_mbuf_cur->m_len, chan->out_mbuf_cur->m_data);
+ }
+
+ if(chan->bprot == BPROT_NONE)
+ {
+ if(!(isic_hscx_silence(chan->out_mbuf_cur->m_data, chan->out_mbuf_cur->m_len)))
+ activity = ACT_TX;
+ }
+ else
+ {
+ activity = ACT_TX;
+ }
+ }
+ }
+
+ avma1pp_fifo(chan, sc);
+ }
+
+ /* call timeout handling routine */
+
+ if(activity == ACT_RX || activity == ACT_TX)
+ (*chan->drvr_linktab->bch_activity)(chan->drvr_linktab->unit, activity);
+}
+
+/*
+ * this is the main routine which checks each channel and then calls
+ * the real interrupt routine as appropriate
+ */
+static void
+avma1pp_hscx_int_handler(struct isic_softc *sc)
+{
+ u_int stat;
+
+ /* has to be a u_int because the byte count is in the 2nd byte */
+ stat = hscx_read_reg_int(0, HSCX_STAT, sc);
+ if (stat & HSCX_INT_MASK)
+ avma1pp_hscx_intr(0, stat, sc);
+ stat = hscx_read_reg_int(1, HSCX_STAT, sc);
+ if (stat & HSCX_INT_MASK)
+ avma1pp_hscx_intr(1, stat, sc);
+}
+
+static void
+avma1pp_disable(struct isic_softc *sc)
+{
+ outb(sc->sc_port + STAT0_OFFSET, ASL_RESET_ALL|ASL_TIMERDISABLE);
+}
+
+static void
+avma1pp_intr(struct isic_softc *sc)
+{
+ u_char stat;
+
+ stat = inb(sc->sc_port + STAT0_OFFSET);
+ DBGL1(L1_H_IRQ, "avma1pp_intr", ("stat %x\n", stat));
+ /* was there an interrupt from this card ? */
+ if ((stat & ASL_IRQ_Pending) == ASL_IRQ_Pending)
+ return; /* no */
+ /* interrupts are low active */
+ if (!(stat & ASL_IRQ_TIMER))
+ DBGL1(L1_H_IRQ, "avma1pp_intr", ("timer interrupt ???\n"));
+ if (!(stat & ASL_IRQ_HSCX))
+ {
+ DBGL1(L1_H_IRQ, "avma1pp_intr", ("HSCX\n"));
+ avma1pp_hscx_int_handler(sc);
+ }
+ if (!(stat & ASL_IRQ_ISAC))
+ {
+ DBGL1(L1_H_IRQ, "avma1pp_intr", ("ISAC\n"));
+ isicintr_sc(sc);
+ }
+}
+
+void
+avma1pp_map_int(pcici_t config_id, void *pisc, unsigned *net_imask)
+{
+ struct isic_softc *sc = (struct isic_softc *)pisc;
+
+ /* may need the irq later */
+ sc->sc_irq = config_id->intline;
+
+ if(!(pci_map_int(config_id, (void *)avma1pp_intr, sc, net_imask)))
+ {
+ printf("Failed to map interrupt for AVM Fritz!Card PCI\n");
+ /* disable the card */
+ avma1pp_disable(sc);
+ }
+}
+
+static void
+avma1pp_hscx_init(struct isic_softc *sc, int h_chan, int activate)
+{
+ isic_Bchan_t *chan = &sc->sc_chan[h_chan];
+ u_int param = 0;
+
+ DBGL1(L1_BCHAN, "avma1pp_hscx_init", ("unit=%d, channel=%d, %s\n",
+ sc->sc_unit, h_chan, activate ? "activate" : "deactivate"));
+
+ if (activate == 0)
+ {
+ /* only deactivate if both channels are idle */
+ if (sc->sc_chan[HSCX_CH_A].state != HSCX_IDLE ||
+ sc->sc_chan[HSCX_CH_B].state != HSCX_IDLE)
+ {
+ return;
+ }
+ sc->avma1pp_cmd = HSCX_CMD_XRS|HSCX_CMD_RRS;
+ sc->avma1pp_prot = HSCX_MODE_TRANS;
+ AVMA1PPSETCMDLONG(param);
+ hscx_write_reg(h_chan, HSCX_STAT, param, sc);
+ return;
+ }
+ if(chan->bprot == BPROT_RHDLC)
+ {
+ DBGL1(L1_BCHAN, "avma1pp_hscx_init", ("BPROT_RHDLC\n"));
+
+ /* HDLC Frames, transparent mode 0 */
+ sc->avma1pp_cmd = HSCX_CMD_XRS|HSCX_CMD_RRS;
+ sc->avma1pp_prot = HSCX_MODE_ITF_FLG;
+ AVMA1PPSETCMDLONG(param);
+ hscx_write_reg(h_chan, HSCX_STAT, param, sc);
+ sc->avma1pp_cmd = HSCX_CMD_XRS;
+ AVMA1PPSETCMDLONG(param);
+ hscx_write_reg(h_chan, HSCX_STAT, param, sc);
+ sc->avma1pp_cmd = 0;
+ }
+ else
+ {
+ DBGL1(L1_BCHAN, "avma1pp_hscx_init", ("BPROT_NONE??\n"));
+
+ /* Raw Telephony, extended transparent mode 1 */
+ sc->avma1pp_cmd = HSCX_CMD_XRS|HSCX_CMD_RRS;
+ sc->avma1pp_prot = HSCX_MODE_TRANS;
+ AVMA1PPSETCMDLONG(param);
+ hscx_write_reg(h_chan, HSCX_STAT, param, sc);
+ sc->avma1pp_cmd = HSCX_CMD_XRS;
+ AVMA1PPSETCMDLONG(param);
+ hscx_write_reg(h_chan, HSCX_STAT, param, sc);
+ sc->avma1pp_cmd = 0;
+ }
+}
+
+static void
+avma1pp_bchannel_setup(int unit, int h_chan, int bprot, int activate)
+{
+#ifdef __FreeBSD__
+ struct isic_softc *sc = &isic_sc[unit];
+#else
+ struct isic_softc *sc = isic_find_sc(unit);
+#endif
+ isic_Bchan_t *chan = &sc->sc_chan[h_chan];
+
+ int s = SPLI4B();
+
+ if(activate == 0)
+ {
+ /* deactivation */
+ chan->state &= ~HSCX_AVMA1PP_ACTIVE;
+ avma1pp_hscx_init(sc, h_chan, activate);
+ }
+
+ DBGL1(L1_BCHAN, "avma1pp_bchannel_setup", ("unit=%d, channel=%d, %s\n",
+ sc->sc_unit, h_chan, activate ? "activate" : "deactivate"));
+
+ /* general part */
+
+ chan->unit = sc->sc_unit; /* unit number */
+ chan->channel = h_chan; /* B channel */
+ chan->bprot = bprot; /* B channel protocol */
+ chan->state = HSCX_IDLE; /* B channel state */
+
+ /* receiver part */
+
+ i4b_Bcleanifq(&chan->rx_queue); /* clean rx queue */
+
+ chan->rx_queue.ifq_maxlen = IFQ_MAXLEN;
+
+ chan->rxcount = 0; /* reset rx counter */
+
+ i4b_Bfreembuf(chan->in_mbuf); /* clean rx mbuf */
+
+ chan->in_mbuf = NULL; /* reset mbuf ptr */
+ chan->in_cbptr = NULL; /* reset mbuf curr ptr */
+ chan->in_len = 0; /* reset mbuf data len */
+
+ /* transmitter part */
+
+ i4b_Bcleanifq(&chan->tx_queue); /* clean tx queue */
+
+ chan->tx_queue.ifq_maxlen = IFQ_MAXLEN;
+
+ chan->txcount = 0; /* reset tx counter */
+
+ i4b_Bfreembuf(chan->out_mbuf_head); /* clean tx mbuf */
+
+ chan->out_mbuf_head = NULL; /* reset head mbuf ptr */
+ chan->out_mbuf_cur = NULL; /* reset current mbuf ptr */
+ chan->out_mbuf_cur_ptr = NULL; /* reset current mbuf data ptr */
+ chan->out_mbuf_cur_len = 0; /* reset current mbuf data cnt */
+
+ if(activate != 0)
+ {
+ /* activation */
+ avma1pp_hscx_init(sc, h_chan, activate);
+ chan->state |= HSCX_AVMA1PP_ACTIVE;
+ }
+
+ splx(s);
+}
+
+static void
+avma1pp_bchannel_start(int unit, int h_chan)
+{
+#ifdef __FreeBSD__
+ struct isic_softc *sc = &isic_sc[unit];
+#else
+ struct isic_softc *sc = isic_find_sc(unit);
+#endif
+
+ register isic_Bchan_t *chan = &sc->sc_chan[h_chan];
+
+ int s;
+ int activity = -1;
+#if 0 /* moved to avma1pp_fifo */
+ /* the "HSCX" probably only allows writing all bytes at once */
+ /* so we need a scratch buffer to collect the bytes */
+ u_char scrbuf[HSCX_FIFO_LEN];
+ int i;
+ register int next_len;
+ register int len;
+#endif
+
+ s = SPLI4B(); /* enter critical section */
+ if(chan->state & HSCX_TX_ACTIVE) /* already running ? */
+ {
+ splx(s);
+ return; /* yes, leave */
+ }
+
+ /* get next mbuf from queue */
+
+ IF_DEQUEUE(&chan->tx_queue, chan->out_mbuf_head);
+
+ if(chan->out_mbuf_head == NULL) /* queue empty ? */
+ {
+ splx(s); /* leave critical section */
+ return; /* yes, exit */
+ }
+
+ /* init current mbuf values */
+
+ chan->out_mbuf_cur = chan->out_mbuf_head;
+ chan->out_mbuf_cur_len = chan->out_mbuf_cur->m_len;
+ chan->out_mbuf_cur_ptr = chan->out_mbuf_cur->m_data;
+
+ /* activity indicator for timeout handling */
+
+ if(chan->bprot == BPROT_NONE)
+ {
+ if(!(isic_hscx_silence(chan->out_mbuf_cur->m_data, chan->out_mbuf_cur->m_len)))
+ activity = ACT_TX;
+ }
+ else
+ {
+ activity = ACT_TX;
+ }
+
+ chan->state |= HSCX_TX_ACTIVE; /* we start transmitting */
+
+ if(sc->sc_trace & TRACE_B_TX) /* if trace, send mbuf to trace dev */
+ {
+ i4b_trace_hdr_t hdr;
+ hdr.unit = unit;
+ hdr.type = (h_chan == HSCX_CH_A ? TRC_CH_B1 : TRC_CH_B2);
+ hdr.dir = FROM_TE;
+ hdr.count = ++sc->sc_trace_bcount;
+ MICROTIME(hdr.time);
+ MPH_Trace_Ind(&hdr, chan->out_mbuf_cur->m_len, chan->out_mbuf_cur->m_data);
+ }
+
+ avma1pp_fifo(chan, sc);
+
+ /* call timeout handling routine */
+
+ if(activity == ACT_RX || activity == ACT_TX)
+ (*chan->drvr_linktab->bch_activity)(chan->drvr_linktab->unit, activity);
+
+ splx(s);
+}
+
+/*---------------------------------------------------------------------------*
+ * return the address of isic drivers linktab
+ *---------------------------------------------------------------------------*/
+static isdn_link_t *
+avma1pp_ret_linktab(int unit, int channel)
+{
+#ifdef __FreeBSD__
+ struct isic_softc *sc = &isic_sc[unit];
+#else
+ struct isic_softc *sc = isic_find_sc(unit);
+#endif
+ isic_Bchan_t *chan = &sc->sc_chan[channel];
+
+ return(&chan->isdn_linktab);
+}
+
+/*---------------------------------------------------------------------------*
+ * set the driver linktab in the b channel softc
+ *---------------------------------------------------------------------------*/
+static void
+avma1pp_set_linktab(int unit, int channel, drvr_link_t *dlt)
+{
+#ifdef __FreeBSD__
+ struct isic_softc *sc = &isic_sc[unit];
+#else
+ struct isic_softc *sc = isic_find_sc(unit);
+#endif
+ isic_Bchan_t *chan = &sc->sc_chan[channel];
+
+ chan->drvr_linktab = dlt;
+}
+
+
+/*---------------------------------------------------------------------------*
+ * initialize our local linktab
+ *---------------------------------------------------------------------------*/
+static void
+avma1pp_init_linktab(struct isic_softc *sc)
+{
+ isic_Bchan_t *chan = &sc->sc_chan[HSCX_CH_A];
+ isdn_link_t *lt = &chan->isdn_linktab;
+
+ /* make sure the hardware driver is known to layer 4 */
+ /* avoid overwriting if already set */
+ if (ctrl_types[CTRL_PASSIVE].set_linktab == NULL)
+ {
+ ctrl_types[CTRL_PASSIVE].set_linktab = avma1pp_set_linktab;
+ ctrl_types[CTRL_PASSIVE].get_linktab = avma1pp_ret_linktab;
+ }
+
+ /* local setup */
+ lt->unit = sc->sc_unit;
+ lt->channel = HSCX_CH_A;
+ lt->bch_config = avma1pp_bchannel_setup;
+ lt->bch_tx_start = avma1pp_bchannel_start;
+ lt->bch_stat = avma1pp_bchannel_stat;
+ lt->tx_queue = &chan->tx_queue;
+
+ /* used by non-HDLC data transfers, i.e. telephony drivers */
+ lt->rx_queue = &chan->rx_queue;
+
+ /* used by HDLC data transfers, i.e. ipr and isp drivers */
+ lt->rx_mbuf = &chan->in_mbuf;
+
+ chan = &sc->sc_chan[HSCX_CH_B];
+ lt = &chan->isdn_linktab;
+
+ lt->unit = sc->sc_unit;
+ lt->channel = HSCX_CH_B;
+ lt->bch_config = avma1pp_bchannel_setup;
+ lt->bch_tx_start = avma1pp_bchannel_start;
+ lt->bch_stat = avma1pp_bchannel_stat;
+ lt->tx_queue = &chan->tx_queue;
+
+ /* used by non-HDLC data transfers, i.e. telephony drivers */
+ lt->rx_queue = &chan->rx_queue;
+
+ /* used by HDLC data transfers, i.e. ipr and isp drivers */
+ lt->rx_mbuf = &chan->in_mbuf;
+}
+
+/*
+ * use this instead of isic_bchannel_stat in i4b_bchan.c because it's static
+ */
+static void
+avma1pp_bchannel_stat(int unit, int h_chan, bchan_statistics_t *bsp)
+{
+#ifdef __FreeBSD__
+ struct isic_softc *sc = &isic_sc[unit];
+#else
+ struct isic_softc *sc = isic_find_sc(unit);
+#endif
+ isic_Bchan_t *chan = &sc->sc_chan[h_chan];
+ int s;
+
+ s = SPLI4B();
+
+ bsp->outbytes = chan->txcount;
+ bsp->inbytes = chan->rxcount;
+
+ chan->txcount = 0;
+ chan->rxcount = 0;
+
+ splx(s);
+}
+
+/*
+ * moved here from avma1pp_bchan_start and avma1pp_hscx_intr
+ */
+static void
+avma1pp_fifo(isic_Bchan_t *chan, struct isic_softc *sc)
+{
+ int len;
+ int nextlen;
+ int i;
+ /* the "HSCX" probably only allows writing all bytes at once */
+ /* so we need a scratch buffer to collect the bytes */
+ u_char scrbuf[HSCX_FIFO_LEN];
+
+ len = 0;
+
+ while(chan->out_mbuf_cur && len != sc->sc_bfifolen)
+ {
+ nextlen = min(chan->out_mbuf_cur_len, sc->sc_bfifolen - len);
+
+#ifdef NOTDEF
+ printf("i:mh=%p, mc=%p, mcp=%p, mcl=%d l=%d nl=%d # ",
+ chan->out_mbuf_head,
+ chan->out_mbuf_cur,
+ chan->out_mbuf_cur_ptr,
+ chan->out_mbuf_cur_len,
+ len,
+ nextlen);
+#endif
+
+ /* collect the data in the scratch buffer */
+ for (i = 0; i < nextlen; i++)
+ scrbuf[i + len] = chan->out_mbuf_cur_ptr[i];
+
+ len += nextlen;
+ chan->txcount += nextlen;
+
+ chan->out_mbuf_cur_ptr += nextlen;
+ chan->out_mbuf_cur_len -= nextlen;
+
+ if(chan->out_mbuf_cur_len == 0)
+ {
+ if((chan->out_mbuf_cur = chan->out_mbuf_cur->m_next) != NULL)
+ {
+ chan->out_mbuf_cur_ptr = chan->out_mbuf_cur->m_data;
+ chan->out_mbuf_cur_len = chan->out_mbuf_cur->m_len;
+
+ if(sc->sc_trace & TRACE_B_TX)
+ {
+ i4b_trace_hdr_t hdr;
+ hdr.unit = sc->sc_unit;
+ hdr.type = (chan->channel == HSCX_CH_A ? TRC_CH_B1 : TRC_CH_B2);
+ hdr.dir = FROM_TE;
+ hdr.count = ++sc->sc_trace_bcount;
+ MICROTIME(hdr.time);
+ MPH_Trace_Ind(&hdr, chan->out_mbuf_cur->m_len, chan->out_mbuf_cur->m_data);
+ }
+ }
+ else
+ {
+ i4b_Bfreembuf(chan->out_mbuf_head);
+ chan->out_mbuf_head = NULL;
+ }
+ }
+ }
+ /* write what we have from the scratch buf to the "HSCX" fifo */
+
+ /* HSCX_WRFIFO also sets the XME */
+ HSCX_WRFIFO(chan->channel, scrbuf, len);
+}
+
+#endif /* NISIC > 0 && defined(AVM_A1_PCI) */
diff --git a/sys/i4b/layer1/i4b_avm_fritz_pcmcia.c b/sys/i4b/layer1/i4b_avm_fritz_pcmcia.c
index 483eb66..a4ee3e8 100644
--- a/sys/i4b/layer1/i4b_avm_fritz_pcmcia.c
+++ b/sys/i4b/layer1/i4b_avm_fritz_pcmcia.c
@@ -33,9 +33,9 @@
* Fritz!Card pcmcia specific routines for isic driver
* ---------------------------------------------------
*
- * $Id: i4b_avm_fritz_pcmcia.c,v 1.7 1998/12/01 21:25:53 hm Exp $
+ * $Id: i4b_avm_fritz_pcmcia.c,v 1.8 1999/02/14 09:44:58 hm Exp $
*
- * last edit-date: [Tue Dec 1 22:03:51 1998]
+ * last edit-date: [Sun Feb 14 10:25:21 1999]
*
* -ap added support for AVM PCMCIA Fritz!Card
* -mh split into separate file
diff --git a/sys/i4b/layer1/i4b_bchan.c b/sys/i4b/layer1/i4b_bchan.c
index 17ee273..e047c93 100644
--- a/sys/i4b/layer1/i4b_bchan.c
+++ b/sys/i4b/layer1/i4b_bchan.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 1998 Hellmuth Michaelis. All rights reserved.
+ * Copyright (c) 1997, 1999 Hellmuth Michaelis. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -27,9 +27,9 @@
* i4b_bchan.c - B channel handling L1 procedures
* ----------------------------------------------
*
- * $Id: i4b_bchan.c,v 1.28 1998/12/05 18:04:28 hm Exp $
+ * $Id: i4b_bchan.c,v 1.30 1999/02/14 19:51:01 hm Exp $
*
- * last edit-date: [Sat Dec 5 18:21:57 1998]
+ * last edit-date: [Sun Feb 14 10:25:27 1999]
*
*---------------------------------------------------------------------------*/
@@ -56,7 +56,9 @@
#include <machine/clock.h>
#include <i386/isa/isa_device.h>
#else
+#ifndef __bsdi__
#include <machine/bus.h>
+#endif
#include <sys/device.h>
#endif
diff --git a/sys/i4b/layer1/i4b_ctx_s0P.c b/sys/i4b/layer1/i4b_ctx_s0P.c
index f9e6b7f..b5314db 100644
--- a/sys/i4b/layer1/i4b_ctx_s0P.c
+++ b/sys/i4b/layer1/i4b_ctx_s0P.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 1998 Hellmuth Michaelis. All rights reserved.
+ * Copyright (c) 1997, 1999 Hellmuth Michaelis. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -27,9 +27,9 @@
* isic - I4B Siemens ISDN Chipset Driver for Creatix PnP cards
* ============================================================
*
- * $Id: i4b_ctx_s0P.c,v 1.17 1998/12/16 09:32:50 hm Exp $
+ * $Id: i4b_ctx_s0P.c,v 1.18 1999/02/14 09:44:58 hm Exp $
*
- * last edit-date: [Mon Dec 14 17:26:30 1998]
+ * last edit-date: [Sun Feb 14 10:25:33 1999]
*
*---------------------------------------------------------------------------*/
diff --git a/sys/i4b/layer1/i4b_drn_ngo.c b/sys/i4b/layer1/i4b_drn_ngo.c
index a5f3d69..75aa990 100644
--- a/sys/i4b/layer1/i4b_drn_ngo.c
+++ b/sys/i4b/layer1/i4b_drn_ngo.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 1998 Hellmuth Michaelis. All rights reserved.
+ * Copyright (c) 1997, 1999 Hellmuth Michaelis. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -27,9 +27,9 @@
* i4b_drn_ngo.c - Dr. Neuhaus Niccy GO@ and SAGEM Cybermod
* --------------------------------------------------------
*
- * $Id: i4b_drn_ngo.c,v 1.19 1998/12/16 09:32:50 hm Exp $
+ * $Id: i4b_drn_ngo.c,v 1.20 1999/02/14 09:44:58 hm Exp $
*
- * last edit-date: [Mon Dec 14 17:26:03 1998]
+ * last edit-date: [Sun Feb 14 10:25:39 1999]
*
*---------------------------------------------------------------------------*/
diff --git a/sys/i4b/layer1/i4b_dynalink.c b/sys/i4b/layer1/i4b_dynalink.c
index 846e79a..e316682 100644
--- a/sys/i4b/layer1/i4b_dynalink.c
+++ b/sys/i4b/layer1/i4b_dynalink.c
@@ -33,9 +33,9 @@
* isdn4bsd layer1 driver for Dynalink IS64PH isdn TA
* ==================================================
*
- * $Id: i4b_dynalink.c,v 1.8 1998/12/17 04:55:38 hm Exp $
+ * $Id: i4b_dynalink.c,v 1.9 1999/02/14 09:44:58 hm Exp $
*
- * last edit-date: [Thu Dec 17 05:50:39 1998]
+ * last edit-date: [Sun Feb 14 10:26:21 1999]
*
* written by Martijn Plak <tigrfhur@xs4all.nl>
*
diff --git a/sys/i4b/layer1/i4b_elsa_isdnmc.c b/sys/i4b/layer1/i4b_elsa_isdnmc.c
index c6987f5..1924fce 100644
--- a/sys/i4b/layer1/i4b_elsa_isdnmc.c
+++ b/sys/i4b/layer1/i4b_elsa_isdnmc.c
@@ -33,9 +33,9 @@
* ELSA MicroLink ISDN/MC card specific routines
* ---------------------------------------------
*
- * $Id: i4b_elsa_isdnmc.c,v 1.2 1998/12/05 18:04:33 hm Exp $
+ * $Id: i4b_elsa_isdnmc.c,v 1.4 1999/02/14 09:44:59 hm Exp $
*
- * last edit-date: [Tue Dec 1 07:45:53 1998]
+ * last edit-date: [Sun Feb 14 10:26:25 1999]
*
* -mh added support for elsa ISDN/mc
*
@@ -94,6 +94,7 @@ static u_int8_t elsa_isdnmc_read_reg __P((struct isic_softc *sc, int what, bus_s
static void elsa_isdnmc_write_reg __P((struct isic_softc *sc, int what, bus_size_t offs, u_int8_t data));
static void elsa_isdnmc_read_fifo __P((struct isic_softc *sc, int what, void *buf, size_t size));
static void elsa_isdnmc_write_fifo __P((struct isic_softc *sc, int what, const void *data, size_t size));
+static void elsa_isdnmc_clrirq __P((struct isic_softc *sc));
#endif
/*
@@ -107,6 +108,24 @@ static void elsa_isdnmc_write_fifo __P((struct isic_softc *sc, int what, const v
/* This is very similar to the ELSA QuickStep 1000 (ISA) card */
+#ifdef __FreeBSD__
+static void
+elsa_isdnmc_clrirq(void *base)
+{
+}
+#else
+static void
+elsa_isdnmc_clrirq(struct isic_softc *sc)
+{
+ ISAC_WRITE(I_MASK, 0xff);
+ HSCX_WRITE(0, H_MASK, 0xff);
+ HSCX_WRITE(1, H_MASK, 0xff);
+ ISAC_WRITE(I_MASK, ISAC_IMASK);
+ HSCX_WRITE(0, H_MASK, HSCX_A_IMASK);
+ HSCX_WRITE(1, H_MASK, HSCX_B_IMASK);
+}
+#endif
+
/*---------------------------------------------------------------------------*
* read fifo routines
*---------------------------------------------------------------------------*/
@@ -284,7 +303,8 @@ isic_attach_elsaisdnmc(struct pcmcia_isic_softc *psc, struct pcmcia_config_entry
t = sc->sc_maps[0].t;
h = sc->sc_maps[0].h;
- sc->clearirq = NULL;
+ sc->clearirq = elsa_isdnmc_clrirq;
+
sc->readreg = elsa_isdnmc_read_reg;
sc->writereg = elsa_isdnmc_write_reg;
diff --git a/sys/i4b/layer1/i4b_elsa_mcall.c b/sys/i4b/layer1/i4b_elsa_mcall.c
index 36882e9..5ad5620 100644
--- a/sys/i4b/layer1/i4b_elsa_mcall.c
+++ b/sys/i4b/layer1/i4b_elsa_mcall.c
@@ -33,9 +33,9 @@
* ELSA MicroLink MC/all card specific routines
* --------------------------------------------
*
- * $Id: i4b_elsa_mcall.c,v 1.1 1998/12/02 06:44:27 hm Exp $
+ * $Id: i4b_elsa_mcall.c,v 1.2 1999/02/14 09:44:59 hm Exp $
*
- * last edit-date: [Tue Dec 1 07:45:53 1998]
+ * last edit-date: [Sun Feb 14 10:26:29 1999]
*
* -mh started support for ELSA MC/all
*
diff --git a/sys/i4b/layer1/i4b_elsa_qs1i.c b/sys/i4b/layer1/i4b_elsa_qs1i.c
index a6b5181..d43a637 100644
--- a/sys/i4b/layer1/i4b_elsa_qs1i.c
+++ b/sys/i4b/layer1/i4b_elsa_qs1i.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 1998 Hellmuth Michaelis. All rights reserved.
+ * Copyright (c) 1997, 1999 Hellmuth Michaelis. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -27,9 +27,9 @@
* isic - I4B Siemens ISDN Chipset Driver for ELSA Quickstep 1000pro ISA
* =====================================================================
*
- * $Id: i4b_elsa_qs1i.c,v 1.1 1998/12/27 21:46:45 phk Exp $
+ * $Id: i4b_elsa_qs1i.c,v 1.14 1999/02/14 11:02:04 hm Exp $
*
- * last edit-date: [Mon Dec 14 17:27:08 1998]
+ * last edit-date: [Sun Feb 14 11:59:45 1999]
*
*---------------------------------------------------------------------------*/
@@ -86,7 +86,7 @@
#include <i4b/layer1/i4b_hscx.h>
#ifdef __FreeBSD__
-/* static void i4b_eq1i_clrirq(void* base); */
+static void i4b_eq1i_clrirq(void* base);
#else
static void i4b_eq1i_clrirq(struct isic_softc *sc);
void isic_attach_Eqs1pi __P((struct isic_softc *sc));
@@ -125,13 +125,12 @@ void isic_attach_Eqs1pi __P((struct isic_softc *sc));
* ELSA QuickStep 1000pro/ISA clear IRQ routine
*---------------------------------------------------------------------------*/
#ifdef __FreeBSD__
-#ifdef notdef
static void
i4b_eq1i_clrirq(void* base)
{
outb((u_int)base + ELSA_OFF_IRQ, 0);
}
-#endif
+
#else
static void
i4b_eq1i_clrirq(struct isic_softc *sc)
@@ -402,9 +401,7 @@ isic_probe_Eqs1pi(struct isa_device *dev, unsigned int iobase2)
/* setup access routines */
-/* XXX no "sc_clearirq" in sight... /phk
- sc->sc_clearirq = i4b_eq1i_clrirq;
-*/
+ sc->clearirq = i4b_eq1i_clrirq;
sc->readreg = eqs1pi_read_reg;
sc->writereg = eqs1pi_write_reg;
diff --git a/sys/i4b/layer1/i4b_elsa_qs1p.c b/sys/i4b/layer1/i4b_elsa_qs1p.c
index b2b35d0..43dd343 100644
--- a/sys/i4b/layer1/i4b_elsa_qs1p.c
+++ b/sys/i4b/layer1/i4b_elsa_qs1p.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 1998 Hellmuth Michaelis. All rights reserved.
+ * Copyright (c) 1997, 1999 Hellmuth Michaelis. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -27,9 +27,9 @@
* isic - I4B Siemens ISDN Chipset Driver for ELSA Quickstep 1000pro PCI
* =====================================================================
*
- * $Id: i4b_elsa_qs1p.c,v 1.4 1998/12/05 18:04:36 hm Exp $
+ * $Id: i4b_elsa_qs1p.c,v 1.5 1999/02/14 09:44:59 hm Exp $
*
- * last edit-date: [Sat Dec 5 18:22:41 1998]
+ * last edit-date: [Sun Feb 14 10:26:43 1999]
*
*---------------------------------------------------------------------------*/
diff --git a/sys/i4b/layer1/i4b_hscx.c b/sys/i4b/layer1/i4b_hscx.c
index ed80a51..29c2f40 100644
--- a/sys/i4b/layer1/i4b_hscx.c
+++ b/sys/i4b/layer1/i4b_hscx.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 1998 Hellmuth Michaelis. All rights reserved.
+ * Copyright (c) 1997, 1999 Hellmuth Michaelis. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -27,9 +27,9 @@
* i4b - Siemens HSCX chip (B-channel) handling
* --------------------------------------------
*
- * $Id: i4b_hscx.c,v 1.37 1998/12/05 18:04:38 hm Exp $
+ * $Id: i4b_hscx.c,v 1.39 1999/02/14 19:51:01 hm Exp $
*
- * last edit-date: [Sat Dec 5 18:23:36 1998]
+ * last edit-date: [Sun Feb 14 10:26:49 1999]
*
*---------------------------------------------------------------------------*/
@@ -55,7 +55,9 @@
#include <machine/clock.h>
#include <i386/isa/isa_device.h>
#else
+#ifndef __bsdi__
#include <machine/bus.h>
+#endif
#include <sys/device.h>
#endif
diff --git a/sys/i4b/layer1/i4b_hscx.h b/sys/i4b/layer1/i4b_hscx.h
index 1b1640d..b611bf9 100644
--- a/sys/i4b/layer1/i4b_hscx.h
+++ b/sys/i4b/layer1/i4b_hscx.h
@@ -30,9 +30,9 @@
*
*---------------------------------------------------------------------------
*
- * $Id: i4b_hscx.h,v 1.3 1998/02/13 17:00:31 hm Exp $
+ * $Id: i4b_hscx.h,v 1.4 1999/02/14 09:44:59 hm Exp $
*
- * last edit-date: [Thu Feb 5 13:38:50 1998]
+ * last edit-date: [Sun Feb 14 10:26:56 1999]
*
* -hm added AVM config register defs
* -hm split up for rewrite of Siemens chipset driver
diff --git a/sys/i4b/layer1/i4b_ipac.h b/sys/i4b/layer1/i4b_ipac.h
index 79d8bc9..d820271 100644
--- a/sys/i4b/layer1/i4b_ipac.h
+++ b/sys/i4b/layer1/i4b_ipac.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 1998 Hellmuth Michaelis. All rights reserved.
+ * Copyright (c) 1997, 1999 Hellmuth Michaelis. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -27,9 +27,9 @@
* i4b_ipac.h - definitions for the Siemens IPAC PSB2115 chip
* ==========================================================
*
- * $Id: i4b_ipac.h,v 1.4 1998/12/05 18:04:39 hm Exp $
+ * $Id: i4b_ipac.h,v 1.5 1999/02/14 09:44:59 hm Exp $
*
- * last edit-date: [Sat Dec 5 18:23:50 1998]
+ * last edit-date: [Sun Feb 14 10:27:03 1999]
*
*---------------------------------------------------------------------------
*/
diff --git a/sys/i4b/layer1/i4b_isac.c b/sys/i4b/layer1/i4b_isac.c
index 4065c9a..71ec0c3 100644
--- a/sys/i4b/layer1/i4b_isac.c
+++ b/sys/i4b/layer1/i4b_isac.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 1998 Hellmuth Michaelis. All rights reserved.
+ * Copyright (c) 1997, 1999 Hellmuth Michaelis. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -27,9 +27,9 @@
* i4b_isac.c - i4b siemens isdn chipset driver ISAC handler
* ---------------------------------------------------------
*
- * $Id: i4b_isac.c,v 1.28 1998/12/05 18:04:41 hm Exp $
+ * $Id: i4b_isac.c,v 1.30 1999/02/14 19:51:01 hm Exp $
*
- * last edit-date: [Sat Dec 5 18:23:59 1998]
+ * last edit-date: [Sun Feb 14 10:27:09 1999]
*
*---------------------------------------------------------------------------*/
@@ -58,7 +58,9 @@
#include <machine/clock.h>
#include <i386/isa/isa_device.h>
#else
+#ifndef __bsdi__
#include <machine/bus.h>
+#endif
#include <sys/device.h>
#endif
diff --git a/sys/i4b/layer1/i4b_isac.h b/sys/i4b/layer1/i4b_isac.h
index 56a4241..942b9cc 100644
--- a/sys/i4b/layer1/i4b_isac.h
+++ b/sys/i4b/layer1/i4b_isac.h
@@ -30,9 +30,9 @@
*
*---------------------------------------------------------------------------
*
- * $Id: i4b_isac.h,v 1.5 1998/03/28 15:11:03 hm Exp $
+ * $Id: i4b_isac.h,v 1.6 1999/02/14 09:44:59 hm Exp $
*
- * last edit-date: [Fri Mar 27 15:52:40 1998]
+ * last edit-date: [Sun Feb 14 10:27:13 1999]
*
* -hm split up for rewrite of Siemens chipset driver
*
diff --git a/sys/i4b/layer1/i4b_isic.c b/sys/i4b/layer1/i4b_isic.c
index 922df79..127fae2 100644
--- a/sys/i4b/layer1/i4b_isic.c
+++ b/sys/i4b/layer1/i4b_isic.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 1998 Hellmuth Michaelis. All rights reserved.
+ * Copyright (c) 1997, 1999 Hellmuth Michaelis. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -27,9 +27,9 @@
* i4b_isic.c - global isic stuff
* ==============================
*
- * $Id: i4b_isic.c,v 1.44 1998/12/20 11:07:59 hm Exp $
+ * $Id: i4b_isic.c,v 1.46 1999/02/14 19:51:02 hm Exp $
*
- * last edit-date: [Fri Dec 18 12:14:07 1998]
+ * last edit-date: [Sun Feb 14 10:27:20 1999]
*
*---------------------------------------------------------------------------*/
@@ -61,9 +61,11 @@
#if defined(__NetBSD__) && defined(amiga)
#include <machine/bus.h>
#else
+#ifndef __bsdi__
#include <dev/isa/isavar.h>
#endif
#endif
+#endif
#ifdef __FreeBSD__
#include <machine/i4b_debug.h>
@@ -87,6 +89,48 @@
void isic_settrace(int unit, int val);
int isic_gettrace(int unit);
+#ifdef __bsdi__
+static int isicmatch(struct device *parent, struct cfdata *cf, void *aux);
+static void isicattach(struct device *parent, struct device *self, void *aux);
+struct cfdriver isiccd =
+ { NULL, "isic", isicmatch, isicattach, DV_IFNET,
+ sizeof(struct isic_softc) };
+
+int isa_isicmatch(struct device *parent, struct cfdata *cf, struct isa_attach_args *);
+int isa_isicattach(struct device *parent, struct device *self, struct isa_attach_args *ia);
+
+static int
+isicmatch(struct device *parent, struct cfdata *cf, void *aux)
+{
+ struct isa_attach_args *ia = (struct isa_attach_args *) aux;
+ if (ia->ia_bustype == BUS_PCMCIA) {
+ ia->ia_irq = IRQNONE;
+ /* return 1; Not yet */
+ return 0; /* for now */
+ }
+ if (ia->ia_bustype == BUS_PNP) {
+ /* return isapnp_isicmatch(parent, cf, ia); */
+ return 0; /* for now */
+ }
+ return isa_isicmatch(parent, cf, ia);
+}
+
+static void
+isicattach(struct device *parent, struct device *self, void *aux)
+{
+ struct isa_attach_args *ia = (struct isa_attach_args *) aux;
+ struct isic_softc *sc = (struct isic_softc *)self;
+
+ sc->sc_flags = sc->sc_dev.dv_flags;
+ isa_isicattach(parent, self, ia);
+ isa_establish(&sc->sc_id, &sc->sc_dev);
+ sc->sc_ih.ih_fun = isicintr;
+ sc->sc_ih.ih_arg = (void *)sc;
+ intr_establish(ia->ia_irq, &sc->sc_ih, DV_NET);
+ /* Could add a shutdown hook here... */
+}
+#endif
+
#ifdef __FreeBSD__
void isicintr_sc(struct isic_softc *sc);
#if !(defined(__FreeBSD_version)) || (defined(__FreeBSD_version) && __FreeBSD_version >= 300006)
diff --git a/sys/i4b/layer1/i4b_isic_isa.c b/sys/i4b/layer1/i4b_isic_isa.c
index c0e11b9..19535f2 100644
--- a/sys/i4b/layer1/i4b_isic_isa.c
+++ b/sys/i4b/layer1/i4b_isic_isa.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 1998 Hellmuth Michaelis. All rights reserved.
+ * Copyright (c) 1997, 1999 Hellmuth Michaelis. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -27,15 +27,17 @@
* i4b_isic_isa.c - ISA bus interface
* ==================================
*
- * $Id: i4b_isic_isa.c,v 1.14 1998/12/20 11:07:59 hm Exp $
+ * $Id: i4b_isic_isa.c,v 1.16 1999/02/14 19:51:02 hm Exp $
*
- * last edit-date: [Fri Dec 18 12:00:26 1998]
+ * last edit-date: [Sun Feb 14 10:27:26 1999]
*
*---------------------------------------------------------------------------*/
#ifdef __FreeBSD__
#include "isic.h"
#include "opt_i4b.h"
+#elif defined(__bsdi__)
+#include "isic.h"
#else
#define NISIC 1
#endif
@@ -56,6 +58,9 @@
#ifdef __FreeBSD__
#include <machine/clock.h>
#include <i386/isa/isa_device.h>
+#elif defined(__bsdi__)
+#include <sys/device.h>
+#include <i386/isa/isavar.h>
#else
#include <sys/device.h>
#if defined(__NetBSD__) && defined(amiga)
@@ -93,7 +98,7 @@ void isicintr ( int unit );
void isicintr_sc(struct isic_softc *sc);
static int isicprobe(struct isa_device *dev);
-int isicattach(struct isa_device *dev);
+static int isicattach(struct isa_device *dev);
struct isa_driver isicdriver = {
isicprobe,
@@ -105,6 +110,8 @@ struct isa_driver isicdriver = {
int next_isic_unit = 0;
struct isic_softc isic_sc[ISIC_MAXUNIT];
+#elif defined(__bsdi__)
+ /* XXX */
#else
#ifdef NetBSD1_3
@@ -196,6 +203,58 @@ isicprobe(struct isa_device *dev)
}
return(ret);
}
+#elif defined(__bsdi__)
+/*---------------------------------------------------------------------------*
+ * isic - non-pnp device driver probe routine
+ *---------------------------------------------------------------------------*/
+int
+isa_isicmatch(struct device *parent, struct cfdata *cf, struct isa_attach_args *ia)
+{
+ int ret = 0;
+
+ switch(cf->cf_flags)
+ {
+#ifdef TEL_S0_8
+ case FLAG_TELES_S0_8:
+ ret = isic_probe_s08(parent, cf, ia);
+ break;
+#endif
+
+#ifdef TEL_S0_16
+ case FLAG_TELES_S0_16:
+ ret = isic_probe_s016(parent, cf, ia);
+ break;
+#endif
+
+#ifdef TEL_S0_16_3
+ case FLAG_TELES_S0_163:
+ ret = isic_probe_s0163(parent, cf, ia);
+ break;
+#endif
+
+#ifdef AVM_A1
+ case FLAG_AVM_A1:
+ ret = isic_probe_avma1(parent, cf, ia);
+ break;
+#endif
+
+#ifdef USR_STI
+ case FLAG_USR_ISDN_TA_INT:
+ ret = isic_probe_usrtai(parent, cf, ia);
+ break;
+#endif
+
+#ifdef ITKIX1
+ case FLAG_ITK_IX1:
+ ret = isic_probe_itkix1(parent, cf, ia);
+ break;
+#endif
+
+ default:
+ break;
+ }
+ return(ret);
+}
#else
@@ -215,7 +274,7 @@ isicprobe(struct isic_attach_args *args)
/*---------------------------------------------------------------------------*
* isic - non-pnp device driver attach routine
*---------------------------------------------------------------------------*/
-int
+static int
isicattach(struct isa_device *dev)
{
return(isic_realattach(dev, 0));
@@ -227,6 +286,13 @@ isicattach(struct isa_device *dev)
int
isic_realattach(struct isa_device *dev, unsigned int iobase2)
+#elif defined(__bsdi__)
+
+/*---------------------------------------------------------------------------*
+ * isic - non-pnp device driver attach routine
+ *---------------------------------------------------------------------------*/
+int
+isa_isicattach(struct device *parent, struct device *self, struct isa_attach_args *ia)
#else /* ! __FreeBSD__ */
int
@@ -242,6 +308,10 @@ isicattach(int flags, struct isic_softc *sc)
#define PARM dev
#define PARM2 dev, iobase2
#define FLAGS dev->id_flags
+#elif defined(__bsdi__)
+ struct isic_softc *sc = (struct isic_softc *)self;
+#define PARM parent, self, ia
+#define FLAGS sc->sc_flags
#else
#define PARM sc
#define PARM2 sc
@@ -338,13 +408,11 @@ isicattach(int flags, struct isic_softc *sc)
break;
#endif
-#ifndef __FreeBSD__
#ifdef TEL_S0_16_3_P
case FLAG_TELES_S0_163_PnP:
ret = isic_attach_s0163P(PARM2);
break;
#endif
-#endif
#ifdef CRTX_S0_P
case FLAG_CREATIX_S0_PnP:
diff --git a/sys/i4b/layer1/i4b_isic_pci.c b/sys/i4b/layer1/i4b_isic_pci.c
index bd6d4fd..b600f30 100644
--- a/sys/i4b/layer1/i4b_isic_pci.c
+++ b/sys/i4b/layer1/i4b_isic_pci.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 1998 Hellmuth Michaelis. All rights reserved.
+ * Copyright (c) 1997, 1999 Hellmuth Michaelis. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -27,9 +27,9 @@
* i4b_isic_pci.c - PCI bus interface
* ==================================
*
- * $Id: i4b_isic_pci.c,v 1.1 1998/12/27 21:46:46 phk Exp $
+ * $Id: i4b_isic_pci.c,v 1.11 1999/02/17 14:31:42 hm Exp $
*
- * last edit-date: [Sat Dec 5 18:24:36 1998]
+ * last edit-date: [Wed Feb 17 15:19:44 1999]
*
*---------------------------------------------------------------------------*/
@@ -82,12 +82,13 @@
#include <i4b/layer1/i4b_hscx.h>
#define PCI_QS1000_ID 0x10001048
+#define PCI_AVMA1_ID 0x0a001244
#define MEM0_MAPOFF 0
#define PORT0_MAPOFF 4
#define PORT1_MAPOFF 12
-static const char* i4b_pci_probe(pcici_t tag, pcidi_t type);
+static char* i4b_pci_probe(pcici_t tag, pcidi_t type);
static void i4b_pci_attach(pcici_t config_id, int unit);
static int isic_pciattach(int unit, u_long type, u_int iobase1, u_int iobase2);
@@ -105,18 +106,24 @@ DATA_SET (pcidevice_set, i4b_pci_driver);
static void isic_pci_intr_sc(struct isic_softc *sc);
+#ifdef AVM_A1_PCI
+extern void avma1pp_map_int(pcici_t, void *, unsigned *);
+#endif
+
/*---------------------------------------------------------------------------*
* PCI probe routine
*---------------------------------------------------------------------------*/
-static const char *
+static char *
i4b_pci_probe(pcici_t tag, pcidi_t type)
{
switch(type)
{
case PCI_QS1000_ID:
- return("ELSA QuickStep 1000pro PCI ISDN adaptor");
- break;
+ return("ELSA QuickStep 1000pro PCI ISDN adapter");
+
+ case PCI_AVMA1_ID:
+ return("AVM Fritz!Card PCI ISDN adapter");
default:
if(bootverbose)
@@ -136,6 +143,7 @@ i4b_pci_attach(pcici_t config_id, int unit)
unsigned short iobase2;
unsigned long type;
struct isic_softc *sc = &isic_sc[unit];
+ u_long reg1, reg2;
if(unit != next_isic_unit)
{
@@ -143,13 +151,35 @@ i4b_pci_attach(pcici_t config_id, int unit)
return;
}
- if(!(pci_map_port(config_id, PCI_MAP_REG_START+PORT0_MAPOFF, &iobase1)))
+ /* IMHO the all following should be done in the low-level driver - GJ */
+ type = pci_conf_read(config_id, PCI_ID_REG);
+
+ /* not all cards have their ports at the same location !!! */
+ switch(type)
+ {
+ case PCI_QS1000_ID:
+ reg1 = PCI_MAP_REG_START+PORT0_MAPOFF;
+ reg2 = PCI_MAP_REG_START+PORT1_MAPOFF;
+ break;
+
+ case PCI_AVMA1_ID:
+ reg1 = PCI_MAP_REG_START+PORT0_MAPOFF;
+ reg2 = 0;
+ break;
+
+ default:
+ reg1 = PCI_MAP_REG_START+PORT0_MAPOFF;
+ reg2 = PCI_MAP_REG_START+PORT1_MAPOFF;
+ break;
+ }
+
+ if(reg1 && !(pci_map_port(config_id, reg1, &iobase1)))
{
printf("i4b_pci_attach: pci_map_port 1 failed!\n");
return;
}
- if(!(pci_map_port(config_id, PCI_MAP_REG_START+PORT1_MAPOFF, &iobase2)))
+ if(reg2 && !(pci_map_port(config_id, reg2, &iobase2)))
{
printf("i4b_pci_attach: pci_map_port 2 failed!\n");
return;
@@ -158,11 +188,19 @@ i4b_pci_attach(pcici_t config_id, int unit)
if(bootverbose)
printf("i4b_pci_attach: unit %d, port0 0x%x, port1 0x%x\n", unit, iobase1, iobase2);
- type = pci_conf_read(config_id, PCI_ID_REG);
-
if((isic_pciattach(unit, type, iobase1, iobase2)) == 0)
return;
+#ifdef AVM_A1_PCI
+ /* the AVM FRTIZ!PCI needs to handle its own interrupts */
+ if (type == PCI_AVMA1_ID)
+ {
+ avma1pp_map_int(config_id, (void *)sc, &net_imask);
+ return;
+ }
+#endif
+
+ /* seems like this should be done before the attach in case it fails */
if(!(pci_map_int(config_id, (void *)isic_pci_intr_sc, (void *)sc, &net_imask)))
return;
}
@@ -201,6 +239,13 @@ isic_pciattach(int unit, u_long type, u_int iobase1, u_int iobase2)
ret = isic_attach_Eqs1pp(unit, iobase1, iobase2);
break;
#endif
+#ifdef AVM_A1_PCI
+ case PCI_AVMA1_ID:
+ ret = isic_attach_avma1pp(unit, iobase1, iobase2);
+ if (ret)
+ next_isic_unit++;
+ return(ret);
+#endif
default:
break;
}
diff --git a/sys/i4b/layer1/i4b_isic_pcmcia.c b/sys/i4b/layer1/i4b_isic_pcmcia.c
index e20964c..98cb22a 100644
--- a/sys/i4b/layer1/i4b_isic_pcmcia.c
+++ b/sys/i4b/layer1/i4b_isic_pcmcia.c
@@ -1,7 +1,7 @@
/*
* Copyright (c) 1998 Matthias Apitz. All rights reserved.
*
- * Copyright (c) 1998 Hellmuth Michaelis. All rights reserved.
+ * Copyright (c) 1998, 1999 Hellmuth Michaelis. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -35,9 +35,9 @@
* i4b_isic_pcmcia.c - i4b FreeBSD PCMCIA support
* ----------------------------------------------
*
- * $Id: i4b_isic_pcmcia.c,v 1.2 1999/01/12 11:04:59 eivind Exp $
+ * $Id: i4b_isic_pcmcia.c,v 1.4 1999/02/14 09:44:59 hm Exp $
*
- * last edit-date: [Mon Dec 14 17:30:09 1998]
+ * last edit-date: [Sun Feb 14 10:27:42 1999]
*
*---------------------------------------------------------------------------*/
@@ -50,9 +50,11 @@
#if (NISIC > 0) && (NCARD > 0)
#include "apm.h"
-#include <sys/param.h>
#include <sys/select.h>
-#include <i386/isa/isa_device.h>
+#include <pccard/card.h>
+#include <pccard/driver.h>
+#include <pccard/slot.h>
+#include <sys/param.h>
#if defined(__FreeBSD__) && __FreeBSD__ >= 3
#include <sys/ioccom.h>
@@ -63,7 +65,6 @@
#include <sys/kernel.h>
#include <sys/systm.h>
#include <sys/mbuf.h>
-#include <sys/module.h>
#include <sys/socket.h>
#include <net/if.h>
#include <machine/clock.h>
@@ -73,10 +74,6 @@
#include <machine/i4b_ioctl.h>
#include <machine/i4b_trace.h>
-#include <pccard/cardinfo.h>
-#include <pccard/slot.h>
-#include <pccard/driver.h>
-
#include <i4b/layer1/i4b_l1.h>
#include <i4b/layer1/i4b_isac.h>
#include <i4b/layer1/i4b_hscx.h>
@@ -85,9 +82,6 @@
#include <i4b/include/i4b_mbuf.h>
#include <i4b/include/i4b_global.h>
-extern int isicattach(struct isa_device *dev);
-extern void isicintr(int unit);
-
/*
* PC-Card (PCMCIA) specific code.
*/
@@ -95,7 +89,16 @@ static int isic_pccard_init __P((struct pccard_devinfo *));
static void isic_unload __P((struct pccard_devinfo *));
static int isic_card_intr __P((struct pccard_devinfo *));
-PCCARD_MODULE(isic, isic_pccard_init, isic_unload, isic_card_intr, 0,net_imask);
+static struct pccard_device isic_info = {
+ "isic",
+ isic_pccard_init,
+ isic_unload,
+ isic_card_intr,
+ 0, /* Attributes - presently unused */
+ &net_imask
+};
+
+DATA_SET(pccarddrv_set, isic_info);
/*
* Initialize the device - called from Slot manager.
@@ -107,6 +110,7 @@ static int isic_pccard_init(devi)
struct pccard_devinfo *devi;
{
struct isa_device *is = &devi->isahd;
+ struct isic_softc *sc = &isic_sc[is->id_unit];
if ((1 << is->id_unit) & opened)
return(EBUSY);
@@ -115,14 +119,11 @@ struct pccard_devinfo *devi;
printf("isic%d: PCMCIA init, irqmask = 0x%x (%d), iobase = 0x%x\n",
is->id_unit, is->id_irq, devi->slt->irq, is->id_iobase);
-#if 0
- /* XXX: problems resolving isic_probe_avma1_pcmcia() /phk */
/*
* look if there is really an AVM PCMCIA Fritz!Card and
* setup the card specific stuff
*/
isic_probe_avma1_pcmcia(is);
-#endif
/* ap:
* XXX what's to do with the return value?
diff --git a/sys/i4b/layer1/i4b_isic_pnp.c b/sys/i4b/layer1/i4b_isic_pnp.c
index ed1892d9..678e7c8 100644
--- a/sys/i4b/layer1/i4b_isic_pnp.c
+++ b/sys/i4b/layer1/i4b_isic_pnp.c
@@ -3,7 +3,7 @@
*
* Copyright (c) 1998 German Tischler. All rights reserved.
*
- * Copyright (c) 1998 Hellmuth Michaelis. All rights reserved.
+ * Copyright (c) 1998, 1999 Hellmuth Michaelis. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -37,9 +37,9 @@
* i4b_isic_pnp.c - i4b pnp support
* --------------------------------
*
- * $Id: i4b_isic_pnp.c,v 1.15 1998/12/20 11:07:59 hm Exp $
+ * $Id: i4b_isic_pnp.c,v 1.16 1999/02/14 09:44:59 hm Exp $
*
- * last edit-date: [Fri Dec 18 20:54:56 1998]
+ * last edit-date: [Sun Feb 14 10:27:52 1999]
*
*---------------------------------------------------------------------------*/
@@ -249,13 +249,11 @@ isic_pnpprobe(struct isa_device *dev, unsigned int iobase2)
switch(dev->id_flags)
{
-#ifndef __FreeBSD__
#ifdef TEL_S0_16_3_P
case FLAG_TELES_S0_163_PnP:
ret = isic_probe_s0163P(dev, iobase2);
break;
#endif
-#endif
#ifdef CRTX_S0_P
case FLAG_CREATIX_S0_PnP:
diff --git a/sys/i4b/layer1/i4b_itk_ix1.c b/sys/i4b/layer1/i4b_itk_ix1.c
index cd70dbf..c46af2b 100644
--- a/sys/i4b/layer1/i4b_itk_ix1.c
+++ b/sys/i4b/layer1/i4b_itk_ix1.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998 Martin Husemann <martin@rumolt.teuto.de>
+ * Copyright (c) 1998, 1999 Martin Husemann <martin@rumolt.teuto.de>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -26,9 +26,13 @@
* i4b_itk_ix1.c - ITK ix1 micro passive card driver for isdn4bsd
* --------------------------------------------------------------
*
- * $Id: i4b_itk_ix1.c,v 1.1 1998/12/27 21:46:46 phk Exp $
+ * $Id: i4b_itk_ix1.c,v 1.3 1999/02/14 09:44:59 hm Exp $
*
- * last edit-date: [Wed Dec 16 14:46:36 1998]
+ * last edit-date: [Sun Feb 14 10:28:00 1999]
+ *
+ * mh - created
+ * mh - fixed FreeBSD problems reported by Kevin Sheehan
+ * mh - added probe routine
*
*---------------------------------------------------------------------------
*
@@ -49,7 +53,14 @@
* - read data from or write data to ITK_ISAC_DATA port or ITK_HSCX_DATA port
* The two HSCX channel registers are offset by HSCXA (0x00) and HSCXB (0x40).
*
- * XXX - A reasonable probe routine has to be written.
+ * The probe routine was derived by trial and error from a representative
+ * sample of two cards ;-) The standard way (checking HSCX versions)
+ * was extended by reading a zero from a non existant HSCX register (register
+ * 0xff). Reading the config register gives varying results, so this doesn't
+ * seem to be used as an id register (like the Teles S0/16.3).
+ *
+ * If the probe fails for your card use "options ITK_PROBE_DEBUG" to get
+ * additional debug output.
*
*---------------------------------------------------------------------------*/
@@ -96,25 +107,34 @@
#include <i4b/include/i4b_global.h>
+/* Register offsets */
#define ITK_ISAC_DATA 0
#define ITK_HSCX_DATA 1
#define ITK_ALE 2
#define ITK_CONFIG 3
+
+/* Size of IO range to allocate for this card */
#define ITK_IO_SIZE 4
+/* Register offsets for the two HSCX channels */
#define HSCXA 0
#define HSCXB 0x40
-#ifndef __FreeBSD__
+/*
+ * Local function prototypes
+ */
+#ifdef __FreeBSD__
+/* FreeBSD version */
+static void itkix1_read_fifo(void *buf, const void *base, size_t len);
+static void itkix1_write_fifo(void *base, const void *buf, size_t len);
+static void itkix1_write_reg(u_char *base, u_int offset, u_int v);
+static u_char itkix1_read_reg(u_char *base, u_int offset);
+#else
+/* NetBSD/OpenBSD version */
static void itkix1_read_fifo(struct isic_softc *sc, int what, void *buf, size_t size);
static void itkix1_write_fifo(struct isic_softc *sc, int what, const void *buf, size_t size);
static void itkix1_write_reg(struct isic_softc *sc, int what, bus_size_t offs, u_int8_t data);
static u_int8_t itkix1_read_reg(struct isic_softc *sc, int what, bus_size_t offs);
-#else
-static u_char itkix1_read_reg(u_char *base, u_int offset);
-static void itkix1_write_reg(u_char *base, u_int offset, u_int v);
-static void itkix1_read_fifo(void *base, const void *buf, size_t len);
-static void itkix1_write_fifo(void *base, const void *buf, size_t len);
#endif
/*
@@ -124,18 +144,34 @@ static void itkix1_write_fifo(void *base, const void *buf, size_t len);
int
isic_probe_itkix1(struct isa_device *dev)
{
- u_int8_t hd, cd;
+ u_int8_t hd, hv1, hv2, saveale;
int ret;
+ /* save old value of this port, we're stomping over it */
+ saveale = inb(dev->id_iobase + ITK_ALE);
+
+ /* select invalid register */
+ outb(dev->id_iobase + ITK_ALE, 0xff);
+ /* get HSCX data for this non existent register */
hd = inb(dev->id_iobase + ITK_HSCX_DATA);
- cd = inb(dev->id_iobase + ITK_CONFIG);
+ /* get HSCX version info */
+ outb(dev->id_iobase + ITK_ALE, HSCXA + H_VSTR);
+ hv1 = inb(dev->id_iobase + ITK_HSCX_DATA);
+ outb(dev->id_iobase + ITK_ALE, HSCXB + H_VSTR);
+ hv2 = inb(dev->id_iobase + ITK_HSCX_DATA);
+
+ /* succeed if version bits are OK and we got a zero from the
+ * non existent register */
+ ret = (hd == 0) && ((hv1 & 0x0f) == 0x05) && ((hv2 & 0x0f) == 0x05);
- ret = (hd == 0 && cd == 0xfc);
+ /* retstore save value if we fail (if we succeed the old value
+ * has no meaning) */
+ if (!ret)
+ outb(dev->id_iobase + ITK_ALE, saveale);
-#define ITK_PROBE_DEBUG
#ifdef ITK_PROBE_DEBUG
- printf("\nITK ix1 micro probe: hscx = 0x%02x, config = 0x%02x, would have %s\n",
- hd, cd, ret ? "succeeded" : "failed");
+ printf("\nITK ix1 micro probe: hscx = 0x%02x, v1 = 0x%02x, v2 = 0x%02x, would have %s\n",
+ hd, hv1, hv2, ret ? "succeeded" : "failed");
return 1;
#else
return ret;
@@ -147,18 +183,34 @@ isic_probe_itkix1(struct isic_attach_args *ia)
{
bus_space_tag_t t = ia->ia_maps[0].t;
bus_space_handle_t h = ia->ia_maps[0].h;
- u_int8_t hd, cd;
+ u_int8_t hd, hv1, hv2, saveale;
int ret;
+ /* save old value of this port, we're stomping over it */
+ saveale = bus_space_read_1(t, h, ITK_ALE);
+
+ /* select invalid register */
+ bus_space_write_1(t, h, ITK_ALE, 0xff);
+ /* get HSCX data for this non existent register */
hd = bus_space_read_1(t, h, ITK_HSCX_DATA);
- cd = bus_space_read_1(t, h, ITK_CONFIG);
+ /* get HSCX version info */
+ bus_space_write_1(t, h, ITK_ALE, HSCXA + H_VSTR);
+ hv1 = bus_space_read_1(t, h, ITK_HSCX_DATA);
+ bus_space_write_1(t, h, ITK_ALE, HSCXB + H_VSTR);
+ hv2 = bus_space_read_1(t, h, ITK_HSCX_DATA);
+
+ /* succeed if version bits are OK and we got a zero from the
+ * non existent register */
+ ret = (hd == 0) && ((hv1 & 0x0f) == 0x05) && ((hv2 & 0x0f) == 0x05);
- ret = (hd == 0 && cd == 0xfc);
+ /* retstore save value if we fail (if we succeed the old value
+ * has no meaning) */
+ if (!ret)
+ bus_space_write_1(t, h, ITK_ALE, saveale);
-#define ITK_PROBE_DEBUG
#ifdef ITK_PROBE_DEBUG
- printf("\nITK ix1 micro probe: hscx = 0x%02x, config = 0x%02x, would have %s\n",
- hd, cd, ret ? "succeeded" : "failed");
+ printf("\nITK ix1 micro probe: hscx = 0x%02x, v1 = 0x%02x, v2 = 0x%02x, would have %s\n",
+ hd, hv1, hv2, ret ? "succeeded" : "failed");
return 1;
#else
return ret;
@@ -267,8 +319,8 @@ int isic_attach_itkix1(struct isic_softc *sc)
static void
itkix1_read_fifo(void *buf, const void *base, size_t len)
{
- int port = (u_long)base & ~0x0003;
- switch ((u_long)base & 3) {
+ u_int port = (u_int)base & ~0x0003;
+ switch ((u_int)base & 3) {
case 0: /* ISAC */
outb(port+ITK_ALE, 0);
insb(port+ITK_ISAC_DATA, (u_char *)buf, (u_int)len);
@@ -310,8 +362,8 @@ itkix1_read_fifo(struct isic_softc *sc, int what, void *buf, size_t size)
static void
itkix1_write_fifo(void *base, const void *buf, size_t len)
{
- int port = (u_long)base & ~0x0003;
- switch ((u_long)base & 3) {
+ u_int port = (u_int)base & ~0x0003;
+ switch ((u_int)base & 3) {
case 0: /* ISAC */
outb(port+ITK_ALE, 0);
outsb(port+ITK_ISAC_DATA, (u_char *)buf, (u_int)len);
@@ -352,8 +404,8 @@ static void itkix1_write_fifo(struct isic_softc *sc, int what, const void *buf,
static void
itkix1_write_reg(u_char *base, u_int offset, u_int v)
{
- int port = (u_long)base & ~0x0003;
- switch ((u_long)base & 3) {
+ u_int port = (u_int)base & ~0x0003;
+ switch ((u_int)base & 3) {
case 0: /* ISAC */
outb(port+ITK_ALE, offset);
outb(port+ITK_ISAC_DATA, (u_char)v);
@@ -394,8 +446,8 @@ static void itkix1_write_reg(struct isic_softc *sc, int what, bus_size_t offs, u
static u_char
itkix1_read_reg(u_char *base, u_int offset)
{
- int port = (u_long)base & ~0x0003;
- switch ((u_long)base & 3) {
+ u_int port = (u_int)base & ~0x0003;
+ switch ((u_int)base & 3) {
case 0: /* ISAC */
outb(port+ITK_ALE, offset);
return (inb(port+ITK_ISAC_DATA));
@@ -406,7 +458,6 @@ itkix1_read_reg(u_char *base, u_int offset)
outb(port+ITK_ALE, HSCXB+offset);
return (inb(port+ITK_HSCX_DATA));
}
- panic("itkix1_read_reg: Fallthrough\n");
}
#else
static u_int8_t itkix1_read_reg(struct isic_softc *sc, int what, bus_size_t offs)
diff --git a/sys/i4b/layer1/i4b_l1.c b/sys/i4b/layer1/i4b_l1.c
index 96497c5..79774bb 100644
--- a/sys/i4b/layer1/i4b_l1.c
+++ b/sys/i4b/layer1/i4b_l1.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 1998 Hellmuth Michaelis. All rights reserved.
+ * Copyright (c) 1997, 1999 Hellmuth Michaelis. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -27,9 +27,9 @@
* i4b_l1.c - isdn4bsd layer 1 handler
* -----------------------------------
*
- * $Id: i4b_l1.c,v 1.27 1998/12/05 18:04:51 hm Exp $
+ * $Id: i4b_l1.c,v 1.29 1999/02/14 19:51:02 hm Exp $
*
- * last edit-date: [Sat Dec 5 18:24:52 1998]
+ * last edit-date: [Sun Feb 14 10:28:10 1999]
*
*---------------------------------------------------------------------------*/
@@ -55,7 +55,9 @@
#include <machine/clock.h>
#include <i386/isa/isa_device.h>
#else
+#ifndef __bsdi__
#include <machine/bus.h>
+#endif
#include <sys/device.h>
#endif
diff --git a/sys/i4b/layer1/i4b_l1.h b/sys/i4b/layer1/i4b_l1.h
index 2b15ccc..939f960 100644
--- a/sys/i4b/layer1/i4b_l1.h
+++ b/sys/i4b/layer1/i4b_l1.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 1998 Hellmuth Michaelis. All rights reserved.
+ * Copyright (c) 1997, 1999 Hellmuth Michaelis. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -27,15 +27,22 @@
* i4b_l1.h - isdn4bsd layer 1 header file
* ---------------------------------------
*
- * $Id: i4b_l1.h,v 1.54 1998/12/17 04:55:39 hm Exp $
+ * $Id: i4b_l1.h,v 1.57 1999/02/17 14:31:42 hm Exp $
*
- * last edit-date: [Mon Dec 14 10:41:36 1998]
+ * last edit-date: [Wed Feb 17 15:16:48 1999]
*
*---------------------------------------------------------------------------*/
#ifndef I4B_L1_H_
#define I4B_L1_H_
+#ifdef __bsdi__
+#include <sys/device.h> /* XXX */
+#ifndef ISA_NPORT_CHECK /* Double yuck XXX */
+#include <i386/isa/isavar.h> /* XXX */
+#endif
+#endif
+
#include <i4b/include/i4b_l3l4.h>
/*---------------------------------------------------------------------------
@@ -74,9 +81,11 @@
#define MAX_DFRAME_LEN 264 /* max length of a D frame */
+#ifndef __bsdi__
#define min(a,b) ((a)<(b)?(a):(b))
+#endif
-#ifndef __FreeBSD__
+#if !defined(__FreeBSD__) && !defined(__bsdi__)
/* We try to map as few as possible as small as possible io and/or
memory regions. Each card defines its own interpretation of this
mapping array. At probe time we have a fixed size array, later
@@ -114,7 +123,7 @@ typedef struct
int unit; /* cards unit number */
int channel; /* which channel is this*/
-#ifdef __FreeBSD__
+#if defined(__FreeBSD__) || defined(__bsdi__)
caddr_t hscx; /* HSCX address */
#endif
@@ -173,7 +182,7 @@ typedef struct
*---------------------------------------------------------------------------*/
struct isic_softc
{
-#ifndef __FreeBSD__
+#if !defined(__FreeBSD__)
/* We are inherited from this class. All drivers must have this
as their first entry in struct softc. */
struct device sc_dev;
@@ -184,6 +193,13 @@ struct isic_softc
#ifdef __FreeBSD__
int sc_port; /* port base address */
+#elif defined(__bsdi__)
+ struct isadev sc_id; /* ISA/PCI device */
+ struct intrhand sc_ih; /* interrupt vectoring */
+ int sc_flags;
+ int sc_port;
+ caddr_t sc_maddr;
+ int sc_abustype; /* PCI, ISA etcetera */
#else
u_int sc_maddr; /* "memory address" for card config register */
int sc_num_mappings; /* number of io mappings provided */
@@ -208,7 +224,7 @@ struct isic_softc
int sc_init_tries; /* no of out tries to access S0 */
-#ifdef __FreeBSD__
+#if defined(__FreeBSD__) || defined(__bsdi__)
caddr_t sc_vmem_addr; /* card RAM virtual memory base */
caddr_t sc_isac; /* ISAC port base addr */
#define ISAC_BASE (sc->sc_isac)
@@ -252,13 +268,21 @@ struct isic_softc
#if defined(__FreeBSD__) && __FreeBSD__ >=3
struct callout_handle sc_T4_callout;
#endif
-
+
+ /*
+ * byte fields for the AVM Fritz!Card PCI. These are packed into
+ * a u_int in the driver.
+ */
+ u_char avma1pp_cmd;
+ u_char avma1pp_txl;
+ u_char avma1pp_prot;
+
int sc_enabled; /* daemon is running */
int sc_ipac; /* flag, running on ipac */
int sc_bfifolen; /* length of b channel fifos */
-#ifdef __FreeBSD__
+#if defined(__FreeBSD__) || defined(__bsdi__)
u_char (*readreg)(u_char *, u_int);
void (*writereg)(u_char *, u_int, u_int);
@@ -398,7 +422,61 @@ extern int isic_probe_drnngo ( struct isa_device *dev, unsigned int iobase2);
extern int isic_probe_sws ( struct isa_device *dev );
extern int isic_probe_Eqs1pi(struct isa_device *dev, unsigned int iobase2);
-#else /* not FreeBSD */
+#elif defined(__bsdi__)
+
+extern struct isic_softc *isic_sc[];
+#define isic_find_sc(unit) (isic_sc[(unit)])
+
+#define ATTACHARGS struct device *, struct device *, struct isa_attach_args *
+#define MATCHARGS struct device *, struct cfdata *, struct isa_attach_args *
+extern int isa_isicmatch(MATCHARGS);
+extern int isa_isicattach(ATTACHARGS);
+extern int isicintr(void *);
+extern void isic_recover(struct isic_softc *sc);
+extern int isic_realattach(ATTACHARGS);
+extern int isic_attach_avma1(ATTACHARGS);
+extern int isic_attach_fritzpcmcia(ATTACHARGS);
+extern int isic_attach_Cs0P(ATTACHARGS);
+extern int isic_attach_Dyn(ATTACHARGS);
+extern int isic_attach_s016(ATTACHARGS);
+extern int isic_attach_s0163(ATTACHARGS);
+extern int isic_attach_s0163P(ATTACHARGS);
+extern int isic_attach_s08(ATTACHARGS);
+extern int isic_attach_usrtai(ATTACHARGS);
+extern int isic_attach_itkix1(ATTACHARGS);
+extern int isic_attach_drnngo(ATTACHARGS);
+extern int isic_attach_sws(ATTACHARGS);
+extern int isic_attach_Eqs1pi(ATTACHARGS);
+extern int isic_attach_Eqs1pp(ATTACHARGS);
+extern void isic_bchannel_setup(int unit, int hscx_channel, int bprot, int activate );
+extern void isic_hscx_init(struct isic_softc *sc, int hscx_channel, int activate );
+extern void isic_hscx_irq(struct isic_softc *sc, u_char ista, int hscx_channel, u_char ex_irq );
+extern int isic_hscx_silence(unsigned char *data, int len );
+extern void isic_hscx_cmd(struct isic_softc *sc, int h_chan, unsigned char cmd );
+extern void isic_hscx_waitxfw(struct isic_softc *sc, int h_chan );
+extern void isic_init_linktab(struct isic_softc *sc );
+extern int isic_isac_init(struct isic_softc *sc );
+extern void isic_isac_irq(struct isic_softc *sc, int r );
+extern void isic_isac_l1_cmd(struct isic_softc *sc, int command );
+extern void isic_next_state(struct isic_softc *sc, int event );
+extern char *isic_printstate(struct isic_softc *sc );
+extern int isic_probe_avma1(MATCHARGS);
+extern int isic_probe_avma1_pcmcia(MATCHARGS);
+extern int isic_probe_Cs0P(MATCHARGS);
+extern int isic_probe_Dyn(MATCHARGS);
+extern int isic_probe_s016(MATCHARGS);
+extern int isic_probe_s0163(MATCHARGS);
+extern int isic_probe_s0163P(MATCHARGS);
+extern int isic_probe_s08(MATCHARGS);
+extern int isic_probe_usrtai(MATCHARGS);
+extern int isic_probe_itkix1(MATCHARGS);
+extern int isic_probe_drnngo(MATCHARGS);
+extern int isic_probe_sws(MATCHARGS);
+extern int isic_probe_Eqs1pi(MATCHARGS);
+
+#undef MATCHARGS
+#undef ATTACHARGS
+#else /* not FreeBSD/__bsdi__ */
extern void isic_recover __P((struct isic_softc *sc));
extern int isicattach __P((int flags, struct isic_softc *sc));
diff --git a/sys/i4b/layer1/i4b_l1fsm.c b/sys/i4b/layer1/i4b_l1fsm.c
index 397ce11..f4134e4 100644
--- a/sys/i4b/layer1/i4b_l1fsm.c
+++ b/sys/i4b/layer1/i4b_l1fsm.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 1998 Hellmuth Michaelis. All rights reserved.
+ * Copyright (c) 1997, 1999 Hellmuth Michaelis. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -27,13 +27,13 @@
* i4b_l1fsm.c - isdn4bsd layer 1 I.430 state machine
* --------------------------------------------------
*
- * $Id: i4b_l1fsm.c,v 1.26 1998/12/05 18:04:55 hm Exp $
+ * $Id: i4b_l1fsm.c,v 1.28 1999/02/14 19:51:02 hm Exp $
*
- * last edit-date: [Sat Dec 5 18:25:12 1998]
+ * last edit-date: [Sun Feb 14 10:28:26 1999]
*
*---------------------------------------------------------------------------*/
-#if defined(__FreeBSD__)
+#if defined(__FreeBSD__) || defined(__bsdi__)
#include "isic.h"
#else
#define NISIC 1
@@ -57,7 +57,9 @@
#include <machine/clock.h>
#include <i386/isa/isa_device.h>
#else
+#ifndef __bsdi__
#include <machine/bus.h>
+#endif
#include <sys/device.h>
#endif
diff --git a/sys/i4b/layer1/i4b_sws.c b/sys/i4b/layer1/i4b_sws.c
index c5182b4..8de9245 100644
--- a/sys/i4b/layer1/i4b_sws.c
+++ b/sys/i4b/layer1/i4b_sws.c
@@ -47,9 +47,9 @@
* EXPERIMENTAL !!!!
* =================
*
- * $Id: i4b_sws.c,v 1.12 1998/12/18 09:32:45 hm Exp $
+ * $Id: i4b_sws.c,v 1.13 1999/02/14 09:44:59 hm Exp $
*
- * last edit-date: [Sun Dec 13 10:49:25 1998]
+ * last edit-date: [Sun Feb 14 10:28:31 1999]
*
* -hm adding driver to i4b
* -hm adjustments for FreeBSD < 2.2.6, no PnP support yet
diff --git a/sys/i4b/layer1/i4b_tel_s016.c b/sys/i4b/layer1/i4b_tel_s016.c
index f77a3c1..e62d6a1 100644
--- a/sys/i4b/layer1/i4b_tel_s016.c
+++ b/sys/i4b/layer1/i4b_tel_s016.c
@@ -3,7 +3,7 @@
*
* Copyright (c) 1996 Gary Jennejohn. All rights reserved.
*
- * Copyright (c) 1997, 1998 Hellmuth Michaelis. All rights reserved.
+ * Copyright (c) 1997, 1999 Hellmuth Michaelis. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -37,9 +37,9 @@
* isic - I4B Siemens ISDN Chipset Driver for Teles S0/16 and clones
* =================================================================
*
- * $Id: i4b_tel_s016.c,v 1.12 1998/12/05 18:04:56 hm Exp $
+ * $Id: i4b_tel_s016.c,v 1.13 1999/02/14 09:45:00 hm Exp $
*
- * last edit-date: [Fri Dec 4 10:40:17 1998]
+ * last edit-date: [Sun Feb 14 10:28:38 1999]
*
* -hm clean up
* -hm checked with a Creatix ISDN-S0 (PCB version: mp 130.1)
diff --git a/sys/i4b/layer1/i4b_tel_s0163.c b/sys/i4b/layer1/i4b_tel_s0163.c
index 5fdd329..efe9f34 100644
--- a/sys/i4b/layer1/i4b_tel_s0163.c
+++ b/sys/i4b/layer1/i4b_tel_s0163.c
@@ -3,7 +3,7 @@
*
* Copyright (c) 1996 Gary Jennejohn. All rights reserved.
*
- * Copyright (c) 1997, 1998 Hellmuth Michaelis. All rights reserved.
+ * Copyright (c) 1997, 1999 Hellmuth Michaelis. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -37,9 +37,9 @@
* isic - I4B Siemens ISDN Chipset Driver for Teles S0/16.3
* ========================================================
*
- * $Id: i4b_tel_s0163.c,v 1.15 1998/12/05 18:04:58 hm Exp $
+ * $Id: i4b_tel_s0163.c,v 1.18 1999/02/14 19:51:02 hm Exp $
*
- * last edit-date: [Fri Dec 4 10:40:58 1998]
+ * last edit-date: [Sun Feb 14 10:28:45 1999]
*
* -hm clean up
* -hm more cleanup
@@ -69,6 +69,8 @@
#ifdef __FreeBSD__
#include <machine/clock.h>
#include <i386/isa/isa_device.h>
+#elif defined(__bsdi__)
+ /* XXX */
#else
#include <machine/bus.h>
#include <sys/device.h>
@@ -95,7 +97,7 @@
static u_char intr_no[] = { 1, 1, 0, 2, 4, 6, 1, 1, 1, 0, 8, 10, 12, 1, 1, 14 };
-#ifndef __FreeBSD__
+#if !defined(__FreeBSD__) && !defined(__bsdi__)
static u_int8_t tels0163_read_reg __P((struct isic_softc *sc, int what, bus_size_t offs));
static void tels0163_write_reg __P((struct isic_softc *sc, int what, bus_size_t offs, u_int8_t data));
static void tels0163_read_fifo __P((struct isic_softc *sc, int what, void *buf, size_t size));
@@ -105,7 +107,7 @@ static void tels0163_write_fifo __P((struct isic_softc *sc, int what, const void
/*---------------------------------------------------------------------------*
* Teles S0/16.3 read fifo routine
*---------------------------------------------------------------------------*/
-#ifdef __FreeBSD__
+#if defined(__FreeBSD__) || defined(__bsdi__)
static void
tels0163_read_fifo(void *buf, const void *base, size_t len)
@@ -129,7 +131,7 @@ tels0163_read_fifo(struct isic_softc *sc, int what, void *buf, size_t size)
/*---------------------------------------------------------------------------*
* Teles S0/16.3 write fifo routine
*---------------------------------------------------------------------------*/
-#ifdef __FreeBSD__
+#if defined(__FreeBSD__) || defined(__bsdi__)
static void
tels0163_write_fifo(void *base, const void *buf, size_t len)
@@ -152,7 +154,7 @@ tels0163_write_fifo(struct isic_softc *sc, int what, const void *buf, size_t siz
/*---------------------------------------------------------------------------*
* Teles S0/16.3 ISAC put register routine
*---------------------------------------------------------------------------*/
-#ifdef __FreeBSD__
+#if defined(__FreeBSD__) || defined(__bsdi__)
static void
tels0163_write_reg(u_char *base, u_int offset, u_int v)
@@ -175,7 +177,7 @@ tels0163_write_reg(struct isic_softc *sc, int what, bus_size_t offs, u_int8_t da
/*---------------------------------------------------------------------------*
* Teles S0/16.3 ISAC get register routine
*---------------------------------------------------------------------------*/
-#ifdef __FreeBSD__
+#if defined(__FreeBSD__) || defined(__bsdi__)
static u_char
tels0163_read_reg(u_char *base, u_int offset)
@@ -254,9 +256,9 @@ isic_probe_s0163(struct isa_device *dev)
}
sc->sc_port = dev->id_iobase;
- if((byte = inb(sc->sc_port)) != 0x51)
+ if(((byte = inb(sc->sc_port)) != 0x51) && (byte != 0x10))
{
- printf("isic%d: Error, signature 1 0x%x != 0x51 for Teles S0/16.3!",
+ printf("isic%d: Error, signature 1 0x%x != 0x51 or 0x10 for Teles S0/16.3!",
dev->id_unit, byte);
return(0);
}
@@ -340,6 +342,147 @@ isic_probe_s0163(struct isa_device *dev)
return (1);
}
+#elif defined(__bsdi__)
+
+static int
+set_softc(struct isic_softc *sc, struct isa_attach_args *ia, int unit)
+{
+ sc->sc_irq = ia->ia_irq;
+
+ /* check if we got an iobase */
+
+ switch(ia->ia_iobase)
+ {
+ case 0xd80:
+ case 0xe80:
+ case 0xf80:
+ break;
+
+ default:
+ printf("isic%d: Error, invalid iobase 0x%x specified for Teles S0/16.3!",
+ unit, ia->ia_iobase);
+ return(0);
+ break;
+ }
+ sc->sc_port = ia->ia_iobase;
+
+ /* setup access routines */
+
+ sc->clearirq = NULL;
+ sc->readreg = tels0163_read_reg;
+ sc->writereg = tels0163_write_reg;
+
+ sc->readfifo = tels0163_read_fifo;
+ sc->writefifo = tels0163_write_fifo;
+
+ /* setup card type */
+
+ sc->sc_cardtyp= CARD_TYPEP_16_3;
+
+ /* setup IOM bus type */
+
+ sc->sc_bustyp = BUS_TYPE_IOM2;
+
+ sc->sc_ipac = 0;
+ sc->sc_bfifolen = HSCX_FIFO_LEN;
+
+ /* setup ISAC and HSCX base addr */
+
+ switch(ia->ia_iobase)
+ {
+ case 0xd80:
+ ISAC_BASE = (caddr_t) 0x960;
+ HSCX_A_BASE = (caddr_t) 0x160;
+ HSCX_B_BASE = (caddr_t) 0x560;
+ break;
+
+ case 0xe80:
+ ISAC_BASE = (caddr_t) 0xa60;
+ HSCX_A_BASE = (caddr_t) 0x260;
+ HSCX_B_BASE = (caddr_t) 0x660;
+ break;
+
+ case 0xf80:
+ ISAC_BASE = (caddr_t) 0xb60;
+ HSCX_A_BASE = (caddr_t) 0x360;
+ HSCX_B_BASE = (caddr_t) 0x760;
+ break;
+ }
+ return 1;
+}
+
+int
+isic_probe_s0163(struct device *dev, struct cfdata *cf,
+ struct isa_attach_args *ia)
+{
+ u_char byte;
+ struct isic_softc dummysc, *sc = &dummysc;
+
+ if((intr_no[ffs(ia->ia_irq) - 1]) == 1)
+ {
+ printf("isic%d: Error, invalid IRQ [%d] specified for Teles S0/16.3!\n",
+ cf->cf_unit, ffs(ia->ia_irq)-1);
+ return(0);
+ }
+
+ /* check if memory addr specified */
+
+ if(ia->ia_maddr)
+ {
+ printf("isic%d: Error, mem addr 0x%lx specified for Teles S0/16.3!",
+ cf->cf_unit, (u_long)ia->ia_maddr);
+ return 0;
+ }
+
+ /* Set up a temporary softc for the probe */
+
+ if (set_softc(sc, ia, cf->cf_unit) == 0)
+ return 0;
+
+ if((byte = inb(sc->sc_port)) != 0x51)
+ {
+ printf("isic%d: Error, signature 1 0x%x != 0x51 for Teles S0/16.3!",
+ cf->cf_unit, byte);
+ return(0);
+ }
+
+ if((byte = inb(sc->sc_port + 1)) != 0x93)
+ {
+ printf("isic%d: Error, signature 2 0x%x != 0x93 for Teles S0/16.3!",
+ cf->cf_unit, byte);
+ return(0);
+ }
+
+ if((byte = inb(sc->sc_port + 2)) != 0x1c)
+ {
+ printf("isic%d: Error, signature 3 0x%x != 0x1c for Teles S0/16.3!",
+ cf->cf_unit, byte);
+ return(0);
+ }
+
+ /*
+ * Read HSCX A/B VSTR. Expected value for the S0/16.3 card is
+ * 0x05 or 0x04 (for older 16.3's) in the least significant bits.
+ */
+
+ if( (((HSCX_READ(0, H_VSTR) & 0xf) != 0x5) &&
+ ((HSCX_READ(0, H_VSTR) & 0xf) != 0x4)) ||
+ (((HSCX_READ(1, H_VSTR) & 0xf) != 0x5) &&
+ ((HSCX_READ(1, H_VSTR) & 0xf) != 0x4)) )
+ {
+ printf("isic%d: HSCX VSTR test failed for Teles S0/16.3\n",
+ cf->cf_unit);
+ printf("isic%d: HSC0: VSTR: %#x\n",
+ cf->cf_unit, HSCX_READ(0, H_VSTR));
+ printf("isic%d: HSC1: VSTR: %#x\n",
+ cf->cf_unit, HSCX_READ(1, H_VSTR));
+ return (0);
+ }
+
+ return (1);
+}
+
+
#else
int
@@ -387,6 +530,34 @@ isic_attach_s0163(struct isa_device *dev)
return (1);
}
+#elif defined(__bsdi__)
+
+extern int
+isic_attach_s0163(struct device *parent, struct device *self, struct isa_attach_args *ia)
+{
+ u_char irq;
+ struct isic_softc *sc = (struct isic_softc *)self;
+ int unit = sc->sc_dev.dv_unit;
+
+ /* Commit the probed attachement values */
+
+ if (set_softc(sc, ia, unit) == 0)
+ panic("isic_attach_s0163: set_softc");
+
+ if (((unsigned)sc->sc_unit) >= NISIC)
+ panic("attach isic%d; NISIC=%d", sc->sc_unit, NISIC);
+ isic_sc[sc->sc_unit] = sc;
+ irq = intr_no[ffs(sc->sc_irq) - 1];
+ /* configure IRQ */
+
+ DELAY(SEC_DELAY / 10);
+ outb(sc->sc_port + 4, irq);
+
+ DELAY(SEC_DELAY / 10);
+ outb(sc->sc_port + 4, irq | 0x01);
+
+ return 1;
+}
#else
int
diff --git a/sys/i4b/layer1/i4b_tel_s08.c b/sys/i4b/layer1/i4b_tel_s08.c
index 6115e12..8f4f284 100644
--- a/sys/i4b/layer1/i4b_tel_s08.c
+++ b/sys/i4b/layer1/i4b_tel_s08.c
@@ -3,7 +3,7 @@
*
* Copyright (c) 1996 Gary Jennejohn. All rights reserved.
*
- * Copyright (c) 1997, 1998 Hellmuth Michaelis. All rights reserved.
+ * Copyright (c) 1997, 1999 Hellmuth Michaelis. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -37,9 +37,9 @@
* isic - I4B Siemens ISDN Chipset Driver for Teles S0/8 and clones
* ================================================================
*
- * $Id: i4b_tel_s08.c,v 1.13 1998/12/05 18:04:59 hm Exp $
+ * $Id: i4b_tel_s08.c,v 1.14 1999/02/14 09:45:00 hm Exp $
*
- * last edit-date: [Fri Dec 4 10:39:12 1998]
+ * last edit-date: [Sun Feb 14 10:28:53 1999]
*
* -hm clean up
* -hm more cleanup
diff --git a/sys/i4b/layer1/i4b_tel_s0P.c b/sys/i4b/layer1/i4b_tel_s0P.c
index 9bccd77..ffe9bef 100644
--- a/sys/i4b/layer1/i4b_tel_s0P.c
+++ b/sys/i4b/layer1/i4b_tel_s0P.c
@@ -1,7 +1,7 @@
/*
* Copyright (c) 1997 Andrew Gordon. All rights reserved.
*
- * Copyright (c) 1997, 1998 Hellmuth Michaelis. All rights reserved.
+ * Copyright (c) 1997, 1999 Hellmuth Michaelis. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -38,9 +38,9 @@
* EXPERIMENTAL !!!
* ================
*
- * $Id: i4b_tel_s0P.c,v 1.12 1998/12/13 09:52:34 hm Exp $
+ * $Id: i4b_tel_s0P.c,v 1.13 1999/02/14 09:45:00 hm Exp $
*
- * last edit-date: [Thu Dec 10 07:11:15 1998]
+ * last edit-date: [Sun Feb 14 10:29:00 1999]
*
* -hm rudimentary PnP support, hint from Andrew Gordon
* -hm more cleanup
diff --git a/sys/i4b/layer1/i4b_usr_sti.c b/sys/i4b/layer1/i4b_usr_sti.c
index db89296..d8b8792 100644
--- a/sys/i4b/layer1/i4b_usr_sti.c
+++ b/sys/i4b/layer1/i4b_usr_sti.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 1998 Hellmuth Michaelis. All rights reserved.
+ * Copyright (c) 1997, 1999 Hellmuth Michaelis. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -27,9 +27,9 @@
* i4b_usr_sti.c - USRobotics Sportster ISDN TA intern (Tina-pp)
* -------------------------------------------------------------
*
- * $Id: i4b_usr_sti.c,v 1.16 1998/12/05 18:05:02 hm Exp $
+ * $Id: i4b_usr_sti.c,v 1.17 1999/02/14 09:45:00 hm Exp $
*
- * last edit-date: [Sat Dec 5 18:25:34 1998]
+ * last edit-date: [Sun Feb 14 10:29:05 1999]
*
*---------------------------------------------------------------------------*/
diff --git a/sys/i4b/layer1/isa_isic.c b/sys/i4b/layer1/isa_isic.c
index 94e4bf7..7165e24 100644
--- a/sys/i4b/layer1/isa_isic.c
+++ b/sys/i4b/layer1/isa_isic.c
@@ -33,9 +33,9 @@
* isa_isic.c - ISA bus frontend for i4b_isic driver
* --------------------------------------------------
*
- * $Id: isa_isic.c,v 1.18 1998/12/16 13:39:47 hm Exp $
+ * $Id: isa_isic.c,v 1.21 1999/02/23 14:51:18 hm Exp $
*
- * last edit-date: [Mon Dec 14 10:53:16 1998]
+ * last edit-date: [Sun Feb 14 10:29:11 1999]
*
* -mh original implementation
* -hm NetBSD patches from Martin
diff --git a/sys/i4b/layer1/isapnp_isic.c b/sys/i4b/layer1/isapnp_isic.c
index 9dfdf68..c340d8f 100644
--- a/sys/i4b/layer1/isapnp_isic.c
+++ b/sys/i4b/layer1/isapnp_isic.c
@@ -33,9 +33,9 @@
* isapnp_isic.c - ISA-P&P bus frontend for i4b_isic driver
* --------------------------------------------------------
*
- * $Id: isapnp_isic.c,v 1.9 1998/12/16 13:39:47 hm Exp $
+ * $Id: isapnp_isic.c,v 1.10 1999/02/14 09:45:00 hm Exp $
*
- * last edit-date: [Mon Dec 14 10:54:23 1998]
+ * last edit-date: [Sun Feb 14 10:29:15 1999]
*
* -mh original implementation
* -hm NetBSD patches from Martin
diff --git a/sys/i4b/layer1/isic_supio.c b/sys/i4b/layer1/isic_supio.c
index 6c58ad2..24cc1de 100644
--- a/sys/i4b/layer1/isic_supio.c
+++ b/sys/i4b/layer1/isic_supio.c
@@ -37,9 +37,9 @@
* But we attach to the supio, so just see "isic".
* -----------------------------------------------
*
- * $Id: isic_supio.c,v 1.5 1998/12/19 12:07:55 hm Exp $
+ * $Id: isic_supio.c,v 1.6 1999/02/14 09:45:00 hm Exp $
*
- * last edit-date: [Mon Nov 16 12:29:19 1998]
+ * last edit-date: [Sun Feb 14 10:29:19 1999]
*
* -is original implementation
*
diff --git a/sys/i4b/layer1/pci_isic.c b/sys/i4b/layer1/pci_isic.c
index 6f929e5..d577592 100644
--- a/sys/i4b/layer1/pci_isic.c
+++ b/sys/i4b/layer1/pci_isic.c
@@ -33,9 +33,9 @@
* pci_isic.c - pcmcia bus frontend for i4b_isic driver
* -------------------------------------------------------
*
- * $Id: pci_isic.c,v 1.1 1998/12/16 13:39:47 hm Exp $
+ * $Id: pci_isic.c,v 1.2 1999/02/14 09:45:00 hm Exp $
*
- * last edit-date: [Mon Nov 16 20:37:32 1998]
+ * last edit-date: [Sun Feb 14 10:29:25 1999]
*
* -mh original implementation
*
diff --git a/sys/i4b/layer1/pcmcia_isic.c b/sys/i4b/layer1/pcmcia_isic.c
index 9d428a1..20b5478 100644
--- a/sys/i4b/layer1/pcmcia_isic.c
+++ b/sys/i4b/layer1/pcmcia_isic.c
@@ -33,9 +33,9 @@
* pcmcia_isic.c - pcmcia bus frontend for i4b_isic driver
* -------------------------------------------------------
*
- * $Id: pcmcia_isic.c,v 1.3 1998/12/05 18:05:04 hm Exp $
+ * $Id: pcmcia_isic.c,v 1.4 1999/02/14 09:45:00 hm Exp $
*
- * last edit-date: [Fri Dec 4 10:38:43 1998]
+ * last edit-date: [Sun Feb 14 10:29:29 1999]
*
* -mh original implementation
*
diff --git a/sys/i4b/layer1/pcmcia_isic.h b/sys/i4b/layer1/pcmcia_isic.h
index 73f52d6..d5953f0 100644
--- a/sys/i4b/layer1/pcmcia_isic.h
+++ b/sys/i4b/layer1/pcmcia_isic.h
@@ -33,9 +33,9 @@
* pcmcia_isic.h - common definitions for pcmcia isic cards
* --------------------------------------------------------
*
- * $Id: pcmcia_isic.h,v 1.1 1998/12/02 06:44:30 hm Exp $
+ * $Id: pcmcia_isic.h,v 1.2 1999/02/14 09:45:00 hm Exp $
*
- * last edit-date: [Mon Nov 30 21:19:14 1998]
+ * last edit-date: [Sun Feb 14 10:29:33 1999]
*
* -mh original implementation
*
OpenPOWER on IntegriCloud