mirror of
				https://git.proxmox.com/git/mirror_edk2
				synced 2025-10-31 03:31:25 +00:00 
			
		
		
		
	EmbeddedPkg/MmcDxe: Make the driver more compliant with the UEFI specification
Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Olivier Martin <olivier.martin@arm.com> git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@14264 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
		
							parent
							
								
									3d783074e1
								
							
						
					
					
						commit
						5ab765a7ad
					
				| @ -515,6 +515,10 @@ MmcIoBlocks ( | ||||
|   MmcHost = MmcHostInstance->MmcHost; | ||||
|   ASSERT (MmcHost); | ||||
| 
 | ||||
|   if (This->Media->MediaId != MediaId) { | ||||
|     return EFI_MEDIA_CHANGED; | ||||
|   } | ||||
| 
 | ||||
|   if ((MmcHost == 0)|| (Buffer == NULL)) { | ||||
|     return EFI_INVALID_PARAMETER; | ||||
|   } | ||||
| @ -529,17 +533,23 @@ MmcIoBlocks ( | ||||
|     return EFI_INVALID_PARAMETER; | ||||
|   } | ||||
| 
 | ||||
|   // The buffer size must not be zero and it must be an exact multiple of the block size
 | ||||
|   if ((BufferSize == 0) || ((BufferSize % This->Media->BlockSize) != 0)) { | ||||
|   if((Transfer == MMC_IOBLOCKS_WRITE) && (This->Media->ReadOnly == TRUE)) { | ||||
|     return EFI_WRITE_PROTECTED; | ||||
|   } | ||||
| 
 | ||||
|   // Reading 0 Byte is valid
 | ||||
|   if (BufferSize == 0) { | ||||
|     return EFI_SUCCESS; | ||||
|   } | ||||
| 
 | ||||
|   // The buffer size must be an exact multiple of the block size
 | ||||
|   if ((BufferSize % This->Media->BlockSize) != 0) { | ||||
|     return EFI_BAD_BUFFER_SIZE; | ||||
|   } | ||||
| 
 | ||||
|   if (This->Media->MediaId != MediaId) { | ||||
|     return EFI_MEDIA_CHANGED; | ||||
|   } | ||||
| 
 | ||||
|   if((Transfer == MMC_IOBLOCKS_WRITE) && (This->Media->ReadOnly == TRUE)) { | ||||
|     return EFI_WRITE_PROTECTED; | ||||
|   // Check the alignment
 | ||||
|   if ((This->Media->IoAlign > 2) && (((UINTN)Buffer & (This->Media->IoAlign - 1)) != 0)) { | ||||
|     return EFI_INVALID_PARAMETER; | ||||
|   } | ||||
| 
 | ||||
|   BytesRemainingToBeTransfered = BufferSize; | ||||
|  | ||||
		Loading…
	
		Reference in New Issue
	
	Block a user
	 oliviermartin
						oliviermartin