Skip to content

Commit

Permalink
Fix ast_mbox assert compile issue
Browse files Browse the repository at this point in the history
Change-Id: I793a21d2b406fd3353f7fb0fd5ae6c37c86166a2
Reviewed-on: http://ralgit01.raleigh.ibm.com/gerrit1/41945
Tested-by: FSP CI Jenkins <fsp-CI-jenkins+hostboot@us.ibm.com>
Reviewed-by: ILYA SMIRNOV <ismirno@us.ibm.com>
Reviewed-by: Prachi Gupta <pragupta@us.ibm.com>
Reviewed-by: William A. Bryan <wilbryan@us.ibm.com>
  • Loading branch information
wghoffa authored and wilbryan committed Jun 16, 2017
1 parent 2c1662e commit 1dc97a6
Show file tree
Hide file tree
Showing 5 changed files with 45 additions and 19 deletions.
48 changes: 35 additions & 13 deletions src/occ_405/firdata/ast_mboxdd.h
Expand Up @@ -26,8 +26,6 @@
#ifndef __AST_MBOXDD_H
#define __AST_MBOXDD_H

#include <assert.h>

/** @file ast_mboxdd.H
* @brief Provides the interfaces Aspeed MBOX hardware
*/
Expand Down Expand Up @@ -120,7 +118,11 @@ errorHndl_t readRegSIO(uint8_t i_regAddr,
*/
inline uint8_t get8( mboxMessage_t *i_msg, uint8_t i_index)
{
assert( i_index < BMC_MBOX_ARGS_REGS);
if ( i_index >= BMC_MBOX_ARGS_REGS )
{
return 0;
}

return i_msg->iv_args[i_index];
}

Expand All @@ -131,9 +133,13 @@ inline uint8_t get8( mboxMessage_t *i_msg, uint8_t i_index)
* @param[in] i_index: Index into args section to be written to
* @param[in] i_value: data to be written
*/
inline void put8( mboxMessage_t *i_msg, uint8_t i_index, uint8_t i_value )
inline void put8( mboxMessage_t *i_msg, uint8_t i_index, uint8_t i_value )
{
assert( i_index < BMC_MBOX_ARGS_REGS);
if ( i_index >= BMC_MBOX_ARGS_REGS )
{
return;
}

i_msg->iv_args[i_index] = i_value;
}

Expand All @@ -146,7 +152,11 @@ inline void put8( mboxMessage_t *i_msg, uint8_t i_index, uint8_t i_value )
*/
inline uint16_t get16( mboxMessage_t *i_msg, uint8_t i_index )
{
assert( i_index < (BMC_MBOX_ARGS_REGS - 1));
if ( i_index >= (BMC_MBOX_ARGS_REGS-1) )
{
return 0;
}

return i_msg->iv_args[i_index] | (i_msg->iv_args[i_index + 1] << 8);
}

Expand All @@ -159,7 +169,11 @@ inline uint16_t get16( mboxMessage_t *i_msg, uint8_t i_index )
*/
inline void put16( mboxMessage_t *i_msg, uint8_t i_index, uint16_t i_value )
{
assert( i_index < (BMC_MBOX_ARGS_REGS - 1));
if ( i_index >= (BMC_MBOX_ARGS_REGS-1) )
{
return;
}

i_msg->iv_args[i_index] = i_value & 0xff;
i_msg->iv_args[i_index + 1] = i_value >> 8;
}
Expand All @@ -174,7 +188,11 @@ inline void put16( mboxMessage_t *i_msg, uint8_t i_index, uint16_t i_value )
*/
inline uint32_t get32( mboxMessage_t *i_msg, uint8_t i_index )
{
assert( i_index < (BMC_MBOX_ARGS_REGS - 3));
if ( i_index >= (BMC_MBOX_ARGS_REGS-3) )
{
return 0;
}

return i_msg->iv_args[i_index] |
(i_msg->iv_args[i_index + 1] << 8) |
(i_msg->iv_args[i_index + 2] << 16) |
Expand All @@ -189,11 +207,15 @@ inline uint32_t get32( mboxMessage_t *i_msg, uint8_t i_index )
*/
inline void put32( mboxMessage_t *i_msg, uint8_t i_index, uint32_t i_value )
{
assert( i_index < (BMC_MBOX_ARGS_REGS - 3));
i_msg->iv_args[i_index] = i_value & 0xff;
i_msg->iv_args[i_index + 1] = (i_value >> 8) & 0xff;
i_msg->iv_args[i_index + 2] = (i_value >> 16) & 0xff;
i_msg->iv_args[i_index + 3 ] = i_value >> 24;
if ( i_index >= (BMC_MBOX_ARGS_REGS-3) )
{
return;
}

i_msg->iv_args[i_index] = i_value & 0xff;
i_msg->iv_args[i_index + 1] = (i_value >> 8) & 0xff;
i_msg->iv_args[i_index + 2] = (i_value >> 16) & 0xff;
i_msg->iv_args[i_index + 3 ] = i_value >> 24;
}

typedef struct {
Expand Down
13 changes: 10 additions & 3 deletions src/occ_405/firdata/pnor_mboxdd.c
Expand Up @@ -36,7 +36,6 @@
#include <norflash.h>
#include <pnor_mboxdd.h>
#include <lpc.h>
#include <assert.h>
extern int TRACE_PNOR_MBOX;
int TRACE_PNOR_MBOX = 0;

Expand Down Expand Up @@ -106,7 +105,11 @@ errorHndl_t readFlash(pnorMbox_t* i_pnorMbox,
do
{
// Ensure we are operating on a 4-byte boundary
assert( i_size % 4 == 0);
if (i_size % 4 != 0)
{
TRAC_ERR("readFlash: not on 4-byte boundary");
return FAIL;
}

TRAC_INFO("readFlash(i_addr=0x%.8X)> ", i_addr);

Expand Down Expand Up @@ -161,7 +164,11 @@ errorHndl_t writeFlash(pnorMbox_t* i_pnorMbox,
do
{
// Ensure we are operating on a 4-byte boundary
assert( i_size % 4 == 0 );
if (i_size % 4 != 0)
{
TRAC_ERR("writeFlash: not on 4-byte boundary");
return FAIL;
}

TRAC_INFO(ENTER_MRK"writeFlash(i_address=0x%llx)> ", i_addr);

Expand Down
1 change: 0 additions & 1 deletion src/occ_405/firdata/pnor_util.c
Expand Up @@ -27,7 +27,6 @@

#include <native.h>
#include <pnor_mboxdd.h>
#include <ecc.h>
#include <pnor_util.h>
#include <norflash.h>

Expand Down
1 change: 0 additions & 1 deletion src/occ_405/occLinkInputFile
Expand Up @@ -98,7 +98,6 @@ INPUT ( amec_amester.o
timer.o
trac_interface.o
wof.o
ecc.o
firData.o
fir_data_collect.o
fsi.o
Expand Down
1 change: 0 additions & 1 deletion src/occ_405/topfiles.mk
Expand Up @@ -65,7 +65,6 @@ TOP-C-SOURCES = amec/amec_analytics.c \
dimm/dimm_control.c \
errl/errl.c \
firdata/ast_mboxdd.c \
firdata/ecc.c \
firdata/firData.c \
firdata/fir_data_collect.c \
firdata/fsi.c \
Expand Down

0 comments on commit 1dc97a6

Please sign in to comment.