Commit 27c6e526f34760a9c48a90112242b7165064fa85

Authored by Alan Cox
Committed by Linus Torvalds
1 parent b6c6b6021e

[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: Alan Cox <alan@redhat.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>

Showing 10 changed files with 118 additions and 167 deletions Side-by-side Diff

drivers/char/rio/cmdpkt.h
... ... @@ -118,45 +118,45 @@
118 118 union {
119 119 struct {
120 120 struct {
121   - uchar PcCommand;
  121 + u8 PcCommand;
122 122 union {
123   - uchar PcPhbNum;
124   - uchar PcLinkNum;
125   - uchar PcIDNum;
  123 + u8 PcPhbNum;
  124 + u8 PcLinkNum;
  125 + u8 PcIDNum;
126 126 } U0;
127 127 } CmdHdr;
128 128 struct {
129   - ushort NumPackets;
130   - ushort LoadBase;
131   - ushort CodeSize;
  129 + u16 NumPackets;
  130 + u16 LoadBase;
  131 + u16 CodeSize;
132 132 } PcBootSequence;
133 133 } S1;
134 134 struct {
135   - ushort PcSequence;
136   - uchar PcBootData[RTA_BOOT_DATA_SIZE];
  135 + u16 PcSequence;
  136 + u8 PcBootData[RTA_BOOT_DATA_SIZE];
137 137 } S2;
138 138 struct {
139   - ushort __crud__;
140   - uchar PcUniqNum[4]; /* this is really a uint. */
141   - uchar PcModuleTypes; /* what modules are fitted */
  139 + u16 __crud__;
  140 + u8 PcUniqNum[4]; /* this is really a uint. */
  141 + u8 PcModuleTypes; /* what modules are fitted */
142 142 } S3;
143 143 struct {
144   - ushort __cmd_hdr__;
145   - uchar __undefined__;
146   - uchar PcModemStatus;
147   - uchar PcPortStatus;
148   - uchar PcSubCommand;
149   - ushort PcSubAddr;
150   - uchar PcSubData[64];
  144 + u16 __cmd_hdr__;
  145 + u8 __undefined__;
  146 + u8 PcModemStatus;
  147 + u8 PcPortStatus;
  148 + u8 PcSubCommand;
  149 + u16 PcSubAddr;
  150 + u8 PcSubData[64];
151 151 } S4;
152 152 struct {
153   - ushort __cmd_hdr__;
154   - uchar PcCommandText[1];
155   - uchar __crud__[20];
156   - uchar PcIDNum2; /* Tacked on end */
  153 + u16 __cmd_hdr__;
  154 + u8 PcCommandText[1];
  155 + u8 __crud__[20];
  156 + u8 PcIDNum2; /* Tacked on end */
157 157 } S5;
158 158 struct {
159   - ushort __cmd_hdr__;
  159 + u16 __cmd_hdr__;
160 160 struct Top Topology[LINKS_PER_UNIT];
161 161 } S6;
162 162 } U1;
drivers/char/rio/daemon.h
... ... @@ -45,15 +45,15 @@
45 45 */
46 46  
47 47 struct Error {
48   - uint Error;
49   - uint Entry;
50   - uint Other;
  48 + unsigned int Error;
  49 + unsigned int Entry;
  50 + unsigned int Other;
51 51 };
52 52  
53 53 struct DownLoad {
54 54 char *DataP;
55   - uint Count;
56   - uint ProductCode;
  55 + unsigned int Count;
  56 + unsigned int ProductCode;
57 57 };
58 58  
59 59 /*
60 60  
61 61  
62 62  
63 63  
64 64  
65 65  
66 66  
67 67  
68 68  
69 69  
70 70  
... ... @@ -68,69 +68,64 @@
68 68 #endif
69 69  
70 70 struct PortSetup {
71   - uint From; /* Set/Clear XP & IXANY Control from this port.... */
72   - uint To; /* .... to this port */
73   - uint XpCps; /* at this speed */
  71 + unsigned int From; /* Set/Clear XP & IXANY Control from this port.... */
  72 + unsigned int To; /* .... to this port */
  73 + unsigned int XpCps; /* at this speed */
74 74 char XpOn[MAX_XP_CTRL_LEN]; /* this is the start string */
75 75 char XpOff[MAX_XP_CTRL_LEN]; /* this is the stop string */
76   - uchar IxAny; /* enable/disable IXANY */
77   - uchar IxOn; /* enable/disable IXON */
78   - uchar Lock; /* lock port params */
79   - uchar Store; /* store params across closes */
80   - uchar Drain; /* close only when drained */
  76 + u8 IxAny; /* enable/disable IXANY */
  77 + u8 IxOn; /* enable/disable IXON */
  78 + u8 Lock; /* lock port params */
  79 + u8 Store; /* store params across closes */
  80 + u8 Drain; /* close only when drained */
81 81 };
82 82  
83 83 struct LpbReq {
84   - uint Host;
85   - uint Link;
  84 + unsigned int Host;
  85 + unsigned int Link;
86 86 struct LPB *LpbP;
87 87 };
88 88  
89 89 struct RupReq {
90   - uint HostNum;
91   - uint RupNum;
  90 + unsigned int HostNum;
  91 + unsigned int RupNum;
92 92 struct RUP *RupP;
93 93 };
94 94  
95 95 struct PortReq {
96   - uint SysPort;
  96 + unsigned int SysPort;
97 97 struct Port *PortP;
98 98 };
99 99  
100 100 struct StreamInfo {
101   - uint SysPort;
102   -#if 0
103   - queue_t RQueue;
104   - queue_t WQueue;
105   -#else
  101 + unsigned int SysPort;
106 102 int RQueue;
107 103 int WQueue;
108   -#endif
109 104 };
110 105  
111 106 struct HostReq {
112   - uint HostNum;
  107 + unsigned int HostNum;
113 108 struct Host *HostP;
114 109 };
115 110  
116 111 struct HostDpRam {
117   - uint HostNum;
  112 + unsigned int HostNum;
118 113 struct DpRam *DpRamP;
119 114 };
120 115  
121 116 struct DebugCtrl {
122   - uint SysPort;
123   - uint Debug;
124   - uint Wait;
  117 + unsigned int SysPort;
  118 + unsigned int Debug;
  119 + unsigned int Wait;
125 120 };
126 121  
127 122 struct MapInfo {
128   - uint FirstPort; /* 8 ports, starting from this (tty) number */
129   - uint RtaUnique; /* reside on this RTA (unique number) */
  123 + unsigned int FirstPort; /* 8 ports, starting from this (tty) number */
  124 + unsigned int RtaUnique; /* reside on this RTA (unique number) */
130 125 };
131 126  
132 127 struct MapIn {
133   - uint NumEntries; /* How many port sets are we mapping? */
  128 + unsigned int NumEntries; /* How many port sets are we mapping? */
134 129 struct MapInfo *MapInfoP; /* Pointer to (user space) info */
135 130 };
136 131  
137 132  
... ... @@ -147,13 +142,13 @@
147 142 };
148 143  
149 144 struct IdentifyRta {
150   - ulong RtaUnique;
151   - uchar ID;
  145 + unsigned long RtaUnique;
  146 + u8 ID;
152 147 };
153 148  
154 149 struct KillNeighbour {
155   - ulong UniqueNum;
156   - uchar Link;
  150 + unsigned long UniqueNum;
  151 + u8 Link;
157 152 };
158 153  
159 154 struct rioVersion {
drivers/char/rio/host.h
... ... @@ -50,22 +50,20 @@
50 50 ** the host.
51 51 */
52 52 struct Host {
53   - uchar Type; /* RIO_EISA, RIO_MCA, ... */
54   - uchar Ivec; /* POLLED or ivec number */
55   - uchar Mode; /* Control stuff */
56   - uchar Slot; /* Slot */
57   - volatile caddr_t Caddr; /* KV address of DPRAM */
58   - volatile struct DpRam *CardP; /* KV address of DPRAM, with overlay */
59   - paddr_t PaddrP; /* Phys. address of DPRAM */
  53 + unsigned char Type; /* RIO_EISA, RIO_MCA, ... */
  54 + unsigned char Ivec; /* POLLED or ivec number */
  55 + unsigned char Mode; /* Control stuff */
  56 + unsigned char Slot; /* Slot */
  57 + caddr_t Caddr; /* KV address of DPRAM */
  58 + struct DpRam *CardP; /* KV address of DPRAM, with overlay */
  59 + paddr_t PaddrP; /* Phys. address of DPRAM */
60 60 char Name[MAX_NAME_LEN]; /* The name of the host */
61   - uint UniqueNum; /* host unique number */
  61 + unsigned int UniqueNum; /* host unique number */
62 62 spinlock_t HostLock; /* Lock structure for MPX */
63   - /*struct pci_devinfo PciDevInfo; *//* PCI Bus/Device/Function stuff */
64   - /*struct lockb HostLock; *//* Lock structure for MPX */
65   - uint WorkToBeDone; /* set to true each interrupt */
66   - uint InIntr; /* Being serviced? */
67   - uint IntSrvDone; /* host's interrupt has been serviced */
68   - int (*Copy) (caddr_t, caddr_t, int); /* copy func */
  63 + unsigned int WorkToBeDone; /* set to true each interrupt */
  64 + unsigned int InIntr; /* Being serviced? */
  65 + unsigned int IntSrvDone; /* host's interrupt has been serviced */
  66 + void (*Copy) (void *, void *, int); /* copy func */
69 67 struct timer_list timer;
70 68 /*
71 69 ** I M P O R T A N T !
... ... @@ -74,7 +72,7 @@
74 72 ** a RIO_HOST_FOAD command.
75 73 */
76 74  
77   - ulong Flags; /* Whats going down */
  75 + unsigned long Flags; /* Whats going down */
78 76 #define RC_WAITING 0
79 77 #define RC_STARTUP 1
80 78 #define RC_RUNNING 2
81 79  
82 80  
... ... @@ -88,28 +86,28 @@
88 86 ** Boot mode applies to the way in which hosts in this system will
89 87 ** boot RTAs
90 88 */
91   -#define RC_BOOT_ALL 0x8 /* Boot all RTAs attached */
92   -#define RC_BOOT_OWN 0x10 /* Only boot RTAs bound to this system */
93   -#define RC_BOOT_NONE 0x20 /* Don't boot any RTAs (slave mode) */
  89 +#define RC_BOOT_ALL 0x8 /* Boot all RTAs attached */
  90 +#define RC_BOOT_OWN 0x10 /* Only boot RTAs bound to this system */
  91 +#define RC_BOOT_NONE 0x20 /* Don't boot any RTAs (slave mode) */
94 92  
95 93 struct Top Topology[LINKS_PER_UNIT]; /* one per link */
96   - struct Map Mapping[MAX_RUP]; /* Mappings for host */
97   - struct PHB *PhbP; /* Pointer to the PHB array */
98   - ushort *PhbNumP; /* Ptr to Number of PHB's */
99   - struct LPB *LinkStrP; /* Link Structure Array */
100   - struct RUP *RupP; /* Sixteen real rups here */
101   - struct PARM_MAP *ParmMapP; /* points to the parmmap */
102   - uint ExtraUnits[MAX_EXTRA_UNITS]; /* unknown things */
103   - uint NumExtraBooted; /* how many of the above */
  94 + struct Map Mapping[MAX_RUP]; /* Mappings for host */
  95 + struct PHB *PhbP; /* Pointer to the PHB array */
  96 + unsigned short *PhbNumP; /* Ptr to Number of PHB's */
  97 + struct LPB *LinkStrP; /* Link Structure Array */
  98 + struct RUP *RupP; /* Sixteen real rups here */
  99 + struct PARM_MAP *ParmMapP; /* points to the parmmap */
  100 + unsigned int ExtraUnits[MAX_EXTRA_UNITS]; /* unknown things */
  101 + unsigned int NumExtraBooted; /* how many of the above */
104 102 /*
105 103 ** Twenty logical rups.
106 104 ** The first sixteen are the real Rup entries (above), the last four
107 105 ** are the link RUPs.
108 106 */
109 107 struct UnixRup UnixRups[MAX_RUP + LINKS_PER_UNIT];
110   - int timeout_id; /* For calling 100 ms delays */
111   - int timeout_sem; /* For calling 100 ms delays */
112   - long locks; /* long req'd for set_bit --RR */
  108 + int timeout_id; /* For calling 100 ms delays */
  109 + int timeout_sem; /* For calling 100 ms delays */
  110 + long locks; /* long req'd for set_bit --RR */
113 111 char ____end_marker____;
114 112 };
115 113 #define Control CardP->DpControl
drivers/char/rio/link.h
... ... @@ -68,8 +68,8 @@
68 68 u16 mon_ltt;
69 69 u16 mon_lrt;
70 70 u16 WaitNoBoot; /* Secs to hold off booting */
71   - PKT_ptr add_packet_list; /* Add packets to here */
72   - PKT_ptr remove_packet_list; /* Send packets from here */
  71 + u16 add_packet_list; /* Add packets to here */
  72 + u16 remove_packet_list; /* Send packets from here */
73 73  
74 74 Channel_ptr lrt_fail_chan; /* Lrt's failure channel */
75 75 Channel_ptr ltt_fail_chan; /* Ltt's failure channel */
drivers/char/rio/linux_compat.h
... ... @@ -19,56 +19,16 @@
19 19 #include <linux/interrupt.h>
20 20  
21 21  
22   -#define disable(oldspl) save_flags (oldspl)
23   -#define restore(oldspl) restore_flags (oldspl)
24   -
25   -#define sysbrk(x) kmalloc ((x),in_interrupt()? GFP_ATOMIC : GFP_KERNEL)
26   -#define sysfree(p,size) kfree ((p))
27   -
28   -#define WBYTE(p,v) writeb(v, &p)
29   -#define RBYTE(p) readb (&p)
30   -#define WWORD(p,v) writew(v, &p)
31   -#define RWORD(p) readw(&p)
32   -#define WINDW(p,v) writew(v, p)
33   -#define RINDW(p) readw(p)
34   -
35 22 #define DEBUG_ALL
36 23  
37   -#define cprintf printk
38   -
39   -#ifdef __KERNEL__
40   -#define INKERNEL
41   -#endif
42   -
43 24 struct ttystatics {
44 25 struct termios tm;
45 26 };
46 27  
47   -#define bzero(d, n) memset((d), 0, (n))
48 28 #define bcopy(src, dest, n) memcpy ((dest), (src), (n))
49 29  
50 30 #define SEM_SIGIGNORE 0x1234
51 31  
52   -#ifdef DEBUG_SEM
53   -#define swait(a,b) printk ("waiting: " __FILE__ " line %d\n", __LINE__)
54   -#define ssignal(sem) printk ("signalling: " __FILE__ " line %d\n", __LINE__)
55   -
56   -#define sreset(sem) printk ("sreset: " __FILE__ "\n")
57   -#define sem_init(sem,v) printk ("sreset: " __FILE__ "\n")
58   -#endif
59   -
60   -
61   -#define getpid() (current->pid)
62   -
63   -#define QSIZE SERIAL_XMIT_SIZE
64   -
65   -#define pseterr(errno) return (- errno)
66   -
67   -#define V_CBAUD CBAUD
68   -
69   -/* For one reason or another rioboot.c uses delay instead of RIODelay. */
70   -#define delay(x,y) RIODelay(NULL, y)
71   -
72 32 extern int rio_debug;
73 33  
74 34 #define RIO_DEBUG_INIT 0x000001
... ... @@ -90,6 +50,7 @@
90 50 #define RIO_DEBUG_SPINLOCK 0x010000
91 51 #define RIO_DEBUG_DELAY 0x020000
92 52 #define RIO_DEBUG_MOD_COUNT 0x040000
  53 +
93 54  
94 55 /* Copied over from riowinif.h . This is ugly. The winif file declares
95 56 also much other stuff which is incompatible with the headers from
drivers/char/rio/port.h
... ... @@ -40,7 +40,7 @@
40 40 struct gs_port gs;
41 41 int PortNum; /* RIO port no., 0-511 */
42 42 struct Host *HostP;
43   - volatile caddr_t Caddr;
  43 + caddr_t Caddr;
44 44 unsigned short HostPort; /* Port number on host card */
45 45 unsigned char RupNum; /* Number of RUP for port */
46 46 unsigned char ID2; /* Second ID of RTA for port */
drivers/char/rio/riodrvr.h
... ... @@ -72,42 +72,42 @@
72 72 */
73 73 int RIOHalted; /* halted ? */
74 74 int RIORtaDisCons; /* RTA connections/disconnections */
75   - uint RIOReadCheck; /* Rio read check */
76   - uint RIONoMessage; /* To display message or not */
77   - uint RIONumBootPkts; /* how many packets for an RTA */
78   - uint RIOBootCount; /* size of RTA code */
79   - uint RIOBooting; /* count of outstanding boots */
80   - uint RIOSystemUp; /* Booted ?? */
81   - uint RIOCounting; /* for counting interrupts */
82   - uint RIOIntCount; /* # of intr since last check */
83   - uint RIOTxCount; /* number of xmit intrs */
84   - uint RIORxCount; /* number of rx intrs */
85   - uint RIORupCount; /* number of rup intrs */
  75 + unsigned int RIOReadCheck; /* Rio read check */
  76 + unsigned int RIONoMessage; /* To display message or not */
  77 + unsigned int RIONumBootPkts; /* how many packets for an RTA */
  78 + unsigned int RIOBootCount; /* size of RTA code */
  79 + unsigned int RIOBooting; /* count of outstanding boots */
  80 + unsigned int RIOSystemUp; /* Booted ?? */
  81 + unsigned int RIOCounting; /* for counting interrupts */
  82 + unsigned int RIOIntCount; /* # of intr since last check */
  83 + unsigned int RIOTxCount; /* number of xmit intrs */
  84 + unsigned int RIORxCount; /* number of rx intrs */
  85 + unsigned int RIORupCount; /* number of rup intrs */
86 86 int RIXTimer;
87 87 int RIOBufferSize; /* Buffersize */
88 88 int RIOBufferMask; /* Buffersize */
89 89  
90 90 int RIOFirstMajor; /* First host card's major no */
91 91  
92   - uint RIOLastPortsMapped; /* highest port number known */
93   - uint RIOFirstPortsMapped; /* lowest port number known */
  92 + unsigned int RIOLastPortsMapped; /* highest port number known */
  93 + unsigned int RIOFirstPortsMapped; /* lowest port number known */
94 94  
95   - uint RIOLastPortsBooted; /* highest port number running */
96   - uint RIOFirstPortsBooted; /* lowest port number running */
  95 + unsigned int RIOLastPortsBooted; /* highest port number running */
  96 + unsigned int RIOFirstPortsBooted; /* lowest port number running */
97 97  
98   - uint RIOLastPortsOpened; /* highest port number running */
99   - uint RIOFirstPortsOpened; /* lowest port number running */
  98 + unsigned int RIOLastPortsOpened; /* highest port number running */
  99 + unsigned int RIOFirstPortsOpened; /* lowest port number running */
100 100  
101 101 /* Flag to say that the topology information has been changed. */
102   - uint RIOQuickCheck;
103   - uint CdRegister; /* ??? */
  102 + unsigned int RIOQuickCheck;
  103 + unsigned int CdRegister; /* ??? */
104 104 int RIOSignalProcess; /* Signalling process */
105 105 int rio_debug; /* To debug ... */
106 106 int RIODebugWait; /* For what ??? */
107 107 int tpri; /* Thread prio */
108 108 int tid; /* Thread id */
109   - uint _RIO_Polled; /* Counter for polling */
110   - uint _RIO_Interrupted; /* Counter for interrupt */
  109 + unsigned int _RIO_Polled; /* Counter for polling */
  110 + unsigned int _RIO_Interrupted; /* Counter for interrupt */
111 111 int intr_tid; /* iointset return value */
112 112 int TxEnSem; /* TxEnable Semaphore */
113 113  
114 114  
... ... @@ -121,9 +121,9 @@
121 121 struct Map RIOSavedTable[TOTAL_MAP_ENTRIES];
122 122  
123 123 /* RTA to host binding table for master/slave operation */
124   - ulong RIOBindTab[MAX_RTA_BINDINGS];
  124 + unsigned long RIOBindTab[MAX_RTA_BINDINGS];
125 125 /* RTA memory dump variable */
126   - uchar RIOMemDump[MEMDUMP_SIZE];
  126 + unsigned char RIOMemDump[MEMDUMP_SIZE];
127 127 struct ModuleInfo RIOModuleTypes[MAX_MODULE_TYPES];
128 128  
129 129 };
... ... @@ -138,8 +138,6 @@
138 138  
139 139  
140 140 #define RIO_RESET_INT 0x7d80
141   -#define WRBYTE(x,y) *(volatile unsigned char *)((x)) = \
142   - (unsigned char)(y)
143 141  
144 142 #endif /* __riodrvr.h */
drivers/char/rio/rup.h
... ... @@ -53,8 +53,8 @@
53 53 #define RUP_NO_OWNER 0xff /* RUP not owned by any process */
54 54  
55 55 struct RUP {
56   - PKT_ptr txpkt; /* Outgoing packet */
57   - PKT_ptr rxpkt; /* Incoming packet */
  56 + u16 txpkt; /* Outgoing packet */
  57 + u16 rxpkt; /* Incoming packet */
58 58 u16 link; /* Which link to send down? */
59 59 u8 rup_dest_unit[2]; /* Destination unit */
60 60 u16 handshake; /* For handshaking */
drivers/char/rio/top.h
... ... @@ -41,8 +41,8 @@
41 41 ** Topology information
42 42 */
43 43 struct Top {
44   - uchar Unit;
45   - uchar Link;
  44 + u8 Unit;
  45 + u8 Link;
46 46 };
47 47  
48 48 #endif /* __rio_top_h__ */
drivers/char/rio/typdef.h
... ... @@ -39,10 +39,10 @@
39 39 ** These types are ONLY to be used for refering to data structures
40 40 ** on the RIO Host card!
41 41 */
42   -typedef volatile u8 BYTE;
43   -typedef volatile u16 WORD;
44   -typedef volatile u32 DWORD;
45   -typedef volatile u16 RIOP;
  42 +typedef u8 BYTE;
  43 +typedef u16 WORD;
  44 +typedef u32 DWORD;
  45 +typedef u16 RIOP;
46 46  
47 47  
48 48 /*
... ... @@ -57,8 +57,7 @@
57 57 typedef unsigned char uchar_t;
58 58 typedef unsigned char queue_t;
59 59 typedef unsigned char mblk_t;
60   -typedef unsigned int paddr_t;
61   -typedef unsigned char uchar;
  60 +typedef unsigned long paddr_t;
62 61  
63 62 #define TPNULL ((ushort)(0x8000))
64 63