aboutsummaryrefslogtreecommitdiff
path: root/include/hw/misc/aspeed_peci.h
diff options
context:
space:
mode:
authorPeter Delevoryas <pdel@fb.com>2022-06-30 09:21:14 +0200
committerCédric Le Goater <clg@kaod.org>2022-06-30 09:21:14 +0200
commit55c57023b740c29151d42600af9ac43ba00e56cc (patch)
tree847312bcb99b4f486ed20bae9dfd4aaf76bef4fc /include/hw/misc/aspeed_peci.h
parent1c5d909f882ebd666224e3e1338a87616ebce4ed (diff)
downloadqemu-55c57023b740c29151d42600af9ac43ba00e56cc.zip
qemu-55c57023b740c29151d42600af9ac43ba00e56cc.tar.gz
qemu-55c57023b740c29151d42600af9ac43ba00e56cc.tar.bz2
hw/misc/aspeed: Add PECI controller
This introduces a really basic PECI controller that responses to commands by always setting the response code to success and then raising an interrupt to indicate the command is done. This helps avoid getting hit with constant errors if the driver continuously attempts to send a command and keeps timing out. The AST2400 and AST2500 only included registers up to 0x5C, not 0xFC. They supported PECI 1.1, 2.0, and 3.0. The AST2600 and AST1030 support PECI 4.0, which includes more read/write buffer registers from 0x80 to 0xFC to support 64-byte mode. This patch doesn't attempt to handle that, or to create a different version of the controller for the different generations, since it's only implementing functionality that is common to all generations. The basic sequence of events is that the firmware will read and write to various registers and then trigger a command by setting the FIRE bit in the command register (similar to the I2C controller). Then the firmware waits for an interrupt from the PECI controller, expecting the interrupt status register to be filled in with info on what happened. If the command was transmitted and received successfully, then response codes from the host CPU will be found in the data buffer registers. Signed-off-by: Peter Delevoryas <pdel@fb.com> Reviewed-by: Cédric Le Goater <clg@kaod.org> Message-Id: <20220630045133.32251-12-me@pjd.dev> [ clg: s/sysbus_mmio_map/aspeed_mmio_map/ ] Signed-off-by: Cédric Le Goater <clg@kaod.org>
Diffstat (limited to 'include/hw/misc/aspeed_peci.h')
-rw-r--r--include/hw/misc/aspeed_peci.h29
1 files changed, 29 insertions, 0 deletions
diff --git a/include/hw/misc/aspeed_peci.h b/include/hw/misc/aspeed_peci.h
new file mode 100644
index 0000000..8382707
--- /dev/null
+++ b/include/hw/misc/aspeed_peci.h
@@ -0,0 +1,29 @@
+/*
+ * Aspeed PECI Controller
+ *
+ * Copyright (c) Meta Platforms, Inc. and affiliates. (http://www.meta.com)
+ *
+ * This code is licensed under the GPL version 2 or later. See the COPYING
+ * file in the top-level directory.
+ */
+
+#ifndef ASPEED_PECI_H
+#define ASPEED_PECI_H
+
+#include "hw/sysbus.h"
+
+#define ASPEED_PECI_NR_REGS ((0xFC + 4) >> 2)
+#define TYPE_ASPEED_PECI "aspeed.peci"
+OBJECT_DECLARE_SIMPLE_TYPE(AspeedPECIState, ASPEED_PECI);
+
+struct AspeedPECIState {
+ /* <private> */
+ SysBusDevice parent;
+
+ MemoryRegion mmio;
+ qemu_irq irq;
+
+ uint32_t regs[ASPEED_PECI_NR_REGS];
+};
+
+#endif