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