WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

[Xen-devel] [PATCH 6/7] x86/ACPI: __init-annotate

To: "xen-devel@xxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxx>
Subject: [Xen-devel] [PATCH 6/7] x86/ACPI: __init-annotate
From: "Jan Beulich" <JBeulich@xxxxxxxxxx>
Date: Thu, 31 Mar 2011 16:57:06 +0100
Delivery-date: Thu, 31 Mar 2011 09:03:59 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
xen/arch/x86/acpi/boot.c consists of almost only code/data in .init.*,
so move the few bits that aren't into a new file and then use the
recently introduced .init.o mechanism to move all the literal strings
into .init.rodata.

Signed-off-by: Jan Beulich <jbeulich@xxxxxxxxxx>

--- a/xen/arch/x86/acpi/Makefile
+++ b/xen/arch/x86/acpi/Makefile
@@ -1,4 +1,4 @@
 subdir-y += cpufreq
 
-obj-y += boot.o power.o suspend.o cpu_idle.o cpuidle_menu.o
-obj-bin-y += wakeup_prot.o
+obj-y += lib.o power.o suspend.o cpu_idle.o cpuidle_menu.o
+obj-bin-y += boot.init.o wakeup_prot.o
--- a/xen/arch/x86/acpi/boot.c
+++ b/xen/arch/x86/acpi/boot.c
@@ -69,58 +69,10 @@ bool_t acpi_skip_timer_override __initda
 static u64 acpi_lapic_addr __initdata = APIC_DEFAULT_PHYS_BASE;
 #endif
 
-u32 __read_mostly acpi_smi_cmd;
-u8 __read_mostly acpi_enable_value;
-u8 __read_mostly acpi_disable_value;
-
-u32 __read_mostly x86_acpiid_to_apicid[MAX_MADT_ENTRIES] =
-    {[0 ... MAX_MADT_ENTRIES - 1] = BAD_APICID };
-
 /* --------------------------------------------------------------------------
                               Boot-time Configuration
    -------------------------------------------------------------------------- 
*/
 
-/*
- * Temporarily use the virtual area starting from FIX_IO_APIC_BASE_END,
- * to map the target physical address. The problem is that set_fixmap()
- * provides a single page, and it is possible that the page is not
- * sufficient.
- * By using this area, we can map up to MAX_IO_APICS pages temporarily,
- * i.e. until the next __va_range() call.
- *
- * Important Safety Note:  The fixed I/O APIC page numbers are *subtracted*
- * from the fixed base.  That's why we start at FIX_IO_APIC_BASE_END and
- * count idx down while incrementing the phys address.
- */
-char *__acpi_map_table(unsigned long phys, unsigned long size)
-{
-       unsigned long base, offset, mapped_size;
-       int idx;
-
-       /* XEN: RAM holes above 1MB are not permanently mapped. */
-       if ((phys + size) <= (1 * 1024 * 1024))
-               return __va(phys);
-
-       offset = phys & (PAGE_SIZE - 1);
-       mapped_size = PAGE_SIZE - offset;
-       set_fixmap(FIX_ACPI_END, phys);
-       base = fix_to_virt(FIX_ACPI_END);
-
-       /*
-        * Most cases can be covered by the below.
-        */
-       idx = FIX_ACPI_END;
-       while (mapped_size < size) {
-               if (--idx < FIX_ACPI_BEGIN)
-                       return NULL;    /* cannot handle this */
-               phys += PAGE_SIZE;
-               set_fixmap(idx, phys);
-               mapped_size += PAGE_SIZE;
-       }
-
-       return ((char *) base + offset);
-}
-
 #ifdef CONFIG_X86_LOCAL_APIC
 static int __init acpi_parse_madt(struct acpi_table_header *table)
 {
@@ -927,17 +879,3 @@ int __init acpi_boot_init(void)
 
        return 0;
 }
-
-unsigned int acpi_get_processor_id(unsigned int cpu)
-{
-       unsigned int acpiid, apicid;
-
-       if ((apicid = x86_cpu_to_apicid[cpu]) == BAD_APICID)
-               return INVALID_ACPIID;
-
-       for (acpiid = 0; acpiid < ARRAY_SIZE(x86_acpiid_to_apicid); acpiid++)
-               if (x86_acpiid_to_apicid[acpiid] == apicid)
-                       return acpiid;
-
-       return INVALID_ACPIID;
-}
--- /dev/null
+++ b/xen/arch/x86/acpi/lib.c
@@ -0,0 +1,83 @@
+/*
+ *  lib.c - Architecture-Specific Low-Level ACPI Support
+ *
+ * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ *
+ * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ */
+
+#include <xen/config.h>
+#include <xen/errno.h>
+#include <xen/init.h>
+#include <xen/acpi.h>
+#include <asm/apic.h>
+#include <asm/fixmap.h>
+
+u32 __read_mostly acpi_smi_cmd;
+u8 __read_mostly acpi_enable_value;
+u8 __read_mostly acpi_disable_value;
+
+u32 __read_mostly x86_acpiid_to_apicid[MAX_MADT_ENTRIES] =
+    {[0 ... MAX_MADT_ENTRIES - 1] = BAD_APICID };
+
+/*
+ * Important Safety Note:  The fixed ACPI page numbers are *subtracted*
+ * from the fixed base.  That's why we start at FIX_ACPI_END and
+ * count idx down while incrementing the phys address.
+ */
+char *__acpi_map_table(unsigned long phys, unsigned long size)
+{
+       unsigned long base, offset, mapped_size;
+       int idx;
+
+       /* XEN: RAM holes above 1MB are not permanently mapped. */
+       if ((phys + size) <= (1 * 1024 * 1024))
+               return __va(phys);
+
+       offset = phys & (PAGE_SIZE - 1);
+       mapped_size = PAGE_SIZE - offset;
+       set_fixmap(FIX_ACPI_END, phys);
+       base = fix_to_virt(FIX_ACPI_END);
+
+       /*
+        * Most cases can be covered by the below.
+        */
+       idx = FIX_ACPI_END;
+       while (mapped_size < size) {
+               if (--idx < FIX_ACPI_BEGIN)
+                       return NULL;    /* cannot handle this */
+               phys += PAGE_SIZE;
+               set_fixmap(idx, phys);
+               mapped_size += PAGE_SIZE;
+       }
+
+       return ((char *) base + offset);
+}
+
+unsigned int acpi_get_processor_id(unsigned int cpu)
+{
+       unsigned int acpiid, apicid;
+
+       if ((apicid = x86_cpu_to_apicid[cpu]) == BAD_APICID)
+               return INVALID_ACPIID;
+
+       for (acpiid = 0; acpiid < ARRAY_SIZE(x86_acpiid_to_apicid); acpiid++)
+               if (x86_acpiid_to_apicid[acpiid] == apicid)
+                       return acpiid;
+
+       return INVALID_ACPIID;
+}
--- a/xen/drivers/acpi/tables/Makefile
+++ b/xen/drivers/acpi/tables/Makefile
@@ -1,5 +1,5 @@
-obj-y += tbfadt.o
-obj-y += tbinstal.o
+obj-bin-y += tbfadt.init.o
+obj-bin-y += tbinstal.init.o
 obj-y += tbutils.o
-obj-y += tbxface.o
-obj-y += tbxfroot.o
+obj-bin-y += tbxface.init.o
+obj-bin-y += tbxfroot.init.o
--- a/xen/drivers/acpi/tables/tbxface.c
+++ b/xen/drivers/acpi/tables/tbxface.c
@@ -67,7 +67,8 @@ ACPI_MODULE_NAME("tbxface")
 acpi_status __init acpi_allocate_root_table(u32 initial_table_count)
 {
 
-       acpi_gbl_root_table_list.size = initial_table_count;
+       acpi_gbl_root_table_list.size = initial_table_count -
+                                       ACPI_ROOT_TABLE_SIZE_INCREMENT;
        acpi_gbl_root_table_list.flags = ACPI_ROOT_ALLOW_RESIZE;
 
        return (acpi_tb_resize_root_table_list());
--- a/xen/drivers/acpi/utilities/Makefile
+++ b/xen/drivers/acpi/utilities/Makefile
@@ -1,2 +1,2 @@
 obj-y += utglobal.o
-obj-y += utmisc.o
+obj-bin-y += utmisc.init.o
--- a/xen/drivers/acpi/utilities/utmisc.c
+++ b/xen/drivers/acpi/utilities/utmisc.c
@@ -135,7 +135,7 @@ const char *__init acpi_ut_validate_exce
  
******************************************************************************/
 
 void ACPI_INTERNAL_VAR_XFACE __init
-acpi_ut_error(char *module_name, u32 line_number, char *format, ...)
+acpi_ut_error(const char *module_name, u32 line_number, char *format, ...)
 {
        va_list args;
 
@@ -148,7 +148,7 @@ acpi_ut_error(char *module_name, u32 lin
 }
 
 void ACPI_INTERNAL_VAR_XFACE __init
-acpi_ut_warning(char *module_name, u32 line_number, char *format, ...)
+acpi_ut_warning(const char *module_name, u32 line_number, char *format, ...)
 {
        va_list args;
 
@@ -162,7 +162,7 @@ acpi_ut_warning(char *module_name, u32 l
 }
 
 void ACPI_INTERNAL_VAR_XFACE __init
-acpi_ut_info(char *module_name, u32 line_number, char *format, ...)
+acpi_ut_info(const char *module_name, u32 line_number, char *format, ...)
 {
        va_list args;
 
--- a/xen/include/acpi/acmacros.h
+++ b/xen/include/acpi/acmacros.h
@@ -413,7 +413,7 @@
  * error messages. The __FILE__ macro is not very useful for this, because it
  * often includes the entire pathname to the module
  */
-#define ACPI_MODULE_NAME(name)          static char ACPI_UNUSED_VAR 
*_acpi_module_name = name;
+#define ACPI_MODULE_NAME(name)          static const char ACPI_UNUSED_VAR 
_acpi_module_name[] = name;
 #else
 #define ACPI_MODULE_NAME(name)
 #endif
--- a/xen/include/acpi/acutils.h
+++ b/xen/include/acpi/acutils.h
@@ -121,41 +121,41 @@ void acpi_ut_track_stack_ptr(void);
 
 void
 acpi_ut_trace(u32 line_number,
-             const char *function_name, char *module_name, u32 component_id);
+             const char *function_name, const char *module_name, u32 
component_id);
 
 void
 acpi_ut_trace_ptr(u32 line_number,
                  const char *function_name,
-                 char *module_name, u32 component_id, void *pointer);
+                 const char *module_name, u32 component_id, void *pointer);
 
 void
 acpi_ut_trace_u32(u32 line_number,
                  const char *function_name,
-                 char *module_name, u32 component_id, u32 integer);
+                 const char *module_name, u32 component_id, u32 integer);
 
 void
 acpi_ut_trace_str(u32 line_number,
                  const char *function_name,
-                 char *module_name, u32 component_id, char *string);
+                 const char *module_name, u32 component_id, char *string);
 
 void
 acpi_ut_exit(u32 line_number,
-            const char *function_name, char *module_name, u32 component_id);
+            const char *function_name, const char *module_name, u32 
component_id);
 
 void
 acpi_ut_status_exit(u32 line_number,
                    const char *function_name,
-                   char *module_name, u32 component_id, acpi_status status);
+                   const char *module_name, u32 component_id, acpi_status 
status);
 
 void
 acpi_ut_value_exit(u32 line_number,
                   const char *function_name,
-                  char *module_name, u32 component_id, acpi_integer value);
+                  const char *module_name, u32 component_id, acpi_integer 
value);
 
 void
 acpi_ut_ptr_exit(u32 line_number,
                 const char *function_name,
-                char *module_name, u32 component_id, u8 * ptr);
+                const char *module_name, u32 component_id, u8 * ptr);
 
 /* Error and message reporting interfaces */
 
@@ -163,32 +163,32 @@ void ACPI_INTERNAL_VAR_XFACE
 acpi_ut_debug_print(u32 requested_debug_level,
                    u32 line_number,
                    const char *function_name,
-                   char *module_name,
+                   const char *module_name,
                    u32 component_id, char *format, ...) ACPI_PRINTF_LIKE(6);
 
 void ACPI_INTERNAL_VAR_XFACE
 acpi_ut_debug_print_raw(u32 requested_debug_level,
                        u32 line_number,
                        const char *function_name,
-                       char *module_name,
+                       const char *module_name,
                        u32 component_id,
                        char *format, ...) ACPI_PRINTF_LIKE(6);
 
 void ACPI_INTERNAL_VAR_XFACE
-acpi_ut_error(char *module_name,
+acpi_ut_error(const char *module_name,
              u32 line_number, char *format, ...) ACPI_PRINTF_LIKE(3);
 
 void ACPI_INTERNAL_VAR_XFACE
-acpi_ut_exception(char *module_name,
+acpi_ut_exception(const char *module_name,
                  u32 line_number,
                  acpi_status status, char *format, ...) ACPI_PRINTF_LIKE(4);
 
 void ACPI_INTERNAL_VAR_XFACE
-acpi_ut_warning(char *module_name,
+acpi_ut_warning(const char *module_name,
                u32 line_number, char *format, ...) ACPI_PRINTF_LIKE(3);
 
 void ACPI_INTERNAL_VAR_XFACE
-acpi_ut_info(char *module_name,
+acpi_ut_info(const char *module_name,
             u32 line_number, char *format, ...) ACPI_PRINTF_LIKE(3);
 
 /*


Attachment: acpi-init.patch
Description: Text document

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel
<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-devel] [PATCH 6/7] x86/ACPI: __init-annotate, Jan Beulich <=