From e86bc96653b1e8092bcbbafc003d24b9aa6a2bfc Mon Sep 17 00:00:00 2001 From: ragge Date: Wed, 19 Feb 1997 10:04:09 +0000 Subject: [PATCH] Basic change to cpu-config code. This will make support of new cpu types much easier. --- sys/arch/vax/include/cpu.h | 18 ++- sys/arch/vax/include/ka410.h | 6 +- sys/arch/vax/include/uvax.h | 19 ++-- sys/arch/vax/vax/autoconf.c | 104 ++--------------- sys/arch/vax/vax/clock.c | 34 +----- sys/arch/vax/vax/ka410.c | 139 ++++++++++------------ sys/arch/vax/vax/ka43.c | 64 +++++------ sys/arch/vax/vax/ka630.c | 78 ++++++------- sys/arch/vax/vax/ka650.c | 18 ++- sys/arch/vax/vax/ka750.c | 21 +++- sys/arch/vax/vax/ka780.c | 29 ++++- sys/arch/vax/vax/ka820.c | 17 ++- sys/arch/vax/vax/ka860.c | 19 +++- sys/arch/vax/vax/locore.c | 41 ++++++- sys/arch/vax/vax/machdep.c | 10 +- sys/arch/vax/vax/pmap.c | 4 +- sys/arch/vax/vax/uvax.c | 215 +++-------------------------------- 17 files changed, 313 insertions(+), 523 deletions(-) diff --git a/sys/arch/vax/include/cpu.h b/sys/arch/vax/include/cpu.h index d92cbed9dbcf..5e0301b94384 100644 --- a/sys/arch/vax/include/cpu.h +++ b/sys/arch/vax/include/cpu.h @@ -1,4 +1,4 @@ -/* $NetBSD: cpu.h,v 1.21 1997/02/12 17:58:57 ragge Exp $ */ +/* $NetBSD: cpu.h,v 1.22 1997/02/19 10:06:03 ragge Exp $ */ /* * Copyright (c) 1994 Ludd, University of Lule}, Sweden @@ -30,20 +30,21 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ - /* All bugs are subject to removal without further notice */ - #include #include #include #include +#include #define enablertclock() #define cpu_wait(p) #define cpu_swapout(p) -extern struct cpu_dep cpu_calls[]; - +/* + * All cpu-dependent info is kept in this struct. Pointer to the + * struct for the current cpu is set up in locore.c. + */ struct cpu_dep { void (*cpu_steal_pages) __P((void)); /* pmap init before mm is on */ void (*cpu_clock) __P((void)); /* CPU dep RT clock start */ @@ -53,8 +54,15 @@ struct cpu_dep { void (*cpu_conf) __P((struct device *, struct device *, void *)); int (*cpu_clkread) __P((time_t)); /* Read cpu clock time */ void (*cpu_clkwrite) __P((void)); /* Write system time to cpu */ + int cpu_vups; /* speed of cpu */ + u_char *cpu_intreq; /* Used on some VAXstations */ + u_char *cpu_intclr; /* Used on some VAXstations */ + u_char *cpu_intmsk; /* Used on some VAXstations */ + struct uc_map *cpu_map; /* Map containing important addresses */ }; +extern struct cpu_dep *dep_call; /* Holds pointer to current CPU struct. */ + struct clockframe { int pc; int ps; diff --git a/sys/arch/vax/include/ka410.h b/sys/arch/vax/include/ka410.h index 379cf9840579..6aa2f0667ae5 100644 --- a/sys/arch/vax/include/ka410.h +++ b/sys/arch/vax/include/ka410.h @@ -1,4 +1,4 @@ -/* $NetBSD: ka410.h,v 1.1 1996/07/20 17:58:14 ragge Exp $ */ +/* $NetBSD: ka410.h,v 1.2 1997/02/19 10:06:05 ragge Exp $ */ /* * Copyright (c) 1996 Ludd, University of Lule}, Sweden. * All rights reserved. @@ -64,7 +64,7 @@ /* * Other fixed addresses which should be mapped */ -#define KA410_CPU_BASE 0x20080000 +#define KA410_CPU_BASE ((struct ka410_cpu *)0x20080000) #define KA410_CPU_END 0x200800FF #define KA410_CPU_SIZE 0x100 #define KA410_NWA_BASE 0x20090000 /* Network Address ROM */ @@ -73,7 +73,7 @@ #define KA410_SER_BASE 0x200A0000 /* Serial line controller */ #define KA410_SER_END 0x200A000F #define KA410_SER_SIZE 0x10 -#define KA410_WAT_BASE 0x200B0000 /* TOY clock and NV-RAM */ +#define KA410_WAT_BASE ((struct ka410_clock *)0x200B0000)/* TOY clock */ #define KA410_WAT_END 0x200B00FF #define KA410_WAT_SIZE 0x100 #define KA410_DKC_BASE 0x200C0000 /* Disk Controller Ports */ diff --git a/sys/arch/vax/include/uvax.h b/sys/arch/vax/include/uvax.h index df7bc81f6a6f..1c95d5698111 100644 --- a/sys/arch/vax/include/uvax.h +++ b/sys/arch/vax/include/uvax.h @@ -1,4 +1,4 @@ -/* $NetBSD: uvax.h,v 1.1 1996/07/20 17:58:24 ragge Exp $ */ +/* $NetBSD: uvax.h,v 1.2 1997/02/19 10:06:07 ragge Exp $ */ /* * Copyright (c) 1996 Ludd, University of Lule}, Sweden. * All rights reserved. @@ -32,6 +32,9 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +#ifndef _VAX_UVAX_H_ +#define _VAX_UVAX_H_ + /* * generic(?) MicroVAX and VAXstation support * @@ -51,26 +54,15 @@ void uvax_steal_pages __P((void)); int uvax_setup __P((int mapen)); struct uvax_calls { - u_long (*uc_phys2virt) __P((u_long)); /* most often used! */ u_long (*uc_memsize) __P((void)); - void (*uc_steal_pages) __P((void)); - void (*uc_conf) __P((struct device*, struct device*, void*)); - void (*uc_memerr) __P((void)); - int (*uc_mchk) __P((caddr_t)); - int (*uc_clkread) __P((time_t)); - void (*uc_clkwrite) __P((void)); char *uc_name; - u_char *uc_intreq; - u_char *uc_intclr; - u_char *uc_intmsk; void *le_iomem; /* base addr of RAM -- CPU's view */ u_long *le_ioaddr; /* base addr of RAM -- LANCE's view */ int *le_memsize; /* size of RAM reserved for LANCE */ void *uc_physmap; - int uc_busTypes; int uc_vups; /* used by delay() */ int uv_flags; @@ -113,3 +105,6 @@ extern struct uc_map *uc_physmap; /* Prototypes */ int uvax_clkread __P((time_t)); void uvax_clkwrite __P((void)); +void uvax_fillmap __P((void)); +u_long uvax_phys2virt __P((u_long)); +#endif diff --git a/sys/arch/vax/vax/autoconf.c b/sys/arch/vax/vax/autoconf.c index 7ea314d4f584..ab73984b4b63 100644 --- a/sys/arch/vax/vax/autoconf.c +++ b/sys/arch/vax/vax/autoconf.c @@ -1,4 +1,4 @@ -/* $NetBSD: autoconf.c,v 1.21 1997/01/31 02:13:40 thorpej Exp $ */ +/* $NetBSD: autoconf.c,v 1.22 1997/02/19 10:04:09 ragge Exp $ */ /* * Copyright (c) 1994 Ludd, University of Lule}, Sweden. @@ -30,9 +30,6 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ - /* All bugs are subject to removal without further notice */ - - #include #include #include @@ -40,6 +37,8 @@ #include #include +#include + #include #include #include @@ -49,106 +48,17 @@ #include #include #include -#include #include #include -#include +void gencnslask __P((void)); +struct cpu_dep *dep_call; struct nexus *nexus; - -#define BACKPLANE 0 -#define BIBUSS 1 -#define SBIBUSS 2 -#define VSBUSS 4 - int mastercpu; /* chief of the system */ -#if defined(VAX630) || defined(VAX410) || defined(VAX43) || defined(VAX46) -#define VAX_uVAX -#endif - -#ifdef VAX8600 /* XXX These are in ka860 also */ -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)); -#endif -#ifdef VAX780 /* XXX These are in ka780 also */ -void ka780_conf __P((struct device *, struct device *, void *)); -void ka780_memenable __P((struct sbi_attach_args *, void *)); -void ka780_memerr __P((void)); -int ka780_mchk __P((caddr_t)); -void ka780_steal_pages __P((void)); -#endif - -struct cpu_dep cpu_calls[]={ - /* Type 0,noexist */ - {NULL, NULL, NULL, NULL, NULL }, -#ifdef VAX780 /* Type 1, 11/{780,782,785} */ - {ka780_steal_pages,generic_clock, ka780_mchk, ka780_memerr, ka780_conf, - generic_clkread, generic_clkwrite}, -#else - {NULL, NULL, NULL, NULL, NULL }, -#endif -#ifdef VAX750 /* Type 2, 11/750 */ - {ka750_steal_pages,generic_clock, ka750_mchk, ka750_memerr, ka750_conf, - generic_clkread, generic_clkwrite}, -#else - {NULL, NULL, NULL, NULL, NULL }, -#endif -#ifdef VAX730 /* Type 3, 11/{730,725}, ceauciesco-vax */ - {NULL, NULL, NULL, NULL, NULL }, -#else - {NULL, NULL, NULL, NULL, NULL }, -#endif -#ifdef VAX8600 /* Type 4, 8600/8650 (11/{790,795}) */ - {ka86_steal_pages, generic_clock, ka86_mchk, ka86_memerr, ka86_conf, - generic_clkread, generic_clkwrite}, -#else - {NULL, NULL, NULL, NULL, NULL }, -#endif -#ifdef VAX8200 /* Type 5, 8200, 8300, 8350 */ - {ka820_steal_pages, generic_clock, ka820_mchk, ka820_memerr, NULL, - ka820_clkread, ka820_clkwrite}, -#else - {NULL, NULL, NULL, NULL, NULL }, -#endif -#ifdef VAX8800 /* Type 6, 85X0, 8700, 88X0 */ - {NULL, generic_clock, NULL, NULL, NULL }, -#else - {NULL, NULL, NULL, NULL, NULL }, -#endif -#ifdef VAX610 /* Type 7, KA610 */ - {NULL, NULL, NULL, NULL, NULL }, -#else - {NULL, NULL, NULL, NULL, NULL }, -#endif -#ifdef VAX630 /* Type 8, KA630 or KA410 (uVAX II) */ - {uvax_steal_pages, no_nicr_clock, uvax_mchk, uvax_memerr, uvax_conf, - uvax_clkread, uvax_clkwrite}, -#else - {NULL, NULL, NULL, NULL, NULL }, -#endif - /* Type 9, not used */ - {NULL, NULL, NULL, NULL, NULL }, -#ifdef VAX650 /* Type 10, KA65X (uVAX III) */ - {uvaxIII_steal_pages, no_nicr_clock, uvaxIII_mchk, uvaxIII_memerr, - uvaxIII_conf, generic_clkread, generic_clkwrite}, -#else - {NULL, NULL, NULL, NULL, NULL }, -#endif -#ifdef VAX_uVAX /* Type 11, RIGEL */ - {uvax_steal_pages, no_nicr_clock, uvax_mchk, uvax_memerr, uvax_conf, - uvax_clkread, uvax_clkwrite}, -#else - {NULL, NULL, NULL, NULL, NULL }, -#endif -}; - -void gencnslask __P((void)); +#define BACKPLANE 0 struct devnametobdevmaj vax_nam2blk[] = { { "hp", 0 }, @@ -377,7 +287,7 @@ cpu_attach(parent, self, aux) struct device *parent, *self; void *aux; { - (*cpu_calls[vax_cputype].cpu_conf)(parent, self, aux); + (*dep_call->cpu_conf)(parent, self, aux); } int mem_match __P((struct device *, void *, void *)); diff --git a/sys/arch/vax/vax/clock.c b/sys/arch/vax/vax/clock.c index f55c19f0bf1a..21e6583acda4 100644 --- a/sys/arch/vax/vax/clock.c +++ b/sys/arch/vax/vax/clock.c @@ -1,4 +1,4 @@ -/* $NetBSD: clock.c,v 1.18 1996/10/13 03:35:33 christos Exp $ */ +/* $NetBSD: clock.c,v 1.19 1997/02/19 10:04:11 ragge Exp $ */ /* * Copyright (c) 1995 Ludd, University of Lule}, Sweden. * All rights reserved. @@ -37,7 +37,6 @@ #include #include -#include #include #include @@ -103,7 +102,7 @@ inittodr(fs_time) { int rv; - rv = (*cpu_calls[vax_cputype].cpu_clkread) (fs_time); + rv = (*dep_call->cpu_clkread) (fs_time); switch (rv) { case CLKREAD_BAD: /* No useable information from system clock */ @@ -138,7 +137,7 @@ inittodr(fs_time) void resettodr() { - (*cpu_calls[vax_cputype].cpu_clkwrite)(); + (*dep_call->cpu_clkwrite)(); } /* * A delayloop that delays about the number of milliseconds that is @@ -148,32 +147,7 @@ void delay(i) int i; { - int mul; - - switch (vax_cputype) { -#if VAX750 || VAX630 || VAX410 - case VAX_750: - case VAX_78032: - mul = 1; /* <= 1 VUPS */ - break; -#endif -#if VAX780 || VAX8200 - case VAX_780: - case VAX_8200: - mul = 2; /* <= 2 VUPS */ - break; -#endif -#if VAX650 - case VAX_650: - mul = 3; /* <= 3 VUPS */ - break; -#endif - default: /* Would be enough... */ - case VAX_8600: - mul = 6; /* <= 6 VUPS */ - break; - } - asm ("1: sobgtr %0, 1b" : : "r" (mul * i)); + asm ("1: sobgtr %0, 1b" : : "r" (dep_call->cpu_vups * i)); } #if VAX750 || VAX780 || VAX8200 || VAX8600 || VAX8800 diff --git a/sys/arch/vax/vax/ka410.c b/sys/arch/vax/vax/ka410.c index 58248739f3e7..5fc0f1ad7dea 100644 --- a/sys/arch/vax/vax/ka410.c +++ b/sys/arch/vax/vax/ka410.c @@ -1,4 +1,4 @@ -/* $NetBSD: ka410.c,v 1.3 1996/10/13 03:35:42 christos Exp $ */ +/* $NetBSD: ka410.c,v 1.4 1997/02/19 10:04:12 ragge Exp $ */ /* * Copyright (c) 1996 Ludd, University of Lule}, Sweden. * All rights reserved. @@ -15,8 +15,8 @@ * 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 at Ludd, University of - * Lule}, Sweden and its contributors. + * This product includes software developed at Ludd, University of + * Lule}, Sweden and its contributors. * 4. The name of the author may not be used to endorse or promote products * derived from this software without specific prior written permission * @@ -32,8 +32,6 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ - - #include #include #include @@ -42,6 +40,7 @@ #include #include +#include #include #include #include @@ -50,70 +49,53 @@ #include #include -/* - * Maybe all these variables/functions should be static or "integrate" - */ -void ka410_conf __P((struct device*, struct device*, void*)); -void ka410_memenable __P((struct sbi_attach_args *, struct device *)); -void ka410_steal_pages __P((void)); +static void ka410_conf __P((struct device*, struct device*, void*)); +static void ka410_memenable __P((struct sbi_attach_args*, struct device *)); +static void ka410_steal_pages __P((void)); +static void ka410_memerr __P((void)); +static int ka410_mchk __P((caddr_t)); -#ifdef notyet -void ka410_memerr __P((void)); -int ka410_mchk __P((caddr_t)); -#endif +static struct ka410_clock *ka410_clkptr; -struct ka410_cpu *ka410_cpuptr = (void*)KA410_CPU_BASE; -struct ka410_clock *ka410_clkptr = (void*)KA410_WAT_BASE; - -extern int uVAX_fillmap __P((struct uc_map *)); - -struct uc_map ka410_map[] = { +static struct uc_map ka410_map[] = { { KA410_CFGTST, KA410_CFGTST+1023, 1024, 0 }, - { KA410_ROM_BASE, KA410_ROM_END, KA410_ROM_SIZE, 0 }, - { KA410_CPU_BASE, KA410_CPU_END, KA410_CPU_SIZE, 0 }, - { KA410_NWA_BASE, KA410_NWA_END, KA410_NWA_SIZE, 0 }, - { KA410_SER_BASE, KA410_SER_END, KA410_SER_SIZE, 0 }, - { KA410_WAT_BASE, KA410_WAT_END, KA410_WAT_SIZE, 0 }, + { KA410_ROM_BASE, KA410_ROM_END, KA410_ROM_SIZE, 0 }, + { (int)KA410_CPU_BASE, KA410_CPU_END, KA410_CPU_SIZE, 0 }, + { KA410_NWA_BASE, KA410_NWA_END, KA410_NWA_SIZE, 0 }, + { KA410_SER_BASE, KA410_SER_END, KA410_SER_SIZE, 0 }, + { (int)KA410_WAT_BASE, KA410_WAT_END, KA410_WAT_SIZE, 0 }, #if 0 - { KA410_SCS_BASE, KA410_SCS_END, KA410_SCS_SIZE, 0 }, + { KA410_SCS_BASE, KA410_SCS_END, KA410_SCS_SIZE, 0 }, #else { 0x200C0000, 0x200C01FF, 0x200, 0 }, #endif - { KA410_LAN_BASE, KA410_LAN_END, KA410_LAN_SIZE, 0 }, - { KA410_CUR_BASE, KA410_CUR_END, KA410_CUR_SIZE, 0 }, - { KA410_DMA_BASE, KA410_DMA_END, KA410_DMA_SIZE, 0 }, + { KA410_LAN_BASE, KA410_LAN_END, KA410_LAN_SIZE, 0 }, + { KA410_CUR_BASE, KA410_CUR_END, KA410_CUR_SIZE, 0 }, + { KA410_DMA_BASE, KA410_DMA_END, KA410_DMA_SIZE, 0 }, /* * there's more to come, eg. framebuffers (mono + GPX) */ {0, 0, 0, 0}, }; -int -ka410_setup(uc,flags) - struct uvax_calls *uc; - int flags; -{ - uc->uc_name = "ka410"; +/* + * Declaration of 410-specific calls. + */ +struct cpu_dep ka410_calls = { + ka410_steal_pages, + no_nicr_clock, + ka410_mchk, + ka410_memerr, + ka410_conf, + ka410_clkread, + ka410_clkwrite, + 1, /* ~VUPS */ + (void*)KA410_INTREQ, /* Used by vaxstation */ + (void*)KA410_INTCLR, /* Used by vaxstation */ + (void*)KA410_INTMSK, /* Used by vaxstation */ + ka410_map, +}; - uc->uc_phys2virt = NULL; /* ka410_mapaddr; */ - uc->uc_physmap = ka410_map; /* ptv_map ? p2v_map */ - - uc->uc_steal_pages = ka410_steal_pages; - uc->uc_conf = ka410_conf; - uc->uc_clkread = ka410_clkread; - uc->uc_clkwrite = ka410_clkwrite; - -#ifdef notyet - uc->uc_memerr = ka410_memerr; - uc->uc_mchk = ka410_mchk; -#endif - - uc->uc_intreq = (void*)KA410_INTREQ; - uc->uc_intclr = (void*)KA410_INTCLR; - uc->uc_intmsk = (void*)KA410_INTMSK; - - uc->uc_busTypes = VAX_VSBUS; -} void ka410_conf(parent, self, aux) @@ -130,24 +112,33 @@ ka410_conf(parent, self, aux) printf(": %s\n", cpu_model); } +void +ka410_memerr() +{ + printf("Memory err!\n"); +} + +int +ka410_mchk(addr) + caddr_t addr; +{ + panic("Machine check"); +} -/* - * - */ u_long le_iomem; /* base addr of RAM -- CPU's view */ u_long le_ioaddr; /* base addr of RAM -- LANCE's view */ void ka410_steal_pages() { - extern vm_offset_t avail_start, virtual_avail, avail_end; + extern vm_offset_t avail_start, virtual_avail, avail_end; int junk; int i; struct { - u_long :2; - u_long data:8; - u_long :22; + u_long :2; + u_long data:8; + u_long :22; } *p; int *srp; /* Scratch Ram */ char *q = (void*)&srp; @@ -156,17 +147,17 @@ ka410_steal_pages() p = (void*)KA410_SCR; for (i=0; i<4; i++) { printf("p[%d] = %x, ", i, p[i].data); - q[i] = p[i].data; + q[i] = p[i].data; } p = (void*)KA410_SCRLEN; printf("\nlen = %d\n", p->data); printf("srp = 0x%x\n", srp); for (i=0; i<0x2; i++) { - printf("%x:0x%x ", i*4, srp[i]); - if ((i & 0x07) == 0x07) - printf("\n"); - } + printf("%x:0x%x ", i*4, srp[i]); + if ((i & 0x07) == 0x07) + printf("\n"); + } printf("\n"); /* @@ -215,27 +206,21 @@ ka410_steal_pages() * pmap_map(ptr,...) inserts a pair of virtual/physical addresses * into the system maptable (Sysmap) */ - uVAX_fillmap(ka410_map); + uvax_fillmap(); /* * Clear restart and boot in progress flags * in the CPMBX. (ie. clear bits 4 and 5) */ - ka410_clkptr->cpmbx = (ka410_clkptr->cpmbx & ~0x30); + KA410_WAT_BASE->cpmbx = (KA410_WAT_BASE->cpmbx & ~0x30); /* * Enable memory parity error detection and clear error bits. */ - ka410_cpuptr->ka410_mser = 1; + KA410_CPU_BASE->ka410_mser = 1; /* (UVAXIIMSER_PEN | UVAXIIMSER_MERR | UVAXIIMSER_LEB); */ - /* - * MM is not yet enabled, thus we still used the physical addresses, - * but before leaving this routine, we need to reset them to virtual. - */ - ka410_cpuptr = (void*)uvax_phys2virt(KA410_CPU_BASE); - ka410_clkptr = (void*)uvax_phys2virt(KA410_WAT_BASE); - + ka410_clkptr = (void*)uvax_phys2virt((u_long)KA410_WAT_BASE); } /* * define what we need and overwrite the uVAX_??? names diff --git a/sys/arch/vax/vax/ka43.c b/sys/arch/vax/vax/ka43.c index 814f8e82bea4..1db171b9b74e 100644 --- a/sys/arch/vax/vax/ka43.c +++ b/sys/arch/vax/vax/ka43.c @@ -1,4 +1,4 @@ -/* $NetBSD: ka43.c,v 1.3 1996/10/13 03:35:43 christos Exp $ */ +/* $NetBSD: ka43.c,v 1.4 1997/02/19 10:04:14 ragge Exp $ */ /* * Copyright (c) 1996 Ludd, University of Lule}, Sweden. * All rights reserved. @@ -15,8 +15,8 @@ * 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 at Ludd, University of - * Lule}, Sweden and its contributors. + * This product includes software developed at Ludd, University of + * Lule}, Sweden and its contributors. * 4. The name of the author may not be used to endorse or promote products * derived from this software without specific prior written permission * @@ -41,6 +41,7 @@ #include #include +#include #include #include #include @@ -50,7 +51,7 @@ #include #include /* cache ??? */ -#define xtrace(x) +#define xtrace(x) void ka43_conf __P((struct device*, struct device*, void*)); void ka43_steal_pages __P((void)); @@ -58,12 +59,10 @@ void ka43_steal_pages __P((void)); void ka43_memerr __P((void)); int ka43_mchk __P((caddr_t)); -struct ka43_cpu *ka43_cpuptr = (void*)KA43_CPU_BASE; -struct ka43_clock *ka43_clkptr = (void*)KA43_WAT_BASE; +struct ka43_clock *ka43_clkptr; -extern int uVAX_fillmap __P((struct uc_map *)); -struct uc_map ka43_map[] = { +static struct uc_map ka43_map[] = { { KA43_CFGTST, KA43_CFGTST, 4, 0 }, { KA43_ROM_BASE, KA43_ROM_END, KA43_ROM_SIZE, 0 }, { KA43_CPU_BASE, KA43_CPU_END, KA43_CPU_SIZE, 0 }, @@ -83,6 +82,21 @@ struct uc_map ka43_map[] = { {0, 0, 0, 0}, }; +struct cpu_dep ka43_calls = { + ka43_steal_pages, + no_nicr_clock, + ka43_mchk, + ka43_memerr, + ka43_conf, + ka43_clkread, + ka43_clkwrite, + 4, + (void*)KA43_INTREQ, + (void*)KA43_INTCLR, + (void*)KA43_INTMSK, + ka43_map, +}; + #define CH1_BITS \ "\020\015BCHIT\014BUSERR\013PPERR\012DPERR\011TPERR\010TRAP1" \ "\007TRAP2\006INTR\005HIT\004REFRESH\003FLUSH\002ENABLE\001FORCEHIT" @@ -164,22 +178,7 @@ ka43_setup(uc,flags) { uc->uc_name = "ka43"; - uc->uc_phys2virt = NULL; uc->uc_physmap = ka43_map; - - uc->uc_steal_pages = ka43_steal_pages; - uc->uc_conf = ka43_conf; - uc->uc_clkread = ka43_clkread; - uc->uc_clkwrite = ka43_clkwrite; - - uc->uc_memerr = ka43_memerr; - uc->uc_mchk = ka43_mchk; - - uc->uc_intreq = (void*)KA43_INTREQ; - uc->uc_intclr = (void*)KA43_INTCLR; - uc->uc_intmsk = (void*)KA43_INTMSK; - - uc->uc_busTypes = VAX_VSBUS; } ka43_discache() @@ -315,7 +314,7 @@ u_long le_ioaddr; /* base addr of RAM -- LANCE's view */ void ka43_steal_pages() { - extern vm_offset_t avail_start, virtual_avail, avail_end; + extern vm_offset_t avail_start, virtual_avail, avail_end; int junk; int i; struct { @@ -337,8 +336,11 @@ ka43_steal_pages() #else *pctl = KA43_PCTL_CPEN; #endif + panic("No support for ka43"); +#if 0 printf("new value for parctl: "); gets(line); +#endif *pctl = *line - '0'; printf("parctl: 0x%x\n", *pctl); @@ -346,7 +348,7 @@ ka43_steal_pages() p = (void*)KA43_SCR; for (i=0; i<4; i++) { printf("p[%d] = %x, ", i, p[i].data); - q[i] = p[i].data; + q[i] = p[i].data; } p = (void*)KA43_SCRLEN; printf("\nlen = %d\n", p->data); @@ -356,7 +358,7 @@ ka43_steal_pages() printf("%x:0x%x ", i*4, srp[i]); if ((i & 0x07) == 0x07) printf("\n"); - } + } printf("\n"); printf ("ka43_steal_pages: avail_end=0x%x\n", avail_end); @@ -405,27 +407,25 @@ ka43_steal_pages() /* * now map in anything listed in ka43_map... */ - uVAX_fillmap(ka43_map); + uvax_fillmap(); /* * Clear restart and boot in progress flags in the CPMBX. */ - ka43_clkptr->cpmbx = ka43_clkptr->cpmbx & 0xF0; + ((struct ka43_clock*)ka43_clkptr)->cpmbx = + ((struct ka43_clock*)ka43_clkptr)->cpmbx & 0xF0; /* * Enable memory parity error detection and clear error bits. */ - ka43_cpuptr->ka43_mser = 0x01; + ((struct ka43_cpu *)KA43_CPU_BASE)->ka43_mser = 0x01; /* (UVAXIIMSER_PEN | UVAXIIMSER_MERR | UVAXIIMSER_LEB); */ /* * 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_cpuptr = (void*)uvax_phys2virt(KA43_CPU_BASE); ka43_clkptr = (void*)uvax_phys2virt(KA43_WAT_BASE); - - printf ("steal_pages done.\n"); } /* diff --git a/sys/arch/vax/vax/ka630.c b/sys/arch/vax/vax/ka630.c index 32121491ecfd..9487a32426ab 100644 --- a/sys/arch/vax/vax/ka630.c +++ b/sys/arch/vax/vax/ka630.c @@ -1,7 +1,7 @@ -/* $NetBSD: ka630.c,v 1.4 1996/10/13 03:35:44 christos Exp $ */ +/* $NetBSD: ka630.c,v 1.5 1997/02/19 10:04:15 ragge Exp $ */ /*- * Copyright (c) 1982, 1988, 1990, 1993 - * The Regents of the University of California. All rights reserved. + * 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 @@ -31,7 +31,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * @(#)ka630.c 7.8 (Berkeley) 5/9/91 + * @(#)ka630.c 7.8 (Berkeley) 5/9/91 */ #include @@ -44,6 +44,7 @@ #include #include +#include #include #include #include @@ -52,38 +53,29 @@ #include #include -struct uvaxIIcpu *uvaxIIcpu_ptr; +static struct uvaxIIcpu *uvaxIIcpu_ptr; -struct ka630clock *ka630_clkptr = KA630CLK; +static struct ka630clock *ka630_clkptr = KA630CLK; 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)); +struct cpu_dep ka630_calls = { + ka630_steal_pages, + no_nicr_clock, + ka630_mchk, + ka630_memerr, + ka630_conf, + ka630_clkread, + ka630_clkwrite, + 1, /* ~VUPS */ + 0, /* Used by vaxstation */ + 0, /* Used by vaxstation */ + 0, /* Used by vaxstation */ -int -ka630_setup(uc,flags) - struct uvax_calls *uc; - int flags; -{ - uc->uc_name = "ka630"; - - uc->uc_phys2virt = NULL; - uc->uc_physmap = NULL; /* ptv_map ? p2v_map */ - - uc->uc_steal_pages = ka630_steal_pages; - uc->uc_conf = ka630_conf; - uc->uc_clkread = ka630_clkread; - uc->uc_clkwrite = ka630_clkwrite; - -#ifdef notyet - uc->uc_memerr = ka630_memerr; - uc->uc_mchk = ka630_mchk; -#endif - - uc->uc_busTypes = VAX_UNIBUS; -} +}; /* * uvaxII_conf() is called by cpu_attach to do the cpu_specific setup. @@ -100,7 +92,8 @@ ka630_conf(parent, self, aux) } /* log crd errors */ -uvaxII_memerr() +void +ka630_memerr() { printf("memory err!\n"); } @@ -121,7 +114,7 @@ struct mc78032frame { int mc63_psl; /* trapped psl */ }; -uvaxII_mchk(cmcf) +ka630_mchk(cmcf) caddr_t cmcf; { register struct mc78032frame *mcf = (struct mc78032frame *)cmcf; @@ -147,7 +140,7 @@ uvaxII_mchk(cmcf) void ka630_steal_pages() { - extern vm_offset_t avail_start, virtual_avail, avail_end; + extern vm_offset_t avail_start, virtual_avail, avail_end; int junk; /* @@ -170,24 +163,23 @@ ka630_steal_pages() (vm_offset_t)KA630CLK + NBPG, VM_PROT_READ|VM_PROT_WRITE); /* - * Clear restart and boot in progress flags - * in the CPMBX. - / - ka630clk_ptr->cpmbx = (ka630clk_ptr->cpmbx & KA630CLK_LANG); + * Clear restart and boot in progress flags in the CPMBX. + * Note: We are not running virtual yet. + */ + KA630CLK->cpmbx = (KA630CLK->cpmbx & KA630CLK_LANG); /* * Enable memory parity error detection and clear error bits. */ - uvaxIIcpu_ptr->uvaxII_mser = (UVAXIIMSER_PEN | UVAXIIMSER_MERR | + UVAXIICPU->uvaxII_mser = (UVAXIIMSER_PEN | UVAXIIMSER_MERR | UVAXIIMSER_LEB); - } -#define uVAX_gettodr ka630_gettodr -#define uVAX_settodr ka630_settodr -#define uVAX_clkptr ka630_clkptr -#define uVAX_genclock ka630_genclock -#define uVAX_clock ka630clock -#define uVAX_clkread ka630_clkread -#define uVAX_clkwrite ka630_clkwrite +#define uVAX_gettodr ka630_gettodr +#define uVAX_settodr ka630_settodr +#define uVAX_clkptr ka630_clkptr +#define uVAX_genclock ka630_genclock +#define uVAX_clock ka630clock +#define uVAX_clkread ka630_clkread +#define uVAX_clkwrite ka630_clkwrite #include diff --git a/sys/arch/vax/vax/ka650.c b/sys/arch/vax/vax/ka650.c index 669fe79a36fb..9c2cc408e525 100644 --- a/sys/arch/vax/vax/ka650.c +++ b/sys/arch/vax/vax/ka650.c @@ -1,4 +1,4 @@ -/* $NetBSD: ka650.c,v 1.8 1997/02/12 17:50:40 ragge Exp $ */ +/* $NetBSD: ka650.c,v 1.9 1997/02/19 10:04:16 ragge Exp $ */ /* * Copyright (c) 1988 The Regents of the University of California. * All rights reserved. @@ -50,6 +50,7 @@ #include #include +#include #include #include #include @@ -68,6 +69,21 @@ static int subtyp; void ka650setcache __P((int)); +struct cpu_dep ka650_calls = { + uvaxIII_steal_pages, + no_nicr_clock, + uvaxIII_mchk, + uvaxIII_memerr, + uvaxIII_conf, + generic_clkread, + generic_clkwrite, + 4, /* ~VUPS */ + 0, /* Used by vaxstation */ + 0, /* Used by vaxstation */ + 0, /* Used by vaxstation */ + +}; + /* * uvaxIII_conf() is called by cpu_attach to do the cpu_specific setup. */ diff --git a/sys/arch/vax/vax/ka750.c b/sys/arch/vax/vax/ka750.c index 222469672e92..7332ec4edfa1 100644 --- a/sys/arch/vax/vax/ka750.c +++ b/sys/arch/vax/vax/ka750.c @@ -1,6 +1,5 @@ -/* $NetBSD: ka750.c,v 1.17 1996/10/13 03:35:48 christos Exp $ */ - -/*- +/* $NetBSD: ka750.c,v 1.18 1997/02/19 10:04:17 ragge Exp $ */ +/* * Copyright (c) 1982, 1986, 1988 The Regents of the University of California. * Copyright (c) 1994 Ludd, University of Lule}, Sweden. * All rights reserved. @@ -46,6 +45,7 @@ #include #include +#include #include #include #include @@ -57,6 +57,21 @@ void ctuattach __P((void)); +struct cpu_dep ka750_calls = { + ka750_steal_pages, + generic_clock, + ka750_mchk, + ka750_memerr, + ka750_conf, + generic_clkread, + generic_clkwrite, + 1, /* ~VUPS */ + 0, /* Used by vaxstation */ + 0, /* Used by vaxstation */ + 0, /* Used by vaxstation */ + +}; + /* * ka750_conf() is called by cpu_attach to do the cpu_specific setup. */ diff --git a/sys/arch/vax/vax/ka780.c b/sys/arch/vax/vax/ka780.c index 93b47118b505..21b76f397530 100644 --- a/sys/arch/vax/vax/ka780.c +++ b/sys/arch/vax/vax/ka780.c @@ -1,4 +1,4 @@ -/* $NetBSD: ka780.c,v 1.6 1996/10/13 03:35:50 christos Exp $ */ +/* $NetBSD: ka780.c,v 1.7 1997/02/19 10:04:18 ragge Exp $ */ /*- * Copyright (c) 1982, 1986, 1988 The Regents of the University of California. * All rights reserved. @@ -47,6 +47,7 @@ #include #include +#include #include #include #include @@ -56,12 +57,28 @@ #include #include -/* Prototypes. XXX These should be somewhere else */ -void ka780_conf __P((struct device *, struct device *, void *)); +static void ka780_conf __P((struct device *, struct device *, void *)); void ka780_memenable __P((struct sbi_attach_args *, void *)); -void ka780_memerr __P((void)); -int ka780_mchk __P((caddr_t)); -void ka780_steal_pages __P((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, + generic_clock, + ka780_mchk, + ka780_memerr, + ka780_conf, + generic_clkread, + generic_clkwrite, + 2, /* ~VUPS */ + 0, /* Used by vaxstation */ + 0, /* Used by vaxstation */ + 0, /* Used by vaxstation */ +}; /* * Memory controller register usage varies per controller. diff --git a/sys/arch/vax/vax/ka820.c b/sys/arch/vax/vax/ka820.c index b3122c80b2e4..2f25a6ff3528 100644 --- a/sys/arch/vax/vax/ka820.c +++ b/sys/arch/vax/vax/ka820.c @@ -1,4 +1,4 @@ -/* $NetBSD: ka820.c,v 1.3 1996/10/13 03:35:51 christos Exp $ */ +/* $NetBSD: ka820.c,v 1.4 1997/02/19 10:04:19 ragge Exp $ */ /* * Copyright (c) 1988 Regents of the University of California. * All rights reserved. @@ -68,6 +68,21 @@ void *bi_nodebase; /* virtual base address for all possible bi nodes */ static int ka820_match __P((struct device *, void *, void *)); static void ka820_attach __P((struct device *, struct device *, void*)); +struct cpu_dep ka820_calls = { + ka820_steal_pages, + generic_clock, + ka820_mchk, + ka820_memerr, + NULL, + ka820_clkread, + ka820_clkwrite, + 3, /* ~VUPS */ + 0, /* Used by vaxstation */ + 0, /* Used by vaxstation */ + 0, /* Used by vaxstation */ + +}; + struct cfattach cpu_bi_ca = { sizeof(struct device), ka820_match, ka820_attach }; diff --git a/sys/arch/vax/vax/ka860.c b/sys/arch/vax/vax/ka860.c index 43cb0094ff21..b528a01c5f13 100644 --- a/sys/arch/vax/vax/ka860.c +++ b/sys/arch/vax/vax/ka860.c @@ -1,4 +1,4 @@ -/* $NetBSD: ka860.c,v 1.6 1996/10/13 03:35:53 christos Exp $ */ +/* $NetBSD: ka860.c,v 1.7 1997/02/19 10:04:20 ragge Exp $ */ /* * Copyright (c) 1986, 1988 Regents of the University of California. * All rights reserved. @@ -46,6 +46,7 @@ #include #include +#include #include #include #include @@ -53,7 +54,6 @@ struct ioa *ioa; -/* XXX These are in autoconf.c also */ void ka86_conf __P((struct device *, struct device *, void *)); void ka86_memenable __P((struct sbi_attach_args *, struct device *)); void ka86_memerr __P((void)); @@ -62,6 +62,21 @@ void ka86_steal_pages __P((void)); void crlattach __P((void)); +struct cpu_dep ka860_calls = { + ka86_steal_pages, + generic_clock, + ka86_mchk, + ka86_memerr, + ka86_conf, + generic_clkread, + generic_clkwrite, + 6, /* ~VUPS */ + 0, /* Used by vaxstation */ + 0, /* Used by vaxstation */ + 0, /* Used by vaxstation */ + +}; + /* * 8600 memory register (MERG) bit definitions */ diff --git a/sys/arch/vax/vax/locore.c b/sys/arch/vax/vax/locore.c index 443f7b51ad5e..b359f39e335a 100644 --- a/sys/arch/vax/vax/locore.c +++ b/sys/arch/vax/vax/locore.c @@ -1,4 +1,4 @@ -/* $NetBSD: locore.c,v 1.17 1996/08/20 14:13:54 ragge Exp $ */ +/* $NetBSD: locore.c,v 1.18 1997/02/19 10:04:22 ragge Exp $ */ /* * Copyright (c) 1994 Ludd, University of Lule}, Sweden. * All rights reserved. @@ -71,6 +71,18 @@ int vax_systype; /* machine dependend identification of the system */ int vax_cpudata; /* contents of the SID register */ int vax_siedata; /* contents of the SIE register */ int vax_confdata; /* machine dependend, configuration/setup data */ +/* + * Also; the strict cpu-dependent information is set up here, in + * form of a pointer to a struct that is specific for each cpu. + */ +extern struct cpu_dep ka780_calls; +extern struct cpu_dep ka750_calls; +extern struct cpu_dep ka860_calls; +extern struct cpu_dep ka820_calls; +extern struct cpu_dep ka43_calls; +extern struct cpu_dep ka410_calls; +extern struct cpu_dep ka630_calls; +extern struct cpu_dep ka650_calls; /* * Start is called from boot; the first routine that is called @@ -153,18 +165,21 @@ tokmem: movw $0xfff, _panic case VAX_TYP_780: vax_bustype = VAX_SBIBUS | VAX_CPUBUS; vax_boardtype = VAX_BTYP_780; + dep_call = &ka780_calls; break; #endif #if VAX750 case VAX_TYP_750: vax_bustype = VAX_CMIBUS | VAX_CPUBUS; vax_boardtype = VAX_BTYP_750; + dep_call = &ka750_calls; break; #endif #if VAX8600 case VAX_TYP_790: vax_bustype = VAX_CPUBUS | VAX_MEMBUS; vax_boardtype = VAX_BTYP_790; + dep_call = &ka860_calls; break; #endif #if VAX630 || VAX650 || VAX410 || VAX43 @@ -175,17 +190,32 @@ tokmem: movw $0xfff, _panic vax_boardtype = (vax_cputype<<24) | ((vax_siedata>>24)&0xFF); switch (vax_boardtype) { +#if VAX410 case VAX_BTYP_410: - case VAX_BTYP_43: + dep_call = &ka410_calls; vax_confdata = *(int *)(0x20020000); vax_bustype = VAX_VSBUS | VAX_CPUBUS; break; - +#endif +#if VAX43 + case VAX_BTYP_43: + vax_confdata = *(int *)(0x20020000); + vax_bustype = VAX_VSBUS | VAX_CPUBUS; + dep_call = &ka43_calls; + break; +#endif +#if VAX630 case VAX_BTYP_630: - case VAX_BTYP_650: + dep_call = &ka630_calls; vax_bustype = VAX_UNIBUS | VAX_CPUBUS; break; - +#endif +#if VAX650 + case VAX_BTYP_650: + vax_bustype = VAX_UNIBUS | VAX_CPUBUS; + dep_call = &ka650_calls; + break; +#endif default: break; } @@ -196,6 +226,7 @@ tokmem: movw $0xfff, _panic vax_boardtype = VAX_BTYP_8000; vax_bustype = VAX_BIBUS; mastercpu = mfpr(PR_BINID); + dep_call = &ka820_calls; break; #endif default: diff --git a/sys/arch/vax/vax/machdep.c b/sys/arch/vax/vax/machdep.c index c468d7123a51..c1f46c1468f2 100644 --- a/sys/arch/vax/vax/machdep.c +++ b/sys/arch/vax/vax/machdep.c @@ -1,4 +1,4 @@ -/* $NetBSD: machdep.c,v 1.35 1997/01/11 11:31:26 ragge Exp $ */ +/* $NetBSD: machdep.c,v 1.36 1997/02/19 10:04:23 ragge Exp $ */ /* * Copyright (c) 1994 Ludd, University of Lule}, Sweden. @@ -368,7 +368,7 @@ dumpconf() void cpu_initclocks() { - (cpu_calls[vax_cputype].cpu_clock) (); + (*dep_call->cpu_clock) (); } int @@ -641,9 +641,9 @@ void machinecheck(frame) caddr_t frame; { - if ((*cpu_calls[vax_cputype].cpu_mchk) (frame) == 0) + if ((*dep_call->cpu_mchk) (frame) == 0) return; - (*cpu_calls[vax_cputype].cpu_memerr) (); + (*dep_call->cpu_memerr) (); panic("machine check"); } @@ -791,5 +791,5 @@ process_sstep(p, sstep) void cmrerr() { - (*cpu_calls[vax_cputype].cpu_memerr) (); + (*dep_call->cpu_memerr) (); } diff --git a/sys/arch/vax/vax/pmap.c b/sys/arch/vax/vax/pmap.c index dad61e2a4a98..732b3182f947 100644 --- a/sys/arch/vax/vax/pmap.c +++ b/sys/arch/vax/vax/pmap.c @@ -1,4 +1,4 @@ -/* $NetBSD: pmap.c,v 1.31 1997/02/12 17:53:01 ragge Exp $ */ +/* $NetBSD: pmap.c,v 1.32 1997/02/19 10:04:25 ragge Exp $ */ /* * Copyright (c) 1994 Ludd, University of Lule}, Sweden. * All rights reserved. @@ -240,7 +240,7 @@ pmap_bootstrap() bcopy(0, (void *)avail_start, NBPG >> 1); mtpr(avail_start, PR_SCBB); bzero(0, NBPG >> 1); - (cpu_calls[vax_cputype].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/uvax.c b/sys/arch/vax/vax/uvax.c index ce9df0e46921..1257f781b261 100644 --- a/sys/arch/vax/vax/uvax.c +++ b/sys/arch/vax/vax/uvax.c @@ -1,9 +1,8 @@ -/* $NetBSD: uvax.c,v 1.3 1996/10/13 03:36:03 christos Exp $ */ +/* $NetBSD: uvax.c,v 1.4 1997/02/19 10:04:27 ragge Exp $ */ /* * Copyright (c) 1996 Ludd, University of Lule}, Sweden. - * All rights reserved. - * - * This code is derived from software contributed to Ludd by Bertram Barth. + * Copyright (c) 1982, 1988, 1990, 1993 + * 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 @@ -15,8 +14,8 @@ * 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 at Ludd, University of - * Lule}, Sweden and its contributors. + * This product includes software developed by the University of + * California, Berkeley and its contributors. * 4. The name of the author may not be used to endorse or promote products * derived from this software without specific prior written permission * @@ -50,151 +49,7 @@ #include #include #include - -#define xtrace(x) -#define xdebug(x) - - -struct uvax_calls guc; /* Generic uVAX Calls */ -/* struct uvax_calls *ucp = &guc; /* not yet public !!! */ -static int uvax_callsSetup = 0; /* not yet setup */ - -u_long uVAX_phys2virt __P((u_long, struct uc_map *)); - -/* u_long uVAX_physmap; /* XXX another ugly hack... */ -int -uvax_notavail(s) - char *s; -{ - printf("\"%s()\" not available for uVAX (%s)\n", s, guc.uc_name); - /* - * should we panic() here??? - */ - return(0); -} - -int -uvax_setup(flags) - int flags; -{ - /* - * insert some defaults here !!! - */ - - /* - * Now call the specific routines to overwrite these defaults - */ - switch (vax_boardtype) { -#ifdef VAX630 - case VAX_BTYP_630: - ka630_setup(&guc, flags); - break; -#endif -#ifdef VAX410 - case VAX_BTYP_410: - ka410_setup(&guc, flags); - break; -#endif -#ifdef VAX43 - case VAX_BTYP_43: - ka43_setup(&guc, flags); - break; -#endif - default: - printf("don't know how to handle 0x%x\n", vax_boardtype); - printf("Let's try using the defaults...\n"); - } - uvax_callsSetup = 1; -} - -/* - * XXX_steal_pages() is the first cpu/board specific function to be called. - * Thus we use this call to setup the dispatch structure for further use. - * - * We should have a special setup-routine !!! - */ -void -uvax_steal_pages() -{ - if (uvax_callsSetup == 0) - uvax_setup(0); - - /* - * now that specific functions are inserted, we can call 'em - */ - if (guc.uc_steal_pages) { - (guc.uc_steal_pages)(); - return; - } - uvax_notavail("uc_steal_pages"); -} - -u_long -uvax_phys2virt(paddr) - u_long paddr; -{ - if (guc.uc_phys2virt) - return ((guc.uc_phys2virt)(paddr)); - if (guc.uc_physmap) - return (uVAX_phys2virt(paddr, guc.uc_physmap)); - uvax_notavail("uc_phys2virt"); - return (0); -} - -void -uvax_conf(parent, self, aux) - struct device *parent, *self; - void *aux; -{ - if (guc.uc_conf) { - (guc.uc_conf)(parent, self, aux); - return; - } - uvax_notavail("uc_conf"); -} - -void -uvax_memerr() -{ - xtrace(("uvax_memerr()\n")); - - if (guc.uc_memerr) { - (guc.uc_memerr)(); - return; - } - uvax_notavail("uc_memerr"); -} - -int -uvax_mchk(addr) - caddr_t addr; -{ - xtrace(("uvax_mchk(0x%x)\n", addr)); - - if (guc.uc_mchk) - return ((guc.uc_mchk)(addr)); - uvax_notavail("uc_mchk"); - return (-1); -} - -int -uvax_clkread(base) - time_t base; -{ - if (guc.uc_clkread) - return ((guc.uc_clkread)(base)); - uvax_notavail("uc_clkread"); -} - -void -uvax_clkwrite() -{ - if (guc.uc_clkwrite) - (guc.uc_clkwrite)(); - else - uvax_notavail("uc_clkwrite"); - return; -} +#include /* * NB: mapping should/must be done in chunks of PAGE_SIZE (ie. 1024), @@ -204,46 +59,14 @@ uvax_clkwrite() * the end-address up to be just beyond the next multiple of PAGE_SIZE. * size is the number of bytes between start and end expressed in NBPG. */ -int -uVAX_old_fillmap(um) - struct uc_map *um; -{ - extern vm_offset_t avail_start, virtual_avail, avail_end; - register struct uc_map *p; - register u_int base, end, size; - - for (p = um; p->um_base != 0; p++) { - base = p->um_base & ~PAGE_SIZE; /* round base down */ - end = ROUND_PAGE(p->um_end + 1) - 1; /* round end up */ - size = (end - base + 1) / NBPG; /* size in pages */ - MAPVIRT(p->um_virt, size); - pmap_map((vm_offset_t)p->um_virt, base, end, - VM_PROT_READ|VM_PROT_WRITE); - - xdebug(("uVAX_fillmap: %x:%x[%x] (%x:%x[%x]) --> %x\n", - p->um_base, p->um_end, p->um_size, - base, end, size, p->um_virt)); - - } -} - -/* - * NB: mapping should/must be done in chunks of PAGE_SIZE (ie. 1024), - * while pmap_map() expects size to be in chunks of NBPG (ie. 512). - * - * Thus we round down the start-address to be aligned wrt PAGE_SIZE and - * the end-address up to be just beyond the next multiple of PAGE_SIZE. - * size is the number of bytes between start and end expressed in NBPG. - */ -int -uVAX_fillmap(um) - struct uc_map *um; +void +uvax_fillmap() { extern vm_offset_t avail_start, virtual_avail, avail_end; register struct uc_map *p; register u_int base, end, off, size; - for (p = um; p->um_base != 0; p++) { + for (p = dep_call->cpu_map; p->um_base != 0; p++) { base = TRUNC_PAGE(p->um_base); /* round base down */ off = p->um_base - base; size = ROUND_PAGE(off + p->um_size); @@ -254,34 +77,28 @@ uVAX_fillmap(um) end = base + size - 1; MAPVIRT(p->um_virt, size/NBPG); pmap_map((vm_offset_t)p->um_virt, base, end, - VM_PROT_READ|VM_PROT_WRITE); - - xdebug(("uVAX_fillmap: %x:%x[%x] (%x:%x[%x]) --> %x\n", - p->um_base, p->um_end, p->um_size, - base, end, size, p->um_virt)); + VM_PROT_READ|VM_PROT_WRITE); } } u_long -uVAX_phys2virt(phys,um) +uvax_phys2virt(phys) u_long phys; - struct uc_map *um; { register struct uc_map *p; u_long virt = 0; - for (p = um; p->um_base != 0; p++) { + for (p = dep_call->cpu_map; p->um_base != 0; p++) { if (p->um_base > phys || p->um_end < phys) continue; virt = p->um_virt + (phys - trunc_page(p->um_base)); break; } - if (virt == 0) { - printf("invalid argument 0x%x to uvax_phys2virt()\n", phys); - /* should we panic() here ??? */ - } - +#ifdef DIAGNOSTIC + if (virt == 0) + panic("invalid argument %p to uvax_phys2virt()\n", phys); +#endif return (virt); }