From patchwork Tue Jun 27 16:06:41 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 781278 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 3wxrQf6BFTz9s2G for ; Wed, 28 Jun 2017 02:06:50 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751576AbdF0QGs (ORCPT ); Tue, 27 Jun 2017 12:06:48 -0400 Received: from mga11.intel.com ([192.55.52.93]:46034 "EHLO mga11.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751893AbdF0QGs (ORCPT ); Tue, 27 Jun 2017 12:06:48 -0400 Received: from orsmga003.jf.intel.com ([10.7.209.27]) by fmsmga102.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 27 Jun 2017 09:06:46 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.39,401,1493708400"; d="scan'208";a="985776383" Received: from black.fi.intel.com ([10.237.72.28]) by orsmga003.jf.intel.com with ESMTP; 27 Jun 2017 09:06:43 -0700 Received: by black.fi.intel.com (Postfix, from userid 1003) id 217D2D6; Tue, 27 Jun 2017 19:06:42 +0300 (EEST) From: Andy Shevchenko To: Ingo Molnar , x86@kernel.org, Thomas Gleixner , "H. Peter Anvin" , linux-kernel@vger.kernel.org, Baolin Wang , wsa@the-dreams.de, linux-i2c@vger.kernel.org, Mika Westerberg Cc: Andy Shevchenko Subject: [PATCH v1] x86/io: Include asm-generic/io.h to architectural code Date: Tue, 27 Jun 2017 19:06:41 +0300 Message-Id: <20170627160641.75712-1-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.11.0 Sender: linux-i2c-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-i2c@vger.kernel.org asm-generic/io.h defines few helpers which would be useful in the drivers, such as writesb() and readsb(). Include it to the asm/io.h in architectural folder. Note, to apply above we need to define macros for functions which do not have them yet defined, such as readb() or writeb(). This is done here as well. Signed-off-by: Andy Shevchenko Acked-by: Wolfram Sang --- arch/x86/include/asm/io.h | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/arch/x86/include/asm/io.h b/arch/x86/include/asm/io.h index 7afb0e2f07f4..abb3090a5822 100644 --- a/arch/x86/include/asm/io.h +++ b/arch/x86/include/asm/io.h @@ -69,6 +69,9 @@ build_mmio_write(__writeb, "b", unsigned char, "q", ) build_mmio_write(__writew, "w", unsigned short, "r", ) build_mmio_write(__writel, "l", unsigned int, "r", ) +#define readb readb +#define readw readw +#define readl readl #define readb_relaxed(a) __readb(a) #define readw_relaxed(a) __readw(a) #define readl_relaxed(a) __readl(a) @@ -76,6 +79,9 @@ build_mmio_write(__writel, "l", unsigned int, "r", ) #define __raw_readw __readw #define __raw_readl __readl +#define writeb writeb +#define writew writew +#define writel writel #define writeb_relaxed(v, a) __writeb(v, a) #define writew_relaxed(v, a) __writew(v, a) #define writel_relaxed(v, a) __writel(v, a) @@ -119,6 +125,7 @@ static inline phys_addr_t virt_to_phys(volatile void *address) { return __pa(address); } +#define virt_to_phys virt_to_phys /** * phys_to_virt - map physical address to virtual @@ -137,6 +144,7 @@ static inline void *phys_to_virt(phys_addr_t address) { return __va(address); } +#define phys_to_virt phys_to_virt /* * Change "struct page" to physical address. @@ -220,6 +228,7 @@ memset_io(volatile void __iomem *addr, unsigned char val, size_t count) { memset((void __force *)addr, val, count); } +#define memset_io(dst,c,count) memset_io(dst,c,count) /** * memcpy_fromio Copy a block of data from I/O memory @@ -234,6 +243,7 @@ memcpy_fromio(void *dst, const volatile void __iomem *src, size_t count) { memcpy(dst, (const void __force *)src, count); } +#define memcpy_fromio(to,from,count) memcpy_fromio(to,from,count) /** * memcpy_toio Copy a block of data into I/O memory @@ -248,6 +258,7 @@ memcpy_toio(volatile void __iomem *dst, const void *src, size_t count) { memcpy((void __force *)dst, src, count); } +#define memcpy_toio(to,from,count) memcpy_toio(to,from,count) /* * ISA space is 'always mapped' on a typical x86 system, no need to @@ -341,9 +352,32 @@ BUILDIO(b, b, char) BUILDIO(w, w, short) BUILDIO(l, , int) +#define inb inb +#define inw inw +#define inl inl +#define inb_p inb_p +#define inw_p inw_p +#define inl_p inl_p +#define insb insb +#define insw insw +#define insl insl + +#define outb outb +#define outw outw +#define outl outl +#define outb_p outb_p +#define outw_p outw_p +#define outl_p outl_p +#define outsb outsb +#define outsw outsw +#define outsl outsl + extern void *xlate_dev_mem_ptr(phys_addr_t phys); extern void unxlate_dev_mem_ptr(phys_addr_t phys, void *addr); +#define xlate_dev_mem_ptr xlate_dev_mem_ptr +#define unxlate_dev_mem_ptr unxlate_dev_mem_ptr + extern int ioremap_change_attr(unsigned long vaddr, unsigned long size, enum page_cache_mode pcm); extern void __iomem *ioremap_wc(resource_size_t offset, unsigned long size); @@ -365,6 +399,8 @@ extern bool xen_biovec_phys_mergeable(const struct bio_vec *vec1, #define IO_SPACE_LIMIT 0xffff +#include + #ifdef CONFIG_MTRR extern int __must_check arch_phys_wc_index(int handle); #define arch_phys_wc_index arch_phys_wc_index