summaryrefslogtreecommitdiff
path: root/src/include/console
diff options
context:
space:
mode:
authorMartin Roth <martinroth@google.com>2015-09-28 15:27:24 -0600
committerMartin Roth <martinroth@google.com>2015-10-05 17:43:11 +0000
commit3a54318856428cda41c5a45e41c4da727d352bf6 (patch)
treeb318ca7a8576d130ec18e853543d21542114d41b /src/include/console
parentf35f5ff3cd86b247a1e8ff1df8d071a3a4556079 (diff)
downloadcoreboot-3a54318856428cda41c5a45e41c4da727d352bf6.tar.xz
Add EM100 'hyper term' spi console support in ramstage & smm
The EM100Pro allows the debug console to be sent over the SPI bus. This is not yet working in romstage due to the use of static variables in the SPI driver code. It is also not working on chipsets that have SPI write buffers of less than 10 characters due to the 9 byte command/header length specified by the EM100 protocol. While this currently works only with the EM100, it seems like it would be useful on any logic analyzer with SPI debug - just filter on command bytes of 0x11. Change-Id: Icd42ccd96cab0a10a4e70f4b02ecf9de8169564b Signed-off-by: Martin Roth <martinroth@google.com> Reviewed-on: http://review.coreboot.org/11743 Tested-by: build bot (Jenkins) Reviewed-by: Stefan Reinauer <stefan.reinauer@coreboot.org>
Diffstat (limited to 'src/include/console')
-rw-r--r--src/include/console/spi.h72
1 files changed, 72 insertions, 0 deletions
diff --git a/src/include/console/spi.h b/src/include/console/spi.h
new file mode 100644
index 0000000000..c47fec541a
--- /dev/null
+++ b/src/include/console/spi.h
@@ -0,0 +1,72 @@
+/*
+ * This file is part of the coreboot project.
+ *
+ * Copyright 2015 Google Inc.
+ *
+ * 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.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc.
+ */
+
+#ifndef CONSOLE_SPI_H
+#define CONSOLE_SPI_H 1
+
+#include <rules.h>
+#include <stdint.h>
+
+void spiconsole_init(void);
+void spiconsole_tx_byte(unsigned char c);
+
+#define __CONSOLE_SPI_ENABLE__ CONFIG_SPI_CONSOLE && \
+ (ENV_RAMSTAGE || (ENV_SMM && CONFIG_DEBUG_SMI))
+
+#if __CONSOLE_SPI_ENABLE__
+static inline void __spiconsole_init(void) { spiconsole_init(); }
+static inline void __spiconsole_tx_byte(u8 data) { spiconsole_tx_byte(data); }
+#else
+static inline void __spiconsole_init(void) {}
+static inline void __spiconsole_tx_byte(u8 data) {}
+#endif /* __CONSOLE_SPI_ENABLE__ */
+
+#define MAX_MSG_LENGTH 128
+
+#define EM100_DEDICATED_CMD 0x11
+#define EM100_UFIFO_CMD 0xC0
+#define EM100_MSG_SIGNATURE 0x47364440
+
+enum em100_message_types {
+ EM100_MSG_CHECKPOINT_1B = 0x01,
+ EM100_MSG_CHECKPOINT_2B,
+ EM100_MSG_CHECKPOINT_4B,
+ EM100_MSG_HEX,
+ EM100_MSG_ASCII,
+ EM100_MSG_TIMESTAMP,
+ EM100_MSG_LOOKUP
+};
+
+struct em100_msg_header {
+ uint8_t spi_command;
+ uint8_t reserved;
+ uint8_t em100_command;
+ uint32_t msg_signature;
+ uint8_t msg_type;
+ uint8_t msg_length;
+} __attribute__ ((packed));
+
+struct em100_msg {
+ struct em100_msg_header header;
+ char data[MAX_MSG_LENGTH];
+} __attribute__ ((packed));
+
+
+
+#endif /* CONSOLE_SPI_H */