mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-12-21 10:05:00 +08:00
7283f862bd
Implement DRM's aperture helpers under video/ for sharing with other sub-systems. Remove DRM-isms from the interface. The helpers track the ownership of framebuffer apertures and provide hand-over from firmware, such as EFI and VESA, to native graphics drivers. Other subsystems, such as fbdev and vfio, also have to maintain ownership of framebuffer apertures. Moving DRM's aperture helpers to a more public location allows all subsystems to interact with each other and share a common implementation. The aperture helpers are selected by the various firmware drivers within DRM and fbdev, and the VGA text-console driver. The original DRM interface is kept in place for use by DRM drivers. v3: * prefix all interfaces with aperture_ (Javier) * rework and simplify documentation (Javier) * rename struct dev_aperture to struct aperture_range * rebase onto latest DRM * update MAINTAINERS entry Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de> Reviewed-by: Javier Martinez Canillas <javierm@redhat.com> Tested-by: Laszlo Ersek <lersek@redhat.com> Link: https://patchwork.freedesktop.org/patch/msgid/20220622140134.12763-3-tzimmermann@suse.de
57 lines
1.6 KiB
C
57 lines
1.6 KiB
C
/* SPDX-License-Identifier: MIT */
|
|
|
|
#ifndef _LINUX_APERTURE_H_
|
|
#define _LINUX_APERTURE_H_
|
|
|
|
#include <linux/types.h>
|
|
|
|
struct pci_dev;
|
|
struct platform_device;
|
|
|
|
#if defined(CONFIG_APERTURE_HELPERS)
|
|
int devm_aperture_acquire_for_platform_device(struct platform_device *pdev,
|
|
resource_size_t base,
|
|
resource_size_t size);
|
|
|
|
int aperture_remove_conflicting_devices(resource_size_t base, resource_size_t size,
|
|
bool primary, const char *name);
|
|
|
|
int aperture_remove_conflicting_pci_devices(struct pci_dev *pdev, const char *name);
|
|
#else
|
|
static inline int devm_aperture_acquire_for_platform_device(struct platform_device *pdev,
|
|
resource_size_t base,
|
|
resource_size_t size)
|
|
{
|
|
return 0;
|
|
}
|
|
|
|
static inline int aperture_remove_conflicting_devices(resource_size_t base, resource_size_t size,
|
|
bool primary, const char *name)
|
|
{
|
|
return 0;
|
|
}
|
|
|
|
static inline int aperture_remove_conflicting_pci_devices(struct pci_dev *pdev, const char *name)
|
|
{
|
|
return 0;
|
|
}
|
|
#endif
|
|
|
|
/**
|
|
* aperture_remove_all_conflicting_devices - remove all existing framebuffers
|
|
* @primary: also kick vga16fb if present; only relevant for VGA devices
|
|
* @name: a descriptive name of the requesting driver
|
|
*
|
|
* This function removes all graphics device drivers. Use this function on systems
|
|
* that can have their framebuffer located anywhere in memory.
|
|
*
|
|
* Returns:
|
|
* 0 on success, or a negative errno code otherwise
|
|
*/
|
|
static inline int aperture_remove_all_conflicting_devices(bool primary, const char *name)
|
|
{
|
|
return aperture_remove_conflicting_devices(0, (resource_size_t)-1, primary, name);
|
|
}
|
|
|
|
#endif
|