index 7405b782458914d56b3f2cfeeede2495ff097b91..7a04c37be0e5bfe812429f463e617723fd72ee79 100644 (file)
--- a/include/rm_dtb_utilloc.h
+++ b/include/rm_dtb_utilloc.h
* Private Resource List and Policy DTB Parsing Utilities
*
* ============================================================================
- * (C) Copyright 2012, Texas Instruments, Inc.
+ * (C) Copyright 2012-2013, Texas Instruments, Inc.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
extern "C" {
#endif
-/**********************************************************************
- *************Common RM DTB Parsing Defines and Functions**************
- **********************************************************************/
+/* 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
-*/
+/* DTB starting node offset for parsing */
#define RM_DTB_UTIL_STARTING_NODE_OFFSET 0
-/**
-* @brief DTB starting depth for parsing
-*/
+/* DTB starting depth for parsing */
#define RM_DTB_UTIL_STARTING_DEPTH 0
+/* Linux DTB alias offset not set */
+#define RM_DTB_UTIL_LINUX_ALIAS_OFFSET_NOT_SET 0xFFFF
+
+/**********************************************************************
+ ******************* Common DTB Parsing Definitions *******************
+ **********************************************************************/
-typedef struct {
- uint32_t base;
- uint32_t length;
- void *nextRange;
+/* Resource range linked list node */
+typedef struct Rm_ResourceRange_s {
+ /* Resource base */
+ uint32_t base;
+ /* Resource length */
+ uint32_t length;
+ /* Link to next resource range linked list node */
+ struct Rm_ResourceRange_s *nextRange;
} Rm_ResourceRange;
+/* Resource value linked list node */
+typedef struct Rm_ResourceValue_s {
+ /* Numerical resource value */
+ uint32_t value;
+ /* Link to next resource value linked list node */
+ struct Rm_ResourceValue_s *nextValue;
+} Rm_ResourceValue;
+
/**********************************************************************
- ***********Resource List DTB Parsing Defines and Functions************
+ ************* Global Resource List Parsing Definitions ***************
**********************************************************************/
-/**
-* @brief Linux DTB alias offset not set
-*/
-#define RM_DTB_LINUX_ALIAS_OFFSET_NOT_SET 0xFFFF
-
+/* GRL resource node property types */
typedef enum {
/** Resource DTB unknown property type */
- Rm_resourcePropType_UNKNOWN = 0,
- /** Resource DTB device name property type */
- Rm_resourcePropType_DEVICE_NAME = 1,
+ Rm_resourcePropType_UNKNOWN = 0,
/** Resource DTB resource range property type */
- Rm_resourcePropType_RESOURCE_RANGE = 2,
- /** Resource DTB resource allocator property type */
- Rm_resourcePropType_RESOURCE_ALLOCATOR = 3,
+ Rm_resourcePropType_RESOURCE_RANGE,
/** Resource DTB resource alias path in Linux DTB */
- Rm_resourcePropType_RESOURCE_LINUX_ALIAS = 4,
+ Rm_resourcePropType_RESOURCE_LINUX_ALIAS,
/** Resource DTB NameServer assignment property type */
- Rm_resourcePropType_NSASSIGNMENT = 5,
+ Rm_resourcePropType_NSASSIGNMENT
} Rm_ResourcePropType;
-typedef struct {
- const char *pathList;
- uint32_t pathListLenBytes;
- uint32_t baseOffset;
- uint32_t lengthOffset;
- void *nextLinuxAlias;
+/* Linux alias path linked list node */
+typedef struct Rm_LinuxAlias_s {
+ /* Pointer to the alias path string */
+ char *path;
+ /* Base value offset into Linux value range located at the end
+ * of the path in the Linux DTB */
+ uint32_t baseOffset;
+ /* Length value offset into the Linux value range located at
+ * the end of the path in the Linux DTB. Will be set to
+ * RM_DTB_UTIL_LINUX_ALIAS_OFFSET_NOT_SET if there is only
+ * a base value to read from the Linux DTB */
+ uint32_t lengthOffset;
+ /* Link to next Linux alias linked list node */
+ struct Rm_LinuxAlias_s *nextLinuxAlias;
} Rm_LinuxAlias;
-typedef struct {
- char *nsName;
- uint32_t resourceValue;
- void *nextNsAssignment;
+/* NameServer assignment linked list node */
+typedef struct Rm_NsAssignment_s {
+ /* NameServer name to be created */
+ char nsName[RM_NAME_MAX_CHARS];
+ /* Resource base value to tie to the name */
+ uint32_t resourceBase;
+ /* Resource length value to tie to the name */
+ uint32_t resourceLength;
+ /* Link to next NameServer assignment linked list node */
+ struct Rm_NsAssignment_s *nextNsAssignment;
} Rm_NsAssignment;
-Rm_ResourcePropType Rm_resourceGetPropertyType(const char *propertyName);
-char *Rm_resourceExtractDeviceName(const void *dtbDataPtr, int32_t dtbDataLen);
-void Rm_resourceFreeDeviceName(char *deviceName);
-Rm_ResourceRange *Rm_resourceExtractRange(const void *dtbDataPtr, int32_t dtbDataLen);
-void Rm_resourceFreeRange(Rm_ResourceRange *rangeList);
-char *Rm_resourceExtractAllocator(const void *dtbDataPtr, int32_t dtbDataLen);
-void Rm_resourceFreeAllocator(char *resourceAllocatorType);
-Rm_LinuxAlias *Rm_resourceExtractLinuxAlias(const void *dtbDataPtr, int32_t dtbDataLen);
-void Rm_resourceFreeLinuxAlias(Rm_LinuxAlias *aliasList);
-Rm_NsAssignment *Rm_resourceExtractNsAssignment(const void *dtbDataPtr, int32_t dtbDataLen);
-void Rm_resourceFreeNsAssignmentList(Rm_NsAssignment *nsAssignmentList);
-
/**********************************************************************
- ***************Policy DTB Parsing Defines and Functions***************
+ ********************* Policy Parsing Definitions *********************
**********************************************************************/
+/* Policy resource node property types */
typedef enum {
/** Policy DTB unknown property type */
- Rm_policyPropType_UNKNOWN = 0,
- /** Policy DTB policy type property type */
- Rm_policyPropType_POLICY_TYPE = 1,
- /** Policy DTB resource assigned ranges property type */
- Rm_policyPropType_RESOURCE_ASSIGNED_RANGES = 2,
- /** Policy DTB resource allocation sizes property type */
- Rm_policyPropType_RESOURCE_ALLOCATION_SIZES = 3,
- /** Policy DTB assigned NameServer names property type */
- Rm_policyPropType_ASSIGNED_NS_NAMES = 4,
+ Rm_policyPropType_UNKNOWN = 0,
+ /** Policy DTB resource assignments property type */
+ Rm_policyPropType_ASSIGNMENTS,
+ /** Policy DTB Client Delegate resource allocation size property type */
+ Rm_policyPropType_CD_ALLOCATION_SIZE,
+ /** Policy DTB allocation alignment property type */
+ Rm_policyPropType_ALLOCATION_ALIGNMENT,
+ /** Policy DTB valid RM instances property type */
+ Rm_policyPropType_VALID_INSTANCES
} Rm_PolicyPropType;
-typedef struct {
- uint32_t allocationSize;
- void *nextAllocationSize;
-} Rm_AllocationSize;
-
-typedef struct {
- char *assignedName;
- void *nextAssignedName;
-} Rm_AssignedNsNames;
-
-Rm_PolicyPropType Rm_policyGetPropertyType(const char *propertyName);
-char *Rm_policyExtractPolicyType(const void *dtbDataPtr, int32_t dtbDataLen);
-void Rm_policyFreePolicyType(char *policyType);
-Rm_ResourceRange *Rm_policyExtractAssignedRanges(const void *dtbDataPtr, int32_t dtbDataLen);
-void Rm_policyFreeAssignedRanges(Rm_ResourceRange *rangeList);
-Rm_AllocationSize *Rm_policyExtractAllocationSizes(const void *dtbDataPtr, int32_t dtbDataLen);
-void Rm_policyFreeAllocationSizesPropList(Rm_AllocationSize *allocationSizeList);
-Rm_AssignedNsNames *Rm_policyExtractAssignedNsNames(const void *dtbDataPtr, int32_t dtbDataLen);
-void Rm_policyFreeAssignmentNsNamesList(Rm_AssignedNsNames *assignedNsNamesList);
+/* Policy assignment linked list node */
+typedef struct Rm_PolicyAssignment_s {
+ /* Resource base affected by the permissions */
+ uint32_t resourceBase;
+ /* Resource length (started from base) affected by the permissions */
+ uint32_t resourceLength;
+ /* Permissions string defining which RM instances get
+ * which permissions for the defined resource range starting
+ * at resourceBase and ending at
+ * resourceBase+resourceLength-1 */
+ char *permissionsList;
+ /* Link to next policy assignment linked list node */
+ struct Rm_PolicyAssignment_s *nextAssignment;
+} Rm_PolicyAssignment;
+
+/* Valid instance linked list node */
+typedef struct Rm_PolicyValidInst_s {
+ /* RM instance name */
+ char instName[RM_NAME_MAX_CHARS];
+ /* Link to next valid instance linked list node */
+ struct Rm_PolicyValidInst_s *nextValidInst;
+} Rm_PolicyValidInst;
/**********************************************************************
- ****************Linux DTB Parsing Defines and Functions***************
+ ******************** Linux DTB Parsing Definitions *******************
**********************************************************************/
-typedef struct {
- uint32_t value;
- void *nextValue;
+/* Linux value range linked list node */
+typedef struct Rm_LinuxValueRange_s {
+ /* Numerical value extracted from Linux DTB */
+ uint32_t value;
+ /* Link to next Linux value linked list node */
+ struct Rm_LinuxValueRange_s *nextValue;
} Rm_LinuxValueRange;
-Rm_LinuxValueRange *Rm_linuxExtractValues(const void *dtbDataPtr, int32_t dtbDataLen);
-void Rm_linuxFreeValues(Rm_LinuxValueRange *valueList);
+/**********************************************************************
+ *************** Global Resource List Parsing Functions ***************
+ **********************************************************************/
+
+Rm_ResourcePropType rmDtbUtilResGetPropertyType(const char *propertyName);
+Rm_ResourceRange *rmDtbUtilResExtractRange(const void *dtbDataPtr, int32_t dtbDataLen);
+void rmDtbUtilResFreeRange(Rm_ResourceRange *rangeList);
+Rm_LinuxAlias *rmDtbUtilResExtractLinuxAlias(const void *dtbDataPtr, int32_t dtbDataLen,
+ int32_t *result);
+void rmDtbUtilResFreeLinuxAlias(Rm_LinuxAlias *aliasList);
+Rm_NsAssignment *rmDtbUtilResExtractNsAssignment(const void *dtbDataPtr, int32_t dtbDataLen,
+ int32_t *result);
+void rmDtbUtilResFreeNsAssignmentList(Rm_NsAssignment *nsAssignmentList);
+
+/**********************************************************************
+ ********************** Policy Parsing Functions***********************
+ **********************************************************************/
+
+Rm_PolicyPropType rmDtbUtilPolicyGetPropertyType(const char *propertyName);
+Rm_PolicyAssignment *rmDtbUtilPolicyExtractAssignments(const void *dtbDataPtr, int32_t dtbDataLen);
+void rmDtbUtilPolicyFreeAssignments(Rm_PolicyAssignment *assignmentList);
+Rm_ResourceValue *rmDtbUtilPolicyExtractCdAllocationSizes(const void *dtbDataPtr, int32_t dtbDataLen);
+void rmDtbUtilPolicyFreeCdAllocationSizes(Rm_ResourceValue *allocationSizeList);
+Rm_ResourceValue *rmDtbUtilPolicyExtractResourceAlignments(const void *dtbDataPtr, int32_t dtbDataLen);
+void rmDtbUtilPolicyFreeResourceAlignments (Rm_ResourceValue *alignmentList);
+Rm_PolicyValidInst *rmDtbUtilPolicyExtractValidInstances(const void *dtbDataPtr, int32_t dtbDataLen,
+ int32_t *result);
+void rmDtbUtilPolicyFreeValidInstances (Rm_PolicyValidInst *validInstList);
+
+/**********************************************************************
+ ********************* Linux DTB Parsing Functions ********************
+ **********************************************************************/
+
+Rm_LinuxValueRange *rmDtbUtilLinuxExtractValues(const void *dtbDataPtr, int32_t dtbDataLen);
+void rmDtbUtilLinuxFreeValues(Rm_LinuxValueRange *valueList);
#ifdef __cplusplus
}