]>
Commit | Line | Data |
---|---|---|
27f30159 SZ |
1 | /** @file\r |
2 | UEFI Component Name(2) protocol implementation for Sata Controller driver.\r | |
3 | \r | |
4 | Copyright (c) 2011, Intel Corporation. All rights reserved.<BR>\r | |
5 | This program and the accompanying materials\r | |
6 | are licensed and made available under the terms and conditions of the BSD License\r | |
7 | which accompanies this distribution. The full text of the license may be found at\r | |
8 | http://opensource.org/licenses/bsd-license.php.\r | |
9 | \r | |
10 | THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r | |
11 | WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r | |
12 | \r | |
13 | **/\r | |
14 | \r | |
15 | #include "SataController.h"\r | |
16 | \r | |
17 | //\r | |
18 | /// EFI Component Name Protocol\r | |
19 | ///\r | |
20 | GLOBAL_REMOVE_IF_UNREFERENCED EFI_COMPONENT_NAME_PROTOCOL gSataControllerComponentName = {\r | |
21 | SataControllerComponentNameGetDriverName,\r | |
22 | SataControllerComponentNameGetControllerName,\r | |
23 | "eng"\r | |
24 | };\r | |
25 | \r | |
26 | //\r | |
27 | /// EFI Component Name 2 Protocol\r | |
28 | ///\r | |
29 | GLOBAL_REMOVE_IF_UNREFERENCED EFI_COMPONENT_NAME2_PROTOCOL gSataControllerComponentName2 = {\r | |
30 | (EFI_COMPONENT_NAME2_GET_DRIVER_NAME) SataControllerComponentNameGetDriverName,\r | |
31 | (EFI_COMPONENT_NAME2_GET_CONTROLLER_NAME) SataControllerComponentNameGetControllerName,\r | |
32 | "en"\r | |
33 | };\r | |
34 | \r | |
35 | //\r | |
36 | /// Driver Name Strings\r | |
37 | ///\r | |
38 | GLOBAL_REMOVE_IF_UNREFERENCED EFI_UNICODE_STRING_TABLE mSataControllerDriverNameTable[] = {\r | |
39 | {\r | |
40 | "eng;en",\r | |
41 | (CHAR16 *)L"Sata Controller Init Driver"\r | |
42 | },\r | |
43 | {\r | |
44 | NULL,\r | |
45 | NULL\r | |
46 | }\r | |
47 | };\r | |
48 | \r | |
49 | ///\r | |
50 | /// Controller Name Strings\r | |
51 | ///\r | |
52 | GLOBAL_REMOVE_IF_UNREFERENCED EFI_UNICODE_STRING_TABLE mSataControllerControllerNameTable[] = {\r | |
53 | {\r | |
54 | "eng;en",\r | |
55 | (CHAR16 *)L"Sata Controller"\r | |
56 | },\r | |
57 | {\r | |
58 | NULL,\r | |
59 | NULL\r | |
60 | }\r | |
61 | };\r | |
62 | \r | |
63 | /**\r | |
64 | Retrieves a Unicode string that is the user readable name of the UEFI Driver.\r | |
65 | \r | |
66 | @param This A pointer to the EFI_COMPONENT_NAME_PROTOCOL instance.\r | |
67 | @param Language A pointer to a three character ISO 639-2 language identifier.\r | |
68 | This is the language of the driver name that that the caller\r | |
69 | is requesting, and it must match one of the languages specified\r | |
70 | in SupportedLanguages. The number of languages supported by a\r | |
71 | driver is up to the driver writer.\r | |
72 | @param DriverName A pointer to the Unicode string to return. This Unicode string\r | |
73 | is the name of the driver specified by This in the language\r | |
74 | specified by Language.\r | |
75 | \r | |
76 | @retval EFI_SUCCESS The Unicode string for the Driver specified by This\r | |
77 | and the language specified by Language was returned\r | |
78 | in DriverName.\r | |
79 | @retval EFI_INVALID_PARAMETER Language is NULL.\r | |
80 | @retval EFI_INVALID_PARAMETER DriverName is NULL.\r | |
81 | @retval EFI_UNSUPPORTED The driver specified by This does not support the\r | |
82 | language specified by Language.\r | |
83 | **/\r | |
84 | EFI_STATUS\r | |
85 | EFIAPI\r | |
86 | SataControllerComponentNameGetDriverName (\r | |
87 | IN EFI_COMPONENT_NAME_PROTOCOL *This,\r | |
88 | IN CHAR8 *Language,\r | |
89 | OUT CHAR16 **DriverName\r | |
90 | )\r | |
91 | {\r | |
92 | return LookupUnicodeString2 (\r | |
93 | Language,\r | |
94 | This->SupportedLanguages,\r | |
95 | mSataControllerDriverNameTable,\r | |
96 | DriverName,\r | |
97 | (BOOLEAN)(This == &gSataControllerComponentName)\r | |
98 | );\r | |
99 | }\r | |
100 | \r | |
101 | /**\r | |
102 | Retrieves a Unicode string that is the user readable name of the controller\r | |
103 | that is being managed by an UEFI Driver. \r | |
104 | \r | |
105 | @param This A pointer to the EFI_COMPONENT_NAME_PROTOCOL instance.\r | |
106 | @param ControllerHandle The handle of a controller that the driver specified by\r | |
107 | This is managing. This handle specifies the controller\r | |
108 | whose name is to be returned.\r | |
109 | @param ChildHandle OPTIONAL The handle of the child controller to retrieve the name\r | |
110 | of. This is an optional parameter that may be NULL. It\r | |
111 | will be NULL for device drivers. It will also be NULL\r | |
112 | for a bus drivers that wish to retrieve the name of the\r | |
113 | bus controller. It will not be NULL for a bus driver\r | |
114 | that wishes to retrieve the name of a child controller.\r | |
115 | @param Language A pointer to a three character ISO 639-2 language\r | |
116 | identifier. This is the language of the controller name\r | |
117 | that that the caller is requesting, and it must match one\r | |
118 | of the languages specified in SupportedLanguages. The\r | |
119 | number of languages supported by a driver is up to the\r | |
120 | driver writer.\r | |
121 | @param ControllerName A pointer to the Unicode string to return. This Unicode\r | |
122 | string is the name of the controller specified by\r | |
123 | ControllerHandle and ChildHandle in the language\r | |
124 | specified by Language from the point of view of the\r | |
125 | driver specified by This.\r | |
126 | \r | |
127 | @retval EFI_SUCCESS The Unicode string for the user readable name in the\r | |
128 | language specified by Language for the driver\r | |
129 | specified by This was returned in DriverName.\r | |
130 | @retval EFI_INVALID_PARAMETER ControllerHandle is not a valid EFI_HANDLE.\r | |
131 | @retval EFI_INVALID_PARAMETER ChildHandle is not NULL and it is not a valid\r | |
132 | EFI_HANDLE.\r | |
133 | @retval EFI_INVALID_PARAMETER Language is NULL.\r | |
134 | @retval EFI_INVALID_PARAMETER ControllerName is NULL.\r | |
135 | @retval EFI_UNSUPPORTED The driver specified by This is not currently\r | |
136 | managing the controller specified by\r | |
137 | ControllerHandle and ChildHandle.\r | |
138 | @retval EFI_UNSUPPORTED The driver specified by This does not support the\r | |
139 | language specified by Language.\r | |
140 | **/\r | |
141 | EFI_STATUS\r | |
142 | EFIAPI\r | |
143 | SataControllerComponentNameGetControllerName (\r | |
144 | IN EFI_COMPONENT_NAME_PROTOCOL *This,\r | |
145 | IN EFI_HANDLE ControllerHandle,\r | |
146 | IN EFI_HANDLE ChildHandle OPTIONAL,\r | |
147 | IN CHAR8 *Language,\r | |
148 | OUT CHAR16 **ControllerName\r | |
149 | )\r | |
150 | {\r | |
151 | EFI_STATUS Status;\r | |
152 | \r | |
153 | //\r | |
154 | // Make sure this driver is currently managing ControllHandle\r | |
155 | //\r | |
156 | Status = EfiTestManagedDevice (\r | |
157 | ControllerHandle,\r | |
158 | gSataControllerDriverBinding.DriverBindingHandle,\r | |
159 | &gEfiPciIoProtocolGuid\r | |
160 | );\r | |
161 | if (EFI_ERROR (Status)) {\r | |
162 | return Status;\r | |
163 | }\r | |
164 | \r | |
165 | if (ChildHandle != NULL) {\r | |
166 | return EFI_UNSUPPORTED;\r | |
167 | }\r | |
168 | \r | |
169 | return LookupUnicodeString2 (\r | |
170 | Language,\r | |
171 | This->SupportedLanguages,\r | |
172 | mSataControllerControllerNameTable,\r | |
173 | ControllerName,\r | |
174 | (BOOLEAN)(This == &gSataControllerComponentName)\r | |
175 | );\r | |
176 | }\r |