From e557d412e15c7f384b2ea3bf316a739a0f81cd55 Mon Sep 17 00:00:00 2001 From: Christopher Kiick Date: Thu, 11 Mar 2010 18:19:56 -0500 Subject: 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 --- usr/src/cmd/Makefile.check | 2 +- usr/src/cmd/halt/Makefile | 6 +- usr/src/cmd/halt/halt.c | 32 +++-- usr/src/cmd/halt/smf.i386/Makefile | 40 +++++++ usr/src/cmd/halt/smf.i386/boot-config.xml | 183 +++++++++++++++++++++++++++++ usr/src/cmd/halt/smf.i386/svc-boot-config | 40 +++++++ usr/src/cmd/halt/smf.sparc/Makefile | 40 +++++++ usr/src/cmd/halt/smf.sparc/boot-config.xml | 183 +++++++++++++++++++++++++++++ usr/src/cmd/halt/smf.sparc/svc-boot-config | 40 +++++++ usr/src/cmd/halt/smf/Makefile | 40 ------- usr/src/cmd/halt/smf/boot-config.xml | 183 ----------------------------- usr/src/cmd/halt/smf/svc-boot-config | 40 ------- usr/src/lib/libscf/common/highlevel.c | 9 +- usr/src/uts/common/krtld/kobj_bootflags.c | 9 +- usr/src/uts/sun4u/os/mach_cpu_states.c | 28 ++++- usr/src/uts/sun4v/os/mach_cpu_states.c | 3 +- 16 files changed, 590 insertions(+), 288 deletions(-) create mode 100644 usr/src/cmd/halt/smf.i386/Makefile create mode 100644 usr/src/cmd/halt/smf.i386/boot-config.xml create mode 100755 usr/src/cmd/halt/smf.i386/svc-boot-config create mode 100644 usr/src/cmd/halt/smf.sparc/Makefile create mode 100644 usr/src/cmd/halt/smf.sparc/boot-config.xml create mode 100755 usr/src/cmd/halt/smf.sparc/svc-boot-config delete mode 100644 usr/src/cmd/halt/smf/Makefile delete mode 100644 usr/src/cmd/halt/smf/boot-config.xml delete mode 100755 usr/src/cmd/halt/smf/svc-boot-config (limited to 'usr') 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.i386/Makefile b/usr/src/cmd/halt/smf.i386/Makefile new file mode 100644 index 0000000000..7c201d7d14 --- /dev/null +++ b/usr/src/cmd/halt/smf.i386/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.i386/boot-config.xml b/usr/src/cmd/halt/smf.i386/boot-config.xml new file mode 100644 index 0000000000..52ecb8965c --- /dev/null +++ b/usr/src/cmd/halt/smf.i386/boot-config.xml @@ -0,0 +1,183 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/usr/src/cmd/halt/smf.i386/svc-boot-config b/usr/src/cmd/halt/smf.i386/svc-boot-config new file mode 100755 index 0000000000..bb9e687dfd --- /dev/null +++ b/usr/src/cmd/halt/smf.i386/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/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 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 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/cmd/halt/smf/Makefile b/usr/src/cmd/halt/smf/Makefile deleted file mode 100644 index c150613e8e..0000000000 --- a/usr/src/cmd/halt/smf/Makefile +++ /dev/null @@ -1,40 +0,0 @@ -# -# 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 2009 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/boot-config.xml b/usr/src/cmd/halt/smf/boot-config.xml deleted file mode 100644 index 5ee1f635d0..0000000000 --- a/usr/src/cmd/halt/smf/boot-config.xml +++ /dev/null @@ -1,183 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/usr/src/cmd/halt/smf/svc-boot-config b/usr/src/cmd/halt/smf/svc-boot-config deleted file mode 100755 index e54214d754..0000000000 --- a/usr/src/cmd/halt/smf/svc-boot-config +++ /dev/null @@ -1,40 +0,0 @@ -#!/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 2009 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; -- cgit v1.2.3