From 454eef0d67e82b7ce04bee76069b0d69da2deea6 Mon Sep 17 00:00:00 2001 From: Konstantin Aladyshev Date: Fri, 5 Aug 2022 16:57:53 +0300 Subject: PCDLesson updates Signed-off-by: Konstantin Aladyshev --- .../Lesson_25/UefiLessonsPkg/PCDLesson/PCDLesson.c | 68 ++++++++++++++ .../UefiLessonsPkg/PCDLesson/PCDLesson.inf | 71 ++++++++++++++ .../Lesson_25/UefiLessonsPkg/UefiLessonsPkg.dec | 103 +++++++++++++++++++++ .../Lesson_25/UefiLessonsPkg/UefiLessonsPkg.dsc | 98 ++++++++++++++++++++ 4 files changed, 340 insertions(+) create mode 100644 Lessons/Lesson_25/UefiLessonsPkg/PCDLesson/PCDLesson.c create mode 100644 Lessons/Lesson_25/UefiLessonsPkg/PCDLesson/PCDLesson.inf create mode 100644 Lessons/Lesson_25/UefiLessonsPkg/UefiLessonsPkg.dec create mode 100644 Lessons/Lesson_25/UefiLessonsPkg/UefiLessonsPkg.dsc (limited to 'Lessons/Lesson_25') diff --git a/Lessons/Lesson_25/UefiLessonsPkg/PCDLesson/PCDLesson.c b/Lessons/Lesson_25/UefiLessonsPkg/PCDLesson/PCDLesson.c new file mode 100644 index 0000000..0fca03d --- /dev/null +++ b/Lessons/Lesson_25/UefiLessonsPkg/PCDLesson/PCDLesson.c @@ -0,0 +1,68 @@ +/* + * Copyright (c) 2021, Konstantin Aladyshev + * + * SPDX-License-Identifier: MIT + */ + +#include +#include + +#include +#include + +EFI_STATUS +EFIAPI +UefiMain ( + IN EFI_HANDLE ImageHandle, + IN EFI_SYSTEM_TABLE *SystemTable + ) +{ + Print(L"PcdInt8=0x%x\n", FixedPcdGet8(PcdInt8)); + Print(L"PcdInt16=0x%x\n", FixedPcdGet16(PcdInt16)); + Print(L"PcdInt32=0x%x\n", FixedPcdGet32(PcdInt32)); + Print(L"PcdInt64=0x%x\n", FixedPcdGet64(PcdInt64)); + Print(L"PcdBool=0x%x\n", FixedPcdGetBool(PcdBool)); + Print(L"PcdInt8=0x%x\n", PcdGet8(PcdInt8)); + Print(L"PcdInt16=0x%x\n", PcdGet16(PcdInt16)); + Print(L"PcdInt32=0x%x\n", PcdGet32(PcdInt32)); + Print(L"PcdInt64=0x%x\n", PcdGet64(PcdInt64)); + Print(L"PcdIntBool=0x%x\n", PcdGetBool(PcdBool)); + + Print(L"PcdAsciiStr=%a\n", FixedPcdGetPtr(PcdAsciiStr)); + Print(L"PcdAsciiStrSize=%d\n", FixedPcdGetSize(PcdAsciiStr)); + Print(L"PcdUCS2Str=%s\n", PcdGetPtr(PcdUCS2Str)); + Print(L"PcdUCS2StrSize=%d\n", PcdGetSize(PcdUCS2Str)); + + for (UINTN i=0; i +# +# SPDX-License-Identifier: MIT +## + +[Defines] + INF_VERSION = 1.25 + BASE_NAME = PCDLesson + FILE_GUID = 8c1a6b71-0c4b-4497-aaad-07404edf142c + MODULE_TYPE = UEFI_APPLICATION + VERSION_STRING = 1.0 + ENTRY_POINT = UefiMain + +[Sources] + PCDLesson.c + +[Packages] + MdePkg/MdePkg.dec + UefiLessonsPkg/UefiLessonsPkg.dec + +[LibraryClasses] + UefiApplicationEntryPoint + UefiLib + +[FixedPcd] + gUefiLessonsPkgTokenSpaceGuid.PcdInt8 + gUefiLessonsPkgTokenSpaceGuid.PcdInt16 + gUefiLessonsPkgTokenSpaceGuid.PcdInt32 + gUefiLessonsPkgTokenSpaceGuid.PcdInt64 + gUefiLessonsPkgTokenSpaceGuid.PcdBool + gUefiLessonsPkgTokenSpaceGuid.PcdExpression + gUefiLessonsPkgTokenSpaceGuid.PcdExpression_1 + gUefiLessonsPkgTokenSpaceGuid.PcdExpression_2 + gUefiLessonsPkgTokenSpaceGuid.PcdExpression_3 + gUefiLessonsPkgTokenSpaceGuid.PcdAsciiStr + gUefiLessonsPkgTokenSpaceGuid.PcdUCS2Str + gUefiLessonsPkgTokenSpaceGuid.PcdArray + gUefiLessonsPkgTokenSpaceGuid.PcdGuidInBytes + gUefiLessonsPkgTokenSpaceGuid.PcdGuid + gUefiLessonsPkgTokenSpaceGuid.PcdGuidByPCD + gUefiLessonsPkgTokenSpaceGuid.PcdGuidByEfiGuid + gUefiLessonsPkgTokenSpaceGuid.PcdDevicePath + gUefiLessonsPkgTokenSpaceGuid.PcdIntCasts + gUefiLessonsPkgTokenSpaceGuid.PcdWithLabels + gUefiLessonsPkgTokenSpaceGuid.PcdArrayExt + gUefiLessonsPkgTokenSpaceGuid.PcdCustomStruct + gUefiLessonsPkgTokenSpaceGuid.PcdCustomStruct_1 + gUefiLessonsPkgTokenSpaceGuid.PcdArrayWithFixedSize + gUefiLessonsPkgTokenSpaceGuid.PcdArrayWithFixedSize_1 + gUefiLessonsPkgTokenSpaceGuid.PcdArrayWithFixedSize_2 + gUefiLessonsPkgTokenSpaceGuid.PcdArrayWithFixedSize_3 + gUefiLessonsPkgTokenSpaceGuid.PcdArrayWithFixedSize_4 + + gUefiLessonsPkgTokenSpaceGuid.PcdInt32Override|43 + + gUefiLessonsPkgTokenSpaceGuid.Region1Offset + gUefiLessonsPkgTokenSpaceGuid.Region1Size + +[FeaturePcd] + gUefiLessonsPkgTokenSpaceGuid.PcdFeatureFlag + +[PatchPcd] + gUefiLessonsPkgTokenSpaceGuid.PcdPatchableInt32 + +[Pcd] + gUefiLessonsPkgTokenSpaceGuid.PcdDynamicInt32 + +[PcdEx] + gUefiLessonsPkgTokenSpaceGuid.PcdDynamicExInt32 + diff --git a/Lessons/Lesson_25/UefiLessonsPkg/UefiLessonsPkg.dec b/Lessons/Lesson_25/UefiLessonsPkg/UefiLessonsPkg.dec new file mode 100644 index 0000000..a841f53 --- /dev/null +++ b/Lessons/Lesson_25/UefiLessonsPkg/UefiLessonsPkg.dec @@ -0,0 +1,103 @@ +## +# Copyright (c) 2021, Konstantin Aladyshev +# +# SPDX-License-Identifier: MIT +## + +[Defines] + DEC_SPECIFICATION = 0x00010005 + PACKAGE_NAME = UefiLessonsPkg + PACKAGE_GUID = 7e7edbba-ca2c-4177-a3f0-d3371358773a + PACKAGE_VERSION = 1.01 + +[Includes] + Include + +[Guids] + # FILE_GUID as defined in UefiLessonsPkg/HelloWorld/HelloWorld.inf + gHelloWorldFileGuid = {0x2e55fa38, 0xf148, 0x42d3, {0xaf, 0x90, 0x1b, 0xe2, 0x47, 0x32, 0x3e, 0x30}} + gUefiLessonsPkgTokenSpaceGuid = {0x150cab53, 0xad47, 0x4385, {0xb5, 0xdd, 0xbc, 0xfc, 0x76, 0xba, 0xca, 0xf0}} + gHIIStringsCGuid = { 0x8e0b8ed3, 0x14f7, 0x499d, { 0xa2, 0x24, 0xae, 0xe8, 0x9d, 0xc9, 0x7f, 0xa3 }} + gHIIStringsUNIGuid = { 0x6ee19058, 0x0fe2, 0x44ed, { 0x89, 0x1c, 0xa5, 0xd7, 0xe1, 0x08, 0xee, 0x1a }} + gHIIStringsUNIRCGuid = { 0x785693b4, 0x623e, 0x40fa, { 0x9a, 0x45, 0x68, 0xda, 0x38, 0x30, 0x89, 0xdd }} + gHIIAddRussianFontGuid = { 0x9fe2f616, 0x323c, 0x45a7, { 0x87, 0xa2, 0xdf, 0xef, 0xf5, 0x17, 0xcc, 0x66 }} + +[Protocols] + gSimpleClassProtocolGuid = { 0xb5510eea, 0x6f11, 0x4e4b, { 0xad, 0x0f, 0x35, 0xce, 0x17, 0xbd, 0x7a, 0x67 }} + +[PcdsFixedAtBuild] + gUefiLessonsPkgTokenSpaceGuid.PcdInt8|0x88|UINT8|0x3B81CDF1 + gUefiLessonsPkgTokenSpaceGuid.PcdInt16|0x1616|UINT16|0x77DFB6E6 + gUefiLessonsPkgTokenSpaceGuid.PcdInt32|0x32323232|UINT32|0xF2A48130 + gUefiLessonsPkgTokenSpaceGuid.PcdInt64|0x6464646464646464|UINT64|0x652F4E29 + gUefiLessonsPkgTokenSpaceGuid.PcdBool|TRUE|BOOLEAN|0x69E88A63 + gUefiLessonsPkgTokenSpaceGuid.PcdExpression|0xFF000000 + 0x00FFFFFF|UINT32|0x9C405222 + gUefiLessonsPkgTokenSpaceGuid.PcdExpression_1|((0xFFFFFFFF & 0x000000FF) << 8) + 0x33|UINT32|0x5911C44B + gUefiLessonsPkgTokenSpaceGuid.PcdExpression_2|(0x00000000 | 0x00100000)|UINT32|0xAD880207 + gUefiLessonsPkgTokenSpaceGuid.PcdExpression_3|((56 < 78) || !(23 > 44))|BOOLEAN|0x45EDE955 + gUefiLessonsPkgTokenSpaceGuid.PcdAsciiStr|"hello"|VOID*|0xB29914B5 + gUefiLessonsPkgTokenSpaceGuid.PcdUCS2Str|L"hello"|VOID*|0xF22124E5 + gUefiLessonsPkgTokenSpaceGuid.PcdArray|{0xa5, 0xA6, 0xA7}|VOID*|0xD5DB9A27 + gUefiLessonsPkgTokenSpaceGuid.PcdGuidInBytes|{0x07, 0x07, 0x74, 0xF1, 0x1D, 0x69, 0x03, 0x42, 0xBF, 0xAB, 0x99, 0xE1, 0x32, 0xFA, 0x41, 0x66}|VOID*|0xB9E0CDC0 + gUefiLessonsPkgTokenSpaceGuid.PcdGuid|{GUID("f1740707-691d-4203-bfab-99e132fa4166")}|VOID*|0x7F2066F7 + gUefiLessonsPkgTokenSpaceGuid.PcdGuidByPCD|{GUID(gUefiLessonsPkgTokenSpaceGuid)}|VOID*|0x0860CCD5 + gUefiLessonsPkgTokenSpaceGuid.PcdGuidByEfiGuid|{GUID({0x150cab53, 0xad47, 0x4385, {0xb5, 0xdd, 0xbc, 0xfc, 0x76, 0xba, 0xca, 0xf0}})}|VOID*|0x613506D5 + gUefiLessonsPkgTokenSpaceGuid.PcdDevicePath|{DEVICE_PATH("PciRoot(0x0)/Pci(0x1,0x1)/Ata(0x0)")}|VOID*|0xC56EE1E2 + gUefiLessonsPkgTokenSpaceGuid.PcdIntCasts|{UINT16(0x1122), UINT32(0x33445566), UINT8(0x77), UINT64(0x8899aabbccddeeff)}|VOID*|0x647456A6 + gUefiLessonsPkgTokenSpaceGuid.PcdWithLabels|{ 0x0A, 0x0B, OFFSET_OF(End), 0x0C, LABEL(Start) 0x0D, LABEL(End) 0x0E, 0x0F, OFFSET_OF(Start) }|VOID*|0xD91A8BF6 + gUefiLessonsPkgTokenSpaceGuid.PcdArrayExt|{0x11, UINT16(0x2233), UINT32(0x44556677), L"hello", "world!", GUID("09b9b358-70bd-421e-bafb-4f97e2ac7d44")}|VOID*|0x7200C5DF + gUefiLessonsPkgTokenSpaceGuid.PcdCustomStruct|{0}|CustomStruct|0x535D4CB5 { + + UefiLessonsPkg/UefiLessonsPkg.dec + + CustomPcdTypes.h + } + gUefiLessonsPkgTokenSpaceGuid.PcdCustomStruct.Val8|0x11 + gUefiLessonsPkgTokenSpaceGuid.PcdCustomStruct.Val32[0]|0x22334455 + gUefiLessonsPkgTokenSpaceGuid.PcdCustomStruct.Val32[1]|0x66778899 + gUefiLessonsPkgTokenSpaceGuid.PcdCustomStruct.ValStruct.Guid|{GUID("f1740707-691d-4203-bfab-99e132fa4166")} + gUefiLessonsPkgTokenSpaceGuid.PcdCustomStruct.ValStruct.Name|L'Hello' + gUefiLessonsPkgTokenSpaceGuid.PcdCustomStruct.ValUnion.BitFields.Field2|0xF + + gUefiLessonsPkgTokenSpaceGuid.PcdCustomStruct_1|{CODE( + { + 0x11, + {0x22334455, 0x66778899}, + { + {0xf1740707, 0x691d, 0x4203, {0xbf, 0xab, 0x99, 0xe1, 0x32, 0xfa, 0x41, 0x66}}, + {0x0048, 0x0065, 0x006c, 0x006c, 0x006f, 0x0000} + }, + {{0x0, 0xf, 0x0}} + } + )}|CustomStruct|0xC1D6B9A7 { + + UefiLessonsPkg/UefiLessonsPkg.dec + + CustomPcdTypes.h + } + + gUefiLessonsPkgTokenSpaceGuid.PcdArrayWithFixedSize|{0x0}|UINT8[8]|0x4C4CB9A3 + gUefiLessonsPkgTokenSpaceGuid.PcdArrayWithFixedSize_1|{0x0}|UINT32[3]|0x285DAD21 + gUefiLessonsPkgTokenSpaceGuid.PcdArrayWithFixedSize_2|{UINT32(0x11223344), UINT32(0x55667788), UINT32(0x99aabbcc)}|UINT32[3]|0x25D6ED26 + gUefiLessonsPkgTokenSpaceGuid.PcdArrayWithFixedSize_3|{CODE({0x11223344, 0x55667788, 0x99aabbcc})}|UINT32[3]|0xE5BC424D + gUefiLessonsPkgTokenSpaceGuid.PcdArrayWithFixedSize_4|{0x0}|CustomStruct[2]|0x0D00EE44 { + + UefiLessonsPkg/UefiLessonsPkg.dec + + CustomPcdTypes.h + } + + gUefiLessonsPkgTokenSpaceGuid.PcdInt32Override|42|UINT32|0x3CB8ABB8 + +[PcdsFeatureFlag] + gUefiLessonsPkgTokenSpaceGuid.PcdFeatureFlag|TRUE|BOOLEAN|0x16DD586E + +[PcdsPatchableInModule] + gUefiLessonsPkgTokenSpaceGuid.PcdPatchableInt32|0x31313131|UINT32|0xFCDA11B5 + +[PcdsDynamic] + gUefiLessonsPkgTokenSpaceGuid.PcdDynamicInt32|0xCAFECAFE|UINT32|0x4F9259A3 + +[PcdsDynamicEx] + gUefiLessonsPkgTokenSpaceGuid.PcdDynamicExInt32|0xBABEBABE|UINT32|0xAF35F3B2 + diff --git a/Lessons/Lesson_25/UefiLessonsPkg/UefiLessonsPkg.dsc b/Lessons/Lesson_25/UefiLessonsPkg/UefiLessonsPkg.dsc new file mode 100644 index 0000000..f406e97 --- /dev/null +++ b/Lessons/Lesson_25/UefiLessonsPkg/UefiLessonsPkg.dsc @@ -0,0 +1,98 @@ +## +# Copyright (c) 2021, Konstantin Aladyshev +# +# SPDX-License-Identifier: MIT +## + +[Defines] + DSC_SPECIFICATION = 0x0001001C + PLATFORM_GUID = 3db7270f-ffac-4139-90a4-0ae68f3f8167 + PLATFORM_VERSION = 0.01 + PLATFORM_NAME = UefiLessonsPkg + SKUID_IDENTIFIER = DEFAULT + SUPPORTED_ARCHITECTURES = X64 + BUILD_TARGETS = DEBUG|RELEASE + FLASH_DEFINITION = UefiLessonsPkg/UefiLessonsPkg.fdf + + +[LibraryClasses] + #HobLib|MdePkg/Library/DxeHobLib/DxeHobLib.inf + #DxeServicesLib|MdePkg/Library/DxeServicesLib/DxeServicesLib.inf + UefiApplicationEntryPoint|MdePkg/Library/UefiApplicationEntryPoint/UefiApplicationEntryPoint.inf + UefiBootServicesTableLib|MdePkg/Library/UefiBootServicesTableLib/UefiBootServicesTableLib.inf + DebugLib|MdePkg/Library/UefiDebugLibConOut/UefiDebugLibConOut.inf + BaseLib|MdePkg/Library/BaseLib/BaseLib.inf + #PcdLib|MdePkg/Library/BasePcdLibNull/BasePcdLibNull.inf + PcdLib|MdePkg/Library/DxePcdLib/DxePcdLib.inf + BaseMemoryLib|MdePkg/Library/BaseMemoryLib/BaseMemoryLib.inf + RegisterFilterLib|MdePkg/Library/RegisterFilterLibNull/RegisterFilterLibNull.inf + PrintLib|MdePkg/Library/BasePrintLib/BasePrintLib.inf + DebugPrintErrorLevelLib|MdePkg/Library/BaseDebugPrintErrorLevelLib/BaseDebugPrintErrorLevelLib.inf + UefiLib|MdePkg/Library/UefiLib/UefiLib.inf + MemoryAllocationLib|MdePkg/Library/UefiMemoryAllocationLib/UefiMemoryAllocationLib.inf + DevicePathLib|MdePkg/Library/UefiDevicePathLib/UefiDevicePathLib.inf + UefiRuntimeServicesTableLib|MdePkg/Library/UefiRuntimeServicesTableLib/UefiRuntimeServicesTableLib.inf + ShellCEntryLib|ShellPkg/Library/UefiShellCEntryLib/UefiShellCEntryLib.inf + ShellLib|ShellPkg/Library/UefiShellLib/UefiShellLib.inf + FileHandleLib|MdePkg/Library/UefiFileHandleLib/UefiFileHandleLib.inf + HiiLib|MdeModulePkg/Library/UefiHiiLib/UefiHiiLib.inf + SortLib|MdeModulePkg/Library/UefiSortLib/UefiSortLib.inf + UefiHiiServicesLib|MdeModulePkg/Library/UefiHiiServicesLib/UefiHiiServicesLib.inf + UefiDriverEntryPoint|MdePkg/Library/UefiDriverEntryPoint/UefiDriverEntryPoint.inf + #SimpleLibrary|UefiLessonsPkg/Library/SimpleLibrary/SimpleLibrary.inf + #SimpleLibrary|UefiLessonsPkg/Library/SimpleLibraryWithConstructor/SimpleLibraryWithConstructor.inf + SimpleLibrary|UefiLessonsPkg/Library/SimpleLibraryWithConstructorAndDestructor/SimpleLibraryWithConstructorAndDestructor.inf + #PeimEntryPoint|MdePkg/Library/PeimEntryPoint/PeimEntryPoint.inf + +[Components] + #MdeModulePkg/Universal/PCD/Dxe/Pcd.inf + UefiLessonsPkg/SimplestApp/SimplestApp.inf + UefiLessonsPkg/HelloWorld/HelloWorld.inf + UefiLessonsPkg/ImageHandle/ImageHandle.inf + UefiLessonsPkg/ImageInfo/ImageInfo.inf + UefiLessonsPkg/MemoryInfo/MemoryInfo.inf + UefiLessonsPkg/SimpleShellApp/SimpleShellApp.inf + UefiLessonsPkg/ListVariables/ListVariables.inf + UefiLessonsPkg/ShowBootVariables/ShowBootVariables.inf + UefiLessonsPkg/InteractiveApp/InteractiveApp.inf + UefiLessonsPkg/PCDLesson/PCDLesson.inf + UefiLessonsPkg/SmbiosInfo/SmbiosInfo.inf + UefiLessonsPkg/ShowTables/ShowTables.inf + UefiLessonsPkg/AcpiInfo/AcpiInfo.inf + UefiLessonsPkg/SaveBGRT/SaveBGRT.inf + UefiLessonsPkg/ListPCI/ListPCI.inf + UefiLessonsPkg/SimpleDriver/SimpleDriver.inf + UefiLessonsPkg/PCIRomInfo/PCIRomInfo.inf + UefiLessonsPkg/Library/SimpleLibrary/SimpleLibrary.inf + UefiLessonsPkg/Library/SimpleLibraryWithConstructor/SimpleLibraryWithConstructor.inf + UefiLessonsPkg/SimpleLibraryUser/SimpleLibraryUser.inf + UefiLessonsPkg/SimpleClassProtocol/SimpleClassProtocol.inf + UefiLessonsPkg/SimpleClassUser/SimpleClassUser.inf + UefiLessonsPkg/HotKeyDriver/HotKeyDriver.inf + UefiLessonsPkg/ShowHII/ShowHII.inf + UefiLessonsPkg/HIIStringsC/HIIStringsC.inf + UefiLessonsPkg/HIIStringsUNI/HIIStringsUNI.inf + UefiLessonsPkg/HIIStringsUNIRC/HIIStringsUNIRC.inf + UefiLessonsPkg/HIIStringsMan/HIIStringsMan.inf + UefiLessonsPkg/HIIAddRussianFont/HIIAddRussianFont.inf + UefiLessonsPkg/HIIAddLocalization/HIIAddLocalization.inf + UefiLessonsPkg/AddNewLanguage/AddNewLanguage.inf + UefiLessonsPkg/HIISimpleForm/HIISimpleForm.inf + #UefiLessonsPkg/HIIStaticForm/HIIStaticForm.inf + UefiLessonsPkg/HIIStaticFormDriver/HIIStaticFormDriver.inf + UefiLessonsPkg/DisplayHIIByGuid/DisplayHIIByGuid.inf + UefiLessonsPkg/SetVariableExample/SetVariableExample.inf + UefiLessonsPkg/UpdateDmpstoreDump/UpdateDmpstoreDump.inf + UefiLessonsPkg/HIIFormCheckbox/HIIFormCheckbox.inf + UefiLessonsPkg/HIIFormDataElements/HIIFormDataElements.inf + UefiLessonsPkg/HIIFormVarstore/HIIFormVarstore.inf + UefiLessonsPkg/HIIFormLabel/HIIFormLabel.inf + #UefiLessonsPkg/SimplePeiModule/SimplePeiModule.inf + UefiLessonsPkg/SimpleDxeDriver/SimpleDxeDriver.inf + #UefiLessonsPkg/BinaryModule/BinaryModule.inf + #UefiLessonsPkg/FlashAccessRaw/FlashAccessRaw.inf + UefiLessonsPkg/FfsFile/FfsFile.inf + +[PcdsFixedAtBuild] + gUefiLessonsPkgTokenSpaceGuid.PcdInt32Override|44 + -- cgit v1.2.3-18-g5258