[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v4 08/16] hw/intc/loongarch_pch: Use generic read callback for io
From: |
Bibo Mao |
Subject: |
[PATCH v4 08/16] hw/intc/loongarch_pch: Use generic read callback for iomem32_high region |
Date: |
Wed, 7 May 2025 10:31:40 +0800 |
Add register read operation emulation in generic read function
loongarch_pch_pic_read(), and use this function for iomem32_high region.
Signed-off-by: Bibo Mao <maobibo@loongson.cn>
Reviewed-by: Song Gao <gaosong@loongson.cn>
---
hw/intc/loongarch_pch_pic.c | 27 ++++++++-------------------
1 file changed, 8 insertions(+), 19 deletions(-)
diff --git a/hw/intc/loongarch_pch_pic.c b/hw/intc/loongarch_pch_pic.c
index 599a27197f..e477a6033b 100644
--- a/hw/intc/loongarch_pch_pic.c
+++ b/hw/intc/loongarch_pch_pic.c
@@ -97,6 +97,12 @@ static uint64_t pch_pic_read(void *opaque, hwaddr addr,
uint64_t field_mask)
case PCH_PIC_AUTO_CTRL1:
/* PCH PIC connect to EXTIOI always, discard auto_ctrl access */
break;
+ case PCH_PIC_INT_STATUS:
+ val = s->intisr & (~s->int_mask);
+ break;
+ case PCH_PIC_INT_POL:
+ val = s->int_polarity;
+ break;
default:
qemu_log_mask(LOG_GUEST_ERROR,
"pch_pic_read: Bad address 0x%"PRIx64"\n", addr);
@@ -226,27 +232,10 @@ static void loongarch_pch_pic_low_writew(void *opaque,
hwaddr addr,
static uint64_t loongarch_pch_pic_high_readw(void *opaque, hwaddr addr,
unsigned size)
{
- LoongArchPICCommonState *s = LOONGARCH_PIC_COMMON(opaque);
- uint64_t val = 0;
+ uint64_t val;
addr += PCH_PIC_INT_STATUS;
- switch (addr) {
- case PCH_PIC_INT_STATUS:
- val = (uint32_t)(s->intisr & (~s->int_mask));
- break;
- case PCH_PIC_INT_STATUS + 4:
- val = (s->intisr & (~s->int_mask)) >> 32;
- break;
- case PCH_PIC_INT_POL:
- val = (uint32_t)s->int_polarity;
- break;
- case PCH_PIC_INT_POL + 4:
- val = s->int_polarity >> 32;
- break;
- default:
- break;
- }
-
+ val = loongarch_pch_pic_read(opaque, addr, size);
trace_loongarch_pch_pic_high_readw(size, addr, val);
return val;
}
--
2.39.3
- [PATCH v4 00/16] hw/intc/loongarch_pch: Cleanup with memory region ops, Bibo Mao, 2025/05/06
- [PATCH v4 01/16] hw/intc/loongarch_pch: Modify name of some registers, Bibo Mao, 2025/05/06
- [PATCH v4 04/16] hw/intc/loongarch_pch: Set version information at initial stage, Bibo Mao, 2025/05/06
- [PATCH v4 05/16] hw/intc/loongarch_pch: Use relative address in MemoryRegionOps, Bibo Mao, 2025/05/06
- [PATCH v4 06/16] hw/intc/loongarch_pch: Discard write operation with ISR register, Bibo Mao, 2025/05/06
- [PATCH v4 02/16] hw/intc/loongarch_pch: Modify register name PCH_PIC_xxx_OFFSET with PCH_PIC_xxx, Bibo Mao, 2025/05/06
- [PATCH v4 03/16] hw/intc/loongarch_pch: Remove some duplicate macro, Bibo Mao, 2025/05/06
- [PATCH v4 07/16] hw/intc/loongarch_pch: Use generic read callback for iomem32_low region, Bibo Mao, 2025/05/06
- [PATCH v4 09/16] hw/intc/loongarch_pch: Use generic read callback for iomem8 region, Bibo Mao, 2025/05/06
- [PATCH v4 10/16] hw/intc/loongarch_pch: Use generic write callback for iomem32_low region, Bibo Mao, 2025/05/06
- [PATCH v4 08/16] hw/intc/loongarch_pch: Use generic read callback for iomem32_high region,
Bibo Mao <=
- [PATCH v4 11/16] hw/intc/loongarch_pch: Use generic write callback for iomem32_high region, Bibo Mao, 2025/05/06
- [PATCH v4 12/16] hw/intc/loongarch_pch: Use generic write callback for iomem8 region, Bibo Mao, 2025/05/06
- Re: [PATCH v4 00/16] hw/intc/loongarch_pch: Cleanup with memory region ops, gaosong, 2025/05/14