From owner-freebsd-arm@FreeBSD.ORG Wed Dec 3 14:40:08 2014 Return-Path: Delivered-To: freebsd-arm@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 552CEFD5 for ; Wed, 3 Dec 2014 14:40:08 +0000 (UTC) Received: from mail-pd0-x22e.google.com (mail-pd0-x22e.google.com [IPv6:2607:f8b0:400e:c02::22e]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 23B71C7 for ; Wed, 3 Dec 2014 14:40:08 +0000 (UTC) Received: by mail-pd0-f174.google.com with SMTP id w10so15449525pde.5 for ; Wed, 03 Dec 2014 06:40:07 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=message-id:date:from:user-agent:mime-version:to:subject :content-type:content-transfer-encoding; bh=8ftFdjJ05A/n42BPeKx+oAXdakc6obZbRo8uT4Ji1sg=; b=SRUtBqjPzFez1P99mXiRvflnUeCO6sqceBnQDy/vmuy0OHMKpH8uicHXfIOhuy4d1J E/uCY9rRmb6CrG80Uy+B1ds0x4FH68z5Gr9YMOFv8VcvTKXAJNe55JzxRNHH2Oz6Tu9m MV+l1o/KSbRiEhMtzYa0SZRPZ5XV70xjDgQ3qRaEhY4qtkHxJgN/z/M1ia9yrz2G7wkN 1N1INp9rg0hQLe0ftHeBi8HyPOYfPBTNHe7dQhmU87yldo7OL2X313d+tRoclRc0xn1G aOPxbjjNFSleMI1GEyOZFhSI05E5pAka9RYGCXy5BLIXk0DvN7KgqdIV+m1idpiYYAH9 WBag== X-Received: by 10.67.4.65 with SMTP id cc1mr9119863pad.87.1417617607464; Wed, 03 Dec 2014 06:40:07 -0800 (PST) Received: from [172.30.1.19] ([112.168.75.52]) by mx.google.com with ESMTPSA id oa8sm23335978pdb.84.2014.12.03.06.40.06 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 03 Dec 2014 06:40:06 -0800 (PST) Message-ID: <547F20C2.6050000@gmail.com> Date: Wed, 03 Dec 2014 23:40:02 +0900 From: Jaemin Yoo User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:31.0) Gecko/20100101 Thunderbird/31.1.0 MIME-Version: 1.0 To: freebsd-arm@freebsd.org Subject: hack patch for enabling uart on aarch64 mustang board Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-BeenThere: freebsd-arm@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "Porting FreeBSD to ARM processors." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 03 Dec 2014 14:40:08 -0000 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; }