Skip to content

Commit

Permalink
[PATCH] rio driver rework continued #1
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Alan Cox authored and Linus Torvalds committed Mar 24, 2006
1 parent b6c6b60 commit 27c6e52
Show file tree
Hide file tree
Showing 10 changed files with 118 additions and 167 deletions.
48 changes: 24 additions & 24 deletions drivers/char/rio/cmdpkt.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
67 changes: 31 additions & 36 deletions drivers/char/rio/daemon.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
};

/*
Expand All @@ -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 */
};

Expand All @@ -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 {
Expand Down
56 changes: 27 additions & 29 deletions drivers/char/rio/host.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
paddr_t 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 !
Expand All @@ -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
Expand All @@ -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
Expand Down
4 changes: 2 additions & 2 deletions drivers/char/rio/link.h
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,8 @@ struct LPB {
u16 mon_ltt;
u16 mon_lrt;
u16 WaitNoBoot; /* Secs to hold off booting */
PKT_ptr add_packet_list; /* Add packets to here */
PKT_ptr remove_packet_list; /* Send packets from here */
u16 add_packet_list; /* Add packets to here */
u16 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 */
Expand Down
41 changes: 1 addition & 40 deletions drivers/char/rio/linux_compat.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,56 +19,16 @@
#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
Expand All @@ -91,6 +51,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
Expand Down
2 changes: 1 addition & 1 deletion drivers/char/rio/port.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ struct Port {
struct gs_port gs;
int PortNum; /* RIO port no., 0-511 */
struct Host *HostP;
volatile caddr_t Caddr;
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 */
Expand Down
Loading

0 comments on commit 27c6e52

Please sign in to comment.