Compare commits
151 Commits
migration-
...
without-de
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
eab13108cd | ||
|
|
750400c56f | ||
|
|
f5ef199312 | ||
|
|
c789207417 | ||
|
|
3bf0b7dd7b | ||
|
|
3864d5e5c6 | ||
|
|
8a840ab4c2 | ||
|
|
d32f29f651 | ||
|
|
696cf0c1cd | ||
|
|
ef92be0914 | ||
|
|
f85bfa0bcb | ||
|
|
ecbd3f095e | ||
|
|
f670b3eec7 | ||
|
|
7b548761e5 | ||
|
|
cfc3bcf373 | ||
|
|
10351fbad1 | ||
|
|
d926f3bb2a | ||
|
|
e5bac1f525 | ||
|
|
5655aab079 | ||
|
|
b28fb58227 | ||
|
|
fc063a7b8a | ||
|
|
d6f74fd12e | ||
|
|
cc98c9fd5c | ||
|
|
04ffce137b | ||
|
|
e264705012 | ||
|
|
4010ba388d | ||
|
|
8d80e1951e | ||
|
|
8008a272d6 | ||
|
|
31e2ac742b | ||
|
|
51efd36faf | ||
|
|
c40c046341 | ||
|
|
93e0932b7b | ||
|
|
bca762c2b9 | ||
|
|
e3f37b2ce6 | ||
|
|
b530ccde5d | ||
|
|
3b33ae48ec | ||
|
|
acbc8aee5b | ||
|
|
00e2a04c27 | ||
|
|
1321e00801 | ||
|
|
3c5867156e | ||
|
|
1f433e84c3 | ||
|
|
331acddc87 | ||
|
|
417296c8d8 | ||
|
|
65417c2357 | ||
|
|
ae2b5d8381 | ||
|
|
6e34f54d88 | ||
|
|
77eb0085c8 | ||
|
|
6dcb9922f3 | ||
|
|
d8b33554d8 | ||
|
|
7ebe4cb364 | ||
|
|
a4d5d153c4 | ||
|
|
70447df936 | ||
|
|
48bffe7f6b | ||
|
|
fa581531ff | ||
|
|
1c6b2e4b79 | ||
|
|
76f7f54840 | ||
|
|
65e57fdb25 | ||
|
|
a67dfa660b | ||
|
|
bfe7bf8590 | ||
|
|
2ca10faeb8 | ||
|
|
d35d5047a6 | ||
|
|
02f95e91a6 | ||
|
|
06e2b0107f | ||
|
|
1beb07ca8a | ||
|
|
e02e085c8b | ||
|
|
c0e38aa8f5 | ||
|
|
c12a984814 | ||
|
|
e094580050 | ||
|
|
626fb3c6a8 | ||
|
|
d90b1e4236 | ||
|
|
f4124f831d | ||
|
|
48e438a3aa | ||
|
|
d598d9746e | ||
|
|
6a7f0515fd | ||
|
|
2555150244 | ||
|
|
aa735872a8 | ||
|
|
6b433719ea | ||
|
|
969d09c3a6 | ||
|
|
5c71a91126 | ||
|
|
b86307ecef | ||
|
|
285ee77f5b | ||
|
|
bf81b8f8ac | ||
|
|
44055caaa5 | ||
|
|
f16c27a52d | ||
|
|
98fb9678da | ||
|
|
6ba3dc2516 | ||
|
|
29c4f0601f | ||
|
|
72006c619f | ||
|
|
ed5d9774c6 | ||
|
|
f8ad895824 | ||
|
|
4ef247661e | ||
|
|
6fdb438187 | ||
|
|
4f2c6448c3 | ||
|
|
c0216b94ed | ||
|
|
9f782e9e82 | ||
|
|
9077e09a13 | ||
|
|
9618ebae45 | ||
|
|
ddbf7bd73c | ||
|
|
30d7aac415 | ||
|
|
ed1f5ff842 | ||
|
|
3e7808de05 | ||
|
|
9b983dc78b | ||
|
|
036e98e5c2 | ||
|
|
479365979b | ||
|
|
a7f16aed39 | ||
|
|
ffd0cac708 | ||
|
|
5474aa4f3e | ||
|
|
947bf7fe9f | ||
|
|
5fc0fc8788 | ||
|
|
506c6698fb | ||
|
|
179d9e2911 | ||
|
|
578086ba2f | ||
|
|
95bd8daaaf | ||
|
|
7ad2878cfd | ||
|
|
d4d901157e | ||
|
|
45f9df86db | ||
|
|
af99aa72ef | ||
|
|
b8a5832b87 | ||
|
|
3290933853 | ||
|
|
fa13458546 | ||
|
|
426c049196 | ||
|
|
c9410a689f | ||
|
|
134c3ffa34 | ||
|
|
49a7f3aabb | ||
|
|
4b402886ac | ||
|
|
bc2c015353 | ||
|
|
909f7da604 | ||
|
|
26934f9a95 | ||
|
|
606a2439ba | ||
|
|
568e0614d0 | ||
|
|
2967f37d44 | ||
|
|
f008a2d218 | ||
|
|
ae0edf2188 | ||
|
|
14cb78bfaf | ||
|
|
2cfb3b6c9b | ||
|
|
32c435a1ae | ||
|
|
7ae7146287 | ||
|
|
3de1fb712a | ||
|
|
11b4a4eeec | ||
|
|
cb1513df3f | ||
|
|
a925323008 | ||
|
|
4b950af8d3 | ||
|
|
9b97d07748 | ||
|
|
5df3eb4d36 | ||
|
|
1f7888e225 | ||
|
|
1d0c537985 | ||
|
|
af36fca459 | ||
|
|
740ce28c46 | ||
|
|
ea361fc348 | ||
|
|
4db4847d83 | ||
|
|
588c5b0b9f |
@@ -295,6 +295,14 @@ F: include/hw/riscv/
|
||||
F: linux-user/host/riscv32/
|
||||
F: linux-user/host/riscv64/
|
||||
|
||||
RISC-V XThead* extensions
|
||||
M: Christoph Muellner <christoph.muellner@vrull.eu>
|
||||
M: LIU Zhiwei <zhiwei_liu@linux.alibaba.com>
|
||||
L: qemu-riscv@nongnu.org
|
||||
S: Supported
|
||||
F: target/riscv/insn_trans/trans_xthead.c.inc
|
||||
F: target/riscv/xthead*.decode
|
||||
|
||||
RISC-V XVentanaCondOps extension
|
||||
M: Philipp Tomsich <philipp.tomsich@vrull.eu>
|
||||
L: qemu-riscv@nongnu.org
|
||||
|
||||
@@ -28,7 +28,6 @@
|
||||
#include "exec/exec-all.h"
|
||||
#include "tcg/tcg.h"
|
||||
#include "qemu/atomic.h"
|
||||
#include "qemu/compiler.h"
|
||||
#include "qemu/timer.h"
|
||||
#include "qemu/rcu.h"
|
||||
#include "exec/log.h"
|
||||
|
||||
@@ -14,9 +14,9 @@
|
||||
* to recording, which is what guest systems expect.
|
||||
*/
|
||||
|
||||
#include "qemu/osdep.h"
|
||||
#include <poll.h>
|
||||
#include <sndio.h>
|
||||
#include "qemu/osdep.h"
|
||||
#include "qemu/main-loop.h"
|
||||
#include "audio.h"
|
||||
#include "trace.h"
|
||||
|
||||
@@ -9,9 +9,9 @@
|
||||
* This work is licensed under the terms of the GNU GPL, version 2 or later.
|
||||
* See the COPYING file in the top-level directory.
|
||||
*/
|
||||
#include <sys/ioctl.h>
|
||||
|
||||
#include "qemu/osdep.h"
|
||||
#include <sys/ioctl.h>
|
||||
#include "qom/object_interfaces.h"
|
||||
#include "qapi/error.h"
|
||||
#include "sysemu/hostmem.h"
|
||||
|
||||
@@ -35,7 +35,6 @@
|
||||
#include "sysemu/runstate.h"
|
||||
#include "sysemu/tpm_backend.h"
|
||||
#include "sysemu/tpm_util.h"
|
||||
#include "sysemu/runstate.h"
|
||||
#include "tpm_int.h"
|
||||
#include "tpm_ioctl.h"
|
||||
#include "migration/blocker.h"
|
||||
|
||||
@@ -12,8 +12,6 @@
|
||||
# define __USE_LINUX_IOCTL_DEFS
|
||||
#endif
|
||||
|
||||
#include <stdint.h>
|
||||
#include <sys/types.h>
|
||||
#ifndef _WIN32
|
||||
#include <sys/uio.h>
|
||||
#include <sys/ioctl.h>
|
||||
|
||||
@@ -10,9 +10,9 @@
|
||||
* later. See the COPYING file in the top-level directory.
|
||||
*/
|
||||
|
||||
#include "qemu/osdep.h"
|
||||
#include <sys/eventfd.h>
|
||||
|
||||
#include "qemu/osdep.h"
|
||||
#include "qapi/error.h"
|
||||
#include "block/export.h"
|
||||
#include "qemu/error-report.h"
|
||||
|
||||
@@ -1926,6 +1926,9 @@ static int coroutine_fn bdrv_aligned_pwritev(BdrvChild *child,
|
||||
if (bs->detect_zeroes == BLOCKDEV_DETECT_ZEROES_OPTIONS_UNMAP) {
|
||||
flags |= BDRV_REQ_MAY_UNMAP;
|
||||
}
|
||||
|
||||
/* Can't use optimization hint with bufferless zero write */
|
||||
flags &= ~BDRV_REQ_REGISTERED_BUF;
|
||||
}
|
||||
|
||||
if (ret < 0) {
|
||||
|
||||
@@ -40,7 +40,6 @@
|
||||
#include "qapi/qmp/qstring.h"
|
||||
#include "qemu/qemu-print.h"
|
||||
#include "sysemu/block-backend.h"
|
||||
#include "qemu/cutils.h"
|
||||
|
||||
BlockDeviceInfo *bdrv_block_device_info(BlockBackend *blk,
|
||||
BlockDriverState *bs,
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
* along with this program; if not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "qemu/osdep.h"
|
||||
#include "qemu.h"
|
||||
|
||||
/*
|
||||
|
||||
@@ -16,6 +16,8 @@
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "qemu/osdep.h"
|
||||
#include "target_arch.h"
|
||||
|
||||
void target_cpu_set_tls(CPUARMState *env, target_ulong newtls)
|
||||
|
||||
@@ -20,11 +20,7 @@
|
||||
#ifndef BSD_PROC_H_
|
||||
#define BSD_PROC_H_
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <sys/time.h>
|
||||
#include <sys/resource.h>
|
||||
#include <unistd.h>
|
||||
|
||||
/* exit(2) */
|
||||
static inline abi_long do_bsd_exit(void *cpu_env, abi_long arg1)
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
* along with this program; if not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "qemu/osdep.h"
|
||||
#include "qemu.h"
|
||||
#include "target_arch_sysarch.h"
|
||||
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
* along with this program; if not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "qemu/osdep.h"
|
||||
#include "qemu.h"
|
||||
|
||||
/*
|
||||
|
||||
@@ -17,9 +17,8 @@
|
||||
* along with this program; if not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <sys/types.h>
|
||||
|
||||
#include "qemu/osdep.h"
|
||||
|
||||
#include "cpu.h"
|
||||
#include "qemu.h"
|
||||
#include "qemu/timer.h"
|
||||
|
||||
@@ -18,12 +18,10 @@
|
||||
* along with this program; if not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/time.h>
|
||||
#include "qemu/osdep.h"
|
||||
#include <sys/resource.h>
|
||||
#include <sys/sysctl.h>
|
||||
|
||||
#include "qemu/osdep.h"
|
||||
#include "qemu/help-texts.h"
|
||||
#include "qemu/units.h"
|
||||
#include "qemu/accel.h"
|
||||
|
||||
@@ -17,7 +17,6 @@
|
||||
#ifndef QEMU_H
|
||||
#define QEMU_H
|
||||
|
||||
#include "qemu/osdep.h"
|
||||
#include "cpu.h"
|
||||
#include "qemu/units.h"
|
||||
#include "exec/cpu_ldst.h"
|
||||
|
||||
@@ -20,7 +20,6 @@
|
||||
#include <sys/select.h>
|
||||
#include <sys/syscall.h>
|
||||
#include <sys/ioccom.h>
|
||||
#include <ctype.h>
|
||||
|
||||
#include "qemu.h"
|
||||
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
* along with this program; if not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "qemu/osdep.h"
|
||||
#include "qemu.h"
|
||||
|
||||
/*
|
||||
|
||||
@@ -17,9 +17,8 @@
|
||||
* along with this program; if not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <sys/types.h>
|
||||
|
||||
#include "qemu/osdep.h"
|
||||
|
||||
#include "cpu.h"
|
||||
#include "qemu.h"
|
||||
#include "qemu/timer.h"
|
||||
|
||||
@@ -1,7 +0,0 @@
|
||||
# Boards:
|
||||
#
|
||||
CONFIG_ISAPC=n
|
||||
CONFIG_I440FX=n
|
||||
CONFIG_Q35=n
|
||||
CONFIG_MICROVM=y
|
||||
|
||||
@@ -1,6 +0,0 @@
|
||||
# Boards:
|
||||
#
|
||||
CONFIG_ISAPC=y
|
||||
CONFIG_I440FX=y
|
||||
CONFIG_Q35=y
|
||||
CONFIG_MICROVM=y
|
||||
@@ -18,7 +18,6 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#include "qemu/osdep.h"
|
||||
#include "qapi/error.h"
|
||||
#include "qemu/bswap.h"
|
||||
|
||||
|
||||
@@ -1626,9 +1626,9 @@ const rv_opcode_data opcode_data[] = {
|
||||
{ "cpop", rv_codec_r, rv_fmt_rd_rs1, NULL, 0, 0, 0 },
|
||||
{ "sext.h", rv_codec_r, rv_fmt_rd_rs1, NULL, 0, 0, 0 },
|
||||
{ "sext.b", rv_codec_r, rv_fmt_rd_rs1, NULL, 0, 0, 0 },
|
||||
{ "xnor", rv_codec_r, rv_fmt_rd_rs1, NULL, 0, 0, 0 },
|
||||
{ "orn", rv_codec_r, rv_fmt_rd_rs1, NULL, 0, 0, 0 },
|
||||
{ "andn", rv_codec_r, rv_fmt_rd_rs1, NULL, 0, 0, 0 },
|
||||
{ "xnor", rv_codec_r, rv_fmt_rd_rs1_rs2, NULL, 0, 0, 0 },
|
||||
{ "orn", rv_codec_r, rv_fmt_rd_rs1_rs2, NULL, 0, 0, 0 },
|
||||
{ "andn", rv_codec_r, rv_fmt_rd_rs1_rs2, NULL, 0, 0, 0 },
|
||||
{ "rol", rv_codec_r, rv_fmt_rd_rs1_rs2, NULL, 0, 0, 0 },
|
||||
{ "ror", rv_codec_r, rv_fmt_rd_rs1_rs2, NULL, 0, 0, 0 },
|
||||
{ "sh1add", rv_codec_r, rv_fmt_rd_rs1_rs2, NULL, 0, 0, 0 },
|
||||
@@ -1647,7 +1647,7 @@ const rv_opcode_data opcode_data[] = {
|
||||
{ "clzw", rv_codec_r, rv_fmt_rd_rs1, NULL, 0, 0, 0 },
|
||||
{ "clzw", rv_codec_r, rv_fmt_rd_rs1, NULL, 0, 0, 0 },
|
||||
{ "cpopw", rv_codec_r, rv_fmt_rd_rs1, NULL, 0, 0, 0 },
|
||||
{ "slli.uw", rv_codec_r, rv_fmt_rd_rs1_rs2, NULL, 0, 0, 0 },
|
||||
{ "slli.uw", rv_codec_i_sh5, rv_fmt_rd_rs1_imm, NULL, 0, 0, 0 },
|
||||
{ "add.uw", rv_codec_r, rv_fmt_rd_rs1_rs2, NULL, 0, 0, 0 },
|
||||
{ "rolw", rv_codec_r, rv_fmt_rd_rs1_rs2, NULL, 0, 0, 0 },
|
||||
{ "rorw", rv_codec_r, rv_fmt_rd_rs1_rs2, NULL, 0, 0, 0 },
|
||||
|
||||
@@ -27,8 +27,6 @@
|
||||
#ifndef QEMU_P9ARRAY_H
|
||||
#define QEMU_P9ARRAY_H
|
||||
|
||||
#include "qemu/compiler.h"
|
||||
|
||||
/**
|
||||
* P9Array provides a mechanism to access arrays in common C-style (e.g. by
|
||||
* square bracket [] operator) in conjunction with reference variables that
|
||||
|
||||
@@ -19,8 +19,6 @@
|
||||
#include "qemu/osdep.h"
|
||||
#ifdef CONFIG_LINUX
|
||||
#include <linux/limits.h>
|
||||
#else
|
||||
#include <limits.h>
|
||||
#endif
|
||||
#include <glib/gprintf.h>
|
||||
#include "hw/virtio/virtio.h"
|
||||
|
||||
@@ -34,7 +34,6 @@
|
||||
#include "sysemu/xen.h"
|
||||
#include "qapi/error.h"
|
||||
#include "qemu/range.h"
|
||||
#include "hw/acpi/pcihp.h"
|
||||
#include "hw/acpi/cpu_hotplug.h"
|
||||
#include "hw/acpi/cpu.h"
|
||||
#include "hw/hotplug.h"
|
||||
|
||||
@@ -18,7 +18,6 @@
|
||||
#include "net/net.h"
|
||||
#include "qemu/cutils.h"
|
||||
#include "qemu/datadir.h"
|
||||
#include "net/net.h"
|
||||
|
||||
static uint64_t cpu_alpha_superpage_to_phys(void *opaque, uint64_t addr)
|
||||
{
|
||||
|
||||
142
hw/arm/aspeed.c
142
hw/arm/aspeed.c
@@ -14,9 +14,11 @@
|
||||
#include "hw/arm/boot.h"
|
||||
#include "hw/arm/aspeed.h"
|
||||
#include "hw/arm/aspeed_soc.h"
|
||||
#include "hw/arm/aspeed_eeprom.h"
|
||||
#include "hw/i2c/i2c_mux_pca954x.h"
|
||||
#include "hw/i2c/smbus_eeprom.h"
|
||||
#include "hw/misc/pca9552.h"
|
||||
#include "hw/nvram/eeprom_at24c.h"
|
||||
#include "hw/sensor/tmp105.h"
|
||||
#include "hw/misc/led.h"
|
||||
#include "hw/qdev-properties.h"
|
||||
@@ -71,6 +73,16 @@ struct AspeedMachineState {
|
||||
SCU_HW_STRAP_VGA_SIZE_SET(VGA_16M_DRAM) | \
|
||||
SCU_AST2400_HW_STRAP_BOOT_MODE(AST2400_SPI_BOOT))
|
||||
|
||||
/* TODO: Find the actual hardware value */
|
||||
#define SUPERMICRO_X11SPI_BMC_HW_STRAP1 ( \
|
||||
AST2500_HW_STRAP1_DEFAULTS | \
|
||||
SCU_AST2500_HW_STRAP_SPI_AUTOFETCH_ENABLE | \
|
||||
SCU_AST2500_HW_STRAP_GPIO_STRAP_ENABLE | \
|
||||
SCU_AST2500_HW_STRAP_UART_DEBUG | \
|
||||
SCU_AST2500_HW_STRAP_DDR4_ENABLE | \
|
||||
SCU_HW_STRAP_SPI_WIDTH | \
|
||||
SCU_HW_STRAP_SPI_MODE(SCU_HW_STRAP_SPI_M_S_EN))
|
||||
|
||||
/* AST2500 evb hardware value: 0xF100C2E6 */
|
||||
#define AST2500_EVB_HW_STRAP1 (( \
|
||||
AST2500_HW_STRAP1_DEFAULTS | \
|
||||
@@ -429,15 +441,6 @@ static void aspeed_machine_init(MachineState *machine)
|
||||
arm_load_kernel(ARM_CPU(first_cpu), machine, &aspeed_board_binfo);
|
||||
}
|
||||
|
||||
static void at24c_eeprom_init(I2CBus *bus, uint8_t addr, uint32_t rsize)
|
||||
{
|
||||
I2CSlave *i2c_dev = i2c_slave_new("at24c-eeprom", addr);
|
||||
DeviceState *dev = DEVICE(i2c_dev);
|
||||
|
||||
qdev_prop_set_uint32(dev, "rom-size", rsize);
|
||||
i2c_slave_realize_and_unref(i2c_dev, bus, &error_abort);
|
||||
}
|
||||
|
||||
static void palmetto_bmc_i2c_init(AspeedMachineState *bmc)
|
||||
{
|
||||
AspeedSoCState *soc = &bmc->soc;
|
||||
@@ -668,15 +671,6 @@ static void g220a_bmc_i2c_init(AspeedMachineState *bmc)
|
||||
eeprom_buf);
|
||||
}
|
||||
|
||||
static void aspeed_eeprom_init(I2CBus *bus, uint8_t addr, uint32_t rsize)
|
||||
{
|
||||
I2CSlave *i2c_dev = i2c_slave_new("at24c-eeprom", addr);
|
||||
DeviceState *dev = DEVICE(i2c_dev);
|
||||
|
||||
qdev_prop_set_uint32(dev, "rom-size", rsize);
|
||||
i2c_slave_realize_and_unref(i2c_dev, bus, &error_abort);
|
||||
}
|
||||
|
||||
static void fp5280g2_bmc_i2c_init(AspeedMachineState *bmc)
|
||||
{
|
||||
AspeedSoCState *soc = &bmc->soc;
|
||||
@@ -709,7 +703,7 @@ static void rainier_bmc_i2c_init(AspeedMachineState *bmc)
|
||||
AspeedSoCState *soc = &bmc->soc;
|
||||
I2CSlave *i2c_mux;
|
||||
|
||||
aspeed_eeprom_init(aspeed_i2c_get_bus(&soc->i2c, 0), 0x51, 32 * KiB);
|
||||
at24c_eeprom_init(aspeed_i2c_get_bus(&soc->i2c, 0), 0x51, 32 * KiB);
|
||||
|
||||
create_pca9552(soc, 3, 0x61);
|
||||
|
||||
@@ -722,9 +716,9 @@ static void rainier_bmc_i2c_init(AspeedMachineState *bmc)
|
||||
0x4a);
|
||||
i2c_mux = i2c_slave_create_simple(aspeed_i2c_get_bus(&soc->i2c, 4),
|
||||
"pca9546", 0x70);
|
||||
aspeed_eeprom_init(pca954x_i2c_get_bus(i2c_mux, 0), 0x50, 64 * KiB);
|
||||
aspeed_eeprom_init(pca954x_i2c_get_bus(i2c_mux, 1), 0x51, 64 * KiB);
|
||||
aspeed_eeprom_init(pca954x_i2c_get_bus(i2c_mux, 2), 0x52, 64 * KiB);
|
||||
at24c_eeprom_init(pca954x_i2c_get_bus(i2c_mux, 0), 0x50, 64 * KiB);
|
||||
at24c_eeprom_init(pca954x_i2c_get_bus(i2c_mux, 1), 0x51, 64 * KiB);
|
||||
at24c_eeprom_init(pca954x_i2c_get_bus(i2c_mux, 2), 0x52, 64 * KiB);
|
||||
create_pca9552(soc, 4, 0x60);
|
||||
|
||||
i2c_slave_create_simple(aspeed_i2c_get_bus(&soc->i2c, 5), TYPE_TMP105,
|
||||
@@ -735,8 +729,8 @@ static void rainier_bmc_i2c_init(AspeedMachineState *bmc)
|
||||
create_pca9552(soc, 5, 0x61);
|
||||
i2c_mux = i2c_slave_create_simple(aspeed_i2c_get_bus(&soc->i2c, 5),
|
||||
"pca9546", 0x70);
|
||||
aspeed_eeprom_init(pca954x_i2c_get_bus(i2c_mux, 0), 0x50, 64 * KiB);
|
||||
aspeed_eeprom_init(pca954x_i2c_get_bus(i2c_mux, 1), 0x51, 64 * KiB);
|
||||
at24c_eeprom_init(pca954x_i2c_get_bus(i2c_mux, 0), 0x50, 64 * KiB);
|
||||
at24c_eeprom_init(pca954x_i2c_get_bus(i2c_mux, 1), 0x51, 64 * KiB);
|
||||
|
||||
i2c_slave_create_simple(aspeed_i2c_get_bus(&soc->i2c, 6), TYPE_TMP105,
|
||||
0x48);
|
||||
@@ -746,10 +740,10 @@ static void rainier_bmc_i2c_init(AspeedMachineState *bmc)
|
||||
0x4b);
|
||||
i2c_mux = i2c_slave_create_simple(aspeed_i2c_get_bus(&soc->i2c, 6),
|
||||
"pca9546", 0x70);
|
||||
aspeed_eeprom_init(pca954x_i2c_get_bus(i2c_mux, 0), 0x50, 64 * KiB);
|
||||
aspeed_eeprom_init(pca954x_i2c_get_bus(i2c_mux, 1), 0x51, 64 * KiB);
|
||||
aspeed_eeprom_init(pca954x_i2c_get_bus(i2c_mux, 2), 0x50, 64 * KiB);
|
||||
aspeed_eeprom_init(pca954x_i2c_get_bus(i2c_mux, 3), 0x51, 64 * KiB);
|
||||
at24c_eeprom_init(pca954x_i2c_get_bus(i2c_mux, 0), 0x50, 64 * KiB);
|
||||
at24c_eeprom_init(pca954x_i2c_get_bus(i2c_mux, 1), 0x51, 64 * KiB);
|
||||
at24c_eeprom_init(pca954x_i2c_get_bus(i2c_mux, 2), 0x50, 64 * KiB);
|
||||
at24c_eeprom_init(pca954x_i2c_get_bus(i2c_mux, 3), 0x51, 64 * KiB);
|
||||
|
||||
create_pca9552(soc, 7, 0x30);
|
||||
create_pca9552(soc, 7, 0x31);
|
||||
@@ -762,15 +756,15 @@ static void rainier_bmc_i2c_init(AspeedMachineState *bmc)
|
||||
i2c_slave_create_simple(aspeed_i2c_get_bus(&soc->i2c, 7), TYPE_TMP105,
|
||||
0x48);
|
||||
i2c_slave_create_simple(aspeed_i2c_get_bus(&soc->i2c, 7), "max31785", 0x52);
|
||||
aspeed_eeprom_init(aspeed_i2c_get_bus(&soc->i2c, 7), 0x50, 64 * KiB);
|
||||
aspeed_eeprom_init(aspeed_i2c_get_bus(&soc->i2c, 7), 0x51, 64 * KiB);
|
||||
at24c_eeprom_init(aspeed_i2c_get_bus(&soc->i2c, 7), 0x50, 64 * KiB);
|
||||
at24c_eeprom_init(aspeed_i2c_get_bus(&soc->i2c, 7), 0x51, 64 * KiB);
|
||||
|
||||
i2c_slave_create_simple(aspeed_i2c_get_bus(&soc->i2c, 8), TYPE_TMP105,
|
||||
0x48);
|
||||
i2c_slave_create_simple(aspeed_i2c_get_bus(&soc->i2c, 8), TYPE_TMP105,
|
||||
0x4a);
|
||||
aspeed_eeprom_init(aspeed_i2c_get_bus(&soc->i2c, 8), 0x50, 64 * KiB);
|
||||
aspeed_eeprom_init(aspeed_i2c_get_bus(&soc->i2c, 8), 0x51, 64 * KiB);
|
||||
at24c_eeprom_init(aspeed_i2c_get_bus(&soc->i2c, 8), 0x50, 64 * KiB);
|
||||
at24c_eeprom_init(aspeed_i2c_get_bus(&soc->i2c, 8), 0x51, 64 * KiB);
|
||||
create_pca9552(soc, 8, 0x60);
|
||||
create_pca9552(soc, 8, 0x61);
|
||||
/* Bus 8: ucd90320@11 */
|
||||
@@ -779,11 +773,11 @@ static void rainier_bmc_i2c_init(AspeedMachineState *bmc)
|
||||
|
||||
i2c_slave_create_simple(aspeed_i2c_get_bus(&soc->i2c, 9), "tmp423", 0x4c);
|
||||
i2c_slave_create_simple(aspeed_i2c_get_bus(&soc->i2c, 9), "tmp423", 0x4d);
|
||||
aspeed_eeprom_init(aspeed_i2c_get_bus(&soc->i2c, 9), 0x50, 128 * KiB);
|
||||
at24c_eeprom_init(aspeed_i2c_get_bus(&soc->i2c, 9), 0x50, 128 * KiB);
|
||||
|
||||
i2c_slave_create_simple(aspeed_i2c_get_bus(&soc->i2c, 10), "tmp423", 0x4c);
|
||||
i2c_slave_create_simple(aspeed_i2c_get_bus(&soc->i2c, 10), "tmp423", 0x4d);
|
||||
aspeed_eeprom_init(aspeed_i2c_get_bus(&soc->i2c, 10), 0x50, 128 * KiB);
|
||||
at24c_eeprom_init(aspeed_i2c_get_bus(&soc->i2c, 10), 0x50, 128 * KiB);
|
||||
|
||||
i2c_slave_create_simple(aspeed_i2c_get_bus(&soc->i2c, 11), TYPE_TMP105,
|
||||
0x48);
|
||||
@@ -791,18 +785,18 @@ static void rainier_bmc_i2c_init(AspeedMachineState *bmc)
|
||||
0x49);
|
||||
i2c_mux = i2c_slave_create_simple(aspeed_i2c_get_bus(&soc->i2c, 11),
|
||||
"pca9546", 0x70);
|
||||
aspeed_eeprom_init(pca954x_i2c_get_bus(i2c_mux, 0), 0x50, 64 * KiB);
|
||||
aspeed_eeprom_init(pca954x_i2c_get_bus(i2c_mux, 1), 0x51, 64 * KiB);
|
||||
at24c_eeprom_init(pca954x_i2c_get_bus(i2c_mux, 0), 0x50, 64 * KiB);
|
||||
at24c_eeprom_init(pca954x_i2c_get_bus(i2c_mux, 1), 0x51, 64 * KiB);
|
||||
create_pca9552(soc, 11, 0x60);
|
||||
|
||||
|
||||
aspeed_eeprom_init(aspeed_i2c_get_bus(&soc->i2c, 13), 0x50, 64 * KiB);
|
||||
at24c_eeprom_init(aspeed_i2c_get_bus(&soc->i2c, 13), 0x50, 64 * KiB);
|
||||
create_pca9552(soc, 13, 0x60);
|
||||
|
||||
aspeed_eeprom_init(aspeed_i2c_get_bus(&soc->i2c, 14), 0x50, 64 * KiB);
|
||||
at24c_eeprom_init(aspeed_i2c_get_bus(&soc->i2c, 14), 0x50, 64 * KiB);
|
||||
create_pca9552(soc, 14, 0x60);
|
||||
|
||||
aspeed_eeprom_init(aspeed_i2c_get_bus(&soc->i2c, 15), 0x50, 64 * KiB);
|
||||
at24c_eeprom_init(aspeed_i2c_get_bus(&soc->i2c, 15), 0x50, 64 * KiB);
|
||||
create_pca9552(soc, 15, 0x60);
|
||||
}
|
||||
|
||||
@@ -846,45 +840,45 @@ static void fuji_bmc_i2c_init(AspeedMachineState *bmc)
|
||||
i2c_slave_create_simple(i2c[17], TYPE_LM75, 0x4c);
|
||||
i2c_slave_create_simple(i2c[17], TYPE_LM75, 0x4d);
|
||||
|
||||
aspeed_eeprom_init(i2c[19], 0x52, 64 * KiB);
|
||||
aspeed_eeprom_init(i2c[20], 0x50, 2 * KiB);
|
||||
aspeed_eeprom_init(i2c[22], 0x52, 2 * KiB);
|
||||
at24c_eeprom_init(i2c[19], 0x52, 64 * KiB);
|
||||
at24c_eeprom_init(i2c[20], 0x50, 2 * KiB);
|
||||
at24c_eeprom_init(i2c[22], 0x52, 2 * KiB);
|
||||
|
||||
i2c_slave_create_simple(i2c[3], TYPE_LM75, 0x48);
|
||||
i2c_slave_create_simple(i2c[3], TYPE_LM75, 0x49);
|
||||
i2c_slave_create_simple(i2c[3], TYPE_LM75, 0x4a);
|
||||
i2c_slave_create_simple(i2c[3], TYPE_TMP422, 0x4c);
|
||||
|
||||
aspeed_eeprom_init(i2c[8], 0x51, 64 * KiB);
|
||||
at24c_eeprom_init(i2c[8], 0x51, 64 * KiB);
|
||||
i2c_slave_create_simple(i2c[8], TYPE_LM75, 0x4a);
|
||||
|
||||
i2c_slave_create_simple(i2c[50], TYPE_LM75, 0x4c);
|
||||
aspeed_eeprom_init(i2c[50], 0x52, 64 * KiB);
|
||||
at24c_eeprom_init(i2c[50], 0x52, 64 * KiB);
|
||||
i2c_slave_create_simple(i2c[51], TYPE_TMP75, 0x48);
|
||||
i2c_slave_create_simple(i2c[52], TYPE_TMP75, 0x49);
|
||||
|
||||
i2c_slave_create_simple(i2c[59], TYPE_TMP75, 0x48);
|
||||
i2c_slave_create_simple(i2c[60], TYPE_TMP75, 0x49);
|
||||
|
||||
aspeed_eeprom_init(i2c[65], 0x53, 64 * KiB);
|
||||
at24c_eeprom_init(i2c[65], 0x53, 64 * KiB);
|
||||
i2c_slave_create_simple(i2c[66], TYPE_TMP75, 0x49);
|
||||
i2c_slave_create_simple(i2c[66], TYPE_TMP75, 0x48);
|
||||
aspeed_eeprom_init(i2c[68], 0x52, 64 * KiB);
|
||||
aspeed_eeprom_init(i2c[69], 0x52, 64 * KiB);
|
||||
aspeed_eeprom_init(i2c[70], 0x52, 64 * KiB);
|
||||
aspeed_eeprom_init(i2c[71], 0x52, 64 * KiB);
|
||||
at24c_eeprom_init(i2c[68], 0x52, 64 * KiB);
|
||||
at24c_eeprom_init(i2c[69], 0x52, 64 * KiB);
|
||||
at24c_eeprom_init(i2c[70], 0x52, 64 * KiB);
|
||||
at24c_eeprom_init(i2c[71], 0x52, 64 * KiB);
|
||||
|
||||
aspeed_eeprom_init(i2c[73], 0x53, 64 * KiB);
|
||||
at24c_eeprom_init(i2c[73], 0x53, 64 * KiB);
|
||||
i2c_slave_create_simple(i2c[74], TYPE_TMP75, 0x49);
|
||||
i2c_slave_create_simple(i2c[74], TYPE_TMP75, 0x48);
|
||||
aspeed_eeprom_init(i2c[76], 0x52, 64 * KiB);
|
||||
aspeed_eeprom_init(i2c[77], 0x52, 64 * KiB);
|
||||
aspeed_eeprom_init(i2c[78], 0x52, 64 * KiB);
|
||||
aspeed_eeprom_init(i2c[79], 0x52, 64 * KiB);
|
||||
aspeed_eeprom_init(i2c[28], 0x50, 2 * KiB);
|
||||
at24c_eeprom_init(i2c[76], 0x52, 64 * KiB);
|
||||
at24c_eeprom_init(i2c[77], 0x52, 64 * KiB);
|
||||
at24c_eeprom_init(i2c[78], 0x52, 64 * KiB);
|
||||
at24c_eeprom_init(i2c[79], 0x52, 64 * KiB);
|
||||
at24c_eeprom_init(i2c[28], 0x50, 2 * KiB);
|
||||
|
||||
for (int i = 0; i < 8; i++) {
|
||||
aspeed_eeprom_init(i2c[81 + i * 8], 0x56, 64 * KiB);
|
||||
at24c_eeprom_init(i2c[81 + i * 8], 0x56, 64 * KiB);
|
||||
i2c_slave_create_simple(i2c[82 + i * 8], TYPE_TMP75, 0x48);
|
||||
i2c_slave_create_simple(i2c[83 + i * 8], TYPE_TMP75, 0x4b);
|
||||
i2c_slave_create_simple(i2c[84 + i * 8], TYPE_TMP75, 0x4a);
|
||||
@@ -955,11 +949,14 @@ static void fby35_i2c_init(AspeedMachineState *bmc)
|
||||
i2c_slave_create_simple(i2c[12], TYPE_LM75, 0x4e);
|
||||
i2c_slave_create_simple(i2c[12], TYPE_LM75, 0x4f);
|
||||
|
||||
aspeed_eeprom_init(i2c[4], 0x51, 128 * KiB);
|
||||
aspeed_eeprom_init(i2c[6], 0x51, 128 * KiB);
|
||||
aspeed_eeprom_init(i2c[8], 0x50, 32 * KiB);
|
||||
aspeed_eeprom_init(i2c[11], 0x51, 128 * KiB);
|
||||
aspeed_eeprom_init(i2c[11], 0x54, 128 * KiB);
|
||||
at24c_eeprom_init(i2c[4], 0x51, 128 * KiB);
|
||||
at24c_eeprom_init(i2c[6], 0x51, 128 * KiB);
|
||||
at24c_eeprom_init_rom(i2c[8], 0x50, 32 * KiB, fby35_nic_fruid,
|
||||
fby35_nic_fruid_len);
|
||||
at24c_eeprom_init_rom(i2c[11], 0x51, 128 * KiB, fby35_bb_fruid,
|
||||
fby35_bb_fruid_len);
|
||||
at24c_eeprom_init_rom(i2c[11], 0x54, 128 * KiB, fby35_bmc_fruid,
|
||||
fby35_bmc_fruid_len);
|
||||
|
||||
/*
|
||||
* TODO: There is a multi-master i2c connection to an AST1030 MiniBMC on
|
||||
@@ -1141,6 +1138,25 @@ static void aspeed_machine_supermicrox11_bmc_class_init(ObjectClass *oc,
|
||||
mc->default_ram_size = 256 * MiB;
|
||||
}
|
||||
|
||||
static void aspeed_machine_supermicro_x11spi_bmc_class_init(ObjectClass *oc,
|
||||
void *data)
|
||||
{
|
||||
MachineClass *mc = MACHINE_CLASS(oc);
|
||||
AspeedMachineClass *amc = ASPEED_MACHINE_CLASS(oc);
|
||||
|
||||
mc->desc = "Supermicro X11 SPI BMC (ARM1176)";
|
||||
amc->soc_name = "ast2500-a1";
|
||||
amc->hw_strap1 = SUPERMICRO_X11SPI_BMC_HW_STRAP1;
|
||||
amc->fmc_model = "mx25l25635e";
|
||||
amc->spi_model = "mx25l25635e";
|
||||
amc->num_cs = 1;
|
||||
amc->macs_mask = ASPEED_MAC0_ON | ASPEED_MAC1_ON;
|
||||
amc->i2c_init = palmetto_bmc_i2c_init;
|
||||
mc->default_ram_size = 512 * MiB;
|
||||
mc->default_cpus = mc->min_cpus = mc->max_cpus =
|
||||
aspeed_soc_num_cpus(amc->soc_name);
|
||||
}
|
||||
|
||||
static void aspeed_machine_ast2500_evb_class_init(ObjectClass *oc, void *data)
|
||||
{
|
||||
MachineClass *mc = MACHINE_CLASS(oc);
|
||||
@@ -1522,6 +1538,10 @@ static const TypeInfo aspeed_machine_types[] = {
|
||||
.name = MACHINE_TYPE_NAME("supermicrox11-bmc"),
|
||||
.parent = TYPE_ASPEED_MACHINE,
|
||||
.class_init = aspeed_machine_supermicrox11_bmc_class_init,
|
||||
}, {
|
||||
.name = MACHINE_TYPE_NAME("supermicro-x11spi-bmc"),
|
||||
.parent = TYPE_ASPEED_MACHINE,
|
||||
.class_init = aspeed_machine_supermicro_x11spi_bmc_class_init,
|
||||
}, {
|
||||
.name = MACHINE_TYPE_NAME("ast2500-evb"),
|
||||
.parent = TYPE_ASPEED_MACHINE,
|
||||
|
||||
@@ -21,16 +21,22 @@
|
||||
|
||||
static const hwaddr aspeed_soc_ast1030_memmap[] = {
|
||||
[ASPEED_DEV_SRAM] = 0x00000000,
|
||||
[ASPEED_DEV_SBC] = 0x79000000,
|
||||
[ASPEED_DEV_SECSRAM] = 0x79000000,
|
||||
[ASPEED_DEV_IOMEM] = 0x7E600000,
|
||||
[ASPEED_DEV_PWM] = 0x7E610000,
|
||||
[ASPEED_DEV_FMC] = 0x7E620000,
|
||||
[ASPEED_DEV_SPI1] = 0x7E630000,
|
||||
[ASPEED_DEV_SPI2] = 0x7E640000,
|
||||
[ASPEED_DEV_UDC] = 0x7E6A2000,
|
||||
[ASPEED_DEV_HACE] = 0x7E6D0000,
|
||||
[ASPEED_DEV_SCU] = 0x7E6E2000,
|
||||
[ASPEED_DEV_JTAG0] = 0x7E6E4000,
|
||||
[ASPEED_DEV_JTAG1] = 0x7E6E4100,
|
||||
[ASPEED_DEV_ADC] = 0x7E6E9000,
|
||||
[ASPEED_DEV_ESPI] = 0x7E6EE000,
|
||||
[ASPEED_DEV_SBC] = 0x7E6F2000,
|
||||
[ASPEED_DEV_GPIO] = 0x7E780000,
|
||||
[ASPEED_DEV_SGPIOM] = 0x7E780500,
|
||||
[ASPEED_DEV_TIMER1] = 0x7E782000,
|
||||
[ASPEED_DEV_UART1] = 0x7E783000,
|
||||
[ASPEED_DEV_UART2] = 0x7E78D000,
|
||||
@@ -48,6 +54,7 @@ static const hwaddr aspeed_soc_ast1030_memmap[] = {
|
||||
[ASPEED_DEV_WDT] = 0x7E785000,
|
||||
[ASPEED_DEV_LPC] = 0x7E789000,
|
||||
[ASPEED_DEV_PECI] = 0x7E78B000,
|
||||
[ASPEED_DEV_I3C] = 0x7E7A0000,
|
||||
[ASPEED_DEV_I2C] = 0x7E7B0000,
|
||||
};
|
||||
|
||||
@@ -78,12 +85,18 @@ static const int aspeed_soc_ast1030_irqmap[] = {
|
||||
[ASPEED_DEV_LPC] = 35,
|
||||
[ASPEED_DEV_PECI] = 38,
|
||||
[ASPEED_DEV_FMC] = 39,
|
||||
[ASPEED_DEV_ESPI] = 42,
|
||||
[ASPEED_DEV_PWM] = 44,
|
||||
[ASPEED_DEV_ADC] = 46,
|
||||
[ASPEED_DEV_SPI1] = 65,
|
||||
[ASPEED_DEV_SPI2] = 66,
|
||||
[ASPEED_DEV_I3C] = 102, /* 102 -> 105 */
|
||||
[ASPEED_DEV_I2C] = 110, /* 110 ~ 123 */
|
||||
[ASPEED_DEV_KCS] = 138, /* 138 -> 142 */
|
||||
[ASPEED_DEV_UDC] = 9,
|
||||
[ASPEED_DEV_SGPIOM] = 51,
|
||||
[ASPEED_DEV_JTAG0] = 27,
|
||||
[ASPEED_DEV_JTAG1] = 53,
|
||||
};
|
||||
|
||||
static qemu_irq aspeed_soc_ast1030_get_irq(AspeedSoCState *s, int dev)
|
||||
@@ -119,6 +132,8 @@ static void aspeed_soc_ast1030_init(Object *obj)
|
||||
snprintf(typename, sizeof(typename), "aspeed.i2c-%s", socname);
|
||||
object_initialize_child(obj, "i2c", &s->i2c, typename);
|
||||
|
||||
object_initialize_child(obj, "i3c", &s->i3c, TYPE_ASPEED_I3C);
|
||||
|
||||
snprintf(typename, sizeof(typename), "aspeed.timer-%s", socname);
|
||||
object_initialize_child(obj, "timerctrl", &s->timerctrl, typename);
|
||||
|
||||
@@ -151,9 +166,21 @@ static void aspeed_soc_ast1030_init(Object *obj)
|
||||
snprintf(typename, sizeof(typename), "aspeed.gpio-%s", socname);
|
||||
object_initialize_child(obj, "gpio", &s->gpio, typename);
|
||||
|
||||
snprintf(typename, sizeof(typename), "aspeed.hace-%s", socname);
|
||||
object_initialize_child(obj, "hace", &s->hace, typename);
|
||||
|
||||
object_initialize_child(obj, "iomem", &s->iomem, TYPE_UNIMPLEMENTED_DEVICE);
|
||||
object_initialize_child(obj, "sbc-unimplemented", &s->sbc_unimplemented,
|
||||
TYPE_UNIMPLEMENTED_DEVICE);
|
||||
object_initialize_child(obj, "pwm", &s->pwm, TYPE_UNIMPLEMENTED_DEVICE);
|
||||
object_initialize_child(obj, "espi", &s->espi, TYPE_UNIMPLEMENTED_DEVICE);
|
||||
object_initialize_child(obj, "udc", &s->udc, TYPE_UNIMPLEMENTED_DEVICE);
|
||||
object_initialize_child(obj, "sgpiom", &s->sgpiom,
|
||||
TYPE_UNIMPLEMENTED_DEVICE);
|
||||
object_initialize_child(obj, "jtag[0]", &s->jtag[0],
|
||||
TYPE_UNIMPLEMENTED_DEVICE);
|
||||
object_initialize_child(obj, "jtag[1]", &s->jtag[1],
|
||||
TYPE_UNIMPLEMENTED_DEVICE);
|
||||
}
|
||||
|
||||
static void aspeed_soc_ast1030_realize(DeviceState *dev_soc, Error **errp)
|
||||
@@ -198,6 +225,14 @@ static void aspeed_soc_ast1030_realize(DeviceState *dev_soc, Error **errp)
|
||||
memory_region_add_subregion(s->memory,
|
||||
sc->memmap[ASPEED_DEV_SRAM],
|
||||
&s->sram);
|
||||
memory_region_init_ram(&s->secsram, OBJECT(s), "sec.sram",
|
||||
sc->secsram_size, &err);
|
||||
if (err != NULL) {
|
||||
error_propagate(errp, err);
|
||||
return;
|
||||
}
|
||||
memory_region_add_subregion(s->memory, sc->memmap[ASPEED_DEV_SECSRAM],
|
||||
&s->secsram);
|
||||
|
||||
/* SCU */
|
||||
if (!sysbus_realize(SYS_BUS_DEVICE(&s->scu), errp)) {
|
||||
@@ -220,6 +255,18 @@ static void aspeed_soc_ast1030_realize(DeviceState *dev_soc, Error **errp)
|
||||
sysbus_connect_irq(SYS_BUS_DEVICE(&s->i2c.busses[i]), 0, irq);
|
||||
}
|
||||
|
||||
/* I3C */
|
||||
if (!sysbus_realize(SYS_BUS_DEVICE(&s->i3c), errp)) {
|
||||
return;
|
||||
}
|
||||
aspeed_mmio_map(s, SYS_BUS_DEVICE(&s->i3c), 0, sc->memmap[ASPEED_DEV_I3C]);
|
||||
for (i = 0; i < ASPEED_I3C_NR_DEVICES; i++) {
|
||||
qemu_irq irq = qdev_get_gpio_in(DEVICE(&s->armv7m),
|
||||
sc->irqmap[ASPEED_DEV_I3C] + i);
|
||||
/* The AST1030 I3C controller has one IRQ per bus. */
|
||||
sysbus_connect_irq(SYS_BUS_DEVICE(&s->i3c.devices[i]), 0, irq);
|
||||
}
|
||||
|
||||
/* PECI */
|
||||
if (!sysbus_realize(SYS_BUS_DEVICE(&s->peci), errp)) {
|
||||
return;
|
||||
@@ -315,17 +362,28 @@ static void aspeed_soc_ast1030_realize(DeviceState *dev_soc, Error **errp)
|
||||
}
|
||||
aspeed_mmio_map(s, SYS_BUS_DEVICE(&s->sbc), 0, sc->memmap[ASPEED_DEV_SBC]);
|
||||
|
||||
/* HACE */
|
||||
object_property_set_link(OBJECT(&s->hace), "dram", OBJECT(&s->sram),
|
||||
&error_abort);
|
||||
if (!sysbus_realize(SYS_BUS_DEVICE(&s->hace), errp)) {
|
||||
return;
|
||||
}
|
||||
aspeed_mmio_map(s, SYS_BUS_DEVICE(&s->hace), 0,
|
||||
sc->memmap[ASPEED_DEV_HACE]);
|
||||
sysbus_connect_irq(SYS_BUS_DEVICE(&s->hace), 0,
|
||||
aspeed_soc_get_irq(s, ASPEED_DEV_HACE));
|
||||
|
||||
/* Watch dog */
|
||||
for (i = 0; i < sc->wdts_num; i++) {
|
||||
AspeedWDTClass *awc = ASPEED_WDT_GET_CLASS(&s->wdt[i]);
|
||||
hwaddr wdt_offset = sc->memmap[ASPEED_DEV_WDT] + i * awc->iosize;
|
||||
|
||||
object_property_set_link(OBJECT(&s->wdt[i]), "scu", OBJECT(&s->scu),
|
||||
&error_abort);
|
||||
if (!sysbus_realize(SYS_BUS_DEVICE(&s->wdt[i]), errp)) {
|
||||
return;
|
||||
}
|
||||
aspeed_mmio_map(s, SYS_BUS_DEVICE(&s->wdt[i]), 0,
|
||||
sc->memmap[ASPEED_DEV_WDT] + i * awc->offset);
|
||||
aspeed_mmio_map(s, SYS_BUS_DEVICE(&s->wdt[i]), 0, wdt_offset);
|
||||
}
|
||||
|
||||
/* GPIO */
|
||||
@@ -336,6 +394,22 @@ static void aspeed_soc_ast1030_realize(DeviceState *dev_soc, Error **errp)
|
||||
sc->memmap[ASPEED_DEV_GPIO]);
|
||||
sysbus_connect_irq(SYS_BUS_DEVICE(&s->gpio), 0,
|
||||
aspeed_soc_get_irq(s, ASPEED_DEV_GPIO));
|
||||
|
||||
aspeed_mmio_map_unimplemented(s, SYS_BUS_DEVICE(&s->pwm), "aspeed.pwm",
|
||||
sc->memmap[ASPEED_DEV_PWM], 0x100);
|
||||
|
||||
aspeed_mmio_map_unimplemented(s, SYS_BUS_DEVICE(&s->espi), "aspeed.espi",
|
||||
sc->memmap[ASPEED_DEV_ESPI], 0x800);
|
||||
|
||||
aspeed_mmio_map_unimplemented(s, SYS_BUS_DEVICE(&s->udc), "aspeed.udc",
|
||||
sc->memmap[ASPEED_DEV_UDC], 0x1000);
|
||||
aspeed_mmio_map_unimplemented(s, SYS_BUS_DEVICE(&s->sgpiom), "aspeed.sgpiom",
|
||||
sc->memmap[ASPEED_DEV_SGPIOM], 0x100);
|
||||
|
||||
aspeed_mmio_map_unimplemented(s, SYS_BUS_DEVICE(&s->jtag[0]), "aspeed.jtag",
|
||||
sc->memmap[ASPEED_DEV_JTAG0], 0x20);
|
||||
aspeed_mmio_map_unimplemented(s, SYS_BUS_DEVICE(&s->jtag[1]), "aspeed.jtag",
|
||||
sc->memmap[ASPEED_DEV_JTAG1], 0x20);
|
||||
}
|
||||
|
||||
static void aspeed_soc_ast1030_class_init(ObjectClass *klass, void *data)
|
||||
@@ -346,9 +420,10 @@ static void aspeed_soc_ast1030_class_init(ObjectClass *klass, void *data)
|
||||
dc->realize = aspeed_soc_ast1030_realize;
|
||||
|
||||
sc->name = "ast1030-a1";
|
||||
sc->cpu_type = ARM_CPU_TYPE_NAME("cortex-m4");
|
||||
sc->cpu_type = ARM_CPU_TYPE_NAME("cortex-m4"); /* TODO cortex-m4f */
|
||||
sc->silicon_rev = AST1030_A1_SILICON_REV;
|
||||
sc->sram_size = 0xc0000;
|
||||
sc->secsram_size = 0x40000; /* 256 * KiB */
|
||||
sc->spis_num = 2;
|
||||
sc->ehcis_num = 0;
|
||||
sc->wdts_num = 4;
|
||||
|
||||
@@ -465,14 +465,14 @@ static void aspeed_soc_ast2600_realize(DeviceState *dev, Error **errp)
|
||||
/* Watch dog */
|
||||
for (i = 0; i < sc->wdts_num; i++) {
|
||||
AspeedWDTClass *awc = ASPEED_WDT_GET_CLASS(&s->wdt[i]);
|
||||
hwaddr wdt_offset = sc->memmap[ASPEED_DEV_WDT] + i * awc->iosize;
|
||||
|
||||
object_property_set_link(OBJECT(&s->wdt[i]), "scu", OBJECT(&s->scu),
|
||||
&error_abort);
|
||||
if (!sysbus_realize(SYS_BUS_DEVICE(&s->wdt[i]), errp)) {
|
||||
return;
|
||||
}
|
||||
aspeed_mmio_map(s, SYS_BUS_DEVICE(&s->wdt[i]), 0,
|
||||
sc->memmap[ASPEED_DEV_WDT] + i * awc->offset);
|
||||
aspeed_mmio_map(s, SYS_BUS_DEVICE(&s->wdt[i]), 0, wdt_offset);
|
||||
}
|
||||
|
||||
/* RAM */
|
||||
|
||||
82
hw/arm/aspeed_eeprom.c
Normal file
82
hw/arm/aspeed_eeprom.c
Normal file
@@ -0,0 +1,82 @@
|
||||
/*
|
||||
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
||||
*
|
||||
* SPDX-License-Identifier: GPL-2.0-only
|
||||
*/
|
||||
|
||||
#include "aspeed_eeprom.h"
|
||||
|
||||
const uint8_t fby35_nic_fruid[] = {
|
||||
0x01, 0x00, 0x00, 0x01, 0x0f, 0x20, 0x00, 0xcf, 0x01, 0x0e, 0x19, 0xd7,
|
||||
0x5e, 0xcf, 0xc8, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0xdd,
|
||||
0x4d, 0x65, 0x6c, 0x6c, 0x61, 0x6e, 0x6f, 0x78, 0x20, 0x43, 0x6f, 0x6e,
|
||||
0x6e, 0x65, 0x63, 0x74, 0x58, 0x2d, 0x36, 0x20, 0x44, 0x58, 0x20, 0x4f,
|
||||
0x43, 0x50, 0x33, 0x2e, 0x30, 0xd8, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58,
|
||||
0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58,
|
||||
0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0xd5, 0x58, 0x58, 0x58, 0x58, 0x58,
|
||||
0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58,
|
||||
0x58, 0x58, 0x58, 0x58, 0xcc, 0x46, 0x52, 0x55, 0x20, 0x56, 0x65, 0x72,
|
||||
0x20, 0x30, 0x2e, 0x30, 0x32, 0xc0, 0xc0, 0xc0, 0xc1, 0x00, 0x00, 0x2f,
|
||||
0x01, 0x11, 0x19, 0xc8, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58,
|
||||
0xdd, 0x4d, 0x65, 0x6c, 0x6c, 0x61, 0x6e, 0x6f, 0x78, 0x20, 0x43, 0x6f,
|
||||
0x6e, 0x6e, 0x65, 0x63, 0x74, 0x58, 0x2d, 0x36, 0x20, 0x44, 0x58, 0x20,
|
||||
0x4f, 0x43, 0x50, 0x33, 0x2e, 0x30, 0xd5, 0x58, 0x58, 0x58, 0x58, 0x58,
|
||||
0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58,
|
||||
0x58, 0x58, 0x58, 0x58, 0xd3, 0x41, 0x39, 0x20, 0x20, 0x20, 0x20, 0x20,
|
||||
0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
|
||||
0xd8, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58,
|
||||
0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58,
|
||||
0x58, 0xc0, 0xc0, 0xc0, 0xc0, 0xcd, 0x43, 0x6f, 0x6e, 0x6e, 0x65, 0x63,
|
||||
0x74, 0x58, 0x2d, 0x36, 0x20, 0x44, 0x58, 0xc1, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0xdb, 0xc0, 0x82, 0x30, 0x15, 0x79, 0x7f, 0xa6, 0x00,
|
||||
0x01, 0x18, 0x0b, 0xff, 0x08, 0x00, 0xff, 0xff, 0x64, 0x00, 0x00, 0x00,
|
||||
0x00, 0x03, 0x20, 0x01, 0xff, 0xff, 0x04, 0x46, 0x00, 0xff, 0xff, 0xff,
|
||||
0xff, 0xff, 0xff, 0xff, 0x01, 0x81, 0x09, 0x15, 0xb3, 0x10, 0x1d, 0x00,
|
||||
0x24, 0x15, 0xb3, 0x00, 0x02, 0xeb, 0x8a, 0x95, 0x5c,
|
||||
};
|
||||
|
||||
const uint8_t fby35_bb_fruid[] = {
|
||||
0x01, 0x00, 0x01, 0x03, 0x10, 0x00, 0x00, 0xeb, 0x01, 0x02, 0x17, 0xc3,
|
||||
0x4e, 0x2f, 0x41, 0xc3, 0x4e, 0x2f, 0x41, 0xc1, 0x00, 0x00, 0x00, 0x23,
|
||||
0x01, 0x0d, 0x00, 0xb6, 0xd2, 0xd0, 0xc6, 0x58, 0x58, 0x58, 0x58, 0x58,
|
||||
0x58, 0xd5, 0x4d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x6d, 0x65, 0x6e, 0x74,
|
||||
0x20, 0x42, 0x6f, 0x61, 0x72, 0x64, 0x20, 0x77, 0x42, 0x4d, 0x43, 0xcd,
|
||||
0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58,
|
||||
0x58, 0xce, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58,
|
||||
0x58, 0x58, 0x58, 0x58, 0xc3, 0x31, 0x2e, 0x30, 0xc9, 0x58, 0x58, 0x58,
|
||||
0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0xd2, 0x58, 0x58, 0x58, 0x58, 0x58,
|
||||
0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58,
|
||||
0x58, 0xc1, 0x00, 0x00, 0x00, 0x00, 0x00, 0xa8, 0x01, 0x0c, 0x00, 0xc6,
|
||||
0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0xd2, 0x59, 0x6f, 0x73, 0x65, 0x6d,
|
||||
0x69, 0x74, 0x65, 0x20, 0x56, 0x33, 0x2e, 0x35, 0x20, 0x45, 0x56, 0x54,
|
||||
0x32, 0xce, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58,
|
||||
0x58, 0x58, 0x58, 0x58, 0xc4, 0x45, 0x56, 0x54, 0x32, 0xcd, 0x58, 0x58,
|
||||
0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0xc7,
|
||||
0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0xc3, 0x31, 0x2e, 0x30, 0xc9,
|
||||
0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0xc3, 0x4e, 0x2f,
|
||||
0x41, 0xc1, 0x00, 0x00, 0x00, 0x00, 0x00, 0x43,
|
||||
};
|
||||
|
||||
const uint8_t fby35_bmc_fruid[] = {
|
||||
0x01, 0x00, 0x00, 0x01, 0x0d, 0x00, 0x00, 0xf1, 0x01, 0x0c, 0x00, 0x36,
|
||||
0xe6, 0xd0, 0xc6, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0xd2, 0x42, 0x4d,
|
||||
0x43, 0x20, 0x53, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x20, 0x4d, 0x6f,
|
||||
0x64, 0x75, 0x6c, 0x65, 0xcd, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58,
|
||||
0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0xce, 0x58, 0x58, 0x58, 0x58, 0x58,
|
||||
0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0xc3, 0x31, 0x2e,
|
||||
0x30, 0xc9, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0xd2,
|
||||
0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58,
|
||||
0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0xc1, 0x39, 0x01, 0x0c, 0x00, 0xc6,
|
||||
0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0xd2, 0x59, 0x6f, 0x73, 0x65, 0x6d,
|
||||
0x69, 0x74, 0x65, 0x20, 0x56, 0x33, 0x2e, 0x35, 0x20, 0x45, 0x56, 0x54,
|
||||
0x32, 0xce, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58,
|
||||
0x58, 0x58, 0x58, 0x58, 0xc4, 0x45, 0x56, 0x54, 0x32, 0xcd, 0x58, 0x58,
|
||||
0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0xc7,
|
||||
0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0xc3, 0x31, 0x2e, 0x30, 0xc9,
|
||||
0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0xc8, 0x43, 0x6f,
|
||||
0x6e, 0x66, 0x69, 0x67, 0x20, 0x41, 0xc1, 0x45,
|
||||
};
|
||||
|
||||
const size_t fby35_nic_fruid_len = sizeof(fby35_nic_fruid);
|
||||
const size_t fby35_bb_fruid_len = sizeof(fby35_bb_fruid);
|
||||
const size_t fby35_bmc_fruid_len = sizeof(fby35_bmc_fruid);
|
||||
19
hw/arm/aspeed_eeprom.h
Normal file
19
hw/arm/aspeed_eeprom.h
Normal file
@@ -0,0 +1,19 @@
|
||||
/*
|
||||
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
||||
*
|
||||
* SPDX-License-Identifier: GPL-2.0-only
|
||||
*/
|
||||
|
||||
#ifndef ASPEED_EEPROM_H
|
||||
#define ASPEED_EEPROM_H
|
||||
|
||||
#include "qemu/osdep.h"
|
||||
|
||||
extern const uint8_t fby35_nic_fruid[];
|
||||
extern const uint8_t fby35_bb_fruid[];
|
||||
extern const uint8_t fby35_bmc_fruid[];
|
||||
extern const size_t fby35_nic_fruid_len;
|
||||
extern const size_t fby35_bb_fruid_len;
|
||||
extern const size_t fby35_bmc_fruid_len;
|
||||
|
||||
#endif
|
||||
@@ -386,14 +386,14 @@ static void aspeed_soc_realize(DeviceState *dev, Error **errp)
|
||||
/* Watch dog */
|
||||
for (i = 0; i < sc->wdts_num; i++) {
|
||||
AspeedWDTClass *awc = ASPEED_WDT_GET_CLASS(&s->wdt[i]);
|
||||
hwaddr wdt_offset = sc->memmap[ASPEED_DEV_WDT] + i * awc->iosize;
|
||||
|
||||
object_property_set_link(OBJECT(&s->wdt[i]), "scu", OBJECT(&s->scu),
|
||||
&error_abort);
|
||||
if (!sysbus_realize(SYS_BUS_DEVICE(&s->wdt[i]), errp)) {
|
||||
return;
|
||||
}
|
||||
aspeed_mmio_map(s, SYS_BUS_DEVICE(&s->wdt[i]), 0,
|
||||
sc->memmap[ASPEED_DEV_WDT] + i * awc->offset);
|
||||
aspeed_mmio_map(s, SYS_BUS_DEVICE(&s->wdt[i]), 0, wdt_offset);
|
||||
}
|
||||
|
||||
/* RAM */
|
||||
|
||||
@@ -51,6 +51,7 @@ arm_ss.add(when: 'CONFIG_ASPEED_SOC', if_true: files(
|
||||
'aspeed.c',
|
||||
'aspeed_ast2600.c',
|
||||
'aspeed_ast10x0.c',
|
||||
'aspeed_eeprom.c',
|
||||
'fby35.c'))
|
||||
arm_ss.add(when: 'CONFIG_MPS2', if_true: files('mps2.c'))
|
||||
arm_ss.add(when: 'CONFIG_MPS2', if_true: files('mps2-tz.c'))
|
||||
|
||||
@@ -1,6 +1,9 @@
|
||||
/*
|
||||
* SmartFusion2 SOM starter kit(from Emcraft) emulation.
|
||||
*
|
||||
* M2S-FG484 SOM hardware architecture specification:
|
||||
* https://www.emcraft.com/jdownloads/som/m2s/m2s-som-ha.pdf
|
||||
*
|
||||
* Copyright (c) 2017 Subbaraya Sundeep <sundeep.lkml@gmail.com>
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
@@ -87,7 +90,7 @@ static void emcraft_sf2_s2s010_init(MachineState *machine)
|
||||
|
||||
/* Attach SPI flash to SPI0 controller */
|
||||
spi_bus = qdev_get_child_bus(dev, "spi0");
|
||||
spi_flash = qdev_new("s25sl12801");
|
||||
spi_flash = qdev_new("s25sl12801"); /* Spansion S25FL128SDPBHICO */
|
||||
qdev_prop_set_uint8(spi_flash, "spansion-cr2nv", 1);
|
||||
if (dinfo) {
|
||||
qdev_prop_set_drive_err(spi_flash, "drive",
|
||||
|
||||
@@ -21,6 +21,7 @@
|
||||
#include "hw/i2c/i2c_mux_pca954x.h"
|
||||
#include "hw/i2c/smbus_eeprom.h"
|
||||
#include "hw/loader.h"
|
||||
#include "hw/nvram/eeprom_at24c.h"
|
||||
#include "hw/qdev-core.h"
|
||||
#include "hw/qdev-properties.h"
|
||||
#include "qapi/error.h"
|
||||
@@ -140,17 +141,6 @@ static I2CBus *npcm7xx_i2c_get_bus(NPCM7xxState *soc, uint32_t num)
|
||||
return I2C_BUS(qdev_get_child_bus(DEVICE(&soc->smbus[num]), "i2c-bus"));
|
||||
}
|
||||
|
||||
static void at24c_eeprom_init(NPCM7xxState *soc, int bus, uint8_t addr,
|
||||
uint32_t rsize)
|
||||
{
|
||||
I2CBus *i2c_bus = npcm7xx_i2c_get_bus(soc, bus);
|
||||
I2CSlave *i2c_dev = i2c_slave_new("at24c-eeprom", addr);
|
||||
DeviceState *dev = DEVICE(i2c_dev);
|
||||
|
||||
qdev_prop_set_uint32(dev, "rom-size", rsize);
|
||||
i2c_slave_realize_and_unref(i2c_dev, i2c_bus, &error_abort);
|
||||
}
|
||||
|
||||
static void npcm7xx_init_pwm_splitter(NPCM7xxMachine *machine,
|
||||
NPCM7xxState *soc, const int *fan_counts)
|
||||
{
|
||||
@@ -253,8 +243,8 @@ static void quanta_gsj_i2c_init(NPCM7xxState *soc)
|
||||
i2c_slave_create_simple(npcm7xx_i2c_get_bus(soc, 3), "tmp105", 0x5c);
|
||||
i2c_slave_create_simple(npcm7xx_i2c_get_bus(soc, 4), "tmp105", 0x5c);
|
||||
|
||||
at24c_eeprom_init(soc, 9, 0x55, 8192);
|
||||
at24c_eeprom_init(soc, 10, 0x55, 8192);
|
||||
at24c_eeprom_init(npcm7xx_i2c_get_bus(soc, 9), 0x55, 8192);
|
||||
at24c_eeprom_init(npcm7xx_i2c_get_bus(soc, 10), 0x55, 8192);
|
||||
|
||||
/*
|
||||
* i2c-11:
|
||||
@@ -360,7 +350,7 @@ static void kudo_bmc_i2c_init(NPCM7xxState *soc)
|
||||
|
||||
i2c_slave_create_simple(npcm7xx_i2c_get_bus(soc, 4), TYPE_PCA9548, 0x77);
|
||||
|
||||
at24c_eeprom_init(soc, 4, 0x50, 8192); /* mbfru */
|
||||
at24c_eeprom_init(npcm7xx_i2c_get_bus(soc, 4), 0x50, 8192); /* mbfru */
|
||||
|
||||
i2c_mux = i2c_slave_create_simple(npcm7xx_i2c_get_bus(soc, 13),
|
||||
TYPE_PCA9548, 0x77);
|
||||
@@ -371,7 +361,7 @@ static void kudo_bmc_i2c_init(NPCM7xxState *soc)
|
||||
i2c_slave_create_simple(pca954x_i2c_get_bus(i2c_mux, 4), "tmp105", 0x48);
|
||||
i2c_slave_create_simple(pca954x_i2c_get_bus(i2c_mux, 5), "tmp105", 0x49);
|
||||
|
||||
at24c_eeprom_init(soc, 14, 0x55, 8192); /* bmcfru */
|
||||
at24c_eeprom_init(npcm7xx_i2c_get_bus(soc, 14), 0x55, 8192); /* bmcfru */
|
||||
|
||||
/* TODO: Add remaining i2c devices. */
|
||||
}
|
||||
|
||||
@@ -33,7 +33,6 @@
|
||||
#include "qemu/units.h"
|
||||
#include "qemu/option.h"
|
||||
#include "monitor/qdev.h"
|
||||
#include "qapi/error.h"
|
||||
#include "hw/sysbus.h"
|
||||
#include "hw/arm/boot.h"
|
||||
#include "hw/arm/primecell.h"
|
||||
|
||||
@@ -22,7 +22,6 @@
|
||||
#include "hw/misc/unimp.h"
|
||||
#include "hw/arm/xlnx-versal.h"
|
||||
#include "qemu/log.h"
|
||||
#include "hw/sysbus.h"
|
||||
|
||||
#define XLNX_VERSAL_ACPU_TYPE ARM_CPU_TYPE_NAME("cortex-a72")
|
||||
#define XLNX_VERSAL_RCPU_TYPE ARM_CPU_TYPE_NAME("cortex-r5f")
|
||||
|
||||
@@ -221,7 +221,8 @@ static const FlashPartInfo known_devices[] = {
|
||||
{ INFO("is25wp032", 0x9d7016, 0, 64 << 10, 64, ER_4K) },
|
||||
{ INFO("is25wp064", 0x9d7017, 0, 64 << 10, 128, ER_4K) },
|
||||
{ INFO("is25wp128", 0x9d7018, 0, 64 << 10, 256, ER_4K) },
|
||||
{ INFO("is25wp256", 0x9d7019, 0, 64 << 10, 512, ER_4K) },
|
||||
{ INFO("is25wp256", 0x9d7019, 0, 64 << 10, 512, ER_4K),
|
||||
.sfdp_read = m25p80_sfdp_is25wp256 },
|
||||
|
||||
/* Macronix */
|
||||
{ INFO("mx25l2005a", 0xc22012, 0, 64 << 10, 4, ER_4K) },
|
||||
|
||||
@@ -330,3 +330,43 @@ static const uint8_t sfdp_w25q01jvq[] = {
|
||||
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
|
||||
};
|
||||
define_sfdp_read(w25q01jvq);
|
||||
|
||||
/*
|
||||
* Integrated Silicon Solution (ISSI)
|
||||
*/
|
||||
|
||||
static const uint8_t sfdp_is25wp256[] = {
|
||||
0x53, 0x46, 0x44, 0x50, 0x06, 0x01, 0x01, 0xff,
|
||||
0x00, 0x06, 0x01, 0x10, 0x30, 0x00, 0x00, 0xff,
|
||||
0x9d, 0x05, 0x01, 0x03, 0x80, 0x00, 0x00, 0x02,
|
||||
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
|
||||
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
|
||||
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
|
||||
0xe5, 0x20, 0xf9, 0xff, 0xff, 0xff, 0xff, 0x0f,
|
||||
0x44, 0xeb, 0x08, 0x6b, 0x08, 0x3b, 0x80, 0xbb,
|
||||
0xfe, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0xff,
|
||||
0xff, 0xff, 0x44, 0xeb, 0x0c, 0x20, 0x0f, 0x52,
|
||||
0x10, 0xd8, 0x00, 0xff, 0x23, 0x4a, 0xc9, 0x00,
|
||||
0x82, 0xd8, 0x11, 0xce, 0xcc, 0xcd, 0x68, 0x46,
|
||||
0x7a, 0x75, 0x7a, 0x75, 0xf7, 0xae, 0xd5, 0x5c,
|
||||
0x4a, 0x42, 0x2c, 0xff, 0xf0, 0x30, 0xfa, 0xa9,
|
||||
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
|
||||
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
|
||||
0x50, 0x19, 0x50, 0x16, 0x9f, 0xf9, 0xc0, 0x64,
|
||||
0x8f, 0xef, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
|
||||
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
|
||||
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
|
||||
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
|
||||
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
|
||||
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
|
||||
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
|
||||
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
|
||||
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
|
||||
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
|
||||
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
|
||||
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
|
||||
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
|
||||
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
|
||||
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
|
||||
};
|
||||
define_sfdp_read(is25wp256);
|
||||
|
||||
@@ -26,4 +26,6 @@ uint8_t m25p80_sfdp_w25q512jv(uint32_t addr);
|
||||
|
||||
uint8_t m25p80_sfdp_w25q01jvq(uint32_t addr);
|
||||
|
||||
uint8_t m25p80_sfdp_is25wp256(uint32_t addr);
|
||||
|
||||
#endif
|
||||
|
||||
@@ -45,7 +45,6 @@
|
||||
#include "qapi/error.h"
|
||||
#include "qemu/error-report.h"
|
||||
#include "qemu/bitops.h"
|
||||
#include "qemu/error-report.h"
|
||||
#include "qemu/host-utils.h"
|
||||
#include "qemu/log.h"
|
||||
#include "qemu/module.h"
|
||||
|
||||
@@ -894,6 +894,10 @@ static void virtio_blk_update_config(VirtIODevice *vdev, uint8_t *config)
|
||||
uint64_t capacity;
|
||||
int64_t length;
|
||||
int blk_size = conf->logical_block_size;
|
||||
AioContext *ctx;
|
||||
|
||||
ctx = blk_get_aio_context(s->blk);
|
||||
aio_context_acquire(ctx);
|
||||
|
||||
blk_get_geometry(s->blk, &capacity);
|
||||
memset(&blkcfg, 0, sizeof(blkcfg));
|
||||
@@ -917,6 +921,7 @@ static void virtio_blk_update_config(VirtIODevice *vdev, uint8_t *config)
|
||||
* per track (cylinder).
|
||||
*/
|
||||
length = blk_getlength(s->blk);
|
||||
aio_context_release(ctx);
|
||||
if (length > 0 && length / conf->heads / conf->secs % blk_size) {
|
||||
blkcfg.geometry.sectors = conf->secs & ~s->sector_mask;
|
||||
} else {
|
||||
|
||||
@@ -39,7 +39,6 @@
|
||||
#include "exec/confidential-guest-support.h"
|
||||
#include "hw/virtio/virtio.h"
|
||||
#include "hw/virtio/virtio-pci.h"
|
||||
#include "qom/object_interfaces.h"
|
||||
|
||||
GlobalProperty hw_compat_7_2[] = {
|
||||
{ "virtio-mem", "x-early-migration", "false" },
|
||||
|
||||
@@ -21,7 +21,6 @@
|
||||
#include "exec/ramblock.h"
|
||||
#include "sysemu/hostmem.h"
|
||||
#include <sys/ioctl.h>
|
||||
#include <fcntl.h>
|
||||
#include <linux/memfd.h>
|
||||
#include "qemu/memfd.h"
|
||||
#include "standard-headers/linux/udmabuf.h"
|
||||
|
||||
@@ -28,7 +28,6 @@
|
||||
#include "qapi/error.h"
|
||||
#include "net/net.h"
|
||||
#include "qemu/log.h"
|
||||
#include "net/net.h"
|
||||
|
||||
#define MIN_SEABIOS_HPPA_VERSION 6 /* require at least this fw version */
|
||||
|
||||
|
||||
@@ -5,8 +5,8 @@
|
||||
* See the COPYING file in the top-level directory.
|
||||
*/
|
||||
|
||||
#include "qemu/ctype.h"
|
||||
#include "qemu/osdep.h"
|
||||
#include "qemu/ctype.h"
|
||||
#include "qemu/error-report.h"
|
||||
#include "qemu/main-loop.h"
|
||||
#include "qemu/sockets.h"
|
||||
|
||||
@@ -8,7 +8,6 @@
|
||||
|
||||
#include "qemu/osdep.h"
|
||||
#include <math.h>
|
||||
#include <string.h>
|
||||
#include "hw/i2c/pmbus_device.h"
|
||||
#include "migration/vmstate.h"
|
||||
#include "qemu/module.h"
|
||||
|
||||
@@ -76,7 +76,6 @@
|
||||
|
||||
#include "hw/acpi/hmat.h"
|
||||
#include "hw/acpi/viot.h"
|
||||
#include "hw/acpi/cxl.h"
|
||||
|
||||
#include CONFIG_DEVICES
|
||||
|
||||
|
||||
@@ -20,7 +20,6 @@
|
||||
*/
|
||||
|
||||
#include "qemu/osdep.h"
|
||||
#include "qemu/log.h"
|
||||
#include "hw/hw.h"
|
||||
#include "audio/audio.h"
|
||||
#include "qemu/timer.h"
|
||||
|
||||
@@ -22,7 +22,6 @@
|
||||
/* Supported chipsets: */
|
||||
#include "hw/pci-host/ls7a.h"
|
||||
#include "hw/loongarch/virt.h"
|
||||
#include "hw/acpi/aml-build.h"
|
||||
|
||||
#include "hw/acpi/utils.h"
|
||||
#include "hw/acpi/pci.h"
|
||||
|
||||
@@ -193,6 +193,7 @@ static void do_hash_operation(AspeedHACEState *s, int algo, bool sg_mode,
|
||||
size_t digest_len = 0;
|
||||
int niov = 0;
|
||||
int i;
|
||||
void *haddr;
|
||||
|
||||
if (sg_mode) {
|
||||
uint32_t len = 0;
|
||||
@@ -217,9 +218,13 @@ static void do_hash_operation(AspeedHACEState *s, int algo, bool sg_mode,
|
||||
addr &= SG_LIST_ADDR_MASK;
|
||||
|
||||
plen = len & SG_LIST_LEN_MASK;
|
||||
iov[i].iov_base = address_space_map(&s->dram_as, addr, &plen, false,
|
||||
MEMTXATTRS_UNSPECIFIED);
|
||||
|
||||
haddr = address_space_map(&s->dram_as, addr, &plen, false,
|
||||
MEMTXATTRS_UNSPECIFIED);
|
||||
if (haddr == NULL) {
|
||||
qemu_log_mask(LOG_GUEST_ERROR, "%s: qcrypto failed\n", __func__);
|
||||
return;
|
||||
}
|
||||
iov[i].iov_base = haddr;
|
||||
if (acc_mode) {
|
||||
niov = gen_acc_mode_iov(s, iov, i, &plen);
|
||||
|
||||
@@ -230,10 +235,14 @@ static void do_hash_operation(AspeedHACEState *s, int algo, bool sg_mode,
|
||||
} else {
|
||||
hwaddr len = s->regs[R_HASH_SRC_LEN];
|
||||
|
||||
haddr = address_space_map(&s->dram_as, s->regs[R_HASH_SRC],
|
||||
&len, false, MEMTXATTRS_UNSPECIFIED);
|
||||
if (haddr == NULL) {
|
||||
qemu_log_mask(LOG_GUEST_ERROR, "%s: qcrypto failed\n", __func__);
|
||||
return;
|
||||
}
|
||||
iov[0].iov_base = haddr;
|
||||
iov[0].iov_len = len;
|
||||
iov[0].iov_base = address_space_map(&s->dram_as, s->regs[R_HASH_SRC],
|
||||
&len, false,
|
||||
MEMTXATTRS_UNSPECIFIED);
|
||||
i = 1;
|
||||
|
||||
if (s->iov_count) {
|
||||
|
||||
@@ -12,7 +12,6 @@
|
||||
#include "qemu/module.h"
|
||||
#include "qemu/error-report.h"
|
||||
#include "hw/misc/aspeed_sdmc.h"
|
||||
#include "hw/misc/aspeed_scu.h"
|
||||
#include "hw/qdev-properties.h"
|
||||
#include "migration/vmstate.h"
|
||||
#include "qapi/error.h"
|
||||
|
||||
@@ -27,10 +27,7 @@
|
||||
#include "hw/irq.h"
|
||||
#include "hw/qdev-properties.h"
|
||||
#include "migration/vmstate.h"
|
||||
#include "hw/input/adb.h"
|
||||
#include "hw/misc/mos6522.h"
|
||||
#include "hw/misc/macio/cuda.h"
|
||||
#include "qapi/error.h"
|
||||
#include "qemu/timer.h"
|
||||
#include "sysemu/runstate.h"
|
||||
#include "sysemu/rtc.h"
|
||||
|
||||
@@ -53,10 +53,8 @@
|
||||
*/
|
||||
static void macio_escc_legacy_setup(MacIOState *s)
|
||||
{
|
||||
ESCCState *escc = ESCC(&s->escc);
|
||||
SysBusDevice *sbd = SYS_BUS_DEVICE(escc);
|
||||
SysBusDevice *sbd = SYS_BUS_DEVICE(&s->escc);
|
||||
MemoryRegion *escc_legacy = g_new(MemoryRegion, 1);
|
||||
MemoryRegion *bar = &s->bar;
|
||||
int i;
|
||||
static const int maps[] = {
|
||||
0x00, 0x00, /* Command B */
|
||||
@@ -80,30 +78,29 @@ static void macio_escc_legacy_setup(MacIOState *s)
|
||||
memory_region_add_subregion(escc_legacy, maps[i], port);
|
||||
}
|
||||
|
||||
memory_region_add_subregion(bar, 0x12000, escc_legacy);
|
||||
memory_region_add_subregion(&s->bar, 0x12000, escc_legacy);
|
||||
}
|
||||
|
||||
static void macio_bar_setup(MacIOState *s)
|
||||
{
|
||||
ESCCState *escc = ESCC(&s->escc);
|
||||
SysBusDevice *sbd = SYS_BUS_DEVICE(escc);
|
||||
MemoryRegion *bar = &s->bar;
|
||||
SysBusDevice *sbd = SYS_BUS_DEVICE(&s->escc);
|
||||
MemoryRegion *bar = sysbus_mmio_get_region(sbd, 0);
|
||||
|
||||
memory_region_add_subregion(bar, 0x13000, sysbus_mmio_get_region(sbd, 0));
|
||||
memory_region_add_subregion(&s->bar, 0x13000, bar);
|
||||
macio_escc_legacy_setup(s);
|
||||
}
|
||||
|
||||
static void macio_common_realize(PCIDevice *d, Error **errp)
|
||||
static bool macio_common_realize(PCIDevice *d, Error **errp)
|
||||
{
|
||||
MacIOState *s = MACIO(d);
|
||||
SysBusDevice *sysbus_dev;
|
||||
SysBusDevice *sbd;
|
||||
|
||||
if (!qdev_realize(DEVICE(&s->dbdma), BUS(&s->macio_bus), errp)) {
|
||||
return;
|
||||
return false;
|
||||
}
|
||||
sysbus_dev = SYS_BUS_DEVICE(&s->dbdma);
|
||||
sbd = SYS_BUS_DEVICE(&s->dbdma);
|
||||
memory_region_add_subregion(&s->bar, 0x08000,
|
||||
sysbus_mmio_get_region(sysbus_dev, 0));
|
||||
sysbus_mmio_get_region(sbd, 0));
|
||||
|
||||
qdev_prop_set_uint32(DEVICE(&s->escc), "disabled", 0);
|
||||
qdev_prop_set_uint32(DEVICE(&s->escc), "frequency", ESCC_CLOCK);
|
||||
@@ -111,28 +108,29 @@ static void macio_common_realize(PCIDevice *d, Error **errp)
|
||||
qdev_prop_set_uint32(DEVICE(&s->escc), "chnBtype", escc_serial);
|
||||
qdev_prop_set_uint32(DEVICE(&s->escc), "chnAtype", escc_serial);
|
||||
if (!qdev_realize(DEVICE(&s->escc), BUS(&s->macio_bus), errp)) {
|
||||
return;
|
||||
return false;
|
||||
}
|
||||
|
||||
macio_bar_setup(s);
|
||||
pci_register_bar(d, 0, PCI_BASE_ADDRESS_SPACE_MEMORY, &s->bar);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
static void macio_realize_ide(MacIOState *s, MACIOIDEState *ide,
|
||||
static bool macio_realize_ide(MacIOState *s, MACIOIDEState *ide,
|
||||
qemu_irq irq0, qemu_irq irq1, int dmaid,
|
||||
Error **errp)
|
||||
{
|
||||
SysBusDevice *sysbus_dev;
|
||||
SysBusDevice *sbd = SYS_BUS_DEVICE(ide);
|
||||
|
||||
sysbus_dev = SYS_BUS_DEVICE(ide);
|
||||
sysbus_connect_irq(sysbus_dev, 0, irq0);
|
||||
sysbus_connect_irq(sysbus_dev, 1, irq1);
|
||||
sysbus_connect_irq(sbd, 0, irq0);
|
||||
sysbus_connect_irq(sbd, 1, irq1);
|
||||
qdev_prop_set_uint32(DEVICE(ide), "channel", dmaid);
|
||||
object_property_set_link(OBJECT(ide), "dbdma", OBJECT(&s->dbdma),
|
||||
&error_abort);
|
||||
macio_ide_register_dma(ide);
|
||||
|
||||
qdev_realize(DEVICE(ide), BUS(&s->macio_bus), errp);
|
||||
return qdev_realize(DEVICE(ide), BUS(&s->macio_bus), errp);
|
||||
}
|
||||
|
||||
static void macio_oldworld_realize(PCIDevice *d, Error **errp)
|
||||
@@ -140,12 +138,9 @@ static void macio_oldworld_realize(PCIDevice *d, Error **errp)
|
||||
MacIOState *s = MACIO(d);
|
||||
OldWorldMacIOState *os = OLDWORLD_MACIO(d);
|
||||
DeviceState *pic_dev = DEVICE(&os->pic);
|
||||
Error *err = NULL;
|
||||
SysBusDevice *sysbus_dev;
|
||||
SysBusDevice *sbd;
|
||||
|
||||
macio_common_realize(d, &err);
|
||||
if (err) {
|
||||
error_propagate(errp, err);
|
||||
if (!macio_common_realize(d, errp)) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -153,51 +148,44 @@ static void macio_oldworld_realize(PCIDevice *d, Error **errp)
|
||||
if (!qdev_realize(DEVICE(&os->pic), BUS(&s->macio_bus), errp)) {
|
||||
return;
|
||||
}
|
||||
sysbus_dev = SYS_BUS_DEVICE(&os->pic);
|
||||
sbd = SYS_BUS_DEVICE(&os->pic);
|
||||
memory_region_add_subregion(&s->bar, 0x0,
|
||||
sysbus_mmio_get_region(sysbus_dev, 0));
|
||||
sysbus_mmio_get_region(sbd, 0));
|
||||
|
||||
qdev_prop_set_uint64(DEVICE(&s->cuda), "timebase-frequency",
|
||||
s->frequency);
|
||||
if (!qdev_realize(DEVICE(&s->cuda), BUS(&s->macio_bus), errp)) {
|
||||
return;
|
||||
}
|
||||
sysbus_dev = SYS_BUS_DEVICE(&s->cuda);
|
||||
sbd = SYS_BUS_DEVICE(&s->cuda);
|
||||
memory_region_add_subregion(&s->bar, 0x16000,
|
||||
sysbus_mmio_get_region(sysbus_dev, 0));
|
||||
sysbus_connect_irq(sysbus_dev, 0, qdev_get_gpio_in(pic_dev,
|
||||
OLDWORLD_CUDA_IRQ));
|
||||
sysbus_mmio_get_region(sbd, 0));
|
||||
sysbus_connect_irq(sbd, 0, qdev_get_gpio_in(pic_dev, OLDWORLD_CUDA_IRQ));
|
||||
|
||||
sysbus_dev = SYS_BUS_DEVICE(&s->escc);
|
||||
sysbus_connect_irq(sysbus_dev, 0, qdev_get_gpio_in(pic_dev,
|
||||
OLDWORLD_ESCCB_IRQ));
|
||||
sysbus_connect_irq(sysbus_dev, 1, qdev_get_gpio_in(pic_dev,
|
||||
OLDWORLD_ESCCA_IRQ));
|
||||
sbd = SYS_BUS_DEVICE(&s->escc);
|
||||
sysbus_connect_irq(sbd, 0, qdev_get_gpio_in(pic_dev, OLDWORLD_ESCCB_IRQ));
|
||||
sysbus_connect_irq(sbd, 1, qdev_get_gpio_in(pic_dev, OLDWORLD_ESCCA_IRQ));
|
||||
|
||||
if (!qdev_realize(DEVICE(&os->nvram), BUS(&s->macio_bus), errp)) {
|
||||
return;
|
||||
}
|
||||
sysbus_dev = SYS_BUS_DEVICE(&os->nvram);
|
||||
sbd = SYS_BUS_DEVICE(&os->nvram);
|
||||
memory_region_add_subregion(&s->bar, 0x60000,
|
||||
sysbus_mmio_get_region(sysbus_dev, 0));
|
||||
sysbus_mmio_get_region(sbd, 0));
|
||||
pmac_format_nvram_partition(&os->nvram, os->nvram.size);
|
||||
|
||||
/* IDE buses */
|
||||
macio_realize_ide(s, &os->ide[0],
|
||||
qdev_get_gpio_in(pic_dev, OLDWORLD_IDE0_IRQ),
|
||||
qdev_get_gpio_in(pic_dev, OLDWORLD_IDE0_DMA_IRQ),
|
||||
0x16, &err);
|
||||
if (err) {
|
||||
error_propagate(errp, err);
|
||||
if (!macio_realize_ide(s, &os->ide[0],
|
||||
qdev_get_gpio_in(pic_dev, OLDWORLD_IDE0_IRQ),
|
||||
qdev_get_gpio_in(pic_dev, OLDWORLD_IDE0_DMA_IRQ),
|
||||
0x16, errp)) {
|
||||
return;
|
||||
}
|
||||
|
||||
macio_realize_ide(s, &os->ide[1],
|
||||
qdev_get_gpio_in(pic_dev, OLDWORLD_IDE1_IRQ),
|
||||
qdev_get_gpio_in(pic_dev, OLDWORLD_IDE1_DMA_IRQ),
|
||||
0x1a, &err);
|
||||
if (err) {
|
||||
error_propagate(errp, err);
|
||||
if (!macio_realize_ide(s, &os->ide[1],
|
||||
qdev_get_gpio_in(pic_dev, OLDWORLD_IDE1_IRQ),
|
||||
qdev_get_gpio_in(pic_dev, OLDWORLD_IDE1_DMA_IRQ),
|
||||
0x1a, errp)) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -220,11 +208,11 @@ static void macio_oldworld_init(Object *obj)
|
||||
DeviceState *dev;
|
||||
int i;
|
||||
|
||||
object_initialize_child(OBJECT(s), "pic", &os->pic, TYPE_HEATHROW);
|
||||
object_initialize_child(obj, "pic", &os->pic, TYPE_HEATHROW);
|
||||
|
||||
object_initialize_child(OBJECT(s), "cuda", &s->cuda, TYPE_CUDA);
|
||||
object_initialize_child(obj, "cuda", &s->cuda, TYPE_CUDA);
|
||||
|
||||
object_initialize_child(OBJECT(s), "nvram", &os->nvram, TYPE_MACIO_NVRAM);
|
||||
object_initialize_child(obj, "nvram", &os->nvram, TYPE_MACIO_NVRAM);
|
||||
dev = DEVICE(&os->nvram);
|
||||
qdev_prop_set_uint32(dev, "size", MACIO_NVRAM_SIZE);
|
||||
qdev_prop_set_uint32(dev, "it_shift", 4);
|
||||
@@ -273,45 +261,36 @@ static void macio_newworld_realize(PCIDevice *d, Error **errp)
|
||||
MacIOState *s = MACIO(d);
|
||||
NewWorldMacIOState *ns = NEWWORLD_MACIO(d);
|
||||
DeviceState *pic_dev = DEVICE(&ns->pic);
|
||||
Error *err = NULL;
|
||||
SysBusDevice *sysbus_dev;
|
||||
SysBusDevice *sbd;
|
||||
MemoryRegion *timer_memory = NULL;
|
||||
|
||||
macio_common_realize(d, &err);
|
||||
if (err) {
|
||||
error_propagate(errp, err);
|
||||
if (!macio_common_realize(d, errp)) {
|
||||
return;
|
||||
}
|
||||
|
||||
/* OpenPIC */
|
||||
qdev_prop_set_uint32(pic_dev, "model", OPENPIC_MODEL_KEYLARGO);
|
||||
sysbus_dev = SYS_BUS_DEVICE(&ns->pic);
|
||||
sysbus_realize_and_unref(sysbus_dev, &error_fatal);
|
||||
sbd = SYS_BUS_DEVICE(&ns->pic);
|
||||
sysbus_realize_and_unref(sbd, &error_fatal);
|
||||
memory_region_add_subregion(&s->bar, 0x40000,
|
||||
sysbus_mmio_get_region(sysbus_dev, 0));
|
||||
sysbus_mmio_get_region(sbd, 0));
|
||||
|
||||
sysbus_dev = SYS_BUS_DEVICE(&s->escc);
|
||||
sysbus_connect_irq(sysbus_dev, 0, qdev_get_gpio_in(pic_dev,
|
||||
NEWWORLD_ESCCB_IRQ));
|
||||
sysbus_connect_irq(sysbus_dev, 1, qdev_get_gpio_in(pic_dev,
|
||||
NEWWORLD_ESCCA_IRQ));
|
||||
sbd = SYS_BUS_DEVICE(&s->escc);
|
||||
sysbus_connect_irq(sbd, 0, qdev_get_gpio_in(pic_dev, NEWWORLD_ESCCB_IRQ));
|
||||
sysbus_connect_irq(sbd, 1, qdev_get_gpio_in(pic_dev, NEWWORLD_ESCCA_IRQ));
|
||||
|
||||
/* IDE buses */
|
||||
macio_realize_ide(s, &ns->ide[0],
|
||||
qdev_get_gpio_in(pic_dev, NEWWORLD_IDE0_IRQ),
|
||||
qdev_get_gpio_in(pic_dev, NEWWORLD_IDE0_DMA_IRQ),
|
||||
0x16, &err);
|
||||
if (err) {
|
||||
error_propagate(errp, err);
|
||||
if (!macio_realize_ide(s, &ns->ide[0],
|
||||
qdev_get_gpio_in(pic_dev, NEWWORLD_IDE0_IRQ),
|
||||
qdev_get_gpio_in(pic_dev, NEWWORLD_IDE0_DMA_IRQ),
|
||||
0x16, errp)) {
|
||||
return;
|
||||
}
|
||||
|
||||
macio_realize_ide(s, &ns->ide[1],
|
||||
qdev_get_gpio_in(pic_dev, NEWWORLD_IDE1_IRQ),
|
||||
qdev_get_gpio_in(pic_dev, NEWWORLD_IDE1_DMA_IRQ),
|
||||
0x1a, &err);
|
||||
if (err) {
|
||||
error_propagate(errp, err);
|
||||
if (!macio_realize_ide(s, &ns->ide[1],
|
||||
qdev_get_gpio_in(pic_dev, NEWWORLD_IDE1_IRQ),
|
||||
qdev_get_gpio_in(pic_dev, NEWWORLD_IDE1_DMA_IRQ),
|
||||
0x1a, errp)) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -326,27 +305,26 @@ static void macio_newworld_realize(PCIDevice *d, Error **errp)
|
||||
if (!qdev_realize(DEVICE(&ns->gpio), BUS(&s->macio_bus), errp)) {
|
||||
return;
|
||||
}
|
||||
sysbus_dev = SYS_BUS_DEVICE(&ns->gpio);
|
||||
sysbus_connect_irq(sysbus_dev, 1, qdev_get_gpio_in(pic_dev,
|
||||
sbd = SYS_BUS_DEVICE(&ns->gpio);
|
||||
sysbus_connect_irq(sbd, 1, qdev_get_gpio_in(pic_dev,
|
||||
NEWWORLD_EXTING_GPIO1));
|
||||
sysbus_connect_irq(sysbus_dev, 9, qdev_get_gpio_in(pic_dev,
|
||||
sysbus_connect_irq(sbd, 9, qdev_get_gpio_in(pic_dev,
|
||||
NEWWORLD_EXTING_GPIO9));
|
||||
memory_region_add_subregion(&s->bar, 0x50,
|
||||
sysbus_mmio_get_region(sysbus_dev, 0));
|
||||
sysbus_mmio_get_region(sbd, 0));
|
||||
|
||||
/* PMU */
|
||||
object_initialize_child(OBJECT(s), "pmu", &s->pmu, TYPE_VIA_PMU);
|
||||
object_property_set_link(OBJECT(&s->pmu), "gpio", OBJECT(sysbus_dev),
|
||||
object_property_set_link(OBJECT(&s->pmu), "gpio", OBJECT(sbd),
|
||||
&error_abort);
|
||||
qdev_prop_set_bit(DEVICE(&s->pmu), "has-adb", ns->has_adb);
|
||||
if (!qdev_realize(DEVICE(&s->pmu), BUS(&s->macio_bus), errp)) {
|
||||
return;
|
||||
}
|
||||
sysbus_dev = SYS_BUS_DEVICE(&s->pmu);
|
||||
sysbus_connect_irq(sysbus_dev, 0, qdev_get_gpio_in(pic_dev,
|
||||
NEWWORLD_PMU_IRQ));
|
||||
sbd = SYS_BUS_DEVICE(&s->pmu);
|
||||
sysbus_connect_irq(sbd, 0, qdev_get_gpio_in(pic_dev, NEWWORLD_PMU_IRQ));
|
||||
memory_region_add_subregion(&s->bar, 0x16000,
|
||||
sysbus_mmio_get_region(sysbus_dev, 0));
|
||||
sysbus_mmio_get_region(sbd, 0));
|
||||
} else {
|
||||
object_unparent(OBJECT(&ns->gpio));
|
||||
|
||||
@@ -358,11 +336,10 @@ static void macio_newworld_realize(PCIDevice *d, Error **errp)
|
||||
if (!qdev_realize(DEVICE(&s->cuda), BUS(&s->macio_bus), errp)) {
|
||||
return;
|
||||
}
|
||||
sysbus_dev = SYS_BUS_DEVICE(&s->cuda);
|
||||
sysbus_connect_irq(sysbus_dev, 0, qdev_get_gpio_in(pic_dev,
|
||||
NEWWORLD_CUDA_IRQ));
|
||||
sbd = SYS_BUS_DEVICE(&s->cuda);
|
||||
sysbus_connect_irq(sbd, 0, qdev_get_gpio_in(pic_dev, NEWWORLD_CUDA_IRQ));
|
||||
memory_region_add_subregion(&s->bar, 0x16000,
|
||||
sysbus_mmio_get_region(sysbus_dev, 0));
|
||||
sysbus_mmio_get_region(sbd, 0));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -372,9 +349,9 @@ static void macio_newworld_init(Object *obj)
|
||||
NewWorldMacIOState *ns = NEWWORLD_MACIO(obj);
|
||||
int i;
|
||||
|
||||
object_initialize_child(OBJECT(s), "pic", &ns->pic, TYPE_OPENPIC);
|
||||
object_initialize_child(obj, "pic", &ns->pic, TYPE_OPENPIC);
|
||||
|
||||
object_initialize_child(OBJECT(s), "gpio", &ns->gpio, TYPE_MACIO_GPIO);
|
||||
object_initialize_child(obj, "gpio", &ns->gpio, TYPE_MACIO_GPIO);
|
||||
|
||||
for (i = 0; i < 2; i++) {
|
||||
macio_init_ide(s, &ns->ide[i], i);
|
||||
@@ -390,9 +367,9 @@ static void macio_instance_init(Object *obj)
|
||||
qbus_init(&s->macio_bus, sizeof(s->macio_bus), TYPE_MACIO_BUS,
|
||||
DEVICE(obj), "macio.0");
|
||||
|
||||
object_initialize_child(OBJECT(s), "dbdma", &s->dbdma, TYPE_MAC_DBDMA);
|
||||
object_initialize_child(obj, "dbdma", &s->dbdma, TYPE_MAC_DBDMA);
|
||||
|
||||
object_initialize_child(OBJECT(s), "escc", &s->escc, TYPE_ESCC);
|
||||
object_initialize_child(obj, "escc", &s->escc, TYPE_ESCC);
|
||||
}
|
||||
|
||||
static const VMStateDescription vmstate_macio_oldworld = {
|
||||
|
||||
@@ -31,12 +31,8 @@
|
||||
#include "qemu/osdep.h"
|
||||
#include "hw/qdev-properties.h"
|
||||
#include "migration/vmstate.h"
|
||||
#include "hw/input/adb.h"
|
||||
#include "hw/irq.h"
|
||||
#include "hw/misc/mos6522.h"
|
||||
#include "hw/misc/macio/gpio.h"
|
||||
#include "hw/misc/macio/pmu.h"
|
||||
#include "qapi/error.h"
|
||||
#include "qemu/timer.h"
|
||||
#include "sysemu/runstate.h"
|
||||
#include "sysemu/rtc.h"
|
||||
|
||||
@@ -25,7 +25,6 @@
|
||||
*/
|
||||
|
||||
#include "qemu/osdep.h"
|
||||
#include "hw/input/adb.h"
|
||||
#include "hw/irq.h"
|
||||
#include "hw/misc/mos6522.h"
|
||||
#include "hw/qdev-properties.h"
|
||||
|
||||
@@ -980,9 +980,9 @@ static ssize_t ftgmac100_receive(NetClientState *nc, const uint8_t *buf,
|
||||
return size;
|
||||
}
|
||||
|
||||
/* 4 bytes for the CRC. */
|
||||
size += 4;
|
||||
crc = cpu_to_be32(crc32(~0, buf, size));
|
||||
/* Increase size by 4, loop below reads the last 4 bytes from crc_ptr. */
|
||||
size += 4;
|
||||
crc_ptr = (uint8_t *) &crc;
|
||||
|
||||
/* Huge frames are truncated. */
|
||||
|
||||
@@ -31,7 +31,6 @@
|
||||
#include "net/net.h"
|
||||
#include "net/checksum.h"
|
||||
|
||||
#include "hw/hw.h"
|
||||
#include "hw/irq.h"
|
||||
#include "hw/qdev-properties.h"
|
||||
#include "hw/stream.h"
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
#include "qapi/error.h"
|
||||
#include "qemu/module.h"
|
||||
#include "hw/i2c/i2c.h"
|
||||
#include "hw/nvram/eeprom_at24c.h"
|
||||
#include "hw/qdev-properties.h"
|
||||
#include "hw/qdev-properties-system.h"
|
||||
#include "sysemu/block-backend.h"
|
||||
@@ -49,6 +50,9 @@ struct EEPROMState {
|
||||
uint8_t *mem;
|
||||
|
||||
BlockBackend *blk;
|
||||
|
||||
const uint8_t *init_rom;
|
||||
uint32_t init_rom_size;
|
||||
};
|
||||
|
||||
static
|
||||
@@ -128,10 +132,39 @@ int at24c_eeprom_send(I2CSlave *s, uint8_t data)
|
||||
return 0;
|
||||
}
|
||||
|
||||
I2CSlave *at24c_eeprom_init(I2CBus *bus, uint8_t address, uint32_t rom_size)
|
||||
{
|
||||
return at24c_eeprom_init_rom(bus, address, rom_size, NULL, 0);
|
||||
}
|
||||
|
||||
I2CSlave *at24c_eeprom_init_rom(I2CBus *bus, uint8_t address, uint32_t rom_size,
|
||||
const uint8_t *init_rom, uint32_t init_rom_size)
|
||||
{
|
||||
EEPROMState *s;
|
||||
|
||||
s = AT24C_EE(i2c_slave_new(TYPE_AT24C_EE, address));
|
||||
|
||||
qdev_prop_set_uint32(DEVICE(s), "rom-size", rom_size);
|
||||
|
||||
/* TODO: Model init_rom with QOM properties. */
|
||||
s->init_rom = init_rom;
|
||||
s->init_rom_size = init_rom_size;
|
||||
|
||||
i2c_slave_realize_and_unref(I2C_SLAVE(s), bus, &error_abort);
|
||||
|
||||
return I2C_SLAVE(s);
|
||||
}
|
||||
|
||||
static void at24c_eeprom_realize(DeviceState *dev, Error **errp)
|
||||
{
|
||||
EEPROMState *ee = AT24C_EE(dev);
|
||||
|
||||
if (ee->init_rom_size > ee->rsize) {
|
||||
error_setg(errp, "%s: init rom is larger than rom: %u > %u",
|
||||
TYPE_AT24C_EE, ee->init_rom_size, ee->rsize);
|
||||
return;
|
||||
}
|
||||
|
||||
if (ee->blk) {
|
||||
int64_t len = blk_getlength(ee->blk);
|
||||
|
||||
@@ -151,19 +184,12 @@ static void at24c_eeprom_realize(DeviceState *dev, Error **errp)
|
||||
}
|
||||
|
||||
ee->mem = g_malloc0(ee->rsize);
|
||||
}
|
||||
|
||||
static
|
||||
void at24c_eeprom_reset(DeviceState *state)
|
||||
{
|
||||
EEPROMState *ee = AT24C_EE(state);
|
||||
|
||||
ee->changed = false;
|
||||
ee->cur = 0;
|
||||
ee->haveaddr = 0;
|
||||
|
||||
memset(ee->mem, 0, ee->rsize);
|
||||
|
||||
if (ee->init_rom) {
|
||||
memcpy(ee->mem, ee->init_rom, MIN(ee->init_rom_size, ee->rsize));
|
||||
}
|
||||
|
||||
if (ee->blk) {
|
||||
int ret = blk_pread(ee->blk, 0, ee->rsize, ee->mem, 0);
|
||||
|
||||
@@ -175,6 +201,16 @@ void at24c_eeprom_reset(DeviceState *state)
|
||||
}
|
||||
}
|
||||
|
||||
static
|
||||
void at24c_eeprom_reset(DeviceState *state)
|
||||
{
|
||||
EEPROMState *ee = AT24C_EE(state);
|
||||
|
||||
ee->changed = false;
|
||||
ee->cur = 0;
|
||||
ee->haveaddr = 0;
|
||||
}
|
||||
|
||||
static Property at24c_eeprom_props[] = {
|
||||
DEFINE_PROP_UINT32("rom-size", EEPROMState, rsize, 0),
|
||||
DEFINE_PROP_BOOL("writable", EEPROMState, writable, true),
|
||||
|
||||
@@ -24,9 +24,12 @@
|
||||
*/
|
||||
|
||||
#include "qemu/osdep.h"
|
||||
#include "qapi/error.h"
|
||||
#include "hw/nvram/chrp_nvram.h"
|
||||
#include "hw/nvram/mac_nvram.h"
|
||||
#include "hw/qdev-properties.h"
|
||||
#include "hw/qdev-properties-system.h"
|
||||
#include "sysemu/block-backend.h"
|
||||
#include "migration/vmstate.h"
|
||||
#include "qemu/cutils.h"
|
||||
#include "qemu/module.h"
|
||||
@@ -44,6 +47,9 @@ static void macio_nvram_writeb(void *opaque, hwaddr addr,
|
||||
addr = (addr >> s->it_shift) & (s->size - 1);
|
||||
trace_macio_nvram_write(addr, value);
|
||||
s->data[addr] = value;
|
||||
if (s->blk) {
|
||||
blk_pwrite(s->blk, addr, 1, &s->data[addr], 0);
|
||||
}
|
||||
}
|
||||
|
||||
static uint64_t macio_nvram_readb(void *opaque, hwaddr addr,
|
||||
@@ -91,6 +97,27 @@ static void macio_nvram_realizefn(DeviceState *dev, Error **errp)
|
||||
|
||||
s->data = g_malloc0(s->size);
|
||||
|
||||
if (s->blk) {
|
||||
int64_t len = blk_getlength(s->blk);
|
||||
if (len < 0) {
|
||||
error_setg_errno(errp, -len,
|
||||
"could not get length of nvram backing image");
|
||||
return;
|
||||
} else if (len != s->size) {
|
||||
error_setg_errno(errp, -len,
|
||||
"invalid size nvram backing image");
|
||||
return;
|
||||
}
|
||||
if (blk_set_perm(s->blk, BLK_PERM_CONSISTENT_READ | BLK_PERM_WRITE,
|
||||
BLK_PERM_ALL, errp) < 0) {
|
||||
return;
|
||||
}
|
||||
if (blk_pread(s->blk, 0, s->size, s->data, 0) < 0) {
|
||||
error_setg(errp, "can't read-nvram contents");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
memory_region_init_io(&s->mem, OBJECT(s), &macio_nvram_ops, s,
|
||||
"macio-nvram", s->size << s->it_shift);
|
||||
sysbus_init_mmio(d, &s->mem);
|
||||
@@ -106,6 +133,7 @@ static void macio_nvram_unrealizefn(DeviceState *dev)
|
||||
static Property macio_nvram_properties[] = {
|
||||
DEFINE_PROP_UINT32("size", MacIONVRAMState, size, 0),
|
||||
DEFINE_PROP_UINT32("it_shift", MacIONVRAMState, it_shift, 0),
|
||||
DEFINE_PROP_DRIVE("drive", MacIONVRAMState, blk),
|
||||
DEFINE_PROP_END_OF_LIST()
|
||||
};
|
||||
|
||||
|
||||
@@ -466,8 +466,7 @@ static void ppc_core99_init(MachineState *machine)
|
||||
fw_cfg = FW_CFG(dev);
|
||||
qdev_prop_set_uint32(dev, "data_width", 1);
|
||||
qdev_prop_set_bit(dev, "dma_enabled", false);
|
||||
object_property_add_child(OBJECT(qdev_get_machine()), TYPE_FW_CFG,
|
||||
OBJECT(fw_cfg));
|
||||
object_property_add_child(OBJECT(machine), TYPE_FW_CFG, OBJECT(fw_cfg));
|
||||
s = SYS_BUS_DEVICE(dev);
|
||||
sysbus_realize_and_unref(s, &error_fatal);
|
||||
sysbus_mmio_map(s, 0, CFG_ADDR);
|
||||
|
||||
@@ -102,7 +102,7 @@ static void ppc_heathrow_init(MachineState *machine)
|
||||
DeviceState *dev, *pic_dev, *grackle_dev;
|
||||
BusState *adb_bus;
|
||||
uint16_t ppc_boot_device;
|
||||
DriveInfo *hd[MAX_IDE_BUS * MAX_IDE_DEVS];
|
||||
DriveInfo *dinfo, *hd[MAX_IDE_BUS * MAX_IDE_DEVS];
|
||||
void *fw_cfg;
|
||||
uint64_t tbfreq = kvm_enabled() ? kvmppc_get_tbfreq() : TBFREQ;
|
||||
|
||||
@@ -245,6 +245,12 @@ static void ppc_heathrow_init(MachineState *machine)
|
||||
qdev_prop_set_chr(dev, "chrA", serial_hd(0));
|
||||
qdev_prop_set_chr(dev, "chrB", serial_hd(1));
|
||||
|
||||
dinfo = drive_get(IF_MTD, 0, 0);
|
||||
if (dinfo) {
|
||||
dev = DEVICE(object_resolve_path_component(macio, "nvram"));
|
||||
qdev_prop_set_drive(dev, "drive", blk_by_legacy_dinfo(dinfo));
|
||||
}
|
||||
|
||||
pci_realize_and_unref(PCI_DEVICE(macio), pci_bus, &error_fatal);
|
||||
|
||||
pic_dev = DEVICE(object_resolve_path_component(macio, "pic"));
|
||||
@@ -303,8 +309,7 @@ static void ppc_heathrow_init(MachineState *machine)
|
||||
fw_cfg = FW_CFG(dev);
|
||||
qdev_prop_set_uint32(dev, "data_width", 1);
|
||||
qdev_prop_set_bit(dev, "dma_enabled", false);
|
||||
object_property_add_child(OBJECT(qdev_get_machine()), TYPE_FW_CFG,
|
||||
OBJECT(fw_cfg));
|
||||
object_property_add_child(OBJECT(machine), TYPE_FW_CFG, OBJECT(fw_cfg));
|
||||
s = SYS_BUS_DEVICE(dev);
|
||||
sysbus_realize_and_unref(s, &error_fatal);
|
||||
sysbus_mmio_map(s, 0, CFG_ADDR);
|
||||
|
||||
@@ -38,8 +38,6 @@
|
||||
#include "sysemu/sysemu.h"
|
||||
#include "exec/address-spaces.h"
|
||||
#include "hw/intc/ppc-uic.h"
|
||||
#include "hw/qdev-properties.h"
|
||||
#include "qapi/error.h"
|
||||
#include "trace.h"
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
@@ -13,7 +13,6 @@
|
||||
|
||||
#include "qemu/osdep.h"
|
||||
#include "qemu/units.h"
|
||||
#include "qemu/error-report.h"
|
||||
#include "qemu/datadir.h"
|
||||
#include "qemu/error-report.h"
|
||||
#include "net/net.h"
|
||||
|
||||
@@ -17,7 +17,6 @@
|
||||
#include "hw/ppc/spapr_drc.h"
|
||||
#include "qom/object.h"
|
||||
#include "migration/vmstate.h"
|
||||
#include "qapi/error.h"
|
||||
#include "qapi/qapi-events-qdev.h"
|
||||
#include "qapi/visitor.h"
|
||||
#include "qemu/error-report.h"
|
||||
|
||||
@@ -14,7 +14,6 @@
|
||||
*/
|
||||
|
||||
#include "qemu/osdep.h"
|
||||
#include "qemu/cutils.h"
|
||||
#include "hw/pci/pci.h"
|
||||
#include "cpu.h"
|
||||
#include "qemu/cutils.h"
|
||||
|
||||
@@ -22,7 +22,6 @@
|
||||
#include "hw/remote/iohub.h"
|
||||
#include "hw/remote/iommu.h"
|
||||
#include "hw/qdev-core.h"
|
||||
#include "hw/remote/iommu.h"
|
||||
#include "hw/remote/vfio-user-obj.h"
|
||||
#include "hw/pci/msi.h"
|
||||
|
||||
|
||||
@@ -8,7 +8,6 @@
|
||||
|
||||
#include "qemu/osdep.h"
|
||||
|
||||
#include "qemu/compiler.h"
|
||||
#include "qemu/int128.h"
|
||||
#include "qemu/range.h"
|
||||
#include "exec/memory.h"
|
||||
|
||||
@@ -12,7 +12,6 @@
|
||||
#include "qemu/error-report.h"
|
||||
#include "qemu/notify.h"
|
||||
#include "qom/object_interfaces.h"
|
||||
#include "hw/qdev-core.h"
|
||||
#include "io/channel.h"
|
||||
#include "hw/qdev-core.h"
|
||||
#include "hw/remote/machine.h"
|
||||
|
||||
@@ -249,17 +249,45 @@ void riscv_load_initrd(MachineState *machine, uint64_t kernel_entry)
|
||||
}
|
||||
}
|
||||
|
||||
uint64_t riscv_load_fdt(hwaddr dram_base, uint64_t mem_size, void *fdt)
|
||||
/*
|
||||
* This function makes an assumption that the DRAM interval
|
||||
* 'dram_base' + 'dram_size' is contiguous.
|
||||
*
|
||||
* Considering that 'dram_end' is the lowest value between
|
||||
* the end of the DRAM block and MachineState->ram_size, the
|
||||
* FDT location will vary according to 'dram_base':
|
||||
*
|
||||
* - if 'dram_base' is less that 3072 MiB, the FDT will be
|
||||
* put at the lowest value between 3072 MiB and 'dram_end';
|
||||
*
|
||||
* - if 'dram_base' is higher than 3072 MiB, the FDT will be
|
||||
* put at 'dram_end'.
|
||||
*
|
||||
* The FDT is fdt_packed() during the calculation.
|
||||
*/
|
||||
uint64_t riscv_compute_fdt_addr(hwaddr dram_base, hwaddr dram_size,
|
||||
MachineState *ms)
|
||||
{
|
||||
uint64_t temp, fdt_addr;
|
||||
hwaddr dram_end = dram_base + mem_size;
|
||||
int ret, fdtsize = fdt_totalsize(fdt);
|
||||
int ret = fdt_pack(ms->fdt);
|
||||
hwaddr dram_end, temp;
|
||||
int fdtsize;
|
||||
|
||||
/* Should only fail if we've built a corrupted tree */
|
||||
g_assert(ret == 0);
|
||||
|
||||
fdtsize = fdt_totalsize(ms->fdt);
|
||||
if (fdtsize <= 0) {
|
||||
error_report("invalid device-tree");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
/*
|
||||
* A dram_size == 0, usually from a MemMapEntry[].size element,
|
||||
* means that the DRAM block goes all the way to ms->ram_size.
|
||||
*/
|
||||
dram_end = dram_base;
|
||||
dram_end += dram_size ? MIN(ms->ram_size, dram_size) : ms->ram_size;
|
||||
|
||||
/*
|
||||
* We should put fdt as far as possible to avoid kernel/initrd overwriting
|
||||
* its content. But it should be addressable by 32 bit system as well.
|
||||
@@ -267,11 +295,18 @@ uint64_t riscv_load_fdt(hwaddr dram_base, uint64_t mem_size, void *fdt)
|
||||
* end of dram or 3GB whichever is lesser.
|
||||
*/
|
||||
temp = (dram_base < 3072 * MiB) ? MIN(dram_end, 3072 * MiB) : dram_end;
|
||||
fdt_addr = QEMU_ALIGN_DOWN(temp - fdtsize, 2 * MiB);
|
||||
|
||||
ret = fdt_pack(fdt);
|
||||
/* Should only fail if we've built a corrupted tree */
|
||||
g_assert(ret == 0);
|
||||
return QEMU_ALIGN_DOWN(temp - fdtsize, 2 * MiB);
|
||||
}
|
||||
|
||||
/*
|
||||
* 'fdt_addr' is received as hwaddr because boards might put
|
||||
* the FDT beyond 32-bit addressing boundary.
|
||||
*/
|
||||
void riscv_load_fdt(hwaddr fdt_addr, void *fdt)
|
||||
{
|
||||
uint32_t fdtsize = fdt_totalsize(fdt);
|
||||
|
||||
/* copy in the device tree */
|
||||
qemu_fdt_dumpdtb(fdt, fdtsize);
|
||||
|
||||
@@ -279,8 +314,6 @@ uint64_t riscv_load_fdt(hwaddr dram_base, uint64_t mem_size, void *fdt)
|
||||
&address_space_memory);
|
||||
qemu_register_reset_nosnapshotload(qemu_fdt_randomize_seeds,
|
||||
rom_ptr_for_as(&address_space_memory, fdt_addr, fdtsize));
|
||||
|
||||
return fdt_addr;
|
||||
}
|
||||
|
||||
void riscv_rom_copy_firmware_info(MachineState *machine, hwaddr rom_base,
|
||||
@@ -356,6 +389,15 @@ void riscv_setup_rom_reset_vec(MachineState *machine, RISCVHartArrayState *harts
|
||||
reset_vec[4] = 0x0182b283; /* ld t0, 24(t0) */
|
||||
}
|
||||
|
||||
if (!harts->harts[0].cfg.ext_icsr) {
|
||||
/*
|
||||
* The Zicsr extension has been disabled, so let's ensure we don't
|
||||
* run the CSR instruction. Let's fill the address with a non
|
||||
* compressed nop.
|
||||
*/
|
||||
reset_vec[2] = 0x00000013; /* addi x0, x0, 0 */
|
||||
}
|
||||
|
||||
/* copy in the reset vector in little_endian byte order */
|
||||
for (i = 0; i < ARRAY_SIZE(reset_vec); i++) {
|
||||
reset_vec[i] = cpu_to_le32(reset_vec[i]);
|
||||
|
||||
@@ -641,8 +641,11 @@ static void microchip_icicle_kit_machine_init(MachineState *machine)
|
||||
}
|
||||
|
||||
/* Compute the fdt load address in dram */
|
||||
fdt_load_addr = riscv_load_fdt(memmap[MICROCHIP_PFSOC_DRAM_LO].base,
|
||||
machine->ram_size, machine->fdt);
|
||||
fdt_load_addr = riscv_compute_fdt_addr(memmap[MICROCHIP_PFSOC_DRAM_LO].base,
|
||||
memmap[MICROCHIP_PFSOC_DRAM_LO].size,
|
||||
machine);
|
||||
riscv_load_fdt(fdt_load_addr, machine->fdt);
|
||||
|
||||
/* Load the reset vector */
|
||||
riscv_setup_rom_reset_vec(machine, &s->soc.u_cpus, firmware_load_addr,
|
||||
memmap[MICROCHIP_PFSOC_ENVM_DATA].base,
|
||||
|
||||
@@ -31,47 +31,47 @@
|
||||
/*
|
||||
* This version of the OpenTitan machine currently supports
|
||||
* OpenTitan RTL version:
|
||||
* <lowRISC/opentitan@d072ac505f82152678d6e04be95c72b728a347b8>
|
||||
* <lowRISC/opentitan@565e4af39760a123c59a184aa2f5812a961fde47>
|
||||
*
|
||||
* MMIO mapping as per (specified commit):
|
||||
* lowRISC/opentitan: hw/top_earlgrey/sw/autogen/top_earlgrey_memory.h
|
||||
*/
|
||||
static const MemMapEntry ibex_memmap[] = {
|
||||
[IBEX_DEV_ROM] = { 0x00008000, 0x8000 },
|
||||
[IBEX_DEV_RAM] = { 0x10000000, 0x20000 },
|
||||
[IBEX_DEV_FLASH] = { 0x20000000, 0x100000 },
|
||||
[IBEX_DEV_UART] = { 0x40000000, 0x1000 },
|
||||
[IBEX_DEV_GPIO] = { 0x40040000, 0x1000 },
|
||||
[IBEX_DEV_SPI_DEVICE] = { 0x40050000, 0x1000 },
|
||||
[IBEX_DEV_I2C] = { 0x40080000, 0x1000 },
|
||||
[IBEX_DEV_PATTGEN] = { 0x400e0000, 0x1000 },
|
||||
[IBEX_DEV_TIMER] = { 0x40100000, 0x1000 },
|
||||
[IBEX_DEV_OTP_CTRL] = { 0x40130000, 0x4000 },
|
||||
[IBEX_DEV_LC_CTRL] = { 0x40140000, 0x1000 },
|
||||
[IBEX_DEV_ALERT_HANDLER] = { 0x40150000, 0x1000 },
|
||||
[IBEX_DEV_SPI_HOST0] = { 0x40300000, 0x1000 },
|
||||
[IBEX_DEV_SPI_HOST1] = { 0x40310000, 0x1000 },
|
||||
[IBEX_DEV_USBDEV] = { 0x40320000, 0x1000 },
|
||||
[IBEX_DEV_PWRMGR] = { 0x40400000, 0x1000 },
|
||||
[IBEX_DEV_RSTMGR] = { 0x40410000, 0x1000 },
|
||||
[IBEX_DEV_CLKMGR] = { 0x40420000, 0x1000 },
|
||||
[IBEX_DEV_PINMUX] = { 0x40460000, 0x1000 },
|
||||
[IBEX_DEV_AON_TIMER] = { 0x40470000, 0x1000 },
|
||||
[IBEX_DEV_SENSOR_CTRL] = { 0x40490000, 0x1000 },
|
||||
[IBEX_DEV_FLASH_CTRL] = { 0x41000000, 0x1000 },
|
||||
[IBEX_DEV_AES] = { 0x41100000, 0x1000 },
|
||||
[IBEX_DEV_HMAC] = { 0x41110000, 0x1000 },
|
||||
[IBEX_DEV_KMAC] = { 0x41120000, 0x1000 },
|
||||
[IBEX_DEV_OTBN] = { 0x41130000, 0x10000 },
|
||||
[IBEX_DEV_KEYMGR] = { 0x41140000, 0x1000 },
|
||||
[IBEX_DEV_CSRNG] = { 0x41150000, 0x1000 },
|
||||
[IBEX_DEV_ENTROPY] = { 0x41160000, 0x1000 },
|
||||
[IBEX_DEV_EDNO] = { 0x41170000, 0x1000 },
|
||||
[IBEX_DEV_EDN1] = { 0x41180000, 0x1000 },
|
||||
[IBEX_DEV_NMI_GEN] = { 0x411c0000, 0x1000 },
|
||||
[IBEX_DEV_PERI] = { 0x411f0000, 0x10000 },
|
||||
[IBEX_DEV_PLIC] = { 0x48000000, 0x4005000 },
|
||||
[IBEX_DEV_FLASH_VIRTUAL] = { 0x80000000, 0x80000 },
|
||||
[IBEX_DEV_ROM] = { 0x00008000, 0x8000 },
|
||||
[IBEX_DEV_RAM] = { 0x10000000, 0x20000 },
|
||||
[IBEX_DEV_FLASH] = { 0x20000000, 0x100000 },
|
||||
[IBEX_DEV_UART] = { 0x40000000, 0x40 },
|
||||
[IBEX_DEV_GPIO] = { 0x40040000, 0x40 },
|
||||
[IBEX_DEV_SPI_DEVICE] = { 0x40050000, 0x2000 },
|
||||
[IBEX_DEV_I2C] = { 0x40080000, 0x80 },
|
||||
[IBEX_DEV_PATTGEN] = { 0x400e0000, 0x40 },
|
||||
[IBEX_DEV_TIMER] = { 0x40100000, 0x200 },
|
||||
[IBEX_DEV_OTP_CTRL] = { 0x40130000, 0x2000 },
|
||||
[IBEX_DEV_LC_CTRL] = { 0x40140000, 0x100 },
|
||||
[IBEX_DEV_ALERT_HANDLER] = { 0x40150000, 0x800 },
|
||||
[IBEX_DEV_SPI_HOST0] = { 0x40300000, 0x40 },
|
||||
[IBEX_DEV_SPI_HOST1] = { 0x40310000, 0x40 },
|
||||
[IBEX_DEV_USBDEV] = { 0x40320000, 0x1000 },
|
||||
[IBEX_DEV_PWRMGR] = { 0x40400000, 0x80 },
|
||||
[IBEX_DEV_RSTMGR] = { 0x40410000, 0x80 },
|
||||
[IBEX_DEV_CLKMGR] = { 0x40420000, 0x80 },
|
||||
[IBEX_DEV_PINMUX] = { 0x40460000, 0x1000 },
|
||||
[IBEX_DEV_AON_TIMER] = { 0x40470000, 0x40 },
|
||||
[IBEX_DEV_SENSOR_CTRL] = { 0x40490000, 0x40 },
|
||||
[IBEX_DEV_FLASH_CTRL] = { 0x41000000, 0x200 },
|
||||
[IBEX_DEV_AES] = { 0x41100000, 0x100 },
|
||||
[IBEX_DEV_HMAC] = { 0x41110000, 0x1000 },
|
||||
[IBEX_DEV_KMAC] = { 0x41120000, 0x1000 },
|
||||
[IBEX_DEV_OTBN] = { 0x41130000, 0x10000 },
|
||||
[IBEX_DEV_KEYMGR] = { 0x41140000, 0x100 },
|
||||
[IBEX_DEV_CSRNG] = { 0x41150000, 0x80 },
|
||||
[IBEX_DEV_ENTROPY] = { 0x41160000, 0x100 },
|
||||
[IBEX_DEV_EDNO] = { 0x41170000, 0x80 },
|
||||
[IBEX_DEV_EDN1] = { 0x41180000, 0x80 },
|
||||
[IBEX_DEV_SRAM_CTRL] = { 0x411c0000, 0x20 },
|
||||
[IBEX_DEV_IBEX_CFG] = { 0x411f0000, 0x100 },
|
||||
[IBEX_DEV_PLIC] = { 0x48000000, 0x8000000 },
|
||||
[IBEX_DEV_FLASH_VIRTUAL] = { 0x80000000, 0x80000 },
|
||||
};
|
||||
|
||||
static void opentitan_board_init(MachineState *machine)
|
||||
@@ -294,12 +294,12 @@ static void lowrisc_ibex_soc_realize(DeviceState *dev_soc, Error **errp)
|
||||
memmap[IBEX_DEV_EDN1].base, memmap[IBEX_DEV_EDN1].size);
|
||||
create_unimplemented_device("riscv.lowrisc.ibex.alert_handler",
|
||||
memmap[IBEX_DEV_ALERT_HANDLER].base, memmap[IBEX_DEV_ALERT_HANDLER].size);
|
||||
create_unimplemented_device("riscv.lowrisc.ibex.nmi_gen",
|
||||
memmap[IBEX_DEV_NMI_GEN].base, memmap[IBEX_DEV_NMI_GEN].size);
|
||||
create_unimplemented_device("riscv.lowrisc.ibex.sram_ctrl",
|
||||
memmap[IBEX_DEV_SRAM_CTRL].base, memmap[IBEX_DEV_SRAM_CTRL].size);
|
||||
create_unimplemented_device("riscv.lowrisc.ibex.otbn",
|
||||
memmap[IBEX_DEV_OTBN].base, memmap[IBEX_DEV_OTBN].size);
|
||||
create_unimplemented_device("riscv.lowrisc.ibex.peri",
|
||||
memmap[IBEX_DEV_PERI].base, memmap[IBEX_DEV_PERI].size);
|
||||
create_unimplemented_device("riscv.lowrisc.ibex.ibex_cfg",
|
||||
memmap[IBEX_DEV_IBEX_CFG].base, memmap[IBEX_DEV_IBEX_CFG].size);
|
||||
}
|
||||
|
||||
static Property lowrisc_ibex_soc_props[] = {
|
||||
|
||||
@@ -616,9 +616,11 @@ static void sifive_u_machine_init(MachineState *machine)
|
||||
kernel_entry = 0;
|
||||
}
|
||||
|
||||
/* Compute the fdt load address in dram */
|
||||
fdt_load_addr = riscv_load_fdt(memmap[SIFIVE_U_DEV_DRAM].base,
|
||||
machine->ram_size, machine->fdt);
|
||||
fdt_load_addr = riscv_compute_fdt_addr(memmap[SIFIVE_U_DEV_DRAM].base,
|
||||
memmap[SIFIVE_U_DEV_DRAM].size,
|
||||
machine);
|
||||
riscv_load_fdt(fdt_load_addr, machine->fdt);
|
||||
|
||||
if (!riscv_is_32bit(&s->soc.u_cpus)) {
|
||||
start_addr_hi32 = (uint64_t)start_addr >> 32;
|
||||
}
|
||||
|
||||
@@ -56,7 +56,7 @@ static void create_fdt(SpikeState *s, const MemMapEntry *memmap,
|
||||
uint64_t addr, size;
|
||||
unsigned long clint_addr;
|
||||
int cpu, socket;
|
||||
MachineState *mc = MACHINE(s);
|
||||
MachineState *ms = MACHINE(s);
|
||||
uint32_t *clint_cells;
|
||||
uint32_t cpu_phandle, intc_phandle, phandle = 1;
|
||||
char *name, *mem_name, *clint_name, *clust_name;
|
||||
@@ -65,7 +65,7 @@ static void create_fdt(SpikeState *s, const MemMapEntry *memmap,
|
||||
"sifive,clint0", "riscv,clint0"
|
||||
};
|
||||
|
||||
fdt = mc->fdt = create_device_tree(&fdt_size);
|
||||
fdt = ms->fdt = create_device_tree(&fdt_size);
|
||||
if (!fdt) {
|
||||
error_report("create_device_tree() failed");
|
||||
exit(1);
|
||||
@@ -96,7 +96,7 @@ static void create_fdt(SpikeState *s, const MemMapEntry *memmap,
|
||||
qemu_fdt_setprop_cell(fdt, "/cpus", "#address-cells", 0x1);
|
||||
qemu_fdt_add_subnode(fdt, "/cpus/cpu-map");
|
||||
|
||||
for (socket = (riscv_socket_count(mc) - 1); socket >= 0; socket--) {
|
||||
for (socket = (riscv_socket_count(ms) - 1); socket >= 0; socket--) {
|
||||
clust_name = g_strdup_printf("/cpus/cpu-map/cluster%d", socket);
|
||||
qemu_fdt_add_subnode(fdt, clust_name);
|
||||
|
||||
@@ -121,7 +121,7 @@ static void create_fdt(SpikeState *s, const MemMapEntry *memmap,
|
||||
qemu_fdt_setprop_cell(fdt, cpu_name, "reg",
|
||||
s->soc[socket].hartid_base + cpu);
|
||||
qemu_fdt_setprop_string(fdt, cpu_name, "device_type", "cpu");
|
||||
riscv_socket_fdt_write_id(mc, cpu_name, socket);
|
||||
riscv_socket_fdt_write_id(ms, cpu_name, socket);
|
||||
qemu_fdt_setprop_cell(fdt, cpu_name, "phandle", cpu_phandle);
|
||||
|
||||
intc_name = g_strdup_printf("%s/interrupt-controller", cpu_name);
|
||||
@@ -147,14 +147,14 @@ static void create_fdt(SpikeState *s, const MemMapEntry *memmap,
|
||||
g_free(cpu_name);
|
||||
}
|
||||
|
||||
addr = memmap[SPIKE_DRAM].base + riscv_socket_mem_offset(mc, socket);
|
||||
size = riscv_socket_mem_size(mc, socket);
|
||||
addr = memmap[SPIKE_DRAM].base + riscv_socket_mem_offset(ms, socket);
|
||||
size = riscv_socket_mem_size(ms, socket);
|
||||
mem_name = g_strdup_printf("/memory@%lx", (long)addr);
|
||||
qemu_fdt_add_subnode(fdt, mem_name);
|
||||
qemu_fdt_setprop_cells(fdt, mem_name, "reg",
|
||||
addr >> 32, addr, size >> 32, size);
|
||||
qemu_fdt_setprop_string(fdt, mem_name, "device_type", "memory");
|
||||
riscv_socket_fdt_write_id(mc, mem_name, socket);
|
||||
riscv_socket_fdt_write_id(ms, mem_name, socket);
|
||||
g_free(mem_name);
|
||||
|
||||
clint_addr = memmap[SPIKE_CLINT].base +
|
||||
@@ -167,14 +167,14 @@ static void create_fdt(SpikeState *s, const MemMapEntry *memmap,
|
||||
0x0, clint_addr, 0x0, memmap[SPIKE_CLINT].size);
|
||||
qemu_fdt_setprop(fdt, clint_name, "interrupts-extended",
|
||||
clint_cells, s->soc[socket].num_harts * sizeof(uint32_t) * 4);
|
||||
riscv_socket_fdt_write_id(mc, clint_name, socket);
|
||||
riscv_socket_fdt_write_id(ms, clint_name, socket);
|
||||
|
||||
g_free(clint_name);
|
||||
g_free(clint_cells);
|
||||
g_free(clust_name);
|
||||
}
|
||||
|
||||
riscv_socket_fdt_write_distance_matrix(mc);
|
||||
riscv_socket_fdt_write_distance_matrix(ms);
|
||||
|
||||
qemu_fdt_add_subnode(fdt, "/chosen");
|
||||
qemu_fdt_setprop_string(fdt, "/chosen", "stdout-path", "/htif");
|
||||
@@ -324,9 +324,10 @@ static void spike_board_init(MachineState *machine)
|
||||
kernel_entry = 0;
|
||||
}
|
||||
|
||||
/* Compute the fdt load address in dram */
|
||||
fdt_load_addr = riscv_load_fdt(memmap[SPIKE_DRAM].base,
|
||||
machine->ram_size, machine->fdt);
|
||||
fdt_load_addr = riscv_compute_fdt_addr(memmap[SPIKE_DRAM].base,
|
||||
memmap[SPIKE_DRAM].size,
|
||||
machine);
|
||||
riscv_load_fdt(fdt_load_addr, machine->fdt);
|
||||
|
||||
/* load the reset vector */
|
||||
riscv_setup_rom_reset_vec(machine, &s->soc[0], memmap[SPIKE_DRAM].base,
|
||||
|
||||
476
hw/riscv/virt.c
476
hw/riscv/virt.c
@@ -227,7 +227,7 @@ static void create_fdt_socket_cpus(RISCVVirtState *s, int socket,
|
||||
{
|
||||
int cpu;
|
||||
uint32_t cpu_phandle;
|
||||
MachineState *mc = MACHINE(s);
|
||||
MachineState *ms = MACHINE(s);
|
||||
char *name, *cpu_name, *core_name, *intc_name;
|
||||
bool is_32_bit = riscv_is_32bit(&s->soc[0]);
|
||||
|
||||
@@ -236,40 +236,40 @@ static void create_fdt_socket_cpus(RISCVVirtState *s, int socket,
|
||||
|
||||
cpu_name = g_strdup_printf("/cpus/cpu@%d",
|
||||
s->soc[socket].hartid_base + cpu);
|
||||
qemu_fdt_add_subnode(mc->fdt, cpu_name);
|
||||
qemu_fdt_add_subnode(ms->fdt, cpu_name);
|
||||
if (riscv_feature(&s->soc[socket].harts[cpu].env,
|
||||
RISCV_FEATURE_MMU)) {
|
||||
qemu_fdt_setprop_string(mc->fdt, cpu_name, "mmu-type",
|
||||
qemu_fdt_setprop_string(ms->fdt, cpu_name, "mmu-type",
|
||||
(is_32_bit) ? "riscv,sv32" : "riscv,sv48");
|
||||
} else {
|
||||
qemu_fdt_setprop_string(mc->fdt, cpu_name, "mmu-type",
|
||||
qemu_fdt_setprop_string(ms->fdt, cpu_name, "mmu-type",
|
||||
"riscv,none");
|
||||
}
|
||||
name = riscv_isa_string(&s->soc[socket].harts[cpu]);
|
||||
qemu_fdt_setprop_string(mc->fdt, cpu_name, "riscv,isa", name);
|
||||
qemu_fdt_setprop_string(ms->fdt, cpu_name, "riscv,isa", name);
|
||||
g_free(name);
|
||||
qemu_fdt_setprop_string(mc->fdt, cpu_name, "compatible", "riscv");
|
||||
qemu_fdt_setprop_string(mc->fdt, cpu_name, "status", "okay");
|
||||
qemu_fdt_setprop_cell(mc->fdt, cpu_name, "reg",
|
||||
qemu_fdt_setprop_string(ms->fdt, cpu_name, "compatible", "riscv");
|
||||
qemu_fdt_setprop_string(ms->fdt, cpu_name, "status", "okay");
|
||||
qemu_fdt_setprop_cell(ms->fdt, cpu_name, "reg",
|
||||
s->soc[socket].hartid_base + cpu);
|
||||
qemu_fdt_setprop_string(mc->fdt, cpu_name, "device_type", "cpu");
|
||||
riscv_socket_fdt_write_id(mc, cpu_name, socket);
|
||||
qemu_fdt_setprop_cell(mc->fdt, cpu_name, "phandle", cpu_phandle);
|
||||
qemu_fdt_setprop_string(ms->fdt, cpu_name, "device_type", "cpu");
|
||||
riscv_socket_fdt_write_id(ms, cpu_name, socket);
|
||||
qemu_fdt_setprop_cell(ms->fdt, cpu_name, "phandle", cpu_phandle);
|
||||
|
||||
intc_phandles[cpu] = (*phandle)++;
|
||||
|
||||
intc_name = g_strdup_printf("%s/interrupt-controller", cpu_name);
|
||||
qemu_fdt_add_subnode(mc->fdt, intc_name);
|
||||
qemu_fdt_setprop_cell(mc->fdt, intc_name, "phandle",
|
||||
qemu_fdt_add_subnode(ms->fdt, intc_name);
|
||||
qemu_fdt_setprop_cell(ms->fdt, intc_name, "phandle",
|
||||
intc_phandles[cpu]);
|
||||
qemu_fdt_setprop_string(mc->fdt, intc_name, "compatible",
|
||||
qemu_fdt_setprop_string(ms->fdt, intc_name, "compatible",
|
||||
"riscv,cpu-intc");
|
||||
qemu_fdt_setprop(mc->fdt, intc_name, "interrupt-controller", NULL, 0);
|
||||
qemu_fdt_setprop_cell(mc->fdt, intc_name, "#interrupt-cells", 1);
|
||||
qemu_fdt_setprop(ms->fdt, intc_name, "interrupt-controller", NULL, 0);
|
||||
qemu_fdt_setprop_cell(ms->fdt, intc_name, "#interrupt-cells", 1);
|
||||
|
||||
core_name = g_strdup_printf("%s/core%d", clust_name, cpu);
|
||||
qemu_fdt_add_subnode(mc->fdt, core_name);
|
||||
qemu_fdt_setprop_cell(mc->fdt, core_name, "cpu", cpu_phandle);
|
||||
qemu_fdt_add_subnode(ms->fdt, core_name);
|
||||
qemu_fdt_setprop_cell(ms->fdt, core_name, "cpu", cpu_phandle);
|
||||
|
||||
g_free(core_name);
|
||||
g_free(intc_name);
|
||||
@@ -282,16 +282,16 @@ static void create_fdt_socket_memory(RISCVVirtState *s,
|
||||
{
|
||||
char *mem_name;
|
||||
uint64_t addr, size;
|
||||
MachineState *mc = MACHINE(s);
|
||||
MachineState *ms = MACHINE(s);
|
||||
|
||||
addr = memmap[VIRT_DRAM].base + riscv_socket_mem_offset(mc, socket);
|
||||
size = riscv_socket_mem_size(mc, socket);
|
||||
addr = memmap[VIRT_DRAM].base + riscv_socket_mem_offset(ms, socket);
|
||||
size = riscv_socket_mem_size(ms, socket);
|
||||
mem_name = g_strdup_printf("/memory@%lx", (long)addr);
|
||||
qemu_fdt_add_subnode(mc->fdt, mem_name);
|
||||
qemu_fdt_setprop_cells(mc->fdt, mem_name, "reg",
|
||||
qemu_fdt_add_subnode(ms->fdt, mem_name);
|
||||
qemu_fdt_setprop_cells(ms->fdt, mem_name, "reg",
|
||||
addr >> 32, addr, size >> 32, size);
|
||||
qemu_fdt_setprop_string(mc->fdt, mem_name, "device_type", "memory");
|
||||
riscv_socket_fdt_write_id(mc, mem_name, socket);
|
||||
qemu_fdt_setprop_string(ms->fdt, mem_name, "device_type", "memory");
|
||||
riscv_socket_fdt_write_id(ms, mem_name, socket);
|
||||
g_free(mem_name);
|
||||
}
|
||||
|
||||
@@ -303,7 +303,7 @@ static void create_fdt_socket_clint(RISCVVirtState *s,
|
||||
char *clint_name;
|
||||
uint32_t *clint_cells;
|
||||
unsigned long clint_addr;
|
||||
MachineState *mc = MACHINE(s);
|
||||
MachineState *ms = MACHINE(s);
|
||||
static const char * const clint_compat[2] = {
|
||||
"sifive,clint0", "riscv,clint0"
|
||||
};
|
||||
@@ -319,15 +319,15 @@ static void create_fdt_socket_clint(RISCVVirtState *s,
|
||||
|
||||
clint_addr = memmap[VIRT_CLINT].base + (memmap[VIRT_CLINT].size * socket);
|
||||
clint_name = g_strdup_printf("/soc/clint@%lx", clint_addr);
|
||||
qemu_fdt_add_subnode(mc->fdt, clint_name);
|
||||
qemu_fdt_setprop_string_array(mc->fdt, clint_name, "compatible",
|
||||
qemu_fdt_add_subnode(ms->fdt, clint_name);
|
||||
qemu_fdt_setprop_string_array(ms->fdt, clint_name, "compatible",
|
||||
(char **)&clint_compat,
|
||||
ARRAY_SIZE(clint_compat));
|
||||
qemu_fdt_setprop_cells(mc->fdt, clint_name, "reg",
|
||||
qemu_fdt_setprop_cells(ms->fdt, clint_name, "reg",
|
||||
0x0, clint_addr, 0x0, memmap[VIRT_CLINT].size);
|
||||
qemu_fdt_setprop(mc->fdt, clint_name, "interrupts-extended",
|
||||
qemu_fdt_setprop(ms->fdt, clint_name, "interrupts-extended",
|
||||
clint_cells, s->soc[socket].num_harts * sizeof(uint32_t) * 4);
|
||||
riscv_socket_fdt_write_id(mc, clint_name, socket);
|
||||
riscv_socket_fdt_write_id(ms, clint_name, socket);
|
||||
g_free(clint_name);
|
||||
|
||||
g_free(clint_cells);
|
||||
@@ -344,7 +344,7 @@ static void create_fdt_socket_aclint(RISCVVirtState *s,
|
||||
uint32_t *aclint_mswi_cells;
|
||||
uint32_t *aclint_sswi_cells;
|
||||
uint32_t *aclint_mtimer_cells;
|
||||
MachineState *mc = MACHINE(s);
|
||||
MachineState *ms = MACHINE(s);
|
||||
|
||||
aclint_mswi_cells = g_new0(uint32_t, s->soc[socket].num_harts * 2);
|
||||
aclint_mtimer_cells = g_new0(uint32_t, s->soc[socket].num_harts * 2);
|
||||
@@ -363,16 +363,16 @@ static void create_fdt_socket_aclint(RISCVVirtState *s,
|
||||
if (s->aia_type != VIRT_AIA_TYPE_APLIC_IMSIC) {
|
||||
addr = memmap[VIRT_CLINT].base + (memmap[VIRT_CLINT].size * socket);
|
||||
name = g_strdup_printf("/soc/mswi@%lx", addr);
|
||||
qemu_fdt_add_subnode(mc->fdt, name);
|
||||
qemu_fdt_setprop_string(mc->fdt, name, "compatible",
|
||||
qemu_fdt_add_subnode(ms->fdt, name);
|
||||
qemu_fdt_setprop_string(ms->fdt, name, "compatible",
|
||||
"riscv,aclint-mswi");
|
||||
qemu_fdt_setprop_cells(mc->fdt, name, "reg",
|
||||
qemu_fdt_setprop_cells(ms->fdt, name, "reg",
|
||||
0x0, addr, 0x0, RISCV_ACLINT_SWI_SIZE);
|
||||
qemu_fdt_setprop(mc->fdt, name, "interrupts-extended",
|
||||
qemu_fdt_setprop(ms->fdt, name, "interrupts-extended",
|
||||
aclint_mswi_cells, aclint_cells_size);
|
||||
qemu_fdt_setprop(mc->fdt, name, "interrupt-controller", NULL, 0);
|
||||
qemu_fdt_setprop_cell(mc->fdt, name, "#interrupt-cells", 0);
|
||||
riscv_socket_fdt_write_id(mc, name, socket);
|
||||
qemu_fdt_setprop(ms->fdt, name, "interrupt-controller", NULL, 0);
|
||||
qemu_fdt_setprop_cell(ms->fdt, name, "#interrupt-cells", 0);
|
||||
riscv_socket_fdt_write_id(ms, name, socket);
|
||||
g_free(name);
|
||||
}
|
||||
|
||||
@@ -386,33 +386,33 @@ static void create_fdt_socket_aclint(RISCVVirtState *s,
|
||||
size = memmap[VIRT_CLINT].size - RISCV_ACLINT_SWI_SIZE;
|
||||
}
|
||||
name = g_strdup_printf("/soc/mtimer@%lx", addr);
|
||||
qemu_fdt_add_subnode(mc->fdt, name);
|
||||
qemu_fdt_setprop_string(mc->fdt, name, "compatible",
|
||||
qemu_fdt_add_subnode(ms->fdt, name);
|
||||
qemu_fdt_setprop_string(ms->fdt, name, "compatible",
|
||||
"riscv,aclint-mtimer");
|
||||
qemu_fdt_setprop_cells(mc->fdt, name, "reg",
|
||||
qemu_fdt_setprop_cells(ms->fdt, name, "reg",
|
||||
0x0, addr + RISCV_ACLINT_DEFAULT_MTIME,
|
||||
0x0, size - RISCV_ACLINT_DEFAULT_MTIME,
|
||||
0x0, addr + RISCV_ACLINT_DEFAULT_MTIMECMP,
|
||||
0x0, RISCV_ACLINT_DEFAULT_MTIME);
|
||||
qemu_fdt_setprop(mc->fdt, name, "interrupts-extended",
|
||||
qemu_fdt_setprop(ms->fdt, name, "interrupts-extended",
|
||||
aclint_mtimer_cells, aclint_cells_size);
|
||||
riscv_socket_fdt_write_id(mc, name, socket);
|
||||
riscv_socket_fdt_write_id(ms, name, socket);
|
||||
g_free(name);
|
||||
|
||||
if (s->aia_type != VIRT_AIA_TYPE_APLIC_IMSIC) {
|
||||
addr = memmap[VIRT_ACLINT_SSWI].base +
|
||||
(memmap[VIRT_ACLINT_SSWI].size * socket);
|
||||
name = g_strdup_printf("/soc/sswi@%lx", addr);
|
||||
qemu_fdt_add_subnode(mc->fdt, name);
|
||||
qemu_fdt_setprop_string(mc->fdt, name, "compatible",
|
||||
qemu_fdt_add_subnode(ms->fdt, name);
|
||||
qemu_fdt_setprop_string(ms->fdt, name, "compatible",
|
||||
"riscv,aclint-sswi");
|
||||
qemu_fdt_setprop_cells(mc->fdt, name, "reg",
|
||||
qemu_fdt_setprop_cells(ms->fdt, name, "reg",
|
||||
0x0, addr, 0x0, memmap[VIRT_ACLINT_SSWI].size);
|
||||
qemu_fdt_setprop(mc->fdt, name, "interrupts-extended",
|
||||
qemu_fdt_setprop(ms->fdt, name, "interrupts-extended",
|
||||
aclint_sswi_cells, aclint_cells_size);
|
||||
qemu_fdt_setprop(mc->fdt, name, "interrupt-controller", NULL, 0);
|
||||
qemu_fdt_setprop_cell(mc->fdt, name, "#interrupt-cells", 0);
|
||||
riscv_socket_fdt_write_id(mc, name, socket);
|
||||
qemu_fdt_setprop(ms->fdt, name, "interrupt-controller", NULL, 0);
|
||||
qemu_fdt_setprop_cell(ms->fdt, name, "#interrupt-cells", 0);
|
||||
riscv_socket_fdt_write_id(ms, name, socket);
|
||||
g_free(name);
|
||||
}
|
||||
|
||||
@@ -430,7 +430,7 @@ static void create_fdt_socket_plic(RISCVVirtState *s,
|
||||
char *plic_name;
|
||||
uint32_t *plic_cells;
|
||||
unsigned long plic_addr;
|
||||
MachineState *mc = MACHINE(s);
|
||||
MachineState *ms = MACHINE(s);
|
||||
static const char * const plic_compat[2] = {
|
||||
"sifive,plic-1.0.0", "riscv,plic0"
|
||||
};
|
||||
@@ -456,27 +456,27 @@ static void create_fdt_socket_plic(RISCVVirtState *s,
|
||||
plic_phandles[socket] = (*phandle)++;
|
||||
plic_addr = memmap[VIRT_PLIC].base + (memmap[VIRT_PLIC].size * socket);
|
||||
plic_name = g_strdup_printf("/soc/plic@%lx", plic_addr);
|
||||
qemu_fdt_add_subnode(mc->fdt, plic_name);
|
||||
qemu_fdt_setprop_cell(mc->fdt, plic_name,
|
||||
qemu_fdt_add_subnode(ms->fdt, plic_name);
|
||||
qemu_fdt_setprop_cell(ms->fdt, plic_name,
|
||||
"#interrupt-cells", FDT_PLIC_INT_CELLS);
|
||||
qemu_fdt_setprop_cell(mc->fdt, plic_name,
|
||||
qemu_fdt_setprop_cell(ms->fdt, plic_name,
|
||||
"#address-cells", FDT_PLIC_ADDR_CELLS);
|
||||
qemu_fdt_setprop_string_array(mc->fdt, plic_name, "compatible",
|
||||
qemu_fdt_setprop_string_array(ms->fdt, plic_name, "compatible",
|
||||
(char **)&plic_compat,
|
||||
ARRAY_SIZE(plic_compat));
|
||||
qemu_fdt_setprop(mc->fdt, plic_name, "interrupt-controller", NULL, 0);
|
||||
qemu_fdt_setprop(mc->fdt, plic_name, "interrupts-extended",
|
||||
qemu_fdt_setprop(ms->fdt, plic_name, "interrupt-controller", NULL, 0);
|
||||
qemu_fdt_setprop(ms->fdt, plic_name, "interrupts-extended",
|
||||
plic_cells, s->soc[socket].num_harts * sizeof(uint32_t) * 4);
|
||||
qemu_fdt_setprop_cells(mc->fdt, plic_name, "reg",
|
||||
qemu_fdt_setprop_cells(ms->fdt, plic_name, "reg",
|
||||
0x0, plic_addr, 0x0, memmap[VIRT_PLIC].size);
|
||||
qemu_fdt_setprop_cell(mc->fdt, plic_name, "riscv,ndev",
|
||||
qemu_fdt_setprop_cell(ms->fdt, plic_name, "riscv,ndev",
|
||||
VIRT_IRQCHIP_NUM_SOURCES - 1);
|
||||
riscv_socket_fdt_write_id(mc, plic_name, socket);
|
||||
qemu_fdt_setprop_cell(mc->fdt, plic_name, "phandle",
|
||||
riscv_socket_fdt_write_id(ms, plic_name, socket);
|
||||
qemu_fdt_setprop_cell(ms->fdt, plic_name, "phandle",
|
||||
plic_phandles[socket]);
|
||||
|
||||
if (!socket) {
|
||||
platform_bus_add_all_fdt_nodes(mc->fdt, plic_name,
|
||||
platform_bus_add_all_fdt_nodes(ms->fdt, plic_name,
|
||||
memmap[VIRT_PLATFORM_BUS].base,
|
||||
memmap[VIRT_PLATFORM_BUS].size,
|
||||
VIRT_PLATFORM_BUS_IRQ);
|
||||
@@ -504,22 +504,23 @@ static void create_fdt_imsic(RISCVVirtState *s, const MemMapEntry *memmap,
|
||||
{
|
||||
int cpu, socket;
|
||||
char *imsic_name;
|
||||
MachineState *mc = MACHINE(s);
|
||||
MachineState *ms = MACHINE(s);
|
||||
int socket_count = riscv_socket_count(ms);
|
||||
uint32_t imsic_max_hart_per_socket, imsic_guest_bits;
|
||||
uint32_t *imsic_cells, *imsic_regs, imsic_addr, imsic_size;
|
||||
|
||||
*msi_m_phandle = (*phandle)++;
|
||||
*msi_s_phandle = (*phandle)++;
|
||||
imsic_cells = g_new0(uint32_t, mc->smp.cpus * 2);
|
||||
imsic_regs = g_new0(uint32_t, riscv_socket_count(mc) * 4);
|
||||
imsic_cells = g_new0(uint32_t, ms->smp.cpus * 2);
|
||||
imsic_regs = g_new0(uint32_t, socket_count * 4);
|
||||
|
||||
/* M-level IMSIC node */
|
||||
for (cpu = 0; cpu < mc->smp.cpus; cpu++) {
|
||||
for (cpu = 0; cpu < ms->smp.cpus; cpu++) {
|
||||
imsic_cells[cpu * 2 + 0] = cpu_to_be32(intc_phandles[cpu]);
|
||||
imsic_cells[cpu * 2 + 1] = cpu_to_be32(IRQ_M_EXT);
|
||||
}
|
||||
imsic_max_hart_per_socket = 0;
|
||||
for (socket = 0; socket < riscv_socket_count(mc); socket++) {
|
||||
for (socket = 0; socket < socket_count; socket++) {
|
||||
imsic_addr = memmap[VIRT_IMSIC_M].base +
|
||||
socket * VIRT_IMSIC_GROUP_MAX_SIZE;
|
||||
imsic_size = IMSIC_HART_SIZE(0) * s->soc[socket].num_harts;
|
||||
@@ -533,41 +534,41 @@ static void create_fdt_imsic(RISCVVirtState *s, const MemMapEntry *memmap,
|
||||
}
|
||||
imsic_name = g_strdup_printf("/soc/imsics@%lx",
|
||||
(unsigned long)memmap[VIRT_IMSIC_M].base);
|
||||
qemu_fdt_add_subnode(mc->fdt, imsic_name);
|
||||
qemu_fdt_setprop_string(mc->fdt, imsic_name, "compatible",
|
||||
qemu_fdt_add_subnode(ms->fdt, imsic_name);
|
||||
qemu_fdt_setprop_string(ms->fdt, imsic_name, "compatible",
|
||||
"riscv,imsics");
|
||||
qemu_fdt_setprop_cell(mc->fdt, imsic_name, "#interrupt-cells",
|
||||
qemu_fdt_setprop_cell(ms->fdt, imsic_name, "#interrupt-cells",
|
||||
FDT_IMSIC_INT_CELLS);
|
||||
qemu_fdt_setprop(mc->fdt, imsic_name, "interrupt-controller",
|
||||
qemu_fdt_setprop(ms->fdt, imsic_name, "interrupt-controller",
|
||||
NULL, 0);
|
||||
qemu_fdt_setprop(mc->fdt, imsic_name, "msi-controller",
|
||||
qemu_fdt_setprop(ms->fdt, imsic_name, "msi-controller",
|
||||
NULL, 0);
|
||||
qemu_fdt_setprop(mc->fdt, imsic_name, "interrupts-extended",
|
||||
imsic_cells, mc->smp.cpus * sizeof(uint32_t) * 2);
|
||||
qemu_fdt_setprop(mc->fdt, imsic_name, "reg", imsic_regs,
|
||||
riscv_socket_count(mc) * sizeof(uint32_t) * 4);
|
||||
qemu_fdt_setprop_cell(mc->fdt, imsic_name, "riscv,num-ids",
|
||||
qemu_fdt_setprop(ms->fdt, imsic_name, "interrupts-extended",
|
||||
imsic_cells, ms->smp.cpus * sizeof(uint32_t) * 2);
|
||||
qemu_fdt_setprop(ms->fdt, imsic_name, "reg", imsic_regs,
|
||||
socket_count * sizeof(uint32_t) * 4);
|
||||
qemu_fdt_setprop_cell(ms->fdt, imsic_name, "riscv,num-ids",
|
||||
VIRT_IRQCHIP_NUM_MSIS);
|
||||
if (riscv_socket_count(mc) > 1) {
|
||||
qemu_fdt_setprop_cell(mc->fdt, imsic_name, "riscv,hart-index-bits",
|
||||
if (socket_count > 1) {
|
||||
qemu_fdt_setprop_cell(ms->fdt, imsic_name, "riscv,hart-index-bits",
|
||||
imsic_num_bits(imsic_max_hart_per_socket));
|
||||
qemu_fdt_setprop_cell(mc->fdt, imsic_name, "riscv,group-index-bits",
|
||||
imsic_num_bits(riscv_socket_count(mc)));
|
||||
qemu_fdt_setprop_cell(mc->fdt, imsic_name, "riscv,group-index-shift",
|
||||
qemu_fdt_setprop_cell(ms->fdt, imsic_name, "riscv,group-index-bits",
|
||||
imsic_num_bits(socket_count));
|
||||
qemu_fdt_setprop_cell(ms->fdt, imsic_name, "riscv,group-index-shift",
|
||||
IMSIC_MMIO_GROUP_MIN_SHIFT);
|
||||
}
|
||||
qemu_fdt_setprop_cell(mc->fdt, imsic_name, "phandle", *msi_m_phandle);
|
||||
qemu_fdt_setprop_cell(ms->fdt, imsic_name, "phandle", *msi_m_phandle);
|
||||
|
||||
g_free(imsic_name);
|
||||
|
||||
/* S-level IMSIC node */
|
||||
for (cpu = 0; cpu < mc->smp.cpus; cpu++) {
|
||||
for (cpu = 0; cpu < ms->smp.cpus; cpu++) {
|
||||
imsic_cells[cpu * 2 + 0] = cpu_to_be32(intc_phandles[cpu]);
|
||||
imsic_cells[cpu * 2 + 1] = cpu_to_be32(IRQ_S_EXT);
|
||||
}
|
||||
imsic_guest_bits = imsic_num_bits(s->aia_guests + 1);
|
||||
imsic_max_hart_per_socket = 0;
|
||||
for (socket = 0; socket < riscv_socket_count(mc); socket++) {
|
||||
for (socket = 0; socket < socket_count; socket++) {
|
||||
imsic_addr = memmap[VIRT_IMSIC_S].base +
|
||||
socket * VIRT_IMSIC_GROUP_MAX_SIZE;
|
||||
imsic_size = IMSIC_HART_SIZE(imsic_guest_bits) *
|
||||
@@ -582,34 +583,34 @@ static void create_fdt_imsic(RISCVVirtState *s, const MemMapEntry *memmap,
|
||||
}
|
||||
imsic_name = g_strdup_printf("/soc/imsics@%lx",
|
||||
(unsigned long)memmap[VIRT_IMSIC_S].base);
|
||||
qemu_fdt_add_subnode(mc->fdt, imsic_name);
|
||||
qemu_fdt_setprop_string(mc->fdt, imsic_name, "compatible",
|
||||
qemu_fdt_add_subnode(ms->fdt, imsic_name);
|
||||
qemu_fdt_setprop_string(ms->fdt, imsic_name, "compatible",
|
||||
"riscv,imsics");
|
||||
qemu_fdt_setprop_cell(mc->fdt, imsic_name, "#interrupt-cells",
|
||||
qemu_fdt_setprop_cell(ms->fdt, imsic_name, "#interrupt-cells",
|
||||
FDT_IMSIC_INT_CELLS);
|
||||
qemu_fdt_setprop(mc->fdt, imsic_name, "interrupt-controller",
|
||||
qemu_fdt_setprop(ms->fdt, imsic_name, "interrupt-controller",
|
||||
NULL, 0);
|
||||
qemu_fdt_setprop(mc->fdt, imsic_name, "msi-controller",
|
||||
qemu_fdt_setprop(ms->fdt, imsic_name, "msi-controller",
|
||||
NULL, 0);
|
||||
qemu_fdt_setprop(mc->fdt, imsic_name, "interrupts-extended",
|
||||
imsic_cells, mc->smp.cpus * sizeof(uint32_t) * 2);
|
||||
qemu_fdt_setprop(mc->fdt, imsic_name, "reg", imsic_regs,
|
||||
riscv_socket_count(mc) * sizeof(uint32_t) * 4);
|
||||
qemu_fdt_setprop_cell(mc->fdt, imsic_name, "riscv,num-ids",
|
||||
qemu_fdt_setprop(ms->fdt, imsic_name, "interrupts-extended",
|
||||
imsic_cells, ms->smp.cpus * sizeof(uint32_t) * 2);
|
||||
qemu_fdt_setprop(ms->fdt, imsic_name, "reg", imsic_regs,
|
||||
socket_count * sizeof(uint32_t) * 4);
|
||||
qemu_fdt_setprop_cell(ms->fdt, imsic_name, "riscv,num-ids",
|
||||
VIRT_IRQCHIP_NUM_MSIS);
|
||||
if (imsic_guest_bits) {
|
||||
qemu_fdt_setprop_cell(mc->fdt, imsic_name, "riscv,guest-index-bits",
|
||||
qemu_fdt_setprop_cell(ms->fdt, imsic_name, "riscv,guest-index-bits",
|
||||
imsic_guest_bits);
|
||||
}
|
||||
if (riscv_socket_count(mc) > 1) {
|
||||
qemu_fdt_setprop_cell(mc->fdt, imsic_name, "riscv,hart-index-bits",
|
||||
if (socket_count > 1) {
|
||||
qemu_fdt_setprop_cell(ms->fdt, imsic_name, "riscv,hart-index-bits",
|
||||
imsic_num_bits(imsic_max_hart_per_socket));
|
||||
qemu_fdt_setprop_cell(mc->fdt, imsic_name, "riscv,group-index-bits",
|
||||
imsic_num_bits(riscv_socket_count(mc)));
|
||||
qemu_fdt_setprop_cell(mc->fdt, imsic_name, "riscv,group-index-shift",
|
||||
qemu_fdt_setprop_cell(ms->fdt, imsic_name, "riscv,group-index-bits",
|
||||
imsic_num_bits(socket_count));
|
||||
qemu_fdt_setprop_cell(ms->fdt, imsic_name, "riscv,group-index-shift",
|
||||
IMSIC_MMIO_GROUP_MIN_SHIFT);
|
||||
}
|
||||
qemu_fdt_setprop_cell(mc->fdt, imsic_name, "phandle", *msi_s_phandle);
|
||||
qemu_fdt_setprop_cell(ms->fdt, imsic_name, "phandle", *msi_s_phandle);
|
||||
g_free(imsic_name);
|
||||
|
||||
g_free(imsic_regs);
|
||||
@@ -628,7 +629,7 @@ static void create_fdt_socket_aplic(RISCVVirtState *s,
|
||||
char *aplic_name;
|
||||
uint32_t *aplic_cells;
|
||||
unsigned long aplic_addr;
|
||||
MachineState *mc = MACHINE(s);
|
||||
MachineState *ms = MACHINE(s);
|
||||
uint32_t aplic_m_phandle, aplic_s_phandle;
|
||||
|
||||
aplic_m_phandle = (*phandle)++;
|
||||
@@ -643,28 +644,28 @@ static void create_fdt_socket_aplic(RISCVVirtState *s,
|
||||
aplic_addr = memmap[VIRT_APLIC_M].base +
|
||||
(memmap[VIRT_APLIC_M].size * socket);
|
||||
aplic_name = g_strdup_printf("/soc/aplic@%lx", aplic_addr);
|
||||
qemu_fdt_add_subnode(mc->fdt, aplic_name);
|
||||
qemu_fdt_setprop_string(mc->fdt, aplic_name, "compatible", "riscv,aplic");
|
||||
qemu_fdt_setprop_cell(mc->fdt, aplic_name,
|
||||
qemu_fdt_add_subnode(ms->fdt, aplic_name);
|
||||
qemu_fdt_setprop_string(ms->fdt, aplic_name, "compatible", "riscv,aplic");
|
||||
qemu_fdt_setprop_cell(ms->fdt, aplic_name,
|
||||
"#interrupt-cells", FDT_APLIC_INT_CELLS);
|
||||
qemu_fdt_setprop(mc->fdt, aplic_name, "interrupt-controller", NULL, 0);
|
||||
qemu_fdt_setprop(ms->fdt, aplic_name, "interrupt-controller", NULL, 0);
|
||||
if (s->aia_type == VIRT_AIA_TYPE_APLIC) {
|
||||
qemu_fdt_setprop(mc->fdt, aplic_name, "interrupts-extended",
|
||||
qemu_fdt_setprop(ms->fdt, aplic_name, "interrupts-extended",
|
||||
aplic_cells, s->soc[socket].num_harts * sizeof(uint32_t) * 2);
|
||||
} else {
|
||||
qemu_fdt_setprop_cell(mc->fdt, aplic_name, "msi-parent",
|
||||
qemu_fdt_setprop_cell(ms->fdt, aplic_name, "msi-parent",
|
||||
msi_m_phandle);
|
||||
}
|
||||
qemu_fdt_setprop_cells(mc->fdt, aplic_name, "reg",
|
||||
qemu_fdt_setprop_cells(ms->fdt, aplic_name, "reg",
|
||||
0x0, aplic_addr, 0x0, memmap[VIRT_APLIC_M].size);
|
||||
qemu_fdt_setprop_cell(mc->fdt, aplic_name, "riscv,num-sources",
|
||||
qemu_fdt_setprop_cell(ms->fdt, aplic_name, "riscv,num-sources",
|
||||
VIRT_IRQCHIP_NUM_SOURCES);
|
||||
qemu_fdt_setprop_cell(mc->fdt, aplic_name, "riscv,children",
|
||||
qemu_fdt_setprop_cell(ms->fdt, aplic_name, "riscv,children",
|
||||
aplic_s_phandle);
|
||||
qemu_fdt_setprop_cells(mc->fdt, aplic_name, "riscv,delegate",
|
||||
qemu_fdt_setprop_cells(ms->fdt, aplic_name, "riscv,delegate",
|
||||
aplic_s_phandle, 0x1, VIRT_IRQCHIP_NUM_SOURCES);
|
||||
riscv_socket_fdt_write_id(mc, aplic_name, socket);
|
||||
qemu_fdt_setprop_cell(mc->fdt, aplic_name, "phandle", aplic_m_phandle);
|
||||
riscv_socket_fdt_write_id(ms, aplic_name, socket);
|
||||
qemu_fdt_setprop_cell(ms->fdt, aplic_name, "phandle", aplic_m_phandle);
|
||||
g_free(aplic_name);
|
||||
|
||||
/* S-level APLIC node */
|
||||
@@ -675,27 +676,27 @@ static void create_fdt_socket_aplic(RISCVVirtState *s,
|
||||
aplic_addr = memmap[VIRT_APLIC_S].base +
|
||||
(memmap[VIRT_APLIC_S].size * socket);
|
||||
aplic_name = g_strdup_printf("/soc/aplic@%lx", aplic_addr);
|
||||
qemu_fdt_add_subnode(mc->fdt, aplic_name);
|
||||
qemu_fdt_setprop_string(mc->fdt, aplic_name, "compatible", "riscv,aplic");
|
||||
qemu_fdt_setprop_cell(mc->fdt, aplic_name,
|
||||
qemu_fdt_add_subnode(ms->fdt, aplic_name);
|
||||
qemu_fdt_setprop_string(ms->fdt, aplic_name, "compatible", "riscv,aplic");
|
||||
qemu_fdt_setprop_cell(ms->fdt, aplic_name,
|
||||
"#interrupt-cells", FDT_APLIC_INT_CELLS);
|
||||
qemu_fdt_setprop(mc->fdt, aplic_name, "interrupt-controller", NULL, 0);
|
||||
qemu_fdt_setprop(ms->fdt, aplic_name, "interrupt-controller", NULL, 0);
|
||||
if (s->aia_type == VIRT_AIA_TYPE_APLIC) {
|
||||
qemu_fdt_setprop(mc->fdt, aplic_name, "interrupts-extended",
|
||||
qemu_fdt_setprop(ms->fdt, aplic_name, "interrupts-extended",
|
||||
aplic_cells, s->soc[socket].num_harts * sizeof(uint32_t) * 2);
|
||||
} else {
|
||||
qemu_fdt_setprop_cell(mc->fdt, aplic_name, "msi-parent",
|
||||
qemu_fdt_setprop_cell(ms->fdt, aplic_name, "msi-parent",
|
||||
msi_s_phandle);
|
||||
}
|
||||
qemu_fdt_setprop_cells(mc->fdt, aplic_name, "reg",
|
||||
qemu_fdt_setprop_cells(ms->fdt, aplic_name, "reg",
|
||||
0x0, aplic_addr, 0x0, memmap[VIRT_APLIC_S].size);
|
||||
qemu_fdt_setprop_cell(mc->fdt, aplic_name, "riscv,num-sources",
|
||||
qemu_fdt_setprop_cell(ms->fdt, aplic_name, "riscv,num-sources",
|
||||
VIRT_IRQCHIP_NUM_SOURCES);
|
||||
riscv_socket_fdt_write_id(mc, aplic_name, socket);
|
||||
qemu_fdt_setprop_cell(mc->fdt, aplic_name, "phandle", aplic_s_phandle);
|
||||
riscv_socket_fdt_write_id(ms, aplic_name, socket);
|
||||
qemu_fdt_setprop_cell(ms->fdt, aplic_name, "phandle", aplic_s_phandle);
|
||||
|
||||
if (!socket) {
|
||||
platform_bus_add_all_fdt_nodes(mc->fdt, aplic_name,
|
||||
platform_bus_add_all_fdt_nodes(ms->fdt, aplic_name,
|
||||
memmap[VIRT_PLATFORM_BUS].base,
|
||||
memmap[VIRT_PLATFORM_BUS].size,
|
||||
VIRT_PLATFORM_BUS_IRQ);
|
||||
@@ -710,13 +711,13 @@ static void create_fdt_socket_aplic(RISCVVirtState *s,
|
||||
static void create_fdt_pmu(RISCVVirtState *s)
|
||||
{
|
||||
char *pmu_name;
|
||||
MachineState *mc = MACHINE(s);
|
||||
MachineState *ms = MACHINE(s);
|
||||
RISCVCPU hart = s->soc[0].harts[0];
|
||||
|
||||
pmu_name = g_strdup_printf("/soc/pmu");
|
||||
qemu_fdt_add_subnode(mc->fdt, pmu_name);
|
||||
qemu_fdt_setprop_string(mc->fdt, pmu_name, "compatible", "riscv,pmu");
|
||||
riscv_pmu_generate_fdt_node(mc->fdt, hart.cfg.pmu_num, pmu_name);
|
||||
qemu_fdt_add_subnode(ms->fdt, pmu_name);
|
||||
qemu_fdt_setprop_string(ms->fdt, pmu_name, "compatible", "riscv,pmu");
|
||||
riscv_pmu_generate_fdt_node(ms->fdt, hart.cfg.pmu_num, pmu_name);
|
||||
|
||||
g_free(pmu_name);
|
||||
}
|
||||
@@ -730,25 +731,26 @@ static void create_fdt_sockets(RISCVVirtState *s, const MemMapEntry *memmap,
|
||||
{
|
||||
char *clust_name;
|
||||
int socket, phandle_pos;
|
||||
MachineState *mc = MACHINE(s);
|
||||
MachineState *ms = MACHINE(s);
|
||||
uint32_t msi_m_phandle = 0, msi_s_phandle = 0;
|
||||
uint32_t *intc_phandles, xplic_phandles[MAX_NODES];
|
||||
int socket_count = riscv_socket_count(ms);
|
||||
|
||||
qemu_fdt_add_subnode(mc->fdt, "/cpus");
|
||||
qemu_fdt_setprop_cell(mc->fdt, "/cpus", "timebase-frequency",
|
||||
qemu_fdt_add_subnode(ms->fdt, "/cpus");
|
||||
qemu_fdt_setprop_cell(ms->fdt, "/cpus", "timebase-frequency",
|
||||
RISCV_ACLINT_DEFAULT_TIMEBASE_FREQ);
|
||||
qemu_fdt_setprop_cell(mc->fdt, "/cpus", "#size-cells", 0x0);
|
||||
qemu_fdt_setprop_cell(mc->fdt, "/cpus", "#address-cells", 0x1);
|
||||
qemu_fdt_add_subnode(mc->fdt, "/cpus/cpu-map");
|
||||
qemu_fdt_setprop_cell(ms->fdt, "/cpus", "#size-cells", 0x0);
|
||||
qemu_fdt_setprop_cell(ms->fdt, "/cpus", "#address-cells", 0x1);
|
||||
qemu_fdt_add_subnode(ms->fdt, "/cpus/cpu-map");
|
||||
|
||||
intc_phandles = g_new0(uint32_t, mc->smp.cpus);
|
||||
intc_phandles = g_new0(uint32_t, ms->smp.cpus);
|
||||
|
||||
phandle_pos = mc->smp.cpus;
|
||||
for (socket = (riscv_socket_count(mc) - 1); socket >= 0; socket--) {
|
||||
phandle_pos = ms->smp.cpus;
|
||||
for (socket = (socket_count - 1); socket >= 0; socket--) {
|
||||
phandle_pos -= s->soc[socket].num_harts;
|
||||
|
||||
clust_name = g_strdup_printf("/cpus/cpu-map/cluster%d", socket);
|
||||
qemu_fdt_add_subnode(mc->fdt, clust_name);
|
||||
qemu_fdt_add_subnode(ms->fdt, clust_name);
|
||||
|
||||
create_fdt_socket_cpus(s, socket, clust_name, phandle,
|
||||
&intc_phandles[phandle_pos]);
|
||||
@@ -774,8 +776,8 @@ static void create_fdt_sockets(RISCVVirtState *s, const MemMapEntry *memmap,
|
||||
*msi_pcie_phandle = msi_s_phandle;
|
||||
}
|
||||
|
||||
phandle_pos = mc->smp.cpus;
|
||||
for (socket = (riscv_socket_count(mc) - 1); socket >= 0; socket--) {
|
||||
phandle_pos = ms->smp.cpus;
|
||||
for (socket = (socket_count - 1); socket >= 0; socket--) {
|
||||
phandle_pos -= s->soc[socket].num_harts;
|
||||
|
||||
if (s->aia_type == VIRT_AIA_TYPE_NONE) {
|
||||
@@ -790,7 +792,7 @@ static void create_fdt_sockets(RISCVVirtState *s, const MemMapEntry *memmap,
|
||||
|
||||
g_free(intc_phandles);
|
||||
|
||||
for (socket = 0; socket < riscv_socket_count(mc); socket++) {
|
||||
for (socket = 0; socket < socket_count; socket++) {
|
||||
if (socket == 0) {
|
||||
*irq_mmio_phandle = xplic_phandles[socket];
|
||||
*irq_virtio_phandle = xplic_phandles[socket];
|
||||
@@ -805,7 +807,7 @@ static void create_fdt_sockets(RISCVVirtState *s, const MemMapEntry *memmap,
|
||||
}
|
||||
}
|
||||
|
||||
riscv_socket_fdt_write_distance_matrix(mc);
|
||||
riscv_socket_fdt_write_distance_matrix(ms);
|
||||
}
|
||||
|
||||
static void create_fdt_virtio(RISCVVirtState *s, const MemMapEntry *memmap,
|
||||
@@ -813,23 +815,23 @@ static void create_fdt_virtio(RISCVVirtState *s, const MemMapEntry *memmap,
|
||||
{
|
||||
int i;
|
||||
char *name;
|
||||
MachineState *mc = MACHINE(s);
|
||||
MachineState *ms = MACHINE(s);
|
||||
|
||||
for (i = 0; i < VIRTIO_COUNT; i++) {
|
||||
name = g_strdup_printf("/soc/virtio_mmio@%lx",
|
||||
(long)(memmap[VIRT_VIRTIO].base + i * memmap[VIRT_VIRTIO].size));
|
||||
qemu_fdt_add_subnode(mc->fdt, name);
|
||||
qemu_fdt_setprop_string(mc->fdt, name, "compatible", "virtio,mmio");
|
||||
qemu_fdt_setprop_cells(mc->fdt, name, "reg",
|
||||
qemu_fdt_add_subnode(ms->fdt, name);
|
||||
qemu_fdt_setprop_string(ms->fdt, name, "compatible", "virtio,mmio");
|
||||
qemu_fdt_setprop_cells(ms->fdt, name, "reg",
|
||||
0x0, memmap[VIRT_VIRTIO].base + i * memmap[VIRT_VIRTIO].size,
|
||||
0x0, memmap[VIRT_VIRTIO].size);
|
||||
qemu_fdt_setprop_cell(mc->fdt, name, "interrupt-parent",
|
||||
qemu_fdt_setprop_cell(ms->fdt, name, "interrupt-parent",
|
||||
irq_virtio_phandle);
|
||||
if (s->aia_type == VIRT_AIA_TYPE_NONE) {
|
||||
qemu_fdt_setprop_cell(mc->fdt, name, "interrupts",
|
||||
qemu_fdt_setprop_cell(ms->fdt, name, "interrupts",
|
||||
VIRTIO_IRQ + i);
|
||||
} else {
|
||||
qemu_fdt_setprop_cells(mc->fdt, name, "interrupts",
|
||||
qemu_fdt_setprop_cells(ms->fdt, name, "interrupts",
|
||||
VIRTIO_IRQ + i, 0x4);
|
||||
}
|
||||
g_free(name);
|
||||
@@ -841,29 +843,29 @@ static void create_fdt_pcie(RISCVVirtState *s, const MemMapEntry *memmap,
|
||||
uint32_t msi_pcie_phandle)
|
||||
{
|
||||
char *name;
|
||||
MachineState *mc = MACHINE(s);
|
||||
MachineState *ms = MACHINE(s);
|
||||
|
||||
name = g_strdup_printf("/soc/pci@%lx",
|
||||
(long) memmap[VIRT_PCIE_ECAM].base);
|
||||
qemu_fdt_add_subnode(mc->fdt, name);
|
||||
qemu_fdt_setprop_cell(mc->fdt, name, "#address-cells",
|
||||
qemu_fdt_add_subnode(ms->fdt, name);
|
||||
qemu_fdt_setprop_cell(ms->fdt, name, "#address-cells",
|
||||
FDT_PCI_ADDR_CELLS);
|
||||
qemu_fdt_setprop_cell(mc->fdt, name, "#interrupt-cells",
|
||||
qemu_fdt_setprop_cell(ms->fdt, name, "#interrupt-cells",
|
||||
FDT_PCI_INT_CELLS);
|
||||
qemu_fdt_setprop_cell(mc->fdt, name, "#size-cells", 0x2);
|
||||
qemu_fdt_setprop_string(mc->fdt, name, "compatible",
|
||||
qemu_fdt_setprop_cell(ms->fdt, name, "#size-cells", 0x2);
|
||||
qemu_fdt_setprop_string(ms->fdt, name, "compatible",
|
||||
"pci-host-ecam-generic");
|
||||
qemu_fdt_setprop_string(mc->fdt, name, "device_type", "pci");
|
||||
qemu_fdt_setprop_cell(mc->fdt, name, "linux,pci-domain", 0);
|
||||
qemu_fdt_setprop_cells(mc->fdt, name, "bus-range", 0,
|
||||
qemu_fdt_setprop_string(ms->fdt, name, "device_type", "pci");
|
||||
qemu_fdt_setprop_cell(ms->fdt, name, "linux,pci-domain", 0);
|
||||
qemu_fdt_setprop_cells(ms->fdt, name, "bus-range", 0,
|
||||
memmap[VIRT_PCIE_ECAM].size / PCIE_MMCFG_SIZE_MIN - 1);
|
||||
qemu_fdt_setprop(mc->fdt, name, "dma-coherent", NULL, 0);
|
||||
qemu_fdt_setprop(ms->fdt, name, "dma-coherent", NULL, 0);
|
||||
if (s->aia_type == VIRT_AIA_TYPE_APLIC_IMSIC) {
|
||||
qemu_fdt_setprop_cell(mc->fdt, name, "msi-parent", msi_pcie_phandle);
|
||||
qemu_fdt_setprop_cell(ms->fdt, name, "msi-parent", msi_pcie_phandle);
|
||||
}
|
||||
qemu_fdt_setprop_cells(mc->fdt, name, "reg", 0,
|
||||
qemu_fdt_setprop_cells(ms->fdt, name, "reg", 0,
|
||||
memmap[VIRT_PCIE_ECAM].base, 0, memmap[VIRT_PCIE_ECAM].size);
|
||||
qemu_fdt_setprop_sized_cells(mc->fdt, name, "ranges",
|
||||
qemu_fdt_setprop_sized_cells(ms->fdt, name, "ranges",
|
||||
1, FDT_PCI_RANGE_IOPORT, 2, 0,
|
||||
2, memmap[VIRT_PCIE_PIO].base, 2, memmap[VIRT_PCIE_PIO].size,
|
||||
1, FDT_PCI_RANGE_MMIO,
|
||||
@@ -873,7 +875,7 @@ static void create_fdt_pcie(RISCVVirtState *s, const MemMapEntry *memmap,
|
||||
2, virt_high_pcie_memmap.base,
|
||||
2, virt_high_pcie_memmap.base, 2, virt_high_pcie_memmap.size);
|
||||
|
||||
create_pcie_irq_map(s, mc->fdt, name, irq_pcie_phandle);
|
||||
create_pcie_irq_map(s, ms->fdt, name, irq_pcie_phandle);
|
||||
g_free(name);
|
||||
}
|
||||
|
||||
@@ -882,39 +884,39 @@ static void create_fdt_reset(RISCVVirtState *s, const MemMapEntry *memmap,
|
||||
{
|
||||
char *name;
|
||||
uint32_t test_phandle;
|
||||
MachineState *mc = MACHINE(s);
|
||||
MachineState *ms = MACHINE(s);
|
||||
|
||||
test_phandle = (*phandle)++;
|
||||
name = g_strdup_printf("/soc/test@%lx",
|
||||
(long)memmap[VIRT_TEST].base);
|
||||
qemu_fdt_add_subnode(mc->fdt, name);
|
||||
qemu_fdt_add_subnode(ms->fdt, name);
|
||||
{
|
||||
static const char * const compat[3] = {
|
||||
"sifive,test1", "sifive,test0", "syscon"
|
||||
};
|
||||
qemu_fdt_setprop_string_array(mc->fdt, name, "compatible",
|
||||
qemu_fdt_setprop_string_array(ms->fdt, name, "compatible",
|
||||
(char **)&compat, ARRAY_SIZE(compat));
|
||||
}
|
||||
qemu_fdt_setprop_cells(mc->fdt, name, "reg",
|
||||
qemu_fdt_setprop_cells(ms->fdt, name, "reg",
|
||||
0x0, memmap[VIRT_TEST].base, 0x0, memmap[VIRT_TEST].size);
|
||||
qemu_fdt_setprop_cell(mc->fdt, name, "phandle", test_phandle);
|
||||
test_phandle = qemu_fdt_get_phandle(mc->fdt, name);
|
||||
qemu_fdt_setprop_cell(ms->fdt, name, "phandle", test_phandle);
|
||||
test_phandle = qemu_fdt_get_phandle(ms->fdt, name);
|
||||
g_free(name);
|
||||
|
||||
name = g_strdup_printf("/reboot");
|
||||
qemu_fdt_add_subnode(mc->fdt, name);
|
||||
qemu_fdt_setprop_string(mc->fdt, name, "compatible", "syscon-reboot");
|
||||
qemu_fdt_setprop_cell(mc->fdt, name, "regmap", test_phandle);
|
||||
qemu_fdt_setprop_cell(mc->fdt, name, "offset", 0x0);
|
||||
qemu_fdt_setprop_cell(mc->fdt, name, "value", FINISHER_RESET);
|
||||
qemu_fdt_add_subnode(ms->fdt, name);
|
||||
qemu_fdt_setprop_string(ms->fdt, name, "compatible", "syscon-reboot");
|
||||
qemu_fdt_setprop_cell(ms->fdt, name, "regmap", test_phandle);
|
||||
qemu_fdt_setprop_cell(ms->fdt, name, "offset", 0x0);
|
||||
qemu_fdt_setprop_cell(ms->fdt, name, "value", FINISHER_RESET);
|
||||
g_free(name);
|
||||
|
||||
name = g_strdup_printf("/poweroff");
|
||||
qemu_fdt_add_subnode(mc->fdt, name);
|
||||
qemu_fdt_setprop_string(mc->fdt, name, "compatible", "syscon-poweroff");
|
||||
qemu_fdt_setprop_cell(mc->fdt, name, "regmap", test_phandle);
|
||||
qemu_fdt_setprop_cell(mc->fdt, name, "offset", 0x0);
|
||||
qemu_fdt_setprop_cell(mc->fdt, name, "value", FINISHER_PASS);
|
||||
qemu_fdt_add_subnode(ms->fdt, name);
|
||||
qemu_fdt_setprop_string(ms->fdt, name, "compatible", "syscon-poweroff");
|
||||
qemu_fdt_setprop_cell(ms->fdt, name, "regmap", test_phandle);
|
||||
qemu_fdt_setprop_cell(ms->fdt, name, "offset", 0x0);
|
||||
qemu_fdt_setprop_cell(ms->fdt, name, "value", FINISHER_PASS);
|
||||
g_free(name);
|
||||
}
|
||||
|
||||
@@ -922,24 +924,24 @@ static void create_fdt_uart(RISCVVirtState *s, const MemMapEntry *memmap,
|
||||
uint32_t irq_mmio_phandle)
|
||||
{
|
||||
char *name;
|
||||
MachineState *mc = MACHINE(s);
|
||||
MachineState *ms = MACHINE(s);
|
||||
|
||||
name = g_strdup_printf("/soc/serial@%lx", (long)memmap[VIRT_UART0].base);
|
||||
qemu_fdt_add_subnode(mc->fdt, name);
|
||||
qemu_fdt_setprop_string(mc->fdt, name, "compatible", "ns16550a");
|
||||
qemu_fdt_setprop_cells(mc->fdt, name, "reg",
|
||||
qemu_fdt_add_subnode(ms->fdt, name);
|
||||
qemu_fdt_setprop_string(ms->fdt, name, "compatible", "ns16550a");
|
||||
qemu_fdt_setprop_cells(ms->fdt, name, "reg",
|
||||
0x0, memmap[VIRT_UART0].base,
|
||||
0x0, memmap[VIRT_UART0].size);
|
||||
qemu_fdt_setprop_cell(mc->fdt, name, "clock-frequency", 3686400);
|
||||
qemu_fdt_setprop_cell(mc->fdt, name, "interrupt-parent", irq_mmio_phandle);
|
||||
qemu_fdt_setprop_cell(ms->fdt, name, "clock-frequency", 3686400);
|
||||
qemu_fdt_setprop_cell(ms->fdt, name, "interrupt-parent", irq_mmio_phandle);
|
||||
if (s->aia_type == VIRT_AIA_TYPE_NONE) {
|
||||
qemu_fdt_setprop_cell(mc->fdt, name, "interrupts", UART0_IRQ);
|
||||
qemu_fdt_setprop_cell(ms->fdt, name, "interrupts", UART0_IRQ);
|
||||
} else {
|
||||
qemu_fdt_setprop_cells(mc->fdt, name, "interrupts", UART0_IRQ, 0x4);
|
||||
qemu_fdt_setprop_cells(ms->fdt, name, "interrupts", UART0_IRQ, 0x4);
|
||||
}
|
||||
|
||||
qemu_fdt_add_subnode(mc->fdt, "/chosen");
|
||||
qemu_fdt_setprop_string(mc->fdt, "/chosen", "stdout-path", name);
|
||||
qemu_fdt_add_subnode(ms->fdt, "/chosen");
|
||||
qemu_fdt_setprop_string(ms->fdt, "/chosen", "stdout-path", name);
|
||||
g_free(name);
|
||||
}
|
||||
|
||||
@@ -947,20 +949,20 @@ static void create_fdt_rtc(RISCVVirtState *s, const MemMapEntry *memmap,
|
||||
uint32_t irq_mmio_phandle)
|
||||
{
|
||||
char *name;
|
||||
MachineState *mc = MACHINE(s);
|
||||
MachineState *ms = MACHINE(s);
|
||||
|
||||
name = g_strdup_printf("/soc/rtc@%lx", (long)memmap[VIRT_RTC].base);
|
||||
qemu_fdt_add_subnode(mc->fdt, name);
|
||||
qemu_fdt_setprop_string(mc->fdt, name, "compatible",
|
||||
qemu_fdt_add_subnode(ms->fdt, name);
|
||||
qemu_fdt_setprop_string(ms->fdt, name, "compatible",
|
||||
"google,goldfish-rtc");
|
||||
qemu_fdt_setprop_cells(mc->fdt, name, "reg",
|
||||
qemu_fdt_setprop_cells(ms->fdt, name, "reg",
|
||||
0x0, memmap[VIRT_RTC].base, 0x0, memmap[VIRT_RTC].size);
|
||||
qemu_fdt_setprop_cell(mc->fdt, name, "interrupt-parent",
|
||||
qemu_fdt_setprop_cell(ms->fdt, name, "interrupt-parent",
|
||||
irq_mmio_phandle);
|
||||
if (s->aia_type == VIRT_AIA_TYPE_NONE) {
|
||||
qemu_fdt_setprop_cell(mc->fdt, name, "interrupts", RTC_IRQ);
|
||||
qemu_fdt_setprop_cell(ms->fdt, name, "interrupts", RTC_IRQ);
|
||||
} else {
|
||||
qemu_fdt_setprop_cells(mc->fdt, name, "interrupts", RTC_IRQ, 0x4);
|
||||
qemu_fdt_setprop_cells(ms->fdt, name, "interrupts", RTC_IRQ, 0x4);
|
||||
}
|
||||
g_free(name);
|
||||
}
|
||||
@@ -968,68 +970,68 @@ static void create_fdt_rtc(RISCVVirtState *s, const MemMapEntry *memmap,
|
||||
static void create_fdt_flash(RISCVVirtState *s, const MemMapEntry *memmap)
|
||||
{
|
||||
char *name;
|
||||
MachineState *mc = MACHINE(s);
|
||||
MachineState *ms = MACHINE(s);
|
||||
hwaddr flashsize = virt_memmap[VIRT_FLASH].size / 2;
|
||||
hwaddr flashbase = virt_memmap[VIRT_FLASH].base;
|
||||
|
||||
name = g_strdup_printf("/flash@%" PRIx64, flashbase);
|
||||
qemu_fdt_add_subnode(mc->fdt, name);
|
||||
qemu_fdt_setprop_string(mc->fdt, name, "compatible", "cfi-flash");
|
||||
qemu_fdt_setprop_sized_cells(mc->fdt, name, "reg",
|
||||
qemu_fdt_add_subnode(ms->fdt, name);
|
||||
qemu_fdt_setprop_string(ms->fdt, name, "compatible", "cfi-flash");
|
||||
qemu_fdt_setprop_sized_cells(ms->fdt, name, "reg",
|
||||
2, flashbase, 2, flashsize,
|
||||
2, flashbase + flashsize, 2, flashsize);
|
||||
qemu_fdt_setprop_cell(mc->fdt, name, "bank-width", 4);
|
||||
qemu_fdt_setprop_cell(ms->fdt, name, "bank-width", 4);
|
||||
g_free(name);
|
||||
}
|
||||
|
||||
static void create_fdt_fw_cfg(RISCVVirtState *s, const MemMapEntry *memmap)
|
||||
{
|
||||
char *nodename;
|
||||
MachineState *mc = MACHINE(s);
|
||||
MachineState *ms = MACHINE(s);
|
||||
hwaddr base = memmap[VIRT_FW_CFG].base;
|
||||
hwaddr size = memmap[VIRT_FW_CFG].size;
|
||||
|
||||
nodename = g_strdup_printf("/fw-cfg@%" PRIx64, base);
|
||||
qemu_fdt_add_subnode(mc->fdt, nodename);
|
||||
qemu_fdt_setprop_string(mc->fdt, nodename,
|
||||
qemu_fdt_add_subnode(ms->fdt, nodename);
|
||||
qemu_fdt_setprop_string(ms->fdt, nodename,
|
||||
"compatible", "qemu,fw-cfg-mmio");
|
||||
qemu_fdt_setprop_sized_cells(mc->fdt, nodename, "reg",
|
||||
qemu_fdt_setprop_sized_cells(ms->fdt, nodename, "reg",
|
||||
2, base, 2, size);
|
||||
qemu_fdt_setprop(mc->fdt, nodename, "dma-coherent", NULL, 0);
|
||||
qemu_fdt_setprop(ms->fdt, nodename, "dma-coherent", NULL, 0);
|
||||
g_free(nodename);
|
||||
}
|
||||
|
||||
static void create_fdt(RISCVVirtState *s, const MemMapEntry *memmap)
|
||||
{
|
||||
MachineState *mc = MACHINE(s);
|
||||
MachineState *ms = MACHINE(s);
|
||||
uint32_t phandle = 1, irq_mmio_phandle = 1, msi_pcie_phandle = 1;
|
||||
uint32_t irq_pcie_phandle = 1, irq_virtio_phandle = 1;
|
||||
uint8_t rng_seed[32];
|
||||
|
||||
if (mc->dtb) {
|
||||
mc->fdt = load_device_tree(mc->dtb, &s->fdt_size);
|
||||
if (!mc->fdt) {
|
||||
if (ms->dtb) {
|
||||
ms->fdt = load_device_tree(ms->dtb, &s->fdt_size);
|
||||
if (!ms->fdt) {
|
||||
error_report("load_device_tree() failed");
|
||||
exit(1);
|
||||
}
|
||||
} else {
|
||||
mc->fdt = create_device_tree(&s->fdt_size);
|
||||
if (!mc->fdt) {
|
||||
ms->fdt = create_device_tree(&s->fdt_size);
|
||||
if (!ms->fdt) {
|
||||
error_report("create_device_tree() failed");
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
qemu_fdt_setprop_string(mc->fdt, "/", "model", "riscv-virtio,qemu");
|
||||
qemu_fdt_setprop_string(mc->fdt, "/", "compatible", "riscv-virtio");
|
||||
qemu_fdt_setprop_cell(mc->fdt, "/", "#size-cells", 0x2);
|
||||
qemu_fdt_setprop_cell(mc->fdt, "/", "#address-cells", 0x2);
|
||||
qemu_fdt_setprop_string(ms->fdt, "/", "model", "riscv-virtio,qemu");
|
||||
qemu_fdt_setprop_string(ms->fdt, "/", "compatible", "riscv-virtio");
|
||||
qemu_fdt_setprop_cell(ms->fdt, "/", "#size-cells", 0x2);
|
||||
qemu_fdt_setprop_cell(ms->fdt, "/", "#address-cells", 0x2);
|
||||
|
||||
qemu_fdt_add_subnode(mc->fdt, "/soc");
|
||||
qemu_fdt_setprop(mc->fdt, "/soc", "ranges", NULL, 0);
|
||||
qemu_fdt_setprop_string(mc->fdt, "/soc", "compatible", "simple-bus");
|
||||
qemu_fdt_setprop_cell(mc->fdt, "/soc", "#size-cells", 0x2);
|
||||
qemu_fdt_setprop_cell(mc->fdt, "/soc", "#address-cells", 0x2);
|
||||
qemu_fdt_add_subnode(ms->fdt, "/soc");
|
||||
qemu_fdt_setprop(ms->fdt, "/soc", "ranges", NULL, 0);
|
||||
qemu_fdt_setprop_string(ms->fdt, "/soc", "compatible", "simple-bus");
|
||||
qemu_fdt_setprop_cell(ms->fdt, "/soc", "#size-cells", 0x2);
|
||||
qemu_fdt_setprop_cell(ms->fdt, "/soc", "#address-cells", 0x2);
|
||||
|
||||
create_fdt_sockets(s, memmap, &phandle, &irq_mmio_phandle,
|
||||
&irq_pcie_phandle, &irq_virtio_phandle,
|
||||
@@ -1051,7 +1053,8 @@ static void create_fdt(RISCVVirtState *s, const MemMapEntry *memmap)
|
||||
|
||||
/* Pass seed to RNG */
|
||||
qemu_guest_getrandom_nofail(rng_seed, sizeof(rng_seed));
|
||||
qemu_fdt_setprop(mc->fdt, "/chosen", "rng-seed", rng_seed, sizeof(rng_seed));
|
||||
qemu_fdt_setprop(ms->fdt, "/chosen", "rng-seed",
|
||||
rng_seed, sizeof(rng_seed));
|
||||
}
|
||||
|
||||
static inline DeviceState *gpex_pcie_init(MemoryRegion *sys_mem,
|
||||
@@ -1103,14 +1106,14 @@ static inline DeviceState *gpex_pcie_init(MemoryRegion *sys_mem,
|
||||
return dev;
|
||||
}
|
||||
|
||||
static FWCfgState *create_fw_cfg(const MachineState *mc)
|
||||
static FWCfgState *create_fw_cfg(const MachineState *ms)
|
||||
{
|
||||
hwaddr base = virt_memmap[VIRT_FW_CFG].base;
|
||||
FWCfgState *fw_cfg;
|
||||
|
||||
fw_cfg = fw_cfg_init_mem_wide(base + 8, base, 8, base + 16,
|
||||
&address_space_memory);
|
||||
fw_cfg_add_i16(fw_cfg, FW_CFG_NB_CPUS, (uint16_t)mc->smp.cpus);
|
||||
fw_cfg_add_i16(fw_cfg, FW_CFG_NB_CPUS, (uint16_t)ms->smp.cpus);
|
||||
|
||||
return fw_cfg;
|
||||
}
|
||||
@@ -1300,9 +1303,11 @@ static void virt_machine_done(Notifier *notifier, void *data)
|
||||
start_addr = virt_memmap[VIRT_FLASH].base;
|
||||
}
|
||||
|
||||
/* Compute the fdt load address in dram */
|
||||
fdt_load_addr = riscv_load_fdt(memmap[VIRT_DRAM].base,
|
||||
machine->ram_size, machine->fdt);
|
||||
fdt_load_addr = riscv_compute_fdt_addr(memmap[VIRT_DRAM].base,
|
||||
memmap[VIRT_DRAM].size,
|
||||
machine);
|
||||
riscv_load_fdt(fdt_load_addr, machine->fdt);
|
||||
|
||||
/* load the reset vector */
|
||||
riscv_setup_rom_reset_vec(machine, &s->soc[0], start_addr,
|
||||
virt_memmap[VIRT_MROM].base,
|
||||
@@ -1328,9 +1333,10 @@ static void virt_machine_init(MachineState *machine)
|
||||
char *soc_name;
|
||||
DeviceState *mmio_irqchip, *virtio_irqchip, *pcie_irqchip;
|
||||
int i, base_hartid, hart_count;
|
||||
int socket_count = riscv_socket_count(machine);
|
||||
|
||||
/* Check socket count limit */
|
||||
if (VIRT_SOCKETS_MAX < riscv_socket_count(machine)) {
|
||||
if (VIRT_SOCKETS_MAX < socket_count) {
|
||||
error_report("number of sockets/nodes should be less than %d",
|
||||
VIRT_SOCKETS_MAX);
|
||||
exit(1);
|
||||
@@ -1338,7 +1344,7 @@ static void virt_machine_init(MachineState *machine)
|
||||
|
||||
/* Initialize sockets */
|
||||
mmio_irqchip = virtio_irqchip = pcie_irqchip = NULL;
|
||||
for (i = 0; i < riscv_socket_count(machine); i++) {
|
||||
for (i = 0; i < socket_count; i++) {
|
||||
if (!riscv_socket_check_hartids(machine, i)) {
|
||||
error_report("discontinuous hartids in socket%d", i);
|
||||
exit(1);
|
||||
@@ -1577,16 +1583,14 @@ static void virt_set_aia(Object *obj, const char *val, Error **errp)
|
||||
|
||||
static bool virt_get_aclint(Object *obj, Error **errp)
|
||||
{
|
||||
MachineState *ms = MACHINE(obj);
|
||||
RISCVVirtState *s = RISCV_VIRT_MACHINE(ms);
|
||||
RISCVVirtState *s = RISCV_VIRT_MACHINE(obj);
|
||||
|
||||
return s->have_aclint;
|
||||
}
|
||||
|
||||
static void virt_set_aclint(Object *obj, bool value, Error **errp)
|
||||
{
|
||||
MachineState *ms = MACHINE(obj);
|
||||
RISCVVirtState *s = RISCV_VIRT_MACHINE(ms);
|
||||
RISCVVirtState *s = RISCV_VIRT_MACHINE(obj);
|
||||
|
||||
s->have_aclint = value;
|
||||
}
|
||||
|
||||
@@ -43,7 +43,6 @@
|
||||
#include "qapi/error.h"
|
||||
#include "qapi/qapi-events-misc.h"
|
||||
#include "qapi/visitor.h"
|
||||
#include "hw/rtc/mc146818rtc_regs.h"
|
||||
|
||||
//#define DEBUG_CMOS
|
||||
//#define DEBUG_COALESCED
|
||||
|
||||
@@ -15,7 +15,6 @@
|
||||
#include "hw/qdev-properties.h"
|
||||
#include "hw/virtio/virtio-serial.h"
|
||||
#include "virtio-ccw.h"
|
||||
#include "hw/virtio/virtio-serial.h"
|
||||
|
||||
#define TYPE_VIRTIO_SERIAL_CCW "virtio-serial-ccw"
|
||||
OBJECT_DECLARE_SIMPLE_TYPE(VirtioSerialCcw, VIRTIO_SERIAL_CCW)
|
||||
|
||||
@@ -8,7 +8,6 @@
|
||||
*/
|
||||
|
||||
#include "qemu/osdep.h"
|
||||
#include <string.h>
|
||||
#include "hw/i2c/pmbus_device.h"
|
||||
#include "hw/irq.h"
|
||||
#include "migration/vmstate.h"
|
||||
|
||||
@@ -8,7 +8,6 @@
|
||||
*/
|
||||
|
||||
#include "qemu/osdep.h"
|
||||
#include "qemu/typedefs.h"
|
||||
#include "qapi/error.h"
|
||||
#include "hw/usb.h"
|
||||
#include "hw/usb/desc.h"
|
||||
|
||||
@@ -8,7 +8,6 @@
|
||||
*/
|
||||
|
||||
#include "qemu/osdep.h"
|
||||
#include "qemu/typedefs.h"
|
||||
#include "qapi/error.h"
|
||||
#include "qapi/visitor.h"
|
||||
#include "hw/usb.h"
|
||||
|
||||
@@ -273,6 +273,7 @@ static void vuf_device_unrealize(DeviceState *dev)
|
||||
{
|
||||
VirtIODevice *vdev = VIRTIO_DEVICE(dev);
|
||||
VHostUserFS *fs = VHOST_USER_FS(dev);
|
||||
struct vhost_virtqueue *vhost_vqs = fs->vhost_dev.vqs;
|
||||
int i;
|
||||
|
||||
/* This will stop vhost backend if appropriate. */
|
||||
@@ -288,8 +289,7 @@ static void vuf_device_unrealize(DeviceState *dev)
|
||||
}
|
||||
g_free(fs->req_vqs);
|
||||
virtio_cleanup(vdev);
|
||||
g_free(fs->vhost_dev.vqs);
|
||||
fs->vhost_dev.vqs = NULL;
|
||||
g_free(vhost_vqs);
|
||||
}
|
||||
|
||||
static struct vhost_dev *vuf_get_vhost(VirtIODevice *vdev)
|
||||
|
||||
@@ -42,6 +42,11 @@
|
||||
#define WDT_PUSH_PULL_MAGIC (0xA8 << 24)
|
||||
#define WDT_OPEN_DRAIN_MAGIC (0x8A << 24)
|
||||
#define WDT_RESET_MASK1 (0x1c / 4)
|
||||
#define WDT_RESET_MASK2 (0x20 / 4)
|
||||
|
||||
#define WDT_SW_RESET_CTRL (0x24 / 4)
|
||||
#define WDT_SW_RESET_MASK1 (0x28 / 4)
|
||||
#define WDT_SW_RESET_MASK2 (0x2c / 4)
|
||||
|
||||
#define WDT_TIMEOUT_STATUS (0x10 / 4)
|
||||
#define WDT_TIMEOUT_CLEAR (0x14 / 4)
|
||||
@@ -83,6 +88,10 @@ static uint64_t aspeed_wdt_read(void *opaque, hwaddr offset, unsigned size)
|
||||
return s->regs[WDT_RESET_MASK1];
|
||||
case WDT_TIMEOUT_STATUS:
|
||||
case WDT_TIMEOUT_CLEAR:
|
||||
case WDT_RESET_MASK2:
|
||||
case WDT_SW_RESET_CTRL:
|
||||
case WDT_SW_RESET_MASK1:
|
||||
case WDT_SW_RESET_MASK2:
|
||||
qemu_log_mask(LOG_UNIMP,
|
||||
"%s: uninmplemented read at offset 0x%" HWADDR_PRIx "\n",
|
||||
__func__, offset);
|
||||
@@ -190,6 +199,10 @@ static void aspeed_wdt_write(void *opaque, hwaddr offset, uint64_t data,
|
||||
|
||||
case WDT_TIMEOUT_STATUS:
|
||||
case WDT_TIMEOUT_CLEAR:
|
||||
case WDT_RESET_MASK2:
|
||||
case WDT_SW_RESET_CTRL:
|
||||
case WDT_SW_RESET_MASK1:
|
||||
case WDT_SW_RESET_MASK2:
|
||||
qemu_log_mask(LOG_UNIMP,
|
||||
"%s: uninmplemented write at offset 0x%" HWADDR_PRIx "\n",
|
||||
__func__, offset);
|
||||
@@ -260,6 +273,7 @@ static void aspeed_wdt_realize(DeviceState *dev, Error **errp)
|
||||
{
|
||||
SysBusDevice *sbd = SYS_BUS_DEVICE(dev);
|
||||
AspeedWDTState *s = ASPEED_WDT(dev);
|
||||
AspeedWDTClass *awc = ASPEED_WDT_GET_CLASS(dev);
|
||||
|
||||
assert(s->scu);
|
||||
|
||||
@@ -271,7 +285,7 @@ static void aspeed_wdt_realize(DeviceState *dev, Error **errp)
|
||||
s->pclk_freq = PCLK_HZ;
|
||||
|
||||
memory_region_init_io(&s->iomem, OBJECT(s), &aspeed_wdt_ops, s,
|
||||
TYPE_ASPEED_WDT, ASPEED_WDT_REGS_MAX * 4);
|
||||
TYPE_ASPEED_WDT, awc->iosize);
|
||||
sysbus_init_mmio(sbd, &s->iomem);
|
||||
}
|
||||
|
||||
@@ -309,7 +323,7 @@ static void aspeed_2400_wdt_class_init(ObjectClass *klass, void *data)
|
||||
AspeedWDTClass *awc = ASPEED_WDT_CLASS(klass);
|
||||
|
||||
dc->desc = "ASPEED 2400 Watchdog Controller";
|
||||
awc->offset = 0x20;
|
||||
awc->iosize = 0x20;
|
||||
awc->ext_pulse_width_mask = 0xff;
|
||||
awc->reset_ctrl_reg = SCU_RESET_CONTROL1;
|
||||
awc->wdt_reload = aspeed_wdt_reload;
|
||||
@@ -346,7 +360,7 @@ static void aspeed_2500_wdt_class_init(ObjectClass *klass, void *data)
|
||||
AspeedWDTClass *awc = ASPEED_WDT_CLASS(klass);
|
||||
|
||||
dc->desc = "ASPEED 2500 Watchdog Controller";
|
||||
awc->offset = 0x20;
|
||||
awc->iosize = 0x20;
|
||||
awc->ext_pulse_width_mask = 0xfffff;
|
||||
awc->reset_ctrl_reg = SCU_RESET_CONTROL1;
|
||||
awc->reset_pulse = aspeed_2500_wdt_reset_pulse;
|
||||
@@ -369,7 +383,7 @@ static void aspeed_2600_wdt_class_init(ObjectClass *klass, void *data)
|
||||
AspeedWDTClass *awc = ASPEED_WDT_CLASS(klass);
|
||||
|
||||
dc->desc = "ASPEED 2600 Watchdog Controller";
|
||||
awc->offset = 0x40;
|
||||
awc->iosize = 0x40;
|
||||
awc->ext_pulse_width_mask = 0xfffff; /* TODO */
|
||||
awc->reset_ctrl_reg = AST2600_SCU_RESET_CONTROL1;
|
||||
awc->reset_pulse = aspeed_2500_wdt_reset_pulse;
|
||||
@@ -392,7 +406,7 @@ static void aspeed_1030_wdt_class_init(ObjectClass *klass, void *data)
|
||||
AspeedWDTClass *awc = ASPEED_WDT_CLASS(klass);
|
||||
|
||||
dc->desc = "ASPEED 1030 Watchdog Controller";
|
||||
awc->offset = 0x80;
|
||||
awc->iosize = 0x80;
|
||||
awc->ext_pulse_width_mask = 0xfffff; /* TODO */
|
||||
awc->reset_ctrl_reg = AST2600_SCU_RESET_CONTROL1;
|
||||
awc->reset_pulse = aspeed_2500_wdt_reset_pulse;
|
||||
|
||||
@@ -20,7 +20,6 @@
|
||||
#ifndef GRAPH_LOCK_H
|
||||
#define GRAPH_LOCK_H
|
||||
|
||||
#include "qemu/osdep.h"
|
||||
#include "qemu/clang-tsa.h"
|
||||
|
||||
/**
|
||||
|
||||
@@ -13,8 +13,6 @@
|
||||
#ifndef BLOCK_WRITE_THRESHOLD_H
|
||||
#define BLOCK_WRITE_THRESHOLD_H
|
||||
|
||||
#include "qemu/typedefs.h"
|
||||
|
||||
/*
|
||||
* bdrv_write_threshold_set:
|
||||
*
|
||||
|
||||
@@ -44,6 +44,7 @@
|
||||
#define ASPEED_CPUS_NUM 2
|
||||
#define ASPEED_MACS_NUM 4
|
||||
#define ASPEED_UARTS_NUM 13
|
||||
#define ASPEED_JTAG_NUM 2
|
||||
|
||||
struct AspeedSoCState {
|
||||
/*< private >*/
|
||||
@@ -70,6 +71,7 @@ struct AspeedSoCState {
|
||||
AspeedSMCState spi[ASPEED_SPIS_NUM];
|
||||
EHCISysBusState ehci[ASPEED_EHCIS_NUM];
|
||||
AspeedSBCState sbc;
|
||||
MemoryRegion secsram;
|
||||
UnimplementedDeviceState sbc_unimplemented;
|
||||
AspeedSDMCState sdmc;
|
||||
AspeedWDTState wdt[ASPEED_WDTS_NUM];
|
||||
@@ -87,6 +89,11 @@ struct AspeedSoCState {
|
||||
UnimplementedDeviceState video;
|
||||
UnimplementedDeviceState emmc_boot_controller;
|
||||
UnimplementedDeviceState dpmcu;
|
||||
UnimplementedDeviceState pwm;
|
||||
UnimplementedDeviceState espi;
|
||||
UnimplementedDeviceState udc;
|
||||
UnimplementedDeviceState sgpiom;
|
||||
UnimplementedDeviceState jtag[ASPEED_JTAG_NUM];
|
||||
};
|
||||
|
||||
#define TYPE_ASPEED_SOC "aspeed-soc"
|
||||
@@ -99,6 +106,7 @@ struct AspeedSoCClass {
|
||||
const char *cpu_type;
|
||||
uint32_t silicon_rev;
|
||||
uint64_t sram_size;
|
||||
uint64_t secsram_size;
|
||||
int spis_num;
|
||||
int ehcis_num;
|
||||
int wdts_num;
|
||||
@@ -137,6 +145,7 @@ enum {
|
||||
ASPEED_DEV_SCU,
|
||||
ASPEED_DEV_ADC,
|
||||
ASPEED_DEV_SBC,
|
||||
ASPEED_DEV_SECSRAM,
|
||||
ASPEED_DEV_EMMC_BC,
|
||||
ASPEED_DEV_VIDEO,
|
||||
ASPEED_DEV_SRAM,
|
||||
@@ -174,6 +183,11 @@ enum {
|
||||
ASPEED_DEV_DPMCU,
|
||||
ASPEED_DEV_DP,
|
||||
ASPEED_DEV_I3C,
|
||||
ASPEED_DEV_ESPI,
|
||||
ASPEED_DEV_UDC,
|
||||
ASPEED_DEV_SGPIOM,
|
||||
ASPEED_DEV_JTAG0,
|
||||
ASPEED_DEV_JTAG1,
|
||||
};
|
||||
|
||||
qemu_irq aspeed_soc_get_irq(AspeedSoCState *s, int dev);
|
||||
|
||||
@@ -30,7 +30,6 @@
|
||||
#include "hw/timer/imx_gpt.h"
|
||||
#include "hw/timer/imx_epit.h"
|
||||
#include "hw/i2c/imx_i2c.h"
|
||||
#include "hw/gpio/imx_gpio.h"
|
||||
#include "hw/sd/sdhci.h"
|
||||
#include "hw/ssi/imx_spi.h"
|
||||
#include "hw/net/imx_fec.h"
|
||||
|
||||
@@ -32,7 +32,6 @@
|
||||
#include "hw/timer/imx_gpt.h"
|
||||
#include "hw/timer/imx_epit.h"
|
||||
#include "hw/i2c/imx_i2c.h"
|
||||
#include "hw/gpio/imx_gpio.h"
|
||||
#include "hw/sd/sdhci.h"
|
||||
#include "hw/ssi/imx_spi.h"
|
||||
#include "hw/net/imx_fec.h"
|
||||
|
||||
@@ -15,9 +15,7 @@
|
||||
#define CXL2_COMPONENT_CM_REGION_SIZE 0x1000
|
||||
#define CXL2_COMPONENT_BLOCK_SIZE 0x10000
|
||||
|
||||
#include "qemu/compiler.h"
|
||||
#include "qemu/range.h"
|
||||
#include "qemu/typedefs.h"
|
||||
#include "hw/cxl/cxl_cdat.h"
|
||||
#include "hw/register.h"
|
||||
#include "qapi/error.h"
|
||||
|
||||
@@ -7,7 +7,6 @@
|
||||
* COPYING file in the top-level directory.
|
||||
*/
|
||||
|
||||
#include "qemu/osdep.h"
|
||||
#include "hw/cxl/cxl.h"
|
||||
#include "hw/boards.h"
|
||||
|
||||
|
||||
@@ -10,7 +10,6 @@
|
||||
#ifndef CXL_PCI_H
|
||||
#define CXL_PCI_H
|
||||
|
||||
#include "qemu/compiler.h"
|
||||
|
||||
#define CXL_VENDOR_ID 0x1e98
|
||||
|
||||
|
||||
@@ -10,7 +10,6 @@
|
||||
#ifndef HW_PL050_H
|
||||
#define HW_PL050_H
|
||||
|
||||
#include "qemu/osdep.h"
|
||||
#include "hw/sysbus.h"
|
||||
#include "migration/vmstate.h"
|
||||
#include "hw/input/ps2.h"
|
||||
|
||||
@@ -251,9 +251,6 @@ void pstrcpy_targphys(const char *name,
|
||||
hwaddr dest, int buf_size,
|
||||
const char *source);
|
||||
|
||||
extern bool option_rom_has_mr;
|
||||
extern bool rom_file_has_mr;
|
||||
|
||||
ssize_t rom_add_file(const char *file, const char *fw_dir,
|
||||
hwaddr addr, int32_t bootindex,
|
||||
bool option_rom, MemoryRegion *mr, AddressSpace *as);
|
||||
|
||||
@@ -12,8 +12,6 @@
|
||||
|
||||
#include "hw/sysbus.h"
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#define TYPE_ASPEED_LPC "aspeed.lpc"
|
||||
#define ASPEED_LPC(obj) OBJECT_CHECK(AspeedLPCState, (obj), TYPE_ASPEED_LPC)
|
||||
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
#include "exec/memory.h"
|
||||
#include "hw/sysbus.h"
|
||||
#include "hw/misc/mos6522.h"
|
||||
#include "hw/input/adb.h"
|
||||
#include "qom/object.h"
|
||||
|
||||
|
||||
|
||||
@@ -26,6 +26,7 @@
|
||||
#ifndef CUDA_H
|
||||
#define CUDA_H
|
||||
|
||||
#include "hw/input/adb.h"
|
||||
#include "hw/misc/mos6522.h"
|
||||
#include "qom/object.h"
|
||||
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
#ifndef PMU_H
|
||||
#define PMU_H
|
||||
|
||||
#include "hw/input/adb.h"
|
||||
#include "hw/misc/mos6522.h"
|
||||
#include "hw/misc/macio/gpio.h"
|
||||
#include "qom/object.h"
|
||||
|
||||
@@ -27,9 +27,8 @@
|
||||
#ifndef MOS6522_H
|
||||
#define MOS6522_H
|
||||
|
||||
#include "exec/memory.h"
|
||||
#include "exec/hwaddr.h"
|
||||
#include "hw/sysbus.h"
|
||||
#include "hw/input/adb.h"
|
||||
#include "qom/object.h"
|
||||
|
||||
#define MOS6522_NUM_REGS 16
|
||||
|
||||
39
include/hw/nvram/eeprom_at24c.h
Normal file
39
include/hw/nvram/eeprom_at24c.h
Normal file
@@ -0,0 +1,39 @@
|
||||
/*
|
||||
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
||||
*
|
||||
* SPDX-License-Identifier: GPL-2.0-only
|
||||
*/
|
||||
|
||||
#ifndef EEPROM_AT24C_H
|
||||
#define EEPROM_AT24C_H
|
||||
|
||||
#include "hw/i2c/i2c.h"
|
||||
|
||||
/*
|
||||
* Create and realize an AT24C EEPROM device on the heap.
|
||||
* @bus: I2C bus to put it on
|
||||
* @address: I2C address of the EEPROM slave when put on a bus
|
||||
* @rom_size: size of the EEPROM
|
||||
*
|
||||
* Create the device state structure, initialize it, put it on the specified
|
||||
* @bus, and drop the reference to it (the device is realized).
|
||||
*/
|
||||
I2CSlave *at24c_eeprom_init(I2CBus *bus, uint8_t address, uint32_t rom_size);
|
||||
|
||||
|
||||
/*
|
||||
* Create and realize an AT24C EEPROM device on the heap with initial data.
|
||||
* @bus: I2C bus to put it on
|
||||
* @address: I2C address of the EEPROM slave when put on a bus
|
||||
* @rom_size: size of the EEPROM
|
||||
* @init_rom: Array of bytes to initialize EEPROM memory with
|
||||
* @init_rom_size: Size of @init_rom, must be less than or equal to @rom_size
|
||||
*
|
||||
* Create the device state structure, initialize it, put it on the specified
|
||||
* @bus, and drop the reference to it (the device is realized). Copies the data
|
||||
* from @init_rom to the beginning of the EEPROM memory buffer.
|
||||
*/
|
||||
I2CSlave *at24c_eeprom_init_rom(I2CBus *bus, uint8_t address, uint32_t rom_size,
|
||||
const uint8_t *init_rom, uint32_t init_rom_size);
|
||||
|
||||
#endif
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user