Skip to contentSkip to conversation

x86: acpi: Few enhancements and improvements

PATCH New Andy Shevchenko 3 participants 29 messages Jul 21, 2017 – Jul 28, 2017

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

cover 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(-)
Signature · 1 line
2.13.2
#1 lore raw

PATCH 1/7 Makefile: Don't shadow actual error when compile ASL

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.

---
 scripts/Makefile.lib | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
scripts/Makefile.lib +1 -1
index 80ddb08474..9ce47b4d22 100644
@@ -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
Signature · 1 line
2.13.2
#2 lore raw

PATCH 1/7 Makefile: Don't shadow actual error when compile ASL

Hi Andy,

Quoted 8 lines · Andy Shevchenko

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
/*

Quoted 7 lines

and user has to remove dsdt.c and run make in order to see the error again.

---
 scripts/Makefile.lib | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Although I am not sure how to reproduce "ASL compiler failed by any reason do not produce output C file"..

Regards,
Bin

#3 lore raw

PATCH 1/7 Makefile: Don't shadow actual error when compile ASL

Quoted 14 lines · Bin Meng

Hi Andy,

Quoted 10 lines · Andy Shevchenko

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.

Quoted 8 lines
Quoted 5 lines
---
 scripts/Makefile.lib | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Thanks!

Quoted 2 lines

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.

Signature · 2 lines
With Best Regards,
Andy Shevchenko
#4 lore raw

PATCH 1/7 Makefile: Don't shadow actual error when compile ASL

Hi Andy,

Quoted 24 lines · Andy Shevchenko
Quoted 14 lines · Bin Meng

Hi Andy,

Quoted 10 lines · Andy Shevchenko

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.

Quoted 8 lines
Quoted 5 lines
---
 scripts/Makefile.lib | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Quoted 8 lines

Thanks!

Quoted 2 lines

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.

Quoted 9 lines

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 ','

Quoted 5 lines

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!

Regards,
Bin

#5 lore raw

PATCH 1/7 Makefile: Don't shadow actual error when compile ASL

Quoted 48 lines · Bin Meng

Hi Andy,

Quoted 24 lines · Andy Shevchenko
Quoted 14 lines · Bin Meng

Hi Andy,

Quoted 10 lines · Andy Shevchenko

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.

Quoted 8 lines
Quoted 5 lines
---
 scripts/Makefile.lib | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Quoted 8 lines

Thanks!

Quoted 2 lines

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.

Quoted 9 lines

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 ','

Quoted 8 lines
Quoted 5 lines

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!

applied to u-boot-x86, thanks!

#6 lore raw

PATCH 2/7 Makefile: Export build date as integer

In reply to Andy Shevchenko

In some cases we would need build date as integer value. Export U_BOOT_BUILD_DATE as %Y%m%d integer value.

---
 Makefile | 2 ++
 1 file changed, 2 insertions(+)
Makefile +2 -0
index 452596485d..71de5c656c 100644
@@ -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
 
Signature · 1 line
2.13.2
#8 lore raw

PATCH 2/7 Makefile: Export build date as integer

Quoted 5 lines · Bin Meng
Quoted 3 lines · Andy Shevchenko

In some cases we would need build date as integer value. Export U_BOOT_BUILD_DATE as %Y%m%d integer value.

Quoted 7 lines
Quoted 5 lines
---
 Makefile | 2 ++
 1 file changed, 2 insertions(+)

applied to u-boot-x86, thanks!

#9 lore raw

PATCH 3/7 x86: acpi: Fill OEM revision

In reply to Andy Shevchenko

Fill OEM revision field in the tables by U-Boot build date.

---
 arch/x86/lib/acpi_table.c | 2 ++
 1 file changed, 2 insertions(+)
arch/x86/lib/acpi_table.c +2 -0
index 01d5b6fff0..c6f4d8941c 100644
@@ -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);
 }
 
Signature · 1 line
2.13.2
#12 lore raw

PATCH 4/7 x86: acpi: Name fields in FADT in accordance with specification

In reply to Andy Shevchenko

ACPI specification defines FADT fields marked as reserved in U-Boot.

Name these fields in accordance with ACPI specification.

---
 arch/x86/include/asm/acpi_table.h | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
arch/x86/include/asm/acpi_table.h +2 -3
index dd7a946b6c..e177c441e7 100644
@@ -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;
Signature · 1 line
2.13.2
#13 lore raw

PATCH 4/7 x86: acpi: Name fields in FADT in accordance with specification

Quoted 9 lines · Andy Shevchenko

ACPI specification defines FADT fields marked as reserved in U-Boot.

Name these fields in accordance with ACPI specification.

---
 arch/x86/include/asm/acpi_table.h | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
#14 lore raw

PATCH 4/7 x86: acpi: Name fields in FADT in accordance with specification

Quoted 6 lines · Bin Meng
Quoted 4 lines · Andy Shevchenko

ACPI specification defines FADT fields marked as reserved in U-Boot.

Name these fields in accordance with ACPI specification.

Quoted 7 lines
Quoted 5 lines
---
 arch/x86/include/asm/acpi_table.h | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

applied to u-boot-x86, thanks!

#15 lore raw

PATCH 5/7 x86: acpi: Deduplicate acpi_fill_madt() implementation

In reply to Andy Shevchenko

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

---
 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(-)
arch/x86/cpu/baytrail/acpi.c +0 -29
index 55ed7de781..cbefdf871d 100644
@@ -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;
arch/x86/cpu/quark/acpi.c +0 -29
index 3968f7a8bf..5717a620b5 100644
@@ -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 */
arch/x86/lib/acpi_table.c +29 -0
index c6f4d8941c..14d10c34cd 100644
@@ -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);
Signature · 1 line
2.13.2
#16 lore raw

PATCH 5/7 x86: acpi: Deduplicate acpi_fill_madt() implementation

Quoted 7 lines · Andy Shevchenko

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

Quoted 7 lines
---
 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(-)
#17 lore raw

PATCH 5/7 x86: acpi: Deduplicate acpi_fill_madt() implementation

Quoted 17 lines · Bin Meng
Quoted 7 lines · Andy Shevchenko

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

Quoted 7 lines
---
 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(-)
Quoted 1 line

applied to u-boot-x86, thanks!

#18 lore raw

PATCH 6/7 x86: acpi: Export acpi_fill_mcfg() with __weak attribute

In reply to Andy Shevchenko

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().

---
 arch/x86/include/asm/acpi_table.h | 3 +++
 arch/x86/lib/acpi_table.c         | 6 +++---
 2 files changed, 6 insertions(+), 3 deletions(-)
arch/x86/include/asm/acpi_table.h +3 -0
index e177c441e7..80038504dd 100644
@@ -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
arch/x86/lib/acpi_table.c +3 -3
index 14d10c34cd..da6014fb41 100644
@@ -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,
Signature · 1 line
2.13.2
#19 lore raw

PATCH 6/7 x86: acpi: Export acpi_fill_mcfg() with __weak attribute

Quoted 5 lines · Andy Shevchenko

Some platforms might require different approach when filling memory mappings configuration table.

Allow them to override the common method.

Quoted 8 lines

At the same time export acpi_create_mcfg_mmconfig().

---
 arch/x86/include/asm/acpi_table.h | 3 +++
 arch/x86/lib/acpi_table.c         | 6 +++---
 2 files changed, 6 insertions(+), 3 deletions(-)
#20 lore raw

PATCH 6/7 x86: acpi: Export acpi_fill_mcfg() with __weak attribute

Quoted 9 lines · Bin Meng
Quoted 7 lines · Andy Shevchenko

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().

Quoted 8 lines
Quoted 6 lines
---
 arch/x86/include/asm/acpi_table.h | 3 +++
 arch/x86/lib/acpi_table.c         | 6 +++---
 2 files changed, 6 insertions(+), 3 deletions(-)

applied to u-boot-x86, thanks!

#21 lore raw

PATCH 7/7 x86: acpi: Don't touch hardware on HW reduced platforms

In reply to Andy Shevchenko

If ACPI HW reduced bit in FADT is set we should ignore any ACPI hardware communications.

---
 arch/x86/lib/acpi_table.c | 4 ++++
 1 file changed, 4 insertions(+)
arch/x86/lib/acpi_table.c +4 -0
index da6014fb41..3eb101105b 100644
@@ -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.
Signature · 1 line
2.13.2
#22 lore raw

PATCH 7/7 x86: acpi: Don't touch hardware on HW reduced platforms

Hi Andy,

Quoted 13 lines · Andy Shevchenko

If ACPI HW reduced bit in FADT is set we should ignore any ACPI hardware communications.

---
 arch/x86/lib/acpi_table.c | 4 ++++
 1 file changed, 4 insertions(+)
arch/x86/lib/acpi_table.c +0 -0
index da6014fb41..3eb101105b 100644

arch/x86/lib/acpi_table.c ulong write_acpi_tables(ulong start) · line 469

Quoted 7 lines
arch/x86/lib/acpi_table.c +4 -0
@@ -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;
+

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?

arch/x86/lib/acpi_table.c ulong write_acpi_tables(ulong start)

Quoted 4 lines
arch/x86/lib/acpi_table.c +0 -1
        /*
         * 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

#23 lore raw

PATCH 7/7 x86: acpi: Don't touch hardware on HW reduced platforms

Quoted 18 lines · Bin Meng

Hi Andy,

Quoted 14 lines · Andy Shevchenko

If ACPI HW reduced bit in FADT is set we should ignore any ACPI hardware communications.

---
 arch/x86/lib/acpi_table.c | 4 ++++
 1 file changed, 4 insertions(+)
arch/x86/lib/acpi_table.c +0 -0
index da6014fb41..3eb101105b 100644
@@ -463,6 +463,10 @@ ulong write_acpi_tables(ulong start)
 
Quoted 8 lines

arch/x86/lib/acpi_table.c ulong write_acpi_tables(ulong start) · line 469

Quoted 6 lines
arch/x86/lib/acpi_table.c +4 -0
        debug("ACPI: done\n");
 
+       /* Don't touch ACPI hardware on HW reduced platforms */
+       if (fadt->flags & ACPI_FADT_HW_REDUCED_ACPI)
+               return current;
+

Thanks!

Quoted 2 lines

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).

Quoted 3 lines

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,

Quoted 12 lines

arch/x86/lib/acpi_table.c ulong write_acpi_tables(ulong start)

Quoted 5 lines
arch/x86/lib/acpi_table.c +0 -1
        /*
         * 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 at lists.denx.de
https://lists.denx.de/listinfo/u-boot

Signature · 2 lines
With Best Regards,
Andy Shevchenko
#24 lore raw

PATCH 7/7 x86: acpi: Don't touch hardware on HW reduced platforms

Hi Andy,

Quoted 39 lines · Andy Shevchenko
Quoted 18 lines · Bin Meng

Hi Andy,

Quoted 14 lines · Andy Shevchenko

If ACPI HW reduced bit in FADT is set we should ignore any ACPI hardware communications.

---
 arch/x86/lib/acpi_table.c | 4 ++++
 1 file changed, 4 insertions(+)
arch/x86/lib/acpi_table.c +0 -0
index da6014fb41..3eb101105b 100644
@@ -463,6 +463,10 @@ ulong write_acpi_tables(ulong start)
 
Quoted 8 lines

arch/x86/lib/acpi_table.c ulong write_acpi_tables(ulong start) · line 469

Quoted 6 lines
arch/x86/lib/acpi_table.c +4 -0
        debug("ACPI: done\n");
 
+       /* Don't touch ACPI hardware on HW reduced platforms */
+       if (fadt->flags & ACPI_FADT_HW_REDUCED_ACPI)
+               return current;
+

Thanks!

Quoted 2 lines

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).

Quoted 9 lines
Quoted 3 lines

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

#25 lore raw

PATCH 7/7 x86: acpi: Don't touch hardware on HW reduced platforms

In reply to Andy Shevchenko

Hi Andy,

Quoted 31 lines · Andy Shevchenko
Quoted 18 lines · Bin Meng

Hi Andy,

Quoted 14 lines · Andy Shevchenko

If ACPI HW reduced bit in FADT is set we should ignore any ACPI hardware communications.

---
 arch/x86/lib/acpi_table.c | 4 ++++
 1 file changed, 4 insertions(+)
arch/x86/lib/acpi_table.c +0 -0
index da6014fb41..3eb101105b 100644
@@ -463,6 +463,10 @@ ulong write_acpi_tables(ulong start)
 
Quoted 8 lines

arch/x86/lib/acpi_table.c ulong write_acpi_tables(ulong start) · line 469

Quoted 6 lines
arch/x86/lib/acpi_table.c +4 -0
        debug("ACPI: done\n");
 
+       /* Don't touch ACPI hardware on HW reduced platforms */
+       if (fadt->flags & ACPI_FADT_HW_REDUCED_ACPI)
+               return current;
+

Thanks!

Quoted 1 line
Quoted 8 lines
Quoted 1 line

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.

Quoted 9 lines
Quoted 3 lines

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

#26 lore raw

PATCH 7/7 x86: acpi: Don't touch hardware on HW reduced platforms

Quoted 12 lines · Bin Meng

Hi Andy,

Quoted 8 lines · Andy Shevchenko
Quoted 1 line · Bin Meng

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.

Quoted 7 lines
Quoted 3 lines

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.

Signature · 2 lines
Andy Shevchenko <[email protected]>
Intel Finland Oy
#27 lore raw

PATCH 7/7 x86: acpi: Don't touch hardware on HW reduced platforms

In reply to Bin Meng
Quoted 18 lines · Bin Meng

Hi Andy,

Quoted 14 lines · Andy Shevchenko

If ACPI HW reduced bit in FADT is set we should ignore any ACPI hardware communications.

---
 arch/x86/lib/acpi_table.c | 4 ++++
 1 file changed, 4 insertions(+)
arch/x86/lib/acpi_table.c +0 -0
index da6014fb41..3eb101105b 100644
@@ -463,6 +463,10 @@ ulong write_acpi_tables(ulong start)
 
Quoted 9 lines

arch/x86/lib/acpi_table.c ulong write_acpi_tables(ulong start) · line 469

Quoted 6 lines
arch/x86/lib/acpi_table.c +4 -0
        debug("ACPI: done\n");
 
+       /* Don't touch ACPI hardware on HW reduced platforms */
+       if (fadt->flags & ACPI_FADT_HW_REDUCED_ACPI)
+               return current;
+

applied to u-boot-x86, thanks!

#28 lore raw

cover x86: acpi: Few enhancements and improvements

In reply to Andy Shevchenko
Quoted 12 lines · Andy Shevchenko

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.

Quoted 5 lines

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
Quoted 19 lines

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(-)
Signature · 2 lines
Andy Shevchenko <[email protected]>
Intel Finland Oy