cpu.c 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. /*
  2. * Copyright (c) 2011 The Chromium OS Authors.
  3. * SPDX-License-Identifier: GPL-2.0+
  4. */
  5. #include <common.h>
  6. #include <dm/root.h>
  7. #include <os.h>
  8. #include <asm/state.h>
  9. DECLARE_GLOBAL_DATA_PTR;
  10. void reset_cpu(ulong ignored)
  11. {
  12. if (state_uninit())
  13. os_exit(2);
  14. if (dm_uninit())
  15. os_exit(2);
  16. /* This is considered normal termination for now */
  17. os_exit(0);
  18. }
  19. int do_reset(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
  20. {
  21. reset_cpu(0);
  22. return 0;
  23. }
  24. /* delay x useconds */
  25. void __udelay(unsigned long usec)
  26. {
  27. os_usleep(usec);
  28. }
  29. unsigned long __attribute__((no_instrument_function)) timer_get_us(void)
  30. {
  31. return os_get_nsec() / 1000;
  32. }
  33. int do_bootm_linux(int flag, int argc, char *argv[], bootm_headers_t *images)
  34. {
  35. if (flag & (BOOTM_STATE_OS_GO | BOOTM_STATE_OS_FAKE_GO)) {
  36. bootstage_mark(BOOTSTAGE_ID_RUN_OS);
  37. printf("## Transferring control to Linux (at address %08lx)...\n",
  38. images->ep);
  39. reset_cpu(0);
  40. }
  41. return 0;
  42. }
  43. int cleanup_before_linux(void)
  44. {
  45. return 0;
  46. }
  47. void *map_physmem(phys_addr_t paddr, unsigned long len, unsigned long flags)
  48. {
  49. return (void *)(gd->arch.ram_buf + paddr);
  50. }
  51. phys_addr_t map_to_sysmem(const void *ptr)
  52. {
  53. return (u8 *)ptr - gd->arch.ram_buf;
  54. }
  55. void flush_dcache_range(unsigned long start, unsigned long stop)
  56. {
  57. }