]> git.proxmox.com Git - mirror_edk2.git/blob - Vlv2TbltDevicePkg/PlatformCpuInfoDxe/PlatformCpuInfoDxe.c
Upload BSD-licensed Vlv2TbltDevicePkg and Vlv2DeviceRefCodePkg to
[mirror_edk2.git] / Vlv2TbltDevicePkg / PlatformCpuInfoDxe / PlatformCpuInfoDxe.c
1 /** @file
2
3 Copyright (c) 2004 - 2014, Intel Corporation. All rights reserved.<BR>
4
5 This program and the accompanying materials are licensed and made available under
6 the terms and conditions of the BSD License that accompanies this distribution.
7 The full text of the license may be found at
8 http://opensource.org/licenses/bsd-license.php.
9
10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
12
13
14 Module Name:
15
16 PlatformCpuInfoDxe.c
17
18 Abstract:
19 Platform Cpu Info driver to public platform related HOB data
20
21 --*/
22
23 #include "PlatformCpuInfoDxe.h"
24
25 CHAR16 EfiPlatformCpuInfoVariable[] = L"PlatformCpuInfo";
26
27 EFI_STATUS
28 EFIAPI
29 PlatformCpuInfoInit (
30 IN EFI_HANDLE ImageHandle,
31 IN EFI_SYSTEM_TABLE *SystemTable
32 )
33 {
34 EFI_STATUS Status;
35 EFI_PLATFORM_CPU_INFO *PlatformCpuInfoPtr;
36 EFI_PEI_HOB_POINTERS GuidHob;
37
38 //
39 // Get Platform Cpu Info HOB
40 //
41 GuidHob.Raw = GetHobList ();
42 while ((GuidHob.Raw = GetNextGuidHob (&gEfiPlatformCpuInfoGuid, GuidHob.Raw)) != NULL) {
43 PlatformCpuInfoPtr = GET_GUID_HOB_DATA (GuidHob.Guid);
44 GuidHob.Raw = GET_NEXT_HOB (GuidHob);
45
46 //
47 // Write the Platform CPU Info to volatile memory for runtime purposes.
48 // This must be done in its own driver because SetVariable protocol is dependent on chipset,
49 // which is dependent on CpuIo, PlatformInfo, and Metronome.
50 //
51 Status = gRT->SetVariable(
52 EfiPlatformCpuInfoVariable,
53 &gEfiVlv2VariableGuid,
54 EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS,
55 sizeof(EFI_PLATFORM_CPU_INFO),
56 PlatformCpuInfoPtr
57 );
58 if (EFI_ERROR(Status)) {
59 return Status;
60 }
61 }
62
63 return EFI_SUCCESS;
64 }
65