Driver for Granch SBNI16 SHDSL modem

Submitted by:	Denis I. Timofeev <timofeev@granch.ru>
MFC after:	1 week
This commit is contained in:
Max Khon 2003-04-13 06:27:13 +00:00
parent 983985c11e
commit 7d0de413cb
8 changed files with 1348 additions and 0 deletions

View File

@ -186,6 +186,7 @@ MAN= aac.4 \
sa.4 \
sbc.4 \
sbp.4 \
sbsh.4 \
screen.4 \
scsi.4 \
sd.4 \
@ -299,6 +300,7 @@ MLINKS+=pcn.4 if_pcn.4
MLINKS+=pcvt.4 vt.4
MLINKS+=ppp.4 if_ppp.4
MLINKS+=rl.4 if_rl.4
MLINKS+=sbsh.4 if_sbsh.4
MLINKS+=scsi.4 CAM.4
MLINKS+=scsi.4 SCSI.4
MLINKS+=scsi.4 cam.4

83
share/man/man4/sbsh.4 Normal file
View File

@ -0,0 +1,83 @@
.\" Written by Denis I. Timofeev, 2003.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\" notice, this list of conditions and the following disclaimer.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\" notice, this list of conditions and the following disclaimer in the
.\" documentation and/or other materials provided with the distribution.
.\"
.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
.\" $FreeBSD$
.\"
.Dd April 11, 2003
.Dt SBSH 4
.Os
.Sh NAME
.Nm sbsh
.Nd "Granch SBNI16 SHDSL modem device driver"
.Sh SYNOPSIS
.Cd "device sbsh"
.Sh DESCRIPTION
The
.Nm
driver provides support for an internal PCI modem SBNI16-SHDSL. A device
is introduced to OS as common ethernet-like netcard which must be
configured with
.Xr ifconfig 8
(all standard network interface parameters could be set). Modem-specific
parameters (master/slave mode, line rate etc.) must be set with the
sb16config utility before interface activation.
.Sh DIAGNOSTICS
.Bl -diag
.It "sbsh%d: couldn't map memory"
.It "sbsh%d: couldn't map interrupt"
.It "sbsh%d: couldn't set up irq"
A fatal initialization error has occurred.
.It "sbsh%d: unable to load firmware"
A fatal error has occurred while sb16config running.
.It "sbsh%d: firmware wasn't loaded"
ifconfig...up has failed because device hadn't been configured with
sb16config.
.It "sbsh%d: transmit timeout"
.It "sbsh%d: interrupt posted but not delivered"
Probably, a hardware error or incompatibility.
.It "sbsh%d: unable to get mbuf"
.It "sbsh%d: unable to get mbuf cluster"
The driver failed to allocate a memory buffer.
.El
.Sh FILES
The sources for the driver reside in:
.Pp
.Bl -tag -compact
.It Pa /sys/dev/sbsh/if_sbsh.c
.It Pa /sys/dev/sbsh/if_sbshreg.h
.El
.Sh SEE ALSO
.Xr arp 4 ,
.Xr netintro 4 ,
.Xr ifconfig 8 ,
.Xr /usr/ports/sysutils/sb16config
.Sh HISTORY
The
.Nm
device driver first appeared in
.Fx 4.9 .
.Sh AUTHORS
The
.Nm
driver was written by
.An Denis I. Timofeev Aq timofeev@granch.ru .

View File

@ -1540,6 +1540,7 @@ device miibus
# card which is 32-bit.
# sis: Support for NICs based on the Silicon Integrated Systems SiS 900,
# SiS 7016 and NS DP83815 PCI fast ethernet controller chips.
# sbsh: Support for Granch SBNI16 SHDSL modem PCI adapters
# sk: Support for the SysKonnect SK-984x series PCI gigabit ethernet NICs.
# This includes the SK-9841 and SK-9842 single port cards (single mode
# and multimode fiber) and the SK-9843 and SK-9844 dual port cards
@ -1616,6 +1617,7 @@ device my # Myson Fast Ethernet (MTD80X, MTD89X)
device rl # RealTek 8129/8139
device pcn # AMD Am79C97x PCI 10/100 NICs
device sf # Adaptec AIC-6915 (``Starfire'')
device sbsh # Granch SBNI16 SHDSL modem
device sis # Silicon Integrated Systems SiS 900/SiS 7016
device ste # Sundance ST201 (D-Link DFE-550TX)
device tl # Texas Instruments ThunderLAN

View File

@ -636,6 +636,7 @@ dev/rp/rp.c optional rp
dev/rp/rp_isa.c optional rp isa
dev/rp/rp_pci.c optional rp pci
dev/sab/sab.c optional sab ebus
dev/sbsh/if_sbsh.c optional sbsh
dev/scd/scd.c optional scd isa
dev/scd/scd_isa.c optional scd isa
dev/si/si.c optional si

1057
sys/dev/sbsh/if_sbsh.c Normal file

File diff suppressed because it is too large Load Diff

194
sys/dev/sbsh/if_sbshreg.h Normal file
View File

@ -0,0 +1,194 @@
/**
* Granch SBNI16 G.SHDSL Modem driver definitions
* Written by Denis I. Timofeev, 2002-2003.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $FreeBSD$
*/
/* SBNI16 controller chip definitions */
/* CR bits */
#define TXEN 0x01 /* transmitter enable */
#define RXEN 0x02 /* receiver enable */
#define NCRC 0x04 /* ignore received CRC */
#define DLBK 0x08 /* digital loopback */
#define CMOD 0x10 /* 0 - use CRC-32, 1 - CRC-16 */
#define FMOD 0x20 /* interframe fill: 0 - all ones, 1 - 0xfe */
#define PMOD 0x40 /* data polarity: 0 - normal, 1 - invert */
#define XRST 0x80 /* reset the transceiver */
/* CRB bits */
#define RDBE 0x01 /* read burst enable */
#define WTBE 0x02 /* write burst enable */
#define RODD 0x04 /* receive 2-byte alignment */
#define RXDE 0x08 /* receive data enable */
/* SR and IMR bits */
#define TXS 0x01 /* transmit success */
#define RXS 0x02 /* receive success */
/* SR only */
#define CRC 0x04 /* CRC error */
#define OFL 0x08 /* fifo overflow error */
#define UFL 0x10 /* fifo underflow error */
#define EXT 0x20 /* interrupt from sk70725 */
/* IMR only */
#define TSI 0x80 /* generate test interrupt */
#define LAST_FRAG 0x00008000
#define SBNI16_MAX_FRAME (1536 + 16)
/* We don't have official vendor id yet... */
#define SBNI16_VENDOR 0x55
#define SBNI16_DEVICE 0x9d
#define SBNI16_SUBDEV 3
/* transceiver chip set definitions */
enum CX28975_API_commands {
_DSL_RESET_SYSTEM = 0x00,
_DSL_SYSTEM_ENABLE = 0x01,
_DSL_AFE_CONFIG = 0x02,
_DSL_TRAINING_MODE = 0x03,
_DSL_CLOCK_CONFIG = 0x04,
_DSL_PCM_MF_LEN = 0x05,
_DSL_SYSTEM_CONFIG = 0x06,
_DSL_LOOPBACK = 0x09,
_DSL_ACTIVATION = 0x0b,
_DSL_FORCE_DEACTIVATE = 0x0c,
_DSL_TEST_MODE = 0x0d,
_DSL_DATA_RATE = 0x0e,
_DSL_PREACTIVATION_CFG = 0x0f,
_DSL_FR_PCM_CONFIG = 0x10,
_DSL_FR_HDSL_CONFIG = 0x11,
_DSL_PCM_CLK_CONF = 0x12,
_AFE_TX_GAIN = 0x13,
_DSL_PREACT_USER_INFO = 0x14,
_DSL_PREACT_RATE_LIST = 0x15,
_DSL_TX_ISO_PULSE = 0x16,
_BP_ERLE_TEST_MODE = 0x18,
_DSL_MULTI_PAIR_CONFIG = 0x19,
_DSL_NB_MULTI_RATE_CONFIG = 0x1a,
_DSL_MULTI_RATE_CONFIG = 0x1b,
_ATM_PHY_MODE = 0x1c,
_ATM_PHY_UTOPIA_CONFIG = 0x1d,
_ATM_PHY_IF_MODE = 0x1e,
_ATM_PHY_INJECT_HEC_ERROR = 0x1f,
_ATM_PHY_CONFIG = 0x20,
_DSL_TNB_BER_STATE = 0x21,
_DSL_RNB_BER_STATE = 0x22,
_DSL_TP_BER_STATE = 0x23,
_DSL_RP_BER_STATE = 0x24,
_DSL_PRBS_CONFIGURE = 0x25,
_DSL_CONST_FILL = 0x26,
_DSL_DBANK = 0x27,
_DSL_NB_CONFIG = 0x28,
_DSL_TNB_FRM_OFST = 0x29,
_DSL_RNB_FRM_OFST = 0x2a,
_DSL_TP_FRM_OFST = 0x2e,
_DSL_RP_FRM_OFST = 0x2f,
_DSL_TP_MAPPER_VALUE = 0x30,
_DSL_TP_MAPPER_WRITE = 0x31,
_DSL_RP_MAPPER_VALUE = 0x32,
_DSL_RP_MAPPER_WRITE = 0x33,
_DSL_TH_MAPPER_VALUE = 0x34,
_DSL_TH_MAPPER_WRITE = 0x35,
_DSL_RH_MAPPER_VALUE = 0x36,
_DSL_RH_MAPPER_WRITE = 0x37,
_DSL_TNB_MAPPER_VALUE = 0x38,
_DSL_TNB_MAPPER_WRITE = 0x39,
_DSL_RNB_MAPPER_VALUE = 0x3a,
_DSL_RNB_MAPPER_WRITE = 0x3b,
_DSL_CLEAR_ERROR_CTRS = 0x40,
_DSL_INJECT_CRC_ERROR = 0x41,
_DSL_THRESHOLDS = 0x43,
_DSL_FR_SET_STATE_MACHINE = 0x4a,
_DSL_FR_TNB_RESET = 0x4b,
_DSL_FR_RNB_RESET = 0x4c,
_EOC_RESET = 0x4d,
_DSL_FR_TX_RESET = 0x4e,
_DSL_FR_RX_RESET = 0x4f,
_DSL_INTR_HOST_MASK = 0x50,
_DSL_INTR_API_SUBMASK = 0x51,
_DSL_DOWNLOAD_START = 0x53,
_DSL_DOWNLOAD_DATA = 0x54,
_DSL_DOWNLOAD_END = 0x55,
_DSL_DPLL_CLOCK_GEN = 0x58,
_DSL_NB_DPLL_CLOCK_GEN = 0x59,
_DSL_WRITE_REG = 0x75,
_DSL_WRITE_AFE = 0x76
};
enum CX28975_status_commands {
_DSL_READ_CONTROL = 0x80,
_DSL_FAR_END_ATTEN = 0x82,
_DSL_NOISE_MARGIN = 0x83,
_DSL_STATUS = 0x85,
_DSL_PREACT_GET_FE_CAPS = 0x88,
_DSL_PREACT_GET_OPT_DATA_RATE = 0x89,
_DSL_VERSIONS = 0x8a,
_DSL_TP_BER_RESULTS = 0x8c,
_DSL_RP_BER_RESULTS = 0x8d,
_DSL_STAGE_NUMBER = 0x8f,
_DSL_AFE_SETTING = 0x90,
_DSL_TNB_BER_RESULTS = 0x91,
_DSL_RNB_BER_RESULTS = 0x92,
_BP_ERLE_RESULTS = 0x93,
_DSL_POWER_BACK_OFF_RESULT = 0x94,
_DSL_OPER_ERR_CTRS = 0x9c,
_DSL_TIME = 0x9d,
_DSL_HDSL_PERF_ERR_CTRS = 0x9e,
_DSL_READ_REG = 0xa0,
_DSL_READ_AFE = 0xa1,
_DSL_SYSTEM_PERF_ERR_CTRS = 0xa2,
_DSL_TP_MAPPER_READ = 0xa3,
_DSL_RP_MAPPER_READ = 0xa4,
_DSL_TH_MAPPER_READ = 0xa5,
_DSL_RH_MAPPER_READ = 0xa6,
_DSL_TNB_MAPPER_READ = 0xa7,
_DSL_RNB_MAPPER_READ = 0xa8,
_EOC_RX_GET_STATS = 0xae,
_EOC_TX_SEND_COMMAND = 0xb0,
_EOC_RX_GET_MSG = 0xb1,
_EOC_TX_GET_MSG_STATUS = 0xb2,
_EOC_TX_DELETE_MSG = 0xb3,
_ATM_PHY_OPER_ERR_CTRS = 0xb8,
_ATM_PHY_PERF_ERR_CTRS = 0xb9,
_ATM_PHY_CELL_CTRS = 0xba
};
enum CX28975_acknoledge_status_codes {
_ACK_NOT_COMPLETE = 0x00,
_ACK_PASS = 0x01,
_ACK_BUSY = 0x02,
_ACK_NOT_APPLICABLE = 0x03,
_ACK_INVALID_DEST = 0x04,
_ACK_INVALID_OPCODE = 0x05,
_ACK_INVALID_LENGTH = 0x06,
_ACK_INVALID_DATA = 0x07,
_ACK_INVALID_CHKSUM = 0x08,
_ACK_NO_RESULT = 0x09,
_ACK_NOT_AVAILABLE = 0x0a,
_ACK_BOOT_WAKE_UP = 0x0d,
_ACK_OPER_WAKE_UP = 0x0e
};

View File

@ -94,6 +94,7 @@ SUBDIR= accf_data \
rc4 \
rl \
rp \
sbsh \
sf \
sis \
sk \

View File

@ -0,0 +1,8 @@
# $FreeBSD$
.PATH: ${.CURDIR}/../../dev/sbsh
KMOD= if_sbsh
SRCS= if_sbsh.c bus_if.h device_if.h pci_if.h
.include <bsd.kmod.mk>