Skip to contentSkip to conversation

Split ACPI boot table parsing

PATCH New Andreas Kleen 1 participant 1 message Nov 25, 2004 ACPI

lore
Share & tools
lore
#0 lore raw

PATCH 1/34 Split ACPI boot table parsing

Split ACPI boot table parsing

Split ACPI boot table parsing into two parts. First a acpi_boot_table_init() call that initializes the basic ACPI table parsing machinery and discovers the RSDP, and then another call to actually parse the various boot tables.

This is needed for a followon patch that implements SRAT support, because nodes need to be set up before the other ACPI tables can be parsed.

On x86-64 I moved the early initialization very early because that is needed for the SRAT parser.

On i386 it should be a nop.

arch/x86_64/kernel/setup.c +14 -7
Index: linux/arch/x86_64/kernel/setup.c
===================================================================
@@ -486,6 +486,14 @@
 
 	init_memory_mapping(); 
 
+#ifdef CONFIG_ACPI_BOOT
+	/*
+	 * Initialize the ACPI boot-time table parser (gets the RSDP and SDT).
+	 * Call this early for SRAT node setup.
+	 */
+	acpi_boot_table_init();
+#endif
+
 #ifdef CONFIG_DISCONTIGMEM
 	numa_initmem_init(0, end_pfn); 
 #else
@@ -552,16 +560,15 @@
 #endif
 	paging_init();
 
-		check_ioapic();
+	check_ioapic();
+
 #ifdef CONFIG_ACPI_BOOT
-       /*
-        * Initialize the ACPI boot-time table parser (gets the RSDP and SDT).
-        * Must do this after paging_init (due to reliance on fixmap, and thus
-        * the bootmem allocator) but before get_smp_config (to allow parsing
-        * of MADT).
-        */
+	/* 
+	 * Read APIC and some other early information from ACPI tables.
+	 */ 
 	acpi_boot_init();
 #endif
+
 #ifdef CONFIG_X86_LOCAL_APIC
 	/*
 	 * get boot-time SMP configuration:
include/linux/acpi.h +7 -0
Index: linux/include/linux/acpi.h
===================================================================
@@ -379,6 +379,7 @@
 char * __acpi_map_table (unsigned long phys_addr, unsigned long size);
 unsigned long acpi_find_rsdp (void);
 int acpi_boot_init (void);
+int acpi_boot_table_init (void);
 int acpi_numa_init (void);
 
 int acpi_table_init (void);
@@ -411,6 +412,12 @@
 	return 0;
 }
 
+
+static inline int acpi_table_init(void)
+{
+	return 0;
+}
+
 #endif 	/*!CONFIG_ACPI_BOOT*/
 
 unsigned int acpi_register_gsi (u32 gsi, int edge_level, int active_high_low);
arch/i386/kernel/setup.c +1 -0
Index: linux/arch/i386/kernel/setup.c
===================================================================
@@ -1404,6 +1404,7 @@
 	/*
 	 * Parse the ACPI tables for possible boot-time SMP configuration.
 	 */
+	acpi_boot_table_init();
 	acpi_boot_init();
 
 #ifdef CONFIG_X86_LOCAL_APIC
arch/i386/kernel/acpi/boot.c +21 -5
Index: linux/arch/i386/kernel/acpi/boot.c
===================================================================
@@ -778,13 +778,16 @@
 }
 
 /*
- * acpi_boot_init()
+ * acpi_boot_table_init() and acpi_boot_init()
  *  called from setup_arch(), always.
  *	1. checksums all tables
  *	2. enumerates lapics
  *	3. enumerates io-apics
  *
- * side effects:
+ * acpi_table_init() is separate to allow reading SRAT without
+ * other side effects.
+ *
+ * side effects of acpi_boot_init:
  *	acpi_lapic = 1 if LAPIC found
  *	acpi_ioapic = 1 if IOAPIC found
  *	if (acpi_lapic && acpi_ioapic) smp_found_config = 1;
@@ -798,7 +801,7 @@
  */
 
 int __init
-acpi_boot_init (void)
+acpi_boot_table_init (void)
 {
 	int error;
 
@@ -818,8 +821,6 @@
 		return error;
 	}
 
-	acpi_table_parse(ACPI_BOOT, acpi_parse_sbf);
-
 	/*
 	 * blacklist may disable ACPI entirely
 	 */
@@ -836,6 +837,21 @@
 		}
 	}
 
+	return 0;
+}
+
+
+int __init acpi_boot_init(void)
+{
+	/*
+	 * If acpi_disabled, bail out
+	 * One exception: acpi=ht continues far enough to enumerate LAPICs
+	 */
+	if (acpi_disabled && !acpi_ht)
+		 return 1;
+
+	acpi_table_parse(ACPI_BOOT, acpi_parse_sbf);
+
 	/*
 	 * set sci_int and PM timer address
 	 */

-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users. Discover which products truly live up to the hype. Start reading now.
http://productguide.itmanagersjournal.com/