summaryrefslogtreecommitdiff
path: root/OvmfPkg/XenBusDxe/XenBusDxe.c
diff options
context:
space:
mode:
authorArd Biesheuvel <ard.biesheuvel@linaro.org>2015-02-28 20:33:11 +0000
committerlersek <lersek@Edk2>2015-02-28 20:33:11 +0000
commitd9fdfd851afc3e98d8c967fd2c0a40a43bac3f0c (patch)
tree915ad3f5d6554bc019856fb696c1b812a01ac466 /OvmfPkg/XenBusDxe/XenBusDxe.c
parentf2162d34106632b520e7d4a209f7385938c4c733 (diff)
downloadedk2-platforms-d9fdfd851afc3e98d8c967fd2c0a40a43bac3f0c.tar.xz
Ovmf/Xen: move XenBusDxe to abstract XENIO_PROTOCOL
While Xen on Intel uses a virtual PCI device to communicate the base address of the grant table, the ARM implementation uses a DT node, which is fundamentally incompatible with the way XenBusDxe is implemented, i.e., as a UEFI Driver Model implementation for a PCI device. Contributed-under: TianoCore Contribution Agreement 1.0 Acked-by: Laszlo Ersek <lersek@redhat.com> Reviewed-by: Anthony PERARD <anthony.perard@citrix.com> Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org> Signed-off-by: Laszlo Ersek <lersek@redhat.com> git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@16973 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'OvmfPkg/XenBusDxe/XenBusDxe.c')
-rw-r--r--OvmfPkg/XenBusDxe/XenBusDxe.c55
1 files changed, 13 insertions, 42 deletions
diff --git a/OvmfPkg/XenBusDxe/XenBusDxe.c b/OvmfPkg/XenBusDxe/XenBusDxe.c
index cc334c086c..2c4a08673c 100644
--- a/OvmfPkg/XenBusDxe/XenBusDxe.c
+++ b/OvmfPkg/XenBusDxe/XenBusDxe.c
@@ -23,8 +23,6 @@
**/
-#include <IndustryStandard/Pci.h>
-#include <IndustryStandard/Acpi.h>
#include <Library/DebugLib.h>
#include <Library/XenHypercallLib.h>
@@ -233,34 +231,22 @@ XenBusDxeDriverBindingSupported (
)
{
EFI_STATUS Status;
- EFI_PCI_IO_PROTOCOL *PciIo;
- PCI_TYPE00 Pci;
+ XENIO_PROTOCOL *XenIo;
Status = gBS->OpenProtocol (
ControllerHandle,
- &gEfiPciIoProtocolGuid,
- (VOID **)&PciIo,
+ &gXenIoProtocolGuid,
+ (VOID **)&XenIo,
This->DriverBindingHandle,
ControllerHandle,
EFI_OPEN_PROTOCOL_BY_DRIVER
);
+
if (EFI_ERROR (Status)) {
return Status;
}
- Status = PciIo->Pci.Read (PciIo, EfiPciIoWidthUint32, 0,
- sizeof Pci / sizeof (UINT32), &Pci);
-
- if (Status == EFI_SUCCESS) {
- if (Pci.Hdr.VendorId == PCI_VENDOR_ID_XEN &&
- Pci.Hdr.DeviceId == PCI_DEVICE_ID_XEN_PLATFORM) {
- Status = EFI_SUCCESS;
- } else {
- Status = EFI_UNSUPPORTED;
- }
- }
-
- gBS->CloseProtocol (ControllerHandle, &gEfiPciIoProtocolGuid,
+ gBS->CloseProtocol (ControllerHandle, &gXenIoProtocolGuid,
This->DriverBindingHandle, ControllerHandle);
return Status;
@@ -326,19 +312,18 @@ XenBusDxeDriverBindingStart (
{
EFI_STATUS Status;
XENBUS_DEVICE *Dev;
- EFI_PCI_IO_PROTOCOL *PciIo;
- EFI_ACPI_ADDRESS_SPACE_DESCRIPTOR *BarDesc;
- UINT64 MmioAddr;
+ XENIO_PROTOCOL *XenIo;
EFI_DEVICE_PATH_PROTOCOL *DevicePath;
Status = gBS->OpenProtocol (
ControllerHandle,
- &gEfiPciIoProtocolGuid,
- (VOID **) &PciIo,
+ &gXenIoProtocolGuid,
+ (VOID**)&XenIo,
This->DriverBindingHandle,
ControllerHandle,
EFI_OPEN_PROTOCOL_BY_DRIVER
);
+
if (EFI_ERROR (Status)) {
return Status;
}
@@ -360,7 +345,7 @@ XenBusDxeDriverBindingStart (
Dev->Signature = XENBUS_DEVICE_SIGNATURE;
Dev->This = This;
Dev->ControllerHandle = ControllerHandle;
- Dev->PciIo = PciIo;
+ Dev->XenIo = XenIo;
Dev->DevicePath = DevicePath;
InitializeListHead (&Dev->ChildList);
@@ -376,20 +361,6 @@ XenBusDxeDriverBindingStart (
mMyDevice = Dev;
EfiReleaseLock (&mMyDeviceLock);
- //
- // The BAR1 of this PCI device is used for shared memory and is supposed to
- // look like MMIO. The address space of the BAR1 will be used to map the
- // Grant Table.
- //
- Status = PciIo->GetBarAttributes (PciIo, PCI_BAR_IDX1, NULL, (VOID**) &BarDesc);
- ASSERT_EFI_ERROR (Status);
- ASSERT (BarDesc->ResType == ACPI_ADDRESS_SPACE_TYPE_MEM);
-
- /* Get a Memory address for mapping the Grant Table. */
- DEBUG ((EFI_D_INFO, "XenBus: BAR at %LX\n", BarDesc->AddrRangeMin));
- MmioAddr = BarDesc->AddrRangeMin;
- FreePool (BarDesc);
-
Status = XenGetSharedInfoPage (Dev);
if (EFI_ERROR (Status)) {
DEBUG ((EFI_D_ERROR, "XenBus: Unable to get the shared info page.\n"));
@@ -397,7 +368,7 @@ XenBusDxeDriverBindingStart (
goto ErrorAllocated;
}
- XenGrantTableInit (Dev, MmioAddr);
+ XenGrantTableInit (Dev);
Status = XenStoreInit (Dev);
ASSERT_EFI_ERROR (Status);
@@ -417,7 +388,7 @@ ErrorAllocated:
gBS->CloseProtocol (ControllerHandle, &gEfiDevicePathProtocolGuid,
This->DriverBindingHandle, ControllerHandle);
ErrorOpenningProtocol:
- gBS->CloseProtocol (ControllerHandle, &gEfiPciIoProtocolGuid,
+ gBS->CloseProtocol (ControllerHandle, &gXenIoProtocolGuid,
This->DriverBindingHandle, ControllerHandle);
return Status;
}
@@ -507,7 +478,7 @@ XenBusDxeDriverBindingStop (
gBS->CloseProtocol (ControllerHandle, &gEfiDevicePathProtocolGuid,
This->DriverBindingHandle, ControllerHandle);
- gBS->CloseProtocol (ControllerHandle, &gEfiPciIoProtocolGuid,
+ gBS->CloseProtocol (ControllerHandle, &gXenIoProtocolGuid,
This->DriverBindingHandle, ControllerHandle);
mMyDevice = NULL;