From 9f8489e12383a3b867a64764990284c800abe782 Mon Sep 17 00:00:00 2001 From: Jeevan Shriram Date: Mon, 12 Mar 2018 16:45:59 -0700 Subject: 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 --- QcomModulePkg/Library/BootLib/MenuKeysDetection.c | 24 ++++++++++++++++++----- 1 file changed, 19 insertions(+), 5 deletions(-) (limited to 'QcomModulePkg/Library/BootLib/MenuKeysDetection.c') 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 #include #include +#include #include #include @@ -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; } -- cgit v1.2.3