Received: from eggs.gnu.org ([208.118.235.92]:42821) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Sogwo-00057L-FN for qemu-devel@nongnu.org; Tue, 10 Jul 2012 16:22:18 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Sogwh-0001uT-2T for qemu-devel@nongnu.org; Tue, 10 Jul 2012 16:22:14 -0400 Received: from mx1.redhat.com ([209.132.183.28]:33153) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Sogwg-0001ti-QO for qemu-devel@nongnu.org; Tue, 10 Jul 2012 16:22:06 -0400 From: Eduardo Habkost Date: Tue, 10 Jul 2012 17:22:20 -0300 Message-Id: <1341951743-2285-6-git-send-email-ehabkost@redhat.com> In-Reply-To: <1341951743-2285-1-git-send-email-ehabkost@redhat.com> References: <1341951743-2285-1-git-send-email-ehabkost@redhat.com> Subject: [Qemu-devel] [QEMU RFC PATCH 5/7] pc: write lapic info (apic IDs) to fw_cfg so seabios can use it List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Igor Mammedov , seabios@seabios.org, Gleb Natapov , Anthony Liguori Signed-off-by: Eduardo Habkost --- hw/pc.c | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/hw/pc.c b/hw/pc.c index 3b8e469..dc95fb8 100644 --- a/hw/pc.c +++ b/hw/pc.c @@ -71,6 +71,7 @@ #define FW_CFG_IRQ0_OVERRIDE (FW_CFG_ARCH_LOCAL + 2) #define FW_CFG_E820_TABLE (FW_CFG_ARCH_LOCAL + 3) #define FW_CFG_HPET (FW_CFG_ARCH_LOCAL + 4) +#define FW_CFG_LAPIC_INFO (FW_CFG_ARCH_LOCAL + 5) #define MSI_ADDR_BASE 0xfee00000 @@ -87,6 +88,18 @@ struct e820_table { struct e820_entry entry[E820_NR_ENTRIES]; } QEMU_PACKED __attribute((__aligned__(4))); +struct lapic_info_entry { + uint8_t apic_id; + uint8_t reserved1; + uint16_t reserved2; + uint32_t reserved3; +} QEMU_PACKED; + +struct lapic_info_table { + uint64_t count; + struct lapic_info_entry entries[]; +} QEMU_PACKED; + static struct e820_table e820_table; struct hpet_fw_config hpet_cfg = {.count = UINT8_MAX}; @@ -652,6 +665,16 @@ static void *bochs_bios_init(void) fw_cfg_add_bytes(fw_cfg, FW_CFG_NUMA, (uint8_t *)numa_fw_cfg, (1 + max_cpus + nb_numa_nodes) * 8); + size_t lapic_info_size = sizeof(struct lapic_info_table) + \ + sizeof(struct lapic_info_entry) * max_cpus; + struct lapic_info_table *lapic_table = g_malloc0(lapic_info_size);; + lapic_table->count = max_cpus; + for (i = 0; i < max_cpus; i++) { + lapic_table->entries[i].apic_id = apic_id_for_cpu(i); + } + fw_cfg_add_bytes(fw_cfg, FW_CFG_LAPIC_INFO, (uint8_t *)lapic_table, + lapic_info_size); + return fw_cfg; } -- 1.7.10.4