3 Copyright (c) 2009, Intel Corporation. All rights reserved. <BR>
4 This software and associated documentation (if any) is furnished
5 under a license and may only be used or copied in accordance
6 with the terms of the license. Except as permitted by such
7 license, no part of this software or documentation may be
8 reproduced, stored in a retrieval system, or transmitted in any
9 form or by any means without the express written consent of
14 MiscOemStringFunction.c
18 boot information boot time changes.
24 #include "MiscSubClassDriver.h"
26 This function makes boot time changes to the contents of the
27 MiscOemString (Type 11).
29 @param RecordData Pointer to copy of RecordData from the Data Table.
31 @retval EFI_SUCCESS All parameters were valid.
32 @retval EFI_UNSUPPORTED Unexpected RecordType value.
33 @retval EFI_INVALID_PARAMETER Invalid parameter was found.
36 MISC_SMBIOS_TABLE_FUNCTION(OemString
)
39 CHAR8
*OptionalStrStart
;
42 STRING_REF TokenToGet
;
43 EFI_SMBIOS_HANDLE SmbiosHandle
;
44 SMBIOS_TABLE_TYPE11
*SmbiosRecord
;
47 // First check for invalid parameters.
49 if (RecordData
== NULL
) {
50 return EFI_INVALID_PARAMETER
;
53 TokenToGet
= STRING_TOKEN (STR_MISC_OEM_STRING
);
54 OemStr
= HiiGetPackageString(&gEfiCallerIdGuid
, TokenToGet
, NULL
);
55 OemStrLen
= StrLen(OemStr
);
56 if (OemStrLen
> SMBIOS_STRING_MAX_LENGTH
) {
57 return EFI_UNSUPPORTED
;
61 // Two zeros following the last string.
63 SmbiosRecord
= AllocatePool(sizeof (SMBIOS_TABLE_TYPE11
) + OemStrLen
+ 1 + 1);
64 ZeroMem(SmbiosRecord
, sizeof (SMBIOS_TABLE_TYPE11
) + OemStrLen
+ 1 + 1);
66 SmbiosRecord
->Hdr
.Type
= EFI_SMBIOS_TYPE_OEM_STRINGS
;
67 SmbiosRecord
->Hdr
.Length
= sizeof (SMBIOS_TABLE_TYPE11
);
69 // Make handle chosen by smbios protocol.add automatically.
71 SmbiosRecord
->Hdr
.Handle
= 0;
72 SmbiosRecord
->StringCount
= 1;
73 OptionalStrStart
= (CHAR8
*)(SmbiosRecord
+ 1);
74 UnicodeStrToAsciiStr(OemStr
, OptionalStrStart
);
77 // Now we have got the full smbios record, call smbios protocol to add this record.
80 Status
= Smbios
-> Add(
84 (EFI_SMBIOS_TABLE_HEADER
*) SmbiosRecord
86 FreePool(SmbiosRecord
);