]>
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 | |
15 | GLOBAL_REMOVE_IF_UNREFERENCED EFI_UNICODE_STRING_TABLE mSioBusDriverNameTable[] = {\r | |
16 | { "eng;en", L"OVMF Sio Bus Driver" },\r | |
17 | { NULL , NULL }\r | |
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 | |
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 | |
35 | "en"\r | |
36 | };\r | |
37 | \r | |
38 | \r | |
39 | /**\r | |
40 | Retrieves a Unicode string that is the user readable name of the driver.\r | |
41 | \r | |
42 | This function retrieves the user readable name of a driver in the form of a\r | |
43 | Unicode string. If the driver specified by This has a user readable name in\r | |
44 | the language specified by Language, then a pointer to the driver name is\r | |
45 | returned in DriverName, and EFI_SUCCESS is returned. If the driver specified\r | |
46 | by This does not support the language specified by Language, then\r | |
47 | EFI_UNSUPPORTED is returned.\r | |
48 | \r | |
49 | @param[in] This A pointer to the EFI_COMPONENT_NAME2_PROTOCOL\r | |
50 | or EFI_COMPONENT_NAME_PROTOCOL instance.\r | |
51 | @param[in] Language A pointer to a Null-terminated ASCII string\r | |
52 | array indicating the language. This is the\r | |
53 | language of the driver name that the caller is\r | |
54 | requesting, and it must match one of the\r | |
55 | languages specified in SupportedLanguages. The\r | |
56 | number of languages supported by a driver is up\r | |
57 | to the driver writer. Language is specified\r | |
58 | in RFC 4646 or ISO 639-2 language code format.\r | |
59 | @param[out] DriverName A pointer to the Unicode string to return. This\r | |
60 | Unicode string is the name of the driver\r | |
61 | specified by This in the language specified by\r | |
62 | Language.\r | |
63 | \r | |
64 | @retval EFI_SUCCESS The Unicode string for the Driver specified by\r | |
65 | This and the language specified by Language was\r | |
66 | returned in DriverName.\r | |
67 | @retval EFI_INVALID_PARAMETER Language is NULL.\r | |
68 | @retval EFI_INVALID_PARAMETER DriverName is NULL.\r | |
69 | @retval EFI_UNSUPPORTED The driver specified by This does not support\r | |
70 | the language specified by Language.\r | |
71 | \r | |
72 | **/\r | |
73 | EFI_STATUS\r | |
74 | EFIAPI\r | |
75 | SioBusComponentNameGetDriverName (\r | |
76 | IN EFI_COMPONENT_NAME_PROTOCOL *This,\r | |
77 | IN CHAR8 *Language,\r | |
78 | OUT CHAR16 **DriverName\r | |
79 | )\r | |
80 | {\r | |
81 | return LookupUnicodeString2 (\r | |
82 | Language,\r | |
83 | This->SupportedLanguages,\r | |
84 | mSioBusDriverNameTable,\r | |
85 | DriverName,\r | |
86 | (BOOLEAN)(This == &gSioBusComponentName)\r | |
87 | );\r | |
88 | }\r | |
89 | \r | |
90 | /**\r | |
91 | Retrieves a Unicode string that is the user readable name of the controller\r | |
92 | that is being managed by a driver.\r | |
93 | \r | |
94 | This function retrieves the user readable name of the controller specified by\r | |
95 | ControllerHandle and ChildHandle in the form of a Unicode string. If the\r | |
96 | driver specified by This has a user readable name in the language specified\r | |
97 | by Language, then a pointer to the controller name is returned in\r | |
98 | ControllerName, and EFI_SUCCESS is returned. If the driver specified by This\r | |
99 | is not currently managing the controller specified by ControllerHandle and\r | |
100 | ChildHandle, then EFI_UNSUPPORTED is returned. If the driver specified by\r | |
101 | This does not support the language specified by Language, then\r | |
102 | EFI_UNSUPPORTED is returned.\r | |
103 | \r | |
104 | @param[in] This A pointer to the EFI_COMPONENT_NAME2_PROTOCOL\r | |
105 | or EFI_COMPONENT_NAME_PROTOCOL instance.\r | |
106 | @param[in] ControllerHandle The handle of a controller that the driver\r | |
107 | specified by This is managing. This handle\r | |
108 | specifies the controller whose name is to be\r | |
109 | returned.\r | |
110 | @param[in] ChildHandle The handle of the child controller to retrieve\r | |
111 | the name of. This is an optional parameter\r | |
112 | that may be NULL. It will be NULL for device\r | |
113 | drivers. It will also be NULL for a bus\r | |
114 | drivers that wish to retrieve the name of the\r | |
115 | bus controller. It will not be NULL for a bus\r | |
116 | driver that wishes to retrieve the name of a\r | |
117 | child controller.\r | |
118 | @param[in] Language A pointer to a Null-terminated ASCII string\r | |
119 | array indicating the language. This is the\r | |
120 | language of the driver name that the caller is\r | |
121 | requesting, and it must match one of the\r | |
122 | languages specified in SupportedLanguages. The\r | |
123 | number of languages supported by a driver is up\r | |
124 | to the driver writer. Language is specified in\r | |
125 | RFC 4646 or ISO 639-2 language code format.\r | |
126 | @param[out] ControllerName A pointer to the Unicode string to return.\r | |
127 | This Unicode string is the name of the\r | |
128 | controller specified by ControllerHandle and\r | |
129 | ChildHandle in the language specified by\r | |
130 | Language from the point of view of the driver\r | |
131 | specified by This.\r | |
132 | \r | |
133 | @retval EFI_SUCCESS The Unicode string for the user readable name\r | |
134 | in the language specified by Language for the\r | |
135 | driver specified by This was returned in\r | |
136 | DriverName.\r | |
137 | @retval EFI_INVALID_PARAMETER ControllerHandle is NULL.\r | |
138 | @retval EFI_INVALID_PARAMETER ChildHandle is not NULL and it is not a valid\r | |
139 | EFI_HANDLE.\r | |
140 | @retval EFI_INVALID_PARAMETER Language is NULL.\r | |
141 | @retval EFI_INVALID_PARAMETER ControllerName is NULL.\r | |
142 | @retval EFI_UNSUPPORTED The driver specified by This is not currently\r | |
143 | managing the controller specified by\r | |
144 | ControllerHandle and ChildHandle.\r | |
145 | @retval EFI_UNSUPPORTED The driver specified by This does not support\r | |
146 | the language specified by Language.\r | |
147 | \r | |
148 | **/\r | |
149 | EFI_STATUS\r | |
150 | EFIAPI\r | |
151 | SioBusComponentNameGetControllerName (\r | |
152 | IN EFI_COMPONENT_NAME_PROTOCOL *This,\r | |
153 | IN EFI_HANDLE ControllerHandle,\r | |
154 | IN EFI_HANDLE ChildHandle OPTIONAL,\r | |
155 | IN CHAR8 *Language,\r | |
156 | OUT CHAR16 **ControllerName\r | |
157 | )\r | |
158 | {\r | |
159 | return EFI_UNSUPPORTED;\r | |
160 | }\r |