#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"
#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"
** NB. for MPX
** tty lock must NOT have been previously acquired.
*/
-int RIOParam(struct Port *PortP, int cmd, int Modem, int SleepFlag)
+int RIOParam(PortP, cmd, Modem, SleepFlag)
+struct Port *PortP;
+int cmd;
+int Modem;
+int SleepFlag;
{
- struct tty_struct *TtyP;
+ register struct tty_struct *TtyP;
int retval;
- struct phb_param __iomem *phb_param_ptr;
- struct PKT __iomem *PacketP;
+ register struct phb_param *phb_param_ptr;
+ PKT *PacketP;
int res;
- u8 Cor1 = 0, Cor2 = 0, Cor4 = 0, Cor5 = 0;
- u8 TxXon = 0, TxXoff = 0, RxXon = 0, RxXoff = 0;
- u8 LNext = 0, TxBaud = 0, RxBaud = 0;
+ uchar Cor1 = 0, Cor2 = 0, Cor4 = 0, Cor5 = 0;
+ uchar TxXon = 0, TxXoff = 0, RxXon = 0, RxXoff = 0;
+ uchar LNext = 0, TxBaud = 0, RxBaud = 0;
int retries = 0xff;
unsigned long flags;
if (retval == RIO_FAIL) {
rio_dprintk(RIO_DEBUG_PARAM, "wait for can_add_transmit broken by signal\n");
rio_spin_unlock_irqrestore(&PortP->portSem, flags);
+ pseterr(EINTR);
func_exit();
- return -EINTR;
+
+ return RIO_FAIL;
}
if (PortP->State & RIO_DELETED) {
rio_spin_unlock_irqrestore(&PortP->portSem, flags);
func_exit();
- return 0;
+
+ return RIO_SUCCESS;
}
}
}
rio_dprintk(RIO_DEBUG_PARAM, "can_add_transmit() returns %x\n", res);
- rio_dprintk(RIO_DEBUG_PARAM, "Packet is %p\n", PacketP);
+ rio_dprintk(RIO_DEBUG_PARAM, "Packet is 0x%x\n", (int) PacketP);
- phb_param_ptr = (struct phb_param __iomem *) PacketP->data;
+ phb_param_ptr = (struct phb_param *) PacketP->data;
switch (TtyP->termios->c_cflag & CSIZE) {
e(115200); /* e(230400);e(460800); e(921600); */
}
+ /* XXX MIssing conversion table. XXX */
+ /* (TtyP->termios->c_cflag & V_CBAUD); */
+
rio_dprintk(RIO_DEBUG_PARAM, "tx baud 0x%x, rx baud 0x%x\n", TxBaud, RxBaud);
/*
** Actually write the info into the packet to be sent
*/
- writeb(cmd, &phb_param_ptr->Cmd);
- writeb(Cor1, &phb_param_ptr->Cor1);
- writeb(Cor2, &phb_param_ptr->Cor2);
- writeb(Cor4, &phb_param_ptr->Cor4);
- writeb(Cor5, &phb_param_ptr->Cor5);
- writeb(TxXon, &phb_param_ptr->TxXon);
- writeb(RxXon, &phb_param_ptr->RxXon);
- writeb(TxXoff, &phb_param_ptr->TxXoff);
- writeb(RxXoff, &phb_param_ptr->RxXoff);
- writeb(LNext, &phb_param_ptr->LNext);
- writeb(TxBaud, &phb_param_ptr->TxBaud);
- writeb(RxBaud, &phb_param_ptr->RxBaud);
+ WBYTE(phb_param_ptr->Cmd, cmd);
+ WBYTE(phb_param_ptr->Cor1, Cor1);
+ WBYTE(phb_param_ptr->Cor2, Cor2);
+ WBYTE(phb_param_ptr->Cor4, Cor4);
+ WBYTE(phb_param_ptr->Cor5, Cor5);
+ WBYTE(phb_param_ptr->TxXon, TxXon);
+ WBYTE(phb_param_ptr->RxXon, RxXon);
+ WBYTE(phb_param_ptr->TxXoff, TxXoff);
+ WBYTE(phb_param_ptr->RxXoff, RxXoff);
+ WBYTE(phb_param_ptr->LNext, LNext);
+ WBYTE(phb_param_ptr->TxBaud, TxBaud);
+ WBYTE(phb_param_ptr->RxBaud, RxBaud);
/*
** Set the length/command field
*/
- writeb(12 | PKT_CMD_BIT, &PacketP->len);
+ WBYTE(PacketP->len, 12 | PKT_CMD_BIT);
/*
** The packet is formed - now, whack it off
*/
func_exit();
- return 0;
+ return RIO_SUCCESS;
}
** 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.
*/
-int can_add_transmit(struct PKT __iomem **PktP, struct Port *PortP)
+int can_add_transmit(PktP, PortP)
+PKT **PktP;
+struct Port *PortP;
{
- struct PKT __iomem *tp;
+ register PKT *tp;
- *PktP = tp = (struct PKT __iomem *) RIO_PTR(PortP->Caddr, readw(PortP->TxAdd));
+ *PktP = tp = (PKT *) RIO_PTR(PortP->Caddr, RWORD(*PortP->TxAdd));
- return !((unsigned long) tp & PKT_IN_USE);
+ return !((uint) tp & PKT_IN_USE);
}
/*
** and then move the TxAdd pointer along one position to point to the next
** packet pointer. You must wrap the pointer from the end back to the start.
*/
-void add_transmit(struct Port *PortP)
+void add_transmit(PortP)
+struct Port *PortP;
{
- if (readw(PortP->TxAdd) & PKT_IN_USE) {
+ if (RWORD(*PortP->TxAdd) & PKT_IN_USE) {
rio_dprintk(RIO_DEBUG_PARAM, "add_transmit: Packet has been stolen!");
}
- writew(readw(PortP->TxAdd) | PKT_IN_USE, PortP->TxAdd);
+ WWORD(*(ushort *) PortP->TxAdd, RWORD(*PortP->TxAdd) | PKT_IN_USE);
PortP->TxAdd = (PortP->TxAdd == PortP->TxEnd) ? PortP->TxStart : PortP->TxAdd + 1;
- writew(RIO_OFF(PortP->Caddr, PortP->TxAdd), &PortP->PhbP->tx_add);
+ WWORD(PortP->PhbP->tx_add, RIO_OFF(PortP->Caddr, PortP->TxAdd));
}
/****************************************
* Put a packet onto the end of the
* free list
****************************************/
-void put_free_end(struct Host *HostP, struct PKT __iomem *PktP)
+void put_free_end(HostP, PktP)
+struct Host *HostP;
+PKT *PktP;
{
- struct rio_free_list __iomem *tmp_pointer;
- unsigned short old_end, new_end;
+ FREE_LIST *tmp_pointer;
+ ushort old_end, new_end;
unsigned long flags;
rio_spin_lock_irqsave(&HostP->HostLock, flags);
*
************************************************/
- rio_dprintk(RIO_DEBUG_PFE, "put_free_end(PktP=%p)\n", PktP);
+ rio_dprintk(RIO_DEBUG_PFE, "put_free_end(PktP=%x)\n", (int) PktP);
- if ((old_end = readw(&HostP->ParmMapP->free_list_end)) != TPNULL) {
+ if ((old_end = RWORD(HostP->ParmMapP->free_list_end)) != TPNULL) {
new_end = RIO_OFF(HostP->Caddr, PktP);
- tmp_pointer = (struct rio_free_list __iomem *) RIO_PTR(HostP->Caddr, old_end);
- writew(new_end, &tmp_pointer->next);
- writew(old_end, &((struct rio_free_list __iomem *) PktP)->prev);
- writew(TPNULL, &((struct rio_free_list __iomem *) PktP)->next);
- writew(new_end, &HostP->ParmMapP->free_list_end);
+ tmp_pointer = (FREE_LIST *) RIO_PTR(HostP->Caddr, old_end);
+ WWORD(tmp_pointer->next, new_end);
+ WWORD(((FREE_LIST *) PktP)->prev, old_end);
+ WWORD(((FREE_LIST *) PktP)->next, TPNULL);
+ WWORD(HostP->ParmMapP->free_list_end, new_end);
} else { /* First packet on the free list this should never happen! */
rio_dprintk(RIO_DEBUG_PFE, "put_free_end(): This should never happen\n");
- writew(RIO_OFF(HostP->Caddr, PktP), &HostP->ParmMapP->free_list_end);
- tmp_pointer = (struct rio_free_list __iomem *) PktP;
- writew(TPNULL, &tmp_pointer->prev);
- writew(TPNULL, &tmp_pointer->next);
+ WWORD(HostP->ParmMapP->free_list_end, RIO_OFF(HostP->Caddr, PktP));
+ tmp_pointer = (FREE_LIST *) PktP;
+ WWORD(tmp_pointer->prev, TPNULL);
+ WWORD(tmp_pointer->next, TPNULL);
}
rio_dprintk(RIO_DEBUG_CMD, "Before unlock: %p\n", &HostP->HostLock);
rio_spin_unlock_irqrestore(&HostP->HostLock, flags);
** relevant packet, [having cleared the PKT_IN_USE bit]. If PKT_IN_USE is clear,
** then can_remove_receive() returns 0.
*/
-int can_remove_receive(struct PKT __iomem **PktP, struct Port *PortP)
+int can_remove_receive(PktP, PortP)
+PKT **PktP;
+struct Port *PortP;
{
- if (readw(PortP->RxRemove) & PKT_IN_USE) {
- *PktP = (struct PKT __iomem *) RIO_PTR(PortP->Caddr, readw(PortP->RxRemove) & ~PKT_IN_USE);
+ if (RWORD(*PortP->RxRemove) & PKT_IN_USE) {
+ *PktP = (PKT *) RIO_PTR(PortP->Caddr, RWORD(*PortP->RxRemove) & ~PKT_IN_USE);
return 1;
}
return 0;
** and then bump the pointers. Once the pointers get to the end, they must
** be wrapped back to the start.
*/
-void remove_receive(struct Port *PortP)
+void remove_receive(PortP)
+struct Port *PortP;
{
- writew(readw(PortP->RxRemove) & ~PKT_IN_USE, PortP->RxRemove);
+ WWORD(*PortP->RxRemove, RWORD(*PortP->RxRemove) & ~PKT_IN_USE);
PortP->RxRemove = (PortP->RxRemove == PortP->RxEnd) ? PortP->RxStart : PortP->RxRemove + 1;
- writew(RIO_OFF(PortP->Caddr, PortP->RxRemove), &PortP->PhbP->rx_remove);
+ WWORD(PortP->PhbP->rx_remove, RIO_OFF(PortP->Caddr, PortP->RxRemove));
}