diff options
Diffstat (limited to 'OvmfPkg/XenBusDxe')
-rw-r--r-- | OvmfPkg/XenBusDxe/ComponentName.c | 2 | ||||
-rw-r--r-- | OvmfPkg/XenBusDxe/GrantTable.c | 5 | ||||
-rw-r--r-- | OvmfPkg/XenBusDxe/GrantTable.h | 3 | ||||
-rw-r--r-- | OvmfPkg/XenBusDxe/XenBus.c | 6 | ||||
-rw-r--r-- | OvmfPkg/XenBusDxe/XenBusDxe.c | 55 | ||||
-rw-r--r-- | OvmfPkg/XenBusDxe/XenBusDxe.h | 8 | ||||
-rw-r--r-- | OvmfPkg/XenBusDxe/XenBusDxe.inf | 2 |
7 files changed, 23 insertions, 58 deletions
diff --git a/OvmfPkg/XenBusDxe/ComponentName.c b/OvmfPkg/XenBusDxe/ComponentName.c index 4530509..3f2dd40 100644 --- a/OvmfPkg/XenBusDxe/ComponentName.c +++ b/OvmfPkg/XenBusDxe/ComponentName.c @@ -155,7 +155,7 @@ XenBusDxeComponentNameGetControllerName ( Status = EfiTestManagedDevice (
ControllerHandle,
gXenBusDxeDriverBinding.DriverBindingHandle,
- &gEfiPciIoProtocolGuid
+ &gXenIoProtocolGuid
);
if (EFI_ERROR (Status)) {
return Status;
diff --git a/OvmfPkg/XenBusDxe/GrantTable.c b/OvmfPkg/XenBusDxe/GrantTable.c index a80d5ef..19117fb 100644 --- a/OvmfPkg/XenBusDxe/GrantTable.c +++ b/OvmfPkg/XenBusDxe/GrantTable.c @@ -139,8 +139,7 @@ XenGrantTableEndAccess ( VOID
XenGrantTableInit (
- IN XENBUS_DEVICE *Dev,
- IN UINT64 MmioAddr
+ IN XENBUS_DEVICE *Dev
)
{
xen_add_to_physmap_t Parameters;
@@ -155,7 +154,7 @@ XenGrantTableInit ( XenGrantTablePutFreeEntry ((grant_ref_t)Index);
}
- GrantTable = (VOID*)(UINTN) MmioAddr;
+ GrantTable = (VOID*)(UINTN) Dev->XenIo->GrantTableAddress;
for (Index = 0; Index < NR_GRANT_FRAMES; Index++) {
Parameters.domid = DOMID_SELF;
Parameters.idx = Index;
diff --git a/OvmfPkg/XenBusDxe/GrantTable.h b/OvmfPkg/XenBusDxe/GrantTable.h index 5772c56..194275b 100644 --- a/OvmfPkg/XenBusDxe/GrantTable.h +++ b/OvmfPkg/XenBusDxe/GrantTable.h @@ -29,8 +29,7 @@ **/
VOID
XenGrantTableInit (
- IN XENBUS_DEVICE *Dev,
- IN UINT64 MmioAddr
+ IN XENBUS_DEVICE *Dev
);
/**
diff --git a/OvmfPkg/XenBusDxe/XenBus.c b/OvmfPkg/XenBusDxe/XenBus.c index f69c27d..ee9526c 100644 --- a/OvmfPkg/XenBusDxe/XenBus.c +++ b/OvmfPkg/XenBusDxe/XenBus.c @@ -138,7 +138,7 @@ XenBusAddDevice ( XENBUS_PRIVATE_DATA *Private;
EFI_STATUS Status;
XENBUS_DEVICE_PATH *TempXenBusPath;
- VOID *ChildPciIo;
+ VOID *ChildXenIo;
AsciiSPrint (DevicePath, sizeof (DevicePath),
"device/%a/%a", Type, Id);
@@ -208,8 +208,8 @@ XenBusAddDevice ( }
Status = gBS->OpenProtocol (Dev->ControllerHandle,
- &gEfiPciIoProtocolGuid,
- &ChildPciIo, Dev->This->DriverBindingHandle,
+ &gXenIoProtocolGuid,
+ &ChildXenIo, Dev->This->DriverBindingHandle,
Private->Handle,
EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER);
if (EFI_ERROR (Status)) {
diff --git a/OvmfPkg/XenBusDxe/XenBusDxe.c b/OvmfPkg/XenBusDxe/XenBusDxe.c index cc334c0..2c4a086 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;
diff --git a/OvmfPkg/XenBusDxe/XenBusDxe.h b/OvmfPkg/XenBusDxe/XenBusDxe.h index 9b72199..6c306e0 100644 --- a/OvmfPkg/XenBusDxe/XenBusDxe.h +++ b/OvmfPkg/XenBusDxe/XenBusDxe.h @@ -39,7 +39,7 @@ //
// Consumed Protocols
//
-#include <Protocol/PciIo.h>
+#include <Protocol/XenIo.h>
//
@@ -73,10 +73,6 @@ extern EFI_COMPONENT_NAME_PROTOCOL gXenBusDxeComponentName; //
#include <IndustryStandard/Xen/xen.h>
-#define PCI_VENDOR_ID_XEN 0x5853
-#define PCI_DEVICE_ID_XEN_PLATFORM 0x0001
-
-
typedef struct _XENBUS_DEVICE_PATH XENBUS_DEVICE_PATH;
typedef struct _XENBUS_DEVICE XENBUS_DEVICE;
@@ -86,7 +82,7 @@ struct _XENBUS_DEVICE { UINT32 Signature;
EFI_DRIVER_BINDING_PROTOCOL *This;
EFI_HANDLE ControllerHandle;
- EFI_PCI_IO_PROTOCOL *PciIo;
+ XENIO_PROTOCOL *XenIo;
EFI_EVENT ExitBootEvent;
EFI_DEVICE_PATH_PROTOCOL *DevicePath;
LIST_ENTRY ChildList;
diff --git a/OvmfPkg/XenBusDxe/XenBusDxe.inf b/OvmfPkg/XenBusDxe/XenBusDxe.inf index 714607d..31553ac 100644 --- a/OvmfPkg/XenBusDxe/XenBusDxe.inf +++ b/OvmfPkg/XenBusDxe/XenBusDxe.inf @@ -67,8 +67,8 @@ [Protocols]
gEfiDriverBindingProtocolGuid
- gEfiPciIoProtocolGuid
gEfiComponentName2ProtocolGuid
gEfiComponentNameProtocolGuid
gXenBusProtocolGuid
+ gXenIoProtocolGuid
|