HAOUAS Elyes has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/43009 )
Change subject: src/acpi/acpi.c: Convert to 96 characters line length ......................................................................
src/acpi/acpi.c: Convert to 96 characters line length
Change-Id: I8ea21ba3b36f90dc9ea0eca5de0bd9f964d47957 Signed-off-by: Elyes HAOUAS ehaouas@noos.fr --- M src/acpi/acpi.c 1 file changed, 64 insertions(+), 103 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/09/43009/1
diff --git a/src/acpi/acpi.c b/src/acpi/acpi.c index 781e398..ae8ee9f 100644 --- a/src/acpi/acpi.c +++ b/src/acpi/acpi.c @@ -1,4 +1,5 @@ /* SPDX-License-Identifier: GPL-2.0-only */ + /* * coreboot ACPI Table support */ @@ -9,8 +10,7 @@ * write_acpi_tables() * acpi_dump_apics() * - * See Kontron 986LCD-M port for a good example of an ACPI implementation - * in coreboot. + * See Kontron 986LCD-M port for a good example of an ACPI implementation in coreboot. */
#include <console/console.h> @@ -39,8 +39,7 @@ }
/** - * Add an ACPI table to the RSDT (and XSDT) structure, recalculate length - * and checksum. + * Add an ACPI table to the RSDT (and XSDT) structure, recalculate length and checksum. */ void acpi_add_table(acpi_rsdp_t *rsdp, void *table) { @@ -64,8 +63,7 @@ }
if (i >= entries_num) { - printk(BIOS_ERR, "ACPI: Error: Could not add ACPI table, " - "too many tables.\n"); + printk(BIOS_ERR, "ACPI: Error: Could not add ACPI table, too many tables.\n"); return; }
@@ -88,21 +86,19 @@ xsdt->entry[i] = (u64)(uintptr_t)table;
/* Fix XSDT length. */ - xsdt->header.length = sizeof(acpi_header_t) + - (sizeof(u64) * (i + 1)); + xsdt->header.length = sizeof(acpi_header_t) + (sizeof(u64) * (i + 1));
/* Re-calculate checksum. */ xsdt->header.checksum = 0; - xsdt->header.checksum = acpi_checksum((u8 *)xsdt, - xsdt->header.length); + xsdt->header.checksum = acpi_checksum((u8 *)xsdt, xsdt->header.length); }
printk(BIOS_DEBUG, "ACPI: added table %d/%d, length now %d\n", i + 1, entries_num, rsdt->header.length); }
-int acpi_create_mcfg_mmconfig(acpi_mcfg_mmconfig_t *mmconfig, u32 base, - u16 seg_nr, u8 start, u8 end) +int acpi_create_mcfg_mmconfig(acpi_mcfg_mmconfig_t *mmconfig, u32 base, u16 seg_nr, u8 start, + u8 end) { memset(mmconfig, 0, sizeof(*mmconfig)); mmconfig->base_address = base; @@ -144,7 +140,7 @@
for (cpu = all_devices; cpu; cpu = cpu->next) { if ((cpu->path.type != DEVICE_PATH_APIC) || - (cpu->bus->dev->path.type != DEVICE_PATH_CPU_CLUSTER)) { + (cpu->bus->dev->path.type != DEVICE_PATH_CPU_CLUSTER)) { continue; } if (!cpu->enabled) @@ -167,8 +163,7 @@ return current; }
-int acpi_create_madt_ioapic(acpi_madt_ioapic_t *ioapic, u8 id, u32 addr, - u32 gsi_base) +int acpi_create_madt_ioapic(acpi_madt_ioapic_t *ioapic, u8 id, u32 addr, u32 gsi_base) { ioapic->type = IO_APIC; /* I/O APIC structure */ ioapic->length = sizeof(acpi_madt_ioapic_t); @@ -180,8 +175,8 @@ return ioapic->length; }
-int acpi_create_madt_irqoverride(acpi_madt_irqoverride_t *irqoverride, - u8 bus, u8 source, u32 gsirq, u16 flags) +int acpi_create_madt_irqoverride(acpi_madt_irqoverride_t *irqoverride, u8 bus, u8 source, + u32 gsirq, u16 flags) { irqoverride->type = IRQ_SOURCE_OVERRIDE; /* Interrupt source override */ irqoverride->length = sizeof(acpi_madt_irqoverride_t); @@ -193,8 +188,7 @@ return irqoverride->length; }
-int acpi_create_madt_lapic_nmi(acpi_madt_lapic_nmi_t *lapic_nmi, u8 cpu, - u16 flags, u8 lint) +int acpi_create_madt_lapic_nmi(acpi_madt_lapic_nmi_t *lapic_nmi, u8 cpu, u16 flags, u8 lint) { lapic_nmi->type = LOCAL_APIC_NMI; /* Local APIC NMI structure */ lapic_nmi->length = sizeof(acpi_madt_lapic_nmi_t); @@ -205,8 +199,7 @@ return lapic_nmi->length; }
-int acpi_create_madt_lx2apic_nmi(acpi_madt_lx2apic_nmi_t *lapic_nmi, u32 cpu, - u16 flags, u8 lint) +int acpi_create_madt_lx2apic_nmi(acpi_madt_lx2apic_nmi_t *lapic_nmi, u32 cpu, u16 flags, u8 lint) { lapic_nmi->type = LOCAL_X2APIC_NMI; /* Local APIC NMI structure */ lapic_nmi->length = sizeof(acpi_madt_lx2apic_nmi_t); @@ -492,8 +485,7 @@ return lapic->length; }
-int acpi_create_srat_mem(acpi_srat_mem_t *mem, u8 node, u32 basek, u32 sizek, - u32 flags) +int acpi_create_srat_mem(acpi_srat_mem_t *mem, u8 node, u32 basek, u32 sizek, u32 flags) { mem->type = 1; /* Memory affinity structure */ mem->length = sizeof(acpi_srat_mem_t); @@ -508,8 +500,7 @@ }
/* http://www.microsoft.com/whdc/system/sysinternals/sratdwn.mspx */ -void acpi_create_srat(acpi_srat_t *srat, - unsigned long (*acpi_fill_srat)(unsigned long current)) +void acpi_create_srat(acpi_srat_t *srat, unsigned long (*acpi_fill_srat)(unsigned long current)) { acpi_header_t *header = &(srat->header); unsigned long current = (unsigned long)srat + sizeof(acpi_srat_t); @@ -569,8 +560,7 @@ header->checksum = acpi_checksum((void *)dmar, header->length); }
-unsigned long acpi_create_dmar_drhd(unsigned long current, u8 flags, - u16 segment, u64 bar) +unsigned long acpi_create_dmar_drhd(unsigned long current, u8 flags, u16 segment, u64 bar) { dmar_entry_t *drhd = (dmar_entry_t *)current; memset(drhd, 0, sizeof(*drhd)); @@ -583,8 +573,7 @@ return drhd->length; }
-unsigned long acpi_create_dmar_rmrr(unsigned long current, u16 segment, - u64 bar, u64 limit) +unsigned long acpi_create_dmar_rmrr(unsigned long current, u16 segment, u64 bar, u64 limit) { dmar_rmrr_entry_t *rmrr = (dmar_rmrr_entry_t *)current; memset(rmrr, 0, sizeof(*rmrr)); @@ -597,8 +586,7 @@ return rmrr->length; }
-unsigned long acpi_create_dmar_atsr(unsigned long current, u8 flags, - u16 segment) +unsigned long acpi_create_dmar_atsr(unsigned long current, u8 flags, u16 segment) { dmar_atsr_entry_t *atsr = (dmar_atsr_entry_t *)current; memset(atsr, 0, sizeof(*atsr)); @@ -610,8 +598,7 @@ return atsr->length; }
-unsigned long acpi_create_dmar_rhsa(unsigned long current, u64 base_addr, - u32 proximity_domain) +unsigned long acpi_create_dmar_rhsa(unsigned long current, u64 base_addr, u32 proximity_domain) { dmar_rhsa_entry_t *rhsa = (dmar_rhsa_entry_t *)current; memset(rhsa, 0, sizeof(*rhsa)); @@ -624,7 +611,7 @@ }
unsigned long acpi_create_dmar_andd(unsigned long current, u8 device_number, - const char *device_name) + const char *device_name) { dmar_andd_entry_t *andd = (dmar_andd_entry_t *)current; int andd_len = sizeof(dmar_andd_entry_t) + strlen(device_name) + 1; @@ -655,8 +642,8 @@ atsr->length = current - base; }
-static unsigned long acpi_create_dmar_ds(unsigned long current, - enum dev_scope_type type, u8 enumeration_id, u8 bus, u8 dev, u8 fn) +static unsigned long acpi_create_dmar_ds(unsigned long current, enum dev_scope_type type, + u8 enumeration_id, u8 bus, u8 dev, u8 fn) { /* we don't support longer paths yet */ const size_t dev_scope_length = sizeof(dev_scope_t) + 2; @@ -673,37 +660,30 @@ return ds->length; }
-unsigned long acpi_create_dmar_ds_pci_br(unsigned long current, u8 bus, - u8 dev, u8 fn) +unsigned long acpi_create_dmar_ds_pci_br(unsigned long current, u8 bus, u8 dev, u8 fn) { - return acpi_create_dmar_ds(current, - SCOPE_PCI_SUB, 0, bus, dev, fn); + return acpi_create_dmar_ds(current, SCOPE_PCI_SUB, 0, bus, dev, fn); }
-unsigned long acpi_create_dmar_ds_pci(unsigned long current, u8 bus, - u8 dev, u8 fn) +unsigned long acpi_create_dmar_ds_pci(unsigned long current, u8 bus, u8 dev, u8 fn) { - return acpi_create_dmar_ds(current, - SCOPE_PCI_ENDPOINT, 0, bus, dev, fn); + return acpi_create_dmar_ds(current, SCOPE_PCI_ENDPOINT, 0, bus, dev, fn); }
-unsigned long acpi_create_dmar_ds_ioapic(unsigned long current, - u8 enumeration_id, u8 bus, u8 dev, u8 fn) +unsigned long acpi_create_dmar_ds_ioapic(unsigned long current, u8 enumeration_id, u8 bus, + u8 dev, u8 fn) { - return acpi_create_dmar_ds(current, - SCOPE_IOAPIC, enumeration_id, bus, dev, fn); + return acpi_create_dmar_ds(current, SCOPE_IOAPIC, enumeration_id, bus, dev, fn); }
-unsigned long acpi_create_dmar_ds_msi_hpet(unsigned long current, - u8 enumeration_id, u8 bus, u8 dev, u8 fn) +unsigned long acpi_create_dmar_ds_msi_hpet(unsigned long current, u8 enumeration_id, u8 bus, + u8 dev, u8 fn) { - return acpi_create_dmar_ds(current, - SCOPE_MSI_HPET, enumeration_id, bus, dev, fn); + return acpi_create_dmar_ds(current, SCOPE_MSI_HPET, enumeration_id, bus, dev, fn); }
/* http://h21007.www2.hp.com/portal/download/files/unprot/Itanium/slit.pdf */ -void acpi_create_slit(acpi_slit_t *slit, - unsigned long (*acpi_fill_slit)(unsigned long current)) +void acpi_create_slit(acpi_slit_t *slit, unsigned long (*acpi_fill_slit)(unsigned long current)) { acpi_header_t *header = &(slit->header); unsigned long current = (unsigned long)slit + sizeof(acpi_slit_t); @@ -765,10 +745,9 @@ header->checksum = acpi_checksum((void *)hpet, sizeof(acpi_hpet_t)); }
-void acpi_create_vfct(const struct device *device, - acpi_vfct_t *vfct, - unsigned long (*acpi_fill_vfct)(const struct device *device, - acpi_vfct_t *vfct_struct, unsigned long current)) +void acpi_create_vfct(const struct device *device, acpi_vfct_t *vfct, + unsigned long (*acpi_fill_vfct)(const struct device *device, acpi_vfct_t *vfct_struct, + unsigned long current)) { acpi_header_t *header = &(vfct->header); unsigned long current = (unsigned long)vfct + sizeof(acpi_vfct_t); @@ -798,8 +777,7 @@ header->checksum = acpi_checksum((void *)vfct, header->length); }
-void acpi_create_ipmi(const struct device *device, - struct acpi_spmi *spmi, +void acpi_create_ipmi(const struct device *device, struct acpi_spmi *spmi, const u16 ipmi_revision, const acpi_addr_t *addr, const enum acpi_ipmi_interface_type type, @@ -879,7 +857,7 @@ }
unsigned long acpi_write_hpet(const struct device *device, unsigned long current, - acpi_rsdp_t *rsdp) + acpi_rsdp_t *rsdp) { acpi_hpet_t *hpet;
@@ -897,10 +875,8 @@ return current; }
-void acpi_create_dbg2(acpi_dbg2_header_t *dbg2, - int port_type, int port_subtype, - acpi_addr_t *address, uint32_t address_size, - const char *device_path) +void acpi_create_dbg2(acpi_dbg2_header_t *dbg2, int port_type, int port_subtype, + acpi_addr_t *address, uint32_t address_size, const char *device_path) { uintptr_t current; acpi_dbg2_device_t *device; @@ -984,8 +960,8 @@ } res = find_resource(dev, PCI_BASE_ADDRESS_0); if (!res) { - printk(BIOS_ERR, "%s: Unable to find resource for %s\n", - __func__, dev_path(dev)); + printk(BIOS_ERR, "%s: Unable to find resource for %s\n", __func__, + dev_path(dev)); return current; }
@@ -1003,11 +979,8 @@ address.addrh = (uint32_t)((res->base >> 32) & 0xffffffff); address.access_size = access_size;
- acpi_create_dbg2(dbg2, - ACPI_DBG2_PORT_SERIAL, - ACPI_DBG2_PORT_SERIAL_16550, - &address, res->size, - acpi_device_path(dev)); + acpi_create_dbg2(dbg2, ACPI_DBG2_PORT_SERIAL, ACPI_DBG2_PORT_SERIAL_16550, &address, + res->size, acpi_device_path(dev));
if (dbg2->header.length) { current += dbg2->header.length; @@ -1079,8 +1052,7 @@ header->checksum = acpi_checksum((void *)xsdt, sizeof(acpi_xsdt_t)); }
-static void acpi_write_rsdp(acpi_rsdp_t *rsdp, acpi_rsdt_t *rsdt, - acpi_xsdt_t *xsdt, char *oem_id) +static void acpi_write_rsdp(acpi_rsdp_t *rsdp, acpi_rsdt_t *rsdt, acpi_xsdt_t *xsdt, char *oem_id) { memset(rsdp, 0, sizeof(acpi_rsdp_t));
@@ -1109,8 +1081,8 @@ rsdp->ext_checksum = acpi_checksum((void *)rsdp, sizeof(acpi_rsdp_t)); }
-unsigned long acpi_create_hest_error_source(acpi_hest_t *hest, - acpi_hest_esd_t *esd, u16 type, void *data, u16 data_len) +unsigned long acpi_create_hest_error_source(acpi_hest_t *hest, acpi_hest_esd_t *esd, u16 type, + void *data, u16 data_len) { acpi_header_t *header = &(hest->header); acpi_hest_hen_t *hen; @@ -1170,8 +1142,7 @@ }
/* ACPI 4.0 */ -void acpi_write_hest(acpi_hest_t *hest, - unsigned long (*acpi_fill_hest)(acpi_hest_t *hest)) +void acpi_write_hest(acpi_hest_t *hest, unsigned long (*acpi_fill_hest)(acpi_hest_t *hest)) { acpi_header_t *header = &(hest->header);
@@ -1251,11 +1222,9 @@ /* should be 0 ACPI 3.0 */ fadt->reserved = 0;
- if (CONFIG(SYSTEM_TYPE_CONVERTIBLE) || - CONFIG(SYSTEM_TYPE_LAPTOP)) + if (CONFIG(SYSTEM_TYPE_CONVERTIBLE) || CONFIG(SYSTEM_TYPE_LAPTOP)) fadt->preferred_pm_profile = PM_MOBILE; - else if (CONFIG(SYSTEM_TYPE_DETACHABLE) || - CONFIG(SYSTEM_TYPE_TABLET)) + else if (CONFIG(SYSTEM_TYPE_DETACHABLE) || CONFIG(SYSTEM_TYPE_TABLET)) fadt->preferred_pm_profile = PM_TABLET; else fadt->preferred_pm_profile = PM_DESKTOP; @@ -1265,8 +1234,7 @@ soc_fill_fadt(fadt); mainboard_fill_fadt(fadt);
- header->checksum = - acpi_checksum((void *) fadt, header->length); + header->checksum = acpi_checksum((void *) fadt, header->length); }
unsigned long __weak fw_cfg_acpi_tables(unsigned long start) @@ -1346,26 +1314,23 @@ }
dsdt_file = cbfs_boot_map_with_leak( - CONFIG_CBFS_PREFIX "/dsdt.aml", - CBFS_TYPE_RAW, &dsdt_size); + CONFIG_CBFS_PREFIX "/dsdt.aml", CBFS_TYPE_RAW, &dsdt_size); if (!dsdt_file) { printk(BIOS_ERR, "No DSDT file, skipping ACPI tables\n"); return current; }
- if (dsdt_file->length > dsdt_size - || dsdt_file->length < sizeof(acpi_header_t) - || memcmp(dsdt_file->signature, "DSDT", 4) != 0) { + if (dsdt_file->length > dsdt_size || dsdt_file->length < sizeof(acpi_header_t) || + memcmp(dsdt_file->signature, "DSDT", 4) != 0) { printk(BIOS_ERR, "Invalid DSDT file, skipping ACPI tables\n"); return current; }
- slic_file = cbfs_boot_map_with_leak(CONFIG_CBFS_PREFIX "/slic", - CBFS_TYPE_RAW, &slic_size); - if (slic_file - && (slic_file->length > slic_size - || slic_file->length < sizeof(acpi_header_t) - || memcmp(slic_file->signature, "SLIC", 4) != 0)) { + slic_file = cbfs_boot_map_with_leak( + CONFIG_CBFS_PREFIX "/slic", CBFS_TYPE_RAW, &slic_size); + if (slic_file && + (slic_file->length > slic_size || slic_file->length < sizeof(acpi_header_t) || + memcmp(slic_file->signature, "SLIC", 4) != 0)) { slic_file = 0; }
@@ -1520,8 +1485,7 @@ return NULL; printk(BIOS_DEBUG, "Checksum 1 passed\n");
- if ((rsdp->revision > 1) && (acpi_checksum((void *)rsdp, - rsdp->length) != 0)) + if ((rsdp->revision > 1) && (acpi_checksum((void *)rsdp, rsdp->length) != 0)) return NULL; printk(BIOS_DEBUG, "Checksum 2 passed all OK\n");
@@ -1551,8 +1515,7 @@ }
if (rsdp == NULL) { - printk(BIOS_ALERT, - "No RSDP found, wake up from S3 not possible.\n"); + printk(BIOS_ALERT, "No RSDP found, wake up from S3 not possible.\n"); return NULL; }
@@ -1570,8 +1533,7 @@ }
if (fadt == NULL) { - printk(BIOS_ALERT, - "No FADT found, wake up from S3 not possible.\n"); + printk(BIOS_ALERT, "No FADT found, wake up from S3 not possible.\n"); return NULL; }
@@ -1579,8 +1541,7 @@ facs = (acpi_facs_t *)(uintptr_t)fadt->firmware_ctrl;
if (facs == NULL) { - printk(BIOS_ALERT, - "No FACS found, wake up from S3 not possible.\n"); + printk(BIOS_ALERT, "No FACS found, wake up from S3 not possible.\n"); return NULL; }