/**@file\r
\r
-Copyright (c) 2006 - 2009, Intel Corporation. All rights reserved.<BR>\r
-This program and the accompanying materials\r
-are licensed and made available under the terms and conditions of the BSD License\r
-which accompanies this distribution. The full text of the license may be found at\r
-http://opensource.org/licenses/bsd-license.php\r
-\r
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+Copyright (c) 2006 - 2012, Intel Corporation. All rights reserved.<BR>\r
+SPDX-License-Identifier: BSD-2-Clause-Patent\r
\r
Module Name:\r
\r
//\r
// Generate Memory Array Mapped Address info\r
//\r
- Type19Record = AllocatePool(sizeof (SMBIOS_TABLE_TYPE19));\r
- ZeroMem(Type19Record, sizeof(SMBIOS_TABLE_TYPE19));\r
+ Type19Record = AllocateZeroPool(sizeof (SMBIOS_TABLE_TYPE19) + 2);\r
Type19Record->Hdr.Type = EFI_SMBIOS_TYPE_MEMORY_ARRAY_MAPPED_ADDRESS;\r
Type19Record->Hdr.Length = sizeof(SMBIOS_TABLE_TYPE19);\r
Type19Record->Hdr.Handle = 0;\r
//\r
// Generate Memory Array Mapped Address info (TYPE 19)\r
//\r
- MemArrayMappedAddrSmbiosHandle = 0;\r
- Status = Smbios->Add (Smbios, NULL, &MemArrayMappedAddrSmbiosHandle, (EFI_SMBIOS_TABLE_HEADER*) Type19Record);\r
+ Status = AddSmbiosRecord (Smbios, &MemArrayMappedAddrSmbiosHandle, (EFI_SMBIOS_TABLE_HEADER*) Type19Record);\r
+\r
FreePool(Type19Record);\r
ASSERT_EFI_ERROR (Status);\r
\r
EfiStatus = LogMemorySmbiosRecord();\r
return EfiStatus;\r
}\r
+\r
+/**\r
+ Add an SMBIOS record.\r
+\r
+ @param Smbios The EFI_SMBIOS_PROTOCOL instance.\r
+ @param SmbiosHandle A unique handle will be assigned to the SMBIOS record.\r
+ @param Record The data for the fixed portion of the SMBIOS record. The format of the record is\r
+ determined by EFI_SMBIOS_TABLE_HEADER.Type. The size of the formatted area is defined \r
+ by EFI_SMBIOS_TABLE_HEADER.Length and either followed by a double-null (0x0000) or \r
+ a set of null terminated strings and a null.\r
+\r
+ @retval EFI_SUCCESS Record was added.\r
+ @retval EFI_OUT_OF_RESOURCES Record was not added due to lack of system resources.\r
+\r
+**/\r
+EFI_STATUS\r
+AddSmbiosRecord (\r
+ IN EFI_SMBIOS_PROTOCOL *Smbios,\r
+ OUT EFI_SMBIOS_HANDLE *SmbiosHandle,\r
+ IN EFI_SMBIOS_TABLE_HEADER *Record\r
+ )\r
+{\r
+ *SmbiosHandle = SMBIOS_HANDLE_PI_RESERVED;\r
+ return Smbios->Add (\r
+ Smbios,\r
+ NULL,\r
+ SmbiosHandle,\r
+ Record\r
+ );\r
+}\r
+\r