blob: 036243e6c99a16c5dd5a904d5ced05d57cf19481 [file] [log] [blame]
Christopher Ferris86a48372019-01-10 14:14:59 -08001/****************************************************************************
2 ****************************************************************************
3 ***
4 *** This header was automatically generated from a Linux kernel header
5 *** of the same name, to make information necessary for userspace to
6 *** call into the kernel available to libc. It contains only constants,
7 *** structures, and macros generated from the original header, and thus,
8 *** contains no copyrightable information.
9 ***
10 *** To edit the content of this header, modify the corresponding
11 *** source file (e.g. under external/kernel-headers/original/) then
12 *** run bionic/libc/kernel/tools/update_all.py
13 ***
14 *** Any manual change here will be lost the next time this script will
15 *** be run. You've been warned!
16 ***
17 ****************************************************************************
18 ****************************************************************************/
19#ifndef SCSI_BSG_UFS_H
20#define SCSI_BSG_UFS_H
21#include <linux/types.h>
22#define UFS_CDB_SIZE 16
Christopher Ferris86a48372019-01-10 14:14:59 -080023#define UIC_CMD_SIZE (sizeof(__u32) * 4)
Christopher Ferrisb7cef6d2023-05-09 19:04:15 +000024enum ufs_bsg_msg_code {
25 UPIU_TRANSACTION_UIC_CMD = 0x1F,
26 UPIU_TRANSACTION_ARPMB_CMD,
27};
28enum ufs_rpmb_op_type {
29 UFS_RPMB_WRITE_KEY = 0x01,
30 UFS_RPMB_READ_CNT = 0x02,
31 UFS_RPMB_WRITE = 0x03,
32 UFS_RPMB_READ = 0x04,
33 UFS_RPMB_READ_RESP = 0x05,
34 UFS_RPMB_SEC_CONF_WRITE = 0x06,
35 UFS_RPMB_SEC_CONF_READ = 0x07,
36 UFS_RPMB_PURGE_ENABLE = 0x08,
37 UFS_RPMB_PURGE_STATUS_READ = 0x09,
38};
Christopher Ferris86a48372019-01-10 14:14:59 -080039struct utp_upiu_header {
40 __be32 dword_0;
41 __be32 dword_1;
42 __be32 dword_2;
43};
44struct utp_upiu_query {
45 __u8 opcode;
46 __u8 idn;
47 __u8 index;
48 __u8 selector;
49 __be16 reserved_osf;
50 __be16 length;
51 __be32 value;
52 __be32 reserved[2];
53};
54struct utp_upiu_cmd {
55 __be32 exp_data_transfer_len;
56 __u8 cdb[UFS_CDB_SIZE];
57};
58struct utp_upiu_req {
59 struct utp_upiu_header header;
60 union {
61 struct utp_upiu_cmd sc;
62 struct utp_upiu_query qr;
Christopher Ferris86a48372019-01-10 14:14:59 -080063 struct utp_upiu_query uc;
64 };
65};
Christopher Ferrisb7cef6d2023-05-09 19:04:15 +000066struct ufs_arpmb_meta {
67 __be16 req_resp_type;
68 __u8 nonce[16];
69 __be32 write_counter;
70 __be16 addr_lun;
71 __be16 block_count;
72 __be16 result;
73} __attribute__((__packed__));
74struct ufs_ehs {
75 __u8 length;
76 __u8 ehs_type;
77 __be16 ehssub_type;
78 struct ufs_arpmb_meta meta;
79 __u8 mac_key[32];
80} __attribute__((__packed__));
Christopher Ferris86a48372019-01-10 14:14:59 -080081struct ufs_bsg_request {
82 __u32 msgcode;
83 struct utp_upiu_req upiu_req;
84};
85struct ufs_bsg_reply {
Christopher Ferrisb7cef6d2023-05-09 19:04:15 +000086 int result;
Christopher Ferris86a48372019-01-10 14:14:59 -080087 __u32 reply_payload_rcv_len;
88 struct utp_upiu_req upiu_rsp;
89};
Christopher Ferrisb7cef6d2023-05-09 19:04:15 +000090struct ufs_rpmb_request {
91 struct ufs_bsg_request bsg_request;
92 struct ufs_ehs ehs_req;
93};
94struct ufs_rpmb_reply {
95 struct ufs_bsg_reply bsg_reply;
96 struct ufs_ehs ehs_rsp;
97};
Christopher Ferris86a48372019-01-10 14:14:59 -080098#endif