summaryrefslogtreecommitdiffstats
path: root/src/ppe/hwp/lib/p9_common_poweronoff.H
blob: 743866a18d5413a0725f957b73bc9c349389d2e1 (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
/* IBM_PROLOG_BEGIN_TAG                                                   */
/* This is an automatically generated prolog.                             */
/*                                                                        */
/* $Source: src/ppe/hwp/lib/p9_common_poweronoff.H $                      */
/*                                                                        */
/* OpenPOWER OnChipController Project                                     */
/*                                                                        */
/* Contributors Listed Below - COPYRIGHT 2015                             */
/* [+] 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_common_poweronoff.H
/// @brief common procedure for power on/off
///
/// *HWP HWP Owner   : David Young   <davidy@us.ibm.com>
/// *HWP FW Owner    : Sangeetha T S  <sangeet2@in.ibm.com>
/// *HWP Team        : PM
/// *HWP Consumed by : SBE:SGPE:CME
/// *HWP Level       : 2
///

#ifndef __P9_COMMON_POWERONOFF_H__
#define __P9_COMMON_POWERONOFF_H__

namespace p9power
{
    enum powerOperation_t
    {
        POWER_ON      = 0x0,
        POWER_OFF     = 0xFF,
        POWER_ON_VDD  = 0x1,
        POWER_OFF_VDD = 0xFE
    };
}


// Will be auto-generated by Ben Gass's Figtree file
// #define PPM_PFCS C_PPM_PFCS_SCOM
// #define PPM_PFCS_CLR C_PPM_PFCS_SCOM1
// #define PPM_PFCS_OR C_PPM_PFCS_SCOM2

#define PPM_PFCS 0x100f0118
#define PPM_PFCS_CLR 0x100f0119
#define PPM_PFCS_OR 0x100f011a

#define PPM_PFDLY 0x100f011b
#define PPM_PFSNS 0x100f011c
#define PPM_PFOFF 0x100f011d

#if 0
namespace fapi2
{
// Will be auto-generated by error XML file

const unsigned  RC_PMPROC_PFETLIB_BAD_DOMAIN = 0;
const unsigned  RC_PMPROC_PFETLIB_BAD_SCOM = 1;
const unsigned  RC_PMPROC_PFETLIB_BAD_OP = 2;
const unsigned  RC_PMPROC_PFETLIB_RAIL_ON = 3;
const unsigned  RC_PMPROC_PFETLIB_RAIL_OFF = 4;
const unsigned  RC_PROCPM_PFETLIB_TIMEOUT = 5;
const unsigned  RC_PROCPM_PFET_CODE_BAD_MODE = 6;
const unsigned  RC_PROCPM_PFET_GET_ATTR = 7;
}
#endif
#define OR_TARGET_ENABLED 1

/// @typedef p9_common_poweronoff_FP_t
/// function pointer typedef definition for HWP call support
#if OR_TARGET_ENABLED  // Cronus may not support fapi2::TARGET_TYPE_EQ|fapi2::TARGET_TYPE_CORE
typedef fapi2::ReturnCode (*p9_common_poweronoff_FP_t) (
    const fapi2::Target<fapi2::TARGET_TYPE_EQ|
                        fapi2::TARGET_TYPE_CORE>&,
    const p9power::powerOperation_t i_operation);
#else
typedef fapi2::ReturnCode (*p9_common_poweronoff_FP_t) (
    const fapi2::Target<fapi2::TARGET_TYPE_EQ>&, const uint32_t);

#endif

extern "C"
{
/// @brief common procedure for power on/off
///
/// @param [in] i_target    TARGET_TYPE_EQ|TARGET_TYPE_CORE target
/// @param [in] i_operation ENUM(ON,OFF)
///
/// @attr
/// @attritem ATTR_PFET_TIMING - EX target, uint32
///
/// @retval FAPI_RC_SUCCESS
#if OR_TARGET_ENABLED
fapi2::ReturnCode
p9_common_poweronoff(
    const fapi2::Target<fapi2::TARGET_TYPE_EQ|
                        fapi2::TARGET_TYPE_CORE>& i_target,
    const p9power::powerOperation_t i_operation);
#else
fapi2::ReturnCode
p9_common_poweronoff(
    const fapi2::Target<fapi2::TARGET_TYPE_EQ>& i_target,
    const p9power::powerOperation_t i_operation);
#endif

} // extern C

#endif  // __P9_COMMON_POWERONOFF_H__
OpenPOWER on IntegriCloud