From 98a08b2d958775aa9aafe963b049dbe4d17e8500 Mon Sep 17 00:00:00 2001 From: Martin Peschke Date: Thu, 19 May 2016 13:09:47 +0200 Subject: move production code from tools/imageProcs to chips/p9/utils/imageProcs Change-Id: I5a7bb15f7c1139886df9c2ad94760c93096528d8 Original-Change-Id: I516c770ec7fd6d1fb2f8f7933a2579038c13ce6d Reviewed-on: http://ralgit01.raleigh.ibm.com/gerrit1/24786 Tested-by: Jenkins Server Reviewed-by: Claus M. Olsen Reviewed-by: Richard J. Knight Reviewed-by: Martin Peschke Reviewed-on: http://ralgit01.raleigh.ibm.com/gerrit1/30300 Tested-by: Jenkins Server Reviewed-by: Sachin Gupta --- .../p9/utils/imageProcs/p9_infrastruct_help.H | 124 +++++++++++++++ .../p9/utils/imageProcs/p9_ring_identification.H | 176 +++++++++++++++++++++ 2 files changed, 300 insertions(+) create mode 100644 src/import/chips/p9/utils/imageProcs/p9_infrastruct_help.H create mode 100644 src/import/chips/p9/utils/imageProcs/p9_ring_identification.H (limited to 'src/import/chips') diff --git a/src/import/chips/p9/utils/imageProcs/p9_infrastruct_help.H b/src/import/chips/p9/utils/imageProcs/p9_infrastruct_help.H new file mode 100644 index 00000000..1eff1031 --- /dev/null +++ b/src/import/chips/p9/utils/imageProcs/p9_infrastruct_help.H @@ -0,0 +1,124 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/import/chips/p9/utils/imageProcs/p9_infrastruct_help.H $ */ +/* */ +/* OpenPOWER sbe Project */ +/* */ +/* Contributors Listed Below - COPYRIGHT 2016 */ +/* [+] 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 */ +#ifndef _P9_INFRASTRUCT_HELP_H_ +#define _P9_INFRASTRUCT_HELP_H_ + +#include +#include +#include +#include +#include +#include //open() +#include +#include //memcpy() +#include +#include + +// +// Various image/ring buffer sizes. Must be used by all users (VBU, FSP, HB, HBI, Cronus) +// +const uint32_t MAX_REF_IMAGE_SIZE = 1024 * + 1024; // Max reference image size. +const uint32_t FIXED_RING_BUF_SIZE = + 60000; // Fixed ring buf size for _fixed. + +#define CHIPLET_ID_MIN (uint8_t)0x00 +#define CHIPLET_ID_MAX (uint8_t)0x37 + +#define MY_INF(_fmt_, _args_...) printf(_fmt_, ##_args_) +#define MY_ERR(_fmt_, _args_...) printf(_fmt_, ##_args_) +#define MY_DBG(_fmt_, _args_...) printf(_fmt_, ##_args_) + + +// Byte-reverse a 32-bit integer +inline uint32_t myRev32(const uint32_t i_x) +{ + uint32_t rx; + +#ifdef _BIG_ENDIAN + rx = i_x; +#else + uint8_t* pix = (uint8_t*)(&i_x); + uint8_t* prx = (uint8_t*)(&rx); + + prx[0] = pix[3]; + prx[1] = pix[2]; + prx[2] = pix[1]; + prx[3] = pix[0]; +#endif + + return rx; +} + +// Byte-reverse a 64-bit integer +inline uint64_t myRev64(const uint64_t i_x) +{ + uint64_t rx; + +#ifdef _BIG_ENDIAN + rx = i_x; +#else + uint8_t* pix = (uint8_t*)(&i_x); + uint8_t* prx = (uint8_t*)(&rx); + + prx[0] = pix[7]; + prx[1] = pix[6]; + prx[2] = pix[5]; + prx[3] = pix[4]; + prx[4] = pix[3]; + prx[5] = pix[2]; + prx[6] = pix[1]; + prx[7] = pix[0]; +#endif + + return rx; +} + + +// Byte-reverse a 16-bit integer if on an LE machine +inline uint16_t myRev16(const uint16_t i_x) +{ + uint16_t rx; + +#ifdef _BIG_ENDIAN + rx = i_x; +#else + uint8_t* pix = (uint8_t*)(&i_x); + uint8_t* prx = (uint8_t*)(&rx); + + prx[0] = pix[1]; + prx[1] = pix[0]; +#endif + + return rx; +} + +// N-byte align an address, offset or size (aos) +inline uint64_t myByteAlign( const uint8_t nBytes, const uint64_t aos) +{ + return ((aos + nBytes - 1) / nBytes) * nBytes; +} + +#endif //_P9_INFRASTRUCT_HELP_H_ diff --git a/src/import/chips/p9/utils/imageProcs/p9_ring_identification.H b/src/import/chips/p9/utils/imageProcs/p9_ring_identification.H new file mode 100644 index 00000000..bd0dc488 --- /dev/null +++ b/src/import/chips/p9/utils/imageProcs/p9_ring_identification.H @@ -0,0 +1,176 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/import/chips/p9/utils/imageProcs/p9_ring_identification.H $ */ +/* */ +/* OpenPOWER sbe Project */ +/* */ +/* Contributors Listed Below - COPYRIGHT 2016 */ +/* [+] 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 */ + +#ifndef _P9_RING_IDENT_H_ +#define _P9_RING_IDENT_H_ +#include +#include +#include +#include + + +// General Ring ID list structure +typedef struct +{ + const char* ringName; + uint8_t ringId; + uint8_t instanceIdMin; // the min instanceId + uint8_t instanceIdMax; // the max instanceId + const char* ringNameImg; // Ring name in image: ringName + "_ring" + uint8_t vpdKeyword; + uint8_t pllCopy; // 0,1,2,3,4,5 -- No of PLL copies required + uint64_t scanRegionType; +} GenRingIdList; + +typedef struct +{ + uint16_t ring_offset; + uint16_t ring_size; +} Ring_toc_entry; + +namespace PERV +{ +extern const GenRingIdList RING_ID_LIST_COMMON[]; +extern const GenRingIdList RING_ID_LIST_INSTANCE[]; +} + +namespace N0 +{ +extern const GenRingIdList RING_ID_LIST_COMMON[]; +extern const GenRingIdList RING_ID_LIST_INSTANCE[]; +} + +namespace N1 +{ +extern const GenRingIdList RING_ID_LIST_COMMON[]; +extern const GenRingIdList RING_ID_LIST_INSTANCE[]; +} + +namespace N2 +{ +extern const GenRingIdList RING_ID_LIST_COMMON[]; +extern const GenRingIdList RING_ID_LIST_INSTANCE[]; +} + +namespace N3 +{ +extern const GenRingIdList RING_ID_LIST_COMMON[]; +extern const GenRingIdList RING_ID_LIST_INSTANCE[]; +} + +namespace XB +{ +extern const GenRingIdList RING_ID_LIST_COMMON[]; +extern const GenRingIdList RING_ID_LIST_INSTANCE[]; +} + +namespace MC +{ +extern const GenRingIdList RING_ID_LIST_COMMON[]; +extern const GenRingIdList RING_ID_LIST_INSTANCE[]; +} + +namespace OB +{ +extern const GenRingIdList RING_ID_LIST_COMMON[]; +extern const GenRingIdList RING_ID_LIST_INSTANCE[]; +} + +namespace PCI0 +{ +extern const GenRingIdList RING_ID_LIST_COMMON[]; +extern const GenRingIdList RING_ID_LIST_INSTANCE[]; +} + +namespace PCI1 +{ +extern const GenRingIdList RING_ID_LIST_COMMON[]; +extern const GenRingIdList RING_ID_LIST_INSTANCE[]; +} + +namespace PCI2 +{ +extern const GenRingIdList RING_ID_LIST_COMMON[]; +extern const GenRingIdList RING_ID_LIST_INSTANCE[]; +} + +namespace EQ +{ +extern const GenRingIdList RING_ID_LIST_COMMON[]; +extern const GenRingIdList RING_ID_LIST_INSTANCE[]; +} + +namespace EC +{ +extern const GenRingIdList RING_ID_LIST_COMMON[]; +extern const GenRingIdList RING_ID_LIST_INSTANCE[]; +} + +// VPD Ring ID list structure. +typedef struct +{ + const char* ringName; + uint8_t ringId; + uint8_t instanceIdMin; // the min instanceId + uint8_t instanceIdMax; // the max instanceId + const char* ringNameImg; // Ring name in image: ringName + "_ring" + uint8_t vpdKeyword; + uint8_t bWcSpace; // 0: fitted 1: worst-case space (3 x ring length) +} RingIdList; + + + +extern const RingIdList RING_ID_LIST_PG[], RING_ID_LIST_PR[]; +extern const uint32_t RING_ID_LIST_PG_SIZE, RING_ID_LIST_PR_SIZE; +extern const RingIdList RING_ID_LIST[]; +extern const uint32_t RING_ID_LIST_SIZE; + +extern const uint32_t RING_ID_LIST_CHIP_SIZE, RING_ID_LIST_CORE_SIZE, + RING_ID_LIST_CME_SIZE, RING_ID_LIST_CC_SIZE; + + +// Enumerated VPD keyword values. +// Note! This is DIFFERENT from the MvpdKeyword list in fapiMvpdAccess.H which +// can't be used in this file since it's not, per se, a fapi file. So +// these values need to be translated in xip_customize when passing the +// mvpdKeyword to getMvpdRing(); +enum VpdKeyword +{ + + VPD_KEYWORD_PDG = 0, + VPD_KEYWORD_PDR = 1, + NUM_OF_VPD_TYPES = 2, + NON_VPD_RING = 3, + NON_VPD_PLL_RING = 4, +}; + + + +int get_vpd_ring_list_entry(const char* i_ringName, + const uint8_t i_ringId, + RingIdList** i_ringIdList); + + +#endif -- cgit v1.2.1