1*83d290c5STom Rini /* SPDX-License-Identifier: GPL-2.0+ */ 2744d9859SSimon Glass /* 3744d9859SSimon Glass * Copyright (c) 2011 The Chromium OS Authors. 4744d9859SSimon Glass * 5744d9859SSimon Glass * (C) Copyright 2002 6744d9859SSimon Glass * Sysgo Real-Time Solutions, GmbH <www.elinos.com> 7744d9859SSimon Glass * Marius Groeger <mgroeger@sysgo.de> 8744d9859SSimon Glass * 9744d9859SSimon Glass * (C) Copyright 2002 10744d9859SSimon Glass * Sysgo Real-Time Solutions, GmbH <www.elinos.com> 11744d9859SSimon Glass * Alex Zuepke <azu@sysgo.de> 12744d9859SSimon Glass */ 13744d9859SSimon Glass 14744d9859SSimon Glass #ifndef _U_BOOT_SANDBOX_H_ 15744d9859SSimon Glass #define _U_BOOT_SANDBOX_H_ 16744d9859SSimon Glass 17744d9859SSimon Glass /* board/.../... */ 18744d9859SSimon Glass int board_init(void); 19744d9859SSimon Glass 20ab4e07ebSSimon Glass /* start.c */ 2170db4212SSimon Glass int sandbox_early_getopt_check(void); 22ab4e07ebSSimon Glass int sandbox_main_loop_init(void); 23ab4e07ebSSimon Glass 24b88eb329SSimon Glass int cleanup_before_linux(void); 25b88eb329SSimon Glass 267d95f2a3SSimon Glass /* drivers/video/sandbox_sdl.c */ 277d95f2a3SSimon Glass int sandbox_lcd_sdl_early_init(void); 287d95f2a3SSimon Glass 299569c406SSimon Glass /** 309569c406SSimon Glass * pci_map_physmem() - map a PCI device into memory 319569c406SSimon Glass * 329569c406SSimon Glass * This is used on sandbox to map a device into memory so that it can be 339569c406SSimon Glass * used with normal memory access. After this call, some part of the device's 349569c406SSimon Glass * internal structure becomes visible. 359569c406SSimon Glass * 369569c406SSimon Glass * This function is normally called from sandbox's map_sysmem() automatically. 379569c406SSimon Glass * 389569c406SSimon Glass * @paddr: Physical memory address, normally corresponding to a PCI BAR 399569c406SSimon Glass * @lenp: On entry, the size of the area to map, On exit it is updated 409569c406SSimon Glass * to the size actually mapped, which may be less if the device 419569c406SSimon Glass * has less space 429569c406SSimon Glass * @devp: Returns the device which mapped into this space 439569c406SSimon Glass * @ptrp: Returns a pointer to the mapped address. The device's space 449569c406SSimon Glass * can be accessed as @lenp bytes starting here 459569c406SSimon Glass * @return 0 if OK, -ve on error 469569c406SSimon Glass */ 479569c406SSimon Glass int pci_map_physmem(phys_addr_t paddr, unsigned long *lenp, 489569c406SSimon Glass struct udevice **devp, void **ptrp); 499569c406SSimon Glass 509569c406SSimon Glass /** 519569c406SSimon Glass * pci_unmap_physmem() - undo a memory mapping 529569c406SSimon Glass * 539569c406SSimon Glass * This must be called after pci_map_physmem() to undo the mapping. 549569c406SSimon Glass * 559569c406SSimon Glass * @paddr: Physical memory address, as passed to pci_map_physmem() 569569c406SSimon Glass * @len: Size of area mapped, as returned by pci_map_physmem() 579569c406SSimon Glass * @dev: Device to unmap, as returned by pci_map_physmem() 589569c406SSimon Glass * @return 0 if OK, -ve on error 599569c406SSimon Glass */ 609569c406SSimon Glass int pci_unmap_physmem(const void *addr, unsigned long len, 619569c406SSimon Glass struct udevice *dev); 629569c406SSimon Glass 639569c406SSimon Glass /** 649569c406SSimon Glass * sandbox_set_enable_pci_map() - Enable / disable PCI address mapping 659569c406SSimon Glass * 669569c406SSimon Glass * Since address mapping involves calling every driver, provide a way to 679569c406SSimon Glass * enable and disable this. It can be handled automatically by the emulator 689569c406SSimon Glass * uclass, which knows if any emulators are currently active. 699569c406SSimon Glass * 709569c406SSimon Glass * If this is disabled, pci_map_physmem() will not be called from 719569c406SSimon Glass * map_sysmem(). 729569c406SSimon Glass * 739569c406SSimon Glass * @enable: 0 to disable, 1 to enable 749569c406SSimon Glass */ 759569c406SSimon Glass void sandbox_set_enable_pci_map(int enable); 769569c406SSimon Glass 77b45122fdSSimon Glass /** 78b45122fdSSimon Glass * sandbox_read_fdt_from_file() - Read a device tree from a file 79b45122fdSSimon Glass * 80b45122fdSSimon Glass * Read a device tree file from a host file and set it up for use as the 81b45122fdSSimon Glass * control FDT. 82b45122fdSSimon Glass */ 83b45122fdSSimon Glass int sandbox_read_fdt_from_file(void); 84b45122fdSSimon Glass 855010d98fSSimon Glass /* Exit sandbox (quit U-Boot) */ 865010d98fSSimon Glass void sandbox_exit(void); 875010d98fSSimon Glass 88744d9859SSimon Glass #endif /* _U_BOOT_SANDBOX_H_ */ 89