OvmfPkg/MptScsiDxe: Report name of driver
[mirror_edk2.git] / OvmfPkg / MptScsiDxe / MptScsi.c
CommitLineData
feec20b2
NL
1/** @file\r
2\r
3 This driver produces Extended SCSI Pass Thru Protocol instances for\r
4 LSI Fusion MPT SCSI devices.\r
5\r
6 Copyright (C) 2020, Oracle and/or its affiliates.\r
7\r
8 SPDX-License-Identifier: BSD-2-Clause-Patent\r
9\r
10**/\r
11\r
ad8f2d6b 12#include <Library/UefiLib.h>\r
feec20b2
NL
13#include <Uefi/UefiSpec.h>\r
14\r
ad8f2d6b
NL
15//\r
16// Higher versions will be used before lower, 0x10-0xffffffef is the version\r
17// range for IVH (Indie Hardware Vendors)\r
18//\r
19#define MPT_SCSI_BINDING_VERSION 0x10\r
20\r
21//\r
22// Driver Binding\r
23//\r
24\r
25STATIC\r
26EFI_STATUS\r
27EFIAPI\r
28MptScsiControllerSupported (\r
29 IN EFI_DRIVER_BINDING_PROTOCOL *This,\r
30 IN EFI_HANDLE ControllerHandle,\r
31 IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath OPTIONAL\r
32 )\r
33{\r
34 return EFI_UNSUPPORTED;\r
35}\r
36\r
37STATIC\r
38EFI_STATUS\r
39EFIAPI\r
40MptScsiControllerStart (\r
41 IN EFI_DRIVER_BINDING_PROTOCOL *This,\r
42 IN EFI_HANDLE ControllerHandle,\r
43 IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath OPTIONAL\r
44 )\r
45{\r
46 return EFI_UNSUPPORTED;\r
47}\r
48\r
49STATIC\r
50EFI_STATUS\r
51EFIAPI\r
52MptScsiControllerStop (\r
53 IN EFI_DRIVER_BINDING_PROTOCOL *This,\r
54 IN EFI_HANDLE ControllerHandle,\r
55 IN UINTN NumberOfChildren,\r
56 IN EFI_HANDLE *ChildHandleBuffer\r
57 )\r
58{\r
59 return EFI_UNSUPPORTED;\r
60}\r
61\r
62STATIC\r
63EFI_DRIVER_BINDING_PROTOCOL mMptScsiDriverBinding = {\r
64 &MptScsiControllerSupported,\r
65 &MptScsiControllerStart,\r
66 &MptScsiControllerStop,\r
67 MPT_SCSI_BINDING_VERSION,\r
68 NULL, // ImageHandle, filled by EfiLibInstallDriverBindingComponentName2\r
69 NULL, // DriverBindingHandle, filled as well\r
70};\r
71\r
be7fcaa1
NL
72//\r
73// Component Name\r
74//\r
75\r
76STATIC\r
77EFI_UNICODE_STRING_TABLE mDriverNameTable[] = {\r
78 { "eng;en", L"LSI Fusion MPT SCSI Driver" },\r
79 { NULL, NULL }\r
80};\r
81\r
82STATIC\r
83EFI_COMPONENT_NAME_PROTOCOL mComponentName;\r
84\r
85EFI_STATUS\r
86EFIAPI\r
87MptScsiGetDriverName (\r
88 IN EFI_COMPONENT_NAME_PROTOCOL *This,\r
89 IN CHAR8 *Language,\r
90 OUT CHAR16 **DriverName\r
91 )\r
92{\r
93 return LookupUnicodeString2 (\r
94 Language,\r
95 This->SupportedLanguages,\r
96 mDriverNameTable,\r
97 DriverName,\r
98 (BOOLEAN)(This == &mComponentName) // Iso639Language\r
99 );\r
100}\r
101\r
102EFI_STATUS\r
103EFIAPI\r
104MptScsiGetDeviceName (\r
105 IN EFI_COMPONENT_NAME_PROTOCOL *This,\r
106 IN EFI_HANDLE DeviceHandle,\r
107 IN EFI_HANDLE ChildHandle,\r
108 IN CHAR8 *Language,\r
109 OUT CHAR16 **ControllerName\r
110 )\r
111{\r
112 return EFI_UNSUPPORTED;\r
113}\r
114\r
115STATIC\r
116EFI_COMPONENT_NAME_PROTOCOL mComponentName = {\r
117 &MptScsiGetDriverName,\r
118 &MptScsiGetDeviceName,\r
119 "eng" // SupportedLanguages, ISO 639-2 language codes\r
120};\r
121\r
122STATIC\r
123EFI_COMPONENT_NAME2_PROTOCOL mComponentName2 = {\r
124 (EFI_COMPONENT_NAME2_GET_DRIVER_NAME) &MptScsiGetDriverName,\r
125 (EFI_COMPONENT_NAME2_GET_CONTROLLER_NAME) &MptScsiGetDeviceName,\r
126 "en" // SupportedLanguages, RFC 4646 language codes\r
127};\r
128\r
feec20b2
NL
129//\r
130// Entry Point\r
131//\r
132\r
133EFI_STATUS\r
134EFIAPI\r
135MptScsiEntryPoint (\r
136 IN EFI_HANDLE ImageHandle,\r
137 IN EFI_SYSTEM_TABLE *SystemTable\r
138 )\r
139{\r
ad8f2d6b
NL
140 return EfiLibInstallDriverBindingComponentName2 (\r
141 ImageHandle,\r
142 SystemTable,\r
143 &mMptScsiDriverBinding,\r
144 ImageHandle, // The handle to install onto\r
be7fcaa1
NL
145 &mComponentName,\r
146 &mComponentName2\r
ad8f2d6b 147 );\r
feec20b2 148}\r