Mario Six | fa44b53 | 2018-08-06 10:23:44 +0200 | [diff] [blame] | 1 | // SPDX-License-Identifier: GPL-2.0+ |
| 2 | /* |
| 3 | * (C) Copyright 2018 |
| 4 | * Mario Six, Guntermann & Drunck GmbH, mario.six@gdsys.cc |
| 5 | */ |
| 6 | |
| 7 | #include <common.h> |
| 8 | #include <dm.h> |
| 9 | #include <cpu.h> |
| 10 | |
| 11 | int cpu_sandbox_get_desc(struct udevice *dev, char *buf, int size) |
| 12 | { |
| 13 | snprintf(buf, size, "LEG Inc. SuperMegaUltraTurbo CPU No. 1"); |
| 14 | |
| 15 | return 0; |
| 16 | } |
| 17 | |
| 18 | int cpu_sandbox_get_info(struct udevice *dev, struct cpu_info *info) |
| 19 | { |
| 20 | info->cpu_freq = 42 * 42 * 42 * 42 * 42; |
| 21 | info->features = 0x42424242; |
Simon Glass | 600f584 | 2020-04-08 16:57:20 -0600 | [diff] [blame] | 22 | info->address_width = IS_ENABLED(CONFIG_PHYS_64BIT) ? 64 : 32; |
Mario Six | fa44b53 | 2018-08-06 10:23:44 +0200 | [diff] [blame] | 23 | |
| 24 | return 0; |
| 25 | } |
| 26 | |
| 27 | int cpu_sandbox_get_count(struct udevice *dev) |
| 28 | { |
| 29 | return 42; |
| 30 | } |
| 31 | |
| 32 | int cpu_sandbox_get_vendor(struct udevice *dev, char *buf, int size) |
| 33 | { |
| 34 | snprintf(buf, size, "Languid Example Garbage Inc."); |
| 35 | |
| 36 | return 0; |
| 37 | } |
| 38 | |
| 39 | static const struct cpu_ops cpu_sandbox_ops = { |
| 40 | .get_desc = cpu_sandbox_get_desc, |
| 41 | .get_info = cpu_sandbox_get_info, |
| 42 | .get_count = cpu_sandbox_get_count, |
| 43 | .get_vendor = cpu_sandbox_get_vendor, |
| 44 | }; |
| 45 | |
| 46 | int cpu_sandbox_probe(struct udevice *dev) |
| 47 | { |
| 48 | return 0; |
| 49 | } |
| 50 | |
| 51 | static const struct udevice_id cpu_sandbox_ids[] = { |
| 52 | { .compatible = "sandbox,cpu_sandbox" }, |
| 53 | { } |
| 54 | }; |
| 55 | |
| 56 | U_BOOT_DRIVER(cpu_sandbox) = { |
| 57 | .name = "cpu_sandbox", |
| 58 | .id = UCLASS_CPU, |
| 59 | .ops = &cpu_sandbox_ops, |
| 60 | .of_match = cpu_sandbox_ids, |
| 61 | .probe = cpu_sandbox_probe, |
| 62 | }; |