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