chore(lib/common): rename DEV_RANGE_xx enumerators

Rename enum 'dev_type' to 'dev_coh_type' and its DEV_RANGE_xx
enumerators to DEV_MEM_xx to match RmmDevMemCoherent type
in RMM Specification 1.1-alp12.

Signed-off-by: AlexeiFedorov <Alexei.Fedorov@arm.com>
Change-Id: I3b477780e1185e7692dfc1872bf923b575f23580
diff --git a/lib/common/include/dev_type.h b/lib/common/include/dev_type.h
index 7f97417..b12835a 100644
--- a/lib/common/include/dev_type.h
+++ b/lib/common/include/dev_type.h
@@ -6,11 +6,11 @@
 #ifndef DEV_TYPE_H
 #define DEV_TYPE_H
 
-/* Types of device memory */
-enum dev_type {
-	DEV_RANGE_COHERENT,
-	DEV_RANGE_NON_COHERENT,
-	DEV_RANGE_MAX
+/* RmmDevMemCoherent type */
+enum dev_coh_type {
+	DEV_MEM_COHERENT,
+	DEV_MEM_NON_COHERENT,
+	DEV_MEM_MAX
 };
 
 #endif /* DEV_TYPE_H */
diff --git a/lib/common/include/platform_api.h b/lib/common/include/platform_api.h
index 34e53b3..1ba1fed 100644
--- a/lib/common/include/platform_api.h
+++ b/lib/common/include/platform_api.h
@@ -27,7 +27,7 @@
  * This function also validates that the dev_granule address is a valid
  * page address and returns device granule type if the addr is valid.
  */
-unsigned long plat_dev_granule_addr_to_idx(unsigned long addr, enum dev_type *type);
+unsigned long plat_dev_granule_addr_to_idx(unsigned long addr, enum dev_coh_type *type);
 
 /*
  * Takes an index in the struct granules array and returns the aligned granule
@@ -41,6 +41,6 @@
  * dev_granule address of the specified device type. The index must be within
  * the number of dev_granules expected by the platform.
  */
-unsigned long plat_dev_granule_idx_to_addr(unsigned long idx, enum dev_type type);
+unsigned long plat_dev_granule_idx_to_addr(unsigned long idx, enum dev_coh_type type);
 
 #endif /* PLATFORM_API_H */
diff --git a/lib/granule/include/dev_granule.h b/lib/granule/include/dev_granule.h
index 0525188..de8d8cf 100644
--- a/lib/granule/include/dev_granule.h
+++ b/lib/granule/include/dev_granule.h
@@ -177,7 +177,7 @@
  * This is purely a lookup, and provides no guarantees about the attributes of
  * the dev_granule (i.e. whether it is locked, its state or its reference count).
  */
-unsigned long dev_granule_addr(const struct dev_granule *g, enum dev_type type);
+unsigned long dev_granule_addr(const struct dev_granule *g, enum dev_coh_type type);
 
 /*
  * Takes an aligned dev_granule address, returns a pointer to the corresponding
@@ -186,7 +186,7 @@
  * This is purely a lookup, and provides no guarantees about the attributes of
  * the granule (i.e. whether it is locked, its state or its reference count).
  */
-struct dev_granule *addr_to_dev_granule(unsigned long addr, enum dev_type *type);
+struct dev_granule *addr_to_dev_granule(unsigned long addr, enum dev_coh_type *type);
 
 /*
  * Verifies whether @addr is a valid dev_granule physical address, returns
@@ -202,7 +202,7 @@
  *     - @addr is not aligned to the size of a granule.
  *     - @addr is out of range.
  */
-struct dev_granule *find_dev_granule(unsigned long addr, enum dev_type *type);
+struct dev_granule *find_dev_granule(unsigned long addr, enum dev_coh_type *type);
 
 /*
  * Obtain a pointer to a locked dev_granule at @addr if @addr is a valid dev_granule
@@ -219,7 +219,7 @@
  */
 struct dev_granule *find_lock_dev_granule(unsigned long addr,
 					  unsigned char expected_state,
-					  enum dev_type *type);
+					  enum dev_coh_type *type);
 /*
  * Refcount field occupies LSB bits of the dev_granule descriptor,
  * and functions which modify its value can operate directly on
diff --git a/lib/granule/src/dev_granule.c b/lib/granule/src/dev_granule.c
index 4ad7e1a..efec5c2 100644
--- a/lib/granule/src/dev_granule.c
+++ b/lib/granule/src/dev_granule.c
@@ -21,7 +21,7 @@
  * This is purely a lookup, and provides no guarantees about the attributes of
  * the dev_granule (i.e. whether it is locked, its state or its reference count).
  */
-unsigned long dev_granule_addr(const struct dev_granule *g, enum dev_type type)
+unsigned long dev_granule_addr(const struct dev_granule *g, enum dev_coh_type type)
 {
 	(void)type;
 	unsigned long idx;
@@ -29,7 +29,7 @@
 	assert(g != NULL);
 
 	/* No coherent device granules */
-	assert(type == DEV_RANGE_NON_COHERENT);
+	assert(type == DEV_MEM_NON_COHERENT);
 
 	idx = ((unsigned long)g - (unsigned long)dev_ncoh_granules) /
 						sizeof(struct dev_granule);
@@ -43,12 +43,12 @@
  * This is purely a lookup, and provides no guarantees about the attributes of
  * the granule (i.e. whether it is locked, its state or its reference count).
  */
-static struct dev_granule *dev_granule_from_idx(unsigned long idx, enum dev_type type)
+static struct dev_granule *dev_granule_from_idx(unsigned long idx, enum dev_coh_type type)
 {
 	(void)type;
 
 	/* No coherent device granules */
-	assert((type == DEV_RANGE_NON_COHERENT) && (idx < RMM_MAX_NCOH_GRANULES));
+	assert((type == DEV_MEM_NON_COHERENT) && (idx < RMM_MAX_NCOH_GRANULES));
 
 	return &dev_ncoh_granules[idx];
 }
@@ -60,7 +60,7 @@
  * This is purely a lookup, and provides no guarantees about the attributes of
  * the granule (i.e. whether it is locked, its state or its reference count).
  */
-struct dev_granule *addr_to_dev_granule(unsigned long addr, enum dev_type *type)
+struct dev_granule *addr_to_dev_granule(unsigned long addr, enum dev_coh_type *type)
 {
 	unsigned long idx;
 
@@ -84,7 +84,7 @@
  *     - @addr is not aligned to the size of a granule.
  *     - @addr is out of range.
  */
-struct dev_granule *find_dev_granule(unsigned long addr, enum dev_type *type)
+struct dev_granule *find_dev_granule(unsigned long addr, enum dev_coh_type *type)
 {
 	unsigned long idx;
 
@@ -115,7 +115,7 @@
  */
 struct dev_granule *find_lock_dev_granule(unsigned long addr,
 					  unsigned char expected_state,
-					  enum dev_type *type)
+					  enum dev_coh_type *type)
 {
 	struct dev_granule *g = find_dev_granule(addr, type);
 
diff --git a/lib/rmm_el3_ifc/include/rmm_el3_ifc.h b/lib/rmm_el3_ifc/include/rmm_el3_ifc.h
index eca8794..f23202d 100644
--- a/lib/rmm_el3_ifc/include/rmm_el3_ifc.h
+++ b/lib/rmm_el3_ifc/include/rmm_el3_ifc.h
@@ -384,7 +384,7 @@
  */
 int rmm_el3_ifc_get_dev_range_validated_pa(unsigned long max_num_banks,
 					   struct memory_info **plat_dev_range_info,
-					   enum dev_type type);
+					   enum dev_coh_type type);
 
 /****************************************************************************
  * RMM-EL3 Runtime interface APIs
diff --git a/lib/rmm_el3_ifc/src/rmm_el3_ifc_manifest.c b/lib/rmm_el3_ifc/src/rmm_el3_ifc_manifest.c
index 651892e..ae9e047 100644
--- a/lib/rmm_el3_ifc/src/rmm_el3_ifc_manifest.c
+++ b/lib/rmm_el3_ifc/src/rmm_el3_ifc_manifest.c
@@ -242,7 +242,7 @@
  */
 int rmm_el3_ifc_get_dev_range_validated_pa(unsigned long max_num_banks,
 					   struct memory_info **plat_dev_range_info,
-					   enum dev_type type)
+					   enum dev_coh_type type)
 {
 	struct memory_info *plat_memory;
 	unsigned int max_granules;
@@ -256,12 +256,12 @@
 		return E_RMM_BOOT_MANIFEST_VERSION_NOT_SUPPORTED;
 	}
 
-	assert(type < DEV_RANGE_MAX);
+	assert(type < DEV_MEM_MAX);
 
 	VERBOSE("Device %scoherent address range:\n",
-		(type == DEV_RANGE_COHERENT) ? "" : "non-");
+		(type == DEV_MEM_COHERENT) ? "" : "non-");
 
-	if (type == DEV_RANGE_COHERENT) {
+	if (type == DEV_MEM_COHERENT) {
 		plat_memory = &local_core_manifest.plat_coh_region;
 		max_granules = RMM_MAX_COH_GRANULES;
 	} else {
diff --git a/plat/arm/src/arm_granule.c b/plat/arm/src/arm_granule.c
index f6745b2..69cf0c7 100644
--- a/plat/arm/src/arm_granule.c
+++ b/plat/arm/src/arm_granule.c
@@ -74,7 +74,7 @@
 	return granule_addr_to_idx(addr, &arm_dram);
 }
 
-unsigned long plat_dev_granule_addr_to_idx(unsigned long addr, enum dev_type *type)
+unsigned long plat_dev_granule_addr_to_idx(unsigned long addr, enum dev_coh_type *type)
 {
 	unsigned long ret;
 
@@ -84,7 +84,7 @@
 	if (arm_dev_ncoh.num_granules != 0UL) {
 		ret = granule_addr_to_idx(addr, &arm_dev_ncoh);
 		if (ret != UINT64_MAX) {
-			*type = DEV_RANGE_NON_COHERENT;
+			*type = DEV_MEM_NON_COHERENT;
 			return ret;
 		}
 	}
@@ -93,12 +93,12 @@
 	if (arm_dev_coh.num_granules != 0UL) {
 		ret = granule_addr_to_idx(addr, &arm_dev_coh);
 		if (ret != UINT64_MAX) {
-			*type = DEV_RANGE_COHERENT;
+			*type = DEV_MEM_COHERENT;
 			return ret;
 		}
 	}
 
-	*type = DEV_RANGE_MAX;
+	*type = DEV_MEM_MAX;
 	return UINT64_MAX;
 }
 
@@ -150,12 +150,12 @@
 	return granule_idx_to_addr(idx, &arm_dram);
 }
 
-unsigned long plat_dev_granule_idx_to_addr(unsigned long idx, enum dev_type type)
+unsigned long plat_dev_granule_idx_to_addr(unsigned long idx, enum dev_coh_type type)
 {
 	(void)type;
 
 	/* No coherent device memory */
-	assert(type == DEV_RANGE_NON_COHERENT);
+	assert(type == DEV_MEM_NON_COHERENT);
 
 	return granule_idx_to_addr(idx, &arm_dev_ncoh);
 }
diff --git a/plat/arm/src/arm_memory.c b/plat/arm/src/arm_memory.c
index f48cfbc..5dabf64 100644
--- a/plat/arm/src/arm_memory.c
+++ b/plat/arm/src/arm_memory.c
@@ -50,19 +50,19 @@
 	arm_set_memory_layout(plat_dram, arm_get_dram_layout());
 }
 
-void arm_set_dev_layout(struct memory_info *plat_dev, enum dev_type type)
+void arm_set_dev_layout(struct memory_info *plat_dev, enum dev_coh_type type)
 {
 	struct arm_memory_layout *memory_ptr;
 
 	assert(plat_dev != NULL);
-	assert(type < DEV_RANGE_MAX);
+	assert(type < DEV_MEM_MAX);
 
 	switch (type) {
-	case DEV_RANGE_COHERENT:
+	case DEV_MEM_COHERENT:
 		memory_ptr = arm_get_dev_coh_layout();
 		break;
 	default:
-		/* DEV_RANGE_NON_COHERENT */
+		/* DEV_MEM_NON_COHERENT */
 		memory_ptr = arm_get_dev_ncoh_layout();
 	}
 
diff --git a/plat/arm/src/arm_setup.c b/plat/arm/src/arm_setup.c
index 5478dde..3248257 100644
--- a/plat/arm/src/arm_setup.c
+++ b/plat/arm/src/arm_setup.c
@@ -55,7 +55,7 @@
 	struct memory_info *plat_memory_info;
 	struct console_list *csl_list;
 	struct console_info *console_ptr;
-	const enum dev_type type[] = {DEV_RANGE_COHERENT, DEV_RANGE_NON_COHERENT};
+	const enum dev_coh_type type[] = {DEV_MEM_COHERENT, DEV_MEM_NON_COHERENT};
 
 	/* TBD Initialize UART for early log */
 	struct xlat_mmap_region plat_regions[] = {
diff --git a/plat/arm/src/include/arm_memory.h b/plat/arm/src/include/arm_memory.h
index 6f34f7e..1cd2ef1 100644
--- a/plat/arm/src/include/arm_memory.h
+++ b/plat/arm/src/include/arm_memory.h
@@ -26,7 +26,7 @@
 };
 
 void arm_set_dram_layout(struct memory_info *plat_dram);
-void arm_set_dev_layout(struct memory_info *plat_dev, enum dev_type type);
+void arm_set_dev_layout(struct memory_info *plat_dev, enum dev_coh_type type);
 struct arm_memory_layout *arm_get_dram_layout(void);
 struct arm_memory_layout *arm_get_dev_ncoh_layout(void);
 struct arm_memory_layout *arm_get_dev_coh_layout(void);
diff --git a/plat/host/common/src/host_platform_api_cmn.c b/plat/host/common/src/host_platform_api_cmn.c
index e2d8d0e..b37a1bf 100644
--- a/plat/host/common/src/host_platform_api_cmn.c
+++ b/plat/host/common/src/host_platform_api_cmn.c
@@ -84,7 +84,7 @@
 	return host_util_get_granule_base() + (idx * GRANULE_SIZE);
 }
 
-unsigned long plat_dev_granule_addr_to_idx(unsigned long addr, enum dev_type *type)
+unsigned long plat_dev_granule_addr_to_idx(unsigned long addr, enum dev_coh_type *type)
 {
 	if (!(GRANULE_ALIGNED(addr) &&
 		(addr < (host_util_get_dev_granule_base() + HOST_NCOH_DEV_SIZE)) &&
@@ -92,16 +92,16 @@
 		return UINT64_MAX;
 	}
 
-	*type = DEV_RANGE_NON_COHERENT;
+	*type = DEV_MEM_NON_COHERENT;
 	return (addr - host_util_get_dev_granule_base()) / GRANULE_SIZE;
 }
 
-unsigned long plat_dev_granule_idx_to_addr(unsigned long idx, enum dev_type type)
+unsigned long plat_dev_granule_idx_to_addr(unsigned long idx, enum dev_coh_type type)
 {
 	(void)type;
 
 	/* No coherent device memory */
-	assert(type == DEV_RANGE_NON_COHERENT);
+	assert(type == DEV_MEM_NON_COHERENT);
 	assert(idx < HOST_NR_NCOH_GRANULES);
 	return host_util_get_dev_granule_base() + (idx * GRANULE_SIZE);
 }
diff --git a/runtime/rmi/granule.c b/runtime/rmi/granule.c
index 39e8965..5e33020 100644
--- a/runtime/rmi/granule.c
+++ b/runtime/rmi/granule.c
@@ -15,7 +15,7 @@
 #ifdef RMM_V1_1
 static unsigned long dev_granule_delegate(unsigned long addr)
 {
-	enum dev_type type;
+	enum dev_coh_type type;
 
 	/* Try to find device granule */
 	struct dev_granule *g = find_dev_granule(addr, &type);
@@ -44,7 +44,7 @@
 
 static unsigned long dev_granule_undelegate(unsigned long addr)
 {
-	enum dev_type type;
+	enum dev_coh_type type;
 
 	/* Try to find device granule */
 	struct dev_granule *g = find_dev_granule(addr, &type);