Hi all,
I did some more investigations in the DECStation zs driver, and the
resulting slowdown of init.
This is the relevant code from drivers/tc/zs.[ch]:
/* Read Register 0 */
#define Tx_BUF_EMP 0x4 /* Tx Buffer empty */
/* Read Register 1 */
#define ALL_SNT 0x1 /* All sent */
/*
* rs_wait_until_sent() --- wait until the transmitter is empty
*/
static void rs_wait_until_sent(struct tty_struct *tty, int timeout)
{
....
while ((read_zsreg(info->zs_channel, 1) & ALL_SNT) == 0) {
current->state = TASK_INTERRUPTIBLE;
current->counter = 0; /* make us low-priority */
schedule_timeout(char_time);
if (signal_pending(current))
break;
if (timeout && ((orig_jiffies + timeout) < jiffies))
break;
}
current->state = TASK_RUNNING;
}
Now, look how NetBSD handles this:
#define SCC_RR0 0 /* status register */
#define SCC_RR1 1 /* special receive conditions */
/*
* Wait for transmitter to be not busy.
*/
do {
SCC_READ_REG(regs, line, SCC_RR0, value);
if (value & ZSRR0_TX_READY)
break;
DELAY(100);
} while (1);
So I changed the loop in rs_wait_until_sent to:
while ((read_zsreg(info->zs_channel, 0) & Tx_BUF_EMP) == 0) {
udelay(100);
}
or
while ((read_zsreg(info->zs_channel, 1) & ALL_SNT) == 0) {
udelay(100);
}
Both versions result in a much faster init, and no problems with the
console for now.
Any comments from the kernel-specialists?
Regards,
--
Karel van Houten
----------------------------------------------------------
The box said "Requires Windows 95 or better."
I can't understand why it won't work on my Linux computer.
----------------------------------------------------------
|