提交 1bcbf42d 编写于 作者: D Dan Williams

nfit: fix format interface code byte order

Per JEDEC Annex L Release 3 the SPD data is:

Bits 9~5 00 000 = Function Undefined
         00 001 = Byte addressable energy backed
         00 010 = Block addressed
         00 011 = Byte addressable, no energy backed
         All other codes reserved
Bits 4~0 0 0000 = Proprietary interface
         0 0001 = Standard interface 1
         All other codes reserved; see Definitions of Functions

...and per the ACPI 6.1 spec:

    byte0: Bits 4~0 (0 or 1)
    byte1: Bits 9~5 (1, 2, or 3)

...so a format interface code displayed as 0x301 should be stored in the
nfit as (0x1, 0x3), little-endian.

Cc: Toshi Kani <toshi.kani@hpe.com>
Cc: Rafael J. Wysocki <rjw@rjwysocki.net>
Cc: Robert Moore <robert.moore@intel.com>
Cc: Robert Elliott <elliott@hpe.com>
Link: https://bugzilla.kernel.org/show_bug.cgi?id=121161
Fixes: 30ec5fd4 ("nfit: fix format interface code byte order per ACPI6.1")
Fixes: 5ad9a7fd ("acpi/nfit: Update nfit driver to comply with ACPI 6.1")
Reported-by: NKristin Jacque <kristin.jacque@intel.com>
Signed-off-by: NDan Williams <dan.j.williams@intel.com>
上级 02395435
...@@ -928,7 +928,7 @@ static ssize_t format_show(struct device *dev, ...@@ -928,7 +928,7 @@ static ssize_t format_show(struct device *dev,
{ {
struct acpi_nfit_control_region *dcr = to_nfit_dcr(dev); struct acpi_nfit_control_region *dcr = to_nfit_dcr(dev);
return sprintf(buf, "0x%04x\n", be16_to_cpu(dcr->code)); return sprintf(buf, "0x%04x\n", le16_to_cpu(dcr->code));
} }
static DEVICE_ATTR_RO(format); static DEVICE_ATTR_RO(format);
...@@ -961,8 +961,8 @@ static ssize_t format1_show(struct device *dev, ...@@ -961,8 +961,8 @@ static ssize_t format1_show(struct device *dev,
continue; continue;
if (nfit_dcr->dcr->code == dcr->code) if (nfit_dcr->dcr->code == dcr->code)
continue; continue;
rc = sprintf(buf, "%#x\n", rc = sprintf(buf, "0x%04x\n",
be16_to_cpu(nfit_dcr->dcr->code)); le16_to_cpu(nfit_dcr->dcr->code));
break; break;
} }
if (rc != ENXIO) if (rc != ENXIO)
......
...@@ -53,12 +53,12 @@ enum nfit_uuids { ...@@ -53,12 +53,12 @@ enum nfit_uuids {
}; };
/* /*
* Region format interface codes are stored as an array of bytes in the * Region format interface codes are stored with the interface as the
* NFIT DIMM Control Region structure * LSB and the function as the MSB.
*/ */
#define NFIT_FIC_BYTE cpu_to_be16(0x101) /* byte-addressable energy backed */ #define NFIT_FIC_BYTE cpu_to_le16(0x101) /* byte-addressable energy backed */
#define NFIT_FIC_BLK cpu_to_be16(0x201) /* block-addressable non-energy backed */ #define NFIT_FIC_BLK cpu_to_le16(0x201) /* block-addressable non-energy backed */
#define NFIT_FIC_BYTEN cpu_to_be16(0x301) /* byte-addressable non-energy backed */ #define NFIT_FIC_BYTEN cpu_to_le16(0x301) /* byte-addressable non-energy backed */
enum { enum {
NFIT_BLK_READ_FLUSH = 1, NFIT_BLK_READ_FLUSH = 1,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册