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/bootconf.h>
35e7cbe64gw
36283b846George.Wilsonextern int zfs_deadman_enabled;
37283b846George.Wilson
38e7cbe64gwchar *
3930c304dJoshua M. Clulowspa_get_bootprop(const char *propname)
40e7cbe64gw{
41e7cbe64gw	int proplen;
42051aabetaylor	char *value;
43e7cbe64gw
44051aabetaylor	proplen = BOP_GETPROPLEN(bootops, propname);
45051aabetaylor	if (proplen <= 0)
46e7cbe64gw		return (NULL);
47e7cbe64gw
48051aabetaylor	value = kmem_zalloc(proplen, KM_SLEEP);
49051aabetaylor	if (BOP_GETPROP(bootops, propname, value) == -1) {
50051aabetaylor		kmem_free(value, proplen);
51e7cbe64gw		return (NULL);
52e7cbe64gw	}
53e7cbe64gw
54051aabetaylor	return (value);
55e7cbe64gw}
56e7cbe64gw
57e7cbe64gwvoid
5830c304dJoshua M. Clulowspa_free_bootprop(char *propval)
59e7cbe64gw{
6030c304dJoshua M. Clulow	if (propval == NULL) {
6130c304dJoshua M. Clulow		return;
6230c304dJoshua M. Clulow	}
6330c304dJoshua M. Clulow
6430c304dJoshua M. Clulow	kmem_free(propval, strlen(propval) + 1);
65e7cbe64gw}
66283b846George.Wilson
67283b846George.Wilsonvoid
68283b846George.Wilsonspa_arch_init(void)
69283b846George.Wilson{
70283b846George.Wilson	/*
71283b846George.Wilson	 * The deadman is disabled by default on sparc.
72283b846George.Wilson	 */
73283b846George.Wilson	if (zfs_deadman_enabled == -1)
74283b846George.Wilson		zfs_deadman_enabled = 0;
75283b846George.Wilson}
76