diff mbox series

[U-Boot,2/2] x86: qemu: qfw: Implement acpi_get_rsdp_addr()

Message ID 1517317277-22957-2-git-send-email-bmeng.cn@gmail.com
State Accepted
Commit 2d1c661915f046d89c4618889283a4f4d3b0bde2
Delegated to: Bin Meng
Headers show
Series [U-Boot,1/2] x86: acpi: Use an API to get the ACPI RSDP table address | expand

Commit Message

Bin Meng Jan. 30, 2018, 1:01 p.m. UTC
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(+)

Comments

Andy Shevchenko Jan. 30, 2018, 1:05 p.m. UTC | #1
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!
Bin Meng Jan. 30, 2018, 2:42 p.m. UTC | #2
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!
Miao Yan Feb. 5, 2018, 6 a.m. UTC | #3
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
>
Bin Meng Feb. 5, 2018, 9:02 a.m. UTC | #4
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
diff mbox series

Patch

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