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