Loading drivers/soc/qcom/scm-boot.c +61 −0 Original line number Diff line number Diff line Loading @@ -31,3 +31,64 @@ int scm_set_boot_addr(phys_addr_t addr, unsigned int flags) &cmd, sizeof(cmd), NULL, 0); } EXPORT_SYMBOL(scm_set_boot_addr); /** * scm_set_boot_addr_mc - Set entry physical address for cpus * @addr: 32bit physical address * @aff0: Collective bitmask of the affinity-level-0 of the mpidr * 1<<aff0_CPU0| 1<<aff0_CPU1....... | 1<<aff0_CPU32 * Supports maximum 32 cpus under any affinity level. * @aff1: Collective bitmask of the affinity-level-1 of the mpidr * @aff2: Collective bitmask of the affinity-level-2 of the mpidr * @flags: Flag to differentiate between coldboot vs warmboot */ int scm_set_boot_addr_mc(phys_addr_t addr, u32 aff0, u32 aff1, u32 aff2, u32 flags) { struct { u32 addr; u32 aff0; u32 aff1; u32 aff2; u32 reserved; u32 flags; } cmd; cmd.addr = addr; cmd.aff0 = aff0; cmd.aff1 = aff1; cmd.aff2 = aff2; /* Reserved for future chips with affinity level 3 effectively 1 << 0 */ cmd.reserved = ~0U; cmd.flags = flags | SCM_FLAG_HLOS; return scm_call(SCM_SVC_BOOT, SCM_BOOT_ADDR_MC, &cmd, sizeof(cmd), NULL, 0); } EXPORT_SYMBOL(scm_set_boot_addr_mc); /** * scm_set_warm_boot_addr_mc_for_all - * Set entry physical address for __all__ possible cpus * This API passes all_set mask to secure-os and relies * on secure-os to appropriately * set the boot-address on the current system. * @addr: 32bit physical address */ int scm_set_warm_boot_addr_mc_for_all(phys_addr_t addr) { return scm_set_boot_addr_mc(addr, ~0U, ~0U, ~0U, SCM_FLAG_WARMBOOT_MC); } EXPORT_SYMBOL(scm_set_warm_boot_addr_mc_for_all); /** * scm_is_mc_boot_available - * Checks if TZ supports the boot API for multi-cluster configuration * Returns true if available and false otherwise */ int scm_is_mc_boot_available(void) { return scm_is_call_available(SCM_SVC_BOOT, SCM_BOOT_ADDR_MC); } EXPORT_SYMBOL(scm_is_mc_boot_available); include/soc/qcom/scm-boot.h +34 −2 Original line number Diff line number Diff line /* Copyright (c) 2010, 2012, The Linux Foundation. All rights reserved. /* Copyright (c) 2010, 2012, 2014, The Linux Foundation. All rights reserved. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 and Loading @@ -21,11 +21,43 @@ #define SCM_FLAG_WARMBOOT_CPU2 0x10 #define SCM_FLAG_WARMBOOT_CPU3 0x40 /* Multicluster Variants */ #define SCM_BOOT_ADDR_MC 0x11 #define SCM_FLAG_COLDBOOT_MC 0x02 #define SCM_FLAG_WARMBOOT_MC 0x04 #ifdef CONFIG_ARM64 #define SCM_FLAG_HLOS 0x01 #else #define SCM_FLAG_HLOS 0x0 #endif #ifdef CONFIG_MSM_SCM int scm_set_boot_addr(phys_addr_t addr, unsigned int flags); int scm_set_boot_addr_mc(phys_addr_t addr, u32 aff0, u32 aff1, u32 aff2, u32 flags); int scm_set_warm_boot_addr_mc_for_all(phys_addr_t addr); int scm_is_mc_boot_available(void); #else static inline int scm_set_boot_addr(phys_addr_t addr, unsigned int flags) { WARN_ONCE(1, "CONFIG_MSM_SCM disabled, SCM call will fail silently\n"); return 0; } int scm_set_boot_addr_mc(phys_addr_t addr, u32 aff0, u32 aff1, u32 aff2, u32 flags) { WARN_ONCE(1, "CONFIG_MSM_SCM disabled, SCM call will fail silently\n"); return 0; } int scm_set_warm_boot_addr_mc_for_all(phys_addr_t addr) { WARN_ONCE(1, "CONFIG_MSM_SCM disabled, SCM call will fail silently\n"); return 0; } static inline int scm_is_mc_boot_available(void) { WARN_ONCE(1, "CONFIG_MSM_SCM disabled, SCM call will fail silently\n"); return 0; } #endif Loading Loading
drivers/soc/qcom/scm-boot.c +61 −0 Original line number Diff line number Diff line Loading @@ -31,3 +31,64 @@ int scm_set_boot_addr(phys_addr_t addr, unsigned int flags) &cmd, sizeof(cmd), NULL, 0); } EXPORT_SYMBOL(scm_set_boot_addr); /** * scm_set_boot_addr_mc - Set entry physical address for cpus * @addr: 32bit physical address * @aff0: Collective bitmask of the affinity-level-0 of the mpidr * 1<<aff0_CPU0| 1<<aff0_CPU1....... | 1<<aff0_CPU32 * Supports maximum 32 cpus under any affinity level. * @aff1: Collective bitmask of the affinity-level-1 of the mpidr * @aff2: Collective bitmask of the affinity-level-2 of the mpidr * @flags: Flag to differentiate between coldboot vs warmboot */ int scm_set_boot_addr_mc(phys_addr_t addr, u32 aff0, u32 aff1, u32 aff2, u32 flags) { struct { u32 addr; u32 aff0; u32 aff1; u32 aff2; u32 reserved; u32 flags; } cmd; cmd.addr = addr; cmd.aff0 = aff0; cmd.aff1 = aff1; cmd.aff2 = aff2; /* Reserved for future chips with affinity level 3 effectively 1 << 0 */ cmd.reserved = ~0U; cmd.flags = flags | SCM_FLAG_HLOS; return scm_call(SCM_SVC_BOOT, SCM_BOOT_ADDR_MC, &cmd, sizeof(cmd), NULL, 0); } EXPORT_SYMBOL(scm_set_boot_addr_mc); /** * scm_set_warm_boot_addr_mc_for_all - * Set entry physical address for __all__ possible cpus * This API passes all_set mask to secure-os and relies * on secure-os to appropriately * set the boot-address on the current system. * @addr: 32bit physical address */ int scm_set_warm_boot_addr_mc_for_all(phys_addr_t addr) { return scm_set_boot_addr_mc(addr, ~0U, ~0U, ~0U, SCM_FLAG_WARMBOOT_MC); } EXPORT_SYMBOL(scm_set_warm_boot_addr_mc_for_all); /** * scm_is_mc_boot_available - * Checks if TZ supports the boot API for multi-cluster configuration * Returns true if available and false otherwise */ int scm_is_mc_boot_available(void) { return scm_is_call_available(SCM_SVC_BOOT, SCM_BOOT_ADDR_MC); } EXPORT_SYMBOL(scm_is_mc_boot_available);
include/soc/qcom/scm-boot.h +34 −2 Original line number Diff line number Diff line /* Copyright (c) 2010, 2012, The Linux Foundation. All rights reserved. /* Copyright (c) 2010, 2012, 2014, The Linux Foundation. All rights reserved. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 and Loading @@ -21,11 +21,43 @@ #define SCM_FLAG_WARMBOOT_CPU2 0x10 #define SCM_FLAG_WARMBOOT_CPU3 0x40 /* Multicluster Variants */ #define SCM_BOOT_ADDR_MC 0x11 #define SCM_FLAG_COLDBOOT_MC 0x02 #define SCM_FLAG_WARMBOOT_MC 0x04 #ifdef CONFIG_ARM64 #define SCM_FLAG_HLOS 0x01 #else #define SCM_FLAG_HLOS 0x0 #endif #ifdef CONFIG_MSM_SCM int scm_set_boot_addr(phys_addr_t addr, unsigned int flags); int scm_set_boot_addr_mc(phys_addr_t addr, u32 aff0, u32 aff1, u32 aff2, u32 flags); int scm_set_warm_boot_addr_mc_for_all(phys_addr_t addr); int scm_is_mc_boot_available(void); #else static inline int scm_set_boot_addr(phys_addr_t addr, unsigned int flags) { WARN_ONCE(1, "CONFIG_MSM_SCM disabled, SCM call will fail silently\n"); return 0; } int scm_set_boot_addr_mc(phys_addr_t addr, u32 aff0, u32 aff1, u32 aff2, u32 flags) { WARN_ONCE(1, "CONFIG_MSM_SCM disabled, SCM call will fail silently\n"); return 0; } int scm_set_warm_boot_addr_mc_for_all(phys_addr_t addr) { WARN_ONCE(1, "CONFIG_MSM_SCM disabled, SCM call will fail silently\n"); return 0; } static inline int scm_is_mc_boot_available(void) { WARN_ONCE(1, "CONFIG_MSM_SCM disabled, SCM call will fail silently\n"); return 0; } #endif Loading