diff mbox

[v4,01/21] acpi: Extract acpi info description into a separate ASL file

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

Commit Message

Boris Ostrovsky Sept. 20, 2016, 12:19 a.m. UTC
This code will be needed by PVH guests who don't want to use full DSDT.

Signed-off-by: Boris Ostrovsky <boris.ostrovsky@oracle.com>
---
Changes in v4:
* New patch. This used to be done in a later patch but because we now
  are trying to keep dsdt.asl GPL-only (in the next patch) it's better
  to do this here and not touch dsdt.asl later.

 .gitignore                                       |  2 +-
 tools/firmware/hvmloader/acpi/Makefile           |  8 +++++---
 tools/firmware/hvmloader/acpi/dsdt.asl           | 19 -----------------
 tools/firmware/hvmloader/acpi/dsdt_acpi_info.asl | 26 ++++++++++++++++++++++++
 4 files changed, 32 insertions(+), 23 deletions(-)
 create mode 100644 tools/firmware/hvmloader/acpi/dsdt_acpi_info.asl

Comments

Jan Beulich Sept. 21, 2016, 10:29 a.m. UTC | #1
>>> On 20.09.16 at 02:19, <boris.ostrovsky@oracle.com> wrote:
> --- a/tools/firmware/hvmloader/acpi/Makefile
> +++ b/tools/firmware/hvmloader/acpi/Makefile
> @@ -33,13 +33,15 @@ 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 mk_dsdt
> +dsdt_anycpu_qemu_xen.asl: 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 mk_dsdt
> +dsdt_%cpu.asl: 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 $*  >> $@

Comments I made on an earlier version now apply here too: In
order to properly deal with make interruptions or failures, this
output redirection should be replaced by going through a
temporary file. Presumably you still have this somewhere later
in the series (as it iirc was in v3), but imo that should then really
be moved ahead of the patch here.

Everything else looks fine.

Jan
Boris Ostrovsky Sept. 21, 2016, 1:21 p.m. UTC | #2
On 09/21/2016 06:29 AM, Jan Beulich wrote:
>>>> On 20.09.16 at 02:19, <boris.ostrovsky@oracle.com> wrote:
>> --- a/tools/firmware/hvmloader/acpi/Makefile
>> +++ b/tools/firmware/hvmloader/acpi/Makefile
>> @@ -33,13 +33,15 @@ 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 mk_dsdt
>> +dsdt_anycpu_qemu_xen.asl: 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 mk_dsdt
>> +dsdt_%cpu.asl: 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 $*  >> $@
> Comments I made on an earlier version now apply here too: In
> order to properly deal with make interruptions or failures, this
> output redirection should be replaced by going through a
> temporary file. Presumably you still have this somewhere later
> in the series (as it iirc was in v3), but imo that should then really
> be moved ahead of the patch here.


Since it looks like I will need to update this Makefile anyway I can
move that patch (#15) to be the first.

-boris

>
> Everything else looks fine.
>
> Jan
>
diff mbox

Patch

diff --git a/.gitignore b/.gitignore
index cc64fc9..6dee857 100644
--- a/.gitignore
+++ b/.gitignore
@@ -129,7 +129,7 @@  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/dsdt_*cpu*.asl
 tools/firmware/hvmloader/acpi/ssdt_*.h
 tools/firmware/hvmloader/hvmloader
 tools/firmware/hvmloader/roms.h
diff --git a/tools/firmware/hvmloader/acpi/Makefile b/tools/firmware/hvmloader/acpi/Makefile
index d3e882a..76da073 100644
--- a/tools/firmware/hvmloader/acpi/Makefile
+++ b/tools/firmware/hvmloader/acpi/Makefile
@@ -33,13 +33,15 @@  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 mk_dsdt
+dsdt_anycpu_qemu_xen.asl: 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 mk_dsdt
+dsdt_%cpu.asl: 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 $*  >> $@
 
 $(filter dsdt_%.c,$(C_SRC)): %.c: iasl %.asl
@@ -63,7 +65,7 @@  acpi.a: $(OBJS)
 
 clean:
 	rm -rf *.a *.o $(IASL_VER) $(IASL_VER).tar.gz $(DEPS)
-	rm -rf ssdt_*.h dsdt*.c *~ *.aml *.hex mk_dsdt dsdt_*.asl
+	rm -rf ssdt_*.h dsdt*.c *~ *.aml *.hex mk_dsdt dsdt_*cpu*.asl
 
 distclean: clean
 
diff --git a/tools/firmware/hvmloader/acpi/dsdt.asl b/tools/firmware/hvmloader/acpi/dsdt.asl
index bd65823..4f6db79 100644
--- a/tools/firmware/hvmloader/acpi/dsdt.asl
+++ b/tools/firmware/hvmloader/acpi/dsdt.asl
@@ -43,25 +43,6 @@  DefinitionBlock ("DSDT.aml", "DSDT", 2, "Xen", "HVM", 0)
 
     Scope (\_SB)
     {
-       /* ACPI_INFO_PHYSICAL_ADDRESS == 0xFC000000 */
-       OperationRegion(BIOS, SystemMemory, 0xFC000000, 40)
-       Field(BIOS, ByteAcc, NoLock, Preserve) {
-           UAR1, 1,
-           UAR2, 1,
-           LTP1, 1,
-           HPET, 1,
-           Offset(2),
-           NCPU, 16,
-           PMIN, 32,
-           PLEN, 32,
-           MSUA, 32, /* MADT checksum address */
-           MAPA, 32, /* MADT LAPIC0 address */
-           VGIA, 32, /* VM generation id address */
-           LMIN, 32,
-           HMIN, 32,
-           LLEN, 32,
-           HLEN, 32
-       }
 
         /* Fix HCT test for 0x400 pci memory:
          * - need to report low 640 MB mem as motherboard resource
diff --git a/tools/firmware/hvmloader/acpi/dsdt_acpi_info.asl b/tools/firmware/hvmloader/acpi/dsdt_acpi_info.asl
new file mode 100644
index 0000000..29e962a
--- /dev/null
+++ b/tools/firmware/hvmloader/acpi/dsdt_acpi_info.asl
@@ -0,0 +1,26 @@ 
+
+    Scope (\_SB)
+    {
+       /*
+        * BIOS region must match struct acpi_info in build.c and
+	* be located at ACPI_INFO_PHYSICAL_ADDRESS = 0xFC000000
+	*/
+       OperationRegion(BIOS, SystemMemory, 0xFC000000, 40)
+       Field(BIOS, ByteAcc, NoLock, Preserve) {
+           UAR1, 1,
+           UAR2, 1,
+           LTP1, 1,
+           HPET, 1,
+           Offset(2),
+           NCPU, 16,
+           PMIN, 32,
+           PLEN, 32,
+           MSUA, 32, /* MADT checksum address */
+           MAPA, 32, /* MADT LAPIC0 address */
+           VGIA, 32, /* VM generation id address */
+           LMIN, 32,
+           HMIN, 32,
+           LLEN, 32,
+           HLEN, 32
+       }
+    }