linux/include/uapi/scsi/scsi_bsg_mpi3mr.h

/* SPDX-License-Identifier: GPL-2.0-or-later WITH Linux-syscall-note */
/*
 * Driver for Broadcom MPI3 Storage Controllers
 *
 * Copyright (C) 2017-2022 Broadcom Inc.
 *  (mailto: [email protected])
 *
 */

#ifndef SCSI_BSG_MPI3MR_H_INCLUDED
#define SCSI_BSG_MPI3MR_H_INCLUDED

#include <linux/types.h>

/* Definitions for BSG commands */
#define MPI3MR_IOCTL_VERSION

#define MPI3MR_APP_DEFAULT_TIMEOUT

#define MPI3MR_BSG_ADPTYPE_UNKNOWN
#define MPI3MR_BSG_ADPTYPE_AVGFAMILY

#define MPI3MR_BSG_ADPSTATE_UNKNOWN
#define MPI3MR_BSG_ADPSTATE_OPERATIONAL
#define MPI3MR_BSG_ADPSTATE_FAULT
#define MPI3MR_BSG_ADPSTATE_IN_RESET
#define MPI3MR_BSG_ADPSTATE_UNRECOVERABLE

#define MPI3MR_BSG_ADPRESET_UNKNOWN
#define MPI3MR_BSG_ADPRESET_SOFT
#define MPI3MR_BSG_ADPRESET_DIAG_FAULT

#define MPI3MR_BSG_LOGDATA_MAX_ENTRIES
#define MPI3MR_BSG_LOGDATA_ENTRY_HEADER_SZ

#define MPI3MR_DRVBSG_OPCODE_UNKNOWN
#define MPI3MR_DRVBSG_OPCODE_ADPINFO
#define MPI3MR_DRVBSG_OPCODE_ADPRESET
#define MPI3MR_DRVBSG_OPCODE_ALLTGTDEVINFO
#define MPI3MR_DRVBSG_OPCODE_GETCHGCNT
#define MPI3MR_DRVBSG_OPCODE_LOGDATAENABLE
#define MPI3MR_DRVBSG_OPCODE_PELENABLE
#define MPI3MR_DRVBSG_OPCODE_GETLOGDATA
#define MPI3MR_DRVBSG_OPCODE_QUERY_HDB
#define MPI3MR_DRVBSG_OPCODE_REPOST_HDB
#define MPI3MR_DRVBSG_OPCODE_UPLOAD_HDB
#define MPI3MR_DRVBSG_OPCODE_REFRESH_HDB_TRIGGERS


#define MPI3MR_BSG_BUFTYPE_UNKNOWN
#define MPI3MR_BSG_BUFTYPE_RAIDMGMT_CMD
#define MPI3MR_BSG_BUFTYPE_RAIDMGMT_RESP
#define MPI3MR_BSG_BUFTYPE_DATA_IN
#define MPI3MR_BSG_BUFTYPE_DATA_OUT
#define MPI3MR_BSG_BUFTYPE_MPI_REPLY
#define MPI3MR_BSG_BUFTYPE_ERR_RESPONSE
#define MPI3MR_BSG_BUFTYPE_MPI_REQUEST

#define MPI3MR_BSG_MPI_REPLY_BUFTYPE_UNKNOWN
#define MPI3MR_BSG_MPI_REPLY_BUFTYPE_STATUS
#define MPI3MR_BSG_MPI_REPLY_BUFTYPE_ADDRESS

#define MPI3MR_HDB_BUFTYPE_UNKNOWN
#define MPI3MR_HDB_BUFTYPE_TRACE
#define MPI3MR_HDB_BUFTYPE_FIRMWARE
#define MPI3MR_HDB_BUFTYPE_RESERVED

#define MPI3MR_HDB_BUFSTATUS_UNKNOWN
#define MPI3MR_HDB_BUFSTATUS_NOT_ALLOCATED
#define MPI3MR_HDB_BUFSTATUS_POSTED_UNPAUSED
#define MPI3MR_HDB_BUFSTATUS_POSTED_PAUSED
#define MPI3MR_HDB_BUFSTATUS_RELEASED

#define MPI3MR_HDB_TRIGGER_TYPE_UNKNOWN
#define MPI3MR_HDB_TRIGGER_TYPE_DIAGFAULT
#define MPI3MR_HDB_TRIGGER_TYPE_ELEMENT
#define MPI3MR_HDB_TRIGGER_TYPE_MASTER


/* Supported BSG commands */
enum command {};

/**
 * struct mpi3_driver_info_layout - Information about driver
 *
 * @information_length: Length of this structure in bytes
 * @driver_signature: Driver Vendor name
 * @os_name: Operating System Name
 * @driver_name: Driver name
 * @driver_version: Driver version
 * @driver_release_date: Driver release date
 * @driver_capabilities: Driver capabilities
 */
struct mpi3_driver_info_layout {};

/**
 * struct mpi3mr_bsg_in_adpinfo - Adapter information request
 * data returned by the driver.
 *
 * @adp_type: Adapter type
 * @rsvd1: Reserved
 * @pci_dev_id: PCI device ID of the adapter
 * @pci_dev_hw_rev: PCI revision of the adapter
 * @pci_subsys_dev_id: PCI subsystem device ID of the adapter
 * @pci_subsys_ven_id: PCI subsystem vendor ID of the adapter
 * @pci_dev: PCI device
 * @pci_func: PCI function
 * @pci_bus: PCI bus
 * @rsvd2: Reserved
 * @pci_seg_id: PCI segment ID
 * @app_intfc_ver: version of the application interface definition
 * @rsvd3: Reserved
 * @rsvd4: Reserved
 * @rsvd5: Reserved
 * @driver_info: Driver Information (Version/Name)
 */
struct mpi3mr_bsg_in_adpinfo {};

/**
 * struct mpi3mr_bsg_adp_reset - Adapter reset request
 * payload data to the driver.
 *
 * @reset_type: Reset type
 * @rsvd1: Reserved
 * @rsvd2: Reserved
 */
struct mpi3mr_bsg_adp_reset {};

/**
 * struct mpi3mr_change_count - Topology change count
 * returned by the driver.
 *
 * @change_count: Topology change count
 * @rsvd: Reserved
 */
struct mpi3mr_change_count {};

/**
 * struct mpi3mr_device_map_info - Target device mapping
 * information
 *
 * @handle: Firmware device handle
 * @perst_id: Persistent ID assigned by the firmware
 * @target_id: Target ID assigned by the driver
 * @bus_id: Bus ID assigned by the driver
 * @rsvd1: Reserved
 * @rsvd2: Reserved
 */
struct mpi3mr_device_map_info {};

/**
 * struct mpi3mr_all_tgt_info - Target device mapping
 * information returned by the driver
 *
 * @num_devices: The number of devices in driver's inventory
 * @rsvd1: Reserved
 * @rsvd2: Reserved
 * @dmi: Variable length array of mapping information of targets
 */
struct mpi3mr_all_tgt_info {};

/**
 * struct mpi3mr_logdata_enable - Number of log data
 * entries saved by the driver returned as payload data for
 * enable logdata BSG request by the driver.
 *
 * @max_entries: Number of log data entries cached by the driver
 * @rsvd: Reserved
 */
struct mpi3mr_logdata_enable {};

/**
 * struct mpi3mr_bsg_out_pel_enable - PEL enable request payload
 * data to the driver.
 *
 * @pel_locale: PEL locale to the firmware
 * @pel_class: PEL class to the firmware
 * @rsvd: Reserved
 */
struct mpi3mr_bsg_out_pel_enable {};

/**
 * struct mpi3mr_logdata_entry - Log data entry cached by the
 * driver.
 *
 * @valid_entry: Is the entry valid
 * @rsvd1: Reserved
 * @rsvd2: Reserved
 * @data: Variable length Log entry data
 */
struct mpi3mr_logdata_entry {};

/**
 * struct mpi3mr_bsg_in_log_data - Log data entries saved by
 * the driver returned as payload data for Get logdata request
 * by the driver.
 *
 * @entry: Variable length Log data entry array
 */
struct mpi3mr_bsg_in_log_data {};

/**
 * struct mpi3mr_hdb_entry - host diag buffer entry.
 *
 * @buf_type: Buffer type
 * @status: Buffer status
 * @trigger_type: Trigger type
 * @rsvd1: Reserved
 * @size: Buffer size
 * @rsvd2: Reserved
 * @trigger_data: Trigger specific data
 * @rsvd3: Reserved
 * @rsvd4: Reserved
 */
struct mpi3mr_hdb_entry {};


/**
 * struct mpi3mr_bsg_in_hdb_status - This structure contains
 * return data for the BSG request to retrieve the number of host
 * diagnostic buffers supported by the driver and their current
 * status and additional status specific data if any in forms of
 * multiple hdb entries.
 *
 * @num_hdb_types: Number of host diag buffer types supported
 * @element_trigger_format: Element trigger format
 * @rsvd1: Reserved
 * @rsvd2: Reserved
 * @rsvd3: Reserved
 * @entry: Variable length Diag buffer status entry array
 */
struct mpi3mr_bsg_in_hdb_status {};

/**
 * struct mpi3mr_bsg_out_repost_hdb - Repost host diagnostic
 * buffer request payload data to the driver.
 *
 * @buf_type: Buffer type
 * @rsvd1: Reserved
 * @rsvd2: Reserved
 */
struct mpi3mr_bsg_out_repost_hdb {};

/**
 * struct mpi3mr_bsg_out_upload_hdb - Upload host diagnostic
 * buffer request payload data to the driver.
 *
 * @buf_type: Buffer type
 * @rsvd1: Reserved
 * @rsvd2: Reserved
 * @start_offset: Start offset of the buffer from where to copy
 * @length: Length of the buffer to copy
 */
struct mpi3mr_bsg_out_upload_hdb {};

/**
 * struct mpi3mr_bsg_out_refresh_hdb_triggers - Refresh host
 * diagnostic buffer triggers request payload data to the driver.
 *
 * @page_type: Page type
 * @rsvd1: Reserved
 * @rsvd2: Reserved
 */
struct mpi3mr_bsg_out_refresh_hdb_triggers {};
/**
 * struct mpi3mr_bsg_drv_cmd -  Generic bsg data
 * structure for all driver specific requests.
 *
 * @mrioc_id: Controller ID
 * @opcode: Driver specific opcode
 * @rsvd1: Reserved
 * @rsvd2: Reserved
 */
struct mpi3mr_bsg_drv_cmd {};
/**
 * struct mpi3mr_bsg_in_reply_buf - MPI reply buffer returned
 * for MPI Passthrough request .
 *
 * @mpi_reply_type: Type of MPI reply
 * @rsvd1: Reserved
 * @rsvd2: Reserved
 * @reply_buf: Variable Length buffer based on mpirep type
 */
struct mpi3mr_bsg_in_reply_buf {};

/**
 * struct mpi3mr_buf_entry - User buffer descriptor for MPI
 * Passthrough requests.
 *
 * @buf_type: Buffer type
 * @rsvd1: Reserved
 * @rsvd2: Reserved
 * @buf_len: Buffer length
 */
struct mpi3mr_buf_entry {};
/**
 * struct mpi3mr_buf_entry_list - list of user buffer
 * descriptor for MPI Passthrough requests.
 *
 * @num_of_entries: Number of buffer descriptors
 * @rsvd1: Reserved
 * @rsvd2: Reserved
 * @rsvd3: Reserved
 * @buf_entry: Variable length array of buffer descriptors
 */
struct mpi3mr_buf_entry_list {};
/**
 * struct mpi3mr_bsg_mptcmd -  Generic bsg data
 * structure for all MPI Passthrough requests .
 *
 * @mrioc_id: Controller ID
 * @rsvd1: Reserved
 * @timeout: MPI request timeout
 * @rsvd2: Reserved
 * @buf_entry_list: Buffer descriptor list
 */
struct mpi3mr_bsg_mptcmd {};

/**
 * struct mpi3mr_bsg_packet -  Generic bsg data
 * structure for all supported requests .
 *
 * @cmd_type: represents drvrcmd or mptcmd
 * @rsvd1: Reserved
 * @rsvd2: Reserved
 * @rsvd3: Reserved
 * @cmd.drvrcmd: driver request structure
 * @cmd.mptcmd: mpt request structure
 */
struct mpi3mr_bsg_packet {};

struct mpi3_nvme_encapsulated_request {};

struct mpi3_nvme_encapsulated_error_reply {};

#define MPI3MR_NVME_PRP_SIZE
#define MPI3MR_NVME_CMD_PRP1_OFFSET
#define MPI3MR_NVME_CMD_PRP2_OFFSET
#define MPI3MR_NVME_CMD_SGL_OFFSET
#define MPI3MR_NVME_DATA_FORMAT_PRP
#define MPI3MR_NVME_DATA_FORMAT_SGL1
#define MPI3MR_NVME_DATA_FORMAT_SGL2
#define MPI3MR_NVMESGL_DATA_SEGMENT
#define MPI3MR_NVMESGL_LAST_SEGMENT

/* MPI3: task management related definitions */
struct mpi3_scsi_task_mgmt_request {};

#define MPI3_SCSITASKMGMT_MSGFLAGS_DO_NOT_SEND_TASK_IU
#define MPI3_SCSITASKMGMT_TASKTYPE_ABORT_TASK
#define MPI3_SCSITASKMGMT_TASKTYPE_ABORT_TASK_SET
#define MPI3_SCSITASKMGMT_TASKTYPE_TARGET_RESET
#define MPI3_SCSITASKMGMT_TASKTYPE_LOGICAL_UNIT_RESET
#define MPI3_SCSITASKMGMT_TASKTYPE_CLEAR_TASK_SET
#define MPI3_SCSITASKMGMT_TASKTYPE_QUERY_TASK
#define MPI3_SCSITASKMGMT_TASKTYPE_CLEAR_ACA
#define MPI3_SCSITASKMGMT_TASKTYPE_QUERY_TASK_SET
#define MPI3_SCSITASKMGMT_TASKTYPE_QUERY_ASYNC_EVENT
#define MPI3_SCSITASKMGMT_TASKTYPE_I_T_NEXUS_RESET
struct mpi3_scsi_task_mgmt_reply {};

#define MPI3_SCSITASKMGMT_RSPCODE_TM_COMPLETE
#define MPI3_SCSITASKMGMT_RSPCODE_INVALID_FRAME
#define MPI3_SCSITASKMGMT_RSPCODE_TM_FUNCTION_NOT_SUPPORTED
#define MPI3_SCSITASKMGMT_RSPCODE_TM_FAILED
#define MPI3_SCSITASKMGMT_RSPCODE_TM_SUCCEEDED
#define MPI3_SCSITASKMGMT_RSPCODE_TM_INVALID_LUN
#define MPI3_SCSITASKMGMT_RSPCODE_TM_OVERLAPPED_TAG
#define MPI3_SCSITASKMGMT_RSPCODE_IO_QUEUED_ON_IOC
#define MPI3_SCSITASKMGMT_RSPCODE_TM_NVME_DENIED

/* MPI3: PEL related definitions */
#define MPI3_PEL_LOCALE_FLAGS_NON_BLOCKING_BOOT_EVENT
#define MPI3_PEL_LOCALE_FLAGS_BLOCKING_BOOT_EVENT
#define MPI3_PEL_LOCALE_FLAGS_PCIE
#define MPI3_PEL_LOCALE_FLAGS_CONFIGURATION
#define MPI3_PEL_LOCALE_FLAGS_CONTROLER
#define MPI3_PEL_LOCALE_FLAGS_SAS
#define MPI3_PEL_LOCALE_FLAGS_EPACK
#define MPI3_PEL_LOCALE_FLAGS_ENCLOSURE
#define MPI3_PEL_LOCALE_FLAGS_PD
#define MPI3_PEL_LOCALE_FLAGS_VD
#define MPI3_PEL_CLASS_DEBUG
#define MPI3_PEL_CLASS_PROGRESS
#define MPI3_PEL_CLASS_INFORMATIONAL
#define MPI3_PEL_CLASS_WARNING
#define MPI3_PEL_CLASS_CRITICAL
#define MPI3_PEL_CLASS_FATAL
#define MPI3_PEL_CLASS_FAULT

/* MPI3: Function definitions */
#define MPI3_BSG_FUNCTION_MGMT_PASSTHROUGH
#define MPI3_BSG_FUNCTION_SCSI_IO
#define MPI3_BSG_FUNCTION_SCSI_TASK_MGMT
#define MPI3_BSG_FUNCTION_SMP_PASSTHROUGH
#define MPI3_BSG_FUNCTION_NVME_ENCAPSULATED

#endif