fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * CDDL HEADER START
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * The contents of this file are subject to the terms of the
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Common Development and Distribution License (the "License").
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * You may not use this file except in compliance with the License.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * or http://www.opensolaris.org/os/licensing.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * See the License for the specific language governing permissions
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * and limitations under the License.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * When distributing Covered Code, include this CDDL HEADER in each
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * If applicable, add the following below this CDDL HEADER, with the
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * fields enclosed by brackets "[]" replaced with your own identifying
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * information: Portions Copyright [yyyy] [name of copyright owner]
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * CDDL HEADER END
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*
3270659f55e0928d6edec3d26217cc29398a8149Srikanth, Ramana * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Use is subject to license terms.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#include <sys/ddi.h>
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#include <sys/sunddi.h>
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#ifdef DS_DDICT
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#include "../contract.h"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#endif
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define SVE_STE_CLASS "SVE_STE"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define SVE_II_CLASS "SVE_II"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define SVE_CACHE_CLASS "SVE_CACHE"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortevoid
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortensc_do_sysevent(char *driver_name, char *trap_messages, int errorno,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte int alertlevel, char *component, dev_info_t *info_dip)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte{
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#if !defined(DS_DDICT) && !defined(_SunOS_5_6) && \
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte !defined(_SunOS_5_7) && !defined(_SunOS_5_8)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte nvlist_t *attr_list;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte int rc;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte attr_list = NULL;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte rc = nvlist_alloc(&attr_list, NV_UNIQUE_NAME_TYPE, KM_SLEEP);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (rc != 0) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte goto out;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte rc = nvlist_add_int32(attr_list, "alertlevel", alertlevel);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (rc != 0) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte goto out;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
3270659f55e0928d6edec3d26217cc29398a8149Srikanth, Ramana rc = nvlist_add_string(attr_list, "messagevalue", trap_messages);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (rc != 0) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte goto out;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte rc = nvlist_add_int32(attr_list, "errorno", errorno);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (rc != 0) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte goto out;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (strcmp(driver_name, "sdbc") == 0)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte rc = ddi_log_sysevent(info_dip, DDI_VENDOR_SUNW,
3270659f55e0928d6edec3d26217cc29398a8149Srikanth, Ramana SVE_CACHE_CLASS, component, attr_list, NULL, DDI_SLEEP);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte else if (strcmp(driver_name, "ste") == 0)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte rc = ddi_log_sysevent(info_dip, DDI_VENDOR_SUNW,
3270659f55e0928d6edec3d26217cc29398a8149Srikanth, Ramana SVE_STE_CLASS, component, attr_list, NULL, DDI_SLEEP);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte else if (strcmp(driver_name, "ii") == 0)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte rc = ddi_log_sysevent(info_dip, DDI_VENDOR_SUNW,
3270659f55e0928d6edec3d26217cc29398a8149Srikanth, Ramana SVE_II_CLASS, component, attr_list, NULL, DDI_SLEEP);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteout:
aab83bb83be7342f6cfccaed8d5fe0b2f404855dJosef 'Jeff' Sipek nvlist_free(attr_list);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (rc != 0) {
3270659f55e0928d6edec3d26217cc29398a8149Srikanth, Ramana cmn_err(CE_WARN, "!%s: unable to log sysevent %d:%s and %d",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte driver_name, errorno, trap_messages, alertlevel);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#endif /* which O/S? */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}