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);
_______________________________________________
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to