mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-03 15:53:54 -06:00
hw/intc/loongarch_pch: Use generic read callback for iomem8 region
Add iomem8 region register read operation emulation in generic read function loongarch_pch_pic_read(), and use this function for iomem8 region. Signed-off-by: Bibo Mao <maobibo@loongson.cn> Reviewed-by: Song Gao <gaosong@loongson.cn> Message-Id: <20250507023148.1877287-10-maobibo@loongson.cn> Signed-off-by: Song Gao <gaosong@loongson.cn>
This commit is contained in:
parent
6dab13c415
commit
81de67213d
1 changed files with 8 additions and 20 deletions
|
@ -103,6 +103,12 @@ static uint64_t pch_pic_read(void *opaque, hwaddr addr, uint64_t field_mask)
|
||||||
case PCH_PIC_INT_POL:
|
case PCH_PIC_INT_POL:
|
||||||
val = s->int_polarity;
|
val = s->int_polarity;
|
||||||
break;
|
break;
|
||||||
|
case PCH_PIC_HTMSI_VEC ... PCH_PIC_HTMSI_VEC_END:
|
||||||
|
val = *(uint64_t *)(s->htmsi_vector + addr - PCH_PIC_HTMSI_VEC);
|
||||||
|
break;
|
||||||
|
case PCH_PIC_ROUTE_ENTRY ... PCH_PIC_ROUTE_ENTRY_END:
|
||||||
|
val = *(uint64_t *)(s->route_entry + addr - PCH_PIC_ROUTE_ENTRY);
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
qemu_log_mask(LOG_GUEST_ERROR,
|
qemu_log_mask(LOG_GUEST_ERROR,
|
||||||
"pch_pic_read: Bad address 0x%"PRIx64"\n", addr);
|
"pch_pic_read: Bad address 0x%"PRIx64"\n", addr);
|
||||||
|
@ -264,28 +270,10 @@ static void loongarch_pch_pic_high_writew(void *opaque, hwaddr addr,
|
||||||
static uint64_t loongarch_pch_pic_readb(void *opaque, hwaddr addr,
|
static uint64_t loongarch_pch_pic_readb(void *opaque, hwaddr addr,
|
||||||
unsigned size)
|
unsigned size)
|
||||||
{
|
{
|
||||||
LoongArchPICCommonState *s = LOONGARCH_PIC_COMMON(opaque);
|
uint64_t val;
|
||||||
uint64_t val = 0;
|
|
||||||
int64_t offset_tmp;
|
|
||||||
|
|
||||||
addr += PCH_PIC_ROUTE_ENTRY;
|
addr += PCH_PIC_ROUTE_ENTRY;
|
||||||
switch (addr) {
|
val = loongarch_pch_pic_read(opaque, addr, size);
|
||||||
case PCH_PIC_HTMSI_VEC ... PCH_PIC_HTMSI_VEC_END:
|
|
||||||
offset_tmp = addr - PCH_PIC_HTMSI_VEC;
|
|
||||||
if (offset_tmp >= 0 && offset_tmp < 64) {
|
|
||||||
val = s->htmsi_vector[offset_tmp];
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case PCH_PIC_ROUTE_ENTRY ... PCH_PIC_ROUTE_ENTRY_END:
|
|
||||||
offset_tmp = addr - PCH_PIC_ROUTE_ENTRY;
|
|
||||||
if (offset_tmp >= 0 && offset_tmp < 64) {
|
|
||||||
val = s->route_entry[offset_tmp];
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
trace_loongarch_pch_pic_readb(size, addr, val);
|
trace_loongarch_pch_pic_readb(size, addr, val);
|
||||||
return val;
|
return val;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue