Use 64-bit LBAs
Logical block addresses for UEFI disks are required to be 64-bit
to cope with large storage devices. Block storage components were
using 32-bit LBAs. This commit aligns block storage with UEFI.
Signed-off-by: Julian Hall <julian.hall@arm.com>
Change-Id: I9489d3df14f908a0642099d874a9fd73a66e5db6
diff --git a/components/media/volume/block_volume/block_volume.c b/components/media/volume/block_volume/block_volume.c
index 137915c..7482fe5 100644
--- a/components/media/volume/block_volume/block_volume.c
+++ b/components/media/volume/block_volume/block_volume.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2022, Arm Limited and Contributors. All rights reserved.
+ * Copyright (c) 2022-2023, Arm Limited and Contributors. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
@@ -196,7 +196,7 @@
while ((bytes_read < length) && (this_instance->file_pos < this_instance->size)) {
- uint32_t lba = this_instance->file_pos / this_instance->partition_info.block_size;
+ uint64_t lba = this_instance->file_pos / this_instance->partition_info.block_size;
size_t offset = this_instance->file_pos % this_instance->partition_info.block_size;
size_t bytes_remaining_in_block = this_instance->partition_info.block_size - offset;
@@ -243,7 +243,7 @@
while ((bytes_written < length) && (this_instance->file_pos < this_instance->size)) {
- uint32_t lba = this_instance->file_pos / this_instance->partition_info.block_size;
+ uint64_t lba = this_instance->file_pos / this_instance->partition_info.block_size;
size_t offset = this_instance->file_pos % this_instance->partition_info.block_size;
size_t bytes_remaining_in_block = this_instance->partition_info.block_size - offset;
diff --git a/components/service/block_storage/block_store/block_store.c b/components/service/block_storage/block_store/block_store.c
index b127ea8..78be43d 100644
--- a/components/service/block_storage/block_store/block_store.c
+++ b/components/service/block_storage/block_store/block_store.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2022, Arm Limited. All rights reserved.
+ * Copyright (c) 2022-2023, Arm Limited. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*
@@ -49,7 +49,7 @@
psa_status_t block_store_read(struct block_store *block_store,
uint32_t client_id,
storage_partition_handle_t handle,
- uint32_t lba,
+ uint64_t lba,
size_t offset,
size_t buffer_size,
uint8_t *buffer,
@@ -71,7 +71,7 @@
psa_status_t block_store_write(struct block_store *block_store,
uint32_t client_id,
storage_partition_handle_t handle,
- uint32_t lba,
+ uint64_t lba,
size_t offset,
const uint8_t *data,
size_t data_len,
@@ -93,7 +93,7 @@
psa_status_t block_store_erase(struct block_store *block_store,
uint32_t client_id,
storage_partition_handle_t handle,
- uint32_t begin_lba,
+ uint64_t begin_lba,
size_t num_blocks)
{
assert(block_store);
diff --git a/components/service/block_storage/block_store/block_store.h b/components/service/block_storage/block_store/block_store.h
index e2575d7..e849729 100644
--- a/components/service/block_storage/block_store/block_store.h
+++ b/components/service/block_storage/block_store/block_store.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2022, Arm Limited. All rights reserved.
+ * Copyright (c) 2022-2023, Arm Limited. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*
@@ -131,7 +131,7 @@
psa_status_t (*read)(void *context,
uint32_t client_id,
storage_partition_handle_t handle,
- uint32_t lba,
+ uint64_t lba,
size_t offset,
size_t buffer_size,
uint8_t *buffer,
@@ -157,7 +157,7 @@
psa_status_t (*write)(void *context,
uint32_t client_id,
storage_partition_handle_t handle,
- uint32_t lba,
+ uint64_t lba,
size_t offset,
const uint8_t *data,
size_t data_len,
@@ -186,7 +186,7 @@
psa_status_t (*erase)(void *context,
uint32_t client_id,
storage_partition_handle_t handle,
- uint32_t begin_lba,
+ uint64_t begin_lba,
size_t num_blocks);
};
@@ -234,7 +234,7 @@
psa_status_t block_store_read(struct block_store *block_store,
uint32_t client_id,
storage_partition_handle_t handle,
- uint32_t lba,
+ uint64_t lba,
size_t offset,
size_t buffer_size,
uint8_t *buffer,
@@ -243,7 +243,7 @@
psa_status_t block_store_write(struct block_store *block_store,
uint32_t client_id,
storage_partition_handle_t handle,
- uint32_t lba,
+ uint64_t lba,
size_t offset,
const uint8_t *data,
size_t data_len,
@@ -252,7 +252,7 @@
psa_status_t block_store_erase(struct block_store *block_store,
uint32_t client_id,
storage_partition_handle_t handle,
- uint32_t begin_lba,
+ uint64_t begin_lba,
size_t num_blocks);
#ifdef __cplusplus
diff --git a/components/service/block_storage/block_store/client/block_storage_client.c b/components/service/block_storage/block_store/client/block_storage_client.c
index 5a7b491..de73fbc 100644
--- a/components/service/block_storage/block_store/client/block_storage_client.c
+++ b/components/service/block_storage/block_store/client/block_storage_client.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2022, Arm Limited. All rights reserved.
+ * Copyright (c) 2022-2023, Arm Limited. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*
@@ -186,7 +186,7 @@
static psa_status_t block_storage_client_read(void *context,
uint32_t client_id,
storage_partition_handle_t handle,
- uint32_t lba,
+ uint64_t lba,
size_t offset,
size_t buffer_size,
uint8_t *buffer,
@@ -252,7 +252,7 @@
static psa_status_t block_storage_client_write(void *context,
uint32_t client_id,
storage_partition_handle_t handle,
- uint32_t lba,
+ uint64_t lba,
size_t offset,
const uint8_t *data,
size_t data_len,
@@ -321,7 +321,7 @@
static psa_status_t block_storage_client_erase(void *context,
uint32_t client_id,
storage_partition_handle_t handle,
- uint32_t begin_lba,
+ uint64_t begin_lba,
size_t num_blocks)
{
struct block_storage_client *this_context = (struct block_storage_client *)context;
@@ -334,7 +334,7 @@
req_msg.handle = handle;
req_msg.begin_lba = begin_lba;
- req_msg.num_blocks = (uint32_t)num_blocks;
+ req_msg.num_blocks = num_blocks;
rpc_call_handle call_handle =
rpc_caller_begin(this_context->client.caller, &req_buf, req_len);
diff --git a/components/service/block_storage/block_store/device/file/file_block_store.c b/components/service/block_storage/block_store/device/file/file_block_store.c
index 7d11304..e834329 100644
--- a/components/service/block_storage/block_store/device/file/file_block_store.c
+++ b/components/service/block_storage/block_store/device/file/file_block_store.c
@@ -162,7 +162,7 @@
}
static psa_status_t file_block_store_read(void *context, uint32_t client_id,
- storage_partition_handle_t handle, uint32_t lba,
+ storage_partition_handle_t handle, uint64_t lba,
size_t offset, size_t buffer_size, uint8_t *buffer,
size_t *data_len)
{
@@ -199,7 +199,7 @@
}
static psa_status_t file_block_store_write(void *context, uint32_t client_id,
- storage_partition_handle_t handle, uint32_t lba,
+ storage_partition_handle_t handle, uint64_t lba,
size_t offset, const uint8_t *data, size_t data_len,
size_t *num_written)
{
@@ -237,7 +237,7 @@
}
static psa_status_t file_block_store_erase(void *context, uint32_t client_id,
- storage_partition_handle_t handle, uint32_t begin_lba,
+ storage_partition_handle_t handle, uint64_t begin_lba,
size_t num_blocks)
{
struct file_block_store *this_instance = (struct file_block_store *)context;
diff --git a/components/service/block_storage/block_store/device/null/null_block_store.c b/components/service/block_storage/block_store/device/null/null_block_store.c
index 3b0ad2e..9b22b4f 100644
--- a/components/service/block_storage/block_store/device/null/null_block_store.c
+++ b/components/service/block_storage/block_store/device/null/null_block_store.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2022, Arm Limited. All rights reserved.
+ * Copyright (c) 2022-2023, Arm Limited. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*
@@ -39,7 +39,7 @@
static psa_status_t null_block_store_read(void *context,
uint32_t client_id,
storage_partition_handle_t handle,
- uint32_t lba,
+ uint64_t lba,
size_t offset,
size_t buffer_size,
uint8_t *buffer,
@@ -78,7 +78,7 @@
static psa_status_t null_block_store_write(void *context,
uint32_t client_id,
storage_partition_handle_t handle,
- uint32_t lba,
+ uint64_t lba,
size_t offset,
const uint8_t *data,
size_t data_len,
@@ -116,7 +116,7 @@
static psa_status_t null_block_store_erase(void *context,
uint32_t client_id,
storage_partition_handle_t handle,
- uint32_t begin_lba,
+ uint64_t begin_lba,
size_t num_blocks)
{
struct null_block_store *null_block_store = (struct null_block_store*)context;
diff --git a/components/service/block_storage/block_store/device/ram/ram_block_store.c b/components/service/block_storage/block_store/device/ram/ram_block_store.c
index 4dd0a2d..7c234ff 100644
--- a/components/service/block_storage/block_store/device/ram/ram_block_store.c
+++ b/components/service/block_storage/block_store/device/ram/ram_block_store.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2022, Arm Limited. All rights reserved.
+ * Copyright (c) 2022-2023, Arm Limited. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*
@@ -15,7 +15,7 @@
#define RAM_BLOCK_STORE_ERASED_VALUE (0xff)
static bool is_block_erased(const struct ram_block_store *ram_block_store,
- uint32_t lba,
+ uint64_t lba,
size_t offset,
size_t len)
{
@@ -75,7 +75,7 @@
static psa_status_t ram_block_store_read(void *context,
uint32_t client_id,
storage_partition_handle_t handle,
- uint32_t lba,
+ uint64_t lba,
size_t offset,
size_t buffer_size,
uint8_t *buffer,
@@ -116,7 +116,7 @@
static psa_status_t ram_block_store_write(void *context,
uint32_t client_id,
storage_partition_handle_t handle,
- uint32_t lba,
+ uint64_t lba,
size_t offset,
const uint8_t *data,
size_t data_len,
@@ -160,7 +160,7 @@
static psa_status_t ram_block_store_erase(void *context,
uint32_t client_id,
storage_partition_handle_t handle,
- uint32_t begin_lba,
+ uint64_t begin_lba,
size_t num_blocks)
{
struct ram_block_store *ram_block_store = (struct ram_block_store*)context;
diff --git a/components/service/block_storage/block_store/device/ram/test/ram_block_store_tests.cpp b/components/service/block_storage/block_store/device/ram/test/ram_block_store_tests.cpp
index 5e9537f..fa75ad0 100644
--- a/components/service/block_storage/block_store/device/ram/test/ram_block_store_tests.cpp
+++ b/components/service/block_storage/block_store/device/ram/test/ram_block_store_tests.cpp
@@ -70,7 +70,7 @@
uint8_t read_buffer[BLOCK_SIZE];
size_t data_len = 0;
size_t num_written = 0;
- uint32_t lba = 10;
+ uint64_t lba = 10;
psa_status_t status =
block_store_open(m_block_store, CLIENT_ID, &m_partition_guid, &handle);
@@ -119,7 +119,7 @@
uint8_t read_buffer[BLOCK_SIZE];
size_t data_len = 0;
size_t num_written = 0;
- uint32_t lba = 10;
+ uint64_t lba = 10;
psa_status_t status =
block_store_open(m_block_store, CLIENT_ID, &m_partition_guid, &handle);
@@ -150,7 +150,7 @@
storage_partition_handle_t handle;
uint8_t write_buffer[BLOCK_SIZE];
size_t num_written = 0;
- uint32_t lba = NUM_BLOCKS + 7;
+ uint64_t lba = NUM_BLOCKS + 7;
psa_status_t status =
block_store_open(m_block_store, CLIENT_ID, &m_partition_guid, &handle);
diff --git a/components/service/block_storage/block_store/device/semihosting/semihosting_block_store.c b/components/service/block_storage/block_store/device/semihosting/semihosting_block_store.c
index a4554b9..f65f598 100644
--- a/components/service/block_storage/block_store/device/semihosting/semihosting_block_store.c
+++ b/components/service/block_storage/block_store/device/semihosting/semihosting_block_store.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2022, Arm Limited. All rights reserved.
+ * Copyright (c) 2022-2023, Arm Limited. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*
@@ -22,7 +22,7 @@
static psa_status_t prepare_for_read(
const struct semihosting_block_store *this_instance,
- uint32_t lba, size_t offset,
+ uint64_t lba, size_t offset,
size_t requested_read_len,
size_t *adjusted_read_len)
{
@@ -95,7 +95,7 @@
static psa_status_t prepare_for_write(
const struct semihosting_block_store *this_instance,
- uint32_t lba, size_t offset,
+ uint64_t lba, size_t offset,
size_t requested_write_len,
size_t *adjusted_write_len)
{
@@ -170,7 +170,7 @@
static psa_status_t semihosting_block_store_read(void *context,
uint32_t client_id,
storage_partition_handle_t handle,
- uint32_t lba,
+ uint64_t lba,
size_t offset,
size_t buffer_size,
uint8_t *buffer,
@@ -227,7 +227,7 @@
static psa_status_t semihosting_block_store_write(void *context,
uint32_t client_id,
storage_partition_handle_t handle,
- uint32_t lba,
+ uint64_t lba,
size_t offset,
const uint8_t *data,
size_t data_len,
@@ -284,7 +284,7 @@
static psa_status_t semihosting_block_store_erase(void *context,
uint32_t client_id,
storage_partition_handle_t handle,
- uint32_t begin_lba,
+ uint64_t begin_lba,
size_t num_blocks)
{
struct semihosting_block_store *this_instance = (struct semihosting_block_store*)context;
diff --git a/components/service/block_storage/block_store/device/semihosting/test/sh_block_store_tests.c b/components/service/block_storage/block_store/device/semihosting/test/sh_block_store_tests.c
index 3e76a39..11040d8 100644
--- a/components/service/block_storage/block_store/device/semihosting/test/sh_block_store_tests.c
+++ b/components/service/block_storage/block_store/device/semihosting/test/sh_block_store_tests.c
@@ -164,7 +164,7 @@
}
static bool erase_blocks(struct test_failure *failure,
- uint32_t begin_lba,
+ uint64_t begin_lba,
size_t num_blocks)
{
bool success = true;
diff --git a/components/service/block_storage/block_store/partitioned/partitioned_block_store.c b/components/service/block_storage/block_store/partitioned/partitioned_block_store.c
index 6b26465..2b72d2a 100644
--- a/components/service/block_storage/block_store/partitioned/partitioned_block_store.c
+++ b/components/service/block_storage/block_store/partitioned/partitioned_block_store.c
@@ -151,7 +151,7 @@
static psa_status_t partitioned_block_store_read(void *context,
uint32_t client_id,
storage_partition_handle_t handle,
- uint32_t lba,
+ uint64_t lba,
size_t offset,
size_t buffer_size,
uint8_t *buffer,
@@ -200,7 +200,7 @@
static psa_status_t partitioned_block_store_write(void *context,
uint32_t client_id,
storage_partition_handle_t handle,
- uint32_t lba,
+ uint64_t lba,
size_t offset,
const uint8_t *data,
size_t data_len,
@@ -248,7 +248,7 @@
static psa_status_t partitioned_block_store_erase(void *context,
uint32_t client_id,
storage_partition_handle_t handle,
- uint32_t begin_lba,
+ uint64_t begin_lba,
size_t num_blocks)
{
const struct partitioned_block_store *partitioned_block_store =
@@ -367,8 +367,8 @@
bool partitioned_block_store_add_partition(
struct partitioned_block_store *partitioned_block_store,
const struct uuid_octets *partition_guid,
- uint32_t starting_lba,
- uint32_t ending_lba,
+ uint64_t starting_lba,
+ uint64_t ending_lba,
uint64_t attributes,
const char *owner)
{
diff --git a/components/service/block_storage/block_store/partitioned/partitioned_block_store.h b/components/service/block_storage/block_store/partitioned/partitioned_block_store.h
index 35c223c..bcd0b50 100644
--- a/components/service/block_storage/block_store/partitioned/partitioned_block_store.h
+++ b/components/service/block_storage/block_store/partitioned/partitioned_block_store.h
@@ -127,8 +127,8 @@
bool partitioned_block_store_add_partition(
struct partitioned_block_store *partitioned_block_store,
const struct uuid_octets *partition_guid,
- uint32_t starting_lba,
- uint32_t ending_lba,
+ uint64_t starting_lba,
+ uint64_t ending_lba,
uint64_t attributes,
const char *owner);
diff --git a/components/service/block_storage/block_store/partitioned/test/partitioned_block_store_tests.cpp b/components/service/block_storage/block_store/partitioned/test/partitioned_block_store_tests.cpp
index 12541bf..560db29 100644
--- a/components/service/block_storage/block_store/partitioned/test/partitioned_block_store_tests.cpp
+++ b/components/service/block_storage/block_store/partitioned/test/partitioned_block_store_tests.cpp
@@ -144,8 +144,8 @@
uint8_t read_buffer[BACK_STORE_BLOCK_SIZE];
size_t data_len = 0;
size_t num_written = 0;
- uint32_t lba_1 = 10;
- uint32_t lba_2 = 7;
+ uint64_t lba_1 = 10;
+ uint64_t lba_2 = 7;
/* Open sessions associated with both partitions */
psa_status_t status = block_store_open(
@@ -315,8 +315,8 @@
m_block_store, &m_partition_2_guid, &info_2);
LONGS_EQUAL(PSA_SUCCESS, status);
- uint32_t lba_1 = info_1.num_blocks;
- uint32_t lba_2 = info_2.num_blocks + 1000;
+ uint64_t lba_1 = info_1.num_blocks;
+ uint64_t lba_2 = info_2.num_blocks + 1000;
status = block_store_open(
m_block_store, LOCAL_CLIENT_ID, &m_partition_1_guid, &handle_1);
diff --git a/components/service/block_storage/block_store/storage_partition.c b/components/service/block_storage/block_store/storage_partition.c
index b5d7cf6..af98209 100644
--- a/components/service/block_storage/block_store/storage_partition.c
+++ b/components/service/block_storage/block_store/storage_partition.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2022, Arm Limited. All rights reserved.
+ * Copyright (c) 2022-2023, Arm Limited. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*
@@ -69,14 +69,14 @@
bool storage_partition_is_lba_legal(
const struct storage_partition *partition,
- uint32_t lba)
+ uint64_t lba)
{
return lba < partition->num_blocks;
}
size_t storage_partition_clip_length(
const struct storage_partition *partition,
- uint32_t lba,
+ uint64_t lba,
size_t offset,
size_t req_len)
{
@@ -95,7 +95,7 @@
size_t storage_partition_clip_num_blocks(
const struct storage_partition *partition,
- uint32_t lba,
+ uint64_t lba,
size_t num_blocks)
{
size_t clipped_num_blocks = 0;
diff --git a/components/service/block_storage/block_store/storage_partition.h b/components/service/block_storage/block_store/storage_partition.h
index 8123fc1..98bd045 100644
--- a/components/service/block_storage/block_store/storage_partition.h
+++ b/components/service/block_storage/block_store/storage_partition.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2022, Arm Limited. All rights reserved.
+ * Copyright (c) 2022-2023, Arm Limited. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*
@@ -37,7 +37,7 @@
size_t num_blocks;
/* Backend storage block that corresponds to LBA zero */
- uint32_t base_lba;
+ uint64_t base_lba;
/* Access control list for controlling access to configured owner */
struct storage_partition_acl acl;
@@ -136,7 +136,7 @@
*/
bool storage_partition_is_lba_legal(
const struct storage_partition *partition,
- uint32_t lba);
+ uint64_t lba);
/**
* \brief Clip the length if it exceeds the limits of the partition
@@ -149,7 +149,7 @@
*/
size_t storage_partition_clip_length(
const struct storage_partition *partition,
- uint32_t lba,
+ uint64_t lba,
size_t offset,
size_t req_len);
@@ -163,7 +163,7 @@
*/
size_t storage_partition_clip_num_blocks(
const struct storage_partition *partition,
- uint32_t lba,
+ uint64_t lba,
size_t num_blocks);
#ifdef __cplusplus
diff --git a/components/service/block_storage/config/gpt/gpt_partition_configurator.c b/components/service/block_storage/config/gpt/gpt_partition_configurator.c
index d47cb7e..cf8c6af 100644
--- a/components/service/block_storage/config/gpt/gpt_partition_configurator.c
+++ b/components/service/block_storage/config/gpt/gpt_partition_configurator.c
@@ -31,9 +31,9 @@
!(partition_entry->length % back_store_info->block_size)) {
/* Partition entry exists and values look sane */
- uint32_t starting_lba =
+ uint64_t starting_lba =
partition_entry->start / back_store_info->block_size;
- uint32_t ending_lba =
+ uint64_t ending_lba =
starting_lba + (partition_entry->length / back_store_info->block_size) - 1;
if (ending_lba >= starting_lba) {
diff --git a/components/service/block_storage/provider/block_storage_provider.c b/components/service/block_storage/provider/block_storage_provider.c
index 2369051..b0715e6 100644
--- a/components/service/block_storage/provider/block_storage_provider.c
+++ b/components/service/block_storage/provider/block_storage_provider.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2022, Arm Limited and Contributors. All rights reserved.
+ * Copyright (c) 2022-2023, Arm Limited and Contributors. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
@@ -186,7 +186,7 @@
get_block_storage_serializer(this_instance, req);
storage_partition_handle_t handle = 0;
- uint32_t lba = 0;
+ uint64_t lba = 0;
size_t offset = 0;
size_t len = 0;
@@ -227,7 +227,7 @@
get_block_storage_serializer(this_instance, req);
storage_partition_handle_t handle = 0;
- uint32_t lba = 0;
+ uint64_t lba = 0;
size_t offset = 0;
const uint8_t *data = NULL;
size_t data_len = 0;
@@ -272,7 +272,7 @@
get_block_storage_serializer(this_instance, req);
storage_partition_handle_t handle = 0;
- uint32_t begin_lba = 0;
+ uint64_t begin_lba = 0;
size_t num_blocks = 0;
if (serializer)
diff --git a/components/service/block_storage/provider/serializer/block_storage_serializer.h b/components/service/block_storage/provider/serializer/block_storage_serializer.h
index 65bcd1e..493c73c 100644
--- a/components/service/block_storage/provider/serializer/block_storage_serializer.h
+++ b/components/service/block_storage/provider/serializer/block_storage_serializer.h
@@ -42,14 +42,14 @@
/* Operation: read */
rpc_status_t (*deserialize_read_req)(const struct call_param_buf *req_buf,
storage_partition_handle_t *handle,
- uint32_t *lba,
+ uint64_t *lba,
size_t *offset,
size_t *len);
/* Operation: write */
rpc_status_t (*deserialize_write_req)(const struct call_param_buf *req_buf,
storage_partition_handle_t *handle,
- uint32_t *lba,
+ uint64_t *lba,
size_t *offset,
const uint8_t **data,
size_t *data_len);
@@ -60,7 +60,7 @@
/* Operation: erase */
rpc_status_t (*deserialize_erase_req)(const struct call_param_buf *req_buf,
storage_partition_handle_t *handle,
- uint32_t *begin_lba,
+ uint64_t *begin_lba,
size_t *num_blocks);
};
diff --git a/components/service/block_storage/provider/serializer/packed-c/packedc_block_storage_serializer.c b/components/service/block_storage/provider/serializer/packed-c/packedc_block_storage_serializer.c
index 7946a47..5e54039 100644
--- a/components/service/block_storage/provider/serializer/packed-c/packedc_block_storage_serializer.c
+++ b/components/service/block_storage/provider/serializer/packed-c/packedc_block_storage_serializer.c
@@ -113,7 +113,7 @@
/* Operation: read */
rpc_status_t deserialize_read_req(const struct call_param_buf *req_buf,
storage_partition_handle_t *handle,
- uint32_t *lba,
+ uint64_t *lba,
size_t *offset,
size_t *len)
{
@@ -137,7 +137,7 @@
/* Operation: write */
rpc_status_t deserialize_write_req(const struct call_param_buf *req_buf,
storage_partition_handle_t *handle,
- uint32_t *lba,
+ uint64_t *lba,
size_t *offset,
const uint8_t **data,
size_t *data_len)
@@ -185,7 +185,7 @@
/* Operation: erase */
rpc_status_t deserialize_erase_req(const struct call_param_buf *req_buf,
storage_partition_handle_t *handle,
- uint32_t *begin_lba,
+ uint64_t *begin_lba,
size_t *num_blocks)
{
rpc_status_t rpc_status = TS_RPC_ERROR_INVALID_REQ_BODY;
diff --git a/components/service/block_storage/test/service/block_storage_service_tests.cpp b/components/service/block_storage/test/service/block_storage_service_tests.cpp
index 3899a04..fd82ba6 100644
--- a/components/service/block_storage/test/service/block_storage_service_tests.cpp
+++ b/components/service/block_storage/test/service/block_storage_service_tests.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2022, Arm Limited and Contributors. All rights reserved.
+ * Copyright (c) 2022-2023, Arm Limited and Contributors. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
@@ -154,7 +154,7 @@
LONGS_EQUAL(PSA_SUCCESS, status);
/* Write over the entire partition */
- for (uint32_t lba = 0; lba < info.num_blocks; ++lba) {
+ for (uint64_t lba = 0; lba < info.num_blocks; ++lba) {
memset(write_buffer, lba & 0xff, sizeof(write_buffer));
@@ -166,7 +166,7 @@
}
/* Expect to read the same data back */
- for (uint32_t lba = 0; lba < info.num_blocks; ++lba) {
+ for (uint64_t lba = 0; lba < info.num_blocks; ++lba) {
size_t data_len;
@@ -188,7 +188,7 @@
LONGS_EQUAL(PSA_ERROR_STORAGE_FAILURE, status);
/* Erase a set of blocks */
- uint32_t erase_begin_lba = 0;
+ uint64_t erase_begin_lba = 0;
size_t erase_len = 3;
status = block_store_erase(
m_block_store, LOCAL_CLIENT_ID, handle,
@@ -196,7 +196,7 @@
LONGS_EQUAL(PSA_SUCCESS, status);
/* Write over the erased blocks - this should now work */
- for (uint32_t lba = erase_begin_lba; lba < erase_len; ++lba) {
+ for (uint64_t lba = erase_begin_lba; lba < erase_len; ++lba) {
memset(write_buffer, lba & 0xff, sizeof(write_buffer));
diff --git a/components/service/secure_storage/backend/secure_flash_store/flash/block_store_adapter/sfs_flash_block_store_adapter.c b/components/service/secure_storage/backend/secure_flash_store/flash/block_store_adapter/sfs_flash_block_store_adapter.c
index 0ff0c99..e1ce307 100644
--- a/components/service/secure_storage/backend/secure_flash_store/flash/block_store_adapter/sfs_flash_block_store_adapter.c
+++ b/components/service/secure_storage/backend/secure_flash_store/flash/block_store_adapter/sfs_flash_block_store_adapter.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2022, Arm Limited. All rights reserved.
+ * Copyright (c) 2022-2023, Arm Limited. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*
@@ -19,7 +19,7 @@
const struct sfs_flash_block_store_adapter *context,
uint32_t block_id,
size_t offset,
- uint32_t *sub_block_lba,
+ uint64_t *sub_block_lba,
size_t *sub_block_offset)
{
size_t sub_block_size = context->flash_info.sector_size;
@@ -53,7 +53,7 @@
psa_status_t status = PSA_SUCCESS;
struct sfs_flash_block_store_adapter *context = get_context(info);
size_t total_bytes_read = 0;
- uint32_t sub_block_lba;
+ uint64_t sub_block_lba;
size_t sub_block_offset;
calc_sub_block_pos(context, block_id, offset, &sub_block_lba, &sub_block_offset);
@@ -100,7 +100,7 @@
psa_status_t status = PSA_SUCCESS;
struct sfs_flash_block_store_adapter *context = get_context(info);
size_t total_bytes_written = 0;
- uint32_t sub_block_lba;
+ uint64_t sub_block_lba;
size_t sub_block_offset;
calc_sub_block_pos(context, block_id, offset, &sub_block_lba, &sub_block_offset);
@@ -151,7 +151,7 @@
{
psa_status_t status = PSA_ERROR_GENERIC_ERROR;
struct sfs_flash_block_store_adapter *context = get_context(info);
- uint32_t sub_block_lba;
+ uint64_t sub_block_lba;
size_t sub_block_offset;
calc_sub_block_pos(context, block_id, 0, &sub_block_lba, &sub_block_offset);
diff --git a/protocols/service/block_storage/packed-c/messages.h b/protocols/service/block_storage/packed-c/messages.h
index fc17d79..2155889 100644
--- a/protocols/service/block_storage/packed-c/messages.h
+++ b/protocols/service/block_storage/packed-c/messages.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2022, Arm Limited and Contributors. All rights reserved.
+ * Copyright (c) 2022-2023, Arm Limited and Contributors. All rights reserved.
* SPDX-License-Identifier: BSD-3-Clause
*/
@@ -34,7 +34,7 @@
/* Mandatory fixed sized output parameters */
struct __attribute__ ((__packed__)) ts_block_storage_get_partition_info_out
{
- uint32_t num_blocks;
+ uint64_t num_blocks;
uint32_t block_size;
uint8_t partition_guid[TS_BLOCK_STORAGE_GUID_OCTET_LEN];
uint8_t parent_guid[TS_BLOCK_STORAGE_GUID_OCTET_LEN];
@@ -83,7 +83,7 @@
struct __attribute__ ((__packed__)) ts_block_storage_read_in
{
uint64_t handle;
- uint32_t lba;
+ uint64_t lba;
uint32_t offset;
uint32_t len;
};
@@ -100,7 +100,7 @@
struct __attribute__ ((__packed__)) ts_block_storage_write_in
{
uint64_t handle;
- uint32_t lba;
+ uint64_t lba;
uint32_t offset;
};
@@ -122,7 +122,7 @@
struct __attribute__ ((__packed__)) ts_block_storage_erase_in
{
uint64_t handle;
- uint32_t begin_lba;
+ uint64_t begin_lba;
uint32_t num_blocks;
};