[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-devel] [PATCH RFC 07/13] xen: implement IO APIC support in Xen mptable parser



Use madt_setup_io (from madt.c) on Xen apic_enumerator, in order to
parse the interrupt sources from the IO APIC.

I would like to get opinions, but I think we should rename and move
madt_setup_io to io_apic.c.
---
 sys/amd64/include/apicvar.h |    1 +
 sys/i386/include/apicvar.h  |    1 +
 sys/x86/acpica/madt.c       |    5 ++---
 sys/x86/xen/mptable.c       |   24 +++++++++++++++++++++++-
 4 files changed, 27 insertions(+), 4 deletions(-)

diff --git a/sys/amd64/include/apicvar.h b/sys/amd64/include/apicvar.h
index a48a76b..3974067 100644
--- a/sys/amd64/include/apicvar.h
+++ b/sys/amd64/include/apicvar.h
@@ -233,6 +233,7 @@ int lapic_set_lvt_triggermode(u_int apic_id, u_int lvt,
 void   lapic_set_tpr(u_int vector);
 void   lapic_setup(int boot);
 void   xen_intr_handle_upcall(struct trapframe *frame);
+int    madt_setup_io(void);
 
 #endif /* !LOCORE */
 #endif /* _MACHINE_APICVAR_H_ */
diff --git a/sys/i386/include/apicvar.h b/sys/i386/include/apicvar.h
index c8ee9bc..05ec013 100644
--- a/sys/i386/include/apicvar.h
+++ b/sys/i386/include/apicvar.h
@@ -232,6 +232,7 @@ int lapic_set_lvt_triggermode(u_int apic_id, u_int lvt,
 void   lapic_set_tpr(u_int vector);
 void   lapic_setup(int boot);
 void   xen_intr_handle_upcall(struct trapframe *frame);
+int    madt_setup_io(void);
 
 #endif /* !LOCORE */
 #endif /* _MACHINE_APICVAR_H_ */
diff --git a/sys/x86/acpica/madt.c b/sys/x86/acpica/madt.c
index 5929fde..6f3b591 100644
--- a/sys/x86/acpica/madt.c
+++ b/sys/x86/acpica/madt.c
@@ -61,7 +61,7 @@ static struct lapic_info {
 } lapics[MAX_APIC_ID + 1];
 
 static int madt_found_sci_override;
-static ACPI_TABLE_MADT *madt;
+ACPI_TABLE_MADT *madt;
 static vm_paddr_t madt_physaddr;
 static vm_offset_t madt_length;
 
@@ -84,7 +84,6 @@ static void   madt_probe_cpus_handler(ACPI_SUBTABLE_HEADER 
*entry,
                    void *arg __unused);
 static void    madt_register(void *dummy);
 static int     madt_setup_local(void);
-static int     madt_setup_io(void);
 static void    madt_walk_table(acpi_subtable_handler *handler, void *arg);
 
 static struct apic_enumerator madt_enumerator = {
@@ -147,7 +146,7 @@ madt_setup_local(void)
 /*
  * Enumerate I/O APICs and setup interrupt sources.
  */
-static int
+int
 madt_setup_io(void)
 {
        void *ioapic;
diff --git a/sys/x86/xen/mptable.c b/sys/x86/xen/mptable.c
index 0384886..46b03f3 100644
--- a/sys/x86/xen/mptable.c
+++ b/sys/x86/xen/mptable.c
@@ -43,6 +43,9 @@ __FBSDID("$FreeBSD$");
 #include <machine/intr_machdep.h>
 #include <machine/apicvar.h>
 
+#include <contrib/dev/acpica/include/acpi.h>
+#include <contrib/dev/acpica/include/actables.h>
+
 #include <machine/cpu.h>
 #include <machine/smp.h>
 
@@ -51,6 +54,9 @@ __FBSDID("$FreeBSD$");
 
 #include <xen/interface/vcpu.h>
 
+/* From madt.c */
+extern ACPI_TABLE_MADT *madt;
+
 static int xenpv_probe(void);
 static int xenpv_probe_cpus(void);
 static int xenpv_setup_local(void);
@@ -107,7 +113,23 @@ xenpv_setup_local(void)
 static int
 xenpv_setup_io(void)
 {
-       return (0);
+       vm_paddr_t madt_physaddr;
+       vm_offset_t madt_length;
+
+       if (!xen_initial_domain())
+               return (0);
+
+       madt_physaddr = acpi_find_table(ACPI_SIG_MADT);
+       if (madt_physaddr == 0)
+               panic("could not find MADT table");
+       madt = acpi_map_table(madt_physaddr, ACPI_SIG_MADT);
+       if (madt == NULL)
+               panic("unable to map MADT");
+       madt_length = madt->Header.Length;
+       acpi_unmap_table(madt);
+       madt = pmap_mapbios(madt_physaddr, madt_length);
+
+       return (madt_setup_io());
 }
 
 static void
-- 
1.7.7.5 (Apple Git-26)


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.