diff mbox

[1/2] tools/libacpi: Re-licence remaining GPL code to LGPLv2.1

Message ID 1479185547-2873-2-git-send-email-boris.ostrovsky@oracle.com (mailing list archive)
State New, archived
Headers show

Commit Message

Boris Ostrovsky Nov. 15, 2016, 4:52 a.m. UTC
We now have permission from Lenovo to relicense commit 801d469ad8b2
("[HVM] ACPI support patch 3 of 4: ACPI _PRT table") to LGPLv2.1

This essentially means reverting commits c3397311a658 ("acpi: Prevent
GPL-only code from seeping into non-GPL binaries") and 26c4f0b8a4cf
("tools/libacpi: fix sed usage")

Signed-off-by: Boris Ostrovsky <boris.ostrovsky@oracle.com>
Acked-by: Ken Lancaster <klancaster@lenovo.com>
---
CC: Ken Lancaster <klancaster@lenovo.com>
--
 tools/firmware/hvmloader/Makefile |   3 -
 tools/libacpi/COPYING             |  12 ----
 tools/libacpi/Makefile            |  20 ++-----
 tools/libacpi/dsdt.asl            |  11 ++++
 tools/libacpi/gpl/COPYING         |  22 -------
 tools/libacpi/gpl/mk_dsdt_gpl.sh  | 117 --------------------------------------
 tools/libacpi/mk_dsdt.c           |  68 +++++++++++++++++++++-
 7 files changed, 83 insertions(+), 170 deletions(-)
 delete mode 100644 tools/libacpi/gpl/COPYING
 delete mode 100755 tools/libacpi/gpl/mk_dsdt_gpl.sh

Comments

Wei Liu Nov. 15, 2016, 6:14 a.m. UTC | #1
On Mon, Nov 14, 2016 at 11:52:26PM -0500, Boris Ostrovsky wrote:
> We now have permission from Lenovo to relicense commit 801d469ad8b2
> ("[HVM] ACPI support patch 3 of 4: ACPI _PRT table") to LGPLv2.1
> 
> This essentially means reverting commits c3397311a658 ("acpi: Prevent
> GPL-only code from seeping into non-GPL binaries") and 26c4f0b8a4cf
> ("tools/libacpi: fix sed usage")
> 
> Signed-off-by: Boris Ostrovsky <boris.ostrovsky@oracle.com>
> Acked-by: Ken Lancaster <klancaster@lenovo.com>

Reviewed-by: Wei Liu <wei.liu2@citrix.com>
Jan Beulich Nov. 15, 2016, 8:10 a.m. UTC | #2
>>> On 15.11.16 at 05:52, <boris.ostrovsky@oracle.com> wrote:
> We now have permission from Lenovo to relicense commit 801d469ad8b2
> ("[HVM] ACPI support patch 3 of 4: ACPI _PRT table") to LGPLv2.1
> 
> This essentially means reverting commits c3397311a658 ("acpi: Prevent
> GPL-only code from seeping into non-GPL binaries") and 26c4f0b8a4cf
> ("tools/libacpi: fix sed usage")
> 
> Signed-off-by: Boris Ostrovsky <boris.ostrovsky@oracle.com>
> Acked-by: Ken Lancaster <klancaster@lenovo.com>

Acked-by: Jan Beulich <jbeulich@suse.com>
Wei Liu Nov. 15, 2016, 3:14 p.m. UTC | #3
On Mon, Nov 14, 2016 at 11:52:26PM -0500, Boris Ostrovsky wrote:
> We now have permission from Lenovo to relicense commit 801d469ad8b2
> ("[HVM] ACPI support patch 3 of 4: ACPI _PRT table") to LGPLv2.1
> 
> This essentially means reverting commits c3397311a658 ("acpi: Prevent
> GPL-only code from seeping into non-GPL binaries") and 26c4f0b8a4cf
> ("tools/libacpi: fix sed usage")
> 
> Signed-off-by: Boris Ostrovsky <boris.ostrovsky@oracle.com>
> Acked-by: Ken Lancaster <klancaster@lenovo.com>

Applied
diff mbox

Patch

diff --git a/tools/firmware/hvmloader/Makefile b/tools/firmware/hvmloader/Makefile
index 77d7551..002ff18 100644
--- a/tools/firmware/hvmloader/Makefile
+++ b/tools/firmware/hvmloader/Makefile
@@ -63,9 +63,6 @@  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
-export GPL := y
-
 .PHONY: all
 all: acpi subdirs-all
 	$(MAKE) hvmloader
diff --git a/tools/libacpi/COPYING b/tools/libacpi/COPYING
index 5f2f87e..063062b 100644
--- a/tools/libacpi/COPYING
+++ b/tools/libacpi/COPYING
@@ -8,18 +8,6 @@  Where clause 3 is invoked in order to relicense under the GPL then
 this shall be considered to be GPL v2 only for files which have
 specified LGPL v2.1 only.
 
-gpl sub-directory
-=================
-This directory contains a gpl sub-directory which contains code
-licensed under the GPL v2, because we have not yet been able to get
-the permission to relicense the relevant code to LGPL v2.1. See
-gpl/COPYING for more information.
-
-The makefile in this component allows to build a GPL and LGPL only
-variant of this library, the latter omits all GPL source code.
-
-
-
                   GNU LESSER GENERAL PUBLIC LICENSE
                        Version 2.1, February 1999
 
diff --git a/tools/libacpi/Makefile b/tools/libacpi/Makefile
index b79db47..506d85e 100644
--- a/tools/libacpi/Makefile
+++ b/tools/libacpi/Makefile
@@ -21,7 +21,7 @@  endif
 
 MK_DSDT = $(ACPI_BUILD_DIR)/mk_dsdt
 
-C_SRC-$(GPL) = dsdt_anycpu.c dsdt_15cpu.c dsdt_anycpu_qemu_xen.c
+C_SRC-$(CONFIG_X86) = dsdt_anycpu.c dsdt_15cpu.c dsdt_anycpu_qemu_xen.c
 C_SRC-$(CONFIG_ARM_64) = dsdt_anycpu_arm.c
 C_SRC = $(addprefix $(ACPI_BUILD_DIR)/, dsdt_pvh.c $(C_SRC-y))
 H_SRC = $(addprefix $(ACPI_BUILD_DIR)/, ssdt_s3.h ssdt_s4.h ssdt_pm.h ssdt_tpm.h)
@@ -45,30 +45,20 @@  $(H_SRC): $(ACPI_BUILD_DIR)/%.h: %.asl iasl
 $(MK_DSDT): mk_dsdt.c
 	$(HOSTCC) $(HOSTCFLAGS) $(CFLAGS_xeninclude) -D__XEN_TOOLS__ -o $@ mk_dsdt.c
 
-ifeq ($(GPL),y)
-$(ACPI_BUILD_DIR)/dsdt_anycpu_qemu_xen.asl: dsdt.asl dsdt_acpi_info.asl gpl/mk_dsdt_gpl.sh $(MK_DSDT)
+$(ACPI_BUILD_DIR)/dsdt_anycpu_qemu_xen.asl: dsdt.asl dsdt_acpi_info.asl $(MK_DSDT)
 	# Remove last bracket
-	awk 'NR > 1 {print s} {s=$$0}' $< > $@.1.$(TMP_SUFFIX)
-	# Strip license comment
-	sed '1,/\*\//d' $@.1.$(TMP_SUFFIX) > $@.$(TMP_SUFFIX)
-	rm -f $@.1.$(TMP_SUFFIX)
-	$(SHELL) gpl/mk_dsdt_gpl.sh >> $@.$(TMP_SUFFIX)
+	awk 'NR > 1 {print s} {s=$$0}' $< > $@.$(TMP_SUFFIX)
 	cat dsdt_acpi_info.asl >> $@.$(TMP_SUFFIX)
 	$(MK_DSDT) --debug=$(debug) --dm-version qemu-xen >> $@.$(TMP_SUFFIX)
 	mv -f $@.$(TMP_SUFFIX) $@
 
 # NB. awk invocation is a portable alternative to 'head -n -1'
-$(ACPI_BUILD_DIR)/dsdt_%cpu.asl: dsdt.asl dsdt_acpi_info.asl gpl/mk_dsdt_gpl.sh $(MK_DSDT)
+$(ACPI_BUILD_DIR)/dsdt_%cpu.asl: dsdt.asl dsdt_acpi_info.asl  $(MK_DSDT)
 	# Remove last bracket
-	awk 'NR > 1 {print s} {s=$$0}' $< > $@.1.$(TMP_SUFFIX)
-	# Strip license comment
-	sed '1,/\*\//d' $@.1.$(TMP_SUFFIX) > $@.$(TMP_SUFFIX)
-	rm -f $@.1.$(TMP_SUFFIX)
-	$(SHELL) gpl/mk_dsdt_gpl.sh >> $@.$(TMP_SUFFIX)
+	awk 'NR > 1 {print s} {s=$$0}' $< > $@.$(TMP_SUFFIX)
 	cat dsdt_acpi_info.asl >> $@.$(TMP_SUFFIX)
 	$(MK_DSDT) --debug=$(debug) --maxcpu $*  >> $@.$(TMP_SUFFIX)
 	mv -f $@.$(TMP_SUFFIX) $@
-endif
 
 $(ACPI_BUILD_DIR)/dsdt_pvh.asl: dsdt_acpi_info.asl $(MK_DSDT)
 	printf "DefinitionBlock (\"DSDT.aml\", \"DSDT\", 5, \"Xen\", \"HVM\", 0)\n{" > $@
diff --git a/tools/libacpi/dsdt.asl b/tools/libacpi/dsdt.asl
index 2db40e4..fa8ff31 100644
--- a/tools/libacpi/dsdt.asl
+++ b/tools/libacpi/dsdt.asl
@@ -442,4 +442,15 @@  DefinitionBlock ("DSDT.aml", "DSDT", 2, "Xen", "HVM", 0)
             }
         }
     }
+    /* _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)
+    }
 }
diff --git a/tools/libacpi/gpl/COPYING b/tools/libacpi/gpl/COPYING
deleted file mode 100644
index f995ef6..0000000
--- a/tools/libacpi/gpl/COPYING
+++ /dev/null
@@ -1,22 +0,0 @@ 
-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/>
-
-
-INBOUND LICENSE
-
-Contributions to this directory are made under the LGPLv2.1 *only* as
-described in the COPYING file of the parent directory. As LGPLv2.1 is
-compatible with the GPLv2, the resulting file is GPLv2 when seen as a
-whole.
-
-The intention of this inbound license, is to avoid having to ask
-subsequent contributors to this directory for permission to change the
-license from GPLv2 to LGPLv2.1, once we get permission from the
-remaining copyright holders of this directory to change the license to
-LGPLv2.1.
-
-Note: The only outstanding permission required to re-license this
-directory to LGPLv2.1 is from Lenovo.
diff --git a/tools/libacpi/gpl/mk_dsdt_gpl.sh b/tools/libacpi/gpl/mk_dsdt_gpl.sh
deleted file mode 100755
index 38fe01a..0000000
--- a/tools/libacpi/gpl/mk_dsdt_gpl.sh
+++ /dev/null
@@ -1,117 +0,0 @@ 
-#!/bin/sh
-
-# 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/>.
-#
-
-cat <<'EndOfASL'
-    /* Beginning of GPL-only code */
-
-    /* _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)
-    }
-EndOfASL
-
-# PCI-ISA link definitions
-# BUFA: List of ISA IRQs available for linking to PCI INTx.
-# BUFB: IRQ descriptor for returning from link-device _CRS methods.
-cat <<'EndOfASL'
-    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 )
-EndOfASL
-
-for i in $(seq 1 4)
-do
-    link=`echo "A B C D" | cut -d" " -f $i`
-    cat <<EndOfASL
-        Device ( LNK$link ) {
-            Name ( _HID,  EISAID("PNP0C0F") )
-            Name ( _UID, $i)
-            Method ( _STA, 0) {
-                If ( And(PIR$link, 0x80) ) {
-                    Return ( 0x09 )
-                } Else {
-                    Return ( 0x0B )
-                }
-            }
-            Method ( _PRS ) {
-                Return ( BUFA )
-            }
-            Method ( _DIS ) {
-                Or ( PIR$link, 0x80, PIR$link )
-            }
-            Method ( _CRS ) {
-                And ( PIR$link, 0x0f, Local0 )
-                ShiftLeft ( 0x1, Local0, IRQV )
-                Return ( BUFB )
-            }
-            Method ( _SRS, 1 ) {
-                CreateWordField ( ARG0, 0x01, IRQ1 )
-                FindSetRightBit ( IRQ1, Local0 )
-                Decrement ( Local0 )
-                Store ( Local0, PIR$link )
-            }
-        }
-EndOfASL
-done
-
-# PCI interrupt routing definitions
-# _PRT: Method to return routing table.
-cat <<'EndOfASL'
-        Method ( _PRT, 0 ) {
-            If ( PICD ) {
-                Return ( PRTA )
-            }
-            Return ( PRTP )
-        }
-EndOfASL
-
-# PRTP: PIC routing table (via ISA links).
-echo "        Name(PRTP, Package() {"
-for dev in $(seq 1 31)
-do
-    for intx in $(seq 0 3)  # INTA-D
-    do
-	link_idx=$(( ((dev + intx) & 3) + 1 ))
-	link=`echo "A B C D" | cut -d" " -f $link_idx`
-	printf "            Package(){0x%04xffff, %u, \\\\_SB.PCI0.LNK%c, 0},\n" \
-	    $dev $intx $link
-    done
-done
-echo "        })"
-
-# PRTA: APIC routing table (via non-legacy IOAPIC GSIs).
-echo "        Name(PRTA, Package() {"
-for dev in $(seq 1 31)
-do
-    for intx in $(seq 0 3)  # INTA-D
-    do
-	idx=$(( ((dev * 4 + dev/8 + intx) & 31) + 16 ))
-	printf "            Package(){0x%04xffff, %u, 0, %u},\n" \
-	    $dev $intx $idx
-    done
-done
-echo "        })"
-
-echo "    }"
-
-echo "    /* End of GPL-only code */"
diff --git a/tools/libacpi/mk_dsdt.c b/tools/libacpi/mk_dsdt.c
index 4ae68bc..16320a9 100644
--- a/tools/libacpi/mk_dsdt.c
+++ b/tools/libacpi/mk_dsdt.c
@@ -108,7 +108,7 @@  static struct option options[] = {
 
 int main(int argc, char **argv)
 {
-    unsigned int slot, cpu, max_cpus;
+    unsigned int slot, dev, intx, link, cpu, max_cpus;
     dm_version dm_version = QEMU_XEN_TRADITIONAL;
 
 #if defined(__i386__) || defined(__x86_64__)
@@ -318,6 +318,72 @@  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: