linux/drivers/scsi/pmcraid.h

/* SPDX-License-Identifier: GPL-2.0-or-later */
/*
 * pmcraid.h -- PMC Sierra MaxRAID controller driver header file
 *
 * Written By: Anil Ravindranath<[email protected]>
 *             PMC-Sierra Inc
 *
 * Copyright (C) 2008, 2009 PMC Sierra Inc.
 */

#ifndef _PMCRAID_H
#define _PMCRAID_H

#include <linux/types.h>
#include <linux/completion.h>
#include <linux/list.h>
#include <scsi/scsi.h>
#include <scsi/scsi_cmnd.h>
#include <linux/cdev.h>
#include <net/netlink.h>
#include <net/genetlink.h>
#include <linux/connector.h>
/*
 * Driver name   : string representing the driver name
 * Device file   : /dev file to be used for management interfaces
 * Driver version: version string in major_version.minor_version.patch format
 * Driver date   : date information in "Mon dd yyyy" format
 */
#define PMCRAID_DRIVER_NAME
#define PMCRAID_DEVFILE
#define PMCRAID_DRIVER_VERSION

#define PMCRAID_FW_VERSION_1

/* Maximum number of adapters supported by current version of the driver */
#define PMCRAID_MAX_ADAPTERS

/* Bit definitions as per firmware, bit position [0][1][2].....[31] */
#define PMC_BIT8(n)
#define PMC_BIT16(n)
#define PMC_BIT32(n)

/* PMC PCI vendor ID and device ID values */
#define PCI_VENDOR_ID_PMC
#define PCI_DEVICE_ID_PMC_MAXRAID

/*
 * MAX_CMD          : maximum commands that can be outstanding with IOA
 * MAX_IO_CMD       : command blocks available for IO commands
 * MAX_HCAM_CMD     : command blocks available for HCAMS
 * MAX_INTERNAL_CMD : command blocks available for internal commands like reset
 */
#define PMCRAID_MAX_CMD
#define PMCRAID_MAX_IO_CMD
#define PMCRAID_MAX_HCAM_CMD
#define PMCRAID_MAX_INTERNAL_CMD

/* MAX_IOADLS       : max number of scatter-gather lists supported by IOA
 * IOADLS_INTERNAL  : number of ioadls included as part of IOARCB.
 * IOADLS_EXTERNAL  : number of ioadls allocated external to IOARCB
 */
#define PMCRAID_IOADLS_INTERNAL
#define PMCRAID_IOADLS_EXTERNAL
#define PMCRAID_MAX_IOADLS

/* HRRQ_ENTRY_SIZE  : size of hrrq buffer
 * IOARCB_ALIGNMENT : alignment required for IOARCB
 * IOADL_ALIGNMENT  : alignment requirement for IOADLs
 * MSIX_VECTORS     : number of MSIX vectors supported
 */
#define HRRQ_ENTRY_SIZE
#define PMCRAID_IOARCB_ALIGNMENT
#define PMCRAID_IOADL_ALIGNMENT
#define PMCRAID_IOASA_ALIGNMENT
#define PMCRAID_NUM_MSIX_VECTORS

/* various other limits */
#define PMCRAID_VENDOR_ID_LEN
#define PMCRAID_PRODUCT_ID_LEN
#define PMCRAID_SERIAL_NUM_LEN
#define PMCRAID_LUN_LEN
#define PMCRAID_MAX_CDB_LEN
#define PMCRAID_DEVICE_ID_LEN
#define PMCRAID_SENSE_DATA_LEN
#define PMCRAID_ADD_CMD_PARAM_LEN

#define PMCRAID_MAX_BUS_TO_SCAN
#define PMCRAID_MAX_NUM_TARGETS_PER_BUS
#define PMCRAID_MAX_NUM_LUNS_PER_TARGET

/* IOA bus/target/lun number of IOA resources */
#define PMCRAID_IOA_BUS_ID
#define PMCRAID_IOA_TARGET_ID
#define PMCRAID_IOA_LUN_ID
#define PMCRAID_VSET_BUS_ID
#define PMCRAID_VSET_LUN_ID
#define PMCRAID_PHYS_BUS_ID
#define PMCRAID_VIRTUAL_ENCL_BUS_ID
#define PMCRAID_MAX_VSET_TARGETS
#define PMCRAID_MAX_VSET_LUNS_PER_TARGET

#define PMCRAID_IOA_MAX_SECTORS
#define PMCRAID_VSET_MAX_SECTORS
#define PMCRAID_MAX_CMD_PER_LUN

/* Number of configuration table entries (resources), includes 1 FP,
 * 1 Enclosure device
 */
#define PMCRAID_MAX_RESOURCES

/* Adapter Commands used by driver */
#define PMCRAID_QUERY_RESOURCE_STATE
#define PMCRAID_RESET_DEVICE
/* options to select reset target */
#define ENABLE_RESET_MODIFIER
#define RESET_DEVICE_LUN
#define RESET_DEVICE_TARGET
#define RESET_DEVICE_BUS

#define PMCRAID_IDENTIFY_HRRQ
#define PMCRAID_QUERY_IOA_CONFIG
#define PMCRAID_QUERY_CMD_STATUS
#define PMCRAID_ABORT_CMD

/* CANCEL ALL command, provides option for setting SYNC_COMPLETE
 * on the target resources for which commands got cancelled
 */
#define PMCRAID_CANCEL_ALL_REQUESTS
#define PMCRAID_SYNC_COMPLETE_AFTER_CANCEL

/* HCAM command and types of HCAM supported by IOA */
#define PMCRAID_HOST_CONTROLLED_ASYNC
#define PMCRAID_HCAM_CODE_CONFIG_CHANGE
#define PMCRAID_HCAM_CODE_LOG_DATA

/* IOA shutdown command and various shutdown types */
#define PMCRAID_IOA_SHUTDOWN
#define PMCRAID_SHUTDOWN_NORMAL
#define PMCRAID_SHUTDOWN_PREPARE_FOR_NORMAL
#define PMCRAID_SHUTDOWN_NONE
#define PMCRAID_SHUTDOWN_ABBREV

/* SET SUPPORTED DEVICES command and the option to select all the
 * devices to be supported
 */
#define PMCRAID_SET_SUPPORTED_DEVICES
#define ALL_DEVICES_SUPPORTED

/* This option is used with SCSI WRITE_BUFFER command */
#define PMCRAID_WR_BUF_DOWNLOAD_AND_SAVE

/* IOASC Codes used by driver */
#define PMCRAID_IOASC_SENSE_MASK
#define PMCRAID_IOASC_SENSE_KEY(ioasc)
#define PMCRAID_IOASC_SENSE_CODE(ioasc)
#define PMCRAID_IOASC_SENSE_QUAL(ioasc)
#define PMCRAID_IOASC_SENSE_STATUS(ioasc)

#define PMCRAID_IOASC_GOOD_COMPLETION
#define PMCRAID_IOASC_GC_IOARCB_NOTFOUND
#define PMCRAID_IOASC_NR_INIT_CMD_REQUIRED
#define PMCRAID_IOASC_NR_IOA_RESET_REQUIRED
#define PMCRAID_IOASC_NR_SYNC_REQUIRED
#define PMCRAID_IOASC_ME_READ_ERROR_NO_REALLOC
#define PMCRAID_IOASC_HW_CANNOT_COMMUNICATE
#define PMCRAID_IOASC_HW_DEVICE_TIMEOUT
#define PMCRAID_IOASC_HW_DEVICE_BUS_STATUS_ERROR
#define PMCRAID_IOASC_HW_IOA_RESET_REQUIRED
#define PMCRAID_IOASC_IR_INVALID_RESOURCE_HANDLE
#define PMCRAID_IOASC_AC_TERMINATED_BY_HOST
#define PMCRAID_IOASC_UA_BUS_WAS_RESET
#define PMCRAID_IOASC_TIME_STAMP_OUT_OF_SYNC
#define PMCRAID_IOASC_UA_BUS_WAS_RESET_BY_OTHER

/* Driver defined IOASCs */
#define PMCRAID_IOASC_IOA_WAS_RESET
#define PMCRAID_IOASC_PCI_ACCESS_ERROR

/* Various timeout values (in milliseconds) used. If any of these are chip
 * specific, move them to pmcraid_chip_details structure.
 */
#define PMCRAID_PCI_DEASSERT_TIMEOUT
#define PMCRAID_BIST_TIMEOUT
#define PMCRAID_AENWAIT_TIMEOUT
#define PMCRAID_TRANSOP_TIMEOUT

#define PMCRAID_RESET_TIMEOUT
#define PMCRAID_CHECK_FOR_RESET_TIMEOUT
#define PMCRAID_VSET_IO_TIMEOUT
#define PMCRAID_INTERNAL_TIMEOUT
#define PMCRAID_SHUTDOWN_TIMEOUT
#define PMCRAID_RESET_BUS_TIMEOUT
#define PMCRAID_RESET_HOST_TIMEOUT
#define PMCRAID_REQUEST_SENSE_TIMEOUT
#define PMCRAID_SET_SUP_DEV_TIMEOUT

/* structure to represent a scatter-gather element (IOADL descriptor) */
struct pmcraid_ioadl_desc {} __attribute__((packed, aligned));

/* pmcraid_ioadl_desc.flags values */
#define IOADL_FLAGS_CHAINED
#define IOADL_FLAGS_LAST_DESC
#define IOADL_FLAGS_READ_LAST
#define IOADL_FLAGS_WRITE_LAST


/* additional IOARCB data which can be CDB or additional request parameters
 * or list of IOADLs. Firmware supports max of 512 bytes for IOARCB, hence then
 * number of IOADLs are limted to 27. In case they are more than 27, they will
 * be used in chained form
 */
struct pmcraid_ioarcb_add_data {};

/*
 * IOA Request Control Block
 */
struct pmcraid_ioarcb {};

/* well known resource handle values */
#define PMCRAID_IOA_RES_HANDLE
#define PMCRAID_INVALID_RES_HANDLE

/* pmcraid_ioarcb.request_type values */
#define REQ_TYPE_SCSI
#define REQ_TYPE_IOACMD
#define REQ_TYPE_HCAM

/* pmcraid_ioarcb.flags0 values */
#define TRANSFER_DIR_WRITE
#define INHIBIT_UL_CHECK
#define SYNC_OVERRIDE
#define SYNC_COMPLETE
#define NO_LINK_DESCS

/* pmcraid_ioarcb.flags1 values */
#define DELAY_AFTER_RESET
#define TASK_TAG_SIMPLE
#define TASK_TAG_ORDERED
#define TASK_TAG_QUEUE_HEAD

/* toggle bit offset in response handle */
#define HRRQ_TOGGLE_BIT
#define HRRQ_RESPONSE_BIT

/* IOA Status Area */
struct pmcraid_ioasa_vset {} __attribute__((packed, aligned));

struct pmcraid_ioasa {} __attribute__((packed, aligned));

#define PMCRAID_DRIVER_ILID

/* Config Table Entry per Resource */
struct pmcraid_config_table_entry {} __attribute__((packed, aligned));

/* extended configuration table sizes are also of 32 bytes in size */
struct pmcraid_config_table_entry_ext {};

/* resource types (config_table_entry.resource_type values) */
#define RES_TYPE_AF_DASD
#define RES_TYPE_GSCSI
#define RES_TYPE_VSET
#define RES_TYPE_IOA_FP

#define RES_IS_IOA(res)
#define RES_IS_GSCSI(res)
#define RES_IS_VSET(res)
#define RES_IS_AFDASD(res)

/* bus_protocol values used by driver */
#define RES_TYPE_VENCLOSURE

/* config_table_entry.common_flags0 */
#define MULTIPATH_RESOURCE

/* unique_flags1 */
#define IMPORT_MODE_MANUAL

/* well known resource handle values */
#define RES_HANDLE_IOA
#define RES_HANDLE_NONE

/* well known resource address values */
#define RES_ADDRESS_IOAFP
#define RES_ADDRESS_INVALID

/* BUS/TARGET/LUN values from resource_addrr */
#define RES_BUS(res_addr)
#define RES_TARGET(res_addr)
#define RES_LUN(res_addr)

/* configuration table structure */
struct pmcraid_config_table {} __attribute__((packed, aligned));

/* config_table.flags value */
#define MICROCODE_UPDATE_REQUIRED

/*
 * HCAM format
 */
#define PMCRAID_HOSTRCB_LDNSIZE

/* Error log notification format */
struct pmcraid_hostrcb_error {} __attribute__ ((packed, aligned));

struct pmcraid_hcam_hdr {} __attribute__((packed, aligned));

#define PMCRAID_AEN_GROUP

struct pmcraid_hcam_ccn {} __attribute__((packed, aligned));

#define PMCRAID_CCN_EXT_SIZE
struct pmcraid_hcam_ccn_ext {} __attribute__((packed, aligned));

struct pmcraid_hcam_ldn {} __attribute__((packed, aligned));

/* pmcraid_hcam.op_code values */
#define HOSTRCB_TYPE_CCN
#define HOSTRCB_TYPE_LDN

/* pmcraid_hcam.notification_type values */
#define NOTIFICATION_TYPE_ENTRY_CHANGED
#define NOTIFICATION_TYPE_ENTRY_NEW
#define NOTIFICATION_TYPE_ENTRY_DELETED
#define NOTIFICATION_TYPE_STATE_CHANGE
#define NOTIFICATION_TYPE_ENTRY_STATECHANGED
#define NOTIFICATION_TYPE_ERROR_LOG
#define NOTIFICATION_TYPE_INFORMATION_LOG

#define HOSTRCB_NOTIFICATIONS_LOST

/* pmcraid_hcam.flags values */
#define HOSTRCB_INTERNAL_OP_ERROR
#define HOSTRCB_ERROR_RESPONSE_SENT

/* pmcraid_hcam.overlay_id values */
#define HOSTRCB_OVERLAY_ID_08
#define HOSTRCB_OVERLAY_ID_09
#define HOSTRCB_OVERLAY_ID_11
#define HOSTRCB_OVERLAY_ID_12
#define HOSTRCB_OVERLAY_ID_13
#define HOSTRCB_OVERLAY_ID_14
#define HOSTRCB_OVERLAY_ID_16
#define HOSTRCB_OVERLAY_ID_17
#define HOSTRCB_OVERLAY_ID_20
#define HOSTRCB_OVERLAY_ID_FF

/* Implementation specific card details */
struct pmcraid_chip_details {};

/* IOA to HOST doorbells (interrupts) */
#define INTRS_TRANSITION_TO_OPERATIONAL
#define INTRS_IOARCB_TRANSFER_FAILED
#define INTRS_IOA_UNIT_CHECK
#define INTRS_NO_HRRQ_FOR_CMD_RESPONSE
#define INTRS_CRITICAL_OP_IN_PROGRESS
#define INTRS_IO_DEBUG_ACK
#define INTRS_IOARRIN_LOST
#define INTRS_SYSTEM_BUS_MMIO_ERROR
#define INTRS_IOA_PROCESSOR_ERROR
#define INTRS_HRRQ_VALID
#define INTRS_OPERATIONAL_STATUS
#define INTRS_ALLOW_MSIX_VECTOR0

/* Host to IOA Doorbells */
#define DOORBELL_RUNTIME_RESET
#define DOORBELL_IOA_RESET_ALERT
#define DOORBELL_IOA_DEBUG_ALERT
#define DOORBELL_ENABLE_DESTRUCTIVE_DIAGS
#define DOORBELL_IOA_START_BIST
#define DOORBELL_INTR_MODE_MSIX
#define DOORBELL_INTR_MSIX_CLR
#define DOORBELL_RESET_IOA

/* Global interrupt mask register value */
#define GLOBAL_INTERRUPT_MASK

#define PMCRAID_ERROR_INTERRUPTS

#define PMCRAID_PCI_INTERRUPTS

/* control_block, associated with each of the commands contains IOARCB, IOADLs
 * memory for IOASA. Additional 3 * 16 bytes are allocated in order to support
 * additional request parameters (of max size 48) any command.
 */
struct pmcraid_control_block {} __attribute__ ((packed, aligned));

/* pmcraid_sglist - Scatter-gather list allocated for passthrough ioctls
 */
struct pmcraid_sglist {};

/* page D0 inquiry data of focal point resource */
struct pmcraid_inquiry_data {};

#define PMCRAID_TIMESTAMP_LEN
#define PMCRAID_REQ_TM_STR_LEN
#define PMCRAID_SCSI_SET_TIMESTAMP
#define PMCRAID_SCSI_SERVICE_ACTION

struct pmcraid_timestamp_data {};

/* pmcraid_cmd - LLD representation of SCSI command */
struct pmcraid_cmd {};

/*
 * Interrupt registers of IOA
 */
struct pmcraid_interrupts {};

/* ISR parameters LLD allocates (one for each MSI-X if enabled) vectors */
struct pmcraid_isr_param {};


/* AEN message header sent as part of event data to applications */
struct pmcraid_aen_msg {};

/* Controller state event message type */
struct pmcraid_state_msg {};

#define PMC_DEVICE_EVENT_RESET_START
#define PMC_DEVICE_EVENT_RESET_SUCCESS
#define PMC_DEVICE_EVENT_RESET_FAILED
#define PMC_DEVICE_EVENT_SHUTDOWN_START
#define PMC_DEVICE_EVENT_SHUTDOWN_SUCCESS
#define PMC_DEVICE_EVENT_SHUTDOWN_FAILED

struct pmcraid_hostrcb {};

#define PMCRAID_AEN_HDR_SIZE



/*
 * Per adapter structure maintained by LLD
 */
struct pmcraid_instance {};

/* LLD maintained resource entry structure */
struct pmcraid_resource_entry {};

/* Data structures used in IOASC error code logging */
struct pmcraid_ioasc_error {};

/* Initial log_level assignments for various IOASCs */
#define IOASC_LOG_LEVEL_NONE
#define IOASC_LOG_LEVEL_MUST
#define IOASC_LOG_LEVEL_HARD

/* Error information maintained by LLD. LLD initializes the pmcraid_error_table
 * statically.
 */
static struct pmcraid_ioasc_error pmcraid_ioasc_error_table[] =;

/* macros to help in debugging */
#define pmcraid_err(...)

#define pmcraid_info(...)

/* check if given command is a SCSI READ or SCSI WRITE command */
#define SCSI_READ_CMD
#define SCSI_WRITE_CMD
#define SCSI_CMD_TYPE(opcode)

#define IS_SCSI_READ_WRITE(opcode)


/*
 * pmcraid_ioctl_header - definition of header structure that precedes all the
 * buffers given as ioctl arguments.
 *
 * .signature           : always ASCII string, "PMCRAID"
 * .reserved            : not used
 * .buffer_length       : length of the buffer following the header
 */
struct pmcraid_ioctl_header {};

#define PMCRAID_IOCTL_SIGNATURE

/*
 * keys to differentiate between driver handled IOCTLs and passthrough
 * IOCTLs passed to IOA. driver determines the ioctl type using macro
 * _IOC_TYPE
 */
#define PMCRAID_DRIVER_IOCTL

#define DRV_IOCTL(n, size)

/*
 * _ARGSIZE: macro that gives size of the argument type passed to an IOCTL cmd.
 * This is to facilitate applications avoiding un-necessary memory allocations.
 * For example, most of driver handled ioctls do not require ioarcb, ioasa.
 */
#define _ARGSIZE(arg)

/* Driver handled IOCTL command definitions */

#define PMCRAID_IOCTL_RESET_ADAPTER

#endif /* _PMCRAID_H */