fix: partition info get count flags usage
Follow up to change [1] fix statements related to
FFA_PARTITION_COUNT_FLAG_MASK and FFA_PARTITION_COUNT_FLAG
macros usage.
[1] https://review.trustedfirmware.org/c/hafnium/hafnium/+/13033
Change-Id: I2a08ea66fc7de8ad9d6eb9cbeb70c1a087e04289
Signed-off-by: Olivier Deprez <olivier.deprez@arm.com>
diff --git a/inc/vmapi/hf/ffa.h b/inc/vmapi/hf/ffa.h
index 8d6d59c..98656a8 100644
--- a/inc/vmapi/hf/ffa.h
+++ b/inc/vmapi/hf/ffa.h
@@ -131,12 +131,12 @@
#define FFA_MEM_PERM_RX UINT32_C(0x3)
/*
- * Defined in Table 13.31 in the FF-A v1.1 BETA0 specification.
+ * Defined in Table 13.34 in the FF-A v1.1 EAC0 specification.
* The Partition count flag is used by FFA_PARTITION_INFO_GET to specify
* if partition info descriptors should be returned or just the count.
*/
-#define FFA_PARTITION_COUNT_FLAG 0x1
-#define FFA_PARTITION_COUNT_FLAG_MASK 0x1
+#define FFA_PARTITION_COUNT_FLAG UINT32_C(0x1)
+#define FFA_PARTITION_COUNT_FLAG_MASK (UINT32_C(0x1) << 0)
/**
* For use where the FF-A specification refers explicitly to '4K pages'. Not to
diff --git a/src/api.c b/src/api.c
index ae9bb68..46eb892 100644
--- a/src/api.c
+++ b/src/api.c
@@ -430,7 +430,7 @@
{
struct vm *current_vm = current->vm;
ffa_vm_count_t vm_count = 0;
- bool count_flag = (flags && FFA_PARTITION_COUNT_FLAG_MASK) ==
+ bool count_flag = (flags & FFA_PARTITION_COUNT_FLAG_MASK) ==
FFA_PARTITION_COUNT_FLAG;
bool uuid_is_null = ffa_uuid_is_null(uuid);
struct ffa_partition_info partitions[2 * MAX_VMS] = {0};
@@ -438,7 +438,7 @@
struct ffa_value ret;
/* Bits 31:1 Must Be Zero */
- if ((flags & ~FFA_PARTITION_COUNT_FLAG) != 0) {
+ if ((flags & ~FFA_PARTITION_COUNT_FLAG_MASK) != 0) {
return ffa_error(FFA_INVALID_PARAMETERS);
}
diff --git a/src/arch/aarch64/plat/ffa/hypervisor.c b/src/arch/aarch64/plat/ffa/hypervisor.c
index e7f9e94..4f7e8cc 100644
--- a/src/arch/aarch64/plat/ffa/hypervisor.c
+++ b/src/arch/aarch64/plat/ffa/hypervisor.c
@@ -877,7 +877,7 @@
return;
}
- if ((flags && FFA_PARTITION_COUNT_FLAG_MASK) ==
+ if ((flags & FFA_PARTITION_COUNT_FLAG_MASK) ==
FFA_PARTITION_COUNT_FLAG) {
vm_count += tee_partitions_count;
} else {