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