History

Merge patch series "UFS Advanced RPMB"

Bean Huo <beanhuo@iokpp.de> says: This series of changes is to add support for UFS advanced RPMB in ufs_bsg. The advanced RPMB application of user space is ufs_utils, the reference code is at: https://github.com/beanhuo/ufs-utils-Micron/blob/ufs_arpmb/ufs_arpmb.c. Changes to ufs_utils will be pushed to: https://github.com/westerndigitalcorporation/ufs-utils

Martin K. Petersen committed 3 years ago

Commit c1635fb2 parents 1e49a53 6ff265f6 files · +318 −81Browse files

Showing the changes to include/uapi (1 of 6 files). Show all

Unified · Split

include/uapi/scsi/scsi_bsg_ufs.h+46−2
@@ -14,10 +14,27 @@ · 13 unmodified lines
1414 */
1515
1616 #define UFS_CDB_SIZE 16
17−#define UPIU_TRANSACTION_UIC_CMD 0x1F
1817 /* uic commands are 4DW long, per UFSHCI V2.1 paragraph 5.6.1 */
1918 #define UIC_CMD_SIZE (sizeof(__u32) * 4)
2019
20+enum ufs_bsg_msg_code {
21+ UPIU_TRANSACTION_UIC_CMD = 0x1F,
22+ UPIU_TRANSACTION_ARPMB_CMD,
23+};
24+
25+/* UFS RPMB Request Message Types */
26+enum ufs_rpmb_op_type {
27+ UFS_RPMB_WRITE_KEY = 0x01,
28+ UFS_RPMB_READ_CNT = 0x02,
29+ UFS_RPMB_WRITE = 0x03,
30+ UFS_RPMB_READ = 0x04,
31+ UFS_RPMB_READ_RESP = 0x05,
32+ UFS_RPMB_SEC_CONF_WRITE = 0x06,
33+ UFS_RPMB_SEC_CONF_READ = 0x07,
34+ UFS_RPMB_PURGE_ENABLE = 0x08,
35+ UFS_RPMB_PURGE_STATUS_READ = 0x09,
36+};
37+
2138 /**
2239 * struct utp_upiu_header - UPIU header structure
2340 * @dword_0: UPIU header DW-0
@@ -79,6 +96,23 @@ struct utp_upiu_req { · 55 unmodified lines
7996 };
8097 };
8198
99+struct ufs_arpmb_meta {
100+ __u16 req_resp_type;
101+ __u8 nonce[16];
102+ __u32 write_counter;
103+ __u16 addr_lun;
104+ __u16 block_count;
105+ __u16 result;
106+} __attribute__((__packed__));
107+
108+struct ufs_ehs {
109+ __u8 length;
110+ __u8 ehs_type;
111+ __u16 ehssub_type;
112+ struct ufs_arpmb_meta meta;
113+ __u8 mac_key[32];
114+} __attribute__((__packed__));
115+
82116 /* request (CDB) structure of the sg_io_v4 */
83117 struct ufs_bsg_request {
84118 __u32 msgcode;
@@ -95,11 +129,21 @@ struct ufs_bsg_reply { · 10 unmodified lines
95129 * msg and status fields. The per-msgcode reply structure
96130 * will contain valid data.
97131 */
98− __u32 result;
132+ int result;
99133
100134 /* If there was reply_payload, how much was received? */
101135 __u32 reply_payload_rcv_len;
102136
103137 struct utp_upiu_req upiu_rsp;
104138 };
139+
140+struct ufs_rpmb_request {
141+ struct ufs_bsg_request bsg_request;
142+ struct ufs_ehs ehs_req;
143+};
144+
145+struct ufs_rpmb_reply {
146+ struct ufs_bsg_reply bsg_reply;
147+ struct ufs_ehs ehs_rsp;
148+};
105149 #endif /* UFS_BSG_H */

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t