Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 03 Dec 2014 23:40:02 +0900
From:      Jaemin Yoo <zaemin.yoo@gmail.com>
To:        freebsd-arm@freebsd.org
Subject:   hack patch for enabling uart on aarch64 mustang board
Message-ID:  <547F20C2.6050000@gmail.com>

next in thread | raw e-mail | index | archive | help

Hello,

You've ever heard about aarch64, armv8, arm64 and etc. I'm also interested
in it and tried to get the real board. But it wasn't that easy and I could
only buy a dev board called 'mustang' from Applied Micro.

Thanks for the great work by Andrew Turner and Semihalf, I could build
loader.efi and kernel without problem. Also I could boot them from sdcard.
FYI, I used bundled efi firmware to load loader.efi.


-----------------------------------------------------------------------
EFI Firmware: X-Gene Mustang Board EFI Aug 25 2014 14:20:27 (rev 0.00)

FreeBSD/arm64 EFI loader, Revision 1.0
(jmin@maui, Mon Oct 27 04:09:00 KST 2014)
\
/kernel data=0x53f070+0x52008 syms=[0x8+0x981c0+0x8+0x9db6d]
Hit [Enter] to boot immediately, or any other key for command prompt.
Booting [/kernel]...
Using DTB provided by EFI at 0x43ffa4fa30.
L3c Cache: 8MB
In initarm on arm64
ERROR loading DTB
0 - 0
4000000000 - 43fa961000
43faaf2000 - 43ffab6000
43ffafc000 - 4400000000
Total = 3ffe29000
pmap_bootstrap ffffff8000004000 43f8800000 6c8000
ffffff8000004000
0
End initarm
VERBOSE_SYSINIT: DDB not enabled, symbol lookups disabled.
Copyright (c) 1992-2014 The FreeBSD Project.
Copyright (c) 1979, 1980, 1983, 1986, 1988, 1989, 1991, 1992, 1993, 1994
        The Regents of the University of California. All rights reserved.
FreeBSD is a registered trademark of The FreeBSD Foundation.
FreeBSD 11.0-CURRENT #3 b405bd9(arm64-dev)-dirty: Mon Oct 27 05:48:25 KST 2014
    jmin@maui:/usr/obj/arm64.arm64/usr/home/jmin/src/arm64/sys/GENERIC arm64
FreeBSD clang version 3.4.1 (tags/RELEASE_34/dot1-final 208032) 20140512
subsystem 1000000
   0xffffff800040120c(0)..
--------------------------------------------------------------------------

Though kernel stuck at vm_set_page_size(), I'm very happy to see the Copyright
log of FreeBSD on an armv8 machine. I've been a driver guy so don't know much
about porting & bringing up FreeBSD on new architecture. But I hope to
contribute more someday. Hopefully asap?. :)

Best Regards,
Jaemin

ps1. You'll need this to enabling ns16550a uart before entering kernel.
    This is a simple hack pach to wait until uart is ready for TX. Of course,
    kernel level UART driver should be enabled to see the log while kernel boots.
ps2. I put some pictures at http://arm64bsd.wordpress.com   

diff --git a/sys/arm64/arm64/machdep.c b/sys/arm64/arm64/machdep.c
index 31d3cb6..b961e00 100644
--- a/sys/arm64/arm64/machdep.c
+++ b/sys/arm64/arm64/machdep.c
@@ -330,9 +330,12 @@ init_proc0(vm_offset_t kstack)
 static void 
 foundation_early_putc(int c)
 {
-       volatile uint32_t *uart = (uint32_t*)0x1c090000;
+       /* hack for using ns16550 */
+       volatile uint32_t *uart = (uint32_t*)0x1c020000;
+       volatile int limit = 1000;
+
+       while(((*(volatile uint8_t*)0x1c020005) & 0x20) == 0 && --limit);
 
-       /* TODO: Wait for space in the fifo */
        uart[0] = c;
 }



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?547F20C2.6050000>