enum ipa_rsrc_group_id {
/* Source resource group identifiers */
IPA_RSRC_GROUP_SRC_UL_DL = 0,
+ IPA_RSRC_GROUP_SRC_COUNT, /* Last in set; not a source group */
/* Destination resource group identifiers */
IPA_RSRC_GROUP_DST_UL_DL_DPL = 0,
+ IPA_RSRC_GROUP_DST_COUNT, /* Last; not a destination group */
};
/* QSB configuration for the SC7180 SoC. */
/* Resource configuration for the SC7180 SoC. */
static const struct ipa_resource_data ipa_resource_data = {
+ .rsrc_group_src_count = IPA_RSRC_GROUP_SRC_COUNT,
+ .rsrc_group_dst_count = IPA_RSRC_GROUP_DST_COUNT,
.resource_src_count = ARRAY_SIZE(ipa_resource_src),
.resource_src = ipa_resource_src,
.resource_dst_count = ARRAY_SIZE(ipa_resource_dst),
IPA_RSRC_GROUP_SRC_UL_DL,
IPA_RSRC_GROUP_SRC_MHI_DMA,
IPA_RSRC_GROUP_SRC_UC_RX_Q,
+ IPA_RSRC_GROUP_SRC_COUNT, /* Last in set; not a source group */
/* Destination resource group identifiers */
IPA_RSRC_GROUP_DST_LWA_DL = 0,
IPA_RSRC_GROUP_DST_UL_DL_DPL,
IPA_RSRC_GROUP_DST_UNUSED_2,
+ IPA_RSRC_GROUP_DST_COUNT, /* Last; not a destination group */
};
/* QSB configuration for the SDM845 SoC. */
/* Resource configuration for the SDM845 SoC. */
static const struct ipa_resource_data ipa_resource_data = {
+ .rsrc_group_src_count = IPA_RSRC_GROUP_SRC_COUNT,
+ .rsrc_group_dst_count = IPA_RSRC_GROUP_DST_COUNT,
.resource_src_count = ARRAY_SIZE(ipa_resource_src),
.resource_src = ipa_resource_src,
.resource_dst_count = ARRAY_SIZE(ipa_resource_dst),
/**
* struct ipa_resource_data - IPA resource configuration data
+ * @rsrc_group_src_count: number of source resource groups supported
+ * @rsrc_group_dst_count: number of destination resource groups supported
* @resource_src_count: number of entries in the resource_src array
* @resource_src: source endpoint group resources
* @resource_dst_count: number of entries in the resource_dst array
* programming it at initialization time, so we specify it here.
*/
struct ipa_resource_data {
+ u32 rsrc_group_src_count;
+ u32 rsrc_group_dst_count;
u32 resource_src_count;
const struct ipa_resource *resource_src;
u32 resource_dst_count;
* total resources of each type is assigned for use by each group.
*/
-/* # IPA source resource groups available based on version */
-static u32 ipa_resource_group_src_count(enum ipa_version version)
-{
- switch (version) {
- case IPA_VERSION_3_5_1:
- case IPA_VERSION_4_0:
- case IPA_VERSION_4_1:
- return 4;
-
- case IPA_VERSION_4_2:
- return 1;
-
- case IPA_VERSION_4_5:
- return 5;
-
- default:
- return 0;
- }
-}
-
-/* # IPA destination resource groups available based on version */
-static u32 ipa_resource_group_dst_count(enum ipa_version version)
-{
- switch (version) {
- case IPA_VERSION_3_5_1:
- return 3;
-
- case IPA_VERSION_4_0:
- case IPA_VERSION_4_1:
- return 4;
-
- case IPA_VERSION_4_2:
- return 1;
-
- case IPA_VERSION_4_5:
- return 5;
-
- default:
- return 0;
- }
-}
-
static bool ipa_resource_limits_valid(struct ipa *ipa,
const struct ipa_resource_data *data)
{
/* We program at most 6 source or destination resource group limits */
BUILD_BUG_ON(IPA_RESOURCE_GROUP_MAX > 6);
- group_count = ipa_resource_group_src_count(ipa->version);
+ group_count = data->rsrc_group_src_count;
if (!group_count || group_count > IPA_RESOURCE_GROUP_MAX)
return false;
return false;
}
- group_count = ipa_resource_group_dst_count(ipa->version);
+ group_count = data->rsrc_group_src_count;
if (!group_count || group_count > IPA_RESOURCE_GROUP_MAX)
return false;
static void ipa_resource_config_src(struct ipa *ipa, u32 resource_type,
const struct ipa_resource_data *data)
{
- u32 group_count = ipa_resource_group_src_count(ipa->version);
+ u32 group_count = data->rsrc_group_src_count;
const struct ipa_resource_limits *ylimits;
const struct ipa_resource *resource;
u32 offset;
static void ipa_resource_config_dst(struct ipa *ipa, u32 resource_type,
const struct ipa_resource_data *data)
{
- u32 group_count = ipa_resource_group_dst_count(ipa->version);
+ u32 group_count = data->rsrc_group_dst_count;
const struct ipa_resource_limits *ylimits;
const struct ipa_resource *resource;
u32 offset;