diff --git a/UnixPkg/CpuRuntimeDxe/Cpu.c b/UnixPkg/CpuRuntimeDxe/Cpu.c index d4926c3707..54c784ea66 100644 --- a/UnixPkg/CpuRuntimeDxe/Cpu.c +++ b/UnixPkg/CpuRuntimeDxe/Cpu.c @@ -1,6 +1,6 @@ /*++ -Copyright (c) 2006 - 2009, Intel Corporation. All rights reserved.
+Copyright (c) 2006 - 2011, Intel Corporation. All rights reserved.
This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD License which accompanies this distribution. The full text of the license may be found at @@ -417,7 +417,7 @@ LogSmbiosData ( EFI_STATUS Status; EFI_SMBIOS_HANDLE SmbiosHandle; - SmbiosHandle = 0; + SmbiosHandle = SMBIOS_HANDLE_PI_RESERVED; Status = Smbios->Add ( Smbios, NULL, diff --git a/UnixPkg/MiscSubClassPlatformDxe/MiscBaseBoardManufacturerFunction.c b/UnixPkg/MiscSubClassPlatformDxe/MiscBaseBoardManufacturerFunction.c index 04f5a1edc5..0158ae9d52 100644 --- a/UnixPkg/MiscSubClassPlatformDxe/MiscBaseBoardManufacturerFunction.c +++ b/UnixPkg/MiscSubClassPlatformDxe/MiscBaseBoardManufacturerFunction.c @@ -2,7 +2,7 @@ BaseBoard manufacturer information boot time changes. SMBIOS type 2. - Copyright (c) 2009, Intel Corporation. All rights reserved.
+ Copyright (c) 2009 - 2011, Intel Corporation. All rights reserved.
This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD License which accompanies this distribution. The full text of the license may be found at @@ -154,13 +154,7 @@ MISC_SMBIOS_TABLE_FUNCTION(MiscBaseBoardManufacturer) // // Now we have got the full smbios record, call smbios protocol to add this record. // - SmbiosHandle = 0; - Status = Smbios-> Add( - Smbios, - NULL, - &SmbiosHandle, - (EFI_SMBIOS_TABLE_HEADER *) SmbiosRecord - ); + Status = AddSmbiosRecord (Smbios, &SmbiosHandle, (EFI_SMBIOS_TABLE_HEADER *) SmbiosRecord); FreePool(SmbiosRecord); return Status; diff --git a/UnixPkg/MiscSubClassPlatformDxe/MiscBiosVendorFunction.c b/UnixPkg/MiscSubClassPlatformDxe/MiscBiosVendorFunction.c index 6d64ef4632..fbfb52fce5 100644 --- a/UnixPkg/MiscSubClassPlatformDxe/MiscBiosVendorFunction.c +++ b/UnixPkg/MiscSubClassPlatformDxe/MiscBiosVendorFunction.c @@ -3,7 +3,7 @@ Misc. subclass type 2. SMBIOS type 0. - Copyright (c) 2009, Intel Corporation. All rights reserved.
+ Copyright (c) 2009 - 2011, Intel Corporation. All rights reserved.
This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD License which accompanies this distribution. The full text of the license may be found at @@ -189,13 +189,7 @@ MISC_SMBIOS_TABLE_FUNCTION(MiscBiosVendor) // // Now we have got the full smbios record, call smbios protocol to add this record. // - SmbiosHandle = 0; - Status = Smbios-> Add( - Smbios, - NULL, - &SmbiosHandle, - (EFI_SMBIOS_TABLE_HEADER *) SmbiosRecord - ); + Status = AddSmbiosRecord (Smbios, &SmbiosHandle, (EFI_SMBIOS_TABLE_HEADER *) SmbiosRecord); FreePool(SmbiosRecord); return Status; diff --git a/UnixPkg/MiscSubClassPlatformDxe/MiscBootInformationFunction.c b/UnixPkg/MiscSubClassPlatformDxe/MiscBootInformationFunction.c index 65c9792a93..fec5ecc0bd 100644 --- a/UnixPkg/MiscSubClassPlatformDxe/MiscBootInformationFunction.c +++ b/UnixPkg/MiscSubClassPlatformDxe/MiscBootInformationFunction.c @@ -2,7 +2,7 @@ boot information boot time changes. SMBIOS type 32. - Copyright (c) 2009, Intel Corporation. All rights reserved.
+ Copyright (c) 2009 - 2011, Intel Corporation. All rights reserved.
This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD License which accompanies this distribution. The full text of the license may be found at @@ -61,13 +61,8 @@ MISC_SMBIOS_TABLE_FUNCTION(BootInformationStatus) // // Now we have got the full smbios record, call smbios protocol to add this record. // - SmbiosHandle = 0; - Status = Smbios-> Add( - Smbios, - NULL, - &SmbiosHandle, - (EFI_SMBIOS_TABLE_HEADER *) SmbiosRecord - ); + Status = AddSmbiosRecord (Smbios, &SmbiosHandle, (EFI_SMBIOS_TABLE_HEADER *) SmbiosRecord); + FreePool(SmbiosRecord); return Status; } diff --git a/UnixPkg/MiscSubClassPlatformDxe/MiscChassisManufacturerFunction.c b/UnixPkg/MiscSubClassPlatformDxe/MiscChassisManufacturerFunction.c index fd1262b190..ce89603479 100644 --- a/UnixPkg/MiscSubClassPlatformDxe/MiscChassisManufacturerFunction.c +++ b/UnixPkg/MiscSubClassPlatformDxe/MiscChassisManufacturerFunction.c @@ -2,7 +2,7 @@ Chassis manufacturer information boot time changes. SMBIOS type 3. - Copyright (c) 2009, Intel Corporation. All rights reserved.
+ Copyright (c) 2009 - 2011, Intel Corporation. All rights reserved.
This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD License which accompanies this distribution. The full text of the license may be found at @@ -124,13 +124,7 @@ MISC_SMBIOS_TABLE_FUNCTION(MiscChassisManufacturer) // // Now we have got the full smbios record, call smbios protocol to add this record. // - SmbiosHandle = 0; - Status = Smbios-> Add( - Smbios, - NULL, - &SmbiosHandle, - (EFI_SMBIOS_TABLE_HEADER *) SmbiosRecord - ); + Status = AddSmbiosRecord (Smbios, &SmbiosHandle, (EFI_SMBIOS_TABLE_HEADER *) SmbiosRecord); FreePool(SmbiosRecord); return Status; diff --git a/UnixPkg/MiscSubClassPlatformDxe/MiscNumberOfInstallableLanguagesFunction.c b/UnixPkg/MiscSubClassPlatformDxe/MiscNumberOfInstallableLanguagesFunction.c index 288848d0da..64addad4a9 100644 --- a/UnixPkg/MiscSubClassPlatformDxe/MiscNumberOfInstallableLanguagesFunction.c +++ b/UnixPkg/MiscSubClassPlatformDxe/MiscNumberOfInstallableLanguagesFunction.c @@ -2,7 +2,7 @@ This driver parses the mSmbiosMiscDataTable structure and reports any generated data. - Copyright (c) 2009, Intel Corporation. All rights reserved.
+ Copyright (c) 2009 - 2011, Intel Corporation. All rights reserved.
This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD License which accompanies this distribution. The full text of the license may be found at @@ -226,13 +226,8 @@ MISC_SMBIOS_TABLE_FUNCTION(NumberOfInstallableLanguages) // // Now we have got the full smbios record, call smbios protocol to add this record. // - SmbiosHandle = 0; - Status = Smbios-> Add( - Smbios, - NULL, - &SmbiosHandle, - (EFI_SMBIOS_TABLE_HEADER *) SmbiosRecord - ); + Status = AddSmbiosRecord (Smbios, &SmbiosHandle, (EFI_SMBIOS_TABLE_HEADER *) SmbiosRecord); + FreePool(SmbiosRecord); return Status; } diff --git a/UnixPkg/MiscSubClassPlatformDxe/MiscOemStringFunction.c b/UnixPkg/MiscSubClassPlatformDxe/MiscOemStringFunction.c index 94fc71c231..f0401cebbd 100644 --- a/UnixPkg/MiscSubClassPlatformDxe/MiscOemStringFunction.c +++ b/UnixPkg/MiscSubClassPlatformDxe/MiscOemStringFunction.c @@ -2,7 +2,7 @@ boot information boot time changes. SMBIOS type 11. - Copyright (c) 2009, Intel Corporation. All rights reserved.
+ Copyright (c) 2009 - 2011, Intel Corporation. All rights reserved.
This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD License which accompanies this distribution. The full text of the license may be found at @@ -68,13 +68,8 @@ MISC_SMBIOS_TABLE_FUNCTION(OemString) // // Now we have got the full smbios record, call smbios protocol to add this record. // - SmbiosHandle = 0; - Status = Smbios-> Add( - Smbios, - NULL, - &SmbiosHandle, - (EFI_SMBIOS_TABLE_HEADER *) SmbiosRecord - ); + Status = AddSmbiosRecord (Smbios, &SmbiosHandle, (EFI_SMBIOS_TABLE_HEADER *) SmbiosRecord); + FreePool(SmbiosRecord); return Status; } diff --git a/UnixPkg/MiscSubClassPlatformDxe/MiscPortInternalConnectorDesignatorFunction.c b/UnixPkg/MiscSubClassPlatformDxe/MiscPortInternalConnectorDesignatorFunction.c index 8f240a4080..9f7708be73 100644 --- a/UnixPkg/MiscSubClassPlatformDxe/MiscPortInternalConnectorDesignatorFunction.c +++ b/UnixPkg/MiscSubClassPlatformDxe/MiscPortInternalConnectorDesignatorFunction.c @@ -1,6 +1,6 @@ /*++ -Copyright (c) 2006 - 2009, Intel Corporation. All rights reserved.
+Copyright (c) 2006 - 2011, Intel Corporation. All rights reserved.
This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD License which accompanies this distribution. The full text of the license may be found at @@ -161,13 +161,8 @@ Returns: // // Now we have got the full smbios record, call smbios protocol to add this record. // - SmbiosHandle = 0; - Status = Smbios-> Add( - Smbios, - NULL, - &SmbiosHandle, - (EFI_SMBIOS_TABLE_HEADER *) SmbiosRecord - ); + Status = AddSmbiosRecord (Smbios, &SmbiosHandle, (EFI_SMBIOS_TABLE_HEADER *) SmbiosRecord); + FreePool(SmbiosRecord); return Status; } diff --git a/UnixPkg/MiscSubClassPlatformDxe/MiscResetCapabilitiesFunction.c b/UnixPkg/MiscSubClassPlatformDxe/MiscResetCapabilitiesFunction.c index 8303c5a29b..588f9d65de 100644 --- a/UnixPkg/MiscSubClassPlatformDxe/MiscResetCapabilitiesFunction.c +++ b/UnixPkg/MiscSubClassPlatformDxe/MiscResetCapabilitiesFunction.c @@ -2,7 +2,7 @@ ResetCapabilities. SMBIOS type 23. - Copyright (c) 2009, Intel Corporation. All rights reserved.
+ Copyright (c) 2009 - 2011, Intel Corporation. All rights reserved.
This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD License which accompanies this distribution. The full text of the license may be found at @@ -63,13 +63,8 @@ MISC_SMBIOS_TABLE_FUNCTION(MiscResetCapabilities) // // Now we have got the full smbios record, call smbios protocol to add this record. // - SmbiosHandle = 0; - Status = Smbios-> Add( - Smbios, - NULL, - &SmbiosHandle, - (EFI_SMBIOS_TABLE_HEADER *) SmbiosRecord - ); + Status = AddSmbiosRecord (Smbios, &SmbiosHandle, (EFI_SMBIOS_TABLE_HEADER *) SmbiosRecord); + FreePool(SmbiosRecord); return Status; } diff --git a/UnixPkg/MiscSubClassPlatformDxe/MiscSubClassDriver.h b/UnixPkg/MiscSubClassPlatformDxe/MiscSubClassDriver.h index debd08bc63..b682aebb07 100644 --- a/UnixPkg/MiscSubClassPlatformDxe/MiscSubClassDriver.h +++ b/UnixPkg/MiscSubClassPlatformDxe/MiscSubClassDriver.h @@ -1,6 +1,6 @@ /*++ -Copyright (c) 2006 - 2009, Intel Corporation. All rights reserved.
+Copyright (c) 2006 - 2011, Intel Corporation. All rights reserved.
This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD License which accompanies this distribution. The full text of the license may be found at @@ -105,16 +105,26 @@ extern UINTN mMiscSubclassDataTableEntries; extern UINT8 MiscSubclassStrings[]; extern EFI_HII_HANDLE mHiiHandle; -// -// Prototypes -// -EFI_STATUS -EFIAPI -MiscSubclassDriverEntryPoint ( - IN EFI_HANDLE ImageHandle, - IN EFI_SYSTEM_TABLE *SystemTable - ); +/** + Add an SMBIOS record. + @param Smbios The EFI_SMBIOS_PROTOCOL instance. + @param SmbiosHandle A unique handle will be assigned to the SMBIOS record. + @param Record The data for the fixed portion of the SMBIOS record. The format of the record is + determined by EFI_SMBIOS_TABLE_HEADER.Type. The size of the formatted area is defined + by EFI_SMBIOS_TABLE_HEADER.Length and either followed by a double-null (0x0000) or + a set of null terminated strings and a null. + + @retval EFI_SUCCESS Record was added. + @retval EFI_OUT_OF_RESOURCES Record was not added due to lack of system resources. + +**/ +EFI_STATUS +AddSmbiosRecord ( + IN EFI_SMBIOS_PROTOCOL *Smbios, + OUT EFI_SMBIOS_HANDLE *SmbiosHandle, + IN EFI_SMBIOS_TABLE_HEADER *Record + ); #endif /* _MISC_SUBCLASS_DRIVER_H */ diff --git a/UnixPkg/MiscSubClassPlatformDxe/MiscSubclassDriverEntryPoint.c b/UnixPkg/MiscSubClassPlatformDxe/MiscSubclassDriverEntryPoint.c index a2c14e7a7a..41b32fe673 100644 --- a/UnixPkg/MiscSubClassPlatformDxe/MiscSubclassDriverEntryPoint.c +++ b/UnixPkg/MiscSubClassPlatformDxe/MiscSubclassDriverEntryPoint.c @@ -1,6 +1,6 @@ /*++ -Copyright (c) 2006 - 2009, Intel Corporation. All rights reserved.
+Copyright (c) 2006 - 2011, Intel Corporation. All rights reserved.
This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD License which accompanies this distribution. The full text of the license may be found at @@ -90,8 +90,8 @@ LogMemorySmbiosRecord ( // // Generate Memory Array Mapped Address info (TYPE 19) // - MemArrayMappedAddrSmbiosHandle = 0; - Status = Smbios->Add (Smbios, NULL, &MemArrayMappedAddrSmbiosHandle, (EFI_SMBIOS_TABLE_HEADER*) Type19Record); + Status = AddSmbiosRecord (Smbios, &MemArrayMappedAddrSmbiosHandle, (EFI_SMBIOS_TABLE_HEADER*) Type19Record); + FreePool(Type19Record); ASSERT_EFI_ERROR (Status); @@ -168,3 +168,34 @@ Returns: EfiStatus = LogMemorySmbiosRecord(); return EfiStatus; } + +/** + Add an SMBIOS record. + + @param Smbios The EFI_SMBIOS_PROTOCOL instance. + @param SmbiosHandle A unique handle will be assigned to the SMBIOS record. + @param Record The data for the fixed portion of the SMBIOS record. The format of the record is + determined by EFI_SMBIOS_TABLE_HEADER.Type. The size of the formatted area is defined + by EFI_SMBIOS_TABLE_HEADER.Length and either followed by a double-null (0x0000) or + a set of null terminated strings and a null. + + @retval EFI_SUCCESS Record was added. + @retval EFI_OUT_OF_RESOURCES Record was not added due to lack of system resources. + +**/ +EFI_STATUS +AddSmbiosRecord ( + IN EFI_SMBIOS_PROTOCOL *Smbios, + OUT EFI_SMBIOS_HANDLE *SmbiosHandle, + IN EFI_SMBIOS_TABLE_HEADER *Record + ) +{ + *SmbiosHandle = SMBIOS_HANDLE_PI_RESERVED; + return Smbios->Add ( + Smbios, + NULL, + SmbiosHandle, + Record + ); +} + diff --git a/UnixPkg/MiscSubClassPlatformDxe/MiscSystemLanguageStringFunction.c b/UnixPkg/MiscSubClassPlatformDxe/MiscSystemLanguageStringFunction.c index 3e10c63caa..86d63b4191 100644 --- a/UnixPkg/MiscSubClassPlatformDxe/MiscSystemLanguageStringFunction.c +++ b/UnixPkg/MiscSubClassPlatformDxe/MiscSystemLanguageStringFunction.c @@ -2,7 +2,7 @@ ResetCapabilities. SMBIOS type 23. - Copyright (c) 2009, Intel Corporation. All rights reserved.
+ Copyright (c) 2009 - 2011, Intel Corporation. All rights reserved.
This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD License which accompanies this distribution. The full text of the license may be found at @@ -72,13 +72,8 @@ MISC_SMBIOS_TABLE_FUNCTION(SystemLanguageString) // // Now we have got the full smbios record, call smbios protocol to add this record. // - SmbiosHandle = 0; - Status = Smbios-> Add( - Smbios, - NULL, - &SmbiosHandle, - (EFI_SMBIOS_TABLE_HEADER *) SmbiosRecord - ); + Status = AddSmbiosRecord (Smbios, &SmbiosHandle, (EFI_SMBIOS_TABLE_HEADER *) SmbiosRecord); + FreePool(SmbiosRecord); return Status; } diff --git a/UnixPkg/MiscSubClassPlatformDxe/MiscSystemManufacturerFunction.c b/UnixPkg/MiscSubClassPlatformDxe/MiscSystemManufacturerFunction.c index 1483ace35b..3582447a40 100644 --- a/UnixPkg/MiscSubClassPlatformDxe/MiscSystemManufacturerFunction.c +++ b/UnixPkg/MiscSubClassPlatformDxe/MiscSystemManufacturerFunction.c @@ -1,6 +1,6 @@ /*++ -Copyright (c) 2006 - 2009, Intel Corporation. All rights reserved.
+Copyright (c) 2006 - 2011, Intel Corporation. All rights reserved.
This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD License which accompanies this distribution. The full text of the license may be found at @@ -126,13 +126,8 @@ MISC_SMBIOS_TABLE_FUNCTION(MiscSystemManufacturer) // // Now we have got the full smbios record, call smbios protocol to add this record. // - SmbiosHandle = 0; - Status = Smbios-> Add( - Smbios, - NULL, - &SmbiosHandle, - (EFI_SMBIOS_TABLE_HEADER *) SmbiosRecord - ); + Status = AddSmbiosRecord (Smbios, &SmbiosHandle, (EFI_SMBIOS_TABLE_HEADER *) SmbiosRecord); + FreePool(SmbiosRecord); return Status; } diff --git a/UnixPkg/MiscSubClassPlatformDxe/MiscSystemOptionStringFunction.c b/UnixPkg/MiscSubClassPlatformDxe/MiscSystemOptionStringFunction.c index a910634f00..145603a9a9 100644 --- a/UnixPkg/MiscSubClassPlatformDxe/MiscSystemOptionStringFunction.c +++ b/UnixPkg/MiscSubClassPlatformDxe/MiscSystemOptionStringFunction.c @@ -2,7 +2,7 @@ BIOS system option string boot time changes. SMBIOS type 12. - Copyright (c) 2009, Intel Corporation. All rights reserved.
+ Copyright (c) 2009 - 2011, Intel Corporation. All rights reserved.
This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD License which accompanies this distribution. The full text of the license may be found at @@ -70,13 +70,7 @@ MISC_SMBIOS_TABLE_FUNCTION(SystemOptionString) // // Now we have got the full smbios record, call smbios protocol to add this record. // - SmbiosHandle = 0; - Status = Smbios-> Add( - Smbios, - NULL, - &SmbiosHandle, - (EFI_SMBIOS_TABLE_HEADER *) SmbiosRecord - ); + Status = AddSmbiosRecord (Smbios, &SmbiosHandle, (EFI_SMBIOS_TABLE_HEADER *) SmbiosRecord); FreePool(SmbiosRecord); return Status; diff --git a/UnixPkg/MiscSubClassPlatformDxe/MiscSystemSlotDesignationFunction.c b/UnixPkg/MiscSubClassPlatformDxe/MiscSystemSlotDesignationFunction.c index 72c4137c6b..2bf8844236 100644 --- a/UnixPkg/MiscSubClassPlatformDxe/MiscSystemSlotDesignationFunction.c +++ b/UnixPkg/MiscSubClassPlatformDxe/MiscSystemSlotDesignationFunction.c @@ -2,7 +2,7 @@ BIOS system slot designator information boot time changes. SMBIOS type 9. - Copyright (c) 2009, Intel Corporation. All rights reserved.
+ Copyright (c) 2009 - 2011, Intel Corporation. All rights reserved.
This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD License which accompanies this distribution. The full text of the license may be found at @@ -85,13 +85,8 @@ MISC_SMBIOS_TABLE_FUNCTION(MiscSystemSlotDesignation) // // Now we have got the full smbios record, call smbios protocol to add this record. // - SmbiosHandle = 0; - Status = Smbios-> Add( - Smbios, - NULL, - &SmbiosHandle, - (EFI_SMBIOS_TABLE_HEADER *) SmbiosRecord - ); + Status = AddSmbiosRecord (Smbios, &SmbiosHandle, (EFI_SMBIOS_TABLE_HEADER *) SmbiosRecord); + FreePool(SmbiosRecord); return Status; }