1 /* SPDX-License-Identifier: GPL-2.0+ */
3 * Copyright (c) 2011 The Chromium OS Authors.
6 * Sysgo Real-Time Solutions, GmbH <www.elinos.com>
7 * Marius Groeger <mgroeger@sysgo.de>
10 * Sysgo Real-Time Solutions, GmbH <www.elinos.com>
11 * Alex Zuepke <azu@sysgo.de>
14 #ifndef _U_BOOT_SANDBOX_H_
15 #define _U_BOOT_SANDBOX_H_
21 int sandbox_early_getopt_check(void);
22 int sandbox_main_loop_init(void);
24 int cleanup_before_linux(void);
26 /* drivers/video/sandbox_sdl.c */
27 int sandbox_lcd_sdl_early_init(void);
30 * pci_map_physmem() - map a PCI device into memory
32 * This is used on sandbox to map a device into memory so that it can be
33 * used with normal memory access. After this call, some part of the device's
34 * internal structure becomes visible.
36 * This function is normally called from sandbox's map_sysmem() automatically.
38 * @paddr: Physical memory address, normally corresponding to a PCI BAR
39 * @lenp: On entry, the size of the area to map, On exit it is updated
40 * to the size actually mapped, which may be less if the device
42 * @devp: Returns the device which mapped into this space
43 * @ptrp: Returns a pointer to the mapped address. The device's space
44 * can be accessed as @lenp bytes starting here
45 * @return 0 if OK, -ve on error
47 int pci_map_physmem(phys_addr_t paddr, unsigned long *lenp,
48 struct udevice **devp, void **ptrp);
51 * pci_unmap_physmem() - undo a memory mapping
53 * This must be called after pci_map_physmem() to undo the mapping.
55 * @paddr: Physical memory address, as passed to pci_map_physmem()
56 * @len: Size of area mapped, as returned by pci_map_physmem()
57 * @dev: Device to unmap, as returned by pci_map_physmem()
58 * @return 0 if OK, -ve on error
60 int pci_unmap_physmem(const void *addr, unsigned long len,
64 * sandbox_set_enable_pci_map() - Enable / disable PCI address mapping
66 * Since address mapping involves calling every driver, provide a way to
67 * enable and disable this. It can be handled automatically by the emulator
68 * uclass, which knows if any emulators are currently active.
70 * If this is disabled, pci_map_physmem() will not be called from
73 * @enable: 0 to disable, 1 to enable
75 void sandbox_set_enable_pci_map(int enable);
78 * sandbox_read_fdt_from_file() - Read a device tree from a file
80 * Read a device tree file from a host file and set it up for use as the
83 int sandbox_read_fdt_from_file(void);
85 /* Exit sandbox (quit U-Boot) */
86 void sandbox_exit(void);
88 #endif /* _U_BOOT_SANDBOX_H_ */