blob: b820c0757955dbce90cc206f3643577c9013235c [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};
Christopher Ferris8666d042023-09-06 14:55:31 -070054struct utp_upiu_query_v4_0 {
55 __u8 opcode;
56 __u8 idn;
57 __u8 index;
58 __u8 selector;
59 __u8 osf3;
60 __u8 osf4;
61 __be16 osf5;
62 __be32 osf6;
63 __be32 osf7;
64 __be32 reserved;
65};
Christopher Ferris86a48372019-01-10 14:14:59 -080066struct utp_upiu_cmd {
67 __be32 exp_data_transfer_len;
68 __u8 cdb[UFS_CDB_SIZE];
69};
70struct utp_upiu_req {
71 struct utp_upiu_header header;
72 union {
73 struct utp_upiu_cmd sc;
74 struct utp_upiu_query qr;
Christopher Ferris86a48372019-01-10 14:14:59 -080075 struct utp_upiu_query uc;
76 };
77};
Christopher Ferrisb7cef6d2023-05-09 19:04:15 +000078struct ufs_arpmb_meta {
79 __be16 req_resp_type;
80 __u8 nonce[16];
81 __be32 write_counter;
82 __be16 addr_lun;
83 __be16 block_count;
84 __be16 result;
85} __attribute__((__packed__));
86struct ufs_ehs {
87 __u8 length;
88 __u8 ehs_type;
89 __be16 ehssub_type;
90 struct ufs_arpmb_meta meta;
91 __u8 mac_key[32];
92} __attribute__((__packed__));
Christopher Ferris86a48372019-01-10 14:14:59 -080093struct ufs_bsg_request {
94 __u32 msgcode;
95 struct utp_upiu_req upiu_req;
96};
97struct ufs_bsg_reply {
Christopher Ferrisb7cef6d2023-05-09 19:04:15 +000098 int result;
Christopher Ferris86a48372019-01-10 14:14:59 -080099 __u32 reply_payload_rcv_len;
100 struct utp_upiu_req upiu_rsp;
101};
Christopher Ferrisb7cef6d2023-05-09 19:04:15 +0000102struct ufs_rpmb_request {
103 struct ufs_bsg_request bsg_request;
104 struct ufs_ehs ehs_req;
105};
106struct ufs_rpmb_reply {
107 struct ufs_bsg_reply bsg_reply;
108 struct ufs_ehs ehs_rsp;
109};
Christopher Ferris86a48372019-01-10 14:14:59 -0800110#endif