Commit 27c6e526 authored by Alan Cox's avatar Alan Cox Committed by Linus Torvalds

[PATCH] rio driver rework continued #1

More header cleanups, strip out typedefs and remove cruft.  There are a lot of
magic macros that can go and also a great deal of abuse of volatile that is
not needed any more as this patch set cleans up the misuse of pointer access
to ISA and PCI space.

It now builds cleanly on 64bit, although there is more work left to do
Signed-off-by: default avatarAlan Cox <alan@redhat.com>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent b6c6b602
...@@ -118,45 +118,45 @@ struct PktCmd_M { ...@@ -118,45 +118,45 @@ struct PktCmd_M {
union { union {
struct { struct {
struct { struct {
uchar PcCommand; u8 PcCommand;
union { union {
uchar PcPhbNum; u8 PcPhbNum;
uchar PcLinkNum; u8 PcLinkNum;
uchar PcIDNum; u8 PcIDNum;
} U0; } U0;
} CmdHdr; } CmdHdr;
struct { struct {
ushort NumPackets; u16 NumPackets;
ushort LoadBase; u16 LoadBase;
ushort CodeSize; u16 CodeSize;
} PcBootSequence; } PcBootSequence;
} S1; } S1;
struct { struct {
ushort PcSequence; u16 PcSequence;
uchar PcBootData[RTA_BOOT_DATA_SIZE]; u8 PcBootData[RTA_BOOT_DATA_SIZE];
} S2; } S2;
struct { struct {
ushort __crud__; u16 __crud__;
uchar PcUniqNum[4]; /* this is really a uint. */ u8 PcUniqNum[4]; /* this is really a uint. */
uchar PcModuleTypes; /* what modules are fitted */ u8 PcModuleTypes; /* what modules are fitted */
} S3; } S3;
struct { struct {
ushort __cmd_hdr__; u16 __cmd_hdr__;
uchar __undefined__; u8 __undefined__;
uchar PcModemStatus; u8 PcModemStatus;
uchar PcPortStatus; u8 PcPortStatus;
uchar PcSubCommand; u8 PcSubCommand;
ushort PcSubAddr; u16 PcSubAddr;
uchar PcSubData[64]; u8 PcSubData[64];
} S4; } S4;
struct { struct {
ushort __cmd_hdr__; u16 __cmd_hdr__;
uchar PcCommandText[1]; u8 PcCommandText[1];
uchar __crud__[20]; u8 __crud__[20];
uchar PcIDNum2; /* Tacked on end */ u8 PcIDNum2; /* Tacked on end */
} S5; } S5;
struct { struct {
ushort __cmd_hdr__; u16 __cmd_hdr__;
struct Top Topology[LINKS_PER_UNIT]; struct Top Topology[LINKS_PER_UNIT];
} S6; } S6;
} U1; } U1;
......
...@@ -45,15 +45,15 @@ static char *_daemon_h_sccs_ = "@(#)daemon.h 1.3"; ...@@ -45,15 +45,15 @@ static char *_daemon_h_sccs_ = "@(#)daemon.h 1.3";
*/ */
struct Error { struct Error {
uint Error; unsigned int Error;
uint Entry; unsigned int Entry;
uint Other; unsigned int Other;
}; };
struct DownLoad { struct DownLoad {
char *DataP; char *DataP;
uint Count; unsigned int Count;
uint ProductCode; unsigned int ProductCode;
}; };
/* /*
...@@ -68,69 +68,64 @@ struct DownLoad { ...@@ -68,69 +68,64 @@ struct DownLoad {
#endif #endif
struct PortSetup { struct PortSetup {
uint From; /* Set/Clear XP & IXANY Control from this port.... */ unsigned int From; /* Set/Clear XP & IXANY Control from this port.... */
uint To; /* .... to this port */ unsigned int To; /* .... to this port */
uint XpCps; /* at this speed */ unsigned int XpCps; /* at this speed */
char XpOn[MAX_XP_CTRL_LEN]; /* this is the start string */ char XpOn[MAX_XP_CTRL_LEN]; /* this is the start string */
char XpOff[MAX_XP_CTRL_LEN]; /* this is the stop string */ char XpOff[MAX_XP_CTRL_LEN]; /* this is the stop string */
uchar IxAny; /* enable/disable IXANY */ u8 IxAny; /* enable/disable IXANY */
uchar IxOn; /* enable/disable IXON */ u8 IxOn; /* enable/disable IXON */
uchar Lock; /* lock port params */ u8 Lock; /* lock port params */
uchar Store; /* store params across closes */ u8 Store; /* store params across closes */
uchar Drain; /* close only when drained */ u8 Drain; /* close only when drained */
}; };
struct LpbReq { struct LpbReq {
uint Host; unsigned int Host;
uint Link; unsigned int Link;
struct LPB *LpbP; struct LPB *LpbP;
}; };
struct RupReq { struct RupReq {
uint HostNum; unsigned int HostNum;
uint RupNum; unsigned int RupNum;
struct RUP *RupP; struct RUP *RupP;
}; };
struct PortReq { struct PortReq {
uint SysPort; unsigned int SysPort;
struct Port *PortP; struct Port *PortP;
}; };
struct StreamInfo { struct StreamInfo {
uint SysPort; unsigned int SysPort;
#if 0
queue_t RQueue;
queue_t WQueue;
#else
int RQueue; int RQueue;
int WQueue; int WQueue;
#endif
}; };
struct HostReq { struct HostReq {
uint HostNum; unsigned int HostNum;
struct Host *HostP; struct Host *HostP;
}; };
struct HostDpRam { struct HostDpRam {
uint HostNum; unsigned int HostNum;
struct DpRam *DpRamP; struct DpRam *DpRamP;
}; };
struct DebugCtrl { struct DebugCtrl {
uint SysPort; unsigned int SysPort;
uint Debug; unsigned int Debug;
uint Wait; unsigned int Wait;
}; };
struct MapInfo { struct MapInfo {
uint FirstPort; /* 8 ports, starting from this (tty) number */ unsigned int FirstPort; /* 8 ports, starting from this (tty) number */
uint RtaUnique; /* reside on this RTA (unique number) */ unsigned int RtaUnique; /* reside on this RTA (unique number) */
}; };
struct MapIn { 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 */ struct MapInfo *MapInfoP; /* Pointer to (user space) info */
}; };
...@@ -147,13 +142,13 @@ struct SpecialRupCmd { ...@@ -147,13 +142,13 @@ struct SpecialRupCmd {
}; };
struct IdentifyRta { struct IdentifyRta {
ulong RtaUnique; unsigned long RtaUnique;
uchar ID; u8 ID;
}; };
struct KillNeighbour { struct KillNeighbour {
ulong UniqueNum; unsigned long UniqueNum;
uchar Link; u8 Link;
}; };
struct rioVersion { struct rioVersion {
......
...@@ -50,22 +50,20 @@ static char *_host_h_sccs_ = "@(#)host.h 1.2"; ...@@ -50,22 +50,20 @@ static char *_host_h_sccs_ = "@(#)host.h 1.2";
** the host. ** the host.
*/ */
struct Host { struct Host {
uchar Type; /* RIO_EISA, RIO_MCA, ... */ unsigned char Type; /* RIO_EISA, RIO_MCA, ... */
uchar Ivec; /* POLLED or ivec number */ unsigned char Ivec; /* POLLED or ivec number */
uchar Mode; /* Control stuff */ unsigned char Mode; /* Control stuff */
uchar Slot; /* Slot */ unsigned char Slot; /* Slot */
volatile caddr_t Caddr; /* KV address of DPRAM */ caddr_t Caddr; /* KV address of DPRAM */
volatile struct DpRam *CardP; /* KV address of DPRAM, with overlay */ struct DpRam *CardP; /* KV address of DPRAM, with overlay */
paddr_t PaddrP; /* Phys. address of DPRAM */ paddr_t PaddrP; /* Phys. address of DPRAM */
char Name[MAX_NAME_LEN]; /* The name of the host */ 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 */ spinlock_t HostLock; /* Lock structure for MPX */
/*struct pci_devinfo PciDevInfo; *//* PCI Bus/Device/Function stuff */ unsigned int WorkToBeDone; /* set to true each interrupt */
/*struct lockb HostLock; *//* Lock structure for MPX */ unsigned int InIntr; /* Being serviced? */
uint WorkToBeDone; /* set to true each interrupt */ unsigned int IntSrvDone; /* host's interrupt has been serviced */
uint InIntr; /* Being serviced? */ void (*Copy) (void *, void *, int); /* copy func */
uint IntSrvDone; /* host's interrupt has been serviced */
int (*Copy) (caddr_t, caddr_t, int); /* copy func */
struct timer_list timer; struct timer_list timer;
/* /*
** I M P O R T A N T ! ** I M P O R T A N T !
...@@ -74,7 +72,7 @@ struct Host { ...@@ -74,7 +72,7 @@ struct Host {
** a RIO_HOST_FOAD command. ** a RIO_HOST_FOAD command.
*/ */
ulong Flags; /* Whats going down */ unsigned long Flags; /* Whats going down */
#define RC_WAITING 0 #define RC_WAITING 0
#define RC_STARTUP 1 #define RC_STARTUP 1
#define RC_RUNNING 2 #define RC_RUNNING 2
...@@ -95,12 +93,12 @@ struct Host { ...@@ -95,12 +93,12 @@ struct Host {
struct Top Topology[LINKS_PER_UNIT]; /* one per link */ struct Top Topology[LINKS_PER_UNIT]; /* one per link */
struct Map Mapping[MAX_RUP]; /* Mappings for host */ struct Map Mapping[MAX_RUP]; /* Mappings for host */
struct PHB *PhbP; /* Pointer to the PHB array */ struct PHB *PhbP; /* Pointer to the PHB array */
ushort *PhbNumP; /* Ptr to Number of PHB's */ unsigned short *PhbNumP; /* Ptr to Number of PHB's */
struct LPB *LinkStrP; /* Link Structure Array */ struct LPB *LinkStrP; /* Link Structure Array */
struct RUP *RupP; /* Sixteen real rups here */ struct RUP *RupP; /* Sixteen real rups here */
struct PARM_MAP *ParmMapP; /* points to the parmmap */ struct PARM_MAP *ParmMapP; /* points to the parmmap */
uint ExtraUnits[MAX_EXTRA_UNITS]; /* unknown things */ unsigned int ExtraUnits[MAX_EXTRA_UNITS]; /* unknown things */
uint NumExtraBooted; /* how many of the above */ unsigned int NumExtraBooted; /* how many of the above */
/* /*
** Twenty logical rups. ** Twenty logical rups.
** The first sixteen are the real Rup entries (above), the last four ** The first sixteen are the real Rup entries (above), the last four
......
...@@ -68,8 +68,8 @@ struct LPB { ...@@ -68,8 +68,8 @@ struct LPB {
u16 mon_ltt; u16 mon_ltt;
u16 mon_lrt; u16 mon_lrt;
u16 WaitNoBoot; /* Secs to hold off booting */ u16 WaitNoBoot; /* Secs to hold off booting */
PKT_ptr add_packet_list; /* Add packets to here */ u16 add_packet_list; /* Add packets to here */
PKT_ptr remove_packet_list; /* Send packets from here */ u16 remove_packet_list; /* Send packets from here */
Channel_ptr lrt_fail_chan; /* Lrt's failure channel */ Channel_ptr lrt_fail_chan; /* Lrt's failure channel */
Channel_ptr ltt_fail_chan; /* Ltt's failure channel */ Channel_ptr ltt_fail_chan; /* Ltt's failure channel */
......
...@@ -19,56 +19,16 @@ ...@@ -19,56 +19,16 @@
#include <linux/interrupt.h> #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 DEBUG_ALL
#define cprintf printk
#ifdef __KERNEL__
#define INKERNEL
#endif
struct ttystatics { struct ttystatics {
struct termios tm; struct termios tm;
}; };
#define bzero(d, n) memset((d), 0, (n))
#define bcopy(src, dest, n) memcpy ((dest), (src), (n)) #define bcopy(src, dest, n) memcpy ((dest), (src), (n))
#define SEM_SIGIGNORE 0x1234 #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; extern int rio_debug;
#define RIO_DEBUG_INIT 0x000001 #define RIO_DEBUG_INIT 0x000001
...@@ -91,6 +51,7 @@ extern int rio_debug; ...@@ -91,6 +51,7 @@ extern int rio_debug;
#define RIO_DEBUG_DELAY 0x020000 #define RIO_DEBUG_DELAY 0x020000
#define RIO_DEBUG_MOD_COUNT 0x040000 #define RIO_DEBUG_MOD_COUNT 0x040000
/* Copied over from riowinif.h . This is ugly. The winif file declares /* Copied over from riowinif.h . This is ugly. The winif file declares
also much other stuff which is incompatible with the headers from also much other stuff which is incompatible with the headers from
the older driver. The older driver includes "brates.h" which shadows the older driver. The older driver includes "brates.h" which shadows
......
...@@ -40,7 +40,7 @@ struct Port { ...@@ -40,7 +40,7 @@ struct Port {
struct gs_port gs; struct gs_port gs;
int PortNum; /* RIO port no., 0-511 */ int PortNum; /* RIO port no., 0-511 */
struct Host *HostP; struct Host *HostP;
volatile caddr_t Caddr; caddr_t Caddr;
unsigned short HostPort; /* Port number on host card */ unsigned short HostPort; /* Port number on host card */
unsigned char RupNum; /* Number of RUP for port */ unsigned char RupNum; /* Number of RUP for port */
unsigned char ID2; /* Second ID of RTA for port */ unsigned char ID2; /* Second ID of RTA for port */
......
...@@ -72,42 +72,42 @@ struct rio_info { ...@@ -72,42 +72,42 @@ struct rio_info {
*/ */
int RIOHalted; /* halted ? */ int RIOHalted; /* halted ? */
int RIORtaDisCons; /* RTA connections/disconnections */ int RIORtaDisCons; /* RTA connections/disconnections */
uint RIOReadCheck; /* Rio read check */ unsigned int RIOReadCheck; /* Rio read check */
uint RIONoMessage; /* To display message or not */ unsigned int RIONoMessage; /* To display message or not */
uint RIONumBootPkts; /* how many packets for an RTA */ unsigned int RIONumBootPkts; /* how many packets for an RTA */
uint RIOBootCount; /* size of RTA code */ unsigned int RIOBootCount; /* size of RTA code */
uint RIOBooting; /* count of outstanding boots */ unsigned int RIOBooting; /* count of outstanding boots */
uint RIOSystemUp; /* Booted ?? */ unsigned int RIOSystemUp; /* Booted ?? */
uint RIOCounting; /* for counting interrupts */ unsigned int RIOCounting; /* for counting interrupts */
uint RIOIntCount; /* # of intr since last check */ unsigned int RIOIntCount; /* # of intr since last check */
uint RIOTxCount; /* number of xmit intrs */ unsigned int RIOTxCount; /* number of xmit intrs */
uint RIORxCount; /* number of rx intrs */ unsigned int RIORxCount; /* number of rx intrs */
uint RIORupCount; /* number of rup intrs */ unsigned int RIORupCount; /* number of rup intrs */
int RIXTimer; int RIXTimer;
int RIOBufferSize; /* Buffersize */ int RIOBufferSize; /* Buffersize */
int RIOBufferMask; /* Buffersize */ int RIOBufferMask; /* Buffersize */
int RIOFirstMajor; /* First host card's major no */ int RIOFirstMajor; /* First host card's major no */
uint RIOLastPortsMapped; /* highest port number known */ unsigned int RIOLastPortsMapped; /* highest port number known */
uint RIOFirstPortsMapped; /* lowest port number known */ unsigned int RIOFirstPortsMapped; /* lowest port number known */
uint RIOLastPortsBooted; /* highest port number running */ unsigned int RIOLastPortsBooted; /* highest port number running */
uint RIOFirstPortsBooted; /* lowest port number running */ unsigned int RIOFirstPortsBooted; /* lowest port number running */
uint RIOLastPortsOpened; /* highest port number running */ unsigned int RIOLastPortsOpened; /* highest port number running */
uint RIOFirstPortsOpened; /* lowest port number running */ unsigned int RIOFirstPortsOpened; /* lowest port number running */
/* Flag to say that the topology information has been changed. */ /* Flag to say that the topology information has been changed. */
uint RIOQuickCheck; unsigned int RIOQuickCheck;
uint CdRegister; /* ??? */ unsigned int CdRegister; /* ??? */
int RIOSignalProcess; /* Signalling process */ int RIOSignalProcess; /* Signalling process */
int rio_debug; /* To debug ... */ int rio_debug; /* To debug ... */
int RIODebugWait; /* For what ??? */ int RIODebugWait; /* For what ??? */
int tpri; /* Thread prio */ int tpri; /* Thread prio */
int tid; /* Thread id */ int tid; /* Thread id */
uint _RIO_Polled; /* Counter for polling */ unsigned int _RIO_Polled; /* Counter for polling */
uint _RIO_Interrupted; /* Counter for interrupt */ unsigned int _RIO_Interrupted; /* Counter for interrupt */
int intr_tid; /* iointset return value */ int intr_tid; /* iointset return value */
int TxEnSem; /* TxEnable Semaphore */ int TxEnSem; /* TxEnable Semaphore */
...@@ -121,9 +121,9 @@ struct rio_info { ...@@ -121,9 +121,9 @@ struct rio_info {
struct Map RIOSavedTable[TOTAL_MAP_ENTRIES]; struct Map RIOSavedTable[TOTAL_MAP_ENTRIES];
/* RTA to host binding table for master/slave operation */ /* RTA to host binding table for master/slave operation */
ulong RIOBindTab[MAX_RTA_BINDINGS]; unsigned long RIOBindTab[MAX_RTA_BINDINGS];
/* RTA memory dump variable */ /* RTA memory dump variable */
uchar RIOMemDump[MEMDUMP_SIZE]; unsigned char RIOMemDump[MEMDUMP_SIZE];
struct ModuleInfo RIOModuleTypes[MAX_MODULE_TYPES]; struct ModuleInfo RIOModuleTypes[MAX_MODULE_TYPES];
}; };
...@@ -138,7 +138,5 @@ struct rio_info { ...@@ -138,7 +138,5 @@ struct rio_info {
#define RIO_RESET_INT 0x7d80 #define RIO_RESET_INT 0x7d80
#define WRBYTE(x,y) *(volatile unsigned char *)((x)) = \
(unsigned char)(y)
#endif /* __riodrvr.h */ #endif /* __riodrvr.h */
...@@ -53,8 +53,8 @@ ...@@ -53,8 +53,8 @@
#define RUP_NO_OWNER 0xff /* RUP not owned by any process */ #define RUP_NO_OWNER 0xff /* RUP not owned by any process */
struct RUP { struct RUP {
PKT_ptr txpkt; /* Outgoing packet */ u16 txpkt; /* Outgoing packet */
PKT_ptr rxpkt; /* Incoming packet */ u16 rxpkt; /* Incoming packet */
u16 link; /* Which link to send down? */ u16 link; /* Which link to send down? */
u8 rup_dest_unit[2]; /* Destination unit */ u8 rup_dest_unit[2]; /* Destination unit */
u16 handshake; /* For handshaking */ u16 handshake; /* For handshaking */
......
...@@ -41,8 +41,8 @@ static char *_top_h_sccs_ = "@(#)top.h 1.2"; ...@@ -41,8 +41,8 @@ static char *_top_h_sccs_ = "@(#)top.h 1.2";
** Topology information ** Topology information
*/ */
struct Top { struct Top {
uchar Unit; u8 Unit;
uchar Link; u8 Link;
}; };
#endif /* __rio_top_h__ */ #endif /* __rio_top_h__ */
...@@ -39,10 +39,10 @@ ...@@ -39,10 +39,10 @@
** These types are ONLY to be used for refering to data structures ** These types are ONLY to be used for refering to data structures
** on the RIO Host card! ** on the RIO Host card!
*/ */
typedef volatile u8 BYTE; typedef u8 BYTE;
typedef volatile u16 WORD; typedef u16 WORD;
typedef volatile u32 DWORD; typedef u32 DWORD;
typedef volatile u16 RIOP; typedef u16 RIOP;
/* /*
...@@ -57,8 +57,7 @@ typedef unsigned short ushort_t; ...@@ -57,8 +57,7 @@ typedef unsigned short ushort_t;
typedef unsigned char uchar_t; typedef unsigned char uchar_t;
typedef unsigned char queue_t; typedef unsigned char queue_t;
typedef unsigned char mblk_t; typedef unsigned char mblk_t;
typedef unsigned int paddr_t; typedef unsigned long paddr_t;
typedef unsigned char uchar;
#define TPNULL ((ushort)(0x8000)) #define TPNULL ((ushort)(0x8000))
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment