[coreboot] r3187 - trunk/payloads/coreinfo

svn at coreboot.org svn at coreboot.org
Sun Mar 23 16:34:05 CET 2008


Author: uwe
Date: 2008-03-23 16:34:04 +0100 (Sun, 23 Mar 2008)
New Revision: 3187

Modified:
   trunk/payloads/coreinfo/coreboot_module.c
   trunk/payloads/coreinfo/coreinfo.c
   trunk/payloads/coreinfo/cpuinfo_module.c
   trunk/payloads/coreinfo/pci_module.c
Log:
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 at hermann-uwe.de>
Acked-by: Uwe Hermann <uwe at hermann-uwe.de>



Modified: trunk/payloads/coreinfo/coreboot_module.c
===================================================================
--- trunk/payloads/coreinfo/coreboot_module.c	2008-03-22 15:27:26 UTC (rev 3186)
+++ trunk/payloads/coreinfo/coreboot_module.c	2008-03-23 15:34:04 UTC (rev 3187)
@@ -121,7 +121,6 @@
 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 @@
 	return 1;
 }
 
-int coreboot_module_init(void)
+static int coreboot_module_init(void)
 {
 	int ret = parse_header((void *)0x00000, 0x1000);
 

Modified: trunk/payloads/coreinfo/coreinfo.c
===================================================================
--- trunk/payloads/coreinfo/coreinfo.c	2008-03-22 15:27:26 UTC (rev 3186)
+++ trunk/payloads/coreinfo/coreinfo.c	2008-03-23 15:34:04 UTC (rev 3187)
@@ -50,7 +50,7 @@
 		waddch(win, '\304');
 }
 
-void print_menu(void)
+static void print_menu(void)
 {
 	int i, j;
 	char menu[80];
@@ -67,7 +67,7 @@
 	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 @@
 	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 @@
 
 	mvprintw(row, 0, buf);
 }
+#endif
 
 static void redraw_module(void)
 {
@@ -105,7 +108,7 @@
 	refresh();
 }
 
-void loop(void)
+static void loop(void)
 {
 	int key;
 

Modified: trunk/payloads/coreinfo/cpuinfo_module.c
===================================================================
--- trunk/payloads/coreinfo/cpuinfo_module.c	2008-03-22 15:27:26 UTC (rev 3186)
+++ trunk/payloads/coreinfo/cpuinfo_module.c	2008-03-23 15:34:04 UTC (rev 3187)
@@ -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 @@
 };
 
 /* 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 @@
 };
 
 /* 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 @@
 };
 
 /* 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 @@
 	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 @@
 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 @@
 	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 @@
 	return 0;
 }
 
-unsigned int getticks(void)
+static unsigned int getticks(void)
 {
 	unsigned long long start, end;
 
@@ -256,7 +257,7 @@
 	return (unsigned int)((end - start) / 100);
 }
 
-int cpuinfo_module_init(void)
+static int cpuinfo_module_init(void)
 {
 	cpu_khz = getticks();
 	return 0;

Modified: trunk/payloads/coreinfo/pci_module.c
===================================================================
--- trunk/payloads/coreinfo/pci_module.c	2008-03-22 15:27:26 UTC (rev 3186)
+++ trunk/payloads/coreinfo/pci_module.c	2008-03-23 15:34:04 UTC (rev 3187)
@@ -125,7 +125,7 @@
 	}
 }
 
-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 @@
 	quicksort(devices, devices_index);
 }
 
-int pci_module_handle(int key)
+static int pci_module_handle(int key)
 {
 	int ret = 0;
 
@@ -270,7 +270,7 @@
 	return ret;
 }
 
-int pci_module_init(void)
+static int pci_module_init(void)
 {
 	pci_scan_bus(0);
 	return 0;





More information about the coreboot mailing list