Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 3ca4b944 authored by Linux Build Service Account's avatar Linux Build Service Account Committed by Gerrit - the friendly Code Review server
Browse files

Merge "soc: qcom: Add infrastructure to test service locator"

parents bcdd9b36 8096c972
Loading
Loading
Loading
Loading
+9 −0
Original line number Diff line number Diff line
@@ -575,4 +575,13 @@ config MSM_PERFORMANCE_HOTPLUG_ON
	  compile out the nodes needed for core-control functionality through
	  msm_performance.

config MSM_SERVICE_LOCATOR
	bool "Service Locator"
	depends on MSM_QMI_INTERFACE
	help
	  The Service Locator provides a library to retrieve location
	  information given a service identifier. Location here translates
	  to what process domain exports the service, and which subsystem
	  that process domain will execute in.

endif # ARCH_MSM
+1 −0
Original line number Diff line number Diff line
@@ -71,3 +71,4 @@ obj-$(CONFIG_MSM_SECURE_BUFFER) += secure_buffer.o
obj-$(CONFIG_TRACER_PKT) += tracer_pkt.o
obj-$(CONFIG_ICNSS) += icnss.o
obj-$(CONFIG_MSM_BAM_DMUX) += bam_dmux.o
obj-$(CONFIG_MSM_SERVICE_LOCATOR) += service-locator.o
+362 −0
Original line number Diff line number Diff line
/*
 * Copyright (c) 2015, The Linux Foundation. All rights reserved.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 and
 * only version 2 as published by the Free Software Foundation.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 */
#ifndef SERVICE_LOCATOR_V01_H
#define SERVICE_LOCATOR_V01_H

#include <linux/qmi_encdec.h>

#include <soc/qcom/msm_qmi_interface.h>
#include <soc/qcom/service-locator.h>

#define SERVREG_LOC_SERVICE_ID_V01 0x40
#define SERVREG_LOC_SERVICE_VERS_V01 0x01

#define QMI_SERVREG_LOC_INDICATION_REGISTER_RESP_V01 0x0020
#define QMI_SERVREG_LOC_REGISTER_SERVICE_LIST_REQ_V01 0x0022
#define QMI_SERVREG_LOC_GET_DOMAIN_LIST_REQ_V01 0x0021
#define QMI_SERVREG_LOC_GET_DOMAIN_LIST_RESP_V01 0x0021
#define QMI_SERVREG_LOC_DATABASE_UPDATED_IND_V01 0x0023
#define QMI_SERVREG_LOC_INDICATION_REGISTER_REQ_V01 0x0020
#define QMI_SERVREG_LOC_REGISTER_SERVICE_LIST_RESP_V01 0x0022

#define QMI_SERVREG_LOC_NAME_LENGTH_V01 64
#define QMI_SERVREG_LOC_LIST_LENGTH_V01 32

enum qmi_servreg_loc_service_instance_enum_type_v01 {
	QMI_SERVREG_LOC_SERVICE_INSTANCE_ENUM_TYPE_MIN_VAL_V01 = INT_MIN,
	QMI_SERVREG_LOC_SERVICE_INSTANCE_APSS_V01 = 0x1,
	QMI_SERVREG_LOC_SERVICE_INSTANCE_ENUM_TYPE_MAX_VAL_V01 = INT_MAX,
};

struct qmi_servreg_loc_indication_register_req_msg_v01 {
	uint8_t enable_database_updated_indication_valid;
	uint8_t enable_database_updated_indication;
};
#define QMI_SERVREG_LOC_INDICATION_REGISTER_REQ_MSG_V01_MAX_MSG_LEN 4
struct elem_info qmi_servreg_loc_indication_register_req_msg_v01_ei[];

struct qmi_servreg_loc_indication_register_resp_msg_v01 {
	struct qmi_response_type_v01 resp;
};
#define QMI_SERVREG_LOC_INDICATION_REGISTER_RESP_MSG_V01_MAX_MSG_LEN 7
struct elem_info qmi_servreg_loc_indication_register_resp_msg_v01_ei[];

struct qmi_servreg_loc_get_domain_list_req_msg_v01 {
	char service_name[QMI_SERVREG_LOC_NAME_LENGTH_V01 + 1];
	uint8_t domain_offset_valid;
	uint32_t domain_offset;
};
#define QMI_SERVREG_LOC_GET_DOMAIN_LIST_REQ_MSG_V01_MAX_MSG_LEN 74
struct elem_info qmi_servreg_loc_get_domain_list_req_msg_v01_ei[];

struct qmi_servreg_loc_get_domain_list_resp_msg_v01 {
	struct qmi_response_type_v01 resp;
	uint8_t total_domains_valid;
	uint16_t total_domains;
	uint8_t db_rev_count_valid;
	uint16_t db_rev_count;
	uint8_t domain_list_valid;
	uint32_t domain_list_len;
	struct servreg_loc_entry_v01
				domain_list[QMI_SERVREG_LOC_LIST_LENGTH_V01];
};
#define QMI_SERVREG_LOC_GET_DOMAIN_LIST_RESP_MSG_V01_MAX_MSG_LEN 2389
struct elem_info qmi_servreg_loc_get_domain_list_resp_msg_v01_ei[];

struct qmi_servreg_loc_register_service_list_req_msg_v01 {
	char domain_name[QMI_SERVREG_LOC_NAME_LENGTH_V01 + 1];
	uint32_t service_list_len;
	struct servreg_loc_entry_v01
				service_list[QMI_SERVREG_LOC_LIST_LENGTH_V01];
};
#define QMI_SERVREG_LOC_REGISTER_SERVICE_LIST_REQ_MSG_V01_MAX_MSG_LEN 2439
struct elem_info qmi_servreg_loc_register_service_list_req_msg_v01_ei[];

struct qmi_servreg_loc_register_service_list_resp_msg_v01 {
	struct qmi_response_type_v01 resp;
};
#define QMI_SERVREG_LOC_REGISTER_SERVICE_LIST_RESP_MSG_V01_MAX_MSG_LEN 7
struct elem_info qmi_servreg_loc_register_service_list_resp_msg_v01_ei[];

struct qmi_servreg_loc_database_updated_ind_msg_v01 {
	char placeholder;
};
#define QMI_SERVREG_LOC_DATABASE_UPDATED_IND_MSG_V01_MAX_MSG_LEN 0
struct elem_info qmi_servreg_loc_database_updated_ind_msg_v01_ei[];

#define QMI_EOTI_DATA_TYPE	\
{				\
	.data_type = QMI_EOTI,	\
	.elem_len  = 0,		\
	.elem_size = 0,		\
	.is_array  = NO_ARRAY,	\
	.tlv_type  = 0x00,	\
	.offset    = 0,		\
	.ei_array  = NULL,	\
},

static struct elem_info servreg_loc_entry_v01_ei[] = {
	{
		.data_type      = QMI_STRING,
		.elem_len       = QMI_SERVREG_LOC_NAME_LENGTH_V01 + 1,
		.elem_size      = sizeof(char),
		.is_array       = NO_ARRAY,
		.tlv_type       = 0,
		.offset         = offsetof(struct servreg_loc_entry_v01,
					   name),
	},
	{
		.data_type      = QMI_UNSIGNED_4_BYTE,
		.elem_len       = 1,
		.elem_size      = sizeof(uint32_t),
		.is_array       = NO_ARRAY,
		.tlv_type       = 0,
		.offset         = offsetof(struct servreg_loc_entry_v01,
					   instance_id),
	},
	{
		.data_type      = QMI_UNSIGNED_1_BYTE,
		.elem_len       = 1,
		.elem_size      = sizeof(uint8_t),
		.is_array       = NO_ARRAY,
		.tlv_type       = 0,
		.offset         = offsetof(struct servreg_loc_entry_v01,
					   service_data_valid),
	},
	{
		.data_type      = QMI_UNSIGNED_4_BYTE,
		.elem_len       = 1,
		.elem_size      = sizeof(uint32_t),
		.is_array       = NO_ARRAY,
		.tlv_type       = 0,
		.offset         = offsetof(struct servreg_loc_entry_v01,
					   service_data),
	},
	QMI_EOTI_DATA_TYPE
};

struct elem_info qmi_servreg_loc_indication_register_req_msg_v01_ei[] = {
	{
		.data_type      = QMI_OPT_FLAG,
		.elem_len       = 1,
		.elem_size      = sizeof(uint8_t),
		.is_array       = NO_ARRAY,
		.tlv_type       = 0x10,
		.offset         = offsetof(struct
				qmi_servreg_loc_indication_register_req_msg_v01,
				enable_database_updated_indication_valid),
	},
	{
		.data_type      = QMI_UNSIGNED_1_BYTE,
		.elem_len       = 1,
		.elem_size      = sizeof(uint8_t),
		.is_array       = NO_ARRAY,
		.tlv_type       = 0x10,
		.offset         = offsetof(struct
				qmi_servreg_loc_indication_register_req_msg_v01,
				enable_database_updated_indication),
	},
	QMI_EOTI_DATA_TYPE
};

struct elem_info qmi_servreg_loc_indication_register_resp_msg_v01_ei[] = {
	{
		.data_type      = QMI_STRUCT,
		.elem_len       = 1,
		.elem_size      = sizeof(struct qmi_response_type_v01),
		.is_array       = NO_ARRAY,
		.tlv_type       = 0x02,
		.offset         = offsetof(struct
			qmi_servreg_loc_indication_register_resp_msg_v01,
			resp),
		.ei_array      = get_qmi_response_type_v01_ei(),
	},
	QMI_EOTI_DATA_TYPE
};

struct elem_info qmi_servreg_loc_get_domain_list_req_msg_v01_ei[] = {
	{
		.data_type      = QMI_STRING,
		.elem_len       = QMI_SERVREG_LOC_NAME_LENGTH_V01 + 1,
		.elem_size      = sizeof(char),
		.is_array       = NO_ARRAY,
		.tlv_type       = 0x01,
		.offset         = offsetof(struct
				qmi_servreg_loc_get_domain_list_req_msg_v01,
				service_name),
	},
	{
		.data_type      = QMI_OPT_FLAG,
		.elem_len       = 1,
		.elem_size      = sizeof(uint8_t),
		.is_array       = NO_ARRAY,
		.tlv_type       = 0x10,
		.offset         = offsetof(struct
				qmi_servreg_loc_get_domain_list_req_msg_v01,
				domain_offset_valid),
	},
	{
		.data_type      = QMI_UNSIGNED_4_BYTE,
		.elem_len       = 1,
		.elem_size      = sizeof(uint32_t),
		.is_array       = NO_ARRAY,
		.tlv_type       = 0x10,
		.offset         = offsetof(struct
				qmi_servreg_loc_get_domain_list_req_msg_v01,
				domain_offset),
	},
	QMI_EOTI_DATA_TYPE
};

struct elem_info qmi_servreg_loc_get_domain_list_resp_msg_v01_ei[] = {
	{
		.data_type      = QMI_STRUCT,
		.elem_len       = 1,
		.elem_size      = sizeof(struct qmi_response_type_v01),
		.is_array       = NO_ARRAY,
		.tlv_type       = 0x02,
		.offset         = offsetof(struct
				qmi_servreg_loc_get_domain_list_resp_msg_v01,
				resp),
		.ei_array      = get_qmi_response_type_v01_ei(),
	},
	{
		.data_type      = QMI_OPT_FLAG,
		.elem_len       = 1,
		.elem_size      = sizeof(uint8_t),
		.is_array       = NO_ARRAY,
		.tlv_type       = 0x10,
		.offset         = offsetof(struct
				qmi_servreg_loc_get_domain_list_resp_msg_v01,
				total_domains_valid),
	},
	{
		.data_type      = QMI_UNSIGNED_2_BYTE,
		.elem_len       = 1,
		.elem_size      = sizeof(uint16_t),
		.is_array       = NO_ARRAY,
		.tlv_type       = 0x10,
		.offset         = offsetof(struct
				qmi_servreg_loc_get_domain_list_resp_msg_v01,
				total_domains),
	},
	{
		.data_type      = QMI_OPT_FLAG,
		.elem_len       = 1,
		.elem_size      = sizeof(uint8_t),
		.is_array       = NO_ARRAY,
		.tlv_type       = 0x11,
		.offset         = offsetof(struct
				qmi_servreg_loc_get_domain_list_resp_msg_v01,
				db_rev_count_valid),
	},
	{
		.data_type      = QMI_UNSIGNED_2_BYTE,
		.elem_len       = 1,
		.elem_size      = sizeof(uint16_t),
		.is_array       = NO_ARRAY,
		.tlv_type       = 0x11,
		.offset         = offsetof(struct
				qmi_servreg_loc_get_domain_list_resp_msg_v01,
				db_rev_count),
	},
	{
		.data_type      = QMI_OPT_FLAG,
		.elem_len       = 1,
		.elem_size      = sizeof(uint8_t),
		.is_array       = NO_ARRAY,
		.tlv_type       = 0x12,
		.offset         = offsetof(struct
				qmi_servreg_loc_get_domain_list_resp_msg_v01,
				domain_list_valid),
	},
	{
		.data_type      = QMI_DATA_LEN,
		.elem_len       = 1,
		.elem_size      = sizeof(uint8_t),
		.is_array       = NO_ARRAY,
		.tlv_type       = 0x12,
		.offset         = offsetof(struct
				qmi_servreg_loc_get_domain_list_resp_msg_v01,
				domain_list_len),
	},
	{
		.data_type      = QMI_STRUCT,
		.elem_len       = QMI_SERVREG_LOC_LIST_LENGTH_V01,
		.elem_size      = sizeof(struct servreg_loc_entry_v01),
		.is_array       = VAR_LEN_ARRAY,
		.tlv_type       = 0x12,
		.offset         = offsetof(struct
				qmi_servreg_loc_get_domain_list_resp_msg_v01,
				domain_list),
		.ei_array      = servreg_loc_entry_v01_ei,
	},
	QMI_EOTI_DATA_TYPE
};

struct elem_info qmi_servreg_loc_register_service_list_req_msg_v01_ei[] = {
	{
		.data_type      = QMI_STRING,
		.elem_len       = QMI_SERVREG_LOC_NAME_LENGTH_V01 + 1,
		.elem_size      = sizeof(char),
		.is_array       = NO_ARRAY,
		.tlv_type       = 0x01,
		.offset         = offsetof(struct
			qmi_servreg_loc_register_service_list_req_msg_v01,
			domain_name),
	},
	{
		.data_type      = QMI_DATA_LEN,
		.elem_len       = 1,
		.elem_size      = sizeof(uint8_t),
		.is_array       = NO_ARRAY,
		.tlv_type       = 0x02,
		.offset         = offsetof(struct
			qmi_servreg_loc_register_service_list_req_msg_v01,
			service_list_len),
	},
	{
		.data_type      = QMI_STRUCT,
		.elem_len       = QMI_SERVREG_LOC_LIST_LENGTH_V01,
		.elem_size      = sizeof(struct servreg_loc_entry_v01),
		.is_array       = VAR_LEN_ARRAY,
		.tlv_type       = 0x02,
		.offset         = offsetof(struct
			qmi_servreg_loc_register_service_list_req_msg_v01,
			service_list),
		.ei_array      = servreg_loc_entry_v01_ei,
	},
	QMI_EOTI_DATA_TYPE
};

struct elem_info qmi_servreg_loc_register_service_list_resp_msg_v01_ei[] = {
	{
		.data_type      = QMI_STRUCT,
		.elem_len       = 1,
		.elem_size      = sizeof(struct qmi_response_type_v01),
		.is_array       = NO_ARRAY,
		.tlv_type       = 0x02,
		.offset         = offsetof(struct
			qmi_servreg_loc_register_service_list_resp_msg_v01,
			resp),
		.ei_array      = get_qmi_response_type_v01_ei(),
	},
	QMI_EOTI_DATA_TYPE
};

struct elem_info qmi_servreg_loc_database_updated_ind_msg_v01_ei[] = {
	QMI_EOTI_DATA_TYPE
};

#endif
+525 −0

File added.

Preview size limit exceeded, changes collapsed.

+88 −0
Original line number Diff line number Diff line
/*
 * Copyright (c) 2015, The Linux Foundation. All rights reserved.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 and
 * only version 2 as published by the Free Software Foundation.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * Process Domain Service Locator API header
 */

#ifndef _SERVICE_LOCATOR_H
#define _SERVICE_LOCATOR_H

#define QMI_SERVREG_LOC_NAME_LENGTH_V01 64
#define QMI_SERVREG_LOC_LIST_LENGTH_V01 32

/*
 * @name: The full process domain path for a process domain which provides
 *	  a particular service
 * @instance_id: The QMI instance id corresponding to the root process
 *		 domain which is responsible for notifications for this
 *		 process domain
 * @service_data_valid: Indicates if service_data field has valid data
 * @service_data: Optional service data provided by the service locator
 */
struct servreg_loc_entry_v01 {
	char name[QMI_SERVREG_LOC_NAME_LENGTH_V01 + 1];
	uint32_t instance_id;
	uint8_t service_data_valid;
	uint32_t service_data;
};

/*
 * @client_name:   Name of the client calling the api
 * @service_name:  Name of the service for which the list of process domains
 *		   is requested
 * @total_domains: Length of the process domain list
 * @db_rev_count:  Process domain list database revision number
 * @domain_list:   List of process domains providing the service
 */
struct pd_qmi_client_data {
	char client_name[QMI_SERVREG_LOC_NAME_LENGTH_V01 + 1];
	char service_name[QMI_SERVREG_LOC_NAME_LENGTH_V01 + 1];
	int total_domains;
	int db_rev_count;
	struct servreg_loc_entry_v01 *domain_list;
};

#if defined(CONFIG_MSM_SERVICE_LOCATOR)
/*
 * Use this api to request information regarding the process domains on which
 * a particular service runs. The client name and the service name inside the
 * pd_qmi_client_data structure need to be filled in by the client calling the
 * api. The total domains, db revision and the domain list will be filled in
 * by the service locator.
 * Returns 0 on success; otherwise a value < 0 if no valid subsystem is found.
 */
int get_service_location(struct pd_qmi_client_data *data);

/*
 * Use this api to request information regarding the subsystem the process
 * domain runs on.
 * @pd_path: The name field from inside the servreg_loc_entry that one
 *	     gets back using the get_processdomains api.
 * Returns 0 on success; otherwise a value < 0 if no valid subsystem is found.
 */
int find_subsys(const char *pd_path, char *subsys);

#else

static inline int get_service_location(struct pd_qmi_client_data *data)
{
	return 0;
}

static inline int find_subsys(const char *pd_path, const char *subsys)
{
	return 0;
}

#endif /* CONFIG_MSM_SERVICE_LOCATOR */

#endif