diff options
author | Alan Cox <alan@lxorguk.ukuu.org.uk> | 2006-03-24 03:18:32 -0800 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-03-24 07:33:29 -0800 |
commit | 554b7c801e379e8c0072533b4da89a3a003cbfac (patch) | |
tree | 86f2da1549e37648948fe3d091ecc76c18714597 /drivers | |
parent | 57c2d60e1e3db506cdcecbf60f939593125db7f8 (diff) |
[PATCH] Yet more rio cleaning (2 of 2)
- Remove more unused headers
- Remove various typedefs
- Correct type of PaddrP (physical addresses should be ulong)
- Kill use of bcopy
- More printk cleanups
- Kill true/false
- Clean up direct access to pci BARs
Signed-off-by: Alan Cox <alan@redhat.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/char/rio/rio.h | 169 | ||||
-rw-r--r-- | drivers/char/rio/rio_linux.c | 70 | ||||
-rw-r--r-- | drivers/char/rio/rioboot.c | 78 | ||||
-rw-r--r-- | drivers/char/rio/riocmd.c | 52 | ||||
-rw-r--r-- | drivers/char/rio/rioctrl.c | 33 | ||||
-rw-r--r-- | drivers/char/rio/rioinit.c | 23 | ||||
-rw-r--r-- | drivers/char/rio/riointr.c | 9 | ||||
-rw-r--r-- | drivers/char/rio/rioparam.c | 39 | ||||
-rw-r--r-- | drivers/char/rio/rioroute.c | 110 | ||||
-rw-r--r-- | drivers/char/rio/riotable.c | 49 | ||||
-rw-r--r-- | drivers/char/rio/riotty.c | 179 | ||||
-rw-r--r-- | drivers/char/rio/riotypes.h | 64 | ||||
-rw-r--r-- | drivers/char/rio/rom.h | 62 | ||||
-rw-r--r-- | drivers/char/rio/sam.h | 67 | ||||
-rw-r--r-- | drivers/char/rio/space.h | 45 | ||||
-rw-r--r-- | drivers/char/rio/top.h | 48 | ||||
-rw-r--r-- | drivers/char/rio/typdef.h | 74 | ||||
-rw-r--r-- | drivers/char/rio/unixrup.h | 6 |
18 files changed, 265 insertions, 912 deletions
diff --git a/drivers/char/rio/rio.h b/drivers/char/rio/rio.h index 2d466ffe112..b4c91871ba2 100644 --- a/drivers/char/rio/rio.h +++ b/drivers/char/rio/rio.h @@ -33,38 +33,6 @@ #ifndef __rio_rio_h__ #define __rio_rio_h__ -#ifdef SCCS_LABELS -static char *_rio_h_sccs_ = "@(#)rio.h 1.3"; -#endif - -/* -** 30.09.1998 ARG - -** Introduced driver version and host card type strings -*/ -#define RIO_DRV_STR "Specialix RIO Driver" -#define RIO_AT_HOST_STR "ISA" -#define RIO_PCI_HOST_STR "PCI" - - -/* -** rio_info_store() commands (arbitary values) : -*/ -#define RIO_INFO_PUT 0xA4B3C2D1 -#define RIO_INFO_GET 0xF1E2D3C4 - - -/* -** anything that I couldn't cram in somewhere else -*/ -/* -#ifndef RIODEBUG -#define debug -#else -#define debug rioprint -#endif -*/ - - /* ** Maximum numbers of things */ @@ -101,9 +69,8 @@ static char *_rio_h_sccs_ = "@(#)rio.h 1.3"; /* ** Flag values returned by functions */ + #define RIO_FAIL -1 -#define RIO_SUCCESS 0 -#define COPYFAIL -1 /* copy[in|out] failed */ /* ** SysPort value for something that hasn't any ports @@ -142,30 +109,8 @@ static char *_rio_h_sccs_ = "@(#)rio.h 1.3"; /* ** Generally useful constants */ -#define HALF_A_SECOND ((HZ)>>1) -#define A_SECOND (HZ) -#define HUNDRED_HZ ((HZ/100)?(HZ/100):1) -#define FIFTY_HZ ((HZ/50)?(HZ/50):1) -#define TWENTY_HZ ((HZ/20)?(HZ/20):1) -#define TEN_HZ ((HZ/10)?(HZ/10):1) -#define FIVE_HZ ((HZ/5)?(HZ/5):1) -#define HUNDRED_MS TEN_HZ -#define FIFTY_MS TWENTY_HZ -#define TWENTY_MS FIFTY_HZ -#define TEN_MS HUNDRED_HZ -#define TWO_SECONDS ((A_SECOND)*2) -#define FIVE_SECONDS ((A_SECOND)*5) -#define TEN_SECONDS ((A_SECOND)*10) -#define FIFTEEN_SECONDS ((A_SECOND)*15) -#define TWENTY_SECONDS ((A_SECOND)*20) -#define HALF_A_MINUTE (A_MINUTE>>1) -#define A_MINUTE (A_SECOND*60) -#define FIVE_MINUTES (A_MINUTE*5) -#define QUARTER_HOUR (A_MINUTE*15) -#define HALF_HOUR (A_MINUTE*30) -#define HOUR (A_MINUTE*60) - -#define SIXTEEN_MEG 0x1000000 + +#define HUNDRED_MS ((HZ/10)?(HZ/10):1) #define ONE_MEG 0x100000 #define SIXTY_FOUR_K 0x10000 @@ -173,8 +118,6 @@ static char *_rio_h_sccs_ = "@(#)rio.h 1.3"; #define RIO_EISA_MEM_SIZE SIXTY_FOUR_K #define RIO_MCA_MEM_SIZE SIXTY_FOUR_K -#define POLL_VECTOR 0x100 - #define COOK_WELL 0 #define COOK_MEDIUM 1 #define COOK_RAW 2 @@ -193,62 +136,19 @@ static char *_rio_h_sccs_ = "@(#)rio.h 1.3"; ** How to convert from various different device number formats: ** DEV is a dev number, as passed to open, close etc - NOT a minor ** number! -** -** Note: LynxOS only gives us 8 bits for the device minor number, -** so all this crap here to deal with 'modem' bits etc. is -** just a load of irrelevant old bunkum! -** This however does not stop us needing to define a value -** for RIO_MODEMOFFSET which is required by the 'riomkdev' -** utility in the New Config Utilities suite. -*/ -/* 0-511: direct 512-1023: modem */ -#define RIO_MODEMOFFSET 0x200 /* doesn't mean anything */ +**/ + #define RIO_MODEM_MASK 0x1FF #define RIO_MODEM_BIT 0x200 #define RIO_UNMODEM(DEV) (MINOR(DEV) & RIO_MODEM_MASK) #define RIO_ISMODEM(DEV) (MINOR(DEV) & RIO_MODEM_BIT) #define RIO_PORT(DEV,FIRST_MAJ) ( (MAJOR(DEV) - FIRST_MAJ) * PORTS_PER_HOST) \ + MINOR(DEV) - -#define splrio spltty - -#define RIO_IPL 5 -#define RIO_PRI (PZERO+10) -#define RIO_CLOSE_PRI PZERO-1 /* uninterruptible sleeps for close */ - -typedef struct DbInf { - uint Flag; - char Name[8]; -} DbInf; - -#ifndef TRUE -#define TRUE (1==1) -#endif -#ifndef FALSE -#define FALSE (!TRUE) -#endif - -#define CSUM(pkt_ptr) (((ushort *)(pkt_ptr))[0] + ((ushort *)(pkt_ptr))[1] + \ - ((ushort *)(pkt_ptr))[2] + ((ushort *)(pkt_ptr))[3] + \ - ((ushort *)(pkt_ptr))[4] + ((ushort *)(pkt_ptr))[5] + \ - ((ushort *)(pkt_ptr))[6] + ((ushort *)(pkt_ptr))[7] + \ - ((ushort *)(pkt_ptr))[8] + ((ushort *)(pkt_ptr))[9] ) - -/* -** This happy little macro copies SIZE bytes of data from FROM to TO -** quite well. SIZE must be a constant. -*/ -#define CCOPY( FROM, TO, SIZE ) { *(struct s { char data[SIZE]; } *)(TO) = *(struct s *)(FROM); } - -/* -** increment a buffer pointer modulo the size of the buffer... -*/ -#define BUMP( P, I ) ((P) = (((P)+(I)) & RIOBufferMask)) - -#define INIT_PACKET( PK, PP ) \ -{ \ - *((uint *)PK) = PP->PacketInfo; \ -} +#define CSUM(pkt_ptr) (((u16 *)(pkt_ptr))[0] + ((u16 *)(pkt_ptr))[1] + \ + ((u16 *)(pkt_ptr))[2] + ((u16 *)(pkt_ptr))[3] + \ + ((u16 *)(pkt_ptr))[4] + ((u16 *)(pkt_ptr))[5] + \ + ((u16 *)(pkt_ptr))[6] + ((u16 *)(pkt_ptr))[7] + \ + ((u16 *)(pkt_ptr))[8] + ((u16 *)(pkt_ptr))[9] ) #define RIO_LINK_ENABLE 0x80FF /* FF is a hack, mainly for Mips, to */ /* prevent a really stupid race condition. */ @@ -267,27 +167,42 @@ typedef struct DbInf { #define DISCONNECT 0 #define CONNECT 1 +/* ------ Control Codes ------ */ -/* -** Machine types - these must NOT overlap with product codes 0-15 -*/ -#define RIO_MIPS_R3230 31 -#define RIO_MIPS_R4030 32 +#define CONTROL '^' +#define IFOAD ( CONTROL + 1 ) +#define IDENTIFY ( CONTROL + 2 ) +#define ZOMBIE ( CONTROL + 3 ) +#define UFOAD ( CONTROL + 4 ) +#define IWAIT ( CONTROL + 5 ) + +#define IFOAD_MAGIC 0xF0AD /* of course */ +#define ZOMBIE_MAGIC (~0xDEAD) /* not dead -> zombie */ +#define UFOAD_MAGIC 0xD1E /* kill-your-neighbour */ +#define IWAIT_MAGIC 0xB1DE /* Bide your time */ + +/* ------ Error Codes ------ */ + +#define E_NO_ERROR ((ushort) 0) + +/* ------ Free Lists ------ */ -#define RIO_IO_UNKNOWN -2 +struct rio_free_list { + u16 next; + u16 prev; +}; -#undef MODERN -#define ERROR( E ) do { u.u_error = E; return OPENFAIL } while ( 0 ) +/* NULL for card side linked lists */ +#define TPNULL ((ushort)(0x8000)) +/* We can add another packet to a transmit queue if the packet pointer pointed + * to by the TxAdd pointer has PKT_IN_USE clear in its address. */ +#define PKT_IN_USE 0x1 -/* Defines for MPX line discipline routines */ +/* ------ Topology ------ */ -#define DIST_LINESW_OPEN 0x01 -#define DIST_LINESW_CLOSE 0x02 -#define DIST_LINESW_READ 0x04 -#define DIST_LINESW_WRITE 0x08 -#define DIST_LINESW_IOCTL 0x10 -#define DIST_LINESW_INPUT 0x20 -#define DIST_LINESW_OUTPUT 0x40 -#define DIST_LINESW_MDMINT 0x80 +struct Top { + u8 Unit; + u8 Link; +}; #endif /* __rio_h__ */ diff --git a/drivers/char/rio/rio_linux.c b/drivers/char/rio/rio_linux.c index f1e9e9a20c8..78dd856534c 100644 --- a/drivers/char/rio/rio_linux.c +++ b/drivers/char/rio/rio_linux.c @@ -57,15 +57,12 @@ #include <asm/uaccess.h> #include "linux_compat.h" -#include "typdef.h" #include "pkt.h" #include "daemon.h" #include "rio.h" #include "riospace.h" -#include "top.h" #include "cmdpkt.h" #include "map.h" -#include "riotypes.h" #include "rup.h" #include "port.h" #include "riodrvr.h" @@ -78,17 +75,13 @@ #include "unixrup.h" #include "board.h" #include "host.h" -#include "error.h" #include "phb.h" #include "link.h" #include "cmdblk.h" #include "route.h" -#include "control.h" #include "cirrus.h" #include "rioioctl.h" #include "param.h" -#include "list.h" -#include "sam.h" #include "protsts.h" #include "rioboard.h" @@ -350,27 +343,9 @@ 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; -} - - static int rio_set_real_termios(void *ptr) { - int rv, modem; - struct tty_struct *tty; - func_enter(); - - tty = ((struct Port *) ptr)->gs.tty; - - modem = rio_ismodem(tty); - - rv = RIOParam((struct Port *) ptr, CONFIG, modem, 1); - - func_exit(); - - return rv; + return RIOParam((struct Port *) ptr, CONFIG, 1, 1); } @@ -973,7 +948,6 @@ static int __init rio_init(void) #ifdef CONFIG_PCI struct pci_dev *pdev = NULL; - unsigned int tint; unsigned short tshort; #endif @@ -998,6 +972,8 @@ static int __init rio_init(void) #ifdef CONFIG_PCI /* First look for the JET devices: */ while ((pdev = pci_get_device(PCI_VENDOR_ID_SPECIALIX, PCI_DEVICE_ID_SPECIALIX_SX_XIO_IO8, pdev))) { + u32 tint; + if (pci_enable_device(pdev)) continue; @@ -1008,7 +984,6 @@ static int __init rio_init(void) Also, reading a non-aligned dword doesn't work. So we read the whole dword at 0x2c and extract the word at 0x2e (SUBSYSTEM_ID) ourselves */ - /* I don't know why the define doesn't work, constant 0x2c does --REW */ pci_read_config_dword(pdev, 0x2c, &tint); tshort = (tint >> 16) & 0xffff; rio_dprintk(RIO_DEBUG_PROBE, "Got a specialix card: %x.\n", tint); @@ -1018,10 +993,8 @@ static int __init rio_init(void) } rio_dprintk(RIO_DEBUG_PROBE, "cp1\n"); - pci_read_config_dword(pdev, PCI_BASE_ADDRESS_2, &tint); - hp = &p->RIOHosts[p->RIONumHosts]; - hp->PaddrP = tint & PCI_BASE_ADDRESS_MEM_MASK; + hp->PaddrP = pci_resource_start(pdev, 2); hp->Ivec = pdev->irq; if (((1 << hp->Ivec) & rio_irqmask) == 0) hp->Ivec = 0; @@ -1035,7 +1008,7 @@ 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) { + if (RIOBoardTest(p->RIOHosts[p->RIONumHosts].PaddrP, p->RIOHosts[p->RIONumHosts].Caddr, RIO_PCI, 0) == 0) { rio_dprintk(RIO_DEBUG_INIT, "Done RIOBoardTest\n"); writeb(0xFF, &p->RIOHosts[p->RIONumHosts].ResetInt); p->RIOHosts[p->RIONumHosts].UniqueNum = @@ -1044,7 +1017,7 @@ static int __init rio_init(void) rio_dprintk(RIO_DEBUG_PROBE, "Hmm Tested ok, uniqid = %x.\n", p->RIOHosts[p->RIONumHosts].UniqueNum); fix_rio_pci(pdev); - p->RIOLastPCISearch = RIO_SUCCESS; + p->RIOLastPCISearch = 0; p->RIONumHosts++; found++; } else { @@ -1067,10 +1040,8 @@ static int __init rio_init(void) continue; #ifdef CONFIG_RIO_OLDPCI - pci_read_config_dword(pdev, PCI_BASE_ADDRESS_0, &tint); - hp = &p->RIOHosts[p->RIONumHosts]; - hp->PaddrP = tint & PCI_BASE_ADDRESS_MEM_MASK; + hp->PaddrP = pci_resource_start(pdev, 0); hp->Ivec = pdev->irq; if (((1 << hp->Ivec) & rio_irqmask) == 0) hp->Ivec = 0; @@ -1088,14 +1059,14 @@ static int __init rio_init(void) rio_reset_interrupt(hp); 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) { + if (RIOBoardTest(p->RIOHosts[p->RIONumHosts].PaddrP, p->RIOHosts[p->RIONumHosts].Caddr, RIO_PCI, 0) == 0) { writeb(0xFF, &p->RIOHosts[p->RIONumHosts].ResetInt); p->RIOHosts[p->RIONumHosts].UniqueNum = ((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; + p->RIOLastPCISearch = 0; p->RIONumHosts++; found++; } else { @@ -1129,7 +1100,7 @@ static int __init rio_init(void) okboard = 0; if ((strncmp(vpdp->identifier, RIO_ISA_IDENT, 16) == 0) || (strncmp(vpdp->identifier, RIO_ISA2_IDENT, 16) == 0) || (strncmp(vpdp->identifier, RIO_ISA3_IDENT, 16) == 0)) { /* Board is present... */ - if (RIOBoardTest(hp->PaddrP, hp->Caddr, RIO_AT, 0) == RIO_SUCCESS) { + if (RIOBoardTest(hp->PaddrP, hp->Caddr, RIO_AT, 0) == 0) { /* ... and feeling fine!!!! */ rio_dprintk(RIO_DEBUG_PROBE, "Hmm Tested ok, uniqid = %x.\n", p->RIOHosts[p->RIONumHosts].UniqueNum); if (RIOAssignAT(p, hp->PaddrP, hp->Caddr, 0)) { @@ -1231,24 +1202,3 @@ static void __exit rio_exit(void) module_init(rio_init); module_exit(rio_exit); - -/* - * Anybody who knows why this doesn't work for me, please tell me -- REW. - * Snatched from scsi.c (fixed one spelling error): - * Overrides for Emacs so that we follow Linus' tabbing style. - * Emacs will notice this stuff at the end of the file and automatically - * adjust the settings for this buffer only. This must remain at the end - * of the file. - * --------------------------------------------------------------------------- - * Local Variables: - * c-indent-level: 4 - * c-brace-imaginary-offset: 0 - * c-brace-offset: -4 - * c-argdecl-indent: 4 - * c-label-offset: -4 - * c-continued-statement-offset: 4 - * c-continued-brace-offset: 0 - * indent-tabs-mode: nil - * tab-width: 8 - * End: - */ diff --git a/drivers/char/rio/rioboot.c b/drivers/char/rio/rioboot.c index e1542e8dfb4..acda9326c2e 100644 --- a/drivers/char/rio/rioboot.c +++ b/drivers/char/rio/rioboot.c @@ -47,15 +47,12 @@ #include "linux_compat.h" #include "rio_linux.h" -#include "typdef.h" #include "pkt.h" #include "daemon.h" #include "rio.h" #include "riospace.h" -#include "top.h" #include "cmdpkt.h" #include "map.h" -#include "riotypes.h" #include "rup.h" #include "port.h" #include "riodrvr.h" @@ -68,7 +65,6 @@ #include "unixrup.h" #include "board.h" #include "host.h" -#include "error.h" #include "phb.h" #include "link.h" #include "cmdblk.h" @@ -386,7 +382,7 @@ int RIOBootCodeHOST(struct rio_info *p, struct DownLoad *rbp) */ offset = (p->RIOConf.HostLoadBase - 2) - 0x7FFC; - writeb(NFIX(((ushort) (~offset) >> (ushort) 12) & 0xF), DestP); + writeb(NFIX(((unsigned short) (~offset) >> (unsigned short) 12) & 0xF), DestP); writeb(PFIX((offset >> 8) & 0xF), DestP + 1); writeb(PFIX((offset >> 4) & 0xF), DestP + 2); writeb(JUMP(offset & 0xF), DestP + 3); @@ -515,10 +511,10 @@ int RIOBootCodeHOST(struct rio_info *p, struct DownLoad *rbp) ** 32 bit pointers for the driver in ioremap space. */ HostP->ParmMapP = ParmMapP; - HostP->PhbP = (PHB *) RIO_PTR(Cad, readw(&ParmMapP->phb_ptr)); - HostP->RupP = (RUP *) RIO_PTR(Cad, readw(&ParmMapP->rups)); - HostP->PhbNumP = (ushort *) RIO_PTR(Cad, readw(&ParmMapP->phb_num_ptr)); - HostP->LinkStrP = (LPB *) RIO_PTR(Cad, readw(&ParmMapP->link_str_ptr)); + HostP->PhbP = (struct PHB *) RIO_PTR(Cad, readw(&ParmMapP->phb_ptr)); + HostP->RupP = (struct RUP *) RIO_PTR(Cad, readw(&ParmMapP->rups)); + HostP->PhbNumP = (unsigned short *) RIO_PTR(Cad, readw(&ParmMapP->phb_num_ptr)); + HostP->LinkStrP = (struct LPB *) RIO_PTR(Cad, readw(&ParmMapP->link_str_ptr)); /* ** point the UnixRups at the real Rups @@ -639,7 +635,7 @@ int RIOBootRup(struct rio_info *p, unsigned int Rup, struct Host *HostP, struct /* ** Fill in the default info on the command block */ - CmdBlkP->Packet.dest_unit = Rup < (ushort) MAX_RUP ? Rup : 0; + CmdBlkP->Packet.dest_unit = Rup < (unsigned short) MAX_RUP ? Rup : 0; CmdBlkP->Packet.dest_port = BOOT_RUP; CmdBlkP->Packet.src_unit = 0; CmdBlkP->Packet.src_port = BOOT_RUP; @@ -748,7 +744,7 @@ static int RIOBootComplete(struct rio_info *p, struct Host *HostP, unsigned int */ RtaType = GetUnitType(RtaUniq); - if (Rup >= (ushort) MAX_RUP) + if (Rup >= (unsigned short) MAX_RUP) rio_dprintk(RIO_DEBUG_BOOT, "RIO: Host %s has booted an RTA(%d) on link %c\n", HostP->Name, 8 * RtaType, readb(&PktCmdP->LinkNum) + 'A'); else rio_dprintk(RIO_DEBUG_BOOT, "RIO: RTA %s has booted an RTA(%d) on link %c\n", HostP->Mapping[Rup].Name, 8 * RtaType, readb(&PktCmdP->LinkNum) + 'A'); @@ -757,7 +753,7 @@ static int RIOBootComplete(struct rio_info *p, struct Host *HostP, unsigned int if (RtaUniq == 0x00000000 || RtaUniq == 0xffffffff) { rio_dprintk(RIO_DEBUG_BOOT, "Illegal RTA Uniq Number\n"); - return TRUE; + return 1; } /* @@ -785,7 +781,7 @@ static int RIOBootComplete(struct rio_info *p, struct Host *HostP, unsigned int */ writew(30, &HostP->LinkStrP[MyLink].WaitNoBoot); rio_dprintk(RIO_DEBUG_BOOT, "RTA %x not owned - suspend booting down link %c on unit %x\n", RtaUniq, 'A' + MyLink, HostP->Mapping[Rup].RtaUniqueNum); - return TRUE; + return 1; } /* @@ -826,7 +822,7 @@ static int RIOBootComplete(struct rio_info *p, struct Host *HostP, unsigned int rio_dprintk(RIO_DEBUG_BOOT, "RTA will be given IDs %d+%d\n", entry + 1, entry2 + 1); else rio_dprintk(RIO_DEBUG_BOOT, "RTA will be given ID %d\n", entry + 1); - return TRUE; + return 1; } } @@ -868,7 +864,7 @@ static int RIOBootComplete(struct rio_info *p, struct Host *HostP, unsigned int rio_dprintk(RIO_DEBUG_BOOT, "Found previous tentative slot (%d)\n", entry); if (!p->RIONoMessage) printk("RTA connected to %s '%s' (%c) not configured.\n", MyType, MyName, MyLink + 'A'); - return TRUE; + return 1; } } @@ -961,13 +957,13 @@ static int RIOBootComplete(struct rio_info *p, struct Host *HostP, unsigned int if (RtaType == TYPE_RTA16) { if (RIOFindFreeID(p, HostP, &entry, &entry2) == 0) { RIODefaultName(p, HostP, entry); - FillSlot(entry, entry2, RtaUniq, HostP); + rio_fill_host_slot(entry, entry2, RtaUniq, HostP); EmptySlot = 0; } } else { if (RIOFindFreeID(p, HostP, &entry, NULL) == 0) { RIODefaultName(p, HostP, entry); - FillSlot(entry, 0, RtaUniq, HostP); + rio_fill_host_slot(entry, 0, RtaUniq, HostP); EmptySlot = 0; } } @@ -1023,7 +1019,7 @@ static int RIOBootComplete(struct rio_info *p, struct Host *HostP, unsigned int } else if (!p->RIONoMessage) printk("RTA connected to %s '%s' (%c) not configured.\n", MyType, MyName, MyLink + 'A'); RIOSetChange(p); - return TRUE; + return 1; } /* @@ -1038,7 +1034,7 @@ static int RIOBootComplete(struct rio_info *p, struct Host *HostP, unsigned int /* ** already got it! */ - return TRUE; + return 1; } } /* @@ -1046,13 +1042,13 @@ static int RIOBootComplete(struct rio_info *p, struct Host *HostP, unsigned int */ if (HostP->NumExtraBooted < MAX_EXTRA_UNITS) HostP->ExtraUnits[HostP->NumExtraBooted++] = RtaUniq; - return TRUE; + return 1; } /* ** If the RTA or its host appears in the RIOBindTab[] structure then -** we mustn't boot the RTA and should return FALSE. +** we mustn't boot the RTA and should return 0. ** This operation is slightly different from the other drivers for RIO ** in that this is designed to work with the new utilities ** not config.rio and is FAR SIMPLER. @@ -1080,38 +1076,38 @@ int RIOBootOk(struct rio_info *p, struct Host *HostP, unsigned long RtaUniq) ** slots tentative, and the second one RTA_SECOND_SLOT as well. */ -void FillSlot(int entry, int entry2, unsigned int RtaUniq, struct Host *HostP) +void rio_fill_host_slot(int entry, int entry2, unsigned int rta_uniq, struct Host *host) { int link; - rio_dprintk(RIO_DEBUG_BOOT, "FillSlot(%d, %d, 0x%x...)\n", entry, entry2, RtaUniq); + rio_dprintk(RIO_DEBUG_BOOT, "rio_fill_host_slot(%d, %d, 0x%x...)\n", entry, entry2, rta_uniq); - HostP->Mapping[entry].Flags = (RTA_BOOTED | RTA_NEWBOOT | SLOT_TENTATIVE); - HostP->Mapping[entry].SysPort = NO_PORT; - HostP->Mapping[entry].RtaUniqueNum = RtaUniq; - HostP->Mapping[entry].HostUniqueNum = HostP->UniqueNum; - HostP->Mapping[entry].ID = entry + 1; - HostP->Mapping[entry].ID2 = 0; + host->Mapping[entry].Flags = (RTA_BOOTED | RTA_NEWBOOT | SLOT_TENTATIVE); + host->Mapping[entry].SysPort = NO_PORT; + host->Mapping[entry].RtaUniqueNum = rta_uniq; + host->Mapping[entry].HostUniqueNum = host->UniqueNum; + host->Mapping[entry].ID = entry + 1; + host->Mapping[entry].ID2 = 0; if (entry2) { - HostP->Mapping[entry2].Flags = (RTA_BOOTED | RTA_NEWBOOT | SLOT_TENTATIVE | RTA16_SECOND_SLOT); - HostP->Mapping[entry2].SysPort = NO_PORT; - HostP->Mapping[entry2].RtaUniqueNum = RtaUniq; - HostP->Mapping[entry2].HostUniqueNum = HostP->UniqueNum; - HostP->Mapping[entry2].Name[0] = '\0'; - HostP->Mapping[entry2].ID = entry2 + 1; - HostP->Mapping[entry2].ID2 = entry + 1; - HostP->Mapping[entry].ID2 = entry2 + 1; + host->Mapping[entry2].Flags = (RTA_BOOTED | RTA_NEWBOOT | SLOT_TENTATIVE | RTA16_SECOND_SLOT); + host->Mapping[entry2].SysPort = NO_PORT; + host->Mapping[entry2].RtaUniqueNum = rta_uniq; + host->Mapping[entry2].HostUniqueNum = host->UniqueNum; + host->Mapping[entry2].Name[0] = '\0'; + host->Mapping[entry2].ID = entry2 + 1; + host->Mapping[entry2].ID2 = entry + 1; + host->Mapping[entry].ID2 = entry2 + 1; } /* ** Must set these up, so that utilities show ** topology of 16 port RTAs correctly */ for (link = 0; link < LINKS_PER_UNIT; link++) { - HostP->Mapping[entry].Topology[link].Unit = ROUTE_DISCONNECT; - HostP->Mapping[entry].Topology[link].Link = NO_LINK; + host->Mapping[entry].Topology[link].Unit = ROUTE_DISCONNECT; + host->Mapping[entry].Topology[link].Link = NO_LINK; if (entry2) { - HostP->Mapping[entry2].Topology[link].Unit = ROUTE_DISCONNECT; - HostP->Mapping[entry2].Topology[link].Link = NO_LINK; + host->Mapping[entry2].Topology[link].Unit = ROUTE_DISCONNECT; + host->Mapping[entry2].Topology[link].Link = NO_LINK; } } } diff --git a/drivers/char/rio/riocmd.c b/drivers/char/rio/riocmd.c index 08fcac1f12d..e6d2b14b5e6 100644 --- a/drivers/char/rio/riocmd.c +++ b/drivers/char/rio/riocmd.c @@ -51,15 +51,12 @@ static char *_riocmd_c_sccs_ = "@(#)riocmd.c 1.2"; #include "linux_compat.h" #include "rio_linux.h" -#include "typdef.h" #include "pkt.h" #include "daemon.h" #include "rio.h" #include "riospace.h" -#include "top.h" #include "cmdpkt.h" #include "map.h" -#include "riotypes.h" #include "rup.h" #include "port.h" #include "riodrvr.h" @@ -72,12 +69,10 @@ static char *_riocmd_c_sccs_ = "@(#)riocmd.c 1.2"; #include "unixrup.h" #include "board.h" #include "host.h" -#include "error.h" #include "phb.h" #include "link.h" #include "cmdblk.h" #include "route.h" -#include "control.h" #include "cirrus.h" @@ -148,7 +143,7 @@ int RIOCommandRta(struct rio_info *p, unsigned long RtaUnique, int (*func) (stru { unsigned int Host; - rio_dprintk(RIO_DEBUG_CMD, "Command RTA 0x%lx func 0x%p\n", RtaUnique, func); + rio_dprintk(RIO_DEBUG_CMD, "Command RTA 0x%lx func %p\n", RtaUnique, func); if (!RtaUnique) return (0); @@ -375,7 +370,7 @@ int RIOFoadWakeup(struct rio_info *p) /* ** Incoming command on the COMMAND_RUP to be processed. */ -static int RIOCommandRup(struct rio_info *p, uint Rup, struct Host *HostP, PKT * PacketP) +static int RIOCommandRup(struct rio_info *p, uint Rup, struct Host *HostP, struct PKT * PacketP) { struct PktCmd *PktCmdP = (struct PktCmd *) PacketP->data; struct Port *PortP; @@ -418,7 +413,7 @@ static int RIOCommandRup(struct rio_info *p, uint Rup, struct Host *HostP, PKT * rio_dprintk(RIO_DEBUG_CMD, "PACKET information: Control 0x%x (%d)\n", PacketP->control, PacketP->control); rio_dprintk(RIO_DEBUG_CMD, "PACKET information: Check 0x%x (%d)\n", PacketP->csum, PacketP->csum); rio_dprintk(RIO_DEBUG_CMD, "COMMAND information: Host Port Number 0x%x, " "Command Code 0x%x\n", PktCmdP->PhbNum, PktCmdP->Command); - return TRUE; + return 1; } PortP = p->RIOPortp[SysPort]; rio_spin_lock_irqsave(&PortP->portSem, flags); @@ -427,7 +422,7 @@ static int RIOCommandRup(struct rio_info *p, uint Rup, struct Host *HostP, PKT * rio_dprintk(RIO_DEBUG_CMD, "Received a break!\n"); /* If the current line disc. is not multi-threading and the current processor is not the default, reset rup_intr - and return FALSE to ensure that the command packet is + and return 0 to ensure that the command packet is not freed. */ /* Call tmgr HANGUP HERE */ /* Fix this later when every thing works !!!! RAMRAJ */ @@ -541,7 +536,7 @@ static int RIOCommandRup(struct rio_info *p, uint Rup, struct Host *HostP, PKT * func_exit(); - return TRUE; + return 1; } /* @@ -600,13 +595,13 @@ int RIOQueueCmdBlk(struct Host *HostP, uint Rup, struct CmdBlk *CmdBlkP) ** straight on the RUP.... */ if ((UnixRupP->CmdsWaitingP == NULL) && (UnixRupP->CmdPendingP == NULL) && (readw(&UnixRupP->RupP->txcontrol) == TX_RUP_INACTIVE) && (CmdBlkP->PreFuncP ? (*CmdBlkP->PreFuncP) (CmdBlkP->PreArg, CmdBlkP) - : TRUE)) { + : 1)) { rio_dprintk(RIO_DEBUG_CMD, "RUP inactive-placing command straight on. Cmd byte is 0x%x\n", CmdBlkP->Packet.data[0]); /* ** Whammy! blat that pack! */ - HostP->Copy((caddr_t) & CmdBlkP->Packet, RIO_PTR(HostP->Caddr, UnixRupP->RupP->txpkt), sizeof(PKT)); + HostP->Copy((caddr_t) & CmdBlkP->Packet, RIO_PTR(HostP->Caddr, UnixRupP->RupP->txpkt), sizeof(struct PKT)); /* ** place command packet on the pending position. @@ -620,7 +615,7 @@ int RIOQueueCmdBlk(struct Host *HostP, uint Rup, struct CmdBlk *CmdBlkP) rio_spin_unlock_irqrestore(&UnixRupP->RupLock, flags); - return RIO_SUCCESS; + return 0; } rio_dprintk(RIO_DEBUG_CMD, "RUP active - en-queing\n"); @@ -633,15 +628,15 @@ int RIOQueueCmdBlk(struct Host *HostP, uint Rup, struct CmdBlk *CmdBlkP) Base = &UnixRupP->CmdsWaitingP; - rio_dprintk(RIO_DEBUG_CMD, "First try to queue cmdblk 0x%p at 0x%p\n", CmdBlkP, Base); + rio_dprintk(RIO_DEBUG_CMD, "First try to queue cmdblk %p at %p\n", CmdBlkP, Base); while (*Base) { - rio_dprintk(RIO_DEBUG_CMD, "Command cmdblk 0x%p here\n", *Base); + rio_dprintk(RIO_DEBUG_CMD, "Command cmdblk %p here\n", *Base); Base = &((*Base)->NextP); - rio_dprintk(RIO_DEBUG_CMD, "Now try to queue cmd cmdblk 0x%p at 0x%p\n", CmdBlkP, Base); + rio_dprintk(RIO_DEBUG_CMD, "Now try to queue cmd cmdblk %p at %p\n", CmdBlkP, Base); } - rio_dprintk(RIO_DEBUG_CMD, "Will queue cmdblk 0x%p at 0x%p\n", CmdBlkP, Base); + rio_dprintk(RIO_DEBUG_CMD, "Will queue cmdblk %p at %p\n", CmdBlkP, Base); *Base = CmdBlkP; @@ -649,7 +644,7 @@ int RIOQueueCmdBlk(struct Host *HostP, uint Rup, struct CmdBlk *CmdBlkP) rio_spin_unlock_irqrestore(&UnixRupP->RupLock, flags); - return RIO_SUCCESS; + return 0; } /* @@ -681,9 +676,7 @@ void RIOPollHostCommands(struct rio_info *p, struct Host *HostP) if (readw(&UnixRupP->RupP->rxcontrol) != RX_RUP_INACTIVE) { int FreeMe; - PacketP = (PKT *) RIO_PTR(HostP->Caddr, readw(&UnixRupP->RupP->rxpkt)); - - ShowPacket(DBG_CMD, PacketP); + PacketP = (struct PKT *) RIO_PTR(HostP->Caddr, readw(&UnixRupP->RupP->rxpkt)); switch (readb(&PacketP->dest_port)) { case BOOT_RUP: @@ -749,7 +742,7 @@ void RIOPollHostCommands(struct rio_info *p, struct Host *HostP) if (CmdBlkP->Packet.dest_port == BOOT_RUP) rio_dprintk(RIO_DEBUG_CMD, "Free Boot %s Command Block '%x'\n", CmdBlkP->Packet.len & 0x80 ? "Command" : "Data", CmdBlkP->Packet.data[0]); - rio_dprintk(RIO_DEBUG_CMD, "Command 0x%p completed\n", CmdBlkP); + rio_dprintk(RIO_DEBUG_CMD, "Command %p completed\n", CmdBlkP); /* ** Clear the Rup lock to prevent mutual exclusion. @@ -782,14 +775,14 @@ void RIOPollHostCommands(struct rio_info *p, struct Host *HostP) ** If it returns RIO_FAIL then don't ** send this command yet! */ - if (!(CmdBlkP->PreFuncP ? (*CmdBlkP->PreFuncP) (CmdBlkP->PreArg, CmdBlkP) : TRUE)) { - rio_dprintk(RIO_DEBUG_CMD, "Not ready to start command 0x%p\n", CmdBlkP); + if (!(CmdBlkP->PreFuncP ? (*CmdBlkP->PreFuncP) (CmdBlkP->PreArg, CmdBlkP) : 1)) { + rio_dprintk(RIO_DEBUG_CMD, "Not ready to start command %p\n", CmdBlkP); } else { - rio_dprintk(RIO_DEBUG_CMD, "Start new command 0x%p Cmd byte is 0x%x\n", CmdBlkP, CmdBlkP->Packet.data[0]); + rio_dprintk(RIO_DEBUG_CMD, "Start new command %p Cmd byte is 0x%x\n", CmdBlkP, CmdBlkP->Packet.data[0]); /* ** Whammy! blat that pack! */ - HostP->Copy((caddr_t) & CmdBlkP->Packet, RIO_PTR(HostP->Caddr, UnixRupP->RupP->txpkt), sizeof(PKT)); + HostP->Copy((caddr_t) & CmdBlkP->Packet, RIO_PTR(HostP->Caddr, UnixRupP->RupP->txpkt), sizeof(struct PKT)); /* ** remove the command from the rup command queue... @@ -831,14 +824,13 @@ int RIOWFlushMark(unsigned long iPortP, struct CmdBlk *CmdBlkP) int RIORFlushEnable(unsigned long iPortP, struct CmdBlk *CmdBlkP) { struct Port *PortP = (struct Port *) iPortP; - PKT *PacketP; + struct PKT *PacketP; unsigned long flags; rio_spin_lock_irqsave(&PortP->portSem, flags); while (can_remove_receive(&PacketP, PortP)) { remove_receive(PortP); - ShowPacket(DBG_PROC, PacketP); put_free_end(PortP->HostP, PacketP); } @@ -892,10 +884,6 @@ int RIOUnUse(unsigned long iPortP, struct CmdBlk *CmdBlkP) return 0; } -void ShowPacket(uint Flags, struct PKT *PacketP) -{ -} - /* ** ** How to use this file: diff --git a/drivers/char/rio/rioctrl.c b/drivers/char/rio/rioctrl.c index f6a19aae104..d31aba62bb7 100644 --- a/drivers/char/rio/rioctrl.c +++ b/drivers/char/rio/rioctrl.c @@ -51,15 +51,12 @@ static char *_rioctrl_c_sccs_ = "@(#)rioctrl.c 1.3"; #include "linux_compat.h" #include "rio_linux.h" -#include "typdef.h" #include "pkt.h" #include "daemon.h" #include "rio.h" #include "riospace.h" -#include "top.h" #include "cmdpkt.h" #include "map.h" -#include "riotypes.h" #include "rup.h" #include "port.h" #include "riodrvr.h" @@ -72,12 +69,10 @@ static char *_rioctrl_c_sccs_ = "@(#)rioctrl.c 1.3"; #include "unixrup.h" #include "board.h" #include "host.h" -#include "error.h" #include "phb.h" #include "link.h" #include "cmdblk.h" #include "route.h" -#include "control.h" #include "cirrus.h" #include "rioioctl.h" @@ -144,7 +139,7 @@ int su; ushort loop; int Entry; struct Port *PortP; - PKT *PacketP; + struct PKT *PacketP; int retval = 0; unsigned long flags; @@ -154,7 +149,7 @@ int su; Host = 0; PortP = NULL; - rio_dprintk(RIO_DEBUG_CTRL, "control ioctl cmd: 0x%x arg: 0x%p\n", cmd, arg); + rio_dprintk(RIO_DEBUG_CTRL, "control ioctl cmd: 0x%x arg: %p\n", cmd, arg); switch (cmd) { /* @@ -572,8 +567,8 @@ int su; PortSetup.Store = p->RIOPortp[port]->Store; PortSetup.Lock = p->RIOPortp[port]->Lock; PortSetup.XpCps = p->RIOPortp[port]->Xprint.XpCps; - bcopy(p->RIOPortp[port]->Xprint.XpOn, PortSetup.XpOn, MAX_XP_CTRL_LEN); - bcopy(p->RIOPortp[port]->Xprint.XpOff, PortSetup.XpOff, MAX_XP_CTRL_LEN); + memcpy(PortSetup.XpOn, p->RIOPortp[port]->Xprint.XpOn, MAX_XP_CTRL_LEN); + memcpy(PortSet |