From 86714ccd8e20acb7ac475c1fbd1338d3a918bc92 Mon Sep 17 00:00:00 2001 From: klu2 Date: Thu, 3 Dec 2009 05:59:57 +0000 Subject: According to PI specification, if token number can not be found for dynamic-ex type PCD, return EFI_NOT_FOUND but not ASSERT(). git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@9511 6f19259b-4bc3-4df7-8a09-765794883524 --- MdeModulePkg/Universal/PCD/Pei/Service.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) (limited to 'MdeModulePkg') diff --git a/MdeModulePkg/Universal/PCD/Pei/Service.c b/MdeModulePkg/Universal/PCD/Pei/Service.c index 200c0d4..a791ef7 100644 --- a/MdeModulePkg/Universal/PCD/Pei/Service.c +++ b/MdeModulePkg/Universal/PCD/Pei/Service.c @@ -2,7 +2,7 @@ The driver internal functions are implmented here. They build Pei PCD database, and provide access service to PCD database. -Copyright (c) 2006 - 2008, Intel Corporation +Copyright (c) 2006 - 2009, Intel Corporation All rights reserved. This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD License which accompanies this distribution. The full text of the license may be found at @@ -57,7 +57,10 @@ PeiRegisterCallBackWorker ( ASSERT (TokenNumber + 1 < PEI_NEX_TOKEN_NUMBER + 1); } else { TokenNumber = GetExPcdTokenNumber (Guid, ExTokenNumber); - + if (TokenNumber == PCD_INVALID_TOKEN_NUMBER) { + return EFI_NOT_FOUND; + } + // // TokenNumber Zero is reserved as PCD_INVALID_TOKEN_NUMBER. // We have to decrement TokenNumber by 1 to make it usable @@ -519,7 +522,10 @@ ExSetWorker ( } TokenNumber = GetExPcdTokenNumber (Guid, ExTokenNumber); - + if (TokenNumber == PCD_INVALID_TOKEN_NUMBER) { + return EFI_NOT_FOUND; + } + InvokeCallbackOnSet (ExTokenNumber, Guid, TokenNumber, Data, *Size); return SetWorker (TokenNumber, Data, Size, PtrType); @@ -702,9 +708,7 @@ GetExPcdTokenNumber ( } } - ASSERT (FALSE); - - return 0; + return PCD_INVALID_TOKEN_NUMBER; } /** -- cgit v1.1