1 /** @file
2 UEFI Component Name(2) protocol implementation for SCSI bus driver.
3
4 Copyright (c) 2006 - 2011, Intel Corporation. All rights reserved.<BR>
5 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
16 #include "ScsiBus.h"
17
18 //
19 // EFI Component Name Protocol
20 //
21 GLOBAL_REMOVE_IF_UNREFERENCED EFI_COMPONENT_NAME_PROTOCOL gScsiBusComponentName = {
22 ScsiBusComponentNameGetDriverName,
23 ScsiBusComponentNameGetControllerName,
24 "eng"
25 };
26
27 //
28 // EFI Component Name 2 Protocol
29 //
30 GLOBAL_REMOVE_IF_UNREFERENCED EFI_COMPONENT_NAME2_PROTOCOL gScsiBusComponentName2 = {
31 (EFI_COMPONENT_NAME2_GET_DRIVER_NAME) ScsiBusComponentNameGetDriverName,
32 (EFI_COMPONENT_NAME2_GET_CONTROLLER_NAME) ScsiBusComponentNameGetControllerName,
33 "en"
34 };
35
36
37 GLOBAL_REMOVE_IF_UNREFERENCED EFI_UNICODE_STRING_TABLE mScsiBusDriverNameTable[] = {
38 { "eng;en", (CHAR16 *) L"SCSI Bus Driver" },
39 { NULL , NULL }
40 };
41
42 /**
43 Retrieves a Unicode string that is the user readable name of the driver.
44
45 This function retrieves the user readable name of a driver in the form of a
46 Unicode string. If the driver specified by This has a user readable name in
47 the language specified by Language, then a pointer to the driver name is
48 returned in DriverName, and EFI_SUCCESS is returned. If the driver specified
49 by This does not support the language specified by Language,
50 then EFI_UNSUPPORTED is returned.
51
52 @param This A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or
53 EFI_COMPONENT_NAME_PROTOCOL instance.
54
55 @param Language A pointer to a Null-terminated ASCII string
56 array indicating the language. This is the
57 language of the driver name that the caller is
58 requesting, and it must match one of the
59 languages specified in SupportedLanguages. The
60 number of languages supported by a driver is up
61 to the driver writer. Language is specified
62 in RFC 4646 or ISO 639-2 language code format.
63
64 @param DriverName A pointer to the Unicode string to return.
65 This Unicode string is the name of the
66 driver specified by This in the language
67 specified by Language.
68
69 @retval EFI_SUCCESS The Unicode string for the Driver specified by
70 This and the language specified by Language was
71 returned in DriverName.
72
73 @retval EFI_INVALID_PARAMETER Language is NULL.
74
75 @retval EFI_INVALID_PARAMETER DriverName is NULL.
76
77 @retval EFI_UNSUPPORTED The driver specified by This does not support
78 the language specified by Language.
79
80 **/
81 EFI_STATUS
82 EFIAPI
ScsiBusComponentNameGetDriverName(IN EFI_COMPONENT_NAME_PROTOCOL * This,IN CHAR8 * Language,OUT CHAR16 ** DriverName)83 ScsiBusComponentNameGetDriverName (
84 IN EFI_COMPONENT_NAME_PROTOCOL *This,
85 IN CHAR8 *Language,
86 OUT CHAR16 **DriverName
87 )
88 {
89 return LookupUnicodeString2 (
90 Language,
91 This->SupportedLanguages,
92 mScsiBusDriverNameTable,
93 DriverName,
94 (BOOLEAN)(This == &gScsiBusComponentName)
95 );
96 }
97
98 /**
99 Retrieves a Unicode string that is the user readable name of the controller
100 that is being managed by a driver.
101
102 This function retrieves the user readable name of the controller specified by
103 ControllerHandle and ChildHandle in the form of a Unicode string. If the
104 driver specified by This has a user readable name in the language specified by
105 Language, then a pointer to the controller name is returned in ControllerName,
106 and EFI_SUCCESS is returned. If the driver specified by This is not currently
107 managing the controller specified by ControllerHandle and ChildHandle,
108 then EFI_UNSUPPORTED is returned. If the driver specified by This does not
109 support the language specified by Language, then EFI_UNSUPPORTED is returned.
110
111 @param This A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or
112 EFI_COMPONENT_NAME_PROTOCOL instance.
113
114 @param ControllerHandle The handle of a controller that the driver
115 specified by This is managing. This handle
116 specifies the controller whose name is to be
117 returned.
118
119 @param ChildHandle The handle of the child controller to retrieve
120 the name of. This is an optional parameter that
121 may be NULL. It will be NULL for device
122 drivers. It will also be NULL for a bus drivers
123 that wish to retrieve the name of the bus
124 controller. It will not be NULL for a bus
125 driver that wishes to retrieve the name of a
126 child controller.
127
128 @param Language A pointer to a Null-terminated ASCII string
129 array indicating the language. This is the
130 language of the driver name that the caller is
131 requesting, and it must match one of the
132 languages specified in SupportedLanguages. The
133 number of languages supported by a driver is up
134 to the driver writer. Language is specified in
135 RFC 4646 or ISO 639-2 language code format.
136
137 @param ControllerName A pointer to the Unicode string to return.
138 This Unicode string is the name of the
139 controller specified by ControllerHandle and
140 ChildHandle in the language specified by
141 Language from the point of view of the driver
142 specified by This.
143
144 @retval EFI_SUCCESS The Unicode string for the user readable name in
145 the language specified by Language for the
146 driver specified by This was returned in
147 DriverName.
148
149 @retval EFI_INVALID_PARAMETER ControllerHandle is NULL.
150
151 @retval EFI_INVALID_PARAMETER ChildHandle is not NULL and it is not a valid
152 EFI_HANDLE.
153
154 @retval EFI_INVALID_PARAMETER Language is NULL.
155
156 @retval EFI_INVALID_PARAMETER ControllerName is NULL.
157
158 @retval EFI_UNSUPPORTED The driver specified by This is not currently
159 managing the controller specified by
160 ControllerHandle and ChildHandle.
161
162 @retval EFI_UNSUPPORTED The driver specified by This does not support
163 the language specified by Language.
164
165 **/
166 EFI_STATUS
167 EFIAPI
ScsiBusComponentNameGetControllerName(IN EFI_COMPONENT_NAME_PROTOCOL * This,IN EFI_HANDLE ControllerHandle,IN EFI_HANDLE ChildHandle OPTIONAL,IN CHAR8 * Language,OUT CHAR16 ** ControllerName)168 ScsiBusComponentNameGetControllerName (
169 IN EFI_COMPONENT_NAME_PROTOCOL *This,
170 IN EFI_HANDLE ControllerHandle,
171 IN EFI_HANDLE ChildHandle OPTIONAL,
172 IN CHAR8 *Language,
173 OUT CHAR16 **ControllerName
174 )
175 {
176 return EFI_UNSUPPORTED;
177 }
178