]> git.proxmox.com Git - mirror_edk2.git/blob - Nt32Pkg/MiscSubClassPlatformDxe/MiscSystemLanguageStringFunction.c
b2232a442f7cf1ce3672ceb88a7559415c8f0c21
[mirror_edk2.git] / Nt32Pkg / MiscSubClassPlatformDxe / MiscSystemLanguageStringFunction.c
1 /*++
2
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
10 Intel Corporation.
11
12 Module Name:
13
14 MiscResetCapabilitiesFunction.c
15
16 Abstract:
17
18 ResetCapabilities.
19 SMBIOS type 23.
20
21 --*/
22
23 #include "MiscSubclassDriver.h"
24 /**
25 This function makes boot time changes to the contents of the
26 MiscOemString (Type 11).
27
28 @param RecordData Pointer to copy of RecordData from the Data Table.
29
30 @retval EFI_SUCCESS All parameters were valid.
31 @retval EFI_UNSUPPORTED Unexpected RecordType value.
32 @retval EFI_INVALID_PARAMETER Invalid parameter was found.
33
34 **/
35 MISC_SMBIOS_TABLE_FUNCTION(SystemLanguageString)
36 {
37 EFI_STATUS Status;
38 EFI_SMBIOS_HANDLE SmbiosHandle;
39 SMBIOS_TABLE_TYPE13 *SmbiosRecord;
40 UINTN StrLeng;
41 CHAR8 *OptionalStrStart;
42 EFI_STRING Str;
43 STRING_REF TokenToGet;
44
45
46 //
47 // First check for invalid parameters.
48 //
49 if (RecordData == NULL) {
50 return EFI_INVALID_PARAMETER;
51 }
52
53 TokenToGet = STRING_TOKEN (STR_MISC_SYSTEM_LANGUAGE_STRING);
54 Str = HiiGetPackageString(&gEfiCallerIdGuid, TokenToGet, NULL);
55 StrLeng = StrLen(Str);
56 if (StrLeng > SMBIOS_STRING_MAX_LENGTH) {
57 return EFI_UNSUPPORTED;
58 }
59
60 //
61 // Two zeros following the last string.
62 //
63 SmbiosRecord = AllocatePool(sizeof (SMBIOS_TABLE_TYPE13) + StrLeng + 1 + 1);
64 ZeroMem(SmbiosRecord, sizeof (SMBIOS_TABLE_TYPE13) + StrLeng + 1 + 1);
65
66 SmbiosRecord->Hdr.Type = EFI_SMBIOS_TYPE_BIOS_LANGUAGE_INFORMATION;
67 SmbiosRecord->Hdr.Length = sizeof (SMBIOS_TABLE_TYPE13);
68 //
69 // Make handle chosen by smbios protocol.add automatically.
70 //
71 SmbiosRecord->Hdr.Handle = 0;
72 SmbiosRecord->InstallableLanguages = 1;
73 SmbiosRecord->Flags = 1;
74 SmbiosRecord->CurrentLanguages = 1;
75 OptionalStrStart = (CHAR8 *)(SmbiosRecord + 1);
76 UnicodeStrToAsciiStr(Str, OptionalStrStart);
77
78
79 //
80 // Now we have got the full smbios record, call smbios protocol to add this record.
81 //
82 SmbiosHandle = 0;
83 Status = Smbios-> Add(
84 Smbios,
85 NULL,
86 &SmbiosHandle,
87 (EFI_SMBIOS_TABLE_HEADER *) SmbiosRecord
88 );
89 FreePool(SmbiosRecord);
90 return Status;
91 }
92