Add common routines to talk with the CPMBX, from Hugh Graham (hugh@openbsd.org)
This makes halt/reboot work correctly on a bunch of machines.
This commit is contained in:
parent
f33e9b1e1a
commit
780401f935
|
@ -1,5 +1,6 @@
|
|||
/* $NetBSD: uvax.h,v 1.6 2000/06/02 21:39:54 matt Exp $ */
|
||||
/* $NetBSD: uvax.h,v 1.7 2002/09/28 09:53:07 ragge Exp $ */
|
||||
/*
|
||||
* Copyright (c) 2002 Hugh Graham.
|
||||
* Copyright (c) 1996 Ludd, University of Lule}, Sweden.
|
||||
* All rights reserved.
|
||||
*
|
||||
|
@ -15,8 +16,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
|
||||
*
|
||||
|
@ -38,49 +39,82 @@
|
|||
/*
|
||||
* Generic definitions common on all MicroVAXen clock chip.
|
||||
*/
|
||||
#define uVAX_CLKVRT 0200
|
||||
#define uVAX_CLKUIP 0200
|
||||
#define uVAX_CLKRATE 040
|
||||
#define uVAX_CLKENABLE 06
|
||||
#define uVAX_CLKSET 0206
|
||||
#define uVAX_CLKVRT 0200
|
||||
#define uVAX_CLKUIP 0200
|
||||
#define uVAX_CLKRATE 040
|
||||
#define uVAX_CLKENABLE 06
|
||||
#define uVAX_CLKSET 0206
|
||||
|
||||
/* cpmbx bits */
|
||||
#define uVAX_CLKHLTACT 03
|
||||
#define uVAX_CLKHLTACT 03
|
||||
|
||||
/* halt action values */
|
||||
#define uVAX_CLKRESTRT 01
|
||||
#define uVAX_CLKREBOOT 02
|
||||
#define uVAX_CLKHALT 03
|
||||
#define uVAX_CLKRESTRT 01
|
||||
#define uVAX_CLKREBOOT 02
|
||||
#define uVAX_CLKHALT 03
|
||||
|
||||
/* in progress flags */
|
||||
#define uVAX_CLKBOOT 04
|
||||
#define uVAX_CLKRSTRT 010
|
||||
#define uVAX_CLKLANG 0360
|
||||
#define uVAX_CLKBOOT 04
|
||||
#define uVAX_CLKRSTRT 010
|
||||
#define uVAX_CLKLANG 0360
|
||||
|
||||
/*
|
||||
* Miscellaneous registers common on most VAXststions.
|
||||
*/
|
||||
struct vs_cpu {
|
||||
u_long vc_hltcod; /* 00 - Halt Code Register */
|
||||
u_long vc_410mser; /* 04 - VS2K */
|
||||
u_long vc_410cear; /* 08 - VS2K */
|
||||
u_long vc_hltcod; /* 00 - Halt Code Register */
|
||||
u_long vc_410mser; /* 04 - VS2K */
|
||||
u_long vc_410cear; /* 08 - VS2K */
|
||||
u_char vc_intmsk; /* 0c - Interrupt mask register */
|
||||
u_char vc_vdcorg; /* 0d - Mono display origin */
|
||||
u_char vc_vdcsel; /* 0e - Video interrupt select */
|
||||
u_char vc_intreq; /* 0f - Interrupt request register */
|
||||
#define vc_intclr vc_intreq
|
||||
u_short vc_diagdsp; /* 10 - Diagnostic display register */
|
||||
u_short pad4; /* 12 */
|
||||
u_long vc_parctl; /* 14 - Parity Control Register */
|
||||
#define vc_bwf0 vc_parctl
|
||||
u_short pad5; /* 16 */
|
||||
u_short pad6; /* 18 */
|
||||
u_short vc_diagtimu; /* 1a - usecond timer KA46 */
|
||||
u_short vc_diagtme; /* 1c - Diagnostic time register */
|
||||
#define vc_diagtimm vc_diagtme /* msecond time KA46 */
|
||||
#define vc_intclr vc_intreq
|
||||
u_short vc_diagdsp; /* 10 - Diagnostic display register */
|
||||
u_short pad4; /* 12 */
|
||||
u_long vc_parctl; /* 14 - Parity Control Register */
|
||||
#define vc_bwf0 vc_parctl
|
||||
u_short pad5; /* 16 */
|
||||
u_short pad6; /* 18 */
|
||||
u_short vc_diagtimu; /* 1a - usecond timer KA46 */
|
||||
u_short vc_diagtme; /* 1c - Diagnostic time register */
|
||||
#define vc_diagtimm vc_diagtme /* msecond time KA46 */
|
||||
};
|
||||
#define PARCTL_DMA 0x1000000
|
||||
#define PARCTL_CPEN 2
|
||||
#define PARCTL_DPEN 1
|
||||
#define PARCTL_DMA 0x1000000
|
||||
#define PARCTL_CPEN 2
|
||||
#define PARCTL_DPEN 1
|
||||
|
||||
|
||||
/*
|
||||
* Console Mailbox layout common to several models.
|
||||
*/
|
||||
|
||||
struct cpmbx {
|
||||
unsigned int mbox_halt:2; /* mailbox halt action */
|
||||
unsigned int mbox_bip:1; /* bootstrap in progress */
|
||||
unsigned int mbox_rip:1; /* restart in progress */
|
||||
unsigned int mbox_lang:4; /* language info */
|
||||
unsigned int terminal:8; /* terminal info */
|
||||
unsigned int keyboard:8; /* keyboard info */
|
||||
unsigned int user_four:4; /* unknown */
|
||||
unsigned int user_halt:3; /* user halt action */
|
||||
unsigned int user_one:1; /* unknown */
|
||||
};
|
||||
|
||||
extern struct cpmbx *cpmbx;
|
||||
|
||||
void generic_halt(void);
|
||||
void generic_reboot(int);
|
||||
|
||||
#define MHALT_RESTART_REBOOT 0
|
||||
#define MHALT_RESTART 1
|
||||
#define MHALT_REBOOT 2
|
||||
#define MHALT_HALT 3
|
||||
|
||||
#define UHALT_DEFAULT 0
|
||||
#define UHALT_RESTART 1
|
||||
#define UHALT_REBOOT 2
|
||||
#define UHALT_HALT 3
|
||||
#define UHALT_RESTART_REBOOT 4
|
||||
|
||||
#endif
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
/* $NetBSD: ka53.c,v 1.7 2002/02/24 01:04:27 matt Exp $ */
|
||||
/* $NetBSD: ka53.c,v 1.8 2002/09/28 09:53:07 ragge Exp $ */
|
||||
/*
|
||||
* Copyright (c) 2002 Hugh Graham.
|
||||
* Copyright (c) 2000 Ludd, University of Lule}, Sweden.
|
||||
* All rights reserved.
|
||||
*
|
||||
|
@ -50,13 +51,10 @@
|
|||
static void ka53_conf(void);
|
||||
static void ka53_memerr(void);
|
||||
static int ka53_mchk(caddr_t);
|
||||
static void ka53_halt(void);
|
||||
static void ka53_reboot(int);
|
||||
static void ka53_softmem(void *);
|
||||
static void ka53_hardmem(void *);
|
||||
static void ka53_steal_pages(void);
|
||||
static void ka53_cache_enable(void);
|
||||
static void ka53_halt(void);
|
||||
|
||||
/*
|
||||
* Declaration of 53-specific calls.
|
||||
|
@ -70,14 +68,13 @@ struct cpu_dep ka53_calls = {
|
|||
generic_clkwrite,
|
||||
32, /* ~VUPS */
|
||||
2, /* SCB pages */
|
||||
ka53_halt,
|
||||
ka53_reboot,
|
||||
generic_halt,
|
||||
generic_reboot,
|
||||
NULL,
|
||||
NULL,
|
||||
CPU_RAISEIPL,
|
||||
};
|
||||
|
||||
|
||||
void
|
||||
ka53_conf()
|
||||
{
|
||||
|
@ -88,6 +85,8 @@ ka53_conf()
|
|||
*hej = *hej;
|
||||
hej[-1] = hej[-1];
|
||||
|
||||
cpmbx = (struct cpmbx *)vax_map_physmem(0x20140400, 1);
|
||||
|
||||
switch((vax_siedata & 0xff00) >> 8) {
|
||||
case VAX_STYP_51: cpuname = "KA51"; break;
|
||||
case VAX_STYP_52: cpuname = "KA52"; break;
|
||||
|
@ -233,16 +232,3 @@ ka53_steal_pages()
|
|||
/* Turn on caches (to speed up execution a bit) */
|
||||
ka53_cache_enable();
|
||||
}
|
||||
|
||||
static void
|
||||
ka53_halt()
|
||||
{
|
||||
asm("halt");
|
||||
}
|
||||
|
||||
static void
|
||||
ka53_reboot(int arg)
|
||||
{
|
||||
asm("halt");
|
||||
}
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: ka660.c,v 1.3 2000/06/29 07:14:27 mrg Exp $ */
|
||||
/* $NetBSD: ka660.c,v 1.4 2002/09/28 09:53:08 ragge Exp $ */
|
||||
/*
|
||||
* Copyright (c) 2000 Ludd, University of Lule}, Sweden.
|
||||
* All rights reserved.
|
||||
|
@ -62,8 +62,6 @@
|
|||
static void ka660_conf(void);
|
||||
static void ka660_memerr(void);
|
||||
static int ka660_mchk(caddr_t);
|
||||
static void ka660_halt(void);
|
||||
static void ka660_reboot(int);
|
||||
static void ka660_cache_enable(void);
|
||||
|
||||
struct vs_cpu *ka660_cpu;
|
||||
|
@ -80,8 +78,8 @@ struct cpu_dep ka660_calls = {
|
|||
generic_clkwrite,
|
||||
6, /* ~VUPS */
|
||||
2, /* SCB pages */
|
||||
ka660_halt,
|
||||
ka660_reboot,
|
||||
generic_halt,
|
||||
generic_reboot,
|
||||
};
|
||||
|
||||
|
||||
|
@ -89,6 +87,8 @@ void
|
|||
ka660_conf()
|
||||
{
|
||||
printf("cpu0: KA660, microcode Rev. %d\n", vax_cpudata & 0377);
|
||||
|
||||
cpmbx = (struct cpmbx *)vax_map_physmem(0x20140400, 1);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -135,16 +135,3 @@ ka660_mchk(addr)
|
|||
panic("Machine check");
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void
|
||||
ka660_halt()
|
||||
{
|
||||
asm("halt");
|
||||
}
|
||||
|
||||
static void
|
||||
ka660_reboot(int arg)
|
||||
{
|
||||
asm("halt");
|
||||
}
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: ka670.c,v 1.8 2002/09/27 15:36:59 provos Exp $ */
|
||||
/* $NetBSD: ka670.c,v 1.9 2002/09/28 09:53:08 ragge Exp $ */
|
||||
/*
|
||||
* Copyright (c) 1999 Ludd, University of Lule}, Sweden.
|
||||
* All rights reserved.
|
||||
|
@ -56,8 +56,6 @@ static void ka670_conf __P((void));
|
|||
static int ka670_mchk __P((caddr_t));
|
||||
static void ka670_memerr __P((void));
|
||||
static int ka670_cache_init __P((void)); /* "int mapen" as argument? */
|
||||
static void ka670_halt __P((void));
|
||||
static void ka670_reboot __P((int));
|
||||
|
||||
struct cpu_dep ka670_calls = {
|
||||
0,
|
||||
|
@ -68,8 +66,8 @@ struct cpu_dep ka670_calls = {
|
|||
generic_clkwrite,
|
||||
8, /* 8 VUP */
|
||||
2, /* SCB pages */
|
||||
ka670_halt,
|
||||
ka670_reboot,
|
||||
generic_halt,
|
||||
generic_reboot,
|
||||
0,
|
||||
};
|
||||
|
||||
|
@ -215,18 +213,6 @@ ka670_conf()
|
|||
* init/reset the caches.
|
||||
*/
|
||||
ka670_cache_init();
|
||||
}
|
||||
|
||||
static void
|
||||
ka670_halt()
|
||||
{
|
||||
asm("halt");
|
||||
cpmbx = (struct cpmbx *)vax_map_physmem(0x20140400, 1);
|
||||
}
|
||||
|
||||
static void
|
||||
ka670_reboot(arg)
|
||||
int arg;
|
||||
{
|
||||
asm("halt");
|
||||
}
|
||||
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
/* $NetBSD: ka680.c,v 1.7 2002/02/24 01:04:27 matt Exp $ */
|
||||
/* $NetBSD: ka680.c,v 1.8 2002/09/28 09:53:08 ragge Exp $ */
|
||||
/*
|
||||
* Copyright (c) 2002 Hugh Graham.
|
||||
* Copyright (c) 2000 Ludd, University of Lule}, Sweden.
|
||||
* All rights reserved.
|
||||
*
|
||||
|
@ -56,8 +57,6 @@ static void ka680_hardmem __P((void *));
|
|||
static void ka680_steal_pages __P((void));
|
||||
static void ka680_memerr __P((void));
|
||||
static int ka680_mchk __P((caddr_t));
|
||||
static void ka680_halt __P((void));
|
||||
static void ka680_reboot __P((int));
|
||||
|
||||
/*
|
||||
* KA680-specific IPRs. KA680 has the funny habit to control all caches
|
||||
|
@ -95,8 +94,8 @@ struct cpu_dep ka680_calls = {
|
|||
generic_clkwrite,
|
||||
24, /* ~VUPS */
|
||||
2, /* SCB pages */
|
||||
ka680_halt,
|
||||
ka680_reboot,
|
||||
generic_halt,
|
||||
generic_reboot,
|
||||
NULL,
|
||||
NULL,
|
||||
CPU_RAISEIPL,
|
||||
|
@ -114,6 +113,8 @@ ka680_conf()
|
|||
*hej = *hej;
|
||||
hej[-1] = hej[-1];
|
||||
|
||||
cpmbx = (struct cpmbx *)vax_map_physmem(0x20140400, 1);
|
||||
|
||||
switch(vax_boardtype) {
|
||||
case VAX_BTYP_680: switch((vax_siedata & 0xff00) >> 8) {
|
||||
case VAX_STYP_675: cpuname = "KA675"; break;
|
||||
|
@ -286,16 +287,3 @@ ka680_mchk(caddr_t addr)
|
|||
panic("Machine check");
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void
|
||||
ka680_halt()
|
||||
{
|
||||
asm("halt");
|
||||
}
|
||||
|
||||
static void
|
||||
ka680_reboot(int arg)
|
||||
{
|
||||
asm("halt");
|
||||
}
|
||||
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
/* $NetBSD: machdep.c,v 1.128 2002/09/25 21:25:39 thorpej Exp $ */
|
||||
/* $NetBSD: machdep.c,v 1.129 2002/09/28 09:53:08 ragge Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2002, Hugh Graham.
|
||||
* Copyright (c) 1994, 1998 Ludd, University of Lule}, Sweden.
|
||||
* Copyright (c) 1993 Adam Glass
|
||||
* Copyright (c) 1988 University of Utah.
|
||||
|
@ -107,6 +108,7 @@ int physmem;
|
|||
int *symtab_start;
|
||||
int *symtab_end;
|
||||
int symtab_nsyms;
|
||||
struct cpmbx *cpmbx; /* Console program mailbox address */
|
||||
|
||||
/*
|
||||
* Extent map to manage I/O register space. We allocate storage for
|
||||
|
@ -932,3 +934,37 @@ krnunlock()
|
|||
KERNEL_UNLOCK();
|
||||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Generic routines for machines with "console program mailbox".
|
||||
*/
|
||||
void
|
||||
generic_halt()
|
||||
{
|
||||
if (cpmbx == NULL) /* Too late to complain here, but avoid panic */
|
||||
asm("halt");
|
||||
|
||||
if (cpmbx->user_halt != UHALT_DEFAULT) {
|
||||
if (cpmbx->mbox_halt != 0)
|
||||
cpmbx->mbox_halt = 0; /* let console override */
|
||||
} else if (cpmbx->mbox_halt != MHALT_HALT)
|
||||
cpmbx->mbox_halt = MHALT_HALT; /* the os decides */
|
||||
|
||||
asm("halt");
|
||||
}
|
||||
|
||||
void
|
||||
generic_reboot(int arg)
|
||||
{
|
||||
if (cpmbx == NULL) /* Too late to complain here, but avoid panic */
|
||||
asm("halt");
|
||||
|
||||
if (cpmbx->user_halt != UHALT_DEFAULT) {
|
||||
if (cpmbx->mbox_halt != 0)
|
||||
cpmbx->mbox_halt = 0;
|
||||
} else if (cpmbx->mbox_halt != MHALT_REBOOT)
|
||||
cpmbx->mbox_halt = MHALT_REBOOT;
|
||||
|
||||
asm("halt");
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue