2020-03-28 21:00:44 +01:00
|
|
|
/** @file
|
|
|
|
|
|
|
|
This driver produces Extended SCSI Pass Thru Protocol instances for
|
|
|
|
pvscsi devices.
|
|
|
|
|
|
|
|
Copyright (C) 2020, Oracle and/or its affiliates.
|
|
|
|
|
|
|
|
SPDX-License-Identifier: BSD-2-Clause-Patent
|
|
|
|
|
|
|
|
**/
|
|
|
|
|
2020-03-28 21:00:45 +01:00
|
|
|
#include <Library/UefiLib.h>
|
2020-03-28 21:00:44 +01:00
|
|
|
#include <Uefi/UefiSpec.h>
|
|
|
|
|
2020-03-28 21:00:45 +01:00
|
|
|
//
|
|
|
|
// Higher versions will be used before lower, 0x10-0xffffffef is the version
|
|
|
|
// range for IHV (Indie Hardware Vendors)
|
|
|
|
//
|
|
|
|
#define PVSCSI_BINDING_VERSION 0x10
|
|
|
|
|
|
|
|
//
|
|
|
|
// Driver Binding
|
|
|
|
//
|
|
|
|
|
|
|
|
STATIC
|
|
|
|
EFI_STATUS
|
|
|
|
EFIAPI
|
|
|
|
PvScsiDriverBindingSupported (
|
|
|
|
IN EFI_DRIVER_BINDING_PROTOCOL *This,
|
|
|
|
IN EFI_HANDLE ControllerHandle,
|
|
|
|
IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath OPTIONAL
|
|
|
|
)
|
|
|
|
{
|
|
|
|
return EFI_UNSUPPORTED;
|
|
|
|
}
|
|
|
|
|
|
|
|
STATIC
|
|
|
|
EFI_STATUS
|
|
|
|
EFIAPI
|
|
|
|
PvScsiDriverBindingStart (
|
|
|
|
IN EFI_DRIVER_BINDING_PROTOCOL *This,
|
|
|
|
IN EFI_HANDLE ControllerHandle,
|
|
|
|
IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath OPTIONAL
|
|
|
|
)
|
|
|
|
{
|
|
|
|
return EFI_UNSUPPORTED;
|
|
|
|
}
|
|
|
|
|
|
|
|
STATIC
|
|
|
|
EFI_STATUS
|
|
|
|
EFIAPI
|
|
|
|
PvScsiDriverBindingStop (
|
|
|
|
IN EFI_DRIVER_BINDING_PROTOCOL *This,
|
|
|
|
IN EFI_HANDLE ControllerHandle,
|
|
|
|
IN UINTN NumberOfChildren,
|
|
|
|
IN EFI_HANDLE *ChildHandleBuffer
|
|
|
|
)
|
|
|
|
{
|
|
|
|
return EFI_UNSUPPORTED;
|
|
|
|
}
|
|
|
|
|
|
|
|
STATIC EFI_DRIVER_BINDING_PROTOCOL mPvScsiDriverBinding = {
|
|
|
|
&PvScsiDriverBindingSupported,
|
|
|
|
&PvScsiDriverBindingStart,
|
|
|
|
&PvScsiDriverBindingStop,
|
|
|
|
PVSCSI_BINDING_VERSION,
|
|
|
|
NULL, // ImageHandle, filled by EfiLibInstallDriverBindingComponentName2()
|
|
|
|
NULL // DriverBindingHandle, filled as well
|
|
|
|
};
|
|
|
|
|
2020-03-28 21:00:46 +01:00
|
|
|
//
|
|
|
|
// Component Name
|
|
|
|
//
|
|
|
|
|
|
|
|
STATIC EFI_UNICODE_STRING_TABLE mDriverNameTable[] = {
|
|
|
|
{ "eng;en", L"PVSCSI Host Driver" },
|
|
|
|
{ NULL, NULL }
|
|
|
|
};
|
|
|
|
|
|
|
|
STATIC EFI_COMPONENT_NAME_PROTOCOL mComponentName;
|
|
|
|
|
|
|
|
STATIC
|
|
|
|
EFI_STATUS
|
|
|
|
EFIAPI
|
|
|
|
PvScsiGetDriverName (
|
|
|
|
IN EFI_COMPONENT_NAME_PROTOCOL *This,
|
|
|
|
IN CHAR8 *Language,
|
|
|
|
OUT CHAR16 **DriverName
|
|
|
|
)
|
|
|
|
{
|
|
|
|
return LookupUnicodeString2 (
|
|
|
|
Language,
|
|
|
|
This->SupportedLanguages,
|
|
|
|
mDriverNameTable,
|
|
|
|
DriverName,
|
|
|
|
(BOOLEAN)(This == &mComponentName) // Iso639Language
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
STATIC
|
|
|
|
EFI_STATUS
|
|
|
|
EFIAPI
|
|
|
|
PvScsiGetDeviceName (
|
|
|
|
IN EFI_COMPONENT_NAME_PROTOCOL *This,
|
|
|
|
IN EFI_HANDLE DeviceHandle,
|
|
|
|
IN EFI_HANDLE ChildHandle,
|
|
|
|
IN CHAR8 *Language,
|
|
|
|
OUT CHAR16 **ControllerName
|
|
|
|
)
|
|
|
|
{
|
|
|
|
return EFI_UNSUPPORTED;
|
|
|
|
}
|
|
|
|
|
|
|
|
STATIC EFI_COMPONENT_NAME_PROTOCOL mComponentName = {
|
|
|
|
&PvScsiGetDriverName,
|
|
|
|
&PvScsiGetDeviceName,
|
|
|
|
"eng" // SupportedLanguages, ISO 639-2 language codes
|
|
|
|
};
|
|
|
|
|
|
|
|
STATIC EFI_COMPONENT_NAME2_PROTOCOL mComponentName2 = {
|
|
|
|
(EFI_COMPONENT_NAME2_GET_DRIVER_NAME) &PvScsiGetDriverName,
|
|
|
|
(EFI_COMPONENT_NAME2_GET_CONTROLLER_NAME) &PvScsiGetDeviceName,
|
|
|
|
"en" // SupportedLanguages, RFC 4646 language codes
|
|
|
|
};
|
|
|
|
|
2020-03-28 21:00:44 +01:00
|
|
|
//
|
|
|
|
// Entry Point
|
|
|
|
//
|
|
|
|
|
|
|
|
EFI_STATUS
|
|
|
|
EFIAPI
|
|
|
|
PvScsiEntryPoint (
|
|
|
|
IN EFI_HANDLE ImageHandle,
|
|
|
|
IN EFI_SYSTEM_TABLE *SystemTable
|
|
|
|
)
|
|
|
|
{
|
2020-03-28 21:00:45 +01:00
|
|
|
return EfiLibInstallDriverBindingComponentName2 (
|
|
|
|
ImageHandle,
|
|
|
|
SystemTable,
|
|
|
|
&mPvScsiDriverBinding,
|
|
|
|
ImageHandle,
|
2020-03-28 21:00:46 +01:00
|
|
|
&mComponentName,
|
|
|
|
&mComponentName2
|
2020-03-28 21:00:45 +01:00
|
|
|
);
|
2020-03-28 21:00:44 +01:00
|
|
|
}
|