xref: /rk3399_rockchip-uboot/arch/sandbox/include/asm/u-boot-sandbox.h (revision 9569c40668290408eac447f9be99dab603c8e34c)
1744d9859SSimon Glass /*
2744d9859SSimon Glass  * Copyright (c) 2011 The Chromium OS Authors.
3744d9859SSimon Glass  *
4744d9859SSimon Glass  * (C) Copyright 2002
5744d9859SSimon Glass  * Sysgo Real-Time Solutions, GmbH <www.elinos.com>
6744d9859SSimon Glass  * Marius Groeger <mgroeger@sysgo.de>
7744d9859SSimon Glass  *
8744d9859SSimon Glass  * (C) Copyright 2002
9744d9859SSimon Glass  * Sysgo Real-Time Solutions, GmbH <www.elinos.com>
10744d9859SSimon Glass  * Alex Zuepke <azu@sysgo.de>
11744d9859SSimon Glass  *
121a459660SWolfgang Denk  * SPDX-License-Identifier:	GPL-2.0+
13744d9859SSimon Glass  */
14744d9859SSimon Glass 
15744d9859SSimon Glass #ifndef _U_BOOT_SANDBOX_H_
16744d9859SSimon Glass #define _U_BOOT_SANDBOX_H_
17744d9859SSimon Glass 
18744d9859SSimon Glass /* board/.../... */
19744d9859SSimon Glass int board_init(void);
20744d9859SSimon Glass 
21ab4e07ebSSimon Glass /* start.c */
2270db4212SSimon Glass int sandbox_early_getopt_check(void);
23ab4e07ebSSimon Glass int sandbox_main_loop_init(void);
24ab4e07ebSSimon Glass 
25b88eb329SSimon Glass int cleanup_before_linux(void);
26b88eb329SSimon Glass 
277d95f2a3SSimon Glass /* drivers/video/sandbox_sdl.c */
287d95f2a3SSimon Glass int sandbox_lcd_sdl_early_init(void);
297d95f2a3SSimon Glass 
30*9569c406SSimon Glass /**
31*9569c406SSimon Glass  * pci_map_physmem() - map a PCI device into memory
32*9569c406SSimon Glass  *
33*9569c406SSimon Glass  * This is used on sandbox to map a device into memory so that it can be
34*9569c406SSimon Glass  * used with normal memory access. After this call, some part of the device's
35*9569c406SSimon Glass  * internal structure becomes visible.
36*9569c406SSimon Glass  *
37*9569c406SSimon Glass  * This function is normally called from sandbox's map_sysmem() automatically.
38*9569c406SSimon Glass  *
39*9569c406SSimon Glass  * @paddr:	Physical memory address, normally corresponding to a PCI BAR
40*9569c406SSimon Glass  * @lenp:	On entry, the size of the area to map, On exit it is updated
41*9569c406SSimon Glass  *		to the size actually mapped, which may be less if the device
42*9569c406SSimon Glass  *		has less space
43*9569c406SSimon Glass  * @devp:	Returns the device which mapped into this space
44*9569c406SSimon Glass  * @ptrp:	Returns a pointer to the mapped address. The device's space
45*9569c406SSimon Glass  *		can be accessed as @lenp bytes starting here
46*9569c406SSimon Glass  * @return 0 if OK, -ve on error
47*9569c406SSimon Glass  */
48*9569c406SSimon Glass int pci_map_physmem(phys_addr_t paddr, unsigned long *lenp,
49*9569c406SSimon Glass 		    struct udevice **devp, void **ptrp);
50*9569c406SSimon Glass 
51*9569c406SSimon Glass /**
52*9569c406SSimon Glass  * pci_unmap_physmem() - undo a memory mapping
53*9569c406SSimon Glass  *
54*9569c406SSimon Glass  * This must be called after pci_map_physmem() to undo the mapping.
55*9569c406SSimon Glass  *
56*9569c406SSimon Glass  * @paddr:	Physical memory address, as passed to pci_map_physmem()
57*9569c406SSimon Glass  * @len:	Size of area mapped, as returned by pci_map_physmem()
58*9569c406SSimon Glass  * @dev:	Device to unmap, as returned by pci_map_physmem()
59*9569c406SSimon Glass  * @return 0 if OK, -ve on error
60*9569c406SSimon Glass  */
61*9569c406SSimon Glass int pci_unmap_physmem(const void *addr, unsigned long len,
62*9569c406SSimon Glass 		      struct udevice *dev);
63*9569c406SSimon Glass 
64*9569c406SSimon Glass /**
65*9569c406SSimon Glass  * sandbox_set_enable_pci_map() - Enable / disable PCI address mapping
66*9569c406SSimon Glass  *
67*9569c406SSimon Glass  * Since address mapping involves calling every driver, provide a way to
68*9569c406SSimon Glass  * enable and disable this. It can be handled automatically by the emulator
69*9569c406SSimon Glass  * uclass, which knows if any emulators are currently active.
70*9569c406SSimon Glass  *
71*9569c406SSimon Glass  * If this is disabled, pci_map_physmem() will not be called from
72*9569c406SSimon Glass  * map_sysmem().
73*9569c406SSimon Glass  *
74*9569c406SSimon Glass  * @enable: 0 to disable, 1 to enable
75*9569c406SSimon Glass  */
76*9569c406SSimon Glass void sandbox_set_enable_pci_map(int enable);
77*9569c406SSimon Glass 
78744d9859SSimon Glass #endif	/* _U_BOOT_SANDBOX_H_ */
79