diff options
author | Konstantin Ananyev <Konstantin.Ananyev@Sun.COM> | 2010-02-18 08:45:09 -0800 |
---|---|---|
committer | Konstantin Ananyev <Konstantin.Ananyev@Sun.COM> | 2010-02-18 08:45:09 -0800 |
commit | 5ee8e422dc45ae866a24584daa90397099b2f01b (patch) | |
tree | 196e59de802fb35d12327cb0223e08b86eb8f0e4 | |
parent | 06b6cf06b74a389fffb05757ac98e72e89a9d9c9 (diff) | |
download | illumos-gate-5ee8e422dc45ae866a24584daa90397099b2f01b.tar.gz |
6927194 FMA needs API to disable fastreboot from kernel
-rw-r--r-- | usr/src/uts/i86pc/os/fakebop.c | 4 | ||||
-rw-r--r-- | usr/src/uts/i86pc/os/fastboot.c | 76 | ||||
-rw-r--r-- | usr/src/uts/i86pc/os/machdep.c | 3 | ||||
-rw-r--r-- | usr/src/uts/i86pc/sys/fastboot.h | 9 | ||||
-rw-r--r-- | usr/src/uts/i86pc/sys/fastboot_impl.h | 57 | ||||
-rw-r--r-- | usr/src/uts/i86pc/sys/fastboot_msg.h | 58 |
6 files changed, 193 insertions, 14 deletions
diff --git a/usr/src/uts/i86pc/os/fakebop.c b/usr/src/uts/i86pc/os/fakebop.c index 00f84d7e34..1c23b7643c 100644 --- a/usr/src/uts/i86pc/os/fakebop.c +++ b/usr/src/uts/i86pc/os/fakebop.c @@ -127,9 +127,9 @@ int force_fastreboot = 0; volatile int fastreboot_onpanic = 0; int post_fastreboot = 0; #ifdef __xpv -int fastreboot_capable = 0; +volatile int fastreboot_capable = 0; #else -int fastreboot_capable = 1; +volatile int fastreboot_capable = 1; #endif /* diff --git a/usr/src/uts/i86pc/os/fastboot.c b/usr/src/uts/i86pc/os/fastboot.c index 8c252d21fc..4cedb0be28 100644 --- a/usr/src/uts/i86pc/os/fastboot.c +++ b/usr/src/uts/i86pc/os/fastboot.c @@ -20,7 +20,7 @@ */ /* - * Copyright 2009 Sun Microsystems, Inc. All rights reserved. + * Copyright 2010 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -91,7 +91,7 @@ #include <sys/smp_impldefs.h> #include <sys/spl.h> -#include <sys/fastboot.h> +#include <sys/fastboot_impl.h> #include <sys/machelf.h> #include <sys/kobj.h> #include <sys/multiboot.h> @@ -117,6 +117,15 @@ static x86pte_t pte_bits = PT_VALID | PT_REF | PT_MOD | PT_NOCONSIST | PT_WRITABLE; static uint_t fastboot_shift_amt_pae[] = {12, 21, 30, 39}; +/* Index into Fast Reboot not supported message array */ +static uint32_t fastreboot_nosup_id = FBNS_DEFAULT; + +/* Fast Reboot not supported message array */ +static const char * const fastreboot_nosup_desc[FBNS_END] = { +#define fastboot_nosup_msg(id, str) str, +#include <sys/fastboot_msg.h> +}; + int fastboot_debug = 0; int fastboot_contig = 0; @@ -1477,11 +1486,12 @@ fastboot_update_config(const char *mdep) } /* - * This is the interface to be called by other kernel components to - * disable fastreboot_onpanic. + * This is an internal interface to disable Fast Reboot on Panic. + * It frees up memory allocated for the backup kernel and sets + * fastreboot_onpanic to zero. */ -void -fastreboot_disable() +static void +fastreboot_onpanic_disable(void) { uint8_t boot_config = (uint8_t)(~UA_FASTREBOOT_ONPANIC); fastboot_update_config((const char *)&boot_config); @@ -1491,14 +1501,62 @@ fastreboot_disable() * This is the interface to be called by fm_panic() in case FMA has diagnosed * a terminal machine check exception. It does not free up memory allocated * for the backup kernel. General disabling fastreboot_onpanic in a - * non-panicking situation must go through fastboot_update_config(). + * non-panicking situation must go through fastboot_onpanic_disable(). */ void -fastreboot_disable_highpil() +fastreboot_disable_highpil(void) { fastreboot_onpanic = 0; } +/* + * This is an internal interface to disable Fast Reboot by Default. + * It does not free up memory allocated for the backup kernel. + */ +static void +fastreboot_capable_disable(uint32_t msgid) +{ + if (fastreboot_capable != 0) { + fastreboot_capable = 0; + if (msgid < sizeof (fastreboot_nosup_desc) / + sizeof (fastreboot_nosup_desc[0])) + fastreboot_nosup_id = msgid; + else + fastreboot_nosup_id = FBNS_DEFAULT; + } +} + +/* + * This is the kernel interface for disabling + * Fast Reboot by Default and Fast Reboot on Panic. + * Frees up memory allocated for the backup kernel. + * General disabling of the Fast Reboot by Default feature should be done + * via the userland interface scf_fastreboot_default_set_transient(). + */ +void +fastreboot_disable(uint32_t msgid) +{ + fastreboot_capable_disable(msgid); + fastreboot_onpanic_disable(); +} + +/* + * Returns Fast Reboot not support message for fastreboot_nosup_id. + * If fastreboot_nosup_id contains invalid index, default + * Fast Reboot not support message is returned. + */ +const char * +fastreboot_nosup_message(void) +{ + uint32_t msgid; + + msgid = fastreboot_nosup_id; + if (msgid >= sizeof (fastreboot_nosup_desc) / + sizeof (fastreboot_nosup_desc[0])) + msgid = FBNS_DEFAULT; + + return (fastreboot_nosup_desc[msgid]); +} /* * A simplified interface for uadmin to call to update the configuration @@ -1513,7 +1571,7 @@ fastboot_update_and_load(int fcn, char *mdep) * or uadmin(1M) was invoked with other functions, * don't try to fast reboot after dumping. */ - fastreboot_disable(); + fastreboot_onpanic_disable(); } mutex_enter(&fastreboot_config_mutex); diff --git a/usr/src/uts/i86pc/os/machdep.c b/usr/src/uts/i86pc/os/machdep.c index 8a2db06a40..9563b061e4 100644 --- a/usr/src/uts/i86pc/os/machdep.c +++ b/usr/src/uts/i86pc/os/machdep.c @@ -360,7 +360,8 @@ mdpreboot(int cmd, int fcn, char *mdep) cmn_err(CE_WARN, "Fast reboot is not supported on xVM"); #else cmn_err(CE_WARN, - "Fast reboot is not supported on this platform"); + "Fast reboot is not supported on this platform%s", + fastreboot_nosup_message()); #endif } diff --git a/usr/src/uts/i86pc/sys/fastboot.h b/usr/src/uts/i86pc/sys/fastboot.h index 58dbc09a9f..751d089e67 100644 --- a/usr/src/uts/i86pc/sys/fastboot.h +++ b/usr/src/uts/i86pc/sys/fastboot.h @@ -20,7 +20,7 @@ */ /* - * Copyright 2009 Sun Microsystems, Inc. All rights reserved. + * Copyright 2010 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -160,11 +160,16 @@ extern void fastboot_load_kernel(char *); /* Load a new kernel */ extern int fastboot_cksum_verify(fastboot_info_t *); /* + * Additional messages explaining why Fast Reboot is not + * supported. + */ +extern const char *fastreboot_nosup_message(void); +/* * Fast reboot tunables */ /* If set, the system is capable of fast reboot */ -extern int fastreboot_capable; +extern int volatile fastreboot_capable; /* * If set, force fast reboot even if the system has diff --git a/usr/src/uts/i86pc/sys/fastboot_impl.h b/usr/src/uts/i86pc/sys/fastboot_impl.h new file mode 100644 index 0000000000..6b75db82cf --- /dev/null +++ b/usr/src/uts/i86pc/sys/fastboot_impl.h @@ -0,0 +1,57 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ + +/* + * Copyright 2010 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +#ifndef _SYS_FASTBOOT_IMPL_H +#define _SYS_FASTBOOT_IMPL_H + + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef _ASM + +#include <sys/fastboot.h> + +/* + * Fast Reboot NOT SUPPORTED message IDs. + */ +enum { +#define fastboot_nosup_msg(id, str) id, +#define fastboot_nosup_msg_end(id) id +#include "fastboot_msg.h" +}; + +extern void fastreboot_disable(uint32_t); +extern void fastreboot_disable_highpil(void); + +#endif /* _ASM */ + +#ifdef __cplusplus +} +#endif + +#endif /* _SYS_FASTBOOT_IMPL_H */ diff --git a/usr/src/uts/i86pc/sys/fastboot_msg.h b/usr/src/uts/i86pc/sys/fastboot_msg.h new file mode 100644 index 0000000000..a35fcf2f67 --- /dev/null +++ b/usr/src/uts/i86pc/sys/fastboot_msg.h @@ -0,0 +1,58 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ + +/* + * Copyright 2010 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ +/* + * !!! IMPORTANT !!! + * Please DO NOT overwrite existing Fastboot Not Support msgids. + * New fastboot_nosup_msg() have to be added to the end of the list, + * just BEFORE fastboot_nosup_msg_end(). + */ + +#ifndef _SYS_FASTBOOT_MSG_H +#define _SYS_FASTBOOT_MSG_H +#endif /* _SYS_FASTBOOT_MSG_H */ + +#ifndef fastboot_nosup_msg +#define fastboot_nosup_msg(id, str) +#endif /* fastboot_nosup_msg */ + +#ifndef fastboot_nosup_msg_end +#define fastboot_nosup_msg_end(id) +#endif /* fastboot_nosup_msg_end */ + +fastboot_nosup_msg(FBNS_DEFAULT, "") +fastboot_nosup_msg(FBNS_SUSPEND, " after suspend/resume") +fastboot_nosup_msg(FBNS_FMAHWERR, " due to FMA recovery from hardware error") + +/* + * Should ALWAYS be the last one. + * No fastboot_nosup_msg() after that line. + */ +fastboot_nosup_msg_end(FBNS_END) + +#undef fastboot_nosup_msg +#undef fastboot_nosup_msg_end + +#undef _SYS_FASTBOOT_MSG_H |