]>
Commit | Line | Data |
---|---|---|
1 | /*++\r | |
2 | \r | |
3 | Copyright (c) 2012 - 2014, Intel Corporation. All rights reserved.<BR>\r | |
4 | \r\r | |
5 | SPDX-License-Identifier: BSD-2-Clause-Patent\r | |
6 | \r | |
7 | \r\r | |
8 | \r | |
9 | \r | |
10 | Module Name:\r | |
11 | \r | |
12 | MiscPhysicalArrayFunction.c\r | |
13 | \r | |
14 | Abstract:\r | |
15 | \r | |
16 | BIOS system Physical Array boot time changes.\r | |
17 | SMBIOS type 16.\r | |
18 | \r | |
19 | --*/\r | |
20 | \r | |
21 | \r | |
22 | #include "CommonHeader.h"\r | |
23 | #include "MiscSubclassDriver.h"\r | |
24 | \r | |
25 | \r | |
26 | \r | |
27 | /**\r | |
28 | This function makes boot time changes to the contents of the\r | |
29 | MiscPhysicalArrayFunction (Type 16).\r | |
30 | \r | |
31 | @param RecordData Pointer to copy of RecordData from the Data Table.\r | |
32 | \r | |
33 | @retval EFI_SUCCESS All parameters were valid.\r | |
34 | @retval EFI_UNSUPPORTED Unexpected RecordType value.\r | |
35 | @retval EFI_INVALID_PARAMETER Invalid parameter was found.\r | |
36 | \r | |
37 | **/\r | |
38 | \r | |
39 | MISC_SMBIOS_TABLE_FUNCTION(MiscPhysicalMemoryArray)\r | |
40 | {\r | |
41 | EFI_STATUS Status;\r | |
42 | EFI_SMBIOS_HANDLE SmbiosHandle;\r | |
43 | SMBIOS_TABLE_TYPE16 *SmbiosRecord;\r | |
44 | EFI_MEMORY_ARRAY_LOCATION_DATA *ForType16InputData;\r | |
45 | UINT32 TopOfMemory = 8 * 1024 * 1024;\r | |
46 | \r | |
47 | //\r | |
48 | // First check for invalid parameters.\r | |
49 | //\r | |
50 | if (RecordData == NULL) {\r | |
51 | return EFI_INVALID_PARAMETER;\r | |
52 | }\r | |
53 | \r | |
54 | ForType16InputData = (EFI_MEMORY_ARRAY_LOCATION_DATA *)RecordData;\r | |
55 | \r | |
56 | //\r | |
57 | // Two zeros following the last string.\r | |
58 | //\r | |
59 | SmbiosRecord = AllocatePool(sizeof (SMBIOS_TABLE_TYPE16) + 1);\r | |
60 | ZeroMem(SmbiosRecord, sizeof (SMBIOS_TABLE_TYPE16) + 1);\r | |
61 | \r | |
62 | SmbiosRecord->Hdr.Type = EFI_SMBIOS_TYPE_PHYSICAL_MEMORY_ARRAY;\r | |
63 | SmbiosRecord->Hdr.Length = sizeof (SMBIOS_TABLE_TYPE16);\r | |
64 | \r | |
65 | //\r | |
66 | // Make handle chosen by smbios protocol.add automatically.\r | |
67 | //\r | |
68 | SmbiosRecord->Hdr.Handle = 0;\r | |
69 | \r | |
70 | //\r | |
71 | // ReleaseDate will be the 3rd optional string following the formatted structure.\r | |
72 | //\r | |
73 | SmbiosRecord->Location = *(UINT8 *) &ForType16InputData ->MemoryArrayLocation;\r | |
74 | SmbiosRecord->Use = *(UINT8 *) &ForType16InputData ->MemoryArrayUse;\r | |
75 | SmbiosRecord->MemoryErrorCorrection = *(UINT8 *) &ForType16InputData->MemoryErrorCorrection;\r | |
76 | \r | |
77 | //\r | |
78 | // System does not provide the error information structure\r | |
79 | //\r | |
80 | SmbiosRecord->MemoryErrorInformationHandle = 0xFFFE;\r | |
81 | \r | |
82 | //\r | |
83 | // Maximum memory capacity\r | |
84 | //\r | |
85 | SmbiosRecord-> MaximumCapacity = TopOfMemory;\r | |
86 | SmbiosRecord-> NumberOfMemoryDevices= 0x02;\r | |
87 | \r | |
88 | //\r | |
89 | // Now we have got the full smbios record, call smbios protocol to add this record.\r | |
90 | //\r | |
91 | SmbiosHandle = SMBIOS_HANDLE_PI_RESERVED;\r | |
92 | Status = Smbios-> Add(\r | |
93 | Smbios,\r | |
94 | NULL,\r | |
95 | &SmbiosHandle,\r | |
96 | (EFI_SMBIOS_TABLE_HEADER *) SmbiosRecord\r | |
97 | );\r | |
98 | FreePool(SmbiosRecord);\r | |
99 | return Status;\r | |
100 | \r | |
101 | }\r |