/*-1* Copyright 2014 Svatopluk Kraus <[email protected]>2* Copyright 2014 Michal Meloun <[email protected]>3* All rights reserved.4*5* Redistribution and use in source and binary forms, with or without6* modification, are permitted provided that the following conditions7* are met:8* 1. Redistributions of source code must retain the above copyright9* notice, this list of conditions and the following disclaimer.10* 2. Redistributions in binary form must reproduce the above copyright11* notice, this list of conditions and the following disclaimer in the12* documentation and/or other materials provided with the distribution.13*14* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND15* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE16* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE17* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE18* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL19* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS20* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)21* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT22* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY23* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF24* SUCH DAMAGE.25*/2627#ifndef _MACHINE_CPUINFO_H_28#define _MACHINE_CPUINFO_H_2930#include <sys/types.h>3132#define CPU_IMPLEMENTER_ARM 0x4133#define CPU_IMPLEMENTER_QCOM 0x5134#define CPU_IMPLEMENTER_MRVL 0x563536/* ARM */37#define CPU_ARCH_ARM1176 0xB7638#define CPU_ARCH_CORTEX_A5 0xC0539#define CPU_ARCH_CORTEX_A7 0xC0740#define CPU_ARCH_CORTEX_A8 0xC0841#define CPU_ARCH_CORTEX_A9 0xC0942#define CPU_ARCH_CORTEX_A12 0xC0D43#define CPU_ARCH_CORTEX_A15 0xC0F44#define CPU_ARCH_CORTEX_A17 0xC1145#define CPU_ARCH_CORTEX_A53 0xD0346#define CPU_ARCH_CORTEX_A57 0xD0747#define CPU_ARCH_CORTEX_A72 0xD0848#define CPU_ARCH_CORTEX_A73 0xD0949#define CPU_ARCH_CORTEX_A75 0xD0A5051/* QCOM */52#define CPU_ARCH_KRAIT_300 0x06F5354/* MRVL */55#define CPU_ARCH_SHEEVA_581 0x581 /* PJ4/PJ4B */56#define CPU_ARCH_SHEEVA_584 0x584 /* PJ4B-MP/PJ4C */5758struct cpuinfo {59/* raw id registers */60uint32_t midr;61uint32_t ctr;62uint32_t tcmtr;63uint32_t tlbtr;64uint32_t mpidr;65uint32_t revidr;66uint32_t id_pfr0;67uint32_t id_pfr1;68uint32_t id_dfr0;69uint32_t id_afr0;70uint32_t id_mmfr0;71uint32_t id_mmfr1;72uint32_t id_mmfr2;73uint32_t id_mmfr3;74uint32_t id_isar0;75uint32_t id_isar1;76uint32_t id_isar2;77uint32_t id_isar3;78uint32_t id_isar4;79uint32_t id_isar5;80uint32_t cbar;81uint32_t ccsidr;82uint32_t clidr;8384/* Parsed bits of above registers... */8586/* midr */87int implementer;88int revision;89int architecture;90int part_number;91int patch;9293/* id_mmfr0 */94int outermost_shareability;95int shareability_levels;96int auxiliary_registers;97int innermost_shareability;9899/* id_mmfr1 */100int mem_barrier;101102/* id_mmfr3 */103int coherent_walk;104int maintenance_broadcast;105106/* id_pfr1 */107int generic_timer_ext;108int virtualization_ext;109int security_ext;110111/* L1 cache info */112int dcache_line_size;113int dcache_line_mask;114int icache_line_size;115int icache_line_mask;116117/* mpidr */118int mp_ext;119};120121extern struct cpuinfo cpuinfo;122123void cpuinfo_init(void);124void cpuinfo_init_bp_hardening(void);125void cpuinfo_reinit_mmu(uint32_t ttb);126#endif /* _MACHINE_CPUINFO_H_ */127128129