xref: /linux/include/linux/aperture.h (revision 5fbcc6708fe32ef80122cd2a59ddca9d18b24d6e)
17283f862SThomas Zimmermann /* SPDX-License-Identifier: MIT */
27283f862SThomas Zimmermann 
37283f862SThomas Zimmermann #ifndef _LINUX_APERTURE_H_
47283f862SThomas Zimmermann #define _LINUX_APERTURE_H_
57283f862SThomas Zimmermann 
67283f862SThomas Zimmermann #include <linux/types.h>
77283f862SThomas Zimmermann 
87283f862SThomas Zimmermann struct pci_dev;
97283f862SThomas Zimmermann struct platform_device;
107283f862SThomas Zimmermann 
117283f862SThomas Zimmermann #if defined(CONFIG_APERTURE_HELPERS)
127283f862SThomas Zimmermann int devm_aperture_acquire_for_platform_device(struct platform_device *pdev,
137283f862SThomas Zimmermann 					      resource_size_t base,
147283f862SThomas Zimmermann 					      resource_size_t size);
157283f862SThomas Zimmermann 
167283f862SThomas Zimmermann int aperture_remove_conflicting_devices(resource_size_t base, resource_size_t size,
17*5fbcc670SDaniel Vetter 					const char *name);
187283f862SThomas Zimmermann 
197283f862SThomas Zimmermann int aperture_remove_conflicting_pci_devices(struct pci_dev *pdev, const char *name);
207283f862SThomas Zimmermann #else
217283f862SThomas Zimmermann static inline int devm_aperture_acquire_for_platform_device(struct platform_device *pdev,
227283f862SThomas Zimmermann 							    resource_size_t base,
237283f862SThomas Zimmermann 							    resource_size_t size)
247283f862SThomas Zimmermann {
257283f862SThomas Zimmermann 	return 0;
267283f862SThomas Zimmermann }
277283f862SThomas Zimmermann 
287283f862SThomas Zimmermann static inline int aperture_remove_conflicting_devices(resource_size_t base, resource_size_t size,
29*5fbcc670SDaniel Vetter 						      const char *name)
307283f862SThomas Zimmermann {
317283f862SThomas Zimmermann 	return 0;
327283f862SThomas Zimmermann }
337283f862SThomas Zimmermann 
347283f862SThomas Zimmermann static inline int aperture_remove_conflicting_pci_devices(struct pci_dev *pdev, const char *name)
357283f862SThomas Zimmermann {
367283f862SThomas Zimmermann 	return 0;
377283f862SThomas Zimmermann }
387283f862SThomas Zimmermann #endif
397283f862SThomas Zimmermann 
407283f862SThomas Zimmermann /**
417283f862SThomas Zimmermann  * aperture_remove_all_conflicting_devices - remove all existing framebuffers
427283f862SThomas Zimmermann  * @name: a descriptive name of the requesting driver
437283f862SThomas Zimmermann  *
447283f862SThomas Zimmermann  * This function removes all graphics device drivers. Use this function on systems
457283f862SThomas Zimmermann  * that can have their framebuffer located anywhere in memory.
467283f862SThomas Zimmermann  *
477283f862SThomas Zimmermann  * Returns:
487283f862SThomas Zimmermann  * 0 on success, or a negative errno code otherwise
497283f862SThomas Zimmermann  */
50*5fbcc670SDaniel Vetter static inline int aperture_remove_all_conflicting_devices(const char *name)
517283f862SThomas Zimmermann {
52*5fbcc670SDaniel Vetter 	return aperture_remove_conflicting_devices(0, (resource_size_t)-1, name);
537283f862SThomas Zimmermann }
547283f862SThomas Zimmermann 
557283f862SThomas Zimmermann #endif
56