Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch/newsmips - Define and use struct hb_attach_args rat...
details: https://anonhg.NetBSD.org/src/rev/300306d8fc57
branches: trunk
changeset: 546949:300306d8fc57
user: tsutsui <tsutsui%NetBSD.org@localhost>
date: Fri May 09 13:36:39 2003 +0000
description:
- Define and use struct hb_attach_args rather than struct confargs
for hb devices.
- Move declarations for hb functions and macros to dev/hbvar.h.
- Define and use hb_badaddr() macro for hb devices.
- Declare news3400_badaddr() in machine/cpu.h rather than machine/autoconf.h.
- Remove unused stuff from machine/autoconf.h.
diffstat:
sys/arch/newsmips/dev/clock_hb.c | 9 +++---
sys/arch/newsmips/dev/fb.c | 11 ++++---
sys/arch/newsmips/dev/hb.c | 27 +++++++++++---------
sys/arch/newsmips/dev/hbvar.h | 46 +++++++++++++++++++++++++++++++++++
sys/arch/newsmips/dev/if_le.c | 19 +++++++------
sys/arch/newsmips/dev/kb_hb.c | 19 +++++++++-----
sys/arch/newsmips/dev/ms_hb.c | 18 +++++++++----
sys/arch/newsmips/dev/sc_wrap.c | 10 ++++---
sys/arch/newsmips/dev/zs_hb.c | 17 ++++++------
sys/arch/newsmips/include/autoconf.h | 15 +----------
sys/arch/newsmips/include/cpu.h | 3 +-
sys/arch/newsmips/newsmips/mainbus.c | 5 +---
sys/arch/newsmips/newsmips/news3400.c | 5 ++-
13 files changed, 128 insertions(+), 76 deletions(-)
diffs (truncated from 567 to 300 lines):
diff -r 91bf57223127 -r 300306d8fc57 sys/arch/newsmips/dev/clock_hb.c
--- a/sys/arch/newsmips/dev/clock_hb.c Fri May 09 12:45:01 2003 +0000
+++ b/sys/arch/newsmips/dev/clock_hb.c Fri May 09 13:36:39 2003 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: clock_hb.c,v 1.3 2002/10/02 04:27:52 thorpej Exp $ */
+/* $NetBSD: clock_hb.c,v 1.4 2003/05/09 13:36:39 tsutsui Exp $ */
/*-
* Copyright (C) 1999 Tsubai Masanari. All rights reserved.
@@ -33,10 +33,11 @@
#include <dev/clock_subr.h>
#include <machine/adrsmap.h>
-#include <machine/autoconf.h>
#include <newsmips/newsmips/clockvar.h>
#include <newsmips/newsmips/clockreg.h>
+#include <newsmips/dev/hbvar.h>
+
struct clock_hb_softc {
struct device sc_dev;
u_int32_t *sc_addr;
@@ -62,9 +63,9 @@
struct cfdata *match;
void *aux;
{
- struct confargs *ca = aux;
+ struct hb_attach_args *ha = aux;
- if (strcmp(ca->ca_name, "mkclock") != 0)
+ if (strcmp(ha->ha_name, "mkclock") != 0)
return 0;
return 1;
diff -r 91bf57223127 -r 300306d8fc57 sys/arch/newsmips/dev/fb.c
--- a/sys/arch/newsmips/dev/fb.c Fri May 09 12:45:01 2003 +0000
+++ b/sys/arch/newsmips/dev/fb.c Fri May 09 13:36:39 2003 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: fb.c,v 1.15 2003/04/19 14:56:06 tsutsui Exp $ */
+/* $NetBSD: fb.c,v 1.16 2003/05/09 13:36:39 tsutsui Exp $ */
/*-
* Copyright (c) 2000 Tsubai Masanari. All rights reserved.
@@ -35,7 +35,8 @@
#include <uvm/uvm_extern.h>
#include <machine/adrsmap.h>
-#include <machine/autoconf.h>
+
+#include <newsmips/dev/hbvar.h>
#include <dev/wscons/wsconsio.h>
#include <dev/wscons/wsdisplayvar.h>
@@ -111,12 +112,12 @@
struct cfdata *match;
void *aux;
{
- struct confargs *ca = aux;
+ struct hb_attach_args *ha = aux;
- if (strcmp(ca->ca_name, "fb") != 0)
+ if (strcmp(ha->ha_name, "fb") != 0)
return 0;
- if (badaddr(NWB253_CTLREG, 2) || badaddr(NWB253_CRTREG, 2))
+ if (hb_badaddr(NWB253_CTLREG, 2) || hb_badaddr(NWB253_CRTREG, 2))
return 0;
if ((*(volatile u_short *)NWB253_CTLREG & 7) != 4)
return 0;
diff -r 91bf57223127 -r 300306d8fc57 sys/arch/newsmips/dev/hb.c
--- a/sys/arch/newsmips/dev/hb.c Fri May 09 12:45:01 2003 +0000
+++ b/sys/arch/newsmips/dev/hb.c Fri May 09 13:36:39 2003 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: hb.c,v 1.10 2003/01/01 01:55:42 thorpej Exp $ */
+/* $NetBSD: hb.c,v 1.11 2003/05/09 13:36:40 tsutsui Exp $ */
#include <sys/param.h>
#include <sys/systm.h>
@@ -6,11 +6,12 @@
#include <machine/autoconf.h>
+#include <newsmips/dev/hbvar.h>
+
static int hb_match __P((struct device *, struct cfdata *, void *));
static void hb_attach __P((struct device *, struct device *, void *));
static int hb_search __P((struct device *, struct cfdata *, void *));
static int hb_print __P((void *, const char *));
-void hb_intr_dispatch __P((int)); /* XXX */
CFATTACH_DECL(hb, sizeof(struct device),
hb_match, hb_attach, NULL, NULL);
@@ -45,10 +46,11 @@
struct device *self;
void *aux;
{
- struct confargs *ca = aux;
+ struct hb_attach_args ha;
printf("\n");
- config_search(hb_search, self, ca);
+ memset(&ha, 0, sizeof(ha));
+ config_search(hb_search, self, &ha);
}
static int
@@ -57,13 +59,14 @@
struct cfdata *cf;
void *aux;
{
- struct confargs *ca = aux;
+ struct hb_attach_args *ha = aux;
- ca->ca_addr = cf->cf_addr;
- ca->ca_name = cf->cf_name;
+ ha->ha_name = cf->cf_name;
+ ha->ha_addr = cf->cf_addr;
+ ha->ha_level = cf->cf_level;
- if (config_match(parent, cf, ca) > 0)
- config_attach(parent, cf, ca, hb_print);
+ if (config_match(parent, cf, ha) > 0)
+ config_attach(parent, cf, ha, hb_print);
return 0;
}
@@ -77,14 +80,14 @@
void *args;
const char *name;
{
- struct confargs *ca = args;
+ struct hb_attach_args *ha = args;
/* Be quiet about empty HB locations. */
if (name)
return QUIET;
- if (ca->ca_addr != -1)
- aprint_normal(" addr 0x%x", ca->ca_addr);
+ if (ha->ha_addr != -1)
+ aprint_normal(" addr 0x%x", ha->ha_addr);
return UNCONF;
}
diff -r 91bf57223127 -r 300306d8fc57 sys/arch/newsmips/dev/hbvar.h
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/arch/newsmips/dev/hbvar.h Fri May 09 13:36:39 2003 +0000
@@ -0,0 +1,46 @@
+/* $NetBSD: hbvar.h,v 1.1 2003/05/09 13:36:40 tsutsui Exp $ */
+
+/*
+ * Copyright (C) 2003 Izumi Tsutsui. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. The name of the author may not be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/* Shorthand for locators. */
+#include "locators.h"
+#define cf_addr cf_loc[HBCF_ADDR]
+#define cf_level cf_loc[HBCF_LEVEL]
+
+/*
+ * Structure used to attach hb devices.
+ */
+struct hb_attach_args {
+ const char *ha_name; /* name of device */
+ int ha_addr; /* device address */
+ int ha_level; /* interrupt level */
+};
+
+#define hb_badaddr news3400_badaddr
+
+void *hb_intr_establish(int, int, int (*)(void *), void *);
+void hb_intr_dispatch(int);
diff -r 91bf57223127 -r 300306d8fc57 sys/arch/newsmips/dev/if_le.c
--- a/sys/arch/newsmips/dev/if_le.c Fri May 09 12:45:01 2003 +0000
+++ b/sys/arch/newsmips/dev/if_le.c Fri May 09 13:36:39 2003 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: if_le.c,v 1.9 2002/10/02 04:27:52 thorpej Exp $ */
+/* $NetBSD: if_le.c,v 1.10 2003/05/09 13:36:40 tsutsui Exp $ */
/*-
* Copyright (c) 1996 The NetBSD Foundation, Inc.
@@ -55,7 +55,6 @@
#include <netinet/if_inarp.h>
#endif
-#include <machine/autoconf.h>
#include <machine/cpu.h>
#include <machine/adrsmap.h>
@@ -64,6 +63,8 @@
#include <dev/ic/am7990reg.h>
#include <dev/ic/am7990var.h>
+#include <newsmips/dev/hbvar.h>
+
/*
* LANCE registers.
* The real stuff is in dev/ic/am7990reg.h
@@ -134,12 +135,12 @@
struct cfdata *cf;
void *aux;
{
- struct confargs *ca = aux;
+ struct hb_attach_args *ha = aux;
- if (strcmp(ca->ca_name, "le"))
+ if (strcmp(ha->ha_name, "le"))
return 0;
- if (badaddr((void *)cf->cf_addr, 1))
+ if (hb_badaddr((void *)ha->ha_addr, 1)) /* XXX */
return 0;
return 1;
@@ -152,18 +153,18 @@
{
struct le_softc *lesc = (struct le_softc *)self;
struct lance_softc *sc = &lesc->sc_am7990.lsc;
- struct cfdata *cf = self->dv_cfdata;
+ struct hb_attach_args *ha = aux;
int intlevel;
u_char *p;
- intlevel = cf->cf_level;
+ intlevel = ha->ha_level;
if (intlevel == -1) {
printf(": interrupt level not configured\n");
return;
}
printf(" level %d", intlevel);
- switch (cf->cf_addr) {
+ switch (ha->ha_addr) {
case LANCE_PORT:
sc->sc_mem = (void *)LANCE_MEMORY;
@@ -183,7 +184,7 @@
return;
}
- lesc->sc_r1 = (void *)cf->cf_addr;
+ lesc->sc_r1 = (void *)ha->ha_addr;
sc->sc_memsize = 0x4000; /* 16K */
sc->sc_addr = (int)sc->sc_mem & 0x00ffffff;
diff -r 91bf57223127 -r 300306d8fc57 sys/arch/newsmips/dev/kb_hb.c
--- a/sys/arch/newsmips/dev/kb_hb.c Fri May 09 12:45:01 2003 +0000
+++ b/sys/arch/newsmips/dev/kb_hb.c Fri May 09 13:36:39 2003 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: kb_hb.c,v 1.4 2002/10/02 04:27:52 thorpej Exp $ */
+/* $NetBSD: kb_hb.c,v 1.5 2003/05/09 13:36:40 tsutsui Exp $ */
/*-
* Copyright (c) 2000 Tsubai Masanari. All rights reserved.
@@ -35,9 +35,10 @@
#include <dev/wscons/wsksymdef.h>
#include <dev/wscons/wsksymvar.h>
-#include <machine/autoconf.h>
#include <machine/adrsmap.h>
+#include <newsmips/dev/hbvar.h>
+
struct kbreg {
u_char kb_data;
u_char kb_stat;
@@ -90,9 +91,9 @@
struct cfdata *cf;
void *aux;
{
- struct confargs *ca = aux;
+ struct hb_attach_args *ha = aux;
- if (strcmp(ca->ca_name, "kb") == 0)
+ if (strcmp(ha->ha_name, "kb") == 0)
return 1;
return 0;
Home |
Main Index |
Thread Index |
Old Index