From patchwork Thu Jan 17 15:21:59 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shawn Guo X-Patchwork-Id: 1997011 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) by patchwork2.kernel.org (Postfix) with ESMTP id 68EEFDF2E1 for ; Thu, 17 Jan 2013 15:25:07 +0000 (UTC) Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1TvrIL-0002t5-2u; Thu, 17 Jan 2013 15:22:21 +0000 Received: from co9ehsobe002.messaging.microsoft.com ([207.46.163.25] helo=co9outboundpool.messaging.microsoft.com) by merlin.infradead.org with esmtps (Exim 4.76 #1 (Red Hat Linux)) id 1TvrHk-0002jQ-1o for linux-arm-kernel@lists.infradead.org; Thu, 17 Jan 2013 15:21:46 +0000 Received: from mail201-co9-R.bigfish.com (10.236.132.231) by CO9EHSOBE013.bigfish.com (10.236.130.76) with Microsoft SMTP Server id 14.1.225.23; Thu, 17 Jan 2013 15:21:42 +0000 Received: from mail201-co9 (localhost [127.0.0.1]) by mail201-co9-R.bigfish.com (Postfix) with ESMTP id 296C63C0179; Thu, 17 Jan 2013 15:21:42 +0000 (UTC) X-Forefront-Antispam-Report: CIP:70.37.183.190; KIP:(null); UIP:(null); IPV:NLI; H:mail.freescale.net; RD:none; EFVD:NLI X-SpamScore: 0 X-BigFish: VS0(zzzz1ee6h1de0h1202h1e76h1d1ah1d2ahzz8275dhz2dh87h2a8h668h839hd24he5bhf0ah1288h12a5h12a9h12bdh12e5h137ah139eh13b6h1441h1504h1537h162dh1631h1758h1898h1155h) X-FB-DOMAIN-IP-MATCH: fail Received: from mail201-co9 (localhost.localdomain [127.0.0.1]) by mail201-co9 (MessageSwitch) id 135843610041633_31710; Thu, 17 Jan 2013 15:21:40 +0000 (UTC) Received: from CO9EHSMHS022.bigfish.com (unknown [10.236.132.249]) by mail201-co9.bigfish.com (Postfix) with ESMTP id 0624F800A0; Thu, 17 Jan 2013 15:21:40 +0000 (UTC) Received: from mail.freescale.net (70.37.183.190) by CO9EHSMHS022.bigfish.com (10.236.130.32) with Microsoft SMTP Server (TLS) id 14.1.225.23; Thu, 17 Jan 2013 15:21:38 +0000 Received: from az84smr01.freescale.net (10.64.34.197) by 039-SN1MMR1-005.039d.mgd.msft.net (10.84.1.17) with Microsoft SMTP Server (TLS) id 14.2.318.3; Thu, 17 Jan 2013 15:21:37 +0000 Received: from S2101-09.ap.freescale.net ([10.192.185.104]) by az84smr01.freescale.net (8.14.3/8.14.0) with ESMTP id r0HFLRpD005341; Thu, 17 Jan 2013 08:21:35 -0700 From: Shawn Guo To: Subject: [PATCH 2/2] ARM: use DEBUG_LL infrastructural for multiplatform uncompress debug Date: Thu, 17 Jan 2013 23:21:59 +0800 Message-ID: <1358436119-30808-3-git-send-email-shawn.guo@linaro.org> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1358436119-30808-1-git-send-email-shawn.guo@linaro.org> References: <1358436119-30808-1-git-send-email-shawn.guo@linaro.org> MIME-Version: 1.0 X-OriginatorOrg: sigmatel.com X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20130117_102144_503566_43F17744 X-CRM114-Status: GOOD ( 14.80 ) X-Spam-Score: -4.2 (----) X-Spam-Report: SpamAssassin version 3.3.2 on merlin.infradead.org summary: Content analysis details: (-4.2 points) pts rule name description ---- ---------------------- -------------------------------------------------- -2.3 RCVD_IN_DNSWL_MED RBL: Sender listed at http://www.dnswl.org/, medium trust [207.46.163.25 listed in list.dnswl.org] -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] Cc: arm@kernel.org, Russell King , Shawn Guo X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: linux-arm-kernel-bounces@lists.infradead.org Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org Instead of providing a dummy uncompress.h and losing the uncompress debug capability completely for multiplatform build, the patch turns the uncompress debug into part of DEBUG_LL support. Thus, when DEBUG_LL is turned on for a particular platform, uncompress debug works too for that platform. To have the uncompress debug work, what most platforms need is only a putc() implementation. Meanwhile, DEBUG_LL infrastructural already has printch() there. We direct putc() call to printch() by creating arch/arm/boot/compressed/debug.S which simply includes arch/arm/kernel/debug.S. However, there is a problem with above approach. DEBUG_LL routines will check MMU enable bit to decide whether physical or virtual address should be used to access debug port. In case virtual address needs to be used, the address returned by addruart will not work for decompressor who uses a different mapping from what kernel uses. Fortunately, decompressor uses a flat mapping (same physical and virtual addresses). So we can easily work it around by asking platform addruart return physical address as virtual address when it runs in decompressor. The macro UNCOMPRESS_DEBUG is defined for this use. Signed-off-by: Shawn Guo --- arch/arm/boot/compressed/Makefile | 3 +++ arch/arm/boot/compressed/debug.S | 3 +++ arch/arm/include/debug/highbank.S | 3 +++ arch/arm/include/debug/imx.S | 3 +++ arch/arm/include/debug/mvebu.S | 3 +++ arch/arm/include/debug/picoxcell.S | 3 +++ arch/arm/include/debug/socfpga.S | 3 +++ arch/arm/include/debug/sunxi.S | 3 +++ arch/arm/include/debug/tegra.S | 3 +++ arch/arm/include/debug/uncompress.h | 8 +++++++- arch/arm/include/debug/vexpress.S | 3 +++ arch/arm/include/debug/zynq.S | 3 +++ 12 files changed, 40 insertions(+), 1 deletion(-) create mode 100644 arch/arm/boot/compressed/debug.S diff --git a/arch/arm/boot/compressed/Makefile b/arch/arm/boot/compressed/Makefile index 5cad8a6..c9865f6 100644 --- a/arch/arm/boot/compressed/Makefile +++ b/arch/arm/boot/compressed/Makefile @@ -24,6 +24,9 @@ endif AFLAGS_head.o += -DTEXT_OFFSET=$(TEXT_OFFSET) HEAD = head.o OBJS += misc.o decompress.o +ifeq ($(CONFIG_DEBUG_LL),y) +OBJS += debug.o +endif FONTC = $(srctree)/drivers/video/console/font_acorn_8x8.c # string library code (-Os is enforced to keep it much smaller) diff --git a/arch/arm/boot/compressed/debug.S b/arch/arm/boot/compressed/debug.S new file mode 100644 index 0000000..7283d5c --- /dev/null +++ b/arch/arm/boot/compressed/debug.S @@ -0,0 +1,3 @@ +#define UNCOMPRESS_DEBUG + +#include "../../kernel/debug.S" diff --git a/arch/arm/include/debug/highbank.S b/arch/arm/include/debug/highbank.S index 8cad432..13056cf 100644 --- a/arch/arm/include/debug/highbank.S +++ b/arch/arm/include/debug/highbank.S @@ -12,6 +12,9 @@ .macro addruart,rp,rv,tmp ldr \rv, =0xfee36000 ldr \rp, =0xfff36000 +#ifdef UNCOMPRESS_DEBUG + mov \rv, \rp +#endif .endm #include diff --git a/arch/arm/include/debug/imx.S b/arch/arm/include/debug/imx.S index 619d8cc..257f160 100644 --- a/arch/arm/include/debug/imx.S +++ b/arch/arm/include/debug/imx.S @@ -31,6 +31,9 @@ .macro addruart, rp, rv, tmp ldr \rp, =UART_PADDR @ physical ldr \rv, =UART_VADDR @ virtual +#ifdef UNCOMPRESS_DEBUG + mov \rv, \rp +#endif .endm .macro senduart,rd,rx diff --git a/arch/arm/include/debug/mvebu.S b/arch/arm/include/debug/mvebu.S index 865c6d0..2024c1c 100644 --- a/arch/arm/include/debug/mvebu.S +++ b/arch/arm/include/debug/mvebu.S @@ -19,6 +19,9 @@ ldr \rv, =ARMADA_370_XP_REGS_VIRT_BASE orr \rp, \rp, #0x00012000 orr \rv, \rv, #0x00012000 +#ifdef UNCOMPRESS_DEBUG + mov \rv, \rp +#endif .endm #define UART_SHIFT 2 diff --git a/arch/arm/include/debug/picoxcell.S b/arch/arm/include/debug/picoxcell.S index bc1f07c..0869efc 100644 --- a/arch/arm/include/debug/picoxcell.S +++ b/arch/arm/include/debug/picoxcell.S @@ -14,6 +14,9 @@ .macro addruart, rp, rv, tmp ldr \rv, =PHYS_TO_IO(PICOXCELL_UART1_BASE) ldr \rp, =PICOXCELL_UART1_BASE +#ifdef UNCOMPRESS_DEBUG + mov \rv, \rp +#endif .endm #include "8250_32.S" diff --git a/arch/arm/include/debug/socfpga.S b/arch/arm/include/debug/socfpga.S index 966b2f9..0298e12 100644 --- a/arch/arm/include/debug/socfpga.S +++ b/arch/arm/include/debug/socfpga.S @@ -15,6 +15,9 @@ orr \rp, \rp, #0x00c00000 orr \rv, \rp, #0xfe000000 @ virtual base orr \rp, \rp, #0xff000000 @ physical base +#ifdef UNCOMPRESS_DEBUG + mov \rv, \rp +#endif .endm #include "8250_32.S" diff --git a/arch/arm/include/debug/sunxi.S b/arch/arm/include/debug/sunxi.S index 04eb56d..5c40a3a 100644 --- a/arch/arm/include/debug/sunxi.S +++ b/arch/arm/include/debug/sunxi.S @@ -21,6 +21,9 @@ .macro addruart, rp, rv, tmp ldr \rp, =SUNXI_UART_DEBUG_PHYS_BASE ldr \rv, =SUNXI_UART_DEBUG_VIRT_BASE +#ifdef UNCOMPRESS_DEBUG + mov \rv, \rp +#endif .endm #define UART_SHIFT 2 diff --git a/arch/arm/include/debug/tegra.S b/arch/arm/include/debug/tegra.S index 883d7c2..789fcb4 100644 --- a/arch/arm/include/debug/tegra.S +++ b/arch/arm/include/debug/tegra.S @@ -188,6 +188,9 @@ /* Load previously selected UART address */ 100: ldr \rp, [\tmp, #4] @ Load tegra_uart_phys ldr \rv, [\tmp, #8] @ Load tegra_uart_virt +#ifdef UNCOMPRESS_DEBUG + mov \rv, \rp +#endif .endm /* diff --git a/arch/arm/include/debug/uncompress.h b/arch/arm/include/debug/uncompress.h index e19955d..b142a84 100644 --- a/arch/arm/include/debug/uncompress.h +++ b/arch/arm/include/debug/uncompress.h @@ -1,3 +1,9 @@ -static inline void putc(int c) {} +#ifdef CONFIG_DEBUG_LL +extern void printch(int c); +#else +static inline void printch(int c) {} +#endif + +static inline void putc(int c) { printch(c); } static inline void flush(void) {} static inline void arch_decomp_setup(void) {} diff --git a/arch/arm/include/debug/vexpress.S b/arch/arm/include/debug/vexpress.S index dc8e882..5015a01 100644 --- a/arch/arm/include/debug/vexpress.S +++ b/arch/arm/include/debug/vexpress.S @@ -43,6 +43,9 @@ orrne \rv, \rp, #DEBUG_LL_VIRT_BASE orrne \rp, \rp, #DEBUG_LL_PHYS_BASE_RS1 +#ifdef UNCOMPRESS_DEBUG + mov \rv, \rp +#endif .endm #include diff --git a/arch/arm/include/debug/zynq.S b/arch/arm/include/debug/zynq.S index f9aa974..2795a64 100644 --- a/arch/arm/include/debug/zynq.S +++ b/arch/arm/include/debug/zynq.S @@ -35,6 +35,9 @@ .macro addruart, rp, rv, tmp ldr \rp, =LL_UART_PADDR @ physical ldr \rv, =LL_UART_VADDR @ virtual +#ifdef UNCOMPRESS_DEBUG + mov \rv, \rp +#endif .endm .macro senduart,rd,rx