hw/arm/acpi: simplify AML bit and/or statement
PATCH v3 1/2 hw/arm/acpi: simplify AML bit and/or statement
The last argument of AML bit and/or statement is the target variable, so we don't need to use a NULL target and then an additional store operation; a single bit and/or statement is enough.
--- hw/arm/virt-acpi-build.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
hw/arm/virt-acpi-build.c +4 -4
@@ -265,16 +265,16 @@ static void acpi_dsdt_add_pci(Aml *scope, const MemMapEntry *memmap, aml_create_dword_field(aml_arg(3), aml_int(8), "CDW3"));aml_append (ifctx,aml_store (aml_name ("CDW2" ),aml_name ("SUPP" )));aml_append (ifctx,aml_store (aml_name ("CDW3" ),aml_name ("CTRL" ))); -aml_append (ifctx,aml_store (aml_and (aml_name ("CTRL" ),aml_int (0x1D ),NULL ), +aml_append (ifctx,aml_and (aml_name ("CTRL" ),aml_int (0x1D ),aml_name ("CTRL" ))); ifctx1 =aml_if (aml_lnot (aml_equal (aml_arg (1 ),aml_int (0x1 )))); -aml_append (ifctx1,aml_store (aml_or (aml_name ("CDW1" ),aml_int (0x08 ),NULL ), +aml_append (ifctx1,aml_or (aml_name ("CDW1" ),aml_int (0x08 ),aml_name ("CDW1" )));aml_append (ifctx, ifctx1); ifctx1 =aml_if (aml_lnot (aml_equal (aml_name ("CDW3" ),aml_name ("CTRL" )))); -aml_append (ifctx1,aml_store (aml_or (aml_name ("CDW1" ),aml_int (0x10 ),NULL ), +aml_append (ifctx1,aml_or (aml_name ("CDW1" ),aml_int (0x10 ),aml_name ("CDW1" )));aml_append (ifctx, ifctx1);
@@ -283,7 +283,7 @@ static void acpi_dsdt_add_pci(Aml *scope, const MemMapEntry *memmap,aml_append (method, ifctx); elsectx =aml_else (); -aml_append (elsectx,aml_store (aml_or (aml_name ("CDW1" ),aml_int (4 ),NULL ), +aml_append (elsectx,aml_or (aml_name ("CDW1" ),aml_int (4 ),aml_name ("CDW1" )));aml_append (elsectx,aml_return (aml_arg (3 )));aml_append (method, elsectx);
Signature · 1 line
1.8.3.1
PATCH v3 2/2 hw/arm/acpi: enable SHPC native hot plug
After the introduction of generic PCIe root port and PCIe-PCI bridge, we will also have SHPC controller on ARM, so just enalbe SHPC native hot plug.
--- hw/arm/virt-acpi-build.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
hw/arm/virt-acpi-build.c +6 -1
@@ -265,7 +265,12 @@ static void acpi_dsdt_add_pci(Aml *scope, const MemMapEntry *memmap, aml_create_dword_field(aml_arg(3), aml_int(8), "CDW3"));aml_append (ifctx,aml_store (aml_name ("CDW2" ),aml_name ("SUPP" )));aml_append (ifctx,aml_store (aml_name ("CDW3" ),aml_name ("CTRL" ))); -aml_append (ifctx,aml_and (aml_name ("CTRL" ),aml_int (0x1D ), + +/* +* Allow OS control for all 5 features: +* PCIeHotplug SHPCHotplug PME AER PCIeCapability. +*/ +aml_append (ifctx,aml_and (aml_name ("CTRL" ),aml_int (0x1F ),aml_name ("CTRL" ))); ifctx1 =aml_if (aml_lnot (aml_equal (aml_arg (1 ),aml_int (0x1 ))));
Signature · 1 line
1.8.3.1
Re: [Qemu-devel] [PATCH v3 2/2] hw/arm/acpi: enable SHPC native hot plug
Quoted 20 lines · On Wed, 6 Mar 2019 06:03:49 +0800 Heyi Guo <[email protected]> wrote:
After the introduction of generic PCIe root port and PCIe-PCI bridge, we will also have SHPC controller on ARM, so just enalbe SHPC native hot plug.
Cc Shannon Zhao <[email protected]>Cc Peter Maydell <[email protected]>Cc "Michael S. Tsirkin" <[email protected]>Cc Igor Mammedov <[email protected]>Reviewed-by Michael S. Tsirkin <[email protected]>Signed-off-by Heyi Guo <[email protected]>--- hw/arm/virt-acpi-build.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)hw/arm/virt-acpi-build.c +0
-0@@ -265,7 +265,12 @@ static void acpi_dsdt_add_pci(Aml *scope, const MemMapEntry *memmap, aml_create_dword_field(aml_arg(3), aml_int(8), "CDW3"));
hw/arm/virt-acpi-build.c static void acpi_dsdt_add_pci(Aml *scope, const MemMapEntry *memmap, · line 274
Quoted 10 lines
hw/arm/virt-acpi-build.c +6
-1aml_append (ifctx,aml_store (aml_name ("CDW2" ),aml_name ("SUPP" )));aml_append (ifctx,aml_store (aml_name ("CDW3" ),aml_name ("CTRL" ))); -aml_append (ifctx,aml_and (aml_name ("CTRL" ),aml_int (0x1D ), + +/* +* Allow OS control for all 5 features: +* PCIeHotplug SHPCHotplug PME AER PCIeCapability. +*/ +aml_append (ifctx,aml_and (aml_name ("CTRL" ),aml_int (0x1F ),aml_name ("CTRL" )));
ditto: fix indent
Quoted 2 lines
hw/arm/virt-acpi-build.c +0
-0ifctx1 =aml_if (aml_lnot (aml_equal (aml_arg (1 ),aml_int (0x1 ))));
Quoted 19 lines · On Wed, 6 Mar 2019 06:03:48 +0800 Heyi Guo <[email protected]> wrote:
The last argument of AML bit and/or statement is the target variable, so we don't need to use a NULL target and then an additional store operation; a single bit and/or statement is enough.
Cc Shannon Zhao <[email protected]>Cc Peter Maydell <[email protected]>Cc "Michael S. Tsirkin" <[email protected]>Cc Igor Mammedov <[email protected]>Suggested-by Igor Mammedov <[email protected]>Signed-off-by Heyi Guo <[email protected]>--- hw/arm/virt-acpi-build.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)hw/arm/virt-acpi-build.c +0
-0
hw/arm/virt-acpi-build.c static void acpi_dsdt_add_pci(Aml *scope, const MemMapEntry *memmap, · line 269
Quoted 6 lines
hw/arm/virt-acpi-build.c +1
-1@@ -265,16 +265,16 @@ static void acpi_dsdt_add_pci(Aml *scope, const MemMapEntry *memmap, aml_create_dword_field(aml_arg(3), aml_int(8), "CDW3"));aml_append (ifctx,aml_store (aml_name ("CDW2" ),aml_name ("SUPP" )));aml_append (ifctx,aml_store (aml_name ("CDW3" ),aml_name ("CTRL" ))); -aml_append (ifctx,aml_store (aml_and (aml_name ("CTRL" ),aml_int (0x1D ),NULL ), +aml_append (ifctx,aml_and (aml_name ("CTRL" ),aml_int (0x1D ),aml_name ("CTRL" )));
pls fix indent in all such cases. I'd align it like this:
aml_append(ifctx,
aml_and(aml_name("CTRL"), aml_int(0x1D), aml_name("CTRL")));or
aml_append(ifctx, aml_and(aml_name("CTRL"), aml_int(0x1D),
aml_name("CTRL")));PS:
When making multi-patch series use --cover-letter git option
Quoted 22 lines
hw/arm/virt-acpi-build.c +3
-3ifctx1 =aml_if (aml_lnot (aml_equal (aml_arg (1 ),aml_int (0x1 )))); -aml_append (ifctx1,aml_store (aml_or (aml_name ("CDW1" ),aml_int (0x08 ),NULL ), +aml_append (ifctx1,aml_or (aml_name ("CDW1" ),aml_int (0x08 ),aml_name ("CDW1" )));aml_append (ifctx, ifctx1); ifctx1 =aml_if (aml_lnot (aml_equal (aml_name ("CDW3" ),aml_name ("CTRL" )))); -aml_append (ifctx1,aml_store (aml_or (aml_name ("CDW1" ),aml_int (0x10 ),NULL ), +aml_append (ifctx1,aml_or (aml_name ("CDW1" ),aml_int (0x10 ),aml_name ("CDW1" )));aml_append (ifctx, ifctx1);@@ -283,7 +283,7 @@ static void acpi_dsdt_add_pci(Aml *scope, const MemMapEntry *memmap,aml_append (method, ifctx); elsectx =aml_else (); -aml_append (elsectx,aml_store (aml_or (aml_name ("CDW1" ),aml_int (4 ),NULL ), +aml_append (elsectx,aml_or (aml_name ("CDW1" ),aml_int (4 ),aml_name ("CDW1" )));aml_append (elsectx,aml_return (aml_arg (3 )));aml_append (method, elsectx);
Sorry, I didn't know the indention policy of qemu code. So we need to indent the 2nd line just after the parentheses it belongs to?
Will change that and send next version.
Thanks,
Heyi
Quoted 65 lines · Igor Mammedov
Quoted 19 lines · On Wed, 6 Mar 2019 06:03:48 +0800 Heyi Guo <[email protected]> wrote:
The last argument of AML bit and/or statement is the target variable, so we don't need to use a NULL target and then an additional store operation; a single bit and/or statement is enough.
Cc Shannon Zhao <[email protected]>Cc Peter Maydell <[email protected]>Cc "Michael S. Tsirkin" <[email protected]>Cc Igor Mammedov <[email protected]>Suggested-by Igor Mammedov <[email protected]>Signed-off-by Heyi Guo <[email protected]>--- hw/arm/virt-acpi-build.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)hw/arm/virt-acpi-build.c +0
-0hw/arm/virt-acpi-build.c static void acpi_dsdt_add_pci(Aml *scope, const MemMapEntry *memmap, · line 269
Quoted 6 lines
hw/arm/virt-acpi-build.c +1
-1@@ -265,16 +265,16 @@ static void acpi_dsdt_add_pci(Aml *scope, const MemMapEntry *memmap, aml_create_dword_field(aml_arg(3), aml_int(8), "CDW3"));aml_append (ifctx,aml_store (aml_name ("CDW2" ),aml_name ("SUPP" )));aml_append (ifctx,aml_store (aml_name ("CDW3" ),aml_name ("CTRL" ))); -aml_append (ifctx,aml_store (aml_and (aml_name ("CTRL" ),aml_int (0x1D ),NULL ), +aml_append (ifctx,aml_and (aml_name ("CTRL" ),aml_int (0x1D ),aml_name ("CTRL" )));pls fix indent in all such cases. I'd align it like this:
aml_append(ifctx, aml_and(aml_name("CTRL"), aml_int(0x1D), aml_name("CTRL")));or
aml_append(ifctx, aml_and(aml_name("CTRL"), aml_int(0x1D), aml_name("CTRL")));PS:
When making multi-patch series use --cover-letter git optionQuoted 14 lines
hw/arm/virt-acpi-build.c +2
-2ifctx1 =aml_if (aml_lnot (aml_equal (aml_arg (1 ),aml_int (0x1 )))); -aml_append (ifctx1,aml_store (aml_or (aml_name ("CDW1" ),aml_int (0x08 ),NULL ), +aml_append (ifctx1,aml_or (aml_name ("CDW1" ),aml_int (0x08 ),aml_name ("CDW1" )));aml_append (ifctx, ifctx1); ifctx1 =aml_if (aml_lnot (aml_equal (aml_name ("CDW3" ),aml_name ("CTRL" )))); -aml_append (ifctx1,aml_store (aml_or (aml_name ("CDW1" ),aml_int (0x10 ),NULL ), +aml_append (ifctx1,aml_or (aml_name ("CDW1" ),aml_int (0x10 ),aml_name ("CDW1" )));aml_append (ifctx, ifctx1);hw/arm/virt-acpi-build.c static void acpi_dsdt_add_pci(Aml *scope, const MemMapEntry *memmap, · line 289
Quoted 8 lines
hw/arm/virt-acpi-build.c +1
-1@@ -283,7 +283,7 @@ static void acpi_dsdt_add_pci(Aml *scope, const MemMapEntry *memmap,aml_append (method, ifctx); elsectx =aml_else (); -aml_append (elsectx,aml_store (aml_or (aml_name ("CDW1" ),aml_int (4 ),NULL ), +aml_append (elsectx,aml_or (aml_name ("CDW1" ),aml_int (4 ),aml_name ("CDW1" )));aml_append (elsectx,aml_return (aml_arg (3 )));aml_append (method, elsectx);.
Quoted 1 line · On Wed, 6 Mar 2019 21:09:11 +0800 Heyi Guo <[email protected]> wrote:
Sorry, I didn't know the indention policy of qemu code. So we need to indent the 2nd line just after the parentheses it belongs to?
See "[PATCH v6 0/2] CODING_STYLE: trivial update" for clarification
Quoted 77 lines
Will change that and send next version.
Thanks,
Heyi
Quoted 65 lines · Igor Mammedov
Quoted 19 lines · On Wed, 6 Mar 2019 06:03:48 +0800 Heyi Guo <[email protected]> wrote:
The last argument of AML bit and/or statement is the target variable, so we don't need to use a NULL target and then an additional store operation; a single bit and/or statement is enough.
Cc Shannon Zhao <[email protected]>Cc Peter Maydell <[email protected]>Cc "Michael S. Tsirkin" <[email protected]>Cc Igor Mammedov <[email protected]>Suggested-by Igor Mammedov <[email protected]>Signed-off-by Heyi Guo <[email protected]>--- hw/arm/virt-acpi-build.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)hw/arm/virt-acpi-build.c +0
-0hw/arm/virt-acpi-build.c static void acpi_dsdt_add_pci(Aml *scope, const MemMapEntry *memmap, · line 269
Quoted 6 lines
hw/arm/virt-acpi-build.c +1
-1@@ -265,16 +265,16 @@ static void acpi_dsdt_add_pci(Aml *scope, const MemMapEntry *memmap, aml_create_dword_field(aml_arg(3), aml_int(8), "CDW3"));aml_append (ifctx,aml_store (aml_name ("CDW2" ),aml_name ("SUPP" )));aml_append (ifctx,aml_store (aml_name ("CDW3" ),aml_name ("CTRL" ))); -aml_append (ifctx,aml_store (aml_and (aml_name ("CTRL" ),aml_int (0x1D ),NULL ), +aml_append (ifctx,aml_and (aml_name ("CTRL" ),aml_int (0x1D ),aml_name ("CTRL" )));pls fix indent in all such cases. I'd align it like this:
aml_append(ifctx, aml_and(aml_name("CTRL"), aml_int(0x1D), aml_name("CTRL")));or
aml_append(ifctx, aml_and(aml_name("CTRL"), aml_int(0x1D), aml_name("CTRL")));PS:
When making multi-patch series use --cover-letter git optionQuoted 14 lines
hw/arm/virt-acpi-build.c +2
-2ifctx1 =aml_if (aml_lnot (aml_equal (aml_arg (1 ),aml_int (0x1 )))); -aml_append (ifctx1,aml_store (aml_or (aml_name ("CDW1" ),aml_int (0x08 ),NULL ), +aml_append (ifctx1,aml_or (aml_name ("CDW1" ),aml_int (0x08 ),aml_name ("CDW1" )));aml_append (ifctx, ifctx1); ifctx1 =aml_if (aml_lnot (aml_equal (aml_name ("CDW3" ),aml_name ("CTRL" )))); -aml_append (ifctx1,aml_store (aml_or (aml_name ("CDW1" ),aml_int (0x10 ),NULL ), +aml_append (ifctx1,aml_or (aml_name ("CDW1" ),aml_int (0x10 ),aml_name ("CDW1" )));aml_append (ifctx, ifctx1);hw/arm/virt-acpi-build.c static void acpi_dsdt_add_pci(Aml *scope, const MemMapEntry *memmap, · line 289
Quoted 8 lines
hw/arm/virt-acpi-build.c +1
-1@@ -283,7 +283,7 @@ static void acpi_dsdt_add_pci(Aml *scope, const MemMapEntry *memmap,aml_append (method, ifctx); elsectx =aml_else (); -aml_append (elsectx,aml_store (aml_or (aml_name ("CDW1" ),aml_int (4 ),NULL ), +aml_append (elsectx,aml_or (aml_name ("CDW1" ),aml_int (4 ),aml_name ("CDW1" )));aml_append (elsectx,aml_return (aml_arg (3 )));aml_append (method, elsectx);.
Got it; thanks.
Heyi
Quoted 83 lines · Igor Mammedov
Quoted 1 line · On Wed, 6 Mar 2019 21:09:11 +0800 Heyi Guo <[email protected]> wrote:
Sorry, I didn't know the indention policy of qemu code. So we need to indent the 2nd line just after the parentheses it belongs to?
See "[PATCH v6 0/2]
CODING_STYLE: trivial update" for clarificationQuoted 74 lines
Will change that and send next version.
Thanks,
Heyi
Quoted 64 lines · Igor Mammedov
Quoted 19 lines · On Wed, 6 Mar 2019 06:03:48 +0800 Heyi Guo <[email protected]> wrote:
The last argument of AML bit and/or statement is the target variable, so we don't need to use a NULL target and then an additional store operation; a single bit and/or statement is enough.
Cc Shannon Zhao <[email protected]>Cc Peter Maydell <[email protected]>Cc "Michael S. Tsirkin" <[email protected]>Cc Igor Mammedov <[email protected]>Suggested-by Igor Mammedov <[email protected]>Signed-off-by Heyi Guo <[email protected]>--- hw/arm/virt-acpi-build.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)hw/arm/virt-acpi-build.c +0
-0hw/arm/virt-acpi-build.c static void acpi_dsdt_add_pci(Aml *scope, const MemMapEntry *memmap, · line 269
Quoted 6 lines
hw/arm/virt-acpi-build.c +1
-1@@ -265,16 +265,16 @@ static void acpi_dsdt_add_pci(Aml *scope, const MemMapEntry *memmap, aml_create_dword_field(aml_arg(3), aml_int(8), "CDW3"));aml_append (ifctx,aml_store (aml_name ("CDW2" ),aml_name ("SUPP" )));aml_append (ifctx,aml_store (aml_name ("CDW3" ),aml_name ("CTRL" ))); -aml_append (ifctx,aml_store (aml_and (aml_name ("CTRL" ),aml_int (0x1D ),NULL ), +aml_append (ifctx,aml_and (aml_name ("CTRL" ),aml_int (0x1D ),aml_name ("CTRL" )));pls fix indent in all such cases. I'd align it like this:
aml_append(ifctx, aml_and(aml_name("CTRL"), aml_int(0x1D), aml_name("CTRL")));or
aml_append(ifctx, aml_and(aml_name("CTRL"), aml_int(0x1D), aml_name("CTRL")));PS:
When making multi-patch series use --cover-letter git optionQuoted 14 lines
hw/arm/virt-acpi-build.c +2
-2ifctx1 =aml_if (aml_lnot (aml_equal (aml_arg (1 ),aml_int (0x1 )))); -aml_append (ifctx1,aml_store (aml_or (aml_name ("CDW1" ),aml_int (0x08 ),NULL ), +aml_append (ifctx1,aml_or (aml_name ("CDW1" ),aml_int (0x08 ),aml_name ("CDW1" )));aml_append (ifctx, ifctx1); ifctx1 =aml_if (aml_lnot (aml_equal (aml_name ("CDW3" ),aml_name ("CTRL" )))); -aml_append (ifctx1,aml_store (aml_or (aml_name ("CDW1" ),aml_int (0x10 ),NULL ), +aml_append (ifctx1,aml_or (aml_name ("CDW1" ),aml_int (0x10 ),aml_name ("CDW1" )));aml_append (ifctx, ifctx1);hw/arm/virt-acpi-build.c static void acpi_dsdt_add_pci(Aml *scope, const MemMapEntry *memmap, · line 289
Quoted 8 lines
hw/arm/virt-acpi-build.c +1
-1@@ -283,7 +283,7 @@ static void acpi_dsdt_add_pci(Aml *scope, const MemMapEntry *memmap,aml_append (method, ifctx); elsectx =aml_else (); -aml_append (elsectx,aml_store (aml_or (aml_name ("CDW1" ),aml_int (4 ),NULL ), +aml_append (elsectx,aml_or (aml_name ("CDW1" ),aml_int (4 ),aml_name ("CDW1" )));aml_append (elsectx,aml_return (aml_arg (3 )));aml_append (method, elsectx);.
.