blob: 7096703c3949348710f8b4c3afbc13541c4f65c2 [file] [log] [blame]
Thomas Zimmermann29160592021-04-12 15:10:41 +02001/* SPDX-License-Identifier: MIT */
2
3#ifndef _DRM_APERTURE_H_
4#define _DRM_APERTURE_H_
5
6#include <linux/types.h>
7
Thomas Zimmermann730e7992021-04-30 12:58:34 +02008struct drm_device;
Thomas Zimmermann97c9bfe2021-06-29 15:58:33 +02009struct drm_driver;
Thomas Zimmermann29160592021-04-12 15:10:41 +020010struct pci_dev;
11
Thomas Zimmermann730e7992021-04-30 12:58:34 +020012int devm_aperture_acquire_from_firmware(struct drm_device *dev, resource_size_t base,
13 resource_size_t size);
14
Thomas Zimmermann29160592021-04-12 15:10:41 +020015int drm_aperture_remove_conflicting_framebuffers(resource_size_t base, resource_size_t size,
Thomas Zimmermann97c9bfe2021-06-29 15:58:33 +020016 bool primary, const struct drm_driver *req_driver);
Thomas Zimmermann29160592021-04-12 15:10:41 +020017
Thomas Zimmermann97c9bfe2021-06-29 15:58:33 +020018int drm_aperture_remove_conflicting_pci_framebuffers(struct pci_dev *pdev,
19 const struct drm_driver *req_driver);
Thomas Zimmermann29160592021-04-12 15:10:41 +020020
21/**
22 * drm_aperture_remove_framebuffers - remove all existing framebuffers
23 * @primary: also kick vga16fb if present
Thomas Zimmermann97c9bfe2021-06-29 15:58:33 +020024 * @req_driver: requesting DRM driver
Thomas Zimmermann29160592021-04-12 15:10:41 +020025 *
26 * This function removes all graphics device drivers. Use this function on systems
27 * that can have their framebuffer located anywhere in memory.
28 *
29 * Returns:
30 * 0 on success, or a negative errno code otherwise
31 */
Thomas Zimmermann97c9bfe2021-06-29 15:58:33 +020032static inline int
33drm_aperture_remove_framebuffers(bool primary, const struct drm_driver *req_driver)
Thomas Zimmermann29160592021-04-12 15:10:41 +020034{
Thomas Zimmermann97c9bfe2021-06-29 15:58:33 +020035 return drm_aperture_remove_conflicting_framebuffers(0, (resource_size_t)-1, primary,
36 req_driver);
Thomas Zimmermann29160592021-04-12 15:10:41 +020037}
38
39#endif