/*
** -----------------------------------------------------------------------------
**
**  Perle Specialix driver for Linux
**  Ported from existing RIO Driver for SCO sources.
 *
 *  (C) 1990 - 2000 Specialix International Ltd., Byfleet, Surrey, UK.
 *
 *      This program is free software; you can redistribute it and/or modify
 *      it under the terms of the GNU General Public License as published by
 *      the Free Software Foundation; either version 2 of the License, or
 *      (at your option) any later version.
 *
 *      This program is distributed in the hope that it will be useful,
 *      but WITHOUT ANY WARRANTY; without even the implied warranty of
 *      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *      GNU General Public License for more details.
 *
 *      You should have received a copy of the GNU General Public License
 *      along with this program; if not, write to the Free Software
 *      Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
**
**	Module		: rioctrl.c
**	SID		: 1.3
**	Last Modified	: 11/6/98 10:33:42
**	Retrieved	: 11/6/98 10:33:49
**
**  ident @(#)rioctrl.c	1.3
**
** -----------------------------------------------------------------------------
*/
#ifdef SCCS_LABELS
static char *_rioctrl_c_sccs_ = "@(#)rioctrl.c	1.3";
#endif


#include <linux/module.h>
#include <linux/slab.h>
#include <linux/errno.h>
#include <asm/io.h>
#include <asm/system.h>
#include <asm/string.h>
#include <asm/uaccess.h>

#include <linux/termios.h>
#include <linux/serial.h>

#include <linux/generic_serial.h>


#include "linux_compat.h"
#include "rio_linux.h"
#include "pkt.h"
#include "daemon.h"
#include "rio.h"
#include "riospace.h"
#include "cmdpkt.h"
#include "map.h"
#include "rup.h"
#include "port.h"
#include "riodrvr.h"
#include "rioinfo.h"
#include "func.h"
#include "errors.h"
#include "pci.h"

#include "parmmap.h"
#include "unixrup.h"
#include "board.h"
#include "host.h"
#include "phb.h"
#include "link.h"
#include "cmdblk.h"
#include "route.h"
#include "cirrus.h"
#include "rioioctl.h"


static struct LpbReq LpbReq;
static struct RupReq RupReq;
static struct PortReq PortReq;
static struct HostReq HostReq;	/* oh really?  global?  and no locking? */
static struct HostDpRam HostDpRam;
static struct DebugCtrl DebugCtrl;
static struct Map MapEnt;
static struct PortSetup PortSetup;
static struct DownLoad DownLoad;
static struct SendPack SendPack;
/* static struct StreamInfo	StreamInfo; */
/* static char modemtable[RIO_PORTS]; */
static struct SpecialRupCmd SpecialRupCmd;
static struct PortParams PortParams;
static struct portStats portStats;

static struct SubCmdStruct {
	ushort Host;
	ushort Rup;
	ushort Port;
	ushort Addr;
} SubCmd;

struct PortTty {
	uint port;
	struct ttystatics Tty;
};

static struct PortTty PortTty;
typedef struct ttystatics TERMIO;

/*
** This table is used when the config.rio downloads bin code to the
** driver. We index the table using the product code, 0-F, and call
** the function pointed to by the entry, passing the information
** about the boot.
** The RIOBootCodeUNKNOWN entry is there to politely tell the calling
** process to bog off.
*/
static int
 (*RIOBootTable[MAX_PRODUCT]) (struct rio_info *, struct DownLoad *) = {
					/* 0 */ RIOBootCodeHOST,
					/* Host Card */
					/* 1 */ RIOBootCodeRTA,
					/* RTA */
};

#define drv_makedev(maj, min) ((((uint) maj & 0xff) << 8) | ((uint) min & 0xff))

static int copy_from_io(void __user *to, void __iomem *from, size_t size)
{
	void *buf = kmalloc(size, GFP_KERNEL);
	int res = -ENOMEM;
	if (buf) {
		rio_memcpy_fromio(buf, from, size);
		res = copy_to_user(to, buf, size);
		kfree(buf);
	}
	return res;
}

int riocontrol(struct rio_info *p, dev_t dev, int cmd, unsigned long arg, int su)
{
	uint Host;		/* leave me unsigned! */
	uint port;		/* and me! */
	struct Host *HostP;
	ushort loop;
	int Entry;
	struct Port *PortP;
	struct PKT __iomem *PacketP;
	int retval = 0;
	unsigned long flags;
	void __user *argp = (void __user *)arg;

	func_enter();

	/* Confuse the compiler to think that we've initialized these */
	Host = 0;
	PortP = NULL;

	rio_dprintk(RIO_DEBUG_CTRL, "control ioctl cmd: 0x%x arg: %p\n", cmd, argp);

	switch (cmd) {
		/*
		 ** RIO_SET_TIMER
		 **
		 ** Change the value of the host card interrupt timer.
		 ** If the host card number is -1 then all host cards are changed
		 ** otherwise just the specified host card will be changed.
		 */
	case RIO_SET_TIMER:
		rio_dprintk(RIO_DEBUG_CTRL, "RIO_SET_TIMER to %ldms\n", arg);
		{
			int host, value;
			host = (arg >> 16) & 0x0000FFFF;
			value = arg & 0x0000ffff;
			if (host == -1) {
				for (host = 0; host < p->RIONumHosts; host++) {
					if (p->RIOHosts[host].Flags == RC_RUNNING) {
						writew(value, &p->RIOHosts[host].ParmMapP->timer);
					}
				}
			} else if (host >= p->RIONumHosts) {
				return -EINVAL;
			} else {
				if (p->RIOHosts[host].Flags == RC_RUNNING) {
					writew(value, &p->RIOHosts[host].ParmMapP->timer);
				}
			}
		}
		return 0;

	case RIO_FOAD_RTA:
		rio_dprintk(RIO_DEBUG_CTRL, "RIO_FOAD_RTA\n");
		return RIOCommandRta(p, arg, RIOFoadRta);

	case RIO_ZOMBIE_RTA:
		rio_dprintk(RIO_DEBUG_CTRL, "RIO_ZOMBIE_RTA\n");
		return RIOCommandRta(p, arg, RIOZombieRta);

	case RIO_IDENTIFY_RTA:
		rio_dprintk(RIO_DEBUG_CTRL, "RIO_IDENTIFY_RTA\n");
		return RIOIdentifyRta(p, argp);

	case RIO_KILL_NEIGHBOUR:
		rio_dprintk(RIO_DEBUG_CTRL, "RIO_KILL_NEIGHBOUR\n");
		return RIOKillNeighbour(p, argp);

	case SPECIAL_RUP_CMD:
		{
			struct CmdBlk *CmdBlkP;

			rio_dprintk(RIO_DEBUG_CTRL, "SPECIAL_RUP_CMD\n");
			if (copy_from_user(&SpecialRupCmd, argp, sizeof(SpecialRupCmd))) {
				rio_dprintk(RIO_DEBUG_CTRL, "SPECIAL_RUP_CMD copy failed\n");
				p->RIOError.Error = COPYIN_FAILED;
				return -EFAULT;
			}
			CmdBlkP = RIOGetCmdBlk();
			if (!CmdBlkP) {
				rio_dprintk(RIO_DEBUG_CTRL, "SPECIAL_RUP_CMD GetCmdBlk failed\n");
				return -ENXIO;
			}
			CmdBlkP->Packet = SpecialRupCmd.Packet;
			if (SpecialRupCmd.Host >= p->RIONumHosts)
				SpecialRupCmd.Host = 0;
			rio_dprintk(RIO_DEBUG_CTRL, "Queue special rup command for host %d rup %d\n", SpecialRupCmd.Host, SpecialRupCmd.RupNum);
			if (RIOQueueCmdBlk(&p->RIOHosts[SpecialRupCmd.Host], SpecialRupCmd.RupNum, CmdBlkP) == RIO_FAIL) {
				printk(KERN_WARNING "rio: FAILED TO QUEUE SPECIAL RUP COMMAND\n");
			}
			return 0;
		}

	case RIO_DEBUG_MEM:
		return -EPERM;

	case RIO_ALL_MODEM:
		rio_dprintk(RIO_DEBUG_CTRL, "RIO_ALL_MODEM\n");
		p->RIOError.Error = IOCTL_COMMAND_UNKNOWN;
		return -EINVAL;

	case RIO_GET_TABLE:
		/*
		 ** Read the routing table from the device driver to user space
		 */
		rio_dprintk(RIO_DEBUG_CTRL, "RIO_GET_TABLE\n");

		if ((retval = RIOApel(p)) != 0)
			return retval;

		if (copy_to_user(argp, p->RIOConnectTable, TOTAL_MAP_ENTRIES * sizeof(struct Map))) {
			rio_dprintk(RIO_DEBUG_CTRL, "RIO_GET_TABLE copy failed\n");
			p->RIOError.Error = COPYOUT_FAILED;
			return -EFAULT;
		}

		{
			int entry;
			rio_dprintk(RIO_DEBUG_CTRL, "*****\nMAP ENTRIES\n");
			for (entry = 0; entry < TOTAL_MAP_ENTRIES; entry++) {
				if ((p->RIOConnectTable[entry].ID == 0) && (p->RIOConnectTable[entry].HostUniqueNum == 0) && (p->RIOConnectTable[entry].RtaUniqueNum == 0))
					continue;

				rio_dprintk(RIO_DEBUG_CTRL, "Map entry %d.HostUniqueNum = 0x%x\n", entry, p->RIOConnectTable[entry].HostUniqueNum);
				rio_dprintk(RIO_DEBUG_CTRL, "Map entry %d.RtaUniqueNum = 0x%x\n", entry, p->RIOConnectTable[entry].RtaUniqueNum);
				rio_dprintk(RIO_DEBUG_CTRL, "Map entry %d.ID = 0x%x\n", entry, p->RIOConnectTable[entry].ID);
				rio_dprintk(RIO_DEBUG_CTRL, "Map entry %d.ID2 = 0x%x\n", entry, p->RIOConnectTable[entry].ID2);
				rio_dprintk(RIO_DEBUG_CTRL, "Map entry %d.Flags = 0x%x\n", entry, (int) p->RIOConnectTable[entry].Flags);
				rio_dprintk(RIO_DEBUG_CTRL, "Map entry %d.SysPort = 0x%x\n", entry, (int) p->RIOConnectTable[entry].SysPort);
				rio_dprintk(RIO_DEBUG_CTRL, "Map entry %d.Top[0].Unit = %x\n", entry, p->RIOConnectTable[entry].Topology[0].Unit);
				rio_dprintk(RIO_DEBUG_CTRL, "Map entry %d.Top[0].Link = %x\n", entry, p->RIOConnectTable[entry].Topology[0].Link);
				rio_dprintk(RIO_DEBUG_CTRL, "Map entry %d.Top[1].Unit = %x\n", entry, p->RIOConnectTable[entry].Topology[1].Unit);
				rio_dprintk(RIO_DEBUG_CTRL, "Map entry %d.Top[1].Link = %x\n", entry, p->RIOConnectTable[entry].Topology[1].Link);
				rio_dprintk(RIO_DEBUG_CTRL, "Map entry %d.Top[2].Unit = %x\n", entry, p->RIOConnectTable[entry].Topology[2].Unit);
				rio_dprintk(RIO_DEBUG_CTRL, "Map entry %d.Top[2].Link = %x\n", entry, p->RIOConnectTable[entry].Topology[2].Link);
				rio_dprintk(RIO_DEBUG_CTRL, "Map entry %d.Top[3].Unit = %x\n", entry, p->RIOConnectTable[entry].Topology[3].Unit);
				rio_dprintk(RIO_DEBUG_CTRL, "Map entry %d.Top[4].Link = %x\n", entry, p->RIOConnectTable[entry].Topology[3].Link);
				rio_dprintk(RIO_DEBUG_CTRL, "Map entry %d.Name = %s\n", entry, p->RIOConnectTable[entry].Name);
			}
			rio_dprintk(RIO_DEBUG_CTRL, "*****\nEND MAP ENTRIES\n");
		}
		p->RIOQuickCheck = NOT_CHANGED;	/* a table has been gotten */
		return 0;

	case RIO_PUT_TABLE:
		/*
		 ** Write the routing table to the device driver from user space
		 */
		rio_dprintk(RIO_DEBUG_CTRL, "RIO_PUT_TABLE\n");

		if (!su) {
			rio_dprintk(RIO_DEBUG_CTRL, "RIO_PUT_TABLE !Root\n");
			p->RIOError.Error = NOT_SUPER_USER;
			return -EPERM;
		}
		if (copy_from_user(&p->RIOConnectTable[0], argp, TOTAL_MAP_ENTRIES * sizeof(struct Map))) {
			rio_dprintk(RIO_DEBUG_CTRL, "RIO_PUT_TABLE copy failed\n");
			p->RIOError.Error = COPYIN_FAILED;
			return -EFAULT;
		}
/*
***********************************
				{
					int entry;
					rio_dprint(RIO_DEBUG_CTRL,  ("*****\nMAP ENTRIES\n") );
					for ( entry=0; entry<TOTAL_MAP_ENTRIES; entry++ )
					{
						rio_dprint(RIO_DEBUG_CTRL,  ("Map entry %d.HostUniqueNum = 0x%x\n", entry, p->RIOConnectTable[entry].HostUniqueNum ) );
						rio_dprint(RIO_DEBUG_CTRL,  ("Map entry %d.RtaUniqueNum = 0x%x\n", entry, p->RIOConnectTable[entry].RtaUniqueNum ) );
						rio_dprint(RIO_DEBUG_CTRL,  ("Map entry %d.ID = 0x%x\n", entry, p->RIOConnectTable[entry].ID ) );
						rio_dprint(RIO_DEBUG_CTRL,  ("Map entry %d.ID2 = 0x%x\n", entry, p->RIOConnectTable[entry].ID2 ) );
						rio_dprint(RIO_DEBUG_CTRL,  ("Map entry %d.Flags = 0x%x\n", entry, p->RIOConnectTable[entry].Flags ) );
						rio_dprint(RIO_DEBUG_CTRL,  ("Map entry %d.SysPort = 0x%x\n", entry, p->RIOConnectTable[entry].SysPort ) );
						rio_dprint(RIO_DEBUG_CTRL,  ("Map entry %d.Top[0].Unit = %b\n", entry, p->RIOConnectTable[entry].Topology[0].Unit ) );
						rio_dprint(RIO_DEBUG_CTRL,  ("Map entry %d.Top[0].Link = %b\n", entry, p->RIOConnectTable[entry].Topology[0].Link ) );
						rio_dprint(RIO_DEBUG_CTRL,  ("Map entry %d.Top[1].Unit = %b\n", entry, p->RIOConnectTable[entry].Topology[1].Unit ) );
						rio_dprint(RIO_DEBUG_CTRL,  ("Map entry %d.Top[1].Link = %b\n", entry, p->RIOConnectTable[entry].Topology[1].Link ) );
						rio_dprint(RIO_DEBUG_CTRL,  ("Map entry %d.Top[2].Unit = %b\n", entry, p->RIOConnectTable[entry].Topology[2].Unit ) );
						rio_dprint(RIO_DEBUG_CTRL,  ("Map entry %d.Top[2].Link = %b\n", entry, p->RIOConnectTable[entry].Topology[2].Link ) );
						rio_dprint(RIO_DEBUG_CTRL,  ("Map entry %d.Top[3].Unit = %b\n", entry, p->RIOConnectTable[entry].Topology[3].Unit ) );
						rio_dprint(RIO_DEBUG_CTRL,  ("Map entry %d.Top[4].Link = %b\n", entry, p->RIOConnectTable[entry].Topology[3].Link ) );
						rio_dprint(RIO_DEBUG_CTRL,  ("Map entry %d.Name = %s\n", entry, p->RIOConnectTable[entry].Name ) );
					}
					rio_dprint(RIO_DEBUG_CTRL,  ("*****\nEND MAP ENTRIES\n") );
				}
***********************************
*/
		return RIONewTable(p);

	case RIO_GET_BINDINGS:
		/*
		 ** Send bindings table, containing unique numbers of RTAs owned
		 ** by this system to user space
		 */
		rio_dprintk(RIO_DEBUG_CTRL, "RIO_GET_BINDINGS\n");

		if (!su) {
			rio_dprintk(RIO_DEBUG_CTRL, "RIO_GET_BINDINGS !Root\n");
			p->RIOError.Error = NOT_SUPER_USER;
			return -EPERM;
		}
		if (copy_to_user(argp, p->RIOBindTab, (sizeof(ulong) * MAX_RTA_BINDINGS))) {
			rio_dprintk(RIO_DEBUG_CTRL, "RIO_GET_BINDINGS copy failed\n");
			p->RIOError.Error = COPYOUT_FAILED;
			return -EFAULT;
		}
		return 0;

	case RIO_PUT_BINDINGS:
		/*
		 ** Receive a bindings table, containing unique numbers of RTAs owned
		 ** by this system
		 */
		rio_dprintk(RIO_DEBUG_CTRL, "RIO_PUT_BINDINGS\n");

		if (!su) {
			rio_dprintk(RIO_DEBUG_CTRL, "RIO_PUT_BINDINGS !Root\n");
			p->RIOError.Error = NOT_SUPER_USER;
			return -EPERM;
		}
		if (copy_from_user(&p->RIOBindTab[0], argp, (sizeof(ulong) * MAX_RTA_BINDINGS))) {
			rio_dprintk(RIO_DEBUG_CTRL, "RIO_PUT_BINDINGS copy failed\n");
			p->RIOError.Error = COPYIN_FAILED;
			return -EFAULT;
		}
		return 0;

	case RIO_BIND_RTA:
		{
			int EmptySlot = -1;
			/*
			 ** Bind this RTA to host, so that it will be booted by
			 ** host in 'boot owned RTAs' mode.
			 */
			rio_dprintk(RIO_DEBUG_CTRL, "RIO_BIND_RTA\n");

			if (!su) {
				rio_dprintk(RIO_DEBUG_CTRL, "RIO_BIND_RTA !Root\n");
				p->RIOError.Error = NOT_SUPER_USER;
				return -EPERM;
			}
			for (Entry = 0; Entry < MAX_RTA_BINDINGS; Entry++) {
				if ((EmptySlot == -1) && (p->RIOBindTab[Entry] == 0L))
					EmptySlot = Entry;
				else if (p->RIOBindTab[Entry] == arg) {
					/*
					 ** Already exists - delete
					 */
					p->RIOBindTab[Entry] = 0L;
					rio_dprintk(RIO_DEBUG_CTRL, "Removing Rta %ld from p->RIOBindTab\n", arg);
					return 0;
				}
			}
			/*
			 ** Dosen't exist - add
			 */
			if (EmptySlot != -1) {
				p->RIOBindTab[EmptySlot] = arg;
				rio_dprintk(RIO_DEBUG_CTRL, "Adding Rta %lx to p->RIOBindTab\n", arg);
			} else {
				rio_dprintk(RIO_DEBUG_CTRL, "p->RIOBindTab full! - Rta %lx not added\n", arg);
				return -ENOMEM;
			}
			return 0;
		}

	case RIO_RESUME:
		rio_dprintk(RIO_DEBUG_CTRL, "RIO_RESUME\n");
		port = arg;
		if ((port < 0) || (port > 511)) {
			rio_dprintk(RIO_DEBUG_CTRL, "RIO_RESUME: Bad port number %d\n", port);
			p->RIOError.Error = PORT_NUMBER_OUT_OF_RANGE;
			return -EINVAL;
		}
		PortP = p->RIOPortp[port];
		if (!PortP->Mapped) {
			rio_dprintk(RIO_DEBUG_CTRL, "RIO_RESUME: Port %d not mapped\n", port);
			p->RIOError.Error = PORT_NOT_MAPPED_INTO_SYSTEM;
			return -EINVAL;
		}
		if (!(PortP->State & (RIO_LOPEN | RIO_MOPEN))) {
			rio_dprintk(RIO_DEBUG_CTRL, "RIO_RESUME: Port %d not open\n", port);
			return -EINVAL;
		}

		rio_spin_lock_irqsave(&PortP->portSem, flags);
		if (RIOPreemptiveCmd(p, (p->RIOPortp[port]), RESUME) == RIO_FAIL) {
			rio_dprintk(RIO_DEBUG_CTRL, "RIO_RESUME failed\n");
			rio_spin_unlock_irqrestore(&PortP->portSem, flags);
			return -EBUSY;
		} else {
			rio_dprintk(RIO_DEBUG_CTRL, "RIO_RESUME: Port %d resumed\n", port);
			PortP->State |= RIO_BUSY;
		}
		rio_spin_unlock_irqrestore(&PortP->portSem, flags);
		return retval;

	case RIO_ASSIGN_RTA:
		rio_dprintk(RIO_DEBUG_CTRL, "RIO_ASSIGN_RTA\n");
		if (!su) {
			rio_dprintk(RIO_DEBUG_CTRL, "RIO_ASSIGN_RTA !Root\n");
			p->RIOError.Error = NOT_SUPER_USER;
			return -EPERM;
		}
		if (copy_from_user(&MapEnt, argp, sizeof(MapEnt))) {
			rio_dprintk(RIO_DEBUG_CTRL, "Copy from user space failed\n");
			p->RIOError.Error = COPYIN_FAILED;
			return -EFAULT;
		}
		return RIOAssignRta(p, &MapEnt);

	case RIO_CHANGE_NAME:
		rio_dprintk(RIO_DEBUG_CTRL, "RIO_CHANGE_NAME\n");
		if (!su) {
			rio_dprintk(RIO_DEBUG_CTRL, "RIO_CHANGE_NAME !Root\n");
			p->RIOError.Error = NOT_SUPER_USER;
			return -EPERM;
		}
		if (copy_from_user(&MapEnt, argp, sizeof(MapEnt))) {
			rio_dprintk(RIO_DEBUG_CTRL, "Copy from user space failed\n");
			p->RIOError.Error = COPYIN_FAILED;
			return -EFAULT;
		}
		return RIOChangeName(p, &MapEnt);

	case RIO_DELETE_RTA:
		rio_dprintk(RIO_DEBUG_CTRL, "RIO_DELETE_RTA\n");
		if (!su) {
			rio_dprintk(RIO_DEBUG_CTRL, "RIO_DELETE_RTA !Root\n");
			p->RIOError.Error = NOT_SUPER_USER;
			return -EPERM;
		}
		if (copy_from_user(&MapEnt, argp, sizeof(MapEnt))) {
			rio_dprintk(RIO_DEBUG_CTRL, "Copy from data space failed\n");
			p->RIOError.Error = COPYIN_FAILED;
			return -EFAULT;
		}
		return RIODeleteRta(p, &MapEnt);

	case RIO_QUICK_CHECK:
		if (copy_to_user(argp, &p->RIORtaDisCons, sizeof(unsigned int))) {
			p->RIOError.Error = COPYOUT_FAILED;
			return -EFAULT;
		}
		return 0;

	case RIO_LAST_ERROR:
		if (copy_to_user(argp, &p->RIOError, sizeof(struct Error)))
			return -EFAULT;
		return 0;

	case RIO_GET_LOG:
		rio_dprintk(RIO_DEBUG_CTRL, "RIO_GET_LOG\n");
		return -EINVAL;

	case RIO_GET_MODTYPE:
		if (copy_from_user(&port, argp, sizeof(unsigned int))) {
			p->RIOError.Error = COPYIN_FAILED;
			return -EFAULT;
		}
		rio_dprintk(RIO_DEBUG_CTRL, "Get module type for port %d\n", port);
		if (port < 0 || port > 511) {
			rio_dprintk(RIO_DEBUG_CTRL, "RIO_GET_MODTYPE: Bad port number %d\n", port);
			p->RIOError.Error = PORT_NUMBER_OUT_OF_RANGE;
			return -EINVAL;
		}
		PortP = (p->RIOPortp[port]);
		if (!PortP->Mapped) {
			rio_dprintk(RIO_DEBUG_CTRL, "RIO_GET_MODTYPE: Port %d not mapped\n", port);
			p->RIOError.Error = PORT_NOT_MAPPED_INTO_SYSTEM;
			return -EINVAL;
		}
		/*
		 ** Return module type of port
		 */
		port = PortP->HostP->UnixRups[PortP->RupNum].ModTypes;
		if (copy_to_user(argp, &port, sizeof(unsigned int))) {
			p->RIOError.Error = COPYOUT_FAILED;
			return -EFAULT;
		}
		return (0);
	case RIO_BLOCK_OPENS:
		rio_dprintk(RIO_DEBUG_CTRL, "Opens block until booted\n");
		for (Entry = 0; Entry < RIO_PORTS; Entry++) {
			rio_spin_lock_irqsave(&PortP->portSem, flags);
			p->RIOPortp[Entry]->WaitUntilBooted = 1;
			rio_spin_unlock_irqrestore(&PortP->portSem, flags);
		}
		return 0;

	case RIO_SETUP_PORTS:
		rio_dprintk(RIO_DEBUG_CTRL, "Setup ports\n");
		if (copy_from_user(&PortSetup, argp, sizeof(PortSetup))) {
			p->RIOError.Error = COPYIN_FAILED;
			rio_dprintk(RIO_DEBUG_CTRL, "EFAULT");
			return -EFAULT;
		}
		if (PortSetup.From > PortSetup.To || PortSetup.To >= RIO_PORTS) {
			p->RIOError.Error = PORT_NUMBER_OUT_OF_RANGE;
			rio_dprintk(RIO_DEBUG_CTRL, "ENXIO");
			return -ENXIO;
		}
		if (PortSetup.XpCps > p->RIOConf.MaxXpCps || PortSetup.XpCps < p->RIOConf.MinXpCps) {
			p->RIOError.Error = XPRINT_CPS_OUT_OF_RANGE;
			rio_dprintk(RIO_DEBUG_CTRL, "EINVAL");
			return -EINVAL;
		}
		if (!p->RIOPortp) {
			printk(KERN_ERR "rio: No p->RIOPortp array!\n");
			rio_dprintk(RIO_DEBUG_CTRL, "No p->RIOPortp array!\n");
			return -EIO;
		}
		rio_dprintk(RIO_DEBUG_CTRL, "entering loop (%d %d)!\n", PortSetup.From, PortSetup.To);
		for (loop = PortSetup.From; loop <= PortSetup.To; loop++) {
			rio_dprintk(RIO_DEBUG_CTRL, "in loop (%d)!\n", loop);
		}
		rio_dprintk(RIO_DEBUG_CTRL, "after loop (%d)!\n", loop);
		rio_dprintk(RIO_DEBUG_CTRL, "Retval:%x\n", retval);
		return retval;

	case RIO_GET_PORT_SETUP:
		rio_dprintk(RIO_DEBUG_CTRL, "Get port setup\n");
		if (copy_from_user(&PortSetup, argp, sizeof(PortSetup))) {
			p->RIOError.Error = COPYIN_FAILED;
			return -EFAULT;
		}
		if (PortSetup.From >= RIO_PORTS) {
			p->RIOError.Error = PORT_NUMBER_OUT_OF_RANGE;
			return -ENXIO;
		}

		port = PortSetup.To = PortSetup.From;
		PortSetup.IxAny = (p->RIOPortp[port]->Config & RIO_IXANY) ? 1 : 0;
		PortSetup.IxOn = (p->RIOPortp[port]->Config & RIO_IXON) ? 1 : 0;
		PortSetup.Drain = (p->RIOPortp[port]->Config & RIO_WAITDRAIN) ? 1 : 0;
		PortSetup.Store = p->RIOPortp[port]->Store;
		PortSetup.Lock = p->RIOPortp[port]->Lock;
		PortSetup.XpCps = p->RIOPortp[port]->Xprint.XpCps;
		memcpy(PortSetup.XpOn, p->RIOPortp[port]->Xprint.XpOn, MAX_XP_CTRL_LEN);
		memcpy(PortSetup.XpOff, p->RIOPortp[port]->Xprint.XpOff, MAX_XP_CTRL_LEN);
		PortSetup.XpOn[MAX_XP_CTRL_LEN - 1] = '\0';
		PortSetup.XpOff[MAX_XP_CTRL_LEN - 1] = '\0';

		if (copy_to_user(argp, &PortSetup, sizeof(PortSetup))) {
			p->RIOError.Error = COPYOUT_FAILED;
			return -EFAULT;
		}
		return retval;

	case RIO_GET_PORT_PARAMS:
		rio_dprintk(RIO_DEBUG_CTRL, "Get port params\n");
		if (copy_from_user(&PortParams, argp, sizeof(struct PortParams))) {
			p->RIOError.Error = COPYIN_FAILED;
			return -EFAULT;
		}
		if (PortParams.Port >= RIO_PORTS) {
			p->RIOError.Error = PORT_NUMBER_OUT_OF_RANGE;
			return -ENXIO;
		}
		PortP = (p->RIOPortp[PortParams.Port]);
		PortParams.Config = PortP->Config;
		PortParams.State = PortP->State;
		rio_dprintk(RIO_DEBUG_CTRL, "Port %d\n", PortParams.Port);

		if (copy_to_user(argp, &PortParams, sizeof(struct PortParams))) {
			p->RIOError.Error = COPYOUT_FAILED;
			return -EFAULT;
		}
		return retval;

	case RIO_GET_PORT_TTY:
		rio_dprintk(RIO_DEBUG_CTRL, "Get port tty\n");
		if (copy_from_user(&PortTty, argp, sizeof(struct PortTty))) {
			p->RIOError.Error = COPYIN_FAILED;
			return -EFAULT;
		}
		if (PortTty.port >= RIO_PORTS) {
			p->RIOError.Error = PORT_NUMBER_OUT_OF_RANGE;
			return -ENXIO;
		}

		rio_dprintk(RIO_DEBUG_CTRL, "Port %d\n", PortTty.port);
		PortP = (p->RIOPortp[PortTty.port]);
		if (copy_to_user(argp, &PortTty, sizeof(struct PortTty))) {
			p->RIOError.Error = COPYOUT_FAILED;
			return -EFAULT;
		}
		return retval;

	case RIO_SET_PORT_TTY:
		if (copy_from_user(&PortTty, argp, sizeof(struct PortTty))) {
			p->RIOError.Error = COPYIN_FAILED;
			return -EFAULT;
		}
		rio_dprintk(RIO_DEBUG_CTRL, "Set port %d tty\n", PortTty.port);
		if (PortTty.port >= (ushort) RIO_PORTS) {
			p->RIOError.Error = PORT_NUMBER_OUT_OF_RANGE;
			return -ENXIO;
		}
		PortP = (p->RIOPortp[PortTty.port]);
		RIOParam(PortP, CONFIG, PortP->State & RIO_MODEM, OK_TO_SLEEP);
		return retval;

	case RIO_SET_PORT_PARAMS:
		rio_dprintk(RIO_DEBUG_CTRL, "Set port params\n");
		if (copy_from_user(&PortParams, argp, sizeof(PortParams))) {
			p->RIOError.Error = COPYIN_FAILED;
			return -EFAULT;
		}
		if (PortParams.Port >= (ushort) RIO_PORTS) {
			p->RIOError.Error = PORT_NUMBER_OUT_OF_RANGE;
			return -ENXIO;
		}
		PortP = (p->RIOPortp[PortParams.Port]);
		rio_spin_lock_irqsave(&PortP->portSem, flags);
		PortP->Config = PortParams.Config;
		rio_spin_unlock_irqrestore(&PortP->portSem, flags);
		return retval;

	case RIO_GET_PORT_STATS:
		rio_dprintk(RIO_DEBUG_CTRL, "RIO_GET_PORT_STATS\n");
		if (copy_from_user(&portStats, argp, sizeof(struct portStats))) {
			p->RIOError.Error = COPYIN_FAILED;
			return -EFAULT;
		}
		if (portStats.port < 0 || portStats.port >= RIO_PORTS) {
			p->RIOError.Error = PORT_NUMBER_OUT_OF_RANGE;
			return -ENXIO;
		}
		PortP = (p->RIOPortp[portStats.port]);
		portStats.gather = PortP->statsGather;
		portStats.txchars = PortP->txchars;
		portStats.rxchars = PortP->rxchars;
		portStats.opens = PortP->opens;
		portStats.closes = PortP->closes;
		portStats.ioctls = PortP->ioctls;
		if (copy_to_user(argp, &portStats, sizeof(struct portStats))) {
			p->RIOError.Error = COPYOUT_FAILED;
			return -EFAULT;
		}
		return retval;

	case RIO_RESET_PORT_STATS:
		port = arg;
		rio_dprintk(RIO_DEBUG_CTRL, "RIO_RESET_PORT_STATS\n");
		if (port >= RIO_PORTS) {
			p->RIOError.Error = PORT_NUMBER_OUT_OF_RANGE;
			return -ENXIO;
		}
		PortP = (p->RIOPortp[port]);
		rio_spin_lock_irqsave(&PortP->portSem, flags);
		PortP->txchars = 0;
		PortP->rxchars = 0;
		PortP->opens = 0;
		PortP->closes = 0;
		PortP->ioctls = 0;
		rio_spin_unlock_irqrestore(&PortP->portSem, flags);
		return retval;

	case RIO_GATHER_PORT_STATS:
		rio_dprintk(RIO_DEBUG_CTRL, "RIO_GATHER_PORT_STATS\n");
		if (copy_from_user(&portStats, argp, sizeof(struct portStats))) {
			p->RIOError.Error = COPYIN_FAILED;
			return -EFAULT;
		}
		if (portStats.port < 0 || portStats.port >= RIO_PORTS) {
			p->RIOError.Error = PORT_NUMBER_OUT_OF_RANGE;
			return -ENXIO;
		}
		PortP = (p->RIOPortp[portStats.port]);
		rio_spin_lock_irqsave(&PortP->portSem, flags);
		PortP->statsGather = portStats.gather;
		rio_spin_unlock_irqrestore(&PortP->portSem, flags);
		return retval;

	case RIO_READ_CONFIG:
		rio_dprintk(RIO_DEBUG_CTRL, "RIO_READ_CONFIG\n");
		if (copy_to_user(argp, &p->RIOConf, sizeof(struct Conf))) {
			p->RIOError.Error = COPYOUT_FAILED;
			return -EFAULT;
		}
		return retval;

	case RIO_SET_CONFIG:
		rio_dprintk(RIO_DEBUG_CTRL, "RIO_SET_CONFIG\n");
		if (!su) {
			p->RIOError.Error = NOT_SUPER_USER;
			return -EPERM;
		}
		if (copy_from_user(&p->RIOConf, argp, sizeof(struct Conf))) {
			p->RIOError.Error = COPYIN_FAILED;
			return -EFAULT;
		}
		/*
		 ** move a few value around
		 */
		for (Host = 0; Host < p->RIONumHosts; Host++)
			if ((p->RIOHosts[Host].Flags & RUN_STATE) == RC_RUNNING)
				writew(p->RIOConf.Timer, &p->RIOHosts[Host].ParmMapP->timer);
		return retval;

	case RIO_START_POLLER:
		rio_dprintk(RIO_DEBUG_CTRL, "RIO_START_POLLER\n");
		return -EINVAL;

	case RIO_STOP_POLLER:
		rio_dprintk(RIO_DEBUG_CTRL, "RIO_STOP_POLLER\n");
		if (!su) {
			p->RIOError.Error = NOT_SUPER_USER;
			return -EPERM;
		}
		p->RIOPolling = NOT_POLLING;
		return retval;

	case RIO_SETDEBUG:
	case RIO_GETDEBUG:
		rio_dprintk(RIO_DEBUG_CTRL, "RIO_SETDEBUG/RIO_GETDEBUG\n");
		if (copy_from_user(&DebugCtrl, argp, sizeof(DebugCtrl))) {
			p->RIOError.Error = COPYIN_FAILED;
			return -EFAULT;
		}
		if (DebugCtrl.SysPort == NO_PORT) {
			if (cmd == RIO_SETDEBUG) {
				if (!su) {
					p->RIOError.Error = NOT_SUPER_USER;
					return -EPERM;
				}
				p->rio_debug = DebugCtrl.Debug;
				p->RIODebugWait = DebugCtrl.Wait;
				rio_dprintk(RIO_DEBUG_CTRL, "Set global debug to 0x%x set wait to 0x%x\n", p->rio_debug, p->RIODebugWait);
			} else {
				rio_dprintk(RIO_DEBUG_CTRL, "Get global debug 0x%x wait 0x%x\n", p->rio_debug, p->RIODebugWait);
				DebugCtrl.Debug = p->rio_debug;
				DebugCtrl.Wait = p->RIODebugWait;
				if (copy_to_user(argp, &DebugCtrl, sizeof(DebugCtrl))) {
					rio_dprintk(RIO_DEBUG_CTRL, "RIO_SET/GET DEBUG: bad port number %d\n", DebugCtrl.SysPort);
					p->RIOError.Error = COPYOUT_FAILED;
					return -EFAULT;
				}
			}
		} else if (DebugCtrl.SysPort >= RIO_PORTS && DebugCtrl.SysPort != NO_PORT) {
			rio_dprintk(RIO_DEBUG_CTRL, "RIO_SET/GET DEBUG: bad port number %d\n", DebugCtrl.SysPort);
			p->RIOError.Error = PORT_NUMBER_OUT_OF_RANGE;
			return -ENXIO;
		} else if (cmd == RIO_SETDEBUG) {
			if (!su) {
				p->RIOError.Error = NOT_SUPER_USER;
				return -EPERM;
			}
			rio_spin_lock_irqsave(&PortP->portSem, flags);
			p->RIOPortp[DebugCtrl.SysPort]->Debug = DebugCtrl.Debug;
			rio_spin_unlock_irqrestore(&PortP->portSem, flags);
			rio_dprintk(RIO_DEBUG_CTRL, "RIO_SETDEBUG 0x%x\n", p->RIOPortp[DebugCtrl.SysPort]->Debug);
		} else {
			rio_dprintk(RIO_DEBUG_CTRL, "RIO_GETDEBUG 0x%x\n", p->RIOPortp[DebugCtrl.SysPort]->Debug);
			DebugCtrl.Debug = p->RIOPortp[DebugCtrl.SysPort]->Debug;
			if (copy_to_user(argp, &DebugCtrl, sizeof(DebugCtrl))) {
				rio_dprintk(RIO_DEBUG_CTRL, "RIO_GETDEBUG: Bad copy to user space\n");
				p->RIOError.Error = COPYOUT_FAILED;
				return -EFAULT;
			}
		}
		return retval;

	case RIO_VERSID:
		/*
		 ** Enquire about the release and version.
		 ** We return MAX_VERSION_LEN bytes, being a
		 ** textual null terminated string.
		 */
		rio_dprintk(RIO_DEBUG_CTRL, "RIO_VERSID\n");
		if (copy_to_user(argp, RIOVersid(), sizeof(struct rioVersion))) {
			rio_dprintk(RIO_DEBUG_CTRL, "RIO_VERSID: Bad copy to user space (host=%d)\n", Host);
			p->RIOError.Error = COPYOUT_FAILED;
			return -EFAULT;
		}
		return retval;

	case RIO_NUM_HOSTS:
		/*
		 ** Enquire as to the number of hosts located
		 ** at init time.
		 */
		rio_dprintk(RIO_DEBUG_CTRL, "RIO_NUM_HOSTS\n");
		if (copy_to_user(argp, &p->RIONumHosts, sizeof(p->RIONumHosts))) {
			rio_dprintk(RIO_DEBUG_CTRL, "RIO_NUM_HOSTS: Bad copy to user space\n");
			p->RIOError.Error = COPYOUT_FAILED;
			return -EFAULT;
		}
		return retval;

	case RIO_HOST_FOAD:
		/*
		 ** Kill host. This may not be in the final version...
		 */
		rio_dprintk(RIO_DEBUG_CTRL, "RIO_HOST_FOAD %ld\n", arg);
		if (!su) {
			rio_dprintk(RIO_DEBUG_CTRL, "RIO_HOST_FOAD: Not super user\n");
			p->RIOError.Error = NOT_SUPER_USER;
			return -EPERM;
		}
		p->RIOHalted = 1;
		p->RIOSystemUp = 0;

		for (Host = 0; Host < p->RIONumHosts; Host++) {
			(void) RIOBoardTest(p->RIOHosts[Host].PaddrP, p->RIOHosts[Host].Caddr, p->RIOHosts[Host].Type, p->RIOHosts[Host].Slot);
			memset(&p->RIOHosts[Host].Flags, 0, ((char *) &p->RIOHosts[Host].____end_marker____) - ((char *) &p->RIOHosts[Host].Flags));
			p->RIOHosts[Host].Flags = RC_WAITING;
		}
		RIOFoadWakeup(p);
		p->RIONumBootPkts = 0;
		p->RIOBooting = 0;
		printk("HEEEEELP!\n");

		for (loop = 0; loop < RIO_PORTS; loop++) {
			spin_lock_init(&p->RIOPortp[loop]->portSem);
			p->RIOPortp[loop]->InUse = NOT_INUSE;
		}

		p->RIOSystemUp = 0;
		return retval;

	case RIO_DOWNLOAD:
		rio_dprintk(RIO_DEBUG_CTRL, "RIO_DOWNLOAD\n");
		if (!su) {
			rio_dprintk(RIO_DEBUG_CTRL, "RIO_DOWNLOAD: Not super user\n");
			p->RIOError.Error = NOT_SUPER_USER;
			return -EPERM;
		}
		if (copy_from_user(&DownLoad, argp, sizeof(DownLoad))) {
			rio_dprintk(RIO_DEBUG_CTRL, "RIO_DOWNLOAD: Copy in from user space failed\n");
			p->RIOError.Error = COPYIN_FAILED;
			return -EFAULT;
		}
		rio_dprintk(RIO_DEBUG_CTRL, "Copied in download code for product code 0x%x\n", DownLoad.ProductCode);

		/*
		 ** It is important that the product code is an unsigned object!
		 */
		if (DownLoad.ProductCode > MAX_PRODUCT) {
			rio_dprintk(RIO_DEBUG_CTRL, "RIO_DOWNLOAD: Bad product code %d passed\n", DownLoad.ProductCode);
			p->RIOError.Error = NO_SUCH_PRODUCT;
			return -ENXIO;
		}
		/*
		 ** do something!
		 */
		retval = (*(RIOBootTable[DownLoad.ProductCode])) (p, &DownLoad);
		/* <-- Panic */
		p->RIOHalted = 0;
		/*
		 ** and go back, content with a job well completed.
		 */
		return retval;

	case RIO_PARMS:
		{
			unsigned int host;

			if (copy_from_user(&host, argp, sizeof(host))) {
				rio_dprintk(RIO_DEBUG_CTRL, "RIO_HOST_REQ: Copy in from user space failed\n");
				p->RIOError.Error = COPYIN_FAILED;
				return -EFAULT;
			}
			/*
			 ** Fetch the parmmap
			 */
			rio_dprintk(RIO_DEBUG_CTRL, "RIO_PARMS\n");
			if (copy_from_io(argp, p->RIOHosts[host].ParmMapP, sizeof(PARM_MAP))) {
				p->RIOError.Error = COPYOUT_FAILED;
				rio_dprintk(RIO_DEBUG_CTRL, "RIO_PARMS: Copy out to user space failed\n");
				return -EFAULT;
			}
		}
		return retval;

	case RIO_HOST_REQ:
		rio_dprintk(RIO_DEBUG_CTRL, "RIO_HOST_REQ\n");
		if (copy_from_user(&HostReq, argp, sizeof(HostReq))) {
			rio_dprintk(RIO_DEBUG_CTRL, "RIO_HOST_REQ: Copy in from user space failed\n");
			p->RIOError.Error = COPYIN_FAILED;
			return -EFAULT;
		}
		if (HostReq.HostNum >= p->RIONumHosts) {
			p->RIOError.Error = HOST_NUMBER_OUT_OF_RANGE;
			rio_dprintk(RIO_DEBUG_CTRL, "RIO_HOST_REQ: Illegal host number %d\n", HostReq.HostNum);
			return -ENXIO;
		}
		rio_dprintk(RIO_DEBUG_CTRL, "Request for host %d\n", HostReq.HostNum);

		if (copy_to_user(HostReq.HostP, &p->RIOHosts[HostReq.HostNum], sizeof(struct Host))) {
			p->RIOError.Error = COPYOUT_FAILED;
			rio_dprintk(RIO_DEBUG_CTRL, "RIO_HOST_REQ: Bad copy to user space\n");
			return -EFAULT;
		}
		return retval;

	case RIO_HOST_DPRAM:
		rio_dprintk(RIO_DEBUG_CTRL, "Request for DPRAM\n");
		if (copy_from_user(&HostDpRam, argp, sizeof(HostDpRam))) {
			rio_dprintk(RIO_DEBUG_CTRL, "RIO_HOST_DPRAM: Copy in from user space failed\n");
			p->RIOError.Error = COPYIN_FAILED;
			return -EFAULT;
		}
		if (HostDpRam.HostNum >= p->RIONumHosts) {
			p->RIOError.Error = HOST_NUMBER_OUT_OF_RANGE;
			rio_dprintk(RIO_DEBUG_CTRL, "RIO_HOST_DPRAM: Illegal host number %d\n", HostDpRam.HostNum);
			return -ENXIO;
		}
		rio_dprintk(RIO_DEBUG_CTRL, "Request for host %d\n", HostDpRam.HostNum);

		if (p->RIOHosts[HostDpRam.HostNum].Type == RIO_PCI) {
			int off;
			/* It's hardware like this that really gets on my tits. */
			static unsigned char copy[sizeof(struct DpRam)];
			for (off = 0; off < sizeof(struct DpRam); off++)
				copy[off] = readb(p->RIOHosts[HostDpRam.HostNum].Caddr + off);
			if (copy_to_user(HostDpRam.DpRamP, copy, sizeof(struct DpRam))) {
				p->RIOError.Error = COPYOUT_FAILED;
				rio_dprintk(RIO_DEBUG_CTRL, "RIO_HOST_DPRAM: Bad copy to user space\n");
				return -EFAULT;
			}
		} else if (copy_from_io(HostDpRam.DpRamP, p->RIOHosts[HostDpRam.HostNum].Caddr, sizeof(struct DpRam))) {
			p->RIOError.Error = COPYOUT_FAILED;
			rio_dprintk(RIO_DEBUG_CTRL, "RIO_HOST_DPRAM: Bad copy to user space\n");
			return -EFAULT;
		}
		return retval;

	case RIO_SET_BUSY:
		rio_dprintk(RIO_DEBUG_CTRL, "RIO_SET_BUSY\n");
		if (arg > 511) {
			rio_dprintk(RIO_DEBUG_CTRL, "RIO_SET_BUSY: Bad port number %ld\n", arg);
			p->RIOError.Error = PORT_NUMBER_OUT_OF_RANGE;
			return -EINVAL;
		}
		rio_spin_lock_irqsave(&PortP->portSem, flags);
		p->RIOPortp[arg]->State |= RIO_BUSY;
		rio_spin_unlock_irqrestore(&PortP->portSem, flags);
		return retval;

	case RIO_HOST_PORT:
		/*
		 ** The daemon want port information
		 ** (probably for debug reasons)
		 */
		rio_dprintk(RIO_DEBUG_CTRL, "RIO_HOST_PORT\n");
		if (copy_from_user(&PortReq, argp, sizeof(PortReq))) {
			rio_dprintk(RIO_DEBUG_CTRL, "RIO_HOST_PORT: Copy in from user space failed\n");
			p->RIOError.Error = COPYIN_FAILED;
			return -EFAULT;
		}

		if (PortReq.SysPort >= RIO_PORTS) {	/* SysPort is unsigned */
			rio_dprintk(RIO_DEBUG_CTRL, "RIO_HOST_PORT: Illegal port number %d\n", PortReq.SysPort);
			p->RIOError.Error = PORT_NUMBER_OUT_OF_RANGE;
			return -ENXIO;
		}
		rio_dprintk(RIO_DEBUG_CTRL, "Request for port %d\n", PortReq.SysPort);
		if (copy_to_user(PortReq.PortP, p->RIOPortp[PortReq.SysPort], sizeof(struct Port))) {
			p->RIOError.Error = COPYOUT_FAILED;
			rio_dprintk(RIO_DEBUG_CTRL, "RIO_HOST_PORT: Bad copy to user space\n");
			return -EFAULT;
		}
		return retval;

	case RIO_HOST_RUP:
		/*
		 ** The daemon want rup information
		 ** (probably for debug reasons)
		 */
		rio_dprintk(RIO_DEBUG_CTRL, "RIO_HOST_RUP\n");
		if (copy_from_user(&RupReq, argp, sizeof(RupReq))) {
			rio_dprintk(RIO_DEBUG_CTRL, "RIO_HOST_RUP: Copy in from user space failed\n");
			p->RIOError.Error = COPYIN_FAILED;
			return -EFAULT;
		}
		if (RupReq.HostNum >= p->RIONumHosts) {	/* host is unsigned */
			rio_dprintk(RIO_DEBUG_CTRL, "RIO_HOST_RUP: Illegal host number %d\n", RupReq.HostNum);
			p->RIOError.Error = HOST_NUMBER_OUT_OF_RANGE;
			return -ENXIO;
		}
		if (RupReq.RupNum >= MAX_RUP + LINKS_PER_UNIT) {	/* eek! */
			rio_dprintk(RIO_DEBUG_CTRL, "RIO_HOST_RUP: Illegal rup number %d\n", RupReq.RupNum);
			p->RIOError.Error = RUP_NUMBER_OUT_OF_RANGE;
			return -EINVAL;
		}
		HostP = &p->RIOHosts[RupReq.HostNum];

		if ((HostP->Flags & RUN_STATE) != RC_RUNNING) {
			rio_dprintk(RIO_DEBUG_CTRL, "RIO_HOST_RUP: Host %d not running\n", RupReq.HostNum);
			p->RIOError.Error = HOST_NOT_RUNNING;
			return -EIO;
		}
		rio_dprintk(RIO_DEBUG_CTRL, "Request for rup %d from host %d\n", RupReq.RupNum, RupReq.HostNum);

		if (copy_from_io(RupReq.RupP, HostP->UnixRups[RupReq.RupNum].RupP, sizeof(struct RUP))) {
			p->RIOError.Error = COPYOUT_FAILED;
			rio_dprintk(RIO_DEBUG_CTRL, "RIO_HOST_RUP: Bad copy to user space\n");
			return -EFAULT;
		}
		return retval;

	case RIO_HOST_LPB:
		/*
		 ** The daemon want lpb information
		 ** (probably for debug reasons)
		 */
		rio_dprintk(RIO_DEBUG_CTRL, "RIO_HOST_LPB\n");
		if (copy_from_user(&LpbReq, argp, sizeof(LpbReq))) {
			rio_dprintk(RIO_DEBUG_CTRL, "RIO_HOST_LPB: Bad copy from user space\n");
			p->RIOError.Error = COPYIN_FAILED;
			return -EFAULT;
		}
		if (LpbReq.Host >= p->RIONumHosts) {	/* host is unsigned */
			rio_dprintk(RIO_DEBUG_CTRL, "RIO_HOST_LPB: Illegal host number %d\n", LpbReq.Host);
			p->RIOError.Error = HOST_NUMBER_OUT_OF_RANGE;
			return -ENXIO;
		}
		if (LpbReq.Link >= LINKS_PER_UNIT) {	/* eek! */
			rio_dprintk(RIO_DEBUG_CTRL, "RIO_HOST_LPB: Illegal link number %d\n", LpbReq.Link);
			p->RIOError.Error = LINK_NUMBER_OUT_OF_RANGE;
			return -EINVAL;
		}
		HostP = &p->RIOHosts[LpbReq.Host];

		if ((HostP->Flags & RUN_STATE) != RC_RUNNING) {
			rio_dprintk(RIO_DEBUG_CTRL, "RIO_HOST_LPB: Host %d not running\n", LpbReq.Host);
			p->RIOError.Error = HOST_NOT_RUNNING;
			return -EIO;
		}
		rio_dprintk(RIO_DEBUG_CTRL, "Request for lpb %d from host %d\n", LpbReq.Link, LpbReq.Host);

		if (copy_from_io(LpbReq.LpbP, &HostP->LinkStrP[LpbReq.Link], sizeof(struct LPB))) {
			rio_dprintk(RIO_DEBUG_CTRL, "RIO_HOST_LPB: Bad copy to user space\n");
			p->RIOError.Error = COPYOUT_FAILED;
			return -EFAULT;
		}
		return retval;

		/*
		 ** Here 3 IOCTL's that allow us to change the way in which
		 ** rio logs errors. send them just to syslog or send them
		 ** to both syslog and console or send them to just the console.
		 **
		 ** See RioStrBuf() in util.c for the other half.
		 */
	case RIO_SYSLOG_ONLY:
		p->RIOPrintLogState = PRINT_TO_LOG;	/* Just syslog */
		return 0;

	case RIO_SYSLOG_CONS:
		p->RIOPrintLogState = PRINT_TO_LOG_CONS;	/* syslog and console */
		return 0;

	case RIO_CONS_ONLY:
		p->RIOPrintLogState = PRINT_TO_CONS;	/* Just console */
		return 0;

	case RIO_SIGNALS_ON:
		if (p->RIOSignalProcess) {
			p->RIOError.Error = SIGNALS_ALREADY_SET;
			return -EBUSY;
		}
		/* FIXME: PID tracking */
		p->RIOSignalProcess = current->pid;
		p->RIOPrintDisabled = DONT_PRINT;
		return retval;

	case RIO_SIGNALS_OFF:
		if (p->RIOSignalProcess != current->pid) {
			p->RIOError.Error = NOT_RECEIVING_PROCESS;
			return -EPERM;
		}
		rio_dprintk(RIO_DEBUG_CTRL, "Clear signal process to zero\n");
		p->RIOSignalProcess = 0;
		return retval;

	case RIO_SET_BYTE_MODE:
		for (Host = 0; Host < p->RIONumHosts; Host++)
			if (p->RIOHosts[Host].Type == RIO_AT)
				p->RIOHosts[Host].Mode &= ~WORD_OPERATION;
		return retval;

	case RIO_SET_WORD_MODE:
		for (Host = 0; Host < p->RIONumHosts; Host++)
			if (p->RIOHosts[Host].Type == RIO_AT)
				p->RIOHosts[Host].Mode |= WORD_OPERATION;
		return retval;

	case RIO_SET_FAST_BUS:
		for (Host = 0; Host < p->RIONumHosts; Host++)
			if (p->RIOHosts[Host].Type == RIO_AT)
				p->RIOHosts[Host].Mode |= FAST_AT_BUS;
		return retval;

	case RIO_SET_SLOW_BUS:
		for (Host = 0; Host < p->RIONumHosts; Host++)
			if (p->RIOHosts[Host].Type == RIO_AT)
				p->RIOHosts[Host].Mode &= ~FAST_AT_BUS;
		return retval;

	case RIO_MAP_B50_TO_50:
	case RIO_MAP_B50_TO_57600:
	case RIO_MAP_B110_TO_110:
	case RIO_MAP_B110_TO_115200:
		rio_dprintk(RIO_DEBUG_CTRL, "Baud rate mapping\n");
		port = arg;
		if (port < 0 || port > 511) {
			rio_dprintk(RIO_DEBUG_CTRL, "Baud rate mapping: Bad port number %d\n", port);
			p->RIOError.Error = PORT_NUMBER_OUT_OF_RANGE;
			return -EINVAL;
		}
		rio_spin_lock_irqsave(&PortP->portSem, flags);
		switch (cmd) {
		case RIO_MAP_B50_TO_50:
			p->RIOPortp[port]->Config |= RIO_MAP_50_TO_50;
			break;
		case RIO_MAP_B50_TO_57600:
			p->RIOPortp[port]->Config &= ~RIO_MAP_50_TO_50;
			break;
		case RIO_MAP_B110_TO_110:
			p->RIOPortp[port]->Config |= RIO_MAP_110_TO_110;
			break;
		case RIO_MAP_B110_TO_115200:
			p->RIOPortp[port]->Config &= ~RIO_MAP_110_TO_110;
			break;
		}
		rio_spin_unlock_irqrestore(&PortP->portSem, flags);
		return retval;

	case RIO_STREAM_INFO:
		rio_dprintk(RIO_DEBUG_CTRL, "RIO_STREAM_INFO\n");
		return -EINVAL;

	case RIO_SEND_PACKET:
		rio_dprintk(RIO_DEBUG_CTRL, "RIO_SEND_PACKET\n");
		if (copy_from_user(&SendPack, argp, sizeof(SendPack))) {
			rio_dprintk(RIO_DEBUG_CTRL, "RIO_SEND_PACKET: Bad copy from user space\n");
			p->RIOError.Error = COPYIN_FAILED;
			return -EFAULT;
		}
		if (SendPack.PortNum >= 128) {
			p->RIOError.Error = PORT_NUMBER_OUT_OF_RANGE;
			return -ENXIO;
		}

		PortP = p->RIOPortp[SendPack.PortNum];
		rio_spin_lock_irqsave(&PortP->portSem, flags);

		if (!can_add_transmit(&PacketP, PortP)) {
			p->RIOError.Error = UNIT_IS_IN_USE;
			rio_spin_unlock_irqrestore(&PortP->portSem, flags);
			return -ENOSPC;
		}

		for (loop = 0; loop < (ushort) (SendPack.Len & 127); loop++)
			writeb(SendPack.Data[loop], &PacketP->data[loop]);

		writeb(SendPack.Len, &PacketP->len);

		add_transmit(PortP);
		/*
		 ** Count characters transmitted for port statistics reporting
		 */
		if (PortP->statsGather)
			PortP->txchars += (SendPack.Len & 127);
		rio_spin_unlock_irqrestore(&PortP->portSem, flags);
		return retval;

	case RIO_NO_MESG:
		if (su)
			p->RIONoMessage = 1;
		return su ? 0 : -EPERM;

	case RIO_MESG:
		if (su)
			p->RIONoMessage = 0;
		return su ? 0 : -EPERM;

	case RIO_WHAT_MESG:
		if (copy_to_user(argp, &p->RIONoMessage, sizeof(p->RIONoMessage))) {
			rio_dprintk(RIO_DEBUG_CTRL, "RIO_WHAT_MESG: Bad copy to user space\n");
			p->RIOError.Error = COPYOUT_FAILED;
			return -EFAULT;
		}
		return 0;

	case RIO_MEM_DUMP:
		if (copy_from_user(&SubCmd, argp, sizeof(struct SubCmdStruct))) {
			p->RIOError.Error = COPYIN_FAILED;
			return -EFAULT;
		}
		rio_dprintk(RIO_DEBUG_CTRL, "RIO_MEM_DUMP host %d rup %d addr %x\n", SubCmd.Host, SubCmd.Rup, SubCmd.Addr);

		if (SubCmd.Rup >= MAX_RUP + LINKS_PER_UNIT) {
			p->RIOError.Error = RUP_NUMBER_OUT_OF_RANGE;
			return -EINVAL;
		}

		if (SubCmd.Host >= p->RIONumHosts) {
			p->RIOError.Error = HOST_NUMBER_OUT_OF_RANGE;
			return -EINVAL;
		}

		port = p->RIOHosts[SubCmd.Host].UnixRups[SubCmd.Rup].BaseSysPort;

		PortP = p->RIOPortp[port];

		rio_spin_lock_irqsave(&PortP->portSem, flags);

		if (RIOPreemptiveCmd(p, PortP, MEMDUMP) == RIO_FAIL) {
			rio_dprintk(RIO_DEBUG_CTRL, "RIO_MEM_DUMP failed\n");
			rio_spin_unlock_irqrestore(&PortP->portSem, flags);
			return -EBUSY;
		} else
			PortP->State |= RIO_BUSY;

		rio_spin_unlock_irqrestore(&PortP->portSem, flags);
		if (copy_to_user(argp, p->RIOMemDump, MEMDUMP_SIZE)) {
			rio_dprintk(RIO_DEBUG_CTRL, "RIO_MEM_DUMP copy failed\n");
			p->RIOError.Error = COPYOUT_FAILED;
			return -EFAULT;
		}
		return 0;

	case RIO_TICK:
		if (arg >= p->RIONumHosts)
			return -EINVAL;
		rio_dprintk(RIO_DEBUG_CTRL, "Set interrupt for host %ld\n", arg);
		writeb(0xFF, &p->RIOHosts[arg].SetInt);
		return 0;

	case RIO_TOCK:
		if (arg >= p->RIONumHosts)
			return -EINVAL;
		rio_dprintk(RIO_DEBUG_CTRL, "Clear interrupt for host %ld\n", arg);
		writeb(0xFF, &p->RIOHosts[arg].ResetInt);
		return 0;

	case RIO_READ_CHECK:
		/* Check reads for pkts with data[0] the same */
		p->RIOReadCheck = !p->RIOReadCheck;
		if (copy_to_user(argp, &p->RIOReadCheck, sizeof(unsigned int))) {
			p->RIOError.Error = COPYOUT_FAILED;
			return -EFAULT;
		}
		return 0;

	case RIO_READ_REGISTER:
		if (copy_from_user(&SubCmd, argp, sizeof(struct SubCmdStruct))) {
			p->RIOError.Error = COPYIN_FAILED;
			return -EFAULT;
		}
		rio_dprintk(RIO_DEBUG_CTRL, "RIO_READ_REGISTER host %d rup %d port %d reg %x\n", SubCmd.Host, SubCmd.Rup, SubCmd.Port, SubCmd.Addr);

		if (SubCmd.Port > 511) {
			rio_dprintk(RIO_DEBUG_CTRL, "Baud rate mapping: Bad port number %d\n", SubCmd.Port);
			p->RIOError.Error = PORT_NUMBER_OUT_OF_RANGE;
			return -EINVAL;
		}

		if (SubCmd.Rup >= MAX_RUP + LINKS_PER_UNIT) {
			p->RIOError.Error = RUP_NUMBER_OUT_OF_RANGE;
			return -EINVAL;
		}

		if (SubCmd.Host >= p->RIONumHosts) {
			p->RIOError.Error = HOST_NUMBER_OUT_OF_RANGE;
			return -EINVAL;
		}

		port = p->RIOHosts[SubCmd.Host].UnixRups[SubCmd.Rup].BaseSysPort + SubCmd.Port;
		PortP = p->RIOPortp[port];

		rio_spin_lock_irqsave(&PortP->portSem, flags);

		if (RIOPreemptiveCmd(p, PortP, READ_REGISTER) == RIO_FAIL) {
			rio_dprintk(RIO_DEBUG_CTRL, "RIO_READ_REGISTER failed\n");
			rio_spin_unlock_irqrestore(&PortP->portSem, flags);
			return -EBUSY;
		} else
			PortP->State |= RIO_BUSY;

		rio_spin_unlock_irqrestore(&PortP->portSem, flags);
		if (copy_to_user(argp, &p->CdRegister, sizeof(unsigned int))) {
			rio_dprintk(RIO_DEBUG_CTRL, "RIO_READ_REGISTER copy failed\n");
			p->RIOError.Error = COPYOUT_FAILED;
			return -EFAULT;
		}
		return 0;
		/*
		 ** rio_make_dev: given port number (0-511) ORed with port type
		 ** (RIO_DEV_DIRECT, RIO_DEV_MODEM, RIO_DEV_XPRINT) return dev_t
		 ** value to pass to mknod to create the correct device node.
		 */
	case RIO_MAKE_DEV:
		{
			unsigned int port = arg & RIO_MODEM_MASK;
			unsigned int ret;

			switch (arg & RIO_DEV_MASK) {
			case RIO_DEV_DIRECT:
				ret = drv_makedev(MAJOR(dev), port);
				rio_dprintk(RIO_DEBUG_CTRL, "Makedev direct 0x%x is 0x%x\n", port, ret);
				return ret;
			case RIO_DEV_MODEM:
				ret = drv_makedev(MAJOR(dev), (port | RIO_MODEM_BIT));
				rio_dprintk(RIO_DEBUG_CTRL, "Makedev modem 0x%x is 0x%x\n", port, ret);
				return ret;
			case RIO_DEV_XPRINT:
				ret = drv_makedev(MAJOR(dev), port);
				rio_dprintk(RIO_DEBUG_CTRL, "Makedev printer 0x%x is 0x%x\n", port, ret);
				return ret;
			}
			rio_dprintk(RIO_DEBUG_CTRL, "MAKE Device is called\n");
			return -EINVAL;
		}
		/*
		 ** rio_minor: given a dev_t from a stat() call, return
		 ** the port number (0-511) ORed with the port type
		 ** ( RIO_DEV_DIRECT, RIO_DEV_MODEM, RIO_DEV_XPRINT )
		 */
	case RIO_MINOR:
		{
			dev_t dv;
			int mino;
			unsigned long ret;

			dv = (dev_t) (arg);
			mino = RIO_UNMODEM(dv);

			if (RIO_ISMODEM(dv)) {
				rio_dprintk(RIO_DEBUG_CTRL, "Minor for device 0x%x: modem %d\n", dv, mino);
				ret = mino | RIO_DEV_MODEM;
			} else {
				rio_dprintk(RIO_DEBUG_CTRL, "Minor for device 0x%x: direct %d\n", dv, mino);
				ret = mino | RIO_DEV_DIRECT;
			}
			return ret;
		}
	}
	rio_dprintk(RIO_DEBUG_CTRL, "INVALID DAEMON IOCTL 0x%x\n", cmd);
	p->RIOError.Error = IOCTL_COMMAND_UNKNOWN;

	func_exit();
	return -EINVAL;
}

/*
** Pre-emptive commands go on RUPs and are only one byte long.
*/
int RIOPreemptiveCmd(struct rio_info *p, struct Port *PortP, u8 Cmd)
{
	struct CmdBlk *CmdBlkP;
	struct PktCmd_M *PktCmdP;
	int Ret;
	ushort rup;
	int port;

	if (PortP->State & RIO_DELETED) {
		rio_dprintk(RIO_DEBUG_CTRL, "Preemptive command to deleted RTA ignored\n");
		return RIO_FAIL;
	}

	if ((PortP->InUse == (typeof(PortP->InUse))-1) ||
			!(CmdBlkP = RIOGetCmdBlk())) {
		rio_dprintk(RIO_DEBUG_CTRL, "Cannot allocate command block "
			"for command %d on port %d\n", Cmd, PortP->PortNum);
		return RIO_FAIL;
	}

	rio_dprintk(RIO_DEBUG_CTRL, "Command blk %p - InUse now %d\n",
			CmdBlkP, PortP->InUse);

	PktCmdP = (struct PktCmd_M *)&CmdBlkP->Packet.data[0];

	CmdBlkP->Packet.src_unit = 0;
	if (PortP->SecondBlock)
		rup = PortP->ID2;
	else
		rup = PortP->RupNum;
	CmdBlkP->Packet.dest_unit = rup;
	CmdBlkP->Packet.src_port = COMMAND_RUP;
	CmdBlkP->Packet.dest_port = COMMAND_RUP;
	CmdBlkP->Packet.len = PKT_CMD_BIT | 2;
	CmdBlkP->PostFuncP = RIOUnUse;
	CmdBlkP->PostArg = (unsigned long) PortP;
	PktCmdP->Command = Cmd;
	port = PortP->HostPort % (ushort) PORTS_PER_RTA;
	/*
	 ** Index ports 8-15 for 2nd block of 16 port RTA.
	 */
	if (PortP->SecondBlock)
		port += (ushort) PORTS_PER_RTA;
	PktCmdP->PhbNum = port;

	switch (Cmd) {
	case MEMDUMP:
		rio_dprintk(RIO_DEBUG_CTRL, "Queue MEMDUMP command blk %p "
				"(addr 0x%x)\n", CmdBlkP, (int) SubCmd.Addr);
		PktCmdP->SubCommand = MEMDUMP;
		PktCmdP->SubAddr = SubCmd.Addr;
		break;
	case FCLOSE:
		rio_dprintk(RIO_DEBUG_CTRL, "Queue FCLOSE command blk %p\n",
				CmdBlkP);
		break;
	case READ_REGISTER:
		rio_dprintk(RIO_DEBUG_CTRL, "Queue READ_REGISTER (0x%x) "
				"command blk %p\n", (int) SubCmd.Addr, CmdBlkP);
		PktCmdP->SubCommand = READ_REGISTER;
		PktCmdP->SubAddr = SubCmd.Addr;
		break;
	case RESUME:
		rio_dprintk(RIO_DEBUG_CTRL, "Queue RESUME command blk %p\n",
				CmdBlkP);
		break;
	case RFLUSH:
		rio_dprintk(RIO_DEBUG_CTRL, "Queue RFLUSH command blk %p\n",
				CmdBlkP);
		CmdBlkP->PostFuncP = RIORFlushEnable;
		break;
	case SUSPEND:
		rio_dprintk(RIO_DEBUG_CTRL, "Queue SUSPEND command blk %p\n",
				CmdBlkP);
		break;

	case MGET:
		rio_dprintk(RIO_DEBUG_CTRL, "Queue MGET command blk %p\n",
				CmdBlkP);
		break;

	case MSET:
	case MBIC:
	case MBIS:
		CmdBlkP->Packet.data[4] = (char) PortP->ModemLines;
		rio_dprintk(RIO_DEBUG_CTRL, "Queue MSET/MBIC/MBIS command "
				"blk %p\n", CmdBlkP);
		break;

	case WFLUSH:
		/*
		 ** If we have queued up the maximum number of Write flushes
		 ** allowed then we should not bother sending any more to the
		 ** RTA.
		 */
		if (PortP->WflushFlag == (typeof(PortP->WflushFlag))-1) {
			rio_dprintk(RIO_DEBUG_CTRL, "Trashed WFLUSH, "
					"WflushFlag about to wrap!");
			RIOFreeCmdBlk(CmdBlkP);
			return (RIO_FAIL);
		} else {
			rio_dprintk(RIO_DEBUG_CTRL, "Queue WFLUSH command "
					"blk %p\n", CmdBlkP);
			CmdBlkP->PostFuncP = RIOWFlushMark;
		}
		break;
	}

	PortP->InUse++;

	Ret = RIOQueueCmdBlk(PortP->HostP, rup, CmdBlkP);

	return Ret;
}
