linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [ patch 6/7] drivers/serial/jsm: new serial device driver
@ 2005-02-27 23:40 Wen Xiong
  2005-02-28  0:47 ` Jeff Garzik
                   ` (3 more replies)
  0 siblings, 4 replies; 21+ messages in thread
From: Wen Xiong @ 2005-02-27 23:40 UTC (permalink / raw)
  To: linux-kernel, linux-serial

[-- Attachment #1: Type: text/plain, Size: 110 bytes --]


This patch is all headers for this device driver.

Signed-off-by: Wen Xiong <wendyx@us.ltcfwd.linux.ibm.com>

[-- Attachment #2: patch6.jasmine --]
[-- Type: text/plain, Size: 52415 bytes --]

diff -Nuar linux-2.6.9.orig/drivers/serial/jsm/digi.h linux-2.6.9.new/drivers/serial/jsm/digi.h
--- linux-2.6.9.orig/drivers/serial/jsm/digi.h	1969-12-31 18:00:00.000000000 -0600
+++ linux-2.6.9.new/drivers/serial/jsm/digi.h	2005-02-27 17:14:44.746952168 -0600
@@ -0,0 +1,416 @@
+/*
+ * Copyright 2003 Digi International (www.digi.com)
+ *	Scott H Kilau <Scott_Kilau at digi dot com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY, EXPRESS OR IMPLIED; without even the
+ * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE.  See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ * $Id: digi.h,v 1.7 2004/09/23 16:08:30 scottk Exp $
+ *
+ *	NOTE: THIS IS A SHARED HEADER. DO NOT CHANGE CODING STYLE!!!
+ */
+
+#ifndef __DIGI_H
+#define __DIGI_H
+
+/************************************************************************
+ ***	Definitions for Digi ditty(1) command.
+ ************************************************************************/
+
+/*
+ * Copyright (c) 1988-96 Digi International Inc., All Rights Reserved.
+ */
+
+/************************************************************************
+ * This module provides application access to special Digi
+ * serial line enhancements which are not standard UNIX(tm) features.
+ ************************************************************************/
+
+#if !defined(TIOCMODG)
+
+#define	TIOCMODG	('d'<<8) | 250		/* get modem ctrl state	*/
+#define	TIOCMODS	('d'<<8) | 251		/* set modem ctrl state	*/
+
+#ifndef TIOCM_LE 
+#define		TIOCM_LE	0x01		/* line enable		*/
+#define		TIOCM_DTR	0x02		/* data terminal ready	*/
+#define		TIOCM_RTS	0x04		/* request to send	*/
+#define		TIOCM_ST	0x08		/* secondary transmit	*/
+#define		TIOCM_SR	0x10		/* secondary receive	*/
+#define		TIOCM_CTS	0x20		/* clear to send	*/
+#define		TIOCM_CAR	0x40		/* carrier detect	*/
+#define		TIOCM_RNG	0x80		/* ring	indicator	*/
+#define		TIOCM_DSR	0x100		/* data set ready	*/
+#define		TIOCM_RI	TIOCM_RNG	/* ring (alternate)	*/
+#define		TIOCM_CD	TIOCM_CAR	/* carrier detect (alt)	*/
+#endif
+
+#endif
+
+#if !defined(TIOCMSET)
+#define	TIOCMSET	('d'<<8) | 252		/* set modem ctrl state	*/
+#define	TIOCMGET	('d'<<8) | 253		/* set modem ctrl state	*/
+#endif
+
+#if !defined(TIOCMBIC)
+#define	TIOCMBIC	('d'<<8) | 254		/* set modem ctrl state */
+#define	TIOCMBIS	('d'<<8) | 255		/* set modem ctrl state */
+#endif
+
+
+#if !defined(TIOCSDTR)
+#define	TIOCSDTR	('e'<<8) | 0		/* set DTR		*/
+#define	TIOCCDTR	('e'<<8) | 1		/* clear DTR		*/
+#endif
+
+/************************************************************************
+ * Ioctl command arguments for DIGI parameters.
+ ************************************************************************/
+#define DIGI_GETA	('e'<<8) | 94		/* Read params		*/
+
+#define DIGI_SETA	('e'<<8) | 95		/* Set params		*/
+#define DIGI_SETAW	('e'<<8) | 96		/* Drain & set params	*/
+#define DIGI_SETAF	('e'<<8) | 97		/* Drain, flush & set params */
+
+#define DIGI_KME	('e'<<8) | 98		/* Read/Write Host	*/
+						/* Adapter Memory	*/
+
+#define	DIGI_GETFLOW	('e'<<8) | 99		/* Get startc/stopc flow */
+						/* control characters 	 */
+#define	DIGI_SETFLOW	('e'<<8) | 100		/* Set startc/stopc flow */
+						/* control characters	 */
+#define	DIGI_GETAFLOW	('e'<<8) | 101		/* Get Aux. startc/stopc */
+						/* flow control chars 	 */
+#define	DIGI_SETAFLOW	('e'<<8) | 102		/* Set Aux. startc/stopc */
+						/* flow control chars	 */
+
+#define DIGI_GEDELAY	('d'<<8) | 246		/* Get edelay */
+#define DIGI_SEDELAY	('d'<<8) | 247		/* Set edelay */
+
+struct	digiflow_t {
+	unsigned char	startc;			/* flow cntl start char	*/
+	unsigned char	stopc;			/* flow cntl stop char	*/
+};
+
+#ifdef	FLOW_2200
+#define	F2200_GETA	('e'<<8) | 104		/* Get 2x36 flow cntl flags */
+#define	F2200_SETAW	('e'<<8) | 105		/* Set 2x36 flow cntl flags */
+#define	F2200_MASK	0x03		/* 2200 flow cntl bit mask */
+#define	FCNTL_2200	0x01		/* 2x36 terminal flow cntl */
+#define	PCNTL_2200	0x02		/* 2x36 printer flow cntl  */
+#define	F2200_XON	0xf8
+#define	P2200_XON	0xf9
+#define	F2200_XOFF	0xfa
+#define	P2200_XOFF	0xfb
+
+#define	FXOFF_MASK	0x03		/* 2200 flow status mask   */
+#define	RCVD_FXOFF	0x01		/* 2x36 Terminal XOFF rcvd */
+#define	RCVD_PXOFF	0x02		/* 2x36 Printer XOFF rcvd  */
+#endif
+
+/************************************************************************
+ * Values for digi_flags 
+ ************************************************************************/
+#define DIGI_IXON	0x0001		/* Handle IXON in the FEP	*/
+#define DIGI_FAST	0x0002		/* Fast baud rates		*/
+#define RTSPACE		0x0004		/* RTS input flow control	*/
+#define CTSPACE		0x0008		/* CTS output flow control	*/
+#define DSRPACE		0x0010		/* DSR output flow control	*/
+#define DCDPACE		0x0020		/* DCD output flow control	*/
+#define DTRPACE		0x0040		/* DTR input flow control	*/
+#define DIGI_COOK	0x0080		/* Cooked processing done in FEP */
+#define DIGI_FORCEDCD	0x0100		/* Force carrier		*/
+#define	DIGI_ALTPIN	0x0200		/* Alternate RJ-45 pin config	*/
+#define	DIGI_AIXON	0x0400		/* Aux flow control in fep	*/
+#define	DIGI_PRINTER	0x0800		/* Hold port open for flow cntrl*/
+#define DIGI_PP_INPUT	0x1000		/* Change parallel port to input*/
+#define DIGI_DTR_TOGGLE	0x2000		/* Support DTR Toggle		*/
+#define DIGI_422	0x4000		/* for 422/232 selectable panel */
+#define DIGI_RTS_TOGGLE	0x8000		/* Support RTS Toggle		*/
+
+/************************************************************************
+ * These options are not supported on the comxi.
+ ************************************************************************/
+#define	DIGI_COMXI	(DIGI_FAST|DIGI_COOK|DSRPACE|DCDPACE|DTRPACE)
+
+#define DIGI_PLEN	28		/* String length		*/
+#define	DIGI_TSIZ	10		/* Terminal string len		*/
+
+/************************************************************************
+ * Structure used with ioctl commands for DIGI parameters.
+ ************************************************************************/
+struct digi_t {
+	unsigned short	digi_flags;		/* Flags (see above)	*/
+	unsigned short	digi_maxcps;		/* Max printer CPS	*/
+	unsigned short	digi_maxchar;		/* Max chars in print queue */
+	unsigned short	digi_bufsize;		/* Buffer size		*/
+	unsigned char	digi_onlen;		/* Length of ON string	*/
+	unsigned char	digi_offlen;		/* Length of OFF string	*/
+	char		digi_onstr[DIGI_PLEN];	/* Printer on string	*/
+	char		digi_offstr[DIGI_PLEN];	/* Printer off string	*/
+	char		digi_term[DIGI_TSIZ];	/* terminal string	*/
+};
+
+/************************************************************************
+ * KME definitions and structures.
+ ************************************************************************/
+#define	RW_IDLE		0	/* Operation complete			*/
+#define	RW_READ		1	/* Read Concentrator Memory		*/
+#define	RW_WRITE	2	/* Write Concentrator Memory		*/
+
+struct rw_t {
+	unsigned char	rw_req;		/* Request type			*/
+	unsigned char	rw_board;	/* Host Adapter board number	*/
+	unsigned char	rw_conc;	/* Concentrator number		*/
+	unsigned char	rw_reserved;	/* Reserved for expansion	*/
+	unsigned int	rw_addr;	/* Address in concentrator	*/
+	unsigned short	rw_size;	/* Read/write request length	*/
+	unsigned char	rw_data[128];	/* Data to read/write		*/
+};
+
+/***********************************************************************
+ * Shrink Buffer and Board Information definitions and structures.
+
+ ************************************************************************/
+			/* Board type return codes */
+#define	PCXI_TYPE 1	/* Board type at the designated port is a PC/Xi */
+#define PCXM_TYPE 2	/* Board type at the designated port is a PC/Xm */
+#define	PCXE_TYPE 3	/* Board type at the designated port is a PC/Xe */
+#define	MCXI_TYPE 4	/* Board type at the designated port is a MC/Xi */
+#define COMXI_TYPE 5	/* Board type at the designated port is a COM/Xi */
+
+			 /* Non-Zero Result codes. */
+#define RESULT_NOBDFND 1 /* A Digi product at that port is not config installed */ 
+#define RESULT_NODESCT 2 /* A memory descriptor was not obtainable */ 
+#define RESULT_NOOSSIG 3 /* FEP/OS signature was not detected on the board */
+#define RESULT_TOOSML  4 /* Too small an area to shrink.  */
+#define RESULT_NOCHAN  5 /* Channel structure for the board was not found */
+
+struct shrink_buf_struct {
+	unsigned int	shrink_buf_vaddr;	/* Virtual address of board */
+	unsigned int	shrink_buf_phys;	/* Physical address of board */
+	unsigned int	shrink_buf_bseg;	/* Amount of board memory */
+	unsigned int	shrink_buf_hseg;	/* '186 Begining of Dual-Port */
+
+	unsigned int	shrink_buf_lseg;	/* '186 Begining of freed memory */ 
+	unsigned int	shrink_buf_mseg;	/* Linear address from start of
+						   dual-port were freed memory
+						   begins, host viewpoint. */
+
+	unsigned int	shrink_buf_bdparam;	/* Parameter for xxmemon and
+						   xxmemoff */
+
+	unsigned int	shrink_buf_reserva;	/* Reserved */
+	unsigned int	shrink_buf_reservb;	/* Reserved */
+	unsigned int	shrink_buf_reservc;	/* Reserved */
+	unsigned int	shrink_buf_reservd;	/* Reserved */
+
+	unsigned char	shrink_buf_result;	/* Reason for call failing
+						   Zero is Good return */
+	unsigned char	shrink_buf_init;	/* Non-Zero if it caused an
+						   xxinit call. */
+
+	unsigned char	shrink_buf_anports;	/* Number of async ports  */
+	unsigned char	shrink_buf_snports; 	/* Number of sync  ports */
+	unsigned char	shrink_buf_type;	/* Board type	1 = PC/Xi,
+								2 = PC/Xm,
+								3 = PC/Xe  
+								4 = MC/Xi  
+								5 = COMX/i */
+	unsigned char	shrink_buf_card;	/* Card number */
+	
+};
+
+/************************************************************************
+ * Structure to get driver status information
+ ************************************************************************/
+struct digi_dinfo {
+	unsigned int	dinfo_nboards;		/* # boards configured	*/
+	char		dinfo_reserved[12];	/* for future expansion */
+	char		dinfo_version[16];	/* driver version	*/
+};
+
+#define	DIGI_GETDD	('d'<<8) | 248		/* get driver info	*/
+ 
+/************************************************************************
+ * Structure used with ioctl commands for per-board information
+ *
+ * physsize and memsize differ when board has "windowed" memory
+ ************************************************************************/
+struct digi_info {
+	unsigned int	info_bdnum;		/* Board number (0 based)  */
+	unsigned int	info_ioport;		/* io port address	   */
+	unsigned int	info_physaddr;		/* memory address	   */
+	unsigned int	info_physsize;		/* Size of host mem window */
+	unsigned int	info_memsize;		/* Amount of dual-port mem */
+						/* on board		   */
+	unsigned short	info_bdtype;		/* Board type		   */
+	unsigned short	info_nports;		/* number of ports	   */
+	char		info_bdstate;		/* board state		   */
+	char		info_reserved[7];	/* for future expansion	   */
+};
+
+#define	DIGI_GETBD	('d'<<8) | 249		/* get board info	   */
+ 
+struct digi_stat {
+	unsigned int	info_chan;		/* Channel number (0 based)  */
+	unsigned int	info_brd;		/* Board number (0 based)  */
+	unsigned int	info_cflag;		/* cflag for channel	   */
+	unsigned int	info_iflag;		/* iflag for channel	   */
+	unsigned int	info_oflag;		/* oflag for channel	   */
+	unsigned int	info_mstat;		/* mstat for channel	   */
+	unsigned int	info_tx_data;		/* tx_data for channel	   */
+	unsigned int	info_rx_data;		/* rx_data for channel	   */
+	unsigned int	info_hflow;		/* hflow for channel	   */
+	unsigned int	info_reserved[8];	/* for future expansion    */
+};
+
+#define	DIGI_GETSTAT	('d'<<8) | 244		/* get board info	   */
+/***********************************************************************
+ *
+ * Structure used with ioctl commands for per-channel information
+ *
+ ************************************************************************/
+struct digi_ch {
+	unsigned int	info_bdnum;		/* Board number (0 based)  */
+	unsigned int	info_channel;		/* Channel index number	   */
+	unsigned int	info_ch_cflag;		/* Channel cflag   	   */
+	unsigned int	info_ch_iflag;		/* Channel iflag   	   */
+	unsigned int	info_ch_oflag;		/* Channel oflag   	   */
+	unsigned int	info_chsize;		/* Channel structure size  */
+	unsigned int	info_sleep_stat;	/* sleep status		   */
+	dev_t		info_dev;		/* device number	   */
+	unsigned char	info_initstate;		/* Channel init state	   */
+	unsigned char	info_running;		/* Channel running state   */
+	int		reserved[8];		/* reserved for future use */
+};
+
+/*
+* This structure is used with the DIGI_FEPCMD ioctl to 
+* tell the driver which port to send the command for.
+*/
+struct digi_cmd {
+	int	cmd;
+	int	word;
+	int	ncmds;
+	int	chan; /* channel index (zero based) */
+	int	bdid; /* board index (zero based) */
+};
+
+
+struct digi_getbuffer /* Struct for holding buffer use counts */
+{
+	unsigned long tIn;
+	unsigned long tOut;
+	unsigned long rxbuf;
+	unsigned long txbuf;
+	unsigned long txdone;
+};
+
+struct digi_getcounter
+{
+	unsigned long norun;		/* number of UART overrun errors */
+	unsigned long noflow;		/* number of buffer overflow errors */
+	unsigned long nframe;		/* number of framing errors */
+	unsigned long nparity;		/* number of parity errors */
+	unsigned long nbreak;		/* number of breaks received */
+	unsigned long rbytes;		/* number of received bytes */
+	unsigned long tbytes;		/* number of bytes transmitted fully */
+};
+
+/*
+*  info_sleep_stat defines
+*/
+#define INFO_RUNWAIT	0x0001
+#define INFO_WOPEN	0x0002
+#define INFO_TTIOW	0x0004
+#define INFO_CH_RWAIT	0x0008
+#define INFO_CH_WEMPTY	0x0010
+#define INFO_CH_WLOW	0x0020
+#define INFO_XXBUF_BUSY 0x0040
+
+#define	DIGI_GETCH	('d'<<8) | 245		/* get board info	*/
+
+/* Board type definitions */
+
+#define	SUBTYPE		0007
+#define	T_PCXI		0000
+#define T_PCXM		0001
+#define T_PCXE		0002
+#define T_PCXR		0003
+#define T_SP		0004
+#define T_SP_PLUS	0005
+#define T_HERC		0000
+#define T_HOU		0001
+#define T_LON		0002
+#define T_CHA		0003
+#define FAMILY		0070
+#define T_COMXI		0000
+#define T_PCXX		0010
+#define T_CX		0020
+#define T_EPC		0030
+#define	T_PCLITE	0040
+#define	T_SPXX		0050
+#define	T_AVXX		0060
+#define T_DXB		0070
+#define T_A2K_4_8	0070
+#define BUSTYPE		0700
+#define T_ISABUS	0000
+#define T_MCBUS		0100
+#define	T_EISABUS	0200
+#define	T_PCIBUS	0400
+
+/* Board State Definitions */
+
+#define	BD_RUNNING	0x0
+#define	BD_REASON	0x7f
+#define	BD_NOTFOUND	0x1
+#define	BD_NOIOPORT	0x2
+#define	BD_NOMEM	0x3
+#define	BD_NOBIOS	0x4
+#define	BD_NOFEP	0x5
+#define	BD_FAILED	0x6
+#define BD_ALLOCATED	0x7
+#define BD_TRIBOOT	0x8
+#define	BD_BADKME	0x80
+
+#define DIGI_SPOLL		('d'<<8) | 254  /* change poller rate   */
+
+#define DIGI_SETCUSTOMBAUD	_IOW('e', 106, int)	/* Set integer baud rate */
+#define DIGI_GETCUSTOMBAUD	_IOR('e', 107, int)	/* Get integer baud rate */
+
+#define DIGI_REALPORT_GETBUFFERS ('e'<<8 ) | 108
+#define DIGI_REALPORT_SENDIMMEDIATE ('e'<<8 ) | 109
+#define DIGI_REALPORT_GETCOUNTERS ('e'<<8 ) | 110
+#define DIGI_REALPORT_GETEVENTS ('e'<<8 ) | 111
+
+#define EV_OPU		0x0001		//!<Output paused by client
+#define EV_OPS		0x0002		//!<Output paused by reqular sw flowctrl  
+#define EV_OPX		0x0004		//!<Output paused by extra sw flowctrl
+#define EV_OPH		0x0008		//!<Output paused by hw flowctrl
+#define EV_OPT		0x0800		//!<Output paused for RTS Toggle predelay
+
+#define EV_IPU		0x0010		//!<Input paused unconditionally by user
+#define EV_IPS		0x0020		//!<Input paused by high/low water marks
+#define EV_IPA		0x0400		//!<Input paused by pattern alarm module
+
+#define EV_TXB		0x0040		//!<Transmit break pending
+#define EV_TXI		0x0080		//!<Transmit immediate pending
+#define EV_TXF		0x0100		//!<Transmit flowctrl char pending
+#define EV_RXB		0x0200		//!<Break received
+
+#define EV_OPALL	0x080f		//!<Output pause flags
+#define EV_IPALL	0x0430		//!<Input pause flags
+
+#endif /* DIGI_H */
diff -Nuar linux-2.6.9.orig/drivers/serial/jsm/dpacompat.h linux-2.6.9.new/drivers/serial/jsm/dpacompat.h
--- linux-2.6.9.orig/drivers/serial/jsm/dpacompat.h	1969-12-31 18:00:00.000000000 -0600
+++ linux-2.6.9.new/drivers/serial/jsm/dpacompat.h	2005-02-27 17:14:44.746952168 -0600
@@ -0,0 +1,114 @@
+/*
+ * Copyright 2003 Digi International (www.digi.com)
+ *      Scott H Kilau <Scott_Kilau at digi dot com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY, EXPRESS OR IMPLIED; without even the
+ * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE.  See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ *      NOTE: THIS IS A SHARED HEADER. DO NOT CHANGE CODING STYLE!!!
+ */
+
+
+/* 
+ * This structure holds data needed for the intelligent <--> nonintelligent 
+ * DPA translation
+ */
+ struct ni_info {
+	int board;
+	int channel;
+	int dtr;
+	int rts;
+	int cts;
+	int dsr;
+	int ri;
+	int dcd;
+	int curtx;
+	int currx;
+	unsigned short iflag;
+	unsigned short oflag;
+	unsigned short cflag;
+	unsigned short lflag;
+
+	unsigned int mstat;
+	unsigned char hflow;
+
+	unsigned char xmit_stopped;
+	unsigned char recv_stopped;
+
+	unsigned int baud;
+};
+
+#define RW_READ		1
+#define RW_WRITE	2
+#define DIGI_KME	('e'<<8) | 98		/* Read/Write Host */
+
+#define SUBTYPE		0007
+#define T_PCXI		0000
+#define T_PCXEM		0001
+#define T_PCXE		0002
+#define T_PCXR		0003
+#define T_SP		0004
+#define T_SP_PLUS	0005
+
+#define T_HERC		0000
+#define T_HOU		0001
+#define T_LON		0002
+#define T_CHA		0003
+
+#define T_NEO		0000
+#define T_CLASSIC	0001
+
+#define FAMILY		0070
+#define T_COMXI		0000
+#define	T_NI		0000
+#define T_PCXX		0010
+#define T_CX		0020
+#define T_EPC		0030
+#define T_PCLITE	0040
+#define T_SPXX		0050
+#define T_AVXX		0060
+#define T_DXB		0070
+#define T_A2K_4_8	0070
+
+#define BUSTYPE		0700
+#define T_ISABUS	0000
+#define T_MCBUS		0100
+#define T_EISABUS	0200
+#define T_PCIBUS	0400
+
+/* Board State Definitions */
+
+#define BD_RUNNING	0x0
+#define BD_REASON	0x7f
+#define BD_NOTFOUND	0x1
+#define BD_NOIOPORT	0x2
+#define BD_NOMEM	0x3
+#define BD_NOBIOS	0x4
+#define BD_NOFEP	0x5
+#define BD_FAILED	0x6
+#define BD_ALLOCATED	0x7
+#define BD_TRIBOOT	0x8
+#define BD_BADKME	0x80
+
+#define DIGI_AIXON	0x0400		/* Aux flow control in fep */
+
+/* Ioctls needed for dpa operation */
+
+#define DIGI_GETDD	('d'<<8) | 248	/* get driver info	*/
+#define DIGI_GETBD	('d'<<8) | 249	/* get board info	*/
+#define DIGI_GET_NI_INFO ('d'<<8) | 250		/* nonintelligent state snfo */
+
+/* Other special ioctls */
+#define DIGI_TIMERIRQ ('d'<<8) | 251	/* Enable/disable RS_TIMER use */
+#define DIGI_LOOPBACK ('d'<<8) | 252	/* Enable/disable UART internal loopback */
diff -Nuar linux-2.6.9.orig/drivers/serial/jsm/jsm_driver.h linux-2.6.9.new/drivers/serial/jsm/jsm_driver.h
--- linux-2.6.9.orig/drivers/serial/jsm/jsm_driver.h	1969-12-31 18:00:00.000000000 -0600
+++ linux-2.6.9.new/drivers/serial/jsm/jsm_driver.h	2005-02-27 17:14:44.747952016 -0600
@@ -0,0 +1,484 @@
+/*
+ * Copyright 2003 Digi International (www.digi.com)
+ *      Scott H Kilau <Scott_Kilau at digi dot com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY, EXPRESS OR IMPLIED; without even the
+ * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE.  See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ *	NOTE: THIS IS A SHARED HEADER. DO NOT CHANGE CODING STYLE!!!
+ *
+ *************************************************************************
+ *
+ * Driver includes
+ *
+ *************************************************************************/
+
+#ifndef __JSM_DRIVER_H
+#define __JSM_DRIVER_H
+
+#include <linux/types.h>	/* To pick up the varions Linux types */
+#include <linux/tty.h>		/* To pick up the various tty structs/defines */
+#include <linux/serial_core.h>
+#include <linux/interrupt.h>	/* For irqreturn_t type */
+#include <linux/module.h>	/* For irqreturn_t type */
+
+#include "jsm_types.h"		/* Additional types needed by the Digi header files */
+#include "digi.h"		/* Digi specific ioctl header */  
+#include "jsm_kcompat.h"	/* Kernel 2.4/2.6 compat includes */
+
+
+/*
+ * Driver identification, error and debugging statments
+ *
+ * In theory, you can change all occurances of "digi" in the next
+ * three lines, and the driver printk's will all automagically change.
+ *
+ * APR((fmt, args, ...));	Always prints message
+ * DPR((fmt, args, ...));	Only prints if JSM_TRACER is defined at
+ *				  compile time and jsm_debug!=0
+ *
+ * TRC_TO_CONSOLE:
+ *	Setting this to 1 will turn on some general function tracing
+ *	resulting in a bunch of extra debugging printks to the console
+ *
+ */
+
+#define	PROCSTR		"jsm"			/* /proc entries	 */
+#define	DEVSTR		"/dev/dg/jsm"		/* /dev entries		 */
+#define	DRVSTR		"jsm"			/* Driver name string 
+						 * displayed by APR	 */
+#define	APR(args)	do {printk(DRVSTR": "); printk args;} while (0)
+
+#define TRC_TO_CONSOLE	1
+
+/*
+ * Debugging levels can be set using debug insmod variable
+ * They can also be compiled out completely.
+ */
+
+#define	DBG_INIT		(jsm_debug & 0x01)
+#define	DBG_BASIC		(jsm_debug & 0x02)
+#define	DBG_CORE		(jsm_debug & 0x04)
+
+#define	DBG_OPEN		(jsm_debug & 0x08)
+#define	DBG_CLOSE		(jsm_debug & 0x10)
+#define	DBG_READ		(jsm_debug & 0x20)
+#define	DBG_WRITE		(jsm_debug & 0x40)
+
+#define	DBG_IOCTL		(jsm_debug & 0x80)
+
+#define	DBG_PROC		(jsm_debug & 0x100)
+#define	DBG_PARAM		(jsm_debug & 0x200)
+#define	DBG_PSCAN		(jsm_debug & 0x400)
+#define	DBG_EVENT		(jsm_debug & 0x800)
+
+#define	DBG_DRAIN		(jsm_debug & 0x1000)
+#define	DBG_MSIGS		(jsm_debug & 0x2000)
+
+#define	DBG_MGMT		(jsm_debug & 0x4000)
+#define	DBG_INTR		(jsm_debug & 0x8000)
+
+#define	DBG_CARR		(jsm_debug & 0x10000)
+
+#if TRC_TO_CONSOLE
+#define PRINTF_TO_CONSOLE(args) { printk(DRVSTR": "); printk args; }
+#else //!defined TRACE_TO_CONSOLE
+#define PRINTF_TO_CONSOLE(args)
+#endif
+
+#define	TRC(args)	{ PRINTF_TO_CONSOLE(args) }
+
+#define DPR_INIT(ARGS)		if (DBG_INIT) TRC(ARGS)
+#define DPR_BASIC(ARGS)		if (DBG_BASIC) TRC(ARGS)
+#define DPR_CORE(ARGS)		if (DBG_CORE) TRC(ARGS)
+#define DPR_OPEN(ARGS)		if (DBG_OPEN)  TRC(ARGS)
+#define DPR_CLOSE(ARGS)		if (DBG_CLOSE)  TRC(ARGS)
+#define DPR_READ(ARGS)		if (DBG_READ)  TRC(ARGS)
+#define DPR_WRITE(ARGS)		if (DBG_WRITE) TRC(ARGS)
+#define DPR_IOCTL(ARGS)		if (DBG_IOCTL) TRC(ARGS)
+#define DPR_PROC(ARGS)		if (DBG_PROC)  TRC(ARGS)
+#define DPR_PARAM(ARGS)		if (DBG_PARAM)  TRC(ARGS)
+#define DPR_PSCAN(ARGS)		if (DBG_PSCAN)  TRC(ARGS)
+#define DPR_EVENT(ARGS)		if (DBG_EVENT)  TRC(ARGS)
+#define DPR_DRAIN(ARGS)		if (DBG_DRAIN)  TRC(ARGS)
+#define DPR_CARR(ARGS)		if (DBG_CARR)  TRC(ARGS)
+#define DPR_MGMT(ARGS)		if (DBG_MGMT)  TRC(ARGS)
+#define DPR_INTR(ARGS)		if (DBG_INTR)  TRC(ARGS)
+#define DPR_MSIGS(ARGS)		if (DBG_MSIGS)  TRC(ARGS)
+#define DPR(ARGS)		if (jsm_debug) TRC(ARGS)
+
+/* Number of boards we support at once. */
+#define	MAXBOARDS	20
+#define	MAXPORTS	8
+#define MAXTTYNAMELEN	200
+
+/* Our 3 magic numbers for our board, channel and unit structs */
+#define JSM_BOARD_MAGIC		0x5c6df104
+#define JSM_CHANNEL_MAGIC	0x6c6df104
+#define JSM_UNIT_MAGIC		0x7c6df104
+
+/* Serial port types */
+#define JSM_SERIAL		0
+
+#define	SERIAL_TYPE_NORMAL	1
+
+#define PORT_NUM(dev)	((dev) & 0x7f)
+#define IS_PRINT(dev)	(((dev) & 0xff) >= 0x80)
+
+/* MAX number of stop characters we will send when our read queue is getting full */
+#define MAX_STOPS_SENT 5
+
+/* 4 extra for alignment play space */
+#define WRITEBUFLEN		((4096) + 4)
+#define MYFLIPLEN		N_TTY_BUF_SIZE
+
+#define jsm_jiffies_from_ms(a) (((a) * HZ) / 1000)
+
+/*
+ * Define a local default termios struct. All ports will be created
+ * with this termios initially.  This is the same structure that is defined
+ * as the default in tty_io.c with the same settings overriden as in serial.c
+ *
+ * In short, this should match the internal serial ports' defaults.
+ */
+#define	DEFAULT_IFLAGS	(ICRNL | IXON)
+#define	DEFAULT_OFLAGS	(OPOST | ONLCR)
+#define	DEFAULT_CFLAGS	(B9600 | CS8 | CREAD | HUPCL | CLOCAL)
+#define	DEFAULT_LFLAGS	(ISIG | ICANON | ECHO | ECHOE | ECHOK | \
+			ECHOCTL | ECHOKE | IEXTEN)
+
+#ifndef _POSIX_VDISABLE
+#define   _POSIX_VDISABLE '\0'
+#endif
+
+#define SNIFF_MAX	65536		/* Sniff buffer size (2^n) */
+#define SNIFF_MASK	(SNIFF_MAX - 1)	/* Sniff wrap mask */
+
+/*
+ * All the possible states the driver can be while being loaded.
+ */
+enum {
+	DRIVER_INITIALIZED = 0,
+	DRIVER_READY
+};
+
+/*
+ * All the possible states the board can be while booting up.
+ */
+enum {
+	BOARD_FAILED = 0,
+	BOARD_FOUND,
+	BOARD_READY
+};
+
+
+/*************************************************************************
+ *
+ * Structures and closely related defines.
+ *
+ *************************************************************************/
+
+struct board_t;
+struct channel_t;
+
+/************************************************************************
+ * Per board operations structure					*
+ ************************************************************************/
+struct board_ops {
+	void (*tasklet) (unsigned long data);
+	JSM_IRQRETURN_TYPE (*intr) (int irq, void *voidbrd, struct pt_regs *regs);
+	void (*uart_init) (struct channel_t *ch);
+	void (*uart_off) (struct channel_t *ch);
+	int  (*drain) (struct tty_struct *tty, uint seconds);
+	void (*param) (struct channel_t *ch);
+	void (*assert_modem_signals) (struct channel_t *ch);
+	void (*flush_uart_write) (struct channel_t *ch);
+	void (*flush_uart_read) (struct channel_t *ch);
+	void (*disable_receiver) (struct channel_t *ch);
+	void (*enable_receiver) (struct channel_t *ch);
+	void (*send_break) (struct channel_t *ch);
+	void (*send_start_character) (struct channel_t *ch);
+	void (*send_stop_character) (struct channel_t *ch);
+	void (*copy_data_from_queue_to_uart) (struct channel_t *ch);
+	uint (*get_uart_bytes_left) (struct channel_t *ch);
+	void (*send_immediate_char) (struct channel_t *ch, unsigned char);
+};
+
+
+/*
+ *	Per-board information
+ */
+struct board_t
+{
+	int		magic;		/* Board Magic number.  */
+	int		boardnum;	/* Board number: 0-32 */
+
+	int		type;		/* Type of board */
+	char		*name;		/* Product Name */
+	u16		vendor;		/* PCI vendor ID */
+	u16		device;		/* PCI device ID */
+	u16		subvendor;	/* PCI subsystem vendor ID */
+	u16		subdevice;	/* PCI subsystem device ID */
+	uchar		rev;		/* PCI revision ID */
+	uint		pci_bus;	/* PCI bus value */
+	uint		pci_slot;	/* PCI slot value */
+	struct pci_dev  *pci_dev;
+	uint		maxports;	/* MAX ports this board can handle */
+
+	spinlock_t	bd_lock;	/* Used to protect board */
+
+	spinlock_t	bd_intr_lock;	/* Used to protect the poller tasklet and
+					 * the interrupt routine from each other.
+					 */
+
+	uint		state;		/* State of card. */
+	wait_queue_head_t state_wait;	/* Place to sleep on for state change */
+
+	struct		tasklet_struct helper_tasklet; /* Poll helper tasklet */
+
+	uint		nasync;		/* Number of ports on card */
+
+	uint		irq;		/* Interrupt request number */
+	ulong		intr_count;	/* Count of interrupts */
+
+	ulong		membase;	/* Start of base memory of the card */
+	ulong		membase_end;	/* End of base memory of the card */
+
+	uchar		*re_map_membase;/* Remapped memory of the card */
+
+	ulong		iobase;		/* Start of io base of the card */
+	ulong		iobase_end;	/* End of io base of the card */
+
+	uint		bd_uart_offset;	/* Space between each UART */
+
+	struct channel_t *channels[MAXPORTS]; /* array of pointers to our channels. */
+
+	struct tty_driver	SerialDriver;
+	char		SerialName[200];
+	struct tty_driver	PrintDriver;
+	char		PrintName[200];
+
+	uint		jsm_Major_Serial_Registered;
+	uint		jsm_Major_TransparentPrint_Registered;
+
+	uint		jsm_Serial_Major;
+	uint		jsm_TransparentPrint_Major;
+
+	uint		TtyRefCnt;
+
+	char		*flipbuf;	/* Our flip buffer, alloced if board is found */
+
+	u16		dpatype;	/* The board "type", as defined by DPA */
+	u16		dpastatus;	/* The board "status", as defined by DPA */
+
+	uint		bd_dividend;	/* Board/UARTs specific dividend */
+
+	struct board_ops *bd_ops;
+
+	/* /proc/<board> entries */
+	struct proc_dir_entry *proc_entry_pointer;
+	struct jsm_proc_entry *jsm_board_table;
+};
+
+
+/************************************************************************ 
+ * Unit flag definitions for un_flags.
+ ************************************************************************/
+#define UN_ISOPEN	0x0001		/* Device is open		*/
+#define UN_CLOSING	0x0002		/* Line is being closed		*/
+#define UN_IMM		0x0004		/* Service immediately		*/
+#define UN_BUSY		0x0008		/* Some work this channel	*/
+#define UN_BREAKI	0x0010		/* Input break received		*/
+#define UN_PWAIT	0x0020		/* Printer waiting for terminal	*/
+#define UN_TIME		0x0040		/* Waiting on time		*/
+#define UN_EMPTY	0x0080		/* Waiting output queue empty	*/
+#define UN_LOW		0x0100		/* Waiting output low water mark*/
+#define UN_EXCL_OPEN	0x0200		/* Open for exclusive use	*/
+#define UN_WOPEN	0x0400		/* Device waiting for open	*/
+#define UN_WIOCTL	0x0800		/* Device waiting for open	*/
+#define UN_HANGUP	0x8000		/* Carrier lost			*/
+
+
+/************************************************************************
+ * Structure for terminal or printer unit. 
+ ************************************************************************/
+struct un_t {
+	int	magic;		/* Unit Magic Number.			*/
+	struct	channel_t *un_ch;
+	ulong	un_time;
+	uint	un_type;
+	uint	un_open_count;	/* Counter of opens to port		*/
+	struct tty_struct *un_tty;/* Pointer to unit tty structure	*/
+	uint	un_flags;	/* Unit flags				*/
+	wait_queue_head_t un_flags_wait; /* Place to sleep to wait on unit */
+	uint	un_dev;		/* Minor device number			*/
+};
+
+
+/************************************************************************ 
+ * Device flag definitions for ch_flags.
+ ************************************************************************/
+#define CH_PRON		0x0001		/* Printer on string		*/
+#define CH_STOP		0x0002		/* Output is stopped		*/
+#define CH_STOPI	0x0004		/* Input is stopped		*/
+#define CH_CD		0x0008		/* Carrier is present		*/
+#define CH_FCAR		0x0010		/* Carrier forced on		*/
+#define CH_HANGUP	0x0020		/* Hangup received		*/
+
+#define CH_RECEIVER_OFF	0x0040		/* Receiver is off		*/
+#define CH_OPENING	0x0080		/* Port in fragile open state	*/
+#define CH_CLOSING	0x0100		/* Port in fragile close state	*/
+#define CH_FIFO_ENABLED 0x0200		/* Port has FIFOs enabled	*/
+#define CH_TX_FIFO_EMPTY 0x0400		/* TX Fifo is completely empty	*/
+#define CH_TX_FIFO_LWM  0x0800		/* TX Fifo is below Low Water	*/
+#define CH_BREAK_SENDING 0x1000		/* Break is being sent		*/
+#define CH_LOOPBACK 0x2000		/* Channel is in lookback mode	*/
+#define CH_FLIPBUF_IN_USE 0x4000	/* Channel's flipbuf is in use	*/
+#define CH_BAUD0	0x08000		/* Used for checking B0 transitions */
+
+/*
+ * Definitions for ch_sniff_flags
+ */
+#define SNIFF_OPEN	0x1
+#define SNIFF_WAIT_DATA	0x2
+#define SNIFF_WAIT_SPACE 0x4
+
+
+/* Our Read/Error/Write queue sizes */
+#define RQUEUEMASK	0x1FFF		/* 8 K - 1 */
+#define EQUEUEMASK	0x1FFF		/* 8 K - 1 */
+#define WQUEUEMASK	0x0FFF		/* 4 K - 1 */
+#define RQUEUESIZE	(RQUEUEMASK + 1)
+#define EQUEUESIZE	RQUEUESIZE
+#define WQUEUESIZE	(WQUEUEMASK + 1)
+
+
+/************************************************************************ 
+ * Channel information structure.
+ ************************************************************************/
+struct channel_t {
+	struct uart_port uart_port;
+	int magic;			/* Channel Magic Number		*/
+	struct board_t	*ch_bd;		/* Board structure pointer	*/
+	struct un_t	ch_tun;		/* Terminal unit info		*/
+	struct un_t	ch_pun;		/* Printer unit info		*/
+
+	spinlock_t	ch_lock;	/* provide for serialization */
+	wait_queue_head_t ch_flags_wait;
+
+	uint		ch_portnum;	/* Port number, 0 offset.	*/
+	uint		ch_open_count;	/* open count			*/
+	uint		ch_flags;	/* Channel flags		*/
+
+	ulong		ch_close_delay;	/* How long we should drop RTS/DTR for */
+
+	ulong		ch_cpstime;	/* Time for CPS calculations	*/
+
+	tcflag_t	ch_c_iflag;	/* channel iflags		*/
+	tcflag_t	ch_c_cflag;	/* channel cflags		*/
+	tcflag_t	ch_c_oflag;	/* channel oflags		*/
+	tcflag_t	ch_c_lflag;	/* channel lflags		*/
+	uchar		ch_stopc;	/* Stop character		*/
+	uchar		ch_startc;	/* Start character		*/
+
+	uint		ch_old_baud;	/* Cache of the current baud */
+	uint		ch_custom_speed;/* Custom baud, if set */
+
+	uint		ch_wopen;	/* Waiting for open process cnt */
+
+	uchar		ch_mostat;	/* FEP output modem status	*/
+	uchar		ch_mistat;	/* FEP input modem status	*/
+
+	struct neo_uart_struct *ch_neo_uart;	/* Pointer to the "mapped" UART struct */
+	uchar		ch_cached_lsr;	/* Cached value of the LSR register */
+
+	uchar		*ch_rqueue;	/* Our read queue buffer - malloc'ed */
+	ushort		ch_r_head;	/* Head location of the read queue */
+	ushort		ch_r_tail;	/* Tail location of the read queue */
+
+	uchar		*ch_equeue;	/* Our error queue buffer - malloc'ed */
+	ushort		ch_e_head;	/* Head location of the error queue */
+	ushort		ch_e_tail;	/* Tail location of the error queue */
+
+	uchar		*ch_wqueue;	/* Our write queue buffer - malloc'ed */
+	ushort		ch_w_head;	/* Head location of the write queue */
+	ushort		ch_w_tail;	/* Tail location of the write queue */
+
+	ulong		ch_rxcount;	/* total of data received so far */
+	ulong		ch_txcount;	/* total of data transmitted so far */
+
+	uchar		ch_r_tlevel;	/* Receive Trigger level */
+	uchar		ch_t_tlevel;	/* Transmit Trigger level */
+
+	uchar		ch_r_watermark;	/* Receive Watermark */
+
+
+	uint		ch_stops_sent;	/* How many times I have sent a stop character
+					 * to try to stop the other guy sending.
+					 */
+	ulong		ch_err_parity;	/* Count of parity errors on channel */
+	ulong		ch_err_frame;	/* Count of framing errors on channel */
+	ulong		ch_err_break;	/* Count of breaks on channel */
+	ulong		ch_err_overrun; /* Count of overruns on channel */
+
+	ulong		ch_xon_sends;	/* Count of xons transmitted */
+	ulong		ch_xoff_sends;	/* Count of xoffs transmitted */
+
+	/* /proc/<board>/<channel> entries */
+	struct proc_dir_entry *proc_entry_pointer;
+	struct jsm_proc_entry *jsm_channel_table;
+
+	uint ch_sniff_in;
+	uint ch_sniff_out;
+	char *ch_sniff_buf;		/* Sniff buffer for proc */
+	ulong ch_sniff_flags;		/* Channel flags	*/
+	wait_queue_head_t ch_sniff_wait;
+};
+
+
+
+/*************************************************************************
+ *
+ * Prototypes for non-static functions used in more than one module
+ *
+ *************************************************************************/
+
+extern void	*jsm_driver_kzmalloc(size_t size, int priority);
+extern char	*jsm_ioctl_name(int cmd);
+
+/*
+ * Our Global Variables.
+ */
+
+extern struct uart_driver jsm_uart_driver;
+
+extern  int		jsm_driver_state;	/* The state of the driver	*/
+extern  uint		jsm_Major;		/* Our driver/mgmt major	*/
+extern  int		jsm_debug;		/* Debug variable		*/
+extern  int		jsm_rawreadok;		/* Set if user wants rawreads	*/
+extern  int		jsm_trcbuf_size;	/* Size of the ringbuffer	*/
+extern  spinlock_t	jsm_global_lock;	/* Driver global spinlock	*/
+extern  uint		jsm_NumBoards;		/* Total number of boards	*/
+extern  struct board_t	*jsm_Board[MAXBOARDS];	/* Array of board structs	*/
+extern  ulong		jsm_poll_counter;	/* Times the poller has run	*/
+extern  char		*jsm_state_text[];	/* Array of state text		*/
+extern  char		*jsm_driver_state_text[];/* Array of driver state text */
+
+
+void jsm_proc_register_basic_prescan(void);
+int jsm_proc_register_basic_postscan(int board_num);
+void jsm_proc_unregister_all(void);
+void jsm_proc_unregister_brd(int board_num);
+
+#endif
diff -Nuar linux-2.6.9.orig/drivers/serial/jsm/jsm_kcompat.h linux-2.6.9.new/drivers/serial/jsm/jsm_kcompat.h
--- linux-2.6.9.orig/drivers/serial/jsm/jsm_kcompat.h	1969-12-31 18:00:00.000000000 -0600
+++ linux-2.6.9.new/drivers/serial/jsm/jsm_kcompat.h	2005-02-27 17:14:44.747952016 -0600
@@ -0,0 +1,46 @@
+/*
+ * Copyright 2004 Digi International (www.digi.com)
+ *      Scott H Kilau <Scott_Kilau at digi dot com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY, EXPRESS OR IMPLIED; without even the
+ * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE.  See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ *	NOTE: THIS IS A SHARED HEADER. DO NOT CHANGE CODING STYLE!!!
+ *
+ *************************************************************************
+ *
+ * This file is intended to contain all the kernel "differences" between the
+ * various kernels that we support.
+ *
+ *************************************************************************/
+
+#ifndef __JSM_KCOMPAT_H
+#define __JSM_KCOMPAT_H
+
+# define JSM_MAJOR(x)			(imajor(x))
+# define JSM_MINOR(x)			(iminor(x))
+# define JSM_TTY_MAJOR(tty)		(MAJOR(tty_devnum(tty)))
+# define JSM_TTY_MINOR(tty)		(MINOR(tty_devnum(tty)))
+
+# define JSM_MOD_INC_USE_COUNT(rtn)	(rtn = 1)
+# define JSM_MOD_DEC_USE_COUNT		
+
+# define JSM_IRQRETURN_TYPE		irqreturn_t
+# define JSM_IRQ_RETURN(x)		return x;
+
+# define PARM_GEN_IP			(PDE(file->f_dentry->d_inode))
+
+# define JSM_GET_TTY_COUNT(x)		(x->count)
+
+#endif /* ! __JSM_KCOMPAT_H */
diff -Nuar linux-2.6.9.orig/drivers/serial/jsm/jsm_mgmt.h linux-2.6.9.new/drivers/serial/jsm/jsm_mgmt.h
--- linux-2.6.9.orig/drivers/serial/jsm/jsm_mgmt.h	1969-12-31 18:00:00.000000000 -0600
+++ linux-2.6.9.new/drivers/serial/jsm/jsm_mgmt.h	2005-02-27 17:14:44.747952016 -0600
@@ -0,0 +1,32 @@
+/*
+ * Copyright 2003 Digi International (www.digi.com)
+ *	Scott H Kilau <Scott_Kilau at digi dot com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY, EXPRESS OR IMPLIED; without even the
+ * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE.  See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ *	NOTE: THIS IS A SHARED HEADER. DO NOT CHANGE CODING STYLE!!!
+ */
+
+#ifndef __JSM_MGMT_H
+#define __JSM_MGMT_H
+
+#define MAXMGMTDEVICES 8
+
+int jsm_mgmt_open(struct inode *inode, struct file *file);
+int jsm_mgmt_close(struct inode *inode, struct file *file);
+int jsm_mgmt_ioctl(struct inode *inode, struct file *file, unsigned int cmd, unsigned long arg);
+
+#endif
+
diff -Nuar linux-2.6.9.orig/drivers/serial/jsm/jsm_neo.h linux-2.6.9.new/drivers/serial/jsm/jsm_neo.h
--- linux-2.6.9.orig/drivers/serial/jsm/jsm_neo.h	1969-12-31 18:00:00.000000000 -0600
+++ linux-2.6.9.new/drivers/serial/jsm/jsm_neo.h	2005-02-27 17:14:44.748951864 -0600
@@ -0,0 +1,143 @@
+/*
+ * Copyright 2003 Digi International (www.digi.com)
+ *	Scott H Kilau <Scott_Kilau at digi dot com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY, EXPRESS OR IMPLIED; without even the
+ * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE.  See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ *	NOTE: THIS IS A SHARED HEADER. DO NOT CHANGE CODING STYLE!!!
+ *
+ */
+
+#ifndef __JSM_NEO_H
+#define __JSM_NEO_H
+
+#include "jsm_types.h"
+#include "jsm_driver.h"
+
+/************************************************************************ 
+ * Per channel/port NEO UART structure					*
+ ************************************************************************
+ *		Base Structure Entries Usage Meanings to Host		*
+ *									*
+ *	W = read write		R = read only				* 
+ *			U = Unused.					*
+ ************************************************************************/
+
+struct neo_uart_struct {
+	volatile uchar txrx;		/* WR  RHR/THR - Holding Reg */
+	volatile uchar ier;		/* WR  IER - Interrupt Enable Reg */
+	volatile uchar isr_fcr;		/* WR  ISR/FCR - Interrupt Status Reg/Fifo Control Reg */
+	volatile uchar lcr;		/* WR  LCR - Line Control Reg */
+	volatile uchar mcr;		/* WR  MCR - Modem Control Reg */
+	volatile uchar lsr;		/* WR  LSR - Line Status Reg */
+	volatile uchar msr;		/* WR  MSR - Modem Status Reg */
+	volatile uchar spr;		/* WR  SPR - Scratch Pad Reg */
+	volatile uchar fctr;		/* WR  FCTR - Feature Control Reg */
+	volatile uchar efr;		/* WR  EFR - Enhanced Function Reg */
+	volatile uchar tfifo;		/* WR  TXCNT/TXTRG - Transmit FIFO Reg */	
+	volatile uchar rfifo;		/* WR  RXCNT/RXTRG - Recieve  FIFO Reg */
+	volatile uchar xoffchar1;	/* WR  XOFF 1 - XOff Character 1 Reg */
+	volatile uchar xoffchar2;	/* WR  XOFF 2 - XOff Character 2 Reg */
+	volatile uchar xonchar1;	/* WR  XON 1 - Xon Character 1 Reg */
+	volatile uchar xonchar2;	/* WR  XON 2 - XOn Character 2 Reg */
+
+	volatile uchar reserved1[0x2ff - 0x200]; /* U   Reserved by Exar */
+	volatile uchar txrxburst[64];	/* RW  64 bytes of RX/TX FIFO Data */
+	volatile uchar reserved2[0x37f - 0x340]; /* U   Reserved by Exar */
+	volatile uchar rxburst_with_errors[64];	/* R  64 bytes of RX FIFO Data + LSR */
+};
+
+/* Where to read the extended interrupt register (32bits instead of 8bits) */
+#define	UART_17158_POLL_ADDR_OFFSET	0x80
+
+
+/*
+ * These are the redefinitions for the FCTR on the XR17C158, since
+ * Exar made them different than their earlier design. (XR16C854)
+ */
+
+/* These are only applicable when table D is selected */
+#define UART_17158_FCTR_RTS_NODELAY	0x00
+#define UART_17158_FCTR_RTS_4DELAY	0x01
+#define UART_17158_FCTR_RTS_6DELAY	0x02
+#define UART_17158_FCTR_RTS_8DELAY	0x03
+#define UART_17158_FCTR_RTS_12DELAY	0x12
+#define UART_17158_FCTR_RTS_16DELAY	0x05
+#define UART_17158_FCTR_RTS_20DELAY	0x13
+#define UART_17158_FCTR_RTS_24DELAY	0x06
+#define UART_17158_FCTR_RTS_28DELAY	0x14
+#define UART_17158_FCTR_RTS_32DELAY	0x07
+#define UART_17158_FCTR_RTS_36DELAY	0x16
+#define UART_17158_FCTR_RTS_40DELAY	0x08
+#define UART_17158_FCTR_RTS_44DELAY	0x09
+#define UART_17158_FCTR_RTS_48DELAY	0x10
+#define UART_17158_FCTR_RTS_52DELAY	0x11
+
+#define UART_17158_FCTR_RTS_IRDA	0x10
+#define UART_17158_FCTR_RS485		0x20
+#define UART_17158_FCTR_TRGA		0x00
+#define UART_17158_FCTR_TRGB		0x40
+#define UART_17158_FCTR_TRGC		0x80
+#define UART_17158_FCTR_TRGD		0xC0
+
+/* 17158 trigger table selects.. */
+#define UART_17158_FCTR_BIT6		0x40
+#define UART_17158_FCTR_BIT7		0x80
+
+/* 17158 TX/RX memmapped buffer offsets */
+#define UART_17158_RX_FIFOSIZE		64  
+#define UART_17158_TX_FIFOSIZE		64  
+
+/* 17158 Extended IIR's */
+#define UART_17158_IIR_RDI_TIMEOUT	0x0C	/* Receiver data TIMEOUT */
+#define UART_17158_IIR_XONXOFF		0x10	/* Received an XON/XOFF char */
+#define UART_17158_IIR_HWFLOW_STATE_CHANGE 0x20	/* CTS/DSR or RTS/DTR state change */
+#define UART_17158_IIR_FIFO_ENABLED	0xC0	/* 16550 FIFOs are Enabled */
+
+/*
+ * These are the extended interrupts that get sent
+ * back to us from the UART's 32bit interrupt register
+ */
+#define UART_17158_RX_LINE_STATUS	0x1	/* RX Ready */
+#define UART_17158_RXRDY_TIMEOUT	0x2	/* RX Ready Timeout */
+#define UART_17158_TXRDY		0x3	/* TX Ready */
+#define UART_17158_MSR			0x4	/* Modem State Change */
+#define UART_17158_TX_AND_FIFO_CLR	0x40	/* Transmitter Holding Reg Empty */
+#define UART_17158_RX_FIFO_DATA_ERROR	0x80	/* UART detected an RX FIFO Data error */
+
+/*
+ * These are the EXTENDED definitions for the 17C158's Interrupt
+ * Enable Register.
+ */
+#define UART_17158_EFR_ECB	0x10	/* Enhanced control bit */
+#define UART_17158_EFR_IXON	0x2	/* Receiver compares Xon1/Xoff1 */
+#define UART_17158_EFR_IXOFF	0x8	/* Transmit Xon1/Xoff1 */
+#define UART_17158_EFR_RTSDTR	0x40	/* Auto RTS/DTR Flow Control Enable */
+#define UART_17158_EFR_CTSDSR	0x80	/* Auto CTS/DSR Flow COntrol Enable */
+
+#define UART_17158_XOFF_DETECT	0x1	/* Indicates whether chip saw an incoming XOFF char  */
+#define UART_17158_XON_DETECT	0x2	/* Indicates whether chip saw an incoming XON char */
+
+#define UART_17158_IER_RSVD1	0x10	/* Reserved by Exar */
+#define UART_17158_IER_XOFF	0x20	/* Xoff Interrupt Enable */
+#define UART_17158_IER_RTSDTR	0x40	/* Output Interrupt Enable */
+#define UART_17158_IER_CTSDSR	0x80	/* Input Interrupt Enable */
+
+/*
+ * Our Global Variables
+ */
+extern struct board_ops jsm_neo_ops;
+
+#endif
diff -Nuar linux-2.6.9.orig/drivers/serial/jsm/jsm_pci.h linux-2.6.9.new/drivers/serial/jsm/jsm_pci.h
--- linux-2.6.9.orig/drivers/serial/jsm/jsm_pci.h	1969-12-31 18:00:00.000000000 -0600
+++ linux-2.6.9.new/drivers/serial/jsm/jsm_pci.h	2005-02-27 17:14:44.748951864 -0600
@@ -0,0 +1,59 @@
+/*
+ * Copyright 2003 Digi International (www.digi.com)
+ *	Scott H Kilau <Scott_Kilau at digi dot com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY, EXPRESS OR IMPLIED; without even the
+ * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE.  See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ *	NOTE: THIS IS A SHARED HEADER. DO NOT CHANGE CODING STYLE!!!
+ */
+
+/* $Id: jsm_pci.h,v 1.4 2004/01/06 16:44:49 scottk Exp $ */
+
+#ifndef __DGAP_PCI_H
+#define __DGAP_PCI_H
+
+#define PCIMAX 32			/* maximum number of PCI boards */
+
+#define DIGI_VID				0x114F
+
+#define PCI_DEVICE_NEO_4_DID			0x00B0
+#define PCI_DEVICE_NEO_8_DID			0x00B1
+#define PCI_DEVICE_NEO_2DB9_DID			0x00C8
+#define PCI_DEVICE_NEO_2DB9PRI_DID		0x00C9
+#define PCI_DEVICE_NEO_2RJ45_DID		0x00CA
+#define PCI_DEVICE_NEO_2RJ45PRI_DID		0x00CB
+#define PCI_DEVICE_NEO_1_422_DID		0x00CC
+#define PCI_DEVICE_NEO_1_422_485_DID		0x00CD
+#define PCI_DEVICE_NEO_2_422_485_DID		0x00CE
+
+
+#define PCI_DEVICE_NEO_4_PCI_NAME		"Neo 4 PCI"
+#define PCI_DEVICE_NEO_8_PCI_NAME		"Neo 8 PCI"
+#define PCI_DEVICE_NEO_2DB9_PCI_NAME		"Neo 2 - DB9 Universal PCI"
+#define PCI_DEVICE_NEO_2DB9PRI_PCI_NAME		"Neo 2 - DB9 Universal PCI - Powered Ring Indicator"
+#define PCI_DEVICE_NEO_2RJ45_PCI_NAME		"Neo 2 - RJ45 Universal PCI"
+#define PCI_DEVICE_NEO_2RJ45PRI_PCI_NAME	"Neo 2 - RJ45 Universal PCI - Powered Ring Indicator"
+#define PCI_DEVICE_NEO_1_422_PCI_NAME		"Neo 1 422 PCI"
+#define PCI_DEVICE_NEO_1_422_485_PCI_NAME	"Neo 1 422/485 PCI"
+#define PCI_DEVICE_NEO_2_422_485_PCI_NAME	"Neo 2 422/485 PCI"
+
+
+/* Size of Memory and I/O for PCI (4 K) */
+#define PCI_RAM_SIZE				0x1000
+
+/* Size of Memory (2MB) */
+#define PCI_MEM_SIZE				0x1000
+
+#endif
diff -Nuar linux-2.6.9.orig/drivers/serial/jsm/jsm_tty.h linux-2.6.9.new/drivers/serial/jsm/jsm_tty.h
--- linux-2.6.9.orig/drivers/serial/jsm/jsm_tty.h	1969-12-31 18:00:00.000000000 -0600
+++ linux-2.6.9.new/drivers/serial/jsm/jsm_tty.h	2005-02-27 17:14:44.748951864 -0600
@@ -0,0 +1,44 @@
+/*
+ * Copyright 2003 Digi International (www.digi.com)
+ *	Scott H Kilau <Scott_Kilau at digi dot com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY, EXPRESS OR IMPLIED; without even the
+ * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE.  See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ *	NOTE: THIS IS A SHARED HEADER. DO NOT CHANGE CODING STYLE!!!
+ */
+
+#ifndef __JSM_TTY_H
+#define __JSM_TTY_H
+
+#include "jsm_driver.h"
+
+int	jsm_tty_write(struct uart_port *port);
+int	jsm_tty_register(struct board_t *brd);
+
+int	jsm_tty_init(struct board_t *);
+int	jsm_uart_port_init(struct board_t *);
+int	jsm_remove_uart_port(struct board_t *);
+
+void	jsm_tty_uninit(struct board_t *);
+
+void	jsm_input(struct channel_t *ch);
+void	jsm_carrier(struct channel_t *ch);
+void	jsm_check_queue_flow_control(struct channel_t *ch);
+void	neo_clear_break(struct channel_t *ch, int force);
+
+
+void	jsm_sniff_nowait_nolock(struct channel_t *ch, uchar *text, uchar *buf, int nbuf);
+
+#endif
diff -Nuar linux-2.6.9.orig/drivers/serial/jsm/jsm_types.h linux-2.6.9.new/drivers/serial/jsm/jsm_types.h
--- linux-2.6.9.orig/drivers/serial/jsm/jsm_types.h	1969-12-31 18:00:00.000000000 -0600
+++ linux-2.6.9.new/drivers/serial/jsm/jsm_types.h	2005-02-27 17:14:44.749951712 -0600
@@ -0,0 +1,36 @@
+/*
+ * Copyright 2003 Digi International (www.digi.com)
+ *	Scott H Kilau <Scott_Kilau at digi dot com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY, EXPRESS OR IMPLIED; without even the
+ * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE.  See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ *	NOTE: THIS IS A SHARED HEADER. DO NOT CHANGE CODING STYLE!!!
+ */
+
+#ifndef __JSM_TYPES_H
+#define __JSM_TYPES_H
+
+#ifndef TRUE
+# define TRUE 1
+#endif
+
+#ifndef FALSE
+# define FALSE 0
+#endif
+
+/* Required for our shared headers! */
+typedef unsigned char uchar;
+
+#endif

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [ patch 6/7] drivers/serial/jsm: new serial device driver
  2005-02-27 23:40 [ patch 6/7] drivers/serial/jsm: new serial device driver Wen Xiong
@ 2005-02-28  0:47 ` Jeff Garzik
  2005-02-28  3:22   ` Christoph Hellwig
  2005-02-28  0:56 ` Rik van Riel
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 21+ messages in thread
From: Jeff Garzik @ 2005-02-28  0:47 UTC (permalink / raw)
  To: Wen Xiong; +Cc: linux-kernel, linux-serial, Andrew Morton, Greg KH

Wen Xiong wrote:
> +struct rw_t {
> +	unsigned char	rw_req;		/* Request type			*/
> +	unsigned char	rw_board;	/* Host Adapter board number	*/
> +	unsigned char	rw_conc;	/* Concentrator number		*/
> +	unsigned char	rw_reserved;	/* Reserved for expansion	*/
> +	unsigned int	rw_addr;	/* Address in concentrator	*/
> +	unsigned short	rw_size;	/* Read/write request length	*/
> +	unsigned char	rw_data[128];	/* Data to read/write		*/
> +};

Invalid naming.  Linux kernel style is "struct foo" not "foo_t" nor 
"struct foo_t".

Also, "rw_t" is too short and ambiguous.


> +
> +/***********************************************************************
> + * Shrink Buffer and Board Information definitions and structures.
> +
> + ************************************************************************/
> +			/* Board type return codes */
> +#define	PCXI_TYPE 1	/* Board type at the designated port is a PC/Xi */
> +#define PCXM_TYPE 2	/* Board type at the designated port is a PC/Xm */
> +#define	PCXE_TYPE 3	/* Board type at the designated port is a PC/Xe */
> +#define	MCXI_TYPE 4	/* Board type at the designated port is a MC/Xi */
> +#define COMXI_TYPE 5	/* Board type at the designated port is a COM/Xi */
> +
> +			 /* Non-Zero Result codes. */
> +#define RESULT_NOBDFND 1 /* A Digi product at that port is not config installed */ 
> +#define RESULT_NODESCT 2 /* A memory descriptor was not obtainable */ 
> +#define RESULT_NOOSSIG 3 /* FEP/OS signature was not detected on the board */
> +#define RESULT_TOOSML  4 /* Too small an area to shrink.  */
> +#define RESULT_NOCHAN  5 /* Channel structure for the board was not found */
> +
> +struct shrink_buf_struct {
> +	unsigned int	shrink_buf_vaddr;	/* Virtual address of board */
> +	unsigned int	shrink_buf_phys;	/* Physical address of board */

Major bug.  These should be unsigned long.


> +	unsigned int	shrink_buf_bseg;	/* Amount of board memory */
> +	unsigned int	shrink_buf_hseg;	/* '186 Begining of Dual-Port */
> +
> +	unsigned int	shrink_buf_lseg;	/* '186 Begining of freed memory */ 
> +	unsigned int	shrink_buf_mseg;	/* Linear address from start of
> +						   dual-port were freed memory
> +						   begins, host viewpoint. */
> +
> +	unsigned int	shrink_buf_bdparam;	/* Parameter for xxmemon and
> +						   xxmemoff */
> +
> +	unsigned int	shrink_buf_reserva;	/* Reserved */
> +	unsigned int	shrink_buf_reservb;	/* Reserved */
> +	unsigned int	shrink_buf_reservc;	/* Reserved */
> +	unsigned int	shrink_buf_reservd;	/* Reserved */

why do these exist?


> +	unsigned char	shrink_buf_result;	/* Reason for call failing
> +						   Zero is Good return */
> +	unsigned char	shrink_buf_init;	/* Non-Zero if it caused an
> +						   xxinit call. */
> +
> +	unsigned char	shrink_buf_anports;	/* Number of async ports  */
> +	unsigned char	shrink_buf_snports; 	/* Number of sync  ports */
> +	unsigned char	shrink_buf_type;	/* Board type	1 = PC/Xi,
> +								2 = PC/Xm,
> +								3 = PC/Xe  
> +								4 = MC/Xi  
> +								5 = COMX/i */
> +	unsigned char	shrink_buf_card;	/* Card number */
> +	
> +};
> +
> +/************************************************************************
> + * Structure to get driver status information
> + ************************************************************************/
> +struct digi_dinfo {
> +	unsigned int	dinfo_nboards;		/* # boards configured	*/
> +	char		dinfo_reserved[12];	/* for future expansion */



> +	char		dinfo_version[16];	/* driver version	*/
> +};
> +
> +#define	DIGI_GETDD	('d'<<8) | 248		/* get driver info	*/
> + 
> +/************************************************************************
> + * Structure used with ioctl commands for per-board information
> + *
> + * physsize and memsize differ when board has "windowed" memory
> + ************************************************************************/
> +struct digi_info {
> +	unsigned int	info_bdnum;		/* Board number (0 based)  */
> +	unsigned int	info_ioport;		/* io port address	   */
> +	unsigned int	info_physaddr;		/* memory address	   */
> +	unsigned int	info_physsize;		/* Size of host mem window */
> +	unsigned int	info_memsize;		/* Amount of dual-port mem */
> +						/* on board		   */

Major bugs.  Use unsigned long for addresses.

Use "void __iomem *" for ioremap'd addresses.

> +
> +/*
> + * Driver identification, error and debugging statments
> + *
> + * In theory, you can change all occurances of "digi" in the next
> + * three lines, and the driver printk's will all automagically change.
> + *
> + * APR((fmt, args, ...));	Always prints message
> + * DPR((fmt, args, ...));	Only prints if JSM_TRACER is defined at
> + *				  compile time and jsm_debug!=0
> + *
> + * TRC_TO_CONSOLE:
> + *	Setting this to 1 will turn on some general function tracing
> + *	resulting in a bunch of extra debugging printks to the console
> + *
> + */
> +
> +#define	PROCSTR		"jsm"			/* /proc entries	 */
> +#define	DEVSTR		"/dev/dg/jsm"		/* /dev entries		 */

Never store pathnames in a kernel driver.



> +#define	DRVSTR		"jsm"			/* Driver name string 
> +						 * displayed by APR	 */
> +#define	APR(args)	do {printk(DRVSTR": "); printk args;} while (0)
> +
> +#define TRC_TO_CONSOLE	1
> +
> +/*
> + * Debugging levels can be set using debug insmod variable
> + * They can also be compiled out completely.
> + */
> +
> +#define	DBG_INIT		(jsm_debug & 0x01)
> +#define	DBG_BASIC		(jsm_debug & 0x02)
> +#define	DBG_CORE		(jsm_debug & 0x04)
> +
> +#define	DBG_OPEN		(jsm_debug & 0x08)
> +#define	DBG_CLOSE		(jsm_debug & 0x10)
> +#define	DBG_READ		(jsm_debug & 0x20)
> +#define	DBG_WRITE		(jsm_debug & 0x40)
> +
> +#define	DBG_IOCTL		(jsm_debug & 0x80)
> +
> +#define	DBG_PROC		(jsm_debug & 0x100)
> +#define	DBG_PARAM		(jsm_debug & 0x200)
> +#define	DBG_PSCAN		(jsm_debug & 0x400)
> +#define	DBG_EVENT		(jsm_debug & 0x800)
> +
> +#define	DBG_DRAIN		(jsm_debug & 0x1000)
> +#define	DBG_MSIGS		(jsm_debug & 0x2000)
> +
> +#define	DBG_MGMT		(jsm_debug & 0x4000)
> +#define	DBG_INTR		(jsm_debug & 0x8000)
> +
> +#define	DBG_CARR		(jsm_debug & 0x10000)
> +
> +#if TRC_TO_CONSOLE
> +#define PRINTF_TO_CONSOLE(args) { printk(DRVSTR": "); printk args; }
> +#else //!defined TRACE_TO_CONSOLE
> +#define PRINTF_TO_CONSOLE(args)
> +#endif
> +
> +#define	TRC(args)	{ PRINTF_TO_CONSOLE(args) }
> +
> +#define DPR_INIT(ARGS)		if (DBG_INIT) TRC(ARGS)
> +#define DPR_BASIC(ARGS)		if (DBG_BASIC) TRC(ARGS)
> +#define DPR_CORE(ARGS)		if (DBG_CORE) TRC(ARGS)
> +#define DPR_OPEN(ARGS)		if (DBG_OPEN)  TRC(ARGS)
> +#define DPR_CLOSE(ARGS)		if (DBG_CLOSE)  TRC(ARGS)
> +#define DPR_READ(ARGS)		if (DBG_READ)  TRC(ARGS)
> +#define DPR_WRITE(ARGS)		if (DBG_WRITE) TRC(ARGS)
> +#define DPR_IOCTL(ARGS)		if (DBG_IOCTL) TRC(ARGS)
> +#define DPR_PROC(ARGS)		if (DBG_PROC)  TRC(ARGS)
> +#define DPR_PARAM(ARGS)		if (DBG_PARAM)  TRC(ARGS)
> +#define DPR_PSCAN(ARGS)		if (DBG_PSCAN)  TRC(ARGS)
> +#define DPR_EVENT(ARGS)		if (DBG_EVENT)  TRC(ARGS)
> +#define DPR_DRAIN(ARGS)		if (DBG_DRAIN)  TRC(ARGS)
> +#define DPR_CARR(ARGS)		if (DBG_CARR)  TRC(ARGS)
> +#define DPR_MGMT(ARGS)		if (DBG_MGMT)  TRC(ARGS)
> +#define DPR_INTR(ARGS)		if (DBG_INTR)  TRC(ARGS)
> +#define DPR_MSIGS(ARGS)		if (DBG_MSIGS)  TRC(ARGS)
> +#define DPR(ARGS)		if (jsm_debug) TRC(ARGS)

encapsulate in "do { ... } while (0)"


> +
> +/* Number of boards we support at once. */
> +#define	MAXBOARDS	20
> +#define	MAXPORTS	8
> +#define MAXTTYNAMELEN	200
> +
> +/* Our 3 magic numbers for our board, channel and unit structs */
> +#define JSM_BOARD_MAGIC		0x5c6df104
> +#define JSM_CHANNEL_MAGIC	0x6c6df104
> +#define JSM_UNIT_MAGIC		0x7c6df104
> +
> +/* Serial port types */
> +#define JSM_SERIAL		0
> +
> +#define	SERIAL_TYPE_NORMAL	1
> +
> +#define PORT_NUM(dev)	((dev) & 0x7f)
> +#define IS_PRINT(dev)	(((dev) & 0xff) >= 0x80)
> +
> +/* MAX number of stop characters we will send when our read queue is getting full */
> +#define MAX_STOPS_SENT 5
> +
> +/* 4 extra for alignment play space */
> +#define WRITEBUFLEN		((4096) + 4)
> +#define MYFLIPLEN		N_TTY_BUF_SIZE
> +
> +#define jsm_jiffies_from_ms(a) (((a) * HZ) / 1000)
> +
> +/*
> + * Define a local default termios struct. All ports will be created
> + * with this termios initially.  This is the same structure that is defined
> + * as the default in tty_io.c with the same settings overriden as in serial.c
> + *
> + * In short, this should match the internal serial ports' defaults.
> + */
> +#define	DEFAULT_IFLAGS	(ICRNL | IXON)
> +#define	DEFAULT_OFLAGS	(OPOST | ONLCR)
> +#define	DEFAULT_CFLAGS	(B9600 | CS8 | CREAD | HUPCL | CLOCAL)
> +#define	DEFAULT_LFLAGS	(ISIG | ICANON | ECHO | ECHOE | ECHOK | \
> +			ECHOCTL | ECHOKE | IEXTEN)
> +
> +#ifndef _POSIX_VDISABLE
> +#define   _POSIX_VDISABLE '\0'
> +#endif
> +
> +#define SNIFF_MAX	65536		/* Sniff buffer size (2^n) */
> +#define SNIFF_MASK	(SNIFF_MAX - 1)	/* Sniff wrap mask */
> +
> +/*
> + * All the possible states the driver can be while being loaded.
> + */
> +enum {
> +	DRIVER_INITIALIZED = 0,
> +	DRIVER_READY
> +};
> +
> +/*
> + * All the possible states the board can be while booting up.
> + */
> +enum {
> +	BOARD_FAILED = 0,
> +	BOARD_FOUND,
> +	BOARD_READY
> +};
> +
> +
> +/*************************************************************************
> + *
> + * Structures and closely related defines.
> + *
> + *************************************************************************/
> +
> +struct board_t;
> +struct channel_t;
> +
> +/************************************************************************
> + * Per board operations structure					*
> + ************************************************************************/
> +struct board_ops {
> +	void (*tasklet) (unsigned long data);
> +	JSM_IRQRETURN_TYPE (*intr) (int irq, void *voidbrd, struct pt_regs *regs);
> +	void (*uart_init) (struct channel_t *ch);
> +	void (*uart_off) (struct channel_t *ch);
> +	int  (*drain) (struct tty_struct *tty, uint seconds);
> +	void (*param) (struct channel_t *ch);
> +	void (*assert_modem_signals) (struct channel_t *ch);
> +	void (*flush_uart_write) (struct channel_t *ch);
> +	void (*flush_uart_read) (struct channel_t *ch);
> +	void (*disable_receiver) (struct channel_t *ch);
> +	void (*enable_receiver) (struct channel_t *ch);
> +	void (*send_break) (struct channel_t *ch);
> +	void (*send_start_character) (struct channel_t *ch);
> +	void (*send_stop_character) (struct channel_t *ch);
> +	void (*copy_data_from_queue_to_uart) (struct channel_t *ch);
> +	uint (*get_uart_bytes_left) (struct channel_t *ch);
> +	void (*send_immediate_char) (struct channel_t *ch, unsigned char);
> +};
> +
> +
> +/*
> + *	Per-board information
> + */
> +struct board_t

style:  use "struct board" not "board_t" nor "struct board_t"


> +{
> +	int		magic;		/* Board Magic number.  */
> +	int		boardnum;	/* Board number: 0-32 */
> +
> +	int		type;		/* Type of board */
> +	char		*name;		/* Product Name */
> +	u16		vendor;		/* PCI vendor ID */
> +	u16		device;		/* PCI device ID */
> +	u16		subvendor;	/* PCI subsystem vendor ID */
> +	u16		subdevice;	/* PCI subsystem device ID */

do not store these; they are already in struct pci_dev


> +	uchar		rev;		/* PCI revision ID */
> +	uint		pci_bus;	/* PCI bus value */
> +	uint		pci_slot;	/* PCI slot value */

ditto


> +	struct pci_dev  *pci_dev;
> +	uint		maxports;	/* MAX ports this board can handle */
> +
> +	spinlock_t	bd_lock;	/* Used to protect board */
> +
> +	spinlock_t	bd_intr_lock;	/* Used to protect the poller tasklet and
> +					 * the interrupt routine from each other.
> +					 */
> +
> +	uint		state;		/* State of card. */
> +	wait_queue_head_t state_wait;	/* Place to sleep on for state change */
> +
> +	struct		tasklet_struct helper_tasklet; /* Poll helper tasklet */
> +
> +	uint		nasync;		/* Number of ports on card */
> +
> +	uint		irq;		/* Interrupt request number */
> +	ulong		intr_count;	/* Count of interrupts */
> +
> +	ulong		membase;	/* Start of base memory of the card */
> +	ulong		membase_end;	/* End of base memory of the card */
> +
> +	uchar		*re_map_membase;/* Remapped memory of the card */

mark '__iomem'


> +	ulong		iobase;		/* Start of io base of the card */
> +	ulong		iobase_end;	/* End of io base of the card */
> +
> +	uint		bd_uart_offset;	/* Space between each UART */
> +
> +	struct channel_t *channels[MAXPORTS]; /* array of pointers to our channels. */
> +
> +	struct tty_driver	SerialDriver;
> +	char		SerialName[200];
> +	struct tty_driver	PrintDriver;
> +	char		PrintName[200];
> +
> +	uint		jsm_Major_Serial_Registered;
> +	uint		jsm_Major_TransparentPrint_Registered;
> +
> +	uint		jsm_Serial_Major;
> +	uint		jsm_TransparentPrint_Major;
> +
> +	uint		TtyRefCnt;

style: eliminate StudlyCaps.  use "tty_ref_cnt" not "TtyRefCnt".

This is not C++.


> +	char		*flipbuf;	/* Our flip buffer, alloced if board is found */
> +
> +	u16		dpatype;	/* The board "type", as defined by DPA */
> +	u16		dpastatus;	/* The board "status", as defined by DPA */
> +
> +	uint		bd_dividend;	/* Board/UARTs specific dividend */
> +
> +	struct board_ops *bd_ops;
> +
> +	/* /proc/<board> entries */
> +	struct proc_dir_entry *proc_entry_pointer;
> +	struct jsm_proc_entry *jsm_board_table;
> +};
> +
> +
> +/************************************************************************ 
> + * Unit flag definitions for un_flags.
> + ************************************************************************/
> +#define UN_ISOPEN	0x0001		/* Device is open		*/
> +#define UN_CLOSING	0x0002		/* Line is being closed		*/
> +#define UN_IMM		0x0004		/* Service immediately		*/
> +#define UN_BUSY		0x0008		/* Some work this channel	*/
> +#define UN_BREAKI	0x0010		/* Input break received		*/
> +#define UN_PWAIT	0x0020		/* Printer waiting for terminal	*/
> +#define UN_TIME		0x0040		/* Waiting on time		*/
> +#define UN_EMPTY	0x0080		/* Waiting output queue empty	*/
> +#define UN_LOW		0x0100		/* Waiting output low water mark*/
> +#define UN_EXCL_OPEN	0x0200		/* Open for exclusive use	*/
> +#define UN_WOPEN	0x0400		/* Device waiting for open	*/
> +#define UN_WIOCTL	0x0800		/* Device waiting for open	*/
> +#define UN_HANGUP	0x8000		/* Carrier lost			*/
> +
> +
> +/************************************************************************
> + * Structure for terminal or printer unit. 
> + ************************************************************************/
> +struct un_t {
> +	int	magic;		/* Unit Magic Number.			*/
> +	struct	channel_t *un_ch;
> +	ulong	un_time;
> +	uint	un_type;
> +	uint	un_open_count;	/* Counter of opens to port		*/
> +	struct tty_struct *un_tty;/* Pointer to unit tty structure	*/
> +	uint	un_flags;	/* Unit flags				*/
> +	wait_queue_head_t un_flags_wait; /* Place to sleep to wait on unit */
> +	uint	un_dev;		/* Minor device number			*/
> +};
> +
> +
> +/************************************************************************ 
> + * Device flag definitions for ch_flags.
> + ************************************************************************/
> +#define CH_PRON		0x0001		/* Printer on string		*/
> +#define CH_STOP		0x0002		/* Output is stopped		*/
> +#define CH_STOPI	0x0004		/* Input is stopped		*/
> +#define CH_CD		0x0008		/* Carrier is present		*/
> +#define CH_FCAR		0x0010		/* Carrier forced on		*/
> +#define CH_HANGUP	0x0020		/* Hangup received		*/
> +
> +#define CH_RECEIVER_OFF	0x0040		/* Receiver is off		*/
> +#define CH_OPENING	0x0080		/* Port in fragile open state	*/
> +#define CH_CLOSING	0x0100		/* Port in fragile close state	*/
> +#define CH_FIFO_ENABLED 0x0200		/* Port has FIFOs enabled	*/
> +#define CH_TX_FIFO_EMPTY 0x0400		/* TX Fifo is completely empty	*/
> +#define CH_TX_FIFO_LWM  0x0800		/* TX Fifo is below Low Water	*/
> +#define CH_BREAK_SENDING 0x1000		/* Break is being sent		*/
> +#define CH_LOOPBACK 0x2000		/* Channel is in lookback mode	*/
> +#define CH_FLIPBUF_IN_USE 0x4000	/* Channel's flipbuf is in use	*/
> +#define CH_BAUD0	0x08000		/* Used for checking B0 transitions */
> +
> +/*
> + * Definitions for ch_sniff_flags
> + */
> +#define SNIFF_OPEN	0x1
> +#define SNIFF_WAIT_DATA	0x2
> +#define SNIFF_WAIT_SPACE 0x4
> +
> +
> +/* Our Read/Error/Write queue sizes */
> +#define RQUEUEMASK	0x1FFF		/* 8 K - 1 */
> +#define EQUEUEMASK	0x1FFF		/* 8 K - 1 */
> +#define WQUEUEMASK	0x0FFF		/* 4 K - 1 */
> +#define RQUEUESIZE	(RQUEUEMASK + 1)
> +#define EQUEUESIZE	RQUEUESIZE
> +#define WQUEUESIZE	(WQUEUEMASK + 1)
> +
> +
> +/************************************************************************ 
> + * Channel information structure.
> + ************************************************************************/
> +struct channel_t {
> +	struct uart_port uart_port;
> +	int magic;			/* Channel Magic Number		*/
> +	struct board_t	*ch_bd;		/* Board structure pointer	*/
> +	struct un_t	ch_tun;		/* Terminal unit info		*/
> +	struct un_t	ch_pun;		/* Printer unit info		*/
> +
> +	spinlock_t	ch_lock;	/* provide for serialization */
> +	wait_queue_head_t ch_flags_wait;
> +
> +	uint		ch_portnum;	/* Port number, 0 offset.	*/
> +	uint		ch_open_count;	/* open count			*/
> +	uint		ch_flags;	/* Channel flags		*/
> +
> +	ulong		ch_close_delay;	/* How long we should drop RTS/DTR for */
> +
> +	ulong		ch_cpstime;	/* Time for CPS calculations	*/
> +
> +	tcflag_t	ch_c_iflag;	/* channel iflags		*/
> +	tcflag_t	ch_c_cflag;	/* channel cflags		*/
> +	tcflag_t	ch_c_oflag;	/* channel oflags		*/
> +	tcflag_t	ch_c_lflag;	/* channel lflags		*/
> +	uchar		ch_stopc;	/* Stop character		*/
> +	uchar		ch_startc;	/* Start character		*/
> +
> +	uint		ch_old_baud;	/* Cache of the current baud */
> +	uint		ch_custom_speed;/* Custom baud, if set */
> +
> +	uint		ch_wopen;	/* Waiting for open process cnt */
> +
> +	uchar		ch_mostat;	/* FEP output modem status	*/
> +	uchar		ch_mistat;	/* FEP input modem status	*/
> +
> +	struct neo_uart_struct *ch_neo_uart;	/* Pointer to the "mapped" UART struct */
> +	uchar		ch_cached_lsr;	/* Cached value of the LSR register */
> +
> +	uchar		*ch_rqueue;	/* Our read queue buffer - malloc'ed */
> +	ushort		ch_r_head;	/* Head location of the read queue */
> +	ushort		ch_r_tail;	/* Tail location of the read queue */
> +
> +	uchar		*ch_equeue;	/* Our error queue buffer - malloc'ed */
> +	ushort		ch_e_head;	/* Head location of the error queue */
> +	ushort		ch_e_tail;	/* Tail location of the error queue */
> +
> +	uchar		*ch_wqueue;	/* Our write queue buffer - malloc'ed */
> +	ushort		ch_w_head;	/* Head location of the write queue */
> +	ushort		ch_w_tail;	/* Tail location of the write queue */
> +
> +	ulong		ch_rxcount;	/* total of data received so far */
> +	ulong		ch_txcount;	/* total of data transmitted so far */
> +
> +	uchar		ch_r_tlevel;	/* Receive Trigger level */
> +	uchar		ch_t_tlevel;	/* Transmit Trigger level */
> +
> +	uchar		ch_r_watermark;	/* Receive Watermark */
> +
> +
> +	uint		ch_stops_sent;	/* How many times I have sent a stop character
> +					 * to try to stop the other guy sending.
> +					 */
> +	ulong		ch_err_parity;	/* Count of parity errors on channel */
> +	ulong		ch_err_frame;	/* Count of framing errors on channel */
> +	ulong		ch_err_break;	/* Count of breaks on channel */
> +	ulong		ch_err_overrun; /* Count of overruns on channel */
> +
> +	ulong		ch_xon_sends;	/* Count of xons transmitted */
> +	ulong		ch_xoff_sends;	/* Count of xoffs transmitted */
> +
> +	/* /proc/<board>/<channel> entries */
> +	struct proc_dir_entry *proc_entry_pointer;
> +	struct jsm_proc_entry *jsm_channel_table;
> +
> +	uint ch_sniff_in;
> +	uint ch_sniff_out;
> +	char *ch_sniff_buf;		/* Sniff buffer for proc */
> +	ulong ch_sniff_flags;		/* Channel flags	*/
> +	wait_queue_head_t ch_sniff_wait;
> +};
> +
> +
> +
> +/*************************************************************************
> + *
> + * Prototypes for non-static functions used in more than one module
> + *
> + *************************************************************************/
> +
> +extern void	*jsm_driver_kzmalloc(size_t size, int priority);
> +extern char	*jsm_ioctl_name(int cmd);
> +
> +/*
> + * Our Global Variables.
> + */
> +
> +extern struct uart_driver jsm_uart_driver;
> +
> +extern  int		jsm_driver_state;	/* The state of the driver	*/
> +extern  uint		jsm_Major;		/* Our driver/mgmt major	*/
> +extern  int		jsm_debug;		/* Debug variable		*/
> +extern  int		jsm_rawreadok;		/* Set if user wants rawreads	*/
> +extern  int		jsm_trcbuf_size;	/* Size of the ringbuffer	*/
> +extern  spinlock_t	jsm_global_lock;	/* Driver global spinlock	*/
> +extern  uint		jsm_NumBoards;		/* Total number of boards	*/
> +extern  struct board_t	*jsm_Board[MAXBOARDS];	/* Array of board structs	*/
> +extern  ulong		jsm_poll_counter;	/* Times the poller has run	*/
> +extern  char		*jsm_state_text[];	/* Array of state text		*/
> +extern  char		*jsm_driver_state_text[];/* Array of driver state text */
> +
> +
> +void jsm_proc_register_basic_prescan(void);
> +int jsm_proc_register_basic_postscan(int board_num);
> +void jsm_proc_unregister_all(void);
> +void jsm_proc_unregister_brd(int board_num);
> +
> +#endif
> diff -Nuar linux-2.6.9.orig/drivers/serial/jsm/jsm_kcompat.h linux-2.6.9.new/drivers/serial/jsm/jsm_kcompat.h
> --- linux-2.6.9.orig/drivers/serial/jsm/jsm_kcompat.h	1969-12-31 18:00:00.000000000 -0600
> +++ linux-2.6.9.new/drivers/serial/jsm/jsm_kcompat.h	2005-02-27 17:14:44.747952016 -0600
> @@ -0,0 +1,46 @@
> +/*
> + * Copyright 2004 Digi International (www.digi.com)
> + *      Scott H Kilau <Scott_Kilau at digi dot com>
> + *
> + * This program is free software; you can redistribute it and/or modify
> + * it under the terms of the GNU General Public License as published by
> + * the Free Software Foundation; either version 2, or (at your option)
> + * any later version.
> + *
> + * This program is distributed in the hope that it will be useful,
> + * but WITHOUT ANY WARRANTY, EXPRESS OR IMPLIED; without even the
> + * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
> + * PURPOSE.  See the GNU General Public License for more details.
> + *
> + * You should have received a copy of the GNU General Public License
> + * along with this program; if not, write to the Free Software
> + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
> + *
> + *	NOTE: THIS IS A SHARED HEADER. DO NOT CHANGE CODING STYLE!!!
> + *
> + *************************************************************************
> + *
> + * This file is intended to contain all the kernel "differences" between the
> + * various kernels that we support.
> + *
> + *************************************************************************/
> +
> +#ifndef __JSM_KCOMPAT_H
> +#define __JSM_KCOMPAT_H
> +
> +# define JSM_MAJOR(x)			(imajor(x))
> +# define JSM_MINOR(x)			(iminor(x))
> +# define JSM_TTY_MAJOR(tty)		(MAJOR(tty_devnum(tty)))
> +# define JSM_TTY_MINOR(tty)		(MINOR(tty_devnum(tty)))
> +
> +# define JSM_MOD_INC_USE_COUNT(rtn)	(rtn = 1)
> +# define JSM_MOD_DEC_USE_COUNT		
> +
> +# define JSM_IRQRETURN_TYPE		irqreturn_t
> +# define JSM_IRQ_RETURN(x)		return x;
> +
> +# define PARM_GEN_IP			(PDE(file->f_dentry->d_inode))
> +
> +# define JSM_GET_TTY_COUNT(x)		(x->count)
> +
> +#endif /* ! __JSM_KCOMPAT_H */
> diff -Nuar linux-2.6.9.orig/drivers/serial/jsm/jsm_mgmt.h linux-2.6.9.new/drivers/serial/jsm/jsm_mgmt.h
> --- linux-2.6.9.orig/drivers/serial/jsm/jsm_mgmt.h	1969-12-31 18:00:00.000000000 -0600
> +++ linux-2.6.9.new/drivers/serial/jsm/jsm_mgmt.h	2005-02-27 17:14:44.747952016 -0600
> @@ -0,0 +1,32 @@
> +/*
> + * Copyright 2003 Digi International (www.digi.com)
> + *	Scott H Kilau <Scott_Kilau at digi dot com>
> + *
> + * This program is free software; you can redistribute it and/or modify
> + * it under the terms of the GNU General Public License as published by
> + * the Free Software Foundation; either version 2, or (at your option)
> + * any later version.
> + *
> + * This program is distributed in the hope that it will be useful,
> + * but WITHOUT ANY WARRANTY, EXPRESS OR IMPLIED; without even the
> + * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
> + * PURPOSE.  See the GNU General Public License for more details.
> + *
> + * You should have received a copy of the GNU General Public License
> + * along with this program; if not, write to the Free Software
> + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
> + *
> + *	NOTE: THIS IS A SHARED HEADER. DO NOT CHANGE CODING STYLE!!!
> + */
> +
> +#ifndef __JSM_MGMT_H
> +#define __JSM_MGMT_H
> +
> +#define MAXMGMTDEVICES 8
> +
> +int jsm_mgmt_open(struct inode *inode, struct file *file);
> +int jsm_mgmt_close(struct inode *inode, struct file *file);
> +int jsm_mgmt_ioctl(struct inode *inode, struct file *file, unsigned int cmd, unsigned long arg);
> +
> +#endif
> +
> diff -Nuar linux-2.6.9.orig/drivers/serial/jsm/jsm_neo.h linux-2.6.9.new/drivers/serial/jsm/jsm_neo.h
> --- linux-2.6.9.orig/drivers/serial/jsm/jsm_neo.h	1969-12-31 18:00:00.000000000 -0600
> +++ linux-2.6.9.new/drivers/serial/jsm/jsm_neo.h	2005-02-27 17:14:44.748951864 -0600
> @@ -0,0 +1,143 @@
> +/*
> + * Copyright 2003 Digi International (www.digi.com)
> + *	Scott H Kilau <Scott_Kilau at digi dot com>
> + *
> + * This program is free software; you can redistribute it and/or modify
> + * it under the terms of the GNU General Public License as published by
> + * the Free Software Foundation; either version 2, or (at your option)
> + * any later version.
> + *
> + * This program is distributed in the hope that it will be useful,
> + * but WITHOUT ANY WARRANTY, EXPRESS OR IMPLIED; without even the
> + * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
> + * PURPOSE.  See the GNU General Public License for more details.
> + *
> + * You should have received a copy of the GNU General Public License
> + * along with this program; if not, write to the Free Software
> + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
> + *
> + *	NOTE: THIS IS A SHARED HEADER. DO NOT CHANGE CODING STYLE!!!
> + *
> + */
> +
> +#ifndef __JSM_NEO_H
> +#define __JSM_NEO_H
> +
> +#include "jsm_types.h"
> +#include "jsm_driver.h"
> +
> +/************************************************************************ 
> + * Per channel/port NEO UART structure					*
> + ************************************************************************
> + *		Base Structure Entries Usage Meanings to Host		*
> + *									*
> + *	W = read write		R = read only				* 
> + *			U = Unused.					*
> + ************************************************************************/
> +
> +struct neo_uart_struct {
> +	volatile uchar txrx;		/* WR  RHR/THR - Holding Reg */
> +	volatile uchar ier;		/* WR  IER - Interrupt Enable Reg */
> +	volatile uchar isr_fcr;		/* WR  ISR/FCR - Interrupt Status Reg/Fifo Control Reg */
> +	volatile uchar lcr;		/* WR  LCR - Line Control Reg */
> +	volatile uchar mcr;		/* WR  MCR - Modem Control Reg */
> +	volatile uchar lsr;		/* WR  LSR - Line Status Reg */
> +	volatile uchar msr;		/* WR  MSR - Modem Status Reg */
> +	volatile uchar spr;		/* WR  SPR - Scratch Pad Reg */
> +	volatile uchar fctr;		/* WR  FCTR - Feature Control Reg */
> +	volatile uchar efr;		/* WR  EFR - Enhanced Function Reg */
> +	volatile uchar tfifo;		/* WR  TXCNT/TXTRG - Transmit FIFO Reg */	
> +	volatile uchar rfifo;		/* WR  RXCNT/RXTRG - Recieve  FIFO Reg */
> +	volatile uchar xoffchar1;	/* WR  XOFF 1 - XOff Character 1 Reg */
> +	volatile uchar xoffchar2;	/* WR  XOFF 2 - XOff Character 2 Reg */
> +	volatile uchar xonchar1;	/* WR  XON 1 - Xon Character 1 Reg */
> +	volatile uchar xonchar2;	/* WR  XON 2 - XOn Character 2 Reg */
> +
> +	volatile uchar reserved1[0x2ff - 0x200]; /* U   Reserved by Exar */
> +	volatile uchar txrxburst[64];	/* RW  64 bytes of RX/TX FIFO Data */
> +	volatile uchar reserved2[0x37f - 0x340]; /* U   Reserved by Exar */
> +	volatile uchar rxburst_with_errors[64];	/* R  64 bytes of RX FIFO Data + LSR */
> +};

eliminate all use of 'volatile', as mentioned in another message.


> +/* Where to read the extended interrupt register (32bits instead of 8bits) */
> +#define	UART_17158_POLL_ADDR_OFFSET	0x80
> +
> +
> +/*
> + * These are the redefinitions for the FCTR on the XR17C158, since
> + * Exar made them different than their earlier design. (XR16C854)
> + */
> +
> +/* These are only applicable when table D is selected */
> +#define UART_17158_FCTR_RTS_NODELAY	0x00
> +#define UART_17158_FCTR_RTS_4DELAY	0x01
> +#define UART_17158_FCTR_RTS_6DELAY	0x02
> +#define UART_17158_FCTR_RTS_8DELAY	0x03
> +#define UART_17158_FCTR_RTS_12DELAY	0x12
> +#define UART_17158_FCTR_RTS_16DELAY	0x05
> +#define UART_17158_FCTR_RTS_20DELAY	0x13
> +#define UART_17158_FCTR_RTS_24DELAY	0x06
> +#define UART_17158_FCTR_RTS_28DELAY	0x14
> +#define UART_17158_FCTR_RTS_32DELAY	0x07
> +#define UART_17158_FCTR_RTS_36DELAY	0x16
> +#define UART_17158_FCTR_RTS_40DELAY	0x08
> +#define UART_17158_FCTR_RTS_44DELAY	0x09
> +#define UART_17158_FCTR_RTS_48DELAY	0x10
> +#define UART_17158_FCTR_RTS_52DELAY	0x11
> +
> +#define UART_17158_FCTR_RTS_IRDA	0x10
> +#define UART_17158_FCTR_RS485		0x20
> +#define UART_17158_FCTR_TRGA		0x00
> +#define UART_17158_FCTR_TRGB		0x40
> +#define UART_17158_FCTR_TRGC		0x80
> +#define UART_17158_FCTR_TRGD		0xC0
> +
> +/* 17158 trigger table selects.. */
> +#define UART_17158_FCTR_BIT6		0x40
> +#define UART_17158_FCTR_BIT7		0x80
> +
> +/* 17158 TX/RX memmapped buffer offsets */
> +#define UART_17158_RX_FIFOSIZE		64  
> +#define UART_17158_TX_FIFOSIZE		64  
> +
> +/* 17158 Extended IIR's */
> +#define UART_17158_IIR_RDI_TIMEOUT	0x0C	/* Receiver data TIMEOUT */
> +#define UART_17158_IIR_XONXOFF		0x10	/* Received an XON/XOFF char */
> +#define UART_17158_IIR_HWFLOW_STATE_CHANGE 0x20	/* CTS/DSR or RTS/DTR state change */
> +#define UART_17158_IIR_FIFO_ENABLED	0xC0	/* 16550 FIFOs are Enabled */
> +
> +/*
> + * These are the extended interrupts that get sent
> + * back to us from the UART's 32bit interrupt register
> + */
> +#define UART_17158_RX_LINE_STATUS	0x1	/* RX Ready */
> +#define UART_17158_RXRDY_TIMEOUT	0x2	/* RX Ready Timeout */
> +#define UART_17158_TXRDY		0x3	/* TX Ready */
> +#define UART_17158_MSR			0x4	/* Modem State Change */
> +#define UART_17158_TX_AND_FIFO_CLR	0x40	/* Transmitter Holding Reg Empty */
> +#define UART_17158_RX_FIFO_DATA_ERROR	0x80	/* UART detected an RX FIFO Data error */
> +
> +/*
> + * These are the EXTENDED definitions for the 17C158's Interrupt
> + * Enable Register.
> + */
> +#define UART_17158_EFR_ECB	0x10	/* Enhanced control bit */
> +#define UART_17158_EFR_IXON	0x2	/* Receiver compares Xon1/Xoff1 */
> +#define UART_17158_EFR_IXOFF	0x8	/* Transmit Xon1/Xoff1 */
> +#define UART_17158_EFR_RTSDTR	0x40	/* Auto RTS/DTR Flow Control Enable */
> +#define UART_17158_EFR_CTSDSR	0x80	/* Auto CTS/DSR Flow COntrol Enable */
> +
> +#define UART_17158_XOFF_DETECT	0x1	/* Indicates whether chip saw an incoming XOFF char  */
> +#define UART_17158_XON_DETECT	0x2	/* Indicates whether chip saw an incoming XON char */
> +
> +#define UART_17158_IER_RSVD1	0x10	/* Reserved by Exar */
> +#define UART_17158_IER_XOFF	0x20	/* Xoff Interrupt Enable */
> +#define UART_17158_IER_RTSDTR	0x40	/* Output Interrupt Enable */
> +#define UART_17158_IER_CTSDSR	0x80	/* Input Interrupt Enable */
> +
> +/*
> + * Our Global Variables
> + */
> +extern struct board_ops jsm_neo_ops;
> +
> +#endif
> diff -Nuar linux-2.6.9.orig/drivers/serial/jsm/jsm_pci.h linux-2.6.9.new/drivers/serial/jsm/jsm_pci.h
> --- linux-2.6.9.orig/drivers/serial/jsm/jsm_pci.h	1969-12-31 18:00:00.000000000 -0600
> +++ linux-2.6.9.new/drivers/serial/jsm/jsm_pci.h	2005-02-27 17:14:44.748951864 -0600
> @@ -0,0 +1,59 @@
> +/*
> + * Copyright 2003 Digi International (www.digi.com)
> + *	Scott H Kilau <Scott_Kilau at digi dot com>
> + *
> + * This program is free software; you can redistribute it and/or modify
> + * it under the terms of the GNU General Public License as published by
> + * the Free Software Foundation; either version 2, or (at your option)
> + * any later version.
> + *
> + * This program is distributed in the hope that it will be useful,
> + * but WITHOUT ANY WARRANTY, EXPRESS OR IMPLIED; without even the
> + * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
> + * PURPOSE.  See the GNU General Public License for more details.
> + *
> + * You should have received a copy of the GNU General Public License
> + * along with this program; if not, write to the Free Software
> + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
> + *
> + *	NOTE: THIS IS A SHARED HEADER. DO NOT CHANGE CODING STYLE!!!
> + */
> +
> +/* $Id: jsm_pci.h,v 1.4 2004/01/06 16:44:49 scottk Exp $ */
> +
> +#ifndef __DGAP_PCI_H
> +#define __DGAP_PCI_H
> +
> +#define PCIMAX 32			/* maximum number of PCI boards */
> +
> +#define DIGI_VID				0x114F
> +
> +#define PCI_DEVICE_NEO_4_DID			0x00B0
> +#define PCI_DEVICE_NEO_8_DID			0x00B1
> +#define PCI_DEVICE_NEO_2DB9_DID			0x00C8
> +#define PCI_DEVICE_NEO_2DB9PRI_DID		0x00C9
> +#define PCI_DEVICE_NEO_2RJ45_DID		0x00CA
> +#define PCI_DEVICE_NEO_2RJ45PRI_DID		0x00CB
> +#define PCI_DEVICE_NEO_1_422_DID		0x00CC
> +#define PCI_DEVICE_NEO_1_422_485_DID		0x00CD
> +#define PCI_DEVICE_NEO_2_422_485_DID		0x00CE

belongs in pci_ids.h



> +#define PCI_DEVICE_NEO_4_PCI_NAME		"Neo 4 PCI"
> +#define PCI_DEVICE_NEO_8_PCI_NAME		"Neo 8 PCI"
> +#define PCI_DEVICE_NEO_2DB9_PCI_NAME		"Neo 2 - DB9 Universal PCI"
> +#define PCI_DEVICE_NEO_2DB9PRI_PCI_NAME		"Neo 2 - DB9 Universal PCI - Powered Ring Indicator"
> +#define PCI_DEVICE_NEO_2RJ45_PCI_NAME		"Neo 2 - RJ45 Universal PCI"
> +#define PCI_DEVICE_NEO_2RJ45PRI_PCI_NAME	"Neo 2 - RJ45 Universal PCI - Powered Ring Indicator"
> +#define PCI_DEVICE_NEO_1_422_PCI_NAME		"Neo 1 422 PCI"
> +#define PCI_DEVICE_NEO_1_422_485_PCI_NAME	"Neo 1 422/485 PCI"
> +#define PCI_DEVICE_NEO_2_422_485_PCI_NAME	"Neo 2 422/485 PCI"
> +
> +
> +/* Size of Memory and I/O for PCI (4 K) */
> +#define PCI_RAM_SIZE				0x1000
> +
> +/* Size of Memory (2MB) */
> +#define PCI_MEM_SIZE				0x1000
> +
> +#endif
> diff -Nuar linux-2.6.9.orig/drivers/serial/jsm/jsm_tty.h linux-2.6.9.new/drivers/serial/jsm/jsm_tty.h
> --- linux-2.6.9.orig/drivers/serial/jsm/jsm_tty.h	1969-12-31 18:00:00.000000000 -0600
> +++ linux-2.6.9.new/drivers/serial/jsm/jsm_tty.h	2005-02-27 17:14:44.748951864 -0600
> @@ -0,0 +1,44 @@
> +/*
> + * Copyright 2003 Digi International (www.digi.com)
> + *	Scott H Kilau <Scott_Kilau at digi dot com>
> + *
> + * This program is free software; you can redistribute it and/or modify
> + * it under the terms of the GNU General Public License as published by
> + * the Free Software Foundation; either version 2, or (at your option)
> + * any later version.
> + *
> + * This program is distributed in the hope that it will be useful,
> + * but WITHOUT ANY WARRANTY, EXPRESS OR IMPLIED; without even the
> + * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
> + * PURPOSE.  See the GNU General Public License for more details.
> + *
> + * You should have received a copy of the GNU General Public License
> + * along with this program; if not, write to the Free Software
> + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
> + *
> + *	NOTE: THIS IS A SHARED HEADER. DO NOT CHANGE CODING STYLE!!!
> + */
> +
> +#ifndef __JSM_TTY_H
> +#define __JSM_TTY_H
> +
> +#include "jsm_driver.h"
> +
> +int	jsm_tty_write(struct uart_port *port);
> +int	jsm_tty_register(struct board_t *brd);
> +
> +int	jsm_tty_init(struct board_t *);
> +int	jsm_uart_port_init(struct board_t *);
> +int	jsm_remove_uart_port(struct board_t *);
> +
> +void	jsm_tty_uninit(struct board_t *);
> +
> +void	jsm_input(struct channel_t *ch);
> +void	jsm_carrier(struct channel_t *ch);
> +void	jsm_check_queue_flow_control(struct channel_t *ch);
> +void	neo_clear_break(struct channel_t *ch, int force);
> +
> +
> +void	jsm_sniff_nowait_nolock(struct channel_t *ch, uchar *text, uchar *buf, int nbuf);
> +
> +#endif
> diff -Nuar linux-2.6.9.orig/drivers/serial/jsm/jsm_types.h linux-2.6.9.new/drivers/serial/jsm/jsm_types.h
> --- linux-2.6.9.orig/drivers/serial/jsm/jsm_types.h	1969-12-31 18:00:00.000000000 -0600
> +++ linux-2.6.9.new/drivers/serial/jsm/jsm_types.h	2005-02-27 17:14:44.749951712 -0600
> @@ -0,0 +1,36 @@
> +/*
> + * Copyright 2003 Digi International (www.digi.com)
> + *	Scott H Kilau <Scott_Kilau at digi dot com>
> + *
> + * This program is free software; you can redistribute it and/or modify
> + * it under the terms of the GNU General Public License as published by
> + * the Free Software Foundation; either version 2, or (at your option)
> + * any later version.
> + *
> + * This program is distributed in the hope that it will be useful,
> + * but WITHOUT ANY WARRANTY, EXPRESS OR IMPLIED; without even the
> + * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
> + * PURPOSE.  See the GNU General Public License for more details.
> + *
> + * You should have received a copy of the GNU General Public License
> + * along with this program; if not, write to the Free Software
> + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
> + *
> + *	NOTE: THIS IS A SHARED HEADER. DO NOT CHANGE CODING STYLE!!!
> + */
> +
> +#ifndef __JSM_TYPES_H
> +#define __JSM_TYPES_H
> +
> +#ifndef TRUE
> +# define TRUE 1
> +#endif
> +
> +#ifndef FALSE
> +# define FALSE 0
> +#endif
> +
> +/* Required for our shared headers! */
> +typedef unsigned char uchar;

eliminate this entire file

	Jeff



^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [ patch 6/7] drivers/serial/jsm: new serial device driver
  2005-02-27 23:40 [ patch 6/7] drivers/serial/jsm: new serial device driver Wen Xiong
  2005-02-28  0:47 ` Jeff Garzik
@ 2005-02-28  0:56 ` Rik van Riel
  2005-02-28  1:45 ` Nish Aravamudan
  2005-02-28  6:55 ` Greg KH
  3 siblings, 0 replies; 21+ messages in thread
From: Rik van Riel @ 2005-02-28  0:56 UTC (permalink / raw)
  To: Wen Xiong; +Cc: linux-kernel, linux-serial

On Sun, 27 Feb 2005, Wen Xiong wrote:

> This patch is all headers for this device driver.
> 
> Signed-off-by: Wen Xiong <wendyx@us.ltcfwd.linux.ibm.com>

+++ linux-2.6.9.new/drivers/serial/jsm/digi.h   2005-02-27
17:14:44.746952168 -0600
@@ -0,0 +1,416 @@
+/*
+ * Copyright 2003 Digi International (www.digi.com)
+ *     Scott H Kilau <Scott_Kilau at digi dot com>
+ *

Not signed off by the copyright holder.  Not sure how
much of a problem this is, but something to think about.

-- 
"Debugging is twice as hard as writing the code in the first place.
Therefore, if you write the code as cleverly as possible, you are,
by definition, not smart enough to debug it." - Brian W. Kernighan

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [ patch 6/7] drivers/serial/jsm: new serial device driver
  2005-02-27 23:40 [ patch 6/7] drivers/serial/jsm: new serial device driver Wen Xiong
  2005-02-28  0:47 ` Jeff Garzik
  2005-02-28  0:56 ` Rik van Riel
@ 2005-02-28  1:45 ` Nish Aravamudan
  2005-02-28  6:55 ` Greg KH
  3 siblings, 0 replies; 21+ messages in thread
From: Nish Aravamudan @ 2005-02-28  1:45 UTC (permalink / raw)
  To: Wen Xiong; +Cc: linux-kernel, linux-serial

> diff -Nuar linux-2.6.9.orig/drivers/serial/jsm/jsm_driver.h linux-2.6.9.new/drivers/serial/jsm/jsm_driver.h
> --- linux-2.6.9.orig/drivers/serial/jsm/jsm_driver.h    1969-12-31 18:00:00.000000000 -0600
> +++ linux-2.6.9.new/drivers/serial/jsm/jsm_driver.h     2005-02-27 17:14:44.747952016 -0600

<snip>

> +#define jsm_jiffies_from_ms(a) (((a) * HZ) / 1000)

Please use the existing msecs_to_jiffies(), which has both a more
sensible name and is correct.

Thanks,
Nish

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [ patch 6/7] drivers/serial/jsm: new serial device driver
  2005-02-28  0:47 ` Jeff Garzik
@ 2005-02-28  3:22   ` Christoph Hellwig
  0 siblings, 0 replies; 21+ messages in thread
From: Christoph Hellwig @ 2005-02-28  3:22 UTC (permalink / raw)
  To: Jeff Garzik; +Cc: Wen Xiong, linux-kernel, linux-serial, Andrew Morton, Greg KH

On Sun, Feb 27, 2005 at 07:47:58PM -0500, Jeff Garzik wrote:
> >+struct shrink_buf_struct {
> >+	unsigned int	shrink_buf_vaddr;	/* Virtual address of board 
> >*/
> >+	unsigned int	shrink_buf_phys;	/* Physical address of board 
> >*/
> 
> Major bug.  These should be unsigned long.

not sure what they actually mean, but a virtual address should be
a void * and drivers shouldn't ever mess with physical addresses.


^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [ patch 6/7] drivers/serial/jsm: new serial device driver
  2005-02-27 23:40 [ patch 6/7] drivers/serial/jsm: new serial device driver Wen Xiong
                   ` (2 preceding siblings ...)
  2005-02-28  1:45 ` Nish Aravamudan
@ 2005-02-28  6:55 ` Greg KH
  2005-03-04 21:08   ` Wen Xiong
  3 siblings, 1 reply; 21+ messages in thread
From: Greg KH @ 2005-02-28  6:55 UTC (permalink / raw)
  To: Wen Xiong; +Cc: linux-kernel, linux-serial

On Sun, Feb 27, 2005 at 06:40:20PM -0500, Wen Xiong wrote:
> 
> diff -Nuar linux-2.6.9.orig/drivers/serial/jsm/digi.h linux-2.6.9.new/drivers/serial/jsm/digi.h

Oh, and please diff against at least the latest kernel release, 2.6.9 is
old...


> + * $Id: digi.h,v 1.7 2004/09/23 16:08:30 scottk Exp $
> + *
> + *	NOTE: THIS IS A SHARED HEADER. DO NOT CHANGE CODING STYLE!!!

Not true anymore, right?

> +/************************************************************************
> + * Structure to get driver status information
> + ************************************************************************/
> +struct digi_dinfo {
> +	unsigned int	dinfo_nboards;		/* # boards configured	*/
> +	char		dinfo_reserved[12];	/* for future expansion */
> +	char		dinfo_version[16];	/* driver version	*/
> +};
> +
> +#define	DIGI_GETDD	('d'<<8) | 248		/* get driver info	*/

All structures that are passed accross the ioctl interface, MUST use the
__u8, __u16, __u32, and friend definitions.  unsigned int is not
allowed.

And why have all of these ioctls?  Shouldn't most of this stuff be
availble in sysfs instead?

> +#ifndef __JSM_DRIVER_H
> +#define __JSM_DRIVER_H
> +
> +#include <linux/types.h>	/* To pick up the varions Linux types */
> +#include <linux/tty.h>		/* To pick up the various tty structs/defines */
> +#include <linux/serial_core.h>
> +#include <linux/interrupt.h>	/* For irqreturn_t type */
> +#include <linux/module.h>	/* For irqreturn_t type */

That comment is incorrect.

> +/*
> + * Driver identification, error and debugging statments
> + *
> + * In theory, you can change all occurances of "digi" in the next
> + * three lines, and the driver printk's will all automagically change.
> + *
> + * APR((fmt, args, ...));	Always prints message
> + * DPR((fmt, args, ...));	Only prints if JSM_TRACER is defined at
> + *				  compile time and jsm_debug!=0
> + *
> + * TRC_TO_CONSOLE:
> + *	Setting this to 1 will turn on some general function tracing
> + *	resulting in a bunch of extra debugging printks to the console
> + *
> + */
> +
> +#define	PROCSTR		"jsm"			/* /proc entries	 */
> +#define	DEVSTR		"/dev/dg/jsm"		/* /dev entries		 */
> +#define	DRVSTR		"jsm"			/* Driver name string 
> +						 * displayed by APR	 */
> +#define	APR(args)	do {printk(DRVSTR": "); printk args;} while (0)

Ick.  You _must_ use a KERN_ level for a printk, this is not allowed.
Please use the dev_printk and helper functions instead.  It's not ok to
create new functions like this.

And again, what's with the double (( when you use this macro?

> +#if TRC_TO_CONSOLE
> +#define PRINTF_TO_CONSOLE(args) { printk(DRVSTR": "); printk args; }
> +#else //!defined TRACE_TO_CONSOLE
> +#define PRINTF_TO_CONSOLE(args)
> +#endif
> +
> +#define	TRC(args)	{ PRINTF_TO_CONSOLE(args) }

do { } while 0

> +/* Our 3 magic numbers for our board, channel and unit structs */
> +#define JSM_BOARD_MAGIC		0x5c6df104
> +#define JSM_CHANNEL_MAGIC	0x6c6df104
> +#define JSM_UNIT_MAGIC		0x7c6df104

Don't use magic numbers, they are not needed at all.  Please just remove
them from the structures, and use the provided kernel slab debug
functions to catch errors that you might have been able to catch with
the magic values.

> + * This file is intended to contain all the kernel "differences" between the
> + * various kernels that we support.

No, please use this for your 2.4 code, not for your 2.6 driver version.

> +# define JSM_MOD_INC_USE_COUNT(rtn)	(rtn = 1)
> +# define JSM_MOD_DEC_USE_COUNT		

You shouldn't even be using these macros in your 2.4 code, so please
don't use it here.

> diff -Nuar linux-2.6.9.orig/drivers/serial/jsm/jsm_mgmt.h linux-2.6.9.new/drivers/serial/jsm/jsm_mgmt.h
> --- linux-2.6.9.orig/drivers/serial/jsm/jsm_mgmt.h	1969-12-31 18:00:00.000000000 -0600
> +++ linux-2.6.9.new/drivers/serial/jsm/jsm_mgmt.h	2005-02-27 17:14:44.747952016 -0600

Do you really need all of these different header files?  Why not just
put them all in 1?

> +/************************************************************************ 
> + * Per channel/port NEO UART structure					*
> + ************************************************************************
> + *		Base Structure Entries Usage Meanings to Host		*
> + *									*
> + *	W = read write		R = read only				* 
> + *			U = Unused.					*
> + ************************************************************************/
> +
> +struct neo_uart_struct {
> +	volatile uchar txrx;		/* WR  RHR/THR - Holding Reg */
> +	volatile uchar ier;		/* WR  IER - Interrupt Enable Reg */
> +	volatile uchar isr_fcr;		/* WR  ISR/FCR - Interrupt Status Reg/Fifo Control Reg */
> +	volatile uchar lcr;		/* WR  LCR - Line Control Reg */
> +	volatile uchar mcr;		/* WR  MCR - Modem Control Reg */
> +	volatile uchar lsr;		/* WR  LSR - Line Status Reg */
> +	volatile uchar msr;		/* WR  MSR - Modem Status Reg */
> +	volatile uchar spr;		/* WR  SPR - Scratch Pad Reg */
> +	volatile uchar fctr;		/* WR  FCTR - Feature Control Reg */
> +	volatile uchar efr;		/* WR  EFR - Enhanced Function Reg */
> +	volatile uchar tfifo;		/* WR  TXCNT/TXTRG - Transmit FIFO Reg */	
> +	volatile uchar rfifo;		/* WR  RXCNT/RXTRG - Recieve  FIFO Reg */
> +	volatile uchar xoffchar1;	/* WR  XOFF 1 - XOff Character 1 Reg */
> +	volatile uchar xoffchar2;	/* WR  XOFF 2 - XOff Character 2 Reg */
> +	volatile uchar xonchar1;	/* WR  XON 1 - Xon Character 1 Reg */
> +	volatile uchar xonchar2;	/* WR  XON 2 - XOn Character 2 Reg */
> +
> +	volatile uchar reserved1[0x2ff - 0x200]; /* U   Reserved by Exar */
> +	volatile uchar txrxburst[64];	/* RW  64 bytes of RX/TX FIFO Data */
> +	volatile uchar reserved2[0x37f - 0x340]; /* U   Reserved by Exar */
> +	volatile uchar rxburst_with_errors[64];	/* R  64 bytes of RX FIFO Data + LSR */
> +};

If you need to use volatile, you are doing something wrong.  Please
don't use it.

> +#define PCIMAX 32			/* maximum number of PCI boards */

Why?  I've seen boxes with more than this number of PCI slots.

> +int	jsm_tty_write(struct uart_port *port);
> +int	jsm_tty_register(struct board_t *brd);
> +
> +int	jsm_tty_init(struct board_t *);
> +int	jsm_uart_port_init(struct board_t *);
> +int	jsm_remove_uart_port(struct board_t *);
> +
> +void	jsm_tty_uninit(struct board_t *);
> +
> +void	jsm_input(struct channel_t *ch);
> +void	jsm_carrier(struct channel_t *ch);
> +void	jsm_check_queue_flow_control(struct channel_t *ch);
> +void	neo_clear_break(struct channel_t *ch, int force);

Why a different naming scheme for this one function?

> diff -Nuar linux-2.6.9.orig/drivers/serial/jsm/jsm_types.h linux-2.6.9.new/drivers/serial/jsm/jsm_types.h
> --- linux-2.6.9.orig/drivers/serial/jsm/jsm_types.h	1969-12-31 18:00:00.000000000 -0600
> +++ linux-2.6.9.new/drivers/serial/jsm/jsm_types.h	2005-02-27 17:14:44.749951712 -0600
> @@ -0,0 +1,36 @@
> +/*
> + * Copyright 2003 Digi International (www.digi.com)
> + *	Scott H Kilau <Scott_Kilau at digi dot com>
> + *
> + * This program is free software; you can redistribute it and/or modify
> + * it under the terms of the GNU General Public License as published by
> + * the Free Software Foundation; either version 2, or (at your option)
> + * any later version.
> + *
> + * This program is distributed in the hope that it will be useful,
> + * but WITHOUT ANY WARRANTY, EXPRESS OR IMPLIED; without even the
> + * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
> + * PURPOSE.  See the GNU General Public License for more details.
> + *
> + * You should have received a copy of the GNU General Public License
> + * along with this program; if not, write to the Free Software
> + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
> + *
> + *	NOTE: THIS IS A SHARED HEADER. DO NOT CHANGE CODING STYLE!!!
> + */
> +
> +#ifndef __JSM_TYPES_H
> +#define __JSM_TYPES_H
> +
> +#ifndef TRUE
> +# define TRUE 1
> +#endif
> +
> +#ifndef FALSE
> +# define FALSE 0
> +#endif

Ick, no, just use 0 for valid function returns, and -ERRSOMETHING for an
error.  You don't need TRUE and FALSE in your code.

> +/* Required for our shared headers! */
> +typedef unsigned char uchar;

No, don't do this.  So this whole .h file can be removed.

thanks,

greg k-h

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [ patch 6/7] drivers/serial/jsm: new serial device driver
  2005-02-28  6:55 ` Greg KH
@ 2005-03-04 21:08   ` Wen Xiong
  2005-03-05  6:44     ` Greg KH
  0 siblings, 1 reply; 21+ messages in thread
From: Wen Xiong @ 2005-03-04 21:08 UTC (permalink / raw)
  To: Greg KH; +Cc: Wen Xiong, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 8914 bytes --]

Greg KH wrote:

>On Sun, Feb 27, 2005 at 06:40:20PM -0500, Wen Xiong wrote:
>  
>
>>diff -Nuar linux-2.6.9.orig/drivers/serial/jsm/digi.h linux-2.6.9.new/drivers/serial/jsm/digi.h
>>    
>>
>
>Oh, and please diff against at least the latest kernel release, 2.6.9 is
>old...
>
>
>  
>
>>+ * $Id: digi.h,v 1.7 2004/09/23 16:08:30 scottk Exp $
>>+ *
>>+ *	NOTE: THIS IS A SHARED HEADER. DO NOT CHANGE CODING STYLE!!!
>>    
>>
>
>Not true anymore, right?
>
>  
>
>>+/************************************************************************
>>+ * Structure to get driver status information
>>+ ************************************************************************/
>>+struct digi_dinfo {
>>+	unsigned int	dinfo_nboards;		/* # boards configured	*/
>>+	char		dinfo_reserved[12];	/* for future expansion */
>>+	char		dinfo_version[16];	/* driver version	*/
>>+};
>>+
>>+#define	DIGI_GETDD	('d'<<8) | 248		/* get driver info	*/
>>    
>>
>
>All structures that are passed accross the ioctl interface, MUST use the
>__u8, __u16, __u32, and friend definitions.  unsigned int is not
>allowed.
>
>And why have all of these ioctls?  Shouldn't most of this stuff be
>availble in sysfs instead?
>
>  
>
>>+#ifndef __JSM_DRIVER_H
>>+#define __JSM_DRIVER_H
>>+
>>+#include <linux/types.h>	/* To pick up the varions Linux types */
>>+#include <linux/tty.h>		/* To pick up the various tty structs/defines */
>>+#include <linux/serial_core.h>
>>+#include <linux/interrupt.h>	/* For irqreturn_t type */
>>+#include <linux/module.h>	/* For irqreturn_t type */
>>    
>>
>
>That comment is incorrect.
>
>  
>
>>+/*
>>+ * Driver identification, error and debugging statments
>>+ *
>>+ * In theory, you can change all occurances of "digi" in the next
>>+ * three lines, and the driver printk's will all automagically change.
>>+ *
>>+ * APR((fmt, args, ...));	Always prints message
>>+ * DPR((fmt, args, ...));	Only prints if JSM_TRACER is defined at
>>+ *				  compile time and jsm_debug!=0
>>+ *
>>+ * TRC_TO_CONSOLE:
>>+ *	Setting this to 1 will turn on some general function tracing
>>+ *	resulting in a bunch of extra debugging printks to the console
>>+ *
>>+ */
>>+
>>+#define	PROCSTR		"jsm"			/* /proc entries	 */
>>+#define	DEVSTR		"/dev/dg/jsm"		/* /dev entries		 */
>>+#define	DRVSTR		"jsm"			/* Driver name string 
>>+						 * displayed by APR	 */
>>+#define	APR(args)	do {printk(DRVSTR": "); printk args;} while (0)
>>    
>>
>
>Ick.  You _must_ use a KERN_ level for a printk, this is not allowed.
>Please use the dev_printk and helper functions instead.  It's not ok to
>create new functions like this.
>
>And again, what's with the double (( when you use this macro?
>
>  
>
>>+#if TRC_TO_CONSOLE
>>+#define PRINTF_TO_CONSOLE(args) { printk(DRVSTR": "); printk args; }
>>+#else //!defined TRACE_TO_CONSOLE
>>+#define PRINTF_TO_CONSOLE(args)
>>+#endif
>>+
>>+#define	TRC(args)	{ PRINTF_TO_CONSOLE(args) }
>>    
>>
>
>do { } while 0
>
>  
>
>>+/* Our 3 magic numbers for our board, channel and unit structs */
>>+#define JSM_BOARD_MAGIC		0x5c6df104
>>+#define JSM_CHANNEL_MAGIC	0x6c6df104
>>+#define JSM_UNIT_MAGIC		0x7c6df104
>>    
>>
>
>Don't use magic numbers, they are not needed at all.  Please just remove
>them from the structures, and use the provided kernel slab debug
>functions to catch errors that you might have been able to catch with
>the magic values.
>
>  
>
>>+ * This file is intended to contain all the kernel "differences" between the
>>+ * various kernels that we support.
>>    
>>
>
>No, please use this for your 2.4 code, not for your 2.6 driver version.
>
>  
>
>>+# define JSM_MOD_INC_USE_COUNT(rtn)	(rtn = 1)
>>+# define JSM_MOD_DEC_USE_COUNT		
>>    
>>
>
>You shouldn't even be using these macros in your 2.4 code, so please
>don't use it here.
>
>  
>
>>diff -Nuar linux-2.6.9.orig/drivers/serial/jsm/jsm_mgmt.h linux-2.6.9.new/drivers/serial/jsm/jsm_mgmt.h
>>--- linux-2.6.9.orig/drivers/serial/jsm/jsm_mgmt.h	1969-12-31 18:00:00.000000000 -0600
>>+++ linux-2.6.9.new/drivers/serial/jsm/jsm_mgmt.h	2005-02-27 17:14:44.747952016 -0600
>>    
>>
>
>Do you really need all of these different header files?  Why not just
>put them all in 1?
>
>  
>
>>+/************************************************************************ 
>>+ * Per channel/port NEO UART structure					*
>>+ ************************************************************************
>>+ *		Base Structure Entries Usage Meanings to Host		*
>>+ *									*
>>+ *	W = read write		R = read only				* 
>>+ *			U = Unused.					*
>>+ ************************************************************************/
>>+
>>+struct neo_uart_struct {
>>+	volatile uchar txrx;		/* WR  RHR/THR - Holding Reg */
>>+	volatile uchar ier;		/* WR  IER - Interrupt Enable Reg */
>>+	volatile uchar isr_fcr;		/* WR  ISR/FCR - Interrupt Status Reg/Fifo Control Reg */
>>+	volatile uchar lcr;		/* WR  LCR - Line Control Reg */
>>+	volatile uchar mcr;		/* WR  MCR - Modem Control Reg */
>>+	volatile uchar lsr;		/* WR  LSR - Line Status Reg */
>>+	volatile uchar msr;		/* WR  MSR - Modem Status Reg */
>>+	volatile uchar spr;		/* WR  SPR - Scratch Pad Reg */
>>+	volatile uchar fctr;		/* WR  FCTR - Feature Control Reg */
>>+	volatile uchar efr;		/* WR  EFR - Enhanced Function Reg */
>>+	volatile uchar tfifo;		/* WR  TXCNT/TXTRG - Transmit FIFO Reg */	
>>+	volatile uchar rfifo;		/* WR  RXCNT/RXTRG - Recieve  FIFO Reg */
>>+	volatile uchar xoffchar1;	/* WR  XOFF 1 - XOff Character 1 Reg */
>>+	volatile uchar xoffchar2;	/* WR  XOFF 2 - XOff Character 2 Reg */
>>+	volatile uchar xonchar1;	/* WR  XON 1 - Xon Character 1 Reg */
>>+	volatile uchar xonchar2;	/* WR  XON 2 - XOn Character 2 Reg */
>>+
>>+	volatile uchar reserved1[0x2ff - 0x200]; /* U   Reserved by Exar */
>>+	volatile uchar txrxburst[64];	/* RW  64 bytes of RX/TX FIFO Data */
>>+	volatile uchar reserved2[0x37f - 0x340]; /* U   Reserved by Exar */
>>+	volatile uchar rxburst_with_errors[64];	/* R  64 bytes of RX FIFO Data + LSR */
>>+};
>>    
>>
>
>If you need to use volatile, you are doing something wrong.  Please
>don't use it.
>
>  
>
>>+#define PCIMAX 32			/* maximum number of PCI boards */
>>    
>>
>
>Why?  I've seen boxes with more than this number of PCI slots.
>
>  
>
>>+int	jsm_tty_write(struct uart_port *port);
>>+int	jsm_tty_register(struct board_t *brd);
>>+
>>+int	jsm_tty_init(struct board_t *);
>>+int	jsm_uart_port_init(struct board_t *);
>>+int	jsm_remove_uart_port(struct board_t *);
>>+
>>+void	jsm_tty_uninit(struct board_t *);
>>+
>>+void	jsm_input(struct channel_t *ch);
>>+void	jsm_carrier(struct channel_t *ch);
>>+void	jsm_check_queue_flow_control(struct channel_t *ch);
>>+void	neo_clear_break(struct channel_t *ch, int force);
>>    
>>
>
>Why a different naming scheme for this one function?
>
>  
>
>>diff -Nuar linux-2.6.9.orig/drivers/serial/jsm/jsm_types.h linux-2.6.9.new/drivers/serial/jsm/jsm_types.h
>>--- linux-2.6.9.orig/drivers/serial/jsm/jsm_types.h	1969-12-31 18:00:00.000000000 -0600
>>+++ linux-2.6.9.new/drivers/serial/jsm/jsm_types.h	2005-02-27 17:14:44.749951712 -0600
>>@@ -0,0 +1,36 @@
>>+/*
>>+ * Copyright 2003 Digi International (www.digi.com)
>>+ *	Scott H Kilau <Scott_Kilau at digi dot com>
>>+ *
>>+ * This program is free software; you can redistribute it and/or modify
>>+ * it under the terms of the GNU General Public License as published by
>>+ * the Free Software Foundation; either version 2, or (at your option)
>>+ * any later version.
>>+ *
>>+ * This program is distributed in the hope that it will be useful,
>>+ * but WITHOUT ANY WARRANTY, EXPRESS OR IMPLIED; without even the
>>+ * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
>>+ * PURPOSE.  See the GNU General Public License for more details.
>>+ *
>>+ * You should have received a copy of the GNU General Public License
>>+ * along with this program; if not, write to the Free Software
>>+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
>>+ *
>>+ *	NOTE: THIS IS A SHARED HEADER. DO NOT CHANGE CODING STYLE!!!
>>+ */
>>+
>>+#ifndef __JSM_TYPES_H
>>+#define __JSM_TYPES_H
>>+
>>+#ifndef TRUE
>>+# define TRUE 1
>>+#endif
>>+
>>+#ifndef FALSE
>>+# define FALSE 0
>>+#endif
>>    
>>
>
>Ick, no, just use 0 for valid function returns, and -ERRSOMETHING for an
>error.  You don't need TRUE and FALSE in your code.
>
>  
>
>>+/* Required for our shared headers! */
>>+typedef unsigned char uchar;
>>    
>>
>
>No, don't do this.  So this whole .h file can be removed.
>
>thanks,
>
>greg k-h
>-
>To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
>the body of a message to majordomo@vger.kernel.org
>More majordomo info at  http://vger.kernel.org/majordomo-info.html
>Please read the FAQ at  http://www.tux.org/lkml/
>
>  
>
Fixed all above problem and combined headers files to one device driver 
head file and another one has user's API.

Signed-off-by: Wen Xiong <wendyx@us.ltcfwd.linux.ibm.com>



[-- Attachment #2: patch6.jasmine --]
[-- Type: text/plain, Size: 31686 bytes --]

diff -Nuar linux-2.6.11.org/drivers/serial/jsm/digi.h linux-2.6.11.new/drivers/serial/jsm/digi.h
--- linux-2.6.11.org/drivers/serial/jsm/digi.h	1969-12-31 18:00:00.000000000 -0600
+++ linux-2.6.11.new/drivers/serial/jsm/digi.h	2005-03-04 11:22:27.558933144 -0600
@@ -0,0 +1,387 @@
+/************************************************************************
+ * Copyright 2003 Digi International (www.digi.com)
+ *
+ * Copyright (C) 2004 IBM Corporation. All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ * 
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY, EXPRESS OR IMPLIED; without even the 
+ * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 
+ * PURPOSE.  See the GNU General Public License for more details.
+ * 
+ * You should have received a copy of the GNU General Public License 
+ * along with this program; if not, write to the Free Software 
+ * Foundation, Inc., 59 * Temple Place - Suite 330, Boston,
+ * MA  02111-1307, USA.
+ *
+ * Contact Information:
+ * Scott H Kilau <Scott_Kilau@digi.com>
+ * Wendy Xiong   <wendyx@us.ltcfwd.linux.ibm.com>
+ *
+ ***********************************************************************/
+
+#ifndef __DIGI_H
+#define __DIGI_H
+
+/************************************************************************
+ ***	Definitions for Digi ditty(1) command.
+ ************************************************************************/
+
+/************************************************************************
+ * This module provides application access to special Digi
+ * serial line enhancements which are not standard UNIX(tm) features.
+ ************************************************************************/
+
+#if !defined(TIOCMODG)
+
+#define TIOCMODG	('d'<<8) | 250		/* get modem ctrl state	*/
+#define TIOCMODS	('d'<<8) | 251		/* set modem ctrl state	*/
+
+#ifndef TIOCM_LE 
+#define TIOCM_LE	0x01		/* line enable		*/
+#define TIOCM_DTR	0x02		/* data terminal ready	*/
+#define TIOCM_RTS	0x04		/* request to send	*/
+#define TIOCM_ST	0x08		/* secondary transmit	*/
+#define TIOCM_SR	0x10		/* secondary receive	*/
+#define TIOCM_CTS	0x20		/* clear to send	*/
+#define TIOCM_CAR	0x40		/* carrier detect	*/
+#define TIOCM_RNG	0x80		/* ring	indicator	*/
+#define TIOCM_DSR	0x100		/* data set ready	*/
+#define TIOCM_RI	TIOCM_RNG	/* ring (alternate)	*/
+#define TIOCM_CD	TIOCM_CAR	/* carrier detect (alt)	*/
+#endif
+
+#endif
+
+#if !defined(TIOCMSET)
+#define TIOCMSET	('d'<<8) | 252		/* set modem ctrl state	*/
+#define TIOCMGET	('d'<<8) | 253		/* set modem ctrl state	*/
+#endif
+
+#if !defined(TIOCMBIC)
+#define TIOCMBIC	('d'<<8) | 254		/* set modem ctrl state */
+#define TIOCMBIS	('d'<<8) | 255		/* set modem ctrl state */
+#endif
+
+
+#if !defined(TIOCSDTR)
+#define TIOCSDTR	('e'<<8) | 0		/* set DTR		*/
+#define TIOCCDTR	('e'<<8) | 1		/* clear DTR		*/
+#endif
+
+/************************************************************************
+ * Ioctl command arguments for DIGI parameters.
+ ************************************************************************/
+#define DIGI_GETA	('e'<<8) | 94		/* Read params		*/
+#define DIGI_SETA	('e'<<8) | 95		/* Set params		*/
+#define DIGI_SETAW	('e'<<8) | 96		/* Drain & set params	*/
+#define DIGI_SETAF	('e'<<8) | 97		/* Drain, flush & set params */
+#define DIGI_KME	('e'<<8) | 98		/* Read/Write Host	*/
+#define DIGI_GETFLOW	('e'<<8) | 99		/* Get startc/stopc flow */
+#define DIGI_SETFLOW	('e'<<8) | 100		/* Set startc/stopc flow */
+#define DIGI_GETAFLOW	('e'<<8) | 101		/* Get Aux. startc/stopc */
+#define DIGI_SETAFLOW	('e'<<8) | 102		/* Set Aux. startc/stopc */
+#define DIGI_GEDELAY	('d'<<8) | 246		/* Get edelay */
+#define DIGI_SEDELAY	('d'<<8) | 247		/* Set edelay */
+
+struct	digiflow_t {
+	unsigned char	startc;			/* flow cntl start char	*/
+	unsigned char	stopc;			/* flow cntl stop char	*/
+};
+
+#ifdef	FLOW_2200
+#define F2200_GETA	('e'<<8) | 104		/* Get 2x36 flow cntl flags */
+#define F2200_SETAW	('e'<<8) | 105		/* Set 2x36 flow cntl flags */
+#define F2200_MASK	0x03		/* 2200 flow cntl bit mask */
+#define FCNTL_2200	0x01		/* 2x36 terminal flow cntl */
+#define PCNTL_2200	0x02		/* 2x36 printer flow cntl  */
+#define F2200_XON	0xf8
+#define P2200_XON	0xf9
+#define F2200_XOFF	0xfa
+#define P2200_XOFF	0xfb
+
+#define FXOFF_MASK	0x03		/* 2200 flow status mask   */
+#define RCVD_FXOFF	0x01		/* 2x36 Terminal XOFF rcvd */
+#define RCVD_PXOFF	0x02		/* 2x36 Printer XOFF rcvd  */
+#endif
+
+/************************************************************************
+ * Values for digi_flags 
+ ************************************************************************/
+#define DIGI_IXON	0x0001		/* Handle IXON in the FEP	*/
+#define DIGI_FAST	0x0002		/* Fast baud rates		*/
+#define RTSPACE		0x0004		/* RTS input flow control	*/
+#define CTSPACE		0x0008		/* CTS output flow control	*/
+#define DSRPACE		0x0010		/* DSR output flow control	*/
+#define DCDPACE		0x0020		/* DCD output flow control	*/
+#define DTRPACE		0x0040		/* DTR input flow control	*/
+#define DIGI_COOK	0x0080		/* Cooked processing done in FEP */
+#define DIGI_FORCEDCD	0x0100		/* Force carrier		*/
+#define DIGI_ALTPIN	0x0200		/* Alternate RJ-45 pin config	*/
+#define DIGI_AIXON	0x0400		/* Aux flow control in fep	*/
+#define DIGI_PRINTER	0x0800		/* Hold port open for flow cntrl*/
+#define DIGI_PP_INPUT	0x1000		/* Change parallel port to input*/
+#define DIGI_DTR_TOGGLE	0x2000		/* Support DTR Toggle		*/
+#define DIGI_422	0x4000		/* for 422/232 selectable panel */
+#define DIGI_RTS_TOGGLE	0x8000		/* Support RTS Toggle		*/
+
+/************************************************************************
+ * These options are not supported on the comxi.
+ ************************************************************************/
+#define DIGI_COMXI	(DIGI_FAST|DIGI_COOK|DSRPACE|DCDPACE|DTRPACE)
+
+#define DIGI_PLEN	28		/* String length		*/
+#define DIGI_TSIZ	10		/* Terminal string len		*/
+
+/************************************************************************
+ * Structure used with ioctl commands for DIGI parameters.
+ ************************************************************************/
+struct digi_t {
+	unsigned short	digi_flags;		/* Flags (see above)	*/
+	unsigned short	digi_maxcps;		/* Max printer CPS	*/
+	unsigned short	digi_maxchar;		/* Max chars in print queue */
+	unsigned short	digi_bufsize;		/* Buffer size		*/
+	unsigned char	digi_onlen;		/* Length of ON string	*/
+	unsigned char	digi_offlen;		/* Length of OFF string	*/
+	char		digi_onstr[DIGI_PLEN];	/* Printer on string	*/
+	char		digi_offstr[DIGI_PLEN];	/* Printer off string	*/
+	char		digi_term[DIGI_TSIZ];	/* terminal string	*/
+};
+
+#define PCXI_TYPE	1	/* Board type at the designated port is a PC/Xi */
+#define PCXM_TYPE	2	/* Board type at the designated port is a PC/Xm */
+#define PCXE_TYPE	3	/* Board type at the designated port is a PC/Xe */
+#define MCXI_TYPE	4	/* Board type at the designated port is a MC/Xi */
+#define COMXI_TYPE	5	/* Board type at the designated port is a COM/Xi */
+
+			 /* Non-Zero Result codes. */
+#define RESULT_NOBDFND	1	/* A Digi product at that port is not config installed */ 
+#define RESULT_NODESCT	2	/* A memory descriptor was not obtainable */ 
+#define RESULT_NOOSSIG	3	/* FEP/OS signature was not detected on the board */
+#define RESULT_TOOSML	4	/* Too small an area to shrink.  */
+#define RESULT_NOCHAN	5	/* Channel structure for the board was not found */
+
+/************************************************************************
+ * Structure to get driver status information
+ ************************************************************************/
+struct digi_dinfo {
+	u8	dinfo_nboards;		/* # boards configured	*/
+	char	dinfo_reserved[12];	/* for future expansion */
+	char	dinfo_version[16];	/* driver version	*/
+};
+
+/************************************************************************
+ * Structure used with ioctl commands for per-board information
+ *
+ * physsize and memsize differ when board has "windowed" memory
+ ************************************************************************/
+struct digi_info {
+	unsigned int	info_bdnum;		/* Board number (0 based)  */
+	unsigned int	info_ioport;		/* io port address	   */
+	unsigned long	info_physaddr;		/* memory address	   */
+	unsigned int	info_physsize;		/* Size of host mem window */
+	unsigned int	info_memsize;		/* Amount of dual-port mem */
+						/* on board		   */
+	unsigned short	info_bdtype;		/* Board type		   */
+	unsigned short	info_nports;		/* number of ports	   */
+	char		info_bdstate;		/* board state		   */
+	char		info_reserved[7];	/* for future expansion	   */
+};
+
+struct digi_stat {
+	unsigned int	info_chan;		/* Channel number (0 based)  */
+	unsigned int	info_brd;		/* Board number (0 based)  */
+	unsigned int	info_cflag;		/* cflag for channel	   */
+	unsigned int	info_iflag;		/* iflag for channel	   */
+	unsigned int	info_oflag;		/* oflag for channel	   */
+	unsigned int	info_mstat;		/* mstat for channel	   */
+	unsigned int	info_tx_data;		/* tx_data for channel	   */
+	unsigned int	info_rx_data;		/* rx_data for channel	   */
+	unsigned int	info_hflow;		/* hflow for channel	   */
+	unsigned int	info_reserved[8];	/* for future expansion    */
+};
+
+/***********************************************************************
+ *
+ * Structure used with ioctl commands for per-channel information
+ *
+ ************************************************************************/
+struct digi_ch {
+	unsigned int	info_bdnum;		/* Board number (0 based)  */
+	unsigned int	info_channel;		/* Channel index number	   */
+	unsigned int	info_ch_cflag;		/* Channel cflag   	   */
+	unsigned int	info_ch_iflag;		/* Channel iflag   	   */
+	unsigned int	info_ch_oflag;		/* Channel oflag   	   */
+	unsigned int	info_chsize;		/* Channel structure size  */
+	unsigned int	info_sleep_stat;	/* sleep status		   */
+	dev_t		info_dev;		/* device number	   */
+	unsigned char	info_initstate;		/* Channel init state	   */
+	unsigned char	info_running;		/* Channel running state   */
+	int		reserved[8];		/* reserved for future use */
+};
+
+/*
+* This structure is used with the DIGI_FEPCMD ioctl to 
+* tell the driver which port to send the command for.
+*/
+struct digi_cmd {
+	int	cmd;
+	int	word;
+	int	ncmds;
+	int	chan; /* channel index (zero based) */
+	int	bdid; /* board index (zero based) */
+};
+
+struct digi_getbuffer /* Struct for holding buffer use counts */
+{
+	unsigned long tIn;
+	unsigned long tOut;
+	unsigned long rxbuf;
+	unsigned long txbuf;
+	unsigned long txdone;
+};
+
+struct digi_getcounter
+{
+	unsigned long norun;		/* number of UART overrun errors */
+	unsigned long noflow;		/* number of buffer overflow errors */
+	unsigned long nframe;		/* number of framing errors */
+	unsigned long nparity;		/* number of parity errors */
+	unsigned long nbreak;		/* number of breaks received */
+	unsigned long rbytes;		/* number of received bytes */
+	unsigned long tbytes;		/* number of bytes transmitted fully */
+};
+
+/*
+*  info_sleep_stat defines
+*/
+#define INFO_RUNWAIT	0x0001
+#define INFO_WOPEN	0x0002
+#define INFO_TTIOW	0x0004
+#define INFO_CH_RWAIT	0x0008
+#define INFO_CH_WEMPTY	0x0010
+#define INFO_CH_WLOW	0x0020
+#define INFO_XXBUF_BUSY 0x0040
+
+
+/* Board type definitions */
+
+#define SUBTYPE		0007
+#define T_PCXI		0000
+#define T_PCXM		0001
+#define T_PCXE		0002
+#define T_PCXR		0003
+#define T_SP		0004
+#define T_SP_PLUS	0005
+
+#define T_HERC		0000
+#define T_HOU		0001
+#define T_LON		0002
+#define T_CHA		0003
+
+#define T_NEO		0000
+#define T_CLASSIC	0001
+
+#define FAMILY		0070
+#define T_COMXI		0000
+#define T_PCXX		0010
+#define T_CX		0020
+#define T_EPC		0030
+#define T_PCLITE	0040
+#define T_SPXX		0050
+#define T_AVXX		0060
+#define T_DXB		0070
+#define T_A2K_4_8	0070
+#define BUSTYPE		0700
+#define T_ISABUS	0000
+#define T_MCBUS		0100
+#define T_EISABUS	0200
+#define T_PCIBUS	0400
+
+/* Board State Definitions */
+
+#define BD_RUNNING	0x0
+#define BD_REASON	0x7f
+#define BD_NOTFOUND	0x1
+#define BD_NOIOPORT	0x2
+#define BD_NOMEM	0x3
+#define BD_NOBIOS	0x4
+#define BD_NOFEP	0x5
+#define BD_FAILED	0x6
+#define BD_ALLOCATED	0x7
+#define BD_TRIBOOT	0x8
+#define BD_BADKME	0x80
+
+#define DIGI_SPOLL		('d'<<8) | 254	/* change poller rate   */
+
+#define DIGI_SETCUSTOMBAUD	_IOW('e', 106, int)	/* Set integer baud rate */
+#define DIGI_GETCUSTOMBAUD	_IOR('e', 107, int)	/* Get integer baud rate */
+
+#define DIGI_REALPORT_GETBUFFERS	('e'<<8 ) | 108
+#define DIGI_REALPORT_SENDIMMEDIATE	('e'<<8 ) | 109
+#define DIGI_REALPORT_GETCOUNTERS	('e'<<8 ) | 110
+#define DIGI_REALPORT_GETEVENTS		('e'<<8 ) | 111
+
+#define EV_OPU		0x0001		//!<Output paused by client
+#define EV_OPS		0x0002		//!<Output paused by reqular sw flowctrl  
+#define EV_OPX		0x0004		//!<Output paused by extra sw flowctrl
+#define EV_OPH		0x0008		//!<Output paused by hw flowctrl
+#define EV_OPT		0x0800		//!<Output paused for RTS Toggle predelay
+
+#define EV_IPU		0x0010		//!<Input paused unconditionally by user
+#define EV_IPS		0x0020		//!<Input paused by high/low water marks
+#define EV_IPA		0x0400		//!<Input paused by pattern alarm module
+
+#define EV_TXB		0x0040		//!<Transmit break pending
+#define EV_TXI		0x0080		//!<Transmit immediate pending
+#define EV_TXF		0x0100		//!<Transmit flowctrl char pending
+#define EV_RXB		0x0200		//!<Break received
+
+#define EV_OPALL	0x080f		//!<Output pause flags
+#define EV_IPALL	0x0430		//!<Input pause flags
+
+/* 
+ * This structure holds data needed for the intelligent <--> nonintelligent
+ * DPA translation
+ */
+struct ni_info {
+	int board;
+	int channel;
+	int dtr;
+	int rts;
+	int cts;
+	int dsr;
+	int ri;
+	int dcd;
+	int curtx;
+	int currx;
+	unsigned short iflag;
+	unsigned short oflag;
+	unsigned short cflag;
+	unsigned short lflag;
+	unsigned int mstat;
+	unsigned char hflow;
+
+	unsigned char xmit_stopped;
+	unsigned char recv_stopped;
+
+	unsigned int baud;
+};
+
+/* Ioctls needed for dpa operation */
+
+#define DIGI_GETSTAT	('d'<<8) | 244		/* get board info	*/
+#define DIGI_GETCH	('d'<<8) | 245		/* get board info	*/
+#define DIGI_GETDD	('d'<<8) | 248		/* get driver info      */
+#define DIGI_GETBD	('d'<<8) | 249		/* get board info       */
+#define DIGI_GET_NI_INFO ('d'<<8) | 250		/* nonintelligent state snfo */
+
+/* Other special ioctls */
+#define DIGI_TIMERIRQ	('d'<<8) | 251		/* Enable/disable RS_TIMER use */
+#define DIGI_LOOPBACK	('d'<<8) | 252		/* Enable/disable UART internal loopback */
+
+#endif /* DIGI_H */
diff -Nuar linux-2.6.11.org/drivers/serial/jsm/jsm_driver.h linux-2.6.11.new/drivers/serial/jsm/jsm_driver.h
--- linux-2.6.11.org/drivers/serial/jsm/jsm_driver.h	1969-12-31 18:00:00.000000000 -0600
+++ linux-2.6.11.new/drivers/serial/jsm/jsm_driver.h	2005-03-04 11:22:19.222869456 -0600
@@ -0,0 +1,465 @@
+/************************************************************************
+ * Copyright 2003 Digi International (www.digi.com)
+ *
+ * Copyright (C) 2004 IBM Corporation. All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ * 
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY, EXPRESS OR IMPLIED; without even the 
+ * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 
+ * PURPOSE.  See the GNU General Public License for more details.
+ * 
+ * You should have received a copy of the GNU General Public License 
+ * along with this program; if not, write to the Free Software 
+ * Foundation, Inc., 59 * Temple Place - Suite 330, Boston,
+ * MA  02111-1307, USA.
+ *
+ * Contact Information:
+ * Scott H Kilau <Scott_Kilau@digi.com>
+ * Wendy Xiong   <wendyx@us.ltcfwd.linux.ibm.com>
+ *
+ ***********************************************************************/
+
+#ifndef __JSM_DRIVER_H
+#define __JSM_DRIVER_H
+
+#include <linux/kernel.h>
+#include <linux/version.h>
+#include <linux/types.h>	/* To pick up the varions Linux types */
+#include <linux/tty.h>		
+#include <linux/serial_core.h>
+#include <linux/serial_reg.h>
+#include <linux/interrupt.h>	/* For irqreturn_t type */
+#include <linux/module.h>	
+#include <linux/moduleparam.h>	
+#include <linux/kdev_t.h>	
+#include <linux/pci.h>
+#include <linux/pci_ids.h>
+#include <linux/device.h>
+#include <linux/config.h>
+
+
+#include "digi.h"		/* Digi specific ioctl header */
+
+#define DRVSTR	"jsm"		/* Driver name string */
+
+#define TRC_TO_IOCTL	1
+
+/*
+ * Debugging levels can be set using debug insmod variable
+ * They can also be compiled out completely.
+ */
+enum {
+	DBG_INIT	= 0x01,
+	DBG_BASIC	= 0x02,
+	DBG_CORE	= 0x04,
+	DBG_OPEN	= 0x08,
+	DBG_CLOSE	= 0x10,
+	DBG_READ	= 0x20,
+	DBG_WRITE	= 0x40,
+	DBG_IOCTL	= 0x80,
+	DBG_PROC	= 0x100,
+	DBG_PARAM	= 0x200,
+	DBG_PSCAN	= 0x400,
+	DBG_EVENT	= 0x800,
+	DBG_DRAIN	= 0x1000,
+	DBG_MSIGS	= 0x2000,
+	DBG_MGMT	= 0x4000,
+	DBG_INTR	= 0x8000,
+	DBG_CARR	= 0x10000,
+};
+
+#define DPRINTK(nlevel, klevel, fmt, args...) \
+	(void)((DBG_##nlevel & debug) && \
+	printk(KERN_##klevel "%s: " fmt, \
+		__FUNCTION__, ## args)); 
+	
+#define MAXPORTS	8
+#define MAX_STOPS_SENT	5
+
+/* 4 extra for alignment play space */
+#define WRITEBUFLEN	((4096) + 4)
+#define MYFLIPLEN	N_TTY_BUF_SIZE
+
+#define JSM_MAJOR(x)	(imajor(x))
+#define JSM_MINOR(x)	(iminor(x))
+
+#ifndef _POSIX_VDISABLE
+#define	_POSIX_VDISABLE '\0'
+#endif
+
+/*
+ * All the possible states the driver can be while being loaded.
+ */
+enum {
+	DRIVER_INITIALIZED = 0,
+	DRIVER_READY
+};
+
+/*
+ * All the possible states the board can be while booting up.
+ */
+enum {
+	BOARD_FAILED = 0,
+	BOARD_FOUND,
+	BOARD_READY
+};
+
+struct board_id {
+	u8 *name;
+	u32 maxports;
+};
+
+struct jsm_board;
+struct jsm_channel;
+
+/************************************************************************
+ * Per board operations structure					*
+ ************************************************************************/
+struct board_ops {
+	irqreturn_t (*intr) (int irq, void *voidbrd, struct pt_regs *regs);
+	void (*uart_init) (struct jsm_channel *ch);
+	void (*uart_off) (struct jsm_channel *ch);
+	void (*param) (struct jsm_channel *ch);
+	void (*assert_modem_signals) (struct jsm_channel *ch);
+	void (*flush_uart_write) (struct jsm_channel *ch);
+	void (*flush_uart_read) (struct jsm_channel *ch);
+	void (*disable_receiver) (struct jsm_channel *ch);
+	void (*enable_receiver) (struct jsm_channel *ch);
+	void (*send_break) (struct jsm_channel *ch);
+	void (*clear_break) (struct jsm_channel *ch, int);
+	void (*send_start_character) (struct jsm_channel *ch);
+	void (*send_stop_character) (struct jsm_channel *ch);
+	void (*copy_data_from_queue_to_uart) (struct jsm_channel *ch);
+	u32 (*get_uart_bytes_left) (struct jsm_channel *ch);
+	void (*send_immediate_char) (struct jsm_channel *ch, unsigned char);
+};
+
+/*
+ *	Per-board information
+ */
+struct jsm_board
+{
+	int		boardnum;	/* Board number: 0-32 */
+
+	int		type;		/* Type of board */
+	char		*name;		/* Product Name */
+	u8		rev;		/* PCI revision ID */
+	struct pci_dev	*pci_dev;
+	u32		maxports;	/* MAX ports this board can handle */
+
+	spinlock_t	bd_lock;	/* Used to protect board */
+
+	spinlock_t	bd_intr_lock;	/* Used to protect the poller tasklet and
+					 * the interrupt routine from each other.
+					 */
+
+	u32		state;		/* State of card. */
+	wait_queue_head_t state_wait;	/* Place to sleep on for state change */
+
+	u32		nasync;		/* Number of ports on card */
+
+	u32		irq;		/* Interrupt request number */
+	u64		intr_count;	/* Count of interrupts */
+
+	u64		membase;	/* Start of base memory of the card */
+	u64		membase_end;	/* End of base memory of the card */
+
+	u8		*re_map_membase;/* Remapped memory of the card */
+
+	u64		iobase;		/* Start of io base of the card */
+	u64		iobase_end;	/* End of io base of the card */
+
+	u32		bd_uart_offset;	/* Space between each UART */
+
+	struct jsm_channel *channels[MAXPORTS]; /* array of pointers to our channels. */
+
+	u32		jsm_major_serial_registered;
+	u32		jsm_serial_major;
+
+	char		*flipbuf;	/* Our flip buffer, alloced if board is found */
+
+	u16		dpatype;	/* The board "type", as defined by DPA */
+	u16		dpastatus;	/* The board "status", as defined by DPA */
+
+	u32		bd_dividend;	/* Board/UARTs specific dividend */
+
+	struct board_ops *bd_ops;
+
+	struct list_head jsm_board_entry;
+};
+
+/************************************************************************ 
+ * Device flag definitions for ch_flags.
+ ************************************************************************/
+#define CH_PRON		0x0001		/* Printer on string		*/
+#define CH_STOP		0x0002		/* Output is stopped		*/
+#define CH_STOPI	0x0004		/* Input is stopped		*/
+#define CH_CD		0x0008		/* Carrier is present		*/
+#define CH_FCAR		0x0010		/* Carrier forced on		*/
+#define CH_HANGUP	0x0020		/* Hangup received		*/
+
+#define CH_RECEIVER_OFF	0x0040		/* Receiver is off		*/
+#define CH_OPENING	0x0080		/* Port in fragile open state	*/
+#define CH_CLOSING	0x0100		/* Port in fragile close state	*/
+#define CH_FIFO_ENABLED 0x0200		/* Port has FIFOs enabled	*/
+#define CH_TX_FIFO_EMPTY 0x0400		/* TX Fifo is completely empty	*/
+#define CH_TX_FIFO_LWM	0x0800		/* TX Fifo is below Low Water	*/
+#define CH_BREAK_SENDING 0x1000		/* Break is being sent		*/
+#define CH_LOOPBACK 0x2000		/* Channel is in lookback mode	*/
+#define CH_FLIPBUF_IN_USE 0x4000	/* Channel's flipbuf is in use	*/
+#define CH_BAUD0	0x08000		/* Used for checking B0 transitions */
+
+/* Our Read/Error/Write queue sizes */
+#define RQUEUEMASK	0x1FFF		/* 8 K - 1 */
+#define EQUEUEMASK	0x1FFF		/* 8 K - 1 */
+#define WQUEUEMASK	0x0FFF		/* 4 K - 1 */
+#define RQUEUESIZE	(RQUEUEMASK + 1)
+#define EQUEUESIZE	RQUEUESIZE
+#define WQUEUESIZE	(WQUEUEMASK + 1)
+
+/************************************************************************ 
+ * Channel information structure.
+ ************************************************************************/
+struct jsm_channel {
+	struct uart_port uart_port;
+	struct jsm_board	*ch_bd;		/* Board structure pointer	*/
+
+	spinlock_t	ch_lock;	/* provide for serialization */
+	wait_queue_head_t ch_flags_wait;
+
+	u32		ch_portnum;	/* Port number, 0 offset.	*/
+	u32		ch_open_count;	/* open count			*/
+	u32		ch_flags;	/* Channel flags		*/
+
+	u64		ch_close_delay;	/* How long we should drop RTS/DTR for */
+
+	u64		ch_cpstime;	/* Time for CPS calculations	*/
+
+	tcflag_t	ch_c_iflag;	/* channel iflags		*/
+	tcflag_t	ch_c_cflag;	/* channel cflags		*/
+	tcflag_t	ch_c_oflag;	/* channel oflags		*/
+	tcflag_t	ch_c_lflag;	/* channel lflags		*/
+	u8		ch_stopc;	/* Stop character		*/
+	u8		ch_startc;	/* Start character		*/
+
+	u32		ch_old_baud;	/* Cache of the current baud */
+	u32		ch_custom_speed;/* Custom baud, if set */
+
+	u32		ch_wopen;	/* Waiting for open process cnt */
+
+	u8		ch_mostat;	/* FEP output modem status	*/
+	u8		ch_mistat;	/* FEP input modem status	*/
+
+	struct neo_uart_struct *ch_neo_uart;	/* Pointer to the "mapped" UART struct */
+	u8		ch_cached_lsr;	/* Cached value of the LSR register */
+
+	u8		*ch_rqueue;	/* Our read queue buffer - malloc'ed */
+	u16		ch_r_head;	/* Head location of the read queue */
+	u16		ch_r_tail;	/* Tail location of the read queue */
+
+	u8		*ch_equeue;	/* Our error queue buffer - malloc'ed */
+	u16		ch_e_head;	/* Head location of the error queue */
+	u16		ch_e_tail;	/* Tail location of the error queue */
+
+	u8		*ch_wqueue;	/* Our write queue buffer - malloc'ed */
+	u16		ch_w_head;	/* Head location of the write queue */
+	u16		ch_w_tail;	/* Tail location of the write queue */
+
+	u64		ch_rxcount;	/* total of data received so far */
+	u64		ch_txcount;	/* total of data transmitted so far */
+
+	u8		ch_r_tlevel;	/* Receive Trigger level */
+	u8		ch_t_tlevel;	/* Transmit Trigger level */
+
+	u8		ch_r_watermark;	/* Receive Watermark */
+
+
+	u32		ch_stops_sent;	/* How many times I have sent a stop character
+					 * to try to stop the other guy sending.
+					 */
+	u64		ch_err_parity;	/* Count of parity errors on channel */
+	u64		ch_err_frame;	/* Count of framing errors on channel */
+	u64		ch_err_break;	/* Count of breaks on channel */
+	u64		ch_err_overrun; /* Count of overruns on channel */
+
+	u64		ch_xon_sends;	/* Count of xons transmitted */
+	u64		ch_xoff_sends;	/* Count of xoffs transmitted */
+};
+
+/************************************************************************ 
+ * Per channel/port NEO UART structure					*
+ ************************************************************************
+ *		Base Structure Entries Usage Meanings to Host		*
+ *									*
+ *	W = read write		R = read only				* 
+ *			U = Unused.					*
+ ************************************************************************/
+
+struct neo_uart_struct {
+	 u8 txrx;		/* WR	RHR/THR - Holding Reg */
+	 u8 ier;		/* WR	IER - Interrupt Enable Reg */
+	 u8 isr_fcr;		/* WR	ISR/FCR - Interrupt Status Reg/Fifo Control Reg */
+	 u8 lcr;		/* WR	LCR - Line Control Reg */
+	 u8 mcr;		/* WR	MCR - Modem Control Reg */
+	 u8 lsr;		/* WR	LSR - Line Status Reg */
+	 u8 msr;		/* WR	MSR - Modem Status Reg */
+	 u8 spr;		/* WR	SPR - Scratch Pad Reg */
+	 u8 fctr;		/* WR	FCTR - Feature Control Reg */
+	 u8 efr;		/* WR	EFR - Enhanced Function Reg */
+	 u8 tfifo;		/* WR	TXCNT/TXTRG - Transmit FIFO Reg */	
+	 u8 rfifo;		/* WR	RXCNT/RXTRG - Recieve FIFO Reg */
+	 u8 xoffchar1;	/* WR	XOFF 1 - XOff Character 1 Reg */
+	 u8 xoffchar2;	/* WR	XOFF 2 - XOff Character 2 Reg */
+	 u8 xonchar1;	/* WR	XON 1 - Xon Character 1 Reg */
+	 u8 xonchar2;	/* WR	XON 2 - XOn Character 2 Reg */
+
+	 u8 reserved1[0x2ff - 0x200]; /* U	Reserved by Exar */
+	 u8 txrxburst[64];	/* RW	64 bytes of RX/TX FIFO Data */
+	 u8 reserved2[0x37f - 0x340]; /* U	Reserved by Exar */
+	 u8 rxburst_with_errors[64];	/* R	64 bytes of RX FIFO Data + LSR */
+};
+
+/* Where to read the extended interrupt register (32bits instead of 8bits) */
+#define	UART_17158_POLL_ADDR_OFFSET	0x80
+
+/*
+ * These are the redefinitions for the FCTR on the XR17C158, since
+ * Exar made them different than their earlier design. (XR16C854)
+ */
+
+/* These are only applicable when table D is selected */
+#define UART_17158_FCTR_RTS_NODELAY	0x00
+#define UART_17158_FCTR_RTS_4DELAY	0x01
+#define UART_17158_FCTR_RTS_6DELAY	0x02
+#define UART_17158_FCTR_RTS_8DELAY	0x03
+#define UART_17158_FCTR_RTS_12DELAY	0x12
+#define UART_17158_FCTR_RTS_16DELAY	0x05
+#define UART_17158_FCTR_RTS_20DELAY	0x13
+#define UART_17158_FCTR_RTS_24DELAY	0x06
+#define UART_17158_FCTR_RTS_28DELAY	0x14
+#define UART_17158_FCTR_RTS_32DELAY	0x07
+#define UART_17158_FCTR_RTS_36DELAY	0x16
+#define UART_17158_FCTR_RTS_40DELAY	0x08
+#define UART_17158_FCTR_RTS_44DELAY	0x09
+#define UART_17158_FCTR_RTS_48DELAY	0x10
+#define UART_17158_FCTR_RTS_52DELAY	0x11
+
+#define UART_17158_FCTR_RTS_IRDA	0x10
+#define UART_17158_FCTR_RS485		0x20
+#define UART_17158_FCTR_TRGA		0x00
+#define UART_17158_FCTR_TRGB		0x40
+#define UART_17158_FCTR_TRGC		0x80
+#define UART_17158_FCTR_TRGD		0xC0
+
+/* 17158 trigger table selects.. */
+#define UART_17158_FCTR_BIT6		0x40
+#define UART_17158_FCTR_BIT7		0x80
+
+/* 17158 TX/RX memmapped buffer offsets */
+#define UART_17158_RX_FIFOSIZE		64
+#define UART_17158_TX_FIFOSIZE		64
+
+/* 17158 Extended IIR's */
+#define UART_17158_IIR_RDI_TIMEOUT	0x0C	/* Receiver data TIMEOUT */
+#define UART_17158_IIR_XONXOFF		0x10	/* Received an XON/XOFF char */
+#define UART_17158_IIR_HWFLOW_STATE_CHANGE 0x20	/* CTS/DSR or RTS/DTR state change */
+#define UART_17158_IIR_FIFO_ENABLED	0xC0	/* 16550 FIFOs are Enabled */
+
+/*
+ * These are the extended interrupts that get sent
+ * back to us from the UART's 32bit interrupt register
+ */
+#define UART_17158_RX_LINE_STATUS	0x1	/* RX Ready */
+#define UART_17158_RXRDY_TIMEOUT	0x2	/* RX Ready Timeout */
+#define UART_17158_TXRDY		0x3	/* TX Ready */
+#define UART_17158_MSR			0x4	/* Modem State Change */
+#define UART_17158_TX_AND_FIFO_CLR	0x40	/* Transmitter Holding Reg Empty */
+#define UART_17158_RX_FIFO_DATA_ERROR	0x80	/* UART detected an RX FIFO Data error */
+
+/*
+ * These are the EXTENDED definitions for the 17C158's Interrupt
+ * Enable Register.
+ */
+#define UART_17158_EFR_ECB	0x10	/* Enhanced control bit */
+#define UART_17158_EFR_IXON	0x2	/* Receiver compares Xon1/Xoff1 */
+#define UART_17158_EFR_IXOFF	0x8	/* Transmit Xon1/Xoff1 */
+#define UART_17158_EFR_RTSDTR	0x40	/* Auto RTS/DTR Flow Control Enable */
+#define UART_17158_EFR_CTSDSR	0x80	/* Auto CTS/DSR Flow COntrol Enable */
+
+#define UART_17158_XOFF_DETECT	0x1	/* Indicates whether chip saw an incoming XOFF char  */
+#define UART_17158_XON_DETECT	0x2	/* Indicates whether chip saw an incoming XON char */
+
+#define UART_17158_IER_RSVD1	0x10	/* Reserved by Exar */
+#define UART_17158_IER_XOFF	0x20	/* Xoff Interrupt Enable */
+#define UART_17158_IER_RTSDTR	0x40	/* Output Interrupt Enable */
+#define UART_17158_IER_CTSDSR	0x80	/* Input Interrupt Enable */
+
+#define PCI_DEVICE_NEO_4_PCI_NAME		"Neo 4 PCI"
+#define PCI_DEVICE_NEO_8_PCI_NAME		"Neo 8 PCI"
+#define PCI_DEVICE_NEO_2DB9_PCI_NAME		"Neo 2 - DB9 Universal PCI"
+#define PCI_DEVICE_NEO_2DB9PRI_PCI_NAME		"Neo 2 - DB9 Universal PCI - Powered Ring Indicator"
+#define PCI_DEVICE_NEO_2RJ45_PCI_NAME		"Neo 2 - RJ45 Universal PCI"
+#define PCI_DEVICE_NEO_2RJ45PRI_PCI_NAME	"Neo 2 - RJ45 Universal PCI - Powered Ring Indicator"
+#define PCI_DEVICE_NEO_1_422_PCI_NAME		"Neo 1 422 PCI"
+#define PCI_DEVICE_NEO_1_422_485_PCI_NAME	"Neo 1 422/485 PCI"
+#define PCI_DEVICE_NEO_2_422_485_PCI_NAME	"Neo 2 422/485 PCI"
+
+/*
+ * Our Global Variables.
+ */
+extern struct	uart_driver jsm_uart_driver;
+extern struct	board_ops jsm_neo_ops;
+extern int	debug;
+extern int	rawreadok;
+
+extern int	jsm_driver_state;	/* The state of the driver	*/
+extern char	*jsm_driver_state_text[];/* Array of driver state text */
+
+extern spinlock_t jsm_board_head_lock;
+static LIST_HEAD(jsm_board_head);
+
+/*************************************************************************
+ *
+ * Prototypes for non-static functions used in more than one module
+ *
+ *************************************************************************/
+extern char *jsm_ioctl_name(int cmd);
+extern int get_jsm_board_number(void);
+
+int jsm_mgmt_open(struct inode *inode, struct file *file);
+int jsm_mgmt_close(struct inode *inode, struct file *file);
+int jsm_mgmt_ioctl(struct inode *inode, struct file *file, unsigned int cmd, unsigned long arg);
+
+int jsm_tty_write(struct uart_port *port);
+int jsm_tty_register(struct jsm_board *brd);
+
+int jsm_tty_init(struct jsm_board *);
+int jsm_uart_port_init(struct jsm_board *);
+int jsm_remove_uart_port(struct jsm_board *);
+
+void jsm_tty_uninit(struct jsm_board *);
+
+void jsm_input(struct jsm_channel *ch);
+void jsm_carrier(struct jsm_channel *ch);
+void jsm_check_queue_flow_control(struct jsm_channel *ch);
+
+
+int jsm_tty_class_init(void);
+int jsm_tty_class_destroy(void);
+void jsm_create_driver_sysfiles(struct device_driver *);
+void jsm_remove_driver_sysfiles(struct device_driver *);
+void jsm_create_ports_sysfiles(struct jsm_board *, struct device *);
+void jsm_remove_ports_sysfiles(struct jsm_board *, struct device *);
+void jsm_tty_register_device(struct jsm_channel *, struct device *);
+void jsm_tty_unregister_device(struct jsm_channel *);
+
+#endif

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [ patch 6/7] drivers/serial/jsm: new serial device driver
  2005-03-04 21:08   ` Wen Xiong
@ 2005-03-05  6:44     ` Greg KH
  2005-03-07 22:48       ` Wen Xiong
  0 siblings, 1 reply; 21+ messages in thread
From: Greg KH @ 2005-03-05  6:44 UTC (permalink / raw)
  To: Wen Xiong; +Cc: linux-kernel

On Fri, Mar 04, 2005 at 04:08:44PM -0500, Wen Xiong wrote:
> +/************************************************************************
> + * Structure used with ioctl commands for DIGI parameters.
> + ************************************************************************/
> +struct digi_t {
> +	unsigned short	digi_flags;		/* Flags (see above)	*/
> +	unsigned short	digi_maxcps;		/* Max printer CPS	*/
> +	unsigned short	digi_maxchar;		/* Max chars in print queue */
> +	unsigned short	digi_bufsize;		/* Buffer size		*/
> +	unsigned char	digi_onlen;		/* Length of ON string	*/
> +	unsigned char	digi_offlen;		/* Length of OFF string	*/
> +	char		digi_onstr[DIGI_PLEN];	/* Printer on string	*/
> +	char		digi_offstr[DIGI_PLEN];	/* Printer off string	*/
> +	char		digi_term[DIGI_TSIZ];	/* terminal string	*/
> +};

Oops, don't use _t for a structure name please.

> +#ifndef __JSM_DRIVER_H
> +#define __JSM_DRIVER_H
> +
> +#include <linux/kernel.h>
> +#include <linux/version.h>
> +#include <linux/types.h>	/* To pick up the varions Linux types */
> +#include <linux/tty.h>		
> +#include <linux/serial_core.h>
> +#include <linux/serial_reg.h>
> +#include <linux/interrupt.h>	/* For irqreturn_t type */
> +#include <linux/module.h>	
> +#include <linux/moduleparam.h>	
> +#include <linux/kdev_t.h>	
> +#include <linux/pci.h>
> +#include <linux/pci_ids.h>
> +#include <linux/device.h>
> +#include <linux/config.h>

Don't put header files in header files if you can help it.  It really
isn't needed here, and odds are, you are including files you don't
really need for each of the different driver .c files.  The build will
go faster if you don't do that.

Also, check your ordering, some of those .h files already included the
ones above it.

> +#include "digi.h"		/* Digi specific ioctl header */

Why do you have your own ioctls?  Please do not add any new ones to the
kernel.

> +#define DRVSTR	"jsm"		/* Driver name string */

What is this for?

> +#define DPRINTK(nlevel, klevel, fmt, args...) \
> +	(void)((DBG_##nlevel & debug) && \
> +	printk(KERN_##klevel "%s: " fmt, \
> +		__FUNCTION__, ## args)); 

Please use dev_dbg() or at least dev_printk() for this.  It provides
consistancy with the rest of the kernel, and it helps identify your
device much better.

> +#define JSM_MAJOR(x)	(imajor(x))
> +#define JSM_MINOR(x)	(iminor(x))

Not needed, please don't use.

> +#ifndef _POSIX_VDISABLE
> +#define	_POSIX_VDISABLE '\0'
> +#endif

What would have defined that before?

> +/*
> + * Our Global Variables.
> + */
> +extern struct	uart_driver jsm_uart_driver;
> +extern struct	board_ops jsm_neo_ops;
> +extern int	debug;
> +extern int	rawreadok;

Both of these are bad global variable names.

> +extern int	jsm_driver_state;	/* The state of the driver	*/
> +extern char	*jsm_driver_state_text[];/* Array of driver state text */
> +
> +extern spinlock_t jsm_board_head_lock;
> +static LIST_HEAD(jsm_board_head);

Hm, static variable in a header file?  bad...

> +/*************************************************************************
> + *
> + * Prototypes for non-static functions used in more than one module
> + *
> + *************************************************************************/
> +extern char *jsm_ioctl_name(int cmd);
> +extern int get_jsm_board_number(void);

Bad name for a global function, put the "jsm" at the front please.

thanks,

greg k-h

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [ patch 6/7] drivers/serial/jsm: new serial device driver
  2005-03-05  6:44     ` Greg KH
@ 2005-03-07 22:48       ` Wen Xiong
  2005-03-08  6:42         ` Greg KH
  0 siblings, 1 reply; 21+ messages in thread
From: Wen Xiong @ 2005-03-07 22:48 UTC (permalink / raw)
  To: Greg KH; +Cc: Wen Xiong, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 4006 bytes --]

Greg KH wrote:

>On Fri, Mar 04, 2005 at 04:08:44PM -0500, Wen Xiong wrote:
>  
>
>>+/************************************************************************
>>+ * Structure used with ioctl commands for DIGI parameters.
>>+ ************************************************************************/
>>+struct digi_t {
>>+	unsigned short	digi_flags;		/* Flags (see above)	*/
>>+	unsigned short	digi_maxcps;		/* Max printer CPS	*/
>>+	unsigned short	digi_maxchar;		/* Max chars in print queue */
>>+	unsigned short	digi_bufsize;		/* Buffer size		*/
>>+	unsigned char	digi_onlen;		/* Length of ON string	*/
>>+	unsigned char	digi_offlen;		/* Length of OFF string	*/
>>+	char		digi_onstr[DIGI_PLEN];	/* Printer on string	*/
>>+	char		digi_offstr[DIGI_PLEN];	/* Printer off string	*/
>>+	char		digi_term[DIGI_TSIZ];	/* terminal string	*/
>>+};
>>    
>>
>
>Oops, don't use _t for a structure name please.
>
>  
>
>>+#ifndef __JSM_DRIVER_H
>>+#define __JSM_DRIVER_H
>>+
>>+#include <linux/kernel.h>
>>+#include <linux/version.h>
>>+#include <linux/types.h>	/* To pick up the varions Linux types */
>>+#include <linux/tty.h>		
>>+#include <linux/serial_core.h>
>>+#include <linux/serial_reg.h>
>>+#include <linux/interrupt.h>	/* For irqreturn_t type */
>>+#include <linux/module.h>	
>>+#include <linux/moduleparam.h>	
>>+#include <linux/kdev_t.h>	
>>+#include <linux/pci.h>
>>+#include <linux/pci_ids.h>
>>+#include <linux/device.h>
>>+#include <linux/config.h>
>>    
>>
>
>Don't put header files in header files if you can help it.  It really
>isn't needed here, and odds are, you are including files you don't
>really need for each of the different driver .c files.  The build will
>go faster if you don't do that.
>
>Also, check your ordering, some of those .h files already included the
>ones above it.
>
>  
>
>>+#include "digi.h"		/* Digi specific ioctl header */
>>    
>>
>
>Why do you have your own ioctls?  Please do not add any new ones to the
>kernel.
>
>  
>
>>+#define DRVSTR	"jsm"		/* Driver name string */
>>    
>>
>
>What is this for?
>
>  
>
>>+#define DPRINTK(nlevel, klevel, fmt, args...) \
>>+	(void)((DBG_##nlevel & debug) && \
>>+	printk(KERN_##klevel "%s: " fmt, \
>>+		__FUNCTION__, ## args)); 
>>    
>>
>
>Please use dev_dbg() or at least dev_printk() for this.  It provides
>consistancy with the rest of the kernel, and it helps identify your
>device much better.
>
>  
>
>>+#define JSM_MAJOR(x)	(imajor(x))
>>+#define JSM_MINOR(x)	(iminor(x))
>>    
>>
>
>Not needed, please don't use.
>
>  
>
>>+#ifndef _POSIX_VDISABLE
>>+#define	_POSIX_VDISABLE '\0'
>>+#endif
>>    
>>
>
>What would have defined that before?
>
>  
>
>>+/*
>>+ * Our Global Variables.
>>+ */
>>+extern struct	uart_driver jsm_uart_driver;
>>+extern struct	board_ops jsm_neo_ops;
>>+extern int	debug;
>>+extern int	rawreadok;
>>    
>>
>
>Both of these are bad global variable names.
>
>  
>
>>+extern int	jsm_driver_state;	/* The state of the driver	*/
>>+extern char	*jsm_driver_state_text[];/* Array of driver state text */
>>+
>>+extern spinlock_t jsm_board_head_lock;
>>+static LIST_HEAD(jsm_board_head);
>>    
>>
>
>Hm, static variable in a header file?  bad...
>
>  
>
>>+/*************************************************************************
>>+ *
>>+ * Prototypes for non-static functions used in more than one module
>>+ *
>>+ *************************************************************************/
>>+extern char *jsm_ioctl_name(int cmd);
>>+extern int get_jsm_board_number(void);
>>    
>>
>
>Bad name for a global function, put the "jsm" at the front please.
>
>thanks,
>
>greg k-h
>-
>To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
>the body of a message to majordomo@vger.kernel.org
>More majordomo info at  http://vger.kernel.org/majordomo-info.html
>Please read the FAQ at  http://www.tux.org/lkml/
>
>  
>
Thanks for your reviewing!
Since some tools in Digi company need these new ioctls to access device 
driver. I still keep these new ioctls.

Thanks,
wendy

[-- Attachment #2: patch6.jasmine --]
[-- Type: text/plain, Size: 31686 bytes --]

diff -Nuar linux-2.6.11.org/drivers/serial/jsm/digi.h linux-2.6.11.new/drivers/serial/jsm/digi.h
--- linux-2.6.11.org/drivers/serial/jsm/digi.h	1969-12-31 18:00:00.000000000 -0600
+++ linux-2.6.11.new/drivers/serial/jsm/digi.h	2005-03-04 11:22:27.558933144 -0600
@@ -0,0 +1,387 @@
+/************************************************************************
+ * Copyright 2003 Digi International (www.digi.com)
+ *
+ * Copyright (C) 2004 IBM Corporation. All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ * 
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY, EXPRESS OR IMPLIED; without even the 
+ * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 
+ * PURPOSE.  See the GNU General Public License for more details.
+ * 
+ * You should have received a copy of the GNU General Public License 
+ * along with this program; if not, write to the Free Software 
+ * Foundation, Inc., 59 * Temple Place - Suite 330, Boston,
+ * MA  02111-1307, USA.
+ *
+ * Contact Information:
+ * Scott H Kilau <Scott_Kilau@digi.com>
+ * Wendy Xiong   <wendyx@us.ltcfwd.linux.ibm.com>
+ *
+ ***********************************************************************/
+
+#ifndef __DIGI_H
+#define __DIGI_H
+
+/************************************************************************
+ ***	Definitions for Digi ditty(1) command.
+ ************************************************************************/
+
+/************************************************************************
+ * This module provides application access to special Digi
+ * serial line enhancements which are not standard UNIX(tm) features.
+ ************************************************************************/
+
+#if !defined(TIOCMODG)
+
+#define TIOCMODG	('d'<<8) | 250		/* get modem ctrl state	*/
+#define TIOCMODS	('d'<<8) | 251		/* set modem ctrl state	*/
+
+#ifndef TIOCM_LE 
+#define TIOCM_LE	0x01		/* line enable		*/
+#define TIOCM_DTR	0x02		/* data terminal ready	*/
+#define TIOCM_RTS	0x04		/* request to send	*/
+#define TIOCM_ST	0x08		/* secondary transmit	*/
+#define TIOCM_SR	0x10		/* secondary receive	*/
+#define TIOCM_CTS	0x20		/* clear to send	*/
+#define TIOCM_CAR	0x40		/* carrier detect	*/
+#define TIOCM_RNG	0x80		/* ring	indicator	*/
+#define TIOCM_DSR	0x100		/* data set ready	*/
+#define TIOCM_RI	TIOCM_RNG	/* ring (alternate)	*/
+#define TIOCM_CD	TIOCM_CAR	/* carrier detect (alt)	*/
+#endif
+
+#endif
+
+#if !defined(TIOCMSET)
+#define TIOCMSET	('d'<<8) | 252		/* set modem ctrl state	*/
+#define TIOCMGET	('d'<<8) | 253		/* set modem ctrl state	*/
+#endif
+
+#if !defined(TIOCMBIC)
+#define TIOCMBIC	('d'<<8) | 254		/* set modem ctrl state */
+#define TIOCMBIS	('d'<<8) | 255		/* set modem ctrl state */
+#endif
+
+
+#if !defined(TIOCSDTR)
+#define TIOCSDTR	('e'<<8) | 0		/* set DTR		*/
+#define TIOCCDTR	('e'<<8) | 1		/* clear DTR		*/
+#endif
+
+/************************************************************************
+ * Ioctl command arguments for DIGI parameters.
+ ************************************************************************/
+#define DIGI_GETA	('e'<<8) | 94		/* Read params		*/
+#define DIGI_SETA	('e'<<8) | 95		/* Set params		*/
+#define DIGI_SETAW	('e'<<8) | 96		/* Drain & set params	*/
+#define DIGI_SETAF	('e'<<8) | 97		/* Drain, flush & set params */
+#define DIGI_KME	('e'<<8) | 98		/* Read/Write Host	*/
+#define DIGI_GETFLOW	('e'<<8) | 99		/* Get startc/stopc flow */
+#define DIGI_SETFLOW	('e'<<8) | 100		/* Set startc/stopc flow */
+#define DIGI_GETAFLOW	('e'<<8) | 101		/* Get Aux. startc/stopc */
+#define DIGI_SETAFLOW	('e'<<8) | 102		/* Set Aux. startc/stopc */
+#define DIGI_GEDELAY	('d'<<8) | 246		/* Get edelay */
+#define DIGI_SEDELAY	('d'<<8) | 247		/* Set edelay */
+
+struct	digiflow_t {
+	unsigned char	startc;			/* flow cntl start char	*/
+	unsigned char	stopc;			/* flow cntl stop char	*/
+};
+
+#ifdef	FLOW_2200
+#define F2200_GETA	('e'<<8) | 104		/* Get 2x36 flow cntl flags */
+#define F2200_SETAW	('e'<<8) | 105		/* Set 2x36 flow cntl flags */
+#define F2200_MASK	0x03		/* 2200 flow cntl bit mask */
+#define FCNTL_2200	0x01		/* 2x36 terminal flow cntl */
+#define PCNTL_2200	0x02		/* 2x36 printer flow cntl  */
+#define F2200_XON	0xf8
+#define P2200_XON	0xf9
+#define F2200_XOFF	0xfa
+#define P2200_XOFF	0xfb
+
+#define FXOFF_MASK	0x03		/* 2200 flow status mask   */
+#define RCVD_FXOFF	0x01		/* 2x36 Terminal XOFF rcvd */
+#define RCVD_PXOFF	0x02		/* 2x36 Printer XOFF rcvd  */
+#endif
+
+/************************************************************************
+ * Values for digi_flags 
+ ************************************************************************/
+#define DIGI_IXON	0x0001		/* Handle IXON in the FEP	*/
+#define DIGI_FAST	0x0002		/* Fast baud rates		*/
+#define RTSPACE		0x0004		/* RTS input flow control	*/
+#define CTSPACE		0x0008		/* CTS output flow control	*/
+#define DSRPACE		0x0010		/* DSR output flow control	*/
+#define DCDPACE		0x0020		/* DCD output flow control	*/
+#define DTRPACE		0x0040		/* DTR input flow control	*/
+#define DIGI_COOK	0x0080		/* Cooked processing done in FEP */
+#define DIGI_FORCEDCD	0x0100		/* Force carrier		*/
+#define DIGI_ALTPIN	0x0200		/* Alternate RJ-45 pin config	*/
+#define DIGI_AIXON	0x0400		/* Aux flow control in fep	*/
+#define DIGI_PRINTER	0x0800		/* Hold port open for flow cntrl*/
+#define DIGI_PP_INPUT	0x1000		/* Change parallel port to input*/
+#define DIGI_DTR_TOGGLE	0x2000		/* Support DTR Toggle		*/
+#define DIGI_422	0x4000		/* for 422/232 selectable panel */
+#define DIGI_RTS_TOGGLE	0x8000		/* Support RTS Toggle		*/
+
+/************************************************************************
+ * These options are not supported on the comxi.
+ ************************************************************************/
+#define DIGI_COMXI	(DIGI_FAST|DIGI_COOK|DSRPACE|DCDPACE|DTRPACE)
+
+#define DIGI_PLEN	28		/* String length		*/
+#define DIGI_TSIZ	10		/* Terminal string len		*/
+
+/************************************************************************
+ * Structure used with ioctl commands for DIGI parameters.
+ ************************************************************************/
+struct digi_t {
+	unsigned short	digi_flags;		/* Flags (see above)	*/
+	unsigned short	digi_maxcps;		/* Max printer CPS	*/
+	unsigned short	digi_maxchar;		/* Max chars in print queue */
+	unsigned short	digi_bufsize;		/* Buffer size		*/
+	unsigned char	digi_onlen;		/* Length of ON string	*/
+	unsigned char	digi_offlen;		/* Length of OFF string	*/
+	char		digi_onstr[DIGI_PLEN];	/* Printer on string	*/
+	char		digi_offstr[DIGI_PLEN];	/* Printer off string	*/
+	char		digi_term[DIGI_TSIZ];	/* terminal string	*/
+};
+
+#define PCXI_TYPE	1	/* Board type at the designated port is a PC/Xi */
+#define PCXM_TYPE	2	/* Board type at the designated port is a PC/Xm */
+#define PCXE_TYPE	3	/* Board type at the designated port is a PC/Xe */
+#define MCXI_TYPE	4	/* Board type at the designated port is a MC/Xi */
+#define COMXI_TYPE	5	/* Board type at the designated port is a COM/Xi */
+
+			 /* Non-Zero Result codes. */
+#define RESULT_NOBDFND	1	/* A Digi product at that port is not config installed */ 
+#define RESULT_NODESCT	2	/* A memory descriptor was not obtainable */ 
+#define RESULT_NOOSSIG	3	/* FEP/OS signature was not detected on the board */
+#define RESULT_TOOSML	4	/* Too small an area to shrink.  */
+#define RESULT_NOCHAN	5	/* Channel structure for the board was not found */
+
+/************************************************************************
+ * Structure to get driver status information
+ ************************************************************************/
+struct digi_dinfo {
+	u8	dinfo_nboards;		/* # boards configured	*/
+	char	dinfo_reserved[12];	/* for future expansion */
+	char	dinfo_version[16];	/* driver version	*/
+};
+
+/************************************************************************
+ * Structure used with ioctl commands for per-board information
+ *
+ * physsize and memsize differ when board has "windowed" memory
+ ************************************************************************/
+struct digi_info {
+	unsigned int	info_bdnum;		/* Board number (0 based)  */
+	unsigned int	info_ioport;		/* io port address	   */
+	unsigned long	info_physaddr;		/* memory address	   */
+	unsigned int	info_physsize;		/* Size of host mem window */
+	unsigned int	info_memsize;		/* Amount of dual-port mem */
+						/* on board		   */
+	unsigned short	info_bdtype;		/* Board type		   */
+	unsigned short	info_nports;		/* number of ports	   */
+	char		info_bdstate;		/* board state		   */
+	char		info_reserved[7];	/* for future expansion	   */
+};
+
+struct digi_stat {
+	unsigned int	info_chan;		/* Channel number (0 based)  */
+	unsigned int	info_brd;		/* Board number (0 based)  */
+	unsigned int	info_cflag;		/* cflag for channel	   */
+	unsigned int	info_iflag;		/* iflag for channel	   */
+	unsigned int	info_oflag;		/* oflag for channel	   */
+	unsigned int	info_mstat;		/* mstat for channel	   */
+	unsigned int	info_tx_data;		/* tx_data for channel	   */
+	unsigned int	info_rx_data;		/* rx_data for channel	   */
+	unsigned int	info_hflow;		/* hflow for channel	   */
+	unsigned int	info_reserved[8];	/* for future expansion    */
+};
+
+/***********************************************************************
+ *
+ * Structure used with ioctl commands for per-channel information
+ *
+ ************************************************************************/
+struct digi_ch {
+	unsigned int	info_bdnum;		/* Board number (0 based)  */
+	unsigned int	info_channel;		/* Channel index number	   */
+	unsigned int	info_ch_cflag;		/* Channel cflag   	   */
+	unsigned int	info_ch_iflag;		/* Channel iflag   	   */
+	unsigned int	info_ch_oflag;		/* Channel oflag   	   */
+	unsigned int	info_chsize;		/* Channel structure size  */
+	unsigned int	info_sleep_stat;	/* sleep status		   */
+	dev_t		info_dev;		/* device number	   */
+	unsigned char	info_initstate;		/* Channel init state	   */
+	unsigned char	info_running;		/* Channel running state   */
+	int		reserved[8];		/* reserved for future use */
+};
+
+/*
+* This structure is used with the DIGI_FEPCMD ioctl to 
+* tell the driver which port to send the command for.
+*/
+struct digi_cmd {
+	int	cmd;
+	int	word;
+	int	ncmds;
+	int	chan; /* channel index (zero based) */
+	int	bdid; /* board index (zero based) */
+};
+
+struct digi_getbuffer /* Struct for holding buffer use counts */
+{
+	unsigned long tIn;
+	unsigned long tOut;
+	unsigned long rxbuf;
+	unsigned long txbuf;
+	unsigned long txdone;
+};
+
+struct digi_getcounter
+{
+	unsigned long norun;		/* number of UART overrun errors */
+	unsigned long noflow;		/* number of buffer overflow errors */
+	unsigned long nframe;		/* number of framing errors */
+	unsigned long nparity;		/* number of parity errors */
+	unsigned long nbreak;		/* number of breaks received */
+	unsigned long rbytes;		/* number of received bytes */
+	unsigned long tbytes;		/* number of bytes transmitted fully */
+};
+
+/*
+*  info_sleep_stat defines
+*/
+#define INFO_RUNWAIT	0x0001
+#define INFO_WOPEN	0x0002
+#define INFO_TTIOW	0x0004
+#define INFO_CH_RWAIT	0x0008
+#define INFO_CH_WEMPTY	0x0010
+#define INFO_CH_WLOW	0x0020
+#define INFO_XXBUF_BUSY 0x0040
+
+
+/* Board type definitions */
+
+#define SUBTYPE		0007
+#define T_PCXI		0000
+#define T_PCXM		0001
+#define T_PCXE		0002
+#define T_PCXR		0003
+#define T_SP		0004
+#define T_SP_PLUS	0005
+
+#define T_HERC		0000
+#define T_HOU		0001
+#define T_LON		0002
+#define T_CHA		0003
+
+#define T_NEO		0000
+#define T_CLASSIC	0001
+
+#define FAMILY		0070
+#define T_COMXI		0000
+#define T_PCXX		0010
+#define T_CX		0020
+#define T_EPC		0030
+#define T_PCLITE	0040
+#define T_SPXX		0050
+#define T_AVXX		0060
+#define T_DXB		0070
+#define T_A2K_4_8	0070
+#define BUSTYPE		0700
+#define T_ISABUS	0000
+#define T_MCBUS		0100
+#define T_EISABUS	0200
+#define T_PCIBUS	0400
+
+/* Board State Definitions */
+
+#define BD_RUNNING	0x0
+#define BD_REASON	0x7f
+#define BD_NOTFOUND	0x1
+#define BD_NOIOPORT	0x2
+#define BD_NOMEM	0x3
+#define BD_NOBIOS	0x4
+#define BD_NOFEP	0x5
+#define BD_FAILED	0x6
+#define BD_ALLOCATED	0x7
+#define BD_TRIBOOT	0x8
+#define BD_BADKME	0x80
+
+#define DIGI_SPOLL		('d'<<8) | 254	/* change poller rate   */
+
+#define DIGI_SETCUSTOMBAUD	_IOW('e', 106, int)	/* Set integer baud rate */
+#define DIGI_GETCUSTOMBAUD	_IOR('e', 107, int)	/* Get integer baud rate */
+
+#define DIGI_REALPORT_GETBUFFERS	('e'<<8 ) | 108
+#define DIGI_REALPORT_SENDIMMEDIATE	('e'<<8 ) | 109
+#define DIGI_REALPORT_GETCOUNTERS	('e'<<8 ) | 110
+#define DIGI_REALPORT_GETEVENTS		('e'<<8 ) | 111
+
+#define EV_OPU		0x0001		//!<Output paused by client
+#define EV_OPS		0x0002		//!<Output paused by reqular sw flowctrl  
+#define EV_OPX		0x0004		//!<Output paused by extra sw flowctrl
+#define EV_OPH		0x0008		//!<Output paused by hw flowctrl
+#define EV_OPT		0x0800		//!<Output paused for RTS Toggle predelay
+
+#define EV_IPU		0x0010		//!<Input paused unconditionally by user
+#define EV_IPS		0x0020		//!<Input paused by high/low water marks
+#define EV_IPA		0x0400		//!<Input paused by pattern alarm module
+
+#define EV_TXB		0x0040		//!<Transmit break pending
+#define EV_TXI		0x0080		//!<Transmit immediate pending
+#define EV_TXF		0x0100		//!<Transmit flowctrl char pending
+#define EV_RXB		0x0200		//!<Break received
+
+#define EV_OPALL	0x080f		//!<Output pause flags
+#define EV_IPALL	0x0430		//!<Input pause flags
+
+/* 
+ * This structure holds data needed for the intelligent <--> nonintelligent
+ * DPA translation
+ */
+struct ni_info {
+	int board;
+	int channel;
+	int dtr;
+	int rts;
+	int cts;
+	int dsr;
+	int ri;
+	int dcd;
+	int curtx;
+	int currx;
+	unsigned short iflag;
+	unsigned short oflag;
+	unsigned short cflag;
+	unsigned short lflag;
+	unsigned int mstat;
+	unsigned char hflow;
+
+	unsigned char xmit_stopped;
+	unsigned char recv_stopped;
+
+	unsigned int baud;
+};
+
+/* Ioctls needed for dpa operation */
+
+#define DIGI_GETSTAT	('d'<<8) | 244		/* get board info	*/
+#define DIGI_GETCH	('d'<<8) | 245		/* get board info	*/
+#define DIGI_GETDD	('d'<<8) | 248		/* get driver info      */
+#define DIGI_GETBD	('d'<<8) | 249		/* get board info       */
+#define DIGI_GET_NI_INFO ('d'<<8) | 250		/* nonintelligent state snfo */
+
+/* Other special ioctls */
+#define DIGI_TIMERIRQ	('d'<<8) | 251		/* Enable/disable RS_TIMER use */
+#define DIGI_LOOPBACK	('d'<<8) | 252		/* Enable/disable UART internal loopback */
+
+#endif /* DIGI_H */
diff -Nuar linux-2.6.11.org/drivers/serial/jsm/jsm_driver.h linux-2.6.11.new/drivers/serial/jsm/jsm_driver.h
--- linux-2.6.11.org/drivers/serial/jsm/jsm_driver.h	1969-12-31 18:00:00.000000000 -0600
+++ linux-2.6.11.new/drivers/serial/jsm/jsm_driver.h	2005-03-04 11:22:19.222869456 -0600
@@ -0,0 +1,465 @@
+/************************************************************************
+ * Copyright 2003 Digi International (www.digi.com)
+ *
+ * Copyright (C) 2004 IBM Corporation. All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ * 
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY, EXPRESS OR IMPLIED; without even the 
+ * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 
+ * PURPOSE.  See the GNU General Public License for more details.
+ * 
+ * You should have received a copy of the GNU General Public License 
+ * along with this program; if not, write to the Free Software 
+ * Foundation, Inc., 59 * Temple Place - Suite 330, Boston,
+ * MA  02111-1307, USA.
+ *
+ * Contact Information:
+ * Scott H Kilau <Scott_Kilau@digi.com>
+ * Wendy Xiong   <wendyx@us.ltcfwd.linux.ibm.com>
+ *
+ ***********************************************************************/
+
+#ifndef __JSM_DRIVER_H
+#define __JSM_DRIVER_H
+
+#include <linux/kernel.h>
+#include <linux/version.h>
+#include <linux/types.h>	/* To pick up the varions Linux types */
+#include <linux/tty.h>		
+#include <linux/serial_core.h>
+#include <linux/serial_reg.h>
+#include <linux/interrupt.h>	/* For irqreturn_t type */
+#include <linux/module.h>	
+#include <linux/moduleparam.h>	
+#include <linux/kdev_t.h>	
+#include <linux/pci.h>
+#include <linux/pci_ids.h>
+#include <linux/device.h>
+#include <linux/config.h>
+
+
+#include "digi.h"		/* Digi specific ioctl header */
+
+#define DRVSTR	"jsm"		/* Driver name string */
+
+#define TRC_TO_IOCTL	1
+
+/*
+ * Debugging levels can be set using debug insmod variable
+ * They can also be compiled out completely.
+ */
+enum {
+	DBG_INIT	= 0x01,
+	DBG_BASIC	= 0x02,
+	DBG_CORE	= 0x04,
+	DBG_OPEN	= 0x08,
+	DBG_CLOSE	= 0x10,
+	DBG_READ	= 0x20,
+	DBG_WRITE	= 0x40,
+	DBG_IOCTL	= 0x80,
+	DBG_PROC	= 0x100,
+	DBG_PARAM	= 0x200,
+	DBG_PSCAN	= 0x400,
+	DBG_EVENT	= 0x800,
+	DBG_DRAIN	= 0x1000,
+	DBG_MSIGS	= 0x2000,
+	DBG_MGMT	= 0x4000,
+	DBG_INTR	= 0x8000,
+	DBG_CARR	= 0x10000,
+};
+
+#define DPRINTK(nlevel, klevel, fmt, args...) \
+	(void)((DBG_##nlevel & debug) && \
+	printk(KERN_##klevel "%s: " fmt, \
+		__FUNCTION__, ## args)); 
+	
+#define MAXPORTS	8
+#define MAX_STOPS_SENT	5
+
+/* 4 extra for alignment play space */
+#define WRITEBUFLEN	((4096) + 4)
+#define MYFLIPLEN	N_TTY_BUF_SIZE
+
+#define JSM_MAJOR(x)	(imajor(x))
+#define JSM_MINOR(x)	(iminor(x))
+
+#ifndef _POSIX_VDISABLE
+#define	_POSIX_VDISABLE '\0'
+#endif
+
+/*
+ * All the possible states the driver can be while being loaded.
+ */
+enum {
+	DRIVER_INITIALIZED = 0,
+	DRIVER_READY
+};
+
+/*
+ * All the possible states the board can be while booting up.
+ */
+enum {
+	BOARD_FAILED = 0,
+	BOARD_FOUND,
+	BOARD_READY
+};
+
+struct board_id {
+	u8 *name;
+	u32 maxports;
+};
+
+struct jsm_board;
+struct jsm_channel;
+
+/************************************************************************
+ * Per board operations structure					*
+ ************************************************************************/
+struct board_ops {
+	irqreturn_t (*intr) (int irq, void *voidbrd, struct pt_regs *regs);
+	void (*uart_init) (struct jsm_channel *ch);
+	void (*uart_off) (struct jsm_channel *ch);
+	void (*param) (struct jsm_channel *ch);
+	void (*assert_modem_signals) (struct jsm_channel *ch);
+	void (*flush_uart_write) (struct jsm_channel *ch);
+	void (*flush_uart_read) (struct jsm_channel *ch);
+	void (*disable_receiver) (struct jsm_channel *ch);
+	void (*enable_receiver) (struct jsm_channel *ch);
+	void (*send_break) (struct jsm_channel *ch);
+	void (*clear_break) (struct jsm_channel *ch, int);
+	void (*send_start_character) (struct jsm_channel *ch);
+	void (*send_stop_character) (struct jsm_channel *ch);
+	void (*copy_data_from_queue_to_uart) (struct jsm_channel *ch);
+	u32 (*get_uart_bytes_left) (struct jsm_channel *ch);
+	void (*send_immediate_char) (struct jsm_channel *ch, unsigned char);
+};
+
+/*
+ *	Per-board information
+ */
+struct jsm_board
+{
+	int		boardnum;	/* Board number: 0-32 */
+
+	int		type;		/* Type of board */
+	char		*name;		/* Product Name */
+	u8		rev;		/* PCI revision ID */
+	struct pci_dev	*pci_dev;
+	u32		maxports;	/* MAX ports this board can handle */
+
+	spinlock_t	bd_lock;	/* Used to protect board */
+
+	spinlock_t	bd_intr_lock;	/* Used to protect the poller tasklet and
+					 * the interrupt routine from each other.
+					 */
+
+	u32		state;		/* State of card. */
+	wait_queue_head_t state_wait;	/* Place to sleep on for state change */
+
+	u32		nasync;		/* Number of ports on card */
+
+	u32		irq;		/* Interrupt request number */
+	u64		intr_count;	/* Count of interrupts */
+
+	u64		membase;	/* Start of base memory of the card */
+	u64		membase_end;	/* End of base memory of the card */
+
+	u8		*re_map_membase;/* Remapped memory of the card */
+
+	u64		iobase;		/* Start of io base of the card */
+	u64		iobase_end;	/* End of io base of the card */
+
+	u32		bd_uart_offset;	/* Space between each UART */
+
+	struct jsm_channel *channels[MAXPORTS]; /* array of pointers to our channels. */
+
+	u32		jsm_major_serial_registered;
+	u32		jsm_serial_major;
+
+	char		*flipbuf;	/* Our flip buffer, alloced if board is found */
+
+	u16		dpatype;	/* The board "type", as defined by DPA */
+	u16		dpastatus;	/* The board "status", as defined by DPA */
+
+	u32		bd_dividend;	/* Board/UARTs specific dividend */
+
+	struct board_ops *bd_ops;
+
+	struct list_head jsm_board_entry;
+};
+
+/************************************************************************ 
+ * Device flag definitions for ch_flags.
+ ************************************************************************/
+#define CH_PRON		0x0001		/* Printer on string		*/
+#define CH_STOP		0x0002		/* Output is stopped		*/
+#define CH_STOPI	0x0004		/* Input is stopped		*/
+#define CH_CD		0x0008		/* Carrier is present		*/
+#define CH_FCAR		0x0010		/* Carrier forced on		*/
+#define CH_HANGUP	0x0020		/* Hangup received		*/
+
+#define CH_RECEIVER_OFF	0x0040		/* Receiver is off		*/
+#define CH_OPENING	0x0080		/* Port in fragile open state	*/
+#define CH_CLOSING	0x0100		/* Port in fragile close state	*/
+#define CH_FIFO_ENABLED 0x0200		/* Port has FIFOs enabled	*/
+#define CH_TX_FIFO_EMPTY 0x0400		/* TX Fifo is completely empty	*/
+#define CH_TX_FIFO_LWM	0x0800		/* TX Fifo is below Low Water	*/
+#define CH_BREAK_SENDING 0x1000		/* Break is being sent		*/
+#define CH_LOOPBACK 0x2000		/* Channel is in lookback mode	*/
+#define CH_FLIPBUF_IN_USE 0x4000	/* Channel's flipbuf is in use	*/
+#define CH_BAUD0	0x08000		/* Used for checking B0 transitions */
+
+/* Our Read/Error/Write queue sizes */
+#define RQUEUEMASK	0x1FFF		/* 8 K - 1 */
+#define EQUEUEMASK	0x1FFF		/* 8 K - 1 */
+#define WQUEUEMASK	0x0FFF		/* 4 K - 1 */
+#define RQUEUESIZE	(RQUEUEMASK + 1)
+#define EQUEUESIZE	RQUEUESIZE
+#define WQUEUESIZE	(WQUEUEMASK + 1)
+
+/************************************************************************ 
+ * Channel information structure.
+ ************************************************************************/
+struct jsm_channel {
+	struct uart_port uart_port;
+	struct jsm_board	*ch_bd;		/* Board structure pointer	*/
+
+	spinlock_t	ch_lock;	/* provide for serialization */
+	wait_queue_head_t ch_flags_wait;
+
+	u32		ch_portnum;	/* Port number, 0 offset.	*/
+	u32		ch_open_count;	/* open count			*/
+	u32		ch_flags;	/* Channel flags		*/
+
+	u64		ch_close_delay;	/* How long we should drop RTS/DTR for */
+
+	u64		ch_cpstime;	/* Time for CPS calculations	*/
+
+	tcflag_t	ch_c_iflag;	/* channel iflags		*/
+	tcflag_t	ch_c_cflag;	/* channel cflags		*/
+	tcflag_t	ch_c_oflag;	/* channel oflags		*/
+	tcflag_t	ch_c_lflag;	/* channel lflags		*/
+	u8		ch_stopc;	/* Stop character		*/
+	u8		ch_startc;	/* Start character		*/
+
+	u32		ch_old_baud;	/* Cache of the current baud */
+	u32		ch_custom_speed;/* Custom baud, if set */
+
+	u32		ch_wopen;	/* Waiting for open process cnt */
+
+	u8		ch_mostat;	/* FEP output modem status	*/
+	u8		ch_mistat;	/* FEP input modem status	*/
+
+	struct neo_uart_struct *ch_neo_uart;	/* Pointer to the "mapped" UART struct */
+	u8		ch_cached_lsr;	/* Cached value of the LSR register */
+
+	u8		*ch_rqueue;	/* Our read queue buffer - malloc'ed */
+	u16		ch_r_head;	/* Head location of the read queue */
+	u16		ch_r_tail;	/* Tail location of the read queue */
+
+	u8		*ch_equeue;	/* Our error queue buffer - malloc'ed */
+	u16		ch_e_head;	/* Head location of the error queue */
+	u16		ch_e_tail;	/* Tail location of the error queue */
+
+	u8		*ch_wqueue;	/* Our write queue buffer - malloc'ed */
+	u16		ch_w_head;	/* Head location of the write queue */
+	u16		ch_w_tail;	/* Tail location of the write queue */
+
+	u64		ch_rxcount;	/* total of data received so far */
+	u64		ch_txcount;	/* total of data transmitted so far */
+
+	u8		ch_r_tlevel;	/* Receive Trigger level */
+	u8		ch_t_tlevel;	/* Transmit Trigger level */
+
+	u8		ch_r_watermark;	/* Receive Watermark */
+
+
+	u32		ch_stops_sent;	/* How many times I have sent a stop character
+					 * to try to stop the other guy sending.
+					 */
+	u64		ch_err_parity;	/* Count of parity errors on channel */
+	u64		ch_err_frame;	/* Count of framing errors on channel */
+	u64		ch_err_break;	/* Count of breaks on channel */
+	u64		ch_err_overrun; /* Count of overruns on channel */
+
+	u64		ch_xon_sends;	/* Count of xons transmitted */
+	u64		ch_xoff_sends;	/* Count of xoffs transmitted */
+};
+
+/************************************************************************ 
+ * Per channel/port NEO UART structure					*
+ ************************************************************************
+ *		Base Structure Entries Usage Meanings to Host		*
+ *									*
+ *	W = read write		R = read only				* 
+ *			U = Unused.					*
+ ************************************************************************/
+
+struct neo_uart_struct {
+	 u8 txrx;		/* WR	RHR/THR - Holding Reg */
+	 u8 ier;		/* WR	IER - Interrupt Enable Reg */
+	 u8 isr_fcr;		/* WR	ISR/FCR - Interrupt Status Reg/Fifo Control Reg */
+	 u8 lcr;		/* WR	LCR - Line Control Reg */
+	 u8 mcr;		/* WR	MCR - Modem Control Reg */
+	 u8 lsr;		/* WR	LSR - Line Status Reg */
+	 u8 msr;		/* WR	MSR - Modem Status Reg */
+	 u8 spr;		/* WR	SPR - Scratch Pad Reg */
+	 u8 fctr;		/* WR	FCTR - Feature Control Reg */
+	 u8 efr;		/* WR	EFR - Enhanced Function Reg */
+	 u8 tfifo;		/* WR	TXCNT/TXTRG - Transmit FIFO Reg */	
+	 u8 rfifo;		/* WR	RXCNT/RXTRG - Recieve FIFO Reg */
+	 u8 xoffchar1;	/* WR	XOFF 1 - XOff Character 1 Reg */
+	 u8 xoffchar2;	/* WR	XOFF 2 - XOff Character 2 Reg */
+	 u8 xonchar1;	/* WR	XON 1 - Xon Character 1 Reg */
+	 u8 xonchar2;	/* WR	XON 2 - XOn Character 2 Reg */
+
+	 u8 reserved1[0x2ff - 0x200]; /* U	Reserved by Exar */
+	 u8 txrxburst[64];	/* RW	64 bytes of RX/TX FIFO Data */
+	 u8 reserved2[0x37f - 0x340]; /* U	Reserved by Exar */
+	 u8 rxburst_with_errors[64];	/* R	64 bytes of RX FIFO Data + LSR */
+};
+
+/* Where to read the extended interrupt register (32bits instead of 8bits) */
+#define	UART_17158_POLL_ADDR_OFFSET	0x80
+
+/*
+ * These are the redefinitions for the FCTR on the XR17C158, since
+ * Exar made them different than their earlier design. (XR16C854)
+ */
+
+/* These are only applicable when table D is selected */
+#define UART_17158_FCTR_RTS_NODELAY	0x00
+#define UART_17158_FCTR_RTS_4DELAY	0x01
+#define UART_17158_FCTR_RTS_6DELAY	0x02
+#define UART_17158_FCTR_RTS_8DELAY	0x03
+#define UART_17158_FCTR_RTS_12DELAY	0x12
+#define UART_17158_FCTR_RTS_16DELAY	0x05
+#define UART_17158_FCTR_RTS_20DELAY	0x13
+#define UART_17158_FCTR_RTS_24DELAY	0x06
+#define UART_17158_FCTR_RTS_28DELAY	0x14
+#define UART_17158_FCTR_RTS_32DELAY	0x07
+#define UART_17158_FCTR_RTS_36DELAY	0x16
+#define UART_17158_FCTR_RTS_40DELAY	0x08
+#define UART_17158_FCTR_RTS_44DELAY	0x09
+#define UART_17158_FCTR_RTS_48DELAY	0x10
+#define UART_17158_FCTR_RTS_52DELAY	0x11
+
+#define UART_17158_FCTR_RTS_IRDA	0x10
+#define UART_17158_FCTR_RS485		0x20
+#define UART_17158_FCTR_TRGA		0x00
+#define UART_17158_FCTR_TRGB		0x40
+#define UART_17158_FCTR_TRGC		0x80
+#define UART_17158_FCTR_TRGD		0xC0
+
+/* 17158 trigger table selects.. */
+#define UART_17158_FCTR_BIT6		0x40
+#define UART_17158_FCTR_BIT7		0x80
+
+/* 17158 TX/RX memmapped buffer offsets */
+#define UART_17158_RX_FIFOSIZE		64
+#define UART_17158_TX_FIFOSIZE		64
+
+/* 17158 Extended IIR's */
+#define UART_17158_IIR_RDI_TIMEOUT	0x0C	/* Receiver data TIMEOUT */
+#define UART_17158_IIR_XONXOFF		0x10	/* Received an XON/XOFF char */
+#define UART_17158_IIR_HWFLOW_STATE_CHANGE 0x20	/* CTS/DSR or RTS/DTR state change */
+#define UART_17158_IIR_FIFO_ENABLED	0xC0	/* 16550 FIFOs are Enabled */
+
+/*
+ * These are the extended interrupts that get sent
+ * back to us from the UART's 32bit interrupt register
+ */
+#define UART_17158_RX_LINE_STATUS	0x1	/* RX Ready */
+#define UART_17158_RXRDY_TIMEOUT	0x2	/* RX Ready Timeout */
+#define UART_17158_TXRDY		0x3	/* TX Ready */
+#define UART_17158_MSR			0x4	/* Modem State Change */
+#define UART_17158_TX_AND_FIFO_CLR	0x40	/* Transmitter Holding Reg Empty */
+#define UART_17158_RX_FIFO_DATA_ERROR	0x80	/* UART detected an RX FIFO Data error */
+
+/*
+ * These are the EXTENDED definitions for the 17C158's Interrupt
+ * Enable Register.
+ */
+#define UART_17158_EFR_ECB	0x10	/* Enhanced control bit */
+#define UART_17158_EFR_IXON	0x2	/* Receiver compares Xon1/Xoff1 */
+#define UART_17158_EFR_IXOFF	0x8	/* Transmit Xon1/Xoff1 */
+#define UART_17158_EFR_RTSDTR	0x40	/* Auto RTS/DTR Flow Control Enable */
+#define UART_17158_EFR_CTSDSR	0x80	/* Auto CTS/DSR Flow COntrol Enable */
+
+#define UART_17158_XOFF_DETECT	0x1	/* Indicates whether chip saw an incoming XOFF char  */
+#define UART_17158_XON_DETECT	0x2	/* Indicates whether chip saw an incoming XON char */
+
+#define UART_17158_IER_RSVD1	0x10	/* Reserved by Exar */
+#define UART_17158_IER_XOFF	0x20	/* Xoff Interrupt Enable */
+#define UART_17158_IER_RTSDTR	0x40	/* Output Interrupt Enable */
+#define UART_17158_IER_CTSDSR	0x80	/* Input Interrupt Enable */
+
+#define PCI_DEVICE_NEO_4_PCI_NAME		"Neo 4 PCI"
+#define PCI_DEVICE_NEO_8_PCI_NAME		"Neo 8 PCI"
+#define PCI_DEVICE_NEO_2DB9_PCI_NAME		"Neo 2 - DB9 Universal PCI"
+#define PCI_DEVICE_NEO_2DB9PRI_PCI_NAME		"Neo 2 - DB9 Universal PCI - Powered Ring Indicator"
+#define PCI_DEVICE_NEO_2RJ45_PCI_NAME		"Neo 2 - RJ45 Universal PCI"
+#define PCI_DEVICE_NEO_2RJ45PRI_PCI_NAME	"Neo 2 - RJ45 Universal PCI - Powered Ring Indicator"
+#define PCI_DEVICE_NEO_1_422_PCI_NAME		"Neo 1 422 PCI"
+#define PCI_DEVICE_NEO_1_422_485_PCI_NAME	"Neo 1 422/485 PCI"
+#define PCI_DEVICE_NEO_2_422_485_PCI_NAME	"Neo 2 422/485 PCI"
+
+/*
+ * Our Global Variables.
+ */
+extern struct	uart_driver jsm_uart_driver;
+extern struct	board_ops jsm_neo_ops;
+extern int	debug;
+extern int	rawreadok;
+
+extern int	jsm_driver_state;	/* The state of the driver	*/
+extern char	*jsm_driver_state_text[];/* Array of driver state text */
+
+extern spinlock_t jsm_board_head_lock;
+static LIST_HEAD(jsm_board_head);
+
+/*************************************************************************
+ *
+ * Prototypes for non-static functions used in more than one module
+ *
+ *************************************************************************/
+extern char *jsm_ioctl_name(int cmd);
+extern int get_jsm_board_number(void);
+
+int jsm_mgmt_open(struct inode *inode, struct file *file);
+int jsm_mgmt_close(struct inode *inode, struct file *file);
+int jsm_mgmt_ioctl(struct inode *inode, struct file *file, unsigned int cmd, unsigned long arg);
+
+int jsm_tty_write(struct uart_port *port);
+int jsm_tty_register(struct jsm_board *brd);
+
+int jsm_tty_init(struct jsm_board *);
+int jsm_uart_port_init(struct jsm_board *);
+int jsm_remove_uart_port(struct jsm_board *);
+
+void jsm_tty_uninit(struct jsm_board *);
+
+void jsm_input(struct jsm_channel *ch);
+void jsm_carrier(struct jsm_channel *ch);
+void jsm_check_queue_flow_control(struct jsm_channel *ch);
+
+
+int jsm_tty_class_init(void);
+int jsm_tty_class_destroy(void);
+void jsm_create_driver_sysfiles(struct device_driver *);
+void jsm_remove_driver_sysfiles(struct device_driver *);
+void jsm_create_ports_sysfiles(struct jsm_board *, struct device *);
+void jsm_remove_ports_sysfiles(struct jsm_board *, struct device *);
+void jsm_tty_register_device(struct jsm_channel *, struct device *);
+void jsm_tty_unregister_device(struct jsm_channel *);
+
+#endif

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [ patch 6/7] drivers/serial/jsm: new serial device driver
  2005-03-07 22:48       ` Wen Xiong
@ 2005-03-08  6:42         ` Greg KH
  2005-03-08 18:42           ` Wen Xiong
  0 siblings, 1 reply; 21+ messages in thread
From: Greg KH @ 2005-03-08  6:42 UTC (permalink / raw)
  To: Wen Xiong; +Cc: linux-kernel

On Mon, Mar 07, 2005 at 05:48:56PM -0500, Wen Xiong wrote:
> Since some tools in Digi company need these new ioctls to access device 
> driver. I still keep these new ioctls.

What tools?  What are they used for?  Why do they need them?  Why can't
they just use the sysfs files?  

As the driver isn't in the kernel tree, there should not be any users
expecting these ioctls to be around, right?

thanks,

greg k-h

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [ patch 6/7] drivers/serial/jsm: new serial device driver
  2005-03-08  6:42         ` Greg KH
@ 2005-03-08 18:42           ` Wen Xiong
  2005-03-09  6:04             ` Greg KH
  0 siblings, 1 reply; 21+ messages in thread
From: Wen Xiong @ 2005-03-08 18:42 UTC (permalink / raw)
  To: Greg KH; +Cc: Wen Xiong, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 1525 bytes --]

Greg KH wrote:

>On Mon, Mar 07, 2005 at 05:48:56PM -0500, Wen Xiong wrote:
>  
>
>>Since some tools in Digi company need these new ioctls to access device 
>>driver. I still keep these new ioctls.
>>    
>>
>
>What tools?  What are they used for?  Why do they need them?  Why can't
>they just use the sysfs files?  
>
>As the driver isn't in the kernel tree, there should not be any users
>expecting these ioctls to be around, right?
>
>thanks,
>
>greg k-h
>-
>To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
>the body of a message to majordomo@vger.kernel.org
>More majordomo info at  http://vger.kernel.org/majordomo-info.html
>Please read the FAQ at  http://www.tux.org/lkml/
>
>  
>
Hi Greg,
I exchanged emails with digi developer,  I scrubbed out some structs and 
ioctls aren't being used by this driver.
Only keep some structures for management ports. After scrubbed the 
digi.h, I combined two headers to one header.
Hope you like  it this time.

Thanks,
wendy

The following email I got from Scott Kilau in digi:
Scott Kilau wrote:

        The DPA program is very old, and is shared among other drivers 
and OS's,
        so changing the code to read the sysfs instead of doing ioctls 
is not possible.
        However, any *new* tools I write, will use sysfs, which is why 
we need to have both the ioctl calls and sysfs files.
        The digi.h file has extra structures and ioctls that may not be 
used in the driver, as that header
        is shared among other drivers and OS's.



[-- Attachment #2: patch6.jasmine --]
[-- Type: text/plain, Size: 19097 bytes --]

diff -Nuar linux-2.6.11.org/drivers/serial/jsm/jsm_driver.h linux-2.6.11.new/drivers/serial/jsm/jsm_driver.h
--- linux-2.6.11.org/drivers/serial/jsm/jsm_driver.h	1969-12-31 18:00:00.000000000 -0600
+++ linux-2.6.11.new/drivers/serial/jsm/jsm_driver.h	2005-03-08 12:19:05.204062432 -0600
@@ -0,0 +1,526 @@
+/************************************************************************
+ * Copyright 2003 Digi International (www.digi.com)
+ *
+ * Copyright (C) 2004 IBM Corporation. All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ * 
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY, EXPRESS OR IMPLIED; without even the 
+ * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 
+ * PURPOSE.  See the GNU General Public License for more details.
+ * 
+ * You should have received a copy of the GNU General Public License 
+ * along with this program; if not, write to the Free Software 
+ * Foundation, Inc., 59 * Temple Place - Suite 330, Boston,
+ * MA  02111-1307, USA.
+ *
+ * Contact Information:
+ * Scott H Kilau <Scott_Kilau@digi.com>
+ * Wendy Xiong   <wendyx@us.ltcfwd.linux.ibm.com>
+ *
+ ***********************************************************************/
+
+#ifndef __JSM_DRIVER_H
+#define __JSM_DRIVER_H
+
+#include <linux/kernel.h>
+#include <linux/version.h>
+#include <linux/types.h>	/* To pick up the varions Linux types */
+#include <linux/tty.h>
+#include <linux/serial_core.h>
+#include <linux/device.h>
+#include <linux/ioctl.h>
+
+/*
+ * Debugging levels can be set using debug insmod variable
+ * They can also be compiled out completely.
+ */
+enum {
+	DBG_INIT	= 0x01,
+	DBG_BASIC	= 0x02,
+	DBG_CORE	= 0x04,
+	DBG_OPEN	= 0x08,
+	DBG_CLOSE	= 0x10,
+	DBG_READ	= 0x20,
+	DBG_WRITE	= 0x40,
+	DBG_IOCTL	= 0x80,
+	DBG_PROC	= 0x100,
+	DBG_PARAM	= 0x200,
+	DBG_PSCAN	= 0x400,
+	DBG_EVENT	= 0x800,
+	DBG_DRAIN	= 0x1000,
+	DBG_MSIGS	= 0x2000,
+	DBG_MGMT	= 0x4000,
+	DBG_INTR	= 0x8000,
+	DBG_CARR	= 0x10000,
+};
+
+#define jsm_printk(nlevel, klevel, pdev, fmt, args...) \
+	if ((DBG_##nlevel & jsm_debug))  		\
+	dev_printk(KERN_##klevel, pdev->dev, fmt, ## args)
+
+#define MAXPORTS	8
+#define MAX_STOPS_SENT	5
+
+/* Board type definitions */
+
+#define T_NEO           0000
+#define T_CLASSIC       0001
+#define T_PCIBUS        0400
+
+/* Board State Definitions */
+
+#define BD_RUNNING      0x0
+#define BD_REASON       0x7f
+#define BD_NOTFOUND     0x1
+#define BD_NOIOPORT     0x2
+#define BD_NOMEM        0x3
+#define BD_NOBIOS       0x4
+#define BD_NOFEP        0x5
+#define BD_FAILED       0x6
+#define BD_ALLOCATED    0x7
+#define BD_TRIBOOT      0x8
+#define BD_BADKME       0x80
+
+/* 4 extra for alignment play space */
+#define WRITEBUFLEN	((4096) + 4)
+#define MYFLIPLEN	N_TTY_BUF_SIZE
+
+#define JSM_VERSION	"jsm: 1.1-1-INKERNEL"
+#define JSM_PARTNUM	"40002438_A-INKERNEL"
+
+/*
+ * All the possible states the driver can be while being loaded.
+ */
+enum {
+	DRIVER_INITIALIZED = 0,
+	DRIVER_READY
+};
+
+/*
+ * All the possible states the board can be while booting up.
+ */
+enum {
+	BOARD_FAILED = 0,
+	BOARD_FOUND,
+	BOARD_READY
+};
+
+struct board_id {
+	u8 *name;
+	u32 maxports;
+};
+
+struct jsm_board;
+struct jsm_channel;
+
+/************************************************************************
+ * Per board operations structure					*
+ ************************************************************************/
+struct board_ops {
+	irqreturn_t (*intr) (int irq, void *voidbrd, struct pt_regs *regs);
+	void (*uart_init) (struct jsm_channel *ch);
+	void (*uart_off) (struct jsm_channel *ch);
+	void (*param) (struct jsm_channel *ch);
+	void (*assert_modem_signals) (struct jsm_channel *ch);
+	void (*flush_uart_write) (struct jsm_channel *ch);
+	void (*flush_uart_read) (struct jsm_channel *ch);
+	void (*disable_receiver) (struct jsm_channel *ch);
+	void (*enable_receiver) (struct jsm_channel *ch);
+	void (*send_break) (struct jsm_channel *ch);
+	void (*clear_break) (struct jsm_channel *ch, int);
+	void (*send_start_character) (struct jsm_channel *ch);
+	void (*send_stop_character) (struct jsm_channel *ch);
+	void (*copy_data_from_queue_to_uart) (struct jsm_channel *ch);
+	u32 (*get_uart_bytes_left) (struct jsm_channel *ch);
+	void (*send_immediate_char) (struct jsm_channel *ch, unsigned char);
+};
+
+
+/*
+ *	Per-board information
+ */
+struct jsm_board
+{
+	int		boardnum;	/* Board number: 0-32 */
+
+	int		type;		/* Type of board */
+	char		*name;		/* Product Name */
+	u8		rev;		/* PCI revision ID */
+	struct pci_dev	*pci_dev;
+	u32		maxports;	/* MAX ports this board can handle */
+
+	spinlock_t	bd_lock;	/* Used to protect board */
+
+	spinlock_t	bd_intr_lock;	/* Used to protect the poller tasklet and
+					 * the interrupt routine from each other.
+					 */
+
+	u32		state;		/* State of card. */
+	wait_queue_head_t state_wait;	/* Place to sleep on for state change */
+
+	u32		nasync;		/* Number of ports on card */
+
+	u32		irq;		/* Interrupt request number */
+	u64		intr_count;	/* Count of interrupts */
+
+	u64		membase;	/* Start of base memory of the card */
+	u64		membase_end;	/* End of base memory of the card */
+
+	u8		*re_map_membase;/* Remapped memory of the card */
+
+	u64		iobase;		/* Start of io base of the card */
+	u64		iobase_end;	/* End of io base of the card */
+
+	u32		bd_uart_offset;	/* Space between each UART */
+
+	struct jsm_channel *channels[MAXPORTS]; /* array of pointers to our channels. */
+
+	u32		jsm_major_serial_registered;
+	u32		jsm_serial_major;
+
+	char		*flipbuf;	/* Our flip buffer, alloced if board is found */
+
+	u16		dpatype;	/* The board "type", as defined by DPA */
+	u16		dpastatus;	/* The board "status", as defined by DPA */
+
+	u32		bd_dividend;	/* Board/UARTs specific dividend */
+
+	struct board_ops *bd_ops;
+
+	struct list_head jsm_board_entry;
+};
+
+/************************************************************************ 
+ * Device flag definitions for ch_flags.
+ ************************************************************************/
+#define CH_PRON		0x0001		/* Printer on string		*/
+#define CH_STOP		0x0002		/* Output is stopped		*/
+#define CH_STOPI	0x0004		/* Input is stopped		*/
+#define CH_CD		0x0008		/* Carrier is present		*/
+#define CH_FCAR		0x0010		/* Carrier forced on		*/
+#define CH_HANGUP	0x0020		/* Hangup received		*/
+
+#define CH_RECEIVER_OFF	0x0040		/* Receiver is off		*/
+#define CH_OPENING	0x0080		/* Port in fragile open state	*/
+#define CH_CLOSING	0x0100		/* Port in fragile close state	*/
+#define CH_FIFO_ENABLED 0x0200		/* Port has FIFOs enabled	*/
+#define CH_TX_FIFO_EMPTY 0x0400		/* TX Fifo is completely empty	*/
+#define CH_TX_FIFO_LWM	0x0800		/* TX Fifo is below Low Water	*/
+#define CH_BREAK_SENDING 0x1000		/* Break is being sent		*/
+#define CH_LOOPBACK 0x2000		/* Channel is in lookback mode	*/
+#define CH_FLIPBUF_IN_USE 0x4000	/* Channel's flipbuf is in use	*/
+#define CH_BAUD0	0x08000		/* Used for checking B0 transitions */
+
+/* Our Read/Error/Write queue sizes */
+#define RQUEUEMASK	0x1FFF		/* 8 K - 1 */
+#define EQUEUEMASK	0x1FFF		/* 8 K - 1 */
+#define WQUEUEMASK	0x0FFF		/* 4 K - 1 */
+#define RQUEUESIZE	(RQUEUEMASK + 1)
+#define EQUEUESIZE	RQUEUESIZE
+#define WQUEUESIZE	(WQUEUEMASK + 1)
+
+
+/************************************************************************ 
+ * Channel information structure.
+ ************************************************************************/
+struct jsm_channel {
+	struct uart_port uart_port;
+	struct jsm_board	*ch_bd;		/* Board structure pointer	*/
+
+	spinlock_t	ch_lock;	/* provide for serialization */
+	wait_queue_head_t ch_flags_wait;
+
+	u32		ch_portnum;	/* Port number, 0 offset.	*/
+	u32		ch_open_count;	/* open count			*/
+	u32		ch_flags;	/* Channel flags		*/
+
+	u64		ch_close_delay;	/* How long we should drop RTS/DTR for */
+
+	u64		ch_cpstime;	/* Time for CPS calculations	*/
+
+	tcflag_t	ch_c_iflag;	/* channel iflags		*/
+	tcflag_t	ch_c_cflag;	/* channel cflags		*/
+	tcflag_t	ch_c_oflag;	/* channel oflags		*/
+	tcflag_t	ch_c_lflag;	/* channel lflags		*/
+	u8		ch_stopc;	/* Stop character		*/
+	u8		ch_startc;	/* Start character		*/
+
+	u32		ch_old_baud;	/* Cache of the current baud */
+	u32		ch_custom_speed;/* Custom baud, if set */
+
+	u32		ch_wopen;	/* Waiting for open process cnt */
+
+	u8		ch_mostat;	/* FEP output modem status	*/
+	u8		ch_mistat;	/* FEP input modem status	*/
+
+	struct neo_uart_struct *ch_neo_uart;	/* Pointer to the "mapped" UART struct */
+	u8		ch_cached_lsr;	/* Cached value of the LSR register */
+
+	u8		*ch_rqueue;	/* Our read queue buffer - malloc'ed */
+	u16		ch_r_head;	/* Head location of the read queue */
+	u16		ch_r_tail;	/* Tail location of the read queue */
+
+	u8		*ch_equeue;	/* Our error queue buffer - malloc'ed */
+	u16		ch_e_head;	/* Head location of the error queue */
+	u16		ch_e_tail;	/* Tail location of the error queue */
+
+	u8		*ch_wqueue;	/* Our write queue buffer - malloc'ed */
+	u16		ch_w_head;	/* Head location of the write queue */
+	u16		ch_w_tail;	/* Tail location of the write queue */
+
+	u64		ch_rxcount;	/* total of data received so far */
+	u64		ch_txcount;	/* total of data transmitted so far */
+
+	u8		ch_r_tlevel;	/* Receive Trigger level */
+	u8		ch_t_tlevel;	/* Transmit Trigger level */
+
+	u8		ch_r_watermark;	/* Receive Watermark */
+
+
+	u32		ch_stops_sent;	/* How many times I have sent a stop character
+					 * to try to stop the other guy sending.
+					 */
+	u64		ch_err_parity;	/* Count of parity errors on channel */
+	u64		ch_err_frame;	/* Count of framing errors on channel */
+	u64		ch_err_break;	/* Count of breaks on channel */
+	u64		ch_err_overrun; /* Count of overruns on channel */
+
+	u64		ch_xon_sends;	/* Count of xons transmitted */
+	u64		ch_xoff_sends;	/* Count of xoffs transmitted */
+};
+
+
+/************************************************************************ 
+ * Per channel/port NEO UART structure					*
+ ************************************************************************
+ *		Base Structure Entries Usage Meanings to Host		*
+ *									*
+ *	W = read write		R = read only				* 
+ *			U = Unused.					*
+ ************************************************************************/
+
+struct neo_uart_struct {
+	 u8 txrx;		/* WR	RHR/THR - Holding Reg */
+	 u8 ier;		/* WR	IER - Interrupt Enable Reg */
+	 u8 isr_fcr;		/* WR	ISR/FCR - Interrupt Status Reg/Fifo Control Reg */
+	 u8 lcr;		/* WR	LCR - Line Control Reg */
+	 u8 mcr;		/* WR	MCR - Modem Control Reg */
+	 u8 lsr;		/* WR	LSR - Line Status Reg */
+	 u8 msr;		/* WR	MSR - Modem Status Reg */
+	 u8 spr;		/* WR	SPR - Scratch Pad Reg */
+	 u8 fctr;		/* WR	FCTR - Feature Control Reg */
+	 u8 efr;		/* WR	EFR - Enhanced Function Reg */
+	 u8 tfifo;		/* WR	TXCNT/TXTRG - Transmit FIFO Reg */	
+	 u8 rfifo;		/* WR	RXCNT/RXTRG - Recieve FIFO Reg */
+	 u8 xoffchar1;	/* WR	XOFF 1 - XOff Character 1 Reg */
+	 u8 xoffchar2;	/* WR	XOFF 2 - XOff Character 2 Reg */
+	 u8 xonchar1;	/* WR	XON 1 - Xon Character 1 Reg */
+	 u8 xonchar2;	/* WR	XON 2 - XOn Character 2 Reg */
+
+	 u8 reserved1[0x2ff - 0x200]; /* U	Reserved by Exar */
+	 u8 txrxburst[64];	/* RW	64 bytes of RX/TX FIFO Data */
+	 u8 reserved2[0x37f - 0x340]; /* U	Reserved by Exar */
+	 u8 rxburst_with_errors[64];	/* R	64 bytes of RX FIFO Data + LSR */
+};
+
+/* Where to read the extended interrupt register (32bits instead of 8bits) */
+#define	UART_17158_POLL_ADDR_OFFSET	0x80
+
+/*
+ * These are the redefinitions for the FCTR on the XR17C158, since
+ * Exar made them different than their earlier design. (XR16C854)
+ */
+
+/* These are only applicable when table D is selected */
+#define UART_17158_FCTR_RTS_NODELAY	0x00
+#define UART_17158_FCTR_RTS_4DELAY	0x01
+#define UART_17158_FCTR_RTS_6DELAY	0x02
+#define UART_17158_FCTR_RTS_8DELAY	0x03
+#define UART_17158_FCTR_RTS_12DELAY	0x12
+#define UART_17158_FCTR_RTS_16DELAY	0x05
+#define UART_17158_FCTR_RTS_20DELAY	0x13
+#define UART_17158_FCTR_RTS_24DELAY	0x06
+#define UART_17158_FCTR_RTS_28DELAY	0x14
+#define UART_17158_FCTR_RTS_32DELAY	0x07
+#define UART_17158_FCTR_RTS_36DELAY	0x16
+#define UART_17158_FCTR_RTS_40DELAY	0x08
+#define UART_17158_FCTR_RTS_44DELAY	0x09
+#define UART_17158_FCTR_RTS_48DELAY	0x10
+#define UART_17158_FCTR_RTS_52DELAY	0x11
+
+#define UART_17158_FCTR_RTS_IRDA	0x10
+#define UART_17158_FCTR_RS485		0x20
+#define UART_17158_FCTR_TRGA		0x00
+#define UART_17158_FCTR_TRGB		0x40
+#define UART_17158_FCTR_TRGC		0x80
+#define UART_17158_FCTR_TRGD		0xC0
+
+/* 17158 trigger table selects.. */
+#define UART_17158_FCTR_BIT6		0x40
+#define UART_17158_FCTR_BIT7		0x80
+
+/* 17158 TX/RX memmapped buffer offsets */
+#define UART_17158_RX_FIFOSIZE		64
+#define UART_17158_TX_FIFOSIZE		64
+
+/* 17158 Extended IIR's */
+#define UART_17158_IIR_RDI_TIMEOUT	0x0C	/* Receiver data TIMEOUT */
+#define UART_17158_IIR_XONXOFF		0x10	/* Received an XON/XOFF char */
+#define UART_17158_IIR_HWFLOW_STATE_CHANGE 0x20	/* CTS/DSR or RTS/DTR state change */
+#define UART_17158_IIR_FIFO_ENABLED	0xC0	/* 16550 FIFOs are Enabled */
+
+/*
+ * These are the extended interrupts that get sent
+ * back to us from the UART's 32bit interrupt register
+ */
+#define UART_17158_RX_LINE_STATUS	0x1	/* RX Ready */
+#define UART_17158_RXRDY_TIMEOUT	0x2	/* RX Ready Timeout */
+#define UART_17158_TXRDY		0x3	/* TX Ready */
+#define UART_17158_MSR			0x4	/* Modem State Change */
+#define UART_17158_TX_AND_FIFO_CLR	0x40	/* Transmitter Holding Reg Empty */
+#define UART_17158_RX_FIFO_DATA_ERROR	0x80	/* UART detected an RX FIFO Data error */
+
+/*
+ * These are the EXTENDED definitions for the 17C158's Interrupt
+ * Enable Register.
+ */
+#define UART_17158_EFR_ECB	0x10	/* Enhanced control bit */
+#define UART_17158_EFR_IXON	0x2	/* Receiver compares Xon1/Xoff1 */
+#define UART_17158_EFR_IXOFF	0x8	/* Transmit Xon1/Xoff1 */
+#define UART_17158_EFR_RTSDTR	0x40	/* Auto RTS/DTR Flow Control Enable */
+#define UART_17158_EFR_CTSDSR	0x80	/* Auto CTS/DSR Flow COntrol Enable */
+
+#define UART_17158_XOFF_DETECT	0x1	/* Indicates whether chip saw an incoming XOFF char  */
+#define UART_17158_XON_DETECT	0x2	/* Indicates whether chip saw an incoming XON char */
+
+#define UART_17158_IER_RSVD1	0x10	/* Reserved by Exar */
+#define UART_17158_IER_XOFF	0x20	/* Xoff Interrupt Enable */
+#define UART_17158_IER_RTSDTR	0x40	/* Output Interrupt Enable */
+#define UART_17158_IER_CTSDSR	0x80	/* Input Interrupt Enable */
+
+#define PCI_DEVICE_NEO_4_PCI_NAME		"Neo 4 PCI"
+#define PCI_DEVICE_NEO_8_PCI_NAME		"Neo 8 PCI"
+#define PCI_DEVICE_NEO_2DB9_PCI_NAME		"Neo 2 - DB9 Universal PCI"
+#define PCI_DEVICE_NEO_2DB9PRI_PCI_NAME		"Neo 2 - DB9 Universal PCI - Powered Ring Indicator"
+#define PCI_DEVICE_NEO_2RJ45_PCI_NAME		"Neo 2 - RJ45 Universal PCI"
+#define PCI_DEVICE_NEO_2RJ45PRI_PCI_NAME	"Neo 2 - RJ45 Universal PCI - Powered Ring Indicator"
+#define PCI_DEVICE_NEO_1_422_PCI_NAME		"Neo 1 422 PCI"
+#define PCI_DEVICE_NEO_1_422_485_PCI_NAME	"Neo 1 422/485 PCI"
+#define PCI_DEVICE_NEO_2_422_485_PCI_NAME	"Neo 2 422/485 PCI"
+
+/*
+ * Our Global Variables.
+ */
+extern struct	uart_driver jsm_uart_driver;
+extern struct	board_ops jsm_neo_ops;
+extern int	jsm_debug;
+extern int	jsm_rawreadok;
+
+extern int	jsm_driver_state;	/* The state of the driver	*/
+extern char	*jsm_driver_state_text[];/* Array of driver state text */
+
+extern spinlock_t jsm_board_head_lock;
+extern struct list_head jsm_board_head;
+/*************************************************************************
+ *
+ * Prototypes for non-static functions used in more than one module
+ *
+ *************************************************************************/
+extern char *jsm_ioctl_name(int cmd);
+extern int jsm_total_boardnum(void);
+
+int jsm_mgmt_open(struct inode *inode, struct file *file);
+int jsm_mgmt_close(struct inode *inode, struct file *file);
+int jsm_mgmt_ioctl(struct inode *inode, struct file *file, unsigned int cmd, unsigned long arg);
+
+int jsm_tty_write(struct uart_port *port);
+int jsm_tty_register(struct jsm_board *brd);
+
+int jsm_tty_init(struct jsm_board *);
+int jsm_uart_port_init(struct jsm_board *);
+int jsm_remove_uart_port(struct jsm_board *);
+
+void jsm_tty_uninit(struct jsm_board *);
+
+void jsm_input(struct jsm_channel *ch);
+void jsm_carrier(struct jsm_channel *ch);
+void jsm_check_queue_flow_control(struct jsm_channel *ch);
+
+void jsm_create_driver_sysfiles(struct device_driver *);
+void jsm_remove_driver_sysfiles(struct device_driver *);
+
+
+/************************************************************************
+ * All structures for management ports of adapters			* 
+ ************************************************************************/
+
+#define DIGI_PLEN       28              /* String length                */
+#define DIGI_TSIZ       10              /* Terminal string len          */
+
+struct digi {
+	unsigned short	digi_flags;		/* Flags (see above)	*/
+	unsigned short	digi_maxcps;		/* Max printer CPS	*/
+	unsigned short	digi_maxchar;		/* Max chars in print queue */
+	unsigned short	digi_bufsize;		/* Buffer size		*/
+	unsigned char	digi_onlen;		/* Length of ON string	*/
+	unsigned char	digi_offlen;		/* Length of OFF string	*/
+	char		digi_onstr[DIGI_PLEN];	/* Printer on string	*/
+	char		digi_offstr[DIGI_PLEN];	/* Printer off string	*/
+	char		digi_term[DIGI_TSIZ];	/* terminal string	*/
+};
+
+/************************************************************************
+ * Structure to get driver status information
+ ************************************************************************/
+struct digi_dinfo {
+	u8	dinfo_nboards;		/* # boards configured	*/
+	char	dinfo_reserved[12];	/* for future expansion */
+	char	dinfo_version[16];	/* driver version	*/
+};
+
+struct digi_info {
+	unsigned int	info_bdnum;		/* Board number (0 based)  */
+	unsigned int	info_ioport;		/* io port address	   */
+	unsigned long	info_physaddr;		/* memory address	   */
+	unsigned int	info_physsize;		/* Size of host mem window */
+	unsigned int	info_memsize;		/* Amount of dual-port mem */
+						/* on board		   */
+	unsigned short	info_bdtype;		/* Board type		   */
+	unsigned short	info_nports;		/* number of ports	   */
+	char		info_bdstate;		/* board state		   */
+	char		info_reserved[7];	/* for future expansion	   */
+};
+
+struct ni_info {
+	int board;
+	int channel;
+	int dtr;
+	int rts;
+	int cts;
+	int dsr;
+	int ri;
+	int dcd;
+	int curtx;
+	int currx;
+	unsigned short iflag;
+	unsigned short oflag;
+	unsigned short cflag;
+	unsigned short lflag;
+	unsigned int mstat;
+	unsigned char hflow;
+	unsigned char xmit_stopped;
+	unsigned char recv_stopped;
+	unsigned int baud;
+};
+
+/* Ioctls needed for dpa operation */
+#define DIGI_GETDD	('d'<<8) | 248		/* get driver info      */
+#define DIGI_GETBD	('d'<<8) | 249		/* get board info       */
+#define DIGI_GET_NI_INFO ('d'<<8) | 250		/* nonintelligent state snfo */
+
+#endif

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [ patch 6/7] drivers/serial/jsm: new serial device driver
  2005-03-08 18:42           ` Wen Xiong
@ 2005-03-09  6:04             ` Greg KH
  2005-03-09 15:50               ` Wen Xiong
  0 siblings, 1 reply; 21+ messages in thread
From: Greg KH @ 2005-03-09  6:04 UTC (permalink / raw)
  To: Wen Xiong; +Cc: linux-kernel

On Tue, Mar 08, 2005 at 01:42:31PM -0500, Wen Xiong wrote:
> The following email I got from Scott Kilau in digi:
> Scott Kilau wrote:
> 
>        The DPA program is very old, and is shared among other drivers 
> and OS's,
>        so changing the code to read the sysfs instead of doing ioctls 
> is not possible.

Hm, so we are supposed to support, for forever, custom ioctls just
because another OS, that we care nothing about, supports it?  Hm, I just
can't think this is a acceptable thing, sorry.  Especially due to the
nasty 64/32 bit issues...

>        However, any *new* tools I write, will use sysfs, which is why 
> we need to have both the ioctl calls and sysfs files.

Please, no new ioctls, end of story.

>        The digi.h file has extra structures and ioctls that may not be 
> used in the driver, as that header
>        is shared among other drivers and OS's.

Please remove them as they are not needed in this OS, right?  As you
already had to change the naming, structure definitions, and format, you
aren't sharing the file.

thanks,

greg k-h

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [ patch 6/7] drivers/serial/jsm: new serial device driver
  2005-03-09  6:04             ` Greg KH
@ 2005-03-09 15:50               ` Wen Xiong
  2005-03-09 16:31                 ` Greg KH
  0 siblings, 1 reply; 21+ messages in thread
From: Wen Xiong @ 2005-03-09 15:50 UTC (permalink / raw)
  To: Greg KH; +Cc: Wen Xiong, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 1257 bytes --]

Greg KH wrote:

>On Tue, Mar 08, 2005 at 01:42:31PM -0500, Wen Xiong wrote:
>  
>
>>The following email I got from Scott Kilau in digi:
>>Scott Kilau wrote:
>>
>>       The DPA program is very old, and is shared among other drivers 
>>and OS's,
>>       so changing the code to read the sysfs instead of doing ioctls 
>>is not possible.
>>    
>>
>
>Hm, so we are supposed to support, for forever, custom ioctls just
>because another OS, that we care nothing about, supports it?  Hm, I just
>can't think this is a acceptable thing, sorry.  Especially due to the
>nasty 64/32 bit issues...
>
>  
>
>>       However, any *new* tools I write, will use sysfs, which is why 
>>we need to have both the ioctl calls and sysfs files.
>>    
>>
>
>Please, no new ioctls, end of story.
>
>  
>
>>       The digi.h file has extra structures and ioctls that may not be 
>>used in the driver, as that header
>>       is shared among other drivers and OS's.
>>    
>>
>
>Please remove them as they are not needed in this OS, right?  As you
>already had to change the naming, structure definitions, and format, you
>aren't sharing the file.
>  
>
Removed the all things are not needed(digi.h) in this OS.
Attached the new patch6.jasmine for your reviewing.

Thanks,
wendy

[-- Attachment #2: patch6.jasmine --]
[-- Type: text/plain, Size: 19012 bytes --]

diff -Nuar linux-2.6.11.org/drivers/serial/jsm/jsm_driver.h linux-2.6.11.new/drivers/serial/jsm/jsm_driver.h
--- linux-2.6.11.org/drivers/serial/jsm/jsm_driver.h	1969-12-31 18:00:00.000000000 -0600
+++ linux-2.6.11.new/drivers/serial/jsm/jsm_driver.h	2005-03-09 09:43:11.995943064 -0600
@@ -0,0 +1,518 @@
+/************************************************************************
+ * Copyright 2003 Digi International (www.digi.com)
+ *
+ * Copyright (C) 2004 IBM Corporation. All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ * 
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY, EXPRESS OR IMPLIED; without even the 
+ * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 
+ * PURPOSE.  See the GNU General Public License for more details.
+ * 
+ * You should have received a copy of the GNU General Public License 
+ * along with this program; if not, write to the Free Software 
+ * Foundation, Inc., 59 * Temple Place - Suite 330, Boston,
+ * MA  02111-1307, USA.
+ *
+ * Contact Information:
+ * Scott H Kilau <Scott_Kilau@digi.com>
+ * Wendy Xiong   <wendyx@us.ltcfwd.linux.ibm.com>
+ *
+ ***********************************************************************/
+#ifndef __JSM_DRIVER_H
+#define __JSM_DRIVER_H
+
+#include <linux/kernel.h>
+#include <linux/version.h>
+#include <linux/types.h>	/* To pick up the varions Linux types */
+#include <linux/tty.h>
+#include <linux/serial_core.h>
+#include <linux/device.h>
+#include <linux/ioctl.h>
+
+/*
+ * Debugging levels can be set using debug insmod variable
+ * They can also be compiled out completely.
+ */
+enum {
+	DBG_INIT	= 0x01,
+	DBG_BASIC	= 0x02,
+	DBG_CORE	= 0x04,
+	DBG_OPEN	= 0x08,
+	DBG_CLOSE	= 0x10,
+	DBG_READ	= 0x20,
+	DBG_WRITE	= 0x40,
+	DBG_IOCTL	= 0x80,
+	DBG_PROC	= 0x100,
+	DBG_PARAM	= 0x200,
+	DBG_PSCAN	= 0x400,
+	DBG_EVENT	= 0x800,
+	DBG_DRAIN	= 0x1000,
+	DBG_MSIGS	= 0x2000,
+	DBG_MGMT	= 0x4000,
+	DBG_INTR	= 0x8000,
+	DBG_CARR	= 0x10000,
+};
+
+#define jsm_printk(nlevel, klevel, pdev, fmt, args...) \
+	if ((DBG_##nlevel & jsm_debug))  		\
+	dev_printk(KERN_##klevel, pdev->dev, fmt, ## args)
+
+#define MAXPORTS	8
+#define MAX_STOPS_SENT	5
+
+/* Board type definitions */
+
+#define T_NEO           0000
+#define T_CLASSIC       0001
+#define T_PCIBUS        0400
+
+/* Board State Definitions */
+
+#define BD_RUNNING      0x0
+#define BD_REASON       0x7f
+#define BD_NOTFOUND     0x1
+#define BD_NOIOPORT     0x2
+#define BD_NOMEM        0x3
+#define BD_NOBIOS       0x4
+#define BD_NOFEP        0x5
+#define BD_FAILED       0x6
+#define BD_ALLOCATED    0x7
+#define BD_TRIBOOT      0x8
+#define BD_BADKME       0x80
+
+/* 4 extra for alignment play space */
+#define WRITEBUFLEN	((4096) + 4)
+#define MYFLIPLEN	N_TTY_BUF_SIZE
+
+#define JSM_VERSION	"jsm: 1.1-1-INKERNEL"
+#define JSM_PARTNUM	"40002438_A-INKERNEL"
+
+/*
+ * All the possible states the driver can be while being loaded.
+ */
+enum {
+	DRIVER_INITIALIZED = 0,
+	DRIVER_READY
+};
+
+/*
+ * All the possible states the board can be while booting up.
+ */
+enum {
+	BOARD_FAILED = 0,
+	BOARD_FOUND,
+	BOARD_READY
+};
+
+struct board_id {
+	u8 *name;
+	u32 maxports;
+};
+
+struct jsm_board;
+struct jsm_channel;
+
+/************************************************************************
+ * Per board operations structure					*
+ ************************************************************************/
+struct board_ops {
+	irqreturn_t (*intr) (int irq, void *voidbrd, struct pt_regs *regs);
+	void (*uart_init) (struct jsm_channel *ch);
+	void (*uart_off) (struct jsm_channel *ch);
+	void (*param) (struct jsm_channel *ch);
+	void (*assert_modem_signals) (struct jsm_channel *ch);
+	void (*flush_uart_write) (struct jsm_channel *ch);
+	void (*flush_uart_read) (struct jsm_channel *ch);
+	void (*disable_receiver) (struct jsm_channel *ch);
+	void (*enable_receiver) (struct jsm_channel *ch);
+	void (*send_break) (struct jsm_channel *ch);
+	void (*clear_break) (struct jsm_channel *ch, int);
+	void (*send_start_character) (struct jsm_channel *ch);
+	void (*send_stop_character) (struct jsm_channel *ch);
+	void (*copy_data_from_queue_to_uart) (struct jsm_channel *ch);
+	u32 (*get_uart_bytes_left) (struct jsm_channel *ch);
+	void (*send_immediate_char) (struct jsm_channel *ch, unsigned char);
+};
+
+/*
+ *	Per-board information
+ */
+struct jsm_board
+{
+	int		boardnum;	/* Board number: 0-32 */
+
+	int		type;		/* Type of board */
+	char		*name;		/* Product Name */
+	u8		rev;		/* PCI revision ID */
+	struct pci_dev	*pci_dev;
+	u32		maxports;	/* MAX ports this board can handle */
+
+	spinlock_t	bd_lock;	/* Used to protect board */
+
+	spinlock_t	bd_intr_lock;	/* Used to protect the poller tasklet and
+					 * the interrupt routine from each other.
+					 */
+
+	u32		state;		/* State of card. */
+	wait_queue_head_t state_wait;	/* Place to sleep on for state change */
+
+	u32		nasync;		/* Number of ports on card */
+
+	u32		irq;		/* Interrupt request number */
+	u64		intr_count;	/* Count of interrupts */
+
+	u64		membase;	/* Start of base memory of the card */
+	u64		membase_end;	/* End of base memory of the card */
+
+	u8		*re_map_membase;/* Remapped memory of the card */
+
+	u64		iobase;		/* Start of io base of the card */
+	u64		iobase_end;	/* End of io base of the card */
+
+	u32		bd_uart_offset;	/* Space between each UART */
+
+	struct jsm_channel *channels[MAXPORTS]; /* array of pointers to our channels. */
+
+	u32		jsm_major_serial_registered;
+	u32		jsm_serial_major;
+
+	char		*flipbuf;	/* Our flip buffer, alloced if board is found */
+
+	u16		dpatype;	/* The board "type", as defined by DPA */
+	u16		dpastatus;	/* The board "status", as defined by DPA */
+
+	u32		bd_dividend;	/* Board/UARTs specific dividend */
+
+	struct board_ops *bd_ops;
+
+	struct list_head jsm_board_entry;
+};
+
+/************************************************************************ 
+ * Device flag definitions for ch_flags.
+ ************************************************************************/
+#define CH_PRON		0x0001		/* Printer on string		*/
+#define CH_STOP		0x0002		/* Output is stopped		*/
+#define CH_STOPI	0x0004		/* Input is stopped		*/
+#define CH_CD		0x0008		/* Carrier is present		*/
+#define CH_FCAR		0x0010		/* Carrier forced on		*/
+#define CH_HANGUP	0x0020		/* Hangup received		*/
+
+#define CH_RECEIVER_OFF	0x0040		/* Receiver is off		*/
+#define CH_OPENING	0x0080		/* Port in fragile open state	*/
+#define CH_CLOSING	0x0100		/* Port in fragile close state	*/
+#define CH_FIFO_ENABLED 0x0200		/* Port has FIFOs enabled	*/
+#define CH_TX_FIFO_EMPTY 0x0400		/* TX Fifo is completely empty	*/
+#define CH_TX_FIFO_LWM	0x0800		/* TX Fifo is below Low Water	*/
+#define CH_BREAK_SENDING 0x1000		/* Break is being sent		*/
+#define CH_LOOPBACK 0x2000		/* Channel is in lookback mode	*/
+#define CH_FLIPBUF_IN_USE 0x4000	/* Channel's flipbuf is in use	*/
+#define CH_BAUD0	0x08000		/* Used for checking B0 transitions */
+
+/* Our Read/Error/Write queue sizes */
+#define RQUEUEMASK	0x1FFF		/* 8 K - 1 */
+#define EQUEUEMASK	0x1FFF		/* 8 K - 1 */
+#define WQUEUEMASK	0x0FFF		/* 4 K - 1 */
+#define RQUEUESIZE	(RQUEUEMASK + 1)
+#define EQUEUESIZE	RQUEUESIZE
+#define WQUEUESIZE	(WQUEUEMASK + 1)
+
+
+/************************************************************************ 
+ * Channel information structure.
+ ************************************************************************/
+struct jsm_channel {
+	struct uart_port uart_port;
+	struct jsm_board	*ch_bd;		/* Board structure pointer	*/
+
+	spinlock_t	ch_lock;	/* provide for serialization */
+	wait_queue_head_t ch_flags_wait;
+
+	u32		ch_portnum;	/* Port number, 0 offset.	*/
+	u32		ch_open_count;	/* open count			*/
+	u32		ch_flags;	/* Channel flags		*/
+
+	u64		ch_close_delay;	/* How long we should drop RTS/DTR for */
+
+	u64		ch_cpstime;	/* Time for CPS calculations	*/
+
+	tcflag_t	ch_c_iflag;	/* channel iflags		*/
+	tcflag_t	ch_c_cflag;	/* channel cflags		*/
+	tcflag_t	ch_c_oflag;	/* channel oflags		*/
+	tcflag_t	ch_c_lflag;	/* channel lflags		*/
+	u8		ch_stopc;	/* Stop character		*/
+	u8		ch_startc;	/* Start character		*/
+
+	u32		ch_old_baud;	/* Cache of the current baud */
+	u32		ch_custom_speed;/* Custom baud, if set */
+
+	u32		ch_wopen;	/* Waiting for open process cnt */
+
+	u8		ch_mostat;	/* FEP output modem status	*/
+	u8		ch_mistat;	/* FEP input modem status	*/
+
+	struct neo_uart_struct *ch_neo_uart;	/* Pointer to the "mapped" UART struct */
+	u8		ch_cached_lsr;	/* Cached value of the LSR register */
+
+	u8		*ch_rqueue;	/* Our read queue buffer - malloc'ed */
+	u16		ch_r_head;	/* Head location of the read queue */
+	u16		ch_r_tail;	/* Tail location of the read queue */
+
+	u8		*ch_equeue;	/* Our error queue buffer - malloc'ed */
+	u16		ch_e_head;	/* Head location of the error queue */
+	u16		ch_e_tail;	/* Tail location of the error queue */
+
+	u8		*ch_wqueue;	/* Our write queue buffer - malloc'ed */
+	u16		ch_w_head;	/* Head location of the write queue */
+	u16		ch_w_tail;	/* Tail location of the write queue */
+
+	u64		ch_rxcount;	/* total of data received so far */
+	u64		ch_txcount;	/* total of data transmitted so far */
+
+	u8		ch_r_tlevel;	/* Receive Trigger level */
+	u8		ch_t_tlevel;	/* Transmit Trigger level */
+
+	u8		ch_r_watermark;	/* Receive Watermark */
+
+
+	u32		ch_stops_sent;	/* How many times I have sent a stop character
+					 * to try to stop the other guy sending.
+					 */
+	u64		ch_err_parity;	/* Count of parity errors on channel */
+	u64		ch_err_frame;	/* Count of framing errors on channel */
+	u64		ch_err_break;	/* Count of breaks on channel */
+	u64		ch_err_overrun; /* Count of overruns on channel */
+
+	u64		ch_xon_sends;	/* Count of xons transmitted */
+	u64		ch_xoff_sends;	/* Count of xoffs transmitted */
+};
+
+/************************************************************************ 
+ * Per channel/port NEO UART structure					*
+ ************************************************************************
+ *		Base Structure Entries Usage Meanings to Host		*
+ *									*
+ *	W = read write		R = read only				* 
+ *			U = Unused.					*
+ ************************************************************************/
+
+struct neo_uart_struct {
+	 u8 txrx;		/* WR	RHR/THR - Holding Reg */
+	 u8 ier;		/* WR	IER - Interrupt Enable Reg */
+	 u8 isr_fcr;		/* WR	ISR/FCR - Interrupt Status Reg/Fifo Control Reg */
+	 u8 lcr;		/* WR	LCR - Line Control Reg */
+	 u8 mcr;		/* WR	MCR - Modem Control Reg */
+	 u8 lsr;		/* WR	LSR - Line Status Reg */
+	 u8 msr;		/* WR	MSR - Modem Status Reg */
+	 u8 spr;		/* WR	SPR - Scratch Pad Reg */
+	 u8 fctr;		/* WR	FCTR - Feature Control Reg */
+	 u8 efr;		/* WR	EFR - Enhanced Function Reg */
+	 u8 tfifo;		/* WR	TXCNT/TXTRG - Transmit FIFO Reg */	
+	 u8 rfifo;		/* WR	RXCNT/RXTRG - Recieve FIFO Reg */
+	 u8 xoffchar1;		/* WR	XOFF 1 - XOff Character 1 Reg */
+	 u8 xoffchar2;		/* WR	XOFF 2 - XOff Character 2 Reg */
+	 u8 xonchar1;		/* WR	XON 1 - Xon Character 1 Reg */
+	 u8 xonchar2;		/* WR	XON 2 - XOn Character 2 Reg */
+
+	 u8 reserved1[0x2ff - 0x200]; /* U	Reserved by Exar */
+	 u8 txrxburst[64];	/* RW	64 bytes of RX/TX FIFO Data */
+	 u8 reserved2[0x37f - 0x340]; /* U	Reserved by Exar */
+	 u8 rxburst_with_errors[64];	/* R	64 bytes of RX FIFO Data + LSR */
+};
+
+/* Where to read the extended interrupt register (32bits instead of 8bits) */
+#define	UART_17158_POLL_ADDR_OFFSET	0x80
+
+/*
+ * These are the redefinitions for the FCTR on the XR17C158, since
+ * Exar made them different than their earlier design. (XR16C854)
+ */
+
+/* These are only applicable when table D is selected */
+#define UART_17158_FCTR_RTS_NODELAY	0x00
+#define UART_17158_FCTR_RTS_4DELAY	0x01
+#define UART_17158_FCTR_RTS_6DELAY	0x02
+#define UART_17158_FCTR_RTS_8DELAY	0x03
+#define UART_17158_FCTR_RTS_12DELAY	0x12
+#define UART_17158_FCTR_RTS_16DELAY	0x05
+#define UART_17158_FCTR_RTS_20DELAY	0x13
+#define UART_17158_FCTR_RTS_24DELAY	0x06
+#define UART_17158_FCTR_RTS_28DELAY	0x14
+#define UART_17158_FCTR_RTS_32DELAY	0x07
+#define UART_17158_FCTR_RTS_36DELAY	0x16
+#define UART_17158_FCTR_RTS_40DELAY	0x08
+#define UART_17158_FCTR_RTS_44DELAY	0x09
+#define UART_17158_FCTR_RTS_48DELAY	0x10
+#define UART_17158_FCTR_RTS_52DELAY	0x11
+
+#define UART_17158_FCTR_RTS_IRDA	0x10
+#define UART_17158_FCTR_RS485		0x20
+#define UART_17158_FCTR_TRGA		0x00
+#define UART_17158_FCTR_TRGB		0x40
+#define UART_17158_FCTR_TRGC		0x80
+#define UART_17158_FCTR_TRGD		0xC0
+
+/* 17158 trigger table selects.. */
+#define UART_17158_FCTR_BIT6		0x40
+#define UART_17158_FCTR_BIT7		0x80
+
+/* 17158 TX/RX memmapped buffer offsets */
+#define UART_17158_RX_FIFOSIZE		64
+#define UART_17158_TX_FIFOSIZE		64
+
+/* 17158 Extended IIR's */
+#define UART_17158_IIR_RDI_TIMEOUT	0x0C	/* Receiver data TIMEOUT */
+#define UART_17158_IIR_XONXOFF		0x10	/* Received an XON/XOFF char */
+#define UART_17158_IIR_HWFLOW_STATE_CHANGE 0x20	/* CTS/DSR or RTS/DTR state change */
+#define UART_17158_IIR_FIFO_ENABLED	0xC0	/* 16550 FIFOs are Enabled */
+
+/*
+ * These are the extended interrupts that get sent
+ * back to us from the UART's 32bit interrupt register
+ */
+#define UART_17158_RX_LINE_STATUS	0x1	/* RX Ready */
+#define UART_17158_RXRDY_TIMEOUT	0x2	/* RX Ready Timeout */
+#define UART_17158_TXRDY		0x3	/* TX Ready */
+#define UART_17158_MSR			0x4	/* Modem State Change */
+#define UART_17158_TX_AND_FIFO_CLR	0x40	/* Transmitter Holding Reg Empty */
+#define UART_17158_RX_FIFO_DATA_ERROR	0x80	/* UART detected an RX FIFO Data error */
+
+/*
+ * These are the EXTENDED definitions for the 17C158's Interrupt
+ * Enable Register.
+ */
+#define UART_17158_EFR_ECB	0x10	/* Enhanced control bit */
+#define UART_17158_EFR_IXON	0x2	/* Receiver compares Xon1/Xoff1 */
+#define UART_17158_EFR_IXOFF	0x8	/* Transmit Xon1/Xoff1 */
+#define UART_17158_EFR_RTSDTR	0x40	/* Auto RTS/DTR Flow Control Enable */
+#define UART_17158_EFR_CTSDSR	0x80	/* Auto CTS/DSR Flow COntrol Enable */
+
+#define UART_17158_XOFF_DETECT	0x1	/* Indicates whether chip saw an incoming XOFF char  */
+#define UART_17158_XON_DETECT	0x2	/* Indicates whether chip saw an incoming XON char */
+
+#define UART_17158_IER_RSVD1	0x10	/* Reserved by Exar */
+#define UART_17158_IER_XOFF	0x20	/* Xoff Interrupt Enable */
+#define UART_17158_IER_RTSDTR	0x40	/* Output Interrupt Enable */
+#define UART_17158_IER_CTSDSR	0x80	/* Input Interrupt Enable */
+
+#define PCI_DEVICE_NEO_4_PCI_NAME		"Neo 4 PCI"
+#define PCI_DEVICE_NEO_8_PCI_NAME		"Neo 8 PCI"
+#define PCI_DEVICE_NEO_2DB9_PCI_NAME		"Neo 2 - DB9 Universal PCI"
+#define PCI_DEVICE_NEO_2DB9PRI_PCI_NAME		"Neo 2 - DB9 Universal PCI - Powered Ring Indicator"
+#define PCI_DEVICE_NEO_2RJ45_PCI_NAME		"Neo 2 - RJ45 Universal PCI"
+#define PCI_DEVICE_NEO_2RJ45PRI_PCI_NAME	"Neo 2 - RJ45 Universal PCI - Powered Ring Indicator"
+#define PCI_DEVICE_NEO_1_422_PCI_NAME		"Neo 1 422 PCI"
+#define PCI_DEVICE_NEO_1_422_485_PCI_NAME	"Neo 1 422/485 PCI"
+#define PCI_DEVICE_NEO_2_422_485_PCI_NAME	"Neo 2 422/485 PCI"
+
+/*
+ * Our Global Variables.
+ */
+extern struct	uart_driver jsm_uart_driver;
+extern struct	board_ops jsm_neo_ops;
+extern int	jsm_debug;
+extern int	jsm_rawreadok;
+
+extern int	jsm_driver_state;	/* The state of the driver	*/
+extern char	*jsm_driver_state_text[];/* Array of driver state text */
+
+extern spinlock_t jsm_board_head_lock;
+extern struct list_head jsm_board_head;
+/*************************************************************************
+ *
+ * Prototypes for non-static functions used in more than one module
+ *
+ *************************************************************************/
+int jsm_mgmt_open(struct inode *inode, struct file *file);
+int jsm_mgmt_close(struct inode *inode, struct file *file);
+int jsm_mgmt_ioctl(struct inode *inode, struct file *file, unsigned int cmd, unsigned long arg);
+
+int jsm_tty_write(struct uart_port *port);
+int jsm_tty_register(struct jsm_board *brd);
+
+int jsm_tty_init(struct jsm_board *);
+int jsm_uart_port_init(struct jsm_board *);
+int jsm_remove_uart_port(struct jsm_board *);
+
+void jsm_tty_uninit(struct jsm_board *);
+
+void jsm_input(struct jsm_channel *ch);
+void jsm_carrier(struct jsm_channel *ch);
+void jsm_check_queue_flow_control(struct jsm_channel *ch);
+
+void jsm_create_driver_sysfiles(struct device_driver *);
+void jsm_remove_driver_sysfiles(struct device_driver *);
+
+/************************************************************************
+ * All structures for management ports of adapters			* 
+ ************************************************************************/
+#define DIGI_PLEN       28              /* String length                */
+#define DIGI_TSIZ       10              /* Terminal string len          */
+
+struct digi {
+	unsigned short	digi_flags;		/* Flags (see above)	*/
+	unsigned short	digi_maxcps;		/* Max printer CPS	*/
+	unsigned short	digi_maxchar;		/* Max chars in print queue */
+	unsigned short	digi_bufsize;		/* Buffer size		*/
+	unsigned char	digi_onlen;		/* Length of ON string	*/
+	unsigned char	digi_offlen;		/* Length of OFF string	*/
+	char		digi_onstr[DIGI_PLEN];	/* Printer on string	*/
+	char		digi_offstr[DIGI_PLEN];	/* Printer off string	*/
+	char		digi_term[DIGI_TSIZ];	/* terminal string	*/
+};
+
+/************************************************************************
+ * Structure to get driver status information
+ ************************************************************************/
+struct digi_dinfo {
+	u8	dinfo_nboards;		/* # boards configured	*/
+	char	dinfo_reserved[12];	/* for future expansion */
+	char	dinfo_version[16];	/* driver version	*/
+};
+
+struct digi_info {
+	unsigned int	info_bdnum;		/* Board number (0 based)  */
+	unsigned int	info_ioport;		/* io port address	   */
+	unsigned long	info_physaddr;		/* memory address	   */
+	unsigned int	info_physsize;		/* Size of host mem window */
+	unsigned int	info_memsize;		/* Amount of dual-port mem */
+						/* on board		   */
+	unsigned short	info_bdtype;		/* Board type		   */
+	unsigned short	info_nports;		/* number of ports	   */
+	char		info_bdstate;		/* board state		   */
+	char		info_reserved[7];	/* for future expansion	   */
+};
+
+struct ni_info {
+	int board;
+	int channel;
+	int dtr;
+	int rts;
+	int cts;
+	int dsr;
+	int ri;
+	int dcd;
+	int curtx;
+	int currx;
+	unsigned short iflag;
+	unsigned short oflag;
+	unsigned short cflag;
+	unsigned short lflag;
+	unsigned int mstat;
+	unsigned char hflow;
+	unsigned char xmit_stopped;
+	unsigned char recv_stopped;
+	unsigned int baud;
+};
+
+/* Ioctls needed for dpa operation */
+#define DIGI_GETDD	('d'<<8) | 248		/* get driver info      */
+#define DIGI_GETBD	('d'<<8) | 249		/* get board info       */
+#define DIGI_GET_NI_INFO ('d'<<8) | 250		/* nonintelligent state snfo */
+
+#endif

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [ patch 6/7] drivers/serial/jsm: new serial device driver
  2005-03-09 15:50               ` Wen Xiong
@ 2005-03-09 16:31                 ` Greg KH
  2005-03-09 17:31                   ` Wen Xiong
  0 siblings, 1 reply; 21+ messages in thread
From: Greg KH @ 2005-03-09 16:31 UTC (permalink / raw)
  To: Wen Xiong; +Cc: linux-kernel

On Wed, Mar 09, 2005 at 10:50:04AM -0500, Wen Xiong wrote:
> +/* Ioctls needed for dpa operation */
> +#define DIGI_GETDD	('d'<<8) | 248		/* get driver info      */
> +#define DIGI_GETBD	('d'<<8) | 249		/* get board info       */
> +#define DIGI_GET_NI_INFO ('d'<<8) | 250		/* nonintelligent state snfo */

Hm, new ioctls still?...

And the structures you are attempting to access through these ioctls are
incorrect, so if you are still insisting you need them, at least make
the code work properly :(

thanks,

greg k-h

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [ patch 6/7] drivers/serial/jsm: new serial device driver
  2005-03-09 16:31                 ` Greg KH
@ 2005-03-09 17:31                   ` Wen Xiong
  0 siblings, 0 replies; 21+ messages in thread
From: Wen Xiong @ 2005-03-09 17:31 UTC (permalink / raw)
  To: Greg KH; +Cc: Scott_Kilau, linux-kernel

Greg KH wrote:

>On Wed, Mar 09, 2005 at 10:50:04AM -0500, Wen Xiong wrote:
>  
>
>>+/* Ioctls needed for dpa operation */
>>+#define DIGI_GETDD	('d'<<8) | 248		/* get driver info      */
>>+#define DIGI_GETBD	('d'<<8) | 249		/* get board info       */
>>+#define DIGI_GET_NI_INFO ('d'<<8) | 250		/* nonintelligent state snfo */
>>    
>>
>
>Hm, new ioctls still?...
>
>And the structures you are attempting to access through these ioctls are
>incorrect, so if you are still insisting you need them, at least make
>the code work properly :(
>
>thanks,
>
>greg k-h
>
>  
>
Hi Scott,

The above three ioctls are for dpa/managment. If I removed these ioctls, 
I have to remove jsm_mgmt.c(patch5.jasmine).
Do you mind I remove jsm_mgmt.c code now? From my side, I  don't think I 
need them now.

Maybe we can have a solution in the kernel as Russell and Greg said later.

Thanks,
wendy


^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [ patch 6/7] drivers/serial/jsm: new serial device driver
  2005-03-09 19:12 ` Greg KH
@ 2005-03-09 22:11   ` Wen Xiong
  0 siblings, 0 replies; 21+ messages in thread
From: Wen Xiong @ 2005-03-09 22:11 UTC (permalink / raw)
  To: Greg KH; +Cc: Kilau, Scott, Wen Xiong, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 1062 bytes --]

Greg KH wrote:

>  
>
>>For the JSM driver, its up to you whether you feel its needed or not.
>>
>>However, I would like to mention that the DIGI drivers that currently
>>reside in the kernel sources *do* reserve that ioctl space,
>>and is acknowledged by "Documentation/ioctl-number.txt":
>>    
>>
>>>d'     F0-FF   linux/digi1.h
>>>      
>>>
>>I understand that the list is not a reservation list,
>>but a current list of potential ioctl conflicts...
>>    
>>
>
>It's not a reservation issue, it's the fact that we don't want to allow
>new ioctls, and if we do, they had better work properly (your
>implementation does not.)
>
>
>  
>
Hi Greg,

We understood that you don't want more new ioctls in the driver.  
For DPA tool(it is very good for customers) works, I think first I want 
to make this part code working, then you can decide if you pickup or not.

Old ioctls work with DPA tool. From your comments, looks old 
implementation does not work.
Need I use "register_ioctl32_convension" and 
"unregister_ioctl32_convension"?

Thank you so much!
wendy

[-- Attachment #2: patch5.jasmine --]
[-- Type: text/plain, Size: 9088 bytes --]

diff -Nuar linux-2.6.11.org/drivers/serial/jsm/jsm_mgmt.c linux-2.6.11.new/drivers/serial/jsm/jsm_mgmt.c
--- linux-2.6.11.org/drivers/serial/jsm/jsm_mgmt.c	1969-12-31 18:00:00.000000000 -0600
+++ linux-2.6.11.new/drivers/serial/jsm/jsm_mgmt.c	2005-03-04 11:28:39.420979504 -0600
@@ -0,0 +1,336 @@
+/************************************************************************
+ * Copyright 2003 Digi International (www.digi.com)
+ *
+ * Copyright (C) 2004 IBM Corporation. All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ * 
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY, EXPRESS OR IMPLIED; without even the 
+ * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 
+ * PURPOSE.  See the GNU General Public License for more details.
+ * 
+ * You should have received a copy of the GNU General Public License 
+ * along with this program; if not, write to the Free Software 
+ * Foundation, Inc., 59 * Temple Place - Suite 330, Boston,
+ * MA  02111-1307, USA.
+ *
+ * Contact Information:
+ * Scott H Kilau <Scott_Kilau@digi.com>
+ * Wendy Xiong   <wendyx@us.ltcfwd.linux.ibm.com>
+ *
+ ***********************************************************************/
+
+/************************************************************************
+ * 
+ * This file implements the mgmt functionality for the
+ * Neo and ClassicBoard based product lines.
+ * 
+ ************************************************************************
+ */
+#include <linux/ctype.h>
+#include <linux/sched.h>	/* For jiffies, task states */
+#include <linux/interrupt.h>	/* For tasklet and interrupt structs/defines */
+#include <linux/termios.h>
+#include <asm/uaccess.h>	/* For copy_from_user/copy_to_user */
+
+#include "jsm_driver.h"
+
+/* Our "in use" variables, to enforce 1 open only */
+static int jsm_mgmt_in_use[8];
+spinlock_t jsm_global_lock = SPIN_LOCK_UNLOCKED;
+
+/*
+ * jsm_mgmt_open()  
+ *
+ * Open the mgmt/downld/dpa device
+ */  
+int jsm_mgmt_open(struct inode *inode, struct file *file)
+{
+	unsigned long lock_flags;
+	unsigned int minor = JSM_MINOR(inode);
+
+	DPRINTK(MGMT, INFO, "start.\n");
+
+	spin_lock_irqsave(&jsm_global_lock, lock_flags);
+
+	/* mgmt device */
+	if (minor < 8) {
+		/* Only allow 1 open at a time on mgmt device */
+		if (jsm_mgmt_in_use[minor]) {
+			spin_unlock_irqrestore(&jsm_global_lock, lock_flags);
+			return -EBUSY;
+		}
+		jsm_mgmt_in_use[minor]++;
+	}
+	else {
+		spin_unlock_irqrestore(&jsm_global_lock, lock_flags);
+		return -ENXIO;
+	}
+
+	spin_unlock_irqrestore(&jsm_global_lock, lock_flags);
+
+	DPRINTK(MGMT, INFO, "finish.\n");
+
+	return 0;
+}
+
+/*
+ * jsm_mgmt_close()
+ *
+ * Open the mgmt/dpa device
+ */  
+int jsm_mgmt_close(struct inode *inode, struct file *file)
+{
+	unsigned long lock_flags;
+	unsigned int minor = JSM_MINOR(inode);
+
+	DPRINTK(MGMT, INFO, "start.\n");
+
+	spin_lock_irqsave(&jsm_global_lock, lock_flags);
+
+	/* mgmt device */
+	if (minor < 8) {
+		if (jsm_mgmt_in_use[minor])
+			jsm_mgmt_in_use[minor] = 0;
+	}
+	spin_unlock_irqrestore(&jsm_global_lock, lock_flags);
+
+	DPRINTK(MGMT, INFO, "finish.\n");
+
+	return 0;
+}
+
+/*
+ * jsm_mgmt_ioctl()
+ *
+ * ioctl the mgmt/dpa device
+ */  
+
+int jsm_mgmt_ioctl(struct inode *inode, struct file *file, unsigned int cmd, unsigned long arg)
+{
+	unsigned long lock_flags;
+	void __user *uarg = (void __user *) arg;
+
+	DPRINTK(MGMT, INFO, "start.\n");
+
+	switch (cmd) {
+
+	case DIGI_GETDD:
+	{
+		/*
+		 * This returns the total number of boards
+		 * in the system, as well as driver version
+		 * and has space for a reserved entry
+		 */
+		struct digi_dinfo *ddi;
+		int adapter_count;
+
+		ddi = (struct digi_dinfo *)kmalloc(sizeof(struct digi_dinfo), GFP_KERNEL);
+		if (!ddi) {
+			DPRINTK(MGMT, WARNING, "memory allocation for board structure failed\n");
+			return -ENOMEM;
+		}
+		memset(ddi, 0, sizeof(struct digi_dinfo));
+
+
+		adapter_count = get_jsm_board_number();
+
+		spin_lock_irqsave(&jsm_global_lock, lock_flags);
+
+		ddi->dinfo_nboards = adapter_count;
+		sprintf(ddi->dinfo_version, "%s", "40002438_A-INKERNEL");
+
+		spin_unlock_irqrestore(&jsm_global_lock, lock_flags);
+
+		DPRINTK(MGMT, INFO, "DIGI_GETDD returning numboards: %d version: %s\n",
+			ddi->dinfo_nboards, ddi->dinfo_version);
+
+		if (copy_to_user(uarg, &ddi, sizeof (struct digi_dinfo)))
+			return -EFAULT;
+
+		kfree(ddi);
+		break;
+	}
+
+	case DIGI_GETBD:
+	{
+		int brd;
+
+		struct digi_info *di;
+		int adapter_count;
+
+		struct list_head *tmp;
+		struct jsm_board *cur_board_entry;
+
+		if (copy_from_user(&brd, uarg, sizeof(int)))
+			return -EFAULT;
+
+		adapter_count = get_jsm_board_number();
+
+		DPRINTK(MGMT, INFO, "DIGI_GETBD asking about board: %d\n", brd);
+
+		if ((brd < 0) || (brd > adapter_count) || (adapter_count == 0))
+			return -ENODEV;
+
+		di = (struct digi_info *)kmalloc(sizeof(struct digi_info), GFP_KERNEL);
+		if (!di) {
+			DPRINTK(MGMT, WARNING, "memory allocation for board structure failed\n");
+			return -ENOMEM;
+		}
+		memset(di, 0, sizeof(struct digi_info));
+
+		di->info_bdnum = brd;
+
+		spin_lock_irqsave(&jsm_board_head_lock, lock_flags);
+		list_for_each(tmp, &jsm_board_head) {
+			cur_board_entry = list_entry(tmp, struct jsm_board,
+						  jsm_board_entry);
+			if (cur_board_entry->boardnum == brd) {
+				break;
+			}
+		}
+		spin_unlock_irqrestore(&jsm_board_head_lock, lock_flags);
+
+
+		spin_lock_irqsave(&cur_board_entry->bd_lock, lock_flags);
+
+		di->info_bdtype = cur_board_entry->dpatype;
+		di->info_bdstate = cur_board_entry->dpastatus;
+		di->info_ioport = 0;
+		di->info_physaddr = (u64) cur_board_entry->membase;
+		di->info_physsize = (u64) cur_board_entry->membase - cur_board_entry->membase_end;
+		if (cur_board_entry->state != BOARD_FAILED)
+			di->info_nports = cur_board_entry->nasync;
+		else
+			di->info_nports = 0;
+
+		spin_unlock_irqrestore(&cur_board_entry->bd_lock, lock_flags);
+
+		DPRINTK(MGMT, INFO, "DIGI_GETBD returning type: %x state: %x ports: %x size: %x\n",
+			di->info_bdtype, di->info_bdstate, di->info_nports, di->info_physsize);
+
+		if (copy_to_user(uarg, &di, sizeof (struct digi_info)))
+			return -EFAULT;
+
+		kfree(di);
+		break;
+	}
+
+	case DIGI_GET_NI_INFO:
+	{
+		struct jsm_channel *ch;
+		struct ni_info *ni;
+		u64 lock_flags;
+		u8 mstat = 0;
+		u32 board = 0;
+		u32 channel = 0;
+		int adapter_count = 0;
+		struct list_head *tmp;
+		struct jsm_board *cur_board_entry;
+
+		adapter_count = get_jsm_board_number();
+		ni = (struct ni_info *)kmalloc(sizeof(struct ni_info), GFP_KERNEL);
+		if (!ni) {
+			DPRINTK(MGMT, WARNING, "memory allocation for board structure failed\n");
+			return -ENOMEM;
+		}
+		memset(ni, 0, sizeof(struct ni_info));
+
+		if (copy_from_user(&ni, uarg, sizeof(struct ni_info)))
+			return -EFAULT;
+
+		DPRINTK(MGMT, INFO, "DIGI_GETBD asking about board: %d channel: %d\n",
+			ni->board, ni->channel);
+
+		board = ni->board;
+		channel = ni->channel;
+
+		/* Verify boundaries on board */
+		if ((board < 0) || (board > adapter_count) || (adapter_count == 0))
+			return -ENODEV;
+
+		spin_lock_irqsave(&jsm_board_head_lock, lock_flags);
+		list_for_each(tmp, &jsm_board_head) {
+			cur_board_entry = list_entry(tmp, struct jsm_board,
+					jsm_board_entry);
+			if (cur_board_entry->boardnum == board) {
+				break;
+			}
+		}
+		spin_unlock_irqrestore(&jsm_board_head_lock, lock_flags);
+
+		/* Verify boundaries on channel */
+		if ((channel < 0) || (channel > cur_board_entry->nasync))
+			return -ENODEV;
+
+		ch = cur_board_entry->channels[channel];
+
+		memset(&ni, 0, sizeof(struct ni_info));
+		ni->board = board;
+		ni->channel = channel;
+
+		spin_lock_irqsave(&ch->ch_lock, lock_flags);
+
+		mstat = (ch->ch_mostat | ch->ch_mistat);
+
+		if (mstat & UART_MCR_DTR) {
+			ni->mstat |= TIOCM_DTR;
+			ni->dtr = TIOCM_DTR;
+		}
+		if (mstat & UART_MCR_RTS) {
+			ni->mstat |= TIOCM_RTS;
+			ni->rts = TIOCM_RTS;
+		}
+		if (mstat & UART_MSR_CTS) {
+			ni->mstat |= TIOCM_CTS;
+			ni->cts = TIOCM_CTS;
+		}
+		if (mstat & UART_MSR_RI) {
+			ni->mstat |= TIOCM_RI;
+			ni->ri = TIOCM_RI;
+		}
+		if (mstat & UART_MSR_DCD) {
+			ni->mstat |= TIOCM_CD;
+			ni->dcd = TIOCM_CD;
+		}
+		if (mstat & UART_MSR_DSR)
+			ni->mstat |= TIOCM_DSR;
+
+		ni->iflag = ch->ch_c_iflag;
+		ni->oflag = ch->ch_c_oflag;
+		ni->cflag = ch->ch_c_cflag;
+		ni->lflag = ch->ch_c_lflag;
+
+		if (ch->ch_flags & CH_STOPI)
+			ni->recv_stopped = 1;
+		else
+			ni->recv_stopped = 0;
+
+		if (ch->ch_flags & CH_STOP)
+			ni->xmit_stopped = 1;
+		else
+			ni->xmit_stopped = 0;
+
+		ni->curtx = ch->ch_txcount;
+		ni->currx = ch->ch_rxcount;
+
+		ni->baud = ch->ch_old_baud;
+
+		spin_unlock_irqrestore(&ch->ch_lock, lock_flags);
+
+		if (copy_to_user(uarg, &ni, sizeof(ni)))
+			return -EFAULT;
+
+		break;
+	}
+
+	}
+
+	DPRINTK(MGMT, INFO, "finish.\n");
+
+	return 0;
+}

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [ patch 6/7] drivers/serial/jsm: new serial device driver
  2005-03-09 19:51 ` Greg KH
@ 2005-03-09 20:33   ` Wen Xiong
  0 siblings, 0 replies; 21+ messages in thread
From: Wen Xiong @ 2005-03-09 20:33 UTC (permalink / raw)
  To: Greg KH; +Cc: Kilau, Scott, Wen Xiong, linux-kernel

Greg KH wrote:

>On Wed, Mar 09, 2005 at 01:35:41PM -0600, Kilau, Scott wrote:
>  
>
>>As it stands today, your requirement appears to be that she needs
>>to yank all diags ioctls and sysfs files before the driver can make
>>it into the kernel sources.
>>    
>>
>
>Not all sysfs files, sysfs files are fine, as long as they are
>implemented properly, and are there for things that "make sense".
>
>But yes, it should would be easier to accept the driver if the ioctls
>were not there :)
>
>thanks,
>
>greg k-h
>
>  
>
Hi All,

I think Digi's DPA magagement tool has very good user interfaces. I am 
going to change and fix the problem.
Then Greg can decide if he want to pick it up or not.

I will attatch the DPA graphic interface for you next time.

Thanks,
wendy


^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [ patch 6/7] drivers/serial/jsm: new serial device driver
  2005-03-09 19:35 Kilau, Scott
@ 2005-03-09 19:51 ` Greg KH
  2005-03-09 20:33   ` Wen Xiong
  0 siblings, 1 reply; 21+ messages in thread
From: Greg KH @ 2005-03-09 19:51 UTC (permalink / raw)
  To: Kilau, Scott; +Cc: Wen Xiong, linux-kernel

On Wed, Mar 09, 2005 at 01:35:41PM -0600, Kilau, Scott wrote:
> As it stands today, your requirement appears to be that she needs
> to yank all diags ioctls and sysfs files before the driver can make
> it into the kernel sources.

Not all sysfs files, sysfs files are fine, as long as they are
implemented properly, and are there for things that "make sense".

But yes, it should would be easier to accept the driver if the ioctls
were not there :)

thanks,

greg k-h

^ permalink raw reply	[flat|nested] 21+ messages in thread

* RE: [ patch 6/7] drivers/serial/jsm: new serial device driver
@ 2005-03-09 19:35 Kilau, Scott
  2005-03-09 19:51 ` Greg KH
  0 siblings, 1 reply; 21+ messages in thread
From: Kilau, Scott @ 2005-03-09 19:35 UTC (permalink / raw)
  To: Greg KH; +Cc: Wen Xiong, linux-kernel


> > DPA support is a requirement for all Digi drivers, so it would
> > not be possible for me to remove them from my "dgnc" version
> > of the driver.

> "requirement" from whom and to who?  The Linux kernel community?

>From our customers who are moving from other OS's to Linux,
and expect DPA support to be under Linux as well.

> It's not a reservation issue, it's the fact that we don't want to
allow
> new ioctls, and if we do, they had better work properly (your
> implementation does not.)
> 
> thanks,
>
> greg k-h

Which is fine and I accept the blame for.

This is something Wendy can change and fix.
I am explaining why they exist today and my
argument of why we need them to stay.

As it stands today, your requirement appears to be that she needs
to yank all diags ioctls and sysfs files before the driver can make
it into the kernel sources.

This is also fine, but Wendy and IBM will need to decide whether
all our diags utilties are needed for the JSM driver or not.

Scott

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [ patch 6/7] drivers/serial/jsm: new serial device driver
  2005-03-09 17:42 Kilau, Scott
@ 2005-03-09 19:12 ` Greg KH
  2005-03-09 22:11   ` Wen Xiong
  0 siblings, 1 reply; 21+ messages in thread
From: Greg KH @ 2005-03-09 19:12 UTC (permalink / raw)
  To: Kilau, Scott; +Cc: Wen Xiong, linux-kernel

On Wed, Mar 09, 2005 at 11:42:31AM -0600, Kilau, Scott wrote:
> Hi Wendy, Greg, all,
> 
> If IBM intends on our DPA management program to work for the JSM
> products, the ioctls are needed.

Wendy, what is IBM's stance on this?

> DPA support is a requirement for all Digi drivers, so it would
> not be possible for me to remove them from my "dgnc" version
> of the driver.

"requirement" from whom and to who?  The Linux kernel community?

> For the JSM driver, its up to you whether you feel its needed or not.
> 
> However, I would like to mention that the DIGI drivers that currently
> reside in the kernel sources *do* reserve that ioctl space,
> and is acknowledged by "Documentation/ioctl-number.txt":
> > d'     F0-FF   linux/digi1.h
> 
> I understand that the list is not a reservation list,
> but a current list of potential ioctl conflicts...

It's not a reservation issue, it's the fact that we don't want to allow
new ioctls, and if we do, they had better work properly (your
implementation does not.)

thanks,

greg k-h

^ permalink raw reply	[flat|nested] 21+ messages in thread

* RE: [ patch 6/7] drivers/serial/jsm: new serial device driver
@ 2005-03-09 17:42 Kilau, Scott
  2005-03-09 19:12 ` Greg KH
  0 siblings, 1 reply; 21+ messages in thread
From: Kilau, Scott @ 2005-03-09 17:42 UTC (permalink / raw)
  To: Wen Xiong, Greg KH; +Cc: linux-kernel

Hi Wendy, Greg, all,

If IBM intends on our DPA management program to work for the JSM
products,
the ioctls are needed.

DPA support is a requirement for all Digi drivers, so it would
not be possible for me to remove them from my "dgnc" version
of the driver.

For the JSM driver, its up to you whether you feel its needed or not.

However, I would like to mention that the DIGI drivers that currently
reside in the kernel sources *do* reserve that ioctl space,
and is acknowledged by "Documentation/ioctl-number.txt":
> d'     F0-FF   linux/digi1.h

I understand that the list is not a reservation list,
but a current list of potential ioctl conflicts...

But the JSM driver sure doesn't add any new ioctl ranges,
or cause any new conflicts that didn't already exist.

Scott



-----Original Message-----
From: Wen Xiong [mailto:wendyx@us.ibm.com] 
Sent: Wednesday, March 09, 2005 11:32 AM
To: Greg KH
Cc: Kilau, Scott; linux-kernel@vger.kernel.org
Subject: Re: [ patch 6/7] drivers/serial/jsm: new serial device driver


Greg KH wrote:

>On Wed, Mar 09, 2005 at 10:50:04AM -0500, Wen Xiong wrote:
>  
>
>>+/* Ioctls needed for dpa operation */
>>+#define DIGI_GETDD	('d'<<8) | 248		/* get driver info
*/
>>+#define DIGI_GETBD	('d'<<8) | 249		/* get board info
*/
>>+#define DIGI_GET_NI_INFO ('d'<<8) | 250		/*
nonintelligent state snfo */
>>    
>>
>
>Hm, new ioctls still?...
>
>And the structures you are attempting to access through these ioctls
are
>incorrect, so if you are still insisting you need them, at least make
>the code work properly :(
>
>thanks,
>
>greg k-h
>
>  
>
Hi Scott,

The above three ioctls are for dpa/managment. If I removed these ioctls,

I have to remove jsm_mgmt.c(patch5.jasmine).
Do you mind I remove jsm_mgmt.c code now? From my side, I  don't think I

need them now.

Maybe we can have a solution in the kernel as Russell and Greg said
later.

Thanks,
wendy


^ permalink raw reply	[flat|nested] 21+ messages in thread

end of thread, other threads:[~2005-03-09 23:05 UTC | newest]

Thread overview: 21+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-02-27 23:40 [ patch 6/7] drivers/serial/jsm: new serial device driver Wen Xiong
2005-02-28  0:47 ` Jeff Garzik
2005-02-28  3:22   ` Christoph Hellwig
2005-02-28  0:56 ` Rik van Riel
2005-02-28  1:45 ` Nish Aravamudan
2005-02-28  6:55 ` Greg KH
2005-03-04 21:08   ` Wen Xiong
2005-03-05  6:44     ` Greg KH
2005-03-07 22:48       ` Wen Xiong
2005-03-08  6:42         ` Greg KH
2005-03-08 18:42           ` Wen Xiong
2005-03-09  6:04             ` Greg KH
2005-03-09 15:50               ` Wen Xiong
2005-03-09 16:31                 ` Greg KH
2005-03-09 17:31                   ` Wen Xiong
2005-03-09 17:42 Kilau, Scott
2005-03-09 19:12 ` Greg KH
2005-03-09 22:11   ` Wen Xiong
2005-03-09 19:35 Kilau, Scott
2005-03-09 19:51 ` Greg KH
2005-03-09 20:33   ` Wen Xiong

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).