xref: /OK3568_Linux_fs/u-boot/arch/sandbox/include/asm/u-boot-sandbox.h (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1*4882a593Smuzhiyun /*
2*4882a593Smuzhiyun  * Copyright (c) 2011 The Chromium OS Authors.
3*4882a593Smuzhiyun  *
4*4882a593Smuzhiyun  * (C) Copyright 2002
5*4882a593Smuzhiyun  * Sysgo Real-Time Solutions, GmbH <www.elinos.com>
6*4882a593Smuzhiyun  * Marius Groeger <mgroeger@sysgo.de>
7*4882a593Smuzhiyun  *
8*4882a593Smuzhiyun  * (C) Copyright 2002
9*4882a593Smuzhiyun  * Sysgo Real-Time Solutions, GmbH <www.elinos.com>
10*4882a593Smuzhiyun  * Alex Zuepke <azu@sysgo.de>
11*4882a593Smuzhiyun  *
12*4882a593Smuzhiyun  * SPDX-License-Identifier:	GPL-2.0+
13*4882a593Smuzhiyun  */
14*4882a593Smuzhiyun 
15*4882a593Smuzhiyun #ifndef _U_BOOT_SANDBOX_H_
16*4882a593Smuzhiyun #define _U_BOOT_SANDBOX_H_
17*4882a593Smuzhiyun 
18*4882a593Smuzhiyun /* board/.../... */
19*4882a593Smuzhiyun int board_init(void);
20*4882a593Smuzhiyun 
21*4882a593Smuzhiyun /* start.c */
22*4882a593Smuzhiyun int sandbox_early_getopt_check(void);
23*4882a593Smuzhiyun int sandbox_main_loop_init(void);
24*4882a593Smuzhiyun 
25*4882a593Smuzhiyun int cleanup_before_linux(void);
26*4882a593Smuzhiyun 
27*4882a593Smuzhiyun /* drivers/video/sandbox_sdl.c */
28*4882a593Smuzhiyun int sandbox_lcd_sdl_early_init(void);
29*4882a593Smuzhiyun 
30*4882a593Smuzhiyun /**
31*4882a593Smuzhiyun  * pci_map_physmem() - map a PCI device into memory
32*4882a593Smuzhiyun  *
33*4882a593Smuzhiyun  * This is used on sandbox to map a device into memory so that it can be
34*4882a593Smuzhiyun  * used with normal memory access. After this call, some part of the device's
35*4882a593Smuzhiyun  * internal structure becomes visible.
36*4882a593Smuzhiyun  *
37*4882a593Smuzhiyun  * This function is normally called from sandbox's map_sysmem() automatically.
38*4882a593Smuzhiyun  *
39*4882a593Smuzhiyun  * @paddr:	Physical memory address, normally corresponding to a PCI BAR
40*4882a593Smuzhiyun  * @lenp:	On entry, the size of the area to map, On exit it is updated
41*4882a593Smuzhiyun  *		to the size actually mapped, which may be less if the device
42*4882a593Smuzhiyun  *		has less space
43*4882a593Smuzhiyun  * @devp:	Returns the device which mapped into this space
44*4882a593Smuzhiyun  * @ptrp:	Returns a pointer to the mapped address. The device's space
45*4882a593Smuzhiyun  *		can be accessed as @lenp bytes starting here
46*4882a593Smuzhiyun  * @return 0 if OK, -ve on error
47*4882a593Smuzhiyun  */
48*4882a593Smuzhiyun int pci_map_physmem(phys_addr_t paddr, unsigned long *lenp,
49*4882a593Smuzhiyun 		    struct udevice **devp, void **ptrp);
50*4882a593Smuzhiyun 
51*4882a593Smuzhiyun /**
52*4882a593Smuzhiyun  * pci_unmap_physmem() - undo a memory mapping
53*4882a593Smuzhiyun  *
54*4882a593Smuzhiyun  * This must be called after pci_map_physmem() to undo the mapping.
55*4882a593Smuzhiyun  *
56*4882a593Smuzhiyun  * @paddr:	Physical memory address, as passed to pci_map_physmem()
57*4882a593Smuzhiyun  * @len:	Size of area mapped, as returned by pci_map_physmem()
58*4882a593Smuzhiyun  * @dev:	Device to unmap, as returned by pci_map_physmem()
59*4882a593Smuzhiyun  * @return 0 if OK, -ve on error
60*4882a593Smuzhiyun  */
61*4882a593Smuzhiyun int pci_unmap_physmem(const void *addr, unsigned long len,
62*4882a593Smuzhiyun 		      struct udevice *dev);
63*4882a593Smuzhiyun 
64*4882a593Smuzhiyun /**
65*4882a593Smuzhiyun  * sandbox_set_enable_pci_map() - Enable / disable PCI address mapping
66*4882a593Smuzhiyun  *
67*4882a593Smuzhiyun  * Since address mapping involves calling every driver, provide a way to
68*4882a593Smuzhiyun  * enable and disable this. It can be handled automatically by the emulator
69*4882a593Smuzhiyun  * uclass, which knows if any emulators are currently active.
70*4882a593Smuzhiyun  *
71*4882a593Smuzhiyun  * If this is disabled, pci_map_physmem() will not be called from
72*4882a593Smuzhiyun  * map_sysmem().
73*4882a593Smuzhiyun  *
74*4882a593Smuzhiyun  * @enable: 0 to disable, 1 to enable
75*4882a593Smuzhiyun  */
76*4882a593Smuzhiyun void sandbox_set_enable_pci_map(int enable);
77*4882a593Smuzhiyun 
78*4882a593Smuzhiyun /**
79*4882a593Smuzhiyun  * sandbox_read_fdt_from_file() - Read a device tree from a file
80*4882a593Smuzhiyun  *
81*4882a593Smuzhiyun  * Read a device tree file from a host file and set it up for use as the
82*4882a593Smuzhiyun  * control FDT.
83*4882a593Smuzhiyun  */
84*4882a593Smuzhiyun int sandbox_read_fdt_from_file(void);
85*4882a593Smuzhiyun 
86*4882a593Smuzhiyun /* Exit sandbox (quit U-Boot) */
87*4882a593Smuzhiyun void sandbox_exit(void);
88*4882a593Smuzhiyun 
89*4882a593Smuzhiyun #endif	/* _U_BOOT_SANDBOX_H_ */
90