summaryrefslogtreecommitdiff
path: root/include/soc/qcom/service-locator.h
blob: 7fa25b90fc1230c264c639e83c050372efdf48b8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
/*
 * Copyright (c) 2015-2016, 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;
};

enum service_locator_state {
	LOCATOR_DOWN = 0x0F,
	LOCATOR_UP = 0x1F,
};

#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, the service name
 * and notifier block pointer need to be provided by 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(char *client_name, char *service_name,
		struct notifier_block *locator_nb);

/*
 * 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(char *client_name,
		char *service_name, struct notifier_block *locator_nb)
{
	return -ENODEV;
}

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

#endif /* CONFIG_MSM_SERVICE_LOCATOR */

#endif