cfg_tree.h

Go to the documentation of this file.
00001 /*** MODULE CFG_TREE ***/
00002 /******************************************************************************/
00022 /******************************************************************************/
00023 /*
00024 * Author: Fred Kleinsorge (GCT_TREE)
00025 * Conversion to CFG_TREE: Burns Fisher
00026 *
00027 *   Modified by:
00028 *
00029 *       X-2     WBF         Burns Fisher                    27-Jul-1999
00030 *               Change include cfgdef to <> rather than ""
00031 *
00032 *       X-1     WBF         Burns Fisher                    23-Jul-1999
00033 *               Initial checkin
00034 */
00035 #ifndef _CFG_TREE_H_
00036 #define _CFG_TREE_H_
00037 
00038 #include <cfgdef.h>
00039 
00040 /*
00041  *  This is the internal max fragments supported
00042  */
00043 #define MAX_FRAGMENTS 64
00044 
00045 typedef struct _cfg_mem_frag_defs {
00046   uint64        type;
00047   uint64        id;
00048   uint64        flags;
00049   uint64        pa;
00050   uint64        size;
00051 } CFG_MEM_FRAG_DEFS;
00052 
00053 /*
00054  *   DEBUG flags
00055  */
00056 #define CFG__DEBUG_ALLOCATE_NODE                0x001
00057 #define CFG__DEBUG_INIT                         0x002
00058 #define CFG__DEBUG_LOOKUP_NODE                  0x004
00059 #define CFG__DEBUG_CREATE_GALAXY                0x008
00060 #define CFG__DEBUG_ASSIGN_HW_COMMUNITY          0x010
00061 #define CFG__DEBUG_ASSIGN_HW_PARTITION          0x020
00062 #define CFG__DEBUG_INSERT_NODE                  0x040
00063 #define CFG__DEBUG_CREATE_PARTITION_ID          0x080
00064 #define CFG__DEBUG_CREATE_COMMUNITY_ID          0x100
00065 #define CFG__DEBUG_BIND_NODE                    0x200
00066 #define CFG__DEBUG_INIT_FRAGS                   0x400
00067 #define CFG__DEBUG_DEASSIGN_HW                  0x800
00068 #define CFG__DEBUG_ASSIGN_MEM_FRAG              0x1000
00069 #define CFG__DEBUG_DEASSIGN_MEM_FRAG            0x2000
00070 #define CFG__DEBUG_GET_MAX_PARTITIONS           0x4000
00071 #define CFG__DEBUG_VALIDATE_PARTITIONS          0x8000
00072 
00073 #ifndef CFG__DEBUG_FLAGS
00074 #define CFG__DEBUG_FLAGS 0
00075 #endif
00076 
00077 #ifdef VMS$GLX
00078 #define CFG_POINTER_TO_ROOT glx$gpq_config_tree
00079 #pragma __required_pointer_size save
00080 #pragma __required_pointer_size long
00081 extern CFG_NODE *glx$gpq_config_tree;
00082 #define CFG__EXTERNAL_ROOT
00083 #pragma __required_pointer_size restore
00084 #endif
00085 
00086 /*
00087  *   Extern data
00088  */
00089 #ifndef CFG_POINTER_TO_ROOT
00090 #define CFG_POINTER_TO_ROOT cfg_root
00091 extern CFG_NODE *cfg_root;
00092 #endif
00093 
00094 #ifdef CFG__DEBUG
00095 extern int32 cfg_debug;
00096 #endif
00097 
00098 /*
00099  *  Node creation routines
00100  */
00101 CFG_HANDLE cfg__alloc_node(char nodeType, char nodeSubType, uint64 flags, int32 extra_size, void *type_specific);
00102 #ifdef V5_MEMORY
00103 CFG_HANDLE cfg__create_mem_desc(char nodeType, char nodeSubType, uint64 flags, int32 extra_size, void *type_specific);
00104 #endif
00105 CFG_HANDLE cfg__create_mem_sub(char nodeType, char nodeSubType, uint64 flags, int32 extra_size, void *type_specific);
00106 
00107 /*
00108  *  Node deletion routines
00109  */
00110 void       cfg__delete_node(CFG_HANDLE node);
00111 
00112 /*
00113  *  Node initialization routines
00114  */
00115 #ifdef V5_MEMORY
00116 int32      cfg__mem_frag_init(CFG_HANDLE node, CFG_HANDLE community, CFG_HANDLE partition, void *type_specific);
00117 #endif
00118 int32      cfg__partition_init(CFG_HANDLE node, CFG_HANDLE community, CFG_HANDLE partition, void *type_specific);
00119 int32      cfg__cpu_init(CFG_HANDLE node, CFG_HANDLE community, CFG_HANDLE partition, void *type_specific);
00120 
00121 extern void       cfg__insert_node(CFG_HANDLE current, CFG_HANDLE newNode, int ins_type);
00122 
00123 typedef struct _cfg_node_info {
00124   int32         size;
00125   CFG_HANDLE    (*create_node)(char nodeType, char nodeSubType, uint64 flags, int32 extra_size, void *type_specific);
00126   void          (*delete_node)(CFG_HANDLE handle);
00127   int32         (*galaxy_init)(CFG_HANDLE node, CFG_HANDLE community, CFG_HANDLE partition, void *type_specific);
00128 } CFG_NODE_INFO;
00129 
00130 /*
00131  *  This array is used to create, init, and delete nodes, it is indexed by
00132  *  the node type.  The first entry is the base size of the node.  The next
00133  *  is the routine used to create the node.  Then the routine to delete the
00134  *  node, and finally a Galaxy initialization routine.
00135  *
00136  *  The normal node creation is cfg__alloc_node, but if there is special
00137  *  processing - like some initialization data from the HW definition, or
00138  *  the size needs to be dynamically set - then a private creation routine
00139  *  can be implemented (they will typically call cfg__alloc_node to do the
00140  *  actual creation).  Deletion is the same.  If special things need to be
00141  *  done as part of the deletion, this is where to hook it.
00142  *
00143  *  The galaxy initialization routine is a type specific initialization that
00144  *  will be done when the galaxy software configuration is completed.
00145  *
00146  */
00147 static CFG_NODE_INFO cfg_node_info[CFG$K_NODE_LAST+1] = {
00148   {0,                              0,               0,                 0},      /* N/A  */
00149   {sizeof(CFG_ROOT_NODE),          0,               0,                 0},      /* Galaxy Root  */
00150   {sizeof(CFG_HW_ROOT_NODE),       cfg__alloc_node, cfg__delete_node,  0},      /* Hardware Root  */
00151   {sizeof(CFG_SW_ROOT_NODE),       cfg__alloc_node, cfg__delete_node,  0},      /* Software Root  */
00152   {sizeof(CFG_TEMPLATE_ROOT_NODE), cfg__alloc_node, cfg__delete_node,  0},      /* Temlplate Root  */
00153   {sizeof(CFG_COMMUNITY_NODE),     cfg__alloc_node, cfg__delete_node,  0},      /* Community  */
00154   {sizeof(CFG_PARTITION_NODE),     cfg__alloc_node, cfg__delete_node,  cfg__partition_init}, /* Partition  */
00155   {sizeof(CFG_SBB_NODE),           cfg__alloc_node, cfg__delete_node,  0},      /* System Building Block  */
00156   {sizeof(CFG_PSEUDO_NODE),        cfg__alloc_node, cfg__delete_node,  0},      /* Pseudo  */
00157   {sizeof(CFG_CPU_NODE),           cfg__alloc_node, cfg__delete_node,  cfg__cpu_init}, /* CPU  */
00158   {sizeof(CFG_MEMORY_SUB_NODE),    cfg__create_mem_sub, cfg__delete_node, 0},   /* Memory Subsystem  */
00159 #ifdef V5_MEMORY
00160   {sizeof(CFG_MEM_DESC_NODE),      cfg__create_mem_desc,cfg__delete_node, cfg__mem_frag_init}, /* Memory Description  */
00161 #else
00162   {0,                              0,               0,                 0},      /* N/A  */
00163 #endif
00164   {sizeof(CFG_MEMORY_CTRL_NODE),   cfg__alloc_node, cfg__delete_node,  0},      /* Memory Control  */
00165   {sizeof(CFG_IOP_NODE),           cfg__alloc_node, cfg__delete_node,  0},      /* IO Processor  */
00166   {sizeof(CFG_HOSE_NODE),          cfg__alloc_node, cfg__delete_node,  0},      /* Hose  */
00167   {sizeof(CFG_BUS_NODE),           cfg__alloc_node, cfg__delete_node,  0},      /* Bus  */
00168   {sizeof(CFG_IO_CTRL_NODE),       cfg__alloc_node, cfg__delete_node,  0},      /* IO Controller  */
00169   {sizeof(CFG_SLOT_NODE),          cfg__alloc_node, cfg__delete_node,  0},      /* Slot  */
00170   {sizeof(CFG_CPU_MODULE_NODE),    cfg__alloc_node, cfg__delete_node,  0},      /* CPU Module Card  */
00171   {0,                              cfg__alloc_node, cfg__delete_node,  0},      /* NODE_LAST  */
00172 };
00173 
00174 /*
00175  *   The actual config buffer has a two quadword header.  The first quadword
00176  *   is the total size in bytes of the buffer, and the second is architected
00177  *   as the checksum.
00178  */
00179 #define CFG__BUFFER_HEADER_SIZE 64
00180 
00181 /*
00182  *   The node insertion can be sibling (next) or child
00183  */
00184 #define CFG__INSERT_NEXT_SIBLING    1
00185 #define CFG__INSERT_CHILD           2
00186 #define CFG__INSERT_CHILD_LAST_SIB  3
00187 #define CFG__INSERT_LAST_SIBLING    4
00188 
00189 #endif  /* _CFG_TREE_H_ */

SourceForge.net Logo
Project space on SourceForge.net