Commit 00d83a54 authored by Alan Cox's avatar Alan Cox Committed by Linus Torvalds

[PATCH] rio driver rework continued #3

Second large chunk of code cleanup.  The split between this and #3 and #4 is
fairly arbitary and due to the message length limit on the list.  These
patches continue the process of ripping out macros and typedefs while cleaning
up lots of 32bit assumptions.  Several inlines for compatibility also get
removed and that causes a lot of noise.
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 e2b3afd6
......@@ -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 */
};
......
......@@ -43,35 +43,34 @@ 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 FillSlot(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 *);
void ShowPacket(unsigned int, struct PKT *);
/* 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 +79,19 @@ 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(paddr_t, 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 +105,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 +130,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 +142,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);
......
......@@ -186,8 +186,8 @@ 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:
......
......@@ -297,7 +297,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,13 +340,16 @@ int RIODelay_ni(struct Port *PortP, int njiffies)
return !RIO_FAIL;
}
void rio_copy_to_card(void *to, void *from, int len)
{
rio_memcpy_toio(NULL, to, from, len);
}
int rio_minor(struct tty_struct *tty)
{
return tty->index + (tty->driver == rio_driver) ? 0 : 256;
}
int rio_ismodem(struct tty_struct *tty)
{
return 1;
......@@ -379,7 +382,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 +400,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 +414,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 +424,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 +853,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 +943,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
......@@ -1049,7 +1028,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);
rio_reset_interrupt(hp);
......@@ -1058,10 +1037,10 @@ static int __init rio_init(void)
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) {
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);
......@@ -1099,7 +1078,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);
......@@ -1110,10 +1089,10 @@ static int __init rio_init(void)
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);
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;
......@@ -1137,7 +1116,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_AT;
hp->Copy = rio_pcicopy; /* AT card PCI???? - PVDL
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
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
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