diff mbox

[U-Boot,v2,21/28] x86: acpi: Return table length in acpi_create_madt_lapics()

Message ID 1462632397-11224-22-git-send-email-bmeng.cn@gmail.com
State Accepted
Commit fc4f5cccd87abf4c72b13f64b49719fde9107cad
Delegated to: Bin Meng
Headers show

Commit Message

Bin Meng May 7, 2016, 2:46 p.m. UTC
Like other MADT table write routines, make acpi_create_madt_lapics()
return how many bytes it has written instead of the table end addr.

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

---

Changes in v2:
- New patch to return table length in acpi_create_madt_lapics()

 arch/x86/include/asm/acpi_table.h | 2 +-
 arch/x86/lib/acpi_table.c         | 8 +++++---
 2 files changed, 6 insertions(+), 4 deletions(-)

Comments

Simon Glass May 7, 2016, 6:47 p.m. UTC | #1
On 7 May 2016 at 08:46, Bin Meng <bmeng.cn@gmail.com> wrote:
> Like other MADT table write routines, make acpi_create_madt_lapics()
> return how many bytes it has written instead of the table end addr.
>
> Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
>
> ---
>
> Changes in v2:
> - New patch to return table length in acpi_create_madt_lapics()
>
>  arch/x86/include/asm/acpi_table.h | 2 +-
>  arch/x86/lib/acpi_table.c         | 8 +++++---
>  2 files changed, 6 insertions(+), 4 deletions(-)

Reviewed-by: Simon Glass <sjg@chromium.org>
Bin Meng May 8, 2016, 8:19 a.m. UTC | #2
On Sun, May 8, 2016 at 2:47 AM, Simon Glass <sjg@chromium.org> wrote:
> On 7 May 2016 at 08:46, Bin Meng <bmeng.cn@gmail.com> wrote:
>> Like other MADT table write routines, make acpi_create_madt_lapics()
>> return how many bytes it has written instead of the table end addr.
>>
>> Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
>>
>> ---
>>
>> Changes in v2:
>> - New patch to return table length in acpi_create_madt_lapics()
>>
>>  arch/x86/include/asm/acpi_table.h | 2 +-
>>  arch/x86/lib/acpi_table.c         | 8 +++++---
>>  2 files changed, 6 insertions(+), 4 deletions(-)
>
> Reviewed-by: Simon Glass <sjg@chromium.org>

applied to u-boot-x86/next, thanks!
diff mbox

Patch

diff --git a/arch/x86/include/asm/acpi_table.h b/arch/x86/include/asm/acpi_table.h
index b450c43..ff4802a 100644
--- a/arch/x86/include/asm/acpi_table.h
+++ b/arch/x86/include/asm/acpi_table.h
@@ -301,7 +301,7 @@  struct acpi_mcfg_mmconfig {
 void acpi_fill_header(struct acpi_table_header *header, char *signature);
 void acpi_create_fadt(struct acpi_fadt *fadt, struct acpi_facs *facs,
 		      void *dsdt);
-u32 acpi_create_madt_lapics(u32 current);
+int acpi_create_madt_lapics(u32 current);
 int acpi_create_madt_ioapic(struct acpi_madt_ioapic *ioapic, u8 id,
 			    u32 addr, u32 gsi_base);
 int acpi_create_madt_irqoverride(struct acpi_madt_irqoverride *irqoverride,
diff --git a/arch/x86/lib/acpi_table.c b/arch/x86/lib/acpi_table.c
index 201b16e..83cb8b5 100644
--- a/arch/x86/lib/acpi_table.c
+++ b/arch/x86/lib/acpi_table.c
@@ -179,21 +179,23 @@  static int acpi_create_madt_lapic(struct acpi_madt_lapic *lapic,
 	return lapic->length;
 }
 
-u32 acpi_create_madt_lapics(u32 current)
+int acpi_create_madt_lapics(u32 current)
 {
 	struct udevice *dev;
+	int length = 0;
 
 	for (uclass_find_first_device(UCLASS_CPU, &dev);
 	     dev;
 	     uclass_find_next_device(&dev)) {
 		struct cpu_platdata *plat = dev_get_parent_platdata(dev);
 
-		current += acpi_create_madt_lapic(
+		length += acpi_create_madt_lapic(
 			(struct acpi_madt_lapic *)current,
 			plat->cpu_id, plat->cpu_id);
+		current += length;
 	}
 
-	return current;
+	return length;
 }
 
 int acpi_create_madt_ioapic(struct acpi_madt_ioapic *ioapic, u8 id,