summaryrefslogtreecommitdiffstats
path: root/OvmfPkg/Bhyve/SmbiosPlatformDxe/SmbiosPlatformDxe.c
diff options
context:
space:
mode:
Diffstat (limited to 'OvmfPkg/Bhyve/SmbiosPlatformDxe/SmbiosPlatformDxe.c')
-rw-r--r--OvmfPkg/Bhyve/SmbiosPlatformDxe/SmbiosPlatformDxe.c91
1 files changed, 44 insertions, 47 deletions
diff --git a/OvmfPkg/Bhyve/SmbiosPlatformDxe/SmbiosPlatformDxe.c b/OvmfPkg/Bhyve/SmbiosPlatformDxe/SmbiosPlatformDxe.c
index 59f5d77a3b..ba21393f8e 100644
--- a/OvmfPkg/Bhyve/SmbiosPlatformDxe/SmbiosPlatformDxe.c
+++ b/OvmfPkg/Bhyve/SmbiosPlatformDxe/SmbiosPlatformDxe.c
@@ -20,34 +20,34 @@
//
#pragma pack(1)
typedef struct {
- SMBIOS_TABLE_TYPE0 Base;
- UINT8 Strings[sizeof(TYPE0_STRINGS)];
+ SMBIOS_TABLE_TYPE0 Base;
+ UINT8 Strings[sizeof (TYPE0_STRINGS)];
} OVMF_TYPE0;
#pragma pack()
-STATIC CONST OVMF_TYPE0 mOvmfDefaultType0 = {
+STATIC CONST OVMF_TYPE0 mOvmfDefaultType0 = {
{
// SMBIOS_STRUCTURE Hdr
{
EFI_SMBIOS_TYPE_BIOS_INFORMATION, // UINT8 Type
sizeof (SMBIOS_TABLE_TYPE0), // UINT8 Length
},
- 1, // SMBIOS_TABLE_STRING Vendor
- 2, // SMBIOS_TABLE_STRING BiosVersion
- 0xE800,// UINT16 BiosSegment
- 3, // SMBIOS_TABLE_STRING BiosReleaseDate
- 0, // UINT8 BiosSize
+ 1, // SMBIOS_TABLE_STRING Vendor
+ 2, // SMBIOS_TABLE_STRING BiosVersion
+ 0xE800, // UINT16 BiosSegment
+ 3, // SMBIOS_TABLE_STRING BiosReleaseDate
+ 0, // UINT8 BiosSize
{ // MISC_BIOS_CHARACTERISTICS BiosCharacteristics
- 0, // Reserved :2
- 0, // Unknown :1
- 1, // BiosCharacteristicsNotSupported :1
- // Remaining BiosCharacteristics bits left unset :60
+ 0, // Reserved :2
+ 0, // Unknown :1
+ 1, // BiosCharacteristicsNotSupported :1
+ // Remaining BiosCharacteristics bits left unset :60
},
{ // BIOSCharacteristicsExtensionBytes[2]
- 0, // BiosReserved
- 0x1C // SystemReserved = VirtualMachineSupported |
- // UefiSpecificationSupported |
- // TargetContentDistributionEnabled
+ 0, // BiosReserved
+ 0x1C // SystemReserved = VirtualMachineSupported |
+ // UefiSpecificationSupported |
+ // TargetContentDistributionEnabled
},
0, // UINT8 SystemBiosMajorRelease
0, // UINT8 SystemBiosMinorRelease
@@ -58,7 +58,6 @@ STATIC CONST OVMF_TYPE0 mOvmfDefaultType0 = {
TYPE0_STRINGS
};
-
/**
Validates the SMBIOS entry point structure
@@ -73,17 +72,17 @@ IsEntryPointStructureValid (
IN SMBIOS_TABLE_ENTRY_POINT *EntryPointStructure
)
{
- UINTN Index;
- UINT8 Length;
- UINT8 Checksum;
- UINT8 *BytePtr;
+ UINTN Index;
+ UINT8 Length;
+ UINT8 Checksum;
+ UINT8 *BytePtr;
- BytePtr = (UINT8*) EntryPointStructure;
- Length = EntryPointStructure->EntryPointLength;
+ BytePtr = (UINT8 *)EntryPointStructure;
+ Length = EntryPointStructure->EntryPointLength;
Checksum = 0;
for (Index = 0; Index < Length; Index++) {
- Checksum = Checksum + (UINT8) BytePtr[Index];
+ Checksum = Checksum + (UINT8)BytePtr[Index];
}
if (Checksum != 0) {
@@ -93,7 +92,6 @@ IsEntryPointStructureValid (
}
}
-
/**
Get SMBIOS record length.
@@ -102,7 +100,7 @@ IsEntryPointStructureValid (
**/
UINTN
SmbiosTableLength (
- IN SMBIOS_STRUCTURE_POINTER SmbiosTable
+ IN SMBIOS_STRUCTURE_POINTER SmbiosTable
)
{
CHAR8 *AChar;
@@ -114,14 +112,14 @@ SmbiosTableLength (
// Each structure shall be terminated by a double-null (SMBIOS spec.7.1)
//
while ((*AChar != 0) || (*(AChar + 1) != 0)) {
- AChar ++;
+ AChar++;
}
+
Length = ((UINTN)AChar - (UINTN)SmbiosTable.Raw + 2);
return Length;
}
-
/**
Install all structures from the given SMBIOS structures block
@@ -131,8 +129,8 @@ SmbiosTableLength (
**/
EFI_STATUS
InstallAllStructures (
- IN EFI_SMBIOS_PROTOCOL *Smbios,
- IN UINT8 *TableAddress
+ IN EFI_SMBIOS_PROTOCOL *Smbios,
+ IN UINT8 *TableAddress
)
{
EFI_STATUS Status;
@@ -152,12 +150,12 @@ InstallAllStructures (
// Log the SMBIOS data for this structure
//
SmbiosHandle = SmbiosTable.Hdr->Handle;
- Status = Smbios->Add (
- Smbios,
- NULL,
- &SmbiosHandle,
- (EFI_SMBIOS_TABLE_HEADER*) SmbiosTable.Raw
- );
+ Status = Smbios->Add (
+ Smbios,
+ NULL,
+ &SmbiosHandle,
+ (EFI_SMBIOS_TABLE_HEADER *)SmbiosTable.Raw
+ );
ASSERT_EFI_ERROR (Status);
if (SmbiosTable.Hdr->Type == 0) {
@@ -175,19 +173,18 @@ InstallAllStructures (
// Add OVMF default Type 0 (BIOS Information) table
//
SmbiosHandle = SMBIOS_HANDLE_PI_RESERVED;
- Status = Smbios->Add (
- Smbios,
- NULL,
- &SmbiosHandle,
- (EFI_SMBIOS_TABLE_HEADER*) &mOvmfDefaultType0
- );
+ Status = Smbios->Add (
+ Smbios,
+ NULL,
+ &SmbiosHandle,
+ (EFI_SMBIOS_TABLE_HEADER *)&mOvmfDefaultType0
+ );
ASSERT_EFI_ERROR (Status);
}
return EFI_SUCCESS;
}
-
/**
Installs SMBIOS information for OVMF
@@ -201,8 +198,8 @@ InstallAllStructures (
EFI_STATUS
EFIAPI
SmbiosTablePublishEntry (
- IN EFI_HANDLE ImageHandle,
- IN EFI_SYSTEM_TABLE *SystemTable
+ IN EFI_HANDLE ImageHandle,
+ IN EFI_SYSTEM_TABLE *SystemTable
)
{
EFI_STATUS Status;
@@ -216,7 +213,7 @@ SmbiosTablePublishEntry (
Status = gBS->LocateProtocol (
&gEfiSmbiosProtocolGuid,
NULL,
- (VOID**)&Smbios
+ (VOID **)&Smbios
);
if (EFI_ERROR (Status)) {
return Status;
@@ -227,7 +224,7 @@ SmbiosTablePublishEntry (
//
EntryPointStructure = GetBhyveSmbiosTables ();
if (EntryPointStructure != NULL) {
- SmbiosTables = (UINT8*)(UINTN)EntryPointStructure->TableAddress;
+ SmbiosTables = (UINT8 *)(UINTN)EntryPointStructure->TableAddress;
}
if (SmbiosTables != NULL) {