From patchwork Fri Feb 19 23:08:53 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Kani, Toshi" X-Patchwork-Id: 8364611 Return-Path: X-Original-To: patchwork-linux-acpi@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 82301C0553 for ; Fri, 19 Feb 2016 22:16:48 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 711FF20412 for ; Fri, 19 Feb 2016 22:16:47 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 7159E2037C for ; Fri, 19 Feb 2016 22:16:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1428212AbcBSWQY (ORCPT ); Fri, 19 Feb 2016 17:16:24 -0500 Received: from g4t3426.houston.hp.com ([15.201.208.54]:57205 "EHLO g4t3426.houston.hp.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1428122AbcBSWQF (ORCPT ); Fri, 19 Feb 2016 17:16:05 -0500 Received: from g4t3433.houston.hp.com (g4t3433.houston.hp.com [16.210.25.219]) by g4t3426.houston.hp.com (Postfix) with ESMTP id 5B3694A; Fri, 19 Feb 2016 22:16:04 +0000 (UTC) Received: from misato.fc.hp.com (misato.fc.hp.com [16.78.168.61]) by g4t3433.houston.hp.com (Postfix) with ESMTP id 8F2114C; Fri, 19 Feb 2016 22:16:03 +0000 (UTC) From: Toshi Kani 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 Subject: [PATCH 2/2] nfit_test: Update SPD ID init handlings Date: Fri, 19 Feb 2016 16:08:53 -0700 Message-Id: <1455923333-13629-3-git-send-email-toshi.kani@hpe.com> X-Mailer: git-send-email 2.5.0 In-Reply-To: <1455923333-13629-1-git-send-email-toshi.kani@hpe.com> References: <1455923333-13629-1-git-send-email-toshi.kani@hpe.com> Sender: linux-acpi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 Cc: Dan Williams Cc: Rafael J. Wysocki --- tools/testing/nvdimm/test/nfit.c | 64 +++++++++++++++++++++++--------------- 1 file changed, 39 insertions(+), 25 deletions(-) -- 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 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;