1 /*
2  * Copyright (c) 2017-2018, ARM Limited and Contributors. All rights reserved.
3  * Copyright (c) 2020-2021, NVIDIA Corporation. All rights reserved.
4  *
5  * SPDX-License-Identifier: BSD-3-Clause
6  */
7 
8 #ifndef TEGRA_PLATFORM_H
9 #define TEGRA_PLATFORM_H
10 
11 #include <cdefs.h>
12 #include <lib/utils_def.h>
13 #include <stdbool.h>
14 
15 /*******************************************************************************
16  * Tegra major, minor version helper macros
17  ******************************************************************************/
18 #define MAJOR_VERSION_SHIFT		U(0x4)
19 #define MAJOR_VERSION_MASK		U(0xF)
20 #define MINOR_VERSION_SHIFT		U(0x10)
21 #define MINOR_VERSION_MASK		U(0xF)
22 #define CHIP_ID_SHIFT			U(8)
23 #define CHIP_ID_MASK			U(0xFF)
24 #define PRE_SI_PLATFORM_SHIFT		U(0x14)
25 #define PRE_SI_PLATFORM_MASK		U(0xF)
26 
27 /*******************************************************************************
28  * Tegra chip ID values
29  ******************************************************************************/
30 #define TEGRA_CHIPID_TEGRA13		U(0x13)
31 #define TEGRA_CHIPID_TEGRA21		U(0x21)
32 #define TEGRA_CHIPID_TEGRA18		U(0x18)
33 #define TEGRA_CHIPID_TEGRA19		U(0x19)
34 
35 /*******************************************************************************
36  * JEDEC Standard Manufacturer's Identification Code and Bank ID
37  ******************************************************************************/
38 #define JEDEC_NVIDIA_MFID		U(0x6B)
39 #define JEDEC_NVIDIA_BKID		U(3)
40 
41 #ifndef __ASSEMBLER__
42 
43 /*
44  * Tegra chip ID major/minor identifiers
45  */
46 uint32_t tegra_get_chipid_major(void);
47 uint32_t tegra_get_chipid_minor(void);
48 
49 /*
50  * Tegra chip ID identifiers
51  */
52 bool tegra_chipid_is_t186(void);
53 bool tegra_chipid_is_t210(void);
54 bool tegra_chipid_is_t210_b01(void);
55 bool tegra_chipid_is_t194(void);
56 
57 /*
58  * Tegra platform identifiers
59  */
60 bool tegra_platform_is_silicon(void);
61 bool tegra_platform_is_qt(void);
62 bool tegra_platform_is_emulation(void);
63 bool tegra_platform_is_linsim(void);
64 bool tegra_platform_is_fpga(void);
65 bool tegra_platform_is_unit_fpga(void);
66 bool tegra_platform_is_virt_dev_kit(void);
67 
68 #endif /* __ASSEMBLER__ */
69 
70 #endif /* TEGRA_PLATFORM_H */
71