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 309569c406SSimon Glass /** 319569c406SSimon Glass * pci_map_physmem() - map a PCI device into memory 329569c406SSimon Glass * 339569c406SSimon Glass * This is used on sandbox to map a device into memory so that it can be 349569c406SSimon Glass * used with normal memory access. After this call, some part of the device's 359569c406SSimon Glass * internal structure becomes visible. 369569c406SSimon Glass * 379569c406SSimon Glass * This function is normally called from sandbox's map_sysmem() automatically. 389569c406SSimon Glass * 399569c406SSimon Glass * @paddr: Physical memory address, normally corresponding to a PCI BAR 409569c406SSimon Glass * @lenp: On entry, the size of the area to map, On exit it is updated 419569c406SSimon Glass * to the size actually mapped, which may be less if the device 429569c406SSimon Glass * has less space 439569c406SSimon Glass * @devp: Returns the device which mapped into this space 449569c406SSimon Glass * @ptrp: Returns a pointer to the mapped address. The device's space 459569c406SSimon Glass * can be accessed as @lenp bytes starting here 469569c406SSimon Glass * @return 0 if OK, -ve on error 479569c406SSimon Glass */ 489569c406SSimon Glass int pci_map_physmem(phys_addr_t paddr, unsigned long *lenp, 499569c406SSimon Glass struct udevice **devp, void **ptrp); 509569c406SSimon Glass 519569c406SSimon Glass /** 529569c406SSimon Glass * pci_unmap_physmem() - undo a memory mapping 539569c406SSimon Glass * 549569c406SSimon Glass * This must be called after pci_map_physmem() to undo the mapping. 559569c406SSimon Glass * 569569c406SSimon Glass * @paddr: Physical memory address, as passed to pci_map_physmem() 579569c406SSimon Glass * @len: Size of area mapped, as returned by pci_map_physmem() 589569c406SSimon Glass * @dev: Device to unmap, as returned by pci_map_physmem() 599569c406SSimon Glass * @return 0 if OK, -ve on error 609569c406SSimon Glass */ 619569c406SSimon Glass int pci_unmap_physmem(const void *addr, unsigned long len, 629569c406SSimon Glass struct udevice *dev); 639569c406SSimon Glass 649569c406SSimon Glass /** 659569c406SSimon Glass * sandbox_set_enable_pci_map() - Enable / disable PCI address mapping 669569c406SSimon Glass * 679569c406SSimon Glass * Since address mapping involves calling every driver, provide a way to 689569c406SSimon Glass * enable and disable this. It can be handled automatically by the emulator 699569c406SSimon Glass * uclass, which knows if any emulators are currently active. 709569c406SSimon Glass * 719569c406SSimon Glass * If this is disabled, pci_map_physmem() will not be called from 729569c406SSimon Glass * map_sysmem(). 739569c406SSimon Glass * 749569c406SSimon Glass * @enable: 0 to disable, 1 to enable 759569c406SSimon Glass */ 769569c406SSimon Glass void sandbox_set_enable_pci_map(int enable); 779569c406SSimon Glass 78b45122fdSSimon Glass /** 79b45122fdSSimon Glass * sandbox_read_fdt_from_file() - Read a device tree from a file 80b45122fdSSimon Glass * 81b45122fdSSimon Glass * Read a device tree file from a host file and set it up for use as the 82b45122fdSSimon Glass * control FDT. 83b45122fdSSimon Glass */ 84b45122fdSSimon Glass int sandbox_read_fdt_from_file(void); 85b45122fdSSimon Glass 86*5010d98fSSimon Glass /* Exit sandbox (quit U-Boot) */ 87*5010d98fSSimon Glass void sandbox_exit(void); 88*5010d98fSSimon Glass 89744d9859SSimon Glass #endif /* _U_BOOT_SANDBOX_H_ */ 90