Commit bc9a5154 authored by Al Viro's avatar Al Viro Committed by Linus Torvalds

[PATCH] epca iomem annotations + several missing readw()

[originally sent to Alan, he had no problems with it]

 - iomem pointers marked as such
 - several direct dereferencings of such pointers replaced with read[bw]().
Signed-off-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 6da34a8d
...@@ -534,7 +534,7 @@ static void shutdown(struct channel *ch) ...@@ -534,7 +534,7 @@ static void shutdown(struct channel *ch)
unsigned long flags; unsigned long flags;
struct tty_struct *tty; struct tty_struct *tty;
struct board_chan *bc; struct board_chan __iomem *bc;
if (!(ch->asyncflags & ASYNC_INITIALIZED)) if (!(ch->asyncflags & ASYNC_INITIALIZED))
return; return;
...@@ -618,7 +618,7 @@ static int pc_write(struct tty_struct * tty, ...@@ -618,7 +618,7 @@ static int pc_write(struct tty_struct * tty,
struct channel *ch; struct channel *ch;
unsigned long flags; unsigned long flags;
int remain; int remain;
struct board_chan *bc; struct board_chan __iomem *bc;
/* ---------------------------------------------------------------- /* ----------------------------------------------------------------
pc_write is primarily called directly by the kernel routine pc_write is primarily called directly by the kernel routine
...@@ -685,7 +685,7 @@ static int pc_write(struct tty_struct * tty, ...@@ -685,7 +685,7 @@ static int pc_write(struct tty_struct * tty,
------------------------------------------------------------------- */ ------------------------------------------------------------------- */
dataLen = min(bytesAvailable, dataLen); dataLen = min(bytesAvailable, dataLen);
memcpy(ch->txptr + head, buf, dataLen); memcpy_toio(ch->txptr + head, buf, dataLen);
buf += dataLen; buf += dataLen;
head += dataLen; head += dataLen;
amountCopied += dataLen; amountCopied += dataLen;
...@@ -726,7 +726,7 @@ static int pc_write_room(struct tty_struct *tty) ...@@ -726,7 +726,7 @@ static int pc_write_room(struct tty_struct *tty)
struct channel *ch; struct channel *ch;
unsigned long flags; unsigned long flags;
unsigned int head, tail; unsigned int head, tail;
struct board_chan *bc; struct board_chan __iomem *bc;
remain = 0; remain = 0;
...@@ -773,7 +773,7 @@ static int pc_chars_in_buffer(struct tty_struct *tty) ...@@ -773,7 +773,7 @@ static int pc_chars_in_buffer(struct tty_struct *tty)
int remain; int remain;
unsigned long flags; unsigned long flags;
struct channel *ch; struct channel *ch;
struct board_chan *bc; struct board_chan __iomem *bc;
/* --------------------------------------------------------- /* ---------------------------------------------------------
verifyChannel returns the channel from the tty struct verifyChannel returns the channel from the tty struct
...@@ -830,7 +830,7 @@ static void pc_flush_buffer(struct tty_struct *tty) ...@@ -830,7 +830,7 @@ static void pc_flush_buffer(struct tty_struct *tty)
unsigned int tail; unsigned int tail;
unsigned long flags; unsigned long flags;
struct channel *ch; struct channel *ch;
struct board_chan *bc; struct board_chan __iomem *bc;
/* --------------------------------------------------------- /* ---------------------------------------------------------
verifyChannel returns the channel from the tty struct verifyChannel returns the channel from the tty struct
if it is valid. This serves as a sanity check. if it is valid. This serves as a sanity check.
...@@ -976,7 +976,7 @@ static int pc_open(struct tty_struct *tty, struct file * filp) ...@@ -976,7 +976,7 @@ static int pc_open(struct tty_struct *tty, struct file * filp)
struct channel *ch; struct channel *ch;
unsigned long flags; unsigned long flags;
int line, retval, boardnum; int line, retval, boardnum;
struct board_chan *bc; struct board_chan __iomem *bc;
unsigned int head; unsigned int head;
line = tty->index; line = tty->index;
...@@ -1041,7 +1041,7 @@ static int pc_open(struct tty_struct *tty, struct file * filp) ...@@ -1041,7 +1041,7 @@ static int pc_open(struct tty_struct *tty, struct file * filp)
ch->statusflags = 0; ch->statusflags = 0;
/* Save boards current modem status */ /* Save boards current modem status */
ch->imodem = bc->mstat; ch->imodem = readb(&bc->mstat);
/* ---------------------------------------------------------------- /* ----------------------------------------------------------------
Set receive head and tail ptrs to each other. This indicates Set receive head and tail ptrs to each other. This indicates
...@@ -1399,10 +1399,10 @@ static void post_fep_init(unsigned int crd) ...@@ -1399,10 +1399,10 @@ static void post_fep_init(unsigned int crd)
{ /* Begin post_fep_init */ { /* Begin post_fep_init */
int i; int i;
unsigned char *memaddr; void __iomem *memaddr;
struct global_data *gd; struct global_data __iomem *gd;
struct board_info *bd; struct board_info *bd;
struct board_chan *bc; struct board_chan __iomem *bc;
struct channel *ch; struct channel *ch;
int shrinkmem = 0, lowwater ; int shrinkmem = 0, lowwater ;
...@@ -1461,7 +1461,7 @@ static void post_fep_init(unsigned int crd) ...@@ -1461,7 +1461,7 @@ static void post_fep_init(unsigned int crd)
8 and 64 of these structures. 8 and 64 of these structures.
-------------------------------------------------------------------- */ -------------------------------------------------------------------- */
bc = (struct board_chan *)(memaddr + CHANSTRUCT); bc = memaddr + CHANSTRUCT;
/* ------------------------------------------------------------------- /* -------------------------------------------------------------------
The below assignment will set gd to point at the BEGINING of The below assignment will set gd to point at the BEGINING of
...@@ -1470,7 +1470,7 @@ static void post_fep_init(unsigned int crd) ...@@ -1470,7 +1470,7 @@ static void post_fep_init(unsigned int crd)
pointer begins at 0xd10. pointer begins at 0xd10.
---------------------------------------------------------------------- */ ---------------------------------------------------------------------- */
gd = (struct global_data *)(memaddr + GLOBAL); gd = memaddr + GLOBAL;
/* -------------------------------------------------------------------- /* --------------------------------------------------------------------
XEPORTS (address 0xc22) points at the number of channels the XEPORTS (address 0xc22) points at the number of channels the
...@@ -1493,6 +1493,7 @@ static void post_fep_init(unsigned int crd) ...@@ -1493,6 +1493,7 @@ static void post_fep_init(unsigned int crd)
for (i = 0; i < bd->numports; i++, ch++, bc++) { /* Begin for each port */ for (i = 0; i < bd->numports; i++, ch++, bc++) { /* Begin for each port */
unsigned long flags; unsigned long flags;
u16 tseg, rseg;
ch->brdchan = bc; ch->brdchan = bc;
ch->mailbox = gd; ch->mailbox = gd;
...@@ -1553,50 +1554,53 @@ static void post_fep_init(unsigned int crd) ...@@ -1553,50 +1554,53 @@ static void post_fep_init(unsigned int crd)
shrinkmem = 0; shrinkmem = 0;
} }
tseg = readw(&bc->tseg);
rseg = readw(&bc->rseg);
switch (bd->type) { switch (bd->type) {
case PCIXEM: case PCIXEM:
case PCIXRJ: case PCIXRJ:
case PCIXR: case PCIXR:
/* Cover all the 2MEG cards */ /* Cover all the 2MEG cards */
ch->txptr = memaddr + (((bc->tseg) << 4) & 0x1fffff); ch->txptr = memaddr + ((tseg << 4) & 0x1fffff);
ch->rxptr = memaddr + (((bc->rseg) << 4) & 0x1fffff); ch->rxptr = memaddr + ((rseg << 4) & 0x1fffff);
ch->txwin = FEPWIN | ((bc->tseg) >> 11); ch->txwin = FEPWIN | (tseg >> 11);
ch->rxwin = FEPWIN | ((bc->rseg) >> 11); ch->rxwin = FEPWIN | (rseg >> 11);
break; break;
case PCXEM: case PCXEM:
case EISAXEM: case EISAXEM:
/* Cover all the 32K windowed cards */ /* Cover all the 32K windowed cards */
/* Mask equal to window size - 1 */ /* Mask equal to window size - 1 */
ch->txptr = memaddr + (((bc->tseg) << 4) & 0x7fff); ch->txptr = memaddr + ((tseg << 4) & 0x7fff);
ch->rxptr = memaddr + (((bc->rseg) << 4) & 0x7fff); ch->rxptr = memaddr + ((rseg << 4) & 0x7fff);
ch->txwin = FEPWIN | ((bc->tseg) >> 11); ch->txwin = FEPWIN | (tseg >> 11);
ch->rxwin = FEPWIN | ((bc->rseg) >> 11); ch->rxwin = FEPWIN | (rseg >> 11);
break; break;
case PCXEVE: case PCXEVE:
case PCXE: case PCXE:
ch->txptr = memaddr + (((bc->tseg - bd->memory_seg) << 4) & 0x1fff); ch->txptr = memaddr + (((tseg - bd->memory_seg) << 4) & 0x1fff);
ch->txwin = FEPWIN | ((bc->tseg - bd->memory_seg) >> 9); ch->txwin = FEPWIN | ((tseg - bd->memory_seg) >> 9);
ch->rxptr = memaddr + (((bc->rseg - bd->memory_seg) << 4) & 0x1fff); ch->rxptr = memaddr + (((rseg - bd->memory_seg) << 4) & 0x1fff);
ch->rxwin = FEPWIN | ((bc->rseg - bd->memory_seg) >>9 ); ch->rxwin = FEPWIN | ((rseg - bd->memory_seg) >>9 );
break; break;
case PCXI: case PCXI:
case PC64XE: case PC64XE:
ch->txptr = memaddr + ((bc->tseg - bd->memory_seg) << 4); ch->txptr = memaddr + ((tseg - bd->memory_seg) << 4);
ch->rxptr = memaddr + ((bc->rseg - bd->memory_seg) << 4); ch->rxptr = memaddr + ((rseg - bd->memory_seg) << 4);
ch->txwin = ch->rxwin = 0; ch->txwin = ch->rxwin = 0;
break; break;
} /* End switch bd->type */ } /* End switch bd->type */
ch->txbufhead = 0; ch->txbufhead = 0;
ch->txbufsize = bc->tmax + 1; ch->txbufsize = readw(&bc->tmax) + 1;
ch->rxbufhead = 0; ch->rxbufhead = 0;
ch->rxbufsize = bc->rmax + 1; ch->rxbufsize = readw(&bc->rmax) + 1;
lowwater = ch->txbufsize >= 2000 ? 1024 : (ch->txbufsize / 2); lowwater = ch->txbufsize >= 2000 ? 1024 : (ch->txbufsize / 2);
...@@ -1718,11 +1722,11 @@ static void epcapoll(unsigned long ignored) ...@@ -1718,11 +1722,11 @@ static void epcapoll(unsigned long ignored)
static void doevent(int crd) static void doevent(int crd)
{ /* Begin doevent */ { /* Begin doevent */
void *eventbuf; void __iomem *eventbuf;
struct channel *ch, *chan0; struct channel *ch, *chan0;
static struct tty_struct *tty; static struct tty_struct *tty;
struct board_info *bd; struct board_info *bd;
struct board_chan *bc; struct board_chan __iomem *bc;
unsigned int tail, head; unsigned int tail, head;
int event, channel; int event, channel;
int mstat, lstat; int mstat, lstat;
...@@ -1817,7 +1821,7 @@ static void doevent(int crd) ...@@ -1817,7 +1821,7 @@ static void doevent(int crd)
static void fepcmd(struct channel *ch, int cmd, int word_or_byte, static void fepcmd(struct channel *ch, int cmd, int word_or_byte,
int byte2, int ncmds, int bytecmd) int byte2, int ncmds, int bytecmd)
{ /* Begin fepcmd */ { /* Begin fepcmd */
unchar *memaddr; unchar __iomem *memaddr;
unsigned int head, cmdTail, cmdStart, cmdMax; unsigned int head, cmdTail, cmdStart, cmdMax;
long count; long count;
int n; int n;
...@@ -2000,7 +2004,7 @@ static void epcaparam(struct tty_struct *tty, struct channel *ch) ...@@ -2000,7 +2004,7 @@ static void epcaparam(struct tty_struct *tty, struct channel *ch)
unsigned int cmdHead; unsigned int cmdHead;
struct termios *ts; struct termios *ts;
struct board_chan *bc; struct board_chan __iomem *bc;
unsigned mval, hflow, cflag, iflag; unsigned mval, hflow, cflag, iflag;
bc = ch->brdchan; bc = ch->brdchan;
...@@ -2010,7 +2014,7 @@ static void epcaparam(struct tty_struct *tty, struct channel *ch) ...@@ -2010,7 +2014,7 @@ static void epcaparam(struct tty_struct *tty, struct channel *ch)
ts = tty->termios; ts = tty->termios;
if ((ts->c_cflag & CBAUD) == 0) { /* Begin CBAUD detected */ if ((ts->c_cflag & CBAUD) == 0) { /* Begin CBAUD detected */
cmdHead = readw(&bc->rin); cmdHead = readw(&bc->rin);
bc->rout = cmdHead; writew(cmdHead, &bc->rout);
cmdHead = readw(&bc->tin); cmdHead = readw(&bc->tin);
/* Changing baud in mid-stream transmission can be wonderful */ /* Changing baud in mid-stream transmission can be wonderful */
/* --------------------------------------------------------------- /* ---------------------------------------------------------------
...@@ -2116,7 +2120,7 @@ static void receive_data(struct channel *ch) ...@@ -2116,7 +2120,7 @@ static void receive_data(struct channel *ch)
unchar *rptr; unchar *rptr;
struct termios *ts = NULL; struct termios *ts = NULL;
struct tty_struct *tty; struct tty_struct *tty;
struct board_chan *bc; struct board_chan __iomem *bc;
int dataToRead, wrapgap, bytesAvailable; int dataToRead, wrapgap, bytesAvailable;
unsigned int tail, head; unsigned int tail, head;
unsigned int wrapmask; unsigned int wrapmask;
...@@ -2154,7 +2158,7 @@ static void receive_data(struct channel *ch) ...@@ -2154,7 +2158,7 @@ static void receive_data(struct channel *ch)
--------------------------------------------------------------------- */ --------------------------------------------------------------------- */
if (!tty || !ts || !(ts->c_cflag & CREAD)) { if (!tty || !ts || !(ts->c_cflag & CREAD)) {
bc->rout = head; writew(head, &bc->rout);
return; return;
} }
...@@ -2270,7 +2274,7 @@ static int info_ioctl(struct tty_struct *tty, struct file * file, ...@@ -2270,7 +2274,7 @@ static int info_ioctl(struct tty_struct *tty, struct file * file,
static int pc_tiocmget(struct tty_struct *tty, struct file *file) static int pc_tiocmget(struct tty_struct *tty, struct file *file)
{ {
struct channel *ch = (struct channel *) tty->driver_data; struct channel *ch = (struct channel *) tty->driver_data;
struct board_chan *bc; struct board_chan __iomem *bc;
unsigned int mstat, mflag = 0; unsigned int mstat, mflag = 0;
unsigned long flags; unsigned long flags;
...@@ -2351,7 +2355,7 @@ static int pc_ioctl(struct tty_struct *tty, struct file * file, ...@@ -2351,7 +2355,7 @@ static int pc_ioctl(struct tty_struct *tty, struct file * file,
unsigned long flags; unsigned long flags;
unsigned int mflag, mstat; unsigned int mflag, mstat;
unsigned char startc, stopc; unsigned char startc, stopc;
struct board_chan *bc; struct board_chan __iomem *bc;
struct channel *ch = (struct channel *) tty->driver_data; struct channel *ch = (struct channel *) tty->driver_data;
void __user *argp = (void __user *)arg; void __user *argp = (void __user *)arg;
...@@ -2633,7 +2637,7 @@ static void pc_start(struct tty_struct *tty) ...@@ -2633,7 +2637,7 @@ static void pc_start(struct tty_struct *tty)
spin_lock_irqsave(&epca_lock, flags); spin_lock_irqsave(&epca_lock, flags);
/* Just in case output was resumed because of a change in Digi-flow */ /* Just in case output was resumed because of a change in Digi-flow */
if (ch->statusflags & TXSTOPPED) { /* Begin transmit resume requested */ if (ch->statusflags & TXSTOPPED) { /* Begin transmit resume requested */
struct board_chan *bc; struct board_chan __iomem *bc;
globalwinon(ch); globalwinon(ch);
bc = ch->brdchan; bc = ch->brdchan;
if (ch->statusflags & LOWWAIT) if (ch->statusflags & LOWWAIT)
...@@ -2727,7 +2731,7 @@ void digi_send_break(struct channel *ch, int msec) ...@@ -2727,7 +2731,7 @@ void digi_send_break(struct channel *ch, int msec)
static void setup_empty_event(struct tty_struct *tty, struct channel *ch) static void setup_empty_event(struct tty_struct *tty, struct channel *ch)
{ /* Begin setup_empty_event */ { /* Begin setup_empty_event */
struct board_chan *bc = ch->brdchan; struct board_chan __iomem *bc = ch->brdchan;
globalwinon(ch); globalwinon(ch);
ch->statusflags |= EMPTYWAIT; ch->statusflags |= EMPTYWAIT;
......
...@@ -128,17 +128,17 @@ struct channel ...@@ -128,17 +128,17 @@ struct channel
unsigned long c_cflag; unsigned long c_cflag;
unsigned long c_lflag; unsigned long c_lflag;
unsigned long c_oflag; unsigned long c_oflag;
unsigned char *txptr; unsigned char __iomem *txptr;
unsigned char *rxptr; unsigned char __iomem *rxptr;
unsigned char *tmp_buf; unsigned char *tmp_buf;
struct board_info *board; struct board_info *board;
struct board_chan *brdchan; struct board_chan __iomem *brdchan;
struct digi_struct digiext; struct digi_struct digiext;
struct tty_struct *tty; struct tty_struct *tty;
wait_queue_head_t open_wait; wait_queue_head_t open_wait;
wait_queue_head_t close_wait; wait_queue_head_t close_wait;
struct work_struct tqueue; struct work_struct tqueue;
struct global_data *mailbox; struct global_data __iomem *mailbox;
}; };
struct board_info struct board_info
...@@ -149,8 +149,8 @@ struct board_info ...@@ -149,8 +149,8 @@ struct board_info
unsigned short numports; unsigned short numports;
unsigned long port; unsigned long port;
unsigned long membase; unsigned long membase;
unsigned char __iomem *re_map_port; void __iomem *re_map_port;
unsigned char *re_map_membase; void __iomem *re_map_membase;
unsigned long memory_seg; unsigned long memory_seg;
void ( * memwinon ) (struct board_info *, unsigned int) ; void ( * memwinon ) (struct board_info *, unsigned int) ;
void ( * memwinoff ) (struct board_info *, unsigned int) ; void ( * memwinoff ) (struct board_info *, unsigned int) ;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment