X-Git-Url: https://git.proxmox.com/?p=mirror_edk2.git;a=blobdiff_plain;f=EdkModulePkg%2FBus%2FUsb%2FUsbMassStorage%2FDxe%2FUsbMassStorage.c;h=daaf3f8fe41d72d2449e608cd43b53d685e84d2c;hp=7f6cd4daf26796f7320d227acdde074f10b9e6ef;hb=93b0fbc8a1731a3c4ae789bebac4b1d8966719c3;hpb=4d1fe68e1ca84cf0d3eec69d20625fa57769de12 diff --git a/EdkModulePkg/Bus/Usb/UsbMassStorage/Dxe/UsbMassStorage.c b/EdkModulePkg/Bus/Usb/UsbMassStorage/Dxe/UsbMassStorage.c index 7f6cd4daf2..daaf3f8fe4 100644 --- a/EdkModulePkg/Bus/Usb/UsbMassStorage/Dxe/UsbMassStorage.c +++ b/EdkModulePkg/Bus/Usb/UsbMassStorage/Dxe/UsbMassStorage.c @@ -1,6 +1,6 @@ /*++ -Copyright (c) 2006, Intel Corporation +Copyright (c) 2006 - 2007, Intel Corporation All rights reserved. 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 @@ -24,44 +24,6 @@ Revision History #include "UsbMassStorage.h" #include "UsbMassStorageHelper.h" -extern EFI_COMPONENT_NAME_PROTOCOL gUsbMassStorageComponentName; - -// -// Prototypes -// Driver model protocol interface -// -EFI_STATUS -EFIAPI -USBMassStorageDriverBindingEntryPoint ( - IN EFI_HANDLE ImageHandle, - IN EFI_SYSTEM_TABLE *SystemTable - ); - -EFI_STATUS -EFIAPI -USBFloppyDriverBindingSupported ( - IN EFI_DRIVER_BINDING_PROTOCOL *This, - IN EFI_HANDLE Controller, - IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath - ); - -EFI_STATUS -EFIAPI -USBFloppyDriverBindingStart ( - IN EFI_DRIVER_BINDING_PROTOCOL *This, - IN EFI_HANDLE Controller, - IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath - ); - -EFI_STATUS -EFIAPI -USBFloppyDriverBindingStop ( - IN EFI_DRIVER_BINDING_PROTOCOL *This, - IN EFI_HANDLE Controller, - IN UINTN NumberOfChildren, - IN EFI_HANDLE *ChildHandleBuffer - ); - // // Block I/O Protocol Interface // @@ -388,6 +350,9 @@ USBFloppyReset ( USB_FLOPPY_DEV *UsbFloppyDevice; EFI_USB_ATAPI_PROTOCOL *UsbAtapiInterface; EFI_STATUS Status; + EFI_TPL OldTpl; + + OldTpl = gBS->RaiseTPL (TPL_CALLBACK); UsbFloppyDevice = USB_FLOPPY_DEV_FROM_THIS (This); @@ -398,6 +363,8 @@ USBFloppyReset ( // Status = UsbAtapiInterface->UsbAtapiReset (UsbAtapiInterface, ExtendedVerification); + gBS->RestoreTPL (OldTpl); + return Status; } @@ -442,6 +409,7 @@ USBFloppyReadBlocks ( UINTN BlockSize; UINTN NumberOfBlocks; BOOLEAN MediaChange; + EFI_TPL OldTpl; Status = EFI_SUCCESS; MediaChange = FALSE; @@ -450,16 +418,16 @@ USBFloppyReadBlocks ( // // Check parameters // - if (!Buffer) { - Status = EFI_INVALID_PARAMETER; - goto Done; + if (Buffer == NULL) { + return EFI_INVALID_PARAMETER; } if (BufferSize == 0) { - Status = EFI_SUCCESS; - goto Done; + return EFI_SUCCESS; } + OldTpl = gBS->RaiseTPL (TPL_CALLBACK); + UsbFloppyTestUnitReady (UsbFloppyDevice); Status = UsbFloppyDetectMedia (UsbFloppyDevice, &MediaChange); @@ -523,6 +491,7 @@ USBFloppyReadBlocks ( if (EFI_ERROR (Status)) { This->Reset (This, TRUE); Status = EFI_DEVICE_ERROR; + goto Done; } if (NumberOfBlocks > BLOCK_UNIT) { @@ -537,6 +506,7 @@ USBFloppyReadBlocks ( } Done: + gBS->RestoreTPL (OldTpl); return Status; } @@ -584,6 +554,7 @@ USBFloppyWriteBlocks ( UINTN BlockSize; UINTN NumberOfBlocks; BOOLEAN MediaChange; + EFI_TPL OldTpl; Status = EFI_SUCCESS; MediaChange = FALSE; @@ -593,16 +564,16 @@ USBFloppyWriteBlocks ( // // Check parameters // - if (!Buffer) { - Status = EFI_INVALID_PARAMETER; - goto Done; + if (Buffer == NULL) { + return EFI_INVALID_PARAMETER; } if (BufferSize == 0) { - Status = EFI_SUCCESS; - goto Done; + return EFI_SUCCESS; } + OldTpl = gBS->RaiseTPL (TPL_CALLBACK); + UsbFloppyTestUnitReady (UsbFloppyDevice); Status = UsbFloppyDetectMedia (UsbFloppyDevice, &MediaChange); @@ -671,6 +642,7 @@ USBFloppyWriteBlocks ( if (EFI_ERROR (Status)) { This->Reset (This, TRUE); Status = EFI_DEVICE_ERROR; + goto Done; } if (NumberOfBlocks > BLOCK_UNIT) { @@ -685,7 +657,7 @@ USBFloppyWriteBlocks ( } Done: - + gBS->RestoreTPL (OldTpl); return Status; }