]> git.proxmox.com Git - mirror_edk2.git/blame - MdePkg/Include/Protocol/EraseBlock.h
MdePkg: Apply uncrustify changes
[mirror_edk2.git] / MdePkg / Include / Protocol / EraseBlock.h
CommitLineData
88bae0c5
HW
1/** @file\r
2 This file defines the EFI Erase Block Protocol.\r
3\r
4 Copyright (c) 2016, Intel Corporation. All rights reserved.<BR>\r
9344f092 5 SPDX-License-Identifier: BSD-2-Clause-Patent\r
88bae0c5
HW
6\r
7 @par Revision Reference:\r
8 This Protocol is introduced in UEFI Specification 2.6\r
9\r
10**/\r
11\r
12#ifndef __EFI_ERASE_BLOCK_PROTOCOL_H__\r
13#define __EFI_ERASE_BLOCK_PROTOCOL_H__\r
14\r
15#define EFI_ERASE_BLOCK_PROTOCOL_GUID \\r
16 { \\r
17 0x95a9a93e, 0xa86e, 0x4926, { 0xaa, 0xef, 0x99, 0x18, 0xe7, 0x72, 0xd9, 0x87 } \\r
18 }\r
19\r
20typedef struct _EFI_ERASE_BLOCK_PROTOCOL EFI_ERASE_BLOCK_PROTOCOL;\r
21\r
2f88bd3a 22#define EFI_ERASE_BLOCK_PROTOCOL_REVISION ((2<<16) | (60))\r
88bae0c5
HW
23\r
24///\r
25/// EFI_ERASE_BLOCK_TOKEN\r
26///\r
27typedef struct {\r
28 //\r
29 // If Event is NULL, then blocking I/O is performed. If Event is not NULL and\r
30 // non-blocking I/O is supported, then non-blocking I/O is performed, and\r
31 // Event will be signaled when the erase request is completed.\r
32 //\r
2f88bd3a 33 EFI_EVENT Event;\r
88bae0c5
HW
34 //\r
35 // Defines whether the signaled event encountered an error.\r
36 //\r
2f88bd3a 37 EFI_STATUS TransactionStatus;\r
88bae0c5
HW
38} EFI_ERASE_BLOCK_TOKEN;\r
39\r
40/**\r
41 Erase a specified number of device blocks.\r
42\r
43 @param[in] This Indicates a pointer to the calling context.\r
44 @param[in] MediaId The media ID that the erase request is for.\r
45 @param[in] LBA The starting logical block address to be\r
46 erased. The caller is responsible for erasing\r
47 only legitimate locations.\r
48 @param[in, out] Token A pointer to the token associated with the\r
49 transaction.\r
50 @param[in] Size The size in bytes to be erased. This must be\r
51 a multiple of the physical block size of the\r
52 device.\r
53\r
54 @retval EFI_SUCCESS The erase request was queued if Event is not\r
55 NULL. The data was erased correctly to the\r
56 device if the Event is NULL.to the device.\r
57 @retval EFI_WRITE_PROTECTED The device cannot be erased due to write\r
58 protection.\r
59 @retval EFI_DEVICE_ERROR The device reported an error while attempting\r
60 to perform the erase operation.\r
61 @retval EFI_INVALID_PARAMETER The erase request contains LBAs that are not\r
62 valid.\r
63 @retval EFI_NO_MEDIA There is no media in the device.\r
64 @retval EFI_MEDIA_CHANGED The MediaId is not for the current media.\r
65\r
66**/\r
67typedef\r
68EFI_STATUS\r
2f88bd3a 69(EFIAPI *EFI_BLOCK_ERASE)(\r
88bae0c5
HW
70 IN EFI_ERASE_BLOCK_PROTOCOL *This,\r
71 IN UINT32 MediaId,\r
72 IN EFI_LBA LBA,\r
73 IN OUT EFI_ERASE_BLOCK_TOKEN *Token,\r
74 IN UINTN Size\r
75 );\r
76\r
77///\r
78/// The EFI Erase Block Protocol provides the ability for a device to expose\r
79/// erase functionality. This optional protocol is installed on the same handle\r
80/// as the EFI_BLOCK_IO_PROTOCOL or EFI_BLOCK_IO2_PROTOCOL.\r
81///\r
82struct _EFI_ERASE_BLOCK_PROTOCOL {\r
83 //\r
84 // The revision to which the EFI_ERASE_BLOCK_PROTOCOL adheres. All future\r
85 // revisions must be backwards compatible. If a future version is not\r
86 // backwards compatible, it is not the same GUID.\r
87 //\r
2f88bd3a 88 UINT64 Revision;\r
88bae0c5
HW
89 //\r
90 // Returns the erase length granularity as a number of logical blocks. A\r
91 // value of 1 means the erase granularity is one logical block.\r
92 //\r
2f88bd3a
MK
93 UINT32 EraseLengthGranularity;\r
94 EFI_BLOCK_ERASE EraseBlocks;\r
88bae0c5
HW
95};\r
96\r
2f88bd3a 97extern EFI_GUID gEfiEraseBlockProtocolGuid;\r
88bae0c5
HW
98\r
99#endif\r