Fix elf loader range checking
[qemu] / pc-bios / bios-pq / 0016-use-correct-mask-to-size-pci-option-rom-bar.patch
1 Subject: [PATCH] bios: Use the correct mask to size the PCI option ROM BAR
2 From:   Alex Williamson <alex.williamson@hp.com>
3
4 Bit 0 is the enable bit, which we not only don't want to set, but
5 it will stick and make us think it's an I/O port resource.
6
7 Signed-off-by: Alex Williamson <alex.williamson@hp.com>
8 Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
9 ---
10
11 diff --git a/bios/rombios32.c b/bios/rombios32.c
12 index d7e18e9..f861f81 100644
13 --- a/bios/rombios32.c
14 +++ b/bios/rombios32.c
15 @@ -985,11 +985,13 @@ static void pci_bios_init_device(PCIDevice *d)
16              int ofs;
17              uint32_t val, size ;
18  
19 -            if (i == PCI_ROM_SLOT)
20 +            if (i == PCI_ROM_SLOT) {
21                  ofs = 0x30;
22 -            else
23 +                pci_config_writel(d, ofs, 0xfffffffe);
24 +            } else {
25                  ofs = 0x10 + i * 4;
26 -            pci_config_writel(d, ofs, 0xffffffff);
27 +                pci_config_writel(d, ofs, 0xffffffff);
28 +            }
29              val = pci_config_readl(d, ofs);
30              if (val != 0) {
31                  size = (~(val & ~0xf)) + 1;
32
33