Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: MIT */
0002 
0003 #ifndef _LINUX_APERTURE_H_
0004 #define _LINUX_APERTURE_H_
0005 
0006 #include <linux/types.h>
0007 
0008 struct pci_dev;
0009 struct platform_device;
0010 
0011 #if defined(CONFIG_APERTURE_HELPERS)
0012 int devm_aperture_acquire_for_platform_device(struct platform_device *pdev,
0013                           resource_size_t base,
0014                           resource_size_t size);
0015 
0016 int aperture_remove_conflicting_devices(resource_size_t base, resource_size_t size,
0017                     bool primary, const char *name);
0018 
0019 int aperture_remove_conflicting_pci_devices(struct pci_dev *pdev, const char *name);
0020 #else
0021 static inline int devm_aperture_acquire_for_platform_device(struct platform_device *pdev,
0022                                 resource_size_t base,
0023                                 resource_size_t size)
0024 {
0025     return 0;
0026 }
0027 
0028 static inline int aperture_remove_conflicting_devices(resource_size_t base, resource_size_t size,
0029                               bool primary, const char *name)
0030 {
0031     return 0;
0032 }
0033 
0034 static inline int aperture_remove_conflicting_pci_devices(struct pci_dev *pdev, const char *name)
0035 {
0036     return 0;
0037 }
0038 #endif
0039 
0040 /**
0041  * aperture_remove_all_conflicting_devices - remove all existing framebuffers
0042  * @primary: also kick vga16fb if present; only relevant for VGA devices
0043  * @name: a descriptive name of the requesting driver
0044  *
0045  * This function removes all graphics device drivers. Use this function on systems
0046  * that can have their framebuffer located anywhere in memory.
0047  *
0048  * Returns:
0049  * 0 on success, or a negative errno code otherwise
0050  */
0051 static inline int aperture_remove_all_conflicting_devices(bool primary, const char *name)
0052 {
0053     return aperture_remove_conflicting_devices(0, (resource_size_t)-1, primary, name);
0054 }
0055 
0056 #endif