bcm27xx: update 6.1 patches to latest version
[openwrt/staging/dangole.git] / target / linux / bcm27xx / patches-6.1 / 950-1217-firmware-psci-Pass-given-partition-number-through.patch
1 From 6988ae7c909dc342322a82daaa3a95b78d038305 Mon Sep 17 00:00:00 2001
2 From: Phil Elwell <phil@raspberrypi.com>
3 Date: Mon, 11 Dec 2023 16:58:07 +0000
4 Subject: [PATCH] firmware/psci: Pass given partition number through
5
6 Pi 5 uses BL31 as its armstub file, so the reset goes via PSCI. Parse
7 any "reboot" parameter as a partition number to reboot into.
8 N.B. This code path is only used if reboot mode has been set to warm
9 or soft.
10
11 Signed-off-by: Phil Elwell <phil@raspberrypi.com>
12 ---
13 drivers/firmware/psci/psci.c | 9 ++++++++-
14 1 file changed, 8 insertions(+), 1 deletion(-)
15
16 --- a/drivers/firmware/psci/psci.c
17 +++ b/drivers/firmware/psci/psci.c
18 @@ -314,7 +314,14 @@ static int psci_sys_reset(struct notifie
19 * reset_type[30:0] = 0 (SYSTEM_WARM_RESET)
20 * cookie = 0 (ignored by the implementation)
21 */
22 - invoke_psci_fn(PSCI_FN_NATIVE(1_1, SYSTEM_RESET2), 0, 0, 0);
23 + // Allow extra arguments separated by spaces after
24 + // the partition number.
25 + unsigned long val;
26 + u8 partition = 0;
27 +
28 + if (data && sscanf(data, "%lu", &val) == 1 && val < 63)
29 + partition = val;
30 + invoke_psci_fn(PSCI_FN_NATIVE(1_1, SYSTEM_RESET2), 0, partition, 0);
31 } else {
32 invoke_psci_fn(PSCI_0_2_FN_SYSTEM_RESET, 0, 0, 0);
33 }