]> git.proxmox.com Git - mirror_edk2.git/blame - MdeModulePkg/Library/ExtendedHiiLib/ExtendedHiiLib.c
Update all files to follow doxygen style file header.
[mirror_edk2.git] / MdeModulePkg / Library / ExtendedHiiLib / ExtendedHiiLib.c
CommitLineData
9226efe5 1/** @file\r
2 HII Library implementation that uses DXE protocols and services.\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**/\r
14\r
15\r
16#include <PiDxe.h>\r
17\r
18#include <Protocol/DevicePath.h>\r
19\r
20#include <Library/BaseMemoryLib.h>\r
21#include <Library/DebugLib.h>\r
22#include <Library/MemoryAllocationLib.h>\r
23#include <Library/UefiBootServicesTableLib.h>\r
24#include <MdeModuleHii.h>\r
25\r
26\r
27//\r
28// Hii vendor device path template\r
29//\r
30HII_VENDOR_DEVICE_PATH mHiiVendorDevicePathTemplate = {\r
31 {\r
32 {\r
33 {\r
34 HARDWARE_DEVICE_PATH,\r
35 HW_VENDOR_DP,\r
36 {\r
37 (UINT8) (sizeof (HII_VENDOR_DEVICE_PATH_NODE)),\r
38 (UINT8) ((sizeof (HII_VENDOR_DEVICE_PATH_NODE)) >> 8)\r
39 }\r
40 },\r
41 EFI_IFR_TIANO_GUID\r
42 },\r
43 0\r
44 },\r
45 {\r
46 END_DEVICE_PATH_TYPE,\r
47 END_ENTIRE_DEVICE_PATH_SUBTYPE,\r
48 { \r
49 END_DEVICE_PATH_LENGTH\r
50 }\r
51 }\r
52};\r
53\r
54\r
55EFI_STATUS\r
56EFIAPI\r
57HiiLibCreateHiiDriverHandle (\r
58 OUT EFI_HANDLE *DriverHandle\r
59 )\r
60{\r
61 EFI_STATUS Status;\r
62 HII_VENDOR_DEVICE_PATH_NODE *VendorDevicePath;\r
63 UINT64 MonotonicCount;\r
64\r
65 VendorDevicePath = AllocateCopyPool (sizeof (HII_VENDOR_DEVICE_PATH), &mHiiVendorDevicePathTemplate);\r
66 if (VendorDevicePath == NULL) {\r
67 return EFI_OUT_OF_RESOURCES;\r
68 }\r
69\r
70 gBS->GetNextMonotonicCount (&MonotonicCount);\r
71 VendorDevicePath->MonotonicCount = (UINT32) MonotonicCount;\r
72\r
73 *DriverHandle = NULL;\r
74 Status = gBS->InstallProtocolInterface (\r
75 DriverHandle,\r
76 &gEfiDevicePathProtocolGuid,\r
77 EFI_NATIVE_INTERFACE,\r
78 VendorDevicePath\r
79 );\r
80 if (EFI_ERROR (Status)) {\r
81 return Status;\r
82 }\r
83\r
84 return EFI_SUCCESS;\r
85}\r
86\r
87\r
88VOID\r
89EFIAPI\r
90HiiLibDestroyHiiDriverHandle (\r
91 IN EFI_HANDLE DriverHandle\r
92 )\r
93{\r
94 EFI_STATUS Status;\r
95 EFI_DEVICE_PATH_PROTOCOL *DevicePath;\r
96\r
97 Status = gBS->HandleProtocol (\r
98 DriverHandle,\r
99 &gEfiDevicePathProtocolGuid,\r
100 (VOID **) &DevicePath\r
101 );\r
102 ASSERT_EFI_ERROR (Status);\r
103\r
104 Status = gBS->UninstallProtocolInterface (\r
105 DriverHandle,\r
106 &gEfiDevicePathProtocolGuid,\r
107 DevicePath\r
108 );\r
109 ASSERT_EFI_ERROR (Status);\r
110\r
111 FreePool (DevicePath);\r
112\r
113}\r
114\r
115\r
116\r