summaryrefslogtreecommitdiffstats
path: root/src/usr/diag/prdf/common/framework/config/iipConfigurator.h
blob: ce3dc4717deeb413996c5b79af36545a1b7c9abc (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
210
211
/* IBM_PROLOG_BEGIN_TAG                                                   */
/* This is an automatically generated prolog.                             */
/*                                                                        */
/* $Source: src/usr/diag/prdf/common/framework/config/iipConfigurator.h $ */
/*                                                                        */
/* IBM CONFIDENTIAL                                                       */
/*                                                                        */
/* COPYRIGHT International Business Machines Corp. 1996,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                                                     */

#ifndef Configurator_h
#define Configurator_h

// Class Specification ************************************************/
//
//  Name:  Configurator
//  Parent class: None.
//
//  Summary: Instantiates a chip object for each hardware chip that
//           is marked as functional in the syspit. Instantiates all
//           the PRD Domains and assigns chip objects to them. Creates
//           the system and transfers chip and domain lists to it.
//
//## Class: Configurator; Abstract
//## Category: PRDCommon
//## Subsystem: PRDCommon
//## Concurrency: Sequential
//## Persistence: Transient
//## Cardinality: 1
//## Uses    iipspit {1 -> 1}
//## Creates instances of: Domain {1 -> n}
//## Creates instances of: CHIP_CLASS {1 -> n}
//
// Notes: There is only one type of configurator per PRD bind which is
//        determined at compile time by the definition of getConfiguratorPtr()
//
// Usage Example:
//        Configurator * c = getConfiguratorPtr(); // CreateConfigurator
//        System *system = c->build();
//        if(!rc)
//        {
//           Configurator::chipList cl  = c->getChipList();
//           Configurator::domainList d = c->getDomainList();
//        }
//        .
//        .
//        delete c;
//       BIG NOTE:
//      (Delete will NOT destroy the chip or domain instances created by
//       the build function - only the vectors of pointers to the instances)
//
// End Class Specification ********************************************/
//----------------------------------------------------------------------
// Reference the virtual function tables and inline function
// defintions in another translation unit.
//----------------------------------------------------------------------

#include <prdfMain.H>

#include <vector>

namespace PRDF
{

/*--------------------------------------------------------------------*/
/*  Forward References                                                */
/*--------------------------------------------------------------------*/
class CHIP_CLASS;
class Domain;

class Configurator
{
public:

  typedef std::vector<CHIP_CLASS *> chipList;
  typedef std::vector<Domain *> domainList;

  static Configurator * getConfiguratorPtr();
      // Function Specification *************************************
      //
      // Purpose: returns a ptr to an instance of the Configurator
      // Notes: There is one and only one type of configurator for each
      //        hardware platform - the correct one is determined at
      //        compile time by the definition of this function.
      //        new is used to create the object and can be
      //        deleted when it is no longer needed.
      //
      // End Function Specification *********************************

    //## Destructor (generated)
  virtual ~Configurator();

   /**
    * @brief  Creates the PRD system object, all chip instances, and all domain
    *         instances.
    * @return error log handle
    */
  virtual errlHndl_t build() = 0;
  // Function Specification ********************************************
  //
  // Purpose:  Builds chipList and domainList and system
  // Parameters: None
  // Returns:    Ptr to system | NULL
  // Requirements: Global ptr to syspit object has been initialized
  // Promises:  All chip objects and domain objects for system intantiated
  // Exceptions: None
  // Concurrency: Sequential
  // Notes:
  //        Instantiate a chip object for each hardware chip that is
  //        marked as functional in the syspit.
  //        Instantiates the domains in the system and assign chips.
  //        This function should only be called once.
  //    If any fail conditions are encoutered then an SRC is written to
  //    the SOT using SRCFILL. If NULL is returned then chiplist and
  //    domainlist may not be complete.
  //
  // End Function Specification ******************************************

protected:

  chipList & getChipList() { return(sysChipLst); }
  // Function Specification ********************************************
  //
  // Purpose:  Get reference to a vector of pointers to chips
  // Parameters: None
  // Returns:    Reference to chipList
  // Requirements: Build must have been called prior to this
  // Promises:  chipList contains all chip objects for the system
  // Exceptions: None
  // Concurrency: Sequential
  //
  // End Function Specification ******************************************

  domainList & getDomainList() { return(sysDmnLst); }
  // Function Specification ********************************************
  //
  // Purpose:  Get reference to a vector of pointers to domains
  // Parameters: None
  // Returns:    Reference to domainList
  // Requirements: Build must have been called prior to this
  // Promises:  domainList contains all domain objects for the system
  //            the appropriate chips have been assigned to each domain
  // Exceptions: None
  // Concurrency: Sequential
  //
  // End Function Specification ******************************************

protected:
  Configurator(int max_chips = 50, int max_domains = 4)
  {
    sysChipLst.reserve(max_chips);
    sysDmnLst.reserve(max_domains);
  }
  // Function Specification ********************************************
  //
  // Purpose:      Constructor
  // Parameters:   Maximum number of chips and domains expected in the system
  //             Specifying maximums causes memory to be managed more efficiently
  // Returns:      Nothing
  // Requirements: None
  // Promises:     Instance of this class created
  // Exceptions:   None
  // Concurrency:  Sequential
  //
  //
  // End Function Specification ******************************************

//## Equality Operations (generated)
//    int operator==(const Configurator &right) const;
//    int operator!=(const Configurator &right) const;


  chipList sysChipLst;        // List of chips in the system
  domainList sysDmnLst;       // List of domains in the system

private:

  Configurator(const Configurator &right);
  const Configurator & operator=(const Configurator &right);

     // Function Specification ********************************************
     //
     // Purpose:      Copy constructor / Assignment operator
     // Parameters:   Reference to instance of Configurator
     // Returns:      Nothing
     // Requirements: These operations are not allowed
     // Promises:     Prevents copies / Assignments from being made
     // Exceptions:   None
     // Concurrency:  n/a
     // Notes:        No definition should exist
     //
     // End Function Specification ****************************************

};

} // End namespace PRDF

#endif
OpenPOWER on IntegriCloud