2009-06-26 00:14:59

by Jacob Pan

[permalink] [raw]
Subject: [PATCH 5/9] x86: make use of platform flags in setup code

>From 7b51bf39f69dc9b2adc84113d76033facb9557bd Mon Sep 17 00:00:00 2001
From: Jacob Pan <[email protected]>
Date: Thu, 11 Jun 2009 20:48:54 -0700
Subject: [PATCH] x86: make use of platform flags in setup code

This patch uses platform feature flags to selectively perform platform
initialization. e.g. avoid reserve resources if certain feature is not
found.

Signed-off-by: Jacob Pan <[email protected]>
---
arch/x86/kernel/head32.c | 6 +++++-
arch/x86/kernel/setup.c | 12 ++++++++----
2 files changed, 13 insertions(+), 5 deletions(-)

diff --git a/arch/x86/kernel/head32.c b/arch/x86/kernel/head32.c
index 3f8579f..0989f5e 100644
--- a/arch/x86/kernel/head32.c
+++ b/arch/x86/kernel/head32.c
@@ -13,6 +13,8 @@
#include <asm/e820.h>
#include <asm/bios_ebda.h>
#include <asm/trampoline.h>
+#include <asm/bootparam.h>
+#include <asm/platform_feature.h>

void __init i386_start_kernel(void)
{
@@ -29,7 +31,9 @@ void __init i386_start_kernel(void)
reserve_early(ramdisk_image, ramdisk_end, "RAMDISK");
}
#endif
- reserve_ebda_region();
+
+ if (platform_has(X86_PLATFORM_FEATURE_BIOS))
+ reserve_ebda_region();

/*
* At this point everything still needed from the boot loader
diff --git a/arch/x86/kernel/setup.c b/arch/x86/kernel/setup.c
index be5ae80..1a5ef7b 100644
--- a/arch/x86/kernel/setup.c
+++ b/arch/x86/kernel/setup.c
@@ -88,6 +88,7 @@
#include <asm/processor.h>
#include <asm/bugs.h>

+#include <asm/platform_feature.h>
#include <asm/system.h>
#include <asm/vsyscall.h>
#include <asm/cpu.h>
@@ -731,7 +732,7 @@ void __init setup_arch(char **cmdline_p)
#endif

ARCH_SETUP
-
+ platform_feature_init_default(boot_params.hdr.hardware_subarch);
setup_memory_map();
parse_setup_data();
/* update the e820_saved too */
@@ -809,7 +810,8 @@ void __init setup_arch(char **cmdline_p)
init_hypervisor(&boot_cpu_data);

#ifdef CONFIG_X86_32
- probe_roms();
+ if (platform_has(X86_PLATFORM_FEATURE_BIOS))
+ probe_roms();
#endif

/* after parse_early_param, so could debug it */
@@ -987,9 +989,11 @@ void __init setup_arch(char **cmdline_p)
e820_mark_nosave_regions(max_low_pfn);

#ifdef CONFIG_X86_32
- request_resource(&iomem_resource, &video_ram_resource);
+ if (platform_has(X86_PLATFORM_FEATURE_BIOS))
+ request_resource(&iomem_resource, &video_ram_resource);
#endif
- reserve_standard_io_resources();
+ if (platform_has(X86_PLATFORM_FEATURE_ISA))
+ reserve_standard_io_resources();

e820_setup_gap();

--
1.5.6.5