summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorPrachi Gupta <pragupta@us.ibm.com>2014-08-26 16:31:17 -0500
committerA. Patrick Williams III <iawillia@us.ibm.com>2014-09-19 11:10:26 -0500
commit4e3de17abf2169f1035acf0a8401da31acdc357b (patch)
tree9f4d3c2d4485f9b1dd9f3374c3d43378ee972d9c /src
parent974a34dabdbd9e3b4d0f4dec1178299838fb0fd9 (diff)
downloadtalos-hostboot-4e3de17abf2169f1035acf0a8401da31acdc357b.tar.gz
talos-hostboot-4e3de17abf2169f1035acf0a8401da31acdc357b.zip
Added Hash Function in FapiUtil
RTC:114588 Change-Id: Ib9fab786a9a82ad9608f0db0b524c7bdca19788c Reviewed-on: http://gfw160.aus.stglabs.ibm.com:8080/gerrit/13277 Tested-by: Jenkins Server Reviewed-by: STEPHEN M. CPREK <smcprek@us.ibm.com> Reviewed-by: Daniel M. Crowell <dcrowell@us.ibm.com> Reviewed-by: A. Patrick Williams III <iawillia@us.ibm.com>
Diffstat (limited to 'src')
-rw-r--r--src/include/usr/hwpf/fapi/fapiUtil.H17
-rw-r--r--src/include/usr/hwpf/plat/fapiPlatUtil.H17
2 files changed, 31 insertions, 3 deletions
diff --git a/src/include/usr/hwpf/fapi/fapiUtil.H b/src/include/usr/hwpf/fapi/fapiUtil.H
index f2f36dee5..470d78fec 100644
--- a/src/include/usr/hwpf/fapi/fapiUtil.H
+++ b/src/include/usr/hwpf/fapi/fapiUtil.H
@@ -5,7 +5,9 @@
/* */
/* OpenPOWER HostBoot Project */
/* */
-/* COPYRIGHT International Business Machines Corp. 2011,2014 */
+/* Contributors Listed Below - COPYRIGHT 2011,2014 */
+/* [+] 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. */
@@ -20,7 +22,7 @@
/* permissions and limitations under the License. */
/* */
/* IBM_PROLOG_END_TAG */
-// $Id: fapiUtil.H,v 1.20 2014/01/20 22:37:52 mklight Exp $
+// $Id: fapiUtil.H,v 1.21 2014/09/16 14:47:23 pragupta Exp $
// $Source: /afs/awd/projects/eclipz/KnowledgeBase/.cvsroot/eclipz/hwpf/working/fapi/fapiUtil.H,v $
/**
@@ -50,6 +52,7 @@
* mjjones 09/24/2013 Update fapiLogError to
* accept another parameter
* dcrowell 10/14/2013 Add explicit inline
+ * pragupta 09/16/2014 Add fapi gen hash function
*/
#ifndef FAPIUTIL_H_
@@ -58,6 +61,15 @@
#include <stdint.h>
#include <stddef.h>
#include <fapiReturnCode.H>
+
+namespace fapi
+{
+ namespace hash
+ {
+ enum validHashes { CRC32 };
+ }
+};
+
#include <fapiPlatUtil.H>
// Defines for endian convertion
@@ -80,6 +92,7 @@
#define fapiMalloc(s) fapiPlatMalloc(s)
#define fapiFree(p) fapiPlatFree(p)
+#define FAPI_GEN_HASH(type, data, size) FAPI_PLAT_GEN_HASH(type,data,size)
// It is an eCMD requirement that these functions have a "C" symbol
// because they may be used from a dynamically linked shared library
extern "C"
diff --git a/src/include/usr/hwpf/plat/fapiPlatUtil.H b/src/include/usr/hwpf/plat/fapiPlatUtil.H
index 76514fb2f..bdd7549bd 100644
--- a/src/include/usr/hwpf/plat/fapiPlatUtil.H
+++ b/src/include/usr/hwpf/plat/fapiPlatUtil.H
@@ -5,7 +5,9 @@
/* */
/* OpenPOWER HostBoot Project */
/* */
-/* COPYRIGHT International Business Machines Corp. 2011,2014 */
+/* Contributors Listed Below - COPYRIGHT 2013,2014 */
+/* [+] 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. */
@@ -40,6 +42,19 @@
#include <endian.h>
#include <stdlib.h>
+#include <util/crc32.H>
+
+#define FAPI_PLAT_GEN_HASH(type, data, size) fapiPlatGenHash<type>(data,size)
+
+template <uint32_t T> uint32_t fapiPlatGenHash
+ (const void* i_data, size_t i_size);
+
+template <> inline uint32_t fapiPlatGenHash <fapi::hash::CRC32>
+ (const void* i_data, size_t i_size)
+{
+ return Util::crc32_calc(i_data, i_size);
+}
+
// defines for endian conversion
#define FAPI_PLAT_BE16TOH(x) be16toh(x)
OpenPOWER on IntegriCloud