[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] [RFC Patch v4 3/8] xl/acpi: unify the computation of lapic_id
There were two places where the lapic_id is computed, one in hvmloader and one in libacpi. Unify them by defining LAPIC_ID in a header file and incluing it in both places. To address compilation issue and make libacpi.h self-contained, include stdint.h in libacpi.h. Signed-off-by: Chao Gao <chao.gao@xxxxxxxxx> --- v4: - new --- tools/firmware/hvmloader/config.h | 3 +-- tools/libacpi/libacpi.h | 3 +++ tools/libxl/libxl_x86_acpi.c | 2 +- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/tools/firmware/hvmloader/config.h b/tools/firmware/hvmloader/config.h index 6e00413..55e3a27 100644 --- a/tools/firmware/hvmloader/config.h +++ b/tools/firmware/hvmloader/config.h @@ -1,7 +1,7 @@ #ifndef __HVMLOADER_CONFIG_H__ #define __HVMLOADER_CONFIG_H__ -#include <stdint.h> +#include <libacpi.h> enum virtual_vga { VGA_none, VGA_std, VGA_cirrus, VGA_pt }; extern enum virtual_vga virtual_vga; @@ -48,7 +48,6 @@ extern uint8_t ioapic_version; #define IOAPIC_ID 0x01 #define LAPIC_BASE_ADDRESS 0xfee00000 -#define LAPIC_ID(vcpu_id) ((vcpu_id) * 2) #define PCI_ISA_DEVFN 0x08 /* dev 1, fn 0 */ #define PCI_ISA_IRQ_MASK 0x0c20U /* ISA IRQs 5,10,11 are PCI connected */ diff --git a/tools/libacpi/libacpi.h b/tools/libacpi/libacpi.h index 46a819d..b89fdb5 100644 --- a/tools/libacpi/libacpi.h +++ b/tools/libacpi/libacpi.h @@ -21,6 +21,9 @@ #define __LIBACPI_H__ #include <stdbool.h> +#include <stdint.h> /* uintXX_t */ + +#define LAPIC_ID(vcpu_id) ((vcpu_id) * 2) #define ACPI_HAS_COM1 (1<<0) #define ACPI_HAS_COM2 (1<<1) diff --git a/tools/libxl/libxl_x86_acpi.c b/tools/libxl/libxl_x86_acpi.c index bbe9219..0b7507d 100644 --- a/tools/libxl/libxl_x86_acpi.c +++ b/tools/libxl/libxl_x86_acpi.c @@ -87,7 +87,7 @@ static void acpi_mem_free(struct acpi_ctxt *ctxt, static uint32_t acpi_lapic_id(unsigned cpu) { - return cpu * 2; + return LAPIC_ID(cpu); } static int init_acpi_config(libxl__gc *gc, -- 1.8.3.1 _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxxxxxxxxx https://lists.xenproject.org/mailman/listinfo/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |