Home | History | Annotate | Download | only in PlatformCpuInfoDxe
      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
      7   the terms and conditions of the BSD License that accompanies this distribution.
      9   The full text of the license may be found at
     11   http://opensource.org/licenses/bsd-license.php.
     13 
     15   THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
     17   WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
     19 
     21 
     23 Module Name:
     24 
     25   PlatformCpuInfoDxe.c
     26 
     27 Abstract:
     28   Platform Cpu Info driver to public platform related HOB data
     29 
     30 --*/
     31 
     32 #include "PlatformCpuInfoDxe.h"
     33 
     34 CHAR16    EfiPlatformCpuInfoVariable[] = L"PlatformCpuInfo";
     35 
     36 EFI_STATUS
     37 EFIAPI
     38 PlatformCpuInfoInit (
     39   IN EFI_HANDLE                         ImageHandle,
     40   IN EFI_SYSTEM_TABLE                   *SystemTable
     41   )
     42 {
     43   EFI_STATUS                  Status;
     44   EFI_PLATFORM_CPU_INFO       *PlatformCpuInfoPtr;
     45   EFI_PEI_HOB_POINTERS        GuidHob;
     46 
     47   //
     48   // Get Platform Cpu Info HOB
     49   //
     50   GuidHob.Raw = GetHobList ();
     51   while ((GuidHob.Raw = GetNextGuidHob (&gEfiPlatformCpuInfoGuid, GuidHob.Raw)) != NULL) {
     52     PlatformCpuInfoPtr = GET_GUID_HOB_DATA (GuidHob.Guid);
     53     GuidHob.Raw = GET_NEXT_HOB (GuidHob);
     54 
     55       //
     56       // Write the Platform CPU Info to volatile memory for runtime purposes.
     57       // This must be done in its own driver because SetVariable protocol is dependent on chipset,
     58       // which is dependent on CpuIo, PlatformInfo, and Metronome.
     59       //
     60       Status = gRT->SetVariable(
     61                       EfiPlatformCpuInfoVariable,
     62                       &gEfiVlv2VariableGuid,
     63                       EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS,
     64                       sizeof(EFI_PLATFORM_CPU_INFO),
     65                       PlatformCpuInfoPtr
     66                       );
     67       if (EFI_ERROR(Status)) {
     68         return Status;
     69       }
     70   }
     71 
     72    return EFI_SUCCESS;
     73 }
     74 
     75