[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-changelog] [xen-unstable] ACPI: eliminate duplicate MADT parsing and unused SBF definitions
# HG changeset patch # User Jan Beulich <jbeulich@xxxxxxxx> # Date 1323773181 -3600 # Node ID c2ff4cb6663431d95bf5cacb1d214d137741d8b3 # Parent eea4fdb356bedf410e2e7dbe4428dbf5c4efc6f6 ACPI: eliminate duplicate MADT parsing and unused SBF definitions Use their proper counterparts in include/acpi/actbl*.h instead. Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx> Acked-by: Keir Fraser <keir@xxxxxxx> --- diff -r eea4fdb356be -r c2ff4cb66634 xen/arch/ia64/xen/dom_fw_common.c --- a/xen/arch/ia64/xen/dom_fw_common.c Tue Dec 13 11:38:57 2011 +0100 +++ b/xen/arch/ia64/xen/dom_fw_common.c Tue Dec 13 11:46:21 2011 +0100 @@ -347,7 +347,7 @@ struct acpi_table_header dsdt; uint8_t aml[8 + 11 * MAX_VIRT_CPUS]; struct acpi_table_madt madt; - struct acpi_table_lsapic lsapic[MAX_VIRT_CPUS]; + struct acpi_madt_local_sapic lsapic[MAX_VIRT_CPUS]; uint8_t pm1a_event_block[4]; uint8_t pm1a_control_block[1]; uint8_t pm_timer_block[4]; @@ -365,7 +365,7 @@ struct acpi_table_facs *facs = &tables->facs; struct acpi_table_header *dsdt = &tables->dsdt; struct acpi_table_madt *madt = &tables->madt; - struct acpi_table_lsapic *lsapic = tables->lsapic; + struct acpi_madt_local_sapic *lsapic = tables->lsapic; int i; int aml_len; int nbr_cpus; @@ -492,18 +492,18 @@ /* An LSAPIC entry describes a CPU. */ nbr_cpus = 0; for (i = 0; i < MAX_VIRT_CPUS; i++) { - lsapic[i].header.type = ACPI_MADT_LSAPIC; - lsapic[i].header.length = sizeof(struct acpi_table_lsapic); - lsapic[i].acpi_id = i; + lsapic[i].header.type = ACPI_MADT_TYPE_LOCAL_SAPIC; + lsapic[i].header.length = sizeof(lsapic[i]); + lsapic[i].processor_id = i; lsapic[i].id = i; lsapic[i].eid = 0; if (xen_ia64_is_vcpu_allocated(d, i)) { - lsapic[i].flags.enabled = 1; + lsapic[i].lapic_flags = ACPI_MADT_ENABLED; nbr_cpus++; } } madt->header.length = sizeof(struct acpi_table_madt) + - nbr_cpus * sizeof(struct acpi_table_lsapic); + nbr_cpus * sizeof(*lsapic); madt->header.checksum = -acpi_tb_checksum((u8*)madt, madt->header.length); return; diff -r eea4fdb356be -r c2ff4cb66634 xen/arch/ia64/xen/dom_fw_dom0.c --- a/xen/arch/ia64/xen/dom_fw_dom0.c Tue Dec 13 11:38:57 2011 +0100 +++ b/xen/arch/ia64/xen/dom_fw_dom0.c Tue Dec 13 11:46:21 2011 +0100 @@ -53,11 +53,11 @@ static int __init acpi_update_lsapic(struct acpi_subtable_header * header, const unsigned long end) { - struct acpi_table_lsapic *lsapic; + struct acpi_madt_local_sapic *lsapic = + container_of(header, struct acpi_madt_local_sapic, header); int enable; - lsapic = (struct acpi_table_lsapic *)header; - if (!lsapic) + if (!header) return -EINVAL; if (lsapic_nbr < dom0->max_vcpus && dom0->vcpu[lsapic_nbr] != NULL) @@ -65,14 +65,14 @@ else enable = 0; - if (lsapic->flags.enabled && enable) { + if ((lsapic->lapic_flags & ACPI_MADT_ENABLED) && enable) { printk("enable lsapic entry: 0x%lx\n", (u64) lsapic); lsapic->id = lsapic_nbr; lsapic->eid = 0; lsapic_nbr++; - } else if (lsapic->flags.enabled) { + } else if (lsapic->lapic_flags & ACPI_MADT_ENABLED) { printk("DISABLE lsapic entry: 0x%lx\n", (u64) lsapic); - lsapic->flags.enabled = 0; + lsapic->lapic_flags &= ~ACPI_MADT_ENABLED; lsapic->id = 0; lsapic->eid = 0; } @@ -83,10 +83,11 @@ acpi_patch_plat_int_src(struct acpi_subtable_header * header, const unsigned long end) { - struct acpi_table_plat_int_src *plintsrc; + struct acpi_madt_interrupt_source *plintsrc = + container_of(header, struct acpi_madt_interrupt_source, + header); - plintsrc = (struct acpi_table_plat_int_src *)header; - if (!plintsrc) + if (!header) return -EINVAL; if (plintsrc->type == ACPI_INTERRUPT_CPEI) { @@ -193,12 +194,13 @@ */ acpi_table_parse(ACPI_SIG_MADT, acpi_backup_table); - if (acpi_table_parse_madt(ACPI_MADT_LSAPIC, acpi_update_lsapic, 0) < 0) + if (acpi_table_parse_madt(ACPI_MADT_TYPE_LOCAL_SAPIC, + acpi_update_lsapic, 0) < 0) printk("Error parsing MADT - no LAPIC entries\n"); acpi_update_madt_checksum(madt); - if (acpi_table_parse_madt(ACPI_MADT_PLAT_INT_SRC, + if (acpi_table_parse_madt(ACPI_MADT_TYPE_INTERRUPT_SOURCE, acpi_patch_plat_int_src, 0) < 0) printk("Error parsing MADT - no PLAT_INT_SRC entries\n"); diff -r eea4fdb356be -r c2ff4cb66634 xen/arch/x86/acpi/boot.c --- a/xen/arch/x86/acpi/boot.c Tue Dec 13 11:38:57 2011 +0100 +++ b/xen/arch/x86/acpi/boot.c Tue Dec 13 11:46:21 2011 +0100 @@ -87,9 +87,9 @@ static int __init acpi_parse_x2apic(struct acpi_subtable_header *header, const unsigned long end) { - struct acpi_table_x2apic *processor = NULL; - - processor = (struct acpi_table_x2apic *)header; + struct acpi_madt_local_x2apic *processor = + container_of(header, struct acpi_madt_local_x2apic, header); + bool_t enabled = 0; if (BAD_MADT_ENTRY(processor, end)) return -EINVAL; @@ -97,8 +97,11 @@ acpi_table_print_madt_entry(header); /* Record local apic id only when enabled */ - if (processor->flags.enabled) - x86_acpiid_to_apicid[processor->acpi_uid] = processor->id; + if (processor->lapic_flags & ACPI_MADT_ENABLED) { + x86_acpiid_to_apicid[processor->uid] = + processor->local_apic_id; + enabled = 1; + } /* * We need to register disabled CPU as well to permit @@ -107,9 +110,7 @@ * to not preallocating memory for all NR_CPUS * when we use CPU hotplug. */ - mp_register_lapic(processor->id, /* X2APIC ID */ - processor->flags.enabled, /* Enabled? */ - 0); + mp_register_lapic(processor->local_apic_id, enabled, 0); return 0; } @@ -117,9 +118,9 @@ static int __init acpi_parse_lapic(struct acpi_subtable_header * header, const unsigned long end) { - struct acpi_table_lapic *processor = NULL; - - processor = (struct acpi_table_lapic *)header; + struct acpi_madt_local_apic *processor = + container_of(header, struct acpi_madt_local_apic, header); + bool_t enabled = 0; if (BAD_MADT_ENTRY(processor, end)) return -EINVAL; @@ -127,8 +128,10 @@ acpi_table_print_madt_entry(header); /* Record local apic id only when enabled */ - if (processor->flags.enabled) - x86_acpiid_to_apicid[processor->acpi_id] = processor->id; + if (processor->lapic_flags & ACPI_MADT_ENABLED) { + x86_acpiid_to_apicid[processor->processor_id] = processor->id; + enabled = 1; + } /* * We need to register disabled CPU as well to permit @@ -137,9 +140,7 @@ * to not preallocating memory for all NR_CPUS * when we use CPU hotplug. */ - mp_register_lapic(processor->id, /* APIC ID */ - processor->flags.enabled, /* Enabled? */ - 0); + mp_register_lapic(processor->id, enabled, 0); return 0; } @@ -148,9 +149,9 @@ acpi_parse_lapic_addr_ovr(struct acpi_subtable_header * header, const unsigned long end) { - struct acpi_table_lapic_addr_ovr *lapic_addr_ovr = NULL; - - lapic_addr_ovr = (struct acpi_table_lapic_addr_ovr *)header; + struct acpi_madt_local_apic_override *lapic_addr_ovr = + container_of(header, struct acpi_madt_local_apic_override, + header); if (BAD_MADT_ENTRY(lapic_addr_ovr, end)) return -EINVAL; @@ -164,9 +165,9 @@ acpi_parse_x2apic_nmi(struct acpi_subtable_header *header, const unsigned long end) { - struct acpi_table_x2apic_nmi *x2apic_nmi = NULL; - - x2apic_nmi = (struct acpi_table_x2apic_nmi *)header; + struct acpi_madt_local_x2apic_nmi *x2apic_nmi = + container_of(header, struct acpi_madt_local_x2apic_nmi, + header); if (BAD_MADT_ENTRY(x2apic_nmi, end)) return -EINVAL; @@ -182,9 +183,8 @@ static int __init acpi_parse_lapic_nmi(struct acpi_subtable_header * header, const unsigned long end) { - struct acpi_table_lapic_nmi *lapic_nmi = NULL; - - lapic_nmi = (struct acpi_table_lapic_nmi *)header; + struct acpi_madt_local_apic_nmi *lapic_nmi = + container_of(header, struct acpi_madt_local_apic_nmi, header); if (BAD_MADT_ENTRY(lapic_nmi, end)) return -EINVAL; @@ -204,9 +204,8 @@ static int __init acpi_parse_ioapic(struct acpi_subtable_header * header, const unsigned long end) { - struct acpi_table_ioapic *ioapic = NULL; - - ioapic = (struct acpi_table_ioapic *)header; + struct acpi_madt_io_apic *ioapic = + container_of(header, struct acpi_madt_io_apic, header); if (BAD_MADT_ENTRY(ioapic, end)) return -EINVAL; @@ -223,9 +222,9 @@ acpi_parse_int_src_ovr(struct acpi_subtable_header * header, const unsigned long end) { - struct acpi_table_int_src_ovr *intsrc = NULL; - - intsrc = (struct acpi_table_int_src_ovr *)header; + struct acpi_madt_interrupt_override *intsrc = + container_of(header, struct acpi_madt_interrupt_override, + header); if (BAD_MADT_ENTRY(intsrc, end)) return -EINVAL; @@ -233,14 +232,15 @@ acpi_table_print_madt_entry(header); if (acpi_skip_timer_override && - intsrc->bus_irq == 0 && intsrc->global_irq == 2) { + intsrc->source_irq == 0 && intsrc->global_irq == 2) { printk(PREFIX "BIOS IRQ0 pin2 override ignored.\n"); return 0; } - mp_override_legacy_irq(intsrc->bus_irq, - intsrc->flags.polarity, - intsrc->flags.trigger, intsrc->global_irq); + mp_override_legacy_irq(intsrc->source_irq, + ACPI_MADT_GET_POLARITY(intsrc->inti_flags), + ACPI_MADT_GET_TRIGGER(intsrc->inti_flags), + intsrc->global_irq); return 0; } @@ -248,9 +248,8 @@ static int __init acpi_parse_nmi_src(struct acpi_subtable_header * header, const unsigned long end) { - struct acpi_table_nmi_src *nmi_src = NULL; - - nmi_src = (struct acpi_table_nmi_src *)header; + struct acpi_madt_nmi_source *nmi_src = + container_of(header, struct acpi_madt_nmi_source, header); if (BAD_MADT_ENTRY(nmi_src, end)) return -EINVAL; @@ -270,7 +269,7 @@ { struct acpi_table_hpet *hpet_tbl = (struct acpi_table_hpet *)table; - if (hpet_tbl->address.space_id != ACPI_SPACE_MEM) { + if (hpet_tbl->address.space_id != ACPI_ADR_SPACE_SYSTEM_MEMORY) { printk(KERN_WARNING PREFIX "HPET timers must be located in " "memory.\n"); return -1; diff -r eea4fdb356be -r c2ff4cb66634 xen/arch/x86/srat.c --- a/xen/arch/x86/srat.c Tue Dec 13 11:38:57 2011 +0100 +++ b/xen/arch/x86/srat.c Tue Dec 13 11:46:21 2011 +0100 @@ -396,7 +396,8 @@ return; srat_region_mask = fill_mask(addr - 1); - acpi_table_parse_srat(ACPI_SRAT_MEMORY_AFFINITY, srat_parse_region, 0); + acpi_table_parse_srat(ACPI_SRAT_TYPE_MEMORY_AFFINITY, + srat_parse_region, 0); for (mask = srat_region_mask, i = 0; mask && i < e820.nr_map; i++) { if (e820.map[i].type != E820_RAM) diff -r eea4fdb356be -r c2ff4cb66634 xen/drivers/acpi/numa.c --- a/xen/drivers/acpi/numa.c Tue Dec 13 11:38:57 2011 +0100 +++ b/xen/drivers/acpi/numa.c Tue Dec 13 11:46:21 2011 +0100 @@ -46,7 +46,7 @@ switch (header->type) { - case ACPI_SRAT_PROCESSOR_AFFINITY: + case ACPI_SRAT_TYPE_CPU_AFFINITY: #ifdef ACPI_DEBUG_OUTPUT { struct acpi_srat_cpu_affinity *p = @@ -68,7 +68,7 @@ #endif /* ACPI_DEBUG_OUTPUT */ break; - case ACPI_SRAT_MEMORY_AFFINITY: + case ACPI_SRAT_TYPE_MEMORY_AFFINITY: #ifdef ACPI_DEBUG_OUTPUT { struct acpi_srat_mem_affinity *p = @@ -194,8 +194,8 @@ } int __init -acpi_table_parse_srat(enum acpi_srat_entry_id id, - acpi_madt_entry_handler handler, unsigned int max_entries) +acpi_table_parse_srat(int id, acpi_madt_entry_handler handler, + unsigned int max_entries) { return acpi_table_parse_entries(ACPI_SIG_SRAT, sizeof(struct acpi_table_srat), id, @@ -206,12 +206,13 @@ { /* SRAT: Static Resource Affinity Table */ if (!acpi_table_parse(ACPI_SIG_SRAT, acpi_parse_srat)) { - acpi_table_parse_srat(ACPI_SRAT_X2APIC_AFFINITY, - acpi_parse_x2apic_affinity, NR_CPUS); - acpi_table_parse_srat(ACPI_SRAT_PROCESSOR_AFFINITY, - acpi_parse_processor_affinity, - NR_CPUS); - acpi_table_parse_srat(ACPI_SRAT_MEMORY_AFFINITY, acpi_parse_memory_affinity, NR_NODE_MEMBLKS); // IA64 specific + acpi_table_parse_srat(ACPI_SRAT_TYPE_X2APIC_CPU_AFFINITY, + acpi_parse_x2apic_affinity, NR_CPUS); + acpi_table_parse_srat(ACPI_SRAT_TYPE_CPU_AFFINITY, + acpi_parse_processor_affinity, NR_CPUS); + acpi_table_parse_srat(ACPI_SRAT_TYPE_MEMORY_AFFINITY, + acpi_parse_memory_affinity, + NR_NODE_MEMBLKS); } /* SLIT: System Locality Information Table */ diff -r eea4fdb356be -r c2ff4cb66634 xen/include/xen/acpi.h --- a/xen/include/xen/acpi.h Tue Dec 13 11:38:57 2011 +0100 +++ b/xen/include/xen/acpi.h Tue Dec 13 11:46:21 2011 +0100 @@ -34,124 +34,14 @@ #include <acpi/acpi.h> #include <asm/acpi.h> +#define ACPI_MADT_GET_(fld, x) (((x) & ACPI_MADT_##fld##_MASK) / \ + (ACPI_MADT_##fld##_MASK & -ACPI_MADT_##fld##_MASK)) + +#define ACPI_MADT_GET_POLARITY(inti) ACPI_MADT_GET_(POLARITY, inti) +#define ACPI_MADT_GET_TRIGGER(inti) ACPI_MADT_GET_(TRIGGER, inti) + #ifdef CONFIG_ACPI_BOOT -enum acpi_madt_entry_id { - ACPI_MADT_LAPIC = 0, - ACPI_MADT_IOAPIC, - ACPI_MADT_INT_SRC_OVR, - ACPI_MADT_NMI_SRC, - ACPI_MADT_LAPIC_NMI, - ACPI_MADT_LAPIC_ADDR_OVR, - ACPI_MADT_IOSAPIC, - ACPI_MADT_LSAPIC, - ACPI_MADT_PLAT_INT_SRC, - ACPI_MADT_X2APIC, - ACPI_MADT_X2APIC_NMI, - ACPI_MADT_ENTRY_COUNT -}; - -typedef struct { - u16 polarity:2; - u16 trigger:2; - u16 reserved:12; -} __attribute__ ((packed)) acpi_interrupt_flags; - -struct acpi_table_lapic { - struct acpi_subtable_header header; - u8 acpi_id; - u8 id; - struct { - u32 enabled:1; - u32 reserved:31; - } flags; -} __attribute__ ((packed)); - -struct acpi_table_x2apic { - struct acpi_subtable_header header; - u16 reserved; - u32 id; - struct { - u32 enabled:1; - u32 reserved:31; - } flags; - u32 acpi_uid; -} __attribute__ ((packed)); - -struct acpi_table_ioapic { - struct acpi_subtable_header header; - u8 id; - u8 reserved; - u32 address; - u32 global_irq_base; -} __attribute__ ((packed)); - -struct acpi_table_int_src_ovr { - struct acpi_subtable_header header; - u8 bus; - u8 bus_irq; - u32 global_irq; - acpi_interrupt_flags flags; -} __attribute__ ((packed)); - -struct acpi_table_nmi_src { - struct acpi_subtable_header header; - acpi_interrupt_flags flags; - u32 global_irq; -} __attribute__ ((packed)); - -struct acpi_table_lapic_nmi { - struct acpi_subtable_header header; - u8 acpi_id; - acpi_interrupt_flags flags; - u8 lint; -} __attribute__ ((packed)); - -struct acpi_table_x2apic_nmi { - struct acpi_subtable_header header; - acpi_interrupt_flags flags; - u32 acpi_uid; - u8 lint; - u8 reserved[3]; -} __attribute__ ((packed)); - -struct acpi_table_lapic_addr_ovr { - struct acpi_subtable_header header; - u8 reserved[2]; - u64 address; -} __attribute__ ((packed)); - -struct acpi_table_iosapic { - struct acpi_subtable_header header; - u8 id; - u8 reserved; - u32 global_irq_base; - u64 address; -} __attribute__ ((packed)); - -struct acpi_table_lsapic { - struct acpi_subtable_header header; - u8 acpi_id; - u8 id; - u8 eid; - u8 reserved[3]; - struct { - u32 enabled:1; - u32 reserved:31; - } flags; -} __attribute__ ((packed)); - -struct acpi_table_plat_int_src { - struct acpi_subtable_header header; - acpi_interrupt_flags flags; - u8 type; /* See acpi_interrupt_type */ - u8 id; - u8 eid; - u8 iosapic_vector; - u32 global_irq; - u32 reserved; -} __attribute__ ((packed)); - enum acpi_interrupt_id { ACPI_INTERRUPT_PMI = 1, ACPI_INTERRUPT_INIT, @@ -159,42 +49,6 @@ ACPI_INTERRUPT_COUNT }; -#define ACPI_SPACE_MEM 0 - -/* - * Simple Boot Flags - * http://www.microsoft.com/whdc/hwdev/resources/specs/simp_bios.mspx - */ -struct acpi_table_sbf -{ - u8 sbf_signature[4]; - u32 sbf_len; - u8 sbf_revision; - u8 sbf_csum; - u8 sbf_oemid[6]; - u8 sbf_oemtable[8]; - u8 sbf_revdata[4]; - u8 sbf_creator[4]; - u8 sbf_crearev[4]; - u8 sbf_cmos; - u8 sbf_spare[3]; -} __attribute__ ((packed)); - -enum acpi_srat_entry_id { - ACPI_SRAT_PROCESSOR_AFFINITY = 0, - ACPI_SRAT_MEMORY_AFFINITY, - ACPI_SRAT_X2APIC_AFFINITY, - ACPI_SRAT_ENTRY_COUNT -}; - -enum acpi_address_range_id { - ACPI_ADDRESS_RANGE_MEMORY = 1, - ACPI_ADDRESS_RANGE_RESERVED = 2, - ACPI_ADDRESS_RANGE_ACPI = 3, - ACPI_ADDRESS_RANGE_NVS = 4, - ACPI_ADDRESS_RANGE_COUNT -}; - /* DMA Remapping Reporting Table (DMAR) */ #define DMAR_FLAGS_INTR_REMAP 0x1 /* intr remap supported */ @@ -282,8 +136,8 @@ int acpi_table_parse_entries(char *id, unsigned long table_size, int entry_id, acpi_table_entry_handler handler, unsigned int max_entries); int acpi_table_parse_madt(enum acpi_madt_type id, acpi_table_entry_handler handler, unsigned int max_entries); -int acpi_table_parse_srat(enum acpi_srat_entry_id id, - acpi_madt_entry_handler handler, unsigned int max_entries); +int acpi_table_parse_srat(int id, acpi_madt_entry_handler handler, + unsigned int max_entries); int acpi_parse_srat(struct acpi_table_header *); void acpi_table_print (struct acpi_table_header *header, unsigned long phys_addr); void acpi_table_print_madt_entry (struct acpi_subtable_header *madt); _______________________________________________ Xen-changelog mailing list Xen-changelog@xxxxxxxxxxxxxxxxxxx http://lists.xensource.com/xen-changelog
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |