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

[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,8 +1116,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 */
......
......@@ -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>
......@@ -143,17 +144,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 0x%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 +171,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 +185,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 +212,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 +250,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 +259,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 +345,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++) {
......@@ -379,10 +380,10 @@ static int RIOCommandRup(struct rio_info *p, uint Rup, struct Host *HostP, PKT *
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 +396,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);
......@@ -421,7 +422,7 @@ static int RIOCommandRup(struct rio_info *p, uint Rup, struct Host *HostP, PKT *
}
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
......@@ -434,15 +435,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 +451,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 +468,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 +515,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 +525,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,7 +534,7 @@ 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);
......@@ -566,10 +561,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 +572,7 @@ struct CmdBlk *RIOGetCmdBlk(void)
*/
void RIOFreeCmdBlk(struct CmdBlk *CmdBlkP)
{
sysfree((void *) CmdBlkP, sizeof(struct CmdBlk));
kfree(CmdBlkP);
}
/*
......@@ -591,7 +585,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,7 +599,7 @@ 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)
if ((UnixRupP->CmdsWaitingP == NULL) && (UnixRupP->CmdPendingP == NULL) && (readw(&UnixRupP->RupP->txcontrol) == TX_RUP_INACTIVE) && (CmdBlkP->PreFuncP ? (*CmdBlkP->PreFuncP) (CmdBlkP->PreArg, CmdBlkP)
: TRUE)) {
rio_dprintk(RIO_DEBUG_CMD, "RUP inactive-placing command straight on. Cmd byte is 0x%x\n", CmdBlkP->Packet.data[0]);
......@@ -622,7 +616,7 @@ 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);
......@@ -634,20 +628,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 0x%p at 0x%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 0x%p here\n", *Base);
Base = &((*Base)->NextP);