ANDROID: GKI: ARM/ARM64: Introduce arch_read_hardware_id

Moving towards device tree and arm single binary referring to
machine descriptor name for hardware id information under
/proc/cpuinfo is not sufficient for soc vendors. Add a
hook for soc vendors to supply a per-soc hardware read method

Change-Id: Ifcccdffa3c0e1e8b5f96837eb1c023e468d4c287
Signed-off-by: Abhimanyu Kapur <abhimany@codeaurora.org>
Signed-off-by: Prasad Sodagudi <psodagud@codeaurora.org>
Signed-off-by: Rishabh Bhatnagar <rishabhb@codeaurora.org>
Signed-off-by: Bhargav Gurappadi <bhargavg1@codeaurora.org>
(cherry picked from commit b39389c3a6)
Signed-off-by: Mark Salyzyn <salyzyn@google.com>
Bug: 153738240
This commit is contained in:
Bhargav Gurappadi 2016-08-01 22:23:00 -07:00 committed by Mark Salyzyn
parent bf3b194518
commit 4cde55b708
4 changed files with 21 additions and 1 deletions

View file

@ -37,6 +37,7 @@ static inline void harden_branch_predictor(void)
#define UDBG_BUS (1 << 4)
extern unsigned int user_debug;
extern char* (*arch_read_hardware_id)(void);
static inline int handle_guest_sea(phys_addr_t addr, unsigned int esr)
{

View file

@ -113,6 +113,9 @@ unsigned int elf_hwcap2 __read_mostly;
EXPORT_SYMBOL(elf_hwcap2);
char* (*arch_read_hardware_id)(void);
EXPORT_SYMBOL(arch_read_hardware_id);
#ifdef MULTI_CPU
struct processor processor __ro_after_init;
#if defined(CONFIG_BIG_LITTLE) && defined(CONFIG_HARDEN_BRANCH_PREDICTOR)
@ -1293,7 +1296,10 @@ static int c_show(struct seq_file *m, void *v)
seq_printf(m, "CPU revision\t: %d\n\n", cpuid & 15);
}
seq_printf(m, "Hardware\t: %s\n", machine_name);
if (!arch_read_hardware_id)
seq_printf(m, "Hardware\t: %s\n", machine_name);
else
seq_printf(m, "Hardware\t: %s\n", arch_read_hardware_id());
seq_printf(m, "Revision\t: %04x\n", system_rev);
seq_printf(m, "Serial\t\t: %s\n", system_serial);

View file

@ -44,6 +44,7 @@ extern void show_pte(unsigned long addr);
extern void __show_regs(struct pt_regs *);
extern void (*arm_pm_restart)(enum reboot_mode reboot_mode, const char *cmd);
extern char* (*arch_read_hardware_id)(void);
int handle_guest_sea(phys_addr_t addr, unsigned int esr);

View file

@ -34,6 +34,12 @@
#include <linux/sched.h>
#include <linux/smp.h>
#include <linux/delay.h>
#include <linux/of_fdt.h>
char* (*arch_read_hardware_id)(void);
EXPORT_SYMBOL(arch_read_hardware_id);
static const char *machine_name;
/*
* In case the boot CPU is hotpluggable, we record its initial state and
@ -177,6 +183,11 @@ static int c_show(struct seq_file *m, void *v)
seq_printf(m, "CPU revision\t: %d\n\n", MIDR_REVISION(midr));
}
if (!arch_read_hardware_id)
seq_printf(m, "Hardware\t: %s\n", machine_name);
else
seq_printf(m, "Hardware\t: %s\n", arch_read_hardware_id());
return 0;
}
@ -383,6 +394,7 @@ void __init cpuinfo_store_boot_cpu(void)
boot_cpu_data = *info;
init_cpu_features(&boot_cpu_data);
machine_name = of_flat_dt_get_machine_name();
}
device_initcall(cpuinfo_regs_init);