Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 13 Dec 2022 20:26:49 GMT
From:      Ed Maste <emaste@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org
Subject:   git: 76f675184492 - main - retire ce(4) driver
Message-ID:  <202212132026.2BDKQnlT036779@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch main has been updated by emaste:

URL: https://cgit.FreeBSD.org/src/commit/?id=76f6751844920f768b944ecadec94aaa77ccb40e

commit 76f6751844920f768b944ecadec94aaa77ccb40e
Author:     Ed Maste <emaste@FreeBSD.org>
AuthorDate: 2020-02-02 18:27:37 +0000
Commit:     Ed Maste <emaste@FreeBSD.org>
CommitDate: 2022-12-13 20:24:25 +0000

    retire ce(4) driver
    
    Sync serial (e.g. T1/T1/G.703) interfaces are obsolete, this driver
    includes obfuscated source, and has reported potential security issues.
    
    Differential Revision:  https://reviews.freebsd.org/D33467
---
 share/man/man4/man4.i386/Makefile |    1 -
 share/man/man4/man4.i386/ce.4     |   97 -
 sys/conf/WITHOUT_SOURCELESS_UCODE |    1 -
 sys/conf/files.i386               |    4 -
 sys/dev/ce/ceddk.c                | 1521 -------------
 sys/dev/ce/ceddk.h                |  202 --
 sys/dev/ce/if_ce.c                | 1813 ----------------
 sys/dev/ce/machdep.h              |   89 -
 sys/dev/ce/ng_ce.h                |   27 -
 sys/dev/ce/tau32-ddk.c            | 4338 -------------------------------------
 sys/dev/ce/tau32-ddk.h            |  516 -----
 sys/dev/cp/machdep.h              |   89 -
 sys/i386/conf/NOTES               |    3 -
 sys/modules/Makefile              |    4 -
 sys/modules/ce/Makefile           |   13 -
 15 files changed, 8718 deletions(-)

diff --git a/share/man/man4/man4.i386/Makefile b/share/man/man4/man4.i386/Makefile
index 3dfc5f151f9f..9cf662a5eba3 100644
--- a/share/man/man4/man4.i386/Makefile
+++ b/share/man/man4/man4.i386/Makefile
@@ -1,7 +1,6 @@
 # $FreeBSD$
 
 MAN=	apm.4 \
-	ce.4 \
 	cp.4 \
 	CPU_ELAN.4 \
 	glxiic.4 \
diff --git a/share/man/man4/man4.i386/ce.4 b/share/man/man4/man4.i386/ce.4
deleted file mode 100644
index 1f5138f24cde..000000000000
--- a/share/man/man4/man4.i386/ce.4
+++ /dev/null
@@ -1,97 +0,0 @@
-.\" Copyright (c) 2006 Roman Kurakin <rik@FreeBSD.org>
-.\" 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.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY 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 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.
-.\"
-.\" $FreeBSD$
-.\"
-.Dd December 13, 2022
-.Dt CE 4 i386
-.Os
-.Sh NAME
-.Nm ce
-.Nd "driver for synchronous Cronyx Tau-PCI/32 WAN adapters"
-.Sh SYNOPSIS
-To compile this driver into the kernel,
-place the following line in your
-kernel configuration file:
-.Bd -ragged -offset indent
-.Cd "device ce"
-.Ed
-.Pp
-Alternatively, to load the driver as a
-module at boot time, place the following line in
-.Xr loader.conf 5 :
-.Bd -literal -offset indent
-if_ce_load="YES"
-.Ed
-.Sh DEPRECATION NOTICE
-The
-.Nm
-driver is not present in
-.Fx 14.0
-and later.
-.Sh DESCRIPTION
-The
-.Nm
-driver creates a
-.Xr netgraph 4
-node for each device found.
-The node is usually paired with
-.Xr ng_async 4 ,
-.Xr ng_cisco 4 ,
-.Xr ng_frame_relay 4
-or with
-.Xr ng_ppp 4
-under control of net/mpd5 port.
-.Pp
-Refer to
-.Xr sconfig 8
-for information about the
-.Nm
-adapter configuration.
-.Sh HARDWARE
-The
-.Nm
-driver supports the following models of Tau-PCI/32 WAN adapters:
-.Pp
-.Bl -tag -width 20n -compact
-.It Cronyx Tau-PCI/32
-two fractional/unframed E1 interfaces,
-with 32 HDLC channels shared between them with total adapter throughput
-2048 kbps.
-.It Cronyx Tau-PCI/32-Lite
-single fractional/unframed E1 interface,
-with 32 HDLC channels.
-.El
-.Sh SEE ALSO
-.Xr cp 4 ,
-.Xr netgraph 4 ,
-.Xr sconfig 8
-.Sh HISTORY
-The
-.Nm
-driver was added in
-.Fx 6.2 ,
-.Fx 5.5
-and
-.Fx 4.11 .
diff --git a/sys/conf/WITHOUT_SOURCELESS_UCODE b/sys/conf/WITHOUT_SOURCELESS_UCODE
index e33bcb17e025..ca69a1f4a134 100644
--- a/sys/conf/WITHOUT_SOURCELESS_UCODE
+++ b/sys/conf/WITHOUT_SOURCELESS_UCODE
@@ -14,7 +14,6 @@ nodevice	runfw
 nodevice	sf
 nodevice	ti
 nodevice	txp
-nodevice	ce
 nodevice	cp
 nodevice	ipwfw
 nodevice	iwifw
diff --git a/sys/conf/files.i386 b/sys/conf/files.i386
index d35a00829f4d..3c398017af7e 100644
--- a/sys/conf/files.i386
+++ b/sys/conf/files.i386
@@ -30,10 +30,6 @@ dev/agp/agp_intel.c		optional agp
 dev/agp/agp_nvidia.c		optional agp
 dev/agp/agp_sis.c		optional agp
 dev/agp/agp_via.c		optional agp
-dev/ce/ceddk.c			optional ce
-dev/ce/if_ce.c			optional ce
-dev/ce/tau32-ddk.c		optional ce \
-	compile-with "${NORMAL_C} ${NO_WCONSTANT_CONVERSION} ${NO_WMISLEADING_INDENTATION} ${NO_WUNUSED_BUT_SET_VARIABLE}"
 dev/glxiic/glxiic.c		optional glxiic
 dev/glxsb/glxsb.c		optional glxsb
 dev/glxsb/glxsb_hash.c		optional glxsb
diff --git a/sys/dev/ce/ceddk.c b/sys/dev/ce/ceddk.c
deleted file mode 100644
index 569476040a93..000000000000
--- a/sys/dev/ce/ceddk.c
+++ /dev/null
@@ -1,1521 +0,0 @@
-/*
- * Middle-level code for Cronyx Tau32-PCI adapters.
- *
- * Copyright (C) 2004 Cronyx Engineering
- * Copyright (C) 2004 Roman Kurakin <rik@FreeBSD.org>
- *
- * This software is distributed with NO WARRANTIES, not even the implied
- * warranties for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- *
- * Authors grant any other persons or organisations a permission to use,
- * modify and redistribute this software in source and binary forms,
- * as long as this message is kept with the software, all derivative
- * works or modified versions.
- *
- * $Cronyx: ceddk.c,v 1.2.6.2 2005/11/17 16:04:13 rik Exp $
- */
-
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
-#include <dev/ce/machdep.h>
-#include <dev/ce/ceddk.h>
-
-#undef CE_DDK_DEBUG_ENABLED
-#ifdef CE_DDK_DEBUG_ENABLED
-#ifdef __FreeBSD__
-# define CE_DDK_DEBUG(b,c,s) \
-	do { \
-		if (c) { \
-			printf("ce%d-%d: ",(b)->num,(c)->num); \
-		} else { \
-			printf("ce%d-*: ",(b)->num); \
-		} \
-		printf s; \
-	} while (0)
-#else
-# define CE_DDK_DEBUG(b,c,s)	do {} while (0)
-#endif
-#else
-# define CE_DDK_DEBUG(b,c,s)	do {} while (0)
-#endif
-
-#if 0
-#define ENTER() \
-	static int enter=0; \
-	do { \
-	enter++; \
-	printf ("%s: >> enter (%16llx) %d\n", __FUNCTION__, rdtsc (), enter); \
-	} while (0)
-
-#define EXIT(val...) \
-	do { \
-	enter--; \
-	printf ("%s: << exit  (%16llx) %d line %d\n", __FUNCTION__, rdtsc (), enter, __LINE__); \
-	return val; \
-	} while (0)
-#else
-#define ENTER() \
-	do {} while (0)
-
-#define EXIT(val...) \
-	do {return val;} while (0)
-#endif
-
-#define CE_ENQUEUE(list,item) \
-	do { \
-		TAU32_UserRequest **last; \
-		last = &(list); \
-		while (*last) { \
-			last = &(*last)->next; \
-		} \
-		(*last) = (item); \
-		(item)->next = NULL; \
-	} while (0)
-
-#define CE_ENQUEUE_HEAD(list,item) \
-	do { \
-		(item)->next = list; \
-		list = item; \
-	} while (0)
-
-#define CE_DEQUEUE(list,item) \
-	do { \
-		item = list; \
-		if (list) { \
-			list = (item)->next; \
-		} \
-	} while (0)
-
-#define CE_PREREQUEST(b,c,list,item) \
-	do { \
-		item = list; \
-		if (!item) { \
-			CE_DDK_DEBUG (b, c, ("Fatal error, no free structs " \
-					     "for UserRequest (%s:%d)\n", \
-					     __FUNCTION__, __LINE__)); \
-		} \
-	} while (0)
-
-#define CE_DUMP_QUEUE(list) \
-	do { \
-		TAU32_UserRequest *item; \
-		int i = 0; \
-		item = list; \
-		while (item) { \
-			printf ("item%d: %p\n", i, item); \
-			item = item->next; \
-			i++; \
-		} \
-	} while (0)
-
-#define CE_FIND_ITEM(list,item,flag) \
-	do { \
-		TAU32_UserRequest *citem; \
-		flag = 0; \
-		for (citem = list; citem; citem = citem->next) { \
-			if (citem == item) { \
-				flag = 1; \
-				break; \
-			} \
-		} \
-	} while (0)
-
-#define CE_LAST_ITEM(list,item) \
-	do { \
-		TAU32_UserRequest **last; \
-		last = &(list); \
-		while ((*last) && (*last)->next) { \
-			last = &(*last)->next; \
-		} \
-		(item) = (*last); \
-	} while (0)
-
-#define CE_ASSERT(a) \
-	do { \
-		if (!(a)) { \
-			printf ("ASSERT: %d %s\n", __LINE__, #a); \
-			__asm __volatile ("int $3"); \
-		} \
-	} while (0)
-
-static void _ce_set_ts (ce_chan_t *c, unsigned long ts);
-static void _ce_submit_configure_e1 (ce_chan_t *c, char *rname);
-
-#ifdef CE_DDK_DEBUG_ENABLED
-static char *ce_err2str (unsigned long err)
-{
-	switch (err) {
-	case TAU32_SUCCESSFUL:
-		return "Successful";
-	case TAU32_ERROR_ALLOCATION:
-		return "Allocation error, not enough tx/rx descriptors";
-	case TAU32_ERROR_BUS:
-		return "PEB could not access to host memory by PCI bus for load/store information";
-	case TAU32_ERROR_FAIL:
-		return "PEB action request failed";
-	case TAU32_ERROR_TIMEOUT:
-		return "PEB action request timeout";
-	case TAU32_ERROR_CANCELLED:
-		return "request has been canceled";
-	case TAU32_ERROR_TX_UNDERFLOW:
-		return "transmission underflow";
-	case TAU32_ERROR_TX_PROTOCOL:
-		return "TX_PROTOCOL";
-	case TAU32_ERROR_RX_OVERFLOW:
-		return "RX_OVERFLOW";
-	case TAU32_ERROR_RX_ABORT:
-		return "RX_ABORT";
-	case TAU32_ERROR_RX_CRC:
-		return "RX_CRC";
-	case TAU32_ERROR_RX_SHORT:
-		return "RX_SHORT";
-	case TAU32_ERROR_RX_SYNC:
-		return "RX_SYNC";
-	case TAU32_ERROR_RX_FRAME:
-		return "RX_FRAME";
-	case TAU32_ERROR_RX_LONG:
-		return "RX_LONG";
-	case TAU32_ERROR_RX_SPLIT:
-		return "frame has splitted between two requests due rx-gap allocation";
-	case TAU32_ERROR_RX_UNFIT:
-		return "frame can't be fit into request buffer";
-	case TAU32_ERROR_TSP:
-		return "ERROR_TSP";
-	case TAU32_ERROR_RSP:
-		return "ERROR_RSP";
-	case TAU32_ERROR_INT_OVER_TX:
-		return "ERROR INT OVER TX";
-	case TAU32_ERROR_INT_OVER_RX:
-		return "ERROR INT OVER RX";
-	case TAU32_ERROR_INT_STORM:
-		return "irq storm";
-	case TAU32_ERROR_INT_E1LOST:
-		return "ERROR_E1LOST";
-	default:
-		return ("Unknown error");
-	}
-}
-#endif
-
-void ce_set_dtr (ce_chan_t *c, int on)
-{
-	c->dtr = on?1:0;
-}
-
-void ce_set_rts (ce_chan_t *c, int on)
-{
-	c->rts = on?1:0;
-}
-
-static void TAU32_CALLBACK_TYPE ce_on_receive
-	(TAU32_UserContext *pContext, TAU32_UserRequest *req)
-{
-	ce_buf_item_t *item = (ce_buf_item_t *)req;
-	ce_chan_t *c;
-	ce_board_t *b;
-	unsigned int error;
-	int len;
-
-	ENTER ();
-	if (!req || !req->sys) {
-		EXIT ();
-	}
-
-	c = (ce_chan_t *)req->sys;
-	b = c->board;
-
-	len = req->Io.Rx.Received;
-	error = req->ErrorCode;
-
-	c->rintr++;
-	if (error == TAU32_SUCCESSFUL) {
-		if (req->Io.Rx.FrameEnd) {
-			c->ipkts++;
-		} else {
-			CE_DDK_DEBUG (b, c, ("No FrameEnd\n"));
-			/* probably do something in some cases*/
-		}
-		c->ibytes += len;
-		if (c->receive)
-			c->receive (c, item->buf, len);
-	} else if (error & TAU32_ERROR_BUS) {
-		c->overrun++;
-		if (c->error)
-			c->error (c, CE_OVERRUN);
-	} else {
-		CE_DDK_DEBUG (b, c, ("Another receive error: %x\n", error));
-		/* Do some processing */
-	}
-
-	CE_ASSERT (!req->pInternal);
-	CE_ENQUEUE (c->rx_queue, req);
-	while (c->rx_queue) {
-		CE_DEQUEUE (c->rx_queue, req);
-		CE_ASSERT (req);
-		item = (ce_buf_item_t *)req;
-		req->Command = TAU32_Rx_Data;
-		req->Io.Rx.Channel = c->num;
-		req->pCallback = ce_on_receive;
-		req->Io.Rx.BufferLength = BUFSZ+4;
-		req->Io.Rx.PhysicalDataAddress = item->phys;
-		if (!TAU32_SubmitRequest (b->ddk.pControllerObject, req)) {
-			CE_DDK_DEBUG (b, c, ("RX submition failure\n"));
-			c->rx_pending--;
-			CE_ENQUEUE_HEAD (c->rx_queue, req);
-			break;
-		}
-	}
-	EXIT ();
-}
-
-static void TAU32_CALLBACK_TYPE ce_on_transmit
-	(TAU32_UserContext *pContext, TAU32_UserRequest *req)
-{
-	int len;
-	unsigned int error;
-	ce_chan_t *c;
-	ENTER ();
-
-	if (!req || !req->sys) {
-		EXIT ();
-	}
-
-	c = (ce_chan_t *)req->sys;
-
-	len = req->Io.Tx.Transmitted;
-	error = req->ErrorCode;
-
-	c->tintr++;
-	if (error == TAU32_SUCCESSFUL) {
-		c->obytes += len;
-		c->opkts++;
-	} else if (error & TAU32_ERROR_BUS) {
-		c->underrun++;
-		if (c->error)
-			c->error (c, CE_UNDERRUN);		
-	} else {
-		CE_DDK_DEBUG (c->board, c, ("Another transmit error: %x\n",
-				error));
-		/* Do some processing */
-	}
-
-	CE_ENQUEUE (c->tx_queue, req);
-	c->tx_pending--;
-
-	if (c->transmit)
-		c->transmit (c, 0, len);
-	EXIT ();
-}
-
-int ce_transmit_space (ce_chan_t *c)
-{
-	return c->tx_pending < (TAU32_IO_QUEUE);
-}
-
-int ce_send_packet (ce_chan_t *c, unsigned char *buf, int len, void *tag)
-{
-	TAU32_UserRequest *req;
-	ce_buf_item_t *item;
-
-	ENTER ();
-
-	if (!ce_transmit_space (c)) {
-		EXIT (-1);
-	}
-
-	if (len <= 0 || len > BUFSZ) {
-		EXIT (-2);
-	}
-
-	CE_DEQUEUE (c->tx_queue, req);
-	CE_ASSERT (req);
-	item = (ce_buf_item_t *)req;
-		
-	if (buf != item->buf)
-		memcpy (item->buf, buf, len);
-		
-	CE_ASSERT (!req->pInternal);
-		
-	req->Command = TAU32_Tx_Data | TAU32_Tx_FrameEnd;
-	req->Io.Tx.Channel = c->num;
-	req->pCallback = ce_on_transmit;
-	req->Io.Tx.DataLength = len;
-	req->Io.Tx.PhysicalDataAddress = item->phys;
-	c->tx_pending++;
-	if (!TAU32_SubmitRequest (c->board->ddk.pControllerObject, req)) {
-		CE_DDK_DEBUG (c->board, c, ("Can't submit packet for "
-					    "transmission\n"));
-		CE_ENQUEUE_HEAD (c->tx_queue, req);
-		c->tx_pending--;
-		EXIT (-3);
-	}
-	EXIT (0);
-}
-
-static void TAU32_CALLBACK_TYPE ce_on_config
-	(TAU32_UserContext *pContext, TAU32_UserRequest *req)
-{
-	ce_board_t *b = (ce_board_t *) pContext;
-	ENTER ();
-	b->cr.pending--;
-	if (req->ErrorCode)
-		CE_DDK_DEBUG (b, (ce_chan_t*)0, ("Config request failure: %lx\n",
-			      req->ErrorCode));
-	EXIT ();
-}
-
-static void TAU32_CALLBACK_TYPE ce_on_config_stop
-	(TAU32_UserContext *pContext, TAU32_UserRequest *req)
-{
-	int i, first;
-	TAU32_UserRequest *rreq;
-	ce_board_t *b = (ce_board_t *) pContext;
-	ce_chan_t *c = b->chan + req->Io.ChannelNumber;
-
-	ENTER ();
-	/* Stop all requests */
-	CE_ASSERT (0);/* Buggy */
-	CE_LAST_ITEM (c->rx_queue, rreq);
-	/* A little hacky, try to guess which is a first */
-	first = rreq ? (c->rx_item - (ce_buf_item_t *)rreq) + 1 : 0;
-	for (i = 0; i < TAU32_IO_QUEUE; i++) {
-		int is_pending;
-		rreq = &c->rx_item[(i + first) % TAU32_IO_QUEUE].req;
-		CE_FIND_ITEM (c->rx_queue, rreq, is_pending);
-		if (!is_pending)
-			continue;
-		TAU32_CancelRequest (b->ddk.pControllerObject, rreq, 1);
-		rreq->Command = TAU32_Rx_Data;
-		rreq->Io.Rx.Channel = c->num;
-		rreq->Io.Rx.BufferLength = BUFSZ+4;
-		rreq->Io.Rx.PhysicalDataAddress = ((ce_buf_item_t *)rreq)->phys;
-		c->rx_pending++;
-		if (!TAU32_SubmitRequest (b->ddk.pControllerObject, rreq)) {
-			CE_ASSERT (0);/* Buggy */
-			c->rx_pending--;
-			break;
-		}
-	}
-
-	c->tx_pending = 0;
-/*	c->rx_pending = 0;*/
-	EXIT ();
-}
-
-static int ce_cfg_submit (ce_board_t *b)
-{
-	TAU32_UserRequest *req;
-	ENTER ();
-
-	CE_DEQUEUE (b->cr.queue, req);
-	CE_ASSERT (req);
-	CE_ASSERT (!req->pInternal);
-
-	req->pCallback = ce_on_config;
-	b->cr.pending++;
-
-	CE_DDK_DEBUG (b, (ce_chan_t *)0, ("config request pending: %d\n",
-		      b->cr.pending));
-
-	if (!TAU32_SubmitRequest (b->ddk.pControllerObject, req)) {
-		CE_ENQUEUE_HEAD (b->cr.queue, req);
-		CE_DDK_DEBUG (b, (ce_chan_t *)0, ("Fail to submit config request\n"));
-		b->cr.pending--;
-		EXIT (0);
-	}
-
-	EXIT (1);
-}
-
-void ce_init_board (ce_board_t *b)
-{
-	int i;
-
-	b->cr.queue = NULL;
-
-	for (i = 0; i < CONFREQSZ; i++) {
-		CE_ENQUEUE (b->cr.queue, b->cr.req + i);
-	}
-
-	b->chan[0].config = TAU32_ais_on_loss;
-
-	/* lloop = off, rloop = off */
-	b->chan[0].config |= TAU32_LineNormal;
-	b->chan[0].lloop = 0;
-	b->chan[0].rloop = 0;
-
-	/* unfram=off, scrambler=off, use16=off, crc4=off,
-	   higain=off, monitor=off*/
-	b->chan[0].config |= (b->ddk.Interfaces == 2 ? TAU32_framed_cas_cross :
-						       TAU32_framed_cas_set);
-	b->chan[0].unfram = 0;
-	b->chan[0].scrambler = 0;
-	b->chan[0].use16 = 0;
-	b->chan[0].crc4 = 0;
-	b->chan[0].higain = 0;
-	b->chan[0].monitor = 0;
-
-	if (b->ddk.Interfaces == 2) {
-		b->chan[1].config = TAU32_ais_on_loss;
-		/* lloop = off, rloop = off */
-		b->chan[1].config |= TAU32_LineNormal;
-		/* unfram=off, scrambler=off, use16=off, crc4=off,
-		   higain=off, monitor=off*/
-		b->chan[1].config |= TAU32_framed_cas_cross;
-		b->chan[1].unfram = 0;
-		b->chan[1].scrambler = 0;
-		b->chan[1].use16 = 0;
-		b->chan[1].crc4 = 0;
-		b->chan[1].higain = 0;
-		b->chan[1].monitor = 0;
-	}
-
-	for (i = 0; i < NCHAN; i++) {
-		/* Chan0 ts=1-15,17-31, Chan1 ts=1-2 */
-		b->chan[i].type = i < b->ddk.Interfaces ? T_E1 : T_DATA;
-		b->chan[i].ts = (i == 0 ? 0xfffefffe :
-				(i != 1 ? 0 : 
-				(b->ddk.Interfaces == 2 ? 0x6: 0)));
-		b->chan[i].dir = (b->ddk.Interfaces == 2) ? (i%2) : 0;
-		b->chan[i].mtu = 1504;
-	}
-#if 0
-	/* c->num == 0 */
-	req = b->cr.queue;
-	/* We must have some here */
-	CE_ASSERT (req);
-	req->Command = TAU32_Configure_E1;
-	req->Io.InterfaceConfig.Interface = TAU32_E1_A;
-	req->Io.InterfaceConfig.Config = b->chan[0].config;
-	req->Io.InterfaceConfig.UnframedTsMask = 0;
-	if (!ce_cfg_submit (b)) {
-		CE_DDK_DEBUG (b, b->chan + 0,
-			      ("Submit request failure, line %d\n",
-			      __LINE__));
-	}
-	/* c->num == 1 */
-	if (b->ddk.Interfaces == 2) {
-		req = b->cr.queue;
-		/* We must have some here */
-		CE_ASSERT (req);
-		req->Command = TAU32_Configure_E1;
-		req->Io.InterfaceConfig.Interface = TAU32_E1_B;
-		req->Io.InterfaceConfig.Config = b->chan[1].config;
-		req->Io.InterfaceConfig.UnframedTsMask = 0;
-		if (!ce_cfg_submit (b)) {
-			CE_DDK_DEBUG (b, b->chan + 1,
-				      ("Submit request failure, line %d\n",
-				      __LINE__));
-		}
-	}
-#endif
-	/* Set default cross matrix */
-	for (i = 0; i < 32; i++) {
-		/* -X-> Peb */
-		b->dxc[i] = TAU32_CROSS_OFF;
-		/* Link2 -> Link1 */
-		b->dxc[i + 32] = i + 64;
-		/* Link1 -> Link2 */
-		b->dxc[i + 64] = i + 32;
-	}
-
-	/* We have only mux mode for now. Later we will also have cross mode */
-	b->mux = 1;
-}
-
-void ce_start_chan (ce_chan_t *c, int tx, int rx, ce_buf_t *cb,
-	unsigned long phys)
-{
-	int i;
-	ce_board_t *b = c->board;
-
-/*	c->config = TAU32_ais_on_loss | TAU32_framed_cas_cross;*/
-
-	if (cb) {
-		CE_DDK_DEBUG (b, c, ("ce_buf_t virt:%p phys:%p\n", cb,
-			      (void *)phys));
-		c->tx_item = cb->tx_item;
-		c->rx_item = cb->rx_item;
-		c->tx_queue = NULL;
-		c->rx_queue = NULL;
-		for (i = 0; i < TAU32_IO_QUEUE; i++) {
-			c->tx_item[i].phys = phys +
-				((char *)(c->tx_item[i].buf)-(char *)cb);
-			c->rx_item[i].phys = phys +
-				((char *)(c->rx_item[i].buf)-(char *)cb);
-			cb->tx_item[i].req.sys = c;
-			cb->rx_item[i].req.sys = c;
-			CE_DDK_DEBUG (b, c, ("tx_item[%d].buf virt:%p phys:%p\n",
-				      i, c->tx_item[i].buf,
-				      (void *)c->tx_item[i].phys));
-			CE_DDK_DEBUG (b, c, ("rx_item[%d].buf virt:%p phys:%p\n",
-				      i, c->rx_item[i].buf,
-				      (void *)c->rx_item[i].phys));
-			CE_ENQUEUE (c->rx_queue, &c->rx_item[i].req);
-			CE_ENQUEUE (c->tx_queue, &c->tx_item[i].req);
-		}
-		c->tx_pending = 0;
-		c->rx_pending = 0;
-	}
-
-	/* submit rx */
-	while (1) {
-		ce_buf_item_t *item;
-		TAU32_UserRequest *req;
-		
-		CE_DEQUEUE (c->rx_queue, req);
-		if (!req)
-			break;
-		item = (ce_buf_item_t *) req;
-		CE_ASSERT (c->rx_pending < TAU32_IO_QUEUE);
-		req->Command = TAU32_Rx_Data;
-		req->Io.Rx.Channel = c->num;
-		req->pCallback = ce_on_receive;
-		req->Io.Rx.BufferLength = c->mtu + (c->phony ? 0 : 4);
-		req->Io.Rx.PhysicalDataAddress = item->phys;
-		c->rx_pending++;
-		if (!TAU32_SubmitRequest (b->ddk.pControllerObject, req)) {
-			CE_DDK_DEBUG (b, c, ("Faild to submit rx request\n"));
-			/*XXXRIK: shouldn't happen, but ... */
-			CE_ASSERT (0);
-			c->rx_pending--;
-			break;
-		}	
-	}
-
-	if (tx | rx) {
-		TAU32_UserRequest *req;
-		CE_PREREQUEST (b, c, b->cr.queue, req);
-		if (!req)
- 			return;
-		req->Command = TAU32_Configure_Commit |
-			       (tx ? TAU32_Tx_Start : 0) |
-			       (rx ? TAU32_Rx_Start : 0);
-		req->Io.ChannelNumber = c->num;
-		if (!ce_cfg_submit (b)) {
-			CE_DDK_DEBUG (b, c, ("Can't start chan\n"));
-			/* Do some error processing */
-			return;
-		}
-	}
-
-	/* If we run just after ce_board_init we have prope values.
-	 * Else I hope you didn't set ts to incorrect value.
-	 */
-	_ce_set_ts (c, c->ts);
-	if (c->num < b->ddk.Interfaces) {
-		/* The same for other modes. We don't check them.
-		 * We hope that config is correctly set. Just as we have
-		 * after ce_board_init. If channel was stoped we hope that
-		 * it's config was not broken just after it and we didn't
-		 * brake it before start.
-		 */
-		_ce_submit_configure_e1 (c, "start_init");
-	}
-}
-
-void ce_stop_chan (ce_chan_t *c)
-{
-	ce_board_t *b = c->board;
-	TAU32_UserRequest *req;
-	CE_DEQUEUE (b->cr.queue, req);
-
-	/* XXXRIK: This function should be for completeness, but for now I
-	 * don't use it. I just started to write and haven't finished it yet.
-	 * It is VERY BUGGY!!! Do not use it. If you really need
-	 * it ask me to fix it or rewrite it by yourself.
-	 * Note: most buggy part of it in ce_on_config_stop!
-	 */
-	if (!req) {
-		CE_DDK_DEBUG (b, c, ("Fatal error, no free structs for "
-			      "UserRequest (%s:%d)\n", __FUNCTION__, __LINE__));
-		return;
-	}
-//	req->Command = TAU32_Configure_Commit |
-//		       TAU32_Tx_Stop | TAU32_Rx_Stop;
-	req->Command = 0;
-	req->Io.ChannelNumber = c->num;
-	req->pCallback = ce_on_config_stop;
-	b->cr.pending++;
-
-	if (!TAU32_SubmitRequest (b->ddk.pControllerObject, req)) {
-		CE_ENQUEUE_HEAD (b->cr.queue, req);
-		CE_DDK_DEBUG (b, c, ("Can't stop chan\n"));
-		b->cr.pending--;
-	}
-}	
-
-void ce_register_transmit (ce_chan_t *c,
-	void (*func) (ce_chan_t*, void*, int))
-{
-	c->transmit = func;
-}
-
-void ce_register_receive (ce_chan_t *c,
-	void (*func) (ce_chan_t*, unsigned char*, int))
-{
-	c->receive = func;
-}
-
-void ce_register_error (ce_chan_t *c,
-	void (*func) (ce_chan_t*, int))
-{
-	c->error = func;
-}
-
-void TAU32_CALLBACK_TYPE ce_error_callback (TAU32_UserContext *pContext,
-						int Item, unsigned NotifyBits)
-{
-	ce_board_t *b = (ce_board_t *) pContext;
-	ENTER ();
-	if (NotifyBits & (TAU32_ERROR_FAIL | TAU32_ERROR_TIMEOUT
-		| TAU32_ERROR_INT_OVER_TX | TAU32_ERROR_INT_OVER_RX
-		| TAU32_ERROR_INT_STORM)) {
-		/* Fatal: adapter failure, need reset & restart */
-		/* RIKXXX: probably I should add CE_FAILURE for ce_error */
-		CE_DDK_DEBUG (b, (ce_chan_t *)0, ("Err, disable interrupts: %s\n",
-				ce_err2str (NotifyBits)));
-/*		TAU32_DisableInterrupts (b->ddk.pControllerObject);*/
-		EXIT ();
-	}
-	if (Item >= 0) {
-		/* channel error */
-		ce_chan_t *c = b->chan + Item;
-		if (NotifyBits & TAU32_ERROR_TX_UNDERFLOW) {
-			c->underrun++;
-			if (c->error)
-				c->error (c, CE_UNDERRUN);
-		}
-		if (NotifyBits & TAU32_ERROR_RX_OVERFLOW) {
-			c->overrun++;
-			if (c->error)
-				c->error (c, CE_OVERFLOW);
-		}
-		if (NotifyBits & (TAU32_ERROR_RX_FRAME | TAU32_ERROR_RX_ABORT |
-		    TAU32_ERROR_RX_SHORT | TAU32_ERROR_RX_LONG |
-		    TAU32_ERROR_RX_SYNC | TAU32_ERROR_RX_SPLIT |
-		    TAU32_ERROR_RX_UNFIT)) {
-			c->frame++;
-			CE_DDK_DEBUG (b, c, ("Frame error: %x\n", NotifyBits));
-			if (c->error)
-				c->error (c, CE_FRAME);
-		}
-		if(NotifyBits & TAU32_ERROR_RX_CRC) {
-			c->crc++;
-			if (c->error)
-				c->error (c, CE_CRC);
-		}
-	} else {
-		CE_DDK_DEBUG (b, (ce_chan_t *)0, ("Another error: %x\n",
-			      NotifyBits));
-		/* Adapter error, do smth */
-	}
-	EXIT ();
-}
-
-void TAU32_CALLBACK_TYPE ce_status_callback(TAU32_UserContext *pContext,
-						int Item, unsigned NotifyBits)
-{
-	ce_board_t *b = (ce_board_t *) pContext;
-	ENTER ();
-	if(Item >= 0) {
-		/* e1 status */
-		ce_chan_t *c = b->chan + Item;
-		c->acc_status |= b->ddk.InterfacesInfo[Item].Status;
-/*		CE_DDK_DEBUG (b, c, ("Current status: %x\n", c->acc_status));*/
-	} else {
-		CE_DDK_DEBUG (b, (ce_chan_t *)0, ("Another status: %x\n", NotifyBits));
-		/* Adapter status, do smth. */
-	}
-	EXIT ();
-}
-
-int ce_get_cd (ce_chan_t *c)
-{
-	unsigned int e1status = c->board->ddk.InterfacesInfo[c->dir].Status;
-
-	return (c->ts && !(e1status & (TAU32_RCL | TAU32_E1OFF)));
-}
-
-int ce_get_cts (ce_chan_t *c)
-{
-	return 0;
-}
-
-int ce_get_dsr (ce_chan_t *c)
-{
-	return 0;
-}
-
-void ce_e1_timer (ce_chan_t *c)
-{
-	unsigned bpv, fas, crc4, ebit, pcv, oof, css;
-	unsigned int acc_status;
-	ce_board_t *b = c->board;
-	TAU32_E1_State	*state;
-
-	if (c->num >= b->ddk.Interfaces)
-		return;
-
-	state = &b->ddk.InterfacesInfo[c->num];
-	acc_status = c->acc_status;
-
-	/* Clear acc_status */
-	c->acc_status = b->ddk.InterfacesInfo[c->num].Status;
-
-	/* Count seconds.
-	 * During the first second after the channel startup
-	 * the status registers are not stable yet,
-	 * we will so skip the first second. */
-	++c->cursec;
-	if (! c->totsec && c->cursec <= 1)
-		return;
-
-	c->status = 0;
-
-	/* Compute the SNMP-compatible channel status. */
-	oof = 0;
-
-	if (acc_status & TAU32_RCL)
-		c->status |= ESTS_LOS;		/* loss of signal */
-	if (acc_status & TAU32_RUA1)
-		c->status |= ESTS_AIS;		/* receiving all ones */
-
-	/* Get error counters. */
-	bpv = state->RxViolations;
-	fas = 0;
-	crc4 = 0;
-	ebit = 0;
-	css = 0;
-
-	if (! c->unfram) {
-		if (! c->use16 && (acc_status & TAU32_RSA1))
-			c->status |= ESTS_AIS16;	/* signaling all ones */
-		if (! c->use16 && (acc_status & TAU32_RDMA))
-			c->status |= ESTS_FARLOMF;	/* alarm in timeslot 16 */
-		if (acc_status & TAU32_RRA)
-			c->status |= ESTS_FARLOF;	/* far loss of framing */
-
-		if (acc_status & TAU32_RFAS) {
-			c->status |= ESTS_LOF;		/* loss of framing */
-			++oof;				/* out of framing */
-		}
-		if ((! c->use16 && (acc_status & TAU32_RCAS)) ||
-		    (c->crc4 && (acc_status & TAU32_RCRC4))) {
*** 7894 LINES SKIPPED ***



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202212132026.2BDKQnlT036779>