summaryrefslogtreecommitdiffstats
path: root/src/usr/fapi2/test/p9_sample_procedure.C
blob: 3e45ae0ef18e41fcc3e451a204692f104403f974 (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
/* IBM_PROLOG_BEGIN_TAG                                                   */
/* This is an automatically generated prolog.                             */
/*                                                                        */
/* $Source: src/usr/fapi2/test/p9_sample_procedure.C $                    */
/*                                                                        */
/* OpenPOWER HostBoot Project                                             */
/*                                                                        */
/* Contributors Listed Below - COPYRIGHT 2015,2018                        */
/* [+] 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                                                     */
#include <cxxtest/TestSuite.H>
#include <p9_sample_procedure.H>
#include <fapi2.H>
#include <plat_attribute_service.H>


//------------------------------------------------------------------------------
/// @file  p9_sample_procedure.C
///
/// @brief These procedures test FAPI_ATTR_GET, FAPI_ATTR_SET,
///        and FAPI_TRY and FAPI_ERR. This is primarily here to
///        to make sure these compile okay.
//------------------------------------------------------------------------------


#define SAMPLE_PROCEDURE_MACRO( SAMPLE_HWP_NAME, FAPI2_TYPE) \
fapi2::ReturnCode SAMPLE_HWP_NAME( \
               fapi2::Target<FAPI2_TYPE>& i_target, \
               uint8_t expectedValue) \
{ \
    uint8_t l_attr_scratch = 0; \
    FAPI_ERR("Entering ..."); \
    FAPI_ERR("Set Scratch Attr on PROC Target"); \
    FAPI_TRY(FAPI_ATTR_SET(fapi2::ATTR_SCRATCH_UINT8_1, \
                   i_target, \
                    expectedValue)); \
    FAPI_ERR("Get Scratch Attr on FAPI2_TYPE Target"); \
    FAPI_TRY(FAPI_ATTR_GET(fapi2::ATTR_SCRATCH_UINT8_1, \
                           i_target, \
                           l_attr_scratch)); \
    FAPI_ERR("Read scratch value : %d , expected it to be %d", \
             l_attr_scratch, \
             expectedValue); \
 fapi_try_exit: \
    FAPI_ERR("Exiting ..."); \
    return fapi2::current_err; \
}

SAMPLE_PROCEDURE_MACRO(p9_sample_procedure_proc, fapi2::TARGET_TYPE_PROC_CHIP)
SAMPLE_PROCEDURE_MACRO(p9_sample_procedure_ex, fapi2::TARGET_TYPE_EX)
SAMPLE_PROCEDURE_MACRO(p9_sample_procedure_eq, fapi2::TARGET_TYPE_EQ)
SAMPLE_PROCEDURE_MACRO(p9_sample_procedure_core, fapi2::TARGET_TYPE_CORE)
SAMPLE_PROCEDURE_MACRO(p9_sample_procedure_mcs, fapi2::TARGET_TYPE_MCS)
SAMPLE_PROCEDURE_MACRO(p9_sample_procedure_mca, fapi2::TARGET_TYPE_MCA)
SAMPLE_PROCEDURE_MACRO(p9_sample_procedure_mcbist, fapi2::TARGET_TYPE_MCBIST)
SAMPLE_PROCEDURE_MACRO(p9_sample_procedure_xbus, fapi2::TARGET_TYPE_XBUS)
SAMPLE_PROCEDURE_MACRO(p9_sample_procedure_capp, fapi2::TARGET_TYPE_CAPP)
SAMPLE_PROCEDURE_MACRO(p9_sample_procedure_obus, fapi2::TARGET_TYPE_OBUS)
SAMPLE_PROCEDURE_MACRO(p9_sample_procedure_obrick, fapi2::TARGET_TYPE_OBUS_BRICK)
SAMPLE_PROCEDURE_MACRO(p9_sample_procedure_sbe, fapi2::TARGET_TYPE_SBE)
SAMPLE_PROCEDURE_MACRO(p9_sample_procedure_ppe, fapi2::TARGET_TYPE_PPE)
SAMPLE_PROCEDURE_MACRO(p9_sample_procedure_perv, fapi2::TARGET_TYPE_PERV)
SAMPLE_PROCEDURE_MACRO(p9_sample_procedure_phb, fapi2::TARGET_TYPE_PHB)
SAMPLE_PROCEDURE_MACRO(p9_sample_procedure_pec, fapi2::TARGET_TYPE_PEC)
SAMPLE_PROCEDURE_MACRO(p9_sample_procedure_mc, fapi2::TARGET_TYPE_MC)
SAMPLE_PROCEDURE_MACRO(p9_sample_procedure_mi, fapi2::TARGET_TYPE_MI)
SAMPLE_PROCEDURE_MACRO(p9_sample_procedure_dmi, fapi2::TARGET_TYPE_DMI)
SAMPLE_PROCEDURE_MACRO(p9_sample_procedure_omi, fapi2::TARGET_TYPE_OMI)
SAMPLE_PROCEDURE_MACRO(p9_sample_procedure_omic, fapi2::TARGET_TYPE_OMIC)
SAMPLE_PROCEDURE_MACRO(p9_sample_procedure_mcc, fapi2::TARGET_TYPE_MCC)
SAMPLE_PROCEDURE_MACRO(p9_sample_procedure_ocmb, fapi2::TARGET_TYPE_OCMB_CHIP)
SAMPLE_PROCEDURE_MACRO(p9_sample_procedure_mem_port, fapi2::TARGET_TYPE_MEM_PORT)

OpenPOWER on IntegriCloud