summaryrefslogtreecommitdiffstats
path: root/src/import/chips/p9/xip/p9_image_help_base.H
blob: 7b1e550c6db5f7387004341a09f0892210910c4c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
/* IBM_PROLOG_BEGIN_TAG                                                   */
/* This is an automatically generated prolog.                             */
/*                                                                        */
/* $Source: chips/p9/xip/p9_image_help_base.H $                           */
/*                                                                        */
/* IBM CONFIDENTIAL                                                       */
/*                                                                        */
/* EKB Project                                                            */
/*                                                                        */
/* COPYRIGHT 2015,2016                                                    */
/* [+] International Business Machines Corp.                              */
/*                                                                        */
/*                                                                        */
/* The source code for this program is not published or otherwise         */
/* divested of its trade secrets, irrespective of what has been           */
/* deposited with the U.S. Copyright Office.                              */
/*                                                                        */
/* IBM_PROLOG_END_TAG                                                     */

#ifndef _P9_IMAGE_HELP_BASE_H_
#define _P9_IMAGE_HELP_BASE_H_

#include <p9_xip_image.h>

//
// Various image/ring buffer sizes. Must be used by all users (VBU, FSP, HB, HBI, Cronus)
//
const uint32_t  MAX_REF_IMAGE_SIZE      =   5000000; // Max reference image size.
const uint32_t  FIXED_SEEPROM_WORK_SPACE =  128 * 1024; // Max work space for Seeprom img.
const uint32_t  MAX_SEEPROM_IMAGE_SIZE  =   56 * 1024; // Max Seeprom image size.
const uint32_t  FIXED_RING_BUF_SIZE     =     60000; // Fixed ring buf size for _fixed.

const uint8_t   MAX_VPD_TYPES           =   2;   // #G and #R, so far.
#define         CHIPLET_ID_MIN            0x00
#define         CHIPLET_ID_MAX            0x1F
#define         CHIPLET_ID_EX_MIN         0x10
#define         CHIPLET_ID_EX_MAX         0x1F
const uint8_t   MAX_CHIPLETS            = CHIPLET_ID_MAX - CHIPLET_ID_MIN + 1;
const uint32_t  ASM_RS4_LAUNCH_BUF_SIZE =  24; // Byte size of RS4 launch buffer.
const uint32_t  WF_ENCAP_SIZE           = 400; // Byte size of WF encapsulation.
// (Actually, only 304B but may change.)
const uint32_t  WF_WORST_CASE_SIZE_FAC  =   4; // WC WF size = 3x ring length.
// (Assumes 12B per write.)
// (4x w/waits instructions.)
const uint32_t  LISTING_STRING_SIZE     = 256;
const uint64_t  MAX_UINT64_T            = (uint64_t)0xFFFFFFFF << 32 | (uint64_t)0xFFFFFFFF;

#ifdef __cplusplus
extern "C" {
#endif

// Base (shared) ring layout for both RS4 and Wiggle-flip layouts.
typedef struct
{
    uint64_t entryOffset;
    uint64_t backItemPtr;
    uint32_t sizeOfThis;
    uint32_t sizeOfMeta; // Exact size of meta data. Arbitrary size. Not null terminated.
} BaseRingLayout;

// RS4 specific layout.
typedef struct
{
    uint64_t entryOffset;
    uint64_t backItemPtr;
    uint32_t sizeOfThis;
    uint32_t sizeOfMeta; // Exact size of meta data. Arbitrary size. Not null terminated.
    uint32_t ddLevel;
    uint8_t  sysPhase;
    uint8_t  override;
    uint8_t  reserved1;
    uint8_t  reserved2;
} Rs4RingLayout;

// PairingInfo is used for pairing, or matching, a back pointer address of a
// ring block with its corresponding TOC name.
typedef struct
{
    uint64_t address;     // (in) Holds HOMER backPtr addr of the ring
    uint8_t  vectorpos;   // (in) Vector position of fwdPtr [0;31]
    //      max=0  for most VPD rings
    //      max=1  for all non-VPD rings
    //      max=1  for perv_ VPD rings
    //      max=15 for most VPD ex_ rings
    //      max=31 for 16 ex_ chiplets with override
    char*     name;       // (out) TOC name
    uint8_t  isvpd;       // (out) 0: Non-VPD ring  1: VPD ring
    uint8_t  overridable; // (out) 0: No (most VPD rings)  1: Yes (all non-VPD rings)
    uint8_t  override;    // (out) 0: base  1: override
} PairingInfo;


///
/// ****************************************************************************
/// Function declares.
/// ****************************************************************************
///
int over_write_ring_data_in_image(  void*            io_image,
                                    const char*      i_ringName,
                                    const void*      i_ringData,    // WF or RS4
                                    const uint32_t  i_sizeRingData, // Byte size
                                    const uint8_t   i_idxVector,
                                    const uint8_t   i_override,
                                    const uint8_t   i_overridable );


#ifdef __cplusplus
}
#endif

#endif //_P8_IMAGE_HELP_BASE_H_
OpenPOWER on IntegriCloud