summaryrefslogtreecommitdiffstats
path: root/OvmfPkg/SmbiosPlatformDxe/EntryPoint.c
blob: e55d135504c1792725a395df8e3f10be4ca6319e (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
48
49
50
51
52
/** @file
  Find and extract SMBIOS data.

  SPDX-License-Identifier: BSD-2-Clause-Patent
**/

#include <Library/MemoryAllocationLib.h> // FreePool()
#include <OvmfPlatforms.h>               // CLOUDHV_DEVICE_ID

#include "SmbiosPlatformDxe.h"

/**
  Installs SMBIOS information for OVMF

  @param ImageHandle     Module's image handle
  @param SystemTable     Pointer of EFI_SYSTEM_TABLE

  @retval EFI_SUCCESS    Smbios data successfully installed
  @retval Other          Smbios data was not installed

**/
EFI_STATUS
EFIAPI
SmbiosTablePublishEntry (
  IN EFI_HANDLE        ImageHandle,
  IN EFI_SYSTEM_TABLE  *SystemTable
  )
{
  EFI_STATUS  Status;
  UINT8       *SmbiosTables;
  UINT16      HostBridgeDevId;

  Status = EFI_NOT_FOUND;
  //
  // Add SMBIOS data if found
  //
  HostBridgeDevId = PcdGet16 (PcdOvmfHostBridgePciDevId);
  if (HostBridgeDevId == CLOUDHV_DEVICE_ID) {
    SmbiosTables = GetCloudHvSmbiosTables ();
    if (SmbiosTables != NULL) {
      Status = InstallAllStructures (SmbiosTables);
    }
  } else {
    SmbiosTables = GetQemuSmbiosTables ();
    if (SmbiosTables != NULL) {
      Status = InstallAllStructures (SmbiosTables);
      FreePool (SmbiosTables);
    }
  }

  return Status;
}