summaryrefslogtreecommitdiffstats
path: root/src/usr/isteps/istep10/host_proc_pcie_scominit.H
blob: c09aae00eef6c922688ed94363d5c48a1a543eab (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
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
/* IBM_PROLOG_BEGIN_TAG                                                   */
/* This is an automatically generated prolog.                             */
/*                                                                        */
/* $Source: src/usr/isteps/istep10/host_proc_pcie_scominit.H $            */
/*                                                                        */
/* OpenPOWER HostBoot Project                                             */
/*                                                                        */
/* Contributors Listed Below - COPYRIGHT 2016,2018                        */
/* [+] 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 __ISTEPS_HOST_PROC_PCIE_SCOMINIT_H
#define __ISTEPS_HOST_PROC_PCIE_SCOMINIT_H

/******************************************************************************/
// Includes
/******************************************************************************/
#include    <stdint.h>

namespace   ISTEP_10
{

/**
 *  @brief Computes PCIE configuration attributes based on MRW values
 *
 *  @param i_pProcChipTarget: Proc chip to compute the PCIE Configuration
 *      attributes for.
 */
errlHndl_t computeProcPcieConfigAttrs(TARGETING::Target* i_pProcChipTarget);

/**
 *  @brief # of bits in a byte for computation purposes
 */
static const size_t BITS_PER_BYTE = 8;

/**
 *  @brief Container for holding IOPs to bifurcate
 */
typedef std::list<uint32_t> BifurcatedIopsContainer;

/**
 *  @brief Enum indicating number of usable IOP lanes for a proc
 */
enum IopLanesPerProc
{
    IOP_LANES_PER_PROC_48X = 48,// 48 Lanes per proc
};

/**
 *  @brief Struct for PCIE lane properties within IOP configuration tables
 */
struct LaneSet
{
    uint8_t width; // Width of each PCIE lane set (0, 4, 8, or 16)
};

/**
 *  @brief Lane groups per PEC
 */
static const size_t MAX_LANE_GROUPS_PER_PEC = 4;

/**
 *  @brief Struct for each row in PCIE IOP configuration table.
 *      Used by code to compute the IOP config and PHBs active mask.
 */
struct laneConfigRow
{
    // Grouping of lanes under one IOP
    LaneSet laneSet[MAX_LANE_GROUPS_PER_PEC];

    // IOP config value from PCIE IOP configuration table
    uint8_t laneConfig;

    // PHB active mask (see PhbActiveMask enum)
    // PHB0 = 0x80
    // PHB1 = 0x40
    // PHB2 = 0x20
    // PHB3 = 0x10
    // PHB4 = 0x08
    // PHB5 = 0x04
    uint8_t phbActive;
    uint16_t phb_to_pcieMAC;
};

/**
 *  @brief Enum indicating lane width (units = "number of lanes")
 */
enum LaneWidth
{
    LANE_WIDTH_NC  = 0,
    LANE_WIDTH_4X  = 4,
    LANE_WIDTH_8X  = 8,
    LANE_WIDTH_16X = 16
};

/**
 *  @brief Enumeration of lane mask values
 */
enum LaneMask
{
    LANE_MASK_X16     = 0xFFFF,
    LANE_MASK_X8_GRP0 = 0xFF00,
    LANE_MASK_X8_GRP1 = 0x00FF,
    LANE_MASK_X4_GRP0 = 0x00F0,
    LANE_MASK_X4_GRP1 = 0x000F,
};

/**
 *  @brief Enumeration of PHB to PCI MAC mappings
 */
enum PhbToMAC
{
    PHB_X16_MAC_MAP      = 0x0000,
    PHB_X8_X8_MAC_MAP    = 0x0050,
    PHB_X8_X4_X4_MAC_MAP = 0x0090,
};

/**
 *  @brief Enum giving bitmask values for enabled PHBs
 */
enum PhbActiveMask
{
    PHB_MASK_NA = 0x00, ///< Sentinel mask (loop terminations)
    PHB0_MASK   = 0x80, ///< PHB0 enabled
    PHB1_MASK   = 0x40, ///< PHB1 enabled
    PHB2_MASK   = 0x20, ///< PHB2 enabled
    PHB3_MASK   = 0x10, ///< PHB3 enabled
    PHB4_MASK   = 0x08, ///< PHB4 enabled
    PHB5_MASK   = 0x04, ///< PHB5 enabled
};

};

#endif
OpenPOWER on IntegriCloud