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