xref: /aosp_15_r20/external/coreboot/src/ec/google/common/mec.h (revision b9411a12aaaa7e1e6a6fb7c5e057f44ee179a49c)
1 /* SPDX-License-Identifier: GPL-2.0-only */
2 
3 #ifndef EC_GOOGLE_COMMON_MEC_H
4 #define EC_GOOGLE_COMMON_MEC_H
5 
6 #include <stddef.h>
7 #include <stdint.h>
8 
9 /* Indicate read or write from MEC IO region */
10 enum mec_io_type {
11 	MEC_IO_READ,
12 	MEC_IO_WRITE
13 };
14 
15 /*
16  * mec_io_bytes - Read / write bytes to MEC EMI port
17  *
18  * @type:    Indicate read or write operation
19  * @base:    Base address for MEC EMI region
20  * @offset:  Base read / write address
21  * @buffer:  Destination / source buffer
22  * @size:    Number of bytes to read / write
23  *
24  * @returns 8-bit checksum of all bytes read or written
25  */
26 
27 uint8_t mec_io_bytes(enum mec_io_type type, uint16_t base,
28 		     uint16_t offset, void *buffer, size_t size);
29 
30 #endif /* EC_GOOGLE_COMMON_MEC_H */
31