1e7cbe64gw/*
2e7cbe64gw * CDDL HEADER START
3e7cbe64gw *
4e7cbe64gw * The contents of this file are subject to the terms of the
5e7cbe64gw * Common Development and Distribution License (the "License").
6e7cbe64gw * You may not use this file except in compliance with the License.
7e7cbe64gw *
8e7cbe64gw * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9e7cbe64gw * or http://www.opensolaris.org/os/licensing.
10e7cbe64gw * See the License for the specific language governing permissions
11e7cbe64gw * and limitations under the License.
12e7cbe64gw *
13e7cbe64gw * When distributing Covered Code, include this CDDL HEADER in each
14e7cbe64gw * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15e7cbe64gw * If applicable, add the following below this CDDL HEADER, with the
16e7cbe64gw * fields enclosed by brackets "[]" replaced with your own identifying
17e7cbe64gw * information: Portions Copyright [yyyy] [name of copyright owner]
18e7cbe64gw *
19e7cbe64gw * CDDL HEADER END
20e7cbe64gw */
21e7cbe64gw
22e7cbe64gw/*
23b24ab67Jeff Bonwick * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
24e7cbe64gw * Use is subject to license terms.
25e7cbe64gw */
26e7cbe64gw
27283b846George.Wilson/*
28283b846George.Wilson * Copyright (c) 2012 by Delphix. All rights reserved.
2930c304dJoshua M. Clulow * Copyright 2020 Joshua M. Clulow <josh@sysmgr.org>
30283b846George.Wilson */
31283b846George.Wilson
32b24ab67Jeff Bonwick#include <sys/zio.h>
33e7cbe64gw#include <sys/spa.h>
34e7cbe64gw#include <sys/sunddi.h>
35283b846George.Wilson#include <sys/x86_archext.h>
36283b846George.Wilson
37283b846George.Wilsonextern int zfs_deadman_enabled;
38e7cbe64gw
39e7cbe64gwchar *
4030c304dJoshua M. Clulowspa_get_bootprop(const char *propname)
41e7cbe64gw{
42051aabetaylor	char *value;
43e7cbe64gw
44e7cbe64gw	if (ddi_prop_lookup_string(DDI_DEV_T_ANY, ddi_root_node(),
4530c304dJoshua M. Clulow	    DDI_PROP_DONTPASS, (char *)propname, &value) != DDI_SUCCESS) {
46e7cbe64gw		return (NULL);
4730c304dJoshua M. Clulow	}
4830c304dJoshua M. Clulow
49051aabetaylor	return (value);
50e7cbe64gw}
51e7cbe64gw
52e7cbe64gwvoid
53051aabetaylorspa_free_bootprop(char *value)
54e7cbe64gw{
5530c304dJoshua M. Clulow	if (value == NULL) {
5630c304dJoshua M. Clulow		return;
5730c304dJoshua M. Clulow	}
5830c304dJoshua M. Clulow
59051aabetaylor	ddi_prop_free(value);
60e7cbe64gw}
61283b846George.Wilson
62283b846George.Wilsonvoid
63283b846George.Wilsonspa_arch_init(void)
64283b846George.Wilson{
65283b846George.Wilson	/*
66283b846George.Wilson	 * Configure the default settings for the zfs deadman unless
67283b846George.Wilson	 * overriden by /etc/system.
68283b846George.Wilson	 */
69283b846George.Wilson	if (zfs_deadman_enabled == -1) {
70283b846George.Wilson		/*
71283b846George.Wilson		 * Disable the zfs deadman logic on VMware deployments.
72283b846George.Wilson		 */
73283b846George.Wilson		if (get_hwenv() == HW_VMWARE)
74283b846George.Wilson			zfs_deadman_enabled = 0;
75283b846George.Wilson		else
76283b846George.Wilson			zfs_deadman_enabled = 1;
77283b846George.Wilson	}
78283b846George.Wilson}
79