]> git.proxmox.com Git - mirror_edk2.git/blob - MdeModulePkg/Bus/Pci/NonDiscoverablePciDeviceDxe/ComponentName.c
MdeModulePkg: Replace BSD License with BSD+Patent License
[mirror_edk2.git] / MdeModulePkg / Bus / Pci / NonDiscoverablePciDeviceDxe / ComponentName.c
1 /** @file
2
3 Copyright (C) 2016, Linaro Ltd. All rights reserved.<BR>
4
5 SPDX-License-Identifier: BSD-2-Clause-Patent
6
7 **/
8
9 #include "NonDiscoverablePciDeviceIo.h"
10
11 //
12 // The purpose of the following scaffolding (EFI_COMPONENT_NAME_PROTOCOL and
13 // EFI_COMPONENT_NAME2_PROTOCOL implementation) is to format the driver's name
14 // in English, for display on standard console devices. This is recommended for
15 // UEFI drivers that follow the UEFI Driver Model. Refer to the Driver Writer's
16 // Guide for UEFI 2.3.1 v1.01, 11 UEFI Driver and Controller Names.
17 //
18
19 STATIC
20 EFI_UNICODE_STRING_TABLE mDriverNameTable[] = {
21 { "eng;en", L"PCI I/O protocol emulation driver for non-discoverable devices" },
22 { NULL, NULL }
23 };
24
25 EFI_COMPONENT_NAME_PROTOCOL gComponentName;
26
27 /**
28 Retrieves a Unicode string that is the user readable name of the UEFI Driver.
29
30 @param This A pointer to the EFI_COMPONENT_NAME_PROTOCOL instance.
31 @param Language A pointer to a three character ISO 639-2 language identifier.
32 This is the language of the driver name that that the caller
33 is requesting, and it must match one of the languages specified
34 in SupportedLanguages. The number of languages supported by a
35 driver is up to the driver writer.
36 @param DriverName A pointer to the Unicode string to return. This Unicode string
37 is the name of the driver specified by This in the language
38 specified by Language.
39
40 @retval EFI_SUCCESS The Unicode string for the Driver specified by This
41 and the language specified by Language was returned
42 in DriverName.
43 @retval EFI_INVALID_PARAMETER Language is NULL.
44 @retval EFI_INVALID_PARAMETER DriverName is NULL.
45 @retval EFI_UNSUPPORTED The driver specified by This does not support the
46 language specified by Language.
47 **/
48 STATIC
49 EFI_STATUS
50 EFIAPI
51 NonDiscoverablePciGetDriverName (
52 IN EFI_COMPONENT_NAME_PROTOCOL *This,
53 IN CHAR8 *Language,
54 OUT CHAR16 **DriverName
55 )
56 {
57 return LookupUnicodeString2 (
58 Language,
59 This->SupportedLanguages,
60 mDriverNameTable,
61 DriverName,
62 (BOOLEAN)(This == &gComponentName) // Iso639Language
63 );
64 }
65
66 /**
67 Retrieves a Unicode string that is the user readable name of the controller
68 that is being managed by an UEFI Driver.
69
70 @param This A pointer to the EFI_COMPONENT_NAME_PROTOCOL instance.
71 @param DeviceHandle The handle of a controller that the driver specified by
72 This is managing. This handle specifies the controller
73 whose name is to be returned.
74 @param ChildHandle The handle of the child controller to retrieve the name
75 of. This is an optional parameter that may be NULL. It
76 will be NULL for device drivers. It will also be NULL
77 for a bus drivers that wish to retrieve the name of the
78 bus controller. It will not be NULL for a bus driver
79 that wishes to retrieve the name of a child controller.
80 @param Language A pointer to a three character ISO 639-2 language
81 identifier. This is the language of the controller name
82 that that the caller is requesting, and it must match one
83 of the languages specified in SupportedLanguages. The
84 number of languages supported by a driver is up to the
85 driver writer.
86 @param ControllerName A pointer to the Unicode string to return. This Unicode
87 string is the name of the controller specified by
88 ControllerHandle and ChildHandle in the language
89 specified by Language from the point of view of the
90 driver specified by This.
91 **/
92 STATIC
93 EFI_STATUS
94 EFIAPI
95 NonDiscoverablePciGetDeviceName (
96 IN EFI_COMPONENT_NAME_PROTOCOL *This,
97 IN EFI_HANDLE DeviceHandle,
98 IN EFI_HANDLE ChildHandle,
99 IN CHAR8 *Language,
100 OUT CHAR16 **ControllerName
101 )
102 {
103 return EFI_UNSUPPORTED;
104 }
105
106 EFI_COMPONENT_NAME_PROTOCOL gComponentName = {
107 &NonDiscoverablePciGetDriverName,
108 &NonDiscoverablePciGetDeviceName,
109 "eng" // SupportedLanguages, ISO 639-2 language codes
110 };
111
112 EFI_COMPONENT_NAME2_PROTOCOL gComponentName2 = {
113 (EFI_COMPONENT_NAME2_GET_DRIVER_NAME) &NonDiscoverablePciGetDriverName,
114 (EFI_COMPONENT_NAME2_GET_CONTROLLER_NAME) &NonDiscoverablePciGetDeviceName,
115 "en" // SupportedLanguages, RFC 4646 language codes
116 };