xref: /aosp_15_r20/bootable/libbootloader/gbl/libefi_types/defs/protocols/block_io2_protocol.h (revision 5225e6b173e52d2efc6bcf950c27374fd72adabc)
1 /*
2  * Copyright (C) 2024 The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *     http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  *
16  */
17 
18 #ifndef __BLOCK_IO2_PROTOCOL_H__
19 #define __BLOCK_IO2_PROTOCOL_H__
20 
21 #include "protocols/block_io_protocol.h"
22 #include "types.h"
23 
24 typedef struct EfiBlockIoMedia EfiBlockIoMedia;
25 typedef struct EfiBlockIo2Protocol EfiBlockIo2Protocol;
26 
27 typedef struct {
28   EfiEvent event;
29   EfiStatus transaction_status;
30 } EfiBlockIo2Token;
31 
32 struct EfiBlockIo2Protocol {
33   EfiBlockIoMedia* media;
34   EfiStatus (*reset)(EfiBlockIo2Protocol* self, bool extended_verification);
35   EfiStatus (*read_blocks_ex)(EfiBlockIo2Protocol* self, uint32_t media_id,
36                               uint64_t lba, EfiBlockIo2Token* token,
37                               size_t buffer_size, void* buffer);
38   EfiStatus (*write_blocks_ex)(EfiBlockIo2Protocol* self, uint32_t media_id,
39                                uint64_t lba, EfiBlockIo2Token* token,
40                                size_t buffer_size, const void* buffer);
41   EfiStatus (*flush_blocks_ex)(EfiBlockIo2Protocol* self,
42                                EfiBlockIo2Token* token);
43 };
44 
45 #endif  //__BLOCK_IO2_PROTOCOL_H__
46