Skip to content
This repository has been archived by the owner on Dec 14, 2023. It is now read-only.

Commit

Permalink
Revert "OvmfPkg: SmbiosPlatformDxe: move IsEntryPointStructureValid()…
Browse files Browse the repository at this point in the history
… to Xen.c"

This reverts commit a136af4.

bhyve smbios code wants to be a second user of the
IsEntryPointStructureValid() function.
  • Loading branch information
D Scott Phillips committed Mar 21, 2019
1 parent 89910a3 commit 3c74b29
Show file tree
Hide file tree
Showing 3 changed files with 50 additions and 35 deletions.
35 changes: 35 additions & 0 deletions OvmfPkg/SmbiosPlatformDxe/SmbiosPlatformDxe.c
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,41 @@ STATIC CONST OVMF_TYPE0 mOvmfDefaultType0 = {
};


/**
Validates the SMBIOS entry point structure
@param EntryPointStructure SMBIOS entry point structure
@retval TRUE The entry point structure is valid
@retval FALSE The entry point structure is not valid
**/
BOOLEAN
IsEntryPointStructureValid (
IN SMBIOS_TABLE_ENTRY_POINT *EntryPointStructure
)
{
UINTN Index;
UINT8 Length;
UINT8 Checksum;
UINT8 *BytePtr;

BytePtr = (UINT8*) EntryPointStructure;
Length = EntryPointStructure->EntryPointLength;
Checksum = 0;

for (Index = 0; Index < Length; Index++) {
Checksum = Checksum + (UINT8) BytePtr[Index];
}

if (Checksum != 0) {
return FALSE;
} else {
return TRUE;
}
}


/**
Get SMBIOS record length.
Expand Down
15 changes: 15 additions & 0 deletions OvmfPkg/SmbiosPlatformDxe/SmbiosPlatformDxe.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,4 +51,19 @@ GetQemuSmbiosTables (
VOID
);


/**
Validates the SMBIOS entry point structure
@param EntryPointStructure SMBIOS entry point structure
@retval TRUE The entry point structure is valid
@retval FALSE The entry point structure is not valid
**/
BOOLEAN
IsEntryPointStructureValid (
IN SMBIOS_TABLE_ENTRY_POINT *EntryPointStructure
);

#endif
35 changes: 0 additions & 35 deletions OvmfPkg/SmbiosPlatformDxe/X86Xen.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,41 +21,6 @@
#define XEN_SMBIOS_PHYSICAL_ADDRESS 0x000EB000
#define XEN_SMBIOS_PHYSICAL_END 0x000F0000

/**
Validates the SMBIOS entry point structure
@param EntryPointStructure SMBIOS entry point structure
@retval TRUE The entry point structure is valid
@retval FALSE The entry point structure is not valid
**/
STATIC
BOOLEAN
IsEntryPointStructureValid (
IN SMBIOS_TABLE_ENTRY_POINT *EntryPointStructure
)
{
UINTN Index;
UINT8 Length;
UINT8 Checksum;
UINT8 *BytePtr;

BytePtr = (UINT8*) EntryPointStructure;
Length = EntryPointStructure->EntryPointLength;
Checksum = 0;

for (Index = 0; Index < Length; Index++) {
Checksum = Checksum + (UINT8) BytePtr[Index];
}

if (Checksum != 0) {
return FALSE;
} else {
return TRUE;
}
}

/**
Locates the Xen SMBIOS data if it exists
Expand Down

0 comments on commit 3c74b29

Please sign in to comment.