TianoCore EDK2 master
Loading...
Searching...
No Matches
MmcBlockIo.c File Reference
#include <Library/BaseMemoryLib.h>
#include "Mmc.h"

Go to the source code of this file.

Macros

#define MMCI0_BLOCKLEN   512
 
#define MMCI0_TIMEOUT   10000
 

Functions

EFI_STATUS MmcNotifyState (IN MMC_HOST_INSTANCE *MmcHostInstance, IN MMC_STATE State)
 
EFI_STATUS EFIAPI MmcGetCardStatus (IN MMC_HOST_INSTANCE *MmcHostInstance)
 
EFI_STATUS EFIAPI MmcReset (IN EFI_BLOCK_IO_PROTOCOL *This, IN BOOLEAN ExtendedVerification)
 
EFI_STATUS MmcDetectCard (EFI_MMC_HOST_PROTOCOL *MmcHost)
 
EFI_STATUS MmcStopTransmission (EFI_MMC_HOST_PROTOCOL *MmcHost)
 
STATIC EFI_STATUS MmcTransferBlock (IN EFI_BLOCK_IO_PROTOCOL *This, IN UINTN Cmd, IN UINTN Transfer, IN UINT32 MediaId, IN EFI_LBA Lba, IN UINTN BufferSize, OUT VOID *Buffer)
 
EFI_STATUS MmcIoBlocks (IN EFI_BLOCK_IO_PROTOCOL *This, IN UINTN Transfer, IN UINT32 MediaId, IN EFI_LBA Lba, IN UINTN BufferSize, OUT VOID *Buffer)
 
EFI_STATUS EFIAPI MmcReadBlocks (IN EFI_BLOCK_IO_PROTOCOL *This, IN UINT32 MediaId, IN EFI_LBA Lba, IN UINTN BufferSize, OUT VOID *Buffer)
 
EFI_STATUS EFIAPI MmcWriteBlocks (IN EFI_BLOCK_IO_PROTOCOL *This, IN UINT32 MediaId, IN EFI_LBA Lba, IN UINTN BufferSize, IN VOID *Buffer)
 
EFI_STATUS EFIAPI MmcFlushBlocks (IN EFI_BLOCK_IO_PROTOCOL *This)
 

Detailed Description

Copyright (c) 2011-2020, ARM Limited. All rights reserved.

SPDX-License-Identifier: BSD-2-Clause-Patent

Definition in file MmcBlockIo.c.

Macro Definition Documentation

◆ MMCI0_BLOCKLEN

#define MMCI0_BLOCKLEN   512

Definition at line 123 of file MmcBlockIo.c.

◆ MMCI0_TIMEOUT

#define MMCI0_TIMEOUT   10000

Definition at line 124 of file MmcBlockIo.c.

Function Documentation

◆ MmcDetectCard()

EFI_STATUS MmcDetectCard ( EFI_MMC_HOST_PROTOCOL MmcHost)

Definition at line 94 of file MmcBlockIo.c.

◆ MmcFlushBlocks()

EFI_STATUS EFIAPI MmcFlushBlocks ( IN EFI_BLOCK_IO_PROTOCOL This)

Flushes all modified data to a physical block device.

Parameters
ThisIndicates a pointer to the calling context.
Return values
EFI_SUCCESSAll outstanding data were written correctly to the device.
EFI_DEVICE_ERRORThe device reported an error while attempting to write data.
EFI_NO_MEDIAThere is no media in the device.

Definition at line 400 of file MmcBlockIo.c.

◆ MmcGetCardStatus()

EFI_STATUS EFIAPI MmcGetCardStatus ( IN MMC_HOST_INSTANCE MmcHostInstance)

Definition at line 25 of file MmcBlockIo.c.

◆ MmcIoBlocks()

EFI_STATUS MmcIoBlocks ( IN EFI_BLOCK_IO_PROTOCOL This,
IN UINTN  Transfer,
IN UINT32  MediaId,
IN EFI_LBA  Lba,
IN UINTN  BufferSize,
OUT VOID *  Buffer 
)

Definition at line 234 of file MmcBlockIo.c.

◆ MmcNotifyState()

EFI_STATUS MmcNotifyState ( IN MMC_HOST_INSTANCE MmcHostInstance,
IN MMC_STATE  State 
)

Definition at line 14 of file MmcBlockIo.c.

◆ MmcReadBlocks()

EFI_STATUS EFIAPI MmcReadBlocks ( IN EFI_BLOCK_IO_PROTOCOL This,
IN UINT32  MediaId,
IN EFI_LBA  Lba,
IN UINTN  BufferSize,
OUT VOID *  Buffer 
)

Reads the requested number of blocks from the device.

This function implements EFI_BLOCK_IO_PROTOCOL.ReadBlocks(). It reads the requested number of blocks from the device. All the blocks are read, or an error is returned.

Parameters
ThisIndicates a pointer to the calling context.
MediaIdThe media ID that the read request is for.
LbaThe starting logical block address to read from on the device.
BufferSizeThe size of the Buffer in bytes. This must be a multiple of the intrinsic block size of the device.
BufferA pointer to the destination buffer for the data. The caller is responsible for either having implicit or explicit ownership of the buffer.
Return values
EFI_SUCCESSThe data was read correctly from the device.
EFI_DEVICE_ERRORThe device reported an error while attempting to perform the read operation.
EFI_NO_MEDIAThere is no media in the device.
EFI_MEDIA_CHANGEDThe MediaId is not for the current media.
EFI_BAD_BUFFER_SIZEThe BufferSize parameter is not a multiple of the intrinsic block size of the device.
EFI_INVALID_PARAMETERThe read request contains LBAs that are not valid, or the buffer is not on proper alignment.

Definition at line 374 of file MmcBlockIo.c.

◆ MmcReset()

EFI_STATUS EFIAPI MmcReset ( IN EFI_BLOCK_IO_PROTOCOL This,
IN BOOLEAN  ExtendedVerification 
)

Reset the block device.

This function implements EFI_BLOCK_IO_PROTOCOL.Reset(). It resets the block device hardware. ExtendedVerification is ignored in this implementation.

Parameters
ThisIndicates a pointer to the calling context.
ExtendedVerificationIndicates that the driver may perform a more exhaustive verification operation of the device during reset.
Return values
EFI_SUCCESSThe block device was reset.
EFI_DEVICE_ERRORThe block device is not functioning correctly and could not be reset.

Definition at line 61 of file MmcBlockIo.c.

◆ MmcStopTransmission()

EFI_STATUS MmcStopTransmission ( EFI_MMC_HOST_PROTOCOL MmcHost)

Definition at line 106 of file MmcBlockIo.c.

◆ MmcTransferBlock()

STATIC EFI_STATUS MmcTransferBlock ( IN EFI_BLOCK_IO_PROTOCOL This,
IN UINTN  Cmd,
IN UINTN  Transfer,
IN UINT32  MediaId,
IN EFI_LBA  Lba,
IN UINTN  BufferSize,
OUT VOID *  Buffer 
)

Definition at line 128 of file MmcBlockIo.c.

◆ MmcWriteBlocks()

EFI_STATUS EFIAPI MmcWriteBlocks ( IN EFI_BLOCK_IO_PROTOCOL This,
IN UINT32  MediaId,
IN EFI_LBA  Lba,
IN UINTN  BufferSize,
IN VOID *  Buffer 
)

Writes a specified number of blocks to the device.

This function implements EFI_BLOCK_IO_PROTOCOL.WriteBlocks(). It writes a specified number of blocks to the device. All blocks are written, or an error is returned.

Parameters
ThisIndicates a pointer to the calling context.
MediaIdThe media ID that the write request is for.
LbaThe starting logical block address to be written.
BufferSizeThe size of the Buffer in bytes. This must be a multiple of the intrinsic block size of the device.
BufferPointer to the source buffer for the data.
Return values
EFI_SUCCESSThe data were written correctly to the device.
EFI_WRITE_PROTECTEDThe device cannot be written to.
EFI_NO_MEDIAThere is no media in the device.
EFI_MEDIA_CHANGEDThe MediaId is not for the current media.
EFI_DEVICE_ERRORThe device reported an error while attempting to perform the write operation.
EFI_BAD_BUFFER_SIZEThe BufferSize parameter is not a multiple of the intrinsic block size of the device.
EFI_INVALID_PARAMETERThe write request contains LBAs that are not valid, or the buffer is not on proper alignment.

Definition at line 387 of file MmcBlockIo.c.