Remove the si(4) driver and sicontrol(8) for Specialix serial cards.
The si(4) driver supported multiport serial adapters for ISA, EISA, and PCI buses. This driver does not use bus_space, instead it depends on direct use of the pointer returned by rman_get_virtual(). It is also still locked by Giant and calls for patch testing to convert it to use bus_space were unanswered. Relnotes: yes
This commit is contained in:
parent
73479f949e
commit
e24281ea43
@ -38,6 +38,10 @@
|
||||
# xargs -n1 | sort | uniq -d;
|
||||
# done
|
||||
|
||||
# 20160819: Remove si(4) and sicontrol(8)
|
||||
OLD_FILES+=usr/share/man/man4/si.4.gz
|
||||
OLD_FILES+=usr/sbin/sicontrol
|
||||
OLD_FILES+=usr/share/man/man8/sicontrol.8.gz
|
||||
# 20160819: Remove scd(4)
|
||||
OLD_FILES+=usr/share/man/man4/scd.4.gz
|
||||
# 20160815: Remove mcd(4)
|
||||
|
@ -453,7 +453,6 @@ MAN= aac.4 \
|
||||
sf.4 \
|
||||
${_sfxge.4} \
|
||||
sge.4 \
|
||||
si.4 \
|
||||
siba.4 \
|
||||
siftr.4 \
|
||||
siis.4 \
|
||||
|
@ -1,181 +0,0 @@
|
||||
.\" $FreeBSD$
|
||||
.Dd September 16, 1995
|
||||
.Dt SI 4
|
||||
.Os
|
||||
.Sh NAME
|
||||
.Nm si
|
||||
.Nd "driver for Specialix International SI/XIO or SX intelligent serial card"
|
||||
.Sh SYNOPSIS
|
||||
.Cd "device si"
|
||||
.Pp
|
||||
For ISA host cards put the following lines in
|
||||
.Pa /boot/device.hints :
|
||||
.Cd hint.si.0.at="isa"
|
||||
.Cd hint.si.0.maddr="0xd0000"
|
||||
.Cd hint.si.0.irq="12"
|
||||
.Sh DESCRIPTION
|
||||
The Specialix SI/XIO and SX hardware makes up an 8 to 32 port RS-232 serial
|
||||
multiplexor.
|
||||
.Pp
|
||||
The system uses two components: a "Host adapter", which is plugged into
|
||||
an ISA, EISA or PCI slot and provides intelligence and buffering/processing
|
||||
capabilities, as well as an external bus in the form of a 37 pin cable.
|
||||
.Pp
|
||||
On this cable, "modules" are connected.
|
||||
The "SI" module comes in a 4 and 8 port version.
|
||||
The "XIO" and "SX" modules come only in
|
||||
8 port versions.
|
||||
.Pp
|
||||
The host adapter polls and transfers data between the modules and the rest
|
||||
of the machine.
|
||||
The Host adapter provides a 256 byte transmit and 256 byte
|
||||
receive FIFO for each of the 32 ports that it can maintain.
|
||||
.Pp
|
||||
The XIO modules can operate each of their 8 ports at 115,200 baud.
|
||||
The SI version can run at 57,600 baud.
|
||||
The SX modules can operate each of their
|
||||
8 ports at up to 921,600 baud.
|
||||
.Pp
|
||||
SX modules are only supported when connected to an SX host card.
|
||||
SI or
|
||||
XIO modules are supported on any host card.
|
||||
.Pp
|
||||
The host adapter uses a shared memory block in the traditional ISA bus
|
||||
"hole" between 0xA0000 and 0xEFFFF.
|
||||
The adapter can be configured outside
|
||||
range, but requires the memory range to be explicitly non-cached.
|
||||
The driver does not yet support this mode of operation.
|
||||
.Pp
|
||||
SX ISA Host cards have an 8/16 bit mode switch or jumper on them.
|
||||
This switch
|
||||
or jumper MUST be set for 8 bit mode.
|
||||
.Pp
|
||||
The ISA adapters can use Irq's 11, 12 or 15 (and 9 and 10 in the case of
|
||||
SX host cards).
|
||||
.Pp
|
||||
The si device driver may have some of its configuration settings changed
|
||||
at run-time with the
|
||||
.Xr sicontrol 8
|
||||
utility.
|
||||
.Pp
|
||||
The si device driver also responds to the
|
||||
.Xr comcontrol 8
|
||||
utility for configuring drain-on-close timeouts.
|
||||
.Pp
|
||||
The driver also defines 3 sysctl variables that can be manipulated:
|
||||
machdep.si_debug sets the debug level for the whole driver.
|
||||
It depends
|
||||
on the driver being compiled with SI_DEBUG.
|
||||
machdep.si_pollrate
|
||||
sets how often per second the driver polls for lost interrupts.
|
||||
machdep.si_realpoll sets whether or not the card will treat the
|
||||
poll intervals as if they were interrupts.
|
||||
.Pp
|
||||
An open on a /dev device node controlled by the si driver obeys the same
|
||||
semantics as the
|
||||
.Xr sio 4
|
||||
driver.
|
||||
It fully supports the usual semantics of the cua ports, and the
|
||||
"initial termios" and "locked termios" settings.
|
||||
In summary, an open on a
|
||||
tty port will block until DCD is raised, unless O_NONBLOCK is specified.
|
||||
CLOCAL is honored.
|
||||
An open on a cua port will always succeed, but DCD
|
||||
transitions will be honored after DCD rises for the first time.
|
||||
.Pp
|
||||
Up to four SI/XIO host cards may be controlled by the si driver.
|
||||
Due to the lack of available interrupts, only 3 ISA SI/XIO host cards can be
|
||||
used at once.
|
||||
.Pp
|
||||
The lowest 5 bits of the minor device number are used to select the port
|
||||
number on the module cluster.
|
||||
The next 2 bits select which of 4 host adapter
|
||||
cards.
|
||||
This allows a maximum of 128 ports on this driver.
|
||||
.Pp
|
||||
Bit 7 is used to differentiate a tty/dialin port (bit 7=0) and a
|
||||
cua/callout port (bit 7=1).
|
||||
.Pp
|
||||
Bit 8 through 15 (on
|
||||
.Fx )
|
||||
are unavailable as they are a shadow of the
|
||||
major device number.
|
||||
.Pp
|
||||
If bit 16 is a 1, the device node is referring to the "initial state" device.
|
||||
This "initial state" is used to prime the
|
||||
.Xr termios 4
|
||||
settings of the device when it is initially opened.
|
||||
If bit 17 is a 1, the device node is referring to the "locked state" device.
|
||||
The "locked state" is used to prevent the
|
||||
.Xr termios 4
|
||||
settings from being changed.
|
||||
.Pp
|
||||
To manipulate the initial/locked settings, the
|
||||
.Xr stty 1
|
||||
command is useful.
|
||||
When setting the "locked" variables, enabling the mode
|
||||
on the lock device will lock the termios mode, while disabling the mode will
|
||||
unlock it.
|
||||
.Sh FILES
|
||||
.Bl -tag -width /dev/si_control -compact
|
||||
.It Pa /dev/si_control
|
||||
global driver control file for
|
||||
.Xr sicontrol 8
|
||||
.It Pa /dev/ttyA*
|
||||
terminal/dialin ports
|
||||
.It Pa /dev/cuaA*
|
||||
dialout ports
|
||||
.It Pa /dev/ttyiA*
|
||||
initial termios state devices
|
||||
.It Pa /dev/ttylA*
|
||||
locked termios state devices
|
||||
.It Pa /dev/cuaiA*
|
||||
initial termios state devices for dialout ports
|
||||
.It Pa /dev/cualA*
|
||||
locked termios state devices for dialout ports
|
||||
.El
|
||||
.Sh SEE ALSO
|
||||
.Xr stty 1 ,
|
||||
.Xr sio 4 ,
|
||||
.Xr termios 4 ,
|
||||
.Xr tty 4 ,
|
||||
.Xr comcontrol 8 ,
|
||||
.Xr sicontrol 8
|
||||
.Sh HISTORY
|
||||
This driver is loosely based on driver code originating at Specialix, which
|
||||
was ported to run on BSDI by
|
||||
.An Andy Rutter Aq Mt andy@specialix.co.uk .
|
||||
The System V driver source is/was available by ftp from
|
||||
.Sy ftp.specialix.co.uk .
|
||||
.Pp
|
||||
This driver is not supported by Specialix International.
|
||||
.Sh AUTHORS
|
||||
.An -nosplit
|
||||
.An Peter Wemm Aq Mt peter@netplex.com.au
|
||||
obtained the code from
|
||||
.An Andy Rutter
|
||||
and ported it to
|
||||
.Fx
|
||||
and threw the man page together.
|
||||
.An Bruce Evans Aq Mt bde@zeta.org.au
|
||||
provided a large amount of assistance during porting.
|
||||
.An Nick Sayer Aq Mt nick@specialix.com
|
||||
wrote the EISA, PCI and SX portions.
|
||||
.Sh BUGS
|
||||
The interrupt tuning rate is not believed to be optimal at this time for
|
||||
maximum efficiency.
|
||||
.Pp
|
||||
Polled mode (a feature of standard Specialix drivers) is not implemented,
|
||||
but it can be approximated by turning on machdep.si_realpoll.
|
||||
The poll
|
||||
frequency is set by machdep.si_pollrate (in units of 1/100th of a second).
|
||||
.Pp
|
||||
The driver does not yet support baud rates higher than 115,200 on SX
|
||||
modules.
|
||||
.Pp
|
||||
Operation outside the traditional ISA "hole" is not yet supported, although it
|
||||
should work if the test is removed from the probe routine.
|
||||
.Pp
|
||||
Multiple host cards are supported although combinations of hosts on
|
||||
different bus types have not been tested - device numbering is known to
|
||||
be a problem and may lead to unexpected results.
|
@ -542,7 +542,6 @@ hint.pbio.0.port="0x360"
|
||||
device smbios
|
||||
device vpd
|
||||
device asmc
|
||||
device si
|
||||
device tpm
|
||||
device padlock_rng # VIA Padlock RNG
|
||||
device rdrand_rng # Intel Bull Mountain RNG
|
||||
|
@ -2511,12 +2511,6 @@ dev/sdhci/sdhci_if.m optional sdhci
|
||||
dev/sdhci/sdhci_pci.c optional sdhci pci
|
||||
dev/sf/if_sf.c optional sf pci
|
||||
dev/sge/if_sge.c optional sge pci
|
||||
dev/si/si.c optional si
|
||||
dev/si/si2_z280.c optional si
|
||||
dev/si/si3_t225.c optional si
|
||||
dev/si/si_eisa.c optional si eisa
|
||||
dev/si/si_isa.c optional si isa
|
||||
dev/si/si_pci.c optional si pci
|
||||
dev/siba/siba_bwn.c optional siba_bwn pci
|
||||
dev/siba/siba_core.c optional siba_bwn pci
|
||||
dev/siis/siis.c optional siis pci
|
||||
|
1649
sys/dev/si/si.c
1649
sys/dev/si/si.c
File diff suppressed because it is too large
Load Diff
395
sys/dev/si/si.h
395
sys/dev/si/si.h
@ -1,395 +0,0 @@
|
||||
/*-
|
||||
* Device driver for Specialix range (SI/XIO) of serial line multiplexors.
|
||||
* 'C' definitions for Specialix serial multiplex driver.
|
||||
*
|
||||
* Copyright (C) 1990, 1992, 1998 Specialix International,
|
||||
* Copyright (C) 1993, Andy Rutter <andy@acronym.co.uk>
|
||||
* Copyright (C) 1995, Peter Wemm <peter@netplex.com.au>
|
||||
*
|
||||
* Derived from: SunOS 4.x version
|
||||
*
|
||||
* 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
|
||||
* notices, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notices, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* This product includes software developed by Andy Rutter of
|
||||
* Advanced Methods and Tools Ltd. based on original information
|
||||
* from Specialix International.
|
||||
* 4. Neither the name of Advanced Methods and Tools, nor Specialix
|
||||
* International may be used to endorse or promote products derived from
|
||||
* this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY ``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 AUTHORS BE LIABLE.
|
||||
*
|
||||
* $FreeBSD$
|
||||
*/
|
||||
|
||||
#include <sys/callout.h>
|
||||
|
||||
/*
|
||||
* We name devices with %r in make_dev() with a radix of 32.
|
||||
*/
|
||||
#define SI_MAXPORTPERCARD 32
|
||||
|
||||
/* Buffer parameters */
|
||||
#define SI_BUFFERSIZE 256
|
||||
|
||||
typedef uint8_t BYTE; /* Type cast for unsigned 8 bit */
|
||||
typedef uint16_t WORD; /* Type cast for unsigned 16 bit */
|
||||
|
||||
/*
|
||||
* Hardware `registers', stored in the shared memory.
|
||||
* These are related to the firmware running on the Z280.
|
||||
*/
|
||||
|
||||
struct si_reg {
|
||||
BYTE initstat;
|
||||
BYTE memsize;
|
||||
WORD int_count;
|
||||
WORD revision;
|
||||
BYTE rx_int_count; /* isr_count on Jet */
|
||||
BYTE main_count; /* spare on Z-280 */
|
||||
WORD int_pending;
|
||||
WORD int_counter;
|
||||
BYTE int_scounter;
|
||||
BYTE res[0x80 - 13];
|
||||
};
|
||||
|
||||
/*
|
||||
* Per module control structure, stored in shared memory.
|
||||
*/
|
||||
struct si_module {
|
||||
WORD sm_next; /* Next module */
|
||||
BYTE sm_type; /* Number of channels */
|
||||
BYTE sm_number; /* Module number on cable */
|
||||
BYTE sm_dsr; /* Private dsr copy */
|
||||
BYTE sm_res[0x80 - 5]; /* Reserve space to 128 bytes */
|
||||
};
|
||||
|
||||
/*
|
||||
* The 'next' pointer & with 0x7fff + SI base address give
|
||||
* the address of the next module block if fitted. (else 0)
|
||||
* Note that next points to the TX buffer so 0x60 must be
|
||||
* subtracted to find the true base.
|
||||
*/
|
||||
#define TA4 0x00
|
||||
#define TA8 0x08
|
||||
#define TA4_ASIC 0x0A
|
||||
#define TA8_ASIC 0x0B
|
||||
#define MTA 0x28
|
||||
#define SXDC 0x48
|
||||
|
||||
/*
|
||||
* Per channel(port) control structure, stored in shared memory.
|
||||
*/
|
||||
struct si_channel {
|
||||
/*
|
||||
* Generic stuff
|
||||
*/
|
||||
WORD next; /* Next Channel */
|
||||
WORD addr_uart; /* Uart address */
|
||||
WORD module; /* address of module struct */
|
||||
BYTE type; /* Uart type */
|
||||
BYTE fill;
|
||||
/*
|
||||
* Uart type specific stuff
|
||||
*/
|
||||
BYTE x_status; /* XON / XOFF status */
|
||||
BYTE c_status; /* cooking status */
|
||||
BYTE hi_rxipos; /* stuff into rx buff */
|
||||
BYTE hi_rxopos; /* stuff out of rx buffer */
|
||||
BYTE hi_txopos; /* Stuff into tx ptr */
|
||||
BYTE hi_txipos; /* ditto out */
|
||||
BYTE hi_stat; /* Command register */
|
||||
BYTE dsr_bit; /* Magic bit for DSR */
|
||||
BYTE txon; /* TX XON char */
|
||||
BYTE txoff; /* ditto XOFF */
|
||||
BYTE rxon; /* RX XON char */
|
||||
BYTE rxoff; /* ditto XOFF */
|
||||
BYTE hi_mr1; /* mode 1 image */
|
||||
BYTE hi_mr2; /* mode 2 image */
|
||||
BYTE hi_csr; /* clock register */
|
||||
BYTE hi_op; /* Op control */
|
||||
BYTE hi_ip; /* Input pins */
|
||||
BYTE hi_state; /* status */
|
||||
BYTE hi_prtcl; /* Protocol */
|
||||
BYTE hi_txon; /* host copy tx xon stuff */
|
||||
BYTE hi_txoff;
|
||||
BYTE hi_rxon;
|
||||
BYTE hi_rxoff;
|
||||
BYTE close_prev; /* Was channel previously closed */
|
||||
BYTE hi_break; /* host copy break process */
|
||||
BYTE break_state; /* local copy ditto */
|
||||
BYTE hi_mask; /* Mask for CS7 etc. */
|
||||
BYTE mask_z280; /* Z280's copy */
|
||||
BYTE res[0x60 - 36];
|
||||
BYTE hi_txbuf[SI_BUFFERSIZE];
|
||||
BYTE hi_rxbuf[SI_BUFFERSIZE];
|
||||
BYTE res1[0xA0];
|
||||
};
|
||||
|
||||
/*
|
||||
* Register definitions
|
||||
*/
|
||||
|
||||
/*
|
||||
* Break input control register definitions
|
||||
*/
|
||||
#define BR_IGN 0x01 /* Ignore any received breaks */
|
||||
#define BR_INT 0x02 /* Interrupt on received break */
|
||||
#define BR_PARMRK 0x04 /* Enable parmrk parity error processing */
|
||||
#define BR_PARIGN 0x08 /* Ignore chars with parity errors */
|
||||
|
||||
/*
|
||||
* Protocol register provided by host for XON/XOFF and cooking
|
||||
*/
|
||||
#define SP_TANY 0x01 /* Tx XON any char */
|
||||
#define SP_TXEN 0x02 /* Tx XON/XOFF enabled */
|
||||
#define SP_CEN 0x04 /* Cooking enabled */
|
||||
#define SP_RXEN 0x08 /* Rx XON/XOFF enabled */
|
||||
#define SP_DCEN 0x20 /* DCD / DTR check */
|
||||
#define SP_PAEN 0x80 /* Parity checking enabled */
|
||||
|
||||
/*
|
||||
* HOST STATUS / COMMAND REGISTER
|
||||
*/
|
||||
#define IDLE_OPEN 0x00 /* Default mode, TX and RX polled
|
||||
buffer updated etc */
|
||||
#define LOPEN 0x02 /* Local open command (no modem ctl */
|
||||
#define MOPEN 0x04 /* Open and monitor modem lines (blocks
|
||||
for DCD */
|
||||
#define MPEND 0x06 /* Wating for DCD */
|
||||
#define CONFIG 0x08 /* Channel config has changed */
|
||||
#define CLOSE 0x0A /* Close channel */
|
||||
#define SBREAK 0x0C /* Start break */
|
||||
#define EBREAK 0x0E /* End break */
|
||||
#define IDLE_CLOSE 0x10 /* Closed channel */
|
||||
#define IDLE_BREAK 0x12 /* In a break */
|
||||
#define FCLOSE 0x14 /* Force a close */
|
||||
#define RESUME 0x16 /* Clear a pending xoff */
|
||||
#define WFLUSH 0x18 /* Flush output buffer */
|
||||
#define RFLUSH 0x1A /* Flush input buffer */
|
||||
|
||||
/*
|
||||
* Host status register
|
||||
*/
|
||||
#define ST_BREAK 0x01 /* Break received (clear with config) */
|
||||
|
||||
/*
|
||||
* OUTPUT PORT REGISTER
|
||||
*/
|
||||
#define OP_CTS 0x01 /* Enable CTS */
|
||||
#define OP_DSR 0x02 /* Enable DSR */
|
||||
/*
|
||||
* INPUT PORT REGISTER
|
||||
*/
|
||||
#define IP_DCD 0x04 /* DCD High */
|
||||
#define IP_DTR 0x20 /* DTR High */
|
||||
#define IP_RTS 0x02 /* RTS High */
|
||||
#define IP_RI 0x40 /* RI High */
|
||||
|
||||
/*
|
||||
* Mode register and uart specific stuff
|
||||
*/
|
||||
/*
|
||||
* MODE REGISTER 1
|
||||
*/
|
||||
#define MR1_5_BITS 0x00
|
||||
#define MR1_6_BITS 0x01
|
||||
#define MR1_7_BITS 0x02
|
||||
#define MR1_8_BITS 0x03
|
||||
/*
|
||||
* Parity
|
||||
*/
|
||||
#define MR1_ODD 0x04
|
||||
#define MR1_EVEN 0x00
|
||||
/*
|
||||
* Parity mode
|
||||
*/
|
||||
#define MR1_WITH 0x00
|
||||
#define MR1_FORCE 0x08
|
||||
#define MR1_NONE 0x10
|
||||
#define MR1_SPECIAL 0x18
|
||||
/*
|
||||
* Error mode
|
||||
*/
|
||||
#define MR1_CHAR 0x00
|
||||
#define MR1_BLOCK 0x20
|
||||
/*
|
||||
* Request to send line automatic control
|
||||
*/
|
||||
#define MR1_CTSCONT 0x80
|
||||
|
||||
/*
|
||||
* MODE REGISTER 2
|
||||
*/
|
||||
/*
|
||||
* Number of stop bits
|
||||
*/
|
||||
#define MR2_1_STOP 0x07
|
||||
#define MR2_2_STOP 0x0F
|
||||
/*
|
||||
* Clear to send automatic testing before character sent
|
||||
*/
|
||||
#define MR2_RTSCONT 0x10
|
||||
/*
|
||||
* Reset RTS automatically after sending character?
|
||||
*/
|
||||
#define MR2_CTSCONT 0x20
|
||||
/*
|
||||
* Channel mode
|
||||
*/
|
||||
#define MR2_NORMAL 0x00
|
||||
#define MR2_AUTO 0x40
|
||||
#define MR2_LOCAL 0x80
|
||||
#define MR2_REMOTE 0xC0
|
||||
|
||||
/*
|
||||
* CLOCK SELECT REGISTER - this and the code assumes ispeed == ospeed
|
||||
*/
|
||||
/*
|
||||
* Clocking rates are in lower and upper nibbles.. R = upper, T = lower
|
||||
*/
|
||||
#define CLK75 0x0
|
||||
#define CLK110 0x1 /* 110 on XIO!! */
|
||||
#define CLK38400 0x2 /* out of sequence */
|
||||
#define CLK150 0x3
|
||||
#define CLK300 0x4
|
||||
#define CLK600 0x5
|
||||
#define CLK1200 0x6
|
||||
#define CLK2000 0x7
|
||||
#define CLK2400 0x8
|
||||
#define CLK4800 0x9
|
||||
#define CLK7200 0xa /* unchecked */
|
||||
#define CLK9600 0xb
|
||||
#define CLK19200 0xc
|
||||
#define CLK57600 0xd
|
||||
|
||||
/*
|
||||
* Per-port (channel) soft information structure, stored in the driver.
|
||||
* This is visible via ioctl()'s.
|
||||
*/
|
||||
struct si_port {
|
||||
volatile struct si_channel *sp_ccb;
|
||||
struct tty *sp_tty;
|
||||
int sp_pend; /* pending command */
|
||||
int sp_last_hi_ip; /* cached DCD */
|
||||
int sp_state;
|
||||
int sp_delta_overflows;
|
||||
struct callout_handle lstart_ch;/* For canceling our timeout */
|
||||
int sp_debug; /* debug mask */
|
||||
char sp_name[5];
|
||||
};
|
||||
|
||||
/* sp_state */
|
||||
/* 0x0001 -- */
|
||||
/* 0x0002 -- */
|
||||
/* 0x0004 -- */
|
||||
/* 0x0008 -- */
|
||||
/* 0x0010 -- */
|
||||
/* 0x0020 -- */
|
||||
/* 0x0040 -- */
|
||||
/* 0x0080 -- */
|
||||
#define SS_LSTART 0x0100 /* lstart timeout pending */
|
||||
/* 0x0200 -- */
|
||||
/* 0x0400 -- */
|
||||
/* 0x0800 -- */
|
||||
|
||||
/*
|
||||
* Command post flags
|
||||
*/
|
||||
#define SI_NOWAIT 0x00 /* Don't wait for command */
|
||||
#define SI_WAIT 0x01 /* Wait for complete */
|
||||
|
||||
/*
|
||||
* SI ioctls
|
||||
*/
|
||||
/*
|
||||
* struct for use by Specialix ioctls - used by siconfig(8)
|
||||
*/
|
||||
typedef struct {
|
||||
unsigned char
|
||||
sid_port:5, /* 0 - 31 ports per card */
|
||||
sid_card:2, /* 0 - 3 cards */
|
||||
sid_control:1; /* controlling device (all cards) */
|
||||
} sidev_t;
|
||||
struct si_tcsi {
|
||||
sidev_t tc_dev;
|
||||
union {
|
||||
int x_int;
|
||||
int x_dbglvl;
|
||||
} tc_action;
|
||||
#define tc_card tc_dev.sid_card
|
||||
#define tc_port tc_dev.sid_port
|
||||
#define tc_int tc_action.x_int
|
||||
#define tc_dbglvl tc_action.x_dbglvl
|
||||
};
|
||||
|
||||
struct si_pstat {
|
||||
sidev_t tc_dev;
|
||||
union {
|
||||
struct si_port x_siport;
|
||||
struct si_channel x_ccb;
|
||||
struct tty x_tty;
|
||||
} tc_action;
|
||||
#define tc_siport tc_action.x_siport
|
||||
#define tc_ccb tc_action.x_ccb
|
||||
#define tc_tty tc_action.x_tty
|
||||
};
|
||||
|
||||
#define IOCTL_MIN 96
|
||||
#define TCSIDEBUG _IOW('S', 96, struct si_tcsi) /* Toggle debug */
|
||||
#define TCSIRXIT _IOW('S', 97, struct si_tcsi) /* RX int throttle */
|
||||
#define TCSIIT _IOW('S', 98, struct si_tcsi) /* TX int throttle */
|
||||
/* 99 defunct */
|
||||
/* 100 defunct */
|
||||
/* 101 defunct */
|
||||
/* 102 defunct */
|
||||
/* 103 defunct */
|
||||
/* 104 defunct */
|
||||
#define TCSISTATE _IOWR('S', 105, struct si_tcsi) /* get current state of RTS
|
||||
DCD and DTR pins */
|
||||
/* 106 defunct */
|
||||
#define TCSIPORTS _IOR('S', 107, int) /* Number of ports found */
|
||||
#define TCSISDBG_LEVEL _IOW('S', 108, struct si_tcsi) /* equivalent of TCSIDEBUG which sets a
|
||||
* particular debug level (DBG_??? bit
|
||||
* mask), default is 0xffff */
|
||||
#define TCSIGDBG_LEVEL _IOWR('S', 109, struct si_tcsi)
|
||||
#define TCSIGRXIT _IOWR('S', 110, struct si_tcsi)
|
||||
#define TCSIGIT _IOWR('S', 111, struct si_tcsi)
|
||||
/* 112 defunct */
|
||||
/* 113 defunct */
|
||||
/* 114 defunct */
|
||||
/* 115 defunct */
|
||||
/* 116 defunct */
|
||||
/* 117 defunct */
|
||||
|
||||
#define TCSISDBG_ALL _IOW('S', 118, int) /* set global debug level */
|
||||
#define TCSIGDBG_ALL _IOR('S', 119, int) /* get global debug level */
|
||||
|
||||
/* 120 defunct */
|
||||
/* 121 defunct */
|
||||
/* 122 defunct */
|
||||
/* 123 defunct */
|
||||
#define TCSIMODULES _IOR('S', 124, int) /* Number of modules found */
|
||||
|
||||
/* Various stats and monitoring hooks per tty device */
|
||||
#define TCSI_PORT _IOWR('S', 125, struct si_pstat) /* get si_port */
|
||||
#define TCSI_CCB _IOWR('S', 126, struct si_pstat) /* get si_ccb */
|
||||
|
||||
#define IOCTL_MAX 127
|
||||
|
||||
#define IS_SI_IOCTL(cmd) ((u_int)((cmd)&0xff00) == ('S'<<8) && \
|
||||
(u_int)((cmd)&0xff) >= IOCTL_MIN && \
|
||||
(u_int)((cmd)&0xff) <= IOCTL_MAX)
|
||||
|
||||
#define CONTROLDEV "/dev/si_control"
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -1,153 +0,0 @@
|
||||
/*-
|
||||
* Device driver for Specialix range (SI/XIO) of serial line multiplexors.
|
||||
*
|
||||
* Copyright (C) 2000, Peter Wemm <peter@netplex.com.au>
|
||||
*
|
||||
* 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
|
||||
* notices, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notices, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY ``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 AUTHORS BE LIABLE.
|
||||
*
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__FBSDID("$FreeBSD$");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
#include <sys/kernel.h>
|
||||
#include <sys/module.h>
|
||||
#include <sys/bus.h>
|
||||
#include <machine/bus.h>
|
||||
#include <sys/rman.h>
|
||||
#include <machine/resource.h>
|
||||
|
||||
#include <dev/si/sireg.h>
|
||||
#include <dev/si/sivar.h>
|
||||
|
||||
#include <dev/eisa/eisaconf.h>
|
||||
|
||||
static int
|
||||
si_eisa_probe(device_t dev)
|
||||
{
|
||||
u_long iobase;
|
||||
u_long maddr;
|
||||
int irq;
|
||||
|
||||
if (eisa_get_id(dev) != SIEISADEVID)
|
||||
return ENXIO;
|
||||
|
||||
device_set_desc(dev, "Specialix SI/XIO EISA host card");
|
||||
|
||||
iobase = (eisa_get_slot(dev) * EISA_SLOT_SIZE) + SIEISABASE;
|
||||
eisa_add_iospace(dev, iobase, SIEISAIOSIZE, RESVADDR_NONE);
|
||||
|
||||
maddr = (inb(iobase+1) << 24) | (inb(iobase) << 16);
|
||||
eisa_add_mspace(dev, maddr, SIEISA_MEMSIZE, RESVADDR_NONE);
|
||||
|
||||
irq = ((inb(iobase+2) >> 4) & 0xf);
|
||||
eisa_add_intr(dev, irq, EISA_TRIGGER_LEVEL); /* XXX shared? */
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
||||
static int
|
||||
si_eisa_attach(device_t dev)
|
||||
{
|
||||
struct si_softc *sc;
|
||||
void *ih;
|
||||
int error;
|
||||
|
||||
error = 0;
|
||||
ih = NULL;
|
||||
sc = device_get_softc(dev);
|
||||
|
||||
sc->sc_type = SIEISA;
|
||||
|
||||
sc->sc_port_rid = 0;
|
||||
sc->sc_port_res = bus_alloc_resource_any(dev, SYS_RES_IOPORT,
|
||||
&sc->sc_port_rid, RF_ACTIVE);
|
||||
if (!sc->sc_port_res) {
|
||||
device_printf(dev, "couldn't allocate ioports\n");
|
||||
goto fail;
|
||||
}
|
||||
sc->sc_iobase = rman_get_start(sc->sc_port_res);
|
||||
|
||||
sc->sc_mem_rid = 0;
|
||||
sc->sc_mem_res = bus_alloc_resource_any(dev, SYS_RES_MEMORY,
|
||||
&sc->sc_mem_rid, RF_ACTIVE);
|
||||
if (!sc->sc_mem_res) {
|
||||
device_printf(dev, "couldn't allocate iomemory");
|
||||
goto fail;
|
||||
}
|
||||
sc->sc_paddr = (caddr_t)rman_get_start(sc->sc_mem_res);
|
||||
sc->sc_maddr = rman_get_virtual(sc->sc_mem_res);
|
||||
|
||||
sc->sc_irq_rid = 0;
|
||||
sc->sc_irq_res = bus_alloc_resource_any(dev, SYS_RES_IRQ,
|
||||
&sc->sc_irq_rid,
|
||||
RF_ACTIVE | RF_SHAREABLE);
|
||||
if (!sc->sc_irq_res) {
|
||||
device_printf(dev, "couldn't allocate interrupt");
|
||||
goto fail;
|
||||
}
|
||||
sc->sc_irq = rman_get_start(sc->sc_irq_res);
|
||||
error = bus_setup_intr(dev, sc->sc_irq_res, INTR_TYPE_TTY,
|
||||
NULL, si_intr, sc,&ih);
|
||||
if (error) {
|
||||
device_printf(dev, "couldn't activate interrupt");
|
||||
goto fail;
|
||||
}
|
||||
|
||||
error = siattach(dev);
|
||||
if (error)
|
||||
goto fail;
|
||||
return (0); /* success */
|
||||
|
||||
fail:
|
||||
if (error == 0)
|
||||
error = ENXIO;
|
||||
if (sc->sc_irq_res) {
|
||||
if (ih)
|
||||
bus_teardown_intr(dev, sc->sc_irq_res, ih);
|
||||
bus_release_resource(dev, SYS_RES_IRQ,
|
||||
sc->sc_irq_rid, sc->sc_irq_res);
|
||||
sc->sc_irq_res = 0;
|
||||
}
|
||||
if (sc->sc_mem_res) {
|
||||
bus_release_resource(dev, SYS_RES_MEMORY,
|
||||
sc->sc_mem_rid, sc->sc_mem_res);
|
||||
sc->sc_mem_res = 0;
|
||||
}
|
||||
if (sc->sc_port_res) {
|
||||
bus_release_resource(dev, SYS_RES_IOPORT,
|
||||
sc->sc_port_rid, sc->sc_port_res);
|
||||
sc->sc_port_res = 0;
|
||||
}
|
||||
return (error);
|
||||
}
|
||||
|
||||
static device_method_t si_eisa_methods[] = {
|
||||
/* Device interface */
|
||||
DEVMETHOD(device_probe, si_eisa_probe),
|
||||
DEVMETHOD(device_attach, si_eisa_attach),
|
||||
|
||||
{ 0, 0 }
|
||||
};
|
||||
|
||||
static driver_t si_eisa_driver = {
|
||||
"si",
|
||||
si_eisa_methods,
|
||||
sizeof(struct si_softc),
|
||||
};
|
||||
|
||||
DRIVER_MODULE(si, eisa, si_eisa_driver, si_devclass, 0, 0);
|
@ -1,338 +0,0 @@
|
||||
/*-
|
||||
* Device driver for Specialix range (SI/XIO) of serial line multiplexors.
|
||||
*
|
||||
* Copyright (C) 2000, Peter Wemm <peter@netplex.com.au>
|
||||
*
|
||||
* 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
|
||||
* notices, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notices, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY ``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 AUTHORS BE LIABLE.
|
||||
*
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__FBSDID("$FreeBSD$");
|
||||
|
||||
#include "opt_debug_si.h"
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
#include <sys/kernel.h>
|
||||
#include <sys/module.h>
|
||||
#include <sys/bus.h>
|
||||
#include <machine/bus.h>
|
||||
#include <sys/rman.h>
|
||||
#include <machine/resource.h>
|
||||
|
||||
#include <dev/si/sireg.h>
|
||||
#include <dev/si/sivar.h>
|
||||
|
||||
#include <isa/isavar.h>
|
||||
|
||||
/* Look for a valid board at the given mem addr */
|
||||
static int
|
||||
si_isa_probe(device_t dev)
|
||||
{
|
||||
struct si_softc *sc;
|
||||
int type;
|
||||
u_int i, ramsize;
|
||||
volatile unsigned char was, *ux;
|
||||
volatile unsigned char *maddr;
|
||||
unsigned char *paddr;
|
||||
int unit;
|
||||
|
||||
/* No pnp support */
|
||||
if (isa_get_vendorid(dev))
|
||||
return (ENXIO);
|
||||
|
||||
sc = device_get_softc(dev);
|
||||
unit = device_get_unit(dev);
|
||||
|
||||
sc->sc_mem_rid = 0;
|
||||
sc->sc_mem_res = bus_alloc_resource_anywhere(dev, SYS_RES_MEMORY,
|
||||
&sc->sc_mem_rid,
|
||||
SIPROBEALLOC, RF_ACTIVE);
|
||||
if (!sc->sc_mem_res) {
|
||||
device_printf(dev, "cannot allocate memory resource\n");
|
||||
return ENXIO;
|
||||
}
|
||||
paddr = (caddr_t)rman_get_start(sc->sc_mem_res);/* physical */
|
||||
maddr = rman_get_virtual(sc->sc_mem_res); /* in kvm */
|
||||
|
||||
DPRINT((0, DBG_AUTOBOOT, "si%d: probe at virtual=0x%x physical=0x%x\n",
|
||||
unit, maddr, paddr));
|
||||
|
||||
/*
|
||||
* this is a lie, but it's easier than trying to handle caching
|
||||
* and ram conflicts in the >1M and <16M region.
|
||||
*/
|
||||
if ((caddr_t)paddr < (caddr_t)0xA0000 ||
|
||||
(caddr_t)paddr >= (caddr_t)0x100000) {
|
||||
device_printf(dev, "maddr (%p) out of range\n", paddr);
|
||||
goto fail;
|
||||
}
|
||||
|
||||
if (((uintptr_t)paddr & 0x7fff) != 0) {
|
||||
device_printf(dev, "maddr (%p) not on 32k boundary\n", paddr);
|
||||
goto fail;
|
||||
}
|
||||
|
||||
/* Is there anything out there? (0x17 is just an arbitrary number) */
|
||||
*maddr = 0x17;
|
||||
if (*maddr != 0x17) {
|
||||
device_printf(dev, "0x17 check fail at phys %p\n", paddr);
|
||||
goto fail;
|
||||
}
|
||||
/*
|
||||
* Let's look first for a JET ISA card, since that's pretty easy
|
||||
*
|
||||
* All jet hosts are supposed to have this string in the IDROM,
|
||||
* but it's not worth checking on self-IDing busses like PCI.
|
||||
*/
|
||||
{
|
||||
unsigned char *jet_chk_str = "JET HOST BY KEV#";
|
||||
|
||||
for (i = 0; i < strlen(jet_chk_str); i++)
|
||||
if (jet_chk_str[i] != *(maddr + SIJETIDSTR + 2 * i))
|
||||
goto try_mk2;
|
||||
}
|
||||
DPRINT((0, DBG_AUTOBOOT|DBG_FAIL, "si%d: JET first check - 0x%x\n",
|
||||
unit, (*(maddr+SIJETIDBASE))));
|
||||
if (*(maddr+SIJETIDBASE) != (SISPLXID&0xff))
|
||||
goto try_mk2;
|
||||
DPRINT((0, DBG_AUTOBOOT|DBG_FAIL, "si%d: JET second check - 0x%x\n",
|
||||
unit, (*(maddr+SIJETIDBASE+2))));
|
||||
if (*(maddr+SIJETIDBASE+2) != ((SISPLXID&0xff00)>>8))
|
||||
goto try_mk2;
|
||||
/* It must be a Jet ISA or RIO card */
|
||||
DPRINT((0, DBG_AUTOBOOT|DBG_FAIL, "si%d: JET id check - 0x%x\n",
|
||||
unit, (*(maddr+SIUNIQID))));
|
||||
if ((*(maddr+SIUNIQID) & 0xf0) != 0x20)
|
||||
goto try_mk2;
|
||||
/* It must be a Jet ISA SI/XIO card */
|
||||
*(maddr + SIJETCONFIG) = 0;
|
||||
type = SIJETISA;
|
||||
ramsize = SIJET_RAMSIZE;
|
||||
goto got_card;
|
||||
|
||||
try_mk2:
|
||||
/*
|
||||
* OK, now to see if whatever responded is really an SI card.
|
||||
* Try for a MK II next (SIHOST2)
|
||||
*/
|
||||
for (i = SIPLSIG; i < SIPLSIG + 8; i++)
|
||||
if ((*(maddr+i) & 7) != (~(unsigned char)i & 7))
|
||||
goto try_mk1;
|
||||
|
||||
/* It must be an SIHOST2 */
|
||||
*(maddr + SIPLRESET) = 0;
|
||||
*(maddr + SIPLIRQCLR) = 0;
|
||||
*(maddr + SIPLIRQSET) = 0x10;
|
||||
type = SIHOST2;
|
||||
ramsize = SIHOST2_RAMSIZE;
|
||||
goto got_card;
|
||||
|
||||
try_mk1:
|
||||
/*
|
||||
* Its not a MK II, so try for a MK I (SIHOST)
|
||||
*/
|
||||
*(maddr+SIRESET) = 0x0; /* reset the card */
|
||||
*(maddr+SIINTCL) = 0x0; /* clear int */
|
||||
*(maddr+SIRAM) = 0x17;
|
||||
if (*(maddr+SIRAM) != (unsigned char)0x17)
|
||||
goto fail;
|
||||
*(maddr+0x7ff8) = 0x17;
|
||||
if (*(maddr+0x7ff8) != (unsigned char)0x17) {
|
||||
device_printf(dev, "0x17 check fail at phys %p = 0x%x\n",
|
||||
paddr+0x77f8, *(maddr+0x77f8));
|
||||
goto fail;
|
||||
}
|
||||
|
||||
/* It must be an SIHOST (maybe?) - there must be a better way XXX */
|
||||
type = SIHOST;
|
||||
ramsize = SIHOST_RAMSIZE;
|
||||
|
||||
got_card:
|
||||
DPRINT((0, DBG_AUTOBOOT, "si%d: found type %d card, try memory test\n",
|
||||
unit, type));
|
||||
/* Try the acid test */
|
||||
ux = maddr + SIRAM;
|
||||
for (i = 0; i < ramsize; i++, ux++)
|
||||
*ux = (unsigned char)(i&0xff);
|
||||
ux = maddr + SIRAM;
|
||||
for (i = 0; i < ramsize; i++, ux++) {
|
||||
if ((was = *ux) != (unsigned char)(i&0xff)) {
|
||||
device_printf(dev,
|
||||
"memtest fail at phys %p, was %x should be %x\n",
|
||||
paddr + i, was, i & 0xff);
|
||||
goto fail;
|
||||
}
|
||||
}
|
||||
|
||||
/* clear out the RAM */
|
||||
ux = maddr + SIRAM;
|
||||
for (i = 0; i < ramsize; i++)
|
||||
*ux++ = 0;
|
||||
ux = maddr + SIRAM;
|
||||
for (i = 0; i < ramsize; i++) {
|
||||
if ((was = *ux++) != 0) {
|
||||
device_printf(dev, "clear fail at phys %p, was %x\n",
|
||||
paddr + i, was);
|
||||
goto fail;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Success, we've found a valid board, now fill in
|
||||
* the adapter structure.
|
||||
*/
|
||||
switch (type) {
|
||||
case SIHOST2:
|
||||
switch (isa_get_irq(dev)) {
|
||||
case 11:
|
||||
case 12:
|
||||
case 15:
|
||||
break;
|
||||
default:
|
||||
device_printf(dev,
|
||||
"bad IRQ value - %d (11, 12, 15 allowed)\n",
|
||||
isa_get_irq(dev));
|
||||
goto fail;
|
||||
}
|
||||
sc->sc_memsize = SIHOST2_MEMSIZE;
|
||||
break;
|
||||
case SIHOST:
|
||||
switch (isa_get_irq(dev)) {
|
||||
case 11:
|
||||
case 12:
|
||||
case 15:
|
||||
break;
|
||||
default:
|
||||
device_printf(dev,
|
||||
"bad IRQ value - %d (11, 12, 15 allowed)\n",
|
||||
isa_get_irq(dev));
|
||||
goto fail;
|
||||
}
|
||||
sc->sc_memsize = SIHOST_MEMSIZE;
|
||||
break;
|
||||
case SIJETISA:
|
||||
switch (isa_get_irq(dev)) {
|
||||
case 9:
|
||||
case 10:
|
||||
case 11:
|
||||
case 12:
|
||||
case 15:
|
||||
break;
|
||||
default:
|
||||
device_printf(dev,
|
||||
"bad IRQ value - %d (9, 10, 11, 12, 15 allowed)\n",
|
||||
isa_get_irq(dev));
|
||||
goto fail;
|
||||
}
|
||||
sc->sc_memsize = SIJETISA_MEMSIZE;
|
||||
break;
|
||||
case SIMCA: /* MCA */
|
||||
default:
|
||||
device_printf(dev, "card type %d not supported\n", type);
|
||||
goto fail;
|
||||
}
|
||||
sc->sc_type = type;
|
||||
bus_release_resource(dev, SYS_RES_MEMORY,
|
||||
sc->sc_mem_rid, sc->sc_mem_res);
|
||||
sc->sc_mem_res = 0;
|
||||
return (0); /* success! */
|
||||
|
||||
fail:
|
||||
if (sc->sc_mem_res) {
|
||||
bus_release_resource(dev, SYS_RES_MEMORY,
|
||||
sc->sc_mem_rid, sc->sc_mem_res);
|
||||
sc->sc_mem_res = 0;
|
||||
}
|
||||
return(EINVAL);
|
||||
}
|
||||
|
||||
static int
|
||||
si_isa_attach(device_t dev)
|
||||
{
|
||||
int error;
|
||||
void *ih;
|
||||
struct si_softc *sc;
|
||||
|
||||
error = 0;
|
||||
ih = NULL;
|
||||
sc = device_get_softc(dev);
|
||||
|
||||
sc->sc_mem_rid = 0;
|
||||
sc->sc_mem_res = bus_alloc_resource_any(dev, SYS_RES_MEMORY,
|
||||
&sc->sc_mem_rid,
|
||||
RF_ACTIVE);
|
||||
if (!sc->sc_mem_res) {
|
||||
device_printf(dev, "couldn't map memory\n");
|
||||
goto fail;
|
||||
}
|
||||
sc->sc_paddr = (caddr_t)rman_get_start(sc->sc_mem_res);
|
||||
sc->sc_maddr = rman_get_virtual(sc->sc_mem_res);
|
||||
|
||||
sc->sc_irq_rid = 0;
|
||||
sc->sc_irq_res = bus_alloc_resource_any(dev, SYS_RES_IRQ,
|
||||
&sc->sc_irq_rid,
|
||||
RF_ACTIVE | RF_SHAREABLE);
|
||||
if (!sc->sc_irq_res) {
|
||||
device_printf(dev, "couldn't allocate interrupt\n");
|
||||
goto fail;
|
||||
}
|
||||
sc->sc_irq = rman_get_start(sc->sc_irq_res);
|
||||
error = bus_setup_intr(dev, sc->sc_irq_res, INTR_TYPE_TTY,
|
||||
NULL, si_intr, sc, &ih);
|
||||
if (error) {
|
||||
device_printf(dev, "couldn't activate interrupt\n");
|
||||
goto fail;
|
||||
}
|
||||
|
||||
error = siattach(dev);
|
||||
if (error)
|
||||
goto fail;
|
||||
return (0); /* success */
|
||||
|
||||
fail:
|
||||
if (error == 0)
|
||||
error = ENXIO;
|
||||
if (sc->sc_irq_res) {
|
||||
if (ih)
|
||||
bus_teardown_intr(dev, sc->sc_irq_res, ih);
|
||||
bus_release_resource(dev, SYS_RES_IRQ,
|
||||
sc->sc_irq_rid, sc->sc_irq_res);
|
||||
sc->sc_irq_res = 0;
|
||||
}
|
||||
if (sc->sc_mem_res) {
|
||||
bus_release_resource(dev, SYS_RES_MEMORY,
|
||||
sc->sc_mem_rid, sc->sc_mem_res);
|
||||
sc->sc_mem_res = 0;
|
||||
}
|
||||
return (error);
|
||||
}
|
||||
|
||||
static device_method_t si_isa_methods[] = {
|
||||
/* Device interface */
|
||||
DEVMETHOD(device_probe, si_isa_probe),
|
||||
DEVMETHOD(device_attach, si_isa_attach),
|
||||
|
||||
{ 0, 0 }
|
||||
};
|
||||
|
||||
static driver_t si_isa_driver = {
|
||||
"si",
|
||||
si_isa_methods,
|
||||
sizeof(struct si_softc),
|
||||
};
|
||||
|
||||
DRIVER_MODULE(si, isa, si_isa_driver, si_devclass, 0, 0);
|
@ -1,168 +0,0 @@
|
||||
/*-
|
||||
* Device driver for Specialix range (SI/XIO) of serial line multiplexors.
|
||||
*
|
||||
* Copyright (C) 2000, Peter Wemm <peter@netplex.com.au>
|
||||
*
|
||||
* 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
|
||||
* notices, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notices, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY ``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 AUTHORS BE LIABLE.
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__FBSDID("$FreeBSD$");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
#include <sys/kernel.h>
|
||||
#include <sys/module.h>
|
||||
#include <sys/bus.h>
|
||||
#include <machine/bus.h>
|
||||
#include <sys/rman.h>
|
||||
#include <machine/resource.h>
|
||||
|
||||
#include <dev/si/sireg.h>
|
||||
#include <dev/si/sivar.h>
|
||||
|
||||
#include <dev/pci/pcireg.h>
|
||||
#include <dev/pci/pcivar.h>
|
||||
|
||||
static int
|
||||
si_pci_probe(device_t dev)
|
||||
{
|
||||
const char *desc = NULL;
|
||||
|
||||
switch (pci_get_devid(dev)) {
|
||||
case 0x400011cb:
|
||||
desc = "Specialix SI/XIO PCI host card";
|
||||
break;
|
||||
case 0x200011cb:
|
||||
if (pci_read_config(dev, SIJETSSIDREG, 4) == 0x020011cb)
|
||||
desc = "Specialix SX PCI host card";
|
||||
break;
|
||||
}
|
||||
if (desc) {
|
||||
device_set_desc(dev, desc);
|
||||
return BUS_PROBE_DEFAULT;
|
||||
}
|
||||
return ENXIO;
|
||||
}
|
||||
|
||||
static int
|
||||
si_pci_attach(device_t dev)
|
||||
{
|
||||
struct si_softc *sc;
|
||||
void *ih;
|
||||
int error;
|
||||
|
||||
error = 0;
|
||||
ih = NULL;
|
||||
sc = device_get_softc(dev);
|
||||
|
||||
switch (pci_get_devid(dev)) {
|
||||
case 0x400011cb:
|
||||
sc->sc_type = SIPCI;
|
||||
sc->sc_mem_rid = SIPCIBADR;
|
||||
break;
|
||||
case 0x200011cb:
|
||||
sc->sc_type = SIJETPCI;
|
||||
sc->sc_mem_rid = SIJETBADR;
|
||||
break;
|
||||
}
|
||||
|
||||
sc->sc_mem_res = bus_alloc_resource_any(dev, SYS_RES_MEMORY,
|
||||
&sc->sc_mem_rid,
|
||||
RF_ACTIVE);
|
||||
if (!sc->sc_mem_res) {
|
||||
device_printf(dev, "couldn't map memory\n");
|
||||
goto fail;
|
||||
}
|
||||
sc->sc_paddr = (caddr_t)rman_get_start(sc->sc_mem_res);
|
||||
sc->sc_maddr = rman_get_virtual(sc->sc_mem_res);
|
||||
|
||||
sc->sc_irq_rid = 0;
|
||||
sc->sc_irq_res = bus_alloc_resource_any(dev, SYS_RES_IRQ,
|
||||
&sc->sc_irq_rid,
|
||||
RF_ACTIVE | RF_SHAREABLE);
|
||||
if (!sc->sc_irq_res) {
|
||||
device_printf(dev, "couldn't map interrupt\n");
|
||||
goto fail;
|
||||
}
|
||||
sc->sc_irq = rman_get_start(sc->sc_irq_res);
|
||||
error = bus_setup_intr(dev, sc->sc_irq_res, INTR_TYPE_TTY,
|
||||
NULL, si_intr, sc, &ih);
|
||||
if (error) {
|
||||
device_printf(dev, "could not activate interrupt\n");
|
||||
goto fail;
|
||||
}
|
||||
|
||||
if (pci_get_devid(dev) == 0x200011cb) {
|
||||
int rid;
|
||||
struct resource *plx_res;
|
||||
uint32_t *addr;
|
||||
uint32_t oldvalue;
|
||||
|
||||
/* Perform a PLX control register fixup */
|
||||
rid = PCIR_BAR(0);
|
||||
plx_res = bus_alloc_resource_any(dev, SYS_RES_MEMORY, &rid,
|
||||
RF_ACTIVE);
|
||||
if (plx_res == NULL) {
|
||||
device_printf(dev, "couldn't map plx registers\n");
|
||||
} else {
|
||||
addr = rman_get_virtual(plx_res);
|
||||
oldvalue = addr[0x50 / 4];
|
||||
if (oldvalue != 0x18260000) {
|
||||
device_printf(dev, "PLX register 0x50: 0x%08x changed to 0x%08x\n", oldvalue, 0x18260000);
|
||||
addr[0x50 / 4] = 0x18260000;
|
||||
}
|
||||
bus_release_resource(dev, SYS_RES_MEMORY, rid, plx_res);
|
||||
}
|
||||
}
|
||||
|
||||
error = siattach(dev);
|
||||
if (error)
|
||||
goto fail;
|
||||
return (0); /* success */
|
||||
|
||||
fail:
|
||||
if (error == 0)
|
||||
error = ENXIO;
|
||||
if (sc->sc_irq_res) {
|
||||
if (ih)
|
||||
bus_teardown_intr(dev, sc->sc_irq_res, ih);
|
||||
bus_release_resource(dev, SYS_RES_IRQ,
|
||||
sc->sc_irq_rid, sc->sc_irq_res);
|
||||
sc->sc_irq_res = 0;
|
||||
}
|
||||
if (sc->sc_mem_res) {
|
||||
bus_release_resource(dev, SYS_RES_MEMORY,
|
||||
sc->sc_mem_rid, sc->sc_mem_res);
|
||||
sc->sc_mem_res = 0;
|
||||
}
|
||||
return (error);
|
||||
}
|
||||
|
||||
static device_method_t si_pci_methods[] = {
|
||||
/* Device interface */
|
||||
DEVMETHOD(device_probe, si_pci_probe),
|
||||
DEVMETHOD(device_attach, si_pci_attach),
|
||||
|
||||
{ 0, 0 }
|
||||
};
|
||||
|
||||
static driver_t si_pci_driver = {
|
||||
"si",
|
||||
si_pci_methods,
|
||||
sizeof(struct si_softc),
|
||||
};
|
||||
|
||||
DRIVER_MODULE(si, pci, si_pci_driver, si_devclass, 0, 0);
|
@ -1,98 +0,0 @@
|
||||
/*-
|
||||
* Device driver for Specialix range (SI/XIO) of serial line multiplexors.
|
||||
* 'C' definitions for Specialix serial multiplex driver.
|
||||
*
|
||||
* Copyright (C) 1990, 1992, 1998 Specialix International,
|
||||
* Copyright (C) 1993, Andy Rutter <andy@acronym.co.uk>
|
||||
* Copyright (C) 1995, Peter Wemm <peter@netplex.com.au>
|
||||
*
|
||||
* Derived from: SunOS 4.x version
|
||||
*
|
||||
* 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
|
||||
* notices, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notices, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* This product includes software developed by Andy Rutter of
|
||||
* Advanced Methods and Tools Ltd. based on original information
|
||||
* from Specialix International.
|
||||
* 4. Neither the name of Advanced Methods and Tools, nor Specialix
|
||||
* International may be used to endorse or promote products derived from
|
||||
* this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY ``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 AUTHORS BE LIABLE.
|
||||
*
|
||||
* $FreeBSD$
|
||||
*/
|
||||
|
||||
/*
|
||||
* Hardware parameters which should be changed at your peril!
|
||||
*/
|
||||
|
||||
/* Base and mask for SI Host 2.x (SIHOST2) */
|
||||
#define SIPLSIG 0x7FF8 /* Start of control space */
|
||||
#define SIPLCNTL 0x7FF8 /* Ditto */
|
||||
#define SIPLRESET SIPLCNTL /* 0 = reset */
|
||||
#define SIPLIRQ11 (SIPLCNTL+1) /* 0 = mask irq 11 */
|
||||
#define SIPLIRQ12 (SIPLCNTL+2) /* 0 = mask irq 12 */
|
||||
#define SIPLIRQ15 (SIPLCNTL+3) /* 0 = mask irq 15 */
|
||||
#define SIPLIRQSET (SIPLCNTL+4) /* 0 = interrupt host */
|
||||
#define SIPLIRQCLR (SIPLCNTL+5) /* 0 = clear irq */
|
||||
|
||||
/* SI Host 1.x */
|
||||
#define SIRAM 0x0000 /* Ram Starts here */
|
||||
#define SIRESET 0x8000 /* Set reset */
|
||||
#define SIRESET_CL 0xc000 /* Clear reset */
|
||||
#define SIWAIT 0x9000 /* Set wait */
|
||||
#define SIWAIT_CL 0xd000 /* Set wait */
|
||||
#define SIINTCL 0xA000 /* Clear host int */
|
||||
#define SIINTCL_CL 0xE000 /* Clear host int */
|
||||
|
||||
/* SI EISA */
|
||||
#define SIEISADEVID 0x4d980411 /* EISA Device ID */
|
||||
#define SIEISABASE 0xc00 /* Our ports start here */
|
||||
#define SIEISAIOSIZE 0x100 /* XXX How many ports */
|
||||
|
||||
/* SI old PCI */
|
||||
#define SIPCIBADR PCIR_BAR(0) /* Which BADR to map in RAM */
|
||||
#define SIPCI_MEMSIZE 0x100000 /* Mapping size */
|
||||
#define SIPCIRESET 0xc0001 /* 0 = Reset */
|
||||
#define SIPCIINTCL 0x40001 /* 0 = clear int */
|
||||
|
||||
/* SI Jet PCI */
|
||||
#define SIJETSSIDREG PCIR_SUBVEND_0 /* Is it an SX or RIO? */
|
||||
#define SIJETBADR PCIR_BAR(2) /* Which BADR to map in RAM */
|
||||
/* SI Jet PCI & ISA */
|
||||
#define SIJETIDBASE 0x7c00 /* ID ROM base */
|
||||
#define SISPLXID 0x984d /* Specialix ID */
|
||||
#define SIUNIQID 0x7c0e /* & 0xf0 = 0x20 for SX */
|
||||
#define SIJETIDSTR 0x7c20 /* ID ROM string */
|
||||
#define SIJETRESET 0x7d00
|
||||
#define SIJETINTCL 0x7d80
|
||||
#define SIJETCONFIG 0x7c00 /* for ISA, top nibble = IRQ */
|
||||
#define SIJETBUSEN 0x2
|
||||
#define SIJETIRQEN 0x4
|
||||
|
||||
/*
|
||||
* MEMSIZE is the total shared mem region
|
||||
* RAMSIZE is value to use when probing
|
||||
* PROBEALLOC is the amount to bus_resource_alloc() during probe.
|
||||
*/
|
||||
#define SIJETPCI_MEMSIZE 0x10000
|
||||
#define SIJETISA_MEMSIZE 0x8000
|
||||
#define SIJET_RAMSIZE 0x7000
|
||||
#define SIHOST_MEMSIZE 0x10000
|
||||
#define SIHOST_RAMSIZE 0x8000
|
||||
#define SIHOST2_MEMSIZE 0x8000
|
||||
#define SIHOST2_RAMSIZE 0x7ff7
|
||||
#define SIEISA_MEMSIZE 0x10000
|
||||
#define SIEISA_RAMSIZE 0x10000
|
||||
#define SIPROBEALLOC 0x8000
|
@ -1,113 +0,0 @@
|
||||
/*-
|
||||
* Device driver for Specialix range (SI/XIO) of serial line multiplexors.
|
||||
*
|
||||
* Copyright (C) 2000, Peter Wemm <peter@netplex.com.au>
|
||||
*
|
||||
* 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
|
||||
* notices, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notices, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY ``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 AUTHORS BE LIABLE.
|
||||
*
|
||||
* $FreeBSD$
|
||||
*/
|
||||
|
||||
#ifdef _KERNEL
|
||||
int siattach(device_t dev);
|
||||
void si_intr(void *);
|
||||
|
||||
extern devclass_t si_devclass;
|
||||
|
||||
/* where the firmware lives; defined in si2_z280.c and si3_t225.c */
|
||||
/* old: si2_z280.c */
|
||||
extern unsigned char si2_z280_download[];
|
||||
extern unsigned short si2_z280_downloadaddr;
|
||||
extern int si2_z280_dsize;
|
||||
/* new: si3_t225.c */
|
||||
extern unsigned char si3_t225_download[];
|
||||
extern unsigned short si3_t225_downloadaddr;
|
||||
extern int si3_t225_dsize;
|
||||
extern unsigned char si3_t225_bootstrap[];
|
||||
extern unsigned short si3_t225_bootloadaddr;
|
||||
extern int si3_t225_bsize;
|
||||
|
||||
struct si_softc {
|
||||
int sc_type; /* adapter type */
|
||||
const char *sc_typename; /* adapter type string */
|
||||
|
||||
struct si_port *sc_ports; /* port structures for this card */
|
||||
|
||||
caddr_t sc_paddr; /* physical addr of iomem */
|
||||
caddr_t sc_maddr; /* kvaddr of iomem */
|
||||
int sc_nport; /* # ports on this card */
|
||||
int sc_irq; /* copy of attach irq */
|
||||
int sc_iobase; /* EISA io port address */
|
||||
struct resource *sc_port_res;
|
||||
struct resource *sc_irq_res;
|
||||
struct resource *sc_mem_res;
|
||||
int sc_port_rid;
|
||||
int sc_irq_rid;
|
||||
int sc_mem_rid;
|
||||
int sc_memsize;
|
||||
};
|
||||
|
||||
#endif /* _KERNEL */
|
||||
|
||||
#ifdef SI_DEBUG
|
||||
/*
|
||||
* debugging stuff - manipulated using siconfig(8)
|
||||
*/
|
||||
|
||||
void si_dprintf(struct si_port *pp, int flags, const char *fmt, ...);
|
||||
|
||||
#define DPRINT(x) si_dprintf x
|
||||
|
||||
/*
|
||||
* Extensive debugging stuff - manipulated using siconfig(8)
|
||||
*/
|
||||
#define DBG_ENTRY 0x00000001
|
||||
#define DBG_DRAIN 0x00000002
|
||||
#define DBG_OPEN 0x00000004
|
||||
#define DBG_CLOSE 0x00000008
|
||||
#define DBG_READ 0x00000010
|
||||
#define DBG_WRITE 0x00000020
|
||||
#define DBG_PARAM 0x00000040
|
||||
#define DBG_INTR 0x00000080
|
||||
#define DBG_IOCTL 0x00000100
|
||||
/* 0x00000200 */
|
||||
#define DBG_SELECT 0x00000400
|
||||
#define DBG_OPTIM 0x00000800
|
||||
#define DBG_START 0x00001000
|
||||
#define DBG_EXIT 0x00002000
|
||||
#define DBG_FAIL 0x00004000
|
||||
#define DBG_STOP 0x00008000
|
||||
#define DBG_AUTOBOOT 0x00010000
|
||||
#define DBG_MODEM 0x00020000
|
||||
#define DBG_DOWNLOAD 0x00040000
|
||||
#define DBG_LSTART 0x00080000
|
||||
#define DBG_POLL 0x00100000
|
||||
#define DBG_ALL 0xffffffff
|
||||
|
||||
#else
|
||||
#define DPRINT(x) /* void */
|
||||
#endif
|
||||
|
||||
/* Adapter types */
|
||||
#define SIEMPTY 0
|
||||
#define SIHOST 1
|
||||
#define SIMCA 2
|
||||
#define SIHOST2 3
|
||||
#define SIEISA 4
|
||||
#define SIPCI 5
|
||||
#define SIJETPCI 6
|
||||
#define SIJETISA 7
|
||||
|
||||
#define SI_ISJET(x) (((x) == SIJETPCI) || ((x) == SIJETISA))
|
@ -880,7 +880,6 @@ device spic
|
||||
hint.spic.0.at="isa"
|
||||
hint.spic.0.port="0x10a0"
|
||||
device asmc
|
||||
device si
|
||||
device tpm
|
||||
device padlock_rng # VIA Padlock RNG
|
||||
device rdrand_rng # Intel Bull Mountain RNG
|
||||
|
@ -330,7 +330,6 @@ SUBDIR= \
|
||||
${_sf} \
|
||||
${_sfxge} \
|
||||
sge \
|
||||
${_si} \
|
||||
siba_bwn \
|
||||
siftr \
|
||||
siis \
|
||||
@ -584,7 +583,6 @@ _rdma= rdma
|
||||
.endif
|
||||
_safe= safe
|
||||
_scsi_low= scsi_low
|
||||
_si= si
|
||||
_speaker= speaker
|
||||
_splash= splash
|
||||
_sppp= sppp
|
||||
|
@ -1,11 +0,0 @@
|
||||
# $FreeBSD$
|
||||
|
||||
.PATH: ${.CURDIR}/../../dev/si
|
||||
|
||||
KMOD= si
|
||||
SRCS= si.c si2_z280.c si3_t225.c si_isa.c si_pci.c
|
||||
SRCS+= bus_if.h device_if.h isa_if.h pci_if.h
|
||||
SRCS+= opt_compat.h opt_debug_si.h opt_eisa.h
|
||||
SRCS.DEV_EISA=si_eisa.c eisa_if.h
|
||||
|
||||
.include <bsd.kmod.mk>
|
@ -834,7 +834,6 @@ DIRDEPS.amd64= \
|
||||
usr.sbin/lptcontrol \
|
||||
usr.sbin/mptable \
|
||||
usr.sbin/ndiscvt \
|
||||
usr.sbin/sicontrol \
|
||||
usr.sbin/spkrtest \
|
||||
usr.sbin/sade \
|
||||
usr.sbin/zzz
|
||||
@ -863,7 +862,6 @@ DIRDEPS.i386= \
|
||||
usr.sbin/ndiscvt \
|
||||
usr.sbin/pnpinfo \
|
||||
usr.sbin/sade \
|
||||
usr.sbin/sicontrol \
|
||||
usr.sbin/spkrtest \
|
||||
usr.sbin/zzz \
|
||||
usr.sbin/acpi \
|
||||
|
@ -1,21 +0,0 @@
|
||||
# Doxyfile 1.5.2
|
||||
|
||||
# $FreeBSD$
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# Project related configuration options
|
||||
#---------------------------------------------------------------------------
|
||||
PROJECT_NAME = "FreeBSD kernel SI device code"
|
||||
OUTPUT_DIRECTORY = $(DOXYGEN_DEST_PATH)/dev_si/
|
||||
EXTRACT_ALL = YES # for undocumented src, no warnings enabled
|
||||
#---------------------------------------------------------------------------
|
||||
# configuration options related to the input files
|
||||
#---------------------------------------------------------------------------
|
||||
INPUT = $(DOXYGEN_SRC_PATH)/dev/si/ \
|
||||
$(NOTREVIEWED)
|
||||
|
||||
GENERATE_TAGFILE = dev_si/dev_si.tag
|
||||
|
||||
@INCLUDE_PATH = $(DOXYGEN_INCLUDE_PATH)
|
||||
@INCLUDE = common-Doxyfile
|
||||
|
@ -29,6 +29,5 @@ SUBDIR+= mptable
|
||||
.if ${MK_NDIS} != "no"
|
||||
SUBDIR+= ndiscvt
|
||||
.endif
|
||||
SUBDIR+= sicontrol
|
||||
SUBDIR+= spkrtest
|
||||
SUBDIR+= zzz
|
||||
|
@ -17,7 +17,6 @@ SUBDIR+= mptable
|
||||
SUBDIR+= ndiscvt
|
||||
.endif
|
||||
SUBDIR+= pnpinfo
|
||||
SUBDIR+= sicontrol
|
||||
SUBDIR+= spkrtest
|
||||
SUBDIR+= zzz
|
||||
|
||||
|
@ -1,9 +0,0 @@
|
||||
# $FreeBSD$
|
||||
|
||||
PROG= sicontrol
|
||||
MAN= sicontrol.8
|
||||
|
||||
CFLAGS+= -I${.CURDIR}/../../sys
|
||||
WARNS?= 2
|
||||
|
||||
.include <bsd.prog.mk>
|
@ -1,18 +0,0 @@
|
||||
# $FreeBSD$
|
||||
# Autogenerated - do NOT edit!
|
||||
|
||||
DIRDEPS = \
|
||||
gnu/lib/csu \
|
||||
gnu/lib/libgcc \
|
||||
include \
|
||||
include/xlocale \
|
||||
lib/${CSU_DIR} \
|
||||
lib/libc \
|
||||
lib/libcompiler_rt \
|
||||
|
||||
|
||||
.include <dirdeps.mk>
|
||||
|
||||
.if ${DEP_RELDIR} == ${_DEP_RELDIR}
|
||||
# local dependencies - needed for -jN in clean tree
|
||||
.endif
|
@ -1,109 +0,0 @@
|
||||
.\" $FreeBSD$
|
||||
.\"
|
||||
.Dd September 26, 1995
|
||||
.Dt SICONTROL 8
|
||||
.Os
|
||||
.Sh NAME
|
||||
.Nm sicontrol
|
||||
.Nd Specialix SI/XIO driver configuration and debugging
|
||||
.Sh SYNOPSIS
|
||||
.Nm
|
||||
device
|
||||
.Ar command Op Ar param ...
|
||||
.Sh DESCRIPTION
|
||||
The
|
||||
.Nm
|
||||
utility is used to configure and monitor the SI/XIO device driver.
|
||||
.Pp
|
||||
The
|
||||
.Nm
|
||||
utility operates on the specified
|
||||
.Ar device
|
||||
to indicate which port is to be used.
|
||||
.Pp
|
||||
The special
|
||||
.Ar device
|
||||
string `-' is used to indicate the global driver settings instead.
|
||||
.Pp
|
||||
A
|
||||
.Pa /dev/
|
||||
is included if necessary.
|
||||
.Pp
|
||||
The following commands are used for the global settings and should be
|
||||
specified with the '-' device name:
|
||||
.Bl -tag -width 4n
|
||||
.It Cm int_throttle Op Cm value
|
||||
Configure the `aggregate interrupt throttle value'.
|
||||
The maximum number of host adapter interrupts per second is determined by:
|
||||
.Pp
|
||||
.Ar "controller CPU clock / (8 * int_throttle)"
|
||||
.Pp
|
||||
The default value at boot time is 25000.
|
||||
The host adapter cpu clock is
|
||||
25MHz.
|
||||
This gives a maximum interrupt rate of about 125 interrupts per
|
||||
second.
|
||||
.Pp
|
||||
Lowering this value will increase the rate in which the host adapter can
|
||||
interrupt the operating system for attention.
|
||||
.\"
|
||||
.It Cm rxint_throttle Op Cm value
|
||||
Configure the receiver interrupt throttle value.
|
||||
The default value of 4 at boot time allows an interrupt rate of
|
||||
approximately 25.
|
||||
.Pp
|
||||
Lowering this value will increase the rate in which the host adapter can
|
||||
interrupt the operating system to empty the receiver fifos.
|
||||
.\"
|
||||
.It Cm nport
|
||||
Return the number of ports under the control of the device driver.
|
||||
.El
|
||||
.Pp
|
||||
The following commands are used for the individual ports and should be
|
||||
specified with a device name from
|
||||
.Pa /dev :
|
||||
.Bl -tag -width 4n
|
||||
.It Cm mstate
|
||||
Show the current incoming modem control signals.
|
||||
.It Cm ccbstat
|
||||
Show the current "ccb" structure for the specified port.
|
||||
This is not of
|
||||
much use outside of debugging the driver and determining why a port is
|
||||
wedged.
|
||||
.El
|
||||
.Sh FILES
|
||||
.Bl -tag -width /dev/si_control -compact
|
||||
.It Pa /dev/si_control
|
||||
global driver control file for use by
|
||||
.Nm
|
||||
.It Pa /dev/ttyA*
|
||||
terminal control ports
|
||||
.It Pa /dev/ttyiA*
|
||||
initial termios state devices, for use by
|
||||
.Xr stty 1
|
||||
.It Pa /dev/ttylA*
|
||||
locked termios state devices, for use by
|
||||
.Xr stty 1
|
||||
.El
|
||||
.Sh DIAGNOSTICS
|
||||
Generally self explanatory.....
|
||||
.Sh SEE ALSO
|
||||
.Xr stty 1 ,
|
||||
.Xr si 4 ,
|
||||
.Xr termios 4 ,
|
||||
.Xr tty 4 ,
|
||||
.Xr comcontrol 8
|
||||
.Sh HISTORY
|
||||
The
|
||||
.Nm
|
||||
utility is loosely based on a utility called
|
||||
.Nm siconfig
|
||||
which was written by
|
||||
.An Andy Rutter Aq Mt andy@acronym.co.uk .
|
||||
.Pp
|
||||
Specialix International do not support this device driver in any way.
|
||||
.Sh AUTHORS
|
||||
.An Peter Wemm Aq Mt peter@FreeBSD.org
|
||||
.Sh BUGS
|
||||
Bound to be many...
|
||||
:-)
|
@ -1,726 +0,0 @@
|
||||
/*
|
||||
* Device driver for Specialix range (SLXOS) of serial line multiplexors.
|
||||
* SLXOS configuration and debug interface
|
||||
*
|
||||
* Copyright (C) 1990, 1992 Specialix International,
|
||||
* Copyright (C) 1993, Andy Rutter <andy@acronym.co.uk>
|
||||
* Copyright (C) 1995, Peter Wemm
|
||||
*
|
||||
* Derived from: SunOS 4.x version
|
||||
*
|
||||
* 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
|
||||
* notices, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notices, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 4. Neither the name of Advanced Methods and Tools, nor Specialix
|
||||
* International may be used to endorse or promote products derived from
|
||||
* this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY ``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 AUTHORS BE LIABLE.
|
||||
*/
|
||||
|
||||
#ifndef lint
|
||||
static const char rcsid[] =
|
||||
"$FreeBSD$";
|
||||
#endif /* not lint */
|
||||
|
||||
#include <ctype.h>
|
||||
#include <err.h>
|
||||
#include <fcntl.h>
|
||||
#include <paths.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/param.h>
|
||||
#include <sys/stat.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include <sys/tty.h>
|
||||
|
||||
#define SI_DEBUG
|
||||
#include <dev/si/si.h>
|
||||
#include <dev/si/sivar.h>
|
||||
|
||||
struct lv {
|
||||
char *lv_name;
|
||||
int lv_bit;
|
||||
} lv[] = {
|
||||
{"entry", DBG_ENTRY},
|
||||
{"open", DBG_OPEN},
|
||||
{"close", DBG_CLOSE},
|
||||
{"read", DBG_READ},
|
||||
{"write", DBG_WRITE},
|
||||
{"param", DBG_PARAM},
|
||||
{"modem", DBG_MODEM},
|
||||
{"select", DBG_SELECT},
|
||||
{"optim", DBG_OPTIM},
|
||||
{"intr", DBG_INTR},
|
||||
{"start", DBG_START},
|
||||
{"lstart", DBG_LSTART},
|
||||
{"ioctl", DBG_IOCTL},
|
||||
{"fail", DBG_FAIL},
|
||||
{"autoboot", DBG_AUTOBOOT},
|
||||
{"download", DBG_DOWNLOAD},
|
||||
{"drain", DBG_DRAIN},
|
||||
{"poll", DBG_POLL},
|
||||
{0, 0}
|
||||
};
|
||||
|
||||
static int alldev = 0;
|
||||
|
||||
void ccb_stat(int, char **);
|
||||
void port_stat(int, char **);
|
||||
void debug(int, char **);
|
||||
void dostat(void);
|
||||
int getnum(char *);
|
||||
int islevel(char *);
|
||||
int lvls2bits(char *);
|
||||
void mstate(int, char **);
|
||||
void nport(int, char **);
|
||||
void onoff(int, char **, int, char *, char *, int);
|
||||
int opencontrol(void);
|
||||
void prlevels(int);
|
||||
void prusage(int, int);
|
||||
void rxint(int, char **);
|
||||
void txint(int, char **);
|
||||
|
||||
struct opt {
|
||||
char *o_name;
|
||||
void (*o_func)(int, char **);
|
||||
} opt[] = {
|
||||
{"debug", debug},
|
||||
{"rxint_throttle", rxint},
|
||||
{"int_throttle", txint},
|
||||
{"nport", nport},
|
||||
{"mstate", mstate},
|
||||
{"ccbstat", ccb_stat},
|
||||
{"portstat", port_stat},
|
||||
{0, 0}
|
||||
};
|
||||
|
||||
struct stat_list {
|
||||
void (*st_func)(int, char **);
|
||||
} stat_list[] = {
|
||||
{mstate},
|
||||
{0}
|
||||
};
|
||||
|
||||
#define U_DEBUG 0
|
||||
#define U_TXINT 1
|
||||
#define U_RXINT 2
|
||||
#define U_NPORT 3
|
||||
#define U_MSTATE 4
|
||||
#define U_STAT_CCB 5
|
||||
#define U_STAT_PORT 6
|
||||
|
||||
#define U_MAX 7
|
||||
#define U_ALL -1
|
||||
char *usage[] = {
|
||||
"debug [[add|del|set debug_levels] | [off]]\n",
|
||||
"int_throttle [newvalue]\n",
|
||||
"rxint_throttle [newvalue]\n",
|
||||
"nport\n",
|
||||
"mstate\n",
|
||||
"ccbstat\n",
|
||||
"portstat\n",
|
||||
0
|
||||
};
|
||||
|
||||
int ctlfd;
|
||||
char *Devname;
|
||||
struct si_tcsi tc;
|
||||
|
||||
int
|
||||
main(int argc, char **argv)
|
||||
{
|
||||
struct opt *op;
|
||||
void (*func)(int, char **) = NULL;
|
||||
|
||||
if (argc < 2)
|
||||
prusage(U_ALL, 1);
|
||||
Devname = argv[1];
|
||||
if (strcmp(Devname, "-") == 0) {
|
||||
alldev = 1;
|
||||
} else {
|
||||
sidev_t dev;
|
||||
int n;
|
||||
int card, port;
|
||||
|
||||
n = sscanf(Devname, "%d:%d", &card, &port);
|
||||
if (n != 2)
|
||||
errx(1, "Devname must be in form card:port. eg: 0:7");
|
||||
dev.sid_card = card;
|
||||
dev.sid_port = port;
|
||||
tc.tc_dev = dev;
|
||||
}
|
||||
ctlfd = opencontrol();
|
||||
if (argc == 2) {
|
||||
dostat();
|
||||
exit(0);
|
||||
}
|
||||
|
||||
argc--; argv++;
|
||||
for (op = opt; op->o_name; op++) {
|
||||
if (strcmp(argv[1], op->o_name) == 0) {
|
||||
func = op->o_func;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (func == NULL)
|
||||
prusage(U_ALL, 1);
|
||||
|
||||
argc -= 2;
|
||||
argv += 2;
|
||||
(*func)(argc, argv);
|
||||
exit(0);
|
||||
}
|
||||
|
||||
int
|
||||
opencontrol(void)
|
||||
{
|
||||
int fd;
|
||||
|
||||
fd = open(CONTROLDEV, O_RDWR|O_NDELAY);
|
||||
if (fd < 0)
|
||||
err(1, "open on %s", CONTROLDEV);
|
||||
return(fd);
|
||||
}
|
||||
|
||||
/*
|
||||
* Print a usage message - this relies on U_DEBUG==0 and U_BOOT==1.
|
||||
* Don't print the DEBUG usage string unless explicity requested.
|
||||
*/
|
||||
void
|
||||
prusage(int strn, int eflag)
|
||||
{
|
||||
char **cp;
|
||||
|
||||
if (strn == U_ALL) {
|
||||
fprintf(stderr, "usage: sicontrol %s", usage[1]);
|
||||
fprintf(stderr, " sicontrol %s", usage[2]);
|
||||
fprintf(stderr, " sicontrol %s", usage[3]);
|
||||
fprintf(stderr, " sicontrol devname %s", usage[4]);
|
||||
for (cp = &usage[5]; *cp; cp++)
|
||||
fprintf(stderr, " sicontrol devname %s", *cp);
|
||||
}
|
||||
else if (strn >= 0 && strn <= U_MAX)
|
||||
fprintf(stderr, "usage: sicontrol devname %s", usage[strn]);
|
||||
else
|
||||
fprintf(stderr, "sicontrol: usage ???\n");
|
||||
exit(eflag);
|
||||
}
|
||||
|
||||
/* print port status */
|
||||
void
|
||||
dostat(void)
|
||||
{
|
||||
char *av[1], *acp;
|
||||
struct stat_list *stp;
|
||||
struct si_tcsi stc;
|
||||
int donefirst = 0;
|
||||
|
||||
printf("%s: ", alldev ? "ALL" : Devname);
|
||||
acp = malloc(strlen(Devname) + 3);
|
||||
memset(acp, ' ', strlen(Devname));
|
||||
strcat(acp, " ");
|
||||
stc = tc;
|
||||
for (stp = stat_list; stp->st_func != NULL; stp++) {
|
||||
if (donefirst)
|
||||
fputs(acp, stdout);
|
||||
else
|
||||
donefirst++;
|
||||
av[0] = NULL;
|
||||
tc = stc;
|
||||
(*stp->st_func)(-1, av);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* debug
|
||||
* debug [[set|add|del debug_lvls] | [off]]
|
||||
*/
|
||||
void
|
||||
debug(int ac, char **av)
|
||||
{
|
||||
int level;
|
||||
|
||||
if (ac > 2)
|
||||
prusage(U_DEBUG, 1);
|
||||
if (alldev) {
|
||||
if (ioctl(ctlfd, TCSIGDBG_ALL, &tc.tc_dbglvl) < 0)
|
||||
err(1, "TCSIGDBG_ALL on %s", Devname);
|
||||
} else {
|
||||
if (ioctl(ctlfd, TCSIGDBG_LEVEL, &tc) < 0)
|
||||
err(1, "TCSIGDBG_LEVEL on %s", Devname);
|
||||
}
|
||||
|
||||
switch (ac) {
|
||||
case 0:
|
||||
printf("%s: debug levels - ", Devname);
|
||||
prlevels(tc.tc_dbglvl);
|
||||
return;
|
||||
case 1:
|
||||
if (strcmp(av[0], "off") == 0) {
|
||||
tc.tc_dbglvl = 0;
|
||||
break;
|
||||
}
|
||||
prusage(U_DEBUG, 1);
|
||||
/* no return */
|
||||
case 2:
|
||||
level = lvls2bits(av[1]);
|
||||
if (strcmp(av[0], "add") == 0)
|
||||
tc.tc_dbglvl |= level;
|
||||
else if (strcmp(av[0], "del") == 0)
|
||||
tc.tc_dbglvl &= ~level;
|
||||
else if (strcmp(av[0], "set") == 0)
|
||||
tc.tc_dbglvl = level;
|
||||
else
|
||||
prusage(U_DEBUG, 1);
|
||||
}
|
||||
if (alldev) {
|
||||
if (ioctl(ctlfd, TCSISDBG_ALL, &tc.tc_dbglvl) < 0)
|
||||
err(1, "TCSISDBG_ALL on %s", Devname);
|
||||
} else {
|
||||
if (ioctl(ctlfd, TCSISDBG_LEVEL, &tc) < 0)
|
||||
err(1, "TCSISDBG_LEVEL on %s", Devname);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
rxint(int ac, char **av)
|
||||
{
|
||||
tc.tc_port = 0;
|
||||
switch (ac) {
|
||||
case 0:
|
||||
printf("%s: ", Devname);
|
||||
case -1:
|
||||
if (ioctl(ctlfd, TCSIGRXIT, &tc) < 0)
|
||||
err(1, "TCSIGRXIT");
|
||||
printf("RX interrupt throttle: %d msec\n", tc.tc_int*10);
|
||||
break;
|
||||
case 1:
|
||||
tc.tc_int = getnum(av[0]) / 10;
|
||||
if (tc.tc_int == 0)
|
||||
tc.tc_int = 1;
|
||||
if (ioctl(ctlfd, TCSIRXIT, &tc) < 0)
|
||||
err(1, "TCSIRXIT on %s at %d msec",
|
||||
Devname, tc.tc_int*10);
|
||||
break;
|
||||
default:
|
||||
prusage(U_RXINT, 1);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
txint(int ac, char **av)
|
||||
{
|
||||
|
||||
tc.tc_port = 0;
|
||||
switch (ac) {
|
||||
case 0:
|
||||
printf("%s: ", Devname);
|
||||
case -1:
|
||||
if (ioctl(ctlfd, TCSIGIT, &tc) < 0)
|
||||
err(1, "TCSIGIT");
|
||||
printf("aggregate interrupt throttle: %d\n", tc.tc_int);
|
||||
break;
|
||||
case 1:
|
||||
tc.tc_int = getnum(av[0]);
|
||||
if (ioctl(ctlfd, TCSIIT, &tc) < 0)
|
||||
err(1, "TCSIIT on %s at %d", Devname, tc.tc_int);
|
||||
break;
|
||||
default:
|
||||
prusage(U_TXINT, 1);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
onoff(int ac, char **av, int cmd, char *cmdstr, char *prstr, int usage)
|
||||
{
|
||||
if (ac > 1)
|
||||
prusage(usage, 1);
|
||||
if (ac == 1) {
|
||||
if (strcmp(av[0], "on") == 0)
|
||||
tc.tc_int = 1;
|
||||
else if (strcmp(av[0], "off") == 0)
|
||||
tc.tc_int = 0;
|
||||
else
|
||||
prusage(usage, 1);
|
||||
} else
|
||||
tc.tc_int = -1;
|
||||
if (ioctl(ctlfd, cmd, &tc) < 0)
|
||||
err(1, "%s on %s", cmdstr, Devname);
|
||||
switch (ac) {
|
||||
case 0:
|
||||
printf("%s: ", Devname);
|
||||
case -1:
|
||||
printf("%s ", prstr);
|
||||
if (tc.tc_int)
|
||||
printf("on\n");
|
||||
else
|
||||
printf("off\n");
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
mstate(int ac, char **av)
|
||||
{
|
||||
switch (ac) {
|
||||
case 0:
|
||||
printf("%s: ", Devname);
|
||||
case -1:
|
||||
break;
|
||||
default:
|
||||
prusage(U_MSTATE, 1);
|
||||
}
|
||||
if (ioctl(ctlfd, TCSISTATE, &tc) < 0)
|
||||
err(1, "TCSISTATE on %s", Devname);
|
||||
printf("modem bits state - (0x%x)", tc.tc_int);
|
||||
if (tc.tc_int & IP_DCD) printf(" DCD");
|
||||
if (tc.tc_int & IP_DTR) printf(" DTR");
|
||||
if (tc.tc_int & IP_RTS) printf(" RTS");
|
||||
printf("\n");
|
||||
}
|
||||
|
||||
void
|
||||
nport(int ac, char **av)
|
||||
{
|
||||
int ports;
|
||||
|
||||
if (ac != 0)
|
||||
prusage(U_NPORT, 1);
|
||||
if (ioctl(ctlfd, TCSIPORTS, &ports) < 0)
|
||||
err(1, "TCSIPORTS on %s", Devname);
|
||||
printf("SLXOS: total of %d ports\n", ports);
|
||||
}
|
||||
|
||||
const char *s_stat(int stat)
|
||||
{
|
||||
switch (stat) {
|
||||
case IDLE_OPEN: return "IDLE_OPEN";
|
||||
case LOPEN: return "LOPEN";
|
||||
case MOPEN: return "MOPEN";
|
||||
case MPEND: return "MPEND";
|
||||
case CONFIG: return "CONFIG";
|
||||
case CLOSE: return "CLOSE";
|
||||
case SBREAK: return "SBREAK";
|
||||
case EBREAK: return "EBREAK";
|
||||
case IDLE_CLOSE:return "IDLE_CLOSE";
|
||||
case IDLE_BREAK:return "IDLE_BREAK";
|
||||
case FCLOSE: return "FCLOSE";
|
||||
case RESUME: return "RESUME";
|
||||
case WFLUSH: return "WFLUSH";
|
||||
case RFLUSH: return "RFLUSH";
|
||||
default: return "??";
|
||||
}
|
||||
}
|
||||
const char *s_mr1(int mr1)
|
||||
{
|
||||
static char msg[200];
|
||||
|
||||
sprintf(msg, "%dbit, %s, parity:[", 5 + (mr1 & MR1_8_BITS), mr1 & MR1_ODD ? "odd" : "even");
|
||||
if (mr1 & MR1_WITH)
|
||||
strcat(msg, "with;");
|
||||
if (mr1 & MR1_FORCE)
|
||||
strcat(msg, "force;");
|
||||
if (mr1 & MR1_NONE)
|
||||
strcat(msg, "none;");
|
||||
if (mr1 & MR1_SPECIAL)
|
||||
strcat(msg, "special;");
|
||||
strcpy(msg + strlen(msg) - 1, "]");
|
||||
sprintf(msg + strlen(msg), ", err: %s", mr1 & MR1_BLOCK ? "block" : "none");
|
||||
sprintf(msg + strlen(msg), ", cts: %s", mr1 & MR1_CTSCONT ? "auto" : "none");
|
||||
return (msg);
|
||||
}
|
||||
const char *s_mr2(int mr2)
|
||||
{
|
||||
static char msg[200];
|
||||
|
||||
switch (mr2 & 0xf) {
|
||||
case MR2_1_STOP: strcpy(msg, "1stop"); break;
|
||||
case MR2_2_STOP: strcpy(msg, "2stop"); break;
|
||||
default: sprintf(msg, "??stop (0x%x)", mr2 & 0xf); break;
|
||||
}
|
||||
if (mr2 & MR2_RTSCONT) strcat(msg, ", rtscont");
|
||||
if (mr2 & MR2_CTSCONT) strcat(msg, ", ctscont");
|
||||
switch (mr2 & 0xc0) {
|
||||
case MR2_NORMAL: strcat(msg, ", mode:normal"); break;
|
||||
case MR2_AUTO: strcat(msg, ", mode:auto"); break;
|
||||
case MR2_LOCAL: strcat(msg, ", mode:local"); break;
|
||||
case MR2_REMOTE: strcat(msg, ", mode:remote"); break;
|
||||
}
|
||||
return (msg);
|
||||
}
|
||||
const char *s_clk(int clk)
|
||||
{
|
||||
switch (clk & 0xf) {
|
||||
case 0x0: return "75";
|
||||
case 0x1: return "110/115200";
|
||||
case 0x2: return "38400";
|
||||
case 0x3: return "150";
|
||||
case 0x4: return "300";
|
||||
case 0x5: return "600";
|
||||
case 0x6: return "1200";
|
||||
case 0x7: return "2000";
|
||||
case 0x8: return "2400";
|
||||
case 0x9: return "4800";
|
||||
case 0xa: return "7200";
|
||||
case 0xb: return "9600";
|
||||
case 0xc: return "19200";
|
||||
case 0xd: return "57600";
|
||||
case 0xe: return "?0xe";
|
||||
case 0xf: return "?0xf";
|
||||
}
|
||||
return ("gcc sucks");
|
||||
}
|
||||
const char *s_op(int op)
|
||||
{
|
||||
static char msg[200];
|
||||
|
||||
sprintf(msg, "cts:%s", (op & OP_CTS) ? "on" : "off");
|
||||
sprintf(msg + strlen(msg), ", dsr:%s", (op & OP_DSR) ? "on" : "off");
|
||||
return (msg);
|
||||
}
|
||||
|
||||
const char *s_ip(int ip)
|
||||
{
|
||||
static char msg[200];
|
||||
|
||||
sprintf(msg, "rts:%s", (ip & IP_RTS) ? "on" : "off");
|
||||
sprintf(msg + strlen(msg), ", dcd:%s", (ip & IP_DCD) ? "on" : "off");
|
||||
sprintf(msg + strlen(msg), ", dtr:%s", (ip & IP_DTR) ? "on" : "off");
|
||||
sprintf(msg + strlen(msg), ", ri:%s", (ip & IP_RI) ? "on" : "off");
|
||||
return (msg);
|
||||
}
|
||||
|
||||
const char *s_state(int state)
|
||||
{
|
||||
return (state & ST_BREAK ? "break:on" : "break:off");
|
||||
}
|
||||
|
||||
const char *s_prtcl(int pr)
|
||||
{
|
||||
static char msg[200];
|
||||
|
||||
sprintf(msg, "tx xon any:%s", (pr & SP_TANY) ? "on" : "off");
|
||||
sprintf(msg + strlen(msg), ", tx xon/xoff:%s", (pr & SP_TXEN) ? "on" : "off");
|
||||
sprintf(msg + strlen(msg), ", cooking:%s", (pr & SP_CEN) ? "on" : "off");
|
||||
sprintf(msg + strlen(msg), ", rx xon/xoff:%s", (pr & SP_RXEN) ? "on" : "off");
|
||||
sprintf(msg + strlen(msg), ", dcd/dsr check:%s", (pr & SP_DCEN) ? "on" : "off");
|
||||
sprintf(msg + strlen(msg), ", parity check:%s", (pr & SP_PAEN) ? "on" : "off");
|
||||
return (msg);
|
||||
}
|
||||
const char *s_break(int br)
|
||||
{
|
||||
static char msg[200];
|
||||
|
||||
sprintf(msg, "ignore rx brk:%s", (br & BR_IGN) ? "on" : "off");
|
||||
sprintf(msg + strlen(msg), ", brk interrupt:%s", (br & BR_INT) ? "on" : "off");
|
||||
sprintf(msg + strlen(msg), ", parmrking:%s", (br & BR_PARMRK) ? "on" : "off");
|
||||
sprintf(msg + strlen(msg), ", parign:%s", (br & BR_PARIGN) ? "on" : "off");
|
||||
return (msg);
|
||||
}
|
||||
|
||||
const char *
|
||||
s_xstat(int xs)
|
||||
{
|
||||
static char msg[200];
|
||||
|
||||
msg[0] = 0;
|
||||
/* MTA definitions, not TA */
|
||||
if (xs & 0x01) strcat(msg, "TION "); /* Tx interrupts on (MTA only) */
|
||||
if (xs & 0x02) strcat(msg, "RTSEN "); /* RTS FLOW enabled (MTA only) */
|
||||
if (xs & 0x04) strcat(msg, "RTSLOW "); /* XOFF received (TA only) */
|
||||
if (xs & 0x08) strcat(msg, "RXEN "); /* Rx XON/XOFF enabled */
|
||||
if (xs & 0x10) strcat(msg, "ANYXO "); /* XOFF pending/sent or RTS dropped */
|
||||
if (xs & 0x20) strcat(msg, "RXSE "); /* Rx XOFF sent */
|
||||
if (xs & 0x40) strcat(msg, "NPEND "); /* Rx XON pending or XOFF pending */
|
||||
if (xs & 0x40) strcat(msg, "FPEND "); /* Rx XOFF pending */
|
||||
return (msg);
|
||||
}
|
||||
|
||||
const char *
|
||||
s_cstat(int cs)
|
||||
{
|
||||
static char msg[200];
|
||||
|
||||
msg[0] = 0;
|
||||
/* MTA definitions, not TA */
|
||||
if (cs & 0x01) strcat(msg, "TEMR "); /* Tx empty requested (MTA only) */
|
||||
if (cs & 0x02) strcat(msg, "TEMA "); /* Tx empty acked (MTA only) */
|
||||
if (cs & 0x04) strcat(msg, "EN "); /* Cooking enabled (on MTA means port is also || */
|
||||
if (cs & 0x08) strcat(msg, "HIGH "); /* Buffer previously hit high water */
|
||||
if (cs & 0x10) strcat(msg, "CTSEN "); /* CTS automatic flow-control enabled */
|
||||
if (cs & 0x20) strcat(msg, "DCDEN "); /* DCD/DTR checking enabled */
|
||||
if (cs & 0x40) strcat(msg, "BREAK "); /* Break detected */
|
||||
if (cs & 0x80) strcat(msg, "RTSEN "); /* RTS automatic flow control enabled (MTA only) */
|
||||
return (msg);
|
||||
}
|
||||
|
||||
void
|
||||
ccb_stat(int ac, char **av)
|
||||
{
|
||||
struct si_pstat sip;
|
||||
#define CCB sip.tc_ccb
|
||||
|
||||
if (ac != 0)
|
||||
prusage(U_STAT_CCB, 1);
|
||||
sip.tc_dev = tc.tc_dev;
|
||||
if (ioctl(ctlfd, TCSI_CCB, &sip) < 0)
|
||||
err(1, "TCSI_CCB on %s", Devname);
|
||||
printf("%s: ", Devname);
|
||||
|
||||
/* WORD next - Next Channel */
|
||||
/* WORD addr_uart - Uart address */
|
||||
/* WORD module - address of module struct */
|
||||
printf("\tuart_type 0x%x\n", CCB.type); /* BYTE type - Uart type */
|
||||
/* BYTE fill - */
|
||||
printf("\tx_status 0x%x %s\n", CCB.x_status, s_xstat(CCB.x_status)); /* BYTE x_status - XON / XOFF status */
|
||||
printf("\tc_status 0x%x %s\n", CCB.c_status, s_cstat(CCB.c_status)); /* BYTE c_status - cooking status */
|
||||
printf("\thi_rxipos 0x%x\n", CCB.hi_rxipos); /* BYTE hi_rxipos - stuff into rx buff */
|
||||
printf("\thi_rxopos 0x%x\n", CCB.hi_rxopos); /* BYTE hi_rxopos - stuff out of rx buffer */
|
||||
printf("\thi_txopos 0x%x\n", CCB.hi_txopos); /* BYTE hi_txopos - Stuff into tx ptr */
|
||||
printf("\thi_txipos 0x%x\n", CCB.hi_txipos); /* BYTE hi_txipos - ditto out */
|
||||
printf("\thi_stat 0x%x %s\n", CCB.hi_stat, s_stat(CCB.hi_stat));/* BYTE hi_stat - Command register */
|
||||
printf("\tdsr_bit 0x%x\n", CCB.dsr_bit); /* BYTE dsr_bit - Magic bit for DSR */
|
||||
printf("\ttxon 0x%x\n", CCB.txon); /* BYTE txon - TX XON char */
|
||||
printf("\ttxoff 0x%x\n", CCB.txoff); /* BYTE txoff - ditto XOFF */
|
||||
printf("\trxon 0x%x\n", CCB.rxon); /* BYTE rxon - RX XON char */
|
||||
printf("\trxoff 0x%x\n", CCB.rxoff); /* BYTE rxoff - ditto XOFF */
|
||||
printf("\thi_mr1 0x%x %s\n", CCB.hi_mr1, s_mr1(CCB.hi_mr1)); /* BYTE hi_mr1 - mode 1 image */
|
||||
printf("\thi_mr2 0x%x %s\n", CCB.hi_mr2, s_mr2(CCB.hi_mr2)); /* BYTE hi_mr2 - mode 2 image */
|
||||
printf("\thi_csr 0x%x in:%s out:%s\n", CCB.hi_csr, s_clk(CCB.hi_csr >> 4), s_clk(CCB.hi_csr)); /* BYTE hi_csr - clock register */
|
||||
printf("\thi_op 0x%x %s\n", CCB.hi_op, s_op(CCB.hi_op)); /* BYTE hi_op - Op control */
|
||||
printf("\thi_ip 0x%x %s\n", CCB.hi_ip, s_ip(CCB.hi_ip)); /* BYTE hi_ip - Input pins */
|
||||
printf("\thi_state 0x%x %s\n", CCB.hi_state, s_state(CCB.hi_state)); /* BYTE hi_state - status */
|
||||
printf("\thi_prtcl 0x%x %s\n", CCB.hi_prtcl, s_prtcl(CCB.hi_prtcl)); /* BYTE hi_prtcl - Protocol */
|
||||
printf("\thi_txon 0x%x\n", CCB.hi_txon); /* BYTE hi_txon - host copy tx xon stuff */
|
||||
printf("\thi_txoff 0x%x\n", CCB.hi_txoff); /* BYTE hi_txoff - */
|
||||
printf("\thi_rxon 0x%x\n", CCB.hi_rxon); /* BYTE hi_rxon - */
|
||||
printf("\thi_rxoff 0x%x\n", CCB.hi_rxoff); /* BYTE hi_rxoff - */
|
||||
printf("\tclose_prev 0x%x\n", CCB.close_prev); /* BYTE close_prev - Was channel previously closed */
|
||||
printf("\thi_break 0x%x %s\n", CCB.hi_break, s_break(CCB.hi_break)); /* BYTE hi_break - host copy break process */
|
||||
printf("\tbreak_state 0x%x\n", CCB.break_state); /* BYTE break_state - local copy ditto */
|
||||
printf("\thi_mask 0x%x\n", CCB.hi_mask); /* BYTE hi_mask - Mask for CS7 etc. */
|
||||
printf("\tmask_z280 0x%x\n", CCB.mask_z280); /* BYTE mask_z280 - Z280's copy */
|
||||
/* BYTE res[0x60 - 36] - */
|
||||
/* BYTE hi_txbuf[SLXOS_BUFFERSIZE] - */
|
||||
/* BYTE hi_rxbuf[SLXOS_BUFFERSIZE] - */
|
||||
/* BYTE res1[0xA0] - */
|
||||
}
|
||||
|
||||
const char *sp_state(int st)
|
||||
{
|
||||
|
||||
if (st & SS_LSTART)
|
||||
return("lstart ");
|
||||
else
|
||||
return("");
|
||||
}
|
||||
|
||||
void
|
||||
port_stat(int ac, char **av)
|
||||
{
|
||||
struct si_pstat sip;
|
||||
#define PRT sip.tc_siport
|
||||
|
||||
if (ac != 0)
|
||||
prusage(U_STAT_PORT, 1);
|
||||
sip.tc_dev = tc.tc_dev;
|
||||
if (ioctl(ctlfd, TCSI_PORT, &sip) < 0)
|
||||
err(1, "TCSI_PORT on %s", Devname);
|
||||
printf("%s: ", Devname);
|
||||
|
||||
printf("\tsp_pend 0x%x %s\n", PRT.sp_pend, s_stat(PRT.sp_pend));
|
||||
printf("\tsp_last_hi_ip 0x%x %s\n", PRT.sp_last_hi_ip, s_ip(PRT.sp_last_hi_ip));
|
||||
printf("\tsp_state 0x%x %s\n", PRT.sp_state, sp_state(PRT.sp_state));
|
||||
printf("\tsp_delta_overflows 0x%d\n", PRT.sp_delta_overflows);
|
||||
}
|
||||
|
||||
int
|
||||
islevel(char *tk)
|
||||
{
|
||||
struct lv *lvp;
|
||||
char *acp;
|
||||
|
||||
for (acp = tk; *acp; acp++)
|
||||
if (isupper(*acp))
|
||||
*acp = tolower(*acp);
|
||||
for (lvp = lv; lvp->lv_name; lvp++)
|
||||
if (strcmp(lvp->lv_name, tk) == 0)
|
||||
return(lvp->lv_bit);
|
||||
return(0);
|
||||
}
|
||||
|
||||
/*
|
||||
* Convert a string consisting of tokens separated by white space, commas
|
||||
* or `|' into a bitfield - flag any unrecognised tokens.
|
||||
*/
|
||||
int
|
||||
lvls2bits(char *str)
|
||||
{
|
||||
int i, bits = 0;
|
||||
int errflag = 0;
|
||||
char token[20];
|
||||
|
||||
while (sscanf(str, "%[^,| \t]", token) == 1) {
|
||||
str += strlen(token);
|
||||
while (isspace(*str) || *str==',' || *str=='|')
|
||||
str++;
|
||||
if (strcmp(token, "all") == 0)
|
||||
return(0xffffffff);
|
||||
if ((i = islevel(token)) == 0) {
|
||||
warnx("unknown token '%s'", token);
|
||||
errflag++;
|
||||
} else
|
||||
bits |= i;
|
||||
}
|
||||
if (errflag)
|
||||
exit(1);
|
||||
|
||||
return(bits);
|
||||
}
|
||||
|
||||
int
|
||||
getnum(char *str)
|
||||
{
|
||||
int x;
|
||||
char *acp = str;
|
||||
|
||||
x = 0;
|
||||
while (*acp) {
|
||||
if (!isdigit(*acp))
|
||||
errx(1, "%s is not a number", str);
|
||||
x *= 10;
|
||||
x += (*acp - '0');
|
||||
acp++;
|
||||
}
|
||||
return(x);
|
||||
}
|
||||
|
||||
void
|
||||
prlevels(int x)
|
||||
{
|
||||
struct lv *lvp;
|
||||
|
||||
switch (x) {
|
||||
case 0:
|
||||
printf("(none)\n");
|
||||
break;
|
||||
case 0xffffffff:
|
||||
printf("all\n");
|
||||
break;
|
||||
default:
|
||||
for (lvp = lv; lvp->lv_name; lvp++)
|
||||
if (x & lvp->lv_bit)
|
||||
printf(" %s", lvp->lv_name);
|
||||
printf("\n");
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user