Patchwork [seabios,3/5] acpi: update pci io windows according to fw_cfg info

login
register
mail settings
Submitter Gerd Hoffmann
Date May 4, 2012, 8:21 a.m.
Message ID <1336119687-6295-4-git-send-email-kraxel@redhat.com>
Download mbox | patch
Permalink /patch/156816/
State New
Headers show

Comments

Gerd Hoffmann - May 4, 2012, 8:21 a.m.
This patch makes the pci ressources runtime configurable.  The patch
fetches the pci window information from the qemu firmware config
interface and in case valid data is found there the ressource entries
are updated accordingly.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
 src/acpi-dsdt.dsl |   38 +++++++++++++++++++++++++++++++++++---
 1 files changed, 35 insertions(+), 3 deletions(-)

Patch

diff --git a/src/acpi-dsdt.dsl b/src/acpi-dsdt.dsl
index d71b783..4e6c2ad 100644
--- a/src/acpi-dsdt.dsl
+++ b/src/acpi-dsdt.dsl
@@ -132,7 +132,7 @@  DefinitionBlock (
                 B0EJ, 32,
             }
 
-            Name (_CRS, ResourceTemplate ()
+            Name (CRES, ResourceTemplate ()
             {
                 WordBusNumber (ResourceProducer, MinFixed, MaxFixed, PosDecode,
                     0x0000,             // Address Space Granularity
@@ -174,15 +174,47 @@  DefinitionBlock (
                     0xFEBFFFFF,         // Address Range Maximum
                     0x00000000,         // Address Translation Offset
                     0x1EC00000,         // Address Length
-                    ,, , AddressRangeMemory, TypeStatic)
+                    ,, PW32, AddressRangeMemory, TypeStatic)
                 QWordMemory (ResourceProducer, PosDecode, MinFixed, MaxFixed, Cacheable, ReadWrite,
                     0x00000000,          // Address Space Granularity
                     0x8000000000,        // Address Range Minimum
                     0xFFFFFFFFFF,        // Address Range Maximum
                     0x00000000,          // Address Translation Offset
                     0x8000000000,        // Address Length
-                    ,, , AddressRangeMemory, TypeStatic)
+                    ,, PW64, AddressRangeMemory, TypeStatic)
             })
+            Method (_INI, 0)
+            {
+		Store (\_SB.PCI0.ISA.FWC.FWCB(0x1a, 64), Local0)
+		CreateQWordField (Local0,  0, QW0)
+		CreateQWordField (Local0,  8, QW1)
+		CreateQWordField (Local0, 16, QW2)
+		CreateQWordField (Local0, 24, QW3)
+
+		/* 32bit pci io window */
+		If (LAnd (LNotEqual(QW0, 0), LNotEqual(QW1, 0))) {
+		    CreateDWordField (CRES,\_SB.PCI0.PW32._MIN, PS32)
+		    CreateDWordField (CRES,\_SB.PCI0.PW32._MAX, PE32)
+		    CreateDWordField (CRES,\_SB.PCI0.PW32._LEN, PL32)
+		    Store (QW0, PS32)
+		    Store (QW1, PE32)
+		    Subtract (QW1, QW0, PL32)
+		}
+
+		/* 64bit pci io window */
+		If (LAnd (LNotEqual(QW2, 0), LNotEqual(QW3, 0))) {
+		    CreateQWordField (CRES,\_SB.PCI0.PW64._MIN, PS64)
+		    CreateQWordField (CRES,\_SB.PCI0.PW64._MAX, PE64)
+		    CreateQWordField (CRES,\_SB.PCI0.PW64._LEN, PL64)
+		    Store (QW2, PS64)
+		    Store (QW3, PE64)
+		    Subtract (QW3, QW2, PL64)
+		}
+	    }
+            Method (_CRS, 0)
+            {
+	        Return (CRES)
+	    }
         }
     }