summaryrefslogtreecommitdiffstats
path: root/pk/ppe42/ppe42_scom.c
blob: aee9db24e52a5b09f6ccd3d840708253bcbb2387 (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
//-----------------------------------------------------------------------------
// *! (C) Copyright International Business Machines Corp. 2015
// *! All Rights Reserved -- Property of IBM
// *! *** IBM Confidential ***
//-----------------------------------------------------------------------------

/// \file   ppe42_scom.c
/// \brief  Lowest level PK SCOM definitions.
///
/// Currently these SCOM functions are only optimized for functionality, not
/// speed. Speed optimization will be done when we have full compiler support
/// for the low-level stvd and lvd SCOM OPs.
///
/// A FAPI-lite SCOM can call these PK SCOM functions.
///
/// Comment:
/// - No need to poll for SCOM completion, nor return error code of SCOM fails.
///   A SCOM fail will cause the GPE to hang if configured to do so. But do we
///   necessarily have to do this?  Wouldn't a gentle recovery from a SCOM fail
///   be preferred?

#include "pk.h"
#include "ppe42_scom.h"
#include "ppe42_msr.h"


uint32_t putscom_abs(const uint32_t i_address, uint64_t i_data)
{

    // Perform the Store Virtual Double instruction
    PPE_STVD(i_address, i_data);

    // Get the MSR[SIBRC] as the return code   
    uint32_t rc = mfmsr();
    rc = ((rc & MSR_SIBRC) >> (32-(MSR_SIBRC_START_BIT + MSR_SIBRC_LEN)));
    return (rc);
    
}

uint32_t _putscom( uint32_t i_chiplet_id, uint32_t i_address, uint64_t i_data)
{

    // Perform the Store Virtual Double Index instruction
    PPE_STVDX(i_chiplet_id, i_address, i_data);

    // Get the MSR[SIBRC] as the return code   
    uint32_t rc = mfmsr();
    rc = ((rc & MSR_SIBRC) >> (32-(MSR_SIBRC_START_BIT + MSR_SIBRC_LEN)));
    return (rc);

}

uint32_t getscom_abs( const uint32_t i_address, uint64_t *o_data)
{
    
    // Perform the Load Virtual Double instruction
    PPE_LVD(i_address, o_data);

    // Get the MSR[SIBRC] as the return code   
    uint32_t rc = mfmsr();
    rc = ((rc & MSR_SIBRC) >> (32-(MSR_SIBRC_START_BIT + MSR_SIBRC_LEN)));
    return (rc);
}


uint32_t _getscom( const uint32_t i_chiplet_id, const uint32_t i_address, uint64_t *o_data)
{
    
    // Perform the Load Virtual Double Index instruction
    PPE_LVDX(i_chiplet_id, i_address, o_data);

    // Get the MSR[SIBRC] as the return code   
    uint32_t rc = mfmsr();
    rc = ((rc & MSR_SIBRC) >> (32-(MSR_SIBRC_START_BIT + MSR_SIBRC_LEN)));
    return (rc);

}
OpenPOWER on IntegriCloud