From 0bfb5c4fb2a8626ccc6f663d1c8ca8e88f6d6666 Mon Sep 17 00:00:00 2001 From: Uwe Hermann Date: Sun, 23 Mar 2008 15:34:04 +0000 Subject: [PATCH] Make functions static (where possible) to reduce code size (trivial). 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 Acked-by: Uwe Hermann git-svn-id: svn://svn.coreboot.org/coreboot/trunk@3187 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1 --- payloads/coreinfo/coreboot_module.c | 3 +-- payloads/coreinfo/coreinfo.c | 11 +++++++---- payloads/coreinfo/cpuinfo_module.c | 23 ++++++++++++----------- payloads/coreinfo/pci_module.c | 6 +++--- 4 files changed, 23 insertions(+), 20 deletions(-) diff --git a/payloads/coreinfo/coreboot_module.c b/payloads/coreinfo/coreboot_module.c index 429d1235f5..45ed38cccd 100644 --- a/payloads/coreinfo/coreboot_module.c +++ b/payloads/coreinfo/coreboot_module.c @@ -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); diff --git a/payloads/coreinfo/coreinfo.c b/payloads/coreinfo/coreinfo.c index de183886ca..c81e9b3895 100644 --- a/payloads/coreinfo/coreinfo.c +++ b/payloads/coreinfo/coreinfo.c @@ -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; diff --git a/payloads/coreinfo/cpuinfo_module.c b/payloads/coreinfo/cpuinfo_module.c index 3dd97f891d..ace87fec45 100644 --- a/payloads/coreinfo/cpuinfo_module.c +++ b/payloads/coreinfo/cpuinfo_module.c @@ -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; diff --git a/payloads/coreinfo/pci_module.c b/payloads/coreinfo/pci_module.c index 59e414a417..5099da2f01 100644 --- a/payloads/coreinfo/pci_module.c +++ b/payloads/coreinfo/pci_module.c @@ -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;