2 Routines that support Memory SubClass data records translation.
4 Copyright (c) 2009, Intel Corporation
5 All rights reserved. This program and the accompanying materials
6 are licensed and made available under the terms and conditions of the BSD License
7 which accompanies this distribution. The full text of the license may be found at
8 http://opensource.org/licenses/bsd-license.php
10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
18 Field Filling Function for Memory SubClass record type 2 -- Physical Memory
21 @param StructureNode Pointer to SMBIOS_STRUCTURE_NODE which is current processed.
22 @param Offset Offset of SMBIOS record which RecordData will be filled.
23 @param RecordData RecordData buffer will be filled.
24 @param RecordDataSize The size of RecordData buffer.
26 @retval EFI_SUCCESS Success fill RecordData into SMBIOS's record buffer.
29 SmbiosFldMemoryType2 (
30 IN OUT SMBIOS_STRUCTURE_NODE
*StructureNode
,
33 IN UINT32 RecordDataSize
37 EFI_MEMORY_ARRAY_LOCATION_DATA
*PhyMemArray
;
38 FRAMEWORK_MEMORY_ARRAY_LOCATION_DATA
*FrameworkPhyMemArray
;
39 UINT32 MemoryCapacity
;
40 UINT16 NumberMemoryDevices
;
44 PhyMemArray
= (EFI_MEMORY_ARRAY_LOCATION_DATA
*) RecordData
;
45 FrameworkPhyMemArray
= (FRAMEWORK_MEMORY_ARRAY_LOCATION_DATA
*) RecordData
;
47 *(UINT8
*) ((UINT8
*) (StructureNode
->Structure
) + OFFSET_OF (SMBIOS_TABLE_TYPE16
, Location
)) = (UINT8
) (PhyMemArray
->MemoryArrayLocation
);
48 *(UINT8
*) ((UINT8
*) (StructureNode
->Structure
) + OFFSET_OF (SMBIOS_TABLE_TYPE16
, Use
)) = (UINT8
) (PhyMemArray
->MemoryArrayUse
);
49 *(UINT8
*) ((UINT8
*) (StructureNode
->Structure
) + OFFSET_OF (SMBIOS_TABLE_TYPE16
, MemoryErrorCorrection
)) = (UINT8
) (PhyMemArray
->MemoryErrorCorrection
);
51 if (!FeaturePcdGet(PcdFrameworkCompatibilitySupport
)) {
52 MemoryCapacity
= (UINT32
) (((UINTN
) PhyMemArray
->MaximumMemoryCapacity
.Value
) << PhyMemArray
->MaximumMemoryCapacity
.Exponent
);
53 NumberMemoryDevices
= PhyMemArray
->NumberMemoryDevices
;
56 // Support EDk/Framework defined Data strucutre.
58 MemoryCapacity
= FrameworkPhyMemArray
->MaximumMemoryCapacity
;
59 NumberMemoryDevices
= FrameworkPhyMemArray
->NumberMemoryDevices
;
63 (UINT8
*) StructureNode
->Structure
+ OFFSET_OF (SMBIOS_TABLE_TYPE16
, MaximumCapacity
),
70 (UINT8
*) (StructureNode
->Structure
) + OFFSET_OF (SMBIOS_TABLE_TYPE16
, MemoryErrorInformationHandle
),
76 (UINT8
*) (StructureNode
->Structure
) + OFFSET_OF (SMBIOS_TABLE_TYPE16
, NumberOfMemoryDevices
),
85 Field Filling Function for Memory SubClass record type 3 -
86 - Memory Device: SMBIOS Type 17
88 @param StructureNode Pointer to SMBIOS_STRUCTURE_NODE which is current processed.
89 @param Offset Offset of SMBIOS record which RecordData will be filled.
90 @param RecordData RecordData buffer will be filled.
91 @param RecordDataSize The size of RecordData buffer.
93 @retval EFI_SUCCESS Success fill RecordData into SMBIOS's record buffer.
96 SmbiosFldMemoryType3 (
97 IN OUT SMBIOS_STRUCTURE_NODE
*StructureNode
,
100 IN UINT32 RecordDataSize
103 EFI_MEMORY_ARRAY_LINK_DATA
*MemDevice
;
104 FRAMEWORK_MEMORY_ARRAY_LINK_DATA
*FrameworkMemDevice
;
105 UINT64 MemoryDeviceSize
;
106 BOOLEAN MemoryDeviceSizeUnitMega
;
107 UINT16 MemoryDeviceSpeed
;
108 UINT16 MemoryDeviceExponent
;
111 MemDevice
= (EFI_MEMORY_ARRAY_LINK_DATA
*) RecordData
;
112 FrameworkMemDevice
= (FRAMEWORK_MEMORY_ARRAY_LINK_DATA
*) RecordData
;
113 MemoryDeviceSpeed
= 0;
114 MemoryDeviceExponent
= 0;
117 // Memory Device Locator
121 OFFSET_OF (SMBIOS_TABLE_TYPE17
, DeviceLocator
),
122 &(MemDevice
->MemoryDeviceLocator
),
127 // Memory Bank Locator
131 OFFSET_OF (SMBIOS_TABLE_TYPE17
, BankLocator
),
132 &(MemDevice
->MemoryBankLocator
),
137 // Memory Manufacturer
141 OFFSET_OF (SMBIOS_TABLE_TYPE17
, Manufacturer
),
142 &(MemDevice
->MemoryManufacturer
),
147 // Memory Serial Number
151 OFFSET_OF (SMBIOS_TABLE_TYPE17
, SerialNumber
),
152 &(MemDevice
->MemorySerialNumber
),
161 OFFSET_OF (SMBIOS_TABLE_TYPE17
, AssetTag
),
162 &(MemDevice
->MemoryAssetTag
),
167 // Memory Part Number
171 OFFSET_OF (SMBIOS_TABLE_TYPE17
, PartNumber
),
172 &(MemDevice
->MemoryPartNumber
),
181 (UINT16
) OFFSET_OF (SMBIOS_TABLE_TYPE17
, MemoryArrayHandle
),
182 16, // SMBIOS type 16
183 &MemDevice
->MemoryArrayLink
,
184 &gEfiMemorySubClassGuid
188 // Set Memory Error Information Handle to Not supported
192 (UINT8
*) (StructureNode
->Structure
) + OFFSET_OF (SMBIOS_TABLE_TYPE17
, MemoryErrorInformationHandle
),
194 sizeof (EFI_SMBIOS_HANDLE
)
201 (UINT8
*) StructureNode
->Structure
+ OFFSET_OF (SMBIOS_TABLE_TYPE17
, TotalWidth
),
202 &MemDevice
->MemoryTotalWidth
,
210 (UINT8
*) StructureNode
->Structure
+ OFFSET_OF (SMBIOS_TABLE_TYPE17
, DataWidth
),
211 &MemDevice
->MemoryDataWidth
,
218 if (!FeaturePcdGet(PcdFrameworkCompatibilitySupport
)) {
223 (UINT8
*) StructureNode
->Structure
+ OFFSET_OF (SMBIOS_TABLE_TYPE17
, FormFactor
),
224 &MemDevice
->MemoryFormFactor
,
232 (UINT8
*) StructureNode
->Structure
+ OFFSET_OF (SMBIOS_TABLE_TYPE17
, DeviceSet
),
233 &MemDevice
->MemoryDeviceSet
,
241 (UINT8
*) StructureNode
->Structure
+ OFFSET_OF (SMBIOS_TABLE_TYPE17
, MemoryType
),
242 &MemDevice
->MemoryType
,
250 (UINT8
*) StructureNode
->Structure
+ OFFSET_OF (SMBIOS_TABLE_TYPE17
, TypeDetail
),
251 &MemDevice
->MemoryTypeDetail
,
258 MemoryDeviceSpeed
= MemDevice
->MemorySpeed
.Value
;
259 MemoryDeviceExponent
= MemDevice
->MemorySpeed
.Exponent
;
260 while (MemoryDeviceExponent
-- > 0) {
261 MemoryDeviceSpeed
= (UINT16
) (MemoryDeviceSpeed
* 10);
265 (UINT8
*) StructureNode
->Structure
+ OFFSET_OF (SMBIOS_TABLE_TYPE17
, Speed
),
270 MemoryDeviceSize
= (UINT64
) (((UINTN
) MemDevice
->MemoryDeviceSize
.Value
) << MemDevice
->MemoryDeviceSize
.Exponent
);
276 (UINT8
*) StructureNode
->Structure
+ OFFSET_OF (SMBIOS_TABLE_TYPE17
, FormFactor
),
277 &FrameworkMemDevice
->MemoryFormFactor
,
285 (UINT8
*) StructureNode
->Structure
+ OFFSET_OF (SMBIOS_TABLE_TYPE17
, DeviceSet
),
286 &FrameworkMemDevice
->MemoryDeviceSet
,
294 (UINT8
*) StructureNode
->Structure
+ OFFSET_OF (SMBIOS_TABLE_TYPE17
, MemoryType
),
295 &FrameworkMemDevice
->MemoryType
,
303 (UINT8
*) StructureNode
->Structure
+ OFFSET_OF (SMBIOS_TABLE_TYPE17
, TypeDetail
),
304 &FrameworkMemDevice
->MemoryTypeDetail
,
312 (UINT8
*) StructureNode
->Structure
+ OFFSET_OF (SMBIOS_TABLE_TYPE17
, Speed
),
313 &FrameworkMemDevice
->MemorySpeed
,
317 MemoryDeviceSize
= FrameworkMemDevice
->MemoryDeviceSize
;
320 MemoryDeviceSizeUnitMega
= FALSE
;
321 MemoryDeviceSize
= RShiftU64 (MemoryDeviceSize
, 10);
325 if (MemoryDeviceSize
> 0xffff) {
326 MemoryDeviceSize
= RShiftU64 (MemoryDeviceSize
, 10);
330 MemoryDeviceSizeUnitMega
= TRUE
;
333 MemoryDeviceSize
= MemoryDeviceSize
& 0x7fff;
334 if (MemoryDeviceSize
!= 0 && !MemoryDeviceSizeUnitMega
) {
335 MemoryDeviceSize
|= 0x8000;
339 (UINT8
*) StructureNode
->Structure
+ OFFSET_OF (SMBIOS_TABLE_TYPE17
, Size
),
348 Field Filling Function for Memory SubClass record type 3 -
349 - Memory Device: SMBIOS Type 6
351 @param StructureNode Pointer to SMBIOS_STRUCTURE_NODE which is current processed.
352 @param Offset Offset of SMBIOS record which RecordData will be filled.
353 @param RecordData RecordData buffer will be filled.
354 @param RecordDataSize The size of RecordData buffer.
356 @retval EFI_SUCCESS Success fill RecordData into SMBIOS's record buffer.
359 SmbiosFldSMBIOSType6 (
360 IN OUT SMBIOS_STRUCTURE_NODE
*StructureNode
,
363 IN UINT32 RecordDataSize
366 EFI_MEMORY_ARRAY_LINK_DATA
*MemDevice
;
367 UINT64 MemoryDeviceSize
;
371 FRAMEWORK_MEMORY_ARRAY_LINK_DATA
*FrameworkMemDevice
;
372 UINT16 MemoryDeviceSpeed
;
373 UINT16 MemoryDeviceExponent
;
375 MemDevice
= (EFI_MEMORY_ARRAY_LINK_DATA
*) RecordData
;
376 FrameworkMemDevice
= (FRAMEWORK_MEMORY_ARRAY_LINK_DATA
*) RecordData
;
377 MemoryDeviceExponent
= 0;
380 // Memory Device Locator
384 OFFSET_OF (SMBIOS_TABLE_TYPE6
, SocketDesignation
),
385 &(MemDevice
->MemoryDeviceLocator
),
389 if (!FeaturePcdGet(PcdFrameworkCompatibilitySupport
)) {
390 MemoryDeviceSpeed
= MemDevice
->MemorySpeed
.Value
;
391 MemoryDeviceExponent
= MemDevice
->MemorySpeed
.Exponent
;
392 while (MemoryDeviceExponent
-- > 0) {
393 MemoryDeviceSpeed
= (UINT16
) (MemoryDeviceSpeed
* 10);
395 MemoryDeviceSize
= (UINT64
) (((UINTN
) MemDevice
->MemoryDeviceSize
.Value
) << MemDevice
->MemoryDeviceSize
.Exponent
);
398 // Support EDk/Framework defined Data strucutre.
400 MemoryDeviceSpeed
= FrameworkMemDevice
->MemorySpeed
;
401 MemoryDeviceSize
= FrameworkMemDevice
->MemoryDeviceSize
;
404 if (MemoryDeviceSpeed
== 0) {
408 // Memory speed is in ns unit
410 MemSpeed
= (UINT8
)(1000 / MemoryDeviceSpeed
);
414 (UINT8
*)StructureNode
->Structure
+ OFFSET_OF (SMBIOS_TABLE_TYPE6
, CurrentSpeed
),
424 if (MemoryDeviceSize
== 0) {
427 MemoryDeviceSize
= RShiftU64 (MemoryDeviceSize
, 21);
428 while (MemoryDeviceSize
!= 0) {
430 MemoryDeviceSize
= RShiftU64(MemoryDeviceSize
,1);
435 (UINT8
*)StructureNode
->Structure
+ OFFSET_OF (SMBIOS_TABLE_TYPE6
, InstalledSize
),
441 (UINT8
*)StructureNode
->Structure
+ OFFSET_OF (SMBIOS_TABLE_TYPE6
, EnabledSize
),
447 // According SMBIOS SPEC Type 6 definition
450 if (!FeaturePcdGet(PcdFrameworkCompatibilitySupport
)) {
451 if (MemDevice
->MemoryFormFactor
== EfiMemoryFormFactorDimm
||
452 MemDevice
->MemoryFormFactor
== EfiMemoryFormFactorFbDimm
) {
456 if (MemDevice
->MemoryFormFactor
== EfiMemoryFormFactorSimm
) {
460 if (MemDevice
->MemoryType
== EfiMemoryTypeSdram
) {
464 if (MemDevice
->MemoryTypeDetail
.Edo
== 1) {
468 if (MemDevice
->MemoryTypeDetail
.FastPaged
== 1) {
473 // Support EDk/Framework defined Data strucutre.
475 if (FrameworkMemDevice
->MemoryFormFactor
== EfiMemoryFormFactorDimm
||
476 FrameworkMemDevice
->MemoryFormFactor
== EfiMemoryFormFactorFbDimm
) {
480 if (FrameworkMemDevice
->MemoryFormFactor
== EfiMemoryFormFactorSimm
) {
484 if (FrameworkMemDevice
->MemoryType
== EfiMemoryTypeSdram
) {
488 if (FrameworkMemDevice
->MemoryTypeDetail
.Edo
== 1) {
492 if (FrameworkMemDevice
->MemoryTypeDetail
.FastPaged
== 1) {
500 (UINT8
*)StructureNode
->Structure
+ OFFSET_OF (SMBIOS_TABLE_TYPE6
, CurrentMemoryType
),
510 Field Filling Function for Memory SubClass record type 4
511 -- Memory Array Mapped Address: SMBIOS Type 19
513 @param StructureNode Pointer to SMBIOS_STRUCTURE_NODE which is current processed.
514 @param Offset Offset of SMBIOS record which RecordData will be filled.
515 @param RecordData RecordData buffer will be filled.
516 @param RecordDataSize The size of RecordData buffer.
518 @retval EFI_SUCCESS Success fill RecordData into SMBIOS's record buffer.
521 SmbiosFldMemoryType4 (
522 IN OUT SMBIOS_STRUCTURE_NODE
*StructureNode
,
525 IN UINT32 RecordDataSize
528 EFI_MEMORY_ARRAY_START_ADDRESS_DATA
*Masa
;
529 EFI_PHYSICAL_ADDRESS TempData
;
531 Masa
= (EFI_MEMORY_ARRAY_START_ADDRESS_DATA
*) RecordData
;
536 TempData
= RShiftU64 (Masa
->MemoryArrayStartAddress
, 10);
538 (UINT8
*) StructureNode
->Structure
+ OFFSET_OF (SMBIOS_TABLE_TYPE19
, StartingAddress
),
546 TempData
= RShiftU64 (Masa
->MemoryArrayEndAddress
, 10);
548 (UINT8
*) StructureNode
->Structure
+ OFFSET_OF (SMBIOS_TABLE_TYPE19
, EndingAddress
),
557 (UINT8
*) StructureNode
->Structure
+ OFFSET_OF (SMBIOS_TABLE_TYPE19
, PartitionWidth
),
558 &Masa
->MemoryArrayPartitionWidth
,
563 // Physical Memory Array Link
565 return SmbiosFldInterLink (
567 (UINT16
) OFFSET_OF (SMBIOS_TABLE_TYPE19
, MemoryArrayHandle
),
568 16, // SMBIOS type 16
569 &Masa
->PhysicalMemoryArrayLink
,
570 &gEfiMemorySubClassGuid
576 Field Filling Function for Memory SubClass record type 5
577 -- Memory Device Mapped Address: SMBIOS Type 20
579 @param StructureNode Pointer to SMBIOS_STRUCTURE_NODE which is current processed.
580 @param Offset Offset of SMBIOS record which RecordData will be filled.
581 @param RecordData RecordData buffer will be filled.
582 @param RecordDataSize The size of RecordData buffer.
584 @retval EFI_SUCCESS Success fill RecordData into SMBIOS's record buffer.
587 SmbiosFldMemoryType5 (
588 IN OUT SMBIOS_STRUCTURE_NODE
*StructureNode
,
591 IN UINT32 RecordDataSize
594 EFI_MEMORY_DEVICE_START_ADDRESS_DATA
*Mdsa
;
595 EFI_PHYSICAL_ADDRESS TempData
;
597 Mdsa
= (EFI_MEMORY_DEVICE_START_ADDRESS_DATA
*) RecordData
;
602 TempData
= RShiftU64 (Mdsa
->MemoryDeviceStartAddress
, 10);
604 (UINT8
*) StructureNode
->Structure
+ OFFSET_OF (SMBIOS_TABLE_TYPE20
, StartingAddress
),
612 TempData
= RShiftU64 (Mdsa
->MemoryDeviceEndAddress
, 10);
614 (UINT8
*) StructureNode
->Structure
+ OFFSET_OF (SMBIOS_TABLE_TYPE20
, EndingAddress
),
620 // Memory Device Link
624 (UINT16
) OFFSET_OF (SMBIOS_TABLE_TYPE20
, MemoryDeviceHandle
),
625 17, // SMBIOS type 17
626 &Mdsa
->PhysicalMemoryDeviceLink
,
627 &gEfiMemorySubClassGuid
631 // Memory Array Mapped Address Link
635 (UINT16
) OFFSET_OF (SMBIOS_TABLE_TYPE20
, MemoryArrayMappedAddressHandle
),
636 19, // SMBIOS type 19
637 &Mdsa
->PhysicalMemoryArrayLink
,
638 &gEfiMemorySubClassGuid
642 // Memory Device Partition Row Position
644 *(UINT8
*) ((UINT8
*) StructureNode
->Structure
+ OFFSET_OF (SMBIOS_TABLE_TYPE20
, PartitionRowPosition
)) = (UINT8
) Mdsa
->MemoryDevicePartitionRowPosition
;
647 // Memory Device Interleave Position
649 *(UINT8
*) ((UINT8
*) StructureNode
->Structure
+ OFFSET_OF (SMBIOS_TABLE_TYPE20
, InterleavePosition
)) = (UINT8
) Mdsa
->MemoryDeviceInterleavePosition
;
652 // Memory Device Interleave Data Depth
654 *(UINT8
*) ((UINT8
*) StructureNode
->Structure
+ OFFSET_OF (SMBIOS_TABLE_TYPE20
, InterleavedDataDepth
)) = (UINT8
) Mdsa
->MemoryDeviceInterleaveDataDepth
;
660 Field Filling Function for Memory SubClass record type 6
661 -- Memory Channel Type: SMBIOS Type 37
663 @param StructureNode Pointer to SMBIOS_STRUCTURE_NODE which is current processed.
664 @param Offset Offset of SMBIOS record which RecordData will be filled.
665 @param RecordData RecordData buffer will be filled.
666 @param RecordDataSize The size of RecordData buffer.
668 @retval EFI_SUCCESS Success fill RecordData into SMBIOS's record buffer.
671 SmbiosFldMemoryType6 (
672 IN OUT SMBIOS_STRUCTURE_NODE
*StructureNode
,
675 IN UINT32 RecordDataSize
678 EFI_MEMORY_CHANNEL_TYPE_DATA
*McTa
;
681 McTa
= (EFI_MEMORY_CHANNEL_TYPE_DATA
*) RecordData
;
683 *(UINT8
*) ((UINT8
*) (StructureNode
->Structure
) + OFFSET_OF (SMBIOS_TABLE_TYPE37
, ChannelType
)) = (UINT8
) (McTa
->MemoryChannelType
);
685 *(UINT8
*) ((UINT8
*) (StructureNode
->Structure
) + OFFSET_OF (SMBIOS_TABLE_TYPE37
, MaximumChannelLoad
)) = (UINT8
) (McTa
->MemoryChannelMaximumLoad
);
687 *(UINT8
*) ((UINT8
*) (StructureNode
->Structure
) + OFFSET_OF (SMBIOS_TABLE_TYPE37
, MemoryDeviceCount
)) = (UINT8
) (McTa
->MemoryChannelDeviceCount
);
690 // Update the length field
691 // Multiple device loads are filled through SmbiosFldMemoryType7
693 StructureNode
->Structure
->Length
= (UINT8
)(StructureNode
->Structure
->Length
+
694 sizeof(MEMORY_DEVICE
) * McTa
->MemoryChannelDeviceCount
);
695 Status
= SmbiosEnlargeStructureBuffer(
697 StructureNode
->Structure
->Length
,
698 StructureNode
->StructureSize
,
699 StructureNode
->StructureSize
+ sizeof(MEMORY_DEVICE
) * McTa
->MemoryChannelDeviceCount
705 Field Filling Function for Memory SubClass record type 7
706 -- Memory Channel Device: SMBIOS Type 37
708 @param StructureNode Pointer to SMBIOS_STRUCTURE_NODE which is current processed.
709 @param Offset Offset of SMBIOS record which RecordData will be filled.
710 @param RecordData RecordData buffer will be filled.
711 @param RecordDataSize The size of RecordData buffer.
713 @retval EFI_SUCCESS Success fill RecordData into SMBIOS's record buffer.
716 SmbiosFldMemoryType7 (
717 IN OUT SMBIOS_STRUCTURE_NODE
*StructureNode
,
720 IN UINT32 RecordDataSize
723 EFI_MEMORY_CHANNEL_DEVICE_DATA
*Mcdd
;
724 UINTN DeviceLoadOffset
;
725 UINTN DeviceLoadHandleOffset
;
727 Mcdd
= (EFI_MEMORY_CHANNEL_DEVICE_DATA
*) RecordData
;
729 if (Mcdd
->DeviceId
< 1) {
730 return EFI_INVALID_PARAMETER
;
733 DeviceLoadOffset
= OFFSET_OF (SMBIOS_TABLE_TYPE37
, MemoryDevice
[0]) + 3 * (Mcdd
->DeviceId
- 1);
734 DeviceLoadHandleOffset
= OFFSET_OF (SMBIOS_TABLE_TYPE37
, MemoryDevice
[1]) + 3 * (Mcdd
->DeviceId
- 1);
736 *(UINT8
*) ((UINT8
*) (StructureNode
->Structure
) + DeviceLoadOffset
) = (UINT8
) (Mcdd
->MemoryChannelDeviceLoad
);
739 // Memory Device Handle Link
741 return SmbiosFldInterLink (
743 (UINT16
) DeviceLoadHandleOffset
,
744 17, // Smbios type 17 -- Physical Memory Device
746 &gEfiMemorySubClassGuid
752 Field Filling Function for Memory SubClass record type 8
753 -- Memory Controller information: SMBIOS Type 5
755 @param StructureNode Pointer to SMBIOS_STRUCTURE_NODE which is current processed.
756 @param Offset Offset of SMBIOS record which RecordData will be filled.
757 @param RecordData RecordData buffer will be filled.
758 @param RecordDataSize The size of RecordData buffer.
760 @retval EFI_SUCCESS Success fill RecordData into SMBIOS's record buffer.
763 SmbiosFldMemoryType8 (
764 IN OUT SMBIOS_STRUCTURE_NODE
*StructureNode
,
767 IN UINT32 RecordDataSize
770 EFI_MEMORY_CONTROLLER_INFORMATION_DATA
*MemoryController
;
771 UINT32 NewMinimalSize
;
773 EFI_INTER_LINK_DATA
*Link
;
779 // There is an update from EFI_MEMORY_CONTROLLER_INFORMATION to
780 // EFI_MEMORY_CONTROLLER_INFORMATION_DATA. Multiple MemoryModuleConfig
781 // handles are filled.
783 MemoryController
= (EFI_MEMORY_CONTROLLER_INFORMATION_DATA
*)RecordData
;
786 // ErrorDetectingMethod
789 (UINT8
*) (StructureNode
->Structure
) + OFFSET_OF (SMBIOS_TABLE_TYPE5
, ErrDetectMethod
),
790 &MemoryController
->ErrorDetectingMethod
,
795 // ErrorCorrectingCapability
798 (UINT8
*) (StructureNode
->Structure
) + OFFSET_OF (SMBIOS_TABLE_TYPE5
, ErrCorrectCapability
),
799 &MemoryController
->ErrorCorrectingCapability
,
804 // MemorySupportedInterleave
807 (UINT8
*) (StructureNode
->Structure
) + OFFSET_OF (SMBIOS_TABLE_TYPE5
, SupportInterleave
),
808 &MemoryController
->MemorySupportedInterleave
,
813 // MemoryCurrentInterleave
816 (UINT8
*) (StructureNode
->Structure
) + OFFSET_OF (SMBIOS_TABLE_TYPE5
, CurrentInterleave
),
817 &MemoryController
->MemoryCurrentInterleave
,
822 // MaxMemoryModuleSize
825 (UINT8
*) (StructureNode
->Structure
) + OFFSET_OF (SMBIOS_TABLE_TYPE5
, MaxMemoryModuleSize
),
826 &MemoryController
->MaxMemoryModuleSize
,
834 (UINT8
*) (StructureNode
->Structure
) + OFFSET_OF (SMBIOS_TABLE_TYPE5
, SupportSpeed
),
835 &MemoryController
->MemorySpeedType
,
840 // MemorySupportedType
843 (UINT8
*) (StructureNode
->Structure
) + OFFSET_OF (SMBIOS_TABLE_TYPE5
, SupportMemoryType
),
844 &MemoryController
->MemorySupportedType
,
849 // MemoryModuleVoltage
852 (UINT8
*) (StructureNode
->Structure
) + OFFSET_OF (SMBIOS_TABLE_TYPE5
, MemoryModuleVoltage
),
853 &MemoryController
->MemoryModuleVoltage
,
858 // NumberofMemorySlot
861 (UINT8
*) (StructureNode
->Structure
) + OFFSET_OF (SMBIOS_TABLE_TYPE5
, AssociatedMemorySlotNum
),
862 &MemoryController
->NumberofMemorySlot
,
866 if (MemoryController
->NumberofMemorySlot
== 0) {
868 // EnabledCorrectingCapability
871 (UINT8
*) (StructureNode
->Structure
) + OFFSET_OF (SMBIOS_TABLE_TYPE5
, MemoryModuleConfigHandles
),
872 &MemoryController
->EnabledCorrectingCapability
,
877 // Memory module configuration handles exist
878 // we should enlarge smbios entry buffer from minimal size
880 NewMinimalSize
= (MemoryController
->NumberofMemorySlot
) * sizeof(UINT16
) + StructureNode
->StructureSize
;
881 StructureNode
->Structure
->Length
= (UINT8
) (NewMinimalSize
- 2);
882 Status
= SmbiosEnlargeStructureBuffer (StructureNode
, StructureNode
->Structure
->Length
, StructureNode
->StructureSize
, NewMinimalSize
);
883 ASSERT_EFI_ERROR (Status
);
886 // MemoryModuleConfigHandles
888 for (Count
= 0, Link
= MemoryController
->MemoryModuleConfig
;
889 Count
< MemoryController
->NumberofMemorySlot
;
893 (UINT16
) (OFFSET_OF (SMBIOS_TABLE_TYPE5
, MemoryModuleConfigHandles
) + Count
* sizeof(UINT16
)),
896 &gEfiMemorySubClassGuid
901 // EnabledCorrectingCapability
904 (UINT8
*) (StructureNode
->Structure
) + OFFSET_OF (SMBIOS_TABLE_TYPE5
, MemoryModuleConfigHandles
) + (MemoryController
->NumberofMemorySlot
) * sizeof(UINT16
),
905 &MemoryController
->EnabledCorrectingCapability
,
914 Field Filling Function for Memory SubClass record type
915 -- Memory 32 Bit Error Information: SMBIOS Type 18
917 @param StructureNode Pointer to SMBIOS_STRUCTURE_NODE which is current processed.
918 @param Offset Offset of SMBIOS record which RecordData will be filled.
919 @param RecordData RecordData buffer will be filled.
920 @param RecordDataSize The size of RecordData buffer.
922 @retval EFI_SUCCESS Success fill RecordData into SMBIOS's record buffer.
925 SmbiosFldMemoryType9 (
926 IN OUT SMBIOS_STRUCTURE_NODE
*StructureNode
,
929 IN UINT32 RecordDataSize
932 EFI_MEMORY_32BIT_ERROR_INFORMATION
*MemoryInfo
;
934 MemoryInfo
= (EFI_MEMORY_32BIT_ERROR_INFORMATION
*)RecordData
;
940 (UINT8
*) (StructureNode
->Structure
) + OFFSET_OF (SMBIOS_TABLE_TYPE18
, ErrorType
),
941 &MemoryInfo
->MemoryErrorType
,
946 // MemoryErrorGranularity
949 (UINT8
*) (StructureNode
->Structure
) + OFFSET_OF (SMBIOS_TABLE_TYPE18
, ErrorGranularity
),
950 &MemoryInfo
->MemoryErrorGranularity
,
955 // MemoryErrorOperation
958 (UINT8
*) (StructureNode
->Structure
) + OFFSET_OF (SMBIOS_TABLE_TYPE18
, ErrorOperation
),
959 &MemoryInfo
->MemoryErrorOperation
,
967 (UINT8
*) (StructureNode
->Structure
) + OFFSET_OF (SMBIOS_TABLE_TYPE18
, VendorSyndrome
),
968 &MemoryInfo
->VendorSyndrome
,
973 // MemoryArrayErrorAddress
976 (UINT8
*) (StructureNode
->Structure
) + OFFSET_OF (SMBIOS_TABLE_TYPE18
, MemoryArrayErrorAddress
),
977 &MemoryInfo
->MemoryArrayErrorAddress
,
982 // DeviceErrorAddress
985 (UINT8
*) (StructureNode
->Structure
) + OFFSET_OF (SMBIOS_TABLE_TYPE18
, DeviceErrorAddress
),
986 &MemoryInfo
->DeviceErrorAddress
,
991 // DeviceErrorResolution
994 (UINT8
*) (StructureNode
->Structure
) + OFFSET_OF (SMBIOS_TABLE_TYPE18
, ErrorResolution
),
995 &MemoryInfo
->DeviceErrorResolution
,
1003 Field Filling Function for Memory SubClass record type
1004 -- Memory 64 Bit Error Information: SMBIOS Type 33
1006 @param StructureNode Pointer to SMBIOS_STRUCTURE_NODE which is current processed.
1007 @param Offset Offset of SMBIOS record which RecordData will be filled.
1008 @param RecordData RecordData buffer will be filled.
1009 @param RecordDataSize The size of RecordData buffer.
1011 @retval EFI_SUCCESS Success fill RecordData into SMBIOS's record buffer.
1014 SmbiosFldMemoryType10 (
1015 IN OUT SMBIOS_STRUCTURE_NODE
*StructureNode
,
1017 IN VOID
*RecordData
,
1018 IN UINT32 RecordDataSize
1021 EFI_MEMORY_64BIT_ERROR_INFORMATION
*MemoryInfo
;
1023 MemoryInfo
= (EFI_MEMORY_64BIT_ERROR_INFORMATION
*)RecordData
;
1029 (UINT8
*) (StructureNode
->Structure
) + OFFSET_OF (SMBIOS_TABLE_TYPE33
, ErrorType
),
1030 &MemoryInfo
->MemoryErrorType
,
1035 // MemoryErrorGranularity
1038 (UINT8
*) (StructureNode
->Structure
) + OFFSET_OF (SMBIOS_TABLE_TYPE33
, ErrorGranularity
),
1039 &MemoryInfo
->MemoryErrorGranularity
,
1044 // MemoryErrorOperation
1047 (UINT8
*) (StructureNode
->Structure
) + OFFSET_OF (SMBIOS_TABLE_TYPE33
, ErrorOperation
),
1048 &MemoryInfo
->MemoryErrorOperation
,
1056 (UINT8
*) (StructureNode
->Structure
) + OFFSET_OF (SMBIOS_TABLE_TYPE33
, VendorSyndrome
),
1057 &MemoryInfo
->VendorSyndrome
,
1062 // MemoryArrayErrorAddress
1065 (UINT8
*) (StructureNode
->Structure
) + OFFSET_OF (SMBIOS_TABLE_TYPE33
, MemoryArrayErrorAddress
),
1066 &MemoryInfo
->MemoryArrayErrorAddress
,
1071 // DeviceErrorAddress
1074 (UINT8
*) (StructureNode
->Structure
) + OFFSET_OF (SMBIOS_TABLE_TYPE33
, DeviceErrorAddress
),
1075 &MemoryInfo
->DeviceErrorAddress
,
1080 // DeviceErrorResolution
1083 (UINT8
*) (StructureNode
->Structure
) + OFFSET_OF (SMBIOS_TABLE_TYPE33
, ErrorResolution
),
1084 &MemoryInfo
->DeviceErrorResolution
,