]> git.proxmox.com Git - mirror_edk2.git/blame - Nt32Pkg/MiscSubClassPlatformDxe/MiscOemStringFunction.c
1. PI SMBIOS Checkin. Major change include:
[mirror_edk2.git] / Nt32Pkg / MiscSubClassPlatformDxe / MiscOemStringFunction.c
CommitLineData
1fdd39d3 1/*++\r
2\r
3Copyright (c) 2009, Intel Corporation. All rights reserved. <BR> \r
4This software and associated documentation (if any) is furnished\r
5under a license and may only be used or copied in accordance\r
6with the terms of the license. Except as permitted by such\r
7license, no part of this software or documentation may be\r
8reproduced, stored in a retrieval system, or transmitted in any\r
9form or by any means without the express written consent of\r
10Intel Corporation.\r
11\r
12Module Name:\r
13\r
14 MiscOemStringFunction.c\r
15 \r
16Abstract: \r
17\r
18 boot information boot time changes.\r
19 SMBIOS type 11.\r
20\r
21--*/\r
22\r
23\r
24#include "MiscSubclassDriver.h"\r
25/**\r
26 This function makes boot time changes to the contents of the\r
27 MiscOemString (Type 11).\r
28\r
29 @param RecordData Pointer to copy of RecordData from the Data Table. \r
30\r
31 @retval EFI_SUCCESS All parameters were valid.\r
32 @retval EFI_UNSUPPORTED Unexpected RecordType value.\r
33 @retval EFI_INVALID_PARAMETER Invalid parameter was found.\r
34\r
35**/\r
36MISC_SMBIOS_TABLE_FUNCTION(OemString)\r
37{\r
38 UINTN OemStrLen;\r
39 CHAR8 *OptionalStrStart;\r
40 EFI_STATUS Status;\r
41 EFI_STRING OemStr;\r
42 STRING_REF TokenToGet;\r
43 EFI_SMBIOS_HANDLE SmbiosHandle;\r
44 SMBIOS_TABLE_TYPE11 *SmbiosRecord;\r
45\r
46 //\r
47 // First check for invalid parameters.\r
48 //\r
49 if (RecordData == NULL) {\r
50 return EFI_INVALID_PARAMETER;\r
51 }\r
52\r
53 TokenToGet = STRING_TOKEN (STR_MISC_OEM_STRING);\r
54 OemStr = HiiGetPackageString(&gEfiCallerIdGuid, TokenToGet, NULL);\r
55 OemStrLen = StrLen(OemStr);\r
56 if (OemStrLen > SMBIOS_STRING_MAX_LENGTH) {\r
57 return EFI_UNSUPPORTED;\r
58 }\r
59\r
60 //\r
61 // Two zeros following the last string.\r
62 //\r
63 SmbiosRecord = AllocatePool(sizeof (SMBIOS_TABLE_TYPE11) + OemStrLen + 1 + 1);\r
64 ZeroMem(SmbiosRecord, sizeof (SMBIOS_TABLE_TYPE11) + OemStrLen + 1 + 1);\r
65\r
66 SmbiosRecord->Hdr.Type = EFI_SMBIOS_TYPE_OEM_STRINGS;\r
67 SmbiosRecord->Hdr.Length = sizeof (SMBIOS_TABLE_TYPE11);\r
68 //\r
69 // Make handle chosen by smbios protocol.add automatically.\r
70 // \r
71 SmbiosRecord->Hdr.Handle = 0; \r
72 SmbiosRecord->StringCount = 1;\r
73 OptionalStrStart = (CHAR8 *)(SmbiosRecord + 1);\r
74 UnicodeStrToAsciiStr(OemStr, OptionalStrStart);\r
75\r
76 //\r
77 // Now we have got the full smbios record, call smbios protocol to add this record.\r
78 //\r
79 SmbiosHandle = 0;\r
80 Status = Smbios-> Add(\r
81 Smbios, \r
82 NULL,\r
83 &SmbiosHandle, \r
84 (EFI_SMBIOS_TABLE_HEADER *) SmbiosRecord\r
85 );\r
86 FreePool(SmbiosRecord);\r
87 return Status;\r
88}\r