diff --git a/include/rm_loc.h b/include/rm_loc.h
index 057942e8ac0b45e6e5482b66b01260b4f73a61f5..a5d65739b8a862953a49e37d60736137f221f52a 100644 (file)
--- a/include/rm_loc.h
+++ b/include/rm_loc.h
/* RM external includes */
#include <ti/drv/rm/rm_services.h>
-#include <ti/drv/rm/rm_policy.h>
#include <ti/drv/rm/rm_transport.h>
+/* RM internal includes */
+#include <ti/drv/rm/include/rm_servicesloc.h>
+#include <ti/drv/rm/include/rm_policyloc.h>
+#include <ti/drv/rm/include/rm_nameserverloc.h>
+
/* AVL BBST includes */
#include <ti/drv/rm/include/tree.h>
-/** String stored for resource elements that are not currently allocated to anyone. If the
- * resource is allocated the allocatedTo field will be populated with the RM instance
- * name it was allocated to. */
-#define RM_NOT_ALLOCATED_STRING "\0"
-/** String stored for resource elements that are reserved by the Linux kernel. These
- * resources will be in use for the lifetime of the system */
-#define RM_ALLOCATED_TO_LINUX "Linux-Kernel"
-
/** Maximum size of a transmittable RM policy in bytes */
#define RM_MAX_POLICY_SIZE_BYTES (64) // Placeholder: This will change
// during development
/** Pointer to RM instance's transaction queue */
typedef void *Rm_TransactionQueue;
-/** Pointer to the RM instance's allocators */
-typedef void *Rm_Allocators;
-
-/** Pointer to the RM instance's NameServer (Valid only on Server) */
-typedef void *Rm_NameServer;
-
/**
* @brief RM protocol packet resource information
*/
typedef struct {
/** Resource name of resource affected by command */
- char name[RM_RESOURCE_NAME_MAX_CHARS];
+ char name[RM_RESOURCE_NAME_MAX_CHARS];
/** If applicable, start of resource range affected by command. If
* RM_RESOURCE_UNSPECIFIED is assigned the higher level RM agent*/
- int32_t base;
+ int32_t base;
/** If applicable, number of specified resource, starting from base, affected by command */
uint32_t length;
/** If applicable, the alignment of the resource affected by the command */
- int32_t alignment;
+ int32_t alignment;
/** If applicable, the NameServer name assigned to the specified
* resource. Used for commands centering on RM NameServer actions */
- char nsName[RM_RESOURCE_NAME_MAX_CHARS];
+ char nameServerName[RM_RESOURCE_NAME_MAX_CHARS];
} Rm_ResourceInfo;
/**
Rm_ServiceType type;
/** Local ID of the transaction. */
uint32_t localId;
- /** ID of transaction on lower level RM instance that generated the
+ /** ID of transaction in RM instance that generated the
* packet that resulted in the creation of the transaction. The
* originating ID will be placed in the transaction's response packet
* to the lower level RM instance. The lower level RM instance will
typedef struct {
const void *rangeData;
- int32_t rangeLen;
+ int32_t rangeLen;
const void *nsAssignData;
- int32_t nsAssignLen;
+ int32_t nsAssignLen;
const void *linuxAliasData;
- int32_t linuxAliasLen;
+ int32_t linuxAliasLen;
} Rm_ResourceProperties;
typedef enum {
Rm_allocatorOp_ALLOCATE = 0,
- Rm_allocatorOp_FREE = 1,
- Rm_allocatorOp_PRE_ALLOCATE = 2,
+ Rm_allocatorOp_FREE,
+ Rm_allocatorOp_PRE_ALLOCATE
} Rm_AllocatorOp;
typedef struct {
- char *serviceSrcInstName;
- Rm_AllocatorOp operation;
- /* Will contain the actual allocation/free values */
+ Rm_PolicyValidInstNode *serviceSrcInstNode;
+ Rm_AllocatorOp operation;
+ uint32_t allocType;
Rm_ResourceInfo *resourceInfo;
} Rm_AllocatorOpInfo;
-typedef struct {
+typedef struct Rm_Allocator_s {
char resourceName[RM_RESOURCE_NAME_MAX_CHARS];
/** Pointer to the first resource entry in the allocator */
void *allocatorRootEntry;
/** Pointer to next resource allocator */
- void *nextAllocator;
+ struct Rm_Allocator_s *nextAllocator;
} Rm_Allocator;
+
typedef struct {
- char name[RM_INSTANCE_NAME_MAX_CHARS];
- Rm_InstType instType;
- bool registeredWithDelegateOrServer;
- Rm_PolicyHandle policyDtb;
- Rm_Allocators allocators;
- Rm_NameServer nameServer;
+ char instName[RM_INSTANCE_NAME_MAX_CHARS];
+ void *startupDtb;
+ Rm_PolicyValidInstTree *validInstTree;
+ uint32_t requestCount;
+ Rm_ServicePreMainReq *preMainReqList;
+} Rm_PreMainInst;
+
+typedef struct {
+ char instName[RM_INSTANCE_NAME_MAX_CHARS];
+ Rm_InstType instType;
+ bool registeredWithDelegateOrServer;
+ void *policy;
+ Rm_PolicyValidInstTree *validInstances;
+ Rm_Allocator *allocators;
+ Rm_NameServerTree *nameServer;
/* RM instance transport parameters */
- Rm_TransportRouteMap routeMap;
+ Rm_TransportRouteMap routeMap;
/* RM Transaction sequence number counter */
- uint32_t transactionSeqNum;
+ uint32_t transactionSeqNum;
/* RM transaction queue */
- Rm_TransactionQueue transactionQueue;
+ Rm_TransactionQueue transactionQueue;
/* Transport API function pointers - not global in case application wants to
* hook up different transports to RM */
- Rm_TransportCallouts transport;
+ Rm_TransportCallouts transport;
} Rm_Inst;
Rm_Transaction *Rm_transactionQueueAdd(Rm_Inst *rmInst);
@@ -181,6 +181,8 @@ Rm_Transaction *Rm_transactionQueueFind(Rm_Inst *rmInst, uint32_t transactionId)
int32_t Rm_transactionQueueDelete(Rm_Inst *rmInst, uint32_t transactionId);
uint32_t Rm_transactionGetSequenceNum(Rm_Inst *rmInst);
+Rm_Allocator *Rm_allocatorFind(Rm_Allocator *allocatorList, char *resourceName);
+
void Rm_transactionResponder (Rm_Inst *rmInst, Rm_Transaction *transaction);
void Rm_transactionForwarder (Rm_Inst *rmInst, Rm_Transaction *transaction);
void Rm_transactionProcessor (Rm_Inst *rmInst, Rm_Transaction *transaction);
**********************************************************************/
/* Declare the tree structure nodes */
+typedef struct Rm_AllocatedTo_s {
+ Rm_PolicyValidInstNode *instNameNode;
+ struct Rm_AllocatedTo_s *nextAllocatedTo;
+} Rm_AllocatedTo;
+
typedef struct _Rm_ResourceNode {
- RB_ENTRY(_Rm_ResourceNode) linkage;
- uint32_t base;
- uint32_t length;
- char allocatedTo[RM_INSTANCE_NAME_MAX_CHARS];
+ RB_ENTRY(_Rm_ResourceNode) linkage;
+ uint32_t base;
+ uint32_t length;
+ uint16_t allocationCount;
+ Rm_AllocatedTo *allocatedTo;
} Rm_ResourceNode;
/* Declare the tree head structure. A structure of type Rm_ResourceTree will need to be
* malloc'd for each tree that is to be created. */
typedef RB_HEAD(_Rm_ResourceTree, _Rm_ResourceNode) Rm_ResourceTree;
-Rm_ResourceNode *Rm_newResourceNode(uint32_t resourceBase, uint32_t resourceLength,
- char *allocatedTo);
+Rm_ResourceNode *Rm_newResourceNode(uint32_t resourceBase, uint32_t resourceLength);
void Rm_freeResourceNode(Rm_ResourceNode *node);
/* Prototype for tree node comparison function
* element1 < element2 --> return < 0