aboutsummaryrefslogtreecommitdiff
path: root/hw/intc
diff options
context:
space:
mode:
authorBibo Mao <maobibo@loongson.cn>2025-05-07 10:31:43 +0800
committerSong Gao <gaosong@loongson.cn>2025-05-14 15:50:27 +0800
commit2618d65036d4c05771727784ec665132689e2608 (patch)
tree98e4589a1bdc2a8fcadb652f662eb0e700cf4b6f /hw/intc
parentf5dc4993fc5cee1a6fcfca1e4728af2fe965f98e (diff)
downloadqemu-2618d65036d4c05771727784ec665132689e2608.zip
qemu-2618d65036d4c05771727784ec665132689e2608.tar.gz
qemu-2618d65036d4c05771727784ec665132689e2608.tar.bz2
hw/intc/loongarch_pch: Use generic write callback for iomem32_high region
Add iomem32_high region register write operation emulation in generic write function loongarch_pch_pic_write(), and use this function for iomem32_high region. Signed-off-by: Bibo Mao <maobibo@loongson.cn> Reviewed-by: Song Gao <gaosong@loongson.cn> Message-Id: <20250507023148.1877287-12-maobibo@loongson.cn> Signed-off-by: Song Gao <gaosong@loongson.cn>
Diffstat (limited to 'hw/intc')
-rw-r--r--hw/intc/loongarch_pch_pic.c28
1 files changed, 5 insertions, 23 deletions
diff --git a/hw/intc/loongarch_pch_pic.c b/hw/intc/loongarch_pch_pic.c
index 07f9b07..50bcc23 100644
--- a/hw/intc/loongarch_pch_pic.c
+++ b/hw/intc/loongarch_pch_pic.c
@@ -158,6 +158,9 @@ static void pch_pic_write(void *opaque, hwaddr addr, uint64_t value,
case PCH_PIC_AUTO_CTRL1:
/* Discard auto_ctrl access */
break;
+ case PCH_PIC_INT_POL:
+ s->int_polarity = (s->int_polarity & ~mask) | data;
+ break;
default:
qemu_log_mask(LOG_GUEST_ERROR,
"pch_pic_write: Bad address 0x%"PRIx64"\n", addr);
@@ -226,14 +229,6 @@ static uint64_t loongarch_pch_pic_low_readw(void *opaque, hwaddr addr,
return val;
}
-static uint64_t get_writew_val(uint64_t value, uint32_t target, bool hi)
-{
- uint64_t mask = 0xffffffff00000000;
- uint64_t data = target;
-
- return hi ? (value & ~mask) | (data << 32) : (value & mask) | data;
-}
-
static void loongarch_pch_pic_low_writew(void *opaque, hwaddr addr,
uint64_t value, unsigned size)
{
@@ -255,22 +250,9 @@ static uint64_t loongarch_pch_pic_high_readw(void *opaque, hwaddr addr,
static void loongarch_pch_pic_high_writew(void *opaque, hwaddr addr,
uint64_t value, unsigned size)
{
- LoongArchPICCommonState *s = LOONGARCH_PIC_COMMON(opaque);
- uint32_t data = (uint32_t)value;
-
addr += PCH_PIC_INT_STATUS;
- trace_loongarch_pch_pic_high_writew(size, addr, data);
-
- switch (addr) {
- case PCH_PIC_INT_POL:
- s->int_polarity = get_writew_val(s->int_polarity, data, 0);
- break;
- case PCH_PIC_INT_POL + 4:
- s->int_polarity = get_writew_val(s->int_polarity, data, 1);
- break;
- default:
- break;
- }
+ trace_loongarch_pch_pic_high_writew(size, addr, value);
+ loongarch_pch_pic_write(opaque, addr, value, size);
}
static uint64_t loongarch_pch_pic_readb(void *opaque, hwaddr addr,