summaryrefslogtreecommitdiffstats
path: root/src/include/usr/targeting/attrsync.H
blob: 274674382950d7387d7072f687cd01539f22ea3a (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
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
/*  IBM_PROLOG_BEGIN_TAG
 *  This is an automatically generated prolog.
 *
 *  $Source: src/include/usr/targeting/attrsync.H $
 *
 *  IBM CONFIDENTIAL
 *
 *  COPYRIGHT International Business Machines Corp. 2012
 *
 *  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 other-
 *  wise divested of its trade secrets, irrespective of what has
 *  been deposited with the U.S. Copyright Office.
 *
 *  Origin: 30
 *
 *  IBM_PROLOG_END_TAG
 */
#ifndef __ATTRSYNC_H_
#define __ATTRSYNC_H_
/**
 *  @file targeting/attsync.H
 *
 *  @brief  Interface to support syncing the targeting attributes between the
 *          FSP and Hostboot. Sync operations can be either direction, HB->FSP
 *          or FSP->HB however for sprint 7.12 only HB->FSP support will be
 *          added.
 */
//******************************************************************************
// Includes
//******************************************************************************
#include <mbox/mbox_queues.H>
#include <mbox/mboxif.H>
#include <errl/errlentry.H>
#include <sys/msg.h>
#include <pnortargeting.H>
#include <stddef.h>
#include <targeting/common/targetservice.H>
#include <targeting/common/attrsyncdefs.H>


namespace   TARGETING
{

    /**
     *  @class AttributeSync
     *
     *  @brief Targeting attribute sync class
     *
     *  @par Detailed Description:
     *      Provides all the functionality to synchronize the targetting
     *      attributes from the Hostboot area down to the FSP
     */
    class AttributeSync
    {

        public:

            /**
             *  @brief Initialize the attribute synchronization object
             *
             *  @par Detailed Description
             *      Ensures member variables are initialized to sane values.
             */
            AttributeSync();

            /**
             *  @brief Destroy the attribute sync object resources
             *
             *  @par Detailed Description:
             *      Frees any memory allocated by the attribute sync object
             *
             */
            ~AttributeSync();

            /**
             *  @brief  Setup the internal variables to point to the correct
             *          attribute section.
             *
             *  @par Detailed Description:
             *          This funciton will call into the AttRP:: to have the
             *          correct attribute section paged into accessable memory.
             *          this function may be called multiple times with different
             *          section names.
             *
             *  @pre None:
             *
             *  @post   The entire section from the HB attribute section
             *          passed in has been synchronized to the FSP memory area.
             *
             *  @param[in]  i_section_to_sync
             *                  TARGETING::SECTION_TYPE is passed in to
             *                  identify the section to be synced to the
             *                  FSP.
             *
             *  @return     errlHndl_t
             *                  return errl ==  NULL  -> success
             *                  return errl !=  NULL  -> failure
             *
             */
            errlHndl_t  syncSectionToFsp( 
                                    TARGETING::SECTION_TYPE i_section_to_sync );

        private:

            /**
             * @enum TARGETING::MBOX_MSG_TYPE
             *
             * @brief  Message enum to determine if msg should be sent
             *         asynchronously or if the call should be synchronous
             *
             */
            enum MBOX_MSG_TYPE
            {
                ASYNCHRONOUS,
                SYNCHRONOUS
            };

            /**
             *  @brief  Setup the internal variables to point to the correct
             *          attribute section.
             *
             *  @par Detailed Description:
             *      This funciton will call into the AttRP:: to have the
             *      correct attribute section paged into accessable memory
             *
             */
            void        getSectionData();

            /**
             *  @brief  Uses the internal mailbox to send a message to the FSP
             *
             *
             *  @par Detailed Description:
             *          This funciton will call into mailboxsp code using the
             *          FSP_ATTR_SYNC_MSGQ as a target message queue..
             *
             *  @param[in] i_type
             *           TARGETING::MBOX_MSG_TYPE passed in to define the
             *           message sending policy.
             *
             *  @param[in/out] i_msg 
             *                    This parameter is used as both input and an
             *                    output parameter. If the message is sent
             *                    synchronusly the response will be populated
             *                    in an object pointed to by this pointer. If
             *                    the message is asynchronus the object
             *                    pointed to by this paramter will be sent to
             *                    the fsp.
             *
             *  @return     errlHndl_t
             *                  return errl ==  NULL  -> success
             *                  return errl !=  NULL  -> failure
             */
            errlHndl_t  sendMboxMessage( MBOX_MSG_TYPE i_type, msg_t * i_msg  );

            /**
             *  @brief  Sends the sync complete message to the FSP indicating
             *          the operation has completed.
             *
             *  @return     errlHndl_t
             *                  return errl ==  NULL  -> success
             *                  return errl !=  NULL  -> failure
             */
            errlHndl_t  sendSyncCompleteMessage();

        private:

            // id of the section being updated
            TARGETING::SECTION_TYPE iv_section_to_sync;


            // count of total pages, calculated from data supplied by the
            // attribute resource provider code;
            uint16_t    iv_total_pages;

            // maintiains the current page number being sync'ed.
            uint16_t    iv_current_page;

            // vector of structures to hold the location info for each section
            // we would like to sync.  Data is filled in by the attrrp code
            // when we call AttRP::readSectionData(...
            std::vector <TARGETING::sectionRefData>iv_pages;

    };

    /**
     *  @brief  Handles synchronization of all RW targeting attributes from
     *          hostboot to the fsp; the following section are are 
     *          synchronized.
     * 
     *           1). SECTION_TYPE_PNOR_RW
     *           2). SECTION_TYPE_HEAP_PNOR_INIT
     *           3). SECTION_TYPE_HEAP_PNOR_ZERO_INIT
     *
     *
     *  @return     errlHndl_t
     *                  return errl ==  NULL  -> success
     *                  return errl !=  NULL  -> failure
     */
    errlHndl_t syncAllAttributesToFsp();

} // namespace
#endif
OpenPOWER on IntegriCloud