aperture.h 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. /* SPDX-License-Identifier: MIT */
  2. #ifndef _LINUX_APERTURE_H_
  3. #define _LINUX_APERTURE_H_
  4. #include <linux/types.h>
  5. struct pci_dev;
  6. struct platform_device;
  7. #if defined(CONFIG_APERTURE_HELPERS)
  8. int devm_aperture_acquire_for_platform_device(struct platform_device *pdev,
  9. resource_size_t base,
  10. resource_size_t size);
  11. int aperture_remove_conflicting_devices(resource_size_t base, resource_size_t size,
  12. bool primary, const char *name);
  13. int aperture_remove_conflicting_pci_devices(struct pci_dev *pdev, const char *name);
  14. #else
  15. static inline int devm_aperture_acquire_for_platform_device(struct platform_device *pdev,
  16. resource_size_t base,
  17. resource_size_t size)
  18. {
  19. return 0;
  20. }
  21. static inline int aperture_remove_conflicting_devices(resource_size_t base, resource_size_t size,
  22. bool primary, const char *name)
  23. {
  24. return 0;
  25. }
  26. static inline int aperture_remove_conflicting_pci_devices(struct pci_dev *pdev, const char *name)
  27. {
  28. return 0;
  29. }
  30. #endif
  31. /**
  32. * aperture_remove_all_conflicting_devices - remove all existing framebuffers
  33. * @primary: also kick vga16fb if present; only relevant for VGA devices
  34. * @name: a descriptive name of the requesting driver
  35. *
  36. * This function removes all graphics device drivers. Use this function on systems
  37. * that can have their framebuffer located anywhere in memory.
  38. *
  39. * Returns:
  40. * 0 on success, or a negative errno code otherwise
  41. */
  42. static inline int aperture_remove_all_conflicting_devices(bool primary, const char *name)
  43. {
  44. return aperture_remove_conflicting_devices(0, (resource_size_t)-1, primary, name);
  45. }
  46. #endif