From a218a65e6a12ba2fe49c68770c9797bc61bffcfc Mon Sep 17 00:00:00 2001 From: leonidk Date: Wed, 5 Apr 2006 07:34:54 +0000 Subject: [PATCH] [MTHCA] fixed erroneous rewriting of the PCI bus interface git-svn-id: svn://openib.tc.cornell.edu/gen1@285 ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86 --- trunk/hw/mthca/kernel/hca_driver.c | 80 +++++++----------------------- 1 file changed, 17 insertions(+), 63 deletions(-) diff --git a/trunk/hw/mthca/kernel/hca_driver.c b/trunk/hw/mthca/kernel/hca_driver.c index 762fce49..3373c15d 100644 --- a/trunk/hw/mthca/kernel/hca_driver.c +++ b/trunk/hw/mthca/kernel/hca_driver.c @@ -109,11 +109,6 @@ fw_access_pciconf ( IN ULONG offset, IN ULONG POINTER_ALIGNMENT length ); -static NTSTATUS -fw_get_pci_bus_interface( - IN DEVICE_OBJECT *p_dev_obj, - OUT BUS_INTERFACE_STANDARD *p_BusInterface ); - static NTSTATUS fw_flash_write_data ( IN BUS_INTERFACE_STANDARD *p_BusInterface, @@ -388,55 +383,6 @@ fw_access_pciconf ( return status; } -static NTSTATUS -fw_get_pci_bus_interface( - IN DEVICE_OBJECT *p_dev_obj, - OUT BUS_INTERFACE_STANDARD *p_BusInterface ) -{ - KEVENT event; - NTSTATUS status; - PIRP p_irp; - IO_STATUS_BLOCK ioStatus; - PIO_STACK_LOCATION p_irpStack; - PDEVICE_OBJECT p_target_obj; - - KeInitializeEvent( &event, NotificationEvent, FALSE ); - - p_target_obj = IoGetAttachedDeviceReference( p_dev_obj ); - - p_irp = IoBuildSynchronousFsdRequest( IRP_MJ_PNP, - p_target_obj, - NULL, - 0, - NULL, - &event, - &ioStatus ); - if (p_irp == NULL) { - status = STATUS_INSUFFICIENT_RESOURCES; - goto End; - } - p_irpStack = IoGetNextIrpStackLocation( p_irp ); - p_irpStack->MinorFunction = IRP_MN_QUERY_INTERFACE; - p_irpStack->Parameters.QueryInterface.InterfaceType = (LPGUID) &GUID_BUS_INTERFACE_STANDARD; - p_irpStack->Parameters.QueryInterface.Size = sizeof(BUS_INTERFACE_STANDARD); - p_irpStack->Parameters.QueryInterface.Version = 1; - p_irpStack->Parameters.QueryInterface.Interface = (PINTERFACE) p_BusInterface; - p_irpStack->Parameters.QueryInterface.InterfaceSpecificData = NULL; - - p_irp->IoStatus.Status = STATUS_NOT_SUPPORTED; - - status = IoCallDriver( p_target_obj, p_irp ); - - if ( status == STATUS_PENDING ) - { - KeWaitForSingleObject( &event, Executive, KernelMode, FALSE, NULL ); - status = ioStatus.Status; - } -End: - // Done with reference - ObDereferenceObject( p_target_obj ); - return status; -} static NTSTATUS __map_crspace( @@ -542,6 +488,20 @@ __unmap_crspace( HCA_EXIT( HCA_DBG_PNP ); } + +static void +__open_fw_access( + IN struct ib_ucontext* p_context, + IN PBUS_INTERFACE_STANDARD p_bus_interface ) +{ + if( !p_context->fw_if_open ) + { + p_bus_interface->InterfaceReference( p_bus_interface->Context ); + p_context->fw_if_open = TRUE; + } +} + + static void __close_fw_access( IN struct ib_ucontext * p_context, @@ -554,6 +514,7 @@ __close_fw_access( } } + void unmap_crspace_for_all( struct ib_ucontext *p_context ) { @@ -580,7 +541,7 @@ fw_access_ctrl( IN OUT ci_umv_buf_t *p_umv_buf ) { DEVICE_OBJECT *p_dev_obj; - PBUS_INTERFACE_STANDARD p_bus_interface; + PBUS_INTERFACE_STANDARD p_bus_interface; NTSTATUS status = STATUS_SUCCESS; PVOID p_data; ULONG offset; @@ -621,14 +582,7 @@ fw_access_ctrl( break; case FW_OPEN_IF: // open BusInterface - if ( !p_context->fw_if_open ) { - status = fw_get_pci_bus_interface(p_dev_obj, p_bus_interface); - if ( NT_SUCCESS( status ) ) { - p_context->fw_if_open = TRUE; - // status can be positive, but != STATUS_SUCCESS - status = STATUS_SUCCESS; - } - } + __open_fw_access( p_context, p_bus_interface ); break; case FW_READ: // read data from flash -- 2.41.0