From 0cda4601cf92ba1679ef8fbe00e3e4a77e185d2e Mon Sep 17 00:00:00 2001 From: Konstantin Aladyshev Date: Mon, 8 Aug 2022 14:53:25 +0300 Subject: Add PcdToken guard for Dynamic PCD Signed-off-by: Konstantin Aladyshev --- Lessons/Lesson_25/UefiLessonsPkg/PCDLesson/PCDLesson.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'Lessons/Lesson_25/UefiLessonsPkg/PCDLesson') diff --git a/Lessons/Lesson_25/UefiLessonsPkg/PCDLesson/PCDLesson.c b/Lessons/Lesson_25/UefiLessonsPkg/PCDLesson/PCDLesson.c index 904404f..a3ecfeb 100644 --- a/Lessons/Lesson_25/UefiLessonsPkg/PCDLesson/PCDLesson.c +++ b/Lessons/Lesson_25/UefiLessonsPkg/PCDLesson/PCDLesson.c @@ -57,9 +57,13 @@ UefiMain ( Print(L"Status=%r\n", Status); Print(L"PcdPatchableInt32=%d\n", PatchPcdGet32(PcdPatchableInt32)); //------- - Print(L"PcdDynamicInt32=0x%x\n", PcdGet32(PcdDynamicInt32)); - PcdSet32S(PcdDynamicInt32, 0xBEEFBEEF); - Print(L"PcdDynamicInt32=0x%x\n", PcdGet32(PcdDynamicInt32)); + if (PcdToken(PcdDynamicInt32)) { + Print(L"PcdDynamicInt32=0x%x\n", PcdGet32(PcdDynamicInt32)); + PcdSet32S(PcdDynamicInt32, 0xBEEFBEEF); + Print(L"PcdDynamicInt32=0x%x\n", PcdGet32(PcdDynamicInt32)); + } else { + Print(L"PcdDynamicInt32 token is unassigned\n"); + } Print(L"PcdDynamicExInt32=%x\n", PcdGetEx32(&gUefiLessonsPkgTokenSpaceGuid, PcdDynamicExInt32)); PcdSetEx32S(&gUefiLessonsPkgTokenSpaceGuid, PcdDynamicExInt32, 0x77777777); -- cgit v1.2.3-18-g5258