diff options
author | Hugh Graham <hugh@cvs.openbsd.org> | 2002-09-21 13:42:44 +0000 |
---|---|---|
committer | Hugh Graham <hugh@cvs.openbsd.org> | 2002-09-21 13:42:44 +0000 |
commit | 9ece5736f3c08778b6b32edd958cd92fb1f2ac40 (patch) | |
tree | 2d5536488abb4ba29e05f0679301fbb97bbb6963 | |
parent | 8d92c183f58578ce544a783dce83056a48a0ee0b (diff) |
Add support for OS defined halt action on Cheetah and Omega.
Should also work on Legacy, but tester hasn't reported back yet...
-rw-r--r-- | sys/arch/vax/include/uvax.h | 35 | ||||
-rw-r--r-- | sys/arch/vax/vax/ka53.c | 25 | ||||
-rw-r--r-- | sys/arch/vax/vax/ka680.c | 25 | ||||
-rw-r--r-- | sys/arch/vax/vax/machdep.c | 28 |
4 files changed, 73 insertions, 40 deletions
diff --git a/sys/arch/vax/include/uvax.h b/sys/arch/vax/include/uvax.h index 28e40c331cc..9d65eb9e909 100644 --- a/sys/arch/vax/include/uvax.h +++ b/sys/arch/vax/include/uvax.h @@ -1,6 +1,7 @@ -/* $OpenBSD: uvax.h,v 1.4 2000/04/26 03:08:43 bjc Exp $ */ +/* $OpenBSD: uvax.h,v 1.5 2002/09/21 13:42:43 hugh Exp $ */ /* $NetBSD: uvax.h,v 1.5 1999/02/02 18:37:22 ragge Exp $ */ /* + * Copyright (c) 2002 Hugh Graham. * Copyright (c) 1996 Ludd, University of Lule}, Sweden. * All rights reserved. * @@ -84,4 +85,36 @@ struct vs_cpu { #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 diff --git a/sys/arch/vax/vax/ka53.c b/sys/arch/vax/vax/ka53.c index 214a6dc7d81..c9c7720aa9a 100644 --- a/sys/arch/vax/vax/ka53.c +++ b/sys/arch/vax/vax/ka53.c @@ -1,6 +1,7 @@ -/* $OpenBSD: ka53.c,v 1.4 2001/08/25 13:33:37 hugh Exp $ */ +/* $OpenBSD: ka53.c,v 1.5 2002/09/21 13:42:43 hugh Exp $ */ /* $NetBSD: ka53.c,v 1.2 2000/06/04 02:19:27 matt Exp $ */ /* + * Copyright (c) 2002 Hugh Graham. * Copyright (c) 2000 Ludd, University of Lule}, Sweden. * All rights reserved. * @@ -45,13 +46,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 680-specific calls. @@ -65,11 +63,10 @@ struct cpu_dep ka53_calls = { generic_clkwrite, 32, /* ~VUPS */ 2, /* SCB pages */ - ka53_halt, - ka53_reboot, + generic_halt, + generic_reboot, }; - void ka53_conf() { @@ -81,6 +78,8 @@ ka53_conf() /* This vector (qbus related?) comes out of nowhere, ignore it for now */ scb_vecalloc(0x0, (void *)nullop, NULL, SCB_ISTACK, NULL); + cpmbx = (struct cpmbx *)vax_map_physmem(0x20140400, 1); + switch((vax_siedata >> 8) & 0xFF) { case VAX_STYP_50: cpuname = "KA50"; @@ -236,15 +235,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"); -} diff --git a/sys/arch/vax/vax/ka680.c b/sys/arch/vax/vax/ka680.c index f4048d83827..7eeaa3e7fef 100644 --- a/sys/arch/vax/vax/ka680.c +++ b/sys/arch/vax/vax/ka680.c @@ -1,6 +1,7 @@ -/* $OpenBSD: ka680.c,v 1.9 2002/07/21 09:17:14 hugh Exp $ */ +/* $OpenBSD: ka680.c,v 1.10 2002/09/21 13:42:43 hugh Exp $ */ /* $NetBSD: ka680.c,v 1.3 2001/01/28 21:01:53 ragge Exp $ */ /* + * Copyright (c) 2002 Hugh Graham. * Copyright (c) 2000 Ludd, University of Lule}, Sweden. * All rights reserved. * @@ -57,8 +58,6 @@ static void ka680_hardmem(void *); static void ka680_steal_pages(void); static void ka680_memerr(void); static int ka680_mchk(caddr_t); -static void ka680_halt(void); -static void ka680_reboot(int); /* * KA680-specific IPRs. KA680 has the funny habit to control all caches @@ -96,11 +95,10 @@ struct cpu_dep ka680_calls = { generic_clkwrite, 24, /* ~VUPS */ 2, /* SCB pages */ - ka680_halt, - ka680_reboot, + generic_halt, + generic_reboot, }; - void ka680_conf() { @@ -112,6 +110,8 @@ ka680_conf() *hej = *hej; hej[-1] = hej[-1]; + cpmbx = (struct cpmbx *)vax_map_physmem(0x20140400, 1); + switch(vax_boardtype) { case VAX_BTYP_1301: switch((vax_siedata & 0xff00) >> 8) { @@ -288,16 +288,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"); -} - diff --git a/sys/arch/vax/vax/machdep.c b/sys/arch/vax/vax/machdep.c index 2a6d400a6cf..5a58a99f76e 100644 --- a/sys/arch/vax/vax/machdep.c +++ b/sys/arch/vax/vax/machdep.c @@ -1,7 +1,8 @@ -/* $OpenBSD: machdep.c,v 1.60 2002/07/20 19:24:57 art Exp $ */ +/* $OpenBSD: machdep.c,v 1.61 2002/09/21 13:42:43 hugh Exp $ */ /* $NetBSD: machdep.c,v 1.108 2000/09/13 15:00:23 thorpej Exp $ */ /* + * Copyright (c) 2002, Hugh Graham. * Copyright (c) 2002, Miodrag Vallat. * Copyright (c) 1994, 1996, 1998 Ludd, University of Lule}, Sweden. * Copyright (c) 1993 Adam Glass @@ -157,6 +158,7 @@ char cpu_model[100]; int physmem; int dumpsize = 0; int cold = 1; /* coldstart */ +struct cpmbx *cpmbx; /* * XXX some storage space must be allocated statically because of @@ -975,3 +977,27 @@ skip_operand(ib, size) return ib; } + +void +generic_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->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"); +} |