Skip to content

Commit

Permalink
Merge branches 'acpi-tables' and 'acpi-scan'
Browse files Browse the repository at this point in the history
* acpi-tables:
  ACPI: tables: x86: Reserve memory occupied by ACPI tables

* acpi-scan:
  ACPI: scan: Fix _STA getting called on devices with unmet dependencies
  • Loading branch information
rafaeljw committed Apr 2, 2021
3 parents 8cdddd1 + 1a1c130 + 3e75942 commit 91463eb
Show file tree
Hide file tree
Showing 5 changed files with 73 additions and 23 deletions.
25 changes: 12 additions & 13 deletions arch/x86/kernel/acpi/boot.c
Original file line number Diff line number Diff line change
Expand Up @@ -1554,10 +1554,18 @@ void __init acpi_boot_table_init(void)
/*
* Initialize the ACPI boot-time table parser.
*/
if (acpi_table_init()) {
if (acpi_locate_initial_tables())
disable_acpi();
return;
}
else
acpi_reserve_initial_tables();
}

int __init early_acpi_boot_init(void)
{
if (acpi_disabled)
return 1;

acpi_table_init_complete();

acpi_table_parse(ACPI_SIG_BOOT, acpi_parse_sbf);

Expand All @@ -1570,18 +1578,9 @@ void __init acpi_boot_table_init(void)
} else {
printk(KERN_WARNING PREFIX "Disabling ACPI support\n");
disable_acpi();
return;
return 1;
}
}
}

int __init early_acpi_boot_init(void)
{
/*
* If acpi_disabled, bail out
*/
if (acpi_disabled)
return 1;

/*
* Process the Multiple APIC Description Table (MADT), if present
Expand Down
8 changes: 3 additions & 5 deletions arch/x86/kernel/setup.c
Original file line number Diff line number Diff line change
Expand Up @@ -1045,6 +1045,9 @@ void __init setup_arch(char **cmdline_p)

cleanup_highmap();

/* Look for ACPI tables and reserve memory occupied by them. */
acpi_boot_table_init();

memblock_set_current_limit(ISA_END_ADDRESS);
e820__memblock_setup();

Expand Down Expand Up @@ -1136,11 +1139,6 @@ void __init setup_arch(char **cmdline_p)

early_platform_quirks();

/*
* Parse the ACPI tables for possible boot-time SMP configuration.
*/
acpi_boot_table_init();

early_acpi_boot_init();

initmem_init();
Expand Down
12 changes: 11 additions & 1 deletion drivers/acpi/scan.c
Original file line number Diff line number Diff line change
Expand Up @@ -1670,6 +1670,8 @@ void acpi_init_device_object(struct acpi_device *device, acpi_handle handle,
device_initialize(&device->dev);
dev_set_uevent_suppress(&device->dev, true);
acpi_init_coherency(device);
/* Assume there are unmet deps to start with. */
device->dep_unmet = 1;
}

void acpi_device_add_finalize(struct acpi_device *device)
Expand Down Expand Up @@ -1933,6 +1935,8 @@ static void acpi_scan_dep_init(struct acpi_device *adev)
{
struct acpi_dep_data *dep;

adev->dep_unmet = 0;

mutex_lock(&acpi_dep_list_lock);

list_for_each_entry(dep, &acpi_dep_list, node) {
Expand Down Expand Up @@ -1980,7 +1984,13 @@ static acpi_status acpi_bus_check_add(acpi_handle handle, bool check_dep,
return AE_CTRL_DEPTH;

acpi_scan_init_hotplug(device);
if (!check_dep)
/*
* If check_dep is true at this point, the device has no dependencies,
* or the creation of the device object would have been postponed above.
*/
if (check_dep)
device->dep_unmet = 0;
else
acpi_scan_dep_init(device);

out:
Expand Down
42 changes: 39 additions & 3 deletions drivers/acpi/tables.c
Original file line number Diff line number Diff line change
Expand Up @@ -780,15 +780,15 @@ acpi_status acpi_os_table_override(struct acpi_table_header *existing_table,
}

/*
* acpi_table_init()
* acpi_locate_initial_tables()
*
* find RSDP, find and checksum SDT/XSDT.
* checksum all tables, print SDT/XSDT
*
* result: sdt_entry[] is initialized
*/

int __init acpi_table_init(void)
int __init acpi_locate_initial_tables(void)
{
acpi_status status;

Expand All @@ -803,9 +803,45 @@ int __init acpi_table_init(void)
status = acpi_initialize_tables(initial_tables, ACPI_MAX_TABLES, 0);
if (ACPI_FAILURE(status))
return -EINVAL;
acpi_table_initrd_scan();

return 0;
}

void __init acpi_reserve_initial_tables(void)
{
int i;

for (i = 0; i < ACPI_MAX_TABLES; i++) {
struct acpi_table_desc *table_desc = &initial_tables[i];
u64 start = table_desc->address;
u64 size = table_desc->length;

if (!start || !size)
break;

pr_info("Reserving %4s table memory at [mem 0x%llx-0x%llx]\n",
table_desc->signature.ascii, start, start + size - 1);

memblock_reserve(start, size);
}
}

void __init acpi_table_init_complete(void)
{
acpi_table_initrd_scan();
check_multiple_madt();
}

int __init acpi_table_init(void)
{
int ret;

ret = acpi_locate_initial_tables();
if (ret)
return ret;

acpi_table_init_complete();

return 0;
}

Expand Down
9 changes: 8 additions & 1 deletion include/linux/acpi.h
Original file line number Diff line number Diff line change
Expand Up @@ -222,10 +222,14 @@ void __iomem *__acpi_map_table(unsigned long phys, unsigned long size);
void __acpi_unmap_table(void __iomem *map, unsigned long size);
int early_acpi_boot_init(void);
int acpi_boot_init (void);
void acpi_boot_table_prepare (void);
void acpi_boot_table_init (void);
int acpi_mps_check (void);
int acpi_numa_init (void);

int acpi_locate_initial_tables (void);
void acpi_reserve_initial_tables (void);
void acpi_table_init_complete (void);
int acpi_table_init (void);
int acpi_table_parse(char *id, acpi_tbl_table_handler handler);
int __init acpi_table_parse_entries(char *id, unsigned long table_size,
Expand Down Expand Up @@ -814,9 +818,12 @@ static inline int acpi_boot_init(void)
return 0;
}

static inline void acpi_boot_table_prepare(void)
{
}

static inline void acpi_boot_table_init(void)
{
return;
}

static inline int acpi_mps_check(void)
Expand Down

0 comments on commit 91463eb

Please sign in to comment.