All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 0/8] ACPI: parse the DBG2 table
@ 2016-02-24 17:10 ` Aleksey Makarov
  0 siblings, 0 replies; 34+ messages in thread
From: Aleksey Makarov @ 2016-02-24 17:10 UTC (permalink / raw)
  To: linux-acpi
  Cc: linux-serial, linux-kernel, linux-arm-kernel, Aleksey Makarov,
	Russell King, Greg Kroah-Hartman, Rafael J . Wysocki,
	Leif Lindholm, Graeme Gregory, Al Stone, Christopher Covington

"ARM Server Base Boot Requiremets" [1] mentions DBG2 (Microsoft Debug
Port Table 2) [2] as a mandatory ACPI table that specifies debug ports.

- Move acpi/dt decision earlier in boot process on ARM64
- Move earlycon early_param handling to serial to parse earlycon option once
- Add definition of DBG2 subtypes.  It's the same patch as in the SPCR series [3]
- Refactor ACPI linker tables code to enable iterating over subtables other than
  subtables having acpi_subtype header (such as DBG2)
- Implement macros

	ACPI_DBG2_DECLARE(name, type, subtype, setup_fn, data_ptr)

  that defines a handler for the port of the given type and subtype.
- For each port defined by that macros that is also described in the ACPI DBG2
  table call provided callback.
- Implement a helper macros that can be used to define early serial console
- Enable DBG2 on ARM64
- Define early console for pl011 serial

Based on the original work by Leif Lindholm <leif.lindholm@linaro.org> [4]

Should be applied to next-20160224.

Tested on last QEMU with patches that introduce DBG2 and fix a QEMU bug:

https://git.linaro.org/people/aleksey.makarov/qemu.git amakarov/gdb2.03

v2:
- Fix parse_acpi() (Matthias Brugger)
- Add a reference to QEMU DBG2 patches and to original work
- Rebase to the last linux-next

v1:
https://lkml.kernel.org/g/1456148818-26257-1-git-send-email-aleksey.makarov@linaro.org

[1] http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.den0044a/index.html
[2] http://go.microsoft.com/fwlink/p/?LinkId=234837
[3] https://lkml.kernel.org/g/1455559532-8305-1-git-send-email-aleksey.makarov@linaro.org
[4] https://lkml.kernel.org/g/1441716217-23786-1-git-send-email-leif.lindholm@linaro.org

Aleksey Makarov (6):
  ACPI: add definitions of DBG2 subtypes
  ACPI: genaralize iterating over subtables in ACPI_PROBE_TABLE()
  ACPI: parse DBG2 table
  ACPI: serial: implement earlycon on ACPI DBG2 port
  ACPI: enable ACPI_DBG2_TABLE on ARM64
  serial: pl011: add ACPI DBG2 serial port

Leif Lindholm (2):
  arm64: move acpi/dt decision earlier in boot process
  of/serial: move earlycon early_param handling to serial

 Documentation/kernel-parameters.txt  |   3 +
 arch/arm64/Kconfig                   |   1 +
 arch/arm64/kernel/acpi.c             |  64 ++++++++++-----------
 drivers/acpi/Kconfig                 |   3 +
 drivers/acpi/Makefile                |   1 +
 drivers/acpi/dbg2.c                  |  85 ++++++++++++++++++++++++++++
 drivers/acpi/scan.c                  |  44 ++++++++++-----
 drivers/clocksource/arm_arch_timer.c |   3 +-
 drivers/irqchip/irq-gic.c            |   4 +-
 drivers/of/fdt.c                     |  11 +---
 drivers/tty/serial/amba-pl011.c      |   3 +
 drivers/tty/serial/earlycon.c        |  61 ++++++++++++++++++++
 include/acpi/actbl2.h                |   5 ++
 include/asm-generic/vmlinux.lds.h    |   1 +
 include/linux/acpi.h                 | 104 ++++++++++++++++++++++++-----------
 include/linux/acpi_dbg2.h            |  68 +++++++++++++++++++++++
 include/linux/clocksource.h          |   2 +-
 include/linux/irqchip.h              |   5 +-
 include/linux/of_fdt.h               |   2 +
 19 files changed, 375 insertions(+), 95 deletions(-)
 create mode 100644 drivers/acpi/dbg2.c
 create mode 100644 include/linux/acpi_dbg2.h

-- 
2.7.1


^ permalink raw reply	[flat|nested] 34+ messages in thread

* [PATCH v2 0/8] ACPI: parse the DBG2 table
@ 2016-02-24 17:10 ` Aleksey Makarov
  0 siblings, 0 replies; 34+ messages in thread
From: Aleksey Makarov @ 2016-02-24 17:10 UTC (permalink / raw)
  To: linux-arm-kernel

"ARM Server Base Boot Requiremets" [1] mentions DBG2 (Microsoft Debug
Port Table 2) [2] as a mandatory ACPI table that specifies debug ports.

- Move acpi/dt decision earlier in boot process on ARM64
- Move earlycon early_param handling to serial to parse earlycon option once
- Add definition of DBG2 subtypes.  It's the same patch as in the SPCR series [3]
- Refactor ACPI linker tables code to enable iterating over subtables other than
  subtables having acpi_subtype header (such as DBG2)
- Implement macros

	ACPI_DBG2_DECLARE(name, type, subtype, setup_fn, data_ptr)

  that defines a handler for the port of the given type and subtype.
- For each port defined by that macros that is also described in the ACPI DBG2
  table call provided callback.
- Implement a helper macros that can be used to define early serial console
- Enable DBG2 on ARM64
- Define early console for pl011 serial

Based on the original work by Leif Lindholm <leif.lindholm@linaro.org> [4]

Should be applied to next-20160224.

Tested on last QEMU with patches that introduce DBG2 and fix a QEMU bug:

https://git.linaro.org/people/aleksey.makarov/qemu.git amakarov/gdb2.03

v2:
- Fix parse_acpi() (Matthias Brugger)
- Add a reference to QEMU DBG2 patches and to original work
- Rebase to the last linux-next

v1:
https://lkml.kernel.org/g/1456148818-26257-1-git-send-email-aleksey.makarov at linaro.org

[1] http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.den0044a/index.html
[2] http://go.microsoft.com/fwlink/p/?LinkId=234837
[3] https://lkml.kernel.org/g/1455559532-8305-1-git-send-email-aleksey.makarov at linaro.org
[4] https://lkml.kernel.org/g/1441716217-23786-1-git-send-email-leif.lindholm at linaro.org

Aleksey Makarov (6):
  ACPI: add definitions of DBG2 subtypes
  ACPI: genaralize iterating over subtables in ACPI_PROBE_TABLE()
  ACPI: parse DBG2 table
  ACPI: serial: implement earlycon on ACPI DBG2 port
  ACPI: enable ACPI_DBG2_TABLE on ARM64
  serial: pl011: add ACPI DBG2 serial port

Leif Lindholm (2):
  arm64: move acpi/dt decision earlier in boot process
  of/serial: move earlycon early_param handling to serial

 Documentation/kernel-parameters.txt  |   3 +
 arch/arm64/Kconfig                   |   1 +
 arch/arm64/kernel/acpi.c             |  64 ++++++++++-----------
 drivers/acpi/Kconfig                 |   3 +
 drivers/acpi/Makefile                |   1 +
 drivers/acpi/dbg2.c                  |  85 ++++++++++++++++++++++++++++
 drivers/acpi/scan.c                  |  44 ++++++++++-----
 drivers/clocksource/arm_arch_timer.c |   3 +-
 drivers/irqchip/irq-gic.c            |   4 +-
 drivers/of/fdt.c                     |  11 +---
 drivers/tty/serial/amba-pl011.c      |   3 +
 drivers/tty/serial/earlycon.c        |  61 ++++++++++++++++++++
 include/acpi/actbl2.h                |   5 ++
 include/asm-generic/vmlinux.lds.h    |   1 +
 include/linux/acpi.h                 | 104 ++++++++++++++++++++++++-----------
 include/linux/acpi_dbg2.h            |  68 +++++++++++++++++++++++
 include/linux/clocksource.h          |   2 +-
 include/linux/irqchip.h              |   5 +-
 include/linux/of_fdt.h               |   2 +
 19 files changed, 375 insertions(+), 95 deletions(-)
 create mode 100644 drivers/acpi/dbg2.c
 create mode 100644 include/linux/acpi_dbg2.h

-- 
2.7.1

^ permalink raw reply	[flat|nested] 34+ messages in thread

* [PATCH v2 1/8] arm64: move acpi/dt decision earlier in boot process
  2016-02-24 17:10 ` Aleksey Makarov
  (?)
@ 2016-02-24 17:10   ` Aleksey Makarov
  -1 siblings, 0 replies; 34+ messages in thread
From: Aleksey Makarov @ 2016-02-24 17:10 UTC (permalink / raw)
  To: linux-acpi
  Cc: Russell King, Graeme Gregory, Greg Kroah-Hartman,
	Rafael J . Wysocki, linux-kernel, Leif Lindholm, Aleksey Makarov,
	Christopher Covington, linux-serial, Catalin Marinas,
	Will Deacon, Al Stone, linux-arm-kernel

From: Leif Lindholm <leif.lindholm@linaro.org>

In order to support selecting earlycon via either ACPI or DT, move
the decision on whether to attempt ACPI configuration into the
early_param handling. Then make acpi_boot_table_init() bail out if
acpi_disabled.

Signed-off-by: Leif Lindholm <leif.lindholm@linaro.org>
Signed-off-by: Aleksey Makarov <aleksey.makarov@linaro.org>
---
 arch/arm64/kernel/acpi.c | 62 +++++++++++++++++++++++-------------------------
 1 file changed, 30 insertions(+), 32 deletions(-)

diff --git a/arch/arm64/kernel/acpi.c b/arch/arm64/kernel/acpi.c
index d1ce8e2..3faa323 100644
--- a/arch/arm64/kernel/acpi.c
+++ b/arch/arm64/kernel/acpi.c
@@ -41,26 +41,8 @@ EXPORT_SYMBOL(acpi_disabled);
 int acpi_pci_disabled = 1;	/* skip ACPI PCI scan and IRQ initialization */
 EXPORT_SYMBOL(acpi_pci_disabled);
 
-static bool param_acpi_off __initdata;
 static bool param_acpi_force __initdata;
 
-static int __init parse_acpi(char *arg)
-{
-	if (!arg)
-		return -EINVAL;
-
-	/* "acpi=off" disables both ACPI table parsing and interpreter */
-	if (strcmp(arg, "off") == 0)
-		param_acpi_off = true;
-	else if (strcmp(arg, "force") == 0) /* force ACPI to be enabled */
-		param_acpi_force = true;
-	else
-		return -EINVAL;	/* Core will print when we return error */
-
-	return 0;
-}
-early_param("acpi", parse_acpi);
-
 static int __init dt_scan_depth1_nodes(unsigned long node,
 				       const char *uname, int depth,
 				       void *data)
@@ -74,6 +56,35 @@ static int __init dt_scan_depth1_nodes(unsigned long node,
 	return 0;
 }
 
+static int __init parse_acpi(char *arg)
+{
+	if (!arg)
+		return -EINVAL;
+
+	/*
+	 * Enable ACPI instead of device tree unless
+	 * - ACPI has been disabled explicitly (acpi=off), or
+	 * - the device tree is not empty (it has more than just a /chosen node)
+	 *   and ACPI has not been force enabled (acpi=force)
+	 */
+	if (strcmp(arg, "off") == 0)
+		return 0;
+	else if (strcmp(arg, "force") == 0)
+		param_acpi_force = true;
+	else if (of_scan_flat_dt(dt_scan_depth1_nodes, NULL))
+		return 0;
+
+	/*
+	 * ACPI is disabled at this point. Enable it in order to parse
+	 * the ACPI tables and carry out sanity checks
+	 */
+	enable_acpi();
+
+	return 0;
+}
+
+early_param("acpi", parse_acpi);
+
 /*
  * __acpi_map_table() will be called before page_init(), so early_ioremap()
  * or early_memremap() should be called here to for ACPI table mapping.
@@ -181,23 +192,10 @@ out:
  */
 void __init acpi_boot_table_init(void)
 {
-	/*
-	 * Enable ACPI instead of device tree unless
-	 * - ACPI has been disabled explicitly (acpi=off), or
-	 * - the device tree is not empty (it has more than just a /chosen node)
-	 *   and ACPI has not been force enabled (acpi=force)
-	 */
-	if (param_acpi_off ||
-	    (!param_acpi_force && of_scan_flat_dt(dt_scan_depth1_nodes, NULL)))
+	if (acpi_disabled)
 		return;
 
 	/*
-	 * ACPI is disabled at this point. Enable it in order to parse
-	 * the ACPI tables and carry out sanity checks
-	 */
-	enable_acpi();
-
-	/*
 	 * If ACPI tables are initialized and FADT sanity checks passed,
 	 * leave ACPI enabled and carry on booting; otherwise disable ACPI
 	 * on initialization error.
-- 
2.7.1

^ permalink raw reply related	[flat|nested] 34+ messages in thread

* [PATCH v2 1/8] arm64: move acpi/dt decision earlier in boot process
@ 2016-02-24 17:10   ` Aleksey Makarov
  0 siblings, 0 replies; 34+ messages in thread
From: Aleksey Makarov @ 2016-02-24 17:10 UTC (permalink / raw)
  To: linux-acpi
  Cc: linux-serial, linux-kernel, linux-arm-kernel, Aleksey Makarov,
	Russell King, Greg Kroah-Hartman, Rafael J . Wysocki,
	Leif Lindholm, Graeme Gregory, Al Stone, Christopher Covington,
	Catalin Marinas, Will Deacon

From: Leif Lindholm <leif.lindholm@linaro.org>

In order to support selecting earlycon via either ACPI or DT, move
the decision on whether to attempt ACPI configuration into the
early_param handling. Then make acpi_boot_table_init() bail out if
acpi_disabled.

Signed-off-by: Leif Lindholm <leif.lindholm@linaro.org>
Signed-off-by: Aleksey Makarov <aleksey.makarov@linaro.org>
---
 arch/arm64/kernel/acpi.c | 62 +++++++++++++++++++++++-------------------------
 1 file changed, 30 insertions(+), 32 deletions(-)

diff --git a/arch/arm64/kernel/acpi.c b/arch/arm64/kernel/acpi.c
index d1ce8e2..3faa323 100644
--- a/arch/arm64/kernel/acpi.c
+++ b/arch/arm64/kernel/acpi.c
@@ -41,26 +41,8 @@ EXPORT_SYMBOL(acpi_disabled);
 int acpi_pci_disabled = 1;	/* skip ACPI PCI scan and IRQ initialization */
 EXPORT_SYMBOL(acpi_pci_disabled);
 
-static bool param_acpi_off __initdata;
 static bool param_acpi_force __initdata;
 
-static int __init parse_acpi(char *arg)
-{
-	if (!arg)
-		return -EINVAL;
-
-	/* "acpi=off" disables both ACPI table parsing and interpreter */
-	if (strcmp(arg, "off") == 0)
-		param_acpi_off = true;
-	else if (strcmp(arg, "force") == 0) /* force ACPI to be enabled */
-		param_acpi_force = true;
-	else
-		return -EINVAL;	/* Core will print when we return error */
-
-	return 0;
-}
-early_param("acpi", parse_acpi);
-
 static int __init dt_scan_depth1_nodes(unsigned long node,
 				       const char *uname, int depth,
 				       void *data)
@@ -74,6 +56,35 @@ static int __init dt_scan_depth1_nodes(unsigned long node,
 	return 0;
 }
 
+static int __init parse_acpi(char *arg)
+{
+	if (!arg)
+		return -EINVAL;
+
+	/*
+	 * Enable ACPI instead of device tree unless
+	 * - ACPI has been disabled explicitly (acpi=off), or
+	 * - the device tree is not empty (it has more than just a /chosen node)
+	 *   and ACPI has not been force enabled (acpi=force)
+	 */
+	if (strcmp(arg, "off") == 0)
+		return 0;
+	else if (strcmp(arg, "force") == 0)
+		param_acpi_force = true;
+	else if (of_scan_flat_dt(dt_scan_depth1_nodes, NULL))
+		return 0;
+
+	/*
+	 * ACPI is disabled at this point. Enable it in order to parse
+	 * the ACPI tables and carry out sanity checks
+	 */
+	enable_acpi();
+
+	return 0;
+}
+
+early_param("acpi", parse_acpi);
+
 /*
  * __acpi_map_table() will be called before page_init(), so early_ioremap()
  * or early_memremap() should be called here to for ACPI table mapping.
@@ -181,23 +192,10 @@ out:
  */
 void __init acpi_boot_table_init(void)
 {
-	/*
-	 * Enable ACPI instead of device tree unless
-	 * - ACPI has been disabled explicitly (acpi=off), or
-	 * - the device tree is not empty (it has more than just a /chosen node)
-	 *   and ACPI has not been force enabled (acpi=force)
-	 */
-	if (param_acpi_off ||
-	    (!param_acpi_force && of_scan_flat_dt(dt_scan_depth1_nodes, NULL)))
+	if (acpi_disabled)
 		return;
 
 	/*
-	 * ACPI is disabled at this point. Enable it in order to parse
-	 * the ACPI tables and carry out sanity checks
-	 */
-	enable_acpi();
-
-	/*
 	 * If ACPI tables are initialized and FADT sanity checks passed,
 	 * leave ACPI enabled and carry on booting; otherwise disable ACPI
 	 * on initialization error.
-- 
2.7.1

^ permalink raw reply related	[flat|nested] 34+ messages in thread

* [PATCH v2 1/8] arm64: move acpi/dt decision earlier in boot process
@ 2016-02-24 17:10   ` Aleksey Makarov
  0 siblings, 0 replies; 34+ messages in thread
From: Aleksey Makarov @ 2016-02-24 17:10 UTC (permalink / raw)
  To: linux-arm-kernel

From: Leif Lindholm <leif.lindholm@linaro.org>

In order to support selecting earlycon via either ACPI or DT, move
the decision on whether to attempt ACPI configuration into the
early_param handling. Then make acpi_boot_table_init() bail out if
acpi_disabled.

Signed-off-by: Leif Lindholm <leif.lindholm@linaro.org>
Signed-off-by: Aleksey Makarov <aleksey.makarov@linaro.org>
---
 arch/arm64/kernel/acpi.c | 62 +++++++++++++++++++++++-------------------------
 1 file changed, 30 insertions(+), 32 deletions(-)

diff --git a/arch/arm64/kernel/acpi.c b/arch/arm64/kernel/acpi.c
index d1ce8e2..3faa323 100644
--- a/arch/arm64/kernel/acpi.c
+++ b/arch/arm64/kernel/acpi.c
@@ -41,26 +41,8 @@ EXPORT_SYMBOL(acpi_disabled);
 int acpi_pci_disabled = 1;	/* skip ACPI PCI scan and IRQ initialization */
 EXPORT_SYMBOL(acpi_pci_disabled);
 
-static bool param_acpi_off __initdata;
 static bool param_acpi_force __initdata;
 
-static int __init parse_acpi(char *arg)
-{
-	if (!arg)
-		return -EINVAL;
-
-	/* "acpi=off" disables both ACPI table parsing and interpreter */
-	if (strcmp(arg, "off") == 0)
-		param_acpi_off = true;
-	else if (strcmp(arg, "force") == 0) /* force ACPI to be enabled */
-		param_acpi_force = true;
-	else
-		return -EINVAL;	/* Core will print when we return error */
-
-	return 0;
-}
-early_param("acpi", parse_acpi);
-
 static int __init dt_scan_depth1_nodes(unsigned long node,
 				       const char *uname, int depth,
 				       void *data)
@@ -74,6 +56,35 @@ static int __init dt_scan_depth1_nodes(unsigned long node,
 	return 0;
 }
 
+static int __init parse_acpi(char *arg)
+{
+	if (!arg)
+		return -EINVAL;
+
+	/*
+	 * Enable ACPI instead of device tree unless
+	 * - ACPI has been disabled explicitly (acpi=off), or
+	 * - the device tree is not empty (it has more than just a /chosen node)
+	 *   and ACPI has not been force enabled (acpi=force)
+	 */
+	if (strcmp(arg, "off") == 0)
+		return 0;
+	else if (strcmp(arg, "force") == 0)
+		param_acpi_force = true;
+	else if (of_scan_flat_dt(dt_scan_depth1_nodes, NULL))
+		return 0;
+
+	/*
+	 * ACPI is disabled at this point. Enable it in order to parse
+	 * the ACPI tables and carry out sanity checks
+	 */
+	enable_acpi();
+
+	return 0;
+}
+
+early_param("acpi", parse_acpi);
+
 /*
  * __acpi_map_table() will be called before page_init(), so early_ioremap()
  * or early_memremap() should be called here to for ACPI table mapping.
@@ -181,23 +192,10 @@ out:
  */
 void __init acpi_boot_table_init(void)
 {
-	/*
-	 * Enable ACPI instead of device tree unless
-	 * - ACPI has been disabled explicitly (acpi=off), or
-	 * - the device tree is not empty (it has more than just a /chosen node)
-	 *   and ACPI has not been force enabled (acpi=force)
-	 */
-	if (param_acpi_off ||
-	    (!param_acpi_force && of_scan_flat_dt(dt_scan_depth1_nodes, NULL)))
+	if (acpi_disabled)
 		return;
 
 	/*
-	 * ACPI is disabled at this point. Enable it in order to parse
-	 * the ACPI tables and carry out sanity checks
-	 */
-	enable_acpi();
-
-	/*
 	 * If ACPI tables are initialized and FADT sanity checks passed,
 	 * leave ACPI enabled and carry on booting; otherwise disable ACPI
 	 * on initialization error.
-- 
2.7.1

^ permalink raw reply related	[flat|nested] 34+ messages in thread

* [PATCH v2 2/8] of/serial: move earlycon early_param handling to serial
  2016-02-24 17:10 ` Aleksey Makarov
@ 2016-02-24 17:10   ` Aleksey Makarov
  -1 siblings, 0 replies; 34+ messages in thread
From: Aleksey Makarov @ 2016-02-24 17:10 UTC (permalink / raw)
  To: linux-acpi
  Cc: linux-serial, linux-kernel, linux-arm-kernel, Aleksey Makarov,
	Russell King, Greg Kroah-Hartman, Rafael J . Wysocki,
	Leif Lindholm, Graeme Gregory, Al Stone, Christopher Covington,
	Rob Herring, Frank Rowand, Grant Likely, Jiri Slaby, devicetree

From: Leif Lindholm <leif.lindholm@linaro.org>

We have multiple "earlycon" early_param handlers - merge the DT one into
the main earlycon one. This means the earlycon early_param handler does
not just return success if no options are specified.

Signed-off-by: Leif Lindholm <leif.lindholm@linaro.org>
Signed-off-by: Aleksey Makarov <aleksey.makarov@linaro.org>
---
 drivers/of/fdt.c              | 11 +----------
 drivers/tty/serial/earlycon.c |  3 ++-
 include/linux/of_fdt.h        |  2 ++
 3 files changed, 5 insertions(+), 11 deletions(-)

diff --git a/drivers/of/fdt.c b/drivers/of/fdt.c
index 3349d2a..0547256 100644
--- a/drivers/of/fdt.c
+++ b/drivers/of/fdt.c
@@ -805,7 +805,7 @@ static inline void early_init_dt_check_for_initrd(unsigned long node)
 
 #ifdef CONFIG_SERIAL_EARLYCON
 
-static int __init early_init_dt_scan_chosen_serial(void)
+int __init early_init_dt_scan_chosen_serial(void)
 {
 	int offset;
 	const char *p, *q, *options = NULL;
@@ -849,15 +849,6 @@ static int __init early_init_dt_scan_chosen_serial(void)
 	}
 	return -ENODEV;
 }
-
-static int __init setup_of_earlycon(char *buf)
-{
-	if (buf)
-		return 0;
-
-	return early_init_dt_scan_chosen_serial();
-}
-early_param("earlycon", setup_of_earlycon);
 #endif
 
 /**
diff --git a/drivers/tty/serial/earlycon.c b/drivers/tty/serial/earlycon.c
index 067783f..d217366 100644
--- a/drivers/tty/serial/earlycon.c
+++ b/drivers/tty/serial/earlycon.c
@@ -17,6 +17,7 @@
 #include <linux/kernel.h>
 #include <linux/init.h>
 #include <linux/io.h>
+#include <linux/of_fdt.h>
 #include <linux/serial_core.h>
 #include <linux/sizes.h>
 #include <linux/of.h>
@@ -209,7 +210,7 @@ static int __init param_setup_earlycon(char *buf)
 	 * don't generate a warning from parse_early_params() in that case
 	 */
 	if (!buf || !buf[0])
-		return 0;
+		return early_init_dt_scan_chosen_serial();
 
 	err = setup_earlycon(buf);
 	if (err == -ENOENT || err == -EALREADY)
diff --git a/include/linux/of_fdt.h b/include/linux/of_fdt.h
index 2fbe868..56b2a43 100644
--- a/include/linux/of_fdt.h
+++ b/include/linux/of_fdt.h
@@ -63,6 +63,7 @@ extern int early_init_dt_scan_chosen(unsigned long node, const char *uname,
 				     int depth, void *data);
 extern int early_init_dt_scan_memory(unsigned long node, const char *uname,
 				     int depth, void *data);
+extern int early_init_dt_scan_chosen_serial(void);
 extern void early_init_fdt_scan_reserved_mem(void);
 extern void early_init_fdt_reserve_self(void);
 extern void early_init_dt_add_memory_arch(u64 base, u64 size);
@@ -91,6 +92,7 @@ extern void early_get_first_memblock_info(void *, phys_addr_t *);
 extern u64 of_flat_dt_translate_address(unsigned long node);
 extern void of_fdt_limit_memory(int limit);
 #else /* CONFIG_OF_FLATTREE */
+static inline int early_init_dt_scan_chosen_serial(void) { return -ENODEV; }
 static inline void early_init_fdt_scan_reserved_mem(void) {}
 static inline void early_init_fdt_reserve_self(void) {}
 static inline const char *of_flat_dt_get_machine_name(void) { return NULL; }
-- 
2.7.1

^ permalink raw reply related	[flat|nested] 34+ messages in thread

* [PATCH v2 2/8] of/serial: move earlycon early_param handling to serial
@ 2016-02-24 17:10   ` Aleksey Makarov
  0 siblings, 0 replies; 34+ messages in thread
From: Aleksey Makarov @ 2016-02-24 17:10 UTC (permalink / raw)
  To: linux-arm-kernel

From: Leif Lindholm <leif.lindholm@linaro.org>

We have multiple "earlycon" early_param handlers - merge the DT one into
the main earlycon one. This means the earlycon early_param handler does
not just return success if no options are specified.

Signed-off-by: Leif Lindholm <leif.lindholm@linaro.org>
Signed-off-by: Aleksey Makarov <aleksey.makarov@linaro.org>
---
 drivers/of/fdt.c              | 11 +----------
 drivers/tty/serial/earlycon.c |  3 ++-
 include/linux/of_fdt.h        |  2 ++
 3 files changed, 5 insertions(+), 11 deletions(-)

diff --git a/drivers/of/fdt.c b/drivers/of/fdt.c
index 3349d2a..0547256 100644
--- a/drivers/of/fdt.c
+++ b/drivers/of/fdt.c
@@ -805,7 +805,7 @@ static inline void early_init_dt_check_for_initrd(unsigned long node)
 
 #ifdef CONFIG_SERIAL_EARLYCON
 
-static int __init early_init_dt_scan_chosen_serial(void)
+int __init early_init_dt_scan_chosen_serial(void)
 {
 	int offset;
 	const char *p, *q, *options = NULL;
@@ -849,15 +849,6 @@ static int __init early_init_dt_scan_chosen_serial(void)
 	}
 	return -ENODEV;
 }
-
-static int __init setup_of_earlycon(char *buf)
-{
-	if (buf)
-		return 0;
-
-	return early_init_dt_scan_chosen_serial();
-}
-early_param("earlycon", setup_of_earlycon);
 #endif
 
 /**
diff --git a/drivers/tty/serial/earlycon.c b/drivers/tty/serial/earlycon.c
index 067783f..d217366 100644
--- a/drivers/tty/serial/earlycon.c
+++ b/drivers/tty/serial/earlycon.c
@@ -17,6 +17,7 @@
 #include <linux/kernel.h>
 #include <linux/init.h>
 #include <linux/io.h>
+#include <linux/of_fdt.h>
 #include <linux/serial_core.h>
 #include <linux/sizes.h>
 #include <linux/of.h>
@@ -209,7 +210,7 @@ static int __init param_setup_earlycon(char *buf)
 	 * don't generate a warning from parse_early_params() in that case
 	 */
 	if (!buf || !buf[0])
-		return 0;
+		return early_init_dt_scan_chosen_serial();
 
 	err = setup_earlycon(buf);
 	if (err == -ENOENT || err == -EALREADY)
diff --git a/include/linux/of_fdt.h b/include/linux/of_fdt.h
index 2fbe868..56b2a43 100644
--- a/include/linux/of_fdt.h
+++ b/include/linux/of_fdt.h
@@ -63,6 +63,7 @@ extern int early_init_dt_scan_chosen(unsigned long node, const char *uname,
 				     int depth, void *data);
 extern int early_init_dt_scan_memory(unsigned long node, const char *uname,
 				     int depth, void *data);
+extern int early_init_dt_scan_chosen_serial(void);
 extern void early_init_fdt_scan_reserved_mem(void);
 extern void early_init_fdt_reserve_self(void);
 extern void early_init_dt_add_memory_arch(u64 base, u64 size);
@@ -91,6 +92,7 @@ extern void early_get_first_memblock_info(void *, phys_addr_t *);
 extern u64 of_flat_dt_translate_address(unsigned long node);
 extern void of_fdt_limit_memory(int limit);
 #else /* CONFIG_OF_FLATTREE */
+static inline int early_init_dt_scan_chosen_serial(void) { return -ENODEV; }
 static inline void early_init_fdt_scan_reserved_mem(void) {}
 static inline void early_init_fdt_reserve_self(void) {}
 static inline const char *of_flat_dt_get_machine_name(void) { return NULL; }
-- 
2.7.1

^ permalink raw reply related	[flat|nested] 34+ messages in thread

* [PATCH v2 3/8] ACPI: add definitions of DBG2 subtypes
  2016-02-24 17:10 ` Aleksey Makarov
  (?)
@ 2016-02-24 17:10   ` Aleksey Makarov
  -1 siblings, 0 replies; 34+ messages in thread
From: Aleksey Makarov @ 2016-02-24 17:10 UTC (permalink / raw)
  To: linux-acpi
  Cc: Lv Zheng, Russell King, Graeme Gregory, Greg Kroah-Hartman,
	Rafael J . Wysocki, linux-kernel, Leif Lindholm, Robert Moore,
	Aleksey Makarov, Christopher Covington, linux-serial, devel,
	Al Stone, linux-arm-kernel, Len Brown

The recent version of Microsoft Debug Port Table 2 (DBG2) [1]
specifies additional serial debug port subtypes.  These constants
are also referred by Serial Port Console Redirection Table (SPCR) [2]

Add these constants.

[1] https://msdn.microsoft.com/en-us/library/windows/hardware/dn639131(v=vs.85).aspx
[2] https://msdn.microsoft.com/en-us/library/windows/hardware/dn639132(v=vs.85).aspx

Signed-off-by: Aleksey Makarov <aleksey.makarov@linaro.org>
---
 include/acpi/actbl2.h | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/include/acpi/actbl2.h b/include/acpi/actbl2.h
index a4ef625..652f747 100644
--- a/include/acpi/actbl2.h
+++ b/include/acpi/actbl2.h
@@ -371,6 +371,11 @@ struct acpi_dbg2_device {
 
 #define ACPI_DBG2_16550_COMPATIBLE  0x0000
 #define ACPI_DBG2_16550_SUBSET      0x0001
+#define ACPI_DBG2_ARM_PL011         0x0003
+#define ACPI_DBG2_ARM_SBSA_32BIT    0x000D
+#define ACPI_DBG2_ARM_SBSA_GENERIC  0x000E
+#define ACPI_DBG2_ARM_DCC           0x000F
+#define ACPI_DBG2_BCM2835           0x0010
 
 #define ACPI_DBG2_1394_STANDARD     0x0000
 
-- 
2.7.1

^ permalink raw reply related	[flat|nested] 34+ messages in thread

* [PATCH v2 3/8] ACPI: add definitions of DBG2 subtypes
@ 2016-02-24 17:10   ` Aleksey Makarov
  0 siblings, 0 replies; 34+ messages in thread
From: Aleksey Makarov @ 2016-02-24 17:10 UTC (permalink / raw)
  To: linux-acpi
  Cc: linux-serial, linux-kernel, linux-arm-kernel, Aleksey Makarov,
	Russell King, Greg Kroah-Hartman, Rafael J . Wysocki,
	Leif Lindholm, Graeme Gregory, Al Stone, Christopher Covington,
	Len Brown, Robert Moore, Lv Zheng, devel

The recent version of Microsoft Debug Port Table 2 (DBG2) [1]
specifies additional serial debug port subtypes.  These constants
are also referred by Serial Port Console Redirection Table (SPCR) [2]

Add these constants.

[1] https://msdn.microsoft.com/en-us/library/windows/hardware/dn639131(v=vs.85).aspx
[2] https://msdn.microsoft.com/en-us/library/windows/hardware/dn639132(v=vs.85).aspx

Signed-off-by: Aleksey Makarov <aleksey.makarov@linaro.org>
---
 include/acpi/actbl2.h | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/include/acpi/actbl2.h b/include/acpi/actbl2.h
index a4ef625..652f747 100644
--- a/include/acpi/actbl2.h
+++ b/include/acpi/actbl2.h
@@ -371,6 +371,11 @@ struct acpi_dbg2_device {
 
 #define ACPI_DBG2_16550_COMPATIBLE  0x0000
 #define ACPI_DBG2_16550_SUBSET      0x0001
+#define ACPI_DBG2_ARM_PL011         0x0003
+#define ACPI_DBG2_ARM_SBSA_32BIT    0x000D
+#define ACPI_DBG2_ARM_SBSA_GENERIC  0x000E
+#define ACPI_DBG2_ARM_DCC           0x000F
+#define ACPI_DBG2_BCM2835           0x0010
 
 #define ACPI_DBG2_1394_STANDARD     0x0000
 
-- 
2.7.1

^ permalink raw reply related	[flat|nested] 34+ messages in thread

* [PATCH v2 3/8] ACPI: add definitions of DBG2 subtypes
@ 2016-02-24 17:10   ` Aleksey Makarov
  0 siblings, 0 replies; 34+ messages in thread
From: Aleksey Makarov @ 2016-02-24 17:10 UTC (permalink / raw)
  To: linux-arm-kernel

The recent version of Microsoft Debug Port Table 2 (DBG2) [1]
specifies additional serial debug port subtypes.  These constants
are also referred by Serial Port Console Redirection Table (SPCR) [2]

Add these constants.

[1] https://msdn.microsoft.com/en-us/library/windows/hardware/dn639131(v=vs.85).aspx
[2] https://msdn.microsoft.com/en-us/library/windows/hardware/dn639132(v=vs.85).aspx

Signed-off-by: Aleksey Makarov <aleksey.makarov@linaro.org>
---
 include/acpi/actbl2.h | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/include/acpi/actbl2.h b/include/acpi/actbl2.h
index a4ef625..652f747 100644
--- a/include/acpi/actbl2.h
+++ b/include/acpi/actbl2.h
@@ -371,6 +371,11 @@ struct acpi_dbg2_device {
 
 #define ACPI_DBG2_16550_COMPATIBLE  0x0000
 #define ACPI_DBG2_16550_SUBSET      0x0001
+#define ACPI_DBG2_ARM_PL011         0x0003
+#define ACPI_DBG2_ARM_SBSA_32BIT    0x000D
+#define ACPI_DBG2_ARM_SBSA_GENERIC  0x000E
+#define ACPI_DBG2_ARM_DCC           0x000F
+#define ACPI_DBG2_BCM2835           0x0010
 
 #define ACPI_DBG2_1394_STANDARD     0x0000
 
-- 
2.7.1

^ permalink raw reply related	[flat|nested] 34+ messages in thread

* [PATCH v2 4/8] ACPI: genaralize iterating over subtables in ACPI_PROBE_TABLE()
  2016-02-24 17:10 ` Aleksey Makarov
@ 2016-02-24 17:10   ` Aleksey Makarov
  -1 siblings, 0 replies; 34+ messages in thread
From: Aleksey Makarov @ 2016-02-24 17:10 UTC (permalink / raw)
  To: linux-acpi
  Cc: linux-serial, linux-kernel, linux-arm-kernel, Aleksey Makarov,
	Russell King, Greg Kroah-Hartman, Rafael J . Wysocki,
	Leif Lindholm, Graeme Gregory, Al Stone, Christopher Covington,
	Len Brown, Daniel Lezcano, Thomas Gleixner, Jason Cooper,
	Marc Zyngier, John Stultz

Refactor ACPI_PROBE_TABLE() so that it is possible to iterate
over subtables that do not have acpi_subtype header (for example
over subtables of DBG2 table)

To do so:

- Add void * data pointer argument for callback.  It will allow to
  parse the table and iterate over subtables calling the subtable
  callbacks that are provided via this data pointer.
- Save only ACPI table id, callback and callback data in the linker
  tables.  This makes tables more terse and simplifies the semantics
  of the fields of it's elements.
  The additional data that required for subtable parsing are saved
  in static namespace without increasing the size of linker tables.
- Introduce two macros with clear meaning of arguments, instead one.
  The old ACPI_DECLARE_PROBE_ENTRY() macros has arguments that have
  different meaning if the entry is for table or for subtable.  The
  arguments of the new macroses ACPI_DECLARE_PROBE_ENTRY() and
  ACPI_DECLARE_PROBE_SUBTYPE_ENTRY() have unambiguous meaning.
- Document arguments of those macroses instead of the fields of linker
  table data.
- Fix the issue that prevents using this macros for parsing subtables
  other than MADT.  In the original code, MADT-specific function
  was used to iterate over subtables, while the name was common.
  Introduce a new parameter to macors that specifies the size of
  the table to do it in common way.
- Don't expose the internals of the tables to the drivers passing
  a pointer to struct acpi_probe_entry to the subtable callback validator.
  Instead, pass the sideband data specified by the driver.
- Fix the driver's callback signatures: a. Add an unused pointer to void
  for table matchers (currently only clocksource callback) b. Change
  the type of sideband data to kernel_ulong_t.

Signed-off-by: Aleksey Makarov <aleksey.makarov@linaro.org>
---
 drivers/acpi/scan.c                  |  44 ++++++++++-----
 drivers/clocksource/arm_arch_timer.c |   3 +-
 drivers/irqchip/irq-gic.c            |   4 +-
 include/linux/acpi.h                 | 104 ++++++++++++++++++++++++-----------
 include/linux/clocksource.h          |   2 +-
 include/linux/irqchip.h              |   5 +-
 6 files changed, 109 insertions(+), 53 deletions(-)

diff --git a/drivers/acpi/scan.c b/drivers/acpi/scan.c
index 5f28cf7..09b5f63 100644
--- a/drivers/acpi/scan.c
+++ b/drivers/acpi/scan.c
@@ -1969,16 +1969,38 @@ static struct acpi_probe_entry *ape;
 static int acpi_probe_count;
 static DEFINE_SPINLOCK(acpi_probe_lock);
 
-static int __init acpi_match_madt(struct acpi_subtable_header *header,
-				  const unsigned long end)
+static int __init acpi_match_and_setup(struct acpi_subtable_header *header,
+				       const unsigned long end)
 {
-	if (!ape->subtable_valid || ape->subtable_valid(header, ape))
-		if (!ape->probe_subtbl(header, end))
+	const struct acpi_probe_subtype_data *data = ape->data;
+
+	if (data->valid(header, data->data))
+		if (!data->setup(header, end))
 			acpi_probe_count++;
 
 	return 0;
 }
 
+int __init acpi_probe_subtype_setup(struct acpi_table_header *table,
+				    const void *data)
+{
+	const struct acpi_probe_subtype_data *data_subtype = data;
+
+	return acpi_parse_entries(ape->id, data_subtype->size,
+				  acpi_match_and_setup, table,
+				  data_subtype->subtype, 0);
+}
+
+static int __init acpi_probe_table_handler(struct acpi_table_header *table)
+{
+	int err = ape->setup(table, ape->data);
+
+	if (ape->setup != acpi_probe_subtype_setup && err >= 0)
+		acpi_probe_count++;
+
+	return err;
+}
+
 int __init __acpi_probe_device_table(struct acpi_probe_entry *ap_head, int nr)
 {
 	int count = 0;
@@ -1988,16 +2010,10 @@ int __init __acpi_probe_device_table(struct acpi_probe_entry *ap_head, int nr)
 
 	spin_lock(&acpi_probe_lock);
 	for (ape = ap_head; nr; ape++, nr--) {
-		if (ACPI_COMPARE_NAME(ACPI_SIG_MADT, ape->id)) {
-			acpi_probe_count = 0;
-			acpi_table_parse_madt(ape->type, acpi_match_madt, 0);
-			count += acpi_probe_count;
-		} else {
-			int res;
-			res = acpi_table_parse(ape->id, ape->probe_table);
-			if (!res)
-				count++;
-		}
+		acpi_probe_count = 0;
+		if (acpi_table_parse(ape->id, acpi_probe_table_handler) < 0)
+			continue;
+		count += acpi_probe_count;
 	}
 	spin_unlock(&acpi_probe_lock);
 
diff --git a/drivers/clocksource/arm_arch_timer.c b/drivers/clocksource/arm_arch_timer.c
index f492ced..c0df7cb 100644
--- a/drivers/clocksource/arm_arch_timer.c
+++ b/drivers/clocksource/arm_arch_timer.c
@@ -868,7 +868,8 @@ static int __init map_generic_timer_interrupt(u32 interrupt, u32 flags)
 }
 
 /* Initialize per-processor generic timer */
-static int __init arch_timer_acpi_init(struct acpi_table_header *table)
+static int __init arch_timer_acpi_init(struct acpi_table_header *table,
+				       const void *data)
 {
 	struct acpi_table_gtdt *gtdt;
 
diff --git a/drivers/irqchip/irq-gic.c b/drivers/irqchip/irq-gic.c
index 282344b..13d8323 100644
--- a/drivers/irqchip/irq-gic.c
+++ b/drivers/irqchip/irq-gic.c
@@ -1287,12 +1287,12 @@ static bool __init acpi_gic_redist_is_present(void)
 }
 
 static bool __init gic_validate_dist(struct acpi_subtable_header *header,
-				     struct acpi_probe_entry *ape)
+				     kernel_ulong_t driver_data)
 {
 	struct acpi_madt_generic_distributor *dist;
 	dist = (struct acpi_madt_generic_distributor *)header;
 
-	return (dist->version == ape->driver_data &&
+	return (dist->version == driver_data &&
 		(dist->version != ACPI_MADT_GIC_VERSION_NONE ||
 		 !acpi_gic_redist_is_present()));
 }
diff --git a/include/linux/acpi.h b/include/linux/acpi.h
index 06ed7e5..9636c32 100644
--- a/include/linux/acpi.h
+++ b/include/linux/acpi.h
@@ -879,47 +879,76 @@ int acpi_dev_prop_read(struct acpi_device *adev, const char *propname,
 struct fwnode_handle *acpi_get_next_subnode(struct device *dev,
 					    struct fwnode_handle *subnode);
 
-struct acpi_probe_entry;
 typedef bool (*acpi_probe_entry_validate_subtbl)(struct acpi_subtable_header *,
-						 struct acpi_probe_entry *);
+						 kernel_ulong_t);
+
+typedef int (*acpi_probe_entry_setup)(struct acpi_table_header *, const void *);
 
 #define ACPI_TABLE_ID_LEN	5
 
-/**
- * struct acpi_probe_entry - boot-time probing entry
- * @id:			ACPI table name
- * @type:		Optional subtable type to match
- *			(if @id contains subtables)
- * @subtable_valid:	Optional callback to check the validity of
- *			the subtable
- * @probe_table:	Callback to the driver being probed when table
- *			match is successful
- * @probe_subtbl:	Callback to the driver being probed when table and
- *			subtable match (and optional callback is successful)
- * @driver_data:	Sideband data provided back to the driver
- */
 struct acpi_probe_entry {
 	__u8 id[ACPI_TABLE_ID_LEN];
-	__u8 type;
-	acpi_probe_entry_validate_subtbl subtable_valid;
-	union {
-		acpi_tbl_table_handler probe_table;
-		acpi_tbl_entry_handler probe_subtbl;
-	};
-	kernel_ulong_t driver_data;
+	acpi_probe_entry_setup setup;
+	const void *data;
 };
 
-#define ACPI_DECLARE_PROBE_ENTRY(table, name, table_id, subtable, valid, data, fn)	\
+/**
+ * ACPI_DECLARE_PROBE_ENTRY() - declare boot-time probing entry
+ * @table:		Name of subsystem to match
+ * @name:               Identifier to compose name of table data
+ * @table_id:		ACPI table name
+ * @setup_fn:		Callback to the driver being probed when table
+ *			matches (of type acpi_probe_entry_setup)
+ * @data_ptr:		Sideband data provided back to the driver
+ */
+#define ACPI_DECLARE_PROBE_ENTRY(table, name, table_id, setup_fn, data_ptr) \
 	static const struct acpi_probe_entry __acpi_probe_##name	\
 		__used __section(__##table##_acpi_probe_table)		\
 		 = {							\
 			.id = table_id,					\
-			.type = subtable,				\
-			.subtable_valid = valid,			\
-			.probe_table = (acpi_tbl_table_handler)fn,	\
-			.driver_data = data, 				\
+			.setup = setup_fn,				\
+			.data = data_ptr,				\
 		   }
 
+struct acpi_probe_subtype_data {
+	u8 subtype;
+	unsigned long size;
+	acpi_probe_entry_validate_subtbl valid;
+	acpi_tbl_entry_handler setup;
+	kernel_ulong_t data;
+};
+
+int acpi_probe_subtype_setup(struct acpi_table_header *table, const void *data);
+
+/**
+ * ACPI_DECLARE_PROBE_SUBTYPE_ENTRY() - declare boot-time probing entry that
+ *				      matches subtables
+ * @table:		Name of subsystem to match
+ * @name:               Identifier to compose name of table data
+ * @table_id:		ACPI table name
+ * @table_size:		Size of the table (without subtables) of type table_id
+ * @subtable:		Subtable type to match
+ * @valid_fn:		Callback to check the validity of the subtable
+ *			(of type acpi_probe_entry_validate_subtbl)
+ * @data_int:		Sideband data provided back to the driver
+ *			(of type kernel_ulong_t)
+ * @setup_fn:		Callback to the driver being probed when table and
+ *			subtable match and valid_fn callback is successful
+ *			(of type acpi_tbl_entry_handler)
+ */
+#define ACPI_DECLARE_PROBE_SUBTYPE_ENTRY(table, name, table_id, table_size, \
+				subtable, valid_fn, data_int, setup_fn)     \
+	static const struct acpi_probe_subtype_data			    \
+	__acpi_probe_subtype_##name __used = {				    \
+			.subtype = subtable,				    \
+			.size = table_size,				    \
+			.valid = valid_fn,				    \
+			.setup = setup_fn,				    \
+			.data = data_int,				    \
+		   };							    \
+	ACPI_DECLARE_PROBE_ENTRY(table, name, table_id,			    \
+		acpi_probe_subtype_setup, &__acpi_probe_subtype_##name)
+
 #define ACPI_PROBE_TABLE(name)		__##name##_acpi_probe_table
 #define ACPI_PROBE_TABLE_END(name)	__##name##_acpi_probe_table_end
 
@@ -992,14 +1021,23 @@ static inline struct fwnode_handle *acpi_get_next_subnode(struct device *dev,
 	return NULL;
 }
 
-#define ACPI_DECLARE_PROBE_ENTRY(table, name, table_id, subtable, validate, data, fn) \
+#define ACPI_DECLARE_PROBE_ENTRY(table, name, table_id, match, data)	\
 	static const void * __acpi_table_##name[]			\
 		__attribute__((unused))					\
-		 = { (void *) table_id,					\
-		     (void *) subtable,					\
-		     (void *) valid,					\
-		     (void *) fn,					\
-		     (void *) data }
+		 = { (void *)table_id,					\
+		     (void *)match,					\
+		     (void *)data }
+
+#define ACPI_DECLARE_PROBE_SUBTYPE_ENTRY(table, name, table_id, table_size, \
+				subtable, valid_fn, data_int, setup_fn)	    \
+	static const void *__acpi_table_##name[]			\
+		__attribute__((unused))					\
+		 = { (void *)table_id,					\
+		     (void *)table_size,				\
+		     (void *)subtable,					\
+		     (void *)valid_fn,					\
+		     (void *)data_int,					\
+		     (void *)setup_fn }
 
 #define acpi_probe_device_table(t)	({ int __r = 0; __r;})
 #endif
diff --git a/include/linux/clocksource.h b/include/linux/clocksource.h
index 6013021..2bb5d51 100644
--- a/include/linux/clocksource.h
+++ b/include/linux/clocksource.h
@@ -259,6 +259,6 @@ static inline void clocksource_probe(void) {}
 #endif
 
 #define CLOCKSOURCE_ACPI_DECLARE(name, table_id, fn)		\
-	ACPI_DECLARE_PROBE_ENTRY(clksrc, name, table_id, 0, NULL, 0, fn)
+	ACPI_DECLARE_PROBE_ENTRY(clksrc, name, table_id, fn, NULL)
 
 #endif /* _LINUX_CLOCKSOURCE_H */
diff --git a/include/linux/irqchip.h b/include/linux/irqchip.h
index 89c34b2..cc4c455 100644
--- a/include/linux/irqchip.h
+++ b/include/linux/irqchip.h
@@ -39,8 +39,9 @@
  * @fn: initialization function
  */
 #define IRQCHIP_ACPI_DECLARE(name, subtable, validate, data, fn)	\
-	ACPI_DECLARE_PROBE_ENTRY(irqchip, name, ACPI_SIG_MADT, 		\
-				 subtable, validate, data, fn)
+	ACPI_DECLARE_PROBE_SUBTYPE_ENTRY(irqchip, name, ACPI_SIG_MADT,	\
+					 sizeof(struct acpi_table_madt),\
+					 subtable, validate, data, fn)
 
 #ifdef CONFIG_IRQCHIP
 void irqchip_init(void);
-- 
2.7.1

^ permalink raw reply related	[flat|nested] 34+ messages in thread

* [PATCH v2 4/8] ACPI: genaralize iterating over subtables in ACPI_PROBE_TABLE()
@ 2016-02-24 17:10   ` Aleksey Makarov
  0 siblings, 0 replies; 34+ messages in thread
From: Aleksey Makarov @ 2016-02-24 17:10 UTC (permalink / raw)
  To: linux-arm-kernel

Refactor ACPI_PROBE_TABLE() so that it is possible to iterate
over subtables that do not have acpi_subtype header (for example
over subtables of DBG2 table)

To do so:

- Add void * data pointer argument for callback.  It will allow to
  parse the table and iterate over subtables calling the subtable
  callbacks that are provided via this data pointer.
- Save only ACPI table id, callback and callback data in the linker
  tables.  This makes tables more terse and simplifies the semantics
  of the fields of it's elements.
  The additional data that required for subtable parsing are saved
  in static namespace without increasing the size of linker tables.
- Introduce two macros with clear meaning of arguments, instead one.
  The old ACPI_DECLARE_PROBE_ENTRY() macros has arguments that have
  different meaning if the entry is for table or for subtable.  The
  arguments of the new macroses ACPI_DECLARE_PROBE_ENTRY() and
  ACPI_DECLARE_PROBE_SUBTYPE_ENTRY() have unambiguous meaning.
- Document arguments of those macroses instead of the fields of linker
  table data.
- Fix the issue that prevents using this macros for parsing subtables
  other than MADT.  In the original code, MADT-specific function
  was used to iterate over subtables, while the name was common.
  Introduce a new parameter to macors that specifies the size of
  the table to do it in common way.
- Don't expose the internals of the tables to the drivers passing
  a pointer to struct acpi_probe_entry to the subtable callback validator.
  Instead, pass the sideband data specified by the driver.
- Fix the driver's callback signatures: a. Add an unused pointer to void
  for table matchers (currently only clocksource callback) b. Change
  the type of sideband data to kernel_ulong_t.

Signed-off-by: Aleksey Makarov <aleksey.makarov@linaro.org>
---
 drivers/acpi/scan.c                  |  44 ++++++++++-----
 drivers/clocksource/arm_arch_timer.c |   3 +-
 drivers/irqchip/irq-gic.c            |   4 +-
 include/linux/acpi.h                 | 104 ++++++++++++++++++++++++-----------
 include/linux/clocksource.h          |   2 +-
 include/linux/irqchip.h              |   5 +-
 6 files changed, 109 insertions(+), 53 deletions(-)

diff --git a/drivers/acpi/scan.c b/drivers/acpi/scan.c
index 5f28cf7..09b5f63 100644
--- a/drivers/acpi/scan.c
+++ b/drivers/acpi/scan.c
@@ -1969,16 +1969,38 @@ static struct acpi_probe_entry *ape;
 static int acpi_probe_count;
 static DEFINE_SPINLOCK(acpi_probe_lock);
 
-static int __init acpi_match_madt(struct acpi_subtable_header *header,
-				  const unsigned long end)
+static int __init acpi_match_and_setup(struct acpi_subtable_header *header,
+				       const unsigned long end)
 {
-	if (!ape->subtable_valid || ape->subtable_valid(header, ape))
-		if (!ape->probe_subtbl(header, end))
+	const struct acpi_probe_subtype_data *data = ape->data;
+
+	if (data->valid(header, data->data))
+		if (!data->setup(header, end))
 			acpi_probe_count++;
 
 	return 0;
 }
 
+int __init acpi_probe_subtype_setup(struct acpi_table_header *table,
+				    const void *data)
+{
+	const struct acpi_probe_subtype_data *data_subtype = data;
+
+	return acpi_parse_entries(ape->id, data_subtype->size,
+				  acpi_match_and_setup, table,
+				  data_subtype->subtype, 0);
+}
+
+static int __init acpi_probe_table_handler(struct acpi_table_header *table)
+{
+	int err = ape->setup(table, ape->data);
+
+	if (ape->setup != acpi_probe_subtype_setup && err >= 0)
+		acpi_probe_count++;
+
+	return err;
+}
+
 int __init __acpi_probe_device_table(struct acpi_probe_entry *ap_head, int nr)
 {
 	int count = 0;
@@ -1988,16 +2010,10 @@ int __init __acpi_probe_device_table(struct acpi_probe_entry *ap_head, int nr)
 
 	spin_lock(&acpi_probe_lock);
 	for (ape = ap_head; nr; ape++, nr--) {
-		if (ACPI_COMPARE_NAME(ACPI_SIG_MADT, ape->id)) {
-			acpi_probe_count = 0;
-			acpi_table_parse_madt(ape->type, acpi_match_madt, 0);
-			count += acpi_probe_count;
-		} else {
-			int res;
-			res = acpi_table_parse(ape->id, ape->probe_table);
-			if (!res)
-				count++;
-		}
+		acpi_probe_count = 0;
+		if (acpi_table_parse(ape->id, acpi_probe_table_handler) < 0)
+			continue;
+		count += acpi_probe_count;
 	}
 	spin_unlock(&acpi_probe_lock);
 
diff --git a/drivers/clocksource/arm_arch_timer.c b/drivers/clocksource/arm_arch_timer.c
index f492ced..c0df7cb 100644
--- a/drivers/clocksource/arm_arch_timer.c
+++ b/drivers/clocksource/arm_arch_timer.c
@@ -868,7 +868,8 @@ static int __init map_generic_timer_interrupt(u32 interrupt, u32 flags)
 }
 
 /* Initialize per-processor generic timer */
-static int __init arch_timer_acpi_init(struct acpi_table_header *table)
+static int __init arch_timer_acpi_init(struct acpi_table_header *table,
+				       const void *data)
 {
 	struct acpi_table_gtdt *gtdt;
 
diff --git a/drivers/irqchip/irq-gic.c b/drivers/irqchip/irq-gic.c
index 282344b..13d8323 100644
--- a/drivers/irqchip/irq-gic.c
+++ b/drivers/irqchip/irq-gic.c
@@ -1287,12 +1287,12 @@ static bool __init acpi_gic_redist_is_present(void)
 }
 
 static bool __init gic_validate_dist(struct acpi_subtable_header *header,
-				     struct acpi_probe_entry *ape)
+				     kernel_ulong_t driver_data)
 {
 	struct acpi_madt_generic_distributor *dist;
 	dist = (struct acpi_madt_generic_distributor *)header;
 
-	return (dist->version == ape->driver_data &&
+	return (dist->version == driver_data &&
 		(dist->version != ACPI_MADT_GIC_VERSION_NONE ||
 		 !acpi_gic_redist_is_present()));
 }
diff --git a/include/linux/acpi.h b/include/linux/acpi.h
index 06ed7e5..9636c32 100644
--- a/include/linux/acpi.h
+++ b/include/linux/acpi.h
@@ -879,47 +879,76 @@ int acpi_dev_prop_read(struct acpi_device *adev, const char *propname,
 struct fwnode_handle *acpi_get_next_subnode(struct device *dev,
 					    struct fwnode_handle *subnode);
 
-struct acpi_probe_entry;
 typedef bool (*acpi_probe_entry_validate_subtbl)(struct acpi_subtable_header *,
-						 struct acpi_probe_entry *);
+						 kernel_ulong_t);
+
+typedef int (*acpi_probe_entry_setup)(struct acpi_table_header *, const void *);
 
 #define ACPI_TABLE_ID_LEN	5
 
-/**
- * struct acpi_probe_entry - boot-time probing entry
- * @id:			ACPI table name
- * @type:		Optional subtable type to match
- *			(if @id contains subtables)
- * @subtable_valid:	Optional callback to check the validity of
- *			the subtable
- * @probe_table:	Callback to the driver being probed when table
- *			match is successful
- * @probe_subtbl:	Callback to the driver being probed when table and
- *			subtable match (and optional callback is successful)
- * @driver_data:	Sideband data provided back to the driver
- */
 struct acpi_probe_entry {
 	__u8 id[ACPI_TABLE_ID_LEN];
-	__u8 type;
-	acpi_probe_entry_validate_subtbl subtable_valid;
-	union {
-		acpi_tbl_table_handler probe_table;
-		acpi_tbl_entry_handler probe_subtbl;
-	};
-	kernel_ulong_t driver_data;
+	acpi_probe_entry_setup setup;
+	const void *data;
 };
 
-#define ACPI_DECLARE_PROBE_ENTRY(table, name, table_id, subtable, valid, data, fn)	\
+/**
+ * ACPI_DECLARE_PROBE_ENTRY() - declare boot-time probing entry
+ * @table:		Name of subsystem to match
+ * @name:               Identifier to compose name of table data
+ * @table_id:		ACPI table name
+ * @setup_fn:		Callback to the driver being probed when table
+ *			matches (of type acpi_probe_entry_setup)
+ * @data_ptr:		Sideband data provided back to the driver
+ */
+#define ACPI_DECLARE_PROBE_ENTRY(table, name, table_id, setup_fn, data_ptr) \
 	static const struct acpi_probe_entry __acpi_probe_##name	\
 		__used __section(__##table##_acpi_probe_table)		\
 		 = {							\
 			.id = table_id,					\
-			.type = subtable,				\
-			.subtable_valid = valid,			\
-			.probe_table = (acpi_tbl_table_handler)fn,	\
-			.driver_data = data, 				\
+			.setup = setup_fn,				\
+			.data = data_ptr,				\
 		   }
 
+struct acpi_probe_subtype_data {
+	u8 subtype;
+	unsigned long size;
+	acpi_probe_entry_validate_subtbl valid;
+	acpi_tbl_entry_handler setup;
+	kernel_ulong_t data;
+};
+
+int acpi_probe_subtype_setup(struct acpi_table_header *table, const void *data);
+
+/**
+ * ACPI_DECLARE_PROBE_SUBTYPE_ENTRY() - declare boot-time probing entry that
+ *				      matches subtables
+ * @table:		Name of subsystem to match
+ * @name:               Identifier to compose name of table data
+ * @table_id:		ACPI table name
+ * @table_size:		Size of the table (without subtables) of type table_id
+ * @subtable:		Subtable type to match
+ * @valid_fn:		Callback to check the validity of the subtable
+ *			(of type acpi_probe_entry_validate_subtbl)
+ * @data_int:		Sideband data provided back to the driver
+ *			(of type kernel_ulong_t)
+ * @setup_fn:		Callback to the driver being probed when table and
+ *			subtable match and valid_fn callback is successful
+ *			(of type acpi_tbl_entry_handler)
+ */
+#define ACPI_DECLARE_PROBE_SUBTYPE_ENTRY(table, name, table_id, table_size, \
+				subtable, valid_fn, data_int, setup_fn)     \
+	static const struct acpi_probe_subtype_data			    \
+	__acpi_probe_subtype_##name __used = {				    \
+			.subtype = subtable,				    \
+			.size = table_size,				    \
+			.valid = valid_fn,				    \
+			.setup = setup_fn,				    \
+			.data = data_int,				    \
+		   };							    \
+	ACPI_DECLARE_PROBE_ENTRY(table, name, table_id,			    \
+		acpi_probe_subtype_setup, &__acpi_probe_subtype_##name)
+
 #define ACPI_PROBE_TABLE(name)		__##name##_acpi_probe_table
 #define ACPI_PROBE_TABLE_END(name)	__##name##_acpi_probe_table_end
 
@@ -992,14 +1021,23 @@ static inline struct fwnode_handle *acpi_get_next_subnode(struct device *dev,
 	return NULL;
 }
 
-#define ACPI_DECLARE_PROBE_ENTRY(table, name, table_id, subtable, validate, data, fn) \
+#define ACPI_DECLARE_PROBE_ENTRY(table, name, table_id, match, data)	\
 	static const void * __acpi_table_##name[]			\
 		__attribute__((unused))					\
-		 = { (void *) table_id,					\
-		     (void *) subtable,					\
-		     (void *) valid,					\
-		     (void *) fn,					\
-		     (void *) data }
+		 = { (void *)table_id,					\
+		     (void *)match,					\
+		     (void *)data }
+
+#define ACPI_DECLARE_PROBE_SUBTYPE_ENTRY(table, name, table_id, table_size, \
+				subtable, valid_fn, data_int, setup_fn)	    \
+	static const void *__acpi_table_##name[]			\
+		__attribute__((unused))					\
+		 = { (void *)table_id,					\
+		     (void *)table_size,				\
+		     (void *)subtable,					\
+		     (void *)valid_fn,					\
+		     (void *)data_int,					\
+		     (void *)setup_fn }
 
 #define acpi_probe_device_table(t)	({ int __r = 0; __r;})
 #endif
diff --git a/include/linux/clocksource.h b/include/linux/clocksource.h
index 6013021..2bb5d51 100644
--- a/include/linux/clocksource.h
+++ b/include/linux/clocksource.h
@@ -259,6 +259,6 @@ static inline void clocksource_probe(void) {}
 #endif
 
 #define CLOCKSOURCE_ACPI_DECLARE(name, table_id, fn)		\
-	ACPI_DECLARE_PROBE_ENTRY(clksrc, name, table_id, 0, NULL, 0, fn)
+	ACPI_DECLARE_PROBE_ENTRY(clksrc, name, table_id, fn, NULL)
 
 #endif /* _LINUX_CLOCKSOURCE_H */
diff --git a/include/linux/irqchip.h b/include/linux/irqchip.h
index 89c34b2..cc4c455 100644
--- a/include/linux/irqchip.h
+++ b/include/linux/irqchip.h
@@ -39,8 +39,9 @@
  * @fn: initialization function
  */
 #define IRQCHIP_ACPI_DECLARE(name, subtable, validate, data, fn)	\
-	ACPI_DECLARE_PROBE_ENTRY(irqchip, name, ACPI_SIG_MADT, 		\
-				 subtable, validate, data, fn)
+	ACPI_DECLARE_PROBE_SUBTYPE_ENTRY(irqchip, name, ACPI_SIG_MADT,	\
+					 sizeof(struct acpi_table_madt),\
+					 subtable, validate, data, fn)
 
 #ifdef CONFIG_IRQCHIP
 void irqchip_init(void);
-- 
2.7.1

^ permalink raw reply related	[flat|nested] 34+ messages in thread

* [PATCH v2 5/8] ACPI: parse DBG2 table
  2016-02-24 17:10 ` Aleksey Makarov
@ 2016-02-24 17:10   ` Aleksey Makarov
  -1 siblings, 0 replies; 34+ messages in thread
From: Aleksey Makarov @ 2016-02-24 17:10 UTC (permalink / raw)
  To: linux-acpi
  Cc: linux-serial, linux-kernel, linux-arm-kernel, Aleksey Makarov,
	Russell King, Greg Kroah-Hartman, Rafael J . Wysocki,
	Leif Lindholm, Graeme Gregory, Al Stone, Christopher Covington,
	Len Brown, Arnd Bergmann, linux-arch

'ARM Server Base Boot Requiremets' [1] mentions DBG2 (Microsoft Debug
Port Table 2) [2] as a mandatory ACPI table that specifies debug ports.

- Implement macros

	ACPI_DBG2_DECLARE(name, type, subtype, setup_fn, data_ptr)

  that defines a handler for the port of given type and subtype.

- For each declared port that is also described in the ACPI DBG2 table
  call the provided callback.

[1] http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.den0044a/index.html
[2] http://go.microsoft.com/fwlink/p/?LinkId=234837

Signed-off-by: Aleksey Makarov <aleksey.makarov@linaro.org>
---
 drivers/acpi/Kconfig              |  3 ++
 drivers/acpi/Makefile             |  1 +
 drivers/acpi/dbg2.c               | 85 +++++++++++++++++++++++++++++++++++++++
 include/asm-generic/vmlinux.lds.h |  1 +
 include/linux/acpi_dbg2.h         | 48 ++++++++++++++++++++++
 5 files changed, 138 insertions(+)
 create mode 100644 drivers/acpi/dbg2.c
 create mode 100644 include/linux/acpi_dbg2.h

diff --git a/drivers/acpi/Kconfig b/drivers/acpi/Kconfig
index 65fb483..660666e 100644
--- a/drivers/acpi/Kconfig
+++ b/drivers/acpi/Kconfig
@@ -57,6 +57,9 @@ config ACPI_SYSTEM_POWER_STATES_SUPPORT
 config ACPI_CCA_REQUIRED
 	bool
 
+config ACPI_DBG2_TABLE
+	bool
+
 config ACPI_DEBUGGER
 	bool "AML debugger interface"
 	select ACPI_DEBUG
diff --git a/drivers/acpi/Makefile b/drivers/acpi/Makefile
index 7395928..3b5f1ea 100644
--- a/drivers/acpi/Makefile
+++ b/drivers/acpi/Makefile
@@ -83,6 +83,7 @@ obj-$(CONFIG_ACPI_CUSTOM_METHOD)+= custom_method.o
 obj-$(CONFIG_ACPI_BGRT)		+= bgrt.o
 obj-$(CONFIG_ACPI_CPPC_LIB)	+= cppc_acpi.o
 obj-$(CONFIG_ACPI_DEBUGGER_USER) += acpi_dbg.o
+obj-$(CONFIG_ACPI_DBG2_TABLE)	+= dbg2.o
 
 # processor has its own "processor." module_param namespace
 processor-y			:= processor_driver.o
diff --git a/drivers/acpi/dbg2.c b/drivers/acpi/dbg2.c
new file mode 100644
index 0000000..8a79117
--- /dev/null
+++ b/drivers/acpi/dbg2.c
@@ -0,0 +1,85 @@
+/*
+ * Copyright (c) 2012, Intel Corporation
+ * Copyright (c) 2015, 2016 Linaro Ltd.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ *
+ */
+
+#define pr_fmt(fmt) "ACPI: DBG2: " fmt
+
+#include <linux/acpi_dbg2.h>
+#include <linux/acpi.h>
+#include <linux/kernel.h>
+
+static const char * __init type2string(u16 type)
+{
+	switch (type) {
+	case ACPI_DBG2_SERIAL_PORT:
+		return "SERIAL";
+	case ACPI_DBG2_1394_PORT:
+		return "1394";
+	case ACPI_DBG2_USB_PORT:
+		return "USB";
+	case ACPI_DBG2_NET_PORT:
+		return "NET";
+	default:
+		return "?";
+	}
+}
+
+static const char * __init subtype2string(u16 subtype)
+{
+	switch (subtype) {
+	case ACPI_DBG2_16550_COMPATIBLE:
+		return "16550_COMPATIBLE";
+	case ACPI_DBG2_16550_SUBSET:
+		return "16550_SUBSET";
+	case ACPI_DBG2_ARM_PL011:
+		return "ARM_PL011";
+	case ACPI_DBG2_ARM_SBSA_32BIT:
+		return "ARM_SBSA_32BIT";
+	case ACPI_DBG2_ARM_SBSA_GENERIC:
+		return "ARM_SBSA_GENERIC";
+	case ACPI_DBG2_ARM_DCC:
+		return "ARM_DCC";
+	case ACPI_DBG2_BCM2835:
+		return "BCM2835";
+	default:
+		return "?";
+	}
+}
+
+int __init acpi_dbg2_setup(struct acpi_table_header *table, const void *data)
+{
+	struct acpi_table_dbg2 *dbg2 = (struct acpi_table_dbg2 *)table;
+	struct acpi_dbg2_data *dbg2_data = (struct acpi_dbg2_data *)data;
+	struct acpi_dbg2_device *dbg2_device, *dbg2_end;
+	int i;
+
+	dbg2_device = ACPI_ADD_PTR(struct acpi_dbg2_device, dbg2,
+				   dbg2->info_offset);
+	dbg2_end = ACPI_ADD_PTR(struct acpi_dbg2_device, dbg2, table->length);
+
+	for (i = 0; i < dbg2->info_count; i++) {
+		if (dbg2_device + 1 > dbg2_end) {
+			pr_err("device pointer overflows, bad table\n");
+			return 0;
+		}
+
+		if (dbg2_device->port_type == dbg2_data->port_type &&
+		    dbg2_device->port_subtype == dbg2_data->port_subtype) {
+			pr_info("debug port type: %s subtype: %s\n",
+				type2string(dbg2_device->port_type),
+				subtype2string(dbg2_device->port_subtype));
+			dbg2_data->setup(dbg2_device, dbg2_data->data);
+		}
+
+		dbg2_device = ACPI_ADD_PTR(struct acpi_dbg2_device, dbg2_device,
+					   dbg2_device->length);
+	}
+
+	return 0;
+}
diff --git a/include/asm-generic/vmlinux.lds.h b/include/asm-generic/vmlinux.lds.h
index e9a81a6..ab6a727 100644
--- a/include/asm-generic/vmlinux.lds.h
+++ b/include/asm-generic/vmlinux.lds.h
@@ -525,6 +525,7 @@
 	IRQCHIP_OF_MATCH_TABLE()					\
 	ACPI_PROBE_TABLE(irqchip)					\
 	ACPI_PROBE_TABLE(clksrc)					\
+	ACPI_PROBE_TABLE(dbg2)						\
 	EARLYCON_TABLE()
 
 #define INIT_TEXT							\
diff --git a/include/linux/acpi_dbg2.h b/include/linux/acpi_dbg2.h
new file mode 100644
index 0000000..125ae7e
--- /dev/null
+++ b/include/linux/acpi_dbg2.h
@@ -0,0 +1,48 @@
+#ifndef _ACPI_DBG2_H_
+#define _ACPI_DBG2_H_
+
+#ifdef CONFIG_ACPI_DBG2_TABLE
+
+#include <linux/kernel.h>
+
+struct acpi_dbg2_device;
+struct acpi_table_header;
+
+struct acpi_dbg2_data {
+	u16 port_type;
+	u16 port_subtype;
+	int (*setup)(struct acpi_dbg2_device *, void *);
+	void *data;
+};
+
+int acpi_dbg2_setup(struct acpi_table_header *header, const void *data);
+
+/**
+ * ACPI_DBG2_DECLARE() - Define handler for ACPI DBG2 port
+ * @name:	Identifier to compose name of table data
+ * @type:	Type of the port
+ * @subtype:	Subtype of the port
+ * @setup_fn:	Function to be called to setup the port
+ *		(of type int (*)(struct acpi_dbg2_device *, void *);)
+ * @data_ptr:	Sideband data provided back to the driver
+ */
+#define ACPI_DBG2_DECLARE(name, type, subtype, setup_fn, data_ptr)	\
+	static const struct acpi_dbg2_data				\
+		__acpi_dbg2_data_##name __used = {			\
+			.port_type = type,				\
+			.port_subtype = subtype,			\
+			.setup = setup_fn,				\
+			.data = data_ptr,				\
+		   };							\
+	ACPI_DECLARE_PROBE_ENTRY(dbg2, name, ACPI_SIG_DBG2,		\
+				 acpi_dbg2_setup, &__acpi_dbg2_data_##name)
+
+#else
+
+#define ACPI_DBG2_DECLARE(name, type, subtype, setup_fn, data_ptr)	\
+	static const void *__acpi_dbg_data_##name[]			\
+		__used __initdata = { (void *)setup_fn,	(void *)data_ptr }
+
+#endif
+
+#endif
-- 
2.7.1

^ permalink raw reply related	[flat|nested] 34+ messages in thread

* [PATCH v2 5/8] ACPI: parse DBG2 table
@ 2016-02-24 17:10   ` Aleksey Makarov
  0 siblings, 0 replies; 34+ messages in thread
From: Aleksey Makarov @ 2016-02-24 17:10 UTC (permalink / raw)
  To: linux-arm-kernel

'ARM Server Base Boot Requiremets' [1] mentions DBG2 (Microsoft Debug
Port Table 2) [2] as a mandatory ACPI table that specifies debug ports.

- Implement macros

	ACPI_DBG2_DECLARE(name, type, subtype, setup_fn, data_ptr)

  that defines a handler for the port of given type and subtype.

- For each declared port that is also described in the ACPI DBG2 table
  call the provided callback.

[1] http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.den0044a/index.html
[2] http://go.microsoft.com/fwlink/p/?LinkId=234837

Signed-off-by: Aleksey Makarov <aleksey.makarov@linaro.org>
---
 drivers/acpi/Kconfig              |  3 ++
 drivers/acpi/Makefile             |  1 +
 drivers/acpi/dbg2.c               | 85 +++++++++++++++++++++++++++++++++++++++
 include/asm-generic/vmlinux.lds.h |  1 +
 include/linux/acpi_dbg2.h         | 48 ++++++++++++++++++++++
 5 files changed, 138 insertions(+)
 create mode 100644 drivers/acpi/dbg2.c
 create mode 100644 include/linux/acpi_dbg2.h

diff --git a/drivers/acpi/Kconfig b/drivers/acpi/Kconfig
index 65fb483..660666e 100644
--- a/drivers/acpi/Kconfig
+++ b/drivers/acpi/Kconfig
@@ -57,6 +57,9 @@ config ACPI_SYSTEM_POWER_STATES_SUPPORT
 config ACPI_CCA_REQUIRED
 	bool
 
+config ACPI_DBG2_TABLE
+	bool
+
 config ACPI_DEBUGGER
 	bool "AML debugger interface"
 	select ACPI_DEBUG
diff --git a/drivers/acpi/Makefile b/drivers/acpi/Makefile
index 7395928..3b5f1ea 100644
--- a/drivers/acpi/Makefile
+++ b/drivers/acpi/Makefile
@@ -83,6 +83,7 @@ obj-$(CONFIG_ACPI_CUSTOM_METHOD)+= custom_method.o
 obj-$(CONFIG_ACPI_BGRT)		+= bgrt.o
 obj-$(CONFIG_ACPI_CPPC_LIB)	+= cppc_acpi.o
 obj-$(CONFIG_ACPI_DEBUGGER_USER) += acpi_dbg.o
+obj-$(CONFIG_ACPI_DBG2_TABLE)	+= dbg2.o
 
 # processor has its own "processor." module_param namespace
 processor-y			:= processor_driver.o
diff --git a/drivers/acpi/dbg2.c b/drivers/acpi/dbg2.c
new file mode 100644
index 0000000..8a79117
--- /dev/null
+++ b/drivers/acpi/dbg2.c
@@ -0,0 +1,85 @@
+/*
+ * Copyright (c) 2012, Intel Corporation
+ * Copyright (c) 2015, 2016 Linaro Ltd.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ *
+ */
+
+#define pr_fmt(fmt) "ACPI: DBG2: " fmt
+
+#include <linux/acpi_dbg2.h>
+#include <linux/acpi.h>
+#include <linux/kernel.h>
+
+static const char * __init type2string(u16 type)
+{
+	switch (type) {
+	case ACPI_DBG2_SERIAL_PORT:
+		return "SERIAL";
+	case ACPI_DBG2_1394_PORT:
+		return "1394";
+	case ACPI_DBG2_USB_PORT:
+		return "USB";
+	case ACPI_DBG2_NET_PORT:
+		return "NET";
+	default:
+		return "?";
+	}
+}
+
+static const char * __init subtype2string(u16 subtype)
+{
+	switch (subtype) {
+	case ACPI_DBG2_16550_COMPATIBLE:
+		return "16550_COMPATIBLE";
+	case ACPI_DBG2_16550_SUBSET:
+		return "16550_SUBSET";
+	case ACPI_DBG2_ARM_PL011:
+		return "ARM_PL011";
+	case ACPI_DBG2_ARM_SBSA_32BIT:
+		return "ARM_SBSA_32BIT";
+	case ACPI_DBG2_ARM_SBSA_GENERIC:
+		return "ARM_SBSA_GENERIC";
+	case ACPI_DBG2_ARM_DCC:
+		return "ARM_DCC";
+	case ACPI_DBG2_BCM2835:
+		return "BCM2835";
+	default:
+		return "?";
+	}
+}
+
+int __init acpi_dbg2_setup(struct acpi_table_header *table, const void *data)
+{
+	struct acpi_table_dbg2 *dbg2 = (struct acpi_table_dbg2 *)table;
+	struct acpi_dbg2_data *dbg2_data = (struct acpi_dbg2_data *)data;
+	struct acpi_dbg2_device *dbg2_device, *dbg2_end;
+	int i;
+
+	dbg2_device = ACPI_ADD_PTR(struct acpi_dbg2_device, dbg2,
+				   dbg2->info_offset);
+	dbg2_end = ACPI_ADD_PTR(struct acpi_dbg2_device, dbg2, table->length);
+
+	for (i = 0; i < dbg2->info_count; i++) {
+		if (dbg2_device + 1 > dbg2_end) {
+			pr_err("device pointer overflows, bad table\n");
+			return 0;
+		}
+
+		if (dbg2_device->port_type == dbg2_data->port_type &&
+		    dbg2_device->port_subtype == dbg2_data->port_subtype) {
+			pr_info("debug port type: %s subtype: %s\n",
+				type2string(dbg2_device->port_type),
+				subtype2string(dbg2_device->port_subtype));
+			dbg2_data->setup(dbg2_device, dbg2_data->data);
+		}
+
+		dbg2_device = ACPI_ADD_PTR(struct acpi_dbg2_device, dbg2_device,
+					   dbg2_device->length);
+	}
+
+	return 0;
+}
diff --git a/include/asm-generic/vmlinux.lds.h b/include/asm-generic/vmlinux.lds.h
index e9a81a6..ab6a727 100644
--- a/include/asm-generic/vmlinux.lds.h
+++ b/include/asm-generic/vmlinux.lds.h
@@ -525,6 +525,7 @@
 	IRQCHIP_OF_MATCH_TABLE()					\
 	ACPI_PROBE_TABLE(irqchip)					\
 	ACPI_PROBE_TABLE(clksrc)					\
+	ACPI_PROBE_TABLE(dbg2)						\
 	EARLYCON_TABLE()
 
 #define INIT_TEXT							\
diff --git a/include/linux/acpi_dbg2.h b/include/linux/acpi_dbg2.h
new file mode 100644
index 0000000..125ae7e
--- /dev/null
+++ b/include/linux/acpi_dbg2.h
@@ -0,0 +1,48 @@
+#ifndef _ACPI_DBG2_H_
+#define _ACPI_DBG2_H_
+
+#ifdef CONFIG_ACPI_DBG2_TABLE
+
+#include <linux/kernel.h>
+
+struct acpi_dbg2_device;
+struct acpi_table_header;
+
+struct acpi_dbg2_data {
+	u16 port_type;
+	u16 port_subtype;
+	int (*setup)(struct acpi_dbg2_device *, void *);
+	void *data;
+};
+
+int acpi_dbg2_setup(struct acpi_table_header *header, const void *data);
+
+/**
+ * ACPI_DBG2_DECLARE() - Define handler for ACPI DBG2 port
+ * @name:	Identifier to compose name of table data
+ * @type:	Type of the port
+ * @subtype:	Subtype of the port
+ * @setup_fn:	Function to be called to setup the port
+ *		(of type int (*)(struct acpi_dbg2_device *, void *);)
+ * @data_ptr:	Sideband data provided back to the driver
+ */
+#define ACPI_DBG2_DECLARE(name, type, subtype, setup_fn, data_ptr)	\
+	static const struct acpi_dbg2_data				\
+		__acpi_dbg2_data_##name __used = {			\
+			.port_type = type,				\
+			.port_subtype = subtype,			\
+			.setup = setup_fn,				\
+			.data = data_ptr,				\
+		   };							\
+	ACPI_DECLARE_PROBE_ENTRY(dbg2, name, ACPI_SIG_DBG2,		\
+				 acpi_dbg2_setup, &__acpi_dbg2_data_##name)
+
+#else
+
+#define ACPI_DBG2_DECLARE(name, type, subtype, setup_fn, data_ptr)	\
+	static const void *__acpi_dbg_data_##name[]			\
+		__used __initdata = { (void *)setup_fn,	(void *)data_ptr }
+
+#endif
+
+#endif
-- 
2.7.1

^ permalink raw reply related	[flat|nested] 34+ messages in thread

* [PATCH v2 6/8] ACPI: serial: implement earlycon on ACPI DBG2 port
  2016-02-24 17:10 ` Aleksey Makarov
@ 2016-02-24 17:10   ` Aleksey Makarov
  -1 siblings, 0 replies; 34+ messages in thread
From: Aleksey Makarov @ 2016-02-24 17:10 UTC (permalink / raw)
  To: linux-acpi
  Cc: linux-serial, linux-kernel, linux-arm-kernel, Aleksey Makarov,
	Russell King, Greg Kroah-Hartman, Rafael J . Wysocki,
	Leif Lindholm, Graeme Gregory, Al Stone, Christopher Covington,
	Jonathan Corbet, Jiri Slaby, linux-doc

Add ACPI_DBG2_EARLYCON_DECLARE() macros that declares
an earlycon on the serial port specified in the DBG2 ACPI table.

Pass the string "earlycon=acpi_dbg2" to the kernel to activate it.

Callbacks for EARLYCON_DECLARE() and OF_EARLYCON_DECLARE()
can also be used for this macros.

Signed-off-by: Aleksey Makarov <aleksey.makarov@linaro.org>
---
 Documentation/kernel-parameters.txt |  3 ++
 drivers/tty/serial/earlycon.c       | 60 +++++++++++++++++++++++++++++++++++++
 include/linux/acpi_dbg2.h           | 20 +++++++++++++
 3 files changed, 83 insertions(+)

diff --git a/Documentation/kernel-parameters.txt b/Documentation/kernel-parameters.txt
index 1fee970..22600e0 100644
--- a/Documentation/kernel-parameters.txt
+++ b/Documentation/kernel-parameters.txt
@@ -1069,6 +1069,9 @@ bytes respectively. Such letter suffixes can also be entirely omitted.
 			A valid base address must be provided, and the serial
 			port must already be setup and configured.
 
+		acpi_dbg2
+			Use serial port specified by the DBG2 ACPI table.
+
 	earlyprintk=	[X86,SH,BLACKFIN,ARM,M68k]
 			earlyprintk=vga
 			earlyprintk=efi
diff --git a/drivers/tty/serial/earlycon.c b/drivers/tty/serial/earlycon.c
index d217366..9ba3a04 100644
--- a/drivers/tty/serial/earlycon.c
+++ b/drivers/tty/serial/earlycon.c
@@ -22,6 +22,7 @@
 #include <linux/sizes.h>
 #include <linux/of.h>
 #include <linux/of_fdt.h>
+#include <linux/acpi.h>
 
 #ifdef CONFIG_FIX_EARLYCON_MEM
 #include <asm/fixmap.h>
@@ -200,6 +201,8 @@ int __init setup_earlycon(char *buf)
 	return -ENOENT;
 }
 
+static bool setup_dbg2_earlycon;
+
 /* early_param wrapper for setup_earlycon() */
 static int __init param_setup_earlycon(char *buf)
 {
@@ -212,6 +215,11 @@ static int __init param_setup_earlycon(char *buf)
 	if (!buf || !buf[0])
 		return early_init_dt_scan_chosen_serial();
 
+	if (!strcmp(buf, "acpi_dbg2")) {
+		setup_dbg2_earlycon = true;
+		return 0;
+	}
+
 	err = setup_earlycon(buf);
 	if (err == -ENOENT || err == -EALREADY)
 		return 0;
@@ -286,3 +294,55 @@ int __init of_setup_earlycon(const struct earlycon_id *match,
 }
 
 #endif /* CONFIG_OF_EARLY_FLATTREE */
+
+#ifdef CONFIG_ACPI_DBG2_TABLE
+
+int __init acpi_setup_earlycon(struct acpi_dbg2_device *device, void *d)
+{
+	int err;
+	struct uart_port *port = &early_console_dev.port;
+	int (*setup)(struct earlycon_device *, const char *) = d;
+	struct acpi_generic_address *reg;
+
+	if (!setup_dbg2_earlycon)
+		return -ENODEV;
+
+	if (device->register_count < 1)
+		return -ENODEV;
+
+	if (device->base_address_offset >= device->length)
+		return -EINVAL;
+
+	reg = (void *)device + device->base_address_offset;
+
+	if (reg->space_id != ACPI_ADR_SPACE_SYSTEM_MEMORY &&
+	    reg->space_id != ACPI_ADR_SPACE_SYSTEM_IO)
+		return -EINVAL;
+
+	spin_lock_init(&port->lock);
+	port->uartclk = BASE_BAUD * 16;
+
+	if (reg->space_id == ACPI_ADR_SPACE_SYSTEM_MEMORY) {
+		if (device->port_type == ACPI_DBG2_ARM_SBSA_32BIT)
+			port->iotype = UPIO_MEM32;
+		else
+			port->iotype = UPIO_MEM;
+		port->mapbase = reg->address;
+		port->membase = earlycon_map(reg->address, SZ_4K);
+	} else {
+		port->iotype = UPIO_PORT;
+		port->iobase = reg->address;
+	}
+
+	early_console_dev.con->data = &early_console_dev;
+	err = setup(&early_console_dev, NULL);
+	if (err < 0)
+		return err;
+	if (!early_console_dev.con->write)
+		return -ENODEV;
+
+	register_console(early_console_dev.con);
+	return 0;
+}
+
+#endif /* CONFIG_ACPI_DBG2_TABLE */
diff --git a/include/linux/acpi_dbg2.h b/include/linux/acpi_dbg2.h
index 125ae7e..b653752 100644
--- a/include/linux/acpi_dbg2.h
+++ b/include/linux/acpi_dbg2.h
@@ -37,12 +37,32 @@ int acpi_dbg2_setup(struct acpi_table_header *header, const void *data);
 	ACPI_DECLARE_PROBE_ENTRY(dbg2, name, ACPI_SIG_DBG2,		\
 				 acpi_dbg2_setup, &__acpi_dbg2_data_##name)
 
+int acpi_setup_earlycon(struct acpi_dbg2_device *device, void *d);
+
+/**
+ * ACPI_DBG2_EARLYCON_DECLARE() - Define handler for ACPI GDB2 serial port
+ * @name:		Identifier to compose name of table data
+ * @subtype:		Subtype of the port
+ * @console_setup:	Function to be called to setup the port
+ *
+ * Type of the console_setup() callback is
+ * int (*setup)(struct earlycon_device *, const char *)
+ * It's the type of callback of of_setup_earlycon().
+ */
+#define ACPI_DBG2_EARLYCON_DECLARE(name, subtype, console_setup)	\
+	ACPI_DBG2_DECLARE(name, ACPI_DBG2_SERIAL_PORT, subtype,		\
+			  acpi_setup_earlycon, console_setup)
+
 #else
 
 #define ACPI_DBG2_DECLARE(name, type, subtype, setup_fn, data_ptr)	\
 	static const void *__acpi_dbg_data_##name[]			\
 		__used __initdata = { (void *)setup_fn,	(void *)data_ptr }
 
+#define ACPI_DBG2_EARLYCON_DECLARE(name, subtype, console_setup)	\
+	static const void *__acpi_dbg_data_serial_##name[]		\
+		__used __initdata = { (void *)console_setup }
+
 #endif
 
 #endif
-- 
2.7.1

^ permalink raw reply related	[flat|nested] 34+ messages in thread

* [PATCH v2 6/8] ACPI: serial: implement earlycon on ACPI DBG2 port
@ 2016-02-24 17:10   ` Aleksey Makarov
  0 siblings, 0 replies; 34+ messages in thread
From: Aleksey Makarov @ 2016-02-24 17:10 UTC (permalink / raw)
  To: linux-arm-kernel

Add ACPI_DBG2_EARLYCON_DECLARE() macros that declares
an earlycon on the serial port specified in the DBG2 ACPI table.

Pass the string "earlycon=acpi_dbg2" to the kernel to activate it.

Callbacks for EARLYCON_DECLARE() and OF_EARLYCON_DECLARE()
can also be used for this macros.

Signed-off-by: Aleksey Makarov <aleksey.makarov@linaro.org>
---
 Documentation/kernel-parameters.txt |  3 ++
 drivers/tty/serial/earlycon.c       | 60 +++++++++++++++++++++++++++++++++++++
 include/linux/acpi_dbg2.h           | 20 +++++++++++++
 3 files changed, 83 insertions(+)

diff --git a/Documentation/kernel-parameters.txt b/Documentation/kernel-parameters.txt
index 1fee970..22600e0 100644
--- a/Documentation/kernel-parameters.txt
+++ b/Documentation/kernel-parameters.txt
@@ -1069,6 +1069,9 @@ bytes respectively. Such letter suffixes can also be entirely omitted.
 			A valid base address must be provided, and the serial
 			port must already be setup and configured.
 
+		acpi_dbg2
+			Use serial port specified by the DBG2 ACPI table.
+
 	earlyprintk=	[X86,SH,BLACKFIN,ARM,M68k]
 			earlyprintk=vga
 			earlyprintk=efi
diff --git a/drivers/tty/serial/earlycon.c b/drivers/tty/serial/earlycon.c
index d217366..9ba3a04 100644
--- a/drivers/tty/serial/earlycon.c
+++ b/drivers/tty/serial/earlycon.c
@@ -22,6 +22,7 @@
 #include <linux/sizes.h>
 #include <linux/of.h>
 #include <linux/of_fdt.h>
+#include <linux/acpi.h>
 
 #ifdef CONFIG_FIX_EARLYCON_MEM
 #include <asm/fixmap.h>
@@ -200,6 +201,8 @@ int __init setup_earlycon(char *buf)
 	return -ENOENT;
 }
 
+static bool setup_dbg2_earlycon;
+
 /* early_param wrapper for setup_earlycon() */
 static int __init param_setup_earlycon(char *buf)
 {
@@ -212,6 +215,11 @@ static int __init param_setup_earlycon(char *buf)
 	if (!buf || !buf[0])
 		return early_init_dt_scan_chosen_serial();
 
+	if (!strcmp(buf, "acpi_dbg2")) {
+		setup_dbg2_earlycon = true;
+		return 0;
+	}
+
 	err = setup_earlycon(buf);
 	if (err == -ENOENT || err == -EALREADY)
 		return 0;
@@ -286,3 +294,55 @@ int __init of_setup_earlycon(const struct earlycon_id *match,
 }
 
 #endif /* CONFIG_OF_EARLY_FLATTREE */
+
+#ifdef CONFIG_ACPI_DBG2_TABLE
+
+int __init acpi_setup_earlycon(struct acpi_dbg2_device *device, void *d)
+{
+	int err;
+	struct uart_port *port = &early_console_dev.port;
+	int (*setup)(struct earlycon_device *, const char *) = d;
+	struct acpi_generic_address *reg;
+
+	if (!setup_dbg2_earlycon)
+		return -ENODEV;
+
+	if (device->register_count < 1)
+		return -ENODEV;
+
+	if (device->base_address_offset >= device->length)
+		return -EINVAL;
+
+	reg = (void *)device + device->base_address_offset;
+
+	if (reg->space_id != ACPI_ADR_SPACE_SYSTEM_MEMORY &&
+	    reg->space_id != ACPI_ADR_SPACE_SYSTEM_IO)
+		return -EINVAL;
+
+	spin_lock_init(&port->lock);
+	port->uartclk = BASE_BAUD * 16;
+
+	if (reg->space_id == ACPI_ADR_SPACE_SYSTEM_MEMORY) {
+		if (device->port_type == ACPI_DBG2_ARM_SBSA_32BIT)
+			port->iotype = UPIO_MEM32;
+		else
+			port->iotype = UPIO_MEM;
+		port->mapbase = reg->address;
+		port->membase = earlycon_map(reg->address, SZ_4K);
+	} else {
+		port->iotype = UPIO_PORT;
+		port->iobase = reg->address;
+	}
+
+	early_console_dev.con->data = &early_console_dev;
+	err = setup(&early_console_dev, NULL);
+	if (err < 0)
+		return err;
+	if (!early_console_dev.con->write)
+		return -ENODEV;
+
+	register_console(early_console_dev.con);
+	return 0;
+}
+
+#endif /* CONFIG_ACPI_DBG2_TABLE */
diff --git a/include/linux/acpi_dbg2.h b/include/linux/acpi_dbg2.h
index 125ae7e..b653752 100644
--- a/include/linux/acpi_dbg2.h
+++ b/include/linux/acpi_dbg2.h
@@ -37,12 +37,32 @@ int acpi_dbg2_setup(struct acpi_table_header *header, const void *data);
 	ACPI_DECLARE_PROBE_ENTRY(dbg2, name, ACPI_SIG_DBG2,		\
 				 acpi_dbg2_setup, &__acpi_dbg2_data_##name)
 
+int acpi_setup_earlycon(struct acpi_dbg2_device *device, void *d);
+
+/**
+ * ACPI_DBG2_EARLYCON_DECLARE() - Define handler for ACPI GDB2 serial port
+ * @name:		Identifier to compose name of table data
+ * @subtype:		Subtype of the port
+ * @console_setup:	Function to be called to setup the port
+ *
+ * Type of the console_setup() callback is
+ * int (*setup)(struct earlycon_device *, const char *)
+ * It's the type of callback of of_setup_earlycon().
+ */
+#define ACPI_DBG2_EARLYCON_DECLARE(name, subtype, console_setup)	\
+	ACPI_DBG2_DECLARE(name, ACPI_DBG2_SERIAL_PORT, subtype,		\
+			  acpi_setup_earlycon, console_setup)
+
 #else
 
 #define ACPI_DBG2_DECLARE(name, type, subtype, setup_fn, data_ptr)	\
 	static const void *__acpi_dbg_data_##name[]			\
 		__used __initdata = { (void *)setup_fn,	(void *)data_ptr }
 
+#define ACPI_DBG2_EARLYCON_DECLARE(name, subtype, console_setup)	\
+	static const void *__acpi_dbg_data_serial_##name[]		\
+		__used __initdata = { (void *)console_setup }
+
 #endif
 
 #endif
-- 
2.7.1

^ permalink raw reply related	[flat|nested] 34+ messages in thread

* [PATCH v2 7/8] ACPI: enable ACPI_DBG2_TABLE on ARM64
  2016-02-24 17:10 ` Aleksey Makarov
@ 2016-02-24 17:10   ` Aleksey Makarov
  -1 siblings, 0 replies; 34+ messages in thread
From: Aleksey Makarov @ 2016-02-24 17:10 UTC (permalink / raw)
  To: linux-acpi
  Cc: linux-serial, linux-kernel, linux-arm-kernel, Aleksey Makarov,
	Russell King, Greg Kroah-Hartman, Rafael J . Wysocki,
	Leif Lindholm, Graeme Gregory, Al Stone, Christopher Covington,
	Catalin Marinas, Will Deacon

SBBR mentions DBG2 as a mandatory ACPI table.
So enable it for ARM64

Signed-off-by: Aleksey Makarov <aleksey.makarov@linaro.org>
---
 arch/arm64/Kconfig       | 1 +
 arch/arm64/kernel/acpi.c | 2 ++
 2 files changed, 3 insertions(+)

diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig
index 2ee5731..4ad33f8 100644
--- a/arch/arm64/Kconfig
+++ b/arch/arm64/Kconfig
@@ -3,6 +3,7 @@ config ARM64
 	select ACPI_CCA_REQUIRED if ACPI
 	select ACPI_GENERIC_GSI if ACPI
 	select ACPI_REDUCED_HARDWARE_ONLY if ACPI
+	select ACPI_DBG2_TABLE if ACPI
 	select ARCH_HAS_DEVMEM_IS_ALLOWED
 	select ARCH_HAS_ATOMIC64_DEC_IF_POSITIVE
 	select ARCH_HAS_ELF_RANDOMIZE
diff --git a/arch/arm64/kernel/acpi.c b/arch/arm64/kernel/acpi.c
index 3faa323..bb93022 100644
--- a/arch/arm64/kernel/acpi.c
+++ b/arch/arm64/kernel/acpi.c
@@ -207,6 +207,8 @@ void __init acpi_boot_table_init(void)
 		if (!param_acpi_force)
 			disable_acpi();
 	}
+
+	acpi_probe_device_table(dbg2);
 }
 
 #ifdef CONFIG_ACPI_APEI
-- 
2.7.1

^ permalink raw reply related	[flat|nested] 34+ messages in thread

* [PATCH v2 7/8] ACPI: enable ACPI_DBG2_TABLE on ARM64
@ 2016-02-24 17:10   ` Aleksey Makarov
  0 siblings, 0 replies; 34+ messages in thread
From: Aleksey Makarov @ 2016-02-24 17:10 UTC (permalink / raw)
  To: linux-arm-kernel

SBBR mentions DBG2 as a mandatory ACPI table.
So enable it for ARM64

Signed-off-by: Aleksey Makarov <aleksey.makarov@linaro.org>
---
 arch/arm64/Kconfig       | 1 +
 arch/arm64/kernel/acpi.c | 2 ++
 2 files changed, 3 insertions(+)

diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig
index 2ee5731..4ad33f8 100644
--- a/arch/arm64/Kconfig
+++ b/arch/arm64/Kconfig
@@ -3,6 +3,7 @@ config ARM64
 	select ACPI_CCA_REQUIRED if ACPI
 	select ACPI_GENERIC_GSI if ACPI
 	select ACPI_REDUCED_HARDWARE_ONLY if ACPI
+	select ACPI_DBG2_TABLE if ACPI
 	select ARCH_HAS_DEVMEM_IS_ALLOWED
 	select ARCH_HAS_ATOMIC64_DEC_IF_POSITIVE
 	select ARCH_HAS_ELF_RANDOMIZE
diff --git a/arch/arm64/kernel/acpi.c b/arch/arm64/kernel/acpi.c
index 3faa323..bb93022 100644
--- a/arch/arm64/kernel/acpi.c
+++ b/arch/arm64/kernel/acpi.c
@@ -207,6 +207,8 @@ void __init acpi_boot_table_init(void)
 		if (!param_acpi_force)
 			disable_acpi();
 	}
+
+	acpi_probe_device_table(dbg2);
 }
 
 #ifdef CONFIG_ACPI_APEI
-- 
2.7.1

^ permalink raw reply related	[flat|nested] 34+ messages in thread

* [PATCH v2 8/8] serial: pl011: add ACPI DBG2 serial port
  2016-02-24 17:10 ` Aleksey Makarov
@ 2016-02-24 17:10   ` Aleksey Makarov
  -1 siblings, 0 replies; 34+ messages in thread
From: Aleksey Makarov @ 2016-02-24 17:10 UTC (permalink / raw)
  To: linux-acpi
  Cc: linux-serial, linux-kernel, linux-arm-kernel, Aleksey Makarov,
	Russell King, Greg Kroah-Hartman, Rafael J . Wysocki,
	Leif Lindholm, Graeme Gregory, Al Stone, Christopher Covington,
	Jiri Slaby

Add a handler for ACPI DBG2 serial port of type ACPI_DBG2_ARM_PL011
that sets up an earlycon on it.

Signed-off-by: Aleksey Makarov <aleksey.makarov@linaro.org>
---
 drivers/tty/serial/amba-pl011.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/tty/serial/amba-pl011.c b/drivers/tty/serial/amba-pl011.c
index 500232a..d38da86 100644
--- a/drivers/tty/serial/amba-pl011.c
+++ b/drivers/tty/serial/amba-pl011.c
@@ -59,6 +59,7 @@
 #include <linux/sizes.h>
 #include <linux/io.h>
 #include <linux/acpi.h>
+#include <linux/acpi_dbg2.h>
 
 #include "amba-pl011.h"
 
@@ -2327,6 +2328,8 @@ static int __init pl011_early_console_setup(struct earlycon_device *device,
 	return 0;
 }
 OF_EARLYCON_DECLARE(pl011, "arm,pl011", pl011_early_console_setup);
+ACPI_DBG2_EARLYCON_DECLARE(pl011, ACPI_DBG2_ARM_PL011,
+			   pl011_early_console_setup);
 
 #else
 #define AMBA_CONSOLE	NULL
-- 
2.7.1

^ permalink raw reply related	[flat|nested] 34+ messages in thread

* [PATCH v2 8/8] serial: pl011: add ACPI DBG2 serial port
@ 2016-02-24 17:10   ` Aleksey Makarov
  0 siblings, 0 replies; 34+ messages in thread
From: Aleksey Makarov @ 2016-02-24 17:10 UTC (permalink / raw)
  To: linux-arm-kernel

Add a handler for ACPI DBG2 serial port of type ACPI_DBG2_ARM_PL011
that sets up an earlycon on it.

Signed-off-by: Aleksey Makarov <aleksey.makarov@linaro.org>
---
 drivers/tty/serial/amba-pl011.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/tty/serial/amba-pl011.c b/drivers/tty/serial/amba-pl011.c
index 500232a..d38da86 100644
--- a/drivers/tty/serial/amba-pl011.c
+++ b/drivers/tty/serial/amba-pl011.c
@@ -59,6 +59,7 @@
 #include <linux/sizes.h>
 #include <linux/io.h>
 #include <linux/acpi.h>
+#include <linux/acpi_dbg2.h>
 
 #include "amba-pl011.h"
 
@@ -2327,6 +2328,8 @@ static int __init pl011_early_console_setup(struct earlycon_device *device,
 	return 0;
 }
 OF_EARLYCON_DECLARE(pl011, "arm,pl011", pl011_early_console_setup);
+ACPI_DBG2_EARLYCON_DECLARE(pl011, ACPI_DBG2_ARM_PL011,
+			   pl011_early_console_setup);
 
 #else
 #define AMBA_CONSOLE	NULL
-- 
2.7.1

^ permalink raw reply related	[flat|nested] 34+ messages in thread

* RE: [PATCH v2 3/8] ACPI: add definitions of DBG2 subtypes
  2016-02-24 17:10   ` Aleksey Makarov
  (?)
  (?)
@ 2016-02-24 17:17     ` Moore, Robert
  -1 siblings, 0 replies; 34+ messages in thread
From: Moore, Robert @ 2016-02-24 17:17 UTC (permalink / raw)
  To: Aleksey Makarov, linux-acpi
  Cc: linux-serial, linux-kernel, linux-arm-kernel, Russell King,
	Greg Kroah-Hartman, Rafael J . Wysocki, Leif Lindholm,
	Graeme Gregory, Al Stone, Christopher Covington, Len Brown,
	Zheng, Lv, devel

I've got these for the next release of ACPICA


> -----Original Message-----
> From: Aleksey Makarov [mailto:aleksey.makarov@linaro.org]
> Sent: Wednesday, February 24, 2016 9:10 AM
> To: linux-acpi@vger.kernel.org
> Cc: linux-serial@vger.kernel.org; linux-kernel@vger.kernel.org; linux-arm-
> kernel@lists.infradead.org; Aleksey Makarov; Russell King; Greg Kroah-
> Hartman; Rafael J . Wysocki; Leif Lindholm; Graeme Gregory; Al Stone;
> Christopher Covington; Len Brown; Moore, Robert; Zheng, Lv;
> devel@acpica.org
> Subject: [PATCH v2 3/8] ACPI: add definitions of DBG2 subtypes
> 
> The recent version of Microsoft Debug Port Table 2 (DBG2) [1] specifies
> additional serial debug port subtypes.  These constants are also referred
> by Serial Port Console Redirection Table (SPCR) [2]
> 
> Add these constants.
> 
> [1] https://msdn.microsoft.com/en-
> us/library/windows/hardware/dn639131(v=vs.85).aspx
> [2] https://msdn.microsoft.com/en-
> us/library/windows/hardware/dn639132(v=vs.85).aspx
> 
> Signed-off-by: Aleksey Makarov <aleksey.makarov@linaro.org>
> ---
>  include/acpi/actbl2.h | 5 +++++
>  1 file changed, 5 insertions(+)
> 
> diff --git a/include/acpi/actbl2.h b/include/acpi/actbl2.h index
> a4ef625..652f747 100644
> --- a/include/acpi/actbl2.h
> +++ b/include/acpi/actbl2.h
> @@ -371,6 +371,11 @@ struct acpi_dbg2_device {
> 
>  #define ACPI_DBG2_16550_COMPATIBLE  0x0000
>  #define ACPI_DBG2_16550_SUBSET      0x0001
> +#define ACPI_DBG2_ARM_PL011         0x0003
> +#define ACPI_DBG2_ARM_SBSA_32BIT    0x000D
> +#define ACPI_DBG2_ARM_SBSA_GENERIC  0x000E
> +#define ACPI_DBG2_ARM_DCC           0x000F
> +#define ACPI_DBG2_BCM2835           0x0010
> 
>  #define ACPI_DBG2_1394_STANDARD     0x0000
> 
> --
> 2.7.1


^ permalink raw reply	[flat|nested] 34+ messages in thread

* RE: [PATCH v2 3/8] ACPI: add definitions of DBG2 subtypes
@ 2016-02-24 17:17     ` Moore, Robert
  0 siblings, 0 replies; 34+ messages in thread
From: Moore, Robert @ 2016-02-24 17:17 UTC (permalink / raw)
  To: Aleksey Makarov, linux-acpi
  Cc: linux-serial, linux-kernel, linux-arm-kernel, Russell King,
	Greg Kroah-Hartman, Rafael J . Wysocki, Leif Lindholm,
	Graeme Gregory, Al Stone, Christopher Covington, Len Brown,
	Zheng, Lv, devel

I've got these for the next release of ACPICA


> -----Original Message-----
> From: Aleksey Makarov [mailto:aleksey.makarov@linaro.org]
> Sent: Wednesday, February 24, 2016 9:10 AM
> To: linux-acpi@vger.kernel.org
> Cc: linux-serial@vger.kernel.org; linux-kernel@vger.kernel.org; linux-arm-
> kernel@lists.infradead.org; Aleksey Makarov; Russell King; Greg Kroah-
> Hartman; Rafael J . Wysocki; Leif Lindholm; Graeme Gregory; Al Stone;
> Christopher Covington; Len Brown; Moore, Robert; Zheng, Lv;
> devel@acpica.org
> Subject: [PATCH v2 3/8] ACPI: add definitions of DBG2 subtypes
> 
> The recent version of Microsoft Debug Port Table 2 (DBG2) [1] specifies
> additional serial debug port subtypes.  These constants are also referred
> by Serial Port Console Redirection Table (SPCR) [2]
> 
> Add these constants.
> 
> [1] https://msdn.microsoft.com/en-
> us/library/windows/hardware/dn639131(v=vs.85).aspx
> [2] https://msdn.microsoft.com/en-
> us/library/windows/hardware/dn639132(v=vs.85).aspx
> 
> Signed-off-by: Aleksey Makarov <aleksey.makarov@linaro.org>
> ---
>  include/acpi/actbl2.h | 5 +++++
>  1 file changed, 5 insertions(+)
> 
> diff --git a/include/acpi/actbl2.h b/include/acpi/actbl2.h index
> a4ef625..652f747 100644
> --- a/include/acpi/actbl2.h
> +++ b/include/acpi/actbl2.h
> @@ -371,6 +371,11 @@ struct acpi_dbg2_device {
> 
>  #define ACPI_DBG2_16550_COMPATIBLE  0x0000
>  #define ACPI_DBG2_16550_SUBSET      0x0001
> +#define ACPI_DBG2_ARM_PL011         0x0003
> +#define ACPI_DBG2_ARM_SBSA_32BIT    0x000D
> +#define ACPI_DBG2_ARM_SBSA_GENERIC  0x000E
> +#define ACPI_DBG2_ARM_DCC           0x000F
> +#define ACPI_DBG2_BCM2835           0x0010
> 
>  #define ACPI_DBG2_1394_STANDARD     0x0000
> 
> --
> 2.7.1

^ permalink raw reply	[flat|nested] 34+ messages in thread

* [PATCH v2 3/8] ACPI: add definitions of DBG2 subtypes
@ 2016-02-24 17:17     ` Moore, Robert
  0 siblings, 0 replies; 34+ messages in thread
From: Moore, Robert @ 2016-02-24 17:17 UTC (permalink / raw)
  To: linux-arm-kernel

I've got these for the next release of ACPICA


> -----Original Message-----
> From: Aleksey Makarov [mailto:aleksey.makarov at linaro.org]
> Sent: Wednesday, February 24, 2016 9:10 AM
> To: linux-acpi at vger.kernel.org
> Cc: linux-serial at vger.kernel.org; linux-kernel at vger.kernel.org; linux-arm-
> kernel at lists.infradead.org; Aleksey Makarov; Russell King; Greg Kroah-
> Hartman; Rafael J . Wysocki; Leif Lindholm; Graeme Gregory; Al Stone;
> Christopher Covington; Len Brown; Moore, Robert; Zheng, Lv;
> devel at acpica.org
> Subject: [PATCH v2 3/8] ACPI: add definitions of DBG2 subtypes
> 
> The recent version of Microsoft Debug Port Table 2 (DBG2) [1] specifies
> additional serial debug port subtypes.  These constants are also referred
> by Serial Port Console Redirection Table (SPCR) [2]
> 
> Add these constants.
> 
> [1] https://msdn.microsoft.com/en-
> us/library/windows/hardware/dn639131(v=vs.85).aspx
> [2] https://msdn.microsoft.com/en-
> us/library/windows/hardware/dn639132(v=vs.85).aspx
> 
> Signed-off-by: Aleksey Makarov <aleksey.makarov@linaro.org>
> ---
>  include/acpi/actbl2.h | 5 +++++
>  1 file changed, 5 insertions(+)
> 
> diff --git a/include/acpi/actbl2.h b/include/acpi/actbl2.h index
> a4ef625..652f747 100644
> --- a/include/acpi/actbl2.h
> +++ b/include/acpi/actbl2.h
> @@ -371,6 +371,11 @@ struct acpi_dbg2_device {
> 
>  #define ACPI_DBG2_16550_COMPATIBLE  0x0000
>  #define ACPI_DBG2_16550_SUBSET      0x0001
> +#define ACPI_DBG2_ARM_PL011         0x0003
> +#define ACPI_DBG2_ARM_SBSA_32BIT    0x000D
> +#define ACPI_DBG2_ARM_SBSA_GENERIC  0x000E
> +#define ACPI_DBG2_ARM_DCC           0x000F
> +#define ACPI_DBG2_BCM2835           0x0010
> 
>  #define ACPI_DBG2_1394_STANDARD     0x0000
> 
> --
> 2.7.1

^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: [Devel] [PATCH v2 3/8] ACPI: add definitions of DBG2 subtypes
@ 2016-02-24 17:17     ` Moore, Robert
  0 siblings, 0 replies; 34+ messages in thread
From: Moore, Robert @ 2016-02-24 17:18 UTC (permalink / raw)
  To: devel

[-- Attachment #1: Type: text/plain, Size: 1799 bytes --]

I've got these for the next release of ACPICA


> -----Original Message-----
> From: Aleksey Makarov [mailto:aleksey.makarov(a)linaro.org]
> Sent: Wednesday, February 24, 2016 9:10 AM
> To: linux-acpi(a)vger.kernel.org
> Cc: linux-serial(a)vger.kernel.org; linux-kernel(a)vger.kernel.org; linux-arm-
> kernel(a)lists.infradead.org; Aleksey Makarov; Russell King; Greg Kroah-
> Hartman; Rafael J . Wysocki; Leif Lindholm; Graeme Gregory; Al Stone;
> Christopher Covington; Len Brown; Moore, Robert; Zheng, Lv;
> devel(a)acpica.org
> Subject: [PATCH v2 3/8] ACPI: add definitions of DBG2 subtypes
> 
> The recent version of Microsoft Debug Port Table 2 (DBG2) [1] specifies
> additional serial debug port subtypes.  These constants are also referred
> by Serial Port Console Redirection Table (SPCR) [2]
> 
> Add these constants.
> 
> [1] https://msdn.microsoft.com/en-
> us/library/windows/hardware/dn639131(v=vs.85).aspx
> [2] https://msdn.microsoft.com/en-
> us/library/windows/hardware/dn639132(v=vs.85).aspx
> 
> Signed-off-by: Aleksey Makarov <aleksey.makarov(a)linaro.org>
> ---
>  include/acpi/actbl2.h | 5 +++++
>  1 file changed, 5 insertions(+)
> 
> diff --git a/include/acpi/actbl2.h b/include/acpi/actbl2.h index
> a4ef625..652f747 100644
> --- a/include/acpi/actbl2.h
> +++ b/include/acpi/actbl2.h
> @@ -371,6 +371,11 @@ struct acpi_dbg2_device {
> 
>  #define ACPI_DBG2_16550_COMPATIBLE  0x0000
>  #define ACPI_DBG2_16550_SUBSET      0x0001
> +#define ACPI_DBG2_ARM_PL011         0x0003
> +#define ACPI_DBG2_ARM_SBSA_32BIT    0x000D
> +#define ACPI_DBG2_ARM_SBSA_GENERIC  0x000E
> +#define ACPI_DBG2_ARM_DCC           0x000F
> +#define ACPI_DBG2_BCM2835           0x0010
> 
>  #define ACPI_DBG2_1394_STANDARD     0x0000
> 
> --
> 2.7.1


^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: [PATCH v2 3/8] ACPI: add definitions of DBG2 subtypes
  2016-02-24 17:17     ` Moore, Robert
  (?)
@ 2016-02-24 17:25       ` Aleksey Makarov
  -1 siblings, 0 replies; 34+ messages in thread
From: Aleksey Makarov @ 2016-02-24 17:25 UTC (permalink / raw)
  To: Moore, Robert, linux-acpi
  Cc: linux-serial, linux-kernel, linux-arm-kernel, Russell King,
	Greg Kroah-Hartman, Rafael J . Wysocki, Leif Lindholm,
	Graeme Gregory, Al Stone, Christopher Covington, Len Brown,
	Zheng, Lv, devel



On 02/24/2016 08:17 PM, Moore, Robert wrote:
> I've got these for the next release of ACPICA

It have not been pulled to linux-next but is required for the patchset.
So I included it here.

> 
> 
>> -----Original Message-----
>> From: Aleksey Makarov [mailto:aleksey.makarov@linaro.org]
>> Sent: Wednesday, February 24, 2016 9:10 AM
>> To: linux-acpi@vger.kernel.org
>> Cc: linux-serial@vger.kernel.org; linux-kernel@vger.kernel.org; linux-arm-
>> kernel@lists.infradead.org; Aleksey Makarov; Russell King; Greg Kroah-
>> Hartman; Rafael J . Wysocki; Leif Lindholm; Graeme Gregory; Al Stone;
>> Christopher Covington; Len Brown; Moore, Robert; Zheng, Lv;
>> devel@acpica.org
>> Subject: [PATCH v2 3/8] ACPI: add definitions of DBG2 subtypes
>>
>> The recent version of Microsoft Debug Port Table 2 (DBG2) [1] specifies
>> additional serial debug port subtypes.  These constants are also referred
>> by Serial Port Console Redirection Table (SPCR) [2]
>>
>> Add these constants.
>>
>> [1] https://msdn.microsoft.com/en-
>> us/library/windows/hardware/dn639131(v=vs.85).aspx
>> [2] https://msdn.microsoft.com/en-
>> us/library/windows/hardware/dn639132(v=vs.85).aspx
>>
>> Signed-off-by: Aleksey Makarov <aleksey.makarov@linaro.org>
>> ---
>>  include/acpi/actbl2.h | 5 +++++
>>  1 file changed, 5 insertions(+)
>>
>> diff --git a/include/acpi/actbl2.h b/include/acpi/actbl2.h index
>> a4ef625..652f747 100644
>> --- a/include/acpi/actbl2.h
>> +++ b/include/acpi/actbl2.h
>> @@ -371,6 +371,11 @@ struct acpi_dbg2_device {
>>
>>  #define ACPI_DBG2_16550_COMPATIBLE  0x0000
>>  #define ACPI_DBG2_16550_SUBSET      0x0001
>> +#define ACPI_DBG2_ARM_PL011         0x0003
>> +#define ACPI_DBG2_ARM_SBSA_32BIT    0x000D
>> +#define ACPI_DBG2_ARM_SBSA_GENERIC  0x000E
>> +#define ACPI_DBG2_ARM_DCC           0x000F
>> +#define ACPI_DBG2_BCM2835           0x0010
>>
>>  #define ACPI_DBG2_1394_STANDARD     0x0000
>>
>> --
>> 2.7.1
> 

^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: [PATCH v2 3/8] ACPI: add definitions of DBG2 subtypes
@ 2016-02-24 17:25       ` Aleksey Makarov
  0 siblings, 0 replies; 34+ messages in thread
From: Aleksey Makarov @ 2016-02-24 17:25 UTC (permalink / raw)
  To: Moore, Robert, linux-acpi
  Cc: linux-serial, linux-kernel, linux-arm-kernel, Russell King,
	Greg Kroah-Hartman, Rafael J . Wysocki, Leif Lindholm,
	Graeme Gregory, Al Stone, Christopher Covington, Len Brown,
	Zheng, Lv, devel



On 02/24/2016 08:17 PM, Moore, Robert wrote:
> I've got these for the next release of ACPICA

It have not been pulled to linux-next but is required for the patchset.
So I included it here.

> 
> 
>> -----Original Message-----
>> From: Aleksey Makarov [mailto:aleksey.makarov@linaro.org]
>> Sent: Wednesday, February 24, 2016 9:10 AM
>> To: linux-acpi@vger.kernel.org
>> Cc: linux-serial@vger.kernel.org; linux-kernel@vger.kernel.org; linux-arm-
>> kernel@lists.infradead.org; Aleksey Makarov; Russell King; Greg Kroah-
>> Hartman; Rafael J . Wysocki; Leif Lindholm; Graeme Gregory; Al Stone;
>> Christopher Covington; Len Brown; Moore, Robert; Zheng, Lv;
>> devel@acpica.org
>> Subject: [PATCH v2 3/8] ACPI: add definitions of DBG2 subtypes
>>
>> The recent version of Microsoft Debug Port Table 2 (DBG2) [1] specifies
>> additional serial debug port subtypes.  These constants are also referred
>> by Serial Port Console Redirection Table (SPCR) [2]
>>
>> Add these constants.
>>
>> [1] https://msdn.microsoft.com/en-
>> us/library/windows/hardware/dn639131(v=vs.85).aspx
>> [2] https://msdn.microsoft.com/en-
>> us/library/windows/hardware/dn639132(v=vs.85).aspx
>>
>> Signed-off-by: Aleksey Makarov <aleksey.makarov@linaro.org>
>> ---
>>  include/acpi/actbl2.h | 5 +++++
>>  1 file changed, 5 insertions(+)
>>
>> diff --git a/include/acpi/actbl2.h b/include/acpi/actbl2.h index
>> a4ef625..652f747 100644
>> --- a/include/acpi/actbl2.h
>> +++ b/include/acpi/actbl2.h
>> @@ -371,6 +371,11 @@ struct acpi_dbg2_device {
>>
>>  #define ACPI_DBG2_16550_COMPATIBLE  0x0000
>>  #define ACPI_DBG2_16550_SUBSET      0x0001
>> +#define ACPI_DBG2_ARM_PL011         0x0003
>> +#define ACPI_DBG2_ARM_SBSA_32BIT    0x000D
>> +#define ACPI_DBG2_ARM_SBSA_GENERIC  0x000E
>> +#define ACPI_DBG2_ARM_DCC           0x000F
>> +#define ACPI_DBG2_BCM2835           0x0010
>>
>>  #define ACPI_DBG2_1394_STANDARD     0x0000
>>
>> --
>> 2.7.1
> 

^ permalink raw reply	[flat|nested] 34+ messages in thread

* [PATCH v2 3/8] ACPI: add definitions of DBG2 subtypes
@ 2016-02-24 17:25       ` Aleksey Makarov
  0 siblings, 0 replies; 34+ messages in thread
From: Aleksey Makarov @ 2016-02-24 17:25 UTC (permalink / raw)
  To: linux-arm-kernel



On 02/24/2016 08:17 PM, Moore, Robert wrote:
> I've got these for the next release of ACPICA

It have not been pulled to linux-next but is required for the patchset.
So I included it here.

> 
> 
>> -----Original Message-----
>> From: Aleksey Makarov [mailto:aleksey.makarov at linaro.org]
>> Sent: Wednesday, February 24, 2016 9:10 AM
>> To: linux-acpi at vger.kernel.org
>> Cc: linux-serial at vger.kernel.org; linux-kernel at vger.kernel.org; linux-arm-
>> kernel at lists.infradead.org; Aleksey Makarov; Russell King; Greg Kroah-
>> Hartman; Rafael J . Wysocki; Leif Lindholm; Graeme Gregory; Al Stone;
>> Christopher Covington; Len Brown; Moore, Robert; Zheng, Lv;
>> devel at acpica.org
>> Subject: [PATCH v2 3/8] ACPI: add definitions of DBG2 subtypes
>>
>> The recent version of Microsoft Debug Port Table 2 (DBG2) [1] specifies
>> additional serial debug port subtypes.  These constants are also referred
>> by Serial Port Console Redirection Table (SPCR) [2]
>>
>> Add these constants.
>>
>> [1] https://msdn.microsoft.com/en-
>> us/library/windows/hardware/dn639131(v=vs.85).aspx
>> [2] https://msdn.microsoft.com/en-
>> us/library/windows/hardware/dn639132(v=vs.85).aspx
>>
>> Signed-off-by: Aleksey Makarov <aleksey.makarov@linaro.org>
>> ---
>>  include/acpi/actbl2.h | 5 +++++
>>  1 file changed, 5 insertions(+)
>>
>> diff --git a/include/acpi/actbl2.h b/include/acpi/actbl2.h index
>> a4ef625..652f747 100644
>> --- a/include/acpi/actbl2.h
>> +++ b/include/acpi/actbl2.h
>> @@ -371,6 +371,11 @@ struct acpi_dbg2_device {
>>
>>  #define ACPI_DBG2_16550_COMPATIBLE  0x0000
>>  #define ACPI_DBG2_16550_SUBSET      0x0001
>> +#define ACPI_DBG2_ARM_PL011         0x0003
>> +#define ACPI_DBG2_ARM_SBSA_32BIT    0x000D
>> +#define ACPI_DBG2_ARM_SBSA_GENERIC  0x000E
>> +#define ACPI_DBG2_ARM_DCC           0x000F
>> +#define ACPI_DBG2_BCM2835           0x0010
>>
>>  #define ACPI_DBG2_1394_STANDARD     0x0000
>>
>> --
>> 2.7.1
> 

^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: [PATCH v2 1/8] arm64: move acpi/dt decision earlier in boot process
  2016-02-24 17:10   ` Aleksey Makarov
@ 2016-02-24 18:22     ` Matthias Brugger
  -1 siblings, 0 replies; 34+ messages in thread
From: Matthias Brugger @ 2016-02-24 18:22 UTC (permalink / raw)
  To: Aleksey Makarov, linux-acpi
  Cc: Russell King, Graeme Gregory, Greg Kroah-Hartman,
	Rafael J . Wysocki, linux-kernel, Leif Lindholm,
	Christopher Covington, linux-serial, Catalin Marinas,
	Will Deacon, Al Stone, linux-arm-kernel



On 24/02/16 18:10, Aleksey Makarov wrote:
> From: Leif Lindholm <leif.lindholm@linaro.org>
>
> In order to support selecting earlycon via either ACPI or DT, move
> the decision on whether to attempt ACPI configuration into the
> early_param handling. Then make acpi_boot_table_init() bail out if
> acpi_disabled.
>
> Signed-off-by: Leif Lindholm <leif.lindholm@linaro.org>
> Signed-off-by: Aleksey Makarov <aleksey.makarov@linaro.org>
> ---
>   arch/arm64/kernel/acpi.c | 62 +++++++++++++++++++++++-------------------------
>   1 file changed, 30 insertions(+), 32 deletions(-)
>
> diff --git a/arch/arm64/kernel/acpi.c b/arch/arm64/kernel/acpi.c
> index d1ce8e2..3faa323 100644
> --- a/arch/arm64/kernel/acpi.c
> +++ b/arch/arm64/kernel/acpi.c
> @@ -41,26 +41,8 @@ EXPORT_SYMBOL(acpi_disabled);
>   int acpi_pci_disabled = 1;	/* skip ACPI PCI scan and IRQ initialization */
>   EXPORT_SYMBOL(acpi_pci_disabled);
>
> -static bool param_acpi_off __initdata;
>   static bool param_acpi_force __initdata;
>
> -static int __init parse_acpi(char *arg)
> -{
> -	if (!arg)
> -		return -EINVAL;
> -
> -	/* "acpi=off" disables both ACPI table parsing and interpreter */
> -	if (strcmp(arg, "off") == 0)
> -		param_acpi_off = true;
> -	else if (strcmp(arg, "force") == 0) /* force ACPI to be enabled */
> -		param_acpi_force = true;
> -	else
> -		return -EINVAL;	/* Core will print when we return error */
> -
> -	return 0;
> -}
> -early_param("acpi", parse_acpi);
> -
>   static int __init dt_scan_depth1_nodes(unsigned long node,
>   				       const char *uname, int depth,
>   				       void *data)
> @@ -74,6 +56,35 @@ static int __init dt_scan_depth1_nodes(unsigned long node,
>   	return 0;
>   }
>
> +static int __init parse_acpi(char *arg)
> +{
> +	if (!arg)
> +		return -EINVAL;
> +
> +	/*
> +	 * Enable ACPI instead of device tree unless
> +	 * - ACPI has been disabled explicitly (acpi=off), or
> +	 * - the device tree is not empty (it has more than just a /chosen node)
> +	 *   and ACPI has not been force enabled (acpi=force)
> +	 */
> +	if (strcmp(arg, "off") == 0)
> +		return 0;
> +	else if (strcmp(arg, "force") == 0)
> +		param_acpi_force = true;
> +	else if (of_scan_flat_dt(dt_scan_depth1_nodes, NULL))

I think we should strcmp for "on" here and return an error on other 
values. IMHO an update to Documentation/kernel-parameters.txt would be 
convenient.

I still wonder if we really want to change the default to ACPI disabled.
But that's a decision the maintainers have to take.

Regards,
Matthias

> +		return 0;
> +
> +	/*
> +	 * ACPI is disabled at this point. Enable it in order to parse
> +	 * the ACPI tables and carry out sanity checks
> +	 */
> +	enable_acpi();
> +
> +	return 0;
> +}
> +
> +early_param("acpi", parse_acpi);
> +
>   /*
>    * __acpi_map_table() will be called before page_init(), so early_ioremap()
>    * or early_memremap() should be called here to for ACPI table mapping.
> @@ -181,23 +192,10 @@ out:
>    */
>   void __init acpi_boot_table_init(void)
>   {
> -	/*
> -	 * Enable ACPI instead of device tree unless
> -	 * - ACPI has been disabled explicitly (acpi=off), or
> -	 * - the device tree is not empty (it has more than just a /chosen node)
> -	 *   and ACPI has not been force enabled (acpi=force)
> -	 */
> -	if (param_acpi_off ||
> -	    (!param_acpi_force && of_scan_flat_dt(dt_scan_depth1_nodes, NULL)))
> +	if (acpi_disabled)
>   		return;
>
>   	/*
> -	 * ACPI is disabled at this point. Enable it in order to parse
> -	 * the ACPI tables and carry out sanity checks
> -	 */
> -	enable_acpi();
> -
> -	/*
>   	 * If ACPI tables are initialized and FADT sanity checks passed,
>   	 * leave ACPI enabled and carry on booting; otherwise disable ACPI
>   	 * on initialization error.
>

^ permalink raw reply	[flat|nested] 34+ messages in thread

* [PATCH v2 1/8] arm64: move acpi/dt decision earlier in boot process
@ 2016-02-24 18:22     ` Matthias Brugger
  0 siblings, 0 replies; 34+ messages in thread
From: Matthias Brugger @ 2016-02-24 18:22 UTC (permalink / raw)
  To: linux-arm-kernel



On 24/02/16 18:10, Aleksey Makarov wrote:
> From: Leif Lindholm <leif.lindholm@linaro.org>
>
> In order to support selecting earlycon via either ACPI or DT, move
> the decision on whether to attempt ACPI configuration into the
> early_param handling. Then make acpi_boot_table_init() bail out if
> acpi_disabled.
>
> Signed-off-by: Leif Lindholm <leif.lindholm@linaro.org>
> Signed-off-by: Aleksey Makarov <aleksey.makarov@linaro.org>
> ---
>   arch/arm64/kernel/acpi.c | 62 +++++++++++++++++++++++-------------------------
>   1 file changed, 30 insertions(+), 32 deletions(-)
>
> diff --git a/arch/arm64/kernel/acpi.c b/arch/arm64/kernel/acpi.c
> index d1ce8e2..3faa323 100644
> --- a/arch/arm64/kernel/acpi.c
> +++ b/arch/arm64/kernel/acpi.c
> @@ -41,26 +41,8 @@ EXPORT_SYMBOL(acpi_disabled);
>   int acpi_pci_disabled = 1;	/* skip ACPI PCI scan and IRQ initialization */
>   EXPORT_SYMBOL(acpi_pci_disabled);
>
> -static bool param_acpi_off __initdata;
>   static bool param_acpi_force __initdata;
>
> -static int __init parse_acpi(char *arg)
> -{
> -	if (!arg)
> -		return -EINVAL;
> -
> -	/* "acpi=off" disables both ACPI table parsing and interpreter */
> -	if (strcmp(arg, "off") == 0)
> -		param_acpi_off = true;
> -	else if (strcmp(arg, "force") == 0) /* force ACPI to be enabled */
> -		param_acpi_force = true;
> -	else
> -		return -EINVAL;	/* Core will print when we return error */
> -
> -	return 0;
> -}
> -early_param("acpi", parse_acpi);
> -
>   static int __init dt_scan_depth1_nodes(unsigned long node,
>   				       const char *uname, int depth,
>   				       void *data)
> @@ -74,6 +56,35 @@ static int __init dt_scan_depth1_nodes(unsigned long node,
>   	return 0;
>   }
>
> +static int __init parse_acpi(char *arg)
> +{
> +	if (!arg)
> +		return -EINVAL;
> +
> +	/*
> +	 * Enable ACPI instead of device tree unless
> +	 * - ACPI has been disabled explicitly (acpi=off), or
> +	 * - the device tree is not empty (it has more than just a /chosen node)
> +	 *   and ACPI has not been force enabled (acpi=force)
> +	 */
> +	if (strcmp(arg, "off") == 0)
> +		return 0;
> +	else if (strcmp(arg, "force") == 0)
> +		param_acpi_force = true;
> +	else if (of_scan_flat_dt(dt_scan_depth1_nodes, NULL))

I think we should strcmp for "on" here and return an error on other 
values. IMHO an update to Documentation/kernel-parameters.txt would be 
convenient.

I still wonder if we really want to change the default to ACPI disabled.
But that's a decision the maintainers have to take.

Regards,
Matthias

> +		return 0;
> +
> +	/*
> +	 * ACPI is disabled at this point. Enable it in order to parse
> +	 * the ACPI tables and carry out sanity checks
> +	 */
> +	enable_acpi();
> +
> +	return 0;
> +}
> +
> +early_param("acpi", parse_acpi);
> +
>   /*
>    * __acpi_map_table() will be called before page_init(), so early_ioremap()
>    * or early_memremap() should be called here to for ACPI table mapping.
> @@ -181,23 +192,10 @@ out:
>    */
>   void __init acpi_boot_table_init(void)
>   {
> -	/*
> -	 * Enable ACPI instead of device tree unless
> -	 * - ACPI has been disabled explicitly (acpi=off), or
> -	 * - the device tree is not empty (it has more than just a /chosen node)
> -	 *   and ACPI has not been force enabled (acpi=force)
> -	 */
> -	if (param_acpi_off ||
> -	    (!param_acpi_force && of_scan_flat_dt(dt_scan_depth1_nodes, NULL)))
> +	if (acpi_disabled)
>   		return;
>
>   	/*
> -	 * ACPI is disabled at this point. Enable it in order to parse
> -	 * the ACPI tables and carry out sanity checks
> -	 */
> -	enable_acpi();
> -
> -	/*
>   	 * If ACPI tables are initialized and FADT sanity checks passed,
>   	 * leave ACPI enabled and carry on booting; otherwise disable ACPI
>   	 * on initialization error.
>

^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: [PATCH v2 3/8] ACPI: add definitions of DBG2 subtypes
  2016-02-24 17:25       ` Aleksey Makarov
  (?)
@ 2016-02-24 20:03         ` Rafael J. Wysocki
  -1 siblings, 0 replies; 34+ messages in thread
From: Rafael J. Wysocki @ 2016-02-24 20:03 UTC (permalink / raw)
  To: Aleksey Makarov
  Cc: Moore, Robert, linux-acpi, linux-serial, linux-kernel,
	linux-arm-kernel, Russell King, Greg Kroah-Hartman,
	Rafael J . Wysocki, Leif Lindholm, Graeme Gregory, Al Stone,
	Christopher Covington, Len Brown, Zheng, Lv, devel

On Wed, Feb 24, 2016 at 6:25 PM, Aleksey Makarov
<aleksey.makarov@linaro.org> wrote:
>
>
> On 02/24/2016 08:17 PM, Moore, Robert wrote:
>> I've got these for the next release of ACPICA
>
> It have not been pulled to linux-next but is required for the patchset.

No, it hasn't.

It will go to linux-next when I get ACPICA patches for the next
release from the upstream.

Thanks,
Rafael

^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: [PATCH v2 3/8] ACPI: add definitions of DBG2 subtypes
@ 2016-02-24 20:03         ` Rafael J. Wysocki
  0 siblings, 0 replies; 34+ messages in thread
From: Rafael J. Wysocki @ 2016-02-24 20:03 UTC (permalink / raw)
  To: Aleksey Makarov
  Cc: Moore, Robert, linux-acpi, linux-serial, linux-kernel,
	linux-arm-kernel, Russell King, Greg Kroah-Hartman,
	Rafael J . Wysocki, Leif Lindholm, Graeme Gregory, Al Stone,
	Christopher Covington, Len Brown, Zheng, Lv, devel

On Wed, Feb 24, 2016 at 6:25 PM, Aleksey Makarov
<aleksey.makarov@linaro.org> wrote:
>
>
> On 02/24/2016 08:17 PM, Moore, Robert wrote:
>> I've got these for the next release of ACPICA
>
> It have not been pulled to linux-next but is required for the patchset.

No, it hasn't.

It will go to linux-next when I get ACPICA patches for the next
release from the upstream.

Thanks,
Rafael

^ permalink raw reply	[flat|nested] 34+ messages in thread

* [PATCH v2 3/8] ACPI: add definitions of DBG2 subtypes
@ 2016-02-24 20:03         ` Rafael J. Wysocki
  0 siblings, 0 replies; 34+ messages in thread
From: Rafael J. Wysocki @ 2016-02-24 20:03 UTC (permalink / raw)
  To: linux-arm-kernel

On Wed, Feb 24, 2016 at 6:25 PM, Aleksey Makarov
<aleksey.makarov@linaro.org> wrote:
>
>
> On 02/24/2016 08:17 PM, Moore, Robert wrote:
>> I've got these for the next release of ACPICA
>
> It have not been pulled to linux-next but is required for the patchset.

No, it hasn't.

It will go to linux-next when I get ACPICA patches for the next
release from the upstream.

Thanks,
Rafael

^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: [PATCH v2 1/8] arm64: move acpi/dt decision earlier in boot process
  2016-02-24 18:22     ` Matthias Brugger
@ 2016-02-25 15:53       ` Aleksey Makarov
  -1 siblings, 0 replies; 34+ messages in thread
From: Aleksey Makarov @ 2016-02-25 15:53 UTC (permalink / raw)
  To: Matthias Brugger, linux-acpi
  Cc: Russell King, Graeme Gregory, Greg Kroah-Hartman,
	Rafael J . Wysocki, linux-kernel, Leif Lindholm,
	Christopher Covington, linux-serial, Catalin Marinas,
	Will Deacon, Al Stone, linux-arm-kernel

Hi Matthias,

On 02/24/2016 09:22 PM, Matthias Brugger wrote:
> 
> 
> On 24/02/16 18:10, Aleksey Makarov wrote:
>> From: Leif Lindholm <leif.lindholm@linaro.org>
>>
>> In order to support selecting earlycon via either ACPI or DT, move
>> the decision on whether to attempt ACPI configuration into the
>> early_param handling. Then make acpi_boot_table_init() bail out if
>> acpi_disabled.
>>
>> Signed-off-by: Leif Lindholm <leif.lindholm@linaro.org>
>> Signed-off-by: Aleksey Makarov <aleksey.makarov@linaro.org>
>> ---
>>   arch/arm64/kernel/acpi.c | 62 +++++++++++++++++++++++-------------------------
>>   1 file changed, 30 insertions(+), 32 deletions(-)
>>
>> diff --git a/arch/arm64/kernel/acpi.c b/arch/arm64/kernel/acpi.c
>> index d1ce8e2..3faa323 100644
>> --- a/arch/arm64/kernel/acpi.c
>> +++ b/arch/arm64/kernel/acpi.c
>> @@ -41,26 +41,8 @@ EXPORT_SYMBOL(acpi_disabled);
>>   int acpi_pci_disabled = 1;    /* skip ACPI PCI scan and IRQ initialization */
>>   EXPORT_SYMBOL(acpi_pci_disabled);
>>
>> -static bool param_acpi_off __initdata;
>>   static bool param_acpi_force __initdata;
>>
>> -static int __init parse_acpi(char *arg)
>> -{
>> -    if (!arg)
>> -        return -EINVAL;
>> -
>> -    /* "acpi=off" disables both ACPI table parsing and interpreter */
>> -    if (strcmp(arg, "off") == 0)
>> -        param_acpi_off = true;
>> -    else if (strcmp(arg, "force") == 0) /* force ACPI to be enabled */
>> -        param_acpi_force = true;
>> -    else
>> -        return -EINVAL;    /* Core will print when we return error */
>> -
>> -    return 0;
>> -}
>> -early_param("acpi", parse_acpi);
>> -
>>   static int __init dt_scan_depth1_nodes(unsigned long node,
>>                          const char *uname, int depth,
>>                          void *data)
>> @@ -74,6 +56,35 @@ static int __init dt_scan_depth1_nodes(unsigned long node,
>>       return 0;
>>   }
>>
>> +static int __init parse_acpi(char *arg)
>> +{
>> +    if (!arg)
>> +        return -EINVAL;
>> +
>> +    /*
>> +     * Enable ACPI instead of device tree unless
>> +     * - ACPI has been disabled explicitly (acpi=off), or
>> +     * - the device tree is not empty (it has more than just a /chosen node)
>> +     *   and ACPI has not been force enabled (acpi=force)
>> +     */
>> +    if (strcmp(arg, "off") == 0)
>> +        return 0;
>> +    else if (strcmp(arg, "force") == 0)
>> +        param_acpi_force = true;
>> +    else if (of_scan_flat_dt(dt_scan_depth1_nodes, NULL))
> 
> I think we should strcmp for "on" here and return an error on other values. IMHO an update to Documentation/kernel-parameters.txt would be convenient.

Actually this patch is not correct at all.

on x86:
- if default is off then "acpi=force" enables it.
- if default is on  then "acpi=off"   disables it.

on ARM64 by default OF is preferred to ACPI, but ACPI is used if OF does not provide any nontrivial data.
So we need both "force" and "off"
- "acpi=force" forces ACPI,
- "acpi=off" disables ACPI

The patch makes incorrect code transformation, it changes the default behaviour.

This patch should just be dropped.  The rest of the patchset does not depend on it.

> I still wonder if we really want to change the default to ACPI disabled.
> But that's a decision the maintainers have to take.

I did not realize that the patch changes default.

Thank you
Aleksey Makarov

> Regards,
> Matthias
> 
>> +        return 0;
>> +
>> +    /*
>> +     * ACPI is disabled at this point. Enable it in order to parse
>> +     * the ACPI tables and carry out sanity checks
>> +     */
>> +    enable_acpi();
>> +
>> +    return 0;
>> +}
>> +
>> +early_param("acpi", parse_acpi);
>> +
>>   /*
>>    * __acpi_map_table() will be called before page_init(), so early_ioremap()
>>    * or early_memremap() should be called here to for ACPI table mapping.
>> @@ -181,23 +192,10 @@ out:
>>    */
>>   void __init acpi_boot_table_init(void)
>>   {
>> -    /*
>> -     * Enable ACPI instead of device tree unless
>> -     * - ACPI has been disabled explicitly (acpi=off), or
>> -     * - the device tree is not empty (it has more than just a /chosen node)
>> -     *   and ACPI has not been force enabled (acpi=force)
>> -     */
>> -    if (param_acpi_off ||
>> -        (!param_acpi_force && of_scan_flat_dt(dt_scan_depth1_nodes, NULL)))
>> +    if (acpi_disabled)
>>           return;
>>
>>       /*
>> -     * ACPI is disabled at this point. Enable it in order to parse
>> -     * the ACPI tables and carry out sanity checks
>> -     */
>> -    enable_acpi();
>> -
>> -    /*
>>        * If ACPI tables are initialized and FADT sanity checks passed,
>>        * leave ACPI enabled and carry on booting; otherwise disable ACPI
>>        * on initialization error.
>>

^ permalink raw reply	[flat|nested] 34+ messages in thread

* [PATCH v2 1/8] arm64: move acpi/dt decision earlier in boot process
@ 2016-02-25 15:53       ` Aleksey Makarov
  0 siblings, 0 replies; 34+ messages in thread
From: Aleksey Makarov @ 2016-02-25 15:53 UTC (permalink / raw)
  To: linux-arm-kernel

Hi Matthias,

On 02/24/2016 09:22 PM, Matthias Brugger wrote:
> 
> 
> On 24/02/16 18:10, Aleksey Makarov wrote:
>> From: Leif Lindholm <leif.lindholm@linaro.org>
>>
>> In order to support selecting earlycon via either ACPI or DT, move
>> the decision on whether to attempt ACPI configuration into the
>> early_param handling. Then make acpi_boot_table_init() bail out if
>> acpi_disabled.
>>
>> Signed-off-by: Leif Lindholm <leif.lindholm@linaro.org>
>> Signed-off-by: Aleksey Makarov <aleksey.makarov@linaro.org>
>> ---
>>   arch/arm64/kernel/acpi.c | 62 +++++++++++++++++++++++-------------------------
>>   1 file changed, 30 insertions(+), 32 deletions(-)
>>
>> diff --git a/arch/arm64/kernel/acpi.c b/arch/arm64/kernel/acpi.c
>> index d1ce8e2..3faa323 100644
>> --- a/arch/arm64/kernel/acpi.c
>> +++ b/arch/arm64/kernel/acpi.c
>> @@ -41,26 +41,8 @@ EXPORT_SYMBOL(acpi_disabled);
>>   int acpi_pci_disabled = 1;    /* skip ACPI PCI scan and IRQ initialization */
>>   EXPORT_SYMBOL(acpi_pci_disabled);
>>
>> -static bool param_acpi_off __initdata;
>>   static bool param_acpi_force __initdata;
>>
>> -static int __init parse_acpi(char *arg)
>> -{
>> -    if (!arg)
>> -        return -EINVAL;
>> -
>> -    /* "acpi=off" disables both ACPI table parsing and interpreter */
>> -    if (strcmp(arg, "off") == 0)
>> -        param_acpi_off = true;
>> -    else if (strcmp(arg, "force") == 0) /* force ACPI to be enabled */
>> -        param_acpi_force = true;
>> -    else
>> -        return -EINVAL;    /* Core will print when we return error */
>> -
>> -    return 0;
>> -}
>> -early_param("acpi", parse_acpi);
>> -
>>   static int __init dt_scan_depth1_nodes(unsigned long node,
>>                          const char *uname, int depth,
>>                          void *data)
>> @@ -74,6 +56,35 @@ static int __init dt_scan_depth1_nodes(unsigned long node,
>>       return 0;
>>   }
>>
>> +static int __init parse_acpi(char *arg)
>> +{
>> +    if (!arg)
>> +        return -EINVAL;
>> +
>> +    /*
>> +     * Enable ACPI instead of device tree unless
>> +     * - ACPI has been disabled explicitly (acpi=off), or
>> +     * - the device tree is not empty (it has more than just a /chosen node)
>> +     *   and ACPI has not been force enabled (acpi=force)
>> +     */
>> +    if (strcmp(arg, "off") == 0)
>> +        return 0;
>> +    else if (strcmp(arg, "force") == 0)
>> +        param_acpi_force = true;
>> +    else if (of_scan_flat_dt(dt_scan_depth1_nodes, NULL))
> 
> I think we should strcmp for "on" here and return an error on other values. IMHO an update to Documentation/kernel-parameters.txt would be convenient.

Actually this patch is not correct at all.

on x86:
- if default is off then "acpi=force" enables it.
- if default is on  then "acpi=off"   disables it.

on ARM64 by default OF is preferred to ACPI, but ACPI is used if OF does not provide any nontrivial data.
So we need both "force" and "off"
- "acpi=force" forces ACPI,
- "acpi=off" disables ACPI

The patch makes incorrect code transformation, it changes the default behaviour.

This patch should just be dropped.  The rest of the patchset does not depend on it.

> I still wonder if we really want to change the default to ACPI disabled.
> But that's a decision the maintainers have to take.

I did not realize that the patch changes default.

Thank you
Aleksey Makarov

> Regards,
> Matthias
> 
>> +        return 0;
>> +
>> +    /*
>> +     * ACPI is disabled at this point. Enable it in order to parse
>> +     * the ACPI tables and carry out sanity checks
>> +     */
>> +    enable_acpi();
>> +
>> +    return 0;
>> +}
>> +
>> +early_param("acpi", parse_acpi);
>> +
>>   /*
>>    * __acpi_map_table() will be called before page_init(), so early_ioremap()
>>    * or early_memremap() should be called here to for ACPI table mapping.
>> @@ -181,23 +192,10 @@ out:
>>    */
>>   void __init acpi_boot_table_init(void)
>>   {
>> -    /*
>> -     * Enable ACPI instead of device tree unless
>> -     * - ACPI has been disabled explicitly (acpi=off), or
>> -     * - the device tree is not empty (it has more than just a /chosen node)
>> -     *   and ACPI has not been force enabled (acpi=force)
>> -     */
>> -    if (param_acpi_off ||
>> -        (!param_acpi_force && of_scan_flat_dt(dt_scan_depth1_nodes, NULL)))
>> +    if (acpi_disabled)
>>           return;
>>
>>       /*
>> -     * ACPI is disabled at this point. Enable it in order to parse
>> -     * the ACPI tables and carry out sanity checks
>> -     */
>> -    enable_acpi();
>> -
>> -    /*
>>        * If ACPI tables are initialized and FADT sanity checks passed,
>>        * leave ACPI enabled and carry on booting; otherwise disable ACPI
>>        * on initialization error.
>>

^ permalink raw reply	[flat|nested] 34+ messages in thread

end of thread, other threads:[~2016-02-25 15:54 UTC | newest]

Thread overview: 34+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-02-24 17:10 [PATCH v2 0/8] ACPI: parse the DBG2 table Aleksey Makarov
2016-02-24 17:10 ` Aleksey Makarov
2016-02-24 17:10 ` [PATCH v2 1/8] arm64: move acpi/dt decision earlier in boot process Aleksey Makarov
2016-02-24 17:10   ` Aleksey Makarov
2016-02-24 17:10   ` Aleksey Makarov
2016-02-24 18:22   ` Matthias Brugger
2016-02-24 18:22     ` Matthias Brugger
2016-02-25 15:53     ` Aleksey Makarov
2016-02-25 15:53       ` Aleksey Makarov
2016-02-24 17:10 ` [PATCH v2 2/8] of/serial: move earlycon early_param handling to serial Aleksey Makarov
2016-02-24 17:10   ` Aleksey Makarov
2016-02-24 17:10 ` [PATCH v2 3/8] ACPI: add definitions of DBG2 subtypes Aleksey Makarov
2016-02-24 17:10   ` Aleksey Makarov
2016-02-24 17:10   ` Aleksey Makarov
2016-02-24 17:17   ` Moore, Robert
2016-02-24 17:18     ` [Devel] " Moore, Robert
2016-02-24 17:17     ` Moore, Robert
2016-02-24 17:17     ` Moore, Robert
2016-02-24 17:25     ` Aleksey Makarov
2016-02-24 17:25       ` Aleksey Makarov
2016-02-24 17:25       ` Aleksey Makarov
2016-02-24 20:03       ` Rafael J. Wysocki
2016-02-24 20:03         ` Rafael J. Wysocki
2016-02-24 20:03         ` Rafael J. Wysocki
2016-02-24 17:10 ` [PATCH v2 4/8] ACPI: genaralize iterating over subtables in ACPI_PROBE_TABLE() Aleksey Makarov
2016-02-24 17:10   ` Aleksey Makarov
2016-02-24 17:10 ` [PATCH v2 5/8] ACPI: parse DBG2 table Aleksey Makarov
2016-02-24 17:10   ` Aleksey Makarov
2016-02-24 17:10 ` [PATCH v2 6/8] ACPI: serial: implement earlycon on ACPI DBG2 port Aleksey Makarov
2016-02-24 17:10   ` Aleksey Makarov
2016-02-24 17:10 ` [PATCH v2 7/8] ACPI: enable ACPI_DBG2_TABLE on ARM64 Aleksey Makarov
2016-02-24 17:10   ` Aleksey Makarov
2016-02-24 17:10 ` [PATCH v2 8/8] serial: pl011: add ACPI DBG2 serial port Aleksey Makarov
2016-02-24 17:10   ` Aleksey Makarov

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.