cpu_sandbox.c 1.2 KB

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