From 13daba04a1d38a7439627446d5168cb3cf064ca0 Mon Sep 17 00:00:00 2001 From: ragge Date: Tue, 2 Feb 1999 18:37:20 +0000 Subject: [PATCH] Another giant change: Allocate register space dynamic instead of compiled-in. This is done on a physical page size basis, instead of virtual (as the (on vax yet non-existing) bus_* routines does). This is similar to the way uba allocation is done. --- sys/arch/vax/bi/bi.c | 22 ++-- sys/arch/vax/include/cpu.h | 11 +- sys/arch/vax/include/nexus.h | 6 +- sys/arch/vax/include/uvax.h | 3 +- sys/arch/vax/include/vmparam.h | 7 +- sys/arch/vax/include/vsbus.h | 12 +-- sys/arch/vax/uba/uba.c | 34 ++---- sys/arch/vax/vax/autoconf.c | 22 ++-- sys/arch/vax/vax/clock.c | 8 +- sys/arch/vax/vax/intvec.s | 4 +- sys/arch/vax/vax/ka410.c | 136 +++++++----------------- sys/arch/vax/vax/ka43.c | 182 ++++++++++++++------------------- sys/arch/vax/vax/ka46.c | 48 +++------ sys/arch/vax/vax/ka630.c | 48 +++------ sys/arch/vax/vax/ka650.c | 59 +++-------- sys/arch/vax/vax/ka750.c | 67 ++++++------ sys/arch/vax/vax/ka780.c | 18 +--- sys/arch/vax/vax/ka820.c | 62 +++-------- sys/arch/vax/vax/ka860.c | 36 +------ sys/arch/vax/vax/machdep.c | 80 +++++++++++++-- sys/arch/vax/vax/pmap.c | 10 +- sys/arch/vax/vax/sbi.c | 23 +++-- sys/arch/vax/vax/vm_machdep.c | 34 +++++- sys/arch/vax/vsa/dz_vsbus.c | 23 ++++- sys/arch/vax/vsa/if_ln.c | 11 +- sys/arch/vax/vsa/ncr.c | 6 +- sys/arch/vax/vsa/smg.c | 17 +-- sys/arch/vax/vsa/vsbus.c | 14 +-- sys/dev/dec/qbus/uba.c | 34 ++---- 29 files changed, 445 insertions(+), 592 deletions(-) diff --git a/sys/arch/vax/bi/bi.c b/sys/arch/vax/bi/bi.c index 00313c574bc9..b583b6d90cff 100644 --- a/sys/arch/vax/bi/bi.c +++ b/sys/arch/vax/bi/bi.c @@ -1,4 +1,4 @@ -/* $NetBSD: bi.c,v 1.10 1998/11/29 15:12:57 ragge Exp $ */ +/* $NetBSD: bi.c,v 1.11 1999/02/02 18:37:22 ragge Exp $ */ /* * Copyright (c) 1996 Ludd, University of Lule}, Sweden. * All rights reserved. @@ -132,16 +132,20 @@ bi_attach(parent, self, aux) int nodenr; printf("\n"); - binode = bi->bi_base = (struct bi_node *)bp->bp_addr; + bi->bi_base = (struct bi_node *)bp->bp_addr; ba.ba_intcpu = 1 << mastercpu; +#define NODEPGS (sizeof(struct bi_node) / VAX_NBPG) for (nodenr = 0; nodenr < NNODEBI; nodenr++) { - if (badaddr((caddr_t)&binode[nodenr], 4)) - continue; - - ba.ba_node = &binode[nodenr]; - ba.ba_nodenr = nodenr; - ba.ba_busnr = 0; /* XXX */ - config_found(self, &ba, bi_print); + binode = (struct bi_node *)vax_map_physmem( + (paddr_t)(bi->bi_base + nodenr), NODEPGS); + if (badaddr((caddr_t)binode, 4)) { + vax_unmap_physmem((vaddr_t)binode, NODEPGS); + } else { + ba.ba_node = binode; + ba.ba_nodenr = nodenr; + ba.ba_busnr = 0; /* XXX */ + config_found(self, &ba, bi_print); + } } } diff --git a/sys/arch/vax/include/cpu.h b/sys/arch/vax/include/cpu.h index 71ff90de73d9..2f249de3ab9d 100644 --- a/sys/arch/vax/include/cpu.h +++ b/sys/arch/vax/include/cpu.h @@ -1,4 +1,4 @@ -/* $NetBSD: cpu.h,v 1.33 1999/01/19 21:04:48 ragge Exp $ */ +/* $NetBSD: cpu.h,v 1.34 1999/02/02 18:37:22 ragge Exp $ */ /* * Copyright (c) 1994 Ludd, University of Lule}, Sweden @@ -106,6 +106,11 @@ extern int want_resched; /* resched() was called */ */ #define need_proftick(p) {(p)->p_flag |= P_OWEUPC; mtpr(AST_OK,PR_ASTLVL); } +/* + * This defines the I/O device register space size in pages. + */ +#define IOSPSZ ((1*1024*1024) / VAX_NBPG) /* 1 MB == 2k pages */ + struct device; /* Some low-level prototypes */ @@ -118,6 +123,10 @@ void dumpsys __P((void)); void swapconf __P((void)); void disk_printtype __P((int, int)); void disk_reallymapin __P((struct buf *, struct pte *, int, int)); +vaddr_t vax_map_physmem __P((paddr_t, int)); +void vax_unmap_physmem __P((vaddr_t, int)); +void ioaccess __P((vaddr_t, paddr_t, int)); +void iounaccess __P((vaddr_t, int)); #ifdef DDB int kdbrint __P((int)); #endif diff --git a/sys/arch/vax/include/nexus.h b/sys/arch/vax/include/nexus.h index 6f15874f8740..a0e5f0cc1b6f 100644 --- a/sys/arch/vax/include/nexus.h +++ b/sys/arch/vax/include/nexus.h @@ -1,4 +1,4 @@ -/* $NetBSD: nexus.h,v 1.12 1996/08/20 14:19:43 ragge Exp $ */ +/* $NetBSD: nexus.h,v 1.13 1999/02/02 18:37:22 ragge Exp $ */ /*- * Copyright (c) 1982, 1986 The Regents of the University of California. @@ -188,8 +188,4 @@ extern caddr_t *nex_vec; #define MCHK_PANIC -1 #define MCHK_RECOVERED 0 -#ifndef _LOCORE -struct nexus *nexus; -#endif - #endif /* _VAX_NEXUS_H_ */ diff --git a/sys/arch/vax/include/uvax.h b/sys/arch/vax/include/uvax.h index be053b2def4f..5e6bf83e5f09 100644 --- a/sys/arch/vax/include/uvax.h +++ b/sys/arch/vax/include/uvax.h @@ -1,4 +1,4 @@ -/* $NetBSD: uvax.h,v 1.4 1998/08/11 17:52:59 ragge Exp $ */ +/* $NetBSD: uvax.h,v 1.5 1999/02/02 18:37:22 ragge Exp $ */ /* * Copyright (c) 1996 Ludd, University of Lule}, Sweden. * All rights reserved. @@ -83,5 +83,4 @@ struct vs_cpu { #define PARCTL_CPEN 2 #define PARCTL_DPEN 1 -struct vs_cpu *vs_cpu; /* Common CPU registers */ #endif diff --git a/sys/arch/vax/include/vmparam.h b/sys/arch/vax/include/vmparam.h index d1a7c2ce1140..1d41ae5d9d23 100644 --- a/sys/arch/vax/include/vmparam.h +++ b/sys/arch/vax/include/vmparam.h @@ -1,4 +1,4 @@ -/* $NetBSD: vmparam.h,v 1.22 1999/01/16 20:49:12 chuck Exp $ */ +/* $NetBSD: vmparam.h,v 1.23 1999/02/02 18:37:22 ragge Exp $ */ /*- * Copyright (c) 1990 The Regents of the University of California. @@ -42,10 +42,6 @@ #ifndef _VMPARAM_H_ #define _VMPARAM_H_ -#ifndef _LOCORE -#include -#endif - /* * Machine dependent constants for VAX. */ @@ -133,7 +129,6 @@ #define SAFERSS 8 /* nominal ``small'' resident set size protected against replacement */ - #if defined(UVM) #define VM_PHYSSEG_MAX 1 diff --git a/sys/arch/vax/include/vsbus.h b/sys/arch/vax/include/vsbus.h index a96432d4839c..70cea3d70792 100644 --- a/sys/arch/vax/include/vsbus.h +++ b/sys/arch/vax/include/vsbus.h @@ -1,4 +1,4 @@ -/* $NetBSD: vsbus.h,v 1.5 1999/01/01 21:43:18 ragge Exp $ */ +/* $NetBSD: vsbus.h,v 1.6 1999/02/02 18:37:22 ragge Exp $ */ /* * Copyright (c) 1996 Ludd, University of Lule}, Sweden. * All rights reserved. @@ -86,6 +86,7 @@ struct vsbus_attach_args { #define NI_ADDR 0x20090000 /* Ethernet address */ #define DZ_CSR 0x200a0000 /* DZ11-compatible chip csr */ #define VS_CLOCK 0x200b0000 /* clock chip address */ +#define SCA_REGS 0x200c0000 /* disk device addresses */ #define NI_BASE 0x200e0000 /* LANCE CSRs */ #define NI_IOSIZE (128 * VAX_NBPG) /* IO address size */ #define VS_REGS 0x20080000 /* Misc cpu internal regs */ @@ -121,14 +122,7 @@ struct vsbus_attach_args { #define VS4000_ST 4 #define VS4000_NI 1 -caddr_t dz_regs; /* On-board serial line */ -caddr_t le_iomem; /* base addr of RAM -- CPU's view */ -short *lance_csr; /* LANCE CSR virtual address */ -int *lance_addr; /* Ethernet address */ -struct vs_cpu *vs_cpu; /* Common CPU registers */ -caddr_t sm_addr; /* virtual address of graphic space */ -caddr_t dma_area; /* DMA area mapping addess */ -caddr_t sca_regs; /* device registers */ +caddr_t le_iomem; /* base addr of RAM -- CPU's view */ int inr_ni, inr_sr, inr_st, inr_vf; /* Interrupt register bit */ void vsbus_intr_enable __P((int)); diff --git a/sys/arch/vax/uba/uba.c b/sys/arch/vax/uba/uba.c index 054bf926324a..f53f4ff806b9 100644 --- a/sys/arch/vax/uba/uba.c +++ b/sys/arch/vax/uba/uba.c @@ -1,4 +1,4 @@ -/* $NetBSD: uba.c,v 1.41 1999/01/19 22:57:47 ragge Exp $ */ +/* $NetBSD: uba.c,v 1.42 1999/02/02 18:37:20 ragge Exp $ */ /* * Copyright (c) 1996 Jonathan Stone. * Copyright (c) 1994, 1996 Ludd, University of Lule}, Sweden. @@ -408,11 +408,8 @@ qba_attach(parent, self, aux) void *aux; { struct uba_softc *sc = (void *)self; - vm_offset_t mini, maxi; printf(": Q22\n"); - - /* * Fill in bus specific data. */ @@ -429,16 +426,8 @@ qba_attach(parent, self, aux) * Map in the UBA page map into kernel space. On other UBAs, * the map registers are in the bus IO space. */ -#if defined(UVM) - (void)uvm_km_suballoc(kernel_map, &mini, &maxi, - QBAPAGES * sizeof(struct pte), FALSE, FALSE, NULL); -#else - (void)kmem_suballoc(kernel_map, &mini, &maxi, - QBAPAGES * sizeof(struct pte), FALSE); -#endif - pmap_map(mini, QBAMAP, QBAMAP + QBAPAGES * sizeof(struct pte), - VM_PROT_READ | VM_PROT_WRITE); - sc->uh_mr = (void *)mini; + sc->uh_mr = (void *)vax_map_physmem(QBAMAP, + (QBAPAGES * sizeof(struct pte)) / VAX_NBPG); uba_attach(sc, QIOPAGE); } @@ -804,9 +793,8 @@ qbgetpri() void uba_attach(sc, iopagephys) struct uba_softc *sc; - unsigned long iopagephys; + paddr_t iopagephys; { - vm_offset_t mini, maxi; /* * Set last free interrupt vector for devices with @@ -818,18 +806,10 @@ uba_attach(sc, iopagephys) /* * Allocate place for unibus memory in virtual space. - * This is done with kmem_suballoc() but after that - * never used in the vm system. Is it OK to do so? */ -#if defined(UVM) - (void)uvm_km_suballoc(kernel_map, &mini, &maxi, UBAIOPAGES * VAX_NBPG, - FALSE, FALSE, NULL); -#else - (void)kmem_suballoc(kernel_map, &mini, &maxi, UBAIOPAGES * VAX_NBPG, FALSE); -#endif - pmap_map(mini, iopagephys, iopagephys + UBAIOPAGES * VAX_NBPG, - VM_PROT_READ|VM_PROT_WRITE); - sc->uh_iopage = (void *)mini; + sc->uh_iopage = (caddr_t)vax_map_physmem(iopagephys, UBAIOPAGES); + if (sc->uh_iopage == 0) + return; /* vax_map_physmem() will complain for us */ /* * Initialize the UNIBUS, by freeing the map * registers and the buffered data path registers diff --git a/sys/arch/vax/vax/autoconf.c b/sys/arch/vax/vax/autoconf.c index 996aad5f76f9..31bf847d5b4a 100644 --- a/sys/arch/vax/vax/autoconf.c +++ b/sys/arch/vax/vax/autoconf.c @@ -1,4 +1,4 @@ -/* $NetBSD: autoconf.c,v 1.36 1998/10/27 21:18:52 matt Exp $ */ +/* $NetBSD: autoconf.c,v 1.37 1999/02/02 18:37:20 ragge Exp $ */ /* * Copyright (c) 1994 Ludd, University of Lule}, Sweden. @@ -52,12 +52,13 @@ #include +#include + #include "locators.h" void gencnslask __P((void)); struct cpu_dep *dep_call; -struct nexus *nexus; int mastercpu; /* chief of the system */ struct device *booted_from; @@ -195,9 +196,7 @@ mainbus_attach(parent, self, hej) switch (vax_cputype) { #if VAX8200 case VAX_8200: { - extern void *bi_nodebase; - - bp.bp_addr = (int)bi_nodebase; + bp.bp_addr = BI_BASE(0,0); config_found(self, &bp, mainbus_print); break; } @@ -233,13 +232,17 @@ find_sbi(self, bp, print) { volatile int tmp; volatile struct sbia_regs *sbiar; - extern struct ioa *ioa; + struct ioa *ioa; int type, i; for (i = 0; i < MAXNIOA; i++) { - if (badaddr((caddr_t)&ioa[i], 4)) + ioa = (struct ioa *)vax_map_physmem((paddr_t)IOA8600(0), + (IOAMAPSIZ / VAX_NBPG)); + if (badaddr((caddr_t)ioa, 4)) { + vax_unmap_physmem((vaddr_t)ioa, (IOAMAPSIZ / VAX_NBPG)); continue; - tmp = ioa[i].ioacsr.ioa_csr; + } + tmp = ioa->ioacsr.ioa_csr; type = tmp & IOA_TYPMSK; switch (type) { @@ -248,7 +251,7 @@ find_sbi(self, bp, print) bp->type = "sbi"; bp->num = i; config_found(self, bp, mainbus_print); - sbiar = (void *)&ioa[i]; + sbiar = (void *)ioa; sbiar->sbi_errsum = -1; sbiar->sbi_error = 0x1000; sbiar->sbi_fltsts = 0xc0000; @@ -258,6 +261,7 @@ find_sbi(self, bp, print) printf("IOAdapter %x unsupported\n", type); break; } + vax_unmap_physmem((vaddr_t)ioa, (IOAMAPSIZ / VAX_NBPG)); } } #endif diff --git a/sys/arch/vax/vax/clock.c b/sys/arch/vax/vax/clock.c index db9fd64b17ca..9af15d12cc15 100644 --- a/sys/arch/vax/vax/clock.c +++ b/sys/arch/vax/vax/clock.c @@ -1,4 +1,4 @@ -/* $NetBSD: clock.c,v 1.24 1998/08/20 23:52:42 matt Exp $ */ +/* $NetBSD: clock.c,v 1.25 1999/02/02 18:37:20 ragge Exp $ */ /* * Copyright (c) 1995 Ludd, University of Lule}, Sweden. * All rights reserved. @@ -63,10 +63,12 @@ microtime(tvp) switch (vax_boardtype) { #ifdef VAX46 - case VAX_BTYP_46: - i = *(volatile int *)(&vs_cpu->vc_diagtimu); + case VAX_BTYP_46: { + extern struct vs_cpu *ka46_cpu; + i = *(volatile int *)(&ka46_cpu->vc_diagtimu); i = (i >> 16) * 1024 + (i & 0x3ff); break; + } #endif default: i = mfpr(PR_ICR); diff --git a/sys/arch/vax/vax/intvec.s b/sys/arch/vax/vax/intvec.s index 00d7fe20ac9a..0cb188084b1e 100644 --- a/sys/arch/vax/vax/intvec.s +++ b/sys/arch/vax/vax/intvec.s @@ -1,4 +1,4 @@ -/* $NetBSD: intvec.s,v 1.36 1999/01/19 21:04:49 ragge Exp $ */ +/* $NetBSD: intvec.s,v 1.37 1999/02/02 18:37:20 ragge Exp $ */ /* * Copyright (c) 1994, 1997 Ludd, University of Lule}, Sweden. @@ -340,7 +340,7 @@ hardclock: mtpr $0xc1,$PR_ICCS # Reset interrupt flag #ifdef VAX46 cmpl _vax_boardtype,$VAX_BTYP_46 bneq 1f - movl _vs_cpu,r0 + movl _ka46_cpu,r0 clrl 0x1c(r0) #endif 1: pushl sp diff --git a/sys/arch/vax/vax/ka410.c b/sys/arch/vax/vax/ka410.c index 3ad17d0c6459..f880b7df7307 100644 --- a/sys/arch/vax/vax/ka410.c +++ b/sys/arch/vax/vax/ka410.c @@ -1,4 +1,4 @@ -/* $NetBSD: ka410.c,v 1.15 1999/01/19 21:04:49 ragge Exp $ */ +/* $NetBSD: ka410.c,v 1.16 1999/02/02 18:37:21 ragge Exp $ */ /* * Copyright (c) 1996 Ludd, University of Lule}, Sweden. * All rights reserved. @@ -53,10 +53,6 @@ #include #include -#include "smg.h" -#include "ry.h" -#include "ncr.h" - static void ka410_conf __P((struct device*, struct device*, void*)); static void ka410_steal_pages __P((void)); static void ka410_memerr __P((void)); @@ -64,6 +60,7 @@ static int ka410_mchk __P((caddr_t)); static void ka410_halt __P((void)); static void ka410_reboot __P((int)); static void ka41_cache_enable __P((void)); +static void ka410_clrf __P((void)); static caddr_t l2cache; /* mapped in address */ static long *cacr; /* l2csche ctlr reg */ @@ -85,6 +82,7 @@ struct cpu_dep ka410_calls = { 2, /* SCB pages */ ka410_halt, ka410_reboot, + ka410_clrf, }; @@ -93,21 +91,40 @@ ka410_conf(parent, self, aux) struct device *parent, *self; void *aux; { + extern int clk_adrshift, clk_tweak; + struct vs_cpu *ka410_cpu; + + ka410_cpu = (struct vs_cpu *)vax_map_physmem(VS_REGS, 1); + switch (vax_cputype) { case VAX_TYP_UV2: + ka410_cpu->vc_410mser = 1; printf(": KA410\n"); break; case VAX_TYP_CVAX: printf(": KA41/42\n"); + ka410_cpu->vc_vdcorg = 0; /* XXX */ + ka410_cpu->vc_parctl = PARCTL_CPEN | PARCTL_DPEN ; printf("%s: Enabling primary cache, ", self->dv_xname); mtpr(KA420_CADR_S2E|KA420_CADR_S1E|KA420_CADR_ISE|KA420_CADR_DSE, PR_CADR); if (vax_confdata & KA420_CFG_CACHPR) { + l2cache = (void *)vax_map_physmem(KA420_CH2_BASE, + (KA420_CH2_SIZE / VAX_NBPG)); + cacr = (void *)vax_map_physmem(KA420_CACR, 1); printf("secondary cache\n"); ka41_cache_enable(); } else printf("no secondary cache present\n"); } + /* Done with ka410_cpu - release it */ + vax_unmap_physmem((vaddr_t)ka410_cpu, 1); + /* + * Setup parameters necessary to read time from clock chip. + */ + clk_adrshift = 1; /* Addressed at long's... */ + clk_tweak = 2; /* ...and shift two */ + clk_page = (short *)vax_map_physmem(KA420_WAT_BASE, 1); } void @@ -135,110 +152,15 @@ ka410_mchk(addr) void ka410_steal_pages() { - extern vm_offset_t avail_start, virtual_avail; - extern int clk_adrshift, clk_tweak; - int junk, parctl = 0; + extern vaddr_t avail_start; /* Interrupt vector number in interrupt mask table */ inr_ni = VS3100_NI; inr_sr = VS3100_SR; inr_st = VS3100_ST; inr_vf = VS3100_VF; - /* - * SCB is already copied/initialized at addr avail_start - * by pmap_bootstrap(), but it's not yet mapped. Thus we use - * the MAPPHYS() macro to reserve these two pages and to - * perform the mapping. The mapped address is assigned to junk. - */ - MAPPHYS(junk, 2, VM_PROT_READ|VM_PROT_WRITE); - - /* - * Setup parameters necessary to read time from clock chip. - */ - clk_adrshift = 1; /* Addressed at long's... */ - clk_tweak = 2; /* ...and shift two */ - MAPVIRT(clk_page, 1); - pmap_map((vm_offset_t)clk_page, (vm_offset_t)KA410_WAT_BASE, - (vm_offset_t)KA410_WAT_BASE + VAX_NBPG, VM_PROT_READ|VM_PROT_WRITE); - - /* LANCE CSR & DMA memory */ - MAPVIRT(lance_csr, 1); - pmap_map((vm_offset_t)lance_csr, (vm_offset_t)NI_BASE, - (vm_offset_t)NI_BASE + VAX_NBPG, VM_PROT_READ|VM_PROT_WRITE); - - MAPVIRT(vs_cpu, 1); - pmap_map((vm_offset_t)vs_cpu, (vm_offset_t)VS_REGS, - (vm_offset_t)VS_REGS + VAX_NBPG, VM_PROT_READ|VM_PROT_WRITE); - - MAPVIRT(dz_regs, 2); - pmap_map((vm_offset_t)dz_regs, (vm_offset_t)DZ_CSR, - (vm_offset_t)DZ_CSR + VAX_NBPG, VM_PROT_READ|VM_PROT_WRITE); - - MAPVIRT(lance_addr, 1); - pmap_map((vm_offset_t)lance_addr, (vm_offset_t)NI_ADDR, - (vm_offset_t)NI_ADDR + VAX_NBPG, VM_PROT_READ|VM_PROT_WRITE); MAPPHYS(le_iomem, (NI_IOSIZE/VAX_NBPG), VM_PROT_READ|VM_PROT_WRITE); - - if (((int)le_iomem & ~KERNBASE) > 0xffffff) - parctl = PARCTL_DMA; - -#if NSMG > 0 - if ((vax_confdata & KA420_CFG_MULTU) == 0) { - MAPVIRT(sm_addr, (SMSIZE / VAX_NBPG)); - pmap_map((vm_offset_t)sm_addr, (vm_offset_t)SMADDR, - (vm_offset_t)SMADDR + SMSIZE, VM_PROT_READ|VM_PROT_WRITE); - ((struct vs_cpu *)VS_REGS)->vc_vdcorg = 0; - } -#endif -#if NRD || NRX || NNCR - MAPVIRT(sca_regs, 1); - pmap_map((vm_offset_t)sca_regs, (vm_offset_t)KA410_DKC_BASE, - (vm_offset_t)KA410_DKC_BASE + VAX_NBPG, - VM_PROT_READ|VM_PROT_WRITE); - - if (vax_boardtype == VAX_BTYP_410) { - MAPVIRT(dma_area, (KA410_DMA_SIZE / VAX_NBPG)); - pmap_map((vm_offset_t)dma_area, (vm_offset_t)KA410_DMA_BASE, - (vm_offset_t)KA410_DMA_BASE + KA410_DMA_SIZE, - VM_PROT_READ|VM_PROT_WRITE); - } else { - MAPVIRT(dma_area, (KA420_DMA_SIZE / VAX_NBPG)); - pmap_map((vm_offset_t)dma_area, (vm_offset_t)KA420_DMA_BASE, - (vm_offset_t)KA420_DMA_BASE + KA420_DMA_SIZE, - VM_PROT_READ|VM_PROT_WRITE); - } -#endif - if ((vax_cputype == VAX_TYP_CVAX) && - (vax_confdata & KA420_CFG_CACHPR)) { - MAPVIRT(l2cache, (KA420_CH2_SIZE / VAX_NBPG)); - pmap_map((vm_offset_t)l2cache, (vm_offset_t)KA420_CH2_BASE, - (vm_offset_t)KA420_CH2_BASE + KA420_CH2_SIZE, - VM_PROT_READ|VM_PROT_WRITE); - MAPVIRT(cacr, 1); - pmap_map((vm_offset_t)cacr, (vm_offset_t)KA420_CACR, - (vm_offset_t)KA420_CACR + VAX_NBPG, VM_PROT_READ|VM_PROT_WRITE); - } - - /* - * Clear restart and boot in progress flags - * in the CPMBX. (ie. clear bits 4 and 5) - */ - KA410_WAT_BASE->cpmbx = (KA410_WAT_BASE->cpmbx & ~0x30); - - /* - * Enable memory parity error detection and clear error bits. - */ - switch (vax_cputype) { - case VAX_TYP_UV2: - KA410_CPU_BASE->ka410_mser = 1; - break; - - case VAX_TYP_CVAX: - ((struct vs_cpu *)VS_REGS)->vc_parctl = - parctl | PARCTL_CPEN | PARCTL_DPEN ; - break; - } } static void @@ -255,3 +177,15 @@ ka410_reboot(arg) asm("movl $0xc, (%0)"::"r"((int)clk_page + 0x38)); /* Don't ask */ asm("halt"); } + +static void +ka410_clrf() +{ + struct ka410_clock *clk = (void *)clk_page; + + /* + * Clear restart and boot in progress flags + * in the CPMBX. (ie. clear bits 4 and 5) + */ + clk->cpmbx = (clk->cpmbx & ~0x30); +} diff --git a/sys/arch/vax/vax/ka43.c b/sys/arch/vax/vax/ka43.c index ecf87b5facc9..9a422a5fe65b 100644 --- a/sys/arch/vax/vax/ka43.c +++ b/sys/arch/vax/vax/ka43.c @@ -1,4 +1,4 @@ -/* $NetBSD: ka43.c,v 1.13 1999/01/19 21:04:49 ragge Exp $ */ +/* $NetBSD: ka43.c,v 1.14 1999/02/02 18:37:21 ragge Exp $ */ /* * Copyright (c) 1996 Ludd, University of Lule}, Sweden. * All rights reserved. @@ -52,22 +52,23 @@ #include #include -#include "smg.h" -#include "ncr.h" +static void ka43_conf __P((struct device*, struct device*, void*)); +static void ka43_steal_pages __P((void)); -void ka43_conf __P((struct device*, struct device*, void*)); -void ka43_steal_pages __P((void)); +static int ka43_mchk __P((caddr_t)); +static void ka43_memerr __P((void)); +#if 0 +static void ka43_clear_errors __P((void)); +#endif +static int ka43_cache_init __P((void)); /* "int mapen" as argument? */ +static int ka43_cache_reset __P((void)); +static int ka43_cache_enable __P((void)); +static int ka43_cache_disable __P((void)); +static int ka43_cache_invalidate __P((void)); +static void ka43_halt __P((void)); +static void ka43_reboot __P((int)); +static void ka43_clrf __P((void)); -int ka43_mchk __P((caddr_t)); -void ka43_memerr __P((void)); - -void ka43_clear_errors __P((void)); - -int ka43_cache_init __P((void)); /* "int mapen" as argument? */ -int ka43_cache_reset __P((void)); -int ka43_cache_enable __P((void)); -int ka43_cache_disable __P((void)); -int ka43_cache_invalidate __P((void)); struct cpu_dep ka43_calls = { ka43_steal_pages, @@ -79,6 +80,9 @@ struct cpu_dep ka43_calls = { chip_clkwrite, 7, /* 7.6 VUP */ 2, /* SCB pages */ + ka43_halt, + ka43_reboot, + ka43_clrf, }; /* @@ -87,6 +91,7 @@ struct cpu_dep ka43_calls = { * but before leving ka43_steal_pages() we reset them to virtual addresses. */ struct ka43_cpu *ka43_cpu = (void*)KA43_CPU_BASE; +extern short *clk_page; u_int *ka43_creg = (void*)KA43_CH2_CREG; u_int *ka43_ctag = (void*)KA43_CT2_BASE; @@ -188,6 +193,7 @@ ka43_cache_init() return (ka43_cache_reset()); } +#if 0 void ka43_clear_errors() { @@ -195,6 +201,7 @@ ka43_clear_errors() val |= KA43_SESR_SERR | KA43_SESR_LERR | KA43_SESR_CERR; *ka43_creg = val; } +#endif int ka43_cache_reset() @@ -299,13 +306,24 @@ ka43_conf(parent, self, aux) struct device *parent, *self; void *aux; { + extern int clk_adrshift, clk_tweak; printf(": KA43\n"); + ka43_cpu = (void *)vax_map_physmem(VS_REGS, 1); + + ka43_creg = (void *)vax_map_physmem(KA43_CH2_CREG, 1); + ka43_ctag = (void *)vax_map_physmem(KA43_CT2_BASE, + (KA43_CT2_SIZE/VAX_NBPG)); + /* * ka43_conf() gets called with MMU enabled, now it's save to * init/reset the caches. */ ka43_cache_init(); + + clk_adrshift = 1; /* Addressed at long's... */ + clk_tweak = 2; /* ...and shift two */ + clk_page = (short *)vax_map_physmem(VS_CLOCK, 1); } @@ -318,93 +336,28 @@ ka43_conf(parent, self, aux) void ka43_steal_pages() { - extern vm_offset_t avail_start, virtual_avail; - extern short *clk_page; - extern int clk_adrshift, clk_tweak; - int junk, val; + extern vaddr_t avail_start; + int val; /* Interrupt vector number in interrupt mask table */ inr_ni = VS3100_NI; inr_sr = VS3100_SR; inr_st = VS3100_ST; inr_vf = VS3100_VF; - /* - * SCB is already copied/initialized at addr avail_start - * by pmap_bootstrap(), but it's not yet mapped. Thus we use - * the MAPPHYS() macro to reserve these two pages and to - * perform the mapping. The mapped address is assigned to junk. - */ - MAPPHYS(junk, 2, VM_PROT_READ|VM_PROT_WRITE); - clk_adrshift = 1; /* Addressed at long's... */ - clk_tweak = 2; /* ...and shift two */ - MAPVIRT(clk_page, 2); - pmap_map((vm_offset_t)clk_page, (vm_offset_t)KA43_WAT_BASE, - (vm_offset_t)KA43_WAT_BASE + VAX_NBPG, VM_PROT_READ|VM_PROT_WRITE); - - /* LANCE CSR */ - MAPVIRT(lance_csr, 1); - pmap_map((vm_offset_t)lance_csr, (vm_offset_t)NI_BASE, - (vm_offset_t)NI_BASE + VAX_NBPG, VM_PROT_READ|VM_PROT_WRITE); - - MAPVIRT(vs_cpu, 1); - pmap_map((vm_offset_t)vs_cpu, (vm_offset_t)VS_REGS, - (vm_offset_t)VS_REGS + VAX_NBPG, VM_PROT_READ|VM_PROT_WRITE); - - MAPVIRT(dz_regs, 2); - pmap_map((vm_offset_t)dz_regs, (vm_offset_t)DZ_CSR, - (vm_offset_t)DZ_CSR + VAX_NBPG, VM_PROT_READ|VM_PROT_WRITE); - - MAPVIRT(lance_addr, 1); - pmap_map((vm_offset_t)lance_addr, (vm_offset_t)NI_ADDR, - (vm_offset_t)NI_ADDR + VAX_NBPG, VM_PROT_READ|VM_PROT_WRITE); - - /* 2nd level CCR */ - MAPVIRT(ka43_creg, 1); - pmap_map((vm_offset_t)ka43_creg, (vm_offset_t)KA43_CH2_CREG, - (vm_offset_t)KA43_CH2_CREG + VAX_NBPG, VM_PROT_READ|VM_PROT_WRITE); - - /* 2nd level CTA */ - MAPVIRT(ka43_ctag, KA43_CT2_SIZE/VAX_NBPG); - pmap_map((vm_offset_t)ka43_ctag, (vm_offset_t)KA43_CT2_BASE, - (vm_offset_t)KA43_CT2_BASE + KA43_CT2_SIZE, - VM_PROT_READ|VM_PROT_WRITE); - -#if NNCR > 0 - /* SCSI controller */ - MAPVIRT(sca_regs, (KA43_SCS_SIZE / VAX_NBPG)); - pmap_map((vm_offset_t)sca_regs, (vm_offset_t)KA43_SCS_BASE, - (vm_offset_t)KA43_SCS_BASE + KA43_SCS_SIZE, - VM_PROT_READ|VM_PROT_WRITE); - - /* SCSI DMA. Not used right now, untested. */ - MAPVIRT(dma_area, (KA43_DMA_SIZE / VAX_NBPG)); - pmap_map((vm_offset_t)dma_area, (vm_offset_t)KA43_DMA_BASE, - (vm_offset_t)KA43_DMA_BASE + KA43_DMA_SIZE, - VM_PROT_READ|VM_PROT_WRITE); -#endif - /* - * Oh holy shit! It took me over one year(!) to find out that - * the 3100/76 has to use diag-mem instead of physical memory - * for communication with LANCE (using phys-mem results in - * parity errors and mchk exceptions with code 17 (0x11)). - * - * Many thanks to Matt Thomas, without his help it could have - * been some more years... ;-) - */ -#define LEMEM (((int)le_iomem & ~KERNBASE)|KA43_DIAGMEM) - MAPPHYS(le_iomem, (NI_IOSIZE/VAX_NBPG), VM_PROT_READ|VM_PROT_WRITE); - pmap_map((vm_offset_t)le_iomem, LEMEM, LEMEM + NI_IOSIZE, - VM_PROT_READ|VM_PROT_WRITE); - -#if NSMG > 0 - if ((vax_confdata & 0x80) == 0) { - MAPVIRT(sm_addr, (SMSIZE / VAX_NBPG)); - pmap_map((vm_offset_t)sm_addr, (vm_offset_t)SMADDR, - (vm_offset_t)SMADDR + SMSIZE, VM_PROT_READ|VM_PROT_WRITE); - ((struct vs_cpu *)VS_REGS)->vc_vdcorg = 0; - } -#endif + /* + * Oh holy shit! It took me over one year(!) to find out that + * the 3100/76 has to use diag-mem instead of physical memory + * for communication with LANCE (using phys-mem results in + * parity errors and mchk exceptions with code 17 (0x11)). + * + * Many thanks to Matt Thomas, without his help it could have + * been some more years... ;-) + */ +#define LEMEM (((int)le_iomem & ~KERNBASE)|KA43_DIAGMEM) + MAPPHYS(le_iomem, (NI_IOSIZE/VAX_NBPG), VM_PROT_READ|VM_PROT_WRITE); + pmap_map((vm_offset_t)le_iomem, LEMEM, LEMEM + NI_IOSIZE, + VM_PROT_READ|VM_PROT_WRITE); /* * if LANCE\'s io-buffer is above 16 MB, then the appropriate flag @@ -418,12 +371,6 @@ ka43_steal_pages() val |= KA43_PCTL_DMA; ka43_cpu->parctl = val; /* and write new value */ - /* - * Clear restart and boot in progress flags in the CPMBX. - */ - ((struct ka43_clock *)KA43_WAT_BASE)->cpmbx = - ((struct ka43_clock *)KA43_WAT_BASE)->cpmbx & 0xF0; - #if 0 /* * Clear all error flags, not really neccessary here, this will @@ -431,10 +378,31 @@ ka43_steal_pages() */ ka43_clear_errors(); #endif - - /* - * MM is not yet enabled, thus we still used the physical addresses, - * but before leaving this routine, we need to reset them to virtual. - */ - ka43_cpu = (void *)vs_cpu; } + +static void +ka43_clrf() +{ + struct ka43_clock *clk = (void *)clk_page; + + /* + * Clear restart and boot in progress flags in the CPMBX. + */ + clk->cpmbx = (clk->cpmbx & ~0xf0); +} + +static void +ka43_halt() +{ + asm("movl $0xc, (%0)"::"r"((int)clk_page + 0x38)); /* Don't ask */ + asm("halt"); +} + +static void +ka43_reboot(arg) + int arg; +{ + asm("movl $0xc, (%0)"::"r"((int)clk_page + 0x38)); /* Don't ask */ + asm("halt"); +} + diff --git a/sys/arch/vax/vax/ka46.c b/sys/arch/vax/vax/ka46.c index 98b13fcc428b..a4d46006cff8 100644 --- a/sys/arch/vax/vax/ka46.c +++ b/sys/arch/vax/vax/ka46.c @@ -1,4 +1,4 @@ -/* $NetBSD: ka46.c,v 1.4 1999/01/19 21:04:49 ragge Exp $ */ +/* $NetBSD: ka46.c,v 1.5 1999/02/02 18:37:21 ragge Exp $ */ /* * Copyright (c) 1998 Ludd, University of Lule}, Sweden. * All rights reserved. @@ -62,6 +62,7 @@ static void ka46_halt __P((void)); static void ka46_reboot __P((int)); static void ka46_cache_enable __P((void)); +struct vs_cpu *ka46_cpu; extern short *clk_page; /* @@ -87,9 +88,18 @@ ka46_conf(parent, self, aux) struct device *parent, *self; void *aux; { + extern int clk_adrshift, clk_tweak; + printf(": KA46\n"); + ka46_cpu = (void *)vax_map_physmem(VS_REGS, 1); printf("%s: turning on floating point chip\n", self->dv_xname); mtpr(2, PR_ACCS); /* Enable floating points */ + /* + * Setup parameters necessary to read time from clock chip. + */ + clk_adrshift = 1; /* Addressed at long's... */ + clk_tweak = 2; /* ...and shift two */ + clk_page = (short *)vax_map_physmem(VS_CLOCK, 1); } void @@ -142,46 +152,12 @@ void ka46_steal_pages() { extern vm_offset_t avail_start, virtual_avail, avail_end; - extern int clk_adrshift, clk_tweak; - int junk, i; + int i; /* Interrupt vector number in interrupt mask table */ inr_ni = VS4000_NI; inr_sr = VS4000_SR; inr_st = VS4000_ST; - /* - * SCB is already copied/initialized at addr avail_start - * by pmap_bootstrap(), but it's not yet mapped. Thus we use - * the MAPPHYS() macro to reserve these two pages and to - * perform the mapping. The mapped address is assigned to junk. - */ - MAPPHYS(junk, 2, VM_PROT_READ|VM_PROT_WRITE); - - /* - * Setup parameters necessary to read time from clock chip. - */ - clk_adrshift = 1; /* Addressed at long's... */ - clk_tweak = 2; /* ...and shift two */ - MAPVIRT(clk_page, 1); - pmap_map((vm_offset_t)clk_page, (vm_offset_t)KA410_WAT_BASE, - (vm_offset_t)KA410_WAT_BASE + VAX_NBPG, VM_PROT_READ|VM_PROT_WRITE); - - /* LANCE CSR & DMA memory */ - MAPVIRT(lance_csr, 1); - pmap_map((vm_offset_t)lance_csr, (vm_offset_t)NI_BASE, - (vm_offset_t)NI_BASE + VAX_NBPG, VM_PROT_READ|VM_PROT_WRITE); - - MAPVIRT(vs_cpu, 1); - pmap_map((vm_offset_t)vs_cpu, (vm_offset_t)VS_REGS, - (vm_offset_t)VS_REGS + VAX_NBPG, VM_PROT_READ|VM_PROT_WRITE); - - MAPVIRT(dz_regs, 2); - pmap_map((vm_offset_t)dz_regs, (vm_offset_t)DZ_CSR, - (vm_offset_t)DZ_CSR + VAX_NBPG, VM_PROT_READ|VM_PROT_WRITE); - - MAPVIRT(lance_addr, 1); - pmap_map((vm_offset_t)lance_addr, (vm_offset_t)NI_ADDR, - (vm_offset_t)NI_ADDR + VAX_NBPG, VM_PROT_READ|VM_PROT_WRITE); MAPPHYS(le_iomem, (NI_IOSIZE/VAX_NBPG), VM_PROT_READ|VM_PROT_WRITE); diff --git a/sys/arch/vax/vax/ka630.c b/sys/arch/vax/vax/ka630.c index 9679b5713b79..20e25b463598 100644 --- a/sys/arch/vax/vax/ka630.c +++ b/sys/arch/vax/vax/ka630.c @@ -1,4 +1,4 @@ -/* $NetBSD: ka630.c,v 1.13 1999/01/19 21:04:49 ragge Exp $ */ +/* $NetBSD: ka630.c,v 1.14 1999/02/02 18:37:21 ragge Exp $ */ /*- * Copyright (c) 1982, 1988, 1990, 1993 * The Regents of the University of California. All rights reserved. @@ -48,13 +48,13 @@ #include #include #include +#include static struct uvaxIIcpu *uvaxIIcpu_ptr; static void ka630_conf __P((struct device *, struct device *, void *)); static void ka630_memerr __P((void)); static int ka630_mchk __P((caddr_t)); -static void ka630_steal_pages __P((void)); static void ka630_halt __P((void)); static void ka630_reboot __P((int)); static void ka630_clrf __P((void)); @@ -62,7 +62,7 @@ static void ka630_clrf __P((void)); extern short *clk_page; struct cpu_dep ka630_calls = { - ka630_steal_pages, + 0, no_nicr_clock, ka630_mchk, ka630_memerr, @@ -84,6 +84,19 @@ ka630_conf(parent, self, aux) struct device *parent, *self; void *aux; { + extern int clk_adrshift, clk_tweak; + + clk_adrshift = 0; /* Addressed at short's... */ + clk_tweak = 0; /* ...and no shifting */ + clk_page = (short *)vax_map_physmem((paddr_t)KA630CLK, 1); + + uvaxIIcpu_ptr = (void *)vax_map_physmem(VS_REGS, 1); + + /* + * Enable memory parity error detection and clear error bits. + */ + uvaxIIcpu_ptr->uvaxII_mser = (UVAXIIMSER_PEN | UVAXIIMSER_MERR | + UVAXIIMSER_LEB); printf(": %s\n", "KA630"); } @@ -135,35 +148,6 @@ ka630_mchk(cmcf) return (-1); } -void -ka630_steal_pages() -{ - extern vaddr_t avail_start, virtual_avail; - extern int clk_adrshift, clk_tweak; - int junk; - - /* - * MicroVAX II: map in cpu and clock registers. - */ - MAPPHYS(junk, 2, VM_PROT_READ|VM_PROT_WRITE); - - MAPVIRT(uvaxIIcpu_ptr, 1); - pmap_map((vaddr_t)uvaxIIcpu_ptr, (vaddr_t)UVAXIICPU, - (vaddr_t)UVAXIICPU + VAX_NBPG, VM_PROT_READ|VM_PROT_WRITE); - - clk_adrshift = 0; /* Addressed at short's... */ - clk_tweak = 0; /* ...and no shifting */ - MAPVIRT(clk_page, 1); - pmap_map((vaddr_t)clk_page, (vaddr_t)KA630CLK, - (vaddr_t)KA630CLK + VAX_NBPG, VM_PROT_READ|VM_PROT_WRITE); - - /* - * Enable memory parity error detection and clear error bits. - */ - UVAXIICPU->uvaxII_mser = (UVAXIIMSER_PEN | UVAXIIMSER_MERR | - UVAXIIMSER_LEB); -} - static void ka630_halt() { diff --git a/sys/arch/vax/vax/ka650.c b/sys/arch/vax/vax/ka650.c index b18ccdc69af5..66d43221faea 100644 --- a/sys/arch/vax/vax/ka650.c +++ b/sys/arch/vax/vax/ka650.c @@ -1,4 +1,4 @@ -/* $NetBSD: ka650.c,v 1.16 1999/01/19 21:04:49 ragge Exp $ */ +/* $NetBSD: ka650.c,v 1.17 1999/02/02 18:37:21 ragge Exp $ */ /* * Copyright (c) 1988 The Regents of the University of California. * All rights reserved. @@ -54,7 +54,6 @@ #include #include #include -#include #include struct ka650_merr *ka650merr_ptr; @@ -62,7 +61,6 @@ struct ka650_cbd *ka650cbd_ptr; struct ka650_ssc *ka650ssc_ptr; struct ka650_ipcr *ka650ipcr_ptr; int *KA650_CACHE_ptr; -static int subtyp; #define CACHEOFF 0 #define CACHEON 1 @@ -72,7 +70,7 @@ static void ka650_halt __P((void)); static void ka650_reboot __P((int)); struct cpu_dep ka650_calls = { - uvaxIII_steal_pages, + 0, /* No special page stealing anymore */ no_nicr_clock, uvaxIII_mchk, uvaxIII_memerr, @@ -93,12 +91,24 @@ uvaxIII_conf(parent, self, aux) struct device *parent, *self; void *aux; { - int syssub = GETSYSSUBT(subtyp); + int syssub = GETSYSSUBT(vax_siedata); + + /* + * MicroVAX III: We map in memory error registers, + * cache control registers, SSC registers, + * interprocessor registers and cache diag space. + */ + ka650merr_ptr = (void *)vax_map_physmem(KA650_MERR, 1); + ka650cbd_ptr = (void *)vax_map_physmem(KA650_CBD, 1); + ka650ssc_ptr = (void *)vax_map_physmem(KA650_SSC, 3); + ka650ipcr_ptr = (void *)vax_map_physmem(KA650_IPCR, 1); + KA650_CACHE_ptr = (void *)vax_map_physmem(KA650_CACHE, + (KA650_CACHESIZE/VAX_NBPG)); printf(": KA6%d%d, CVAX microcode rev %d Firmware rev %d\n", syssub == VAX_SIE_KA640 ? 4 : 5, syssub == VAX_SIE_KA655 ? 5 : 0, - (vax_cpudata & 0xff), GETFRMREV(subtyp)); + (vax_cpudata & 0xff), GETFRMREV(vax_siedata)); ka650setcache(CACHEON); if (ctob(physmem) > ka650merr_ptr->merr_qbmbr) { printf("physmem(0x%x) > qbmbr(0x%x)\n", @@ -107,43 +117,6 @@ uvaxIII_conf(parent, self, aux) } } -void -uvaxIII_steal_pages() -{ - extern vm_offset_t virtual_avail; - - /* - * MicroVAX III: We map in Qbus map registers, memory - * error registers, cache control registers, SSC registers, - * interprocessor registers and cache diag space. - */ - MAPVIRT(nexus, vax_btoc(0x400000)); /* Qbus map registers */ - pmap_map((vm_offset_t)nexus, 0x20088000, 0x20090000, - VM_PROT_READ|VM_PROT_WRITE); - - MAPVIRT(ka650merr_ptr, 1); /* mem err & mem config regs */ - pmap_map((vm_offset_t)ka650merr_ptr, (vm_offset_t)KA650_MERR, - KA650_MERR + VAX_NBPG, VM_PROT_READ|VM_PROT_WRITE); - - MAPVIRT(ka650cbd_ptr, 1); /* cache control & boot/diag regs */ - pmap_map((vm_offset_t)ka650cbd_ptr, (vm_offset_t)KA650_CBD, - KA650_CBD + VAX_NBPG, VM_PROT_READ|VM_PROT_WRITE); - - MAPVIRT(ka650ssc_ptr, 3); /* SSC regs (& console prog mail box) */ - pmap_map((vm_offset_t)ka650ssc_ptr, (vm_offset_t)KA650_SSC, - KA650_SSC + VAX_NBPG * 3, VM_PROT_READ|VM_PROT_WRITE); - - MAPVIRT(ka650ipcr_ptr, 1); /* InterProcessor Com Regs */ - pmap_map((vm_offset_t)ka650ipcr_ptr, (vm_offset_t)KA650_IPCR, - KA650_IPCR + VAX_NBPG, VM_PROT_READ|VM_PROT_WRITE); - - MAPVIRT(KA650_CACHE_ptr, 128); /* Cache Diagnostic space (for flush) */ - pmap_map((vm_offset_t)KA650_CACHE_ptr, (vm_offset_t)KA650_CACHE, - KA650_CACHE + KA650_CACHESIZE, VM_PROT_READ|VM_PROT_WRITE); - - subtyp = *(int *)0x20040004; -} - void uvaxIII_memerr() { diff --git a/sys/arch/vax/vax/ka750.c b/sys/arch/vax/vax/ka750.c index 31f83b4f8441..d36b37e29ad6 100644 --- a/sys/arch/vax/vax/ka750.c +++ b/sys/arch/vax/vax/ka750.c @@ -1,4 +1,4 @@ -/* $NetBSD: ka750.c,v 1.26 1999/01/19 21:04:49 ragge Exp $ */ +/* $NetBSD: ka750.c,v 1.27 1999/02/02 18:37:21 ragge Exp $ */ /* * Copyright (c) 1982, 1986, 1988 The Regents of the University of California. * Copyright (c) 1994 Ludd, University of Lule}, Sweden. @@ -63,7 +63,7 @@ void ctuattach __P((void)); void ka750_clrf __P((void)); struct cpu_dep ka750_calls = { - ka750_steal_pages, + 0, generic_clock, ka750_mchk, ka750_memerr, @@ -260,23 +260,6 @@ ka750_mchk(cmcf) return (MCHK_PANIC); } -void -ka750_steal_pages() -{ - extern vm_offset_t avail_start, virtual_avail; - int junk; - - /* - * We take away the pages we need, one for SCB and the rest - * for UBA vectors == 1 + 2 will alloc all needed space. - * We also set up virtual area for SBI. - */ - MAPPHYS(junk, V750PGS, VM_PROT_READ|VM_PROT_WRITE); - MAPVIRT(nexus, vax_btoc(NEX750SZ)); - pmap_map((vm_offset_t)nexus, NEX750, NEX750 + NEX750SZ, - VM_PROT_READ|VM_PROT_WRITE); -} - static int cmi_print __P((void *, const char *)); static int cmi_match __P((struct device *, struct cfdata *, void *)); static void cmi_attach __P((struct device *, struct device *, void*)); @@ -319,43 +302,57 @@ cmi_attach(parent, self, aux) void *aux; { struct sbi_attach_args sa; + struct nexus *nexusP; printf("I\n"); /* * Probe for memory, can be in the first 4 slots. */ +#define NEXPAGES (sizeof(struct nexus) / VAX_NBPG) for (sa.nexnum = 0; sa.nexnum < 4; sa.nexnum++) { - if (badaddr((caddr_t)&nexus[sa.nexnum], 4)) - continue; - - sa.nexaddr = nexus + sa.nexnum; - sa.type = NEX_MEM16; - config_found(self, (void*)&sa, cmi_print); + nexusP = (struct nexus *)vax_map_physmem(NEX750 + + sizeof(struct nexus) * sa.nexnum, NEXPAGES); + if (badaddr((caddr_t)nexusP, 4)) { + vax_unmap_physmem((vaddr_t)nexusP, NEXPAGES); + } else { + sa.nexaddr = nexusP; + sa.type = NEX_MEM16; + config_found(self, (void*)&sa, cmi_print); + } } /* * Probe for mba's, can be in slot 4 - 7. */ for (sa.nexnum = 4; sa.nexnum < 7; sa.nexnum++) { - if (badaddr((caddr_t)&nexus[sa.nexnum], 4)) - continue; - - sa.nexaddr = nexus + sa.nexnum; - sa.type = NEX_MBA; - config_found(self, (void*)&sa, cmi_print); + nexusP = (struct nexus *)vax_map_physmem(NEX750 + + sizeof(struct nexus) * sa.nexnum, NEXPAGES); + if (badaddr((caddr_t)nexusP, 4)) { + vax_unmap_physmem((vaddr_t)nexusP, NEXPAGES); + } else { + sa.nexaddr = nexusP; + sa.type = NEX_MBA; + config_found(self, (void*)&sa, cmi_print); + } } /* * There are always one generic UBA, and maybe an optional. */ sa.nexnum = 8; - sa.nexaddr = nexus + sa.nexnum; + sa.nexaddr = (struct nexus *)vax_map_physmem(NEX750 + + sizeof(struct nexus) * sa.nexnum, NEXPAGES); sa.type = NEX_UBA0; config_found(self, (void*)&sa, cmi_print); - sa.type = NEX_UBA1; - if (badaddr((caddr_t)&nexus[++sa.nexnum], 4) == 0) - config_found(self, (void*)&sa, cmi_print); + sa.nexnum = 9; + sa.nexaddr = (struct nexus *)vax_map_physmem(NEX750 + + sizeof(struct nexus) * sa.nexnum, NEXPAGES); + sa.type = NEX_UBA1; + if (badaddr((caddr_t)nexusP, 4)) + vax_unmap_physmem((vaddr_t)sa.nexaddr, NEXPAGES); + else + config_found(self, (void*)&sa, cmi_print); } void diff --git a/sys/arch/vax/vax/ka780.c b/sys/arch/vax/vax/ka780.c index 4521af9f4b5c..086aa4eea453 100644 --- a/sys/arch/vax/vax/ka780.c +++ b/sys/arch/vax/vax/ka780.c @@ -1,4 +1,4 @@ -/* $NetBSD: ka780.c,v 1.11 1999/01/19 21:04:49 ragge Exp $ */ +/* $NetBSD: ka780.c,v 1.12 1999/02/02 18:37:21 ragge Exp $ */ /*- * Copyright (c) 1982, 1986, 1988 The Regents of the University of California. * All rights reserved. @@ -61,13 +61,12 @@ static void ka780_conf __P((struct device *, struct device *, void *)); void ka780_memenable __P((struct sbi_attach_args *, void *)); static void ka780_memerr __P((void)); static int ka780_mchk __P((caddr_t)); -static void ka780_steal_pages __P((void)); /* * Declaration of 780-specific calls. */ struct cpu_dep ka780_calls = { - ka780_steal_pages, + 0, generic_clock, ka780_mchk, ka780_memerr, @@ -334,16 +333,3 @@ ka780_conf(parent, self, aux) printf("no FPA\n"); } - -void -ka780_steal_pages() -{ - extern vm_offset_t avail_start, virtual_avail; - extern struct nexus *nexus; - int junk; - - MAPPHYS(junk, 4, VM_PROT_READ|VM_PROT_WRITE); - MAPVIRT(nexus, vax_btoc(8192*16)); - pmap_map((vm_offset_t)nexus, 0x20000000, 0x20020000, - VM_PROT_READ|VM_PROT_WRITE); -} diff --git a/sys/arch/vax/vax/ka820.c b/sys/arch/vax/vax/ka820.c index d47596147b8d..b6e0e3b65cf5 100644 --- a/sys/arch/vax/vax/ka820.c +++ b/sys/arch/vax/vax/ka820.c @@ -1,4 +1,4 @@ -/* $NetBSD: ka820.c,v 1.13 1999/01/19 21:04:49 ragge Exp $ */ +/* $NetBSD: ka820.c,v 1.14 1999/02/02 18:37:21 ragge Exp $ */ /* * Copyright (c) 1988 Regents of the University of California. * All rights reserved. @@ -67,7 +67,6 @@ struct ka820port *ka820port_ptr; struct rx50device *rx50device_ptr; -void *bi_nodebase; /* virtual base address for all possible bi nodes */ static int ka820_match __P((struct device *, struct cfdata *, void *)); static void ka820_attach __P((struct device *, struct device *, void*)); @@ -75,7 +74,7 @@ static void rxcdintr __P((int)); void crxintr __P((int)); struct cpu_dep ka820_calls = { - ka820_steal_pages, + 0, generic_clock, ka820_mchk, ka820_memerr, @@ -97,51 +96,6 @@ char bootram[KA820_BRPAGES * VAX_NBPG]; char eeprom[KA820_EEPAGES * VAX_NBPG]; #endif -void -ka820_steal_pages() -{ - extern vm_offset_t avail_start, virtual_avail; - extern short *clk_page; - extern int clk_adrshift, clk_tweak; - struct scb *sb; - int junk; - - /* - * On the ka820, we map in the port CSR, the clock registers - * and the console RX50 register. We also map in the BI nodespace - * for all possible (16) nodes. It would only be needed with - * the existent nodes, but we only loose 1K so... - * Another waste of memory is the 8K block after SCB, which is - * used for (eventually) DWBUA and KLESI interrupt vectors. - * This is only needed for the existing devices, but is allocated - * for all possible devices. - */ - sb = (void *)avail_start; - MAPPHYS(junk, 2, VM_PROT_READ|VM_PROT_WRITE); /* SCB & vectors */ - MAPPHYS(junk, NNODEBI, VM_PROT_READ|VM_PROT_WRITE); /* BI ivec's */ - clk_adrshift = 0; /* clk regs are addressed at short's */ - clk_tweak = 1; /* ...but not exactly in each short */ - MAPVIRT(clk_page, 1); - pmap_map((vm_offset_t)clk_page, (vm_offset_t)KA820_CLOCKADDR, - KA820_CLOCKADDR + VAX_NBPG, VM_PROT_READ|VM_PROT_WRITE); - - MAPVIRT(ka820port_ptr, 1); - pmap_map((vm_offset_t)ka820port_ptr, (vm_offset_t)KA820_PORTADDR, - KA820_PORTADDR + VAX_NBPG, VM_PROT_READ|VM_PROT_WRITE); - - MAPVIRT(rx50device_ptr, 1); - pmap_map((vm_offset_t)rx50device_ptr, (vm_offset_t)KA820_RX50ADDR, - KA820_RX50ADDR + VAX_NBPG, VM_PROT_READ|VM_PROT_WRITE); - - MAPVIRT(bi_nodebase, NNODEBI * (sizeof(struct bi_node) / VAX_NBPG)); - pmap_map((vm_offset_t)bi_nodebase, (vm_offset_t)BI_BASE(0,0), - BI_BASE(0,0) + sizeof(struct bi_node) * NNODEBI, - VM_PROT_READ|VM_PROT_WRITE); - - /* Steal the interrupt vectors that are unique for us */ - scb_vecalloc(KA820_INT_RXCD, rxcdintr, 0, SCB_ISTACK); -} - int ka820_match(parent, cf, aux) struct device *parent; @@ -170,6 +124,8 @@ ka820_attach(parent, self, aux) { struct bi_attach_args *ba = aux; register int csr; + extern short *clk_page; + extern int clk_adrshift, clk_tweak; u_short rev = ba->ba_node->biic.bi_revs; extern char cpu_model[]; @@ -190,6 +146,16 @@ ka820_attach(parent, self, aux) /* XXX - should be done somewhere else */ scb_vecalloc(SCB_RX50, crxintr, 0, SCB_ISTACK); + + clk_adrshift = 0; /* clk regs are addressed at short's */ + clk_tweak = 1; /* ...but not exactly in each short */ + clk_page = (short *)vax_map_physmem((paddr_t)KA820_CLOCKADDR, 1); + + /* Steal the interrupt vectors that are unique for us */ + scb_vecalloc(KA820_INT_RXCD, rxcdintr, 0, SCB_ISTACK); + + rx50device_ptr = (void *)vax_map_physmem(KA820_RX50ADDR, 1); + ka820port_ptr = (void *)vax_map_physmem(KA820_PORTADDR, 1); } /* diff --git a/sys/arch/vax/vax/ka860.c b/sys/arch/vax/vax/ka860.c index 558a7e4b7cb0..2efd37237c93 100644 --- a/sys/arch/vax/vax/ka860.c +++ b/sys/arch/vax/vax/ka860.c @@ -1,4 +1,4 @@ -/* $NetBSD: ka860.c,v 1.12 1999/01/19 21:04:49 ragge Exp $ */ +/* $NetBSD: ka860.c,v 1.13 1999/02/02 18:37:21 ragge Exp $ */ /* * Copyright (c) 1986, 1988 Regents of the University of California. * All rights reserved. @@ -53,20 +53,17 @@ #include #include -struct ioa *ioa; - void ka86_conf __P((struct device *, struct device *, void *)); void ka86_memenable __P((struct sbi_attach_args *, struct device *)); void ka86_memerr __P((void)); int ka86_mchk __P((caddr_t)); -void ka86_steal_pages __P((void)); void ka86_reboot __P((int)); void ka86_clrf __P((void)); void crlattach __P((void)); struct cpu_dep ka860_calls = { - ka86_steal_pages, + 0, generic_clock, ka86_mchk, ka86_memerr, @@ -272,35 +269,6 @@ ka86_mchk(cmcf) return (MCHK_PANIC); } -void -ka86_steal_pages() -{ - extern vm_offset_t avail_start, virtual_avail; - extern struct nexus *nexus; - int junk; - - /* 8600 may have 2 SBI's == 4 pages */ - MAPPHYS(junk, 4, VM_PROT_READ|VM_PROT_WRITE); - - /* Map in ioa register space */ - MAPVIRT(ioa, MAXNIOA); - pmap_map((vm_offset_t)ioa, (u_int)IOA8600(0), - (u_int)IOA8600(0) + IOAMAPSIZ, VM_PROT_READ|VM_PROT_WRITE); - pmap_map((vm_offset_t)ioa + IOAMAPSIZ, (u_int)IOA8600(1), - (u_int)IOA8600(1) + IOAMAPSIZ, VM_PROT_READ|VM_PROT_WRITE); - pmap_map((vm_offset_t)ioa + 2 * IOAMAPSIZ, (u_int)IOA8600(2), - (u_int)IOA8600(2) + IOAMAPSIZ, VM_PROT_READ|VM_PROT_WRITE); - pmap_map((vm_offset_t)ioa + 3 * IOAMAPSIZ, (u_int)IOA8600(3), - (u_int)IOA8600(3) + IOAMAPSIZ, VM_PROT_READ|VM_PROT_WRITE); - - /* Map in possible nexus space */ - MAPVIRT(nexus, vax_btoc(NEXSIZE * MAXNNEXUS)); - pmap_map((vm_offset_t)nexus, (u_int)NEXA8600, - (u_int)NEXA8600 + NNEX8600 * NEXSIZE, VM_PROT_READ|VM_PROT_WRITE); - pmap_map((vm_offset_t)&nexus[NNEXSBI], (u_int)NEXB8600, - (u_int)NEXB8600 + NNEX8600 * NEXSIZE, VM_PROT_READ|VM_PROT_WRITE); -} - struct ka86 { unsigned snr:12, plant:4, diff --git a/sys/arch/vax/vax/machdep.c b/sys/arch/vax/vax/machdep.c index 36adc240efa5..72a6425b0fa4 100644 --- a/sys/arch/vax/vax/machdep.c +++ b/sys/arch/vax/vax/machdep.c @@ -1,4 +1,4 @@ -/* $NetBSD: machdep.c,v 1.70 1999/01/19 21:04:49 ragge Exp $ */ +/* $NetBSD: machdep.c,v 1.71 1999/02/02 18:37:21 ragge Exp $ */ /* * Copyright (c) 1994, 1998 Ludd, University of Lule}, Sweden. @@ -144,6 +144,9 @@ int physmem; int todrstopped = 0; int dumpsize = 0; +#define IOMAPSZ 100 +static struct map iomap[IOMAPSZ]; + caddr_t allocsys __P((caddr_t)); #define valloclim(name, type, num, lim) \ @@ -172,6 +175,10 @@ vm_map_t mb_map = NULL; vm_map_t phys_map = NULL; #endif +#ifdef DEBUG +int iospace_inited = 0; +#endif + void cpu_startup() { @@ -477,6 +484,16 @@ void consinit() { extern int smgprobe(void), smgcninit(void); + + /* + * Init I/O memory resource map. Must be done before cninit() + * is called; we may want to use iospace in the console routines. + */ + rminit(iomap, IOSPSZ, (long)1, "iomap", IOMAPSZ); +#ifdef DEBUG + iospace_inited = 1; +#endif + cninit(); #if NSMG /* XXX - do this probe after everything else due to wscons trouble */ @@ -488,7 +505,9 @@ consinit() extern int end; /* Contains pointer to symsize also */ extern int *esym; - ddb_init(*(int *)&end, ((int *)&end) + 1, esym); + extern void ksym_init(int *, int *); + ksym_init(&end, esym); +// ddb_init(*(int *)&end, ((int *)&end) + 1, esym); } #ifdef donotworkbyunknownreason if (boothowto & RB_KDB) @@ -844,22 +863,61 @@ process_sstep(p, sstep) return (0); } -#ifdef notyet +#undef PHYSMEMDEBUG /* * Allocates a virtual range suitable for mapping in physical memory. * This differs from the bus_space routines in that it allocates on - * physical page sizes instead of logical sizes. + * physical page sizes instead of logical sizes. This implementation + * uses resource maps when allocating space, which is allocated from + * the IOMAP submap. The implementation is similar to the uba resource + * map handling. Size is given in pages. + * + * It is known that the first page in the iospace area is unused; it may + * be use by console device drivers (before the map system is inited). */ vaddr_t vax_map_physmem(phys, size) paddr_t phys; - psize_t size; + int size; { + extern vaddr_t iospace; + vaddr_t addr; + int pageno; + static int warned = 0; - if (size > NBPG) { /* Need to alloc new virtual chunk */ - - } else { - - } -} +#ifdef DEBUG + if (!iospace_inited) + panic("vax_map_physmem: called before rminit()?!?"); #endif + pageno = rmalloc(iomap, size); + if (pageno == 0) { + if (warned++ == 0) /* Warn only once */ + printf("vax_map_physmem: iomap too small\n"); + return 0; + } + addr = iospace + (pageno * VAX_NBPG); + ioaccess(addr, phys, size); +#ifdef PHYSMEMDEBUG + printf("vax_map_physmem: alloc'ed %d pages for paddr %lx, at %lx\n", + size, phys, addr); +#endif + return addr; +} + +/* + * Unmaps the previous mapped (addr, size) pair. + */ +void +vax_unmap_physmem(addr, size) + vaddr_t addr; + int size; +{ + extern vaddr_t iospace; + int pageno = (addr - iospace) / VAX_NBPG; +#ifdef PHYSMEMDEBUG + printf("vax_unmap_physmem: unmapping %d pages at addr %lx\n", + size, addr); +#endif + rmfree(iomap, pageno, size); + iounaccess(addr, size); +} diff --git a/sys/arch/vax/vax/pmap.c b/sys/arch/vax/vax/pmap.c index ca860645b3d0..e2816fbf9c54 100644 --- a/sys/arch/vax/vax/pmap.c +++ b/sys/arch/vax/vax/pmap.c @@ -1,4 +1,4 @@ -/* $NetBSD: pmap.c,v 1.58 1999/01/19 22:57:47 ragge Exp $ */ +/* $NetBSD: pmap.c,v 1.59 1999/02/02 18:37:21 ragge Exp $ */ /* * Copyright (c) 1994, 1998 Ludd, University of Lule}, Sweden. * All rights reserved. @@ -87,6 +87,7 @@ struct pmap kernel_pmap_store; struct pte *Sysmap; /* System page table */ struct pv_entry *pv_table; /* array of entries, one per LOGICAL page */ void *scratch; +vaddr_t iospace; vaddr_t ptemapstart, ptemapend; vm_map_t pte_map; @@ -160,6 +161,8 @@ pmap_bootstrap() sysptsize += ((USRPTSIZE * 4) / VAX_NBPG) * maxproc; /* Kernel stacks per process */ sysptsize += UPAGES * maxproc; + /* IO device register space */ + sysptsize += IOSPSZ; #endif /* @@ -232,11 +235,14 @@ pmap_bootstrap() MAPVIRT(qd_ubaio, 16); #endif + MAPVIRT(iospace, IOSPSZ); /* Device iospace mapping area */ + /* Init SCB and set up stray vectors. */ avail_start = scb_init(avail_start); bzero(0, VAX_NBPG >> 1); - (*dep_call->cpu_steal_pages)(); + if (dep_call->cpu_steal_pages) + (*dep_call->cpu_steal_pages)(); avail_start = ROUND_PAGE(avail_start); virtual_avail = ROUND_PAGE(virtual_avail); diff --git a/sys/arch/vax/vax/sbi.c b/sys/arch/vax/vax/sbi.c index c039de0739b0..7f5c3359ef38 100644 --- a/sys/arch/vax/vax/sbi.c +++ b/sys/arch/vax/vax/sbi.c @@ -1,4 +1,4 @@ -/* $NetBSD: sbi.c,v 1.18 1998/04/13 12:10:28 ragge Exp $ */ +/* $NetBSD: sbi.c,v 1.19 1999/02/02 18:37:21 ragge Exp $ */ /* * Copyright (c) 1994 Ludd, University of Lule}, Sweden. * All rights reserved. @@ -92,19 +92,24 @@ sbi_attach(parent, self, aux) * in different ways (if they identifies themselves at all). * We have to fake identifying depending on different CPUs. */ +#define NEXPAGES (sizeof(struct nexus) / VAX_NBPG) minnex = self->dv_unit * NNEXSBI; for (nexnum = minnex; nexnum < minnex + NNEXSBI; nexnum++) { + struct nexus *nexusP; volatile int tmp; - if (badaddr((caddr_t)&nexus[nexnum], 4)) - continue; + nexusP = (struct nexus *)vax_map_physmem((paddr_t)NEXA8600 + + sizeof(struct nexus) * nexnum, NEXPAGES); + if (badaddr((caddr_t)nexusP, 4)) { + vax_unmap_physmem((vaddr_t)nexusP, NEXPAGES); + } else { + tmp = nexusP->nexcsr.nex_csr; /* no byte reads */ + sa.type = tmp & 255; - tmp = nexus[nexnum].nexcsr.nex_csr; /* no byte reads */ - sa.type = tmp & 255; - - sa.nexnum = nexnum; - sa.nexaddr = nexus + nexnum; - config_found(self, (void*)&sa, sbi_print); + sa.nexnum = nexnum; + sa.nexaddr = nexusP; + config_found(self, (void*)&sa, sbi_print); + } } } diff --git a/sys/arch/vax/vax/vm_machdep.c b/sys/arch/vax/vax/vm_machdep.c index 4fc69155f317..116af3766aa7 100644 --- a/sys/arch/vax/vax/vm_machdep.c +++ b/sys/arch/vax/vax/vm_machdep.c @@ -1,4 +1,4 @@ -/* $NetBSD: vm_machdep.c,v 1.44 1999/01/01 21:43:19 ragge Exp $ */ +/* $NetBSD: vm_machdep.c,v 1.45 1999/02/02 18:37:21 ragge Exp $ */ /* * Copyright (c) 1994 Ludd, University of Lule}, Sweden. @@ -342,3 +342,35 @@ vunmapbuf(bp, len) bp->b_saveaddr = 0; } #endif + +/* + * Map in a bunch of pages read/writeable for the kernel. + */ +void +ioaccess(vaddr, paddr, npgs) + vaddr_t vaddr; + paddr_t paddr; + int npgs; +{ + u_int *pte = (u_int *)kvtopte(vaddr); + int i; + + for (i = 0; i < npgs; i++) + pte[i] = PG_V | PG_KW | (PG_PFNUM(paddr) + i); +} + +/* + * Opposite to the above: just forget their mapping. + */ +void +iounaccess(vaddr, npgs) + vaddr_t vaddr; + int npgs; +{ + u_int *pte = (u_int *)kvtopte(vaddr); + int i; + + for (i = 0; i < npgs; i++) + pte[i] = 0; + mtpr(0, PR_TBIA); +} diff --git a/sys/arch/vax/vsa/dz_vsbus.c b/sys/arch/vax/vsa/dz_vsbus.c index 18ec7732a4dd..861479bcd7e0 100644 --- a/sys/arch/vax/vsa/dz_vsbus.c +++ b/sys/arch/vax/vsa/dz_vsbus.c @@ -1,4 +1,4 @@ -/* $NetBSD: dz_vsbus.c,v 1.6 1998/08/10 14:47:16 ragge Exp $ */ +/* $NetBSD: dz_vsbus.c,v 1.7 1999/02/02 18:37:21 ragge Exp $ */ /* * Copyright (c) 1998 Ludd, University of Lule}, Sweden. * All rights reserved. @@ -48,6 +48,8 @@ #include #include #include +#include + #include #include @@ -62,6 +64,8 @@ static int dz_print __P((void *, const char *)); static void txon __P((void)); static void rxon __P((void)); +static vaddr_t dz_regs; /* Used for console */ + struct cfattach dz_vsbus_ca = { sizeof(struct dz_softc), dz_vsbus_match, dz_vsbus_attach }; @@ -155,10 +159,12 @@ dzcngetc(dev) int c = 0; int mino = minor(dev); u_short rbuf; +#if 0 u_char mask; mask = vs_cpu->vc_intmsk; /* save old state */ vs_cpu->vc_intmsk = 0; /* disable all interrupts */ +#endif do { while ((dz->csr & 0x80) == 0) @@ -172,8 +178,10 @@ dzcngetc(dev) if (c == 13) c = 10; +#if 0 vs_cpu->vc_intclr = 0x80; /* clear te interrupt request */ vs_cpu->vc_intmsk = mask; /* restore interrupt mask */ +#endif return (c); } @@ -184,6 +192,7 @@ void dzcnprobe(cndev) struct consdev *cndev; { + extern vaddr_t iospace; switch (vax_boardtype) { case VAX_BTYP_410: @@ -191,6 +200,8 @@ dzcnprobe(cndev) case VAX_BTYP_43: case VAX_BTYP_46: cndev->cn_dev = makedev(DZMAJOR, 3); + dz_regs = iospace; + ioaccess(iospace, 0x200A0000, 1); cndev->cn_pri = CN_NORMAL; break; @@ -222,13 +233,17 @@ dzcnputc(dev,ch) int timeout = 1<<15; /* don't hang the machine! */ int mino = minor(dev); u_short tcr; +#if 0 u_char mask; +#endif if (mfpr(PR_MAPEN) == 0) return; +#if 0 mask = vs_cpu->vc_intmsk; /* save old state */ vs_cpu->vc_intmsk = 0; /* disable all interrupts */ +#endif tcr = dz->tcr; /* remember which lines to scan */ dz->tcr = (1 << mino); @@ -238,7 +253,9 @@ dzcnputc(dev,ch) dz->tdr = ch; /* Put the character */ dz->tcr = tcr; +#if 0 vs_cpu->vc_intmsk = mask; /* restore interrupt mask */ +#endif } void @@ -269,10 +286,12 @@ lkccngetc(dev) { int lkc_decode(int); int c; +#if 0 u_char mask; mask = vs_cpu->vc_intmsk; /* save old state */ vs_cpu->vc_intmsk = 0; /* disable all interrupts */ +#endif loop: while ((dz->csr & 0x80) == 0) @@ -282,8 +301,10 @@ loop: if (c < 1) goto loop; +#if 0 vs_cpu->vc_intclr = 0x80; /* clear te interrupt request */ vs_cpu->vc_intmsk = mask; /* restore interrupt mask */ +#endif return (c); } diff --git a/sys/arch/vax/vsa/if_ln.c b/sys/arch/vax/vsa/if_ln.c index 157ab387ddb5..4bd3d7362871 100644 --- a/sys/arch/vax/vsa/if_ln.c +++ b/sys/arch/vax/vsa/if_ln.c @@ -1,4 +1,4 @@ -/* $NetBSD: if_ln.c,v 1.8 1998/08/15 10:51:17 mycroft Exp $ */ +/* $NetBSD: if_ln.c,v 1.9 1999/02/02 18:37:21 ragge Exp $ */ /*- * Copyright (c) 1997, 1998 The NetBSD Foundation, Inc. @@ -215,6 +215,9 @@ static inline void ln_tint __P((struct ln_softc *)); static inline void ln_read __P((struct ln_softc *, caddr_t, int)); void ln_reset __P((struct ln_softc *)); +static short *lance_csr; /* LANCE CSR virtual address */ +static int *lance_addr; /* Ethernet address */ + struct cfattach ln_ca = { sizeof(struct ln_softc), lnmatch, lnattach }; @@ -232,10 +235,12 @@ lnmatch(parent, cf, aux) { struct vsbus_attach_args *va = aux; -#ifdef DIAGNOSTIC + if (lance_csr == 0) + lance_csr = (short *)vax_map_physmem(NI_BASE, 1); if (lance_csr == 0) return 0; -#endif + if (lance_addr == 0) + lance_addr = (int *)vax_map_physmem(NI_ADDR, 1); if (va->va_type == inr_ni) return 2; return 0; diff --git a/sys/arch/vax/vsa/ncr.c b/sys/arch/vax/vsa/ncr.c index 7fd0dccb5834..718f13424004 100644 --- a/sys/arch/vax/vsa/ncr.c +++ b/sys/arch/vax/vsa/ncr.c @@ -1,4 +1,4 @@ -/* $NetBSD: ncr.c,v 1.16 1998/12/06 13:55:09 ragge Exp $ */ +/* $NetBSD: ncr.c,v 1.17 1999/02/02 18:37:21 ragge Exp $ */ /*- * Copyright (c) 1996 The NetBSD Foundation, Inc. @@ -98,6 +98,8 @@ static struct scsipi_device si_dev = { NULL, /* Use default "done" routine. */ }; +static caddr_t sca_regs; + static int si_match(struct device *, struct cfdata *, void *); static void si_attach(struct device *, struct device *, void *); static void si_minphys(struct buf *); @@ -124,6 +126,8 @@ si_match(parent, cf, aux) { struct vsbus_attach_args *va = aux; + if (sca_regs == 0) + sca_regs = (caddr_t)vax_map_physmem(SCA_REGS, 1); if (va->va_type == 0x200C0080) return 1; return 0; diff --git a/sys/arch/vax/vsa/smg.c b/sys/arch/vax/vsa/smg.c index 35f47e3630b1..f6a84822a047 100644 --- a/sys/arch/vax/vsa/smg.c +++ b/sys/arch/vax/vsa/smg.c @@ -1,4 +1,4 @@ -/* $NetBSD: smg.c,v 1.11 1999/01/11 21:54:23 drochner Exp $ */ +/* $NetBSD: smg.c,v 1.12 1999/02/02 18:37:21 ragge Exp $ */ /* * Copyright (c) 1998 Ludd, University of Lule}, Sweden. * All rights reserved. @@ -46,6 +46,7 @@ #include #include +#include #include "lkc.h" @@ -101,6 +102,8 @@ const struct wsscreen_list smg_screenlist = { _smg_scrlist, }; +static caddr_t sm_addr; + extern char q_font[]; #define QCHAR(c) (c < 32 ? 32 : (c > 127 ? c - 66 : c - 32)) #define QFONT(c,line) q_font[QCHAR(c) * 15 + line] @@ -145,10 +148,11 @@ smg_match(parent, match, aux) if (va->va_type != inr_vf) return 0; -#ifdef DIAGNOSTIC + if (sm_addr == 0) - panic("smg: inconsistency in smg address mapping"); -#endif + sm_addr = (caddr_t)vax_map_physmem(SMADDR, (SMSIZE/VAX_NBPG)); + if (sm_addr == 0) + return 0; return 1; } @@ -465,8 +469,9 @@ smgprobe() case VAX_BTYP_43: if (vax_confdata & 0x20) /* doesn't use graphics console */ break; - if (sm_addr == 0) /* Haven't mapped graphic area */ - break; + sm_addr = (caddr_t)vax_map_physmem(SMADDR, (SMSIZE/VAX_NBPG)); + if (sm_addr == 0) + return 0; return 1; diff --git a/sys/arch/vax/vsa/vsbus.c b/sys/arch/vax/vsa/vsbus.c index 7dc7c7b32866..a87aa6fd2cb3 100644 --- a/sys/arch/vax/vsa/vsbus.c +++ b/sys/arch/vax/vsa/vsbus.c @@ -1,4 +1,4 @@ -/* $NetBSD: vsbus.c,v 1.13 1998/12/06 14:33:54 ragge Exp $ */ +/* $NetBSD: vsbus.c,v 1.14 1999/02/02 18:37:21 ragge Exp $ */ /* * Copyright (c) 1996 Ludd, University of Lule}, Sweden. * All rights reserved. @@ -70,6 +70,8 @@ int vsbus_print __P((void *, const char *)); void ka410_attach __P((struct device *, struct device *, void *)); void ka43_attach __P((struct device *, struct device *, void *)); +static struct vs_cpu *vs_cpu; + #define VSBUS_MAXINTR 8 struct vsbus_softc { @@ -127,6 +129,8 @@ vsbus_attach(parent, self, aux) struct vsbus_attach_args va; printf("\n"); + + vs_cpu = (void *)vax_map_physmem(VS_REGS, 1); /* * first setup interrupt-table, so that devices can register * their interrupt-routines... @@ -145,11 +149,9 @@ vsbus_attach(parent, self, aux) config_found(self, &va, vsbus_print); /* If sm_addr is set, a monochrome graphics adapter is found */ - /* XXX ckeck for color adapter */ - if (sm_addr) { - va.va_type = inr_vf; - config_found(self, &va, vsbus_print); - } + /* XXX - fixa! */ + va.va_type = inr_vf; + config_found(self, &va, vsbus_print); /* XXX - Avoid searching for SCSI on 4000/60 */ if (vax_boardtype == VAX_BTYP_46) diff --git a/sys/dev/dec/qbus/uba.c b/sys/dev/dec/qbus/uba.c index 054bf926324a..f53f4ff806b9 100644 --- a/sys/dev/dec/qbus/uba.c +++ b/sys/dev/dec/qbus/uba.c @@ -1,4 +1,4 @@ -/* $NetBSD: uba.c,v 1.41 1999/01/19 22:57:47 ragge Exp $ */ +/* $NetBSD: uba.c,v 1.42 1999/02/02 18:37:20 ragge Exp $ */ /* * Copyright (c) 1996 Jonathan Stone. * Copyright (c) 1994, 1996 Ludd, University of Lule}, Sweden. @@ -408,11 +408,8 @@ qba_attach(parent, self, aux) void *aux; { struct uba_softc *sc = (void *)self; - vm_offset_t mini, maxi; printf(": Q22\n"); - - /* * Fill in bus specific data. */ @@ -429,16 +426,8 @@ qba_attach(parent, self, aux) * Map in the UBA page map into kernel space. On other UBAs, * the map registers are in the bus IO space. */ -#if defined(UVM) - (void)uvm_km_suballoc(kernel_map, &mini, &maxi, - QBAPAGES * sizeof(struct pte), FALSE, FALSE, NULL); -#else - (void)kmem_suballoc(kernel_map, &mini, &maxi, - QBAPAGES * sizeof(struct pte), FALSE); -#endif - pmap_map(mini, QBAMAP, QBAMAP + QBAPAGES * sizeof(struct pte), - VM_PROT_READ | VM_PROT_WRITE); - sc->uh_mr = (void *)mini; + sc->uh_mr = (void *)vax_map_physmem(QBAMAP, + (QBAPAGES * sizeof(struct pte)) / VAX_NBPG); uba_attach(sc, QIOPAGE); } @@ -804,9 +793,8 @@ qbgetpri() void uba_attach(sc, iopagephys) struct uba_softc *sc; - unsigned long iopagephys; + paddr_t iopagephys; { - vm_offset_t mini, maxi; /* * Set last free interrupt vector for devices with @@ -818,18 +806,10 @@ uba_attach(sc, iopagephys) /* * Allocate place for unibus memory in virtual space. - * This is done with kmem_suballoc() but after that - * never used in the vm system. Is it OK to do so? */ -#if defined(UVM) - (void)uvm_km_suballoc(kernel_map, &mini, &maxi, UBAIOPAGES * VAX_NBPG, - FALSE, FALSE, NULL); -#else - (void)kmem_suballoc(kernel_map, &mini, &maxi, UBAIOPAGES * VAX_NBPG, FALSE); -#endif - pmap_map(mini, iopagephys, iopagephys + UBAIOPAGES * VAX_NBPG, - VM_PROT_READ|VM_PROT_WRITE); - sc->uh_iopage = (void *)mini; + sc->uh_iopage = (caddr_t)vax_map_physmem(iopagephys, UBAIOPAGES); + if (sc->uh_iopage == 0) + return; /* vax_map_physmem() will complain for us */ /* * Initialize the UNIBUS, by freeing the map * registers and the buffered data path registers