]> git.proxmox.com Git - mirror_edk2.git/blob - MdeModulePkg/Universal/Disk/DiskIoDxe/ComponentName.c
925bf0885c79ddd20121c33ed419dacecba3d62d
[mirror_edk2.git] / MdeModulePkg / Universal / Disk / DiskIoDxe / ComponentName.c
1 /** @file
2 UEFI Component Name(2) protocol implementation for DiskIo driver.
3
4 Copyright (c) 2006 - 2008, Intel Corporation. <BR>
5 All rights reserved. This program and the accompanying materials
6 are licensed and made available under the terms and conditions of the BSD License
7 which accompanies this distribution. The full text of the license may be found at
8 http://opensource.org/licenses/bsd-license.php
9
10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
12
13 **/
14
15 #include "DiskIo.h"
16
17 //
18 // EFI Component Name Protocol
19 //
20 GLOBAL_REMOVE_IF_UNREFERENCED EFI_COMPONENT_NAME_PROTOCOL gDiskIoComponentName = {
21 DiskIoComponentNameGetDriverName,
22 DiskIoComponentNameGetControllerName,
23 "eng"
24 };
25
26 //
27 // EFI Component Name 2 Protocol
28 //
29 GLOBAL_REMOVE_IF_UNREFERENCED EFI_COMPONENT_NAME2_PROTOCOL gDiskIoComponentName2 = {
30 (EFI_COMPONENT_NAME2_GET_DRIVER_NAME) DiskIoComponentNameGetDriverName,
31 (EFI_COMPONENT_NAME2_GET_CONTROLLER_NAME) DiskIoComponentNameGetControllerName,
32 "en"
33 };
34
35 //
36 // Driver name table for DiskIo module.
37 // It is shared by the implementation of ComponentName & ComponentName2 Protocol.
38 //
39 GLOBAL_REMOVE_IF_UNREFERENCED EFI_UNICODE_STRING_TABLE mDiskIoDriverNameTable[] = {
40 {
41 "eng;en",
42 (CHAR16 *)L"Generic Disk I/O Driver"
43 },
44 {
45 NULL,
46 NULL
47 }
48 };
49
50
51
52 /**
53 Retrieves a Unicode string that is the user readable name of the driver.
54
55 This function retrieves the user readable name of a driver in the form of a
56 Unicode string. If the driver specified by This has a user readable name in
57 the language specified by Language, then a pointer to the driver name is
58 returned in DriverName, and EFI_SUCCESS is returned. If the driver specified
59 by This does not support the language specified by Language,
60 then EFI_UNSUPPORTED is returned.
61
62 @param This[in] A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or
63 EFI_COMPONENT_NAME_PROTOCOL instance.
64
65 @param Language[in] A pointer to a Null-terminated ASCII string
66 array indicating the language. This is the
67 language of the driver name that the caller is
68 requesting, and it must match one of the
69 languages specified in SupportedLanguages. The
70 number of languages supported by a driver is up
71 to the driver writer. Language is specified
72 in RFC 4646 or ISO 639-2 language code format.
73
74 @param DriverName[out] A pointer to the Unicode string to return.
75 This Unicode string is the name of the
76 driver specified by This in the language
77 specified by Language.
78
79 @retval EFI_SUCCESS The Unicode string for the Driver specified by
80 This and the language specified by Language was
81 returned in DriverName.
82
83 @retval EFI_INVALID_PARAMETER Language is NULL.
84
85 @retval EFI_INVALID_PARAMETER DriverName is NULL.
86
87 @retval EFI_UNSUPPORTED The driver specified by This does not support
88 the language specified by Language.
89
90 **/
91 EFI_STATUS
92 EFIAPI
93 DiskIoComponentNameGetDriverName (
94 IN EFI_COMPONENT_NAME_PROTOCOL *This,
95 IN CHAR8 *Language,
96 OUT CHAR16 **DriverName
97 )
98 {
99 return LookupUnicodeString2 (
100 Language,
101 This->SupportedLanguages,
102 mDiskIoDriverNameTable,
103 DriverName,
104 (BOOLEAN)(This == &gDiskIoComponentName)
105 );
106 }
107
108
109
110 /**
111 Retrieves a Unicode string that is the user readable name of the controller
112 that is being managed by a driver.
113
114 This function retrieves the user readable name of the controller specified by
115 ControllerHandle and ChildHandle in the form of a Unicode string. If the
116 driver specified by This has a user readable name in the language specified by
117 Language, then a pointer to the controller name is returned in ControllerName,
118 and EFI_SUCCESS is returned. If the driver specified by This is not currently
119 managing the controller specified by ControllerHandle and ChildHandle,
120 then EFI_UNSUPPORTED is returned. If the driver specified by This does not
121 support the language specified by Language, then EFI_UNSUPPORTED is returned.
122
123 @param This[in] A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or
124 EFI_COMPONENT_NAME_PROTOCOL instance.
125
126 @param ControllerHandle[in] The handle of a controller that the driver
127 specified by This is managing. This handle
128 specifies the controller whose name is to be
129 returned.
130
131 @param ChildHandle[in] The handle of the child controller to retrieve
132 the name of. This is an optional parameter that
133 may be NULL. It will be NULL for device
134 drivers. It will also be NULL for a bus drivers
135 that wish to retrieve the name of the bus
136 controller. It will not be NULL for a bus
137 driver that wishes to retrieve the name of a
138 child controller.
139
140 @param Language[in] A pointer to a Null-terminated ASCII string
141 array indicating the language. This is the
142 language of the driver name that the caller is
143 requesting, and it must match one of the
144 languages specified in SupportedLanguages. The
145 number of languages supported by a driver is up
146 to the driver writer. Language is specified in
147 RFC 4646 or ISO 639-2 language code format.
148
149 @param ControllerName[out] A pointer to the Unicode string to return.
150 This Unicode string is the name of the
151 controller specified by ControllerHandle and
152 ChildHandle in the language specified by
153 Language from the point of view of the driver
154 specified by This.
155
156 @retval EFI_SUCCESS The Unicode string for the user readable name in
157 the language specified by Language for the
158 driver specified by This was returned in
159 DriverName.
160
161 @retval EFI_INVALID_PARAMETER ControllerHandle is not a valid EFI_HANDLE.
162
163 @retval EFI_INVALID_PARAMETER ChildHandle is not NULL and it is not a valid
164 EFI_HANDLE.
165
166 @retval EFI_INVALID_PARAMETER Language is NULL.
167
168 @retval EFI_INVALID_PARAMETER ControllerName is NULL.
169
170 @retval EFI_UNSUPPORTED The driver specified by This is not currently
171 managing the controller specified by
172 ControllerHandle and ChildHandle.
173
174 @retval EFI_UNSUPPORTED The driver specified by This does not support
175 the language specified by Language.
176
177 **/
178 EFI_STATUS
179 EFIAPI
180 DiskIoComponentNameGetControllerName (
181 IN EFI_COMPONENT_NAME_PROTOCOL *This,
182 IN EFI_HANDLE ControllerHandle,
183 IN EFI_HANDLE ChildHandle OPTIONAL,
184 IN CHAR8 *Language,
185 OUT CHAR16 **ControllerName
186 )
187 {
188 return EFI_UNSUPPORTED;
189 }