diff --git a/include/rm_policyloc.h b/include/rm_policyloc.h
index 44edff05c701aa70ccb5ca9163b340ca9f0cc320..1d439057fafedc2f4ab3a8dd01f2eb02fded0109 100644 (file)
--- a/include/rm_policyloc.h
+++ b/include/rm_policyloc.h
/* RM external API includes */
#include <ti/drv/rm/rm_policy.h>
-/* RM internal API includes */
-#include <ti/drv/rm/include/rm_loc.h>
-
/* AVL BBST includes */
#include <ti/drv/rm/include/tree.h>
* allocated by the specified RM instances
* 4 - 15 : UNUSED
*/
-typedef uint16_t Rm_PermissionBits;
+typedef uint16_t Rm_PolicyPermBits;
#define RM_POLICY_PERM_INIT_LOWER 'i'
#define RM_POLICY_PERM_INIT_UPPER 'I'
#define RM_POLICY_PERM_TERMINATOR '&'
#define RM_POLICY_PERM_ASSIGNMENT '='
-#define RM_POLICY_SET_PERM(permBits, permTypeShift, val) \
- permBits = ((permBits & (~(((Rm_PermissionBits) 0x1) << permTypeShift))) | \
- ((((Rm_PermissionBits) val) & 0x1) << permTypeShift))
-#define RM_POLICY_GET_PERM(permBits, permTypeShift) \
+#define RM_policy_SET_PERM(permBits, permTypeShift, val) \
+ permBits = ((permBits & (~(((Rm_PolicyPermBits) 0x1) << permTypeShift))) | \
+ ((((Rm_PolicyPermBits) val) & 0x1) << permTypeShift))
+#define RM_policy_GET_PERM(permBits, permTypeShift) \
((permBits >> permTypeShift) & 0x1)
typedef struct Rm_Permission_s {
char instName[RM_INSTANCE_NAME_MAX_CHARS];
- Rm_PermissionBits permissionBits;
+ Rm_PolicyPermBits permissionBits;
struct Rm_Permission_s *nextPermission;
} Rm_PolicyPermission;
-typedef struct {
- const void *assignmentData;
- int32_t assignmentLen;
- const void *allocationSizeData;
- int32_t allocationSizeLen;
- const void *alignmentData;
- int32_t alignmentLen;
-} Rm_PolicyNodeProperties;
-
-void Rm_policyIncrementValidInstAllocationCount(void *validInstNameNode);
-void Rm_policyDecrementValidInstAllocationCount(void *validInstNameNode);
-void *Rm_policyGetValidInstNode(void *validInstTree, char *instName);
-char *Rm_policyGetValidInstNodeName(void *validInstNode);
-void *Rm_policyGetLinuxInstNode(void *validInstTree);
-int32_t Rm_policyValidatePolicy(Rm_Inst *rmInst, void *policyDtb);
-void *Rm_policyCreateValidInstTree(void *policyDtb, int32_t *result);
-
/**********************************************************************
- ******************* Red-Black Tree BBST Defines **********************
+ ************** Policy Valid Instance Tree Definitions ****************
**********************************************************************/
/* Declare the tree structure nodes */
-typedef struct _Rm_ValidInstNode {
- RB_ENTRY(_Rm_ValidInstNode) linkage;
+typedef struct _Rm_PolicyValidInstNode {
+ RB_ENTRY(_Rm_PolicyValidInstNode) linkage;
char name[RM_INSTANCE_NAME_MAX_CHARS];
uint32_t allocRefCount;
bool deletePending;
-} Rm_ValidInstNode;
+} Rm_PolicyValidInstNode;
/* Declare the tree head structure. */
-typedef RB_HEAD(_Rm_ValidInstTree, _Rm_ValidInstNode) Rm_ValidInstTree;
+typedef RB_HEAD(_Rm_PolicyValidInstTree, _Rm_PolicyValidInstNode) Rm_PolicyValidInstTree;
-Rm_ValidInstNode *Rm_newValidInstNode(char *instName);
-void Rm_freeValidInstNode(Rm_ValidInstNode *node);
+Rm_PolicyValidInstNode *Rm_policyNewValidInstNode(char *instName);
+void Rm_policyFreeValidInstNode(Rm_PolicyValidInstNode *node);
/* Prototype for Valid Instance node comparison function
* element1 < element2 --> return < 0
* element1 = element2 --> return 0
* element1 > element2 --> return > 0 */
-int Rm_ValidInstNodeCompare(Rm_ValidInstNode *element1, Rm_ValidInstNode *element2);
+int Rm_policyValidInstNodeCompare(Rm_PolicyValidInstNode *node1, Rm_PolicyValidInstNode *node2);
/* Generate the tree prototypes */
-RB_PROTOTYPE(_Rm_ValidInstTree, _Rm_ValidInstNode, linkage, Rm_ValidInstNodeCompare);
+RB_PROTOTYPE(_Rm_PolicyValidInstTree, _Rm_PolicyValidInstNode,
+ linkage, Rm_policyValidInstNodeCompare);
+
+/**********************************************************************
+ *********************** Internal Policy APIs *************************
+ **********************************************************************/
+
+typedef enum {
+ Rm_policyCheck_EXCLUSIVE = 0,
+ Rm_policyCheck_INIT,
+ Rm_policyCheck_USE
+} Rm_PolicyCheckType;
+
+typedef struct {
+ Rm_PolicyCheckType type;
+ void *policyDtb;
+ Rm_PolicyValidInstNode *validInstNode;
+ int32_t resourceOffset;
+ uint32_t resourceBase;
+ uint32_t resourceLength;
+} Rm_PolicyCheckCfg;
+
+Rm_PolicyValidInstNode *Rm_policyGetValidInstNode(Rm_PolicyValidInstTree *validInstTree, char *instName);
+Rm_PolicyValidInstNode *Rm_policyGetLinuxInstNode(Rm_PolicyValidInstTree *validInstTree);
+bool Rm_policyCheckPrivilege(Rm_PolicyCheckCfg *privilegeCfg, int32_t *result);
+uint32_t Rm_policyGetResourceBase(void *policyDtb, Rm_PolicyValidInstNode *validInstNode,
+ int32_t resourceOffset, uint32_t allocType,
+ int32_t *result);
+uint32_t Rm_policyGetResourceAlignment(void *policyDtb, int32_t resourceOffset);
+int32_t Rm_policyGetResourceOffset(void *policyDtb, char *resourceName);
+int32_t Rm_policyValidatePolicyResourceNames(void *allocatorList, void *policyDtb);
+int32_t Rm_policyValidatePolicy(void *policyDtb, Rm_PolicyValidInstTree *validInstTree);
+Rm_PolicyValidInstTree *Rm_policyCreateValidInstTree(void *policyDtb, int32_t *result);
+void Rm_policyFreeValidInstTree(Rm_PolicyValidInstTree *validInstTree);
#ifdef __cplusplus
}