X-Git-Url: https://git.proxmox.com/?p=mirror_edk2.git;a=blobdiff_plain;f=EdkModulePkg%2FBus%2FScsi%2FScsiDisk%2FDxe%2FScsiDisk.c;h=9eac2c474deb944ec5f0727e0c36b98004ad5d79;hp=a3f4d6a3b6a42d2a41488eba55a58b9a12c945e0;hb=c094abe5852057ef47941d8de3af20b2286cd822;hpb=90a98f29c5db0a9e008c6779866ba6f1ada45cae;ds=sidebyside diff --git a/EdkModulePkg/Bus/Scsi/ScsiDisk/Dxe/ScsiDisk.c b/EdkModulePkg/Bus/Scsi/ScsiDisk/Dxe/ScsiDisk.c index a3f4d6a3b6..9eac2c474d 100644 --- a/EdkModulePkg/Bus/Scsi/ScsiDisk/Dxe/ScsiDisk.c +++ b/EdkModulePkg/Bus/Scsi/ScsiDisk/Dxe/ScsiDisk.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 @@ -332,17 +332,22 @@ Returns: { SCSI_DISK_DEV *ScsiDiskDevice; EFI_STATUS Status; + EFI_TPL OldTpl; + + OldTpl = gBS->RaiseTPL (EFI_TPL_CALLBACK); ScsiDiskDevice = SCSI_DISK_DEV_FROM_THIS (This); Status = ScsiDiskDevice->ScsiIo->ResetDevice (ScsiDiskDevice->ScsiIo); if (!ExtendedVerification) { - return Status; + goto Done; } Status = ScsiDiskDevice->ScsiIo->ResetBus (ScsiDiskDevice->ScsiIo); +Done: + gBS->RestoreTPL (OldTpl); return Status; } @@ -389,6 +394,7 @@ Returns: UINTN BlockSize; UINTN NumberOfBlocks; BOOLEAN MediaChange; + EFI_TPL OldTpl; MediaChange = FALSE; if (!Buffer) { @@ -399,13 +405,16 @@ Returns: return EFI_SUCCESS; } + OldTpl = gBS->RaiseTPL (EFI_TPL_CALLBACK); + ScsiDiskDevice = SCSI_DISK_DEV_FROM_THIS (This); if (!IsDeviceFixed (ScsiDiskDevice)) { Status = ScsiDiskDetectMedia (ScsiDiskDevice, FALSE, &MediaChange); if (EFI_ERROR (Status)) { - return EFI_DEVICE_ERROR; + Status = EFI_DEVICE_ERROR; + goto Done; } if (MediaChange) { @@ -426,27 +435,33 @@ Returns: NumberOfBlocks = BufferSize / BlockSize; if (!(Media->MediaPresent)) { - return EFI_NO_MEDIA; + Status = EFI_NO_MEDIA; + goto Done; } if (MediaId != Media->MediaId) { - return EFI_MEDIA_CHANGED; + Status = EFI_MEDIA_CHANGED; + goto Done; } if (BufferSize % BlockSize != 0) { - return EFI_BAD_BUFFER_SIZE; + Status = EFI_BAD_BUFFER_SIZE; + goto Done; } if (LBA > Media->LastBlock) { - return EFI_INVALID_PARAMETER; + Status = EFI_INVALID_PARAMETER; + goto Done; } if ((LBA + NumberOfBlocks - 1) > Media->LastBlock) { - return EFI_INVALID_PARAMETER; + Status = EFI_INVALID_PARAMETER; + goto Done; } if ((Media->IoAlign > 1) && (((UINTN) Buffer & (Media->IoAlign - 1)) != 0)) { - return EFI_INVALID_PARAMETER; + Status = EFI_INVALID_PARAMETER; + goto Done; } // @@ -455,6 +470,8 @@ Returns: // Status = ScsiDiskReadSectors (ScsiDiskDevice, Buffer, LBA, NumberOfBlocks); +Done: + gBS->RestoreTPL (OldTpl); return Status; } @@ -501,6 +518,7 @@ Returns: UINTN BlockSize; UINTN NumberOfBlocks; BOOLEAN MediaChange; + EFI_TPL OldTpl; MediaChange = FALSE; if (!Buffer) { @@ -511,13 +529,16 @@ Returns: return EFI_SUCCESS; } + OldTpl = gBS->RaiseTPL (EFI_TPL_CALLBACK); + ScsiDiskDevice = SCSI_DISK_DEV_FROM_THIS (This); if (!IsDeviceFixed (ScsiDiskDevice)) { Status = ScsiDiskDetectMedia (ScsiDiskDevice, FALSE, &MediaChange); if (EFI_ERROR (Status)) { - return EFI_DEVICE_ERROR; + Status = EFI_DEVICE_ERROR; + goto Done; } if (MediaChange) { @@ -538,27 +559,33 @@ Returns: NumberOfBlocks = BufferSize / BlockSize; if (!(Media->MediaPresent)) { - return EFI_NO_MEDIA; + Status = EFI_NO_MEDIA; + goto Done; } if (MediaId != Media->MediaId) { - return EFI_MEDIA_CHANGED; + Status = EFI_MEDIA_CHANGED; + goto Done; } if (BufferSize % BlockSize != 0) { - return EFI_BAD_BUFFER_SIZE; + Status = EFI_BAD_BUFFER_SIZE; + goto Done; } if (LBA > Media->LastBlock) { - return EFI_INVALID_PARAMETER; + Status = EFI_INVALID_PARAMETER; + goto Done; } if ((LBA + NumberOfBlocks - 1) > Media->LastBlock) { - return EFI_INVALID_PARAMETER; + Status = EFI_INVALID_PARAMETER; + goto Done; } if ((Media->IoAlign > 1) && (((UINTN) Buffer & (Media->IoAlign - 1)) != 0)) { - return EFI_INVALID_PARAMETER; + Status = EFI_INVALID_PARAMETER; + goto Done; } // // if all the parameters are valid, then perform read sectors command @@ -566,6 +593,9 @@ Returns: // Status = ScsiDiskWriteSectors (ScsiDiskDevice, Buffer, LBA, NumberOfBlocks); +Done: + gBS->RestoreTPL (OldTpl); + return Status; }