]> git.proxmox.com Git - mirror_edk2.git/blob - MdeModulePkg/Bus/Pci/NvmExpressDxe/NvmExpressBlockIo.h
MdeMdeModulePkg/NvmExpressDxe: Add NVM Express support.
[mirror_edk2.git] / MdeModulePkg / Bus / Pci / NvmExpressDxe / NvmExpressBlockIo.h
1 /** @file
2 Header file for EFI_BLOCK_IO_PROTOCOL interface.
3
4 Copyright (c) 2013, Intel Corporation. All rights reserved.<BR>
5 This program and the accompanying materials
6 are licensed and made available under the terms and conditions of the BSD License
7 which accompanies this distribution. The full text of the license may be found at
8 http://opensource.org/licenses/bsd-license.php
9
10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
12
13 **/
14
15 #ifndef _EFI_NVME_BLOCKIO_H_
16 #define _EFI_NVME_BLOCKIO_H_
17
18 /**
19 Reset the Block Device.
20
21 @param This Indicates a pointer to the calling context.
22 @param ExtendedVerification Driver may perform diagnostics on reset.
23
24 @retval EFI_SUCCESS The device was reset.
25 @retval EFI_DEVICE_ERROR The device is not functioning properly and could
26 not be reset.
27
28 **/
29 EFI_STATUS
30 EFIAPI
31 NvmeBlockIoReset (
32 IN EFI_BLOCK_IO_PROTOCOL *This,
33 IN BOOLEAN ExtendedVerification
34 );
35
36 /**
37 Read BufferSize bytes from Lba into Buffer.
38
39 @param This Indicates a pointer to the calling context.
40 @param MediaId Id of the media, changes every time the media is replaced.
41 @param Lba The starting Logical Block Address to read from
42 @param BufferSize Size of Buffer, must be a multiple of device block size.
43 @param Buffer A pointer to the destination buffer for the data. The caller is
44 responsible for either having implicit or explicit ownership of the buffer.
45
46 @retval EFI_SUCCESS The data was read correctly from the device.
47 @retval EFI_DEVICE_ERROR The device reported an error while performing the read.
48 @retval EFI_NO_MEDIA There is no media in the device.
49 @retval EFI_MEDIA_CHANGED The MediaId does not matched the current device.
50 @retval EFI_BAD_BUFFER_SIZE The Buffer was not a multiple of the block size of the device.
51 @retval EFI_INVALID_PARAMETER The read request contains LBAs that are not valid,
52 or the buffer is not on proper alignment.
53
54 **/
55 EFI_STATUS
56 EFIAPI
57 NvmeBlockIoReadBlocks (
58 IN EFI_BLOCK_IO_PROTOCOL *This,
59 IN UINT32 MediaId,
60 IN EFI_LBA Lba,
61 IN UINTN BufferSize,
62 OUT VOID *Buffer
63 );
64
65 /**
66 Write BufferSize bytes from Lba into Buffer.
67
68 @param This Indicates a pointer to the calling context.
69 @param MediaId The media ID that the write request is for.
70 @param Lba The starting logical block address to be written. The caller is
71 responsible for writing to only legitimate locations.
72 @param BufferSize Size of Buffer, must be a multiple of device block size.
73 @param Buffer A pointer to the source buffer for the data.
74
75 @retval EFI_SUCCESS The data was written correctly to the device.
76 @retval EFI_WRITE_PROTECTED The device can not be written to.
77 @retval EFI_DEVICE_ERROR The device reported an error while performing the write.
78 @retval EFI_NO_MEDIA There is no media in the device.
79 @retval EFI_MEDIA_CHNAGED The MediaId does not matched the current device.
80 @retval EFI_BAD_BUFFER_SIZE The Buffer was not a multiple of the block size of the device.
81 @retval EFI_INVALID_PARAMETER The write request contains LBAs that are not valid,
82 or the buffer is not on proper alignment.
83
84 **/
85 EFI_STATUS
86 EFIAPI
87 NvmeBlockIoWriteBlocks (
88 IN EFI_BLOCK_IO_PROTOCOL *This,
89 IN UINT32 MediaId,
90 IN EFI_LBA Lba,
91 IN UINTN BufferSize,
92 IN VOID *Buffer
93 );
94
95 /**
96 Flush the Block Device.
97
98 @param This Indicates a pointer to the calling context.
99
100 @retval EFI_SUCCESS All outstanding data was written to the device
101 @retval EFI_DEVICE_ERROR The device reported an error while writing back the data
102 @retval EFI_NO_MEDIA There is no media in the device.
103
104 **/
105 EFI_STATUS
106 EFIAPI
107 NvmeBlockIoFlushBlocks (
108 IN EFI_BLOCK_IO_PROTOCOL *This
109 );
110
111 #endif