Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit c8e008e2 authored by Rafael J. Wysocki's avatar Rafael J. Wysocki
Browse files

Merge branches 'acpica' and 'acpi-scan'

* acpica:
  ACPI / osl: Remove deprecated acpi_get_table_with_size()/early_acpi_os_unmap_memory()
  ACPI / osl: Remove acpi_get_table_with_size()/early_acpi_os_unmap_memory() users
  ACPICA: Tables: Allow FADT to be customized with virtual address
  ACPICA: Tables: Back port acpi_get_table_with_size() and early_acpi_os_unmap_memory() from Linux kernel

* acpi-scan:
  ACPI: do not warn if _BQC does not exist
Loading
Loading
Loading
Loading
+1 −1
Original line number Original line Diff line number Diff line
@@ -29,7 +29,7 @@


/* Basic configuration for ACPI */
/* Basic configuration for ACPI */
#ifdef	CONFIG_ACPI
#ifdef	CONFIG_ACPI
/* ACPI table mapping after acpi_gbl_permanent_mmap is set */
/* ACPI table mapping after acpi_permanent_mmap is set */
static inline void __iomem *acpi_os_ioremap(acpi_physical_address phys,
static inline void __iomem *acpi_os_ioremap(acpi_physical_address phys,
					    acpi_size size)
					    acpi_size size)
{
{
+3 −4
Original line number Original line Diff line number Diff line
@@ -132,14 +132,13 @@ static int __init acpi_fadt_sanity_check(void)
	struct acpi_table_header *table;
	struct acpi_table_header *table;
	struct acpi_table_fadt *fadt;
	struct acpi_table_fadt *fadt;
	acpi_status status;
	acpi_status status;
	acpi_size tbl_size;
	int ret = 0;
	int ret = 0;


	/*
	/*
	 * FADT is required on arm64; retrieve it to check its presence
	 * FADT is required on arm64; retrieve it to check its presence
	 * and carry out revision and ACPI HW reduced compliancy tests
	 * and carry out revision and ACPI HW reduced compliancy tests
	 */
	 */
	status = acpi_get_table_with_size(ACPI_SIG_FADT, 0, &table, &tbl_size);
	status = acpi_get_table(ACPI_SIG_FADT, 0, &table);
	if (ACPI_FAILURE(status)) {
	if (ACPI_FAILURE(status)) {
		const char *msg = acpi_format_exception(status);
		const char *msg = acpi_format_exception(status);


@@ -170,10 +169,10 @@ static int __init acpi_fadt_sanity_check(void)


out:
out:
	/*
	/*
	 * acpi_get_table_with_size() creates FADT table mapping that
	 * acpi_get_table() creates FADT table mapping that
	 * should be released after parsing and before resuming boot
	 * should be released after parsing and before resuming boot
	 */
	 */
	early_acpi_os_unmap_memory(table, tbl_size);
	acpi_put_table(table);
	return ret;
	return ret;
}
}


+6 −0
Original line number Original line Diff line number Diff line
@@ -166,6 +166,12 @@ acpi_tb_install_table_with_override(struct acpi_table_desc *new_table_desc,


acpi_status acpi_tb_parse_root_table(acpi_physical_address rsdp_address);
acpi_status acpi_tb_parse_root_table(acpi_physical_address rsdp_address);


acpi_status
acpi_tb_get_table(struct acpi_table_desc *table_desc,
		  struct acpi_table_header **out_table);

void acpi_tb_put_table(struct acpi_table_desc *table_desc);

/*
/*
 * tbxfload
 * tbxfload
 */
 */
+7 −7
Original line number Original line Diff line number Diff line
@@ -311,6 +311,8 @@ void acpi_tb_parse_fadt(void)
{
{
	u32 length;
	u32 length;
	struct acpi_table_header *table;
	struct acpi_table_header *table;
	struct acpi_table_desc *fadt_desc;
	acpi_status status;


	/*
	/*
	 * The FADT has multiple versions with different lengths,
	 * The FADT has multiple versions with different lengths,
@@ -319,14 +321,12 @@ void acpi_tb_parse_fadt(void)
	 * Get a local copy of the FADT and convert it to a common format
	 * Get a local copy of the FADT and convert it to a common format
	 * Map entire FADT, assumed to be smaller than one page.
	 * Map entire FADT, assumed to be smaller than one page.
	 */
	 */
	length = acpi_gbl_root_table_list.tables[acpi_gbl_fadt_index].length;
	fadt_desc = &acpi_gbl_root_table_list.tables[acpi_gbl_fadt_index];

	status = acpi_tb_get_table(fadt_desc, &table);
	table =
	if (ACPI_FAILURE(status)) {
	    acpi_os_map_memory(acpi_gbl_root_table_list.
			       tables[acpi_gbl_fadt_index].address, length);
	if (!table) {
		return;
		return;
	}
	}
	length = fadt_desc->length;


	/*
	/*
	 * Validate the FADT checksum before we copy the table. Ignore
	 * Validate the FADT checksum before we copy the table. Ignore
@@ -340,7 +340,7 @@ void acpi_tb_parse_fadt(void)


	/* All done with the real FADT, unmap it */
	/* All done with the real FADT, unmap it */


	acpi_os_unmap_memory(table, length);
	acpi_tb_put_table(fadt_desc);


	/* Obtain the DSDT and FACS tables via their addresses within the FADT */
	/* Obtain the DSDT and FACS tables via their addresses within the FADT */


+85 −0
Original line number Original line Diff line number Diff line
@@ -381,3 +381,88 @@ acpi_tb_parse_root_table(acpi_physical_address rsdp_address)
	acpi_os_unmap_memory(table, length);
	acpi_os_unmap_memory(table, length);
	return_ACPI_STATUS(AE_OK);
	return_ACPI_STATUS(AE_OK);
}
}

/*******************************************************************************
 *
 * FUNCTION:    acpi_tb_get_table
 *
 * PARAMETERS:  table_desc          - Table descriptor
 *              out_table           - Where the pointer to the table is returned
 *
 * RETURN:      Status and pointer to the requested table
 *
 * DESCRIPTION: Increase a reference to a table descriptor and return the
 *              validated table pointer.
 *              If the table descriptor is an entry of the root table list,
 *              this API must be invoked with ACPI_MTX_TABLES acquired.
 *
 ******************************************************************************/

acpi_status
acpi_tb_get_table(struct acpi_table_desc *table_desc,
		  struct acpi_table_header **out_table)
{
	acpi_status status;

	ACPI_FUNCTION_TRACE(acpi_tb_get_table);

	if (table_desc->validation_count == 0) {

		/* Table need to be "VALIDATED" */

		status = acpi_tb_validate_table(table_desc);
		if (ACPI_FAILURE(status)) {
			return_ACPI_STATUS(status);
		}
	}

	table_desc->validation_count++;
	if (table_desc->validation_count == 0) {
		ACPI_ERROR((AE_INFO,
			    "Table %p, Validation count is zero after increment\n",
			    table_desc));
		table_desc->validation_count--;
		return_ACPI_STATUS(AE_LIMIT);
	}

	*out_table = table_desc->pointer;
	return_ACPI_STATUS(AE_OK);
}

/*******************************************************************************
 *
 * FUNCTION:    acpi_tb_put_table
 *
 * PARAMETERS:  table_desc          - Table descriptor
 *
 * RETURN:      None
 *
 * DESCRIPTION: Decrease a reference to a table descriptor and release the
 *              validated table pointer if no references.
 *              If the table descriptor is an entry of the root table list,
 *              this API must be invoked with ACPI_MTX_TABLES acquired.
 *
 ******************************************************************************/

void acpi_tb_put_table(struct acpi_table_desc *table_desc)
{

	ACPI_FUNCTION_TRACE(acpi_tb_put_table);

	if (table_desc->validation_count == 0) {
		ACPI_WARNING((AE_INFO,
			      "Table %p, Validation count is zero before decrement\n",
			      table_desc));
		return_VOID;
	}
	table_desc->validation_count--;

	if (table_desc->validation_count == 0) {

		/* Table need to be "INVALIDATED" */

		acpi_tb_invalidate_table(table_desc);
	}

	return_VOID;
}
Loading