xref: /openbmc/linux/include/linux/aperture.h (revision 116b1c5a)
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,
175fbcc670SDaniel Vetter 					const char *name);
187283f862SThomas Zimmermann 
19*116b1c5aSThomas Zimmermann int __aperture_remove_legacy_vga_devices(struct pci_dev *pdev);
20*116b1c5aSThomas Zimmermann 
217283f862SThomas Zimmermann int aperture_remove_conflicting_pci_devices(struct pci_dev *pdev, const char *name);
227283f862SThomas Zimmermann #else
devm_aperture_acquire_for_platform_device(struct platform_device * pdev,resource_size_t base,resource_size_t size)237283f862SThomas Zimmermann static inline int devm_aperture_acquire_for_platform_device(struct platform_device *pdev,
247283f862SThomas Zimmermann 							    resource_size_t base,
257283f862SThomas Zimmermann 							    resource_size_t size)
267283f862SThomas Zimmermann {
277283f862SThomas Zimmermann 	return 0;
287283f862SThomas Zimmermann }
297283f862SThomas Zimmermann 
aperture_remove_conflicting_devices(resource_size_t base,resource_size_t size,const char * name)307283f862SThomas Zimmermann static inline int aperture_remove_conflicting_devices(resource_size_t base, resource_size_t size,
315fbcc670SDaniel Vetter 						      const char *name)
327283f862SThomas Zimmermann {
337283f862SThomas Zimmermann 	return 0;
347283f862SThomas Zimmermann }
357283f862SThomas Zimmermann 
__aperture_remove_legacy_vga_devices(struct pci_dev * pdev)36*116b1c5aSThomas Zimmermann static inline int __aperture_remove_legacy_vga_devices(struct pci_dev *pdev)
37*116b1c5aSThomas Zimmermann {
38*116b1c5aSThomas Zimmermann 	return 0;
39*116b1c5aSThomas Zimmermann }
40*116b1c5aSThomas Zimmermann 
aperture_remove_conflicting_pci_devices(struct pci_dev * pdev,const char * name)417283f862SThomas Zimmermann static inline int aperture_remove_conflicting_pci_devices(struct pci_dev *pdev, const char *name)
427283f862SThomas Zimmermann {
437283f862SThomas Zimmermann 	return 0;
447283f862SThomas Zimmermann }
457283f862SThomas Zimmermann #endif
467283f862SThomas Zimmermann 
477283f862SThomas Zimmermann /**
487283f862SThomas Zimmermann  * aperture_remove_all_conflicting_devices - remove all existing framebuffers
497283f862SThomas Zimmermann  * @name: a descriptive name of the requesting driver
507283f862SThomas Zimmermann  *
517283f862SThomas Zimmermann  * This function removes all graphics device drivers. Use this function on systems
527283f862SThomas Zimmermann  * that can have their framebuffer located anywhere in memory.
537283f862SThomas Zimmermann  *
547283f862SThomas Zimmermann  * Returns:
557283f862SThomas Zimmermann  * 0 on success, or a negative errno code otherwise
567283f862SThomas Zimmermann  */
aperture_remove_all_conflicting_devices(const char * name)575fbcc670SDaniel Vetter static inline int aperture_remove_all_conflicting_devices(const char *name)
587283f862SThomas Zimmermann {
595fbcc670SDaniel Vetter 	return aperture_remove_conflicting_devices(0, (resource_size_t)-1, name);
607283f862SThomas Zimmermann }
617283f862SThomas Zimmermann 
627283f862SThomas Zimmermann #endif
63