mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-12-28 16:56:26 +00:00
116b1c5a36
The hardware for gma500 is different from the rest, as it uses stolen framebuffer memory that is not available via PCI BAR. The regular PCI removal helper cannot detect the framebuffer, while the non-PCI helper misses possible conflicting VGA devices (i.e., a framebuffer or text console). Gma500 therefore calls both helpers to catch all cases. It's confusing as it implies that there's something about the PCI device that requires ownership management. The relationship between the PCI device and the VGA devices is non-obvious. At worst, readers might assume that calling two functions for clearing aperture ownership is a bug in the driver. Hence, move the PCI removal helper's code for VGA functionality into a separate function and call this function from gma500. Documents the purpose of each call to aperture helpers. The change contains comments and example code form the discussion at [1]. v5: * fix grammar in gma500 comment (Javier) Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de> Link: https://patchwork.kernel.org/project/dri-devel/patch/20230404201842.567344-1-daniel.vetter@ffwll.ch/ # 1 Reviewed-by: Javier Martinez Canillas <javierm@redhat.com> Link: https://patchwork.freedesktop.org/patch/msgid/20230406132109.32050-10-tzimmermann@suse.de
63 lines
1.6 KiB
C
63 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,
|
|
const char *name);
|
|
|
|
int __aperture_remove_legacy_vga_devices(struct pci_dev *pdev);
|
|
|
|
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,
|
|
const char *name)
|
|
{
|
|
return 0;
|
|
}
|
|
|
|
static inline int __aperture_remove_legacy_vga_devices(struct pci_dev *pdev)
|
|
{
|
|
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
|
|
* @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(const char *name)
|
|
{
|
|
return aperture_remove_conflicting_devices(0, (resource_size_t)-1, name);
|
|
}
|
|
|
|
#endif
|