x86: acpi: Annotate struct acpi_table_header with __packed
PATCH 1/4 x86: acpi: Annotate struct acpi_table_header with __packed
GCC starts complaining about possible pointer misalignment of pointers to the unpacked (alignment=4) structures in the packed (alignment=1) ones:
CC arch/x86/cpu/tangier/acpi.oarch/x86/cpu/tangier/acpi.c: In function ‘acpi_create_fadt’:arch/x86/cpu/tangier/acpi.c:22:37: warning: taking address of packed member of ‘struct acpi_fadt’ may result in an unaligned pointer value [-Waddress-of-packed-member]
22 | struct acpi_table_header *header = &(fadt->header);
CC arch/x86/lib/acpi_table.oarch/x86/lib/acpi_table.c: In function ‘acpi_create_spcr’:arch/x86/lib/acpi_table.c:366:37: warning: taking address of packed member of ‘struct acpi_spcr’ may result in an unaligned pointer value [-Waddress-of-packed-member]
366 | struct acpi_table_header *header = &(spcr->header);
Fix the potential issues by annotating embedded structures with __packed even though they are packed naturally.
--- arch/x86/include/asm/acpi_table.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/x86/include/asm/acpi_table.h +1 -1
@@ -34,7 +34,7 @@ struct acpi_rsdp { };/* Generic ACPI header, provided by (almost) all tables */ -struct acpi_table_header { +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!) */
Signature · 1 line
2.23.0.rc1
PATCH 2/4 x86: tangier: Reserve PCI ECAM in motherboard resources
Per PCI firmware specification the ACPI has to reserve the memory which is defined as PCI ECAM.
--- arch/x86/cpu/tangier/acpi.c | 3 ++- .../include/asm/arch-tangier/acpi/platform.asl | 1 + .../asm/arch-tangier/acpi/southcluster.asl | 17 +++++++++++++++++ arch/x86/include/asm/arch-tangier/iomap.h | 10 ++++++++++ 4 files changed, 30 insertions(+), 1 deletion(-) create mode 100644 arch/x86/include/asm/arch-tangier/iomap.h
arch/x86/cpu/tangier/acpi.c +2 -1
@@ -14,6 +14,7 @@#include <asm/mpspec.h> #include <asm/tables.h> #include <asm/arch/global_nvs.h> +#include <asm/arch/iomap.h> void acpi_create_fadt (struct acpi_fadt *fadt,struct acpi_facs *facs,void *dsdt)
@@ -63,7 +64,7 @@ u32 acpi_fill_mcfg(u32 current)/* TODO: Derive parameters from SFI MCFG table */ current +=acpi_create_mcfg_mmconfig ((struct acpi_mcfg_mmconfig *)current, -0x3f500000 ,0x0 ,0x0 ,0x0 ); +MCFG_BASE_ADDRESS ,0x0 ,0x0 ,0x0 );return current; }
arch/x86/include/asm/arch-tangier/acpi/platform.asl +1 -0
@@ -6,6 +6,7 @@ */ #include <asm/acpi/statdef.asl> +#include <asm/arch/iomap.h> /* * The _PTS method (Prepare To Sleep) is called before the OS is
arch/x86/include/asm/arch-tangier/acpi/southcluster.asl +17 -0
@@ -66,6 +66,23 @@ Device (PCI0) Return (MCRS) } + /* Device Resource Consumption */ + Device (PDRC) + { + Name (_HID, EISAID("PNP0C02")) + Name (_UID, One) + + Name (PDRS, ResourceTemplate() + { + Memory32Fixed(ReadWrite, MCFG_BASE_ADDRESS, MCFG_BASE_SIZE) + }) + + Method (_CRS, 0, Serialized) + { + Return (PDRS) + } + } + Method (_OSC, 4) { /* Check for proper GUID */
arch/x86/include/asm/arch-tangier/iomap.h new file +10 -0
@@ -0,0 +1,10 @@ +/* SPDX-License-Identifier: GPL-2.0+ */ +/* Copyright (c) 2019 Intel Corporation */ + +#ifndef _TANGIER_IOMAP_H +#define _TANGIER_IOMAP_H + +#define MCFG_BASE_ADDRESS 0x3f500000 +#define MCFG_BASE_SIZE 0x00100000 + +#endif /* _TANGIER_IOMAP_H */
Signature · 1 line
2.23.0.rc1
PATCH 2/4 x86: tangier: Reserve PCI ECAM in motherboard resources
Quoted 6 lines · Andy Shevchenko
Per PCI firmware specification the ACPI has to reserve the memory which is defined as PCI ECAM.
Fixes 39665beed6f7 ("x86: tangier: Enable ACPI support for Intel Tangier")Signed-off-by Andy Shevchenko <[email protected]>
Quoted 8 lines
--- arch/x86/cpu/tangier/acpi.c | 3 ++- .../include/asm/arch-tangier/acpi/platform.asl | 1 + .../asm/arch-tangier/acpi/southcluster.asl | 17 +++++++++++++++++ arch/x86/include/asm/arch-tangier/iomap.h | 10 ++++++++++ 4 files changed, 30 insertions(+), 1 deletion(-) create mode 100644 arch/x86/include/asm/arch-tangier/iomap.h
PATCH 2/4 x86: tangier: Reserve PCI ECAM in motherboard resources
Quoted 18 lines · Bin Meng
Quoted 6 lines · Andy Shevchenko
Per PCI firmware specification the ACPI has to reserve the memory which is defined as PCI ECAM.
Fixes 39665beed6f7 ("x86: tangier: Enable ACPI support for Intel Tangier")Signed-off-by Andy Shevchenko <[email protected]>Quoted 8 lines
--- arch/x86/cpu/tangier/acpi.c | 3 ++- .../include/asm/arch-tangier/acpi/platform.asl | 1 + .../asm/arch-tangier/acpi/southcluster.asl | 17 +++++++++++++++++ arch/x86/include/asm/arch-tangier/iomap.h | 10 ++++++++++ 4 files changed, 30 insertions(+), 1 deletion(-) create mode 100644 arch/x86/include/asm/arch-tangier/iomap.h
Quoted 1 line
Reviewed-by Bin Meng <[email protected]>
applied to u-boot-x86, thanks!
PATCH 3/4 x86: tangier: Fix off-by-one error when preparing CSRT
In reply to Andy ShevchenkoIntel iDMA 32-bit controller has 17 bits for the maximum block size value. Due to nature of the binary number representation the maximum value is 2^17 - 1. The original code misses the latter part in equation.
--- arch/x86/cpu/tangier/acpi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/x86/cpu/tangier/acpi.c +1 -1
@@ -95,7 +95,7 @@ static u32 acpi_fill_csrt_dma(struct acpi_csrt_group *grp) si->dma_address_width =32 ; si->base_request_line =0 ; si->num_handshake_signals =16 ; - si->max_block_size =0x20000 ; + si->max_block_size =0x1ffff ;return grp->length; }
Signature · 1 line
2.23.0.rc1
PATCH 3/4 x86: tangier: Fix off-by-one error when preparing CSRT
Quoted 11 lines · Andy Shevchenko
Intel iDMA 32-bit controller has 17 bits for the maximum block size value. Due to nature of the binary number representation the maximum value is 2^17 - 1. The original code misses the latter part in equation.
Fixes 5e99fde34a77 ("x86: tangier: Populate CSRT for shared DMA controller")Signed-off-by Andy Shevchenko <[email protected]>--- arch/x86/cpu/tangier/acpi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
PATCH 3/4 x86: tangier: Fix off-by-one error when preparing CSRT
Quoted 8 lines · Bin Meng
Quoted 5 lines · Andy Shevchenko
Intel iDMA 32-bit controller has 17 bits for the maximum block size value. Due to nature of the binary number representation the maximum value is 2^17 - 1. The original code misses the latter part in equation.
Quoted 8 lines
Quoted 6 lines
Fixes 5e99fde34a77 ("x86: tangier: Populate CSRT for shared DMA controller")Signed-off-by Andy Shevchenko <[email protected]>--- arch/x86/cpu/tangier/acpi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)Reviewed-by Bin Meng <[email protected]>
applied to u-boot-x86, thanks!
PATCH 4/4 x86: tangier: Use spaces over TABs in ASL code
In reply to Andy ShevchenkoFor sake of consistency use spaces over TABs in ASL code.
--- .../asm/arch-tangier/acpi/southcluster.asl | 26 +++++++++---------- 1 file changed, 13 insertions(+), 13 deletions(-)
arch/x86/include/asm/arch-tangier/acpi/southcluster.asl +13 -13
@@ -382,19 +382,19 @@ Device (PCI0) Name (RBUF, ResourceTemplate() { /* - * Shadow registers in SRAM for PMIC: - * SRAM PMIC register - * -------------------- - * 0x00- Unknown - * 0x03 THRMIRQ (0x04) - * 0x04 BCUIRQ (0x05) - * 0x05 ADCIRQ (0x06) - * 0x06 CHGRIRQ0 (0x07) - * 0x07 CHGRIRQ1 (0x08) - * 0x08- Unknown - * 0x0a PBSTATUS (0x27) - * 0x0b- Unknown - */ + * Shadow registers in SRAM for PMIC: + * SRAM PMIC register + * -------------------- + * 0x00- Unknown + * 0x03 THRMIRQ (0x04) + * 0x04 BCUIRQ (0x05) + * 0x05 ADCIRQ (0x06) + * 0x06 CHGRIRQ0 (0x07) + * 0x07 CHGRIRQ1 (0x08) + * 0x08- Unknown + * 0x0a PBSTATUS (0x27) + * 0x0b- Unknown + */ Memory32Fixed(ReadWrite, 0xFFFFF610, 0x00000010) Interrupt(ResourceConsumer, Level, ActiveHigh, Shared, ,, ) { 30 } Interrupt(ResourceConsumer, Level, ActiveHigh, Shared, ,, ) { 23 }
Signature · 1 line
2.23.0.rc1
PATCH 4/4 x86: tangier: Use spaces over TABs in ASL code
Quoted 8 lines · Andy Shevchenko
For sake of consistency use spaces over TABs in ASL code.
Signed-off-by Andy Shevchenko <[email protected]>--- .../asm/arch-tangier/acpi/southcluster.asl | 26 +++++++++---------- 1 file changed, 13 insertions(+), 13 deletions(-)
PATCH 4/4 x86: tangier: Use spaces over TABs in ASL code
Quoted 6 lines · Bin Meng
Quoted 3 lines · Andy Shevchenko
For sake of consistency use spaces over TABs in ASL code.
Quoted 7 lines
Quoted 5 lines
Signed-off-by Andy Shevchenko <[email protected]>--- .../asm/arch-tangier/acpi/southcluster.asl | 26 +++++++++---------- 1 file changed, 13 insertions(+), 13 deletions(-)Reviewed-by Bin Meng <[email protected]>
applied to u-boot-x86, thanks!
PATCH 1/4 x86: acpi: Annotate struct acpi_table_header with __packed
In reply to Andy ShevchenkoHi Andy,
Quoted 2 lines · Andy Shevchenko
GCC starts complaining about possible pointer misalignment of pointers to the
Which GCC version?
Quoted 12 lines
unpacked (alignment=4) structures in the packed (alignment=1) ones:
CC
arch/x86/cpu/tangier/acpi.oarch/x86/cpu/tangier/acpi.c: In function ‘acpi_create_fadt’:arch/x86/cpu/tangier/acpi.c:22:37: warning: taking address of packed member of ‘struct acpi_fadt’ may result in an unaligned pointer value [-Waddress-of-packed-member]
22 | structacpi_table_header*header = &(fadt->header);CC
arch/x86/lib/acpi_table.oarch/x86/lib/acpi_table.c: In function ‘acpi_create_spcr’:arch/x86/lib/acpi_table.c:366:37: warning: taking address of packed member of ‘struct acpi_spcr’ may result in an unaligned pointer value [-Waddress-of-packed-member]
366 | structacpi_table_header*header = &(spcr->header);
Quoted 8 lines
Fix the potential issues by annotating embedded structures with
__packedeven though they are packed naturally.Signed-off-by Andy Shevchenko <[email protected]>--- arch/x86/include/asm/acpi_table.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
Regards,
Bin
PATCH 1/4 x86: acpi: Annotate struct acpi_table_header with __packed
Quoted 9 lines · Bin Meng
Hi Andy,
Quoted 2 lines · Andy Shevchenko
GCC starts complaining about possible pointer misalignment of pointers to the
Which GCC version?
gcc (Debian 9.2.1-4) 9.2.1 20190821
Copyright (C) 2019 Free Software Foundation, Inc.
Signature · 2 lines
With Best Regards, Andy Shevchenko
PATCH 1/4 x86: acpi: Annotate struct acpi_table_header with __packed
Hi Andy,
Quoted 8 lines · Andy Shevchenko
Quoted 6 lines · Bin Meng
Hi Andy,
Quoted 1 line · Andy Shevchenko
Quoted 7 lines
Quoted 3 lines
Quoted 1 line
GCC starts complaining about possible pointer misalignment of pointers to the
Which GCC version?
gcc (Debian 9.2.1-4) 9.2.1 20190821
Copyright (C) 2019 Free Software Foundation, Inc.
I will add such information in the commit message when applying.
Regards,
Bin
PATCH 1/4 x86: acpi: Annotate struct acpi_table_header with __packed
Quoted 15 lines · Bin Meng
Hi Andy,
Quoted 10 lines · Andy Shevchenko
Quoted 8 lines · Bin Meng
Hi Andy,
Quoted 2 lines · Andy Shevchenko
GCC starts complaining about possible pointer misalignment of pointers to the
Quoted 9 lines
Quoted 5 lines
Quoted 1 line
Which GCC version?
gcc (Debian 9.2.1-4) 9.2.1 20190821
Copyright (C) 2019 Free Software Foundation, Inc.I will add such information in the commit message when applying.
Reviewed-by Bin Meng <[email protected]>
applied to u-boot-x86, thanks!