summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMarty Gloff <mgloff@us.ibm.com>2017-05-05 16:00:02 -0500
committerDaniel M. Crowell <dcrowell@us.ibm.com>2017-05-15 12:24:08 -0400
commit39a6328f155b641dbbe781c292029f45a2aad5cf (patch)
tree0a526a3c0ec07c60676c8bdae74b8856bb28df91 /src
parentfad80fcf1cf0ae7923cab267777f2c3974f7cc93 (diff)
downloadtalos-hostboot-39a6328f155b641dbbe781c292029f45a2aad5cf.tar.gz
talos-hostboot-39a6328f155b641dbbe781c292029f45a2aad5cf.zip
Save space in Bootloader image with string utilities
Some string utility functions are not being used in Bootloader, so add conditions to keep them from being compiled in. Also memset can be replaced by a simple loop to reduce size. Change-Id: I7e483855b9263b19fb3cb3232015d142efede68a Reviewed-on: http://ralgit01.raleigh.ibm.com/gerrit1/40177 Tested-by: Jenkins Server <pfd-jenkins+hostboot@us.ibm.com> Tested-by: Jenkins OP Build CI <op-jenkins+hostboot@us.ibm.com> Tested-by: FSP CI Jenkins <fsp-CI-jenkins+hostboot@us.ibm.com> Reviewed-by: Stephen M. Cprek <smcprek@us.ibm.com> Reviewed-by: Christian R. Geddes <crgeddes@us.ibm.com> Reviewed-by: Daniel M. Crowell <dcrowell@us.ibm.com>
Diffstat (limited to 'src')
-rw-r--r--src/bootloader/bl_string_utils.C32
-rw-r--r--src/bootloader/bootloader.C3
-rw-r--r--src/bootloader/makefile1
-rw-r--r--src/lib/string_utils.C4
-rw-r--r--src/makefile2
5 files changed, 40 insertions, 2 deletions
diff --git a/src/bootloader/bl_string_utils.C b/src/bootloader/bl_string_utils.C
new file mode 100644
index 000000000..4a5eea12d
--- /dev/null
+++ b/src/bootloader/bl_string_utils.C
@@ -0,0 +1,32 @@
+/* IBM_PROLOG_BEGIN_TAG */
+/* This is an automatically generated prolog. */
+/* */
+/* $Source: src/bootloader/bl_string_utils.C $ */
+/* */
+/* OpenPOWER HostBoot Project */
+/* */
+/* Contributors Listed Below - COPYRIGHT 2017 */
+/* [+] International Business Machines Corp. */
+/* */
+/* */
+/* Licensed under the Apache License, Version 2.0 (the "License"); */
+/* you may not use this file except in compliance with the License. */
+/* You may obtain a copy of the License at */
+/* */
+/* http://www.apache.org/licenses/LICENSE-2.0 */
+/* */
+/* Unless required by applicable law or agreed to in writing, software */
+/* distributed under the License is distributed on an "AS IS" BASIS, */
+/* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or */
+/* implied. See the License for the specific language governing */
+/* permissions and limitations under the License. */
+/* */
+/* IBM_PROLOG_END_TAG */
+
+#include <bootloader/bootloader.H>
+
+#define bl_string_utils_C
+
+#include <../lib/string_utils.C>
+
+#undef bl_string_utils_C
diff --git a/src/bootloader/bootloader.C b/src/bootloader/bootloader.C
index fda5bdfac..408b27c09 100644
--- a/src/bootloader/bootloader.C
+++ b/src/bootloader/bootloader.C
@@ -204,7 +204,8 @@ namespace Bootloader{
// Clear/zero-out the struct since we want 0 ('zero') values for
// struct elements my_ecid, entry_point and log
- memset(&l_hw_parms, 0, sizeof(ROM_hw_params));
+ uint8_t *p_hw_parms = reinterpret_cast<uint8_t *>(&l_hw_parms);
+ for(uint8_t i = 0; i < sizeof(ROM_hw_params); p_hw_parms[i++] = 0){}
// Use current hw hash key
memcpy (&l_hw_parms.hw_key_hash, g_blData->blToHbData.hwKeysHash,
diff --git a/src/bootloader/makefile b/src/bootloader/makefile
index c90908a52..1ff44222c 100644
--- a/src/bootloader/makefile
+++ b/src/bootloader/makefile
@@ -41,6 +41,7 @@ OBJS += bl_pnor_utils.o
OBJS += bl_pnor_ecc.o
OBJS += bl_builtins.o
OBJS += bl_terminate.o
+OBJS += bl_string_utils.o
OPT_LEVEL = -Os
diff --git a/src/lib/string_utils.C b/src/lib/string_utils.C
index 2ef8419a9..79a8bf709 100644
--- a/src/lib/string_utils.C
+++ b/src/lib/string_utils.C
@@ -25,6 +25,7 @@
#include <string.h>
#include <stdlib.h>
+#ifndef BOOTLOADER
extern "C" void *memset(void *vdest, int ch, size_t len)
{
// TODO: align to an 8-byte boundary
@@ -55,6 +56,7 @@ extern "C" void *memset(void *vdest, int ch, size_t len)
return vdest;
}
+#endif
extern "C" void *memcpy(void *vdest, const void *vsrc, size_t len)
{
@@ -81,6 +83,7 @@ extern "C" void *memcpy(void *vdest, const void *vsrc, size_t len)
return vdest;
}
+#ifndef BOOTLOADER
extern "C" void *memmove(void *vdest, const void *vsrc, size_t len)
{
// Copy first-to-last
@@ -100,6 +103,7 @@ extern "C" void *memmove(void *vdest, const void *vsrc, size_t len)
return vdest;
}
+#endif
extern "C" int memcmp(const void *p1, const void *p2, size_t len)
{
diff --git a/src/makefile b/src/makefile
index 3a34ee26b..300d63935 100644
--- a/src/makefile
+++ b/src/makefile
@@ -72,7 +72,7 @@ BOOTLDR_OBJECTS += bl_pnor_utils.o
BOOTLDR_OBJECTS += bl_pnor_ecc.o
BOOTLDR_OBJECTS += bl_terminate.o
BOOTLDR_OBJECTS += forceattn_p8.o
-BOOTLDR_OBJECTS += string_utils.o
+BOOTLDR_OBJECTS += bl_string_utils.o
BOOTLDR_OBJECTS += rom_entry.o
SECUREROM_OBJECTS += ROM.o
OpenPOWER on IntegriCloud