]> git.proxmox.com Git - mirror_edk2.git/blob - OvmfPkg/SioBusDxe/ComponentName.c
OvmfPkg: Add an Super IO bus driver
[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 This program and the accompanying materials
7 are licensed and made available under the terms and conditions
8 of the BSD License which accompanies this distribution. The
9 full text of the license may be found at
10 http://opensource.org/licenses/bsd-license.php
11
12 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
13 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
14
15 **/
16
17 #include "SioBusDxe.h"
18
19 //
20 // Driver name table
21 //
22 GLOBAL_REMOVE_IF_UNREFERENCED EFI_UNICODE_STRING_TABLE mSioBusDriverNameTable[] = {
23 { "eng;en", L"OVMF Sio Bus Driver" },
24 { NULL , NULL }
25 };
26
27 //
28 // EFI Component Name Protocol
29 //
30 GLOBAL_REMOVE_IF_UNREFERENCED EFI_COMPONENT_NAME_PROTOCOL gSioBusComponentName = {
31 SioBusComponentNameGetDriverName,
32 SioBusComponentNameGetControllerName,
33 "eng"
34 };
35
36 //
37 // EFI Component Name 2 Protocol
38 //
39 GLOBAL_REMOVE_IF_UNREFERENCED EFI_COMPONENT_NAME2_PROTOCOL gSioBusComponentName2 = {
40 (EFI_COMPONENT_NAME2_GET_DRIVER_NAME) SioBusComponentNameGetDriverName,
41 (EFI_COMPONENT_NAME2_GET_CONTROLLER_NAME) SioBusComponentNameGetControllerName,
42 "en"
43 };
44
45
46 /**
47 Retrieves a Unicode string that is the user readable name of the driver.
48
49 This function retrieves the user readable name of a driver in the form of a
50 Unicode string. If the driver specified by This has a user readable name in
51 the language specified by Language, then a pointer to the driver name is
52 returned in DriverName, and EFI_SUCCESS is returned. If the driver specified
53 by This does not support the language specified by Language, then
54 EFI_UNSUPPORTED is returned.
55
56 @param[in] This A pointer to the EFI_COMPONENT_NAME2_PROTOCOL
57 or EFI_COMPONENT_NAME_PROTOCOL instance.
58 @param[in] Language A pointer to a Null-terminated ASCII string
59 array indicating the language. This is the
60 language of the driver name that the caller is
61 requesting, and it must match one of the
62 languages specified in SupportedLanguages. The
63 number of languages supported by a driver is up
64 to the driver writer. Language is specified
65 in RFC 4646 or ISO 639-2 language code format.
66 @param[out] DriverName A pointer to the Unicode string to return. This
67 Unicode string is the name of the driver
68 specified by This in the language specified by
69 Language.
70
71 @retval EFI_SUCCESS The Unicode string for the Driver specified by
72 This and the language specified by Language was
73 returned in DriverName.
74 @retval EFI_INVALID_PARAMETER Language is NULL.
75 @retval EFI_INVALID_PARAMETER DriverName is NULL.
76 @retval EFI_UNSUPPORTED The driver specified by This does not support
77 the language specified by Language.
78
79 **/
80 EFI_STATUS
81 EFIAPI
82 SioBusComponentNameGetDriverName (
83 IN EFI_COMPONENT_NAME_PROTOCOL *This,
84 IN CHAR8 *Language,
85 OUT CHAR16 **DriverName
86 )
87 {
88 return LookupUnicodeString2 (
89 Language,
90 This->SupportedLanguages,
91 mSioBusDriverNameTable,
92 DriverName,
93 (BOOLEAN)(This == &gSioBusComponentName)
94 );
95 }
96
97 /**
98 Retrieves a Unicode string that is the user readable name of the controller
99 that is being managed by a driver.
100
101 This function retrieves the user readable name of the controller specified by
102 ControllerHandle and ChildHandle in the form of a Unicode string. If the
103 driver specified by This has a user readable name in the language specified
104 by Language, then a pointer to the controller name is returned in
105 ControllerName, and EFI_SUCCESS is returned. If the driver specified by This
106 is not currently managing the controller specified by ControllerHandle and
107 ChildHandle, then EFI_UNSUPPORTED is returned. If the driver specified by
108 This does not support the language specified by Language, then
109 EFI_UNSUPPORTED is returned.
110
111 @param[in] This A pointer to the EFI_COMPONENT_NAME2_PROTOCOL
112 or EFI_COMPONENT_NAME_PROTOCOL instance.
113 @param[in] ControllerHandle The handle of a controller that the driver
114 specified by This is managing. This handle
115 specifies the controller whose name is to be
116 returned.
117 @param[in] ChildHandle The handle of the child controller to retrieve
118 the name of. This is an optional parameter
119 that may be NULL. It will be NULL for device
120 drivers. It will also be NULL for a bus
121 drivers that wish to retrieve the name of the
122 bus controller. It will not be NULL for a bus
123 driver that wishes to retrieve the name of a
124 child controller.
125 @param[in] Language A pointer to a Null-terminated ASCII string
126 array indicating the language. This is the
127 language of the driver name that the caller is
128 requesting, and it must match one of the
129 languages specified in SupportedLanguages. The
130 number of languages supported by a driver is up
131 to the driver writer. Language is specified in
132 RFC 4646 or ISO 639-2 language code format.
133 @param[out] ControllerName A pointer to the Unicode string to return.
134 This Unicode string is the name of the
135 controller specified by ControllerHandle and
136 ChildHandle in the language specified by
137 Language from the point of view of the driver
138 specified by This.
139
140 @retval EFI_SUCCESS The Unicode string for the user readable name
141 in the language specified by Language for the
142 driver specified by This was returned in
143 DriverName.
144 @retval EFI_INVALID_PARAMETER ControllerHandle is NULL.
145 @retval EFI_INVALID_PARAMETER ChildHandle is not NULL and it is not a valid
146 EFI_HANDLE.
147 @retval EFI_INVALID_PARAMETER Language is NULL.
148 @retval EFI_INVALID_PARAMETER ControllerName is NULL.
149 @retval EFI_UNSUPPORTED The driver specified by This is not currently
150 managing the controller specified by
151 ControllerHandle and ChildHandle.
152 @retval EFI_UNSUPPORTED The driver specified by This does not support
153 the language specified by Language.
154
155 **/
156 EFI_STATUS
157 EFIAPI
158 SioBusComponentNameGetControllerName (
159 IN EFI_COMPONENT_NAME_PROTOCOL *This,
160 IN EFI_HANDLE ControllerHandle,
161 IN EFI_HANDLE ChildHandle OPTIONAL,
162 IN CHAR8 *Language,
163 OUT CHAR16 **ControllerName
164 )
165 {
166 return EFI_UNSUPPORTED;
167 }