|
13 | 13 | #include <linux/efi-bgrt.h> |
14 | 14 | #include <linux/errno.h> |
15 | 15 | #include <linux/fb.h> |
16 | | -#include <linux/pci.h> |
17 | 16 | #include <linux/platform_device.h> |
18 | 17 | #include <linux/printk.h> |
19 | 18 | #include <linux/screen_info.h> |
@@ -47,8 +46,6 @@ static bool use_bgrt = true; |
47 | 46 | static bool request_mem_succeeded = false; |
48 | 47 | static u64 mem_flags = EFI_MEMORY_WC | EFI_MEMORY_UC; |
49 | 48 |
|
50 | | -static struct pci_dev *efifb_pci_dev; /* dev with BAR covering the efifb */ |
51 | | - |
52 | 49 | struct efifb_par { |
53 | 50 | u32 pseudo_palette[16]; |
54 | 51 | resource_size_t base; |
@@ -348,9 +345,6 @@ static struct attribute *efifb_attrs[] = { |
348 | 345 | }; |
349 | 346 | ATTRIBUTE_GROUPS(efifb); |
350 | 347 |
|
351 | | -static struct resource *bar_resource; |
352 | | -static u64 bar_offset; |
353 | | - |
354 | 348 | static int efifb_probe(struct platform_device *dev) |
355 | 349 | { |
356 | 350 | struct screen_info *si; |
@@ -411,21 +405,7 @@ static int efifb_probe(struct platform_device *dev) |
411 | 405 | si->rsvd_pos = 24; |
412 | 406 | } |
413 | 407 |
|
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); |
429 | 409 |
|
430 | 410 | efifb_defined.bits_per_pixel = si->lfb_depth; |
431 | 411 | efifb_defined.xres = si->lfb_width; |
@@ -640,57 +620,3 @@ static struct platform_driver efifb_driver = { |
640 | 620 | }; |
641 | 621 |
|
642 | 622 | 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