1 #pragma once 2 3 #include <stdbool.h> 4 #include <stdint.h> 5 6 #include <cpuinfo.h> 7 #include <cpuinfo/common.h> 8 9 enum cpuinfo_arm_chipset_vendor { 10 cpuinfo_arm_chipset_vendor_unknown = 0, 11 cpuinfo_arm_chipset_vendor_qualcomm, 12 cpuinfo_arm_chipset_vendor_mediatek, 13 cpuinfo_arm_chipset_vendor_samsung, 14 cpuinfo_arm_chipset_vendor_hisilicon, 15 cpuinfo_arm_chipset_vendor_actions, 16 cpuinfo_arm_chipset_vendor_allwinner, 17 cpuinfo_arm_chipset_vendor_amlogic, 18 cpuinfo_arm_chipset_vendor_broadcom, 19 cpuinfo_arm_chipset_vendor_lg, 20 cpuinfo_arm_chipset_vendor_leadcore, 21 cpuinfo_arm_chipset_vendor_marvell, 22 cpuinfo_arm_chipset_vendor_mstar, 23 cpuinfo_arm_chipset_vendor_novathor, 24 cpuinfo_arm_chipset_vendor_nvidia, 25 cpuinfo_arm_chipset_vendor_pinecone, 26 cpuinfo_arm_chipset_vendor_renesas, 27 cpuinfo_arm_chipset_vendor_rockchip, 28 cpuinfo_arm_chipset_vendor_spreadtrum, 29 cpuinfo_arm_chipset_vendor_telechips, 30 cpuinfo_arm_chipset_vendor_texas_instruments, 31 cpuinfo_arm_chipset_vendor_wondermedia, 32 cpuinfo_arm_chipset_vendor_max, 33 }; 34 35 enum cpuinfo_arm_chipset_series { 36 cpuinfo_arm_chipset_series_unknown = 0, 37 cpuinfo_arm_chipset_series_qualcomm_qsd, 38 cpuinfo_arm_chipset_series_qualcomm_msm, 39 cpuinfo_arm_chipset_series_qualcomm_apq, 40 cpuinfo_arm_chipset_series_qualcomm_snapdragon, 41 cpuinfo_arm_chipset_series_mediatek_mt, 42 cpuinfo_arm_chipset_series_samsung_exynos, 43 cpuinfo_arm_chipset_series_hisilicon_k3v, 44 cpuinfo_arm_chipset_series_hisilicon_hi, 45 cpuinfo_arm_chipset_series_hisilicon_kirin, 46 cpuinfo_arm_chipset_series_actions_atm, 47 cpuinfo_arm_chipset_series_allwinner_a, 48 cpuinfo_arm_chipset_series_amlogic_aml, 49 cpuinfo_arm_chipset_series_amlogic_s, 50 cpuinfo_arm_chipset_series_broadcom_bcm, 51 cpuinfo_arm_chipset_series_lg_nuclun, 52 cpuinfo_arm_chipset_series_leadcore_lc, 53 cpuinfo_arm_chipset_series_marvell_pxa, 54 cpuinfo_arm_chipset_series_mstar_6a, 55 cpuinfo_arm_chipset_series_novathor_u, 56 cpuinfo_arm_chipset_series_nvidia_tegra_t, 57 cpuinfo_arm_chipset_series_nvidia_tegra_ap, 58 cpuinfo_arm_chipset_series_nvidia_tegra_sl, 59 cpuinfo_arm_chipset_series_pinecone_surge_s, 60 cpuinfo_arm_chipset_series_renesas_mp, 61 cpuinfo_arm_chipset_series_rockchip_rk, 62 cpuinfo_arm_chipset_series_spreadtrum_sc, 63 cpuinfo_arm_chipset_series_telechips_tcc, 64 cpuinfo_arm_chipset_series_texas_instruments_omap, 65 cpuinfo_arm_chipset_series_wondermedia_wm, 66 cpuinfo_arm_chipset_series_max, 67 }; 68 69 #define CPUINFO_ARM_CHIPSET_SUFFIX_MAX 8 70 71 struct cpuinfo_arm_chipset { 72 enum cpuinfo_arm_chipset_vendor vendor; 73 enum cpuinfo_arm_chipset_series series; 74 uint32_t model; 75 char suffix[CPUINFO_ARM_CHIPSET_SUFFIX_MAX]; 76 }; 77 78 #define CPUINFO_ARM_CHIPSET_NAME_MAX CPUINFO_PACKAGE_NAME_MAX 79 80 #ifndef __cplusplus 81 CPUINFO_INTERNAL void cpuinfo_arm_chipset_to_string( 82 const struct cpuinfo_arm_chipset chipset[restrict static 1], 83 char name[restrict static CPUINFO_ARM_CHIPSET_NAME_MAX]); 84 85 CPUINFO_INTERNAL void cpuinfo_arm_fixup_chipset( 86 struct cpuinfo_arm_chipset chipset[restrict static 1], uint32_t cores, uint32_t max_cpu_freq_max); 87 88 CPUINFO_INTERNAL void cpuinfo_arm_decode_vendor_uarch( 89 uint32_t midr, 90 #if CPUINFO_ARCH_ARM 91 bool has_vfpv4, 92 #endif 93 enum cpuinfo_vendor vendor[restrict static 1], 94 enum cpuinfo_uarch uarch[restrict static 1]); 95 96 CPUINFO_INTERNAL void cpuinfo_arm_decode_cache( 97 enum cpuinfo_uarch uarch, 98 uint32_t cluster_cores, 99 uint32_t midr, 100 const struct cpuinfo_arm_chipset chipset[restrict static 1], 101 uint32_t cluster_id, 102 uint32_t arch_version, 103 struct cpuinfo_cache l1i[restrict static 1], 104 struct cpuinfo_cache l1d[restrict static 1], 105 struct cpuinfo_cache l2[restrict static 1], 106 struct cpuinfo_cache l3[restrict static 1]); 107 108 CPUINFO_INTERNAL uint32_t cpuinfo_arm_compute_max_cache_size( 109 const struct cpuinfo_processor processor[restrict static 1]); 110 #else /* defined(__cplusplus) */ 111 CPUINFO_INTERNAL void cpuinfo_arm_decode_cache( 112 enum cpuinfo_uarch uarch, 113 uint32_t cluster_cores, 114 uint32_t midr, 115 const struct cpuinfo_arm_chipset chipset[1], 116 uint32_t cluster_id, 117 uint32_t arch_version, 118 struct cpuinfo_cache l1i[1], 119 struct cpuinfo_cache l1d[1], 120 struct cpuinfo_cache l2[1], 121 struct cpuinfo_cache l3[1]); 122 #endif 123