diff options
| author | Christopher Kiick <Chris.Kiick@Sun.COM> | 2010-03-11 18:19:56 -0500 |
|---|---|---|
| committer | Christopher Kiick <Chris.Kiick@Sun.COM> | 2010-03-11 18:19:56 -0500 |
| commit | e557d412e15c7f384b2ea3bf316a739a0f81cd55 (patch) | |
| tree | f29c6b63d3976f5103dbca9dd7cdbbe374b1b55a /usr | |
| parent | de6d0fcd730431ea0d586564c1551016efe19f56 (diff) | |
| download | illumos-joyent-e557d412e15c7f384b2ea3bf316a739a0f81cd55.tar.gz | |
6830088 Fast reboot support for SPARC platforms
--HG--
rename : usr/src/cmd/halt/smf/Makefile => usr/src/cmd/halt/smf.i386/Makefile
rename : usr/src/cmd/halt/smf/boot-config.xml => usr/src/cmd/halt/smf.i386/boot-config.xml
rename : usr/src/cmd/halt/smf/svc-boot-config => usr/src/cmd/halt/smf.i386/svc-boot-config
rename : usr/src/cmd/halt/smf/Makefile => usr/src/cmd/halt/smf.sparc/Makefile
rename : usr/src/cmd/halt/smf/boot-config.xml => usr/src/cmd/halt/smf.sparc/boot-config.xml
rename : usr/src/cmd/halt/smf/svc-boot-config => usr/src/cmd/halt/smf.sparc/svc-boot-config
Diffstat (limited to 'usr')
| -rw-r--r-- | usr/src/cmd/Makefile.check | 2 | ||||
| -rw-r--r-- | usr/src/cmd/halt/Makefile | 6 | ||||
| -rw-r--r-- | usr/src/cmd/halt/halt.c | 32 | ||||
| -rw-r--r-- | usr/src/cmd/halt/smf.i386/Makefile (renamed from usr/src/cmd/halt/smf/Makefile) | 2 | ||||
| -rw-r--r-- | usr/src/cmd/halt/smf.i386/boot-config.xml (renamed from usr/src/cmd/halt/smf/boot-config.xml) | 2 | ||||
| -rwxr-xr-x | usr/src/cmd/halt/smf.i386/svc-boot-config (renamed from usr/src/cmd/halt/smf/svc-boot-config) | 2 | ||||
| -rw-r--r-- | usr/src/cmd/halt/smf.sparc/Makefile | 40 | ||||
| -rw-r--r-- | usr/src/cmd/halt/smf.sparc/boot-config.xml | 183 | ||||
| -rwxr-xr-x | usr/src/cmd/halt/smf.sparc/svc-boot-config | 40 | ||||
| -rw-r--r-- | usr/src/lib/libscf/common/highlevel.c | 9 | ||||
| -rw-r--r-- | usr/src/uts/common/krtld/kobj_bootflags.c | 9 | ||||
| -rw-r--r-- | usr/src/uts/sun4u/os/mach_cpu_states.c | 28 | ||||
| -rw-r--r-- | usr/src/uts/sun4v/os/mach_cpu_states.c | 3 |
13 files changed, 330 insertions, 28 deletions
diff --git a/usr/src/cmd/Makefile.check b/usr/src/cmd/Makefile.check index bc13f620b7..f4d3a77c75 100644 --- a/usr/src/cmd/Makefile.check +++ b/usr/src/cmd/Makefile.check @@ -113,7 +113,7 @@ MANIFEST_SUBDIRS= \ gss/gssd \ hal/addons/network-devices \ hal/hald/solaris \ - halt/smf \ + halt/smf.$(MACH) \ hostid/smf \ idmap/idmapd \ ipf/svc \ diff --git a/usr/src/cmd/halt/Makefile b/usr/src/cmd/halt/Makefile index f5c49c642e..fb22435c48 100644 --- a/usr/src/cmd/halt/Makefile +++ b/usr/src/cmd/halt/Makefile @@ -19,7 +19,7 @@ # CDDL HEADER END # # -# Copyright 2009 Sun Microsystems, Inc. All rights reserved. +# Copyright 2010 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # @@ -32,8 +32,8 @@ include ../Makefile.cmd # A new propery config/uadmin_boot_archive_sync is added to # boot-config service. Which needs a support on sparc also. # -sparc_SUBDIRS = smf -i386_SUBDIRS = smf +sparc_SUBDIRS = smf.sparc +i386_SUBDIRS = smf.i386 SUBDIRS = $($(MACH)_SUBDIRS) ROOTLINKS = $(ROOTUSRSBIN)/poweroff $(ROOTUSRSBIN)/reboot diff --git a/usr/src/cmd/halt/halt.c b/usr/src/cmd/halt/halt.c index ec7f7afdf4..17f95c635a 100644 --- a/usr/src/cmd/halt/halt.c +++ b/usr/src/cmd/halt/halt.c @@ -19,7 +19,7 @@ * CDDL HEADER END */ /* - * Copyright 2009 Sun Microsystems, Inc. All rights reserved. + * Copyright 2010 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -132,6 +132,7 @@ static ctid_t startdct = -1; * Fast Reboot related variables */ static char fastboot_mounted[MAXPATHLEN]; + #if defined(__i386) static grub_boot_args_t fbarg; static grub_boot_args_t *fbarg_used; @@ -1287,8 +1288,8 @@ main(int argc, char *argv[]) optstring = "dlnqpfe:"; usage = gettext("usage: %s [ -dlnq(p|fe:) ] [ boot args ]\n"); #else - optstring = "dlnq"; - usage = gettext("usage: %s [ -dlnq ] [ boot args ]\n"); + optstring = "dlnqfp"; + usage = gettext("usage: %s [ -dlnq(p|f) ] [ boot args ]\n"); #endif cmd = A_SHUTDOWN; fcn = AD_BOOT; @@ -1322,13 +1323,13 @@ main(int argc, char *argv[]) case 'y': ttyn = NULL; break; -#if defined(__i386) - case 'p': - prom_reboot = 1; - break; case 'f': fast_reboot = 1; break; + case 'p': + prom_reboot = 1; + break; +#if defined(__i386) case 'e': bename = optarg; break; @@ -1382,24 +1383,31 @@ main(int argc, char *argv[]) cmdname); return (EINVAL); } - /* * Check whether fast reboot is the default operating mode */ if (fcn == AD_BOOT && !fast_reboot && !prom_reboot && - zoneid == GLOBAL_ZONEID) + zoneid == GLOBAL_ZONEID) { fast_reboot = scf_is_fastboot_default(); + } + if (bename && !fast_reboot) { (void) fprintf(stderr, gettext("%s: -e only valid with -f\n"), cmdname); return (EINVAL); } +#if defined(__sparc) + if (fast_reboot) { + fast_reboot = 2; /* need to distinguish each case */ + } +#endif + /* * If fast reboot, do some sanity check on the argument */ - if (fast_reboot) { + if (fast_reboot == 1) { int rc; int is_dryrun = 0; @@ -1543,7 +1551,7 @@ main(int argc, char *argv[]) * Try to stop gdm so X has a chance to return the screen and * keyboard to a sane state. */ - if (fast_reboot && stop_gdm() != 0) { + if (fast_reboot == 1 && stop_gdm() != 0) { (void) fprintf(stderr, gettext("%s: Falling back to regular reboot.\n"), cmdname); fast_reboot = 0; @@ -1650,7 +1658,7 @@ fail: else (void) audit_halt_fail(); - if (fast_reboot) { + if (fast_reboot == 1) { if (bename) { (void) halt_exec(LUUMOUNT_PROG, "-n", bename, NULL); diff --git a/usr/src/cmd/halt/smf/Makefile b/usr/src/cmd/halt/smf.i386/Makefile index c150613e8e..7c201d7d14 100644 --- a/usr/src/cmd/halt/smf/Makefile +++ b/usr/src/cmd/halt/smf.i386/Makefile @@ -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. # diff --git a/usr/src/cmd/halt/smf/boot-config.xml b/usr/src/cmd/halt/smf.i386/boot-config.xml index 5ee1f635d0..52ecb8965c 100644 --- a/usr/src/cmd/halt/smf/boot-config.xml +++ b/usr/src/cmd/halt/smf.i386/boot-config.xml @@ -1,7 +1,7 @@ <?xml version="1.0"?> <!DOCTYPE service_bundle SYSTEM "/usr/share/lib/xml/dtd/service_bundle.dtd.1"> <!-- - Copyright 2009 Sun Microsystems, Inc. All rights reserved. + Copyright 2010 Sun Microsystems, Inc. All rights reserved. Use is subject to license terms. CDDL HEADER START diff --git a/usr/src/cmd/halt/smf/svc-boot-config b/usr/src/cmd/halt/smf.i386/svc-boot-config index e54214d754..bb9e687dfd 100755 --- a/usr/src/cmd/halt/smf/svc-boot-config +++ b/usr/src/cmd/halt/smf.i386/svc-boot-config @@ -20,7 +20,7 @@ # CDDL HEADER END # # -# Copyright 2009 Sun Microsystems, Inc. All rights reserved. +# Copyright 2010 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # # Start and refresh method script for the boot-config service. diff --git a/usr/src/cmd/halt/smf.sparc/Makefile b/usr/src/cmd/halt/smf.sparc/Makefile new file mode 100644 index 0000000000..7c201d7d14 --- /dev/null +++ b/usr/src/cmd/halt/smf.sparc/Makefile @@ -0,0 +1,40 @@ +# +# 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. +# + +include ../../Makefile.cmd + +MANIFEST= boot-config.xml +SVCMETHOD= svc-boot-config + +ROOTMANIFESTDIR = $(ROOTSVCSYSTEM) + +all clean clobber lint: + +install: all $(ROOTMANIFEST) $(ROOTSVCMETHOD) + +check: $(CHKMANIFEST) + +include ../../Makefile.targ diff --git a/usr/src/cmd/halt/smf.sparc/boot-config.xml b/usr/src/cmd/halt/smf.sparc/boot-config.xml new file mode 100644 index 0000000000..2373176e50 --- /dev/null +++ b/usr/src/cmd/halt/smf.sparc/boot-config.xml @@ -0,0 +1,183 @@ +<?xml version="1.0"?> +<!DOCTYPE service_bundle SYSTEM "/usr/share/lib/xml/dtd/service_bundle.dtd.1"> +<!-- + Copyright 2010 Sun Microsystems, Inc. All rights reserved. + Use is subject to license terms. + + 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 + + NOTE: This service manifest is not editable; its contents will + be overwritten by package or patch operations, including + operating system upgrade. Make customizations in a different + file. +--> + +<service_bundle type='manifest' name='SUNWcsr:boot-config'> + +<service + name='system/boot-config' + type='service' + version='1'> + + <single_instance /> + + <dependency + name='manifest_import' + grouping='optional_all' + restart_on='none' + type='service'> + <service_fmri value='svc:/system/manifest-import:default' /> + </dependency> + + <!-- The boot-config service is made to depend on milestone + multi-user to minimize the chance for panic reboot loop. --> + <dependency + name='boot_multi-user' + grouping='optional_all' + restart_on='none' + type='service'> + <service_fmri value='svc:/milestone/multi-user' /> + </dependency> + + <instance name='default' enabled = 'true'> + + <exec_method + type='method' + name='start' + exec='/lib/svc/method/svc-boot-config' + timeout_seconds='60' /> + + <exec_method + type='method' + name='stop' + exec=':true' + timeout_seconds='60' /> + + <exec_method + type='method' + name='refresh' + exec='/lib/svc/method/svc-boot-config' + timeout_seconds='60' /> + + <property_group name='startd' type='framework'> + <propval name='duration' type='astring' + value='transient' /> + </property_group> + + <property_group name='general' type='framework'> + <propval name='action_authorization' type='astring' + value='solaris.system.shutdown' /> + <propval name='value_authorization' type='astring' + value='solaris.system.shutdown' /> + </property_group> + + <property_group name='config' type='application'> + <stability value='Stable' /> + <propval name='fastreboot_default' type='boolean' + value='false' /> + <propval name='fastreboot_onpanic' type='boolean' + value='false' /> + <propval name='value_authorization' type='astring' + value='solaris.system.shutdown' /> + <propval name='uadmin_boot_archive_sync' type='boolean' + value='false' /> + </property_group> + + <property_group name='fastreboot_blacklist' type='application'> + <stability value='Unstable' /> + <property name='platforms' type='astring'> + <astring_list> + <value_node value='VirtualBox' /> + <value_node value='VMware Virtual Platform' /> + <value_node value='MCP55' /> + <value_node value='Precision WorkStation 650 ' /> + <value_node value='PowerEdge 1600SC ' /> + </astring_list> + </property> + </property_group> + </instance> + + <stability value='Stable' /> + + <template> + <common_name> + <loctext xml:lang='C'> + Boot Configuration Management + </loctext> + </common_name> + <description> + <loctext xml:lang='C'> +Apply the configuration defined in this service by uploading the configuration to the kernel. + </loctext> + </description> + <documentation> + <manpage title='reboot' section='1M' + manpath='/usr/share/man' /> + <manpage title='init' section='1M' + manpath='/usr/share/man' /> + <manpage title='uadmin' section='2' + manpath='/usr/share/man' /> + <manpage title='quiesce' section='9E' + manpath='/usr/share/man' /> + </documentation> + <pg_pattern name='config' type='application' + required='true'> + <common_name> + <loctext xml:lang='C'> + Boot Configuration Parameters + </loctext> + </common_name> + <description> + <loctext xml:lang='C'> +Parameters for controlling the reboot behavior. + </loctext> + </description> + <prop_pattern name='fastreboot_default' type='boolean' + required='true'> + <common_name> + <loctext xml:lang='C'> + Fast Reboot by Default + </loctext> + </common_name> + <description> + <loctext xml:lang='C'> +When set to true, reboot(1M) and init(1M) 6 will call uadmin(2) with AD_FASTREOOT, which will bypass firmware. + </loctext> + </description> + </prop_pattern> + <prop_pattern name='fastreboot_onpanic' type='boolean' + required='true'> + <common_name> + <loctext xml:lang='C'> + Fast Reboot on Panic + </loctext> + </common_name> + <description> + <loctext xml:lang='C'> +When set to true, the system will fast reboot on panic. + </loctext> + </description> + </prop_pattern> + </pg_pattern> + + </template> +</service> + +</service_bundle> diff --git a/usr/src/cmd/halt/smf.sparc/svc-boot-config b/usr/src/cmd/halt/smf.sparc/svc-boot-config new file mode 100755 index 0000000000..bb9e687dfd --- /dev/null +++ b/usr/src/cmd/halt/smf.sparc/svc-boot-config @@ -0,0 +1,40 @@ +#!/sbin/sh +# +# 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. +# +# Start and refresh method script for the boot-config service. +# + +. /lib/svc/share/smf_include.sh + +# +# This service is only valid in the global zone. +# +smf_is_globalzone || exit $SMF_EXIT_OK + +# +# uadmin A_CONFIG AD_UPDATE_BOOT_CONFIG +# +/usr/sbin/uadmin 23 1 +exit $SMF_EXIT_OK diff --git a/usr/src/lib/libscf/common/highlevel.c b/usr/src/lib/libscf/common/highlevel.c index e31c2ece5c..d5ab524d0c 100644 --- a/usr/src/lib/libscf/common/highlevel.c +++ b/usr/src/lib/libscf/common/highlevel.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. */ @@ -162,9 +162,6 @@ scf_get_boot_config(uint8_t *boot_config) assert(boot_config); *boot_config = 0; -#ifndef __x86 - return; -#else { /* * Property vector for BOOT_CONFIG_PG_PARAMS property group. @@ -183,6 +180,8 @@ scf_get_boot_config(uint8_t *boot_config) prop = NULL; if (scf_read_propvec(FMRI_BOOT_CONFIG, BOOT_CONFIG_PG_PARAMS, B_TRUE, ua_boot_config, &prop) != SCF_FAILED) { + +#ifdef __x86 /* * Unset both flags if the platform has been * blacklisted. @@ -190,6 +189,7 @@ scf_get_boot_config(uint8_t *boot_config) if (scf_is_fb_blacklisted()) *boot_config &= ~(UA_FASTREBOOT_DEFAULT | UA_FASTREBOOT_ONPANIC); +#endif /* __x86 */ return; } #if defined(FASTREBOOT_DEBUG) @@ -204,7 +204,6 @@ scf_get_boot_config(uint8_t *boot_config) } #endif /* FASTREBOOT_DEBUG */ } -#endif /* __x86 */ } /* diff --git a/usr/src/uts/common/krtld/kobj_bootflags.c b/usr/src/uts/common/krtld/kobj_bootflags.c index e0a8c4deb0..b2d5af605b 100644 --- a/usr/src/uts/common/krtld/kobj_bootflags.c +++ b/usr/src/uts/common/krtld/kobj_bootflags.c @@ -19,7 +19,7 @@ * CDDL HEADER END */ /* - * Copyright 2008 Sun Microsystems, Inc. All rights reserved. + * Copyright 2010 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -79,7 +79,7 @@ bootflags(struct bootops *ops) #if defined(_OBP) /* skip bootblk args */ - params.gos_opts = "abcdDF:gGHhi:km:o:O:rsvVwxZ:"; + params.gos_opts = "abcdDf:F:gGHhi:km:o:O:rsvVwxZ:"; #else params.gos_opts = "abcdgGhi:km:O:rsvwx"; #endif @@ -104,6 +104,11 @@ bootflags(struct bootops *ops) case 'D': case 'F': break; + case 'f': + (void)prom_setprop(prom_optionsnode(), "diag-level", + (char *)params.gos_optargp, + params.gos_optarglen + 1); + break; #endif case 'g': boothowto |= RB_FORTHDEBUG; diff --git a/usr/src/uts/sun4u/os/mach_cpu_states.c b/usr/src/uts/sun4u/os/mach_cpu_states.c index f154bea238..684e8d607e 100644 --- a/usr/src/uts/sun4u/os/mach_cpu_states.c +++ b/usr/src/uts/sun4u/os/mach_cpu_states.c @@ -19,7 +19,7 @@ * CDDL HEADER END */ /* - * Copyright 2009 Sun Microsystems, Inc. All rights reserved. + * Copyright 2010 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -128,6 +128,7 @@ mdboot(int cmd, int fcn, char *bootstr, boolean_t invoke_cb) if (bootstr == NULL) { switch (fcn) { + case AD_FASTREBOOT: case AD_BOOT: bootstr = ""; break; @@ -150,6 +151,31 @@ mdboot(int cmd, int fcn, char *bootstr, boolean_t invoke_cb) break; } } + if (fcn == AD_FASTREBOOT) { + pnode_t onode; + int dllen; + onode = prom_optionsnode(); + if ((onode == OBP_NONODE) || (onode == OBP_BADNODE)) { + cmn_err(CE_WARN, "Unable to set diag level for" + " quick reboot"); + } else { + dllen = prom_getproplen(onode, "diag-level"); + if (dllen != -1) { + int newstrlen; + char *newstr = kmem_alloc(strlen( + bootstr) + dllen + 5, KM_SLEEP); + (void) strcpy(newstr, bootstr); + (void) strcat(newstr, " -f "); + newstrlen = strlen(bootstr) + 4; + (void) prom_getprop(onode, "diag-level", + (caddr_t)&(newstr[newstrlen])); + newstr[newstrlen + dllen] = '\0'; + bootstr = newstr; + } + (void) prom_setprop(onode, "diag-level", + "off", 4); + } + } reboot_machine(bootstr); } /* MAYBE REACHED */ diff --git a/usr/src/uts/sun4v/os/mach_cpu_states.c b/usr/src/uts/sun4v/os/mach_cpu_states.c index 78fdbbde65..9ac2dc9177 100644 --- a/usr/src/uts/sun4v/os/mach_cpu_states.c +++ b/usr/src/uts/sun4v/os/mach_cpu_states.c @@ -19,7 +19,7 @@ * CDDL HEADER END */ /* - * Copyright 2009 Sun Microsystems, Inc. All rights reserved. + * Copyright 2010 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -223,6 +223,7 @@ mdboot(int cmd, int fcn, char *bootstr, boolean_t invoke_cb) if (bootstr == NULL) { switch (fcn) { + case AD_FASTREBOOT: case AD_BOOT: bootstr = ""; break; |
