Cache and microsecond clock resolution on KA46.

This commit is contained in:
ragge 1998-08-11 17:52:57 +00:00
parent b2f8ac044f
commit 2c639fb882
6 changed files with 71 additions and 98 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: ka46.h,v 1.1 1998/08/10 14:33:33 ragge Exp $ */
/* $NetBSD: ka46.h,v 1.2 1998/08/11 17:52:58 ragge Exp $ */
/*
* Copyright (c) 1998 Ludd, University of Lule}, Sweden.
* All rights reserved.
@ -41,3 +41,15 @@
#define PCTAG_PARITY 0x80000000
#define PCTAG_VALID 1
/* memory addresses of interest */
#define KA46_INVFLT 0x20200000
#define KA46_INVFLTSZ 32768
#define KA46_CCR 0x23000000
#define KA46_TAGST 0x2d000000
#define KA46_TAGSZ 32768
#define CCR_CENA 0x00000001
#define CCR_SPECIO 0x00000010
#define KA46_BWF0 0x20080014
#define BWF0_FEN 0x01000000

View File

@ -1,4 +1,4 @@
/* $NetBSD: uvax.h,v 1.3 1998/05/22 09:49:08 ragge Exp $ */
/* $NetBSD: uvax.h,v 1.4 1998/08/11 17:52:59 ragge Exp $ */
/*
* Copyright (c) 1996 Ludd, University of Lule}, Sweden.
* All rights reserved.
@ -35,50 +35,6 @@
#ifndef _VAX_UVAX_H_
#define _VAX_UVAX_H_
/*
* generic(?) MicroVAX and VAXstation support
*
* There are similarities to struct cpu_calls[] in autoconf.c
*/
/*
* Prototypes for autoconf.c
*/
struct device;
void uvax_conf __P((struct device*, struct device*, void*));
int uvax_clock __P((void));
void uvax_memerr __P((void));
int uvax_mchk __P((caddr_t));
void uvax_steal_pages __P((void));
int uvax_setup __P((int mapen));
struct uvax_calls {
u_long (*uc_memsize) __P((void));
char *uc_name;
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_vups; /* used by delay() */
int uv_flags;
int vs_flags;
};
extern struct uvax_calls guc; /* Generic uVAX Calls */
extern struct uvax_calls *ucp;
struct uc_map {
u_long um_base;
u_long um_end;
u_long um_size;
u_long um_virt;
};
extern struct uc_map *uc_physmap;
/*
* Generic definitions common on all MicroVAXen clock chip.
*/
@ -116,18 +72,16 @@ struct vs_cpu {
u_short vc_diagdsp; /* Diagnostic display register */
u_short pad4;
u_long vc_parctl; /* Parity Control Register */
#define vc_bwf0 vc_parctl
u_short pad5;
u_short pad6;
u_short pad7;
u_short vc_diagtimu; /* usecond timer KA46 */
u_short vc_diagtme; /* Diagnostic time register */
#define vc_diagtimm vc_diagtme /* msecond time KA46 */
};
#define PARCTL_DMA 0x1000000
#define PARCTL_CPEN 2
#define PARCTL_DPEN 1
/* Prototypes */
int uvax_clkread __P((time_t));
void uvax_clkwrite __P((void));
void uvax_fillmap __P((void));
u_long uvax_phys2virt __P((u_long));
struct vs_cpu *vs_cpu; /* Common CPU registers */
#endif

View File

@ -1,4 +1,4 @@
/* $NetBSD: clock.c,v 1.22 1998/04/13 12:10:27 ragge Exp $ */
/* $NetBSD: clock.c,v 1.23 1998/08/11 17:52:57 ragge Exp $ */
/*
* Copyright (c) 1995 Ludd, University of Lule}, Sweden.
* All rights reserved.
@ -41,9 +41,7 @@
#include <machine/sid.h>
#include <machine/clock.h>
#include <machine/cpu.h>
static unsigned long year; /* start of current year in seconds */
static unsigned long year_len; /* length of current year in 100th of seconds */
#include <machine/uvax.h>
int yeartonum __P((int));
int numtoyear __P((int));
@ -57,19 +55,24 @@ void
microtime(tvp)
struct timeval *tvp;
{
u_int int_time, tmp_year;
int s, i;
static struct timeval lasttime;
s = splhigh();
int_time = mfpr(PR_TODR);
bcopy((caddr_t)&time, tvp, sizeof(struct timeval));
asm ("movc3 %0,(%1),(%2)"
:
: "r" (sizeof(struct timeval)),"r" (&time),"r"(tvp)
:"r0","r1","r2","r3","r4","r5");
i = mfpr(PR_ICR) + tick; /* Get current interval count */
switch (vax_boardtype) {
#ifdef VAX46
case VAX_BTYP_46:
i = *(volatile int *)(&vs_cpu->vc_diagtimu);
i = (i >> 16) * 1024 + (i & 0x3ff);
break;
#endif
default:
i = mfpr(PR_ICR);
break;
}
i += tick; /* Get current interval count */
tvp->tv_usec += i;
while (tvp->tv_usec > 1000000) {
tvp->tv_sec++;
@ -82,13 +85,6 @@ microtime(tvp)
tvp->tv_usec -= 1000000;
}
bcopy(tvp, &lasttime, sizeof(struct timeval));
if (int_time > year_len) {
mtpr(mfpr(PR_TODR) - year_len, PR_TODR);
year += year_len / 100;
tmp_year = year / SEC_PER_DAY / 365 + 2;
year_len = 100 * SEC_PER_DAY *
((tmp_year % 4 && tmp_year != 32) ? 365 : 366);
}
splx(s);
}
@ -168,7 +164,7 @@ generic_clock()
}
#endif
#if VAX650 || VAX630 || VAX410 || VAX43
#if VAX650 || VAX630 || VAX410 || VAX43 || VAX46
/*
* Most microvaxen don't have a interval count register.
*/

View File

@ -1,4 +1,4 @@
# $NetBSD: genassym.cf,v 1.5 1998/05/03 12:59:57 ragge Exp $
# $NetBSD: genassym.cf,v 1.6 1998/08/11 17:52:57 ragge Exp $
#
# Copyright (c) 1997 Ludd, University of Lule}, Sweden.
# All rights reserved.
@ -106,3 +106,4 @@ define ENAMETOOLONG ENAMETOOLONG
define SYS_sigreturn SYS_sigreturn
define VAX_TYP_UV2 VAX_TYP_UV2
define VAX_BTYP_46 VAX_BTYP_46

View File

@ -1,4 +1,4 @@
/* $NetBSD: intvec.s,v 1.30 1998/07/05 06:49:10 jonathan Exp $ */
/* $NetBSD: intvec.s,v 1.31 1998/08/11 17:52:58 ragge Exp $ */
/*
* Copyright (c) 1994, 1997 Ludd, University of Lule}, Sweden.
@ -406,7 +406,13 @@ ENTRY(netint)
.globl hardclock
hardclock: mtpr $0xc1,$PR_ICCS # Reset interrupt flag
pushr $0x3f
pushl sp
#ifdef VAX46
cmpl _vax_boardtype,$VAX_BTYP_46
bneq 1f
movl _vs_cpu,r0
clrl 0x1c(r0)
#endif
1: pushl sp
addl2 $24,(sp)
calls $1,_hardclock
popr $0x3f

View File

@ -1,4 +1,4 @@
/* $NetBSD: ka46.c,v 1.1 1998/08/10 14:31:07 ragge Exp $ */
/* $NetBSD: ka46.c,v 1.2 1998/08/11 17:52:58 ragge Exp $ */
/*
* Copyright (c) 1998 Ludd, University of Lule}, Sweden.
* All rights reserved.
@ -54,24 +54,14 @@
#include <machine/clock.h>
#include <machine/vsbus.h>
#include "smg.h"
#include "ry.h"
#include "ncr.h"
static void ka46_conf __P((struct device*, struct device*, void*));
static void ka46_steal_pages __P((void));
static void ka46_memerr __P((void));
static int ka46_mchk __P((caddr_t));
static void ka46_halt __P((void));
static void ka46_reboot __P((int));
#if 0
static void ka46_cache_enable __P((void));
static caddr_t l2cache; /* mapped in address */
static long *cacr; /* l2csche ctlr reg */
#endif
static int *io_map; /* Virtual address of i/o map */
extern short *clk_page;
/*
@ -97,29 +87,41 @@ ka46_conf(parent, self, aux)
void *aux;
{
printf(": KA46\n");
#if 0
printf("%s: Enabling cache\n", self->dv_xname);
ka46_cache_enable();
#endif
printf("%s: turning on floating point chip\n", self->dv_xname);
mtpr(2, PR_ACCS); /* Enable floating points */
}
#if 0
void
ka46_cache_enable()
{
int i;
int i, *tmp;
/* Disable and clear cache */
mtpr(PCSTS_FLUSH, PR_PCSTS);
/* Write valid parity to all cache entries */
/* Disable caches */
*(int *)KA46_CCR &= ~CCR_SPECIO;/* secondary */
mtpr(PCSTS_FLUSH, PR_PCSTS); /* primary */
*(int *)KA46_BWF0 &= ~BWF0_FEN; /* invalidate filter */
/* Clear caches */
tmp = (void *)KA46_INVFLT; /* inv filter */
for (i = 0; i < 32768; i++)
tmp[i] = 0;
/* Write valid parity to all primary cache entries */
for (i = 0; i < 256; i++) {
mtpr(i << 3, PR_PCIDX);
mtpr(PCTAG_PARITY, PR_PCTAG);
}
mtpr(PCSTS_FLUSH, PR_PCSTS);
/* Secondary cache */
tmp = (void *)KA46_TAGST;
for (i = 0; i < KA46_TAGSZ*2; i+=2)
tmp[i] = 0;
/* Enable cache */
*(int *)KA46_BWF0 |= BWF0_FEN; /* invalidate filter */
mtpr(PCSTS_ENABLE, PR_PCSTS);
*(int *)KA46_CCR = CCR_SPECIO | CCR_CENA;
}
#endif
void
ka46_memerr()
@ -182,6 +184,8 @@ ka46_steal_pages()
MAPPHYS(le_iomem, (NI_IOSIZE/NBPG), VM_PROT_READ|VM_PROT_WRITE);
/* Turn on caches (to speed up execution a bit) */
ka46_cache_enable();
/*
* The I/O MMU maps all 16K device addressable memory to
* the low 16M of the physical memory. In this way the
@ -192,7 +196,7 @@ ka46_steal_pages()
* This will be reworked the day NetBSD/vax changes to
* 4K pages. (No use before that).
*/
{ int *lio_map;
{ int *io_map, *lio_map;
avail_end &= ~0x3ffff;
lio_map = (int *)avail_end;