From patchwork Tue Dec 15 05:56:58 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Stultz X-Patchwork-Id: 58375 Delivered-To: patches@linaro.org Received: by 10.112.73.68 with SMTP id j4csp1921578lbv; Mon, 14 Dec 2015 21:57:04 -0800 (PST) X-Received: by 10.67.24.104 with SMTP id ih8mr52173364pad.124.1450159024629; Mon, 14 Dec 2015 21:57:04 -0800 (PST) Return-Path: Received: from mail-pf0-x22c.google.com (mail-pf0-x22c.google.com. [2607:f8b0:400e:c00::22c]) by mx.google.com with ESMTPS id cy6si14182227pad.242.2015.12.14.21.57.04 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 14 Dec 2015 21:57:04 -0800 (PST) Received-SPF: pass (google.com: domain of john.stultz@linaro.org designates 2607:f8b0:400e:c00::22c as permitted sender) client-ip=2607:f8b0:400e:c00::22c; Authentication-Results: mx.google.com; spf=pass (google.com: domain of john.stultz@linaro.org designates 2607:f8b0:400e:c00::22c as permitted sender) smtp.mailfrom=john.stultz@linaro.org; dkim=pass header.i=@linaro.org Received: by pff63 with SMTP id 63so24596347pff.2 for ; Mon, 14 Dec 2015 21:57:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id; bh=ib2zbXGyPHLviFv/2e/jy/wbOHioyN+LxfMOcTlXH3c=; b=MFPQXBQK+qeoDSv0EJrxKG+GHer5p8ULpZJc4ZnMIi0hVT6n6B6xslWOWs8FTh/WeB M+RpV3hdq3+nXEIKT7jovZgUbxXd6BFQCGEX/PZaFyuaQiXbBsjyr+YWBaMNfCSjpwj3 a8UDF0gSR/jRwrdihaOhO41radCEuriT2+5ck= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=ib2zbXGyPHLviFv/2e/jy/wbOHioyN+LxfMOcTlXH3c=; b=jbwz1ksNAXDPPIOF+GoJueeTtLRESm8ucxz4JWSqE4dswTsprztBGK5wcWUXw70n6x GGMNcSSDLD1M1Flvtjx9cLIOxGe2cRj0UR17gcoPIu4JyNcB16fxPNQaznmh0w5t/wyO UNx3c8dDZa6yjdx22rgthpKYJ9CK5HCowbMlyocWfug1rFppkBebQbcEq+IRoUMzY6om K/hXvaVv9MQDB4TzfW8BYzuVDgWKwIXfMgiLFpSFyrSOvt9ziOWfuSp4nXKqUH0RhcXR 3WikNsdUdDFhFNTD8ion5dVpaCvPn579sD4wwoU9HJL4vTnx3cwLHU0uxp9TO8++RVPX sTRg== X-Gm-Message-State: ALoCoQknhagPEjWobn1qNR2Cgtr7cQkYAqKZcq1of4nrQGOXGQYK1AuWCBZyaRs+FJUN40DKcou0Yq5HeupKS9lLDOpQw/cxTQ== X-Received: by 10.98.80.69 with SMTP id e66mr22290175pfb.66.1450159024170; Mon, 14 Dec 2015 21:57:04 -0800 (PST) Return-Path: Received: from localhost.localdomain (c-76-115-103-22.hsd1.or.comcast.net. [76.115.103.22]) by smtp.gmail.com with ESMTPSA id xi8sm46521526pab.9.2015.12.14.21.57.03 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 14 Dec 2015 21:57:03 -0800 (PST) From: John Stultz To: Cc: John Stultz , Vishal Bhoj , haojian.zhuang@linaro.org, guodong.xu@linaro.org Subject: [RFC][PATCH] linaro-edk2: Enable "adb reboot bootloader" support Date: Mon, 14 Dec 2015 21:56:58 -0800 Message-Id: <1450159018-13526-1-git-send-email-john.stultz@linaro.org> X-Mailer: git-send-email 1.9.1 This allows the bootloader to user a reserved page to read if the kernel requested we boot into fastboot mode or normal bootup. This allows users to reboot into fastboot mode w/o having to modify jumpers on J15 This change requires the kernel to support the communication of the reboot reason to the bootloader. Cc: Vishal Bhoj Cc: haojian.zhuang@linaro.org Cc: guodong.xu@linaro.org Signed-off-by: John Stultz --- .../HiKeyPkg/Drivers/HiKeyDxe/InstallBootMenu.c | 22 ++++++++++++++++++++++ HisiPkg/HiKeyPkg/Library/HiKeyLib/HiKeyMem.c | 1 + 2 files changed, 23 insertions(+) -- 1.9.1 diff --git a/HisiPkg/HiKeyPkg/Drivers/HiKeyDxe/InstallBootMenu.c b/HisiPkg/HiKeyPkg/Drivers/HiKeyDxe/InstallBootMenu.c index 84fdea1..ebe7f13 100644 --- a/HisiPkg/HiKeyPkg/Drivers/HiKeyDxe/InstallBootMenu.c +++ b/HisiPkg/HiKeyPkg/Drivers/HiKeyDxe/InstallBootMenu.c @@ -375,6 +375,27 @@ HiKeyTestLed ( } } + +#define REBOOT_REASON_ADDR 0x05F01000 +#define REBOOT_REASON_BOOTLOADER 0x77665500 +#define REBOOT_REASON_NONE 0x77665501 +STATIC +VOID +EFIAPI +HiKeyDetectRebootReason ( + IN VOID + ) +{ + UINT32 *addr = (UINT32*)REBOOT_REASON_ADDR; + UINT32 val; + + val = *addr; + if (val == REBOOT_REASON_BOOTLOADER) { + mBootIndex = 0; + } + return; +} + STATIC VOID EFIAPI @@ -540,6 +561,7 @@ HiKeyOnEndOfDxe ( } HiKeyDetectJumper (); + HiKeyDetectRebootReason (); // Check boot device. // If boot device is eMMC, it's always higher priority. diff --git a/HisiPkg/HiKeyPkg/Library/HiKeyLib/HiKeyMem.c b/HisiPkg/HiKeyPkg/Library/HiKeyLib/HiKeyMem.c index d7d15b5..e0ae73f 100644 --- a/HisiPkg/HiKeyPkg/Library/HiKeyLib/HiKeyMem.c +++ b/HisiPkg/HiKeyPkg/Library/HiKeyLib/HiKeyMem.c @@ -37,6 +37,7 @@ STATIC struct HiKeyReservedMemory { EFI_PHYSICAL_ADDRESS Size; } HiKeyReservedMemoryBuffer [] = { { 0x05E00000, 0x00100000 }, // MCU + { 0x05F01000, 0x00001000 }, // ADB REBOOT "REASON" { 0x06DFF000, 0x00001000 }, // MAILBOX { 0x0740F000, 0x00001000 }, // MAILBOX { 0x3E000000, 0x02000000 } // TEE OS