return tmu->get_policy(res_name, policy);
}
+int pass_set_pmqos_data(struct pass_resource *res, void *data)
+{
+ struct pass_resource_nonstandard *nonstandard = NULL;
+ char *res_name;
+ int id;
+
+ if (!res)
+ return -EINVAL;
+
+ res_name = res->cdata.res_name;
+ id = res->cdata.res_type;
+
+ switch (id) {
+ case PASS_RESOURCE_NONSTANDARD_ID:
+ nonstandard = (res->hal.nonstandard);
+ break;
+ default:
+ return -EINVAL;
+ }
+
+ if (!nonstandard->set_pmqos_data || !res_name || !data)
+ return -EINVAL;
+
+ return nonstandard->set_pmqos_data(res_name, data);
+}
+
int pass_get_resource(struct pass *pass)
{
struct pass_resource_info *info;
struct pass_conf_data *cdata = &pass_res->cdata;
int res_type = cdata->res_type;
char *res_name = cdata->res_name;
- char name[10];
+ char name[BUFF_MAX];
switch (res_type) {
case PASS_RESOURCE_CPU_ID:
len = strlen(PASS_RESOURCE_GPU_NAME);
strncpy(name, PASS_RESOURCE_GPU_NAME, len);
break;
+ case PASS_RESOURCE_NONSTANDARD_ID:
+ len = strlen(PASS_RESOURCE_NONSTANDARD_NAME);
+ strncpy(name, PASS_RESOURCE_NONSTANDARD_NAME, len);
+ break;
default:
_E("Unsupported resource type (type: %d)\n", res_type);
return -EINVAL;
ret = info->open(res_name, info,
(struct pass_resource_common**)&pass_res->hal.gpu);
break;
+ case PASS_RESOURCE_NONSTANDARD_ID:
+ ret = info->open(res_name, info,
+ (struct pass_resource_common**)&pass_res->hal.nonstandard);
+ break;
};
if (ret < 0) {
info = pass_res->hal.gpu->common.info;
ret = info->close(res_name, common);
break;
+ case PASS_RESOURCE_NONSTANDARD_ID:
+ common = (struct pass_resource_common*)pass_res->hal.nonstandard;
+ info = pass_res->hal.nonstandard->common.info;
+ ret = info->close(res_name, common);
default:
return -EINVAL;
};
int pass_get_cpu_stats(struct pass_policy *policy);
int64_t pass_get_time_ms(void);
+/***
+ * Functions for Nonstandard H/W resources
+ */
+/*
+ * NOTE: It is not propper method. But PASS must need to keep
+ * the backwards compatibility, set the PMQoS's data from
+ * platform to hal. So, It is not recommended to use it.
+ *
+ * This function will be removed after finding the proper method.
+ */
+int pass_set_pmqos_data(struct pass_resource *res, void *data);
+
#endif /* __PASS_HAL__ */
conf_data->res_type = PASS_RESOURCE_GPU_ID;
else if (!strncmp(buf, PASS_RESOURCE_BUS_NAME, strlen(buf)))
conf_data->res_type = PASS_RESOURCE_BUS_ID;
+ else if (!strncmp(buf, PASS_RESOURCE_NONSTANDARD_NAME, strlen(buf)))
+ conf_data->res_type = PASS_RESOURCE_NONSTANDARD_ID;
else
return -EINVAL;
} else if (MATCH(result->name, "pass_res_name")) {
* Mandatory:
* @res_type: the unique id for each h/w resource. The id can have
* the one value among following defined resource id.
- * - 1: PASS_RESOURCE_CPU_ID
- * - 2: PASS_RESOURCE_BUS_ID
- * - 3: PASS_RESOURCE_GPU_ID
+ * - 1: PASS_RESOURCE_CPU_ID
+ * - 2: PASS_RESOURCE_BUS_ID
+ * - 3: PASS_RESOURCE_GPU_ID
+ * - 99: PASS_RESOURCE_NONSTANDARD_ID
* @res_name: the unique name of sysfs entry.
* - In case of /sys/devices/system/cpu/cpu0, res_name is 'cpu0'
* - In case of /sys/devices/system/cpu/cpu4, res_name is 'cpu4'
*
* @cdata: the parsed data from configuration file (pass.conf).
* @hal: the hal instance of each h/w resource from pass_get_hal_info().
- * - If res_type of cdata is PASS_RESOURCE_CPU_ID, hal.cpu will be used.
- * - If res_type of cdata is PASS_RESOURCE_BUS_ID, hal.bus will be used.
- * - If res_type of cdata is PASS_RESOURCE_GPU_ID, hal.gpu will be used.
+ * - If res_type of cdata is PASS_RESOURCE_CPU_ID, hal.cpu will be used.
+ * - If res_type of cdata is PASS_RESOURCE_BUS_ID, hal.bus will be used.
+ * - If res_type of cdata is PASS_RESOURCE_GPU_ID, hal.gpu will be used.
+ * - If res_type of cdata is PASS_RESOURCE_NONSTANDARD_ID,
+ * hal.nonstandard will be used.
* @policy: the policy data to handle the h/w resource
*/
struct pass_resource {
struct pass_resource_cpu *cpu;
struct pass_resource_bus *bus;
struct pass_resource_gpu *gpu;
+ struct pass_resource_nonstandard *nonstandard;
} hal;
};