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 10struct pci_dev; 11struct platform_device; 12 13#if defined(CONFIG_APERTURE_HELPERS) 14int devm_aperture_acquire_for_platform_device(struct platform_device *pdev, 15 resource_size_t base, 16 resource_size_t size); 17 18int aperture_remove_conflicting_devices(resource_size_t base, resource_size_t size, 19 bool primary, const char *name); 20 21int aperture_remove_conflicting_pci_devices(struct pci_dev *pdev, const char *name); 22#else 23static inline int devm_aperture_acquire_for_platform_device(struct platform_device *pdev, 24 resource_size_t base, 25 resource_size_t size) 26{ 27 return 0; 28} 29 30static inline int aperture_remove_conflicting_devices(resource_size_t base, resource_size_t size, 31 bool primary, const char *name) 32{ 33 return 0; 34} 35 36static inline int aperture_remove_conflicting_pci_devices(struct pci_dev *pdev, const char *name) 37{ 38 return 0; 39} 40#endif 41 42/** 43 * aperture_remove_all_conflicting_devices - remove all existing framebuffers 44 * @primary: also kick vga16fb if present; only relevant for VGA devices 45 * @name: a descriptive name of the requesting driver 46 * 47 * This function removes all graphics device drivers. Use this function on systems 48 * that can have their framebuffer located anywhere in memory. 49 * 50 * Returns: 51 * 0 on success, or a negative errno code otherwise 52 */ 53static inline int aperture_remove_all_conflicting_devices(bool primary, const char *name) 54{ 55 return aperture_remove_conflicting_devices(0, (resource_size_t)-1, primary, name); 56} 57 58#endif 59