+++ /dev/null
-/*++\r
-\r
-Copyright (c) 2012 - 2014, Intel Corporation. All rights reserved.<BR>\r
- \r\r
- SPDX-License-Identifier: BSD-2-Clause-Patent\r
-\r
- \r\r
-\r
-\r
-Module Name:\r
-\r
- MiscPhysicalArrayFunction.c\r
-\r
-Abstract:\r
-\r
- BIOS system Physical Array boot time changes.\r
- SMBIOS type 16.\r
-\r
---*/\r
-\r
-\r
-#include "CommonHeader.h"\r
-#include "MiscSubclassDriver.h"\r
-\r
-\r
-\r
-/**\r
- This function makes boot time changes to the contents of the\r
- MiscPhysicalArrayFunction (Type 16).\r
-\r
- @param RecordData Pointer to copy of RecordData from the Data Table.\r
-\r
- @retval EFI_SUCCESS All parameters were valid.\r
- @retval EFI_UNSUPPORTED Unexpected RecordType value.\r
- @retval EFI_INVALID_PARAMETER Invalid parameter was found.\r
-\r
-**/\r
-\r
-MISC_SMBIOS_TABLE_FUNCTION(MiscPhysicalMemoryArray)\r
-{\r
- EFI_STATUS Status;\r
- EFI_SMBIOS_HANDLE SmbiosHandle;\r
- SMBIOS_TABLE_TYPE16 *SmbiosRecord;\r
- EFI_MEMORY_ARRAY_LOCATION_DATA *ForType16InputData;\r
- UINT32 TopOfMemory = 8 * 1024 * 1024;\r
-\r
- //\r
- // First check for invalid parameters.\r
- //\r
- if (RecordData == NULL) {\r
- return EFI_INVALID_PARAMETER;\r
- }\r
-\r
- ForType16InputData = (EFI_MEMORY_ARRAY_LOCATION_DATA *)RecordData;\r
-\r
- //\r
- // Two zeros following the last string.\r
- //\r
- SmbiosRecord = AllocatePool(sizeof (SMBIOS_TABLE_TYPE16) + 1);\r
- ZeroMem(SmbiosRecord, sizeof (SMBIOS_TABLE_TYPE16) + 1);\r
-\r
- SmbiosRecord->Hdr.Type = EFI_SMBIOS_TYPE_PHYSICAL_MEMORY_ARRAY;\r
- SmbiosRecord->Hdr.Length = sizeof (SMBIOS_TABLE_TYPE16);\r
-\r
- //\r
- // Make handle chosen by smbios protocol.add automatically.\r
- //\r
- SmbiosRecord->Hdr.Handle = 0;\r
-\r
- //\r
- // ReleaseDate will be the 3rd optional string following the formatted structure.\r
- //\r
- SmbiosRecord->Location = *(UINT8 *) &ForType16InputData ->MemoryArrayLocation;\r
- SmbiosRecord->Use = *(UINT8 *) &ForType16InputData ->MemoryArrayUse;\r
- SmbiosRecord->MemoryErrorCorrection = *(UINT8 *) &ForType16InputData->MemoryErrorCorrection;\r
-\r
- //\r
- // System does not provide the error information structure\r
- //\r
- SmbiosRecord->MemoryErrorInformationHandle = 0xFFFE;\r
-\r
- //\r
- // Maximum memory capacity\r
- //\r
- SmbiosRecord-> MaximumCapacity = TopOfMemory;\r
- SmbiosRecord-> NumberOfMemoryDevices= 0x02;\r
-\r
- //\r
- // Now we have got the full smbios record, call smbios protocol to add this record.\r
- //\r
- SmbiosHandle = SMBIOS_HANDLE_PI_RESERVED;\r
- Status = Smbios-> Add(\r
- Smbios,\r
- NULL,\r
- &SmbiosHandle,\r
- (EFI_SMBIOS_TABLE_HEADER *) SmbiosRecord\r
- );\r
- FreePool(SmbiosRecord);\r
- return Status;\r
-\r
-}\r