Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp2984919rwd; Fri, 19 May 2023 13:05:58 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4EfS7bMk2Tn+2Z/vOl3t9vP9pg5S2fUDWDEtLw8YOpsP/N2OMebn2dh06p9510LwoyPMi2 X-Received: by 2002:a17:902:f641:b0:1ac:5d9b:d971 with SMTP id m1-20020a170902f64100b001ac5d9bd971mr6291008plg.34.1684526758372; Fri, 19 May 2023 13:05:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684526758; cv=none; d=google.com; s=arc-20160816; b=EYWRe1S3aBKhtL5q8onVhKpN/hEtOt+dGybQAmXf7qIYp5V28DpO74BMzLgWGqJWv3 /Nv26+8068Dwi60WjPGIUC6ifp29FD7gxbHGa4hToPLxW2C+qocgWa3bbXzSDtIFNFii SAP8xg4aohWzsnAza6dxJSJGMbYzpeBMq0/ERqm7ae9T7+gapbVG9+hiDvg3nws2jCRU goNWE2U0T7xzGjj8cPGkP/9k2il3Wc4nfB9qT4enUAVMFPPkPsyxHoLBK9Az3dbYT/Ym AhOipSEL4BhPTmHUP/sWFQWQDq7APoSmlvuYZFhOct9NV72yYyqR4ERyBSkZDE0Van14 v2ig== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:feedback-id:dkim-signature :dkim-signature; bh=9Ue55PNTF4QaBoX9cm2KiiX1+jDjMSVX9qJLLW4yuTE=; b=YrqYMO8TWVmXkMjkU3GTdubSY46R+PkUBeY6uFSlZi9LeHf9WEocwKq4u75wSYAEQ6 T7N6IZlhJE+fDK7pECS7udLJY3QleOZdNN6GxFy+gWHgBWsjaVIyLT+rEfL0wA8Z+VNG QWaSfVT/FmAFRjFlspDWFJHoDajBuxBDZP41wvR0ZsLGYS6PlEuosAUxlXN3z/B7fO0Q k805mgNAf/GmIvr5gj8Es0baRs7E1pxrAsO4+claPQ9vbHpTB1xfJ0+r4R+MSmSdIZN8 tV5TORwBtDtPoa/lRN9G0L396qgTZjPtug/tCPqEmPCw0bB2sy+ZH5ShRK150XnIAG68 YPQA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@flygoat.com header.s=fm2 header.b=q5c0LGDC; dkim=pass header.i=@messagingengine.com header.s=fm1 header.b=n9z6Hj2w; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=flygoat.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id jf4-20020a170903268400b001ae5fe35b6dsi58303plb.177.2023.05.19.13.05.45; Fri, 19 May 2023 13:05:58 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@flygoat.com header.s=fm2 header.b=q5c0LGDC; dkim=pass header.i=@messagingengine.com header.s=fm1 header.b=n9z6Hj2w; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=flygoat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231290AbjESTv6 (ORCPT + 99 others); Fri, 19 May 2023 15:51:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42734 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229871AbjESTvz (ORCPT ); Fri, 19 May 2023 15:51:55 -0400 Received: from wout5-smtp.messagingengine.com (wout5-smtp.messagingengine.com [64.147.123.21]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E19E81B4; Fri, 19 May 2023 12:51:53 -0700 (PDT) Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.west.internal (Postfix) with ESMTP id C89973200990; Fri, 19 May 2023 15:51:50 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute4.internal (MEProxy); Fri, 19 May 2023 15:51:51 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=flygoat.com; h= cc:cc:content-transfer-encoding:content-type:date:date:from:from :in-reply-to:message-id:mime-version:reply-to:sender:subject :subject:to:to; s=fm2; t=1684525910; x=1684612310; bh=9Ue55PNTF4 QaBoX9cm2KiiX1+jDjMSVX9qJLLW4yuTE=; b=q5c0LGDCsmNtXet0dY5h+YEIFJ wES6On7QlKcuyJCv2nYiJHBAFdYKBfyvlCt/mTCPOGt1FgdcMRwmTQRg/wBs1Ubn qKmoXsWUftzFyZV4fNnR8uEwuysICI1Up/8e1RX1Kvujz031I22N7WdWajEr+sPV yP0OevuGBng6qFDdjLxDurcgmTtkolo3OTTUE0dlrAmxVQ71C+3jGauh2VhG6PsV 51gC57y2DIIc3sF20dVWo7Bt2P3bi4r59MhqrRDdmd/bBJIM46WQ2Hak3JebULxY +01jTolCKlpaeVFatLtnM1QXg19GIT4V/jtJzYQT5pelx/j+6k/rRzV+LwgA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:date:date:feedback-id:feedback-id:from:from :in-reply-to:message-id:mime-version:reply-to:sender:subject :subject:to:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm1; t=1684525910; x=1684612310; bh=9Ue55PNTF4QaB oX9cm2KiiX1+jDjMSVX9qJLLW4yuTE=; b=n9z6Hj2wjed23Hl99aB1RYvDendbE TQ1PYFzYfz+WY0xdb4to10Rb14m7/vF0YGq+nwcQHi8XuS6GVH8siUkbKNnlXp0I 3W3EWThSHxW0yaGVevVR/jaf4DNbmajsZuiysURrokLNOYuvXZ+GQtojhe0Ks2VT MVEH12/m+UTPk9EllNUp+Y4/MuLGMdxOKw4WdgtXs/hEsHjf+98MHONWmTJNiaru 40tTwzaYYKeP7erKuBdPaNcOyK+D3wvcDrRkcZ8zciLnWhbzx506gTg4RxkzZ+Xr je1BOxKLyUgX8m94OxzQtK8Bxv9t+D+yMpvXIIRuB+NZVQjwmf1EtB30w== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvhedrfeeihedgudegvdcutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh necuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmd enucfjughrpefhvfevufffkffoggfgsedtkeertdertddtnecuhfhrohhmpeflihgrgihu nhcujggrnhhguceojhhirgiguhhnrdihrghnghesfhhlhihgohgrthdrtghomheqnecugg ftrfgrthhtvghrnhephfetuddtudevieeljeejteffheeujeduhefgffejudfhueelledu ffefgfffveeknecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrh homhepjhhirgiguhhnrdihrghnghesfhhlhihgohgrthdrtghomh X-ME-Proxy: Feedback-ID: ifd894703:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Fri, 19 May 2023 15:51:48 -0400 (EDT) From: Jiaxun Yang To: linux-mips@vger.kernel.org Cc: linux-kernel@vger.kernel.org, tsbogend@alpha.franken.de, linux-arch@vger.kernel.org, arnd@arndb.de, Jiaxun Yang , Baoquan He , Huacai Chen Subject: [PATCH v4] mips: add including Date: Fri, 19 May 2023 20:51:35 +0100 Message-Id: <20230519195135.79600-1-jiaxun.yang@flygoat.com> X-Mailer: git-send-email 2.39.2 (Apple Git-143) MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW,SPF_HELO_PASS, SPF_PASS,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org With the adding, some default ioremap_xx methods defined in asm-generic/io.h can be used. E.g the default ioremap_uc() returning NULL. We also massaged various headers to avoid nested includes. Signed-off-by: Baoquan He Signed-off-by: Jiaxun Yang [jiaxun.yang@flygoat.com: Massage more headers, fix ioport defines] Cc: Thomas Bogendoerfer Cc: Huacai Chen Cc: Jiaxun Yang Cc: linux-mips@vger.kernel.org --- Tested against qemu malta 34Kf, boston I6500, Loongson64, hopefully everything is fine now. --- arch/mips/include/asm/io.h | 65 +++++++++++++++++++++++++++++---- arch/mips/include/asm/mmiowb.h | 4 +- arch/mips/include/asm/smp-ops.h | 2 - arch/mips/include/asm/smp.h | 4 +- arch/mips/kernel/setup.c | 1 + arch/mips/pci/pci-ip27.c | 3 ++ 6 files changed, 64 insertions(+), 15 deletions(-) diff --git a/arch/mips/include/asm/io.h b/arch/mips/include/asm/io.h index cc28d207a061..8508d01fb75e 100644 --- a/arch/mips/include/asm/io.h +++ b/arch/mips/include/asm/io.h @@ -15,7 +15,6 @@ #define ARCH_HAS_IOREMAP_WC #include -#include #include #include @@ -28,7 +27,6 @@ #include #include #include -#include #include #include @@ -44,6 +42,11 @@ # define __raw_ioswabq(a, x) (x) # define ____raw_ioswabq(a, x) (x) +# define _ioswabb ioswabb +# define _ioswabw ioswabw +# define _ioswabl ioswabl +# define _ioswabq ioswabq + # define __relaxed_ioswabb ioswabb # define __relaxed_ioswabw ioswabw # define __relaxed_ioswabl ioswabl @@ -129,6 +132,7 @@ static inline phys_addr_t virt_to_phys(const volatile void *x) * almost all conceivable cases a device driver should not be using * this function */ +#define phys_to_virt phys_to_virt static inline void * phys_to_virt(unsigned long address) { return __va(address); @@ -297,9 +301,9 @@ static inline type pfx##read##bwlq(const volatile void __iomem *mem) \ return pfx##ioswab##bwlq(__mem, __val); \ } -#define __BUILD_IOPORT_SINGLE(pfx, bwlq, type, barrier, relax, p) \ +#define __BUILD_IOPORT_SINGLE(pfx, bwlq, type, barrier, relax) \ \ -static inline void pfx##out##bwlq##p(type val, unsigned long port) \ +static inline void pfx##out##bwlq(type val, unsigned long port) \ { \ volatile type *__addr; \ type __val; \ @@ -319,7 +323,7 @@ static inline void pfx##out##bwlq##p(type val, unsigned long port) \ *__addr = __val; \ } \ \ -static inline type pfx##in##bwlq##p(unsigned long port) \ +static inline type pfx##in##bwlq(unsigned long port) \ { \ volatile type *__addr; \ type __val; \ @@ -361,11 +365,10 @@ __BUILD_MEMORY_PFX(__mem_, q, u64, 0) #endif #define __BUILD_IOPORT_PFX(bus, bwlq, type) \ - __BUILD_IOPORT_SINGLE(bus, bwlq, type, 1, 0,) \ - __BUILD_IOPORT_SINGLE(bus, bwlq, type, 1, 0, _p) + __BUILD_IOPORT_SINGLE(bus, bwlq, type, 1, 0) #define BUILDIO_IOPORT(bwlq, type) \ - __BUILD_IOPORT_PFX(, bwlq, type) \ + __BUILD_IOPORT_PFX(_, bwlq, type) \ __BUILD_IOPORT_PFX(__mem_, bwlq, type) BUILDIO_IOPORT(b, u8) @@ -481,14 +484,17 @@ BUILDSTRING(l, u32) BUILDSTRING(q, u64) #endif +#define memset_io memset_io static inline void memset_io(volatile void __iomem *addr, unsigned char val, int count) { memset((void __force *) addr, val, count); } +#define memcpy_fromio memcpy_fromio static inline void memcpy_fromio(void *dst, const volatile void __iomem *src, int count) { memcpy(dst, (void __force *) src, count); } +#define memcpy_toio memcpy_toio static inline void memcpy_toio(volatile void __iomem *dst, const void *src, int count) { memcpy((void __force *) dst, src, count); @@ -549,6 +555,47 @@ extern void (*_dma_cache_inv)(unsigned long start, unsigned long size); #define csr_out32(v, a) (*(volatile u32 *)((unsigned long)(a) + __CSR_32_ADJUST) = (v)) #define csr_in32(a) (*(volatile u32 *)((unsigned long)(a) + __CSR_32_ADJUST)) + +#define __raw_readb __raw_readb +#define __raw_readw __raw_readw +#define __raw_readl __raw_readl +#define __raw_readq __raw_readq +#define __raw_writeb __raw_writeb +#define __raw_writew __raw_writew +#define __raw_writel __raw_writel +#define __raw_writeq __raw_writeq + +#define readb readb +#define readw readw +#define readl readl +#define writeb writeb +#define writew writew +#define writel writel + +#define readsb readsb +#define readsw readsw +#define readsl readsl +#define readsq readsq +#define writesb writesb +#define writesw writesw +#define writesl writesl +#define writesq writesq + +#define _inb _inb +#define _inw _inw +#define _inl _inl +#define insb insb +#define insw insw +#define insl insl + +#define _outb _outb +#define _outw _outw +#define _outl _outl +#define outsb outsb +#define outsw outsw +#define outsl outsl + + /* * Convert a physical pointer to a virtual kernel pointer for /dev/mem * access @@ -557,4 +604,6 @@ extern void (*_dma_cache_inv)(unsigned long start, unsigned long size); void __ioread64_copy(void *to, const void __iomem *from, size_t count); +#include + #endif /* _ASM_IO_H */ diff --git a/arch/mips/include/asm/mmiowb.h b/arch/mips/include/asm/mmiowb.h index a40824e3ef8e..cf27752fd220 100644 --- a/arch/mips/include/asm/mmiowb.h +++ b/arch/mips/include/asm/mmiowb.h @@ -2,9 +2,9 @@ #ifndef _ASM_MMIOWB_H #define _ASM_MMIOWB_H -#include +#include -#define mmiowb() iobarrier_w() +#define mmiowb() wmb() #include diff --git a/arch/mips/include/asm/smp-ops.h b/arch/mips/include/asm/smp-ops.h index 5719ff49eff1..a6941b7f0cc0 100644 --- a/arch/mips/include/asm/smp-ops.h +++ b/arch/mips/include/asm/smp-ops.h @@ -13,8 +13,6 @@ #include -#include - #ifdef CONFIG_SMP #include diff --git a/arch/mips/include/asm/smp.h b/arch/mips/include/asm/smp.h index aab8981bc32c..125c3494a010 100644 --- a/arch/mips/include/asm/smp.h +++ b/arch/mips/include/asm/smp.h @@ -11,13 +11,11 @@ #ifndef __ASM_SMP_H #define __ASM_SMP_H -#include +#include #include -#include #include #include -#include #include extern int smp_num_siblings; diff --git a/arch/mips/kernel/setup.c b/arch/mips/kernel/setup.c index febdc5564638..f9f149928e46 100644 --- a/arch/mips/kernel/setup.c +++ b/arch/mips/kernel/setup.c @@ -41,6 +41,7 @@ #include #include #include +#include #include #include diff --git a/arch/mips/pci/pci-ip27.c b/arch/mips/pci/pci-ip27.c index d85cbf84e41c..973faea61cad 100644 --- a/arch/mips/pci/pci-ip27.c +++ b/arch/mips/pci/pci-ip27.c @@ -7,6 +7,9 @@ * Copyright (C) 1999, 2000, 04 Ralf Baechle (ralf@linux-mips.org) * Copyright (C) 1999, 2000 Silicon Graphics, Inc. */ + +#include + #include #include #include -- 2.39.2 (Apple Git-143)