diff --git a/include/rm_loc.h b/include/rm_loc.h
index 9e7832b537731c8aaab77157be33aec5c4b25c74..d351977c2f6f97a1b645ac0aee6607cb0ad5ab8f 100644 (file)
--- a/include/rm_loc.h
+++ b/include/rm_loc.h
* \par
*/
-#ifndef RMLOC_H_
-#define RMLOC_H_
+#ifndef RM_LOC_H_
+#define RM_LOC_H_
#ifdef __cplusplus
extern "C" {
#endif
/* RM external includes */
+#include <ti/drv/rm/rm.h>
#include <ti/drv/rm/rm_services.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_internal.h>
+#include <ti/drv/rm/include/rm_allocatorloc.h>
#include <ti/drv/rm/include/rm_policyloc.h>
+#include <ti/drv/rm/include/rm_transportloc.h>
#include <ti/drv/rm/include/rm_nameserverloc.h>
#include <ti/drv/rm/include/rm_treeloc.h>
-/**
- * @brief RM protocol packet resource information
- */
+/* Static allocation configuration structure */
typedef struct {
- /** Resource name of resource affected by command */
- char name[RM_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;
- /** 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;
- /** If applicable, the NameServer name assigned to the specified
- * resource. Used for commands centering on RM NameServer actions */
- char nameServerName[RM_NAME_MAX_CHARS];
-} Rm_ResourceInfo;
+ /* Instance name */
+ char *instName;
+ /* Static policy */
+ void *staticPolicy;
+ /* Static valid instance tree */
+ Rm_PolicyValidInstTree *staticValidInstTree;
+} Rm_StaticAllocCfg;
-/**
- * @brief RM transactions are the internalized version of service requests received
- * from components and RM commands received from other RM instances.
- * Transactions that cannot immediately be serviced are placed in the RM
- * instance's transaction queue. The transactions track all service
- * requests within the RM infrastructure.
- */
+/* Service transaction linked list node */
typedef struct Rm_Transaction_s {
- /** Transaction service type */
- Rm_ServiceType type;
- /** Local ID of the transaction. */
- uint32_t localId;
- /** 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
- * match the response packet with the originating request using the ID */
- uint32_t remoteOriginatingId;
- /** Name of the RM instance the RM packet, that spawned the transaction,
- * originated from */
- char pktSrcInstName[RM_NAME_MAX_CHARS];
- /** Transaction's associated callback function */
- Rm_ServiceCallback callback;
- /** Transaction state. The codes are externally visible and tracked
- * in rmservices.h */
- int32_t state;
- /** Name of the RM instance the service originated from */
- char serviceSrcInstName[RM_NAME_MAX_CHARS];
- /** Resource information */
- Rm_ResourceInfo resourceInfo;
- /** Link to the next transaction in the queue */
+ /* Transaction service type */
+ Rm_ServiceType type;
+ /* Local ID of the transaction. */
+ uint32_t localId;
+ /* 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
+ * The RM instance that receives the response will
+ * match the response packet with the originating request using the ID */
+ uint32_t remoteOriginatingId;
+ /* Name of the RM instance that generated the packet that resulted
+ * in the creation of the service transaction. Used to send the response
+ * packet. */
+ char pktSrcInstName[RM_NAME_MAX_CHARS];
+ /* Transaction service callback function */
+ Rm_ServiceCallback callback;
+ /* Transaction state. The codes are defined in rm.h */
+ int32_t state;
+ /* Transaction has been forwarded to CD or Server instance. Waiting for response */
+ bool hasBeenForwarded;
+ /* Name of the RM instance the service originated from */
+ char serviceSrcInstName[RM_NAME_MAX_CHARS];
+ /* Resource information */
+ Rm_ResourceInfo resourceInfo;
+ /* Link to the next transaction in the queue */
struct Rm_Transaction_s *nextTransaction;
} Rm_Transaction;
+/* Server-specific instance data */
typedef struct {
- const void *rangeData;
- int32_t rangeLen;
- const void *nsAssignData;
- int32_t nsAssignLen;
- const void *linuxAliasData;
- int32_t linuxAliasLen;
-} Rm_ResourceProperties;
-
-typedef enum {
- Rm_allocatorOp_ALLOCATE = 0,
- Rm_allocatorOp_FREE,
- Rm_allocatorOp_PRE_ALLOCATE
-} Rm_AllocatorOp;
+ /* Pointer to the global policy */
+ void *globalPolicy;
+ /* Pointer to root entry of the global policy valid instance tree */
+ Rm_PolicyValidInstTree *globalValidInstTree;
+ /* Pointer to the linked list of allocators */
+ Rm_Allocator *allocators;
+ /* Pointer to the root entry of the NameServer */
+ Rm_NameServerTree *nameServer;
+} Rm_ServerInstData;
+/* Client Delegate-specific instance data */
typedef struct {
- Rm_PolicyValidInstNode *serviceSrcInstNode;
- Rm_AllocatorOp operation;
- uint32_t allocType;
- Rm_ResourceInfo *resourceInfo;
-} Rm_AllocatorOpInfo;
-
-typedef struct Rm_Allocator_s {
- char resourceName[RM_NAME_MAX_CHARS];
- /** Pointer to the first resource entry in the allocator */
- void *allocatorRootEntry;
- /** Pointer to next resource allocator */
- struct Rm_Allocator_s *nextAllocator;
-} Rm_Allocator;
+ /* Pointer to the static policy if provided */
+ void *staticPolicy;
+ /* Pointer to the root entry of the valid instance tree
+ * extracted from the static policy */
+ Rm_PolicyValidInstTree *staticValidInstTree;
+} Rm_ClientDelegateInstData;
+/* Client-specific instance data */
typedef struct {
- char instName[RM_NAME_MAX_CHARS];
- void *startupDtb;
- Rm_PolicyValidInstTree *validInstTree;
- uint32_t requestCount;
- Rm_ServicePreMainReq *preMainReqList;
-} Rm_PreMainInst;
+ /* Pointer to the static policy if provided */
+ void *staticPolicy;
+ /* Pointer to the root entry of the valid instance tree
+ * extracted from the static policy */
+ Rm_PolicyValidInstTree *staticValidInstTree;
+} Rm_ClientInstData;
+/* RM instance structure */
typedef struct {
- char instName[RM_NAME_MAX_CHARS];
- Rm_InstType instType;
- Rm_ServiceHandle *serviceHandle;
- bool registeredWithDelegateOrServer;
- void *policy;
- void *staticPolicy;
- Rm_PolicyValidInstTree *validInstances;
- Rm_Allocator *allocators;
- Rm_NameServerTree *nameServer;
- void *transports;
- uint32_t transactionSeqNum;
- Rm_Transaction *transactionQueue;
- Rm_TransportCallouts transport;
+ /* Name given to the RM instance. Policy will assign resources based
+ * on the names assigned to instances at instance init */
+ char instName[RM_NAME_MAX_CHARS];
+ /* Instance type */
+ Rm_InstType instType;
+ /* Instance lock status. Instance locks if static request fails when
+ * checked against global policy */
+ bool isLocked;
+ /* Pointer to the serviceHandle opened from the instance */
+ Rm_ServiceHandle *serviceHandle;
+ /* Tracks whether the instance has registered with a CD or Server.
+ * Applicable to CD and Client instances */
+ bool registeredWithDelegateOrServer;
+ /* Linked list of transports registered by the application */
+ Rm_Transport *transports;
+ /* Service transaction sequence number tracker */
+ uint32_t transactionSeqNum;
+ /* Service transaction linked list queue */
+ Rm_Transaction *transactionQueue;
+ /* Local gate key provided through OSAL when RM needs to block due to
+ * a service request that requires a blocking operation to complete */
+ uint32_t localGateKey;
+ /* Instance-type specific constructs */
+ union {
+ /* Server-specific instance data */
+ Rm_ServerInstData server;
+ /* Client Delegate-specific instance data */
+ Rm_ClientDelegateInstData cd;
+ /* Client-specific instance data */
+ Rm_ClientInstData client;
+ } u;
} Rm_Inst;
Rm_Transaction *rmTransactionQueueAdd(Rm_Inst *rmInst);
Rm_Transaction *rmTransactionQueueFind(Rm_Inst *rmInst, uint32_t transactionId);
int32_t rmTransactionQueueDelete(Rm_Inst *rmInst, uint32_t transactionId);
-uint32_t rmTransactionGetSequenceNum(Rm_Inst *rmInst);
-
-Rm_Allocator *rmAllocatorFind(Rm_Allocator *allocatorList, char *resourceName);
-
-void rmTransactionResponder (Rm_Inst *rmInst, Rm_Transaction *transaction);
-void rmTransactionForwarder (Rm_Inst *rmInst, Rm_Transaction *transaction);
-void rmTransactionProcessor (Rm_Inst *rmInst, Rm_Transaction *transaction);
+void rmProcessRouter(Rm_Inst *rmInst, Rm_Transaction *transaction);
#ifdef __cplusplus
}
#endif
-#endif /* RMLOC_H_ */
+#endif /* RM_LOC_H_ */