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