[U-Boot] [PATCH v1 0/7] x86: acpi: Few enhancements and improvements

Patch 1 is a build improvement to have better understanding why DSDT is not compiled.
Patches 2 and 3 add date of U-Boot build as OEM revision to the generated tables.
Patch 4 marks fields in FADT in accordance with latest ACPI spec.
Patches 5 and 6 provides a generic "fill" functions that can be replaced in specific board / architecture code.
Patch 7 allows to define HW reduced platforms by avoiding ACPI hardware communication as required by spec.
The series has been tested on Intel Edison board.
Andy Shevchenko (7): Makefile: Don't shadow actual error when compile ASL Makefile: Export build date as integer x86: acpi: Fill OEM revision x86: acpi: Name fields in FADT in accordance with specification x86: acpi: Deduplicate acpi_fill_madt() implementation x86: acpi: Export acpi_fill_mcfg() with __weak attribute x86: acpi: Don't touch hardware on HW reduced platforms
Makefile | 2 ++ arch/x86/cpu/baytrail/acpi.c | 29 --------------------------- arch/x86/cpu/quark/acpi.c | 29 --------------------------- arch/x86/include/asm/acpi_table.h | 8 +++++--- arch/x86/lib/acpi_table.c | 41 ++++++++++++++++++++++++++++++++++++--- scripts/Makefile.lib | 2 +- 6 files changed, 46 insertions(+), 65 deletions(-)

If ASL compiler failed by any reason do not produce output C file. Otherwise sequential run of make will shadow the actual error in ASL, i.e.
CC board/intel/edison/dsdt.o board/intel/edison/dsdt.c:1:1: error: unterminated comment /*
and user has to remove dsdt.c and run make in order to see the error again.
Signed-off-by: Andy Shevchenko andriy.shevchenko@linux.intel.com --- scripts/Makefile.lib | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib index 80ddb08474..9ce47b4d22 100644 --- a/scripts/Makefile.lib +++ b/scripts/Makefile.lib @@ -386,7 +386,7 @@ $(obj)/helloworld.so: $(obj)/helloworld.o arch/$(ARCH)/lib/$(EFI_CRT0) \ quiet_cmd_acpi_c_asl= ASL $< cmd_acpi_c_asl= \ $(CPP) -x assembler-with-cpp -D__ASSEMBLY__ -P $(UBOOTINCLUDE) -o $<.tmp $<; \ - iasl -p $< -tc $<.tmp $(if $(KBUILD_VERBOSE:1=), >/dev/null); \ + iasl -p $< -tc $<.tmp $(if $(KBUILD_VERBOSE:1=), >/dev/null) && \ mv $(patsubst %.asl,%.hex,$<) $@
$(obj)/dsdt.c: $(src)/dsdt.asl

Hi Andy,
On Sat, Jul 22, 2017 at 3:32 AM, Andy Shevchenko andriy.shevchenko@linux.intel.com wrote:
If ASL compiler failed by any reason do not produce output C file. Otherwise sequential run of make will shadow the actual error in ASL, i.e.
CC board/intel/edison/dsdt.o board/intel/edison/dsdt.c:1:1: error: unterminated comment /*
and user has to remove dsdt.c and run make in order to see the error again.
Signed-off-by: Andy Shevchenko andriy.shevchenko@linux.intel.com
scripts/Makefile.lib | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
Reviewed-by: Bin Meng bmeng.cn@gmail.com
Although I am not sure how to reproduce "ASL compiler failed by any reason do not produce output C file"..
Regards, Bin

On Sat, Jul 22, 2017 at 3:59 PM, Bin Meng bmeng.cn@gmail.com wrote:
Hi Andy,
On Sat, Jul 22, 2017 at 3:32 AM, Andy Shevchenko andriy.shevchenko@linux.intel.com wrote:
If ASL compiler failed by any reason do not produce output C file. Otherwise sequential run of make will shadow the actual error in ASL, i.e.
CC board/intel/edison/dsdt.o board/intel/edison/dsdt.c:1:1: error: unterminated comment /*
and user has to remove dsdt.c and run make in order to see the error again.
Signed-off-by: Andy Shevchenko andriy.shevchenko@linux.intel.com
scripts/Makefile.lib | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
Reviewed-by: Bin Meng bmeng.cn@gmail.com
Thanks!
Although I am not sure how to reproduce "ASL compiler failed by any reason do not produce output C file"..
Add
Name (XXX) ({
line to dsdt.asl for Minnowboard MAX and you will see
ASL board/intel/minnowmax/dsdt.asl Compiler aborting due to parser-detected syntax error(s) board/intel/minnowmax/dsdt.asl.tmp 739: Name(XXX) ({ Error 6126 - ^ syntax error, unexpected PARSEOP_CLOSE_PAREN, expecting ','
Next run will get you above error (see commit message) which has been quite confusing.
P.S. Of course it's artificial, but better to handle iasl (potential) failures.

Hi Andy,
On Sun, Jul 23, 2017 at 12:38 AM, Andy Shevchenko andy.shevchenko@gmail.com wrote:
On Sat, Jul 22, 2017 at 3:59 PM, Bin Meng bmeng.cn@gmail.com wrote:
Hi Andy,
On Sat, Jul 22, 2017 at 3:32 AM, Andy Shevchenko andriy.shevchenko@linux.intel.com wrote:
If ASL compiler failed by any reason do not produce output C file. Otherwise sequential run of make will shadow the actual error in ASL, i.e.
CC board/intel/edison/dsdt.o board/intel/edison/dsdt.c:1:1: error: unterminated comment /*
and user has to remove dsdt.c and run make in order to see the error again.
Signed-off-by: Andy Shevchenko andriy.shevchenko@linux.intel.com
scripts/Makefile.lib | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
Reviewed-by: Bin Meng bmeng.cn@gmail.com
Thanks!
Although I am not sure how to reproduce "ASL compiler failed by any reason do not produce output C file"..
Add
Name (XXX) ({
Ah, I tried some pattern with no success but yours indeed triggers the issue.
line to dsdt.asl for Minnowboard MAX and you will see
ASL board/intel/minnowmax/dsdt.asl Compiler aborting due to parser-detected syntax error(s) board/intel/minnowmax/dsdt.asl.tmp 739: Name(XXX) ({ Error 6126 - ^ syntax error, unexpected PARSEOP_CLOSE_PAREN, expecting ','
Next run will get you above error (see commit message) which has been quite confusing.
P.S. Of course it's artificial, but better to handle iasl (potential) failures.
Thanks for the clarification! Tested-by: Bin Meng bmeng.cn@gmail.com
Regards, Bin

On Sun, Jul 23, 2017 at 12:47 AM, Bin Meng bmeng.cn@gmail.com wrote:
Hi Andy,
On Sun, Jul 23, 2017 at 12:38 AM, Andy Shevchenko andy.shevchenko@gmail.com wrote:
On Sat, Jul 22, 2017 at 3:59 PM, Bin Meng bmeng.cn@gmail.com wrote:
Hi Andy,
On Sat, Jul 22, 2017 at 3:32 AM, Andy Shevchenko andriy.shevchenko@linux.intel.com wrote:
If ASL compiler failed by any reason do not produce output C file. Otherwise sequential run of make will shadow the actual error in ASL, i.e.
CC board/intel/edison/dsdt.o board/intel/edison/dsdt.c:1:1: error: unterminated comment /*
and user has to remove dsdt.c and run make in order to see the error again.
Signed-off-by: Andy Shevchenko andriy.shevchenko@linux.intel.com
scripts/Makefile.lib | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
Reviewed-by: Bin Meng bmeng.cn@gmail.com
Thanks!
Although I am not sure how to reproduce "ASL compiler failed by any reason do not produce output C file"..
Add
Name (XXX) ({
Ah, I tried some pattern with no success but yours indeed triggers the issue.
line to dsdt.asl for Minnowboard MAX and you will see
ASL board/intel/minnowmax/dsdt.asl Compiler aborting due to parser-detected syntax error(s) board/intel/minnowmax/dsdt.asl.tmp 739: Name(XXX) ({ Error 6126 - ^ syntax error, unexpected PARSEOP_CLOSE_PAREN, expecting ','
Next run will get you above error (see commit message) which has been quite confusing.
P.S. Of course it's artificial, but better to handle iasl (potential) failures.
Thanks for the clarification! Tested-by: Bin Meng bmeng.cn@gmail.com
applied to u-boot-x86, thanks!

In some cases we would need build date as integer value. Export U_BOOT_BUILD_DATE as %Y%m%d integer value.
Signed-off-by: Andy Shevchenko andriy.shevchenko@linux.intel.com --- Makefile | 2 ++ 1 file changed, 2 insertions(+)
diff --git a/Makefile b/Makefile index 452596485d..71de5c656c 100644 --- a/Makefile +++ b/Makefile @@ -1352,6 +1352,7 @@ define filechk_timestamp.h LC_ALL=C $${DATE} -u -d "$${SOURCE_DATE}" +'#define U_BOOT_TIME "%T"'; \ LC_ALL=C $${DATE} -u -d "$${SOURCE_DATE}" +'#define U_BOOT_TZ "%z"'; \ LC_ALL=C $${DATE} -u -d "$${SOURCE_DATE}" +'#define U_BOOT_DMI_DATE "%m/%d/%Y"'; \ + LC_ALL=C $${DATE} -u -d "$${SOURCE_DATE}" +'#define U_BOOT_BUILD_DATE 0x%Y%m%d'; \ else \ return 42; \ fi; \ @@ -1360,6 +1361,7 @@ define filechk_timestamp.h LC_ALL=C date +'#define U_BOOT_TIME "%T"'; \ LC_ALL=C date +'#define U_BOOT_TZ "%z"'; \ LC_ALL=C date +'#define U_BOOT_DMI_DATE "%m/%d/%Y"'; \ + LC_ALL=C date +'#define U_BOOT_BUILD_DATE 0x%Y%m%d'; \ fi) endef

On Sat, Jul 22, 2017 at 3:32 AM, Andy Shevchenko andriy.shevchenko@linux.intel.com wrote:
In some cases we would need build date as integer value. Export U_BOOT_BUILD_DATE as %Y%m%d integer value.
Signed-off-by: Andy Shevchenko andriy.shevchenko@linux.intel.com
Makefile | 2 ++ 1 file changed, 2 insertions(+)
Reviewed-by: Bin Meng bmeng.cn@gmail.com

On Sat, Jul 22, 2017 at 9:11 PM, Bin Meng bmeng.cn@gmail.com wrote:
On Sat, Jul 22, 2017 at 3:32 AM, Andy Shevchenko andriy.shevchenko@linux.intel.com wrote:
In some cases we would need build date as integer value. Export U_BOOT_BUILD_DATE as %Y%m%d integer value.
Signed-off-by: Andy Shevchenko andriy.shevchenko@linux.intel.com
Makefile | 2 ++ 1 file changed, 2 insertions(+)
Reviewed-by: Bin Meng bmeng.cn@gmail.com
applied to u-boot-x86, thanks!

Fill OEM revision field in the tables by U-Boot build date.
Signed-off-by: Andy Shevchenko andriy.shevchenko@linux.intel.com --- arch/x86/lib/acpi_table.c | 2 ++ 1 file changed, 2 insertions(+)
diff --git a/arch/x86/lib/acpi_table.c b/arch/x86/lib/acpi_table.c index 01d5b6fff0..c6f4d8941c 100644 --- a/arch/x86/lib/acpi_table.c +++ b/arch/x86/lib/acpi_table.c @@ -11,6 +11,7 @@ #include <cpu.h> #include <dm.h> #include <dm/uclass-internal.h> +#include <version.h> #include <asm/acpi/global_nvs.h> #include <asm/acpi_table.h> #include <asm/io.h> @@ -60,6 +61,7 @@ void acpi_fill_header(struct acpi_table_header *header, char *signature) memcpy(header->signature, signature, 4); memcpy(header->oem_id, OEM_ID, 6); memcpy(header->oem_table_id, OEM_TABLE_ID, 8); + header->oem_revision = U_BOOT_BUILD_DATE; memcpy(header->aslc_id, ASLC_ID, 4); }

On Sat, Jul 22, 2017 at 3:32 AM, Andy Shevchenko andriy.shevchenko@linux.intel.com wrote:
Fill OEM revision field in the tables by U-Boot build date.
Signed-off-by: Andy Shevchenko andriy.shevchenko@linux.intel.com
arch/x86/lib/acpi_table.c | 2 ++ 1 file changed, 2 insertions(+)
Reviewed-by: Bin Meng bmeng.cn@gmail.com

On Sat, Jul 22, 2017 at 9:12 PM, Bin Meng bmeng.cn@gmail.com wrote:
On Sat, Jul 22, 2017 at 3:32 AM, Andy Shevchenko andriy.shevchenko@linux.intel.com wrote:
Fill OEM revision field in the tables by U-Boot build date.
Signed-off-by: Andy Shevchenko andriy.shevchenko@linux.intel.com
arch/x86/lib/acpi_table.c | 2 ++ 1 file changed, 2 insertions(+)
Reviewed-by: Bin Meng bmeng.cn@gmail.com
applied to u-boot-x86, thanks!

ACPI specification defines FADT fields marked as reserved in U-Boot.
Name these fields in accordance with ACPI specification.
Signed-off-by: Andy Shevchenko andriy.shevchenko@linux.intel.com --- arch/x86/include/asm/acpi_table.h | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/arch/x86/include/asm/acpi_table.h b/arch/x86/include/asm/acpi_table.h index dd7a946b6c..e177c441e7 100644 --- a/arch/x86/include/asm/acpi_table.h +++ b/arch/x86/include/asm/acpi_table.h @@ -178,9 +178,8 @@ struct __packed acpi_fadt { u32 flags; struct acpi_gen_regaddr reset_reg; u8 reset_value; - u8 res3; - u8 res4; - u8 res5; + u16 arm_boot_arch; + u8 minor_revision; u32 x_firmware_ctl_l; u32 x_firmware_ctl_h; u32 x_dsdt_l;

On Sat, Jul 22, 2017 at 3:32 AM, Andy Shevchenko andriy.shevchenko@linux.intel.com wrote:
ACPI specification defines FADT fields marked as reserved in U-Boot.
Name these fields in accordance with ACPI specification.
Signed-off-by: Andy Shevchenko andriy.shevchenko@linux.intel.com
arch/x86/include/asm/acpi_table.h | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
Reviewed-by: Bin Meng bmeng.cn@gmail.com

On Sat, Jul 22, 2017 at 9:14 PM, Bin Meng bmeng.cn@gmail.com wrote:
On Sat, Jul 22, 2017 at 3:32 AM, Andy Shevchenko andriy.shevchenko@linux.intel.com wrote:
ACPI specification defines FADT fields marked as reserved in U-Boot.
Name these fields in accordance with ACPI specification.
Signed-off-by: Andy Shevchenko andriy.shevchenko@linux.intel.com
arch/x86/include/asm/acpi_table.h | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
Reviewed-by: Bin Meng bmeng.cn@gmail.com
applied to u-boot-x86, thanks!

In Baytrail and Quark support code acpi_fill_madt() is identical.
Deduplicate its implementation by moving to lib/acpi_tables.c.
At the same time mark acpi_fill_madt() with __weak attribute to keep a possibility to override it in platform code
Signed-off-by: Andy Shevchenko andriy.shevchenko@linux.intel.com --- arch/x86/cpu/baytrail/acpi.c | 29 ----------------------------- arch/x86/cpu/quark/acpi.c | 29 ----------------------------- arch/x86/lib/acpi_table.c | 29 +++++++++++++++++++++++++++++ 3 files changed, 29 insertions(+), 58 deletions(-)
diff --git a/arch/x86/cpu/baytrail/acpi.c b/arch/x86/cpu/baytrail/acpi.c index 55ed7de781..cbefdf871d 100644 --- a/arch/x86/cpu/baytrail/acpi.c +++ b/arch/x86/cpu/baytrail/acpi.c @@ -11,8 +11,6 @@ #include <asm/acpi_s3.h> #include <asm/acpi_table.h> #include <asm/io.h> -#include <asm/ioapic.h> -#include <asm/mpspec.h> #include <asm/tables.h> #include <asm/arch/global_nvs.h> #include <asm/arch/iomap.h> @@ -141,33 +139,6 @@ void acpi_create_fadt(struct acpi_fadt *fadt, struct acpi_facs *facs, header->checksum = table_compute_checksum(fadt, header->length); }
-static int acpi_create_madt_irq_overrides(u32 current) -{ - struct acpi_madt_irqoverride *irqovr; - u16 sci_flags = MP_IRQ_TRIGGER_LEVEL | MP_IRQ_POLARITY_HIGH; - int length = 0; - - irqovr = (void *)current; - length += acpi_create_madt_irqoverride(irqovr, 0, 0, 2, 0); - - irqovr = (void *)(current + length); - length += acpi_create_madt_irqoverride(irqovr, 0, 9, 9, sci_flags); - - return length; -} - -u32 acpi_fill_madt(u32 current) -{ - current += acpi_create_madt_lapics(current); - - current += acpi_create_madt_ioapic((struct acpi_madt_ioapic *)current, - io_apic_read(IO_APIC_ID) >> 24, IO_APIC_ADDR, 0); - - current += acpi_create_madt_irq_overrides(current); - - return current; -} - void acpi_create_gnvs(struct acpi_global_nvs *gnvs) { struct udevice *dev; diff --git a/arch/x86/cpu/quark/acpi.c b/arch/x86/cpu/quark/acpi.c index 3968f7a8bf..5717a620b5 100644 --- a/arch/x86/cpu/quark/acpi.c +++ b/arch/x86/cpu/quark/acpi.c @@ -6,8 +6,6 @@
#include <common.h> #include <asm/acpi_table.h> -#include <asm/ioapic.h> -#include <asm/mpspec.h> #include <asm/tables.h> #include <asm/arch/global_nvs.h> #include <asm/arch/iomap.h> @@ -136,33 +134,6 @@ void acpi_create_fadt(struct acpi_fadt *fadt, struct acpi_facs *facs, header->checksum = table_compute_checksum(fadt, header->length); }
-static int acpi_create_madt_irq_overrides(u32 current) -{ - struct acpi_madt_irqoverride *irqovr; - u16 sci_flags = MP_IRQ_TRIGGER_LEVEL | MP_IRQ_POLARITY_HIGH; - int length = 0; - - irqovr = (void *)current; - length += acpi_create_madt_irqoverride(irqovr, 0, 0, 2, 0); - - irqovr = (void *)(current + length); - length += acpi_create_madt_irqoverride(irqovr, 0, 9, 9, sci_flags); - - return length; -} - -u32 acpi_fill_madt(u32 current) -{ - current += acpi_create_madt_lapics(current); - - current += acpi_create_madt_ioapic((struct acpi_madt_ioapic *)current, - io_apic_read(IO_APIC_ID) >> 24, IO_APIC_ADDR, 0); - - current += acpi_create_madt_irq_overrides(current); - - return current; -} - void acpi_create_gnvs(struct acpi_global_nvs *gnvs) { /* quark is a uni-processor */ diff --git a/arch/x86/lib/acpi_table.c b/arch/x86/lib/acpi_table.c index c6f4d8941c..14d10c34cd 100644 --- a/arch/x86/lib/acpi_table.c +++ b/arch/x86/lib/acpi_table.c @@ -15,7 +15,9 @@ #include <asm/acpi/global_nvs.h> #include <asm/acpi_table.h> #include <asm/io.h> +#include <asm/ioapic.h> #include <asm/lapic.h> +#include <asm/mpspec.h> #include <asm/tables.h> #include <asm/arch/global_nvs.h>
@@ -241,6 +243,33 @@ int acpi_create_madt_lapic_nmi(struct acpi_madt_lapic_nmi *lapic_nmi, return lapic_nmi->length; }
+static int acpi_create_madt_irq_overrides(u32 current) +{ + struct acpi_madt_irqoverride *irqovr; + u16 sci_flags = MP_IRQ_TRIGGER_LEVEL | MP_IRQ_POLARITY_HIGH; + int length = 0; + + irqovr = (void *)current; + length += acpi_create_madt_irqoverride(irqovr, 0, 0, 2, 0); + + irqovr = (void *)(current + length); + length += acpi_create_madt_irqoverride(irqovr, 0, 9, 9, sci_flags); + + return length; +} + +__weak u32 acpi_fill_madt(u32 current) +{ + current += acpi_create_madt_lapics(current); + + current += acpi_create_madt_ioapic((struct acpi_madt_ioapic *)current, + io_apic_read(IO_APIC_ID) >> 24, IO_APIC_ADDR, 0); + + current += acpi_create_madt_irq_overrides(current); + + return current; +} + static void acpi_create_madt(struct acpi_madt *madt) { struct acpi_table_header *header = &(madt->header);

On Sat, Jul 22, 2017 at 3:32 AM, Andy Shevchenko andriy.shevchenko@linux.intel.com wrote:
In Baytrail and Quark support code acpi_fill_madt() is identical.
Deduplicate its implementation by moving to lib/acpi_tables.c.
At the same time mark acpi_fill_madt() with __weak attribute to keep a possibility to override it in platform code
Signed-off-by: Andy Shevchenko andriy.shevchenko@linux.intel.com
arch/x86/cpu/baytrail/acpi.c | 29 ----------------------------- arch/x86/cpu/quark/acpi.c | 29 ----------------------------- arch/x86/lib/acpi_table.c | 29 +++++++++++++++++++++++++++++ 3 files changed, 29 insertions(+), 58 deletions(-)
Reviewed-by: Bin Meng bmeng.cn@gmail.com

On Sat, Jul 22, 2017 at 9:33 PM, Bin Meng bmeng.cn@gmail.com wrote:
On Sat, Jul 22, 2017 at 3:32 AM, Andy Shevchenko andriy.shevchenko@linux.intel.com wrote:
In Baytrail and Quark support code acpi_fill_madt() is identical.
Deduplicate its implementation by moving to lib/acpi_tables.c.
At the same time mark acpi_fill_madt() with __weak attribute to keep a possibility to override it in platform code
Signed-off-by: Andy Shevchenko andriy.shevchenko@linux.intel.com
arch/x86/cpu/baytrail/acpi.c | 29 ----------------------------- arch/x86/cpu/quark/acpi.c | 29 ----------------------------- arch/x86/lib/acpi_table.c | 29 +++++++++++++++++++++++++++++ 3 files changed, 29 insertions(+), 58 deletions(-)
Reviewed-by: Bin Meng bmeng.cn@gmail.com
applied to u-boot-x86, thanks!

Some platforms might require different approach when filling memory mappings configuration table.
Allow them to override the common method.
At the same time export acpi_create_mcfg_mmconfig().
Signed-off-by: Andy Shevchenko andriy.shevchenko@linux.intel.com --- arch/x86/include/asm/acpi_table.h | 3 +++ arch/x86/lib/acpi_table.c | 6 +++--- 2 files changed, 6 insertions(+), 3 deletions(-)
diff --git a/arch/x86/include/asm/acpi_table.h b/arch/x86/include/asm/acpi_table.h index e177c441e7..80038504dd 100644 --- a/arch/x86/include/asm/acpi_table.h +++ b/arch/x86/include/asm/acpi_table.h @@ -314,6 +314,9 @@ int acpi_create_madt_irqoverride(struct acpi_madt_irqoverride *irqoverride, int acpi_create_madt_lapic_nmi(struct acpi_madt_lapic_nmi *lapic_nmi, u8 cpu, u16 flags, u8 lint); u32 acpi_fill_madt(u32 current); +int acpi_create_mcfg_mmconfig(struct acpi_mcfg_mmconfig *mmconfig, u32 base, + u16 seg_nr, u8 start, u8 end); +u32 acpi_fill_mcfg(u32 current); void acpi_create_gnvs(struct acpi_global_nvs *gnvs); /** * enter_acpi_mode() - enter into ACPI mode diff --git a/arch/x86/lib/acpi_table.c b/arch/x86/lib/acpi_table.c index 14d10c34cd..da6014fb41 100644 --- a/arch/x86/lib/acpi_table.c +++ b/arch/x86/lib/acpi_table.c @@ -293,8 +293,8 @@ static void acpi_create_madt(struct acpi_madt *madt) header->checksum = table_compute_checksum((void *)madt, header->length); }
-static int acpi_create_mcfg_mmconfig(struct acpi_mcfg_mmconfig *mmconfig, - u32 base, u16 seg_nr, u8 start, u8 end) +int acpi_create_mcfg_mmconfig(struct acpi_mcfg_mmconfig *mmconfig, u32 base, + u16 seg_nr, u8 start, u8 end) { memset(mmconfig, 0, sizeof(*mmconfig)); mmconfig->base_address_l = base; @@ -306,7 +306,7 @@ static int acpi_create_mcfg_mmconfig(struct acpi_mcfg_mmconfig *mmconfig, return sizeof(struct acpi_mcfg_mmconfig); }
-static u32 acpi_fill_mcfg(u32 current) +__weak u32 acpi_fill_mcfg(u32 current) { current += acpi_create_mcfg_mmconfig ((struct acpi_mcfg_mmconfig *)current,

On Sat, Jul 22, 2017 at 3:32 AM, Andy Shevchenko andriy.shevchenko@linux.intel.com wrote:
Some platforms might require different approach when filling memory mappings configuration table.
Allow them to override the common method.
At the same time export acpi_create_mcfg_mmconfig().
Signed-off-by: Andy Shevchenko andriy.shevchenko@linux.intel.com
arch/x86/include/asm/acpi_table.h | 3 +++ arch/x86/lib/acpi_table.c | 6 +++--- 2 files changed, 6 insertions(+), 3 deletions(-)
Reviewed-by: Bin Meng bmeng.cn@gmail.com

On Sat, Jul 22, 2017 at 9:34 PM, Bin Meng bmeng.cn@gmail.com wrote:
On Sat, Jul 22, 2017 at 3:32 AM, Andy Shevchenko andriy.shevchenko@linux.intel.com wrote:
Some platforms might require different approach when filling memory mappings configuration table.
Allow them to override the common method.
At the same time export acpi_create_mcfg_mmconfig().
Signed-off-by: Andy Shevchenko andriy.shevchenko@linux.intel.com
arch/x86/include/asm/acpi_table.h | 3 +++ arch/x86/lib/acpi_table.c | 6 +++--- 2 files changed, 6 insertions(+), 3 deletions(-)
Reviewed-by: Bin Meng bmeng.cn@gmail.com
applied to u-boot-x86, thanks!

If ACPI HW reduced bit in FADT is set we should ignore any ACPI hardware communications.
Signed-off-by: Andy Shevchenko andriy.shevchenko@linux.intel.com --- arch/x86/lib/acpi_table.c | 4 ++++ 1 file changed, 4 insertions(+)
diff --git a/arch/x86/lib/acpi_table.c b/arch/x86/lib/acpi_table.c index da6014fb41..3eb101105b 100644 --- a/arch/x86/lib/acpi_table.c +++ b/arch/x86/lib/acpi_table.c @@ -463,6 +463,10 @@ ulong write_acpi_tables(ulong start)
debug("ACPI: done\n");
+ /* Don't touch ACPI hardware on HW reduced platforms */ + if (fadt->flags & ACPI_FADT_HW_REDUCED_ACPI) + return current; + /* * Other than waiting for OSPM to request us to switch to ACPI mode, * do it by ourselves, since SMI will not be triggered.

Hi Andy,
On Sat, Jul 22, 2017 at 3:32 AM, Andy Shevchenko andriy.shevchenko@linux.intel.com wrote:
If ACPI HW reduced bit in FADT is set we should ignore any ACPI hardware communications.
Signed-off-by: Andy Shevchenko andriy.shevchenko@linux.intel.com
arch/x86/lib/acpi_table.c | 4 ++++ 1 file changed, 4 insertions(+)
diff --git a/arch/x86/lib/acpi_table.c b/arch/x86/lib/acpi_table.c index da6014fb41..3eb101105b 100644 --- a/arch/x86/lib/acpi_table.c +++ b/arch/x86/lib/acpi_table.c @@ -463,6 +463,10 @@ ulong write_acpi_tables(ulong start)
debug("ACPI: done\n");
/* Don't touch ACPI hardware on HW reduced platforms */
if (fadt->flags & ACPI_FADT_HW_REDUCED_ACPI)
return current;
Reviewed-by: Bin Meng bmeng.cn@gmail.com
I assume this is needed on Intel Edison. If that's the case, will you support S3 resume on Edison? And if yes, I believe we will need update acpi_resume() to add the same check there?
/* * Other than waiting for OSPM to request us to switch to ACPI mode, * do it by ourselves, since SMI will not be triggered.
--
Regards, Bin

On Sat, Jul 22, 2017 at 4:45 PM, Bin Meng bmeng.cn@gmail.com wrote:
Hi Andy,
On Sat, Jul 22, 2017 at 3:32 AM, Andy Shevchenko andriy.shevchenko@linux.intel.com wrote:
If ACPI HW reduced bit in FADT is set we should ignore any ACPI hardware communications.
Signed-off-by: Andy Shevchenko andriy.shevchenko@linux.intel.com
arch/x86/lib/acpi_table.c | 4 ++++ 1 file changed, 4 insertions(+)
diff --git a/arch/x86/lib/acpi_table.c b/arch/x86/lib/acpi_table.c index da6014fb41..3eb101105b 100644 --- a/arch/x86/lib/acpi_table.c +++ b/arch/x86/lib/acpi_table.c @@ -463,6 +463,10 @@ ulong write_acpi_tables(ulong start)
debug("ACPI: done\n");
/* Don't touch ACPI hardware on HW reduced platforms */
if (fadt->flags & ACPI_FADT_HW_REDUCED_ACPI)
return current;
Reviewed-by: Bin Meng bmeng.cn@gmail.com
Thanks!
I assume this is needed on Intel Edison.
Actually it has very little with Edison, though I had stumbled over the bug on that platform.
ARM64 support, if any will come, or I even can suggest to try ASUS T100 transformer (Baytrail based HW reduced).
If that's the case, will you support S3 resume on Edison? And if yes, I believe we will need update acpi_resume() to add the same check there?
It might affect any of HW reduced one, needs to be checked.
I fixed only one issue I found, I didn't look at every places where U-Boot goes to ACPI HW,
/* * Other than waiting for OSPM to request us to switch to ACPI mode, * do it by ourselves, since SMI will not be triggered.
--
Regards, Bin _______________________________________________ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot

Hi Andy,
On Sun, Jul 23, 2017 at 12:43 AM, Andy Shevchenko andy.shevchenko@gmail.com wrote:
On Sat, Jul 22, 2017 at 4:45 PM, Bin Meng bmeng.cn@gmail.com wrote:
Hi Andy,
On Sat, Jul 22, 2017 at 3:32 AM, Andy Shevchenko andriy.shevchenko@linux.intel.com wrote:
If ACPI HW reduced bit in FADT is set we should ignore any ACPI hardware communications.
Signed-off-by: Andy Shevchenko andriy.shevchenko@linux.intel.com
arch/x86/lib/acpi_table.c | 4 ++++ 1 file changed, 4 insertions(+)
diff --git a/arch/x86/lib/acpi_table.c b/arch/x86/lib/acpi_table.c index da6014fb41..3eb101105b 100644 --- a/arch/x86/lib/acpi_table.c +++ b/arch/x86/lib/acpi_table.c @@ -463,6 +463,10 @@ ulong write_acpi_tables(ulong start)
debug("ACPI: done\n");
/* Don't touch ACPI hardware on HW reduced platforms */
if (fadt->flags & ACPI_FADT_HW_REDUCED_ACPI)
return current;
Reviewed-by: Bin Meng bmeng.cn@gmail.com
Thanks!
I assume this is needed on Intel Edison.
Actually it has very little with Edison, though I had stumbled over the bug on that platform.
ARM64 support, if any will come, or I even can suggest to try ASUS T100 transformer (Baytrail based HW reduced).
If that's the case, will you support S3 resume on Edison? And if yes, I believe we will need update acpi_resume() to add the same check there?
It might affect any of HW reduced one, needs to be checked.
I fixed only one issue I found, I didn't look at every places where U-Boot goes to ACPI HW,
OK, we will revisit that then once a HW reduced platform wants to support S3.
Regards, Bin

Hi Andy,
On Sun, Jul 23, 2017 at 12:43 AM, Andy Shevchenko andy.shevchenko@gmail.com wrote:
On Sat, Jul 22, 2017 at 4:45 PM, Bin Meng bmeng.cn@gmail.com wrote:
Hi Andy,
On Sat, Jul 22, 2017 at 3:32 AM, Andy Shevchenko andriy.shevchenko@linux.intel.com wrote:
If ACPI HW reduced bit in FADT is set we should ignore any ACPI hardware communications.
Signed-off-by: Andy Shevchenko andriy.shevchenko@linux.intel.com
arch/x86/lib/acpi_table.c | 4 ++++ 1 file changed, 4 insertions(+)
diff --git a/arch/x86/lib/acpi_table.c b/arch/x86/lib/acpi_table.c index da6014fb41..3eb101105b 100644 --- a/arch/x86/lib/acpi_table.c +++ b/arch/x86/lib/acpi_table.c @@ -463,6 +463,10 @@ ulong write_acpi_tables(ulong start)
debug("ACPI: done\n");
/* Don't touch ACPI hardware on HW reduced platforms */
if (fadt->flags & ACPI_FADT_HW_REDUCED_ACPI)
return current;
Reviewed-by: Bin Meng bmeng.cn@gmail.com
Thanks!
I assume this is needed on Intel Edison.
Actually it has very little with Edison, though I had stumbled over the bug on that platform.
ARM64 support, if any will come, or I even can suggest to try ASUS T100 transformer (Baytrail based HW reduced).
Just out of curiosity, if the ASUS T100 transformer is BayTrail based, why is that HW reduced? My understanding is that BayTrail has these ACPI registers.
If that's the case, will you support S3 resume on Edison? And if yes, I believe we will need update acpi_resume() to add the same check there?
It might affect any of HW reduced one, needs to be checked.
I fixed only one issue I found, I didn't look at every places where U-Boot goes to ACPI HW,
Regards, Bin

On Sun, 2017-07-23 at 08:48 +0800, Bin Meng wrote:
Hi Andy,
On Sun, Jul 23, 2017 at 12:43 AM, Andy Shevchenko andy.shevchenko@gmail.com wrote:
On Sat, Jul 22, 2017 at 4:45 PM, Bin Meng bmeng.cn@gmail.com wrote:
I assume this is needed on Intel Edison.
Actually it has very little with Edison, though I had stumbled over the bug on that platform.
ARM64 support, if any will come, or I even can suggest to try ASUS T100 transformer (Baytrail based HW reduced).
Just out of curiosity, if the ASUS T100 transformer is BayTrail based, why is that HW reduced? My understanding is that BayTrail has these ACPI registers.
Yeah, I don't know the reason why, but the decision had been made by department without our team involvement. So, they make it HW reduced and BIOS also had been adapted for this.

On Sat, Jul 22, 2017 at 9:45 PM, Bin Meng bmeng.cn@gmail.com wrote:
Hi Andy,
On Sat, Jul 22, 2017 at 3:32 AM, Andy Shevchenko andriy.shevchenko@linux.intel.com wrote:
If ACPI HW reduced bit in FADT is set we should ignore any ACPI hardware communications.
Signed-off-by: Andy Shevchenko andriy.shevchenko@linux.intel.com
arch/x86/lib/acpi_table.c | 4 ++++ 1 file changed, 4 insertions(+)
diff --git a/arch/x86/lib/acpi_table.c b/arch/x86/lib/acpi_table.c index da6014fb41..3eb101105b 100644 --- a/arch/x86/lib/acpi_table.c +++ b/arch/x86/lib/acpi_table.c @@ -463,6 +463,10 @@ ulong write_acpi_tables(ulong start)
debug("ACPI: done\n");
/* Don't touch ACPI hardware on HW reduced platforms */
if (fadt->flags & ACPI_FADT_HW_REDUCED_ACPI)
return current;
Reviewed-by: Bin Meng bmeng.cn@gmail.com
applied to u-boot-x86, thanks!

On Fri, 2017-07-21 at 22:31 +0300, Andy Shevchenko wrote:
Patch 1 is a build improvement to have better understanding why DSDT is not compiled.
Patches 2 and 3 add date of U-Boot build as OEM revision to the generated tables.
Patch 4 marks fields in FADT in accordance with latest ACPI spec.
Patches 5 and 6 provides a generic "fill" functions that can be replaced in specific board / architecture code.
Patch 7 allows to define HW reduced platforms by avoiding ACPI hardware communication as required by spec.
The series has been tested on Intel Edison board.
# dmesg | grep -i acpi [ 0.000000] Command line: console=tty1 console=ttyS2,115200n8 rootfstype=ramfs rw ignore_loglevel apic=debug acpi.debug_layer=0xffff056d acpi.debug_level=0x0000200f [ 0.000000] ACPI: Early table checksum verification disabled [ 0.000000] ACPI: RSDP 0x00000000000E4500 000024 (v02 U-BOOT) [ 0.000000] ACPI: XSDT 0x00000000000E45E0 00003C (v01 U-BOOT U-BOOTBL 20170721 INTL 00000000) [ 0.000000] ACPI: FACP 0x00000000000E4BA0 0000F4 (v06 U-BOOT U-BOOTBL 20170721 INTL 00000000) [ 0.000000] ACPI: DSDT 0x00000000000E4780 000317 (v02 U-BOOT U-BOOTBL 00010000 INTL 20170303) [ 0.000000] ACPI: APIC 0x00000000000E4CA0 000048 (v04 U-BOOT U-BOOTBL 20170721 INTL 00000000) [ 0.000000] ACPI: MCFG 0x00000000000E4CF0 00003C (v01 U-BOOT U-BOOTBL 20170721 INTL 00000000) [ 0.000000] ACPI: Local APIC address 0xfee00000 [ 0.000000] ACPI: no legacy devices present [ 0.000000] ACPI: Local APIC address 0xfee00000 [ 0.000000] ACPI: LAPIC (acpi_id[0x00] lapic_id[0x00] enabled) [ 0.000000] ACPI: LAPIC (acpi_id[0x02] lapic_id[0x02] enabled) [ 0.000000] ACPI: IOAPIC (id[0x02] address[0xfec00000] gsi_base[0]) [ 0.000000] Using ACPI (MADT) for SMP configuration information [ 0.000000] Kernel command line: console=tty1 console=ttyS2,115200n8 rootfstype=ramfs rw ignore_loglevel apic=debug acpi.debug_layer=0xffff056d acpi.debug_level=0x0000200f [ 0.000492] ACPI: Core revision 20170531 [ 0.001000] ACPI: 1 ACPI AML tables successfully acquired and loaded [ 0.077715] ACPI FADT declares the system doesn't support PCIe ASPM, so disable it [ 0.078017] ACPI: bus type PCI registered [ 0.128219] ACPI: Added _OSI(Module Device) [ 0.128361] ACPI: Added _OSI(Processor Device) [ 0.128496] ACPI: Added _OSI(3.0 _SCP Extensions) [ 0.128635] ACPI: Added _OSI(Processor Aggregator Device) [ 0.130366] ACPI: Interpreter enabled [ 0.130541] ACPI: (supports S0) [ 0.130647] ACPI: Using IOAPIC for interrupt routing [ 0.130897] PCI: Using host bridge windows from ACPI; if necessary, use "pci=nocrs" and report a bug [ 0.155018] bus-0135 bus_get_status : Device [ACPI] status [0000000f] [ 0.158317] ACPI: PCI Root Bridge [PCI0] (domain 0000 [bus 00-ff]) [ 0.158776] acpi PNP0A08:00: _OSC: OS supports [ExtendedConfig ASPM ClockPM Segments MSI] [ 0.159628] acpi PNP0A08:00: _OSC: OS now controls [PCIeHotplug PME AER PCIeCapability] [ 0.159869] acpi PNP0A08:00: FADT indicates ASPM is unsupported, using BIOS configuration [ 0.161535] acpi PNP0A08:00: [Firmware Info]: MMCONFIG for domain 0000 [bus 00-00] only partially covers this bridge [ 0.221280] ACPI: bus type USB registered [ 0.304179] pnp: PnP ACPI init [ 0.304830] pnp: PnP ACPI: found 0 devices
Andy Shevchenko (7): Makefile: Don't shadow actual error when compile ASL Makefile: Export build date as integer x86: acpi: Fill OEM revision x86: acpi: Name fields in FADT in accordance with specification x86: acpi: Deduplicate acpi_fill_madt() implementation x86: acpi: Export acpi_fill_mcfg() with __weak attribute x86: acpi: Don't touch hardware on HW reduced platforms
Makefile | 2 ++ arch/x86/cpu/baytrail/acpi.c | 29 --------------------------- arch/x86/cpu/quark/acpi.c | 29 --------------------------- arch/x86/include/asm/acpi_table.h | 8 +++++--- arch/x86/lib/acpi_table.c | 41 ++++++++++++++++++++++++++++++++++++--- scripts/Makefile.lib | 2 +- 6 files changed, 46 insertions(+), 65 deletions(-)
participants (3)
-
Andy Shevchenko
-
Andy Shevchenko
-
Bin Meng