]> Gitweb @ Texas Instruments - Open Source Git Repositories - git.TI.com/gitweb - keystone-rtos/rm-lld.git/commitdiff
Started consolidating error codes and cleaning up static(premain) allocation code
authorJustin Sobota <jsobota@ti.com>
Thu, 31 Jan 2013 20:45:10 +0000 (15:45 -0500)
committerJustin Sobota <jsobota@ti.com>
Thu, 31 Jan 2013 20:45:10 +0000 (15:45 -0500)
include/rm_dtb_utilloc.h
include/rm_loc.h
include/rm_servicesloc.h
rm.h
rm_services.h
src/rm.c
src/rm_dtb_util.c
src/rm_services.c

index c7273c105b8b4c303a9e60dfcdeeca37f4d75ee1..21d0395fd9f8fd5260cdf75eb45c02943a25343d 100644 (file)
@@ -47,11 +47,6 @@ extern "C" {
 /* RM external includes */
 #include <ti/drv/rm/rm.h>
 
-/** 
-* @brief LIBFDT's return codes start at 1.  Map a return value of 0 to an okay result
-*        from the LIBFDT APIs
-*/
-#define RM_DTB_UTIL_RESULT_OKAY 0
 /** 
 * @brief DTB starting node offset for parsing
 */
index c4e3641eedcf05d517b56803a874b19fb352cca2..df6fb1113e8ab516b208e9de075d1977a1e7b663 100644 (file)
@@ -137,12 +137,10 @@ typedef struct Rm_Allocator_s {
 } Rm_Allocator;
 
 typedef struct {
-    char                    instName[RM_NAME_MAX_CHARS];
-    void                   *startupDtb;
-    Rm_PolicyValidInstTree *validInstTree;
-    uint32_t                requestCount;
-    Rm_ServicePreMainReq   *preMainReqList;
-} Rm_PreMainInst;
+    void                   *staticPolicy;
+    Rm_PolicyValidInstTree *staticValidInstTree;
+    Rm_ServiceStaticReq    *staticReqList;
+} Rm_StaticInfo;
 
 typedef struct {
     char                    instName[RM_NAME_MAX_CHARS];
@@ -150,7 +148,6 @@ typedef struct {
     Rm_ServiceHandle       *serviceHandle;
     bool                    registeredWithDelegateOrServer;
     void                   *policy;
-    void                   *staticPolicy;
     Rm_PolicyValidInstTree *validInstances;    
     Rm_Allocator           *allocators;
     Rm_NameServerTree      *nameServer;
@@ -158,15 +155,14 @@ typedef struct {
     uint32_t                transactionSeqNum;
     Rm_Transaction         *transactionQueue;
     Rm_TransportCallouts    transportCallouts;
+    Rm_StaticInfo           staticInfo;
 } 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);
index e8003a5521daa18450c4fa60c2d121af6d6419b6..9eab463ce0a2f6dec05db37f2dcb787a07709f8c 100644 (file)
@@ -1,5 +1,5 @@
 /*
- *  file  rmservicesloc.h
+ *  file  rm_servicesloc.h
  *
  *  Private data structures of Resource Manager services layer.
  *
@@ -47,10 +47,10 @@ extern "C" {
 /* RM external includes */
 #include <ti/drv/rm/rm_services.h>
 
-typedef struct Rm_ServicePreMainReq_s {
-    Rm_ServiceReqInfo *preMainReq;
-    struct Rm_ServicePreMainReq_s *nextPreMainReq;
-} Rm_ServicePreMainReq;
+typedef struct Rm_ServiceStaticReq_s {
+    Rm_ServiceReqInfo *staticReq;
+    struct Rm_ServiceStaticReq_s *nextStaticReq;
+} Rm_ServiceStaticReq;
 
 #ifdef __cplusplus
 }
diff --git a/rm.h b/rm.h
index e5e0ebed3ae1cf803c5d8a927b0ef28de783c7ff..ca6f1d2811a586fd4702a4f21beb6cc86dcbb2cd 100644 (file)
--- a/rm.h
+++ b/rm.h
@@ -88,7 +88,6 @@ extern "C" {
 #define RM_INIT_ERROR_POLICY_SYNTAX_ERROR_INVALID_PERM_CHAR -263
 #define RM_INIT_ERROR_POLICY_SYNTAX_ERROR_PERM_CHAR_WITHOUT_ASSIGN_CHAR -264
 #define RM_INIT_ERROR_POLICY_SYNTAX_ERROR_INVALID_CHAR_ON_RIGHT_WITH_ASSINMENT_ON_LEFT -265
-#define RM_INIT_ERROR_PREMAIN_INST_AND_POSTMAIN_INST_NAMES_DONT_MATCH -266
 #define RM_INIT_ERROR_POLICY_UNKNOWN_RESOURCE_PROPERTY -267
 #define RM_INIT_ERROR_POLICY_VALID_INSTANCE_NAME_TOO_LONG -268
 #define RM_INIT_ERROR_POLICY_SYNTAX_ERROR_INSTANCE_NAME_IN_ASSIGNMENT_TOO_LONG -269
@@ -97,6 +96,10 @@ extern "C" {
 #define RM_INIT_ERROR_SERVICE_HANDLE_MEMORY_ALLOC_FAILED -272
 #define RM_INIT_ERROR_SERVICE_HANDLE_ALREADY_ALLOCATED -273
 #define RM_INIT_ERROR_SERVICE_HANDLE_ALREADY_CLOSED_FOR_INSTANCE -274
+#define RM_INIT_ERROR_UNKNOWN_RESOURCE_LIST_PROPERTY_TYPE -275
+#define RM_INIT_ERROR_ALLOCATOR_DOES_NOT_EXIST -276
+#define RM_INIT_ERROR_RESOURCE_OVERLAP_WHEN_CREATING_ALLOCATOR -277
+#define RM_INIT_ERROR_COULD_NOT_LOCATE_RESOURCE_IN_LINUX_DTB -278
 
 /** RM Service Request State Codes and Errors */
 /** RM Service Request State Code Base */
@@ -165,10 +168,10 @@ extern "C" {
 /** The resource couldn't be allocated because it was already allocated to an instance with exclusive
  *  privileges for the resource */
 #define RM_SERVICE_DENIED_RESOURCE_ALLOCATED_TO_INSTANCE_WITH_EXCLUSIVE_PRIV (RM_SERVICE_DENIED_BEGIN+21)
-/** Pre main request was not an allocate use or allocate init request */
-#define RM_SERVICE_DENIED_INVALID_PREMAIN_REQUEST (RM_SERVICE_DENIED_BEGIN+22)
-/** Startup policy denied pre-main allocation request */
-#define RM_SERVICE_DENIED_POLICY_DENIED_PREMAIN_ALLOCATION (RM_SERVICE_DENIED_BEGIN+23)
+/** Static request was not an allocate use or allocate init request */
+#define RM_SERVICE_DENIED_INVALID_STATIC_REQUEST (RM_SERVICE_DENIED_BEGIN+22)
+/** Startup policy denied static allocation request */
+#define RM_SERVICE_DENIED_POLICY_DENIED_STATIC_ALLOCATION (RM_SERVICE_DENIED_BEGIN+23)
 /** End of resource denied reasons */
 #define RM_SERVICE_DENIED_END (RM_SERVICE_DENIED_BEGIN+23)
 
@@ -265,12 +268,6 @@ typedef enum {
     Rm_instType_CLIENT = 2
 } Rm_InstType;
 
-typedef struct {
-    char        *instName;
-    Rm_InstType  instType;
-    void        *startupPolicyDtb;
-} Rm_PreMainInitCfg;
-
 /** 
  * @brief RM instance initialization structure
  */
@@ -314,19 +311,20 @@ typedef struct {
      *  Note: This parameter will be ignored when the instance type is a 
      *        Client 
      */
-    void *policy;
+    void *dynamicPolicy;
+    /** static policy used for pre-main allocation of resources.  Resources given
+     *  in the static will be verified against the global policy once the RM
+     *  system is fully initialized */
+    void *staticPolicy;
 } Rm_InitCfg;
 
 /* TESTING PURPOSES: SERVER ONLY */
 void Rm_printResourceStatus(Rm_Handle *rmHandle);
 
 Rm_PreMainHandle Rm_preMainInit(Rm_PreMainInitCfg *preMainInitCfg, int32_t *result);
-/** [Server/Client Delegate Parameter] Pre-main allocation handle used to
- *  by application to request resources prior to main via the startup policy
- *  The preMainHandle will be used to validate the resources allocated prior
- *  to main
- */
-int32_t Rm_preMainHandleValidateAndDelete(Rm_Handle rmHandle, Rm_PreMainHandle rmPreMainHandle);
+
+
+int32_t Rm_validateStaticRequests(Rm_Handle rmHandle);
 
 /**
  *  @b Description
index 188ca45cdd783c27f46cc25a691d991c7c5e0a6a..4969f7445e9d4e363d854fc151e7c01eae0e664b 100644 (file)
@@ -173,41 +173,6 @@ typedef struct {
                               Rm_ServiceRespInfo *serviceResponse);
 } Rm_ServiceHandle;
 
-/** 
- * @brief RM pre-main allocation request information provided by the pre-main 
- *        startup function requesting the resource */
-typedef struct {
-    Rm_PreMainHandle   rmPreMainHandle;
-    Rm_ServiceReqInfo *request;
-} Rm_PreMainReqCfg;
-
-/**
- *  @b Description
- *  @n  
- *      Non-blocking function used by RTSC pre-main startup functions to
- *      allocate RM resources for usage.  Pre-main allocated resources will be 
- *      validated by RM against a memory-mapped startup resource policy.
- *      Pre-main allocation of unauthorized resources will result in a system
- *      exception.
- *
- *      Note: Resource pre-main allocations can only occur on a core that is 
- *            running a RM Server or Client Delegate that has a startup policy
- *            allowing the allocation of pre-main resources
- *
- *  @param[in]  preMainRequest
- *      Resource pre-main allocation structure that provides details of the 
- *      resource requested from RM for preallocation
- *
- *  @param[out] preMainResponse
- *      Contains the result information regarding the pre-main allocation request
- *
- *  @retval
- *      Success - 0 - Resource pre-main allocation request okay.
- *  @retval
- *      Failure - non-zero - Resource pre-main allocation request error.
- */
-void Rm_servicePreMainRequest(Rm_PreMainReqCfg *reqCfg, Rm_ServiceRespInfo *preMainResp);
-
 /**
  *  @b Description
  *  @n  
index 1baa97ff2d0d1e17b0858751ed4f80e9dfbc0421..3dfb2bb8b288439ef4019f47962ebb3c57110f0c 100644 (file)
--- a/src/rm.c
+++ b/src/rm.c
@@ -70,7 +70,6 @@
 /**********************************************************************\r
  ************************** Globals ***********************************\r
  **********************************************************************/\r
-extern const char rmDtbStartingNode[];\r
 \r
 /** @brief Global Variable which describes the RM Version Information */\r
 const char  rmVersionStr[] = RM_VERSION_STR ":" __DATE__  ":" __TIME__;\r
@@ -227,18 +226,15 @@ int32_t rmAllocatorDelete(Rm_Inst *rmInst, char *resourceName)
 \r
     if (allocator) {\r
         if (prevAllocator == NULL) {\r
-            /* Allocator at start of list. Map second allocator to start of list \r
-             * as long as more than one allocators. */\r
             rmInst->allocators = allocator->nextAllocator;\r
         }\r
         else {\r
-            /* Allocator in middle or end of list. */\r
             prevAllocator->nextAllocator = allocator->nextAllocator;\r
         }\r
         Rm_osalFree((void *)allocator, sizeof(Rm_Allocator));\r
     }\r
     else {\r
-        retVal = -22; /* TEMP ERROR: Can't conflict with LIBFDT errors */\r
+        retVal = RM_INIT_ERROR_ALLOCATOR_DOES_NOT_EXIST;\r
     }\r
     return (retVal);\r
 }\r
@@ -404,13 +400,13 @@ int32_t rmCreateTreeAllocator(Rm_Inst *rmInst, const char *resourceName, Rm_Reso
                }\r
             Rm_osalFree((void *)treeRootEntry, sizeof(Rm_ResourceTree));\r
             rmAllocatorDelete(rmInst, allocator->resourceName);\r
-            return (-24); /* TODO FIX RETURN */\r
+            return (RM_INIT_ERROR_RESOURCE_OVERLAP_WHEN_CREATING_ALLOCATOR);\r
         }\r
         range = range->nextRange;\r
     }\r
     \r
     allocator->allocatorRootEntry = treeRootEntry;\r
-    return(0);   /* TODO: FIX THIS RETURN */\r
+    return(RM_INIT_OK);\r
 }\r
 \r
 /* Called when an allocate request is made but the base is unspecified.  RM must preallocate\r
@@ -1304,12 +1300,12 @@ void rmTransactionProcessor (Rm_Inst *rmInst, Rm_Transaction *transaction)
 int32_t rmReserveLinuxResource(Rm_Inst *rmInst, Rm_LinuxAlias *linuxAlias, \r
                                Rm_LinuxValueRange *linuxValues, Rm_AllocatorOpInfo *opInfo)\r
 {\r
-    int32_t  retVal = RM_DTB_UTIL_RESULT_OKAY;\r
+    int32_t  retVal = RM_INIT_OK;\r
     bool     baseFound = FALSE;\r
     bool     lengthFound = FALSE;\r
     uint32_t valueIndex = 0;\r
 \r
-    while ((linuxValues != NULL) && (!baseFound || !lengthFound)) {\r
+    while ((linuxValues) && (!baseFound || !lengthFound)) {\r
         if (linuxAlias->baseOffset == valueIndex) {\r
             opInfo->resourceInfo->base = linuxValues->value;\r
             baseFound = TRUE;\r
@@ -1329,7 +1325,7 @@ int32_t rmReserveLinuxResource(Rm_Inst *rmInst, Rm_LinuxAlias *linuxAlias,
     }\r
 \r
     if (!baseFound || !lengthFound) {\r
-        retVal = -33; /* TODO: ERROR BASE OR LENGTH OFFSET IN LINUX DTB WAS INCORRECT */\r
+        retVal = RM_INIT_ERROR_COULD_NOT_LOCATE_RESOURCE_IN_LINUX_DTB;\r
     }\r
     else {\r
         /* Allocate resource to Linux */\r
@@ -1354,7 +1350,7 @@ int32_t rmFindAndReserveLinuxResource(Rm_Inst *rmInst, const char *resourceName,
     const char         *propertyName;\r
     const void         *propertyData; \r
     Rm_LinuxValueRange *linuxValueRange;\r
-    int32_t             retVal = RM_DTB_UTIL_RESULT_OKAY\r
+    int32_t             retVal = RM_INIT_OK\r
 \r
     memset((void *) &opInfo, 0, sizeof(Rm_AllocatorOpInfo));\r
     memset((void *) &resourceInfo, 0, sizeof(Rm_ResourceInfo));\r
@@ -1364,7 +1360,7 @@ int32_t rmFindAndReserveLinuxResource(Rm_Inst *rmInst, const char *resourceName,
     opInfo.operation = Rm_allocatorOp_ALLOCATE;\r
     opInfo.resourceInfo = &resourceInfo;    \r
 \r
-    while(linuxAlias != NULL) {\r
+    while(linuxAlias) {\r
         /* Reset parsing variables */\r
         pathOffset = 0;\r
         pathSize = strlen(linuxAlias->path) + 1;\r
@@ -1386,7 +1382,7 @@ int32_t rmFindAndReserveLinuxResource(Rm_Inst *rmInst, const char *resourceName,
                 if ((depth < prevDepth) || (nodeOffset == -FDT_ERR_NOTFOUND)) {\r
                     /* Returning from subnode that matched part of alias path without finding\r
                      * resource values */\r
-                    retVal = (-31); /* TODO: COULD NOT FIND RESOURCE AT ALIAS PATH */\r
+                    retVal = (RM_INIT_ERROR_COULD_NOT_LOCATE_RESOURCE_IN_LINUX_DTB);\r
                     break;\r
                 }\r
             }\r
@@ -1423,7 +1419,7 @@ int32_t rmFindAndReserveLinuxResource(Rm_Inst *rmInst, const char *resourceName,
             }\r
         }\r
 \r
-        if (retVal < RM_DTB_UTIL_RESULT_OKAY) {\r
+        if (retVal < RM_INIT_OK) {\r
             break;\r
         }\r
         linuxAlias = (Rm_LinuxAlias *) linuxAlias->nextLinuxAlias;\r
@@ -1440,13 +1436,13 @@ int32_t rmCreateAndInitAllocator(Rm_Inst *rmInst, const char *resourceName,
     Rm_NsAssignment     *nsAssignmentBasePtr = NULL;\r
     Rm_LinuxAlias       *linuxAlias = NULL;\r
     Rm_NameServerObjCfg  nameServerObjCfg;      \r
-    int32_t              retVal = RM_DTB_UTIL_RESULT_OKAY;\r
+    int32_t              retVal = RM_INIT_OK;\r
 \r
     if (resourceProperties->rangeData && (resourceProperties->rangeLen > 0)) {\r
         range = rangeBasePtr = rmDtbUtilResExtractRange(resourceProperties->rangeData, \r
                                                         resourceProperties->rangeLen);\r
         \r
-        if ((retVal = rmCreateTreeAllocator(rmInst, resourceName, range)) >= RM_DTB_UTIL_RESULT_OKAY) {\r
+        if ((retVal = rmCreateTreeAllocator(rmInst, resourceName, range)) >= RM_INIT_OK) {\r
             if (resourceProperties->linuxAliasData && resourceProperties->linuxAliasLen) {\r
                 linuxAlias = rmDtbUtilResExtractLinuxAlias(resourceProperties->linuxAliasData,\r
                                                            resourceProperties->linuxAliasLen, &retVal);\r
@@ -1457,7 +1453,7 @@ int32_t rmCreateAndInitAllocator(Rm_Inst *rmInst, const char *resourceName,
         }\r
     }\r
     \r
-    if (retVal >= RM_DTB_UTIL_RESULT_OKAY) {\r
+    if (retVal >= RM_INIT_OK) {\r
         if (resourceProperties->nsAssignData && resourceProperties->nsAssignLen) {\r
             nsAssignments = rmDtbUtilResExtractNsAssignment(resourceProperties->nsAssignData, \r
                                                             resourceProperties->nsAssignLen, &retVal);\r
@@ -1470,8 +1466,6 @@ int32_t rmCreateAndInitAllocator(Rm_Inst *rmInst, const char *resourceName,
                     nameServerObjCfg.nodeCfg.resourceName = (char *)resourceName;\r
                     nameServerObjCfg.nodeCfg.resourceBase= nsAssignments->resourceBase;\r
                     nameServerObjCfg.nodeCfg.resourceLength = nsAssignments->resourceLength;                \r
-                    \r
-                    /* TODO: RETURN IF ANY OF THE ADDS FAIL??? */\r
                     rmNameServerAddObject(&nameServerObjCfg);\r
                     nsAssignments = nsAssignments->nextNsAssignment;\r
                 }\r
@@ -1489,153 +1483,85 @@ int32_t rmCreateAndInitAllocator(Rm_Inst *rmInst, const char *resourceName,
 \r
 int32_t rmParseResourceProperty(void *globalResourceDtb, int32_t offset, Rm_ResourceProperties *propertyInfo)\r
 {\r
-       int32_t propertyLen;\r
-       const char *propertyName;\r
-       const void *propertyData;\r
-    Rm_ResourcePropType propertyType;\r
-    int32_t retVal = RM_DTB_UTIL_RESULT_OKAY;\r
+       int32_t              propertyLen;\r
+       const char          *propertyName;\r
+       const void          *propertyData;\r
+    Rm_ResourcePropType  propertyType;\r
+    int32_t              retVal = RM_INIT_OK;\r
 \r
-    /* Get the property data and store it in the corresponding propertyInfo field */\r
        propertyData = fdt_getprop_by_offset(globalResourceDtb, offset, &propertyName, &propertyLen);\r
-    if (propertyData)\r
-    {\r
-        propertyType = rmDtbUtilResGetPropertyType(propertyName);\r
-        if (propertyType == Rm_resourcePropType_RESOURCE_RANGE)\r
-        {\r
-            if (propertyInfo->rangeData || propertyInfo->rangeLen)\r
-            {\r
-                /* The range fields have already been populated.  Return an error.\r
-                 * The resource list has specified a property field more than once\r
-                 * for a resource node */\r
-                retVal = -18; /* TEMP ERROR: Can't conflict with LIBFDT errors */\r
-            }\r
-            else\r
-            {\r
-                propertyInfo->rangeData = propertyData;\r
-                propertyInfo->rangeLen = propertyLen;\r
-            }\r
-        }\r
-        else if (propertyType == Rm_resourcePropType_NSASSIGNMENT)\r
-        {\r
-            if (propertyInfo->nsAssignData || propertyInfo->nsAssignLen)\r
-            {\r
-                /* The nsAssign fields have already been populated.  Return an error.\r
-                 * The resource list has specified a property field more than once\r
-                 * for a resource node */\r
-                retVal = -19; /* TEMP ERROR: Can't conflict with LIBFDT errors */\r
-            }\r
-            else\r
-            {\r
-                propertyInfo->nsAssignData = propertyData;\r
-                propertyInfo->nsAssignLen = propertyLen;\r
-            }\r
-        }\r
-        else if (propertyType == Rm_resourcePropType_RESOURCE_LINUX_ALIAS)\r
-        {\r
-            if (propertyInfo->linuxAliasData || propertyInfo->linuxAliasLen)\r
-            {\r
-                /* The linuxAlias fields have already been populated.  Return an error.\r
-                 * The resource list has specified a property field more than once\r
-                 * for a resource node */\r
-                retVal = -28; /* TEMP ERROR: Can't conflict with LIBFDT errors */\r
-            }\r
-            else\r
-            {\r
-                propertyInfo->linuxAliasData = propertyData;\r
-                propertyInfo->linuxAliasLen = propertyLen;\r
-            }\r
-        }        \r
-        else\r
-        {\r
-            retVal = -20; /* TEMP ERROR: Can't conflict with LIBFDT errors */\r
-        }\r
-    }\r
-    else\r
-    {\r
-        retVal = -16; /* TEMP ERROR: Can't conflict with LIBFDT errors */\r
+    propertyType = rmDtbUtilResGetPropertyType(propertyName);\r
+    if (propertyType == Rm_resourcePropType_RESOURCE_RANGE) {\r
+        propertyInfo->rangeData = propertyData;\r
+        propertyInfo->rangeLen = propertyLen;\r
+    }\r
+    else if (propertyType == Rm_resourcePropType_NSASSIGNMENT) {\r
+        propertyInfo->nsAssignData = propertyData;\r
+        propertyInfo->nsAssignLen = propertyLen;\r
+    }\r
+    else if (propertyType == Rm_resourcePropType_RESOURCE_LINUX_ALIAS) {\r
+        propertyInfo->linuxAliasData = propertyData;\r
+        propertyInfo->linuxAliasLen = propertyLen;\r
+    }        \r
+    else {\r
+        retVal = RM_INIT_ERROR_UNKNOWN_RESOURCE_LIST_PROPERTY_TYPE;\r
     }\r
 \r
-    /* Don't get anymore properties if error occurred */\r
-    if (retVal == RM_DTB_UTIL_RESULT_OKAY)\r
-    {\r
+    if (retVal == RM_INIT_OK) {\r
         offset = fdt_next_property_offset(globalResourceDtb, offset);\r
-       if (offset >= 0)\r
-       {\r
+       if (offset >= 0) {\r
            retVal = rmParseResourceProperty(globalResourceDtb, offset, propertyInfo);\r
        }\r
-        else if (offset != -FDT_ERR_NOTFOUND)\r
-        {\r
-            /* Error was returned by LIBFDT when parsing the properties */\r
+        else if (offset != -FDT_ERR_NOTFOUND) {\r
+            /* Error returned by LIBFDT */\r
             retVal = offset;\r
         }\r
     }\r
-    \r
     return (retVal);\r
 }\r
 \r
 int32_t rmParseResourceNode(Rm_Inst *rmInst, void *globalResourceDtb, int32_t nodeOffset, int32_t depth,\r
                             void *linuxDtb)\r
 {\r
-       const char *resourceName = fdt_get_name(globalResourceDtb, nodeOffset, NULL);\r
-    Rm_ResourceProperties resourceProperties;\r
-       int32_t error = RM_DTB_UTIL_RESULT_OKAY;\r
-       int32_t offset;\r
+       const char            *resourceName = fdt_get_name(globalResourceDtb, nodeOffset, NULL);\r
+    Rm_ResourceProperties  resourceProperties;\r
+       int32_t                retVal = RM_INIT_OK;\r
+       int32_t                offset;\r
 \r
-    /* Initialize the resource properties structure */\r
     memset((void *)&resourceProperties, 0, sizeof(Rm_ResourceProperties));\r
-\r
-    /* Ignore properties of the base node */\r
-    if (strcmp(resourceName, rmDtbStartingNode))\r
-    {\r
-        /* Get the properties for the resource node if any exist */\r
-       offset = fdt_first_property_offset(globalResourceDtb, nodeOffset);\r
-       if (offset >= RM_DTB_UTIL_STARTING_NODE_OFFSET)\r
-       {\r
-            /* Since at least one property exists attempt to parse the property nodes and \r
-             * use them to create and initialize a resource allocator */\r
-               error =  rmParseResourceProperty(globalResourceDtb, offset, &resourceProperties);\r
-            if (error < -FDT_ERR_NOTFOUND)\r
-            {\r
-                return (error);\r
-            }\r
-            \r
-            /* Initialize an allocator with the resource properties if no error was returned */\r
-            rmCreateAndInitAllocator(rmInst, resourceName, &resourceProperties, linuxDtb);\r
-       }\r
-        else if (offset != -FDT_ERR_NOTFOUND)\r
-        {\r
-               /* Error was returned by LIBFDT when parsing the properties */\r
-            return (offset);\r
+    /* Get properties of resource node */\r
+       offset = fdt_first_property_offset(globalResourceDtb, nodeOffset);\r
+       if (offset >= RM_DTB_UTIL_STARTING_NODE_OFFSET) {\r
+               retVal =  rmParseResourceProperty(globalResourceDtb, offset, &resourceProperties);\r
+        if (retVal < -FDT_ERR_NOTFOUND) {\r
+            return (retVal);\r
         }\r
+        rmCreateAndInitAllocator(rmInst, resourceName, &resourceProperties, linuxDtb);\r
+       }\r
+    else if (offset != -FDT_ERR_NOTFOUND) {\r
+               /* Error returned by LIBFDT */\r
+        return (offset);\r
     }\r
     \r
-    /* Get the next resource node */\r
        offset = fdt_next_node(globalResourceDtb, nodeOffset, &depth);\r
-    /* Check the offset and depth of the next node to make sure the current node\r
-     * wasn't the last node in the Resource List.  A depth less than the depth set\r
-     * at the start of the recursion will signal the end of the resource list */\r
-    if ((offset >= RM_DTB_UTIL_STARTING_NODE_OFFSET) && (depth >= RM_DTB_UTIL_STARTING_DEPTH))\r
-    {\r
-        error = rmParseResourceNode(rmInst, globalResourceDtb, offset, depth, linuxDtb);\r
-        if (error < -FDT_ERR_NOTFOUND)\r
-        {\r
-            return (error);\r
+    if ((offset >= RM_DTB_UTIL_STARTING_NODE_OFFSET) && (depth >= RM_DTB_UTIL_STARTING_DEPTH)) {\r
+        retVal = rmParseResourceNode(rmInst, globalResourceDtb, offset, depth, linuxDtb);\r
+        if (retVal < -FDT_ERR_NOTFOUND) {\r
+            return (retVal);\r
         }\r
     }\r
-    else if (offset != -FDT_ERR_NOTFOUND)\r
-    {\r
-        /* Error was returned by LIBFDT when parsing the nodes */\r
+    else if (offset != -FDT_ERR_NOTFOUND) {\r
+        /* Error returned by LIBFDT */\r
         return (offset);\r
     }\r
-\r
-    return (RM_DTB_UTIL_RESULT_OKAY);\r
+    return (retVal);\r
 }\r
 \r
 int32_t rmInitializeAllocators(Rm_Inst *rmInst, void *globalResourceDtb, void *linuxDtb)\r
 {\r
     int32_t nodeOffset = RM_DTB_UTIL_STARTING_NODE_OFFSET;\r
     int32_t startDepth = RM_DTB_UTIL_STARTING_DEPTH;\r
-    int32_t result = RM_DTB_UTIL_RESULT_OKAY;\r
+    int32_t result = RM_INIT_OK;\r
 \r
     /* Recursively parse the Global Resource List, creating an allocator for\r
      * each resource as specified in the node */\r
@@ -1657,42 +1583,39 @@ void Rm_printResourceStatus(Rm_Handle *rmHandle)
     Rm_ResourceTree *treeRoot;\r
     Rm_ResourceNode *treeNode;\r
 \r
-    while (allocator != NULL) {\r
-        Rm_osalLog("Resource: %s\n", allocator->resourceName);\r
+    if (rmInst->instType == Rm_instType_SERVER) {\r
+        while (allocator != NULL) {\r
+            Rm_osalLog("Resource: %s\n", allocator->resourceName);\r
 \r
-        treeRoot = allocator->allocatorRootEntry;\r
+            treeRoot = allocator->allocatorRootEntry;\r
 \r
-        RB_FOREACH(treeNode, _Rm_AllocatorResourceTree, treeRoot) {               \r
-            Rm_osalLog("          %10d - %10d ", treeNode->base, \r
-                                                 treeNode->base + treeNode->length -1);\r
-            \r
-            if (treeNode->allocationCount == 0) {\r
-                Rm_osalLog("NOT ALLOCATED\n");\r
-            }\r
-            else {\r
-                owners = treeNode->ownerList;\r
-                Rm_osalLog("allocated to ");\r
-                while (owners) {\r
-                    Rm_osalLog(" %s", owners->instNameNode->name);\r
-                    owners = owners->nextOwner;\r
+            RB_FOREACH(treeNode, _Rm_AllocatorResourceTree, treeRoot) {               \r
+                Rm_osalLog("          %10d - %10d ", treeNode->base, \r
+                                                     treeNode->base + treeNode->length -1);\r
+                \r
+                if (treeNode->allocationCount == 0) {\r
+                    Rm_osalLog("NOT ALLOCATED\n");\r
                 }\r
-                Rm_osalLog("\n");\r
-            }\r
-        }        \r
-        allocator = allocator->nextAllocator;\r
+                else {\r
+                    owners = treeNode->ownerList;\r
+                    Rm_osalLog("allocated to ");\r
+                    while (owners) {\r
+                        Rm_osalLog(" %s", owners->instNameNode->name);\r
+                        owners = owners->nextOwner;\r
+                    }\r
+                    Rm_osalLog("\n");\r
+                }\r
+            }        \r
+            allocator = allocator->nextAllocator;\r
+        }\r
+        rmNameServerPrintObjects(rmInst->nameServer);\r
     }\r
-\r
-    rmNameServerPrintObjects(rmInst->nameServer);\r
 }\r
 \r
 Rm_PreMainHandle Rm_preMainInit(Rm_PreMainInitCfg *preMainInitCfg, int32_t *result)\r
 {\r
     Rm_PreMainInst *preMainInst;\r
 \r
-    if ((strlen(preMainInitCfg->instName) + 1) > RM_NAME_MAX_CHARS) {\r
-        *result = RM_INIT_ERROR_INSTANCE_NAME_TOO_BIG;\r
-        return (NULL);\r
-    }\r
 \r
     preMainInst = (Rm_PreMainInst *) Rm_osalMalloc (sizeof(Rm_PreMainInst));\r
     fdt_open_into(preMainInitCfg->startupPolicyDtb, preMainInitCfg->startupPolicyDtb,\r
@@ -1721,33 +1644,6 @@ Rm_PreMainHandle Rm_preMainInit(Rm_PreMainInitCfg *preMainInitCfg, int32_t *resu
     return((Rm_PreMainHandle)preMainInst);\r
 }\r
 \r
-int32_t Rm_preMainHandleValidateAndDelete(Rm_Handle rmHandle, Rm_PreMainHandle rmPreMainHandle)\r
-{\r
-    Rm_Inst              *rmInst = (Rm_Inst *)rmHandle;\r
-    Rm_PreMainInst       *preMainInst = (Rm_PreMainInst *)rmPreMainHandle;\r
-    Rm_ServicePreMainReq *serviceReq = preMainInst->preMainReqList;\r
-    Rm_ServicePreMainReq *nextServiceReq;\r
-    int32_t retVal = RM_INIT_OK;\r
-\r
-    if (strcmp(rmInst->instName, preMainInst->instName) == 0) {\r
-        /* TODO: Validate the requests against the global policyDtb */\r
-\r
-        /* Free all memory associated with the pre-main instance */\r
-        rmPolicyFreeValidInstTree(preMainInst->validInstTree);\r
-        while(serviceReq) {\r
-            nextServiceReq = serviceReq->nextPreMainReq;\r
-            Rm_osalFree((void *)serviceReq->preMainReq, sizeof(Rm_ServiceReqInfo));\r
-            Rm_osalFree((void *)serviceReq, sizeof(Rm_ServicePreMainReq));\r
-            serviceReq = nextServiceReq;\r
-        }\r
-        Rm_osalFree((void *)preMainInst, sizeof(Rm_PreMainInst));\r
-    }\r
-    else {\r
-        retVal = RM_INIT_ERROR_PREMAIN_INST_AND_POSTMAIN_INST_NAMES_DONT_MATCH;\r
-    }\r
-    return(retVal);\r
-}\r
-\r
 Rm_Handle Rm_init(Rm_InitCfg *initCfg, int32_t *result)\r
 {\r
     Rm_Inst *rmInst;\r
@@ -1776,8 +1672,8 @@ Rm_Handle Rm_init(Rm_InitCfg *initCfg, int32_t *result)
     rmInst->transactionSeqNum = rmTransactionInitSequenceNum();\r
     rmInst->transactionQueue= NULL;\r
 \r
-    if ((rmInst->instType != Rm_instType_CLIENT) && initCfg->policy) {\r
-        rmInst->policy = initCfg->policy;\r
+    if ((rmInst->instType != Rm_instType_CLIENT) && initCfg->dynamicPolicy) {\r
+        rmInst->policy = initCfg->dynamicPolicy;\r
         fdt_open_into(rmInst->policy, rmInst->policy, fdt_totalsize(rmInst->policy)); \r
 \r
         /* Create valid instance list from policy.  Must be done prior to parsing\r
@@ -1803,7 +1699,7 @@ Rm_Handle Rm_init(Rm_InitCfg *initCfg, int32_t *result)
         }\r
     }\r
 \r
-    if ((rmInst->instType != Rm_instType_CLIENT) && initCfg->policy) {\r
+    if ((rmInst->instType != Rm_instType_CLIENT) && initCfg->dynamicPolicy) {\r
         *result = rmPolicyValidatePolicyResourceNames(rmInst->policy, (void *)rmInst->allocators);\r
     }    \r
 \r
index aaf2c896cd236e06e991ccaf7f2808b8e87c7c46..eddbf769dbed93b5d18b1c57c6a569e47e148147 100644 (file)
@@ -60,8 +60,6 @@
  ******************** Common DTB Parsing Globals **********************
  **********************************************************************/
 
-const char rmDtbStartingNode[] = "\0";
-
 /**********************************************************************
  *************** Global Resource List Parsing Globals *****************
  **********************************************************************/
index 5120cd6754cc0423d6d99698b44fe6c996ca5731..885fd96380b8999b5d1a07159633cd4758afae73 100644 (file)
 void Rm_serviceHandler (void *rmHandle, Rm_ServiceReqInfo *serviceRequest,
                         Rm_ServiceRespInfo *serviceResponse)
 {
-    Rm_Inst        *rmInst = (Rm_Inst *)rmHandle;
-    Rm_Transaction *transaction;
+    Rm_Inst             *rmInst = (Rm_Inst *)rmHandle;
+    Rm_Transaction      *transaction;
+    Rm_PolicyCheckCfg    privCheckCfg;
+    Rm_ServiceStaticReq *lastStaticReq;
 
-    if (serviceRequest->callback.serviceCallback == NULL) {
-        serviceResponse->serviceState = RM_SERVICE_ERROR_CALLBACK_NOT_PROVIDED;
-        return;
-    }
+    if (serviceRequest->reqType == Rm_reqType_STATIC) {
+        serviceResponse->serviceState = RM_SERVICE_PROCESSING;
 
-    if (serviceRequest->type >= Rm_service_LAST) {
-        serviceResponse->serviceState = RM_SERVICE_ERROR_INVALID_SERVICE_TYPE;
-        return;
-    }
-    
-    transaction = rmTransactionQueueAdd(rmInst);
-    if (transaction) {
-        transaction->type = serviceRequest->type;
-        strncpy(transaction->serviceSrcInstName, rmInst->instName, RM_NAME_MAX_CHARS);
-        transaction->callback.serviceCallback = serviceRequest->callback.serviceCallback;
-        transaction->state = RM_SERVICE_PROCESSING;
-        if (serviceRequest->resourceName) {
-            strncpy(transaction->resourceInfo.name, serviceRequest->resourceName, RM_NAME_MAX_CHARS);
+        if ((serviceRequest->serviceType == Rm_service_RESOURCE_ALLOCATE_INIT) ||
+            (serviceRequest->serviceType == Rm_service_RESOURCE_ALLOCATE_USE) ||
+            (serviceRequest->resourceBase != RM_RESOURCE_BASE_UNSPECIFIED)) {
+            /* Check request against startup policy */
+            memset((void *)&privCheckCfg, 0, sizeof(Rm_PolicyCheckCfg));
+
+            if (serviceRequest->serviceType == Rm_service_RESOURCE_ALLOCATE_INIT) {
+                privCheckCfg.type = Rm_policyCheck_INIT;
+            }
+            else {
+                privCheckCfg.type = Rm_policyCheck_USE;
+            }
+            privCheckCfg.policyDtb = rmInst->staticInfo.staticPolicy;
+            privCheckCfg.validInstNode = rmPolicyGetValidInstNode(rmInst->staticInfo.staticValidInstTree, 
+                                                                  rmInst->instName);
+            privCheckCfg.resourceOffset = rmPolicyGetResourceOffset(rmInst->staticInfo.staticPolicy,
+                                                                    serviceRequest->resourceName);
+            privCheckCfg.resourceBase = serviceRequest->resourceBase;
+            privCheckCfg.resourceLength = serviceRequest->resourceLength;
+
+            if (rmPolicyCheckPrivilege(&privCheckCfg, &serviceResponse->serviceState)) {
+                serviceResponse->serviceState = RM_SERVICE_APPROVED_AND_COMPLETED;
+            }
+            else if (serviceResponse->serviceState == RM_SERVICE_PROCESSING) {
+                /* Privilege check returned FALSE without error */
+                serviceResponse->serviceState = RM_SERVICE_DENIED_POLICY_DENIED_STATIC_ALLOCATION;
+            }
         }
-        transaction->resourceInfo.base = serviceRequest->resourceBase;
-        transaction->resourceInfo.length = serviceRequest->resourceLength;
-        transaction->resourceInfo.alignment = serviceRequest->resourceAlignment;
-        if (serviceRequest->resourceNsName) {
-            strncpy(transaction->resourceInfo.nameServerName, serviceRequest->resourceNsName, RM_NAME_MAX_CHARS);
+        else {
+            serviceResponse->serviceState = RM_SERVICE_DENIED_INVALID_STATIC_REQUEST;
+        }
+
+        /* Store request for validation after instance transports have been established */
+        if (serviceResponse->serviceState == RM_SERVICE_APPROVED_AND_COMPLETED) {
+            lastStaticReq = rmInst->staticInfo.staticReqList;
+            while(lastStaticReq) {
+                lastStaticReq = lastStaticReq->nextStaticReq;
+            }
+            lastStaticReq = (Rm_ServiceStaticReq *) Rm_osalMalloc (sizeof(Rm_ServiceStaticReq));
+            lastStaticReq->nextStaticReq = NULL;
+            lastStaticReq->staticReq = (Rm_ServiceReqInfo *) Rm_osalMalloc(sizeof(Rm_ServiceReqInfo));
+            memcpy((void *)lastStaticReq->staticReq, (void *)serviceRequest, sizeof(Rm_ServiceReqInfo));
+
+            /* Fill out response */
+            serviceResponse->resourceBase = serviceRequest->resourceBase;
+            serviceResponse->resourceLength = serviceRequest->resourceLength;
+            strncpy(serviceResponse->resourceName, serviceRequest->resourceName, RM_NAME_MAX_CHARS);
+            serviceResponse->serviceId = rmTransactionGetSequenceNum(rmInst);
+        }
+    }
+    else if (serviceRequest->reqType == Rm_reqType_DYNAMIC) {
+        if (serviceRequest->callback.serviceCallback == NULL) {
+            serviceResponse->serviceState = RM_SERVICE_ERROR_CALLBACK_NOT_PROVIDED;
+            return;
         }
 
-        rmTransactionProcessor (rmInst, transaction);
-        serviceResponse->serviceState = transaction->state;
-        if (serviceResponse->serviceState == RM_SERVICE_PROCESSING) {
-            /* Service still being processed.  Provide transaction ID
-             * back to component so it can sort service responses received
-             * via callback function */
-            serviceResponse->serviceId = transaction->localId;
+        if (serviceRequest->serviceType >= Rm_service_LAST) {
+            serviceResponse->serviceState = RM_SERVICE_ERROR_INVALID_SERVICE_TYPE;
+            return;
         }
-        else if (serviceResponse->serviceState == RM_SERVICE_APPROVED_AND_COMPLETED) {
-            if ((transaction->type == Rm_service_RESOURCE_ALLOCATE_INIT) ||
-                (transaction->type == Rm_service_RESOURCE_ALLOCATE_USE) ||
-                (transaction->type == Rm_service_RESOURCE_GET_BY_NAME)) {
-                strncpy(serviceResponse->resourceName, transaction->resourceInfo.name, RM_NAME_MAX_CHARS);
-                serviceResponse->resourceBase = transaction->resourceInfo.base;
-                serviceResponse->resourceLength = transaction->resourceInfo.length;
+        
+        transaction = rmTransactionQueueAdd(rmInst);
+        if (transaction) {
+            transaction->type = serviceRequest->serviceType;
+            strncpy(transaction->serviceSrcInstName, rmInst->instName, RM_NAME_MAX_CHARS);
+            transaction->callback.serviceCallback = serviceRequest->callback.serviceCallback;
+            transaction->state = RM_SERVICE_PROCESSING;
+            if (serviceRequest->resourceName) {
+                strncpy(transaction->resourceInfo.name, serviceRequest->resourceName, RM_NAME_MAX_CHARS);
+            }
+            transaction->resourceInfo.base = serviceRequest->resourceBase;
+            transaction->resourceInfo.length = serviceRequest->resourceLength;
+            transaction->resourceInfo.alignment = serviceRequest->resourceAlignment;
+            if (serviceRequest->resourceNsName) {
+                strncpy(transaction->resourceInfo.nameServerName, serviceRequest->resourceNsName, RM_NAME_MAX_CHARS);
+            }
+
+            rmTransactionProcessor (rmInst, transaction);
+            serviceResponse->serviceState = transaction->state;
+            if (serviceResponse->serviceState == RM_SERVICE_PROCESSING) {
+                /* Service still being processed.  Provide transaction ID
+                 * back to component so it can sort service responses received
+                 * via callback function */
+                serviceResponse->serviceId = transaction->localId;
+            }
+            else if (serviceResponse->serviceState == RM_SERVICE_APPROVED_AND_COMPLETED) {
+                if ((transaction->type == Rm_service_RESOURCE_ALLOCATE_INIT) ||
+                    (transaction->type == Rm_service_RESOURCE_ALLOCATE_USE) ||
+                    (transaction->type == Rm_service_RESOURCE_GET_BY_NAME)) {
+                    strncpy(serviceResponse->resourceName, transaction->resourceInfo.name, RM_NAME_MAX_CHARS);
+                    serviceResponse->resourceBase = transaction->resourceInfo.base;
+                    serviceResponse->resourceLength = transaction->resourceInfo.length;
+                }
+                rmTransactionQueueDelete(rmInst, transaction->localId);
+            }
+            else {
+                rmTransactionQueueDelete(rmInst, transaction->localId);
             }
-            rmTransactionQueueDelete(rmInst, transaction->localId);
         }
         else {
-            rmTransactionQueueDelete(rmInst, transaction->localId);
+            serviceResponse->serviceState = RM_SERVICE_ERROR_TRANSACTION_FAILED_TO_ALLOCATE;    
         }
     }
-    else {
-        serviceResponse->serviceState = RM_SERVICE_ERROR_TRANSACTION_FAILED_TO_ALLOCATE;    
-    }
     return;
 }
 
-void Rm_servicePreMainRequest(Rm_PreMainReqCfg *reqCfg, Rm_ServiceRespInfo *preMainResp)
+void Rm_serviceValidateStaticRequests(Rm_Handle rmHandle, Rm_ServiceCallback validateCallback)
 {
-    Rm_PreMainInst       *preMainInst = (Rm_PreMainInst *)reqCfg->rmPreMainHandle;
-    Rm_PolicyCheckCfg     privCheckCfg;
-    Rm_ServicePreMainReq *lastServiceReq;
-
-    preMainResp->serviceState = RM_SERVICE_PROCESSING;
-    preMainResp->serviceId = 0;
+    Rm_Inst             *rmInst = (Rm_Inst *)rmHandle;
+    Rm_ServiceReqInfo   *staticRequest;
+    Rm_ServiceStaticReq *nextServiceReq;
+    Rm_Transaction      *transaction;
+    Rm_ServiceRespInfo   serviceResponse;
 
-    if ((reqCfg->request->type == Rm_service_RESOURCE_ALLOCATE_INIT) ||
-        (reqCfg->request->type == Rm_service_RESOURCE_ALLOCATE_USE) ||
-        (reqCfg->request->resourceBase == RM_RESOURCE_BASE_UNSPECIFIED)) {
-        /* Check request against startup policy */
-        memset((void *)&privCheckCfg, 0, sizeof(Rm_PolicyCheckCfg));
+    if (validateCallback.serviceCallback == NULL) {
+        serviceResponse->serviceState = RM_SERVICE_ERROR_CALLBACK_NOT_PROVIDED;
+        return;
+    }
 
-        if (reqCfg->request->type == Rm_service_RESOURCE_ALLOCATE_INIT) {
-            privCheckCfg.type = Rm_policyCheck_INIT;
+    /* Validate static requests against the global policyDtb */
+    while(rmInst->staticInfo.staticReqList) {
+        transaction = rmTransactionQueueAdd(rmInst);
+        if (transaction) {
+            staticRequest = rmInst->staticInfo.staticReqList->staticReq;
+            transaction->type = staticRequest->serviceType;
+            strncpy(transaction->serviceSrcInstName, rmInst->instName, RM_NAME_MAX_CHARS);
+            transaction->callback.serviceCallback = validateCallback.serviceCallback;
+            transaction->state = RM_SERVICE_PROCESSING;
+            if (staticRequest->resourceName) {
+                strncpy(transaction->resourceInfo.name, staticRequest->resourceName, RM_NAME_MAX_CHARS);
+            }
+            transaction->resourceInfo.base = staticRequest->resourceBase;
+            transaction->resourceInfo.length = staticRequest->resourceLength;
+            transaction->resourceInfo.alignment = staticRequest->resourceAlignment;
+            if (staticRequest->resourceNsName) {
+                strncpy(transaction->resourceInfo.nameServerName, staticRequest->resourceNsName, RM_NAME_MAX_CHARS);
+            }
+        
+            rmTransactionProcessor (rmInst, transaction);
+            memset((void *)&serviceResponse, 0, sizeof(Rm_ServiceRespInfo));
+            serviceResponse->serviceState = transaction->state;
+            if (serviceResponse->serviceState == RM_SERVICE_PROCESSING) {
+                /* Service still being processed.  Provide transaction ID
+                 * back to component so it can sort service responses received
+                 * via callback function */
+                serviceResponse->serviceId = transaction->localId;
+            }
+            else if (serviceResponse->serviceState == RM_SERVICE_APPROVED_AND_COMPLETED) {
+                if ((transaction->type == Rm_service_RESOURCE_ALLOCATE_INIT) ||
+                    (transaction->type == Rm_service_RESOURCE_ALLOCATE_USE) ||
+                    (transaction->type == Rm_service_RESOURCE_GET_BY_NAME)) {
+                    strncpy(serviceResponse->resourceName, transaction->resourceInfo.name, RM_NAME_MAX_CHARS);
+                    serviceResponse->resourceBase = transaction->resourceInfo.base;
+                    serviceResponse->resourceLength = transaction->resourceInfo.length;
+                }
+                rmTransactionQueueDelete(rmInst, transaction->localId);
+            }
+            else {
+                rmTransactionQueueDelete(rmInst, transaction->localId);
+            }
+            /* Issue response via callback since function won't return until all static requests have
+             * been handled */
+            validateCallback->serviceCallback(&serviceResponse);
         }
         else {
-            privCheckCfg.type = Rm_policyCheck_USE;
-        }
-        privCheckCfg.policyDtb = preMainInst->startupDtb;
-        privCheckCfg.validInstNode = rmPolicyGetValidInstNode(preMainInst->validInstTree, 
-                                                              preMainInst->instName);
-        privCheckCfg.resourceOffset = rmPolicyGetResourceOffset(preMainInst->startupDtb,
-                                                                reqCfg->request->resourceName);
-        privCheckCfg.resourceBase = reqCfg->request->resourceBase;
-        privCheckCfg.resourceLength = reqCfg->request->resourceLength;
-
-        if (rmPolicyCheckPrivilege(&privCheckCfg, &preMainResp->serviceState)) {
-            preMainResp->serviceState = RM_SERVICE_APPROVED_AND_COMPLETED;
-        }
-        else if (preMainResp->serviceState == RM_SERVICE_PROCESSING) {
-            /* Privilege check returned FALSE without error */
-            preMainResp->serviceState = RM_SERVICE_DENIED_POLICY_DENIED_PREMAIN_ALLOCATION;
-        }
-    }
-    else {
-        preMainResp->serviceState = RM_SERVICE_DENIED_INVALID_PREMAIN_REQUEST;
-    }
-
-    /* Store the request for validation after post-main instance
-     * transports have been established */
-    if (preMainResp->serviceState == RM_SERVICE_APPROVED_AND_COMPLETED) {
-        /* Store the request for validation after all instances have been setup post-main */
-        lastServiceReq = preMainInst->preMainReqList;
-        while(lastServiceReq) {
-            lastServiceReq = lastServiceReq->nextPreMainReq;
+            serviceResponse->serviceState = RM_SERVICE_ERROR_TRANSACTION_FAILED_TO_ALLOCATE;
+            return;
         }
-        lastServiceReq = (Rm_ServicePreMainReq *) Rm_osalMalloc (sizeof(Rm_ServicePreMainReq));
-        lastServiceReq->nextPreMainReq = NULL;
-        lastServiceReq->preMainReq = (Rm_ServiceReqInfo *) Rm_osalMalloc(sizeof(Rm_ServiceReqInfo));
-        memcpy((void *)lastServiceReq->preMainReq, (void *)reqCfg->request, sizeof(Rm_ServiceReqInfo));
-
-        /* Fill out response */
-        preMainResp->resourceBase = reqCfg->request->resourceBase;
-        preMainResp->resourceLength = reqCfg->request->resourceLength;
-        strncpy(preMainResp->resourceName, reqCfg->request->resourceName, RM_NAME_MAX_CHARS);
-        preMainResp->serviceId = ++preMainInst->requestCount;
+        /* Free memory associated with static requests sent for validation */
+        nextServiceReq = rmInst->staticInfo.staticReqList->nextStaticReq;
+        Rm_osalFree((void *)rmInst->staticInfo.staticReqList->staticReq, sizeof(Rm_ServiceReqInfo));
+        Rm_osalFree((void *)rmInst->staticInfo.staticReqList, sizeof(Rm_ServiceStaticReq));
+        rmInst->staticInfo.staticReqList = nextServiceReq;
     }
 }