Commit 38f808dd authored by Adrian Bunk's avatar Adrian Bunk Committed by Linus Torvalds

[PATCH] remove ip2 programs

drivers/char/ip2/ contained three programs. Besides shipping programs at
this place doesn't sound like a good idea, they didn't even all compile.

The patch below removes them.
Signed-off-by: default avatarAdrian Bunk <bunk@stusta.de>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 8ce13b01
all: ip2mkdev ip2trace ip2stat
ip2mkdev: ip2mkdev.c
cc -o ip2mkdev ip2mkdev.c
ip2trace: ip2trace.c
cc -o ip2trace ip2trace.c
ip2stat: ip2stat.c
cc -o ip2stat ip2stat.c
#include <sys/types.h>
#include <sys/stat.h>
#include <linux/major.h>
#include <fcntl.h>
#include <unistd.h>
#include <stdio.h>
#include "ip2.h"
#include "i2ellis.h"
char nm[256];
i2eBordStr Board[2];
static void ex_details(i2eBordStrPtr);
int main (int argc, char *argv[])
{
int board, box, port;
int fd;
int dev;
i2eBordStrPtr pB = Board;
// Remove all IP2 devices
for ( board = 0; board < 4; ++board )
{
sprintf ( nm, "/dev/ip2ipl%d", board );
unlink ( nm );
sprintf ( nm, "/dev/ip2stat%d", board );
unlink ( nm );
}
for ( port = 0; port < 256; ++port )
{
sprintf ( nm, "/dev/ttyF%d", port );
unlink ( nm );
sprintf ( nm, "/dev/cuf%d", port );
unlink ( nm );
}
// Now create management devices, and use the status device to determine how
// port devices need to exist, and then create them.
for ( board = 0; board < 4; ++board )
{
printf("Board %d: ", board );
sprintf ( nm, "/dev/ip2ipl%d", board );
mknod ( nm, S_IFCHR|0666, (IP2_IPL_MAJOR << 8) | board * 4 );
sprintf ( nm, "/dev/ip2stat%d", board );
mknod ( nm, S_IFCHR|0666, (IP2_IPL_MAJOR << 8) | board * 4 + 1 );
fd = open ( nm, O_RDONLY );
if ( !fd )
{
printf ( "Unable to open status device %s\n", nm );
exit ( 1 );
}
if ( ioctl ( fd, 65, Board ) < 0 )
{
printf ( "not present\n" );
close ( fd );
unlink ( nm );
sprintf ( nm, "/dev/ip2ipl%d", board );
unlink ( nm );
}
else
{
switch( pB->i2ePom.e.porID & ~POR_ID_RESERVED )
{
case POR_ID_FIIEX: ex_details ( pB ); break;
case POR_ID_II_4: printf ( "ISA-4" ); break;
case POR_ID_II_8: printf ( "ISA-8 std" ); break;
case POR_ID_II_8R: printf ( "ISA-8 RJ11" ); break;
default:
printf ( "Unknown board type, ID = %x", pB->i2ePom.e.porID );
}
for ( box = 0; box < ABS_MAX_BOXES; ++box )
{
for ( port = 0; port < ABS_BIGGEST_BOX; ++port )
{
if ( pB->i2eChannelMap[box] & ( 1 << port ) )
{
dev = port
+ box * ABS_BIGGEST_BOX
+ board * ABS_BIGGEST_BOX * ABS_MAX_BOXES;
sprintf ( nm, "/dev/ttyF%d", dev );
mknod ( nm, S_IFCHR|0666, (IP2_TTY_MAJOR << 8) | dev );
sprintf ( nm, "/dev/cuf%d", dev );
mknod ( nm, S_IFCHR|0666, (IP2_CALLOUT_MAJOR << 8) | dev );
printf(".");
}
}
}
printf("\n");
}
}
}
static void ex_details ( i2eBordStrPtr pB )
{
int box;
int i;
int ports = 0;
int boxes = 0;
for( box = 0; box < ABS_MAX_BOXES; ++box )
{
if( pB->i2eChannelMap[box] != 0 ) ++boxes;
for( i = 0; i < ABS_BIGGEST_BOX; ++i )
{
if( pB->i2eChannelMap[box] & 1<< i ) ++ports;
}
}
printf("EX bx=%d pt=%d %d bit", boxes, ports, pB->i2eDataWidth16 ? 16 : 8 );
}
/*******************************************************************************
*
* (c) 1998 by Computone Corporation
*
********************************************************************************
*
*
* PACKAGE: Linux tty Device Driver for IntelliPort family of multiport
* serial I/O controllers.
*
* DESCRIPTION: Status display utility
*
*******************************************************************************/
#include <sys/time.h>
#include <sys/types.h>
#include <unistd.h>
#include <stdio.h>
#include <signal.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <ctype.h>
#include <linux/timer.h>
#include <linux/termios.h>
#include "i2ellis.h"
#include "i2lib.h"
i2eBordStr Board[2];
i2ChanStr Port[2];
struct driver_stats
{
ULONG ref_count;
ULONG irq_counter;
ULONG bh_counter;
} Driver;
char devname[20];
int main (int argc, char *argv[])
{
int fd;
int dev, i;
i2eBordStrPtr pB = Board;
i2ChanStrPtr pCh = Port;
if ( argc != 2 )
{
printf ( "Usage: %s <port>\n", argv[0] );
exit(1);
}
i = sscanf ( argv[1], "/dev/ttyF%d", &dev );
if ( i != 1 ) exit(1);
//printf("%s: board %d, port %d\n", argv[1], dev / 64, dev % 64 );
sprintf ( devname, "/dev/ip2stat%d", dev / 64 );
if( 0 > ( fd = open ( devname, O_RDONLY ) ) ) {
// Conventional name failed - try devfs name
sprintf ( devname, "/dev/ip2/stat%d", dev / 64 );
if( 0 > ( fd = open ( devname, O_RDONLY ) ) ) {
// Where is our board???
printf( "Unable to open board %d to retrieve stats\n",
dev / 64 );
exit( 255 );
}
}
ioctl ( fd, 64, &Driver );
ioctl ( fd, 65, Board );
ioctl ( fd, dev % 64, Port );
printf ( "Driver statistics:-\n" );
printf ( " Reference Count: %d\n", Driver.ref_count );
printf ( " Interrupts to date: %ld\n", Driver.irq_counter );
printf ( " Bottom half to date: %ld\n", Driver.bh_counter );
printf ( "Board statistics(%d):-\n",dev/64 );
printf ( "FIFO: remains = %d%s\n", pB->i2eFifoRemains,
pB->i2eWaitingForEmptyFifo ? ", busy" : "" );
printf ( "Mail: out mail = %02x\n", pB->i2eOutMailWaiting );
printf ( " Input interrupts : %d\n", pB->i2eFifoInInts );
printf ( " Output interrupts: %d\n", pB->i2eFifoOutInts );
printf ( " Flow queued : %ld\n", pB->debugFlowQueued );
printf ( " Bypass queued : %ld\n", pB->debugBypassQueued );
printf ( " Inline queued : %ld\n", pB->debugInlineQueued );
printf ( " Data queued : %ld\n", pB->debugDataQueued );
printf ( " Flow packets : %ld\n", pB->debugFlowCount );
printf ( " Bypass packets : %ld\n", pB->debugBypassCount );
printf ( " Inline packets : %ld\n", pB->debugInlineCount );
printf ( " Mail status : %x\n", pB->i2eStatus );
printf ( " Output mail : %x\n", pB->i2eOutMailWaiting );
printf ( " Fatal flag : %d\n", pB->i2eFatal );
printf ( "Channel statistics(%s:%d):-\n",argv[1],dev%64 );
printf ( "ibuf: stuff = %d strip = %d\n", pCh->Ibuf_stuff, pCh->Ibuf_strip );
printf ( "obuf: stuff = %d strip = %d\n", pCh->Obuf_stuff, pCh->Obuf_strip );
printf ( "pbuf: stuff = %d\n", pCh->Pbuf_stuff );
printf ( "cbuf: stuff = %d strip = %d\n", pCh->Cbuf_stuff, pCh->Cbuf_strip );
printf ( "infl: count = %d room = %d\n", pCh->infl.asof, pCh->infl.room );
printf ( "outfl: count = %d room = %d\n", pCh->outfl.asof, pCh->outfl.room );
printf ( "throttled = %d ",pCh->throttled);
printf ( "bookmarks = %d ",pCh->bookMarks);
printf ( "flush_flags = %x\n",pCh->flush_flags);
printf ( "needs: ");
if (pCh->channelNeeds & NEED_FLOW) printf("FLOW ");
if (pCh->channelNeeds & NEED_INLINE) printf("INLINE ");
if (pCh->channelNeeds & NEED_BYPASS) printf("BYPASS ");
if (pCh->channelNeeds & NEED_CREDIT) printf("CREDIT ");
printf ( "\n");
printf ( "dss: in = %x, out = %x\n",pCh->dataSetIn,pCh->dataSetOut);
}
/*******************************************************************************
*
* (c) 1998 by Computone Corporation
*
********************************************************************************
*
*
* PACKAGE: Linux tty Device Driver for IntelliPort family of multiport
* serial I/O controllers.
*
* DESCRIPTION: Interpretive trace dump utility
*
*******************************************************************************/
#include <sys/time.h>
#include <sys/types.h>
#include <unistd.h>
#include <stdio.h>
#include <signal.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <ctype.h>
#include "ip2trace.h"
unsigned long namebuf[100];
struct {
int wrap,
size,
o_strip,
o_stuff,
strip,
stuff;
unsigned long buf[1000];
} tbuf;
struct sigaction act;
typedef enum { kChar, kInt, kAddr, kHex } eFormat;
int active = 1;
void quit() { active = 0; }
int main (int argc, char *argv[])
{
int fd = open ( "/dev/ip2trace", O_RDONLY );
int cnt, i;
unsigned long ts, td;
struct timeval timeout;
union ip2breadcrumb bc;
eFormat fmt = kHex;
if ( fd < 0 )
{
printf ( "Can't open device /dev/ip2trace\n" );
exit ( 1 );
}
act.sa_handler = quit;
/*act.sa_mask = 0;*/
sigemptyset(&act.sa_mask);
act.sa_flags = 0;
act.sa_restorer = NULL;
sigaction ( SIGTERM, &act, NULL );
ioctl ( fd, 1, namebuf );
printf ( "iiSendPendingMail %p\n", namebuf[0] );
printf ( "i2InitChannels %p\n", namebuf[1] );
printf ( "i2QueueNeeds %p\n", namebuf[2] );
printf ( "i2QueueCommands %p\n", namebuf[3] );
printf ( "i2GetStatus %p\n", namebuf[4] );
printf ( "i2Input %p\n", namebuf[5] );
printf ( "i2InputFlush %p\n", namebuf[6] );
printf ( "i2Output %p\n", namebuf[7] );
printf ( "i2FlushOutput %p\n", namebuf[8] );
printf ( "i2DrainWakeup %p\n", namebuf[9] );
printf ( "i2DrainOutput %p\n", namebuf[10] );
printf ( "i2OutputFree %p\n", namebuf[11] );
printf ( "i2StripFifo %p\n", namebuf[12] );
printf ( "i2StuffFifoBypass %p\n", namebuf[13] );
printf ( "i2StuffFifoFlow %p\n", namebuf[14] );
printf ( "i2StuffFifoInline %p\n", namebuf[15] );
printf ( "i2ServiceBoard %p\n", namebuf[16] );
printf ( "serviceOutgoingFifo %p\n", namebuf[17] );
printf ( "ip2_init %p\n", namebuf[18] );
printf ( "ip2_init_board %p\n", namebuf[19] );
printf ( "find_eisa_board %p\n", namebuf[20] );
printf ( "set_irq %p\n", namebuf[21] );
printf ( "ex_details %p\n", namebuf[22] );
printf ( "ip2_interrupt %p\n", namebuf[23] );
printf ( "ip2_poll %p\n", namebuf[24] );
printf ( "service_all_boards %p\n", namebuf[25] );
printf ( "do_input %p\n", namebuf[27] );
printf ( "do_status %p\n", namebuf[26] );
printf ( "open_sanity_check %p\n", namebuf[27] );
printf ( "open_block_til_ready %p\n", namebuf[28] );
printf ( "ip2_open %p\n", namebuf[29] );
printf ( "ip2_close %p\n", namebuf[30] );
printf ( "ip2_hangup %p\n", namebuf[31] );
printf ( "ip2_write %p\n", namebuf[32] );
printf ( "ip2_putchar %p\n", namebuf[33] );
printf ( "ip2_flush_chars %p\n", namebuf[34] );
printf ( "ip2_write_room %p\n", namebuf[35] );
printf ( "ip2_chars_in_buf %p\n", namebuf[36] );
printf ( "ip2_flush_buffer %p\n", namebuf[37] );
//printf ( "ip2_wait_until_sent %p\n", namebuf[38] );
printf ( "ip2_throttle %p\n", namebuf[39] );
printf ( "ip2_unthrottle %p\n", namebuf[40] );
printf ( "ip2_ioctl %p\n", namebuf[41] );
printf ( "get_modem_info %p\n", namebuf[42] );
printf ( "set_modem_info %p\n", namebuf[43] );
printf ( "get_serial_info %p\n", namebuf[44] );
printf ( "set_serial_info %p\n", namebuf[45] );
printf ( "ip2_set_termios %p\n", namebuf[46] );
printf ( "ip2_set_line_discipline %p\n", namebuf[47] );
printf ( "set_line_characteristics %p\n", namebuf[48] );
printf("\n-------------------------\n");
printf("Start of trace\n");
while ( active ) {
cnt = read ( fd, &tbuf, sizeof tbuf );
if ( cnt ) {
if ( tbuf.wrap ) {
printf ( "\nTrace buffer: wrap=%d, strip=%d, stuff=%d\n",
tbuf.wrap, tbuf.strip, tbuf.stuff );
}
for ( i = 0, bc.value = 0; i < cnt; ++i ) {
if ( !bc.hdr.codes ) {
td = tbuf.buf[i] - ts;
ts = tbuf.buf[i++];
bc.value = tbuf.buf[i];
printf ( "\n(%d) Port %3d ", ts, bc.hdr.port );
fmt = kHex;
switch ( bc.hdr.cat )
{
case ITRC_INIT:
printf ( "Init %d: ", bc.hdr.label );
break;
case ITRC_OPEN:
printf ( "Open %d: ", bc.hdr.label );
break;
case ITRC_CLOSE:
printf ( "Close %d: ", bc.hdr.label );
break;
case ITRC_DRAIN:
printf ( "Drain %d: ", bc.hdr.label );
fmt = kInt;
break;
case ITRC_IOCTL:
printf ( "Ioctl %d: ", bc.hdr.label );
break;
case ITRC_FLUSH:
printf ( "Flush %d: ", bc.hdr.label );
break;
case ITRC_STATUS:
printf ( "GetS %d: ", bc.hdr.label );
break;
case ITRC_HANGUP:
printf ( "Hangup %d: ", bc.hdr.label );
break;
case ITRC_INTR:
printf ( "*Intr %d: ", bc.hdr.label );
break;
case ITRC_SFLOW:
printf ( "SFlow %d: ", bc.hdr.label );
fmt = kInt;
break;
case ITRC_SBCMD:
printf ( "Bypass CMD %d: ", bc.hdr.label );
fmt = kInt;
break;
case ITRC_SICMD:
printf ( "Inline CMD %d: ", bc.hdr.label );
fmt = kInt;
break;
case ITRC_MODEM:
printf ( "Modem %d: ", bc.hdr.label );
break;
case ITRC_INPUT:
printf ( "Input %d: ", bc.hdr.label );
break;
case ITRC_OUTPUT:
printf ( "Output %d: ", bc.hdr.label );
fmt = kInt;
break;
case ITRC_PUTC:
printf ( "Put char %d: ", bc.hdr.label );
fmt = kChar;
break;
case ITRC_QUEUE:
printf ( "Queue CMD %d: ", bc.hdr.label );
fmt = kInt;
break;
case ITRC_STFLW:
printf ( "Stat Flow %d: ", bc.hdr.label );
fmt = kInt;
break;
case ITRC_SFIFO:
printf ( "SFifo %d: ", bc.hdr.label );
break;
case ITRC_VERIFY:
printf ( "Verfy %d: ", bc.hdr.label );
fmt = kHex;
break;
case ITRC_WRITE:
printf ( "Write %d: ", bc.hdr.label );
fmt = kChar;
break;
case ITRC_ERROR:
printf ( "ERROR %d: ", bc.hdr.label );
fmt = kInt;
break;
default:
printf ( "%08x ", tbuf.buf[i] );
break;
}
}
else
{
--bc.hdr.codes;
switch ( fmt )
{
case kChar:
printf ( "%c (0x%02x) ",
isprint ( tbuf.buf[i] ) ? tbuf.buf[i] : '.', tbuf.buf[i] );
break;
case kInt:
printf ( "%d ", tbuf.buf[i] );
break;
case kAddr:
case kHex:
printf ( "0x%x ", tbuf.buf[i] );
break;
}
}
}
}
fflush ( stdout );
timeout.tv_sec = 0;
timeout.tv_usec = 250;
select ( 0, NULL, NULL, NULL, &timeout );
}
printf("\n-------------------------\n");
printf("End of trace\n");
close ( fd );
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment