2 Routines that support Processor 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 Processor SubClass record type 17 -- Cache association.
20 @param StructureNode Pointer to SMBIOS_STRUCTURE_NODE which is current processed.
21 @param Offset Offset of SMBIOS record which RecordData will be filled.
22 @param RecordData RecordData buffer will be filled.
23 @param RecordDataSize The size of RecordData buffer.
25 @retval EFI_SUCCESS Success fill RecordData into SMBIOS's record buffer.
28 SmbiosFldProcessorType17 (
29 IN OUT SMBIOS_STRUCTURE_NODE
*StructureNode
,
32 IN UINT32 RecordDataSize
35 EFI_SUBCLASS_TYPE1_HEADER
*DataHeader
;
36 EFI_INTER_LINK_DATA
*LinkData
;
40 DataHeader
= (EFI_SUBCLASS_TYPE1_HEADER
*) RecordData
;
41 LinkData
= (EFI_INTER_LINK_DATA
*) (DataHeader
+ 1);
42 if (RecordDataSize
!= sizeof (EFI_INTER_LINK_DATA
) + sizeof (EFI_SUBCLASS_TYPE1_HEADER
)) {
43 return EFI_INVALID_PARAMETER
;
46 // Determine the cache level
48 Pointer
= (UINT8
*) (StructureNode
->Structure
) + OFFSET_OF (SMBIOS_TABLE_TYPE4
, L1CacheHandle
);
49 if ((*Pointer
== 0) && (*(Pointer
+ 1) == 0)) {
50 SetMem ((UINT8
*) (StructureNode
->Structure
) + OFFSET_OF (SMBIOS_TABLE_TYPE4
, L1CacheHandle
), 2, 0xFF);
53 Pointer
= (UINT8
*) (StructureNode
->Structure
) + OFFSET_OF (SMBIOS_TABLE_TYPE4
, L2CacheHandle
);
54 if ((*Pointer
== 0) && (*(Pointer
+ 1) == 0)) {
55 SetMem ((UINT8
*) (StructureNode
->Structure
) + OFFSET_OF (SMBIOS_TABLE_TYPE4
, L2CacheHandle
), 2, 0xFF);
58 Pointer
= (UINT8
*) (StructureNode
->Structure
) + OFFSET_OF (SMBIOS_TABLE_TYPE4
, L3CacheHandle
);
59 if ((*Pointer
== 0) && (*(Pointer
+ 1) == 0)) {
60 SetMem ((UINT8
*) (StructureNode
->Structure
) + OFFSET_OF (SMBIOS_TABLE_TYPE4
, L3CacheHandle
), 2, 0xFF);
63 if (LinkData
->SubInstance
== 1) {
64 FieldOffset
= (UINT16
) OFFSET_OF (SMBIOS_TABLE_TYPE4
, L1CacheHandle
);
65 } else if (LinkData
->SubInstance
== 2) {
66 FieldOffset
= (UINT16
) OFFSET_OF (SMBIOS_TABLE_TYPE4
, L2CacheHandle
);
67 } else if (LinkData
->SubInstance
== 3) {
68 FieldOffset
= (UINT16
) OFFSET_OF (SMBIOS_TABLE_TYPE4
, L3CacheHandle
);
70 return EFI_INVALID_PARAMETER
;
73 return SmbiosFldInterLink (
76 7, // Smbios type 7 -- Cache Information
78 &gEfiCacheSubClassGuid
// gProcessorSubClassName
83 Field Filling Function for Processor SubClass record type 6 -- ProcessorID.
86 @param StructureNode Pointer to SMBIOS_STRUCTURE_NODE which is current processed.
87 @param Offset Offset of SMBIOS record which RecordData will be filled.
88 @param RecordData RecordData buffer will be filled.
89 @param RecordDataSize The size of RecordData buffer.
91 @retval EFI_SUCCESS Success fill RecordData into SMBIOS's record buffer.
94 SmbiosFldProcessorType6 (
95 IN OUT SMBIOS_STRUCTURE_NODE
*StructureNode
,
98 IN UINT32 RecordDataSize
101 EFI_PROCESSOR_ID_DATA
*ProcessorIdData
;
103 ProcessorIdData
= RecordData
;
105 (UINT8
*) (StructureNode
->Structure
) + Offset
,
106 &(ProcessorIdData
->Signature
),
111 (UINT8
*) (StructureNode
->Structure
) + Offset
+ 4,
112 &(ProcessorIdData
->FeatureFlags
),
120 Field Filling Function for Processor SubClass record type 9 -- Voltage.
123 @param StructureNode Pointer to SMBIOS_STRUCTURE_NODE which is current processed.
124 @param Offset Offset of SMBIOS record which RecordData will be filled.
125 @param RecordData RecordData buffer will be filled.
126 @param RecordDataSize The size of RecordData buffer.
128 @retval EFI_SUCCESS Success fill RecordData into SMBIOS's record buffer.
131 SmbiosFldProcessorType9 (
132 IN OUT SMBIOS_STRUCTURE_NODE
*StructureNode
,
135 IN UINT32 RecordDataSize
138 EFI_EXP_BASE10_DATA
*Base10Data
;
142 if (RecordDataSize
!= sizeof (EFI_EXP_BASE10_DATA
)) {
143 return EFI_INVALID_PARAMETER
;
146 Base10Data
= RecordData
;
147 Value
= Base10Data
->Value
;
148 Exponent
= Base10Data
->Exponent
;
151 while (Exponent
!= 0) {
153 Value
= (INT16
) (Value
* 10);
156 Value
= (INT16
) (Value
/ 10);
161 * (UINT8
*) ((UINT8
*) (StructureNode
->Structure
) + Offset
) = (UINT8
) (Value
| BIT7
);