blob: b2b8e36455598585615593a7ddbd47ce0965ab17 [file] [log] [blame]
Tom Rini10e47792018-05-06 17:58:06 -04001/* SPDX-License-Identifier: GPL-2.0+ */
Simon Glassb4a905e2011-10-10 08:22:14 +00002/*
3 * Copyright (c) 2011 The Chromium OS Authors.
4 *
5 * (C) Copyright 2002
6 * Sysgo Real-Time Solutions, GmbH <www.elinos.com>
7 * Marius Groeger <mgroeger@sysgo.de>
8 *
9 * (C) Copyright 2002
10 * Sysgo Real-Time Solutions, GmbH <www.elinos.com>
11 * Alex Zuepke <azu@sysgo.de>
Simon Glassb4a905e2011-10-10 08:22:14 +000012 */
13
14#ifndef _U_BOOT_SANDBOX_H_
15#define _U_BOOT_SANDBOX_H_
16
17/* board/.../... */
18int board_init(void);
Simon Glassb4a905e2011-10-10 08:22:14 +000019
Simon Glass0fc3c222012-02-26 17:38:50 -050020/* start.c */
Simon Glass8a3e0352012-02-15 15:51:16 -080021int sandbox_early_getopt_check(void);
Simon Glass0fc3c222012-02-26 17:38:50 -050022int sandbox_main_loop_init(void);
23
Simon Glass0aa63492013-11-10 10:27:07 -070024int cleanup_before_linux(void);
25
Simon Glassb9ddbf42014-02-27 13:26:19 -070026/* drivers/video/sandbox_sdl.c */
27int sandbox_lcd_sdl_early_init(void);
28
Simon Glass70778bc2015-03-05 12:25:26 -070029/**
30 * pci_map_physmem() - map a PCI device into memory
31 *
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.
35 *
36 * This function is normally called from sandbox's map_sysmem() automatically.
37 *
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
41 * has less space
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
46 */
47int pci_map_physmem(phys_addr_t paddr, unsigned long *lenp,
48 struct udevice **devp, void **ptrp);
49
50/**
51 * pci_unmap_physmem() - undo a memory mapping
52 *
53 * This must be called after pci_map_physmem() to undo the mapping.
54 *
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
59 */
60int pci_unmap_physmem(const void *addr, unsigned long len,
61 struct udevice *dev);
62
63/**
64 * sandbox_set_enable_pci_map() - Enable / disable PCI address mapping
65 *
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.
69 *
70 * If this is disabled, pci_map_physmem() will not be called from
71 * map_sysmem().
72 *
73 * @enable: 0 to disable, 1 to enable
74 */
75void sandbox_set_enable_pci_map(int enable);
76
Simon Glass26b78b22015-02-27 22:06:34 -070077/**
78 * sandbox_read_fdt_from_file() - Read a device tree from a file
79 *
80 * Read a device tree file from a host file and set it up for use as the
81 * control FDT.
82 */
83int sandbox_read_fdt_from_file(void);
84
Simon Glassd860f222015-07-06 12:54:29 -060085/* Exit sandbox (quit U-Boot) */
86void sandbox_exit(void);
87
Simon Glassb4a905e2011-10-10 08:22:14 +000088#endif /* _U_BOOT_SANDBOX_H_ */