summaryrefslogtreecommitdiffstats
path: root/src/import/chips/p9/procedures/hwp/cache/p9_l2err_linedelete.C
blob: 8ef374e75d2e4163461360a2e8df89b1f62dabab (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
/* IBM_PROLOG_BEGIN_TAG                                                   */
/* This is an automatically generated prolog.                             */
/*                                                                        */
/* $Source: src/import/chips/p9/procedures/hwp/cache/p9_l2err_linedelete.C $ */
/*                                                                        */
/* OpenPOWER HostBoot 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 p9_l2err_linedelete.C
///
/// @brief Delete the L2 error cache line according to the error extraction
///        information.
///        See more detailed description in header file.
///
/// *HWP HWP Owner   : Chen Qian <qianqc@cn.ibm.com>
/// *HWP FW Owner    : Thi Tran <thi@us.ibm.com>
/// *HWP Team        : Quad
/// *HWP Consumed by : PRDF
/// *HWP Level       : 3
///----------------------------------------------------------------------------

//------------------------------------------------------------------------------
// Includes
//------------------------------------------------------------------------------
#include <p9_l2err_linedelete.H>
#include <p9_l2_flush.H>
#include <p9_quad_scom_addresses.H>
#include <p9_quad_scom_addresses_fld.H>

//------------------------------------------------------------------------------
// Function definitions
//------------------------------------------------------------------------------

//------------------------------------------------------------------------------
// HWP entry point
//------------------------------------------------------------------------------
// See doxygen in header file
fapi2::ReturnCode p9_l2err_linedelete(
    const fapi2::Target<fapi2::TARGET_TYPE_EX>& i_target,
    const p9_l2err_extract_err_data& i_err_data,
    const uint64_t i_busyCount)
{
    fapi2::ReturnCode l_rc;
    fapi2::buffer<uint64_t> l_cmdReg;
    p9core::purgeData_t l_purgeData;

    // mark function entry
    FAPI_DBG("Entering p9_l2err_linedelete. BusyCount %d", i_busyCount);

    //   +---------------------------+
    //   |    L2 Line Delete Scom    |
    //   +---------------------------+
    //   |Bit(s)|  Data              |
    //   +------+--------------------+
    //   |    0 | Trigger            |
    //   +------+--------------------+
    //   |  1:4 | Purge type (LD=0x2)|
    //   +------+--------------------+
    //   | 5:16 | Don't care         |
    //   +------+--------------------+
    //   |17:19 | Member             |
    //   +------+--------------------+
    //   |20:27 | CGC  addr 48:55    |
    //   +------+--------------------+
    //   |   28 | Bank               |
    //   +------+--------------------+
    //   |29:30 | Don't care         |
    //   +------+--------------------+

    // Write member, address and bank into PRD Purge Engine Command Register
    // SCOM Addr: 0x000000001001080E
    // bit 0 is the trigger, the act of writing this bit to 1 sets off the line delete
    // bits 1:4 is ttype 0b0010 = line delete
    // bits 17:19 is the member
    // bits 20:27 is the cgc address
    // bit 28 is the bank

    // Ensure that purge engine is idle before starting line delete
    FAPI_TRY(purgeCompleteCheck(i_target, i_busyCount, l_cmdReg),
             "Error returned from purgeCompleteCheck call");

    // Set PRD Purge Engine Command register values for line delete
    l_purgeData.iv_cmdType = 0b0010; // L2 Dir Line_Delete
    l_purgeData.iv_cmdMem = i_err_data.member;
    l_purgeData.iv_cmdBank = i_err_data.bank;
    l_purgeData.iv_cmdCGC = i_err_data.address;

    FAPI_TRY(setupAndTriggerPrdPurge(i_target, l_purgeData, l_cmdReg),
             "Error returned from setupAndTriggerPrdPurge");

    // Verify purge/line delete complete
    FAPI_TRY(purgeCompleteCheck(i_target, i_busyCount, l_cmdReg),
             "Error returned from purgeCompleteCheck call");

fapi_try_exit:
    FAPI_INF("Exiting p9_l2err_linedelete...");
    return fapi2::current_err;
} // p9_l2err_extract
OpenPOWER on IntegriCloud