1 | /* $Id: ComponentName.c 48674 2013-09-25 08:26:15Z vboxsync $ */
|
---|
2 | /** @file
|
---|
3 | * ComponentName,c
|
---|
4 | */
|
---|
5 |
|
---|
6 | /*
|
---|
7 | * Copyright (C) 2012 Oracle Corporation
|
---|
8 | *
|
---|
9 | * This file is part of VirtualBox Open Source Edition (OSE), as
|
---|
10 | * available from http://www.virtualbox.org. This file is free software;
|
---|
11 | * you can redistribute it and/or modify it under the terms of the GNU
|
---|
12 | * General Public License (GPL) as published by the Free Software
|
---|
13 | * Foundation, in version 2 as it comes in the "COPYING" file of the
|
---|
14 | * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
|
---|
15 | * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
|
---|
16 | *
|
---|
17 | * The contents of this file may alternatively be used under the terms
|
---|
18 | * of the Common Development and Distribution License Version 1.0
|
---|
19 | * (CDDL) only, as it comes in the "COPYING.CDDL" file of the
|
---|
20 | * VirtualBox OSE distribution, in which case the provisions of the
|
---|
21 | * CDDL are applicable instead of those of the GPL.
|
---|
22 | *
|
---|
23 | * You may elect to license modified versions of this file under the
|
---|
24 | * terms and conditions of either the GPL or the CDDL or both.
|
---|
25 | */
|
---|
26 |
|
---|
27 | /** @file
|
---|
28 | UEFI Component Name protocol for Partition driver.
|
---|
29 |
|
---|
30 | Copyright (c) 2006 - 2011, Intel Corporation. All rights reserved.<BR>
|
---|
31 | This program and the accompanying materials
|
---|
32 | are licensed and made available under the terms and conditions of the BSD License
|
---|
33 | which accompanies this distribution. The full text of the license may be found at
|
---|
34 | http://opensource.org/licenses/bsd-license.php
|
---|
35 |
|
---|
36 | THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
---|
37 | WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
---|
38 |
|
---|
39 | **/
|
---|
40 |
|
---|
41 | #include "Partition.h"
|
---|
42 |
|
---|
43 | //
|
---|
44 | // EFI Component Name Protocol
|
---|
45 | //
|
---|
46 | GLOBAL_REMOVE_IF_UNREFERENCED EFI_COMPONENT_NAME_PROTOCOL gPartitionComponentName = {
|
---|
47 | PartitionComponentNameGetDriverName,
|
---|
48 | PartitionComponentNameGetControllerName,
|
---|
49 | "eng"
|
---|
50 | };
|
---|
51 |
|
---|
52 | //
|
---|
53 | // EFI Component Name 2 Protocol
|
---|
54 | //
|
---|
55 | GLOBAL_REMOVE_IF_UNREFERENCED EFI_COMPONENT_NAME2_PROTOCOL gPartitionComponentName2 = {
|
---|
56 | (EFI_COMPONENT_NAME2_GET_DRIVER_NAME) PartitionComponentNameGetDriverName,
|
---|
57 | (EFI_COMPONENT_NAME2_GET_CONTROLLER_NAME) PartitionComponentNameGetControllerName,
|
---|
58 | "en"
|
---|
59 | };
|
---|
60 |
|
---|
61 | //
|
---|
62 | // Driver name table for Partition module.
|
---|
63 | // It is shared by the implementation of ComponentName & ComponentName2 Protocol.
|
---|
64 | //
|
---|
65 | GLOBAL_REMOVE_IF_UNREFERENCED EFI_UNICODE_STRING_TABLE mPartitionDriverNameTable[] = {
|
---|
66 | {
|
---|
67 | "eng;en",
|
---|
68 | L"Partition Driver(MBR/GPT/El Torito)"
|
---|
69 | },
|
---|
70 | {
|
---|
71 | NULL,
|
---|
72 | NULL
|
---|
73 | }
|
---|
74 | };
|
---|
75 |
|
---|
76 |
|
---|
77 |
|
---|
78 | /**
|
---|
79 | Retrieves a Unicode string that is the user readable name of the driver.
|
---|
80 |
|
---|
81 | This function retrieves the user readable name of a driver in the form of a
|
---|
82 | Unicode string. If the driver specified by This has a user readable name in
|
---|
83 | the language specified by Language, then a pointer to the driver name is
|
---|
84 | returned in DriverName, and EFI_SUCCESS is returned. If the driver specified
|
---|
85 | by This does not support the language specified by Language,
|
---|
86 | then EFI_UNSUPPORTED is returned.
|
---|
87 |
|
---|
88 | @param This[in] A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or
|
---|
89 | EFI_COMPONENT_NAME_PROTOCOL instance.
|
---|
90 |
|
---|
91 | @param Language[in] A pointer to a Null-terminated ASCII string
|
---|
92 | array indicating the language. This is the
|
---|
93 | language of the driver name that the caller is
|
---|
94 | requesting, and it must match one of the
|
---|
95 | languages specified in SupportedLanguages. The
|
---|
96 | number of languages supported by a driver is up
|
---|
97 | to the driver writer. Language is specified
|
---|
98 | in RFC 4646 or ISO 639-2 language code format.
|
---|
99 |
|
---|
100 | @param DriverName[out] A pointer to the Unicode string to return.
|
---|
101 | This Unicode string is the name of the
|
---|
102 | driver specified by This in the language
|
---|
103 | specified by Language.
|
---|
104 |
|
---|
105 | @retval EFI_SUCCESS The Unicode string for the Driver specified by
|
---|
106 | This and the language specified by Language was
|
---|
107 | returned in DriverName.
|
---|
108 |
|
---|
109 | @retval EFI_INVALID_PARAMETER Language is NULL.
|
---|
110 |
|
---|
111 | @retval EFI_INVALID_PARAMETER DriverName is NULL.
|
---|
112 |
|
---|
113 | @retval EFI_UNSUPPORTED The driver specified by This does not support
|
---|
114 | the language specified by Language.
|
---|
115 |
|
---|
116 | **/
|
---|
117 | EFI_STATUS
|
---|
118 | EFIAPI
|
---|
119 | PartitionComponentNameGetDriverName (
|
---|
120 | IN EFI_COMPONENT_NAME_PROTOCOL *This,
|
---|
121 | IN CHAR8 *Language,
|
---|
122 | OUT CHAR16 **DriverName
|
---|
123 | )
|
---|
124 | {
|
---|
125 | return LookupUnicodeString2 (
|
---|
126 | Language,
|
---|
127 | This->SupportedLanguages,
|
---|
128 | mPartitionDriverNameTable,
|
---|
129 | DriverName,
|
---|
130 | (BOOLEAN)(This == &gPartitionComponentName)
|
---|
131 | );
|
---|
132 | }
|
---|
133 |
|
---|
134 |
|
---|
135 | /**
|
---|
136 | Retrieves a Unicode string that is the user readable name of the controller
|
---|
137 | that is being managed by a driver.
|
---|
138 |
|
---|
139 | This function retrieves the user readable name of the controller specified by
|
---|
140 | ControllerHandle and ChildHandle in the form of a Unicode string. If the
|
---|
141 | driver specified by This has a user readable name in the language specified by
|
---|
142 | Language, then a pointer to the controller name is returned in ControllerName,
|
---|
143 | and EFI_SUCCESS is returned. If the driver specified by This is not currently
|
---|
144 | managing the controller specified by ControllerHandle and ChildHandle,
|
---|
145 | then EFI_UNSUPPORTED is returned. If the driver specified by This does not
|
---|
146 | support the language specified by Language, then EFI_UNSUPPORTED is returned.
|
---|
147 |
|
---|
148 | @param This[in] A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or
|
---|
149 | EFI_COMPONENT_NAME_PROTOCOL instance.
|
---|
150 |
|
---|
151 | @param ControllerHandle[in] The handle of a controller that the driver
|
---|
152 | specified by This is managing. This handle
|
---|
153 | specifies the controller whose name is to be
|
---|
154 | returned.
|
---|
155 |
|
---|
156 | @param ChildHandle[in] The handle of the child controller to retrieve
|
---|
157 | the name of. This is an optional parameter that
|
---|
158 | may be NULL. It will be NULL for device
|
---|
159 | drivers. It will also be NULL for a bus drivers
|
---|
160 | that wish to retrieve the name of the bus
|
---|
161 | controller. It will not be NULL for a bus
|
---|
162 | driver that wishes to retrieve the name of a
|
---|
163 | child controller.
|
---|
164 |
|
---|
165 | @param Language[in] A pointer to a Null-terminated ASCII string
|
---|
166 | array indicating the language. This is the
|
---|
167 | language of the driver name that the caller is
|
---|
168 | requesting, and it must match one of the
|
---|
169 | languages specified in SupportedLanguages. The
|
---|
170 | number of languages supported by a driver is up
|
---|
171 | to the driver writer. Language is specified in
|
---|
172 | RFC 4646 or ISO 639-2 language code format.
|
---|
173 |
|
---|
174 | @param ControllerName[out] A pointer to the Unicode string to return.
|
---|
175 | This Unicode string is the name of the
|
---|
176 | controller specified by ControllerHandle and
|
---|
177 | ChildHandle in the language specified by
|
---|
178 | Language from the point of view of the driver
|
---|
179 | specified by This.
|
---|
180 |
|
---|
181 | @retval EFI_SUCCESS The Unicode string for the user readable name in
|
---|
182 | the language specified by Language for the
|
---|
183 | driver specified by This was returned in
|
---|
184 | DriverName.
|
---|
185 |
|
---|
186 | @retval EFI_INVALID_PARAMETER ControllerHandle is NULL.
|
---|
187 |
|
---|
188 | @retval EFI_INVALID_PARAMETER ChildHandle is not NULL and it is not a valid
|
---|
189 | EFI_HANDLE.
|
---|
190 |
|
---|
191 | @retval EFI_INVALID_PARAMETER Language is NULL.
|
---|
192 |
|
---|
193 | @retval EFI_INVALID_PARAMETER ControllerName is NULL.
|
---|
194 |
|
---|
195 | @retval EFI_UNSUPPORTED The driver specified by This is not currently
|
---|
196 | managing the controller specified by
|
---|
197 | ControllerHandle and ChildHandle.
|
---|
198 |
|
---|
199 | @retval EFI_UNSUPPORTED The driver specified by This does not support
|
---|
200 | the language specified by Language.
|
---|
201 |
|
---|
202 | **/
|
---|
203 | EFI_STATUS
|
---|
204 | EFIAPI
|
---|
205 | PartitionComponentNameGetControllerName (
|
---|
206 | IN EFI_COMPONENT_NAME_PROTOCOL *This,
|
---|
207 | IN EFI_HANDLE ControllerHandle,
|
---|
208 | IN EFI_HANDLE ChildHandle OPTIONAL,
|
---|
209 | IN CHAR8 *Language,
|
---|
210 | OUT CHAR16 **ControllerName
|
---|
211 | )
|
---|
212 | {
|
---|
213 | return EFI_UNSUPPORTED;
|
---|
214 | }
|
---|