3 Copyright (c) 2012 - 2014, Intel Corporation. All rights reserved.<BR>
5 SPDX-License-Identifier: BSD-2-Clause-Patent
12 MiscPhysicalArrayFunction.c
16 BIOS system Physical Array boot time changes.
22 #include "CommonHeader.h"
23 #include "MiscSubclassDriver.h"
28 This function makes boot time changes to the contents of the
29 MiscPhysicalArrayFunction (Type 16).
31 @param RecordData Pointer to copy of RecordData from the Data Table.
33 @retval EFI_SUCCESS All parameters were valid.
34 @retval EFI_UNSUPPORTED Unexpected RecordType value.
35 @retval EFI_INVALID_PARAMETER Invalid parameter was found.
39 MISC_SMBIOS_TABLE_FUNCTION(MiscPhysicalMemoryArray
)
42 EFI_SMBIOS_HANDLE SmbiosHandle
;
43 SMBIOS_TABLE_TYPE16
*SmbiosRecord
;
44 EFI_MEMORY_ARRAY_LOCATION_DATA
*ForType16InputData
;
45 UINT32 TopOfMemory
= 8 * 1024 * 1024;
48 // First check for invalid parameters.
50 if (RecordData
== NULL
) {
51 return EFI_INVALID_PARAMETER
;
54 ForType16InputData
= (EFI_MEMORY_ARRAY_LOCATION_DATA
*)RecordData
;
57 // Two zeros following the last string.
59 SmbiosRecord
= AllocatePool(sizeof (SMBIOS_TABLE_TYPE16
) + 1);
60 ZeroMem(SmbiosRecord
, sizeof (SMBIOS_TABLE_TYPE16
) + 1);
62 SmbiosRecord
->Hdr
.Type
= EFI_SMBIOS_TYPE_PHYSICAL_MEMORY_ARRAY
;
63 SmbiosRecord
->Hdr
.Length
= sizeof (SMBIOS_TABLE_TYPE16
);
66 // Make handle chosen by smbios protocol.add automatically.
68 SmbiosRecord
->Hdr
.Handle
= 0;
71 // ReleaseDate will be the 3rd optional string following the formatted structure.
73 SmbiosRecord
->Location
= *(UINT8
*) &ForType16InputData
->MemoryArrayLocation
;
74 SmbiosRecord
->Use
= *(UINT8
*) &ForType16InputData
->MemoryArrayUse
;
75 SmbiosRecord
->MemoryErrorCorrection
= *(UINT8
*) &ForType16InputData
->MemoryErrorCorrection
;
78 // System does not provide the error information structure
80 SmbiosRecord
->MemoryErrorInformationHandle
= 0xFFFE;
83 // Maximum memory capacity
85 SmbiosRecord
-> MaximumCapacity
= TopOfMemory
;
86 SmbiosRecord
-> NumberOfMemoryDevices
= 0x02;
89 // Now we have got the full smbios record, call smbios protocol to add this record.
91 SmbiosHandle
= SMBIOS_HANDLE_PI_RESERVED
;
92 Status
= Smbios
-> Add(
96 (EFI_SMBIOS_TABLE_HEADER
*) SmbiosRecord
98 FreePool(SmbiosRecord
);