Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp4800413imu; Tue, 29 Jan 2019 07:44:17 -0800 (PST) X-Google-Smtp-Source: ALg8bN6pcT8mO2MjxFPGhuVw8qc2jXrDGz0IjYl2dIyFBsVFX3ZsZofGVGcuwCsc4E2Tbodu22VY X-Received: by 2002:a62:4e83:: with SMTP id c125mr26980397pfb.101.1548776656977; Tue, 29 Jan 2019 07:44:16 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548776656; cv=none; d=google.com; s=arc-20160816; b=oNKKJOwOG9ZOVUVtPzcuz+VpA+cXOGX6vdqKBCZmKZu4YcU42M6+AT5GhGY7XqtIs3 j+7dt9PkHNe6y0HK72rZVg95TBDXowZOKugyZpbWNzPqr0qIMNske/Gr8n6ZPH0/bEzq Ko3bhv60ct+aimItgxbLlFovnft437DVuCkxb8zVSPreOInHSkvGpXRZqyz1wK5+IZ6j rMXYqoOLgV5E406h8ZeRmIzIP6kJtkw28t8qysKxyL1Q2egT/mzR2W1Bnv34V5uC5g/T MpObyFZK1bYunnVnOFFmE3xh6G1rhiD9OMj4+ulZxDwp16A7PHKvEa2QLyLRoDaeUdEp rLbw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=ZCAZOUchMpZ91kBQ/qiyRt39IyQwRPq6axhteUk33go=; b=DlXFS1Uoyn+3nbvwVTc/MZTmZOD0GmRuZtwUWjZTe0bSdn8H+eS+KGCEDP7Xjp12/O 4fs2aQVzlBaoz9PEDHkQ70QVzNJZb+4tlM1pqVUCxQIyHv4gaK/BHwAZrnPmPolrlgal zn4X+4GPe6mDkkD0WT/cz4f8kiAfXviTXRdMr2lP8z5Vma5FA7Ol2RnOax70L+Mr2DYm /Z3rHobqYhI+/pTOauKMtJfGhcXgQRGmMXuz/NsO16z9T2sJY9GZ4Rv5IUWUoGf0eRlw nv5BlIDcDEplUUKeAQGbUDVggb8A0emHuSii3e6Ky4xLra0MpI5/Siv8eAgDyFxkrvGA JsOg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f16si35033995pgg.173.2019.01.29.07.44.01; Tue, 29 Jan 2019 07:44:16 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727181AbfA2Pne (ORCPT + 99 others); Tue, 29 Jan 2019 10:43:34 -0500 Received: from mga04.intel.com ([192.55.52.120]:43986 "EHLO mga04.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725783AbfA2Pne (ORCPT ); Tue, 29 Jan 2019 10:43:34 -0500 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga004.jf.intel.com ([10.7.209.38]) by fmsmga104.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 29 Jan 2019 07:43:34 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.56,537,1539673200"; d="scan'208";a="270859494" Received: from cvg-ubt08.iil.intel.com ([143.185.152.136]) by orsmga004.jf.intel.com with ESMTP; 29 Jan 2019 07:43:32 -0800 From: Vladimir Kondratiev To: Greg Kroah-Hartman , Linus Torvalds Cc: linux-kernel@vger.kernel.org, Vladimir Kondratiev Subject: [PATCH] lib: 64bit IO Date: Tue, 29 Jan 2019 17:41:02 +0200 Message-Id: <20190129154102.17655-1-vladimir.kondratiev@linux.intel.com> X-Mailer: git-send-email 2.19.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org implement missing io{read|write}64 For 64-bit platforms, these 64-bit io functions are defined in include/asm-generic/iomap.h, but actual implementation missing. Provide it. Signed-off-by: Vladimir Kondratiev --- lib/iomap.c | 46 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) diff --git a/lib/iomap.c b/lib/iomap.c index 541d926da95e..5e2b0bcc5561 100644 --- a/lib/iomap.c +++ b/lib/iomap.c @@ -62,11 +62,17 @@ static void bad_io_access(unsigned long port, const char *access) #ifndef pio_read16be #define pio_read16be(port) swab16(inw(port)) #define pio_read32be(port) swab32(inl(port)) +#ifdef CONFIG_64BIT +#define pio_read64be(port) swab64(inq(port)) +#endif #endif #ifndef mmio_read16be #define mmio_read16be(addr) be16_to_cpu(__raw_readw(addr)) #define mmio_read32be(addr) be32_to_cpu(__raw_readl(addr)) +#ifdef CONFIG_64BIT +#define mmio_read64be(addr) be64_to_cpu(__raw_readq(addr)) +#endif #endif unsigned int ioread8(void __iomem *addr) @@ -100,14 +106,38 @@ EXPORT_SYMBOL(ioread16be); EXPORT_SYMBOL(ioread32); EXPORT_SYMBOL(ioread32be); +#ifdef CONFIG_64BIT + +u64 ioread64(void __iomem *addr) +{ + IO_COND(addr, return inq(port), return readq(addr)); + return 0xffffffffffffffffULL; +} +EXPORT_SYMBOL(ioread64); + +u64 ioread64be(void __iomem *addr) +{ + IO_COND(addr, return pio_read64be(port), return mmio_read64be(addr)); + return 0xffffffffffffffffULL; +} +EXPORT_SYMBOL(ioread64be); + +#endif /* CONFIG_64BIT */ + #ifndef pio_write16be #define pio_write16be(val,port) outw(swab16(val),port) #define pio_write32be(val,port) outl(swab32(val),port) +#ifdef CONFIG_64BIT +#define pio_write64be(val, port) outq(swab64(val), port) +#endif #endif #ifndef mmio_write16be #define mmio_write16be(val,port) __raw_writew(be16_to_cpu(val),port) #define mmio_write32be(val,port) __raw_writel(be32_to_cpu(val),port) +#ifdef CONFIG_64BIT +#define mmio_write64be(val, port) __raw_writeq(be64_to_cpu(val), port) +#endif #endif void iowrite8(u8 val, void __iomem *addr) @@ -136,6 +166,22 @@ EXPORT_SYMBOL(iowrite16be); EXPORT_SYMBOL(iowrite32); EXPORT_SYMBOL(iowrite32be); +#ifdef CONFIG_64BIT + +void iowrite64(u64 val, void __iomem *addr) +{ + IO_COND(addr, outq(val, port), writeq(val, addr)); +} +EXPORT_SYMBOL(iowrite64); + +void iowrite64be(u64 val, void __iomem *addr) +{ + IO_COND(addr, pio_write64be(val, port), mmio_write64be(val, addr)); +} +EXPORT_SYMBOL(iowrite64be); + +#endif /* CONFIG_64BIT */ + /* * These are the "repeat MMIO read/write" functions. * Note the "__raw" accesses, since we don't want to -- 2.19.1