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) 2011, Oracle and/or its affiliates. All rights reserved.
2N/A */
2N/A
2N/A#ifndef _BAY_H
2N/A#define _BAY_H
2N/A
2N/A#include <fm/topo_mod.h>
2N/A
2N/A#ifdef __cplusplus
2N/Aextern "C" {
2N/A#endif
2N/A
2N/A/*
2N/A * Path for bay configuration file:
2N/A * /usr/platform/<PLATFORM>/lib/fm/topo/maps/
2N/A *
2N/A * Default/prefered name for bay configuration file:
2N/A * <PRODUCT>,<CHASSIS-SN>,bay_labels
2N/A */
2N/A#define BAY_CONFIG "/usr/platform/%s/lib/fm/topo/maps/%s.%s,bay_labels"
2N/A
2N/A/*
2N/A * Config file path/name when the chassis S/N is not available:
2N/A * /usr/platform/<PLATFORM>/lib/fm/topo/maps/<PRODUCT>,bay_labels
2N/A *
2N/A * Config file path/name when the product name is not available:
2N/A * /usr/platform/<PLATFORM>/lib/fm/topo/maps/<PLATFORM>,bay_labels
2N/A */
2N/A#define BAY_CONF_FILE_1 "/usr/platform/%s/lib/fm/topo/maps/%s,bay_labels"
2N/A
2N/A/* <alias-id> for 'internal' chassis receptacles */
2N/A#define INTERNAL "SYS"
2N/A
2N/A/* /devices */
2N/A#define DEVICES "/devices"
2N/A
2N/A/* SAS 'model' property values */
2N/A#define MODEL_SAS "Serial Attached SCSI Controller"
2N/A#define MODEL_SCSI "SCSI bus controller"
2N/A
2N/A#define BAY_SCSI_AP DDI_NT_SCSI_ATTACHMENT_POINT
2N/A
2N/A/* SAS property names */
2N/A#define PHY_NUM "phy-num"
2N/A#define NUM_PHYS_HBA "num-phys-hba"
2N/A#define NUM_PHYS "num-phys"
2N/A
2N/A#define BAY_PROP_UNKNOWN "unknown"
2N/A
2N/A#define MAX_PM_SHIFT 16
2N/A#define MAX_HBAS 4
2N/A#define DFLT_DIR_AT_PHY 4 /* default w/no 'attached-phys-pm' */
2N/A#define DFLT_NUM_PHYS (DFLT_DIR_AT_PHY * 2)
2N/A#define MAX_BAYS DFLT_NUM_PHYS
2N/A
2N/A/* bay structure */
2N/Atypedef struct bay_s {
2N/A int phy; /* HBA PHY */
2N/A int inst; /* bay instance */
2N/A char *label; /* bay label */
2N/A int hba_inst; /* HBA driver instance */
2N/A char *hba_nm; /* HBA driver name */
2N/A char *ch_prod; /* chassis product */
2N/A char *ch_label; /* chassis name */
2N/A char *ch_serial; /* external chassis serial number */
2N/A di_node_t hba_dnode; /* HBA devinfo node */
2N/A} bay_t;
2N/A
2N/A/* callback structure for PCIe label topo walk */
2N/Atypedef struct tw_pcie_cbs {
2N/A char *devfs_path;
2N/A char *label;
2N/A topo_mod_t *mod;
2N/A topo_hdl_t *hdl;
2N/A} tw_pcie_cbs_t;
2N/A
2N/A/* bay_util.c prototypes */
2N/Aboolean_t cmp_str(const char *, const char *);
2N/Achar *ctbl(char *);
2N/Aint gather_sas_hba(di_node_t, void *);
2N/Avoid gen_ofile_name(char *, char *, char *);
2N/Aint get_int_prop(di_node_t, di_path_t, char *);
2N/Aint get_phy(di_node_t, di_path_t);
2N/Aint get_str_prop(di_node_t, di_path_t, char *, char *);
2N/Aboolean_t sas_direct(di_node_t);
2N/Aint th_hba_l(topo_hdl_t *, tnode_t *, void *);
2N/A
2N/A#ifdef __cplusplus
2N/A}
2N/A#endif
2N/A
2N/A#endif /* _BAY_H */