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