x86: acpi: Introduce ACPI global NVS support
cover x86: acpi: Introduce ACPI global NVS support
ACPI global NVS is an area in system memory with various platform defined variables that can be utilized between U-Boot and ACPI ASL codes. U-Boot set these variables at runtime, so that ASL codes can test these variables to provide some runtime flexiblity.
Tested on MinnowMax with CONFIG_INTERNAL_UART set to off, and install a Windows 10, check the internal UART is not exposed in the Windows device manager.
This series is available at u-boot-x86/gnvs-working.
Bin Meng (4):
x86: baytrail: Introduce ACPI global NVS
x86: quark: Introduce ACPI global NVS
x86: acpi: Pack global NVS into ACPI table
x86: baytrail: acpi: Hide internal UART per GNVS setting
arch/x86/cpu/baytrail/acpi.c | 26 ++++++++++++++++++++++ arch/x86/cpu/quark/acpi.c | 7 ++++++ arch/x86/include/asm/acpi_table.h | 4 ++++ .../include/asm/arch-baytrail/acpi/global_nvs.asl | 13 +++++++++++ arch/x86/include/asm/arch-baytrail/acpi/lpc.asl | 19 +++++++--------- .../include/asm/arch-baytrail/acpi/platform.asl | 3 +++ arch/x86/include/asm/arch-baytrail/global_nvs.h | 21 +++++++++++++++++ .../x86/include/asm/arch-quark/acpi/global_nvs.asl | 12 ++++++++++ arch/x86/include/asm/arch-quark/acpi/platform.asl | 3 +++ arch/x86/include/asm/arch-quark/global_nvs.h | 20 +++++++++++++++++ arch/x86/lib/acpi_table.c | 21 +++++++++++++++++ doc/README.x86 | 2 -- 12 files changed, 138 insertions(+), 13 deletions(-) create mode 100644 arch/x86/include/asm/arch-baytrail/acpi/global_nvs.asl create mode 100644 arch/x86/include/asm/arch-baytrail/global_nvs.h create mode 100644 arch/x86/include/asm/arch-quark/acpi/global_nvs.asl create mode 100644 arch/x86/include/asm/arch-quark/global_nvs.h
Signature · 1 line
2.7.4
PATCH 1/4 x86: baytrail: Introduce ACPI global NVS
This introduces baytrail-specific ACPI global NVS structure, defined in both C header file and ASL file.
---
arch/x86/cpu/baytrail/acpi.c | 26 ++++++++++++++++++++++ .../include/asm/arch-baytrail/acpi/global_nvs.asl | 13 +++++++++++ arch/x86/include/asm/arch-baytrail/global_nvs.h | 21 +++++++++++++++++ 3 files changed, 60 insertions(+) create mode 100644 arch/x86/include/asm/arch-baytrail/acpi/global_nvs.asl create mode 100644 arch/x86/include/asm/arch-baytrail/global_nvs.h
arch/x86/cpu/baytrail/acpi.c +26 -0
@@ -5,10 +5,14 @@*/ #include <common.h> +#include <cpu.h> +#include <dm.h> +#include <dm/uclass-internal.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> void acpi_create_fadt(struct acpi_fadt *fadt, struct acpi_facs *facs,
@@ -161,3 +165,25 @@ u32 acpi_fill_madt(u32 current)return current; } + +void acpi_create_gnvs (struct acpi_global_nvs *gnvs) +{ +struct udevice *dev; +int ret; + +/* at least we have one processor */ + gnvs->pcnt =1 ; +/* override the processor count with actual number */ + ret =uclass_find_first_device (UCLASS_CPU , &dev); +if (ret ==0 && dev !=NULL ) { + ret =cpu_get_count (dev); +if (ret >0 ) + gnvs->pcnt = ret; + } + +/* determine whether internal uart is on */ +if (IS_ENABLED (CONFIG_INTERNAL_UART )) + gnvs->iuart_en =1 ; +else + gnvs->iuart_en =0 ; +}
arch/x86/include/asm/arch-baytrail/acpi/global_nvs.asl new file +13 -0
@@ -0,0 +1,13 @@ +/* + * Copyright (C) 2016 Bin Meng <[email protected]> + * + * SPDX-License-Identifier: GPL-2.0+ + */ + +OperationRegion(GNVS, SystemMemory, 0xdeadbeef, 0x100) +Field(GNVS, ByteAcc, NoLock, Preserve) +{ + Offset (0x00), + PCNT, 8, /* processor count */ + IURE, 8, /* internal UART enabled */ +}
arch/x86/include/asm/arch-baytrail/global_nvs.h new file +21 -0
@@ -0,0 +1,21 @@ +/* +* Copyright (C) 2016, Bin Meng <[email protected]> +* +* SPDX-License-Identifier: GPL-2.0+ +*/ + +#ifndef _GLOBAL_NVS_H_ +#define _GLOBAL_NVS_H_ + +struct __packed acpi_global_nvs { +u8 pcnt;/* processor count */ +u8 iuart_en;/* internal UART enabled */ + +/* +* Add padding so sizeof(struct acpi_global_nvs) == 0x100. +* This must match the size defined in the global_nvs.asl. +*/ +u8 rsvd[254 ]; +}; + +#endif /* _GLOBAL_NVS_H_ */
Signature · 1 line
2.7.4
PATCH 2/4 x86: quark: Introduce ACPI global NVS
In reply to Bin MengThis introduces quark-specific ACPI global NVS structure, defined in both C header file and ASL file.
---
arch/x86/cpu/quark/acpi.c | 7 +++++++ arch/x86/include/asm/arch-quark/acpi/global_nvs.asl | 12 ++++++++++++ arch/x86/include/asm/arch-quark/global_nvs.h | 20 ++++++++++++++++++++ 3 files changed, 39 insertions(+) create mode 100644 arch/x86/include/asm/arch-quark/acpi/global_nvs.asl create mode 100644 arch/x86/include/asm/arch-quark/global_nvs.h
arch/x86/cpu/quark/acpi.c +7 -0
@@ -9,6 +9,7 @@#include <asm/ioapic.h> #include <asm/mpspec.h> #include <asm/tables.h> +#include <asm/arch/global_nvs.h> #include <asm/arch/iomap.h> void acpi_create_fadt(struct acpi_fadt *fadt, struct acpi_facs *facs,
@@ -161,3 +162,9 @@ u32 acpi_fill_madt(u32 current)return current; } + +void acpi_create_gnvs (struct acpi_global_nvs *gnvs) +{ +/* quark is a uni-processor */ + gnvs->pcnt =1 ; +}
arch/x86/include/asm/arch-quark/acpi/global_nvs.asl new file +12 -0
@@ -0,0 +1,12 @@ +/* + * Copyright (C) 2016 Bin Meng <[email protected]> + * + * SPDX-License-Identifier: GPL-2.0+ + */ + +OperationRegion(GNVS, SystemMemory, 0xdeadbeef, 0x100) +Field(GNVS, ByteAcc, NoLock, Preserve) +{ + Offset (0x00), + PCNT, 8, /* processor count */ +}
arch/x86/include/asm/arch-quark/global_nvs.h new file +20 -0
@@ -0,0 +1,20 @@ +/* +* Copyright (C) 2016, Bin Meng <[email protected]> +* +* SPDX-License-Identifier: GPL-2.0+ +*/ + +#ifndef _GLOBAL_NVS_H_ +#define _GLOBAL_NVS_H_ + +struct __packed acpi_global_nvs { +u8 pcnt;/* processor count */ + +/* +* Add padding so sizeof(struct acpi_global_nvs) == 0x100. +* This must match the size defined in the global_nvs.asl. +*/ +u8 rsvd[255 ]; +}; + +#endif /* _GLOBAL_NVS_H_ */
Signature · 1 line
2.7.4
PATCH 3/4 x86: acpi: Pack global NVS into ACPI table
In reply to Bin MengNow that platform-specific ACPI global NVS is added, pack it into ACPI table and get its address fixed up.
---
arch/x86/include/asm/acpi_table.h | 4 ++++ .../x86/include/asm/arch-baytrail/acpi/platform.asl | 3 +++ arch/x86/include/asm/arch-quark/acpi/platform.asl | 3 +++ arch/x86/lib/acpi_table.c | 21 +++++++++++++++++++++ doc/README.x86 | 2 -- 5 files changed, 31 insertions(+), 2 deletions(-)
arch/x86/include/asm/acpi_table.h +4 -0
@@ -299,6 +299,9 @@ struct acpi_mcfg_mmconfig {/* PM1_CNT bit defines */ #define PM1_CNT_SCI_EN (1 << 0) +/* ACPI global NVS structure */ +struct acpi_global_nvs ; +/* These can be used by the target port */ void acpi_fill_header (struct acpi_table_header *header,char *signature);
@@ -312,4 +315,5 @@ 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); +void acpi_create_gnvs (struct acpi_global_nvs *gnvs);u32 write_acpi_tables (u32 start);
arch/x86/include/asm/arch-baytrail/acpi/platform.asl +3 -0
@@ -22,6 +22,9 @@ Method(_WAK, 1) Return (Package() {0, 0}) } +/* ACPI global NVS */ +#include "global_nvs.asl" + /* TODO: add CPU ASL support */ Scope (\_SB)
arch/x86/include/asm/arch-quark/acpi/platform.asl +3 -0
@@ -22,6 +22,9 @@ Method(_WAK, 1) Return (Package() {0, 0}) } +/* ACPI global NVS */ +#include "global_nvs.asl" + /* TODO: add CPU ASL support */ Scope (\_SB)
arch/x86/lib/acpi_table.c +21 -0
@@ -15,6 +15,7 @@#include <asm/io.h> #include <asm/lapic.h> #include <asm/tables.h> +#include <asm/arch/global_nvs.h> /* * IASL compiles the dsdt entries and writes the hex values
@@ -336,6 +337,7 @@ u32 write_acpi_tables(u32 start)struct acpi_fadt *fadt;struct acpi_mcfg *mcfg;struct acpi_madt *madt; +int i; current = start;
@@ -383,6 +385,25 @@ u32 write_acpi_tables(u32 start) current += dsdt->length -sizeof (struct acpi_table_header ); current =ALIGN (current,16 ); +/* Pack GNVS into the ACPI table area */ +for (i =0 ; i < dsdt->length; i++) { +u32 gnvs = (u32 )dsdt + i; +if (*(u32 *)gnvs ==0xdeadbeef ) { +debug ("Fix up global NVS in DSDT to 0x%08x\n" , current); + *(u32 *)gnvs = current; +break ; + } + } + +/* Update DSDT checksum since we patched the GNVS address */ + dsdt->checksum =0 ; + dsdt->checksum =table_compute_checksum ((void *)dsdt, dsdt->length); + +/* Fill in platform-specific global NVS variables */ +acpi_create_gnvs ((struct acpi_global_nvs *)current); + current +=sizeof (struct acpi_global_nvs ); + current =ALIGN (current,16 ); +debug ("ACPI: * FADT\n" ); fadt = (struct acpi_fadt *)current; current +=sizeof (struct acpi_fadt );
doc/README.x86 +0 -2
@@ -1020,8 +1020,6 @@ Features not supported so far (to make it a complete ACPI solution): * S3 (Suspend to RAM), S4 (Suspend to Disk). Features that are optional: - * ACPI global NVS support. We may need it to simplify ASL code logic if - utilizing NVS variables. Most likely we will need this sooner or later. * Dynamic AML bytecodes insertion at run-time. We may need this to support SSDT table generation and DSDT fix up. * SMI support. Since U-Boot is a modern bootloader, we don't want to bring
Signature · 1 line
2.7.4
PATCH 4/4 x86: baytrail: acpi: Hide internal UART per GNVS setting
In reply to Bin MengIf global NVS says internal UART is not enabled, hide it in the ASL code so that OS won't see it.
---
arch/x86/include/asm/arch-baytrail/acpi/lpc.asl | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-)
arch/x86/include/asm/arch-baytrail/acpi/lpc.asl +8 -11
@@ -119,17 +119,14 @@ Device (LPCB) Method(_STA, 0, Serialized) { - /* - * TODO: - * - * Need to hide the internal UART depending on whether - * internal UART is enabled or not so that external - * SuperIO UART can be exposed to system. - */ - Store(1, UI3E) - Store(1, UI4E) - Store(1, C1EN) - Return (STA_VISIBLE) + If (LEqual(IURE, 1)) { + Store(1, UI3E) + Store(1, UI4E) + Store(1, C1EN) + Return (STA_VISIBLE) + } Else { + Return (STA_MISSING) + } }
Signature · 1 line
2.7.4
PATCH 1/4 x86: baytrail: Introduce ACPI global NVS
In reply to Bin MengQuoted 4 lines · Bin Meng
This introduces baytrail-specific ACPI global NVS structure, defined in both C header file and ASL file.
Signed-off-by Bin Meng <[email protected]>
Quoted 8 lines
---
arch/x86/cpu/baytrail/acpi.c | 26 ++++++++++++++++++++++ .../include/asm/arch-baytrail/acpi/global_nvs.asl | 13 +++++++++++ arch/x86/include/asm/arch-baytrail/global_nvs.h | 21 +++++++++++++++++ 3 files changed, 60 insertions(+) create mode 100644 arch/x86/include/asm/arch-baytrail/acpi/global_nvs.asl create mode 100644 arch/x86/include/asm/arch-baytrail/global_nvs.h
PATCH 3/4 x86: acpi: Pack global NVS into ACPI table
In reply to Bin MengQuoted 4 lines · Bin Meng
Now that platform-specific ACPI global NVS is added, pack it into ACPI table and get its address fixed up.
Signed-off-by Bin Meng <[email protected]>
Quoted 8 lines
---
arch/x86/include/asm/acpi_table.h | 4 ++++ .../x86/include/asm/arch-baytrail/acpi/platform.asl | 3 +++ arch/x86/include/asm/arch-quark/acpi/platform.asl | 3 +++ arch/x86/lib/acpi_table.c | 21 +++++++++++++++++++++ doc/README.x86 | 2 -- 5 files changed, 31 insertions(+), 2 deletions(-)
PATCH 4/4 x86: baytrail: acpi: Hide internal UART per GNVS setting
In reply to Bin MengQuoted 9 lines · Bin Meng
If global NVS says internal UART is not enabled, hide it in the ASL code so that OS won't see it.
Signed-off-by Bin Meng <[email protected]>---
arch/x86/include/asm/arch-baytrail/acpi/lpc.asl | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-)
PATCH 4/4 x86: baytrail: acpi: Hide internal UART per GNVS setting
Hi George,
Quoted 6 lines · George McCollister
Quoted 5 lines · Bin Meng
If global NVS says internal UART is not enabled, hide it in the ASL code so that OS won't see it.
Signed-off-by Bin Meng <[email protected]>
Quoted 7 lines
Quoted 4 lines
---
arch/x86/include/asm/arch-baytrail/acpi/lpc.asl | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-)Reviewed-by George McCollister <[email protected]>Tested-by George McCollister <[email protected]>
Thanks for the review and testing. Does this series solve the UART issue you were seeing when booting Linux?
Regards,
Bin
PATCH 4/4 x86: baytrail: acpi: Hide internal UART per GNVS setting
Quoted 12 lines · Bin Meng
Hi George,
Quoted 8 lines · George McCollister
Quoted 7 lines · Bin Meng
If global NVS says internal UART is not enabled, hide it in the ASL code so that OS won't see it.
Signed-off-by Bin Meng <[email protected]>---
Quoted 8 lines
Quoted 5 lines
Quoted 2 lines
arch/x86/include/asm/arch-baytrail/acpi/lpc.asl | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-)Reviewed-by George McCollister <[email protected]>Tested-by George McCollister <[email protected]>Thanks for the review and testing. Does this series solve the UART issue you were seeing when booting Linux?
Yes, it works perfectly now. Thanks.
Quoted 3 lines
Regards,
Bin
PATCH 2/4 x86: quark: Introduce ACPI global NVS
In reply to Bin MengQuoted 4 lines · Bin Meng
This introduces quark-specific ACPI global NVS structure, defined in both C header file and ASL file.
Signed-off-by Bin Meng <[email protected]>
Quoted 8 lines
---
arch/x86/cpu/quark/acpi.c | 7 +++++++ arch/x86/include/asm/arch-quark/acpi/global_nvs.asl | 12 ++++++++++++ arch/x86/include/asm/arch-quark/global_nvs.h | 20 ++++++++++++++++++++ 3 files changed, 39 insertions(+) create mode 100644 arch/x86/include/asm/arch-quark/acpi/global_nvs.asl create mode 100644 arch/x86/include/asm/arch-quark/global_nvs.h
PATCH 1/4 x86: baytrail: Introduce ACPI global NVS
In reply to Bin MengQuoted 4 lines · Bin Meng
This introduces baytrail-specific ACPI global NVS structure, defined in both C header file and ASL file.
Signed-off-by Bin Meng <[email protected]>
Quoted 8 lines
---
arch/x86/cpu/baytrail/acpi.c | 26 ++++++++++++++++++++++ .../include/asm/arch-baytrail/acpi/global_nvs.asl | 13 +++++++++++ arch/x86/include/asm/arch-baytrail/global_nvs.h | 21 +++++++++++++++++ 3 files changed, 60 insertions(+) create mode 100644 arch/x86/include/asm/arch-baytrail/acpi/global_nvs.asl create mode 100644 arch/x86/include/asm/arch-baytrail/global_nvs.h
PATCH 3/4 x86: acpi: Pack global NVS into ACPI table
In reply to Bin MengHi Bin,
Quoted 4 lines · Bin Meng
Now that platform-specific ACPI global NVS is added, pack it into ACPI table and get its address fixed up.
Signed-off-by Bin Meng <[email protected]>
Quoted 8 lines
---
arch/x86/include/asm/acpi_table.h | 4 ++++ .../x86/include/asm/arch-baytrail/acpi/platform.asl | 3 +++ arch/x86/include/asm/arch-quark/acpi/platform.asl | 3 +++ arch/x86/lib/acpi_table.c | 21 +++++++++++++++++++++ doc/README.x86 | 2 -- 5 files changed, 31 insertions(+), 2 deletions(-)
Comments/questions below
Quoted 70 lines
arch/x86/include/asm/acpi_table.h +4
-0@@ -299,6 +299,9 @@ struct acpi_mcfg_mmconfig {/* PM1_CNT bit defines */ #define PM1_CNT_SCI_EN (1 << 0) +/* ACPI global NVS structure */ +struct acpi_global_nvs ; +/* These can be used by the target port */ void acpi_fill_header (struct acpi_table_header *header,char *signature);@@ -312,4 +315,5 @@ 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); +void acpi_create_gnvs (struct acpi_global_nvs *gnvs);u32 write_acpi_tables (u32 start);arch/x86/include/asm/arch-baytrail/acpi/platform.asl +3
-0@@ -22,6 +22,9 @@ Method(_WAK, 1) Return (Package() {0, 0}) } +/* ACPI global NVS */ +#include "global_nvs.asl" + /* TODO: add CPU ASL support */ Scope (\_SB)arch/x86/include/asm/arch-quark/acpi/platform.asl +3
-0@@ -22,6 +22,9 @@ Method(_WAK, 1) Return (Package() {0, 0}) } +/* ACPI global NVS */ +#include "global_nvs.asl" + /* TODO: add CPU ASL support */ Scope (\_SB)arch/x86/lib/acpi_table.c +2
-0@@ -15,6 +15,7 @@#include <asm/io.h> #include <asm/lapic.h> #include <asm/tables.h> +#include <asm/arch/global_nvs.h> /* * IASL compiles the dsdt entries and writes the hex values @@ -336,6 +337,7 @@ u32 write_acpi_tables(u32 start)struct acpi_fadt *fadt;struct acpi_mcfg *mcfg;struct acpi_madt *madt; +int i; current = start;
arch/x86/lib/acpi_table.c u32 write_acpi_tables(u32 start) · line 390
Quoted 6 lines
arch/x86/lib/acpi_table.c +3
-0@@ -383,6 +385,25 @@ u32 write_acpi_tables(u32 start) current += dsdt->length -sizeof (struct acpi_table_header ); current =ALIGN (current,16 ); +/* Pack GNVS into the ACPI table area */ +for (i =0 ; i < dsdt->length; i++) { +u32 gnvs = (u32 )dsdt + i;
How about:
u32 *gnvs = (u32 *)(dsdt + i)
arch/x86/lib/acpi_table.c u32 write_acpi_tables(u32 start) · line 391
Quoted 1 line
arch/x86/lib/acpi_table.c +1
-0+if (*(u32 *)gnvs ==0xdeadbeef ) {
The deadbeef comes from the .asl file, right? Can you use a #define shared by both files?
Quoted 32 lines
arch/x86/lib/acpi_table.c +15
-0+debug ("Fix up global NVS in DSDT to 0x%08x\n" , current); + *(u32 *)gnvs = current; +break ; + } + } + +/* Update DSDT checksum since we patched the GNVS address */ + dsdt->checksum =0 ; + dsdt->checksum =table_compute_checksum ((void *)dsdt, dsdt->length); + +/* Fill in platform-specific global NVS variables */ +acpi_create_gnvs ((struct acpi_global_nvs *)current); + current +=sizeof (struct acpi_global_nvs ); + current =ALIGN (current,16 ); +debug ("ACPI: * FADT\n" ); fadt = (struct acpi_fadt *)current; current +=sizeof (struct acpi_fadt );doc/README.x86 +0
-3@@ -1020,8 +1020,6 @@ Features not supported so far (to make it a complete ACPI solution): * S3 (Suspend to RAM), S4 (Suspend to Disk). Features that are optional: - * ACPI global NVS support. We may need it to simplify ASL code logic if - utilizing NVS variables. Most likely we will need this sooner or later. * Dynamic AML bytecodes insertion at run-time. We may need this to support SSDT table generation and DSDT fix up. * SMI support. Since U-Boot is a modern bootloader, we don't want to bring --
Quoted 2 lines
2.7.4
Regards,
Simon
PATCH 3/4 x86: acpi: Pack global NVS into ACPI table
Hi Simon,
Quoted 93 lines · Simon Glass
Hi Bin,
Quoted 4 lines · Bin Meng
Now that platform-specific ACPI global NVS is added, pack it into ACPI table and get its address fixed up.
Signed-off-by Bin Meng <[email protected]>Quoted 8 lines
---
arch/x86/include/asm/acpi_table.h | 4 ++++ .../x86/include/asm/arch-baytrail/acpi/platform.asl | 3 +++ arch/x86/include/asm/arch-quark/acpi/platform.asl | 3 +++ arch/x86/lib/acpi_table.c | 21 +++++++++++++++++++++ doc/README.x86 | 2 -- 5 files changed, 31 insertions(+), 2 deletions(-)Reviewed-by Simon Glass <[email protected]>Comments/questions below
Quoted 73 lines
arch/x86/include/asm/acpi_table.h +4
-0@@ -299,6 +299,9 @@ struct acpi_mcfg_mmconfig {/* PM1_CNT bit defines */ #define PM1_CNT_SCI_EN (1 << 0) +/* ACPI global NVS structure */ +struct acpi_global_nvs ; +/* These can be used by the target port */ void acpi_fill_header (struct acpi_table_header *header,char *signature);@@ -312,4 +315,5 @@ 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); +void acpi_create_gnvs (struct acpi_global_nvs *gnvs);u32 write_acpi_tables (u32 start);arch/x86/include/asm/arch-baytrail/acpi/platform.asl +3
-0@@ -22,6 +22,9 @@ Method(_WAK, 1) Return (Package() {0, 0}) } +/* ACPI global NVS */ +#include "global_nvs.asl" + /* TODO: add CPU ASL support */ Scope (\_SB)arch/x86/include/asm/arch-quark/acpi/platform.asl +3
-0@@ -22,6 +22,9 @@ Method(_WAK, 1) Return (Package() {0, 0}) } +/* ACPI global NVS */ +#include "global_nvs.asl" + /* TODO: add CPU ASL support */ Scope (\_SB)arch/x86/lib/acpi_table.c +2
-0@@ -15,6 +15,7 @@#include <asm/io.h> #include <asm/lapic.h> #include <asm/tables.h> +#include <asm/arch/global_nvs.h> /* * IASL compiles the dsdt entries and writes the hex values @@ -336,6 +337,7 @@ u32 write_acpi_tables(u32 start)struct acpi_fadt *fadt;struct acpi_mcfg *mcfg;struct acpi_madt *madt; +int i; current = start;@@ -383,6 +385,25 @@ u32 write_acpi_tables(u32 start) current += dsdt->length -sizeof (struct acpi_table_header ); current =ALIGN (current,16 );
Quoted 7 lines
arch/x86/lib/acpi_table.c u32 write_acpi_tables(u32 start) · line 390
Quoted 3 lines
arch/x86/lib/acpi_table.c +3
-0+/* Pack GNVS into the ACPI table area */ +for (i =0 ; i < dsdt->length; i++) { +u32 gnvs = (u32 )dsdt + i;How about:
u32 *gnvs = (u32 *)(dsdt + i)
(dsdt + i) points to wrong place, it should be:
u32 *gnvs = (u32 *)((u32)dsdt + i);
Which way do you prefer?
Quoted 6 lines
arch/x86/lib/acpi_table.c u32 write_acpi_tables(u32 start) · line 391
Quoted 2 lines
arch/x86/lib/acpi_table.c +1
-0+if (*(u32 *)gnvs ==0xdeadbeef ) {The deadbeef comes from the .asl file, right? Can you use a #define shared by both files?
Yes, they have to match. Will do in v2.
Quoted 25 lines
Quoted 25 lines
arch/x86/lib/acpi_table.c +15
-0+debug ("Fix up global NVS in DSDT to 0x%08x\n" , current); + *(u32 *)gnvs = current; +break ; + } + } + +/* Update DSDT checksum since we patched the GNVS address */ + dsdt->checksum =0 ; + dsdt->checksum =table_compute_checksum ((void *)dsdt, dsdt->length); + +/* Fill in platform-specific global NVS variables */ +acpi_create_gnvs ((struct acpi_global_nvs *)current); + current +=sizeof (struct acpi_global_nvs ); + current =ALIGN (current,16 ); +debug ("ACPI: * FADT\n" ); fadt = (struct acpi_fadt *)current; current +=sizeof (struct acpi_fadt );doc/README.x86 +0
-0@@ -1020,8 +1020,6 @@ Features not supported so far (to make it a complete ACPI solution): * S3 (Suspend to RAM), S4 (Suspend to Disk).
Quoted 7 lines
doc/README.x86 Features not supported so far (to make it a complete ACPI solution):
Quoted 7 lines
doc/README.x86 +0
-3Features that are optional: - * ACPI global NVS support. We may need it to simplify ASL code logic if - utilizing NVS variables. Most likely we will need this sooner or later. * Dynamic AML bytecodes insertion at run-time. We may need this to support SSDT table generation and DSDT fix up. * SMI support. Since U-Boot is a modern bootloader, we don't want to bring --
Regards,
Bin