]> git.baikalelectronics.ru Git - arm-tf.git/commitdiff
Allow ARM Standard platforms to dynamically define PSCI capability
authorSoby Mathew <soby.mathew@arm.com>
Fri, 21 Oct 2016 16:51:22 +0000 (17:51 +0100)
committerSoby Mathew <soby.mathew@arm.com>
Wed, 7 Dec 2016 12:45:55 +0000 (12:45 +0000)
The capabilities exposed by the PSCI generic layer depends on the hooks
populated by the platform in `plat_arm_psci_pm_ops`. Currently ARM
Standard platforms statically define this structure. However, some
platforms may want to modify the hooks at runtime before registering
them with the generic layer.

This patch introduces a new ARM platform layer API
`plat_arm_psci_override_pm_ops` which allows the platform to probe
the power controller and modify `plat_arm_psci_pm_ops` if required.
Consequently, 'plat_arm_psci_pm_ops' is no longer qualified as
`const` on ARM Standard platforms.

Change-Id: I7dbb44b7bd36c20ec14ded5ee45a96816ca2ab9d
Signed-off-by: Soby Mathew <soby.mathew@arm.com>
include/plat/arm/common/plat_arm.h
plat/arm/board/fvp/fvp_pm.c
plat/arm/board/juno/juno_pm.c
plat/arm/common/arm_pm.c
plat/arm/css/common/css_pm.c

index 29fcffec87a38c89a937ce2c019bce1493c737ae..bc32e40fabc84a9699e29b3586a493cf6b37306c 100644 (file)
@@ -220,4 +220,7 @@ int plat_arm_get_alt_image_source(
 unsigned int plat_arm_calc_core_pos(u_register_t mpidr);
 const mmap_region_t *plat_arm_get_mmap(void);
 
+/* Allow platform to override psci_pm_ops during runtime */
+const plat_psci_ops_t *plat_arm_psci_override_pm_ops(plat_psci_ops_t *ops);
+
 #endif /* __PLAT_ARM_H__ */
index 66c0c3df963de4cfd18fdf23f15397d1f12faec7..139f71312231b6844d2fd56ac70b559abe336512 100644 (file)
@@ -327,7 +327,7 @@ static int fvp_node_hw_state(u_register_t target_cpu,
  * Export the platform handlers via plat_arm_psci_pm_ops. The ARM Standard
  * platform layer will take care of registering the handlers with PSCI.
  ******************************************************************************/
-const plat_psci_ops_t plat_arm_psci_pm_ops = {
+plat_psci_ops_t plat_arm_psci_pm_ops = {
        .cpu_standby = fvp_cpu_standby,
        .pwr_domain_on = fvp_pwr_domain_on,
        .pwr_domain_off = fvp_pwr_domain_off,
index c355d94dfbbb4da985d6d2251c92f7c374537967..c0fa628ef67d60b68fce52a6582879eedb8a22fd 100644 (file)
@@ -76,7 +76,7 @@ static int juno_translate_power_state_by_mpidr(u_register_t mpidr,
  * Export the platform handlers via plat_arm_psci_pm_ops. The ARM Standard
  * platform will take care of registering the handlers with PSCI.
  ******************************************************************************/
-const plat_psci_ops_t plat_arm_psci_pm_ops = {
+plat_psci_ops_t plat_arm_psci_pm_ops = {
        .pwr_domain_on                  = css_pwr_domain_on,
        .pwr_domain_on_finish           = css_pwr_domain_on_finish,
        .pwr_domain_off                 = css_pwr_domain_off,
index 1e756a9e50fcf883b3b3c59e0991833561de4131..d2e682d4ad65773238c2bbee8c7777e612e83b63 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, ARM Limited and Contributors. All rights reserved.
+ * Copyright (c) 2015-2016, ARM Limited and Contributors. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions are met:
 #include <platform_def.h>
 #include <psci.h>
 
+/* Allow ARM Standard platforms to override this function */
+#pragma weak plat_arm_psci_override_pm_ops
+
 /* Standard ARM platforms are expected to export plat_arm_psci_pm_ops */
-extern const plat_psci_ops_t plat_arm_psci_pm_ops;
+extern plat_psci_ops_t plat_arm_psci_pm_ops;
 
 #if ARM_RECOM_STATE_ID_ENC
 extern unsigned int arm_pm_idle_states[];
@@ -150,6 +153,14 @@ int arm_validate_ns_entrypoint(uintptr_t entrypoint)
        return PSCI_E_INVALID_ADDRESS;
 }
 
+/******************************************************************************
+ * Default definition on ARM standard platforms to override the plat_psci_ops.
+ *****************************************************************************/
+const plat_psci_ops_t *plat_arm_psci_override_pm_ops(plat_psci_ops_t *ops)
+{
+       return ops;
+}
+
 /******************************************************************************
  * Helper function to resume the platform from system suspend. Reinitialize
  * the system components which are not in the Always ON power domain.
@@ -201,7 +212,7 @@ void arm_program_trusted_mailbox(uintptr_t address)
 int plat_setup_psci_ops(uintptr_t sec_entrypoint,
                                const plat_psci_ops_t **psci_ops)
 {
-       *psci_ops = &plat_arm_psci_pm_ops;
+       *psci_ops = plat_arm_psci_override_pm_ops(&plat_arm_psci_pm_ops);
 
        /* Setup mailbox with entry point. */
        arm_program_trusted_mailbox(sec_entrypoint);
index 65d27336d6d75c1afb3fd32f6187cb67f6951ec2..d4dd0af7dbfa0ae3c090ef06a077a048b1d39eb3 100644 (file)
@@ -261,7 +261,7 @@ int css_node_hw_state(u_register_t mpidr, unsigned int power_level)
  * Export the platform handlers via plat_arm_psci_pm_ops. The ARM Standard
  * platform will take care of registering the handlers with PSCI.
  ******************************************************************************/
-const plat_psci_ops_t plat_arm_psci_pm_ops = {
+plat_psci_ops_t plat_arm_psci_pm_ops = {
        .pwr_domain_on          = css_pwr_domain_on,
        .pwr_domain_on_finish   = css_pwr_domain_on_finish,
        .pwr_domain_off         = css_pwr_domain_off,