Skip to content

Commit

Permalink
Revert "x86: Move FACP table into separate functions"
Browse files Browse the repository at this point in the history
Before the culprit patch (see BugLink for the details):

  => acpi list
  Name      Base   Size  Detail
  ----  --------  -----  ------
  RSDP  000e4500     24  v02 U-BOOT
  RSDT  000e4530     38  v01 U-BOOT U-BOOTBL 20220401 INTL 0
  XSDT  000e45e0     4c  v01 U-BOOT U-BOOTBL 20220401 INTL 0
  CSRT  000e5490     58  v00 U-BOOT U-BOOTBL 20220401 INTL 0
  FACP  000e54f0    114  v06 U-BOOT U-BOOTBL 20220401 INTL 0
  DSDT  000e4780    c06  v02 U-BOOT U-BOOTBL 10000 INTL 20200925
  FACS  000e4740     40
  MCFG  000e5610     3c  v01 U-BOOT U-BOOTBL 20220401 INTL 0
  SPCR  000e5650     50  v02 U-BOOT U-BOOTBL 20220401 INTL 0
  APIC  000e56a0     48  v02 U-BOOT U-BOOTBL 20220401 INTL 0

After the culprit patch:

  => acpi list
  Name      Base   Size  Detail
  ----  --------  -----  ------
  RSDP  000e4500     24  v02 U-BOOT
  RSDT  000e4530     34  v01 U-BOOT U-BOOTBL 20220401 INTL 0
  XSDT  000e45e0     44  v01 U-BOOT U-BOOTBL 20220401 INTL 0
  CSRT  000e53a0     58  v00 U-BOOT U-BOOTBL 20220401 INTL 0
  MCFG  000e5520     3c  v01 U-BOOT U-BOOTBL 20220401 INTL 0
  SPCR  000e5560     50  v02 U-BOOT U-BOOTBL 20220401 INTL 0
  APIC  000e55b0     48  v02 U-BOOT U-BOOTBL 20220401 INTL 0

As a result Linux kernel can't find mandatory tables and fails
to boot.

Hence, revert it for good.

This reverts commit 379d3c1.

BugLink: https://lore.kernel.org/all/20220131225930.GJ7515@bill-the-cat/
Signed-off-by: Andy Shevchenko <[email protected]>
  • Loading branch information
andy-shev authored and Tom Rini committed Mar 31, 2022
1 parent dd2986a commit ce1cbf1
Show file tree
Hide file tree
Showing 6 changed files with 45 additions and 68 deletions.
17 changes: 4 additions & 13 deletions arch/x86/cpu/apollolake/acpi.c
Original file line number Diff line number Diff line change
Expand Up @@ -146,25 +146,16 @@ void fill_fadt(struct acpi_fadt *fadt)
fadt->x_pm_tmr_blk.addrl = IOMAP_ACPI_BASE + PM1_TMR;
}

static int apl_write_fadt(struct acpi_ctx *ctx, const struct acpi_writer *entry)
void acpi_create_fadt(struct acpi_fadt *fadt, struct acpi_facs *facs,
void *dsdt)
{
struct acpi_table_header *header;
struct acpi_fadt *fadt;
struct acpi_table_header *header = &fadt->header;

fadt = ctx->current;
acpi_fadt_common(fadt, ctx->facs, ctx->dsdt);
acpi_fadt_common(fadt, facs, dsdt);
intel_acpi_fill_fadt(fadt);
fill_fadt(fadt);
header = &fadt->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, "FACS", apl_write_fadt, 0);

int apl_acpi_fill_dmar(struct acpi_ctx *ctx)
{
Expand Down
27 changes: 8 additions & 19 deletions arch/x86/cpu/baytrail/acpi.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,24 +15,20 @@
#include <asm/arch/iomap.h>
#include <dm/uclass-internal.h>

static int baytrail_write_fadt(struct acpi_ctx *ctx,
const struct acpi_writer *entry)
void acpi_create_fadt(struct acpi_fadt *fadt, struct acpi_facs *facs,
void *dsdt)
{
struct acpi_table_header *header;
struct acpi_fadt *fadt;

fadt = ctx->current;
header = &fadt->header;
struct acpi_table_header *header = &(fadt->header);
u16 pmbase = ACPI_BASE_ADDRESS;

memset(fadt, '\0', sizeof(struct acpi_fadt));
memset((void *)fadt, 0, sizeof(struct acpi_fadt));

acpi_fill_header(header, "FACP");
header->length = sizeof(struct acpi_fadt);
header->revision = 4;

fadt->firmware_ctrl = (u32)ctx->facs;
fadt->dsdt = (u32)ctx->dsdt;
fadt->firmware_ctrl = (u32)facs;
fadt->dsdt = (u32)dsdt;
fadt->preferred_pm_profile = ACPI_PM_MOBILE;
fadt->sci_int = 9;
fadt->smi_cmd = 0;
Expand Down Expand Up @@ -79,9 +75,9 @@ static int baytrail_write_fadt(struct acpi_ctx *ctx,
fadt->reset_reg.addrh = 0;
fadt->reset_value = SYS_RST | RST_CPU | FULL_RST;

fadt->x_firmware_ctl_l = (u32)ctx->facs;
fadt->x_firmware_ctl_l = (u32)facs;
fadt->x_firmware_ctl_h = 0;
fadt->x_dsdt_l = (u32)ctx->dsdt;
fadt->x_dsdt_l = (u32)dsdt;
fadt->x_dsdt_h = 0;

fadt->x_pm1a_evt_blk.space_id = ACPI_ADDRESS_SPACE_IO;
Expand Down Expand Up @@ -141,14 +137,7 @@ static int baytrail_write_fadt(struct acpi_ctx *ctx,
fadt->x_gpe1_blk.addrh = 0x0;

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, "FACP", baytrail_write_fadt, 0);

int acpi_create_gnvs(struct acpi_global_nvs *gnvs)
{
Expand Down
27 changes: 8 additions & 19 deletions arch/x86/cpu/quark/acpi.c
Original file line number Diff line number Diff line change
Expand Up @@ -10,24 +10,20 @@
#include <asm/arch/global_nvs.h>
#include <asm/arch/iomap.h>

static int quark_write_fadt(struct acpi_ctx *ctx,
const struct acpi_writer *entry)
void acpi_create_fadt(struct acpi_fadt *fadt, struct acpi_facs *facs,
void *dsdt)
{
struct acpi_table_header *header = &(fadt->header);
u16 pmbase = ACPI_PM1_BASE_ADDRESS;
struct acpi_table_header *header;
struct acpi_fadt *fadt;

fadt = ctx->current;
header = &fadt->header;

memset(fadt, '\0', sizeof(struct acpi_fadt));
memset((void *)fadt, 0, sizeof(struct acpi_fadt));

acpi_fill_header(header, "FACP");
header->length = sizeof(struct acpi_fadt);
header->revision = 4;

fadt->firmware_ctrl = (u32)ctx->facs;
fadt->dsdt = (u32)ctx->dsdt;
fadt->firmware_ctrl = (u32)facs;
fadt->dsdt = (u32)dsdt;
fadt->preferred_pm_profile = ACPI_PM_UNSPECIFIED;
fadt->sci_int = 9;
fadt->smi_cmd = 0;
Expand Down Expand Up @@ -74,9 +70,9 @@ static int quark_write_fadt(struct acpi_ctx *ctx,
fadt->reset_reg.addrh = 0;
fadt->reset_value = SYS_RST | RST_CPU | FULL_RST;

fadt->x_firmware_ctl_l = (u32)ctx->facs;
fadt->x_firmware_ctl_l = (u32)facs;
fadt->x_firmware_ctl_h = 0;
fadt->x_dsdt_l = (u32)ctx->dsdt;
fadt->x_dsdt_l = (u32)dsdt;
fadt->x_dsdt_h = 0;

fadt->x_pm1a_evt_blk.space_id = ACPI_ADDRESS_SPACE_IO;
Expand Down Expand Up @@ -136,14 +132,7 @@ static int quark_write_fadt(struct acpi_ctx *ctx,
fadt->x_gpe1_blk.addrh = 0x0;

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, "FACP", quark_write_fadt, 0);

int acpi_create_gnvs(struct acpi_global_nvs *gnvs)
{
Expand Down
25 changes: 8 additions & 17 deletions arch/x86/cpu/tangier/acpi.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,23 +16,19 @@
#include <asm/arch/iomap.h>
#include <dm/uclass-internal.h>

static int tangier_write_fadt(struct acpi_ctx *ctx,
const struct acpi_writer *entry)
void acpi_create_fadt(struct acpi_fadt *fadt, struct acpi_facs *facs,
void *dsdt)
{
struct acpi_table_header *header;
struct acpi_fadt *fadt;
struct acpi_table_header *header = &(fadt->header);

fadt = ctx->current;
header = &fadt->header;

memset(fadt, '\0', sizeof(struct acpi_fadt));
memset((void *)fadt, 0, sizeof(struct acpi_fadt));

acpi_fill_header(header, "FACP");
header->length = sizeof(struct acpi_fadt);
header->revision = 6;

fadt->firmware_ctrl = (u32)ctx->facs;
fadt->dsdt = (u32)ctx->dsdt;
fadt->firmware_ctrl = (u32)facs;
fadt->dsdt = (u32)dsdt;
fadt->preferred_pm_profile = ACPI_PM_UNSPECIFIED;

fadt->iapc_boot_arch = ACPI_FADT_VGA_NOT_PRESENT |
Expand All @@ -45,18 +41,13 @@ static int tangier_write_fadt(struct acpi_ctx *ctx,

fadt->minor_revision = 2;

fadt->x_firmware_ctl_l = (u32)ctx->facs;
fadt->x_firmware_ctl_l = (u32)facs;
fadt->x_firmware_ctl_h = 0;
fadt->x_dsdt_l = (u32)ctx->dsdt;
fadt->x_dsdt_l = (u32)dsdt;
fadt->x_dsdt_h = 0;

header->checksum = table_compute_checksum(fadt, header->length);

acpi_inc(ctx, sizeof(struct acpi_fadt));

return 0;
}
ACPI_WRITER(5fadt, "FACP", tangier_write_fadt, 0);

u32 acpi_fill_madt(u32 current)
{
Expand Down
2 changes: 2 additions & 0 deletions arch/x86/include/asm/acpi_table.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ struct acpi_table_header;

/* These can be used by the target port */

void acpi_create_fadt(struct acpi_fadt *fadt, struct acpi_facs *facs,
void *dsdt);
int acpi_create_madt_lapics(u32 current);
int acpi_create_madt_ioapic(struct acpi_madt_ioapic *ioapic, u8 id,
u32 addr, u32 gsi_base);
Expand Down
15 changes: 15 additions & 0 deletions arch/x86/lib/acpi_table.c
Original file line number Diff line number Diff line change
Expand Up @@ -458,6 +458,21 @@ int acpi_write_gnvs(struct acpi_ctx *ctx, const struct acpi_writer *entry)
}
ACPI_WRITER(4gnvs, "GNVS", acpi_write_gnvs, 0);

static int acpi_write_fadt(struct acpi_ctx *ctx,
const struct acpi_writer *entry)
{
struct acpi_fadt *fadt;

fadt = ctx->current;
acpi_create_fadt(fadt, ctx->facs, ctx->dsdt);
acpi_add_table(ctx, fadt);

acpi_inc(ctx, sizeof(struct acpi_fadt));

return 0;
}
ACPI_WRITER(5fact, "FADT", acpi_write_fadt, 0);

/**
* acpi_write_hpet() - Write out a HPET table
*
Expand Down

0 comments on commit ce1cbf1

Please sign in to comment.