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