1 /*++ 2 3 Copyright (c) 2012 - 2014, Intel Corporation. All rights reserved.<BR> 4 5 6 This program and the accompanying materials are licensed and made available under 7 8 the terms and conditions of the BSD License that accompanies this distribution. 9 10 The full text of the license may be found at 11 12 http://opensource.org/licenses/bsd-license.php. 13 14 15 16 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 17 18 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. 19 20 21 22 23 24 Module Name: 25 26 MiscPhysicalArrayFunction.c 27 28 Abstract: 29 30 BIOS system Physical Array boot time changes. 31 SMBIOS type 16. 32 33 --*/ 34 35 36 #include "CommonHeader.h" 37 #include "MiscSubclassDriver.h" 38 39 40 41 /** 42 This function makes boot time changes to the contents of the 43 MiscPhysicalArrayFunction (Type 16). MISC_SMBIOS_TABLE_FUNCTION(MiscPhysicalMemoryArray)44 45 @param RecordData Pointer to copy of RecordData from the Data Table. 46 47 @retval EFI_SUCCESS All parameters were valid. 48 @retval EFI_UNSUPPORTED Unexpected RecordType value. 49 @retval EFI_INVALID_PARAMETER Invalid parameter was found. 50 51 **/ 52 53 MISC_SMBIOS_TABLE_FUNCTION(MiscPhysicalMemoryArray) 54 { 55 EFI_STATUS Status; 56 EFI_SMBIOS_HANDLE SmbiosHandle; 57 SMBIOS_TABLE_TYPE16 *SmbiosRecord; 58 EFI_MEMORY_ARRAY_LOCATION_DATA *ForType16InputData; 59 UINT32 TopOfMemory = 8 * 1024 * 1024; 60 61 // 62 // First check for invalid parameters. 63 // 64 if (RecordData == NULL) { 65 return EFI_INVALID_PARAMETER; 66 } 67 68 ForType16InputData = (EFI_MEMORY_ARRAY_LOCATION_DATA *)RecordData; 69 70 // 71 // Two zeros following the last string. 72 // 73 SmbiosRecord = AllocatePool(sizeof (SMBIOS_TABLE_TYPE16) + 1); 74 ZeroMem(SmbiosRecord, sizeof (SMBIOS_TABLE_TYPE16) + 1); 75 76 SmbiosRecord->Hdr.Type = EFI_SMBIOS_TYPE_PHYSICAL_MEMORY_ARRAY; 77 SmbiosRecord->Hdr.Length = sizeof (SMBIOS_TABLE_TYPE16); 78 79 // 80 // Make handle chosen by smbios protocol.add automatically. 81 // 82 SmbiosRecord->Hdr.Handle = 0; 83 84 // 85 // ReleaseDate will be the 3rd optional string following the formatted structure. 86 // 87 SmbiosRecord->Location = *(UINT8 *) &ForType16InputData ->MemoryArrayLocation; 88 SmbiosRecord->Use = *(UINT8 *) &ForType16InputData ->MemoryArrayUse; 89 SmbiosRecord->MemoryErrorCorrection = *(UINT8 *) &ForType16InputData->MemoryErrorCorrection; 90 91 // 92 // System does not provide the error information structure 93 // 94 SmbiosRecord->MemoryErrorInformationHandle = 0xFFFE; 95 96 // 97 // Maximum memory capacity 98 // 99 SmbiosRecord-> MaximumCapacity = TopOfMemory; 100 SmbiosRecord-> NumberOfMemoryDevices= 0x02; 101 102 // 103 // Now we have got the full smbios record, call smbios protocol to add this record. 104 // 105 SmbiosHandle = SMBIOS_HANDLE_PI_RESERVED; 106 Status = Smbios-> Add( 107 Smbios, 108 NULL, 109 &SmbiosHandle, 110 (EFI_SMBIOS_TABLE_HEADER *) SmbiosRecord 111 ); 112 FreePool(SmbiosRecord); 113 return Status; 114 115 } 116