#include <drm/drm_probe_helper.h>
 #include <linux/mmu_notifier.h>
 #include <linux/suspend.h>
+#include <linux/fb.h>
 
 #include "amdgpu.h"
 #include "amdgpu_irq.h"
 
 static const struct drm_driver amdgpu_kms_driver;
 
+static bool amdgpu_is_fw_framebuffer(resource_size_t base,
+                                    resource_size_t size)
+{
+       bool found = false;
+#if IS_REACHABLE(CONFIG_FB)
+       struct apertures_struct *a;
+
+       a = alloc_apertures(1);
+       if (!a)
+               return false;
+
+       a->ranges[0].base = base;
+       a->ranges[0].size = size;
+
+       found = is_firmware_framebuffer(a);
+       kfree(a);
+#endif
+       return found;
+}
+
 static int amdgpu_pci_probe(struct pci_dev *pdev,
                            const struct pci_device_id *ent)
 {
        unsigned long flags = ent->driver_data;
        int ret, retry = 0;
        bool supports_atomic = false;
+       bool is_fw_fb;
+       resource_size_t base, size;
 
        if (amdgpu_virtual_display ||
            amdgpu_device_asic_has_dc_support(flags & AMD_ASIC_MASK))
        }
 #endif
 
+       base = pci_resource_start(pdev, 0);
+       size = pci_resource_len(pdev, 0);
+       is_fw_fb = amdgpu_is_fw_framebuffer(base, size);
+
        /* Get rid of things like offb */
        ret = drm_aperture_remove_conflicting_pci_framebuffers(pdev, &amdgpu_kms_driver);
        if (ret)
        adev->dev  = &pdev->dev;
        adev->pdev = pdev;
        ddev = adev_to_drm(adev);
+       adev->is_fw_fb = is_fw_fb;
 
        if (!supports_atomic)
                ddev->driver_features &= ~DRIVER_ATOMIC;