hw/ufs: Support for Query Transfer Requests
This commit makes the UFS device support query and nop out transfer requests. The next patch would be support for UFS logical unit and scsi command transfer request. Signed-off-by: Jeuk Kim <jeuk20.kim@samsung.com> Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> Message-id: ff7a5f0fd26761936a553ffb89d3df0ba62844e9.1693980783.git.jeuk20.kim@gmail.com Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
This commit is contained in:
parent
bc4e68d362
commit
329f166244
@ -18,6 +18,7 @@ ufs_err_dma_read_req_upiu(uint32_t slot, uint64_t addr) "failed to read req upiu
|
||||
ufs_err_dma_read_prdt(uint32_t slot, uint64_t addr) "failed to read prdt. UTRLDBR slot %"PRIu32", prdt addr %"PRIu64""
|
||||
ufs_err_dma_write_utrd(uint32_t slot, uint64_t addr) "failed to write utrd. UTRLDBR slot %"PRIu32", UTRD dma addr %"PRIu64""
|
||||
ufs_err_dma_write_rsp_upiu(uint32_t slot, uint64_t addr) "failed to write rsp upiu. UTRLDBR slot %"PRIu32", response upiu addr %"PRIu64""
|
||||
ufs_err_utrl_slot_error(uint32_t slot) "UTRLDBR slot %"PRIu32" is in error"
|
||||
ufs_err_utrl_slot_busy(uint32_t slot) "UTRLDBR slot %"PRIu32" is busy"
|
||||
ufs_err_unsupport_register_offset(uint32_t offset) "Register offset 0x%"PRIx32" is not yet supported"
|
||||
ufs_err_invalid_register_offset(uint32_t offset) "Register offset 0x%"PRIx32" is invalid"
|
||||
|
988
hw/ufs/ufs.c
988
hw/ufs/ufs.c
File diff suppressed because it is too large
Load Diff
46
hw/ufs/ufs.h
46
hw/ufs/ufs.h
@ -18,6 +18,32 @@
|
||||
#define UFS_MAX_LUS 32
|
||||
#define UFS_BLOCK_SIZE 4096
|
||||
|
||||
typedef enum UfsRequestState {
|
||||
UFS_REQUEST_IDLE = 0,
|
||||
UFS_REQUEST_READY = 1,
|
||||
UFS_REQUEST_RUNNING = 2,
|
||||
UFS_REQUEST_COMPLETE = 3,
|
||||
UFS_REQUEST_ERROR = 4,
|
||||
} UfsRequestState;
|
||||
|
||||
typedef enum UfsReqResult {
|
||||
UFS_REQUEST_SUCCESS = 0,
|
||||
UFS_REQUEST_FAIL = 1,
|
||||
} UfsReqResult;
|
||||
|
||||
typedef struct UfsRequest {
|
||||
struct UfsHc *hc;
|
||||
UfsRequestState state;
|
||||
int slot;
|
||||
|
||||
UtpTransferReqDesc utrd;
|
||||
UtpUpiuReq req_upiu;
|
||||
UtpUpiuRsp rsp_upiu;
|
||||
|
||||
/* for scsi command */
|
||||
QEMUSGList *sg;
|
||||
} UfsRequest;
|
||||
|
||||
typedef struct UfsParams {
|
||||
char *serial;
|
||||
uint8_t nutrs; /* Number of UTP Transfer Request Slots */
|
||||
@ -30,6 +56,12 @@ typedef struct UfsHc {
|
||||
UfsReg reg;
|
||||
UfsParams params;
|
||||
uint32_t reg_size;
|
||||
UfsRequest *req_list;
|
||||
|
||||
DeviceDescriptor device_desc;
|
||||
GeometryDescriptor geometry_desc;
|
||||
Attributes attributes;
|
||||
Flags flags;
|
||||
|
||||
qemu_irq irq;
|
||||
QEMUBH *doorbell_bh;
|
||||
@ -39,4 +71,18 @@ typedef struct UfsHc {
|
||||
#define TYPE_UFS "ufs"
|
||||
#define UFS(obj) OBJECT_CHECK(UfsHc, (obj), TYPE_UFS)
|
||||
|
||||
typedef enum UfsQueryFlagPerm {
|
||||
UFS_QUERY_FLAG_NONE = 0x0,
|
||||
UFS_QUERY_FLAG_READ = 0x1,
|
||||
UFS_QUERY_FLAG_SET = 0x2,
|
||||
UFS_QUERY_FLAG_CLEAR = 0x4,
|
||||
UFS_QUERY_FLAG_TOGGLE = 0x8,
|
||||
} UfsQueryFlagPerm;
|
||||
|
||||
typedef enum UfsQueryAttrPerm {
|
||||
UFS_QUERY_ATTR_NONE = 0x0,
|
||||
UFS_QUERY_ATTR_READ = 0x1,
|
||||
UFS_QUERY_ATTR_WRITE = 0x2,
|
||||
} UfsQueryAttrPerm;
|
||||
|
||||
#endif /* HW_UFS_UFS_H */
|
||||
|
Loading…
Reference in New Issue
Block a user