Based on SeaBIOS commit 2062f2ba by Gerd Hoffmann <[email protected]>.

Contributed-under: TianoCore Contribution Agreement 1.0

Signed-off-by: Laszlo Ersek <[email protected]>
---
 OvmfPkg/AcpiTables/Dsdt.asl |   89 +++++++++++++++++++++++++++++++++++++++++--
 1 files changed, 85 insertions(+), 4 deletions(-)

diff --git a/OvmfPkg/AcpiTables/Dsdt.asl b/OvmfPkg/AcpiTables/Dsdt.asl
index f7ae92b..5ce236d 100644
--- a/OvmfPkg/AcpiTables/Dsdt.asl
+++ b/OvmfPkg/AcpiTables/Dsdt.asl
@@ -36,7 +36,7 @@ DefinitionBlock ("Dsdt.aml", "DSDT", 1, "INTEL ", "OVMF    ", 
3) {
       //
       // BUS, I/O, and MMIO resources
       //
-      Name (_CRS, ResourceTemplate () {
+      Name (CRES, ResourceTemplate () {
         WORDBusNumber (          // Bus number resource (0); the bridge 
produces bus numbers for its subsequent buses
           ResourceProducer,      // bit 0 of general flags is 1
           MinFixed,              // Range is fixed
@@ -91,21 +91,102 @@ DefinitionBlock ("Dsdt.aml", "DSDT", 1, "INTEL ", "OVMF    
", 3) {
           0x00020000             // Range Length
           )
 
-        DWORDMEMORY (            // Descriptor for linear frame buffer video 
RAM
+        DWORDMEMORY (            // Descriptor for 32-bit MMIO
           ResourceProducer,      // bit 0 of general flags is 0
           PosDecode,
           MinFixed,              // Range is fixed
           MaxFixed,              // Range is Fixed
-          Cacheable,
+          NonCacheable,
           ReadWrite,
           0x00000000,            // Granularity
           0xF8000000,            // Min
           0xFFFBFFFF,            // Max
           0x00000000,            // Translation
-          0x07FC0000             // Range Length
+          0x07FC0000,            // Range Length
+          ,                      // ResourceSourceIndex
+          ,                      // ResourceSource
+          PW32                   // DescriptorName
           )
       })
 
+      Name (CR64, ResourceTemplate () {
+        QWordMemory (            // Descriptor for 64-bit MMIO
+            ResourceProducer,    // bit 0 of general flags is 0
+            PosDecode,
+            MinFixed,            // Range is fixed
+            MaxFixed,            // Range is Fixed
+            Cacheable,
+            ReadWrite,
+            0x00000000,          // Granularity
+            0x8000000000,        // Min
+            0xFFFFFFFFFF,        // Max
+            0x00000000,          // Translation
+            0x8000000000,        // Range Length
+            ,                    // ResourceSourceIndex
+            ,                    // ResourceSource
+            PW64                 // DescriptorName
+            )
+      })
+
+      Method (_CRS, 0) {
+        //
+        // see "OvmfPkg/AcpiPlatformDxe/Qemu.c", struct BFLD
+        //
+        External (BDAT, OpRegionObj)
+        Field(BDAT, QWordAcc, NoLock, Preserve) {
+          P0S, 64,
+          P0E, 64,
+          P0L, 64,
+          P1S, 64,
+          P1E, 64,
+          P1L, 64
+        }
+        Field(BDAT, DWordAcc, NoLock, Preserve) {
+          P0SL, 32,
+          P0SH, 32,
+          P0EL, 32,
+          P0EH, 32,
+          P0LL, 32,
+          P0LH, 32,
+          P1SL, 32,
+          P1SH, 32,
+          P1EL, 32,
+          P1EH, 32,
+          P1LL, 32,
+          P1LH, 32
+        }
+
+        //
+        // fixup 32-bit PCI IO window
+        //
+        CreateDWordField (CRES, \_SB.PCI0.PW32._MIN, PS32)
+        CreateDWordField (CRES, \_SB.PCI0.PW32._MAX, PE32)
+        CreateDWordField (CRES, \_SB.PCI0.PW32._LEN, PL32)
+        Store (P0SL, PS32)
+        Store (P0EL, PE32)
+        Store (P0LL, PL32)
+
+        If (LAnd (LEqual (P1SL, 0x00), LEqual (P1SH, 0x00))) {
+          Return (CRES)
+        } Else {
+          //
+          // fixup 64-bit PCI IO window
+          //
+          CreateQWordField (CR64, \_SB.PCI0.PW64._MIN, PS64)
+          CreateQWordField (CR64, \_SB.PCI0.PW64._MAX, PE64)
+          CreateQWordField (CR64, \_SB.PCI0.PW64._LEN, PL64)
+          Store (P1S, PS64)
+          Store (P1E, PE64)
+          Store (P1L, PL64)
+
+          //
+          // add window and return result
+          //
+          ConcatenateResTemplate (CRES, CR64, Local0)
+          Return (Local0)
+        }
+      }
+
       //
       // PCI Interrupt Routing Table - PIC Mode Only
       //
-- 
1.7.1


------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
edk2-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/edk2-devel

Reply via email to