aboutsummaryrefslogtreecommitdiff
path: root/src/soc/intel/braswell/acpi.c
diff options
context:
space:
mode:
authorAngel Pons <th3fanbus@gmail.com>2020-03-19 00:31:58 +0100
committerPatrick Georgi <pgeorgi@google.com>2020-03-23 09:42:39 +0000
commitaee7ab2f6e69b70414f8225cb7a83c3e4cb62d9a (patch)
tree73a8668b87d5e495041b67f5f799e40386230bab /src/soc/intel/braswell/acpi.c
parent140a4ae7bf2960ac7d095ba94847093f4755bf04 (diff)
soc/intel/braswell: Clean up
Tested with BUILD_TIMELESS=1, Facebook FBG1701 remains unaffected. Change-Id: I784a5ddc1a8dcbfb960ce970b28b850244a47773 Signed-off-by: Angel Pons <th3fanbus@gmail.com> Reviewed-on: https://review.coreboot.org/c/coreboot/+/39663 Reviewed-by: Matt DeVillier <matt.devillier@gmail.com> Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Diffstat (limited to 'src/soc/intel/braswell/acpi.c')
-rw-r--r--src/soc/intel/braswell/acpi.c57
1 files changed, 26 insertions, 31 deletions
diff --git a/src/soc/intel/braswell/acpi.c b/src/soc/intel/braswell/acpi.c
index 413b9972d4..765be82c40 100644
--- a/src/soc/intel/braswell/acpi.c
+++ b/src/soc/intel/braswell/acpi.c
@@ -250,13 +250,13 @@ void acpi_fill_in_fadt(acpi_fadt_t *fadt)
static acpi_tstate_t soc_tss_table[] = {
{ 100, 1000, 0, 0x00, 0 },
- { 88, 875, 0, 0x1e, 0 },
- { 75, 750, 0, 0x1c, 0 },
- { 63, 625, 0, 0x1a, 0 },
- { 50, 500, 0, 0x18, 0 },
- { 38, 375, 0, 0x16, 0 },
- { 25, 250, 0, 0x14, 0 },
- { 13, 125, 0, 0x12, 0 },
+ { 88, 875, 0, 0x1e, 0 },
+ { 75, 750, 0, 0x1c, 0 },
+ { 63, 625, 0, 0x1a, 0 },
+ { 50, 500, 0, 0x18, 0 },
+ { 38, 375, 0, 0x16, 0 },
+ { 25, 250, 0, 0x14, 0 },
+ { 13, 125, 0, 0x12, 0 },
};
static void generate_t_state_entries(int core, int cores_per_package)
@@ -271,24 +271,23 @@ static void generate_t_state_entries(int core, int cores_per_package)
acpigen_write_TPC("\\TLVL");
/* Write TSS table for MSR access */
- acpigen_write_TSS_package(
- ARRAY_SIZE(soc_tss_table), soc_tss_table);
+ acpigen_write_TSS_package(ARRAY_SIZE(soc_tss_table), soc_tss_table);
}
static int calculate_power(int tdp, int p1_ratio, int ratio)
{
- u32 m;
- u32 power;
+ u32 m, power;
/*
* M = ((1.1 - ((p1_ratio - ratio) * 0.00625)) / 1.1) ^ 2
- *
- * Power = (ratio / p1_ratio) * m * tdp
*/
m = (110000 - ((p1_ratio - ratio) * 625)) / 11;
m = (m * m) / 1000;
+ /*
+ * Power = (ratio / p1_ratio) * m * TDP
+ */
power = ((ratio * 100000 / p1_ratio) / 100);
power *= (m / 100) * (tdp / 1000);
power /= 1000;
@@ -387,8 +386,8 @@ static void generate_p_state_entries(int core, int cores_per_package)
ratio >= ratio_min; ratio -= ratio_step) {
/* Calculate VID for this ratio */
- vid = ((ratio - ratio_min) * vid_range_2) /
- ratio_range_2 + vid_min;
+ vid = ((ratio - ratio_min) * vid_range_2) / ratio_range_2 + vid_min;
+
/* Round up if remainder */
if (((ratio - ratio_min) * vid_range_2) % ratio_range_2)
vid++;
@@ -424,20 +423,16 @@ void generate_cpu_entries(struct device *device)
}
/* Generate processor \_PR.CPUx */
- acpigen_write_processor(
- core, pcontrol_blk, plen);
+ acpigen_write_processor(core, pcontrol_blk, plen);
/* Generate P-state tables */
- generate_p_state_entries(
- core, pattrs->num_cpus);
+ generate_p_state_entries(core, pattrs->num_cpus);
/* Generate C-state tables */
- acpigen_write_CST_package(
- cstate_map, ARRAY_SIZE(cstate_map));
+ acpigen_write_CST_package(cstate_map, ARRAY_SIZE(cstate_map));
/* Generate T-state tables */
- generate_t_state_entries(
- core, pattrs->num_cpus);
+ generate_t_state_entries(core, pattrs->num_cpus);
acpigen_pop_len();
}
@@ -466,8 +461,7 @@ unsigned long acpi_madt_irq_overrides(unsigned long current)
sci_flags |= MP_IRQ_POLARITY_HIGH;
irqovr = (void *)current;
- current += acpi_create_madt_irqoverride(irqovr, 0, sci_irq, sci_irq,
- sci_flags);
+ current += acpi_create_madt_irqoverride(irqovr, 0, sci_irq, sci_irq, sci_flags);
return current;
}
@@ -480,8 +474,7 @@ static int update_igd_opregion(igd_opregion_t *opregion)
return 0;
}
-unsigned long southcluster_write_acpi_tables(struct device *device,
- unsigned long current,
+unsigned long southcluster_write_acpi_tables(struct device *device, unsigned long current,
struct acpi_rsdp *rsdp)
{
acpi_header_t *ssdt2;
@@ -511,9 +504,9 @@ unsigned long southcluster_write_acpi_tables(struct device *device,
if (ssdt2->length) {
current += ssdt2->length;
acpi_add_table(rsdp, ssdt2);
- printk(BIOS_DEBUG, "ACPI: * SSDT2 @ %p Length %x\n", ssdt2,
- ssdt2->length);
+ printk(BIOS_DEBUG, "ACPI: * SSDT2 @ %p Length %x\n", ssdt2, ssdt2->length);
current = acpi_align_current(current);
+
} else {
ssdt2 = NULL;
printk(BIOS_DEBUG, "ACPI: * SSDT2 not generated.\n");
@@ -537,15 +530,17 @@ void southcluster_inject_dsdt(struct device *device)
if (gnvs) {
acpi_create_gnvs(gnvs);
- /* Fill in the Wifi Region id */
+
+ /* Fill in the Wi-Fi Region ID */
if (CONFIG(HAVE_REGULATORY_DOMAIN))
gnvs->cid1 = wifi_regulatory_domain();
else
gnvs->cid1 = WRDD_DEFAULT_REGULATORY_DOMAIN;
+
/* And tell SMI about it */
smm_setup_structures(gnvs, NULL, NULL);
- /* Add it to DSDT. */
+ /* Add it to DSDT */
acpigen_write_scope("\\");
acpigen_write_name_dword("NVSA", (u32) gnvs);
acpigen_pop_len();