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

From: Toshi Kani
Date: Tue Mar 01 2016 - 12:02:23 EST


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.

Thanks,
-Toshi

> > -----Original Message-----
> > From: Toshi Kani [mailto:toshi.kani@xxxxxxx]
> > Sent: Tuesday, March 01, 2016 8:38 AM
> > To: Moore, Robert; rjw@xxxxxxxxxxxxx; Williams, Dan J
> > Cc: Zheng, Lv; elliott@xxxxxxx; linux-nvdimm@xxxxxxxxxxxx; linux-
> > acpi@xxxxxxxxxxxxxxx; linux-kernel@xxxxxxxxxxxxxxx; devel@xxxxxxxxxx
> > Subject: Re: [PATCH v2 1/3] ACPI/NFIT: Update Control Region Structure
> > to
> > comply ACPI 6.1
> >
> > On Tue, 2016-03-01 at 15:13 +0000, Moore, Robert wrote:
> > >
> > > > -----Original Message-----
> > > > From: Toshi Kani [mailto:toshi.kani@xxxxxxx]
> > > > Sent: Monday, February 22, 2016 1:55 PM
> > > > To: rjw@xxxxxxxxxxxxx; Williams, Dan J
> > > > Cc: Moore, Robert; Zheng, Lv; elliott@xxxxxxx;
> > > > linux-nvdimm@xxxxxxxxxxx g; linux-acpi@xxxxxxxxxxxxxxx;
> > > > linux-kernel@xxxxxxxxxxxxxxx; devel@xxxxxxxxxx; Toshi Kani
> > > > Subject: [PATCH v2 1/3] ACPI/NFIT: Update Control Region Structure
> > > > to comply ACPI 6.1
> > > >
> > > > ACPI 6.1, Table 5-133, updates NVDIMM Control Region Structure as
> > > > follows.
> > > > Â- Valid Fields, Manufacturing Location, and Manufacturing Date
> > > > ÂÂÂare added from reserved range.ÂÂNo change in the structure size.
> > > > Â- IDs defined as SPD values are arrays of bytes.ÂÂThe spec
> > > > ÂÂÂclarified that they need to be represented as arrays of bytes
> > > > ÂÂÂas well.
> > > >
> > > > This patch makes the following changes to support this update.
> > > > Â- Change 'struct acpi_nfit_control_region' to reflect the update.
> > > > ÂÂÂSPD IDs are defined as arrays of bytes, so that they can be
> > > > ÂÂÂtreated in the same way regardless of CPU endianness and are
> > > > ÂÂÂnot miss-treated as little-endian numeric values.
> > >
> > >
> > > I don't think we are going to start changing the ACPI tables defined
> > > in the ACPICA headers because of this. We do in fact have macros for
> > > this purpose.
> >
> > Can you elaborate what macros you suggest to use for this purpose?
> >
> > Thanks,
> > -Toshi
> NïïïïïrïïyïïïbïXïïÇvï^ï)Þ{.nï+ïïïï{ïiïbï{ayïÊÚï,jïïfïïïhïïïzïïwïïï
> ïïïj:+vïïïwïjïmïïïïïïïïzZ+ïïïïïÝj"ïï!ïi