Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1346875

Re: [PATCH v2 1/3] ACPI/NFIT: Update Control Region Structure to comply ACPI 6.1

From Toshi Kani <toshi.kani@hpe.com>
Newsgroups linux.kernel
Subject Re: [PATCH v2 1/3] ACPI/NFIT: Update Control Region Structure to comply ACPI 6.1
Date 2016-03-01 19:50 +0100
Message-ID <r7XwS-4vn-9@gated-at.bofh.it> (permalink)
References (2 earlier) <r7UfE-2na-3@gated-at.bofh.it> <r7USl-2ET-1@gated-at.bofh.it> <r7V22-2XK-27@gated-at.bofh.it> <r7VY7-3zV-39@gated-at.bofh.it> <r7X3Q-4gl-13@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Tue, 2016-03-01 at 10:14 -0800, Dan Williams wrote:
> On Tue, Mar 1, 2016 at 9:36 AM, Toshi Kani <toshi.kani@hpe.com> wrote:
> > On Tue, 2016-03-01 at 16:03 +0000, Moore, Robert wrote:
> > > We have a bunch of macros in include/acmacros.h -- like this:
> > > 
> > > ACPI_MOVE_16_TO_16(d, s)
> > 
> > There is a problem in using the ACPICA byte-swap macros.  ACPI is
> > little-
> > endian arch, so the macros are set to perform byte-swappings when the
> > CPU
> > arch is big-endian.  This case, however, is the other way around.  The
> > fields in question are defined & stored as arrays of bytes.  If you
> > treat
> > them as multi-bytes numeric values, then you need to byte-swap them
> > when
> > the CPU arch is little-endian because arrays of bytes have the same
> > addressing as big-endian.
> > 
> > Another issue is that it is not clear who needs to perform the byte-
> > swapping among ACPICA and drivers.  If ACPICA, drivers must agree that
> > these fields are always treated as multi-bytes numeric values despite
> > of
> > the spec.  If drivers, we need to make sure that only a single driver
> > performs this byte-swapping one time as ACPI tables are global
> > structures.
> > 
> > I think it is much clearer to define the structure according to the
> > ACPI
> > spec.
> 
> I think the "ACPI tables are little-endian" assumption is pervasive
> throughout the implementation.
> 
> Toshi, it seems all we need is conversions like:
> 
> - sprintf(buf, "%#x\n", dcr->vendor_id);
> + sprintf(buf, "%#x\n", le16_to_cpu(dcr->vendor_id));
> 
> ...for the values exported to userspace through sysfs, but otherwise
> leave the base table definitions as is.  Will this suffice?

Yes, I am OK to go with this option to get it done.

We still need to add new fields into the structure.  Is it OK to make this
change?  If not, we will need to have a local structure to define the new
fields...

Thanks,
-Toshi

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

RE: [PATCH v2 1/3] ACPI/NFIT: Update Control Region Structure to  comply ACPI 6.1 "Moore, Robert" <robert.moore@intel.com> - 2016-03-01 16:20 +0100
  Re: [PATCH v2 1/3] ACPI/NFIT: Update Control Region Structure to  comply ACPI 6.1 Toshi Kani <toshi.kani@hpe.com> - 2016-03-01 17:00 +0100
    RE: [PATCH v2 1/3] ACPI/NFIT: Update Control Region Structure to  comply ACPI 6.1 "Moore, Robert" <robert.moore@intel.com> - 2016-03-01 17:10 +0100
      Re: [PATCH v2 1/3] ACPI/NFIT: Update Control Region Structure to  comply ACPI 6.1 Toshi Kani <toshi.kani@hpe.com> - 2016-03-01 18:10 +0100
        RE: [PATCH v2 1/3] ACPI/NFIT: Update Control Region Structure to  comply ACPI 6.1 "Moore, Robert" <robert.moore@intel.com> - 2016-03-01 18:40 +0100
          RE: [PATCH v2 1/3] ACPI/NFIT: Update Control Region Structure to  comply ACPI 6.1 "Moore, Robert" <robert.moore@intel.com> - 2016-03-01 18:50 +0100
          Re: [PATCH v2 1/3] ACPI/NFIT: Update Control Region Structure to  comply ACPI 6.1 Toshi Kani <toshi.kani@hpe.com> - 2016-03-01 19:40 +0100
        Re: [PATCH v2 1/3] ACPI/NFIT: Update Control Region Structure to  comply ACPI 6.1 Dan Williams <dan.j.williams@intel.com> - 2016-03-01 19:20 +0100
          Re: [PATCH v2 1/3] ACPI/NFIT: Update Control Region Structure to  comply ACPI 6.1 Toshi Kani <toshi.kani@hpe.com> - 2016-03-01 19:50 +0100
          Re: [PATCH v2 1/3] ACPI/NFIT: Update Control Region Structure to  comply ACPI 6.1 Toshi Kani <toshi.kani@hpe.com> - 2016-03-01 20:40 +0100

csiph-web