]>
Commit | Line | Data |
---|---|---|
a5cc178a HW |
1 | /** @file\r |
2 | UEFI Component Name(2) protocol implementation for SioBusDxe driver.\r | |
3 | \r | |
4 | Copyright (c) 2019, Intel Corporation. All rights reserved.<BR>\r | |
5 | \r | |
b26f0cf9 | 6 | SPDX-License-Identifier: BSD-2-Clause-Patent\r |
a5cc178a HW |
7 | \r |
8 | **/\r | |
9 | \r | |
10 | #include "SioBusDxe.h"\r | |
11 | \r | |
12 | //\r | |
13 | // Driver name table\r | |
14 | //\r | |
ac0a286f | 15 | GLOBAL_REMOVE_IF_UNREFERENCED EFI_UNICODE_STRING_TABLE mSioBusDriverNameTable[] = {\r |
a5cc178a | 16 | { "eng;en", L"OVMF Sio Bus Driver" },\r |
ac0a286f | 17 | { NULL, NULL }\r |
a5cc178a HW |
18 | };\r |
19 | \r | |
20 | //\r | |
21 | // EFI Component Name Protocol\r | |
22 | //\r | |
23 | GLOBAL_REMOVE_IF_UNREFERENCED EFI_COMPONENT_NAME_PROTOCOL gSioBusComponentName = {\r | |
24 | SioBusComponentNameGetDriverName,\r | |
25 | SioBusComponentNameGetControllerName,\r | |
26 | "eng"\r | |
27 | };\r | |
28 | \r | |
29 | //\r | |
30 | // EFI Component Name 2 Protocol\r | |
31 | //\r | |
ac0a286f MK |
32 | GLOBAL_REMOVE_IF_UNREFERENCED EFI_COMPONENT_NAME2_PROTOCOL gSioBusComponentName2 = {\r |
33 | (EFI_COMPONENT_NAME2_GET_DRIVER_NAME)SioBusComponentNameGetDriverName,\r | |
34 | (EFI_COMPONENT_NAME2_GET_CONTROLLER_NAME)SioBusComponentNameGetControllerName,\r | |
a5cc178a HW |
35 | "en"\r |
36 | };\r | |
37 | \r | |
a5cc178a HW |
38 | /**\r |
39 | Retrieves a Unicode string that is the user readable name of the driver.\r | |
40 | \r | |
41 | This function retrieves the user readable name of a driver in the form of a\r | |
42 | Unicode string. If the driver specified by This has a user readable name in\r | |
43 | the language specified by Language, then a pointer to the driver name is\r | |
44 | returned in DriverName, and EFI_SUCCESS is returned. If the driver specified\r | |
45 | by This does not support the language specified by Language, then\r | |
46 | EFI_UNSUPPORTED is returned.\r | |
47 | \r | |
48 | @param[in] This A pointer to the EFI_COMPONENT_NAME2_PROTOCOL\r | |
49 | or EFI_COMPONENT_NAME_PROTOCOL instance.\r | |
50 | @param[in] Language A pointer to a Null-terminated ASCII string\r | |
51 | array indicating the language. This is the\r | |
52 | language of the driver name that the caller is\r | |
53 | requesting, and it must match one of the\r | |
54 | languages specified in SupportedLanguages. The\r | |
55 | number of languages supported by a driver is up\r | |
56 | to the driver writer. Language is specified\r | |
57 | in RFC 4646 or ISO 639-2 language code format.\r | |
58 | @param[out] DriverName A pointer to the Unicode string to return. This\r | |
59 | Unicode string is the name of the driver\r | |
60 | specified by This in the language specified by\r | |
61 | Language.\r | |
62 | \r | |
63 | @retval EFI_SUCCESS The Unicode string for the Driver specified by\r | |
64 | This and the language specified by Language was\r | |
65 | returned in DriverName.\r | |
66 | @retval EFI_INVALID_PARAMETER Language is NULL.\r | |
67 | @retval EFI_INVALID_PARAMETER DriverName is NULL.\r | |
68 | @retval EFI_UNSUPPORTED The driver specified by This does not support\r | |
69 | the language specified by Language.\r | |
70 | \r | |
71 | **/\r | |
72 | EFI_STATUS\r | |
73 | EFIAPI\r | |
74 | SioBusComponentNameGetDriverName (\r | |
ac0a286f MK |
75 | IN EFI_COMPONENT_NAME_PROTOCOL *This,\r |
76 | IN CHAR8 *Language,\r | |
77 | OUT CHAR16 **DriverName\r | |
a5cc178a HW |
78 | )\r |
79 | {\r | |
80 | return LookupUnicodeString2 (\r | |
81 | Language,\r | |
82 | This->SupportedLanguages,\r | |
83 | mSioBusDriverNameTable,\r | |
84 | DriverName,\r | |
85 | (BOOLEAN)(This == &gSioBusComponentName)\r | |
86 | );\r | |
87 | }\r | |
88 | \r | |
89 | /**\r | |
90 | Retrieves a Unicode string that is the user readable name of the controller\r | |
91 | that is being managed by a driver.\r | |
92 | \r | |
93 | This function retrieves the user readable name of the controller specified by\r | |
94 | ControllerHandle and ChildHandle in the form of a Unicode string. If the\r | |
95 | driver specified by This has a user readable name in the language specified\r | |
96 | by Language, then a pointer to the controller name is returned in\r | |
97 | ControllerName, and EFI_SUCCESS is returned. If the driver specified by This\r | |
98 | is not currently managing the controller specified by ControllerHandle and\r | |
99 | ChildHandle, then EFI_UNSUPPORTED is returned. If the driver specified by\r | |
100 | This does not support the language specified by Language, then\r | |
101 | EFI_UNSUPPORTED is returned.\r | |
102 | \r | |
103 | @param[in] This A pointer to the EFI_COMPONENT_NAME2_PROTOCOL\r | |
104 | or EFI_COMPONENT_NAME_PROTOCOL instance.\r | |
105 | @param[in] ControllerHandle The handle of a controller that the driver\r | |
106 | specified by This is managing. This handle\r | |
107 | specifies the controller whose name is to be\r | |
108 | returned.\r | |
109 | @param[in] ChildHandle The handle of the child controller to retrieve\r | |
110 | the name of. This is an optional parameter\r | |
111 | that may be NULL. It will be NULL for device\r | |
112 | drivers. It will also be NULL for a bus\r | |
113 | drivers that wish to retrieve the name of the\r | |
114 | bus controller. It will not be NULL for a bus\r | |
115 | driver that wishes to retrieve the name of a\r | |
116 | child controller.\r | |
117 | @param[in] Language A pointer to a Null-terminated ASCII string\r | |
118 | array indicating the language. This is the\r | |
119 | language of the driver name that the caller is\r | |
120 | requesting, and it must match one of the\r | |
121 | languages specified in SupportedLanguages. The\r | |
122 | number of languages supported by a driver is up\r | |
123 | to the driver writer. Language is specified in\r | |
124 | RFC 4646 or ISO 639-2 language code format.\r | |
125 | @param[out] ControllerName A pointer to the Unicode string to return.\r | |
126 | This Unicode string is the name of the\r | |
127 | controller specified by ControllerHandle and\r | |
128 | ChildHandle in the language specified by\r | |
129 | Language from the point of view of the driver\r | |
130 | specified by This.\r | |
131 | \r | |
132 | @retval EFI_SUCCESS The Unicode string for the user readable name\r | |
133 | in the language specified by Language for the\r | |
134 | driver specified by This was returned in\r | |
135 | DriverName.\r | |
136 | @retval EFI_INVALID_PARAMETER ControllerHandle is NULL.\r | |
137 | @retval EFI_INVALID_PARAMETER ChildHandle is not NULL and it is not a valid\r | |
138 | EFI_HANDLE.\r | |
139 | @retval EFI_INVALID_PARAMETER Language is NULL.\r | |
140 | @retval EFI_INVALID_PARAMETER ControllerName is NULL.\r | |
141 | @retval EFI_UNSUPPORTED The driver specified by This is not currently\r | |
142 | managing the controller specified by\r | |
143 | ControllerHandle and ChildHandle.\r | |
144 | @retval EFI_UNSUPPORTED The driver specified by This does not support\r | |
145 | the language specified by Language.\r | |
146 | \r | |
147 | **/\r | |
148 | EFI_STATUS\r | |
149 | EFIAPI\r | |
150 | SioBusComponentNameGetControllerName (\r | |
ac0a286f MK |
151 | IN EFI_COMPONENT_NAME_PROTOCOL *This,\r |
152 | IN EFI_HANDLE ControllerHandle,\r | |
153 | IN EFI_HANDLE ChildHandle OPTIONAL,\r | |
154 | IN CHAR8 *Language,\r | |
155 | OUT CHAR16 **ControllerName\r | |
a5cc178a HW |
156 | )\r |
157 | {\r | |
158 | return EFI_UNSUPPORTED;\r | |
159 | }\r |