summaryrefslogtreecommitdiffstats
path: root/EmulatorPkg
diff options
context:
space:
mode:
authorandrewfish <andrewfish@6f19259b-4bc3-4df7-8a09-765794883524>2012-01-30 23:55:38 +0000
committerandrewfish <andrewfish@6f19259b-4bc3-4df7-8a09-765794883524>2012-01-30 23:55:38 +0000
commit8fa6b23c495b2b05592d5ab8036a9c72814969d4 (patch)
treebbc07c1f90212ae54b1f696ff93fd185a3cd21cd /EmulatorPkg
parenteefe286b7b7a3e22338f9d347dc61b43497a8269 (diff)
downloadedk2-8fa6b23c495b2b05592d5ab8036a9c72814969d4.tar.gz
edk2-8fa6b23c495b2b05592d5ab8036a9c72814969d4.tar.bz2
edk2-8fa6b23c495b2b05592d5ab8036a9c72814969d4.zip
cleanup SmbiosLib.h definitions, and the code that depends on them.
signed-off-by:andrewfish reviewed-by:mikekinney git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@12970 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'EmulatorPkg')
-rw-r--r--EmulatorPkg/Include/Library/SmbiosLib.h55
-rw-r--r--EmulatorPkg/Library/SmbiosLib/SmbiosLib.c42
-rw-r--r--EmulatorPkg/PlatformSmbiosDxe/PlatformSmbiosDxe.c19
3 files changed, 64 insertions, 52 deletions
diff --git a/EmulatorPkg/Include/Library/SmbiosLib.h b/EmulatorPkg/Include/Library/SmbiosLib.h
index 2f7f180731..9bfb3fa669 100644
--- a/EmulatorPkg/Include/Library/SmbiosLib.h
+++ b/EmulatorPkg/Include/Library/SmbiosLib.h
@@ -22,15 +22,42 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
#include <Protocol/Smbios.h>
+///
+/// Cache copy of the SMBIOS Protocol pointer
+///
+extern EFI_SMBIOS_PROTOCOL *gSmbios;
+
+
+///
+/// Template for SMBIOS table initialization.
+/// The SMBIOS_TABLE_STRING types in the formated area must match the
+/// StringArray sequene.
+///
typedef struct {
+ //
+ // formatted area of a given SMBIOS record
+ //
SMBIOS_STRUCTURE *Entry;
+ //
+ // NULL terminated array of ASCII strings to be added to the SMBIOS record.
+ //
CHAR8 **StringArray;
} SMBIOS_TEMPLATE_ENTRY;
+/**
+ Create an initial SMBIOS Table from an array of SMBIOS_TEMPLATE_ENTRY
+ entries. SMBIOS_TEMPLATE_ENTRY.NULL indicates the end of the table.
+
+ @param Template Array of SMBIOS_TEMPLATE_ENTRY entries.
+
+ @retval EFI_SUCCESS New SMBIOS tables were created.
+ @retval EFI_OUT_OF_RESOURCES New SMBIOS tables were not created.
+**/
EFI_STATUS
-InitializeSmbiosTableFromTemplate (
- IN SMBIOS_TEMPLATE_ENTRY *template
+EFIAPI
+SmbiosLibInitializeFromTemplate (
+ IN SMBIOS_TEMPLATE_ENTRY *Template
);
@@ -61,15 +88,17 @@ InitializeSmbiosTableFromTemplate (
@param StringArray Array of strings to convert to an SMBIOS string pack.
NULL is OK.
+ @retval EFI_SUCCESS New SmbiosEntry was added to SMBIOS table.
+ @retval EFI_OUT_OF_RESOURCES SmbiosEntry was not added.
**/
EFI_STATUS
-CreateSmbiosEntry (
+EFIAPI
+SmbiosLibCreateEntry (
IN SMBIOS_STRUCTURE *SmbiosEntry,
IN CHAR8 **StringArray
);
-
/**
Update the string associated with an existing SMBIOS record.
@@ -86,7 +115,8 @@ CreateSmbiosEntry (
@retval EFI_NOT_FOUND The StringNumber.is not valid for this SMBIOS record.
**/
EFI_STATUS
-SmbiosUpdateString (
+EFIAPI
+SmbiosLibUpdateString (
IN EFI_SMBIOS_HANDLE SmbiosHandle,
IN SMBIOS_TABLE_STRING StringNumber,
IN CHAR8 *String
@@ -108,7 +138,8 @@ SmbiosUpdateString (
@retval EFI_NOT_FOUND The StringNumber.is not valid for this SMBIOS record.
**/
EFI_STATUS
-SmbiosUpdateUnicodeString (
+EFIAPI
+SmbiosLibUpdateUnicodeString (
IN EFI_SMBIOS_HANDLE SmbiosHandle,
IN SMBIOS_TABLE_STRING StringNumber,
IN CHAR16 *String
@@ -124,7 +155,7 @@ SmbiosUpdateUnicodeString (
@retval Other Pointer to matching SMBIOS string.
**/
CHAR8 *
-SmbiosReadString (
+SmbiosLibReadString (
IN SMBIOS_STRUCTURE *Header,
IN UINTN Instance
);
@@ -142,7 +173,7 @@ SmbiosReadString (
**/
SMBIOS_STRUCTURE *
EFIAPI
-SmbiosGetRecord (
+SmbiosLibGetRecord (
IN EFI_SMBIOS_TYPE Type,
IN UINTN Instance,
OUT EFI_SMBIOS_HANDLE *SmbiosHandle
@@ -160,17 +191,11 @@ SmbiosGetRecord (
**/
EFI_STATUS
EFIAPI
-SmbiosRemove (
+SmbiosLibRemove (
OUT EFI_SMBIOS_HANDLE SmbiosHandle
);
-EFI_STATUS
-EFIAPI
-SmbiosGetVersion (
- OUT UINT8 *SmbiosMajorVersion,
- OUT UINT8 *SmbiosMinorVersion
- );
#endif
diff --git a/EmulatorPkg/Library/SmbiosLib/SmbiosLib.c b/EmulatorPkg/Library/SmbiosLib/SmbiosLib.c
index 901703a537..15e135974f 100644
--- a/EmulatorPkg/Library/SmbiosLib/SmbiosLib.c
+++ b/EmulatorPkg/Library/SmbiosLib/SmbiosLib.c
@@ -28,9 +28,18 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
EFI_SMBIOS_PROTOCOL *gSmbios = NULL;
+/**
+ Create an initial SMBIOS Table from an array of SMBIOS_TEMPLATE_ENTRY
+ entries. SMBIOS_TEMPLATE_ENTRY.NULL indicates the end of the table.
+
+ @param Template Array of SMBIOS_TEMPLATE_ENTRY entries.
+
+ @retval EFI_SUCCESS New SMBIOS tables were created.
+ @retval EFI_OUT_OF_RESOURCES New SMBIOS tables were not created.
+**/
EFI_STATUS
EFIAPI
-InitializeSmbiosTableFromTemplate (
+SmbiosLibInitializeFromTemplate (
IN SMBIOS_TEMPLATE_ENTRY *Template
)
{
@@ -42,7 +51,7 @@ InitializeSmbiosTableFromTemplate (
}
for (Index = 0; Template[Index].Entry != NULL; Index++) {
- Status = CreateSmbiosEntry (Template[Index].Entry, Template[Index].StringArray);
+ Status = SmbiosLibCreateEntry (Template[Index].Entry, Template[Index].StringArray);
}
return Status;
@@ -79,7 +88,7 @@ InitializeSmbiosTableFromTemplate (
**/
EFI_STATUS
EFIAPI
-CreateSmbiosEntry (
+SmbiosLibCreateEntry (
IN SMBIOS_STRUCTURE *SmbiosEntry,
IN CHAR8 **StringArray
)
@@ -156,7 +165,7 @@ CreateSmbiosEntry (
**/
EFI_STATUS
EFIAPI
-SmbiosUpdateString (
+SmbiosLibUpdateString (
IN EFI_SMBIOS_HANDLE SmbiosHandle,
IN SMBIOS_TABLE_STRING StringNumber,
IN CHAR8 *String
@@ -195,7 +204,7 @@ SmbiosUpdateString (
**/
EFI_STATUS
EFIAPI
-SmbiosUpdateUnicodeString (
+SmbiosLibUpdateUnicodeString (
IN EFI_SMBIOS_HANDLE SmbiosHandle,
IN SMBIOS_TABLE_STRING StringNumber,
IN CHAR16 *String
@@ -238,7 +247,7 @@ SmbiosUpdateUnicodeString (
@retval Other Pointer to matching SMBIOS string.
**/
CHAR8 *
-SmbiosReadString (
+SmbiosLibReadString (
IN SMBIOS_STRUCTURE *Header,
IN UINTN Instance
)
@@ -273,7 +282,7 @@ SmbiosReadString (
**/
SMBIOS_STRUCTURE *
EFIAPI
-SmbiosGetRecord (
+SmbiosLibGetRecord (
IN EFI_SMBIOS_TYPE Type,
IN UINTN Instance,
OUT EFI_SMBIOS_HANDLE *SmbiosHandle
@@ -311,7 +320,7 @@ SmbiosGetRecord (
**/
EFI_STATUS
EFIAPI
-SmbiosRemove (
+SmbiosLibRemove (
OUT EFI_SMBIOS_HANDLE SmbiosHandle
)
{
@@ -319,26 +328,9 @@ SmbiosRemove (
}
-EFI_STATUS
-EFIAPI
-SmbiosGetVersion (
- OUT UINT8 *SmbiosMajorVersion,
- OUT UINT8 *SmbiosMinorVersion
- )
-{
- if (SmbiosMajorVersion != NULL) {
- *SmbiosMajorVersion = gSmbios->MajorVersion;
- }
- if (SmbiosMinorVersion != NULL) {
- *SmbiosMinorVersion = gSmbios->MinorVersion;
- }
- return EFI_SUCCESS;
-}
-
/**
-
@param ImageHandle ImageHandle of the loaded driver.
@param SystemTable Pointer to the EFI System Table.
diff --git a/EmulatorPkg/PlatformSmbiosDxe/PlatformSmbiosDxe.c b/EmulatorPkg/PlatformSmbiosDxe/PlatformSmbiosDxe.c
index 43bf17ec31..b94b06535b 100644
--- a/EmulatorPkg/PlatformSmbiosDxe/PlatformSmbiosDxe.c
+++ b/EmulatorPkg/PlatformSmbiosDxe/PlatformSmbiosDxe.c
@@ -48,13 +48,13 @@ CreatePlatformSmbiosMemoryRecords (
EFI_SMBIOS_HANDLE PhyscialMemoryArrayHandle;
EFI_SMBIOS_HANDLE SmbiosHandle;
- Smbios16.Hdr = SmbiosGetRecord (EFI_SMBIOS_TYPE_PHYSICAL_MEMORY_ARRAY, 0, &PhyscialMemoryArrayHandle);
+ Smbios16.Hdr = SmbiosLibGetRecord (EFI_SMBIOS_TYPE_PHYSICAL_MEMORY_ARRAY, 0, &PhyscialMemoryArrayHandle);
if (Smbios16.Hdr == NULL) {
// Only make a Type19 entry if a Type16 entry exists.
return;
}
- Smbios17.Hdr = SmbiosGetRecord (EFI_SMBIOS_TYPE_MEMORY_DEVICE, 0, &SmbiosHandle);
+ Smbios17.Hdr = SmbiosLibGetRecord (EFI_SMBIOS_TYPE_MEMORY_DEVICE, 0, &SmbiosHandle);
if (Smbios17.Hdr == NULL) {
// if type17 exits update with type16 Smbios handle
Smbios17.Type17->MemoryArrayHandle = PhyscialMemoryArrayHandle;
@@ -70,7 +70,7 @@ CreatePlatformSmbiosMemoryRecords (
HobPtr.ResourceDescriptor->PhysicalStart +
HobPtr.ResourceDescriptor->ResourceLength - 1;
- CreateSmbiosEntry ((SMBIOS_STRUCTURE *)&gSmbiosType19Template, NULL);
+ SmbiosLibCreateEntry ((SMBIOS_STRUCTURE *)&gSmbiosType19Template, NULL);
}
HobPtr.Raw = GET_NEXT_HOB (HobPtr);
}
@@ -96,32 +96,27 @@ PlatfomrSmbiosDriverEntryPoint (
EFI_STATUS Status;
EFI_SMBIOS_HANDLE SmbiosHandle;
SMBIOS_STRUCTURE_POINTER Smbios;
- UINT8 SmbiosMajorVersion;
- UINT8 SmbiosMinorVersion;
-
- Status = SmbiosGetVersion (&SmbiosMajorVersion, &SmbiosMinorVersion);
- ASSERT_EFI_ERROR (Status);
// Phase 0 - Patch table to make SMBIOS 2.7 structures smaller to conform
// to an early version of the specification.
// Phase 1 - Initialize SMBIOS tables from template
- Status = InitializeSmbiosTableFromTemplate (gSmbiosTemplate);
+ Status = SmbiosLibInitializeFromTemplate (gSmbiosTemplate);
ASSERT_EFI_ERROR (Status);
// Phase 2 - Patch SMBIOS table entries
- Smbios.Hdr = SmbiosGetRecord (EFI_SMBIOS_TYPE_BIOS_INFORMATION, 0, &SmbiosHandle);
+ Smbios.Hdr = SmbiosLibGetRecord (EFI_SMBIOS_TYPE_BIOS_INFORMATION, 0, &SmbiosHandle);
if (Smbios.Type0 != NULL) {
// 64K * (n+1) bytes
Smbios.Type0->BiosSize = (UINT8)DivU64x32 (FixedPcdGet64 (PcdEmuFirmwareFdSize), 64*1024) - 1;
- SmbiosUpdateUnicodeString (
+ SmbiosLibUpdateUnicodeString (
SmbiosHandle,
Smbios.Type0->BiosVersion,
(CHAR16 *) PcdGetPtr (PcdFirmwareVersionString)
);
- SmbiosUpdateUnicodeString (
+ SmbiosLibUpdateUnicodeString (
SmbiosHandle,
Smbios.Type0->BiosReleaseDate,
(CHAR16 *) PcdGetPtr (PcdFirmwareReleaseDateString)