Make functions static (where possible) to reduce code size (trivial).
authorUwe Hermann <uwe@hermann-uwe.de>
Sun, 23 Mar 2008 15:34:04 +0000 (15:34 +0000)
committerUwe Hermann <uwe@hermann-uwe.de>
Sun, 23 Mar 2008 15:34:04 +0000 (15:34 +0000)
Also, disable header() for now, as it's not being used.

Here are some stats on size differences:

 - ls

23820 coreinfo.old.elf
23564 coreinfo.new.elf

 - size *elf

   text    data     bss     dec     hex filename
  15199    2468  181904  199571   30b93 coreinfo.old.elf
  14934    2468  181912  199314   30a92 coreinfo.new.elf

Signed-off-by: Uwe Hermann <uwe@hermann-uwe.de>
Acked-by: Uwe Hermann <uwe@hermann-uwe.de>
git-svn-id: svn://svn.coreboot.org/coreboot/trunk@3187 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1

payloads/coreinfo/coreboot_module.c
payloads/coreinfo/coreinfo.c
payloads/coreinfo/cpuinfo_module.c
payloads/coreinfo/pci_module.c

index 429d1235f58a3d6cf32eac4e62cdf217c586b1b0..45ed38cccde4d5e0a00448abc09c0a2bf793fd80 100644 (file)
@@ -121,7 +121,6 @@ int coreboot_module_redraw(WINDOW *win)
 static void parse_memory(unsigned char *ptr)
 {
        struct cb_memory *mem = (struct cb_memory *)ptr;
-
        int max = (MEM_RANGE_COUNT(mem) > MAX_MEMORY_COUNT)
            ? MAX_MEMORY_COUNT : MEM_RANGE_COUNT(mem);
        int i;
@@ -236,7 +235,7 @@ static int parse_header(void *addr, int len)
        return 1;
 }
 
-int coreboot_module_init(void)
+static int coreboot_module_init(void)
 {
        int ret = parse_header((void *)0x00000, 0x1000);
 
index de183886caa3027740aa83950acbd2ad9e08751c..c81e9b389531f86cca4c925b5ab8fa5a397c2d54 100644 (file)
@@ -50,7 +50,7 @@ void print_module_title(WINDOW *win, const char *title)
                waddch(win, '\304');
 }
 
-void print_menu(void)
+static void print_menu(void)
 {
        int i, j;
        char menu[80];
@@ -67,7 +67,7 @@ void print_menu(void)
        mvprintw(23, 0, menu);
 }
 
-void center(int row, const char *str)
+static void center(int row, const char *str)
 {
        int len = strlen(str);
        int j;
@@ -80,7 +80,9 @@ void center(int row, const char *str)
        mvprintw(row, (SCREEN_X - len) / 2, str);
 }
 
-void header(int row, const char *str)
+/* FIXME: Currently unused. */
+#if 0
+static void header(int row, const char *str)
 {
        char buf[SCREEN_X];
        char *ptr = buf;
@@ -97,6 +99,7 @@ void header(int row, const char *str)
 
        mvprintw(row, 0, buf);
 }
+#endif
 
 static void redraw_module(void)
 {
@@ -105,7 +108,7 @@ static void redraw_module(void)
        refresh();
 }
 
-void loop(void)
+static void loop(void)
 {
        int key;
 
index 3dd97f891dcb4c651a61da1e98a5ddf11c11702e..ace87fec4556bed9f535be4cc77521bc177a79e3 100644 (file)
@@ -33,7 +33,7 @@
 #define VENDOR_SIS   0x20536953
 
 /* CPUID 0x00000001 EDX flags */
-const char *generic_cap_flags[] = {
+static const char *generic_cap_flags[] = {
        "fpu", "vme", "de", "pse", "tsc", "msr", "pae", "mce",
        "cx8", "apic", NULL, "sep", "mtrr", "pge", "mca", "cmov",
        "pat", "pse36", "psn", "clflsh", NULL, "ds", "acpi", "mmx",
@@ -41,7 +41,7 @@ const char *generic_cap_flags[] = {
 };
 
 /* CPUID 0x00000001 ECX flags */
-const char *intel_cap_generic_ecx_flags[] = {
+static const char *intel_cap_generic_ecx_flags[] = {
        "sse3", NULL, NULL, "monitor", "ds-cpl", "vmx", NULL, "est",
        "tm2", "ssse3", "cntx-id", NULL, NULL, "cx16", "xTPR", NULL,
        NULL, NULL, "dca", NULL, NULL, NULL, NULL, NULL,
@@ -49,7 +49,7 @@ const char *intel_cap_generic_ecx_flags[] = {
 };
 
 /* CPUID 0x80000001 EDX flags */
-const char *intel_cap_extended_edx_flags[] = {
+static const char *intel_cap_extended_edx_flags[] = {
        NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
        NULL, NULL, NULL, "SYSCALL", NULL, NULL, NULL, NULL,
        NULL, NULL, NULL, NULL, "xd", NULL, NULL, NULL,
@@ -57,21 +57,21 @@ const char *intel_cap_extended_edx_flags[] = {
 };
 
 /* CPUID 0x80000001 ECX flags */
-const char *intel_cap_extended_ecx_flags[] = {
+static const char *intel_cap_extended_ecx_flags[] = {
        "lahf_lm", NULL, NULL, NULL, NULL, NULL, NULL, NULL,
        NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
        NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
        NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
 };
 
-const char *amd_cap_generic_ecx_flags[] = {
+static const char *amd_cap_generic_ecx_flags[] = {
        "sse3", NULL, NULL, "mwait", NULL, NULL, NULL, NULL,
        NULL, NULL, NULL, NULL, NULL, "cmpxchg16b", NULL, NULL,
        NULL, NULL, NULL, NULL, NULL, NULL, NULL, "popcnt",
        NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL
 };
 
-const char *amd_cap_extended_edx_flags[] = {
+static const char *amd_cap_extended_edx_flags[] = {
        "fpu", "vme", "de", "pse", "tsc", "msr", "pae", "mce",
        "cx8", "apic", NULL, "sep", "mtrr", "pge", "mca", "cmov",
        "pat", "pse36", NULL, "mp", "nx", NULL, "mmxext", "mmx",
@@ -79,7 +79,7 @@ const char *amd_cap_extended_edx_flags[] = {
        NULL, "lm", "3dnowext", "3dnow"
 }; /* "mp" defined for CPUs prior to AMD family 0xf */
 
-const char *amd_cap_extended_ecx_flags[] = {
+static const char *amd_cap_extended_ecx_flags[] = {
        "lahf/sahf", "CmpLegacy", "svm", "ExtApicSpace",
        "LockMovCr0", "abm", "sse4a", "misalignsse",
        "3dnowPref", "osvw", "ibs", NULL, "skinit", "wdt", NULL, NULL,
@@ -90,7 +90,8 @@ const char *amd_cap_extended_ecx_flags[] = {
 static unsigned long vendor;
 static unsigned int cpu_khz;
 
-void decode_flags(WINDOW *win, unsigned long reg, const char **flags, int *row)
+static void decode_flags(WINDOW *win, unsigned long reg, const char **flags,
+                        int *row)
 {
        int i;
        int lrow = *row;
@@ -175,7 +176,7 @@ static void do_name(WINDOW *win, int row)
        mvwprintw(win, row, 1, "Processor: %s", name);
 }
 
-int cpuinfo_module_redraw(WINDOW *win)
+static int cpuinfo_module_redraw(WINDOW *win)
 {
        unsigned long eax, ebx, ecx, edx;
        unsigned int brand;
@@ -244,7 +245,7 @@ int cpuinfo_module_redraw(WINDOW *win)
        return 0;
 }
 
-unsigned int getticks(void)
+static unsigned int getticks(void)
 {
        unsigned long long start, end;
 
@@ -256,7 +257,7 @@ unsigned int getticks(void)
        return (unsigned int)((end - start) / 100);
 }
 
-int cpuinfo_module_init(void)
+static int cpuinfo_module_init(void)
 {
        cpu_khz = getticks();
        return 0;
index 59e414a417e4fd3b2af3168f250e20652f749e9d..5099da2f0117084ad33c0739c6e567e1ab673477 100644 (file)
@@ -125,7 +125,7 @@ static void show_config_space(WINDOW *win, int row, int col, int index)
        }
 }
 
-int pci_module_redraw(WINDOW *win)
+static int pci_module_redraw(WINDOW *win)
 {
        unsigned int bus, devfn, func;
        int i, last;
@@ -237,7 +237,7 @@ static void pci_scan_bus(int bus)
        quicksort(devices, devices_index);
 }
 
-int pci_module_handle(int key)
+static int pci_module_handle(int key)
 {
        int ret = 0;
 
@@ -270,7 +270,7 @@ int pci_module_handle(int key)
        return ret;
 }
 
-int pci_module_init(void)
+static int pci_module_init(void)
 {
        pci_scan_bus(0);
        return 0;