mirror of https://github.com/xemu-project/xemu.git
hw/misc/iotkit-secctl: Add remaining simple registers
Add remaining easy registers to iotkit-secctl: * NSCCFG just routes its two bits out to external GPIO lines * BRGINSTAT/BRGINTCLR/BRGINTEN can be dummies, because QEMU's bus fabric can never report errors Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Message-id: 20180220180325.29818-18-peter.maydell@linaro.org
This commit is contained in:
parent
b3717c23e1
commit
b1ce38e12b
|
@ -136,12 +136,24 @@ static MemTxResult iotkit_secctl_s_read(void *opaque, hwaddr addr,
|
||||||
case A_SECRESPCFG:
|
case A_SECRESPCFG:
|
||||||
r = s->secrespcfg;
|
r = s->secrespcfg;
|
||||||
break;
|
break;
|
||||||
|
case A_NSCCFG:
|
||||||
|
r = s->nsccfg;
|
||||||
|
break;
|
||||||
case A_SECPPCINTSTAT:
|
case A_SECPPCINTSTAT:
|
||||||
r = s->secppcintstat;
|
r = s->secppcintstat;
|
||||||
break;
|
break;
|
||||||
case A_SECPPCINTEN:
|
case A_SECPPCINTEN:
|
||||||
r = s->secppcinten;
|
r = s->secppcinten;
|
||||||
break;
|
break;
|
||||||
|
case A_BRGINTSTAT:
|
||||||
|
/* QEMU's bus fabric can never report errors as it doesn't buffer
|
||||||
|
* writes, so we never report bridge interrupts.
|
||||||
|
*/
|
||||||
|
r = 0;
|
||||||
|
break;
|
||||||
|
case A_BRGINTEN:
|
||||||
|
r = s->brginten;
|
||||||
|
break;
|
||||||
case A_AHBNSPPCEXP0:
|
case A_AHBNSPPCEXP0:
|
||||||
case A_AHBNSPPCEXP1:
|
case A_AHBNSPPCEXP1:
|
||||||
case A_AHBNSPPCEXP2:
|
case A_AHBNSPPCEXP2:
|
||||||
|
@ -174,12 +186,9 @@ static MemTxResult iotkit_secctl_s_read(void *opaque, hwaddr addr,
|
||||||
case A_APBSPPPCEXP3:
|
case A_APBSPPPCEXP3:
|
||||||
r = s->apbexp[offset_to_ppc_idx(offset)].sp;
|
r = s->apbexp[offset_to_ppc_idx(offset)].sp;
|
||||||
break;
|
break;
|
||||||
case A_NSCCFG:
|
|
||||||
case A_SECMPCINTSTATUS:
|
case A_SECMPCINTSTATUS:
|
||||||
case A_SECMSCINTSTAT:
|
case A_SECMSCINTSTAT:
|
||||||
case A_SECMSCINTEN:
|
case A_SECMSCINTEN:
|
||||||
case A_BRGINTSTAT:
|
|
||||||
case A_BRGINTEN:
|
|
||||||
case A_NSMSCEXP:
|
case A_NSMSCEXP:
|
||||||
qemu_log_mask(LOG_UNIMP,
|
qemu_log_mask(LOG_UNIMP,
|
||||||
"IoTKit SecCtl S block read: "
|
"IoTKit SecCtl S block read: "
|
||||||
|
@ -298,6 +307,10 @@ static MemTxResult iotkit_secctl_s_write(void *opaque, hwaddr addr,
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (offset) {
|
switch (offset) {
|
||||||
|
case A_NSCCFG:
|
||||||
|
s->nsccfg = value & 3;
|
||||||
|
qemu_set_irq(s->nsc_cfg_irq, s->nsccfg);
|
||||||
|
break;
|
||||||
case A_SECRESPCFG:
|
case A_SECRESPCFG:
|
||||||
value &= 1;
|
value &= 1;
|
||||||
s->secrespcfg = value;
|
s->secrespcfg = value;
|
||||||
|
@ -311,6 +324,11 @@ static MemTxResult iotkit_secctl_s_write(void *opaque, hwaddr addr,
|
||||||
s->secppcinten = value & 0x00f000f3;
|
s->secppcinten = value & 0x00f000f3;
|
||||||
foreach_ppc(s, iotkit_secctl_ppc_update_irq_enable);
|
foreach_ppc(s, iotkit_secctl_ppc_update_irq_enable);
|
||||||
break;
|
break;
|
||||||
|
case A_BRGINTCLR:
|
||||||
|
break;
|
||||||
|
case A_BRGINTEN:
|
||||||
|
s->brginten = value & 0xffff0000;
|
||||||
|
break;
|
||||||
case A_AHBNSPPCEXP0:
|
case A_AHBNSPPCEXP0:
|
||||||
case A_AHBNSPPCEXP1:
|
case A_AHBNSPPCEXP1:
|
||||||
case A_AHBNSPPCEXP2:
|
case A_AHBNSPPCEXP2:
|
||||||
|
@ -349,11 +367,8 @@ static MemTxResult iotkit_secctl_s_write(void *opaque, hwaddr addr,
|
||||||
ppc = &s->apbexp[offset_to_ppc_idx(offset)];
|
ppc = &s->apbexp[offset_to_ppc_idx(offset)];
|
||||||
iotkit_secctl_ppc_sp_write(ppc, value);
|
iotkit_secctl_ppc_sp_write(ppc, value);
|
||||||
break;
|
break;
|
||||||
case A_NSCCFG:
|
|
||||||
case A_SECMSCINTCLR:
|
case A_SECMSCINTCLR:
|
||||||
case A_SECMSCINTEN:
|
case A_SECMSCINTEN:
|
||||||
case A_BRGINTCLR:
|
|
||||||
case A_BRGINTEN:
|
|
||||||
qemu_log_mask(LOG_UNIMP,
|
qemu_log_mask(LOG_UNIMP,
|
||||||
"IoTKit SecCtl S block write: "
|
"IoTKit SecCtl S block write: "
|
||||||
"unimplemented offset 0x%x\n", offset);
|
"unimplemented offset 0x%x\n", offset);
|
||||||
|
@ -551,6 +566,8 @@ static void iotkit_secctl_reset(DeviceState *dev)
|
||||||
s->secppcintstat = 0;
|
s->secppcintstat = 0;
|
||||||
s->secppcinten = 0;
|
s->secppcinten = 0;
|
||||||
s->secrespcfg = 0;
|
s->secrespcfg = 0;
|
||||||
|
s->nsccfg = 0;
|
||||||
|
s->brginten = 0;
|
||||||
|
|
||||||
foreach_ppc(s, iotkit_secctl_reset_ppc);
|
foreach_ppc(s, iotkit_secctl_reset_ppc);
|
||||||
}
|
}
|
||||||
|
@ -621,6 +638,7 @@ static void iotkit_secctl_init(Object *obj)
|
||||||
}
|
}
|
||||||
|
|
||||||
qdev_init_gpio_out_named(dev, &s->sec_resp_cfg, "sec_resp_cfg", 1);
|
qdev_init_gpio_out_named(dev, &s->sec_resp_cfg, "sec_resp_cfg", 1);
|
||||||
|
qdev_init_gpio_out_named(dev, &s->nsc_cfg_irq, "nsc_cfg", 1);
|
||||||
|
|
||||||
memory_region_init_io(&s->s_regs, obj, &iotkit_secctl_s_ops,
|
memory_region_init_io(&s->s_regs, obj, &iotkit_secctl_s_ops,
|
||||||
s, "iotkit-secctl-s-regs", 0x1000);
|
s, "iotkit-secctl-s-regs", 0x1000);
|
||||||
|
@ -650,6 +668,8 @@ static const VMStateDescription iotkit_secctl_vmstate = {
|
||||||
VMSTATE_UINT32(secppcintstat, IoTKitSecCtl),
|
VMSTATE_UINT32(secppcintstat, IoTKitSecCtl),
|
||||||
VMSTATE_UINT32(secppcinten, IoTKitSecCtl),
|
VMSTATE_UINT32(secppcinten, IoTKitSecCtl),
|
||||||
VMSTATE_UINT32(secrespcfg, IoTKitSecCtl),
|
VMSTATE_UINT32(secrespcfg, IoTKitSecCtl),
|
||||||
|
VMSTATE_UINT32(nsccfg, IoTKitSecCtl),
|
||||||
|
VMSTATE_UINT32(brginten, IoTKitSecCtl),
|
||||||
VMSTATE_STRUCT_ARRAY(apb, IoTKitSecCtl, IOTS_NUM_APB_PPC, 1,
|
VMSTATE_STRUCT_ARRAY(apb, IoTKitSecCtl, IOTS_NUM_APB_PPC, 1,
|
||||||
iotkit_secctl_ppc_vmstate, IoTKitSecCtlPPC),
|
iotkit_secctl_ppc_vmstate, IoTKitSecCtlPPC),
|
||||||
VMSTATE_STRUCT_ARRAY(apbexp, IoTKitSecCtl, IOTS_NUM_APB_EXP_PPC, 1,
|
VMSTATE_STRUCT_ARRAY(apbexp, IoTKitSecCtl, IOTS_NUM_APB_EXP_PPC, 1,
|
||||||
|
|
|
@ -18,6 +18,7 @@
|
||||||
* + sysbus MMIO region 1 is the "non-secure privilege control block" registers
|
* + sysbus MMIO region 1 is the "non-secure privilege control block" registers
|
||||||
* + named GPIO output "sec_resp_cfg" indicating whether blocked accesses
|
* + named GPIO output "sec_resp_cfg" indicating whether blocked accesses
|
||||||
* should RAZ/WI or bus error
|
* should RAZ/WI or bus error
|
||||||
|
* + named GPIO output "nsc_cfg" whose value tracks the NSCCFG register value
|
||||||
* Controlling the 2 APB PPCs in the IoTKit:
|
* Controlling the 2 APB PPCs in the IoTKit:
|
||||||
* + named GPIO outputs apb_ppc0_nonsec[0..2] and apb_ppc1_nonsec
|
* + named GPIO outputs apb_ppc0_nonsec[0..2] and apb_ppc1_nonsec
|
||||||
* + named GPIO outputs apb_ppc0_ap[0..2] and apb_ppc1_ap
|
* + named GPIO outputs apb_ppc0_ap[0..2] and apb_ppc1_ap
|
||||||
|
@ -83,6 +84,7 @@ struct IoTKitSecCtl {
|
||||||
|
|
||||||
/*< public >*/
|
/*< public >*/
|
||||||
qemu_irq sec_resp_cfg;
|
qemu_irq sec_resp_cfg;
|
||||||
|
qemu_irq nsc_cfg_irq;
|
||||||
|
|
||||||
MemoryRegion s_regs;
|
MemoryRegion s_regs;
|
||||||
MemoryRegion ns_regs;
|
MemoryRegion ns_regs;
|
||||||
|
@ -90,6 +92,8 @@ struct IoTKitSecCtl {
|
||||||
uint32_t secppcintstat;
|
uint32_t secppcintstat;
|
||||||
uint32_t secppcinten;
|
uint32_t secppcinten;
|
||||||
uint32_t secrespcfg;
|
uint32_t secrespcfg;
|
||||||
|
uint32_t nsccfg;
|
||||||
|
uint32_t brginten;
|
||||||
|
|
||||||
IoTKitSecCtlPPC apb[IOTS_NUM_APB_PPC];
|
IoTKitSecCtlPPC apb[IOTS_NUM_APB_PPC];
|
||||||
IoTKitSecCtlPPC apbexp[IOTS_NUM_APB_EXP_PPC];
|
IoTKitSecCtlPPC apbexp[IOTS_NUM_APB_EXP_PPC];
|
||||||
|
|
Loading…
Reference in New Issue