blob: 215588904675b169a90d87388e67901d9d7e81fa [file] [log] [blame]
Julian Halle450ec82022-07-04 14:57:40 +01001/*
Julian Hallbcd755e2023-03-21 17:10:48 +00002 * Copyright (c) 2022-2023, Arm Limited and Contributors. All rights reserved.
Julian Halle450ec82022-07-04 14:57:40 +01003 * 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{
Julian Hall71787fc2022-11-18 10:27:00 +000031 uint8_t partition_guid[TS_BLOCK_STORAGE_GUID_OCTET_LEN];
Julian Halle450ec82022-07-04 14:57:40 +010032};
33
34/* Mandatory fixed sized output parameters */
35struct __attribute__ ((__packed__)) ts_block_storage_get_partition_info_out
36{
Julian Hallbcd755e2023-03-21 17:10:48 +000037 uint64_t num_blocks;
Julian Hall71787fc2022-11-18 10:27:00 +000038 uint32_t block_size;
39 uint8_t partition_guid[TS_BLOCK_STORAGE_GUID_OCTET_LEN];
40 uint8_t parent_guid[TS_BLOCK_STORAGE_GUID_OCTET_LEN];
Julian Halle450ec82022-07-04 14:57:40 +010041};
42
43/****************************************
44 * \brief open operation
45 *
46 * Open the storage partition identified by the specified unique partition
47 * GUID. A handle is returned that should be used as a qualifier for subsequent
48 * partition-oriented operations.
49 */
50
51/* Mandatory fixed sized input parameters */
52struct __attribute__ ((__packed__)) ts_block_storage_open_in
53{
Julian Hall71787fc2022-11-18 10:27:00 +000054 uint8_t partition_guid[TS_BLOCK_STORAGE_GUID_OCTET_LEN];
Julian Halle450ec82022-07-04 14:57:40 +010055};
56
57/* Mandatory fixed sized output parameters */
58struct __attribute__ ((__packed__)) ts_block_storage_open_out
59{
Julian Hall71787fc2022-11-18 10:27:00 +000060 uint64_t handle;
Julian Halle450ec82022-07-04 14:57:40 +010061};
62
63/****************************************
64 * \brief close operation
65 *
66 * Close a previously opened storage partition. Used when access to the storage
67 * partition is no longer required.
68 */
69
70/* Mandatory fixed sized input parameters */
71struct __attribute__ ((__packed__)) ts_block_storage_close_in
72{
Julian Hall71787fc2022-11-18 10:27:00 +000073 uint64_t handle;
Julian Halle450ec82022-07-04 14:57:40 +010074};
75
76/****************************************
77 * \brief read operation
78 *
79 * Read data from the block identified by the specified LBA.
80 */
81
82/* Mandatory fixed sized input parameters */
83struct __attribute__ ((__packed__)) ts_block_storage_read_in
84{
Julian Hall71787fc2022-11-18 10:27:00 +000085 uint64_t handle;
Julian Hallbcd755e2023-03-21 17:10:48 +000086 uint64_t lba;
Julian Hall71787fc2022-11-18 10:27:00 +000087 uint32_t offset;
88 uint32_t len;
Julian Halle450ec82022-07-04 14:57:40 +010089};
90
91/* Read data returned in response */
92
93/****************************************
94 * \brief write operation
95 *
96 * Write data to the block identified by the specified LBA.
97 */
98
99/* Mandatory fixed sized input parameters */
100struct __attribute__ ((__packed__)) ts_block_storage_write_in
101{
Julian Hall71787fc2022-11-18 10:27:00 +0000102 uint64_t handle;
Julian Hallbcd755e2023-03-21 17:10:48 +0000103 uint64_t lba;
Julian Hall71787fc2022-11-18 10:27:00 +0000104 uint32_t offset;
Julian Halle450ec82022-07-04 14:57:40 +0100105};
106
107/* Write data follows fixed size input message */
108
109/* Mandatory fixed sized output parameters */
110struct __attribute__ ((__packed__)) ts_block_storage_write_out
111{
Julian Hall71787fc2022-11-18 10:27:00 +0000112 uint64_t num_written;
Julian Halle450ec82022-07-04 14:57:40 +0100113};
114
115/****************************************
116 * \brief erase operation
117 *
118 * Erase the set of blocks identified by the specified set of LBAs.
119 */
120
121/* Mandatory fixed sized input parameters */
122struct __attribute__ ((__packed__)) ts_block_storage_erase_in
123{
Julian Hall71787fc2022-11-18 10:27:00 +0000124 uint64_t handle;
Julian Hallbcd755e2023-03-21 17:10:48 +0000125 uint64_t begin_lba;
Julian Hall71787fc2022-11-18 10:27:00 +0000126 uint32_t num_blocks;
Julian Halle450ec82022-07-04 14:57:40 +0100127};
128
129#endif /* TS_BLOCK_STORAGE_PACKEDC_MESSAGES_H */