#ifndef _PM8001_DEFS_H_
#define _PM8001_DEFS_H_
#include <scsi/sas.h>
#ifdef __LITTLE_ENDIAN_BITFIELD
struct sas_identify_frame_local {
u8 frame_type:4;
u8 dev_type:3;
u8 _un0:1;
u8 _un1;
union {
struct {
u8 _un20:1;
u8 smp_iport:1;
u8 stp_iport:1;
u8 ssp_iport:1;
u8 _un247:4;
};
u8 initiator_bits;
};
union {
struct {
u8 _un30:1;
u8 smp_tport:1;
u8 stp_tport:1;
u8 ssp_tport:1;
u8 _un347:4;
};
u8 target_bits;
};
u8 _un4_11[8];
u8 sas_addr[SAS_ADDR_SIZE];
u8 phy_id;
u8 _un21_27[7];
} __packed;
#elif defined(__BIG_ENDIAN_BITFIELD)
struct sas_identify_frame_local {
u8 _un0:1;
u8 dev_type:3;
u8 frame_type:4;
u8 _un1;
union {
struct {
u8 _un247:4;
u8 ssp_iport:1;
u8 stp_iport:1;
u8 smp_iport:1;
u8 _un20:1;
};
u8 initiator_bits;
};
union {
struct {
u8 _un347:4;
u8 ssp_tport:1;
u8 stp_tport:1;
u8 smp_tport:1;
u8 _un30:1;
};
u8 target_bits;
};
u8 _un4_11[8];
u8 sas_addr[SAS_ADDR_SIZE];
u8 phy_id;
u8 _un21_27[7];
} __packed;
#else
#error "Bitfield order not defined!"
#endif
enum chip_flavors {
chip_8001,
chip_8008,
chip_8009,
chip_8018,
chip_8019,
chip_8074,
chip_8076,
chip_8077,
chip_8006,
chip_8070,
chip_8072
};
enum phy_speed {
PHY_SPEED_15 = 0x01,
PHY_SPEED_30 = 0x02,
PHY_SPEED_60 = 0x04,
PHY_SPEED_120 = 0x08,
};
enum data_direction {
DATA_DIR_NONE = 0x0,
DATA_DIR_IN = 0x01,
DATA_DIR_OUT = 0x02,
DATA_DIR_BYRECIPIENT = 0x04,
};
enum port_type {
PORT_TYPE_SAS = (1L << 1),
PORT_TYPE_SATA = (1L << 0),
};
#define PM8001_MAX_CCB 1024 /* max ccbs supported */
#define PM8001_MPI_QUEUE 1024 /* maximum mpi queue entries */
#define PM8001_MAX_INB_NUM 64
#define PM8001_MAX_OUTB_NUM 64
#define PM8001_CAN_QUEUE 508 /* SCSI Queue depth */
#define IOMB_SIZE_SPC 64
#define IOMB_SIZE_SPCV 128
#define PM8001_MAX_PHYS 16 /* max. possible phys */
#define PM8001_MAX_PORTS 16 /* max. possible ports */
#define PM8001_MAX_DEVICES 2048 /* max supported device */
#define PM8001_MAX_MSIX_VEC 64 /* max msi-x int for spcv/ve */
#define PM8001_RESERVE_SLOT 128
#define PM8001_SECTOR_SIZE 512
#define PM8001_PAGE_SIZE_4K 4096
#define PM8001_MAX_IO_SIZE (4 * 1024 * 1024)
#define PM8001_MAX_DMA_SG (PM8001_MAX_IO_SIZE / PM8001_PAGE_SIZE_4K)
#define PM8001_MAX_SECTORS (PM8001_MAX_IO_SIZE / PM8001_SECTOR_SIZE)
enum memory_region_num {
AAP1 = 0x0,
IOP,
NVMD,
FW_FLASH,
FORENSIC_MEM,
USI_MAX_MEMCNT_BASE
};
#define PM8001_EVENT_LOG_SIZE (128 * 1024)
#define USI_MAX_MEMCNT (USI_MAX_MEMCNT_BASE + ((2 * PM8001_MAX_INB_NUM) \
+ (2 * PM8001_MAX_OUTB_NUM)))
enum mpi_err {
MPI_IO_STATUS_SUCCESS = 0x0,
MPI_IO_STATUS_BUSY = 0x01,
MPI_IO_STATUS_FAIL = 0x02,
};
enum phy_control_type {
PHY_LINK_RESET = 0x01,
PHY_HARD_RESET = 0x02,
PHY_NOTIFY_ENABLE_SPINUP = 0x10,
};
enum pm8001_hba_info_flags {
PM8001F_INIT_TIME = (1U << 0),
PM8001F_RUN_TIME = (1U << 1),
};
#define PHY_LINK_DISABLE 0x00
#define PHY_LINK_DOWN 0x01
#define PHY_STATE_LINK_UP_SPCV 0x2
#define PHY_STATE_LINK_UP_SPC 0x1
#endif