x86: Generate a valid ACPI table

Implement write_acpi_table() to create a minimal working ACPI table.
This includes writing FACS, XSDT, RSDP, FADT, MCFG, MADT, DSDT & SSDT
ACPI table entries.

Use a Kconfig option GENERATE_ACPI_TABLE to tell U-Boot whether we need
actually write the APCI table just like we did for PIRQ routing, MP table
and SFI tables. With ACPI table existence, linux kernel gets control of
power management, thermal management, configuration management and
monitoring in hardware.

Signed-off-by: Saket Sinha <saket.sinha89@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Tidied up whitespace and aligned some tabs:
Signed-off-by: Simon Glass <sjg@chromium.org>
diff --git a/arch/x86/lib/tables.c b/arch/x86/lib/tables.c
index 75ffbc1..f15b2e2 100644
--- a/arch/x86/lib/tables.c
+++ b/arch/x86/lib/tables.c
@@ -8,6 +8,7 @@
 #include <asm/sfi.h>
 #include <asm/mpspec.h>
 #include <asm/tables.h>
+#include <asm/acpi_table.h>
 
 u8 table_compute_checksum(void *v, int len)
 {
@@ -51,4 +52,8 @@
 	rom_table_end = write_mp_table(rom_table_end);
 	rom_table_end = ALIGN(rom_table_end, 1024);
 #endif
+#ifdef CONFIG_GENERATE_ACPI_TABLE
+	rom_table_end = write_acpi_tables(rom_table_end);
+	rom_table_end = ALIGN(rom_table_end, 1024);
+#endif
 }