cpu.c 1.2 KB

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