WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-changelog

[Xen-changelog] [xen-unstable] hvmloader/acpi: Introduce --maxcpu option

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] [xen-unstable] hvmloader/acpi: Introduce --maxcpu option to mk_dsdt
From: Xen patchbot-unstable <patchbot@xxxxxxx>
Date: Fri, 28 Oct 2011 20:55:09 +0100
Delivery-date: Fri, 28 Oct 2011 12:56:17 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-id: BK change log <xen-changelog.lists.xensource.com>
List-post: <mailto:xen-changelog@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
Reply-to: xen-devel@xxxxxxxxxxxxxxxxxxx
Sender: xen-changelog-bounces@xxxxxxxxxxxxxxxxxxx
# HG changeset patch
# User Anthony PERARD <anthony.perard@xxxxxxxxxx>
# Date 1319818341 -3600
# Node ID 9a2aad56b392596829c241e981507cabb5ba7b52
# Parent  0526644ad2a620fbe7ac867d22be5936bec20367
hvmloader/acpi: Introduce --maxcpu option to mk_dsdt

With this new option, there is no need to compile mk_dsdt for each
DSDT table that we want.  The Makefile is a bit reorganize to handle
this new option and to prepare more change in a coming patch.

Signed-off-by: Anthony PERARD <anthony.perard@xxxxxxxxxx>
---


diff -r 0526644ad2a6 -r 9a2aad56b392 .hgignore
--- a/.hgignore Thu Oct 27 16:07:18 2011 +0100
+++ b/.hgignore Fri Oct 28 17:12:21 2011 +0100
@@ -140,7 +140,9 @@
 ^tools/firmware/etherboot/ipxe\.git/.*$
 ^tools/firmware/extboot/extboot.img$
 ^tools/firmware/extboot/signrom$
+^tools/firmware/hvmloader/acpi/mk_dsdt$
 ^tools/firmware/hvmloader/acpi/dsdt.*\.c$
+^tools/firmware/hvmloader/acpi/dsdt_.*\.asl$
 ^tools/firmware/hvmloader/acpi/ssdt_.*\.h$
 ^tools/firmware/hvmloader/hvmloader$
 ^tools/firmware/hvmloader/roms\.inc$
diff -r 0526644ad2a6 -r 9a2aad56b392 tools/firmware/hvmloader/acpi/Makefile
--- a/tools/firmware/hvmloader/acpi/Makefile    Thu Oct 27 16:07:18 2011 +0100
+++ b/tools/firmware/hvmloader/acpi/Makefile    Fri Oct 28 17:12:21 2011 +0100
@@ -31,15 +31,19 @@
        sed -e 's/AmlCode/$*/g' $*.hex >$@
        rm -f $*.hex $*.aml
 
+mk_dsdt: mk_dsdt.c
+       $(HOSTCC) $(HOSTCFLAGS) $(CFLAGS_xeninclude) -o $@ mk_dsdt.c
+
 # NB. awk invocation is a portable alternative to 'head -n -1'
-dsdt_15cpu.c dsdt_anycpu.c: %.c: dsdt.asl mk_dsdt.c iasl
-       $(HOSTCC) $(HOSTCFLAGS) $(CFLAGS_xeninclude) -o mk_$* mk_dsdt.c
-       awk 'NR > 1 {print s} {s=$$0}' $< >$*.asl
-       ./mk_$* >>$*.asl
+dsdt_%cpu.asl: dsdt.asl mk_dsdt
+       awk 'NR > 1 {print s} {s=$$0}' $< > $@
+       ./mk_dsdt --maxcpu $*  >> $@
+
+$(filter dsdt_%.c,$(C_SRC)): %.c: iasl %.asl
        iasl -vs -p $* -tc $*.asl
        sed -e 's/AmlCode/$*/g' $*.hex >$@
        echo "int $*_len=sizeof($*);" >>$@
-       rm -f $*.hex $*.aml $*.asl mk_$*
+       rm -f $*.aml $*.hex
 
 iasl:
        @echo
@@ -56,7 +60,7 @@
 
 clean:
        rm -rf *.a *.o $(IASL_VER) $(IASL_VER).tar.gz $(DEPS)
-       rm -rf ssdt_*.h dsdt*.c *~ *.aml *.hex mk_dsdt mk_dsdt15 dsdt_*cpu.asl
+       rm -rf ssdt_*.h dsdt*.c *~ *.aml *.hex mk_dsdt dsdt_*.asl
 
 install: all
 
diff -r 0526644ad2a6 -r 9a2aad56b392 tools/firmware/hvmloader/acpi/mk_dsdt.c
--- a/tools/firmware/hvmloader/acpi/mk_dsdt.c   Thu Oct 27 16:07:18 2011 +0100
+++ b/tools/firmware/hvmloader/acpi/mk_dsdt.c   Fri Oct 28 17:12:21 2011 +0100
@@ -1,6 +1,9 @@
 #include <stdio.h>
 #include <stdarg.h>
 #include <stdint.h>
+#include <string.h>
+#include <getopt.h>
+#include <stdlib.h>
 #include <xen/hvm/hvm_info_table.h>
 
 static unsigned int indent_level;
@@ -71,12 +74,44 @@
     pop_block();
 }
 
+static struct option options[] = {
+    { "maxcpu", 1, 0, 'c' },
+    { 0, 0, 0, 0 }
+};
+
 int main(int argc, char **argv)
 {
     unsigned int slot, dev, intx, link, cpu, max_cpus = HVM_MAX_VCPUS;
 
-    /* Extract optional maximum-cpu specification from invocation name. */
-    sscanf(argv[0], "%*[^0-9]%u", &max_cpus); /* e.g., ./mk_dsdt15 */
+    for ( ; ; )
+    {
+        int opt = getopt_long(argc, argv, "", options, NULL);
+        if ( opt == -1 )
+            break;
+
+        switch ( opt )
+        {
+        case 'c': {
+            long i = 0;
+            char *endptr;
+
+            i = strtol(optarg, &endptr, 10);
+            if ( (*optarg != '\0') && (*endptr == '\0') && (i >= 0) )
+            {
+                max_cpus = i;
+            }
+            else if ( !(strcmp(optarg, "any") == 0) )
+            {
+                fprintf(stderr, "`%s' is not a number or is < 0.\n", optarg);
+                return -1;
+            }
+            break;
+        }
+        default:
+            fprintf(stderr, "options not supported.\n");
+            return -1;
+        }
+    }
 
     /**** DSDT DefinitionBlock start ****/
     /* (we append to existing DSDT definition block) */

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-changelog] [xen-unstable] hvmloader/acpi: Introduce --maxcpu option to mk_dsdt, Xen patchbot-unstable <=