[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] [xen stable-4.4] hvmloader: don't treat ROM BAR like other BARs



commit 1af109570552b4f7b2aaa3a335b447c50ebb676c
Author:     Jan Beulich <jbeulich@xxxxxxxx>
AuthorDate: Tue Apr 21 09:20:34 2015 +0200
Commit:     Jan Beulich <jbeulich@xxxxxxxx>
CommitDate: Tue Apr 21 09:20:34 2015 +0200

    hvmloader: don't treat ROM BAR like other BARs
    
    Its low 11 bits have different meaning.
    
    Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx>
    Reviewed-by: Konrad Rzeszutek Wilk <konrad.wilk@xxxxxxxxxx>
    Acked-by: Ian Campbell <ian.campbell@xxxxxxxxxx>
    Reviewed-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
    master commit: 73aa7fc2926c5ae30d8ebd049beadbb48e24d6c6
    master date: 2015-03-26 11:17:51 +0100
---
 tools/firmware/hvmloader/pci.c |   36 +++++++++++++++++++++++++-----------
 1 files changed, 25 insertions(+), 11 deletions(-)

diff --git a/tools/firmware/hvmloader/pci.c b/tools/firmware/hvmloader/pci.c
index 627e8cb..460f183 100644
--- a/tools/firmware/hvmloader/pci.c
+++ b/tools/firmware/hvmloader/pci.c
@@ -172,18 +172,31 @@ void pci_setup(void)
                 bar_reg = PCI_ROM_ADDRESS;
 
             bar_data = pci_readl(devfn, bar_reg);
-            is_64bar = !!((bar_data & (PCI_BASE_ADDRESS_SPACE |
-                         PCI_BASE_ADDRESS_MEM_TYPE_MASK)) ==
-                         (PCI_BASE_ADDRESS_SPACE_MEMORY |
-                         PCI_BASE_ADDRESS_MEM_TYPE_64));
-            pci_writel(devfn, bar_reg, ~0);
+            if ( bar_reg != PCI_ROM_ADDRESS )
+            {
+                is_64bar = !!((bar_data & (PCI_BASE_ADDRESS_SPACE |
+                             PCI_BASE_ADDRESS_MEM_TYPE_MASK)) ==
+                             (PCI_BASE_ADDRESS_SPACE_MEMORY |
+                             PCI_BASE_ADDRESS_MEM_TYPE_64));
+                pci_writel(devfn, bar_reg, ~0);
+            }
+            else
+            {
+                is_64bar = 0;
+                pci_writel(devfn, bar_reg,
+                           (bar_data | PCI_ROM_ADDRESS_MASK) &
+                           ~PCI_ROM_ADDRESS_ENABLE);
+            }
             bar_sz = pci_readl(devfn, bar_reg);
             pci_writel(devfn, bar_reg, bar_data);
 
-            bar_sz &= (((bar_data & PCI_BASE_ADDRESS_SPACE) ==
-                        PCI_BASE_ADDRESS_SPACE_MEMORY) ?
-                       PCI_BASE_ADDRESS_MEM_MASK :
-                       (PCI_BASE_ADDRESS_IO_MASK & 0xffff));
+            if ( bar_reg != PCI_ROM_ADDRESS )
+                bar_sz &= (((bar_data & PCI_BASE_ADDRESS_SPACE) ==
+                            PCI_BASE_ADDRESS_SPACE_MEMORY) ?
+                           PCI_BASE_ADDRESS_MEM_MASK :
+                           (PCI_BASE_ADDRESS_IO_MASK & 0xffff));
+            else
+                bar_sz &= PCI_ROM_ADDRESS_MASK;
             if (is_64bar) {
                 bar_data_upper = pci_readl(devfn, bar_reg + 4);
                 pci_writel(devfn, bar_reg + 4, ~0);
@@ -207,8 +220,9 @@ void pci_setup(void)
             bars[i].bar_reg = bar_reg;
             bars[i].bar_sz  = bar_sz;
 
-            if ( (bar_data & PCI_BASE_ADDRESS_SPACE) ==
-                 PCI_BASE_ADDRESS_SPACE_MEMORY )
+            if ( ((bar_data & PCI_BASE_ADDRESS_SPACE) ==
+                  PCI_BASE_ADDRESS_SPACE_MEMORY) ||
+                 (bar_reg == PCI_ROM_ADDRESS) )
                 mmio_total += bar_sz;
 
             nr_bars++;
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.4

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.