Misc HW patch queue
- Remove unused MIPS SAAR* registers (Phil) - Remove warning when testing the TC58128 NAND EEPROM (Peter) - KConfig cleanups around ISA SuperI/O and MIPS (Paolo) - QDev API uses sanitization (Philippe) - Split AHCI model as PCI / SysBus (Philippe) - Add SMP support to SPARC Leon3 board (Clément) -----BEGIN PGP SIGNATURE----- iQIzBAABCAAdFiEE+qvnXhKRciHc/Wuy4+MsLN6twN4FAmXOUD4ACgkQ4+MsLN6t wN6gWRAAjf+6Z9VUvvHqZoaSJW49k+GRUelTI2tyN+eGfetAx9dk8aIbpbV1X12d pc56jsSi6ICT7baCegtxHszhYJr2e9A2QLCAOJt+Oz87kEGes3ONVVKAk7pwjKxt m8pmU3uXWgFvU6PoFBhGBa6LiZBulgLNXBUwzmEhc9PpPkR49ULdDp/qxtWvxOV5 xYBktFlkiT+AvHq3QWCnDIaw+pH5ghEq9BI4xFOvvvqSqdHEqsGAaiKPa9Po0Gfz Ap9qsm4FxKxhGoeQWtAIP8TvN3pFFSXMysziP6Xt1rffKsvF9ioghGKRM6BgQfqD ZetjcFbcf7dQu3zZVy8ljYcymMxfZcWWVVq4CMC68lPQE97hz1CT3PJjgd77dKfi z60uRkOGaiPW5iIGT9+vdQxZ5K3HivKyjuHOdV8V4HnWO3oqgfDtNHn5RKed0qUg g1FoWriJGsDixdx1vd0EoH2/oTxy4HIsFv7a1OjiZyBLjO+EeEZ3+H9pqUHqBxva +Dv70z9F1sv5dzcUXH+oCgTbnKlJ90Q+e3vj0wGdlBncVsgIwbtgqYelhUEl+xJX Mu6KNUo5ANVP38ZKG0GSMCZHfcUjc5s+5rG55NbTN0HiF56a6D2KlQAuXdUsGE1J 7i4cwipJmfxzbdPDlSb3kBxm5pFexEk6nROF9kTHQj3ZBMMvIls= =nOX+ -----END PGP SIGNATURE----- Merge tag 'hw-misc-20240215' of https://github.com/philmd/qemu into staging Misc HW patch queue - Remove unused MIPS SAAR* registers (Phil) - Remove warning when testing the TC58128 NAND EEPROM (Peter) - KConfig cleanups around ISA SuperI/O and MIPS (Paolo) - QDev API uses sanitization (Philippe) - Split AHCI model as PCI / SysBus (Philippe) - Add SMP support to SPARC Leon3 board (Clément) # -----BEGIN PGP SIGNATURE----- # # iQIzBAABCAAdFiEE+qvnXhKRciHc/Wuy4+MsLN6twN4FAmXOUD4ACgkQ4+MsLN6t # wN6gWRAAjf+6Z9VUvvHqZoaSJW49k+GRUelTI2tyN+eGfetAx9dk8aIbpbV1X12d # pc56jsSi6ICT7baCegtxHszhYJr2e9A2QLCAOJt+Oz87kEGes3ONVVKAk7pwjKxt # m8pmU3uXWgFvU6PoFBhGBa6LiZBulgLNXBUwzmEhc9PpPkR49ULdDp/qxtWvxOV5 # xYBktFlkiT+AvHq3QWCnDIaw+pH5ghEq9BI4xFOvvvqSqdHEqsGAaiKPa9Po0Gfz # Ap9qsm4FxKxhGoeQWtAIP8TvN3pFFSXMysziP6Xt1rffKsvF9ioghGKRM6BgQfqD # ZetjcFbcf7dQu3zZVy8ljYcymMxfZcWWVVq4CMC68lPQE97hz1CT3PJjgd77dKfi # z60uRkOGaiPW5iIGT9+vdQxZ5K3HivKyjuHOdV8V4HnWO3oqgfDtNHn5RKed0qUg # g1FoWriJGsDixdx1vd0EoH2/oTxy4HIsFv7a1OjiZyBLjO+EeEZ3+H9pqUHqBxva # +Dv70z9F1sv5dzcUXH+oCgTbnKlJ90Q+e3vj0wGdlBncVsgIwbtgqYelhUEl+xJX # Mu6KNUo5ANVP38ZKG0GSMCZHfcUjc5s+5rG55NbTN0HiF56a6D2KlQAuXdUsGE1J # 7i4cwipJmfxzbdPDlSb3kBxm5pFexEk6nROF9kTHQj3ZBMMvIls= # =nOX+ # -----END PGP SIGNATURE----- # gpg: Signature made Thu 15 Feb 2024 17:56:14 GMT # gpg: using RSA key FAABE75E12917221DCFD6BB2E3E32C2CDEADC0DE # gpg: Good signature from "Philippe Mathieu-Daudé (F4BUG) <f4bug@amsat.org>" [full] # Primary key fingerprint: FAAB E75E 1291 7221 DCFD 6BB2 E3E3 2C2C DEAD C0DE * tag 'hw-misc-20240215' of https://github.com/philmd/qemu: (56 commits) hw/ide/ich9: Use AHCIPCIState typedef hw/ide/ahci: Move SysBus definitions to 'ahci-sysbus.h' hw/ide/ahci: Remove SysbusAHCIState::num_ports field hw/ide/ahci: Do not pass 'ports' argument to ahci_realize() hw/ide/ahci: Convert AHCIState::ports to unsigned hw/ide/ahci: Pass AHCI context to ahci_ide_create_devs() hw/ide/ahci: Inline ahci_get_num_ports() hw/ide/ahci: Rename AHCI PCI function as 'pdev' hw/ide/ahci: Expose AHCIPCIState structure hw/i386/q35: Use DEVICE() cast macro with PCIDevice object hw/i386/q35: Simplify pc_q35_init() since PCI is always enabled MAINTAINERS: Add myself as reviewer for TCG Plugins MAINTAINERS: replace Fabien by myself as Leon3 maintainer hw/sparc/leon3: Initialize GPIO before realizing CPU devices hw/sparc/leon3: Pass DeviceState opaque argument to leon3_start_cpu() hw/sparc/leon3: Pass DeviceState opaque argument to leon3_set_pil_in() hw/sparc/leon3: check cpu_id in the tiny bootloader hw/sparc/leon3: implement multiprocessor hw/sparc/leon3: remove SP initialization target/sparc: implement asr17 feature for smp ... Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
This commit is contained in:
commit
da96ad4a6a
@ -1358,6 +1358,7 @@ M: Philippe Mathieu-Daudé <philmd@linaro.org>
|
|||||||
R: Aurelien Jarno <aurelien@aurel32.net>
|
R: Aurelien Jarno <aurelien@aurel32.net>
|
||||||
S: Odd Fixes
|
S: Odd Fixes
|
||||||
F: hw/isa/piix.c
|
F: hw/isa/piix.c
|
||||||
|
F: hw/isa/fdc37m81x-superio.c
|
||||||
F: hw/acpi/piix4.c
|
F: hw/acpi/piix4.c
|
||||||
F: hw/mips/malta.c
|
F: hw/mips/malta.c
|
||||||
F: hw/pci-host/gt64120.c
|
F: hw/pci-host/gt64120.c
|
||||||
@ -1709,7 +1710,7 @@ F: hw/rtc/sun4v-rtc.c
|
|||||||
F: include/hw/rtc/sun4v-rtc.h
|
F: include/hw/rtc/sun4v-rtc.h
|
||||||
|
|
||||||
Leon3
|
Leon3
|
||||||
M: Fabien Chouteau <chouteau@adacore.com>
|
M: Clément Chigot <chigot@adacore.com>
|
||||||
M: Frederic Konrad <konrad.frederic@yahoo.fr>
|
M: Frederic Konrad <konrad.frederic@yahoo.fr>
|
||||||
S: Maintained
|
S: Maintained
|
||||||
F: hw/sparc/leon3.c
|
F: hw/sparc/leon3.c
|
||||||
@ -3706,6 +3707,7 @@ TCG Plugins
|
|||||||
M: Alex Bennée <alex.bennee@linaro.org>
|
M: Alex Bennée <alex.bennee@linaro.org>
|
||||||
R: Alexandre Iooss <erdnaxe@crans.org>
|
R: Alexandre Iooss <erdnaxe@crans.org>
|
||||||
R: Mahmoud Mandour <ma.mandourr@gmail.com>
|
R: Mahmoud Mandour <ma.mandourr@gmail.com>
|
||||||
|
R: Pierrick Bouvier <pierrick.bouvier@linaro.org>
|
||||||
S: Maintained
|
S: Maintained
|
||||||
F: docs/devel/tcg-plugins.rst
|
F: docs/devel/tcg-plugins.rst
|
||||||
F: plugins/
|
F: plugins/
|
||||||
|
@ -30,7 +30,7 @@
|
|||||||
#include "hw/boards.h"
|
#include "hw/boards.h"
|
||||||
#include "qemu/error-report.h"
|
#include "qemu/error-report.h"
|
||||||
#include "hw/char/pl011.h"
|
#include "hw/char/pl011.h"
|
||||||
#include "hw/ide/ahci.h"
|
#include "hw/ide/ahci-sysbus.h"
|
||||||
#include "hw/cpu/a9mpcore.h"
|
#include "hw/cpu/a9mpcore.h"
|
||||||
#include "hw/cpu/a15mpcore.h"
|
#include "hw/cpu/a15mpcore.h"
|
||||||
#include "qemu/log.h"
|
#include "qemu/log.h"
|
||||||
|
@ -38,6 +38,7 @@
|
|||||||
#include "hw/boards.h"
|
#include "hw/boards.h"
|
||||||
#include "hw/ide/internal.h"
|
#include "hw/ide/internal.h"
|
||||||
#include "hw/ide/ahci_internal.h"
|
#include "hw/ide/ahci_internal.h"
|
||||||
|
#include "hw/ide/ahci-sysbus.h"
|
||||||
#include "hw/intc/arm_gicv3_common.h"
|
#include "hw/intc/arm_gicv3_common.h"
|
||||||
#include "hw/intc/arm_gicv3_its_common.h"
|
#include "hw/intc/arm_gicv3_its_common.h"
|
||||||
#include "hw/loader.h"
|
#include "hw/loader.h"
|
||||||
|
@ -1,7 +1,9 @@
|
|||||||
/*
|
/*
|
||||||
* QEMU GRLIB APB UART Emulator
|
* QEMU GRLIB APB UART Emulator
|
||||||
*
|
*
|
||||||
* Copyright (c) 2010-2019 AdaCore
|
* SPDX-License-Identifier: MIT
|
||||||
|
*
|
||||||
|
* Copyright (c) 2010-2024 AdaCore
|
||||||
*
|
*
|
||||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
* of this software and associated documentation files (the "Software"), to deal
|
* of this software and associated documentation files (the "Software"), to deal
|
||||||
@ -26,7 +28,7 @@
|
|||||||
#include "hw/irq.h"
|
#include "hw/irq.h"
|
||||||
#include "hw/qdev-properties.h"
|
#include "hw/qdev-properties.h"
|
||||||
#include "hw/qdev-properties-system.h"
|
#include "hw/qdev-properties-system.h"
|
||||||
#include "hw/sparc/grlib.h"
|
#include "hw/char/grlib_uart.h"
|
||||||
#include "hw/sysbus.h"
|
#include "hw/sysbus.h"
|
||||||
#include "qemu/module.h"
|
#include "qemu/module.h"
|
||||||
#include "chardev/char-fe.h"
|
#include "chardev/char-fe.h"
|
||||||
|
@ -129,7 +129,7 @@ static void i82374_realize(DeviceState *dev, Error **errp)
|
|||||||
error_setg(errp, "DMA already initialized on ISA bus");
|
error_setg(errp, "DMA already initialized on ISA bus");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
i8257_dma_init(isa_bus, true);
|
i8257_dma_init(OBJECT(dev), isa_bus, true);
|
||||||
|
|
||||||
portio_list_init(&s->port_list, OBJECT(s), i82374_portio_list, s,
|
portio_list_init(&s->port_list, OBJECT(s), i82374_portio_list, s,
|
||||||
"i82374");
|
"i82374");
|
||||||
|
@ -632,12 +632,13 @@ static void i8257_register_types(void)
|
|||||||
|
|
||||||
type_init(i8257_register_types)
|
type_init(i8257_register_types)
|
||||||
|
|
||||||
void i8257_dma_init(ISABus *bus, bool high_page_enable)
|
void i8257_dma_init(Object *parent, ISABus *bus, bool high_page_enable)
|
||||||
{
|
{
|
||||||
ISADevice *isa1, *isa2;
|
ISADevice *isa1, *isa2;
|
||||||
DeviceState *d;
|
DeviceState *d;
|
||||||
|
|
||||||
isa1 = isa_new(TYPE_I8257);
|
isa1 = isa_new(TYPE_I8257);
|
||||||
|
object_property_add_child(parent, "dma[*]", OBJECT(isa1));
|
||||||
d = DEVICE(isa1);
|
d = DEVICE(isa1);
|
||||||
qdev_prop_set_int32(d, "base", 0x00);
|
qdev_prop_set_int32(d, "base", 0x00);
|
||||||
qdev_prop_set_int32(d, "page-base", 0x80);
|
qdev_prop_set_int32(d, "page-base", 0x80);
|
||||||
@ -646,6 +647,7 @@ void i8257_dma_init(ISABus *bus, bool high_page_enable)
|
|||||||
isa_realize_and_unref(isa1, bus, &error_fatal);
|
isa_realize_and_unref(isa1, bus, &error_fatal);
|
||||||
|
|
||||||
isa2 = isa_new(TYPE_I8257);
|
isa2 = isa_new(TYPE_I8257);
|
||||||
|
object_property_add_child(parent, "dma[*]", OBJECT(isa2));
|
||||||
d = DEVICE(isa2);
|
d = DEVICE(isa2);
|
||||||
qdev_prop_set_int32(d, "base", 0xc0);
|
qdev_prop_set_int32(d, "base", 0xc0);
|
||||||
qdev_prop_set_int32(d, "page-base", 0x88);
|
qdev_prop_set_int32(d, "page-base", 0x88);
|
||||||
|
@ -310,7 +310,7 @@ static void pc_init1(MachineState *machine,
|
|||||||
qdev_prop_set_int32(DEVICE(rtc_state), "base_year", 2000);
|
qdev_prop_set_int32(DEVICE(rtc_state), "base_year", 2000);
|
||||||
isa_realize_and_unref(rtc_state, isa_bus, &error_fatal);
|
isa_realize_and_unref(rtc_state, isa_bus, &error_fatal);
|
||||||
|
|
||||||
i8257_dma_init(isa_bus, 0);
|
i8257_dma_init(OBJECT(machine), isa_bus, 0);
|
||||||
pcms->hpet_enabled = false;
|
pcms->hpet_enabled = false;
|
||||||
idebus[0] = NULL;
|
idebus[0] = NULL;
|
||||||
idebus[1] = NULL;
|
idebus[1] = NULL;
|
||||||
|
@ -47,7 +47,7 @@
|
|||||||
#include "hw/display/ramfb.h"
|
#include "hw/display/ramfb.h"
|
||||||
#include "hw/firmware/smbios.h"
|
#include "hw/firmware/smbios.h"
|
||||||
#include "hw/ide/pci.h"
|
#include "hw/ide/pci.h"
|
||||||
#include "hw/ide/ahci.h"
|
#include "hw/ide/ahci-pci.h"
|
||||||
#include "hw/intc/ioapic.h"
|
#include "hw/intc/ioapic.h"
|
||||||
#include "hw/southbridge/ich9.h"
|
#include "hw/southbridge/ich9.h"
|
||||||
#include "hw/usb.h"
|
#include "hw/usb.h"
|
||||||
@ -130,12 +130,10 @@ static void pc_q35_init(MachineState *machine)
|
|||||||
ISADevice *rtc_state;
|
ISADevice *rtc_state;
|
||||||
MemoryRegion *system_memory = get_system_memory();
|
MemoryRegion *system_memory = get_system_memory();
|
||||||
MemoryRegion *system_io = get_system_io();
|
MemoryRegion *system_io = get_system_io();
|
||||||
MemoryRegion *pci_memory;
|
MemoryRegion *pci_memory = g_new(MemoryRegion, 1);
|
||||||
MemoryRegion *rom_memory;
|
|
||||||
GSIState *gsi_state;
|
GSIState *gsi_state;
|
||||||
ISABus *isa_bus;
|
ISABus *isa_bus;
|
||||||
int i;
|
int i;
|
||||||
PCIDevice *ahci;
|
|
||||||
ram_addr_t lowmem;
|
ram_addr_t lowmem;
|
||||||
DriveInfo *hd[MAX_SATA_PORTS];
|
DriveInfo *hd[MAX_SATA_PORTS];
|
||||||
MachineClass *mc = MACHINE_GET_CLASS(machine);
|
MachineClass *mc = MACHINE_GET_CLASS(machine);
|
||||||
@ -143,6 +141,8 @@ static void pc_q35_init(MachineState *machine)
|
|||||||
bool keep_pci_slot_hpc;
|
bool keep_pci_slot_hpc;
|
||||||
uint64_t pci_hole64_size = 0;
|
uint64_t pci_hole64_size = 0;
|
||||||
|
|
||||||
|
assert(pcmc->pci_enabled);
|
||||||
|
|
||||||
/* Check whether RAM fits below 4G (leaving 1/2 GByte for IO memory
|
/* Check whether RAM fits below 4G (leaving 1/2 GByte for IO memory
|
||||||
* and 256 Mbytes for PCI Express Enhanced Configuration Access Mapping
|
* and 256 Mbytes for PCI Express Enhanced Configuration Access Mapping
|
||||||
* also known as MMCFG).
|
* also known as MMCFG).
|
||||||
@ -189,16 +189,6 @@ static void pc_q35_init(MachineState *machine)
|
|||||||
kvmclock_create(pcmc->kvmclock_create_always);
|
kvmclock_create(pcmc->kvmclock_create_always);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* pci enabled */
|
|
||||||
if (pcmc->pci_enabled) {
|
|
||||||
pci_memory = g_new(MemoryRegion, 1);
|
|
||||||
memory_region_init(pci_memory, NULL, "pci", UINT64_MAX);
|
|
||||||
rom_memory = pci_memory;
|
|
||||||
} else {
|
|
||||||
pci_memory = NULL;
|
|
||||||
rom_memory = system_memory;
|
|
||||||
}
|
|
||||||
|
|
||||||
pc_guest_info_init(pcms);
|
pc_guest_info_init(pcms);
|
||||||
|
|
||||||
if (pcmc->smbios_defaults) {
|
if (pcmc->smbios_defaults) {
|
||||||
@ -212,14 +202,13 @@ static void pc_q35_init(MachineState *machine)
|
|||||||
/* create pci host bus */
|
/* create pci host bus */
|
||||||
phb = OBJECT(qdev_new(TYPE_Q35_HOST_DEVICE));
|
phb = OBJECT(qdev_new(TYPE_Q35_HOST_DEVICE));
|
||||||
|
|
||||||
if (pcmc->pci_enabled) {
|
pci_hole64_size = object_property_get_uint(phb,
|
||||||
pci_hole64_size = object_property_get_uint(phb,
|
PCI_HOST_PROP_PCI_HOLE64_SIZE,
|
||||||
PCI_HOST_PROP_PCI_HOLE64_SIZE,
|
&error_abort);
|
||||||
&error_abort);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* allocate ram and load rom/bios */
|
/* allocate ram and load rom/bios */
|
||||||
pc_memory_init(pcms, system_memory, rom_memory, pci_hole64_size);
|
memory_region_init(pci_memory, NULL, "pci", UINT64_MAX);
|
||||||
|
pc_memory_init(pcms, system_memory, pci_memory, pci_hole64_size);
|
||||||
|
|
||||||
object_property_add_child(OBJECT(machine), "q35", phb);
|
object_property_add_child(OBJECT(machine), "q35", phb);
|
||||||
object_property_set_link(phb, PCI_HOST_PROP_RAM_MEM,
|
object_property_set_link(phb, PCI_HOST_PROP_RAM_MEM,
|
||||||
@ -243,18 +232,18 @@ static void pc_q35_init(MachineState *machine)
|
|||||||
pcms->bus = host_bus;
|
pcms->bus = host_bus;
|
||||||
|
|
||||||
/* irq lines */
|
/* irq lines */
|
||||||
gsi_state = pc_gsi_create(&x86ms->gsi, pcmc->pci_enabled);
|
gsi_state = pc_gsi_create(&x86ms->gsi, true);
|
||||||
|
|
||||||
/* create ISA bus */
|
/* create ISA bus */
|
||||||
lpc = pci_new_multifunction(PCI_DEVFN(ICH9_LPC_DEV, ICH9_LPC_FUNC),
|
lpc = pci_new_multifunction(PCI_DEVFN(ICH9_LPC_DEV, ICH9_LPC_FUNC),
|
||||||
TYPE_ICH9_LPC_DEVICE);
|
TYPE_ICH9_LPC_DEVICE);
|
||||||
qdev_prop_set_bit(DEVICE(lpc), "smm-enabled",
|
|
||||||
x86_machine_is_smm_enabled(x86ms));
|
|
||||||
lpc_dev = DEVICE(lpc);
|
lpc_dev = DEVICE(lpc);
|
||||||
|
qdev_prop_set_bit(lpc_dev, "smm-enabled",
|
||||||
|
x86_machine_is_smm_enabled(x86ms));
|
||||||
|
pci_realize_and_unref(lpc, host_bus, &error_fatal);
|
||||||
for (i = 0; i < IOAPIC_NUM_PINS; i++) {
|
for (i = 0; i < IOAPIC_NUM_PINS; i++) {
|
||||||
qdev_connect_gpio_out_named(lpc_dev, ICH9_GPIO_GSI, i, x86ms->gsi[i]);
|
qdev_connect_gpio_out_named(lpc_dev, ICH9_GPIO_GSI, i, x86ms->gsi[i]);
|
||||||
}
|
}
|
||||||
pci_realize_and_unref(lpc, host_bus, &error_fatal);
|
|
||||||
|
|
||||||
rtc_state = ISA_DEVICE(object_resolve_path_component(OBJECT(lpc), "rtc"));
|
rtc_state = ISA_DEVICE(object_resolve_path_component(OBJECT(lpc), "rtc"));
|
||||||
|
|
||||||
@ -286,9 +275,7 @@ static void pc_q35_init(MachineState *machine)
|
|||||||
pc_i8259_create(isa_bus, gsi_state->i8259_irq);
|
pc_i8259_create(isa_bus, gsi_state->i8259_irq);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pcmc->pci_enabled) {
|
ioapic_init_gsi(gsi_state, "q35");
|
||||||
ioapic_init_gsi(gsi_state, "q35");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (tcg_enabled()) {
|
if (tcg_enabled()) {
|
||||||
x86_register_ferr_irq(x86ms->gsi[13]);
|
x86_register_ferr_irq(x86ms->gsi[13]);
|
||||||
@ -304,16 +291,20 @@ static void pc_q35_init(MachineState *machine)
|
|||||||
0xff0104);
|
0xff0104);
|
||||||
|
|
||||||
if (pcms->sata_enabled) {
|
if (pcms->sata_enabled) {
|
||||||
|
PCIDevice *pdev;
|
||||||
|
AHCIPCIState *ich9;
|
||||||
|
|
||||||
/* ahci and SATA device, for q35 1 ahci controller is built-in */
|
/* ahci and SATA device, for q35 1 ahci controller is built-in */
|
||||||
ahci = pci_create_simple_multifunction(host_bus,
|
pdev = pci_create_simple_multifunction(host_bus,
|
||||||
PCI_DEVFN(ICH9_SATA1_DEV,
|
PCI_DEVFN(ICH9_SATA1_DEV,
|
||||||
ICH9_SATA1_FUNC),
|
ICH9_SATA1_FUNC),
|
||||||
"ich9-ahci");
|
"ich9-ahci");
|
||||||
idebus[0] = qdev_get_child_bus(&ahci->qdev, "ide.0");
|
ich9 = ICH9_AHCI(pdev);
|
||||||
idebus[1] = qdev_get_child_bus(&ahci->qdev, "ide.1");
|
idebus[0] = qdev_get_child_bus(DEVICE(pdev), "ide.0");
|
||||||
g_assert(MAX_SATA_PORTS == ahci_get_num_ports(ahci));
|
idebus[1] = qdev_get_child_bus(DEVICE(pdev), "ide.1");
|
||||||
ide_drive_get(hd, ahci_get_num_ports(ahci));
|
g_assert(MAX_SATA_PORTS == ich9->ahci.ports);
|
||||||
ahci_ide_create_devs(ahci, hd);
|
ide_drive_get(hd, ich9->ahci.ports);
|
||||||
|
ahci_ide_create_devs(&ich9->ahci, hd);
|
||||||
} else {
|
} else {
|
||||||
idebus[0] = idebus[1] = NULL;
|
idebus[0] = idebus[1] = NULL;
|
||||||
}
|
}
|
||||||
|
@ -19,9 +19,8 @@
|
|||||||
#include "qemu/error-report.h"
|
#include "qemu/error-report.h"
|
||||||
#include "qemu/module.h"
|
#include "qemu/module.h"
|
||||||
#include "sysemu/dma.h"
|
#include "sysemu/dma.h"
|
||||||
#include "hw/ide/internal.h"
|
|
||||||
#include "migration/vmstate.h"
|
#include "migration/vmstate.h"
|
||||||
#include "ahci_internal.h"
|
#include "hw/ide/ahci-sysbus.h"
|
||||||
|
|
||||||
#include "trace.h"
|
#include "trace.h"
|
||||||
|
|
||||||
|
@ -36,6 +36,8 @@
|
|||||||
#include "sysemu/dma.h"
|
#include "sysemu/dma.h"
|
||||||
#include "hw/ide/internal.h"
|
#include "hw/ide/internal.h"
|
||||||
#include "hw/ide/pci.h"
|
#include "hw/ide/pci.h"
|
||||||
|
#include "hw/ide/ahci-pci.h"
|
||||||
|
#include "hw/ide/ahci-sysbus.h"
|
||||||
#include "ahci_internal.h"
|
#include "ahci_internal.h"
|
||||||
|
|
||||||
#include "trace.h"
|
#include "trace.h"
|
||||||
@ -1613,14 +1615,14 @@ void ahci_init(AHCIState *s, DeviceState *qdev)
|
|||||||
"ahci-idp", 32);
|
"ahci-idp", 32);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ahci_realize(AHCIState *s, DeviceState *qdev, AddressSpace *as, int ports)
|
void ahci_realize(AHCIState *s, DeviceState *qdev, AddressSpace *as)
|
||||||
{
|
{
|
||||||
qemu_irq *irqs;
|
qemu_irq *irqs;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
s->as = as;
|
s->as = as;
|
||||||
s->ports = ports;
|
assert(s->ports > 0);
|
||||||
s->dev = g_new0(AHCIDevice, ports);
|
s->dev = g_new0(AHCIDevice, s->ports);
|
||||||
ahci_reg_init(s);
|
ahci_reg_init(s);
|
||||||
irqs = qemu_allocate_irqs(ahci_irq_set, s, s->ports);
|
irqs = qemu_allocate_irqs(ahci_irq_set, s, s->ports);
|
||||||
for (i = 0; i < s->ports; i++) {
|
for (i = 0; i < s->ports; i++) {
|
||||||
@ -1818,7 +1820,7 @@ const VMStateDescription vmstate_ahci = {
|
|||||||
.version_id = 1,
|
.version_id = 1,
|
||||||
.post_load = ahci_state_post_load,
|
.post_load = ahci_state_post_load,
|
||||||
.fields = (const VMStateField[]) {
|
.fields = (const VMStateField[]) {
|
||||||
VMSTATE_STRUCT_VARRAY_POINTER_INT32(dev, AHCIState, ports,
|
VMSTATE_STRUCT_VARRAY_POINTER_UINT32(dev, AHCIState, ports,
|
||||||
vmstate_ahci_device, AHCIDevice),
|
vmstate_ahci_device, AHCIDevice),
|
||||||
VMSTATE_UINT32(control_regs.cap, AHCIState),
|
VMSTATE_UINT32(control_regs.cap, AHCIState),
|
||||||
VMSTATE_UINT32(control_regs.ghc, AHCIState),
|
VMSTATE_UINT32(control_regs.ghc, AHCIState),
|
||||||
@ -1826,7 +1828,7 @@ const VMStateDescription vmstate_ahci = {
|
|||||||
VMSTATE_UINT32(control_regs.impl, AHCIState),
|
VMSTATE_UINT32(control_regs.impl, AHCIState),
|
||||||
VMSTATE_UINT32(control_regs.version, AHCIState),
|
VMSTATE_UINT32(control_regs.version, AHCIState),
|
||||||
VMSTATE_UINT32(idp_index, AHCIState),
|
VMSTATE_UINT32(idp_index, AHCIState),
|
||||||
VMSTATE_INT32_EQUAL(ports, AHCIState, NULL),
|
VMSTATE_UINT32_EQUAL(ports, AHCIState, NULL),
|
||||||
VMSTATE_END_OF_LIST()
|
VMSTATE_END_OF_LIST()
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
@ -1861,11 +1863,11 @@ static void sysbus_ahci_realize(DeviceState *dev, Error **errp)
|
|||||||
{
|
{
|
||||||
SysbusAHCIState *s = SYSBUS_AHCI(dev);
|
SysbusAHCIState *s = SYSBUS_AHCI(dev);
|
||||||
|
|
||||||
ahci_realize(&s->ahci, dev, &address_space_memory, s->num_ports);
|
ahci_realize(&s->ahci, dev, &address_space_memory);
|
||||||
}
|
}
|
||||||
|
|
||||||
static Property sysbus_ahci_properties[] = {
|
static Property sysbus_ahci_properties[] = {
|
||||||
DEFINE_PROP_UINT32("num-ports", SysbusAHCIState, num_ports, 1),
|
DEFINE_PROP_UINT32("num-ports", SysbusAHCIState, ahci.ports, 1),
|
||||||
DEFINE_PROP_END_OF_LIST(),
|
DEFINE_PROP_END_OF_LIST(),
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -1895,18 +1897,8 @@ static void sysbus_ahci_register_types(void)
|
|||||||
|
|
||||||
type_init(sysbus_ahci_register_types)
|
type_init(sysbus_ahci_register_types)
|
||||||
|
|
||||||
int32_t ahci_get_num_ports(PCIDevice *dev)
|
void ahci_ide_create_devs(AHCIState *ahci, DriveInfo **hd)
|
||||||
{
|
{
|
||||||
AHCIPCIState *d = ICH9_AHCI(dev);
|
|
||||||
AHCIState *ahci = &d->ahci;
|
|
||||||
|
|
||||||
return ahci->ports;
|
|
||||||
}
|
|
||||||
|
|
||||||
void ahci_ide_create_devs(PCIDevice *dev, DriveInfo **hd)
|
|
||||||
{
|
|
||||||
AHCIPCIState *d = ICH9_AHCI(dev);
|
|
||||||
AHCIState *ahci = &d->ahci;
|
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
for (i = 0; i < ahci->ports; i++) {
|
for (i = 0; i < ahci->ports; i++) {
|
||||||
@ -1915,5 +1907,4 @@ void ahci_ide_create_devs(PCIDevice *dev, DriveInfo **hd)
|
|||||||
}
|
}
|
||||||
ide_bus_create_drive(&ahci->dev[i].port, 0, hd[i]);
|
ide_bus_create_drive(&ahci->dev[i].port, 0, hd[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -324,14 +324,6 @@ struct AHCIDevice {
|
|||||||
MemReentrancyGuard mem_reentrancy_guard;
|
MemReentrancyGuard mem_reentrancy_guard;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct AHCIPCIState {
|
|
||||||
/*< private >*/
|
|
||||||
PCIDevice parent_obj;
|
|
||||||
/*< public >*/
|
|
||||||
|
|
||||||
AHCIState ahci;
|
|
||||||
};
|
|
||||||
|
|
||||||
extern const VMStateDescription vmstate_ahci;
|
extern const VMStateDescription vmstate_ahci;
|
||||||
|
|
||||||
#define VMSTATE_AHCI(_field, _state) { \
|
#define VMSTATE_AHCI(_field, _state) { \
|
||||||
@ -385,7 +377,7 @@ typedef struct SDBFIS {
|
|||||||
uint32_t payload;
|
uint32_t payload;
|
||||||
} QEMU_PACKED SDBFIS;
|
} QEMU_PACKED SDBFIS;
|
||||||
|
|
||||||
void ahci_realize(AHCIState *s, DeviceState *qdev, AddressSpace *as, int ports);
|
void ahci_realize(AHCIState *s, DeviceState *qdev, AddressSpace *as);
|
||||||
void ahci_init(AHCIState *s, DeviceState *qdev);
|
void ahci_init(AHCIState *s, DeviceState *qdev);
|
||||||
void ahci_uninit(AHCIState *s);
|
void ahci_uninit(AHCIState *s);
|
||||||
|
|
||||||
|
10
hw/ide/ich.c
10
hw/ide/ich.c
@ -69,6 +69,7 @@
|
|||||||
#include "hw/isa/isa.h"
|
#include "hw/isa/isa.h"
|
||||||
#include "sysemu/dma.h"
|
#include "sysemu/dma.h"
|
||||||
#include "hw/ide/pci.h"
|
#include "hw/ide/pci.h"
|
||||||
|
#include "hw/ide/ahci-pci.h"
|
||||||
#include "ahci_internal.h"
|
#include "ahci_internal.h"
|
||||||
|
|
||||||
#define ICH9_MSI_CAP_OFFSET 0x80
|
#define ICH9_MSI_CAP_OFFSET 0x80
|
||||||
@ -99,20 +100,21 @@ static void pci_ich9_reset(DeviceState *dev)
|
|||||||
|
|
||||||
static void pci_ich9_ahci_init(Object *obj)
|
static void pci_ich9_ahci_init(Object *obj)
|
||||||
{
|
{
|
||||||
struct AHCIPCIState *d = ICH9_AHCI(obj);
|
AHCIPCIState *d = ICH9_AHCI(obj);
|
||||||
|
|
||||||
ahci_init(&d->ahci, DEVICE(obj));
|
ahci_init(&d->ahci, DEVICE(obj));
|
||||||
}
|
}
|
||||||
|
|
||||||
static void pci_ich9_ahci_realize(PCIDevice *dev, Error **errp)
|
static void pci_ich9_ahci_realize(PCIDevice *dev, Error **errp)
|
||||||
{
|
{
|
||||||
struct AHCIPCIState *d;
|
AHCIPCIState *d;
|
||||||
int sata_cap_offset;
|
int sata_cap_offset;
|
||||||
uint8_t *sata_cap;
|
uint8_t *sata_cap;
|
||||||
d = ICH9_AHCI(dev);
|
d = ICH9_AHCI(dev);
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
ahci_realize(&d->ahci, DEVICE(dev), pci_get_address_space(dev), 6);
|
d->ahci.ports = 6;
|
||||||
|
ahci_realize(&d->ahci, DEVICE(dev), pci_get_address_space(dev));
|
||||||
|
|
||||||
pci_config_set_prog_interface(dev->config, AHCI_PROGMODE_MAJOR_REV_1);
|
pci_config_set_prog_interface(dev->config, AHCI_PROGMODE_MAJOR_REV_1);
|
||||||
|
|
||||||
@ -154,7 +156,7 @@ static void pci_ich9_ahci_realize(PCIDevice *dev, Error **errp)
|
|||||||
|
|
||||||
static void pci_ich9_uninit(PCIDevice *dev)
|
static void pci_ich9_uninit(PCIDevice *dev)
|
||||||
{
|
{
|
||||||
struct AHCIPCIState *d;
|
AHCIPCIState *d;
|
||||||
d = ICH9_AHCI(dev);
|
d = ICH9_AHCI(dev);
|
||||||
|
|
||||||
msi_uninit(dev);
|
msi_uninit(dev);
|
||||||
|
@ -1,9 +1,11 @@
|
|||||||
/*
|
/*
|
||||||
* QEMU GRLIB IRQMP Emulator
|
* QEMU GRLIB IRQMP Emulator
|
||||||
*
|
*
|
||||||
* (Multiprocessor and extended interrupt not supported)
|
* (Extended interrupt not supported)
|
||||||
*
|
*
|
||||||
* Copyright (c) 2010-2019 AdaCore
|
* SPDX-License-Identifier: MIT
|
||||||
|
*
|
||||||
|
* Copyright (c) 2010-2024 AdaCore
|
||||||
*
|
*
|
||||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
* of this software and associated documentation files (the "Software"), to deal
|
* of this software and associated documentation files (the "Software"), to deal
|
||||||
@ -29,7 +31,7 @@
|
|||||||
#include "hw/sysbus.h"
|
#include "hw/sysbus.h"
|
||||||
|
|
||||||
#include "hw/qdev-properties.h"
|
#include "hw/qdev-properties.h"
|
||||||
#include "hw/sparc/grlib.h"
|
#include "hw/intc/grlib_irqmp.h"
|
||||||
|
|
||||||
#include "trace.h"
|
#include "trace.h"
|
||||||
#include "qapi/error.h"
|
#include "qapi/error.h"
|
||||||
@ -50,6 +52,10 @@
|
|||||||
#define FORCE_OFFSET 0x80
|
#define FORCE_OFFSET 0x80
|
||||||
#define EXTENDED_OFFSET 0xC0
|
#define EXTENDED_OFFSET 0xC0
|
||||||
|
|
||||||
|
/* Multiprocessor Status Register */
|
||||||
|
#define MP_STATUS_CPU_STATUS_MASK ((1 << IRQMP_MAX_CPU)-2)
|
||||||
|
#define MP_STATUS_NCPU_SHIFT 28
|
||||||
|
|
||||||
#define MAX_PILS 16
|
#define MAX_PILS 16
|
||||||
|
|
||||||
OBJECT_DECLARE_SIMPLE_TYPE(IRQMP, GRLIB_IRQMP)
|
OBJECT_DECLARE_SIMPLE_TYPE(IRQMP, GRLIB_IRQMP)
|
||||||
@ -61,14 +67,17 @@ struct IRQMP {
|
|||||||
|
|
||||||
MemoryRegion iomem;
|
MemoryRegion iomem;
|
||||||
|
|
||||||
|
unsigned int ncpus;
|
||||||
IRQMPState *state;
|
IRQMPState *state;
|
||||||
qemu_irq irq;
|
qemu_irq start_signal[IRQMP_MAX_CPU];
|
||||||
|
qemu_irq irq[IRQMP_MAX_CPU];
|
||||||
};
|
};
|
||||||
|
|
||||||
struct IRQMPState {
|
struct IRQMPState {
|
||||||
uint32_t level;
|
uint32_t level;
|
||||||
uint32_t pending;
|
uint32_t pending;
|
||||||
uint32_t clear;
|
uint32_t clear;
|
||||||
|
uint32_t mpstatus;
|
||||||
uint32_t broadcast;
|
uint32_t broadcast;
|
||||||
|
|
||||||
uint32_t mask[IRQMP_MAX_CPU];
|
uint32_t mask[IRQMP_MAX_CPU];
|
||||||
@ -80,37 +89,35 @@ struct IRQMPState {
|
|||||||
|
|
||||||
static void grlib_irqmp_check_irqs(IRQMPState *state)
|
static void grlib_irqmp_check_irqs(IRQMPState *state)
|
||||||
{
|
{
|
||||||
uint32_t pend = 0;
|
int i;
|
||||||
uint32_t level0 = 0;
|
|
||||||
uint32_t level1 = 0;
|
|
||||||
|
|
||||||
assert(state != NULL);
|
assert(state != NULL);
|
||||||
assert(state->parent != NULL);
|
assert(state->parent != NULL);
|
||||||
|
|
||||||
/* IRQ for CPU 0 (no SMP support) */
|
for (i = 0; i < state->parent->ncpus; i++) {
|
||||||
pend = (state->pending | state->force[0])
|
uint32_t pend = (state->pending | state->force[i]) & state->mask[i];
|
||||||
& state->mask[0];
|
uint32_t level0 = pend & ~state->level;
|
||||||
|
uint32_t level1 = pend & state->level;
|
||||||
|
|
||||||
level0 = pend & ~state->level;
|
trace_grlib_irqmp_check_irqs(state->pending, state->force[i],
|
||||||
level1 = pend & state->level;
|
state->mask[i], level1, level0);
|
||||||
|
|
||||||
trace_grlib_irqmp_check_irqs(state->pending, state->force[0],
|
/* Trigger level1 interrupt first and level0 if there is no level1 */
|
||||||
state->mask[0], level1, level0);
|
qemu_set_irq(state->parent->irq[i], level1 ?: level0);
|
||||||
|
}
|
||||||
/* Trigger level1 interrupt first and level0 if there is no level1 */
|
|
||||||
qemu_set_irq(state->parent->irq, level1 ?: level0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void grlib_irqmp_ack_mask(IRQMPState *state, uint32_t mask)
|
static void grlib_irqmp_ack_mask(IRQMPState *state, unsigned int cpu,
|
||||||
|
uint32_t mask)
|
||||||
{
|
{
|
||||||
/* Clear registers */
|
/* Clear registers */
|
||||||
state->pending &= ~mask;
|
state->pending &= ~mask;
|
||||||
state->force[0] &= ~mask; /* Only CPU 0 (No SMP support) */
|
state->force[cpu] &= ~mask;
|
||||||
|
|
||||||
grlib_irqmp_check_irqs(state);
|
grlib_irqmp_check_irqs(state);
|
||||||
}
|
}
|
||||||
|
|
||||||
void grlib_irqmp_ack(DeviceState *dev, int intno)
|
void grlib_irqmp_ack(DeviceState *dev, unsigned int cpu, int intno)
|
||||||
{
|
{
|
||||||
IRQMP *irqmp = GRLIB_IRQMP(dev);
|
IRQMP *irqmp = GRLIB_IRQMP(dev);
|
||||||
IRQMPState *state;
|
IRQMPState *state;
|
||||||
@ -124,7 +131,7 @@ void grlib_irqmp_ack(DeviceState *dev, int intno)
|
|||||||
|
|
||||||
trace_grlib_irqmp_ack(intno);
|
trace_grlib_irqmp_ack(intno);
|
||||||
|
|
||||||
grlib_irqmp_ack_mask(state, mask);
|
grlib_irqmp_ack_mask(state, cpu, mask);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void grlib_irqmp_set_irq(void *opaque, int irq, int level)
|
static void grlib_irqmp_set_irq(void *opaque, int irq, int level)
|
||||||
@ -150,7 +157,6 @@ static void grlib_irqmp_set_irq(void *opaque, int irq, int level)
|
|||||||
s->pending |= 1 << irq;
|
s->pending |= 1 << irq;
|
||||||
}
|
}
|
||||||
grlib_irqmp_check_irqs(s);
|
grlib_irqmp_check_irqs(s);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -179,10 +185,12 @@ static uint64_t grlib_irqmp_read(void *opaque, hwaddr addr,
|
|||||||
return state->force[0];
|
return state->force[0];
|
||||||
|
|
||||||
case CLEAR_OFFSET:
|
case CLEAR_OFFSET:
|
||||||
case MP_STATUS_OFFSET:
|
|
||||||
/* Always read as 0 */
|
/* Always read as 0 */
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
case MP_STATUS_OFFSET:
|
||||||
|
return state->mpstatus;
|
||||||
|
|
||||||
case BROADCAST_OFFSET:
|
case BROADCAST_OFFSET:
|
||||||
return state->broadcast;
|
return state->broadcast;
|
||||||
|
|
||||||
@ -221,8 +229,9 @@ static uint64_t grlib_irqmp_read(void *opaque, hwaddr addr,
|
|||||||
static void grlib_irqmp_write(void *opaque, hwaddr addr,
|
static void grlib_irqmp_write(void *opaque, hwaddr addr,
|
||||||
uint64_t value, unsigned size)
|
uint64_t value, unsigned size)
|
||||||
{
|
{
|
||||||
IRQMP *irqmp = opaque;
|
IRQMP *irqmp = opaque;
|
||||||
IRQMPState *state;
|
IRQMPState *state;
|
||||||
|
int i;
|
||||||
|
|
||||||
assert(irqmp != NULL);
|
assert(irqmp != NULL);
|
||||||
state = irqmp->state;
|
state = irqmp->state;
|
||||||
@ -251,11 +260,24 @@ static void grlib_irqmp_write(void *opaque, hwaddr addr,
|
|||||||
|
|
||||||
case CLEAR_OFFSET:
|
case CLEAR_OFFSET:
|
||||||
value &= ~1; /* clean up the value */
|
value &= ~1; /* clean up the value */
|
||||||
grlib_irqmp_ack_mask(state, value);
|
for (i = 0; i < irqmp->ncpus; i++) {
|
||||||
|
grlib_irqmp_ack_mask(state, i, value);
|
||||||
|
}
|
||||||
return;
|
return;
|
||||||
|
|
||||||
case MP_STATUS_OFFSET:
|
case MP_STATUS_OFFSET:
|
||||||
/* Read Only (no SMP support) */
|
/*
|
||||||
|
* Writing and reading operations are reversed for the CPU status.
|
||||||
|
* Writing "1" will start the CPU, but reading "1" means that the CPU
|
||||||
|
* is power-down.
|
||||||
|
*/
|
||||||
|
value &= MP_STATUS_CPU_STATUS_MASK;
|
||||||
|
for (i = 0; i < irqmp->ncpus; i++) {
|
||||||
|
if ((value >> i) & 1) {
|
||||||
|
qemu_set_irq(irqmp->start_signal[i], 1);
|
||||||
|
state->mpstatus &= ~(1 << i);
|
||||||
|
}
|
||||||
|
}
|
||||||
return;
|
return;
|
||||||
|
|
||||||
case BROADCAST_OFFSET:
|
case BROADCAST_OFFSET:
|
||||||
@ -322,35 +344,55 @@ static void grlib_irqmp_reset(DeviceState *d)
|
|||||||
|
|
||||||
memset(irqmp->state, 0, sizeof *irqmp->state);
|
memset(irqmp->state, 0, sizeof *irqmp->state);
|
||||||
irqmp->state->parent = irqmp;
|
irqmp->state->parent = irqmp;
|
||||||
|
irqmp->state->mpstatus = ((irqmp->ncpus - 1) << MP_STATUS_NCPU_SHIFT) |
|
||||||
|
((1 << irqmp->ncpus) - 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void grlib_irqmp_init(Object *obj)
|
static void grlib_irqmp_realize(DeviceState *dev, Error **errp)
|
||||||
{
|
{
|
||||||
IRQMP *irqmp = GRLIB_IRQMP(obj);
|
IRQMP *irqmp = GRLIB_IRQMP(dev);
|
||||||
SysBusDevice *dev = SYS_BUS_DEVICE(obj);
|
|
||||||
|
|
||||||
qdev_init_gpio_in(DEVICE(obj), grlib_irqmp_set_irq, MAX_PILS);
|
if ((!irqmp->ncpus) || (irqmp->ncpus > IRQMP_MAX_CPU)) {
|
||||||
qdev_init_gpio_out_named(DEVICE(obj), &irqmp->irq, "grlib-irq", 1);
|
error_setg(errp, "Invalid ncpus properties: "
|
||||||
memory_region_init_io(&irqmp->iomem, obj, &grlib_irqmp_ops, irqmp,
|
"%u, must be 0 < ncpus =< %u.", irqmp->ncpus,
|
||||||
|
IRQMP_MAX_CPU);
|
||||||
|
}
|
||||||
|
|
||||||
|
qdev_init_gpio_in(dev, grlib_irqmp_set_irq, MAX_PILS);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Transitionning from 0 to 1 starts the CPUs. The opposite can't
|
||||||
|
* happen.
|
||||||
|
*/
|
||||||
|
qdev_init_gpio_out_named(dev, irqmp->start_signal, "grlib-start-cpu",
|
||||||
|
IRQMP_MAX_CPU);
|
||||||
|
qdev_init_gpio_out_named(dev, irqmp->irq, "grlib-irq", irqmp->ncpus);
|
||||||
|
memory_region_init_io(&irqmp->iomem, OBJECT(dev), &grlib_irqmp_ops, irqmp,
|
||||||
"irqmp", IRQMP_REG_SIZE);
|
"irqmp", IRQMP_REG_SIZE);
|
||||||
|
|
||||||
irqmp->state = g_malloc0(sizeof *irqmp->state);
|
irqmp->state = g_malloc0(sizeof *irqmp->state);
|
||||||
|
|
||||||
sysbus_init_mmio(dev, &irqmp->iomem);
|
sysbus_init_mmio(SYS_BUS_DEVICE(dev), &irqmp->iomem);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static Property grlib_irqmp_properties[] = {
|
||||||
|
DEFINE_PROP_UINT32("ncpus", IRQMP, ncpus, 1),
|
||||||
|
DEFINE_PROP_END_OF_LIST(),
|
||||||
|
};
|
||||||
|
|
||||||
static void grlib_irqmp_class_init(ObjectClass *klass, void *data)
|
static void grlib_irqmp_class_init(ObjectClass *klass, void *data)
|
||||||
{
|
{
|
||||||
DeviceClass *dc = DEVICE_CLASS(klass);
|
DeviceClass *dc = DEVICE_CLASS(klass);
|
||||||
|
|
||||||
|
dc->realize = grlib_irqmp_realize;
|
||||||
dc->reset = grlib_irqmp_reset;
|
dc->reset = grlib_irqmp_reset;
|
||||||
|
device_class_set_props(dc, grlib_irqmp_properties);
|
||||||
}
|
}
|
||||||
|
|
||||||
static const TypeInfo grlib_irqmp_info = {
|
static const TypeInfo grlib_irqmp_info = {
|
||||||
.name = TYPE_GRLIB_IRQMP,
|
.name = TYPE_GRLIB_IRQMP,
|
||||||
.parent = TYPE_SYS_BUS_DEVICE,
|
.parent = TYPE_SYS_BUS_DEVICE,
|
||||||
.instance_size = sizeof(IRQMP),
|
.instance_size = sizeof(IRQMP),
|
||||||
.instance_init = grlib_irqmp_init,
|
|
||||||
.class_init = grlib_irqmp_class_init,
|
.class_init = grlib_irqmp_class_init,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -15,9 +15,17 @@ config I82378
|
|||||||
|
|
||||||
config ISA_SUPERIO
|
config ISA_SUPERIO
|
||||||
bool
|
bool
|
||||||
select ISA_BUS
|
depends on ISA_BUS
|
||||||
select PCKBD
|
select PCKBD
|
||||||
|
select PARALLEL
|
||||||
|
select SERIAL_ISA
|
||||||
select FDC_ISA
|
select FDC_ISA
|
||||||
|
# Some users of ISA_SUPERIO do not use it
|
||||||
|
#select IDE_ISA
|
||||||
|
|
||||||
|
config FDC37M81X
|
||||||
|
bool
|
||||||
|
select ISA_SUPERIO
|
||||||
|
|
||||||
config PC87312
|
config PC87312
|
||||||
bool
|
bool
|
||||||
@ -26,9 +34,6 @@ config PC87312
|
|||||||
select I8254
|
select I8254
|
||||||
select I8257
|
select I8257
|
||||||
select MC146818RTC
|
select MC146818RTC
|
||||||
select SERIAL_ISA
|
|
||||||
select PARALLEL
|
|
||||||
select FDC_ISA
|
|
||||||
select IDE_ISA
|
select IDE_ISA
|
||||||
|
|
||||||
config PIIX
|
config PIIX
|
||||||
@ -46,11 +51,10 @@ config PIIX
|
|||||||
|
|
||||||
config VT82C686
|
config VT82C686
|
||||||
bool
|
bool
|
||||||
|
select ISA_BUS
|
||||||
select ISA_SUPERIO
|
select ISA_SUPERIO
|
||||||
select ACPI
|
select ACPI
|
||||||
select ACPI_SMBUS
|
select ACPI_SMBUS
|
||||||
select SERIAL_ISA
|
|
||||||
select FDC_ISA
|
|
||||||
select USB_UHCI
|
select USB_UHCI
|
||||||
select APM
|
select APM
|
||||||
select I8254
|
select I8254
|
||||||
@ -58,14 +62,10 @@ config VT82C686
|
|||||||
select I8259
|
select I8259
|
||||||
select IDE_VIA
|
select IDE_VIA
|
||||||
select MC146818RTC
|
select MC146818RTC
|
||||||
select PARALLEL
|
|
||||||
|
|
||||||
config SMC37C669
|
config SMC37C669
|
||||||
bool
|
bool
|
||||||
select ISA_SUPERIO
|
select ISA_SUPERIO
|
||||||
select SERIAL_ISA
|
|
||||||
select PARALLEL
|
|
||||||
select FDC_ISA
|
|
||||||
|
|
||||||
config LPC_ICH9
|
config LPC_ICH9
|
||||||
bool
|
bool
|
||||||
|
32
hw/isa/fdc37m81x-superio.c
Normal file
32
hw/isa/fdc37m81x-superio.c
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
/*
|
||||||
|
* SMS FDC37M817 Super I/O
|
||||||
|
*
|
||||||
|
* Copyright (c) 2018 Philippe Mathieu-Daudé
|
||||||
|
*
|
||||||
|
* This work is licensed under the terms of the GNU GPL, version 2 or later.
|
||||||
|
* See the COPYING file in the top-level directory.
|
||||||
|
* SPDX-License-Identifier: GPL-2.0-or-later
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "qemu/osdep.h"
|
||||||
|
#include "hw/isa/superio.h"
|
||||||
|
|
||||||
|
static void fdc37m81x_class_init(ObjectClass *klass, void *data)
|
||||||
|
{
|
||||||
|
ISASuperIOClass *sc = ISA_SUPERIO_CLASS(klass);
|
||||||
|
|
||||||
|
sc->serial.count = 2; /* NS16C550A */
|
||||||
|
sc->parallel.count = 1;
|
||||||
|
sc->floppy.count = 1; /* SMSC 82077AA Compatible */
|
||||||
|
sc->ide.count = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static const TypeInfo types[] = {
|
||||||
|
{
|
||||||
|
.name = TYPE_FDC37M81X_SUPERIO,
|
||||||
|
.parent = TYPE_ISA_SUPERIO,
|
||||||
|
.class_init = fdc37m81x_class_init,
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
DEFINE_TYPES(types)
|
@ -185,30 +185,12 @@ static const TypeInfo isa_superio_type_info = {
|
|||||||
.abstract = true,
|
.abstract = true,
|
||||||
.class_size = sizeof(ISASuperIOClass),
|
.class_size = sizeof(ISASuperIOClass),
|
||||||
.class_init = isa_superio_class_init,
|
.class_init = isa_superio_class_init,
|
||||||
};
|
|
||||||
|
|
||||||
/* SMS FDC37M817 Super I/O */
|
|
||||||
static void fdc37m81x_class_init(ObjectClass *klass, void *data)
|
|
||||||
{
|
|
||||||
ISASuperIOClass *sc = ISA_SUPERIO_CLASS(klass);
|
|
||||||
|
|
||||||
sc->serial.count = 2; /* NS16C550A */
|
|
||||||
sc->parallel.count = 1;
|
|
||||||
sc->floppy.count = 1; /* SMSC 82077AA Compatible */
|
|
||||||
sc->ide.count = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
static const TypeInfo fdc37m81x_type_info = {
|
|
||||||
.name = TYPE_FDC37M81X_SUPERIO,
|
|
||||||
.parent = TYPE_ISA_SUPERIO,
|
|
||||||
.instance_size = sizeof(ISASuperIODevice),
|
.instance_size = sizeof(ISASuperIODevice),
|
||||||
.class_init = fdc37m81x_class_init,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
static void isa_superio_register_types(void)
|
static void isa_superio_register_types(void)
|
||||||
{
|
{
|
||||||
type_register_static(&isa_superio_type_info);
|
type_register_static(&isa_superio_type_info);
|
||||||
type_register_static(&fdc37m81x_type_info);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
type_init(isa_superio_register_types)
|
type_init(isa_superio_register_types)
|
||||||
|
@ -739,7 +739,7 @@ static void ich9_lpc_realize(PCIDevice *d, Error **errp)
|
|||||||
|
|
||||||
isa_bus_register_input_irqs(isa_bus, lpc->gsi);
|
isa_bus_register_input_irqs(isa_bus, lpc->gsi);
|
||||||
|
|
||||||
i8257_dma_init(isa_bus, 0);
|
i8257_dma_init(OBJECT(d), isa_bus, 0);
|
||||||
|
|
||||||
/* RTC */
|
/* RTC */
|
||||||
qdev_prop_set_int32(DEVICE(&lpc->rtc), "base_year", 2000);
|
qdev_prop_set_int32(DEVICE(&lpc->rtc), "base_year", 2000);
|
||||||
|
@ -4,6 +4,7 @@ system_ss.add(when: 'CONFIG_ISA_BUS', if_true: files('isa-bus.c'))
|
|||||||
system_ss.add(when: 'CONFIG_ISA_SUPERIO', if_true: files('isa-superio.c'))
|
system_ss.add(when: 'CONFIG_ISA_SUPERIO', if_true: files('isa-superio.c'))
|
||||||
system_ss.add(when: 'CONFIG_PC87312', if_true: files('pc87312.c'))
|
system_ss.add(when: 'CONFIG_PC87312', if_true: files('pc87312.c'))
|
||||||
system_ss.add(when: 'CONFIG_PIIX', if_true: files('piix.c'))
|
system_ss.add(when: 'CONFIG_PIIX', if_true: files('piix.c'))
|
||||||
|
system_ss.add(when: 'CONFIG_FDC37M81X', if_true: files('fdc37m81x-superio.c'))
|
||||||
system_ss.add(when: 'CONFIG_SMC37C669', if_true: files('smc37c669-superio.c'))
|
system_ss.add(when: 'CONFIG_SMC37C669', if_true: files('smc37c669-superio.c'))
|
||||||
system_ss.add(when: 'CONFIG_VT82C686', if_true: files('vt82c686.c'))
|
system_ss.add(when: 'CONFIG_VT82C686', if_true: files('vt82c686.c'))
|
||||||
|
|
||||||
|
@ -336,7 +336,7 @@ static void pci_piix_realize(PCIDevice *dev, const char *uhci_type,
|
|||||||
i8254_pit_init(isa_bus, 0x40, 0, NULL);
|
i8254_pit_init(isa_bus, 0x40, 0, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
i8257_dma_init(isa_bus, 0);
|
i8257_dma_init(OBJECT(dev), isa_bus, 0);
|
||||||
|
|
||||||
/* RTC */
|
/* RTC */
|
||||||
qdev_prop_set_int32(DEVICE(&d->rtc), "base_year", 2000);
|
qdev_prop_set_int32(DEVICE(&d->rtc), "base_year", 2000);
|
||||||
|
@ -103,7 +103,6 @@ static void smc37c669_class_init(ObjectClass *klass, void *data)
|
|||||||
static const TypeInfo smc37c669_type_info = {
|
static const TypeInfo smc37c669_type_info = {
|
||||||
.name = TYPE_SMC37C669_SUPERIO,
|
.name = TYPE_SMC37C669_SUPERIO,
|
||||||
.parent = TYPE_ISA_SUPERIO,
|
.parent = TYPE_ISA_SUPERIO,
|
||||||
.instance_size = sizeof(ISASuperIODevice),
|
|
||||||
.class_size = sizeof(ISASuperIOClass),
|
.class_size = sizeof(ISASuperIOClass),
|
||||||
.class_init = smc37c669_class_init,
|
.class_init = smc37c669_class_init,
|
||||||
};
|
};
|
||||||
|
@ -731,7 +731,7 @@ static void via_isa_realize(PCIDevice *d, Error **errp)
|
|||||||
s->isa_irqs_in = i8259_init(isa_bus, *isa_irq);
|
s->isa_irqs_in = i8259_init(isa_bus, *isa_irq);
|
||||||
isa_bus_register_input_irqs(isa_bus, s->isa_irqs_in);
|
isa_bus_register_input_irqs(isa_bus, s->isa_irqs_in);
|
||||||
i8254_pit_init(isa_bus, 0x40, 0, NULL);
|
i8254_pit_init(isa_bus, 0x40, 0, NULL);
|
||||||
i8257_dma_init(isa_bus, 0);
|
i8257_dma_init(OBJECT(d), isa_bus, 0);
|
||||||
|
|
||||||
/* RTC */
|
/* RTC */
|
||||||
qdev_prop_set_int32(DEVICE(&s->rtc), "base_year", 2000);
|
qdev_prop_set_int32(DEVICE(&s->rtc), "base_year", 2000);
|
||||||
|
@ -1,13 +1,12 @@
|
|||||||
config MALTA
|
config MALTA
|
||||||
bool
|
bool
|
||||||
|
select FDC37M81X
|
||||||
select GT64120
|
select GT64120
|
||||||
select ISA_SUPERIO
|
|
||||||
select PIIX
|
select PIIX
|
||||||
|
|
||||||
config MIPSSIM
|
config MIPSSIM
|
||||||
bool
|
bool
|
||||||
select ISA_BUS
|
select SERIAL
|
||||||
select SERIAL_ISA
|
|
||||||
select MIPSNET
|
select MIPSNET
|
||||||
|
|
||||||
config JAZZ
|
config JAZZ
|
||||||
@ -50,7 +49,6 @@ config LOONGSON3V
|
|||||||
|
|
||||||
config MIPS_CPS
|
config MIPS_CPS
|
||||||
bool
|
bool
|
||||||
select PTIMER
|
|
||||||
select MIPS_ITU
|
select MIPS_ITU
|
||||||
|
|
||||||
config MIPS_BOSTON
|
config MIPS_BOSTON
|
||||||
|
@ -24,7 +24,7 @@
|
|||||||
#include "hw/boards.h"
|
#include "hw/boards.h"
|
||||||
#include "hw/char/serial.h"
|
#include "hw/char/serial.h"
|
||||||
#include "hw/ide/pci.h"
|
#include "hw/ide/pci.h"
|
||||||
#include "hw/ide/ahci.h"
|
#include "hw/ide/ahci-pci.h"
|
||||||
#include "hw/loader.h"
|
#include "hw/loader.h"
|
||||||
#include "hw/loader-fit.h"
|
#include "hw/loader-fit.h"
|
||||||
#include "hw/mips/bootloader.h"
|
#include "hw/mips/bootloader.h"
|
||||||
@ -677,7 +677,8 @@ static void boston_mach_init(MachineState *machine)
|
|||||||
MemoryRegion *flash, *ddr_low_alias, *lcd, *platreg;
|
MemoryRegion *flash, *ddr_low_alias, *lcd, *platreg;
|
||||||
MemoryRegion *sys_mem = get_system_memory();
|
MemoryRegion *sys_mem = get_system_memory();
|
||||||
XilinxPCIEHost *pcie2;
|
XilinxPCIEHost *pcie2;
|
||||||
PCIDevice *ahci;
|
PCIDevice *pdev;
|
||||||
|
AHCIPCIState *ich9;
|
||||||
DriveInfo *hd[6];
|
DriveInfo *hd[6];
|
||||||
Chardev *chr;
|
Chardev *chr;
|
||||||
int fw_size, fit_err;
|
int fw_size, fit_err;
|
||||||
@ -769,11 +770,12 @@ static void boston_mach_init(MachineState *machine)
|
|||||||
qemu_chr_fe_set_handlers(&s->lcd_display, NULL, NULL,
|
qemu_chr_fe_set_handlers(&s->lcd_display, NULL, NULL,
|
||||||
boston_lcd_event, NULL, s, NULL, true);
|
boston_lcd_event, NULL, s, NULL, true);
|
||||||
|
|
||||||
ahci = pci_create_simple_multifunction(&PCI_BRIDGE(&pcie2->root)->sec_bus,
|
pdev = pci_create_simple_multifunction(&PCI_BRIDGE(&pcie2->root)->sec_bus,
|
||||||
PCI_DEVFN(0, 0), TYPE_ICH9_AHCI);
|
PCI_DEVFN(0, 0), TYPE_ICH9_AHCI);
|
||||||
g_assert(ARRAY_SIZE(hd) == ahci_get_num_ports(ahci));
|
ich9 = ICH9_AHCI(pdev);
|
||||||
ide_drive_get(hd, ahci_get_num_ports(ahci));
|
g_assert(ARRAY_SIZE(hd) == ich9->ahci.ports);
|
||||||
ahci_ide_create_devs(ahci, hd);
|
ide_drive_get(hd, ich9->ahci.ports);
|
||||||
|
ahci_ide_create_devs(&ich9->ahci, hd);
|
||||||
|
|
||||||
if (machine->firmware) {
|
if (machine->firmware) {
|
||||||
fw_size = load_image_targphys(machine->firmware,
|
fw_size = load_image_targphys(machine->firmware,
|
||||||
|
@ -96,7 +96,6 @@ static void mips_cps_realize(DeviceState *dev, Error **errp)
|
|||||||
itu_present = true;
|
itu_present = true;
|
||||||
/* Attach ITC Tag to the VP */
|
/* Attach ITC Tag to the VP */
|
||||||
env->itc_tag = mips_itu_get_tag_region(&s->itu);
|
env->itc_tag = mips_itu_get_tag_region(&s->itu);
|
||||||
env->itu = &s->itu;
|
|
||||||
}
|
}
|
||||||
qemu_register_reset(main_cpu_reset, cpu);
|
qemu_register_reset(main_cpu_reset, cpu);
|
||||||
}
|
}
|
||||||
@ -104,8 +103,6 @@ static void mips_cps_realize(DeviceState *dev, Error **errp)
|
|||||||
/* Inter-Thread Communication Unit */
|
/* Inter-Thread Communication Unit */
|
||||||
if (itu_present) {
|
if (itu_present) {
|
||||||
object_initialize_child(OBJECT(dev), "itu", &s->itu, TYPE_MIPS_ITU);
|
object_initialize_child(OBJECT(dev), "itu", &s->itu, TYPE_MIPS_ITU);
|
||||||
object_property_set_link(OBJECT(&s->itu), "cpu[0]",
|
|
||||||
OBJECT(first_cpu), &error_abort);
|
|
||||||
object_property_set_uint(OBJECT(&s->itu), "num-fifo", 16,
|
object_property_set_uint(OBJECT(&s->itu), "num-fifo", 16,
|
||||||
&error_abort);
|
&error_abort);
|
||||||
object_property_set_uint(OBJECT(&s->itu), "num-semaphores", 16,
|
object_property_set_uint(OBJECT(&s->itu), "num-semaphores", 16,
|
||||||
|
@ -289,7 +289,7 @@ static void mips_jazz_init(MachineState *machine,
|
|||||||
/* ISA devices */
|
/* ISA devices */
|
||||||
i8259 = i8259_init(isa_bus, env->irq[4]);
|
i8259 = i8259_init(isa_bus, env->irq[4]);
|
||||||
isa_bus_register_input_irqs(isa_bus, i8259);
|
isa_bus_register_input_irqs(isa_bus, i8259);
|
||||||
i8257_dma_init(isa_bus, 0);
|
i8257_dma_init(OBJECT(rc4030), isa_bus, 0);
|
||||||
pit = i8254_pit_init(isa_bus, 0x40, 0, NULL);
|
pit = i8254_pit_init(isa_bus, 0x40, 0, NULL);
|
||||||
pcspk = isa_new(TYPE_PC_SPEAKER);
|
pcspk = isa_new(TYPE_PC_SPEAKER);
|
||||||
object_property_set_link(OBJECT(pcspk), "pit", OBJECT(pit), &error_fatal);
|
object_property_set_link(OBJECT(pcspk), "pit", OBJECT(pit), &error_fatal);
|
||||||
|
@ -31,7 +31,6 @@
|
|||||||
#include "hw/clock.h"
|
#include "hw/clock.h"
|
||||||
#include "hw/mips/mips.h"
|
#include "hw/mips/mips.h"
|
||||||
#include "hw/char/serial.h"
|
#include "hw/char/serial.h"
|
||||||
#include "hw/isa/isa.h"
|
|
||||||
#include "net/net.h"
|
#include "net/net.h"
|
||||||
#include "sysemu/sysemu.h"
|
#include "sysemu/sysemu.h"
|
||||||
#include "hw/boards.h"
|
#include "hw/boards.h"
|
||||||
@ -206,7 +205,11 @@ mips_mipssim_init(MachineState *machine)
|
|||||||
cpu_mips_irq_init_cpu(cpu);
|
cpu_mips_irq_init_cpu(cpu);
|
||||||
cpu_mips_clock_init(cpu);
|
cpu_mips_clock_init(cpu);
|
||||||
|
|
||||||
/* Register 64 KB of ISA IO space at 0x1fd00000. */
|
/*
|
||||||
|
* Register 64 KB of ISA IO space at 0x1fd00000. But without interrupts
|
||||||
|
* (except for the hardcoded serial port interrupt) -device cannot work,
|
||||||
|
* so do not expose the ISA bus to the user.
|
||||||
|
*/
|
||||||
memory_region_init_alias(isa, NULL, "isa_mmio",
|
memory_region_init_alias(isa, NULL, "isa_mmio",
|
||||||
get_system_io(), 0, 0x00010000);
|
get_system_io(), 0, 0x00010000);
|
||||||
memory_region_add_subregion(get_system_memory(), 0x1fd00000, isa);
|
memory_region_add_subregion(get_system_memory(), 0x1fd00000, isa);
|
||||||
|
@ -123,14 +123,17 @@ static bool macio_realize_ide(MacIOState *s, MACIOIDEState *ide,
|
|||||||
{
|
{
|
||||||
SysBusDevice *sbd = SYS_BUS_DEVICE(ide);
|
SysBusDevice *sbd = SYS_BUS_DEVICE(ide);
|
||||||
|
|
||||||
sysbus_connect_irq(sbd, 0, irq0);
|
|
||||||
sysbus_connect_irq(sbd, 1, irq1);
|
|
||||||
qdev_prop_set_uint32(DEVICE(ide), "channel", dmaid);
|
qdev_prop_set_uint32(DEVICE(ide), "channel", dmaid);
|
||||||
object_property_set_link(OBJECT(ide), "dbdma", OBJECT(&s->dbdma),
|
object_property_set_link(OBJECT(ide), "dbdma", OBJECT(&s->dbdma),
|
||||||
&error_abort);
|
&error_abort);
|
||||||
macio_ide_register_dma(ide);
|
macio_ide_register_dma(ide);
|
||||||
|
if (!qdev_realize(DEVICE(ide), BUS(&s->macio_bus), errp)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
sysbus_connect_irq(sbd, 0, irq0);
|
||||||
|
sysbus_connect_irq(sbd, 1, irq1);
|
||||||
|
|
||||||
return qdev_realize(DEVICE(ide), BUS(&s->macio_bus), errp);
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void macio_oldworld_realize(PCIDevice *d, Error **errp)
|
static void macio_oldworld_realize(PCIDevice *d, Error **errp)
|
||||||
|
@ -86,7 +86,7 @@ static uint64_t itc_tag_read(void *opaque, hwaddr addr, unsigned size)
|
|||||||
return tag->ITCAddressMap[index];
|
return tag->ITCAddressMap[index];
|
||||||
}
|
}
|
||||||
|
|
||||||
void itc_reconfigure(MIPSITUState *tag)
|
static void itc_reconfigure(MIPSITUState *tag)
|
||||||
{
|
{
|
||||||
uint64_t *am = &tag->ITCAddressMap[0];
|
uint64_t *am = &tag->ITCAddressMap[0];
|
||||||
MemoryRegion *mr = &tag->storage_io;
|
MemoryRegion *mr = &tag->storage_io;
|
||||||
@ -94,12 +94,6 @@ void itc_reconfigure(MIPSITUState *tag)
|
|||||||
uint64_t size = (1 * KiB) + (am[1] & ITC_AM1_ADDR_MASK_MASK);
|
uint64_t size = (1 * KiB) + (am[1] & ITC_AM1_ADDR_MASK_MASK);
|
||||||
bool is_enabled = (am[0] & ITC_AM0_EN_MASK) != 0;
|
bool is_enabled = (am[0] & ITC_AM0_EN_MASK) != 0;
|
||||||
|
|
||||||
if (tag->saar) {
|
|
||||||
address = (tag->saar[0] & 0xFFFFFFFFE000ULL) << 4;
|
|
||||||
size = 1ULL << ((tag->saar[0] >> 1) & 0x1f);
|
|
||||||
is_enabled = tag->saar[0] & 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
memory_region_transaction_begin();
|
memory_region_transaction_begin();
|
||||||
if (!(size & (size - 1))) {
|
if (!(size & (size - 1))) {
|
||||||
memory_region_set_size(mr, size);
|
memory_region_set_size(mr, size);
|
||||||
@ -158,12 +152,7 @@ static inline ITCView get_itc_view(hwaddr addr)
|
|||||||
static inline int get_cell_stride_shift(const MIPSITUState *s)
|
static inline int get_cell_stride_shift(const MIPSITUState *s)
|
||||||
{
|
{
|
||||||
/* Minimum interval (for EntryGain = 0) is 128 B */
|
/* Minimum interval (for EntryGain = 0) is 128 B */
|
||||||
if (s->saar) {
|
return 7 + (s->ITCAddressMap[1] & ITC_AM1_ENTRY_GRAIN_MASK);
|
||||||
return 7 + ((s->icr0 >> ITC_ICR0_BLK_GRAIN) &
|
|
||||||
ITC_ICR0_BLK_GRAIN_MASK);
|
|
||||||
} else {
|
|
||||||
return 7 + (s->ITCAddressMap[1] & ITC_AM1_ENTRY_GRAIN_MASK);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline ITCStorageCell *get_cell(MIPSITUState *s,
|
static inline ITCStorageCell *get_cell(MIPSITUState *s,
|
||||||
@ -516,7 +505,6 @@ static void mips_itu_init(Object *obj)
|
|||||||
static void mips_itu_realize(DeviceState *dev, Error **errp)
|
static void mips_itu_realize(DeviceState *dev, Error **errp)
|
||||||
{
|
{
|
||||||
MIPSITUState *s = MIPS_ITU(dev);
|
MIPSITUState *s = MIPS_ITU(dev);
|
||||||
CPUMIPSState *env;
|
|
||||||
|
|
||||||
if (s->num_fifo > ITC_FIFO_NUM_MAX) {
|
if (s->num_fifo > ITC_FIFO_NUM_MAX) {
|
||||||
error_setg(errp, "Exceed maximum number of FIFO cells: %d",
|
error_setg(errp, "Exceed maximum number of FIFO cells: %d",
|
||||||
@ -528,15 +516,6 @@ static void mips_itu_realize(DeviceState *dev, Error **errp)
|
|||||||
s->num_semaphores);
|
s->num_semaphores);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (!s->cpu0) {
|
|
||||||
error_setg(errp, "Missing 'cpu[0]' property");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
env = &MIPS_CPU(s->cpu0)->env;
|
|
||||||
if (env->saarp) {
|
|
||||||
s->saar = env->CP0_SAAR;
|
|
||||||
}
|
|
||||||
|
|
||||||
s->cell = g_new(ITCStorageCell, get_num_cells(s));
|
s->cell = g_new(ITCStorageCell, get_num_cells(s));
|
||||||
}
|
}
|
||||||
@ -545,15 +524,10 @@ static void mips_itu_reset(DeviceState *dev)
|
|||||||
{
|
{
|
||||||
MIPSITUState *s = MIPS_ITU(dev);
|
MIPSITUState *s = MIPS_ITU(dev);
|
||||||
|
|
||||||
if (s->saar) {
|
s->ITCAddressMap[0] = 0;
|
||||||
s->saar[0] = 0x11 << 1;
|
s->ITCAddressMap[1] =
|
||||||
s->icr0 = get_num_cells(s) << ITC_ICR0_CELL_NUM;
|
|
||||||
} else {
|
|
||||||
s->ITCAddressMap[0] = 0;
|
|
||||||
s->ITCAddressMap[1] =
|
|
||||||
((ITC_STORAGE_ADDRSPACE_SZ - 1) & ITC_AM1_ADDR_MASK_MASK) |
|
((ITC_STORAGE_ADDRSPACE_SZ - 1) & ITC_AM1_ADDR_MASK_MASK) |
|
||||||
(get_num_cells(s) << ITC_AM1_NUMENTRIES_OFS);
|
(get_num_cells(s) << ITC_AM1_NUMENTRIES_OFS);
|
||||||
}
|
|
||||||
itc_reconfigure(s);
|
itc_reconfigure(s);
|
||||||
|
|
||||||
itc_reset_cells(s);
|
itc_reset_cells(s);
|
||||||
@ -564,7 +538,6 @@ static Property mips_itu_properties[] = {
|
|||||||
ITC_FIFO_NUM_MAX),
|
ITC_FIFO_NUM_MAX),
|
||||||
DEFINE_PROP_UINT32("num-semaphores", MIPSITUState, num_semaphores,
|
DEFINE_PROP_UINT32("num-semaphores", MIPSITUState, num_semaphores,
|
||||||
ITC_SEMAPH_NUM_MAX),
|
ITC_SEMAPH_NUM_MAX),
|
||||||
DEFINE_PROP_LINK("cpu[0]", MIPSITUState, cpu0, TYPE_MIPS_CPU, ArchCPU *),
|
|
||||||
DEFINE_PROP_END_OF_LIST(),
|
DEFINE_PROP_END_OF_LIST(),
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -278,9 +278,9 @@ static void ibm_40p_init(MachineState *machine)
|
|||||||
|
|
||||||
/* PCI -> ISA bridge */
|
/* PCI -> ISA bridge */
|
||||||
i82378_dev = DEVICE(pci_new(PCI_DEVFN(11, 0), "i82378"));
|
i82378_dev = DEVICE(pci_new(PCI_DEVFN(11, 0), "i82378"));
|
||||||
|
qdev_realize_and_unref(i82378_dev, BUS(pci_bus), &error_fatal);
|
||||||
qdev_connect_gpio_out(i82378_dev, 0,
|
qdev_connect_gpio_out(i82378_dev, 0,
|
||||||
qdev_get_gpio_in(DEVICE(cpu), PPC6xx_INPUT_INT));
|
qdev_get_gpio_in(DEVICE(cpu), PPC6xx_INPUT_INT));
|
||||||
qdev_realize_and_unref(i82378_dev, BUS(pci_bus), &error_fatal);
|
|
||||||
|
|
||||||
sysbus_connect_irq(pcihost, 0, qdev_get_gpio_in(i82378_dev, 15));
|
sysbus_connect_irq(pcihost, 0, qdev_get_gpio_in(i82378_dev, 15));
|
||||||
isa_bus = ISA_BUS(qdev_get_child_bus(i82378_dev, "isa.0"));
|
isa_bus = ISA_BUS(qdev_get_child_bus(i82378_dev, "isa.0"));
|
||||||
|
@ -20,6 +20,7 @@
|
|||||||
#include "qemu/cutils.h"
|
#include "qemu/cutils.h"
|
||||||
#include "qemu/error-report.h"
|
#include "qemu/error-report.h"
|
||||||
#include "qemu/guest-random.h"
|
#include "qemu/guest-random.h"
|
||||||
|
#include "qemu/units.h"
|
||||||
#include "qapi/error.h"
|
#include "qapi/error.h"
|
||||||
#include "hw/loader.h"
|
#include "hw/loader.h"
|
||||||
#include "hw/rx/rx62n.h"
|
#include "hw/rx/rx62n.h"
|
||||||
|
@ -23,6 +23,7 @@
|
|||||||
#include "qemu/osdep.h"
|
#include "qemu/osdep.h"
|
||||||
#include "qapi/error.h"
|
#include "qapi/error.h"
|
||||||
#include "qemu/error-report.h"
|
#include "qemu/error-report.h"
|
||||||
|
#include "qemu/units.h"
|
||||||
#include "hw/rx/rx62n.h"
|
#include "hw/rx/rx62n.h"
|
||||||
#include "hw/loader.h"
|
#include "hw/loader.h"
|
||||||
#include "hw/sysbus.h"
|
#include "hw/sysbus.h"
|
||||||
@ -147,14 +148,11 @@ static void register_icu(RX62NState *s)
|
|||||||
qlist_append_int(trigger_level, levelirq[i]);
|
qlist_append_int(trigger_level, levelirq[i]);
|
||||||
}
|
}
|
||||||
qdev_prop_set_array(DEVICE(icu), "trigger-level", trigger_level);
|
qdev_prop_set_array(DEVICE(icu), "trigger-level", trigger_level);
|
||||||
|
|
||||||
for (i = 0; i < NR_IRQS; i++) {
|
|
||||||
s->irq[i] = qdev_get_gpio_in(DEVICE(icu), i);
|
|
||||||
}
|
|
||||||
sysbus_realize(icu, &error_abort);
|
sysbus_realize(icu, &error_abort);
|
||||||
|
|
||||||
sysbus_connect_irq(icu, 0, qdev_get_gpio_in(DEVICE(&s->cpu), RX_CPU_IRQ));
|
sysbus_connect_irq(icu, 0, qdev_get_gpio_in(DEVICE(&s->cpu), RX_CPU_IRQ));
|
||||||
sysbus_connect_irq(icu, 1, qdev_get_gpio_in(DEVICE(&s->cpu), RX_CPU_FIR));
|
sysbus_connect_irq(icu, 1, qdev_get_gpio_in(DEVICE(&s->cpu), RX_CPU_FIR));
|
||||||
sysbus_connect_irq(icu, 2, s->irq[SWI]);
|
sysbus_connect_irq(icu, 2, qdev_get_gpio_in(DEVICE(&s->icu), SWI));
|
||||||
sysbus_mmio_map(icu, 0, RX62N_ICU_BASE);
|
sysbus_mmio_map(icu, 0, RX62N_ICU_BASE);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -171,7 +169,8 @@ static void register_tmr(RX62NState *s, int unit)
|
|||||||
|
|
||||||
irqbase = RX62N_TMR_IRQ + TMR_NR_IRQ * unit;
|
irqbase = RX62N_TMR_IRQ + TMR_NR_IRQ * unit;
|
||||||
for (i = 0; i < TMR_NR_IRQ; i++) {
|
for (i = 0; i < TMR_NR_IRQ; i++) {
|
||||||
sysbus_connect_irq(tmr, i, s->irq[irqbase + i]);
|
sysbus_connect_irq(tmr, i,
|
||||||
|
qdev_get_gpio_in(DEVICE(&s->icu), irqbase + i));
|
||||||
}
|
}
|
||||||
sysbus_mmio_map(tmr, 0, RX62N_TMR_BASE + unit * 0x10);
|
sysbus_mmio_map(tmr, 0, RX62N_TMR_BASE + unit * 0x10);
|
||||||
}
|
}
|
||||||
@ -189,7 +188,8 @@ static void register_cmt(RX62NState *s, int unit)
|
|||||||
|
|
||||||
irqbase = RX62N_CMT_IRQ + CMT_NR_IRQ * unit;
|
irqbase = RX62N_CMT_IRQ + CMT_NR_IRQ * unit;
|
||||||
for (i = 0; i < CMT_NR_IRQ; i++) {
|
for (i = 0; i < CMT_NR_IRQ; i++) {
|
||||||
sysbus_connect_irq(cmt, i, s->irq[irqbase + i]);
|
sysbus_connect_irq(cmt, i,
|
||||||
|
qdev_get_gpio_in(DEVICE(&s->icu), irqbase + i));
|
||||||
}
|
}
|
||||||
sysbus_mmio_map(cmt, 0, RX62N_CMT_BASE + unit * 0x10);
|
sysbus_mmio_map(cmt, 0, RX62N_CMT_BASE + unit * 0x10);
|
||||||
}
|
}
|
||||||
@ -208,7 +208,8 @@ static void register_sci(RX62NState *s, int unit)
|
|||||||
|
|
||||||
irqbase = RX62N_SCI_IRQ + SCI_NR_IRQ * unit;
|
irqbase = RX62N_SCI_IRQ + SCI_NR_IRQ * unit;
|
||||||
for (i = 0; i < SCI_NR_IRQ; i++) {
|
for (i = 0; i < SCI_NR_IRQ; i++) {
|
||||||
sysbus_connect_irq(sci, i, s->irq[irqbase + i]);
|
sysbus_connect_irq(sci, i,
|
||||||
|
qdev_get_gpio_in(DEVICE(&s->icu), irqbase + i));
|
||||||
}
|
}
|
||||||
sysbus_mmio_map(sci, 0, RX62N_SCI_BASE + unit * 0x08);
|
sysbus_mmio_map(sci, 0, RX62N_SCI_BASE + unit * 0x08);
|
||||||
}
|
}
|
||||||
|
@ -285,9 +285,9 @@ static void r2d_init(MachineState *machine)
|
|||||||
dinfo = drive_get(IF_IDE, 0, 0);
|
dinfo = drive_get(IF_IDE, 0, 0);
|
||||||
dev = qdev_new("mmio-ide");
|
dev = qdev_new("mmio-ide");
|
||||||
busdev = SYS_BUS_DEVICE(dev);
|
busdev = SYS_BUS_DEVICE(dev);
|
||||||
sysbus_connect_irq(busdev, 0, irq[CF_IDE]);
|
|
||||||
qdev_prop_set_uint32(dev, "shift", 1);
|
qdev_prop_set_uint32(dev, "shift", 1);
|
||||||
sysbus_realize_and_unref(busdev, &error_fatal);
|
sysbus_realize_and_unref(busdev, &error_fatal);
|
||||||
|
sysbus_connect_irq(busdev, 0, irq[CF_IDE]);
|
||||||
sysbus_mmio_map(busdev, 0, 0x14001000);
|
sysbus_mmio_map(busdev, 0, 0x14001000);
|
||||||
sysbus_mmio_map(busdev, 1, 0x1400080c);
|
sysbus_mmio_map(busdev, 1, 0x1400080c);
|
||||||
mmio_ide_init_drives(dev, dinfo, NULL);
|
mmio_ide_init_drives(dev, dinfo, NULL);
|
||||||
|
144
hw/sparc/leon3.c
144
hw/sparc/leon3.c
@ -1,7 +1,9 @@
|
|||||||
/*
|
/*
|
||||||
* QEMU Leon3 System Emulator
|
* QEMU Leon3 System Emulator
|
||||||
*
|
*
|
||||||
* Copyright (c) 2010-2019 AdaCore
|
* SPDX-License-Identifier: MIT
|
||||||
|
*
|
||||||
|
* Copyright (c) 2010-2024 AdaCore
|
||||||
*
|
*
|
||||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
* of this software and associated documentation files (the "Software"), to deal
|
* of this software and associated documentation files (the "Software"), to deal
|
||||||
@ -40,7 +42,9 @@
|
|||||||
#include "elf.h"
|
#include "elf.h"
|
||||||
#include "trace.h"
|
#include "trace.h"
|
||||||
|
|
||||||
#include "hw/sparc/grlib.h"
|
#include "hw/timer/grlib_gptimer.h"
|
||||||
|
#include "hw/char/grlib_uart.h"
|
||||||
|
#include "hw/intc/grlib_irqmp.h"
|
||||||
#include "hw/misc/grlib_ahb_apb_pnp.h"
|
#include "hw/misc/grlib_ahb_apb_pnp.h"
|
||||||
|
|
||||||
/* Default system clock. */
|
/* Default system clock. */
|
||||||
@ -50,6 +54,8 @@
|
|||||||
#define LEON3_PROM_OFFSET (0x00000000)
|
#define LEON3_PROM_OFFSET (0x00000000)
|
||||||
#define LEON3_RAM_OFFSET (0x40000000)
|
#define LEON3_RAM_OFFSET (0x40000000)
|
||||||
|
|
||||||
|
#define MAX_CPUS 4
|
||||||
|
|
||||||
#define LEON3_UART_OFFSET (0x80000100)
|
#define LEON3_UART_OFFSET (0x80000100)
|
||||||
#define LEON3_UART_IRQ (3)
|
#define LEON3_UART_IRQ (3)
|
||||||
|
|
||||||
@ -63,9 +69,11 @@
|
|||||||
#define LEON3_AHB_PNP_OFFSET (0xFFFFF000)
|
#define LEON3_AHB_PNP_OFFSET (0xFFFFF000)
|
||||||
|
|
||||||
typedef struct ResetData {
|
typedef struct ResetData {
|
||||||
SPARCCPU *cpu;
|
struct CPUResetData {
|
||||||
uint32_t entry; /* save kernel entry in case of reset */
|
int id;
|
||||||
target_ulong sp; /* initial stack pointer */
|
SPARCCPU *cpu;
|
||||||
|
} info[MAX_CPUS];
|
||||||
|
uint32_t entry; /* save kernel entry in case of reset */
|
||||||
} ResetData;
|
} ResetData;
|
||||||
|
|
||||||
static uint32_t *gen_store_u32(uint32_t *code, hwaddr addr, uint32_t val)
|
static uint32_t *gen_store_u32(uint32_t *code, hwaddr addr, uint32_t val)
|
||||||
@ -91,13 +99,26 @@ static uint32_t *gen_store_u32(uint32_t *code, hwaddr addr, uint32_t val)
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
* When loading a kernel in RAM the machine is expected to be in a different
|
* When loading a kernel in RAM the machine is expected to be in a different
|
||||||
* state (eg: initialized by the bootloader). This little code reproduces
|
* state (eg: initialized by the bootloader). This little code reproduces
|
||||||
* this behavior.
|
* this behavior. Also this code can be executed by the secondary cpus as
|
||||||
|
* well since it looks at the %asr17 register before doing any
|
||||||
|
* initialization, it allows to use the same reset address for all the
|
||||||
|
* cpus.
|
||||||
*/
|
*/
|
||||||
static void write_bootloader(CPUSPARCState *env, uint8_t *base,
|
static void write_bootloader(void *ptr, hwaddr kernel_addr)
|
||||||
hwaddr kernel_addr)
|
|
||||||
{
|
{
|
||||||
uint32_t *p = (uint32_t *) base;
|
uint32_t *p = ptr;
|
||||||
|
uint32_t *sec_cpu_branch_p = NULL;
|
||||||
|
|
||||||
|
/* If we are running on a secondary CPU, jump directly to the kernel. */
|
||||||
|
|
||||||
|
stl_p(p++, 0x85444000); /* rd %asr17, %g2 */
|
||||||
|
stl_p(p++, 0x8530a01c); /* srl %g2, 0x1c, %g2 */
|
||||||
|
stl_p(p++, 0x80908000); /* tst %g2 */
|
||||||
|
/* Filled below. */
|
||||||
|
sec_cpu_branch_p = p;
|
||||||
|
stl_p(p++, 0x0BADC0DE); /* bne xxx */
|
||||||
|
stl_p(p++, 0x01000000); /* nop */
|
||||||
|
|
||||||
/* Initialize the UARTs */
|
/* Initialize the UARTs */
|
||||||
/* *UART_CONTROL = UART_RECEIVE_ENABLE | UART_TRANSMIT_ENABLE; */
|
/* *UART_CONTROL = UART_RECEIVE_ENABLE | UART_TRANSMIT_ENABLE; */
|
||||||
@ -111,6 +132,10 @@ static void write_bootloader(CPUSPARCState *env, uint8_t *base,
|
|||||||
/* *GPTIMER0_CONFIG = GPTIMER_ENABLE | GPTIMER_RESTART; */
|
/* *GPTIMER0_CONFIG = GPTIMER_ENABLE | GPTIMER_RESTART; */
|
||||||
p = gen_store_u32(p, 0x80000318, 3);
|
p = gen_store_u32(p, 0x80000318, 3);
|
||||||
|
|
||||||
|
/* Now, the relative branch above can be computed. */
|
||||||
|
stl_p(sec_cpu_branch_p, 0x12800000
|
||||||
|
+ (p - sec_cpu_branch_p));
|
||||||
|
|
||||||
/* JUMP to the entry point */
|
/* JUMP to the entry point */
|
||||||
stl_p(p++, 0x82100000); /* mov %g0, %g1 */
|
stl_p(p++, 0x82100000); /* mov %g0, %g1 */
|
||||||
stl_p(p++, 0x03000000 + extract32(kernel_addr, 10, 22));
|
stl_p(p++, 0x03000000 + extract32(kernel_addr, 10, 22));
|
||||||
@ -121,18 +146,19 @@ static void write_bootloader(CPUSPARCState *env, uint8_t *base,
|
|||||||
stl_p(p++, 0x01000000); /* nop */
|
stl_p(p++, 0x01000000); /* nop */
|
||||||
}
|
}
|
||||||
|
|
||||||
static void main_cpu_reset(void *opaque)
|
static void leon3_cpu_reset(void *opaque)
|
||||||
{
|
{
|
||||||
ResetData *s = (ResetData *)opaque;
|
struct CPUResetData *info = (struct CPUResetData *) opaque;
|
||||||
CPUState *cpu = CPU(s->cpu);
|
int id = info->id;
|
||||||
CPUSPARCState *env = &s->cpu->env;
|
ResetData *s = (ResetData *)DO_UPCAST(ResetData, info[id], info);
|
||||||
|
CPUState *cpu = CPU(s->info[id].cpu);
|
||||||
|
CPUSPARCState *env = cpu_env(cpu);
|
||||||
|
|
||||||
cpu_reset(cpu);
|
cpu_reset(cpu);
|
||||||
|
|
||||||
cpu->halted = 0;
|
cpu->halted = cpu->cpu_index != 0;
|
||||||
env->pc = s->entry;
|
env->pc = s->entry;
|
||||||
env->npc = s->entry + 4;
|
env->npc = s->entry + 4;
|
||||||
env->regbase[6] = s->sp;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void leon3_cache_control_int(CPUSPARCState *env)
|
static void leon3_cache_control_int(CPUSPARCState *env)
|
||||||
@ -166,7 +192,8 @@ static void leon3_cache_control_int(CPUSPARCState *env)
|
|||||||
|
|
||||||
static void leon3_irq_ack(CPUSPARCState *env, int intno)
|
static void leon3_irq_ack(CPUSPARCState *env, int intno)
|
||||||
{
|
{
|
||||||
grlib_irqmp_ack(env->irq_manager, intno);
|
CPUState *cpu = CPU(env_cpu(env));
|
||||||
|
grlib_irqmp_ack(env->irq_manager, cpu->cpu_index, intno);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -175,9 +202,10 @@ static void leon3_irq_ack(CPUSPARCState *env, int intno)
|
|||||||
*/
|
*/
|
||||||
static void leon3_set_pil_in(void *opaque, int n, int level)
|
static void leon3_set_pil_in(void *opaque, int n, int level)
|
||||||
{
|
{
|
||||||
CPUSPARCState *env = opaque;
|
DeviceState *cpu = opaque;
|
||||||
|
CPUState *cs = CPU(cpu);
|
||||||
|
CPUSPARCState *env = cpu_env(cs);
|
||||||
uint32_t pil_in = level;
|
uint32_t pil_in = level;
|
||||||
CPUState *cs;
|
|
||||||
|
|
||||||
assert(env != NULL);
|
assert(env != NULL);
|
||||||
|
|
||||||
@ -193,7 +221,6 @@ static void leon3_set_pil_in(void *opaque, int n, int level)
|
|||||||
|
|
||||||
env->interrupt_index = TT_EXTINT | i;
|
env->interrupt_index = TT_EXTINT | i;
|
||||||
if (old_interrupt != env->interrupt_index) {
|
if (old_interrupt != env->interrupt_index) {
|
||||||
cs = env_cpu(env);
|
|
||||||
trace_leon3_set_irq(i);
|
trace_leon3_set_irq(i);
|
||||||
cpu_interrupt(cs, CPU_INTERRUPT_HARD);
|
cpu_interrupt(cs, CPU_INTERRUPT_HARD);
|
||||||
}
|
}
|
||||||
@ -201,13 +228,26 @@ static void leon3_set_pil_in(void *opaque, int n, int level)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (!env->pil_in && (env->interrupt_index & ~15) == TT_EXTINT) {
|
} else if (!env->pil_in && (env->interrupt_index & ~15) == TT_EXTINT) {
|
||||||
cs = env_cpu(env);
|
|
||||||
trace_leon3_reset_irq(env->interrupt_index & 15);
|
trace_leon3_reset_irq(env->interrupt_index & 15);
|
||||||
env->interrupt_index = 0;
|
env->interrupt_index = 0;
|
||||||
cpu_reset_interrupt(cs, CPU_INTERRUPT_HARD);
|
cpu_reset_interrupt(cs, CPU_INTERRUPT_HARD);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void leon3_start_cpu_async_work(CPUState *cpu, run_on_cpu_data data)
|
||||||
|
{
|
||||||
|
cpu->halted = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void leon3_start_cpu(void *opaque, int n, int level)
|
||||||
|
{
|
||||||
|
DeviceState *cpu = opaque;
|
||||||
|
CPUState *cs = CPU(cpu);
|
||||||
|
|
||||||
|
assert(level == 1);
|
||||||
|
async_run_on_cpu(cs, leon3_start_cpu_async_work, RUN_ON_CPU_NULL);
|
||||||
|
}
|
||||||
|
|
||||||
static void leon3_irq_manager(CPUSPARCState *env, int intno)
|
static void leon3_irq_manager(CPUSPARCState *env, int intno)
|
||||||
{
|
{
|
||||||
leon3_irq_ack(env, intno);
|
leon3_irq_ack(env, intno);
|
||||||
@ -233,17 +273,23 @@ static void leon3_generic_hw_init(MachineState *machine)
|
|||||||
AHBPnp *ahb_pnp;
|
AHBPnp *ahb_pnp;
|
||||||
APBPnp *apb_pnp;
|
APBPnp *apb_pnp;
|
||||||
|
|
||||||
/* Init CPU */
|
reset_info = g_malloc0(sizeof(ResetData));
|
||||||
cpu = SPARC_CPU(cpu_create(machine->cpu_type));
|
|
||||||
env = &cpu->env;
|
|
||||||
|
|
||||||
cpu_sparc_set_id(env, 0);
|
for (i = 0; i < machine->smp.cpus; i++) {
|
||||||
|
/* Init CPU */
|
||||||
|
cpu = SPARC_CPU(object_new(machine->cpu_type));
|
||||||
|
qdev_init_gpio_in_named(DEVICE(cpu), leon3_start_cpu, "start_cpu", 1);
|
||||||
|
qdev_init_gpio_in_named(DEVICE(cpu), leon3_set_pil_in, "pil", 1);
|
||||||
|
qdev_realize(DEVICE(cpu), NULL, &error_fatal);
|
||||||
|
env = &cpu->env;
|
||||||
|
|
||||||
/* Reset data */
|
cpu_sparc_set_id(env, i);
|
||||||
reset_info = g_new0(ResetData, 1);
|
|
||||||
reset_info->cpu = cpu;
|
/* Reset data */
|
||||||
reset_info->sp = LEON3_RAM_OFFSET + ram_size;
|
reset_info->info[i].id = i;
|
||||||
qemu_register_reset(main_cpu_reset, reset_info);
|
reset_info->info[i].cpu = cpu;
|
||||||
|
qemu_register_reset(leon3_cpu_reset, &reset_info->info[i]);
|
||||||
|
}
|
||||||
|
|
||||||
ahb_pnp = GRLIB_AHB_PNP(qdev_new(TYPE_GRLIB_AHB_PNP));
|
ahb_pnp = GRLIB_AHB_PNP(qdev_new(TYPE_GRLIB_AHB_PNP));
|
||||||
sysbus_realize_and_unref(SYS_BUS_DEVICE(ahb_pnp), &error_fatal);
|
sysbus_realize_and_unref(SYS_BUS_DEVICE(ahb_pnp), &error_fatal);
|
||||||
@ -261,14 +307,24 @@ static void leon3_generic_hw_init(MachineState *machine)
|
|||||||
|
|
||||||
/* Allocate IRQ manager */
|
/* Allocate IRQ manager */
|
||||||
irqmpdev = qdev_new(TYPE_GRLIB_IRQMP);
|
irqmpdev = qdev_new(TYPE_GRLIB_IRQMP);
|
||||||
qdev_init_gpio_in_named_with_opaque(DEVICE(cpu), leon3_set_pil_in,
|
object_property_set_int(OBJECT(irqmpdev), "ncpus", machine->smp.cpus,
|
||||||
env, "pil", 1);
|
&error_fatal);
|
||||||
qdev_connect_gpio_out_named(irqmpdev, "grlib-irq", 0,
|
|
||||||
qdev_get_gpio_in_named(DEVICE(cpu), "pil", 0));
|
|
||||||
sysbus_realize_and_unref(SYS_BUS_DEVICE(irqmpdev), &error_fatal);
|
sysbus_realize_and_unref(SYS_BUS_DEVICE(irqmpdev), &error_fatal);
|
||||||
|
|
||||||
|
for (i = 0; i < machine->smp.cpus; i++) {
|
||||||
|
cpu = reset_info->info[i].cpu;
|
||||||
|
env = &cpu->env;
|
||||||
|
qdev_connect_gpio_out_named(irqmpdev, "grlib-start-cpu", i,
|
||||||
|
qdev_get_gpio_in_named(DEVICE(cpu),
|
||||||
|
"start_cpu", 0));
|
||||||
|
qdev_connect_gpio_out_named(irqmpdev, "grlib-irq", i,
|
||||||
|
qdev_get_gpio_in_named(DEVICE(cpu),
|
||||||
|
"pil", 0));
|
||||||
|
env->irq_manager = irqmpdev;
|
||||||
|
env->qemu_irq_ack = leon3_irq_manager;
|
||||||
|
}
|
||||||
|
|
||||||
sysbus_mmio_map(SYS_BUS_DEVICE(irqmpdev), 0, LEON3_IRQMP_OFFSET);
|
sysbus_mmio_map(SYS_BUS_DEVICE(irqmpdev), 0, LEON3_IRQMP_OFFSET);
|
||||||
env->irq_manager = irqmpdev;
|
|
||||||
env->qemu_irq_ack = leon3_irq_manager;
|
|
||||||
grlib_apb_pnp_add_entry(apb_pnp, LEON3_IRQMP_OFFSET, 0xFFF,
|
grlib_apb_pnp_add_entry(apb_pnp, LEON3_IRQMP_OFFSET, 0xFFF,
|
||||||
GRLIB_VENDOR_GAISLER, GRLIB_IRQMP_DEV,
|
GRLIB_VENDOR_GAISLER, GRLIB_IRQMP_DEV,
|
||||||
2, 0, GRLIB_APBIO_AREA);
|
2, 0, GRLIB_APBIO_AREA);
|
||||||
@ -339,13 +395,12 @@ static void leon3_generic_hw_init(MachineState *machine)
|
|||||||
* the machine in an initialized state through a little
|
* the machine in an initialized state through a little
|
||||||
* bootloader.
|
* bootloader.
|
||||||
*/
|
*/
|
||||||
uint8_t *bootloader_entry;
|
write_bootloader(memory_region_get_ram_ptr(prom), entry);
|
||||||
|
|
||||||
bootloader_entry = memory_region_get_ram_ptr(prom);
|
|
||||||
write_bootloader(env, bootloader_entry, entry);
|
|
||||||
env->pc = LEON3_PROM_OFFSET;
|
|
||||||
env->npc = LEON3_PROM_OFFSET + 4;
|
|
||||||
reset_info->entry = LEON3_PROM_OFFSET;
|
reset_info->entry = LEON3_PROM_OFFSET;
|
||||||
|
for (i = 0; i < machine->smp.cpus; i++) {
|
||||||
|
reset_info->info[i].cpu->env.pc = LEON3_PROM_OFFSET;
|
||||||
|
reset_info->info[i].cpu->env.npc = LEON3_PROM_OFFSET + 4;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -384,6 +439,7 @@ static void leon3_generic_machine_init(MachineClass *mc)
|
|||||||
mc->init = leon3_generic_hw_init;
|
mc->init = leon3_generic_hw_init;
|
||||||
mc->default_cpu_type = SPARC_CPU_TYPE_NAME("LEON3");
|
mc->default_cpu_type = SPARC_CPU_TYPE_NAME("LEON3");
|
||||||
mc->default_ram_id = "leon3.ram";
|
mc->default_ram_id = "leon3.ram";
|
||||||
|
mc->max_cpus = MAX_CPUS;
|
||||||
}
|
}
|
||||||
|
|
||||||
DEFINE_MACHINE("leon3_generic", leon3_generic_machine_init)
|
DEFINE_MACHINE("leon3_generic", leon3_generic_machine_init)
|
||||||
|
@ -312,13 +312,11 @@ static void *sparc32_dma_init(hwaddr dma_base,
|
|||||||
dma = qdev_new(TYPE_SPARC32_DMA);
|
dma = qdev_new(TYPE_SPARC32_DMA);
|
||||||
espdma = SPARC32_ESPDMA_DEVICE(object_resolve_path_component(
|
espdma = SPARC32_ESPDMA_DEVICE(object_resolve_path_component(
|
||||||
OBJECT(dma), "espdma"));
|
OBJECT(dma), "espdma"));
|
||||||
sysbus_connect_irq(SYS_BUS_DEVICE(espdma), 0, espdma_irq);
|
|
||||||
|
|
||||||
esp = SYSBUS_ESP(object_resolve_path_component(OBJECT(espdma), "esp"));
|
esp = SYSBUS_ESP(object_resolve_path_component(OBJECT(espdma), "esp"));
|
||||||
|
|
||||||
ledma = SPARC32_LEDMA_DEVICE(object_resolve_path_component(
|
ledma = SPARC32_LEDMA_DEVICE(object_resolve_path_component(
|
||||||
OBJECT(dma), "ledma"));
|
OBJECT(dma), "ledma"));
|
||||||
sysbus_connect_irq(SYS_BUS_DEVICE(ledma), 0, ledma_irq);
|
|
||||||
|
|
||||||
lance = SYSBUS_PCNET(object_resolve_path_component(
|
lance = SYSBUS_PCNET(object_resolve_path_component(
|
||||||
OBJECT(ledma), "lance"));
|
OBJECT(ledma), "lance"));
|
||||||
@ -332,6 +330,11 @@ static void *sparc32_dma_init(hwaddr dma_base,
|
|||||||
}
|
}
|
||||||
|
|
||||||
sysbus_realize_and_unref(SYS_BUS_DEVICE(dma), &error_fatal);
|
sysbus_realize_and_unref(SYS_BUS_DEVICE(dma), &error_fatal);
|
||||||
|
|
||||||
|
sysbus_connect_irq(SYS_BUS_DEVICE(espdma), 0, espdma_irq);
|
||||||
|
|
||||||
|
sysbus_connect_irq(SYS_BUS_DEVICE(ledma), 0, ledma_irq);
|
||||||
|
|
||||||
sysbus_mmio_map(SYS_BUS_DEVICE(dma), 0, dma_base);
|
sysbus_mmio_map(SYS_BUS_DEVICE(dma), 0, dma_base);
|
||||||
|
|
||||||
sysbus_mmio_map(SYS_BUS_DEVICE(esp), 0, esp_base);
|
sysbus_mmio_map(SYS_BUS_DEVICE(esp), 0, esp_base);
|
||||||
|
@ -24,6 +24,7 @@
|
|||||||
|
|
||||||
|
|
||||||
#include "qemu/osdep.h"
|
#include "qemu/osdep.h"
|
||||||
|
#include "qapi/error.h"
|
||||||
#include "cpu.h"
|
#include "cpu.h"
|
||||||
#include "hw/boards.h"
|
#include "hw/boards.h"
|
||||||
#include "hw/sparc/sparc64.h"
|
#include "hw/sparc/sparc64.h"
|
||||||
@ -271,9 +272,10 @@ SPARCCPU *sparc64_cpu_devinit(const char *cpu_type, uint64_t prom_addr)
|
|||||||
uint32_t stick_frequency = 100 * 1000000;
|
uint32_t stick_frequency = 100 * 1000000;
|
||||||
uint32_t hstick_frequency = 100 * 1000000;
|
uint32_t hstick_frequency = 100 * 1000000;
|
||||||
|
|
||||||
cpu = SPARC_CPU(cpu_create(cpu_type));
|
cpu = SPARC_CPU(object_new(cpu_type));
|
||||||
qdev_init_gpio_in_named(DEVICE(cpu), sparc64_cpu_set_ivec_irq,
|
qdev_init_gpio_in_named(DEVICE(cpu), sparc64_cpu_set_ivec_irq,
|
||||||
"ivec-irq", IVEC_MAX);
|
"ivec-irq", IVEC_MAX);
|
||||||
|
qdev_realize(DEVICE(cpu), NULL, &error_fatal);
|
||||||
env = &cpu->env;
|
env = &cpu->env;
|
||||||
|
|
||||||
env->tick = cpu_timer_create("tick", cpu, tick_irq,
|
env->tick = cpu_timer_create("tick", cpu, tick_irq,
|
||||||
|
@ -1,7 +1,9 @@
|
|||||||
/*
|
/*
|
||||||
* QEMU GRLIB GPTimer Emulator
|
* QEMU GRLIB GPTimer Emulator
|
||||||
*
|
*
|
||||||
* Copyright (c) 2010-2019 AdaCore
|
* SPDX-License-Identifier: MIT
|
||||||
|
*
|
||||||
|
* Copyright (c) 2010-2024 AdaCore
|
||||||
*
|
*
|
||||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
* of this software and associated documentation files (the "Software"), to deal
|
* of this software and associated documentation files (the "Software"), to deal
|
||||||
@ -23,7 +25,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "qemu/osdep.h"
|
#include "qemu/osdep.h"
|
||||||
#include "hw/sparc/grlib.h"
|
#include "hw/timer/grlib_gptimer.h"
|
||||||
#include "hw/sysbus.h"
|
#include "hw/sysbus.h"
|
||||||
#include "qemu/timer.h"
|
#include "qemu/timer.h"
|
||||||
#include "hw/irq.h"
|
#include "hw/irq.h"
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
#include "hw/intc/allwinner-a10-pic.h"
|
#include "hw/intc/allwinner-a10-pic.h"
|
||||||
#include "hw/net/allwinner_emac.h"
|
#include "hw/net/allwinner_emac.h"
|
||||||
#include "hw/sd/allwinner-sdhost.h"
|
#include "hw/sd/allwinner-sdhost.h"
|
||||||
#include "hw/ide/ahci.h"
|
#include "hw/ide/ahci-sysbus.h"
|
||||||
#include "hw/usb/hcd-ohci.h"
|
#include "hw/usb/hcd-ohci.h"
|
||||||
#include "hw/usb/hcd-ehci.h"
|
#include "hw/usb/hcd-ehci.h"
|
||||||
#include "hw/rtc/allwinner-rtc.h"
|
#include "hw/rtc/allwinner-rtc.h"
|
||||||
|
@ -22,7 +22,7 @@
|
|||||||
|
|
||||||
#include "qom/object.h"
|
#include "qom/object.h"
|
||||||
#include "hw/timer/allwinner-a10-pit.h"
|
#include "hw/timer/allwinner-a10-pit.h"
|
||||||
#include "hw/ide/ahci.h"
|
#include "hw/ide/ahci-sysbus.h"
|
||||||
#include "hw/intc/arm_gic.h"
|
#include "hw/intc/arm_gic.h"
|
||||||
#include "hw/sd/allwinner-sdhost.h"
|
#include "hw/sd/allwinner-sdhost.h"
|
||||||
#include "hw/misc/allwinner-r40-ccu.h"
|
#include "hw/misc/allwinner-r40-ccu.h"
|
||||||
|
@ -22,7 +22,7 @@
|
|||||||
#include "hw/net/cadence_gem.h"
|
#include "hw/net/cadence_gem.h"
|
||||||
#include "hw/char/cadence_uart.h"
|
#include "hw/char/cadence_uart.h"
|
||||||
#include "hw/net/xlnx-zynqmp-can.h"
|
#include "hw/net/xlnx-zynqmp-can.h"
|
||||||
#include "hw/ide/ahci.h"
|
#include "hw/ide/ahci-sysbus.h"
|
||||||
#include "hw/sd/sdhci.h"
|
#include "hw/sd/sdhci.h"
|
||||||
#include "hw/ssi/xilinx_spips.h"
|
#include "hw/ssi/xilinx_spips.h"
|
||||||
#include "hw/dma/xlnx_dpdma.h"
|
#include "hw/dma/xlnx_dpdma.h"
|
||||||
|
32
include/hw/char/grlib_uart.h
Normal file
32
include/hw/char/grlib_uart.h
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
/*
|
||||||
|
* QEMU GRLIB UART
|
||||||
|
*
|
||||||
|
* SPDX-License-Identifier: MIT
|
||||||
|
*
|
||||||
|
* Copyright (c) 2024 AdaCore
|
||||||
|
*
|
||||||
|
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
* of this software and associated documentation files (the "Software"), to deal
|
||||||
|
* in the Software without restriction, including without limitation the rights
|
||||||
|
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
* copies of the Software, and to permit persons to whom the Software is
|
||||||
|
* furnished to do so, subject to the following conditions:
|
||||||
|
*
|
||||||
|
* The above copyright notice and this permission notice shall be included in
|
||||||
|
* all copies or substantial portions of the Software.
|
||||||
|
*
|
||||||
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||||
|
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||||
|
* THE SOFTWARE.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef GRLIB_UART_H
|
||||||
|
#define GRLIB_UART_H
|
||||||
|
|
||||||
|
#define TYPE_GRLIB_APB_UART "grlib-apbuart"
|
||||||
|
|
||||||
|
#endif
|
@ -45,6 +45,6 @@ struct I8257State {
|
|||||||
PortioList portio_pageh;
|
PortioList portio_pageh;
|
||||||
};
|
};
|
||||||
|
|
||||||
void i8257_dma_init(ISABus *bus, bool high_page_enable);
|
void i8257_dma_init(Object *parent, ISABus *bus, bool high_page_enable);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
22
include/hw/ide/ahci-pci.h
Normal file
22
include/hw/ide/ahci-pci.h
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
/*
|
||||||
|
* QEMU AHCI Emulation (PCI devices)
|
||||||
|
*
|
||||||
|
* SPDX-License-Identifier: GPL-2.0-or-later
|
||||||
|
*/
|
||||||
|
#ifndef HW_IDE_AHCI_PCI_H
|
||||||
|
#define HW_IDE_AHCI_PCI_H
|
||||||
|
|
||||||
|
#include "qom/object.h"
|
||||||
|
#include "hw/ide/ahci.h"
|
||||||
|
#include "hw/pci/pci_device.h"
|
||||||
|
|
||||||
|
#define TYPE_ICH9_AHCI "ich9-ahci"
|
||||||
|
OBJECT_DECLARE_SIMPLE_TYPE(AHCIPCIState, ICH9_AHCI)
|
||||||
|
|
||||||
|
struct AHCIPCIState {
|
||||||
|
PCIDevice parent_obj;
|
||||||
|
|
||||||
|
AHCIState ahci;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
35
include/hw/ide/ahci-sysbus.h
Normal file
35
include/hw/ide/ahci-sysbus.h
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
/*
|
||||||
|
* QEMU AHCI Emulation (MMIO-mapped devices)
|
||||||
|
*
|
||||||
|
* SPDX-License-Identifier: GPL-2.0-or-later
|
||||||
|
*/
|
||||||
|
#ifndef HW_IDE_AHCI_SYSBUS_H
|
||||||
|
#define HW_IDE_AHCI_SYSBUS_H
|
||||||
|
|
||||||
|
#include "qom/object.h"
|
||||||
|
#include "hw/sysbus.h"
|
||||||
|
#include "hw/ide/ahci.h"
|
||||||
|
|
||||||
|
#define TYPE_SYSBUS_AHCI "sysbus-ahci"
|
||||||
|
OBJECT_DECLARE_SIMPLE_TYPE(SysbusAHCIState, SYSBUS_AHCI)
|
||||||
|
|
||||||
|
struct SysbusAHCIState {
|
||||||
|
SysBusDevice parent_obj;
|
||||||
|
|
||||||
|
AHCIState ahci;
|
||||||
|
};
|
||||||
|
|
||||||
|
#define TYPE_ALLWINNER_AHCI "allwinner-ahci"
|
||||||
|
OBJECT_DECLARE_SIMPLE_TYPE(AllwinnerAHCIState, ALLWINNER_AHCI)
|
||||||
|
|
||||||
|
#define ALLWINNER_AHCI_MMIO_OFF 0x80
|
||||||
|
#define ALLWINNER_AHCI_MMIO_SIZE 0x80
|
||||||
|
|
||||||
|
struct AllwinnerAHCIState {
|
||||||
|
SysbusAHCIState parent_obj;
|
||||||
|
|
||||||
|
MemoryRegion mmio;
|
||||||
|
uint32_t regs[ALLWINNER_AHCI_MMIO_SIZE / 4];
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
@ -24,8 +24,7 @@
|
|||||||
#ifndef HW_IDE_AHCI_H
|
#ifndef HW_IDE_AHCI_H
|
||||||
#define HW_IDE_AHCI_H
|
#define HW_IDE_AHCI_H
|
||||||
|
|
||||||
#include "hw/sysbus.h"
|
#include "exec/memory.h"
|
||||||
#include "qom/object.h"
|
|
||||||
|
|
||||||
typedef struct AHCIDevice AHCIDevice;
|
typedef struct AHCIDevice AHCIDevice;
|
||||||
|
|
||||||
@ -46,43 +45,12 @@ typedef struct AHCIState {
|
|||||||
MemoryRegion idp; /* Index-Data Pair I/O port space */
|
MemoryRegion idp; /* Index-Data Pair I/O port space */
|
||||||
unsigned idp_offset; /* Offset of index in I/O port space */
|
unsigned idp_offset; /* Offset of index in I/O port space */
|
||||||
uint32_t idp_index; /* Current IDP index */
|
uint32_t idp_index; /* Current IDP index */
|
||||||
int32_t ports;
|
uint32_t ports;
|
||||||
qemu_irq irq;
|
qemu_irq irq;
|
||||||
AddressSpace *as;
|
AddressSpace *as;
|
||||||
} AHCIState;
|
} AHCIState;
|
||||||
|
|
||||||
|
|
||||||
#define TYPE_ICH9_AHCI "ich9-ahci"
|
void ahci_ide_create_devs(AHCIState *ahci, DriveInfo **hd);
|
||||||
OBJECT_DECLARE_SIMPLE_TYPE(AHCIPCIState, ICH9_AHCI)
|
|
||||||
|
|
||||||
int32_t ahci_get_num_ports(PCIDevice *dev);
|
|
||||||
void ahci_ide_create_devs(PCIDevice *dev, DriveInfo **hd);
|
|
||||||
|
|
||||||
#define TYPE_SYSBUS_AHCI "sysbus-ahci"
|
|
||||||
OBJECT_DECLARE_SIMPLE_TYPE(SysbusAHCIState, SYSBUS_AHCI)
|
|
||||||
|
|
||||||
struct SysbusAHCIState {
|
|
||||||
/*< private >*/
|
|
||||||
SysBusDevice parent_obj;
|
|
||||||
/*< public >*/
|
|
||||||
|
|
||||||
AHCIState ahci;
|
|
||||||
uint32_t num_ports;
|
|
||||||
};
|
|
||||||
|
|
||||||
#define TYPE_ALLWINNER_AHCI "allwinner-ahci"
|
|
||||||
OBJECT_DECLARE_SIMPLE_TYPE(AllwinnerAHCIState, ALLWINNER_AHCI)
|
|
||||||
|
|
||||||
#define ALLWINNER_AHCI_MMIO_OFF 0x80
|
|
||||||
#define ALLWINNER_AHCI_MMIO_SIZE 0x80
|
|
||||||
|
|
||||||
struct AllwinnerAHCIState {
|
|
||||||
/*< private >*/
|
|
||||||
SysbusAHCIState parent_obj;
|
|
||||||
/*< public >*/
|
|
||||||
|
|
||||||
MemoryRegion mmio;
|
|
||||||
uint32_t regs[ALLWINNER_AHCI_MMIO_SIZE/4];
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif /* HW_IDE_AHCI_H */
|
#endif /* HW_IDE_AHCI_H */
|
||||||
|
@ -1,7 +1,9 @@
|
|||||||
/*
|
/*
|
||||||
* QEMU GRLIB Components
|
* QEMU GRLIB Components
|
||||||
*
|
*
|
||||||
* Copyright (c) 2010-2019 AdaCore
|
* SPDX-License-Identifier: MIT
|
||||||
|
*
|
||||||
|
* Copyright (c) 2010-2024 AdaCore
|
||||||
*
|
*
|
||||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
* of this software and associated documentation files (the "Software"), to deal
|
* of this software and associated documentation files (the "Software"), to deal
|
||||||
@ -22,8 +24,8 @@
|
|||||||
* THE SOFTWARE.
|
* THE SOFTWARE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef GRLIB_H
|
#ifndef GRLIB_IRQMP_H
|
||||||
#define GRLIB_H
|
#define GRLIB_IRQMP_H
|
||||||
|
|
||||||
#include "hw/sysbus.h"
|
#include "hw/sysbus.h"
|
||||||
|
|
||||||
@ -34,12 +36,6 @@
|
|||||||
/* IRQMP */
|
/* IRQMP */
|
||||||
#define TYPE_GRLIB_IRQMP "grlib-irqmp"
|
#define TYPE_GRLIB_IRQMP "grlib-irqmp"
|
||||||
|
|
||||||
void grlib_irqmp_ack(DeviceState *dev, int intno);
|
void grlib_irqmp_ack(DeviceState *dev, unsigned int cpu, int intno);
|
||||||
|
|
||||||
/* GPTimer */
|
#endif /* GRLIB_IRQMP_H */
|
||||||
#define TYPE_GRLIB_GPTIMER "grlib-gptimer"
|
|
||||||
|
|
||||||
/* APB UART */
|
|
||||||
#define TYPE_GRLIB_APB_UART "grlib-apbuart"
|
|
||||||
|
|
||||||
#endif /* GRLIB_H */
|
|
@ -70,15 +70,9 @@ struct MIPSITUState {
|
|||||||
|
|
||||||
/* ITU Control Register */
|
/* ITU Control Register */
|
||||||
uint64_t icr0;
|
uint64_t icr0;
|
||||||
|
|
||||||
/* SAAR */
|
|
||||||
uint64_t *saar;
|
|
||||||
ArchCPU *cpu0;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/* Get ITC Configuration Tag memory region. */
|
/* Get ITC Configuration Tag memory region. */
|
||||||
MemoryRegion *mips_itu_get_tag_region(MIPSITUState *itu);
|
MemoryRegion *mips_itu_get_tag_region(MIPSITUState *itu);
|
||||||
|
|
||||||
void itc_reconfigure(struct MIPSITUState *tag);
|
|
||||||
|
|
||||||
#endif /* MIPS_ITU_H */
|
#endif /* MIPS_ITU_H */
|
||||||
|
@ -29,7 +29,6 @@
|
|||||||
#include "hw/timer/renesas_tmr.h"
|
#include "hw/timer/renesas_tmr.h"
|
||||||
#include "hw/timer/renesas_cmt.h"
|
#include "hw/timer/renesas_cmt.h"
|
||||||
#include "hw/char/renesas_sci.h"
|
#include "hw/char/renesas_sci.h"
|
||||||
#include "qemu/units.h"
|
|
||||||
#include "qom/object.h"
|
#include "qom/object.h"
|
||||||
|
|
||||||
#define TYPE_RX62N_MCU "rx62n-mcu"
|
#define TYPE_RX62N_MCU "rx62n-mcu"
|
||||||
@ -68,7 +67,6 @@ struct RX62NState {
|
|||||||
MemoryRegion iomem2;
|
MemoryRegion iomem2;
|
||||||
MemoryRegion iomem3;
|
MemoryRegion iomem3;
|
||||||
MemoryRegion c_flash;
|
MemoryRegion c_flash;
|
||||||
qemu_irq irq[NR_IRQS];
|
|
||||||
|
|
||||||
/* Input Clock (XTAL) frequency */
|
/* Input Clock (XTAL) frequency */
|
||||||
uint32_t xtal_freq_hz;
|
uint32_t xtal_freq_hz;
|
||||||
|
32
include/hw/timer/grlib_gptimer.h
Normal file
32
include/hw/timer/grlib_gptimer.h
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
/*
|
||||||
|
* QEMU GRLIB GPTimer
|
||||||
|
*
|
||||||
|
* SPDX-License-Identifier: MIT
|
||||||
|
*
|
||||||
|
* Copyright (c) 2024 AdaCore
|
||||||
|
*
|
||||||
|
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
* of this software and associated documentation files (the "Software"), to deal
|
||||||
|
* in the Software without restriction, including without limitation the rights
|
||||||
|
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
* copies of the Software, and to permit persons to whom the Software is
|
||||||
|
* furnished to do so, subject to the following conditions:
|
||||||
|
*
|
||||||
|
* The above copyright notice and this permission notice shall be included in
|
||||||
|
* all copies or substantial portions of the Software.
|
||||||
|
*
|
||||||
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||||
|
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||||
|
* THE SOFTWARE.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef GRLIB_GPTIMER_H
|
||||||
|
#define GRLIB_GPTIMER_H
|
||||||
|
|
||||||
|
#define TYPE_GRLIB_GPTIMER "grlib-gptimer"
|
||||||
|
|
||||||
|
#endif
|
@ -747,9 +747,7 @@ typedef struct CPUArchState {
|
|||||||
* CP0 Register 9
|
* CP0 Register 9
|
||||||
*/
|
*/
|
||||||
int32_t CP0_Count;
|
int32_t CP0_Count;
|
||||||
uint32_t CP0_SAARI;
|
|
||||||
#define CP0SAARI_TARGET 0 /* 5..0 */
|
#define CP0SAARI_TARGET 0 /* 5..0 */
|
||||||
uint64_t CP0_SAAR[2];
|
|
||||||
#define CP0SAAR_BASE 12 /* 43..12 */
|
#define CP0SAAR_BASE 12 /* 43..12 */
|
||||||
#define CP0SAAR_SIZE 1 /* 5..1 */
|
#define CP0SAAR_SIZE 1 /* 5..1 */
|
||||||
#define CP0SAAR_EN 0
|
#define CP0SAAR_EN 0
|
||||||
@ -1174,7 +1172,6 @@ typedef struct CPUArchState {
|
|||||||
uint32_t CP0_Status_rw_bitmask; /* Read/write bits in CP0_Status */
|
uint32_t CP0_Status_rw_bitmask; /* Read/write bits in CP0_Status */
|
||||||
uint32_t CP0_TCStatus_rw_bitmask; /* Read/write bits in CP0_TCStatus */
|
uint32_t CP0_TCStatus_rw_bitmask; /* Read/write bits in CP0_TCStatus */
|
||||||
uint64_t insn_flags; /* Supported instruction set */
|
uint64_t insn_flags; /* Supported instruction set */
|
||||||
int saarp;
|
|
||||||
|
|
||||||
/* Fields up to this point are cleared by a CPU reset */
|
/* Fields up to this point are cleared by a CPU reset */
|
||||||
struct {} end_reset_fields;
|
struct {} end_reset_fields;
|
||||||
@ -1183,8 +1180,7 @@ typedef struct CPUArchState {
|
|||||||
CPUMIPSMVPContext *mvp;
|
CPUMIPSMVPContext *mvp;
|
||||||
#if !defined(CONFIG_USER_ONLY)
|
#if !defined(CONFIG_USER_ONLY)
|
||||||
CPUMIPSTLBContext *tlb;
|
CPUMIPSTLBContext *tlb;
|
||||||
void *irq[8];
|
qemu_irq irq[8];
|
||||||
struct MIPSITUState *itu;
|
|
||||||
MemoryRegion *itc_tag; /* ITC Configuration Tags */
|
MemoryRegion *itc_tag; /* ITC Configuration Tags */
|
||||||
|
|
||||||
/* Loongson IOCSR memory */
|
/* Loongson IOCSR memory */
|
||||||
|
@ -83,7 +83,6 @@ struct mips_def_t {
|
|||||||
uint32_t lcsr_cpucfg2;
|
uint32_t lcsr_cpucfg2;
|
||||||
uint64_t insn_flags;
|
uint64_t insn_flags;
|
||||||
enum mips_mmu_types mmu_type;
|
enum mips_mmu_types mmu_type;
|
||||||
int32_t SAARP;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
extern const char regnames[32][3];
|
extern const char regnames[32][3];
|
||||||
|
@ -281,8 +281,8 @@ const VMStateDescription vmstate_mips_cpu = {
|
|||||||
VMSTATE_UINT32(env.CP0_BadInstrP, MIPSCPU),
|
VMSTATE_UINT32(env.CP0_BadInstrP, MIPSCPU),
|
||||||
VMSTATE_UINT32(env.CP0_BadInstrX, MIPSCPU),
|
VMSTATE_UINT32(env.CP0_BadInstrX, MIPSCPU),
|
||||||
VMSTATE_INT32(env.CP0_Count, MIPSCPU),
|
VMSTATE_INT32(env.CP0_Count, MIPSCPU),
|
||||||
VMSTATE_UINT32(env.CP0_SAARI, MIPSCPU),
|
VMSTATE_UNUSED(sizeof(uint32_t)), /* was CP0_SAARI */
|
||||||
VMSTATE_UINT64_ARRAY(env.CP0_SAAR, MIPSCPU, 2),
|
VMSTATE_UNUSED(2 * sizeof(uint64_t)), /* was CP0_SAAR[2] */
|
||||||
VMSTATE_UINTTL(env.CP0_EntryHi, MIPSCPU),
|
VMSTATE_UINTTL(env.CP0_EntryHi, MIPSCPU),
|
||||||
VMSTATE_INT32(env.CP0_Compare, MIPSCPU),
|
VMSTATE_INT32(env.CP0_Compare, MIPSCPU),
|
||||||
VMSTATE_INT32(env.CP0_Status, MIPSCPU),
|
VMSTATE_INT32(env.CP0_Status, MIPSCPU),
|
||||||
|
@ -371,22 +371,6 @@ target_ulong helper_mfc0_count(CPUMIPSState *env)
|
|||||||
return (int32_t)cpu_mips_get_count(env);
|
return (int32_t)cpu_mips_get_count(env);
|
||||||
}
|
}
|
||||||
|
|
||||||
target_ulong helper_mfc0_saar(CPUMIPSState *env)
|
|
||||||
{
|
|
||||||
if ((env->CP0_SAARI & 0x3f) < 2) {
|
|
||||||
return (int32_t) env->CP0_SAAR[env->CP0_SAARI & 0x3f];
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
target_ulong helper_mfhc0_saar(CPUMIPSState *env)
|
|
||||||
{
|
|
||||||
if ((env->CP0_SAARI & 0x3f) < 2) {
|
|
||||||
return env->CP0_SAAR[env->CP0_SAARI & 0x3f] >> 32;
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
target_ulong helper_mftc0_entryhi(CPUMIPSState *env)
|
target_ulong helper_mftc0_entryhi(CPUMIPSState *env)
|
||||||
{
|
{
|
||||||
int other_tc = env->CP0_VPEControl & (0xff << CP0VPECo_TargTC);
|
int other_tc = env->CP0_VPEControl & (0xff << CP0VPECo_TargTC);
|
||||||
@ -514,13 +498,6 @@ target_ulong helper_dmfc0_watchhi(CPUMIPSState *env, uint32_t sel)
|
|||||||
return env->CP0_WatchHi[sel];
|
return env->CP0_WatchHi[sel];
|
||||||
}
|
}
|
||||||
|
|
||||||
target_ulong helper_dmfc0_saar(CPUMIPSState *env)
|
|
||||||
{
|
|
||||||
if ((env->CP0_SAARI & 0x3f) < 2) {
|
|
||||||
return env->CP0_SAAR[env->CP0_SAARI & 0x3f];
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
#endif /* TARGET_MIPS64 */
|
#endif /* TARGET_MIPS64 */
|
||||||
|
|
||||||
void helper_mtc0_index(CPUMIPSState *env, target_ulong arg1)
|
void helper_mtc0_index(CPUMIPSState *env, target_ulong arg1)
|
||||||
@ -1100,46 +1077,6 @@ void helper_mtc0_count(CPUMIPSState *env, target_ulong arg1)
|
|||||||
cpu_mips_store_count(env, arg1);
|
cpu_mips_store_count(env, arg1);
|
||||||
}
|
}
|
||||||
|
|
||||||
void helper_mtc0_saari(CPUMIPSState *env, target_ulong arg1)
|
|
||||||
{
|
|
||||||
uint32_t target = arg1 & 0x3f;
|
|
||||||
if (target <= 1) {
|
|
||||||
env->CP0_SAARI = target;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void helper_mtc0_saar(CPUMIPSState *env, target_ulong arg1)
|
|
||||||
{
|
|
||||||
uint32_t target = env->CP0_SAARI & 0x3f;
|
|
||||||
if (target < 2) {
|
|
||||||
env->CP0_SAAR[target] = arg1 & 0x00000ffffffff03fULL;
|
|
||||||
switch (target) {
|
|
||||||
case 0:
|
|
||||||
if (env->itu) {
|
|
||||||
itc_reconfigure(env->itu);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void helper_mthc0_saar(CPUMIPSState *env, target_ulong arg1)
|
|
||||||
{
|
|
||||||
uint32_t target = env->CP0_SAARI & 0x3f;
|
|
||||||
if (target < 2) {
|
|
||||||
env->CP0_SAAR[target] =
|
|
||||||
(((uint64_t) arg1 << 32) & 0x00000fff00000000ULL) |
|
|
||||||
(env->CP0_SAAR[target] & 0x00000000ffffffffULL);
|
|
||||||
switch (target) {
|
|
||||||
case 0:
|
|
||||||
if (env->itu) {
|
|
||||||
itc_reconfigure(env->itu);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void helper_mtc0_entryhi(CPUMIPSState *env, target_ulong arg1)
|
void helper_mtc0_entryhi(CPUMIPSState *env, target_ulong arg1)
|
||||||
{
|
{
|
||||||
target_ulong old, val, mask;
|
target_ulong old, val, mask;
|
||||||
|
@ -31,8 +31,6 @@ DEF_HELPER_1(mftc0_tcschedule, tl, env)
|
|||||||
DEF_HELPER_1(mfc0_tcschefback, tl, env)
|
DEF_HELPER_1(mfc0_tcschefback, tl, env)
|
||||||
DEF_HELPER_1(mftc0_tcschefback, tl, env)
|
DEF_HELPER_1(mftc0_tcschefback, tl, env)
|
||||||
DEF_HELPER_1(mfc0_count, tl, env)
|
DEF_HELPER_1(mfc0_count, tl, env)
|
||||||
DEF_HELPER_1(mfc0_saar, tl, env)
|
|
||||||
DEF_HELPER_1(mfhc0_saar, tl, env)
|
|
||||||
DEF_HELPER_1(mftc0_entryhi, tl, env)
|
DEF_HELPER_1(mftc0_entryhi, tl, env)
|
||||||
DEF_HELPER_1(mftc0_status, tl, env)
|
DEF_HELPER_1(mftc0_status, tl, env)
|
||||||
DEF_HELPER_1(mftc0_cause, tl, env)
|
DEF_HELPER_1(mftc0_cause, tl, env)
|
||||||
@ -57,7 +55,6 @@ DEF_HELPER_1(dmfc0_lladdr, tl, env)
|
|||||||
DEF_HELPER_1(dmfc0_maar, tl, env)
|
DEF_HELPER_1(dmfc0_maar, tl, env)
|
||||||
DEF_HELPER_2(dmfc0_watchlo, tl, env, i32)
|
DEF_HELPER_2(dmfc0_watchlo, tl, env, i32)
|
||||||
DEF_HELPER_2(dmfc0_watchhi, tl, env, i32)
|
DEF_HELPER_2(dmfc0_watchhi, tl, env, i32)
|
||||||
DEF_HELPER_1(dmfc0_saar, tl, env)
|
|
||||||
#endif /* TARGET_MIPS64 */
|
#endif /* TARGET_MIPS64 */
|
||||||
|
|
||||||
DEF_HELPER_2(mtc0_index, void, env, tl)
|
DEF_HELPER_2(mtc0_index, void, env, tl)
|
||||||
@ -103,9 +100,6 @@ DEF_HELPER_2(mtc0_srsconf4, void, env, tl)
|
|||||||
DEF_HELPER_2(mtc0_hwrena, void, env, tl)
|
DEF_HELPER_2(mtc0_hwrena, void, env, tl)
|
||||||
DEF_HELPER_2(mtc0_pwctl, void, env, tl)
|
DEF_HELPER_2(mtc0_pwctl, void, env, tl)
|
||||||
DEF_HELPER_2(mtc0_count, void, env, tl)
|
DEF_HELPER_2(mtc0_count, void, env, tl)
|
||||||
DEF_HELPER_2(mtc0_saari, void, env, tl)
|
|
||||||
DEF_HELPER_2(mtc0_saar, void, env, tl)
|
|
||||||
DEF_HELPER_2(mthc0_saar, void, env, tl)
|
|
||||||
DEF_HELPER_2(mtc0_entryhi, void, env, tl)
|
DEF_HELPER_2(mtc0_entryhi, void, env, tl)
|
||||||
DEF_HELPER_2(mttc0_entryhi, void, env, tl)
|
DEF_HELPER_2(mttc0_entryhi, void, env, tl)
|
||||||
DEF_HELPER_2(mtc0_compare, void, env, tl)
|
DEF_HELPER_2(mtc0_compare, void, env, tl)
|
||||||
|
@ -5151,17 +5151,6 @@ static void gen_mfhc0(DisasContext *ctx, TCGv arg, int reg, int sel)
|
|||||||
goto cp0_unimplemented;
|
goto cp0_unimplemented;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case CP0_REGISTER_09:
|
|
||||||
switch (sel) {
|
|
||||||
case CP0_REG09__SAAR:
|
|
||||||
CP0_CHECK(ctx->saar);
|
|
||||||
gen_helper_mfhc0_saar(arg, tcg_env);
|
|
||||||
register_name = "SAAR";
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
goto cp0_unimplemented;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case CP0_REGISTER_17:
|
case CP0_REGISTER_17:
|
||||||
switch (sel) {
|
switch (sel) {
|
||||||
case CP0_REG17__LLADDR:
|
case CP0_REG17__LLADDR:
|
||||||
@ -5252,17 +5241,6 @@ static void gen_mthc0(DisasContext *ctx, TCGv arg, int reg, int sel)
|
|||||||
goto cp0_unimplemented;
|
goto cp0_unimplemented;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case CP0_REGISTER_09:
|
|
||||||
switch (sel) {
|
|
||||||
case CP0_REG09__SAAR:
|
|
||||||
CP0_CHECK(ctx->saar);
|
|
||||||
gen_helper_mthc0_saar(tcg_env, arg);
|
|
||||||
register_name = "SAAR";
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
goto cp0_unimplemented;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case CP0_REGISTER_17:
|
case CP0_REGISTER_17:
|
||||||
switch (sel) {
|
switch (sel) {
|
||||||
case CP0_REG17__LLADDR:
|
case CP0_REG17__LLADDR:
|
||||||
@ -5675,16 +5653,6 @@ static void gen_mfc0(DisasContext *ctx, TCGv arg, int reg, int sel)
|
|||||||
ctx->base.is_jmp = DISAS_EXIT;
|
ctx->base.is_jmp = DISAS_EXIT;
|
||||||
register_name = "Count";
|
register_name = "Count";
|
||||||
break;
|
break;
|
||||||
case CP0_REG09__SAARI:
|
|
||||||
CP0_CHECK(ctx->saar);
|
|
||||||
gen_mfc0_load32(arg, offsetof(CPUMIPSState, CP0_SAARI));
|
|
||||||
register_name = "SAARI";
|
|
||||||
break;
|
|
||||||
case CP0_REG09__SAAR:
|
|
||||||
CP0_CHECK(ctx->saar);
|
|
||||||
gen_helper_mfc0_saar(arg, tcg_env);
|
|
||||||
register_name = "SAAR";
|
|
||||||
break;
|
|
||||||
default:
|
default:
|
||||||
goto cp0_unimplemented;
|
goto cp0_unimplemented;
|
||||||
}
|
}
|
||||||
@ -6401,16 +6369,6 @@ static void gen_mtc0(DisasContext *ctx, TCGv arg, int reg, int sel)
|
|||||||
gen_helper_mtc0_count(tcg_env, arg);
|
gen_helper_mtc0_count(tcg_env, arg);
|
||||||
register_name = "Count";
|
register_name = "Count";
|
||||||
break;
|
break;
|
||||||
case CP0_REG09__SAARI:
|
|
||||||
CP0_CHECK(ctx->saar);
|
|
||||||
gen_helper_mtc0_saari(tcg_env, arg);
|
|
||||||
register_name = "SAARI";
|
|
||||||
break;
|
|
||||||
case CP0_REG09__SAAR:
|
|
||||||
CP0_CHECK(ctx->saar);
|
|
||||||
gen_helper_mtc0_saar(tcg_env, arg);
|
|
||||||
register_name = "SAAR";
|
|
||||||
break;
|
|
||||||
default:
|
default:
|
||||||
goto cp0_unimplemented;
|
goto cp0_unimplemented;
|
||||||
}
|
}
|
||||||
@ -7175,16 +7133,6 @@ static void gen_dmfc0(DisasContext *ctx, TCGv arg, int reg, int sel)
|
|||||||
ctx->base.is_jmp = DISAS_EXIT;
|
ctx->base.is_jmp = DISAS_EXIT;
|
||||||
register_name = "Count";
|
register_name = "Count";
|
||||||
break;
|
break;
|
||||||
case CP0_REG09__SAARI:
|
|
||||||
CP0_CHECK(ctx->saar);
|
|
||||||
gen_mfc0_load32(arg, offsetof(CPUMIPSState, CP0_SAARI));
|
|
||||||
register_name = "SAARI";
|
|
||||||
break;
|
|
||||||
case CP0_REG09__SAAR:
|
|
||||||
CP0_CHECK(ctx->saar);
|
|
||||||
gen_helper_dmfc0_saar(arg, tcg_env);
|
|
||||||
register_name = "SAAR";
|
|
||||||
break;
|
|
||||||
default:
|
default:
|
||||||
goto cp0_unimplemented;
|
goto cp0_unimplemented;
|
||||||
}
|
}
|
||||||
@ -7887,16 +7835,6 @@ static void gen_dmtc0(DisasContext *ctx, TCGv arg, int reg, int sel)
|
|||||||
gen_helper_mtc0_count(tcg_env, arg);
|
gen_helper_mtc0_count(tcg_env, arg);
|
||||||
register_name = "Count";
|
register_name = "Count";
|
||||||
break;
|
break;
|
||||||
case CP0_REG09__SAARI:
|
|
||||||
CP0_CHECK(ctx->saar);
|
|
||||||
gen_helper_mtc0_saari(tcg_env, arg);
|
|
||||||
register_name = "SAARI";
|
|
||||||
break;
|
|
||||||
case CP0_REG09__SAAR:
|
|
||||||
CP0_CHECK(ctx->saar);
|
|
||||||
gen_helper_mtc0_saar(tcg_env, arg);
|
|
||||||
register_name = "SAAR";
|
|
||||||
break;
|
|
||||||
default:
|
default:
|
||||||
goto cp0_unimplemented;
|
goto cp0_unimplemented;
|
||||||
}
|
}
|
||||||
|
@ -49,7 +49,6 @@ typedef struct DisasContext {
|
|||||||
bool mrp;
|
bool mrp;
|
||||||
bool nan2008;
|
bool nan2008;
|
||||||
bool abs2008;
|
bool abs2008;
|
||||||
bool saar;
|
|
||||||
bool mi;
|
bool mi;
|
||||||
int gi;
|
int gi;
|
||||||
} DisasContext;
|
} DisasContext;
|
||||||
|
@ -545,10 +545,9 @@ struct CPUArchState {
|
|||||||
#endif
|
#endif
|
||||||
sparc_def_t def;
|
sparc_def_t def;
|
||||||
|
|
||||||
void *irq_manager;
|
/* Leon3 */
|
||||||
|
DeviceState *irq_manager;
|
||||||
void (*qemu_irq_ack)(CPUSPARCState *env, int intno);
|
void (*qemu_irq_ack)(CPUSPARCState *env, int intno);
|
||||||
|
|
||||||
/* Leon3 cache control */
|
|
||||||
uint32_t cache_control;
|
uint32_t cache_control;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -212,4 +212,20 @@ void helper_power_down(CPUSPARCState *env)
|
|||||||
env->npc = env->pc + 4;
|
env->npc = env->pc + 4;
|
||||||
cpu_loop_exit(cs);
|
cpu_loop_exit(cs);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
target_ulong helper_rdasr17(CPUSPARCState *env)
|
||||||
|
{
|
||||||
|
CPUState *cs = env_cpu(env);
|
||||||
|
target_ulong val;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* TODO: There are many more fields to be filled,
|
||||||
|
* some of which are writable.
|
||||||
|
*/
|
||||||
|
val = env->def.nwindows - 1; /* [4:0] NWIN */
|
||||||
|
val |= 1 << 8; /* [8] V8 */
|
||||||
|
val |= (cs->cpu_index) << 28; /* [31:28] INDEX */
|
||||||
|
|
||||||
|
return val;
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
DEF_HELPER_1(rett, void, env)
|
DEF_HELPER_1(rett, void, env)
|
||||||
DEF_HELPER_2(wrpsr, void, env, tl)
|
DEF_HELPER_2(wrpsr, void, env, tl)
|
||||||
DEF_HELPER_1(rdpsr, tl, env)
|
DEF_HELPER_1(rdpsr, tl, env)
|
||||||
|
DEF_HELPER_1(rdasr17, tl, env)
|
||||||
DEF_HELPER_1(power_down, void, env)
|
DEF_HELPER_1(power_down, void, env)
|
||||||
#else
|
#else
|
||||||
DEF_HELPER_FLAGS_2(wrpil, TCG_CALL_NO_RWG, void, env, tl)
|
DEF_HELPER_FLAGS_2(wrpil, TCG_CALL_NO_RWG, void, env, tl)
|
||||||
|
@ -37,6 +37,7 @@
|
|||||||
|
|
||||||
#ifdef TARGET_SPARC64
|
#ifdef TARGET_SPARC64
|
||||||
# define gen_helper_rdpsr(D, E) qemu_build_not_reached()
|
# define gen_helper_rdpsr(D, E) qemu_build_not_reached()
|
||||||
|
# define gen_helper_rdasr17(D, E) qemu_build_not_reached()
|
||||||
# define gen_helper_rett(E) qemu_build_not_reached()
|
# define gen_helper_rett(E) qemu_build_not_reached()
|
||||||
# define gen_helper_power_down(E) qemu_build_not_reached()
|
# define gen_helper_power_down(E) qemu_build_not_reached()
|
||||||
# define gen_helper_wrpsr(E, S) qemu_build_not_reached()
|
# define gen_helper_wrpsr(E, S) qemu_build_not_reached()
|
||||||
@ -2382,16 +2383,8 @@ static bool trans_RDY(DisasContext *dc, arg_RDY *a)
|
|||||||
|
|
||||||
static TCGv do_rd_leon3_config(DisasContext *dc, TCGv dst)
|
static TCGv do_rd_leon3_config(DisasContext *dc, TCGv dst)
|
||||||
{
|
{
|
||||||
uint32_t val;
|
gen_helper_rdasr17(dst, tcg_env);
|
||||||
|
return dst;
|
||||||
/*
|
|
||||||
* TODO: There are many more fields to be filled,
|
|
||||||
* some of which are writable.
|
|
||||||
*/
|
|
||||||
val = dc->def->nwindows - 1; /* [4:0] NWIN */
|
|
||||||
val |= 1 << 8; /* [8] V8 */
|
|
||||||
|
|
||||||
return tcg_constant_tl(val);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
TRANS(RDASR17, ASR17, do_rd_special, true, a->rd, do_rd_leon3_config)
|
TRANS(RDASR17, ASR17, do_rd_special, true, a->rd, do_rd_leon3_config)
|
||||||
|
Loading…
Reference in New Issue
Block a user