mirror of
https://src.fedoraproject.org/rpms/grub2.git
synced 2024-11-28 07:44:52 +00:00
48 lines
1.7 KiB
Diff
48 lines
1.7 KiB
Diff
|
From a537d6501871c17a7e09289ab86aeda122138a91 Mon Sep 17 00:00:00 2001
|
||
|
From: "mike.travis@hpe.com" <mike.travis@hpe.com>
|
||
|
Date: Wed, 28 Mar 2018 11:42:18 -0500
|
||
|
Subject: [PATCH] efi/uga: Fix PCIe LER when GRUB2 accesses non-enabled MMIO
|
||
|
data from VGA
|
||
|
|
||
|
A GPU inserted into a PCIe I/O slot disappears during system startup.
|
||
|
The problem centers around GRUB and a specific VGA init function in
|
||
|
efi_uga.c. This causes an LER (Link Error Recorvery) because the MMIO
|
||
|
memory has not been enabled before attempting access.
|
||
|
|
||
|
The fix is to add the same coding used in other VGA drivers, specifically
|
||
|
to add a check to insure that it is indeed a VGA controller. And then
|
||
|
enable the MMIO address space with the specific bits.
|
||
|
|
||
|
Signed-off-by: Mike Travis <mike.travis@hpe.com>
|
||
|
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
|
||
|
---
|
||
|
grub-core/video/efi_uga.c | 13 +++++++++++--
|
||
|
1 file changed, 11 insertions(+), 2 deletions(-)
|
||
|
|
||
|
diff --git a/grub-core/video/efi_uga.c b/grub-core/video/efi_uga.c
|
||
|
index 464ede874da..044af1d20d3 100644
|
||
|
--- a/grub-core/video/efi_uga.c
|
||
|
+++ b/grub-core/video/efi_uga.c
|
||
|
@@ -94,10 +94,19 @@ static int
|
||
|
find_card (grub_pci_device_t dev, grub_pci_id_t pciid, void *data)
|
||
|
{
|
||
|
struct find_framebuf_ctx *ctx = data;
|
||
|
- grub_pci_address_t addr;
|
||
|
+ grub_pci_address_t addr, rcaddr;
|
||
|
+ grub_uint32_t subclass;
|
||
|
|
||
|
addr = grub_pci_make_address (dev, GRUB_PCI_REG_CLASS);
|
||
|
- if (grub_pci_read (addr) >> 24 == 0x3)
|
||
|
+ subclass = (grub_pci_read (addr) >> 16) & 0xffff;
|
||
|
+
|
||
|
+ if (subclass != GRUB_PCI_CLASS_SUBCLASS_VGA)
|
||
|
+ return 0;
|
||
|
+
|
||
|
+ /* Enable MEM address spaces */
|
||
|
+ rcaddr = grub_pci_make_address (dev, GRUB_PCI_REG_COMMAND);
|
||
|
+ grub_pci_write_word (rcaddr, grub_pci_read_word (rcaddr) | GRUB_PCI_COMMAND_MEM_ENABLED);
|
||
|
+
|
||
|
{
|
||
|
int i;
|
||
|
|