1 | /** @file
|
---|
2 | Utility routines used by boot maintenance modules.
|
---|
3 |
|
---|
4 | Copyright (c) 2004 - 2015, Intel Corporation. All rights reserved.<BR>
|
---|
5 | This program and the accompanying materials
|
---|
6 | are licensed and made available under the terms and conditions of the BSD License
|
---|
7 | which accompanies this distribution. The full text of the license may be found at
|
---|
8 | http://opensource.org/licenses/bsd-license.php
|
---|
9 |
|
---|
10 | THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
---|
11 | WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
---|
12 |
|
---|
13 | **/
|
---|
14 |
|
---|
15 | #include "BootMaintenanceManager.h"
|
---|
16 |
|
---|
17 | /**
|
---|
18 | Function deletes the variable specified by VarName and VarGuid.
|
---|
19 |
|
---|
20 | @param VarName A Null-terminated Unicode string that is
|
---|
21 | the name of the vendor's variable.
|
---|
22 |
|
---|
23 | @param VarGuid A unique identifier for the vendor.
|
---|
24 |
|
---|
25 | @retval EFI_SUCCESS The variable was found and removed
|
---|
26 | @retval EFI_UNSUPPORTED The variable store was inaccessible
|
---|
27 | @retval EFI_NOT_FOUND The variable was not found
|
---|
28 |
|
---|
29 | **/
|
---|
30 | EFI_STATUS
|
---|
31 | EfiLibDeleteVariable (
|
---|
32 | IN CHAR16 *VarName,
|
---|
33 | IN EFI_GUID *VarGuid
|
---|
34 | )
|
---|
35 | {
|
---|
36 | return gRT->SetVariable (
|
---|
37 | VarName,
|
---|
38 | VarGuid,
|
---|
39 | 0,
|
---|
40 | 0,
|
---|
41 | NULL
|
---|
42 | );
|
---|
43 | }
|
---|
44 |
|
---|
45 | /**
|
---|
46 | Function is used to determine the number of device path instances
|
---|
47 | that exist in a device path.
|
---|
48 |
|
---|
49 |
|
---|
50 | @param DevicePath A pointer to a device path data structure.
|
---|
51 |
|
---|
52 | @return This function counts and returns the number of device path instances
|
---|
53 | in DevicePath.
|
---|
54 |
|
---|
55 | **/
|
---|
56 | UINTN
|
---|
57 | EfiDevicePathInstanceCount (
|
---|
58 | IN EFI_DEVICE_PATH_PROTOCOL *DevicePath
|
---|
59 | )
|
---|
60 | {
|
---|
61 | UINTN Count;
|
---|
62 | UINTN Size;
|
---|
63 |
|
---|
64 | Count = 0;
|
---|
65 | while (GetNextDevicePathInstance (&DevicePath, &Size) != NULL) {
|
---|
66 | Count += 1;
|
---|
67 | }
|
---|
68 |
|
---|
69 | return Count;
|
---|
70 | }
|
---|
71 |
|
---|
72 | /**
|
---|
73 | Get a string from the Data Hub record based on
|
---|
74 | a device path.
|
---|
75 |
|
---|
76 | @param DevPath The device Path.
|
---|
77 |
|
---|
78 | @return A string located from the Data Hub records based on
|
---|
79 | the device path.
|
---|
80 | @retval NULL If failed to get the String from Data Hub.
|
---|
81 |
|
---|
82 | **/
|
---|
83 | UINT16 *
|
---|
84 | EfiLibStrFromDatahub (
|
---|
85 | IN EFI_DEVICE_PATH_PROTOCOL *DevPath
|
---|
86 | )
|
---|
87 | {
|
---|
88 | return NULL;
|
---|
89 | }
|
---|