]> git.proxmox.com Git - mirror_edk2.git/blame - MdePkg/Library/UefiLib/UefiLib.c
1) Clean up MdePkg/Include/Common/BootScript.h and remove boot script definition...
[mirror_edk2.git] / MdePkg / Library / UefiLib / UefiLib.c
CommitLineData
878ddf1f 1/** @file\r
2 Mde UEFI library functions.\r
3\r
4 Copyright (c) 2006, Intel Corporation<BR>\r
5 All rights reserved. This program and the accompanying materials \r
6 are licensed and made available under the terms and conditions of the BSD License \r
7 which accompanies this distribution. The full text of the license may be found at \r
8 http://opensource.org/licenses/bsd-license.php \r
9\r
10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, \r
11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. \r
12\r
13 Module Name: UefiLib.c\r
14\r
15**/\r
16\r
17/**\r
18 Compare whether two names of languages are identical.\r
19\r
20 @param Language1 Name of language 1.\r
21 @param Language2 Name of language 2.\r
22\r
23 @retval TRUE Language 1 and language 2 are the same.\r
24 @retval FALSE Language 1 and language 2 are not the same.\r
25\r
26**/\r
27BOOLEAN\r
28CompareIso639LanguageCode (\r
29 IN CONST CHAR8 *Language1,\r
30 IN CONST CHAR8 *Language2\r
31 )\r
32{\r
33 return (BOOLEAN) (ReadUnaligned24 ((CONST UINT32 *) Language1) == ReadUnaligned24 ((CONST UINT32 *) Language2));\r
34}\r
35\r
36/**\r
37 This function searches the list of configuration tables stored in the EFI System \r
38 Table for a table with a GUID that matches TableGuid. If a match is found, \r
39 then a pointer to the configuration table is returned in Table, and EFI_SUCCESS \r
40 is returned. If a matching GUID is not found, then EFI_NOT_FOUND is returned.\r
41\r
42 @param TableGuid Pointer to table's GUID type..\r
43 @param Table Pointer to the table associated with TableGuid in the EFI System Table.\r
44\r
45 @retval EFI_SUCCESS A configuration table matching TableGuid was found.\r
46 @retval EFI_NOT_FOUND A configuration table matching TableGuid could not be found.\r
47\r
48**/\r
49EFI_STATUS\r
50EFIAPI\r
51EfiGetSystemConfigurationTable ( \r
52 IN EFI_GUID *TableGuid,\r
53 OUT VOID **Table\r
54 )\r
55{\r
56 EFI_SYSTEM_TABLE *SystemTable;\r
57 UINTN Index;\r
58\r
59 ASSERT (TableGuid != NULL);\r
60 ASSERT (Table != NULL);\r
61\r
62 SystemTable = gST;\r
63 *Table = NULL;\r
64 for (Index = 0; Index < SystemTable->NumberOfTableEntries; Index++) {\r
65 if (CompareGuid (TableGuid, &(SystemTable->ConfigurationTable[Index].VendorGuid))) {\r
66 *Table = SystemTable->ConfigurationTable[Index].VendorTable;\r
67 return EFI_SUCCESS;\r
68 }\r
69 }\r
70\r
71 return EFI_NOT_FOUND;\r
72}\r
73\r
74/**\r
75 This function causes the notification function to be executed for every protocol \r
76 of type ProtocolGuid instance that exists in the system when this function is \r
77 invoked. In addition, every time a protocol of type ProtocolGuid instance is \r
78 installed or reinstalled, the notification function is also executed.\r
79\r
80 @param ProtocolGuid Supplies GUID of the protocol upon whose installation the event is fired.\r
81 @param NotifyTpl Supplies the task priority level of the event notifications.\r
82 @param NotifyFunction Supplies the function to notify when the event is signaled.\r
83 @param NotifyContext The context parameter to pass to NotifyFunction.\r
84 @param Registration A pointer to a memory location to receive the registration value.\r
85\r
86 @return The notification event that was created. \r
87\r
88**/\r
89EFI_EVENT\r
90EFIAPI\r
91EfiCreateProtocolNotifyEvent(\r
92 IN EFI_GUID *ProtocolGuid,\r
93 IN EFI_TPL NotifyTpl,\r
94 IN EFI_EVENT_NOTIFY NotifyFunction,\r
95 IN VOID *NotifyContext, OPTIONAL\r
f2df6a00 96 OUT VOID **Registration\r
878ddf1f 97 )\r
98{\r
99 EFI_STATUS Status;\r
100 EFI_EVENT Event;\r
101\r
102 //\r
103 // Create the event\r
104 //\r
105\r
106 Status = gBS->CreateEvent (\r
107 EFI_EVENT_NOTIFY_SIGNAL,\r
108 NotifyTpl,\r
109 NotifyFunction,\r
110 NotifyContext,\r
111 &Event\r
112 );\r
113 ASSERT_EFI_ERROR (Status);\r
114\r
115 //\r
116 // Register for protocol notifactions on this event\r
117 //\r
118\r
119 Status = gBS->RegisterProtocolNotify (\r
120 ProtocolGuid,\r
121 Event,\r
122 Registration\r
123 );\r
124\r
125 ASSERT_EFI_ERROR (Status);\r
126\r
127 //\r
128 // Kick the event so we will perform an initial pass of\r
129 // current installed drivers\r
130 //\r
131\r
132 gBS->SignalEvent (Event);\r
133 return Event;\r
134}\r
135\r
136/**\r
137 This function creates an event using NotifyTpl, NoifyFunction, and NotifyContext.\r
138 This event is signaled with EfiNamedEventSignal(). This provide the ability for \r
139 one or more listeners on the same event named by the GUID specified by Name.\r
140\r
141 @param Name Supplies GUID name of the event.\r
142 @param NotifyTpl Supplies the task priority level of the event notifications.\r
143 @param NotifyFunction Supplies the function to notify when the event is signaled.\r
144 @param NotifyContext The context parameter to pass to NotifyFunction. \r
145 @param Registration A pointer to a memory location to receive the registration value.\r
146\r
147 @retval EFI_SUCCESS A named event was created.\r
148 @retval EFI_OUT_OF_RESOURCES There are not enough resource to create the named event.\r
149\r
150**/\r
151EFI_STATUS\r
152EFIAPI\r
153EfiNamedEventListen (\r
154 IN CONST EFI_GUID *Name,\r
155 IN EFI_TPL NotifyTpl,\r
156 IN EFI_EVENT_NOTIFY NotifyFunction,\r
157 IN CONST VOID *NotifyContext, OPTIONAL\r
13c84604 158 OUT VOID *Registration OPTIONAL\r
878ddf1f 159 )\r
160{\r
161 EFI_STATUS Status;\r
162 EFI_EVENT Event;\r
163 VOID *RegistrationLocal;\r
164\r
165 //\r
166 // Create event\r
167 //\r
168 Status = gBS->CreateEvent (\r
169 EFI_EVENT_NOTIFY_SIGNAL,\r
170 NotifyTpl,\r
171 NotifyFunction,\r
172 (VOID *) NotifyContext,\r
173 &Event\r
174 );\r
175 ASSERT_EFI_ERROR (Status);\r
176\r
177 //\r
178 // The Registration is not optional to RegisterProtocolNotify().\r
179 // To make it optional to EfiNamedEventListen(), may need to substitute with a local.\r
180 //\r
181 if (Registration != NULL) {\r
182 RegistrationLocal = Registration;\r
183 } else {\r
184 RegistrationLocal = &RegistrationLocal;\r
185 }\r
186\r
187 //\r
188 // Register for an installation of protocol interface\r
189 //\r
190\r
191 Status = gBS->RegisterProtocolNotify (\r
192 (EFI_GUID *) Name,\r
193 Event,\r
194 RegistrationLocal\r
195 );\r
196 ASSERT_EFI_ERROR (Status);\r
197\r
198 return EFI_SUCCESS;\r
199}\r
200\r
201/**\r
202 This function signals the named event specified by Name. The named event must \r
203 have been created with EfiNamedEventListen().\r
204\r
205 @param Name Supplies GUID name of the event.\r
206\r
207 @retval EFI_SUCCESS A named event was signaled.\r
208 @retval EFI_OUT_OF_RESOURCES There are not enough resource to signal the named event.\r
209\r
210**/\r
211EFI_STATUS\r
212EFIAPI\r
213EfiNamedEventSignal (\r
214 IN CONST EFI_GUID *Name\r
215 )\r
216{\r
217 EFI_STATUS Status;\r
218 EFI_HANDLE Handle;\r
219\r
220 Handle = NULL;\r
221 Status = gBS->InstallProtocolInterface (\r
222 &Handle,\r
223 (EFI_GUID *) Name,\r
224 EFI_NATIVE_INTERFACE,\r
225 NULL\r
226 );\r
227 ASSERT_EFI_ERROR (Status);\r
228\r
229 Status = gBS->UninstallProtocolInterface (\r
230 Handle,\r
231 (EFI_GUID *) Name,\r
232 NULL\r
233 );\r
234 ASSERT_EFI_ERROR (Status);\r
235\r
236 return EFI_SUCCESS;\r
237}\r
238\r
239\r
240/**\r
241 This function initializes a basic mutual exclusion lock to the released state \r
242 and returns the lock. Each lock provides mutual exclusion access at its task \r
243 priority level. Since there is no preemption or multiprocessor support in EFI,\r
244 acquiring the lock only consists of raising to the locks TPL.\r
245\r
246 @param Lock A pointer to the lock data structure to initialize.\r
247 @param Priority EFI TPL associated with the lock.\r
248\r
249 @return The lock.\r
250\r
251**/\r
252EFI_LOCK *\r
253EFIAPI\r
254EfiInitializeLock (\r
255 IN OUT EFI_LOCK *Lock,\r
256 IN EFI_TPL Priority\r
257 )\r
258{\r
259 ASSERT (Lock != NULL);\r
260 ASSERT (Priority <= EFI_TPL_HIGH_LEVEL);\r
261\r
262 Lock->Tpl = Priority;\r
263 Lock->OwnerTpl = EFI_TPL_APPLICATION;\r
264 Lock->Lock = EfiLockReleased ;\r
265 return Lock;\r
266}\r
267\r
268/**\r
511710d6 269 This function raises the system's current task priority level to the task \r
878ddf1f 270 priority level of the mutual exclusion lock. Then, it places the lock in the \r
271 acquired state.\r
272\r
273 @param Priority The task priority level of the lock.\r
274\r
275**/\r
276VOID\r
277EFIAPI\r
278EfiAcquireLock (\r
279 IN EFI_LOCK *Lock\r
280 )\r
281{\r
282 ASSERT (Lock != NULL);\r
283 ASSERT (Lock->Lock == EfiLockReleased);\r
284\r
285 Lock->OwnerTpl = gBS->RaiseTPL (Lock->Tpl);\r
286 Lock->Lock = EfiLockAcquired;\r
287}\r
288\r
289/**\r
511710d6 290 This function raises the system's current task priority level to the task \r
878ddf1f 291 priority level of the mutual exclusion lock. Then, it attempts to place the \r
292 lock in the acquired state.\r
293\r
294 @param Lock A pointer to the lock to acquire.\r
295\r
296 @retval EFI_SUCCESS The lock was acquired.\r
297 @retval EFI_ACCESS_DENIED The lock could not be acquired because it is already owned.\r
298\r
299**/\r
300EFI_STATUS\r
301EFIAPI\r
302EfiAcquireLockOrFail (\r
303 IN EFI_LOCK *Lock\r
304 )\r
305{\r
306\r
307 ASSERT (Lock != NULL);\r
308 ASSERT (Lock->Lock != EfiLockUninitialized);\r
309\r
310 if (Lock->Lock == EfiLockAcquired) {\r
311 //\r
312 // Lock is already owned, so bail out\r
313 //\r
314 return EFI_ACCESS_DENIED;\r
315 }\r
316\r
317 Lock->OwnerTpl = gBS->RaiseTPL (Lock->Tpl);\r
318\r
319 Lock->Lock = EfiLockAcquired;\r
320\r
321 return EFI_SUCCESS;\r
322}\r
323\r
324/**\r
325 This function transitions a mutual exclusion lock from the acquired state to \r
511710d6 326 the released state, and restores the system's task priority level to its \r
878ddf1f 327 previous level.\r
328\r
329 @param Lock A pointer to the lock to release.\r
330\r
331**/\r
332VOID\r
333EFIAPI\r
334EfiReleaseLock (\r
335 IN EFI_LOCK *Lock\r
336 )\r
337{\r
338 EFI_TPL Tpl;\r
339\r
340 ASSERT (Lock != NULL);\r
341 ASSERT (Lock->Lock == EfiLockAcquired);\r
342\r
343 Tpl = Lock->OwnerTpl;\r
344 \r
345 Lock->Lock = EfiLockReleased;\r
346\r
347 gBS->RestoreTPL (Tpl);\r
348}\r
349\r
350/**\r
351 This function looks up a Unicode string in UnicodeStringTable. If Language is \r
352 a member of SupportedLanguages and a Unicode string is found in UnicodeStringTable\r
353 that matches the language code specified by Language, then it is returned in \r
354 UnicodeString.\r
355\r
356 @param Language A pointer to the ISO 639-2 language code for the \r
357 Unicode string to look up and return.\r
358 @param SupportedLanguages A pointer to the set of ISO 639-2 language codes \r
359 that the Unicode string table supports. Language \r
360 must be a member of this set.\r
361 @param UnicodeStringTable A pointer to the table of Unicode strings.\r
362 @param UnicodeString A pointer to the Unicode string from UnicodeStringTable\r
363 that matches the language specified by Language.\r
364\r
365 @retval EFI_SUCCESS The Unicode string that matches the language \r
366 specified by Language was found\r
367 in the table of Unicoide strings UnicodeStringTable, \r
368 and it was returned in UnicodeString.\r
369 @retval EFI_INVALID_PARAMETER Language is NULL.\r
370 @retval EFI_INVALID_PARAMETER UnicodeString is NULL.\r
371 @retval EFI_UNSUPPORTED SupportedLanguages is NULL.\r
372 @retval EFI_UNSUPPORTED UnicodeStringTable is NULL.\r
373 @retval EFI_UNSUPPORTED The language specified by Language is not a \r
374 member of SupportedLanguages.\r
375 @retval EFI_UNSUPPORTED The language specified by Language is not \r
376 supported by UnicodeStringTable.\r
377\r
378**/\r
379EFI_STATUS\r
380EFIAPI\r
381LookupUnicodeString (\r
382 IN CONST CHAR8 *Language,\r
383 IN CONST CHAR8 *SupportedLanguages,\r
384 IN CONST EFI_UNICODE_STRING_TABLE *UnicodeStringTable,\r
385 OUT CHAR16 **UnicodeString\r
386 )\r
387{\r
388 //\r
389 // Make sure the parameters are valid\r
390 //\r
391 if (Language == NULL || UnicodeString == NULL) {\r
392 return EFI_INVALID_PARAMETER;\r
393 }\r
394\r
395 //\r
396 // If there are no supported languages, or the Unicode String Table is empty, then the\r
397 // Unicode String specified by Language is not supported by this Unicode String Table\r
398 //\r
399 if (SupportedLanguages == NULL || UnicodeStringTable == NULL) {\r
400 return EFI_UNSUPPORTED;\r
401 }\r
402\r
403 //\r
404 // Make sure Language is in the set of Supported Languages\r
405 //\r
406 while (*SupportedLanguages != 0) {\r
407 if (CompareIso639LanguageCode (Language, SupportedLanguages)) {\r
408\r
409 //\r
410 // Search the Unicode String Table for the matching Language specifier\r
411 //\r
412 while (UnicodeStringTable->Language != NULL) {\r
413 if (CompareIso639LanguageCode (Language, UnicodeStringTable->Language)) {\r
414\r
415 //\r
416 // A matching string was found, so return it\r
417 //\r
418 *UnicodeString = UnicodeStringTable->UnicodeString;\r
419 return EFI_SUCCESS;\r
420 }\r
421\r
422 UnicodeStringTable++;\r
423 }\r
424\r
425 return EFI_UNSUPPORTED;\r
426 }\r
427\r
428 SupportedLanguages += 3;\r
429 }\r
430\r
431 return EFI_UNSUPPORTED;\r
432}\r
433\r
434/**\r
435 This function adds a Unicode string to UnicodeStringTable.\r
436 If Language is a member of SupportedLanguages then UnicodeString is added to \r
437 UnicodeStringTable. New buffers are allocated for both Language and \r
438 UnicodeString. The contents of Language and UnicodeString are copied into \r
439 these new buffers. These buffers are automatically freed when \r
440 FreeUnicodeStringTable() is called.\r
441\r
442 @param Language A pointer to the ISO 639-2 language code for the Unicode \r
443 string to add.\r
444 @param SupportedLanguages A pointer to the set of ISO 639-2 language codes\r
445 that the Unicode string table supports.\r
446 Language must be a member of this set.\r
447 @param UnicodeStringTable A pointer to the table of Unicode strings.\r
448 @param UnicodeString A pointer to the Unicode string to add.\r
449\r
450 @retval EFI_SUCCESS The Unicode string that matches the language \r
451 specified by Language was found in the table of \r
452 Unicode strings UnicodeStringTable, and it was \r
453 returned in UnicodeString.\r
454 @retval EFI_INVALID_PARAMETER Language is NULL.\r
455 @retval EFI_INVALID_PARAMETER UnicodeString is NULL.\r
456 @retval EFI_INVALID_PARAMETER UnicodeString is an empty string.\r
457 @retval EFI_UNSUPPORTED SupportedLanguages is NULL.\r
458 @retval EFI_ALREADY_STARTED A Unicode string with language Language is \r
459 already present in UnicodeStringTable.\r
460 @retval EFI_OUT_OF_RESOURCES There is not enough memory to add another \r
461 Unicode string to UnicodeStringTable.\r
462 @retval EFI_UNSUPPORTED The language specified by Language is not a \r
463 member of SupportedLanguages.\r
464\r
465**/\r
466EFI_STATUS\r
467EFIAPI\r
468AddUnicodeString (\r
469 IN CONST CHAR8 *Language,\r
470 IN CONST CHAR8 *SupportedLanguages,\r
471 IN EFI_UNICODE_STRING_TABLE **UnicodeStringTable,\r
472 IN CONST CHAR16 *UnicodeString\r
473 )\r
474{\r
475 UINTN NumberOfEntries;\r
476 EFI_UNICODE_STRING_TABLE *OldUnicodeStringTable;\r
477 EFI_UNICODE_STRING_TABLE *NewUnicodeStringTable;\r
478 UINTN UnicodeStringLength;\r
479\r
480 //\r
481 // Make sure the parameter are valid\r
482 //\r
483 if (Language == NULL || UnicodeString == NULL || UnicodeStringTable == NULL) {\r
484 return EFI_INVALID_PARAMETER;\r
485 }\r
486\r
487 //\r
488 // If there are no supported languages, then a Unicode String can not be added\r
489 //\r
490 if (SupportedLanguages == NULL) {\r
491 return EFI_UNSUPPORTED;\r
492 }\r
493\r
494 //\r
495 // If the Unicode String is empty, then a Unicode String can not be added\r
496 //\r
497 if (UnicodeString[0] == 0) {\r
498 return EFI_INVALID_PARAMETER;\r
499 }\r
500\r
501 //\r
502 // Make sure Language is a member of SupportedLanguages\r
503 //\r
504 while (*SupportedLanguages != 0) {\r
505 if (CompareIso639LanguageCode (Language, SupportedLanguages)) {\r
506\r
507 //\r
508 // Determine the size of the Unicode String Table by looking for a NULL Language entry\r
509 //\r
510 NumberOfEntries = 0;\r
511 if (*UnicodeStringTable != NULL) {\r
512 OldUnicodeStringTable = *UnicodeStringTable;\r
513 while (OldUnicodeStringTable->Language != NULL) {\r
514 if (CompareIso639LanguageCode (Language, OldUnicodeStringTable->Language)) {\r
515 return EFI_ALREADY_STARTED;\r
516 }\r
517\r
518 OldUnicodeStringTable++;\r
519 NumberOfEntries++;\r
520 }\r
521 }\r
522\r
523 //\r
524 // Allocate space for a new Unicode String Table. It must hold the current number of\r
525 // entries, plus 1 entry for the new Unicode String, plus 1 entry for the end of table\r
526 // marker\r
527 //\r
528 NewUnicodeStringTable = AllocatePool ((NumberOfEntries + 2) * sizeof (EFI_UNICODE_STRING_TABLE));\r
529 if (NewUnicodeStringTable == NULL) {\r
530 return EFI_OUT_OF_RESOURCES;\r
531 }\r
532\r
533 //\r
534 // If the current Unicode String Table contains any entries, then copy them to the\r
535 // newly allocated Unicode String Table.\r
536 //\r
537 if (*UnicodeStringTable != NULL) {\r
538 CopyMem (\r
539 NewUnicodeStringTable,\r
540 *UnicodeStringTable,\r
541 NumberOfEntries * sizeof (EFI_UNICODE_STRING_TABLE)\r
542 );\r
543 }\r
544\r
545 //\r
546 // Allocate space for a copy of the Language specifier\r
547 //\r
548 NewUnicodeStringTable[NumberOfEntries].Language = AllocateCopyPool (3, Language);\r
549 if (NewUnicodeStringTable[NumberOfEntries].Language == NULL) {\r
550 gBS->FreePool (NewUnicodeStringTable);\r
551 return EFI_OUT_OF_RESOURCES;\r
552 }\r
553\r
554 //\r
555 // Compute the length of the Unicode String\r
556 //\r
557 for (UnicodeStringLength = 0; UnicodeString[UnicodeStringLength] != 0; UnicodeStringLength++)\r
558 ;\r
559\r
560 //\r
561 // Allocate space for a copy of the Unicode String\r
562 //\r
563 NewUnicodeStringTable[NumberOfEntries].UnicodeString = AllocateCopyPool (\r
564 (UnicodeStringLength + 1) * sizeof (CHAR16),\r
565 UnicodeString\r
566 );\r
567 if (NewUnicodeStringTable[NumberOfEntries].UnicodeString == NULL) {\r
568 gBS->FreePool (NewUnicodeStringTable[NumberOfEntries].Language);\r
569 gBS->FreePool (NewUnicodeStringTable);\r
570 return EFI_OUT_OF_RESOURCES;\r
571 }\r
572\r
573 //\r
574 // Mark the end of the Unicode String Table\r
575 //\r
576 NewUnicodeStringTable[NumberOfEntries + 1].Language = NULL;\r
577 NewUnicodeStringTable[NumberOfEntries + 1].UnicodeString = NULL;\r
578\r
579 //\r
580 // Free the old Unicode String Table\r
581 //\r
582 if (*UnicodeStringTable != NULL) {\r
583 gBS->FreePool (*UnicodeStringTable);\r
584 }\r
585\r
586 //\r
587 // Point UnicodeStringTable at the newly allocated Unicode String Table\r
588 //\r
589 *UnicodeStringTable = NewUnicodeStringTable;\r
590\r
591 return EFI_SUCCESS;\r
592 }\r
593\r
594 SupportedLanguages += 3;\r
595 }\r
596\r
597 return EFI_UNSUPPORTED;\r
598}\r
599\r
600/**\r
601 This function frees the table of Unicode strings in UnicodeStringTable.\r
602 If UnicodeStringTable is NULL, then EFI_SUCCESS is returned.\r
603 Otherwise, each language code, and each Unicode string in the Unicode string \r
604 table are freed, and EFI_SUCCESS is returned.\r
605\r
606 @param UnicodeStringTable A pointer to the table of Unicode strings.\r
607\r
608 @retval EFI_SUCCESS The Unicode string table was freed.\r
609\r
610**/\r
611EFI_STATUS\r
612EFIAPI\r
613FreeUnicodeStringTable (\r
614 IN EFI_UNICODE_STRING_TABLE *UnicodeStringTable\r
615 )\r
616{\r
617 UINTN Index;\r
618\r
619 //\r
620 // If the Unicode String Table is NULL, then it is already freed\r
621 //\r
622 if (UnicodeStringTable == NULL) {\r
623 return EFI_SUCCESS;\r
624 }\r
625\r
626 //\r
627 // Loop through the Unicode String Table until we reach the end of table marker\r
628 //\r
629 for (Index = 0; UnicodeStringTable[Index].Language != NULL; Index++) {\r
630\r
631 //\r
632 // Free the Language string from the Unicode String Table\r
633 //\r
634 gBS->FreePool (UnicodeStringTable[Index].Language);\r
635\r
636 //\r
637 // Free the Unicode String from the Unicode String Table\r
638 //\r
639 if (UnicodeStringTable[Index].UnicodeString != NULL) {\r
640 gBS->FreePool (UnicodeStringTable[Index].UnicodeString);\r
641 }\r
642 }\r
643\r
644 //\r
645 // Free the Unicode String Table itself\r
646 //\r
647 gBS->FreePool (UnicodeStringTable);\r
648\r
649 return EFI_SUCCESS;\r
650}\r