u-boot-sandbox.h 2.8 KB

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