Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch/vax bus.h'ify more of the vax code.
details: https://anonhg.NetBSD.org/src/rev/a2bb32deb3e4
branches: trunk
changeset: 473197:a2bb32deb3e4
user: ragge <ragge%NetBSD.org@localhost>
date: Mon May 24 20:10:30 1999 +0000
description:
bus.h'ify more of the vax code.
diffstat:
sys/arch/vax/conf/files.vax | 10 ++-
sys/arch/vax/include/bus.h | 4 +-
sys/arch/vax/uba/uba_mainbus.c | 132 +++++++++++++++++++++++++++++++++++++++++
sys/arch/vax/vax/bus_mem.c | 40 +++--------
4 files changed, 153 insertions(+), 33 deletions(-)
diffs (269 lines):
diff -r a7d16a83a071 -r a2bb32deb3e4 sys/arch/vax/conf/files.vax
--- a/sys/arch/vax/conf/files.vax Mon May 24 19:10:57 1999 +0000
+++ b/sys/arch/vax/conf/files.vax Mon May 24 20:10:30 1999 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: files.vax,v 1.50 1999/05/23 22:56:53 ragge Exp $
+# $NetBSD: files.vax,v 1.51 1999/05/24 20:10:31 ragge Exp $
#
# new style config file for vax architecture
#
@@ -67,11 +67,14 @@
attach kdb at bi
file arch/vax/bi/kdb.c kdb
-device uba { csr }
+# Unibus/Q22 bus definitions
+include "dev/dec/uba/files.uba"
+
attach uba at mainbus with uba_mainbus
+file arch/vax/uba/uba_mainbus.c uba_mainbus & new_uba
attach uba at sbi with uba_sbi
attach uba at cmi with uba_cmi
-file arch/vax/uba/uba.c uba
+file arch/vax/uba/uba.c uba & !new_uba
device mtc: mscp
attach mtc at uba
@@ -334,6 +337,7 @@
file arch/vax/vax/udiv.s
file arch/vax/vax/trap.c
file arch/vax/vax/bus_dma.c
+file arch/vax/vax/bus_mem.c
file arch/vax/vax/vm_machdep.c
file arch/vax/vax/findcpu.c
diff -r a7d16a83a071 -r a2bb32deb3e4 sys/arch/vax/include/bus.h
--- a/sys/arch/vax/include/bus.h Mon May 24 19:10:57 1999 +0000
+++ b/sys/arch/vax/include/bus.h Mon May 24 20:10:30 1999 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: bus.h,v 1.5 1999/04/14 23:14:46 ragge Exp $ */
+/* $NetBSD: bus.h,v 1.6 1999/05/24 20:10:30 ragge Exp $ */
/*-
* Copyright (c) 1996, 1997, 1998 The NetBSD Foundation, Inc.
@@ -105,7 +105,7 @@
/*
* Access methods for bus resources and address space.
*/
-typedef struct vax_bus_space bus_space_tag_t;
+typedef struct vax_bus_space *bus_space_tag_t;
typedef u_long bus_space_handle_t;
struct vax_bus_space {
diff -r a7d16a83a071 -r a2bb32deb3e4 sys/arch/vax/uba/uba_mainbus.c
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/arch/vax/uba/uba_mainbus.c Mon May 24 20:10:30 1999 +0000
@@ -0,0 +1,132 @@
+/* $NetBSD: uba_mainbus.c,v 1.1 1999/05/24 20:10:31 ragge Exp $ */
+/*
+ * Copyright (c) 1996 Jonathan Stone.
+ * Copyright (c) 1994, 1996 Ludd, University of Lule}, Sweden.
+ * Copyright (c) 1982, 1986 The Regents of the University of California.
+ * 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. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed by the University of
+ * California, Berkeley and its contributors.
+ * 4. Neither the name of the University nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``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 REGENTS OR CONTRIBUTORS 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.
+ *
+ * @(#)uba.c 7.10 (Berkeley) 12/16/90
+ * @(#)autoconf.c 7.20 (Berkeley) 5/9/91
+ */
+
+#include <sys/param.h>
+#include <sys/device.h>
+#include <sys/systm.h>
+
+#include <machine/bus.h>
+#include <machine/pte.h>
+#include <machine/mtpr.h>
+#include <machine/nexus.h>
+#include <machine/cpu.h>
+
+#include <dev/dec/uba/ubareg.h>
+#include <dev/dec/uba/ubavar.h>
+
+/*
+ * The Q22 bus is the main IO bus on MicroVAX II/MicroVAX III systems.
+ * It has an address space of 4MB (22 address bits), therefore the name,
+ * and is hardware compatible with all 16 and 18 bits Q-bus devices.
+ */
+int qba_match __P((struct device *, struct cfdata *, void *));
+void qba_attach __P((struct device *, struct device *, void *));
+void qba_beforescan __P((struct uba_softc*));
+void qba_init __P((struct uba_softc*));
+
+struct cfattach uba_mainbus_ca = {
+ sizeof(struct uba_softc), qba_match, qba_attach
+};
+
+extern struct vax_bus_space vax_mem_bus_space;
+
+int
+qba_match(parent, vcf, aux)
+ struct device *parent;
+ struct cfdata *vcf;
+ void *aux;
+{
+ struct bp_conf *bp = aux;
+
+ if (strcmp(bp->type, "uba"))
+ return 0;
+
+ return 1;
+}
+
+void
+qba_attach(parent, self, aux)
+ struct device *parent, *self;
+ void *aux;
+{
+ struct uba_softc *sc = (void *)self;
+
+ printf(": Q22\n");
+ /*
+ * Fill in bus specific data.
+ */
+/* sc->uh_uba not used; no regs */
+/* sc->uh_nbdp is 0; Qbus has no BDP's */
+/* sc->uh_nr is 0; there can be only one! */
+/* sc->uh_afterscan; not used */
+/* sc->uh_errchk; not used */
+ sc->uh_beforescan = qba_beforescan;
+ sc->uh_ubainit = qba_init;
+ sc->uh_type = QBA;
+ sc->uh_memsize = QBAPAGES;
+ sc->uh_tag = &vax_mem_bus_space;
+ /*
+ * Map in the UBA page map into kernel space. On other UBAs,
+ * the map registers are in the bus IO space.
+ */
+ sc->uh_mr = (void *)vax_map_physmem(QBAMAP,
+ (QBAPAGES * sizeof(struct pte)) / VAX_NBPG);
+
+ uba_attach(sc, QIOPAGE);
+}
+
+/*
+ * Called when the QBA is set up; to enable DMA access from
+ * QBA devices to main memory.
+ */
+void
+qba_beforescan(sc)
+ struct uba_softc *sc;
+{
+ bus_space_write_2(sc->uh_tag, sc->uh_ioh, QIPCR, Q_LMEAE);
+}
+
+void
+qba_init(sc)
+ struct uba_softc *sc;
+{
+ mtpr(0, PR_IUR);
+ DELAY(500000);
+ qba_beforescan(sc);
+}
diff -r a7d16a83a071 -r a2bb32deb3e4 sys/arch/vax/vax/bus_mem.c
--- a/sys/arch/vax/vax/bus_mem.c Mon May 24 19:10:57 1999 +0000
+++ b/sys/arch/vax/vax/bus_mem.c Mon May 24 20:10:30 1999 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: bus_mem.c,v 1.4 1999/03/26 23:41:38 mycroft Exp $ */
+/* $NetBSD: bus_mem.c,v 1.5 1999/05/24 20:10:30 ragge Exp $ */
/*
* Copyright (c) 1998 Matt Thomas
* All rights reserved.
@@ -47,45 +47,28 @@
#include <machine/intr.h>
static int
-vax_mem_add_mapping(
- bus_addr_t bpa,
+vax_mem_bus_space_map(
+ void *t,
+ bus_addr_t pa,
bus_size_t size,
int cacheable,
- bus_space_handle_t *bshp)
+ bus_space_handle_t *bshp,
+ int f2)
{
- u_long pa, endpa;
- vm_offset_t va;
+ vaddr_t va;
- pa = trunc_page(bpa);
- endpa = round_page(bpa + size);
-
- va = uvm_km_valloc(kernel_map, endpa - pa);
+ va = uvm_km_valloc(kernel_map, size);
if (va == 0)
return (ENOMEM);
- *bshp = (bus_space_handle_t)(va + (bpa & VAX_PGOFSET));
+ *bshp = (bus_space_handle_t)(va + (pa & VAX_PGOFSET));
- for (; pa < endpa; pa += VAX_NBPG, va += VAX_NBPG) {
- pmap_enter(pmap_kernel(), va, pa,
- VM_PROT_READ | VM_PROT_WRITE, TRUE, 0);
- }
+ ioaccess(va, pa, size >> VAX_PGSHIFT);
return 0;
}
static int
-vax_mem_bus_space_map(
- void *t,
- bus_addr_t a,
- bus_size_t s,
- int f,
- bus_space_handle_t *hp,
- int f2)
-{
- return vax_mem_add_mapping(a, s, (f & BUS_SPACE_MAP_CACHEABLE), hp);
-}
-
-static int
vax_mem_bus_space_subregion(
void *t,
bus_space_handle_t h,
@@ -110,6 +93,7 @@
/*
* Free the kernel virtual mapping.
*/
+ iounaccess(va, size >> VAX_PGSHIFT);
uvm_km_free(kernel_map, va, endva - va);
}
@@ -137,7 +121,7 @@
panic("vax_mem_bus_free not implemented");
}
-static const struct vax_bus_space vax_mem_bus_space = {
+struct vax_bus_space vax_mem_bus_space = {
NULL,
vax_mem_bus_space_map,
vax_mem_bus_space_unmap,
Home |
Main Index |
Thread Index |
Old Index