aboutsummaryrefslogtreecommitdiff
path: root/src/ec/google/common/mec.h
diff options
context:
space:
mode:
authorDuncan Laurie <dlaurie@google.com>2018-10-14 02:39:46 +0000
committerPatrick Georgi <pgeorgi@google.com>2018-10-18 15:01:27 +0000
commit26cf00ab498a78b59c9170d38d6ee7ced930259c (patch)
treeae300f5c0ff2b489db92493e1ba77c2ca1a82c93 /src/ec/google/common/mec.h
parentc2ef1029fabfccbdd3e86c5f659f83109313c9f9 (diff)
ec/google/common: Add a common MEC interface
In order to re-use the MEC interface code in the Chrome EC driver move it to a common directory within the ec/google directory. The Chrome EC driver itself is changed to use this interface in the next commit, and future commits will introduce a new EC that also uses this interface. Change-Id: I13516b5e4c4c49f53bb998366284a26703142e2a Signed-off-by: Duncan Laurie <dlaurie@google.com> Reviewed-on: https://review.coreboot.org/29111 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Paul Menzel <paulepanter@users.sourceforge.net> Reviewed-by: Aaron Durbin <adurbin@chromium.org>
Diffstat (limited to 'src/ec/google/common/mec.h')
-rw-r--r--src/ec/google/common/mec.h43
1 files changed, 43 insertions, 0 deletions
diff --git a/src/ec/google/common/mec.h b/src/ec/google/common/mec.h
new file mode 100644
index 0000000000..3452bada7a
--- /dev/null
+++ b/src/ec/google/common/mec.h
@@ -0,0 +1,43 @@
+/*
+ * This file is part of the coreboot project.
+ *
+ * Copyright 2018 Google LLC
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; version 2 of the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ */
+
+#ifndef EC_GOOGLE_COMMON_MEC_H
+#define EC_GOOGLE_COMMON_MEC_H
+
+#include <stddef.h>
+#include <stdint.h>
+
+/* Indicate read or write from MEC IO region */
+enum mec_io_type {
+ MEC_IO_READ,
+ MEC_IO_WRITE
+};
+
+/*
+ * mec_io_bytes - Read / write bytes to MEC EMI port
+ *
+ * @type: Indicate read or write operation
+ * @base: Base address for MEC EMI region
+ * @offset: Base read / write address
+ * @buffer: Destination / source buffer
+ * @size: Number of bytes to read / write
+ *
+ * @returns 8-bit checksum of all bytes read or written
+ */
+
+uint8_t mec_io_bytes(enum mec_io_type type, uint16_t base,
+ uint16_t offset, void *buffer, size_t size);
+
+#endif /* EC_GOOGLE_COMMON_MEC_H */