From 00d83a54aa824b11ebc8c66c4a879cfeb5029a22 Mon Sep 17 00:00:00 2001 From: Alan Cox Date: Fri, 24 Mar 2006 03:18:28 -0800 Subject: [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: Alan Cox Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- drivers/char/rio/rioinit.c | 186 ++++++++++++++++++--------------------------- 1 file changed, 76 insertions(+), 110 deletions(-) (limited to 'drivers/char/rio/rioinit.c') diff --git a/drivers/char/rio/rioinit.c b/drivers/char/rio/rioinit.c index 0d44ef464e6b..1d73c4646bbd 100644 --- a/drivers/char/rio/rioinit.c +++ b/drivers/char/rio/rioinit.c @@ -82,9 +82,6 @@ static char *_rioinit_c_sccs_ = "@(#)rioinit.c 1.3"; #include "rioioctl.h" #include "rio_linux.h" -#undef bcopy -#define bcopy rio_pcicopy - int RIOPCIinit(struct rio_info *p, int Mode); static int RIOScrub(int, BYTE *, int); @@ -99,12 +96,8 @@ static int RIOScrub(int, BYTE *, int); ** bits < 0 indicates 8 bit operation requested, ** bits > 0 indicates 16 bit operation. */ -int -RIOAssignAT(p, Base, virtAddr, mode) -struct rio_info * p; -int Base; -caddr_t virtAddr; -int mode; + +int RIOAssignAT(struct rio_info *p, int Base, caddr_t virtAddr, int mode) { int bits; struct DpRam *cardp = (struct DpRam *)virtAddr; @@ -124,29 +117,25 @@ int mode; /* ** Revision 01 AT host cards don't support WORD operations, */ - if ( RBYTE(cardp->DpRevision) == 01 ) + if (readb(&cardp->DpRevision) == 01) bits = BYTE_OPERATION; p->RIOHosts[p->RIONumHosts].Type = RIO_AT; - p->RIOHosts[p->RIONumHosts].Copy = bcopy; + p->RIOHosts[p->RIONumHosts].Copy = rio_copy_to_card; /* set this later */ p->RIOHosts[p->RIONumHosts].Slot = -1; p->RIOHosts[p->RIONumHosts].Mode = SLOW_LINKS | SLOW_AT_BUS | bits; - WBYTE(p->RIOHosts[p->RIONumHosts].Control, - BOOT_FROM_RAM | EXTERNAL_BUS_OFF | - p->RIOHosts[p->RIONumHosts].Mode | - INTERRUPT_DISABLE ); - WBYTE(p->RIOHosts[p->RIONumHosts].ResetInt,0xff); - WBYTE(p->RIOHosts[p->RIONumHosts].Control, - BOOT_FROM_RAM | EXTERNAL_BUS_OFF | - p->RIOHosts[p->RIONumHosts].Mode | - INTERRUPT_DISABLE ); - WBYTE(p->RIOHosts[p->RIONumHosts].ResetInt,0xff); + writeb(BOOT_FROM_RAM | EXTERNAL_BUS_OFF | p->RIOHosts[p->RIONumHosts].Mode | INTERRUPT_DISABLE , + &p->RIOHosts[p->RIONumHosts].Control); + writeb(0xFF, &p->RIOHosts[p->RIONumHosts].ResetInt); + writeb(BOOT_FROM_RAM | EXTERNAL_BUS_OFF | p->RIOHosts[p->RIONumHosts].Mode | INTERRUPT_DISABLE, + &p->RIOHosts[p->RIONumHosts].Control); + 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_INIT, "RIO-init: Uniquenum 0x%x\n",p->RIOHosts[p->RIONumHosts].UniqueNum); p->RIONumHosts++; @@ -154,7 +143,7 @@ int mode; return(1); } -static uchar val[] = { +static u8 val[] = { #ifdef VERY_LONG_TEST 0x00, 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80, 0xa5, 0xff, 0x5a, 0x00, 0xff, 0xc9, 0x36, @@ -167,12 +156,7 @@ static uchar val[] = { ** RAM test a board. ** Nothing too complicated, just enough to check it out. */ -int -RIOBoardTest(paddr, caddr, type, slot) -paddr_t paddr; -caddr_t caddr; -uchar type; -int slot; +int RIOBoardTest(paddr_t paddr, caddr_t caddr, unsigned char type, int slot) { struct DpRam *DpRam = (struct DpRam *)caddr; char *ram[4]; @@ -180,8 +164,8 @@ int slot; int op, bank; int nbanks; - rio_dprintk (RIO_DEBUG_INIT, "RIO-init: Reset host type=%d, DpRam=0x%x, slot=%d\n", - type,(int)DpRam, slot); + rio_dprintk (RIO_DEBUG_INIT, "RIO-init: Reset host type=%d, DpRam=0x%p, slot=%d\n", + type, DpRam, slot); RIOHostReset(type, DpRam, slot); @@ -209,12 +193,11 @@ int slot; if (nbanks == 3) { - rio_dprintk (RIO_DEBUG_INIT, "RIO-init: Memory: 0x%x(0x%x), 0x%x(0x%x), 0x%x(0x%x)\n", - (int)ram[0], size[0], (int)ram[1], size[1], (int)ram[2], size[2]); + rio_dprintk (RIO_DEBUG_INIT, "RIO-init: Memory: 0x%p(0x%x), 0x%p(0x%x), 0x%p(0x%x)\n", + ram[0], size[0], ram[1], size[1], ram[2], size[2]); } else { - rio_dprintk (RIO_DEBUG_INIT, "RIO-init: 0x%x(0x%x), 0x%x(0x%x), 0x%x(0x%x), 0x%x(0x%x)\n", - (int)ram[0], size[0], (int)ram[1], size[1], (int)ram[2], size[2], (int)ram[3], - size[3]); + rio_dprintk (RIO_DEBUG_INIT, "RIO-init: 0x%p(0x%x), 0x%p(0x%x), 0x%p(0x%x), 0x%p(0x%x)\n", + ram[0], size[0], ram[1], size[1], ram[2], size[2], ram[3], size[3]); } /* @@ -248,13 +231,10 @@ int slot; ** Call with op not zero, and the RAM will be read and compated with val[op-1] ** to check that the data from the previous phase was retained. */ -static int -RIOScrub(op, ram, size) -int op; -BYTE * ram; -int size; + +static int RIOScrub(int op, BYTE *ram, int size) { - int off; + int off; unsigned char oldbyte; unsigned char newbyte; unsigned char invbyte; @@ -279,15 +259,15 @@ int size; */ if (op) { for (off=0; offMapping[UnitId].Name,17); + memcpy(HostP->Mapping[UnitId].Name, "UNKNOWN RTA X-XX", 17); HostP->Mapping[UnitId].Name[12]='1'+(HostP-p->RIOHosts); if ((UnitId+1) > 9) { HostP->Mapping[UnitId].Name[14]='0'+((UnitId+1)/10); @@ -412,8 +388,7 @@ uint UnitId; static struct rioVersion stVersion; -struct rioVersion * -RIOVersid(void) +struct rioVersion *RIOVersid(void) { strlcpy(stVersion.version, "RIO driver for linux V1.0", sizeof(stVersion.version)); @@ -423,40 +398,31 @@ RIOVersid(void) return &stVersion; } -void -RIOHostReset(Type, DpRamP, Slot) -uint Type; -volatile struct DpRam *DpRamP; -uint Slot; +void RIOHostReset(unsigned int Type, struct DpRam *DpRamP, unsigned int Slot) { /* ** Reset the Tpu */ rio_dprintk (RIO_DEBUG_INIT, "RIOHostReset: type 0x%x", Type); switch ( Type ) { - case RIO_AT: - rio_dprintk (RIO_DEBUG_INIT, " (RIO_AT)\n"); - WBYTE(DpRamP->DpControl, BOOT_FROM_RAM | EXTERNAL_BUS_OFF | - INTERRUPT_DISABLE | BYTE_OPERATION | - SLOW_LINKS | SLOW_AT_BUS); - WBYTE(DpRamP->DpResetTpu, 0xFF); - udelay(3); - + case RIO_AT: + rio_dprintk (RIO_DEBUG_INIT, " (RIO_AT)\n"); + writeb(BOOT_FROM_RAM | EXTERNAL_BUS_OFF | INTERRUPT_DISABLE | BYTE_OPERATION | + SLOW_LINKS | SLOW_AT_BUS, &DpRamP->DpControl); + writeb(0xFF, &DpRamP->DpResetTpu); + udelay(3); rio_dprintk (RIO_DEBUG_INIT, "RIOHostReset: Don't know if it worked. Try reset again\n"); - WBYTE(DpRamP->DpControl, BOOT_FROM_RAM | EXTERNAL_BUS_OFF | - INTERRUPT_DISABLE | BYTE_OPERATION | - SLOW_LINKS | SLOW_AT_BUS); - WBYTE(DpRamP->DpResetTpu, 0xFF); - udelay(3); - break; + writeb(BOOT_FROM_RAM | EXTERNAL_BUS_OFF | INTERRUPT_DISABLE | + BYTE_OPERATION | SLOW_LINKS | SLOW_AT_BUS, &DpRamP->DpControl); + writeb(0xFF, &DpRamP->DpResetTpu); + udelay(3); + break; case RIO_PCI: rio_dprintk (RIO_DEBUG_INIT, " (RIO_PCI)\n"); - DpRamP->DpControl = RIO_PCI_BOOT_FROM_RAM; - DpRamP->DpResetInt = 0xFF; - DpRamP->DpResetTpu = 0xFF; + writeb(RIO_PCI_BOOT_FROM_RAM, &DpRamP->DpControl); + writeb(0xFF, &DpRamP->DpResetInt); + writeb(0xFF, &DpRamP->DpResetTpu); udelay(100); - /* for (i=0; i<6000; i++); */ - /* suspend( 3 ); */ break; default: rio_dprintk (RIO_DEBUG_INIT, " (UNKNOWN)\n"); -- cgit v1.2.1