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 <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
This commit is contained in:
Uwe Hermann 2008-03-23 15:34:04 +00:00
parent b0e3f39a39
commit 0bfb5c4fb2
4 changed files with 23 additions and 20 deletions

View File

@ -121,7 +121,6 @@ int coreboot_module_redraw(WINDOW *win)
static void parse_memory(unsigned char *ptr) static void parse_memory(unsigned char *ptr)
{ {
struct cb_memory *mem = (struct cb_memory *)ptr; struct cb_memory *mem = (struct cb_memory *)ptr;
int max = (MEM_RANGE_COUNT(mem) > MAX_MEMORY_COUNT) int max = (MEM_RANGE_COUNT(mem) > MAX_MEMORY_COUNT)
? MAX_MEMORY_COUNT : MEM_RANGE_COUNT(mem); ? MAX_MEMORY_COUNT : MEM_RANGE_COUNT(mem);
int i; int i;
@ -236,7 +235,7 @@ static int parse_header(void *addr, int len)
return 1; return 1;
} }
int coreboot_module_init(void) static int coreboot_module_init(void)
{ {
int ret = parse_header((void *)0x00000, 0x1000); int ret = parse_header((void *)0x00000, 0x1000);

View File

@ -50,7 +50,7 @@ void print_module_title(WINDOW *win, const char *title)
waddch(win, '\304'); waddch(win, '\304');
} }
void print_menu(void) static void print_menu(void)
{ {
int i, j; int i, j;
char menu[80]; char menu[80];
@ -67,7 +67,7 @@ void print_menu(void)
mvprintw(23, 0, menu); mvprintw(23, 0, menu);
} }
void center(int row, const char *str) static void center(int row, const char *str)
{ {
int len = strlen(str); int len = strlen(str);
int j; int j;
@ -80,7 +80,9 @@ void center(int row, const char *str)
mvprintw(row, (SCREEN_X - len) / 2, 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 buf[SCREEN_X];
char *ptr = buf; char *ptr = buf;
@ -97,6 +99,7 @@ void header(int row, const char *str)
mvprintw(row, 0, buf); mvprintw(row, 0, buf);
} }
#endif
static void redraw_module(void) static void redraw_module(void)
{ {
@ -105,7 +108,7 @@ static void redraw_module(void)
refresh(); refresh();
} }
void loop(void) static void loop(void)
{ {
int key; int key;

View File

@ -33,7 +33,7 @@
#define VENDOR_SIS 0x20536953 #define VENDOR_SIS 0x20536953
/* CPUID 0x00000001 EDX flags */ /* CPUID 0x00000001 EDX flags */
const char *generic_cap_flags[] = { static const char *generic_cap_flags[] = {
"fpu", "vme", "de", "pse", "tsc", "msr", "pae", "mce", "fpu", "vme", "de", "pse", "tsc", "msr", "pae", "mce",
"cx8", "apic", NULL, "sep", "mtrr", "pge", "mca", "cmov", "cx8", "apic", NULL, "sep", "mtrr", "pge", "mca", "cmov",
"pat", "pse36", "psn", "clflsh", NULL, "ds", "acpi", "mmx", "pat", "pse36", "psn", "clflsh", NULL, "ds", "acpi", "mmx",
@ -41,7 +41,7 @@ const char *generic_cap_flags[] = {
}; };
/* CPUID 0x00000001 ECX 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", "sse3", NULL, NULL, "monitor", "ds-cpl", "vmx", NULL, "est",
"tm2", "ssse3", "cntx-id", NULL, NULL, "cx16", "xTPR", NULL, "tm2", "ssse3", "cntx-id", NULL, NULL, "cx16", "xTPR", NULL,
NULL, NULL, "dca", NULL, NULL, NULL, NULL, NULL, NULL, NULL, "dca", NULL, NULL, NULL, NULL, NULL,
@ -49,7 +49,7 @@ const char *intel_cap_generic_ecx_flags[] = {
}; };
/* CPUID 0x80000001 EDX 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, NULL, NULL, NULL, NULL, NULL,
NULL, NULL, NULL, "SYSCALL", NULL, NULL, NULL, NULL, NULL, NULL, NULL, "SYSCALL", NULL, NULL, NULL, NULL,
NULL, NULL, NULL, NULL, "xd", 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 */ /* 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, "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, 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, "sse3", NULL, NULL, "mwait", NULL, NULL, NULL, NULL,
NULL, NULL, NULL, NULL, NULL, "cmpxchg16b", 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, "popcnt",
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL 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", "fpu", "vme", "de", "pse", "tsc", "msr", "pae", "mce",
"cx8", "apic", NULL, "sep", "mtrr", "pge", "mca", "cmov", "cx8", "apic", NULL, "sep", "mtrr", "pge", "mca", "cmov",
"pat", "pse36", NULL, "mp", "nx", NULL, "mmxext", "mmx", "pat", "pse36", NULL, "mp", "nx", NULL, "mmxext", "mmx",
@ -79,7 +79,7 @@ const char *amd_cap_extended_edx_flags[] = {
NULL, "lm", "3dnowext", "3dnow" NULL, "lm", "3dnowext", "3dnow"
}; /* "mp" defined for CPUs prior to AMD family 0xf */ }; /* "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", "lahf/sahf", "CmpLegacy", "svm", "ExtApicSpace",
"LockMovCr0", "abm", "sse4a", "misalignsse", "LockMovCr0", "abm", "sse4a", "misalignsse",
"3dnowPref", "osvw", "ibs", NULL, "skinit", "wdt", NULL, NULL, "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 long vendor;
static unsigned int cpu_khz; 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 i;
int lrow = *row; int lrow = *row;
@ -175,7 +176,7 @@ static void do_name(WINDOW *win, int row)
mvwprintw(win, row, 1, "Processor: %s", name); 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 long eax, ebx, ecx, edx;
unsigned int brand; unsigned int brand;
@ -244,7 +245,7 @@ int cpuinfo_module_redraw(WINDOW *win)
return 0; return 0;
} }
unsigned int getticks(void) static unsigned int getticks(void)
{ {
unsigned long long start, end; unsigned long long start, end;
@ -256,7 +257,7 @@ unsigned int getticks(void)
return (unsigned int)((end - start) / 100); return (unsigned int)((end - start) / 100);
} }
int cpuinfo_module_init(void) static int cpuinfo_module_init(void)
{ {
cpu_khz = getticks(); cpu_khz = getticks();
return 0; return 0;

View 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; unsigned int bus, devfn, func;
int i, last; int i, last;
@ -237,7 +237,7 @@ static void pci_scan_bus(int bus)
quicksort(devices, devices_index); quicksort(devices, devices_index);
} }
int pci_module_handle(int key) static int pci_module_handle(int key)
{ {
int ret = 0; int ret = 0;
@ -270,7 +270,7 @@ int pci_module_handle(int key)
return ret; return ret;
} }
int pci_module_init(void) static int pci_module_init(void)
{ {
pci_scan_bus(0); pci_scan_bus(0);
return 0; return 0;