summaryrefslogtreecommitdiffstats
path: root/src/sbefw/sbecmdgeneric.H
blob: af14541ffa492a1d17fced0c1671d0f91489947a (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
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
/* IBM_PROLOG_BEGIN_TAG                                                   */
/* This is an automatically generated prolog.                             */
/*                                                                        */
/* $Source: src/sbefw/sbecmdgeneric.H $                                   */
/*                                                                        */
/* OpenPOWER sbe Project                                                  */
/*                                                                        */
/* Contributors Listed Below - COPYRIGHT 2016,2017                        */
/* [+] 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                                                     */
/*
 * @file: ppe/sbe/sbefw/sbecmdgeneric.H
 *
 * @brief This file contains the SBE Generic command details
 *
 */

#ifndef __SBEFW_SBECMDGENERIC_H
#define __SBEFW_SBECMDGENERIC_H

#include <stdint.h>
#include <p9_sbe_hb_structures.H>

typedef struct sbeStashMemoryPair
{
    // This is coming from p9_sbe_hb_structures.H
    keyAddrPair_t keyValuePairfromHost;

    // Default Constructor to initialize addr/key to 0xFF
    sbeStashMemoryPair()
    {
        for(uint8_t cnt=0; cnt<MAX_ROW_COUNT; cnt++)
        {
            keyValuePairfromHost.addr[cnt] = 0xFFFFFFFFFFFFFFFFULL;
            keyValuePairfromHost.key[cnt] = 0xFF;
        }
    }

    bool updatePair(uint8_t key, uint64_t addr)
    {
        bool l_return = false;
        // Check if Key already exist, if yes update addr there
        for(uint8_t cnt=0; cnt<MAX_ROW_COUNT; cnt++)
        {
            if(keyValuePairfromHost.key[cnt] == key)
            {
                keyValuePairfromHost.addr[cnt] = addr;
                l_return = true;
                break;
            }
        }
        if(false == l_return) // Insert the new key into a free pair
        {
            for(uint8_t cnt=0; cnt<MAX_ROW_COUNT; cnt++)
            {
                if(keyValuePairfromHost.key[cnt] == 0xFF)
                {
                    keyValuePairfromHost.key[cnt] = key;
                    keyValuePairfromHost.addr[cnt] = addr;
                    l_return = true;
                    break;
                }
            }
        }
        return l_return;
    }

    uint64_t fetchStashAddrAttribute()
    {
        return (uint64_t)((uint8_t*)(&keyValuePairfromHost));
    }
}sbeStashMemoryPair_t;

// Message struct to receive the key/addr pair from host
typedef struct stashMsg
{
    uint64_t reserve:56;
    uint64_t key:8;
    uint64_t addr;
}stashMsg_t;

/**
  * @brief retrieve SBE FFDC on request from FSP.  (0xA801)
  *
  * @param[in] i_pArg Buffer to be passed to the function (not used as of now)
  *
  * @return    Rc from the FIFO access utility
  */
uint32_t sbeGetFfdc(uint8_t *i_pArg);

/**
  * @brief SBE Generic capabilities  (0xA802)
  *
  * @param[in] i_pArg Buffer to be passed to the function (not used as of now)
  *
  * @return    Rc from the FIFO access utility
  */
uint32_t sbeGetCapabilities(uint8_t *i_pArg);

/**
  * @brief SBE Fifo Quiesce (0xA806)
  *
  * @param[in] i_pArg Buffer to be passed to the function (not used as of now)
  *
  * @return    Rc from the FIFO access utility
  */
uint32_t sbeFifoQuiesce(uint8_t *i_pArg);

/**
  * @brief SBE Psu Set FFDC Address(0xD704)
  *
  * @param[in] i_pArg Buffer to be passed to the function (not used as of now)
  *
  * @return    Rc from the Psu access utility
  */
uint32_t sbeSetFFDCAddr(uint8_t *i_pArg);

/**
  * @brief SBE Psu Quiesce (0xD705)
  *
  * @param[in] i_pArg Buffer to be passed to the function (not used as of now)
  *
  * @return    Rc from the Psu access utility
  */
uint32_t sbePsuQuiesce(uint8_t *i_pArg);

/**
  * @brief SBE Psu Set System Fabric Map (0xD706)
  *
  * @param[in] i_pArg Buffer to be passed to the function (not used as of now)
  *
  * @return    Rc from the Psu access utility
  */
uint32_t sbeSetSystemFabricMap(uint8_t *i_pArg);

/**
  * @brief SBE stash the key addr pair into sbe memory (0xD707)
  *
  * @param[in] i_pArg Buffer to be passed to the function (not used as of now)
  *
  * @return    Rc from the Psu access utility
  */
uint32_t sbeStashKeyAddrPair(uint8_t *i_pArg);

/**
  * @brief Read the data from SBE memory (0xD703)
  *
  * @param[in] i_pArg Buffer to be passed to the function (not used as of now)
  *
  * @return    Rc from the Psu access utility
  */
uint32_t sbeReadMem(uint8_t *i_pArg);
#endif // __SBEFW_SBECMDGENERIC_H
OpenPOWER on IntegriCloud