xref: /aosp_15_r20/external/coreboot/util/cbfstool/flashrom.h (revision b9411a12aaaa7e1e6a6fb7c5e057f44ee179a49c)
1 /* Copyright 2020 The ChromiumOS Authors. All rights reserved.
2  * Use of this source code is governed by a BSD-style license that can be
3  * found in the LICENSE file.
4  *
5  * Host utilities to execute flashrom command.
6  */
7 
8 #include <stdint.h>
9 #include "common.h" /* from cbfstool for buffer API. */
10 
11 /**
12  * Read using flashrom into an allocated buffer.
13  *
14  * @param buffer	The parameter that contains the buffer to use
15  *			in the read operation.
16  * @param region	The name of the fmap region to read, or NULL to
17  *			read the entire flash chip.
18  *
19  * @return 0 on success, or < 0 on error.
20  */
21 int flashrom_host_read(struct buffer *buffer, const char *region);
22 
23 /**
24  * Write using flashrom from a buffer.
25  *
26  * @param buffer	The parameter that contains the buffer to use
27  *			in the write operation.
28  * @param regions	The name of the fmap region to write, or NULL to
29  *			write the entire flash chip.
30  *
31  * @return 0 on success, or < 0 on error.
32  */
33 int flashrom_host_write(struct buffer *buffer, const char *region);
34