mirror of
https://github.com/AsahiLinux/u-boot
synced 2024-12-21 02:33:07 +00:00
816226d27e
Add a basic CPU driver that retrieves information about the microblaze CPU core. cpu_ops handlers are implemented so that the "cpu" command can work properly: U-Boot-mONStR> cpu list 0: cpu@0 MicroBlaze @ 50MHz, Rev: 11.0, FPGA family: zynq7000 U-Boot-mONStR> cpu detail 0: cpu@0 MicroBlaze @ 50MHz, Rev: 11.0, FPGA family: zynq7000 ID = 0, freq = 50 MHz: L1 cache, MMU Note: cpu_ver_lookup[] and family_string_lookup[] arrays were imported from linux. Signed-off-by: Ovidiu Panait <ovpanait@gmail.com> Link: https://lore.kernel.org/r/20220531181435.3473549-14-ovpanait@gmail.com Signed-off-by: Michal Simek <michal.simek@amd.com>
114 lines
3.4 KiB
C
114 lines
3.4 KiB
C
/* SPDX-License-Identifier: GPL-2.0+ */
|
|
/*
|
|
* Copyright (C) 2022, Ovidiu Panait <ovpanait@gmail.com>
|
|
*/
|
|
|
|
#ifndef __ASM_MICROBLAZE_CPUINFO_H
|
|
#define __ASM_MICROBLAZE_CPUINFO_H
|
|
|
|
/**
|
|
* struct microblaze_cpuinfo - CPU info for microblaze processor core.
|
|
*
|
|
* @icache_size: Size of instruction cache memory in bytes.
|
|
* @icache_line_length: Instruction cache line length in bytes.
|
|
* @dcache_size: Size of data cache memory in bytes.
|
|
* @dcache_line_length: Data cache line length in bytes.
|
|
* @use_mmu: MMU support flag.
|
|
* @cpu_freq: Cpu clock frequency in Hz.
|
|
* @addr_size: Address bus width in bits.
|
|
* @ver_code: Cpu version code.
|
|
* @fpga_code: FPGA family version code.
|
|
*/
|
|
struct microblaze_cpuinfo {
|
|
u32 icache_size;
|
|
u32 icache_line_length;
|
|
|
|
u32 dcache_size;
|
|
u32 dcache_line_length;
|
|
|
|
#if CONFIG_IS_ENABLED(CPU_MICROBLAZE)
|
|
u32 use_mmu;
|
|
u32 cpu_freq;
|
|
u32 addr_size;
|
|
|
|
u32 ver_code;
|
|
u32 fpga_code;
|
|
#endif /* CONFIG_CPU_MICROBLAZE */
|
|
};
|
|
|
|
/**
|
|
* struct microblaze_version_data - Maps a hex version code to a cpu/fpga name.
|
|
*/
|
|
struct microblaze_version_map {
|
|
const char *string;
|
|
const u32 code;
|
|
};
|
|
|
|
/**
|
|
* microblaze_lookup_cpu_version_code() - Get hex version code for the
|
|
* specified cpu name string.
|
|
*
|
|
* This function searches the cpu_ver_lookup[] array for the hex version code
|
|
* associated with a specific CPU name. The version code is returned if a match
|
|
* is found, otherwise 0.
|
|
*
|
|
* @string: cpu name string
|
|
*
|
|
* Return: >0 if the entry is found, 0 otherwise.
|
|
*/
|
|
const u32 microblaze_lookup_cpu_version_code(const char *string);
|
|
|
|
/**
|
|
* microblaze_lookup_fpga_family_code() - Get hex version code for the
|
|
* specified fpga family name.
|
|
*
|
|
* This function searches the family_string_lookup[] array for the hex version
|
|
* code associated with a specific fpga family name. The version code is
|
|
* returned if a match is found, otherwise 0.
|
|
*
|
|
* @string: fpga family name string
|
|
*
|
|
* Return: >0 if the entry is found, 0 otherwise.
|
|
*/
|
|
const u32 microblaze_lookup_fpga_family_code(const char *string);
|
|
|
|
/**
|
|
* microblaze_lookup_cpu_version_string() - Get cpu name for the specified cpu
|
|
* version code.
|
|
*
|
|
* This function searches the cpu_ver_lookup[] array for the cpu name string
|
|
* associated with a specific version code. The cpu name is returned if a match
|
|
* is found, otherwise "(unknown)".
|
|
*
|
|
* @code: cpu version code
|
|
*
|
|
* Return: Pointer to the cpu name if the entry is found, otherwise "(unknown)".
|
|
*/
|
|
const char *microblaze_lookup_cpu_version_string(const u32 code);
|
|
|
|
/**
|
|
* microblaze_lookup_fpga_family_string() - Get fpga family name for the
|
|
* specified version code.
|
|
*
|
|
* This function searches the family_string_lookup[] array for the fpga family
|
|
* name string associated with a specific version code. The fpga family name is
|
|
* returned if a match is found, otherwise "(unknown)".
|
|
*
|
|
* @code: fpga family version code
|
|
*
|
|
* Return: Pointer to the fpga family name if the entry is found, otherwise
|
|
* "(unknown)".
|
|
*/
|
|
const char *microblaze_lookup_fpga_family_string(const u32 code);
|
|
|
|
/**
|
|
* microblaze_early_cpuinfo_init() - Initialize cpuinfo with default values.
|
|
*
|
|
* Initializes the global data cpuinfo structure with default values (cache
|
|
* size, cache line size, etc.). It is called very early in the boot process
|
|
* (start.S codepath right before the first cache flush call) to ensure that
|
|
* cache related operations are properly handled.
|
|
*/
|
|
void microblaze_early_cpuinfo_init(void);
|
|
|
|
#endif /* __ASM_MICROBLAZE_CPUINFO_H */
|