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