Duncan Laurie | 26cf00a | 2018-10-14 02:39:46 +0000 | [diff] [blame] | 1 | /* |
| 2 | * This file is part of the coreboot project. |
| 3 | * |
| 4 | * Copyright 2018 Google LLC |
| 5 | * |
| 6 | * This program is free software; you can redistribute it and/or modify |
| 7 | * it under the terms of the GNU General Public License as published by |
| 8 | * the Free Software Foundation; version 2 of the License. |
| 9 | * |
| 10 | * This program is distributed in the hope that it will be useful, |
| 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 13 | * GNU General Public License for more details. |
| 14 | */ |
| 15 | |
| 16 | #ifndef EC_GOOGLE_COMMON_MEC_H |
| 17 | #define EC_GOOGLE_COMMON_MEC_H |
| 18 | |
| 19 | #include <stddef.h> |
| 20 | #include <stdint.h> |
| 21 | |
| 22 | /* Indicate read or write from MEC IO region */ |
| 23 | enum mec_io_type { |
| 24 | MEC_IO_READ, |
| 25 | MEC_IO_WRITE |
| 26 | }; |
| 27 | |
| 28 | /* |
| 29 | * mec_io_bytes - Read / write bytes to MEC EMI port |
| 30 | * |
| 31 | * @type: Indicate read or write operation |
| 32 | * @base: Base address for MEC EMI region |
| 33 | * @offset: Base read / write address |
| 34 | * @buffer: Destination / source buffer |
| 35 | * @size: Number of bytes to read / write |
| 36 | * |
| 37 | * @returns 8-bit checksum of all bytes read or written |
| 38 | */ |
| 39 | |
| 40 | uint8_t mec_io_bytes(enum mec_io_type type, uint16_t base, |
| 41 | uint16_t offset, void *buffer, size_t size); |
| 42 | |
| 43 | #endif /* EC_GOOGLE_COMMON_MEC_H */ |