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