From 802ac63ea3c782b3ecbac7d4ad707eb2552faff3 Mon Sep 17 00:00:00 2001 From: Miod Vallat Date: Sat, 11 Jul 2009 19:56:05 +0000 Subject: When rebooting, pass a request to the PROM for it to skip diagnostics and memory initialization. This reduces memory test and initialization time from a "in soviet russia, memory test you" time of over 2 minutes for 1GB on Origin 200, to a more reasonable 12 seconds (and on a Fuel with 2GB, time goes down from 6 seconds to under a second). --- sys/arch/sgi/include/mnode.h | 16 ++++++++++++++-- sys/arch/sgi/sgi/ip27_machdep.c | 40 ++++++++++++++++++++++++++++++++++++---- 2 files changed, 50 insertions(+), 6 deletions(-) diff --git a/sys/arch/sgi/include/mnode.h b/sys/arch/sgi/include/mnode.h index 65bfec9c657..d0bbd0a72e9 100644 --- a/sys/arch/sgi/include/mnode.h +++ b/sys/arch/sgi/include/mnode.h @@ -1,4 +1,4 @@ -/* $OpenBSD: mnode.h,v 1.8 2009/07/06 22:46:40 miod Exp $ */ +/* $OpenBSD: mnode.h,v 1.9 2009/07/11 19:56:02 miod Exp $ */ /* * Copyright (c) 2004 Opsycon AB (www.opsycon.se / www.opsycon.com) @@ -373,7 +373,7 @@ typedef struct gda { uint32_t magic; /* GDA_MAGIC */ uint16_t ver; uint16_t masternasid; /* NASID of the master cpu */ - uint32_t promop; + uint32_t promop; /* Request to pass to PROM */ uint32_t switches; void *tlb_handlers[3]; uint partid; @@ -385,6 +385,18 @@ typedef struct gda { int16_t nasid[GDA_MAXNODES]; /* NASID of connected nodes */ } gda_t; +#define GDA_PROMOP_MAGIC 0x0ead0000 +/* commands */ +#define GDA_PROMOP_HALT 0x00000010 +#define GDA_PROMOP_POWERDOWN 0x00000020 +#define GDA_PROMOP_RESTART 0x00000030 +#define GDA_PROMOP_REBOOT 0x00000040 +#define GDA_PROMOP_EIM 0x00000050 +/* options */ +#define GDA_PROMOP_NO_DIAGS 0x00000100 /* don't run diagnostics */ +#define GDA_PROMOP_NO_MEMINIT 0x00000200 /* don't initialize memory */ +#define GDA_PROMOP_NO_DEVINIT 0x00000400 /* don't initialize devices */ + /* ========== */ /* diff --git a/sys/arch/sgi/sgi/ip27_machdep.c b/sys/arch/sgi/sgi/ip27_machdep.c index 081ce363da6..ebb3cfb4dff 100644 --- a/sys/arch/sgi/sgi/ip27_machdep.c +++ b/sys/arch/sgi/sgi/ip27_machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ip27_machdep.c,v 1.16 2009/07/06 22:46:43 miod Exp $ */ +/* $OpenBSD: ip27_machdep.c,v 1.17 2009/07/11 19:56:04 miod Exp $ */ /* * Copyright (c) 2008, 2009 Miodrag Vallat. @@ -397,17 +397,49 @@ ip27_widget_id(int16_t nasid, u_int widget, uint32_t *wid) void ip27_halt(int howto) { + uint32_t promop; + /* * Even if ARCBios TLB and exception vectors are restored, * returning to ARCBios doesn't work. * * So, instead, send a reset through the network interface - * of the Hub space. Unfortunately there is no known way - * to tell the PROM which action we want it to take afterwards. + * of the Hub space. Although there seems to be a way to tell + * the PROM which action we want it to take afterwards, it + * always reboots for me... */ - if (howto & RB_HALT) + if (howto & RB_HALT) { +#if 0 + if (howto & RB_POWERDOWN) + promop = GDA_PROMOP_HALT; + else + promop = GDA_PROMOP_EIM; +#else return; /* caller will spin */ +#endif + } else + promop = GDA_PROMOP_REBOOT; + + promop |= GDA_PROMOP_MAGIC | GDA_PROMOP_NO_DIAGS | + GDA_PROMOP_NO_MEMINIT; + +#if 0 + /* + * That's what one would expect, based on the gda layout... + */ + gda->promop = promop; +#else + /* + * ...but the magic location is in a different castle. + * And it's not even the same between IP27 and IP35. + * Laugh, everyone! It's what SGI wants us to. + */ + if (ip35) + IP27_LHUB_S(HUBLBBASE_IP35 + 0x8010, promop); + else + IP27_LHUB_S(HUBPIBASE + 0x418, promop); +#endif if (ip35) { IP27_LHUB_S(HUBNIBASE_IP35 + HUBNI_RESET_ENABLE, -- cgit v1.2.3