Skip to content

Commit a3fd64b

Browse files
committed
PRD: add BitString support to error log parsing code
Change-Id: Iab3eab5f87d1ff466657fd505ef1940859a7ec02 RTC: 169103 Reviewed-on: http://ralgit01.raleigh.ibm.com/gerrit1/36251 Tested-by: Jenkins Server <pfd-jenkins+hostboot@us.ibm.com> Reviewed-by: Brian J. Stegmiller <bjs@us.ibm.com> Reviewed-by: Caleb N. Palmer <cnpalmer@us.ibm.com> Reviewed-by: Benjamin J. Weisenbeck <bweisenb@us.ibm.com> Reviewed-by: Zane C. Shelley <zshelle@us.ibm.com> Squashed: I6835e9d4c51fb3697287e6556a2be347912c7136 Reviewed-on: http://ralgit01.raleigh.ibm.com/gerrit1/36513 Tested-by: Jenkins OP Build CI <op-jenkins+hostboot@us.ibm.com> Tested-by: FSP CI Jenkins <fsp-CI-jenkins+hostboot@us.ibm.com>
1 parent 61a53e4 commit a3fd64b

File tree

8 files changed

+55
-30
lines changed

8 files changed

+55
-30
lines changed

src/usr/diag/prdf/common/framework/register/iipscr.C

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,8 @@
4545
#include <iipscr.h>
4646
#include <iipconst.h>
4747

48+
#include <prdfAssert.h>
49+
4850
namespace PRDF
4951
{
5052
/*--------------------------------------------------------------------*/

src/usr/diag/prdf/common/plugins/plugins.mk

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
#
66
# OpenPOWER HostBoot Project
77
#
8-
# Contributors Listed Below - COPYRIGHT 2013,2016
8+
# Contributors Listed Below - COPYRIGHT 2013,2017
99
# [+] International Business Machines Corp.
1010
#
1111
#
@@ -37,6 +37,7 @@ LIBRARY_OFILES += prdfMemLogParse.o
3737
#LIBRARY_OFILES += prdfProcLogParse.o TODO RTC 136050
3838
LIBRARY_OFILES += prdrErrlPluginsSupt.o
3939
LIBRARY_OFILES += prdfParserUtils.o
40+
LIBRARY_OFILES += prdfBitString.o
4041

4142
LIBFLAGS = -Efips/lib
4243

src/usr/diag/prdf/common/prdf_types.h

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,15 @@
3131
#undef NULL
3232
#define NULL 0
3333

34+
#if defined(PRDF_HOSTBOOT_ERRL_PLUGIN) || defined(PRDF_FSP_ERRL_PLUGIN)
35+
// The error log parser is always compiled with the x86_64-mcp8-jail, which
36+
// does not support C++11, yet. Therefore, define nullptr so we don't have
37+
// to revert a bunch of new code.
38+
#ifndef nullptr
39+
#define nullptr NULL
40+
#endif
41+
#endif
42+
3443
namespace PRDF
3544
{
3645

src/usr/diag/prdf/common/util/prdfAssert.h

Lines changed: 20 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,9 @@
55
/* */
66
/* OpenPOWER HostBoot Project */
77
/* */
8-
/* COPYRIGHT International Business Machines Corp. 2004,2014 */
8+
/* Contributors Listed Below - COPYRIGHT 2004,2017 */
9+
/* [+] International Business Machines Corp. */
10+
/* */
911
/* */
1012
/* Licensed under the Apache License, Version 2.0 (the "License"); */
1113
/* you may not use this file except in compliance with the License. */
@@ -31,15 +33,24 @@
3133
namespace PRDF
3234
{
3335

34-
#define PRDF_ASSERT(x) { if(!(x)) { prdfAssert(#x,__FILE__,__LINE__); } }
36+
#if defined(PRDF_HOSTBOOT_ERRL_PLUGIN) || defined(PRDF_FSP_ERRL_PLUGIN)
3537

36-
/**
37-
* @brief PRD implementation of assert().
38-
* @param i_exp A boolean expression.
39-
* @param i_file The file calling assert().
40-
* @param i_line The line of the file in which assert() is called.
41-
*/
42-
void prdfAssert( const char * i_exp, const char * i_file, int i_line );
38+
// Special case for error log parsing code.
39+
#define PRDF_ASSERT(x) (void) 0
40+
41+
#else
42+
43+
#define PRDF_ASSERT(x) { if(!(x)) { prdfAssert(#x,__FILE__,__LINE__); } }
44+
45+
/**
46+
* @brief PRD implementation of assert().
47+
* @param i_exp A boolean expression.
48+
* @param i_file The file calling assert().
49+
* @param i_line The line of the file in which assert() is called.
50+
*/
51+
void prdfAssert( const char * i_exp, const char * i_file, int i_line );
52+
53+
#endif
4354

4455
} // end namespace PRDF
4556

src/usr/diag/prdf/common/util/prdfBitString.C

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,9 @@
2727
* @brief BitString and BitStringBuffer class Definitions
2828
*/
2929

30-
#define PRDFBITSTRING_CPP
31-
3230
#include <prdfBitString.H>
3331

34-
#undef PRDFBITSTRING_CPP
32+
#include <prdfAssert.h>
3533

3634
#include <algorithm>
3735

@@ -42,6 +40,12 @@ namespace PRDF
4240
// BitString class
4341
//##############################################################################
4442

43+
const uint32_t BitString::CPU_WORD_BIT_LEN = sizeof(CPU_WORD) * 8;
44+
45+
const CPU_WORD BitString::CPU_WORD_MASK = static_cast<CPU_WORD>(-1);
46+
47+
//------------------------------------------------------------------------------
48+
4549
CPU_WORD BitString::getField( uint32_t i_pos, uint32_t i_len ) const
4650
{
4751
PRDF_ASSERT( nullptr != getBufAddr() ); // must to have a valid address
@@ -465,7 +469,7 @@ void BitStringBuffer::initBuffer()
465469
std::ostream & operator<<(std::ostream & out,
466470
const BitString & bit_string )
467471
{
468-
const uint32_t bit_field_length = CPU_WORD_BIT_LEN;
472+
const uint32_t bit_field_length = BitString::CPU_WORD_BIT_LEN;
469473
out << std::hex;
470474
for(uint32_t pos = 0; pos < bit_string.getBitLen(); pos += bit_field_length)
471475
{

src/usr/diag/prdf/common/util/prdfBitString.H

Lines changed: 8 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,7 @@
3030
* @brief BitString and BitStringBuffer class declarations
3131
*/
3232

33-
#if !defined(PRDF_TYPES_H)
3433
#include <prdf_types.h>
35-
#endif
3634

3735
#if defined(ESW_SIM_COMPILE)
3836
#define _USE_IOSTREAMS_
@@ -43,8 +41,6 @@
4341
#include <iomanip>
4442
#endif
4543

46-
#include <prdfAssert.h>
47-
4844
namespace PRDF
4945
{
5046

@@ -54,15 +50,6 @@ class BitStringBuffer;
5450
* size for a specific CPU architecture. */
5551
typedef uint32_t CPU_WORD;
5652

57-
/** Size of a CPU_WORD */
58-
constexpr uint32_t CPU_WORD_SIZE = sizeof(CPU_WORD);
59-
60-
/** Bit length of a CPU_WORD */
61-
constexpr uint32_t CPU_WORD_BIT_LEN = CPU_WORD_SIZE * 8;
62-
63-
/** A CPU_WORD with all of the bits set to 1. */
64-
constexpr CPU_WORD CPU_WORD_MASK = static_cast<CPU_WORD>(-1);
65-
6653
//##############################################################################
6754
// BitString class
6855
//##############################################################################
@@ -99,6 +86,14 @@ constexpr CPU_WORD CPU_WORD_MASK = static_cast<CPU_WORD>(-1);
9986
*/
10087
class BitString
10188
{
89+
public: // constants
90+
91+
/** Bit length of a CPU_WORD */
92+
static const uint32_t CPU_WORD_BIT_LEN;
93+
94+
/** A CPU_WORD with all of the bits set to 1 */
95+
static const CPU_WORD CPU_WORD_MASK;
96+
10297
public: // functions
10398

10499
/**

src/usr/diag/prdf/plugins/makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
#
66
# OpenPOWER HostBoot Project
77
#
8-
# Contributors Listed Below - COPYRIGHT 2013,2015
8+
# Contributors Listed Below - COPYRIGHT 2013,2017
99
# [+] International Business Machines Corp.
1010
#
1111
#
@@ -23,7 +23,7 @@
2323
#
2424
# IBM_PROLOG_END_TAG
2525

26-
INCFLAGS += -I. -I.. \
26+
INCFLAGS += -I. -I..
2727

2828
CFLAGS += -DPRDF_HOSTBOOT_ERRL_PLUGIN
2929

src/usr/diag/prdf/rule/makefile

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
#
66
# OpenPOWER HostBoot Project
77
#
8-
# Contributors Listed Below - COPYRIGHT 2016
8+
# Contributors Listed Below - COPYRIGHT 2016,2017
99
# [+] International Business Machines Corp.
1010
#
1111
#
@@ -86,6 +86,9 @@ SOURCE_PLUGIN_DIRS += ${SRC_USR}/plugins
8686
# Individual source files to link.
8787
SOURCE_PLUGIN_FILES += ${SRC_USR}/common/rule/prdf_rule.mk
8888
SOURCE_PLUGIN_FILES += ${SRC_USR}/common/rule/tables.mk
89+
SOURCE_PLUGIN_FILES += ${SRC_USR}/common/util/prdfAssert.h
90+
SOURCE_PLUGIN_FILES += ${SRC_USR}/common/util/prdfBitString.C
91+
SOURCE_PLUGIN_FILES += ${SRC_USR}/common/util/prdfBitString.H
8992
SOURCE_PLUGIN_FILES += ${SRC_USR}/common/util/UtilHash.H
9093
SOURCE_PLUGIN_FILES += ${SRC_USR}/common/plat/mem/prdfMemConst.H
9194
SOURCE_PLUGIN_FILES += ${SRC_USR}/common/iipconst.h

0 commit comments

Comments
 (0)