summaryrefslogtreecommitdiff
path: root/device/chario.c
diff options
context:
space:
mode:
Diffstat (limited to 'device/chario.c')
-rw-r--r--device/chario.c108
1 files changed, 48 insertions, 60 deletions
diff --git a/device/chario.c b/device/chario.c
index d7c092e9..0e9dd70b 100644
--- a/device/chario.c
+++ b/device/chario.c
@@ -49,6 +49,7 @@
#include <device/io_req.h>
#include <device/ds_routines.h>
#include <device/device_reply.user.h>
+#include <device/chario.h>
#include <device/tty.h>
@@ -63,18 +64,6 @@ short ttlowat[NSPEEDS] =
125,125 };
/*
- * forward declarations
- */
-void queue_delayed_reply(
- queue_t, io_req_t, boolean_t (*)(io_req_t));
-void tty_output(struct tty *);
-void tty_flush(struct tty *, int);
-boolean_t char_open_done(io_req_t);
-boolean_t char_read_done(io_req_t);
-boolean_t char_write_done(io_req_t);
-void ttstart(struct tty *tp);
-
-/*
* Fake 'line discipline' switch for the benefit of old code
* that wants to call through it.
*/
@@ -91,9 +80,9 @@ struct ldisc_switch linesw[] = {
/*
* Sizes for input and output circular buffers.
*/
-int tty_inq_size = 4096; /* big nuf */
-int tty_outq_size = 2048; /* Must be bigger that tthiwat */
-int pdma_default = 1; /* turn pseudo dma on by default */
+const unsigned int tty_inq_size = 4096; /* big nuf */
+const unsigned int tty_outq_size = 2048; /* Must be bigger that tthiwat */
+boolean_t pdma_default = TRUE; /* turn pseudo dma on by default */
/*
* compute pseudo-dma tables
@@ -216,7 +205,7 @@ out:
boolean_t char_open_done(
io_req_t ior)
{
- register struct tty *tp = (struct tty *)ior->io_dev_ptr;
+ struct tty *tp = (struct tty *)ior->io_dev_ptr;
spl_t s = spltty();
simple_lock(&tp->t_lock);
@@ -256,13 +245,13 @@ boolean_t tty_close_open_reply(
* device needs to run on master.
*/
io_return_t char_write(
- register struct tty * tp,
- register io_req_t ior)
+ struct tty * tp,
+ io_req_t ior)
{
spl_t s;
- register int count;
- register char *data;
- vm_offset_t addr;
+ int count;
+ char *data;
+ vm_offset_t addr = 0;
io_return_t rc = D_SUCCESS;
data = ior->io_data;
@@ -347,10 +336,10 @@ out:
* May run on any CPU.
*/
boolean_t char_write_done(
- register io_req_t ior)
+ io_req_t ior)
{
- register struct tty *tp = (struct tty *)ior->io_dev_ptr;
- register spl_t s = spltty();
+ struct tty *tp = (struct tty *)ior->io_dev_ptr;
+ spl_t s = spltty();
simple_lock(&tp->t_lock);
if (tp->t_outq.c_cc > TTHIWAT(tp) ||
@@ -378,7 +367,7 @@ boolean_t char_write_done(
}
boolean_t tty_close_write_reply(
- register io_req_t ior)
+ io_req_t ior)
{
ior->io_residual = ior->io_count;
ior->io_error = D_DEVICE_DOWN;
@@ -392,8 +381,8 @@ boolean_t tty_close_write_reply(
* May run on any CPU - does not talk to device driver.
*/
io_return_t char_read(
- register struct tty *tp,
- register io_req_t ior)
+ struct tty *tp,
+ io_req_t ior)
{
spl_t s;
kern_return_t rc;
@@ -453,10 +442,10 @@ io_return_t char_read(
* May run on any CPU - does not talk to device driver.
*/
boolean_t char_read_done(
- register io_req_t ior)
+ io_req_t ior)
{
- register struct tty *tp = (struct tty *)ior->io_dev_ptr;
- register spl_t s = spltty();
+ struct tty *tp = (struct tty *)ior->io_dev_ptr;
+ spl_t s = spltty();
simple_lock(&tp->t_lock);
@@ -485,7 +474,7 @@ boolean_t char_read_done(
}
boolean_t tty_close_read_reply(
- register io_req_t ior)
+ io_req_t ior)
{
ior->io_residual = ior->io_count;
ior->io_error = D_DEVICE_DOWN;
@@ -499,9 +488,9 @@ boolean_t tty_close_read_reply(
* Iff modem control should run on master.
*/
void ttyclose(
- register struct tty *tp)
+ struct tty *tp)
{
- register io_req_t ior;
+ io_req_t ior;
/*
* Flush the read and write queues. Signal
@@ -537,11 +526,11 @@ void ttyclose(
*/
boolean_t
tty_queue_clean(
- queue_t q,
- ipc_port_t port,
- boolean_t (*routine)(io_req_t) )
+ queue_t q,
+ const ipc_port_t port,
+ boolean_t (*routine)(io_req_t) )
{
- register io_req_t ior;
+ io_req_t ior;
ior = (io_req_t)queue_first(q);
while (!queue_end(q, (queue_entry_t)ior)) {
@@ -563,11 +552,11 @@ tty_queue_clean(
*/
boolean_t
tty_portdeath(
- struct tty * tp,
- ipc_port_t port)
+ struct tty * tp,
+ const ipc_port_t port)
{
- register spl_t spl = spltty();
- register boolean_t result;
+ spl_t spl = spltty();
+ boolean_t result;
simple_lock(&tp->t_lock);
@@ -598,7 +587,7 @@ tty_portdeath(
* May run on any CPU.
*/
io_return_t tty_get_status(
- register struct tty *tp,
+ struct tty *tp,
dev_flavor_t flavor,
int * data, /* pointer to OUT array */
natural_t *count) /* out */
@@ -608,7 +597,7 @@ io_return_t tty_get_status(
switch (flavor) {
case TTY_STATUS:
{
- register struct tty_status *tsp =
+ struct tty_status *tsp =
(struct tty_status *) data;
if (*count < TTY_STATUS_COUNT)
@@ -644,7 +633,7 @@ io_return_t tty_get_status(
* device needs to run on master.
*/
io_return_t tty_set_status(
- register struct tty *tp,
+ struct tty *tp,
dev_flavor_t flavor,
int * data,
natural_t count)
@@ -654,7 +643,7 @@ io_return_t tty_set_status(
switch (flavor) {
case TTY_FLUSH:
{
- register int flags;
+ int flags;
if (count < TTY_FLUSH_COUNT)
return D_INVALID_OPERATION;
@@ -697,7 +686,7 @@ io_return_t tty_set_status(
case TTY_STATUS:
/* set special characters and speed */
{
- register struct tty_status *tsp;
+ struct tty_status *tsp;
if (count < TTY_STATUS_COUNT)
return D_INVALID_OPERATION;
@@ -752,9 +741,9 @@ void queue_delayed_reply(
* TTY containing queue must be locked (at spltty).
*/
void tty_queue_completion(
- register queue_t qh)
+ queue_t qh)
{
- register io_req_t ior;
+ io_req_t ior;
while ((ior = (io_req_t)dequeue_head(qh)) != 0) {
iodone(ior);
@@ -767,7 +756,7 @@ void tty_queue_completion(
* we can initialize the queues here.
*/
void ttychars(
- register struct tty *tp)
+ struct tty *tp)
{
if ((tp->t_flags & TS_INIT) == 0) {
/*
@@ -804,7 +793,7 @@ void ttychars(
* device needs to run on master.
*/
void tty_flush(
- register struct tty *tp,
+ struct tty *tp,
int rw)
{
if (rw & D_READ) {
@@ -827,9 +816,9 @@ void tty_flush(
* What if device runs on a different CPU?
*/
void ttrstrt(
- register struct tty *tp)
+ struct tty *tp)
{
- register spl_t s;
+ spl_t s;
s = spltty();
simple_lock(&tp->t_lock);
@@ -850,8 +839,7 @@ void ttrstrt(
* Called at spltty, tty already locked.
* Must be on master CPU if device runs on master.
*/
-void ttstart(tp)
- register struct tty *tp;
+void ttstart(struct tty *tp)
{
if ((tp->t_state & (TS_TIMEOUT|TS_TTSTOP|TS_BUSY)) == 0) {
/*
@@ -875,7 +863,7 @@ void ttstart(tp)
* Must be on master CPU if device runs on master.
*/
void tty_output(
- register struct tty *tp)
+ struct tty *tp)
{
if ((tp->t_state & (TS_TIMEOUT|TS_TTSTOP|TS_BUSY)) == 0) {
/*
@@ -897,9 +885,9 @@ void tty_output(
void ttypush(
void * _tp)
{
- register struct tty *tp = _tp;
+ struct tty *tp = _tp;
spl_t s = spltty();
- register int state;
+ int state;
simple_lock(&tp->t_lock);
@@ -918,7 +906,7 @@ void ttypush(
if (state & TS_MIN_TO_RCV)
{ /* a character was received */
tp->t_state = state & ~TS_MIN_TO_RCV;
- timeout(ttypush,tp,pdma_timeouts[tp->t_ispeed]);
+ timeout(ttypush, tp, pdma_timeouts[tp->t_ispeed]);
}
else
{
@@ -985,7 +973,7 @@ void ttyinput(
* into the future, but this involves making a timeout/untimeout
* call on every character.
*/
- register int ptime = pdma_timeouts[tp->t_ispeed];
+ int ptime = pdma_timeouts[tp->t_ispeed];
if (ptime > 0)
{
if ((tp->t_state & TS_MIN_TO) == 0)
@@ -1015,7 +1003,7 @@ void ttyinput_many(
* Do not want to overflow input queue
*/
if (tp->t_inq.c_cc < tp->t_inq.c_hog)
- count -= b_to_q( chars, count, &tp->t_inq);
+ count -= b_to_q(chars, count, &tp->t_inq);
tty_queue_completion(&tp->t_delayed_read);
}