From: Chanwoo Choi Date: Fri, 26 Jan 2018 00:57:48 +0000 (+0900) Subject: pass: Make include directory containing the exported header files X-Git-Tag: submit/tizen/20180221.002730~15 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=5e45392dfefd5aec3a4d665243abef2324e99f2c;p=platform%2Fcore%2Fsystem%2Fpass.git pass: Make include directory containing the exported header files Existing *.[ch] files uses the following type in order to include the header file which is located in the outside directory. But it is not proper method for including the header file. - #include "core/*.h: Make 'include' directory containing the all exported header files and move the exported header files under 'include/' as following: - src/core/*.h -> include/pass/log.h - src/shared/*.h -> include/pass/*.h - src/hal/hal.h -> include/pass/hal/hal.h Change-Id: I68f6ad4c711b50a1d48bee3785d5657a8b58c963 Signed-off-by: Chanwoo Choi --- diff --git a/CMakeLists.txt b/CMakeLists.txt index 048523b..1b6053f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -87,8 +87,7 @@ SET(SRCS INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}) INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/src) -INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/src/pass) -INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/src/hal) +INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/include) SET(PKG_MODULES vconf diff --git a/include/pass/common.h b/include/pass/common.h new file mode 100644 index 0000000..46c7490 --- /dev/null +++ b/include/pass/common.h @@ -0,0 +1,150 @@ +/* + * PASS + * + * Copyright (c) 2017 Samsung Electronics Co., Ltd. + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + +#ifndef __CORE_COMMON_H__ +#define __CORE_COMMON_H__ + +#include +#include +#include +#include +#include + +#define ARRAY_SIZE(name) (sizeof(name)/sizeof(name[0])) + +/* + * One byte digit has 3 position in decimal representation + * 2 - 5 + * 4 - 10 + * 8 - 20 + * >8 - compile time error + * plus 1 null termination byte + * plus 1 for negative prefix + */ +#define MAX_DEC_SIZE(type) \ + (2 + (sizeof(type) <= 1 ? 3 : \ + sizeof(type) <= 2 ? 5 : \ + sizeof(type) <= 4 ? 10 : \ + sizeof(type) <= 8 ? 20 : \ + sizeof(int[-2*(sizeof(type) > 8)]))) + +#ifndef __CONSTRUCTOR__ +#define __CONSTRUCTOR__ __attribute__ ((constructor)) +#endif + +#ifndef __DESTRUCTOR__ +#define __DESTRUCTOR__ __attribute__ ((destructor)) +#endif + +#ifndef __WEAK__ +#define __WEAK__ __attribute__ ((weak)) +#endif + +#ifndef max +#define max(a, b) \ + __extension__ ({ \ + typeof(a) _a = (a); \ + typeof(b) _b = (b); \ + _a > _b ? _a : _b; \ + }) +#endif + +#ifndef min +#define min(a, b) \ + __extension__ ({ \ + typeof(a) _a = (a); \ + typeof(b) _b = (b); \ + _a < _b ? _a : _b; \ + }) +#endif + +#ifndef clamp +#define clamp(x, low, high) \ + __extension__ ({ \ + typeof(x) _x = (x); \ + typeof(low) _low = (low); \ + typeof(high) _high = (high); \ + ((_x > _high) ? _high : ((_x < _low) ? _low : _x)); \ + }) +#endif + +#ifndef SEC_TO_MSEC +#define SEC_TO_MSEC(x) ((x)*1000) +#endif +#ifndef MSEC_TO_USEC +#define MSEC_TO_USEC(x) ((unsigned int)(x)*1000) +#endif +#ifndef NSEC_TO_MSEC +#define NSEC_TO_MSEC(x) ((double)x/1000000) +#endif +#ifndef USEC_TO_MSEC +#define USEC_TO_MSEC(x) ((double)x/1000) +#endif + +#define NANO_SECOND_MULTIPLIER 1000000 /* 1ms = 1,000,000 nsec */ + +#ifndef safe_free +#define safe_free(x) safe_free_memory((void**)&(x)) +#endif + +static inline void safe_free_memory(void** mem) +{ + if (mem && *mem) { + free(*mem); + *mem = NULL; + } +} + +#define ret_value_if(expr, val) do { \ + if (expr) { \ + _E("(%s)", #expr); \ + return (val); \ + } \ +} while (0) + +#define ret_value_msg_if(expr, val, fmt, arg...) do { \ + if (expr) { \ + _E(fmt, ##arg); \ + return val; \ + } \ +} while (0) + +#define ret_msg_if(expr, fmt, arg...) do { \ + if (expr) { \ + _E(fmt, ##arg); \ + return; \ + } \ +} while (0) + +FILE * open_proc_oom_score_adj_file(int pid, const char *mode); +int get_exec_pid(const char *execpath); +int get_cmdline_name(pid_t pid, char *cmdline, size_t cmdline_size); +int is_vip(int pid); +int remove_dir(const char *path, int del_dir); +int sys_check_node(char *path); +int sys_get_int(char *fname, int *val); +int sys_set_int(char *fname, int val); +int sys_get_str(char *fname, char *str); +int sys_set_str(char *fname, char *val); +int terminate_process(const char *partition, bool force); +int mount_check(const char* path); +void print_time(const char *prefix); +int get_privilege(pid_t pid, char *name, size_t len); + +#endif /* __CORE_COMMON_H__ */ diff --git a/include/pass/config-parser.h b/include/pass/config-parser.h new file mode 100644 index 0000000..32a0d9b --- /dev/null +++ b/include/pass/config-parser.h @@ -0,0 +1,42 @@ +/* + * PASS + * + * Copyright (c) 2017 Samsung Electronics Co., Ltd. + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + +#ifndef __CONFIG_PARSER_H__ +#define __CONFIG_PARSER_H__ + +#define MATCH(a, b) (!strncmp(a, b, strlen(a))) +#define SET_CONF(a, b) (a = (b > 0.0 ? b : a)) + +struct parse_result { + char *section; + char *name; + char *value; +}; + +/** + * @brief Parse config file and call callback\n + * @param[in] file_name conf file. + * @param[in] cb cb is called when conf file is parsed line by line. + * @param[in] user_data user data is passed to cb. + * @return 0 on success, negative if failed + */ +int config_parse(const char *file_name, int cb(struct parse_result *result, + void *user_data), void *user_data); + +#endif diff --git a/include/pass/device-notifier.h b/include/pass/device-notifier.h new file mode 100644 index 0000000..77c571f --- /dev/null +++ b/include/pass/device-notifier.h @@ -0,0 +1,48 @@ +/* + * PASS + * + * Copyright (c) 2017 Samsung Electronics Co., Ltd. All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + +#ifndef __DEVICE_NOTIFIER_H__ +#define __DEVICE_NOTIFIER_H__ + +#include + +enum device_notifier_type { + DEVICE_NOTIFIER_BOOTING_DONE, + DEVICE_NOTIFIER_PMQOS, + DEVICE_NOTIFIER_POWEROFF, + DEVICE_NOTIFIER_MAX, +}; + +struct device_notifier { + bool is_used; + enum device_notifier_type status; + int (*func)(void *data, void *user_data); + void *user_data; +}; + +/* + * This is for internal callback method. + */ +int register_notifier(enum device_notifier_type status, + int (*func)(void *data, void *user_data), void *user_data); +int unregister_notifier(enum device_notifier_type status, + int (*func)(void *data, void *user_data), void *user_data); +void device_notify(enum device_notifier_type status, void *value); + +#endif /* __DEVICE_NOTIFIER_H__ */ diff --git a/include/pass/devices.h b/include/pass/devices.h new file mode 100644 index 0000000..38bad23 --- /dev/null +++ b/include/pass/devices.h @@ -0,0 +1,125 @@ +/* + * PASS + * + * Copyright (c) 2017 Samsung Electronics Co., Ltd. + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + +#ifndef __DEVICES_H__ +#define __DEVICES_H__ + +#include +#include "common.h" + +enum device_priority { + DEVICE_PRIORITY_NORMAL = 0, + DEVICE_PRIORITY_HIGH, +}; + +enum device_flags { + NORMAL_MODE = 0x00000001, +}; + +struct device_ops { + enum device_priority priority; + char *name; + int (*probe) (void *data); + void (*init) (void *data); + void (*exit) (void *data); + int (*start) (enum device_flags flags); + int (*stop) (enum device_flags flags); + int (*status) (void); + int (*execute) (void *data); +}; + +enum device_ops_status { + DEVICE_OPS_STATUS_UNINIT, + DEVICE_OPS_STATUS_START, + DEVICE_OPS_STATUS_STOP, + DEVICE_OPS_STATUS_MAX, +}; + +void devices_init(void *data); +void devices_exit(void *data); + +static inline int device_start(const struct device_ops *dev) +{ + if (dev && dev->start) + return dev->start(NORMAL_MODE); + + return -EINVAL; +} + +static inline int device_stop(const struct device_ops *dev) +{ + if (dev && dev->stop) + return dev->stop(NORMAL_MODE); + + return -EINVAL; +} + +static inline int device_exit(const struct device_ops *dev, void *data) +{ + if (dev && dev->exit) { + dev->exit(data); + return 0; + } + + return -EINVAL; +} + +static inline int device_execute(const struct device_ops *dev, void *data) +{ + if (dev && dev->execute) + return dev->execute(data); + + return -EINVAL; +} + +static inline int device_get_status(const struct device_ops *dev) +{ + if (dev && dev->status) + return dev->status(); + + return -EINVAL; +} + +#define DEVICE_OPS_REGISTER(dev) \ +static void __CONSTRUCTOR__ module_init(void) \ +{ \ + add_device(dev); \ +} \ +static void __DESTRUCTOR__ module_exit(void) \ +{ \ + remove_device(dev); \ +} + +void add_device(const struct device_ops *dev); +void remove_device(const struct device_ops *dev); + +const struct device_ops *find_device(const char *name); +int check_default(const struct device_ops *dev); + +#define NOT_SUPPORT_OPS(dev) ((check_default(dev)) ? 1 : 0) + +#define FIND_DEVICE_INT(dev, name) do { \ + if (!dev) dev = find_device(name); if (check_default(dev)) return -ENODEV; \ +} while (0) + +#define FIND_DEVICE_VOID(dev, name) do { \ + if (!dev) dev = find_device(name); if (check_default(dev)) return; \ +} while (0) + +#endif diff --git a/include/pass/gdbus-util.h b/include/pass/gdbus-util.h new file mode 100644 index 0000000..306e859 --- /dev/null +++ b/include/pass/gdbus-util.h @@ -0,0 +1,60 @@ +/* + * PASS (Power Aware System Service) + * + * Copyright (c) 2017 Samsung Electronics Co., Ltd. + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef __GDBUS_UTIL_H__ +#define __GDBUS_UTIL_H__ + +#include +#include + +#include "pass/pass-dbus-stub.h" +#include "pmqos/pmqos-dbus-stub.h" + +#define SYSTEMD_DBUS_NAME "org.freedesktop.systemd1" +#define SYSTEMD_DBUS_OBJECT_PATH "/org/freedesktop/systemd1" +#define SYSTEMD_DBUS_IFACE_FOR_PROPS "org.freedesktop.DBus.Properties" +#define SYSTEMD_DBUS_METHOD_GET_PROP "Get" +#define SYSTEMD_DBUS_METHOD_GET_PROP_ARG_TYPE "(ss)" +#define SYSTEMD_DBUS_METHOD_GET_PROP_RET_TYPE "(v)" +#define SYSTEMD_DBUS_IFACE_MANAGER SYSTEMD_DBUS_NAME ".Manager" + +struct pass_gdbus_signal_info { + const gchar *handler; + GCallback cb; + gpointer cb_data; + gulong ret_id; +}; + +int pass_gdbus_register_systemd_startup_callback(GDBusSignalCallback cb, + gpointer user_data, guint *id); +int pass_gdbus_unregister_systemd_startup_callback(guint id); +int pass_gdbus_get_systemd_dbus_property_string(const char *iface, + const char *prop, const char **value); +int pass_gdbus_export_interface(gpointer instance, const char *obj_path); +int pass_gdbus_get_name(const char *name); +int pass_gdbus_connect_signal(gpointer instance, int num_signals, + struct pass_gdbus_signal_info *signal_infos); +void pass_gdbus_disconnect_signal(gpointer instance, int num_signals, + struct pass_gdbus_signal_info *signal_infos); +SystemPassCore *pass_gdbus_get_instance_core(void); +void pass_gdbus_put_instance_core(SystemPassCore **instance); +SystemPassPmqos *pass_gdbus_get_instance_pmqos(void); +void pass_gdbus_put_instance_pmqos(SystemPassPmqos **instance); +int pass_gdbus_get_system_connection(void); +void pass_gdbus_put_system_connection(void); +#endif /* __GDBUS_UTIL_H__ */ diff --git a/include/pass/hal/hal.h b/include/pass/hal/hal.h new file mode 100644 index 0000000..b9e2699 --- /dev/null +++ b/include/pass/hal/hal.h @@ -0,0 +1,245 @@ +/* + * Copyright (c) 2017 Samsung Electronics Co., Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef _PASS_HAL_H_ +#define _PASS_HAL_H_ + +#include +#include +#include + +#define BUFF_MAX 255 + +#define MAKE_4B_CODE_4(A, B, C, D) \ + ((((A) & 0xff) << 24) | (((B) & 0xff) << 16) | \ + (((C) & 0xff) << 8) | (((D) & 0xff))) +#define MAKE_TAG_CONSTANT(A, B, C, D) MAKE_4B_CODE_4(A, B, C, D) + +#define HAL_INFO_TAG MAKE_TAG_CONSTANT('P', 'A', 'S', 'S') + +/* Symbolic name of the HAL info (PASS HAL Info) */ +#define HAL_INFO_SYM PassHalInfo + +#define PASS_RESOURCE_UNKNOWN 0 +#define PASS_RESOURCE_CPU_ID 1 +#define PASS_RESOURCE_BUS_ID 2 +#define PASS_RESOURCE_GPU_ID 3 +#define PASS_RESOURCE_MEMORY_ID 4 +#define PASS_RESOURCE_NONSTANDARD_ID 99 + +#define PASS_RESOURCE_CPU_NAME "cpu" +#define PASS_RESOURCE_BUS_NAME "bus" +#define PASS_RESOURCE_GPU_NAME "gpu" +#define PASS_RESOURCE_MEMORY_NAME "memory" +#define PASS_RESOURCE_NONSTANDARD_NAME "nonstandard" + +/** + * Define the common structure + */ + +struct pass_resource_common; + +/* + * pass_resource_info - Define the information structure for the resource. + * + * @magic : magic must be initialized to HAL_INFO_TAG + * @hal_version : HAL version + * @device_version: device version + * @id : device id, can have the following value. + * - PASS_RESOURCE_CPU_ID + * - PASS_RESOURCE_BUS_ID + * - PASS_RESOURCE_GPU_ID + * - PASS_RESOURCE_MEMORY_ID + * - PASS_RESOURCE_NONSTANDARD_ID + * @name : device name, can have the following value. + * - PASS_RESOURCE_CPU_NAME + * - PASS_RESOURCE_BUS_NAME + * - PASS_RESOURCE_GPU_NAME + * - PASS_RESOURCE_MEMORY_NAME + * - PASS_RESOURCE_NONSTANDARD_NAME + * @dso : module's dso + * @resourced[] : reserved for future use + * @open : function pointer to open device + * @close : function pointer to close device + */ +struct pass_resource_info { + uint32_t magic; + uint16_t hal_version; + uint16_t device_version; + const int id; + const char *name; + void *dso; + uint32_t reserved[8]; + + int (*open)(char *res_name, struct pass_resource_info *info, + struct pass_resource_common **common); + int (*close)(char *res_name, struct pass_resource_common *common); +}; + +struct pass_resource_common { + /* indicate to this device information structure */ + struct pass_resource_info *info; +}; + +/* + * Define the ops (operations) structure which are used on specific resource. + */ +struct pass_resource_dvfs_ops { + /* Get and set the current governor. */ + int (*get_curr_governor)(char *res_name, char *governor); + int (*set_curr_governor)(char *res_name, char *governor); + + int (*get_avail_governor)(char *res_name, char **avail_governor); + + /* Get the current frequency. */ + int (*get_curr_freq)(char *res_name); + + /* Get and set the minimum frequency. */ + int (*get_min_freq)(char *res_name); + int (*set_min_freq)(char *res_name, int freq); + + /* Get and set the maximum frequency. */ + int (*get_max_freq)(char *res_name); + int (*set_max_freq)(char *res_name, int freq); + + /* Get the minimum/maximum frequency which can be set to resource. */ + int (*get_available_min_freq)(char *res_name); + int (*get_available_max_freq)(char *res_name); + + /* Get and set the up_threshold to support boosting. */ + int (*get_up_threshold)(char *res_name); + int (*set_up_threshold)(char *res_name, int up_threshold); + + /* Get the load_table of each resource to estimate the system load. */ + int (*get_load_table)(char *name, void *pass_cpu_load_table); +}; + +struct pass_resource_hotplug_ops { + /* Get and set the online status of resource. */ + int (*get_online_state)(char *res_name, int cpu); + int (*set_online_state)(char *res_name, int cpu, int on); + /* Get and set the minimum number of online CPUs */ + int (*get_online_min_num) (char *res_name); + int (*set_online_min_num) (char *res_name, int min_num); + /* Get and set the maximum number of online CPUs */ + int (*get_online_max_num) (char *res_name); + int (*set_online_max_num) (char *res_name, int max_num); +}; + +struct pass_resource_tmu_ops { + /* Get the current temperature of resoruce. */ + int (*get_temp)(char *res_thremal_name); + + /* Get the policy of thermal management unit. */ + int (*get_policy)(char *res_thermal_name, char *policy); +}; + +/* + * Define the resource structure for CPU H/W. + * + * @common : common resource structure. + * @dvfs : function lists for the DVFS (Dynamic Volt. & Freq. Scaling). + * @tmu : function lists for the TMU (Thermal Management Unit). + * @hotplug : function lists for the CPU on/off. + */ +struct pass_resource_cpu { + struct pass_resource_common common; + + struct pass_resource_dvfs_ops dvfs; + struct pass_resource_tmu_ops tmu; + struct pass_resource_hotplug_ops hotplug; +}; + +/* + * Define the resource structure for Memory Bus H/W. + * + * @common : common resource structure. + * @dvfs : function lists for the DVFS (Dynamic Volt. & Freq. Scaling). + * @tmu : function lists for the TMU (Thermal Management Unit). + */ +struct pass_resource_bus { + struct pass_resource_common common; + + struct pass_resource_dvfs_ops dvfs; + struct pass_resource_tmu_ops tmu; +}; + +/* + * Define the resource structure for GPU H/W. + * + * @common : common resource structure. + * @dvfs : function lists for the DVFS (Dynamic Volt. & Freq. Scaling). + * @tmu : function lists for the TMU (Thermal Management Unit). + */ +struct pass_resource_gpu { + struct pass_resource_common common; + + struct pass_resource_dvfs_ops dvfs; + struct pass_resource_tmu_ops tmu; +}; + +/* + * Define the resource structure for Memory H/W. + * + * @common : common resource structure. + */ +struct pass_resource_memory { + struct pass_resource_common common; + + /* Get and set the /sys/kernel/debug/fault_around_bytes */ + int (*get_fault_around_bytes)(char *res_name); + int (*set_fault_around_bytes)(char *res_name, int fault_around_bytes); +}; + +/* + * Define the resource structure for nonstandard H/W. + * + * Following function is Deprecated. (Not recommended for use) + * @set_pmqos_data : function to bypass the scenario data to HAL. + * + * This structure indicates the nonstandard H/W which doesn't have + * the official supported framework (e.g., cpufreq, devfreq and so on) + * in Linux Kernel. But, the specific device might be controlled + * according to PMQoS scenario or other cases. + */ +struct pass_resource_nonstandard { + struct pass_resource_common common; + + /* + * 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 (*set_pmqos_data)(char *res_name, void *data); +}; + +int pass_get_hal_info(const char *id, const struct pass_resource_info **info); + +/** + * Structure define of HAL info module + * + * All HAL module should be use below define to make a specific + * structure for Tizen HAL. pass_get_resource_info function + * will load a pass_resource_data structure by using TizenHwInfo name + * at runtime. TizenHwInfo means Tizen Hardware Info. + */ +#define HAL_MODULE_STRUCTURE \ + __attribute__ ((visibility("default"))) \ + struct pass_resource_info HAL_INFO_SYM + +#endif /* _PASS_HAL_H_ */ diff --git a/include/pass/log.h b/include/pass/log.h new file mode 100644 index 0000000..d170161 --- /dev/null +++ b/include/pass/log.h @@ -0,0 +1,32 @@ +/* + * PASS (Power Aware System Service) + * + * Copyright (c) 2017 Samsung Electronics Co., Ltd. + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef __LOG_H__ +#define __LOG_H__ + +#include +#ifdef LOG_TAG +#undef LOG_TAG +#define LOG_TAG "PASS" +#endif /* LOG_TAG */ + +#define _D(fmt, arg...) do { SLOGD(fmt, ##arg); } while (0) +#define _I(fmt, arg...) do { SLOGI(fmt, ##arg); } while (0) +#define _W(fmt, arg...) do { SLOGW(fmt, ##arg); } while (0) +#define _E(fmt, arg...) do { SLOGE(fmt, ##arg); } while (0) +#endif diff --git a/src/core/common.c b/src/core/common.c index b75a016..a0ee779 100644 --- a/src/core/common.c +++ b/src/core/common.c @@ -34,9 +34,8 @@ #include #include -#include "shared/log.h" - -#include "common.h" +#include +#include #define BUFF_MAX 255 diff --git a/src/core/common.h b/src/core/common.h deleted file mode 100644 index 46c7490..0000000 --- a/src/core/common.h +++ /dev/null @@ -1,150 +0,0 @@ -/* - * PASS - * - * Copyright (c) 2017 Samsung Electronics Co., Ltd. - * - * Licensed under the Apache License, Version 2.0 (the License); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - - -#ifndef __CORE_COMMON_H__ -#define __CORE_COMMON_H__ - -#include -#include -#include -#include -#include - -#define ARRAY_SIZE(name) (sizeof(name)/sizeof(name[0])) - -/* - * One byte digit has 3 position in decimal representation - * 2 - 5 - * 4 - 10 - * 8 - 20 - * >8 - compile time error - * plus 1 null termination byte - * plus 1 for negative prefix - */ -#define MAX_DEC_SIZE(type) \ - (2 + (sizeof(type) <= 1 ? 3 : \ - sizeof(type) <= 2 ? 5 : \ - sizeof(type) <= 4 ? 10 : \ - sizeof(type) <= 8 ? 20 : \ - sizeof(int[-2*(sizeof(type) > 8)]))) - -#ifndef __CONSTRUCTOR__ -#define __CONSTRUCTOR__ __attribute__ ((constructor)) -#endif - -#ifndef __DESTRUCTOR__ -#define __DESTRUCTOR__ __attribute__ ((destructor)) -#endif - -#ifndef __WEAK__ -#define __WEAK__ __attribute__ ((weak)) -#endif - -#ifndef max -#define max(a, b) \ - __extension__ ({ \ - typeof(a) _a = (a); \ - typeof(b) _b = (b); \ - _a > _b ? _a : _b; \ - }) -#endif - -#ifndef min -#define min(a, b) \ - __extension__ ({ \ - typeof(a) _a = (a); \ - typeof(b) _b = (b); \ - _a < _b ? _a : _b; \ - }) -#endif - -#ifndef clamp -#define clamp(x, low, high) \ - __extension__ ({ \ - typeof(x) _x = (x); \ - typeof(low) _low = (low); \ - typeof(high) _high = (high); \ - ((_x > _high) ? _high : ((_x < _low) ? _low : _x)); \ - }) -#endif - -#ifndef SEC_TO_MSEC -#define SEC_TO_MSEC(x) ((x)*1000) -#endif -#ifndef MSEC_TO_USEC -#define MSEC_TO_USEC(x) ((unsigned int)(x)*1000) -#endif -#ifndef NSEC_TO_MSEC -#define NSEC_TO_MSEC(x) ((double)x/1000000) -#endif -#ifndef USEC_TO_MSEC -#define USEC_TO_MSEC(x) ((double)x/1000) -#endif - -#define NANO_SECOND_MULTIPLIER 1000000 /* 1ms = 1,000,000 nsec */ - -#ifndef safe_free -#define safe_free(x) safe_free_memory((void**)&(x)) -#endif - -static inline void safe_free_memory(void** mem) -{ - if (mem && *mem) { - free(*mem); - *mem = NULL; - } -} - -#define ret_value_if(expr, val) do { \ - if (expr) { \ - _E("(%s)", #expr); \ - return (val); \ - } \ -} while (0) - -#define ret_value_msg_if(expr, val, fmt, arg...) do { \ - if (expr) { \ - _E(fmt, ##arg); \ - return val; \ - } \ -} while (0) - -#define ret_msg_if(expr, fmt, arg...) do { \ - if (expr) { \ - _E(fmt, ##arg); \ - return; \ - } \ -} while (0) - -FILE * open_proc_oom_score_adj_file(int pid, const char *mode); -int get_exec_pid(const char *execpath); -int get_cmdline_name(pid_t pid, char *cmdline, size_t cmdline_size); -int is_vip(int pid); -int remove_dir(const char *path, int del_dir); -int sys_check_node(char *path); -int sys_get_int(char *fname, int *val); -int sys_set_int(char *fname, int val); -int sys_get_str(char *fname, char *str); -int sys_set_str(char *fname, char *val); -int terminate_process(const char *partition, bool force); -int mount_check(const char* path); -void print_time(const char *prefix); -int get_privilege(pid_t pid, char *name, size_t len); - -#endif /* __CORE_COMMON_H__ */ diff --git a/src/core/config-parser.c b/src/core/config-parser.c index d0e2632..b13a5b2 100644 --- a/src/core/config-parser.c +++ b/src/core/config-parser.c @@ -20,9 +20,8 @@ #include #include -#include "shared/log.h" - -#include "config-parser.h" +#include +#include #define BUFF_MAX 255 #define MAX_SECTION 64 diff --git a/src/core/config-parser.h b/src/core/config-parser.h deleted file mode 100644 index 32a0d9b..0000000 --- a/src/core/config-parser.h +++ /dev/null @@ -1,42 +0,0 @@ -/* - * PASS - * - * Copyright (c) 2017 Samsung Electronics Co., Ltd. - * - * Licensed under the Apache License, Version 2.0 (the License); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - - -#ifndef __CONFIG_PARSER_H__ -#define __CONFIG_PARSER_H__ - -#define MATCH(a, b) (!strncmp(a, b, strlen(a))) -#define SET_CONF(a, b) (a = (b > 0.0 ? b : a)) - -struct parse_result { - char *section; - char *name; - char *value; -}; - -/** - * @brief Parse config file and call callback\n - * @param[in] file_name conf file. - * @param[in] cb cb is called when conf file is parsed line by line. - * @param[in] user_data user data is passed to cb. - * @return 0 on success, negative if failed - */ -int config_parse(const char *file_name, int cb(struct parse_result *result, - void *user_data), void *user_data); - -#endif diff --git a/src/core/device-notifier.c b/src/core/device-notifier.c index 4a03ead..2c6e99b 100644 --- a/src/core/device-notifier.c +++ b/src/core/device-notifier.c @@ -18,10 +18,9 @@ #include -#include "shared/log.h" - -#include "device-notifier.h" -#include "common.h" +#include +#include +#include #define DEVICE_NOTIFIER_MAX_COUNT 255 diff --git a/src/core/device-notifier.h b/src/core/device-notifier.h deleted file mode 100644 index 77c571f..0000000 --- a/src/core/device-notifier.h +++ /dev/null @@ -1,48 +0,0 @@ -/* - * PASS - * - * Copyright (c) 2017 Samsung Electronics Co., Ltd. All rights reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - - -#ifndef __DEVICE_NOTIFIER_H__ -#define __DEVICE_NOTIFIER_H__ - -#include - -enum device_notifier_type { - DEVICE_NOTIFIER_BOOTING_DONE, - DEVICE_NOTIFIER_PMQOS, - DEVICE_NOTIFIER_POWEROFF, - DEVICE_NOTIFIER_MAX, -}; - -struct device_notifier { - bool is_used; - enum device_notifier_type status; - int (*func)(void *data, void *user_data); - void *user_data; -}; - -/* - * This is for internal callback method. - */ -int register_notifier(enum device_notifier_type status, - int (*func)(void *data, void *user_data), void *user_data); -int unregister_notifier(enum device_notifier_type status, - int (*func)(void *data, void *user_data), void *user_data); -void device_notify(enum device_notifier_type status, void *value); - -#endif /* __DEVICE_NOTIFIER_H__ */ diff --git a/src/core/devices.c b/src/core/devices.c index 46ca468..42e193c 100644 --- a/src/core/devices.c +++ b/src/core/devices.c @@ -19,10 +19,9 @@ #include #include -#include "shared/log.h" - -#include "common.h" -#include "devices.h" +#include +#include +#include static const struct device_ops default_ops = { .name = "default-ops", diff --git a/src/core/devices.h b/src/core/devices.h deleted file mode 100644 index 38bad23..0000000 --- a/src/core/devices.h +++ /dev/null @@ -1,125 +0,0 @@ -/* - * PASS - * - * Copyright (c) 2017 Samsung Electronics Co., Ltd. - * - * Licensed under the Apache License, Version 2.0 (the License); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - - -#ifndef __DEVICES_H__ -#define __DEVICES_H__ - -#include -#include "common.h" - -enum device_priority { - DEVICE_PRIORITY_NORMAL = 0, - DEVICE_PRIORITY_HIGH, -}; - -enum device_flags { - NORMAL_MODE = 0x00000001, -}; - -struct device_ops { - enum device_priority priority; - char *name; - int (*probe) (void *data); - void (*init) (void *data); - void (*exit) (void *data); - int (*start) (enum device_flags flags); - int (*stop) (enum device_flags flags); - int (*status) (void); - int (*execute) (void *data); -}; - -enum device_ops_status { - DEVICE_OPS_STATUS_UNINIT, - DEVICE_OPS_STATUS_START, - DEVICE_OPS_STATUS_STOP, - DEVICE_OPS_STATUS_MAX, -}; - -void devices_init(void *data); -void devices_exit(void *data); - -static inline int device_start(const struct device_ops *dev) -{ - if (dev && dev->start) - return dev->start(NORMAL_MODE); - - return -EINVAL; -} - -static inline int device_stop(const struct device_ops *dev) -{ - if (dev && dev->stop) - return dev->stop(NORMAL_MODE); - - return -EINVAL; -} - -static inline int device_exit(const struct device_ops *dev, void *data) -{ - if (dev && dev->exit) { - dev->exit(data); - return 0; - } - - return -EINVAL; -} - -static inline int device_execute(const struct device_ops *dev, void *data) -{ - if (dev && dev->execute) - return dev->execute(data); - - return -EINVAL; -} - -static inline int device_get_status(const struct device_ops *dev) -{ - if (dev && dev->status) - return dev->status(); - - return -EINVAL; -} - -#define DEVICE_OPS_REGISTER(dev) \ -static void __CONSTRUCTOR__ module_init(void) \ -{ \ - add_device(dev); \ -} \ -static void __DESTRUCTOR__ module_exit(void) \ -{ \ - remove_device(dev); \ -} - -void add_device(const struct device_ops *dev); -void remove_device(const struct device_ops *dev); - -const struct device_ops *find_device(const char *name); -int check_default(const struct device_ops *dev); - -#define NOT_SUPPORT_OPS(dev) ((check_default(dev)) ? 1 : 0) - -#define FIND_DEVICE_INT(dev, name) do { \ - if (!dev) dev = find_device(name); if (check_default(dev)) return -ENODEV; \ -} while (0) - -#define FIND_DEVICE_VOID(dev, name) do { \ - if (!dev) dev = find_device(name); if (check_default(dev)) return; \ -} while (0) - -#endif diff --git a/src/core/gdbus-util.c b/src/core/gdbus-util.c index 0702dc2..42d21b8 100644 --- a/src/core/gdbus-util.c +++ b/src/core/gdbus-util.c @@ -19,8 +19,8 @@ #include #include -#include "gdbus-util.h" -#include "shared/log.h" +#include +#include static GDBusConnection *g_dbus_sys_conn = NULL; diff --git a/src/core/gdbus-util.h b/src/core/gdbus-util.h deleted file mode 100644 index 306e859..0000000 --- a/src/core/gdbus-util.h +++ /dev/null @@ -1,60 +0,0 @@ -/* - * PASS (Power Aware System Service) - * - * Copyright (c) 2017 Samsung Electronics Co., Ltd. - * - * Licensed under the Apache License, Version 2.0 (the License); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef __GDBUS_UTIL_H__ -#define __GDBUS_UTIL_H__ - -#include -#include - -#include "pass/pass-dbus-stub.h" -#include "pmqos/pmqos-dbus-stub.h" - -#define SYSTEMD_DBUS_NAME "org.freedesktop.systemd1" -#define SYSTEMD_DBUS_OBJECT_PATH "/org/freedesktop/systemd1" -#define SYSTEMD_DBUS_IFACE_FOR_PROPS "org.freedesktop.DBus.Properties" -#define SYSTEMD_DBUS_METHOD_GET_PROP "Get" -#define SYSTEMD_DBUS_METHOD_GET_PROP_ARG_TYPE "(ss)" -#define SYSTEMD_DBUS_METHOD_GET_PROP_RET_TYPE "(v)" -#define SYSTEMD_DBUS_IFACE_MANAGER SYSTEMD_DBUS_NAME ".Manager" - -struct pass_gdbus_signal_info { - const gchar *handler; - GCallback cb; - gpointer cb_data; - gulong ret_id; -}; - -int pass_gdbus_register_systemd_startup_callback(GDBusSignalCallback cb, - gpointer user_data, guint *id); -int pass_gdbus_unregister_systemd_startup_callback(guint id); -int pass_gdbus_get_systemd_dbus_property_string(const char *iface, - const char *prop, const char **value); -int pass_gdbus_export_interface(gpointer instance, const char *obj_path); -int pass_gdbus_get_name(const char *name); -int pass_gdbus_connect_signal(gpointer instance, int num_signals, - struct pass_gdbus_signal_info *signal_infos); -void pass_gdbus_disconnect_signal(gpointer instance, int num_signals, - struct pass_gdbus_signal_info *signal_infos); -SystemPassCore *pass_gdbus_get_instance_core(void); -void pass_gdbus_put_instance_core(SystemPassCore **instance); -SystemPassPmqos *pass_gdbus_get_instance_pmqos(void); -void pass_gdbus_put_instance_pmqos(SystemPassPmqos **instance); -int pass_gdbus_get_system_connection(void); -void pass_gdbus_put_system_connection(void); -#endif /* __GDBUS_UTIL_H__ */ diff --git a/src/core/main.c b/src/core/main.c index 9b56d8c..a3c2542 100644 --- a/src/core/main.c +++ b/src/core/main.c @@ -23,12 +23,11 @@ #include #include -#include "shared/log.h" - -#include "common.h" -#include "device-notifier.h" -#include "devices.h" -#include "gdbus-util.h" +#include +#include +#include +#include +#include #define PASS_DBUS_BUS_NAME "org.tizen.system.pass" diff --git a/src/hal/CMakeLists.txt b/src/hal/CMakeLists.txt index ade8159..c0f1fbc 100755 --- a/src/hal/CMakeLists.txt +++ b/src/hal/CMakeLists.txt @@ -2,7 +2,7 @@ CMAKE_MINIMUM_REQUIRED(VERSION 2.6) PROJECT(pass-hal-devel C) SET(HAL_HEADERS - hal.h + ../../include/pass/hal/hal.h hal-log.h ) diff --git a/src/hal/hal.c b/src/hal/hal.c index 2f65a71..beadab5 100644 --- a/src/hal/hal.c +++ b/src/hal/hal.c @@ -24,7 +24,8 @@ #include #include -#include "hal.h" +#include + #include "hal-log.h" #ifndef EXPORT diff --git a/src/hal/hal.h b/src/hal/hal.h deleted file mode 100644 index b9e2699..0000000 --- a/src/hal/hal.h +++ /dev/null @@ -1,245 +0,0 @@ -/* - * Copyright (c) 2017 Samsung Electronics Co., Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef _PASS_HAL_H_ -#define _PASS_HAL_H_ - -#include -#include -#include - -#define BUFF_MAX 255 - -#define MAKE_4B_CODE_4(A, B, C, D) \ - ((((A) & 0xff) << 24) | (((B) & 0xff) << 16) | \ - (((C) & 0xff) << 8) | (((D) & 0xff))) -#define MAKE_TAG_CONSTANT(A, B, C, D) MAKE_4B_CODE_4(A, B, C, D) - -#define HAL_INFO_TAG MAKE_TAG_CONSTANT('P', 'A', 'S', 'S') - -/* Symbolic name of the HAL info (PASS HAL Info) */ -#define HAL_INFO_SYM PassHalInfo - -#define PASS_RESOURCE_UNKNOWN 0 -#define PASS_RESOURCE_CPU_ID 1 -#define PASS_RESOURCE_BUS_ID 2 -#define PASS_RESOURCE_GPU_ID 3 -#define PASS_RESOURCE_MEMORY_ID 4 -#define PASS_RESOURCE_NONSTANDARD_ID 99 - -#define PASS_RESOURCE_CPU_NAME "cpu" -#define PASS_RESOURCE_BUS_NAME "bus" -#define PASS_RESOURCE_GPU_NAME "gpu" -#define PASS_RESOURCE_MEMORY_NAME "memory" -#define PASS_RESOURCE_NONSTANDARD_NAME "nonstandard" - -/** - * Define the common structure - */ - -struct pass_resource_common; - -/* - * pass_resource_info - Define the information structure for the resource. - * - * @magic : magic must be initialized to HAL_INFO_TAG - * @hal_version : HAL version - * @device_version: device version - * @id : device id, can have the following value. - * - PASS_RESOURCE_CPU_ID - * - PASS_RESOURCE_BUS_ID - * - PASS_RESOURCE_GPU_ID - * - PASS_RESOURCE_MEMORY_ID - * - PASS_RESOURCE_NONSTANDARD_ID - * @name : device name, can have the following value. - * - PASS_RESOURCE_CPU_NAME - * - PASS_RESOURCE_BUS_NAME - * - PASS_RESOURCE_GPU_NAME - * - PASS_RESOURCE_MEMORY_NAME - * - PASS_RESOURCE_NONSTANDARD_NAME - * @dso : module's dso - * @resourced[] : reserved for future use - * @open : function pointer to open device - * @close : function pointer to close device - */ -struct pass_resource_info { - uint32_t magic; - uint16_t hal_version; - uint16_t device_version; - const int id; - const char *name; - void *dso; - uint32_t reserved[8]; - - int (*open)(char *res_name, struct pass_resource_info *info, - struct pass_resource_common **common); - int (*close)(char *res_name, struct pass_resource_common *common); -}; - -struct pass_resource_common { - /* indicate to this device information structure */ - struct pass_resource_info *info; -}; - -/* - * Define the ops (operations) structure which are used on specific resource. - */ -struct pass_resource_dvfs_ops { - /* Get and set the current governor. */ - int (*get_curr_governor)(char *res_name, char *governor); - int (*set_curr_governor)(char *res_name, char *governor); - - int (*get_avail_governor)(char *res_name, char **avail_governor); - - /* Get the current frequency. */ - int (*get_curr_freq)(char *res_name); - - /* Get and set the minimum frequency. */ - int (*get_min_freq)(char *res_name); - int (*set_min_freq)(char *res_name, int freq); - - /* Get and set the maximum frequency. */ - int (*get_max_freq)(char *res_name); - int (*set_max_freq)(char *res_name, int freq); - - /* Get the minimum/maximum frequency which can be set to resource. */ - int (*get_available_min_freq)(char *res_name); - int (*get_available_max_freq)(char *res_name); - - /* Get and set the up_threshold to support boosting. */ - int (*get_up_threshold)(char *res_name); - int (*set_up_threshold)(char *res_name, int up_threshold); - - /* Get the load_table of each resource to estimate the system load. */ - int (*get_load_table)(char *name, void *pass_cpu_load_table); -}; - -struct pass_resource_hotplug_ops { - /* Get and set the online status of resource. */ - int (*get_online_state)(char *res_name, int cpu); - int (*set_online_state)(char *res_name, int cpu, int on); - /* Get and set the minimum number of online CPUs */ - int (*get_online_min_num) (char *res_name); - int (*set_online_min_num) (char *res_name, int min_num); - /* Get and set the maximum number of online CPUs */ - int (*get_online_max_num) (char *res_name); - int (*set_online_max_num) (char *res_name, int max_num); -}; - -struct pass_resource_tmu_ops { - /* Get the current temperature of resoruce. */ - int (*get_temp)(char *res_thremal_name); - - /* Get the policy of thermal management unit. */ - int (*get_policy)(char *res_thermal_name, char *policy); -}; - -/* - * Define the resource structure for CPU H/W. - * - * @common : common resource structure. - * @dvfs : function lists for the DVFS (Dynamic Volt. & Freq. Scaling). - * @tmu : function lists for the TMU (Thermal Management Unit). - * @hotplug : function lists for the CPU on/off. - */ -struct pass_resource_cpu { - struct pass_resource_common common; - - struct pass_resource_dvfs_ops dvfs; - struct pass_resource_tmu_ops tmu; - struct pass_resource_hotplug_ops hotplug; -}; - -/* - * Define the resource structure for Memory Bus H/W. - * - * @common : common resource structure. - * @dvfs : function lists for the DVFS (Dynamic Volt. & Freq. Scaling). - * @tmu : function lists for the TMU (Thermal Management Unit). - */ -struct pass_resource_bus { - struct pass_resource_common common; - - struct pass_resource_dvfs_ops dvfs; - struct pass_resource_tmu_ops tmu; -}; - -/* - * Define the resource structure for GPU H/W. - * - * @common : common resource structure. - * @dvfs : function lists for the DVFS (Dynamic Volt. & Freq. Scaling). - * @tmu : function lists for the TMU (Thermal Management Unit). - */ -struct pass_resource_gpu { - struct pass_resource_common common; - - struct pass_resource_dvfs_ops dvfs; - struct pass_resource_tmu_ops tmu; -}; - -/* - * Define the resource structure for Memory H/W. - * - * @common : common resource structure. - */ -struct pass_resource_memory { - struct pass_resource_common common; - - /* Get and set the /sys/kernel/debug/fault_around_bytes */ - int (*get_fault_around_bytes)(char *res_name); - int (*set_fault_around_bytes)(char *res_name, int fault_around_bytes); -}; - -/* - * Define the resource structure for nonstandard H/W. - * - * Following function is Deprecated. (Not recommended for use) - * @set_pmqos_data : function to bypass the scenario data to HAL. - * - * This structure indicates the nonstandard H/W which doesn't have - * the official supported framework (e.g., cpufreq, devfreq and so on) - * in Linux Kernel. But, the specific device might be controlled - * according to PMQoS scenario or other cases. - */ -struct pass_resource_nonstandard { - struct pass_resource_common common; - - /* - * 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 (*set_pmqos_data)(char *res_name, void *data); -}; - -int pass_get_hal_info(const char *id, const struct pass_resource_info **info); - -/** - * Structure define of HAL info module - * - * All HAL module should be use below define to make a specific - * structure for Tizen HAL. pass_get_resource_info function - * will load a pass_resource_data structure by using TizenHwInfo name - * at runtime. TizenHwInfo means Tizen Hardware Info. - */ -#define HAL_MODULE_STRUCTURE \ - __attribute__ ((visibility("default"))) \ - struct pass_resource_info HAL_INFO_SYM - -#endif /* _PASS_HAL_H_ */ diff --git a/src/pass/pass-gov.c b/src/pass/pass-gov.c index 19febfd..6601220 100644 --- a/src/pass/pass-gov.c +++ b/src/pass/pass-gov.c @@ -21,15 +21,15 @@ #include #include +#include +#include + #include "pass.h" #include "pass-gov.h" #include "pass-pmqos.h" #include "pass-hal.h" #include "pass-rescon.h" -#include "core/device-notifier.h" -#include "core/config-parser.h" - #define PASS_CPU_STATS_MAX_COUNT 20 struct pass_governor { diff --git a/src/pass/pass-hal.c b/src/pass/pass-hal.c index 48d1e33..0d91fcc 100644 --- a/src/pass/pass-hal.c +++ b/src/pass/pass-hal.c @@ -22,11 +22,11 @@ #include #include +#include + #include "pass.h" #include "pass-hal.h" -#include "core/common.h" - static struct pass_resource_dvfs_ops *get_dvfs(struct pass_resource *res, int res_type) { diff --git a/src/pass/pass-hal.h b/src/pass/pass-hal.h index 172b0a4..8d1fd6f 100644 --- a/src/pass/pass-hal.h +++ b/src/pass/pass-hal.h @@ -20,7 +20,7 @@ #ifndef __PASS_HAL__ #define __PASS_HAL__ -#include "hal/hal.h" +#include /*** * Functions for all H/W resources diff --git a/src/pass/pass-parser.c b/src/pass/pass-parser.c index 12e6ce7..57a08cc 100644 --- a/src/pass/pass-parser.c +++ b/src/pass/pass-parser.c @@ -22,11 +22,11 @@ #include #include -#include "pass.h" +#include +#include +#include -#include "core/common.h" -#include "core/config-parser.h" -#include "hal/hal.h" +#include "pass.h" #define MAX_NUM 255 #define MIN_TIMEOUT_SEC 0.2 diff --git a/src/pass/pass-pmqos.c b/src/pass/pass-pmqos.c index 22668b2..64606f0 100644 --- a/src/pass/pass-pmqos.c +++ b/src/pass/pass-pmqos.c @@ -21,13 +21,13 @@ #include #include +#include +#include + #include "pass.h" #include "pass-gov.h" #include "pass-rescon.h" -#include "core/device-notifier.h" -#include "core/config-parser.h" - /**************************************************************************** * PASS Notifier * * - DEVICE_NOTIFIER_PMQOS * diff --git a/src/pass/pass.c b/src/pass/pass.c index 9cf90d2..c85d440 100644 --- a/src/pass/pass.c +++ b/src/pass/pass.c @@ -22,16 +22,16 @@ #include #include +#include +#include +#include +#include + #include "pass.h" #include "pass-parser.h" #include "pass-hal.h" #include "pass-gov.h" -#include "core/device-notifier.h" -#include "core/devices.h" -#include "core/common.h" -#include "core/gdbus-util.h" - #define DBUS_CORE_I_START_HANDLER "handle_start" #define DBUS_CORE_I_STOP_HANDLER "handle_stop" #define DBUS_CORE_I_NUM_SIGNALS 2 diff --git a/src/pass/pass.h b/src/pass/pass.h index c5959fd..adaffcd 100644 --- a/src/pass/pass.h +++ b/src/pass/pass.h @@ -24,7 +24,7 @@ #include #include -#include "shared/log.h" +#include #define BUFF_MAX 255 diff --git a/src/pmqos/pmqos-parser.c b/src/pmqos/pmqos-parser.c index 6d6b83c..8352f08 100644 --- a/src/pmqos/pmqos-parser.c +++ b/src/pmqos/pmqos-parser.c @@ -24,8 +24,8 @@ #include #include -#include "core/config-parser.h" -#include "shared/log.h" +#include +#include #include "pmqos.h" diff --git a/src/pmqos/pmqos.c b/src/pmqos/pmqos.c index 78854dd..88d19ab 100644 --- a/src/pmqos/pmqos.c +++ b/src/pmqos/pmqos.c @@ -20,11 +20,11 @@ #include #include -#include "core/gdbus-util.h" -#include "core/devices.h" -#include "core/common.h" -#include "core/device-notifier.h" -#include "shared/log.h" +#include +#include +#include +#include +#include #include "pmqos.h" diff --git a/src/shared/log.h b/src/shared/log.h deleted file mode 100644 index d170161..0000000 --- a/src/shared/log.h +++ /dev/null @@ -1,32 +0,0 @@ -/* - * PASS (Power Aware System Service) - * - * Copyright (c) 2017 Samsung Electronics Co., Ltd. - * - * Licensed under the Apache License, Version 2.0 (the License); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef __LOG_H__ -#define __LOG_H__ - -#include -#ifdef LOG_TAG -#undef LOG_TAG -#define LOG_TAG "PASS" -#endif /* LOG_TAG */ - -#define _D(fmt, arg...) do { SLOGD(fmt, ##arg); } while (0) -#define _I(fmt, arg...) do { SLOGI(fmt, ##arg); } while (0) -#define _W(fmt, arg...) do { SLOGW(fmt, ##arg); } while (0) -#define _E(fmt, arg...) do { SLOGE(fmt, ##arg); } while (0) -#endif