From patchwork Wed Jun 20 23:18:24 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Denys Dmytriyenko X-Patchwork-Id: 139399 Delivered-To: patch@linaro.org Received: by 2002:a2e:970d:0:0:0:0:0 with SMTP id r13-v6csp1357739lji; Wed, 20 Jun 2018 16:18:33 -0700 (PDT) X-Google-Smtp-Source: ADUXVKJ1EHNCHWyKh+uw0KfCMuBOeSjQW5PjZznx3yNtgmatTt82XvJSuHE7uwUki3qQdbhZVrGi X-Received: by 2002:a63:2581:: with SMTP id l123-v6mr4044882pgl.226.1529536713347; Wed, 20 Jun 2018 16:18:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1529536713; cv=none; d=google.com; s=arc-20160816; b=sxNyph1gY3Hyh4rt9bHnFK4cM7Vz8OdhOmIV9XxKHHu4KfvqW9j+gQRDGFwMsMuuKp DV0zoSdfpiVsL3nmY0kNuLT2RwQjMfus5WyLSa20oEL0s6VxtRb4lwPBN4A9bHX6JU8Z KO9a7w7ozlFre0MnWj1BuuwJhjooGaAGprsqvfurTE1HdyEln273b7A5mn/wqPmz4ovr IR2q5OKsvwYbgtZSGNVfc9Z/o6BcAeoAT3YPZitXzEWqX88iqeLzLjW/rU18fwxMBtKu samG5RqNG4eVS1SK0gPQExhkfWu0NtTWyBTBDMitgge5a2m0P7MvMJ17TnkMdK2xHHOr iHYg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=errors-to:sender:content-transfer-encoding:mime-version :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:cc:message-id:date:to:from:delivered-to :arc-authentication-results; bh=qFrFLKdFlmnpscoQ4txjUTbd7yGpgVAJyFyBusTeq+A=; b=HuFDTqIS/8DYAL+3p73/80C2nkXnZPKGGRw42e7ICczr6Ju17T70cTbb/3GXh1g1rW cEQc8EJ3a2zf2JLnqdgk2nQc6FrpXDmQjRfMbGsr/uh8VU9Vw6xuA8mZsxFL7q/qapI4 pm2Am4zj6w2b5ykP8i7dfw4JeyOCMRz7NtdITiNA8rhShDQjNYZXlNX3IqlQxozaFs89 2uB2gnZE5lQdgEE2HPSSEUBqPDU47PvAZuc5+GIfPKQnCgbewgmmKABdbWMVMeRldHQ+ mplXeFxn89jPUwryzIldMcGTDt23TQWvOz0OGoGPQDhJT3CPj7WGVjT6N7ltEzm2rSCG Z8cQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of openembedded-devel-bounces@lists.openembedded.org designates 140.211.169.62 as permitted sender) smtp.mailfrom=openembedded-devel-bounces@lists.openembedded.org Return-Path: Received: from mail.openembedded.org (mail.openembedded.org. [140.211.169.62]) by mx.google.com with ESMTP id q14-v6si3252856pll.324.2018.06.20.16.18.32; Wed, 20 Jun 2018 16:18:33 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of openembedded-devel-bounces@lists.openembedded.org designates 140.211.169.62 as permitted sender) client-ip=140.211.169.62; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of openembedded-devel-bounces@lists.openembedded.org designates 140.211.169.62 as permitted sender) smtp.mailfrom=openembedded-devel-bounces@lists.openembedded.org Received: from layers.openembedded.org (localhost [127.0.0.1]) by mail.openembedded.org (Postfix) with ESMTP id 8F799783C6; Wed, 20 Jun 2018 23:18:27 +0000 (UTC) X-Original-To: openembedded-devel@lists.openembedded.org Delivered-To: openembedded-devel@lists.openembedded.org Received: from mailout4.zoneedit.com (mailout4.zoneedit.com [64.68.198.17]) by mail.openembedded.org (Postfix) with ESMTP id B9F1678375 for ; Wed, 20 Jun 2018 23:18:25 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by mailout4.zoneedit.com (Postfix) with ESMTP id 9EE6E20BD9; Wed, 20 Jun 2018 23:18:26 +0000 (UTC) Received: from mailout4.zoneedit.com ([127.0.0.1]) by localhost (zmo03-pco.easydns.vpn [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id FOdOPeasTg0m; Wed, 20 Jun 2018 23:18:26 +0000 (UTC) Received: from mail.denix.org (pool-100-15-85-143.washdc.fios.verizon.net [100.15.85.143]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mailout4.zoneedit.com (Postfix) with ESMTPSA id 74DF12017D; Wed, 20 Jun 2018 23:18:25 +0000 (UTC) Received: from gimli.denix (gimli [192.168.0.6]) by mail.denix.org (Postfix) with ESMTP id F39DA1634C3; Wed, 20 Jun 2018 19:18:24 -0400 (EDT) From: Denys Dmytriyenko To: openembedded-devel@lists.openembedded.org Date: Wed, 20 Jun 2018 19:18:24 -0400 Message-Id: <1529536704-42697-1-git-send-email-denis@denix.org> X-Mailer: git-send-email 2.7.4 Cc: Denys Dmytriyenko Subject: [oe] [PATCH v2] devmem2: ensure word is 32-bit, add support for 64-bit long X-BeenThere: openembedded-devel@lists.openembedded.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: Using the OpenEmbedded metadata to build Distributions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: openembedded-devel-bounces@lists.openembedded.org Errors-To: openembedded-devel-bounces@lists.openembedded.org From: Denys Dmytriyenko Since sizeof(unsigned long) can be 8-byte on 64-bit architectures, use uint32_t instead for "word" access to always be 4-byte/32-bit long. Also introduce proper "long" 8-byte/64-bit access by using uint64_t. Signed-off-by: Denys Dmytriyenko --- v2 - change 64-bit name from "double" to "long" to match busybox meta-oe/recipes-support/devmem2/devmem2.bb | 4 +- ...sure-word-is-32-bit-and-add-support-for-6.patch | 70 ++++++++++++++++++++++ 2 files changed, 73 insertions(+), 1 deletion(-) create mode 100644 meta-oe/recipes-support/devmem2/devmem2/0001-devmem.c-ensure-word-is-32-bit-and-add-support-for-6.patch -- 2.7.4 -- _______________________________________________ Openembedded-devel mailing list Openembedded-devel@lists.openembedded.org http://lists.openembedded.org/mailman/listinfo/openembedded-devel diff --git a/meta-oe/recipes-support/devmem2/devmem2.bb b/meta-oe/recipes-support/devmem2/devmem2.bb index c86eb2e..9bd1eb7 100644 --- a/meta-oe/recipes-support/devmem2/devmem2.bb +++ b/meta-oe/recipes-support/devmem2/devmem2.bb @@ -4,7 +4,9 @@ LIC_FILES_CHKSUM = "file://devmem2.c;endline=38;md5=a9eb9f3890384519f435aedf9862 PR = "r7" SRC_URI = "http://www.free-electrons.com/pub/mirror/devmem2.c;downloadfilename=devmem2-new.c \ - file://devmem2-fixups-2.patch;apply=yes;striplevel=0" + file://devmem2-fixups-2.patch;apply=yes;striplevel=0 \ + file://0001-devmem.c-ensure-word-is-32-bit-and-add-support-for-6.patch" + S = "${WORKDIR}" CFLAGS += "-DFORCE_STRICT_ALIGNMENT" diff --git a/meta-oe/recipes-support/devmem2/devmem2/0001-devmem.c-ensure-word-is-32-bit-and-add-support-for-6.patch b/meta-oe/recipes-support/devmem2/devmem2/0001-devmem.c-ensure-word-is-32-bit-and-add-support-for-6.patch new file mode 100644 index 0000000..2a57f29 --- /dev/null +++ b/meta-oe/recipes-support/devmem2/devmem2/0001-devmem.c-ensure-word-is-32-bit-and-add-support-for-6.patch @@ -0,0 +1,70 @@ +From 1360a907879dd24041797a3b709d49aeac2ab444 Mon Sep 17 00:00:00 2001 +From: Denys Dmytriyenko +Date: Tue, 29 May 2018 16:55:42 -0400 +Subject: [PATCH] devmem.c: ensure word is 32-bit and add support for 64-bit + long + +Signed-off-by: Denys Dmytriyenko +--- + devmem2.c | 23 +++++++++++++++++------ + 1 file changed, 17 insertions(+), 6 deletions(-) + +diff --git a/devmem2.c b/devmem2.c +index 5845381..68131b2 100644 +--- a/devmem2.c ++++ b/devmem2.c +@@ -39,6 +39,7 @@ + + #include + #include ++#include + #include + #include + #include +@@ -69,7 +70,7 @@ int main(int argc, char **argv) { + if(argc < 2) { + fprintf(stderr, "\nUsage:\t%s { address } [ type [ data ] ]\n" + "\taddress : memory address to act upon\n" +- "\ttype : access operation type : [b]yte, [h]alfword, [w]ord\n" ++ "\ttype : access operation type : [b]yte, [h]alfword, [w]ord, [l]ong\n" + "\tdata : data to be written\n\n", + argv[0]); + exit(1); +@@ -103,9 +104,14 @@ int main(int argc, char **argv) { + read_result = *((unsigned short *) virt_addr); + break; + case 'w': +- data_size = sizeof(unsigned long); ++ data_size = sizeof(uint32_t); + virt_addr = fixup_addr(virt_addr, data_size); +- read_result = *((unsigned long *) virt_addr); ++ read_result = *((uint32_t *) virt_addr); ++ break; ++ case 'l': ++ data_size = sizeof(uint64_t); ++ virt_addr = fixup_addr(virt_addr, data_size); ++ read_result = *((uint64_t *) virt_addr); + break; + default: + fprintf(stderr, "Illegal data type '%c'.\n", access_type); +@@ -129,9 +135,14 @@ int main(int argc, char **argv) { + read_result = *((unsigned short *) virt_addr); + break; + case 'w': +- virt_addr = fixup_addr(virt_addr, sizeof(unsigned long)); +- *((unsigned long *) virt_addr) = write_val; +- read_result = *((unsigned long *) virt_addr); ++ virt_addr = fixup_addr(virt_addr, sizeof(uint32_t)); ++ *((uint32_t *) virt_addr) = write_val; ++ read_result = *((uint32_t *) virt_addr); ++ break; ++ case 'l': ++ virt_addr = fixup_addr(virt_addr, sizeof(uint64_t)); ++ *((uint64_t *) virt_addr) = write_val; ++ read_result = *((uint64_t *) virt_addr); + break; + } + sprintf(fmt_str, "Write at address 0x%%08lX (%%p): 0x%%0%dlX, " +-- +2.7.4 +