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