18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-or-later */ 28c2ecf20Sopenharmony_ci/* 38c2ecf20Sopenharmony_ci * CXL Flash Device Driver 48c2ecf20Sopenharmony_ci * 58c2ecf20Sopenharmony_ci * Written by: Manoj N. Kumar <manoj@linux.vnet.ibm.com>, IBM Corporation 68c2ecf20Sopenharmony_ci * Matthew R. Ochs <mrochs@linux.vnet.ibm.com>, IBM Corporation 78c2ecf20Sopenharmony_ci * 88c2ecf20Sopenharmony_ci * Copyright (C) 2015 IBM Corporation 98c2ecf20Sopenharmony_ci */ 108c2ecf20Sopenharmony_ci 118c2ecf20Sopenharmony_ci#ifndef _SISLITE_H 128c2ecf20Sopenharmony_ci#define _SISLITE_H 138c2ecf20Sopenharmony_ci 148c2ecf20Sopenharmony_ci#include <linux/types.h> 158c2ecf20Sopenharmony_ci 168c2ecf20Sopenharmony_citypedef u16 ctx_hndl_t; 178c2ecf20Sopenharmony_citypedef u32 res_hndl_t; 188c2ecf20Sopenharmony_ci 198c2ecf20Sopenharmony_ci#define SIZE_4K 4096 208c2ecf20Sopenharmony_ci#define SIZE_64K 65536 218c2ecf20Sopenharmony_ci 228c2ecf20Sopenharmony_ci/* 238c2ecf20Sopenharmony_ci * IOARCB: 64 bytes, min 16 byte alignment required, host native endianness 248c2ecf20Sopenharmony_ci * except for SCSI CDB which remains big endian per SCSI standards. 258c2ecf20Sopenharmony_ci */ 268c2ecf20Sopenharmony_cistruct sisl_ioarcb { 278c2ecf20Sopenharmony_ci u16 ctx_id; /* ctx_hndl_t */ 288c2ecf20Sopenharmony_ci u16 req_flags; 298c2ecf20Sopenharmony_ci#define SISL_REQ_FLAGS_RES_HNDL 0x8000U /* bit 0 (MSB) */ 308c2ecf20Sopenharmony_ci#define SISL_REQ_FLAGS_PORT_LUN_ID 0x0000U 318c2ecf20Sopenharmony_ci 328c2ecf20Sopenharmony_ci#define SISL_REQ_FLAGS_SUP_UNDERRUN 0x4000U /* bit 1 */ 338c2ecf20Sopenharmony_ci 348c2ecf20Sopenharmony_ci#define SISL_REQ_FLAGS_TIMEOUT_SECS 0x0000U /* bits 8,9 */ 358c2ecf20Sopenharmony_ci#define SISL_REQ_FLAGS_TIMEOUT_MSECS 0x0040U 368c2ecf20Sopenharmony_ci#define SISL_REQ_FLAGS_TIMEOUT_USECS 0x0080U 378c2ecf20Sopenharmony_ci#define SISL_REQ_FLAGS_TIMEOUT_CYCLES 0x00C0U 388c2ecf20Sopenharmony_ci 398c2ecf20Sopenharmony_ci#define SISL_REQ_FLAGS_TMF_CMD 0x0004u /* bit 13 */ 408c2ecf20Sopenharmony_ci 418c2ecf20Sopenharmony_ci#define SISL_REQ_FLAGS_AFU_CMD 0x0002U /* bit 14 */ 428c2ecf20Sopenharmony_ci 438c2ecf20Sopenharmony_ci#define SISL_REQ_FLAGS_HOST_WRITE 0x0001U /* bit 15 (LSB) */ 448c2ecf20Sopenharmony_ci#define SISL_REQ_FLAGS_HOST_READ 0x0000U 458c2ecf20Sopenharmony_ci 468c2ecf20Sopenharmony_ci union { 478c2ecf20Sopenharmony_ci u32 res_hndl; /* res_hndl_t */ 488c2ecf20Sopenharmony_ci u32 port_sel; /* this is a selection mask: 498c2ecf20Sopenharmony_ci * 0x1 -> port#0 can be selected, 508c2ecf20Sopenharmony_ci * 0x2 -> port#1 can be selected. 518c2ecf20Sopenharmony_ci * Can be bitwise ORed. 528c2ecf20Sopenharmony_ci */ 538c2ecf20Sopenharmony_ci }; 548c2ecf20Sopenharmony_ci u64 lun_id; 558c2ecf20Sopenharmony_ci u32 data_len; /* 4K for read/write */ 568c2ecf20Sopenharmony_ci u32 ioadl_len; 578c2ecf20Sopenharmony_ci union { 588c2ecf20Sopenharmony_ci u64 data_ea; /* min 16 byte aligned */ 598c2ecf20Sopenharmony_ci u64 ioadl_ea; 608c2ecf20Sopenharmony_ci }; 618c2ecf20Sopenharmony_ci u8 msi; /* LISN to send on RRQ write */ 628c2ecf20Sopenharmony_ci#define SISL_MSI_CXL_PFAULT 0 /* reserved for CXL page faults */ 638c2ecf20Sopenharmony_ci#define SISL_MSI_SYNC_ERROR 1 /* recommended for AFU sync error */ 648c2ecf20Sopenharmony_ci#define SISL_MSI_RRQ_UPDATED 2 /* recommended for IO completion */ 658c2ecf20Sopenharmony_ci#define SISL_MSI_ASYNC_ERROR 3 /* master only - for AFU async error */ 668c2ecf20Sopenharmony_ci 678c2ecf20Sopenharmony_ci u8 rrq; /* 0 for a single RRQ */ 688c2ecf20Sopenharmony_ci u16 timeout; /* in units specified by req_flags */ 698c2ecf20Sopenharmony_ci u32 rsvd1; 708c2ecf20Sopenharmony_ci u8 cdb[16]; /* must be in big endian */ 718c2ecf20Sopenharmony_ci#define SISL_AFU_CMD_SYNC 0xC0 /* AFU sync command */ 728c2ecf20Sopenharmony_ci#define SISL_AFU_CMD_LUN_PROVISION 0xD0 /* AFU LUN provision command */ 738c2ecf20Sopenharmony_ci#define SISL_AFU_CMD_DEBUG 0xE0 /* AFU debug command */ 748c2ecf20Sopenharmony_ci 758c2ecf20Sopenharmony_ci#define SISL_AFU_LUN_PROVISION_CREATE 0x00 /* LUN provision create type */ 768c2ecf20Sopenharmony_ci#define SISL_AFU_LUN_PROVISION_DELETE 0x01 /* LUN provision delete type */ 778c2ecf20Sopenharmony_ci 788c2ecf20Sopenharmony_ci union { 798c2ecf20Sopenharmony_ci u64 reserved; /* Reserved for IOARRIN mode */ 808c2ecf20Sopenharmony_ci struct sisl_ioasa *ioasa; /* IOASA EA for SQ Mode */ 818c2ecf20Sopenharmony_ci }; 828c2ecf20Sopenharmony_ci} __packed; 838c2ecf20Sopenharmony_ci 848c2ecf20Sopenharmony_cistruct sisl_rc { 858c2ecf20Sopenharmony_ci u8 flags; 868c2ecf20Sopenharmony_ci#define SISL_RC_FLAGS_SENSE_VALID 0x80U 878c2ecf20Sopenharmony_ci#define SISL_RC_FLAGS_FCP_RSP_CODE_VALID 0x40U 888c2ecf20Sopenharmony_ci#define SISL_RC_FLAGS_OVERRUN 0x20U 898c2ecf20Sopenharmony_ci#define SISL_RC_FLAGS_UNDERRUN 0x10U 908c2ecf20Sopenharmony_ci 918c2ecf20Sopenharmony_ci u8 afu_rc; 928c2ecf20Sopenharmony_ci#define SISL_AFU_RC_RHT_INVALID 0x01U /* user error */ 938c2ecf20Sopenharmony_ci#define SISL_AFU_RC_RHT_UNALIGNED 0x02U /* should never happen */ 948c2ecf20Sopenharmony_ci#define SISL_AFU_RC_RHT_OUT_OF_BOUNDS 0x03u /* user error */ 958c2ecf20Sopenharmony_ci#define SISL_AFU_RC_RHT_DMA_ERR 0x04u /* see afu_extra 968c2ecf20Sopenharmony_ci * may retry if afu_retry is off 978c2ecf20Sopenharmony_ci * possible on master exit 988c2ecf20Sopenharmony_ci */ 998c2ecf20Sopenharmony_ci#define SISL_AFU_RC_RHT_RW_PERM 0x05u /* no RW perms, user error */ 1008c2ecf20Sopenharmony_ci#define SISL_AFU_RC_LXT_UNALIGNED 0x12U /* should never happen */ 1018c2ecf20Sopenharmony_ci#define SISL_AFU_RC_LXT_OUT_OF_BOUNDS 0x13u /* user error */ 1028c2ecf20Sopenharmony_ci#define SISL_AFU_RC_LXT_DMA_ERR 0x14u /* see afu_extra 1038c2ecf20Sopenharmony_ci * may retry if afu_retry is off 1048c2ecf20Sopenharmony_ci * possible on master exit 1058c2ecf20Sopenharmony_ci */ 1068c2ecf20Sopenharmony_ci#define SISL_AFU_RC_LXT_RW_PERM 0x15u /* no RW perms, user error */ 1078c2ecf20Sopenharmony_ci 1088c2ecf20Sopenharmony_ci#define SISL_AFU_RC_NOT_XLATE_HOST 0x1au /* possible if master exited */ 1098c2ecf20Sopenharmony_ci 1108c2ecf20Sopenharmony_ci /* NO_CHANNELS means the FC ports selected by dest_port in 1118c2ecf20Sopenharmony_ci * IOARCB or in the LXT entry are down when the AFU tried to select 1128c2ecf20Sopenharmony_ci * a FC port. If the port went down on an active IO, it will set 1138c2ecf20Sopenharmony_ci * fc_rc to =0x54(NOLOGI) or 0x57(LINKDOWN) instead. 1148c2ecf20Sopenharmony_ci */ 1158c2ecf20Sopenharmony_ci#define SISL_AFU_RC_NO_CHANNELS 0x20U /* see afu_extra, may retry */ 1168c2ecf20Sopenharmony_ci#define SISL_AFU_RC_CAP_VIOLATION 0x21U /* either user error or 1178c2ecf20Sopenharmony_ci * afu reset/master restart 1188c2ecf20Sopenharmony_ci */ 1198c2ecf20Sopenharmony_ci#define SISL_AFU_RC_OUT_OF_DATA_BUFS 0x30U /* always retry */ 1208c2ecf20Sopenharmony_ci#define SISL_AFU_RC_DATA_DMA_ERR 0x31U /* see afu_extra 1218c2ecf20Sopenharmony_ci * may retry if afu_retry is off 1228c2ecf20Sopenharmony_ci */ 1238c2ecf20Sopenharmony_ci 1248c2ecf20Sopenharmony_ci u8 scsi_rc; /* SCSI status byte, retry as appropriate */ 1258c2ecf20Sopenharmony_ci#define SISL_SCSI_RC_CHECK 0x02U 1268c2ecf20Sopenharmony_ci#define SISL_SCSI_RC_BUSY 0x08u 1278c2ecf20Sopenharmony_ci 1288c2ecf20Sopenharmony_ci u8 fc_rc; /* retry */ 1298c2ecf20Sopenharmony_ci /* 1308c2ecf20Sopenharmony_ci * We should only see fc_rc=0x57 (LINKDOWN) or 0x54(NOLOGI) for 1318c2ecf20Sopenharmony_ci * commands that are in flight when a link goes down or is logged out. 1328c2ecf20Sopenharmony_ci * If the link is down or logged out before AFU selects the port, either 1338c2ecf20Sopenharmony_ci * it will choose the other port or we will get afu_rc=0x20 (no_channel) 1348c2ecf20Sopenharmony_ci * if there is no valid port to use. 1358c2ecf20Sopenharmony_ci * 1368c2ecf20Sopenharmony_ci * ABORTPEND/ABORTOK/ABORTFAIL/TGTABORT can be retried, typically these 1378c2ecf20Sopenharmony_ci * would happen if a frame is dropped and something times out. 1388c2ecf20Sopenharmony_ci * NOLOGI or LINKDOWN can be retried if the other port is up. 1398c2ecf20Sopenharmony_ci * RESIDERR can be retried as well. 1408c2ecf20Sopenharmony_ci * 1418c2ecf20Sopenharmony_ci * ABORTFAIL might indicate that lots of frames are getting CRC errors. 1428c2ecf20Sopenharmony_ci * So it maybe retried once and reset the link if it happens again. 1438c2ecf20Sopenharmony_ci * The link can also be reset on the CRC error threshold interrupt. 1448c2ecf20Sopenharmony_ci */ 1458c2ecf20Sopenharmony_ci#define SISL_FC_RC_ABORTPEND 0x52 /* exchange timeout or abort request */ 1468c2ecf20Sopenharmony_ci#define SISL_FC_RC_WRABORTPEND 0x53 /* due to write XFER_RDY invalid */ 1478c2ecf20Sopenharmony_ci#define SISL_FC_RC_NOLOGI 0x54 /* port not logged in, in-flight cmds */ 1488c2ecf20Sopenharmony_ci#define SISL_FC_RC_NOEXP 0x55 /* FC protocol error or HW bug */ 1498c2ecf20Sopenharmony_ci#define SISL_FC_RC_INUSE 0x56 /* tag already in use, HW bug */ 1508c2ecf20Sopenharmony_ci#define SISL_FC_RC_LINKDOWN 0x57 /* link down, in-flight cmds */ 1518c2ecf20Sopenharmony_ci#define SISL_FC_RC_ABORTOK 0x58 /* pending abort completed w/success */ 1528c2ecf20Sopenharmony_ci#define SISL_FC_RC_ABORTFAIL 0x59 /* pending abort completed w/fail */ 1538c2ecf20Sopenharmony_ci#define SISL_FC_RC_RESID 0x5A /* ioasa underrun/overrun flags set */ 1548c2ecf20Sopenharmony_ci#define SISL_FC_RC_RESIDERR 0x5B /* actual data len does not match SCSI 1558c2ecf20Sopenharmony_ci * reported len, possibly due to dropped 1568c2ecf20Sopenharmony_ci * frames 1578c2ecf20Sopenharmony_ci */ 1588c2ecf20Sopenharmony_ci#define SISL_FC_RC_TGTABORT 0x5C /* command aborted by target */ 1598c2ecf20Sopenharmony_ci}; 1608c2ecf20Sopenharmony_ci 1618c2ecf20Sopenharmony_ci#define SISL_SENSE_DATA_LEN 20 /* Sense data length */ 1628c2ecf20Sopenharmony_ci#define SISL_WWID_DATA_LEN 16 /* WWID data length */ 1638c2ecf20Sopenharmony_ci 1648c2ecf20Sopenharmony_ci/* 1658c2ecf20Sopenharmony_ci * IOASA: 64 bytes & must follow IOARCB, min 16 byte alignment required, 1668c2ecf20Sopenharmony_ci * host native endianness 1678c2ecf20Sopenharmony_ci */ 1688c2ecf20Sopenharmony_cistruct sisl_ioasa { 1698c2ecf20Sopenharmony_ci union { 1708c2ecf20Sopenharmony_ci struct sisl_rc rc; 1718c2ecf20Sopenharmony_ci u32 ioasc; 1728c2ecf20Sopenharmony_ci#define SISL_IOASC_GOOD_COMPLETION 0x00000000U 1738c2ecf20Sopenharmony_ci }; 1748c2ecf20Sopenharmony_ci 1758c2ecf20Sopenharmony_ci union { 1768c2ecf20Sopenharmony_ci u32 resid; 1778c2ecf20Sopenharmony_ci u32 lunid_hi; 1788c2ecf20Sopenharmony_ci }; 1798c2ecf20Sopenharmony_ci 1808c2ecf20Sopenharmony_ci u8 port; 1818c2ecf20Sopenharmony_ci u8 afu_extra; 1828c2ecf20Sopenharmony_ci /* when afu_rc=0x04, 0x14, 0x31 (_xxx_DMA_ERR): 1838c2ecf20Sopenharmony_ci * afu_exta contains PSL response code. Useful codes are: 1848c2ecf20Sopenharmony_ci */ 1858c2ecf20Sopenharmony_ci#define SISL_AFU_DMA_ERR_PAGE_IN 0x0A /* AFU_retry_on_pagein Action 1868c2ecf20Sopenharmony_ci * Enabled N/A 1878c2ecf20Sopenharmony_ci * Disabled retry 1888c2ecf20Sopenharmony_ci */ 1898c2ecf20Sopenharmony_ci#define SISL_AFU_DMA_ERR_INVALID_EA 0x0B /* this is a hard error 1908c2ecf20Sopenharmony_ci * afu_rc Implies 1918c2ecf20Sopenharmony_ci * 0x04, 0x14 master exit. 1928c2ecf20Sopenharmony_ci * 0x31 user error. 1938c2ecf20Sopenharmony_ci */ 1948c2ecf20Sopenharmony_ci /* when afu rc=0x20 (no channels): 1958c2ecf20Sopenharmony_ci * afu_extra bits [4:5]: available portmask, [6:7]: requested portmask. 1968c2ecf20Sopenharmony_ci */ 1978c2ecf20Sopenharmony_ci#define SISL_AFU_NO_CLANNELS_AMASK(afu_extra) (((afu_extra) & 0x0C) >> 2) 1988c2ecf20Sopenharmony_ci#define SISL_AFU_NO_CLANNELS_RMASK(afu_extra) ((afu_extra) & 0x03) 1998c2ecf20Sopenharmony_ci 2008c2ecf20Sopenharmony_ci u8 scsi_extra; 2018c2ecf20Sopenharmony_ci u8 fc_extra; 2028c2ecf20Sopenharmony_ci 2038c2ecf20Sopenharmony_ci union { 2048c2ecf20Sopenharmony_ci u8 sense_data[SISL_SENSE_DATA_LEN]; 2058c2ecf20Sopenharmony_ci struct { 2068c2ecf20Sopenharmony_ci u32 lunid_lo; 2078c2ecf20Sopenharmony_ci u8 wwid[SISL_WWID_DATA_LEN]; 2088c2ecf20Sopenharmony_ci }; 2098c2ecf20Sopenharmony_ci }; 2108c2ecf20Sopenharmony_ci 2118c2ecf20Sopenharmony_ci /* These fields are defined by the SISlite architecture for the 2128c2ecf20Sopenharmony_ci * host to use as they see fit for their implementation. 2138c2ecf20Sopenharmony_ci */ 2148c2ecf20Sopenharmony_ci union { 2158c2ecf20Sopenharmony_ci u64 host_use[4]; 2168c2ecf20Sopenharmony_ci u8 host_use_b[32]; 2178c2ecf20Sopenharmony_ci }; 2188c2ecf20Sopenharmony_ci} __packed; 2198c2ecf20Sopenharmony_ci 2208c2ecf20Sopenharmony_ci#define SISL_RESP_HANDLE_T_BIT 0x1ULL /* Toggle bit */ 2218c2ecf20Sopenharmony_ci 2228c2ecf20Sopenharmony_ci/* MMIO space is required to support only 64-bit access */ 2238c2ecf20Sopenharmony_ci 2248c2ecf20Sopenharmony_ci/* 2258c2ecf20Sopenharmony_ci * This AFU has two mechanisms to deal with endian-ness. 2268c2ecf20Sopenharmony_ci * One is a global configuration (in the afu_config) register 2278c2ecf20Sopenharmony_ci * below that specifies the endian-ness of the host. 2288c2ecf20Sopenharmony_ci * The other is a per context (i.e. application) specification 2298c2ecf20Sopenharmony_ci * controlled by the endian_ctrl field here. Since the master 2308c2ecf20Sopenharmony_ci * context is one such application the master context's 2318c2ecf20Sopenharmony_ci * endian-ness is set to be the same as the host. 2328c2ecf20Sopenharmony_ci * 2338c2ecf20Sopenharmony_ci * As per the SISlite spec, the MMIO registers are always 2348c2ecf20Sopenharmony_ci * big endian. 2358c2ecf20Sopenharmony_ci */ 2368c2ecf20Sopenharmony_ci#define SISL_ENDIAN_CTRL_BE 0x8000000000000080ULL 2378c2ecf20Sopenharmony_ci#define SISL_ENDIAN_CTRL_LE 0x0000000000000000ULL 2388c2ecf20Sopenharmony_ci 2398c2ecf20Sopenharmony_ci#ifdef __BIG_ENDIAN 2408c2ecf20Sopenharmony_ci#define SISL_ENDIAN_CTRL SISL_ENDIAN_CTRL_BE 2418c2ecf20Sopenharmony_ci#else 2428c2ecf20Sopenharmony_ci#define SISL_ENDIAN_CTRL SISL_ENDIAN_CTRL_LE 2438c2ecf20Sopenharmony_ci#endif 2448c2ecf20Sopenharmony_ci 2458c2ecf20Sopenharmony_ci/* per context host transport MMIO */ 2468c2ecf20Sopenharmony_cistruct sisl_host_map { 2478c2ecf20Sopenharmony_ci __be64 endian_ctrl; /* Per context Endian Control. The AFU will 2488c2ecf20Sopenharmony_ci * operate on whatever the context is of the 2498c2ecf20Sopenharmony_ci * host application. 2508c2ecf20Sopenharmony_ci */ 2518c2ecf20Sopenharmony_ci 2528c2ecf20Sopenharmony_ci __be64 intr_status; /* this sends LISN# programmed in ctx_ctrl. 2538c2ecf20Sopenharmony_ci * Only recovery in a PERM_ERR is a context 2548c2ecf20Sopenharmony_ci * exit since there is no way to tell which 2558c2ecf20Sopenharmony_ci * command caused the error. 2568c2ecf20Sopenharmony_ci */ 2578c2ecf20Sopenharmony_ci#define SISL_ISTATUS_PERM_ERR_LISN_3_EA 0x0400ULL /* b53, user error */ 2588c2ecf20Sopenharmony_ci#define SISL_ISTATUS_PERM_ERR_LISN_2_EA 0x0200ULL /* b54, user error */ 2598c2ecf20Sopenharmony_ci#define SISL_ISTATUS_PERM_ERR_LISN_1_EA 0x0100ULL /* b55, user error */ 2608c2ecf20Sopenharmony_ci#define SISL_ISTATUS_PERM_ERR_LISN_3_PASID 0x0080ULL /* b56, user error */ 2618c2ecf20Sopenharmony_ci#define SISL_ISTATUS_PERM_ERR_LISN_2_PASID 0x0040ULL /* b57, user error */ 2628c2ecf20Sopenharmony_ci#define SISL_ISTATUS_PERM_ERR_LISN_1_PASID 0x0020ULL /* b58, user error */ 2638c2ecf20Sopenharmony_ci#define SISL_ISTATUS_PERM_ERR_CMDROOM 0x0010ULL /* b59, user error */ 2648c2ecf20Sopenharmony_ci#define SISL_ISTATUS_PERM_ERR_RCB_READ 0x0008ULL /* b60, user error */ 2658c2ecf20Sopenharmony_ci#define SISL_ISTATUS_PERM_ERR_SA_WRITE 0x0004ULL /* b61, user error */ 2668c2ecf20Sopenharmony_ci#define SISL_ISTATUS_PERM_ERR_RRQ_WRITE 0x0002ULL /* b62, user error */ 2678c2ecf20Sopenharmony_ci /* Page in wait accessing RCB/IOASA/RRQ is reported in b63. 2688c2ecf20Sopenharmony_ci * Same error in data/LXT/RHT access is reported via IOASA. 2698c2ecf20Sopenharmony_ci */ 2708c2ecf20Sopenharmony_ci#define SISL_ISTATUS_TEMP_ERR_PAGEIN 0x0001ULL /* b63, can only be 2718c2ecf20Sopenharmony_ci * generated when AFU 2728c2ecf20Sopenharmony_ci * auto retry is 2738c2ecf20Sopenharmony_ci * disabled. If user 2748c2ecf20Sopenharmony_ci * can determine the 2758c2ecf20Sopenharmony_ci * command that caused 2768c2ecf20Sopenharmony_ci * the error, it can 2778c2ecf20Sopenharmony_ci * be retried. 2788c2ecf20Sopenharmony_ci */ 2798c2ecf20Sopenharmony_ci#define SISL_ISTATUS_UNMASK (0x07FFULL) /* 1 means unmasked */ 2808c2ecf20Sopenharmony_ci#define SISL_ISTATUS_MASK ~(SISL_ISTATUS_UNMASK) /* 1 means masked */ 2818c2ecf20Sopenharmony_ci 2828c2ecf20Sopenharmony_ci __be64 intr_clear; 2838c2ecf20Sopenharmony_ci __be64 intr_mask; 2848c2ecf20Sopenharmony_ci __be64 ioarrin; /* only write what cmd_room permits */ 2858c2ecf20Sopenharmony_ci __be64 rrq_start; /* start & end are both inclusive */ 2868c2ecf20Sopenharmony_ci __be64 rrq_end; /* write sequence: start followed by end */ 2878c2ecf20Sopenharmony_ci __be64 cmd_room; 2888c2ecf20Sopenharmony_ci __be64 ctx_ctrl; /* least significant byte or b56:63 is LISN# */ 2898c2ecf20Sopenharmony_ci#define SISL_CTX_CTRL_UNMAP_SECTOR 0x8000000000000000ULL /* b0 */ 2908c2ecf20Sopenharmony_ci#define SISL_CTX_CTRL_LISN_MASK (0xFFULL) 2918c2ecf20Sopenharmony_ci __be64 mbox_w; /* restricted use */ 2928c2ecf20Sopenharmony_ci __be64 sq_start; /* Submission Queue (R/W): write sequence and */ 2938c2ecf20Sopenharmony_ci __be64 sq_end; /* inclusion semantics are the same as RRQ */ 2948c2ecf20Sopenharmony_ci __be64 sq_head; /* Submission Queue Head (R): for debugging */ 2958c2ecf20Sopenharmony_ci __be64 sq_tail; /* Submission Queue TAIL (R/W): next IOARCB */ 2968c2ecf20Sopenharmony_ci __be64 sq_ctx_reset; /* Submission Queue Context Reset (R/W) */ 2978c2ecf20Sopenharmony_ci}; 2988c2ecf20Sopenharmony_ci 2998c2ecf20Sopenharmony_ci/* per context provisioning & control MMIO */ 3008c2ecf20Sopenharmony_cistruct sisl_ctrl_map { 3018c2ecf20Sopenharmony_ci __be64 rht_start; 3028c2ecf20Sopenharmony_ci __be64 rht_cnt_id; 3038c2ecf20Sopenharmony_ci /* both cnt & ctx_id args must be ULL */ 3048c2ecf20Sopenharmony_ci#define SISL_RHT_CNT_ID(cnt, ctx_id) (((cnt) << 48) | ((ctx_id) << 32)) 3058c2ecf20Sopenharmony_ci 3068c2ecf20Sopenharmony_ci __be64 ctx_cap; /* afu_rc below is when the capability is violated */ 3078c2ecf20Sopenharmony_ci#define SISL_CTX_CAP_PROXY_ISSUE 0x8000000000000000ULL /* afu_rc 0x21 */ 3088c2ecf20Sopenharmony_ci#define SISL_CTX_CAP_REAL_MODE 0x4000000000000000ULL /* afu_rc 0x21 */ 3098c2ecf20Sopenharmony_ci#define SISL_CTX_CAP_HOST_XLATE 0x2000000000000000ULL /* afu_rc 0x1a */ 3108c2ecf20Sopenharmony_ci#define SISL_CTX_CAP_PROXY_TARGET 0x1000000000000000ULL /* afu_rc 0x21 */ 3118c2ecf20Sopenharmony_ci#define SISL_CTX_CAP_AFU_CMD 0x0000000000000008ULL /* afu_rc 0x21 */ 3128c2ecf20Sopenharmony_ci#define SISL_CTX_CAP_GSCSI_CMD 0x0000000000000004ULL /* afu_rc 0x21 */ 3138c2ecf20Sopenharmony_ci#define SISL_CTX_CAP_WRITE_CMD 0x0000000000000002ULL /* afu_rc 0x21 */ 3148c2ecf20Sopenharmony_ci#define SISL_CTX_CAP_READ_CMD 0x0000000000000001ULL /* afu_rc 0x21 */ 3158c2ecf20Sopenharmony_ci __be64 mbox_r; 3168c2ecf20Sopenharmony_ci __be64 lisn_pasid[2]; 3178c2ecf20Sopenharmony_ci /* pasid _a arg must be ULL */ 3188c2ecf20Sopenharmony_ci#define SISL_LISN_PASID(_a, _b) (((_a) << 32) | (_b)) 3198c2ecf20Sopenharmony_ci __be64 lisn_ea[3]; 3208c2ecf20Sopenharmony_ci}; 3218c2ecf20Sopenharmony_ci 3228c2ecf20Sopenharmony_ci/* single copy global regs */ 3238c2ecf20Sopenharmony_cistruct sisl_global_regs { 3248c2ecf20Sopenharmony_ci __be64 aintr_status; 3258c2ecf20Sopenharmony_ci /* 3268c2ecf20Sopenharmony_ci * In cxlflash, FC port/link are arranged in port pairs, each 3278c2ecf20Sopenharmony_ci * gets a byte of status: 3288c2ecf20Sopenharmony_ci * 3298c2ecf20Sopenharmony_ci * *_OTHER: other err, FC_ERRCAP[31:20] 3308c2ecf20Sopenharmony_ci * *_LOGO: target sent FLOGI/PLOGI/LOGO while logged in 3318c2ecf20Sopenharmony_ci * *_CRC_T: CRC threshold exceeded 3328c2ecf20Sopenharmony_ci * *_LOGI_R: login state machine timed out and retrying 3338c2ecf20Sopenharmony_ci * *_LOGI_F: login failed, FC_ERROR[19:0] 3348c2ecf20Sopenharmony_ci * *_LOGI_S: login succeeded 3358c2ecf20Sopenharmony_ci * *_LINK_DN: link online to offline 3368c2ecf20Sopenharmony_ci * *_LINK_UP: link offline to online 3378c2ecf20Sopenharmony_ci */ 3388c2ecf20Sopenharmony_ci#define SISL_ASTATUS_FC2_OTHER 0x80000000ULL /* b32 */ 3398c2ecf20Sopenharmony_ci#define SISL_ASTATUS_FC2_LOGO 0x40000000ULL /* b33 */ 3408c2ecf20Sopenharmony_ci#define SISL_ASTATUS_FC2_CRC_T 0x20000000ULL /* b34 */ 3418c2ecf20Sopenharmony_ci#define SISL_ASTATUS_FC2_LOGI_R 0x10000000ULL /* b35 */ 3428c2ecf20Sopenharmony_ci#define SISL_ASTATUS_FC2_LOGI_F 0x08000000ULL /* b36 */ 3438c2ecf20Sopenharmony_ci#define SISL_ASTATUS_FC2_LOGI_S 0x04000000ULL /* b37 */ 3448c2ecf20Sopenharmony_ci#define SISL_ASTATUS_FC2_LINK_DN 0x02000000ULL /* b38 */ 3458c2ecf20Sopenharmony_ci#define SISL_ASTATUS_FC2_LINK_UP 0x01000000ULL /* b39 */ 3468c2ecf20Sopenharmony_ci 3478c2ecf20Sopenharmony_ci#define SISL_ASTATUS_FC3_OTHER 0x00800000ULL /* b40 */ 3488c2ecf20Sopenharmony_ci#define SISL_ASTATUS_FC3_LOGO 0x00400000ULL /* b41 */ 3498c2ecf20Sopenharmony_ci#define SISL_ASTATUS_FC3_CRC_T 0x00200000ULL /* b42 */ 3508c2ecf20Sopenharmony_ci#define SISL_ASTATUS_FC3_LOGI_R 0x00100000ULL /* b43 */ 3518c2ecf20Sopenharmony_ci#define SISL_ASTATUS_FC3_LOGI_F 0x00080000ULL /* b44 */ 3528c2ecf20Sopenharmony_ci#define SISL_ASTATUS_FC3_LOGI_S 0x00040000ULL /* b45 */ 3538c2ecf20Sopenharmony_ci#define SISL_ASTATUS_FC3_LINK_DN 0x00020000ULL /* b46 */ 3548c2ecf20Sopenharmony_ci#define SISL_ASTATUS_FC3_LINK_UP 0x00010000ULL /* b47 */ 3558c2ecf20Sopenharmony_ci 3568c2ecf20Sopenharmony_ci#define SISL_ASTATUS_FC0_OTHER 0x00008000ULL /* b48 */ 3578c2ecf20Sopenharmony_ci#define SISL_ASTATUS_FC0_LOGO 0x00004000ULL /* b49 */ 3588c2ecf20Sopenharmony_ci#define SISL_ASTATUS_FC0_CRC_T 0x00002000ULL /* b50 */ 3598c2ecf20Sopenharmony_ci#define SISL_ASTATUS_FC0_LOGI_R 0x00001000ULL /* b51 */ 3608c2ecf20Sopenharmony_ci#define SISL_ASTATUS_FC0_LOGI_F 0x00000800ULL /* b52 */ 3618c2ecf20Sopenharmony_ci#define SISL_ASTATUS_FC0_LOGI_S 0x00000400ULL /* b53 */ 3628c2ecf20Sopenharmony_ci#define SISL_ASTATUS_FC0_LINK_DN 0x00000200ULL /* b54 */ 3638c2ecf20Sopenharmony_ci#define SISL_ASTATUS_FC0_LINK_UP 0x00000100ULL /* b55 */ 3648c2ecf20Sopenharmony_ci 3658c2ecf20Sopenharmony_ci#define SISL_ASTATUS_FC1_OTHER 0x00000080ULL /* b56 */ 3668c2ecf20Sopenharmony_ci#define SISL_ASTATUS_FC1_LOGO 0x00000040ULL /* b57 */ 3678c2ecf20Sopenharmony_ci#define SISL_ASTATUS_FC1_CRC_T 0x00000020ULL /* b58 */ 3688c2ecf20Sopenharmony_ci#define SISL_ASTATUS_FC1_LOGI_R 0x00000010ULL /* b59 */ 3698c2ecf20Sopenharmony_ci#define SISL_ASTATUS_FC1_LOGI_F 0x00000008ULL /* b60 */ 3708c2ecf20Sopenharmony_ci#define SISL_ASTATUS_FC1_LOGI_S 0x00000004ULL /* b61 */ 3718c2ecf20Sopenharmony_ci#define SISL_ASTATUS_FC1_LINK_DN 0x00000002ULL /* b62 */ 3728c2ecf20Sopenharmony_ci#define SISL_ASTATUS_FC1_LINK_UP 0x00000001ULL /* b63 */ 3738c2ecf20Sopenharmony_ci 3748c2ecf20Sopenharmony_ci#define SISL_FC_INTERNAL_UNMASK 0x0000000300000000ULL /* 1 means unmasked */ 3758c2ecf20Sopenharmony_ci#define SISL_FC_INTERNAL_MASK ~(SISL_FC_INTERNAL_UNMASK) 3768c2ecf20Sopenharmony_ci#define SISL_FC_INTERNAL_SHIFT 32 3778c2ecf20Sopenharmony_ci 3788c2ecf20Sopenharmony_ci#define SISL_FC_SHUTDOWN_NORMAL 0x0000000000000010ULL 3798c2ecf20Sopenharmony_ci#define SISL_FC_SHUTDOWN_ABRUPT 0x0000000000000020ULL 3808c2ecf20Sopenharmony_ci 3818c2ecf20Sopenharmony_ci#define SISL_STATUS_SHUTDOWN_ACTIVE 0x0000000000000010ULL 3828c2ecf20Sopenharmony_ci#define SISL_STATUS_SHUTDOWN_COMPLETE 0x0000000000000020ULL 3838c2ecf20Sopenharmony_ci 3848c2ecf20Sopenharmony_ci#define SISL_ASTATUS_UNMASK 0xFFFFFFFFULL /* 1 means unmasked */ 3858c2ecf20Sopenharmony_ci#define SISL_ASTATUS_MASK ~(SISL_ASTATUS_UNMASK) /* 1 means masked */ 3868c2ecf20Sopenharmony_ci 3878c2ecf20Sopenharmony_ci __be64 aintr_clear; 3888c2ecf20Sopenharmony_ci __be64 aintr_mask; 3898c2ecf20Sopenharmony_ci __be64 afu_ctrl; 3908c2ecf20Sopenharmony_ci __be64 afu_hb; 3918c2ecf20Sopenharmony_ci __be64 afu_scratch_pad; 3928c2ecf20Sopenharmony_ci __be64 afu_port_sel; 3938c2ecf20Sopenharmony_ci#define SISL_AFUCONF_AR_IOARCB 0x4000ULL 3948c2ecf20Sopenharmony_ci#define SISL_AFUCONF_AR_LXT 0x2000ULL 3958c2ecf20Sopenharmony_ci#define SISL_AFUCONF_AR_RHT 0x1000ULL 3968c2ecf20Sopenharmony_ci#define SISL_AFUCONF_AR_DATA 0x0800ULL 3978c2ecf20Sopenharmony_ci#define SISL_AFUCONF_AR_RSRC 0x0400ULL 3988c2ecf20Sopenharmony_ci#define SISL_AFUCONF_AR_IOASA 0x0200ULL 3998c2ecf20Sopenharmony_ci#define SISL_AFUCONF_AR_RRQ 0x0100ULL 4008c2ecf20Sopenharmony_ci/* Aggregate all Auto Retry Bits */ 4018c2ecf20Sopenharmony_ci#define SISL_AFUCONF_AR_ALL (SISL_AFUCONF_AR_IOARCB|SISL_AFUCONF_AR_LXT| \ 4028c2ecf20Sopenharmony_ci SISL_AFUCONF_AR_RHT|SISL_AFUCONF_AR_DATA| \ 4038c2ecf20Sopenharmony_ci SISL_AFUCONF_AR_RSRC|SISL_AFUCONF_AR_IOASA| \ 4048c2ecf20Sopenharmony_ci SISL_AFUCONF_AR_RRQ) 4058c2ecf20Sopenharmony_ci#ifdef __BIG_ENDIAN 4068c2ecf20Sopenharmony_ci#define SISL_AFUCONF_ENDIAN 0x0000ULL 4078c2ecf20Sopenharmony_ci#else 4088c2ecf20Sopenharmony_ci#define SISL_AFUCONF_ENDIAN 0x0020ULL 4098c2ecf20Sopenharmony_ci#endif 4108c2ecf20Sopenharmony_ci#define SISL_AFUCONF_MBOX_CLR_READ 0x0010ULL 4118c2ecf20Sopenharmony_ci __be64 afu_config; 4128c2ecf20Sopenharmony_ci __be64 rsvd[0xf8]; 4138c2ecf20Sopenharmony_ci __le64 afu_version; 4148c2ecf20Sopenharmony_ci __be64 interface_version; 4158c2ecf20Sopenharmony_ci#define SISL_INTVER_CAP_SHIFT 16 4168c2ecf20Sopenharmony_ci#define SISL_INTVER_MAJ_SHIFT 8 4178c2ecf20Sopenharmony_ci#define SISL_INTVER_CAP_MASK 0xFFFFFFFF00000000ULL 4188c2ecf20Sopenharmony_ci#define SISL_INTVER_MAJ_MASK 0x00000000FFFF0000ULL 4198c2ecf20Sopenharmony_ci#define SISL_INTVER_MIN_MASK 0x000000000000FFFFULL 4208c2ecf20Sopenharmony_ci#define SISL_INTVER_CAP_IOARRIN_CMD_MODE 0x800000000000ULL 4218c2ecf20Sopenharmony_ci#define SISL_INTVER_CAP_SQ_CMD_MODE 0x400000000000ULL 4228c2ecf20Sopenharmony_ci#define SISL_INTVER_CAP_RESERVED_CMD_MODE_A 0x200000000000ULL 4238c2ecf20Sopenharmony_ci#define SISL_INTVER_CAP_RESERVED_CMD_MODE_B 0x100000000000ULL 4248c2ecf20Sopenharmony_ci#define SISL_INTVER_CAP_LUN_PROVISION 0x080000000000ULL 4258c2ecf20Sopenharmony_ci#define SISL_INTVER_CAP_AFU_DEBUG 0x040000000000ULL 4268c2ecf20Sopenharmony_ci#define SISL_INTVER_CAP_OCXL_LISN 0x020000000000ULL 4278c2ecf20Sopenharmony_ci}; 4288c2ecf20Sopenharmony_ci 4298c2ecf20Sopenharmony_ci#define CXLFLASH_NUM_FC_PORTS_PER_BANK 2 /* fixed # of ports per bank */ 4308c2ecf20Sopenharmony_ci#define CXLFLASH_MAX_FC_BANKS 2 /* max # of banks supported */ 4318c2ecf20Sopenharmony_ci#define CXLFLASH_MAX_FC_PORTS (CXLFLASH_NUM_FC_PORTS_PER_BANK * \ 4328c2ecf20Sopenharmony_ci CXLFLASH_MAX_FC_BANKS) 4338c2ecf20Sopenharmony_ci#define CXLFLASH_MAX_CONTEXT 512 /* number of contexts per AFU */ 4348c2ecf20Sopenharmony_ci#define CXLFLASH_NUM_VLUNS 512 /* number of vluns per AFU/port */ 4358c2ecf20Sopenharmony_ci#define CXLFLASH_NUM_REGS 512 /* number of registers per port */ 4368c2ecf20Sopenharmony_ci 4378c2ecf20Sopenharmony_cistruct fc_port_bank { 4388c2ecf20Sopenharmony_ci __be64 fc_port_regs[CXLFLASH_NUM_FC_PORTS_PER_BANK][CXLFLASH_NUM_REGS]; 4398c2ecf20Sopenharmony_ci __be64 fc_port_luns[CXLFLASH_NUM_FC_PORTS_PER_BANK][CXLFLASH_NUM_VLUNS]; 4408c2ecf20Sopenharmony_ci}; 4418c2ecf20Sopenharmony_ci 4428c2ecf20Sopenharmony_cistruct sisl_global_map { 4438c2ecf20Sopenharmony_ci union { 4448c2ecf20Sopenharmony_ci struct sisl_global_regs regs; 4458c2ecf20Sopenharmony_ci char page0[SIZE_4K]; /* page 0 */ 4468c2ecf20Sopenharmony_ci }; 4478c2ecf20Sopenharmony_ci 4488c2ecf20Sopenharmony_ci char page1[SIZE_4K]; /* page 1 */ 4498c2ecf20Sopenharmony_ci 4508c2ecf20Sopenharmony_ci struct fc_port_bank bank[CXLFLASH_MAX_FC_BANKS]; /* pages 2 - 9 */ 4518c2ecf20Sopenharmony_ci 4528c2ecf20Sopenharmony_ci /* pages 10 - 15 are reserved */ 4538c2ecf20Sopenharmony_ci 4548c2ecf20Sopenharmony_ci}; 4558c2ecf20Sopenharmony_ci 4568c2ecf20Sopenharmony_ci/* 4578c2ecf20Sopenharmony_ci * CXL Flash Memory Map 4588c2ecf20Sopenharmony_ci * 4598c2ecf20Sopenharmony_ci * +-------------------------------+ 4608c2ecf20Sopenharmony_ci * | 512 * 64 KB User MMIO | 4618c2ecf20Sopenharmony_ci * | (per context) | 4628c2ecf20Sopenharmony_ci * | User Accessible | 4638c2ecf20Sopenharmony_ci * +-------------------------------+ 4648c2ecf20Sopenharmony_ci * | 512 * 128 B per context | 4658c2ecf20Sopenharmony_ci * | Provisioning and Control | 4668c2ecf20Sopenharmony_ci * | Trusted Process accessible | 4678c2ecf20Sopenharmony_ci * +-------------------------------+ 4688c2ecf20Sopenharmony_ci * | 64 KB Global | 4698c2ecf20Sopenharmony_ci * | Trusted Process accessible | 4708c2ecf20Sopenharmony_ci * +-------------------------------+ 4718c2ecf20Sopenharmony_ci */ 4728c2ecf20Sopenharmony_cistruct cxlflash_afu_map { 4738c2ecf20Sopenharmony_ci union { 4748c2ecf20Sopenharmony_ci struct sisl_host_map host; 4758c2ecf20Sopenharmony_ci char harea[SIZE_64K]; /* 64KB each */ 4768c2ecf20Sopenharmony_ci } hosts[CXLFLASH_MAX_CONTEXT]; 4778c2ecf20Sopenharmony_ci 4788c2ecf20Sopenharmony_ci union { 4798c2ecf20Sopenharmony_ci struct sisl_ctrl_map ctrl; 4808c2ecf20Sopenharmony_ci char carea[cache_line_size()]; /* 128B each */ 4818c2ecf20Sopenharmony_ci } ctrls[CXLFLASH_MAX_CONTEXT]; 4828c2ecf20Sopenharmony_ci 4838c2ecf20Sopenharmony_ci union { 4848c2ecf20Sopenharmony_ci struct sisl_global_map global; 4858c2ecf20Sopenharmony_ci char garea[SIZE_64K]; /* 64KB single block */ 4868c2ecf20Sopenharmony_ci }; 4878c2ecf20Sopenharmony_ci}; 4888c2ecf20Sopenharmony_ci 4898c2ecf20Sopenharmony_ci/* 4908c2ecf20Sopenharmony_ci * LXT - LBA Translation Table 4918c2ecf20Sopenharmony_ci * LXT control blocks 4928c2ecf20Sopenharmony_ci */ 4938c2ecf20Sopenharmony_cistruct sisl_lxt_entry { 4948c2ecf20Sopenharmony_ci u64 rlba_base; /* bits 0:47 is base 4958c2ecf20Sopenharmony_ci * b48:55 is lun index 4968c2ecf20Sopenharmony_ci * b58:59 is write & read perms 4978c2ecf20Sopenharmony_ci * (if no perm, afu_rc=0x15) 4988c2ecf20Sopenharmony_ci * b60:63 is port_sel mask 4998c2ecf20Sopenharmony_ci */ 5008c2ecf20Sopenharmony_ci}; 5018c2ecf20Sopenharmony_ci 5028c2ecf20Sopenharmony_ci/* 5038c2ecf20Sopenharmony_ci * RHT - Resource Handle Table 5048c2ecf20Sopenharmony_ci * Per the SISlite spec, RHT entries are to be 16-byte aligned 5058c2ecf20Sopenharmony_ci */ 5068c2ecf20Sopenharmony_cistruct sisl_rht_entry { 5078c2ecf20Sopenharmony_ci struct sisl_lxt_entry *lxt_start; 5088c2ecf20Sopenharmony_ci u32 lxt_cnt; 5098c2ecf20Sopenharmony_ci u16 rsvd; 5108c2ecf20Sopenharmony_ci u8 fp; /* format & perm nibbles. 5118c2ecf20Sopenharmony_ci * (if no perm, afu_rc=0x05) 5128c2ecf20Sopenharmony_ci */ 5138c2ecf20Sopenharmony_ci u8 nmask; 5148c2ecf20Sopenharmony_ci} __packed __aligned(16); 5158c2ecf20Sopenharmony_ci 5168c2ecf20Sopenharmony_cistruct sisl_rht_entry_f1 { 5178c2ecf20Sopenharmony_ci u64 lun_id; 5188c2ecf20Sopenharmony_ci union { 5198c2ecf20Sopenharmony_ci struct { 5208c2ecf20Sopenharmony_ci u8 valid; 5218c2ecf20Sopenharmony_ci u8 rsvd[5]; 5228c2ecf20Sopenharmony_ci u8 fp; 5238c2ecf20Sopenharmony_ci u8 port_sel; 5248c2ecf20Sopenharmony_ci }; 5258c2ecf20Sopenharmony_ci 5268c2ecf20Sopenharmony_ci u64 dw; 5278c2ecf20Sopenharmony_ci }; 5288c2ecf20Sopenharmony_ci} __packed __aligned(16); 5298c2ecf20Sopenharmony_ci 5308c2ecf20Sopenharmony_ci/* make the fp byte */ 5318c2ecf20Sopenharmony_ci#define SISL_RHT_FP(fmt, perm) (((fmt) << 4) | (perm)) 5328c2ecf20Sopenharmony_ci 5338c2ecf20Sopenharmony_ci/* make the fp byte for a clone from a source fp and clone flags 5348c2ecf20Sopenharmony_ci * flags must be only 2 LSB bits. 5358c2ecf20Sopenharmony_ci */ 5368c2ecf20Sopenharmony_ci#define SISL_RHT_FP_CLONE(src_fp, cln_flags) ((src_fp) & (0xFC | (cln_flags))) 5378c2ecf20Sopenharmony_ci 5388c2ecf20Sopenharmony_ci#define RHT_PERM_READ 0x01U 5398c2ecf20Sopenharmony_ci#define RHT_PERM_WRITE 0x02U 5408c2ecf20Sopenharmony_ci#define RHT_PERM_RW (RHT_PERM_READ | RHT_PERM_WRITE) 5418c2ecf20Sopenharmony_ci 5428c2ecf20Sopenharmony_ci/* extract the perm bits from a fp */ 5438c2ecf20Sopenharmony_ci#define SISL_RHT_PERM(fp) ((fp) & RHT_PERM_RW) 5448c2ecf20Sopenharmony_ci 5458c2ecf20Sopenharmony_ci#define PORT0 0x01U 5468c2ecf20Sopenharmony_ci#define PORT1 0x02U 5478c2ecf20Sopenharmony_ci#define PORT2 0x04U 5488c2ecf20Sopenharmony_ci#define PORT3 0x08U 5498c2ecf20Sopenharmony_ci#define PORT_MASK(_n) ((1 << (_n)) - 1) 5508c2ecf20Sopenharmony_ci 5518c2ecf20Sopenharmony_ci/* AFU Sync Mode byte */ 5528c2ecf20Sopenharmony_ci#define AFU_LW_SYNC 0x0U 5538c2ecf20Sopenharmony_ci#define AFU_HW_SYNC 0x1U 5548c2ecf20Sopenharmony_ci#define AFU_GSYNC 0x2U 5558c2ecf20Sopenharmony_ci 5568c2ecf20Sopenharmony_ci/* Special Task Management Function CDB */ 5578c2ecf20Sopenharmony_ci#define TMF_LUN_RESET 0x1U 5588c2ecf20Sopenharmony_ci#define TMF_CLEAR_ACA 0x2U 5598c2ecf20Sopenharmony_ci 5608c2ecf20Sopenharmony_ci#endif /* _SISLITE_H */ 561