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