+/**
+ * Resource Reservation Check function
+ *
+ * [in] count
+ * Number of module subtypes
+ *
+ * [in] cfg
+ * Pointer to rm element config
+ *
+ * [in] reservations
+ * Pointer to resource reservation array
+ *
+ * Returns
+ * - (n) number of tables in module that have non-zero reservation count.
+ */
+static int
+tf_dev_reservation_check(uint16_t count,
+ struct tf_rm_element_cfg *cfg,
+ uint16_t *reservations)
+{
+ uint16_t cnt = 0;
+ uint16_t *rm_num;
+ int i, j;
+
+ for (i = 0; i < TF_DIR_MAX; i++) {
+ rm_num = (uint16_t *)reservations + i * count;
+ for (j = 0; j < count; j++) {
+ if ((cfg[j].cfg_type == TF_RM_ELEM_CFG_HCAPI ||
+ cfg[j].cfg_type == TF_RM_ELEM_CFG_HCAPI_BA ||
+ cfg[j].cfg_type ==
+ TF_RM_ELEM_CFG_HCAPI_BA_PARENT ||
+ cfg[j].cfg_type ==
+ TF_RM_ELEM_CFG_HCAPI_BA_CHILD) &&
+ rm_num[j] > 0)
+ cnt++;
+ }
+ }
+
+ return cnt;
+}
+