VirtualBox

source: vbox/trunk/src/VBox/Devices/EFI/FirmwareNew/OvmfPkg/XenPvBlkDxe/ComponentName.c@ 99404

最後變更 在這個檔案從99404是 99404,由 vboxsync 提交於 20 月 前

Devices/EFI/FirmwareNew: Update to edk2-stable202302 and make it build, bugref:4643

  • 屬性 svn:eol-style 設為 native
檔案大小: 6.4 KB
 
1/** @file
2 Component Name functions implementation for XenPvBlk driver.
3
4 Copyright (C) 2014, Citrix Ltd.
5
6 SPDX-License-Identifier: BSD-2-Clause-Patent
7
8**/
9
10#include "XenPvBlkDxe.h"
11
12///
13/// Component Name Protocol instance
14///
15GLOBAL_REMOVE_IF_UNREFERENCED
16EFI_COMPONENT_NAME_PROTOCOL gXenPvBlkDxeComponentName = {
17 (EFI_COMPONENT_NAME_GET_DRIVER_NAME)XenPvBlkDxeComponentNameGetDriverName,
18 (EFI_COMPONENT_NAME_GET_CONTROLLER_NAME)XenPvBlkDxeComponentNameGetControllerName,
19 "eng"
20};
21
22///
23/// Component Name 2 Protocol instance
24///
25GLOBAL_REMOVE_IF_UNREFERENCED
26EFI_COMPONENT_NAME2_PROTOCOL gXenPvBlkDxeComponentName2 = {
27 XenPvBlkDxeComponentNameGetDriverName,
28 XenPvBlkDxeComponentNameGetControllerName,
29 "en"
30};
31
32///
33/// Table of driver names
34///
35GLOBAL_REMOVE_IF_UNREFERENCED
36EFI_UNICODE_STRING_TABLE mXenPvBlkDxeDriverNameTable[] = {
37 { "eng;en", (CHAR16 *)L"Xen PV Block Driver" },
38 { NULL, NULL }
39};
40
41///
42/// Table of controller names
43///
44GLOBAL_REMOVE_IF_UNREFERENCED
45EFI_UNICODE_STRING_TABLE mXenPvBlkDxeControllerNameTable[] = {
46 { "eng;en", (CHAR16 *)L"Xen PV Block Device" },
47 { NULL, NULL }
48};
49
50/**
51 Retrieves a Unicode string that is the user-readable name of the EFI Driver.
52
53 @param This A pointer to the EFI_COMPONENT_NAME_PROTOCOL instance.
54 @param Language A pointer to a three-character ISO 639-2 language identifier.
55 This is the language of the driver name that the caller
56 is requesting, and it must match one of the languages specified
57 in SupportedLanguages. The number of languages supported by a
58 driver is up to the driver writer.
59 @param DriverName A pointer to the Unicode string to return. This Unicode string
60 is the name of the driver specified by This in the language
61 specified by Language.
62
63 @retval EFI_SUCCESS The Unicode string for the Driver specified by This
64 and the language specified by Language was returned
65 in DriverName.
66 @retval EFI_INVALID_PARAMETER Language is NULL.
67 @retval EFI_INVALID_PARAMETER DriverName is NULL.
68 @retval EFI_UNSUPPORTED The driver specified by This does not support the
69 language specified by Language.
70
71**/
72EFI_STATUS
73EFIAPI
74XenPvBlkDxeComponentNameGetDriverName (
75 IN EFI_COMPONENT_NAME2_PROTOCOL *This,
76 IN CHAR8 *Language,
77 OUT CHAR16 **DriverName
78 )
79{
80 return LookupUnicodeString2 (
81 Language,
82 This->SupportedLanguages,
83 mXenPvBlkDxeDriverNameTable,
84 DriverName,
85 (BOOLEAN)(This != &gXenPvBlkDxeComponentName2)
86 );
87}
88
89/**
90 Retrieves a Unicode string that is the user readable name of the controller
91 that is being managed by an EFI Driver.
92
93 @param This A pointer to the EFI_COMPONENT_NAME_PROTOCOL instance.
94 @param ControllerHandle The handle of a controller that the driver specified by
95 This is managing. This handle specifies the controller
96 whose name is to be returned.
97 @param ChildHandle The handle of the child controller to retrieve the name
98 of. This is an optional parameter that may be NULL. It
99 will be NULL for device drivers. It will also be NULL
100 for a bus drivers that wish to retrieve the name of the
101 bus controller. It will not be NULL for a bus driver
102 that wishes to retrieve the name of a child controller.
103 @param Language A pointer to a three character ISO 639-2 language
104 identifier. This is the language of the controller name
105 that the caller is requesting, and it must match one
106 of the languages specified in SupportedLanguages. The
107 number of languages supported by a driver is up to the
108 driver writer.
109 @param ControllerName A pointer to the Unicode string to return. This Unicode
110 string is the name of the controller specified by
111 ControllerHandle and ChildHandle in the language specified
112 by Language, from the point of view of the driver specified
113 by This.
114
115 @retval EFI_SUCCESS The Unicode string for the user-readable name in the
116 language specified by Language for the driver
117 specified by This was returned in DriverName.
118 @retval EFI_INVALID_PARAMETER ControllerHandle is NULL.
119 @retval EFI_INVALID_PARAMETER ChildHandle is not NULL and it is not a valid EFI_HANDLE.
120 @retval EFI_INVALID_PARAMETER Language is NULL.
121 @retval EFI_INVALID_PARAMETER ControllerName is NULL.
122 @retval EFI_UNSUPPORTED The driver specified by This is not currently managing
123 the controller specified by ControllerHandle and
124 ChildHandle.
125 @retval EFI_UNSUPPORTED The driver specified by This does not support the
126 language specified by Language.
127
128**/
129EFI_STATUS
130EFIAPI
131XenPvBlkDxeComponentNameGetControllerName (
132 IN EFI_COMPONENT_NAME2_PROTOCOL *This,
133 IN EFI_HANDLE ControllerHandle,
134 IN EFI_HANDLE ChildHandle OPTIONAL,
135 IN CHAR8 *Language,
136 OUT CHAR16 **ControllerName
137 )
138{
139 EFI_STATUS Status;
140
141 //
142 // ChildHandle must be NULL for a Device Driver
143 //
144 if (ChildHandle != NULL) {
145 return EFI_UNSUPPORTED;
146 }
147
148 //
149 // Make sure this driver is currently managing ControllerHandle
150 //
151 Status = EfiTestManagedDevice (
152 ControllerHandle,
153 gXenPvBlkDxeDriverBinding.DriverBindingHandle,
154 &gXenBusProtocolGuid
155 );
156 if (EFI_ERROR (Status)) {
157 return Status;
158 }
159
160 //
161 // Lookup name of controller specified by ControllerHandle
162 //
163 return LookupUnicodeString2 (
164 Language,
165 This->SupportedLanguages,
166 mXenPvBlkDxeControllerNameTable,
167 ControllerName,
168 (BOOLEAN)(This != &gXenPvBlkDxeComponentName2)
169 );
170}
注意: 瀏覽 TracBrowser 來幫助您使用儲存庫瀏覽器

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette