Fix format of Copyright notice to conform to legal requirements.
[mirror_edk2.git] / PcAtChipsetPkg / Bus / Pci / IdeControllerDxe / ComponentName.c
CommitLineData
a1f11f75 1/** @file\r
2 This portion is to register the IDE Controller Driver name:\r
3 "IDE Controller Init Driver"\r
4\r
47ca9c95 5 Copyright (c) 2008 - 2010, Intel Corporation. All rights reserved.<BR>\r
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 21GLOBAL_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 30GLOBAL_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 39GLOBAL_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
50//\r
47ca9c95 51/// Controller Name Strings\r
52///\r
a1f11f75 53GLOBAL_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
64EFI_STATUS\r
65EFIAPI\r
66IdeControllerComponentNameGetDriverName (\r
67 IN EFI_COMPONENT_NAME_PROTOCOL *This,\r
68 IN CHAR8 *Language,\r
69 OUT CHAR16 **DriverName\r
70 )\r
71/*++\r
72\r
73 Routine Description:\r
74 Retrieves a Unicode string that is the user readable name of the EFI Driver.\r
75\r
76 Arguments:\r
77 This - A pointer to the EFI_COMPONENT_NAME_PROTOCOL instance.\r
78 Language - A pointer to a three character ISO 639-2 language identifier.\r
47ca9c95 79 This is the language of the driver name that that the caller\r
a1f11f75 80 is requesting, and it must match one of the languages specified\r
47ca9c95 81 in SupportedLanguages. The number of languages supported by a\r
a1f11f75 82 driver is up to the driver writer.\r
83 DriverName - A pointer to the Unicode string to return. This Unicode string\r
47ca9c95 84 is the name of the driver specified by This in the language\r
a1f11f75 85 specified by Language.\r
86\r
87 Returns:\r
88 EFI_SUCCESS - The Unicode string for the Driver specified by This\r
47ca9c95 89 and the language specified by Language was returned\r
a1f11f75 90 in DriverName.\r
91 EFI_INVALID_PARAMETER - Language is NULL.\r
92 EFI_INVALID_PARAMETER - DriverName is NULL.\r
47ca9c95 93 EFI_UNSUPPORTED - The driver specified by This does not support the\r
a1f11f75 94 language specified by Language.\r
95\r
96--*/\r
97{\r
98 return LookupUnicodeString2 (\r
99 Language,\r
100 This->SupportedLanguages,\r
101 mIdeControllerDriverNameTable,\r
102 DriverName,\r
103 (BOOLEAN)(This == &gIdeControllerComponentName)\r
104 );\r
105}\r
106\r
107EFI_STATUS\r
108EFIAPI\r
109IdeControllerComponentNameGetControllerName (\r
110 IN EFI_COMPONENT_NAME_PROTOCOL *This,\r
111 IN EFI_HANDLE ControllerHandle,\r
112 IN EFI_HANDLE ChildHandle OPTIONAL,\r
113 IN CHAR8 *Language,\r
114 OUT CHAR16 **ControllerName\r
115 )\r
116/*++\r
117\r
118 Routine Description:\r
119 Retrieves a Unicode string that is the user readable name of the controller\r
120 that is being managed by an EFI Driver.\r
121\r
122 Arguments:\r
123 This - A pointer to the EFI_COMPONENT_NAME_PROTOCOL instance.\r
47ca9c95 124 ControllerHandle - The handle of a controller that the driver specified by\r
125 This is managing. This handle specifies the controller\r
a1f11f75 126 whose name is to be returned.\r
47ca9c95 127 ChildHandle - The handle of the child controller to retrieve the name\r
128 of. This is an optional parameter that may be NULL. It\r
129 will be NULL for device drivers. It will also be NULL\r
130 for a bus drivers that wish to retrieve the name of the\r
131 bus controller. It will not be NULL for a bus driver\r
a1f11f75 132 that wishes to retrieve the name of a child controller.\r
47ca9c95 133 Language - A pointer to a three character ISO 639-2 language\r
134 identifier. This is the language of the controller name\r
a1f11f75 135 that that the caller is requesting, and it must match one\r
47ca9c95 136 of the languages specified in SupportedLanguages. The\r
137 number of languages supported by a driver is up to the\r
a1f11f75 138 driver writer.\r
139 ControllerName - A pointer to the Unicode string to return. This Unicode\r
47ca9c95 140 string is the name of the controller specified by\r
141 ControllerHandle and ChildHandle in the language\r
142 specified by Language from the point of view of the\r
143 driver specified by This.\r
a1f11f75 144\r
145 Returns:\r
47ca9c95 146 EFI_SUCCESS - The Unicode string for the user readable name in the\r
147 language specified by Language for the driver\r
a1f11f75 148 specified by This was returned in DriverName.\r
149 EFI_INVALID_PARAMETER - ControllerHandle is not a valid EFI_HANDLE.\r
47ca9c95 150 EFI_INVALID_PARAMETER - ChildHandle is not NULL and it is not a valid\r
a1f11f75 151 EFI_HANDLE.\r
152 EFI_INVALID_PARAMETER - Language is NULL.\r
153 EFI_INVALID_PARAMETER - ControllerName is NULL.\r
47ca9c95 154 EFI_UNSUPPORTED - The driver specified by This is not currently\r
155 managing the controller specified by\r
a1f11f75 156 ControllerHandle and ChildHandle.\r
47ca9c95 157 EFI_UNSUPPORTED - The driver specified by This does not support the\r
a1f11f75 158 language specified by Language.\r
159\r
160--*/\r
161{\r
162 EFI_STATUS Status;\r
163\r
164 //\r
165 // Make sure this driver is currently managing ControllHandle\r
166 //\r
167 Status = EfiTestManagedDevice (\r
168 ControllerHandle,\r
169 gIdeControllerDriverBinding.DriverBindingHandle,\r
170 &gEfiPciIoProtocolGuid\r
171 );\r
172 if (EFI_ERROR (Status)) {\r
173 return Status;\r
174 }\r
175\r
176 if (ChildHandle != NULL) {\r
177 return EFI_UNSUPPORTED;\r
178 }\r
179\r
180 return LookupUnicodeString2 (\r
181 Language,\r
182 This->SupportedLanguages,\r
183 mIdeControllerControllerNameTable,\r
184 ControllerName,\r
185 (BOOLEAN)(This == &gIdeControllerComponentName)\r
186 );\r
187}\r