blob: 77699126bfd09bb8d824b439c03d0afc74594795 [file] [log] [blame]
Julian Halle450ec82022-07-04 14:57:40 +01001/*
2 * Copyright (c) 2022, Arm Limited and Contributors. All rights reserved.
3 * SPDX-License-Identifier: BSD-3-Clause
4 */
5
6#ifndef TS_BLOCK_STORAGE_PACKEDC_MESSAGES_H
7#define TS_BLOCK_STORAGE_PACKEDC_MESSAGES_H
8
9#include <stdint.h>
10
11/**
12 * Protocol definitions for block storage operations
13 * using the packed-c serialization.
14 */
15
16/****************************************
17 * Common defines
18 */
19#define TS_BLOCK_STORAGE_GUID_OCTET_LEN (16)
20
21/****************************************
22 * \brief get_partition_info operation
23 *
24 * Get information about the storage partition identified by the specified
25 * unique partition GUID.
26 */
27
28/* Mandatory fixed sized input parameters */
29struct __attribute__ ((__packed__)) ts_block_storage_get_partition_info_in
30{
31 uint8_t partition_guid[TS_BLOCK_STORAGE_GUID_OCTET_LEN];
32};
33
34/* Mandatory fixed sized output parameters */
35struct __attribute__ ((__packed__)) ts_block_storage_get_partition_info_out
36{
37 uint32_t num_blocks;
38 uint32_t block_size;
39};
40
41/****************************************
42 * \brief open operation
43 *
44 * Open the storage partition identified by the specified unique partition
45 * GUID. A handle is returned that should be used as a qualifier for subsequent
46 * partition-oriented operations.
47 */
48
49/* Mandatory fixed sized input parameters */
50struct __attribute__ ((__packed__)) ts_block_storage_open_in
51{
52 uint8_t partition_guid[TS_BLOCK_STORAGE_GUID_OCTET_LEN];
53};
54
55/* Mandatory fixed sized output parameters */
56struct __attribute__ ((__packed__)) ts_block_storage_open_out
57{
58 uint64_t handle;
59};
60
61/****************************************
62 * \brief close operation
63 *
64 * Close a previously opened storage partition. Used when access to the storage
65 * partition is no longer required.
66 */
67
68/* Mandatory fixed sized input parameters */
69struct __attribute__ ((__packed__)) ts_block_storage_close_in
70{
71 uint64_t handle;
72};
73
74/****************************************
75 * \brief read operation
76 *
77 * Read data from the block identified by the specified LBA.
78 */
79
80/* Mandatory fixed sized input parameters */
81struct __attribute__ ((__packed__)) ts_block_storage_read_in
82{
83 uint64_t handle;
84 uint32_t lba;
85 uint32_t offset;
86 uint32_t len;
87};
88
89/* Read data returned in response */
90
91/****************************************
92 * \brief write operation
93 *
94 * Write data to the block identified by the specified LBA.
95 */
96
97/* Mandatory fixed sized input parameters */
98struct __attribute__ ((__packed__)) ts_block_storage_write_in
99{
100 uint64_t handle;
101 uint32_t lba;
102 uint32_t offset;
103};
104
105/* Write data follows fixed size input message */
106
107/* Mandatory fixed sized output parameters */
108struct __attribute__ ((__packed__)) ts_block_storage_write_out
109{
110 uint64_t num_written;
111};
112
113/****************************************
114 * \brief erase operation
115 *
116 * Erase the set of blocks identified by the specified set of LBAs.
117 */
118
119/* Mandatory fixed sized input parameters */
120struct __attribute__ ((__packed__)) ts_block_storage_erase_in
121{
122 uint64_t handle;
123 uint32_t begin_lba;
124 uint32_t num_blocks;
125};
126
127#endif /* TS_BLOCK_STORAGE_PACKEDC_MESSAGES_H */