xref: /freebsd/sys/compat/linuxkpi/common/include/linux/aperture.h (revision c89d94ad5d95fd15e891b2723caae8a6104ee153)
111d79c47SEmmanuel Vadot /* SPDX-License-Identifier: MIT */
211d79c47SEmmanuel Vadot 
311d79c47SEmmanuel Vadot #ifndef _LINUX_APERTURE_H_
411d79c47SEmmanuel Vadot #define _LINUX_APERTURE_H_
511d79c47SEmmanuel Vadot 
611d79c47SEmmanuel Vadot #include <linux/types.h>
711d79c47SEmmanuel Vadot 
811d79c47SEmmanuel Vadot #define	CONFIG_APERTURE_HELPERS
911d79c47SEmmanuel Vadot 
1011d79c47SEmmanuel Vadot struct pci_dev;
1111d79c47SEmmanuel Vadot struct platform_device;
1211d79c47SEmmanuel Vadot 
1311d79c47SEmmanuel Vadot #if defined(CONFIG_APERTURE_HELPERS)
1411d79c47SEmmanuel Vadot int devm_aperture_acquire_for_platform_device(struct platform_device *pdev,
1511d79c47SEmmanuel Vadot 					      resource_size_t base,
1611d79c47SEmmanuel Vadot 					      resource_size_t size);
1711d79c47SEmmanuel Vadot 
1811d79c47SEmmanuel Vadot int aperture_remove_conflicting_devices(resource_size_t base, resource_size_t size,
19*c89d94adSVladimir Kondratyev 					const char *name);
20*c89d94adSVladimir Kondratyev 
21*c89d94adSVladimir Kondratyev int __aperture_remove_legacy_vga_devices(struct pci_dev *pdev);
2211d79c47SEmmanuel Vadot 
2311d79c47SEmmanuel Vadot int aperture_remove_conflicting_pci_devices(struct pci_dev *pdev, const char *name);
2411d79c47SEmmanuel Vadot #else
devm_aperture_acquire_for_platform_device(struct platform_device * pdev,resource_size_t base,resource_size_t size)2511d79c47SEmmanuel Vadot static inline int devm_aperture_acquire_for_platform_device(struct platform_device *pdev,
2611d79c47SEmmanuel Vadot 							    resource_size_t base,
2711d79c47SEmmanuel Vadot 							    resource_size_t size)
2811d79c47SEmmanuel Vadot {
2911d79c47SEmmanuel Vadot 	return 0;
3011d79c47SEmmanuel Vadot }
3111d79c47SEmmanuel Vadot 
aperture_remove_conflicting_devices(resource_size_t base,resource_size_t size,const char * name)3211d79c47SEmmanuel Vadot static inline int aperture_remove_conflicting_devices(resource_size_t base, resource_size_t size,
33*c89d94adSVladimir Kondratyev 						      const char *name)
34*c89d94adSVladimir Kondratyev {
35*c89d94adSVladimir Kondratyev 	return 0;
36*c89d94adSVladimir Kondratyev }
37*c89d94adSVladimir Kondratyev 
__aperture_remove_legacy_vga_devices(struct pci_dev * pdev)38*c89d94adSVladimir Kondratyev static inline int __aperture_remove_legacy_vga_devices(struct pci_dev *pdev)
3911d79c47SEmmanuel Vadot {
4011d79c47SEmmanuel Vadot 	return 0;
4111d79c47SEmmanuel Vadot }
4211d79c47SEmmanuel Vadot 
aperture_remove_conflicting_pci_devices(struct pci_dev * pdev,const char * name)4311d79c47SEmmanuel Vadot static inline int aperture_remove_conflicting_pci_devices(struct pci_dev *pdev, const char *name)
4411d79c47SEmmanuel Vadot {
4511d79c47SEmmanuel Vadot 	return 0;
4611d79c47SEmmanuel Vadot }
4711d79c47SEmmanuel Vadot #endif
4811d79c47SEmmanuel Vadot 
4911d79c47SEmmanuel Vadot /**
5011d79c47SEmmanuel Vadot  * aperture_remove_all_conflicting_devices - remove all existing framebuffers
5111d79c47SEmmanuel Vadot  * @name: a descriptive name of the requesting driver
5211d79c47SEmmanuel Vadot  *
5311d79c47SEmmanuel Vadot  * This function removes all graphics device drivers. Use this function on systems
5411d79c47SEmmanuel Vadot  * that can have their framebuffer located anywhere in memory.
5511d79c47SEmmanuel Vadot  *
5611d79c47SEmmanuel Vadot  * Returns:
5711d79c47SEmmanuel Vadot  * 0 on success, or a negative errno code otherwise
5811d79c47SEmmanuel Vadot  */
aperture_remove_all_conflicting_devices(const char * name)59*c89d94adSVladimir Kondratyev static inline int aperture_remove_all_conflicting_devices(const char *name)
6011d79c47SEmmanuel Vadot {
61*c89d94adSVladimir Kondratyev 	return aperture_remove_conflicting_devices(0, (resource_size_t)-1, name);
6211d79c47SEmmanuel Vadot }
6311d79c47SEmmanuel Vadot 
6411d79c47SEmmanuel Vadot #endif
65