Skip to content

Commit

Permalink
Add ACPI Table (EGIT)
Browse files Browse the repository at this point in the history
  • Loading branch information
lzw29107 committed Aug 15, 2024
1 parent 9cfa5c7 commit ac66b8a
Showing 1 changed file with 47 additions and 1 deletion.
48 changes: 47 additions & 1 deletion hw/arm/virt-acpi-build.c
Original file line number Diff line number Diff line change
Expand Up @@ -578,6 +578,49 @@ build_srat(GArray *table_data, BIOSLinker *linker, VirtMachineState *vms)
acpi_table_end(linker, &table);
}

/* EGIT */
static void
build_egit(GArray *table_data, BIOSLinker *linker, VirtMachineState *vms)
{
VirtMachineClass *vmc = VIRT_MACHINE_GET_CLASS(vms);

uint32_t irqflags = vmc->claim_edge_triggered_timers ?
1 : /* Interrupt is Edge triggered */
0; /* Interrupt is Level triggered */
AcpiTable table = { .sig = "EGIT", .rev = 3, .oem_id = vms->oem_id,
.oem_table_id = vms->oem_table_id };

acpi_table_begin(&table, table_data);

/* CntControlBase Physical Address */
build_append_int_noprefix(table_data, 0xFFFFFFFFFFFFFFFF, 8);
/*
* FIXME: clarify comment:
* The interrupt values are the same with the device tree when adding 16
*/
/* Secure EL1 timer GSIV */
build_append_int_noprefix(table_data, ARCH_TIMER_S_EL1_IRQ, 4);
/* Non-Secure EL1 timer GSIV */
build_append_int_noprefix(table_data, ARCH_TIMER_NS_EL1_IRQ, 4);
/* Virtual timer GSIV */
build_append_int_noprefix(table_data, ARCH_TIMER_VIRT_IRQ, 4);
/* Non-Secure EL2 timer GSIV */
build_append_int_noprefix(table_data, ARCH_TIMER_NS_EL2_IRQ, 4);
/* Secure EL1 timer Flags */
build_append_int_noprefix(table_data, irqflags, 4);
/* Non-Secure EL1 timer Flags */
build_append_int_noprefix(table_data, irqflags |
1UL << 2, /* Always-on Capability */
4);
/* Virtual Timer Flags */
build_append_int_noprefix(table_data, irqflags, 4);
/* Non-Secure EL2 timer Flags */
build_append_int_noprefix(table_data, irqflags, 4);

build_append_int_noprefix(table_data, 0, 4); /* Reserved */
acpi_table_end(linker, &table);
}

/*
* ACPI spec, Revision 6.5
* 5.2.25 Generic Timer Description Table (GTDT)
Expand Down Expand Up @@ -965,7 +1008,7 @@ void virt_acpi_build(VirtMachineState *vms, AcpiBuildTables *tables)
dsdt = tables_blob->len;
build_dsdt(tables_blob, tables->linker, vms);

/* FADT MADT PPTT GTDT MCFG SPCR DBG2 pointed to by RSDT */
/* FADT MADT PPTT EGIT GTDT MCFG SPCR DBG2 pointed to by RSDT */
acpi_add_table(table_offsets, tables_blob);
build_fadt_rev6(tables_blob, tables->linker, vms, dsdt);

Expand All @@ -978,6 +1021,9 @@ void virt_acpi_build(VirtMachineState *vms, AcpiBuildTables *tables)
vms->oem_id, vms->oem_table_id);
}

acpi_add_table(table_offsets, tables_blob);
build_egit(tables_blob, tables->linker, vms);

acpi_add_table(table_offsets, tables_blob);
build_gtdt(tables_blob, tables->linker, vms);

Expand Down

0 comments on commit ac66b8a

Please sign in to comment.