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