From e8ca7d1e32c04f4a7f9679f7d09dbe0e49baa471 Mon Sep 17 00:00:00 2001
From: Soby Mathew <soby.mathew@arm.com>
Date: Thu, 15 Jan 2015 11:49:58 +0000
Subject: [PATCH] Increment the PSCI VERSION to 1.0

This patch:

   * Bumps the PSCI VERSION to 1.0. This means that
     the PSCI_VERSION API will now return the value 0x00010000
     to indicate the version as 1.0. The firmware remains
     compatible with PSCI v0.2 clients.

   * The firmware design guide is updated to document the
     APIs supported by the Trusted Firmware generic code.

   * The FVP Device Tree Sources (dts) and Blobs(dtb) are also
     updated to add "psci-1.0" and "psci-0.2" to the list of
     compatible PSCI versions.

Change-Id: Iafc2f549c92651dcd65d7e24a8aae35790d00f8a
---
 docs/firmware-design.md                  |  63 +++++++++++++----------
 fdts/fvp-base-gicv2-psci.dtb             | Bin 10082 -> 10106 bytes
 fdts/fvp-base-gicv2-psci.dts             |   2 +-
 fdts/fvp-base-gicv2legacy-psci.dtb       | Bin 10082 -> 10106 bytes
 fdts/fvp-base-gicv2legacy-psci.dts       |   2 +-
 fdts/fvp-base-gicv3-psci.dtb             | Bin 10710 -> 10734 bytes
 fdts/fvp-base-gicv3-psci.dts             |   2 +-
 fdts/fvp-foundation-gicv2-psci.dtb       | Bin 7451 -> 7475 bytes
 fdts/fvp-foundation-gicv2-psci.dts       |   2 +-
 fdts/fvp-foundation-gicv2legacy-psci.dtb | Bin 7451 -> 7475 bytes
 fdts/fvp-foundation-gicv2legacy-psci.dts |   2 +-
 fdts/fvp-foundation-gicv3-psci.dtb       | Bin 8079 -> 8103 bytes
 fdts/fvp-foundation-gicv3-psci.dts       |   2 +-
 include/bl31/services/psci.h             |   4 +-
 14 files changed, 45 insertions(+), 34 deletions(-)

diff --git a/docs/firmware-design.md b/docs/firmware-design.md
index 774ea436c..ee76d5c89 100644
--- a/docs/firmware-design.md
+++ b/docs/firmware-design.md
@@ -734,32 +734,43 @@ restoring the stack and CPU state and returning from the original SMC.
 
 TODO: Provide design walkthrough of PSCI implementation.
 
-The complete PSCI API is not yet implemented. The following functions are
-currently implemented:
-
--   `PSCI_VERSION`
--   `CPU_OFF`
--   `CPU_ON`
--   `CPU_SUSPEND`
--   `AFFINITY_INFO`
--   `SYSTEM_OFF`
--   `SYSTEM_RESET`
-
-The `CPU_ON`, `CPU_OFF` and `CPU_SUSPEND` functions implement the warm boot
-path in ARM Trusted Firmware. `CPU_ON` and `CPU_OFF` have undergone testing
-on all the supported FVPs. `CPU_SUSPEND` & `AFFINITY_INFO` have undergone
-testing only on the AEM v8 Base FVP. Support for `AFFINITY_INFO` is still
-experimental. Support for `CPU_SUSPEND` is stable for entry into power down
-states. Standby states are currently not supported. `PSCI_VERSION` is
-present but completely untested in this version of the software.
-
-The following unsupported functions return with a error code as documented in
-the [Power State Coordination Interface PDD] [PSCI].
-
--   `MIGRATE` : -1 (NOT_SUPPORTED)
--   `MIGRATE_INFO_TYPE` : 2 (Trusted OS is either not present or does not
-     require migration)
--   `MIGRATE_INFO_UP_CPU` : 0 (Return value is UNDEFINED)
+The PSCI v1.0 specification categorizes APIs as optional and mandatory. All the
+mandatory APIs in PSCI v1.0 and all the APIs in PSCI v0.2 draft specification
+[Power State Coordination Interface PDD] [PSCI] are implemented. The table lists
+the PSCI v1.0 APIs and their support in generic code.
+
+An API implementation might have a dependency on platform code e.g. CPU_SUSPEND
+requires the platform to export a part of the implementation. Hence the level
+of support of the mandatory APIs depends upon the support exported by the
+platform port as well. The Juno and FVP (all variants) platforms export all the
+required support.
+
+| PSCI v1.0 API         |Supported| Comments                                  |
+|:----------------------|:--------|:------------------------------------------|
+|`PSCI_VERSION`         | Yes     | The version returned is 1.0               |
+|`CPU_SUSPEND`          | Yes*    | The original `power_state` format is used |
+|`CPU_OFF`              | Yes*    |                                           |
+|`CPU_ON`               | Yes*    |                                           |
+|`AFFINITY_INFO`        | Yes     |                                           |
+|`MIGRATE`              | Yes**   |                                           |
+|`MIGRATE_INFO_TYPE`    | Yes**   |                                           |
+|`MIGRATE_INFO_CPU`     | Yes**   |                                           |
+|`SYSTEM_OFF`           | Yes*    |                                           |
+|`SYSTEM_RESET`         | Yes*    |                                           |
+|`PSCI_FEATURES`        | Yes     |                                           |
+|`CPU_FREEZE`           | No      |                                           |
+|`CPU_DEFAULT_SUSPEND`  | No      |                                           |
+|`CPU_HW_STATE`         | No      |                                           |
+|`SYSTEM_SUSPEND`       | No      |                                           |
+|`PSCI_SET_SUSPEND_MODE`| No      |                                           |
+|`PSCI_STAT_RESIDENCY`  | No      |                                           |
+|`PSCI_STAT_COUNT`      | No      |                                           |
+
+*Note : These PSCI APIs require platform power management hooks to be
+registered with the generic PSCI code to be supported.
+
+**Note : These PSCI APIs require appropriate Secure Payload Dispatcher
+hooks to be registered with the generic PSCI code to be supported.
 
 
 5.  Secure-EL1 Payloads and Dispatchers
diff --git a/fdts/fvp-base-gicv2-psci.dtb b/fdts/fvp-base-gicv2-psci.dtb
index ae3b4c55c041da0a7a85b3cf7d2ebee450d97b6a..b8a31ce33beabb6165c45eaa796d1de07131986f 100644
GIT binary patch
delta 75
zcmaFl_sdV<0`I@K3=Ha33=9k&3=Ap~69vQ>FKpD<&8V&n6k<y(%GD_-PR`Ud)H7g!
Pa}4y1;GE5$7z<PZVwx7|

delta 51
zcmez6_sCD+0`I@K3=HZ?3=9k&3=Ap^69vQ>cWl(y&B)IQ6k<y(%GD_-PR?Xt*v!RL
Gpb7w$I}O<Y

diff --git a/fdts/fvp-base-gicv2-psci.dts b/fdts/fvp-base-gicv2-psci.dts
index 43518a3f4..c1c9efbf1 100644
--- a/fdts/fvp-base-gicv2-psci.dts
+++ b/fdts/fvp-base-gicv2-psci.dts
@@ -52,7 +52,7 @@
 	};
 
 	psci {
-		compatible = "arm,psci";
+		compatible = "arm,psci-1.0", "arm,psci-0.2", "arm,psci";
 		method = "smc";
 		cpu_suspend = <0xc4000001>;
 		cpu_off = <0x84000002>;
diff --git a/fdts/fvp-base-gicv2legacy-psci.dtb b/fdts/fvp-base-gicv2legacy-psci.dtb
index 2d23968f3e445a853b91144728d84f6676ee7f8f..4270623b56a3c3eaf132bea4ea3cb5b91af71465 100644
GIT binary patch
delta 75
zcmaFl_sdV<0`I@K3=Ha33=9k&3=Ap~69vQ>FKpD<&8V&n6k<y(%GD_-PR`Ud)H7g!
Pa}4y1;GE5$7z<PZVwx7|

delta 51
zcmez6_sCD+0`I@K3=HZ?3=9k&3=Ap^69vQ>cWl(y&B)IQ6k<y(%GD_-PR?Xt*v!RL
Gpb7w$I}O<Y

diff --git a/fdts/fvp-base-gicv2legacy-psci.dts b/fdts/fvp-base-gicv2legacy-psci.dts
index 06d33e749..7bd5ea268 100644
--- a/fdts/fvp-base-gicv2legacy-psci.dts
+++ b/fdts/fvp-base-gicv2legacy-psci.dts
@@ -52,7 +52,7 @@
 	};
 
 	psci {
-		compatible = "arm,psci";
+		compatible = "arm,psci-1.0", "arm,psci-0.2", "arm,psci";
 		method = "smc";
 		cpu_suspend = <0xc4000001>;
 		cpu_off = <0x84000002>;
diff --git a/fdts/fvp-base-gicv3-psci.dtb b/fdts/fvp-base-gicv3-psci.dtb
index c2f63ebebee24231f71f3eb0c9d6a839e3314d6f..27c3f9353ba97a34e087cb1a299ceaf62501b84b 100644
GIT binary patch
delta 75
zcmcZ>{4QAF0`I@K3=Ep@7#J8l7#P&1OcW4j^x3Gfn^9dED8!anl&e!voSdm^sAs?c
Q=NRZ2!8w~hF+NcT0DZ<6!2kdN

delta 60
zcmaDCd@Weu0`I@K3=Epr7#J8l7#P%QCJKnNnE*Kq4U_HpWHx%vV&vxp^4JoKa&-!d
OlQS6@HghpOQ3n7U*$^@S

diff --git a/fdts/fvp-base-gicv3-psci.dts b/fdts/fvp-base-gicv3-psci.dts
index 6afa44c72..32e577ada 100644
--- a/fdts/fvp-base-gicv3-psci.dts
+++ b/fdts/fvp-base-gicv3-psci.dts
@@ -52,7 +52,7 @@
 	};
 
 	psci {
-		compatible = "arm,psci";
+		compatible = "arm,psci-1.0", "arm,psci-0.2", "arm,psci";
 		method = "smc";
 		cpu_suspend = <0xc4000001>;
 		cpu_off = <0x84000002>;
diff --git a/fdts/fvp-foundation-gicv2-psci.dtb b/fdts/fvp-foundation-gicv2-psci.dtb
index df8e629ffafe1746e42d3c84997e68873b28c493..5b92e5ee8288926bd72503e35def261ed4b3f189 100644
GIT binary patch
delta 75
zcmbPjwb@GG0`I@K3=Fcy3=9k&3=C3hCJKl%rfk&M&#0~p6k<y(%GD_-PR`Ud)H7g!
Pa}4y1;GE6h7*(YKBHb0U

delta 51
zcmdmNHQP$y0`I@K3=Fc;3=9k&3=C3JCJKl%`fSwL&&baS6k<y(%GD_-PR?Xt*v!YI
GDh&W?_6(x{

diff --git a/fdts/fvp-foundation-gicv2-psci.dts b/fdts/fvp-foundation-gicv2-psci.dts
index 15ff47182..c04d535f2 100644
--- a/fdts/fvp-foundation-gicv2-psci.dts
+++ b/fdts/fvp-foundation-gicv2-psci.dts
@@ -52,7 +52,7 @@
 	};
 
 	psci {
-		compatible = "arm,psci";
+		compatible = "arm,psci-1.0", "arm,psci-0.2", "arm,psci";
 		method = "smc";
 		cpu_suspend = <0xc4000001>;
 		cpu_off = <0x84000002>;
diff --git a/fdts/fvp-foundation-gicv2legacy-psci.dtb b/fdts/fvp-foundation-gicv2legacy-psci.dtb
index ed43254131d0d94a1466270f1b39dff12b214420..71f6ae2c9cfc907e6fd60d715ca0e7c6d5533213 100644
GIT binary patch
delta 88
zcmbPjwb@GG0`I@K3=Fcy3=9k&3=C3hCJKl%rfk%ZW;Rd;3e8F^%GD_-PR`Ud)H7g!
ca}4y1;2fYT1_s9Dg3`(FnGHAhF!xIW06F#;tpET3

delta 51
zcmdmNHQP$y0`I@K3=Fc;3=9k&3=C3JCJKl%`fSvYX6EMv3e8F^%GD_-PR?Xt*qp_D
GQW5}YUk#K1

diff --git a/fdts/fvp-foundation-gicv2legacy-psci.dts b/fdts/fvp-foundation-gicv2legacy-psci.dts
index a923c3489..8dba04c1e 100644
--- a/fdts/fvp-foundation-gicv2legacy-psci.dts
+++ b/fdts/fvp-foundation-gicv2legacy-psci.dts
@@ -83,7 +83,7 @@
 		};
 
 		idle-states {
-			entry-method = "arm,psci";
+			entry-method = "arm,psci-1.0", "arm,psci-0.2", "arm,psci";
 
 			CPU_SLEEP_0: cpu-sleep-0 {
 				compatible = "arm,idle-state";
diff --git a/fdts/fvp-foundation-gicv3-psci.dtb b/fdts/fvp-foundation-gicv3-psci.dtb
index 724847c3c9a2e0db86ba826683e59ce456d9d9f5..d7d9e1412ca6ef9c100db1682a1999a1309c9ec2 100644
GIT binary patch
delta 75
zcmeCTUv4jOf%o5A1_t@%3=9k&3=Faw69vQ>A8gdv&#0~p6k<y(%GD_-PR`Ud)H7g!
Qa}4y1;GE6h7-z}?069Sxi~s-t

delta 60
zcmZ2(-)}E)f%o5A1_t?l1_lNX1_oJyi2~wmCx9G=hRN~VG8;YTG4gW)d2ESAxjF^K
O$(alcoB5b#$^roAtPdIh

diff --git a/fdts/fvp-foundation-gicv3-psci.dts b/fdts/fvp-foundation-gicv3-psci.dts
index 49290e4e1..48a1afc06 100644
--- a/fdts/fvp-foundation-gicv3-psci.dts
+++ b/fdts/fvp-foundation-gicv3-psci.dts
@@ -52,7 +52,7 @@
 	};
 
 	psci {
-		compatible = "arm,psci";
+		compatible = "arm,psci-1.0", "arm,psci-0.2", "arm,psci";
 		method = "smc";
 		cpu_suspend = <0xc4000001>;
 		cpu_off = <0x84000002>;
diff --git a/include/bl31/services/psci.h b/include/bl31/services/psci.h
index 59675810b..80bc53b83 100644
--- a/include/bl31/services/psci.h
+++ b/include/bl31/services/psci.h
@@ -115,8 +115,8 @@
 /*******************************************************************************
  * PSCI version
  ******************************************************************************/
-#define PSCI_MAJOR_VER		(0 << 16)
-#define PSCI_MINOR_VER		0x2
+#define PSCI_MAJOR_VER		(1 << 16)
+#define PSCI_MINOR_VER		0x0
 
 /*******************************************************************************
  * PSCI error codes
-- 
GitLab