[PATCH] intel_txt: fix section warning messages from tboot when"allyesconfig" is set on i386

From: Wang, Shane
Date: Thu Mar 04 2010 - 00:31:15 EST


This patch is to fix the warning messages related to tboot when "allyesconfig" is set on i386.

Signed-off-by: Shane Wang <shane.wang@xxxxxxxxx>

arch/x86/kernel/tboot.c | 90 ++++++++++++++++----------------------
1 file changed, 40 insertions(+), 50 deletions(-)

diff -r d5d64753146c arch/x86/kernel/tboot.c
--- a/arch/x86/kernel/tboot.c Mon Mar 01 09:47:50 2010 -0500
+++ b/arch/x86/kernel/tboot.c Tue Mar 02 05:23:32 2010 -0500
@@ -55,6 +55,44 @@ struct tboot *tboot __read_mostly;

static u8 tboot_uuid[16] __initdata = TBOOT_UUID;

+#ifdef CONFIG_ACPI_SLEEP
+
+static void add_mac_region(phys_addr_t start, unsigned long size)
+{
+ struct tboot_mac_region *mr;
+ phys_addr_t end = start + size;
+
+ if (start && size) {
+ mr = &tboot->mac_regions[tboot->num_mac_regions++];
+ mr->start = round_down(start, PAGE_SIZE);
+ mr->size = round_up(end, PAGE_SIZE) - mr->start;
+ }
+}
+
+static void __init tboot_setup_sleep(void)
+{
+ tboot->num_mac_regions = 0;
+
+ /* S3 resume code */
+ add_mac_region(acpi_wakeup_address, WAKEUP_SIZE);
+
+#ifdef CONFIG_X86_TRAMPOLINE
+ /* AP trampoline code */
+ add_mac_region(virt_to_phys(trampoline_base), TRAMPOLINE_SIZE);
+#endif
+
+ /* kernel code + data + bss */
+ add_mac_region(virt_to_phys(_text), _end - _text);
+
+ tboot->acpi_sinfo.kernel_s3_resume_vector = acpi_wakeup_address;
+}
+
+#else /* no CONFIG_ACPI_SLEEP */
+
+static void tboot_setup_sleep(void) {}
+
+#endif
+
void __init tboot_probe(void)
{
/* Look for valid page-aligned address for shared page. */
@@ -98,6 +136,8 @@ void __init tboot_probe(void)
pr_debug("shutdown_entry: 0x%x\n", tboot->shutdown_entry);
pr_debug("tboot_base: 0x%08x\n", tboot->tboot_base);
pr_debug("tboot_size: 0x%x\n", tboot->tboot_size);
+
+ tboot_setup_sleep();
}

static pgd_t *tboot_pg_dir;
@@ -168,51 +208,6 @@ static void tboot_create_trampoline(void
map_base, map_size);
}

-#ifdef CONFIG_ACPI_SLEEP
-
-static void add_mac_region(phys_addr_t start, unsigned long size)
-{
- struct tboot_mac_region *mr;
- phys_addr_t end = start + size;
-
- if (start && size) {
- mr = &tboot->mac_regions[tboot->num_mac_regions++];
- mr->start = round_down(start, PAGE_SIZE);
- mr->size = round_up(end, PAGE_SIZE) - mr->start;
- }
-}
-
-static int tboot_setup_sleep(void)
-{
- tboot->num_mac_regions = 0;
-
- /* S3 resume code */
- add_mac_region(acpi_wakeup_address, WAKEUP_SIZE);
-
-#ifdef CONFIG_X86_TRAMPOLINE
- /* AP trampoline code */
- add_mac_region(virt_to_phys(trampoline_base), TRAMPOLINE_SIZE);
-#endif
-
- /* kernel code + data + bss */
- add_mac_region(virt_to_phys(_text), _end - _text);
-
- tboot->acpi_sinfo.kernel_s3_resume_vector = acpi_wakeup_address;
-
- return 0;
-}
-
-#else /* no CONFIG_ACPI_SLEEP */
-
-static int tboot_setup_sleep(void)
-{
- /* S3 shutdown requested, but S3 not supported by the kernel... */
- BUG();
- return -1;
-}
-
-#endif
-
void tboot_shutdown(u32 shutdown_type)
{
void (*shutdown)(void);
@@ -227,11 +222,6 @@ void tboot_shutdown(u32 shutdown_type)
*/
if (!tboot_pg_dir)
return;
-
- /* if this is S3 then set regions to MAC */
- if (shutdown_type == TB_SHUTDOWN_S3)
- if (tboot_setup_sleep())
- return;

tboot->shutdown_type = shutdown_type;

Attachment: fix_warning.patch
Description: fix_warning.patch