From owner-svn-src-all@FreeBSD.ORG Wed May 14 22:52:18 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 313A410E; Wed, 14 May 2014 22:52:18 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 11A70234C; Wed, 14 May 2014 22:52:18 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.8/8.14.8) with ESMTP id s4EMqH9Z003931; Wed, 14 May 2014 22:52:17 GMT (envelope-from ian@svn.freebsd.org) Received: (from ian@localhost) by svn.freebsd.org (8.14.8/8.14.8/Submit) id s4EMqGma003919; Wed, 14 May 2014 22:52:16 GMT (envelope-from ian@svn.freebsd.org) Message-Id: <201405142252.s4EMqGma003919@svn.freebsd.org> From: Ian Lepore Date: Wed, 14 May 2014 22:52:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r266094 - in stable/10/sys: arm/arm arm/at91 arm/conf conf kern sys X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 14 May 2014 22:52:18 -0000 Author: ian Date: Wed May 14 22:52:16 2014 New Revision: 266094 URL: http://svnweb.freebsd.org/changeset/base/266094 Log: MFC r261038, r261039, r261040, r261041 Implement generic support for early printf. Modified: stable/10/sys/arm/arm/locore.S stable/10/sys/arm/at91/uart_dev_at91usart.c stable/10/sys/arm/conf/HL201 stable/10/sys/conf/options stable/10/sys/conf/options.arm stable/10/sys/kern/subr_prf.c stable/10/sys/sys/systm.h Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/arm/arm/locore.S ============================================================================== --- stable/10/sys/arm/arm/locore.S Wed May 14 22:24:09 2014 (r266093) +++ stable/10/sys/arm/arm/locore.S Wed May 14 22:52:16 2014 (r266094) @@ -258,9 +258,13 @@ mmu_init_table: /* fill all table VA==PA */ /* map SDRAM VA==PA, WT cacheable */ #if !defined(SMP) - MMU_INIT(PHYSADDR, PHYSADDR , 64, L1_TYPE_S|L1_S_C|L1_S_AP(AP_KRW)) + MMU_INIT(PHYSADDR, PHYSADDR, 64, L1_TYPE_S|L1_S_C|L1_S_AP(AP_KRW)) /* map VA 0xc0000000..0xc3ffffff to PA */ MMU_INIT(KERNBASE, PHYSADDR, 64, L1_TYPE_S|L1_S_C|L1_S_AP(AP_KRW)) +#if defined(SOCDEV_PA) && defined(SOCKDEV_VA) + /* Map in 0x04000000 worth of the SoC's devices for bootstrap debugging */ + MMU_INIT(SOCKDEV_VA, SOCDEV_PA, 64, L1_TYPE_S|L1_S_C|L1_S_AP(AP_KRW)) +#endif #else MMU_INIT(PHYSADDR, PHYSADDR , 64, L1_TYPE_S|L1_SHARED|L1_S_C|L1_S_AP(AP_KRW)) /* map VA 0xc0000000..0xc3ffffff to PA */ Modified: stable/10/sys/arm/at91/uart_dev_at91usart.c ============================================================================== --- stable/10/sys/arm/at91/uart_dev_at91usart.c Wed May 14 22:24:09 2014 (r266093) +++ stable/10/sys/arm/at91/uart_dev_at91usart.c Wed May 14 22:52:16 2014 (r266094) @@ -276,6 +276,24 @@ at91_usart_putc(struct uart_bas *bas, in WR4(bas, USART_THR, c); } +#ifdef EARLY_PRINTF +/* + * Early printf support. This assumes that we have the SoC "system" devices + * mapped into AT91_BASE. To use this before we adjust the boostrap tables, + * You'll need to define SOCDEV_VA to be 0xdc000000 and SOCDEV_PA to be + * 0xfc000000 in your config file where you define EARLY_PRINTF + */ +volatile uint32_t *at91_dbgu = (volatile uint32_t *)(AT91_BASE + AT91_DBGU0); + +void +eputc(int c) +{ + while (!(at91_dbgu[USART_CSR / 4] & USART_CSR_TXRDY)) + continue; + at91_dbgu[USART_THR / 4] = c; +} +#endif + /* * Check for a character available. */ Modified: stable/10/sys/arm/conf/HL201 ============================================================================== --- stable/10/sys/arm/conf/HL201 Wed May 14 22:24:09 2014 (r266093) +++ stable/10/sys/arm/conf/HL201 Wed May 14 22:52:16 2014 (r266094) @@ -1,4 +1,4 @@ -# Kernel configuration for the AT91SAM9 based Hot-e configuration file +# Kernel configuration for the AT91SAM9G20 based Hot-e configuration file # # For more information on this file, please read the handbook section on # Kernel Configuration Files: @@ -39,16 +39,16 @@ options FFS #Berkeley Fast Filesystem #options MD_ROOT #MD is a potential root device #options MD_ROOT_SIZE=4096 # 4MB ram disk options NANDFS # NAND file system -#options ROOTDEVNAME=\"ufs:/dev/mmcsd0s1a\" +options ROOTDEVNAME=\"ufs:/dev/mmcsd0s1a\" options NFSCL #New Network Filesystem Client #options NFSD #New Network Filesystem Server #options NFSLOCKD #Network Lock Manager options NFS_ROOT #NFS usable as /, requires NFSCL -options BOOTP_NFSROOT -options BOOTP -options BOOTP_NFSV3 +#options BOOTP_NFSROOT +#options BOOTP +#options BOOTP_NFSV3 #options BOOTP_WIRED_TO=ate0 -options BOOTP_COMPAT +#options BOOTP_COMPAT options ALT_BREAK_TO_DEBUGGER @@ -62,7 +62,6 @@ options SYSVSHM #SYSV-style shared me options SYSVMSG #SYSV-style message queues options SYSVSEM #SYSV-style semaphores options _KPOSIX_PRIORITY_SCHEDULING #Posix P1003_1B real-time extensions -#options SYSCTL_OMIT_DESCR options MUTEX_NOINLINE options RWLOCK_NOINLINE options NO_FFS_SNAPSHOT @@ -83,22 +82,11 @@ device mii #options DIAGNOSTIC device md -#device at91_twi # TWI: Two Wire Interface -#device at91_spi # SPI: -device spibus -# MMC/SD -#device at91_mci -#device mmc -#device mmcsd -# iic -device iic -device iicbus -device icee - device bpf + # USB support options USB_HOST_ALIGN=32 # Align usb buffers to cache line size. -#device ohci # OHCI localbus->USB interface +device ohci # OHCI localbus->USB interface device usb # USB Bus (required) #device udbp # USB Double Bulk Pipe devices device uhid # "Human Interface Devices" @@ -132,5 +120,14 @@ device pass # Passthrough device (dire #device wlan_amrr # AMRR transmit rate control algorithm options ROOTDEVNAME=\"ufs:da0s1a\" -# NAND Flash - my board as 128MB Samsung part -device nand # NAND interface on CS3 +# NAND Flash - my board as 128MB Samsung part, YMMV. +device nand # NAND interface on CS3 + +# Coming soon, but not yet +#options FDT +#options FDT_DTB_STATIC +#makeoptions FDT_DTS_FILE=at91sam9g20ek.dts + +options EARLY_PRINTF +options SOCDEV_PA=0xfc000000 +options SOCDEV_VA=0xdc000000 Modified: stable/10/sys/conf/options ============================================================================== --- stable/10/sys/conf/options Wed May 14 22:24:09 2014 (r266093) +++ stable/10/sys/conf/options Wed May 14 22:52:16 2014 (r266094) @@ -62,6 +62,7 @@ KDB_TRACE opt_kdb.h KDB_UNATTENDED opt_kdb.h KLD_DEBUG opt_kld.h SYSCTL_DEBUG opt_sysctl.h +EARLY_PRINTF opt_global.h TEXTDUMP_PREFERRED opt_ddb.h TEXTDUMP_VERBOSE opt_ddb.h Modified: stable/10/sys/conf/options.arm ============================================================================== --- stable/10/sys/conf/options.arm Wed May 14 22:24:09 2014 (r266093) +++ stable/10/sys/conf/options.arm Wed May 14 22:52:16 2014 (r266094) @@ -36,6 +36,8 @@ LINUX_BOOT_ABI opt_global.h LOADERRAMADDR opt_global.h NO_EVENTTIMERS opt_timer.h PHYSADDR opt_global.h +SOCDEV_PA opt_global.h +SOCDEV_VA opt_global.h PV_STATS opt_pmap.h QEMU_WORKAROUNDS opt_global.h SOC_MV_ARMADAXP opt_global.h Modified: stable/10/sys/kern/subr_prf.c ============================================================================== --- stable/10/sys/kern/subr_prf.c Wed May 14 22:24:09 2014 (r266093) +++ stable/10/sys/kern/subr_prf.c Wed May 14 22:52:16 2014 (r266094) @@ -1122,3 +1122,25 @@ hexdump(const void *ptr, int length, con printf("\n"); } } +#ifdef EARLY_PRINTF +/* + * Support for calling an alternate printf early in boot (like before + * cn_init() can be called). Platforms need to define eputc that want + * to use this. + */ +static void +early_putc_func(int ch, void *arg __unused) +{ + eputc(ch); +} + +void +eprintf(const char *fmt, ...) +{ + va_list ap; + + va_start(ap, fmt); + kvprintf(fmt, early_putc_func, NULL, 10, ap); + va_end(ap); +} +#endif Modified: stable/10/sys/sys/systm.h ============================================================================== --- stable/10/sys/sys/systm.h Wed May 14 22:24:09 2014 (r266093) +++ stable/10/sys/sys/systm.h Wed May 14 22:52:16 2014 (r266094) @@ -196,6 +196,10 @@ void init_param1(void); void init_param2(long physpages); void init_static_kenv(char *, size_t); void tablefull(const char *); +#ifdef EARLY_PRINTF +void eprintf(const char *, ...) __printflike(1, 2); +void eputc(int ch); +#endif int kvprintf(char const *, void (*)(int, void*), void *, int, __va_list) __printflike(1, 0); void log(int, const char *, ...) __printflike(2, 3);