Make sure rxtx buffers provided in PM are of same size
SPM/hafnium currently allows only same size rx/tx buffers, if different
sizes are provided in Partition's manifest throw an error.
Also, add a unit test to verify it.
Signed-off-by: Manish Pandey <manish.pandey2@arm.com>
Change-Id: I8bab13375b8f62b60caea6384fcd4125fc9eedb0
diff --git a/src/manifest.c b/src/manifest.c
index d6dfac8..9db1863 100644
--- a/src/manifest.c
+++ b/src/manifest.c
@@ -361,6 +361,10 @@
i++;
} while (fdt_next_sibling(mem_node) && (i < SP_MAX_MEMORY_REGIONS));
+ if (rxtx->rx_buffer->page_count != rxtx->tx_buffer->page_count) {
+ return MANIFEST_ERROR_RXTX_SIZE_MISMATCH;
+ }
+
*count = i;
return MANIFEST_SUCCESS;
@@ -830,6 +834,8 @@
return "Memory-region node should have at least one entry";
case MANIFEST_ERROR_DEVICE_REGION_NODE_EMPTY:
return "Device-region node should have at least one entry";
+ case MANIFEST_ERROR_RXTX_SIZE_MISMATCH:
+ return "RX and TX buffers should be of same size";
}
panic("Unexpected manifest return code.");