blob: 5f20786e95b44a55a88d2dcfb91e43a9cfb9948a [file] [log] [blame]
Travis Geiselbrecht1d0df692008-09-01 02:26:09 -07001/*
2 * Copyright (c) 2008 Travis Geiselbrecht
3 *
Umang Agrawal3f4cc322019-05-27 14:28:59 +05304 * Copyright (c) 2014-2019, The Linux Foundation. All rights reserved.
Sundarajan Srinivasan79e5f512014-03-28 16:43:06 -07005 *
Travis Geiselbrecht1d0df692008-09-01 02:26:09 -07006 * Permission is hereby granted, free of charge, to any person obtaining
7 * a copy of this software and associated documentation files
8 * (the "Software"), to deal in the Software without restriction,
9 * including without limitation the rights to use, copy, modify, merge,
10 * publish, distribute, sublicense, and/or sell copies of the Software,
11 * and to permit persons to whom the Software is furnished to do so,
12 * subject to the following conditions:
13 *
14 * The above copyright notice and this permission notice shall be
15 * included in all copies or substantial portions of the Software.
16 *
17 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
18 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
19 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
20 * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
21 * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
22 * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
23 * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
24 */
25#ifndef __PLATFORM_H
26#define __PLATFORM_H
27
Pavel Nedeva4c9d3a2013-05-15 14:42:34 +030028#include <dload_util.h>
29
Deepa Dinamani20cb9e52012-10-18 12:20:47 -070030#define PA(x) platform_get_virt_to_phys_mapping(x)
31#define VA(x) platform_get_phys_to_virt_mapping(x)
32
Travis Geiselbrecht1d0df692008-09-01 02:26:09 -070033time_t current_time(void);
34bigtime_t current_time_hires(void);
35
36/* super early platform initialization, before almost everything */
37void platform_early_init(void);
38
39/* later init, after the kernel has come up */
40void platform_init(void);
41
42/* called by the arch init code to get the platform to set up any mmu mappings it may need */
Deepa Dinamani3e5cf0d2012-10-29 12:15:17 -070043int platform_use_identity_mmu_mappings(void);
Travis Geiselbrecht1d0df692008-09-01 02:26:09 -070044void platform_init_mmu_mappings(void);
Deepa Dinamani20cb9e52012-10-18 12:20:47 -070045addr_t platform_get_virt_to_phys_mapping(addr_t virt_addr);
46addr_t platform_get_phys_to_virt_mapping(addr_t phys_addr);
Unnati Gandhi7c536732014-07-17 14:37:49 +053047addr_t get_bs_info_addr(void);
Travis Geiselbrecht1d0df692008-09-01 02:26:09 -070048
Greg Griscod6250552011-06-29 14:40:23 -070049void display_init(void);
50void display_shutdown(void);
51void display_image_on_screen(void);
jialongjhanb2dda0b2020-04-21 20:20:51 +080052//[Arima][8901][JialongJhan]Show Fastboot logo 20190418 Start
53void display_default_image_on_screen(void);
54void display_fastboot_image_on_screen(void);
55void display_lowbattery_image_on_screen(void);
56//[Arima][8901][JialongJhan]Show Fastboot logo 20190418 End
57//[Arima][8901][JialongJhan] Command mode update screen 20190516 Start
58int msm_display_flush(void);
59//[Arima][8901][JialongJhan] Command mode update screen 20190516 End
60
vijay kumar7ad71162015-05-21 11:38:20 +053061void display_fbcon_message(char *str);
Greg Griscod6250552011-06-29 14:40:23 -070062
63unsigned board_machtype(void);
Amol Jadia63aaff2012-02-01 15:51:50 -080064unsigned board_platform_id(void);
Greg Griscod6250552011-06-29 14:40:23 -070065unsigned check_reboot_mode(void);
lijuangc518f5d2015-02-10 10:22:53 +080066unsigned check_hard_reboot_mode(void);
lijuangdc20de12015-02-11 12:09:57 +080067uint32_t check_alarm_boot(void);
Greg Griscod6250552011-06-29 14:40:23 -070068void platform_uninit_timer(void);
69void reboot_device(unsigned);
lijuang395b5e62015-11-19 17:39:44 +080070int set_download_mode(enum reboot_reason mode);
Sundarajan Srinivasan79e5f512014-03-28 16:43:06 -070071uint32_t platform_get_smem_base_addr();
Unnati Gandhi7c536732014-07-17 14:37:49 +053072uint32_t platform_get_sclk_count(void);
73void clock_config_cdc(uint32_t interface);
74int platform_is_msm8939();
Unnati Gandhibdddf0d2014-11-18 18:00:34 +053075int platform_is_msm8909();
Jeevan Shriram8d5e5ee2015-01-07 11:35:55 -080076int platform_is_msm8992();
Parth Dixit4552cba2015-10-20 01:18:59 +053077int platform_is_msm8937();
Parth Dixit05f3c9f2016-03-18 17:14:57 +053078int platform_is_msm8917();
lijuang412d4f02018-10-16 18:27:48 +080079int platform_is_qm215();
Parth Dixitdeecdcd2016-01-12 15:12:56 +053080uint32_t platform_get_apcs_ipc_base();
81int platform_is_msm8952();
Gaurav Nebhwani4157b052016-03-09 15:45:55 +053082int platform_is_msm8953();
Unnati Gandhia4084922015-05-28 14:22:09 +053083int platform_is_msm8956();
lijuangd18524e2018-04-04 20:22:19 +080084int platform_is_sdm429();
85int platform_is_sdm439();
Umang Agrawal3f4cc322019-05-27 14:28:59 +053086int platform_is_sdm429w();
Meng Jiangc86f5cb2019-10-23 15:05:25 +080087int platform_is_sda429w();
vijay kumara0a74722015-09-04 15:45:49 +053088uint32_t platform_is_msm8976_v_1_1();
Parth Dixit4734bd62016-01-13 11:06:28 +053089uint32_t platform_get_tz_app_add();
90uint32_t platform_get_tz_app_size();
Unnati Gandhibdddf0d2014-11-18 18:00:34 +053091int boot_device_mask(int);
Unnati Gandhi6bc34fa2014-11-27 16:55:54 +053092uint32_t platform_detect_panel();
Aparna Mallavarapu711119b2015-03-29 03:35:07 +053093uint32_t platform_get_max_periph();
Channagoud Kadabi53a21262015-04-09 16:18:23 -070094int platform_is_msm8996();
Shalini Krishnamoorthi3d4bb2a2016-06-24 15:17:29 -070095int platform_is_apq8096_mediabox();
Channagoud Kadabie35356f2015-08-05 18:06:38 -070096bool platform_use_qmp_misc_settings();
lijuang4ece1e72015-08-14 21:02:36 +080097void set_device_unlock_value(int type, bool status);
98void get_product_name(unsigned char *buf);
99void get_bootloader_version(unsigned char *buf);
100void get_baseband_version(unsigned char *buf);
101bool is_device_locked();
Karthik Jadala8e6b2192017-02-08 12:59:16 +0530102bool platform_is_mdm9650();
anisha agarwal35eb8032017-03-21 13:12:12 -0700103bool platform_is_sdx20();
Channagoud Kadabic0dbac92016-01-11 16:49:01 -0800104uint64_t platform_get_ddr_start();
Mayank Grover90457012016-12-29 18:24:04 +0530105bool platform_is_glink_enabled();
Mayank Grover42664672017-03-06 17:57:26 +0530106bool platform_is_mdm9206();
AnilKumar Chimata29a19c32017-08-10 14:48:55 +0530107int is_vb_le_enabled();
Mayank Grovere73aafb2017-11-02 12:52:33 +0530108void* get_rpmb_snd_rcv_buff();
Monika Singh5e170362018-03-14 00:48:36 +0530109int LoadImage(char *Pname, void **ImgBuf, uint32_t *ImgSzActual);
110void boot_verifier_init();
111uint32_t get_page_size();
Monika Singh94316462018-03-15 18:39:01 +0530112int read_rollback_index(uint32_t loc, uint64_t *roll_back_index);
113int write_rollback_index(uint32_t loc, uint64_t roll_back_index);
Monika Singhb0fad822018-03-15 18:50:55 +0530114int get_userkey(uint8_t **user_key, uint32_t *user_key_size);
115int erase_userkey();
116int store_userkey(uint8_t *user_key, uint32_t user_key_size);
Monika Singh32a09f72018-03-14 13:08:29 +0530117bool is_device_locked_critical();
118bool is_verity_enforcing();
Travis Geiselbrecht1d0df692008-09-01 02:26:09 -0700119#endif