Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch/hp300/dev Update hardware drivers with console atta...
details: https://anonhg.NetBSD.org/src/rev/cba785f85892
branches: trunk
changeset: 519271:cba785f85892
user: gmcgarry <gmcgarry%NetBSD.org@localhost>
date: Fri Dec 14 08:34:27 2001 +0000
description:
Update hardware drivers with console attachments to the new console
attachment interface.
diffstat:
sys/arch/hp300/dev/apci.c | 80 ++++++--------
sys/arch/hp300/dev/dca.c | 133 ++++++++----------------
sys/arch/hp300/dev/dcm.c | 138 +++++++++----------------
sys/arch/hp300/dev/dio.c | 7 +-
sys/arch/hp300/dev/grf_dv.c | 147 +++++++--------------------
sys/arch/hp300/dev/grf_gb.c | 148 +++++++--------------------
sys/arch/hp300/dev/grf_hy.c | 147 ++++++--------------------
sys/arch/hp300/dev/grf_rb.c | 148 +++++++--------------------
sys/arch/hp300/dev/grf_subr.c | 9 +-
sys/arch/hp300/dev/grf_tc.c | 223 ++++++++++++-----------------------------
sys/arch/hp300/dev/grfvar.h | 3 +-
sys/arch/hp300/dev/hil.c | 97 ++++++++++--------
sys/arch/hp300/dev/hilvar.h | 12 +-
13 files changed, 414 insertions(+), 878 deletions(-)
diffs (truncated from 1984 to 300 lines):
diff -r 910cb0f160b0 -r cba785f85892 sys/arch/hp300/dev/apci.c
--- a/sys/arch/hp300/dev/apci.c Fri Dec 14 08:33:54 2001 +0000
+++ b/sys/arch/hp300/dev/apci.c Fri Dec 14 08:34:27 2001 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: apci.c,v 1.12 2001/06/12 15:17:18 wiz Exp $ */
+/* $NetBSD: apci.c,v 1.13 2001/12/14 08:34:27 gmcgarry Exp $ */
/*-
* Copyright (c) 1996, 1997, 1999 The NetBSD Foundation, Inc.
@@ -188,11 +188,14 @@
int apciconsinit; /* has been initialized */
int apcimajor; /* our major number */
-void apcicnprobe __P((struct consdev *));
-void apcicninit __P((struct consdev *));
+int apcicnattach __P((bus_space_tag_t, bus_addr_t, int));
int apcicngetc __P((dev_t));
void apcicnputc __P((dev_t, int));
+static struct consdev apci_cons = {
+ NULL, NULL, apcicngetc, apcicnputc, nullcnpollc, NULL, NODEV, CN_REMOTE
+};
+
int
apcimatch(parent, match, aux)
@@ -887,59 +890,44 @@
* The following routines are required for the APCI to act as the console.
*/
-void
-apcicnprobe(cp)
- struct consdev *cp;
+int
+apcicnattach(bus_space_tag_t bst, bus_addr_t addr, int scode)
{
+ bus_space_handle_t bsh;
+ caddr_t va;
+ struct apciregs *apci;
- /* locate the major number */
- for (apcimajor = 0; apcimajor < nchrdev; apcimajor++)
- if (cdevsw[apcimajor].d_open == apciopen)
- break;
+ if (machineid != HP_425 || mmuid != MMUID_425_E)
+ return (1);
- /* initialize the required fields */
- cp->cn_dev = makedev(apcimajor, 0); /* XXX */
- cp->cn_pri = CN_DEAD;
+ if (bus_space_map(bst, addr, DIOCSIZE, 0, &bsh))
+ return (1);
+
+ va = bus_space_vaddr(bst, bsh);
+ apci = (struct apciregs *)va;
- /* Abort early if console is already forced. */
- if (conforced)
- return;
+ apciinit(apci, apcidefaultrate);
+ apciconsinit = 1;
+ apci_cn = apci;
+
+ /* locate the major number */
+ for (apcimajor = 0; apcimajor < nchrdev; apcimajor++)
+ if (cdevsw[apcimajor].d_open == apciopen)
+ break;
- /*
- * The APCI can only be a console on a 425e; on other 4xx
- * models, the "first" serial port is mapped to the DCA
- * at select code 9. See frodo.c for the autoconfiguration
- * version of this check.
- */
- if (machineid != HP_425 || mmuid != MMUID_425_E)
- return;
+ /* initialize required fields */
+ cn_tab = &apci_cons;
+ cn_tab->cn_dev = makedev(apcimajor, 0);
-#ifdef APCI_FORCE_CONSOLE
- cp->cn_pri = CN_REMOTE;
- conforced = 1;
- conscode = -2; /* XXX */
-#else
- cp->cn_pri = CN_NORMAL;
+#ifdef KGDB
+ /* XXX this needs to be fixed. */
+ if (major(kgdb_dev) == 1) /* XXX */
+ kgdb_dev = makedev(apcimajor, minor(kgdb_dev));
#endif
- /*
- * If our priority is higher than the currently-remembered
- * console, install ourselves.
- */
- if (((cn_tab == NULL) || (cp->cn_pri > cn_tab->cn_pri)) || conforced)
- cn_tab = cp;
+ return (0);
}
-/* ARGSUSED */
-void
-apcicninit(cp)
- struct consdev *cp;
-{
-
- apci_cn = (struct apciregs *)IIOV(FRODO_BASE + FRODO_APCI_OFFSET(1));
- apciinit(apci_cn, apcidefaultrate);
- apciconsinit = 1;
-}
/* ARGSUSED */
int
diff -r 910cb0f160b0 -r cba785f85892 sys/arch/hp300/dev/dca.c
--- a/sys/arch/hp300/dev/dca.c Fri Dec 14 08:33:54 2001 +0000
+++ b/sys/arch/hp300/dev/dca.c Fri Dec 14 08:34:27 2001 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: dca.c,v 1.44 2001/06/12 15:17:18 wiz Exp $ */
+/* $NetBSD: dca.c,v 1.45 2001/12/14 08:34:27 gmcgarry Exp $ */
/*-
* Copyright (c) 1996, 1997 The NetBSD Foundation, Inc.
@@ -98,6 +98,7 @@
#include <sys/device.h>
#include <machine/autoconf.h>
+#include <machine/bus.h>
#include <machine/cpu.h>
#include <machine/intr.h>
@@ -134,9 +135,6 @@
extern struct cfdriver dca_cd;
-int dcadefaultrate = TTYDEF_SPEED;
-int dcamajor;
-
cdev_decl(dca);
int dcaintr __P((void *));
@@ -149,17 +147,22 @@
int dcamctl __P((struct dca_softc *, int, int));
void dcainit __P((struct dcadevice *, int));
-int dca_console_scan __P((int, caddr_t, void *));
-void dcacnprobe __P((struct consdev *));
-void dcacninit __P((struct consdev *));
+int dcacnattach __P((bus_space_tag_t, bus_addr_t, int));
int dcacngetc __P((dev_t));
void dcacnputc __P((dev_t, int));
/*
* Stuff for DCA console support.
*/
-static struct dcadevice *dca_cn = NULL; /* pointer to hardware */
-static int dcaconsinit; /* has been initialized */
+
+static int dcadefaultrate = TTYDEF_SPEED;
+static struct consdev dca_cons = {
+ NULL, NULL, dcacngetc, dcacnputc, nullcnpollc, NULL, NODEV, CN_REMOTE
+};
+static int dcamajor;
+static struct dcadevice *dca_cn = NULL; /* pointer to hardware */
+static int dcaconsinit; /* has been initialized */
+static int dcaconscode;
struct speedtab dcaspeedtab[] = {
{ 0, 0 },
@@ -232,8 +235,8 @@
int scode = da->da_scode;
int ipl;
- if (scode == conscode) {
- dca = (struct dcadevice *)conaddr;
+ if (scode == dcaconscode) {
+ dca = dca_cn;
sc->sc_flags |= DCA_ISCONSOLE;
DELAY(100000);
@@ -974,96 +977,52 @@
*/
int
-dca_console_scan(scode, va, arg)
- int scode;
- caddr_t va;
- void *arg;
+dcacnattach(bus_space_tag_t bst, bus_addr_t addr, int scode)
{
- struct dcadevice *dca = (struct dcadevice *)va;
- struct consdev *cp = arg;
- u_char *dioiidev;
- int force = 0, pri;
-
- switch (dca->dca_id) {
- case DCAID0:
- case DCAID1:
- pri = CN_NORMAL;
- break;
+ bus_space_handle_t bsh;
+ caddr_t va;
+ struct dcadevice *dca;
- case DCAREMID0:
- case DCAREMID1:
- pri = CN_REMOTE;
- break;
-
- default:
- return (0);
- }
+ if (bus_space_map(bst, addr, DIOCSIZE, 0, &bsh))
+ return (1);
-#ifdef CONSCODE
- /*
- * Raise our priority, if appropriate.
- */
- if (scode == CONSCODE) {
- pri = CN_REMOTE;
- force = conforced = 1;
- }
-#endif
+ va = bus_space_vaddr(bst, bsh);
+ dca = (struct dcadevice *)va;
- /* Only raise priority. */
- if (pri > cp->cn_pri)
- cp->cn_pri = pri;
-
- /*
- * If our priority is higher than the currently-remembered
- * console, stash our priority, for the benefit of dcacninit().
- */
- if (((cn_tab == NULL) || (cp->cn_pri > cn_tab->cn_pri)) || force) {
- cn_tab = cp;
- if (scode >= 132) {
- dioiidev = (u_char *)va;
- return ((dioiidev[0x101] + 1) * 0x100000);
- }
- return (DIOCSIZE);
- }
- return (0);
-}
+ switch (dca->dca_id) {
+#ifdef CONSCODE
+ case DCAID0:
+ case DCAID1:
+#endif
+ case DCAREMID0:
+ case DCAREMID1:
+ break;
+ default:
+ bus_space_unmap(bst, bsh, DIOCSIZE);
+ return (1);
+ }
-void
-dcacnprobe(cp)
- struct consdev *cp;
-{
-
- /* locate the major number */
- for (dcamajor = 0; dcamajor < nchrdev; dcamajor++)
- if (cdevsw[dcamajor].d_open == dcaopen)
- break;
+ dcainit(dca, dcadefaultrate);
+ dcaconsinit = 1;
+ dcaconscode = scode;
+ dca_cn = dca;
- /* initialize required fields */
- cp->cn_dev = makedev(dcamajor, 0); /* XXX */
- cp->cn_pri = CN_DEAD;
+ /* locate the major number */
+ for (dcamajor = 0; dcamajor < nchrdev; dcamajor++)
+ if (cdevsw[dcamajor].d_open == dcaopen)
+ break;
- /* Abort early if console is already forced. */
- if (conforced)
- return;
-
- console_scan(dca_console_scan, cp);
+ /* initialize required fields */
+ cn_tab = &dca_cons;
+ cn_tab->cn_dev = makedev(dcamajor, 0);
#ifdef KGDB
/* XXX this needs to be fixed. */
if (major(kgdb_dev) == 1) /* XXX */
kgdb_dev = makedev(dcamajor, minor(kgdb_dev));
#endif
-}
-/* ARGSUSED */
-void
-dcacninit(cp)
- struct consdev *cp;
Home |
Main Index |
Thread Index |
Old Index