Re: [PATCH v3 17/29] x86: Move acpi_table header to main include/ directory
Hi Andy, On Wed, 8 Apr 2020 at 11:05, Andy Shevchenko wrote: > > On Tue, Apr 07, 2020 at 08:57:27PM -0600, Simon Glass wrote: > > On Fri, 3 Apr 2020 at 06:58, Andy Shevchenko > > wrote: > > > > > > On Mon, Mar 30, 2020 at 05:12:53PM -0600, Simon Glass wrote: > > > > This file is potentially useful to other architectures saddled with ACPI > > > > so move most of its contents to a common location. > > > > > > It's not just potentially, it's definitely useful. > > > But this makes me think, why we don't incorporate ACPICA headers as is? > > > > Due to code style and the vast amount of unused code. > > So, it will be interesting journey over the same problems then. > But it's your problem to maintain this :-) If Intel is interested in maintaining this in U-Boot let us know. So long as the code style is right as we don't add dead code it should be fine. Regards, Simon
Re: [PATCH v3 17/29] x86: Move acpi_table header to main include/ directory
On Tue, Apr 07, 2020 at 08:57:27PM -0600, Simon Glass wrote: > On Fri, 3 Apr 2020 at 06:58, Andy Shevchenko > wrote: > > > > On Mon, Mar 30, 2020 at 05:12:53PM -0600, Simon Glass wrote: > > > This file is potentially useful to other architectures saddled with ACPI > > > so move most of its contents to a common location. > > > > It's not just potentially, it's definitely useful. > > But this makes me think, why we don't incorporate ACPICA headers as is? > > Due to code style and the vast amount of unused code. So, it will be interesting journey over the same problems then. But it's your problem to maintain this :-) -- With Best Regards, Andy Shevchenko
Re: [PATCH v3 17/29] x86: Move acpi_table header to main include/ directory
Hi Andy, On Fri, 3 Apr 2020 at 06:58, Andy Shevchenko wrote: > > On Mon, Mar 30, 2020 at 05:12:53PM -0600, Simon Glass wrote: > > This file is potentially useful to other architectures saddled with ACPI > > so move most of its contents to a common location. > > It's not just potentially, it's definitely useful. > But this makes me think, why we don't incorporate ACPICA headers as is? Due to code style and the vast amount of unused code. > > > > > Signed-off-by: Simon Glass > > Reviewed-by: Bin Meng > > Reviewed-by: Wolfgang Wallner > > --- > > > > Changes in v3: > > - Add forward declarations for the functions > > - Move acpi_table.h to include/acpi > > - Update commit message to say that we move most of its contents > > > > Changes in v2: None > > > > arch/x86/cpu/baytrail/acpi.c | 2 +- > > arch/x86/cpu/cpu.c| 2 +- > > arch/x86/cpu/quark/acpi.c | 2 +- > > arch/x86/cpu/tangier/acpi.c | 4 +- > > arch/x86/include/asm/acpi_table.h | 381 + > > arch/x86/lib/acpi.c | 2 +- > > arch/x86/lib/acpi_s3.c| 2 +- > > arch/x86/lib/acpi_table.c | 2 +- > > arch/x86/lib/tables.c | 2 +- > > arch/x86/lib/zimage.c | 2 +- > > include/acpi/acpi_table.h | 394 ++ > > lib/efi_loader/efi_acpi.c | 2 +- > > 12 files changed, 412 insertions(+), 385 deletions(-) > > create mode 100644 include/acpi/acpi_table.h > > Regards, Simon
Re: [PATCH v3 17/29] x86: Move acpi_table header to main include/ directory
On Mon, Mar 30, 2020 at 05:12:53PM -0600, Simon Glass wrote: > This file is potentially useful to other architectures saddled with ACPI > so move most of its contents to a common location. It's not just potentially, it's definitely useful. But this makes me think, why we don't incorporate ACPICA headers as is? > > Signed-off-by: Simon Glass > Reviewed-by: Bin Meng > Reviewed-by: Wolfgang Wallner > --- > > Changes in v3: > - Add forward declarations for the functions > - Move acpi_table.h to include/acpi > - Update commit message to say that we move most of its contents > > Changes in v2: None > > arch/x86/cpu/baytrail/acpi.c | 2 +- > arch/x86/cpu/cpu.c| 2 +- > arch/x86/cpu/quark/acpi.c | 2 +- > arch/x86/cpu/tangier/acpi.c | 4 +- > arch/x86/include/asm/acpi_table.h | 381 + > arch/x86/lib/acpi.c | 2 +- > arch/x86/lib/acpi_s3.c| 2 +- > arch/x86/lib/acpi_table.c | 2 +- > arch/x86/lib/tables.c | 2 +- > arch/x86/lib/zimage.c | 2 +- > include/acpi/acpi_table.h | 394 ++ > lib/efi_loader/efi_acpi.c | 2 +- > 12 files changed, 412 insertions(+), 385 deletions(-) > create mode 100644 include/acpi/acpi_table.h > > diff --git a/arch/x86/cpu/baytrail/acpi.c b/arch/x86/cpu/baytrail/acpi.c > index 3c27391873c..57723109796 100644 > --- a/arch/x86/cpu/baytrail/acpi.c > +++ b/arch/x86/cpu/baytrail/acpi.c > @@ -7,7 +7,7 @@ > #include > #include > #include > -#include > +#include > #include > #include > #include > diff --git a/arch/x86/cpu/cpu.c b/arch/x86/cpu/cpu.c > index 246ee50948c..cec04b481b9 100644 > --- a/arch/x86/cpu/cpu.c > +++ b/arch/x86/cpu/cpu.c > @@ -27,8 +27,8 @@ > #include > #include > #include > +#include > #include > -#include > #include > #include > #include > diff --git a/arch/x86/cpu/quark/acpi.c b/arch/x86/cpu/quark/acpi.c > index 7b6fc2f4a53..26cda3b3376 100644 > --- a/arch/x86/cpu/quark/acpi.c > +++ b/arch/x86/cpu/quark/acpi.c > @@ -4,7 +4,7 @@ > */ > > #include > -#include > +#include > #include > #include > #include > diff --git a/arch/x86/cpu/tangier/acpi.c b/arch/x86/cpu/tangier/acpi.c > index 8b128138b0d..4ec8fdd6f89 100644 > --- a/arch/x86/cpu/tangier/acpi.c > +++ b/arch/x86/cpu/tangier/acpi.c > @@ -8,13 +8,13 @@ > #include > #include > #include > -#include > -#include > +#include > #include > #include > #include > #include > #include > +#include > > void acpi_create_fadt(struct acpi_fadt *fadt, struct acpi_facs *facs, > void *dsdt) > diff --git a/arch/x86/include/asm/acpi_table.h > b/arch/x86/include/asm/acpi_table.h > index 7588913f937..928475cef4e 100644 > --- a/arch/x86/include/asm/acpi_table.h > +++ b/arch/x86/include/asm/acpi_table.h > @@ -9,381 +9,14 @@ > #ifndef __ASM_ACPI_TABLE_H__ > #define __ASM_ACPI_TABLE_H__ > > -#define RSDP_SIG "RSD PTR " /* RSDP pointer signature */ > -#define OEM_ID "U-BOOT"/* U-Boot */ > -#define OEM_TABLE_ID "U-BOOTBL" /* U-Boot Table */ > -#define ASLC_ID "INTL" /* Intel ASL Compiler */ > - > -#define ACPI_RSDP_REV_ACPI_1_0 0 > -#define ACPI_RSDP_REV_ACPI_2_0 2 > - > -/* > - * RSDP (Root System Description Pointer) > - * Note: ACPI 1.0 didn't have length, xsdt_address, and ext_checksum > - */ > -struct acpi_rsdp { > - char signature[8]; /* RSDP signature */ > - u8 checksum;/* Checksum of the first 20 bytes */ > - char oem_id[6]; /* OEM ID */ > - u8 revision;/* 0 for ACPI 1.0, others 2 */ > - u32 rsdt_address; /* Physical address of RSDT (32 bits) */ > - u32 length; /* Total RSDP length (incl. extended part) */ > - u64 xsdt_address; /* Physical address of XSDT (64 bits) */ > - u8 ext_checksum;/* Checksum of the whole table */ > - u8 reserved[3]; > -}; > - > -/* Generic ACPI header, provided by (almost) all tables */ > -struct __packed acpi_table_header { > - char signature[4]; /* ACPI signature (4 ASCII characters) */ > - u32 length; /* Table length in bytes (incl. header) */ > - u8 revision;/* Table version (not ACPI version!) */ > - volatile u8 checksum; /* To make sum of entire table == 0 */ > - char oem_id[6]; /* OEM identification */ > - char oem_table_id[8]; /* OEM table identification */ > - u32 oem_revision; /* OEM revision number */ > - char aslc_id[4];/* ASL compiler vendor ID */ > - u32 aslc_revision; /* ASL compiler revision number */ > -}; > - > -/* A maximum number of 32 ACPI tables ought to be enough for now */ > -#define MAX_ACPI_TABLES 32 > - > -/* RSDT (Root System Description Table) */ > -struct acpi_rsdt { > - struct
[PATCH v3 17/29] x86: Move acpi_table header to main include/ directory
This file is potentially useful to other architectures saddled with ACPI so move most of its contents to a common location. Signed-off-by: Simon Glass Reviewed-by: Bin Meng Reviewed-by: Wolfgang Wallner --- Changes in v3: - Add forward declarations for the functions - Move acpi_table.h to include/acpi - Update commit message to say that we move most of its contents Changes in v2: None arch/x86/cpu/baytrail/acpi.c | 2 +- arch/x86/cpu/cpu.c| 2 +- arch/x86/cpu/quark/acpi.c | 2 +- arch/x86/cpu/tangier/acpi.c | 4 +- arch/x86/include/asm/acpi_table.h | 381 + arch/x86/lib/acpi.c | 2 +- arch/x86/lib/acpi_s3.c| 2 +- arch/x86/lib/acpi_table.c | 2 +- arch/x86/lib/tables.c | 2 +- arch/x86/lib/zimage.c | 2 +- include/acpi/acpi_table.h | 394 ++ lib/efi_loader/efi_acpi.c | 2 +- 12 files changed, 412 insertions(+), 385 deletions(-) create mode 100644 include/acpi/acpi_table.h diff --git a/arch/x86/cpu/baytrail/acpi.c b/arch/x86/cpu/baytrail/acpi.c index 3c27391873c..57723109796 100644 --- a/arch/x86/cpu/baytrail/acpi.c +++ b/arch/x86/cpu/baytrail/acpi.c @@ -7,7 +7,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/arch/x86/cpu/cpu.c b/arch/x86/cpu/cpu.c index 246ee50948c..cec04b481b9 100644 --- a/arch/x86/cpu/cpu.c +++ b/arch/x86/cpu/cpu.c @@ -27,8 +27,8 @@ #include #include #include +#include #include -#include #include #include #include diff --git a/arch/x86/cpu/quark/acpi.c b/arch/x86/cpu/quark/acpi.c index 7b6fc2f4a53..26cda3b3376 100644 --- a/arch/x86/cpu/quark/acpi.c +++ b/arch/x86/cpu/quark/acpi.c @@ -4,7 +4,7 @@ */ #include -#include +#include #include #include #include diff --git a/arch/x86/cpu/tangier/acpi.c b/arch/x86/cpu/tangier/acpi.c index 8b128138b0d..4ec8fdd6f89 100644 --- a/arch/x86/cpu/tangier/acpi.c +++ b/arch/x86/cpu/tangier/acpi.c @@ -8,13 +8,13 @@ #include #include #include -#include -#include +#include #include #include #include #include #include +#include void acpi_create_fadt(struct acpi_fadt *fadt, struct acpi_facs *facs, void *dsdt) diff --git a/arch/x86/include/asm/acpi_table.h b/arch/x86/include/asm/acpi_table.h index 7588913f937..928475cef4e 100644 --- a/arch/x86/include/asm/acpi_table.h +++ b/arch/x86/include/asm/acpi_table.h @@ -9,381 +9,14 @@ #ifndef __ASM_ACPI_TABLE_H__ #define __ASM_ACPI_TABLE_H__ -#define RSDP_SIG "RSD PTR " /* RSDP pointer signature */ -#define OEM_ID "U-BOOT"/* U-Boot */ -#define OEM_TABLE_ID "U-BOOTBL" /* U-Boot Table */ -#define ASLC_ID"INTL" /* Intel ASL Compiler */ - -#define ACPI_RSDP_REV_ACPI_1_0 0 -#define ACPI_RSDP_REV_ACPI_2_0 2 - -/* - * RSDP (Root System Description Pointer) - * Note: ACPI 1.0 didn't have length, xsdt_address, and ext_checksum - */ -struct acpi_rsdp { - char signature[8]; /* RSDP signature */ - u8 checksum;/* Checksum of the first 20 bytes */ - char oem_id[6]; /* OEM ID */ - u8 revision;/* 0 for ACPI 1.0, others 2 */ - u32 rsdt_address; /* Physical address of RSDT (32 bits) */ - u32 length; /* Total RSDP length (incl. extended part) */ - u64 xsdt_address; /* Physical address of XSDT (64 bits) */ - u8 ext_checksum;/* Checksum of the whole table */ - u8 reserved[3]; -}; - -/* Generic ACPI header, provided by (almost) all tables */ -struct __packed acpi_table_header { - char signature[4]; /* ACPI signature (4 ASCII characters) */ - u32 length; /* Table length in bytes (incl. header) */ - u8 revision;/* Table version (not ACPI version!) */ - volatile u8 checksum; /* To make sum of entire table == 0 */ - char oem_id[6]; /* OEM identification */ - char oem_table_id[8]; /* OEM table identification */ - u32 oem_revision; /* OEM revision number */ - char aslc_id[4];/* ASL compiler vendor ID */ - u32 aslc_revision; /* ASL compiler revision number */ -}; - -/* A maximum number of 32 ACPI tables ought to be enough for now */ -#define MAX_ACPI_TABLES32 - -/* RSDT (Root System Description Table) */ -struct acpi_rsdt { - struct acpi_table_header header; - u32 entry[MAX_ACPI_TABLES]; -}; - -/* XSDT (Extended System Description Table) */ -struct acpi_xsdt { - struct acpi_table_header header; - u64 entry[MAX_ACPI_TABLES]; -}; - -/* FADT Preferred Power Management Profile */ -enum acpi_pm_profile { - ACPI_PM_UNSPECIFIED = 0, - ACPI_PM_DESKTOP, - ACPI_PM_MOBILE, - ACPI_PM_WORKSTATION, - ACPI_PM_ENTERPRISE_SERVER, -