Home | History | Annotate | Download | only in PiSmbiosRecordOnDataHubSmbiosRecordThunk
      1 /** @file
      2   Routines that support Misc SubClass data records translation.
      3 
      4 Copyright (c) 2009 - 2010, Intel Corporation. All rights reserved.<BR>
      5 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 > 0) {
    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   // It's the index of multiple languages. Languages are filled by SmbiosFldMiscType14.
    917   //
    918   CopyMem (
    919     (UINT8 *) (StructureNode->Structure) + OFFSET_OF (SMBIOS_TABLE_TYPE13, CurrentLanguages),
    920     &InstallableLanguage->CurrentLanguageNumber,
    921     1
    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 35 -- Management Device Component.
   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 SmbiosFldMiscType35 (
   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_COMPONENT_DESCRIPTION  *ManagementDeviceComponent;
   2062   EFI_INTER_LINK_DATA                               ManagementDeviceLink;
   2063   EFI_INTER_LINK_DATA                               ManagementDeviceComponentLink;
   2064   EFI_INTER_LINK_DATA                               ManagementDeviceThresholdLink;
   2065 
   2066   ManagementDeviceComponent = (EFI_MISC_MANAGEMENT_DEVICE_COMPONENT_DESCRIPTION *)RecordData;
   2067   CopyMem (
   2068     &ManagementDeviceLink,
   2069     &ManagementDeviceComponent->ManagementDeviceLink,
   2070     sizeof (EFI_INTER_LINK_DATA)
   2071     );
   2072   CopyMem (
   2073     &ManagementDeviceComponentLink,
   2074     &ManagementDeviceComponent->ManagementDeviceComponentLink,
   2075     sizeof (EFI_INTER_LINK_DATA)
   2076     );
   2077   CopyMem (&ManagementDeviceThresholdLink,
   2078     &ManagementDeviceComponent->ManagementDeviceThresholdLink,
   2079     sizeof (EFI_INTER_LINK_DATA)
   2080     );
   2081 
   2082   //
   2083   // ManagementDeviceComponentDescription
   2084   //
   2085   SmbiosFldString (
   2086     StructureNode,
   2087     OFFSET_OF (SMBIOS_TABLE_TYPE35, Description),
   2088     &ManagementDeviceComponent->ManagementDeviceComponentDescription,
   2089     2       // 64 * sizeof(CHAR16)
   2090     );
   2091 
   2092   //
   2093   // ManagementDeviceLink
   2094   //
   2095   SmbiosFldInterLink (
   2096     StructureNode,
   2097     (UINT16) OFFSET_OF (SMBIOS_TABLE_TYPE35, ManagementDeviceHandle),
   2098     34,     // SMBIOS type 34 - Management Device
   2099     &ManagementDeviceLink,
   2100     &gEfiMiscSubClassGuid
   2101     );
   2102 
   2103   //
   2104   // ManagementDeviceComponentLink
   2105   //
   2106   SmbiosFldInterLink (
   2107     StructureNode,
   2108     (UINT16) OFFSET_OF (SMBIOS_TABLE_TYPE35, ComponentHandle),
   2109     ManagementDeviceComponent->ComponentType,   // SMBIOS type, according to SMBIOS spec, it can be Type 26, 27, 28, 29
   2110     &ManagementDeviceComponentLink,
   2111     &gEfiMiscSubClassGuid
   2112     );
   2113 
   2114   //
   2115   // ManagementDeviceThresholdLink
   2116   //
   2117   SmbiosFldInterLink (
   2118     StructureNode,
   2119     (UINT16) OFFSET_OF (SMBIOS_TABLE_TYPE35, ThresholdHandle),
   2120     36,     // SMBIOS type 36 - Management Device Threshold Data
   2121     &ManagementDeviceThresholdLink,
   2122     &gEfiMiscSubClassGuid
   2123     );
   2124 
   2125   return EFI_SUCCESS;
   2126 }
   2127 
   2128 /**
   2129   Field Filling Function for Misc SubClass record type 36 -- Management Device Threshold.
   2130 
   2131   @param StructureNode    Pointer to SMBIOS_STRUCTURE_NODE which is current processed.
   2132   @param Offset           Offset of SMBIOS record which RecordData will be filled.
   2133   @param RecordData       RecordData buffer will be filled.
   2134   @param RecordDataSize   The size of RecordData buffer.
   2135 
   2136   @retval EFI_SUCCESS   Success fill RecordData into SMBIOS's record buffer.
   2137 **/
   2138 EFI_STATUS
   2139 SmbiosFldMiscType36 (
   2140   IN OUT  SMBIOS_STRUCTURE_NODE     *StructureNode,
   2141   IN      UINT32                    Offset,
   2142   IN      VOID                      *RecordData,
   2143   IN      UINT32                    RecordDataSize
   2144   )
   2145 {
   2146   EFI_MISC_MANAGEMENT_DEVICE_THRESHOLD *DeviceThreshold;
   2147 
   2148   DeviceThreshold = (EFI_MISC_MANAGEMENT_DEVICE_THRESHOLD *)RecordData;
   2149 
   2150   //
   2151   // LowerThresNonCritical
   2152   //
   2153   CopyMem (
   2154     (UINT8 *) (StructureNode->Structure) + OFFSET_OF (SMBIOS_TABLE_TYPE36, LowerThresholdNonCritical),
   2155     &DeviceThreshold->LowerThresNonCritical,
   2156     2
   2157     );
   2158 
   2159   //
   2160   // UpperThresNonCritical
   2161   //
   2162   CopyMem (
   2163     (UINT8 *) (StructureNode->Structure) + OFFSET_OF (SMBIOS_TABLE_TYPE36, UpperThresholdNonCritical),
   2164     &DeviceThreshold->UpperThresNonCritical,
   2165     2
   2166     );
   2167 
   2168   //
   2169   // LowerThresCritical
   2170   //
   2171   CopyMem (
   2172     (UINT8 *) (StructureNode->Structure) + OFFSET_OF (SMBIOS_TABLE_TYPE36, LowerThresholdCritical),
   2173     &DeviceThreshold->LowerThresCritical,
   2174     2
   2175     );
   2176 
   2177   //
   2178   // UpperThresCritical
   2179   //
   2180   CopyMem (
   2181     (UINT8 *) (StructureNode->Structure) + OFFSET_OF (SMBIOS_TABLE_TYPE36, UpperThresholdCritical),
   2182     &DeviceThreshold->UpperThresCritical,
   2183     2
   2184     );
   2185 
   2186   //
   2187   // LowerThresNonRecover
   2188   //
   2189   CopyMem (
   2190     (UINT8 *) (StructureNode->Structure) + OFFSET_OF (SMBIOS_TABLE_TYPE36, LowerThresholdNonRecoverable),
   2191     &DeviceThreshold->LowerThresNonRecover,
   2192     2
   2193     );
   2194 
   2195   //
   2196   // UpperThresNonRecover
   2197   //
   2198   CopyMem (
   2199     (UINT8 *) (StructureNode->Structure) + OFFSET_OF (SMBIOS_TABLE_TYPE36, UpperThresholdNonRecoverable),
   2200     &DeviceThreshold->UpperThresNonRecover,
   2201     2
   2202     );
   2203 
   2204   return EFI_SUCCESS;
   2205 }
   2206 
   2207 /**
   2208   Field Filling Function for Misc SubClass record type 38 -- IPMI device info.
   2209 
   2210   @param StructureNode    Pointer to SMBIOS_STRUCTURE_NODE which is current processed.
   2211   @param Offset           Offset of SMBIOS record which RecordData will be filled.
   2212   @param RecordData       RecordData buffer will be filled.
   2213   @param RecordDataSize   The size of RecordData buffer.
   2214 
   2215   @retval EFI_SUCCESS   Success fill RecordData into SMBIOS's record buffer.
   2216 **/
   2217 EFI_STATUS
   2218 SmbiosFldMiscType38 (
   2219   IN OUT  SMBIOS_STRUCTURE_NODE     *StructureNode,
   2220   IN      UINT32                    Offset,
   2221   IN      VOID                      *RecordData,
   2222   IN      UINT32                    RecordDataSize
   2223   )
   2224 {
   2225   EFI_MISC_IPMI_INTERFACE_TYPE_DATA  *IpmiInfo;
   2226 
   2227   IpmiInfo  = (EFI_MISC_IPMI_INTERFACE_TYPE_DATA *) RecordData;
   2228 
   2229   //
   2230   // Interface Type
   2231   //
   2232   *(UINT8 *) ((UINT8 *) (StructureNode->Structure) + OFFSET_OF (SMBIOS_TABLE_TYPE38, InterfaceType)) = (UINT8) (IpmiInfo->IpmiInterfaceType);
   2233 
   2234   //
   2235   // IPMI specification revision
   2236   //
   2237   *(UINT8 *) ((UINT8 *) (StructureNode->Structure) + OFFSET_OF (SMBIOS_TABLE_TYPE38, IPMISpecificationRevision)) =
   2238   (UINT8) ((IpmiInfo->IpmiSpecificationRevision.IpmiSpecLeastSignificantDigit) + \
   2239            (IpmiInfo->IpmiSpecificationRevision.IpmiSpecMostSignificantDigit << 4));
   2240 
   2241   //
   2242   // I2C slave address
   2243   //
   2244   *(UINT8 *) ((UINT8 *) (StructureNode->Structure) + OFFSET_OF (SMBIOS_TABLE_TYPE38, I2CSlaveAddress)) = (UINT8) (IpmiInfo->IpmiI2CSlaveAddress);
   2245 
   2246   //
   2247   // NV storage device address
   2248   //
   2249   *(UINT8 *) ((UINT8 *) (StructureNode->Structure) + OFFSET_OF (SMBIOS_TABLE_TYPE38, NVStorageDeviceAddress)) = (UINT8) (IpmiInfo->IpmiNvDeviceAddress);
   2250 
   2251   //
   2252   // Base address
   2253   //
   2254   CopyMem (
   2255     (UINT8 *) (StructureNode->Structure) + OFFSET_OF (SMBIOS_TABLE_TYPE38, BaseAddress),
   2256     &IpmiInfo->IpmiBaseAddress,
   2257     8
   2258     );
   2259 
   2260   return EFI_SUCCESS;
   2261 }
   2262 
   2263 /**
   2264   Field Filling Function for Misc SubClass record type 39 -- Power supply.
   2265 
   2266   @param StructureNode    Pointer to SMBIOS_STRUCTURE_NODE which is current processed.
   2267   @param Offset           Offset of SMBIOS record which RecordData will be filled.
   2268   @param RecordData       RecordData buffer will be filled.
   2269   @param RecordDataSize   The size of RecordData buffer.
   2270 
   2271   @retval EFI_SUCCESS   Success fill RecordData into SMBIOS's record buffer.
   2272 **/
   2273 EFI_STATUS
   2274 SmbiosFldMiscType39 (
   2275   IN OUT  SMBIOS_STRUCTURE_NODE     *StructureNode,
   2276   IN      UINT32                    Offset,
   2277   IN      VOID                      *RecordData,
   2278   IN      UINT32                    RecordDataSize
   2279   )
   2280 {
   2281   EFI_MISC_SYSTEM_POWER_SUPPLY *PowerSupply;
   2282 
   2283   PowerSupply = (EFI_MISC_SYSTEM_POWER_SUPPLY *)RecordData;
   2284 
   2285   //
   2286   // PowerUnitGroup
   2287   //
   2288   CopyMem (
   2289     (UINT8 *) (StructureNode->Structure) + OFFSET_OF (SMBIOS_TABLE_TYPE39, PowerUnitGroup),
   2290     &PowerSupply->PowerUnitGroup,
   2291     1
   2292     );
   2293 
   2294   //
   2295   // PowerSupplyLocation
   2296   //
   2297   SmbiosFldString (
   2298     StructureNode,
   2299     OFFSET_OF (SMBIOS_TABLE_TYPE39, Location),
   2300     &(PowerSupply->PowerSupplyLocation),
   2301     2 // 64 * sizeof(CHAR16)
   2302     );
   2303 
   2304   //
   2305   // PowerSupplyDeviceName
   2306   //
   2307   SmbiosFldString (
   2308     StructureNode,
   2309     OFFSET_OF (SMBIOS_TABLE_TYPE39, DeviceName),
   2310     &(PowerSupply->PowerSupplyDeviceName),
   2311     2 // 64 * sizeof(CHAR16)
   2312     );
   2313 
   2314   //
   2315   // PowerSupplyManufacturer
   2316   //
   2317   SmbiosFldString (
   2318     StructureNode,
   2319     OFFSET_OF (SMBIOS_TABLE_TYPE39, Manufacturer),
   2320     &(PowerSupply->PowerSupplyManufacturer),
   2321     2 // 64 * sizeof(CHAR16)
   2322     );
   2323 
   2324   //
   2325   // PowerSupplySerialNumber
   2326   //
   2327   SmbiosFldString (
   2328     StructureNode,
   2329     OFFSET_OF (SMBIOS_TABLE_TYPE39, SerialNumber),
   2330     &(PowerSupply->PowerSupplySerialNumber),
   2331     2 // 64 * sizeof(CHAR16)
   2332     );
   2333 
   2334   //
   2335   // PowerSupplyAssetTagNumber
   2336   //
   2337   SmbiosFldString (
   2338     StructureNode,
   2339     OFFSET_OF (SMBIOS_TABLE_TYPE39, AssetTagNumber),
   2340     &(PowerSupply->PowerSupplyAssetTagNumber),
   2341     2 // 64 * sizeof(CHAR16)
   2342     );
   2343 
   2344   //
   2345   // PowerSupplyModelPartNumber
   2346   //
   2347   SmbiosFldString (
   2348     StructureNode,
   2349     OFFSET_OF (SMBIOS_TABLE_TYPE39, ModelPartNumber),
   2350     &(PowerSupply->PowerSupplyModelPartNumber),
   2351     2 // 64 * sizeof(CHAR16)
   2352     );
   2353 
   2354   //
   2355   // PowerSupplyRevisionLevel
   2356   //
   2357   SmbiosFldString (
   2358     StructureNode,
   2359     OFFSET_OF (SMBIOS_TABLE_TYPE39, RevisionLevel),
   2360     &(PowerSupply->PowerSupplyRevisionLevel),
   2361     2 // 64 * sizeof(CHAR16)
   2362     );
   2363 
   2364   //
   2365   // PowerSupplyMaxPowerCapacity
   2366   //
   2367   CopyMem (
   2368     (UINT8 *) (StructureNode->Structure) + OFFSET_OF (SMBIOS_TABLE_TYPE39, MaxPowerCapacity),
   2369     &PowerSupply->PowerSupplyMaxPowerCapacity,
   2370     2
   2371     );
   2372 
   2373   //
   2374   // PowerSupplyCharacteristics
   2375   //
   2376   CopyMem (
   2377     (UINT8 *) (StructureNode->Structure) + OFFSET_OF (SMBIOS_TABLE_TYPE39, PowerSupplyCharacteristics),
   2378     &PowerSupply->PowerSupplyCharacteristics,
   2379     2
   2380     );
   2381 
   2382   //
   2383   // PowerSupplyInputVoltageProbeLink
   2384   //
   2385   SmbiosFldInterLink (
   2386     StructureNode,
   2387     (UINT16) OFFSET_OF (SMBIOS_TABLE_TYPE39, InputVoltageProbeHandle),
   2388     26,  // SMBIOS type 26 - Voltage Probe
   2389     &PowerSupply->PowerSupplyInputVoltageProbeLink,
   2390     &gEfiMiscSubClassGuid
   2391     );
   2392 
   2393   //
   2394   // PowerSupplyCoolingDeviceLink
   2395   //
   2396   SmbiosFldInterLink (
   2397     StructureNode,
   2398     (UINT16) OFFSET_OF (SMBIOS_TABLE_TYPE39, CoolingDeviceHandle),
   2399     27,  // SMBIOS type 27 - Cooling Device
   2400     &PowerSupply->PowerSupplyCoolingDeviceLink,
   2401     &gEfiMiscSubClassGuid
   2402     );
   2403 
   2404   //
   2405   // PowerSupplyInputCurrentProbeLink
   2406   //
   2407   SmbiosFldInterLink (
   2408     StructureNode,
   2409     (UINT16) OFFSET_OF (SMBIOS_TABLE_TYPE39, InputCurrentProbeHandle),
   2410     29,  // SMBIOS type 29 - Electrical Current Probe
   2411     &PowerSupply->PowerSupplyInputCurrentProbeLink,
   2412     &gEfiMiscSubClassGuid
   2413     );
   2414 
   2415   return EFI_SUCCESS;
   2416 }
   2417 
   2418 /**
   2419   Field Filling Function for Misc SubClass record type 0x80-0xFF -- OEM.
   2420 
   2421   @param StructureNode    Pointer to SMBIOS_STRUCTURE_NODE which is current processed.
   2422   @param Offset           Offset of SMBIOS record which RecordData will be filled.
   2423   @param RecordData       RecordData buffer will be filled.
   2424   @param RecordDataSize   The size of RecordData buffer.
   2425 
   2426   @retval EFI_SUCCESS   Success fill RecordData into SMBIOS's record buffer.
   2427 **/
   2428 EFI_STATUS
   2429 SmbiosFldMiscTypeOEM (
   2430   IN OUT  SMBIOS_STRUCTURE_NODE     *StructureNode,
   2431   IN      UINT32                    Offset,
   2432   IN      VOID                      *RecordData,
   2433   IN      UINT32                    RecordDataSize
   2434   )
   2435 {
   2436   EFI_STATUS                            Status;
   2437   UINT8                                 *NewRecordData;
   2438   UINT32                                IncrementDataSize;
   2439   UINT16                                Handle;
   2440   INT8                                  Result;
   2441   UINT32                                StructureSize;
   2442   UINT8                                 CountOfString;
   2443 
   2444   Status             = EFI_SUCCESS;
   2445   NewRecordData      = NULL;
   2446 
   2447   //
   2448   // Check if OEM structure has included 2 trailing 0s in data record, if not,
   2449   // we append them at the end to ensure OEM structure is always correct with 2 trailing 0s.
   2450   //
   2451   Result = SmbiosCheckTrailingZero (RecordData, RecordDataSize);
   2452 
   2453   if (Result != 0) {
   2454     DEBUG ((EFI_D_ERROR, "OEM SMBIOS type %x is not valid!!\n", ((SMBIOS_STRUCTURE *) RecordData) -> Type));
   2455     if (Result == -1) {
   2456       //
   2457       // No 2 trailing 0s exist
   2458       //
   2459       DEBUG ((EFI_D_ERROR, "OEM SMBIOS type has NO 2 trailing 0s!!\n"));
   2460       IncrementDataSize = 2;
   2461     } else {
   2462       //
   2463       // Only 1 trailing 0 exist at the end
   2464       //
   2465       DEBUG ((EFI_D_ERROR, "OEM SMBIOS type has only 1 trailing 0!!\n"));
   2466       IncrementDataSize = 1;
   2467     }
   2468     NewRecordData = AllocateZeroPool (RecordDataSize + IncrementDataSize);
   2469     ASSERT (NewRecordData != NULL);
   2470     CopyMem (NewRecordData, RecordData, RecordDataSize);
   2471     RecordData = NewRecordData;
   2472     RecordDataSize += IncrementDataSize;
   2473   }
   2474 
   2475   Status = GetSmbiosStructureSize (StructureNode->Structure, &StructureSize, &CountOfString);
   2476   ASSERT_EFI_ERROR (Status);
   2477 
   2478   if (StructureSize < RecordDataSize) {
   2479     //
   2480     // Create new SMBIOS table entry
   2481     //
   2482     SmbiosUpdateStructureBuffer (
   2483       StructureNode,
   2484       RecordData
   2485       );
   2486   } else {
   2487     //
   2488     // Copy the entire data (including the Smbios structure header),
   2489     // but preserve the handle that is already allocated.
   2490     //
   2491     Handle = StructureNode->Structure->Handle;
   2492     CopyMem (
   2493       StructureNode->Structure,
   2494       RecordData,
   2495       RecordDataSize
   2496       );
   2497     StructureNode->Structure->Handle = Handle;
   2498     StructureNode->StructureSize = RecordDataSize;
   2499   }
   2500 
   2501   if (NewRecordData != NULL) {
   2502     FreePool (NewRecordData);
   2503   }
   2504 
   2505   return Status;
   2506 }
   2507 
   2508 /**
   2509   Field Filling Function for Misc SubClass record type 127 - End-of-Table.
   2510 
   2511   @param StructureNode    Pointer to SMBIOS_STRUCTURE_NODE which is current processed.
   2512   @param Offset           Offset of SMBIOS record which RecordData will be filled.
   2513   @param RecordData       RecordData buffer will be filled.
   2514   @param RecordDataSize   The size of RecordData buffer.
   2515 
   2516   @retval EFI_SUCCESS   Success fill RecordData into SMBIOS's record buffer.
   2517 **/
   2518 EFI_STATUS
   2519 SmbiosFldMiscType127 (
   2520   IN OUT  SMBIOS_STRUCTURE_NODE     *StructureNode,
   2521   IN      UINT32                    Offset,
   2522   IN      VOID                      *RecordData,
   2523   IN      UINT32                    RecordDataSize
   2524   )
   2525 {
   2526   return EFI_SUCCESS;
   2527 }
   2528