e7cbe64f7a72dae5cb44f100db60ca88f3313c65gw/*
e7cbe64f7a72dae5cb44f100db60ca88f3313c65gw * CDDL HEADER START
e7cbe64f7a72dae5cb44f100db60ca88f3313c65gw *
e7cbe64f7a72dae5cb44f100db60ca88f3313c65gw * The contents of this file are subject to the terms of the
e7cbe64f7a72dae5cb44f100db60ca88f3313c65gw * Common Development and Distribution License (the "License").
e7cbe64f7a72dae5cb44f100db60ca88f3313c65gw * You may not use this file except in compliance with the License.
e7cbe64f7a72dae5cb44f100db60ca88f3313c65gw *
e7cbe64f7a72dae5cb44f100db60ca88f3313c65gw * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
e7cbe64f7a72dae5cb44f100db60ca88f3313c65gw * or http://www.opensolaris.org/os/licensing.
e7cbe64f7a72dae5cb44f100db60ca88f3313c65gw * See the License for the specific language governing permissions
e7cbe64f7a72dae5cb44f100db60ca88f3313c65gw * and limitations under the License.
e7cbe64f7a72dae5cb44f100db60ca88f3313c65gw *
e7cbe64f7a72dae5cb44f100db60ca88f3313c65gw * When distributing Covered Code, include this CDDL HEADER in each
e7cbe64f7a72dae5cb44f100db60ca88f3313c65gw * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
e7cbe64f7a72dae5cb44f100db60ca88f3313c65gw * If applicable, add the following below this CDDL HEADER, with the
e7cbe64f7a72dae5cb44f100db60ca88f3313c65gw * fields enclosed by brackets "[]" replaced with your own identifying
e7cbe64f7a72dae5cb44f100db60ca88f3313c65gw * information: Portions Copyright [yyyy] [name of copyright owner]
e7cbe64f7a72dae5cb44f100db60ca88f3313c65gw *
e7cbe64f7a72dae5cb44f100db60ca88f3313c65gw * CDDL HEADER END
e7cbe64f7a72dae5cb44f100db60ca88f3313c65gw */
e7cbe64f7a72dae5cb44f100db60ca88f3313c65gw
e7cbe64f7a72dae5cb44f100db60ca88f3313c65gw/*
b24ab6762772a3f6a89393947930c7fa61306783Jeff Bonwick * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
e7cbe64f7a72dae5cb44f100db60ca88f3313c65gw * Use is subject to license terms.
e7cbe64f7a72dae5cb44f100db60ca88f3313c65gw */
e7cbe64f7a72dae5cb44f100db60ca88f3313c65gw
283b84606b6fc326692c03273de1774e8c122f9aGeorge.Wilson/*
283b84606b6fc326692c03273de1774e8c122f9aGeorge.Wilson * Copyright (c) 2012 by Delphix. All rights reserved.
283b84606b6fc326692c03273de1774e8c122f9aGeorge.Wilson */
283b84606b6fc326692c03273de1774e8c122f9aGeorge.Wilson
b24ab6762772a3f6a89393947930c7fa61306783Jeff Bonwick#include <sys/zio.h>
e7cbe64f7a72dae5cb44f100db60ca88f3313c65gw#include <sys/spa.h>
e7cbe64f7a72dae5cb44f100db60ca88f3313c65gw#include <sys/bootconf.h>
e7cbe64f7a72dae5cb44f100db60ca88f3313c65gw
283b84606b6fc326692c03273de1774e8c122f9aGeorge.Wilsonextern int zfs_deadman_enabled;
283b84606b6fc326692c03273de1774e8c122f9aGeorge.Wilson
e7cbe64f7a72dae5cb44f100db60ca88f3313c65gwchar *
051aabe6136ff13e81542a427e9693ffe1503525taylorspa_get_bootprop(char *propname)
e7cbe64f7a72dae5cb44f100db60ca88f3313c65gw{
e7cbe64f7a72dae5cb44f100db60ca88f3313c65gw int proplen;
051aabe6136ff13e81542a427e9693ffe1503525taylor char *value;
e7cbe64f7a72dae5cb44f100db60ca88f3313c65gw
051aabe6136ff13e81542a427e9693ffe1503525taylor proplen = BOP_GETPROPLEN(bootops, propname);
051aabe6136ff13e81542a427e9693ffe1503525taylor if (proplen <= 0)
e7cbe64f7a72dae5cb44f100db60ca88f3313c65gw return (NULL);
e7cbe64f7a72dae5cb44f100db60ca88f3313c65gw
051aabe6136ff13e81542a427e9693ffe1503525taylor value = kmem_zalloc(proplen, KM_SLEEP);
051aabe6136ff13e81542a427e9693ffe1503525taylor if (BOP_GETPROP(bootops, propname, value) == -1) {
051aabe6136ff13e81542a427e9693ffe1503525taylor kmem_free(value, proplen);
e7cbe64f7a72dae5cb44f100db60ca88f3313c65gw return (NULL);
e7cbe64f7a72dae5cb44f100db60ca88f3313c65gw }
e7cbe64f7a72dae5cb44f100db60ca88f3313c65gw
051aabe6136ff13e81542a427e9693ffe1503525taylor return (value);
e7cbe64f7a72dae5cb44f100db60ca88f3313c65gw}
e7cbe64f7a72dae5cb44f100db60ca88f3313c65gw
e7cbe64f7a72dae5cb44f100db60ca88f3313c65gwvoid
051aabe6136ff13e81542a427e9693ffe1503525taylorspa_free_bootprop(char *propname)
e7cbe64f7a72dae5cb44f100db60ca88f3313c65gw{
051aabe6136ff13e81542a427e9693ffe1503525taylor kmem_free(propname, strlen(propname) + 1);
e7cbe64f7a72dae5cb44f100db60ca88f3313c65gw}
283b84606b6fc326692c03273de1774e8c122f9aGeorge.Wilson
283b84606b6fc326692c03273de1774e8c122f9aGeorge.Wilsonvoid
283b84606b6fc326692c03273de1774e8c122f9aGeorge.Wilsonspa_arch_init(void)
283b84606b6fc326692c03273de1774e8c122f9aGeorge.Wilson{
283b84606b6fc326692c03273de1774e8c122f9aGeorge.Wilson /*
283b84606b6fc326692c03273de1774e8c122f9aGeorge.Wilson * The deadman is disabled by default on sparc.
283b84606b6fc326692c03273de1774e8c122f9aGeorge.Wilson */
283b84606b6fc326692c03273de1774e8c122f9aGeorge.Wilson if (zfs_deadman_enabled == -1)
283b84606b6fc326692c03273de1774e8c122f9aGeorge.Wilson zfs_deadman_enabled = 0;
283b84606b6fc326692c03273de1774e8c122f9aGeorge.Wilson}