summaryrefslogtreecommitdiff
path: root/QcomModulePkg/Library/BootLib/MenuKeysDetection.c
diff options
context:
space:
mode:
authorJeevan Shriram <jshriram@codeaurora.org>2018-03-12 16:45:59 -0700
committerMukesh Ojha <mojha@codeaurora.org>2018-03-29 23:46:11 +0530
commit9f8489e12383a3b867a64764990284c800abe782 (patch)
tree5b1ff33291fb67a261b31ff8292422042daf3cfa /QcomModulePkg/Library/BootLib/MenuKeysDetection.c
parentd35e99fcab4c60d264cae8a087d5f52501880b15 (diff)
QcomModulePkg: Add support for read/write in NAND partitions
Add support to read and write from NAND partitions by generating NAND GUID through protocol. Change-Id: Ib2769e9cf313efafb84786e554337810cd24a140
Diffstat (limited to 'QcomModulePkg/Library/BootLib/MenuKeysDetection.c')
-rw-r--r--QcomModulePkg/Library/BootLib/MenuKeysDetection.c24
1 files changed, 19 insertions, 5 deletions
diff --git a/QcomModulePkg/Library/BootLib/MenuKeysDetection.c b/QcomModulePkg/Library/BootLib/MenuKeysDetection.c
index 38b8a1cb23..42e79eb6f5 100644
--- a/QcomModulePkg/Library/BootLib/MenuKeysDetection.c
+++ b/QcomModulePkg/Library/BootLib/MenuKeysDetection.c
@@ -1,4 +1,4 @@
-/* Copyright (c) 2016-2017, The Linux Foundation. All rights reserved.
+/* Copyright (c) 2016-2018, The Linux Foundation. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
@@ -39,6 +39,7 @@
#include <Library/UefiBootServicesTableLib.h>
#include <Library/UnlockMenu.h>
#include <Library/VerifiedBootMenu.h>
+#include <Library/Board.h>
#include <Uefi.h>
#include <Protocol/EFIVerifiedBoot.h>
@@ -100,10 +101,15 @@ STATIC VOID
UpdateDeviceStatus (OPTION_MENU_INFO *MsgInfo, INTN Reason)
{
CHAR8 FfbmPageBuffer[FFBM_MODE_BUF_SIZE] = "";
+ EFI_STATUS Status = EFI_SUCCESS;
+ EFI_GUID Ptype = gEfiMiscPartitionGuid;
+ MemCardType CardType = UNKNOWN;
/* Clear the screen */
gST->ConOut->ClearScreen (gST->ConOut);
+ CardType = CheckRootDeviceType ();
+
switch (Reason) {
case RECOVER:
if (MsgInfo->Info.MenuType == DISPLAY_MENU_UNLOCK ||
@@ -133,14 +139,22 @@ UpdateDeviceStatus (OPTION_MENU_INFO *MsgInfo, INTN Reason)
break;
case FFBM:
AsciiSPrint (FfbmPageBuffer, sizeof (FfbmPageBuffer), "ffbm-00");
- WriteToPartition (&gEfiMiscPartitionGuid, FfbmPageBuffer,
- sizeof (FfbmPageBuffer));
+ if (CardType == NAND) {
+ Status = GetNandMiscPartiGuid (&Ptype);
+ }
+ if (Status == EFI_SUCCESS) {
+ WriteToPartition (&Ptype, FfbmPageBuffer, sizeof (FfbmPageBuffer));
+ }
RebootDevice (NORMAL_MODE);
break;
case QMMI:
AsciiSPrint (FfbmPageBuffer, sizeof (FfbmPageBuffer), "ffbm-02");
- WriteToPartition (&gEfiMiscPartitionGuid, FfbmPageBuffer,
- sizeof (FfbmPageBuffer));
+ if (CardType == NAND) {
+ Status = GetNandMiscPartiGuid (&Ptype);
+ }
+ if (Status == EFI_SUCCESS) {
+ WriteToPartition (&Ptype, FfbmPageBuffer, sizeof (FfbmPageBuffer));
+ }
RebootDevice (NORMAL_MODE);
break;
}