EDK2 doxygen online documents - Firmware Encoding Index 1
EDK2 doxygen online documents - Firmware Encoding Index

Nt32Pkg/MiscSubClassPlatformDxe/MiscOemStringFunction.c

Go to the documentation of this file.
00001 
00017 #include "MiscSubclassDriver.h"
00029 MISC_SMBIOS_TABLE_FUNCTION(OemString)
00030 {
00031   UINTN                    OemStrLen;
00032   CHAR8                    *OptionalStrStart;
00033   EFI_STATUS               Status;
00034   EFI_STRING               OemStr;
00035   STRING_REF               TokenToGet;
00036   EFI_SMBIOS_HANDLE        SmbiosHandle;
00037   SMBIOS_TABLE_TYPE11      *SmbiosRecord;
00038 
00039   //
00040   // First check for invalid parameters.
00041   //
00042   if (RecordData == NULL) {
00043     return EFI_INVALID_PARAMETER;
00044   }
00045 
00046   TokenToGet = STRING_TOKEN (STR_MISC_OEM_STRING);
00047   OemStr = HiiGetPackageString(&gEfiCallerIdGuid, TokenToGet, NULL);
00048   OemStrLen = StrLen(OemStr);
00049   if (OemStrLen > SMBIOS_STRING_MAX_LENGTH) {
00050     return EFI_UNSUPPORTED;
00051   }
00052 
00053   //
00054   // Two zeros following the last string.
00055   //
00056   SmbiosRecord = AllocatePool(sizeof (SMBIOS_TABLE_TYPE11) + OemStrLen + 1 + 1);
00057   ZeroMem(SmbiosRecord, sizeof (SMBIOS_TABLE_TYPE11) + OemStrLen + 1 + 1);
00058 
00059   SmbiosRecord->Hdr.Type = EFI_SMBIOS_TYPE_OEM_STRINGS;
00060   SmbiosRecord->Hdr.Length = sizeof (SMBIOS_TABLE_TYPE11);
00061   //
00062   // Make handle chosen by smbios protocol.add automatically.
00063   // 
00064   SmbiosRecord->Hdr.Handle = 0;  
00065   SmbiosRecord->StringCount = 1;
00066   OptionalStrStart = (CHAR8 *)(SmbiosRecord + 1);
00067   UnicodeStrToAsciiStr(OemStr, OptionalStrStart);
00068 
00069   //
00070   // Now we have got the full smbios record, call smbios protocol to add this record.
00071   //
00072   SmbiosHandle = 0;
00073   Status = Smbios-> Add(
00074                       Smbios, 
00075                       NULL,
00076                       &SmbiosHandle, 
00077                       (EFI_SMBIOS_TABLE_HEADER *) SmbiosRecord
00078                       );
00079   FreePool(SmbiosRecord);
00080   return Status;
00081 }
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Defines