[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 05/18] hw/pci-host/bonito: Simplify soft reset using FIELD_EX32()
From: |
Philippe Mathieu-Daudé |
Subject: |
[PATCH 05/18] hw/pci-host/bonito: Simplify soft reset using FIELD_EX32() |
Date: |
Thu, 31 Dec 2020 23:48:58 +0100 |
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
---
hw/pci-host/bonito.c | 10 ++++------
1 file changed, 4 insertions(+), 6 deletions(-)
diff --git a/hw/pci-host/bonito.c b/hw/pci-host/bonito.c
index fe94e6740b5..104c58331d0 100644
--- a/hw/pci-host/bonito.c
+++ b/hw/pci-host/bonito.c
@@ -244,7 +244,6 @@ static void bonito_writel(void *opaque, hwaddr addr,
{
PCIBonitoState *s = opaque;
uint32_t saddr;
- int reset = 0;
saddr = addr >> 2;
@@ -277,13 +276,12 @@ static void bonito_writel(void *opaque, hwaddr addr,
s->regs[saddr] = val;
break;
case BONITO_BONGENCFG:
- if (!(s->regs[saddr] & 0x04) && (val & 0x04)) {
- reset = 1; /* bit 2 jump from 0 to 1 cause reset */
- }
- s->regs[saddr] = val;
- if (reset) {
+ if (!FIELD_EX32(s->regs[saddr], BONGENCFG, CPUSELFRESET)
+ && FIELD_EX32(val, BONGENCFG, CPUSELFRESET)) {
+ /* bit 2 jump from 0 to 1 cause reset */
qemu_system_reset_request(SHUTDOWN_CAUSE_GUEST_RESET);
}
+ s->regs[saddr] = val;
break;
case BONITO_INTENSET:
s->regs[BONITO_INTENSET] = val;
--
2.26.2
- [PATCH 00/18] hw/pci-host/bonito: Remap PCI "lo" regions when PCIMAP reg is modified, Philippe Mathieu-Daudé, 2020/12/31
- [PATCH 01/18] hw/pci-host/bonito: Remove unused definitions, Philippe Mathieu-Daudé, 2020/12/31
- [PATCH 02/18] hw/pci-host/bonito: Display hexadecimal value with '0x' prefix, Philippe Mathieu-Daudé, 2020/12/31
- [PATCH 03/18] hw/pci-host/bonito: Use PCI_DEVFN() macro, Philippe Mathieu-Daudé, 2020/12/31
- [PATCH 04/18] hw/pci-host/bonito: Use pci_config_set_interrupt_pin(), Philippe Mathieu-Daudé, 2020/12/31
- [PATCH 05/18] hw/pci-host/bonito: Simplify soft reset using FIELD_EX32(),
Philippe Mathieu-Daudé <=
- [RFC PATCH 06/18] hw/pci-host/bonito: Do not allow big-endian targets, Philippe Mathieu-Daudé, 2020/12/31
- [PATCH 07/18] hw/pci-host/bonito: Make BONPONCFG register read-only, Philippe Mathieu-Daudé, 2020/12/31
- [RFC PATCH 08/18] hw/pci-host/bonito: Remap PCI "lo" regions when PCIMAP reg is modified, Philippe Mathieu-Daudé, 2020/12/31
- [PATCH 09/18] hw/pci-host/bonito: Rename north bridge helpers, Philippe Mathieu-Daudé, 2020/12/31
- [PATCH 10/18] hw/pci-host/bonito: Rename PCI host helpers, Philippe Mathieu-Daudé, 2020/12/31
- [PATCH 11/18] hw/pci-host/bonito: Rename PCI function helpers, Philippe Mathieu-Daudé, 2020/12/31
- [PATCH 12/18] hw/pci-host/bonito: Rename PCIBonitoState -> BonitoPciState, Philippe Mathieu-Daudé, 2020/12/31
- [PATCH 13/18] hw/pci-host/bonito: Create PCI regions in bonito_host_realize(), Philippe Mathieu-Daudé, 2020/12/31
- [RFC PATCH 14/18] hw/pci-host/bonito: Simplify using pci_host_conf_le_ops MemoryRegionOps, Philippe Mathieu-Daudé, 2020/12/31
- [PATCH 15/18] hw/pci-host/bonito: Map north bridge region in bonito_host_realize(), Philippe Mathieu-Daudé, 2020/12/31