]> git.proxmox.com Git - mirror_edk2.git/blob - MdeModulePkg/Library/BootMaintenanceManagerUiLib/BmLib.c
MdeModulePkg: Replace BSD License with BSD+Patent License
[mirror_edk2.git] / MdeModulePkg / Library / BootMaintenanceManagerUiLib / BmLib.c
1 /** @file
2 Utility routines used by boot maintenance modules.
3
4 Copyright (c) 2004 - 2018, Intel Corporation. All rights reserved.<BR>
5 SPDX-License-Identifier: BSD-2-Clause-Patent
6
7 **/
8
9 #include "BootMaintenanceManager.h"
10
11 /**
12 Function deletes the variable specified by VarName and VarGuid.
13
14 @param VarName A Null-terminated Unicode string that is
15 the name of the vendor's variable.
16
17 @param VarGuid A unique identifier for the vendor.
18
19 @retval EFI_SUCCESS The variable was found and removed
20 @retval EFI_UNSUPPORTED The variable store was inaccessible
21 @retval EFI_NOT_FOUND The variable was not found
22
23 **/
24 EFI_STATUS
25 EfiLibDeleteVariable (
26 IN CHAR16 *VarName,
27 IN EFI_GUID *VarGuid
28 )
29 {
30 return gRT->SetVariable (
31 VarName,
32 VarGuid,
33 0,
34 0,
35 NULL
36 );
37 }
38
39 /**
40 Function is used to determine the number of device path instances
41 that exist in a device path.
42
43
44 @param DevicePath A pointer to a device path data structure.
45
46 @return This function counts and returns the number of device path instances
47 in DevicePath.
48
49 **/
50 UINTN
51 EfiDevicePathInstanceCount (
52 IN EFI_DEVICE_PATH_PROTOCOL *DevicePath
53 )
54 {
55 UINTN Count;
56 UINTN Size;
57
58 Count = 0;
59 while (GetNextDevicePathInstance (&DevicePath, &Size) != NULL) {
60 Count += 1;
61 }
62
63 return Count;
64 }
65
66 /**
67 Get a string from the Data Hub record based on
68 a device path.
69
70 @param DevPath The device Path.
71
72 @return A string located from the Data Hub records based on
73 the device path.
74 @retval NULL If failed to get the String from Data Hub.
75
76 **/
77 UINT16 *
78 EfiLibStrFromDatahub (
79 IN EFI_DEVICE_PATH_PROTOCOL *DevPath
80 )
81 {
82 return NULL;
83 }