]> git.proxmox.com Git - mirror_edk2.git/blame - MdePkg/Include/Protocol/EraseBlock.h
MdePkg/Include/Protocol/Tls.h: pack structures from the TLS RFC
[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
5 This program and the accompanying materials\r
6 are licensed and made available under the terms and conditions of the BSD License\r
7 which accompanies this distribution. The full text of the license may be found at\r
8 http://opensource.org/licenses/bsd-license.php\r
9\r
10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
12\r
13 @par Revision Reference:\r
14 This Protocol is introduced in UEFI Specification 2.6\r
15\r
16**/\r
17\r
18#ifndef __EFI_ERASE_BLOCK_PROTOCOL_H__\r
19#define __EFI_ERASE_BLOCK_PROTOCOL_H__\r
20\r
21#define EFI_ERASE_BLOCK_PROTOCOL_GUID \\r
22 { \\r
23 0x95a9a93e, 0xa86e, 0x4926, { 0xaa, 0xef, 0x99, 0x18, 0xe7, 0x72, 0xd9, 0x87 } \\r
24 }\r
25\r
26typedef struct _EFI_ERASE_BLOCK_PROTOCOL EFI_ERASE_BLOCK_PROTOCOL;\r
27\r
28#define EFI_ERASE_BLOCK_PROTOCOL_REVISION ((2<<16) | (60))\r
29\r
30///\r
31/// EFI_ERASE_BLOCK_TOKEN\r
32///\r
33typedef struct {\r
34 //\r
35 // If Event is NULL, then blocking I/O is performed. If Event is not NULL and\r
36 // non-blocking I/O is supported, then non-blocking I/O is performed, and\r
37 // Event will be signaled when the erase request is completed.\r
38 //\r
39 EFI_EVENT Event;\r
40 //\r
41 // Defines whether the signaled event encountered an error.\r
42 //\r
43 EFI_STATUS TransactionStatus;\r
44} EFI_ERASE_BLOCK_TOKEN;\r
45\r
46/**\r
47 Erase a specified number of device blocks.\r
48\r
49 @param[in] This Indicates a pointer to the calling context.\r
50 @param[in] MediaId The media ID that the erase request is for.\r
51 @param[in] LBA The starting logical block address to be\r
52 erased. The caller is responsible for erasing\r
53 only legitimate locations.\r
54 @param[in, out] Token A pointer to the token associated with the\r
55 transaction.\r
56 @param[in] Size The size in bytes to be erased. This must be\r
57 a multiple of the physical block size of the\r
58 device.\r
59\r
60 @retval EFI_SUCCESS The erase request was queued if Event is not\r
61 NULL. The data was erased correctly to the\r
62 device if the Event is NULL.to the device.\r
63 @retval EFI_WRITE_PROTECTED The device cannot be erased due to write\r
64 protection.\r
65 @retval EFI_DEVICE_ERROR The device reported an error while attempting\r
66 to perform the erase operation.\r
67 @retval EFI_INVALID_PARAMETER The erase request contains LBAs that are not\r
68 valid.\r
69 @retval EFI_NO_MEDIA There is no media in the device.\r
70 @retval EFI_MEDIA_CHANGED The MediaId is not for the current media.\r
71\r
72**/\r
73typedef\r
74EFI_STATUS\r
75(EFIAPI *EFI_BLOCK_ERASE) (\r
76 IN EFI_ERASE_BLOCK_PROTOCOL *This,\r
77 IN UINT32 MediaId,\r
78 IN EFI_LBA LBA,\r
79 IN OUT EFI_ERASE_BLOCK_TOKEN *Token,\r
80 IN UINTN Size\r
81 );\r
82\r
83///\r
84/// The EFI Erase Block Protocol provides the ability for a device to expose\r
85/// erase functionality. This optional protocol is installed on the same handle\r
86/// as the EFI_BLOCK_IO_PROTOCOL or EFI_BLOCK_IO2_PROTOCOL.\r
87///\r
88struct _EFI_ERASE_BLOCK_PROTOCOL {\r
89 //\r
90 // The revision to which the EFI_ERASE_BLOCK_PROTOCOL adheres. All future\r
91 // revisions must be backwards compatible. If a future version is not\r
92 // backwards compatible, it is not the same GUID.\r
93 //\r
94 UINT64 Revision;\r
95 //\r
96 // Returns the erase length granularity as a number of logical blocks. A\r
97 // value of 1 means the erase granularity is one logical block.\r
98 //\r
99 UINT32 EraseLengthGranularity;\r
100 EFI_BLOCK_ERASE EraseBlocks;\r
101};\r
102\r
103extern EFI_GUID gEfiEraseBlockProtocolGuid;\r
104\r
105#endif\r