]> git.proxmox.com Git - mirror_edk2.git/blobdiff - OvmfPkg/AcpiTables/Dsdt.asl
OvmfPkg: add qemu debug console port to XTRA device
[mirror_edk2.git] / OvmfPkg / AcpiTables / Dsdt.asl
old mode 100755 (executable)
new mode 100644 (file)
index 91ec944..2dda7ab
@@ -1,16 +1,16 @@
 /** @file\r
   Contains root level name space objects for the platform\r
-  \r
-  Copyright (c) 2008, Intel Corporation<BR> All rights\r
-  reserved. This program and the accompanying materials are\r
+\r
+  Copyright (c) 2008, Intel Corporation. All rights reserved.<BR>\r
+  This program and the accompanying materials are\r
   licensed and made available under the terms and conditions of the BSD License\r
   which accompanies this distribution.  The full text of the license may be found at\r
   http://opensource.org/licenses/bsd-license.php\r
-  \r
+\r
   THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
   WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
 \r
-**/ \r
+**/\r
 \r
 DefinitionBlock ("Dsdt.aml", "DSDT", 1, "INTEL ", "OVMF    ", 3) {\r
   //\r
@@ -36,7 +36,7 @@ DefinitionBlock ("Dsdt.aml", "DSDT", 1, "INTEL ", "OVMF    ", 3) {
       //\r
       // BUS, I/O, and MMIO resources\r
       //\r
-      Name (_CRS, ResourceTemplate () {\r
+      Name (CRES, ResourceTemplate () {\r
         WORDBusNumber (          // Bus number resource (0); the bridge produces bus numbers for its subsequent buses\r
           ResourceProducer,      // bit 0 of general flags is 1\r
           MinFixed,              // Range is fixed\r
@@ -55,7 +55,7 @@ DefinitionBlock ("Dsdt.aml", "DSDT", 1, "INTEL ", "OVMF    ", 3) {
           ResourceProducer,      // bit 0 of general flags is 0\r
           MinFixed,              // Range is fixed\r
           MaxFixed,              // Range is fixed\r
-          PosDecode,             \r
+          PosDecode,\r
           EntireRange,\r
           0x0000,                // Granularity\r
           0x0000,                // Min\r
@@ -68,7 +68,7 @@ DefinitionBlock ("Dsdt.aml", "DSDT", 1, "INTEL ", "OVMF    ", 3) {
           ResourceProducer,      // bit 0 of general flags is 0\r
           MinFixed,              // Range is fixed\r
           MaxFixed,              // Range is fixed\r
-          PosDecode,             \r
+          PosDecode,\r
           EntireRange,\r
           0x0000,                // Granularity\r
           0x0D00,                // Min\r
@@ -91,21 +91,102 @@ DefinitionBlock ("Dsdt.aml", "DSDT", 1, "INTEL ", "OVMF    ", 3) {
           0x00020000             // Range Length\r
           )\r
 \r
-        DWORDMEMORY (            // Descriptor for linear frame buffer video RAM\r
+        DWORDMEMORY (            // Descriptor for 32-bit MMIO\r
           ResourceProducer,      // bit 0 of general flags is 0\r
           PosDecode,\r
           MinFixed,              // Range is fixed\r
           MaxFixed,              // Range is Fixed\r
-          Cacheable,\r
+          NonCacheable,\r
           ReadWrite,\r
           0x00000000,            // Granularity\r
           0xF8000000,            // Min\r
           0xFFFBFFFF,            // Max\r
           0x00000000,            // Translation\r
-          0x07FC0000             // Range Length\r
+          0x07FC0000,            // Range Length\r
+          ,                      // ResourceSourceIndex\r
+          ,                      // ResourceSource\r
+          PW32                   // DescriptorName\r
           )\r
       })\r
 \r
+      Name (CR64, ResourceTemplate () {\r
+        QWordMemory (            // Descriptor for 64-bit MMIO\r
+            ResourceProducer,    // bit 0 of general flags is 0\r
+            PosDecode,\r
+            MinFixed,            // Range is fixed\r
+            MaxFixed,            // Range is Fixed\r
+            Cacheable,\r
+            ReadWrite,\r
+            0x00000000,          // Granularity\r
+            0x8000000000,        // Min\r
+            0xFFFFFFFFFF,        // Max\r
+            0x00000000,          // Translation\r
+            0x8000000000,        // Range Length\r
+            ,                    // ResourceSourceIndex\r
+            ,                    // ResourceSource\r
+            PW64                 // DescriptorName\r
+            )\r
+      })\r
+\r
+      Method (_CRS, 0) {\r
+        //\r
+        // see the FIRMWARE_DATA structure in "OvmfPkg/AcpiPlatformDxe/Qemu.c"\r
+        //\r
+        External (FWDT, OpRegionObj)\r
+        Field(FWDT, QWordAcc, NoLock, Preserve) {\r
+          P0S, 64,               // PciWindow32.Base\r
+          P0E, 64,               // PciWindow32.End\r
+          P0L, 64,               // PciWindow32.Length\r
+          P1S, 64,               // PciWindow64.Base\r
+          P1E, 64,               // PciWindow64.End\r
+          P1L, 64                // PciWindow64.Length\r
+        }\r
+        Field(FWDT, DWordAcc, NoLock, Preserve) {\r
+          P0SL, 32,              // PciWindow32.Base,   low  32 bits\r
+          P0SH, 32,              // PciWindow32.Base,   high 32 bits\r
+          P0EL, 32,              // PciWindow32.End,    low  32 bits\r
+          P0EH, 32,              // PciWindow32.End,    high 32 bits\r
+          P0LL, 32,              // PciWindow32.Length, low  32 bits\r
+          P0LH, 32,              // PciWindow32.Length, high 32 bits\r
+          P1SL, 32,              // PciWindow64.Base,   low  32 bits\r
+          P1SH, 32,              // PciWindow64.Base,   high 32 bits\r
+          P1EL, 32,              // PciWindow64.End,    low  32 bits\r
+          P1EH, 32,              // PciWindow64.End,    high 32 bits\r
+          P1LL, 32,              // PciWindow64.Length, low  32 bits\r
+          P1LH, 32               // PciWindow64.Length, high 32 bits\r
+        }\r
+\r
+        //\r
+        // fixup 32-bit PCI IO window\r
+        //\r
+        CreateDWordField (CRES, \_SB.PCI0.PW32._MIN, PS32)\r
+        CreateDWordField (CRES, \_SB.PCI0.PW32._MAX, PE32)\r
+        CreateDWordField (CRES, \_SB.PCI0.PW32._LEN, PL32)\r
+        Store (P0SL, PS32)\r
+        Store (P0EL, PE32)\r
+        Store (P0LL, PL32)\r
+\r
+        If (LAnd (LEqual (P1SL, 0x00), LEqual (P1SH, 0x00))) {\r
+          Return (CRES)\r
+        } Else {\r
+          //\r
+          // fixup 64-bit PCI IO window\r
+          //\r
+          CreateQWordField (CR64, \_SB.PCI0.PW64._MIN, PS64)\r
+          CreateQWordField (CR64, \_SB.PCI0.PW64._MAX, PE64)\r
+          CreateQWordField (CR64, \_SB.PCI0.PW64._LEN, PL64)\r
+          Store (P1S, PS64)\r
+          Store (P1E, PE64)\r
+          Store (P1L, PL64)\r
+\r
+          //\r
+          // add window and return result\r
+          //\r
+          ConcatenateResTemplate (CRES, CR64, Local0)\r
+          Return (Local0)\r
+        }\r
+      }\r
+\r
       //\r
       // PCI Interrupt Routing Table - PIC Mode Only\r
       //\r
@@ -186,7 +267,7 @@ DefinitionBlock ("Dsdt.aml", "DSDT", 1, "INTEL ", "OVMF    ", 3) {
           // Shift 1 by value in register 70\r
           //\r
           ShiftLeft (Local0, And (Arg0, 0x0F), IRQW)   // Save in buffer\r
-          Return (BUF0)                                // Return Buf0 \r
+          Return (BUF0)                                // Return Buf0\r
         }\r
 \r
         //\r
@@ -222,7 +303,7 @@ DefinitionBlock ("Dsdt.aml", "DSDT", 1, "INTEL ", "OVMF    ", 3) {
           Method (_DIS, 0, NotSerialized) { PDIS (PIRA)  }\r
           Method (_CRS, 0, NotSerialized) { Return (PCRS (PIRA)) }\r
           Method (_PRS, 0, NotSerialized) { Return (PPRS) }\r
-          Method (_SRS, 1, NotSerialized) { PSRS (PIRA, Arg0) } \r
+          Method (_SRS, 1, NotSerialized) { PSRS (PIRA, Arg0) }\r
         }\r
 \r
         //\r
@@ -236,7 +317,7 @@ DefinitionBlock ("Dsdt.aml", "DSDT", 1, "INTEL ", "OVMF    ", 3) {
           Method (_DIS, 0, NotSerialized) { PDIS (PIRB) }\r
           Method (_CRS, 0, NotSerialized) { Return (PCRS (PIRB)) }\r
           Method (_PRS, 0, NotSerialized) { Return (PPRS) }\r
-          Method (_SRS, 1, NotSerialized) { PSRS (PIRB, Arg0) } \r
+          Method (_SRS, 1, NotSerialized) { PSRS (PIRB, Arg0) }\r
         }\r
 \r
         //\r
@@ -250,7 +331,7 @@ DefinitionBlock ("Dsdt.aml", "DSDT", 1, "INTEL ", "OVMF    ", 3) {
           Method (_DIS, 0, NotSerialized) { PDIS (PIRC) }\r
           Method (_CRS, 0, NotSerialized) { Return (PCRS (PIRC)) }\r
           Method (_PRS, 0, NotSerialized) { Return (PPRS) }\r
-          Method (_SRS, 1, NotSerialized) { PSRS (PIRC, Arg0) } \r
+          Method (_SRS, 1, NotSerialized) { PSRS (PIRC, Arg0) }\r
         }\r
 \r
         //\r
@@ -264,9 +345,9 @@ DefinitionBlock ("Dsdt.aml", "DSDT", 1, "INTEL ", "OVMF    ", 3) {
           Method (_DIS, 0, NotSerialized) { PDIS (PIRD) }\r
           Method (_CRS, 0, NotSerialized) { Return (PCRS (PIRD)) }\r
           Method (_PRS, 0, NotSerialized) { Return (PPRS) }\r
-          Method (_SRS, 1, NotSerialized) { PSRS (PIRD, Arg0) } \r
+          Method (_SRS, 1, NotSerialized) { PSRS (PIRD, Arg0) }\r
         }\r
-        \r
+\r
         //\r
         // Programmable Interrupt Controller (PIC)\r
         //\r
@@ -281,10 +362,10 @@ DefinitionBlock ("Dsdt.aml", "DSDT", 1, "INTEL ", "OVMF    ", 3) {
         }\r
 \r
         //\r
-        // ISA DMA \r
+        // ISA DMA\r
         //\r
         Device (DMAC) {\r
-          Name (_HID, EISAID ("PNP0200")) \r
+          Name (_HID, EISAID ("PNP0200"))\r
           Name (_CRS, ResourceTemplate () {\r
             IO (Decode16, 0x00, 0x00, 0, 0x10)\r
             IO (Decode16, 0x81, 0x81, 0, 0x03)\r
@@ -364,19 +445,21 @@ DefinitionBlock ("Dsdt.aml", "DSDT", 1, "INTEL ", "OVMF    ", 3) {
             IO (Decode16, 0x278, 0x278, 0x00, 0x08)\r
             IO (Decode16, 0x370, 0x370, 0x00, 0x02)\r
             IO (Decode16, 0x378, 0x378, 0x00, 0x08)\r
-            IO (Decode16, 0x400, 0x400, 0x00, 0x40)       // PMBLK1\r
+            IO (Decode16, 0x402, 0x402, 0x00, 0x01)        // QEMU debug console, should use FixedPcdGet16 (PcdDebugIoPort)\r
             IO (Decode16, 0x440, 0x440, 0x00, 0x10)\r
             IO (Decode16, 0x678, 0x678, 0x00, 0x08)\r
             IO (Decode16, 0x778, 0x778, 0x00, 0x08)\r
-            Memory32Fixed (ReadOnly, 0xFEC00000, 0x1000)  // IO APIC\r
-            Memory32Fixed (ReadOnly, 0xFEE00000, 0x1000)\r
+            IO (Decode16, 0xafe0, 0xafe0, 0x00, 0x04)      // QEMU GPE0 BLK\r
+            IO (Decode16, 0xb000, 0xb000, 0x00, 0x40)      // PMBLK1\r
+            Memory32Fixed (ReadOnly, 0xFEC00000, 0x1000)   // IO APIC\r
+            Memory32Fixed (ReadOnly, 0xFEE00000, 0x100000) // LAPIC\r
           })\r
         }\r
 \r
         //\r
         // PS/2 Keyboard and PC/AT Enhanced Keyboard 101/102\r
         //\r
-        Device (PS2K) {  \r
+        Device (PS2K) {\r
           Name (_HID, EISAID ("PNP0303"))\r
           Name (_CID, EISAID ("PNP030B"))\r
           Name(_CRS,ResourceTemplate() {\r