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