summaryrefslogtreecommitdiffstats
path: root/src/usr/util/utillidmgrdefs.H
blob: 50b87cf949d05cf0236af28517298b99b7c27646 (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
/* IBM_PROLOG_BEGIN_TAG                                                   */
/* This is an automatically generated prolog.                             */
/*                                                                        */
/* $Source: src/include/usr/util/utillidmgrdefs.H $                       */
/*                                                                        */
/* IBM CONFIDENTIAL                                                       */
/*                                                                        */
/* COPYRIGHT International Business Machines Corp. 2013                   */
/*                                                                        */
/* p1                                                                     */
/*                                                                        */
/* Object Code Only (OCO) source materials                                */
/* Licensed Internal Code Source Materials                                */
/* IBM HostBoot Licensed Internal Code                                    */
/*                                                                        */
/* The source code for this program is not published or otherwise         */
/* divested of its trade secrets, irrespective of what has been           */
/* deposited with the U.S. Copyright Office.                              */
/*                                                                        */
/* Origin: 30                                                             */
/*                                                                        */
/* IBM_PROLOG_END_TAG                                                     */
/* File utillidmgrdefs.H created by ADAM R. MUHLE on Fri Mar 22 2013. */

/* Change Activity: */
/* End Change Activity */

#ifndef _UTILLIDMGRDEFS_H
#define _UTILLIDMGRDEFS_H

// gets the return code from the uint64_t returned by the mailbox message
#define UTILLID_GET_RC( data0 ) ( static_cast<UTILLID::UTILLID_RC>( \
                        ( data0 & UTILLID::RETURN_CODE_MASK )  >> 48 ))

// used to add the LID ID into the first data word of a
// message - only modifies the first word of the uint64_t
#define UTILLID_ADD_LID_ID( lidId, data0 )  \
                            ( data0 = ( data0 & ~UTILLID::LID_ID_MASK) | \
                            ( static_cast<uint64_t>(lidId) << 32 ) )

// used to add the LID ID into the first data word of a
// message - only modifies the second word of the uint64_t
#define UTILLID_ADD_HEADER_FLAG( headerFlag, data0 )  \
                            ( data0 = ( data0 & ~UTILLID::LID_HEADER_MASK) | \
                            ( static_cast<uint64_t>(headerFlag)  ) )

// used to set TCE TOKEN into data1 of a
// message - only modifies the second word of the uint64_t
#define UTILLID_ADD_TCE_TOKEN( tecToken, data1 )  \
                            ( data1 = ( data1 & ~UTILLID::TCE_TOKEN_MASK) | \
                            ( static_cast<uint64_t>(tecToken)  ) )


// Used to get the LID ID from the first data word of a
// message - only retrieves the first word of the uint64_t
#define UTILLID_GET_LID_ID( data0 ) ( static_cast<uint32_t>( \
                            ( data0 & UTILLID::LID_ID_MASK ) >> 32 ) )

// Used to get the page number of the current LID from the mailbox message.
// The macro will extract the total page count from the last two bytes
// of the data[0] uint64_t in the mailbox message.
#define UTILLID_GET_PAGE_COUNT( data0 ) ( static_cast<uint16_t> ( \
                            ( data0 & UTILLID::PAGE_COUNT_MASK ) ) )

// Used to get the size  passed as part of the  mailbox
// message.  The macro will extract the size from the last word
// of the data uint64_t in the mailbox message.
#define UTILLID_GET_SIZE( data ) ( static_cast<size_t> ( \
                           ( data & UTILLID::SIZE_MASK ) ) )

namespace UTILLID
{

    //*******************************************************************
    // Macros
    //*******************************************************************
    // constants for use in masking off corresponding bytes in message data 
    // words used for LID transfer mbox messages.

    // mask to manipulate the return code field in the data returned in the
    // response to LID related messages
    const uint64_t RETURN_CODE_MASK     = 0xFFFF000000000000;

    // page count mask
    const uint64_t PAGE_COUNT_MASK      = 0x000000000000FFFF;

    // LID ID Mask
    const uint64_t LID_ID_MASK          = 0xFFFFFFFF00000000;

    // LID HEADER Mask
    //     0 -> want LID without header
    //     1 -> request LID with header - NOT currently supported
    const uint64_t LID_HEADER_MASK      = 0x000000000000FFFF;

    // Size mask
    const uint64_t SIZE_MASK            = 0x00000000FFFFFFFF;

    // TCE Token Mask
    //     0 -> Use DMA
    //     != 0 -> Indicates TCE Token to use.
    const uint64_t TCE_TOKEN_MASK       = 0x00000000FFFFFFFF;

    /**
     * @enum UTILLID::MSG_TYPE
     *
     * @brief  Targeting attribute sync service message types for use in the
     *         attribute sync messages between FSP and Hostboot
     */
    enum MSG_TYPE
    {
        //NOTE: Types cannot overlap with typs in attrsyncdefs.H
        //  due to common FSP message queue
        NO_MSG         = 0x00000000,
        GET_INFO       = 0x000000D1,  //HB Request for information about a LID
        SEND_TO_HB     = 0x000000D2,  //HB Request for a LID
        PAGE_TO_HB     = 0x000000D3,  //FSP sending LID Page to HB
     };

    /**
     * @enum UTILLID::UTILLID Return Codes
     *
     * @brief  Return code values LID transfer messages used by Hostboot
     *         and the FSP during communication.
     *
     */
    enum UTILLID_RC
    {
        UTILLID_SUCCESS = 0,
        UTILLID_FAILURE = 1
    };

}; //end UTILLID namespace

#endif /* _UTILLIDMGRDEFS_H */
OpenPOWER on IntegriCloud