All of lore.kernel.org
 help / color / mirror / Atom feed
From: Hanjun Guo <hanjun.guo@linaro.org>
To: Timur Tabi <timur@codeaurora.org>, Lv Zheng <lv.zheng@intel.com>
Cc: "Rafael J. Wysocki" <rafael.j.wysocki@intel.com>,
	Len Brown <len.brown@intel.com>, Lv Zheng <zetalog@gmail.com>,
	lkml <linux-kernel@vger.kernel.org>,
	linux-acpi@vger.kernel.org,
	Tomasz Nowicki <tomasz.nowicki@linaro.org>,
	Bob Moore <robert.moore@intel.com>
Subject: Re: [PATCH 15/17] ACPICA/ARM: ACPI 5.1: Update for GTDT table changes.
Date: Sat, 02 May 2015 22:02:08 +0800	[thread overview]
Message-ID: <5544D8E0.9000301@linaro.org> (raw)
In-Reply-To: <CAOZdJXU6vENaPJdwt6VBOwWrZ5tcjqk4k4uxBX2T5QPUDCgo7A@mail.gmail.com>

Hi Timur,

oh, you already noticed this issue, sorry for the
noise in my previous email.

On 2015年05月02日 06:43, Timur Tabi wrote:
> On Tue, Jul 29, 2014 at 11:21 PM, Lv Zheng <lv.zheng@intel.com> wrote:
>> From: Tomasz Nowicki <tomasz.nowicki@linaro.org>
>>
>> New fields and new subtables. Tomasz Nowicki.
>> tomasz.nowicki@linaro.org
>>
>> Signed-off-by: Tomasz Nowicki <tomasz.nowicki@linaro.org>
>> Signed-off-by: Hanjun Guo <hanjun.guo@linaro.org>
>> Signed-off-by: Bob Moore <robert.moore@intel.com>
>> Signed-off-by: Lv Zheng <lv.zheng@intel.com>
>
> Hi, I know this patch is old, but something confuses me about it:
>
>> +/* Common GTDT subtable header */
>> +
>> +struct acpi_gtdt_header {
>> +       u8 type;
>> +       u16 length;
>> +};
>
> I'm trying to write a function that parses the watchdog structure
> (acpi_gtdt_watchdog).  The first entry in that structure is
> acpi_gtdt_header.  Looking at the ACPI specification, I see that this
> is correct: the type is one byte, and the length is two bytes.
>
> However, this means that I cannot use acpi_parse_entries() to parse
> the watchdog subtable:
>
> int __init
> acpi_parse_entries(char *id, unsigned long table_size,
>          acpi_tbl_entry_handler handler,
>          struct acpi_table_header *table_header,
>          int entry_id, unsigned int max_entries)
>
> acpi_tbl_entry_handler takes an acpi_subtable_header as its first
> parameter.  However, that structure looks like this:
>
> struct acpi_subtable_header {
>      u8 type;
>      u8 length;
> };
>
> This is not compatible, so I'm confused now.  How do I properly parse
> the watchdog subtable, if I cannot use acpi_parse_entries?

This is really a pain. I noticed this when I was prototyping the code
for GTDT in ACPI 5.1, and I even sent an email to Charles to ask him if
there are mistakes here, but there are chances that more than 255 bytes
in that structure so we must use u16 for the length.

>
> For context, here is my patch:
>
> http://www.spinics.net/lists/linux-watchdog/msg06240.html
>
> Scroll down to function arm_sbsa_wdt_parse_gtdt().  The typecast in
> first line is invalid:
>
> +    struct acpi_gtdt_watchdog *wdg = (struct acpi_gtdt_watchdog *)header;
>
> because of the mismatch.  I don't know how to fix this.

Yes, you can't use acpi_parse_entries() anymore, in my opinion, you
can introduce a similar function as acpi_parse_entries(), you can
refer to some code that parsing the structures with u16 length, the
code I'm familiar it's the code for Intel DMAR (similar with ARM IORT),
for DMAR table parsing, it has the same head as GTDT watchdog timer:

/* DMAR subtable header */

struct acpi_dmar_header {
         u16 type;
         u16 length;
};

please refer to drivers/iommu/dmar.c and drivers/iommu/intel-iommu.c,
hope it helps.

Thanks
Hanjun


>
--
To unsubscribe from this list: send the line "unsubscribe linux-acpi" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

WARNING: multiple messages have this Message-ID (diff)
From: Hanjun Guo <hanjun.guo@linaro.org>
To: Timur Tabi <timur@codeaurora.org>, Lv Zheng <lv.zheng@intel.com>
Cc: "Rafael J. Wysocki" <rafael.j.wysocki@intel.com>,
	Len Brown <len.brown@intel.com>, Lv Zheng <zetalog@gmail.com>,
	lkml <linux-kernel@vger.kernel.org>,
	linux-acpi@vger.kernel.org,
	Tomasz Nowicki <tomasz.nowicki@linaro.org>,
	Bob Moore <robert.moore@intel.com>
Subject: Re: [PATCH 15/17] ACPICA/ARM: ACPI 5.1: Update for GTDT table changes.
Date: Sat, 02 May 2015 22:02:08 +0800	[thread overview]
Message-ID: <5544D8E0.9000301@linaro.org> (raw)
In-Reply-To: <CAOZdJXU6vENaPJdwt6VBOwWrZ5tcjqk4k4uxBX2T5QPUDCgo7A@mail.gmail.com>

Hi Timur,

oh, you already noticed this issue, sorry for the
noise in my previous email.

On 2015年05月02日 06:43, Timur Tabi wrote:
> On Tue, Jul 29, 2014 at 11:21 PM, Lv Zheng <lv.zheng@intel.com> wrote:
>> From: Tomasz Nowicki <tomasz.nowicki@linaro.org>
>>
>> New fields and new subtables. Tomasz Nowicki.
>> tomasz.nowicki@linaro.org
>>
>> Signed-off-by: Tomasz Nowicki <tomasz.nowicki@linaro.org>
>> Signed-off-by: Hanjun Guo <hanjun.guo@linaro.org>
>> Signed-off-by: Bob Moore <robert.moore@intel.com>
>> Signed-off-by: Lv Zheng <lv.zheng@intel.com>
>
> Hi, I know this patch is old, but something confuses me about it:
>
>> +/* Common GTDT subtable header */
>> +
>> +struct acpi_gtdt_header {
>> +       u8 type;
>> +       u16 length;
>> +};
>
> I'm trying to write a function that parses the watchdog structure
> (acpi_gtdt_watchdog).  The first entry in that structure is
> acpi_gtdt_header.  Looking at the ACPI specification, I see that this
> is correct: the type is one byte, and the length is two bytes.
>
> However, this means that I cannot use acpi_parse_entries() to parse
> the watchdog subtable:
>
> int __init
> acpi_parse_entries(char *id, unsigned long table_size,
>          acpi_tbl_entry_handler handler,
>          struct acpi_table_header *table_header,
>          int entry_id, unsigned int max_entries)
>
> acpi_tbl_entry_handler takes an acpi_subtable_header as its first
> parameter.  However, that structure looks like this:
>
> struct acpi_subtable_header {
>      u8 type;
>      u8 length;
> };
>
> This is not compatible, so I'm confused now.  How do I properly parse
> the watchdog subtable, if I cannot use acpi_parse_entries?

This is really a pain. I noticed this when I was prototyping the code
for GTDT in ACPI 5.1, and I even sent an email to Charles to ask him if
there are mistakes here, but there are chances that more than 255 bytes
in that structure so we must use u16 for the length.

>
> For context, here is my patch:
>
> http://www.spinics.net/lists/linux-watchdog/msg06240.html
>
> Scroll down to function arm_sbsa_wdt_parse_gtdt().  The typecast in
> first line is invalid:
>
> +    struct acpi_gtdt_watchdog *wdg = (struct acpi_gtdt_watchdog *)header;
>
> because of the mismatch.  I don't know how to fix this.

Yes, you can't use acpi_parse_entries() anymore, in my opinion, you
can introduce a similar function as acpi_parse_entries(), you can
refer to some code that parsing the structures with u16 length, the
code I'm familiar it's the code for Intel DMAR (similar with ARM IORT),
for DMAR table parsing, it has the same head as GTDT watchdog timer:

/* DMAR subtable header */

struct acpi_dmar_header {
         u16 type;
         u16 length;
};

please refer to drivers/iommu/dmar.c and drivers/iommu/intel-iommu.c,
hope it helps.

Thanks
Hanjun


>

  reply	other threads:[~2015-05-02 14:02 UTC|newest]

Thread overview: 42+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-07-30  4:20 [PATCH 00/17] ACPICA: 20140724 Release Lv Zheng
2014-07-30  4:20 ` Lv Zheng
2014-07-30  4:20 ` [PATCH 01/17] ACPICA: Work around an ancient GCC bug Lv Zheng
2014-07-30  4:20   ` Lv Zheng
2014-07-30  4:20 ` [PATCH 02/17] ACPICA: Remove a redundant cast to acpi_size for ACPI_OFFSET() macro Lv Zheng
2014-07-30  4:20   ` Lv Zheng
2014-07-30  4:20 ` [PATCH 03/17] ACPICA: Disassembler: Add support for the ToUUID opererator (macro) Lv Zheng
2014-07-30  4:20   ` Lv Zheng
2014-07-30  4:20 ` [PATCH 04/17] ACPICA: Update for comments/formatting. No functional changes Lv Zheng
2014-07-30  4:20   ` Lv Zheng
2014-07-30  4:20 ` [PATCH 05/17] ACPICA: Remove some extraneous printf arguments Lv Zheng
2014-07-30  4:20   ` Lv Zheng
2014-07-30  4:21 ` [PATCH 06/17] ACPICA: Tables: Update for DMAR table changes Lv Zheng
2014-07-30  4:21   ` Lv Zheng
2014-07-30  4:21 ` [PATCH 07/17] ACPICA: Utilities: Fix local printf issue Lv Zheng
2014-07-30  4:21   ` Lv Zheng
2014-07-30  4:21 ` [PATCH 08/17] ACPICA: acpihelp: Add UUID support, restructure some existing files Lv Zheng
2014-07-30  4:21   ` Lv Zheng
2014-07-30  4:21 ` [PATCH 09/17] ACPICA: Debug object: Add current value of Timer() to debug line prefix Lv Zheng
2014-07-30  4:21   ` Lv Zheng
2014-07-30  4:21 ` [PATCH 10/17] ACPICA: ACPI 5.1: Support for the _DSD predefined name Lv Zheng
2014-07-30  4:21   ` Lv Zheng
2014-07-30  4:21 ` [PATCH 11/17] ACPICA: ACPI 5.1: New notify value for System Affinity Update Lv Zheng
2014-07-30  4:21   ` Lv Zheng
2014-07-30  4:21 ` [PATCH 12/17] ACPICA: ACPI 5.1: Support for the _CCA predifined name Lv Zheng
2014-07-30  4:21   ` Lv Zheng
2014-07-30  4:21 ` [PATCH 13/17] ACPICA/ARM: ACPI 5.1: Update for FADT changes Lv Zheng
2014-07-30  4:21   ` Lv Zheng
2014-07-30  4:21 ` [PATCH 14/17] ACPICA/ARM: ACPI 5.1: Update for MADT changes Lv Zheng
2014-07-30  4:21   ` Lv Zheng
2014-07-30  4:21 ` [PATCH 15/17] ACPICA/ARM: ACPI 5.1: Update for GTDT table changes Lv Zheng
2014-07-30  4:21   ` Lv Zheng
2015-05-01 22:43   ` Timur Tabi
2015-05-02 14:02     ` Hanjun Guo [this message]
2015-05-02 14:02       ` Hanjun Guo
2015-05-05 20:28       ` Moore, Robert
2015-05-05 20:28         ` Moore, Robert
2014-07-30  4:22 ` [PATCH 16/17] ACPICA: ACPI 5.1: Update for PCCT " Lv Zheng
2014-07-30  4:22   ` Lv Zheng
2014-07-30  4:22 ` [PATCH 17/17] ACPICA: Update version to 20140724 Lv Zheng
2014-07-30  4:22   ` Lv Zheng
2014-07-31 22:32 ` [PATCH 00/17] ACPICA: 20140724 Release Rafael J. Wysocki

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=5544D8E0.9000301@linaro.org \
    --to=hanjun.guo@linaro.org \
    --cc=len.brown@intel.com \
    --cc=linux-acpi@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lv.zheng@intel.com \
    --cc=rafael.j.wysocki@intel.com \
    --cc=robert.moore@intel.com \
    --cc=timur@codeaurora.org \
    --cc=tomasz.nowicki@linaro.org \
    --cc=zetalog@gmail.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.