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