summaryrefslogtreecommitdiff
path: root/drivers/video/fbdev/efifb.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/video/fbdev/efifb.c')
-rw-r--r--drivers/video/fbdev/efifb.c97
1 files changed, 5 insertions, 92 deletions
diff --git a/drivers/video/fbdev/efifb.c b/drivers/video/fbdev/efifb.c
index 10fc14ad5d12..8dd82afb3452 100644
--- a/drivers/video/fbdev/efifb.c
+++ b/drivers/video/fbdev/efifb.c
@@ -13,11 +13,9 @@
#include <linux/efi-bgrt.h>
#include <linux/errno.h>
#include <linux/fb.h>
-#include <linux/pci.h>
#include <linux/platform_device.h>
#include <linux/printk.h>
#include <linux/screen_info.h>
-#include <linux/pm_runtime.h>
#include <video/vga.h>
#include <asm/efi.h>
#include <drm/drm_utils.h> /* For drm_get_panel_orientation_quirk */
@@ -48,8 +46,6 @@ static bool use_bgrt = true;
static bool request_mem_succeeded = false;
static u64 mem_flags = EFI_MEMORY_WC | EFI_MEMORY_UC;
-static struct pci_dev *efifb_pci_dev; /* dev with BAR covering the efifb */
-
struct efifb_par {
u32 pseudo_palette[16];
resource_size_t base;
@@ -258,9 +254,6 @@ static void efifb_destroy(struct fb_info *info)
{
struct efifb_par *par = info->par;
- if (efifb_pci_dev)
- pm_runtime_put(&efifb_pci_dev->dev);
-
if (info->screen_base) {
if (mem_flags & (EFI_MEMORY_UC | EFI_MEMORY_WC))
iounmap(info->screen_base);
@@ -352,11 +345,6 @@ static struct attribute *efifb_attrs[] = {
};
ATTRIBUTE_GROUPS(efifb);
-static bool pci_dev_disabled; /* FB base matches BAR of a disabled device */
-
-static struct resource *bar_resource;
-static u64 bar_offset;
-
static int efifb_probe(struct platform_device *dev)
{
struct screen_info *si;
@@ -381,7 +369,7 @@ static int efifb_probe(struct platform_device *dev)
if (!si)
return -ENOMEM;
- if (si->orig_video_isVGA != VIDEO_TYPE_EFI || pci_dev_disabled)
+ if (si->orig_video_isVGA != VIDEO_TYPE_EFI)
return -ENODEV;
if (fb_get_options("efifb", &option))
@@ -417,21 +405,7 @@ static int efifb_probe(struct platform_device *dev)
si->rsvd_pos = 24;
}
- efifb_fix.smem_start = si->lfb_base;
-
- if (si->capabilities & VIDEO_CAPABILITY_64BIT_BASE) {
- u64 ext_lfb_base;
-
- ext_lfb_base = (u64)(unsigned long)si->ext_lfb_base << 32;
- efifb_fix.smem_start |= ext_lfb_base;
- }
-
- if (bar_resource &&
- bar_resource->start + bar_offset != efifb_fix.smem_start) {
- dev_info(&efifb_pci_dev->dev,
- "BAR has moved, updating efifb address\n");
- efifb_fix.smem_start = bar_resource->start + bar_offset;
- }
+ efifb_fix.smem_start = __screen_info_lfb_base(si);
efifb_defined.bits_per_pixel = si->lfb_depth;
efifb_defined.xres = si->lfb_width;
@@ -598,26 +572,20 @@ static int efifb_probe(struct platform_device *dev)
goto err_groups;
}
- if (efifb_pci_dev)
- WARN_ON(pm_runtime_get_sync(&efifb_pci_dev->dev) < 0);
-
err = devm_aperture_acquire_for_platform_device(dev, par->base, par->size);
if (err) {
pr_err("efifb: cannot acquire aperture\n");
- goto err_put_rpm_ref;
+ goto err_fb_dealloc_cmap;
}
err = register_framebuffer(info);
if (err < 0) {
pr_err("efifb: cannot register framebuffer\n");
- goto err_put_rpm_ref;
+ goto err_fb_dealloc_cmap;
}
fb_info(info, "%s frame buffer device\n", info->fix.id);
return 0;
-err_put_rpm_ref:
- if (efifb_pci_dev)
- pm_runtime_put(&efifb_pci_dev->dev);
-
+err_fb_dealloc_cmap:
fb_dealloc_cmap(&info->cmap);
err_groups:
sysfs_remove_groups(&dev->dev.kobj, efifb_groups);
@@ -652,58 +620,3 @@ static struct platform_driver efifb_driver = {
};
builtin_platform_driver(efifb_driver);
-
-#if defined(CONFIG_PCI)
-
-static void record_efifb_bar_resource(struct pci_dev *dev, int idx, u64 offset)
-{
- u16 word;
-
- efifb_pci_dev = dev;
-
- pci_read_config_word(dev, PCI_COMMAND, &word);
- if (!(word & PCI_COMMAND_MEMORY)) {
- pci_dev_disabled = true;
- dev_err(&dev->dev,
- "BAR %d: assigned to efifb but device is disabled!\n",
- idx);
- return;
- }
-
- bar_resource = &dev->resource[idx];
- bar_offset = offset;
-
- dev_info(&dev->dev, "BAR %d: assigned to efifb\n", idx);
-}
-
-static void efifb_fixup_resources(struct pci_dev *dev)
-{
- u64 base = screen_info.lfb_base;
- u64 size = screen_info.lfb_size;
- int i;
-
- if (efifb_pci_dev || screen_info.orig_video_isVGA != VIDEO_TYPE_EFI)
- return;
-
- if (screen_info.capabilities & VIDEO_CAPABILITY_64BIT_BASE)
- base |= (u64)screen_info.ext_lfb_base << 32;
-
- if (!base)
- return;
-
- for (i = 0; i < PCI_STD_NUM_BARS; i++) {
- struct resource *res = &dev->resource[i];
-
- if (!(res->flags & IORESOURCE_MEM))
- continue;
-
- if (res->start <= base && res->end >= base + size - 1) {
- record_efifb_bar_resource(dev, i, base - res->start);
- break;
- }
- }
-}
-DECLARE_PCI_FIXUP_CLASS_HEADER(PCI_ANY_ID, PCI_ANY_ID, PCI_BASE_CLASS_DISPLAY,
- 16, efifb_fixup_resources);
-
-#endif