Some code (specifically, introduced by commit 801d469ad ("[HVM] ACPI
support patch 3 of 4: ACPI _PRT table.")) has only been licensed under
GPLv2. We want to prevent this code from showing up in non-GPL
binaries which might become possible after we make ACPI builder code
available to users other than hvmloader.

There are two pieces that we need to be careful about:
(1) A small piece of code in dsdt.asl that implements _PIC method
(2) A fragment of ASL generator in mk_dsdt.c that describes PCI
    interrupt routing.

The cleanest way to deal with this seems to be taking generatedi ASL
chunk from (2), adding it to dsdt.asl and keeping dsdt.asl GPL-only.

Signed-off-by: Boris Ostrovsky <boris.ostrov...@oracle.com>
---
CC: Lars Kurth <lars.ku...@citrix.com>
---

Changes in v4:
* New in v4
  Added code in new dsdt.asl is
  +    Scope ( \_SB.PCI0 )
  +    {
  +        Name ( BUFA, ResourceTemplate() { IRQ(Level, ActiveLow, Shared) { 5, 
10, 11 } } )
           ...
  +        })
  +    }

 tools/firmware/hvmloader/Makefile          |   4 +
 tools/firmware/hvmloader/acpi/Makefile     |   9 +-
 tools/firmware/hvmloader/acpi/dsdt.asl     | 461 ----------------
 tools/firmware/hvmloader/acpi/gpl/COPYING  |   5 +
 tools/firmware/hvmloader/acpi/gpl/dsdt.asl | 846 +++++++++++++++++++++++++++++
 tools/firmware/hvmloader/acpi/mk_dsdt.c    |  68 +--
 6 files changed, 862 insertions(+), 531 deletions(-)
 delete mode 100644 tools/firmware/hvmloader/acpi/dsdt.asl
 create mode 100644 tools/firmware/hvmloader/acpi/gpl/COPYING
 create mode 100644 tools/firmware/hvmloader/acpi/gpl/dsdt.asl

diff --git a/tools/firmware/hvmloader/Makefile 
b/tools/firmware/hvmloader/Makefile
index 9f7357f..23b0a58 100644
--- a/tools/firmware/hvmloader/Makefile
+++ b/tools/firmware/hvmloader/Makefile
@@ -65,6 +65,10 @@ ROMBIOS_ROM := $(ROMBIOS_DIR)/BIOS-bochs-latest
 ROMS += $(ROMBIOS_ROM) $(STDVGA_ROM) $(CIRRUSVGA_ROM) $(ETHERBOOT_ROMS)
 endif
 
+# Certain parts of ACPI builder are GPL-only
+GPL = y
+export GPL
+
 .PHONY: all
 all: subdirs-all
        $(MAKE) hvmloader
diff --git a/tools/firmware/hvmloader/acpi/Makefile 
b/tools/firmware/hvmloader/acpi/Makefile
index 76da073..32d8c22 100644
--- a/tools/firmware/hvmloader/acpi/Makefile
+++ b/tools/firmware/hvmloader/acpi/Makefile
@@ -17,7 +17,8 @@
 XEN_ROOT = $(CURDIR)/../../../..
 include $(XEN_ROOT)/tools/firmware/Rules.mk
 
-C_SRC = build.c dsdt_anycpu.c dsdt_15cpu.c static_tables.c 
dsdt_anycpu_qemu_xen.c
+C_SRC-$(GPL)   = build.c dsdt_anycpu.c dsdt_15cpu.c dsdt_anycpu_qemu_xen.c
+C_SRC          = build.c static_tables.c $(C_SRC-y)
 OBJS  = $(patsubst %.c,%.o,$(C_SRC))
 
 CFLAGS += $(CFLAGS_xeninclude)
@@ -33,16 +34,18 @@ ssdt_s3.h ssdt_s4.h ssdt_pm.h ssdt_tpm.h: %.h: %.asl iasl
 mk_dsdt: mk_dsdt.c
        $(HOSTCC) $(HOSTCFLAGS) $(CFLAGS_xeninclude) -o $@ mk_dsdt.c
 
-dsdt_anycpu_qemu_xen.asl: dsdt.asl dsdt_acpi_info.asl mk_dsdt
+ifeq ($(GPL),y)
+dsdt_anycpu_qemu_xen.asl: gpl/dsdt.asl dsdt_acpi_info.asl mk_dsdt
        awk 'NR > 1 {print s} {s=$$0}' $< > $@
        cat dsdt_acpi_info.asl >> $@
        ./mk_dsdt --debug=$(debug) --dm-version qemu-xen >> $@
 
 # NB. awk invocation is a portable alternative to 'head -n -1'
-dsdt_%cpu.asl: dsdt.asl dsdt_acpi_info.asl mk_dsdt
+dsdt_%cpu.asl: gpl/dsdt.asl dsdt_acpi_info.asl mk_dsdt
        awk 'NR > 1 {print s} {s=$$0}' $< > $@
        cat dsdt_acpi_info.asl >> $@
        ./mk_dsdt --debug=$(debug) --maxcpu $*  >> $@
+endif
 
 $(filter dsdt_%.c,$(C_SRC)): %.c: iasl %.asl
        iasl -vs -p $* -tc $*.asl
diff --git a/tools/firmware/hvmloader/acpi/dsdt.asl 
b/tools/firmware/hvmloader/acpi/dsdt.asl
deleted file mode 100644
index 4f6db79..0000000
--- a/tools/firmware/hvmloader/acpi/dsdt.asl
+++ /dev/null
@@ -1,461 +0,0 @@
-/******************************************************************************
- * DSDT for Xen with Qemu device model
- *
- * Copyright (c) 2004, Intel Corporation.
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms and conditions of the GNU General Public License,
- * version 2, as published by the Free Software Foundation.
- *
- * This program is distributed in the hope it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
- * more details.
- *
- * You should have received a copy of the GNU General Public License along with
- * this program; If not, see <http://www.gnu.org/licenses/>.
- */
-
-DefinitionBlock ("DSDT.aml", "DSDT", 2, "Xen", "HVM", 0)
-{
-    Name (\PMBS, 0x0C00)
-    Name (\PMLN, 0x08)
-    Name (\IOB1, 0x00)
-    Name (\IOL1, 0x00)
-    Name (\APCB, 0xFEC00000)
-    Name (\APCL, 0x00010000)
-    Name (\PUID, 0x00)
-
-    /* _S3 and _S4 are in separate SSDTs */
-    Name (\_S5, Package (0x04)
-    {
-        0x00,  /* PM1a_CNT.SLP_TYP */
-        0x00,  /* PM1b_CNT.SLP_TYP */
-        0x00,  /* reserved */
-        0x00   /* reserved */
-    })
-
-    Name(PICD, 0)
-    Method(_PIC, 1)
-    {
-        Store(Arg0, PICD) 
-    }
-
-    Scope (\_SB)
-    {
-
-        /* Fix HCT test for 0x400 pci memory:
-         * - need to report low 640 MB mem as motherboard resource
-         */
-       Device(MEM0)
-       {
-           Name(_HID, EISAID("PNP0C02"))
-           Name(_CRS, ResourceTemplate() {
-               QWordMemory(
-                    ResourceConsumer, PosDecode, MinFixed,
-                    MaxFixed, Cacheable, ReadWrite,
-                    0x00000000,
-                    0x00000000,
-                    0x0009ffff,
-                    0x00000000,
-                    0x000a0000)
-           })
-       }
-
-       Device (PCI0)
-       {
-           Name (_HID, EisaId ("PNP0A03"))
-           Name (_UID, 0x00)
-           Name (_ADR, 0x00)
-           Name (_BBN, 0x00)
-
-           /* Make cirrues VGA S3 suspend/resume work in Windows XP/2003 */
-           Device (VGA)
-           {
-               Name (_ADR, 0x00020000)
-
-               Method (_S1D, 0, NotSerialized)
-               {
-                   Return (0x00)
-               }
-               Method (_S2D, 0, NotSerialized)
-               {
-                   Return (0x00)
-               }
-               Method (_S3D, 0, NotSerialized)
-               {
-                   Return (0x00)
-               }
-           }
-
-           Method (_CRS, 0, NotSerialized)
-           {
-               Store (ResourceTemplate ()
-               {
-                   /* bus number is from 0 - 255*/
-                   WordBusNumber(
-                        ResourceProducer, MinFixed, MaxFixed, SubDecode,
-                        0x0000,
-                        0x0000,
-                        0x00FF,
-                        0x0000,
-                        0x0100)
-                    IO (Decode16, 0x0CF8, 0x0CF8, 0x01, 0x08)
-                    WordIO(
-                        ResourceProducer, MinFixed, MaxFixed, PosDecode,
-                        EntireRange,
-                        0x0000,
-                        0x0000,
-                        0x0CF7,
-                        0x0000,
-                        0x0CF8)
-                    WordIO(
-                        ResourceProducer, MinFixed, MaxFixed, PosDecode,
-                        EntireRange,
-                        0x0000,
-                        0x0D00,
-                        0xFFFF,
-                        0x0000,
-                        0xF300)
-
-                    /* reserve memory for pci devices */
-                    DWordMemory(
-                        ResourceProducer, PosDecode, MinFixed, MaxFixed,
-                        WriteCombining, ReadWrite,
-                        0x00000000,
-                        0x000A0000,
-                        0x000BFFFF,
-                        0x00000000,
-                        0x00020000)
-
-                    DWordMemory(
-                        ResourceProducer, PosDecode, MinFixed, MaxFixed,
-                        NonCacheable, ReadWrite,
-                        0x00000000,
-                        0xF0000000,
-                        0xF4FFFFFF,
-                        0x00000000,
-                        0x05000000,
-                        ,, _Y01)
-
-                    QWordMemory (
-                        ResourceProducer, PosDecode, MinFixed, MaxFixed,
-                        NonCacheable, ReadWrite,
-                        0x0000000000000000,
-                        0x0000000FFFFFFFF0,
-                        0x0000000FFFFFFFFF,
-                        0x0000000000000000,
-                        0x0000000000000010,
-                        ,, _Y02)
-
-                }, Local1)
-
-                CreateDWordField(Local1, \_SB.PCI0._CRS._Y01._MIN, MMIN)
-                CreateDWordField(Local1, \_SB.PCI0._CRS._Y01._MAX, MMAX)
-                CreateDWordField(Local1, \_SB.PCI0._CRS._Y01._LEN, MLEN)
-
-                Store(\_SB.PMIN, MMIN)
-                Store(\_SB.PLEN, MLEN)
-                Add(MMIN, MLEN, MMAX)
-                Subtract(MMAX, One, MMAX)
-
-                /*
-                 * WinXP / Win2K3 blue-screen for operations on 64-bit values.
-                 * Therefore we need to split the 64-bit calculations needed
-                 * here, but different iasl versions evaluate name references
-                 * to integers differently:
-                 * Year (approximate)          2006    2008    2012
-                 * \_SB.PCI0._CRS._Y02         zero   valid   valid
-                 * \_SB.PCI0._CRS._Y02._MIN   valid   valid    huge
-                 */
-                If(LEqual(Zero, \_SB.PCI0._CRS._Y02)) {
-                    Subtract(\_SB.PCI0._CRS._Y02._MIN, 14, Local0)
-                } Else {
-                    Store(\_SB.PCI0._CRS._Y02, Local0)
-                }
-                CreateDWordField(Local1, Add(Local0, 14), MINL)
-                CreateDWordField(Local1, Add(Local0, 18), MINH)
-                CreateDWordField(Local1, Add(Local0, 22), MAXL)
-                CreateDWordField(Local1, Add(Local0, 26), MAXH)
-                CreateDWordField(Local1, Add(Local0, 38), LENL)
-                CreateDWordField(Local1, Add(Local0, 42), LENH)
-
-                Store(\_SB.LMIN, MINL)
-                Store(\_SB.HMIN, MINH)
-                Store(\_SB.LLEN, LENL)
-                Store(\_SB.HLEN, LENH)
-                Add(MINL, LENL, MAXL)
-                Add(MINH, LENH, MAXH)
-                If(LLess(MAXL, MINL)) {
-                    Add(MAXH, One, MAXH)
-                }
-                If(LOr(MINH, LENL)) {
-                    If(LEqual(MAXL, 0)) {
-                        Subtract(MAXH, One, MAXH)
-                    }
-                    Subtract(MAXL, One, MAXL)
-                }
-
-                Return (Local1)
-            }
-
-            Device(HPET) {
-                Name(_HID,  EISAID("PNP0103"))
-                Name(_UID, 0)
-                Method (_STA, 0, NotSerialized) {
-                    If(LEqual(\_SB.HPET, 0)) {
-                        Return(0x00)
-                    } Else {
-                        Return(0x0F)
-                    }
-                }
-                Name(_CRS, ResourceTemplate() {
-                    DWordMemory(
-                        ResourceConsumer, PosDecode, MinFixed, MaxFixed,
-                        NonCacheable, ReadWrite,
-                        0x00000000,
-                        0xFED00000,
-                        0xFED003FF,
-                        0x00000000,
-                        0x00000400 /* 1K memory: FED00000 - FED003FF */
-                    )
-                })
-            }
-
-            Device (ISA)
-            {
-                Name (_ADR, 0x00010000) /* device 1, fn 0 */
-
-                OperationRegion(PIRQ, PCI_Config, 0x60, 0x4)
-                Scope(\) {
-                    Field (\_SB.PCI0.ISA.PIRQ, ByteAcc, NoLock, Preserve) {
-                        PIRA, 8,
-                        PIRB, 8,
-                        PIRC, 8,
-                        PIRD, 8
-                    }
-                }
-                Device (SYSR)
-                {
-                    Name (_HID, EisaId ("PNP0C02"))
-                    Name (_UID, 0x01)
-                    Name (CRS, ResourceTemplate ()
-                    {
-                        /* TODO: list hidden resources */
-                        IO (Decode16, 0x0010, 0x0010, 0x00, 0x10)
-                        IO (Decode16, 0x0022, 0x0022, 0x00, 0x0C)
-                        IO (Decode16, 0x0030, 0x0030, 0x00, 0x10)
-                        IO (Decode16, 0x0044, 0x0044, 0x00, 0x1C)
-                        IO (Decode16, 0x0062, 0x0062, 0x00, 0x02)
-                        IO (Decode16, 0x0065, 0x0065, 0x00, 0x0B)
-                        IO (Decode16, 0x0072, 0x0072, 0x00, 0x0E)
-                        IO (Decode16, 0x0080, 0x0080, 0x00, 0x01)
-                        IO (Decode16, 0x0084, 0x0084, 0x00, 0x03)
-                        IO (Decode16, 0x0088, 0x0088, 0x00, 0x01)
-                        IO (Decode16, 0x008C, 0x008C, 0x00, 0x03)
-                        IO (Decode16, 0x0090, 0x0090, 0x00, 0x10)
-                        IO (Decode16, 0x00A2, 0x00A2, 0x00, 0x1C)
-                        IO (Decode16, 0x00E0, 0x00E0, 0x00, 0x10)
-                        IO (Decode16, 0x08A0, 0x08A0, 0x00, 0x04)
-                        IO (Decode16, 0x0CC0, 0x0CC0, 0x00, 0x10)
-                        IO (Decode16, 0x04D0, 0x04D0, 0x00, 0x02)
-                    })
-                    Method (_CRS, 0, NotSerialized)
-                    {
-                        Return (CRS)
-                    }
-                }
-
-                Device (PIC)
-                {
-                    Name (_HID, EisaId ("PNP0000"))
-                    Name (_CRS, ResourceTemplate ()
-                    {
-                        IO (Decode16, 0x0020, 0x0020, 0x01, 0x02)
-                        IO (Decode16, 0x00A0, 0x00A0, 0x01, 0x02)
-                        IRQNoFlags () {2}
-                    })
-                }
-
-                Device (DMA0)
-                {
-                    Name (_HID, EisaId ("PNP0200"))
-                    Name (_CRS, ResourceTemplate ()
-                    {
-                        DMA (Compatibility, BusMaster, Transfer8) {4}
-                        IO (Decode16, 0x0000, 0x0000, 0x00, 0x10)
-                        IO (Decode16, 0x0081, 0x0081, 0x00, 0x03)
-                        IO (Decode16, 0x0087, 0x0087, 0x00, 0x01)
-                        IO (Decode16, 0x0089, 0x0089, 0x00, 0x03)
-                        IO (Decode16, 0x008F, 0x008F, 0x00, 0x01)
-                        IO (Decode16, 0x00C0, 0x00C0, 0x00, 0x20)
-                        IO (Decode16, 0x0480, 0x0480, 0x00, 0x10)
-                    })
-                }
-
-                Device (TMR)
-                {
-                    Name (_HID, EisaId ("PNP0100"))
-                    Name (_CRS, ResourceTemplate ()
-                    {
-                        IO (Decode16, 0x0040, 0x0040, 0x00, 0x04)
-                        IRQNoFlags () {0}
-                    })
-                }
-
-                Device (RTC)
-                {
-                    Name (_HID, EisaId ("PNP0B00"))
-                    Name (_CRS, ResourceTemplate ()
-                    {
-                        IO (Decode16, 0x0070, 0x0070, 0x00, 0x02)
-                        IRQNoFlags () {8}
-                    })
-                }
-
-                Device (SPKR)
-                {
-                    Name (_HID, EisaId ("PNP0800"))
-                    Name (_CRS, ResourceTemplate ()
-                    {
-                        IO (Decode16, 0x0061, 0x0061, 0x00, 0x01)
-                    })
-                }
-
-                Device (PS2M)
-                {
-                    Name (_HID, EisaId ("PNP0F13"))
-                    Name (_CID, 0x130FD041)
-                    Method (_STA, 0, NotSerialized)
-                    {
-                        Return (0x0F)
-                    }
-
-                    Name (_CRS, ResourceTemplate ()
-                    {
-                        IRQNoFlags () {12}
-                    })
-                }
-
-                Device (PS2K)
-                {
-                    Name (_HID, EisaId ("PNP0303"))
-                    Name (_CID, 0x0B03D041)
-                    Method (_STA, 0, NotSerialized)
-                    {
-                        Return (0x0F)
-                    }
-
-                    Name (_CRS, ResourceTemplate ()
-                    {
-                        IO (Decode16, 0x0060, 0x0060, 0x00, 0x01)
-                        IO (Decode16, 0x0064, 0x0064, 0x00, 0x01)
-                        IRQNoFlags () {1}
-                    })
-                }
-
-                Device (FDC0)
-                {
-                    Name (_HID, EisaId ("PNP0700"))
-                    Method (_STA, 0, NotSerialized)
-                    {
-                          Return (0x0F)
-                    }
-
-                    Name (_CRS, ResourceTemplate ()
-                    {
-                        IO (Decode16, 0x03F0, 0x03F0, 0x01, 0x06)
-                        IO (Decode16, 0x03F7, 0x03F7, 0x01, 0x01)
-                        IRQNoFlags () {6}
-                        DMA (Compatibility, NotBusMaster, Transfer8) {2}
-                    })
-                }
-
-                Device (UAR1)
-                {
-                    Name (_HID, EisaId ("PNP0501"))
-                    Name (_UID, 0x01)
-                    Method (_STA, 0, NotSerialized)
-                    {
-                        If(LEqual(\_SB.UAR1, 0)) {
-                            Return(0x00)
-                        } Else {
-                            Return(0x0F)
-                        }
-                    }
-
-                    Name (_CRS, ResourceTemplate()
-                    {
-                        IO (Decode16, 0x03F8, 0x03F8, 8, 8)
-                        IRQNoFlags () {4}
-                    })
-                }
-
-                Device (UAR2)
-                {
-                    Name (_HID, EisaId ("PNP0501"))
-                    Name (_UID, 0x02)
-                    Method (_STA, 0, NotSerialized)
-                    {
-                        If(LEqual(\_SB.UAR2, 0)) {
-                            Return(0x00)
-                        } Else {
-                            Return(0x0F)
-                        }
-                    }
-
-                    Name (_CRS, ResourceTemplate()
-                    {
-                        IO (Decode16, 0x02F8, 0x02F8, 8, 8)
-                        IRQNoFlags () {3}
-                    })
-                }
-
-                Device (LTP1)
-                {
-                    Name (_HID, EisaId ("PNP0400"))
-                    Name (_UID, 0x02)
-                    Method (_STA, 0, NotSerialized)
-                    {
-                        If(LEqual(\_SB.LTP1, 0)) {
-                            Return(0x00)
-                        } Else {
-                            Return(0x0F)
-                        }
-                    }
-
-                    Name (_CRS, ResourceTemplate()
-                    {
-                        IO (Decode16, 0x0378, 0x0378, 0x08, 0x08)
-                        IRQNoFlags () {7}
-                    })
-                }
-
-                Device(VGID) {
-                    Name(_HID, EisaId ("XEN0000"))
-                    Name(_UID, 0x00)
-                    Name(_CID, "VM_Gen_Counter")
-                    Name(_DDN, "VM_Gen_Counter")
-                    Method(_STA, 0, NotSerialized)
-                    {
-                        If(LEqual(\_SB.VGIA, 0x00000000)) {
-                            Return(0x00)
-                        } Else {
-                            Return(0x0F)
-                        }
-                    }
-                    Name(PKG, Package ()
-                    {
-                        0x00000000,
-                        0x00000000
-                    })
-                    Method(ADDR, 0, NotSerialized)
-                    {
-                        Store(\_SB.VGIA, Index(PKG, 0))
-                        Return(PKG)
-                    }
-                }
-            }
-        }
-    }
-}
diff --git a/tools/firmware/hvmloader/acpi/gpl/COPYING 
b/tools/firmware/hvmloader/acpi/gpl/COPYING
new file mode 100644
index 0000000..8dfdf61
--- /dev/null
+++ b/tools/firmware/hvmloader/acpi/gpl/COPYING
@@ -0,0 +1,5 @@
+Unlike files in the directory above that are licensed under GNU Lesser
+General Public License version 2.1, files here are licensed under GNU
+General Public License version 2.
+
+A copy of this license can be obtained at <http://www.gnu.org/licenses/>
\ No newline at end of file
diff --git a/tools/firmware/hvmloader/acpi/gpl/dsdt.asl 
b/tools/firmware/hvmloader/acpi/gpl/dsdt.asl
new file mode 100644
index 0000000..7c5cc14
--- /dev/null
+++ b/tools/firmware/hvmloader/acpi/gpl/dsdt.asl
@@ -0,0 +1,846 @@
+/******************************************************************************
+ * DSDT for Xen with Qemu device model
+ *
+ * Copyright (c) 2004, Intel Corporation.
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms and conditions of the GNU General Public License,
+ * version 2, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program; If not, see <http://www.gnu.org/licenses/>.
+ */
+
+DefinitionBlock ("DSDT.aml", "DSDT", 2, "Xen", "HVM", 0)
+{
+    Name (\PMBS, 0x0C00)
+    Name (\PMLN, 0x08)
+    Name (\IOB1, 0x00)
+    Name (\IOL1, 0x00)
+    Name (\APCB, 0xFEC00000)
+    Name (\APCL, 0x00010000)
+    Name (\PUID, 0x00)
+
+    /* _S3 and _S4 are in separate SSDTs */
+    Name (\_S5, Package (0x04)
+    {
+        0x00,  /* PM1a_CNT.SLP_TYP */
+        0x00,  /* PM1b_CNT.SLP_TYP */
+        0x00,  /* reserved */
+        0x00   /* reserved */
+    })
+
+    Name(PICD, 0)
+    Method(_PIC, 1)
+    {
+        Store(Arg0, PICD) 
+    }
+
+    Scope (\_SB)
+    {
+
+        /* Fix HCT test for 0x400 pci memory:
+         * - need to report low 640 MB mem as motherboard resource
+         */
+       Device(MEM0)
+       {
+           Name(_HID, EISAID("PNP0C02"))
+           Name(_CRS, ResourceTemplate() {
+               QWordMemory(
+                    ResourceConsumer, PosDecode, MinFixed,
+                    MaxFixed, Cacheable, ReadWrite,
+                    0x00000000,
+                    0x00000000,
+                    0x0009ffff,
+                    0x00000000,
+                    0x000a0000)
+           })
+       }
+
+       Device (PCI0)
+       {
+           Name (_HID, EisaId ("PNP0A03"))
+           Name (_UID, 0x00)
+           Name (_ADR, 0x00)
+           Name (_BBN, 0x00)
+
+           /* Make cirrues VGA S3 suspend/resume work in Windows XP/2003 */
+           Device (VGA)
+           {
+               Name (_ADR, 0x00020000)
+
+               Method (_S1D, 0, NotSerialized)
+               {
+                   Return (0x00)
+               }
+               Method (_S2D, 0, NotSerialized)
+               {
+                   Return (0x00)
+               }
+               Method (_S3D, 0, NotSerialized)
+               {
+                   Return (0x00)
+               }
+           }
+
+           Method (_CRS, 0, NotSerialized)
+           {
+               Store (ResourceTemplate ()
+               {
+                   /* bus number is from 0 - 255*/
+                   WordBusNumber(
+                        ResourceProducer, MinFixed, MaxFixed, SubDecode,
+                        0x0000,
+                        0x0000,
+                        0x00FF,
+                        0x0000,
+                        0x0100)
+                    IO (Decode16, 0x0CF8, 0x0CF8, 0x01, 0x08)
+                    WordIO(
+                        ResourceProducer, MinFixed, MaxFixed, PosDecode,
+                        EntireRange,
+                        0x0000,
+                        0x0000,
+                        0x0CF7,
+                        0x0000,
+                        0x0CF8)
+                    WordIO(
+                        ResourceProducer, MinFixed, MaxFixed, PosDecode,
+                        EntireRange,
+                        0x0000,
+                        0x0D00,
+                        0xFFFF,
+                        0x0000,
+                        0xF300)
+
+                    /* reserve memory for pci devices */
+                    DWordMemory(
+                        ResourceProducer, PosDecode, MinFixed, MaxFixed,
+                        WriteCombining, ReadWrite,
+                        0x00000000,
+                        0x000A0000,
+                        0x000BFFFF,
+                        0x00000000,
+                        0x00020000)
+
+                    DWordMemory(
+                        ResourceProducer, PosDecode, MinFixed, MaxFixed,
+                        NonCacheable, ReadWrite,
+                        0x00000000,
+                        0xF0000000,
+                        0xF4FFFFFF,
+                        0x00000000,
+                        0x05000000,
+                        ,, _Y01)
+
+                    QWordMemory (
+                        ResourceProducer, PosDecode, MinFixed, MaxFixed,
+                        NonCacheable, ReadWrite,
+                        0x0000000000000000,
+                        0x0000000FFFFFFFF0,
+                        0x0000000FFFFFFFFF,
+                        0x0000000000000000,
+                        0x0000000000000010,
+                        ,, _Y02)
+
+                }, Local1)
+
+                CreateDWordField(Local1, \_SB.PCI0._CRS._Y01._MIN, MMIN)
+                CreateDWordField(Local1, \_SB.PCI0._CRS._Y01._MAX, MMAX)
+                CreateDWordField(Local1, \_SB.PCI0._CRS._Y01._LEN, MLEN)
+
+                Store(\_SB.PMIN, MMIN)
+                Store(\_SB.PLEN, MLEN)
+                Add(MMIN, MLEN, MMAX)
+                Subtract(MMAX, One, MMAX)
+
+                /*
+                 * WinXP / Win2K3 blue-screen for operations on 64-bit values.
+                 * Therefore we need to split the 64-bit calculations needed
+                 * here, but different iasl versions evaluate name references
+                 * to integers differently:
+                 * Year (approximate)          2006    2008    2012
+                 * \_SB.PCI0._CRS._Y02         zero   valid   valid
+                 * \_SB.PCI0._CRS._Y02._MIN   valid   valid    huge
+                 */
+                If(LEqual(Zero, \_SB.PCI0._CRS._Y02)) {
+                    Subtract(\_SB.PCI0._CRS._Y02._MIN, 14, Local0)
+                } Else {
+                    Store(\_SB.PCI0._CRS._Y02, Local0)
+                }
+                CreateDWordField(Local1, Add(Local0, 14), MINL)
+                CreateDWordField(Local1, Add(Local0, 18), MINH)
+                CreateDWordField(Local1, Add(Local0, 22), MAXL)
+                CreateDWordField(Local1, Add(Local0, 26), MAXH)
+                CreateDWordField(Local1, Add(Local0, 38), LENL)
+                CreateDWordField(Local1, Add(Local0, 42), LENH)
+
+                Store(\_SB.LMIN, MINL)
+                Store(\_SB.HMIN, MINH)
+                Store(\_SB.LLEN, LENL)
+                Store(\_SB.HLEN, LENH)
+                Add(MINL, LENL, MAXL)
+                Add(MINH, LENH, MAXH)
+                If(LLess(MAXL, MINL)) {
+                    Add(MAXH, One, MAXH)
+                }
+                If(LOr(MINH, LENL)) {
+                    If(LEqual(MAXL, 0)) {
+                        Subtract(MAXH, One, MAXH)
+                    }
+                    Subtract(MAXL, One, MAXL)
+                }
+
+                Return (Local1)
+            }
+
+            Device(HPET) {
+                Name(_HID,  EISAID("PNP0103"))
+                Name(_UID, 0)
+                Method (_STA, 0, NotSerialized) {
+                    If(LEqual(\_SB.HPET, 0)) {
+                        Return(0x00)
+                    } Else {
+                        Return(0x0F)
+                    }
+                }
+                Name(_CRS, ResourceTemplate() {
+                    DWordMemory(
+                        ResourceConsumer, PosDecode, MinFixed, MaxFixed,
+                        NonCacheable, ReadWrite,
+                        0x00000000,
+                        0xFED00000,
+                        0xFED003FF,
+                        0x00000000,
+                        0x00000400 /* 1K memory: FED00000 - FED003FF */
+                    )
+                })
+            }
+
+            Device (ISA)
+            {
+                Name (_ADR, 0x00010000) /* device 1, fn 0 */
+
+                OperationRegion(PIRQ, PCI_Config, 0x60, 0x4)
+                Scope(\) {
+                    Field (\_SB.PCI0.ISA.PIRQ, ByteAcc, NoLock, Preserve) {
+                        PIRA, 8,
+                        PIRB, 8,
+                        PIRC, 8,
+                        PIRD, 8
+                    }
+                }
+                Device (SYSR)
+                {
+                    Name (_HID, EisaId ("PNP0C02"))
+                    Name (_UID, 0x01)
+                    Name (CRS, ResourceTemplate ()
+                    {
+                        /* TODO: list hidden resources */
+                        IO (Decode16, 0x0010, 0x0010, 0x00, 0x10)
+                        IO (Decode16, 0x0022, 0x0022, 0x00, 0x0C)
+                        IO (Decode16, 0x0030, 0x0030, 0x00, 0x10)
+                        IO (Decode16, 0x0044, 0x0044, 0x00, 0x1C)
+                        IO (Decode16, 0x0062, 0x0062, 0x00, 0x02)
+                        IO (Decode16, 0x0065, 0x0065, 0x00, 0x0B)
+                        IO (Decode16, 0x0072, 0x0072, 0x00, 0x0E)
+                        IO (Decode16, 0x0080, 0x0080, 0x00, 0x01)
+                        IO (Decode16, 0x0084, 0x0084, 0x00, 0x03)
+                        IO (Decode16, 0x0088, 0x0088, 0x00, 0x01)
+                        IO (Decode16, 0x008C, 0x008C, 0x00, 0x03)
+                        IO (Decode16, 0x0090, 0x0090, 0x00, 0x10)
+                        IO (Decode16, 0x00A2, 0x00A2, 0x00, 0x1C)
+                        IO (Decode16, 0x00E0, 0x00E0, 0x00, 0x10)
+                        IO (Decode16, 0x08A0, 0x08A0, 0x00, 0x04)
+                        IO (Decode16, 0x0CC0, 0x0CC0, 0x00, 0x10)
+                        IO (Decode16, 0x04D0, 0x04D0, 0x00, 0x02)
+                    })
+                    Method (_CRS, 0, NotSerialized)
+                    {
+                        Return (CRS)
+                    }
+                }
+
+                Device (PIC)
+                {
+                    Name (_HID, EisaId ("PNP0000"))
+                    Name (_CRS, ResourceTemplate ()
+                    {
+                        IO (Decode16, 0x0020, 0x0020, 0x01, 0x02)
+                        IO (Decode16, 0x00A0, 0x00A0, 0x01, 0x02)
+                        IRQNoFlags () {2}
+                    })
+                }
+
+                Device (DMA0)
+                {
+                    Name (_HID, EisaId ("PNP0200"))
+                    Name (_CRS, ResourceTemplate ()
+                    {
+                        DMA (Compatibility, BusMaster, Transfer8) {4}
+                        IO (Decode16, 0x0000, 0x0000, 0x00, 0x10)
+                        IO (Decode16, 0x0081, 0x0081, 0x00, 0x03)
+                        IO (Decode16, 0x0087, 0x0087, 0x00, 0x01)
+                        IO (Decode16, 0x0089, 0x0089, 0x00, 0x03)
+                        IO (Decode16, 0x008F, 0x008F, 0x00, 0x01)
+                        IO (Decode16, 0x00C0, 0x00C0, 0x00, 0x20)
+                        IO (Decode16, 0x0480, 0x0480, 0x00, 0x10)
+                    })
+                }
+
+                Device (TMR)
+                {
+                    Name (_HID, EisaId ("PNP0100"))
+                    Name (_CRS, ResourceTemplate ()
+                    {
+                        IO (Decode16, 0x0040, 0x0040, 0x00, 0x04)
+                        IRQNoFlags () {0}
+                    })
+                }
+
+                Device (RTC)
+                {
+                    Name (_HID, EisaId ("PNP0B00"))
+                    Name (_CRS, ResourceTemplate ()
+                    {
+                        IO (Decode16, 0x0070, 0x0070, 0x00, 0x02)
+                        IRQNoFlags () {8}
+                    })
+                }
+
+                Device (SPKR)
+                {
+                    Name (_HID, EisaId ("PNP0800"))
+                    Name (_CRS, ResourceTemplate ()
+                    {
+                        IO (Decode16, 0x0061, 0x0061, 0x00, 0x01)
+                    })
+                }
+
+                Device (PS2M)
+                {
+                    Name (_HID, EisaId ("PNP0F13"))
+                    Name (_CID, 0x130FD041)
+                    Method (_STA, 0, NotSerialized)
+                    {
+                        Return (0x0F)
+                    }
+
+                    Name (_CRS, ResourceTemplate ()
+                    {
+                        IRQNoFlags () {12}
+                    })
+                }
+
+                Device (PS2K)
+                {
+                    Name (_HID, EisaId ("PNP0303"))
+                    Name (_CID, 0x0B03D041)
+                    Method (_STA, 0, NotSerialized)
+                    {
+                        Return (0x0F)
+                    }
+
+                    Name (_CRS, ResourceTemplate ()
+                    {
+                        IO (Decode16, 0x0060, 0x0060, 0x00, 0x01)
+                        IO (Decode16, 0x0064, 0x0064, 0x00, 0x01)
+                        IRQNoFlags () {1}
+                    })
+                }
+
+                Device (FDC0)
+                {
+                    Name (_HID, EisaId ("PNP0700"))
+                    Method (_STA, 0, NotSerialized)
+                    {
+                          Return (0x0F)
+                    }
+
+                    Name (_CRS, ResourceTemplate ()
+                    {
+                        IO (Decode16, 0x03F0, 0x03F0, 0x01, 0x06)
+                        IO (Decode16, 0x03F7, 0x03F7, 0x01, 0x01)
+                        IRQNoFlags () {6}
+                        DMA (Compatibility, NotBusMaster, Transfer8) {2}
+                    })
+                }
+
+                Device (UAR1)
+                {
+                    Name (_HID, EisaId ("PNP0501"))
+                    Name (_UID, 0x01)
+                    Method (_STA, 0, NotSerialized)
+                    {
+                        If(LEqual(\_SB.UAR1, 0)) {
+                            Return(0x00)
+                        } Else {
+                            Return(0x0F)
+                        }
+                    }
+
+                    Name (_CRS, ResourceTemplate()
+                    {
+                        IO (Decode16, 0x03F8, 0x03F8, 8, 8)
+                        IRQNoFlags () {4}
+                    })
+                }
+
+                Device (UAR2)
+                {
+                    Name (_HID, EisaId ("PNP0501"))
+                    Name (_UID, 0x02)
+                    Method (_STA, 0, NotSerialized)
+                    {
+                        If(LEqual(\_SB.UAR2, 0)) {
+                            Return(0x00)
+                        } Else {
+                            Return(0x0F)
+                        }
+                    }
+
+                    Name (_CRS, ResourceTemplate()
+                    {
+                        IO (Decode16, 0x02F8, 0x02F8, 8, 8)
+                        IRQNoFlags () {3}
+                    })
+                }
+
+                Device (LTP1)
+                {
+                    Name (_HID, EisaId ("PNP0400"))
+                    Name (_UID, 0x02)
+                    Method (_STA, 0, NotSerialized)
+                    {
+                        If(LEqual(\_SB.LTP1, 0)) {
+                            Return(0x00)
+                        } Else {
+                            Return(0x0F)
+                        }
+                    }
+
+                    Name (_CRS, ResourceTemplate()
+                    {
+                        IO (Decode16, 0x0378, 0x0378, 0x08, 0x08)
+                        IRQNoFlags () {7}
+                    })
+                }
+
+                Device(VGID) {
+                    Name(_HID, EisaId ("XEN0000"))
+                    Name(_UID, 0x00)
+                    Name(_CID, "VM_Gen_Counter")
+                    Name(_DDN, "VM_Gen_Counter")
+                    Method(_STA, 0, NotSerialized)
+                    {
+                        If(LEqual(\_SB.VGIA, 0x00000000)) {
+                            Return(0x00)
+                        } Else {
+                            Return(0x0F)
+                        }
+                    }
+                    Name(PKG, Package ()
+                    {
+                        0x00000000,
+                        0x00000000
+                    })
+                    Method(ADDR, 0, NotSerialized)
+                    {
+                        Store(\_SB.VGIA, Index(PKG, 0))
+                        Return(PKG)
+                    }
+                }
+            }
+        }
+    }
+
+    Scope ( \_SB.PCI0 )
+    {
+        Name ( BUFA, ResourceTemplate() { IRQ(Level, ActiveLow, Shared) { 5, 
10, 11 } } )
+        Name ( BUFB, Buffer() { 0x23, 0x00, 0x00, 0x18, 0x79, 0 } )
+        CreateWordField ( BUFB, 0x01, IRQV )
+        Device ( LNKA ) {
+            Name ( _HID,  EISAID("PNP0C0F") )
+            Name ( _UID, 1 )
+            Method ( _STA, 0 ) {
+                If ( And(PIRA, 0x80) ) {
+                    Return ( 0x09 )
+                }
+                Else {
+                    Return ( 0x0B )
+                }
+            }
+            Method ( _PRS ) {
+                Return ( BUFA )
+            }
+            Method ( _DIS ) {
+                Or ( PIRA, 0x80, PIRA )
+            }
+            Method ( _CRS ) {
+                And ( PIRA, 0x0f, Local0 )
+                ShiftLeft ( 0x1, Local0, IRQV )
+                Return ( BUFB )
+            }
+            Method ( _SRS, 1 ) {
+                CreateWordField ( ARG0, 0x01, IRQ1 )
+                FindSetRightBit ( IRQ1, Local0 )
+                Decrement ( Local0 )
+                Store ( Local0, PIRA )
+            }
+        }
+        Device ( LNKB ) {
+            Name ( _HID,  EISAID("PNP0C0F") )
+            Name ( _UID, 2 )
+            Method ( _STA, 0 ) {
+                If ( And(PIRB, 0x80) ) {
+                    Return ( 0x09 )
+                }
+                Else {
+                    Return ( 0x0B )
+                }
+            }
+            Method ( _PRS ) {
+                Return ( BUFA )
+            }
+            Method ( _DIS ) {
+                Or ( PIRB, 0x80, PIRB )
+            }
+            Method ( _CRS ) {
+                And ( PIRB, 0x0f, Local0 )
+                ShiftLeft ( 0x1, Local0, IRQV )
+                Return ( BUFB )
+            }
+            Method ( _SRS, 1 ) {
+                CreateWordField ( ARG0, 0x01, IRQ1 )
+                FindSetRightBit ( IRQ1, Local0 )
+                Decrement ( Local0 )
+                Store ( Local0, PIRB )
+            }
+        }
+        Device ( LNKC ) {
+            Name ( _HID,  EISAID("PNP0C0F") )
+            Name ( _UID, 3 )
+            Method ( _STA, 0 ) {
+                If ( And(PIRC, 0x80) ) {
+                    Return ( 0x09 )
+                }
+                Else {
+                    Return ( 0x0B )
+                }
+            }
+            Method ( _PRS ) {
+                Return ( BUFA )
+            }
+            Method ( _DIS ) {
+                Or ( PIRC, 0x80, PIRC )
+            }
+            Method ( _CRS ) {
+                And ( PIRC, 0x0f, Local0 )
+                ShiftLeft ( 0x1, Local0, IRQV )
+                Return ( BUFB )
+            }
+            Method ( _SRS, 1 ) {
+                CreateWordField ( ARG0, 0x01, IRQ1 )
+                FindSetRightBit ( IRQ1, Local0 )
+                Decrement ( Local0 )
+                Store ( Local0, PIRC )
+            }
+        }
+        Device ( LNKD ) {
+            Name ( _HID,  EISAID("PNP0C0F") )
+            Name ( _UID, 4 )
+            Method ( _STA, 0 ) {
+                If ( And(PIRD, 0x80) ) {
+                    Return ( 0x09 )
+                }
+                Else {
+                    Return ( 0x0B )
+                }
+            }
+            Method ( _PRS ) {
+                Return ( BUFA )
+            }
+            Method ( _DIS ) {
+                Or ( PIRD, 0x80, PIRD )
+            }
+            Method ( _CRS ) {
+                And ( PIRD, 0x0f, Local0 )
+                ShiftLeft ( 0x1, Local0, IRQV )
+                Return ( BUFB )
+            }
+            Method ( _SRS, 1 ) {
+                CreateWordField ( ARG0, 0x01, IRQ1 )
+                FindSetRightBit ( IRQ1, Local0 )
+                Decrement ( Local0 )
+                Store ( Local0, PIRD )
+            }
+        }
+        Method ( _PRT, 0 ) {
+            If ( PICD ) {
+                Return ( PRTA )
+            }
+            Return ( PRTP )
+        }
+
+        Name(PRTP, Package()
+        {
+                Package(){0x0001ffff, 0, \_SB.PCI0.LNKB, 0},
+                Package(){0x0001ffff, 1, \_SB.PCI0.LNKC, 0},
+                Package(){0x0001ffff, 2, \_SB.PCI0.LNKD, 0},
+                Package(){0x0001ffff, 3, \_SB.PCI0.LNKA, 0},
+                Package(){0x0002ffff, 0, \_SB.PCI0.LNKC, 0},
+                Package(){0x0002ffff, 1, \_SB.PCI0.LNKD, 0},
+                Package(){0x0002ffff, 2, \_SB.PCI0.LNKA, 0},
+                Package(){0x0002ffff, 3, \_SB.PCI0.LNKB, 0},
+                Package(){0x0003ffff, 0, \_SB.PCI0.LNKD, 0},
+                Package(){0x0003ffff, 1, \_SB.PCI0.LNKA, 0},
+                Package(){0x0003ffff, 2, \_SB.PCI0.LNKB, 0},
+                Package(){0x0003ffff, 3, \_SB.PCI0.LNKC, 0},
+                Package(){0x0004ffff, 0, \_SB.PCI0.LNKA, 0},
+                Package(){0x0004ffff, 1, \_SB.PCI0.LNKB, 0},
+                Package(){0x0004ffff, 2, \_SB.PCI0.LNKC, 0},
+                Package(){0x0004ffff, 3, \_SB.PCI0.LNKD, 0},
+                Package(){0x0005ffff, 0, \_SB.PCI0.LNKB, 0},
+                Package(){0x0005ffff, 1, \_SB.PCI0.LNKC, 0},
+                Package(){0x0005ffff, 2, \_SB.PCI0.LNKD, 0},
+                Package(){0x0005ffff, 3, \_SB.PCI0.LNKA, 0},
+                Package(){0x0006ffff, 0, \_SB.PCI0.LNKC, 0},
+                Package(){0x0006ffff, 1, \_SB.PCI0.LNKD, 0},
+                Package(){0x0006ffff, 2, \_SB.PCI0.LNKA, 0},
+                Package(){0x0006ffff, 3, \_SB.PCI0.LNKB, 0},
+                Package(){0x0007ffff, 0, \_SB.PCI0.LNKD, 0},
+                Package(){0x0007ffff, 1, \_SB.PCI0.LNKA, 0},
+                Package(){0x0007ffff, 2, \_SB.PCI0.LNKB, 0},
+                Package(){0x0007ffff, 3, \_SB.PCI0.LNKC, 0},
+                Package(){0x0008ffff, 0, \_SB.PCI0.LNKA, 0},
+                Package(){0x0008ffff, 1, \_SB.PCI0.LNKB, 0},
+                Package(){0x0008ffff, 2, \_SB.PCI0.LNKC, 0},
+                Package(){0x0008ffff, 3, \_SB.PCI0.LNKD, 0},
+                Package(){0x0009ffff, 0, \_SB.PCI0.LNKB, 0},
+                Package(){0x0009ffff, 1, \_SB.PCI0.LNKC, 0},
+                Package(){0x0009ffff, 2, \_SB.PCI0.LNKD, 0},
+                Package(){0x0009ffff, 3, \_SB.PCI0.LNKA, 0},
+                Package(){0x000affff, 0, \_SB.PCI0.LNKC, 0},
+                Package(){0x000affff, 1, \_SB.PCI0.LNKD, 0},
+                Package(){0x000affff, 2, \_SB.PCI0.LNKA, 0},
+                Package(){0x000affff, 3, \_SB.PCI0.LNKB, 0},
+                Package(){0x000bffff, 0, \_SB.PCI0.LNKD, 0},
+                Package(){0x000bffff, 1, \_SB.PCI0.LNKA, 0},
+                Package(){0x000bffff, 2, \_SB.PCI0.LNKB, 0},
+                Package(){0x000bffff, 3, \_SB.PCI0.LNKC, 0},
+                Package(){0x000cffff, 0, \_SB.PCI0.LNKA, 0},
+                Package(){0x000cffff, 1, \_SB.PCI0.LNKB, 0},
+                Package(){0x000cffff, 2, \_SB.PCI0.LNKC, 0},
+                Package(){0x000cffff, 3, \_SB.PCI0.LNKD, 0},
+                Package(){0x000dffff, 0, \_SB.PCI0.LNKB, 0},
+                Package(){0x000dffff, 1, \_SB.PCI0.LNKC, 0},
+                Package(){0x000dffff, 2, \_SB.PCI0.LNKD, 0},
+                Package(){0x000dffff, 3, \_SB.PCI0.LNKA, 0},
+                Package(){0x000effff, 0, \_SB.PCI0.LNKC, 0},
+                Package(){0x000effff, 1, \_SB.PCI0.LNKD, 0},
+                Package(){0x000effff, 2, \_SB.PCI0.LNKA, 0},
+                Package(){0x000effff, 3, \_SB.PCI0.LNKB, 0},
+                Package(){0x000fffff, 0, \_SB.PCI0.LNKD, 0},
+                Package(){0x000fffff, 1, \_SB.PCI0.LNKA, 0},
+                Package(){0x000fffff, 2, \_SB.PCI0.LNKB, 0},
+                Package(){0x000fffff, 3, \_SB.PCI0.LNKC, 0},
+                Package(){0x0010ffff, 0, \_SB.PCI0.LNKA, 0},
+                Package(){0x0010ffff, 1, \_SB.PCI0.LNKB, 0},
+                Package(){0x0010ffff, 2, \_SB.PCI0.LNKC, 0},
+                Package(){0x0010ffff, 3, \_SB.PCI0.LNKD, 0},
+                Package(){0x0011ffff, 0, \_SB.PCI0.LNKB, 0},
+                Package(){0x0011ffff, 1, \_SB.PCI0.LNKC, 0},
+                Package(){0x0011ffff, 2, \_SB.PCI0.LNKD, 0},
+                Package(){0x0011ffff, 3, \_SB.PCI0.LNKA, 0},
+                Package(){0x0012ffff, 0, \_SB.PCI0.LNKC, 0},
+                Package(){0x0012ffff, 1, \_SB.PCI0.LNKD, 0},
+                Package(){0x0012ffff, 2, \_SB.PCI0.LNKA, 0},
+                Package(){0x0012ffff, 3, \_SB.PCI0.LNKB, 0},
+                Package(){0x0013ffff, 0, \_SB.PCI0.LNKD, 0},
+                Package(){0x0013ffff, 1, \_SB.PCI0.LNKA, 0},
+                Package(){0x0013ffff, 2, \_SB.PCI0.LNKB, 0},
+                Package(){0x0013ffff, 3, \_SB.PCI0.LNKC, 0},
+                Package(){0x0014ffff, 0, \_SB.PCI0.LNKA, 0},
+                Package(){0x0014ffff, 1, \_SB.PCI0.LNKB, 0},
+                Package(){0x0014ffff, 2, \_SB.PCI0.LNKC, 0},
+                Package(){0x0014ffff, 3, \_SB.PCI0.LNKD, 0},
+                Package(){0x0015ffff, 0, \_SB.PCI0.LNKB, 0},
+                Package(){0x0015ffff, 1, \_SB.PCI0.LNKC, 0},
+                Package(){0x0015ffff, 2, \_SB.PCI0.LNKD, 0},
+                Package(){0x0015ffff, 3, \_SB.PCI0.LNKA, 0},
+                Package(){0x0016ffff, 0, \_SB.PCI0.LNKC, 0},
+                Package(){0x0016ffff, 1, \_SB.PCI0.LNKD, 0},
+                Package(){0x0016ffff, 2, \_SB.PCI0.LNKA, 0},
+                Package(){0x0016ffff, 3, \_SB.PCI0.LNKB, 0},
+                Package(){0x0017ffff, 0, \_SB.PCI0.LNKD, 0},
+                Package(){0x0017ffff, 1, \_SB.PCI0.LNKA, 0},
+                Package(){0x0017ffff, 2, \_SB.PCI0.LNKB, 0},
+                Package(){0x0017ffff, 3, \_SB.PCI0.LNKC, 0},
+                Package(){0x0018ffff, 0, \_SB.PCI0.LNKA, 0},
+                Package(){0x0018ffff, 1, \_SB.PCI0.LNKB, 0},
+                Package(){0x0018ffff, 2, \_SB.PCI0.LNKC, 0},
+                Package(){0x0018ffff, 3, \_SB.PCI0.LNKD, 0},
+                Package(){0x0019ffff, 0, \_SB.PCI0.LNKB, 0},
+                Package(){0x0019ffff, 1, \_SB.PCI0.LNKC, 0},
+                Package(){0x0019ffff, 2, \_SB.PCI0.LNKD, 0},
+                Package(){0x0019ffff, 3, \_SB.PCI0.LNKA, 0},
+                Package(){0x001affff, 0, \_SB.PCI0.LNKC, 0},
+                Package(){0x001affff, 1, \_SB.PCI0.LNKD, 0},
+                Package(){0x001affff, 2, \_SB.PCI0.LNKA, 0},
+                Package(){0x001affff, 3, \_SB.PCI0.LNKB, 0},
+                Package(){0x001bffff, 0, \_SB.PCI0.LNKD, 0},
+                Package(){0x001bffff, 1, \_SB.PCI0.LNKA, 0},
+                Package(){0x001bffff, 2, \_SB.PCI0.LNKB, 0},
+                Package(){0x001bffff, 3, \_SB.PCI0.LNKC, 0},
+                Package(){0x001cffff, 0, \_SB.PCI0.LNKA, 0},
+                Package(){0x001cffff, 1, \_SB.PCI0.LNKB, 0},
+                Package(){0x001cffff, 2, \_SB.PCI0.LNKC, 0},
+                Package(){0x001cffff, 3, \_SB.PCI0.LNKD, 0},
+                Package(){0x001dffff, 0, \_SB.PCI0.LNKB, 0},
+                Package(){0x001dffff, 1, \_SB.PCI0.LNKC, 0},
+                Package(){0x001dffff, 2, \_SB.PCI0.LNKD, 0},
+                Package(){0x001dffff, 3, \_SB.PCI0.LNKA, 0},
+                Package(){0x001effff, 0, \_SB.PCI0.LNKC, 0},
+                Package(){0x001effff, 1, \_SB.PCI0.LNKD, 0},
+                Package(){0x001effff, 2, \_SB.PCI0.LNKA, 0},
+                Package(){0x001effff, 3, \_SB.PCI0.LNKB, 0},
+                Package(){0x001fffff, 0, \_SB.PCI0.LNKD, 0},
+                Package(){0x001fffff, 1, \_SB.PCI0.LNKA, 0},
+                Package(){0x001fffff, 2, \_SB.PCI0.LNKB, 0},
+                Package(){0x001fffff, 3, \_SB.PCI0.LNKC, 0},
+        })
+
+        Name(PRTA, Package()
+        {
+                Package(){0x0001ffff, 0, 0, 20},
+                Package(){0x0001ffff, 1, 0, 21},
+                Package(){0x0001ffff, 2, 0, 22},
+                Package(){0x0001ffff, 3, 0, 23},
+                Package(){0x0002ffff, 0, 0, 24},
+                Package(){0x0002ffff, 1, 0, 25},
+                Package(){0x0002ffff, 2, 0, 26},
+                Package(){0x0002ffff, 3, 0, 27},
+                Package(){0x0003ffff, 0, 0, 28},
+                Package(){0x0003ffff, 1, 0, 29},
+                Package(){0x0003ffff, 2, 0, 30},
+                Package(){0x0003ffff, 3, 0, 31},
+                Package(){0x0004ffff, 0, 0, 32},
+                Package(){0x0004ffff, 1, 0, 33},
+                Package(){0x0004ffff, 2, 0, 34},
+                Package(){0x0004ffff, 3, 0, 35},
+                Package(){0x0005ffff, 0, 0, 36},
+                Package(){0x0005ffff, 1, 0, 37},
+                Package(){0x0005ffff, 2, 0, 38},
+                Package(){0x0005ffff, 3, 0, 39},
+                Package(){0x0006ffff, 0, 0, 40},
+                Package(){0x0006ffff, 1, 0, 41},
+                Package(){0x0006ffff, 2, 0, 42},
+                Package(){0x0006ffff, 3, 0, 43},
+                Package(){0x0007ffff, 0, 0, 44},
+                Package(){0x0007ffff, 1, 0, 45},
+                Package(){0x0007ffff, 2, 0, 46},
+                Package(){0x0007ffff, 3, 0, 47},
+                Package(){0x0008ffff, 0, 0, 17},
+                Package(){0x0008ffff, 1, 0, 18},
+                Package(){0x0008ffff, 2, 0, 19},
+                Package(){0x0008ffff, 3, 0, 20},
+                Package(){0x0009ffff, 0, 0, 21},
+                Package(){0x0009ffff, 1, 0, 22},
+                Package(){0x0009ffff, 2, 0, 23},
+                Package(){0x0009ffff, 3, 0, 24},
+                Package(){0x000affff, 0, 0, 25},
+                Package(){0x000affff, 1, 0, 26},
+                Package(){0x000affff, 2, 0, 27},
+                Package(){0x000affff, 3, 0, 28},
+                Package(){0x000bffff, 0, 0, 29},
+                Package(){0x000bffff, 1, 0, 30},
+                Package(){0x000bffff, 2, 0, 31},
+                Package(){0x000bffff, 3, 0, 32},
+                Package(){0x000cffff, 0, 0, 33},
+                Package(){0x000cffff, 1, 0, 34},
+                Package(){0x000cffff, 2, 0, 35},
+                Package(){0x000cffff, 3, 0, 36},
+                Package(){0x000dffff, 0, 0, 37},
+                Package(){0x000dffff, 1, 0, 38},
+                Package(){0x000dffff, 2, 0, 39},
+                Package(){0x000dffff, 3, 0, 40},
+                Package(){0x000effff, 0, 0, 41},
+                Package(){0x000effff, 1, 0, 42},
+                Package(){0x000effff, 2, 0, 43},
+                Package(){0x000effff, 3, 0, 44},
+                Package(){0x000fffff, 0, 0, 45},
+                Package(){0x000fffff, 1, 0, 46},
+                Package(){0x000fffff, 2, 0, 47},
+                Package(){0x000fffff, 3, 0, 16},
+                Package(){0x0010ffff, 0, 0, 18},
+                Package(){0x0010ffff, 1, 0, 19},
+                Package(){0x0010ffff, 2, 0, 20},
+                Package(){0x0010ffff, 3, 0, 21},
+                Package(){0x0011ffff, 0, 0, 22},
+                Package(){0x0011ffff, 1, 0, 23},
+                Package(){0x0011ffff, 2, 0, 24},
+                Package(){0x0011ffff, 3, 0, 25},
+                Package(){0x0012ffff, 0, 0, 26},
+                Package(){0x0012ffff, 1, 0, 27},
+                Package(){0x0012ffff, 2, 0, 28},
+                Package(){0x0012ffff, 3, 0, 29},
+                Package(){0x0013ffff, 0, 0, 30},
+                Package(){0x0013ffff, 1, 0, 31},
+                Package(){0x0013ffff, 2, 0, 32},
+                Package(){0x0013ffff, 3, 0, 33},
+                Package(){0x0014ffff, 0, 0, 34},
+                Package(){0x0014ffff, 1, 0, 35},
+                Package(){0x0014ffff, 2, 0, 36},
+                Package(){0x0014ffff, 3, 0, 37},
+                Package(){0x0015ffff, 0, 0, 38},
+                Package(){0x0015ffff, 1, 0, 39},
+                Package(){0x0015ffff, 2, 0, 40},
+                Package(){0x0015ffff, 3, 0, 41},
+                Package(){0x0016ffff, 0, 0, 42},
+                Package(){0x0016ffff, 1, 0, 43},
+                Package(){0x0016ffff, 2, 0, 44},
+                Package(){0x0016ffff, 3, 0, 45},
+                Package(){0x0017ffff, 0, 0, 46},
+                Package(){0x0017ffff, 1, 0, 47},
+                Package(){0x0017ffff, 2, 0, 16},
+                Package(){0x0017ffff, 3, 0, 17},
+                Package(){0x0018ffff, 0, 0, 19},
+                Package(){0x0018ffff, 1, 0, 20},
+                Package(){0x0018ffff, 2, 0, 21},
+                Package(){0x0018ffff, 3, 0, 22},
+                Package(){0x0019ffff, 0, 0, 23},
+                Package(){0x0019ffff, 1, 0, 24},
+                Package(){0x0019ffff, 2, 0, 25},
+                Package(){0x0019ffff, 3, 0, 26},
+                Package(){0x001affff, 0, 0, 27},
+                Package(){0x001affff, 1, 0, 28},
+                Package(){0x001affff, 2, 0, 29},
+                Package(){0x001affff, 3, 0, 30},
+                Package(){0x001bffff, 0, 0, 31},
+                Package(){0x001bffff, 1, 0, 32},
+                Package(){0x001bffff, 2, 0, 33},
+                Package(){0x001bffff, 3, 0, 34},
+                Package(){0x001cffff, 0, 0, 35},
+                Package(){0x001cffff, 1, 0, 36},
+                Package(){0x001cffff, 2, 0, 37},
+                Package(){0x001cffff, 3, 0, 38},
+                Package(){0x001dffff, 0, 0, 39},
+                Package(){0x001dffff, 1, 0, 40},
+                Package(){0x001dffff, 2, 0, 41},
+                Package(){0x001dffff, 3, 0, 42},
+                Package(){0x001effff, 0, 0, 43},
+                Package(){0x001effff, 1, 0, 44},
+                Package(){0x001effff, 2, 0, 45},
+                Package(){0x001effff, 3, 0, 46},
+                Package(){0x001fffff, 0, 0, 47},
+                Package(){0x001fffff, 1, 0, 16},
+                Package(){0x001fffff, 2, 0, 17},
+                Package(){0x001fffff, 3, 0, 18},
+        })
+    }
+}
diff --git a/tools/firmware/hvmloader/acpi/mk_dsdt.c 
b/tools/firmware/hvmloader/acpi/mk_dsdt.c
index b2ade89..7656b5d 100644
--- a/tools/firmware/hvmloader/acpi/mk_dsdt.c
+++ b/tools/firmware/hvmloader/acpi/mk_dsdt.c
@@ -91,7 +91,7 @@ static struct option options[] = {
 
 int main(int argc, char **argv)
 {
-    unsigned int slot, dev, intx, link, cpu, max_cpus = HVM_MAX_VCPUS;
+    unsigned int slot, cpu, max_cpus = HVM_MAX_VCPUS;
     dm_version dm_version = QEMU_XEN_TRADITIONAL;
 
     for ( ; ; )
@@ -273,72 +273,6 @@ int main(int argc, char **argv)
         }
     } pop_block();
 
-    /*** PCI-ISA link definitions ***/
-    /* BUFA: List of ISA IRQs available for linking to PCI INTx. */
-    stmt("Name", "BUFA, ResourceTemplate() { "
-         "IRQ(Level, ActiveLow, Shared) { 5, 10, 11 } }");
-    /* BUFB: IRQ descriptor for returning from link-device _CRS methods. */
-    stmt("Name", "BUFB, Buffer() { "
-         "0x23, 0x00, 0x00, 0x18, " /* IRQ descriptor */
-         "0x79, 0 }");              /* End tag, null checksum */
-    stmt("CreateWordField", "BUFB, 0x01, IRQV");
-    /* Create four PCI-ISA link devices: LNKA, LNKB, LNKC, LNKD. */
-    for ( link = 0; link < 4; link++ )
-    {
-        push_block("Device", "LNK%c", 'A'+link);
-        stmt("Name", "_HID,  EISAID(\"PNP0C0F\")");  /* PCI interrupt link */
-        stmt("Name", "_UID, %u", link+1);
-        push_block("Method", "_STA, 0");
-        push_block("If", "And(PIR%c, 0x80)", 'A'+link);
-        stmt("Return", "0x09");
-        pop_block();
-        push_block("Else", NULL);
-        stmt("Return", "0x0B");
-        pop_block();
-        pop_block();
-        push_block("Method", "_PRS");
-        stmt("Return", "BUFA");
-        pop_block();
-        push_block("Method", "_DIS");
-        stmt("Or", "PIR%c, 0x80, PIR%c", 'A'+link, 'A'+link);
-        pop_block();
-        push_block("Method", "_CRS");
-        stmt("And", "PIR%c, 0x0f, Local0", 'A'+link);
-        stmt("ShiftLeft", "0x1, Local0, IRQV");
-        stmt("Return", "BUFB");
-        pop_block();
-        push_block("Method", "_SRS, 1");
-        stmt("CreateWordField", "ARG0, 0x01, IRQ1");
-        stmt("FindSetRightBit", "IRQ1, Local0");
-        stmt("Decrement", "Local0");
-        stmt("Store", "Local0, PIR%c", 'A'+link);
-        pop_block();
-        pop_block();
-    }
-
-    /*** PCI interrupt routing definitions***/
-    /* _PRT: Method to return routing table. */
-    push_block("Method", "_PRT, 0");
-    push_block("If", "PICD");
-    stmt("Return", "PRTA");
-    pop_block();
-    stmt("Return", "PRTP");
-    pop_block();
-    /* PRTP: PIC routing table (via ISA links). */
-    printf("Name(PRTP, Package() {\n");
-    for ( dev = 1; dev < 32; dev++ )
-        for ( intx = 0; intx < 4; intx++ ) /* INTA-D */
-            printf("Package(){0x%04xffff, %u, \\_SB.PCI0.LNK%c, 0},\n",
-                   dev, intx, 'A'+((dev+intx)&3));
-    printf("})\n");
-    /* PRTA: APIC routing table (via non-legacy IOAPIC GSIs). */
-    printf("Name(PRTA, Package() {\n");
-    for ( dev = 1; dev < 32; dev++ )
-        for ( intx = 0; intx < 4; intx++ ) /* INTA-D */
-            printf("Package(){0x%04xffff, %u, 0, %u},\n",
-                   dev, intx, ((dev*4+dev/8+intx)&31)+16);
-    printf("})\n");
-
     /*
      * Each PCI hotplug slot needs at least two methods to handle
      * the ACPI event:
-- 
1.8.3.1


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel

Reply via email to