summaryrefslogtreecommitdiffstats
path: root/src/usr/hwpf/hwp/pstates/pstates/freqVoltageSvc.H
blob: 183f7be9e089efc1d3498f746691cc702c726337 (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
/* IBM_PROLOG_BEGIN_TAG                                                   */
/* This is an automatically generated prolog.                             */
/*                                                                        */
/* $Source: src/usr/hwpf/hwp/pstates/pstates/freqVoltageSvc.H $           */
/*                                                                        */
/* OpenPOWER HostBoot Project                                             */
/*                                                                        */
/* Contributors Listed Below - COPYRIGHT 2014                             */
/* [+] 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 freqVoltageSvc.H
 *  @brief Contains freqVoltage class declaration
 *
 *  This file contains information about frequency voltage service class. This
 *  class is used for reading/parsing/writing frequency and voltage related
 *  data.
 */

#ifndef __PSTATES_FREQVOLTAGESVC_H
#define __PSTATES_FREQVOLTAGESVC_H

#include <errl/errlentry.H>
#include <hwpf/fapi/fapiMvpdAccess.H>
#include <pstates.h>

namespace FREQVOLTSVC
{

    /**
     * @brief Set system frequency attribute
     *
     * @par Detailed Description:
     *      This function reads nominal, max turbo frequency, and min power
     *      save frequency from VPD and updates system target attributes.
     *
     * @return Error log handle indicating the status of the request
     *
     * @retval NULL  Successfully set system frequency
     * @retval !NULL Failed to set system frequency.
     */
    errlHndl_t setSysFreq();

    /**
     * @brief Run p8_build_pstate_datablock HWP
     *
     * @par Detailed Description:
     *     This function is wrapper for executing p8_build_pstate_datablock
     *     HW procedure.
     *
     * @param[in] i_procChip
     *     Valid functional Processor Chip target pointer
     * @param[out] o_data
     *     On success, holds pstate data
     *
     * @return Error log handle indicating the status of the request
     *
     * @retval NULL  Successfully retrieved pstate data
     * @retval !NULL Failed to get pstate data, ignore output
     */
    errlHndl_t runP8BuildPstateDataBlock(const TARGETING::Target * i_procChip,
                                         PstateSuperStructure * o_data);

    /**
     * @brief Run proc_get_voltage HWP
     *
     * @par Detailed Description:
     *     This function is wrapper for executing proc_get_voltage
     *     HW procedure.
     *
     * @param[in] i_procChip
     *     Valid functional Processor Chip target pointer
     * @param[in] i_bootFreqMhz
     *     Boot Frequency in MHZ
     * @param[out] o_vdd_vid
     *     On success, holds VDD value
     * @param[out] o_vcs_vid
     *     On success, holds VCS value
     *
     * @return Error log handle indicating the status of the request
     *
     * @retval NULL  Successfully retrieved boot voltage data
     * @retval !NULL Failed to get boot voltage, ignore output
     */
    errlHndl_t runProcGetVoltage(const TARGETING::Target * i_procChip,
                                 const uint32_t i_bootFreqMhz,
                                 uint8_t & o_vdd_vid,
                                 uint8_t & o_vcs_vid);

    /**
     * @brief Get system frequency
     *
     * @par Detailed Description:
     *     This function reads nominal, max turbo and min PowerSave frequency
     *     from VPD.
     *     It also does validation (check if all functional core voltage data
     *     points to the same nominal frequency value). Returns error if
     *     validation fails.
     *     Max Turbo frequency returned is the lowest turbo freq of all the
     *     functional cores in the system, obtained from VPD.
     *     Min PowerSave frequency returned is the highest powersave freq of
     *     all the functional cores in the system, obtained from VPD.
     *
     * @param[out] o_sysNomFreqMhz
     *     On success, holds system nominal frequency
     *     On failure, set to zero.
     * @param[out] o_sysVPDTurboMaxFreqMhz
     *     On success, holds lowest turbo frequency
     *     On failure, set to zero.
     * @param[out] o_sysVPDPowerSaveMinFreqMhz
     *     On success, holds highest powersave frequency
     *     On failure, set to zero.
     *
     * @return Error log handle indicating the status of the request
     *
     * @retval NULL  Successfully retrieved system frequency
     * @retval !NULL Failed to get system frequency, ignore output
     */
    errlHndl_t getSysFreq(
        uint32_t & o_sysVPDPowerSaveMinFreqMhz,
        TARGETING::ATTR_NOMINAL_FREQ_MHZ_type & o_sysNomFreqMhz,
        TARGETING::ATTR_FREQ_CORE_MAX_type & o_sysVPDTurboMaxFreqMhz);

    /**
     * @brief Verify the system boot frequency attribute
     *
     * @par Detailed Description:
     *      This method reads the system's boot frequency (ATTR_BOOT_FREQ_MHZ)
     *      and verifies that it is greater than or equal to the minimum
     *      power save frequency from VPD.
     *
     * @param[in] i_pTarget
     *      Pointer to system target.
     */
    void verifyBootFreq(TARGETING::Target* const i_pTarget);

}; // end namespace FREQVOLTSVC

#endif // __PSTATES_FREQVOLTAGESVC_H
OpenPOWER on IntegriCloud