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