2N/A/*
2N/A * CDDL HEADER START
2N/A *
2N/A * The contents of this file are subject to the terms of the
2N/A * Common Development and Distribution License (the "License").
2N/A * You may not use this file except in compliance with the License.
2N/A *
2N/A * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
2N/A * or http://www.opensolaris.org/os/licensing.
2N/A * See the License for the specific language governing permissions
2N/A * and limitations under the License.
2N/A *
2N/A * When distributing Covered Code, include this CDDL HEADER in each
2N/A * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
2N/A * If applicable, add the following below this CDDL HEADER, with the
2N/A * fields enclosed by brackets "[]" replaced with your own identifying
2N/A * information: Portions Copyright [yyyy] [name of copyright owner]
2N/A *
2N/A * CDDL HEADER END
2N/A */
2N/A
2N/A/*
2N/A * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
2N/A */
2N/A
2N/A#ifndef _SMP_IMPL_H
2N/A#define _SMP_IMPL_H
2N/A
2N/A#ifdef __cplusplus
2N/Aextern "C" {
2N/A#endif
2N/A
2N/A#include <sys/scsi/generic/smp_frames.h>
2N/A
2N/A#include <scsi/libsmp.h>
2N/A#include <scsi/libsmp_plugin.h>
2N/A
2N/A#include <pthread.h>
2N/A
2N/A#define LIBSMP_ERRMSGLEN 512
2N/A
2N/A#define LIBSMP_DEFAULT_PLUGINDIR "/usr/lib/scsi/plugins/smp"
2N/A#define LIBSMP_PLUGIN_ENGINE "engine"
2N/A#define LIBSMP_PLUGIN_FRAMEWORK "framework"
2N/A#define LIBSMP_PLUGIN_VENDOR "vendor"
2N/A
2N/A#define LIBSMP_PLUGIN_EXT ".so"
2N/A
2N/A#define LIBSMP_DEFAULT_ENGINE "usmp"
2N/A
2N/Astruct smp_engine {
2N/A char *se_name;
2N/A const smp_engine_ops_t *se_ops;
2N/A void *se_object;
2N/A int (*se_init)(struct smp_engine *);
2N/A void (*se_fini)(struct smp_engine *);
2N/A uint_t se_refcnt;
2N/A struct smp_engine *se_next;
2N/A};
2N/A
2N/Astruct smp_plugin {
2N/A struct smp_plugin *sp_next;
2N/A struct smp_plugin *sp_prev;
2N/A smp_target_t *sp_target;
2N/A uint64_t sp_priority;
2N/A void *sp_object;
2N/A void *sp_data;
2N/A boolean_t sp_initialized;
2N/A const smp_function_def_t *sp_functions;
2N/A int (*sp_init)(smp_plugin_t *);
2N/A void (*sp_fini)(smp_plugin_t *);
2N/A};
2N/A
2N/A#define SMP_ACTION_F_OFFSET 0x01
2N/A#define SMP_ACTION_F_EXEC 0x02
2N/A#define SMP_ACTION_F_DECODE 0x04
2N/A
2N/Astruct smp_action {
2N/A uint32_t sa_timeout;
2N/A const smp_function_def_t *sa_def;
2N/A uint8_t *sa_request;
2N/A size_t sa_request_rqsd;
2N/A size_t sa_request_alloc_len;
2N/A off_t sa_request_data_off;
2N/A uint8_t *sa_response;
2N/A size_t sa_response_alloc_len;
2N/A size_t sa_response_engine_len;
2N/A size_t sa_response_data_len;
2N/A off_t sa_response_data_off;
2N/A smp_result_t sa_result;
2N/A uint_t sa_flags;
2N/A uint_t sa_cap;
2N/A uint8_t sa_buf[1];
2N/A};
2N/A
2N/Astruct smp_target {
2N/A smp_engine_t *st_engine;
2N/A void *st_priv;
2N/A uint_t st_mtbf_request;
2N/A uint_t st_mtbf_response;
2N/A uint16_t st_change_count;
2N/A smp_plugin_t *st_plugin_first;
2N/A smp_plugin_t *st_plugin_last;
2N/A char *st_vendor;
2N/A char *st_product;
2N/A char *st_revision;
2N/A char *st_component_vendor;
2N/A uint16_t st_component_id;
2N/A uint8_t st_component_revision;
2N/A smp_report_general_resp_t st_repgen;
2N/A};
2N/A
2N/Aextern void smp_engine_init(void);
2N/Aextern void smp_engine_fini(void);
2N/A
2N/Aextern int smp_plugin_load(smp_target_t *);
2N/Aextern void smp_plugin_unload(smp_target_t *);
2N/A
2N/A#ifdef __cplusplus
2N/A}
2N/A#endif
2N/A
2N/A#endif /* _SMP_IMPL_H */