Skip to contentSkip to conversation

x86: apic_32.c - add lapic resource

PATCH Applied Cyrill Gorcunov 2 participants 2 messages Jul 1, 2008 – Jul 9, 2008 x86

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 x86: apic_32.c - add lapic resource

Add lapic resource into kernel resource map and mark it as busy

CC Maciej W. Rozycki <[email protected]>

---

I've started to unify apic code but it will require a huge amount of time and will not be done soon but this patch is usefull even now I think.

Any comments are _quite__welcome_.

The patch is on top of

	commit ccbb46cbe2993e6b23244b53a5d2791c71d134f5
	Author: Ingo Molnar <[email protected]>
	Date:   Fri Jun 27 19:55:22 2008 +0200

	    stacktrace: export print_stack_trace and save_stack_trace
arch/x86/kernel/apic_32.c +23 -0
Index: linux-2.6.git/arch/x86/kernel/apic_32.c
====================================================================
@@ -81,6 +81,11 @@ int pic_mode;
 /* Have we found an MP table */
 int smp_found_config;
 
+static struct resource lapic_resource = {
+	.name = "Local APIC",
+	.flags = IORESOURCE_MEM | IORESOURCE_BUSY,
+};
+
 static unsigned int calibration_result;
 
 static int lapic_next_event(unsigned long delta,
@@ -1754,3 +1759,21 @@ static int __init apic_set_verbosity(cha
 }
 __setup("apic=", apic_set_verbosity);
 
+static int __init lapic_insert_resource(void)
+{
+	if (!apic_phys)
+		return -1;
+
+	/* Put local APIC into the resource map. */
+	lapic_resource.start = apic_phys;
+	lapic_resource.end = lapic_resource.start + PAGE_SIZE - 1;
+	insert_resource(&iomem_resource, &lapic_resource);
+
+	return 0;
+}
+
+/*
+ * need call insert after e820_reserve_resources()
+ * that is using request_resource
+ */
+late_initcall(lapic_insert_resource);
Applied
#1 lore raw
Quoted 1 line · Cyrill Gorcunov

Add lapic resource into kernel resource map and mark it as busy

applied to tip/x86/core, thanks Cyrill.

Quoted 3 lines

I've started to unify apic code but it will require a huge amount of time and will not be done soon but this patch is usefull even now I think.

agreed, unifying the apic code is quite non-trivial.

Ingo