mirror of
https://xff.cz/git/u-boot/
synced 2025-09-01 00:32:04 +02:00
cpu: Support querying the address width
Different CPUs may support different address widths, meaning the amount of memory they can address. Add a property for this to the cpu_info struct. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
This commit is contained in:
@@ -19,6 +19,7 @@ int cpu_sandbox_get_info(struct udevice *dev, struct cpu_info *info)
|
||||
{
|
||||
info->cpu_freq = 42 * 42 * 42 * 42 * 42;
|
||||
info->features = 0x42424242;
|
||||
info->address_width = IS_ENABLED(CONFIG_PHYS_64BIT) ? 64 : 32;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@@ -44,10 +44,12 @@ enum {
|
||||
*
|
||||
* @cpu_freq: Current CPU frequency in Hz
|
||||
* @features: Flags for supported CPU features
|
||||
* @address_width: Width of the CPU address space in bits (e.g. 32)
|
||||
*/
|
||||
struct cpu_info {
|
||||
ulong cpu_freq;
|
||||
ulong features;
|
||||
uint address_width;
|
||||
};
|
||||
|
||||
struct cpu_ops {
|
||||
|
@@ -33,6 +33,7 @@ static int dm_test_cpu(struct unit_test_state *uts)
|
||||
ut_assertok(cpu_get_info(dev, &info));
|
||||
ut_asserteq(info.cpu_freq, 42 * 42 * 42 * 42 * 42);
|
||||
ut_asserteq(info.features, 0x42424242);
|
||||
ut_asserteq(info.address_width, 32);
|
||||
|
||||
ut_asserteq(cpu_get_count(dev), 42);
|
||||
|
||||
|
Reference in New Issue
Block a user