All of lore.kernel.org
 help / color / mirror / Atom feed
* [U-Boot] [PATCH 1/2] x86: acpi: Use an API to get the ACPI RSDP table address
@ 2018-01-30 13:01 Bin Meng
  2018-01-30 13:01 ` [U-Boot] [PATCH 2/2] x86: qemu: qfw: Implement acpi_get_rsdp_addr() Bin Meng
  2018-01-30 14:42 ` [U-Boot] [PATCH 1/2] x86: acpi: Use an API to get the ACPI RSDP table address Bin Meng
  0 siblings, 2 replies; 7+ messages in thread
From: Bin Meng @ 2018-01-30 13:01 UTC (permalink / raw)
  To: u-boot

At present the acpi_rsdp_addr variable is directly referenced in
setup_zimage(). This changes to use an API for better encapsulation
and extension.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
---

 arch/x86/include/asm/acpi_table.h |  9 +++++++++
 arch/x86/lib/acpi_table.c         |  7 ++++++-
 arch/x86/lib/acpi_table.h         | 10 ----------
 arch/x86/lib/zimage.c             |  4 ++--
 4 files changed, 17 insertions(+), 13 deletions(-)
 delete mode 100644 arch/x86/lib/acpi_table.h

diff --git a/arch/x86/include/asm/acpi_table.h b/arch/x86/include/asm/acpi_table.h
index 8003850..d5d77cc 100644
--- a/arch/x86/include/asm/acpi_table.h
+++ b/arch/x86/include/asm/acpi_table.h
@@ -330,6 +330,15 @@ void enter_acpi_mode(int pm1_cnt);
 ulong write_acpi_tables(ulong start);
 
 /**
+ * acpi_get_rsdp_addr() - get ACPI RSDP table address
+ *
+ * This routine returns the ACPI RSDP table address in the system memory.
+ *
+ * @return:	ACPI RSDP table address
+ */
+ulong acpi_get_rsdp_addr(void);
+
+/**
  * acpi_find_fadt() - find ACPI FADT table in the sytem memory
  *
  * This routine parses the ACPI table to locate the ACPI FADT table.
diff --git a/arch/x86/lib/acpi_table.c b/arch/x86/lib/acpi_table.c
index d3e5d2e..115a8e4 100644
--- a/arch/x86/lib/acpi_table.c
+++ b/arch/x86/lib/acpi_table.c
@@ -29,7 +29,7 @@
 extern const unsigned char AmlCode[];
 
 /* ACPI RSDP address to be used in boot parameters */
-unsigned long acpi_rsdp_addr;
+static ulong acpi_rsdp_addr;
 
 static void acpi_write_rsdp(struct acpi_rsdp *rsdp, struct acpi_rsdt *rsdt,
 			    struct acpi_xsdt *xsdt)
@@ -480,6 +480,11 @@ ulong write_acpi_tables(ulong start)
 	return current;
 }
 
+ulong acpi_get_rsdp_addr(void)
+{
+	return acpi_rsdp_addr;
+}
+
 static struct acpi_rsdp *acpi_valid_rsdp(struct acpi_rsdp *rsdp)
 {
 	if (strncmp((char *)rsdp, RSDP_SIG, sizeof(RSDP_SIG) - 1) != 0)
diff --git a/arch/x86/lib/acpi_table.h b/arch/x86/lib/acpi_table.h
deleted file mode 100644
index cece5d1..0000000
--- a/arch/x86/lib/acpi_table.h
+++ /dev/null
@@ -1,10 +0,0 @@
-/*
- * SPDX-License-Identifier:	GPL-2.0
- */
-
-#ifndef _X86_LIB_ACPI_TABLES_H
-#define _X86_LIB_ACPI_TABLES_H
-
-extern unsigned long acpi_rsdp_addr;
-
-#endif
diff --git a/arch/x86/lib/zimage.c b/arch/x86/lib/zimage.c
index eae2663..2a82bc8 100644
--- a/arch/x86/lib/zimage.c
+++ b/arch/x86/lib/zimage.c
@@ -14,6 +14,7 @@
  */
 
 #include <common.h>
+#include <asm/acpi_table.h>
 #include <asm/io.h>
 #include <asm/ptrace.h>
 #include <asm/zimage.h>
@@ -24,7 +25,6 @@
 #include <asm/arch/timestamp.h>
 #endif
 #include <linux/compiler.h>
-#include "acpi_table.h"
 
 DECLARE_GLOBAL_DATA_PTR;
 
@@ -258,7 +258,7 @@ int setup_zimage(struct boot_params *setup_base, char *cmd_line, int auto_boot,
 
 #ifdef CONFIG_GENERATE_ACPI_TABLE
 	if (bootproto >= 0x020e)
-		hdr->acpi_rsdp_addr = acpi_rsdp_addr;
+		hdr->acpi_rsdp_addr = acpi_get_rsdp_addr();
 #endif
 
 	setup_video(&setup_base->screen_info);
-- 
2.7.4

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

* [U-Boot] [PATCH 2/2] x86: qemu: qfw: Implement acpi_get_rsdp_addr()
  2018-01-30 13:01 [U-Boot] [PATCH 1/2] x86: acpi: Use an API to get the ACPI RSDP table address Bin Meng
@ 2018-01-30 13:01 ` Bin Meng
  2018-01-30 13:05   ` Andy Shevchenko
  2018-02-05  6:00   ` Miao Yan
  2018-01-30 14:42 ` [U-Boot] [PATCH 1/2] x86: acpi: Use an API to get the ACPI RSDP table address Bin Meng
  1 sibling, 2 replies; 7+ messages in thread
From: Bin Meng @ 2018-01-30 13:01 UTC (permalink / raw)
  To: u-boot

U-Boot on QEMU does not build ACPI table by ourself, instead it uses
the prebuilt ACPI table via the qfw interface. This implements the
qfw version of acpi_get_rsdp_addr() for setup_zimage().

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
---

 drivers/misc/qfw.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/drivers/misc/qfw.c b/drivers/misc/qfw.c
index a8af9e0..9a54803 100644
--- a/drivers/misc/qfw.c
+++ b/drivers/misc/qfw.c
@@ -222,6 +222,14 @@ out:
 	free(table_loader);
 	return addr;
 }
+
+ulong acpi_get_rsdp_addr(void)
+{
+	struct fw_file *file;
+
+	file = qemu_fwcfg_find_file("etc/acpi/rsdp");
+	return file->addr;
+}
 #endif
 
 /* Read configuration item using fw_cfg PIO interface */
-- 
2.7.4

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

* [U-Boot] [PATCH 2/2] x86: qemu: qfw: Implement acpi_get_rsdp_addr()
  2018-01-30 13:01 ` [U-Boot] [PATCH 2/2] x86: qemu: qfw: Implement acpi_get_rsdp_addr() Bin Meng
@ 2018-01-30 13:05   ` Andy Shevchenko
  2018-01-30 14:42     ` Bin Meng
  2018-02-05  6:00   ` Miao Yan
  1 sibling, 1 reply; 7+ messages in thread
From: Andy Shevchenko @ 2018-01-30 13:05 UTC (permalink / raw)
  To: u-boot

On Tue, 2018-01-30 at 05:01 -0800, Bin Meng wrote:
> U-Boot on QEMU does not build ACPI table by ourself, instead it uses
> the prebuilt ACPI table via the qfw interface. This implements the
> qfw version of acpi_get_rsdp_addr() for setup_zimage().
> 
> Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
> ---
> 
>  drivers/misc/qfw.c | 8 ++++++++
>  1 file changed, 8 insertions(+)
> 
> diff --git a/drivers/misc/qfw.c b/drivers/misc/qfw.c
> index a8af9e0..9a54803 100644
> --- a/drivers/misc/qfw.c
> +++ b/drivers/misc/qfw.c
> @@ -222,6 +222,14 @@ out:
>  	free(table_loader);
>  	return addr;
>  }
> +
> +ulong acpi_get_rsdp_addr(void)
> +{
> +	struct fw_file *file;
> +
> +	file = qemu_fwcfg_find_file("etc/acpi/rsdp");
> +	return file->addr;
> +}
>  #endif
>  
>  /* Read configuration item using fw_cfg PIO interface */


For both, FWIW:

Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>

Thanks for taking care!

-- 
Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Intel Finland Oy

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

* [U-Boot] [PATCH 1/2] x86: acpi: Use an API to get the ACPI RSDP table address
  2018-01-30 13:01 [U-Boot] [PATCH 1/2] x86: acpi: Use an API to get the ACPI RSDP table address Bin Meng
  2018-01-30 13:01 ` [U-Boot] [PATCH 2/2] x86: qemu: qfw: Implement acpi_get_rsdp_addr() Bin Meng
@ 2018-01-30 14:42 ` Bin Meng
  1 sibling, 0 replies; 7+ messages in thread
From: Bin Meng @ 2018-01-30 14:42 UTC (permalink / raw)
  To: u-boot

On Tue, Jan 30, 2018 at 9:01 PM, Bin Meng <bmeng.cn@gmail.com> wrote:
> At present the acpi_rsdp_addr variable is directly referenced in
> setup_zimage(). This changes to use an API for better encapsulation
> and extension.
>
> Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
> ---
>
>  arch/x86/include/asm/acpi_table.h |  9 +++++++++
>  arch/x86/lib/acpi_table.c         |  7 ++++++-
>  arch/x86/lib/acpi_table.h         | 10 ----------
>  arch/x86/lib/zimage.c             |  4 ++--
>  4 files changed, 17 insertions(+), 13 deletions(-)
>  delete mode 100644 arch/x86/lib/acpi_table.h
>

applied to u-boot-x86, thanks!

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

* [U-Boot] [PATCH 2/2] x86: qemu: qfw: Implement acpi_get_rsdp_addr()
  2018-01-30 13:05   ` Andy Shevchenko
@ 2018-01-30 14:42     ` Bin Meng
  0 siblings, 0 replies; 7+ messages in thread
From: Bin Meng @ 2018-01-30 14:42 UTC (permalink / raw)
  To: u-boot

On Tue, Jan 30, 2018 at 9:05 PM, Andy Shevchenko
<andriy.shevchenko@linux.intel.com> wrote:
> On Tue, 2018-01-30 at 05:01 -0800, Bin Meng wrote:
>> U-Boot on QEMU does not build ACPI table by ourself, instead it uses
>> the prebuilt ACPI table via the qfw interface. This implements the
>> qfw version of acpi_get_rsdp_addr() for setup_zimage().
>>
>> Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
>> ---
>>
>>  drivers/misc/qfw.c | 8 ++++++++
>>  1 file changed, 8 insertions(+)
>>
>> diff --git a/drivers/misc/qfw.c b/drivers/misc/qfw.c
>> index a8af9e0..9a54803 100644
>> --- a/drivers/misc/qfw.c
>> +++ b/drivers/misc/qfw.c
>> @@ -222,6 +222,14 @@ out:
>>       free(table_loader);
>>       return addr;
>>  }
>> +
>> +ulong acpi_get_rsdp_addr(void)
>> +{
>> +     struct fw_file *file;
>> +
>> +     file = qemu_fwcfg_find_file("etc/acpi/rsdp");
>> +     return file->addr;
>> +}
>>  #endif
>>
>>  /* Read configuration item using fw_cfg PIO interface */
>
>
> For both, FWIW:
>
> Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
>
> Thanks for taking care!
>

applied to u-boot-x86, thanks!

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

* [U-Boot] [PATCH 2/2] x86: qemu: qfw: Implement acpi_get_rsdp_addr()
  2018-01-30 13:01 ` [U-Boot] [PATCH 2/2] x86: qemu: qfw: Implement acpi_get_rsdp_addr() Bin Meng
  2018-01-30 13:05   ` Andy Shevchenko
@ 2018-02-05  6:00   ` Miao Yan
  2018-02-05  9:02     ` Bin Meng
  1 sibling, 1 reply; 7+ messages in thread
From: Miao Yan @ 2018-02-05  6:00 UTC (permalink / raw)
  To: u-boot

On Tue, Jan 30, 2018 at 9:01 PM, Bin Meng <bmeng.cn@gmail.com> wrote:
> U-Boot on QEMU does not build ACPI table by ourself, instead it uses
> the prebuilt ACPI table via the qfw interface. This implements the
> qfw version of acpi_get_rsdp_addr() for setup_zimage().
>
> Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
> ---
>
>  drivers/misc/qfw.c | 8 ++++++++
>  1 file changed, 8 insertions(+)
>
> diff --git a/drivers/misc/qfw.c b/drivers/misc/qfw.c
> index a8af9e0..9a54803 100644
> --- a/drivers/misc/qfw.c
> +++ b/drivers/misc/qfw.c
> @@ -222,6 +222,14 @@ out:
>         free(table_loader);
>         return addr;
>  }
> +
> +ulong acpi_get_rsdp_addr(void)
> +{
> +       struct fw_file *file;
> +
> +       file = qemu_fwcfg_find_file("etc/acpi/rsdp");
> +       return file->addr;

qemu_fwcfg_find_file() can return NULL. Don't we need to check that ? Or
can we assume etc/acpi/rsdp is always present ?

Sorry for the late response.

Miao

> +}
>  #endif
>
>  /* Read configuration item using fw_cfg PIO interface */
> --
> 2.7.4
>

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

* [U-Boot] [PATCH 2/2] x86: qemu: qfw: Implement acpi_get_rsdp_addr()
  2018-02-05  6:00   ` Miao Yan
@ 2018-02-05  9:02     ` Bin Meng
  0 siblings, 0 replies; 7+ messages in thread
From: Bin Meng @ 2018-02-05  9:02 UTC (permalink / raw)
  To: u-boot

Hi Miao,

On Mon, Feb 5, 2018 at 2:00 PM, Miao Yan <yanmiaobest@gmail.com> wrote:
> On Tue, Jan 30, 2018 at 9:01 PM, Bin Meng <bmeng.cn@gmail.com> wrote:
>> U-Boot on QEMU does not build ACPI table by ourself, instead it uses
>> the prebuilt ACPI table via the qfw interface. This implements the
>> qfw version of acpi_get_rsdp_addr() for setup_zimage().
>>
>> Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
>> ---
>>
>>  drivers/misc/qfw.c | 8 ++++++++
>>  1 file changed, 8 insertions(+)
>>
>> diff --git a/drivers/misc/qfw.c b/drivers/misc/qfw.c
>> index a8af9e0..9a54803 100644
>> --- a/drivers/misc/qfw.c
>> +++ b/drivers/misc/qfw.c
>> @@ -222,6 +222,14 @@ out:
>>         free(table_loader);
>>         return addr;
>>  }
>> +
>> +ulong acpi_get_rsdp_addr(void)
>> +{
>> +       struct fw_file *file;
>> +
>> +       file = qemu_fwcfg_find_file("etc/acpi/rsdp");
>> +       return file->addr;
>
> qemu_fwcfg_find_file() can return NULL. Don't we need to check that ? Or
> can we assume etc/acpi/rsdp is always present ?
>
> Sorry for the late response.
>

I think you are correct. If file is NULL, we should return 0.

Regards,
Bin

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

end of thread, other threads:[~2018-02-05  9:02 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-01-30 13:01 [U-Boot] [PATCH 1/2] x86: acpi: Use an API to get the ACPI RSDP table address Bin Meng
2018-01-30 13:01 ` [U-Boot] [PATCH 2/2] x86: qemu: qfw: Implement acpi_get_rsdp_addr() Bin Meng
2018-01-30 13:05   ` Andy Shevchenko
2018-01-30 14:42     ` Bin Meng
2018-02-05  6:00   ` Miao Yan
2018-02-05  9:02     ` Bin Meng
2018-01-30 14:42 ` [U-Boot] [PATCH 1/2] x86: acpi: Use an API to get the ACPI RSDP table address Bin Meng

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.