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