OvmfPkg: remove BLOCK_MMIO_PROTOCOL and BlockMmioToBlockIoDxe
BLOCK_MMIO_PROTOCOL and BlockMmioToBlockIoDxe were introduced to OvmfPkg in March 2010, in adjacent commitsb0f5144676
andefd82c5794
. In the past eight years, no driver or application seems to have materialized that produced BLOCK_MMIO_PROTOCOL instances. Meanwhile the UEFI spec has developed the EFI_RAM_DISK_PROTOCOL, which edk2 implements (and OVMF includes) as RamDiskDxe. Rather than fixing issues in the unused BlockMmioToBlockIoDxe driver, remove the driver, together with the BLOCK_MMIO_PROTOCOL definition that now becomes unused too. Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org> Cc: Jordan Justen <jordan.l.justen@intel.com> Cc: Steven Shi <steven.shi@intel.com> Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=926 Reported-by: Steven Shi <steven.shi@intel.com> Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Laszlo Ersek <lersek@redhat.com> Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
This commit is contained in:
@@ -1,528 +0,0 @@
|
|||||||
/** @file
|
|
||||||
The driver wrappers BlockMmio protocol instances to produce
|
|
||||||
Block I/O Protocol instances.
|
|
||||||
|
|
||||||
Copyright (c) 2007 - 2012, Intel Corporation. All rights reserved.<BR>
|
|
||||||
This program and the accompanying materials
|
|
||||||
are licensed and made available under the terms and conditions of the BSD License
|
|
||||||
which accompanies this distribution. The full text of the license may be found at
|
|
||||||
http://opensource.org/licenses/bsd-license.php
|
|
||||||
|
|
||||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
|
||||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
|
||||||
|
|
||||||
**/
|
|
||||||
|
|
||||||
#include "BlockIo.h"
|
|
||||||
|
|
||||||
EFI_DRIVER_BINDING_PROTOCOL gBlockIoDriverBinding = {
|
|
||||||
BlockIoDriverBindingSupported,
|
|
||||||
BlockIoDriverBindingStart,
|
|
||||||
BlockIoDriverBindingStop,
|
|
||||||
0x11,
|
|
||||||
NULL,
|
|
||||||
NULL
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
Reset the block device.
|
|
||||||
|
|
||||||
This function implements EFI_BLOCK_IO_PROTOCOL.Reset().
|
|
||||||
It resets the block device hardware.
|
|
||||||
ExtendedVerification is ignored in this implementation.
|
|
||||||
|
|
||||||
@param This Indicates a pointer to the calling context.
|
|
||||||
@param ExtendedVerification Indicates that the driver may perform a more exhaustive
|
|
||||||
verification operation of the device during reset.
|
|
||||||
|
|
||||||
@retval EFI_SUCCESS The block device was reset.
|
|
||||||
@retval EFI_DEVICE_ERROR The block device is not functioning correctly and could not be reset.
|
|
||||||
|
|
||||||
**/
|
|
||||||
EFI_STATUS
|
|
||||||
EFIAPI
|
|
||||||
BlockIoReset (
|
|
||||||
IN EFI_BLOCK_IO_PROTOCOL *This,
|
|
||||||
IN BOOLEAN ExtendedVerification
|
|
||||||
)
|
|
||||||
{
|
|
||||||
return EFI_SUCCESS;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
Reads the requested number of blocks from the device.
|
|
||||||
|
|
||||||
This function implements EFI_BLOCK_IO_PROTOCOL.ReadBlocks().
|
|
||||||
It reads the requested number of blocks from the device.
|
|
||||||
All the blocks are read, or an error is returned.
|
|
||||||
|
|
||||||
@param This Indicates a pointer to the calling context.
|
|
||||||
@param ReadData If TRUE then read data. If FALSE then write data.
|
|
||||||
@param MediaId The media ID that the read request is for.
|
|
||||||
@param Lba The starting logical block address to read from on the device.
|
|
||||||
@param BufferSize The size of the Buffer in bytes.
|
|
||||||
This must be a multiple of the intrinsic block size of the device.
|
|
||||||
@param Buffer A pointer to the destination buffer for the data. The caller is
|
|
||||||
responsible for either having implicit or explicit ownership of the buffer.
|
|
||||||
|
|
||||||
@retval EFI_SUCCESS The data was read correctly from the device.
|
|
||||||
@retval EFI_DEVICE_ERROR The device reported an error while attempting to perform the read operation.
|
|
||||||
@retval EFI_NO_MEDIA There is no media in the device.
|
|
||||||
@retval EFI_MEDIA_CHANGED The MediaId is not for the current media.
|
|
||||||
@retval EFI_BAD_BUFFER_SIZE The BufferSize parameter is not a multiple of the intrinsic block size of the device.
|
|
||||||
@retval EFI_INVALID_PARAMETER The read request contains LBAs that are not valid,
|
|
||||||
or the buffer is not on proper alignment.
|
|
||||||
|
|
||||||
**/
|
|
||||||
EFI_STATUS
|
|
||||||
EFIAPI
|
|
||||||
ReadOrWriteBlocks (
|
|
||||||
IN EFI_BLOCK_IO_PROTOCOL *This,
|
|
||||||
IN BOOLEAN ReadData,
|
|
||||||
IN UINT32 MediaId,
|
|
||||||
IN EFI_LBA Lba,
|
|
||||||
IN UINTN BufferSize,
|
|
||||||
OUT VOID *Buffer
|
|
||||||
)
|
|
||||||
{
|
|
||||||
EFI_STATUS Status;
|
|
||||||
BLOCK_MMIO_TO_BLOCK_IO_DEVICE *Private;
|
|
||||||
UINTN TotalBlock;
|
|
||||||
EFI_BLOCK_IO_MEDIA *Media;
|
|
||||||
UINT64 Address;
|
|
||||||
UINTN Count;
|
|
||||||
EFI_CPU_IO_PROTOCOL_IO_MEM CpuAccessFunction;
|
|
||||||
|
|
||||||
//
|
|
||||||
// First, validate the parameters
|
|
||||||
//
|
|
||||||
if ((Buffer == NULL) || (BufferSize == 0)) {
|
|
||||||
return EFI_INVALID_PARAMETER;
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
// Get private data structure
|
|
||||||
//
|
|
||||||
Private = PRIVATE_FROM_BLOCK_IO (This);
|
|
||||||
Media = Private->BlockMmio->Media;
|
|
||||||
|
|
||||||
//
|
|
||||||
// BufferSize must be a multiple of the intrinsic block size of the device.
|
|
||||||
//
|
|
||||||
if (ModU64x32 (BufferSize, Media->BlockSize) != 0) {
|
|
||||||
return EFI_BAD_BUFFER_SIZE;
|
|
||||||
}
|
|
||||||
|
|
||||||
TotalBlock = (UINTN) DivU64x32 (BufferSize, Media->BlockSize);
|
|
||||||
|
|
||||||
//
|
|
||||||
// Make sure the range to read is valid.
|
|
||||||
//
|
|
||||||
if (Lba + TotalBlock - 1 > Media->LastBlock) {
|
|
||||||
return EFI_INVALID_PARAMETER;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!(Media->MediaPresent)) {
|
|
||||||
return EFI_NO_MEDIA;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (MediaId != Media->MediaId) {
|
|
||||||
return EFI_MEDIA_CHANGED;
|
|
||||||
}
|
|
||||||
|
|
||||||
Address = Private->BlockMmio->BaseAddress;
|
|
||||||
Address += MultU64x32 (Lba, Media->BlockSize);
|
|
||||||
|
|
||||||
Count = BufferSize >> 3;
|
|
||||||
|
|
||||||
if (ReadData) {
|
|
||||||
CpuAccessFunction = Private->CpuIo->Mem.Read;
|
|
||||||
} else {
|
|
||||||
CpuAccessFunction = Private->CpuIo->Mem.Write;
|
|
||||||
}
|
|
||||||
|
|
||||||
Status = (CpuAccessFunction) (
|
|
||||||
Private->CpuIo,
|
|
||||||
EfiCpuIoWidthUint64,
|
|
||||||
Address,
|
|
||||||
Count,
|
|
||||||
Buffer
|
|
||||||
);
|
|
||||||
|
|
||||||
return Status;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
Reads the requested number of blocks from the device.
|
|
||||||
|
|
||||||
This function implements EFI_BLOCK_IO_PROTOCOL.ReadBlocks().
|
|
||||||
It reads the requested number of blocks from the device.
|
|
||||||
All the blocks are read, or an error is returned.
|
|
||||||
|
|
||||||
@param This Indicates a pointer to the calling context.
|
|
||||||
@param MediaId The media ID that the read request is for.
|
|
||||||
@param Lba The starting logical block address to read from on the device.
|
|
||||||
@param BufferSize The size of the Buffer in bytes.
|
|
||||||
This must be a multiple of the intrinsic block size of the device.
|
|
||||||
@param Buffer A pointer to the destination buffer for the data. The caller is
|
|
||||||
responsible for either having implicit or explicit ownership of the buffer.
|
|
||||||
|
|
||||||
@retval EFI_SUCCESS The data was read correctly from the device.
|
|
||||||
@retval EFI_DEVICE_ERROR The device reported an error while attempting to perform the read operation.
|
|
||||||
@retval EFI_NO_MEDIA There is no media in the device.
|
|
||||||
@retval EFI_MEDIA_CHANGED The MediaId is not for the current media.
|
|
||||||
@retval EFI_BAD_BUFFER_SIZE The BufferSize parameter is not a multiple of the intrinsic block size of the device.
|
|
||||||
@retval EFI_INVALID_PARAMETER The read request contains LBAs that are not valid,
|
|
||||||
or the buffer is not on proper alignment.
|
|
||||||
|
|
||||||
**/
|
|
||||||
EFI_STATUS
|
|
||||||
EFIAPI
|
|
||||||
BlockIoReadBlocks (
|
|
||||||
IN EFI_BLOCK_IO_PROTOCOL *This,
|
|
||||||
IN UINT32 MediaId,
|
|
||||||
IN EFI_LBA Lba,
|
|
||||||
IN UINTN BufferSize,
|
|
||||||
OUT VOID *Buffer
|
|
||||||
)
|
|
||||||
{
|
|
||||||
DEBUG ((EFI_D_INFO, "BlockIo (MMIO) ReadBlocks: lba=0x%Lx, size=0x%Lx\n",
|
|
||||||
Lba, (UINT64)BufferSize));
|
|
||||||
return ReadOrWriteBlocks (
|
|
||||||
This,
|
|
||||||
TRUE,
|
|
||||||
MediaId,
|
|
||||||
Lba,
|
|
||||||
BufferSize,
|
|
||||||
Buffer
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
Writes a specified number of blocks to the device.
|
|
||||||
|
|
||||||
This function implements EFI_BLOCK_IO_PROTOCOL.WriteBlocks().
|
|
||||||
It writes a specified number of blocks to the device.
|
|
||||||
All blocks are written, or an error is returned.
|
|
||||||
|
|
||||||
@param This Indicates a pointer to the calling context.
|
|
||||||
@param MediaId The media ID that the write request is for.
|
|
||||||
@param Lba The starting logical block address to be written.
|
|
||||||
@param BufferSize The size of the Buffer in bytes.
|
|
||||||
This must be a multiple of the intrinsic block size of the device.
|
|
||||||
@param Buffer Pointer to the source buffer for the data.
|
|
||||||
|
|
||||||
@retval EFI_SUCCESS The data were written correctly to the device.
|
|
||||||
@retval EFI_WRITE_PROTECTED The device cannot be written to.
|
|
||||||
@retval EFI_NO_MEDIA There is no media in the device.
|
|
||||||
@retval EFI_MEDIA_CHANGED The MediaId is not for the current media.
|
|
||||||
@retval EFI_DEVICE_ERROR The device reported an error while attempting to perform the write operation.
|
|
||||||
@retval EFI_BAD_BUFFER_SIZE The BufferSize parameter is not a multiple of the intrinsic
|
|
||||||
block size of the device.
|
|
||||||
@retval EFI_INVALID_PARAMETER The write request contains LBAs that are not valid,
|
|
||||||
or the buffer is not on proper alignment.
|
|
||||||
|
|
||||||
**/
|
|
||||||
EFI_STATUS
|
|
||||||
EFIAPI
|
|
||||||
BlockIoWriteBlocks (
|
|
||||||
IN EFI_BLOCK_IO_PROTOCOL *This,
|
|
||||||
IN UINT32 MediaId,
|
|
||||||
IN EFI_LBA Lba,
|
|
||||||
IN UINTN BufferSize,
|
|
||||||
IN VOID *Buffer
|
|
||||||
)
|
|
||||||
{
|
|
||||||
DEBUG ((EFI_D_INFO, "BlockIo (MMIO) WriteBlocks: lba=0x%Lx, size=0x%Lx\n",
|
|
||||||
Lba, (UINT64)BufferSize));
|
|
||||||
return ReadOrWriteBlocks (
|
|
||||||
This,
|
|
||||||
FALSE,
|
|
||||||
MediaId,
|
|
||||||
Lba,
|
|
||||||
BufferSize,
|
|
||||||
Buffer
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
Flushes all modified data to a physical block device.
|
|
||||||
|
|
||||||
@param This Indicates a pointer to the calling context.
|
|
||||||
|
|
||||||
@retval EFI_SUCCESS All outstanding data were written correctly to the device.
|
|
||||||
@retval EFI_DEVICE_ERROR The device reported an error while attempting to write data.
|
|
||||||
@retval EFI_NO_MEDIA There is no media in the device.
|
|
||||||
|
|
||||||
**/
|
|
||||||
EFI_STATUS
|
|
||||||
EFIAPI
|
|
||||||
BlockIoFlushBlocks (
|
|
||||||
IN EFI_BLOCK_IO_PROTOCOL *This
|
|
||||||
)
|
|
||||||
{
|
|
||||||
return EFI_SUCCESS;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
Initialize data for device that does not support multiple LUNSs.
|
|
||||||
|
|
||||||
@param This The Driver Binding Protocol instance.
|
|
||||||
@param Controller The device to initialize.
|
|
||||||
@param BlockMmio Pointer to USB_MASS_TRANSPORT.
|
|
||||||
@param Context Parameter for USB_MASS_DEVICE.Context.
|
|
||||||
|
|
||||||
@retval EFI_SUCCESS Initialization succeeds.
|
|
||||||
@retval Other Initialization fails.
|
|
||||||
|
|
||||||
**/
|
|
||||||
EFI_STATUS
|
|
||||||
BlockIoInit (
|
|
||||||
IN EFI_DRIVER_BINDING_PROTOCOL *This,
|
|
||||||
IN EFI_HANDLE Controller
|
|
||||||
)
|
|
||||||
{
|
|
||||||
EFI_STATUS Status;
|
|
||||||
BLOCK_MMIO_TO_BLOCK_IO_DEVICE *Private;
|
|
||||||
BLOCK_MMIO_PROTOCOL *BlockMmio;
|
|
||||||
|
|
||||||
Private = (BLOCK_MMIO_TO_BLOCK_IO_DEVICE*) AllocateZeroPool (sizeof (*Private));
|
|
||||||
ASSERT (Private != NULL);
|
|
||||||
|
|
||||||
Status = gBS->LocateProtocol (
|
|
||||||
&gEfiCpuIo2ProtocolGuid,
|
|
||||||
NULL,
|
|
||||||
(VOID **) &(Private->CpuIo)
|
|
||||||
);
|
|
||||||
ASSERT_EFI_ERROR (Status);
|
|
||||||
|
|
||||||
Status = gBS->OpenProtocol (
|
|
||||||
Controller,
|
|
||||||
&gBlockMmioProtocolGuid,
|
|
||||||
(VOID **) &BlockMmio,
|
|
||||||
This->DriverBindingHandle,
|
|
||||||
Controller,
|
|
||||||
EFI_OPEN_PROTOCOL_BY_DRIVER
|
|
||||||
);
|
|
||||||
if (EFI_ERROR (Status)) {
|
|
||||||
DEBUG ((EFI_D_ERROR, "BlockIoInit: OpenBlockMmioProtocol By Driver (%r)\n", Status));
|
|
||||||
goto ON_ERROR;
|
|
||||||
}
|
|
||||||
DEBUG ((EFI_D_INFO, "BlockMmio: %p\n", BlockMmio));
|
|
||||||
DEBUG ((EFI_D_INFO, "BlockMmio->Media->LastBlock: 0x%lx\n", BlockMmio->Media->LastBlock));
|
|
||||||
|
|
||||||
Private->Signature = BLOCK_MMIO_TO_BLOCK_IO_SIGNATURE;
|
|
||||||
Private->Controller = Controller;
|
|
||||||
Private->BlockMmio = BlockMmio;
|
|
||||||
Private->BlockIo.Media = BlockMmio->Media;
|
|
||||||
Private->BlockIo.Reset = BlockIoReset;
|
|
||||||
Private->BlockIo.ReadBlocks = BlockIoReadBlocks;
|
|
||||||
Private->BlockIo.WriteBlocks = BlockIoWriteBlocks;
|
|
||||||
Private->BlockIo.FlushBlocks = BlockIoFlushBlocks;
|
|
||||||
|
|
||||||
DEBUG ((EFI_D_INFO, "Private->BlockIo.Media->LastBlock: 0x%lx\n", Private->BlockIo.Media->LastBlock));
|
|
||||||
|
|
||||||
Status = gBS->InstallProtocolInterface (
|
|
||||||
&Controller,
|
|
||||||
&gEfiBlockIoProtocolGuid,
|
|
||||||
EFI_NATIVE_INTERFACE,
|
|
||||||
&Private->BlockIo
|
|
||||||
);
|
|
||||||
if (EFI_ERROR (Status)) {
|
|
||||||
goto ON_ERROR;
|
|
||||||
}
|
|
||||||
|
|
||||||
return EFI_SUCCESS;
|
|
||||||
|
|
||||||
ON_ERROR:
|
|
||||||
if (Private != NULL) {
|
|
||||||
FreePool (Private);
|
|
||||||
}
|
|
||||||
if (BlockMmio != NULL) {
|
|
||||||
gBS->CloseProtocol (
|
|
||||||
Controller,
|
|
||||||
&gBlockMmioProtocolGuid,
|
|
||||||
This->DriverBindingHandle,
|
|
||||||
Controller
|
|
||||||
);
|
|
||||||
}
|
|
||||||
return Status;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
Check whether the controller is a supported USB mass storage.
|
|
||||||
|
|
||||||
@param This The USB mass storage driver binding protocol.
|
|
||||||
@param Controller The controller handle to check.
|
|
||||||
@param RemainingDevicePath The remaining device path.
|
|
||||||
|
|
||||||
@retval EFI_SUCCESS The driver supports this controller.
|
|
||||||
@retval other This device isn't supported.
|
|
||||||
|
|
||||||
**/
|
|
||||||
EFI_STATUS
|
|
||||||
EFIAPI
|
|
||||||
BlockIoDriverBindingSupported (
|
|
||||||
IN EFI_DRIVER_BINDING_PROTOCOL *This,
|
|
||||||
IN EFI_HANDLE Controller,
|
|
||||||
IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
|
|
||||||
)
|
|
||||||
{
|
|
||||||
EFI_STATUS Status;
|
|
||||||
BLOCK_MMIO_PROTOCOL *BlockMmio;
|
|
||||||
|
|
||||||
Status = gBS->OpenProtocol (
|
|
||||||
Controller,
|
|
||||||
&gBlockMmioProtocolGuid,
|
|
||||||
(VOID **) &BlockMmio,
|
|
||||||
This->DriverBindingHandle,
|
|
||||||
Controller,
|
|
||||||
EFI_OPEN_PROTOCOL_BY_DRIVER
|
|
||||||
);
|
|
||||||
if (EFI_ERROR (Status)) {
|
|
||||||
return Status;
|
|
||||||
}
|
|
||||||
|
|
||||||
gBS->CloseProtocol (
|
|
||||||
Controller,
|
|
||||||
&gBlockMmioProtocolGuid,
|
|
||||||
This->DriverBindingHandle,
|
|
||||||
Controller
|
|
||||||
);
|
|
||||||
|
|
||||||
return Status;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
Starts the USB mass storage device with this driver.
|
|
||||||
|
|
||||||
This function consumes USB I/O Portocol, intializes USB mass storage device,
|
|
||||||
installs Block I/O Protocol, and submits Asynchronous Interrupt
|
|
||||||
Transfer to manage the USB mass storage device.
|
|
||||||
|
|
||||||
@param This The USB mass storage driver binding protocol.
|
|
||||||
@param Controller The USB mass storage device to start on
|
|
||||||
@param RemainingDevicePath The remaining device path.
|
|
||||||
|
|
||||||
@retval EFI_SUCCESS This driver supports this device.
|
|
||||||
@retval EFI_UNSUPPORTED This driver does not support this device.
|
|
||||||
@retval EFI_DEVICE_ERROR This driver cannot be started due to device Error.
|
|
||||||
@retval EFI_OUT_OF_RESOURCES Can't allocate memory resources.
|
|
||||||
@retval EFI_ALREADY_STARTED This driver has been started.
|
|
||||||
|
|
||||||
**/
|
|
||||||
EFI_STATUS
|
|
||||||
EFIAPI
|
|
||||||
BlockIoDriverBindingStart (
|
|
||||||
IN EFI_DRIVER_BINDING_PROTOCOL *This,
|
|
||||||
IN EFI_HANDLE Controller,
|
|
||||||
IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
|
|
||||||
)
|
|
||||||
{
|
|
||||||
EFI_STATUS Status;
|
|
||||||
|
|
||||||
Status = BlockIoInit (This, Controller);
|
|
||||||
if (EFI_ERROR (Status)) {
|
|
||||||
DEBUG ((EFI_D_ERROR, "BlockIoDriverBindingStart: BlockIoInit (%r)\n", Status));
|
|
||||||
return Status;
|
|
||||||
}
|
|
||||||
|
|
||||||
DEBUG ((EFI_D_INIT, "BlockIoDriverBindingStart: Successfully started\n"));
|
|
||||||
return Status;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
Stop controlling the device.
|
|
||||||
|
|
||||||
@param This The USB mass storage driver binding
|
|
||||||
@param Controller The device controller controlled by the driver.
|
|
||||||
@param NumberOfChildren The number of children of this device
|
|
||||||
@param ChildHandleBuffer The buffer of children handle.
|
|
||||||
|
|
||||||
@retval EFI_SUCCESS The driver stopped from controlling the device.
|
|
||||||
@retval EFI_DEVICE_ERROR The device could not be stopped due to a device error.
|
|
||||||
@retval EFI_UNSUPPORTED Block I/O Protocol is not installed on Controller.
|
|
||||||
@retval Others Failed to stop the driver
|
|
||||||
|
|
||||||
**/
|
|
||||||
EFI_STATUS
|
|
||||||
EFIAPI
|
|
||||||
BlockIoDriverBindingStop (
|
|
||||||
IN EFI_DRIVER_BINDING_PROTOCOL *This,
|
|
||||||
IN EFI_HANDLE Controller,
|
|
||||||
IN UINTN NumberOfChildren,
|
|
||||||
IN EFI_HANDLE *ChildHandleBuffer
|
|
||||||
)
|
|
||||||
{
|
|
||||||
EFI_STATUS Status;
|
|
||||||
BLOCK_MMIO_TO_BLOCK_IO_DEVICE *Private;
|
|
||||||
|
|
||||||
Private = PRIVATE_FROM_BLOCK_IO (This);
|
|
||||||
|
|
||||||
//
|
|
||||||
// Uninstall Block I/O protocol from the device handle,
|
|
||||||
// then call the transport protocol to stop itself.
|
|
||||||
//
|
|
||||||
Status = gBS->UninstallProtocolInterface (
|
|
||||||
Controller,
|
|
||||||
&gEfiBlockIoProtocolGuid,
|
|
||||||
&Private->BlockIo
|
|
||||||
);
|
|
||||||
if (EFI_ERROR (Status)) {
|
|
||||||
return Status;
|
|
||||||
}
|
|
||||||
|
|
||||||
gBS->CloseProtocol (
|
|
||||||
Controller,
|
|
||||||
&gBlockMmioProtocolGuid,
|
|
||||||
This->DriverBindingHandle,
|
|
||||||
Controller
|
|
||||||
);
|
|
||||||
|
|
||||||
FreePool (Private);
|
|
||||||
|
|
||||||
DEBUG ((EFI_D_INFO, "Successfully stopped BlockIo on BlockMmio\n"));
|
|
||||||
return EFI_SUCCESS;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
Entrypoint of Block MMIO to Block IO Driver.
|
|
||||||
|
|
||||||
This function is the entrypoint of USB Mass Storage Driver. It installs Driver Binding
|
|
||||||
Protocol together with Component Name Protocols.
|
|
||||||
|
|
||||||
@param ImageHandle The firmware allocated handle for the EFI image.
|
|
||||||
@param SystemTable A pointer to the EFI System Table.
|
|
||||||
|
|
||||||
@retval EFI_SUCCESS The entry point is executed successfully.
|
|
||||||
|
|
||||||
**/
|
|
||||||
EFI_STATUS
|
|
||||||
EFIAPI
|
|
||||||
BlockMmioToBlockIoEntryPoint (
|
|
||||||
IN EFI_HANDLE ImageHandle,
|
|
||||||
IN EFI_SYSTEM_TABLE *SystemTable
|
|
||||||
)
|
|
||||||
{
|
|
||||||
EFI_STATUS Status;
|
|
||||||
|
|
||||||
//
|
|
||||||
// Install driver binding protocol
|
|
||||||
//
|
|
||||||
Status = EfiLibInstallDriverBindingComponentName2 (
|
|
||||||
ImageHandle,
|
|
||||||
SystemTable,
|
|
||||||
&gBlockIoDriverBinding,
|
|
||||||
ImageHandle,
|
|
||||||
&gBlockMmioToBlockIoComponentName,
|
|
||||||
&gBlockMmioToBlockIoComponentName2
|
|
||||||
);
|
|
||||||
ASSERT_EFI_ERROR (Status);
|
|
||||||
|
|
||||||
return EFI_SUCCESS;
|
|
||||||
}
|
|
@@ -1,346 +0,0 @@
|
|||||||
/** @file
|
|
||||||
Definitions of functions for Driver Binding Protocol and Block I/O Protocol,
|
|
||||||
and other internal definitions.
|
|
||||||
|
|
||||||
Copyright (c) 2007 - 2010, Intel Corporation. All rights reserved.<BR>
|
|
||||||
This program and the accompanying materials
|
|
||||||
are licensed and made available under the terms and conditions of the BSD License
|
|
||||||
which accompanies this distribution. The full text of the license may be found at
|
|
||||||
http://opensource.org/licenses/bsd-license.php
|
|
||||||
|
|
||||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
|
||||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
|
||||||
|
|
||||||
**/
|
|
||||||
|
|
||||||
#ifndef _EFI_BLOCK_MMIO_TO_BLOCK_IO_H_
|
|
||||||
#define _EFI_BLOCK_MMIO_TO_BLOCK_IO_H_
|
|
||||||
|
|
||||||
#include <Uefi.h>
|
|
||||||
#include <Protocol/BlockMmio.h>
|
|
||||||
#include <Protocol/ComponentName.h>
|
|
||||||
#include <Protocol/ComponentName2.h>
|
|
||||||
#include <Protocol/CpuIo2.h>
|
|
||||||
#include <Protocol/DevicePath.h>
|
|
||||||
#include <Protocol/DriverBinding.h>
|
|
||||||
#include <Library/BaseLib.h>
|
|
||||||
#include <Library/DebugLib.h>
|
|
||||||
#include <Library/MemoryAllocationLib.h>
|
|
||||||
#include <Library/UefiBootServicesTableLib.h>
|
|
||||||
#include <Library/UefiLib.h>
|
|
||||||
|
|
||||||
#define BLOCK_MMIO_TO_BLOCK_IO_SIGNATURE SIGNATURE_32 ('B', 'M', 'I', 'O')
|
|
||||||
|
|
||||||
#define PRIVATE_FROM_BLOCK_IO(a) \
|
|
||||||
CR (a, BLOCK_MMIO_TO_BLOCK_IO_DEVICE, BlockIo, BLOCK_MMIO_TO_BLOCK_IO_SIGNATURE)
|
|
||||||
|
|
||||||
extern EFI_COMPONENT_NAME_PROTOCOL gBlockMmioToBlockIoComponentName;
|
|
||||||
extern EFI_COMPONENT_NAME2_PROTOCOL gBlockMmioToBlockIoComponentName2;
|
|
||||||
|
|
||||||
typedef struct {
|
|
||||||
UINT32 Signature;
|
|
||||||
EFI_HANDLE Controller;
|
|
||||||
BLOCK_MMIO_PROTOCOL *BlockMmio;
|
|
||||||
EFI_CPU_IO2_PROTOCOL *CpuIo;
|
|
||||||
EFI_DEVICE_PATH_PROTOCOL *DevicePath;
|
|
||||||
EFI_BLOCK_IO_PROTOCOL BlockIo;
|
|
||||||
} BLOCK_MMIO_TO_BLOCK_IO_DEVICE;
|
|
||||||
|
|
||||||
//
|
|
||||||
// Functions for Driver Binding Protocol
|
|
||||||
//
|
|
||||||
|
|
||||||
/**
|
|
||||||
Check whether the controller is a supported.
|
|
||||||
|
|
||||||
@param This The driver binding protocol.
|
|
||||||
@param Controller The controller handle to check.
|
|
||||||
@param RemainingDevicePath The remaining device path.
|
|
||||||
|
|
||||||
@retval EFI_SUCCESS The driver supports this controller.
|
|
||||||
@retval other This device isn't supported.
|
|
||||||
|
|
||||||
**/
|
|
||||||
EFI_STATUS
|
|
||||||
EFIAPI
|
|
||||||
BlockIoDriverBindingSupported (
|
|
||||||
IN EFI_DRIVER_BINDING_PROTOCOL *This,
|
|
||||||
IN EFI_HANDLE Controller,
|
|
||||||
IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
|
|
||||||
);
|
|
||||||
|
|
||||||
/**
|
|
||||||
Starts the BlockIo device with this driver.
|
|
||||||
|
|
||||||
This function consumes Block MMIO Portocol and
|
|
||||||
installs Block I/O Protocol.
|
|
||||||
|
|
||||||
@param This The driver binding protocol.
|
|
||||||
@param Controller The Block MMIO device to start on
|
|
||||||
@param RemainingDevicePath The remaining device path.
|
|
||||||
|
|
||||||
@retval EFI_SUCCESS This driver supports this device.
|
|
||||||
@retval EFI_UNSUPPORTED This driver does not support this device.
|
|
||||||
@retval EFI_DEVICE_ERROR This driver cannot be started due to device Error.
|
|
||||||
@retval EFI_OUT_OF_RESOURCES Can't allocate memory resources.
|
|
||||||
@retval EFI_ALREADY_STARTED This driver has been started.
|
|
||||||
|
|
||||||
**/
|
|
||||||
EFI_STATUS
|
|
||||||
EFIAPI
|
|
||||||
BlockIoDriverBindingStart (
|
|
||||||
IN EFI_DRIVER_BINDING_PROTOCOL *This,
|
|
||||||
IN EFI_HANDLE Controller,
|
|
||||||
IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
|
|
||||||
);
|
|
||||||
|
|
||||||
/**
|
|
||||||
Stop controlling the device.
|
|
||||||
|
|
||||||
@param This The driver binding
|
|
||||||
@param Controller The device controller controlled by the driver.
|
|
||||||
@param NumberOfChildren The number of children of this device
|
|
||||||
@param ChildHandleBuffer The buffer of children handle.
|
|
||||||
|
|
||||||
@retval EFI_SUCCESS The driver stopped from controlling the device.
|
|
||||||
@retval EFI_DEVICE_ERROR The device could not be stopped due to a device error.
|
|
||||||
@retval EFI_UNSUPPORTED Block I/O Protocol is not installed on Controller.
|
|
||||||
@retval Others Failed to stop the driver
|
|
||||||
|
|
||||||
**/
|
|
||||||
EFI_STATUS
|
|
||||||
EFIAPI
|
|
||||||
BlockIoDriverBindingStop (
|
|
||||||
IN EFI_DRIVER_BINDING_PROTOCOL *This,
|
|
||||||
IN EFI_HANDLE Controller,
|
|
||||||
IN UINTN NumberOfChildren,
|
|
||||||
IN EFI_HANDLE *ChildHandleBuffer
|
|
||||||
);
|
|
||||||
|
|
||||||
//
|
|
||||||
// Functions for Block I/O Protocol
|
|
||||||
//
|
|
||||||
|
|
||||||
/**
|
|
||||||
Reset the block device.
|
|
||||||
|
|
||||||
This function implements EFI_BLOCK_IO_PROTOCOL.Reset().
|
|
||||||
It resets the block device hardware.
|
|
||||||
ExtendedVerification is ignored in this implementation.
|
|
||||||
|
|
||||||
@param This Indicates a pointer to the calling context.
|
|
||||||
@param ExtendedVerification Indicates that the driver may perform a more exhaustive
|
|
||||||
verification operation of the device during reset.
|
|
||||||
|
|
||||||
@retval EFI_SUCCESS The block device was reset.
|
|
||||||
@retval EFI_DEVICE_ERROR The block device is not functioning correctly and could not be reset.
|
|
||||||
|
|
||||||
**/
|
|
||||||
EFI_STATUS
|
|
||||||
EFIAPI
|
|
||||||
BlockIoReset (
|
|
||||||
IN EFI_BLOCK_IO_PROTOCOL *This,
|
|
||||||
IN BOOLEAN ExtendedVerification
|
|
||||||
);
|
|
||||||
|
|
||||||
/**
|
|
||||||
Reads the requested number of blocks from the device.
|
|
||||||
|
|
||||||
This function implements EFI_BLOCK_IO_PROTOCOL.ReadBlocks().
|
|
||||||
It reads the requested number of blocks from the device.
|
|
||||||
All the blocks are read, or an error is returned.
|
|
||||||
|
|
||||||
@param This Indicates a pointer to the calling context.
|
|
||||||
@param MediaId The media ID that the read request is for.
|
|
||||||
@param Lba The starting logical block address to read from on the device.
|
|
||||||
@param BufferSize The size of the Buffer in bytes.
|
|
||||||
This must be a multiple of the intrinsic block size of the device.
|
|
||||||
@param Buffer A pointer to the destination buffer for the data. The caller is
|
|
||||||
responsible for either having implicit or explicit ownership of the buffer.
|
|
||||||
|
|
||||||
@retval EFI_SUCCESS The data was read correctly from the device.
|
|
||||||
@retval EFI_DEVICE_ERROR The device reported an error while attempting to perform the read operation.
|
|
||||||
@retval EFI_NO_MEDIA There is no media in the device.
|
|
||||||
@retval EFI_MEDIA_CHANGED The MediaId is not for the current media.
|
|
||||||
@retval EFI_BAD_BUFFER_SIZE The BufferSize parameter is not a multiple of the intrinsic block size of the device.
|
|
||||||
@retval EFI_INVALID_PARAMETER The read request contains LBAs that are not valid,
|
|
||||||
or the buffer is not on proper alignment.
|
|
||||||
|
|
||||||
**/
|
|
||||||
EFI_STATUS
|
|
||||||
EFIAPI
|
|
||||||
BlockIoReadBlocks (
|
|
||||||
IN EFI_BLOCK_IO_PROTOCOL *This,
|
|
||||||
IN UINT32 MediaId,
|
|
||||||
IN EFI_LBA Lba,
|
|
||||||
IN UINTN BufferSize,
|
|
||||||
OUT VOID *Buffer
|
|
||||||
);
|
|
||||||
|
|
||||||
/**
|
|
||||||
Writes a specified number of blocks to the device.
|
|
||||||
|
|
||||||
This function implements EFI_BLOCK_IO_PROTOCOL.WriteBlocks().
|
|
||||||
It writes a specified number of blocks to the device.
|
|
||||||
All blocks are written, or an error is returned.
|
|
||||||
|
|
||||||
@param This Indicates a pointer to the calling context.
|
|
||||||
@param MediaId The media ID that the write request is for.
|
|
||||||
@param Lba The starting logical block address to be written.
|
|
||||||
@param BufferSize The size of the Buffer in bytes.
|
|
||||||
This must be a multiple of the intrinsic block size of the device.
|
|
||||||
@param Buffer Pointer to the source buffer for the data.
|
|
||||||
|
|
||||||
@retval EFI_SUCCESS The data were written correctly to the device.
|
|
||||||
@retval EFI_WRITE_PROTECTED The device cannot be written to.
|
|
||||||
@retval EFI_NO_MEDIA There is no media in the device.
|
|
||||||
@retval EFI_MEDIA_CHANGED The MediaId is not for the current media.
|
|
||||||
@retval EFI_DEVICE_ERROR The device reported an error while attempting to perform the write operation.
|
|
||||||
@retval EFI_BAD_BUFFER_SIZE The BufferSize parameter is not a multiple of the intrinsic
|
|
||||||
block size of the device.
|
|
||||||
@retval EFI_INVALID_PARAMETER The write request contains LBAs that are not valid,
|
|
||||||
or the buffer is not on proper alignment.
|
|
||||||
|
|
||||||
**/
|
|
||||||
EFI_STATUS
|
|
||||||
EFIAPI
|
|
||||||
BlockIoWriteBlocks (
|
|
||||||
IN EFI_BLOCK_IO_PROTOCOL *This,
|
|
||||||
IN UINT32 MediaId,
|
|
||||||
IN EFI_LBA Lba,
|
|
||||||
IN UINTN BufferSize,
|
|
||||||
IN VOID *Buffer
|
|
||||||
);
|
|
||||||
|
|
||||||
/**
|
|
||||||
Flushes all modified data to a physical block device.
|
|
||||||
|
|
||||||
@param This Indicates a pointer to the calling context.
|
|
||||||
|
|
||||||
@retval EFI_SUCCESS All outstanding data were written correctly to the device.
|
|
||||||
@retval EFI_DEVICE_ERROR The device reported an error while attempting to write data.
|
|
||||||
@retval EFI_NO_MEDIA There is no media in the device.
|
|
||||||
|
|
||||||
**/
|
|
||||||
EFI_STATUS
|
|
||||||
EFIAPI
|
|
||||||
BlockIoFlushBlocks (
|
|
||||||
IN EFI_BLOCK_IO_PROTOCOL *This
|
|
||||||
);
|
|
||||||
|
|
||||||
//
|
|
||||||
// EFI Component Name Functions
|
|
||||||
//
|
|
||||||
|
|
||||||
/**
|
|
||||||
Retrieves a Unicode string that is the user readable name of the driver.
|
|
||||||
|
|
||||||
This function retrieves the user readable name of a driver in the form of a
|
|
||||||
Unicode string. If the driver specified by This has a user readable name in
|
|
||||||
the language specified by Language, then a pointer to the driver name is
|
|
||||||
returned in DriverName, and EFI_SUCCESS is returned. If the driver specified
|
|
||||||
by This does not support the language specified by Language,
|
|
||||||
then EFI_UNSUPPORTED is returned.
|
|
||||||
|
|
||||||
@param This A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or
|
|
||||||
EFI_COMPONENT_NAME_PROTOCOL instance.
|
|
||||||
@param Language A pointer to a Null-terminated ASCII string
|
|
||||||
array indicating the language. This is the
|
|
||||||
language of the driver name that the caller is
|
|
||||||
requesting, and it must match one of the
|
|
||||||
languages specified in SupportedLanguages. The
|
|
||||||
number of languages supported by a driver is up
|
|
||||||
to the driver writer. Language is specified
|
|
||||||
in RFC 4646 or ISO 639-2 language code format.
|
|
||||||
@param DriverName A pointer to the Unicode string to return.
|
|
||||||
This Unicode string is the name of the
|
|
||||||
driver specified by This in the language
|
|
||||||
specified by Language.
|
|
||||||
|
|
||||||
@retval EFI_SUCCESS The Unicode string for the Driver specified by
|
|
||||||
This and the language specified by Language was
|
|
||||||
returned in DriverName.
|
|
||||||
@retval EFI_INVALID_PARAMETER Language is NULL.
|
|
||||||
@retval EFI_INVALID_PARAMETER DriverName is NULL.
|
|
||||||
@retval EFI_UNSUPPORTED The driver specified by This does not support
|
|
||||||
the language specified by Language.
|
|
||||||
|
|
||||||
**/
|
|
||||||
EFI_STATUS
|
|
||||||
EFIAPI
|
|
||||||
BlockMmioToBlockIoGetDriverName (
|
|
||||||
IN EFI_COMPONENT_NAME_PROTOCOL *This,
|
|
||||||
IN CHAR8 *Language,
|
|
||||||
OUT CHAR16 **DriverName
|
|
||||||
);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
Retrieves a Unicode string that is the user readable name of the controller
|
|
||||||
that is being managed by a driver.
|
|
||||||
|
|
||||||
This function retrieves the user readable name of the controller specified by
|
|
||||||
ControllerHandle and ChildHandle in the form of a Unicode string. If the
|
|
||||||
driver specified by This has a user readable name in the language specified by
|
|
||||||
Language, then a pointer to the controller name is returned in ControllerName,
|
|
||||||
and EFI_SUCCESS is returned. If the driver specified by This is not currently
|
|
||||||
managing the controller specified by ControllerHandle and ChildHandle,
|
|
||||||
then EFI_UNSUPPORTED is returned. If the driver specified by This does not
|
|
||||||
support the language specified by Language, then EFI_UNSUPPORTED is returned.
|
|
||||||
|
|
||||||
@param This A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or
|
|
||||||
EFI_COMPONENT_NAME_PROTOCOL instance.
|
|
||||||
@param ControllerHandle The handle of a controller that the driver
|
|
||||||
specified by This is managing. This handle
|
|
||||||
specifies the controller whose name is to be
|
|
||||||
returned.
|
|
||||||
@param ChildHandle The handle of the child controller to retrieve
|
|
||||||
the name of. This is an optional parameter that
|
|
||||||
may be NULL. It will be NULL for device
|
|
||||||
drivers. It will also be NULL for a bus drivers
|
|
||||||
that wish to retrieve the name of the bus
|
|
||||||
controller. It will not be NULL for a bus
|
|
||||||
driver that wishes to retrieve the name of a
|
|
||||||
child controller.
|
|
||||||
@param Language A pointer to a Null-terminated ASCII string
|
|
||||||
array indicating the language. This is the
|
|
||||||
language of the driver name that the caller is
|
|
||||||
requesting, and it must match one of the
|
|
||||||
languages specified in SupportedLanguages. The
|
|
||||||
number of languages supported by a driver is up
|
|
||||||
to the driver writer. Language is specified in
|
|
||||||
RFC 4646 or ISO 639-2 language code format.
|
|
||||||
@param ControllerName A pointer to the Unicode string to return.
|
|
||||||
This Unicode string is the name of the
|
|
||||||
controller specified by ControllerHandle and
|
|
||||||
ChildHandle in the language specified by
|
|
||||||
Language from the point of view of the driver
|
|
||||||
specified by This.
|
|
||||||
|
|
||||||
@retval EFI_SUCCESS The Unicode string for the user readable name in
|
|
||||||
the language specified by Language for the
|
|
||||||
driver specified by This was returned in
|
|
||||||
DriverName.
|
|
||||||
@retval EFI_INVALID_PARAMETER ControllerHandle is not a valid EFI_HANDLE.
|
|
||||||
@retval EFI_INVALID_PARAMETER ChildHandle is not NULL and it is not a valid
|
|
||||||
EFI_HANDLE.
|
|
||||||
@retval EFI_INVALID_PARAMETER Language is NULL.
|
|
||||||
@retval EFI_INVALID_PARAMETER ControllerName is NULL.
|
|
||||||
@retval EFI_UNSUPPORTED The driver specified by This is not currently
|
|
||||||
managing the controller specified by
|
|
||||||
ControllerHandle and ChildHandle.
|
|
||||||
@retval EFI_UNSUPPORTED The driver specified by This does not support
|
|
||||||
the language specified by Language.
|
|
||||||
|
|
||||||
**/
|
|
||||||
EFI_STATUS
|
|
||||||
EFIAPI
|
|
||||||
BlockMmioToBlockIoGetControllerName (
|
|
||||||
IN EFI_COMPONENT_NAME_PROTOCOL *This,
|
|
||||||
IN EFI_HANDLE ControllerHandle,
|
|
||||||
IN EFI_HANDLE ChildHandle OPTIONAL,
|
|
||||||
IN CHAR8 *Language,
|
|
||||||
OUT CHAR16 **ControllerName
|
|
||||||
);
|
|
||||||
|
|
||||||
#endif
|
|
@@ -1,56 +0,0 @@
|
|||||||
## @file
|
|
||||||
# The driver wrappers BlockMmio protocol instances to produce
|
|
||||||
# Block I/O Protocol instances.
|
|
||||||
#
|
|
||||||
# Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>
|
|
||||||
#
|
|
||||||
# This program and the accompanying materials
|
|
||||||
# are licensed and made available under the terms and conditions of the BSD License
|
|
||||||
# which accompanies this distribution. The full text of the license may be found at
|
|
||||||
# http://opensource.org/licenses/bsd-license.php
|
|
||||||
#
|
|
||||||
# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
|
||||||
# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
|
||||||
#
|
|
||||||
#
|
|
||||||
##
|
|
||||||
|
|
||||||
[Defines]
|
|
||||||
INF_VERSION = 0x00010005
|
|
||||||
BASE_NAME = BlockMmioToBlockIoDxe
|
|
||||||
FILE_GUID = 33cb97af-6c33-4c42-986b-07581fa366d4
|
|
||||||
MODULE_TYPE = UEFI_DRIVER
|
|
||||||
VERSION_STRING = 1.0
|
|
||||||
ENTRY_POINT = BlockMmioToBlockIoEntryPoint
|
|
||||||
|
|
||||||
#
|
|
||||||
# The following information is for reference only and not required by the build tools.
|
|
||||||
#
|
|
||||||
# VALID_ARCHITECTURES = IA32 X64 IPF EBC
|
|
||||||
#
|
|
||||||
|
|
||||||
[Sources]
|
|
||||||
BlockIo.c
|
|
||||||
BlockIo.h
|
|
||||||
ComponentName.c
|
|
||||||
|
|
||||||
[Packages]
|
|
||||||
MdePkg/MdePkg.dec
|
|
||||||
OvmfPkg/OvmfPkg.dec
|
|
||||||
|
|
||||||
[LibraryClasses]
|
|
||||||
BaseLib
|
|
||||||
BaseMemoryLib
|
|
||||||
DebugLib
|
|
||||||
DevicePathLib
|
|
||||||
MemoryAllocationLib
|
|
||||||
UefiBootServicesTableLib
|
|
||||||
UefiDriverEntryPoint
|
|
||||||
UefiLib
|
|
||||||
|
|
||||||
[Protocols]
|
|
||||||
gBlockMmioProtocolGuid ## TO_START
|
|
||||||
gEfiCpuIo2ProtocolGuid ## TO_START
|
|
||||||
gEfiDevicePathProtocolGuid ## TO_START
|
|
||||||
gEfiBlockIoProtocolGuid ## BY_START
|
|
||||||
|
|
@@ -1,162 +0,0 @@
|
|||||||
/** @file
|
|
||||||
UEFI Component Name(2) protocol implementation for Block MMIO to Block IO driver.
|
|
||||||
|
|
||||||
Copyright (c) 2004 - 2007, Intel Corporation. All rights reserved.<BR>
|
|
||||||
This program and the accompanying materials
|
|
||||||
are licensed and made available under the terms and conditions of the BSD License
|
|
||||||
which accompanies this distribution. The full text of the license may be found at
|
|
||||||
http://opensource.org/licenses/bsd-license.php
|
|
||||||
|
|
||||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
|
||||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
|
||||||
|
|
||||||
**/
|
|
||||||
|
|
||||||
#include "BlockIo.h"
|
|
||||||
|
|
||||||
//
|
|
||||||
// EFI Component Name Protocol
|
|
||||||
//
|
|
||||||
GLOBAL_REMOVE_IF_UNREFERENCED EFI_COMPONENT_NAME_PROTOCOL gBlockMmioToBlockIoComponentName = {
|
|
||||||
BlockMmioToBlockIoGetDriverName,
|
|
||||||
BlockMmioToBlockIoGetControllerName,
|
|
||||||
"eng"
|
|
||||||
};
|
|
||||||
|
|
||||||
//
|
|
||||||
// EFI Component Name 2 Protocol
|
|
||||||
//
|
|
||||||
GLOBAL_REMOVE_IF_UNREFERENCED EFI_COMPONENT_NAME2_PROTOCOL gBlockMmioToBlockIoComponentName2 = {
|
|
||||||
(EFI_COMPONENT_NAME2_GET_DRIVER_NAME) BlockMmioToBlockIoGetDriverName,
|
|
||||||
(EFI_COMPONENT_NAME2_GET_CONTROLLER_NAME) BlockMmioToBlockIoGetControllerName,
|
|
||||||
"en"
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
GLOBAL_REMOVE_IF_UNREFERENCED EFI_UNICODE_STRING_TABLE
|
|
||||||
mBlockMmioToBlockIoDriverNameTable[] = {
|
|
||||||
{"eng;en", L"Block MMIO to Block IO Driver"},
|
|
||||||
{NULL, NULL}
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
Retrieves a Unicode string that is the user readable name of the driver.
|
|
||||||
|
|
||||||
This function retrieves the user readable name of a driver in the form of a
|
|
||||||
Unicode string. If the driver specified by This has a user readable name in
|
|
||||||
the language specified by Language, then a pointer to the driver name is
|
|
||||||
returned in DriverName, and EFI_SUCCESS is returned. If the driver specified
|
|
||||||
by This does not support the language specified by Language,
|
|
||||||
then EFI_UNSUPPORTED is returned.
|
|
||||||
|
|
||||||
@param This A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or
|
|
||||||
EFI_COMPONENT_NAME_PROTOCOL instance.
|
|
||||||
@param Language A pointer to a Null-terminated ASCII string
|
|
||||||
array indicating the language. This is the
|
|
||||||
language of the driver name that the caller is
|
|
||||||
requesting, and it must match one of the
|
|
||||||
languages specified in SupportedLanguages. The
|
|
||||||
number of languages supported by a driver is up
|
|
||||||
to the driver writer. Language is specified
|
|
||||||
in RFC 4646 or ISO 639-2 language code format.
|
|
||||||
@param DriverName A pointer to the Unicode string to return.
|
|
||||||
This Unicode string is the name of the
|
|
||||||
driver specified by This in the language
|
|
||||||
specified by Language.
|
|
||||||
|
|
||||||
@retval EFI_SUCCESS The Unicode string for the Driver specified by
|
|
||||||
This and the language specified by Language was
|
|
||||||
returned in DriverName.
|
|
||||||
@retval EFI_INVALID_PARAMETER Language is NULL.
|
|
||||||
@retval EFI_INVALID_PARAMETER DriverName is NULL.
|
|
||||||
@retval EFI_UNSUPPORTED The driver specified by This does not support
|
|
||||||
the language specified by Language.
|
|
||||||
|
|
||||||
**/
|
|
||||||
EFI_STATUS
|
|
||||||
EFIAPI
|
|
||||||
BlockMmioToBlockIoGetDriverName (
|
|
||||||
IN EFI_COMPONENT_NAME_PROTOCOL *This,
|
|
||||||
IN CHAR8 *Language,
|
|
||||||
OUT CHAR16 **DriverName
|
|
||||||
)
|
|
||||||
{
|
|
||||||
return LookupUnicodeString2 (
|
|
||||||
Language,
|
|
||||||
This->SupportedLanguages,
|
|
||||||
mBlockMmioToBlockIoDriverNameTable,
|
|
||||||
DriverName,
|
|
||||||
(BOOLEAN)(This == &gBlockMmioToBlockIoComponentName)
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
Retrieves a Unicode string that is the user readable name of the controller
|
|
||||||
that is being managed by a driver.
|
|
||||||
|
|
||||||
This function retrieves the user readable name of the controller specified by
|
|
||||||
ControllerHandle and ChildHandle in the form of a Unicode string. If the
|
|
||||||
driver specified by This has a user readable name in the language specified by
|
|
||||||
Language, then a pointer to the controller name is returned in ControllerName,
|
|
||||||
and EFI_SUCCESS is returned. If the driver specified by This is not currently
|
|
||||||
managing the controller specified by ControllerHandle and ChildHandle,
|
|
||||||
then EFI_UNSUPPORTED is returned. If the driver specified by This does not
|
|
||||||
support the language specified by Language, then EFI_UNSUPPORTED is returned.
|
|
||||||
|
|
||||||
@param This A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or
|
|
||||||
EFI_COMPONENT_NAME_PROTOCOL instance.
|
|
||||||
@param ControllerHandle The handle of a controller that the driver
|
|
||||||
specified by This is managing. This handle
|
|
||||||
specifies the controller whose name is to be
|
|
||||||
returned.
|
|
||||||
@param ChildHandle The handle of the child controller to retrieve
|
|
||||||
the name of. This is an optional parameter that
|
|
||||||
may be NULL. It will be NULL for device
|
|
||||||
drivers. It will also be NULL for a bus drivers
|
|
||||||
that wish to retrieve the name of the bus
|
|
||||||
controller. It will not be NULL for a bus
|
|
||||||
driver that wishes to retrieve the name of a
|
|
||||||
child controller.
|
|
||||||
@param Language A pointer to a Null-terminated ASCII string
|
|
||||||
array indicating the language. This is the
|
|
||||||
language of the driver name that the caller is
|
|
||||||
requesting, and it must match one of the
|
|
||||||
languages specified in SupportedLanguages. The
|
|
||||||
number of languages supported by a driver is up
|
|
||||||
to the driver writer. Language is specified in
|
|
||||||
RFC 4646 or ISO 639-2 language code format.
|
|
||||||
@param ControllerName A pointer to the Unicode string to return.
|
|
||||||
This Unicode string is the name of the
|
|
||||||
controller specified by ControllerHandle and
|
|
||||||
ChildHandle in the language specified by
|
|
||||||
Language from the point of view of the driver
|
|
||||||
specified by This.
|
|
||||||
|
|
||||||
@retval EFI_SUCCESS The Unicode string for the user readable name in
|
|
||||||
the language specified by Language for the
|
|
||||||
driver specified by This was returned in
|
|
||||||
DriverName.
|
|
||||||
@retval EFI_INVALID_PARAMETER ControllerHandle is not a valid EFI_HANDLE.
|
|
||||||
@retval EFI_INVALID_PARAMETER ChildHandle is not NULL and it is not a valid
|
|
||||||
EFI_HANDLE.
|
|
||||||
@retval EFI_INVALID_PARAMETER Language is NULL.
|
|
||||||
@retval EFI_INVALID_PARAMETER ControllerName is NULL.
|
|
||||||
@retval EFI_UNSUPPORTED The driver specified by This is not currently
|
|
||||||
managing the controller specified by
|
|
||||||
ControllerHandle and ChildHandle.
|
|
||||||
@retval EFI_UNSUPPORTED The driver specified by This does not support
|
|
||||||
the language specified by Language.
|
|
||||||
|
|
||||||
**/
|
|
||||||
EFI_STATUS
|
|
||||||
EFIAPI
|
|
||||||
BlockMmioToBlockIoGetControllerName (
|
|
||||||
IN EFI_COMPONENT_NAME_PROTOCOL *This,
|
|
||||||
IN EFI_HANDLE ControllerHandle,
|
|
||||||
IN EFI_HANDLE ChildHandle OPTIONAL,
|
|
||||||
IN CHAR8 *Language,
|
|
||||||
OUT CHAR16 **ControllerName
|
|
||||||
)
|
|
||||||
{
|
|
||||||
return EFI_UNSUPPORTED;
|
|
||||||
}
|
|
@@ -1,50 +0,0 @@
|
|||||||
/** @file
|
|
||||||
Block IO (memory mapped)
|
|
||||||
|
|
||||||
Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>
|
|
||||||
This program and the accompanying materials
|
|
||||||
are licensed and made available under the terms and conditions of the BSD License
|
|
||||||
which accompanies this distribution. The full text of the license may be found at
|
|
||||||
http://opensource.org/licenses/bsd-license.php
|
|
||||||
|
|
||||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
|
||||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
|
||||||
|
|
||||||
**/
|
|
||||||
|
|
||||||
#ifndef __BLOCK_MMIO_H__
|
|
||||||
#define __BLOCK_MMIO_H__
|
|
||||||
|
|
||||||
#include <Protocol/BlockIo.h>
|
|
||||||
|
|
||||||
#define BLOCK_MMIO_PROTOCOL_GUID \
|
|
||||||
{ \
|
|
||||||
0x6b558ce3, 0x69e5, 0x4c67, {0xa6, 0x34, 0xf7, 0xfe, 0x72, 0xad, 0xbe, 0x84 } \
|
|
||||||
}
|
|
||||||
|
|
||||||
typedef struct _BLOCK_MMIO_PROTOCOL BLOCK_MMIO_PROTOCOL;
|
|
||||||
|
|
||||||
|
|
||||||
///
|
|
||||||
/// This protocol provides control over block devices.
|
|
||||||
///
|
|
||||||
struct _BLOCK_MMIO_PROTOCOL {
|
|
||||||
///
|
|
||||||
/// The revision to which the block IO interface adheres. All future
|
|
||||||
/// revisions must be backwards compatible. If a future version is not
|
|
||||||
/// back wards compatible, it is not the same GUID.
|
|
||||||
///
|
|
||||||
UINT64 Revision;
|
|
||||||
///
|
|
||||||
/// Pointer to the EFI_BLOCK_IO_MEDIA data for this device.
|
|
||||||
///
|
|
||||||
EFI_BLOCK_IO_MEDIA *Media;
|
|
||||||
|
|
||||||
EFI_PHYSICAL_ADDRESS BaseAddress;
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
extern EFI_GUID gBlockMmioProtocolGuid;
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
@@ -66,7 +66,6 @@
|
|||||||
|
|
||||||
[Protocols]
|
[Protocols]
|
||||||
gVirtioDeviceProtocolGuid = {0xfa920010, 0x6785, 0x4941, {0xb6, 0xec, 0x49, 0x8c, 0x57, 0x9f, 0x16, 0x0a}}
|
gVirtioDeviceProtocolGuid = {0xfa920010, 0x6785, 0x4941, {0xb6, 0xec, 0x49, 0x8c, 0x57, 0x9f, 0x16, 0x0a}}
|
||||||
gBlockMmioProtocolGuid = {0x6b558ce3, 0x69e5, 0x4c67, {0xa6, 0x34, 0xf7, 0xfe, 0x72, 0xad, 0xbe, 0x84}}
|
|
||||||
gXenBusProtocolGuid = {0x3d3ca290, 0xb9a5, 0x11e3, {0xb7, 0x5d, 0xb8, 0xac, 0x6f, 0x7d, 0x65, 0xe6}}
|
gXenBusProtocolGuid = {0x3d3ca290, 0xb9a5, 0x11e3, {0xb7, 0x5d, 0xb8, 0xac, 0x6f, 0x7d, 0x65, 0xe6}}
|
||||||
gXenIoProtocolGuid = {0x6efac84f, 0x0ab0, 0x4747, {0x81, 0xbe, 0x85, 0x55, 0x62, 0x59, 0x04, 0x49}}
|
gXenIoProtocolGuid = {0x6efac84f, 0x0ab0, 0x4747, {0x81, 0xbe, 0x85, 0x55, 0x62, 0x59, 0x04, 0x49}}
|
||||||
gIoMmuAbsentProtocolGuid = {0xf8775d50, 0x8abd, 0x4adf, {0x92, 0xac, 0x85, 0x3e, 0x51, 0xf6, 0xc8, 0xdc}}
|
gIoMmuAbsentProtocolGuid = {0xf8775d50, 0x8abd, 0x4adf, {0x92, 0xac, 0x85, 0x3e, 0x51, 0xf6, 0xc8, 0xdc}}
|
||||||
|
@@ -698,7 +698,6 @@
|
|||||||
NULL|IntelFrameworkModulePkg/Library/LegacyBootMaintUiLib/LegacyBootMaintUiLib.inf
|
NULL|IntelFrameworkModulePkg/Library/LegacyBootMaintUiLib/LegacyBootMaintUiLib.inf
|
||||||
!endif
|
!endif
|
||||||
}
|
}
|
||||||
OvmfPkg/BlockMmioToBlockIoDxe/BlockIo.inf
|
|
||||||
OvmfPkg/VirtioPciDeviceDxe/VirtioPciDeviceDxe.inf
|
OvmfPkg/VirtioPciDeviceDxe/VirtioPciDeviceDxe.inf
|
||||||
OvmfPkg/Virtio10Dxe/Virtio10.inf
|
OvmfPkg/Virtio10Dxe/Virtio10.inf
|
||||||
OvmfPkg/VirtioBlkDxe/VirtioBlk.inf
|
OvmfPkg/VirtioBlkDxe/VirtioBlk.inf
|
||||||
|
@@ -225,7 +225,6 @@ INF MdeModulePkg/Universal/ResetSystemRuntimeDxe/ResetSystemRuntimeDxe.inf
|
|||||||
INF MdeModulePkg/Universal/Metronome/Metronome.inf
|
INF MdeModulePkg/Universal/Metronome/Metronome.inf
|
||||||
INF PcAtChipsetPkg/PcatRealTimeClockRuntimeDxe/PcatRealTimeClockRuntimeDxe.inf
|
INF PcAtChipsetPkg/PcatRealTimeClockRuntimeDxe/PcatRealTimeClockRuntimeDxe.inf
|
||||||
|
|
||||||
INF OvmfPkg/BlockMmioToBlockIoDxe/BlockIo.inf
|
|
||||||
INF OvmfPkg/VirtioPciDeviceDxe/VirtioPciDeviceDxe.inf
|
INF OvmfPkg/VirtioPciDeviceDxe/VirtioPciDeviceDxe.inf
|
||||||
INF OvmfPkg/Virtio10Dxe/Virtio10.inf
|
INF OvmfPkg/Virtio10Dxe/Virtio10.inf
|
||||||
INF OvmfPkg/VirtioBlkDxe/VirtioBlk.inf
|
INF OvmfPkg/VirtioBlkDxe/VirtioBlk.inf
|
||||||
|
@@ -707,7 +707,6 @@
|
|||||||
NULL|IntelFrameworkModulePkg/Library/LegacyBootMaintUiLib/LegacyBootMaintUiLib.inf
|
NULL|IntelFrameworkModulePkg/Library/LegacyBootMaintUiLib/LegacyBootMaintUiLib.inf
|
||||||
!endif
|
!endif
|
||||||
}
|
}
|
||||||
OvmfPkg/BlockMmioToBlockIoDxe/BlockIo.inf
|
|
||||||
OvmfPkg/VirtioPciDeviceDxe/VirtioPciDeviceDxe.inf
|
OvmfPkg/VirtioPciDeviceDxe/VirtioPciDeviceDxe.inf
|
||||||
OvmfPkg/Virtio10Dxe/Virtio10.inf
|
OvmfPkg/Virtio10Dxe/Virtio10.inf
|
||||||
OvmfPkg/VirtioBlkDxe/VirtioBlk.inf
|
OvmfPkg/VirtioBlkDxe/VirtioBlk.inf
|
||||||
|
@@ -226,7 +226,6 @@ INF MdeModulePkg/Universal/ResetSystemRuntimeDxe/ResetSystemRuntimeDxe.inf
|
|||||||
INF MdeModulePkg/Universal/Metronome/Metronome.inf
|
INF MdeModulePkg/Universal/Metronome/Metronome.inf
|
||||||
INF PcAtChipsetPkg/PcatRealTimeClockRuntimeDxe/PcatRealTimeClockRuntimeDxe.inf
|
INF PcAtChipsetPkg/PcatRealTimeClockRuntimeDxe/PcatRealTimeClockRuntimeDxe.inf
|
||||||
|
|
||||||
INF OvmfPkg/BlockMmioToBlockIoDxe/BlockIo.inf
|
|
||||||
INF OvmfPkg/VirtioPciDeviceDxe/VirtioPciDeviceDxe.inf
|
INF OvmfPkg/VirtioPciDeviceDxe/VirtioPciDeviceDxe.inf
|
||||||
INF OvmfPkg/Virtio10Dxe/Virtio10.inf
|
INF OvmfPkg/Virtio10Dxe/Virtio10.inf
|
||||||
INF OvmfPkg/VirtioBlkDxe/VirtioBlk.inf
|
INF OvmfPkg/VirtioBlkDxe/VirtioBlk.inf
|
||||||
|
@@ -705,7 +705,6 @@
|
|||||||
NULL|IntelFrameworkModulePkg/Library/LegacyBootMaintUiLib/LegacyBootMaintUiLib.inf
|
NULL|IntelFrameworkModulePkg/Library/LegacyBootMaintUiLib/LegacyBootMaintUiLib.inf
|
||||||
!endif
|
!endif
|
||||||
}
|
}
|
||||||
OvmfPkg/BlockMmioToBlockIoDxe/BlockIo.inf
|
|
||||||
OvmfPkg/VirtioPciDeviceDxe/VirtioPciDeviceDxe.inf
|
OvmfPkg/VirtioPciDeviceDxe/VirtioPciDeviceDxe.inf
|
||||||
OvmfPkg/Virtio10Dxe/Virtio10.inf
|
OvmfPkg/Virtio10Dxe/Virtio10.inf
|
||||||
OvmfPkg/VirtioBlkDxe/VirtioBlk.inf
|
OvmfPkg/VirtioBlkDxe/VirtioBlk.inf
|
||||||
|
@@ -226,7 +226,6 @@ INF MdeModulePkg/Universal/ResetSystemRuntimeDxe/ResetSystemRuntimeDxe.inf
|
|||||||
INF MdeModulePkg/Universal/Metronome/Metronome.inf
|
INF MdeModulePkg/Universal/Metronome/Metronome.inf
|
||||||
INF PcAtChipsetPkg/PcatRealTimeClockRuntimeDxe/PcatRealTimeClockRuntimeDxe.inf
|
INF PcAtChipsetPkg/PcatRealTimeClockRuntimeDxe/PcatRealTimeClockRuntimeDxe.inf
|
||||||
|
|
||||||
INF OvmfPkg/BlockMmioToBlockIoDxe/BlockIo.inf
|
|
||||||
INF OvmfPkg/VirtioPciDeviceDxe/VirtioPciDeviceDxe.inf
|
INF OvmfPkg/VirtioPciDeviceDxe/VirtioPciDeviceDxe.inf
|
||||||
INF OvmfPkg/Virtio10Dxe/Virtio10.inf
|
INF OvmfPkg/Virtio10Dxe/Virtio10.inf
|
||||||
INF OvmfPkg/VirtioBlkDxe/VirtioBlk.inf
|
INF OvmfPkg/VirtioBlkDxe/VirtioBlk.inf
|
||||||
|
Reference in New Issue
Block a user