2021-12-10 15:41:55 +01:00
|
|
|
/** @file
|
|
|
|
Find and extract SMBIOS data.
|
|
|
|
|
|
|
|
SPDX-License-Identifier: BSD-2-Clause-Patent
|
|
|
|
**/
|
|
|
|
|
|
|
|
#include <Library/MemoryAllocationLib.h> // FreePool()
|
2021-12-10 15:41:56 +01:00
|
|
|
#include <OvmfPlatforms.h> // CLOUDHV_DEVICE_ID
|
2021-12-10 15:41:55 +01:00
|
|
|
|
|
|
|
#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;
|
2021-12-10 15:41:56 +01:00
|
|
|
UINT16 HostBridgeDevId;
|
2021-12-10 15:41:55 +01:00
|
|
|
|
|
|
|
Status = EFI_NOT_FOUND;
|
|
|
|
//
|
2021-12-10 15:41:56 +01:00
|
|
|
// Add SMBIOS data if found
|
2021-12-10 15:41:55 +01:00
|
|
|
//
|
2021-12-10 15:41:56 +01:00
|
|
|
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);
|
|
|
|
}
|
2021-12-10 15:41:55 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
return Status;
|
|
|
|
}
|