Re: [PATCH 1/2] Reland "x86: Move FACP table into separate functions""
Hi Andy, On Fri, 25 Aug 2023 at 07:27, Andy Shevchenko wrote: > > On Fri, Aug 25, 2023 at 04:25:29PM +0300, Andy Shevchenko wrote: > > On Fri, Aug 25, 2023 at 04:17:58PM +0300, Andy Shevchenko wrote: > > > On Fri, Aug 25, 2023 at 02:06:34PM +0300, Andy Shevchenko wrote: > > > > On Thu, Aug 24, 2023 at 12:23:32PM -0600, Simon Glass wrote: > > > > > Each board has its own way of creating this table. Rather than > > > > > calling the > > > > > acpi_create_fadt() function for each one from a common > > > > > acpi_write_fadt() > > > > > function, just move the writer into the board-specific code. > > > > > > > > No luck, but I have a bit of time to debug more. > > > > > > Okay, after your patch even U-Boot can't see those tables > > > > > > => acpi list > > > Name Base Size Detail > > > - -- > > > RSDP 000e4500 24 v02 U-BOOT > > > RSDT 000e4530 34 v01 U-BOOT U-BOOTBL 20231001 INTL 0 > > > XSDT 000e45e0 44 v01 U-BOOT U-BOOTBL 20231001 INTL 0 > > > CSRT 000e5490 58 v00 U-BOOT U-BOOTBL 20231001 INTL 0 > > > MCFG 000e5610 3c v01 U-BOOT U-BOOTBL 20231001 INTL 0 > > > SPCR 000e5650 50 v02 U-BOOT U-BOOTBL 20231001 INTL 0 > > > APIC 000e56a0 48 v02 U-BOOT U-BOOTBL 20231001 INTL 0 > > > > > > Because the base is badly corrupted: > > > > > > -0030: 52 53 44 54 38 00 00 00 01 95 55 2d 42 4f 4f 54 > > > RSDT8.U-BOOT > > > +0030: 52 53 44 54 34 00 00 00 01 eb 55 2d 42 4f 4f 54 > > > RSDT4.U-BOOT > > > > Length -4 bytes, another checksum as a result. > > > > > -0050: 00 00 00 00 90 54 0e 00 f0 54 0e 00 10 56 0e 00 > > > .T...T...V.. > > > +0050: 00 00 00 00 90 54 0e 00 10 56 0e 00 50 56 0e 00 > > > .T...V..PV.. > > > > Missing pointer to 0x0e54f0 which is... FADT! > > > > > -0060: 50 56 0e 00 a0 56 0e 00 00 00 00 00 00 00 00 00 > > > PV...V.. > > > +0060: a0 56 0e 00 00 00 00 00 00 00 00 00 00 00 00 00 > > > .V.. > > > > > > -00e0: 58 53 44 54 4c 00 00 00 01 7b 55 2d 42 4f 4f 54 > > > XSDTL{U-BOOT > > > +00e0: 58 53 44 54 44 00 00 00 01 d5 55 2d 42 4f 4f 54 > > > XSDTD.U-BOOT > > > > Wrong length, another checksum. > > > > > -0100: 00 00 00 00 90 54 0e 00 00 00 00 00 f0 54 0e 00 > > > .T...T.. > > > +0100: 00 00 00 00 90 54 0e 00 00 00 00 00 10 56 0e 00 > > > .T...V.. > > > > > > -0110: 00 00 00 00 10 56 0e 00 00 00 00 00 50 56 0e 00 > > > .V..PV.. > > > +0110: 00 00 00 00 50 56 0e 00 00 00 00 00 a0 56 0e 00 > > > PV...V.. > > > > > > -0120: 00 00 00 00 a0 56 0e 00 00 00 00 00 00 00 00 00 > > > .V.. > > > +0120: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 > > > > > > > Same reason. So, your code forgot to link FADT to the main tables. > > By code analysis you simply missed > > + acpi_add_table(ctx, fadt); > > I'm going to check this right now... Stay tuned! Thanks for digging into this, I really appreciate it! - Simon
Re: [PATCH 1/2] Reland "x86: Move FACP table into separate functions""
On Fri, Aug 25, 2023 at 04:25:29PM +0300, Andy Shevchenko wrote: > On Fri, Aug 25, 2023 at 04:17:58PM +0300, Andy Shevchenko wrote: > > On Fri, Aug 25, 2023 at 02:06:34PM +0300, Andy Shevchenko wrote: > > > On Thu, Aug 24, 2023 at 12:23:32PM -0600, Simon Glass wrote: > > > > Each board has its own way of creating this table. Rather than calling > > > > the > > > > acpi_create_fadt() function for each one from a common acpi_write_fadt() > > > > function, just move the writer into the board-specific code. > > > > > > No luck, but I have a bit of time to debug more. > > > > Okay, after your patch even U-Boot can't see those tables > > > > => acpi list > > Name Base Size Detail > > - -- > > RSDP 000e4500 24 v02 U-BOOT > > RSDT 000e4530 34 v01 U-BOOT U-BOOTBL 20231001 INTL 0 > > XSDT 000e45e0 44 v01 U-BOOT U-BOOTBL 20231001 INTL 0 > > CSRT 000e5490 58 v00 U-BOOT U-BOOTBL 20231001 INTL 0 > > MCFG 000e5610 3c v01 U-BOOT U-BOOTBL 20231001 INTL 0 > > SPCR 000e5650 50 v02 U-BOOT U-BOOTBL 20231001 INTL 0 > > APIC 000e56a0 48 v02 U-BOOT U-BOOTBL 20231001 INTL 0 > > > > Because the base is badly corrupted: > > > > -0030: 52 53 44 54 38 00 00 00 01 95 55 2d 42 4f 4f 54 RSDT8.U-BOOT > > +0030: 52 53 44 54 34 00 00 00 01 eb 55 2d 42 4f 4f 54 RSDT4.U-BOOT > > Length -4 bytes, another checksum as a result. > > > -0050: 00 00 00 00 90 54 0e 00 f0 54 0e 00 10 56 0e 00 .T...T...V.. > > +0050: 00 00 00 00 90 54 0e 00 10 56 0e 00 50 56 0e 00 .T...V..PV.. > > Missing pointer to 0x0e54f0 which is... FADT! > > > -0060: 50 56 0e 00 a0 56 0e 00 00 00 00 00 00 00 00 00 PV...V.. > > +0060: a0 56 0e 00 00 00 00 00 00 00 00 00 00 00 00 00 .V.. > > > > -00e0: 58 53 44 54 4c 00 00 00 01 7b 55 2d 42 4f 4f 54 XSDTL{U-BOOT > > +00e0: 58 53 44 54 44 00 00 00 01 d5 55 2d 42 4f 4f 54 XSDTD.U-BOOT > > Wrong length, another checksum. > > > -0100: 00 00 00 00 90 54 0e 00 00 00 00 00 f0 54 0e 00 .T...T.. > > +0100: 00 00 00 00 90 54 0e 00 00 00 00 00 10 56 0e 00 .T...V.. > > > > -0110: 00 00 00 00 10 56 0e 00 00 00 00 00 50 56 0e 00 .V..PV.. > > +0110: 00 00 00 00 50 56 0e 00 00 00 00 00 a0 56 0e 00 PV...V.. > > > > -0120: 00 00 00 00 a0 56 0e 00 00 00 00 00 00 00 00 00 .V.. > > +0120: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 > > Same reason. So, your code forgot to link FADT to the main tables. By code analysis you simply missed + acpi_add_table(ctx, fadt); I'm going to check this right now... Stay tuned! -- With Best Regards, Andy Shevchenko
Re: [PATCH 1/2] Reland "x86: Move FACP table into separate functions""
On Fri, Aug 25, 2023 at 04:17:58PM +0300, Andy Shevchenko wrote: > On Fri, Aug 25, 2023 at 02:06:34PM +0300, Andy Shevchenko wrote: > > On Thu, Aug 24, 2023 at 12:23:32PM -0600, Simon Glass wrote: > > > Each board has its own way of creating this table. Rather than calling the > > > acpi_create_fadt() function for each one from a common acpi_write_fadt() > > > function, just move the writer into the board-specific code. > > > > No luck, but I have a bit of time to debug more. > > Okay, after your patch even U-Boot can't see those tables > > => acpi list > Name Base Size Detail > - -- > RSDP 000e4500 24 v02 U-BOOT > RSDT 000e4530 34 v01 U-BOOT U-BOOTBL 20231001 INTL 0 > XSDT 000e45e0 44 v01 U-BOOT U-BOOTBL 20231001 INTL 0 > CSRT 000e5490 58 v00 U-BOOT U-BOOTBL 20231001 INTL 0 > MCFG 000e5610 3c v01 U-BOOT U-BOOTBL 20231001 INTL 0 > SPCR 000e5650 50 v02 U-BOOT U-BOOTBL 20231001 INTL 0 > APIC 000e56a0 48 v02 U-BOOT U-BOOTBL 20231001 INTL 0 > > Because the base is badly corrupted: > > -0030: 52 53 44 54 38 00 00 00 01 95 55 2d 42 4f 4f 54 RSDT8.U-BOOT > +0030: 52 53 44 54 34 00 00 00 01 eb 55 2d 42 4f 4f 54 RSDT4.U-BOOT Length -4 bytes, another checksum as a result. > -0050: 00 00 00 00 90 54 0e 00 f0 54 0e 00 10 56 0e 00 .T...T...V.. > +0050: 00 00 00 00 90 54 0e 00 10 56 0e 00 50 56 0e 00 .T...V..PV.. Missing pointer to 0x0e54f0 which is... FADT! > -0060: 50 56 0e 00 a0 56 0e 00 00 00 00 00 00 00 00 00 PV...V.. > +0060: a0 56 0e 00 00 00 00 00 00 00 00 00 00 00 00 00 .V.. > > -00e0: 58 53 44 54 4c 00 00 00 01 7b 55 2d 42 4f 4f 54 XSDTL{U-BOOT > +00e0: 58 53 44 54 44 00 00 00 01 d5 55 2d 42 4f 4f 54 XSDTD.U-BOOT Wrong length, another checksum. > -0100: 00 00 00 00 90 54 0e 00 00 00 00 00 f0 54 0e 00 .T...T.. > +0100: 00 00 00 00 90 54 0e 00 00 00 00 00 10 56 0e 00 .T...V.. > > -0110: 00 00 00 00 10 56 0e 00 00 00 00 00 50 56 0e 00 .V..PV.. > +0110: 00 00 00 00 50 56 0e 00 00 00 00 00 a0 56 0e 00 PV...V.. > > -0120: 00 00 00 00 a0 56 0e 00 00 00 00 00 00 00 00 00 .V.. > +0120: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 Same reason. So, your code forgot to link FADT to the main tables. -- With Best Regards, Andy Shevchenko
Re: [PATCH 1/2] Reland "x86: Move FACP table into separate functions""
On Fri, Aug 25, 2023 at 02:06:34PM +0300, Andy Shevchenko wrote: > On Thu, Aug 24, 2023 at 12:23:32PM -0600, Simon Glass wrote: > > Each board has its own way of creating this table. Rather than calling the > > acpi_create_fadt() function for each one from a common acpi_write_fadt() > > function, just move the writer into the board-specific code. > > No luck, but I have a bit of time to debug more. Okay, after your patch even U-Boot can't see those tables => acpi list Name Base Size Detail - -- RSDP 000e4500 24 v02 U-BOOT RSDT 000e4530 34 v01 U-BOOT U-BOOTBL 20231001 INTL 0 XSDT 000e45e0 44 v01 U-BOOT U-BOOTBL 20231001 INTL 0 CSRT 000e5490 58 v00 U-BOOT U-BOOTBL 20231001 INTL 0 MCFG 000e5610 3c v01 U-BOOT U-BOOTBL 20231001 INTL 0 SPCR 000e5650 50 v02 U-BOOT U-BOOTBL 20231001 INTL 0 APIC 000e56a0 48 v02 U-BOOT U-BOOTBL 20231001 INTL 0 Because the base is badly corrupted: -0030: 52 53 44 54 38 00 00 00 01 95 55 2d 42 4f 4f 54 RSDT8.U-BOOT +0030: 52 53 44 54 34 00 00 00 01 eb 55 2d 42 4f 4f 54 RSDT4.U-BOOT -0050: 00 00 00 00 90 54 0e 00 f0 54 0e 00 10 56 0e 00 .T...T...V.. +0050: 00 00 00 00 90 54 0e 00 10 56 0e 00 50 56 0e 00 .T...V..PV.. -0060: 50 56 0e 00 a0 56 0e 00 00 00 00 00 00 00 00 00 PV...V.. +0060: a0 56 0e 00 00 00 00 00 00 00 00 00 00 00 00 00 .V.. -00e0: 58 53 44 54 4c 00 00 00 01 7b 55 2d 42 4f 4f 54 XSDTL{U-BOOT +00e0: 58 53 44 54 44 00 00 00 01 d5 55 2d 42 4f 4f 54 XSDTD.U-BOOT -0100: 00 00 00 00 90 54 0e 00 00 00 00 00 f0 54 0e 00 .T...T.. +0100: 00 00 00 00 90 54 0e 00 00 00 00 00 10 56 0e 00 .T...V.. -0110: 00 00 00 00 10 56 0e 00 00 00 00 00 50 56 0e 00 .V..PV.. +0110: 00 00 00 00 50 56 0e 00 00 00 00 00 a0 56 0e 00 PV...V.. -0120: 00 00 00 00 a0 56 0e 00 00 00 00 00 00 00 00 00 .V.. +0120: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 -- With Best Regards, Andy Shevchenko
Re: [PATCH 1/2] Reland "x86: Move FACP table into separate functions""
On Fri, Aug 25, 2023 at 02:10:05PM +0300, Andy Shevchenko wrote: > On Fri, Aug 25, 2023 at 02:06:34PM +0300, Andy Shevchenko wrote: > > On Thu, Aug 24, 2023 at 12:23:32PM -0600, Simon Glass wrote: > > > Each board has its own way of creating this table. Rather than calling the > > > acpi_create_fadt() function for each one from a common acpi_write_fadt() > > > function, just move the writer into the board-specific code. > > > > No luck, but I have a bit of time to debug more. > > U-boot: > > Writing tables to e4500: > ACPI: Writing ACPI tables at e4500 > writing acpi tables > 0base: writing table '' at 000e4500 > - return code 0 > 1facs: writing table 'FACS' at 000e4740 > - return code 0 > 3dsdt: writing table 'DSDT' at 000e4780 > - return code 0 > 4gnvs: writing table 'GNVS' at 000e5390 > - return code 0 > 5csrt: writing table 'CSRT' at 000e5490 > - return code 0 > 5fadt: writing table 'FADT' at 000e54f0 > - return code 0 > 5mcfg: writing table 'MCFG' at 000e5610 > - return code 0 > 5spcr: writing table 'SPCR' at 000e5650 > - return code 0 > 5tcpa: writing table 'TCPA' at 000e56a0 > 5tcpa: Omitted due to being empty > - return code 0 > 5tpm2: writing table 'TPM2' at 000e56a0 > 5tpm2: Omitted due to being empty > - return code 0 > 5x86: writing table '' at 000e56a0 > - return code 0 > 6ssdt: writing table 'SSDT' at 000e56f0 > 6ssdt: Omitted due to being empty > - return code 0 > 8dev: writing table '' at 000e56f0 > - return code 0 > writing acpi tables done ok > ACPI current = e56f0 > - wrote 'acpi' to e4500, end e56f0 > - wrote 'smbios' to e56f0, end e584f > - done writing tables > Linux: > > [0.003034] ACPI: RSDP 0x000E4500 24 (v02 U-BOOT) > [0.003090] ACPI: XSDT 0x000E45E0 44 (v01 U-BOOT U-BOOTBL > 20231001 INTL ) > [0.003158] ACPI: CSRT 0x000E5490 58 (v00 U-BOOT U-BOOTBL > 20231001 INTL ) > [0.003219] ACPI: MCFG 0x000E5610 3C (v01 U-BOOT U-BOOTBL > 20231001 INTL ) > [0.003277] ACPI: SPCR 0x000E5650 50 (v02 U-BOOT U-BOOTBL > 20231001 INTL ) > [0.003332] ACPI: APIC 0x000E56A0 48 (v02 U-BOOT U-BOOTBL > 20231001 INTL ) > [0.003382] ACPI: Reserving CSRT table memory at [mem 0xe5490-0xe54e7] > [0.003403] ACPI: Reserving MCFG table memory at [mem 0xe5610-0xe564b] > [0.003421] ACPI: Reserving SPCR table memory at [mem 0xe5650-0xe569f] > [0.003437] ACPI: Reserving APIC table memory at [mem 0xe56a0-0xe56e7] > > As you can see a few tables are missing: > FACS, DSDT, GNVS, FADT I added a debug to the ACPI writer, so with your patch Writing tables to e4500: ACPI: Writing ACPI tables at e4500 writing acpi tables 0base: writing table '' at 000e4500 * other: Added type 3, 000e4500, size 240 - return code 0 1facs: writing table 'FACS' at 000e4740 * other: Added type 3, 000e4740, size 40 - return code 0 3dsdt: writing table 'DSDT' at 000e4780 Writing DSDT tables Writing DSDT finished, err=0 Failed to find ordering, leaving as is * other: Added type 3, 000e4780, size c10 - return code 0 4gnvs: writing table 'GNVS' at 000e5390 * other: Added type 3, 000e5390, size 100 - return code 0 5csrt: writing table 'CSRT' at 000e5490 * other: Added type 3, 000e5490, size 60 - return code 0 5fadt: writing table 'FADT' at 000e54f0 * other: Added type 3, 000e54f0, size 120 - return code 0 5mcfg: writing table 'MCFG' at 000e5610 * other: Added type 3, 000e5610, size 40 - return code 0 5spcr: writing table 'SPCR' at 000e5650 * other: Added type 3, 000e5650, size 50 - return code 0 5tcpa: writing table 'TCPA' at 000e56a0 5tcpa: Omitted due to being empty - return code 0 5tpm2: writing table 'TPM2' at 000e56a0 5tpm2: Omitted due to being empty - return code 0 5x86: writing table '' at 000e56a0 * other: Added type 3, 000e56a0, size 50 - return code 0 6ssdt: writing table 'SSDT' at 000e56f0 Writing SSDT tables Writing SSDT finished, err=0 Failed to find ordering, leaving as is 6ssdt: Omitted due to being empty - return code 0 8dev: writing table '' at 000e56f0 Writing device tables Writing finished, err=0 - return code 0 writing acpi tables done ok ACPI current = e56f0 - wrote 'acpi' to e4500, end e56f0 - wrote 'smbios' to e56f0, end e584f - done writing tables Without your patch (to save your time: there is no single character difference 100% copy): Writing tables to e4500: ACPI: Writing ACPI tables at e4500 writing acpi tables 0base: writing table '' at 000e4500 * other: Added type 3, 000e4500, size 240 - return code 0 1facs: writing table 'FACS' at 000e4740 * other: Added type 3, 000e4740, size 40 - return code 0 3dsdt: writing table 'DSDT' at 000e4780 Writing DSDT tables Writing DSDT finished, err=0 Failed to find ordering, leaving as is * other: Added type 3, 000e4780, size c10 - return code 0 4gnvs: writing table 'GNVS' at 000e5390 * other: Added type 3, 000e5390, size 100 - return code 0 5csrt: writing table 'CSRT' at 000e5490 * other: Added type 3, 000e5490, size 60 -
Re: [PATCH 1/2] Reland "x86: Move FACP table into separate functions""
On Fri, Aug 25, 2023 at 02:06:34PM +0300, Andy Shevchenko wrote: > On Thu, Aug 24, 2023 at 12:23:32PM -0600, Simon Glass wrote: > > Each board has its own way of creating this table. Rather than calling the > > acpi_create_fadt() function for each one from a common acpi_write_fadt() > > function, just move the writer into the board-specific code. > > No luck, but I have a bit of time to debug more. U-boot: Writing tables to e4500: ACPI: Writing ACPI tables at e4500 writing acpi tables 0base: writing table '' at 000e4500 - return code 0 1facs: writing table 'FACS' at 000e4740 - return code 0 3dsdt: writing table 'DSDT' at 000e4780 - return code 0 4gnvs: writing table 'GNVS' at 000e5390 - return code 0 5csrt: writing table 'CSRT' at 000e5490 - return code 0 5fadt: writing table 'FADT' at 000e54f0 - return code 0 5mcfg: writing table 'MCFG' at 000e5610 - return code 0 5spcr: writing table 'SPCR' at 000e5650 - return code 0 5tcpa: writing table 'TCPA' at 000e56a0 5tcpa: Omitted due to being empty - return code 0 5tpm2: writing table 'TPM2' at 000e56a0 5tpm2: Omitted due to being empty - return code 0 5x86: writing table '' at 000e56a0 - return code 0 6ssdt: writing table 'SSDT' at 000e56f0 6ssdt: Omitted due to being empty - return code 0 8dev: writing table '' at 000e56f0 - return code 0 writing acpi tables done ok ACPI current = e56f0 - wrote 'acpi' to e4500, end e56f0 - wrote 'smbios' to e56f0, end e584f - done writing tables Linux: [0.003034] ACPI: RSDP 0x000E4500 24 (v02 U-BOOT) [0.003090] ACPI: XSDT 0x000E45E0 44 (v01 U-BOOT U-BOOTBL 20231001 INTL ) [0.003158] ACPI: CSRT 0x000E5490 58 (v00 U-BOOT U-BOOTBL 20231001 INTL ) [0.003219] ACPI: MCFG 0x000E5610 3C (v01 U-BOOT U-BOOTBL 20231001 INTL ) [0.003277] ACPI: SPCR 0x000E5650 50 (v02 U-BOOT U-BOOTBL 20231001 INTL ) [0.003332] ACPI: APIC 0x000E56A0 48 (v02 U-BOOT U-BOOTBL 20231001 INTL ) [0.003382] ACPI: Reserving CSRT table memory at [mem 0xe5490-0xe54e7] [0.003403] ACPI: Reserving MCFG table memory at [mem 0xe5610-0xe564b] [0.003421] ACPI: Reserving SPCR table memory at [mem 0xe5650-0xe569f] [0.003437] ACPI: Reserving APIC table memory at [mem 0xe56a0-0xe56e7] As you can see a few tables are missing: FACS, DSDT, GNVS, FADT -- With Best Regards, Andy Shevchenko
Re: [PATCH 1/2] Reland "x86: Move FACP table into separate functions""
On Thu, Aug 24, 2023 at 12:23:32PM -0600, Simon Glass wrote: > Each board has its own way of creating this table. Rather than calling the > acpi_create_fadt() function for each one from a common acpi_write_fadt() > function, just move the writer into the board-specific code. No luck, but I have a bit of time to debug more. -- With Best Regards, Andy Shevchenko
[PATCH 1/2] Reland "x86: Move FACP table into separate functions""
Each board has its own way of creating this table. Rather than calling the acpi_create_fadt() function for each one from a common acpi_write_fadt() function, just move the writer into the board-specific code. Signed-off-by: Simon Glass --- Make another attempt to land this. It apparently breaks Edison but I cannot test that board, nor can I work out what is wrong with the code. Previous test report is here: https://lore.kernel.org/all/yga9z7sbfaev6...@smile.fi.intel.com/ Looking at the image, the method is definitely present: $ nm /tmp/b/edison/u-boot |grep acpi_writer 0115fde0 D _u_boot_list_2_acpi_writer_2_0base 0115fdf0 D _u_boot_list_2_acpi_writer_2_1facs 0115fe00 D _u_boot_list_2_acpi_writer_2_3dsdt 0115fe10 D _u_boot_list_2_acpi_writer_2_4gnvs 0115fe20 D _u_boot_list_2_acpi_writer_2_5csrt 0115fe30 D _u_boot_list_2_acpi_writer_2_5fadt 0115fe40 D _u_boot_list_2_acpi_writer_2_5mcfg 0115fe50 D _u_boot_list_2_acpi_writer_2_5spcr 0115fe60 D _u_boot_list_2_acpi_writer_2_5tcpa 0115fe70 D _u_boot_list_2_acpi_writer_2_5tpm2 0115fe80 D _u_boot_list_2_acpi_writer_2_5x86 0115fe90 D _u_boot_list_2_acpi_writer_2_6ssdt 0115fea0 D _u_boot_list_2_acpi_writer_2_8dev I wonder if the code in quark_write_fadt() is not being called? 'acpi list' shows what tables are installed. On minnowmax there is no difference with or without this patch. Perhaps someone with sharper eyes than me can figure this out? The mechanism is that the functions to be called are put in a linker list, each element being declared using ACPI_WRITER(function_name). Then acpi_write_all() is called to write each one. Debugging could be added to that function, perhaps? arch/x86/cpu/apollolake/acpi.c| 17 + arch/x86/cpu/baytrail/acpi.c | 27 +++ arch/x86/cpu/quark/acpi.c | 27 +++ arch/x86/cpu/tangier/acpi.c | 25 + arch/x86/include/asm/acpi_table.h | 2 -- arch/x86/lib/acpi_table.c | 15 --- 6 files changed, 68 insertions(+), 45 deletions(-) diff --git a/arch/x86/cpu/apollolake/acpi.c b/arch/x86/cpu/apollolake/acpi.c index fd21c0b49684..16aaed7238ab 100644 --- a/arch/x86/cpu/apollolake/acpi.c +++ b/arch/x86/cpu/apollolake/acpi.c @@ -146,16 +146,25 @@ void fill_fadt(struct acpi_fadt *fadt) fadt->x_pm_tmr_blk.addrl = IOMAP_ACPI_BASE + PM1_TMR; } -void acpi_create_fadt(struct acpi_fadt *fadt, struct acpi_facs *facs, - void *dsdt) +static int apl_write_fadt(struct acpi_ctx *ctx, const struct acpi_writer *entry) { - struct acpi_table_header *header = >header; + struct acpi_table_header *header; + struct acpi_fadt *fadt; - acpi_fadt_common(fadt, facs, dsdt); + fadt = ctx->current; + acpi_fadt_common(fadt, ctx->facs, ctx->dsdt); intel_acpi_fill_fadt(fadt); fill_fadt(fadt); + header = >header; header->checksum = table_compute_checksum(fadt, header->length); + + acpi_add_table(ctx, fadt); + + acpi_inc(ctx, sizeof(struct acpi_fadt)); + + return 0; } +ACPI_WRITER(5fadt, "FADT", apl_write_fadt, 0); int apl_acpi_fill_dmar(struct acpi_ctx *ctx) { diff --git a/arch/x86/cpu/baytrail/acpi.c b/arch/x86/cpu/baytrail/acpi.c index 07757b88a305..4c526ff27310 100644 --- a/arch/x86/cpu/baytrail/acpi.c +++ b/arch/x86/cpu/baytrail/acpi.c @@ -15,20 +15,24 @@ #include #include -void acpi_create_fadt(struct acpi_fadt *fadt, struct acpi_facs *facs, - void *dsdt) +static int baytrail_write_fadt(struct acpi_ctx *ctx, + const struct acpi_writer *entry) { - struct acpi_table_header *header = &(fadt->header); + struct acpi_table_header *header; + struct acpi_fadt *fadt; + + fadt = ctx->current; + header = >header; u16 pmbase = ACPI_BASE_ADDRESS; - memset((void *)fadt, 0, sizeof(struct acpi_fadt)); + memset(fadt, '\0', sizeof(struct acpi_fadt)); acpi_fill_header(header, "FACP"); header->length = sizeof(struct acpi_fadt); header->revision = 4; - fadt->firmware_ctrl = (u32)facs; - fadt->dsdt = (u32)dsdt; + fadt->firmware_ctrl = (u32)ctx->facs; + fadt->dsdt = (u32)ctx->dsdt; fadt->preferred_pm_profile = ACPI_PM_MOBILE; fadt->sci_int = 9; fadt->smi_cmd = 0; @@ -75,9 +79,9 @@ void acpi_create_fadt(struct acpi_fadt *fadt, struct acpi_facs *facs, fadt->reset_reg.addrh = 0; fadt->reset_value = SYS_RST | RST_CPU | FULL_RST; - fadt->x_firmware_ctl_l = (u32)facs; + fadt->x_firmware_ctl_l = (u32)ctx->facs; fadt->x_firmware_ctl_h = 0; - fadt->x_dsdt_l = (u32)dsdt; + fadt->x_dsdt_l = (u32)ctx->dsdt; fadt->x_dsdt_h = 0; fadt->x_pm1a_evt_blk.space_id = ACPI_ADDRESS_SPACE_IO; @@ -137,7 +141,14 @@ void acpi_create_fadt(struct acpi_fadt *fadt, struct