aboutsummaryrefslogtreecommitdiffstats
path: root/Lessons/Lesson_20/UefiLessonsPkg/PCDLesson/PCDLesson.c
blob: 7cc7788de0ba486d2cbde88a5f7e5430293beda0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
/*
 * Copyright (c) 2021, Konstantin Aladyshev <aladyshev22@gmail.com>
 *
 * SPDX-License-Identifier: MIT
 */

#include <Library/UefiBootServicesTableLib.h>
#include <Library/UefiLib.h>

#include <Library/DevicePathLib.h>
#include <Library/PcdLib.h>

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<FixedPcdGetSize(PcdArray); i++) {
    Print(L"PcdArray[%d]=0x%02x\n", i, ((UINT8*)FixedPcdGetPtr(PcdArray))[i]);
  }

  Print(L"PcdGuidInBytes=%g\n", *(EFI_GUID*)FixedPcdGetPtr(PcdGuidInBytes));
  Print(L"PcdGuid=%g\n", *(EFI_GUID*)FixedPcdGetPtr(PcdGuid));

  Print(L"PcdDevicePath: %s\n", ConvertDevicePathToText((EFI_DEVICE_PATH_PROTOCOL*) FixedPcdGetPtr(PcdDevicePath), FALSE, FALSE));

  return EFI_SUCCESS;
}