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 cleanup_before_linux(void)
57 void *map_physmem(phys_addr_t paddr, unsigned long len, unsigned long flags)
60 unsigned long plen = len;
64 if (enable_pci_map && !pci_map_physmem(paddr, &len, &map_dev, &ptr)) {
66 printf("%s: Warning: partial map at %x, wanted %lx, got %lx\n",
67 __func__, paddr, len, plen);
74 return (void *)(gd->arch.ram_buf + paddr);
77 void unmap_physmem(const void *vaddr, unsigned long flags)
81 pci_unmap_physmem(vaddr, map_len, map_dev);
87 void sandbox_set_enable_pci_map(int enable)
89 enable_pci_map = enable;
92 phys_addr_t map_to_sysmem(const void *ptr)
94 return (u8 *)ptr - gd->arch.ram_buf;
97 void flush_dcache_range(unsigned long start, unsigned long stop)