2 * Copyright (c) 2011 The Chromium OS Authors.
3 * SPDX-License-Identifier: GPL-2.0+
11 DECLARE_GLOBAL_DATA_PTR;
13 /* Enable access to PCI memory with map_sysmem() */
14 static bool enable_pci_map;
17 /* Last device that was mapped into memory, and length of mapping */
18 static struct udevice *map_dev;
19 unsigned long map_len;
22 void reset_cpu(ulong ignored)
30 /* This is considered normal termination for now */
34 int do_reset(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
41 /* delay x useconds */
42 void __udelay(unsigned long usec)
47 unsigned long __attribute__((no_instrument_function)) timer_get_us(void)
49 return os_get_nsec() / 1000;
52 int do_bootm_linux(int flag, int argc, char *argv[], bootm_headers_t *images)
54 if (flag & (BOOTM_STATE_OS_GO | BOOTM_STATE_OS_FAKE_GO)) {
55 bootstage_mark(BOOTSTAGE_ID_RUN_OS);
56 printf("## Transferring control to Linux (at address %08lx)...\n",
64 int cleanup_before_linux(void)
69 void *map_physmem(phys_addr_t paddr, unsigned long len, unsigned long flags)
72 unsigned long plen = len;
76 if (enable_pci_map && !pci_map_physmem(paddr, &len, &map_dev, &ptr)) {
78 printf("%s: Warning: partial map at %x, wanted %lx, got %lx\n",
79 __func__, paddr, len, plen);
86 return (void *)(gd->arch.ram_buf + paddr);
89 void unmap_physmem(const void *vaddr, unsigned long flags)
93 pci_unmap_physmem(vaddr, map_len, map_dev);
99 void sandbox_set_enable_pci_map(int enable)
101 enable_pci_map = enable;
104 phys_addr_t map_to_sysmem(const void *ptr)
106 return (u8 *)ptr - gd->arch.ram_buf;
109 void flush_dcache_range(unsigned long start, unsigned long stop)