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 * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
2N/A */
2N/A
2N/A#ifndef _disklog_H
2N/A#define _disklog_H
2N/A
2N/A#ifdef __cplusplus
2N/Aextern "c" {
2N/A#endif
2N/A
2N/A#include <stdio.h>
2N/A#include <sys/types.h>
2N/A#include <scsi/libscsi.h>
2N/A#include <sys/scsi/impl/spc3_types.h>
2N/A
2N/A#define DL_ROOT "/"
2N/A#define DL_SD_DRIVER "sd"
2N/A#define DL_SSD_DRIVER "ssd"
2N/A#define DL_DEVICES "/devices"
2N/A#define DL_DEV "/dev"
2N/A#define DL_DISKWD ":wd,raw"
2N/A#define DL_DISKS2 ":c,raw"
2N/A#define DL_FILENAME_SUF ".disklog"
2N/A#define DL_SEAGATE "SEAGATE"
2N/A#define DL_HITACHI "HITACHI"
2N/A#define DL_FILEMODE "w"
2N/A#define DL_DIRMODE 0755
2N/A
2N/A#define DL_SUCCESS 0
2N/A#define DL_FAILURE 1
2N/A
2N/A#define DL_INQ_DATALEN 0xff
2N/A#define DL_PAGELEN 0xff
2N/A#define DL_DATALEN 0xffff
2N/A#define DL_THREADS_NUM 50
2N/A
2N/A#define DL_HITACHI_LOGDUMP_OFFSET 0
2N/A#define DL_HITACHI_LOGDUMP_OFFSET_INC 0xffff
2N/A#define DL_HITACHI_LOGDUMP_DATALEN 0xffff
2N/A#define DL_HITACHI_LOGDUMP_LOGNAME_SUF ".hitachi.dumplog"
2N/A
2N/A#define DL_SEAGATE_LOGDUMP_FIXED 0xfe
2N/A#define DL_SEAGATE_LOGDUMP_OFFSET 0
2N/A#define DL_SEAGATE_LOGDUMP_OFFSET_INC 0x200
2N/A#define DL_SEAGATE_LOGDUMP_XFER_MSB 0x200
2N/A#define DL_SEAGATE_LOGDUMP_DATALEN 0x80000
2N/A#define DL_SEAGATE_LOGDUMP_LOGNAME_SUF ".seagate.dumplog"
2N/A
2N/A#define DL_DEFAULT_SAS_PHY_LOG_DESC_LEN 48
2N/A#define DL_BACK_SCAN_PROGRESS_PERCENT(i) (double)(i * 100.0 / 65536.0)
2N/A
2N/A#define SPC3_CMD_HITACHI_LOG_DUMP SPC3_CMD_VENDOR_E6
2N/A#define SPC3_CMD_SEAGATE_LOG_DUMP SPC3_CMD_VENDOR_F7
2N/A
2N/A#pragma pack(1)
2N/A
2N/Atypedef enum dl_log_page_code {
2N/A DL_LOG_PC_BACK_SCAN = 0x15,
2N/A DL_LOG_PC_SEAGATE_CACHE = 0x37,
2N/A DL_LOG_PC_SEAGATE_FACTORY = 0x3e
2N/A} dl_log_page_code_t;
2N/A
2N/Atypedef enum dl_log_param_code {
2N/A DL_LOG_PC_ERR_HITACHI_TR = 0x8009,
2N/A DL_LOG_PC_ERR_HITACHI_POS = 0x8015,
2N/A DL_LOG_PC_BACK_SCAN_STATUS = 0,
2N/A DL_LOG_PC_BACK_SCAN_END = 0X800,
2N/A DL_LOG_PC_SEAGATE_CACHE_BLKSENT = 0x0,
2N/A DL_LOG_PC_SEAGATE_CACHE_BLKRECV = 0x1,
2N/A DL_LOG_PC_SEAGATE_CACHE_BLKREAD = 0x2,
2N/A DL_LOG_PC_SEAGATE_CACHE_SMALLSZ = 0x3,
2N/A DL_LOG_PC_SEAGATE_CACHE_BIGSZ = 0x4,
2N/A DL_LOG_PC_SEAGATE_FACTORY_HOURS = 0x0,
2N/A DL_LOG_PC_SEAGATE_FACTORY_MINUTES = 0x8
2N/A} dl_log_param_code_t;
2N/A
2N/Atypedef enum dl_mode_sub_page_code {
2N/A DL_MODE_SPC_NONE = 0x0,
2N/A DL_MODE_SPC_SPECIAL = 0xffff
2N/A} dl_mode_sub_page_code_t;
2N/A
2N/Atypedef enum dl_log_params_back_scan_status_code {
2N/A DL_LPBS_SC_NONE = 0x0,
2N/A DL_LPBS_SC_MEDIUM = 0x1,
2N/A DL_LPBS_SC_PRESCAN = 0x2,
2N/A DL_LPBS_SC_FATAL = 0x3,
2N/A DL_LPBS_SC_VENDOR_ERR = 0x4,
2N/A DL_LPBS_SC_NO_PLIST = 0x5,
2N/A DL_LPBS_SC_VENDOR_CAUSE = 0x6,
2N/A DL_LPBS_SC_HIGH_TEMP = 0x7,
2N/A DL_LPBS_SC_INACTIVE = 0x8
2N/A} dl_log_params_back_scan_status_code_t;
2N/A
2N/Atypedef struct dl_log_params_back_scan_status {
2N/A spc3_log_params_header_t lpbss_prh;
2N/A uint8_t lpbss_apom[4];
2N/A uint8_t _reserved1;
2N/A uint8_t lpbss_status;
2N/A uint16_t lpbss_number_of_bsp;
2N/A uint16_t lpbss_progress;
2N/A uint16_t lpbss_number_of_bmsp;
2N/A} dl_log_params_back_scan_status_t;
2N/A
2N/Atypedef struct dl_log_params_medium_scan {
2N/A spc3_log_params_header_t lpms_prh;
2N/A uint8_t lpms_apom[4];
2N/A DECL_BITFIELD2(
2N/A lpms_sense_key :4,
2N/A lpms_reassign_status :4);
2N/A uint8_t lpms_asc;
2N/A uint8_t lpms_ascq;
2N/A char lpms_vendor[5];
2N/A uint8_t lpms_lba[8];
2N/A} dl_log_params_medium_scan_t;
2N/A
2N/Atypedef enum dl_log_protocol_port_id {
2N/A DL_LOG_PP_ID_SAS = 0x06
2N/A} dl_log_protocol_port_id_t;
2N/A
2N/Atypedef struct dl_log_params_protocol_port_header {
2N/A spc3_log_params_header_t lppph_prh;
2N/A DECL_BITFIELD2(
2N/A lppph_id :4,
2N/A _reserved1 :4);
2N/A uint8_t _reserved2;
2N/A uint8_t lppph_generation_code;
2N/A uint8_t lppph_number_of_phys;
2N/A} dl_log_params_protocol_port_header_t;
2N/A
2N/Atypedef enum dl_log_protocol_dev_type {
2N/A DL_LOG_PD_TYPE_NONE = 0,
2N/A DL_LOG_PD_TYPE_END_DEV = 1,
2N/A DL_LOG_PD_TYPE_EXPANDER = 2,
2N/A DL_LOG_PD_TYPE_EXPANDER_COMPLIANT = 3
2N/A} dl_log_params_protocol_dev_type_t;
2N/A
2N/Atypedef enum dl_log_protocol_reason {
2N/A DL_LOG_P_REASON_UNKOWN = 0,
2N/A DL_LOG_P_REASON_POWERON = 1,
2N/A DL_LOG_P_REASON_HARDRESET = 2,
2N/A DL_LOG_P_REASON_SMP = 3,
2N/A DL_LOG_P_REASON_LOSS_OF_DWORD = 4,
2N/A DL_LOG_P_REASON_MUX = 5,
2N/A DL_LOG_P_REASON_IT = 6,
2N/A DL_LOG_P_REASON_TIMEOUT = 7,
2N/A DL_LOG_P_REASON_STOP = 8,
2N/A DL_LOG_P_REASON_EXP = 9
2N/A} dl_log_protocol_reason_t;
2N/A
2N/Atypedef enum dl_log_protocol_link_rate {
2N/A DL_LOG_PL_RATE_UNKOWN = 0,
2N/A DL_LOG_PL_RATE_DISABLED = 1,
2N/A DL_LOG_PL_RATE_PHY_RESET = 2,
2N/A DL_LOG_PL_RATE_SPINUP_HOLD = 3,
2N/A DL_LOG_PL_RATE_PORT_SELECTOR = 4,
2N/A DL_LOG_PL_RATE_RESET = 5,
2N/A DL_LOG_PL_RATE_UNSUPPORTED_PHY = 6,
2N/A DL_LOG_PL_RESERVED = 7,
2N/A DL_LOG_PL_RATE_G1 = 8,
2N/A DL_LOG_PL_RATE_G2 = 9,
2N/A DL_LOG_PL_RATE_G3 = 0xa
2N/A} dl_log_protocol_link_rate_t;
2N/A
2N/A/*
2N/A * SAS-2 10.2.8.1 Table 232 SAS phy log descriptor
2N/A */
2N/Atypedef struct dl_log_params_protocol_spld_header {
2N/A uint8_t _reserved1;
2N/A uint8_t lppsh_phy_id;
2N/A uint8_t _reserved2;
2N/A uint8_t lppsh_spld_len;
2N/A DECL_BITFIELD3(
2N/A lppsh_attached_reason :4,
2N/A lppsh_attached_dev_type :3,
2N/A _reserved3 :1);
2N/A DECL_BITFIELD2(
2N/A lppsh_link_rate :4,
2N/A lppsh_reason :4);
2N/A DECL_BITFIELD5(
2N/A _reserved4 :1,
2N/A lppsh_attached_smpi :1,
2N/A lppsh_attached_stpi :1,
2N/A lppsh_attached_sspi :1,
2N/A _reserved5 :4);
2N/A DECL_BITFIELD5(
2N/A _reserved6 :1,
2N/A lppsh_attached_smpt :1,
2N/A lppsh_attached_stpt :1,
2N/A lppsh_attached_sspt :1,
2N/A _reserved7 :4);
2N/A uint8_t lppsh_sas_addr[8];
2N/A uint8_t lppsh_attached_sas_addr[8];
2N/A uint8_t lppsh_attached_phy_id;
2N/A uint8_t _reserved8[7];
2N/A uint32_t lppsh_invalid_dword_cnt;
2N/A uint32_t lppsh_disparity_err_cnt;
2N/A uint32_t lppsh_loss_of_dword_sync;
2N/A uint32_t lppsh_phy_reset_problem;
2N/A uint8_t _reserved9[2];
2N/A uint8_t lppsh_phy_event_descriptor_len;
2N/A uint8_t lppsh_number_of_phy_event;
2N/A} dl_log_params_protocol_spld_header_t;
2N/A
2N/Atypedef enum dl_log_protocol_phy_event_name {
2N/A DL_LOG_PPEN_NO_EVENT = 0,
2N/A DL_LOG_PPEN_INVALID_DWORD_CNT = 1,
2N/A DL_LOG_PPEN_DISPARITY_ERR_CNT = 2,
2N/A DL_LOG_PPEN_LOSS_OF_DWORD = 3,
2N/A DL_LOG_PPEN_PHY_RESET_CNT = 4,
2N/A DL_LOG_PPEN_BUF_OVERFLOW_CNT = 5,
2N/A DL_LOG_PPEN_RECEIVED_ERR_CNT = 6,
2N/A DL_LOG_PPEN_ADDR_ERR_CNT = 0x20,
2N/A DL_LOG_PPEN_TRANSMITTED_ABANDON_CNT = 0x21,
2N/A DL_LOG_PPEN_RECEIVED_ABANDON_CNT = 0x22,
2N/A DL_LOG_PPEN_TRANSMITTED_RETRY_CNT = 0x23,
2N/A DL_LOG_PPEN_RECEIVED_RETRY_CNT = 0x24,
2N/A DL_LOG_PPEN_RECEIVED_AIP_PART_CNT = 0x25,
2N/A DL_LOG_PPEN_RECEIVED_AIP_CONN_CNT = 0x26,
2N/A DL_LOG_PPEN_TRANSMITTED_BREAK_CNT = 0x27,
2N/A DL_LOG_PPEN_RECEIVED_BREAK_CNT = 0x28,
2N/A DL_LOG_PPEN_BREAK_TIMEOUT_CNT = 0x29,
2N/A DL_LOG_PPEN_CONN_CNT = 0x2a,
2N/A DL_LOG_PPEN_PEAK_BLOCKED_CNT = 0x2b,
2N/A DL_LOG_PPEN_PEAK_WAIT_TIME = 0x2c,
2N/A DL_LOG_PPEN_PEAK_ARBI_TIME = 0x2d,
2N/A DL_LOG_PPEN_PEAK_CONN_TIME = 0x2e,
2N/A DL_LOG_PPEN_TRANSMITTED_SSP_CNT = 0x40,
2N/A DL_LOG_PPEN_RECEIVED_SSP_CNT = 0x41,
2N/A DL_LOG_PPEN_TRANSMITTED_SSP_ERR_CNT = 0x42,
2N/A DL_LOG_PPEN_RECEIVED_SSP_ERR_CNT = 0x43,
2N/A DL_LOG_PPEN_TRANSMITTED_CB_CNT = 0x44,
2N/A DL_LOG_PPEN_RECEIVED_CB_CNT = 0x45,
2N/A DL_LOG_PPEN_TRANSMITTED_SATA_CNT = 0x50,
2N/A DL_LOG_PPEN_RECEIVED_SATA_CNT = 0x51,
2N/A DL_LOG_PPEN_SATA_BUF_CNT = 0x52,
2N/A DL_LOG_PPEN_TRANSMITTED_SMP_CNT = 0x60,
2N/A DL_LOG_PPEN_RECEIVED_SMP_CNT = 0x61,
2N/A DL_LOG_PPEN_RECEIVED_SMP_ERR_CNT = 0x63
2N/A} dl_log_protocol_phy_event_name_t;
2N/A
2N/A/*
2N/A * SAS-2 10.4.3.14.4 Table 297 Phy event descriptor
2N/A */
2N/Atypedef struct dl_log_params_protocol_ped {
2N/A uint8_t reserved1[3];
2N/A uint8_t lppp_phy_event_source;
2N/A uint32_t lppp_phy_event;
2N/A uint32_t lppp_peak_val;
2N/A} dl_log_params_protocol_ped_t;
2N/A
2N/A/* HITACHI Log Dump Command(E6) */
2N/Atypedef struct dl_hitachi_logdump_cdb {
2N/A uint8_t hlc_opcode;
2N/A uint8_t _reserved1;
2N/A DECL_BITFIELD2(
2N/A hlc_mode :4,
2N/A _reserved2 :4);
2N/A uint8_t hlc_offset[3];
2N/A uint8_t hlc_allocation_length[3];
2N/A DECL_BITFIELD4(
2N/A hlc_link :1,
2N/A hlc_flag :1,
2N/A _reserved3 :4,
2N/A hlc_vu :2);
2N/A} dl_hitachi_logdump_cdb_t;
2N/A
2N/A/* SEAGATE Log Dump Command(F7) */
2N/Atypedef struct dl_seagate_logdump_cdb {
2N/A uint8_t slc_opcode;
2N/A DECL_BITFIELD5(
2N/A _reserved1 :1,
2N/A slc_clear :1,
2N/A slc_dump :1,
2N/A slc_read :1,
2N/A _reserved2 :4);
2N/A uint8_t _reserved3[2];
2N/A uint16_t slc_start_offset;
2N/A uint8_t slc_fixed;
2N/A uint16_t slc_xfer_length;
2N/A uint8_t _reserved4;
2N/A} dl_seagate_logdump_cdb_t;
2N/A
2N/A#pragma pack()
2N/A
2N/A#ifdef __cplusplus
2N/A}
2N/A#endif
2N/A
2N/A#endif /* _disklog_H */