Skip to content

Commit bdf8d5b

Browse files
aalugoredcrowell77
authored andcommitted
P9 Updates for occ communication code
This commit contains updates for p9 OCC communication code to no longer use the deprecated ecmdDataBufferBase class. Change-Id: I96b6be564a6edee1f66099583f030d3b519acb60 Depends-on: I6182163e569ac97f06e3ddfbb69deab90e849de3 Reviewed-on: http://ralgit01.raleigh.ibm.com/gerrit1/31876 Reviewed-by: Martin Gloff <mgloff@us.ibm.com> Tested-by: Jenkins Server <pfd-jenkins+hostboot@us.ibm.com> Tested-by: FSP CI Jenkins <fsp-CI-jenkins+hostboot@us.ibm.com> Tested-by: Jenkins OP Build CI <op-jenkins+hostboot@us.ibm.com> Reviewed-by: Christopher J. Cain <cjcain@us.ibm.com> Reviewed-by: Daniel M. Crowell <dcrowell@us.ibm.com>
1 parent c4692b7 commit bdf8d5b

File tree

6 files changed

+125
-77
lines changed

6 files changed

+125
-77
lines changed

src/include/usr/occ/occAccess.H

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -31,30 +31,33 @@
3131

3232
namespace HBOCC
3333
{
34-
3534
/**
3635
* @brief Read OCC SRAM
3736
*
3837
* @param[in] i_pTarget PROC or OCC target pointer
3938
* @param[in] i_addr OCI Address to be used for the operation
4039
* @param[in,out] io_dataBuf Reference to data buffer
40+
* @param[in] i_dataLen Size of the data to read
4141
* @return errlHndl_t Error log if operation failed
4242
*/
4343
errlHndl_t readSRAM(const TARGETING::Target*i_pTarget,
44-
const uint32_t i_addr,
45-
ecmdDataBufferBase & io_dataBuf);
44+
const uint32_t i_addr,
45+
uint64_t * io_dataBuf,
46+
size_t i_dataLen );
4647

4748
/**
4849
* @brief Write OCC SRAM
4950
*
5051
* @param[in] i_pTarget PROC or OCC target pointer
5152
* @param[in] i_addr OCI Address to be used for the operation
5253
* @param[in] i_dataBuf Reference to data buffer
54+
* @param[in] i_dataLen Size of the data to write
5355
* @return errlHndl_t Error log if operation failed
5456
*/
5557
errlHndl_t writeSRAM(const TARGETING::Target*i_pTarget,
56-
const uint32_t i_addr,
57-
ecmdDataBufferBase & io_dataBuf);
58+
const uint32_t i_addr,
59+
uint64_t * io_dataBuf,
60+
size_t i_dataLen );
5861

5962
/**
6063
* @brief Write OCC Circular Buffer
@@ -64,7 +67,7 @@ namespace HBOCC
6467
* @return errlHndl_t Error log if operation failed
6568
*/
6669
errlHndl_t writeCircularBuffer(const TARGETING::Target*i_pTarget,
67-
ecmdDataBufferBase & i_dataBuf);
70+
uint64_t * i_dataBuf);
6871

6972
} //end OCC namespace
7073

src/usr/htmgt/htmgt_occ.C

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,11 +37,11 @@
3737
#include <targeting/common/targetservice.H>
3838
#include <console/consoleif.H>
3939
#include <sys/time.h>
40-
#include <ecmdDataBufferBase.H>
4140
#include <occ/occAccess.H>
4241
#include <occ/occ.H>
4342
#include <occ/occ_common.H>
4443
#include <errl/errludlogregister.H>
44+
#include <buffer.H>
4545

4646
namespace HTMGT
4747
{
@@ -932,14 +932,17 @@ namespace HTMGT
932932
// Read SRAM response buffer to check for OCC checkpoint
933933
errlHndl_t l_err = NULL;
934934
const uint16_t l_length = 8;
935-
ecmdDataBufferBase l_buffer(l_length*8); // convert to bits
935+
936+
fapi2::buffer<uint64_t> l_buffer;
936937
l_err = HBOCC::readSRAM(occ->getTarget(),
937938
OCC_RSP_SRAM_ADDR,
938-
l_buffer);
939+
l_buffer.pointer(),
940+
l_length);
939941
if (NULL == l_err)
940942
{
941943
// Check response status for checkpoint (byte 6-7)
942-
const uint16_t checkpoint = l_buffer.getHalfWord(3);
944+
uint16_t checkpoint = 0;
945+
l_buffer.extractToRight<48,16>(checkpoint);
943946
if (checkpoint != lastCheckpoint)
944947
{
945948
TMGT_INF("_waitForOccCheckpoint: OCC%d Checkpoint "

src/usr/htmgt/htmgt_occcmd.C

Lines changed: 22 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,8 @@
4343
#include <errl/errlmanager.H>
4444
#include <stdio.h>
4545
#include <console/consoleif.H>
46-
46+
#include <variable_buffer.H>
47+
#include <fapi2.H>
4748

4849
namespace HTMGT
4950
{
@@ -794,34 +795,34 @@ namespace HTMGT
794795
#ifdef CONFIG_HTMGT
795796
// Read SRAM to check for exception
796797
// (Exception data not copied into HOMER)
797-
const uint16_t l_length = 4*KILOBYTE;
798-
uint8_t l_sram_data[l_length];
799-
ecmdDataBufferBase l_buffer(l_length*8); // convert to bits
798+
const size_t l_length = 4*KILOBYTE;
799+
800+
fapi2::variable_buffer l_buffer(l_length*8); // convert to bits
801+
800802
errlHndl_t l_err = HBOCC::readSRAM(iv_Occ->getTarget(),
801-
OCC_RSP_SRAM_ADDR,
802-
l_buffer);
803+
OCC_RSP_SRAM_ADDR,
804+
reinterpret_cast<uint64_t*>(l_buffer.pointer()),
805+
l_length );
803806
if (NULL == l_err)
804807
{
805-
const uint32_t l_flatSize = l_buffer.flattenSize();
806-
l_buffer.flatten(l_sram_data, l_flatSize);
807-
// Skip 8 byte ecmd header
808-
const uint8_t *sramRspPtr = &l_sram_data[8];
808+
auto sramRspPtr = reinterpret_cast<uint8_t*>(l_buffer.pointer());
809+
uint32_t l_sramDataLen = l_buffer.getLength<uint8_t>();
809810
// Check buffer status for exception
810-
if ((l_flatSize >= 3) && (0xE0 == (sramRspPtr[2] & 0xE0)))
811+
if ((l_sramDataLen >= 3) && (0xE0 == (sramRspPtr[2] & 0xE0)))
811812
{
812813
const uint8_t exceptionType = sramRspPtr[2];
813814
uint16_t exceptionDataLength = 0;
814-
if (l_flatSize >= 5)
815+
if (l_sramDataLen >= 5)
815816
{
816817
exceptionDataLength = UINT16_GET(&sramRspPtr[3]);
817818
}
818819
// Exception length includes response header (w/o checksum) and
819820
// the data length
820821
uint32_t exceptionLength = OCC_RSP_HDR_LENGTH - 2 +
821822
exceptionDataLength;
822-
if (exceptionLength > l_flatSize)
823+
if (exceptionLength > l_sramDataLen)
823824
{
824-
exceptionLength = l_flatSize;
825+
exceptionLength = l_sramDataLen;
825826
}
826827

827828
TMGT_ERR("handleOccException: OCC%d SRAM has exception"
@@ -896,21 +897,24 @@ namespace HTMGT
896897

897898
// Notify OCC that command is available (via circular buffer)
898899
const uint32_t l_bitsToSend = sizeof(occCircBufferCmd_t) * 8;
899-
ecmdDataBufferBase l_circ_buffer(l_bitsToSend);
900+
900901
const occCircBufferCmd_t tmgtDataWriteAttention =
901902
{
902903
0x10, // sender: HTMGT
903904
0x01, // command: Command Write Attention
904905
{0, 0, 0, 0, 0, 0} // reserved
905906
};
906-
l_circ_buffer.insert((uint8_t*)&tmgtDataWriteAttention, 0,
907-
l_bitsToSend);
907+
908+
fapi2::buffer<uint64_t> l_circ_buffer;
909+
l_circ_buffer.insert((*(uint64_t*)&tmgtDataWriteAttention),0, l_bitsToSend);
910+
911+
908912
if (G_debug_trace & DEBUG_TRACE_VERBOSE)
909913
{
910914
TMGT_INF("writeOccCmd: Calling writeCircularBuffer()");
911915
}
912916
#ifdef CONFIG_HTMGT
913-
l_err = HBOCC::writeCircularBuffer(iv_Occ->iv_target, l_circ_buffer);
917+
l_err = HBOCC::writeCircularBuffer(iv_Occ->iv_target, l_circ_buffer.pointer());
914918
if (NULL != l_err)
915919
{
916920
TMGT_ERR("writeOccCmd: Error writing to OCC Circular Buffer,"

src/usr/htmgt/occError.C

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,10 @@
2929
#include "occError.H"
3030
#include "htmgt_occcmd.H"
3131

32-
#include <ecmdDataBufferBase.H>
3332
#include <occ/occAccess.H>
3433
#include <console/consoleif.H>
3534
#include <targeting/targplatutil.H>
36-
35+
#include <variable_buffer.H>
3736

3837
namespace HTMGT
3938
{
@@ -93,19 +92,20 @@ namespace HTMGT
9392
errlHndl_t l_errlHndl = NULL;
9493

9594
// Read data from SRAM (length must be multiple of 8 bytes)
96-
const uint16_t l_length = (i_length + 8) & 0xFFF8;
97-
uint8_t l_sram_data[8 + l_length];
98-
ecmdDataBufferBase l_buffer(l_length*8); // convert to bits
95+
const uint16_t l_length = (i_length) & 0xFFF8;
96+
fapi2::variable_buffer l_buffer(l_length*8); //convert to bits
9997
// HBOCC is only defined for HTMGT
10098
#ifdef CONFIG_HTMGT
101-
l_errlHndl = HBOCC::readSRAM(iv_target, i_address, l_buffer);
99+
l_errlHndl = HBOCC::readSRAM( iv_target,
100+
i_address,
101+
reinterpret_cast<uint64_t*>(l_buffer.pointer()),
102+
l_length );
102103
#endif
103104
if (NULL == l_errlHndl)
104105
{
105-
const uint32_t l_flatSize = l_buffer.flattenSize();
106-
l_buffer.flatten(l_sram_data, l_flatSize);
107-
// Skip 8 byte ecmd header
108-
const occErrlEntry_t *l_occElog=(occErrlEntry_t *)&l_sram_data[8];
106+
107+
const occErrlEntry_t * l_occElog= reinterpret_cast<occErrlEntry_t*>
108+
(l_buffer.pointer());
109109

110110
TMGT_BIN("OCC ELOG", l_occElog, 256);
111111

0 commit comments

Comments
 (0)