]> git.proxmox.com Git - mirror_edk2.git/commitdiff
OVMF: Add BlockMmioToBlockIoDxe driver
authorjljusten <jljusten@6f19259b-4bc3-4df7-8a09-765794883524>
Sun, 21 Mar 2010 00:34:15 +0000 (00:34 +0000)
committerjljusten <jljusten@6f19259b-4bc3-4df7-8a09-765794883524>
Sun, 21 Mar 2010 00:34:15 +0000 (00:34 +0000)
This driver will wrapper BlockMmio protocol instances to produce the
standard UEFI BlockIo protocol.

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@10296 6f19259b-4bc3-4df7-8a09-765794883524

OvmfPkg/BlockMmioToBlockIoDxe/BlockIo.c [new file with mode: 0644]
OvmfPkg/BlockMmioToBlockIoDxe/BlockIo.h [new file with mode: 0644]
OvmfPkg/BlockMmioToBlockIoDxe/BlockIo.inf [new file with mode: 0644]
OvmfPkg/BlockMmioToBlockIoDxe/ComponentName.c [new file with mode: 0644]
OvmfPkg/OvmfPkg.fdf
OvmfPkg/OvmfPkgIa32.dsc
OvmfPkg/OvmfPkgIa32X64.dsc
OvmfPkg/OvmfPkgIa32X64.fdf
OvmfPkg/OvmfPkgX64.dsc

diff --git a/OvmfPkg/BlockMmioToBlockIoDxe/BlockIo.c b/OvmfPkg/BlockMmioToBlockIoDxe/BlockIo.c
new file mode 100644 (file)
index 0000000..bdd1402
--- /dev/null
@@ -0,0 +1,526 @@
+/** @file\r
+  The driver wrappers BlockMmio protocol instances to produce\r
+  Block I/O Protocol instances.\r
+\r
+  Copyright (c) 2007 - 2010, Intel Corporation\r
+  All rights reserved. This program and the accompanying materials\r
+  are licensed and made available under the terms and conditions of the BSD License\r
+  which accompanies this distribution.  The full text of the license may be found at\r
+  http://opensource.org/licenses/bsd-license.php\r
+  \r
+  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
+  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+\r
+**/\r
+\r
+#include "BlockIo.h"\r
+\r
+EFI_DRIVER_BINDING_PROTOCOL gBlockIoDriverBinding = {\r
+  BlockIoDriverBindingSupported,\r
+  BlockIoDriverBindingStart,\r
+  BlockIoDriverBindingStop,\r
+  0x11,\r
+  NULL,\r
+  NULL\r
+};\r
+\r
+/**\r
+  Reset the block device.\r
+\r
+  This function implements EFI_BLOCK_IO_PROTOCOL.Reset(). \r
+  It resets the block device hardware.\r
+  ExtendedVerification is ignored in this implementation.\r
+\r
+  @param  This                   Indicates a pointer to the calling context.\r
+  @param  ExtendedVerification   Indicates that the driver may perform a more exhaustive\r
+                                 verification operation of the device during reset.\r
+\r
+  @retval EFI_SUCCESS            The block device was reset.\r
+  @retval EFI_DEVICE_ERROR       The block device is not functioning correctly and could not be reset.\r
+\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+BlockIoReset (\r
+  IN EFI_BLOCK_IO_PROTOCOL    *This,\r
+  IN BOOLEAN                  ExtendedVerification\r
+  )\r
+{\r
+  return EFI_SUCCESS;\r
+}\r
+\r
+/**\r
+  Reads the requested number of blocks from the device.\r
+\r
+  This function implements EFI_BLOCK_IO_PROTOCOL.ReadBlocks(). \r
+  It reads the requested number of blocks from the device.\r
+  All the blocks are read, or an error is returned.\r
+\r
+  @param  This                   Indicates a pointer to the calling context.\r
+  @param  ReadData               If TRUE then read data.  If FALSE then write data.\r
+  @param  MediaId                The media ID that the read request is for.\r
+  @param  Lba                    The starting logical block address to read from on the device.\r
+  @param  BufferSize             The size of the Buffer in bytes.\r
+                                 This must be a multiple of the intrinsic block size of the device.\r
+  @param  Buffer                 A pointer to the destination buffer for the data. The caller is\r
+                                 responsible for either having implicit or explicit ownership of the buffer.\r
+\r
+  @retval EFI_SUCCESS            The data was read correctly from the device.\r
+  @retval EFI_DEVICE_ERROR       The device reported an error while attempting to perform the read operation.\r
+  @retval EFI_NO_MEDIA           There is no media in the device.\r
+  @retval EFI_MEDIA_CHANGED      The MediaId is not for the current media.\r
+  @retval EFI_BAD_BUFFER_SIZE    The BufferSize parameter is not a multiple of the intrinsic block size of the device.\r
+  @retval EFI_INVALID_PARAMETER  The read request contains LBAs that are not valid,\r
+                                 or the buffer is not on proper alignment.\r
+\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+ReadOrWriteBlocks (\r
+  IN EFI_BLOCK_IO_PROTOCOL    *This,\r
+  IN BOOLEAN                  ReadData,\r
+  IN UINT32                   MediaId,\r
+  IN EFI_LBA                  Lba,\r
+  IN UINTN                    BufferSize,\r
+  OUT VOID                    *Buffer\r
+  )\r
+{\r
+  EFI_STATUS                    Status;\r
+  BLOCK_MMIO_TO_BLOCK_IO_DEVICE *Private;\r
+  UINTN                         TotalBlock;\r
+  EFI_BLOCK_IO_MEDIA            *Media;\r
+  UINT64                        Address;\r
+  UINTN                         Count;\r
+  EFI_CPU_IO_PROTOCOL_IO_MEM    CpuAccessFunction;\r
+\r
+  //\r
+  // First, validate the parameters\r
+  //\r
+  if ((Buffer == NULL) || (BufferSize == 0)) {\r
+    return EFI_INVALID_PARAMETER;\r
+  }\r
+\r
+  //\r
+  // Get private data structure\r
+  //\r
+  Private = PRIVATE_FROM_BLOCK_IO (This);\r
+  Media   = Private->BlockMmio->Media;\r
+\r
+  //\r
+  // BufferSize must be a multiple of the intrinsic block size of the device.\r
+  //\r
+  if ((BufferSize % Media->BlockSize) != 0) {\r
+    return EFI_BAD_BUFFER_SIZE;\r
+  }\r
+\r
+  TotalBlock = BufferSize / Media->BlockSize;\r
+\r
+  //\r
+  // Make sure the range to read is valid.\r
+  //\r
+  if (Lba + TotalBlock - 1 > Media->LastBlock) {\r
+    return EFI_INVALID_PARAMETER;\r
+  }\r
+\r
+  if (!(Media->MediaPresent)) {\r
+    return EFI_NO_MEDIA;\r
+  }\r
+\r
+  if (MediaId != Media->MediaId) {\r
+    return EFI_MEDIA_CHANGED;\r
+  }\r
+\r
+  Address = Private->BlockMmio->BaseAddress;\r
+  Address += Media->BlockSize * Lba;\r
+\r
+  Count = BufferSize / 8;\r
+\r
+  if (ReadData) {\r
+    CpuAccessFunction = Private->CpuIo->Mem.Read;\r
+  } else {\r
+    CpuAccessFunction = Private->CpuIo->Mem.Write;\r
+  }\r
+\r
+  Status = (CpuAccessFunction) (\r
+             Private->CpuIo,\r
+             EfiCpuIoWidthUint64,\r
+             Address,\r
+             Count,\r
+             Buffer\r
+             );\r
+\r
+  return Status;\r
+}\r
+\r
+\r
+/**\r
+  Reads the requested number of blocks from the device.\r
+\r
+  This function implements EFI_BLOCK_IO_PROTOCOL.ReadBlocks(). \r
+  It reads the requested number of blocks from the device.\r
+  All the blocks are read, or an error is returned.\r
+\r
+  @param  This                   Indicates a pointer to the calling context.\r
+  @param  MediaId                The media ID that the read request is for.\r
+  @param  Lba                    The starting logical block address to read from on the device.\r
+  @param  BufferSize             The size of the Buffer in bytes.\r
+                                 This must be a multiple of the intrinsic block size of the device.\r
+  @param  Buffer                 A pointer to the destination buffer for the data. The caller is\r
+                                 responsible for either having implicit or explicit ownership of the buffer.\r
+\r
+  @retval EFI_SUCCESS            The data was read correctly from the device.\r
+  @retval EFI_DEVICE_ERROR       The device reported an error while attempting to perform the read operation.\r
+  @retval EFI_NO_MEDIA           There is no media in the device.\r
+  @retval EFI_MEDIA_CHANGED      The MediaId is not for the current media.\r
+  @retval EFI_BAD_BUFFER_SIZE    The BufferSize parameter is not a multiple of the intrinsic block size of the device.\r
+  @retval EFI_INVALID_PARAMETER  The read request contains LBAs that are not valid,\r
+                                 or the buffer is not on proper alignment.\r
+\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+BlockIoReadBlocks (\r
+  IN EFI_BLOCK_IO_PROTOCOL    *This,\r
+  IN UINT32                   MediaId,\r
+  IN EFI_LBA                  Lba,\r
+  IN UINTN                    BufferSize,\r
+  OUT VOID                    *Buffer\r
+  )\r
+{\r
+  DEBUG ((EFI_D_INFO, "BlockIo (MMIO) ReadBlocks: lba=0x%lx, size=0x%x\n", Lba, BufferSize));\r
+  return ReadOrWriteBlocks (\r
+    This,\r
+    TRUE,\r
+    MediaId,\r
+    Lba,\r
+    BufferSize,\r
+    Buffer\r
+    );\r
+}\r
+\r
+\r
+/**\r
+  Writes a specified number of blocks to the device.\r
+\r
+  This function implements EFI_BLOCK_IO_PROTOCOL.WriteBlocks(). \r
+  It writes a specified number of blocks to the device.\r
+  All blocks are written, or an error is returned.\r
+\r
+  @param  This                   Indicates a pointer to the calling context.\r
+  @param  MediaId                The media ID that the write request is for.\r
+  @param  Lba                    The starting logical block address to be written.\r
+  @param  BufferSize             The size of the Buffer in bytes.\r
+                                 This must be a multiple of the intrinsic block size of the device.\r
+  @param  Buffer                 Pointer to the source buffer for the data.\r
+\r
+  @retval EFI_SUCCESS            The data were written correctly to the device.\r
+  @retval EFI_WRITE_PROTECTED    The device cannot be written to.\r
+  @retval EFI_NO_MEDIA           There is no media in the device.\r
+  @retval EFI_MEDIA_CHANGED      The MediaId is not for the current media.\r
+  @retval EFI_DEVICE_ERROR       The device reported an error while attempting to perform the write operation.\r
+  @retval EFI_BAD_BUFFER_SIZE    The BufferSize parameter is not a multiple of the intrinsic\r
+                                 block size of the device.\r
+  @retval EFI_INVALID_PARAMETER  The write request contains LBAs that are not valid,\r
+                                 or the buffer is not on proper alignment.\r
+\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+BlockIoWriteBlocks (\r
+  IN EFI_BLOCK_IO_PROTOCOL    *This,\r
+  IN UINT32                   MediaId,\r
+  IN EFI_LBA                  Lba,\r
+  IN UINTN                    BufferSize,\r
+  IN VOID                     *Buffer\r
+  )\r
+{\r
+  DEBUG ((EFI_D_INFO, "BlockIo (MMIO) WriteBlocks: lba=0x%lx, size=0x%x\n", Lba, BufferSize));\r
+  return ReadOrWriteBlocks (\r
+    This,\r
+    FALSE,\r
+    MediaId,\r
+    Lba,\r
+    BufferSize,\r
+    Buffer\r
+    );\r
+}\r
+\r
+/**\r
+  Flushes all modified data to a physical block device.\r
+\r
+  @param  This                   Indicates a pointer to the calling context.\r
+\r
+  @retval EFI_SUCCESS            All outstanding data were written correctly to the device.\r
+  @retval EFI_DEVICE_ERROR       The device reported an error while attempting to write data.\r
+  @retval EFI_NO_MEDIA           There is no media in the device.\r
+\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+BlockIoFlushBlocks (\r
+  IN EFI_BLOCK_IO_PROTOCOL  *This\r
+  )\r
+{\r
+  return EFI_SUCCESS;\r
+}\r
+\r
+\r
+/**\r
+  Initialize data for device that does not support multiple LUNSs.\r
+\r
+  @param  This            The Driver Binding Protocol instance.\r
+  @param  Controller      The device to initialize.\r
+  @param  BlockMmio       Pointer to USB_MASS_TRANSPORT.\r
+  @param  Context         Parameter for USB_MASS_DEVICE.Context.\r
+\r
+  @retval EFI_SUCCESS     Initialization succeeds.\r
+  @retval Other           Initialization fails.\r
+\r
+**/\r
+EFI_STATUS\r
+BlockIoInit (\r
+  IN EFI_DRIVER_BINDING_PROTOCOL   *This,\r
+  IN EFI_HANDLE                    Controller\r
+  )\r
+{\r
+  EFI_STATUS                     Status;\r
+  BLOCK_MMIO_TO_BLOCK_IO_DEVICE  *Private;\r
+  BLOCK_MMIO_PROTOCOL            *BlockMmio;\r
+\r
+  Private = (BLOCK_MMIO_TO_BLOCK_IO_DEVICE*) AllocateZeroPool (sizeof (Private));\r
+  ASSERT (Private != NULL);\r
+\r
+  Status = gBS->LocateProtocol (\r
+                  &gEfiCpuIo2ProtocolGuid,\r
+                  NULL,\r
+                  (VOID **) &(Private->CpuIo)\r
+                  );\r
+  ASSERT_EFI_ERROR (Status);\r
+\r
+  Status = gBS->OpenProtocol (\r
+                  Controller,\r
+                  &gBlockMmioProtocolGuid,\r
+                  (VOID **) &BlockMmio,\r
+                  This->DriverBindingHandle,\r
+                  Controller,\r
+                  EFI_OPEN_PROTOCOL_BY_DRIVER\r
+                  );\r
+  if (EFI_ERROR (Status)) {\r
+    DEBUG ((EFI_D_ERROR, "BlockIoInit: OpenBlockMmioProtocol By Driver (%r)\n", Status));\r
+    goto ON_ERROR;\r
+  }\r
+  DEBUG ((EFI_D_INFO, "BlockMmio: 0x%x\n", BlockMmio));\r
+  DEBUG ((EFI_D_INFO, "BlockMmio->Media->LastBlock: 0x%lx\n", BlockMmio->Media->LastBlock));\r
+  \r
+  Private->Signature            = BLOCK_MMIO_TO_BLOCK_IO_SIGNATURE;\r
+  Private->Controller           = Controller;\r
+  Private->BlockMmio            = BlockMmio;\r
+  Private->BlockIo.Media        = BlockMmio->Media;\r
+  Private->BlockIo.Reset        = BlockIoReset;\r
+  Private->BlockIo.ReadBlocks   = BlockIoReadBlocks;\r
+  Private->BlockIo.WriteBlocks  = BlockIoWriteBlocks;\r
+  Private->BlockIo.FlushBlocks  = BlockIoFlushBlocks;\r
+\r
+  DEBUG ((EFI_D_INFO, "Private->BlockIo.Media->LastBlock: 0x%lx\n", Private->BlockIo.Media->LastBlock));\r
+\r
+  Status = gBS->InstallProtocolInterface (\r
+                  &Controller,\r
+                  &gEfiBlockIoProtocolGuid,\r
+                  EFI_NATIVE_INTERFACE,\r
+                  &Private->BlockIo\r
+                  );\r
+  if (EFI_ERROR (Status)) {\r
+    goto ON_ERROR;\r
+  }\r
+\r
+  return EFI_SUCCESS;\r
+\r
+ON_ERROR:\r
+  if (Private != NULL) {\r
+    FreePool (Private);\r
+  }\r
+  if (BlockMmio != NULL) {\r
+    gBS->CloseProtocol (\r
+           Controller,\r
+           &gBlockMmioProtocolGuid,\r
+           This->DriverBindingHandle,\r
+           Controller\r
+           );\r
+  }\r
+  return Status;  \r
+}\r
+\r
+\r
+/**\r
+  Check whether the controller is a supported USB mass storage.\r
+\r
+  @param  This                   The USB mass storage driver binding protocol.\r
+  @param  Controller             The controller handle to check.\r
+  @param  RemainingDevicePath    The remaining device path.\r
+\r
+  @retval EFI_SUCCESS            The driver supports this controller.\r
+  @retval other                  This device isn't supported.\r
+\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+BlockIoDriverBindingSupported (\r
+  IN EFI_DRIVER_BINDING_PROTOCOL  *This,\r
+  IN EFI_HANDLE                   Controller,\r
+  IN EFI_DEVICE_PATH_PROTOCOL     *RemainingDevicePath\r
+  )\r
+{\r
+  EFI_STATUS                    Status;\r
+  BLOCK_MMIO_PROTOCOL           *BlockMmio;\r
+\r
+  Status = gBS->OpenProtocol (\r
+                  Controller,\r
+                  &gBlockMmioProtocolGuid,\r
+                  (VOID **) &BlockMmio,\r
+                  This->DriverBindingHandle,\r
+                  Controller,\r
+                  EFI_OPEN_PROTOCOL_BY_DRIVER\r
+                  );\r
+  if (EFI_ERROR (Status)) {\r
+    return Status;\r
+  }\r
+\r
+  gBS->CloseProtocol (\r
+         Controller,\r
+         &gBlockMmioProtocolGuid,\r
+         This->DriverBindingHandle,\r
+         Controller\r
+         );\r
+\r
+  return Status;\r
+}\r
+\r
+/**\r
+  Starts the USB mass storage device with this driver.\r
+\r
+  This function consumes USB I/O Portocol, intializes USB mass storage device,\r
+  installs Block I/O Protocol, and submits Asynchronous Interrupt\r
+  Transfer to manage the USB mass storage device.\r
+\r
+  @param  This                  The USB mass storage driver binding protocol.\r
+  @param  Controller            The USB mass storage device to start on\r
+  @param  RemainingDevicePath   The remaining device path.\r
+\r
+  @retval EFI_SUCCESS           This driver supports this device.\r
+  @retval EFI_UNSUPPORTED       This driver does not support this device.\r
+  @retval EFI_DEVICE_ERROR      This driver cannot be started due to device Error.\r
+  @retval EFI_OUT_OF_RESOURCES  Can't allocate memory resources.\r
+  @retval EFI_ALREADY_STARTED   This driver has been started.\r
+\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+BlockIoDriverBindingStart (\r
+  IN EFI_DRIVER_BINDING_PROTOCOL  *This,\r
+  IN EFI_HANDLE                   Controller,\r
+  IN EFI_DEVICE_PATH_PROTOCOL     *RemainingDevicePath\r
+  )\r
+{\r
+  EFI_STATUS                    Status;\r
+  \r
+  Status = BlockIoInit (This, Controller);\r
+  if (EFI_ERROR (Status)) {\r
+    DEBUG ((EFI_D_ERROR, "BlockIoDriverBindingStart: BlockIoInit (%r)\n", Status));\r
+    return Status;\r
+  }\r
+\r
+  DEBUG ((EFI_D_INIT, "BlockIoDriverBindingStart: Successfully started\n"));\r
+  return Status;\r
+}\r
+\r
+\r
+/**\r
+  Stop controlling the device.\r
+\r
+  @param  This                   The USB mass storage driver binding\r
+  @param  Controller             The device controller controlled by the driver.\r
+  @param  NumberOfChildren       The number of children of this device\r
+  @param  ChildHandleBuffer      The buffer of children handle.\r
+\r
+  @retval EFI_SUCCESS            The driver stopped from controlling the device.\r
+  @retval EFI_DEVICE_ERROR       The device could not be stopped due to a device error.\r
+  @retval EFI_UNSUPPORTED        Block I/O Protocol is not installed on Controller.\r
+  @retval Others                 Failed to stop the driver\r
+\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+BlockIoDriverBindingStop (\r
+  IN  EFI_DRIVER_BINDING_PROTOCOL *This,\r
+  IN  EFI_HANDLE                  Controller,\r
+  IN  UINTN                       NumberOfChildren,\r
+  IN  EFI_HANDLE                  *ChildHandleBuffer\r
+  )\r
+{\r
+  EFI_STATUS                    Status;\r
+  BLOCK_MMIO_TO_BLOCK_IO_DEVICE *Private;\r
+\r
+  Private = PRIVATE_FROM_BLOCK_IO (This);\r
+\r
+  //\r
+  // Uninstall Block I/O protocol from the device handle,\r
+  // then call the transport protocol to stop itself.\r
+  //\r
+  Status = gBS->UninstallProtocolInterface (\r
+                  Controller,\r
+                  &gEfiBlockIoProtocolGuid,\r
+                  &Private->BlockIo\r
+                  );\r
+  if (EFI_ERROR (Status)) {\r
+    return Status;\r
+  }\r
+\r
+  gBS->CloseProtocol (\r
+        Controller,\r
+        &gBlockMmioProtocolGuid,\r
+        This->DriverBindingHandle,\r
+        Controller\r
+        );\r
+\r
+  FreePool (Private);\r
+  \r
+  DEBUG ((EFI_D_INFO, "Successfully stopped BlockIo on BlockMmio\n"));\r
+  return EFI_SUCCESS;\r
+}\r
+\r
+/**\r
+  Entrypoint of Block MMIO to Block IO Driver.\r
+\r
+  This function is the entrypoint of USB Mass Storage Driver. It installs Driver Binding\r
+  Protocol together with Component Name Protocols.\r
+\r
+  @param  ImageHandle       The firmware allocated handle for the EFI image.\r
+  @param  SystemTable       A pointer to the EFI System Table.\r
+\r
+  @retval EFI_SUCCESS       The entry point is executed successfully.\r
+\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+BlockMmioToBlockIoEntryPoint (\r
+  IN EFI_HANDLE               ImageHandle,\r
+  IN EFI_SYSTEM_TABLE         *SystemTable\r
+  )\r
+{\r
+  EFI_STATUS  Status;\r
+\r
+  //\r
+  // Install driver binding protocol\r
+  //\r
+  Status = EfiLibInstallDriverBindingComponentName2 (\r
+             ImageHandle,\r
+             SystemTable,\r
+             &gBlockIoDriverBinding,\r
+             ImageHandle,\r
+             &gBlockMmioToBlockIoComponentName,\r
+             &gBlockMmioToBlockIoComponentName2\r
+             );\r
+  ASSERT_EFI_ERROR (Status);\r
+\r
+  return EFI_SUCCESS;\r
+}\r
diff --git a/OvmfPkg/BlockMmioToBlockIoDxe/BlockIo.h b/OvmfPkg/BlockMmioToBlockIoDxe/BlockIo.h
new file mode 100644 (file)
index 0000000..18e5bcf
--- /dev/null
@@ -0,0 +1,346 @@
+/** @file\r
+  Definitions of functions for Driver Binding Protocol and Block I/O Protocol,\r
+  and other internal definitions.\r
+\r
+  Copyright (c) 2007 - 2010, Intel Corporation\r
+  All rights reserved. This program and the accompanying materials\r
+  are licensed and made available under the terms and conditions of the BSD License\r
+  which accompanies this distribution.  The full text of the license may be found at\r
+  http://opensource.org/licenses/bsd-license.php\r
+\r
+  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
+  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+\r
+**/\r
+\r
+#ifndef _EFI_BLOCK_MMIO_TO_BLOCK_IO_H_\r
+#define _EFI_BLOCK_MMIO_TO_BLOCK_IO_H_\r
+\r
+#include <Uefi.h>\r
+#include <Protocol/BlockMmio.h>\r
+#include <Protocol/ComponentName.h>\r
+#include <Protocol/ComponentName2.h>\r
+#include <Protocol/CpuIo2.h>\r
+#include <Protocol/DevicePath.h>\r
+#include <Protocol/DriverBinding.h>\r
+#include <Library/BaseLib.h>\r
+#include <Library/DebugLib.h>\r
+#include <Library/MemoryAllocationLib.h>\r
+#include <Library/UefiBootServicesTableLib.h>\r
+#include <Library/UefiLib.h>\r
+\r
+#define  BLOCK_MMIO_TO_BLOCK_IO_SIGNATURE    SIGNATURE_32 ('B', 'M', 'I', 'O')\r
+\r
+#define PRIVATE_FROM_BLOCK_IO(a) \\r
+        CR (a, BLOCK_MMIO_TO_BLOCK_IO_DEVICE, BlockIo, BLOCK_MMIO_TO_BLOCK_IO_SIGNATURE)\r
+\r
+extern EFI_COMPONENT_NAME_PROTOCOL   gBlockMmioToBlockIoComponentName;\r
+extern EFI_COMPONENT_NAME2_PROTOCOL  gBlockMmioToBlockIoComponentName2;\r
+\r
+typedef struct {\r
+  UINT32                    Signature;\r
+  EFI_HANDLE                Controller;\r
+  BLOCK_MMIO_PROTOCOL       *BlockMmio;\r
+  EFI_CPU_IO2_PROTOCOL      *CpuIo;\r
+  EFI_DEVICE_PATH_PROTOCOL  *DevicePath;\r
+  EFI_BLOCK_IO_PROTOCOL     BlockIo;\r
+} BLOCK_MMIO_TO_BLOCK_IO_DEVICE;\r
+\r
+//\r
+// Functions for Driver Binding Protocol\r
+//\r
+\r
+/**\r
+  Check whether the controller is a supported.\r
+\r
+  @param  This                   The driver binding protocol.\r
+  @param  Controller             The controller handle to check.\r
+  @param  RemainingDevicePath    The remaining device path.\r
+\r
+  @retval EFI_SUCCESS            The driver supports this controller.\r
+  @retval other                  This device isn't supported.\r
+\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+BlockIoDriverBindingSupported (\r
+  IN EFI_DRIVER_BINDING_PROTOCOL  *This,\r
+  IN EFI_HANDLE                   Controller,\r
+  IN EFI_DEVICE_PATH_PROTOCOL     *RemainingDevicePath\r
+  );\r
+\r
+/**\r
+  Starts the BlockIo device with this driver.\r
+\r
+  This function consumes Block MMIO Portocol and\r
+  installs Block I/O Protocol.\r
+\r
+  @param  This                  The driver binding protocol.\r
+  @param  Controller            The Block MMIO device to start on\r
+  @param  RemainingDevicePath   The remaining device path.\r
+\r
+  @retval EFI_SUCCESS           This driver supports this device.\r
+  @retval EFI_UNSUPPORTED       This driver does not support this device.\r
+  @retval EFI_DEVICE_ERROR      This driver cannot be started due to device Error.\r
+  @retval EFI_OUT_OF_RESOURCES  Can't allocate memory resources.\r
+  @retval EFI_ALREADY_STARTED   This driver has been started.\r
+\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+BlockIoDriverBindingStart (\r
+  IN EFI_DRIVER_BINDING_PROTOCOL  *This,\r
+  IN EFI_HANDLE                   Controller,\r
+  IN EFI_DEVICE_PATH_PROTOCOL     *RemainingDevicePath\r
+  );\r
+\r
+/**\r
+  Stop controlling the device.\r
+\r
+  @param  This                   The driver binding\r
+  @param  Controller             The device controller controlled by the driver.\r
+  @param  NumberOfChildren       The number of children of this device\r
+  @param  ChildHandleBuffer      The buffer of children handle.\r
+\r
+  @retval EFI_SUCCESS            The driver stopped from controlling the device.\r
+  @retval EFI_DEVICE_ERROR       The device could not be stopped due to a device error.\r
+  @retval EFI_UNSUPPORTED        Block I/O Protocol is not installed on Controller.\r
+  @retval Others                 Failed to stop the driver\r
+\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+BlockIoDriverBindingStop (\r
+  IN  EFI_DRIVER_BINDING_PROTOCOL *This,\r
+  IN  EFI_HANDLE                  Controller,\r
+  IN  UINTN                       NumberOfChildren,\r
+  IN  EFI_HANDLE                  *ChildHandleBuffer\r
+  );\r
+\r
+//\r
+// Functions for Block I/O Protocol\r
+//\r
+\r
+/**\r
+  Reset the block device.\r
+\r
+  This function implements EFI_BLOCK_IO_PROTOCOL.Reset(). \r
+  It resets the block device hardware.\r
+  ExtendedVerification is ignored in this implementation.\r
+\r
+  @param  This                   Indicates a pointer to the calling context.\r
+  @param  ExtendedVerification   Indicates that the driver may perform a more exhaustive\r
+                                 verification operation of the device during reset.\r
+\r
+  @retval EFI_SUCCESS            The block device was reset.\r
+  @retval EFI_DEVICE_ERROR       The block device is not functioning correctly and could not be reset.\r
+\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+BlockIoReset (\r
+  IN EFI_BLOCK_IO_PROTOCOL    *This,\r
+  IN BOOLEAN                  ExtendedVerification\r
+  );\r
+\r
+/**\r
+  Reads the requested number of blocks from the device.\r
+\r
+  This function implements EFI_BLOCK_IO_PROTOCOL.ReadBlocks(). \r
+  It reads the requested number of blocks from the device.\r
+  All the blocks are read, or an error is returned.\r
+\r
+  @param  This                   Indicates a pointer to the calling context.\r
+  @param  MediaId                The media ID that the read request is for.\r
+  @param  Lba                    The starting logical block address to read from on the device.\r
+  @param  BufferSize             The size of the Buffer in bytes.\r
+                                 This must be a multiple of the intrinsic block size of the device.\r
+  @param  Buffer                 A pointer to the destination buffer for the data. The caller is\r
+                                 responsible for either having implicit or explicit ownership of the buffer.\r
+\r
+  @retval EFI_SUCCESS            The data was read correctly from the device.\r
+  @retval EFI_DEVICE_ERROR       The device reported an error while attempting to perform the read operation.\r
+  @retval EFI_NO_MEDIA           There is no media in the device.\r
+  @retval EFI_MEDIA_CHANGED      The MediaId is not for the current media.\r
+  @retval EFI_BAD_BUFFER_SIZE    The BufferSize parameter is not a multiple of the intrinsic block size of the device.\r
+  @retval EFI_INVALID_PARAMETER  The read request contains LBAs that are not valid,\r
+                                 or the buffer is not on proper alignment.\r
+\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+BlockIoReadBlocks (\r
+  IN EFI_BLOCK_IO_PROTOCOL    *This,\r
+  IN UINT32                   MediaId,\r
+  IN EFI_LBA                  Lba,\r
+  IN UINTN                    BufferSize,\r
+  OUT VOID                    *Buffer\r
+  );\r
+\r
+/**\r
+  Writes a specified number of blocks to the device.\r
+\r
+  This function implements EFI_BLOCK_IO_PROTOCOL.WriteBlocks(). \r
+  It writes a specified number of blocks to the device.\r
+  All blocks are written, or an error is returned.\r
+\r
+  @param  This                   Indicates a pointer to the calling context.\r
+  @param  MediaId                The media ID that the write request is for.\r
+  @param  Lba                    The starting logical block address to be written.\r
+  @param  BufferSize             The size of the Buffer in bytes.\r
+                                 This must be a multiple of the intrinsic block size of the device.\r
+  @param  Buffer                 Pointer to the source buffer for the data.\r
+\r
+  @retval EFI_SUCCESS            The data were written correctly to the device.\r
+  @retval EFI_WRITE_PROTECTED    The device cannot be written to.\r
+  @retval EFI_NO_MEDIA           There is no media in the device.\r
+  @retval EFI_MEDIA_CHANGED      The MediaId is not for the current media.\r
+  @retval EFI_DEVICE_ERROR       The device reported an error while attempting to perform the write operation.\r
+  @retval EFI_BAD_BUFFER_SIZE    The BufferSize parameter is not a multiple of the intrinsic\r
+                                 block size of the device.\r
+  @retval EFI_INVALID_PARAMETER  The write request contains LBAs that are not valid,\r
+                                 or the buffer is not on proper alignment.\r
+\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+BlockIoWriteBlocks (\r
+  IN EFI_BLOCK_IO_PROTOCOL    *This,\r
+  IN UINT32                   MediaId,\r
+  IN EFI_LBA                  Lba,\r
+  IN UINTN                    BufferSize,\r
+  IN VOID                     *Buffer\r
+  );\r
+\r
+/**\r
+  Flushes all modified data to a physical block device.\r
+\r
+  @param  This                   Indicates a pointer to the calling context.\r
+\r
+  @retval EFI_SUCCESS            All outstanding data were written correctly to the device.\r
+  @retval EFI_DEVICE_ERROR       The device reported an error while attempting to write data.\r
+  @retval EFI_NO_MEDIA           There is no media in the device.\r
+\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+BlockIoFlushBlocks (\r
+  IN EFI_BLOCK_IO_PROTOCOL  *This\r
+  );\r
+\r
+//\r
+// EFI Component Name Functions\r
+//\r
+\r
+/**\r
+  Retrieves a Unicode string that is the user readable name of the driver.\r
+\r
+  This function retrieves the user readable name of a driver in the form of a\r
+  Unicode string. If the driver specified by This has a user readable name in\r
+  the language specified by Language, then a pointer to the driver name is\r
+  returned in DriverName, and EFI_SUCCESS is returned. If the driver specified\r
+  by This does not support the language specified by Language,\r
+  then EFI_UNSUPPORTED is returned.\r
+\r
+  @param  This                  A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or\r
+                                EFI_COMPONENT_NAME_PROTOCOL instance.\r
+  @param  Language              A pointer to a Null-terminated ASCII string\r
+                                array indicating the language. This is the\r
+                                language of the driver name that the caller is\r
+                                requesting, and it must match one of the\r
+                                languages specified in SupportedLanguages. The\r
+                                number of languages supported by a driver is up\r
+                                to the driver writer. Language is specified\r
+                                in RFC 4646 or ISO 639-2 language code format.\r
+  @param  DriverName            A pointer to the Unicode string to return.\r
+                                This Unicode string is the name of the\r
+                                driver specified by This in the language\r
+                                specified by Language.\r
+\r
+  @retval EFI_SUCCESS           The Unicode string for the Driver specified by\r
+                                This and the language specified by Language was\r
+                                returned in DriverName.\r
+  @retval EFI_INVALID_PARAMETER Language is NULL.\r
+  @retval EFI_INVALID_PARAMETER DriverName is NULL.\r
+  @retval EFI_UNSUPPORTED       The driver specified by This does not support\r
+                                the language specified by Language.\r
+\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+BlockMmioToBlockIoGetDriverName (\r
+  IN  EFI_COMPONENT_NAME_PROTOCOL  *This,\r
+  IN  CHAR8                        *Language,\r
+  OUT CHAR16                       **DriverName\r
+  );\r
+\r
+\r
+/**\r
+  Retrieves a Unicode string that is the user readable name of the controller\r
+  that is being managed by a driver.\r
+\r
+  This function retrieves the user readable name of the controller specified by\r
+  ControllerHandle and ChildHandle in the form of a Unicode string. If the\r
+  driver specified by This has a user readable name in the language specified by\r
+  Language, then a pointer to the controller name is returned in ControllerName,\r
+  and EFI_SUCCESS is returned.  If the driver specified by This is not currently\r
+  managing the controller specified by ControllerHandle and ChildHandle,\r
+  then EFI_UNSUPPORTED is returned.  If the driver specified by This does not\r
+  support the language specified by Language, then EFI_UNSUPPORTED is returned.\r
+\r
+  @param  This                  A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or\r
+                                EFI_COMPONENT_NAME_PROTOCOL instance.\r
+  @param  ControllerHandle      The handle of a controller that the driver\r
+                                specified by This is managing.  This handle\r
+                                specifies the controller whose name is to be\r
+                                returned.\r
+  @param  ChildHandle           The handle of the child controller to retrieve\r
+                                the name of.  This is an optional parameter that\r
+                                may be NULL.  It will be NULL for device\r
+                                drivers.  It will also be NULL for a bus drivers\r
+                                that wish to retrieve the name of the bus\r
+                                controller.  It will not be NULL for a bus\r
+                                driver that wishes to retrieve the name of a\r
+                                child controller.\r
+  @param  Language              A pointer to a Null-terminated ASCII string\r
+                                array indicating the language.  This is the\r
+                                language of the driver name that the caller is\r
+                                requesting, and it must match one of the\r
+                                languages specified in SupportedLanguages. The\r
+                                number of languages supported by a driver is up\r
+                                to the driver writer. Language is specified in\r
+                                RFC 4646 or ISO 639-2 language code format.\r
+  @param  ControllerName        A pointer to the Unicode string to return.\r
+                                This Unicode string is the name of the\r
+                                controller specified by ControllerHandle and\r
+                                ChildHandle in the language specified by\r
+                                Language from the point of view of the driver\r
+                                specified by This.\r
+\r
+  @retval EFI_SUCCESS           The Unicode string for the user readable name in\r
+                                the language specified by Language for the\r
+                                driver specified by This was returned in\r
+                                DriverName.\r
+  @retval EFI_INVALID_PARAMETER ControllerHandle is not a valid EFI_HANDLE.\r
+  @retval EFI_INVALID_PARAMETER ChildHandle is not NULL and it is not a valid\r
+                                EFI_HANDLE.\r
+  @retval EFI_INVALID_PARAMETER Language is NULL.\r
+  @retval EFI_INVALID_PARAMETER ControllerName is NULL.\r
+  @retval EFI_UNSUPPORTED       The driver specified by This is not currently\r
+                                managing the controller specified by\r
+                                ControllerHandle and ChildHandle.\r
+  @retval EFI_UNSUPPORTED       The driver specified by This does not support\r
+                                the language specified by Language.\r
+\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+BlockMmioToBlockIoGetControllerName (\r
+  IN  EFI_COMPONENT_NAME_PROTOCOL                     *This,\r
+  IN  EFI_HANDLE                                      ControllerHandle,\r
+  IN  EFI_HANDLE                                      ChildHandle        OPTIONAL,\r
+  IN  CHAR8                                           *Language,\r
+  OUT CHAR16                                          **ControllerName\r
+  );\r
+\r
+#endif\r
diff --git a/OvmfPkg/BlockMmioToBlockIoDxe/BlockIo.inf b/OvmfPkg/BlockMmioToBlockIoDxe/BlockIo.inf
new file mode 100644 (file)
index 0000000..c8aea28
--- /dev/null
@@ -0,0 +1,55 @@
+## @file\r
+# The driver wrappers BlockMmio protocol instances to produce\r
+# Block I/O Protocol instances.\r
+#\r
+# Copyright (c) 2006 - 2010, Intel Corporation. \r
+#\r
+#  All rights reserved. This program and the accompanying materials\r
+#  are licensed and made available under the terms and conditions of the BSD License\r
+#  which accompanies this distribution. The full text of the license may be found at\r
+#  http://opensource.org/licenses/bsd-license.php\r
+#\r
+#  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
+#  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+#\r
+#\r
+##\r
+\r
+[Defines]\r
+  INF_VERSION                    = 0x00010005\r
+  BASE_NAME                      = BlockMmioToBlockIoDxe\r
+  FILE_GUID                      = 33cb97af-6c33-4c42-986b-07581fa366d4\r
+  MODULE_TYPE                    = UEFI_DRIVER\r
+  VERSION_STRING                 = 1.0\r
+  ENTRY_POINT                    = BlockMmioToBlockIoEntryPoint\r
+\r
+#\r
+# The following information is for reference only and not required by the build tools.\r
+#\r
+#  VALID_ARCHITECTURES           = IA32 X64 IPF EBC\r
+#\r
+\r
+[Sources]\r
+  BlockIo.c\r
+  ComponentName.c\r
+\r
+[Packages]\r
+  MdePkg/MdePkg.dec\r
+  OvmfPkg/OvmfPkg.dec\r
+\r
+[LibraryClasses]\r
+  BaseLib\r
+  BaseMemoryLib\r
+  DebugLib\r
+  DevicePathLib\r
+  MemoryAllocationLib\r
+  UefiBootServicesTableLib\r
+  UefiDriverEntryPoint\r
+  UefiLib\r
+\r
+[Protocols]\r
+  gBlockMmioProtocolGuid                        ## TO_START\r
+  gEfiCpuIo2ProtocolGuid                        ## TO_START\r
+  gEfiDevicePathProtocolGuid                    ## TO_START\r
+  gEfiBlockIoProtocolGuid                       ## BY_START\r
+\r
diff --git a/OvmfPkg/BlockMmioToBlockIoDxe/ComponentName.c b/OvmfPkg/BlockMmioToBlockIoDxe/ComponentName.c
new file mode 100644 (file)
index 0000000..83eb64e
--- /dev/null
@@ -0,0 +1,162 @@
+/** @file\r
+  UEFI Component Name(2) protocol implementation for Block MMIO to Block IO driver.\r
+\r
+  Copyright (c) 2004 - 2007, Intel Corporation\r
+  All rights reserved. This program and the accompanying materials\r
+  are licensed and made available under the terms and conditions of the BSD License\r
+  which accompanies this distribution.  The full text of the license may be found at\r
+  http://opensource.org/licenses/bsd-license.php\r
+\r
+  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
+  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+\r
+**/\r
+\r
+#include "BlockIo.h"\r
+\r
+//\r
+// EFI Component Name Protocol\r
+//\r
+GLOBAL_REMOVE_IF_UNREFERENCED EFI_COMPONENT_NAME_PROTOCOL  gBlockMmioToBlockIoComponentName = {\r
+  BlockMmioToBlockIoGetDriverName,\r
+  BlockMmioToBlockIoGetControllerName,\r
+  "eng"\r
+};\r
+\r
+//\r
+// EFI Component Name 2 Protocol\r
+//\r
+GLOBAL_REMOVE_IF_UNREFERENCED EFI_COMPONENT_NAME2_PROTOCOL gBlockMmioToBlockIoComponentName2 = {\r
+  (EFI_COMPONENT_NAME2_GET_DRIVER_NAME) BlockMmioToBlockIoGetDriverName,\r
+  (EFI_COMPONENT_NAME2_GET_CONTROLLER_NAME) BlockMmioToBlockIoGetControllerName,\r
+  "en"\r
+};\r
+\r
+\r
+GLOBAL_REMOVE_IF_UNREFERENCED EFI_UNICODE_STRING_TABLE\r
+mBlockMmioToBlockIoDriverNameTable[] = {\r
+  {"eng;en", L"Block MMIO to Block IO Driver"},\r
+  {NULL,  NULL}\r
+};\r
+\r
+/**\r
+  Retrieves a Unicode string that is the user readable name of the driver.\r
+\r
+  This function retrieves the user readable name of a driver in the form of a\r
+  Unicode string. If the driver specified by This has a user readable name in\r
+  the language specified by Language, then a pointer to the driver name is\r
+  returned in DriverName, and EFI_SUCCESS is returned. If the driver specified\r
+  by This does not support the language specified by Language,\r
+  then EFI_UNSUPPORTED is returned.\r
+\r
+  @param  This                  A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or\r
+                                EFI_COMPONENT_NAME_PROTOCOL instance.\r
+  @param  Language              A pointer to a Null-terminated ASCII string\r
+                                array indicating the language. This is the\r
+                                language of the driver name that the caller is\r
+                                requesting, and it must match one of the\r
+                                languages specified in SupportedLanguages. The\r
+                                number of languages supported by a driver is up\r
+                                to the driver writer. Language is specified\r
+                                in RFC 4646 or ISO 639-2 language code format.\r
+  @param  DriverName            A pointer to the Unicode string to return.\r
+                                This Unicode string is the name of the\r
+                                driver specified by This in the language\r
+                                specified by Language.\r
+\r
+  @retval EFI_SUCCESS           The Unicode string for the Driver specified by\r
+                                This and the language specified by Language was\r
+                                returned in DriverName.\r
+  @retval EFI_INVALID_PARAMETER Language is NULL.\r
+  @retval EFI_INVALID_PARAMETER DriverName is NULL.\r
+  @retval EFI_UNSUPPORTED       The driver specified by This does not support\r
+                                the language specified by Language.\r
+\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+BlockMmioToBlockIoGetDriverName (\r
+  IN  EFI_COMPONENT_NAME_PROTOCOL  *This,\r
+  IN  CHAR8                        *Language,\r
+  OUT CHAR16                       **DriverName\r
+  )\r
+{\r
+  return LookupUnicodeString2 (\r
+           Language,\r
+           This->SupportedLanguages,\r
+           mBlockMmioToBlockIoDriverNameTable,\r
+           DriverName,\r
+           (BOOLEAN)(This == &gBlockMmioToBlockIoComponentName)\r
+           );\r
+}\r
+\r
+/**\r
+  Retrieves a Unicode string that is the user readable name of the controller\r
+  that is being managed by a driver.\r
+\r
+  This function retrieves the user readable name of the controller specified by\r
+  ControllerHandle and ChildHandle in the form of a Unicode string. If the\r
+  driver specified by This has a user readable name in the language specified by\r
+  Language, then a pointer to the controller name is returned in ControllerName,\r
+  and EFI_SUCCESS is returned.  If the driver specified by This is not currently\r
+  managing the controller specified by ControllerHandle and ChildHandle,\r
+  then EFI_UNSUPPORTED is returned.  If the driver specified by This does not\r
+  support the language specified by Language, then EFI_UNSUPPORTED is returned.\r
+\r
+  @param  This                  A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or\r
+                                EFI_COMPONENT_NAME_PROTOCOL instance.\r
+  @param  ControllerHandle      The handle of a controller that the driver\r
+                                specified by This is managing.  This handle\r
+                                specifies the controller whose name is to be\r
+                                returned.\r
+  @param  ChildHandle           The handle of the child controller to retrieve\r
+                                the name of.  This is an optional parameter that\r
+                                may be NULL.  It will be NULL for device\r
+                                drivers.  It will also be NULL for a bus drivers\r
+                                that wish to retrieve the name of the bus\r
+                                controller.  It will not be NULL for a bus\r
+                                driver that wishes to retrieve the name of a\r
+                                child controller.\r
+  @param  Language              A pointer to a Null-terminated ASCII string\r
+                                array indicating the language.  This is the\r
+                                language of the driver name that the caller is\r
+                                requesting, and it must match one of the\r
+                                languages specified in SupportedLanguages. The\r
+                                number of languages supported by a driver is up\r
+                                to the driver writer. Language is specified in\r
+                                RFC 4646 or ISO 639-2 language code format.\r
+  @param  ControllerName        A pointer to the Unicode string to return.\r
+                                This Unicode string is the name of the\r
+                                controller specified by ControllerHandle and\r
+                                ChildHandle in the language specified by\r
+                                Language from the point of view of the driver\r
+                                specified by This.\r
+\r
+  @retval EFI_SUCCESS           The Unicode string for the user readable name in\r
+                                the language specified by Language for the\r
+                                driver specified by This was returned in\r
+                                DriverName.\r
+  @retval EFI_INVALID_PARAMETER ControllerHandle is not a valid EFI_HANDLE.\r
+  @retval EFI_INVALID_PARAMETER ChildHandle is not NULL and it is not a valid\r
+                                EFI_HANDLE.\r
+  @retval EFI_INVALID_PARAMETER Language is NULL.\r
+  @retval EFI_INVALID_PARAMETER ControllerName is NULL.\r
+  @retval EFI_UNSUPPORTED       The driver specified by This is not currently\r
+                                managing the controller specified by\r
+                                ControllerHandle and ChildHandle.\r
+  @retval EFI_UNSUPPORTED       The driver specified by This does not support\r
+                                the language specified by Language.\r
+\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+BlockMmioToBlockIoGetControllerName (\r
+  IN  EFI_COMPONENT_NAME_PROTOCOL                     *This,\r
+  IN  EFI_HANDLE                                      ControllerHandle,\r
+  IN  EFI_HANDLE                                      ChildHandle        OPTIONAL,\r
+  IN  CHAR8                                           *Language,\r
+  OUT CHAR16                                          **ControllerName\r
+  )\r
+{\r
+  return EFI_UNSUPPORTED;\r
+}\r
index 47f8518bee98e82bb40547a848f8e0eeb0f60783..ec90c5494d18e1df387049143410d2282380b791 100644 (file)
@@ -164,6 +164,7 @@ INF  PcAtChipsetPkg/KbcResetDxe/Reset.inf
 INF  MdeModulePkg/Universal/Metronome/Metronome.inf\r
 INF  PcAtChipsetPkg/PcatRealTimeClockRuntimeDxe/PcatRealTimeClockRuntimeDxe.inf\r
 \r
+INF  OvmfPkg/BlockMmioToBlockIoDxe/BlockIo.inf\r
 INF  OvmfPkg/EmuVariableFvbRuntimeDxe/Fvb.inf\r
 INF  MdeModulePkg/Universal/FaultTolerantWriteDxe/FaultTolerantWriteDxe.inf\r
 INF  MdeModulePkg/Universal/Variable/RuntimeDxe/VariableRuntimeDxe.inf\r
index 29cd5cadccb49acef0b167273cca86264aec3cbd..edde083950f591496453d14d74c669e16c124de0 100644 (file)
       TimerLib|OvmfPkg/Library/AcpiTimerLib/AcpiTimerLib.inf\r
   }\r
 \r
+  OvmfPkg/BlockMmioToBlockIoDxe/BlockIo.inf\r
   OvmfPkg/EmuVariableFvbRuntimeDxe/Fvb.inf {\r
     <LibraryClasses>\r
       PlatformFvbLib|OvmfPkg/Library/EmuVariableFvbLib/EmuVariableFvbLib.inf\r
index 269fcf6556c49c9c18b68c425a5bf0bec1286898..ee4f58c0e17f106410b9595960e5253dce2b8638 100644 (file)
 [PcdsFeatureFlag]\r
   gEfiMdeModulePkgTokenSpaceGuid.PcdStatusCodeUseSerial|FALSE\r
   gEfiMdeModulePkgTokenSpaceGuid.PcdStatusCodeUseMemory|TRUE\r
-\r
   gEfiMdeModulePkgTokenSpaceGuid.PcdDxeIplSupportUefiDecompress|FALSE\r
   gEfiMdeModulePkgTokenSpaceGuid.PcdDxeIplSwitchToLongMode|TRUE\r
 \r
       TimerLib|OvmfPkg/Library/AcpiTimerLib/AcpiTimerLib.inf\r
   }\r
 \r
+  OvmfPkg/BlockMmioToBlockIoDxe/BlockIo.inf\r
   OvmfPkg/EmuVariableFvbRuntimeDxe/Fvb.inf {\r
     <LibraryClasses>\r
       PlatformFvbLib|OvmfPkg/Library/EmuVariableFvbLib/EmuVariableFvbLib.inf\r
index b6866e137b4974744b4082be1e16f3133f200874..13a39d88551add8d29323ef32d0aa7dc78a95676 100644 (file)
@@ -166,6 +166,7 @@ INF  PcAtChipsetPkg/KbcResetDxe/Reset.inf
 INF  MdeModulePkg/Universal/Metronome/Metronome.inf\r
 INF  PcAtChipsetPkg/PcatRealTimeClockRuntimeDxe/PcatRealTimeClockRuntimeDxe.inf\r
 \r
+INF  OvmfPkg/BlockMmioToBlockIoDxe/BlockIo.inf\r
 INF  OvmfPkg/EmuVariableFvbRuntimeDxe/Fvb.inf\r
 INF  MdeModulePkg/Universal/FaultTolerantWriteDxe/FaultTolerantWriteDxe.inf\r
 INF  MdeModulePkg/Universal/Variable/RuntimeDxe/VariableRuntimeDxe.inf\r
index 1b6d8e8ee48d8951933c5adfd6b4c611c674a66b..a9ef611338e7546a0c076af8b538fbb037dac2af 100644 (file)
 [PcdsFeatureFlag]\r
   gEfiMdeModulePkgTokenSpaceGuid.PcdStatusCodeUseSerial|FALSE\r
   gEfiMdeModulePkgTokenSpaceGuid.PcdStatusCodeUseMemory|TRUE\r
-\r
   gEfiMdeModulePkgTokenSpaceGuid.PcdDxeIplSupportUefiDecompress|FALSE\r
   gEfiMdeModulePkgTokenSpaceGuid.PcdDxeIplSwitchToLongMode|FALSE\r
 \r
       TimerLib|OvmfPkg/Library/AcpiTimerLib/AcpiTimerLib.inf\r
   }\r
 \r
+  OvmfPkg/BlockMmioToBlockIoDxe/BlockIo.inf\r
   OvmfPkg/EmuVariableFvbRuntimeDxe/Fvb.inf {\r
     <LibraryClasses>\r
       PlatformFvbLib|OvmfPkg/Library/EmuVariableFvbLib/EmuVariableFvbLib.inf\r