@@ -354,7 +354,11 @@ static uint64_t tpm_tis_mmio_read(void *opaque, hwaddr addr,
val = s->loc[locty].inte;
break;
case TPM_TIS_REG_INT_VECTOR:
- val = s->irq_num;
+ if (s->irq_num != TPM_IRQ_DISABLED) {
+ val = s->irq_num;
+ } else {
+ val = 0;
+ }
break;
case TPM_TIS_REG_INT_STATUS:
val = s->loc[locty].ints;
@@ -586,6 +590,9 @@ static void tpm_tis_mmio_write(void *opaque, hwaddr addr,
if (s->active_locty != locty) {
break;
}
+ if (s->irq_num == TPM_IRQ_DISABLED) {
+ val &= ~TPM_TIS_INT_ENABLED;
+ }
s->loc[locty].inte &= mask;
s->loc[locty].inte |= (val & (TPM_TIS_INT_ENABLED |
@@ -596,6 +603,9 @@ static void tpm_tis_mmio_write(void *opaque, hwaddr addr,
/* hard wired -- ignore */
break;
case TPM_TIS_REG_INT_STATUS:
+ if (s->irq_num == TPM_IRQ_DISABLED) {
+ break;
+ }
/* clearing of interrupt flags */
if (((val & TPM_TIS_INTERRUPTS_SUPPORTED)) &&
(s->loc[locty].ints & TPM_TIS_INTERRUPTS_SUPPORTED)) {
@@ -128,13 +128,15 @@ static void tpm_tis_isa_realizefn(DeviceState *dev, Error **errp)
error_setg(errp, "'tpmdev' property is required");
return;
}
- if (s->irq_num > 15) {
+ if (s->irq_num > 15 && s->irq_num != TPM_IRQ_DISABLED) {
error_setg(errp, "IRQ %d is outside valid range of 0 to 15",
s->irq_num);
return;
}
- isa_init_irq(ISA_DEVICE(dev), &s->irq, s->irq_num);
+ if (s->irq_num != TPM_IRQ_DISABLED) {
+ isa_init_irq(ISA_DEVICE(dev), &s->irq, s->irq_num);
+ }
memory_region_add_subregion(isa_address_space(ISA_DEVICE(dev)),
TPM_TIS_ADDR_BASE, &s->mmio);