+++ /dev/null
-/*++\r
-\r
-Copyright (c) 2004 - 2010, Intel Corporation. All rights reserved.<BR>\r
-This program and the accompanying materials \r
-are licensed and made available under the terms and conditions of the BSD License \r
-which accompanies this distribution. The full text of the license may be found at \r
-http://opensource.org/licenses/bsd-license.php \r
- \r
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, \r
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. \r
-\r
-Module Name:\r
-\r
- BlockIo.h\r
-\r
-Abstract:\r
-\r
- Block IO protocol as defined in the EFI 1.0 specification.\r
-\r
- The Block IO protocol is used to abstract block devices like hard drives,\r
- DVD-ROMs and floppy drives.\r
-\r
- \r
---*/\r
-\r
-#ifndef __BLOCK_IO_H__\r
-#define __BLOCK_IO_H__\r
-\r
-#define EFI_BLOCK_IO_PROTOCOL_GUID \\r
- { \\r
- 0x964e5b21, 0x6459, 0x11d2, {0x8e, 0x39, 0x0, 0xa0, 0xc9, 0x69, 0x72, 0x3b} \\r
- }\r
-\r
-//\r
-// Forward reference for pure ANSI compatability\r
-//\r
-EFI_FORWARD_DECLARATION (EFI_BLOCK_IO_PROTOCOL);\r
-\r
-typedef\r
-EFI_STATUS\r
-(EFIAPI *EFI_BLOCK_RESET) (\r
- IN EFI_BLOCK_IO_PROTOCOL * This,\r
- IN BOOLEAN ExtendedVerification\r
- )\r
-/*++\r
-\r
- Routine Description:\r
- Reset the Block Device.\r
-\r
- Arguments:\r
- This - Protocol instance pointer.\r
- ExtendedVerification - Driver may perform diagnostics on reset.\r
-\r
- Returns:\r
- EFI_SUCCESS - The device was reset.\r
- EFI_DEVICE_ERROR - The device is not functioning properly and could \r
- not be reset.\r
-\r
---*/\r
-;\r
-\r
-typedef\r
-EFI_STATUS\r
-(EFIAPI *EFI_BLOCK_READ) (\r
- IN EFI_BLOCK_IO_PROTOCOL * This,\r
- IN UINT32 MediaId,\r
- IN EFI_LBA Lba,\r
- IN UINTN BufferSize,\r
- OUT VOID *Buffer\r
- )\r
-/*++\r
-\r
- Routine Description:\r
- Read BufferSize bytes from Lba into Buffer.\r
-\r
- Arguments:\r
- This - Protocol instance pointer.\r
- MediaId - Id of the media, changes every time the media is replaced.\r
- Lba - The starting Logical Block Address to read from\r
- BufferSize - Size of Buffer, must be a multiple of device block size.\r
- Buffer - Buffer containing read data\r
-\r
- Returns:\r
- EFI_SUCCESS - The data was read correctly from the device.\r
- EFI_DEVICE_ERROR - The device reported an error while performing the read.\r
- EFI_NO_MEDIA - There is no media in the device.\r
- EFI_MEDIA_CHANGED - The MediaId does not matched the current device.\r
- EFI_BAD_BUFFER_SIZE - The Buffer was not a multiple of the block size of the \r
- device.\r
- EFI_INVALID_PARAMETER - The read request contains device addresses that are not \r
- valid for the device.\r
-\r
---*/\r
-;\r
-\r
-typedef\r
-EFI_STATUS\r
-(EFIAPI *EFI_BLOCK_WRITE) (\r
- IN EFI_BLOCK_IO_PROTOCOL * This,\r
- IN UINT32 MediaId,\r
- IN EFI_LBA Lba,\r
- IN UINTN BufferSize,\r
- IN VOID *Buffer\r
- )\r
-/*++\r
-\r
- Routine Description:\r
- Write BufferSize bytes from Lba into Buffer.\r
-\r
- Arguments:\r
- This - Protocol instance pointer.\r
- MediaId - Id of the media, changes every time the media is replaced.\r
- Lba - The starting Logical Block Address to read from\r
- BufferSize - Size of Buffer, must be a multiple of device block size.\r
- Buffer - Buffer containing read data\r
-\r
- Returns:\r
- EFI_SUCCESS - The data was written correctly to the device.\r
- EFI_WRITE_PROTECTED - The device can not be written to.\r
- EFI_DEVICE_ERROR - The device reported an error while performing the write.\r
- EFI_NO_MEDIA - There is no media in the device.\r
- EFI_MEDIA_CHNAGED - The MediaId does not matched the current device.\r
- EFI_BAD_BUFFER_SIZE - The Buffer was not a multiple of the block size of the \r
- device.\r
- EFI_INVALID_PARAMETER - The write request contains a LBA that is not \r
- valid for the device.\r
-\r
---*/\r
-;\r
-\r
-typedef\r
-EFI_STATUS\r
-(EFIAPI *EFI_BLOCK_FLUSH) (\r
- IN EFI_BLOCK_IO_PROTOCOL * This\r
- )\r
-/*++\r
-\r
- Routine Description:\r
- Flush the Block Device.\r
-\r
- Arguments:\r
- This - Protocol instance pointer.\r
-\r
- Returns:\r
- EFI_SUCCESS - All outstanding data was written to the device\r
- EFI_DEVICE_ERROR - The device reported an error while writting back the data\r
- EFI_NO_MEDIA - There is no media in the device.\r
-\r
---*/\r
-;\r
-\r
-/*++\r
-\r
- Block IO read only mode data and updated only via members of BlockIO\r
-\r
- MediaId - The curent media Id. If the media changes, this value is changed.\r
- RemovableMedia - TRUE if the media is removable; otherwise, FALSE.\r
- MediaPresent - TRUE if there is a media currently present in the device;\r
- othersise, FALSE. THis field shows the media present status\r
- as of the most recent ReadBlocks() or WriteBlocks() call.\r
- LogicalPartition - TRUE if LBA 0 is the first block of a partition; otherwise\r
- FALSE. For media with only one partition this would be TRUE.\r
- ReadOnly - TRUE if the media is marked read-only otherwise, FALSE. This\r
- field shows the read-only status as of the most recent \r
- WriteBlocks () call.\r
- WriteCaching - TRUE if the WriteBlock () function caches write data.\r
- BlockSize - The intrinsic block size of the device. If the media changes, then\r
- this field is updated.\r
- IoAlign - Supplies the alignment requirement for any buffer to read or write\r
- block(s).\r
- LastBlock - The last logical block address on the device. If the media changes,\r
- then this field is updated.\r
-\r
---*/\r
-typedef struct {\r
- UINT32 MediaId;\r
- BOOLEAN RemovableMedia;\r
- BOOLEAN MediaPresent;\r
-\r
- BOOLEAN LogicalPartition;\r
- BOOLEAN ReadOnly;\r
- BOOLEAN WriteCaching;\r
-\r
- UINT32 BlockSize;\r
- UINT32 IoAlign;\r
-\r
- EFI_LBA LastBlock;\r
-\r
- EFI_LBA LowestAlignedLba;\r
- UINT32 LogicalBlocksPerPhysicalBlock;\r
-} EFI_BLOCK_IO_MEDIA;\r
-\r
-#define EFI_BLOCK_IO_PROTOCOL_REVISION 0x00010000\r
-#define EFI_BLOCK_IO_PROTOCOL_REVISION2 0x00020001\r
-\r
-#define SIZE_OF_EFI_BLOCK_IO_MEDIA_REV1 ((UINTN)&((EFI_BLOCK_IO_MEDIA *)0)->LastBlock + sizeof(EFI_LBA))\r
-#define SIZE_OF_EFI_BLOCK_IO_MEDIA_REV2 sizeof(EFI_BLOCK_IO_MEDIA)\r
-\r
-struct _EFI_BLOCK_IO_PROTOCOL {\r
- UINT64 Revision;\r
-\r
- EFI_BLOCK_IO_MEDIA *Media;\r
-\r
- EFI_BLOCK_RESET Reset;\r
- EFI_BLOCK_READ ReadBlocks;\r
- EFI_BLOCK_WRITE WriteBlocks;\r
- EFI_BLOCK_FLUSH FlushBlocks;\r
-\r
-};\r
-\r
-extern EFI_GUID gEfiBlockIoProtocolGuid;\r
-\r
-#endif\r