* [U-Boot] [PATCH 0/4] x86: acpi: Introduce ACPI global NVS support
@ 2016-06-15 8:33 Bin Meng
2016-06-15 8:33 ` [U-Boot] [PATCH 1/4] x86: baytrail: Introduce ACPI global NVS Bin Meng
` (3 more replies)
0 siblings, 4 replies; 14+ messages in thread
From: Bin Meng @ 2016-06-15 8:33 UTC (permalink / raw)
To: u-boot
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
--
2.7.4
^ permalink raw reply [flat|nested] 14+ messages in thread
* [U-Boot] [PATCH 1/4] x86: baytrail: Introduce ACPI global NVS
2016-06-15 8:33 [U-Boot] [PATCH 0/4] x86: acpi: Introduce ACPI global NVS support Bin Meng
@ 2016-06-15 8:33 ` Bin Meng
2016-06-15 13:54 ` George McCollister
2016-06-17 3:52 ` Simon Glass
2016-06-15 8:33 ` [U-Boot] [PATCH 2/4] x86: quark: " Bin Meng
` (2 subsequent siblings)
3 siblings, 2 replies; 14+ messages in thread
From: Bin Meng @ 2016-06-15 8:33 UTC (permalink / raw)
To: u-boot
This introduces baytrail-specific ACPI global NVS structure, defined in
both C header file and ASL file.
Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
---
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
diff --git a/arch/x86/cpu/baytrail/acpi.c b/arch/x86/cpu/baytrail/acpi.c
index 5ee4868..fa92d88 100644
--- a/arch/x86/cpu/baytrail/acpi.c
+++ b/arch/x86/cpu/baytrail/acpi.c
@@ -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;
+}
diff --git a/arch/x86/include/asm/arch-baytrail/acpi/global_nvs.asl b/arch/x86/include/asm/arch-baytrail/acpi/global_nvs.asl
new file mode 100644
index 0000000..fe348b3
--- /dev/null
+++ b/arch/x86/include/asm/arch-baytrail/acpi/global_nvs.asl
@@ -0,0 +1,13 @@
+/*
+ * Copyright (C) 2016 Bin Meng <bmeng.cn@gmail.com>
+ *
+ * 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 */
+}
diff --git a/arch/x86/include/asm/arch-baytrail/global_nvs.h b/arch/x86/include/asm/arch-baytrail/global_nvs.h
new file mode 100644
index 0000000..56e3626
--- /dev/null
+++ b/arch/x86/include/asm/arch-baytrail/global_nvs.h
@@ -0,0 +1,21 @@
+/*
+ * Copyright (C) 2016, Bin Meng <bmeng.cn@gmail.com>
+ *
+ * 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_ */
--
2.7.4
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [U-Boot] [PATCH 2/4] x86: quark: Introduce ACPI global NVS
2016-06-15 8:33 [U-Boot] [PATCH 0/4] x86: acpi: Introduce ACPI global NVS support Bin Meng
2016-06-15 8:33 ` [U-Boot] [PATCH 1/4] x86: baytrail: Introduce ACPI global NVS Bin Meng
@ 2016-06-15 8:33 ` Bin Meng
2016-06-17 3:51 ` Simon Glass
2016-06-15 8:33 ` [U-Boot] [PATCH 3/4] x86: acpi: Pack global NVS into ACPI table Bin Meng
2016-06-15 8:33 ` [U-Boot] [PATCH 4/4] x86: baytrail: acpi: Hide internal UART per GNVS setting Bin Meng
3 siblings, 1 reply; 14+ messages in thread
From: Bin Meng @ 2016-06-15 8:33 UTC (permalink / raw)
To: u-boot
This introduces quark-specific ACPI global NVS structure, defined in
both C header file and ASL file.
Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
---
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
diff --git a/arch/x86/cpu/quark/acpi.c b/arch/x86/cpu/quark/acpi.c
index 8f69829..3968f7a 100644
--- a/arch/x86/cpu/quark/acpi.c
+++ b/arch/x86/cpu/quark/acpi.c
@@ -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;
+}
diff --git a/arch/x86/include/asm/arch-quark/acpi/global_nvs.asl b/arch/x86/include/asm/arch-quark/acpi/global_nvs.asl
new file mode 100644
index 0000000..3f9fd89
--- /dev/null
+++ b/arch/x86/include/asm/arch-quark/acpi/global_nvs.asl
@@ -0,0 +1,12 @@
+/*
+ * Copyright (C) 2016 Bin Meng <bmeng.cn@gmail.com>
+ *
+ * SPDX-License-Identifier: GPL-2.0+
+ */
+
+OperationRegion(GNVS, SystemMemory, 0xdeadbeef, 0x100)
+Field(GNVS, ByteAcc, NoLock, Preserve)
+{
+ Offset (0x00),
+ PCNT, 8, /* processor count */
+}
diff --git a/arch/x86/include/asm/arch-quark/global_nvs.h b/arch/x86/include/asm/arch-quark/global_nvs.h
new file mode 100644
index 0000000..0231da0
--- /dev/null
+++ b/arch/x86/include/asm/arch-quark/global_nvs.h
@@ -0,0 +1,20 @@
+/*
+ * Copyright (C) 2016, Bin Meng <bmeng.cn@gmail.com>
+ *
+ * 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_ */
--
2.7.4
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [U-Boot] [PATCH 3/4] x86: acpi: Pack global NVS into ACPI table
2016-06-15 8:33 [U-Boot] [PATCH 0/4] x86: acpi: Introduce ACPI global NVS support Bin Meng
2016-06-15 8:33 ` [U-Boot] [PATCH 1/4] x86: baytrail: Introduce ACPI global NVS Bin Meng
2016-06-15 8:33 ` [U-Boot] [PATCH 2/4] x86: quark: " Bin Meng
@ 2016-06-15 8:33 ` Bin Meng
2016-06-15 13:55 ` George McCollister
2016-06-17 3:52 ` Simon Glass
2016-06-15 8:33 ` [U-Boot] [PATCH 4/4] x86: baytrail: acpi: Hide internal UART per GNVS setting Bin Meng
3 siblings, 2 replies; 14+ messages in thread
From: Bin Meng @ 2016-06-15 8:33 UTC (permalink / raw)
To: u-boot
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 <bmeng.cn@gmail.com>
---
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(-)
diff --git a/arch/x86/include/asm/acpi_table.h b/arch/x86/include/asm/acpi_table.h
index 56aa282..caff4d8 100644
--- a/arch/x86/include/asm/acpi_table.h
+++ b/arch/x86/include/asm/acpi_table.h
@@ -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);
diff --git a/arch/x86/include/asm/arch-baytrail/acpi/platform.asl b/arch/x86/include/asm/arch-baytrail/acpi/platform.asl
index 6bc82ec..a80d2c0 100644
--- a/arch/x86/include/asm/arch-baytrail/acpi/platform.asl
+++ b/arch/x86/include/asm/arch-baytrail/acpi/platform.asl
@@ -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)
diff --git a/arch/x86/include/asm/arch-quark/acpi/platform.asl b/arch/x86/include/asm/arch-quark/acpi/platform.asl
index bd72842..1ecf153 100644
--- a/arch/x86/include/asm/arch-quark/acpi/platform.asl
+++ b/arch/x86/include/asm/arch-quark/acpi/platform.asl
@@ -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)
diff --git a/arch/x86/lib/acpi_table.c b/arch/x86/lib/acpi_table.c
index bb71286..2e4f3ab 100644
--- a/arch/x86/lib/acpi_table.c
+++ b/arch/x86/lib/acpi_table.c
@@ -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);
diff --git a/doc/README.x86 b/doc/README.x86
index a548b54..7d694b1 100644
--- a/doc/README.x86
+++ b/doc/README.x86
@@ -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
--
2.7.4
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [U-Boot] [PATCH 4/4] x86: baytrail: acpi: Hide internal UART per GNVS setting
2016-06-15 8:33 [U-Boot] [PATCH 0/4] x86: acpi: Introduce ACPI global NVS support Bin Meng
` (2 preceding siblings ...)
2016-06-15 8:33 ` [U-Boot] [PATCH 3/4] x86: acpi: Pack global NVS into ACPI table Bin Meng
@ 2016-06-15 8:33 ` Bin Meng
2016-06-15 13:57 ` George McCollister
3 siblings, 1 reply; 14+ messages in thread
From: Bin Meng @ 2016-06-15 8:33 UTC (permalink / raw)
To: u-boot
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 <bmeng.cn@gmail.com>
---
arch/x86/include/asm/arch-baytrail/acpi/lpc.asl | 19 ++++++++-----------
1 file changed, 8 insertions(+), 11 deletions(-)
diff --git a/arch/x86/include/asm/arch-baytrail/acpi/lpc.asl b/arch/x86/include/asm/arch-baytrail/acpi/lpc.asl
index 22f0d68..fe34d32 100644
--- a/arch/x86/include/asm/arch-baytrail/acpi/lpc.asl
+++ b/arch/x86/include/asm/arch-baytrail/acpi/lpc.asl
@@ -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)
+ }
}
--
2.7.4
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [U-Boot] [PATCH 1/4] x86: baytrail: Introduce ACPI global NVS
2016-06-15 8:33 ` [U-Boot] [PATCH 1/4] x86: baytrail: Introduce ACPI global NVS Bin Meng
@ 2016-06-15 13:54 ` George McCollister
2016-06-17 3:52 ` Simon Glass
1 sibling, 0 replies; 14+ messages in thread
From: George McCollister @ 2016-06-15 13:54 UTC (permalink / raw)
To: u-boot
On Wed, Jun 15, 2016 at 3:33 AM, Bin Meng <bmeng.cn@gmail.com> wrote:
> This introduces baytrail-specific ACPI global NVS structure, defined in
> both C header file and ASL file.
>
> Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
> ---
>
> 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
Reviewed-by: George McCollister <george.mccollister@gmail.com>
Tested-by: George McCollister <george.mccollister@gmail.com>
^ permalink raw reply [flat|nested] 14+ messages in thread
* [U-Boot] [PATCH 3/4] x86: acpi: Pack global NVS into ACPI table
2016-06-15 8:33 ` [U-Boot] [PATCH 3/4] x86: acpi: Pack global NVS into ACPI table Bin Meng
@ 2016-06-15 13:55 ` George McCollister
2016-06-17 3:52 ` Simon Glass
1 sibling, 0 replies; 14+ messages in thread
From: George McCollister @ 2016-06-15 13:55 UTC (permalink / raw)
To: u-boot
On Wed, Jun 15, 2016 at 3:33 AM, Bin Meng <bmeng.cn@gmail.com> wrote:
> 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 <bmeng.cn@gmail.com>
> ---
>
> 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: George McCollister <george.mccollister@gmail.com>
Tested-by: George McCollister <george.mccollister@gmail.com>
^ permalink raw reply [flat|nested] 14+ messages in thread
* [U-Boot] [PATCH 4/4] x86: baytrail: acpi: Hide internal UART per GNVS setting
2016-06-15 8:33 ` [U-Boot] [PATCH 4/4] x86: baytrail: acpi: Hide internal UART per GNVS setting Bin Meng
@ 2016-06-15 13:57 ` George McCollister
2016-06-15 14:09 ` Bin Meng
0 siblings, 1 reply; 14+ messages in thread
From: George McCollister @ 2016-06-15 13:57 UTC (permalink / raw)
To: u-boot
On Wed, Jun 15, 2016 at 3:33 AM, Bin Meng <bmeng.cn@gmail.com> wrote:
> 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 <bmeng.cn@gmail.com>
>
> ---
>
> arch/x86/include/asm/arch-baytrail/acpi/lpc.asl | 19 ++++++++-----------
> 1 file changed, 8 insertions(+), 11 deletions(-)
Reviewed-by: George McCollister <george.mccollister@gmail.com>
Tested-by: George McCollister <george.mccollister@gmail.com>
^ permalink raw reply [flat|nested] 14+ messages in thread
* [U-Boot] [PATCH 4/4] x86: baytrail: acpi: Hide internal UART per GNVS setting
2016-06-15 13:57 ` George McCollister
@ 2016-06-15 14:09 ` Bin Meng
2016-06-15 14:14 ` George McCollister
0 siblings, 1 reply; 14+ messages in thread
From: Bin Meng @ 2016-06-15 14:09 UTC (permalink / raw)
To: u-boot
Hi George,
On Wed, Jun 15, 2016 at 9:57 PM, George McCollister
<george.mccollister@gmail.com> wrote:
> On Wed, Jun 15, 2016 at 3:33 AM, Bin Meng <bmeng.cn@gmail.com> wrote:
>> 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 <bmeng.cn@gmail.com>
>>
>> ---
>>
>> arch/x86/include/asm/arch-baytrail/acpi/lpc.asl | 19 ++++++++-----------
>> 1 file changed, 8 insertions(+), 11 deletions(-)
>
> Reviewed-by: George McCollister <george.mccollister@gmail.com>
> Tested-by: George McCollister <george.mccollister@gmail.com>
Thanks for the review and testing. Does this series solve the UART
issue you were seeing when booting Linux?
Regards,
Bin
^ permalink raw reply [flat|nested] 14+ messages in thread
* [U-Boot] [PATCH 4/4] x86: baytrail: acpi: Hide internal UART per GNVS setting
2016-06-15 14:09 ` Bin Meng
@ 2016-06-15 14:14 ` George McCollister
0 siblings, 0 replies; 14+ messages in thread
From: George McCollister @ 2016-06-15 14:14 UTC (permalink / raw)
To: u-boot
On Wed, Jun 15, 2016 at 9:09 AM, Bin Meng <bmeng.cn@gmail.com> wrote:
> Hi George,
>
> On Wed, Jun 15, 2016 at 9:57 PM, George McCollister
> <george.mccollister@gmail.com> wrote:
>> On Wed, Jun 15, 2016 at 3:33 AM, Bin Meng <bmeng.cn@gmail.com> wrote:
>>> 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 <bmeng.cn@gmail.com>
>>>
>>> ---
>>>
>>> arch/x86/include/asm/arch-baytrail/acpi/lpc.asl | 19 ++++++++-----------
>>> 1 file changed, 8 insertions(+), 11 deletions(-)
>>
>> Reviewed-by: George McCollister <george.mccollister@gmail.com>
>> Tested-by: George McCollister <george.mccollister@gmail.com>
>
> 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.
>
> Regards,
> Bin
^ permalink raw reply [flat|nested] 14+ messages in thread
* [U-Boot] [PATCH 2/4] x86: quark: Introduce ACPI global NVS
2016-06-15 8:33 ` [U-Boot] [PATCH 2/4] x86: quark: " Bin Meng
@ 2016-06-17 3:51 ` Simon Glass
0 siblings, 0 replies; 14+ messages in thread
From: Simon Glass @ 2016-06-17 3:51 UTC (permalink / raw)
To: u-boot
On 15 June 2016 at 02:33, Bin Meng <bmeng.cn@gmail.com> wrote:
> This introduces quark-specific ACPI global NVS structure, defined in
> both C header file and ASL file.
>
> Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
> ---
>
> 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
Reviewed-by: Simon Glass <sjg@chromium.org>
^ permalink raw reply [flat|nested] 14+ messages in thread
* [U-Boot] [PATCH 1/4] x86: baytrail: Introduce ACPI global NVS
2016-06-15 8:33 ` [U-Boot] [PATCH 1/4] x86: baytrail: Introduce ACPI global NVS Bin Meng
2016-06-15 13:54 ` George McCollister
@ 2016-06-17 3:52 ` Simon Glass
1 sibling, 0 replies; 14+ messages in thread
From: Simon Glass @ 2016-06-17 3:52 UTC (permalink / raw)
To: u-boot
On 15 June 2016 at 02:33, Bin Meng <bmeng.cn@gmail.com> wrote:
> This introduces baytrail-specific ACPI global NVS structure, defined in
> both C header file and ASL file.
>
> Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
> ---
>
> 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
Reviewed-by: Simon Glass <sjg@chromium.org>
^ permalink raw reply [flat|nested] 14+ messages in thread
* [U-Boot] [PATCH 3/4] x86: acpi: Pack global NVS into ACPI table
2016-06-15 8:33 ` [U-Boot] [PATCH 3/4] x86: acpi: Pack global NVS into ACPI table Bin Meng
2016-06-15 13:55 ` George McCollister
@ 2016-06-17 3:52 ` Simon Glass
2016-06-17 4:53 ` Bin Meng
1 sibling, 1 reply; 14+ messages in thread
From: Simon Glass @ 2016-06-17 3:52 UTC (permalink / raw)
To: u-boot
Hi Bin,
On 15 June 2016 at 02:33, Bin Meng <bmeng.cn@gmail.com> wrote:
> 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 <bmeng.cn@gmail.com>
> ---
>
> 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 <sjg@chromium.org>
Comments/questions below
>
> diff --git a/arch/x86/include/asm/acpi_table.h b/arch/x86/include/asm/acpi_table.h
> index 56aa282..caff4d8 100644
> --- a/arch/x86/include/asm/acpi_table.h
> +++ b/arch/x86/include/asm/acpi_table.h
> @@ -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);
> diff --git a/arch/x86/include/asm/arch-baytrail/acpi/platform.asl b/arch/x86/include/asm/arch-baytrail/acpi/platform.asl
> index 6bc82ec..a80d2c0 100644
> --- a/arch/x86/include/asm/arch-baytrail/acpi/platform.asl
> +++ b/arch/x86/include/asm/arch-baytrail/acpi/platform.asl
> @@ -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)
> diff --git a/arch/x86/include/asm/arch-quark/acpi/platform.asl b/arch/x86/include/asm/arch-quark/acpi/platform.asl
> index bd72842..1ecf153 100644
> --- a/arch/x86/include/asm/arch-quark/acpi/platform.asl
> +++ b/arch/x86/include/asm/arch-quark/acpi/platform.asl
> @@ -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)
> diff --git a/arch/x86/lib/acpi_table.c b/arch/x86/lib/acpi_table.c
> index bb71286..2e4f3ab 100644
> --- a/arch/x86/lib/acpi_table.c
> +++ b/arch/x86/lib/acpi_table.c
> @@ -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;
How about:
u32 *gnvs = (u32 *)(dsdt + i)
> + if (*(u32 *)gnvs == 0xdeadbeef) {
The deadbeef comes from the .asl file, right? Can you use a #define
shared by both files?
> + 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);
> diff --git a/doc/README.x86 b/doc/README.x86
> index a548b54..7d694b1 100644
> --- a/doc/README.x86
> +++ b/doc/README.x86
> @@ -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
> --
> 2.7.4
>
Regards,
Simon
^ permalink raw reply [flat|nested] 14+ messages in thread
* [U-Boot] [PATCH 3/4] x86: acpi: Pack global NVS into ACPI table
2016-06-17 3:52 ` Simon Glass
@ 2016-06-17 4:53 ` Bin Meng
0 siblings, 0 replies; 14+ messages in thread
From: Bin Meng @ 2016-06-17 4:53 UTC (permalink / raw)
To: u-boot
Hi Simon,
On Fri, Jun 17, 2016 at 11:52 AM, Simon Glass <sjg@chromium.org> wrote:
> Hi Bin,
>
> On 15 June 2016 at 02:33, Bin Meng <bmeng.cn@gmail.com> wrote:
>> 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 <bmeng.cn@gmail.com>
>> ---
>>
>> 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 <sjg@chromium.org>
>
> Comments/questions below
>
>>
>> diff --git a/arch/x86/include/asm/acpi_table.h b/arch/x86/include/asm/acpi_table.h
>> index 56aa282..caff4d8 100644
>> --- a/arch/x86/include/asm/acpi_table.h
>> +++ b/arch/x86/include/asm/acpi_table.h
>> @@ -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);
>> diff --git a/arch/x86/include/asm/arch-baytrail/acpi/platform.asl b/arch/x86/include/asm/arch-baytrail/acpi/platform.asl
>> index 6bc82ec..a80d2c0 100644
>> --- a/arch/x86/include/asm/arch-baytrail/acpi/platform.asl
>> +++ b/arch/x86/include/asm/arch-baytrail/acpi/platform.asl
>> @@ -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)
>> diff --git a/arch/x86/include/asm/arch-quark/acpi/platform.asl b/arch/x86/include/asm/arch-quark/acpi/platform.asl
>> index bd72842..1ecf153 100644
>> --- a/arch/x86/include/asm/arch-quark/acpi/platform.asl
>> +++ b/arch/x86/include/asm/arch-quark/acpi/platform.asl
>> @@ -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)
>> diff --git a/arch/x86/lib/acpi_table.c b/arch/x86/lib/acpi_table.c
>> index bb71286..2e4f3ab 100644
>> --- a/arch/x86/lib/acpi_table.c
>> +++ b/arch/x86/lib/acpi_table.c
>> @@ -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;
>
> 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?
>
>> + 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.
>> + 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);
>> diff --git a/doc/README.x86 b/doc/README.x86
>> index a548b54..7d694b1 100644
>> --- a/doc/README.x86
>> +++ b/doc/README.x86
>> @@ -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
>> --
Regards,
Bin
^ permalink raw reply [flat|nested] 14+ messages in thread
end of thread, other threads:[~2016-06-17 4:53 UTC | newest]
Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-06-15 8:33 [U-Boot] [PATCH 0/4] x86: acpi: Introduce ACPI global NVS support Bin Meng
2016-06-15 8:33 ` [U-Boot] [PATCH 1/4] x86: baytrail: Introduce ACPI global NVS Bin Meng
2016-06-15 13:54 ` George McCollister
2016-06-17 3:52 ` Simon Glass
2016-06-15 8:33 ` [U-Boot] [PATCH 2/4] x86: quark: " Bin Meng
2016-06-17 3:51 ` Simon Glass
2016-06-15 8:33 ` [U-Boot] [PATCH 3/4] x86: acpi: Pack global NVS into ACPI table Bin Meng
2016-06-15 13:55 ` George McCollister
2016-06-17 3:52 ` Simon Glass
2016-06-17 4:53 ` Bin Meng
2016-06-15 8:33 ` [U-Boot] [PATCH 4/4] x86: baytrail: acpi: Hide internal UART per GNVS setting Bin Meng
2016-06-15 13:57 ` George McCollister
2016-06-15 14:09 ` Bin Meng
2016-06-15 14:14 ` George McCollister
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.