summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorphk <phk@FreeBSD.org>2003-09-26 19:35:50 +0000
committerphk <phk@FreeBSD.org>2003-09-26 19:35:50 +0000
commit0c8bfb6d004a87cd501c13516a69b3ef59ed6c7c (patch)
treeb043c185e95f23eb60516b39361aaf3ed74ca525
parent62fcef349695e2b63bcd465cb80df34a2bb21b46 (diff)
downloadFreeBSD-src-0c8bfb6d004a87cd501c13516a69b3ef59ed6c7c.zip
FreeBSD-src-0c8bfb6d004a87cd501c13516a69b3ef59ed6c7c.tar.gz
OK, I messed up /dev/console with what I had hoped would be compat
code. Convert remaining console drivers and hope for the best.
-rw-r--r--sys/alpha/tlsb/zs_tlsb.c7
-rw-r--r--sys/dev/ofw/ofw_console.c8
-rw-r--r--sys/dev/sab/sab.c2
-rw-r--r--sys/dev/zs/zs.c2
-rw-r--r--sys/kern/tty_cons.c5
-rw-r--r--sys/pc98/cbus/sio.c37
-rw-r--r--sys/pc98/pc98/sio.c37
-rw-r--r--sys/sys/cons.h1
8 files changed, 52 insertions, 47 deletions
diff --git a/sys/alpha/tlsb/zs_tlsb.c b/sys/alpha/tlsb/zs_tlsb.c
index d2f89db..0852724 100644
--- a/sys/alpha/tlsb/zs_tlsb.c
+++ b/sys/alpha/tlsb/zs_tlsb.c
@@ -228,6 +228,7 @@ zs_cnattach(vm_offset_t base, vm_offset_t offset)
zs_console_addr = (caddr_t) ALPHA_PHYS_TO_K0SEG(base + offset);
sprintf(zs_consdev.cn_name, "zs0");
+ zs_consdev.cn_unit = 0;
zs_consdev.cn_pri = CN_NORMAL;
make_dev(&zs_cdevsw, 0, UID_ROOT, GID_WHEEL, 0600, "zs0");
cnadd(&zs_consdev);
@@ -238,7 +239,7 @@ int
zs_cngetc(struct consdev *cp)
{
int s = spltty();
- int c = zs_getc(zs_console_addr, minor(cp->cn_dev));
+ int c = zs_getc(zs_console_addr, cp->cn_unit);
splx(s);
return c;
}
@@ -247,7 +248,7 @@ int
zs_cncheckc(struct consdev *cp)
{
int s = spltty();
- int c = zs_maygetc(zs_console_addr, minor(cp->cn_dev));
+ int c = zs_maygetc(zs_console_addr, cp->cn_unit);
splx(s);
return c;
}
@@ -256,7 +257,7 @@ void
zs_cnputc(struct consdev *cp, int c)
{
int s = spltty();
- zs_putc(zs_console_addr, minor(cp->cn_dev), c);
+ zs_putc(zs_console_addr, cp->cn_unit, c);
splx(s);
}
diff --git a/sys/dev/ofw/ofw_console.c b/sys/dev/ofw/ofw_console.c
index b835dd1..920733a 100644
--- a/sys/dev/ofw/ofw_console.c
+++ b/sys/dev/ofw/ofw_console.c
@@ -92,15 +92,16 @@ cn_drvinit(void *unused)
{
phandle_t options;
char output[32];
+ dev_t dev;
- if (ofw_consdev.cn_dev != NULL) {
+ if (ofw_consdev.cn_pri != CN_DEAD) {
if ((options = OF_finddevice("/options")) == -1 ||
OF_getprop(options, "output-device", output,
sizeof(output)) == -1)
return;
- make_dev(&ofw_cdevsw, 0, UID_ROOT, GID_WHEEL, 0600, "%s",
+ dev = make_dev(&ofw_cdevsw, 0, UID_ROOT, GID_WHEEL, 0600, "%s",
output);
- make_dev_alias(ofw_consdev.cn_dev, "ofwcons");
+ make_dev_alias(dev, "ofwcons");
}
}
@@ -275,7 +276,6 @@ ofw_cons_probe(struct consdev *cp)
return;
}
- cp->cn_dev = NULL;
cp->cn_pri = CN_INTERNAL;
}
diff --git a/sys/dev/sab/sab.c b/sys/dev/sab/sab.c
index 4d86a5b..2eeb7f0 100644
--- a/sys/dev/sab/sab.c
+++ b/sys/dev/sab/sab.c
@@ -1111,7 +1111,7 @@ sab_cnprobe(struct consdev *cn)
cn->cn_pri = CN_DEAD;
else {
cn->cn_pri = CN_REMOTE;
- cn->cn_dev = sc->sc_si;
+ strcpy(cn->cn_name, devtoname(sc->sc_si));
cn->cn_tp = sc->sc_tty;
}
}
diff --git a/sys/dev/zs/zs.c b/sys/dev/zs/zs.c
index c797b4b..f3687ff 100644
--- a/sys/dev/zs/zs.c
+++ b/sys/dev/zs/zs.c
@@ -869,7 +869,7 @@ zs_cnprobe(struct consdev *cn)
cn->cn_pri = CN_DEAD;
else {
cn->cn_pri = CN_REMOTE;
- cn->cn_dev = sc->sc_si;
+ strcpy(cn->cn_name, devtoname(sc->sc_si));
cn->cn_tp = sc->sc_tty;
}
}
diff --git a/sys/kern/tty_cons.c b/sys/kern/tty_cons.c
index 10aeaff..a8221a4 100644
--- a/sys/kern/tty_cons.c
+++ b/sys/kern/tty_cons.c
@@ -208,11 +208,6 @@ cnadd(struct consdev *cn)
if (cnd->cnd_cn != NULL)
return (ENOMEM);
cnd->cnd_cn = cn;
- if (cn->cn_name[0] == '\0' && cn->cn_dev != NULL) {
- strcpy(cn->cn_name, devtoname(cn->cn_dev));
- /* XXX: it is unclear if/where this print might output */
- printf("NOTE: console \"%s\" didn't set name\n", cn->cn_name);
- }
if (cn->cn_name[0] == '\0') {
/* XXX: it is unclear if/where this print might output */
printf("WARNING: console at %p has no name\n", cn);
diff --git a/sys/pc98/cbus/sio.c b/sys/pc98/cbus/sio.c
index 620735c..2ca08cb 100644
--- a/sys/pc98/cbus/sio.c
+++ b/sys/pc98/cbus/sio.c
@@ -3963,6 +3963,18 @@ struct siocnstate {
u_char mcr;
};
+/*
+ * This is a function in order to not replicate "ttyd%d" more
+ * places than absolutely necessary.
+ */
+static void
+siocnset(struct consdev *cd, int unit)
+{
+
+ cd->cn_unit = unit;
+ sprintf(cd->cn_name, "ttyd%d", unit);
+}
+
#ifndef __alpha__
static speed_t siocngetspeed(Port_t, u_long rclk);
#endif
@@ -4185,7 +4197,7 @@ siocnprobe(cp)
splx(s);
if (COM_CONSOLE(flags) && !COM_LLCONSOLE(flags)) {
- cp->cn_dev = makedev(CDEV_MAJOR, unit);
+ siocnset(cp, unit);
cp->cn_pri = COM_FORCECONSOLE(flags)
|| boothowto & RB_SERIAL
? CN_REMOTE : CN_NORMAL;
@@ -4197,7 +4209,7 @@ siocnprobe(cp)
siogdbiobase = iobase;
siogdbunit = unit;
#if DDB > 0
- gdbconsdev.cn_dev = makedev(CDEV_MAJOR, unit);
+ siocnset(&gdbconsdev, unit);
gdb_arg = &gdbconsdev;
gdb_getc = siocngetc;
gdb_putc = siocnputc;
@@ -4219,7 +4231,7 @@ siocnprobe(cp)
printf("configuration file (currently sio only).\n");
siogdbiobase = siocniobase;
siogdbunit = siocnunit;
- gdbconsdev.cn_dev = makedev(CDEV_MAJOR, siocnunit);
+ siocnset(&gdbconsdev, siocnunit);
gdb_arg = &gdbconsdev;
gdb_getc = siocngetc;
gdb_putc = siocnputc;
@@ -4232,7 +4244,7 @@ static void
siocninit(cp)
struct consdev *cp;
{
- comconsole = DEV_TO_UNIT(cp->cn_dev);
+ comconsole = cp->cn_unit;
}
static void
@@ -4263,7 +4275,7 @@ siocnattach(port, speed)
siocnunit = unit;
comdefaultrate = speed;
sio_consdev.cn_pri = CN_NORMAL;
- sio_consdev.cn_dev = makedev(CDEV_MAJOR, unit);
+ siocnset(&sio_consdev, unit);
s = spltty();
@@ -4307,7 +4319,7 @@ siogdbattach(port, speed)
printf("sio%d: gdb debugging port\n", unit);
siogdbunit = unit;
#if DDB > 0
- gdbconsdev.cn_dev = makedev(CDEV_MAJOR, unit);
+ siocnset(&gdbconsdev, unit);
gdb_arg = &gdbconsdev;
gdb_getc = siocngetc;
gdb_putc = siocnputc;
@@ -4343,14 +4355,12 @@ static int
siocncheckc(struct consdev *cd)
{
int c;
- dev_t dev;
Port_t iobase;
int s;
struct siocnstate sp;
speed_t speed;
- dev = cd->cn_dev;
- if (minor(dev) == siocnunit) {
+ if (cd->cn_unit == siocnunit) {
iobase = siocniobase;
speed = comdefaultrate;
} else {
@@ -4368,19 +4378,16 @@ siocncheckc(struct consdev *cd)
return (c);
}
-
static int
siocngetc(struct consdev *cd)
{
int c;
- dev_t dev;
Port_t iobase;
int s;
struct siocnstate sp;
speed_t speed;
- dev = cd->cn_dev;
- if (minor(dev) == siocnunit) {
+ if (cd->cn_unit == siocnunit) {
iobase = siocniobase;
speed = comdefaultrate;
} else {
@@ -4402,13 +4409,11 @@ siocnputc(struct consdev *cd, int c)
{
int need_unlock;
int s;
- dev_t dev;
struct siocnstate sp;
Port_t iobase;
speed_t speed;
- dev = cd->cn_dev;
- if (minor(dev) == siocnunit) {
+ if (cd->cn_unit == siocnunit) {
iobase = siocniobase;
speed = comdefaultrate;
} else {
diff --git a/sys/pc98/pc98/sio.c b/sys/pc98/pc98/sio.c
index 620735c..2ca08cb 100644
--- a/sys/pc98/pc98/sio.c
+++ b/sys/pc98/pc98/sio.c
@@ -3963,6 +3963,18 @@ struct siocnstate {
u_char mcr;
};
+/*
+ * This is a function in order to not replicate "ttyd%d" more
+ * places than absolutely necessary.
+ */
+static void
+siocnset(struct consdev *cd, int unit)
+{
+
+ cd->cn_unit = unit;
+ sprintf(cd->cn_name, "ttyd%d", unit);
+}
+
#ifndef __alpha__
static speed_t siocngetspeed(Port_t, u_long rclk);
#endif
@@ -4185,7 +4197,7 @@ siocnprobe(cp)
splx(s);
if (COM_CONSOLE(flags) && !COM_LLCONSOLE(flags)) {
- cp->cn_dev = makedev(CDEV_MAJOR, unit);
+ siocnset(cp, unit);
cp->cn_pri = COM_FORCECONSOLE(flags)
|| boothowto & RB_SERIAL
? CN_REMOTE : CN_NORMAL;
@@ -4197,7 +4209,7 @@ siocnprobe(cp)
siogdbiobase = iobase;
siogdbunit = unit;
#if DDB > 0
- gdbconsdev.cn_dev = makedev(CDEV_MAJOR, unit);
+ siocnset(&gdbconsdev, unit);
gdb_arg = &gdbconsdev;
gdb_getc = siocngetc;
gdb_putc = siocnputc;
@@ -4219,7 +4231,7 @@ siocnprobe(cp)
printf("configuration file (currently sio only).\n");
siogdbiobase = siocniobase;
siogdbunit = siocnunit;
- gdbconsdev.cn_dev = makedev(CDEV_MAJOR, siocnunit);
+ siocnset(&gdbconsdev, siocnunit);
gdb_arg = &gdbconsdev;
gdb_getc = siocngetc;
gdb_putc = siocnputc;
@@ -4232,7 +4244,7 @@ static void
siocninit(cp)
struct consdev *cp;
{
- comconsole = DEV_TO_UNIT(cp->cn_dev);
+ comconsole = cp->cn_unit;
}
static void
@@ -4263,7 +4275,7 @@ siocnattach(port, speed)
siocnunit = unit;
comdefaultrate = speed;
sio_consdev.cn_pri = CN_NORMAL;
- sio_consdev.cn_dev = makedev(CDEV_MAJOR, unit);
+ siocnset(&sio_consdev, unit);
s = spltty();
@@ -4307,7 +4319,7 @@ siogdbattach(port, speed)
printf("sio%d: gdb debugging port\n", unit);
siogdbunit = unit;
#if DDB > 0
- gdbconsdev.cn_dev = makedev(CDEV_MAJOR, unit);
+ siocnset(&gdbconsdev, unit);
gdb_arg = &gdbconsdev;
gdb_getc = siocngetc;
gdb_putc = siocnputc;
@@ -4343,14 +4355,12 @@ static int
siocncheckc(struct consdev *cd)
{
int c;
- dev_t dev;
Port_t iobase;
int s;
struct siocnstate sp;
speed_t speed;
- dev = cd->cn_dev;
- if (minor(dev) == siocnunit) {
+ if (cd->cn_unit == siocnunit) {
iobase = siocniobase;
speed = comdefaultrate;
} else {
@@ -4368,19 +4378,16 @@ siocncheckc(struct consdev *cd)
return (c);
}
-
static int
siocngetc(struct consdev *cd)
{
int c;
- dev_t dev;
Port_t iobase;
int s;
struct siocnstate sp;
speed_t speed;
- dev = cd->cn_dev;
- if (minor(dev) == siocnunit) {
+ if (cd->cn_unit == siocnunit) {
iobase = siocniobase;
speed = comdefaultrate;
} else {
@@ -4402,13 +4409,11 @@ siocnputc(struct consdev *cd, int c)
{
int need_unlock;
int s;
- dev_t dev;
struct siocnstate sp;
Port_t iobase;
speed_t speed;
- dev = cd->cn_dev;
- if (minor(dev) == siocnunit) {
+ if (cd->cn_unit == siocnunit) {
iobase = siocniobase;
speed = comdefaultrate;
} else {
diff --git a/sys/sys/cons.h b/sys/sys/cons.h
index e4ecfb2..19f66f9 100644
--- a/sys/sys/cons.h
+++ b/sys/sys/cons.h
@@ -67,7 +67,6 @@ struct consdev {
cn_dbctl_t *cn_dbctl;
/* debugger control interface */
struct tty *cn_tp; /* tty structure for console device */
- dev_t cn_dev; /* major/minor of device */
short cn_pri; /* pecking order; the higher the better */
void *cn_arg; /* drivers method argument */
int cn_unit; /* some drivers prefer this */
OpenPOWER on IntegriCloud