From: Toshi Kani <toshi.kani@hpe.com>
To: rjw@rjwysocki.net, dan.j.williams@intel.com
Cc: robert.moore@intel.com, elliott@hpe.com,
linux-nvdimm@lists.01.org, linux-acpi@vger.kernel.org,
linux-kernel@vger.kernel.org, devel@acpica.org,
Toshi Kani <toshi.kani@hpe.com>
Subject: [PATCH 2/2] nfit_test: Update SPD ID init handlings
Date: Fri, 19 Feb 2016 16:08:53 -0700 [thread overview]
Message-ID: <1455923333-13629-3-git-send-email-toshi.kani@hpe.com> (raw)
In-Reply-To: <1455923333-13629-1-git-send-email-toshi.kani@hpe.com>
Update the test code that initializes SPD IDs of NFIT control
region structures. nfit_set_spd_id() is added to handle
initialization to an array of bytes.
Signed-off-by: Toshi Kani <toshi.kani@hpe.com>
Cc: Dan Williams <dan.j.williams@intel.com>
Cc: Rafael J. Wysocki <rjw@rjwysocki.net>
---
tools/testing/nvdimm/test/nfit.c | 64 +++++++++++++++++++++++---------------
1 file changed, 39 insertions(+), 25 deletions(-)
diff --git a/tools/testing/nvdimm/test/nfit.c b/tools/testing/nvdimm/test/nfit.c
index 90bd2ea..283e187 100644
--- a/tools/testing/nvdimm/test/nfit.c
+++ b/tools/testing/nvdimm/test/nfit.c
@@ -160,6 +160,14 @@ static struct nfit_test *to_nfit_test(struct device *dev)
return container_of(pdev, struct nfit_test, pdev);
}
+static void nfit_set_spd_id(u8 *dist, u64 value, size_t size)
+{
+ int shift;
+
+ for (shift = size - 1; shift >= 0; shift--, dist++)
+ *dist = (u8)((value >> (8 * shift)) & 0xff);
+}
+
static int nfit_test_cmd_get_config_size(struct nd_cmd_get_config_size *nd_cmd,
unsigned int buf_len)
{
@@ -815,10 +823,11 @@ static void nfit_test0_setup(struct nfit_test *t)
dcr->header.type = ACPI_NFIT_TYPE_CONTROL_REGION;
dcr->header.length = sizeof(struct acpi_nfit_control_region);
dcr->region_index = 0+1;
- dcr->vendor_id = 0xabcd;
- dcr->device_id = 0;
- dcr->revision_id = 1;
- dcr->serial_number = ~handle[0];
+ nfit_set_spd_id(dcr->vendor_id, 0xabcd, sizeof(dcr->vendor_id));
+ nfit_set_spd_id(dcr->device_id, 0, sizeof(dcr->device_id));
+ nfit_set_spd_id(dcr->revision_id, 1, sizeof(dcr->revision_id));
+ nfit_set_spd_id(dcr->serial_number, ~handle[0],
+ sizeof(dcr->serial_number));
dcr->windows = 1;
dcr->window_size = DCR_SIZE;
dcr->command_offset = 0;
@@ -831,10 +840,11 @@ static void nfit_test0_setup(struct nfit_test *t)
dcr->header.type = ACPI_NFIT_TYPE_CONTROL_REGION;
dcr->header.length = sizeof(struct acpi_nfit_control_region);
dcr->region_index = 1+1;
- dcr->vendor_id = 0xabcd;
- dcr->device_id = 0;
- dcr->revision_id = 1;
- dcr->serial_number = ~handle[1];
+ nfit_set_spd_id(dcr->vendor_id, 0xabcd, sizeof(dcr->vendor_id));
+ nfit_set_spd_id(dcr->device_id, 0, sizeof(dcr->device_id));
+ nfit_set_spd_id(dcr->revision_id, 1, sizeof(dcr->revision_id));
+ nfit_set_spd_id(dcr->serial_number, ~handle[1],
+ sizeof(dcr->serial_number));
dcr->windows = 1;
dcr->window_size = DCR_SIZE;
dcr->command_offset = 0;
@@ -847,10 +857,11 @@ static void nfit_test0_setup(struct nfit_test *t)
dcr->header.type = ACPI_NFIT_TYPE_CONTROL_REGION;
dcr->header.length = sizeof(struct acpi_nfit_control_region);
dcr->region_index = 2+1;
- dcr->vendor_id = 0xabcd;
- dcr->device_id = 0;
- dcr->revision_id = 1;
- dcr->serial_number = ~handle[2];
+ nfit_set_spd_id(dcr->vendor_id, 0xabcd, sizeof(dcr->vendor_id));
+ nfit_set_spd_id(dcr->device_id, 0, sizeof(dcr->device_id));
+ nfit_set_spd_id(dcr->revision_id, 1, sizeof(dcr->revision_id));
+ nfit_set_spd_id(dcr->serial_number, ~handle[2],
+ sizeof(dcr->serial_number));
dcr->windows = 1;
dcr->window_size = DCR_SIZE;
dcr->command_offset = 0;
@@ -863,10 +874,11 @@ static void nfit_test0_setup(struct nfit_test *t)
dcr->header.type = ACPI_NFIT_TYPE_CONTROL_REGION;
dcr->header.length = sizeof(struct acpi_nfit_control_region);
dcr->region_index = 3+1;
- dcr->vendor_id = 0xabcd;
- dcr->device_id = 0;
- dcr->revision_id = 1;
- dcr->serial_number = ~handle[3];
+ nfit_set_spd_id(dcr->vendor_id, 0xabcd, sizeof(dcr->vendor_id));
+ nfit_set_spd_id(dcr->device_id, 0, sizeof(dcr->device_id));
+ nfit_set_spd_id(dcr->revision_id, 1, sizeof(dcr->revision_id));
+ nfit_set_spd_id(dcr->serial_number, ~handle[3],
+ sizeof(dcr->serial_number));
dcr->windows = 1;
dcr->window_size = DCR_SIZE;
dcr->command_offset = 0;
@@ -959,10 +971,11 @@ static void nfit_test0_setup(struct nfit_test *t)
dcr->header.type = ACPI_NFIT_TYPE_CONTROL_REGION;
dcr->header.length = sizeof(struct acpi_nfit_control_region);
dcr->region_index = 4+1;
- dcr->vendor_id = 0xabcd;
- dcr->device_id = 0;
- dcr->revision_id = 1;
- dcr->serial_number = ~handle[4];
+ nfit_set_spd_id(dcr->vendor_id, 0xabcd, sizeof(dcr->vendor_id));
+ nfit_set_spd_id(dcr->device_id, 0, sizeof(dcr->device_id));
+ nfit_set_spd_id(dcr->revision_id, 1, sizeof(dcr->revision_id));
+ nfit_set_spd_id(dcr->serial_number, ~handle[4],
+ sizeof(dcr->serial_number));
dcr->windows = 1;
dcr->window_size = DCR_SIZE;
dcr->command_offset = 0;
@@ -1128,11 +1141,12 @@ static void nfit_test1_setup(struct nfit_test *t)
dcr->header.type = ACPI_NFIT_TYPE_CONTROL_REGION;
dcr->header.length = sizeof(struct acpi_nfit_control_region);
dcr->region_index = 0+1;
- dcr->vendor_id = 0xabcd;
- dcr->device_id = 0;
- dcr->revision_id = 1;
- dcr->serial_number = ~0;
- dcr->code = 0x201;
+ nfit_set_spd_id(dcr->vendor_id, 0xabcd, sizeof(dcr->vendor_id));
+ nfit_set_spd_id(dcr->device_id, 0, sizeof(dcr->device_id));
+ nfit_set_spd_id(dcr->revision_id, 1, sizeof(dcr->revision_id));
+ nfit_set_spd_id(dcr->serial_number, ~0,
+ sizeof(dcr->serial_number));
+ nfit_set_spd_id(dcr->code, 0x201, sizeof(dcr->code));
dcr->windows = 0;
dcr->window_size = 0;
dcr->command_offset = 0;
prev parent reply other threads:[~2016-02-19 23:08 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-02-19 23:08 [PATCH 0/2] ACPI 6.1 update for NFIT Control Region Structure Toshi Kani
2016-02-19 23:08 ` [PATCH 1/2] ACPI/NFIT: Update Control Region Structure per ACPI 6.1 Toshi Kani
2016-02-19 22:34 ` Dan Williams
2016-02-19 22:55 ` Moore, Robert
2016-02-19 23:44 ` Toshi Kani
2016-02-19 23:08 ` Toshi Kani [this message]
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=1455923333-13629-3-git-send-email-toshi.kani@hpe.com \
--to=toshi.kani@hpe.com \
--cc=dan.j.williams@intel.com \
--cc=devel@acpica.org \
--cc=elliott@hpe.com \
--cc=linux-acpi@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-nvdimm@lists.01.org \
--cc=rjw@rjwysocki.net \
--cc=robert.moore@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;
as well as URLs for NNTP newsgroup(s).