Skip to content

Commit 8084a5b

Browse files
committed
fbdev/efifb: Remove framebuffer relocation tracking
If the firmware framebuffer has been reloacted, the sysfb code fixes the screen_info state before it creates the framebuffer's platform device. Efifb will automatically receive a screen_info with updated values. Hence remove the tracking from efifb. Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de> Reviewed-by: Javier Martinez Canillas <javierm@redhat.com> Acked-by: Sui Jingfeng <sui.jingfeng@linux.dev> Link: https://patchwork.freedesktop.org/patch/msgid/20240212090736.11464-9-tzimmermann@suse.de
1 parent 78aa89d commit 8084a5b

1 file changed

Lines changed: 1 addition & 75 deletions

File tree

drivers/video/fbdev/efifb.c

Lines changed: 1 addition & 75 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
#include <linux/efi-bgrt.h>
1414
#include <linux/errno.h>
1515
#include <linux/fb.h>
16-
#include <linux/pci.h>
1716
#include <linux/platform_device.h>
1817
#include <linux/printk.h>
1918
#include <linux/screen_info.h>
@@ -47,8 +46,6 @@ static bool use_bgrt = true;
4746
static bool request_mem_succeeded = false;
4847
static u64 mem_flags = EFI_MEMORY_WC | EFI_MEMORY_UC;
4948

50-
static struct pci_dev *efifb_pci_dev; /* dev with BAR covering the efifb */
51-
5249
struct efifb_par {
5350
u32 pseudo_palette[16];
5451
resource_size_t base;
@@ -348,9 +345,6 @@ static struct attribute *efifb_attrs[] = {
348345
};
349346
ATTRIBUTE_GROUPS(efifb);
350347

351-
static struct resource *bar_resource;
352-
static u64 bar_offset;
353-
354348
static int efifb_probe(struct platform_device *dev)
355349
{
356350
struct screen_info *si;
@@ -411,21 +405,7 @@ static int efifb_probe(struct platform_device *dev)
411405
si->rsvd_pos = 24;
412406
}
413407

414-
efifb_fix.smem_start = si->lfb_base;
415-
416-
if (si->capabilities & VIDEO_CAPABILITY_64BIT_BASE) {
417-
u64 ext_lfb_base;
418-
419-
ext_lfb_base = (u64)(unsigned long)si->ext_lfb_base << 32;
420-
efifb_fix.smem_start |= ext_lfb_base;
421-
}
422-
423-
if (bar_resource &&
424-
bar_resource->start + bar_offset != efifb_fix.smem_start) {
425-
dev_info(&efifb_pci_dev->dev,
426-
"BAR has moved, updating efifb address\n");
427-
efifb_fix.smem_start = bar_resource->start + bar_offset;
428-
}
408+
efifb_fix.smem_start = __screen_info_lfb_base(si);
429409

430410
efifb_defined.bits_per_pixel = si->lfb_depth;
431411
efifb_defined.xres = si->lfb_width;
@@ -640,57 +620,3 @@ static struct platform_driver efifb_driver = {
640620
};
641621

642622
builtin_platform_driver(efifb_driver);
643-
644-
#if defined(CONFIG_PCI)
645-
646-
static void record_efifb_bar_resource(struct pci_dev *dev, int idx, u64 offset)
647-
{
648-
u16 word;
649-
650-
efifb_pci_dev = dev;
651-
652-
pci_read_config_word(dev, PCI_COMMAND, &word);
653-
if (!(word & PCI_COMMAND_MEMORY)) {
654-
dev_err(&dev->dev,
655-
"BAR %d: assigned to efifb but device is disabled!\n",
656-
idx);
657-
return;
658-
}
659-
660-
bar_resource = &dev->resource[idx];
661-
bar_offset = offset;
662-
663-
dev_info(&dev->dev, "BAR %d: assigned to efifb\n", idx);
664-
}
665-
666-
static void efifb_fixup_resources(struct pci_dev *dev)
667-
{
668-
u64 base = screen_info.lfb_base;
669-
u64 size = screen_info.lfb_size;
670-
int i;
671-
672-
if (efifb_pci_dev || screen_info.orig_video_isVGA != VIDEO_TYPE_EFI)
673-
return;
674-
675-
if (screen_info.capabilities & VIDEO_CAPABILITY_64BIT_BASE)
676-
base |= (u64)screen_info.ext_lfb_base << 32;
677-
678-
if (!base)
679-
return;
680-
681-
for (i = 0; i < PCI_STD_NUM_BARS; i++) {
682-
struct resource *res = &dev->resource[i];
683-
684-
if (!(res->flags & IORESOURCE_MEM))
685-
continue;
686-
687-
if (res->start <= base && res->end >= base + size - 1) {
688-
record_efifb_bar_resource(dev, i, base - res->start);
689-
break;
690-
}
691-
}
692-
}
693-
DECLARE_PCI_FIXUP_CLASS_HEADER(PCI_ANY_ID, PCI_ANY_ID, PCI_BASE_CLASS_DISPLAY,
694-
16, efifb_fixup_resources);
695-
696-
#endif

0 commit comments

Comments
 (0)