Update SPCI_VERSION implementation to match latest spec.
This also updates the version number from 0.9 to 1.0.
Bug: 132420445
Change-Id: I991ea9f71634935c21a590f9309dd66ac910eff5
diff --git a/src/api.c b/src/api.c
index 8f8272e..988e5f6 100644
--- a/src/api.c
+++ b/src/api.c
@@ -1384,22 +1384,24 @@
}
/** Returns the version of the implemented SPCI specification. */
-struct spci_value api_spci_version(void)
+struct spci_value api_spci_version(uint32_t requested_version)
{
/*
* Ensure that both major and minor revision representation occupies at
* most 15 bits.
*/
static_assert(0x8000 > SPCI_VERSION_MAJOR,
- "Major revision representation take more than 15 bits.");
+ "Major revision representation takes more than 15 bits.");
static_assert(0x10000 > SPCI_VERSION_MINOR,
- "Minor revision representation take more than 16 bits.");
+ "Minor revision representation takes more than 16 bits.");
+ if (requested_version & SPCI_VERSION_RESERVED_BIT) {
+ /* Invalid encoding, return an error. */
+ return (struct spci_value){.func = SPCI_NOT_SUPPORTED};
+ }
- struct spci_value ret = {
- .func = SPCI_SUCCESS_32,
- .arg2 = (SPCI_VERSION_MAJOR << SPCI_VERSION_MAJOR_OFFSET) |
+ return (struct spci_value){
+ .func = (SPCI_VERSION_MAJOR << SPCI_VERSION_MAJOR_OFFSET) |
SPCI_VERSION_MINOR};
- return ret;
}
int64_t api_debug_log(char c, struct vcpu *current)