]> git.proxmox.com Git - mirror_edk2.git/blob - EdkCompatibilityPkg/Compatibility/DataHubSmBiosRecordsOnPiSmBiosThunk/MiscConv.c
Add a thunk driver to translate framework DataHub's smbios related record to PI SMBIO...
[mirror_edk2.git] / EdkCompatibilityPkg / Compatibility / DataHubSmBiosRecordsOnPiSmBiosThunk / MiscConv.c
1 /** @file
2 Routines that support Misc SubClass data records translation.
3
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
9
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.
12
13 **/
14
15 #include "Thunk.h"
16
17 /**
18 Field Filling Function for Misc SubClass record type 0 -- Bios Information.
19
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.
24
25 @retval EFI_SUCCESS Success fill RecordData into SMBIOS's record buffer.
26 **/
27 EFI_STATUS
28 SmbiosFldMiscType0 (
29 IN OUT SMBIOS_STRUCTURE_NODE *StructureNode,
30 IN UINT32 Offset,
31 IN VOID *RecordData,
32 IN UINT32 RecordDataSize
33 )
34 {
35 EFI_STATUS Status;
36 EFI_MISC_BIOS_VENDOR_DATA *BiosInfo;
37
38 Status = EFI_SUCCESS;
39 BiosInfo = NULL;
40
41 BiosInfo = (EFI_MISC_BIOS_VENDOR_DATA *) RecordData;
42
43 //
44 // Bios Vendor
45 //
46 SmbiosFldString (
47 StructureNode,
48 OFFSET_OF (SMBIOS_TABLE_TYPE0, Vendor),
49 &(BiosInfo->BiosVendor),
50 2 // 64 * sizeof(CHAR16)
51 );
52
53 //
54 // Bios Version
55 //
56 SmbiosFldString (
57 StructureNode,
58 OFFSET_OF (SMBIOS_TABLE_TYPE0, BiosVersion),
59 &(BiosInfo->BiosVersion),
60 2 // 64 * sizeof(CHAR16)
61 );
62
63 //
64 // Bios Release Date
65 //
66 SmbiosFldString (
67 StructureNode,
68 OFFSET_OF (SMBIOS_TABLE_TYPE0, BiosReleaseDate),
69 &(BiosInfo->BiosReleaseDate),
70 2 // 64 * sizeof(CHAR16)
71 );
72
73 //
74 // Bios Starting Address Segment
75 //
76 CopyMem (
77 (UINT8 *) (StructureNode->Structure) + OFFSET_OF (SMBIOS_TABLE_TYPE0, BiosSegment),
78 &BiosInfo->BiosStartingAddress,
79 2
80 );
81
82 //
83 // Bios Physical device size
84 //
85 SmbiosFldBase2ToByteWith64K (
86 StructureNode,
87 OFFSET_OF (SMBIOS_TABLE_TYPE0, BiosSize),
88 &BiosInfo->BiosPhysicalDeviceSize,
89 sizeof (EFI_EXP_BASE2_DATA)
90 );
91 (*(UINT8 *) ((UINT8 *) (StructureNode->Structure) + OFFSET_OF (SMBIOS_TABLE_TYPE0, BiosSize)))--;
92
93 //
94 // Bios Characteristics
95 //
96 CopyMem (
97 (UINT8 *) (StructureNode->Structure) + OFFSET_OF (SMBIOS_TABLE_TYPE0, BiosCharacteristics),
98 &BiosInfo->BiosCharacteristics1,
99 4
100 );
101
102 //
103 // Bios Characteristics higher four bytes
104 //
105 CopyMem (
106 (UINT8 *) (StructureNode->Structure) + OFFSET_OF (SMBIOS_TABLE_TYPE0, BiosCharacteristics) + 4,
107 &BiosInfo->BiosCharacteristics2,
108 4
109 );
110
111 //
112 // Bios Characteristics Extension1/2
113 //
114 CopyMem (
115 (UINT8 *) (StructureNode->Structure) + OFFSET_OF (SMBIOS_TABLE_TYPE0, BIOSCharacteristicsExtensionBytes),
116 (UINT8 *) &BiosInfo->BiosCharacteristics1 + 4,
117 2
118 );
119
120 //
121 // System BIOS Major Release
122 //
123 CopyMem (
124 (UINT8 *) (StructureNode->Structure) + OFFSET_OF (SMBIOS_TABLE_TYPE0, SystemBiosMajorRelease),
125 (UINT8 *) &BiosInfo->BiosMajorRelease,
126 1
127 );
128
129 //
130 // System BIOS Minor Release
131 //
132 CopyMem (
133 (UINT8 *) (StructureNode->Structure) + OFFSET_OF (SMBIOS_TABLE_TYPE0, SystemBiosMinorRelease),
134 (UINT8 *) &BiosInfo->BiosMinorRelease,
135 1
136 );
137
138 //
139 // Embedded Controller Firmware Major Release
140 //
141 CopyMem (
142 (UINT8 *) (StructureNode->Structure) + OFFSET_OF (SMBIOS_TABLE_TYPE0, EmbeddedControllerFirmwareMajorRelease),
143 (UINT8 *) &BiosInfo->BiosEmbeddedFirmwareMajorRelease,
144 1
145 );
146
147 //
148 // Embedded Controller Firmware Minor Release
149 //
150 CopyMem (
151 (UINT8 *) (StructureNode->Structure) + OFFSET_OF (SMBIOS_TABLE_TYPE0, EmbeddedControllerFirmwareMinorRelease),
152 (UINT8 *) &BiosInfo->BiosEmbeddedFirmwareMinorRelease,
153 1
154 );
155
156 return Status;
157 }
158
159 /**
160 Field Filling Function for Misc SubClass record type 1 -- System Information.
161
162 @param StructureNode Pointer to SMBIOS_STRUCTURE_NODE which is current processed.
163 @param Offset Offset of SMBIOS record which RecordData will be filled.
164 @param RecordData RecordData buffer will be filled.
165 @param RecordDataSize The size of RecordData buffer.
166
167 @retval EFI_SUCCESS Success fill RecordData into SMBIOS's record buffer.
168 **/
169 EFI_STATUS
170 SmbiosFldMiscType1 (
171 IN OUT SMBIOS_STRUCTURE_NODE *StructureNode,
172 IN UINT32 Offset,
173 IN VOID *RecordData,
174 IN UINT32 RecordDataSize
175 )
176 {
177 EFI_STATUS Status;
178 EFI_MISC_SYSTEM_MANUFACTURER_DATA *SystemInfo;
179
180 Status = EFI_SUCCESS;
181 SystemInfo = NULL;
182
183 SystemInfo = (EFI_MISC_SYSTEM_MANUFACTURER_DATA *) RecordData;
184
185 //
186 // System Manufacturer
187 //
188 SmbiosFldString (
189 StructureNode,
190 OFFSET_OF (SMBIOS_TABLE_TYPE1, Manufacturer),
191 &(SystemInfo->SystemManufacturer),
192 2 // 64 * sizeof(CHAR16)
193 );
194
195 //
196 // System Product Name
197 //
198 SmbiosFldString (
199 StructureNode,
200 OFFSET_OF (SMBIOS_TABLE_TYPE1, ProductName),
201 &(SystemInfo->SystemProductName),
202 2 // 64 * sizeof(CHAR16)
203 );
204
205 //
206 // System Version
207 //
208 SmbiosFldString (
209 StructureNode,
210 OFFSET_OF (SMBIOS_TABLE_TYPE1, Version),
211 &(SystemInfo->SystemVersion),
212 2 // 64 * sizeof(CHAR16)
213 );
214
215 //
216 // System Serial Number
217 //
218 SmbiosFldString (
219 StructureNode,
220 OFFSET_OF (SMBIOS_TABLE_TYPE1, SerialNumber),
221 &(SystemInfo->SystemSerialNumber),
222 2 // 64 * sizeof(CHAR16)
223 );
224
225 //
226 // Uuid
227 //
228 CopyMem (
229 (UINT8 *) (StructureNode->Structure) + OFFSET_OF (SMBIOS_TABLE_TYPE1, Uuid),
230 &SystemInfo->SystemUuid,
231 16
232 );
233
234 //
235 // Wakeup Type
236 //
237 CopyMem (
238 (UINT8 *) (StructureNode->Structure) + OFFSET_OF (SMBIOS_TABLE_TYPE1, WakeUpType),
239 &SystemInfo->SystemWakeupType,
240 1
241 );
242
243 //
244 // System SKU Number
245 //
246 SmbiosFldString (
247 StructureNode,
248 OFFSET_OF (SMBIOS_TABLE_TYPE1, SKUNumber),
249 &(SystemInfo->SystemSKUNumber),
250 2 // 64 * sizeof(CHAR16)
251 );
252
253 //
254 // System Family
255 //
256 SmbiosFldString (
257 StructureNode,
258 OFFSET_OF (SMBIOS_TABLE_TYPE1, Family),
259 &(SystemInfo->SystemFamily),
260 2 // 64 * sizeof(CHAR16)
261 );
262
263 return Status;
264 }
265
266 /**
267 Field Filling Function for record type 2 -- Base Board Manufacture.
268
269 @param StructureNode Pointer to SMBIOS_STRUCTURE_NODE which is current processed.
270 @param Offset Offset of SMBIOS record which RecordData will be filled.
271 @param RecordData RecordData buffer will be filled.
272 @param RecordDataSize The size of RecordData buffer.
273
274 @retval EFI_SUCCESS Success fill RecordData into SMBIOS's record buffer.
275 **/
276 EFI_STATUS
277 SmbiosFldMiscType2 (
278 IN OUT SMBIOS_STRUCTURE_NODE *StructureNode,
279 IN UINT32 Offset,
280 IN VOID *RecordData,
281 IN UINT32 RecordDataSize
282 )
283 {
284 EFI_STATUS Status;
285 EFI_MISC_BASE_BOARD_MANUFACTURER_DATA *Bbm;
286 Status = EFI_SUCCESS;
287 Bbm = (EFI_MISC_BASE_BOARD_MANUFACTURER_DATA *) RecordData;
288
289 //
290 // Manufacturer
291 //
292 SmbiosFldString (
293 StructureNode,
294 OFFSET_OF (SMBIOS_TABLE_TYPE2, Manufacturer),
295 &(Bbm->BaseBoardManufacturer),
296 2
297 );
298
299 //
300 // Product
301 //
302 SmbiosFldString (
303 StructureNode,
304 OFFSET_OF (SMBIOS_TABLE_TYPE2, ProductName),
305 &(Bbm->BaseBoardProductName),
306 2
307 );
308
309 //
310 // Version
311 //
312 SmbiosFldString (
313 StructureNode,
314 OFFSET_OF (SMBIOS_TABLE_TYPE2, Version),
315 &(Bbm->BaseBoardVersion),
316 2
317 );
318
319 //
320 // Serial Number
321 //
322 SmbiosFldString (
323 StructureNode,
324 OFFSET_OF (SMBIOS_TABLE_TYPE2, SerialNumber),
325 &(Bbm->BaseBoardSerialNumber),
326 2
327 );
328
329 //
330 // Asset Tag
331 //
332 SmbiosFldString (
333 StructureNode,
334 OFFSET_OF (SMBIOS_TABLE_TYPE2, AssetTag),
335 &(Bbm->BaseBoardAssetTag),
336 2
337 );
338
339 //
340 // Location in Chassis
341 //
342 SmbiosFldString (
343 StructureNode,
344 OFFSET_OF (SMBIOS_TABLE_TYPE2, LocationInChassis),
345 &(Bbm->BaseBoardChassisLocation),
346 2
347 );
348
349 //
350 // Feature Flags
351 //
352 CopyMem (
353 (UINT8 *) (StructureNode->Structure) + OFFSET_OF (SMBIOS_TABLE_TYPE2, FeatureFlag),
354 &Bbm->BaseBoardFeatureFlags,
355 1
356 );
357
358 //
359 // Board Type
360 //
361 *(UINT8 *) ((UINT8 *) (StructureNode->Structure) + OFFSET_OF (SMBIOS_TABLE_TYPE2, BoardType)) = (UINT8) Bbm->BaseBoardType;
362
363 //
364 // Chassis Handle
365 //
366 SmbiosFldInterLink (
367 StructureNode,
368 (UINT16) OFFSET_OF (SMBIOS_TABLE_TYPE2, ChassisHandle),
369 3, // SMBIOS type 3 - System Enclosure or Chassis
370 &Bbm->BaseBoardChassisLink,
371 &gEfiMiscSubClassGuid
372 );
373
374 //
375 // Number of Contained Object Handles
376 //
377 *(UINT8 *) ((UINT8 *) (StructureNode->Structure) + OFFSET_OF (SMBIOS_TABLE_TYPE2, NumberOfContainedObjectHandles)) = (UINT8) Bbm->BaseBoardNumberLinks;
378
379 return Status;
380 }
381
382 /**
383 Field Filling Function for Misc SubClass record type 3 -
384 - System Enclosure or Chassis.
385
386 @param StructureNode Pointer to SMBIOS_STRUCTURE_NODE which is current processed.
387 @param Offset Offset of SMBIOS record which RecordData will be filled.
388 @param RecordData RecordData buffer will be filled.
389 @param RecordDataSize The size of RecordData buffer.
390
391 @retval EFI_SUCCESS Success fill RecordData into SMBIOS's record buffer.
392 **/
393 EFI_STATUS
394 SmbiosFldMiscType3 (
395 IN OUT SMBIOS_STRUCTURE_NODE *StructureNode,
396 IN UINT32 Offset,
397 IN VOID *RecordData,
398 IN UINT32 RecordDataSize
399 )
400 {
401 EFI_STATUS Status;
402 EFI_MISC_CHASSIS_MANUFACTURER_DATA *Ec;
403 EFI_MISC_ELEMENTS *Element;
404 UINT16 Index;
405 UINT8 ContainedElementType;
406 Status = EFI_SUCCESS;
407 Ec = (EFI_MISC_CHASSIS_MANUFACTURER_DATA *) RecordData;
408
409 //
410 // Chassis Type
411 //
412 *(UINT8*)((UINT8 *) (StructureNode->Structure) +
413 OFFSET_OF (SMBIOS_TABLE_TYPE3, Type))
414 = (UINT8) (Ec->ChassisType.ChassisType | Ec->ChassisType.ChassisLockPresent << 7);
415
416
417 //
418 // Chassis Bootup State
419 //
420 CopyMem (
421 (UINT8 *) (StructureNode->Structure) + OFFSET_OF (SMBIOS_TABLE_TYPE3, BootupState),
422 &Ec->ChassisBootupState,
423 1
424 );
425
426 //
427 // Chassis Power Supply State
428 //
429 CopyMem (
430 (UINT8 *) (StructureNode->Structure) + OFFSET_OF (SMBIOS_TABLE_TYPE3, PowerSupplyState),
431 &Ec->ChassisPowerSupplyState,
432 1
433 );
434
435 //
436 // Chassis Thermal State
437 //
438 CopyMem (
439 (UINT8 *) (StructureNode->Structure) + OFFSET_OF (SMBIOS_TABLE_TYPE3, ThermalState),
440 &Ec->ChassisThermalState,
441 1
442 );
443
444 //
445 // Chassis Security State
446 //
447 CopyMem (
448 (UINT8 *) (StructureNode->Structure) + OFFSET_OF (SMBIOS_TABLE_TYPE3, SecurityStatus),
449 &Ec->ChassisSecurityState,
450 1
451 );
452
453 //
454 // Chassis Oem Defined
455 //
456 CopyMem (
457 (UINT8 *) (StructureNode->Structure) + OFFSET_OF (SMBIOS_TABLE_TYPE3, OemDefined),
458 &Ec->ChassisOemDefined,
459 4
460 );
461
462 //
463 // Chassis Height
464 //
465 *(UINT8*)((UINT8*)(StructureNode->Structure) +
466 OFFSET_OF (SMBIOS_TABLE_TYPE3, Height))
467 = (UINT8)Ec->ChassisHeight;
468
469 //
470 // Chassis Number Power Cords
471 //
472 *(UINT8*)((UINT8*)(StructureNode->Structure) +
473 OFFSET_OF (SMBIOS_TABLE_TYPE3, NumberofPowerCords))
474 = (UINT8)Ec->ChassisNumberPowerCords;
475
476 //
477 // Chassis Element Count
478 //
479 *(UINT8*)((UINT8*)(StructureNode->Structure) +
480 OFFSET_OF (SMBIOS_TABLE_TYPE3, ContainedElementCount))
481 = (UINT8)Ec->ChassisElementCount;
482
483 if( Ec->ChassisElementCount ) {
484 //
485 // Element Record Length
486 // Current solution covers first 3 bytes; user can extend to meet its requirements.
487 //
488 *(UINT8*)((UINT8*)(StructureNode->Structure) +
489 OFFSET_OF (SMBIOS_TABLE_TYPE3, ContainedElementRecordLength))
490 = (UINT8)sizeof(CONTAINED_ELEMENT);
491
492 //
493 // Update the structure's length and StructureSize
494 //
495 StructureNode->Structure->Length = (UINT8)(StructureNode->Structure->Length +
496 Ec->ChassisElementCount * sizeof(CONTAINED_ELEMENT));
497 Status = SmbiosEnlargeStructureBuffer (
498 StructureNode,
499 StructureNode->Structure->Length,
500 StructureNode->StructureSize,
501 StructureNode->StructureSize + Ec->ChassisElementCount * sizeof(CONTAINED_ELEMENT)
502 );
503 if (EFI_ERROR (Status)) {
504 return Status;
505 }
506
507 //
508 // Contained Elements
509 //
510 for (Index=0, Element = &Ec->ChassisElements;
511 Index < Ec->ChassisElementCount;
512 Index += 1, Element ++) {
513
514 //
515 // ContainedElementType
516 //
517 ContainedElementType = (UINT8)((Element->ChassisElementType.RecordType == 1)
518 ? (UINT8)(Element->ChassisElementType.RecordType << 7 | Element->ChassisElementType.Type)
519 : (UINT8)(Element->ChassisBaseBoard));
520 *(UINT8*)((UINT8*)(StructureNode->Structure) +
521 OFFSET_OF (SMBIOS_TABLE_TYPE3, ContainedElements) +
522 Index * sizeof(CONTAINED_ELEMENT) +
523 OFFSET_OF(CONTAINED_ELEMENT,ContainedElementType))
524 = ContainedElementType;
525
526 //
527 // ContainedElementMinimum
528 //
529 *(UINT8*)((UINT8*)(StructureNode->Structure) +
530 OFFSET_OF (SMBIOS_TABLE_TYPE3, ContainedElements) +
531 Index * sizeof(CONTAINED_ELEMENT) +
532 OFFSET_OF(CONTAINED_ELEMENT,ContainedElementMinimum))
533 = (UINT8)Element->ChassisElementMinimum;
534
535 //
536 // ContainedElementMaximum
537 //
538 *(UINT8*)((UINT8*)(StructureNode->Structure) +
539 OFFSET_OF (SMBIOS_TABLE_TYPE3, ContainedElements) +
540 Index * sizeof(CONTAINED_ELEMENT) +
541 OFFSET_OF(CONTAINED_ELEMENT,ContainedElementMaximum))
542 = (UINT8)Element->ChassisElementMaximum;
543 }
544 }
545
546 //
547 // Move the filling of following four String fields after Contained Elements
548 // because they would break SMBIOS table.
549 // Chassis Manufacturer
550 //
551 SmbiosFldString (
552 StructureNode,
553 OFFSET_OF (SMBIOS_TABLE_TYPE3, Manufacturer),
554 &(Ec->ChassisManufacturer),
555 2 // 64 * sizeof(CHAR16)
556 );
557
558 //
559 // Chassis Version
560 //
561 SmbiosFldString (
562 StructureNode,
563 OFFSET_OF (SMBIOS_TABLE_TYPE3, Version),
564 &(Ec->ChassisVersion),
565 2 // 64 * sizeof(CHAR16)
566 );
567
568 //
569 // Chassis Serial Number
570 //
571 SmbiosFldString (
572 StructureNode,
573 OFFSET_OF (SMBIOS_TABLE_TYPE3, SerialNumber),
574 &(Ec->ChassisSerialNumber),
575 2 // 64 * sizeof(CHAR16)
576 );
577
578 //
579 // Chassis Asset Tag
580 //
581 SmbiosFldString (
582 StructureNode,
583 OFFSET_OF (SMBIOS_TABLE_TYPE3, AssetTag),
584 &(Ec->ChassisAssetTag),
585 2 // 64 * sizeof(CHAR16)
586 );
587
588 return Status;
589 }
590
591 /**
592 Field Filling Function for Misc SubClass record type 8 -- Port Connector.
593
594 @param StructureNode Pointer to SMBIOS_STRUCTURE_NODE which is current processed.
595 @param Offset Offset of SMBIOS record which RecordData will be filled.
596 @param RecordData RecordData buffer will be filled.
597 @param RecordDataSize The size of RecordData buffer.
598
599 @retval EFI_SUCCESS Success fill RecordData into SMBIOS's record buffer.
600 **/
601 EFI_STATUS
602 SmbiosFldMiscType8 (
603 IN OUT SMBIOS_STRUCTURE_NODE *StructureNode,
604 IN UINT32 Offset,
605 IN VOID *RecordData,
606 IN UINT32 RecordDataSize
607 )
608 {
609 EFI_STATUS Status;
610 EFI_MISC_PORT_INTERNAL_CONNECTOR_DESIGNATOR_DATA *Picd;
611
612 Status = EFI_SUCCESS;
613 Picd = (EFI_MISC_PORT_INTERNAL_CONNECTOR_DESIGNATOR_DATA *) RecordData;
614
615 //
616 // Internal Connector Designator
617 //
618 SmbiosFldString (
619 StructureNode,
620 OFFSET_OF (SMBIOS_TABLE_TYPE8, InternalReferenceDesignator),
621 &(Picd->PortInternalConnectorDesignator),
622 2 // 64 * sizeof(CHAR16)
623 );
624
625 //
626 // Internal Connector Type
627 //
628 *(UINT8 *) ((UINT8 *) (StructureNode->Structure) + OFFSET_OF (SMBIOS_TABLE_TYPE8, InternalConnectorType)) = (UINT8) Picd->PortInternalConnectorType;
629
630 //
631 // External Connector Designator
632 //
633 SmbiosFldString (
634 StructureNode,
635 OFFSET_OF (SMBIOS_TABLE_TYPE8, ExternalReferenceDesignator),
636 &(Picd->PortExternalConnectorDesignator),
637 2 // 64 * sizeof(CHAR16)
638 );
639
640 //
641 // Internal Connector Type
642 //
643 *(UINT8 *) ((UINT8 *) (StructureNode->Structure) + OFFSET_OF (SMBIOS_TABLE_TYPE8, ExternalConnectorType)) = (UINT8) Picd->PortExternalConnectorType;
644
645 //
646 // Internal Connector Type
647 //
648 *(UINT8 *) ((UINT8 *) (StructureNode->Structure) + OFFSET_OF (SMBIOS_TABLE_TYPE8, PortType)) = (UINT8) Picd->PortType;
649
650 return Status;
651 }
652
653 /**
654 Field Filling Function for Misc SubClass record type 9 -- System slot.
655
656 @param StructureNode Pointer to SMBIOS_STRUCTURE_NODE which is current processed.
657 @param Offset Offset of SMBIOS record which RecordData will be filled.
658 @param RecordData RecordData buffer will be filled.
659 @param RecordDataSize The size of RecordData buffer.
660
661 @retval EFI_SUCCESS Success fill RecordData into SMBIOS's record buffer.
662 **/
663 EFI_STATUS
664 SmbiosFldMiscType9 (
665 IN OUT SMBIOS_STRUCTURE_NODE *StructureNode,
666 IN UINT32 Offset,
667 IN VOID *RecordData,
668 IN UINT32 RecordDataSize
669 )
670 {
671 EFI_STATUS Status;
672 EFI_MISC_SYSTEM_SLOT_DESIGNATION_DATA *Slot;
673
674 Status = EFI_SUCCESS;
675 Slot = (EFI_MISC_SYSTEM_SLOT_DESIGNATION_DATA *) RecordData;
676
677 //
678 // Slot Designation
679 //
680 SmbiosFldString (
681 StructureNode,
682 OFFSET_OF (SMBIOS_TABLE_TYPE9, SlotDesignation),
683 &(Slot->SlotDesignation),
684 2 // 64 * sizeof(CHAR16)
685 );
686
687 //
688 // Slot Type
689 //
690 CopyMem (
691 (UINT8 *) (StructureNode->Structure) + OFFSET_OF (SMBIOS_TABLE_TYPE9, SlotType),
692 &Slot->SlotType,
693 1
694 );
695
696 //
697 // Slot Data Bus Width
698 //
699 CopyMem (
700 (UINT8 *) (StructureNode->Structure) + OFFSET_OF (SMBIOS_TABLE_TYPE9, SlotDataBusWidth),
701 &Slot->SlotDataBusWidth,
702 1
703 );
704
705 //
706 // Slot Usage
707 //
708 CopyMem (
709 (UINT8 *) (StructureNode->Structure) + OFFSET_OF (SMBIOS_TABLE_TYPE9, CurrentUsage),
710 &Slot->SlotUsage,
711 1
712 );
713
714 //
715 // Slot Length
716 //
717 CopyMem (
718 (UINT8 *) (StructureNode->Structure) + OFFSET_OF (SMBIOS_TABLE_TYPE9, SlotLength),
719 &Slot->SlotLength,
720 1
721 );
722
723 //
724 // Slot Id
725 //
726 CopyMem (
727 (UINT8 *) (StructureNode->Structure) + OFFSET_OF (SMBIOS_TABLE_TYPE9, SlotID),
728 &Slot->SlotId,
729 2
730 );
731
732 //
733 // Slot Characteristics
734 //
735 CopyMem (
736 (UINT8 *) (StructureNode->Structure) + OFFSET_OF (SMBIOS_TABLE_TYPE9, SlotCharacteristics1),
737 &Slot->SlotCharacteristics,
738 2
739 );
740
741 return Status;
742 }
743
744 /**
745 Field Filling Function for Misc SubClass record type 10 - Onboard Device.
746
747 @param StructureNode Pointer to SMBIOS_STRUCTURE_NODE which is current processed.
748 @param Offset Offset of SMBIOS record which RecordData will be filled.
749 @param RecordData RecordData buffer will be filled.
750 @param RecordDataSize The size of RecordData buffer.
751
752 @retval EFI_SUCCESS Success fill RecordData into SMBIOS's record buffer.
753 **/
754 EFI_STATUS
755 SmbiosFldMiscType10 (
756 IN OUT SMBIOS_STRUCTURE_NODE *StructureNode,
757 IN UINT32 Offset,
758 IN VOID *RecordData,
759 IN UINT32 RecordDataSize
760 )
761 {
762 EFI_STATUS Status;
763 EFI_MISC_ONBOARD_DEVICE_DATA *OnboardDevice;
764 UINTN NumberOfDevices;
765 UINTN Index;
766 UINT8 StatusAndType;
767
768 Status = EFI_SUCCESS;
769 OnboardDevice = (EFI_MISC_ONBOARD_DEVICE_DATA *) RecordData;
770
771 NumberOfDevices = (StructureNode->Structure->Length - 4) / 2;
772 for (Index = 0; Index < NumberOfDevices; Index += 1) {
773 //
774 // OnBoard Device Description
775 //
776 SmbiosFldString (
777 StructureNode,
778 (UINT32) (OFFSET_OF (SMBIOS_TABLE_TYPE10, Device) + 1 + (2 * Index)),
779 &(OnboardDevice->OnBoardDeviceDescription),
780 2 // 64 * sizeof(CHAR16)
781 );
782
783 //
784 // Status & Type: Bit 7 Devicen Status, Bits 6:0 Type of Device
785 //
786 StatusAndType = (UINT8) OnboardDevice->OnBoardDeviceStatus.DeviceType;
787 if (OnboardDevice->OnBoardDeviceStatus.DeviceEnabled != 0) {
788 StatusAndType |= 0x80;
789 } else {
790 StatusAndType &= 0x7F;
791 }
792
793 * (UINT8 *) ((UINT8 *) (StructureNode->Structure) + (OFFSET_OF (SMBIOS_TABLE_TYPE10, Device) + (2 * Index))) = StatusAndType;
794 }
795
796 return Status;
797 }
798
799 /**
800 Field Filling Function for Misc SubClass record type 11 - OEM Strings.
801
802 @param StructureNode Pointer to SMBIOS_STRUCTURE_NODE which is current processed.
803 @param Offset Offset of SMBIOS record which RecordData will be filled.
804 @param RecordData RecordData buffer will be filled.
805 @param RecordDataSize The size of RecordData buffer.
806
807 @retval EFI_SUCCESS Success fill RecordData into SMBIOS's record buffer.
808 **/
809 EFI_STATUS
810 SmbiosFldMiscType11 (
811 IN OUT SMBIOS_STRUCTURE_NODE *StructureNode,
812 IN UINT32 Offset,
813 IN VOID *RecordData,
814 IN UINT32 RecordDataSize
815 )
816 {
817 EFI_MISC_OEM_STRING_DATA *OemString;
818
819 OemString = (EFI_MISC_OEM_STRING_DATA *)RecordData;
820 //
821 // OEM String data
822 //
823 SmbiosFldString (
824 StructureNode,
825 OFFSET_OF (SMBIOS_TABLE_TYPE11, StringCount),
826 &(OemString->OemStringRef[0]),
827 2
828 );
829 return EFI_SUCCESS;
830 }
831
832 /**
833 Field Filling Function for Misc SubClass record type 12 - System Options.
834
835 @param StructureNode Pointer to SMBIOS_STRUCTURE_NODE which is current processed.
836 @param Offset Offset of SMBIOS record which RecordData will be filled.
837 @param RecordData RecordData buffer will be filled.
838 @param RecordDataSize The size of RecordData buffer.
839
840 @retval EFI_SUCCESS Success fill RecordData into SMBIOS's record buffer.
841 **/
842 EFI_STATUS
843 SmbiosFldMiscType12 (
844 IN OUT SMBIOS_STRUCTURE_NODE *StructureNode,
845 IN UINT32 Offset,
846 IN VOID *RecordData,
847 IN UINT32 RecordDataSize
848 )
849 {
850 EFI_STATUS Status;
851 EFI_MISC_SYSTEM_OPTION_STRING_DATA *Sos;
852 UINTN NumberOfInstallableLanguages;
853 UINTN Index;
854
855 Status = EFI_SUCCESS;
856 Sos = (EFI_MISC_SYSTEM_OPTION_STRING_DATA *) RecordData;
857
858 //
859 // As MiscDataHub spec defines,
860 // NumberOfInstallableLanguages should retrieve from Type 13.
861 //
862 NumberOfInstallableLanguages = (StructureNode->Structure->Length - 4);
863 for (Index = 0; Index < NumberOfInstallableLanguages; Index += 1) {
864 //
865 // OnBoard Device Description
866 //
867 SmbiosFldString (
868 StructureNode,
869 (UINT32) (OFFSET_OF (SMBIOS_TABLE_TYPE12, StringCount) + (Index)),
870 &(Sos->SystemOptionStringRef[Index]),
871 2
872 );
873 }
874
875 return Status;
876 }
877
878 /**
879 Field Filling Function for Misc SubClass record type 13 - BIOS Language.
880
881 @param StructureNode Pointer to SMBIOS_STRUCTURE_NODE which is current processed.
882 @param Offset Offset of SMBIOS record which RecordData will be filled.
883 @param RecordData RecordData buffer will be filled.
884 @param RecordDataSize The size of RecordData buffer.
885
886 @retval EFI_SUCCESS Success fill RecordData into SMBIOS's record buffer.
887 **/
888 EFI_STATUS
889 SmbiosFldMiscType13 (
890 IN OUT SMBIOS_STRUCTURE_NODE *StructureNode,
891 IN UINT32 Offset,
892 IN VOID *RecordData,
893 IN UINT32 RecordDataSize
894 )
895 {
896 EFI_MISC_NUMBER_OF_INSTALLABLE_LANGUAGES_DATA *InstallableLanguage;
897
898 InstallableLanguage = (EFI_MISC_NUMBER_OF_INSTALLABLE_LANGUAGES_DATA *) RecordData;
899
900 //
901 // Number Of Installable Languages
902 //
903 *(UINT8 *) ((UINT8 *) (StructureNode->Structure) + OFFSET_OF (SMBIOS_TABLE_TYPE13, InstallableLanguages)) = (UINT8) (InstallableLanguage->NumberOfInstallableLanguages);
904
905 //
906 // Language Flags
907 //
908 CopyMem (
909 (UINT8 *) (StructureNode->Structure) + OFFSET_OF (SMBIOS_TABLE_TYPE13, Flags),
910 &InstallableLanguage->LanguageFlags,
911 1
912 );
913
914 //
915 // Current Language Number
916 //
917 SmbiosFldString (
918 StructureNode,
919 OFFSET_OF (SMBIOS_TABLE_TYPE13, CurrentLanguages),
920 &(InstallableLanguage->CurrentLanguageNumber),
921 2 // 64 * sizeof(CHAR16)
922 );
923
924 return EFI_SUCCESS;
925 }
926
927 /**
928 Field Filling Function for Misc SubClass record type 14 - System Language String
929 Current solution assumes that EFI_MISC_SYSTEM_LANGUAGE_STRINGs are logged with
930 their LanguageId having ascending orders.
931
932 @param StructureNode Pointer to SMBIOS_STRUCTURE_NODE which is current processed.
933 @param Offset Offset of SMBIOS record which RecordData will be filled.
934 @param RecordData RecordData buffer will be filled.
935 @param RecordDataSize The size of RecordData buffer.
936
937 @retval EFI_SUCCESS Success fill RecordData into SMBIOS's record buffer.
938 **/
939 EFI_STATUS
940 SmbiosFldMiscType14 (
941 IN OUT SMBIOS_STRUCTURE_NODE *StructureNode,
942 IN UINT32 Offset,
943 IN VOID *RecordData,
944 IN UINT32 RecordDataSize
945 )
946 {
947 UINT16 CurrentLanguageNumber;
948 EFI_MISC_SYSTEM_LANGUAGE_STRING *LanguageString;
949
950 LanguageString = (EFI_MISC_SYSTEM_LANGUAGE_STRING *) RecordData;
951
952 //
953 // Backup CurrentLanguage
954 //
955 CopyMem (
956 &CurrentLanguageNumber,
957 (UINT8 *) (StructureNode->Structure) + OFFSET_OF (SMBIOS_TABLE_TYPE13, CurrentLanguages),
958 1
959 );
960
961 //
962 // Clear the field so that SmbiosFldString can be reused
963 //
964 *(UINT8 *)((UINT8 *) (StructureNode->Structure) + OFFSET_OF (SMBIOS_TABLE_TYPE13, CurrentLanguages)) = 0;
965
966 SmbiosFldString (
967 StructureNode,
968 OFFSET_OF (SMBIOS_TABLE_TYPE13, CurrentLanguages),
969 &(LanguageString->SystemLanguageString),
970 2 // 64 * sizeof(CHAR16)
971 );
972
973 //
974 // Restore CurrentLanguage
975 //
976 CopyMem (
977 (UINT8 *) (StructureNode->Structure) + OFFSET_OF (SMBIOS_TABLE_TYPE13, CurrentLanguages),
978 &CurrentLanguageNumber,
979 1
980 );
981
982 return EFI_SUCCESS;
983 }
984
985 /**
986 Field Filling Function for Misc SubClass record type 15 -- System Event Log.
987
988 @param StructureNode Pointer to SMBIOS_STRUCTURE_NODE which is current processed.
989 @param Offset Offset of SMBIOS record which RecordData will be filled.
990 @param RecordData RecordData buffer will be filled.
991 @param RecordDataSize The size of RecordData buffer.
992
993 @retval EFI_SUCCESS Success fill RecordData into SMBIOS's record buffer.
994 **/
995 EFI_STATUS
996 SmbiosFldMiscType15 (
997 IN OUT SMBIOS_STRUCTURE_NODE *StructureNode,
998 IN UINT32 Offset,
999 IN VOID *RecordData,
1000 IN UINT32 RecordDataSize
1001 )
1002 {
1003 EFI_STATUS Status;
1004 EFI_MISC_SYSTEM_EVENT_LOG_DATA *SystemEventLog;
1005
1006 Status = EFI_SUCCESS;
1007 SystemEventLog = NULL;
1008
1009 SystemEventLog = (EFI_MISC_SYSTEM_EVENT_LOG_DATA *) RecordData;
1010
1011 //
1012 // Log Area Length
1013 //
1014 CopyMem (
1015 (UINT8 *) (StructureNode->Structure) + OFFSET_OF (SMBIOS_TABLE_TYPE15, LogAreaLength),
1016 &(SystemEventLog->LogAreaLength),
1017 2
1018 );
1019
1020 //
1021 // Log Header Start Offset
1022 //
1023 CopyMem (
1024 (UINT8 *) (StructureNode->Structure) + OFFSET_OF (SMBIOS_TABLE_TYPE15, LogHeaderStartOffset),
1025 &(SystemEventLog->LogHeaderStartOffset),
1026 2
1027 );
1028
1029 //
1030 // Log Data Start Offset
1031 //
1032 CopyMem (
1033 (UINT8 *) (StructureNode->Structure) + OFFSET_OF (SMBIOS_TABLE_TYPE15, LogDataStartOffset),
1034 &(SystemEventLog->LogDataStartOffset),
1035 2
1036 );
1037
1038 //
1039 // Access Method
1040 //
1041 CopyMem (
1042 (UINT8 *) (StructureNode->Structure) + OFFSET_OF (SMBIOS_TABLE_TYPE15, AccessMethod),
1043 &(SystemEventLog->AccessMethod),
1044 1
1045 );
1046
1047 //
1048 // Log Status
1049 //
1050 CopyMem (
1051 (UINT8 *) (StructureNode->Structure) + OFFSET_OF (SMBIOS_TABLE_TYPE15, LogStatus),
1052 &(SystemEventLog->LogStatus),
1053 1
1054 );
1055
1056 //
1057 // Log Change Token
1058 //
1059 CopyMem (
1060 (UINT8 *) (StructureNode->Structure) + OFFSET_OF (SMBIOS_TABLE_TYPE15, LogChangeToken),
1061 &(SystemEventLog->LogChangeToken),
1062 4
1063 );
1064
1065 //
1066 // Access Method Address
1067 //
1068 CopyMem (
1069 (UINT8 *) (StructureNode->Structure) + OFFSET_OF (SMBIOS_TABLE_TYPE15, AccessMethodAddress),
1070 &(SystemEventLog->AccessMethodAddress),
1071 4
1072 );
1073
1074 //
1075 // Log Header Format
1076 //
1077 CopyMem (
1078 (UINT8 *) (StructureNode->Structure) + OFFSET_OF (SMBIOS_TABLE_TYPE15, LogHeaderFormat),
1079 &(SystemEventLog->LogHeaderFormat),
1080 1
1081 );
1082
1083 //
1084 // Number of Supported Log Type Descriptors
1085 //
1086 CopyMem (
1087 (UINT8 *) (StructureNode->Structure) + OFFSET_OF (SMBIOS_TABLE_TYPE15, NumberOfSupportedLogTypeDescriptors),
1088 &(SystemEventLog->NumberOfSupportedLogType),
1089 1
1090 );
1091
1092 //
1093 // Length of each Log Type Descriptor
1094 //
1095 CopyMem (
1096 (UINT8 *) (StructureNode->Structure) + OFFSET_OF (SMBIOS_TABLE_TYPE15, LengthOfLogTypeDescriptor),
1097 &(SystemEventLog->LengthOfLogDescriptor),
1098 1
1099 );
1100
1101 return Status;
1102 }
1103
1104 /**
1105 Field Filling Function for Misc SubClass record type 21 - Pointing Device.
1106
1107 @param StructureNode Pointer to SMBIOS_STRUCTURE_NODE which is current processed.
1108 @param Offset Offset of SMBIOS record which RecordData will be filled.
1109 @param RecordData RecordData buffer will be filled.
1110 @param RecordDataSize The size of RecordData buffer.
1111
1112 @retval EFI_SUCCESS Success fill RecordData into SMBIOS's record buffer.
1113 **/
1114 EFI_STATUS
1115 SmbiosFldMiscType21 (
1116 IN OUT SMBIOS_STRUCTURE_NODE *StructureNode,
1117 IN UINT32 Offset,
1118 IN VOID *RecordData,
1119 IN UINT32 RecordDataSize
1120 )
1121 {
1122 EFI_MISC_POINTING_DEVICE_TYPE_DATA *PointingDeviceData;
1123
1124 PointingDeviceData = (EFI_MISC_POINTING_DEVICE_TYPE_DATA *) RecordData;
1125
1126 //
1127 // Pointing Device Type
1128 //
1129 *(UINT8 *) ((UINT8 *) (StructureNode->Structure) + OFFSET_OF (SMBIOS_TABLE_TYPE21, Type)) = (UINT8) (PointingDeviceData->PointingDeviceType);
1130
1131 //
1132 // Pointing Device Interface
1133 //
1134 *(UINT8 *) ((UINT8 *) (StructureNode->Structure) + OFFSET_OF (SMBIOS_TABLE_TYPE21, Interface)) = (UINT8) (PointingDeviceData->PointingDeviceInterface);
1135
1136 //
1137 // Number Pointing Device Buttons
1138 //
1139 *(UINT8 *) ((UINT8 *) (StructureNode->Structure) + OFFSET_OF (SMBIOS_TABLE_TYPE21, NumberOfButtons)) = (UINT8) (PointingDeviceData->NumberPointingDeviceButtons);
1140
1141 return EFI_SUCCESS;
1142 }
1143
1144 /**
1145 Field Filling Function for Misc SubClass record type 22 - Portable Battery.
1146
1147 @param StructureNode Pointer to SMBIOS_STRUCTURE_NODE which is current processed.
1148 @param Offset Offset of SMBIOS record which RecordData will be filled.
1149 @param RecordData RecordData buffer will be filled.
1150 @param RecordDataSize The size of RecordData buffer.
1151
1152 @retval EFI_SUCCESS Success fill RecordData into SMBIOS's record buffer.
1153 **/
1154 EFI_STATUS
1155 SmbiosFldMiscType22 (
1156 IN OUT SMBIOS_STRUCTURE_NODE *StructureNode,
1157 IN UINT32 Offset,
1158 IN VOID *RecordData,
1159 IN UINT32 RecordDataSize
1160 )
1161 {
1162 EFI_MISC_PORTABLE_BATTERY *PortableBattery;
1163 STRING_REF Chemistry;
1164 PortableBattery = (EFI_MISC_PORTABLE_BATTERY *)RecordData;
1165
1166 //
1167 // Location
1168 //
1169 SmbiosFldString (
1170 StructureNode,
1171 OFFSET_OF (SMBIOS_TABLE_TYPE22, Location),
1172 &(PortableBattery->Location),
1173 2 // 64 * sizeof(CHAR16)
1174 );
1175
1176 //
1177 // Manufacturer
1178 //
1179 SmbiosFldString (
1180 StructureNode,
1181 OFFSET_OF (SMBIOS_TABLE_TYPE22, Manufacturer),
1182 &(PortableBattery->Manufacturer),
1183 2
1184 );
1185
1186 //
1187 // ManufactureDate
1188 //
1189 SmbiosFldString (
1190 StructureNode,
1191 OFFSET_OF (SMBIOS_TABLE_TYPE22, ManufactureDate),
1192 &(PortableBattery->ManufactureDate),
1193 2
1194 );
1195
1196 //
1197 // SerialNumber
1198 //
1199 SmbiosFldString (
1200 StructureNode,
1201 OFFSET_OF (SMBIOS_TABLE_TYPE22, SerialNumber),
1202 &(PortableBattery->SerialNumber),
1203 2
1204 );
1205
1206 //
1207 // DeviceName
1208 //
1209 SmbiosFldString (
1210 StructureNode,
1211 OFFSET_OF (SMBIOS_TABLE_TYPE22, DeviceName),
1212 &(PortableBattery->DeviceName),
1213 2
1214 );
1215
1216 //
1217 // DeviceChemistry
1218 //
1219 CopyMem (
1220 (UINT8 *) (StructureNode->Structure) + OFFSET_OF (SMBIOS_TABLE_TYPE22, DeviceChemistry),
1221 &PortableBattery->DeviceChemistry,
1222 1
1223 );
1224
1225 //
1226 // DesignCapacity
1227 //
1228 CopyMem (
1229 (UINT8 *) (StructureNode->Structure) + OFFSET_OF (SMBIOS_TABLE_TYPE22, DeviceCapacity),
1230 &PortableBattery->DesignCapacity,
1231 2
1232 );
1233
1234 //
1235 // DesignVoltage
1236 //
1237 CopyMem (
1238 (UINT8 *) (StructureNode->Structure) + OFFSET_OF (SMBIOS_TABLE_TYPE22, DesignVoltage),
1239 &PortableBattery->DesignVoltage,
1240 2
1241 );
1242
1243 //
1244 // SBDSVersionNumber
1245 //
1246 SmbiosFldString (
1247 StructureNode,
1248 OFFSET_OF (SMBIOS_TABLE_TYPE22, SBDSVersionNumber),
1249 &(PortableBattery->SBDSVersionNumber),
1250 2 // 64 * sizeof(CHAR16)
1251 );
1252
1253 //
1254 // MaximumError
1255 //
1256 CopyMem (
1257 (UINT8 *) (StructureNode->Structure) + OFFSET_OF (SMBIOS_TABLE_TYPE22, MaximumErrorInBatteryData),
1258 &PortableBattery->MaximumError,
1259 1
1260 );
1261
1262 //
1263 // SBDSSerialNumber
1264 //
1265 CopyMem (
1266 (UINT8 *) (StructureNode->Structure) + OFFSET_OF (SMBIOS_TABLE_TYPE22, SBDSSerialNumber),
1267 &PortableBattery->SBDSSerialNumber,
1268 2
1269 );
1270
1271 //
1272 // SBDSManufactureDate
1273 //
1274 CopyMem (
1275 (UINT8 *) (StructureNode->Structure) + OFFSET_OF (SMBIOS_TABLE_TYPE22, SBDSManufactureDate),
1276 &PortableBattery->SBDSManufactureDate,
1277 2
1278 );
1279
1280 //
1281 // Avoid alignment issue on IPF
1282 //
1283 CopyMem (
1284 &Chemistry,
1285 &PortableBattery->SBDSDeviceChemistry,
1286 2
1287 );
1288
1289 //
1290 // SBDSDeviceChemistry
1291 //
1292 SmbiosFldString (
1293 StructureNode,
1294 OFFSET_OF (SMBIOS_TABLE_TYPE22, SBDSDeviceChemistry),
1295 &Chemistry,
1296 2 // 64 * sizeof(CHAR16)
1297 );
1298
1299 //
1300 // DesignCapacityMultiplier
1301 //
1302 CopyMem (
1303 (UINT8 *) (StructureNode->Structure) + OFFSET_OF (SMBIOS_TABLE_TYPE22, DesignCapacityMultiplier),
1304 &PortableBattery->DesignCapacityMultiplier,
1305 1
1306 );
1307
1308 //
1309 // OEMSpecific
1310 //
1311 CopyMem (
1312 (UINT8 *) (StructureNode->Structure) + OFFSET_OF (SMBIOS_TABLE_TYPE22, OEMSpecific),
1313 &PortableBattery->OEMSpecific,
1314 4
1315 );
1316
1317 return EFI_SUCCESS;
1318 }
1319
1320 /**
1321 Field Filling Function for Misc SubClass record type 23 - System Reset.
1322
1323 @param StructureNode Pointer to SMBIOS_STRUCTURE_NODE which is current processed.
1324 @param Offset Offset of SMBIOS record which RecordData will be filled.
1325 @param RecordData RecordData buffer will be filled.
1326 @param RecordDataSize The size of RecordData buffer.
1327
1328 @retval EFI_SUCCESS Success fill RecordData into SMBIOS's record buffer.
1329 **/
1330 EFI_STATUS
1331 SmbiosFldMiscType23 (
1332 IN OUT SMBIOS_STRUCTURE_NODE *StructureNode,
1333 IN UINT32 Offset,
1334 IN VOID *RecordData,
1335 IN UINT32 RecordDataSize
1336 )
1337 {
1338 EFI_MISC_RESET_CAPABILITIES_DATA *SystemResetData;
1339
1340 SystemResetData = (EFI_MISC_RESET_CAPABILITIES_DATA *) RecordData;
1341
1342 //
1343 // Reset Capabilities
1344 //
1345 CopyMem (
1346 (UINT8 *) (StructureNode->Structure) + OFFSET_OF (SMBIOS_TABLE_TYPE23, Capabilities),
1347 &(SystemResetData->ResetCapabilities),
1348 1
1349 );
1350
1351 //
1352 // Reset Count
1353 //
1354 CopyMem (
1355 (UINT8 *) (StructureNode->Structure) + OFFSET_OF (SMBIOS_TABLE_TYPE23, ResetCount),
1356 &(SystemResetData->ResetCount),
1357 2
1358 );
1359
1360 //
1361 // Reset Limit
1362 //
1363 CopyMem (
1364 (UINT8 *) (StructureNode->Structure) + OFFSET_OF (SMBIOS_TABLE_TYPE23, ResetLimit),
1365 &(SystemResetData->ResetLimit),
1366 2
1367 );
1368
1369 //
1370 // Reset Timer Interval
1371 //
1372 CopyMem (
1373 (UINT8 *) (StructureNode->Structure) + OFFSET_OF (SMBIOS_TABLE_TYPE23, TimerInterval),
1374 &(SystemResetData->ResetTimerInterval),
1375 2
1376 );
1377
1378 //
1379 // Reset Timeout
1380 //
1381 CopyMem (
1382 (UINT8 *) (StructureNode->Structure) + OFFSET_OF (SMBIOS_TABLE_TYPE23, Timeout),
1383 &(SystemResetData->ResetTimeout),
1384 2
1385 );
1386
1387 return EFI_SUCCESS;
1388 }
1389
1390 /**
1391 Field Filling Function for Misc SubClass record type 24 - Hardware Security.
1392
1393 @param StructureNode Pointer to SMBIOS_STRUCTURE_NODE which is current processed.
1394 @param Offset Offset of SMBIOS record which RecordData will be filled.
1395 @param RecordData RecordData buffer will be filled.
1396 @param RecordDataSize The size of RecordData buffer.
1397
1398 @retval EFI_SUCCESS Success fill RecordData into SMBIOS's record buffer.
1399 **/
1400 EFI_STATUS
1401 SmbiosFldMiscType24 (
1402 IN OUT SMBIOS_STRUCTURE_NODE *StructureNode,
1403 IN UINT32 Offset,
1404 IN VOID *RecordData,
1405 IN UINT32 RecordDataSize
1406 )
1407 {
1408 EFI_MISC_HARDWARE_SECURITY_SETTINGS_DATA *HardwareSecurity;
1409
1410 HardwareSecurity = (EFI_MISC_HARDWARE_SECURITY_SETTINGS_DATA *)RecordData;
1411
1412 //
1413 // Hardware Security Settings
1414 //
1415 CopyMem (
1416 (UINT8 *) (StructureNode->Structure) + OFFSET_OF (SMBIOS_TABLE_TYPE24, HardwareSecuritySettings),
1417 &HardwareSecurity->HardwareSecuritySettings,
1418 1
1419 );
1420
1421 return EFI_SUCCESS;
1422 }
1423
1424 /**
1425 Field Filling Function for Misc SubClass record type 25 - System Power Controls.
1426
1427 @param StructureNode Pointer to SMBIOS_STRUCTURE_NODE which is current processed.
1428 @param Offset Offset of SMBIOS record which RecordData will be filled.
1429 @param RecordData RecordData buffer will be filled.
1430 @param RecordDataSize The size of RecordData buffer.
1431
1432 @retval EFI_SUCCESS Success fill RecordData into SMBIOS's record buffer.
1433 **/
1434 EFI_STATUS
1435 SmbiosFldMiscType25 (
1436 IN OUT SMBIOS_STRUCTURE_NODE *StructureNode,
1437 IN UINT32 Offset,
1438 IN VOID *RecordData,
1439 IN UINT32 RecordDataSize
1440 )
1441 {
1442 EFI_MISC_SCHEDULED_POWER_ON_MONTH *PowerOnMonth;
1443
1444 PowerOnMonth = (EFI_MISC_SCHEDULED_POWER_ON_MONTH *)RecordData;
1445
1446 //
1447 // ScheduledPoweronMonth
1448 //
1449 CopyMem (
1450 (UINT8 *) (StructureNode->Structure) + OFFSET_OF (SMBIOS_TABLE_TYPE25, NextScheduledPowerOnMonth),
1451 &PowerOnMonth->ScheduledPoweronMonth,
1452 1
1453 );
1454
1455 //
1456 // ScheduledPoweronDayOfMonth
1457 //
1458 CopyMem (
1459 (UINT8 *) (StructureNode->Structure) + OFFSET_OF (SMBIOS_TABLE_TYPE25, NextScheduledPowerOnDayOfMonth),
1460 &PowerOnMonth->ScheduledPoweronDayOfMonth,
1461 1
1462 );
1463
1464 //
1465 // ScheduledPoweronHour
1466 //
1467 CopyMem (
1468 (UINT8 *) (StructureNode->Structure) + OFFSET_OF (SMBIOS_TABLE_TYPE25, NextScheduledPowerOnHour),
1469 &PowerOnMonth->ScheduledPoweronHour,
1470 1
1471 );
1472
1473 //
1474 // ScheduledPoweronMinute
1475 //
1476 CopyMem (
1477 (UINT8 *) (StructureNode->Structure) + OFFSET_OF (SMBIOS_TABLE_TYPE25, NextScheduledPowerOnMinute),
1478 &PowerOnMonth->ScheduledPoweronMinute,
1479 1
1480 );
1481
1482 //
1483 // ScheduledPoweronSecond
1484 //
1485 CopyMem (
1486 (UINT8 *) (StructureNode->Structure) + OFFSET_OF (SMBIOS_TABLE_TYPE25, NextScheduledPowerOnSecond),
1487 &PowerOnMonth->ScheduledPoweronSecond,
1488 1
1489 );
1490
1491 return EFI_SUCCESS;
1492 }
1493
1494 /**
1495 Field Filling Function for Misc SubClass record type 26 - Voltage Probe.
1496
1497 @param StructureNode Pointer to SMBIOS_STRUCTURE_NODE which is current processed.
1498 @param Offset Offset of SMBIOS record which RecordData will be filled.
1499 @param RecordData RecordData buffer will be filled.
1500 @param RecordDataSize The size of RecordData buffer.
1501
1502 @retval EFI_SUCCESS Success fill RecordData into SMBIOS's record buffer.
1503 **/
1504 EFI_STATUS
1505 SmbiosFldMiscType26 (
1506 IN OUT SMBIOS_STRUCTURE_NODE *StructureNode,
1507 IN UINT32 Offset,
1508 IN VOID *RecordData,
1509 IN UINT32 RecordDataSize
1510 )
1511 {
1512 EFI_MISC_VOLTAGE_PROBE_DESCRIPTION *VoltageProbe;
1513
1514 VoltageProbe = (EFI_MISC_VOLTAGE_PROBE_DESCRIPTION *)RecordData;
1515
1516 //
1517 // VoltageProbe Description
1518 //
1519 SmbiosFldString (
1520 StructureNode,
1521 OFFSET_OF (SMBIOS_TABLE_TYPE26, Description),
1522 &(VoltageProbe->VoltageProbeDescription),
1523 2 // 64 * sizeof(CHAR16)
1524 );
1525
1526 //
1527 // VoltageProbeLocation
1528 //
1529 CopyMem (
1530 (UINT8 *) (StructureNode->Structure) + OFFSET_OF (SMBIOS_TABLE_TYPE26, LocationAndStatus),
1531 &VoltageProbe->VoltageProbeLocation,
1532 1
1533 );
1534
1535 //
1536 // VoltageProbeMaximumValue
1537 //
1538 CopyMem (
1539 (UINT8 *) (StructureNode->Structure) + OFFSET_OF (SMBIOS_TABLE_TYPE26, MaximumValue),
1540 &VoltageProbe->VoltageProbeMaximumValue,
1541 2
1542 );
1543
1544 //
1545 // VoltageProbeMinimumValue
1546 //
1547 CopyMem (
1548 (UINT8 *) (StructureNode->Structure) + OFFSET_OF (SMBIOS_TABLE_TYPE26, MinimumValue),
1549 &VoltageProbe->VoltageProbeMinimumValue,
1550 2
1551 );
1552
1553 //
1554 // VoltageProbeResolution
1555 //
1556 CopyMem (
1557 (UINT8 *) (StructureNode->Structure) + OFFSET_OF (SMBIOS_TABLE_TYPE26, Resolution),
1558 &VoltageProbe->VoltageProbeResolution,
1559 2
1560 );
1561
1562 //
1563 // VoltageProbeTolerance
1564 //
1565 CopyMem (
1566 (UINT8 *) (StructureNode->Structure) + OFFSET_OF (SMBIOS_TABLE_TYPE26, Tolerance),
1567 &VoltageProbe->VoltageProbeTolerance,
1568 2
1569 );
1570
1571 //
1572 // VoltageProbeAccuracy
1573 //
1574 CopyMem (
1575 (UINT8 *) (StructureNode->Structure) + OFFSET_OF (SMBIOS_TABLE_TYPE26, Accuracy),
1576 &VoltageProbe->VoltageProbeAccuracy,
1577 2
1578 );
1579
1580 //
1581 // VoltageProbeNominalValue
1582 //
1583 CopyMem (
1584 (UINT8 *) (StructureNode->Structure) + OFFSET_OF (SMBIOS_TABLE_TYPE26, NominalValue),
1585 &VoltageProbe->VoltageProbeNominalValue,
1586 2
1587 );
1588
1589 //
1590 // VoltageProbeOemDefined
1591 //
1592 CopyMem (
1593 (UINT8 *) (StructureNode->Structure) + OFFSET_OF (SMBIOS_TABLE_TYPE26, OEMDefined),
1594 &VoltageProbe->VoltageProbeOemDefined,
1595 4
1596 );
1597
1598 return EFI_SUCCESS;
1599 }
1600
1601 /**
1602 Field Filling Function for Misc SubClass record type 27 - Cooling Device.
1603
1604 @param StructureNode Pointer to SMBIOS_STRUCTURE_NODE which is current processed.
1605 @param Offset Offset of SMBIOS record which RecordData will be filled.
1606 @param RecordData RecordData buffer will be filled.
1607 @param RecordDataSize The size of RecordData buffer.
1608
1609 @retval EFI_SUCCESS Success fill RecordData into SMBIOS's record buffer.
1610 **/
1611 EFI_STATUS
1612 SmbiosFldMiscType27 (
1613 IN OUT SMBIOS_STRUCTURE_NODE *StructureNode,
1614 IN UINT32 Offset,
1615 IN VOID *RecordData,
1616 IN UINT32 RecordDataSize
1617 )
1618 {
1619 EFI_MISC_COOLING_DEVICE_TEMP_LINK *CoolingDevice;
1620
1621 CoolingDevice = (EFI_MISC_COOLING_DEVICE_TEMP_LINK *)RecordData;
1622
1623 //
1624 // Device Type
1625 //
1626 CopyMem (
1627 (UINT8 *) (StructureNode->Structure) + OFFSET_OF (SMBIOS_TABLE_TYPE27, DeviceTypeAndStatus),
1628 &CoolingDevice->CoolingDeviceType,
1629 1
1630 );
1631
1632 //
1633 // Temperature Probe
1634 //
1635 SmbiosFldInterLink (
1636 StructureNode,
1637 (UINT16) OFFSET_OF (SMBIOS_TABLE_TYPE27, TemperatureProbeHandle),
1638 28, // SMBIOS type 28 - Temperature Probe
1639 &CoolingDevice->CoolingDeviceTemperatureLink,
1640 &gEfiMiscSubClassGuid
1641 );
1642
1643 //
1644 // CoolingDeviceUnitGroup
1645 //
1646 CopyMem (
1647 (UINT8 *) (StructureNode->Structure) + OFFSET_OF (SMBIOS_TABLE_TYPE27, CoolingUnitGroup),
1648 &CoolingDevice->CoolingDeviceUnitGroup,
1649 1
1650 );
1651
1652 //
1653 // CoolingDeviceUnitGroup
1654 //
1655 CopyMem (
1656 (UINT8 *) (StructureNode->Structure) + OFFSET_OF (SMBIOS_TABLE_TYPE27, OEMDefined),
1657 &CoolingDevice->CoolingDeviceOemDefined,
1658 4
1659 );
1660
1661 //
1662 // CoolingDeviceNominalSpeed
1663 //
1664 CopyMem (
1665 (UINT8 *) (StructureNode->Structure) + OFFSET_OF (SMBIOS_TABLE_TYPE27, NominalSpeed),
1666 &CoolingDevice->CoolingDeviceNominalSpeed,
1667 2
1668 );
1669
1670 return EFI_SUCCESS;
1671 }
1672
1673 /**
1674 Field Filling Function for Misc SubClass record type 28 -- Temperature Probe.
1675
1676 @param StructureNode Pointer to SMBIOS_STRUCTURE_NODE which is current processed.
1677 @param Offset Offset of SMBIOS record which RecordData will be filled.
1678 @param RecordData RecordData buffer will be filled.
1679 @param RecordDataSize The size of RecordData buffer.
1680
1681 @retval EFI_SUCCESS Success fill RecordData into SMBIOS's record buffer.
1682 **/
1683 EFI_STATUS
1684 SmbiosFldMiscType28 (
1685 IN OUT SMBIOS_STRUCTURE_NODE *StructureNode,
1686 IN UINT32 Offset,
1687 IN VOID *RecordData,
1688 IN UINT32 RecordDataSize
1689 )
1690 {
1691 EFI_MISC_TEMPERATURE_PROBE_DESCRIPTION *TemperatureProbe;
1692
1693 TemperatureProbe = (EFI_MISC_TEMPERATURE_PROBE_DESCRIPTION *)RecordData;
1694
1695 //
1696 // TemperatureProbeDescription
1697 //
1698 SmbiosFldString (
1699 StructureNode,
1700 OFFSET_OF (SMBIOS_TABLE_TYPE28, Description),
1701 &(TemperatureProbe->TemperatureProbeDescription),
1702 2
1703 );
1704
1705 //
1706 // TemperatureProbeLocation
1707 //
1708 CopyMem (
1709 (UINT8 *) (StructureNode->Structure) + OFFSET_OF (SMBIOS_TABLE_TYPE28, LocationAndStatus),
1710 &TemperatureProbe->TemperatureProbeLocation,
1711 1
1712 );
1713
1714 //
1715 // TemperatureProbeMaximumValue
1716 //
1717 CopyMem (
1718 (UINT8 *) (StructureNode->Structure) + OFFSET_OF (SMBIOS_TABLE_TYPE28, MaximumValue),
1719 &TemperatureProbe->TemperatureProbeMaximumValue,
1720 2
1721 );
1722
1723 //
1724 // TemperatureProbeMinimumValue
1725 //
1726 CopyMem (
1727 (UINT8 *) (StructureNode->Structure) + OFFSET_OF (SMBIOS_TABLE_TYPE28, MinimumValue),
1728 &TemperatureProbe->TemperatureProbeMinimumValue,
1729 2
1730 );
1731
1732 //
1733 // TemperatureProbeResolution
1734 //
1735 CopyMem (
1736 (UINT8 *) (StructureNode->Structure) + OFFSET_OF (SMBIOS_TABLE_TYPE28, Resolution),
1737 &TemperatureProbe->TemperatureProbeResolution,
1738 2
1739 );
1740
1741
1742 //
1743 // TemperatureProbeTolerance
1744 //
1745 CopyMem (
1746 (UINT8 *) (StructureNode->Structure) + OFFSET_OF (SMBIOS_TABLE_TYPE28, Tolerance),
1747 &TemperatureProbe->TemperatureProbeTolerance,
1748 2
1749 );
1750
1751 //
1752 // TemperatureProbeAccuracy
1753 //
1754 CopyMem (
1755 (UINT8 *) (StructureNode->Structure) + OFFSET_OF (SMBIOS_TABLE_TYPE28, Accuracy),
1756 &TemperatureProbe->TemperatureProbeAccuracy,
1757 2
1758 );
1759
1760 //
1761 // TemperatureProbeNominalValue
1762 //
1763 CopyMem (
1764 (UINT8 *) (StructureNode->Structure) + OFFSET_OF (SMBIOS_TABLE_TYPE28, NominalValue),
1765 &TemperatureProbe->TemperatureProbeNominalValue,
1766 2
1767 );
1768
1769 //
1770 // TemperatureProbeOemDefined
1771 //
1772 CopyMem (
1773 (UINT8 *) (StructureNode->Structure) + OFFSET_OF (SMBIOS_TABLE_TYPE28, OEMDefined),
1774 &TemperatureProbe->TemperatureProbeOemDefined,
1775 4
1776 );
1777
1778 return EFI_SUCCESS;
1779 }
1780
1781 /**
1782 Field Filling Function for Misc SubClass record type 29 -- Electrical Current Probe.
1783
1784 @param StructureNode Pointer to SMBIOS_STRUCTURE_NODE which is current processed.
1785 @param Offset Offset of SMBIOS record which RecordData will be filled.
1786 @param RecordData RecordData buffer will be filled.
1787 @param RecordDataSize The size of RecordData buffer.
1788
1789 @retval EFI_SUCCESS Success fill RecordData into SMBIOS's record buffer.
1790 **/
1791 EFI_STATUS
1792 SmbiosFldMiscType29 (
1793 IN OUT SMBIOS_STRUCTURE_NODE *StructureNode,
1794 IN UINT32 Offset,
1795 IN VOID *RecordData,
1796 IN UINT32 RecordDataSize
1797 )
1798 {
1799 EFI_MISC_ELECTRICAL_CURRENT_PROBE_DESCRIPTION *ElectricalProbe;
1800
1801 ElectricalProbe = (EFI_MISC_ELECTRICAL_CURRENT_PROBE_DESCRIPTION *)RecordData;
1802
1803 //
1804 // ElectricalCurrentProbeDescription
1805 //
1806 SmbiosFldString (
1807 StructureNode,
1808 OFFSET_OF (SMBIOS_TABLE_TYPE29, Description),
1809 &(ElectricalProbe->ElectricalCurrentProbeDescription),
1810 2 // 64 * sizeof(CHAR16)
1811 );
1812
1813 //
1814 // ElectricalCurrentProbeLocation
1815 //
1816 CopyMem (
1817 (UINT8 *) (StructureNode->Structure) + OFFSET_OF (SMBIOS_TABLE_TYPE29, LocationAndStatus),
1818 &ElectricalProbe->ElectricalCurrentProbeLocation,
1819 1
1820 );
1821
1822 //
1823 // ElectricalCurrentProbeMaximumValue
1824 //
1825 CopyMem (
1826 (UINT8 *) (StructureNode->Structure) + OFFSET_OF (SMBIOS_TABLE_TYPE29, MaximumValue),
1827 &ElectricalProbe->ElectricalCurrentProbeMaximumValue,
1828 2
1829 );
1830
1831 //
1832 // ElectricalCurrentProbeMinimumValue
1833 //
1834 CopyMem (
1835 (UINT8 *) (StructureNode->Structure) + OFFSET_OF (SMBIOS_TABLE_TYPE29, MinimumValue),
1836 &ElectricalProbe->ElectricalCurrentProbeMinimumValue,
1837 2
1838 );
1839
1840 //
1841 // ElectricalCurrentProbeResolution
1842 //
1843 CopyMem (
1844 (UINT8 *) (StructureNode->Structure) + OFFSET_OF (SMBIOS_TABLE_TYPE29, Resolution),
1845 &ElectricalProbe->ElectricalCurrentProbeResolution,
1846 2
1847 );
1848
1849 //
1850 // ElectricalCurrentProbeTolerance
1851 //
1852 CopyMem (
1853 (UINT8 *) (StructureNode->Structure) + OFFSET_OF (SMBIOS_TABLE_TYPE29, Tolerance),
1854 &ElectricalProbe->ElectricalCurrentProbeTolerance,
1855 2
1856 );
1857
1858 //
1859 // ElectricalCurrentProbeAccuracy
1860 //
1861 CopyMem (
1862 (UINT8 *) (StructureNode->Structure) + OFFSET_OF (SMBIOS_TABLE_TYPE29, Accuracy),
1863 &ElectricalProbe->ElectricalCurrentProbeAccuracy,
1864 2
1865 );
1866 //
1867 // ElectricalCurrentProbeNominalValue
1868 //
1869 CopyMem (
1870 (UINT8 *) (StructureNode->Structure) + OFFSET_OF (SMBIOS_TABLE_TYPE29, NominalValue),
1871 &ElectricalProbe->ElectricalCurrentProbeNominalValue,
1872 2
1873 );
1874
1875 //
1876 // ElectricalCurrentProbeOemDefined
1877 //
1878 CopyMem (
1879 (UINT8 *) (StructureNode->Structure) + OFFSET_OF (SMBIOS_TABLE_TYPE29, OEMDefined),
1880 &ElectricalProbe->ElectricalCurrentProbeOemDefined,
1881 4
1882 );
1883
1884 return EFI_SUCCESS;
1885 }
1886
1887 /**
1888 Field Filling Function for Misc SubClass record type 30 -- Out-of-Band Remote Access.
1889
1890 @param StructureNode Pointer to SMBIOS_STRUCTURE_NODE which is current processed.
1891 @param Offset Offset of SMBIOS record which RecordData will be filled.
1892 @param RecordData RecordData buffer will be filled.
1893 @param RecordDataSize The size of RecordData buffer.
1894
1895 @retval EFI_SUCCESS Success fill RecordData into SMBIOS's record buffer.
1896 **/
1897 EFI_STATUS
1898 SmbiosFldMiscType30 (
1899 IN OUT SMBIOS_STRUCTURE_NODE *StructureNode,
1900 IN UINT32 Offset,
1901 IN VOID *RecordData,
1902 IN UINT32 RecordDataSize
1903 )
1904 {
1905 EFI_MISC_REMOTE_ACCESS_MANUFACTURER_DESCRIPTION *RemoteData;
1906
1907 RemoteData = (EFI_MISC_REMOTE_ACCESS_MANUFACTURER_DESCRIPTION *)RecordData;
1908
1909 //
1910 // ManufacturerNameDescription
1911 //
1912 SmbiosFldString (
1913 StructureNode,
1914 OFFSET_OF (SMBIOS_TABLE_TYPE30, ManufacturerName),
1915 &(RemoteData->RemoteAccessManufacturerNameDescription),
1916 2 // 64 * sizeof(CHAR16)
1917 );
1918
1919 //
1920 // RemoteAccessConnections
1921 //
1922 CopyMem (
1923 (UINT8 *) (StructureNode->Structure) + OFFSET_OF (SMBIOS_TABLE_TYPE30, Connections),
1924 &RemoteData->RemoteAccessConnections,
1925 1
1926 );
1927
1928 return EFI_SUCCESS;
1929 }
1930
1931 /**
1932 Field Filling Function for Misc SubClass record type 32 -- System Boot Information.
1933
1934 @param StructureNode Pointer to SMBIOS_STRUCTURE_NODE which is current processed.
1935 @param Offset Offset of SMBIOS record which RecordData will be filled.
1936 @param RecordData RecordData buffer will be filled.
1937 @param RecordDataSize The size of RecordData buffer.
1938
1939 @retval EFI_SUCCESS Success fill RecordData into SMBIOS's record buffer.
1940 **/
1941 EFI_STATUS
1942 SmbiosFldMiscType32 (
1943 IN OUT SMBIOS_STRUCTURE_NODE *StructureNode,
1944 IN UINT32 Offset,
1945 IN VOID *RecordData,
1946 IN UINT32 RecordDataSize
1947 )
1948 {
1949 EFI_STATUS Status;
1950 EFI_MISC_BOOT_INFORMATION_STATUS_DATA *BootInfo;
1951
1952 Status = EFI_SUCCESS;
1953 BootInfo = (EFI_MISC_BOOT_INFORMATION_STATUS_DATA *) RecordData;
1954
1955 //
1956 // Set reserved bytes
1957 //
1958 ZeroMem ((UINT8 *) (StructureNode->Structure) + OFFSET_OF (SMBIOS_TABLE_TYPE32, Reserved), 6);
1959
1960 //
1961 // Set BootInformation Status
1962 //
1963 CopyMem (
1964 (UINT8 *) (StructureNode->Structure) + OFFSET_OF (SMBIOS_TABLE_TYPE32, BootStatus),
1965 &BootInfo->BootInformationStatus,
1966 1
1967 );
1968
1969 //
1970 // Set Additional Data
1971 //
1972 CopyMem (
1973 (UINT8 *) (StructureNode->Structure) + OFFSET_OF (SMBIOS_TABLE_TYPE32, BootStatus) + 1,
1974 &BootInfo->BootInformationData,
1975 9
1976 );
1977
1978 return Status;
1979 }
1980
1981 /**
1982 Field Filling Function for Misc SubClass record type 34 -- Management Device.
1983
1984 @param StructureNode Pointer to SMBIOS_STRUCTURE_NODE which is current processed.
1985 @param Offset Offset of SMBIOS record which RecordData will be filled.
1986 @param RecordData RecordData buffer will be filled.
1987 @param RecordDataSize The size of RecordData buffer.
1988
1989 @retval EFI_SUCCESS Success fill RecordData into SMBIOS's record buffer.
1990 **/
1991 EFI_STATUS
1992 SmbiosFldMiscType34 (
1993 IN OUT SMBIOS_STRUCTURE_NODE *StructureNode,
1994 IN UINT32 Offset,
1995 IN VOID *RecordData,
1996 IN UINT32 RecordDataSize
1997 )
1998 {
1999 EFI_MISC_MANAGEMENT_DEVICE_DESCRIPTION *ManagementDevice;
2000
2001 ManagementDevice = (EFI_MISC_MANAGEMENT_DEVICE_DESCRIPTION *)RecordData;
2002
2003 //
2004 // ManagementDeviceDescription
2005 //
2006 SmbiosFldString (
2007 StructureNode,
2008 OFFSET_OF (SMBIOS_TABLE_TYPE34, Description),
2009 &(ManagementDevice->ManagementDeviceDescription),
2010 2 // 64 * sizeof(CHAR16)
2011 );
2012
2013 //
2014 // ManagementDeviceType
2015 //
2016 CopyMem (
2017 (UINT8 *) (StructureNode->Structure) + OFFSET_OF (SMBIOS_TABLE_TYPE34, Type),
2018 &ManagementDevice->ManagementDeviceType,
2019 1
2020 );
2021
2022 //
2023 // ManagementDeviceAddress
2024 //
2025 CopyMem (
2026 (UINT8 *) (StructureNode->Structure) + OFFSET_OF (SMBIOS_TABLE_TYPE34, Address),
2027 &ManagementDevice->ManagementDeviceAddress,
2028 4
2029 );
2030
2031 //
2032 // ManagementDeviceAddressType
2033 //
2034 CopyMem (
2035 (UINT8 *) (StructureNode->Structure) + OFFSET_OF (SMBIOS_TABLE_TYPE34, AddressType),
2036 &ManagementDevice->ManagementDeviceAddressType,
2037 1
2038 );
2039
2040 return EFI_SUCCESS;
2041 }
2042
2043 /**
2044 Field Filling Function for Misc SubClass record type 36 -- Management Device Threshold.
2045
2046 @param StructureNode Pointer to SMBIOS_STRUCTURE_NODE which is current processed.
2047 @param Offset Offset of SMBIOS record which RecordData will be filled.
2048 @param RecordData RecordData buffer will be filled.
2049 @param RecordDataSize The size of RecordData buffer.
2050
2051 @retval EFI_SUCCESS Success fill RecordData into SMBIOS's record buffer.
2052 **/
2053 EFI_STATUS
2054 SmbiosFldMiscType36 (
2055 IN OUT SMBIOS_STRUCTURE_NODE *StructureNode,
2056 IN UINT32 Offset,
2057 IN VOID *RecordData,
2058 IN UINT32 RecordDataSize
2059 )
2060 {
2061 EFI_MISC_MANAGEMENT_DEVICE_THRESHOLD *DeviceThreshold;
2062
2063 DeviceThreshold = (EFI_MISC_MANAGEMENT_DEVICE_THRESHOLD *)RecordData;
2064
2065 //
2066 // LowerThresNonCritical
2067 //
2068 CopyMem (
2069 (UINT8 *) (StructureNode->Structure) + OFFSET_OF (SMBIOS_TABLE_TYPE36, LowerThresholdNonCritical),
2070 &DeviceThreshold->LowerThresNonCritical,
2071 2
2072 );
2073
2074 //
2075 // UpperThresNonCritical
2076 //
2077 CopyMem (
2078 (UINT8 *) (StructureNode->Structure) + OFFSET_OF (SMBIOS_TABLE_TYPE36, UpperThresholdNonCritical),
2079 &DeviceThreshold->UpperThresNonCritical,
2080 2
2081 );
2082
2083 //
2084 // LowerThresCritical
2085 //
2086 CopyMem (
2087 (UINT8 *) (StructureNode->Structure) + OFFSET_OF (SMBIOS_TABLE_TYPE36, LowerThresholdCritical),
2088 &DeviceThreshold->LowerThresCritical,
2089 2
2090 );
2091
2092 //
2093 // UpperThresCritical
2094 //
2095 CopyMem (
2096 (UINT8 *) (StructureNode->Structure) + OFFSET_OF (SMBIOS_TABLE_TYPE36, UpperThresholdCritical),
2097 &DeviceThreshold->UpperThresCritical,
2098 2
2099 );
2100
2101 //
2102 // LowerThresNonRecover
2103 //
2104 CopyMem (
2105 (UINT8 *) (StructureNode->Structure) + OFFSET_OF (SMBIOS_TABLE_TYPE36, LowerThresholdNonRecoverable),
2106 &DeviceThreshold->LowerThresNonRecover,
2107 2
2108 );
2109
2110 //
2111 // UpperThresNonRecover
2112 //
2113 CopyMem (
2114 (UINT8 *) (StructureNode->Structure) + OFFSET_OF (SMBIOS_TABLE_TYPE36, UpperThresholdNonRecoverable),
2115 &DeviceThreshold->UpperThresNonRecover,
2116 2
2117 );
2118
2119 return EFI_SUCCESS;
2120 }
2121
2122 /**
2123 Field Filling Function for Misc SubClass record type 38 -- IPMI device info.
2124
2125 @param StructureNode Pointer to SMBIOS_STRUCTURE_NODE which is current processed.
2126 @param Offset Offset of SMBIOS record which RecordData will be filled.
2127 @param RecordData RecordData buffer will be filled.
2128 @param RecordDataSize The size of RecordData buffer.
2129
2130 @retval EFI_SUCCESS Success fill RecordData into SMBIOS's record buffer.
2131 **/
2132 EFI_STATUS
2133 SmbiosFldMiscType38 (
2134 IN OUT SMBIOS_STRUCTURE_NODE *StructureNode,
2135 IN UINT32 Offset,
2136 IN VOID *RecordData,
2137 IN UINT32 RecordDataSize
2138 )
2139 {
2140 EFI_MISC_IPMI_INTERFACE_TYPE_DATA *IpmiInfo;
2141
2142 IpmiInfo = (EFI_MISC_IPMI_INTERFACE_TYPE_DATA *) RecordData;
2143
2144 //
2145 // Interface Type
2146 //
2147 *(UINT8 *) ((UINT8 *) (StructureNode->Structure) + OFFSET_OF (SMBIOS_TABLE_TYPE38, InterfaceType)) = (UINT8) (IpmiInfo->IpmiInterfaceType);
2148
2149 //
2150 // IPMI specification revision
2151 //
2152 *(UINT8 *) ((UINT8 *) (StructureNode->Structure) + OFFSET_OF (SMBIOS_TABLE_TYPE38, IPMISpecificationRevision)) =
2153 (UINT8) ((IpmiInfo->IpmiSpecificationRevision.IpmiSpecLeastSignificantDigit) + \
2154 (IpmiInfo->IpmiSpecificationRevision.IpmiSpecMostSignificantDigit << 4));
2155
2156 //
2157 // I2C slave address
2158 //
2159 *(UINT8 *) ((UINT8 *) (StructureNode->Structure) + OFFSET_OF (SMBIOS_TABLE_TYPE38, I2CSlaveAddress)) = (UINT8) (IpmiInfo->IpmiI2CSlaveAddress);
2160
2161 //
2162 // NV storage device address
2163 //
2164 *(UINT8 *) ((UINT8 *) (StructureNode->Structure) + OFFSET_OF (SMBIOS_TABLE_TYPE38, NVStorageDeviceAddress)) = (UINT8) (IpmiInfo->IpmiNvDeviceAddress);
2165
2166 //
2167 // Base address
2168 //
2169 CopyMem (
2170 (UINT8 *) (StructureNode->Structure) + OFFSET_OF (SMBIOS_TABLE_TYPE38, BaseAddress),
2171 &IpmiInfo->IpmiBaseAddress,
2172 8
2173 );
2174
2175 return EFI_SUCCESS;
2176 }
2177
2178 /**
2179 Field Filling Function for Misc SubClass record type 39 -- Power supply.
2180
2181 @param StructureNode Pointer to SMBIOS_STRUCTURE_NODE which is current processed.
2182 @param Offset Offset of SMBIOS record which RecordData will be filled.
2183 @param RecordData RecordData buffer will be filled.
2184 @param RecordDataSize The size of RecordData buffer.
2185
2186 @retval EFI_SUCCESS Success fill RecordData into SMBIOS's record buffer.
2187 **/
2188 EFI_STATUS
2189 SmbiosFldMiscType39 (
2190 IN OUT SMBIOS_STRUCTURE_NODE *StructureNode,
2191 IN UINT32 Offset,
2192 IN VOID *RecordData,
2193 IN UINT32 RecordDataSize
2194 )
2195 {
2196 EFI_MISC_SYSTEM_POWER_SUPPLY *PowerSupply;
2197
2198 PowerSupply = (EFI_MISC_SYSTEM_POWER_SUPPLY *)RecordData;
2199
2200 //
2201 // PowerUnitGroup
2202 //
2203 CopyMem (
2204 (UINT8 *) (StructureNode->Structure) + OFFSET_OF (SMBIOS_TABLE_TYPE39, PowerUnitGroup),
2205 &PowerSupply->PowerUnitGroup,
2206 1
2207 );
2208
2209 //
2210 // PowerSupplyLocation
2211 //
2212 SmbiosFldString (
2213 StructureNode,
2214 OFFSET_OF (SMBIOS_TABLE_TYPE39, Location),
2215 &(PowerSupply->PowerSupplyLocation),
2216 2 // 64 * sizeof(CHAR16)
2217 );
2218
2219 //
2220 // PowerSupplyDeviceName
2221 //
2222 SmbiosFldString (
2223 StructureNode,
2224 OFFSET_OF (SMBIOS_TABLE_TYPE39, DeviceName),
2225 &(PowerSupply->PowerSupplyDeviceName),
2226 2 // 64 * sizeof(CHAR16)
2227 );
2228
2229 //
2230 // PowerSupplyManufacturer
2231 //
2232 SmbiosFldString (
2233 StructureNode,
2234 OFFSET_OF (SMBIOS_TABLE_TYPE39, Manufacturer),
2235 &(PowerSupply->PowerSupplyManufacturer),
2236 2 // 64 * sizeof(CHAR16)
2237 );
2238
2239 //
2240 // PowerSupplySerialNumber
2241 //
2242 SmbiosFldString (
2243 StructureNode,
2244 OFFSET_OF (SMBIOS_TABLE_TYPE39, SerialNumber),
2245 &(PowerSupply->PowerSupplySerialNumber),
2246 2 // 64 * sizeof(CHAR16)
2247 );
2248
2249 //
2250 // PowerSupplyAssetTagNumber
2251 //
2252 SmbiosFldString (
2253 StructureNode,
2254 OFFSET_OF (SMBIOS_TABLE_TYPE39, AssetTagNumber),
2255 &(PowerSupply->PowerSupplyAssetTagNumber),
2256 2 // 64 * sizeof(CHAR16)
2257 );
2258
2259 //
2260 // PowerSupplyModelPartNumber
2261 //
2262 SmbiosFldString (
2263 StructureNode,
2264 OFFSET_OF (SMBIOS_TABLE_TYPE39, ModelPartNumber),
2265 &(PowerSupply->PowerSupplyModelPartNumber),
2266 2 // 64 * sizeof(CHAR16)
2267 );
2268
2269 //
2270 // PowerSupplyRevisionLevel
2271 //
2272 SmbiosFldString (
2273 StructureNode,
2274 OFFSET_OF (SMBIOS_TABLE_TYPE39, RevisionLevel),
2275 &(PowerSupply->PowerSupplyRevisionLevel),
2276 2 // 64 * sizeof(CHAR16)
2277 );
2278
2279 //
2280 // PowerSupplyMaxPowerCapacity
2281 //
2282 CopyMem (
2283 (UINT8 *) (StructureNode->Structure) + OFFSET_OF (SMBIOS_TABLE_TYPE39, MaxPowerCapacity),
2284 &PowerSupply->PowerSupplyMaxPowerCapacity,
2285 2
2286 );
2287
2288 //
2289 // PowerSupplyCharacteristics
2290 //
2291 CopyMem (
2292 (UINT8 *) (StructureNode->Structure) + OFFSET_OF (SMBIOS_TABLE_TYPE39, PowerSupplyCharacteristics),
2293 &PowerSupply->PowerSupplyCharacteristics,
2294 2
2295 );
2296
2297 //
2298 // PowerSupplyInputVoltageProbeLink
2299 //
2300 SmbiosFldInterLink (
2301 StructureNode,
2302 (UINT16) OFFSET_OF (SMBIOS_TABLE_TYPE39, InputVoltageProbeHandle),
2303 26, // SMBIOS type 26 - Voltage Probe
2304 &PowerSupply->PowerSupplyInputVoltageProbeLink,
2305 &gEfiMiscSubClassGuid
2306 );
2307
2308 //
2309 // PowerSupplyCoolingDeviceLink
2310 //
2311 SmbiosFldInterLink (
2312 StructureNode,
2313 (UINT16) OFFSET_OF (SMBIOS_TABLE_TYPE39, CoolingDeviceHandle),
2314 27, // SMBIOS type 27 - Cooling Device
2315 &PowerSupply->PowerSupplyCoolingDeviceLink,
2316 &gEfiMiscSubClassGuid
2317 );
2318
2319 //
2320 // PowerSupplyInputCurrentProbeLink
2321 //
2322 SmbiosFldInterLink (
2323 StructureNode,
2324 (UINT16) OFFSET_OF (SMBIOS_TABLE_TYPE39, InputCurrentProbeHandle),
2325 29, // SMBIOS type 29 - Electrical Current Probe
2326 &PowerSupply->PowerSupplyInputCurrentProbeLink,
2327 &gEfiMiscSubClassGuid
2328 );
2329
2330 return EFI_SUCCESS;
2331 }
2332
2333 /**
2334 Field Filling Function for Misc SubClass record type 0x80-0xFF -- OEM.
2335
2336 @param StructureNode Pointer to SMBIOS_STRUCTURE_NODE which is current processed.
2337 @param Offset Offset of SMBIOS record which RecordData will be filled.
2338 @param RecordData RecordData buffer will be filled.
2339 @param RecordDataSize The size of RecordData buffer.
2340
2341 @retval EFI_SUCCESS Success fill RecordData into SMBIOS's record buffer.
2342 **/
2343 EFI_STATUS
2344 SmbiosFldMiscTypeOEM (
2345 IN OUT SMBIOS_STRUCTURE_NODE *StructureNode,
2346 IN UINT32 Offset,
2347 IN VOID *RecordData,
2348 IN UINT32 RecordDataSize
2349 )
2350 {
2351 EFI_STATUS Status;
2352 UINT8 *NewRecordData;
2353 UINT32 IncrementDataSize;
2354 UINT16 Handle;
2355 INT8 Result;
2356 UINT32 StructureSize;
2357 UINT8 CountOfString;
2358
2359 Status = EFI_SUCCESS;
2360 NewRecordData = NULL;
2361
2362 //
2363 // Check if OEM structure has included 2 trailing 0s in data record, if not,
2364 // we append them at the end to ensure OEM structure is always correct with 2 trailing 0s.
2365 //
2366 Result = SmbiosCheckTrailingZero (RecordData, RecordDataSize);
2367
2368 if (Result != 0) {
2369 DEBUG ((EFI_D_ERROR, "OEM SMBIOS type %x is not valid!!\n", ((SMBIOS_STRUCTURE *) RecordData) -> Type));
2370 if (Result == -1) {
2371 //
2372 // No 2 trailing 0s exist
2373 //
2374 DEBUG ((EFI_D_ERROR, "OEM SMBIOS type has NO 2 trailing 0s!!\n"));
2375 IncrementDataSize = 2;
2376 } else {
2377 //
2378 // Only 1 trailing 0 exist at the end
2379 //
2380 DEBUG ((EFI_D_ERROR, "OEM SMBIOS type has only 1 trailing 0!!\n"));
2381 IncrementDataSize = 1;
2382 }
2383 NewRecordData = AllocateZeroPool (RecordDataSize + IncrementDataSize);
2384 ASSERT (NewRecordData != NULL);
2385 CopyMem (NewRecordData, RecordData, RecordDataSize);
2386 RecordData = NewRecordData;
2387 RecordDataSize += IncrementDataSize;
2388 }
2389
2390 Status = GetSmbiosStructureSize (StructureNode->Structure, &StructureSize, &CountOfString);
2391 ASSERT_EFI_ERROR (Status);
2392
2393 if (StructureSize < RecordDataSize) {
2394 Status = SmbiosEnlargeStructureBuffer (
2395 StructureNode,
2396 ((EFI_SMBIOS_TABLE_HEADER *)RecordData)->Length,
2397 StructureSize,
2398 RecordDataSize
2399 );
2400 if (EFI_ERROR (Status)) {
2401 return Status;
2402 }
2403 }
2404
2405 //
2406 // Copy the entire data (including the Smbios structure header),
2407 // but preserve the handle that is already allocated.
2408 //
2409 Handle = StructureNode->Structure->Handle;
2410 CopyMem (
2411 StructureNode->Structure,
2412 RecordData,
2413 RecordDataSize
2414 );
2415 StructureNode->Structure->Handle = Handle;
2416 StructureNode->StructureSize = RecordDataSize;
2417
2418 if (NewRecordData != NULL) {
2419 FreePool (NewRecordData);
2420 }
2421
2422 return Status;
2423 }
2424
2425 /**
2426 Field Filling Function for Misc SubClass record type 127 - End-of-Table.
2427
2428 @param StructureNode Pointer to SMBIOS_STRUCTURE_NODE which is current processed.
2429 @param Offset Offset of SMBIOS record which RecordData will be filled.
2430 @param RecordData RecordData buffer will be filled.
2431 @param RecordDataSize The size of RecordData buffer.
2432
2433 @retval EFI_SUCCESS Success fill RecordData into SMBIOS's record buffer.
2434 **/
2435 EFI_STATUS
2436 SmbiosFldMiscType127 (
2437 IN OUT SMBIOS_STRUCTURE_NODE *StructureNode,
2438 IN UINT32 Offset,
2439 IN VOID *RecordData,
2440 IN UINT32 RecordDataSize
2441 )
2442 {
2443 return EFI_SUCCESS;
2444 }