diff options
Diffstat (limited to 'drivers/char/rio')
43 files changed, 1773 insertions, 3800 deletions
diff --git a/drivers/char/rio/Makefile b/drivers/char/rio/Makefile index bce2bd1204e..2d1c5a7cba7 100644 --- a/drivers/char/rio/Makefile +++ b/drivers/char/rio/Makefile @@ -9,4 +9,4 @@ obj-$(CONFIG_RIO) += rio.o rio-objs := rio_linux.o rioinit.o rioboot.o riocmd.o rioctrl.o riointr.o \ - rioparam.o riopcicopy.o rioroute.o riotable.o riotty.o + rioparam.o rioroute.o riotable.o riotty.o diff --git a/drivers/char/rio/board.h b/drivers/char/rio/board.h index 29c98020409..bdea633a907 100644 --- a/drivers/char/rio/board.h +++ b/drivers/char/rio/board.h @@ -33,10 +33,6 @@ #ifndef __rio_board_h__ #define __rio_board_h__ -#ifdef SCCS_LABELS -static char *_board_h_sccs_ = "@(#)board.h 1.2"; -#endif - /* ** board.h contains the definitions for the *hardware* of the host cards. ** It describes the memory overlay for the dual port RAM area. @@ -53,29 +49,29 @@ static char *_board_h_sccs_ = "@(#)board.h 1.2"; ** The shape of the Host Control area, at offset 0x7C00, Write Only */ struct s_Ctrl { - BYTE DpCtl; /* 7C00 */ - BYTE Dp_Unused2_[127]; - BYTE DpIntSet; /* 7C80 */ - BYTE Dp_Unused3_[127]; - BYTE DpTpuReset; /* 7D00 */ - BYTE Dp_Unused4_[127]; - BYTE DpIntReset; /* 7D80 */ - BYTE Dp_Unused5_[127]; + u8 DpCtl; /* 7C00 */ + u8 Dp_Unused2_[127]; + u8 DpIntSet; /* 7C80 */ + u8 Dp_Unused3_[127]; + u8 DpTpuReset; /* 7D00 */ + u8 Dp_Unused4_[127]; + u8 DpIntReset; /* 7D80 */ + u8 Dp_Unused5_[127]; }; /* ** The PROM data area on the host (0x7C00), Read Only */ struct s_Prom { - WORD DpSlxCode[2]; - WORD DpRev; - WORD Dp_Unused6_; - WORD DpUniq[4]; - WORD DpJahre; - WORD DpWoche; - WORD DpHwFeature[5]; - WORD DpOemId; - WORD DpSiggy[16]; + u16 DpSlxCode[2]; + u16 DpRev; + u16 Dp_Unused6_; + u16 DpUniq[4]; + u16 DpJahre; + u16 DpWoche; + u16 DpHwFeature[5]; + u16 DpOemId; + u16 DpSiggy[16]; }; /* @@ -90,19 +86,19 @@ union u_CtrlProm { /* This is the control/PROM area (0x7C00) */ ** The top end of memory! */ struct s_ParmMapS { /* Area containing Parm Map Pointer */ - BYTE Dp_Unused8_[DP_PARMMAP_ADDR]; - WORD DpParmMapAd; + u8 Dp_Unused8_[DP_PARMMAP_ADDR]; + u16 DpParmMapAd; }; struct s_StartUpS { - BYTE Dp_Unused9_[DP_STARTUP_ADDR]; - BYTE Dp_LongJump[0x4]; - BYTE Dp_Unused10_[2]; - BYTE Dp_ShortJump[0x2]; + u8 Dp_Unused9_[DP_STARTUP_ADDR]; + u8 Dp_LongJump[0x4]; + u8 Dp_Unused10_[2]; + u8 Dp_ShortJump[0x2]; }; union u_Sram2ParmMap { /* This is the top of memory (0x7E00-0x7FFF) */ - BYTE DpSramMem[DP_SRAM2_SIZE]; + u8 DpSramMem[DP_SRAM2_SIZE]; struct s_ParmMapS DpParmMapS; struct s_StartUpS DpStartUpS; }; @@ -111,11 +107,11 @@ union u_Sram2ParmMap { /* This is the top of memory (0x7E00-0x7FFF) */ ** This is the DP RAM overlay. */ struct DpRam { - BYTE DpSram1[DP_SRAM1_SIZE]; /* 0000 - 7BFF */ + u8 DpSram1[DP_SRAM1_SIZE]; /* 0000 - 7BFF */ union u_CtrlProm DpCtrlProm; /* 7C00 - 7DFF */ union u_Sram2ParmMap DpSram2ParmMap; /* 7E00 - 7FFF */ - BYTE DpScratch[DP_SCRATCH_SIZE]; /* 8000 - 8FFF */ - BYTE DpSram3[DP_SRAM3_SIZE]; /* 9000 - FFFF */ + u8 DpScratch[DP_SCRATCH_SIZE]; /* 8000 - 8FFF */ + u8 DpSram3[DP_SRAM3_SIZE]; /* 9000 - FFFF */ }; #define DpControl DpCtrlProm.DpCtrl.DpCtl diff --git a/drivers/char/rio/bootpkt.h b/drivers/char/rio/bootpkt.h deleted file mode 100644 index 602266e0c08..00000000000 --- a/drivers/char/rio/bootpkt.h +++ /dev/null @@ -1,61 +0,0 @@ - - -/**************************************************************************** - ******* ******* - ******* B O O T P A C K E T H E A D E R F I L E - ******* ******* - **************************************************************************** - - Author : Ian Nandhra - Date : - - * - * (C) 1990 - 2000 Specialix International Ltd., Byfleet, Surrey, UK. - * - * 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 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; 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. - - Version : 0.01 - - - Mods - ---------------------------------------------------------------------------- - Date By Description - ---------------------------------------------------------------------------- - - ***************************************************************************/ - -#ifndef _pkt_h -#define _pkt_h 1 - -#ifndef lint -#ifdef SCCS -static char *_rio_bootpkt_h_sccs = "@(#)bootpkt.h 1.1"; -#endif -#endif - - /************************************************* - * Overlayed onto the Data fields of a regular - * Packet - ************************************************/ -typedef struct BOOT_PKT BOOT_PKT; -struct BOOT_PKT { - short seq_num; - char data[10]; -}; - - -#endif - -/*********** end of file ***********/ diff --git a/drivers/char/rio/cirrus.h b/drivers/char/rio/cirrus.h index 89bd94eb45b..f4f837f8682 100644 --- a/drivers/char/rio/cirrus.h +++ b/drivers/char/rio/cirrus.h @@ -40,73 +40,7 @@ #endif #define _cirrus_h 1 - - -/* Bit fields for particular registers */ - -/* GCR */ -#define GCR_SERIAL 0x00 /* Configure as serial channel */ -#define GCR_PARALLEL 0x80 /* Configure as parallel channel */ - -/* RDSR - when status read from FIFO */ -#define RDSR_BREAK 0x08 /* Break received */ -#define RDSR_TIMEOUT 0x80 /* No new data timeout */ -#define RDSR_SC1 0x10 /* Special char 1 (tx XON) matched */ -#define RDSR_SC2 0x20 /* Special char 2 (tx XOFF) matched */ -#define RDSR_SC12_MASK 0x30 /* Mask for special chars 1 and 2 */ - -/* PPR */ -#define PPR_DEFAULT 0x31 /* Default value - for a 25Mhz clock gives - a timeout period of 1ms */ - -/* LIVR */ -#define LIVR_EXCEPTION 0x07 /* Receive exception interrupt */ - -/* CCR */ -#define CCR_RESET 0x80 /* Reset channel */ -#define CCR_CHANGE 0x4e /* COR's have changed - NB always change all - COR's */ -#define CCR_WFLUSH 0x82 /* Flush transmit FIFO and TSR / THR */ - -#define CCR_SENDSC1 0x21 /* Send special character one */ -#define CCR_SENDSC2 0x22 /* Send special character two */ -#define CCR_SENDSC3 0x23 /* Send special character three */ -#define CCR_SENDSC4 0x24 /* Send special character four */ - -#define CCR_TENABLE 0x18 /* Enable transmitter */ -#define CCR_TDISABLE 0x14 /* Disable transmitter */ -#define CCR_RENABLE 0x12 /* Enable receiver */ -#define CCR_RDISABLE 0x11 /* Disable receiver */ - -#define CCR_READY 0x00 /* CCR is ready for another command */ - -/* CCSR */ -#define CCSR_TXENABLE 0x08 /* Transmitter enable */ -#define CCSR_RXENABLE 0x80 /* Receiver enable */ -#define CCSR_TXFLOWOFF 0x04 /* Transmit flow off */ -#define CCSR_TXFLOWON 0x02 /* Transmit flow on */ - -/* SVRR */ -#define SVRR_RECEIVE 0x01 /* Receive interrupt pending */ -#define SVRR_TRANSMIT 0x02 /* Transmit interrupt pending */ -#define SVRR_MODEM 0x04 /* Modem interrupt pending */ - -/* CAR */ -#define CAR_PORTS 0x03 /* Bit fields for ports */ - -/* IER */ -#define IER_MODEM 0x80 /* Change in modem status */ -#define IER_RECEIVE 0x10 /* Good data / data exception */ -#define IER_TRANSMITR 0x04 /* Transmit ready (FIFO empty) */ -#define IER_TRANSMITE 0x02 /* Transmit empty */ -#define IER_TIMEOUT 0x01 /* Timeout on no data */ - -#define IER_DEFAULT 0x94 /* Default values */ -#define IER_PARALLEL 0x84 /* Default for Parallel */ -#define IER_EMPTY 0x92 /* Transmitter empty rather than ready */ - -/* COR1 - Driver only */ -#define COR1_INPCK 0x10 /* Check parity of received characters */ +/* Bit fields for particular registers shared with driver */ /* COR1 - driver and RTA */ #define COR1_ODD 0x80 /* Odd parity */ @@ -222,35 +156,6 @@ #define MSVR1_HOST 0xf3 /* The bits the host wants */ -/* MSVR2 */ -#define MSVR2_DSR 0x02 /* DSR output pin (DTR on Cirrus) */ - -/* MCOR */ -#define MCOR_CD 0x80 /* CD (DSR on Cirrus) */ -#define MCOR_RTS 0x40 /* RTS (CTS on Cirrus) */ -#define MCOR_RI 0x20 /* RI */ -#define MCOR_DTR 0x10 /* DTR (CD on Cirrus) */ - -#define MCOR_DEFAULT (MCOR_CD | MCOR_RTS | MCOR_RI | MCOR_DTR) -#define MCOR_FULLMODEM MCOR_DEFAULT -#define MCOR_RJ45 (MCOR_CD | MCOR_RTS | MCOR_DTR) -#define MCOR_RESTRICTED (MCOR_CD | MCOR_RTS) - -/* More MCOR - H/W Handshake (flowcontrol) stuff */ -#define MCOR_THRESH8 0x08 /* eight characters then we stop */ -#define MCOR_THRESH9 0x09 /* nine characters then we stop */ -#define MCOR_THRESH10 0x0A /* ten characters then we stop */ -#define MCOR_THRESH11 0x0B /* eleven characters then we stop */ - -#define MCOR_THRESHBITS 0x0F /* mask for ANDing out the above */ - -#define MCOR_THRESHOLD MCOR_THRESH9 /* MUST BE GREATER THAN COR3_THRESHOLD */ - - -/* RTPR */ -#define RTPR_DEFAULT 0x02 /* Default */ - - /* Defines for the subscripts of a CONFIG packet */ #define CONFIG_COR1 1 /* Option register 1 */ #define CONFIG_COR2 2 /* Option register 2 */ @@ -264,19 +169,6 @@ #define CONFIG_TXBAUD 10 /* Tx baud rate */ #define CONFIG_RXBAUD 11 /* Rx baud rate */ -/* Port status stuff */ -#define IDLE_CLOSED 0 /* Closed */ -#define IDLE_OPEN 1 /* Idle open */ -#define IDLE_BREAK 2 /* Idle on break */ - -/* Subscript of MODEM STATUS packet */ -#define MODEM_VALUE 3 /* Current values of handshake pins */ -/* Subscript of SBREAK packet */ -#define BREAK_LENGTH 1 /* Length of a break in slices of 0.01 seconds - 0 = stay on break until an EBREAK command - is sent */ - - #define PRE_EMPTIVE 0x80 /* Pre-emptive bit in command field */ /* Packet types going from Host to remote - with the exception of OPEN, MOPEN, diff --git a/drivers/char/rio/cmdblk.h b/drivers/char/rio/cmdblk.h index a9a8c45631d..c46b2fdb662 100644 --- a/drivers/char/rio/cmdblk.h +++ b/drivers/char/rio/cmdblk.h @@ -48,10 +48,10 @@ struct CmdBlk { struct CmdBlk *NextP; /* Pointer to next command block */ struct PKT Packet; /* A packet, to copy to the rup */ /* The func to call to check if OK */ - int (*PreFuncP) (int, struct CmdBlk *); + int (*PreFuncP) (unsigned long, struct CmdBlk *); int PreArg; /* The arg for the func */ /* The func to call when completed */ - int (*PostFuncP) (int, struct CmdBlk *); + int (*PostFuncP) (unsigned long, struct CmdBlk *); int PostArg; /* The arg for the func */ }; diff --git a/drivers/char/rio/cmdpkt.h b/drivers/char/rio/cmdpkt.h index 77cee8df68e..357ae572243 100644 --- a/drivers/char/rio/cmdpkt.h +++ b/drivers/char/rio/cmdpkt.h @@ -55,24 +55,24 @@ static char *_cmdpkt_h_sccs_ = "@(#)cmdpkt.h 1.2"; ** at Data[2] in the actual pkt! */ struct BootSequence { - WORD NumPackets; - WORD LoadBase; - WORD CodeSize; + u16 NumPackets; + u16 LoadBase; + u16 CodeSize; }; #define BOOT_SEQUENCE_LEN 8 struct SamTop { - BYTE Unit; - BYTE Link; + u8 Unit; + u8 Link; }; struct CmdHdr { - BYTE PcCommand; + u8 PcCommand; union { - BYTE PcPhbNum; - BYTE PcLinkNum; - BYTE PcIDNum; + u8 PcPhbNum; + u8 PcLinkNum; + u8 PcIDNum; } U0; }; @@ -84,28 +84,28 @@ struct PktCmd { struct BootSequence PcBootSequence; } S1; struct { - WORD PcSequence; - BYTE PcBootData[RTA_BOOT_DATA_SIZE]; + u16 PcSequence; + u8 PcBootData[RTA_BOOT_DATA_SIZE]; } S2; struct { - WORD __crud__; - BYTE PcUniqNum[4]; /* this is really a uint. */ - BYTE PcModuleTypes; /* what modules are fitted */ + u16 __crud__; + u8 PcUniqNum[4]; /* this is really a uint. */ + u8 PcModuleTypes; /* what modules are fitted */ } S3; struct { struct CmdHdr CmdHdr; - BYTE __undefined__; - BYTE PcModemStatus; - BYTE PcPortStatus; - BYTE PcSubCommand; /* commands like mem or register dump */ - WORD PcSubAddr; /* Address for command */ - BYTE PcSubData[64]; /* Date area for command */ + u8 __undefined__; + u8 PcModemStatus; + u8 PcPortStatus; + u8 PcSubCommand; /* commands like mem or register dump */ + u16 PcSubAddr; /* Address for command */ + u8 PcSubData[64]; /* Date area for command */ } S4; struct { struct CmdHdr CmdHdr; - BYTE PcCommandText[1]; - BYTE __crud__[20]; - BYTE PcIDNum2; /* It had to go somewhere! */ + u8 PcCommandText[1]; + u8 __crud__[20]; + u8 PcIDNum2; /* It had to go somewhere! */ } S5; struct { struct CmdHdr CmdHdr; @@ -118,45 +118,45 @@ struct PktCmd_M { union { struct { struct { - uchar PcCommand; + u8 PcCommand; union { - uchar PcPhbNum; - uchar PcLinkNum; - uchar PcIDNum; + u8 PcPhbNum; + u8 PcLinkNum; + u8 PcIDNum; } U0; } CmdHdr; struct { - ushort NumPackets; - ushort LoadBase; - ushort CodeSize; + u16 NumPackets; + u16 LoadBase; + u16 CodeSize; } PcBootSequence; } S1; struct { - ushort PcSequence; - uchar PcBootData[RTA_BOOT_DATA_SIZE]; + u16 PcSequence; + u8 PcBootData[RTA_BOOT_DATA_SIZE]; } S2; struct { - ushort __crud__; - uchar PcUniqNum[4]; /* this is really a uint. */ - uchar PcModuleTypes; /* what modules are fitted */ + u16 __crud__; + u8 PcUniqNum[4]; /* this is really a uint. */ + u8 PcModuleTypes; /* what modules are fitted */ } S3; struct { - ushort __cmd_hdr__; - uchar __undefined__; - uchar PcModemStatus; - uchar PcPortStatus; - uchar PcSubCommand; - ushort PcSubAddr; - uchar PcSubData[64]; + u16 __cmd_hdr__; + u8 __undefined__; + u8 PcModemStatus; + u8 PcPortStatus; + u8 PcSubCommand; + u16 PcSubAddr; + u8 PcSubData[64]; } S4; struct { - ushort __cmd_hdr__; - uchar PcCommandText[1]; - uchar __crud__[20]; - uchar PcIDNum2; /* Tacked on end */ + u16 __cmd_hdr__; + u8 PcCommandText[1]; + u8 __crud__[20]; + u8 PcIDNum2; /* Tacked on end */ } S5; struct { - ushort __cmd_hdr__; + u16 __cmd_hdr__; struct Top Topology[LINKS_PER_UNIT]; } S6; } U1; diff --git a/drivers/char/rio/control.h b/drivers/char/rio/control.h deleted file mode 100644 index 6853d03304a..00000000000 --- a/drivers/char/rio/control.h +++ /dev/null @@ -1,61 +0,0 @@ - - -/**************************************************************************** - ******* ******* - ******* C O N T R O L P A C K E T H E A D E R S - ******* ******* - **************************************************************************** - - Author : Jon Brawn - Date : - - * - * (C) 1990 - 2000 Specialix International Ltd., Byfleet, Surrey, UK. - * - * 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 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; 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. - - Version : 0.01 - - - Mods - ---------------------------------------------------------------------------- - Date By Description - ---------------------------------------------------------------------------- - - ***************************************************************************/ - - -#ifndef _control_h -#define _control_h - -#ifndef lint -/* static char *_rio_control_h_sccs = "@(#)control.h 1.4"; */ -#endif - -#define CONTROL '^' -#define IFOAD ( CONTROL + 1 ) -#define IDENTIFY ( CONTROL + 2 ) -#define ZOMBIE ( CONTROL + 3 ) -#define UFOAD ( CONTROL + 4 ) -#define IWAIT ( CONTROL + 5 ) - -#define IFOAD_MAGIC 0xF0AD /* of course */ -#define ZOMBIE_MAGIC (~0xDEAD) /* not dead -> zombie */ -#define UFOAD_MAGIC 0xD1E /* kill-your-neighbour */ -#define IWAIT_MAGIC 0xB1DE /* Bide your time */ - -#endif - -/*********** end of file ***********/ diff --git a/drivers/char/rio/daemon.h b/drivers/char/rio/daemon.h index 28a991bd4fe..5818a8aa46e 100644 --- a/drivers/char/rio/daemon.h +++ b/drivers/char/rio/daemon.h @@ -45,15 +45,15 @@ static char *_daemon_h_sccs_ = "@(#)daemon.h 1.3"; */ struct Error { - uint Error; - uint Entry; - uint Other; + unsigned int Error; + unsigned int Entry; + unsigned int Other; }; struct DownLoad { char *DataP; - uint Count; - uint ProductCode; + unsigned int Count; + unsigned int ProductCode; }; /* @@ -68,69 +68,64 @@ struct DownLoad { #endif struct PortSetup { - uint From; /* Set/Clear XP & IXANY Control from this port.... */ - uint To; /* .... to this port */ - uint XpCps; /* at this speed */ + unsigned int From; /* Set/Clear XP & IXANY Control from this port.... */ + unsigned int To; /* .... to this port */ + unsigned int XpCps; /* at this speed */ char XpOn[MAX_XP_CTRL_LEN]; /* this is the start string */ char XpOff[MAX_XP_CTRL_LEN]; /* this is the stop string */ - uchar IxAny; /* enable/disable IXANY */ - uchar IxOn; /* enable/disable IXON */ - uchar Lock; /* lock port params */ - uchar Store; /* store params across closes */ - uchar Drain; /* close only when drained */ + u8 IxAny; /* enable/disable IXANY */ + u8 IxOn; /* enable/disable IXON */ + u8 Lock; /* lock port params */ + u8 Store; /* store params across closes */ + u8 Drain; /* close only when drained */ }; struct LpbReq { - uint Host; - uint Link; + unsigned int Host; + unsigned int Link; struct LPB *LpbP; }; struct RupReq { - uint HostNum; - uint RupNum; + unsigned int HostNum; + unsigned int RupNum; struct RUP *RupP; }; struct PortReq { - uint SysPort; + unsigned int SysPort; struct Port *PortP; }; struct StreamInfo { - uint SysPort; -#if 0 - queue_t RQueue; - queue_t WQueue; -#else + unsigned int SysPort; int RQueue; int WQueue; -#endif }; struct HostReq { - uint HostNum; + unsigned int HostNum; struct Host *HostP; }; struct HostDpRam { - uint HostNum; + unsigned int HostNum; struct DpRam *DpRamP; }; struct DebugCtrl { - uint SysPort; - uint Debug; - uint Wait; + unsigned int SysPort; + unsigned int Debug; + unsigned int Wait; }; struct MapInfo { - uint FirstPort; /* 8 ports, starting from this (tty) number */ - uint RtaUnique; /* reside on this RTA (unique number) */ + unsigned int FirstPort; /* 8 ports, starting from this (tty) number */ + unsigned int RtaUnique; /* reside on this RTA (unique number) */ }; struct MapIn { - uint NumEntries; /* How many port sets are we mapping? */ + unsigned int NumEntries; /* How many port sets are we mapping? */ struct MapInfo *MapInfoP; /* Pointer to (user space) info */ }; @@ -147,13 +142,13 @@ struct SpecialRupCmd { }; struct IdentifyRta { - ulong RtaUnique; - uchar ID; + unsigned long RtaUnique; + u8 ID; }; struct KillNeighbour { - ulong UniqueNum; - uchar Link; + unsigned long UniqueNum; + u8 Link; }; struct rioVersion { diff --git a/drivers/char/rio/defaults.h b/drivers/char/rio/defaults.h deleted file mode 100644 index d55c2f6a987..00000000000 --- a/drivers/char/rio/defaults.h +++ /dev/null @@ -1,51 +0,0 @@ - -/**************************************************************************** - ******* ******* - ******* D E F A U L T S - ******* ******* - **************************************************************************** - - Author : Ian Nandhra - Date : - - * - * (C) 1990 - 2000 Specialix International Ltd., Byfleet, Surrey, UK. - * - * 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 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; 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. - - Version : 0.01 - - - Mods - ---------------------------------------------------------------------------- - Date By Description - ---------------------------------------------------------------------------- - - ***************************************************************************/ - -#ifndef lint -#ifdef SCCS -static char *_rio_defaults_h_sccs = "@(#)defaults.h 1.1"; -#endif -#endif - - -#define MILLISECOND (int) (1000/64) /* 15.625 low ticks */ -#define SECOND (int) 15625 /* Low priority ticks */ - -#define LINK_TIMEOUT (int) (POLL_PERIOD / 2) - - -/*********** end of file ***********/ diff --git a/drivers/char/rio/error.h b/drivers/char/rio/error.h deleted file mode 100644 index f20f0789db8..00000000000 --- a/drivers/char/rio/error.h +++ /dev/null @@ -1,82 +0,0 @@ - -/**************************************************************************** - ******* ******* - ******* E R R O R H E A D E R F I L E - ******* ******* - **************************************************************************** - - Author : Ian Nandhra - Date : - - * - * (C) 1990 - 2000 Specialix International Ltd., Byfleet, Surrey, UK. - * - * 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 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; 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. - - Version : 0.01 - - - Mods - ---------------------------------------------------------------------------- - Date By Description - ---------------------------------------------------------------------------- - - ***************************************************************************/ - -#ifndef lint -/* static char *_rio_error_h_sccs = "@(#)error.h 1.3"; */ -#endif - -#define E_NO_ERROR ((ushort) 0) -#define E_PROCESS_NOT_INIT ((ushort) 1) -#define E_LINK_TIMEOUT ((ushort) 2) -#define E_NO_ROUTE ((ushort) 3) -#define E_CONFUSED ((ushort) 4) -#define E_HOME ((ushort) 5) -#define E_CSUM_FAIL ((ushort) 6) -#define E_DISCONNECTED ((ushort) 7) -#define E_BAD_RUP ((ushort) 8) -#define E_NO_VIRGIN ((ushort) 9) -#define E_BOOT_RUP_BUSY ((ushort) 10) - - - - /************************************************* - * Parsed to mem_halt() - ************************************************/ -#define E_CHANALLOC ((ushort) 0x80) -#define E_POLL_ALLOC ((ushort) 0x81) -#define E_LTTWAKE ((ushort) 0x82) -#define E_LTT_ALLOC ((ushort) 0x83) -#define E_LRT_ALLOC ((ushort) 0x84) -#define E_CIRRUS ((ushort) 0x85) -#define E_MONITOR ((ushort) 0x86) -#define E_PHB_ALLOC ((ushort) 0x87) -#define E_ARRAY_ALLOC ((ushort) 0x88) -#define E_QBUF_ALLOC ((ushort) 0x89) -#define E_PKT_ALLOC ((ushort) 0x8a) -#define E_GET_TX_Q_BUF ((ushort) 0x8b) -#define E_GET_RX_Q_BUF ((ushort) 0x8c) -#define E_MEM_OUT ((ushort) 0x8d) -#define E_MMU_INIT ((ushort) 0x8e) -#define E_LTT_INIT ((ushort) 0x8f) -#define E_LRT_INIT ((ushort) 0x90) -#define E_LINK_RUN ((ushort) 0x91) -#define E_MONITOR_ALLOC ((ushort) 0x92) -#define E_MONITOR_INIT ((ushort) 0x93) -#define E_POLL_INIT ((ushort) 0x94) - - -/*********** end of file ***********/ diff --git a/drivers/char/rio/func.h b/drivers/char/rio/func.h index b4778410ec6..e64fe991239 100644 --- a/drivers/char/rio/func.h +++ b/drivers/char/rio/func.h @@ -43,35 +43,33 @@ static char *_func_h_sccs_ = "@(#)func.h 1.3"; /* rioboot.c */ int RIOBootCodeRTA(struct rio_info *, struct DownLoad *); -int RIOBootCodeHOST(struct rio_info *, register struct DownLoad *); +int RIOBootCodeHOST(struct rio_info *, struct DownLoad *); int RIOBootCodeUNKNOWN(struct rio_info *, struct DownLoad *); void msec_timeout(struct Host *); -int RIOBootRup(struct rio_info *, uint, struct Host *, struct PKT *); -int RIOBootOk(struct rio_info *, struct Host *, ulong); -int RIORtaBound(struct rio_info *, uint); -void FillSlot(int, int, uint, struct Host *); +int RIOBootRup(struct rio_info *, unsigned int, struct Host *, struct PKT *); +int RIOBootOk(struct rio_info *, struct Host *, unsigned long); +int RIORtaBound(struct rio_info *, unsigned int); +void rio_fill_host_slot(int, int, unsigned int, struct Host *); /* riocmd.c */ int RIOFoadRta(struct Host *, struct Map *); int RIOZombieRta(struct Host *, struct Map *); -int RIOCommandRta(struct rio_info *, uint, int (*func) (struct Host *, struct Map *)); -int RIOIdentifyRta(struct rio_info *, caddr_t); -int RIOKillNeighbour(struct rio_info *, caddr_t); +int RIOCommandRta(struct rio_info *, unsigned long, int (*func) (struct Host *, struct Map *)); +int RIOIdentifyRta(struct rio_info *, void *); +int RIOKillNeighbour(struct rio_info *, void *); int RIOSuspendBootRta(struct Host *, int, int); int RIOFoadWakeup(struct rio_info *); struct CmdBlk *RIOGetCmdBlk(void); void RIOFreeCmdBlk(struct CmdBlk *); -int RIOQueueCmdBlk(struct Host *, uint, struct CmdBlk *); +int RIOQueueCmdBlk(struct Host *, unsigned int, struct CmdBlk *); void RIOPollHostCommands(struct rio_info *, struct Host *); -int RIOWFlushMark(int, struct CmdBlk *); -int RIORFlushEnable(int, struct CmdBlk *); -int RIOUnUse(int, struct CmdBlk *); -void ShowPacket(uint, struct PKT *); +int RIOWFlushMark(unsigned long, struct CmdBlk *); +int RIORFlushEnable(unsigned long, struct CmdBlk *); +int RIOUnUse(unsigned long, struct CmdBlk *); /* rioctrl.c */ -int copyin(int, caddr_t, int); int riocontrol(struct rio_info *, dev_t, int, caddr_t, int); -int RIOPreemptiveCmd(struct rio_info *, struct Port *, uchar); +int RIOPreemptiveCmd(struct rio_info *, struct Port *, unsigned char); /* rioinit.c */ void rioinit(struct rio_info *, struct RioHostInfo *); @@ -80,19 +78,17 @@ void RIOISAinit(struct rio_info *, int); int RIODoAT(struct rio_info *, int, int); caddr_t RIOCheckForATCard(int); int RIOAssignAT(struct rio_info *, int, caddr_t, int); -int RIOBoardTest(paddr_t, caddr_t, uchar, int); +int RIOBoardTest(unsigned long, caddr_t, unsigned char, int); void RIOAllocDataStructs(struct rio_info *); void RIOSetupDataStructs(struct rio_info *); -int RIODefaultName(struct rio_info *, struct Host *, uint); +int RIODefaultName(struct rio_info *, struct Host *, unsigned int); struct rioVersion *RIOVersid(void); -int RIOMapin(paddr_t, int, caddr_t *); -void RIOMapout(paddr_t, long, caddr_t); -void RIOHostReset(uint, volatile struct DpRam *, uint); +void RIOHostReset(unsigned int, struct DpRam *, unsigned int); /* riointr.c */ void RIOTxEnable(char *); void RIOServiceHost(struct rio_info *, struct Host *, int); -int riotproc(struct rio_info *, register struct ttystatics *, int, int); +int riotproc(struct rio_info *, struct ttystatics *, int, int); /* rioparam.c */ int RIOParam(struct Port *, int, int, int); @@ -106,18 +102,18 @@ int can_remove_receive(struct PKT **, struct Port *); void remove_receive(struct Port *); /* rioroute.c */ -int RIORouteRup(struct rio_info *, uint, struct Host *, struct PKT *); -void RIOFixPhbs(struct rio_info *, struct Host *, uint); -uint GetUnitType(uint); +int RIORouteRup(struct rio_info *, unsigned int, struct Host *, struct PKT *); +void RIOFixPhbs(struct rio_info *, struct Host *, unsigned int); +unsigned int GetUnitType(unsigned int); int RIOSetChange(struct rio_info *); -int RIOFindFreeID(struct rio_info *, struct Host *, uint *, uint *); +int RIOFindFreeID(struct rio_info *, struct Host *, unsigned int *, unsigned int *); /* riotty.c */ int riotopen(struct tty_struct *tty, struct file *filp); int riotclose(void *ptr); -int riotioctl(struct rio_info *, struct tty_struct *, register int, register caddr_t); +int riotioctl(struct rio_info *, struct tty_struct *, int, caddr_t); void ttyseth(struct Port *, struct ttystatics *, struct old_sgttyb *sg); /* riotable.c */ @@ -131,7 +127,7 @@ int RIOChangeName(struct rio_info *, struct Map *); #if 0 /* riodrvr.c */ struct rio_info *rio_install(struct RioHostInfo *); -int rio_uninstall(register struct rio_info *); +int rio_uninstall(struct rio_info *); int rio_open(struct rio_info *, int, struct file *); int rio_close(struct rio_info *, struct file *); int rio_read(struct rio_info *, struct file *, char *, int); @@ -143,7 +139,7 @@ int rio_isr_thread(char *); struct rio_info *rio_info_store(int cmd, struct rio_info *p); #endif -extern int rio_pcicopy(char *src, char *dst, int n); +extern void rio_copy_to_card(void *to, void *from, int len); extern int rio_minor(struct tty_struct *tty); extern int rio_ismodem(struct tty_struct *tty); diff --git a/drivers/char/rio/host.h b/drivers/char/rio/host.h index f7dfcedf7d4..3ec73d1a279 100644 --- a/drivers/char/rio/host.h +++ b/drivers/char/rio/host.h @@ -50,22 +50,20 @@ static char *_host_h_sccs_ = "@(#)host.h 1.2"; ** the host. */ struct Host { - uchar Type; /* RIO_EISA, RIO_MCA, ... */ - uchar Ivec; /* POLLED or ivec number */ - uchar Mode; /* Control stuff */ - uchar Slot; /* Slot */ - volatile caddr_t Caddr; /* KV address of DPRAM */ - volatile struct DpRam *CardP; /* KV address of DPRAM, with overlay */ - paddr_t PaddrP; /* Phys. address of DPRAM */ + unsigned char Type; /* RIO_EISA, RIO_MCA, ... */ + unsigned char Ivec; /* POLLED or ivec number */ + unsigned char Mode; /* Control stuff */ + unsigned char Slot; /* Slot */ + caddr_t Caddr; /* KV address of DPRAM */ + struct DpRam *CardP; /* KV address of DPRAM, with overlay */ + unsigned long PaddrP; /* Phys. address of DPRAM */ char Name[MAX_NAME_LEN]; /* The name of the host */ - uint UniqueNum; /* host unique number */ + unsigned int UniqueNum; /* host unique number */ spinlock_t HostLock; /* Lock structure for MPX */ - /*struct pci_devinfo PciDevInfo; *//* PCI Bus/Device/Function stuff */ - /*struct lockb HostLock; *//* Lock structure for MPX */ - uint WorkToBeDone; /* set to true each interrupt */ - uint InIntr; /* Being serviced? */ - uint IntSrvDone; /* host's interrupt has been serviced */ - int (*Copy) (caddr_t, caddr_t, int); /* copy func */ + unsigned int WorkToBeDone; /* set to true each interrupt */ + unsigned int InIntr; /* Being serviced? */ + unsigned int IntSrvDone; /* host's interrupt has been serviced */ + void (*Copy) (void *, void *, int); /* copy func */ struct timer_list timer; /* ** I M P O R T A N T ! @@ -74,7 +72,7 @@ struct Host { ** a RIO_HOST_FOAD command. */ - ulong Flags; /* Whats going down */ + unsigned long Flags; /* Whats going down */ #define RC_WAITING 0 #define RC_STARTUP 1 #define RC_RUNNING 2 @@ -88,28 +86,28 @@ struct Host { ** Boot mode applies to the way in which hosts in this system will ** boot RTAs */ -#define RC_BOOT_ALL 0x8 /* Boot all RTAs attached */ -#define RC_BOOT_OWN 0x10 /* Only boot RTAs bound to this system */ -#define RC_BOOT_NONE 0x20 /* Don't boot any RTAs (slave mode) */ +#define RC_BOOT_ALL 0x8 /* Boot all RTAs attached */ +#define RC_BOOT_OWN 0x10 /* Only boot RTAs bound to this system */ +#define RC_BOOT_NONE 0x20 /* Don't boot any RTAs (slave mode) */ struct Top Topology[LINKS_PER_UNIT]; /* one per link */ - struct Map Mapping[MAX_RUP]; /* Mappings for host */ - struct PHB *PhbP; /* Pointer to the PHB array */ - ushort *PhbNumP; /* Ptr to Number of PHB's */ - struct LPB *LinkStrP; /* Link Structure Array */ - struct RUP *RupP; /* Sixteen real rups here */ - struct PARM_MAP *ParmMapP; /* points to the parmmap */ - uint ExtraUnits[MAX_EXTRA_UNITS]; /* unknown things */ - uint NumExtraBooted; /* how many of the above */ + struct Map Mapping[MAX_RUP]; /* Mappings for host */ + struct PHB *PhbP; /* Pointer to the PHB array */ + unsigned short *PhbNumP; /* Ptr to Number of PHB's */ + struct LPB *LinkStrP; /* Link Structure Array */ + struct RUP *RupP; /* Sixteen real rups here */ + struct PARM_MAP *ParmMapP; /* points to the parmmap */ + unsigned int ExtraUnits[MAX_EXTRA_UNITS]; /* unknown things */ + unsigned int NumExtraBooted; /* how many of the above */ /* ** Twenty logical rups. ** The first sixteen are the real Rup entries (above), the last four ** are the link RUPs. */ struct UnixRup UnixRups[MAX_RUP + LINKS_PER_UNIT]; - int timeout_id; /* For calling 100 ms delays */ - int timeout_sem; /* For calling 100 ms delays */ - long locks; /* long req'd for set_bit --RR */ + int timeout_id; /* For calling 100 ms delays */ + int timeout_sem; /* For calling 100 ms delays */ + long locks; /* long req'd for set_bit --RR */ char ____end_marker____; }; #define Control CardP->DpControl diff --git a/drivers/char/rio/link.h b/drivers/char/rio/link.h index 48d68ca7f82..f3bf11a04d4 100644 --- a/drivers/char/rio/link.h +++ b/drivers/char/rio/link.h @@ -37,38 +37,9 @@ #ifndef _link_h #define _link_h 1 -#ifndef lint -#ifdef SCCS_LABELS -/* static char *_rio_link_h_sccs = "@(#)link.h 1.15"; */ -#endif -#endif - - - /************************************************* * Define the Link Status stuff ************************************************/ -#define LRT_ACTIVE ((ushort) 0x01) -#define LRT_SPARE1 ((ushort) 0x02) -#define INTRO_RCVD ((ushort) 0x04) -#define FORCED_DISCONNECT ((ushort) 0x08) -#define LRT_SPARE2 ((ushort) 0x80) - -#define TOP_OF_RTA_RAM ((ushort) 0x7000) -#define HOST_SERIAL_POINTER (unsigned char **) (TOP_OF_RTA_RAM - 2 * sizeof (ushort)) - -/* Flags for ltt_status */ -#define WAITING_ACK (ushort) 0x0001 -#define DATA_SENT (ushort) 0x0002 -#define WAITING_RUP (ushort) 0x0004 -#define WAITING_RETRY (ushort) 0x0008 -#define WAITING_TOPOLOGY (ushort) 0x0010 -#define SEND_SYNC (ushort) 0x0020 -#define FOAD_THIS_LINK (ushort) 0x0040 -#define REQUEST_SYNC (ushort) 0x0080 -#define REMOTE_DYING (ushort) 0x0100 -#define DIE_NOW (ushort) 0x0200 - /* Boot request stuff */ #define BOOT_REQUEST ((ushort) 0) /* Request for a boot */ #define BOOT_ABORT ((ushort) 1) /* Abort a boot */ @@ -76,77 +47,48 @@ and load address */ #define BOOT_COMPLETED ((ushort) 3) /* Boot completed */ -/* States that a link can be in */ -#define LINK_DISCONNECTED ((ushort) 0) /* Disconnected */ -#define LINK_BOOT1 ((ushort) 1) /* Trying to send 1st stage boot */ -#define LINK_BOOT2 ((ushort) 2) /* Trying to send 2nd stage boot */ -#define LINK_BOOT2WAIT ((ushort) 3) /* Waiting for selftest results */ -#define LINK_BOOT3 ((ushort) 4) /* Trying to send 3rd stage boots */ -#define LINK_SYNC ((ushort) 5) /* Syncing */ - -#define LINK_INTRO ((ushort) 10) /* Introductory packet */ -#define LINK_SUPPLYID ((ushort) 11) /* Trying to supply an ID */ -#define LINK_TOPOLOGY ((ushort) 12) /* Send a topology update */ -#define LINK_REQUESTID ((ushort) 13) /* Waiting for an ID */ -#define LINK_CONNECTED ((ushort) 14) /* Connected */ - -#define LINK_INTERCONNECT ((ushort) 20) /* Subnets interconnected */ - -#define LINK_SPARE ((ushort) 40) - -/* -** Set the default timeout for link communications. -*/ -#define LINKTIMEOUT (400 * MILLISECOND) - -/* -** LED stuff -*/ -#define LED_SET_COLOUR(colour) -#define LED_OR_COLOUR(colour) -#define LED_TIMEOUT(time) struct LPB { - WORD link_number; /* Link Number */ - Channel_ptr in_ch; /* Link In Channel */ - Channel_ptr out_ch; /* Link Out Channel */ - BYTE attached_serial[4]; /* Attached serial number */ - BYTE attached_host_serial[4]; + u16 link_number; /* Link Number */ + u16 in_ch; /* Link In Channel */ + u16 out_ch; /* Link Out Channel */ + u8 attached_serial[4]; /* Attached serial number */ + u8 attached_host_serial[4]; /* Serial number of Host who booted the other end */ - WORD descheduled; /* Currently Descheduled */ - WORD state; /* Current state */ - WORD send_poll; /* Send a Poll Packet */ - Process_ptr ltt_p; /* Process Descriptor */ - Process_ptr lrt_p; /* Process Descriptor */ - WORD lrt_status; /* Current lrt status */ - WORD ltt_status; /* Current ltt status */ - WORD timeout; /* Timeout value */ - WORD topology; /* Topology bits */ - WORD mon_ltt; - WORD mon_lrt; - WORD WaitNoBoot; /* Secs to hold off booting */ - PKT_ptr add_packet_list; /* Add packets to here */ - PKT_ptr remove_packet_list; /* Send packets from here */ - - Channel_ptr lrt_fail_chan; /* Lrt's failure channel */ - Channel_ptr ltt_fail_chan; /* Ltt's failure channel */ + u16 descheduled; /* Currently Descheduled */ + u16 state; /* Current state */ + u16 send_poll; /* Send a Poll Packet */ + u16 ltt_p; /* Process Descriptor */ + u16 lrt_p; /* Process Descriptor */ + u16 lrt_status; /* Current lrt status */ + u16 ltt_status; /* Current ltt status */ + u16 timeout; /* Timeout value */ + u16 topology; /* Topology bits */ + u16 mon_ltt; + u16 mon_lrt; + u16 WaitNoBoot; /* Secs to hold off booting */ + u16 add_packet_list; /* Add packets to here */ + u16 remove_packet_list; /* Send packets from here */ + + u16 lrt_fail_chan; /* Lrt's failure channel */ + u16 ltt_fail_chan; /* Ltt's failure channel */ /* RUP structure for HOST to driver communications */ struct RUP rup; struct RUP link_rup; /* RUP for the link (POLL, topology etc.) */ - WORD attached_link; /* Number of attached link */ - WORD csum_errors; /* csum errors */ - WORD num_disconnects; /* number of disconnects */ - WORD num_sync_rcvd; /* # sync's received */ - WORD num_sync_rqst; /* # sync requests */ - WORD num_tx; /* Num pkts sent */ - WORD num_rx; /* Num pkts received */ - WORD module_attached; /* Module tpyes of attached */ - WORD led_timeout; /* LED timeout */ - WORD first_port; /* First port to service */ - WORD last_port; /* Last port to service */ + u16 attached_link; /* Number of attached link */ + u16 csum_errors; /* csum errors */ + u16 num_disconnects; /* number of disconnects */ + u16 num_sync_rcvd; /* # sync's received */ + u16 num_sync_rqst; /* # sync requests */ + u16 num_tx; /* Num pkts sent */ + u16 num_rx; /* Num pkts received */ + u16 module_attached; /* Module tpyes of attached */ + u16 led_timeout; /* LED timeout */ + u16 first_port; /* First port to service */ + u16 last_port; /* Last port to service */ }; #endif diff --git a/drivers/char/rio/linux_compat.h b/drivers/char/rio/linux_compat.h index 17a14c4a342..34c0d2899ef 100644 --- a/drivers/char/rio/linux_compat.h +++ b/drivers/char/rio/linux_compat.h @@ -19,56 +19,12 @@ #include <linux/interrupt.h> -#define disable(oldspl) save_flags (oldspl) -#define restore(oldspl) restore_flags (oldspl) - -#define sysbrk(x) kmalloc ((x),in_interrupt()? GFP_ATOMIC : GFP_KERNEL) -#define sysfree(p,size) kfree ((p)) - -#define WBYTE(p,v) writeb(v, &p) -#define RBYTE(p) readb (&p) -#define WWORD(p,v) writew(v, &p) -#define RWORD(p) readw(&p) -#define WINDW(p,v) writew(v, p) -#define RINDW(p) readw(p) - #define DEBUG_ALL -#define cprintf printk - -#ifdef __KERNEL__ -#define INKERNEL -#endif - struct ttystatics { struct termios tm; }; -#define bzero(d, n) memset((d), 0, (n)) -#define bcopy(src, dest, n) memcpy ((dest), (src), (n)) - -#define SEM_SIGIGNORE 0x1234 - -#ifdef DEBUG_SEM -#define swait(a,b) printk ("waiting: " __FILE__ " line %d\n", __LINE__) -#define ssignal(sem) printk ("signalling: " __FILE__ " line %d\n", __LINE__) - -#define sreset(sem) printk ("sreset: " __FILE__ "\n") -#define sem_init(sem,v) printk ("sreset: " __FILE__ "\n") -#endif - - -#define getpid() (current->pid) - -#define QSIZE SERIAL_XMIT_SIZE - -#define pseterr(errno) return (- errno) - -#define V_CBAUD CBAUD - -/* For one reason or another rioboot.c uses delay instead of RIODelay. */ -#define delay(x,y) RIODelay(NULL, y) - extern int rio_debug; #define RIO_DEBUG_INIT 0x000001 @@ -91,6 +47,7 @@ extern int rio_debug; #define RIO_DEBUG_DELAY 0x020000 #define RIO_DEBUG_MOD_COUNT 0x040000 + /* Copied over from riowinif.h . This is ugly. The winif file declares also much other stuff which is incompatible with the headers from the older driver. The older driver includes "brates.h" which shadows diff --git a/drivers/char/rio/list.h b/drivers/char/rio/list.h deleted file mode 100644 index 79b853140ae..00000000000 --- a/drivers/char/rio/list.h +++ /dev/null @@ -1,56 +0,0 @@ -/**************************************************************************** - ******* ******* - ******* L I S T ******* - ******* ******* - **************************************************************************** - - Author : Jeremy Rolls. - Date : 04-Nov-1990 - - * - * (C) 1990 - 2000 Specialix International Ltd., Byfleet, Surrey, UK. - * - * 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 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; 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. - - Version : 0.01 - - - Mods - ---------------------------------------------------------------------------- - Date By Description - ---------------------------------------------------------------------------- - ***************************************************************************/ - -#ifndef _list_h -#define _list_h 1 - -#ifdef SCCS_LABELS -#ifndef lint -static char *_rio_list_h_sccs = "@(#)list.h 1.9"; -#endif -#endif - -#define PKT_IN_USE 0x1 - -#define ZERO_PTR (ushort) 0x8000 -#define CaD PortP->Caddr - -/* -** We can add another packet to a transmit queue if the packet pointer pointed -** to by the TxAdd pointer has PKT_IN_USE clear in its address. -*/ - -#endif /* ifndef _list.h */ -/*********** end of file ***********/ diff --git a/drivers/char/rio/map.h b/drivers/char/rio/map.h index 97fe287aab2..bdbcd09c8b8 100644 --- a/drivers/char/rio/map.h +++ b/drivers/char/rio/map.h @@ -47,17 +47,17 @@ static char *_map_h_sccs_ = "@(#)map.h 1.2"; #define MAX_NAME_LEN 32 struct Map { - uint HostUniqueNum; /* Supporting hosts unique number */ - uint RtaUniqueNum; /* Unique number */ + unsigned int HostUniqueNum; /* Supporting hosts unique number */ + unsigned int RtaUniqueNum; /* Unique number */ /* ** The next two IDs must be swapped on big-endian architectures ** when using a v2.04 /etc/rio/config with a v3.00 driver (when ** upgrading for example). */ - ushort ID; /* ID used in the subnet */ - ushort ID2; /* ID of 2nd block of 8 for 16 port */ - ulong Flags; /* Booted, ID Given, Disconnected */ - ulong SysPort; /* First tty mapped to this port */ + unsigned short ID; /* ID used in the subnet */ + unsigned short ID2; /* ID of 2nd block of 8 for 16 port */ + unsigned long Flags; /* Booted, ID Given, Disconnected */ + unsigned long SysPort; /* First tty mapped to this port */ struct Top Topology[LINKS_PER_UNIT]; /* ID connected to each link */ char Name[MAX_NAME_LEN]; /* Cute name by which RTA is known */ }; diff --git a/drivers/char/rio/param.h b/drivers/char/rio/param.h index de7e57180c9..675c200b245 100644 --- a/drivers/char/rio/param.h +++ b/drivers/char/rio/param.h @@ -43,18 +43,18 @@ static char *_param_h_sccs_ = "@(#)param.h 1.2"; */ struct phb_param { - BYTE Cmd; /* It is very important that these line up */ - BYTE Cor1; /* with what is expected at the other end. */ - BYTE Cor2; /* to confirm that you've got it right, */ - BYTE Cor4; /* check with cirrus/cirrus.h */ - BYTE Cor5; - BYTE TxXon; /* Transmit X-On character */ - BYTE TxXoff; /* Transmit X-Off character */ - BYTE RxXon; /* Receive X-On character */ - BYTE RxXoff; /* Receive X-Off character */ - BYTE LNext; /* Literal-next character */ - BYTE TxBaud; /* Transmit baudrate */ - BYTE RxBaud; /* Receive baudrate */ + u8 Cmd; /* It is very important that these line up */ + u8 Cor1; /* with what is expected at the other end. */ + u8 Cor2; /* to confirm that you've got it right, */ + u8 Cor4; /* check with cirrus/cirrus.h */ + u8 Cor5; + u8 TxXon; /* Transmit X-On character */ + u8 TxXoff; /* Transmit X-Off character */ + u8 RxXon; /* Receive X-On character */ + u8 RxXoff; /* Receive X-Off character */ + u8 LNext; /* Literal-next character */ + u8 TxBaud; /* Transmit baudrate */ + u8 RxBaud; /* Receive baudrate */ }; #endif diff --git a/drivers/char/rio/parmmap.h b/drivers/char/rio/parmmap.h index e24acc1d184..9764ef85c5a 100644 --- a/drivers/char/rio/parmmap.h +++ b/drivers/char/rio/parmmap.h @@ -47,40 +47,40 @@ typedef struct PARM_MAP PARM_MAP; struct PARM_MAP { - PHB_ptr phb_ptr; /* Pointer to the PHB array */ - WORD_ptr phb_num_ptr; /* Ptr to Number of PHB's */ - FREE_LIST_ptr free_list; /* Free List pointer */ - FREE_LIST_ptr free_list_end; /* Free List End pointer */ - Q_BUF_ptr_ptr q_free_list_ptr; /* Ptr to Q_BUF variable */ - BYTE_ptr unit_id_ptr; /* Unit Id */ - LPB_ptr link_str_ptr; /* Link Structure Array */ - BYTE_ptr bootloader_1; /* 1st Stage Boot Loader */ - BYTE_ptr bootloader_2; /* 2nd Stage Boot Loader */ - WORD_ptr port_route_map_ptr; /* Port Route Map */ - ROUTE_STR_ptr route_ptr; /* Unit Route Map */ - NUMBER_ptr map_present; /* Route Map present */ - NUMBER pkt_num; /* Total number of packets */ - NUMBER q_num; /* Total number of Q packets */ - WORD buffers_per_port; /* Number of buffers per port */ - WORD heap_size; /* Initial size of heap */ - WORD heap_left; /* Current Heap left */ - WORD error; /* Error code */ - WORD tx_max; /* Max number of tx pkts per phb */ - WORD rx_max; /* Max number of rx pkts per phb */ - WORD rx_limit; /* For high / low watermarks */ - NUMBER links; /* Links to use */ - NUMBER timer; /* Interrupts per second */ - RUP_ptr rups; /* Pointer to the RUPs */ - WORD max_phb; /* Mostly for debugging */ - WORD living; /* Just increments!! */ - WORD init_done; /* Initialisation over */ - WORD booting_link; - WORD idle_count; /* Idle time counter */ - WORD busy_count; /* Busy counter */ - WORD idle_control; /* Control Idle Process */ - WORD tx_intr; /* TX interrupt pending */ - WORD rx_intr; /* RX interrupt pending */ - WORD rup_intr; /* RUP interrupt pending */ + u16 phb_ptr; /* Pointer to the PHB array */ + u16 phb_num_ptr; /* Ptr to Number of PHB's */ + u16 free_list; /* Free List pointer */ + u16 free_list_end; /* Free List End pointer */ + u16 q_free_list_ptr; /* Ptr to Q_BUF variable */ + u16 unit_id_ptr; /* Unit Id */ + u16 link_str_ptr; /* Link Structure Array */ + u16 bootloader_1; /* 1st Stage Boot Loader */ + u16 bootloader_2; /* 2nd Stage Boot Loader */ + u16 port_route_map_ptr; /* Port Route Map */ + u16 route_ptr; /* Unit Route Map */ + u16 map_present; /* Route Map present */ + s16 pkt_num; /* Total number of packets */ + s16 q_num; /* Total number of Q packets */ + u16 buffers_per_port; /* Number of buffers per port */ + u16 heap_size; /* Initial size of heap */ + u16 heap_left; /* Current Heap left */ + u16 error; /* Error code */ + u16 tx_max; /* Max number of tx pkts per phb */ + u16 rx_max; /* Max number of rx pkts per phb */ + u16 rx_limit; /* For high / low watermarks */ + s16 links; /* Links to use */ + s16 timer; /* Interrupts per second */ + u16 rups; /* Pointer to the RUPs */ + u16 max_phb; /* Mostly for debugging */ + u16 living; /* Just increments!! */ + u16 init_done; /* Initialisation over */ + u16 booting_link; + u16 idle_count; /* Idle time counter */ + u16 busy_count; /* Busy counter */ + u16 idle_control; /* Control Idle Process */ + u16 tx_intr; /* TX interrupt pending */ + u16 rx_intr; /* RX interrupt pending */ + u16 rup_intr; /* RUP interrupt pending */ }; #endif diff --git a/drivers/char/rio/phb.h b/drivers/char/rio/phb.h index 2663ca0306e..a4c48ae4e36 100644 --- a/drivers/char/rio/phb.h +++ b/drivers/char/rio/phb.h @@ -37,13 +37,6 @@ #ifndef _phb_h #define _phb_h 1 -#ifdef SCCS_LABELS -#ifndef lint -/* static char *_rio_phb_h_sccs = "@(#)phb.h 1.12"; */ -#endif -#endif - - /************************************************* * Handshake asserted. Deasserted by the LTT(s) ************************************************/ @@ -124,23 +117,23 @@ * the start. The pointer tx_add points to a SPACE to put a Packet. * The pointer tx_remove points to the next Packet to remove *************************************************************************/ -typedef struct PHB PHB; + struct PHB { - WORD source; - WORD handshake; - WORD status; - NUMBER timeout; /* Maximum of 1.9 seconds */ - WORD link; /* Send down this link */ - WORD destination; - PKT_ptr_ptr tx_start; - PKT_ptr_ptr tx_end; - PKT_ptr_ptr tx_add; - PKT_ptr_ptr tx_remove; - - PKT_ptr_ptr rx_start; - PKT_ptr_ptr rx_end; - PKT_ptr_ptr rx_add; - PKT_ptr_ptr rx_remove; + u8 source; + u8 handshake; + u8 status; + u16 timeout; /* Maximum of 1.9 seconds */ + u8 link; /* Send down this link */ + u8 destination; + u16 tx_start; + u16 tx_end; + u16 tx_add; + u16 tx_remove; + + u16 rx_start; + u16 rx_end; + u16 rx_add; + u16 rx_remove; }; diff --git a/drivers/char/rio/pkt.h b/drivers/char/rio/pkt.h index 7011e52e82d..a9458164f02 100644 --- a/drivers/char/rio/pkt.h +++ b/drivers/char/rio/pkt.h @@ -37,14 +37,6 @@ #ifndef _pkt_h #define _pkt_h 1 - -#ifdef SCCS_LABELS -#ifndef lint -/* static char *_rio_pkt_h_sccs = "@(#)pkt.h 1.8"; */ -#endif -#endif - -#define MAX_TTL 0xf #define PKT_CMD_BIT ((ushort) 0x080) #define PKT_CMD_DATA ((ushort) 0x080) @@ -70,15 +62,15 @@ #define CONTROL_DATA_WNDW (DATA_WNDW << 8) struct PKT { - BYTE dest_unit; /* Destination Unit Id */ - BYTE dest_port; /* Destination POrt */ - BYTE src_unit; /* Source Unit Id */ - BYTE src_port; /* Source POrt */ - BYTE len; - BYTE control; - BYTE data[PKT_MAX_DATA_LEN]; + u8 dest_unit; /* Destination Unit Id */ + u8 dest_port; /* Destination POrt */ + u8 src_unit; /* Source Unit Id */ + u8 src_port; /* Source POrt */ + u8 len; + u8 control; + u8 data[PKT_MAX_DATA_LEN]; /* Actual data :-) */ - WORD csum; /* C-SUM */ + u16 csum; /* C-SUM */ }; #endif diff --git a/drivers/char/rio/port.h b/drivers/char/rio/port.h index c99b1e70fdc..9b5fa3eb040 100644 --- a/drivers/char/rio/port.h +++ b/drivers/char/rio/port.h @@ -33,91 +33,37 @@ #ifndef __rio_port_h__ #define __rio_port_h__ -#ifdef SCCS_LABELS -static char *_port_h_sccs_ = "@(#)port.h 1.3"; -#endif - - -#undef VPIX - - -/* -** the port data structure - one per port in the system -*/ - -#ifdef STATS -struct RIOStats { - /* - ** interrupt statistics - */ - uint BreakIntCnt; - uint ModemOffCnt; - uint ModemOnCnt; - uint RxIntCnt; - uint TxIntCnt; - /* - ** throughput statistics - */ - uint RxCharCnt; - uint RxPktCnt; - uint RxSaveCnt; - uint TxCharCnt; - uint TxPktCnt; - /* - ** driver entry statistics - */ - uint CloseCnt; - uint IoctlCnt; - uint OpenCnt; - uint ReadCnt; - uint WriteCnt; - /* - ** proc statistics - */ - uint BlockCnt; - uint OutputCnt; - uint ResumeCnt; - uint RflushCnt; - uint SuspendCnt; - uint TbreakCnt; - uint TimeoutCnt; - uint UnblockCnt; - uint WflushCnt; - uint WFBodgeCnt; -}; -#endif - /* ** Port data structure */ struct Port { struct gs_port gs; - int PortNum; /* RIO port no., 0-511 */ + int PortNum; /* RIO port no., 0-511 */ struct Host *HostP; - volatile caddr_t Caddr; - ushort HostPort; /* Port number on host card */ - uchar RupNum; /* Number of RUP for port */ - uchar ID2; /* Second ID of RTA for port */ - ulong State; /* FLAGS for open & xopen */ -#define RIO_LOPEN 0x00001 /* Local open */ -#define RIO_MOPEN 0x00002 /* Modem open */ -#define RIO_WOPEN 0x00004 /* Waiting for open */ -#define RIO_CLOSING 0x00008 /* The port is being close */ -#define RIO_XPBUSY 0x00010 /* Transparent printer busy */ -#define RIO_BREAKING 0x00020 /* Break in progress */ -#define RIO_DIRECT 0x00040 /* Doing Direct output */ -#define RIO_EXCLUSIVE 0x00080 /* Stream open for exclusive use */ -#define RIO_NDELAY 0x00100 /* Stream is open FNDELAY */ -#define RIO_CARR_ON 0x00200 /* Stream has carrier present */ -#define RIO_XPWANTR 0x00400 /* Stream wanted by Xprint */ -#define RIO_RBLK 0x00800 /* Stream is read-blocked */ -#define RIO_BUSY 0x01000 /* Stream is BUSY for write */ -#define RIO_TIMEOUT 0x02000 /* Stream timeout in progress */ -#define RIO_TXSTOP 0x04000 /* Stream output is stopped */ -#define RIO_WAITFLUSH 0x08000 /* Stream waiting for flush */ -#define RIO_DYNOROD 0x10000 /* Drain failed */ -#define RIO_DELETED 0x20000 /* RTA has been deleted */ -#define RIO_ISSCANCODE 0x40000 /* This line is in scancode mode */ + caddr_t Caddr; + unsigned short HostPort; /* Port number on host card */ + unsigned char RupNum; /* Number of RUP for port */ + unsigned char ID2; /* Second ID of RTA for port */ + unsigned long State; /* FLAGS for open & xopen */ +#define RIO_LOPEN 0x00001 /* Local open */ +#define RIO_MOPEN 0x00002 /* Modem open */ +#define RIO_WOPEN 0x00004 /* Waiting for open */ +#define RIO_CLOSING 0x00008 /* The port is being close */ +#define RIO_XPBUSY 0x00010 /* Transparent printer busy */ +#define RIO_BREAKING 0x00020 /* Break in progress */ +#define RIO_DIRECT 0x00040 /* Doing Direct output */ +#define RIO_EXCLUSIVE 0x00080 /* Stream open for exclusive use */ +#define RIO_NDELAY 0x00100 /* Stream is open FNDELAY */ +#define RIO_CARR_ON 0x00200 /* Stream has carrier present */ +#define RIO_XPWANTR 0x00400 /* Stream wanted by Xprint */ +#define RIO_RBLK 0x00800 /* Stream is read-blocked */ +#define RIO_BUSY 0x01000 /* Stream is BUSY for write */ +#define RIO_TIMEOUT 0x02000 /* Stream timeout in progress */ +#define RIO_TXSTOP 0x04000 /* Stream output is stopped */ +#define RIO_WAITFLUSH 0x08000 /* Stream waiting for flush */ +#define RIO_DYNOROD 0x10000 /* Drain failed */ +#define RIO_DELETED 0x20000 /* RTA has been deleted */ +#define RIO_ISSCANCODE 0x40000 /* This line is in scancode mode */ #define RIO_USING_EUC 0x100000 /* Using extended Unix chars */ #define RIO_CAN_COOK 0x200000 /* This line can do cooking */ #define RIO_TRIAD_MODE 0x400000 /* Enable TRIAD special ops. */ @@ -125,15 +71,15 @@ struct Port { #define RIO_TRIAD_FUNC 0x1000000 /* Seen a function key coming in */ #define RIO_THROTTLE_RX 0x2000000 /* RX needs to be throttled. */ - ulong Config; /* FLAGS for NOREAD.... */ -#define RIO_NOREAD 0x0001 /* Are not allowed to read port */ -#define RIO_NOWRITE 0x0002 /* Are not allowed to write port */ -#define RIO_NOXPRINT 0x0004 /* Are not allowed to xprint port */ -#define RIO_NOMASK 0x0007 /* All not allowed things */ -#define RIO_IXANY 0x0008 /* Port is allowed ixany */ -#define RIO_MODEM 0x0010 /* Stream is a modem device */ -#define RIO_IXON 0x0020 /* Port is allowed ixon */ -#define RIO_WAITDRAIN 0x0040 /* Wait for port to completely drain */ + unsigned long Config; /* FLAGS for NOREAD.... */ +#define RIO_NOREAD 0x0001 /* Are not allowed to read port */ +#define RIO_NOWRITE 0x0002 /* Are not allowed to write port */ +#define RIO_NOXPRINT 0x0004 /* Are not allowed to xprint port */ +#define RIO_NOMASK 0x0007 /* All not allowed things */ +#define RIO_IXANY 0x0008 /* Port is allowed ixany */ +#define RIO_MODEM 0x0010 /* Stream is a modem device */ +#define RIO_IXON 0x0020 /* Port is allowed ixon */ +#define RIO_WAITDRAIN 0x0040 /* Wait for port to completely drain */ #define RIO_MAP_50_TO_50 0x0080 /* Map 50 baud to 50 baud */ #define RIO_MAP_110_TO_110 0x0100 /* Map 110 baud to 110 baud */ @@ -142,36 +88,36 @@ struct Port { ** As LynxOS does not appear to support Hardware Flow Control ..... ** Define our own flow control flags in 'Config'. */ -#define RIO_CTSFLOW 0x0200 /* RIO's own CTSFLOW flag */ -#define RIO_RTSFLOW 0x0400 /* RIO's own RTSFLOW flag */ +#define RIO_CTSFLOW 0x0200 /* RIO's own CTSFLOW flag */ +#define RIO_RTSFLOW 0x0400 /* RIO's own RTSFLOW flag */ - struct PHB *PhbP; /* pointer to PHB for port */ - WORD *TxAdd; /* Add packets here */ - WORD *TxStart; /* Start of add array */ - WORD *TxEnd; /* End of add array */ - WORD *RxRemove; /* Remove packets here */ - WORD *RxStart; /* Start of remove array */ - WORD *RxEnd; /* End of remove array */ - uint RtaUniqueNum; /* Unique number of RTA */ - ushort PortState; /* status of port */ - ushort ModemState; /* status of modem lines */ - ulong ModemLines; /* Modem bits sent to RTA */ - uchar CookMode; /* who expands CR/LF? */ - uchar ParamSem; /* Prevent write during param */ - uchar Mapped; /* if port mapped onto host */ - uchar SecondBlock; /* if port belongs to 2nd block - of 16 port RTA */ - uchar InUse; /* how many pre-emptive cmds */ - uchar Lock; /* if params locked */ - uchar Store; /* if params stored across closes */ - uchar FirstOpen; /* TRUE if first time port opened */ - uchar FlushCmdBodge; /* if doing a (non)flush */ - uchar MagicFlags; /* require intr processing */ -#define MAGIC_FLUSH 0x01 /* mirror of WflushFlag */ -#define MAGIC_REBOOT 0x02 /* RTA re-booted, re-open ports */ -#define MORE_OUTPUT_EYGOR 0x04 /* riotproc failed to empty clists */ - uchar WflushFlag; /* 1 How many WFLUSHs active */ + struct PHB *PhbP; /* pointer to PHB for port */ + u16 *TxAdd; /* Add packets here */ + u16 *TxStart; /* Start of add array */ + u16 *TxEnd; /* End of add array */ + u16 *RxRemove; /* Remove packets here */ + u16 *RxStart; /* Start of remove array */ + u16 *RxEnd; /* End of remove array */ + unsigned int RtaUniqueNum; /* Unique number of RTA */ + unsigned short PortState; /* status of port */ + unsigned short ModemState; /* status of modem lines */ + unsigned long ModemLines; /* Modem bits sent to RTA */ + unsigned char CookMode; /* who expands CR/LF? */ + unsigned char ParamSem; /* Prevent write during param */ + unsigned char Mapped; /* if port mapped onto host */ + unsigned char SecondBlock; /* if port belongs to 2nd block + of 16 port RTA */ + unsigned char InUse; /* how many pre-emptive cmds */ + unsigned char Lock; /* if params locked */ + unsigned char Store; /* if params stored across closes */ + unsigned char FirstOpen; /* TRUE if first time port opened */ + unsigned char FlushCmdBodge; /* if doing a (non)flush */ + unsigned char MagicFlags; /* require intr processing */ +#define MAGIC_FLUSH 0x01 /* mirror of WflushFlag */ +#define MAGIC_REBOOT 0x02 /* RTA re-booted, re-open ports */ +#define MORE_OUTPUT_EYGOR 0x04 /* riotproc failed to empty clists */ + unsigned char WflushFlag; /* 1 How many WFLUSHs active */ /* ** Transparent print stuff */ @@ -179,63 +125,55 @@ struct Port { #ifndef MAX_XP_CTRL_LEN #define MAX_XP_CTRL_LEN 16 /* ALSO IN DAEMON.H */ #endif - uint XpCps; + unsigned int XpCps; char XpOn[MAX_XP_CTRL_LEN]; char XpOff[MAX_XP_CTRL_LEN]; - ushort XpLen; /* strlen(XpOn)+strlen(XpOff) */ - uchar XpActive; - uchar XpLastTickOk; /* TRUE if we can process */ + unsigned short XpLen; /* strlen(XpOn)+strlen(XpOff) */ + unsigned char XpActive; + unsigned char XpLastTickOk; /* TRUE if we can process */ #define XP_OPEN 00001 #define XP_RUNABLE 00002 struct ttystatics *XttyP; } Xprint; -#ifdef VPIX - v86_t *StashP; - uint IntMask; - struct termss VpixSs; - uchar ModemStatusReg; /* Modem status register */ -#endif - uchar RxDataStart; - uchar Cor2Copy; /* copy of COR2 */ - char *Name; /* points to the Rta's name */ -#ifdef STATS - struct RIOStats Stat; /* ports statistics */ -#endif + unsigned char RxDataStart; + unsigned char Cor2Copy; /* copy of COR2 */ + char *Name; /* points to the Rta's name */ char *TxRingBuffer; - ushort TxBufferIn; /* New data arrives here */ - ushort TxBufferOut; /* Intr removes data here */ - ushort OldTxBufferOut; /* Indicates if draining */ - int TimeoutId; /* Timeout ID */ - uint Debug; - uchar WaitUntilBooted; /* True if open should block */ - uint statsGather; /* True if gathering stats */ - ulong txchars; /* Chars transmitted */ - ulong rxchars; /* Chars received */ - ulong opens; /* port open count */ - ulong closes; /* port close count */ - ulong ioctls; /* ioctl count */ - uchar LastRxTgl; /* Last state of rx toggle bit */ - spinlock_t portSem; /* Lock using this sem */ - int MonitorTstate; /* Monitoring ? */ - int timeout_id; /* For calling 100 ms delays */ - int timeout_sem; /* For calling 100 ms delays */ - int firstOpen; /* First time open ? */ - char *p; /* save the global struc here .. */ + unsigned short TxBufferIn; /* New data arrives here */ + unsigned short TxBufferOut; /* Intr removes data here */ + unsigned short OldTxBufferOut; /* Indicates if draining */ + int TimeoutId; /* Timeout ID */ + unsigned int Debug; + unsigned char WaitUntilBooted; /* True if open should block */ + unsigned int statsGather; /* True if gathering stats */ + unsigned long txchars; /* Chars transmitted */ + unsigned long rxchars; /* Chars received */ + unsigned long opens; /* port open count */ + unsigned long closes; /* port close count */ + unsigned long ioctls; /* ioctl count */ + unsigned char LastRxTgl; /* Last state of rx toggle bit */ + spinlock_t portSem; /* Lock using this sem */ + int MonitorTstate; /* Monitoring ? */ + int timeout_id; /* For calling 100 ms delays */ + int timeout_sem; /* For calling 100 ms delays */ + int firstOpen; /* First time open ? */ + char *p; /* save the global struc here .. */ }; struct ModuleInfo { char *Name; - uint Flags[4]; /* one per port on a module */ + unsigned int Flags[4]; /* one per port on a module */ }; -#endif /* ** This struct is required because trying to grab an entire Port structure ** runs into problems with differing struct sizes between driver and config. */ struct PortParams { - uint Port; - ulong Config; - ulong State; + unsigned int Port; + unsigned long Config; + unsigned long State; struct ttystatics *TtyP; }; + +#endif diff --git a/drivers/char/rio/qbuf.h b/drivers/char/rio/qbuf.h deleted file mode 100644 index 391ffc33553..00000000000 --- a/drivers/char/rio/qbuf.h +++ /dev/null @@ -1,62 +0,0 @@ - -/**************************************************************************** - ******* ******* - ******* Q U E U E B U F F E R S T R U C T U R E S - ******* ******* - **************************************************************************** - - Author : Ian Nandhra / Jeremy Rolls - Date : - - * - * (C) 1990 - 2000 Specialix International Ltd., Byfleet, Surrey, UK. - * - * 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 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; 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. - - Version : 0.01 - - - Mods - ---------------------------------------------------------------------------- - Date By Description - ---------------------------------------------------------------------------- - - ***************************************************************************/ - -#ifndef _qbuf_h -#define _qbuf_h 1 - -#ifndef lint -#ifdef SCCS_LABELS -static char *_rio_qbuf_h_sccs = "@(#)qbuf.h 1.1"; -#endif -#endif - - - -#define PKTS_PER_BUFFER (220 / PKT_LENGTH) - -typedef struct Q_BUF Q_BUF; -struct Q_BUF { - Q_BUF_ptr next; - Q_BUF_ptr prev; - PKT_ptr buf[PKTS_PER_BUFFER]; -}; - - -#endif - - -/*********** end of file ***********/ diff --git a/drivers/char/rio/rio.h b/drivers/char/rio/rio.h index 7f45e1ab533..b4c91871ba2 100644 --- a/drivers/char/rio/rio.h +++ b/drivers/char/rio/rio.h @@ -33,38 +33,6 @@ #ifndef __rio_rio_h__ #define __rio_rio_h__ -#ifdef SCCS_LABELS -static char *_rio_h_sccs_ = "@(#)rio.h 1.3"; -#endif - -/* -** 30.09.1998 ARG - -** Introduced driver version and host card type strings -*/ -#define RIO_DRV_STR "Specialix RIO Driver" -#define RIO_AT_HOST_STR "ISA" -#define RIO_PCI_HOST_STR "PCI" - - -/* -** rio_info_store() commands (arbitary values) : -*/ -#define RIO_INFO_PUT 0xA4B3C2D1 -#define RIO_INFO_GET 0xF1E2D3C4 - - -/* -** anything that I couldn't cram in somewhere else -*/ -/* -#ifndef RIODEBUG -#define debug -#else -#define debug rioprint -#endif -*/ - - /* ** Maximum numbers of things */ @@ -101,9 +69,8 @@ static char *_rio_h_sccs_ = "@(#)rio.h 1.3"; /* ** Flag values returned by functions */ + #define RIO_FAIL -1 -#define RIO_SUCCESS 0 -#define COPYFAIL -1 /* copy[in|out] failed */ /* ** SysPort value for something that hasn't any ports @@ -142,30 +109,8 @@ static char *_rio_h_sccs_ = "@(#)rio.h 1.3"; /* ** Generally useful constants */ -#define HALF_A_SECOND ((HZ)>>1) -#define A_SECOND (HZ) -#define HUNDRED_HZ ((HZ/100)?(HZ/100):1) -#define FIFTY_HZ ((HZ/50)?(HZ/50):1) -#define TWENTY_HZ ((HZ/20)?(HZ/20):1) -#define TEN_HZ ((HZ/10)?(HZ/10):1) -#define FIVE_HZ ((HZ/5)?(HZ/5):1) -#define HUNDRED_MS TEN_HZ -#define FIFTY_MS TWENTY_HZ -#define TWENTY_MS FIFTY_HZ -#define TEN_MS HUNDRED_HZ -#define TWO_SECONDS ((A_SECOND)*2) -#define FIVE_SECONDS ((A_SECOND)*5) -#define TEN_SECONDS ((A_SECOND)*10) -#define FIFTEEN_SECONDS ((A_SECOND)*15) -#define TWENTY_SECONDS ((A_SECOND)*20) -#define HALF_A_MINUTE (A_MINUTE>>1) -#define A_MINUTE (A_SECOND*60) -#define FIVE_MINUTES (A_MINUTE*5) -#define QUARTER_HOUR (A_MINUTE*15) -#define HALF_HOUR (A_MINUTE*30) -#define HOUR (A_MINUTE*60) - -#define SIXTEEN_MEG 0x1000000 + +#define HUNDRED_MS ((HZ/10)?(HZ/10):1) #define ONE_MEG 0x100000 #define SIXTY_FOUR_K 0x10000 @@ -173,8 +118,6 @@ static char *_rio_h_sccs_ = "@(#)rio.h 1.3"; #define RIO_EISA_MEM_SIZE SIXTY_FOUR_K #define RIO_MCA_MEM_SIZE SIXTY_FOUR_K -#define POLL_VECTOR 0x100 - #define COOK_WELL 0 #define COOK_MEDIUM 1 #define COOK_RAW 2 @@ -186,69 +129,26 @@ static char *_rio_h_sccs_ = "@(#)rio.h 1.3"; ** RIO_OBJ takes hostp->Caddr and a UNIX pointer to an object and ** returns the offset into the DP RAM area. */ -#define RIO_PTR(C,O) (((caddr_t)(C))+(0xFFFF&(O))) -#define RIO_OFF(C,O) ((int)(O)-(int)(C)) +#define RIO_PTR(C,O) (((unsigned char *)(C))+(0xFFFF&(O))) +#define RIO_OFF(C,O) ((long)(O)-(long)(C)) /* ** How to convert from various different device number formats: ** DEV is a dev number, as passed to open, close etc - NOT a minor ** number! -** -** Note: LynxOS only gives us 8 bits for the device minor number, -** so all this crap here to deal with 'modem' bits etc. is -** just a load of irrelevant old bunkum! -** This however does not stop us needing to define a value -** for RIO_MODEMOFFSET which is required by the 'riomkdev' -** utility in the New Config Utilities suite. -*/ -/* 0-511: direct 512-1023: modem */ -#define RIO_MODEMOFFSET 0x200 /* doesn't mean anything */ +**/ + #define RIO_MODEM_MASK 0x1FF #define RIO_MODEM_BIT 0x200 #define RIO_UNMODEM(DEV) (MINOR(DEV) & RIO_MODEM_MASK) #define RIO_ISMODEM(DEV) (MINOR(DEV) & RIO_MODEM_BIT) #define RIO_PORT(DEV,FIRST_MAJ) ( (MAJOR(DEV) - FIRST_MAJ) * PORTS_PER_HOST) \ + MINOR(DEV) - -#define splrio spltty - -#define RIO_IPL 5 -#define RIO_PRI (PZERO+10) -#define RIO_CLOSE_PRI PZERO-1 /* uninterruptible sleeps for close */ - -typedef struct DbInf { - uint Flag; - char Name[8]; -} DbInf; - -#ifndef TRUE -#define TRUE (1==1) -#endif -#ifndef FALSE -#define FALSE (!TRUE) -#endif - -#define CSUM(pkt_ptr) (((ushort *)(pkt_ptr))[0] + ((ushort *)(pkt_ptr))[1] + \ - ((ushort *)(pkt_ptr))[2] + ((ushort *)(pkt_ptr))[3] + \ - ((ushort *)(pkt_ptr))[4] + ((ushort *)(pkt_ptr))[5] + \ - ((ushort *)(pkt_ptr))[6] + ((ushort *)(pkt_ptr))[7] + \ - ((ushort *)(pkt_ptr))[8] + ((ushort *)(pkt_ptr))[9] ) - -/* -** This happy little macro copies SIZE bytes of data from FROM to TO -** quite well. SIZE must be a constant. -*/ -#define CCOPY( FROM, TO, SIZE ) { *(struct s { char data[SIZE]; } *)(TO) = *(struct s *)(FROM); } - -/* -** increment a buffer pointer modulo the size of the buffer... -*/ -#define BUMP( P, I ) ((P) = (((P)+(I)) & RIOBufferMask)) - -#define INIT_PACKET( PK, PP ) \ -{ \ - *((uint *)PK) = PP->PacketInfo; \ -} +#define CSUM(pkt_ptr) (((u16 *)(pkt_ptr))[0] + ((u16 *)(pkt_ptr))[1] + \ + ((u16 *)(pkt_ptr))[2] + ((u16 *)(pkt_ptr))[3] + \ + ((u16 *)(pkt_ptr))[4] + ((u16 *)(pkt_ptr))[5] + \ + ((u16 *)(pkt_ptr))[6] + ((u16 *)(pkt_ptr))[7] + \ + ((u16 *)(pkt_ptr))[8] + ((u16 *)(pkt_ptr))[9] ) #define RIO_LINK_ENABLE 0x80FF /* FF is a hack, mainly for Mips, to */ /* prevent a really stupid race condition. */ @@ -267,27 +167,42 @@ typedef struct DbInf { #define DISCONNECT 0 #define CONNECT 1 +/* ------ Control Codes ------ */ -/* -** Machine types - these must NOT overlap with product codes 0-15 -*/ -#define RIO_MIPS_R3230 31 -#define RIO_MIPS_R4030 32 +#define CONTROL '^' +#define IFOAD ( CONTROL + 1 ) +#define IDENTIFY ( CONTROL + 2 ) +#define ZOMBIE ( CONTROL + 3 ) +#define UFOAD ( CONTROL + 4 ) +#define IWAIT ( CONTROL + 5 ) + +#define IFOAD_MAGIC 0xF0AD /* of course */ +#define ZOMBIE_MAGIC (~0xDEAD) /* not dead -> zombie */ +#define UFOAD_MAGIC 0xD1E /* kill-your-neighbour */ +#define IWAIT_MAGIC 0xB1DE /* Bide your time */ + +/* ------ Error Codes ------ */ + +#define E_NO_ERROR ((ushort) 0) + +/* ------ Free Lists ------ */ -#define RIO_IO_UNKNOWN -2 +struct rio_free_list { + u16 next; + u16 prev; +}; -#undef MODERN -#define ERROR( E ) do { u.u_error = E; return OPENFAIL } while ( 0 ) +/* NULL for card side linked lists */ +#define TPNULL ((ushort)(0x8000)) +/* We can add another packet to a transmit queue if the packet pointer pointed + * to by the TxAdd pointer has PKT_IN_USE clear in its address. */ +#define PKT_IN_USE 0x1 -/* Defines for MPX line discipline routines */ +/* ------ Topology ------ */ -#define DIST_LINESW_OPEN 0x01 -#define DIST_LINESW_CLOSE 0x02 -#define DIST_LINESW_READ 0x04 -#define DIST_LINESW_WRITE 0x08 -#define DIST_LINESW_IOCTL 0x10 -#define DIST_LINESW_INPUT 0x20 -#define DIST_LINESW_OUTPUT 0x40 -#define DIST_LINESW_MDMINT 0x80 +struct Top { + u8 Unit; + u8 Link; +}; #endif /* __rio_h__ */ diff --git a/drivers/char/rio/rio_linux.c b/drivers/char/rio/rio_linux.c index c9af283a811..78dd856534c 100644 --- a/drivers/char/rio/rio_linux.c +++ b/drivers/char/rio/rio_linux.c @@ -57,15 +57,12 @@ #include <asm/uaccess.h> #include "linux_compat.h" -#include "typdef.h" #include "pkt.h" #include "daemon.h" #include "rio.h" #include "riospace.h" -#include "top.h" #include "cmdpkt.h" #include "map.h" -#include "riotypes.h" #include "rup.h" #include "port.h" #include "riodrvr.h" @@ -78,17 +75,13 @@ #include "unixrup.h" #include "board.h" #include "host.h" -#include "error.h" #include "phb.h" #include "link.h" #include "cmdblk.h" #include "route.h" -#include "control.h" #include "cirrus.h" #include "rioioctl.h" #include "param.h" -#include "list.h" -#include "sam.h" #include "protsts.h" #include "rioboard.h" @@ -297,7 +290,7 @@ static void my_hd(void *ad, int len) unsigned char *addr = ad; for (i = 0; i < len; i += 16) { - rio_dprintk(RIO_DEBUG_PARAM, "%08x ", (int) addr + i); + rio_dprintk(RIO_DEBUG_PARAM, "%08lx ", (unsigned long) addr + i); for (j = 0; j < 16; j++) { rio_dprintk(RIO_DEBUG_PARAM, "%02x %s", addr[j + i], (j == 7) ? " " : ""); } @@ -340,34 +333,19 @@ int RIODelay_ni(struct Port *PortP, int njiffies) return !RIO_FAIL; } - -int rio_minor(struct tty_struct *tty) +void rio_copy_to_card(void *to, void *from, int len) { - return tty->index + (tty->driver == rio_driver) ? 0 : 256; + rio_memcpy_toio(NULL, to, from, len); } - -int rio_ismodem(struct tty_struct *tty) +int rio_minor(struct tty_struct *tty) { - return 1; + return tty->index + (tty->driver == rio_driver) ? 0 : 256; } - static int rio_set_real_termios(void *ptr) { - int rv, modem; - struct tty_struct *tty; - func_enter(); - - tty = ((struct Port *) ptr)->gs.tty; - - modem = rio_ismodem(tty); - - rv = RIOParam((struct Port *) ptr, CONFIG, modem, 1); - - func_exit(); - - return rv; + return RIOParam((struct Port *) ptr, CONFIG, 1, 1); } @@ -379,7 +357,7 @@ static void rio_reset_interrupt(struct Host *HostP) case RIO_AT: case RIO_MCA: case RIO_PCI: - WBYTE(HostP->ResetInt, 0xff); + writeb(0xFF, &HostP->ResetInt); } func_exit(); @@ -397,9 +375,6 @@ static irqreturn_t rio_interrupt(int irq, void *ptr, struct pt_regs *regs) /* AAargh! The order in which to do these things is essential and not trivial. - - Rate limit goes before "recursive". Otherwise a series of - recursive calls will hang the machine in the interrupt routine. - - hardware twiddling goes before "recursive". Otherwise when we poll the card, and a recursive interrupt happens, we won't ack the card, so it might keep on interrupting us. (especially @@ -414,26 +389,6 @@ static irqreturn_t rio_interrupt(int irq, void *ptr, struct pt_regs *regs) - The initialized test goes before recursive. */ - - -#ifdef IRQ_RATE_LIMIT - /* Aaargh! I'm ashamed. This costs more lines-of-code than the - actual interrupt routine!. (Well, used to when I wrote that comment) */ - { - static int lastjif; - static int nintr = 0; - - if (lastjif == jiffies) { - if (++nintr > IRQ_RATE_LIMIT) { - free_irq(HostP->Ivec, ptr); - printk(KERN_ERR "rio: Too many interrupts. Turning off interrupt %d.\n", HostP->Ivec); - } - } else { - lastjif = jiffies; - nintr = 0; - } - } -#endif rio_dprintk(RIO_DEBUG_IFLOW, "rio: We've have noticed the interrupt\n"); if (HostP->Ivec == irq) { /* Tell the card we've noticed the interrupt. */ @@ -444,13 +399,13 @@ static irqreturn_t rio_interrupt(int irq, void *ptr, struct pt_regs *regs) return IRQ_HANDLED; if (test_and_set_bit(RIO_BOARD_INTR_LOCK, &HostP->locks)) { - printk(KERN_ERR "Recursive interrupt! (host %d/irq%d)\n", (int) ptr, HostP->Ivec); + printk(KERN_ERR "Recursive interrupt! (host %p/irq%d)\n", ptr, HostP->Ivec); return IRQ_HANDLED; } RIOServiceHost(p, HostP, irq); - rio_dprintk(RIO_DEBUG_IFLOW, "riointr() doing host %d type %d\n", (int) ptr, HostP->Type); + rio_dprintk(RIO_DEBUG_IFLOW, "riointr() doing host %p type %d\n", ptr, HostP->Type); clear_bit(RIO_BOARD_INTR_LOCK, &HostP->locks); rio_dprintk(RIO_DEBUG_IFLOW, "rio: exit rio_interrupt (%d/%d)\n", irq, HostP->Ivec); @@ -873,7 +828,7 @@ static int rio_init_datastructures(void) #define HOST_SZ sizeof(struct Host) #define PORT_SZ sizeof(struct Port *) #define TMIO_SZ sizeof(struct termios *) - rio_dprintk(RIO_DEBUG_INIT, "getting : %d %d %d %d %d bytes\n", RI_SZ, RIO_HOSTS * HOST_SZ, RIO_PORTS * PORT_SZ, RIO_PORTS * TMIO_SZ, RIO_PORTS * TMIO_SZ); + rio_dprintk(RIO_DEBUG_INIT, "getting : %Zd %Zd %Zd %Zd %Zd bytes\n", RI_SZ, RIO_HOSTS * HOST_SZ, RIO_PORTS * PORT_SZ, RIO_PORTS * TMIO_SZ, RIO_PORTS * TMIO_SZ); if (!(p = ckmalloc(RI_SZ))) goto free0; @@ -963,22 +918,21 @@ static void __exit rio_release_drivers(void) static void fix_rio_pci(struct pci_dev *pdev) { - unsigned int hwbase; - unsigned long rebase; + unsigned long hwbase; + unsigned char *rebase; unsigned int t; #define CNTRL_REG_OFFSET 0x50 #define CNTRL_REG_GOODVALUE 0x18260000 - pci_read_config_dword(pdev, PCI_BASE_ADDRESS_0, &hwbase); - hwbase &= PCI_BASE_ADDRESS_MEM_MASK; - rebase = (ulong) ioremap(hwbase, 0x80); + hwbase = pci_resource_start(pdev, 0); + rebase = ioremap(hwbase, 0x80); t = readl(rebase + CNTRL_REG_OFFSET); if (t != CNTRL_REG_GOODVALUE) { printk(KERN_DEBUG "rio: performing cntrl reg fix: %08x -> %08x\n", t, CNTRL_REG_GOODVALUE); writel(CNTRL_REG_GOODVALUE, rebase + CNTRL_REG_OFFSET); } - iounmap((char *) rebase); + iounmap(rebase); } #endif @@ -994,7 +948,6 @@ static int __init rio_init(void) #ifdef CONFIG_PCI struct pci_dev *pdev = NULL; - unsigned int tint; unsigned short tshort; #endif @@ -1019,6 +972,8 @@ static int __init rio_init(void) #ifdef CONFIG_PCI /* First look for the JET devices: */ while ((pdev = pci_get_device(PCI_VENDOR_ID_SPECIALIX, PCI_DEVICE_ID_SPECIALIX_SX_XIO_IO8, pdev))) { + u32 tint; + if (pci_enable_device(pdev)) continue; @@ -1029,7 +984,6 @@ static int __init rio_init(void) Also, reading a non-aligned dword doesn't work. So we read the whole dword at 0x2c and extract the word at 0x2e (SUBSYSTEM_ID) ourselves */ - /* I don't know why the define doesn't work, constant 0x2c does --REW */ pci_read_config_dword(pdev, 0x2c, &tint); tshort = (tint >> 16) & 0xffff; rio_dprintk(RIO_DEBUG_PROBE, "Got a specialix card: %x.\n", tint); @@ -1039,33 +993,31 @@ static int __init rio_init(void) } rio_dprintk(RIO_DEBUG_PROBE, "cp1\n"); - pci_read_config_dword(pdev, PCI_BASE_ADDRESS_2, &tint); - hp = &p->RIOHosts[p->RIONumHosts]; - hp->PaddrP = tint & PCI_BASE_ADDRESS_MEM_MASK; + hp->PaddrP = pci_resource_start(pdev, 2); hp->Ivec = pdev->irq; if (((1 << hp->Ivec) & rio_irqmask) == 0) hp->Ivec = 0; hp->Caddr = ioremap(p->RIOHosts[p->RIONumHosts].PaddrP, RIO_WINDOW_LEN); hp->CardP = (struct DpRam *) hp->Caddr; hp->Type = RIO_PCI; - hp->Copy = rio_pcicopy; + hp->Copy = rio_copy_to_card; hp->Mode = RIO_PCI_BOOT_FROM_RAM; spin_lock_init(&hp->HostLock); rio_reset_interrupt(hp); rio_start_card_running(hp); rio_dprintk(RIO_DEBUG_PROBE, "Going to test it (%p/%p).\n", (void *) p->RIOHosts[p->RIONumHosts].PaddrP, p->RIOHosts[p->RIONumHosts].Caddr); - if (RIOBoardTest(p->RIOHosts[p->RIONumHosts].PaddrP, p->RIOHosts[p->RIONumHosts].Caddr, RIO_PCI, 0) == RIO_SUCCESS) { + if (RIOBoardTest(p->RIOHosts[p->RIONumHosts].PaddrP, p->RIOHosts[p->RIONumHosts].Caddr, RIO_PCI, 0) == 0) { rio_dprintk(RIO_DEBUG_INIT, "Done RIOBoardTest\n"); - WBYTE(p->RIOHosts[p->RIONumHosts].ResetInt, 0xff); + writeb(0xFF, &p->RIOHosts[p->RIONumHosts].ResetInt); p->RIOHosts[p->RIONumHosts].UniqueNum = - ((RBYTE(p->RIOHosts[p->RIONumHosts].Unique[0]) & 0xFF) << 0) | - ((RBYTE(p->RIOHosts[p->RIONumHosts].Unique[1]) & 0xFF) << 8) | ((RBYTE(p->RIOHosts[p->RIONumHosts].Unique[2]) & 0xFF) << 16) | ((RBYTE(p->RIOHosts[p->RIONumHosts].Unique[3]) & 0xFF) << 24); + ((readb(&p->RIOHosts[p->RIONumHosts].Unique[0]) & 0xFF) << 0) | + ((readb(&p->RIOHosts[p->RIONumHosts].Unique[1]) & 0xFF) << 8) | ((readb(&p->RIOHosts[p->RIONumHosts].Unique[2]) & 0xFF) << 16) | ((readb(&p->RIOHosts[p->RIONumHosts].Unique[3]) & 0xFF) << 24); rio_dprintk(RIO_DEBUG_PROBE, "Hmm Tested ok, uniqid = %x.\n", p->RIOHosts[p->RIONumHosts].UniqueNum); fix_rio_pci(pdev); - p->RIOLastPCISearch = RIO_SUCCESS; + p->RIOLastPCISearch = 0; p->RIONumHosts++; found++; } else { @@ -1088,10 +1040,8 @@ static int __init rio_init(void) continue; #ifdef CONFIG_RIO_OLDPCI - pci_read_config_dword(pdev, PCI_BASE_ADDRESS_0, &tint); - hp = &p->RIOHosts[p->RIONumHosts]; - hp->PaddrP = tint & PCI_BASE_ADDRESS_MEM_MASK; + hp->PaddrP = pci_resource_start(pdev, 0); hp->Ivec = pdev->irq; if (((1 << hp->Ivec) & rio_irqmask) == 0) hp->Ivec = 0; @@ -1099,7 +1049,7 @@ static int __init rio_init(void) hp->Caddr = ioremap(p->RIOHosts[p->RIONumHosts].PaddrP, RIO_WINDOW_LEN); hp->CardP = (struct DpRam *) hp->Caddr; hp->Type = RIO_PCI; - hp->Copy = rio_pcicopy; + hp->Copy = rio_copy_to_card; hp->Mode = RIO_PCI_BOOT_FROM_RAM; spin_lock_init(&hp->HostLock); @@ -1109,14 +1059,14 @@ static int __init rio_init(void) rio_reset_interrupt(hp); rio_start_card_running(hp); rio_dprintk(RIO_DEBUG_PROBE, "Going to test it (%p/%p).\n", (void *) p->RIOHosts[p->RIONumHosts].PaddrP, p->RIOHosts[p->RIONumHosts].Caddr); - if (RIOBoardTest(p->RIOHosts[p->RIONumHosts].PaddrP, p->RIOHosts[p->RIONumHosts].Caddr, RIO_PCI, 0) == RIO_SUCCESS) { - WBYTE(p->RIOHosts[p->RIONumHosts].ResetInt, 0xff); + if (RIOBoardTest(p->RIOHosts[p->RIONumHosts].PaddrP, p->RIOHosts[p->RIONumHosts].Caddr, RIO_PCI, 0) == 0) { + writeb(0xFF, &p->RIOHosts[p->RIONumHosts].ResetInt); p->RIOHosts[p->RIONumHosts].UniqueNum = - ((RBYTE(p->RIOHosts[p->RIONumHosts].Unique[0]) & 0xFF) << 0) | - ((RBYTE(p->RIOHosts[p->RIONumHosts].Unique[1]) & 0xFF) << 8) | ((RBYTE(p->RIOHosts[p->RIONumHosts].Unique[2]) & 0xFF) << 16) | ((RBYTE(p->RIOHosts[p->RIONumHosts].Unique[3]) & 0xFF) << 24); + ((readb(&p->RIOHosts[p->RIONumHosts].Unique[0]) & 0xFF) << 0) | + ((readb(&p->RIOHosts[p->RIONumHosts].Unique[1]) & 0xFF) << 8) | ((readb(&p->RIOHosts[p->RIONumHosts].Unique[2]) & 0xFF) << 16) | ((readb(&p->RIOHosts[p->RIONumHosts].Unique[3]) & 0xFF) << 24); rio_dprintk(RIO_DEBUG_PROBE, "Hmm Tested ok, uniqid = %x.\n", p->RIOHosts[p->RIONumHosts].UniqueNum); - p->RIOLastPCISearch = RIO_SUCCESS; + p->RIOLastPCISearch = 0; p->RIONumHosts++; found++; } else { @@ -1137,8 +1087,8 @@ static int __init rio_init(void) hp->Caddr = ioremap(p->RIOHosts[p->RIONumHosts].PaddrP, RIO_WINDOW_LEN); hp->CardP = (struct DpRam *) hp->Caddr; hp->Type = RIO_AT; - hp->Copy = rio_pcicopy; /* AT card PCI???? - PVDL - * -- YES! this is now a normal copy. Only the + hp->Copy = rio_copy_to_card; /* AT card PCI???? - PVDL + * -- YES! this is now a normal copy. Only the * old PCI card uses the special PCI copy. * Moreover, the ISA card will work with the * special PCI copy anyway. -- REW */ @@ -1150,7 +1100,7 @@ static int __init rio_init(void) okboard = 0; if ((strncmp(vpdp->identifier, RIO_ISA_IDENT, 16) == 0) || (strncmp(vpdp->identifier, RIO_ISA2_IDENT, 16) == 0) || (strncmp(vpdp->identifier, RIO_ISA3_IDENT, 16) == 0)) { /* Board is present... */ - if (RIOBoardTest(hp->PaddrP, hp->Caddr, RIO_AT, 0) == RIO_SUCCESS) { + if (RIOBoardTest(hp->PaddrP, hp->Caddr, RIO_AT, 0) == 0) { /* ... and feeling fine!!!! */ rio_dprintk(RIO_DEBUG_PROBE, "Hmm Tested ok, uniqid = %x.\n", p->RIOHosts[p->RIONumHosts].UniqueNum); if (RIOAssignAT(p, hp->PaddrP, hp->Caddr, 0)) { @@ -1252,24 +1202,3 @@ static void __exit rio_exit(void) module_init(rio_init); module_exit(rio_exit); - -/* - * Anybody who knows why this doesn't work for me, please tell me -- REW. - * Snatched from scsi.c (fixed one spelling error): - * Overrides for Emacs so that we follow Linus' tabbing style. - * Emacs will notice this stuff at the end of the file and automatically - * adjust the settings for this buffer only. This must remain at the end - * of the file. - * --------------------------------------------------------------------------- - * Local Variables: - * c-indent-level: 4 - * c-brace-imaginary-offset: 0 - * c-brace-offset: -4 - * c-argdecl-indent: 4 - * c-label-offset: -4 - * c-continued-statement-offset: 4 - * c-continued-brace-offset: 0 - * indent-tabs-mode: nil - * tab-width: 8 - * End: - */ diff --git a/drivers/char/rio/rioboot.c b/drivers/char/rio/rioboot.c index 92df43552f1..acda9326c2e 100644 --- a/drivers/char/rio/rioboot.c +++ b/drivers/char/rio/rioboot.c @@ -30,38 +30,29 @@ ** ----------------------------------------------------------------------------- */ -#ifdef SCCS_LABELS -static char *_rioboot_c_sccs_ = "@(#)rioboot.c 1.3"; -#endif - #include <linux/module.h> #include <linux/slab.h> +#include <linux/termios.h> +#include <linux/serial.h> +#include <asm/semaphore.h> +#include <linux/generic_serial.h> #include <linux/errno.h> #include <linux/interrupt.h> +#include <linux/delay.h> #include <asm/io.h> #include <asm/system.h> #include <asm/string.h> -#include <asm/semaphore.h> - - -#include <linux/termios.h> -#include <linux/serial.h> - -#include <linux/generic_serial.h> - +#include <asm/uaccess.h> #include "linux_compat.h" #include "rio_linux.h" -#include "typdef.h" #include "pkt.h" #include "daemon.h" #include "rio.h" #include "riospace.h" -#include "top.h" #include "cmdpkt.h" #include "map.h" -#include "riotypes.h" #include "rup.h" #include "port.h" #include "riodrvr.h" @@ -74,161 +65,130 @@ static char *_rioboot_c_sccs_ = "@(#)rioboot.c 1.3"; #include "unixrup.h" #include "board.h" #include "host.h" -#include "error.h" #include "phb.h" #include "link.h" #include "cmdblk.h" #include "route.h" -static int RIOBootComplete( struct rio_info *p, struct Host *HostP, uint Rup, struct PktCmd *PktCmdP ); - -static uchar -RIOAtVec2Ctrl[] = -{ - /* 0 */ INTERRUPT_DISABLE, - /* 1 */ INTERRUPT_DISABLE, - /* 2 */ INTERRUPT_DISABLE, - /* 3 */ INTERRUPT_DISABLE, - /* 4 */ INTERRUPT_DISABLE, - /* 5 */ INTERRUPT_DISABLE, - /* 6 */ INTERRUPT_DISABLE, - /* 7 */ INTERRUPT_DISABLE, - /* 8 */ INTERRUPT_DISABLE, - /* 9 */ IRQ_9|INTERRUPT_ENABLE, +static int RIOBootComplete(struct rio_info *p, struct Host *HostP, unsigned int Rup, struct PktCmd *PktCmdP); + +static const unsigned char RIOAtVec2Ctrl[] = { + /* 0 */ INTERRUPT_DISABLE, + /* 1 */ INTERRUPT_DISABLE, + /* 2 */ INTERRUPT_DISABLE, + /* 3 */ INTERRUPT_DISABLE, + /* 4 */ INTERRUPT_DISABLE, + /* 5 */ INTERRUPT_DISABLE, + /* 6 */ INTERRUPT_DISABLE, + /* 7 */ INTERRUPT_DISABLE, + /* 8 */ INTERRUPT_DISABLE, + /* 9 */ IRQ_9 | INTERRUPT_ENABLE, /* 10 */ INTERRUPT_DISABLE, - /* 11 */ IRQ_11|INTERRUPT_ENABLE, - /* 12 */ IRQ_12|INTERRUPT_ENABLE, + /* 11 */ IRQ_11 | INTERRUPT_ENABLE, + /* 12 */ IRQ_12 | INTERRUPT_ENABLE, /* 13 */ INTERRUPT_DISABLE, /* 14 */ INTERRUPT_DISABLE, - /* 15 */ IRQ_15|INTERRUPT_ENABLE + /* 15 */ IRQ_15 | INTERRUPT_ENABLE }; -/* -** Load in the RTA boot code. -*/ -int -RIOBootCodeRTA(p, rbp) -struct rio_info * p; -struct DownLoad * rbp; +/** + * RIOBootCodeRTA - Load RTA boot code + * @p: RIO to load + * @rbp: Download descriptor + * + * Called when the user process initiates booting of the card firmware. + * Lads the firmware + */ + +int RIOBootCodeRTA(struct rio_info *p, struct DownLoad * rbp) { int offset; - func_enter (); + func_enter(); - /* Linux doesn't allow you to disable interrupts during a - "copyin". (Crash when a pagefault occurs). */ - /* disable(oldspl); */ - - rio_dprintk (RIO_DEBUG_BOOT, "Data at user address 0x%x\n",(int)rbp->DataP); + rio_dprintk(RIO_DEBUG_BOOT, "Data at user address %p\n", rbp->DataP); /* - ** Check that we have set asside enough memory for this - */ - if ( rbp->Count > SIXTY_FOUR_K ) { - rio_dprintk (RIO_DEBUG_BOOT, "RTA Boot Code Too Large!\n"); + ** Check that we have set asside enough memory for this + */ + if (rbp->Count > SIXTY_FOUR_K) { + rio_dprintk(RIO_DEBUG_BOOT, "RTA Boot Code Too Large!\n"); p->RIOError.Error = HOST_FILE_TOO_LARGE; - /* restore(oldspl); */ - func_exit (); + func_exit(); return -ENOMEM; } - if ( p->RIOBooting ) { - rio_dprintk (RIO_DEBUG_BOOT, "RTA Boot Code : BUSY BUSY BUSY!\n"); + if (p->RIOBooting) { + rio_dprintk(RIO_DEBUG_BOOT, "RTA Boot Code : BUSY BUSY BUSY!\n"); p->RIOError.Error = BOOT_IN_PROGRESS; - /* restore(oldspl); */ - func_exit (); + func_exit(); return -EBUSY; } /* - ** The data we load in must end on a (RTA_BOOT_DATA_SIZE) byte boundary, - ** so calculate how far we have to move the data up the buffer - ** to achieve this. - */ - offset = (RTA_BOOT_DATA_SIZE - (rbp->Count % RTA_BOOT_DATA_SIZE)) % - RTA_BOOT_DATA_SIZE; + ** The data we load in must end on a (RTA_BOOT_DATA_SIZE) byte boundary, + ** so calculate how far we have to move the data up the buffer + ** to achieve this. + */ + offset = (RTA_BOOT_DATA_SIZE - (rbp->Count % RTA_BOOT_DATA_SIZE)) % RTA_BOOT_DATA_SIZE; /* - ** Be clean, and clear the 'unused' portion of the boot buffer, - ** because it will (eventually) be part of the Rta run time environment - ** and so should be zeroed. - */ - bzero( (caddr_t)p->RIOBootPackets, offset ); + ** Be clean, and clear the 'unused' portion of the boot buffer, + ** because it will (eventually) be part of the Rta run time environment + ** and so should be zeroed. + */ + memset(p->RIOBootPackets, 0, offset); /* - ** Copy the data from user space. - */ + ** Copy the data from user space into the array + */ - if ( copyin((int)rbp->DataP,((caddr_t)(p->RIOBootPackets))+offset, - rbp->Count) ==COPYFAIL ) { - rio_dprintk (RIO_DEBUG_BOOT, "Bad data copy from user space\n"); + if (copy_from_user(((u8 *)p->RIOBootPackets) + offset, rbp->DataP, rbp->Count)) { + rio_dprintk(RIO_DEBUG_BOOT, "Bad data copy from user space\n"); p->RIOError.Error = COPYIN_FAILED; - /* restore(oldspl); */ - func_exit (); + func_exit(); return -EFAULT; } /* - ** Make sure that our copy of the size includes that offset we discussed - ** earlier. - */ - p->RIONumBootPkts = (rbp->Count+offset)/RTA_BOOT_DATA_SIZE; - p->RIOBootCount = rbp->Count; + ** Make sure that our copy of the size includes that offset we discussed + ** earlier. + */ + p->RIONumBootPkts = (rbp->Count + offset) / RTA_BOOT_DATA_SIZE; + p->RIOBootCount = rbp->Count; - /* restore(oldspl); */ func_exit(); return 0; } -void rio_start_card_running (struct Host * HostP) -{ - func_enter (); +/** + * rio_start_card_running - host card start + * @HostP: The RIO to kick off + * + * Start a RIO processor unit running. Encapsulates the knowledge + * of the card type. + */ - switch ( HostP->Type ) { +void rio_start_card_running(struct Host *HostP) +{ + switch (HostP->Type) { case RIO_AT: - rio_dprintk (RIO_DEBUG_BOOT, "Start ISA card running\n"); - WBYTE(HostP->Control, - BOOT_FROM_RAM | EXTERNAL_BUS_ON - | HostP->Mode - | RIOAtVec2Ctrl[HostP->Ivec & 0xF] ); - break; - -#ifdef FUTURE_RELEASE - case RIO_MCA: - /* - ** MCA handles IRQ vectors differently, so we don't write - ** them to this register. - */ - rio_dprintk (RIO_DEBUG_BOOT, "Start MCA card running\n"); - WBYTE(HostP->Control, McaTpBootFromRam | McaTpBusEnable | HostP->Mode); + rio_dprintk(RIO_DEBUG_BOOT, "Start ISA card running\n"); + writeb(BOOT_FROM_RAM | EXTERNAL_BUS_ON | HostP->Mode | RIOAtVec2Ctrl[HostP->Ivec & 0xF], &HostP->Control); break; - - case RIO_EISA: - /* - ** EISA is totally different and expects OUTBZs to turn it on. - */ - rio_dprintk (RIO_DEBUG_BOOT, "Start EISA card running\n"); - OUTBZ( HostP->Slot, EISA_CONTROL_PORT, HostP->Mode | RIOEisaVec2Ctrl[HostP->Ivec] | EISA_TP_RUN | EISA_TP_BUS_ENABLE | EISA_TP_BOOT_FROM_RAM ); - break; -#endif - case RIO_PCI: - /* - ** PCI is much the same as MCA. Everything is once again memory - ** mapped, so we are writing to memory registers instead of io - ** ports. - */ - rio_dprintk (RIO_DEBUG_BOOT, "Start PCI card running\n"); - WBYTE(HostP->Control, PCITpBootFromRam | PCITpBusEnable | HostP->Mode); + /* + ** PCI is much the same as MCA. Everything is once again memory + ** mapped, so we are writing to memory registers instead of io + ** ports. + */ + rio_dprintk(RIO_DEBUG_BOOT, "Start PCI card running\n"); + writeb(PCITpBootFromRam | PCITpBusEnable | HostP->Mode, &HostP->Control); break; default: - rio_dprintk (RIO_DEBUG_BOOT, "Unknown host type %d\n", HostP->Type); + rio_dprintk(RIO_DEBUG_BOOT, "Unknown host type %d\n", HostP->Type); break; } -/* - printk (KERN_INFO "Done with starting the card\n"); - func_exit (); -*/ return; } @@ -239,370 +199,350 @@ void rio_start_card_running (struct Host * HostP) ** Put your rubber pants on before messing with this code - even the magic ** numbers have trouble understanding what they are doing here. */ -int -RIOBootCodeHOST(p, rbp) -struct rio_info * p; -register struct DownLoad *rbp; + +int RIOBootCodeHOST(struct rio_info *p, struct DownLoad *rbp) { - register struct Host *HostP; - register caddr_t Cad; - register PARM_MAP *ParmMapP; - register int RupN; + struct Host *HostP; + u8 *Cad; + PARM_MAP *ParmMapP; + int RupN; int PortN; - uint host; - caddr_t StartP; - BYTE *DestP; + unsigned int host; + u8 *StartP; + u8 *DestP; int wait_count; - ushort OldParmMap; - ushort offset; /* It is very important that this is a ushort */ - /* uint byte; */ - caddr_t DownCode = NULL; + u16 OldParmMap; + u16 offset; /* It is very important that this is a u16 */ + u8 *DownCode = NULL; unsigned long flags; - HostP = NULL; /* Assure the compiler we've initialized it */ - for ( host=0; host<p->RIONumHosts; host++ ) { - rio_dprintk (RIO_DEBUG_BOOT, "Attempt to boot host %d\n",host); + HostP = NULL; /* Assure the compiler we've initialized it */ + + + /* Walk the hosts */ + for (host = 0; host < p->RIONumHosts; host++) { + rio_dprintk(RIO_DEBUG_BOOT, "Attempt to boot host %d\n", host); HostP = &p->RIOHosts[host]; - - rio_dprintk (RIO_DEBUG_BOOT, "Host Type = 0x%x, Mode = 0x%x, IVec = 0x%x\n", - HostP->Type, HostP->Mode, HostP->Ivec); + rio_dprintk(RIO_DEBUG_BOOT, "Host Type = 0x%x, Mode = 0x%x, IVec = 0x%x\n", HostP->Type, HostP->Mode, HostP->Ivec); - if ( (HostP->Flags & RUN_STATE) != RC_WAITING ) { - rio_dprintk (RIO_DEBUG_BOOT, "%s %d already running\n","Host",host); + /* Don't boot hosts already running */ + if ((HostP->Flags & RUN_STATE) != RC_WAITING) { + rio_dprintk(RIO_DEBUG_BOOT, "%s %d already running\n", "Host", host); continue; } /* - ** Grab a 32 bit pointer to the card. - */ + ** Grab a pointer to the card (ioremapped) + */ Cad = HostP->Caddr; /* - ** We are going to (try) and load in rbp->Count bytes. - ** The last byte will reside at p->RIOConf.HostLoadBase-1; - ** Therefore, we need to start copying at address - ** (caddr+p->RIOConf.HostLoadBase-rbp->Count) - */ - StartP = (caddr_t)&Cad[p->RIOConf.HostLoadBase-rbp->Count]; - - rio_dprintk (RIO_DEBUG_BOOT, "kernel virtual address for host is 0x%x\n", (int)Cad ); - rio_dprintk (RIO_DEBUG_BOOT, "kernel virtual address for download is 0x%x\n", (int)StartP); - rio_dprintk (RIO_DEBUG_BOOT, "host loadbase is 0x%x\n",p->RIOConf.HostLoadBase); - rio_dprintk (RIO_DEBUG_BOOT, "size of download is 0x%x\n", rbp->Count); - - if ( p->RIOConf.HostLoadBase < rbp->Count ) { - rio_dprintk (RIO_DEBUG_BOOT, "Bin too large\n"); + ** We are going to (try) and load in rbp->Count bytes. + ** The last byte will reside at p->RIOConf.HostLoadBase-1; + ** Therefore, we need to start copying at address + ** (caddr+p->RIOConf.HostLoadBase-rbp->Count) + */ + StartP = &Cad[p->RIOConf.HostLoadBase - rbp->Count]; + + rio_dprintk(RIO_DEBUG_BOOT, "kernel virtual address for host is %p\n", Cad); + rio_dprintk(RIO_DEBUG_BOOT, "kernel virtual address for download is %p\n", StartP); + rio_dprintk(RIO_DEBUG_BOOT, "host loadbase is 0x%x\n", p->RIOConf.HostLoadBase); + rio_dprintk(RIO_DEBUG_BOOT, "size of download is 0x%x\n", rbp->Count); + + /* Make sure it fits */ + if (p->RIOConf.HostLoadBase < rbp->Count) { + rio_dprintk(RIO_DEBUG_BOOT, "Bin too large\n"); p->RIOError.Error = HOST_FILE_TOO_LARGE; - func_exit (); + func_exit(); return -EFBIG; } /* - ** Ensure that the host really is stopped. - ** Disable it's external bus & twang its reset line. - */ - RIOHostReset( HostP->Type, (struct DpRam *)HostP->CardP, HostP->Slot ); - - /* - ** Copy the data directly from user space to the SRAM. - ** This ain't going to be none too clever if the download - ** code is bigger than this segment. - */ - rio_dprintk (RIO_DEBUG_BOOT, "Copy in code\n"); + ** Ensure that the host really is stopped. + ** Disable it's external bus & twang its reset line. + */ + RIOHostReset(HostP->Type, (struct DpRam *) HostP->CardP, HostP->Slot); /* - ** PCI hostcard can't cope with 32 bit accesses and so need to copy - ** data to a local buffer, and then dripfeed the card. - */ - if ( HostP->Type == RIO_PCI ) { - /* int offset; */ - - DownCode = sysbrk(rbp->Count); - if ( !DownCode ) { - rio_dprintk (RIO_DEBUG_BOOT, "No system memory available\n"); - p->RIOError.Error = NOT_ENOUGH_CORE_FOR_PCI_COPY; - func_exit (); - return -ENOMEM; - } - bzero(DownCode, rbp->Count); - - if ( copyin((int)rbp->DataP,DownCode,rbp->Count)==COPYFAIL ) { - rio_dprintk (RIO_DEBUG_BOOT, "Bad copyin of host data\n"); - sysfree( DownCode, rbp->Count ); - p->RIOError.Error = COPYIN_FAILED; - func_exit (); - return -EFAULT; - } - - HostP->Copy( DownCode, StartP, rbp->Count ); - - sysfree( DownCode, rbp->Count ); + ** Copy the data directly from user space to the SRAM. + ** This ain't going to be none too clever if the download + ** code is bigger than this segment. + */ + rio_dprintk(RIO_DEBUG_BOOT, "Copy in code\n"); + + /* Buffer to local memory as we want to use I/O space and + some cards only do 8 or 16 bit I/O */ + + DownCode = vmalloc(rbp->Count); + if (!DownCode) { + p->RIOError.Error = NOT_ENOUGH_CORE_FOR_PCI_COPY; + func_exit(); + return -ENOMEM; } - else if ( copyin((int)rbp->DataP,StartP,rbp->Count)==COPYFAIL ) { - rio_dprintk (RIO_DEBUG_BOOT, "Bad copyin of host data\n"); + if (copy_from_user(rbp->DataP, DownCode, rbp->Count)) { + kfree(DownCode); p->RIOError.Error = COPYIN_FAILED; - func_exit (); + func_exit(); return -EFAULT; } + HostP->Copy(DownCode, StartP, rbp->Count); + vfree(DownCode); - rio_dprintk (RIO_DEBUG_BOOT, "Copy completed\n"); + rio_dprintk(RIO_DEBUG_BOOT, "Copy completed\n"); /* - ** S T O P ! - ** - ** Upto this point the code has been fairly rational, and possibly - ** even straight forward. What follows is a pile of crud that will - ** magically turn into six bytes of transputer assembler. Normally - ** you would expect an array or something, but, being me, I have - ** chosen [been told] to use a technique whereby the startup code - ** will be correct if we change the loadbase for the code. Which - ** brings us onto another issue - the loadbase is the *end* of the - ** code, not the start. - ** - ** If I were you I wouldn't start from here. - */ + ** S T O P ! + ** + ** Upto this point the code has been fairly rational, and possibly + ** even straight forward. What follows is a pile of crud that will + ** magically turn into six bytes of transputer assembler. Normally + ** you would expect an array or something, but, being me, I have + ** chosen [been told] to use a technique whereby the startup code + ** will be correct if we change the loadbase for the code. Which + ** brings us onto another issue - the loadbase is the *end* of the + ** code, not the start. + ** + ** If I were you I wouldn't start from here. + */ /* - ** We now need to insert a short boot section into - ** the memory at the end of Sram2. This is normally (de)composed - ** of the last eight bytes of the download code. The - ** download has been assembled/compiled to expect to be - ** loaded from 0x7FFF downwards. We have loaded it - ** at some other address. The startup code goes into the small - ** ram window at Sram2, in the last 8 bytes, which are really - ** at addresses 0x7FF8-0x7FFF. - ** - ** If the loadbase is, say, 0x7C00, then we need to branch to - ** address 0x7BFE to run the host.bin startup code. We assemble - ** this jump manually. - ** - ** The two byte sequence 60 08 is loaded into memory at address - ** 0x7FFE,F. This is a local branch to location 0x7FF8 (60 is nfix 0, - ** which adds '0' to the .O register, complements .O, and then shifts - ** it left by 4 bit positions, 08 is a jump .O+8 instruction. This will - ** add 8 to .O (which was 0xFFF0), and will branch RELATIVE to the new - ** location. Now, the branch starts from the value of .PC (or .IP or - ** whatever the bloody register is called on this chip), and the .PC - ** will be pointing to the location AFTER the branch, in this case - ** .PC == 0x8000, so the branch will be to 0x8000+0xFFF8 = 0x7FF8. - ** - ** A long branch is coded at 0x7FF8. This consists of loading a four - ** byte offset into .O using nfix (as above) and pfix operators. The - ** pfix operates in exactly the same way as the nfix operator, but - ** without the complement operation. The offset, of course, must be - ** relative to the address of the byte AFTER the branch instruction, - ** which will be (urm) 0x7FFC, so, our final destination of the branch - ** (loadbase-2), has to be reached from here. Imagine that the loadbase - ** is 0x7C00 (which it is), then we will need to branch to 0x7BFE (which - ** is the first byte of the initial two byte short local branch of the - ** download code). - ** - ** To code a jump from 0x7FFC (which is where the branch will start - ** from) to 0x7BFE, we will need to branch 0xFC02 bytes (0x7FFC+0xFC02)= - ** 0x7BFE. - ** This will be coded as four bytes: - ** 60 2C 20 02 - ** being nfix .O+0 - ** pfix .O+C - ** pfix .O+0 - ** jump .O+2 - ** - ** The nfix operator is used, so that the startup code will be - ** compatible with the whole Tp family. (lies, damn lies, it'll never - ** work in a month of Sundays). - ** - ** The nfix nyble is the 1s complement of the nyble value you - ** want to load - in this case we wanted 'F' so we nfix loaded '0'. - */ + ** We now need to insert a short boot section into + ** the memory at the end of Sram2. This is normally (de)composed + ** of the last eight bytes of the download code. The + ** download has been assembled/compiled to expect to be + ** loaded from 0x7FFF downwards. We have loaded it + ** at some other address. The startup code goes into the small + ** ram window at Sram2, in the last 8 bytes, which are really + ** at addresses 0x7FF8-0x7FFF. + ** + ** If the loadbase is, say, 0x7C00, then we need to branch to + ** address 0x7BFE to run the host.bin startup code. We assemble + ** this jump manually. + ** + ** The two byte sequence 60 08 is loaded into memory at address + ** 0x7FFE,F. This is a local branch to location 0x7FF8 (60 is nfix 0, + ** which adds '0' to the .O register, complements .O, and then shifts + ** it left by 4 bit positions, 08 is a jump .O+8 instruction. This will + ** add 8 to .O (which was 0xFFF0), and will branch RELATIVE to the new + ** location. Now, the branch starts from the value of .PC (or .IP or + ** whatever the bloody register is called on this chip), and the .PC + ** will be pointing to the location AFTER the branch, in this case + ** .PC == 0x8000, so the branch will be to 0x8000+0xFFF8 = 0x7FF8. + ** + ** A long branch is coded at 0x7FF8. This consists of loading a four + ** byte offset into .O using nfix (as above) and pfix operators. The + ** pfix operates in exactly the same way as the nfix operator, but + ** without the complement operation. The offset, of course, must be + ** relative to the address of the byte AFTER the branch instruction, + ** which will be (urm) 0x7FFC, so, our final destination of the branch + ** (loadbase-2), has to be reached from here. Imagine that the loadbase + ** is 0x7C00 (which it is), then we will need to branch to 0x7BFE (which + ** is the first byte of the initial two byte short local branch of the + ** download code). + ** + ** To code a jump from 0x7FFC (which is where the branch will start + ** from) to 0x7BFE, we will need to branch 0xFC02 bytes (0x7FFC+0xFC02)= + ** 0x7BFE. + ** This will be coded as four bytes: + ** 60 2C 20 02 + ** being nfix .O+0 + ** pfix .O+C + ** pfix .O+0 + ** jump .O+2 + ** + ** The nfix operator is used, so that the startup code will be + ** compatible with the whole Tp family. (lies, damn lies, it'll never + ** work in a month of Sundays). + ** + ** The nfix nyble is the 1s complement of the nyble value you + ** want to load - in this case we wanted 'F' so we nfix loaded '0'. + */ /* - ** Dest points to the top 8 bytes of Sram2. The Tp jumps - ** to 0x7FFE at reset time, and starts executing. This is - ** a short branch to 0x7FF8, where a long branch is coded. - */ + ** Dest points to the top 8 bytes of Sram2. The Tp jumps + ** to 0x7FFE at reset time, and starts executing. This is + ** a short branch to 0x7FF8, where a long branch is coded. + */ - DestP = (BYTE *)&Cad[0x7FF8]; /* <<<---- READ THE ABOVE COMMENTS */ + DestP = (u8 *) &Cad[0x7FF8]; /* <<<---- READ THE ABOVE COMMENTS */ #define NFIX(N) (0x60 | (N)) /* .O = (~(.O + N))<<4 */ #define PFIX(N) (0x20 | (N)) /* .O = (.O + N)<<4 */ -#define JUMP(N) (0x00 | (N)) /* .PC = .PC + .O */ +#define JUMP(N) (0x00 | (N)) /* .PC = .PC + .O */ /* - ** 0x7FFC is the address of the location following the last byte of - ** the four byte jump instruction. - ** READ THE ABOVE COMMENTS - ** - ** offset is (TO-FROM) % MEMSIZE, but with compound buggering about. - ** Memsize is 64K for this range of Tp, so offset is a short (unsigned, - ** cos I don't understand 2's complement). - */ - offset = (p->RIOConf.HostLoadBase-2)-0x7FFC; - WBYTE( DestP[0] , NFIX(((ushort)(~offset) >> (ushort)12) & 0xF) ); - WBYTE( DestP[1] , PFIX(( offset >> 8) & 0xF) ); - WBYTE( DestP[2] , PFIX(( offset >> 4) & 0xF) ); - WBYTE( DestP[3] , JUMP( offset & 0xF) ); - - WBYTE( DestP[6] , NFIX(0) ); - WBYTE( DestP[7] , JUMP(8) ); - - rio_dprintk (RIO_DEBUG_BOOT, "host loadbase is 0x%x\n",p->RIOConf.HostLoadBase); - rio_dprintk (RIO_DEBUG_BOOT, "startup offset is 0x%x\n",offset); + ** 0x7FFC is the address of the location following the last byte of + ** the four byte jump instruction. + ** READ THE ABOVE COMMENTS + ** + ** offset is (TO-FROM) % MEMSIZE, but with compound buggering about. + ** Memsize is 64K for this range of Tp, so offset is a short (unsigned, + ** cos I don't understand 2's complement). + */ + offset = (p->RIOConf.HostLoadBase - 2) - 0x7FFC; + + writeb(NFIX(((unsigned short) (~offset) >> (unsigned short) 12) & 0xF), DestP); + writeb(PFIX((offset >> 8) & 0xF), DestP + 1); + writeb(PFIX((offset >> 4) & 0xF), DestP + 2); + writeb(JUMP(offset & 0xF), DestP + 3); + + writeb(NFIX(0), DestP + 6); + writeb(JUMP(8), DestP + 7); + + rio_dprintk(RIO_DEBUG_BOOT, "host loadbase is 0x%x\n", p->RIOConf.HostLoadBase); + rio_dprintk(RIO_DEBUG_BOOT, "startup offset is 0x%x\n", offset); /* - ** Flag what is going on - */ + ** Flag what is going on + */ HostP->Flags &= ~RUN_STATE; HostP->Flags |= RC_STARTUP; /* - ** Grab a copy of the current ParmMap pointer, so we - ** can tell when it has changed. - */ - OldParmMap = RWORD(HostP->__ParmMapR); + ** Grab a copy of the current ParmMap pointer, so we + ** can tell when it has changed. + */ + OldParmMap = readw(&HostP->__ParmMapR); - rio_dprintk (RIO_DEBUG_BOOT, "Original parmmap is 0x%x\n",OldParmMap); + rio_dprintk(RIO_DEBUG_BOOT, "Original parmmap is 0x%x\n", OldParmMap); /* - ** And start it running (I hope). - ** As there is nothing dodgy or obscure about the - ** above code, this is guaranteed to work every time. - */ - rio_dprintk (RIO_DEBUG_BOOT, "Host Type = 0x%x, Mode = 0x%x, IVec = 0x%x\n", - HostP->Type, HostP->Mode, HostP->Ivec); + ** And start it running (I hope). + ** As there is nothing dodgy or obscure about the + ** above code, this is guaranteed to work every time. + */ + rio_dprintk(RIO_DEBUG_BOOT, "Host Type = 0x%x, Mode = 0x%x, IVec = 0x%x\n", HostP->Type, HostP->Mode, HostP->Ivec); rio_start_card_running(HostP); - rio_dprintk (RIO_DEBUG_BOOT, "Set control port\n"); + rio_dprintk(RIO_DEBUG_BOOT, "Set control port\n"); /* - ** Now, wait for upto five seconds for the Tp to setup the parmmap - ** pointer: - */ - for ( wait_count=0; (wait_count<p->RIOConf.StartupTime)&& - (RWORD(HostP->__ParmMapR)==OldParmMap); wait_count++ ) { - rio_dprintk (RIO_DEBUG_BOOT, "Checkout %d, 0x%x\n",wait_count,RWORD(HostP->__ParmMapR)); - delay(HostP, HUNDRED_MS); + ** Now, wait for upto five seconds for the Tp to setup the parmmap + ** pointer: + */ + for (wait_count = 0; (wait_count < p->RIOConf.StartupTime) && (readw(&HostP->__ParmMapR) == OldParmMap); wait_count++) { + rio_dprintk(RIO_DEBUG_BOOT, "Checkout %d, 0x%x\n", wait_count, readw(&HostP->__ParmMapR)); + mdelay(100); } /* - ** If the parmmap pointer is unchanged, then the host code - ** has crashed & burned in a really spectacular way - */ - if ( RWORD(HostP->__ParmMapR) == OldParmMap ) { - rio_dprintk (RIO_DEBUG_BOOT, "parmmap 0x%x\n", RWORD(HostP->__ParmMapR)); - rio_dprintk (RIO_DEBUG_BOOT, "RIO Mesg Run Fail\n"); - -#define HOST_DISABLE \ - HostP->Flags &= ~RUN_STATE; \ - HostP->Flags |= RC_STUFFED; \ - RIOHostReset( HostP->Type, (struct DpRam *)HostP->CardP, HostP->Slot );\ - continue - - HOST_DISABLE; + ** If the parmmap pointer is unchanged, then the host code + ** has crashed & burned in a really spectacular way + */ + if (readw(&HostP->__ParmMapR) == OldParmMap) { + rio_dprintk(RIO_DEBUG_BOOT, "parmmap 0x%x\n", readw(&HostP->__ParmMapR)); + rio_dprintk(RIO_DEBUG_BOOT, "RIO Mesg Run Fail\n"); + HostP->Flags &= ~RUN_STATE; + HostP->Flags |= RC_STUFFED; + RIOHostReset( HostP->Type, (struct DpRam *)HostP->CardP, HostP->Slot ); + continue; } - rio_dprintk (RIO_DEBUG_BOOT, "Running 0x%x\n", RWORD(HostP->__ParmMapR)); + rio_dprintk(RIO_DEBUG_BOOT, "Running 0x%x\n", readw(&HostP->__ParmMapR)); /* - ** Well, the board thought it was OK, and setup its parmmap - ** pointer. For the time being, we will pretend that this - ** board is running, and check out what the error flag says. - */ + ** Well, the board thought it was OK, and setup its parmmap + ** pointer. For the time being, we will pretend that this + ** board is running, and check out what the error flag says. + */ /* - ** Grab a 32 bit pointer to the parmmap structure - */ - ParmMapP = (PARM_MAP *)RIO_PTR(Cad,RWORD(HostP->__ParmMapR)); - rio_dprintk (RIO_DEBUG_BOOT, "ParmMapP : %x\n", (int)ParmMapP); - ParmMapP = (PARM_MAP *)((unsigned long)Cad + - (unsigned long)((RWORD((HostP->__ParmMapR))) & 0xFFFF)); - rio_dprintk (RIO_DEBUG_BOOT, "ParmMapP : %x\n", (int)ParmMapP); + ** Grab a 32 bit pointer to the parmmap structure + */ + ParmMapP = (PARM_MAP *) RIO_PTR(Cad, readw(&HostP->__ParmMapR)); + rio_dprintk(RIO_DEBUG_BOOT, "ParmMapP : %p\n", ParmMapP); + ParmMapP = (PARM_MAP *) ((unsigned long) Cad + readw(&HostP->__ParmMapR)); + rio_dprintk(RIO_DEBUG_BOOT, "ParmMapP : %p\n", ParmMapP); /* - ** The links entry should be 0xFFFF; we set it up - ** with a mask to say how many PHBs to use, and - ** which links to use. - */ - if ( (RWORD(ParmMapP->links) & 0xFFFF) != 0xFFFF ) { - rio_dprintk (RIO_DEBUG_BOOT, "RIO Mesg Run Fail %s\n", HostP->Name); - rio_dprintk (RIO_DEBUG_BOOT, "Links = 0x%x\n",RWORD(ParmMapP->links)); - HOST_DISABLE; + ** The links entry should be 0xFFFF; we set it up + ** with a mask to say how many PHBs to use, and + ** which links to use. + */ + if (readw(&ParmMapP->links) != 0xFFFF) { + rio_dprintk(RIO_DEBUG_BOOT, "RIO Mesg Run Fail %s\n", HostP->Name); + rio_dprintk(RIO_DEBUG_BOOT, "Links = 0x%x\n", readw(&ParmMapP->links)); + HostP->Flags &= ~RUN_STATE; + HostP->Flags |= RC_STUFFED; + RIOHostReset( HostP->Type, (struct DpRam *)HostP->CardP, HostP->Slot ); + continue; } - WWORD(ParmMapP->links , RIO_LINK_ENABLE); + writew(RIO_LINK_ENABLE, &ParmMapP->links); /* - ** now wait for the card to set all the parmmap->XXX stuff - ** this is a wait of upto two seconds.... - */ - rio_dprintk (RIO_DEBUG_BOOT, "Looking for init_done - %d ticks\n",p->RIOConf.StartupTime); + ** now wait for the card to set all the parmmap->XXX stuff + ** this is a wait of upto two seconds.... + */ + rio_dprintk(RIO_DEBUG_BOOT, "Looking for init_done - %d ticks\n", p->RIOConf.StartupTime); HostP->timeout_id = 0; - for ( wait_count=0; (wait_count<p->RIOConf.StartupTime) && - !RWORD(ParmMapP->init_done); wait_count++ ) { - rio_dprintk (RIO_DEBUG_BOOT, "Waiting for init_done\n"); - delay(HostP, HUNDRED_MS); + for (wait_count = 0; (wait_count < p->RIOConf.StartupTime) && !readw(&ParmMapP->init_done); wait_count++) { + rio_dprintk(RIO_DEBUG_BOOT, "Waiting for init_done\n"); + mdelay(100); } - rio_dprintk (RIO_DEBUG_BOOT, "OK! init_done!\n"); - - if (RWORD(ParmMapP->error) != E_NO_ERROR || - !RWORD(ParmMapP->init_done) ) { - rio_dprintk (RIO_DEBUG_BOOT, "RIO Mesg Run Fail %s\n", HostP->Name); - rio_dprintk (RIO_DEBUG_BOOT, "Timedout waiting for init_done\n"); - HOST_DISABLE; + rio_dprintk(RIO_DEBUG_BOOT, "OK! init_done!\n"); + + if (readw(&ParmMapP->error) != E_NO_ERROR || !readw(&ParmMapP->init_done)) { + rio_dprintk(RIO_DEBUG_BOOT, "RIO Mesg Run Fail %s\n", HostP->Name); + rio_dprintk(RIO_DEBUG_BOOT, "Timedout waiting for init_done\n"); + HostP->Flags &= ~RUN_STATE; + HostP->Flags |= RC_STUFFED; + RIOHostReset( HostP->Type, (struct DpRam *)HostP->CardP, HostP->Slot ); + continue; } - rio_dprintk (RIO_DEBUG_BOOT, "Got init_done\n"); + rio_dprintk(RIO_DEBUG_BOOT, "Got init_done\n"); /* - ** It runs! It runs! - */ - rio_dprintk (RIO_DEBUG_BOOT, "Host ID %x Running\n",HostP->UniqueNum); + ** It runs! It runs! + */ + rio_dprintk(RIO_DEBUG_BOOT, "Host ID %x Running\n", HostP->UniqueNum); /* - ** set the time period between interrupts. - */ - WWORD(ParmMapP->timer, (short)p->RIOConf.Timer ); + ** set the time period between interrupts. + */ + writew(p->RIOConf.Timer, &ParmMapP->timer); /* - ** Translate all the 16 bit pointers in the __ParmMapR into - ** 32 bit pointers for the driver. - */ - HostP->ParmMapP = ParmMapP; - HostP->PhbP = (PHB*)RIO_PTR(Cad,RWORD(ParmMapP->phb_ptr)); - HostP->RupP = (RUP*)RIO_PTR(Cad,RWORD(ParmMapP->rups)); - HostP->PhbNumP = (ushort*)RIO_PTR(Cad,RWORD(ParmMapP->phb_num_ptr)); - HostP->LinkStrP = (LPB*)RIO_PTR(Cad,RWORD(ParmMapP->link_str_ptr)); + ** Translate all the 16 bit pointers in the __ParmMapR into + ** 32 bit pointers for the driver in ioremap space. + */ + HostP->ParmMapP = ParmMapP; + HostP->PhbP = (struct PHB *) RIO_PTR(Cad, readw(&ParmMapP->phb_ptr)); + HostP->RupP = (struct RUP *) RIO_PTR(Cad, readw(&ParmMapP->rups)); + HostP->PhbNumP = (unsigned short *) RIO_PTR(Cad, readw(&ParmMapP->phb_num_ptr)); + HostP->LinkStrP = (struct LPB *) RIO_PTR(Cad, readw(&ParmMapP->link_str_ptr)); /* - ** point the UnixRups at the real Rups - */ - for ( RupN = 0; RupN<MAX_RUP; RupN++ ) { - HostP->UnixRups[RupN].RupP = &HostP->RupP[RupN]; - HostP->UnixRups[RupN].Id = RupN+1; + ** point the UnixRups at the real Rups + */ + for (RupN = 0; RupN < MAX_RUP; RupN++) { + HostP->UnixRups[RupN].RupP = &HostP->RupP[RupN]; + HostP->UnixRups[RupN].Id = RupN + 1; HostP->UnixRups[RupN].BaseSysPort = NO_PORT; spin_lock_init(&HostP->UnixRups[RupN].RupLock); } - for ( RupN = 0; RupN<LINKS_PER_UNIT; RupN++ ) { - HostP->UnixRups[RupN+MAX_RUP].RupP = &HostP->LinkStrP[RupN].rup; - HostP->UnixRups[RupN+MAX_RUP].Id = 0; - HostP->UnixRups[RupN+MAX_RUP].BaseSysPort = NO_PORT; - spin_lock_init(&HostP->UnixRups[RupN+MAX_RUP].RupLock); + for (RupN = 0; RupN < LINKS_PER_UNIT; RupN++) { + HostP->UnixRups[RupN + MAX_RUP].RupP = &HostP->LinkStrP[RupN].rup; + HostP->UnixRups[RupN + MAX_RUP].Id = 0; + HostP->UnixRups[RupN + MAX_RUP].BaseSysPort = NO_PORT; + spin_lock_init(&HostP->UnixRups[RupN + MAX_RUP].RupLock); } /* - ** point the PortP->Phbs at the real Phbs - */ - for ( PortN=p->RIOFirstPortsMapped; - PortN<p->RIOLastPortsMapped+PORTS_PER_RTA; PortN++ ) { - if ( p->RIOPortp[PortN]->HostP == HostP ) { + ** point the PortP->Phbs at the real Phbs + */ + for (PortN = p->RIOFirstPortsMapped; PortN < p->RIOLastPortsMapped + PORTS_PER_RTA; PortN++) { + if (p->RIOPortp[PortN]->HostP == HostP) { struct Port *PortP = p->RIOPortp[PortN]; struct PHB *PhbP; /* int oldspl; */ - if ( !PortP->Mapped ) + if (!PortP->Mapped) continue; PhbP = &HostP->PhbP[PortP->HostPort]; @@ -610,641 +550,522 @@ register struct DownLoad *rbp; PortP->PhbP = PhbP; - PortP->TxAdd = (WORD *)RIO_PTR(Cad,RWORD(PhbP->tx_add)); - PortP->TxStart = (WORD *)RIO_PTR(Cad,RWORD(PhbP->tx_start)); - PortP->TxEnd = (WORD *)RIO_PTR(Cad,RWORD(PhbP->tx_end)); - PortP->RxRemove = (WORD *)RIO_PTR(Cad,RWORD(PhbP->rx_remove)); - PortP->RxStart = (WORD *)RIO_PTR(Cad,RWORD(PhbP->rx_start)); - PortP->RxEnd = (WORD *)RIO_PTR(Cad,RWORD(PhbP->rx_end)); + PortP->TxAdd = (u16 *) RIO_PTR(Cad, readw(&PhbP->tx_add)); + PortP->TxStart = (u16 *) RIO_PTR(Cad, readw(&PhbP->tx_start)); + PortP->TxEnd = (u16 *) RIO_PTR(Cad, readw(&PhbP->tx_end)); + PortP->RxRemove = (u16 *) RIO_PTR(Cad, readw(&PhbP->rx_remove)); + PortP->RxStart = (u16 *) RIO_PTR(Cad, readw(&PhbP->rx_start)); + PortP->RxEnd = (u16 *) RIO_PTR(Cad, readw(&PhbP->rx_end)); rio_spin_unlock_irqrestore(&PortP->portSem, flags); /* - ** point the UnixRup at the base SysPort - */ - if ( !(PortN % PORTS_PER_RTA) ) + ** point the UnixRup at the base SysPort + */ + if (!(PortN % PORTS_PER_RTA)) HostP->UnixRups[PortP->RupNum].BaseSysPort = PortN; } } - rio_dprintk (RIO_DEBUG_BOOT, "Set the card running... \n"); + rio_dprintk(RIO_DEBUG_BOOT, "Set the card running... \n"); /* - ** last thing - show the world that everything is in place - */ + ** last thing - show the world that everything is in place + */ HostP->Flags &= ~RUN_STATE; HostP->Flags |= RC_RUNNING; } /* - ** MPX always uses a poller. This is actually patched into the system - ** configuration and called directly from each clock tick. - ** - */ + ** MPX always uses a poller. This is actually patched into the system + ** configuration and called directly from each clock tick. + ** + */ p->RIOPolling = 1; p->RIOSystemUp++; - - rio_dprintk (RIO_DEBUG_BOOT, "Done everything %x\n", HostP->Ivec); - func_exit (); + + rio_dprintk(RIO_DEBUG_BOOT, "Done everything %x\n", HostP->Ivec); + func_exit(); return 0; } -/* -** Boot an RTA. If we have successfully processed this boot, then -** return 1. If we havent, then return 0. -*/ -int -RIOBootRup( p, Rup, HostP, PacketP) -struct rio_info * p; -uint Rup; -struct Host *HostP; -struct PKT *PacketP; +/** + * RIOBootRup - Boot an RTA + * @p: rio we are working with + * @Rup: Rup number + * @HostP: host object + * @PacketP: packet to use + * + * If we have successfully processed this boot, then + * return 1. If we havent, then return 0. + */ + +int RIOBootRup(struct rio_info *p, unsigned int Rup, struct Host *HostP, struct PKT *PacketP) { - struct PktCmd *PktCmdP = (struct PktCmd *)PacketP->data; + struct PktCmd *PktCmdP = (struct PktCmd *) PacketP->data; struct PktCmd_M *PktReplyP; struct CmdBlk *CmdBlkP; - uint sequence; + unsigned int sequence; /* - ** If we haven't been told what to boot, we can't boot it. - */ - if ( p->RIONumBootPkts == 0 ) { - rio_dprintk (RIO_DEBUG_BOOT, "No RTA code to download yet\n"); + ** If we haven't been told what to boot, we can't boot it. + */ + if (p->RIONumBootPkts == 0) { + rio_dprintk(RIO_DEBUG_BOOT, "No RTA code to download yet\n"); return 0; } - /* rio_dprint(RIO_DEBUG_BOOT, NULL,DBG_BOOT,"Incoming command packet\n"); */ - /* ShowPacket( DBG_BOOT, PacketP ); */ - /* - ** Special case of boot completed - if we get one of these then we - ** don't need a command block. For all other cases we do, so handle - ** this first and then get a command block, then handle every other - ** case, relinquishing the command block if disaster strikes! - */ - if ( (RBYTE(PacketP->len) & PKT_CMD_BIT) && - (RBYTE(PktCmdP->Command)==BOOT_COMPLETED) ) - return RIOBootComplete(p, HostP, Rup, PktCmdP ); + ** Special case of boot completed - if we get one of these then we + ** don't need a command block. For all other cases we do, so handle + ** this first and then get a command block, then handle every other + ** case, relinquishing the command block if disaster strikes! + */ + if ((readb(&PacketP->len) & PKT_CMD_BIT) && (readb(&PktCmdP->Command) == BOOT_COMPLETED)) + return RIOBootComplete(p, HostP, Rup, PktCmdP); /* - ** try to unhook a command block from the command free list. - */ - if ( !(CmdBlkP = RIOGetCmdBlk()) ) { - rio_dprintk (RIO_DEBUG_BOOT, "No command blocks to boot RTA! come back later.\n"); + ** Try to allocate a command block. This is in kernel space + */ + if (!(CmdBlkP = RIOGetCmdBlk())) { + rio_dprintk(RIO_DEBUG_BOOT, "No command blocks to boot RTA! come back later.\n"); return 0; } /* - ** Fill in the default info on the command block - */ - CmdBlkP->Packet.dest_unit = Rup < (ushort)MAX_RUP ? Rup : 0; + ** Fill in the default info on the command block + */ + CmdBlkP->Packet.dest_unit = Rup < (unsigned short) MAX_RUP ? Rup : 0; CmdBlkP->Packet.dest_port = BOOT_RUP; - CmdBlkP->Packet.src_unit = 0; - CmdBlkP->Packet.src_port = BOOT_RUP; + CmdBlkP->Packet.src_unit = 0; + CmdBlkP->Packet.src_port = BOOT_RUP; CmdBlkP->PreFuncP = CmdBlkP->PostFuncP = NULL; - PktReplyP = (struct PktCmd_M *)CmdBlkP->Packet.data; + PktReplyP = (struct PktCmd_M *) CmdBlkP->Packet.data; /* - ** process COMMANDS on the boot rup! - */ - if ( RBYTE(PacketP->len) & PKT_CMD_BIT ) { + ** process COMMANDS on the boot rup! + */ + if (readb(&PacketP->len) & PKT_CMD_BIT) { /* - ** We only expect one type of command - a BOOT_REQUEST! - */ - if ( RBYTE(PktCmdP->Command) != BOOT_REQUEST ) { - rio_dprintk (RIO_DEBUG_BOOT, "Unexpected command %d on BOOT RUP %d of host %d\n", - PktCmdP->Command,Rup,HostP-p->RIOHosts); - ShowPacket( DBG_BOOT, PacketP ); - RIOFreeCmdBlk( CmdBlkP ); + ** We only expect one type of command - a BOOT_REQUEST! + */ + if (readb(&PktCmdP->Command) != BOOT_REQUEST) { + rio_dprintk(RIO_DEBUG_BOOT, "Unexpected command %d on BOOT RUP %d of host %Zd\n", readb(&PktCmdP->Command), Rup, HostP - p->RIOHosts); + RIOFreeCmdBlk(CmdBlkP); return 1; } /* - ** Build a Boot Sequence command block - ** - ** 02.03.1999 ARG - ESIL 0820 fix - ** We no longer need to use "Boot Mode", we'll always allow - ** boot requests - the boot will not complete if the device - ** appears in the bindings table. - ** So, this conditional is not required ... - ** - if (p->RIOBootMode == RC_BOOT_NONE) - ** - ** If the system is in slave mode, and a boot request is - ** received, set command to BOOT_ABORT so that the boot - ** will not complete. - ** - PktReplyP->Command = BOOT_ABORT; - else - ** - ** We'll just (always) set the command field in packet reply - ** to allow an attempted boot sequence : - */ + ** Build a Boot Sequence command block + ** + ** We no longer need to use "Boot Mode", we'll always allow + ** boot requests - the boot will not complete if the device + ** appears in the bindings table. + ** + ** We'll just (always) set the command field in packet reply + ** to allow an attempted boot sequence : + */ PktReplyP->Command = BOOT_SEQUENCE; PktReplyP->BootSequence.NumPackets = p->RIONumBootPkts; - PktReplyP->BootSequence.LoadBase = p->RIOConf.RtaLoadBase; - PktReplyP->BootSequence.CodeSize = p->RIOBootCount; + PktReplyP->BootSequence.LoadBase = p->RIOConf.RtaLoadBase; + PktReplyP->BootSequence.CodeSize = p->RIOBootCount; - CmdBlkP->Packet.len = BOOT_SEQUENCE_LEN | PKT_CMD_BIT; + CmdBlkP->Packet.len = BOOT_SEQUENCE_LEN | PKT_CMD_BIT; - bcopy("BOOT",(void *)&CmdBlkP->Packet.data[BOOT_SEQUENCE_LEN],4); + memcpy((void *) &CmdBlkP->Packet.data[BOOT_SEQUENCE_LEN], "BOOT", 4); - rio_dprintk (RIO_DEBUG_BOOT, "Boot RTA on Host %d Rup %d - %d (0x%x) packets to 0x%x\n", - HostP-p->RIOHosts, Rup, p->RIONumBootPkts, p->RIONumBootPkts, - p->RIOConf.RtaLoadBase); + rio_dprintk(RIO_DEBUG_BOOT, "Boot RTA on Host %Zd Rup %d - %d (0x%x) packets to 0x%x\n", HostP - p->RIOHosts, Rup, p->RIONumBootPkts, p->RIONumBootPkts, p->RIOConf.RtaLoadBase); /* - ** If this host is in slave mode, send the RTA an invalid boot - ** sequence command block to force it to kill the boot. We wait - ** for half a second before sending this packet to prevent the RTA - ** attempting to boot too often. The master host should then grab - ** the RTA and make it its own. - */ + ** If this host is in slave mode, send the RTA an invalid boot + ** sequence command block to force it to kill the boot. We wait + ** for half a second before sending this packet to prevent the RTA + ** attempting to boot too often. The master host should then grab + ** the RTA and make it its own. + */ p->RIOBooting++; - RIOQueueCmdBlk( HostP, Rup, CmdBlkP ); + RIOQueueCmdBlk(HostP, Rup, CmdBlkP); return 1; } /* - ** It is a request for boot data. - */ - sequence = RWORD(PktCmdP->Sequence); + ** It is a request for boot data. + */ + sequence = readw(&PktCmdP->Sequence); - rio_dprintk (RIO_DEBUG_BOOT, "Boot block %d on Host %d Rup%d\n",sequence,HostP-p->RIOHosts,Rup); + rio_dprintk(RIO_DEBUG_BOOT, "Boot block %d on Host %Zd Rup%d\n", sequence, HostP - p->RIOHosts, Rup); - if ( sequence >= p->RIONumBootPkts ) { - rio_dprintk (RIO_DEBUG_BOOT, "Got a request for packet %d, max is %d\n", sequence, - p->RIONumBootPkts); - ShowPacket( DBG_BOOT, PacketP ); + if (sequence >= p->RIONumBootPkts) { + rio_dprintk(RIO_DEBUG_BOOT, "Got a request for packet %d, max is %d\n", sequence, p->RIONumBootPkts); } PktReplyP->Sequence = sequence; - - bcopy( p->RIOBootPackets[ p->RIONumBootPkts - sequence - 1 ], - PktReplyP->BootData, RTA_BOOT_DATA_SIZE ); - + memcpy(PktReplyP->BootData, p->RIOBootPackets[p->RIONumBootPkts - sequence - 1], RTA_BOOT_DATA_SIZE); CmdBlkP->Packet.len = PKT_MAX_DATA_LEN; - ShowPacket( DBG_BOOT, &CmdBlkP->Packet ); - RIOQueueCmdBlk( HostP, Rup, CmdBlkP ); + RIOQueueCmdBlk(HostP, Rup, CmdBlkP); return 1; } -/* -** This function is called when an RTA been booted. -** If booted by a host, HostP->HostUniqueNum is the booting host. -** If booted by an RTA, HostP->Mapping[Rup].RtaUniqueNum is the booting RTA. -** RtaUniq is the booted RTA. -*/ -static int RIOBootComplete( struct rio_info *p, struct Host *HostP, uint Rup, struct PktCmd *PktCmdP ) +/** + * RIOBootComplete - RTA boot is done + * @p: RIO we are working with + * @HostP: Host structure + * @Rup: RUP being used + * @PktCmdP: Packet command that was used + * + * This function is called when an RTA been booted. + * If booted by a host, HostP->HostUniqueNum is the booting host. + * If booted by an RTA, HostP->Mapping[Rup].RtaUniqueNum is the booting RTA. + * RtaUniq is the booted RTA. + */ + +static int RIOBootComplete(struct rio_info *p, struct Host *HostP, unsigned int Rup, struct PktCmd *PktCmdP) { - struct Map *MapP = NULL; - struct Map *MapP2 = NULL; - int Flag; - int found; - int host, rta; - int EmptySlot = -1; - int entry, entry2; - char *MyType, *MyName; - uint MyLink; - ushort RtaType; - uint RtaUniq = (RBYTE(PktCmdP->UniqNum[0])) + - (RBYTE(PktCmdP->UniqNum[1]) << 8) + - (RBYTE(PktCmdP->UniqNum[2]) << 16) + - (RBYTE(PktCmdP->UniqNum[3]) << 24); - - /* Was RIOBooting-- . That's bad. If an RTA sends two of them, the - driver will never think that the RTA has booted... -- REW */ + struct Map *MapP = NULL; + struct Map *MapP2 = NULL; + int Flag; + int found; + int host, rta; + int EmptySlot = -1; + int entry, entry2; + char *MyType, *MyName; + unsigned int MyLink; + unsigned short RtaType; + u32 RtaUniq = (readb(&PktCmdP->UniqNum[0])) + (readb(&PktCmdP->UniqNum[1]) << 8) + (readb(&PktCmdP->UniqNum[2]) << 16) + (readb(&PktCmdP->UniqNum[3]) << 24); + p->RIOBooting = 0; - rio_dprintk (RIO_DEBUG_BOOT, "RTA Boot completed - BootInProgress now %d\n", p->RIOBooting); + rio_dprintk(RIO_DEBUG_BOOT, "RTA Boot completed - BootInProgress now %d\n", p->RIOBooting); /* - ** Determine type of unit (16/8 port RTA). - */ + ** Determine type of unit (16/8 port RTA). + */ + RtaType = GetUnitType(RtaUniq); - if ( Rup >= (ushort)MAX_RUP ) { - rio_dprintk (RIO_DEBUG_BOOT, "RIO: Host %s has booted an RTA(%d) on link %c\n", - HostP->Name, 8 * RtaType, RBYTE(PktCmdP->LinkNum)+'A'); - } else { - rio_dprintk (RIO_DEBUG_BOOT, "RIO: RTA %s has booted an RTA(%d) on link %c\n", - HostP->Mapping[Rup].Name, 8 * RtaType, - RBYTE(PktCmdP->LinkNum)+'A'); - } + if (Rup >= (unsigned short) MAX_RUP) + rio_dprintk(RIO_DEBUG_BOOT, "RIO: Host %s has booted an RTA(%d) on link %c\n", HostP->Name, 8 * RtaType, readb(&PktCmdP->LinkNum) + 'A'); + else + rio_dprintk(RIO_DEBUG_BOOT, "RIO: RTA %s has booted an RTA(%d) on link %c\n", HostP->Mapping[Rup].Name, 8 * RtaType, readb(&PktCmdP->LinkNum) + 'A'); - rio_dprintk (RIO_DEBUG_BOOT, "UniqNum is 0x%x\n",RtaUniq); + rio_dprintk(RIO_DEBUG_BOOT, "UniqNum is 0x%x\n", RtaUniq); - if ( ( RtaUniq == 0x00000000 ) || ( RtaUniq == 0xffffffff ) ) - { - rio_dprintk (RIO_DEBUG_BOOT, "Illegal RTA Uniq Number\n"); - return TRUE; + if (RtaUniq == 0x00000000 || RtaUniq == 0xffffffff) { + rio_dprintk(RIO_DEBUG_BOOT, "Illegal RTA Uniq Number\n"); + return 1; } /* - ** If this RTA has just booted an RTA which doesn't belong to this - ** system, or the system is in slave mode, do not attempt to create - ** a new table entry for it. - */ - if (!RIOBootOk(p, HostP, RtaUniq)) - { - MyLink = RBYTE(PktCmdP->LinkNum); - if (Rup < (ushort) MAX_RUP) - { - /* - ** RtaUniq was clone booted (by this RTA). Instruct this RTA - ** to hold off further attempts to boot on this link for 30 - ** seconds. - */ - if (RIOSuspendBootRta(HostP, HostP->Mapping[Rup].ID, MyLink)) - { - rio_dprintk (RIO_DEBUG_BOOT, "RTA failed to suspend booting on link %c\n", - 'A' + MyLink); - } - } - else - { - /* - ** RtaUniq was booted by this host. Set the booting link - ** to hold off for 30 seconds to give another unit a - ** chance to boot it. - */ - WWORD(HostP->LinkStrP[MyLink].WaitNoBoot, 30); - } - rio_dprintk (RIO_DEBUG_BOOT, "RTA %x not owned - suspend booting down link %c on unit %x\n", - RtaUniq, 'A' + MyLink, HostP->Mapping[Rup].RtaUniqueNum); - return TRUE; + ** If this RTA has just booted an RTA which doesn't belong to this + ** system, or the system is in slave mode, do not attempt to create + ** a new table entry for it. + */ + + if (!RIOBootOk(p, HostP, RtaUniq)) { + MyLink = readb(&PktCmdP->LinkNum); + if (Rup < (unsigned short) MAX_RUP) { + /* + ** RtaUniq was clone booted (by this RTA). Instruct this RTA + ** to hold off further attempts to boot on this link for 30 + ** seconds. + */ + if (RIOSuspendBootRta(HostP, HostP->Mapping[Rup].ID, MyLink)) { + rio_dprintk(RIO_DEBUG_BOOT, "RTA failed to suspend booting on link %c\n", 'A' + MyLink); + } + } else + /* + ** RtaUniq was booted by this host. Set the booting link + ** to hold off for 30 seconds to give another unit a + ** chance to boot it. + */ + writew(30, &HostP->LinkStrP[MyLink].WaitNoBoot); + rio_dprintk(RIO_DEBUG_BOOT, "RTA %x not owned - suspend booting down link %c on unit %x\n", RtaUniq, 'A' + MyLink, HostP->Mapping[Rup].RtaUniqueNum); + return 1; } /* - ** Check for a SLOT_IN_USE entry for this RTA attached to the - ** current host card in the driver table. - ** - ** If it exists, make a note that we have booted it. Other parts of - ** the driver are interested in this information at a later date, - ** in particular when the booting RTA asks for an ID for this unit, - ** we must have set the BOOTED flag, and the NEWBOOT flag is used - ** to force an open on any ports that where previously open on this - ** unit. - */ - for ( entry=0; entry<MAX_RUP; entry++ ) - { - uint sysport; - - if ((HostP->Mapping[entry].Flags & SLOT_IN_USE) && - (HostP->Mapping[entry].RtaUniqueNum==RtaUniq)) - { - HostP->Mapping[entry].Flags |= RTA_BOOTED|RTA_NEWBOOT; -#ifdef NEED_TO_FIX - RIO_SV_BROADCAST(HostP->svFlags[entry]); -#endif - if ( (sysport=HostP->Mapping[entry].SysPort) != NO_PORT ) - { - if ( sysport < p->RIOFirstPortsBooted ) - p->RIOFirstPortsBooted = sysport; - if ( sysport > p->RIOLastPortsBooted ) - p->RIOLastPortsBooted = sysport; - /* - ** For a 16 port RTA, check the second bank of 8 ports - */ - if (RtaType == TYPE_RTA16) - { - entry2 = HostP->Mapping[entry].ID2 - 1; - HostP->Mapping[entry2].Flags |= RTA_BOOTED|RTA_NEWBOOT; -#ifdef NEED_TO_FIX - RIO_SV_BROADCAST(HostP->svFlags[entry2]); -#endif - sysport = HostP->Mapping[entry2].SysPort; - if ( sysport < p->RIOFirstPortsBooted ) - p->RIOFirstPortsBooted = sysport; - if ( sysport > p->RIOLastPortsBooted ) - p->RIOLastPortsBooted = sysport; - } - } - if (RtaType == TYPE_RTA16) { - rio_dprintk (RIO_DEBUG_BOOT, "RTA will be given IDs %d+%d\n", - entry+1, entry2+1); - } else { - rio_dprintk (RIO_DEBUG_BOOT, "RTA will be given ID %d\n",entry+1); + ** Check for a SLOT_IN_USE entry for this RTA attached to the + ** current host card in the driver table. + ** + ** If it exists, make a note that we have booted it. Other parts of + ** the driver are interested in this information at a later date, + ** in particular when the booting RTA asks for an ID for this unit, + ** we must have set the BOOTED flag, and the NEWBOOT flag is used + ** to force an open on any ports that where previously open on this + ** unit. + */ + for (entry = 0; entry < MAX_RUP; entry++) { + unsigned int sysport; + + if ((HostP->Mapping[entry].Flags & SLOT_IN_USE) && (HostP->Mapping[entry].RtaUniqueNum == RtaUniq)) { + HostP->Mapping[entry].Flags |= RTA_BOOTED | RTA_NEWBOOT; + if ((sysport = HostP->Mapping[entry].SysPort) != NO_PORT) { + if (sysport < p->RIOFirstPortsBooted) + p->RIOFirstPortsBooted = sysport; + if (sysport > p->RIOLastPortsBooted) + p->RIOLastPortsBooted = sysport; + /* + ** For a 16 port RTA, check the second bank of 8 ports + */ + if (RtaType == TYPE_RTA16) { + entry2 = HostP->Mapping[entry].ID2 - 1; + HostP->Mapping[entry2].Flags |= RTA_BOOTED | RTA_NEWBOOT; + sysport = HostP->Mapping[entry2].SysPort; + if (sysport < p->RIOFirstPortsBooted) + p->RIOFirstPortsBooted = sysport; + if (sysport > p->RIOLastPortsBooted) + p->RIOLastPortsBooted = sysport; + } + } + if (RtaType == TYPE_RTA16) + rio_dprintk(RIO_DEBUG_BOOT, "RTA will be given IDs %d+%d\n", entry + 1, entry2 + 1); + else + rio_dprintk(RIO_DEBUG_BOOT, "RTA will be given ID %d\n", entry + 1); + return 1; } - return TRUE; - } } - rio_dprintk (RIO_DEBUG_BOOT, "RTA not configured for this host\n"); + rio_dprintk(RIO_DEBUG_BOOT, "RTA not configured for this host\n"); - if ( Rup >= (ushort)MAX_RUP ) - { - /* - ** It was a host that did the booting - */ - MyType = "Host"; - MyName = HostP->Name; - } - else - { - /* - ** It was an RTA that did the booting - */ - MyType = "RTA"; - MyName = HostP->Mapping[Rup].Name; + if (Rup >= (unsigned short) MAX_RUP) { + /* + ** It was a host that did the booting + */ + MyType = "Host"; + MyName = HostP->Name; + } else { + /* + ** It was an RTA that did the booting + */ + MyType = "RTA"; + MyName = HostP->Mapping[Rup].Name; } - MyLink = RBYTE(PktCmdP->LinkNum); + MyLink = readb(&PktCmdP->LinkNum); /* - ** There is no SLOT_IN_USE entry for this RTA attached to the current - ** host card in the driver table. - ** - ** Check for a SLOT_TENTATIVE entry for this RTA attached to the - ** current host card in the driver table. - ** - ** If we find one, then we re-use that slot. - */ - for ( entry=0; entry<MAX_RUP; entry++ ) - { - if ( (HostP->Mapping[entry].Flags & SLOT_TENTATIVE) && - (HostP->Mapping[entry].RtaUniqueNum == RtaUniq) ) - { - if (RtaType == TYPE_RTA16) - { - entry2 = HostP->Mapping[entry].ID2 - 1; - if ( (HostP->Mapping[entry2].Flags & SLOT_TENTATIVE) && - (HostP->Mapping[entry2].RtaUniqueNum == RtaUniq) ) - rio_dprintk (RIO_DEBUG_BOOT, "Found previous tentative slots (%d+%d)\n", - entry, entry2); - else - continue; + ** There is no SLOT_IN_USE entry for this RTA attached to the current + ** host card in the driver table. + ** + ** Check for a SLOT_TENTATIVE entry for this RTA attached to the + ** current host card in the driver table. + ** + ** If we find one, then we re-use that slot. + */ + for (entry = 0; entry < MAX_RUP; entry++) { + if ((HostP->Mapping[entry].Flags & SLOT_TENTATIVE) && (HostP->Mapping[entry].RtaUniqueNum == RtaUniq)) { + if (RtaType == TYPE_RTA16) { + entry2 = HostP->Mapping[entry].ID2 - 1; + if ((HostP->Mapping[entry2].Flags & SLOT_TENTATIVE) && (HostP->Mapping[entry2].RtaUniqueNum == RtaUniq)) + rio_dprintk(RIO_DEBUG_BOOT, "Found previous tentative slots (%d+%d)\n", entry, entry2); + else + continue; + } else + rio_dprintk(RIO_DEBUG_BOOT, "Found previous tentative slot (%d)\n", entry); + if (!p->RIONoMessage) + printk("RTA connected to %s '%s' (%c) not configured.\n", MyType, MyName, MyLink + 'A'); + return 1; } - else - rio_dprintk (RIO_DEBUG_BOOT, "Found previous tentative slot (%d)\n",entry); - if (! p->RIONoMessage) - cprintf("RTA connected to %s '%s' (%c) not configured.\n",MyType,MyName,MyLink+'A'); - return TRUE; - } } /* - ** There is no SLOT_IN_USE or SLOT_TENTATIVE entry for this RTA - ** attached to the current host card in the driver table. - ** - ** Check if there is a SLOT_IN_USE or SLOT_TENTATIVE entry on another - ** host for this RTA in the driver table. - ** - ** For a SLOT_IN_USE entry on another host, we need to delete the RTA - ** entry from the other host and add it to this host (using some of - ** the functions from table.c which do this). - ** For a SLOT_TENTATIVE entry on another host, we must cope with the - ** following scenario: - ** - ** + Plug 8 port RTA into host A. (This creates SLOT_TENTATIVE entry - ** in table) - ** + Unplug RTA and plug into host B. (We now have 2 SLOT_TENTATIVE - ** entries) - ** + Configure RTA on host B. (This slot now becomes SLOT_IN_USE) - ** + Unplug RTA and plug back into host A. - ** + Configure RTA on host A. We now have the same RTA configured - ** with different ports on two different hosts. - */ - rio_dprintk (RIO_DEBUG_BOOT, "Have we seen RTA %x before?\n", RtaUniq ); + ** There is no SLOT_IN_USE or SLOT_TENTATIVE entry for this RTA + ** attached to the current host card in the driver table. + ** + ** Check if there is a SLOT_IN_USE or SLOT_TENTATIVE entry on another + ** host for this RTA in the driver table. + ** + ** For a SLOT_IN_USE entry on another host, we need to delete the RTA + ** entry from the other host and add it to this host (using some of + ** the functions from table.c which do this). + ** For a SLOT_TENTATIVE entry on another host, we must cope with the + ** following scenario: + ** + ** + Plug 8 port RTA into host A. (This creates SLOT_TENTATIVE entry + ** in table) + ** + Unplug RTA and plug into host B. (We now have 2 SLOT_TENTATIVE + ** entries) + ** + Configure RTA on host B. (This slot now becomes SLOT_IN_USE) + ** + Unplug RTA and plug back into host A. + ** + Configure RTA on host A. We now have the same RTA configured + ** with different ports on two different hosts. + */ + rio_dprintk(RIO_DEBUG_BOOT, "Have we seen RTA %x before?\n", RtaUniq); found = 0; - Flag = 0; /* Convince the compiler this variable is initialized */ - for ( host = 0; !found && (host < p->RIONumHosts); host++ ) - { - for ( rta=0; rta<MAX_RUP; rta++ ) - { - if ((p->RIOHosts[host].Mapping[rta].Flags & - (SLOT_IN_USE | SLOT_TENTATIVE)) && - (p->RIOHosts[host].Mapping[rta].RtaUniqueNum==RtaUniq)) - { - Flag = p->RIOHosts[host].Mapping[rta].Flags; - MapP = &p->RIOHosts[host].Mapping[rta]; - if (RtaType == TYPE_RTA16) - { - MapP2 = &p->RIOHosts[host].Mapping[MapP->ID2 - 1]; - rio_dprintk (RIO_DEBUG_BOOT, "This RTA is units %d+%d from host %s\n", - rta+1, MapP->ID2, p->RIOHosts[host].Name); - } - else - rio_dprintk (RIO_DEBUG_BOOT, "This RTA is unit %d from host %s\n", - rta+1, p->RIOHosts[host].Name); - found = 1; - break; + Flag = 0; /* Convince the compiler this variable is initialized */ + for (host = 0; !found && (host < p->RIONumHosts); host++) { + for (rta = 0; rta < MAX_RUP; rta++) { + if ((p->RIOHosts[host].Mapping[rta].Flags & (SLOT_IN_USE | SLOT_TENTATIVE)) && (p->RIOHosts[host].Mapping[rta].RtaUniqueNum == RtaUniq)) { + Flag = p->RIOHosts[host].Mapping[rta].Flags; + MapP = &p->RIOHosts[host].Mapping[rta]; + if (RtaType == TYPE_RTA16) { + MapP2 = &p->RIOHosts[host].Mapping[MapP->ID2 - 1]; + rio_dprintk(RIO_DEBUG_BOOT, "This RTA is units %d+%d from host %s\n", rta + 1, MapP->ID2, p->RIOHosts[host].Name); + } else + rio_dprintk(RIO_DEBUG_BOOT, "This RTA is unit %d from host %s\n", rta + 1, p->RIOHosts[host].Name); + found = 1; + break; + } } - } } /* - ** There is no SLOT_IN_USE or SLOT_TENTATIVE entry for this RTA - ** attached to the current host card in the driver table. - ** - ** If we have not found a SLOT_IN_USE or SLOT_TENTATIVE entry on - ** another host for this RTA in the driver table... - ** - ** Check for a SLOT_IN_USE entry for this RTA in the config table. - */ - if ( !MapP ) - { - rio_dprintk (RIO_DEBUG_BOOT, "Look for RTA %x in RIOSavedTable\n",RtaUniq); - for ( rta=0; rta < TOTAL_MAP_ENTRIES; rta++ ) - { - rio_dprintk (RIO_DEBUG_BOOT, "Check table entry %d (%x)", - rta, - p->RIOSavedTable[rta].RtaUniqueNum); - - if ( (p->RIOSavedTable[rta].Flags & SLOT_IN_USE) && - (p->RIOSavedTable[rta].RtaUniqueNum == RtaUniq) ) - { - MapP = &p->RIOSavedTable[rta]; - Flag = p->RIOSavedTable[rta].Flags; - if (RtaType == TYPE_RTA16) - { - for (entry2 = rta + 1; entry2 < TOTAL_MAP_ENTRIES; - entry2++) - { - if (p->RIOSavedTable[entry2].RtaUniqueNum == RtaUniq) - break; - } - MapP2 = &p->RIOSavedTable[entry2]; - rio_dprintk (RIO_DEBUG_BOOT, "This RTA is from table entries %d+%d\n", - rta, entry2); - } - else - rio_dprintk (RIO_DEBUG_BOOT, "This RTA is from table entry %d\n", rta); - break; + ** There is no SLOT_IN_USE or SLOT_TENTATIVE entry for this RTA + ** attached to the current host card in the driver table. + ** + ** If we have not found a SLOT_IN_USE or SLOT_TENTATIVE entry on + ** another host for this RTA in the driver table... + ** + ** Check for a SLOT_IN_USE entry for this RTA in the config table. + */ + if (!MapP) { + rio_dprintk(RIO_DEBUG_BOOT, "Look for RTA %x in RIOSavedTable\n", RtaUniq); + for (rta = 0; rta < TOTAL_MAP_ENTRIES; rta++) { + rio_dprintk(RIO_DEBUG_BOOT, "Check table entry %d (%x)", rta, p->RIOSavedTable[rta].RtaUniqueNum); + + if ((p->RIOSavedTable[rta].Flags & SLOT_IN_USE) && (p->RIOSavedTable[rta].RtaUniqueNum == RtaUniq)) { + MapP = &p->RIOSavedTable[rta]; + Flag = p->RIOSavedTable[rta].Flags; + if (RtaType == TYPE_RTA16) { + for (entry2 = rta + 1; entry2 < TOTAL_MAP_ENTRIES; entry2++) { + if (p->RIOSavedTable[entry2].RtaUniqueNum == RtaUniq) + break; + } + MapP2 = &p->RIOSavedTable[entry2]; + rio_dprintk(RIO_DEBUG_BOOT, "This RTA is from table entries %d+%d\n", rta, entry2); + } else + rio_dprintk(RIO_DEBUG_BOOT, "This RTA is from table entry %d\n", rta); + break; + } } - } } /* - ** There is no SLOT_IN_USE or SLOT_TENTATIVE entry for this RTA - ** attached to the current host card in the driver table. - ** - ** We may have found a SLOT_IN_USE entry on another host for this - ** RTA in the config table, or a SLOT_IN_USE or SLOT_TENTATIVE entry - ** on another host for this RTA in the driver table. - ** - ** Check the driver table for room to fit this newly discovered RTA. - ** RIOFindFreeID() first looks for free slots and if it does not - ** find any free slots it will then attempt to oust any - ** tentative entry in the table. - */ + ** There is no SLOT_IN_USE or SLOT_TENTATIVE entry for this RTA + ** attached to the current host card in the driver table. + ** + ** We may have found a SLOT_IN_USE entry on another host for this + ** RTA in the config table, or a SLOT_IN_USE or SLOT_TENTATIVE entry + ** on another host for this RTA in the driver table. + ** + ** Check the driver table for room to fit this newly discovered RTA. + ** RIOFindFreeID() first looks for free slots and if it does not + ** find any free slots it will then attempt to oust any + ** tentative entry in the table. + */ EmptySlot = 1; - if (RtaType == TYPE_RTA16) - { - if (RIOFindFreeID(p, HostP, &entry, &entry2) == 0) - { - RIODefaultName(p, HostP, entry); - FillSlot(entry, entry2, RtaUniq, HostP); - EmptySlot = 0; - } - } - else - { - if (RIOFindFreeID(p, HostP, &entry, NULL) == 0) - { - RIODefaultName(p, HostP, entry); - FillSlot(entry, 0, RtaUniq, HostP); - EmptySlot = 0; - } + if (RtaType == TYPE_RTA16) { + if (RIOFindFreeID(p, HostP, &entry, &entry2) == 0) { + RIODefaultName(p, HostP, entry); + rio_fill_host_slot(entry, entry2, RtaUniq, HostP); + EmptySlot = 0; + } + } else { + if (RIOFindFreeID(p, HostP, &entry, NULL) == 0) { + RIODefaultName(p, HostP, entry); + rio_fill_host_slot(entry, 0, RtaUniq, HostP); + EmptySlot = 0; + } } /* - ** There is no SLOT_IN_USE or SLOT_TENTATIVE entry for this RTA - ** attached to the current host card in the driver table. - ** - ** If we found a SLOT_IN_USE entry on another host for this - ** RTA in the config or driver table, and there are enough free - ** slots in the driver table, then we need to move it over and - ** delete it from the other host. - ** If we found a SLOT_TENTATIVE entry on another host for this - ** RTA in the driver table, just delete the other host entry. - */ - if (EmptySlot == 0) - { - if ( MapP ) - { - if (Flag & SLOT_IN_USE) - { - rio_dprintk (RIO_DEBUG_BOOT, - "This RTA configured on another host - move entry to current host (1)\n"); - HostP->Mapping[entry].SysPort = MapP->SysPort; - CCOPY( MapP->Name, HostP->Mapping[entry].Name, MAX_NAME_LEN ); - HostP->Mapping[entry].Flags = - SLOT_IN_USE | RTA_BOOTED | RTA_NEWBOOT; -#ifdef NEED_TO_FIX - RIO_SV_BROADCAST(HostP->svFlags[entry]); -#endif - RIOReMapPorts( p, HostP, &HostP->Mapping[entry] ); - if ( HostP->Mapping[entry].SysPort < p->RIOFirstPortsBooted ) - p->RIOFirstPortsBooted = HostP->Mapping[entry].SysPort; - if ( HostP->Mapping[entry].SysPort > p->RIOLastPortsBooted ) - p->RIOLastPortsBooted = HostP->Mapping[entry].SysPort; - rio_dprintk (RIO_DEBUG_BOOT, "SysPort %d, Name %s\n",(int)MapP->SysPort,MapP->Name); - } - else - { - rio_dprintk (RIO_DEBUG_BOOT, - "This RTA has a tentative entry on another host - delete that entry (1)\n"); - HostP->Mapping[entry].Flags = - SLOT_TENTATIVE | RTA_BOOTED | RTA_NEWBOOT; -#ifdef NEED_TO_FIX - RIO_SV_BROADCAST(HostP->svFlags[entry]); -#endif - } - if (RtaType == TYPE_RTA16) - { - if (Flag & SLOT_IN_USE) - { - HostP->Mapping[entry2].Flags = SLOT_IN_USE | - RTA_BOOTED | RTA_NEWBOOT | RTA16_SECOND_SLOT; -#ifdef NEED_TO_FIX - RIO_SV_BROADCAST(HostP->svFlags[entry2]); -#endif - HostP->Mapping[entry2].SysPort = MapP2->SysPort; - /* - ** Map second block of ttys for 16 port RTA - */ - RIOReMapPorts( p, HostP, &HostP->Mapping[entry2] ); - if (HostP->Mapping[entry2].SysPort < p->RIOFirstPortsBooted) - p->RIOFirstPortsBooted = HostP->Mapping[entry2].SysPort; - if (HostP->Mapping[entry2].SysPort > p->RIOLastPortsBooted) - p->RIOLastPortsBooted = HostP->Mapping[entry2].SysPort; - rio_dprintk (RIO_DEBUG_BOOT, "SysPort %d, Name %s\n", - (int)HostP->Mapping[entry2].SysPort, - HostP->Mapping[entry].Name); - } - else - HostP->Mapping[entry2].Flags = SLOT_TENTATIVE | - RTA_BOOTED | RTA_NEWBOOT | RTA16_SECOND_SLOT; -#ifdef NEED_TO_FIX - RIO_SV_BROADCAST(HostP->svFlags[entry2]); -#endif - bzero( (caddr_t)MapP2, sizeof(struct Map) ); - } - bzero( (caddr_t)MapP, sizeof(struct Map) ); - if (! p->RIONoMessage) - cprintf("An orphaned RTA has been adopted by %s '%s' (%c).\n",MyType,MyName,MyLink+'A'); - } - else if (! p->RIONoMessage) - cprintf("RTA connected to %s '%s' (%c) not configured.\n",MyType,MyName,MyLink+'A'); - RIOSetChange(p); - return TRUE; + ** There is no SLOT_IN_USE or SLOT_TENTATIVE entry for this RTA + ** attached to the current host card in the driver table. + ** + ** If we found a SLOT_IN_USE entry on another host for this + ** RTA in the config or driver table, and there are enough free + ** slots in the driver table, then we need to move it over and + ** delete it from the other host. + ** If we found a SLOT_TENTATIVE entry on another host for this + ** RTA in the driver table, just delete the other host entry. + */ + if (EmptySlot == 0) { + if (MapP) { + if (Flag & SLOT_IN_USE) { + rio_dprintk(RIO_DEBUG_BOOT, "This RTA configured on another host - move entry to current host (1)\n"); + HostP->Mapping[entry].SysPort = MapP->SysPort; + memcpy(HostP->Mapping[entry].Name, MapP->Name, MAX_NAME_LEN); + HostP->Mapping[entry].Flags = SLOT_IN_USE | RTA_BOOTED | RTA_NEWBOOT; + RIOReMapPorts(p, HostP, &HostP->Mapping[entry]); + if (HostP->Mapping[entry].SysPort < p->RIOFirstPortsBooted) + p->RIOFirstPortsBooted = HostP->Mapping[entry].SysPort; + if (HostP->Mapping[entry].SysPort > p->RIOLastPortsBooted) + p->RIOLastPortsBooted = HostP->Mapping[entry].SysPort; + rio_dprintk(RIO_DEBUG_BOOT, "SysPort %d, Name %s\n", (int) MapP->SysPort, MapP->Name); + } else { + rio_dprintk(RIO_DEBUG_BOOT, "This RTA has a tentative entry on another host - delete that entry (1)\n"); + HostP->Mapping[entry].Flags = SLOT_TENTATIVE | RTA_BOOTED | RTA_NEWBOOT; + } + if (RtaType == TYPE_RTA16) { + if (Flag & SLOT_IN_USE) { + HostP->Mapping[entry2].Flags = SLOT_IN_USE | RTA_BOOTED | RTA_NEWBOOT | RTA16_SECOND_SLOT; + HostP->Mapping[entry2].SysPort = MapP2->SysPort; + /* + ** Map second block of ttys for 16 port RTA + */ + RIOReMapPorts(p, HostP, &HostP->Mapping[entry2]); + if (HostP->Mapping[entry2].SysPort < p->RIOFirstPortsBooted) + p->RIOFirstPortsBooted = HostP->Mapping[entry2].SysPort; + if (HostP->Mapping[entry2].SysPort > p->RIOLastPortsBooted) + p->RIOLastPortsBooted = HostP->Mapping[entry2].SysPort; + rio_dprintk(RIO_DEBUG_BOOT, "SysPort %d, Name %s\n", (int) HostP->Mapping[entry2].SysPort, HostP->Mapping[entry].Name); + } else + HostP->Mapping[entry2].Flags = SLOT_TENTATIVE | RTA_BOOTED | RTA_NEWBOOT | RTA16_SECOND_SLOT; + memset(MapP2, 0, sizeof(struct Map)); + } + memset(MapP, 0, sizeof(struct Map)); + if (!p->RIONoMessage) + printk("An orphaned RTA has been adopted by %s '%s' (%c).\n", MyType, MyName, MyLink + 'A'); + } else if (!p->RIONoMessage) + printk("RTA connected to %s '%s' (%c) not configured.\n", MyType, MyName, MyLink + 'A'); + RIOSetChange(p); + return 1; } /* - ** There is no room in the driver table to make an entry for the - ** booted RTA. Keep a note of its Uniq Num in the overflow table, - ** so we can ignore it's ID requests. - */ - if (! p->RIONoMessage) - cprintf("The RTA connected to %s '%s' (%c) cannot be configured. You cannot configure more than 128 ports to one host card.\n",MyType,MyName,MyLink+'A'); - for ( entry=0; entry<HostP->NumExtraBooted; entry++ ) - { - if ( HostP->ExtraUnits[entry] == RtaUniq ) - { - /* - ** already got it! - */ - return TRUE; - } + ** There is no room in the driver table to make an entry for the + ** booted RTA. Keep a note of its Uniq Num in the overflow table, + ** so we can ignore it's ID requests. + */ + if (!p->RIONoMessage) + printk("The RTA connected to %s '%s' (%c) cannot be configured. You cannot configure more than 128 ports to one host card.\n", MyType, MyName, MyLink + 'A'); + for (entry = 0; entry < HostP->NumExtraBooted; entry++) { + if (HostP->ExtraUnits[entry] == RtaUniq) { + /* + ** already got it! + */ + return 1; + } } /* - ** If there is room, add the unit to the list of extras - */ - if ( HostP->NumExtraBooted < MAX_EXTRA_UNITS ) - HostP->ExtraUnits[HostP->NumExtraBooted++] = RtaUniq; - return TRUE; + ** If there is room, add the unit to the list of extras + */ + if (HostP->NumExtraBooted < MAX_EXTRA_UNITS) + HostP->ExtraUnits[HostP->NumExtraBooted++] = RtaUniq; + return 1; } /* ** If the RTA or its host appears in the RIOBindTab[] structure then -** we mustn't boot the RTA and should return FALSE. +** we mustn't boot the RTA and should return 0. ** This operation is slightly different from the other drivers for RIO ** in that this is designed to work with the new utilities ** not config.rio and is FAR SIMPLER. ** We no longer support the RIOBootMode variable. It is all done from the ** "boot/noboot" field in the rio.cf file. */ -int -RIOBootOk(p, HostP, RtaUniq) -struct rio_info * p; -struct Host * HostP; -ulong RtaUniq; +int RIOBootOk(struct rio_info *p, struct Host *HostP, unsigned long RtaUniq) { - int Entry; - uint HostUniq = HostP->UniqueNum; + int Entry; + unsigned int HostUniq = HostP->UniqueNum; /* - ** Search bindings table for RTA or its parent. - ** If it exists, return 0, else 1. - */ - for (Entry = 0; - ( Entry < MAX_RTA_BINDINGS ) && ( p->RIOBindTab[Entry] != 0 ); - Entry++) - { - if ( (p->RIOBindTab[Entry] == HostUniq) || - (p->RIOBindTab[Entry] == RtaUniq) ) + ** Search bindings table for RTA or its parent. + ** If it exists, return 0, else 1. + */ + for (Entry = 0; (Entry < MAX_RTA_BINDINGS) && (p->RIOBindTab[Entry] != 0); Entry++) { + if ((p->RIOBindTab[Entry] == HostUniq) || (p->RIOBindTab[Entry] == RtaUniq)) return 0; } return 1; @@ -1255,45 +1076,38 @@ ulong RtaUniq; ** slots tentative, and the second one RTA_SECOND_SLOT as well. */ -void -FillSlot(entry, entry2, RtaUniq, HostP) -int entry; -int entry2; -uint RtaUniq; -struct Host *HostP; +void rio_fill_host_slot(int entry, int entry2, unsigned int rta_uniq, struct Host *host) { - int link; + int link; - rio_dprintk (RIO_DEBUG_BOOT, "FillSlot(%d, %d, 0x%x...)\n", entry, entry2, RtaUniq); + rio_dprintk(RIO_DEBUG_BOOT, "rio_fill_host_slot(%d, %d, 0x%x...)\n", entry, entry2, rta_uniq); - HostP->Mapping[entry].Flags = (RTA_BOOTED | RTA_NEWBOOT | SLOT_TENTATIVE); - HostP->Mapping[entry].SysPort = NO_PORT; - HostP->Mapping[entry].RtaUniqueNum = RtaUniq; - HostP->Mapping[entry].HostUniqueNum = HostP->UniqueNum; - HostP->Mapping[entry].ID = entry + 1; - HostP->Mapping[entry].ID2 = 0; + host->Mapping[entry].Flags = (RTA_BOOTED | RTA_NEWBOOT | SLOT_TENTATIVE); + host->Mapping[entry].SysPort = NO_PORT; + host->Mapping[entry].RtaUniqueNum = rta_uniq; + host->Mapping[entry].HostUniqueNum = host->UniqueNum; + host->Mapping[entry].ID = entry + 1; + host->Mapping[entry].ID2 = 0; if (entry2) { - HostP->Mapping[entry2].Flags = (RTA_BOOTED | RTA_NEWBOOT | - SLOT_TENTATIVE | RTA16_SECOND_SLOT); - HostP->Mapping[entry2].SysPort = NO_PORT; - HostP->Mapping[entry2].RtaUniqueNum = RtaUniq; - HostP->Mapping[entry2].HostUniqueNum = HostP->UniqueNum; - HostP->Mapping[entry2].Name[0] = '\0'; - HostP->Mapping[entry2].ID = entry2 + 1; - HostP->Mapping[entry2].ID2 = entry + 1; - HostP->Mapping[entry].ID2 = entry2 + 1; + host->Mapping[entry2].Flags = (RTA_BOOTED | RTA_NEWBOOT | SLOT_TENTATIVE | RTA16_SECOND_SLOT); + host->Mapping[entry2].SysPort = NO_PORT; + host->Mapping[entry2].RtaUniqueNum = rta_uniq; + host->Mapping[entry2].HostUniqueNum = host->UniqueNum; + host->Mapping[entry2].Name[0] = '\0'; + host->Mapping[entry2].ID = entry2 + 1; + host->Mapping[entry2].ID2 = entry + 1; + host->Mapping[entry].ID2 = entry2 + 1; } /* - ** Must set these up, so that utilities show - ** topology of 16 port RTAs correctly - */ - for ( link=0; link<LINKS_PER_UNIT; link++ ) { - HostP->Mapping[entry].Topology[link].Unit = ROUTE_DISCONNECT; - HostP->Mapping[entry].Topology[link].Link = NO_LINK; + ** Must set these up, so that utilities show + ** topology of 16 port RTAs correctly + */ + for (link = 0; link < LINKS_PER_UNIT; link++) { + host->Mapping[entry].Topology[link].Unit = ROUTE_DISCONNECT; + host->Mapping[entry].Topology[link].Link = NO_LINK; if (entry2) { - HostP->Mapping[entry2].Topology[link].Unit = ROUTE_DISCONNECT; - HostP->Mapping[entry2].Topology[link].Link = NO_LINK; + host->Mapping[entry2].Topology[link].Unit = ROUTE_DISCONNECT; + host->Mapping[entry2].Topology[link].Link = NO_LINK; } } } - diff --git a/drivers/char/rio/riocmd.c b/drivers/char/rio/riocmd.c index 694bfb9d937..e6d2b14b5e6 100644 --- a/drivers/char/rio/riocmd.c +++ b/drivers/char/rio/riocmd.c @@ -42,6 +42,7 @@ static char *_riocmd_c_sccs_ = "@(#)riocmd.c 1.2"; #include <asm/system.h> #include <asm/string.h> #include <asm/semaphore.h> +#include <asm/uaccess.h> #include <linux/termios.h> #include <linux/serial.h> @@ -50,15 +51,12 @@ static char *_riocmd_c_sccs_ = "@(#)riocmd.c 1.2"; #include "linux_compat.h" #include "rio_linux.h" -#include "typdef.h" #include "pkt.h" #include "daemon.h" #include "rio.h" #include "riospace.h" -#include "top.h" #include "cmdpkt.h" #include "map.h" -#include "riotypes.h" #include "rup.h" #include "port.h" #include "riodrvr.h" @@ -71,12 +69,10 @@ static char *_riocmd_c_sccs_ = "@(#)riocmd.c 1.2"; #include "unixrup.h" #include "board.h" #include "host.h" -#include "error.h" #include "phb.h" #include "link.h" #include "cmdblk.h" #include "route.h" -#include "control.h" #include "cirrus.h" @@ -143,17 +139,17 @@ int RIOZombieRta(struct Host *HostP, struct Map *MapP) return 0; } -int RIOCommandRta(struct rio_info *p, uint RtaUnique, int (*func) (struct Host * HostP, struct Map * MapP)) +int RIOCommandRta(struct rio_info *p, unsigned long RtaUnique, int (*func) (struct Host * HostP, struct Map * MapP)) { - uint Host; + unsigned int Host; - rio_dprintk(RIO_DEBUG_CMD, "Command RTA 0x%x func 0x%x\n", RtaUnique, (int) func); + rio_dprintk(RIO_DEBUG_CMD, "Command RTA 0x%lx func %p\n", RtaUnique, func); if (!RtaUnique) return (0); for (Host = 0; Host < p->RIONumHosts; Host++) { - uint Rta; + unsigned int Rta; struct Host *HostP = &p->RIOHosts[Host]; for (Rta = 0; Rta < RTAS_PER_HOST; Rta++) { @@ -170,7 +166,7 @@ int RIOCommandRta(struct rio_info *p, uint RtaUnique, int (*func) (struct Host * ** any connections, we can get to it. */ for (Link = 0; Link < LINKS_PER_UNIT; Link++) { - if (MapP->Topology[Link].Unit <= (uchar) MAX_RUP) { + if (MapP->Topology[Link].Unit <= (u8) MAX_RUP) { /* ** Its worth trying the operation... */ @@ -184,18 +180,18 @@ int RIOCommandRta(struct rio_info *p, uint RtaUnique, int (*func) (struct Host * } -int RIOIdentifyRta(struct rio_info *p, caddr_t arg) +int RIOIdentifyRta(struct rio_info *p, void * arg) { - uint Host; + unsigned int Host; - if (copyin((int) arg, (caddr_t) & IdRta, sizeof(IdRta)) == COPYFAIL) { + if (copy_from_user(&IdRta, arg, sizeof(IdRta))) { rio_dprintk(RIO_DEBUG_CMD, "RIO_IDENTIFY_RTA copy failed\n"); p->RIOError.Error = COPYIN_FAILED; return -EFAULT; } for (Host = 0; Host < p->RIONumHosts; Host++) { - uint Rta; + unsigned int Rta; struct Host *HostP = &p->RIOHosts[Host]; for (Rta = 0; Rta < RTAS_PER_HOST; Rta++) { @@ -211,7 +207,7 @@ int RIOIdentifyRta(struct rio_info *p, caddr_t arg) ** any connections, we can get to it. */ for (Link = 0; Link < LINKS_PER_UNIT; Link++) { - if (MapP->Topology[Link].Unit <= (uchar) MAX_RUP) { + if (MapP->Topology[Link].Unit <= (u8) MAX_RUP) { /* ** Its worth trying the operation... */ @@ -249,7 +245,7 @@ int RIOIdentifyRta(struct rio_info *p, caddr_t arg) } -int RIOKillNeighbour(struct rio_info *p, caddr_t arg) +int RIOKillNeighbour(struct rio_info *p, void * arg) { uint Host; uint ID; @@ -258,7 +254,7 @@ int RIOKillNeighbour(struct rio_info *p, caddr_t arg) rio_dprintk(RIO_DEBUG_CMD, "KILL HOST NEIGHBOUR\n"); - if (copyin((int) arg, (caddr_t) & KillUnit, sizeof(KillUnit)) == COPYFAIL) { + if (copy_from_user(&KillUnit, arg, sizeof(KillUnit))) { rio_dprintk(RIO_DEBUG_CMD, "RIO_KILL_NEIGHBOUR copy failed\n"); p->RIOError.Error = COPYIN_FAILED; return -EFAULT; @@ -344,7 +340,7 @@ int RIOSuspendBootRta(struct Host *HostP, int ID, int Link) int RIOFoadWakeup(struct rio_info *p) { int port; - register struct Port *PortP; + struct Port *PortP; unsigned long flags; for (port = 0; port < RIO_PORTS; port++) { @@ -374,15 +370,15 @@ int RIOFoadWakeup(struct rio_info *p) /* ** Incoming command on the COMMAND_RUP to be processed. */ -static int RIOCommandRup(struct rio_info *p, uint Rup, struct Host *HostP, PKT * PacketP) +static int RIOCommandRup(struct rio_info *p, uint Rup, struct Host *HostP, struct PKT * PacketP) { struct PktCmd *PktCmdP = (struct PktCmd *) PacketP->data; struct Port *PortP; struct UnixRup *UnixRupP; - ushort SysPort; - ushort ReportedModemStatus; - ushort rup; - ushort subCommand; + unsigned short SysPort; + unsigned short ReportedModemStatus; + unsigned short rup; + unsigned short subCommand; unsigned long flags; func_enter(); @@ -395,18 +391,18 @@ static int RIOCommandRup(struct rio_info *p, uint Rup, struct Host *HostP, PKT * ** we can use PhbNum to get the rup number for the appropriate 8 port ** block (for the first block, this should be equal to 'Rup'). */ - rup = RBYTE(PktCmdP->PhbNum) / (ushort) PORTS_PER_RTA; + rup = readb(&PktCmdP->PhbNum) / (unsigned short) PORTS_PER_RTA; UnixRupP = &HostP->UnixRups[rup]; - SysPort = UnixRupP->BaseSysPort + (RBYTE(PktCmdP->PhbNum) % (ushort) PORTS_PER_RTA); + SysPort = UnixRupP->BaseSysPort + (readb(&PktCmdP->PhbNum) % (unsigned short) PORTS_PER_RTA); rio_dprintk(RIO_DEBUG_CMD, "Command on rup %d, port %d\n", rup, SysPort); if (UnixRupP->BaseSysPort == NO_PORT) { rio_dprintk(RIO_DEBUG_CMD, "OBSCURE ERROR!\n"); rio_dprintk(RIO_DEBUG_CMD, "Diagnostics follow. Please WRITE THESE DOWN and report them to Specialix Technical Support\n"); - rio_dprintk(RIO_DEBUG_CMD, "CONTROL information: Host number %d, name ``%s''\n", HostP - p->RIOHosts, HostP->Name); + rio_dprintk(RIO_DEBUG_CMD, "CONTROL information: Host number %Zd, name ``%s''\n", HostP - p->RIOHosts, HostP->Name); rio_dprintk(RIO_DEBUG_CMD, "CONTROL information: Rup number 0x%x\n", rup); - if (Rup >= (ushort) MAX_RUP) { + if (Rup >= (unsigned short) MAX_RUP) { rio_dprintk(RIO_DEBUG_CMD, "CONTROL information: This is the RUP for RTA ``%s''\n", HostP->Mapping[Rup].Name); } else rio_dprintk(RIO_DEBUG_CMD, "CONTROL information: This is the RUP for link ``%c'' of host ``%s''\n", ('A' + Rup - MAX_RUP), HostP->Name); @@ -417,16 +413,16 @@ static int RIOCommandRup(struct rio_info *p, uint Rup, struct Host *HostP, PKT * rio_dprintk(RIO_DEBUG_CMD, "PACKET information: Control 0x%x (%d)\n", PacketP->control, PacketP->control); rio_dprintk(RIO_DEBUG_CMD, "PACKET information: Check 0x%x (%d)\n", PacketP->csum, PacketP->csum); rio_dprintk(RIO_DEBUG_CMD, "COMMAND information: Host Port Number 0x%x, " "Command Code 0x%x\n", PktCmdP->PhbNum, PktCmdP->Command); - return TRUE; + return 1; } PortP = p->RIOPortp[SysPort]; rio_spin_lock_irqsave(&PortP->portSem, flags); - switch (RBYTE(PktCmdP->Command)) { + switch (readb(&PktCmdP->Command)) { case BREAK_RECEIVED: rio_dprintk(RIO_DEBUG_CMD, "Received a break!\n"); /* If the current line disc. is not multi-threading and the current processor is not the default, reset rup_intr - and return FALSE to ensure that the command packet is + and return 0 to ensure that the command packet is not freed. */ /* Call tmgr HANGUP HERE */ /* Fix this later when every thing works !!!! RAMRAJ */ @@ -434,15 +430,15 @@ static int RIOCommandRup(struct rio_info *p, uint Rup, struct Host *HostP, PKT * break; case COMPLETE: - rio_dprintk(RIO_DEBUG_CMD, "Command complete on phb %d host %d\n", RBYTE(PktCmdP->PhbNum), HostP - p->RIOHosts); + rio_dprintk(RIO_DEBUG_CMD, "Command complete on phb %d host %Zd\n", readb(&PktCmdP->PhbNum), HostP - p->RIOHosts); subCommand = 1; - switch (RBYTE(PktCmdP->SubCommand)) { + switch (readb(&PktCmdP->SubCommand)) { case MEMDUMP: - rio_dprintk(RIO_DEBUG_CMD, "Memory dump cmd (0x%x) from addr 0x%x\n", RBYTE(PktCmdP->SubCommand), RWORD(PktCmdP->SubAddr)); + rio_dprintk(RIO_DEBUG_CMD, "Memory dump cmd (0x%x) from addr 0x%x\n", readb(&PktCmdP->SubCommand), readw(&PktCmdP->SubAddr)); break; case READ_REGISTER: - rio_dprintk(RIO_DEBUG_CMD, "Read register (0x%x)\n", RWORD(PktCmdP->SubAddr)); - p->CdRegister = (RBYTE(PktCmdP->ModemStatus) & MSVR1_HOST); + rio_dprintk(RIO_DEBUG_CMD, "Read register (0x%x)\n", readw(&PktCmdP->SubAddr)); + p->CdRegister = (readb(&PktCmdP->ModemStatus) & MSVR1_HOST); break; default: subCommand = 0; @@ -450,10 +446,10 @@ static int RIOCommandRup(struct rio_info *p, uint Rup, struct Host *HostP, PKT * } if (subCommand) break; - rio_dprintk(RIO_DEBUG_CMD, "New status is 0x%x was 0x%x\n", RBYTE(PktCmdP->PortStatus), PortP->PortState); - if (PortP->PortState != RBYTE(PktCmdP->PortStatus)) { + rio_dprintk(RIO_DEBUG_CMD, "New status is 0x%x was 0x%x\n", readb(&PktCmdP->PortStatus), PortP->PortState); + if (PortP->PortState != readb(&PktCmdP->PortStatus)) { rio_dprintk(RIO_DEBUG_CMD, "Mark status & wakeup\n"); - PortP->PortState = RBYTE(PktCmdP->PortStatus); + PortP->PortState = readb(&PktCmdP->PortStatus); /* What should we do here ... wakeup( &PortP->PortState ); */ @@ -467,7 +463,7 @@ static int RIOCommandRup(struct rio_info *p, uint Rup, struct Host *HostP, PKT * ** to the check for modem status change (they're just there because ** it's a convenient place to put them!). */ - ReportedModemStatus = RBYTE(PktCmdP->ModemStatus); + ReportedModemStatus = readb(&PktCmdP->ModemStatus); if ((PortP->ModemState & MSVR1_HOST) == (ReportedModemStatus & MSVR1_HOST)) { rio_dprintk(RIO_DEBUG_CMD, "Modem status unchanged 0x%x\n", PortP->ModemState); /* @@ -514,9 +510,6 @@ static int RIOCommandRup(struct rio_info *p, uint Rup, struct Host *HostP, PKT * */ if (PortP->State & (PORT_ISOPEN | RIO_WOPEN)) wake_up_interruptible(&PortP->gs.open_wait); -#ifdef STATS - PortP->Stat.ModemOnCnt++; -#endif } } else { /* @@ -527,9 +520,6 @@ static int RIOCommandRup(struct rio_info *p, uint Rup, struct Host *HostP, PKT * tty_hangup(PortP->gs.tty); PortP->State &= ~RIO_CARR_ON; rio_dprintk(RIO_DEBUG_CMD, "Carrirer just went down\n"); -#ifdef STATS - PortP->Stat.ModemOffCnt++; -#endif } } } @@ -539,14 +529,14 @@ static int RIOCommandRup(struct rio_info *p, uint Rup, struct Host *HostP, PKT * break; default: - rio_dprintk(RIO_DEBUG_CMD, "Unknown command %d on CMD_RUP of host %d\n", RBYTE(PktCmdP->Command), HostP - p->RIOHosts); + rio_dprintk(RIO_DEBUG_CMD, "Unknown command %d on CMD_RUP of host %Zd\n", readb(&PktCmdP->Command), HostP - p->RIOHosts); break; } rio_spin_unlock_irqrestore(&PortP->portSem, flags); func_exit(); - return TRUE; + return 1; } /* @@ -566,10 +556,9 @@ struct CmdBlk *RIOGetCmdBlk(void) { struct CmdBlk *CmdBlkP; - CmdBlkP = (struct CmdBlk *) sysbrk(sizeof(struct CmdBlk)); + CmdBlkP = (struct CmdBlk *)kmalloc(sizeof(struct CmdBlk), GFP_ATOMIC); if (CmdBlkP) - bzero(CmdBlkP, sizeof(struct CmdBlk)); - + memset(CmdBlkP, 0, sizeof(struct CmdBlk)); return CmdBlkP; } @@ -578,7 +567,7 @@ struct CmdBlk *RIOGetCmdBlk(void) */ void RIOFreeCmdBlk(struct CmdBlk *CmdBlkP) { - sysfree((void *) CmdBlkP, sizeof(struct CmdBlk)); + kfree(CmdBlkP); } /* @@ -591,7 +580,7 @@ int RIOQueueCmdBlk(struct Host *HostP, uint Rup, struct CmdBlk *CmdBlkP) struct UnixRup *UnixRupP; unsigned long flags; - if (Rup >= (ushort) (MAX_RUP + LINKS_PER_UNIT)) { + if (Rup >= (unsigned short) (MAX_RUP + LINKS_PER_UNIT)) { rio_dprintk(RIO_DEBUG_CMD, "Illegal rup number %d in RIOQueueCmdBlk\n", Rup); RIOFreeCmdBlk(CmdBlkP); return RIO_FAIL; @@ -605,14 +594,14 @@ int RIOQueueCmdBlk(struct Host *HostP, uint Rup, struct CmdBlk *CmdBlkP) ** If the RUP is currently inactive, then put the request ** straight on the RUP.... */ - if ((UnixRupP->CmdsWaitingP == NULL) && (UnixRupP->CmdPendingP == NULL) && (RWORD(UnixRupP->RupP->txcontrol) == TX_RUP_INACTIVE) && (CmdBlkP->PreFuncP ? (*CmdBlkP->PreFuncP) (CmdBlkP->PreArg, CmdBlkP) - : TRUE)) { + if ((UnixRupP->CmdsWaitingP == NULL) && (UnixRupP->CmdPendingP == NULL) && (readw(&UnixRupP->RupP->txcontrol) == TX_RUP_INACTIVE) && (CmdBlkP->PreFuncP ? (*CmdBlkP->PreFuncP) (CmdBlkP->PreArg, CmdBlkP) + : 1)) { rio_dprintk(RIO_DEBUG_CMD, "RUP inactive-placing command straight on. Cmd byte is 0x%x\n", CmdBlkP->Packet.data[0]); /* ** Whammy! blat that pack! */ - HostP->Copy((caddr_t) & CmdBlkP->Packet, RIO_PTR(HostP->Caddr, UnixRupP->RupP->txpkt), sizeof(PKT)); + HostP->Copy((caddr_t) & CmdBlkP->Packet, RIO_PTR(HostP->Caddr, UnixRupP->RupP->txpkt), sizeof(struct PKT)); /* ** place command packet on the pending position. @@ -622,11 +611,11 @@ int RIOQueueCmdBlk(struct Host *HostP, uint Rup, struct CmdBlk *CmdBlkP) /* ** set the command register */ - WWORD(UnixRupP->RupP->txcontrol, TX_PACKET_READY); + writew(TX_PACKET_READY, &UnixRupP->RupP->txcontrol); rio_spin_unlock_irqrestore(&UnixRupP->RupLock, flags); - return RIO_SUCCESS; + return 0; } rio_dprintk(RIO_DEBUG_CMD, "RUP active - en-queing\n"); @@ -634,20 +623,20 @@ int RIOQueueCmdBlk(struct Host *HostP, uint Rup, struct CmdBlk *CmdBlkP) rio_dprintk(RIO_DEBUG_CMD, "Rup active - command waiting\n"); if (UnixRupP->CmdPendingP != NULL) rio_dprintk(RIO_DEBUG_CMD, "Rup active - command pending\n"); - if (RWORD(UnixRupP->RupP->txcontrol) != TX_RUP_INACTIVE) + if (readw(&UnixRupP->RupP->txcontrol) != TX_RUP_INACTIVE) rio_dprintk(RIO_DEBUG_CMD, "Rup active - command rup not ready\n"); Base = &UnixRupP->CmdsWaitingP; - rio_dprintk(RIO_DEBUG_CMD, "First try to queue cmdblk 0x%x at 0x%x\n", (int) CmdBlkP, (int) Base); + rio_dprintk(RIO_DEBUG_CMD, "First try to queue cmdblk %p at %p\n", CmdBlkP, Base); while (*Base) { - rio_dprintk(RIO_DEBUG_CMD, "Command cmdblk 0x%x here\n", (int) (*Base)); + rio_dprintk(RIO_DEBUG_CMD, "Command cmdblk %p here\n", *Base); Base = &((*Base)->NextP); - rio_dprintk(RIO_DEBUG_CMD, "Now try to queue cmd cmdblk 0x%x at 0x%x\n", (int) CmdBlkP, (int) Base); + rio_dprintk(RIO_DEBUG_CMD, "Now try to queue cmd cmdblk %p at %p\n", CmdBlkP, Base); } - rio_dprintk(RIO_DEBUG_CMD, "Will queue cmdblk 0x%x at 0x%x\n", (int) CmdBlkP, (int) Base); + rio_dprintk(RIO_DEBUG_CMD, "Will queue cmdblk %p at %p\n", CmdBlkP, Base); *Base = CmdBlkP; @@ -655,7 +644,7 @@ int RIOQueueCmdBlk(struct Host *HostP, uint Rup, struct CmdBlk *CmdBlkP) rio_spin_unlock_irqrestore(&UnixRupP->RupLock, flags); - return RIO_SUCCESS; + return 0; } /* @@ -664,10 +653,10 @@ int RIOQueueCmdBlk(struct Host *HostP, uint Rup, struct CmdBlk *CmdBlkP) */ void RIOPollHostCommands(struct rio_info *p, struct Host *HostP) { - register struct CmdBlk *CmdBlkP; - register struct UnixRup *UnixRupP; + struct CmdBlk *CmdBlkP; + struct UnixRup *UnixRupP; struct PKT *PacketP; - ushort Rup; + unsigned short Rup; unsigned long flags; @@ -684,16 +673,14 @@ void RIOPollHostCommands(struct rio_info *p, struct Host *HostP) /* ** First check for incoming commands: */ - if (RWORD(UnixRupP->RupP->rxcontrol) != RX_RUP_INACTIVE) { + if (readw(&UnixRupP->RupP->rxcontrol) != RX_RUP_INACTIVE) { int FreeMe; - PacketP = (PKT *) RIO_PTR(HostP->Caddr, RWORD(UnixRupP->RupP->rxpkt)); + PacketP = (struct PKT *) RIO_PTR(HostP->Caddr, readw(&UnixRupP->RupP->rxpkt)); - ShowPacket(DBG_CMD, PacketP); - - switch (RBYTE(PacketP->dest_port)) { + switch (readb(&PacketP->dest_port)) { case BOOT_RUP: - rio_dprintk(RIO_DEBUG_CMD, "Incoming Boot %s packet '%x'\n", RBYTE(PacketP->len) & 0x80 ? "Command" : "Data", RBYTE(PacketP->data[0])); + rio_dprintk(RIO_DEBUG_CMD, "Incoming Boot %s packet '%x'\n", readb(&PacketP->len) & 0x80 ? "Command" : "Data", readb(&PacketP->data[0])); rio_spin_unlock_irqrestore(&UnixRupP->RupLock, flags); FreeMe = RIOBootRup(p, Rup, HostP, PacketP); rio_spin_lock_irqsave(&UnixRupP->RupLock, flags); @@ -708,7 +695,7 @@ void RIOPollHostCommands(struct rio_info *p, struct Host *HostP) rio_spin_unlock_irqrestore(&UnixRupP->RupLock, flags); FreeMe = RIOCommandRup(p, Rup, HostP, PacketP); if (PacketP->data[5] == MEMDUMP) { - rio_dprintk(RIO_DEBUG_CMD, "Memdump from 0x%x complete\n", *(ushort *) & (PacketP->data[6])); + rio_dprintk(RIO_DEBUG_CMD, "Memdump from 0x%x complete\n", *(unsigned short *) & (PacketP->data[6])); HostP->Copy((caddr_t) & (PacketP->data[8]), (caddr_t) p->RIOMemDump, 32); } rio_spin_lock_irqsave(&UnixRupP->RupLock, flags); @@ -721,7 +708,7 @@ void RIOPollHostCommands(struct rio_info *p, struct Host *HostP) break; default: - rio_dprintk(RIO_DEBUG_CMD, "Unknown RUP %d\n", RBYTE(PacketP->dest_port)); + rio_dprintk(RIO_DEBUG_CMD, "Unknown RUP %d\n", readb(&PacketP->dest_port)); FreeMe = 1; break; } @@ -730,11 +717,11 @@ void RIOPollHostCommands(struct rio_info *p, struct Host *HostP) rio_dprintk(RIO_DEBUG_CMD, "Free processed incoming command packet\n"); put_free_end(HostP, PacketP); - WWORD(UnixRupP->RupP->rxcontrol, RX_RUP_INACTIVE); + writew(RX_RUP_INACTIVE, &UnixRupP->RupP->rxcontrol); - if (RWORD(UnixRupP->RupP->handshake) == PHB_HANDSHAKE_SET) { + if (readw(&UnixRupP->RupP->handshake) == PHB_HANDSHAKE_SET) { rio_dprintk(RIO_DEBUG_CMD, "Handshake rup %d\n", Rup); - WWORD(UnixRupP->RupP->handshake, PHB_HANDSHAKE_SET | PHB_HANDSHAKE_RESET); + writew(PHB_HANDSHAKE_SET | PHB_HANDSHAKE_RESET, &UnixRupP->RupP->handshake); } } } @@ -744,7 +731,7 @@ void RIOPollHostCommands(struct rio_info *p, struct Host *HostP) ** and it has completed, then tidy it up. */ if ((CmdBlkP = UnixRupP->CmdPendingP) && /* ASSIGN! */ - (RWORD(UnixRupP->RupP->txcontrol) == TX_RUP_INACTIVE)) { + (readw(&UnixRupP->RupP->txcontrol) == TX_RUP_INACTIVE)) { /* ** we are idle. ** there is a command in pending. @@ -755,7 +742,7 @@ void RIOPollHostCommands(struct rio_info *p, struct Host *HostP) if (CmdBlkP->Packet.dest_port == BOOT_RUP) rio_dprintk(RIO_DEBUG_CMD, "Free Boot %s Command Block '%x'\n", CmdBlkP->Packet.len & 0x80 ? "Command" : "Data", CmdBlkP->Packet.data[0]); - rio_dprintk(RIO_DEBUG_CMD, "Command 0x%x completed\n", (int) CmdBlkP); + rio_dprintk(RIO_DEBUG_CMD, "Command %p completed\n", CmdBlkP); /* ** Clear the Rup lock to prevent mutual exclusion. @@ -782,20 +769,20 @@ void RIOPollHostCommands(struct rio_info *p, struct Host *HostP) ** is idle, then process the command */ if ((CmdBlkP = UnixRupP->CmdsWaitingP) && /* ASSIGN! */ - (UnixRupP->CmdPendingP == NULL) && (RWORD(UnixRupP->RupP->txcontrol) == TX_RUP_INACTIVE)) { + (UnixRupP->CmdPendingP == NULL) && (readw(&UnixRupP->RupP->txcontrol) == TX_RUP_INACTIVE)) { /* ** if the pre-function is non-zero, call it. ** If it returns RIO_FAIL then don't ** send this command yet! */ - if (!(CmdBlkP->PreFuncP ? (*CmdBlkP->PreFuncP) (CmdBlkP->PreArg, CmdBlkP) : TRUE)) { - rio_dprintk(RIO_DEBUG_CMD, "Not ready to start command 0x%x\n", (int) CmdBlkP); + if (!(CmdBlkP->PreFuncP ? (*CmdBlkP->PreFuncP) (CmdBlkP->PreArg, CmdBlkP) : 1)) { + rio_dprintk(RIO_DEBUG_CMD, "Not ready to start command %p\n", CmdBlkP); } else { - rio_dprintk(RIO_DEBUG_CMD, "Start new command 0x%x Cmd byte is 0x%x\n", (int) CmdBlkP, CmdBlkP->Packet.data[0]); + rio_dprintk(RIO_DEBUG_CMD, "Start new command %p Cmd byte is 0x%x\n", CmdBlkP, CmdBlkP->Packet.data[0]); /* ** Whammy! blat that pack! */ - HostP->Copy((caddr_t) & CmdBlkP->Packet, RIO_PTR(HostP->Caddr, UnixRupP->RupP->txpkt), sizeof(PKT)); + HostP->Copy((caddr_t) & CmdBlkP->Packet, RIO_PTR(HostP->Caddr, UnixRupP->RupP->txpkt), sizeof(struct PKT)); /* ** remove the command from the rup command queue... @@ -810,7 +797,7 @@ void RIOPollHostCommands(struct rio_info *p, struct Host *HostP) /* ** set the command register */ - WWORD(UnixRupP->RupP->txcontrol, TX_PACKET_READY); + writew(TX_PACKET_READY, &UnixRupP->RupP->txcontrol); /* ** the command block will be freed @@ -822,7 +809,7 @@ void RIOPollHostCommands(struct rio_info *p, struct Host *HostP) } while (Rup); } -int RIOWFlushMark(int iPortP, struct CmdBlk *CmdBlkP) +int RIOWFlushMark(unsigned long iPortP, struct CmdBlk *CmdBlkP) { struct Port *PortP = (struct Port *) iPortP; unsigned long flags; @@ -834,33 +821,32 @@ int RIOWFlushMark(int iPortP, struct CmdBlk *CmdBlkP) return RIOUnUse(iPortP, CmdBlkP); } -int RIORFlushEnable(int iPortP, struct CmdBlk *CmdBlkP) +int RIORFlushEnable(unsigned long iPortP, struct CmdBlk *CmdBlkP) { struct Port *PortP = (struct Port *) iPortP; - PKT *PacketP; + struct PKT *PacketP; unsigned long flags; rio_spin_lock_irqsave(&PortP->portSem, flags); while (can_remove_receive(&PacketP, PortP)) { remove_receive(PortP); - ShowPacket(DBG_PROC, PacketP); put_free_end(PortP->HostP, PacketP); } - if (RWORD(PortP->PhbP->handshake) == PHB_HANDSHAKE_SET) { + if (readw(&PortP->PhbP->handshake) == PHB_HANDSHAKE_SET) { /* ** MAGIC! (Basically, handshake the RX buffer, so that ** the RTAs upstream can be re-enabled.) */ rio_dprintk(RIO_DEBUG_CMD, "Util: Set RX handshake bit\n"); - WWORD(PortP->PhbP->handshake, PHB_HANDSHAKE_SET | PHB_HANDSHAKE_RESET); + writew(PHB_HANDSHAKE_SET | PHB_HANDSHAKE_RESET, &PortP->PhbP->handshake); } rio_spin_unlock_irqrestore(&PortP->portSem, flags); return RIOUnUse(iPortP, CmdBlkP); } -int RIOUnUse(int iPortP, struct CmdBlk *CmdBlkP) +int RIOUnUse(unsigned long iPortP, struct CmdBlk *CmdBlkP) { struct Port *PortP = (struct Port *) iPortP; unsigned long flags; @@ -890,7 +876,7 @@ int RIOUnUse(int iPortP, struct CmdBlk *CmdBlkP) ** When PortP->InUse becomes NOT_INUSE, we must ensure that any data ** hanging around in the transmit buffer is sent immediately. */ - WWORD(PortP->HostP->ParmMapP->tx_intr, 1); + writew(1, &PortP->HostP->ParmMapP->tx_intr); /* What to do here .. wakeup( (caddr_t)&(PortP->InUse) ); */ @@ -898,10 +884,6 @@ int RIOUnUse(int iPortP, struct CmdBlk *CmdBlkP) return 0; } -void ShowPacket(uint Flags, struct PKT *PacketP) -{ -} - /* ** ** How to use this file: diff --git a/drivers/char/rio/rioctrl.c b/drivers/char/rio/rioctrl.c index fcf18a06122..d31aba62bb7 100644 --- a/drivers/char/rio/rioctrl.c +++ b/drivers/char/rio/rioctrl.c @@ -51,15 +51,12 @@ static char *_rioctrl_c_sccs_ = "@(#)rioctrl.c 1.3"; #include "linux_compat.h" #include "rio_linux.h" -#include "typdef.h" #include "pkt.h" #include "daemon.h" #include "rio.h" #include "riospace.h" -#include "top.h" #include "cmdpkt.h" #include "map.h" -#include "riotypes.h" #include "rup.h" #include "port.h" #include "riodrvr.h" @@ -72,12 +69,10 @@ static char *_rioctrl_c_sccs_ = "@(#)rioctrl.c 1.3"; #include "unixrup.h" #include "board.h" #include "host.h" -#include "error.h" #include "phb.h" #include "link.h" #include "cmdblk.h" #include "route.h" -#include "control.h" #include "cirrus.h" #include "rioioctl.h" @@ -131,30 +126,6 @@ static int #define drv_makedev(maj, min) ((((uint) maj & 0xff) << 8) | ((uint) min & 0xff)) -int copyin(int arg, caddr_t dp, int siz) -{ - int rv; - - rio_dprintk(RIO_DEBUG_CTRL, "Copying %d bytes from user %p to %p.\n", siz, (void *) arg, dp); - rv = copy_from_user(dp, (void *) arg, siz); - if (rv) - return COPYFAIL; - else - return rv; -} - -static int copyout(caddr_t dp, int arg, int siz) -{ - int rv; - - rio_dprintk(RIO_DEBUG_CTRL, "Copying %d bytes to user %p from %p.\n", siz, (void *) arg, dp); - rv = copy_to_user((void *) arg, dp, siz); - if (rv) - return COPYFAIL; - else - return rv; -} - int riocontrol(p, dev, cmd, arg, su) struct rio_info *p; dev_t dev; @@ -168,7 +139,7 @@ int su; ushort loop; int Entry; struct Port *PortP; - PKT *PacketP; + struct PKT *PacketP; int retval = 0; unsigned long flags; @@ -178,7 +149,7 @@ int su; Host = 0; PortP = NULL; - rio_dprintk(RIO_DEBUG_CTRL, "control ioctl cmd: 0x%x arg: 0x%x\n", cmd, (int) arg); + rio_dprintk(RIO_DEBUG_CTRL, "control ioctl cmd: 0x%x arg: %p\n", cmd, arg); switch (cmd) { /* @@ -189,90 +160,34 @@ int su; ** otherwise just the specified host card will be changed. */ case RIO_SET_TIMER: - rio_dprintk(RIO_DEBUG_CTRL, "RIO_SET_TIMER to %dms\n", (uint) arg); + rio_dprintk(RIO_DEBUG_CTRL, "RIO_SET_TIMER to %ldms\n", (unsigned long)arg); { int host, value; - host = (uint) arg >> 16; - value = (uint) arg & 0x0000ffff; + host = ((unsigned long) arg >> 16) & 0x0000FFFF; + value = (unsigned long) arg & 0x0000ffff; if (host == -1) { for (host = 0; host < p->RIONumHosts; host++) { if (p->RIOHosts[host].Flags == RC_RUNNING) { - WWORD(p->RIOHosts[host].ParmMapP->timer, value); + writew(value, &p->RIOHosts[host].ParmMapP->timer); } } } else if (host >= p->RIONumHosts) { return -EINVAL; } else { if (p->RIOHosts[host].Flags == RC_RUNNING) { - WWORD(p->RIOHosts[host].ParmMapP->timer, value); + writew(value, &p->RIOHosts[host].ParmMapP->timer); } } } return 0; - case RIO_IDENTIFY_DRIVER: - /* - ** 15.10.1998 ARG - ESIL 0760 part fix - ** Added driver ident string output. - ** - #ifndef __THIS_RELEASE__ - #warning Driver Version string not defined ! - #endif - cprintf("%s %s %s %s\n", - RIO_DRV_STR, - __THIS_RELEASE__, - __DATE__, __TIME__ ); - - return 0; - - case RIO_DISPLAY_HOST_CFG: - ** - ** 15.10.1998 ARG - ESIL 0760 part fix - ** Added driver host card ident string output. - ** - ** Note that the only types currently supported - ** are ISA and PCI. Also this driver does not - ** (yet) distinguish between the Old PCI card - ** and the Jet PCI card. In fact I think this - ** driver only supports JET PCI ! - ** - - for (Host = 0; Host < p->RIONumHosts; Host++) - { - HostP = &(p->RIOHosts[Host]); - - switch ( HostP->Type ) - { - case RIO_AT : - strcpy( host_type, RIO_AT_HOST_STR ); - break; - - case RIO_PCI : - strcpy( host_type, RIO_PCI_HOST_STR ); - break; - - default : - strcpy( host_type, "Unknown" ); - break; - } - - cprintf( - "RIO Host %d - Type:%s Addr:%X IRQ:%d\n", - Host, host_type, - (uint)HostP->PaddrP, - (int)HostP->Ivec - 32 ); - } - return 0; - ** - */ - case RIO_FOAD_RTA: rio_dprintk(RIO_DEBUG_CTRL, "RIO_FOAD_RTA\n"); - return RIOCommandRta(p, (uint) arg, RIOFoadRta); + return RIOCommandRta(p, (unsigned long)arg, RIOFoadRta); case RIO_ZOMBIE_RTA: rio_dprintk(RIO_DEBUG_CTRL, "RIO_ZOMBIE_RTA\n"); - return RIOCommandRta(p, (uint) arg, RIOZombieRta); + return RIOCommandRta(p, (unsigned long)arg, RIOZombieRta); case RIO_IDENTIFY_RTA: rio_dprintk(RIO_DEBUG_CTRL, "RIO_IDENTIFY_RTA\n"); @@ -287,7 +202,7 @@ int su; struct CmdBlk *CmdBlkP; rio_dprintk(RIO_DEBUG_CTRL, "SPECIAL_RUP_CMD\n"); - if (copyin((int) arg, (caddr_t) & SpecialRupCmd, sizeof(SpecialRupCmd)) == COPYFAIL) { + if (copy_from_user(&SpecialRupCmd, arg, sizeof(SpecialRupCmd))) { rio_dprintk(RIO_DEBUG_CTRL, "SPECIAL_RUP_CMD copy failed\n"); p->RIOError.Error = COPYIN_FAILED; return -EFAULT; @@ -302,7 +217,7 @@ int su; SpecialRupCmd.Host = 0; rio_dprintk(RIO_DEBUG_CTRL, "Queue special rup command for host %d rup %d\n", SpecialRupCmd.Host, SpecialRupCmd.RupNum); if (RIOQueueCmdBlk(&p->RIOHosts[SpecialRupCmd.Host], SpecialRupCmd.RupNum, CmdBlkP) == RIO_FAIL) { - cprintf("FAILED TO QUEUE SPECIAL RUP COMMAND\n"); + printk(KERN_WARNING "rio: FAILED TO QUEUE SPECIAL RUP COMMAND\n"); } return 0; } @@ -324,7 +239,7 @@ int su; if ((retval = RIOApel(p)) != 0) return retval; - if (copyout((caddr_t) p->RIOConnectTable, (int) arg, TOTAL_MAP_ENTRIES * sizeof(struct Map)) == COPYFAIL) { + if (copy_to_user(arg, p->RIOConnectTable, TOTAL_MAP_ENTRIES * sizeof(struct Map))) { rio_dprintk(RIO_DEBUG_CTRL, "RIO_GET_TABLE copy failed\n"); p->RIOError.Error = COPYOUT_FAILED; return -EFAULT; @@ -369,7 +284,7 @@ int su; p->RIOError.Error = NOT_SUPER_USER; return -EPERM; } - if (copyin((int) arg, (caddr_t) & p->RIOConnectTable[0], TOTAL_MAP_ENTRIES * sizeof(struct Map)) == COPYFAIL) { + if (copy_from_user(&p->RIOConnectTable[0], arg, TOTAL_MAP_ENTRIES * sizeof(struct Map))) { rio_dprintk(RIO_DEBUG_CTRL, "RIO_PUT_TABLE copy failed\n"); p->RIOError.Error = COPYIN_FAILED; return -EFAULT; @@ -415,7 +330,7 @@ int su; p->RIOError.Error = NOT_SUPER_USER; return -EPERM; } - if (copyout((caddr_t) p->RIOBindTab, (int) arg, (sizeof(ulong) * MAX_RTA_BINDINGS)) == COPYFAIL) { + if (copy_to_user(arg, p->RIOBindTab, (sizeof(ulong) * MAX_RTA_BINDINGS))) { rio_dprintk(RIO_DEBUG_CTRL, "RIO_GET_BINDINGS copy failed\n"); p->RIOError.Error = COPYOUT_FAILED; return -EFAULT; @@ -434,7 +349,7 @@ int su; p->RIOError.Error = NOT_SUPER_USER; return -EPERM; } - if (copyin((int) arg, (caddr_t) & p->RIOBindTab[0], (sizeof(ulong) * MAX_RTA_BINDINGS)) == COPYFAIL) { + if (copy_from_user(&p->RIOBindTab[0], arg, (sizeof(ulong) * MAX_RTA_BINDINGS))) { rio_dprintk(RIO_DEBUG_CTRL, "RIO_PUT_BINDINGS copy failed\n"); p->RIOError.Error = COPYIN_FAILED; return -EFAULT; @@ -458,12 +373,12 @@ int su; for (Entry = 0; Entry < MAX_RTA_BINDINGS; Entry++) { if ((EmptySlot == -1) && (p->RIOBindTab[Entry] == 0L)) EmptySlot = Entry; - else if (p->RIOBindTab[Entry] == (int) arg) { + else if (p->RIOBindTab[Entry] == (long)arg) { /* ** Already exists - delete */ p->RIOBindTab[Entry] = 0L; - rio_dprintk(RIO_DEBUG_CTRL, "Removing Rta %x from p->RIOBindTab\n", (int) arg); + rio_dprintk(RIO_DEBUG_CTRL, "Removing Rta %ld from p->RIOBindTab\n", (unsigned long)arg); return 0; } } @@ -471,10 +386,10 @@ int su; ** Dosen't exist - add */ if (EmptySlot != -1) { - p->RIOBindTab[EmptySlot] = (int) arg; - rio_dprintk(RIO_DEBUG_CTRL, "Adding Rta %x to p->RIOBindTab\n", (int) arg); + p->RIOBindTab[EmptySlot] = (unsigned long)arg; + rio_dprintk(RIO_DEBUG_CTRL, "Adding Rta %lx to p->RIOBindTab\n", (unsigned long) arg); } else { - rio_dprintk(RIO_DEBUG_CTRL, "p->RIOBindTab full! - Rta %x not added\n", (int) arg); + rio_dprintk(RIO_DEBUG_CTRL, "p->RIOBindTab full! - Rta %lx not added\n", (unsigned long) arg); return -ENOMEM; } return 0; @@ -482,7 +397,7 @@ int su; case RIO_RESUME: rio_dprintk(RIO_DEBUG_CTRL, "RIO_RESUME\n"); - port = (uint) arg; + port = (unsigned long) arg; if ((port < 0) || (port > 511)) { rio_dprintk(RIO_DEBUG_CTRL, "RIO_RESUME: Bad port number %d\n", port); p->RIOError.Error = PORT_NUMBER_OUT_OF_RANGE; @@ -518,8 +433,7 @@ int su; p->RIOError.Error = NOT_SUPER_USER; return -EPERM; } - if (copyin((int) arg, (caddr_t) & MapEnt, sizeof(MapEnt)) - == COPYFAIL) { + if (copy_from_user(&MapEnt, arg, sizeof(MapEnt))) { rio_dprintk(RIO_DEBUG_CTRL, "Copy from user space failed\n"); p->RIOError.Error = COPYIN_FAILED; return -EFAULT; @@ -533,8 +447,7 @@ int su; p->RIOError.Error = NOT_SUPER_USER; return -EPERM; } - if (copyin((int) arg, (caddr_t) & MapEnt, sizeof(MapEnt)) - == COPYFAIL) { + if (copy_from_user(&MapEnt, arg, sizeof(MapEnt))) { rio_dprintk(RIO_DEBUG_CTRL, "Copy from user space failed\n"); p->RIOError.Error = COPYIN_FAILED; return -EFAULT; @@ -548,8 +461,7 @@ int su; p->RIOError.Error = NOT_SUPER_USER; return -EPERM; } - if (copyin((int) arg, (caddr_t) & MapEnt, sizeof(MapEnt)) - == COPYFAIL) { + if (copy_from_user(&MapEnt, arg, sizeof(MapEnt))) { rio_dprintk(RIO_DEBUG_CTRL, "Copy from data space failed\n"); p->RIOError.Error = COPYIN_FAILED; return -EFAULT; @@ -557,30 +469,14 @@ int su; return RIODeleteRta(p, &MapEnt); case RIO_QUICK_CHECK: - /* - ** 09.12.1998 ARG - ESIL 0776 part fix - ** A customer was using this to get the RTAs - ** connect/disconnect status. - ** RIOConCon() had been botched use RIOHalted - ** to keep track of RTA connections and - ** disconnections. That has been changed and - ** RIORtaDisCons in the rio_info struct now - ** does the job. So we need to return the value - ** of RIORtaCons instead of RIOHalted. - ** - if (copyout((caddr_t)&p->RIOHalted,(int)arg, - sizeof(uint))==COPYFAIL) { - ** - */ - - if (copyout((caddr_t) & p->RIORtaDisCons, (int) arg, sizeof(uint)) == COPYFAIL) { + if (copy_to_user(arg, &p->RIORtaDisCons, sizeof(unsigned int))) { p->RIOError.Error = COPYOUT_FAILED; return -EFAULT; } return 0; case RIO_LAST_ERROR: - if (copyout((caddr_t) & p->RIOError, (int) arg, sizeof(struct Error)) == COPYFAIL) + if (copy_to_user(arg, &p->RIOError, sizeof(struct Error))) return -EFAULT; return 0; @@ -589,7 +485,7 @@ int su; return -EINVAL; case RIO_GET_MODTYPE: - if (copyin((int) arg, (caddr_t) & port, sizeof(uint)) == COPYFAIL) { + if (copy_from_user(&port, arg, sizeof(unsigned int))) { p->RIOError.Error = COPYIN_FAILED; return -EFAULT; } @@ -609,36 +505,11 @@ int su; ** Return module type of port */ port = PortP->HostP->UnixRups[PortP->RupNum].ModTypes; - if (copyout((caddr_t) & port, (int) arg, sizeof(uint)) == COPYFAIL) { + if (copy_to_user(arg, &port, sizeof(unsigned int))) { p->RIOError.Error = COPYOUT_FAILED; return -EFAULT; } return (0); - /* - ** 02.03.1999 ARG - ESIL 0820 fix - ** We are no longer using "Boot Mode", so these ioctls - ** are not required : - ** - case RIO_GET_BOOT_MODE : - rio_dprint(RIO_DEBUG_CTRL, ("Get boot mode - %x\n", p->RIOBootMode)); - ** - ** Return boot state of system - BOOT_ALL, BOOT_OWN or BOOT_NONE - ** - if (copyout((caddr_t)&p->RIOBootMode, (int)arg, - sizeof(p->RIOBootMode)) == COPYFAIL) { - p->RIOError.Error = COPYOUT_FAILED; - return -EFAULT; - } - return(0); - - case RIO_SET_BOOT_MODE : - p->RIOBootMode = (uint) arg; - rio_dprint(RIO_DEBUG_CTRL, ("Set boot mode to 0x%x\n", p->RIOBootMode)); - return(0); - ** - ** End ESIL 0820 fix - */ - case RIO_BLOCK_OPENS: rio_dprintk(RIO_DEBUG_CTRL, "Opens block until booted\n"); for (Entry = 0; Entry < RIO_PORTS; Entry++) { @@ -650,8 +521,7 @@ int su; case RIO_SETUP_PORTS: rio_dprintk(RIO_DEBUG_CTRL, "Setup ports\n"); - if (copyin((int) arg, (caddr_t) & PortSetup, sizeof(PortSetup)) - == COPYFAIL) { + if (copy_from_user(&PortSetup, arg, sizeof(PortSetup))) { p->RIOError.Error = COPYIN_FAILED; rio_dprintk(RIO_DEBUG_CTRL, "EFAULT"); return -EFAULT; @@ -667,7 +537,7 @@ int su; return -EINVAL; } if (!p->RIOPortp) { - cprintf("No p->RIOPortp array!\n"); + printk(KERN_ERR "rio: No p->RIOPortp array!\n"); rio_dprintk(RIO_DEBUG_CTRL, "No p->RIOPortp array!\n"); return -EIO; } @@ -681,8 +551,7 @@ int su; case RIO_GET_PORT_SETUP: rio_dprintk(RIO_DEBUG_CTRL, "Get port setup\n"); - if (copyin((int) arg, (caddr_t) & PortSetup, sizeof(PortSetup)) - == COPYFAIL) { + if (copy_from_user(&PortSetup, arg, sizeof(PortSetup))) { p->RIOError.Error = COPYIN_FAILED; return -EFAULT; } @@ -698,13 +567,12 @@ int su; PortSetup.Store = p->RIOPortp[port]->Store; PortSetup.Lock = p->RIOPortp[port]->Lock; PortSetup.XpCps = p->RIOPortp[port]->Xprint.XpCps; - bcopy(p->RIOPortp[port]->Xprint.XpOn, PortSetup.XpOn, MAX_XP_CTRL_LEN); - bcopy(p->RIOPortp[port]->Xprint.XpOff, PortSetup.XpOff, MAX_XP_CTRL_LEN); + memcpy(PortSetup.XpOn, p->RIOPortp[port]->Xprint.XpOn, MAX_XP_CTRL_LEN); + memcpy(PortSetup.XpOff, p->RIOPortp[port]->Xprint.XpOff, MAX_XP_CTRL_LEN); PortSetup.XpOn[MAX_XP_CTRL_LEN - 1] = '\0'; PortSetup.XpOff[MAX_XP_CTRL_LEN - 1] = '\0'; - if (copyout((caddr_t) & PortSetup, (int) arg, sizeof(PortSetup)) - == COPYFAIL) { + if (copy_to_user(arg, &PortSetup, sizeof(PortSetup))) { p->RIOError.Error = COPYOUT_FAILED; return -EFAULT; } @@ -712,7 +580,7 @@ int su; case RIO_GET_PORT_PARAMS: rio_dprintk(RIO_DEBUG_CTRL, "Get port params\n"); - if (copyin((int) arg, (caddr_t) & PortParams, sizeof(struct PortParams)) == COPYFAIL) { + if (copy_from_user(&PortParams, arg, sizeof(struct PortParams))) { p->RIOError.Error = COPYIN_FAILED; return -EFAULT; } @@ -725,7 +593,7 @@ int su; PortParams.State = PortP->State; rio_dprintk(RIO_DEBUG_CTRL, "Port %d\n", PortParams.Port); - if (copyout((caddr_t) & PortParams, (int) arg, sizeof(struct PortParams)) == COPYFAIL) { + if (copy_to_user(arg, &PortParams, sizeof(struct PortParams))) { p->RIOError.Error = COPYOUT_FAILED; return -EFAULT; } @@ -733,8 +601,7 @@ int su; case RIO_GET_PORT_TTY: rio_dprintk(RIO_DEBUG_CTRL, "Get port tty\n"); - if (copyin((int) arg, (caddr_t) & PortTty, sizeof(struct PortTty)) - == COPYFAIL) { + if (copy_from_user(&PortTty, arg, sizeof(struct PortTty))) { p->RIOError.Error = COPYIN_FAILED; return -EFAULT; } @@ -745,14 +612,14 @@ int su; rio_dprintk(RIO_DEBUG_CTRL, "Port %d\n", PortTty.port); PortP = (p->RIOPortp[PortTty.port]); - if (copyout((caddr_t) & PortTty, (int) arg, sizeof(struct PortTty)) == COPYFAIL) { + if (copy_to_user(arg, &PortTty, sizeof(struct PortTty))) { p->RIOError.Error = COPYOUT_FAILED; return -EFAULT; } return retval; case RIO_SET_PORT_TTY: - if (copyin((int) arg, (caddr_t) & PortTty, sizeof(struct PortTty)) == COPYFAIL) { + if (copy_from_user(&PortTty, arg, sizeof(struct PortTty))) { p->RIOError.Error = COPYIN_FAILED; return -EFAULT; } @@ -767,8 +634,7 @@ int su; case RIO_SET_PORT_PARAMS: rio_dprintk(RIO_DEBUG_CTRL, "Set port params\n"); - if (copyin((int) arg, (caddr_t) & PortParams, sizeof(PortParams)) - == COPYFAIL) { + if (copy_from_user(&PortParams, arg, sizeof(PortParams))) { p->RIOError.Error = COPYIN_FAILED; return -EFAULT; } @@ -784,7 +650,7 @@ int su; case RIO_GET_PORT_STATS: rio_dprintk(RIO_DEBUG_CTRL, "RIO_GET_PORT_STATS\n"); - if (copyin((int) arg, (caddr_t) & portStats, sizeof(struct portStats)) == COPYFAIL) { + if (copy_from_user(&portStats, arg, sizeof(struct portStats))) { p->RIOError.Error = COPYIN_FAILED; return -EFAULT; } @@ -799,14 +665,14 @@ int su; portStats.opens = PortP->opens; portStats.closes = PortP->closes; portStats.ioctls = PortP->ioctls; - if (copyout((caddr_t) & portStats, (int) arg, sizeof(struct portStats)) == COPYFAIL) { + if (copy_to_user(arg, &portStats, sizeof(struct portStats))) { p->RIOError.Error = COPYOUT_FAILED; return -EFAULT; } return retval; case RIO_RESET_PORT_STATS: - port = (uint) arg; + port = (unsigned long) arg; rio_dprintk(RIO_DEBUG_CTRL, "RIO_RESET_PORT_STATS\n"); if (port >= RIO_PORTS) { p->RIOError.Error = PORT_NUMBER_OUT_OF_RANGE; @@ -824,7 +690,7 @@ int su; case RIO_GATHER_PORT_STATS: rio_dprintk(RIO_DEBUG_CTRL, "RIO_GATHER_PORT_STATS\n"); - if (copyin((int) arg, (caddr_t) & portStats, sizeof(struct portStats)) == COPYFAIL) { + if (copy_from_user(&portStats, arg, sizeof(struct portStats))) { p->RIOError.Error = COPYIN_FAILED; return -EFAULT; } @@ -840,7 +706,7 @@ int su; case RIO_READ_CONFIG: rio_dprintk(RIO_DEBUG_CTRL, "RIO_READ_CONFIG\n"); - if (copyout((caddr_t) & p->RIOConf, (int) arg, sizeof(struct Conf)) == COPYFAIL) { + if (copy_to_user(arg, &p->RIOConf, sizeof(struct Conf))) { p->RIOError.Error = COPYOUT_FAILED; return -EFAULT; } @@ -852,8 +718,7 @@ int su; p->RIOError.Error = NOT_SUPER_USER; return -EPERM; } - if (copyin((int) arg, (caddr_t) & p->RIOConf, sizeof(struct Conf)) - == COPYFAIL) { + if (copy_from_user(&p->RIOConf, arg, sizeof(struct Conf))) { p->RIOError.Error = COPYIN_FAILED; return -EFAULT; } @@ -862,7 +727,7 @@ int su; */ for (Host = 0; Host < p->RIONumHosts; Host++) if ((p->RIOHosts[Host].Flags & RUN_STATE) == RC_RUNNING) - WWORD(p->RIOHosts[Host].ParmMapP->timer, p->RIOConf.Timer); + writew(p->RIOConf.Timer, &p->RIOHosts[Host].ParmMapP->timer); return retval; case RIO_START_POLLER: @@ -881,8 +746,7 @@ int su; case RIO_SETDEBUG: case RIO_GETDEBUG: rio_dprintk(RIO_DEBUG_CTRL, "RIO_SETDEBUG/RIO_GETDEBUG\n"); - if (copyin((int) arg, (caddr_t) & DebugCtrl, sizeof(DebugCtrl)) - == COPYFAIL) { + if (copy_from_user(&DebugCtrl, arg, sizeof(DebugCtrl))) { p->RIOError.Error = COPYIN_FAILED; return -EFAULT; } @@ -899,7 +763,7 @@ int su; rio_dprintk(RIO_DEBUG_CTRL, "Get global debug 0x%x wait 0x%x\n", p->rio_debug, p->RIODebugWait); DebugCtrl.Debug = p->rio_debug; DebugCtrl.Wait = p->RIODebugWait; - if (copyout((caddr_t) & DebugCtrl, (int) arg, sizeof(DebugCtrl)) == COPYFAIL) { + if (copy_to_user(arg, &DebugCtrl, sizeof(DebugCtrl))) { rio_dprintk(RIO_DEBUG_CTRL, "RIO_SET/GET DEBUG: bad port number %d\n", DebugCtrl.SysPort); p->RIOError.Error = COPYOUT_FAILED; return -EFAULT; @@ -921,7 +785,7 @@ int su; } else { rio_dprintk(RIO_DEBUG_CTRL, "RIO_GETDEBUG 0x%x\n", p->RIOPortp[DebugCtrl.SysPort]->Debug); DebugCtrl.Debug = p->RIOPortp[DebugCtrl.SysPort]->Debug; - if (copyout((caddr_t) & DebugCtrl, (int) arg, sizeof(DebugCtrl)) == COPYFAIL) { + if (copy_to_user(arg, &DebugCtrl, sizeof(DebugCtrl))) { rio_dprintk(RIO_DEBUG_CTRL, "RIO_GETDEBUG: Bad copy to user space\n"); p->RIOError.Error = COPYOUT_FAILED; return -EFAULT; @@ -936,43 +800,20 @@ int su; ** textual null terminated string. */ rio_dprintk(RIO_DEBUG_CTRL, "RIO_VERSID\n"); - if (copyout((caddr_t) RIOVersid(), (int) arg, sizeof(struct rioVersion)) == COPYFAIL) { + if (copy_to_user(arg, RIOVersid(), sizeof(struct rioVersion))) { rio_dprintk(RIO_DEBUG_CTRL, "RIO_VERSID: Bad copy to user space (host=%d)\n", Host); p->RIOError.Error = COPYOUT_FAILED; return -EFAULT; } return retval; - /* - ** !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - ** !! commented out previous 'RIO_VERSID' functionality !! - ** !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - ** - case RIO_VERSID: - ** - ** Enquire about the release and version. - ** We return MAX_VERSION_LEN bytes, being a textual null - ** terminated string. - ** - rio_dprint(RIO_DEBUG_CTRL, ("RIO_VERSID\n")); - if (copyout((caddr_t)RIOVersid(), - (int)arg, MAX_VERSION_LEN ) == COPYFAIL ) { - rio_dprint(RIO_DEBUG_CTRL, ("RIO_VERSID: Bad copy to user space\n",Host)); - p->RIOError.Error = COPYOUT_FAILED; - return -EFAULT; - } - return retval; - ** - ** !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - */ - case RIO_NUM_HOSTS: /* ** Enquire as to the number of hosts located ** at init time. */ rio_dprintk(RIO_DEBUG_CTRL, "RIO_NUM_HOSTS\n"); - if (copyout((caddr_t) & p->RIONumHosts, (int) arg, sizeof(p->RIONumHosts)) == COPYFAIL) { + if (copy_to_user(arg, &p->RIONumHosts, sizeof(p->RIONumHosts))) { rio_dprintk(RIO_DEBUG_CTRL, "RIO_NUM_HOSTS: Bad copy to user space\n"); p->RIOError.Error = COPYOUT_FAILED; return -EFAULT; @@ -983,7 +824,7 @@ int su; /* ** Kill host. This may not be in the final version... */ - rio_dprintk(RIO_DEBUG_CTRL, "RIO_HOST_FOAD %d\n", (int) arg); + rio_dprintk(RIO_DEBUG_CTRL, "RIO_HOST_FOAD %ld\n", (unsigned long) arg); if (!su) { rio_dprintk(RIO_DEBUG_CTRL, "RIO_HOST_FOAD: Not super user\n"); p->RIOError.Error = NOT_SUPER_USER; @@ -994,7 +835,7 @@ int su; for (Host = 0; Host < p->RIONumHosts; Host++) { (void) RIOBoardTest(p->RIOHosts[Host].PaddrP, p->RIOHosts[Host].Caddr, p->RIOHosts[Host].Type, p->RIOHosts[Host].Slot); - bzero((caddr_t) & p->RIOHosts[Host].Flags, ((int) &p->RIOHosts[Host].____end_marker____) - ((int) &p->RIOHosts[Host].Flags)); + memset(&p->RIOHosts[Host].Flags, 0, ((char *) &p->RIOHosts[Host].____end_marker____) - ((char *) &p->RIOHosts[Host].Flags)); p->RIOHosts[Host].Flags = RC_WAITING; } RIOFoadWakeup(p); @@ -1017,7 +858,7 @@ int su; p->RIOError.Error = NOT_SUPER_USER; return -EPERM; } - if (copyin((int) arg, (caddr_t) & DownLoad, sizeof(DownLoad)) == COPYFAIL) { + if (copy_from_user(&DownLoad, arg, sizeof(DownLoad))) { rio_dprintk(RIO_DEBUG_CTRL, "RIO_DOWNLOAD: Copy in from user space failed\n"); p->RIOError.Error = COPYIN_FAILED; return -EFAULT; @@ -1045,9 +886,9 @@ int su; case RIO_PARMS: { - uint host; + unsigned int host; - if (copyin((int) arg, (caddr_t) & host, sizeof(host)) == COPYFAIL) { + if (copy_from_user(&host, arg, sizeof(host))) { rio_dprintk(RIO_DEBUG_CTRL, "RIO_HOST_REQ: Copy in from user space failed\n"); p->RIOError.Error = COPYIN_FAILED; return -EFAULT; @@ -1056,7 +897,7 @@ int su; ** Fetch the parmmap */ rio_dprintk(RIO_DEBUG_CTRL, "RIO_PARMS\n"); - if (copyout((caddr_t) p->RIOHosts[host].ParmMapP, (int) arg, sizeof(PARM_MAP)) == COPYFAIL) { + if (copy_to_user(arg, p->RIOHosts[host].ParmMapP, sizeof(PARM_MAP))) { p->RIOError.Error = COPYOUT_FAILED; rio_dprintk(RIO_DEBUG_CTRL, "RIO_PARMS: Copy out to user space failed\n"); return -EFAULT; @@ -1066,7 +907,7 @@ int su; case RIO_HOST_REQ: rio_dprintk(RIO_DEBUG_CTRL, "RIO_HOST_REQ\n"); - if (copyin((int) arg, (caddr_t) & HostReq, sizeof(HostReq)) == COPYFAIL) { + if (copy_from_user(&HostReq, arg, sizeof(HostReq))) { rio_dprintk(RIO_DEBUG_CTRL, "RIO_HOST_REQ: Copy in from user space failed\n"); p->RIOError.Error = COPYIN_FAILED; return -EFAULT; @@ -1078,7 +919,7 @@ int su; } rio_dprintk(RIO_DEBUG_CTRL, "Request for host %d\n", HostReq.HostNum); - if (copyout((caddr_t) & p->RIOHosts[HostReq.HostNum], (int) HostReq.HostP, sizeof(struct Host)) == COPYFAIL) { + if (copy_to_user(HostReq.HostP, &p->RIOHosts[HostReq.HostNum], sizeof(struct Host))) { p->RIOError.Error = COPYOUT_FAILED; rio_dprintk(RIO_DEBUG_CTRL, "RIO_HOST_REQ: Bad copy to user space\n"); return -EFAULT; @@ -1087,7 +928,7 @@ int su; case RIO_HOST_DPRAM: rio_dprintk(RIO_DEBUG_CTRL, "Request for DPRAM\n"); - if (copyin((int) arg, (caddr_t) & HostDpRam, sizeof(HostDpRam)) == COPYFAIL) { + if (copy_from_user(&HostDpRam, arg, sizeof(HostDpRam))) { rio_dprintk(RIO_DEBUG_CTRL, "RIO_HOST_DPRAM: Copy in from user space failed\n"); p->RIOError.Error = COPYIN_FAILED; return -EFAULT; @@ -1104,13 +945,13 @@ int su; /* It's hardware like this that really gets on my tits. */ static unsigned char copy[sizeof(struct DpRam)]; for (off = 0; off < sizeof(struct DpRam); off++) - copy[off] = p->RIOHosts[HostDpRam.HostNum].Caddr[off]; - if (copyout((caddr_t) copy, (int) HostDpRam.DpRamP, sizeof(struct DpRam)) == COPYFAIL) { + copy[off] = readb(&p->RIOHosts[HostDpRam.HostNum].Caddr[off]); + if (copy_to_user(HostDpRam.DpRamP, copy, sizeof(struct DpRam))) { p->RIOError.Error = COPYOUT_FAILED; rio_dprintk(RIO_DEBUG_CTRL, "RIO_HOST_DPRAM: Bad copy to user space\n"); return -EFAULT; } - } else if (copyout((caddr_t) p->RIOHosts[HostDpRam.HostNum].Caddr, (int) HostDpRam.DpRamP, sizeof(struct DpRam)) == COPYFAIL) { + } else if (copy_to_user(HostDpRam.DpRamP, p->RIOHosts[HostDpRam.HostNum].Caddr, sizeof(struct DpRam))) { p->RIOError.Error = COPYOUT_FAILED; rio_dprintk(RIO_DEBUG_CTRL, "RIO_HOST_DPRAM: Bad copy to user space\n"); return -EFAULT; @@ -1119,13 +960,13 @@ int su; case RIO_SET_BUSY: rio_dprintk(RIO_DEBUG_CTRL, "RIO_SET_BUSY\n"); - if ((int) arg < 0 || (int) arg > 511) { - rio_dprintk(RIO_DEBUG_CTRL, "RIO_SET_BUSY: Bad port number %d\n", (int) arg); + if ((unsigned long) arg > 511) { + rio_dprintk(RIO_DEBUG_CTRL, "RIO_SET_BUSY: Bad port number %ld\n", (unsigned long) arg); p->RIOError.Error = PORT_NUMBER_OUT_OF_RANGE; return -EINVAL; } rio_spin_lock_irqsave(&PortP->portSem, flags); - p->RIOPortp[(int) arg]->State |= RIO_BUSY; + p->RIOPortp[(unsigned long) arg]->State |= RIO_BUSY; rio_spin_unlock_irqrestore(&PortP->portSem, flags); return retval; @@ -1135,7 +976,7 @@ int su; ** (probably for debug reasons) */ rio_dprintk(RIO_DEBUG_CTRL, "RIO_HOST_PORT\n"); - if (copyin((int) arg, (caddr_t) & PortReq, sizeof(PortReq)) == COPYFAIL) { + if (copy_from_user(&PortReq, arg, sizeof(PortReq))) { rio_dprintk(RIO_DEBUG_CTRL, "RIO_HOST_PORT: Copy in from user space failed\n"); p->RIOError.Error = COPYIN_FAILED; return -EFAULT; @@ -1147,7 +988,7 @@ int su; return -ENXIO; } rio_dprintk(RIO_DEBUG_CTRL, "Request for port %d\n", PortReq.SysPort); - if (copyout((caddr_t) p->RIOPortp[PortReq.SysPort], (int) PortReq.PortP, sizeof(struct Port)) == COPYFAIL) { + if (copy_to_user(PortReq.PortP, p->RIOPortp[PortReq.SysPort], sizeof(struct Port))) { p->RIOError.Error = COPYOUT_FAILED; rio_dprintk(RIO_DEBUG_CTRL, "RIO_HOST_PORT: Bad copy to user space\n"); return -EFAULT; @@ -1160,7 +1001,7 @@ int su; ** (probably for debug reasons) */ rio_dprintk(RIO_DEBUG_CTRL, "RIO_HOST_RUP\n"); - if (copyin((int) arg, (caddr_t) & RupReq, sizeof(RupReq)) == COPYFAIL) { + if (copy_from_user(&RupReq, arg, sizeof(RupReq))) { rio_dprintk(RIO_DEBUG_CTRL, "RIO_HOST_RUP: Copy in from user space failed\n"); p->RIOError.Error = COPYIN_FAILED; return -EFAULT; @@ -1184,7 +1025,7 @@ int su; } rio_dprintk(RIO_DEBUG_CTRL, "Request for rup %d from host %d\n", RupReq.RupNum, RupReq.HostNum); - if (copyout((caddr_t) HostP->UnixRups[RupReq.RupNum].RupP, (int) RupReq.RupP, sizeof(struct RUP)) == COPYFAIL) { + if (copy_to_user(HostP->UnixRups[RupReq.RupNum].RupP, RupReq.RupP, sizeof(struct RUP))) { p->RIOError.Error = COPYOUT_FAILED; rio_dprintk(RIO_DEBUG_CTRL, "RIO_HOST_RUP: Bad copy to user space\n"); return -EFAULT; @@ -1197,7 +1038,7 @@ int su; ** (probably for debug reasons) */ rio_dprintk(RIO_DEBUG_CTRL, "RIO_HOST_LPB\n"); - if (copyin((int) arg, (caddr_t) & LpbReq, sizeof(LpbReq)) == COPYFAIL) { + if (copy_from_user(&LpbReq, arg, sizeof(LpbReq))) { rio_dprintk(RIO_DEBUG_CTRL, "RIO_HOST_LPB: Bad copy from user space\n"); p->RIOError.Error = COPYIN_FAILED; return -EFAULT; @@ -1221,7 +1062,7 @@ int su; } rio_dprintk(RIO_DEBUG_CTRL, "Request for lpb %d from host %d\n", LpbReq.Link, LpbReq.Host); - if (copyout((caddr_t) & HostP->LinkStrP[LpbReq.Link], (int) LpbReq.LpbP, sizeof(struct LPB)) == COPYFAIL) { + if (copy_to_user(LpbReq.LpbP, &HostP->LinkStrP[LpbReq.Link], sizeof(struct LPB))) { rio_dprintk(RIO_DEBUG_CTRL, "RIO_HOST_LPB: Bad copy to user space\n"); p->RIOError.Error = COPYOUT_FAILED; return -EFAULT; @@ -1252,12 +1093,13 @@ int su; p->RIOError.Error = SIGNALS_ALREADY_SET; return -EBUSY; } - p->RIOSignalProcess = getpid(); + /* FIXME: PID tracking */ + p->RIOSignalProcess = current->pid; p->RIOPrintDisabled = DONT_PRINT; return retval; case RIO_SIGNALS_OFF: - if (p->RIOSignalProcess != getpid()) { + if (p->RIOSignalProcess != current->pid) { p->RIOError.Error = NOT_RECEIVING_PROCESS; return -EPERM; } @@ -1294,7 +1136,7 @@ int su; case RIO_MAP_B110_TO_110: case RIO_MAP_B110_TO_115200: rio_dprintk(RIO_DEBUG_CTRL, "Baud rate mapping\n"); - port = (uint) arg; + port = (unsigned long) arg; if (port < 0 || port > 511) { rio_dprintk(RIO_DEBUG_CTRL, "Baud rate mapping: Bad port number %d\n", port); p->RIOError.Error = PORT_NUMBER_OUT_OF_RANGE; @@ -1324,7 +1166,7 @@ int su; case RIO_SEND_PACKET: rio_dprintk(RIO_DEBUG_CTRL, "RIO_SEND_PACKET\n"); - if (copyin((int) arg, (caddr_t) & SendPack, sizeof(SendPack)) == COPYFAIL) { + if (copy_from_user(&SendPack, arg, sizeof(SendPack))) { rio_dprintk(RIO_DEBUG_CTRL, "RIO_SEND_PACKET: Bad copy from user space\n"); p->RIOError.Error = COPYIN_FAILED; return -EFAULT; @@ -1344,9 +1186,9 @@ int su; } for (loop = 0; loop < (ushort) (SendPack.Len & 127); loop++) - WBYTE(PacketP->data[loop], SendPack.Data[loop]); + writeb(SendPack.Data[loop], &PacketP->data[loop]); - WBYTE(PacketP->len, SendPack.Len); + writeb(SendPack.Len, &PacketP->len); add_transmit(PortP); /* @@ -1368,7 +1210,7 @@ int su; return su ? 0 : -EPERM; case RIO_WHAT_MESG: - if (copyout((caddr_t) & p->RIONoMessage, (int) arg, sizeof(p->RIONoMessage)) == COPYFAIL) { + if (copy_to_user(arg, &p->RIONoMessage, sizeof(p->RIONoMessage))) { rio_dprintk(RIO_DEBUG_CTRL, "RIO_WHAT_MESG: Bad copy to user space\n"); p->RIOError.Error = COPYOUT_FAILED; return -EFAULT; @@ -1376,7 +1218,7 @@ int su; return 0; case RIO_MEM_DUMP: - if (copyin((int) arg, (caddr_t) & SubCmd, sizeof(struct SubCmdStruct)) == COPYFAIL) { + if (copy_from_user(&SubCmd, arg, sizeof(struct SubCmdStruct))) { p->RIOError.Error = COPYIN_FAILED; return -EFAULT; } @@ -1406,7 +1248,7 @@ int su; PortP->State |= RIO_BUSY; rio_spin_unlock_irqrestore(&PortP->portSem, flags); - if (copyout((caddr_t) p->RIOMemDump, (int) arg, MEMDUMP_SIZE) == COPYFAIL) { + if (copy_to_user(arg, p->RIOMemDump, MEMDUMP_SIZE)) { rio_dprintk(RIO_DEBUG_CTRL, "RIO_MEM_DUMP copy failed\n"); p->RIOError.Error = COPYOUT_FAILED; return -EFAULT; @@ -1414,30 +1256,30 @@ int su; return 0; case RIO_TICK: - if ((int) arg < 0 || (int) arg >= p->RIONumHosts) + if ((unsigned long) arg >= p->RIONumHosts) return -EINVAL; - rio_dprintk(RIO_DEBUG_CTRL, "Set interrupt for host %d\n", (int) arg); - WBYTE(p->RIOHosts[(int) arg].SetInt, 0xff); + rio_dprintk(RIO_DEBUG_CTRL, "Set interrupt for host %ld\n", (unsigned long) arg); + writeb(0xFF, &p->RIOHosts[(unsigned long) arg].SetInt); return 0; case RIO_TOCK: - if ((int) arg < 0 || (int) arg >= p->RIONumHosts) + if ((unsigned long) arg >= p->RIONumHosts) return -EINVAL; - rio_dprintk(RIO_DEBUG_CTRL, "Clear interrupt for host %d\n", (int) arg); - WBYTE((p->RIOHosts[(int) arg].ResetInt), 0xff); + rio_dprintk(RIO_DEBUG_CTRL, "Clear interrupt for host %ld\n", (unsigned long) arg); + writeb(0xFF, &p->RIOHosts[(unsigned long) arg].ResetInt); return 0; case RIO_READ_CHECK: /* Check reads for pkts with data[0] the same */ p->RIOReadCheck = !p->RIOReadCheck; - if (copyout((caddr_t) & p->RIOReadCheck, (int) arg, sizeof(uint)) == COPYFAIL) { + if (copy_to_user(arg, &p->RIOReadCheck, sizeof(unsigned int))) { p->RIOError.Error = COPYOUT_FAILED; return -EFAULT; } return 0; case RIO_READ_REGISTER: - if (copyin((int) arg, (caddr_t) & SubCmd, sizeof(struct SubCmdStruct)) == COPYFAIL) { + if (copy_from_user(&SubCmd, arg, sizeof(struct SubCmdStruct))) { p->RIOError.Error = COPYIN_FAILED; return -EFAULT; } @@ -1472,7 +1314,7 @@ int su; PortP->State |= RIO_BUSY; rio_spin_unlock_irqrestore(&PortP->portSem, flags); - if (copyout((caddr_t) & p->CdRegister, (int) arg, sizeof(uint)) == COPYFAIL) { + if (copy_to_user(arg, &p->CdRegister, sizeof(unsigned int))) { rio_dprintk(RIO_DEBUG_CTRL, "RIO_READ_REGISTER copy failed\n"); p->RIOError.Error = COPYOUT_FAILED; return -EFAULT; @@ -1485,21 +1327,22 @@ int su; */ case RIO_MAKE_DEV: { - uint port = (uint) arg & RIO_MODEM_MASK; + unsigned int port = (unsigned long) arg & RIO_MODEM_MASK; + unsigned int ret; - switch ((uint) arg & RIO_DEV_MASK) { + switch ((unsigned long) arg & RIO_DEV_MASK) { case RIO_DEV_DIRECT: - arg = (caddr_t) drv_makedev(MAJOR(dev), port); - rio_dprintk(RIO_DEBUG_CTRL, "Makedev direct 0x%x is 0x%x\n", port, (int) arg); - return (int) arg; + ret = drv_makedev(MAJOR(dev), port); + rio_dprintk(RIO_DEBUG_CTRL, "Makedev direct 0x%x is 0x%x\n", port, ret); + return ret; case RIO_DEV_MODEM: - arg = (caddr_t) drv_makedev(MAJOR(dev), (port | RIO_MODEM_BIT)); - rio_dprintk(RIO_DEBUG_CTRL, "Makedev modem 0x%x is 0x%x\n", port, (int) arg); - return (int) arg; + ret = drv_makedev(MAJOR(dev), (port | RIO_MODEM_BIT)); + rio_dprintk(RIO_DEBUG_CTRL, "Makedev modem 0x%x is 0x%x\n", port, ret); + return ret; case RIO_DEV_XPRINT: - arg = (caddr_t) drv_makedev(MAJOR(dev), port); - rio_dprintk(RIO_DEBUG_CTRL, "Makedev printer 0x%x is 0x%x\n", port, (int) arg); - return (int) arg; + ret = drv_makedev(MAJOR(dev), port); + rio_dprintk(RIO_DEBUG_CTRL, "Makedev printer 0x%x is 0x%x\n", port, ret); + return ret; } rio_dprintk(RIO_DEBUG_CTRL, "MAKE Device is called\n"); return -EINVAL; @@ -1513,18 +1356,19 @@ int su; { dev_t dv; int mino; + unsigned long ret; - dv = (dev_t) ((int) arg); + dv = (dev_t) ((unsigned long) arg); mino = RIO_UNMODEM(dv); if (RIO_ISMODEM(dv)) { rio_dprintk(RIO_DEBUG_CTRL, "Minor for device 0x%x: modem %d\n", dv, mino); - arg = (caddr_t) (mino | RIO_DEV_MODEM); + ret = mino | RIO_DEV_MODEM; } else { rio_dprintk(RIO_DEBUG_CTRL, "Minor for device 0x%x: direct %d\n", dv, mino); - arg = (caddr_t) (mino | RIO_DEV_DIRECT); + ret = mino | RIO_DEV_DIRECT; } - return (int) arg; + return ret; } } rio_dprintk(RIO_DEBUG_CTRL, "INVALID DAEMON IOCTL 0x%x\n", cmd); @@ -1537,10 +1381,7 @@ int su; /* ** Pre-emptive commands go on RUPs and are only one byte long. */ -int RIOPreemptiveCmd(p, PortP, Cmd) -struct rio_info *p; -struct Port *PortP; -uchar Cmd; +int RIOPreemptiveCmd(struct rio_info *p, struct Port *PortP, u8 Cmd) { struct CmdBlk *CmdBlkP; struct PktCmd_M *PktCmdP; @@ -1558,7 +1399,7 @@ uchar Cmd; return RIO_FAIL; } - rio_dprintk(RIO_DEBUG_CTRL, "Command blk 0x%x - InUse now %d\n", (int) CmdBlkP, PortP->InUse); + rio_dprintk(RIO_DEBUG_CTRL, "Command blk %p - InUse now %d\n", CmdBlkP, PortP->InUse); PktCmdP = (struct PktCmd_M *) &CmdBlkP->Packet.data[0]; @@ -1572,7 +1413,7 @@ uchar Cmd; CmdBlkP->Packet.dest_port = COMMAND_RUP; CmdBlkP->Packet.len = PKT_CMD_BIT | 2; CmdBlkP->PostFuncP = RIOUnUse; - CmdBlkP->PostArg = (int) PortP; + CmdBlkP->PostArg = (unsigned long) PortP; PktCmdP->Command = Cmd; port = PortP->HostPort % (ushort) PORTS_PER_RTA; /* @@ -1584,38 +1425,38 @@ uchar Cmd; switch (Cmd) { case MEMDUMP: - rio_dprintk(RIO_DEBUG_CTRL, "Queue MEMDUMP command blk 0x%x (addr 0x%x)\n", (int) CmdBlkP, (int) SubCmd.Addr); + rio_dprintk(RIO_DEBUG_CTRL, "Queue MEMDUMP command blk %p (addr 0x%x)\n", CmdBlkP, (int) SubCmd.Addr); PktCmdP->SubCommand = MEMDUMP; PktCmdP->SubAddr = SubCmd.Addr; break; case FCLOSE: - rio_dprintk(RIO_DEBUG_CTRL, "Queue FCLOSE command blk 0x%x\n", (int) CmdBlkP); + rio_dprintk(RIO_DEBUG_CTRL, "Queue FCLOSE command blk %p\n", CmdBlkP); break; case READ_REGISTER: - rio_dprintk(RIO_DEBUG_CTRL, "Queue READ_REGISTER (0x%x) command blk 0x%x\n", (int) SubCmd.Addr, (int) CmdBlkP); + rio_dprintk(RIO_DEBUG_CTRL, "Queue READ_REGISTER (0x%x) command blk %p\n", (int) SubCmd.Addr, CmdBlkP); PktCmdP->SubCommand = READ_REGISTER; PktCmdP->SubAddr = SubCmd.Addr; break; case RESUME: - rio_dprintk(RIO_DEBUG_CTRL, "Queue RESUME command blk 0x%x\n", (int) CmdBlkP); + rio_dprintk(RIO_DEBUG_CTRL, "Queue RESUME command blk %p\n", CmdBlkP); break; case RFLUSH: - rio_dprintk(RIO_DEBUG_CTRL, "Queue RFLUSH command blk 0x%x\n", (int) CmdBlkP); + rio_dprintk(RIO_DEBUG_CTRL, "Queue RFLUSH command blk %p\n", CmdBlkP); CmdBlkP->PostFuncP = RIORFlushEnable; break; case SUSPEND: - rio_dprintk(RIO_DEBUG_CTRL, "Queue SUSPEND command blk 0x%x\n", (int) CmdBlkP); + rio_dprintk(RIO_DEBUG_CTRL, "Queue SUSPEND command blk %p\n", CmdBlkP); break; case MGET: - rio_dprintk(RIO_DEBUG_CTRL, "Queue MGET command blk 0x%x\n", (int) CmdBlkP); + rio_dprintk(RIO_DEBUG_CTRL, "Queue MGET command blk %p\n", CmdBlkP); break; case MSET: case MBIC: case MBIS: CmdBlkP->Packet.data[4] = (char) PortP->ModemLines; - rio_dprintk(RIO_DEBUG_CTRL, "Queue MSET/MBIC/MBIS command blk 0x%x\n", (int) CmdBlkP); + rio_dprintk(RIO_DEBUG_CTRL, "Queue MSET/MBIC/MBIS command blk %p\n", CmdBlkP); break; case WFLUSH: @@ -1629,7 +1470,7 @@ uchar Cmd; RIOFreeCmdBlk(CmdBlkP); return (RIO_FAIL); } else { - rio_dprintk(RIO_DEBUG_CTRL, "Queue WFLUSH command blk 0x%x\n", (int) CmdBlkP); + rio_dprintk(RIO_DEBUG_CTRL, "Queue WFLUSH command blk %p\n", CmdBlkP); CmdBlkP->PostFuncP = RIOWFlushMark; } break; diff --git a/drivers/char/rio/riodrvr.h b/drivers/char/rio/riodrvr.h index 663ee0914ed..3cffe275f21 100644 --- a/drivers/char/rio/riodrvr.h +++ b/drivers/char/rio/riodrvr.h @@ -72,42 +72,42 @@ struct rio_info { */ int RIOHalted; /* halted ? */ int RIORtaDisCons; /* RTA connections/disconnections */ - uint RIOReadCheck; /* Rio read check */ - uint RIONoMessage; /* To display message or not */ - uint RIONumBootPkts; /* how many packets for an RTA */ - uint RIOBootCount; /* size of RTA code */ - uint RIOBooting; /* count of outstanding boots */ - uint RIOSystemUp; /* Booted ?? */ - uint RIOCounting; /* for counting interrupts */ - uint RIOIntCount; /* # of intr since last check */ - uint RIOTxCount; /* number of xmit intrs */ - uint RIORxCount; /* number of rx intrs */ - uint RIORupCount; /* number of rup intrs */ + unsigned int RIOReadCheck; /* Rio read check */ + unsigned int RIONoMessage; /* To display message or not */ + unsigned int RIONumBootPkts; /* how many packets for an RTA */ + unsigned int RIOBootCount; /* size of RTA code */ + unsigned int RIOBooting; /* count of outstanding boots */ + unsigned int RIOSystemUp; /* Booted ?? */ + unsigned int RIOCounting; /* for counting interrupts */ + unsigned int RIOIntCount; /* # of intr since last check */ + unsigned int RIOTxCount; /* number of xmit intrs */ + unsigned int RIORxCount; /* number of rx intrs */ + unsigned int RIORupCount; /* number of rup intrs */ int RIXTimer; int RIOBufferSize; /* Buffersize */ int RIOBufferMask; /* Buffersize */ int RIOFirstMajor; /* First host card's major no */ - uint RIOLastPortsMapped; /* highest port number known */ - uint RIOFirstPortsMapped; /* lowest port number known */ + unsigned int RIOLastPortsMapped; /* highest port number known */ + unsigned int RIOFirstPortsMapped; /* lowest port number known */ - uint RIOLastPortsBooted; /* highest port number running */ - uint RIOFirstPortsBooted; /* lowest port number running */ + unsigned int RIOLastPortsBooted; /* highest port number running */ + unsigned int RIOFirstPortsBooted; /* lowest port number running */ - uint RIOLastPortsOpened; /* highest port number running */ - uint RIOFirstPortsOpened; /* lowest port number running */ + unsigned int RIOLastPortsOpened; /* highest port number running */ + unsigned int RIOFirstPortsOpened; /* lowest port number running */ /* Flag to say that the topology information has been changed. */ - uint RIOQuickCheck; - uint CdRegister; /* ??? */ + unsigned int RIOQuickCheck; + unsigned int CdRegister; /* ??? */ int RIOSignalProcess; /* Signalling process */ int rio_debug; /* To debug ... */ int RIODebugWait; /* For what ??? */ int tpri; /* Thread prio */ int tid; /* Thread id */ - uint _RIO_Polled; /* Counter for polling */ - uint _RIO_Interrupted; /* Counter for interrupt */ + unsigned int _RIO_Polled; /* Counter for polling */ + unsigned int _RIO_Interrupted; /* Counter for interrupt */ int intr_tid; /* iointset return value */ int TxEnSem; /* TxEnable Semaphore */ @@ -121,9 +121,9 @@ struct rio_info { struct Map RIOSavedTable[TOTAL_MAP_ENTRIES]; /* RTA to host binding table for master/slave operation */ - ulong RIOBindTab[MAX_RTA_BINDINGS]; + unsigned long RIOBindTab[MAX_RTA_BINDINGS]; /* RTA memory dump variable */ - uchar RIOMemDump[MEMDUMP_SIZE]; + unsigned char RIOMemDump[MEMDUMP_SIZE]; struct ModuleInfo RIOModuleTypes[MAX_MODULE_TYPES]; }; @@ -138,7 +138,5 @@ struct rio_info { #define RIO_RESET_INT 0x7d80 -#define WRBYTE(x,y) *(volatile unsigned char *)((x)) = \ - (unsigned char)(y) #endif /* __riodrvr.h */ diff --git a/drivers/char/rio/rioinit.c b/drivers/char/rio/rioinit.c index 0d44ef464e6..24d2992154c 100644 --- a/drivers/char/rio/rioinit.c +++ b/drivers/char/rio/rioinit.c @@ -51,15 +51,12 @@ static char *_rioinit_c_sccs_ = "@(#)rioinit.c 1.3"; #include "linux_compat.h" -#include "typdef.h" #include "pkt.h" #include "daemon.h" #include "rio.h" #include "riospace.h" -#include "top.h" #include "cmdpkt.h" #include "map.h" -#include "riotypes.h" #include "rup.h" #include "port.h" #include "riodrvr.h" @@ -72,22 +69,17 @@ static char *_rioinit_c_sccs_ = "@(#)rioinit.c 1.3"; #include "unixrup.h" #include "board.h" #include "host.h" -#include "error.h" #include "phb.h" #include "link.h" #include "cmdblk.h" #include "route.h" -#include "control.h" #include "cirrus.h" #include "rioioctl.h" #include "rio_linux.h" -#undef bcopy -#define bcopy rio_pcicopy - int RIOPCIinit(struct rio_info *p, int Mode); -static int RIOScrub(int, BYTE *, int); +static int RIOScrub(int, u8 *, int); /** @@ -99,12 +91,8 @@ static int RIOScrub(int, BYTE *, int); ** bits < 0 indicates 8 bit operation requested, ** bits > 0 indicates 16 bit operation. */ -int -RIOAssignAT(p, Base, virtAddr, mode) -struct rio_info * p; -int Base; -caddr_t virtAddr; -int mode; + +int RIOAssignAT(struct rio_info *p, int Base, caddr_t virtAddr, int mode) { int bits; struct DpRam *cardp = (struct DpRam *)virtAddr; @@ -124,29 +112,25 @@ int mode; /* ** Revision 01 AT host cards don't support WORD operations, */ - if ( RBYTE(cardp->DpRevision) == 01 ) + if (readb(&cardp->DpRevision) == 01) bits = BYTE_OPERATION; p->RIOHosts[p->RIONumHosts].Type = RIO_AT; - p->RIOHosts[p->RIONumHosts].Copy = bcopy; + p->RIOHosts[p->RIONumHosts].Copy = rio_copy_to_card; /* set this later */ p->RIOHosts[p->RIONumHosts].Slot = -1; p->RIOHosts[p->RIONumHosts].Mode = SLOW_LINKS | SLOW_AT_BUS | bits; - WBYTE(p->RIOHosts[p->RIONumHosts].Control, - BOOT_FROM_RAM | EXTERNAL_BUS_OFF | - p->RIOHosts[p->RIONumHosts].Mode | - INTERRUPT_DISABLE ); - WBYTE(p->RIOHosts[p->RIONumHosts].ResetInt,0xff); - WBYTE(p->RIOHosts[p->RIONumHosts].Control, - BOOT_FROM_RAM | EXTERNAL_BUS_OFF | - p->RIOHosts[p->RIONumHosts].Mode | - INTERRUPT_DISABLE ); - WBYTE(p->RIOHosts[p->RIONumHosts].ResetInt,0xff); + writeb(BOOT_FROM_RAM | EXTERNAL_BUS_OFF | p->RIOHosts[p->RIONumHosts].Mode | INTERRUPT_DISABLE , + &p->RIOHosts[p->RIONumHosts].Control); + writeb(0xFF, &p->RIOHosts[p->RIONumHosts].ResetInt); + writeb(BOOT_FROM_RAM | EXTERNAL_BUS_OFF | p->RIOHosts[p->RIONumHosts].Mode | INTERRUPT_DISABLE, + &p->RIOHosts[p->RIONumHosts].Control); + writeb(0xFF, &p->RIOHosts[p->RIONumHosts].ResetInt); p->RIOHosts[p->RIONumHosts].UniqueNum = - ((RBYTE(p->RIOHosts[p->RIONumHosts].Unique[0])&0xFF)<<0)| - ((RBYTE(p->RIOHosts[p->RIONumHosts].Unique[1])&0xFF)<<8)| - ((RBYTE(p->RIOHosts[p->RIONumHosts].Unique[2])&0xFF)<<16)| - ((RBYTE(p->RIOHosts[p->RIONumHosts].Unique[3])&0xFF)<<24); + ((readb(&p->RIOHosts[p->RIONumHosts].Unique[0])&0xFF)<<0)| + ((readb(&p->RIOHosts[p->RIONumHosts].Unique[1])&0xFF)<<8)| + ((readb(&p->RIOHosts[p->RIONumHosts].Unique[2])&0xFF)<<16)| + ((readb(&p->RIOHosts[p->RIONumHosts].Unique[3])&0xFF)<<24); rio_dprintk (RIO_DEBUG_INIT, "RIO-init: Uniquenum 0x%x\n",p->RIOHosts[p->RIONumHosts].UniqueNum); p->RIONumHosts++; @@ -154,7 +138,7 @@ int mode; return(1); } -static uchar val[] = { +static u8 val[] = { #ifdef VERY_LONG_TEST 0x00, 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80, 0xa5, 0xff, 0x5a, 0x00, 0xff, 0xc9, 0x36, @@ -167,12 +151,7 @@ static uchar val[] = { ** RAM test a board. ** Nothing too complicated, just enough to check it out. */ -int -RIOBoardTest(paddr, caddr, type, slot) -paddr_t paddr; -caddr_t caddr; -uchar type; -int slot; +int RIOBoardTest(unsigned long paddr, caddr_t caddr, unsigned char type, int slot) { struct DpRam *DpRam = (struct DpRam *)caddr; char *ram[4]; @@ -180,8 +159,8 @@ int slot; int op, bank; int nbanks; - rio_dprintk (RIO_DEBUG_INIT, "RIO-init: Reset host type=%d, DpRam=0x%x, slot=%d\n", - type,(int)DpRam, slot); + rio_dprintk (RIO_DEBUG_INIT, "RIO-init: Reset host type=%d, DpRam=%p, slot=%d\n", + type, DpRam, slot); RIOHostReset(type, DpRam, slot); @@ -209,12 +188,11 @@ int slot; if (nbanks == 3) { - rio_dprintk (RIO_DEBUG_INIT, "RIO-init: Memory: 0x%x(0x%x), 0x%x(0x%x), 0x%x(0x%x)\n", - (int)ram[0], size[0], (int)ram[1], size[1], (int)ram[2], size[2]); + rio_dprintk (RIO_DEBUG_INIT, "RIO-init: Memory: %p(0x%x), %p(0x%x), %p(0x%x)\n", + ram[0], size[0], ram[1], size[1], ram[2], size[2]); } else { - rio_dprintk (RIO_DEBUG_INIT, "RIO-init: 0x%x(0x%x), 0x%x(0x%x), 0x%x(0x%x), 0x%x(0x%x)\n", - (int)ram[0], size[0], (int)ram[1], size[1], (int)ram[2], size[2], (int)ram[3], - size[3]); + rio_dprintk (RIO_DEBUG_INIT, "RIO-init: %p(0x%x), %p(0x%x), %p(0x%x), %p(0x%x)\n", + ram[0], size[0], ram[1], size[1], ram[2], size[2], ram[3], size[3]); } /* @@ -224,7 +202,7 @@ int slot; */ for (op=0; op<TEST_END; op++) { for (bank=0; bank<nbanks; bank++) { - if (RIOScrub(op, (BYTE *)ram[bank], size[bank]) == RIO_FAIL) { + if (RIOScrub(op, (u8 *)ram[bank], size[bank]) == RIO_FAIL) { rio_dprintk (RIO_DEBUG_INIT, "RIO-init: RIOScrub band %d, op %d failed\n", bank, op); return RIO_FAIL; @@ -233,7 +211,7 @@ int slot; } rio_dprintk (RIO_DEBUG_INIT, "Test completed\n"); - return RIO_SUCCESS; + return 0; } @@ -248,13 +226,10 @@ int slot; ** Call with op not zero, and the RAM will be read and compated with val[op-1] ** to check that the data from the previous phase was retained. */ -static int -RIOScrub(op, ram, size) -int op; -BYTE * ram; -int size; + +static int RIOScrub(int op, u8 *ram, int size) { - int off; + int off; unsigned char oldbyte; unsigned char newbyte; unsigned char invbyte; @@ -279,15 +254,15 @@ int size; */ if (op) { for (off=0; off<size; off++) { - if (RBYTE(ram[off]) != oldbyte) { - rio_dprintk (RIO_DEBUG_INIT, "RIO-init: Byte Pre Check 1: BYTE at offset 0x%x should have been=%x, was=%x\n", off, oldbyte, RBYTE(ram[off])); + if (readb(ram + off) != oldbyte) { + rio_dprintk (RIO_DEBUG_INIT, "RIO-init: Byte Pre Check 1: BYTE at offset 0x%x should have been=%x, was=%x\n", off, oldbyte, readb(ram + off)); return RIO_FAIL; } } for (off=0; off<size; off+=2) { - if (*(ushort *)&ram[off] != oldword) { - rio_dprintk (RIO_DEBUG_INIT, "RIO-init: Word Pre Check: WORD at offset 0x%x should have been=%x, was=%x\n",off,oldword,*(ushort *)&ram[off]); - rio_dprintk (RIO_DEBUG_INIT, "RIO-init: Word Pre Check: BYTE at offset 0x%x is %x BYTE at offset 0x%x is %x\n", off, RBYTE(ram[off]), off+1, RBYTE(ram[off+1])); + if (readw(ram + off) != oldword) { + rio_dprintk (RIO_DEBUG_INIT, "RIO-init: Word Pre Check: WORD at offset 0x%x should have been=%x, was=%x\n",off,oldword, readw(ram + off)); + rio_dprintk (RIO_DEBUG_INIT, "RIO-init: Word Pre Check: BYTE at offset 0x%x is %x BYTE at offset 0x%x is %x\n", off, readb(ram + off), off+1, readb(ram+off+1)); return RIO_FAIL; } } @@ -301,13 +276,13 @@ int size; ** the BYTE read/write test. */ for (off=0; off<size; off++) { - if (op && (RBYTE(ram[off]) != oldbyte)) { - rio_dprintk (RIO_DEBUG_INIT, "RIO-init: Byte Pre Check 2: BYTE at offset 0x%x should have been=%x, was=%x\n", off, oldbyte, RBYTE(ram[off])); + if (op && (readb(ram + off) != oldbyte)) { + rio_dprintk (RIO_DEBUG_INIT, "RIO-init: Byte Pre Check 2: BYTE at offset 0x%x should have been=%x, was=%x\n", off, oldbyte, readb(ram + off)); return RIO_FAIL; } - WBYTE(ram[off],invbyte); - if (RBYTE(ram[off]) != invbyte) { - rio_dprintk (RIO_DEBUG_INIT, "RIO-init: Byte Inv Check: BYTE at offset 0x%x should have been=%x, was=%x\n", off, invbyte, RBYTE(ram[off])); + writeb(invbyte, ram + off); + if (readb(ram + off) != invbyte) { + rio_dprintk (RIO_DEBUG_INIT, "RIO-init: Byte Inv Check: BYTE at offset 0x%x should have been=%x, was=%x\n", off, invbyte, readb(ram + off)); return RIO_FAIL; } } @@ -320,16 +295,16 @@ int size; ** This is the WORD operation test. */ for (off=0; off<size; off+=2) { - if (*(ushort *)&ram[off] != invword) { - rio_dprintk (RIO_DEBUG_INIT, "RIO-init: Word Inv Check: WORD at offset 0x%x should have been=%x, was=%x\n", off, invword, *(ushort *)&ram[off]); - rio_dprintk (RIO_DEBUG_INIT, "RIO-init: Word Inv Check: BYTE at offset 0x%x is %x BYTE at offset 0x%x is %x\n", off, RBYTE(ram[off]), off+1, RBYTE(ram[off+1])); + if (readw(ram + off) != invword) { + rio_dprintk (RIO_DEBUG_INIT, "RIO-init: Word Inv Check: WORD at offset 0x%x should have been=%x, was=%x\n", off, invword, readw(ram + off)); + rio_dprintk (RIO_DEBUG_INIT, "RIO-init: Word Inv Check: BYTE at offset 0x%x is %x BYTE at offset 0x%x is %x\n", off, readb(ram + off), off+1, readb(ram+off+1)); return RIO_FAIL; } - *(ushort *)&ram[off] = newword; - if ( *(ushort *)&ram[off] != newword ) { - rio_dprintk (RIO_DEBUG_INIT, "RIO-init: Post Word Check 1: WORD at offset 0x%x should have been=%x, was=%x\n", off, newword, *(ushort *)&ram[off]); - rio_dprintk (RIO_DEBUG_INIT, "RIO-init: Post Word Check 1: BYTE at offset 0x%x is %x BYTE at offset 0x%x is %x\n", off, RBYTE(ram[off]), off+1, RBYTE(ram[off+1])); + writew(newword, ram + off); + if ( readw(ram + off) != newword ) { + rio_dprintk (RIO_DEBUG_INIT, "RIO-init: Post Word Check 1: WORD at offset 0x%x should have been=%x, was=%x\n", off, newword, readw(ram + off)); + rio_dprintk (RIO_DEBUG_INIT, "RIO-init: Post Word Check 1: BYTE at offset 0x%x is %x BYTE at offset 0x%x is %x\n", off, readb(ram + off), off+1, readb(ram + off + 1)); return RIO_FAIL; } } @@ -340,16 +315,16 @@ int size; ** required test data. */ for (off=0; off<size; off++) { - if (RBYTE(ram[off]) != newbyte) { - rio_dprintk (RIO_DEBUG_INIT, "RIO-init: Post Byte Check: BYTE at offset 0x%x should have been=%x, was=%x\n", off, newbyte, RBYTE(ram[off])); + if (readb(ram + off) != newbyte) { + rio_dprintk (RIO_DEBUG_INIT, "RIO-init: Post Byte Check: BYTE at offset 0x%x should have been=%x, was=%x\n", off, newbyte, readb(ram + off)); return RIO_FAIL; } } for (off=0; off<size; off+=2) { - if ( *(ushort *)&ram[off] != newword ) { - rio_dprintk (RIO_DEBUG_INIT, "RIO-init: Post Word Check 2: WORD at offset 0x%x should have been=%x, was=%x\n", off, newword, *(ushort *)&ram[off]); - rio_dprintk (RIO_DEBUG_INIT, "RIO-init: Post Word Check 2: BYTE at offset 0x%x is %x BYTE at offset 0x%x is %x\n", off, RBYTE(ram[off]), off+1, RBYTE(ram[off+1])); + if (readw(ram + off) != newword ) { + rio_dprintk (RIO_DEBUG_INIT, "RIO-init: Post Word Check 2: WORD at offset 0x%x should have been=%x, was=%x\n", off, newword, readw(ram + off)); + rio_dprintk (RIO_DEBUG_INIT, "RIO-init: Post Word Check 2: BYTE at offset 0x%x is %x BYTE at offset 0x%x is %x\n", off, readb(ram + off), off+1, readb(ram + off + 1)); return RIO_FAIL; } } @@ -360,41 +335,37 @@ int size; swapword = invbyte | (newbyte << 8); for (off=0; off<size; off+=2) { - WBYTE(ram[off],invbyte); - WBYTE(ram[off+1],newbyte); + writeb(invbyte, &ram[off]); + writeb(newbyte, &ram[off+1]); } for ( off=0; off<size; off+=2 ) { - if (*(ushort *)&ram[off] != swapword) { - rio_dprintk (RIO_DEBUG_INIT, "RIO-init: SwapWord Check 1: WORD at offset 0x%x should have been=%x, was=%x\n", off, swapword, *((ushort *)&ram[off])); - rio_dprintk (RIO_DEBUG_INIT, "RIO-init: SwapWord Check 1: BYTE at offset 0x%x is %x BYTE at offset 0x%x is %x\n", off, RBYTE(ram[off]), off+1, RBYTE(ram[off+1])); + if (readw(ram + off) != swapword) { + rio_dprintk (RIO_DEBUG_INIT, "RIO-init: SwapWord Check 1: WORD at offset 0x%x should have been=%x, was=%x\n", off, swapword, readw(ram + off)); + rio_dprintk (RIO_DEBUG_INIT, "RIO-init: SwapWord Check 1: BYTE at offset 0x%x is %x BYTE at offset 0x%x is %x\n", off, readb(ram + off), off+1, readb(ram + off + 1)); return RIO_FAIL; } - *((ushort *)&ram[off]) = ~swapword; + writew(~swapword, ram + off); } for (off=0; off<size; off+=2) { - if (RBYTE(ram[off]) != newbyte) { - rio_dprintk (RIO_DEBUG_INIT, "RIO-init: SwapWord Check 2: BYTE at offset 0x%x should have been=%x, was=%x\n", off, newbyte, RBYTE(ram[off])); + if (readb(ram + off) != newbyte) { + rio_dprintk (RIO_DEBUG_INIT, "RIO-init: SwapWord Check 2: BYTE at offset 0x%x should have been=%x, was=%x\n", off, newbyte, readb(ram + off)); return RIO_FAIL; } - if (RBYTE(ram[off+1]) != invbyte) { - rio_dprintk (RIO_DEBUG_INIT, "RIO-init: SwapWord Check 2: BYTE at offset 0x%x should have been=%x, was=%x\n", off+1, invbyte, RBYTE(ram[off+1])); + if (readb(ram + off + 1) != invbyte) { + rio_dprintk (RIO_DEBUG_INIT, "RIO-init: SwapWord Check 2: BYTE at offset 0x%x should have been=%x, was=%x\n", off+1, invbyte, readb(ram + off + 1)); return RIO_FAIL; } - *((ushort *)&ram[off]) = newword; + writew(newword, ram + off); } - return RIO_SUCCESS; + return 0; } -int -RIODefaultName(p, HostP, UnitId) -struct rio_info * p; -struct Host * HostP; -uint UnitId; +int RIODefaultName(struct rio_info *p, struct Host *HostP, unsigned int UnitId) { - bcopy("UNKNOWN RTA X-XX",HostP->Mapping[UnitId].Name,17); + memcpy(HostP->Mapping[UnitId].Name, "UNKNOWN RTA X-XX", 17); HostP->Mapping[UnitId].Name[12]='1'+(HostP-p->RIOHosts); if ((UnitId+1) > 9) { HostP->Mapping[UnitId].Name[14]='0'+((UnitId+1)/10); @@ -412,8 +383,7 @@ uint UnitId; static struct rioVersion stVersion; -struct rioVersion * -RIOVersid(void) +struct rioVersion *RIOVersid(void) { strlcpy(stVersion.version, "RIO driver for linux V1.0", sizeof(stVersion.version)); @@ -423,40 +393,31 @@ RIOVersid(void) return &stVersion; } -void -RIOHostReset(Type, DpRamP, Slot) -uint Type; -volatile struct DpRam *DpRamP; -uint Slot; +void RIOHostReset(unsigned int Type, struct DpRam *DpRamP, unsigned int Slot) { /* ** Reset the Tpu */ rio_dprintk (RIO_DEBUG_INIT, "RIOHostReset: type 0x%x", Type); switch ( Type ) { - case RIO_AT: - rio_dprintk (RIO_DEBUG_INIT, " (RIO_AT)\n"); - WBYTE(DpRamP->DpControl, BOOT_FROM_RAM | EXTERNAL_BUS_OFF | - INTERRUPT_DISABLE | BYTE_OPERATION | - SLOW_LINKS | SLOW_AT_BUS); - WBYTE(DpRamP->DpResetTpu, 0xFF); - udelay(3); - + case RIO_AT: + rio_dprintk (RIO_DEBUG_INIT, " (RIO_AT)\n"); + writeb(BOOT_FROM_RAM | EXTERNAL_BUS_OFF | INTERRUPT_DISABLE | BYTE_OPERATION | + SLOW_LINKS | SLOW_AT_BUS, &DpRamP->DpControl); + writeb(0xFF, &DpRamP->DpResetTpu); + udelay(3); rio_dprintk (RIO_DEBUG_INIT, "RIOHostReset: Don't know if it worked. Try reset again\n"); - WBYTE(DpRamP->DpControl, BOOT_FROM_RAM | EXTERNAL_BUS_OFF | - INTERRUPT_DISABLE | BYTE_OPERATION | - SLOW_LINKS | SLOW_AT_BUS); - WBYTE(DpRamP->DpResetTpu, 0xFF); - udelay(3); - break; + writeb(BOOT_FROM_RAM | EXTERNAL_BUS_OFF | INTERRUPT_DISABLE | + BYTE_OPERATION | SLOW_LINKS | SLOW_AT_BUS, &DpRamP->DpControl); + writeb(0xFF, &DpRamP->DpResetTpu); + udelay(3); + break; case RIO_PCI: rio_dprintk (RIO_DEBUG_INIT, " (RIO_PCI)\n"); - DpRamP->DpControl = RIO_PCI_BOOT_FROM_RAM; - DpRamP->DpResetInt = 0xFF; - DpRamP->DpResetTpu = 0xFF; + writeb(RIO_PCI_BOOT_FROM_RAM, &DpRamP->DpControl); + writeb(0xFF, &DpRamP->DpResetInt); + writeb(0xFF, &DpRamP->DpResetTpu); udelay(100); - /* for (i=0; i<6000; i++); */ - /* suspend( 3 ); */ break; default: rio_dprintk (RIO_DEBUG_INIT, " (UNKNOWN)\n"); diff --git a/drivers/char/rio/riointr.c b/drivers/char/rio/riointr.c index 34d8787557a..97f0fa55065 100644 --- a/drivers/char/rio/riointr.c +++ b/drivers/char/rio/riointr.c @@ -54,15 +54,12 @@ static char *_riointr_c_sccs_ = "@(#)riointr.c 1.2"; #include "linux_compat.h" #include "rio_linux.h" -#include "typdef.h" #include "pkt.h" #include "daemon.h" #include "rio.h" #include "riospace.h" -#include "top.h" #include "cmdpkt.h" #include "map.h" -#include "riotypes.h" #include "rup.h" #include "port.h" #include "riodrvr.h" @@ -75,12 +72,10 @@ static char *_riointr_c_sccs_ = "@(#)riointr.c 1.2"; #include "unixrup.h" #include "board.h" #include "host.h" -#include "error.h" #include "phb.h" #include "link.h" #include "cmdblk.h" #include "route.h" -#include "control.h" #include "cirrus.h" #include "rioioctl.h" @@ -101,8 +96,7 @@ static char *firstchars(char *p, int nch) #define INCR( P, I ) ((P) = (((P)+(I)) & p->RIOBufferMask)) /* Enable and start the transmission of packets */ -void RIOTxEnable(en) -char *en; +void RIOTxEnable(char *en) { struct Port *PortP; struct rio_info *p; @@ -186,10 +180,8 @@ char *en; static int RupIntr; static int RxIntr; static int TxIntr; -void RIOServiceHost(p, HostP, From) -struct rio_info *p; -struct Host *HostP; -int From; + +void RIOServiceHost(struct rio_info *p, struct Host *HostP, int From) { rio_spin_lock(&HostP->HostLock); if ((HostP->Flags & RUN_STATE) != RC_RUNNING) { @@ -201,22 +193,22 @@ int From; } rio_spin_unlock(&HostP->HostLock); - if (RWORD(HostP->ParmMapP->rup_intr)) { - WWORD(HostP->ParmMapP->rup_intr, 0); + if (readw(&HostP->ParmMapP->rup_intr)) { + writew(0, &HostP->ParmMapP->rup_intr); p->RIORupCount++; RupIntr++; - rio_dprintk(RIO_DEBUG_INTR, "rio: RUP interrupt on host %d\n", HostP - p->RIOHosts); + rio_dprintk(RIO_DEBUG_INTR, "rio: RUP interrupt on host %Zd\n", HostP - p->RIOHosts); RIOPollHostCommands(p, HostP); } - if (RWORD(HostP->ParmMapP->rx_intr)) { + if (readw(&HostP->ParmMapP->rx_intr)) { int port; - WWORD(HostP->ParmMapP->rx_intr, 0); + writew(0, &HostP->ParmMapP->rx_intr); p->RIORxCount++; RxIntr++; - rio_dprintk(RIO_DEBUG_INTR, "rio: RX interrupt on host %d\n", HostP - p->RIOHosts); + rio_dprintk(RIO_DEBUG_INTR, "rio: RX interrupt on host %Zd\n", HostP - p->RIOHosts); /* ** Loop through every port. If the port is mapped into ** the system ( i.e. has /dev/ttyXXXX associated ) then it is @@ -277,26 +269,26 @@ int From; ** it's handshake bit is set, then we must clear the handshake, ** so that that downstream RTA is re-enabled. */ - if (!can_remove_receive(&PacketP, PortP) && (RWORD(PortP->PhbP->handshake) == PHB_HANDSHAKE_SET)) { + if (!can_remove_receive(&PacketP, PortP) && (readw(&PortP->PhbP->handshake) == PHB_HANDSHAKE_SET)) { /* ** MAGIC! ( Basically, handshake the RX buffer, so that ** the RTAs upstream can be re-enabled. ) */ rio_dprintk(RIO_DEBUG_INTR, "Set RX handshake bit\n"); - WWORD(PortP->PhbP->handshake, PHB_HANDSHAKE_SET | PHB_HANDSHAKE_RESET); + writew(PHB_HANDSHAKE_SET | PHB_HANDSHAKE_RESET, &PortP->PhbP->handshake); } rio_spin_unlock(&PortP->portSem); } } - if (RWORD(HostP->ParmMapP->tx_intr)) { + if (readw(&HostP->ParmMapP->tx_intr)) { int port; - WWORD(HostP->ParmMapP->tx_intr, 0); + writew(0, &HostP->ParmMapP->tx_intr); p->RIOTxCount++; TxIntr++; - rio_dprintk(RIO_DEBUG_INTR, "rio: TX interrupt on host %d\n", HostP - p->RIOHosts); + rio_dprintk(RIO_DEBUG_INTR, "rio: TX interrupt on host %Zd\n", HostP - p->RIOHosts); /* ** Loop through every port. @@ -399,7 +391,6 @@ int From; /* For now don't handle RTA reboots. -- REW. Reenabled. Otherwise RTA reboots didn't work. Duh. -- REW */ if (PortP->MagicFlags) { -#if 1 if (PortP->MagicFlags & MAGIC_REBOOT) { /* ** well, the RTA has been rebooted, and there is room @@ -416,13 +407,12 @@ int From; PortP->InUse = NOT_INUSE; rio_spin_unlock(&PortP->portSem); - if (RIOParam(PortP, OPEN, ((PortP->Cor2Copy & (COR2_RTSFLOW | COR2_CTSFLOW)) == (COR2_RTSFLOW | COR2_CTSFLOW)) ? TRUE : FALSE, DONT_SLEEP) == RIO_FAIL) { + if (RIOParam(PortP, OPEN, ((PortP->Cor2Copy & (COR2_RTSFLOW | COR2_CTSFLOW)) == (COR2_RTSFLOW | COR2_CTSFLOW)) ? 1 : 0, DONT_SLEEP) == RIO_FAIL) { continue; /* with next port */ } rio_spin_lock(&PortP->portSem); PortP->MagicFlags &= ~MAGIC_REBOOT; } -#endif /* ** As mentioned above, this is a tacky hack to cope @@ -445,9 +435,9 @@ int From; */ PktCmdP = (struct PktCmd *) &PacketP->data[0]; - WBYTE(PktCmdP->Command, WFLUSH); + writeb(WFLUSH, &PktCmdP->Command); - p = PortP->HostPort % (ushort) PORTS_PER_RTA; + p = PortP->HostPort % (u16) PORTS_PER_RTA; /* ** If second block of ports for 16 port RTA, add 8 @@ -456,27 +446,27 @@ int From; if (PortP->SecondBlock) p += PORTS_PER_RTA; - WBYTE(PktCmdP->PhbNum, p); + writeb(p, &PktCmdP->PhbNum); /* ** to make debuggery easier */ - WBYTE(PacketP->data[2], 'W'); - WBYTE(PacketP->data[3], 'F'); - WBYTE(PacketP->data[4], 'L'); - WBYTE(PacketP->data[5], 'U'); - WBYTE(PacketP->data[6], 'S'); - WBYTE(PacketP->data[7], 'H'); - WBYTE(PacketP->data[8], ' '); - WBYTE(PacketP->data[9], '0' + PortP->WflushFlag); - WBYTE(PacketP->data[10], ' '); - WBYTE(PacketP->data[11], ' '); - WBYTE(PacketP->data[12], '\0'); + writeb('W', &PacketP->data[2]); + writeb('F', &PacketP->data[3]); + writeb('L', &PacketP->data[4]); + writeb('U', &PacketP->data[5]); + writeb('S', &PacketP->data[6]); + writeb('H', &PacketP->data[7]); + writeb(' ', &PacketP->data[8]); + writeb('0' + PortP->WflushFlag, &PacketP->data[9]); + writeb(' ', &PacketP->data[10]); + writeb(' ', &PacketP->data[11]); + writeb('\0', &PacketP->data[12]); /* ** its two bytes long! */ - WBYTE(PacketP->len, PKT_CMD_BIT | 2); + writeb(PKT_CMD_BIT | 2, &PacketP->len); /* ** queue it! @@ -529,19 +519,15 @@ int From; } /* -** Routine for handling received data for clist drivers. -** NB: Called with the tty locked. The spl from the lockb( ) is passed. -** we return the ttySpl level that we re-locked at. +** Routine for handling received data for tty drivers */ -static void RIOReceive(p, PortP) -struct rio_info *p; -struct Port *PortP; +static void RIOReceive(struct rio_info *p, struct Port *PortP) { struct tty_struct *TtyP; - register ushort transCount; + unsigned short transCount; struct PKT *PacketP; - register uint DataCnt; - uchar *ptr; + register unsigned int DataCnt; + unsigned char *ptr; unsigned char *buf; int copied = 0; @@ -594,9 +580,6 @@ struct Port *PortP; transCount = 1; while (can_remove_receive(&PacketP, PortP) && transCount) { -#ifdef STATS - PortP->Stat.RxIntCnt++; -#endif /* STATS */ RxIntCnt++; /* @@ -642,28 +625,15 @@ struct Port *PortP; ** to '#define', (this is the only place ___DEBUG_IT___ occurs in the ** driver). */ -#undef ___DEBUG_IT___ -#ifdef ___DEBUG_IT___ - kkprintf("I:%d R:%d P:%d Q:%d C:%d F:%x ", intCount, RxIntCnt, PortP->PortNum, TtyP->rxqueue.count, transCount, TtyP->flags); -#endif - ptr = (uchar *) PacketP->data + PortP->RxDataStart; + ptr = (unsigned char *) PacketP->data + PortP->RxDataStart; tty_prepare_flip_string(TtyP, &buf, transCount); rio_memcpy_fromio(buf, ptr, transCount); -#ifdef STATS - /* - ** keep a count for statistical purposes - */ - PortP->Stat.RxCharCnt += transCount; -#endif PortP->RxDataStart += transCount; PacketP->len -= transCount; copied += transCount; -#ifdef ___DEBUG_IT___ - kkprintf("T:%d L:%d\n", DataCnt, PacketP->len); -#endif if (PacketP->len == 0) { /* @@ -674,12 +644,6 @@ struct Port *PortP; remove_receive(PortP); put_free_end(PortP->HostP, PacketP); PortP->RxDataStart = 0; -#ifdef STATS - /* - ** more lies ( oops, I mean statistics ) - */ - PortP->Stat.RxPktCnt++; -#endif /* STATS */ } } } @@ -691,215 +655,3 @@ struct Port *PortP; return; } -#ifdef FUTURE_RELEASE -/* -** The proc routine called by the line discipline to do the work for it. -** The proc routine works hand in hand with the interrupt routine. -*/ -int riotproc(p, tp, cmd, port) -struct rio_info *p; -register struct ttystatics *tp; -int cmd; -int port; -{ - register struct Port *PortP; - int SysPort; - struct PKT *PacketP; - - SysPort = port; /* Believe me, it works. */ - - if (SysPort < 0 || SysPort >= RIO_PORTS) { - rio_dprintk(RIO_DEBUG_INTR, "Illegal port %d derived from TTY in riotproc()\n", SysPort); - return 0; - } - PortP = p->RIOPortp[SysPort]; - - if ((uint) PortP->PhbP < (uint) PortP->Caddr || (uint) PortP->PhbP >= (uint) PortP->Caddr + SIXTY_FOUR_K) { - rio_dprintk(RIO_DEBUG_INTR, "RIO: NULL or BAD PhbP on sys port %d in proc routine\n", SysPort); - rio_dprintk(RIO_DEBUG_INTR, " PortP = 0x%x\n", PortP); - rio_dprintk(RIO_DEBUG_INTR, " PortP->PhbP = 0x%x\n", PortP->PhbP); - rio_dprintk(RIO_DEBUG_INTR, " PortP->Caddr = 0x%x\n", PortP->PhbP); - rio_dprintk(RIO_DEBUG_INTR, " PortP->HostPort = 0x%x\n", PortP->HostPort); - return 0; - } - - switch (cmd) { - case T_WFLUSH: - rio_dprintk(RIO_DEBUG_INTR, "T_WFLUSH\n"); - /* - ** Because of the spooky way the RIO works, we don't need - ** to issue a flush command on any of the SET*F commands, - ** as that causes trouble with getty and login, which issue - ** these commands to incur a READ flush, and rely on the fact - ** that the line discipline does a wait for drain for them. - ** As the rio doesn't wait for drain, the write flush would - ** destroy the Password: prompt. This isn't very friendly, so - ** here we only issue a WFLUSH command if we are in the interrupt - ** routine, or we aren't executing a SET*F command. - */ - if (PortP->HostP->InIntr || !PortP->FlushCmdBodge) { - /* - ** form a wflush packet - 1 byte long, no data - */ - if (PortP->State & RIO_DELETED) { - rio_dprintk(RIO_DEBUG_INTR, "WFLUSH on deleted RTA\n"); - } else { - if (RIOPreemptiveCmd(p, PortP, WFLUSH) == RIO_FAIL) { - rio_dprintk(RIO_DEBUG_INTR, "T_WFLUSH Command failed\n"); - } else - rio_dprintk(RIO_DEBUG_INTR, "T_WFLUSH Command\n"); - } - /* - ** WFLUSH operation - flush the data! - */ - PortP->TxBufferIn = PortP->TxBufferOut = 0; - } else { - rio_dprintk(RIO_DEBUG_INTR, "T_WFLUSH Command ignored\n"); - } - /* - ** sort out the line discipline - */ - if (PortP->CookMode == COOK_WELL) - goto start; - break; - - case T_RESUME: - rio_dprintk(RIO_DEBUG_INTR, "T_RESUME\n"); - /* - ** send pre-emptive resume packet - */ - if (PortP->State & RIO_DELETED) { - rio_dprintk(RIO_DEBUG_INTR, "RESUME on deleted RTA\n"); - } else { - if (RIOPreemptiveCmd(p, PortP, RESUME) == RIO_FAIL) { - rio_dprintk(RIO_DEBUG_INTR, "T_RESUME Command failed\n"); - } - } - /* - ** and re-start the sender software! - */ - if (PortP->CookMode == COOK_WELL) - goto start; - break; - - case T_TIME: - rio_dprintk(RIO_DEBUG_INTR, "T_TIME\n"); - /* - ** T_TIME is called when xDLY is set in oflags and - ** the line discipline timeout has expired. It's - ** function in life is to clear the TIMEOUT flag - ** and to re-start output to the port. - */ - /* - ** Fall through and re-start output - */ - case T_OUTPUT: - start: - if (PortP->MagicFlags & MAGIC_FLUSH) { - PortP->MagicFlags |= MORE_OUTPUT_EYGOR; - return 0; - } - RIOTxEnable((char *) PortP); - PortP->MagicFlags &= ~MORE_OUTPUT_EYGOR; - /*rio_dprint(RIO_DEBUG_INTR, PortP,DBG_PROC,"T_OUTPUT finished\n"); */ - break; - - case T_SUSPEND: - rio_dprintk(RIO_DEBUG_INTR, "T_SUSPEND\n"); - /* - ** send a suspend pre-emptive packet. - */ - if (PortP->State & RIO_DELETED) { - rio_dprintk(RIO_DEBUG_INTR, "SUSPEND deleted RTA\n"); - } else { - if (RIOPreemptiveCmd(p, PortP, SUSPEND) == RIO_FAIL) { - rio_dprintk(RIO_DEBUG_INTR, "T_SUSPEND Command failed\n"); - } - } - /* - ** done! - */ - break; - - case T_BLOCK: - rio_dprintk(RIO_DEBUG_INTR, "T_BLOCK\n"); - break; - - case T_RFLUSH: - rio_dprintk(RIO_DEBUG_INTR, "T_RFLUSH\n"); - if (PortP->State & RIO_DELETED) { - rio_dprintk(RIO_DEBUG_INTR, "RFLUSH on deleted RTA\n"); - PortP->RxDataStart = 0; - } else { - if (RIOPreemptiveCmd(p, PortP, RFLUSH) == RIO_FAIL) { - rio_dprintk(RIO_DEBUG_INTR, "T_RFLUSH Command failed\n"); - return 0; - } - PortP->RxDataStart = 0; - while (can_remove_receive(&PacketP, PortP)) { - remove_receive(PortP); - ShowPacket(DBG_PROC, PacketP); - put_free_end(PortP->HostP, PacketP); - } - if (PortP->PhbP->handshake == PHB_HANDSHAKE_SET) { - /* - ** MAGIC! - */ - rio_dprintk(RIO_DEBUG_INTR, "Set receive handshake bit\n"); - PortP->PhbP->handshake |= PHB_HANDSHAKE_RESET; - } - } - break; - /* FALLTHROUGH */ - case T_UNBLOCK: - rio_dprintk(RIO_DEBUG_INTR, "T_UNBLOCK\n"); - /* - ** If there is any data to receive set a timeout to service it. - */ - RIOReceive(p, PortP); - break; - - case T_BREAK: - rio_dprintk(RIO_DEBUG_INTR, "T_BREAK\n"); - /* - ** Send a break command. For Sys V - ** this is a timed break, so we - ** send a SBREAK[time] packet - */ - /* - ** Build a BREAK command - */ - if (PortP->State & RIO_DELETED) { - rio_dprintk(RIO_DEBUG_INTR, "BREAK on deleted RTA\n"); - } else { - if (RIOShortCommand(PortP, SBREAK, 2, p->RIOConf.BreakInterval) == RIO_FAIL) { - rio_dprintk(RIO_DEBUG_INTR, "SBREAK RIOShortCommand failed\n"); - } - } - - /* - ** done! - */ - break; - - case T_INPUT: - rio_dprintk(RIO_DEBUG_INTR, "Proc T_INPUT called - I don't know what to do!\n"); - break; - case T_PARM: - rio_dprintk(RIO_DEBUG_INTR, "Proc T_PARM called - I don't know what to do!\n"); - break; - - case T_SWTCH: - rio_dprintk(RIO_DEBUG_INTR, "Proc T_SWTCH called - I don't know what to do!\n"); - break; - - default: - rio_dprintk(RIO_DEBUG_INTR, "Proc UNKNOWN command %d\n", cmd); - } - /* - ** T_OUTPUT returns without passing through this point! - */ - /*rio_dprint(RIO_DEBUG_INTR, PortP,DBG_PROC,"riotproc done\n"); */ - return (0); -} -#endif diff --git a/drivers/char/rio/rioparam.c b/drivers/char/rio/rioparam.c index c622f46d6d7..d2e8092cdb2 100644 --- a/drivers/char/rio/rioparam.c +++ b/drivers/char/rio/rioparam.c @@ -52,15 +52,12 @@ static char *_rioparam_c_sccs_ = "@(#)rioparam.c 1.3"; #include "linux_compat.h" #include "rio_linux.h" -#include "typdef.h" #include "pkt.h" #include "daemon.h" #include "rio.h" #include "riospace.h" -#include "top.h" #include "cmdpkt.h" #include "map.h" -#include "riotypes.h" #include "rup.h" #include "port.h" #include "riodrvr.h" @@ -73,17 +70,13 @@ static char *_rioparam_c_sccs_ = "@(#)rioparam.c 1.3"; #include "unixrup.h" #include "board.h" #include "host.h" -#include "error.h" #include "phb.h" #include "link.h" #include "cmdblk.h" #include "route.h" -#include "control.h" #include "cirrus.h" #include "rioioctl.h" #include "param.h" -#include "list.h" -#include "sam.h" @@ -157,20 +150,16 @@ static char *_rioparam_c_sccs_ = "@(#)rioparam.c 1.3"; ** NB. for MPX ** tty lock must NOT have been previously acquired. */ -int RIOParam(PortP, cmd, Modem, SleepFlag) -struct Port *PortP; -int cmd; -int Modem; -int SleepFlag; +int RIOParam(struct Port *PortP, int cmd, int Modem, int SleepFlag) { - register struct tty_struct *TtyP; + struct tty_struct *TtyP; int retval; - register struct phb_param *phb_param_ptr; - PKT *PacketP; + struct phb_param *phb_param_ptr; + struct PKT *PacketP; int res; - uchar Cor1 = 0, Cor2 = 0, Cor4 = 0, Cor5 = 0; - uchar TxXon = 0, TxXoff = 0, RxXon = 0, RxXoff = 0; - uchar LNext = 0, TxBaud = 0, RxBaud = 0; + u8 Cor1 = 0, Cor2 = 0, Cor4 = 0, Cor5 = 0; + u8 TxXon = 0, TxXoff = 0, RxXon = 0, RxXoff = 0; + u8 LNext = 0, TxBaud = 0, RxBaud = 0; int retries = 0xff; unsigned long flags; @@ -226,16 +215,13 @@ int SleepFlag; if (retval == RIO_FAIL) { rio_dprintk(RIO_DEBUG_PARAM, "wait for can_add_transmit broken by signal\n"); rio_spin_unlock_irqrestore(&PortP->portSem, flags); - pseterr(EINTR); func_exit(); - - return RIO_FAIL; + return -EINTR; } if (PortP->State & RIO_DELETED) { rio_spin_unlock_irqrestore(&PortP->portSem, flags); func_exit(); - - return RIO_SUCCESS; + return 0; } } @@ -247,7 +233,7 @@ int SleepFlag; } rio_dprintk(RIO_DEBUG_PARAM, "can_add_transmit() returns %x\n", res); - rio_dprintk(RIO_DEBUG_PARAM, "Packet is 0x%x\n", (int) PacketP); + rio_dprintk(RIO_DEBUG_PARAM, "Packet is %p\n", PacketP); phb_param_ptr = (struct phb_param *) PacketP->data; @@ -474,9 +460,6 @@ int SleepFlag; e(115200); /* e(230400);e(460800); e(921600); */ } - /* XXX MIssing conversion table. XXX */ - /* (TtyP->termios->c_cflag & V_CBAUD); */ - rio_dprintk(RIO_DEBUG_PARAM, "tx baud 0x%x, rx baud 0x%x\n", TxBaud, RxBaud); @@ -552,23 +535,23 @@ int SleepFlag; /* ** Actually write the info into the packet to be sent */ - WBYTE(phb_param_ptr->Cmd, cmd); - WBYTE(phb_param_ptr->Cor1, Cor1); - WBYTE(phb_param_ptr->Cor2, Cor2); - WBYTE(phb_param_ptr->Cor4, Cor4); - WBYTE(phb_param_ptr->Cor5, Cor5); - WBYTE(phb_param_ptr->TxXon, TxXon); - WBYTE(phb_param_ptr->RxXon, RxXon); - WBYTE(phb_param_ptr->TxXoff, TxXoff); - WBYTE(phb_param_ptr->RxXoff, RxXoff); - WBYTE(phb_param_ptr->LNext, LNext); - WBYTE(phb_param_ptr->TxBaud, TxBaud); - WBYTE(phb_param_ptr->RxBaud, RxBaud); + writeb(cmd, &phb_param_ptr->Cmd); + writeb(Cor1, &phb_param_ptr->Cor1); + writeb(Cor2, &phb_param_ptr->Cor2); + writeb(Cor4, &phb_param_ptr->Cor4); + writeb(Cor5, &phb_param_ptr->Cor5); + writeb(TxXon, &phb_param_ptr->TxXon); + writeb(RxXon, &phb_param_ptr->RxXon); + writeb(TxXoff, &phb_param_ptr->TxXoff); + writeb(RxXoff, &phb_param_ptr->RxXoff); + writeb(LNext, &phb_param_ptr->LNext); + writeb(TxBaud, &phb_param_ptr->TxBaud); + writeb(RxBaud, &phb_param_ptr->RxBaud); /* ** Set the length/command field */ - WBYTE(PacketP->len, 12 | PKT_CMD_BIT); + writeb(12 | PKT_CMD_BIT, &PacketP->len); /* ** The packet is formed - now, whack it off @@ -589,7 +572,7 @@ int SleepFlag; */ func_exit(); - return RIO_SUCCESS; + return 0; } @@ -597,15 +580,13 @@ int SleepFlag; ** We can add another packet to a transmit queue if the packet pointer pointed ** to by the TxAdd pointer has PKT_IN_USE clear in its address. */ -int can_add_transmit(PktP, PortP) -PKT **PktP; -struct Port *PortP; +int can_add_transmit(struct PKT **PktP, struct Port *PortP) { - register PKT *tp; + struct PKT *tp; - *PktP = tp = (PKT *) RIO_PTR(PortP->Caddr, RWORD(*PortP->TxAdd)); + *PktP = tp = (struct PKT *) RIO_PTR(PortP->Caddr, readw(PortP->TxAdd)); - return !((uint) tp & PKT_IN_USE); + return !((unsigned long) tp & PKT_IN_USE); } /* @@ -613,27 +594,24 @@ struct Port *PortP; ** and then move the TxAdd pointer along one position to point to the next ** packet pointer. You must wrap the pointer from the end back to the start. */ -void add_transmit(PortP) -struct Port *PortP; +void add_transmit(struct Port *PortP) { - if (RWORD(*PortP->TxAdd) & PKT_IN_USE) { + if (readw(PortP->TxAdd) & PKT_IN_USE) { rio_dprintk(RIO_DEBUG_PARAM, "add_transmit: Packet has been stolen!"); } - WWORD(*(ushort *) PortP->TxAdd, RWORD(*PortP->TxAdd) | PKT_IN_USE); + writew(readw(PortP->TxAdd) | PKT_IN_USE, PortP->TxAdd); PortP->TxAdd = (PortP->TxAdd == PortP->TxEnd) ? PortP->TxStart : PortP->TxAdd + 1; - WWORD(PortP->PhbP->tx_add, RIO_OFF(PortP->Caddr, PortP->TxAdd)); + writew(RIO_OFF(PortP->Caddr, PortP->TxAdd), &PortP->PhbP->tx_add); } /**************************************** * Put a packet onto the end of the * free list ****************************************/ -void put_free_end(HostP, PktP) -struct Host *HostP; -PKT *PktP; +void put_free_end(struct Host *HostP, struct PKT *PktP) { - FREE_LIST *tmp_pointer; - ushort old_end, new_end; + struct rio_free_list *tmp_pointer; + unsigned short old_end, new_end; unsigned long flags; rio_spin_lock_irqsave(&HostP->HostLock, flags); @@ -643,21 +621,21 @@ PKT *PktP; * ************************************************/ - rio_dprintk(RIO_DEBUG_PFE, "put_free_end(PktP=%x)\n", (int) PktP); + rio_dprintk(RIO_DEBUG_PFE, "put_free_end(PktP=%p)\n", PktP); - if ((old_end = RWORD(HostP->ParmMapP->free_list_end)) != TPNULL) { + if ((old_end = readw(&HostP->ParmMapP->free_list_end)) != TPNULL) { new_end = RIO_OFF(HostP->Caddr, PktP); - tmp_pointer = (FREE_LIST *) RIO_PTR(HostP->Caddr, old_end); - WWORD(tmp_pointer->next, new_end); - WWORD(((FREE_LIST *) PktP)->prev, old_end); - WWORD(((FREE_LIST *) PktP)->next, TPNULL); - WWORD(HostP->ParmMapP->free_list_end, new_end); + tmp_pointer = (struct rio_free_list *) RIO_PTR(HostP->Caddr, old_end); + writew(new_end, &tmp_pointer->next); + writew(old_end, &((struct rio_free_list *) PktP)->prev); + writew(TPNULL, &((struct rio_free_list *) PktP)->next); + writew(new_end, &HostP->ParmMapP->free_list_end); } else { /* First packet on the free list this should never happen! */ rio_dprintk(RIO_DEBUG_PFE, "put_free_end(): This should never happen\n"); - WWORD(HostP->ParmMapP->free_list_end, RIO_OFF(HostP->Caddr, PktP)); - tmp_pointer = (FREE_LIST *) PktP; - WWORD(tmp_pointer->prev, TPNULL); - WWORD(tmp_pointer->next, TPNULL); + writew(RIO_OFF(HostP->Caddr, PktP), &HostP->ParmMapP->free_list_end); + tmp_pointer = (struct rio_free_list *) PktP; + writew(TPNULL, &tmp_pointer->prev); + writew(TPNULL, &tmp_pointer->next); } rio_dprintk(RIO_DEBUG_CMD, "Before unlock: %p\n", &HostP->HostLock); rio_spin_unlock_irqrestore(&HostP->HostLock, flags); @@ -669,12 +647,10 @@ PKT *PktP; ** relevant packet, [having cleared the PKT_IN_USE bit]. If PKT_IN_USE is clear, ** then can_remove_receive() returns 0. */ -int can_remove_receive(PktP, PortP) -PKT **PktP; -struct Port *PortP; +int can_remove_receive(struct PKT **PktP, struct Port *PortP) { - if (RWORD(*PortP->RxRemove) & PKT_IN_USE) { - *PktP = (PKT *) RIO_PTR(PortP->Caddr, RWORD(*PortP->RxRemove) & ~PKT_IN_USE); + if (readw(PortP->RxRemove) & PKT_IN_USE) { + *PktP = (struct PKT *) RIO_PTR(PortP->Caddr, readw(PortP->RxRemove) & ~PKT_IN_USE); return 1; } return 0; @@ -685,10 +661,9 @@ struct Port *PortP; ** and then bump the pointers. Once the pointers get to the end, they must ** be wrapped back to the start. */ -void remove_receive(PortP) -struct Port *PortP; +void remove_receive(struct Port *PortP) { - WWORD(*PortP->RxRemove, RWORD(*PortP->RxRemove) & ~PKT_IN_USE); + writew(readw(PortP->RxRemove) & ~PKT_IN_USE, PortP->RxRemove); PortP->RxRemove = (PortP->RxRemove == PortP->RxEnd) ? PortP->RxStart : PortP->RxRemove + 1; - WWORD(PortP->PhbP->rx_remove, RIO_OFF(PortP->Caddr, PortP->RxRemove)); + writew(RIO_OFF(PortP->Caddr, PortP->RxRemove), &PortP->PhbP->rx_remove); } diff --git a/drivers/char/rio/riopcicopy.c b/drivers/char/rio/riopcicopy.c deleted file mode 100644 index 535afaa51ca..00000000000 --- a/drivers/char/rio/riopcicopy.c +++ /dev/null @@ -1,8 +0,0 @@ - -/* Yeah. We have copyright on this one. Sure. */ - -void rio_pcicopy(char *from, char *to, int amount) -{ - while (amount--) - *to++ = *from++; -} diff --git a/drivers/char/rio/rioroute.c b/drivers/char/rio/rioroute.c index f98888f5265..35708533794 100644 --- a/drivers/char/rio/rioroute.c +++ b/drivers/char/rio/rioroute.c @@ -50,15 +50,12 @@ static char *_rioroute_c_sccs_ = "@(#)rioroute.c 1.3"; #include "linux_compat.h" #include "rio_linux.h" -#include "typdef.h" #include "pkt.h" #include "daemon.h" #include "rio.h" #include "riospace.h" -#include "top.h" #include "cmdpkt.h" #include "map.h" -#include "riotypes.h" #include "rup.h" #include "port.h" #include "riodrvr.h" @@ -71,29 +68,25 @@ static char *_rioroute_c_sccs_ = "@(#)rioroute.c 1.3"; #include "unixrup.h" #include "board.h" #include "host.h" -#include "error.h" #include "phb.h" #include "link.h" #include "cmdblk.h" #include "route.h" -#include "control.h" #include "cirrus.h" #include "rioioctl.h" #include "param.h" -#include "list.h" -#include "sam.h" -static int RIOCheckIsolated(struct rio_info *, struct Host *, uint); -static int RIOIsolate(struct rio_info *, struct Host *, uint); -static int RIOCheck(struct Host *, uint); -static void RIOConCon(struct rio_info *, struct Host *, uint, uint, uint, uint, int); +static int RIOCheckIsolated(struct rio_info *, struct Host *, unsigned int); +static int RIOIsolate(struct rio_info *, struct Host *, unsigned int); +static int RIOCheck(struct Host *, unsigned int); +static void RIOConCon(struct rio_info *, struct Host *, unsigned int, unsigned int, unsigned int, unsigned int, int); /* ** Incoming on the ROUTE_RUP ** I wrote this while I was tired. Forgive me. */ -int RIORouteRup(struct rio_info *p, uint Rup, struct Host *HostP, PKT * PacketP) +int RIORouteRup(struct rio_info *p, unsigned int Rup, struct Host *HostP, struct PKT * PacketP) { struct PktCmd *PktCmdP = (struct PktCmd *) PacketP->data; struct PktCmd_M *PktReplyP; @@ -104,10 +97,10 @@ int RIORouteRup(struct rio_info *p, uint Rup, struct Host *HostP, PKT * PacketP) int ThisLink, ThisLinkMin, ThisLinkMax; int port; int Mod, Mod1, Mod2; - ushort RtaType; - uint RtaUniq; - uint ThisUnit, ThisUnit2; /* 2 ids to accommodate 16 port RTA */ - uint OldUnit, NewUnit, OldLink, NewLink; + unsigned short RtaType; + unsigned int RtaUniq; + unsigned int ThisUnit, ThisUnit2; /* 2 ids to accommodate 16 port RTA */ + unsigned int OldUnit, NewUnit, OldLink, NewLink; char *MyType, *MyName; int Lies; unsigned long flags; @@ -115,7 +108,7 @@ int RIORouteRup(struct rio_info *p, uint Rup, struct Host *HostP, PKT * PacketP) /* ** Is this unit telling us it's current link topology? */ - if (RBYTE(PktCmdP->Command) == ROUTE_TOPOLOGY) { + if (readb(&PktCmdP->Command) == ROUTE_TOPOLOGY) { MapP = HostP->Mapping; /* @@ -125,7 +118,7 @@ int RIORouteRup(struct rio_info *p, uint Rup, struct Host *HostP, PKT * PacketP) ** from an RTA then we need to fill in the Mapping structure's ** Topology array for the unit. */ - if (Rup >= (ushort) MAX_RUP) { + if (Rup >= (unsigned short) MAX_RUP) { ThisUnit = HOST_ID; TopP = HostP->Topology; MyType = "Host"; @@ -151,11 +144,11 @@ int RIORouteRup(struct rio_info *p, uint Rup, struct Host *HostP, PKT * PacketP) ** it won't lie about network interconnect, total disconnects ** and no-IDs. (or at least, it doesn't *matter* if it does) */ - if (RBYTE(PktCmdP->RouteTopology[ThisLink].Unit) > (ushort) MAX_RUP) + if (readb(&PktCmdP->RouteTopology[ThisLink].Unit) > (unsigned short) MAX_RUP) continue; for (NewLink = ThisLinkMin; NewLink < ThisLink; NewLink++) { - if ((RBYTE(PktCmdP->RouteTopology[ThisLink].Unit) == RBYTE(PktCmdP->RouteTopology[NewLink].Unit)) && (RBYTE(PktCmdP->RouteTopology[ThisLink].Link) == RBYTE(PktCmdP->RouteTopology[NewLink].Link))) { + if ((readb(&PktCmdP->RouteTopology[ThisLink].Unit) == readb(&PktCmdP->RouteTopology[NewLink].Unit)) && (readb(&PktCmdP->RouteTopology[ThisLink].Link) == readb(&PktCmdP->RouteTopology[NewLink].Link))) { Lies++; } } @@ -164,11 +157,11 @@ int RIORouteRup(struct rio_info *p, uint Rup, struct Host *HostP, PKT * PacketP) if (Lies) { rio_dprintk(RIO_DEBUG_ROUTE, "LIES! DAMN LIES! %d LIES!\n", Lies); rio_dprintk(RIO_DEBUG_ROUTE, "%d:%c %d:%c %d:%c %d:%c\n", - RBYTE(PktCmdP->RouteTopology[0].Unit), - 'A' + RBYTE(PktCmdP->RouteTopology[0].Link), - RBYTE(PktCmdP->RouteTopology[1].Unit), - 'A' + RBYTE(PktCmdP->RouteTopology[1].Link), RBYTE(PktCmdP->RouteTopology[2].Unit), 'A' + RBYTE(PktCmdP->RouteTopology[2].Link), RBYTE(PktCmdP->RouteTopology[3].Unit), 'A' + RBYTE(PktCmdP->RouteTopology[3].Link)); - return TRUE; + readb(&PktCmdP->RouteTopology[0].Unit), + 'A' + readb(&PktCmdP->RouteTopology[0].Link), + readb(&PktCmdP->RouteTopology[1].Unit), + 'A' + readb(&PktCmdP->RouteTopology[1].Link), readb(&PktCmdP->RouteTopology[2].Unit), 'A' + readb(&PktCmdP->RouteTopology[2].Link), readb(&PktCmdP->RouteTopology[3].Unit), 'A' + readb(&PktCmdP->RouteTopology[3].Link)); + return 1; } /* @@ -184,8 +177,8 @@ int RIORouteRup(struct rio_info *p, uint Rup, struct Host *HostP, PKT * PacketP) /* ** this is what it is now connected to */ - NewUnit = RBYTE(PktCmdP->RouteTopology[ThisLink].Unit); - NewLink = RBYTE(PktCmdP->RouteTopology[ThisLink].Link); + NewUnit = readb(&PktCmdP->RouteTopology[ThisLink].Unit); + NewLink = readb(&PktCmdP->RouteTopology[ThisLink].Link); if (OldUnit != NewUnit || OldLink != NewLink) { /* @@ -219,7 +212,7 @@ int RIORouteRup(struct rio_info *p, uint Rup, struct Host *HostP, PKT * PacketP) if (NewUnit == ROUTE_INTERCONNECT) { if (!p->RIONoMessage) - cprintf("%s '%s' (%c) is connected to another network.\n", MyType, MyName, 'A' + ThisLink); + printk(KERN_DEBUG "rio: %s '%s' (%c) is connected to another network.\n", MyType, MyName, 'A' + ThisLink); } /* @@ -258,18 +251,18 @@ int RIORouteRup(struct rio_info *p, uint Rup, struct Host *HostP, PKT * PacketP) RIOCheckIsolated(p, HostP, OldUnit); } } - return TRUE; + return 1; } /* ** The only other command we recognise is a route_request command */ - if (RBYTE(PktCmdP->Command) != ROUTE_REQUEST) { - rio_dprintk(RIO_DEBUG_ROUTE, "Unknown command %d received on rup %d host %d ROUTE_RUP\n", RBYTE(PktCmdP->Command), Rup, (int) HostP); - return TRUE; + if (readb(&PktCmdP->Command) != ROUTE_REQUEST) { + rio_dprintk(RIO_DEBUG_ROUTE, "Unknown command %d received on rup %d host %p ROUTE_RUP\n", readb(&PktCmdP->Command), Rup, HostP); + return 1; } - RtaUniq = (RBYTE(PktCmdP->UniqNum[0])) + (RBYTE(PktCmdP->UniqNum[1]) << 8) + (RBYTE(PktCmdP->UniqNum[2]) << 16) + (RBYTE(PktCmdP->UniqNum[3]) << 24); + RtaUniq = (readb(&PktCmdP->UniqNum[0])) + (readb(&PktCmdP->UniqNum[1]) << 8) + (readb(&PktCmdP->UniqNum[2]) << 16) + (readb(&PktCmdP->UniqNum[3]) << 24); /* ** Determine if 8 or 16 port RTA @@ -278,7 +271,7 @@ int RIORouteRup(struct rio_info *p, uint Rup, struct Host *HostP, PKT * PacketP) rio_dprintk(RIO_DEBUG_ROUTE, "Received a request for an ID for serial number %x\n", RtaUniq); - Mod = RBYTE(PktCmdP->ModuleTypes); + Mod = readb(&PktCmdP->ModuleTypes); Mod1 = LONYBLE(Mod); if (RtaType == TYPE_RTA16) { /* @@ -292,10 +285,6 @@ int RIORouteRup(struct rio_info *p, uint Rup, struct Host *HostP, PKT * PacketP) rio_dprintk(RIO_DEBUG_ROUTE, "Module types are %s (ports 0-3) and %s (ports 4-7)\n", p->RIOModuleTypes[Mod1].Name, p->RIOModuleTypes[Mod2].Name); } - if (RtaUniq == 0xffffffff) { - ShowPacket(DBG_SPECIAL, PacketP); - } - /* ** try to unhook a command block from the command free list. */ @@ -320,7 +309,7 @@ int RIORouteRup(struct rio_info *p, uint Rup, struct Host *HostP, PKT * PacketP) PktReplyP->Command = ROUTE_FOAD; HostP->Copy("RT_FOAD", PktReplyP->CommandText, 7); RIOQueueCmdBlk(HostP, Rup, CmdBlkP); - return TRUE; + return 1; } /* @@ -348,13 +337,13 @@ int RIORouteRup(struct rio_info *p, uint Rup, struct Host *HostP, PKT * PacketP) if ((HostP->Mapping[ThisUnit].Flags & SLOT_IN_USE) && !(HostP->Mapping[ThisUnit].Flags & RTA_BOOTED)) { if (!(HostP->Mapping[ThisUnit].Flags & MSG_DONE)) { if (!p->RIONoMessage) - cprintf("RTA '%s' is being updated.\n", HostP->Mapping[ThisUnit].Name); + printk(KERN_DEBUG "rio: RTA '%s' is being updated.\n", HostP->Mapping[ThisUnit].Name); HostP->Mapping[ThisUnit].Flags |= MSG_DONE; } PktReplyP->Command = ROUTE_FOAD; HostP->Copy("RT_FOAD", PktReplyP->CommandText, 7); RIOQueueCmdBlk(HostP, Rup, CmdBlkP); - return TRUE; + return 1; } /* @@ -447,7 +436,7 @@ int RIORouteRup(struct rio_info *p, uint Rup, struct Host *HostP, PKT * PacketP) /* ** Job done, get on with the interrupts! */ - return TRUE; + return 1; } } /* @@ -475,7 +464,7 @@ int RIORouteRup(struct rio_info *p, uint Rup, struct Host *HostP, PKT * PacketP) if (!UnknownMesgDone) { if (!p->RIONoMessage) - cprintf("One or more unknown RTAs are being updated.\n"); + printk(KERN_DEBUG "rio: One or more unknown RTAs are being updated.\n"); UnknownMesgDone = 1; } @@ -491,28 +480,25 @@ int RIORouteRup(struct rio_info *p, uint Rup, struct Host *HostP, PKT * PacketP) if (RtaType == TYPE_RTA16) { if (RIOFindFreeID(p, HostP, &ThisUnit, &ThisUnit2) == 0) { RIODefaultName(p, HostP, ThisUnit); - FillSlot(ThisUnit, ThisUnit2, RtaUniq, HostP); + rio_fill_host_slot(ThisUnit, ThisUnit2, RtaUniq, HostP); } } else { if (RIOFindFreeID(p, HostP, &ThisUnit, NULL) == 0) { RIODefaultName(p, HostP, ThisUnit); - FillSlot(ThisUnit, 0, RtaUniq, HostP); + rio_fill_host_slot(ThisUnit, 0, RtaUniq, HostP); } } PktReplyP->Command = ROUTE_USED; HostP->Copy("RT_USED", PktReplyP->CommandText, 7); } RIOQueueCmdBlk(HostP, Rup, CmdBlkP); - return TRUE; + return 1; } -void RIOFixPhbs(p, HostP, unit) -struct rio_info *p; -struct Host *HostP; -uint unit; +void RIOFixPhbs(struct rio_info *p, struct Host *HostP, unsigned int unit) { - ushort link, port; + unsigned short link, port; struct Port *PortP; unsigned long flags; int PortN = HostP->Mapping[unit].SysPort; @@ -520,19 +506,19 @@ uint unit; rio_dprintk(RIO_DEBUG_ROUTE, "RIOFixPhbs unit %d sysport %d\n", unit, PortN); if (PortN != -1) { - ushort dest_unit = HostP->Mapping[unit].ID2; + unsigned short dest_unit = HostP->Mapping[unit].ID2; /* ** Get the link number used for the 1st 8 phbs on this unit. */ PortP = p->RIOPortp[HostP->Mapping[dest_unit - 1].SysPort]; - link = RWORD(PortP->PhbP->link); + link = readw(&PortP->PhbP->link); for (port = 0; port < PORTS_PER_RTA; port++, PortN++) { - ushort dest_port = port + 8; - WORD *TxPktP; - PKT *Pkt; + unsigned short dest_port = port + 8; + u16 *TxPktP; + struct PKT *Pkt; PortP = p->RIOPortp[PortN]; @@ -569,18 +555,18 @@ uint unit; ** card. This needs to be translated into a 32 bit pointer ** so it can be accessed from the driver. */ - Pkt = (PKT *) RIO_PTR(HostP->Caddr, RINDW(TxPktP)); + Pkt = (struct PKT *) RIO_PTR(HostP->Caddr, readw(TxPktP)); /* ** If the packet is used, reset it. */ - Pkt = (PKT *) ((uint) Pkt & ~PKT_IN_USE); - WBYTE(Pkt->dest_unit, dest_unit); - WBYTE(Pkt->dest_port, dest_port); + Pkt = (struct PKT *) ((unsigned long) Pkt & ~PKT_IN_USE); + writeb(dest_unit, &Pkt->dest_unit); + writeb(dest_port, &Pkt->dest_port); } - rio_dprintk(RIO_DEBUG_ROUTE, "phb dest: Old %x:%x New %x:%x\n", RWORD(PortP->PhbP->destination) & 0xff, (RWORD(PortP->PhbP->destination) >> 8) & 0xff, dest_unit, dest_port); - WWORD(PortP->PhbP->destination, dest_unit + (dest_port << 8)); - WWORD(PortP->PhbP->link, link); + rio_dprintk(RIO_DEBUG_ROUTE, "phb dest: Old %x:%x New %x:%x\n", readw(&PortP->PhbP->destination) & 0xff, (readw(&PortP->PhbP->destination) >> 8) & 0xff, dest_unit, dest_port); + writew(dest_unit + (dest_port << 8), &PortP->PhbP->destination); + writew(link, &PortP->PhbP->link); rio_spin_unlock_irqrestore(&PortP->portSem, flags); } @@ -590,9 +576,9 @@ uint unit; */ if (link > 3) return; - if (((unit * 8) + 7) > RWORD(HostP->LinkStrP[link].last_port)) { + if (((unit * 8) + 7) > readw(&HostP->LinkStrP[link].last_port)) { rio_dprintk(RIO_DEBUG_ROUTE, "last port on host link %d: %d\n", link, (unit * 8) + 7); - WWORD(HostP->LinkStrP[link].last_port, (unit * 8) + 7); + writew((unit * 8) + 7, &HostP->LinkStrP[link].last_port); } } } @@ -603,10 +589,7 @@ uint unit; ** the world about it. This is done to ensure that the configurator ** only gets up-to-date information about what is going on. */ -static int RIOCheckIsolated(p, HostP, UnitId) -struct rio_info *p; -struct Host *HostP; -uint UnitId; +static int RIOCheckIsolated(struct rio_info *p, struct Host *HostP, unsigned int UnitId) { unsigned long flags; rio_spin_lock_irqsave(&HostP->HostLock, flags); @@ -628,12 +611,9 @@ uint UnitId; ** all the units attached to it. This will mean that the entire ** subnet will re-introduce itself. */ -static int RIOIsolate(p, HostP, UnitId) -struct rio_info *p; -struct Host *HostP; -uint UnitId; +static int RIOIsolate(struct rio_info *p, struct Host *HostP, unsigned int UnitId) { - uint link, unit; + unsigned int link, unit; UnitId--; /* this trick relies on the Unit Id being UNSIGNED! */ @@ -658,9 +638,7 @@ uint UnitId; return 1; } -static int RIOCheck(HostP, UnitId) -struct Host *HostP; -uint UnitId; +static int RIOCheck(struct Host *HostP, unsigned int UnitId) { unsigned char link; @@ -714,8 +692,7 @@ uint UnitId; ** Returns the type of unit (host, 16/8 port RTA) */ -uint GetUnitType(Uniq) -uint Uniq; +unsigned int GetUnitType(unsigned int Uniq) { switch ((Uniq >> 28) & 0xf) { case RIO_AT: @@ -736,8 +713,7 @@ uint Uniq; } } -int RIOSetChange(p) -struct rio_info *p; +int RIOSetChange(struct rio_info *p) { if (p->RIOQuickCheck != NOT_CHANGED) return (0); @@ -751,14 +727,13 @@ struct rio_info *p; return (0); } -static void RIOConCon(p, HostP, FromId, FromLink, ToId, ToLink, Change) -struct rio_info *p; -struct Host *HostP; -uint FromId; -uint FromLink; -uint ToId; -uint ToLink; -int Change; +static void RIOConCon(struct rio_info *p, + struct Host *HostP, + unsigned int FromId, + unsigned int FromLink, + unsigned int ToId, + unsigned int ToLink, + int Change) { char *FromName; char *FromType; @@ -818,7 +793,7 @@ int Change; ToType = ToId ? "RTA" : "HOST"; rio_dprintk(RIO_DEBUG_ROUTE, "Link between %s '%s' (%c) and %s '%s' (%c) %s.\n", FromType, FromName, 'A' + FromLink, ToType, ToName, 'A' + ToLink, (Change == CONNECT) ? "established" : "disconnected"); - cprintf("Link between %s '%s' (%c) and %s '%s' (%c) %s.\n", FromType, FromName, 'A' + FromLink, ToType, ToName, 'A' + ToLink, (Change == CONNECT) ? "established" : "disconnected"); + printk(KERN_DEBUG "rio: Link between %s '%s' (%c) and %s '%s' (%c) %s.\n", FromType, FromName, 'A' + FromLink, ToType, ToName, 'A' + ToLink, (Change == CONNECT) ? "established" : "disconnected"); } /* @@ -838,7 +813,7 @@ static int RIORemoveFromSavedTable(struct rio_info *p, struct Map *pMap) */ for (entry = 0; entry < TOTAL_MAP_ENTRIES; entry++) { if (p->RIOSavedTable[entry].RtaUniqueNum == pMap->RtaUniqueNum) { - bzero((caddr_t) & p->RIOSavedTable[entry], sizeof(struct Map)); + memset(&p->RIOSavedTable[entry], 0, sizeof(struct Map)); } } return 0; @@ -898,7 +873,7 @@ static int RIOFreeDisconnected(struct rio_info *p, struct Host *HostP, int unit) int nOther = (HostP->Mapping[unit].ID2) - 1; rio_dprintk(RIO_DEBUG_ROUTE, "RioFreedis second slot %d.\n", nOther); - bzero((caddr_t) & HostP->Mapping[nOther], sizeof(struct Map)); + memset(&HostP->Mapping[nOther], 0, sizeof(struct Map)); } RIORemoveFromSavedTable(p, &HostP->Mapping[unit]); @@ -912,7 +887,8 @@ static int RIOFreeDisconnected(struct rio_info *p, struct Host *HostP, int unit) ** This function scans the given host table for either one ** or two free unit ID's. */ -int RIOFindFreeID(struct rio_info *p, struct Host *HostP, uint * pID1, uint * pID2) + +int RIOFindFreeID(struct rio_info *p, struct Host *HostP, unsigned int * pID1, unsigned int * pID2) { int unit, tempID; @@ -997,7 +973,7 @@ int RIOFindFreeID(struct rio_info *p, struct Host *HostP, uint * pID1, uint * pI /* ** Clear out this slot now that we intend to use it. */ - bzero(&HostP->Mapping[unit], sizeof(struct Map)); + memset(&HostP->Mapping[unit], 0, sizeof(struct Map)); /* ** If the second ID is not needed then we can return @@ -1015,7 +991,7 @@ int RIOFindFreeID(struct rio_info *p, struct Host *HostP, uint * pID1, uint * pI /* ** Clear out this slot now that we intend to use it. */ - bzero(&HostP->Mapping[unit], sizeof(struct Map)); + memset(&HostP->Mapping[unit], 0, sizeof(struct Map)); /* At this point under the right(wrong?) conditions ** we may have a first unit ID being higher than the diff --git a/drivers/char/rio/riotable.c b/drivers/char/rio/riotable.c index a86b216ab65..d3abe0d37d6 100644 --- a/drivers/char/rio/riotable.c +++ b/drivers/char/rio/riotable.c @@ -53,15 +53,12 @@ static char *_riotable_c_sccs_ = "@(#)riotable.c 1.2"; #include "linux_compat.h" #include "rio_linux.h" -#include "typdef.h" #include "pkt.h" #include "daemon.h" #include "rio.h" #include "riospace.h" -#include "top.h" #include "cmdpkt.h" #include "map.h" -#include "riotypes.h" #include "rup.h" #include "port.h" #include "riodrvr.h" @@ -74,25 +71,20 @@ static char *_riotable_c_sccs_ = "@(#)riotable.c 1.2"; #include "unixrup.h" #include "board.h" #include "host.h" -#include "error.h" #include "phb.h" #include "link.h" #include "cmdblk.h" #include "route.h" -#include "control.h" #include "cirrus.h" #include "rioioctl.h" #include "param.h" -#include "list.h" -#include "sam.h" #include "protsts.h" /* ** A configuration table has been loaded. It is now up to us ** to sort it out and use the information contained therein. */ -int RIONewTable(p) -struct rio_info *p; +int RIONewTable(struct rio_info *p) { int Host, Host1, Host2, NameIsUnique, Entry, SubEnt; struct Map *MapP; @@ -137,7 +129,7 @@ struct rio_info *p; cptr = MapP->Name; /* (2) */ cptr[MAX_NAME_LEN - 1] = '\0'; if (cptr[0] == '\0') { - bcopy(MapP->RtaUniqueNum ? "RTA NN" : "HOST NN", MapP->Name, 8); + memcpy(MapP->Name, MapP->RtaUniqueNum ? "RTA NN" : "HOST NN", 8); MapP->Name[5] = '0' + Entry / 10; MapP->Name[6] = '0' + Entry % 10; } @@ -298,9 +290,9 @@ struct rio_info *p; */ for (Host = 0; Host < RIO_HOSTS; Host++) { for (Entry = 0; Entry < MAX_RUP; Entry++) { - bzero((caddr_t) & p->RIOHosts[Host].Mapping[Entry], sizeof(struct Map)); + memset(&p->RIOHosts[Host].Mapping[Entry], 0, sizeof(struct Map)); } - bzero((caddr_t) & p->RIOHosts[Host].Name[0], sizeof(p->RIOHosts[Host].Name)); + memset(&p->RIOHosts[Host].Name[0], 0, sizeof(p->RIOHosts[Host].Name)); } /* @@ -326,7 +318,7 @@ struct rio_info *p; */ if (MapP->ID == 0) { rio_dprintk(RIO_DEBUG_TABLE, "Host entry found. Name %s\n", MapP->Name); - bcopy(MapP->Name, HostP->Name, MAX_NAME_LEN); + memcpy(HostP->Name, MapP->Name, MAX_NAME_LEN); continue; } @@ -370,7 +362,7 @@ struct rio_info *p; } } if (!p->RIOHosts[Host].Name[0]) { - bcopy("HOST 1", p->RIOHosts[Host].Name, 7); + memcpy(p->RIOHosts[Host].Name, "HOST 1", 7); p->RIOHosts[Host].Name[5] += Host; } /* @@ -398,7 +390,7 @@ struct rio_info *p; */ if (Host1 != Host) { rio_dprintk(RIO_DEBUG_TABLE, "Default name %s already used\n", p->RIOHosts[Host].Name); - bcopy("HOST 1", p->RIOHosts[Host].Name, 7); + memcpy(p->RIOHosts[Host].Name, "HOST 1", 7); p->RIOHosts[Host].Name[5] += Host1; } rio_dprintk(RIO_DEBUG_TABLE, "Assigning default name %s\n", p->RIOHosts[Host].Name); @@ -409,9 +401,10 @@ struct rio_info *p; /* ** User process needs the config table - build it from first ** principles. +** +* FIXME: SMP locking */ -int RIOApel(p) -struct rio_info *p; +int RIOApel(struct rio_info *p) { int Host; int link; @@ -419,17 +412,17 @@ struct rio_info *p; int Next = 0; struct Map *MapP; struct Host *HostP; - long oldspl; - - disable(oldspl); /* strange but true! */ + unsigned long flags; rio_dprintk(RIO_DEBUG_TABLE, "Generating a table to return to config.rio\n"); - bzero((caddr_t) & p->RIOConnectTable[0], sizeof(struct Map) * TOTAL_MAP_ENTRIES); + memset(&p->RIOConnectTable[0], 0, sizeof(struct Map) * TOTAL_MAP_ENTRIES); for (Host = 0; Host < RIO_HOSTS; Host++) { rio_dprintk(RIO_DEBUG_TABLE, "Processing host %d\n", Host); HostP = &p->RIOHosts[Host]; + rio_spin_lock_irqsave(&HostP->HostLock, flags); + MapP = &p->RIOConnectTable[Next++]; MapP->HostUniqueNum = HostP->UniqueNum; if ((HostP->Flags & RUN_STATE) != RC_RUNNING) @@ -440,7 +433,7 @@ struct rio_info *p; MapP->SysPort = NO_PORT; for (link = 0; link < LINKS_PER_UNIT; link++) MapP->Topology[link] = HostP->Topology[link]; - bcopy(HostP->Name, MapP->Name, MAX_NAME_LEN); + memcpy(MapP->Name, HostP->Name, MAX_NAME_LEN); for (Rup = 0; Rup < MAX_RUP; Rup++) { if (HostP->Mapping[Rup].Flags & (SLOT_IN_USE | SLOT_TENTATIVE)) { p->RIOConnectTable[Next] = HostP->Mapping[Rup]; @@ -453,8 +446,8 @@ struct rio_info *p; Next++; } } + rio_spin_unlock_irqrestore(&HostP->HostLock, flags); } - restore(oldspl); return 0; } @@ -463,9 +456,7 @@ struct rio_info *p; ** if the entry is suitably inactive, then we can gob on it and remove ** it from the table. */ -int RIODeleteRta(p, MapP) -struct rio_info *p; -struct Map *MapP; +int RIODeleteRta(struct rio_info *p, struct Map *MapP) { int host, entry, port, link; int SysPort; @@ -541,10 +532,10 @@ struct Map *MapP; ** the phb to port mappings in RIORouteRup. */ if (PortP->SecondBlock) { - ushort dest_unit = HostMapP->ID; - ushort dest_port = port - SysPort; - WORD *TxPktP; - PKT *Pkt; + u16 dest_unit = HostMapP->ID; + u16 dest_port = port - SysPort; + u16 *TxPktP; + struct PKT *Pkt; for (TxPktP = PortP->TxStart; TxPktP <= PortP->TxEnd; TxPktP++) { /* @@ -554,19 +545,19 @@ struct Map *MapP; ** a 32 bit pointer so it can be ** accessed from the driver. */ - Pkt = (PKT *) RIO_PTR(HostP->Caddr, RWORD(*TxPktP)); + Pkt = (struct PKT *) RIO_PTR(HostP->Caddr, readw(&*TxPktP)); rio_dprintk(RIO_DEBUG_TABLE, "Tx packet (%x) destination: Old %x:%x New %x:%x\n", *TxPktP, Pkt->dest_unit, Pkt->dest_port, dest_unit, dest_port); - WWORD(Pkt->dest_unit, dest_unit); - WWORD(Pkt->dest_port, dest_port); + writew(dest_unit, &Pkt->dest_unit); + writew(dest_port, &Pkt->dest_port); } rio_dprintk(RIO_DEBUG_TABLE, "Port %d phb destination: Old %x:%x New %x:%x\n", port, PortP->PhbP->destination & 0xff, (PortP->PhbP->destination >> 8) & 0xff, dest_unit, dest_port); - WWORD(PortP->PhbP->destination, dest_unit + (dest_port << 8)); + writew(dest_unit + (dest_port << 8), &PortP->PhbP->destination); } rio_spin_unlock_irqrestore(&PortP->portSem, sem_flags); } } rio_dprintk(RIO_DEBUG_TABLE, "Entry nulled.\n"); - bzero((char *) HostMapP, sizeof(struct Map)); + memset(HostMapP, 0, sizeof(struct Map)); work_done++; } } @@ -576,11 +567,11 @@ struct Map *MapP; /* XXXXX lock me up */ for (entry = 0; entry < TOTAL_MAP_ENTRIES; entry++) { if (p->RIOSavedTable[entry].RtaUniqueNum == MapP->RtaUniqueNum) { - bzero((char *) &p->RIOSavedTable[entry], sizeof(struct Map)); + memset(&p->RIOSavedTable[entry], 0, sizeof(struct Map)); work_done++; } if (p->RIOConnectTable[entry].RtaUniqueNum == MapP->RtaUniqueNum) { - bzero((char *) &p->RIOConnectTable[entry], sizeof(struct Map)); + memset(&p->RIOConnectTable[entry], 0, sizeof(struct Map)); work_done++; } } @@ -602,7 +593,7 @@ int RIOAssignRta(struct rio_info *p, struct Map *MapP) rio_dprintk(RIO_DEBUG_TABLE, "Assign entry on host %x, rta %x, ID %d, Sysport %d\n", MapP->HostUniqueNum, MapP->RtaUniqueNum, MapP->ID, (int) MapP->SysPort); - if ((MapP->ID != (ushort) - 1) && ((int) MapP->ID < (int) 1 || (int) MapP->ID > MAX_RUP)) { + if ((MapP->ID != (u16) - 1) && ((int) MapP->ID < (int) 1 || (int) MapP->ID > MAX_RUP)) { rio_dprintk(RIO_DEBUG_TABLE, "Bad ID in map entry!\n"); p->RIOError.Error = ID_NUMBER_OUT_OF_RANGE; return -EINVAL; @@ -648,7 +639,7 @@ int RIOAssignRta(struct rio_info *p, struct Map *MapP) ** Now we have a host we need to allocate an ID ** if the entry does not already have one. */ - if (MapP->ID == (ushort) - 1) { + if (MapP->ID == (u16) - 1) { int nNewID; rio_dprintk(RIO_DEBUG_TABLE, "Attempting to get a new ID for rta \"%s\"\n", MapP->Name); @@ -667,7 +658,7 @@ int RIOAssignRta(struct rio_info *p, struct Map *MapP) p->RIOError.Error = COULDNT_FIND_ENTRY; return -EBUSY; } - MapP->ID = (ushort) nNewID + 1; + MapP->ID = (u16) nNewID + 1; rio_dprintk(RIO_DEBUG_TABLE, "Allocated ID %d for this new RTA.\n", MapP->ID); HostMapP = &p->RIOHosts[host].Mapping[nNewID]; HostMapP->RtaUniqueNum = MapP->RtaUniqueNum; @@ -708,7 +699,7 @@ int RIOAssignRta(struct rio_info *p, struct Map *MapP) */ HostMapP->SysPort = MapP->SysPort; if ((MapP->Flags & RTA16_SECOND_SLOT) == 0) - CCOPY(MapP->Name, HostMapP->Name, MAX_NAME_LEN); + memcpy(HostMapP->Name, MapP->Name, MAX_NAME_LEN); HostMapP->Flags = SLOT_IN_USE | RTA_BOOTED; #ifdef NEED_TO_FIX RIO_SV_BROADCAST(p->RIOHosts[host].svFlags[MapP->ID - 1]); @@ -742,16 +733,13 @@ int RIOAssignRta(struct rio_info *p, struct Map *MapP) } -int RIOReMapPorts(p, HostP, HostMapP) -struct rio_info *p; -struct Host *HostP; -struct Map *HostMapP; +int RIOReMapPorts(struct rio_info *p, struct Host *HostP, struct Map *HostMapP) { - register struct Port *PortP; - uint SubEnt; - uint HostPort; - uint SysPort; - ushort RtaType; + struct Port *PortP; + unsigned int SubEnt; + unsigned int HostPort; + unsigned int SysPort; + u16 RtaType; unsigned long flags; rio_dprintk(RIO_DEBUG_TABLE, "Mapping sysport %d to id %d\n", (int) HostMapP->SysPort, HostMapP->ID); @@ -794,12 +782,12 @@ struct Map *HostMapP; */ if ((HostP->Flags & RUN_STATE) == RC_RUNNING) { struct PHB *PhbP = PortP->PhbP = &HostP->PhbP[HostPort]; - PortP->TxAdd = (WORD *) RIO_PTR(HostP->Caddr, RWORD(PhbP->tx_add)); - PortP->TxStart = (WORD *) RIO_PTR(HostP->Caddr, RWORD(PhbP->tx_start)); - PortP->TxEnd = (WORD *) RIO_PTR(HostP->Caddr, RWORD(PhbP->tx_end)); - PortP->RxRemove = (WORD *) RIO_PTR(HostP->Caddr, RWORD(PhbP->rx_remove)); - PortP->RxStart = (WORD *) RIO_PTR(HostP->Caddr, RWORD(PhbP->rx_start)); - PortP->RxEnd = (WORD *) RIO_PTR(HostP->Caddr, RWORD(PhbP->rx_end)); + PortP->TxAdd = (u16 *) RIO_PTR(HostP->Caddr, readw(&PhbP->tx_add)); + PortP->TxStart = (u16 *) RIO_PTR(HostP->Caddr, readw(&PhbP->tx_start)); + PortP->TxEnd = (u16 *) RIO_PTR(HostP->Caddr, readw(&PhbP->tx_end)); + PortP->RxRemove = (u16 *) RIO_PTR(HostP->Caddr, readw(&PhbP->rx_remove)); + PortP->RxStart = (u16 *) RIO_PTR(HostP->Caddr, readw(&PhbP->rx_start)); + PortP->RxEnd = (u16 *) RIO_PTR(HostP->Caddr, readw(&PhbP->rx_end)); } else PortP->PhbP = NULL; @@ -813,10 +801,10 @@ struct Map *HostMapP; PortP->RupNum = HostMapP->ID - 1; if (HostMapP->Flags & RTA16_SECOND_SLOT) { PortP->ID2 = HostMapP->ID2 - 1; - PortP->SecondBlock = TRUE; + PortP->SecondBlock = 1; } else { PortP->ID2 = 0; - PortP->SecondBlock = FALSE; + PortP->SecondBlock = 0; } PortP->RtaUniqueNum = HostMapP->RtaUniqueNum; @@ -866,9 +854,6 @@ struct Map *HostMapP; PortP->RxDataStart = 0; PortP->Cor2Copy = 0; PortP->Name = &HostMapP->Name[0]; -#ifdef STATS - bzero((caddr_t) & PortP->Stat, sizeof(struct RIOStats)); -#endif PortP->statsGather = 0; PortP->txchars = 0; PortP->rxchars = 0; @@ -876,10 +861,10 @@ struct Map *HostMapP; PortP->closes = 0; PortP->ioctls = 0; if (PortP->TxRingBuffer) - bzero(PortP->TxRingBuffer, p->RIOBufferSize); + memset(PortP->TxRingBuffer, 0, p->RIOBufferSize); else if (p->RIOBufferSize) { - PortP->TxRingBuffer = sysbrk(p->RIOBufferSize); - bzero(PortP->TxRingBuffer, p->RIOBufferSize); + PortP->TxRingBuffer = kmalloc(p->RIOBufferSize, GFP_KERNEL); + memset(PortP->TxRingBuffer, 0, p->RIOBufferSize); } PortP->TxBufferOut = 0; PortP->TxBufferIn = 0; @@ -890,7 +875,7 @@ struct Map *HostMapP; ** If the same, we have received the same rx pkt from the RTA ** twice. Initialise to a value not equal to PHB_RX_TGL or 0. */ - PortP->LastRxTgl = ~(uchar) PHB_RX_TGL; + PortP->LastRxTgl = ~(u8) PHB_RX_TGL; /* ** and mark the port as usable @@ -906,9 +891,7 @@ struct Map *HostMapP; return 0; } -int RIOChangeName(p, MapP) -struct rio_info *p; -struct Map *MapP; +int RIOChangeName(struct rio_info *p, struct Map *MapP) { int host; struct Map *HostMapP; @@ -941,7 +924,7 @@ struct Map *MapP; return -ENXIO; } if (MapP->ID == 0) { - CCOPY(MapP->Name, p->RIOHosts[host].Name, MAX_NAME_LEN); + memcpy(p->RIOHosts[host].Name, MapP->Name, MAX_NAME_LEN); return 0; } @@ -951,7 +934,7 @@ struct Map *MapP; p->RIOError.Error = RTA_NUMBER_WRONG; return -ENXIO; } - CCOPY(MapP->Name, HostMapP->Name, MAX_NAME_LEN); + memcpy(HostMapP->Name, MapP->Name, MAX_NAME_LEN); return 0; } } diff --git a/drivers/char/rio/riotty.c b/drivers/char/rio/riotty.c index 6379816ed17..204267613c9 100644 --- a/drivers/char/rio/riotty.c +++ b/drivers/char/rio/riotty.c @@ -56,15 +56,12 @@ static char *_riotty_c_sccs_ = "@(#)riotty.c 1.3"; #include "linux_compat.h" #include "rio_linux.h" -#include "typdef.h" #include "pkt.h" #include "daemon.h" #include "rio.h" #include "riospace.h" -#include "top.h" #include "cmdpkt.h" #include "map.h" -#include "riotypes.h" #include "rup.h" #include "port.h" #include "riodrvr.h" @@ -77,58 +74,18 @@ static char *_riotty_c_sccs_ = "@(#)riotty.c 1.3"; #include "unixrup.h" #include "board.h" #include "host.h" -#include "error.h" #include "phb.h" #include "link.h" #include "cmdblk.h" #include "route.h" -#include "control.h" #include "cirrus.h" #include "rioioctl.h" #include "param.h" -#include "list.h" -#include "sam.h" static void RIOClearUp(struct Port *PortP); -int RIOShortCommand(struct rio_info *p, struct Port *PortP, int command, int len, int arg); - - -extern int conv_vb[]; /* now defined in ttymgr.c */ -extern int conv_bv[]; /* now defined in ttymgr.c */ -/* -** 16.09.1998 ARG - Fix to build riotty.k.o for Modular Kernel Support -** -** ep.def.h is necessary for Modular Kernel Support -** DO NOT place any kernel 'extern's after this line -** or this source file will not build riotty.k.o -*/ -#ifdef uLYNX -#include <ep.def.h> -#endif - -#ifdef NEED_THIS2 -static struct old_sgttyb default_sg = { - B19200, B19200, /* input and output speed */ - 'H' - '@', /* erase char */ - -1, /* 2nd erase char */ - 'U' - '@', /* kill char */ - ECHO | CRMOD, /* mode */ - 'C' - '@', /* interrupt character */ - '\\' - '@', /* quit char */ - 'Q' - '@', /* start char */ - 'S' - '@', /* stop char */ - 'D' - '@', /* EOF */ - -1, /* brk */ - (LCRTBS | LCRTERA | LCRTKIL | LCTLECH), /* local mode word */ - 'Z' - '@', /* process stop */ - 'Y' - '@', /* delayed stop */ - 'R' - '@', /* reprint line */ - 'O' - '@', /* flush output */ - 'W' - '@', /* word erase */ - 'V' - '@' /* literal next char */ -}; -#endif +/* Below belongs in func.h */ +int RIOShortCommand(struct rio_info *p, struct Port *PortP, int command, int len, int arg); extern struct rio_info *p; @@ -136,8 +93,7 @@ extern struct rio_info *p; int riotopen(struct tty_struct *tty, struct file *filp) { - register uint SysPort; - int Modem; + unsigned int SysPort; int repeat_this = 250; struct Port *PortP; /* pointer to the port structure */ unsigned long flags; @@ -151,16 +107,14 @@ int riotopen(struct tty_struct *tty, struct file *filp) tty->driver_data = NULL; SysPort = rio_minor(tty); - Modem = rio_ismodem(tty); if (p->RIOFailed) { rio_dprintk(RIO_DEBUG_TTY, "System initialisation failed\n"); - pseterr(ENXIO); func_exit(); return -ENXIO; } - rio_dprintk(RIO_DEBUG_TTY, "port open SysPort %d (%s) (mapped:%d)\n", SysPort, Modem ? "Modem" : "tty", p->RIOPortp[SysPort]->Mapped); + rio_dprintk(RIO_DEBUG_TTY, "port open SysPort %d (mapped:%d)\n", SysPort, p->RIOPortp[SysPort]->Mapped); /* ** Validate that we have received a legitimate request. @@ -170,7 +124,6 @@ int riotopen(struct tty_struct *tty, struct file *filp) */ if (SysPort >= RIO_PORTS) { /* out of range ? */ rio_dprintk(RIO_DEBUG_TTY, "Illegal port number %d\n", SysPort); - pseterr(ENXIO); func_exit(); return -ENXIO; } @@ -187,7 +140,6 @@ int riotopen(struct tty_struct *tty, struct file *filp) */ rio_dprintk(RIO_DEBUG_TTY, "port not mapped into system\n"); func_exit(); - pseterr(ENXIO); return -ENXIO; } @@ -209,7 +161,6 @@ int riotopen(struct tty_struct *tty, struct file *filp) */ if ((PortP->HostP->Flags & RUN_STATE) != RC_RUNNING) { rio_dprintk(RIO_DEBUG_TTY, "Host not running\n"); - pseterr(ENXIO); func_exit(); return -ENXIO; } @@ -309,15 +260,12 @@ int riotopen(struct tty_struct *tty, struct file *filp) /* PortP->gs.xmit_cnt = 0; */ rio_spin_unlock_irqrestore(&PortP->portSem, flags); -#ifdef NEED_THIS - ttyseth(PortP, tp, (struct old_sgttyb *) &default_sg); -#endif /* Someone explain to me why this delay/config is here. If I read the docs correctly the "open" command piggybacks the parameters immediately. -- REW */ - RIOParam(PortP, OPEN, Modem, OK_TO_SLEEP); /* Open the port */ + RIOParam(PortP, OPEN, 1, OK_TO_SLEEP); /* Open the port */ rio_spin_lock_irqsave(&PortP->portSem, flags); /* @@ -325,20 +273,6 @@ int riotopen(struct tty_struct *tty, struct file *filp) */ while (!(PortP->PortState & PORT_ISOPEN) && !p->RIOHalted) { rio_dprintk(RIO_DEBUG_TTY, "Waiting for PORT_ISOPEN-currently %x\n", PortP->PortState); -/* -** 15.10.1998 ARG - ESIL 0759 -** (Part) fix for port being trashed when opened whilst RTA "disconnected" -** Take out the limited wait - now wait for ever or until user -** bangs us out. -** - if (repeat_this -- <= 0) { - rio_dprint(RIO_DEBUG_TTY, ("Waiting for open to finish timed out.\n")); - RIOPreemptiveCmd(p, PortP, FCLOSE ); - rio_spin_unlock_irqrestore(&PortP->portSem, flags); - return -EINTR; - } -** -*/ rio_spin_unlock_irqrestore(&PortP->portSem, flags); if (RIODelay(PortP, HUNDRED_MS) == RIO_FAIL) { rio_dprintk(RIO_DEBUG_TTY, "Waiting for open to finish broken by signal\n"); @@ -358,80 +292,61 @@ int riotopen(struct tty_struct *tty, struct file *filp) } rio_dprintk(RIO_DEBUG_TTY, "PORT_ISOPEN found\n"); } -#ifdef MODEM_SUPPORT - if (Modem) { - rio_dprintk(RIO_DEBUG_TTY, "Modem - test for carrier\n"); + rio_dprintk(RIO_DEBUG_TTY, "Modem - test for carrier\n"); + /* + ** ACTION + ** insert test for carrier here. -- ??? + ** I already see that test here. What's the deal? -- REW + */ + if ((PortP->gs.tty->termios->c_cflag & CLOCAL) || (PortP->ModemState & MSVR1_CD)) { + rio_dprintk(RIO_DEBUG_TTY, "open(%d) Modem carr on\n", SysPort); /* - ** ACTION - ** insert test for carrier here. -- ??? - ** I already see that test here. What's the deal? -- REW + tp->tm.c_state |= CARR_ON; + wakeup((caddr_t) &tp->tm.c_canq); */ - if ((PortP->gs.tty->termios->c_cflag & CLOCAL) || (PortP->ModemState & MSVR1_CD)) { - rio_dprintk(RIO_DEBUG_TTY, "open(%d) Modem carr on\n", SysPort); + PortP->State |= RIO_CARR_ON; + wake_up_interruptible(&PortP->gs.open_wait); + } else { /* no carrier - wait for DCD */ /* - tp->tm.c_state |= CARR_ON; - wakeup((caddr_t) &tp->tm.c_canq); - */ - PortP->State |= RIO_CARR_ON; - wake_up_interruptible(&PortP->gs.open_wait); - } else { /* no carrier - wait for DCD */ - + while (!(PortP->gs.tty->termios->c_state & CARR_ON) && + !(filp->f_flags & O_NONBLOCK) && !p->RIOHalted ) + */ + while (!(PortP->State & RIO_CARR_ON) && !(filp->f_flags & O_NONBLOCK) && !p->RIOHalted) { + rio_dprintk(RIO_DEBUG_TTY, "open(%d) sleeping for carr on\n", SysPort); /* - while (!(PortP->gs.tty->termios->c_state & CARR_ON) && - !(filp->f_flags & O_NONBLOCK) && !p->RIOHalted ) + PortP->gs.tty->termios->c_state |= WOPEN; */ - while (!(PortP->State & RIO_CARR_ON) && !(filp->f_flags & O_NONBLOCK) && !p->RIOHalted) { - - rio_dprintk(RIO_DEBUG_TTY, "open(%d) sleeping for carr on\n", SysPort); + PortP->State |= RIO_WOPEN; + rio_spin_unlock_irqrestore(&PortP->portSem, flags); + if (RIODelay(PortP, HUNDRED_MS) == RIO_FAIL) { /* - PortP->gs.tty->termios->c_state |= WOPEN; + ** ACTION: verify that this is a good thing + ** to do here. -- ??? + ** I think it's OK. -- REW */ - PortP->State |= RIO_WOPEN; + rio_dprintk(RIO_DEBUG_TTY, "open(%d) sleeping for carr broken by signal\n", SysPort); + RIOPreemptiveCmd(p, PortP, FCLOSE); + /* + tp->tm.c_state &= ~WOPEN; + */ + PortP->State &= ~RIO_WOPEN; rio_spin_unlock_irqrestore(&PortP->portSem, flags); - if (RIODelay(PortP, HUNDRED_MS) == RIO_FAIL) - { - /* - ** ACTION: verify that this is a good thing - ** to do here. -- ??? - ** I think it's OK. -- REW - */ - rio_dprintk(RIO_DEBUG_TTY, "open(%d) sleeping for carr broken by signal\n", SysPort); - RIOPreemptiveCmd(p, PortP, FCLOSE); - /* - tp->tm.c_state &= ~WOPEN; - */ - PortP->State &= ~RIO_WOPEN; - rio_spin_unlock_irqrestore(&PortP->portSem, flags); - func_exit(); - return -EINTR; - } + func_exit(); + return -EINTR; } - PortP->State &= ~RIO_WOPEN; } - if (p->RIOHalted) - goto bombout; - rio_dprintk(RIO_DEBUG_TTY, "Setting RIO_MOPEN\n"); - PortP->State |= RIO_MOPEN; - } else -#endif - { - /* - ** ACTION - ** Direct line open - force carrier (will probably mean - ** that sleeping Modem line fubar) - */ - PortP->State |= RIO_LOPEN; + PortP->State &= ~RIO_WOPEN; } + if (p->RIOHalted) + goto bombout; + rio_dprintk(RIO_DEBUG_TTY, "Setting RIO_MOPEN\n"); + PortP->State |= RIO_MOPEN; - if (p->RIOHalted) { + if (p->RIOHalted) goto bombout; - } rio_dprintk(RIO_DEBUG_TTY, "high level open done\n"); -#ifdef STATS - PortP->Stat.OpenCnt++; -#endif /* ** Count opens for port statistics reporting */ @@ -460,23 +375,21 @@ int riotclose(void *ptr) unsigned long end_time; struct tty_struct *tty; unsigned long flags; - int Modem; int rv = 0; rio_dprintk(RIO_DEBUG_TTY, "port close SysPort %d\n", PortP->PortNum); /* PortP = p->RIOPortp[SysPort]; */ - rio_dprintk(RIO_DEBUG_TTY, "Port is at address 0x%x\n", (int) PortP); + rio_dprintk(RIO_DEBUG_TTY, "Port is at address %p\n", PortP); /* tp = PortP->TtyP; *//* Get tty */ tty = PortP->gs.tty; - rio_dprintk(RIO_DEBUG_TTY, "TTY is at address 0x%x\n", (int) tty); + rio_dprintk(RIO_DEBUG_TTY, "TTY is at address %p\n", tty); if (PortP->gs.closing_wait) end_time = jiffies + PortP->gs.closing_wait; else end_time = jiffies + MAX_SCHEDULE_TIMEOUT; - Modem = rio_ismodem(tty); rio_spin_lock_irqsave(&PortP->portSem, flags); /* @@ -500,7 +413,7 @@ int riotclose(void *ptr) /* ** clear the open bits for this device */ - PortP->State &= (Modem ? ~RIO_MOPEN : ~RIO_LOPEN); + PortP->State &= ~RIO_MOPEN; PortP->State &= ~RIO_CARR_ON; PortP->ModemState &= ~MSVR1_CD; /* @@ -536,7 +449,6 @@ int riotclose(void *ptr) if (!deleted) while ((PortP->InUse != NOT_INUSE) && !p->RIOHalted && (PortP->TxBufferIn != PortP->TxBufferOut)) { - cprintf("Need to flush the ttyport\n"); if (repeat_this-- <= 0) { rv = -EINTR; rio_dprintk(RIO_DEBUG_TTY, "Waiting for not idle closed broken by signal\n"); @@ -615,16 +527,13 @@ int riotclose(void *ptr) */ PortP->Config &= ~(RIO_CTSFLOW | RIO_RTSFLOW); -#ifdef STATS - PortP->Stat.CloseCnt++; -#endif /* ** Count opens for port statistics reporting */ if (PortP->statsGather) PortP->closes++; - close_end: +close_end: /* XXX: Why would a "DELETED" flag be reset here? I'd have thought that a "deleted" flag means that the port was permanently gone, but here we can make it reappear by it @@ -640,8 +549,7 @@ int riotclose(void *ptr) -static void RIOClearUp(PortP) -struct Port *PortP; +static void RIOClearUp(struct Port *PortP) { rio_dprintk(RIO_DEBUG_TTY, "RIOHalted set\n"); PortP->Config = 0; /* Direct semaphore */ @@ -668,7 +576,7 @@ struct Port *PortP; */ int RIOShortCommand(struct rio_info *p, struct Port *PortP, int command, int len, int arg) { - PKT *PacketP; + struct PKT *PacketP; int retries = 20; /* at 10 per second -> 2 seconds */ unsigned long flags; @@ -722,15 +630,15 @@ int RIOShortCommand(struct rio_info *p, struct Port *PortP, int command, int len /* ** set the command byte and the argument byte */ - WBYTE(PacketP->data[0], command); + writeb(command, &PacketP->data[0]); if (len == 2) - WBYTE(PacketP->data[1], arg); + writeb(arg, &PacketP->data[1]); /* ** set the length of the packet and set the command bit. */ - WBYTE(PacketP->len, PKT_CMD_BIT | len); + writeb(PKT_CMD_BIT | len, &PacketP->len); add_transmit(PortP); /* diff --git a/drivers/char/rio/riotypes.h b/drivers/char/rio/riotypes.h deleted file mode 100644 index 46084d5c7e9..00000000000 --- a/drivers/char/rio/riotypes.h +++ /dev/null @@ -1,68 +0,0 @@ -/**************************************************************************** - ******* ******* - ******* R I O T Y P E S - ******* ******* - **************************************************************************** - - Author : Jon Brawn - Date : - - * - * (C) 1990 - 2000 Specialix International Ltd., Byfleet, Surrey, UK. - * - * 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 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; 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. - - Version : 0.01 - - - Mods - ---------------------------------------------------------------------------- - Date By Description - ---------------------------------------------------------------------------- - - ***************************************************************************/ - -#ifndef _riotypes_h -#define _riotypes_h 1 - -#ifdef SCCS_LABELS -#ifndef lint -/* static char *_rio_riotypes_h_sccs = "@(#)riotypes.h 1.10"; */ -#endif -#endif - -typedef unsigned short NUMBER_ptr; -typedef unsigned short WORD_ptr; -typedef unsigned short BYTE_ptr; -typedef unsigned short char_ptr; -typedef unsigned short Channel_ptr; -typedef unsigned short FREE_LIST_ptr_ptr; -typedef unsigned short FREE_LIST_ptr; -typedef unsigned short LPB_ptr; -typedef unsigned short Process_ptr; -typedef unsigned short PHB_ptr; -typedef unsigned short PKT_ptr; -typedef unsigned short PKT_ptr_ptr; -typedef unsigned short Q_BUF_ptr; -typedef unsigned short Q_BUF_ptr_ptr; -typedef unsigned short ROUTE_STR_ptr; -typedef unsigned short RUP_ptr; -typedef unsigned short short_ptr; -typedef unsigned short u_short_ptr; -typedef unsigned short ushort_ptr; - -#endif /* __riotypes__ */ - -/*********** end of file ***********/ diff --git a/drivers/char/rio/rom.h b/drivers/char/rio/rom.h deleted file mode 100644 index 58a7843625f..00000000000 --- a/drivers/char/rio/rom.h +++ /dev/null @@ -1,62 +0,0 @@ -/**************************************************************************** - ******* ******* - ******* R O M - ******* ******* - **************************************************************************** - - Author : Ian Nandhra - Date : - - * - * (C) 1990 - 2000 Specialix International Ltd., Byfleet, Surrey, UK. - * - * 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 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; 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. - - Version : 0.01 - - - Mods - ---------------------------------------------------------------------------- - Date By Description - ---------------------------------------------------------------------------- - - ***************************************************************************/ - -#ifndef _rom_h -#define _rom_h 1 - -#ifndef lint -#ifdef SCCS -static char *_rio_rom_h_sccs = "@(#)rom.h 1.1"; -#endif -#endif - -typedef struct ROM ROM; -struct ROM { - u_short slx; - char pcb_letter_rev; - char pcb_number_rev; - char serial[4]; - char year; - char week; -}; - -#endif - -#define HOST_ROM (ROM *) 0x7c00 -#define RTA_ROM (ROM *) 0x7801 -#define ROM_LENGTH 0x20 - -/*********** end of file ***********/ diff --git a/drivers/char/rio/rup.h b/drivers/char/rio/rup.h index f74f67c6f70..4ae90cb207a 100644 --- a/drivers/char/rio/rup.h +++ b/drivers/char/rio/rup.h @@ -37,14 +37,7 @@ #ifndef _rup_h #define _rup_h 1 -#ifdef SCCS_LABELS -#ifndef lint -/* static char *_rio_rup_h_sccs = "@(#)rup.h 1.5"; */ -#endif -#endif - #define MAX_RUP ((short) 16) - #define PKTS_PER_RUP ((short) 2) /* They are always used in pairs */ /************************************************* @@ -60,15 +53,15 @@ #define RUP_NO_OWNER 0xff /* RUP not owned by any process */ struct RUP { - PKT_ptr txpkt; /* Outgoing packet */ - PKT_ptr rxpkt; /* Incoming packet */ - WORD link; /* Which link to send down? */ - BYTE rup_dest_unit[2]; /* Destination unit */ - WORD handshake; /* For handshaking */ - WORD timeout; /* Timeout */ - WORD status; /* Status */ - WORD txcontrol; /* Transmit control */ - WORD rxcontrol; /* Receive control */ + u16 txpkt; /* Outgoing packet */ + u16 rxpkt; /* Incoming packet */ + u16 link; /* Which link to send down? */ + u8 rup_dest_unit[2]; /* Destination unit */ + u16 handshake; /* For handshaking */ + u16 timeout; /* Timeout */ + u16 status; /* Status */ + u16 txcontrol; /* Transmit control */ + u16 rxcontrol; /* Receive control */ }; #endif diff --git a/drivers/char/rio/sam.h b/drivers/char/rio/sam.h deleted file mode 100644 index 6f754e19015..00000000000 --- a/drivers/char/rio/sam.h +++ /dev/null @@ -1,67 +0,0 @@ -/**************************************************************************** - ******* ******* - ******* S A M . H - ******* ******* - **************************************************************************** - - Author : Ian Nandhra - Date : - - * - * (C) 1990 - 2000 Specialix International Ltd., Byfleet, Surrey, UK. - * - * 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 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; 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. - - Version : 0.01 - - - Mods - ---------------------------------------------------------------------------- - Date By Description - ---------------------------------------------------------------------------- - - ***************************************************************************/ -#ifndef _sam_h -#define _sam_h 1 - -#ifdef SCCS_LABELS -#ifndef lint -/* static char *_rio_sam_h_sccs = "@(#)sam.h 1.3"; */ -#endif -#endif - - -#define NUM_FREE_LIST_UNITS 500 - -#ifndef FALSE -#define FALSE (short) 0x00 -#endif -#ifndef TRUE -#define TRUE (short) !FALSE -#endif - -#define TX TRUE -#define RX FALSE - - -typedef struct FREE_LIST FREE_LIST; -struct FREE_LIST { - FREE_LIST_ptr next; - FREE_LIST_ptr prev; -}; - - -#endif -/*********** end of file ***********/ diff --git a/drivers/char/rio/space.h b/drivers/char/rio/space.h deleted file mode 100644 index 1f12690f9d1..00000000000 --- a/drivers/char/rio/space.h +++ /dev/null @@ -1,45 +0,0 @@ -/* -** ----------------------------------------------------------------------------- -** -** Perle Specialix driver for Linux -** Ported from existing RIO Driver for SCO sources. - * - * (C) 1990 - 2000 Specialix International Ltd., Byfleet, Surrey, UK. - * - * 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 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; 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. -** -** Module : space.h -** SID : 1.2 -** Last Modified : 11/6/98 11:34:19 -** Retrieved : 11/6/98 11:34:22 -** -** ident @(#)space.h 1.2 -** -** ----------------------------------------------------------------------------- -*/ - -#ifndef __rio_space_h__ -#define __rio_space_h__ - -#ifdef SCCS_LABELS -static char *_space_h_sccs_ = "@(#)space.h 1.2"; -#endif - -extern int rio_cntls; -extern int rio_bases[]; -extern int rio_limits[]; -extern int rio_vects[]; - -#endif /* __rio_space_h__ */ diff --git a/drivers/char/rio/top.h b/drivers/char/rio/top.h deleted file mode 100644 index d15a11dc4f7..00000000000 --- a/drivers/char/rio/top.h +++ /dev/null @@ -1,48 +0,0 @@ -/* -** ----------------------------------------------------------------------------- -** -** Perle Specialix driver for Linux -** Ported from existing RIO Driver for SCO sources. - * - * (C) 1990 - 2000 Specialix International Ltd., Byfleet, Surrey, UK. - * - * 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 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; 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. -** -** Module : top.h -** SID : 1.2 -** Last Modified : 11/6/98 11:34:19 -** Retrieved : 11/6/98 11:34:22 -** -** ident @(#)top.h 1.2 -** -** ----------------------------------------------------------------------------- -*/ - -#ifndef __rio_top_h__ -#define __rio_top_h__ - -#ifdef SCCS_LABELS -static char *_top_h_sccs_ = "@(#)top.h 1.2"; -#endif - -/* -** Topology information -*/ -struct Top { - uchar Unit; - uchar Link; -}; - -#endif /* __rio_top_h__ */ diff --git a/drivers/char/rio/typdef.h b/drivers/char/rio/typdef.h deleted file mode 100644 index 185b889e151..00000000000 --- a/drivers/char/rio/typdef.h +++ /dev/null @@ -1,82 +0,0 @@ -/* -** ----------------------------------------------------------------------------- -** -** Perle Specialix driver for Linux -** Ported from existing RIO Driver for SCO sources. - * - * (C) 1990 - 2000 Specialix International Ltd., Byfleet, Surrey, UK. - * - * 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 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; 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. -** -** Module : typdef.h -** SID : 1.2 -** Last Modified : 11/6/98 11:34:20 -** Retrieved : 11/6/98 11:34:22 -** -** ident @(#)typdef.h 1.2 -** -** ----------------------------------------------------------------------------- -*/ - -#ifndef __rio_typdef_h__ -#define __rio_typdef_h__ - -#ifdef SCCS_LABELS -static char *_typdef_h_sccs_ = "@(#)typdef.h 1.2"; -#endif - -#undef VPIX - -/* -** IT IS REALLY, REALLY, IMPORTANT THAT BYTES ARE UNSIGNED! -** -** These types are ONLY to be used for refering to data structures -** on the RIO Host card! -*/ -typedef volatile unsigned char BYTE; -typedef volatile unsigned short WORD; -typedef volatile unsigned int DWORD; -typedef volatile unsigned short RIOP; -typedef volatile short NUMBER; - - -/* -** 27.01.199 ARG - mods to compile 'newutils' on LyxnOS - -** These #defines are for the benefit of the 'libfuncs' library -** only. They are not necessarily correct type mappings and -** are here only to make the source compile. -*/ -/* typedef unsigned int uint; */ -typedef unsigned long ulong_t; -typedef unsigned short ushort_t; -typedef unsigned char uchar_t; -typedef unsigned char queue_t; -typedef unsigned char mblk_t; -typedef unsigned int paddr_t; -typedef unsigned char uchar; - -#define TPNULL ((ushort)(0x8000)) - - -/* -** RIO structures defined in other include files. -*/ -typedef struct PKT PKT; -typedef struct LPB LPB; -typedef struct RUP RUP; -typedef struct Port Port; -typedef struct DpRam DpRam; - -#endif /* __rio_typdef_h__ */ diff --git a/drivers/char/rio/unixrup.h b/drivers/char/rio/unixrup.h index a126c7cabac..4306e01dbf0 100644 --- a/drivers/char/rio/unixrup.h +++ b/drivers/char/rio/unixrup.h @@ -45,9 +45,9 @@ struct UnixRup { struct CmdBlk *CmdsWaitingP; /* Commands waiting to be done */ struct CmdBlk *CmdPendingP; /* The command currently being sent */ struct RUP *RupP; /* the Rup to send it to */ - uint Id; /* Id number */ - uint BaseSysPort; /* SysPort of first tty on this RTA */ - uint ModTypes; /* Modules on this RTA */ + unsigned int Id; /* Id number */ + unsigned int BaseSysPort; /* SysPort of first tty on this RTA */ + unsigned int ModTypes; /* Modules on this RTA */ spinlock_t RupLock; /* Lock structure for MPX */ /* struct lockb RupLock; *//* Lock structure for MPX */ }; |