ARM: support System Reset via PSCI
Subsystems (3)
v3 cover ARM: support System Reset via PSCI
For ARMv8, the secure firmware (ex. ARM Trusted Firmware BL31) is often implemented, making U-Boot a non-secure world boot loader.
The secure firmware generally includes PSCI. The power management operations, including System Reset, are supposed to be handled by PSCI. In this case, U-Boot should not touch the system reset directly. Instead, U-Boot should call PSCI service to reset the system.
In order to implement this, arm-smccc code is needed. The code has been copied from Linux. (1/3)
They have been adjusted for use in U-Boot (2/3).
3/3 implements a generic sysreset driver based on the PSCI specification.
Changes in v3:
- opcodes-virt.h is GPL-2.0+
Changes in v2:
- split into separate patches "import" and "adjust"
- split into separate patches "import" and "adjust"
Masahiro Yamada (3):
ARM: import arm-smccc code from Linux 4.11-rc6
ARM: adjust arm-smccc code for use in U-Boot
sysreset: psci: support system reset in a generic way with PSCI
arch/arm/Kconfig | 9 ++ arch/arm/cpu/armv7/Makefile | 1 + arch/arm/cpu/armv7/smccc-call.S | 56 +++++++++ arch/arm/cpu/armv8/Makefile | 2 + arch/arm/cpu/armv8/smccc-call.S | 44 +++++++ arch/arm/include/asm/opcodes-sec.h | 17 +++ arch/arm/include/asm/opcodes-virt.h | 27 +++++ arch/arm/include/asm/opcodes.h | 229 ++++++++++++++++++++++++++++++++++++ arch/arm/lib/asm-offsets.c | 8 ++ drivers/Kconfig | 2 + drivers/Makefile | 5 +- drivers/firmware/Kconfig | 6 + drivers/firmware/Makefile | 2 + drivers/firmware/firmware-uclass.c | 11 ++ drivers/firmware/psci.c | 94 +++++++++++++++ drivers/sysreset/Kconfig | 10 ++ drivers/sysreset/Makefile | 1 + drivers/sysreset/sysreset_psci.c | 41 +++++++ include/dm/uclass-id.h | 1 + include/linux/arm-smccc.h | 126 ++++++++++++++++++++ include/linux/psci.h | 13 ++ 21 files changed, 703 insertions(+), 2 deletions(-) create mode 100644 arch/arm/cpu/armv7/smccc-call.S create mode 100644 arch/arm/cpu/armv8/smccc-call.S create mode 100644 arch/arm/include/asm/opcodes-sec.h create mode 100644 arch/arm/include/asm/opcodes-virt.h create mode 100644 arch/arm/include/asm/opcodes.h create mode 100644 drivers/firmware/Kconfig create mode 100644 drivers/firmware/Makefile create mode 100644 drivers/firmware/firmware-uclass.c create mode 100644 drivers/firmware/psci.c create mode 100644 drivers/sysreset/sysreset_psci.c create mode 100644 include/linux/arm-smccc.h
Signature · 1 line
2.7.4
PATCH v3 1/3 ARM: import arm-smccc code from Linux 4.11-rc6
Imports ARM SMC Calling Convention code from Linux 4.11-rc6. The files have been copied as follows:
[Linux] [U-Boot]arch/arm/kernel/smccc-call.S -> arch/arm/cpu/armv7/smccc-call.Sarch/arm64/kernel/smccc-call.S -> arch/arm/cpu/armv8/smccc-call.S arch/arm/include/asm/opcodes* -> arch/arm/include/asm/opcodes*include/linux/arm-smccc.h -> include/linux/arm-smccc.h
---
Changes in v3: None
Changes in v2:
- split into separate patches "import" and "adjust"
arch/arm/cpu/armv7/smccc-call.S | 64 ++++++++++ arch/arm/cpu/armv8/smccc-call.S | 52 ++++++++ arch/arm/include/asm/opcodes-sec.h | 24 ++++ arch/arm/include/asm/opcodes-virt.h | 39 ++++++ arch/arm/include/asm/opcodes.h | 231 ++++++++++++++++++++++++++++++++++++ include/linux/arm-smccc.h | 134 +++++++++++++++++++++ 6 files changed, 544 insertions(+) create mode 100644 arch/arm/cpu/armv7/smccc-call.S create mode 100644 arch/arm/cpu/armv8/smccc-call.S create mode 100644 arch/arm/include/asm/opcodes-sec.h create mode 100644 arch/arm/include/asm/opcodes-virt.h create mode 100644 arch/arm/include/asm/opcodes.h create mode 100644 include/linux/arm-smccc.h
arch/arm/cpu/armv7/smccc-call.S new file +64 -0
@@ -0,0 +1,64 @@ +/* + * Copyright (c) 2015, Linaro Limited + * + * This software is licensed under the terms of the GNU General Public + * License version 2, as published by the Free Software Foundation, and + * may be copied, distributed, and modified under those terms. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + */ +#include <linux/linkage.h> + +#include <asm/opcodes-sec.h> +#include <asm/opcodes-virt.h> +#include <asm/unwind.h> + + /* + * Wrap c macros in asm macros to delay expansion until after the + * SMCCC asm macro is expanded. + */ + .macro SMCCC_SMC + __SMC(0) + .endm + + .macro SMCCC_HVC + __HVC(0) + .endm + + .macro SMCCC instr +UNWIND( .fnstart) + mov r12, sp + push {r4-r7} +UNWIND( .save {r4-r7}) + ldm r12, {r4-r7} + \instr + pop {r4-r7} + ldr r12, [sp, #(4 * 4)] + stm r12, {r0-r3} + bx lr +UNWIND( .fnend) + .endm + +/* + * void smccc_smc(unsigned long a0, unsigned long a1, unsigned long a2, + * unsigned long a3, unsigned long a4, unsigned long a5, + * unsigned long a6, unsigned long a7, struct arm_smccc_res *res, + * struct arm_smccc_quirk *quirk) + */ +ENTRY(__arm_smccc_smc) + SMCCC SMCCC_SMC +ENDPROC(__arm_smccc_smc) + +/* + * void smccc_hvc(unsigned long a0, unsigned long a1, unsigned long a2, + * unsigned long a3, unsigned long a4, unsigned long a5, + * unsigned long a6, unsigned long a7, struct arm_smccc_res *res, + * struct arm_smccc_quirk *quirk) + */ +ENTRY(__arm_smccc_hvc) + SMCCC SMCCC_HVC +ENDPROC(__arm_smccc_hvc)
arch/arm/cpu/armv8/smccc-call.S new file +52 -0
52 lines not on this page · raw message
arch/arm/include/asm/opcodes-sec.h new file +24 -0
@@ -0,0 +1,24 @@ +/* +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License version 2 as +* published by the Free Software Foundation. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* Copyright (C) 2012 ARM Limited +*/ + +#ifndef __ASM_ARM_OPCODES_SEC_H +#define __ASM_ARM_OPCODES_SEC_H + +#include <asm/opcodes.h> + +#define __SMC (imm4) __inst_arm_thumb32( \ + 0xE1600070 | (((imm4) & 0xF) << 0), \ + 0xF7F08000 | (((imm4) & 0xF) << 16) \ +) + +#endif /* __ASM_ARM_OPCODES_SEC_H */
arch/arm/include/asm/opcodes-virt.h new file +39 -0
@@ -0,0 +1,39 @@ +/* +* opcodes-virt.h: Opcode definitions for the ARM virtualization extensions +* Copyright (C) 2012 Linaro Limited +* +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License along +* with this program; if not, write to the Free Software Foundation, Inc., +* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. +*/ +#ifndef __ASM_ARM_OPCODES_VIRT_H +#define __ASM_ARM_OPCODES_VIRT_H + +#include <asm/opcodes.h> + +#define __HVC (imm16) __inst_arm_thumb32( \ + 0xE1400070 | (((imm16) & 0xFFF0) << 4) | ((imm16) & 0x000F), \ + 0xF7E08000 | (((imm16) & 0xF000) << 4) | ((imm16) & 0x0FFF) \ +) + +#define __ERET __inst_arm_thumb32( \ + 0xE160006E, \ + 0xF3DE8F00 \ +) + +#define __MSR_ELR_HYP (regnum) __inst_arm_thumb32( \ + 0xE12EF300 | regnum, \ + 0xF3808E30 | (regnum << 16) \ +) + +#endif /* ! __ASM_ARM_OPCODES_VIRT_H */
arch/arm/include/asm/opcodes.h new file +231 -0
231 lines not on this page · raw message
include/linux/arm-smccc.h new file +134 -0
134 lines not on this page · raw message
Signature · 1 line
2.7.4
PATCH v3 1/3 ARM: import arm-smccc code from Linux 4.11-rc6
Quoted 10 lines · Masahiro Yamada
Imports ARM SMC Calling Convention code from Linux 4.11-rc6. The files have been copied as follows:
[Linux] [U-Boot]
arch/arm/kernel/smccc-call.S->arch/arm/cpu/armv7/smccc-call.Sarch/arm64/kernel/smccc-call.S->arch/arm/cpu/armv8/smccc-call.Sarch/arm/include/asm/opcodes*->arch/arm/include/asm/opcodes*include/linux/arm-smccc.h->include/linux/arm-smccc.hSigned-off-by Masahiro Yamada <[email protected]>
Applied to u-boot/master, thanks!
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 819 bytes Desc: Digital signature URL: <http://lists.denx.de/pipermail/u-boot/attachments/20170419/bb528278/attachment.sig>
PATCH v3 2/3 ARM: adjust arm-smccc code for use in U-Boot
In reply to Masahiro YamadaAdjust ARM SMC Calling Convention code for U-Boot:
- Replace the license block with SPDX
- Change path to asm-offsets.h
- Define UNWIND() as no-op
- Add Kconfig entry
- Add asm-offsets
---
Changes in v3:
- opcodes-virt.h is GPL-2.0+
Changes in v2:
- split into separate patches "import" and "adjust"
arch/arm/Kconfig | 8 ++++++++ arch/arm/cpu/armv7/Makefile | 1 + arch/arm/cpu/armv7/smccc-call.S | 12 ++---------- arch/arm/cpu/armv8/Makefile | 2 ++ arch/arm/cpu/armv8/smccc-call.S | 12 ++---------- arch/arm/include/asm/opcodes-sec.h | 11 ++--------- arch/arm/include/asm/opcodes-virt.h | 14 +------------- arch/arm/include/asm/opcodes.h | 4 +--- arch/arm/lib/asm-offsets.c | 8 ++++++++ include/linux/arm-smccc.h | 10 +--------- 10 files changed, 28 insertions(+), 54 deletions(-)
arch/arm/Kconfig +8 -0
@@ -174,6 +174,14 @@ config SYS_CACHELINE_SIZE default 64 if SYS_CACHE_SHIFT_6 default 32 if SYS_CACHE_SHIFT_5 +config ARM_SMCCC + bool "Support for ARM SMC Calling Convention (SMCCC)" + depends on CPU_V7 || ARM64 + help + Say Y here if you want to enable ARM SMC Calling Convention. + This should be enabled if U-Boot needs to communicate with system + firmware (for example, PSCI) according to SMCCC. + config SEMIHOSTING bool "support boot from semihosting" help
arch/arm/cpu/armv7/Makefile +1 -0
@@ -18,6 +18,7 @@ obj-y += lowlevel_init.o endif endif +obj-$(CONFIG_ARM_SMCCC) += smccc-call.o obj-$(CONFIG_ARMV7_NONSEC) += nonsec_virt.o virt-v7.o virt-dt.o obj-$(CONFIG_ARMV7_PSCI) += psci.o psci-common.o
arch/arm/cpu/armv7/smccc-call.S +2 -10
@@ -1,22 +1,14 @@ /* * Copyright (c) 2015, Linaro Limited * - * This software is licensed under the terms of the GNU General Public - * License version 2, as published by the Free Software Foundation, and - * may be copied, distributed, and modified under those terms. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * + * SPDX-License-Identifier: GPL-2.0 */ #include <linux/linkage.h> #include <asm/opcodes-sec.h> #include <asm/opcodes-virt.h> -#include <asm/unwind.h> +#define UNWIND(x...) /* * Wrap c macros in asm macros to delay expansion until after the * SMCCC asm macro is expanded.
arch/arm/cpu/armv8/Makefile +2 -0
@@ -16,6 +16,8 @@ obj-y += tlb.o obj-y += transition.o obj-y += fwcall.o obj-y += cpu-dt.o +obj-$(CONFIG_ARM_SMCCC) += smccc-call.o + ifndef CONFIG_SPL_BUILD obj-$(CONFIG_ARMV8_SPIN_TABLE) += spin_table.o spin_table_v8.o endif
arch/arm/cpu/armv8/smccc-call.S +2 -10
@@ -1,19 +1,11 @@ /* * Copyright (c) 2015, Linaro Limited * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License Version 2 as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * + * SPDX-License-Identifier: GPL-2.0 */ #include <linux/linkage.h> #include <linux/arm-smccc.h> -#include <asm/asm-offsets.h> +#include <generated/asm-offsets.h> .macro SMCCC instr .cfi_startproc
arch/arm/include/asm/opcodes-sec.h +2 -9
@@ -1,14 +1,7 @@/* -* This program is free software; you can redistribute it and/or modify -* it under the terms of the GNU General Public License version 2 as -* published by the Free Software Foundation. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* * Copyright (C) 2012 ARM Limited +* +* SPDX-License-Identifier: GPL-2.0 */ #ifndef __ASM_ARM_OPCODES_SEC_H
arch/arm/include/asm/opcodes-virt.h +1 -13
@@ -2,19 +2,7 @@* opcodes-virt.h: Opcode definitions for the ARM virtualization extensions * Copyright (C) 2012 Linaro Limited * -* This program is free software; you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation; either version 2 of the License, or -* (at your option) any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License along -* with this program; if not, write to the Free Software Foundation, Inc., -* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. +* SPDX-License-Identifier: GPL-2.0+ */ #ifndef __ASM_ARM_OPCODES_VIRT_H#define __ASM_ARM_OPCODES_VIRT_H
arch/arm/include/asm/opcodes.h +1 -3
@@ -1,9 +1,7 @@/* * arch/arm/include/asm/opcodes.h * -* This program is free software; you can redistribute it and/or modify -* it under the terms of the GNU General Public License version 2 as -* published by the Free Software Foundation. +* SPDX-License-Identifier: GPL-2.0 */ #ifndef __ASM_ARM_OPCODES_H
arch/arm/lib/asm-offsets.c +8 -0
@@ -14,6 +14,7 @@#include <common.h> #include <linux/kbuild.h> +#include <linux/arm-smccc.h> #if defined(CONFIG_MX25 ) || defined(CONFIG_MX27 ) || defined(CONFIG_MX35 ) \ || defined(CONFIG_MX51 ) || defined(CONFIG_MX53 )
@@ -198,5 +199,12 @@ int main(void)DEFINE (PLL_DP_HFS_MFN , offsetof(struct dpll , dp_hfs_mfn));#endif +#ifdef CONFIG_ARM_SMCCC +DEFINE (ARM_SMCCC_RES_X0_OFFS , offsetof(struct arm_smccc_res , a0)); +DEFINE (ARM_SMCCC_RES_X2_OFFS , offsetof(struct arm_smccc_res , a2)); +DEFINE (ARM_SMCCC_QUIRK_ID_OFFS , offsetof(struct arm_smccc_quirk , id)); +DEFINE (ARM_SMCCC_QUIRK_STATE_OFFS , offsetof(struct arm_smccc_quirk , state)); +#endif +return 0 ; }
include/linux/arm-smccc.h +1 -9
@@ -1,15 +1,7 @@/* * Copyright (c) 2015, Linaro Limited * -* This software is licensed under the terms of the GNU General Public -* License version 2, as published by the Free Software Foundation, and -* may be copied, distributed, and modified under those terms. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* +* SPDX-License-Identifier: GPL-2.0 */ #ifndef __LINUX_ARM_SMCCC_H#define __LINUX_ARM_SMCCC_H
Signature · 1 line
2.7.4
PATCH v3 2/3 ARM: adjust arm-smccc code for use in U-Boot
Quoted 8 lines · Masahiro Yamada
Adjust ARM SMC Calling Convention code for U-Boot:
- Replace the license block with SPDX
- Change path toasm-offsets.h
- DefineUNWIND()as no-op
- AddKconfigentry
- Add asm-offsetsSigned-off-by Masahiro Yamada <[email protected]>
Applied to u-boot/master, thanks!
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 819 bytes Desc: Digital signature URL: <http://lists.denx.de/pipermail/u-boot/attachments/20170419/3ca525eb/attachment.sig>
PATCH v3 3/3 sysreset: psci: support system reset in a generic way with PSCI
In reply to Masahiro YamadaIf the system is running PSCI firmware, the System Reset function (func ID: 0x80000009) is supposed to be handled by PSCI, that is, the SoC/board specific reset implementation should be moved to PSCI. U-Boot should call the PSCI service according to the arm-smccc manner.
The arm-smccc is supported on ARMv7 or later. Especially, ARMv8 generation SoCs are likely to run ARM Trusted Firmware BL31. In this case, U-Boot is a non-secure world boot loader, so it should not be able to reset the system directly.
---
Changes in v3: None
Changes in v2: None
arch/arm/Kconfig | 1 + drivers/Kconfig | 2 + drivers/Makefile | 5 +- drivers/firmware/Kconfig | 6 +++ drivers/firmware/Makefile | 2 + drivers/firmware/firmware-uclass.c | 11 +++++ drivers/firmware/psci.c | 94 ++++++++++++++++++++++++++++++++++++++ drivers/sysreset/Kconfig | 10 ++++ drivers/sysreset/Makefile | 1 + drivers/sysreset/sysreset_psci.c | 41 +++++++++++++++++ include/dm/uclass-id.h | 1 + include/linux/psci.h | 13 ++++++ 12 files changed, 185 insertions(+), 2 deletions(-) create mode 100644 drivers/firmware/Kconfig create mode 100644 drivers/firmware/Makefile create mode 100644 drivers/firmware/firmware-uclass.c create mode 100644 drivers/firmware/psci.c create mode 100644 drivers/sysreset/sysreset_psci.c
arch/arm/Kconfig +1 -0
@@ -177,6 +177,7 @@ config SYS_CACHELINE_SIZE config ARM_SMCCC bool "Support for ARM SMC Calling Convention (SMCCC)" depends on CPU_V7 || ARM64 + select ARM_PSCI_FW help Say Y here if you want to enable ARM SMC Calling Convention. This should be enabled if U-Boot needs to communicate with system
drivers/Kconfig +2 -0
@@ -22,6 +22,8 @@ source "drivers/dfu/Kconfig" source "drivers/dma/Kconfig" +source "drivers/firmware/Kconfig" + source "drivers/fpga/Kconfig" source "drivers/gpio/Kconfig"
drivers/Makefile +3 -2
@@ -23,7 +23,7 @@ obj-$(CONFIG_SPL_SERIAL_SUPPORT) += serial/ obj-$(CONFIG_SPL_SPI_SUPPORT) += spi/ obj-$(CONFIG_SPL_POWER_SUPPORT) += power/ power/pmic/ obj-$(CONFIG_SPL_POWER_SUPPORT) += power/regulator/ -obj-$(CONFIG_SPL_DRIVERS_MISC_SUPPORT) += misc/ sysreset/ +obj-$(CONFIG_SPL_DRIVERS_MISC_SUPPORT) += misc/ sysreset/ firmware/ obj-$(CONFIG_SPL_MTD_SUPPORT) += mtd/ obj-$(CONFIG_SPL_NAND_SUPPORT) += mtd/nand/ obj-$(CONFIG_SPL_ONENAND_SUPPORT) += mtd/onenand/
@@ -52,7 +52,7 @@ endif ifdef CONFIG_TPL_BUILD obj-$(CONFIG_TPL_I2C_SUPPORT) += i2c/ -obj-$(CONFIG_TPL_DRIVERS_MISC_SUPPORT) += misc/ sysreset/ +obj-$(CONFIG_TPL_DRIVERS_MISC_SUPPORT) += misc/ sysreset/ firmware/ obj-$(CONFIG_TPL_MMC_SUPPORT) += mmc/ obj-$(CONFIG_TPL_MPC8XXX_INIT_DDR_SUPPORT) += ddr/fsl/ obj-$(CONFIG_TPL_NAND_SUPPORT) += mtd/nand/
@@ -71,6 +71,7 @@ obj-y += block/ obj-$(CONFIG_BOOTCOUNT_LIMIT) += bootcount/ obj-$(CONFIG_CPU) += cpu/ obj-y += crypto/ +obj-y += firmware/ obj-$(CONFIG_FPGA) += fpga/ obj-y += hwmon/ obj-y += misc/
drivers/firmware/Kconfig new file +6 -0
@@ -0,0 +1,6 @@ +config FIRMWARE + bool + +config ARM_PSCI_FW + bool + select FIRMWARE
drivers/firmware/Makefile new file +2 -0
@@ -0,0 +1,2 @@ +obj-$(CONFIG_FIRMWARE) += firmware-uclass.o +obj-$(CONFIG_ARM_PSCI_FW) += psci.o
drivers/firmware/firmware-uclass.c new file +11 -0
@@ -0,0 +1,11 @@ +/* +* SPDX-License-Identifier: GPL-2.0+ +*/ + +#include <dm/uclass.h> + +/* Firmware access is platform-dependent. No generic code in uclass */ +UCLASS_DRIVER (firmware) = { + .id =UCLASS_FIRMWARE , + .name ="firmware" , +};
drivers/firmware/psci.c new file +94 -0
94 lines not on this page · raw message
drivers/sysreset/Kconfig +10 -0
@@ -13,4 +13,14 @@ config SYSRESET to effect a reset. The uclass will try all available drivers when reset_walk() is called. +if SYSRESET + +config SYSRESET_PSCI + bool "Enable support for PSCI System Reset" + depends on ARM_PSCI_FW + help + Enable PSCI SYSTEM_RESET function call. To use this, PSCI firmware + must be running on your system. + +endif endmenu
drivers/sysreset/Makefile +1 -0
@@ -5,6 +5,7 @@ # obj-$(CONFIG_SYSRESET) += sysreset-uclass.o +obj-$(CONFIG_SYSRESET_PSCI) += sysreset_psci.o ifndef CONFIG_SPL_BUILD obj-$(CONFIG_ROCKCHIP_RK3036) += sysreset_rk3036.o
drivers/sysreset/sysreset_psci.c new file +41 -0
41 lines not on this page · raw message
include/dm/uclass-id.h +1 -0
@@ -35,6 +35,7 @@ enum uclass_id {UCLASS_DMA ,/* Direct Memory Access */ UCLASS_ETH ,/* Ethernet device */ UCLASS_GPIO ,/* Bank of general-purpose I/O pins */ +UCLASS_FIRMWARE ,/* Firmware */ UCLASS_I2C ,/* I2C bus */ UCLASS_I2C_EEPROM ,/* I2C EEPROM device */ UCLASS_I2C_GENERIC, /* Generic I2C device */
include/linux/psci.h +13 -0
@@ -87,4 +87,17 @@#define PSCI_RET_NOT_PRESENT -7#define PSCI_RET_DISABLED -8 +#ifdef CONFIG_ARM_PSCI_FW +typedef unsigned long (psci_fn )(unsigned long ,unsigned long , +unsigned long ,unsigned long ); + +extern psci_fn *invoke_psci_fn; +#else +unsigned long invoke_psci_fn (unsigned long a0,unsigned long a1, +unsigned long a2,unsigned long a3) +{ +return PSCI_RET_DISABLED ; +} +#endif +#endif /* _UAPI_LINUX_PSCI_H */
Signature · 1 line
2.7.4
PATCH v3 3/3 sysreset: psci: support system reset in a generic way with PSCI
Quoted 6 lines · Masahiro Yamada
If the system is running PSCI firmware, the System Reset function (func ID:
0x80000009) is supposed to be handled by PSCI, that is, the SoC/board specific reset implementation should be moved to PSCI. U-Boot should call the PSCI service according to the arm-smccc manner.
Quoted 6 lines
The arm-smccc is supported on ARMv7 or later. Especially, ARMv8 generation SoCs are likely to run ARM Trusted Firmware BL31. In this case, U-Boot is a non-secure world boot loader, so it should not be able to reset the system directly.
Signed-off-by Masahiro Yamada <[email protected]>
Applied to u-boot/master, thanks!
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 819 bytes Desc: Digital signature URL: <http://lists.denx.de/pipermail/u-boot/attachments/20170419/ff7a4cc3/attachment.sig>