blob: 9c338114f2f40f36959ce6f3bcb5247b414e9857 (
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/usr/targeting/attrrp.H $
//
// IBM CONFIDENTIAL
//
// COPYRIGHT International Business Machines Corp. 2011
//
// 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
#ifndef __TARGETING_ATTRRP_H
#define __TARGETING_ATTRRP_H
#include <initservice/taskargs.H>
#include <sys/msg.h>
namespace TARGETING
{
// Forward declaration of attribute section parsed information structure.
struct AttrRP_Section;
/** @class AttrRP
* @brief Attribute Resource Provider daemon class.
*
* Provides all the functionality to translate between PNOR and Attribute
* virtual memory spaces. Parses PNOR header for attribute sections,
* allocates virtual memory spaces with the kernel for each section, and
* handles virtual memory request messages from the kernel.
*/
class AttrRP
{
public:
/** @brief Initializes and starts the AttrRP daemon.
* @param[in] i_taskArgs - Pointer to init service arguments.
*
* @note If any error occurs during initialization, it will be
* reported back through the TaskArgs structure to the init
* service.
*/
static void init(INITSERVICE::TaskArgs* i_taskArgs);
protected:
/** @brief Default constructor.
* Ensures member variables are initialized to sane values.
*/
AttrRP() :
iv_msgQ(NULL), iv_sections(NULL), iv_sectionCount(0)
{ };
/** @brief Default destructor.
* Frees any memory allocated by the daemon.
*
* @note This should never actually be used because the daemon
* thread and the vmm blocks are unable to be reclaimed.
* Function will assert if called due to leaky behavior.
*/
~AttrRP();
private:
/** @brief Performs the startup of the daemon instance.
*
* init() is a static function that just calls
* Singleton<AttrRP>::instance().startup(). See init for behavior.
*/
void startup(INITSERVICE::TaskArgs* i_taskArgs);
/** @brief Daemon thread processing function.
*
* Performs a while(1) waiting for messages from the kernel/VMM
* and handles as appropriately. Reads / writes data from / to
* PNOR for the attribute sections.
*/
void msgServiceTask() const;
/** @brief Parses the attribute section header in PNOR.
*
* Constructs the local attribute section data structures
* (iv_sections / iv_sectionCount).
*
* @return errlHndl_t - Error log if error occurs.
*/
errlHndl_t parseAttrSectHeader();
/** @brief Allocates VMM sections for each Attribute section.
*
* Calls to the kernel to create vmm blocks for each attribute
* and initializes permissions appropriately based on section
* type.
*
* @return errlHndl_t - Error log if error occurs.
*/
errlHndl_t createVmmSections();
/** @brief Redirect to msgServiceTask on the AttrRP instance.
*
* This function, being static, can be called from task_create
* and is used to enter the daemon thread's msgServiceTask loop.
*
* @param[in] i_instance - The AttrRP to call msgServiceTask on.
*/
static void startMsgServiceTask(void* i_instance);
/** Message Queue for VMM requests. */
msg_q_t iv_msgQ;
/** Parsed structures of the attribute sections. */
AttrRP_Section* iv_sections;
/** Count of attribute sections. */
size_t iv_sectionCount;
};
};
#endif
|