From 8a8f3f48368f666f7b4f578d43d8c4e03cb519e2 Mon Sep 17 00:00:00 2001 From: Stefan Reinauer Date: Thu, 22 Mar 2007 00:36:11 +0000 Subject: [PATCH] * fix typos in device_util.c * drop double error in malloc.c * add extra CFLAGS to reduce code size by 10% * add more build time defines and use them in the LB table. The LB_TAG_COMPILE_TIME is a partly duplicate of LB_TAG_BUILD, as LB_TAG_BUILD contains both date and time. I left this in for compatibility reasons. Signed-off-by: Stefan Reinauer Acked-by: Carl-Daniel Hailfinger git-svn-id: svn://coreboot.org/repository/LinuxBIOSv3@268 f3766cd6-281f-0410-b1cd-43a5c92072e9 --- Makefile | 8 +++++++- arch/x86/linuxbios_table.c | 30 +++++++++++++----------------- device/device_util.c | 4 ++-- lib/malloc.c | 1 - 4 files changed, 22 insertions(+), 21 deletions(-) diff --git a/Makefile b/Makefile index fd69df9032..a5fc482f02 100644 --- a/Makefile +++ b/Makefile @@ -38,7 +38,8 @@ MAKEFLAGS += --no-print-directory CC := gcc CFLAGS := -Os -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs \ -Werror-implicit-function-declaration -Wstrict-aliasing \ - -fno-common -ffreestanding -fno-builtin + -fno-common -ffreestanding -fno-builtin -fomit-frame-pointer \ + -mpreferred-stack-boundary=2 -mregparm=3 -pipe HOSTCC := gcc HOSTCXX := g++ @@ -126,6 +127,11 @@ prepare2: $(Q)printf "#define LINUXBIOS_COMPILER \"$(shell LANG= $(CC) --version | head -n1)\"\n" >> $(obj)/build.h $(Q)printf "#define LINUXBIOS_ASSEMBLER \"$(shell LANG= $(AS) --version | head -n1)\"\n" >> $(obj)/build.h $(Q)printf "#define LINUXBIOS_LINKER \"$(shell LANG= $(LD) --version | head -n1)\"\n" >> $(obj)/build.h + $(Q)printf "#define LINUXBIOS_COMPILE_TIME \"`LANG= date +%T`\"\n" >> $(obj)/build.h + $(Q)printf "#define LINUXBIOS_COMPILE_BY \"$(shell whoami)\"\n" >> $(obj)/build.h + $(Q)printf "#define LINUXBIOS_COMPILE_HOST \"$(shell hostname)\"\n" >> $(obj)/build.h + $(Q)printf "#define LINUXBIOS_COMPILE_DOMAIN \"$(shell dnsdomainname)\"\n" >> $(obj)/build.h + clean: $(Q)printf " CLEAN $(subst $(shell pwd)/,,$(obj))\n" diff --git a/arch/x86/linuxbios_table.c b/arch/x86/linuxbios_table.c index 163bf72120..f542184992 100644 --- a/arch/x86/linuxbios_table.c +++ b/arch/x86/linuxbios_table.c @@ -144,24 +144,20 @@ struct cmos_checksum *lb_cmos_checksum(struct lb_header *header) void lb_strings(struct lb_header *header) { -#warning "Fill in the strings in lb_strings -- needs Makefile changes" static const struct { u32 tag; const u8 *string; } strings[] = { - { LB_TAG_VERSION, (u8 *) "3 -- FIXME", }, -/* - { LB_TAG_VERSION, linuxbios_version, }, - { LB_TAG_EXTRA_VERSION, linuxbios_extra_version, }, - { LB_TAG_BUILD, linuxbios_build, }, - { LB_TAG_COMPILE_TIME, linuxbios_compile_time, }, - { LB_TAG_COMPILE_BY, linuxbios_compile_by, }, - { LB_TAG_COMPILE_HOST, linuxbios_compile_host, }, - { LB_TAG_COMPILE_DOMAIN, linuxbios_compile_domain, }, - { LB_TAG_COMPILER, linuxbios_compiler, }, - { LB_TAG_LINKER, linuxbios_linker, }, - { LB_TAG_ASSEMBLER, linuxbios_assembler, }, -*/ + { LB_TAG_VERSION, (const u8 *)LINUXBIOS_VERSION, }, + { LB_TAG_EXTRA_VERSION, (const u8 *)LINUXBIOS_EXTRA_VERSION, }, + { LB_TAG_BUILD, (const u8 *)LINUXBIOS_BUILD, }, + { LB_TAG_COMPILE_TIME, (const u8 *)LINUXBIOS_COMPILE_TIME, }, // duplicate? + { LB_TAG_COMPILE_BY, (const u8 *)LINUXBIOS_COMPILE_BY, }, + { LB_TAG_COMPILE_HOST, (const u8 *)LINUXBIOS_COMPILE_HOST, }, + { LB_TAG_COMPILE_DOMAIN, (const u8 *)LINUXBIOS_COMPILE_DOMAIN, }, + { LB_TAG_COMPILER, (const u8 *)LINUXBIOS_COMPILER, }, + { LB_TAG_LINKER, (const u8 *)LINUXBIOS_LINKER, }, + { LB_TAG_ASSEMBLER, (const u8 *)LINUXBIOS_ASSEMBLER, }, }; unsigned int i; for(i = 0; i < sizeof(strings)/sizeof(strings[0]); i++) { @@ -244,7 +240,8 @@ static void lb_cleanup_memory_ranges(struct lb_memory *mem) entries = (mem->size - sizeof(*mem))/sizeof(mem->map[0]); printk(BIOS_INFO, "%s: # entries %d\n", __func__, entries); for(i = 0; i < entries; i++) - printk(BIOS_INFO, " #%d: base 0x%x size 0x%x\n", i, (u32)mem->map[i].start.lo, mem->map[i].size.lo); + printk(BIOS_INFO, " #%d: base 0x%x size 0x%x\n", + i, (u32)mem->map[i].start.lo, mem->map[i].size.lo); /* Sort the lb memory ranges */ for(i = 0; i < entries; i++) { @@ -375,8 +372,7 @@ static struct lb_memory *build_lb_mem(struct lb_header *head) mem_ranges = mem; /* Build the raw table of memory */ - search_global_resources( - IORESOURCE_MEM | IORESOURCE_CACHEABLE, IORESOURCE_MEM | IORESOURCE_CACHEABLE, + search_global_resources( IORESOURCE_MEM | IORESOURCE_CACHEABLE, IORESOURCE_MEM | IORESOURCE_CACHEABLE, build_lb_mem_range, mem); lb_cleanup_memory_ranges(mem); return mem; diff --git a/device/device_util.c b/device/device_util.c index 2cb59ea99f..9226c25445 100644 --- a/device/device_util.c +++ b/device/device_util.c @@ -297,7 +297,7 @@ int path_eq(struct device_path *path1, struct device_path *path2) equal = (path1->u.cpu_bus.id == path2->u.cpu_bus.id); break; default: - printk(BIOS_ERR, "Uknown device type: %d\n", path1->type); + printk(BIOS_ERR, "Unknown device type: %d\n", path1->type); break; } } @@ -339,7 +339,7 @@ int id_eq(struct device_id *path1, struct device_id *path2) equal = (path1->u.cpu_bus.vendor == path2->u.cpu_bus.vendor) && (path1->u.cpu_bus.device == path2->u.cpu_bus.device); break; default: - printk(BIOS_ERR, "Uknown device type: %d\n", path1->type); + printk(BIOS_ERR, "Unknown device type: %d\n", path1->type); break; } } diff --git a/lib/malloc.c b/lib/malloc.c index 42e4cbc5c4..7bdb2a1608 100644 --- a/lib/malloc.c +++ b/lib/malloc.c @@ -55,7 +55,6 @@ void *malloc(size_t size) free_mem_ptr); if (size > freebytes) { - printk(BIOS_ERR, "OUT OF MEMORY for alloc of %d bytes\n", size); die("OUT OF MEMORY\n"); }