xref: /openbmc/linux/include/drm/drm_aperture.h (revision 97c9bfe3)
129160591SThomas Zimmermann /* SPDX-License-Identifier: MIT */
229160591SThomas Zimmermann 
329160591SThomas Zimmermann #ifndef _DRM_APERTURE_H_
429160591SThomas Zimmermann #define _DRM_APERTURE_H_
529160591SThomas Zimmermann 
629160591SThomas Zimmermann #include <linux/types.h>
729160591SThomas Zimmermann 
8730e7992SThomas Zimmermann struct drm_device;
9*97c9bfe3SThomas Zimmermann struct drm_driver;
1029160591SThomas Zimmermann struct pci_dev;
1129160591SThomas Zimmermann 
12730e7992SThomas Zimmermann int devm_aperture_acquire_from_firmware(struct drm_device *dev, resource_size_t base,
13730e7992SThomas Zimmermann 					resource_size_t size);
14730e7992SThomas Zimmermann 
1529160591SThomas Zimmermann int drm_aperture_remove_conflicting_framebuffers(resource_size_t base, resource_size_t size,
16*97c9bfe3SThomas Zimmermann 						 bool primary, const struct drm_driver *req_driver);
1729160591SThomas Zimmermann 
18*97c9bfe3SThomas Zimmermann int drm_aperture_remove_conflicting_pci_framebuffers(struct pci_dev *pdev,
19*97c9bfe3SThomas Zimmermann 						     const struct drm_driver *req_driver);
2029160591SThomas Zimmermann 
2129160591SThomas Zimmermann /**
2229160591SThomas Zimmermann  * drm_aperture_remove_framebuffers - remove all existing framebuffers
2329160591SThomas Zimmermann  * @primary: also kick vga16fb if present
24*97c9bfe3SThomas Zimmermann  * @req_driver: requesting DRM driver
2529160591SThomas Zimmermann  *
2629160591SThomas Zimmermann  * This function removes all graphics device drivers. Use this function on systems
2729160591SThomas Zimmermann  * that can have their framebuffer located anywhere in memory.
2829160591SThomas Zimmermann  *
2929160591SThomas Zimmermann  * Returns:
3029160591SThomas Zimmermann  * 0 on success, or a negative errno code otherwise
3129160591SThomas Zimmermann  */
32*97c9bfe3SThomas Zimmermann static inline int
33*97c9bfe3SThomas Zimmermann drm_aperture_remove_framebuffers(bool primary, const struct drm_driver *req_driver)
3429160591SThomas Zimmermann {
35*97c9bfe3SThomas Zimmermann 	return drm_aperture_remove_conflicting_framebuffers(0, (resource_size_t)-1, primary,
36*97c9bfe3SThomas Zimmermann 							    req_driver);
3729160591SThomas Zimmermann }
3829160591SThomas Zimmermann 
3929160591SThomas Zimmermann #endif
40