Linux CXL
 help / color / mirror / Atom feed
From: Dave Jiang <dave.jiang@intel.com>
To: Jonathan Cameron <Jonathan.Cameron@Huawei.com>
Cc: <linux-acpi@vger.kernel.org>, <linux-cxl@vger.kernel.org>,
	"Rafael J. Wysocki" <rafael@kernel.org>, <lenb@kernel.org>,
	<dan.j.williams@intel.com>, <ira.weiny@intel.com>,
	<vishal.l.verma@intel.com>, <alison.schofield@intel.com>,
	<lukas@wunner.de>
Subject: Re: [PATCH v3 1/4] acpi: Move common tables helper functions to common lib
Date: Mon, 12 Jun 2023 13:47:55 -0700	[thread overview]
Message-ID: <c90132d1-e8f0-95c8-3b16-407ce9c505da@intel.com> (raw)
In-Reply-To: <20230602133504.00001c69@Huawei.com>


On 6/2/23 05:35, Jonathan Cameron wrote:
> On Thu, 01 Jun 2023 14:31:52 -0700
> Dave Jiang <dave.jiang@intel.com> wrote:
>
>> Some of the routines in ACPI driver/acpi/tables.c can be shared with
>> parsing CDAT. CDAT is a device-provided data structure that is formatted
>> similar to a platform provided ACPI table. CDAT is used by CXL and can
>> exist on platforms that do not use ACPI. Split out the common routine
>> from ACPI to accommodate platforms that do not support ACPI and move that
>> to /lib. The common routines can be built outside of ACPI if
>> FIRMWARE_TABLES is selected.
>>
>> Link: https://lore.kernel.org/linux-cxl/CAJZ5v0jipbtTNnsA0-o5ozOk8ZgWnOg34m34a9pPenTyRLj=6A@mail.gmail.com/
>> Suggested-by: Rafael J. Wysocki <rafael@kernel.org>
>> Signed-off-by: Dave Jiang <dave.jiang@intel.com>
> Minor comment to fix inline. With that tidied up
>
> Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
>
>> diff --git a/include/linux/fw_table.h b/include/linux/fw_table.h
>> new file mode 100644
>> index 000000000000..ff8fa58d5818
>> --- /dev/null
>> +++ b/include/linux/fw_table.h
>> @@ -0,0 +1,43 @@
>> +/* SPDX-License-Identifier: GPL-2.0-or-later */
>> +/*
>> + *  fw_tables.h - Parsing support for ACPI and ACPI-like tables provided by
>> + *                platform or device firmware
>> + *
>> + *  Copyright (C) 2001 Paul Diefenbaugh <paul.s.diefenbaugh@intel.com>
>> + *  Copyright (C) 2023 Intel Corp.
>> + */
>> +#ifndef _FW_TABLE_H_
>> +#define _FW_TABLE_H_
>> +
>> +union acpi_subtable_headers;
>> +
>> +typedef int (*acpi_tbl_entry_handler)(union acpi_subtable_headers *header,
>> +				      const unsigned long end);
>> +
>> +typedef int (*acpi_tbl_entry_handler_arg)(union acpi_subtable_headers *header,
>> +					  void *arg, const unsigned long end);
>> +
>> +struct acpi_subtable_proc {
>> +	int id;
>> +	acpi_tbl_entry_handler handler;
>> +	acpi_tbl_entry_handler_arg handler_arg;
>> +	void *arg;
>> +	int count;
>> +};
>> +
>> +#include <linux/acpi.h>
>> +#include <acpi/acpi.h>
> Includes mid way down the files is not a common pattern and I can't see why
> it's particularly useful to do so here.
>
> + linux/acpi.h includes acpi/acpi.h and I can't see that changing any time
> soon...

Unfortunately because linux/acpi.h needs defines from this header file, 
and this header file needs ACPI table definitions from acpi/acpi.h, and 
acpi/acpi.h can't be included independently without linux/acpi.h, this 
seems to be the only way to get everything to build w/o complaints from 
the compiler. This header really just needs some ACPI table struct 
definitions but there's no easy way to just include those.  Also having 
the headers in the beginning causes compiler errors. It's ugly but seems 
to be the way things will build cleanly.


>> +
>> +union acpi_subtable_headers {
>> +	struct acpi_subtable_header common;
>> +	struct acpi_hmat_structure hmat;
>> +	struct acpi_prmt_module_header prmt;
>> +	struct acpi_cedt_header cedt;
>> +};
>> +
>> +int acpi_parse_entries_array(char *id, unsigned long table_size,
>> +			     struct acpi_table_header *table_header,
>> +			     struct acpi_subtable_proc *proc,
>> +			     int proc_num, unsigned int max_entries);
>> +
>> +#endif
>

  reply	other threads:[~2023-06-12 20:53 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-01 21:31 [PATCH v3 0/4] acpi: Add CDAT parsing support to ACPI tables code Dave Jiang
2023-06-01 21:31 ` [PATCH v3 1/4] acpi: Move common tables helper functions to common lib Dave Jiang
2023-06-02 12:35   ` Jonathan Cameron
2023-06-12 20:47     ` Dave Jiang [this message]
2023-06-01 21:31 ` [PATCH v3 2/4] lib/firmware_table: tables: Add CDAT table parsing support Dave Jiang
2023-06-02 12:36   ` Jonathan Cameron
2023-06-01 21:32 ` [PATCH v3 3/4] acpi: fix misnamed define for CDAT DSMAS Dave Jiang
2023-06-02 12:38   ` Jonathan Cameron
2023-06-01 21:32 ` [PATCH v3 4/4] acpi: Add defines for CDAT SSLBIS Dave Jiang
2023-06-02 12:38   ` Jonathan Cameron
2023-06-04 16:09 ` [PATCH v3 0/4] acpi: Add CDAT parsing support to ACPI tables code Rafael J. Wysocki
2023-06-12 20:16   ` Dave Jiang
2023-06-06  1:36 ` Hanjun Guo
2023-06-12 20:17   ` Dave Jiang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=c90132d1-e8f0-95c8-3b16-407ce9c505da@intel.com \
    --to=dave.jiang@intel.com \
    --cc=Jonathan.Cameron@Huawei.com \
    --cc=alison.schofield@intel.com \
    --cc=dan.j.williams@intel.com \
    --cc=ira.weiny@intel.com \
    --cc=lenb@kernel.org \
    --cc=linux-acpi@vger.kernel.org \
    --cc=linux-cxl@vger.kernel.org \
    --cc=lukas@wunner.de \
    --cc=rafael@kernel.org \
    --cc=vishal.l.verma@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox