diff options
author | Parth Dixit <parthd@codeaurora.org> | 2019-05-14 17:08:46 +0530 |
---|---|---|
committer | Parth Dixit <parthd@codeaurora.org> | 2019-05-29 16:55:38 +0530 |
commit | 3f4e4aa3fa315f56b28eee160c0cb070ffcabd8f (patch) | |
tree | 2cc358ee1891a053d63c5a58ad5a873b9f648f0a | |
parent | 4425f8ff0e74ed19ea440a28e5b1e14351f9055b (diff) |
QcomModulePkg : Update Partial bins support
Move updating of partial nodes inside update device tree.
Search for nodes only if it is defective.
Add support for adding a property to disable defective node.
Change-Id: Ic9a7d5c6bb43395a2739aebb2259bcdff5db4acf
-rw-r--r-- | QcomModulePkg/Library/BootLib/BootLinux.c | 11 | ||||
-rw-r--r-- | QcomModulePkg/Library/BootLib/PartialGoods.c | 52 | ||||
-rw-r--r-- | QcomModulePkg/Library/BootLib/UpdateDeviceTree.c | 11 |
3 files changed, 28 insertions, 46 deletions
diff --git a/QcomModulePkg/Library/BootLib/BootLinux.c b/QcomModulePkg/Library/BootLib/BootLinux.c index e95f2e18fe..dda9aa04e1 100644 --- a/QcomModulePkg/Library/BootLib/BootLinux.c +++ b/QcomModulePkg/Library/BootLib/BootLinux.c @@ -32,7 +32,6 @@ #include <Library/DeviceInfo.h> #include <Library/DrawUI.h> -#include <Library/PartialGoods.h> #include <Library/PartitionTableUpdate.h> #include <Library/ShutdownServices.h> #include <Library/VerifiedBootMenu.h> @@ -714,16 +713,6 @@ LoadAddrAndDTUpdate (BootParamlist *BootParamlistPtr) BootParamlistPtr->KernelSizeActual); } - if (FixedPcdGetBool (EnablePartialGoods)) { - Status = UpdatePartialGoodsNode - ((VOID *)BootParamlistPtr->DeviceTreeLoadAddr); - if (Status != EFI_SUCCESS) { - DEBUG ((EFI_D_ERROR, - "Failed to update device tree for partial goods, Status=%r\n", - Status)); - return Status; - } - } return EFI_SUCCESS; } diff --git a/QcomModulePkg/Library/BootLib/PartialGoods.c b/QcomModulePkg/Library/BootLib/PartialGoods.c index a4d282ec3a..6f4c7a34b3 100644 --- a/QcomModulePkg/Library/BootLib/PartialGoods.c +++ b/QcomModulePkg/Library/BootLib/PartialGoods.c @@ -172,8 +172,6 @@ FindNodeAndUpdateProperty (VOID *fdt, UINT32 Value) { struct SubNodeListNew *SNode = NULL; - CONST struct fdt_property *Prop = NULL; - INT32 PropLen = 0; INT32 SubNodeOffset = 0; INT32 ParentOffset = 0; INT32 Ret = 0; @@ -193,35 +191,19 @@ FindNodeAndUpdateProperty (VOID *fdt, /* Find the subnode */ SNode = &(Table->SubNode); - SubNodeOffset = fdt_subnode_offset (fdt, ParentOffset, SNode->SubNodeName); + SubNodeOffset = fdt_subnode_offset (fdt, ParentOffset, + SNode->SubNodeName); if (SubNodeOffset < 0) { - DEBUG ((EFI_D_INFO, "Subnode : %a is not present, ignore\n", + DEBUG ((EFI_D_INFO, "Subnode: %a is not present, ignore\n", SNode->SubNodeName)); continue; } - /* Find the property node and its length */ - Prop = fdt_get_property (fdt, SubNodeOffset, SNode->PropertyName, &PropLen); - if (!Prop) { - /* Need to continue with next SubNode List instead of bailing out*/ - DEBUG ((EFI_D_INFO, "Property: %a not found for (%a)\tLen:%d, continue " - "with next subnode\n", - SNode->PropertyName, SNode->SubNodeName, PropLen)); - continue; - } - - /* Replace the property value based on the property */ - if (AsciiStrnCmp (SNode->PropertyStr, - Prop->data, - fdt32_to_cpu (Prop->len))) { - DEBUG ((EFI_D_VERBOSE, "Property string mismatch (%a) with (%a)\n", - SNode->PropertyStr, Prop->data)); - continue; - } + /* Add/Replace the property with Replace string value */ + Ret = fdt_setprop (fdt, SubNodeOffset, SNode->PropertyName, + (CONST VOID *)SNode->ReplaceStr, + AsciiStrLen (SNode->ReplaceStr)+ 1); - /* Replace the property with Replace string value */ - Ret = fdt_setprop_inplace (fdt, SubNodeOffset, SNode->PropertyName, - (CONST VOID *)SNode->ReplaceStr, PropLen); if (!Ret) { DEBUG ((EFI_D_INFO, "Partial goods (%a) status property disabled\n", SNode->SubNodeName)); @@ -309,20 +291,23 @@ UpdatePartialGoodsNode (VOID *fdt) /* Read and update Multimedia Partial Goods Nodes */ Status = ReadMMPartialGoods (pChipInfoProtocol, &PartialGoodsMMValue); - if (Status != EFI_SUCCESS) - goto out; /* NOT a critical failure and need not error out.*/ + if (Status != EFI_SUCCESS) { + DEBUG ((EFI_D_INFO, "No mm partial goods found.\n")); + } - if (PartialGoodsMMValue) + if (PartialGoodsMMValue) { DEBUG ((EFI_D_INFO, "PartialGoods for Multimedia: 0x%x\n", PartialGoodsMMValue)); - FindNodeAndUpdateProperty (fdt, ARRAY_SIZE (PartialGoodsMmType), - &PartialGoodsMmType[0], PartialGoodsMMValue); + FindNodeAndUpdateProperty (fdt, ARRAY_SIZE (PartialGoodsMmType), + &PartialGoodsMmType[0], PartialGoodsMMValue); + } /* Read and update CPU Partial Goods nodes */ Status = ReadCpuPartialGoods (pChipInfoProtocol, PartialGoodsCpuValue); - if (Status != EFI_SUCCESS) - goto out; + if (Status != EFI_SUCCESS) { + DEBUG ((EFI_D_INFO, "No partial goods for cpu ss found.\n")); + } for (i = 0; i < MAX_CPU_CLUSTER; i++) { if (PartialGoodsCpuValue[i]) { @@ -334,8 +319,5 @@ UpdatePartialGoodsNode (VOID *fdt) } } - return Status; -out: - DEBUG ((EFI_D_VERBOSE, "Continue to boot...\n")); return EFI_SUCCESS; } diff --git a/QcomModulePkg/Library/BootLib/UpdateDeviceTree.c b/QcomModulePkg/Library/BootLib/UpdateDeviceTree.c index 58c9ffd70c..67a2ddebeb 100644 --- a/QcomModulePkg/Library/BootLib/UpdateDeviceTree.c +++ b/QcomModulePkg/Library/BootLib/UpdateDeviceTree.c @@ -39,6 +39,7 @@ #include <Protocol/EFIChipInfoTypes.h> #include <Protocol/EFIDDRGetConfig.h> #include <Protocol/EFIRng.h> +#include <Library/PartialGoods.h> #define NUM_SPLASHMEM_PROP_ELEM 4 #define DEFAULT_CELL_SIZE 2 @@ -593,6 +594,16 @@ UpdateDeviceTree (VOID *fdt, DEBUG ((EFI_D_VERBOSE, "End DT fstab node update: %lu ms\n", GetTimerCountms ())); + /* Check partial goods*/ + if (FixedPcdGetBool (EnablePartialGoods)) { + ret = UpdatePartialGoodsNode (fdt); + if (ret != EFI_SUCCESS) { + DEBUG ((EFI_D_ERROR, + "Failed to update device tree for partial goods, Status=%r\n", + ret)); + return ret; + } + } fdt_pack (fdt); return ret; |