]> git.proxmox.com Git - mirror_edk2.git/blame - SecurityPkg/Tcg/Opal/OpalPassword/OpalHiiCallbacks.c
SecurityPkg: Remove dead code and inf redundant definitions.
[mirror_edk2.git] / SecurityPkg / Tcg / Opal / OpalPassword / OpalHiiCallbacks.c
CommitLineData
112e584b
SZ
1/** @file\r
2 Callbacks required by the HII of the Opal UEFI Driver to help display\r
3 Opal device information.\r
4\r
5Copyright (c) 2016 - 2018, Intel Corporation. All rights reserved.<BR>\r
6This program and the accompanying materials\r
7are licensed and made available under the terms and conditions of the BSD License\r
8which accompanies this distribution. The full text of the license may be found at\r
9http://opensource.org/licenses/bsd-license.php\r
10\r
11THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
12WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
13\r
14**/\r
15\r
16#include "OpalHii.h"\r
17\r
112e584b
SZ
18/**\r
19 Get the driver image handle.\r
20\r
21 @retval the driver image handle.\r
22\r
23**/\r
24EFI_HANDLE\r
25HiiGetDriverImageHandleCB(\r
26 VOID\r
27 )\r
28{\r
29 return gImageHandle;\r
30}\r
31\r
112e584b
SZ
32/**\r
33 Returns the opaque pointer to a physical disk context.\r
34\r
35 @param DiskIndex Input the disk index.\r
36\r
37 @retval The device pointer.\r
38\r
39**/\r
40VOID *\r
41HiiGetDiskContextCB(\r
42 UINT8 DiskIndex\r
43 )\r
44{\r
45 OPAL_DRIVER_DEVICE* Dev;\r
46 UINT8 CurrentDisk;\r
47\r
48 Dev = OpalDriverGetDeviceList();\r
49 CurrentDisk = 0;\r
50\r
51 if (DiskIndex >= GetDeviceCount()) {\r
52 return NULL;\r
53 }\r
54\r
55 while (Dev != NULL) {\r
56 if (CurrentDisk == DiskIndex) {\r
57 return Dev;\r
58 } else {\r
59 Dev = Dev->Next;\r
60 CurrentDisk++;\r
61 }\r
62 }\r
63\r
64 return NULL;\r
65}\r
66\r
67/**\r
68 Returns the opaque pointer to a physical disk context.\r
69\r
70 @param DiskIndex Input the disk index.\r
71\r
72 @retval The device pointer.\r
73\r
74**/\r
75OPAL_DISK*\r
76HiiGetOpalDiskCB(\r
77 UINT8 DiskIndex\r
78 )\r
79{\r
80 VOID *Ctx;\r
81 OPAL_DRIVER_DEVICE *Tmp;\r
82\r
83 Ctx = HiiGetDiskContextCB (DiskIndex);\r
84\r
85 if (Ctx == NULL) {\r
86 return NULL;\r
87 }\r
88\r
89 Tmp = (OPAL_DRIVER_DEVICE*) Ctx;\r
90\r
91 return &Tmp->OpalDisk;\r
92}\r
93\r
94/**\r
95 Returns the disk name.\r
96\r
97 @param DiskIndex Input the disk index.\r
98\r
99 @retval Returns the disk name.\r
100\r
101**/\r
102CHAR8*\r
103HiiDiskGetNameCB(\r
104 UINT8 DiskIndex\r
105 )\r
106{\r
107 OPAL_DRIVER_DEVICE* Ctx;\r
108\r
109 Ctx = (OPAL_DRIVER_DEVICE*) HiiGetDiskContextCB (DiskIndex);\r
110\r
111 if (Ctx != NULL) {\r
112 if (Ctx->NameZ == NULL) {\r
113 OpalDriverGetDriverDeviceName (Ctx);\r
114 }\r
115 return Ctx->NameZ;\r
116 }\r
117 return NULL;\r
118}\r
119\r
120/**\r
121 Returns the driver name.\r
122\r
123 @retval Returns the driver name.\r
124\r
125**/\r
126CHAR16*\r
127HiiGetDriverNameCB(\r
128 VOID\r
129 )\r
130{\r
131 return (CHAR16*)EFI_DRIVER_NAME_UNICODE;\r
132}\r