summaryrefslogtreecommitdiffstats
path: root/src/include/usr/targeting/common/attrsyncdefs.H
blob: ba7af1082c83ab0266fba8f372903dd027c59f3d (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
/* IBM_PROLOG_BEGIN_TAG                                                   */
/* This is an automatically generated prolog.                             */
/*                                                                        */
/* $Source: src/include/usr/targeting/common/attrsyncdefs.H $             */
/*                                                                        */
/* OpenPOWER HostBoot Project                                             */
/*                                                                        */
/* COPYRIGHT International Business Machines Corp. 2012,2014              */
/*                                                                        */
/* 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                                                     */
#ifndef __ATTRSYNC_DEFS_H__
#define __ATTRSYNC_DEFS_H__

//******************************************************************************
// Macros
//******************************************************************************
// constants for use in masking off corresponding bytes in message data words
// used for attribute synchronization mbox messages, sectoin ID and page
// number are used in the sync messages
const uint64_t SECTIONID_MASK       = 0xFFFF000000000000;
const uint64_t PAGE_NUMBER_MASK     = 0x0000FFFF00000000;

// page count mask, used in attribute sync commit message  
const uint64_t PAGE_COUNT_MASK      = 0xFFFF000000000000;

// mask to manipulate the return code field in the data returned in the
// response to an attribute sync commit message
const uint64_t RETURN_CODE_MASK     = 0xFFFF000000000000;


// used to add the section into the first data word of an attribute sync
// message - only modifies the first two bytes of the uint64_t
#define ATTR_SYNC_ADD_SECTION_ID( sectionId, data0 )  \
                            ( data0 = ( data0 & ~SECTIONID_MASK) | \
                            ( static_cast<uint64_t>(sectionId) << 48 ) )

// used to get the section from the first data word of an attribute sync
// message - only retrieves the first two bytes of the uint64_t
#define ATTR_SYNC_GET_SECTION_ID( data0 ) ( static_cast<SECTION_TYPE>( \
                            ( data0 & SECTIONID_MASK ) >> 48 ) )

// used to add the number of the current page to be sync'd. used in the
// attribute sync message code. Only modifies the second two bytes 
// of the uint64_t
#define ATTR_SYNC_ADD_PAGE_NUMBER( pageNumber, data0 )    \
                            ( data0 = ( data0 & ~PAGE_NUMBER_MASK) | \
                            ( static_cast<uint64_t>(pageNumber) << 32 ) )

// used to get the number of the current page to be sync'd. used in the
// attribute sync message code. Only retrieves the second two bytes
// of the uint64_t
#define ATTR_SYNC_GET_PAGE_NUMBER( data0 ) ( static_cast<uint16_t>( \
                            ( data0 & PAGE_NUMBER_MASK ) >> 32 ) )

// Used in the commit message sent after all the pages of the current section
// are sent, the macro will add the total page count to the first two bytes
// of the data[0] uint64_t in the mailbox message.
#define ATTR_SYNC_ADD_PAGE_COUNT( pageCount, data0 ) \
                            ( data0 = ( data0 & ~PAGE_COUNT_MASK) | \
                            ( static_cast<uint64_t>(pageCount) << 48 ) )

// Used in the commit message sent after all the pages of the current section
// are sent, the macro will extract the total page count from the first two bytes
// of the data[0] uint64_t in the mailbox message.
#define ATTR_SYNC_GET_PAGE_COUNT( data0 ) ( static_cast<uint16_t> ( \
                            ( data0 & PAGE_COUNT_MASK ) >> 48 ) )

// sets the return code in the first 2 bytes of the mailbox message
#define ATTR_SYNC_ADD_RC( rc, data0 ) \
                            ( data0 = (data0 & ~RETURN_CODE_MASK) | \
                            ( static_cast<uint64_t>(rc) << 48 ) )

// gets the return code from the uint64_t returned by the mailbox message
#define ATTR_SYNC_GET_RC( data0 ) ( static_cast<ATTR_SYNC_RC>( \
                            ( data0 & RETURN_CODE_MASK )  >> 48 ))

namespace   TARGETING
{
    /**
     * @enum TARGETING::ATTR_SYNC_MSG_TYPE
     *
     * @brief  Targeting attribute sync service message types for use in the
     *         attribute sync messages between FSP and Hostboot
     */
    enum ATTR_SYNC_MSG_TYPE
    {
        //NOTE: Types cannot overlap with types in utillidmgrdefs.H
        //  due to common FSP message queue
        ATTR_SYNC_NO_MSG          = 0,
        ATTR_SYNC_SECTION_TO_FSP  = 0x000000A1,
        ATTR_SYNC_COMPLETE_TO_FSP = 0x000000A2,
        ATTR_SYNC_REQUEST_TO_HB   = 0x000000A3,
        ATTR_SYNC_SECTION_TO_HB   = 0x000000A4,
        ATTR_SYNC_COMPLETE_TO_HB  = 0x000000A5,
    };


    /**
     * @enum TARGETING::ATTR_SYNC_RC
     *
     * @brief  Return code values for the sync complete message used by HB
     *         and the FSP when the sync has been completed.
     *
     */
    enum ATTR_SYNC_RC
    {
        ATTR_SYNC_SUCCESS = 0,
        ATTR_SYNC_FAILURE = 1
    };

}; // end namespace

#endif
OpenPOWER on IntegriCloud