1 /*
   2  * CDDL HEADER START
   3  *
   4  * The contents of this file are subject to the terms of the
   5  * Common Development and Distribution License (the "License").
   6  * You may not use this file except in compliance with the License.
   7  *
   8  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
   9  * or http://www.opensolaris.org/os/licensing.
  10  * See the License for the specific language governing permissions
  11  * and limitations under the License.
  12  *
  13  * When distributing Covered Code, include this CDDL HEADER in each
  14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
  15  * If applicable, add the following below this CDDL HEADER, with the
  16  * fields enclosed by brackets "[]" replaced with your own identifying
  17  * information: Portions Copyright [yyyy] [name of copyright owner]
  18  *
  19  * CDDL HEADER END
  20  */
  21 
  22 /*
  23  * Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved.
  24  */
  25 
  26 /*
  27  * SM-HBA interfaces/definitions for MPT SAS driver.
  28  */
  29 
  30 #ifndef _MPTSAS_SMHBA_H
  31 #define _MPTSAS_SMHBA_H
  32 #ifdef  __cplusplus
  33 extern "C" {
  34 #endif
  35 
  36 /* Leverage definition of data_type_t in nvpair.h */
  37 #include <sys/nvpair.h>
  38 #include <sys/scsi/adapters/mpt_sas/mptsas_var.h>
  39 
  40 #define MPTSAS_NUM_PHYS         "num-phys"
  41 #define MPTSAS_NUM_PHYS_HBA     "num-phys-hba"
  42 #define MPTSAS_SMHBA_SUPPORTED  "sm-hba-supported"
  43 #define MPTSAS_DRV_VERSION      "driver-version"
  44 #define MPTSAS_HWARE_VERSION    "hardware-version"
  45 #define MPTSAS_FWARE_VERSION    "firmware-version"
  46 #define MPTSAS_SUPPORTED_PROTOCOL       "supported-protocol"
  47 #define MPTSAS_VIRTUAL_PORT     "virtual-port"
  48 
  49 #define MPTSAS_MANUFACTURER     "Manufacturer"
  50 #define MPTSAS_SERIAL_NUMBER    "SerialNumber"
  51 #define MPTSAS_MODEL_NAME       "ModelName"
  52 #define MPTSAS_VARIANT          "variant"
  53 
  54 #define IS_ATAPI_DEVICE(x)      ((x) & 0x2000)
  55 #define IS_SATA_DEVICE(x)       ((x) & 0x80)
  56 #define DEVINFO_DIRECT_ATTACHED 0x0800
  57 
  58 /*
  59  * Interfaces to add properties required for SM-HBA
  60  *
  61  * _add_xxx_prop() interfaces add only 1 prop that is specified in the args.
  62  * _set_xxx_props() interfaces add more than 1 prop for a set of phys/devices.
  63  */
  64 int mptsas_smhba_setup(mptsas_t *);
  65 void mptsas_smhba_show_phy_info(mptsas_t *);
  66 void mptsas_smhba_set_phy_props(mptsas_t *mpt, char *iport, dev_info_t *dip,
  67     uint8_t phy_nums, uint16_t *attached_devhdl);
  68 void mptsas_smhba_log_sysevent(mptsas_t *mpt, char *subclass, char *etype,
  69     smhba_info_t *phyp);
  70 void
  71 mptsas_create_phy_stats(mptsas_t *mpt, char *iport, dev_info_t *dip);
  72 int mptsas_update_phy_stats(kstat_t *ks, int rw);
  73 void mptsas_destroy_phy_stats(mptsas_t *mpt);
  74 int mptsas_smhba_phy_init(mptsas_t *mpt);
  75 int mptsas_smhba_phy_state_update(mptsas_t *mpt, uint8_t phy);
  76 #ifdef  __cplusplus
  77 }
  78 #endif
  79 #endif  /* _MPTSAS_SMHBA_H */