From nobody Wed Jan 19 16:24:48 2022 X-Original-To: freebsd-riscv@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 7DB33196C1CA for ; Wed, 19 Jan 2022 16:24:49 +0000 (UTC) (envelope-from mhorne@freebsd.org) Received: from smtp.freebsd.org (smtp.freebsd.org [96.47.72.83]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "smtp.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Jf9w13B9bz4vwh; Wed, 19 Jan 2022 16:24:49 +0000 (UTC) (envelope-from mhorne@freebsd.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1642609489; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=X7iWzuZyqy66HwIQBh49wHLwK8DHjRTpK7Xt83rIRGQ=; b=C0utSdQcfuj2VrFu3mLKSKOxXKR+FaIOIREgJ/8f1G+ThOESpYi5JrfDtmeF4JFF/60DwI dvnuble+CsfJ91sxtaz+CYHqwOU3VJ/sxkd+20I4QNff6fUeSOJstgtma68CuDKcu30bIZ 3Jex6omSxHhapdm0czlw7M7Bvbomwadxob8JClyEsONejReDUgimjhtc4ivGmfQlFLNAZB yUeke48nu1HI04lgG3rTLh2v2g7yAeAiOV3eaL3qUr30NJrcXv3swriczuBVtJJ2H+5Y5r rKNsjtxwAxH1thW/m1moVb27u7T1HKvoqbFG+TjXbswTRsxcwP22hdje72uzuw== Received: from [192.168.1.106] (host-173-212-69-198.public.eastlink.ca [173.212.69.198]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) (Authenticated sender: mhorne) by smtp.freebsd.org (Postfix) with ESMTPSA id 255604DFA; Wed, 19 Jan 2022 16:24:49 +0000 (UTC) (envelope-from mhorne@freebsd.org) Message-ID: Date: Wed, 19 Jan 2022 12:24:48 -0400 List-Id: FreeBSD on the RISC-V instruction set architecture List-Archive: https://lists.freebsd.org/archives/freebsd-riscv List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-riscv@freebsd.org X-BeenThere: freebsd-riscv@freebsd.org MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:91.0) Gecko/20100101 Thunderbird/91.4.1 Subject: Re: Sipeed Lichee RV (Allwinner D1) Content-Language: en-CA To: Jakob Alvermark , freebsd-riscv@FreeBSD.org References: From: Mitchell Horne In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1642609489; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=X7iWzuZyqy66HwIQBh49wHLwK8DHjRTpK7Xt83rIRGQ=; b=h/OnYs+tgB8jSNjvdIaldB4RRyOSw6ShIkAJ/4wYQOpAxPkCfaGs3/1sU7wwXZ2FhAAN35 7gG7E2YRcR9izgDKOgrG/s4qNlDf2OrPLZxe46DjB3PECY/B9eP4vOWhio9g3xYv7bAQbo qSlm3hRkXx58JMnLaRjOKRlL6c5WVNaw+BCN7jeS8SSWL6aKKSHInoKXO6pdT9JrsAGFHh n1W0GkJW8cKHbf5dY/vEiWoXaupMS0b+dXbwFoGNNBz63SHiSmQeWLZCqkcJMvU6rhoLMZ F5j2I0AGG5CfSNbVOj62zK0WJQ7/1atDJDaVJXeY25+KhPOtqD4GskfiTKXvow== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1642609489; a=rsa-sha256; cv=none; b=CltewLxV0Vzlho92DvqgAMI3CWmFRlj9tV+vpPvI7uL/DjzRb4ylnXFrG5agaWpZRy7TrM XNOcTEDwBEzdCYdXnAK3Oaqq8B1mrn99O1HYzWvi31HbfdQA3ObVzCgLpb0RFyqd61j/Bm cW7+ZqC6JbVnux7NMSmKhPDV7LLWXm0pEXMVocS6A2BOufnmzzb3x2ipDpv9usUnBayHi7 nidYEBlvIM/3RYi+3K9+t0hiI3M+J9O+aOzjYtFesUkBQdGDcCXqpha+1+rrXL1fdWP70q 9SkTU1En3oqs9p4m67WViuWQy/GkJ+bRLrkK6qvNwJvxPsj7BEi2mVZkPa4MUw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N On 1/17/22 15:02, Jakob Alvermark wrote: > Hi, > > > With RISC-V SBCs now coming down in price, I got curios and got myself > a Lichee RV (with the dock). > > https://linux-sunxi.org/Sipeed_Lichee_RV > > The instructions here, https://linux-sunxi.org/Allwinner_Nezha along > with some patching got me a working U-boot. > > Cross-building and putting together and image for and SD card got me > this far: > > [35]HELLO! BOOT0 is starting! > [38]BOOT0 commit : 771192d > [41]set pll start > [42]periph0 has been enabled > [45]set pll end > [47]board init ok > [49]DRAM only have internal ZQ!! > [51]get_pmu_exist() = -1 > [54]ddr_efuse_type: 0x0 > [57][AUTO DEBUG] single rank and full DQ! > [61]ddr_efuse_type: 0x0 > [64][AUTO DEBUG] rank 0 row = 15 > [67][AUTO DEBUG] rank 0 bank = 8 > [70][AUTO DEBUG] rank 0 page size = 2 KB > [74]DRAM BOOT DRIVE INFO: V0.24 > [77]DRAM CLK = 792 MHz > [79]DRAM Type = 3 (2:DDR2,3:DDR3) > [82]DRAMC ZQ value: 0x7b7bfb > [85]DRAM ODT value: 0x42. > [87]ddr_efuse_type: 0x0 > [90]DRAM SIZE =512 M > [94]DRAM simple test OK. > [96]dram size =512 > [98]card no is 0 > [99]sdcard 0 line count 4 > [102][mmc]: mmc driver ver 2021-04-2 16:45 > [111][mmc]: Wrong media type 0x0 > [114][mmc]: ***Try SD card 0*** > [131][mmc]: HSSDR52/SDR25 4 bit > [134][mmc]: 50000000 Hz > [136][mmc]: 15193 MB > [138][mmc]: ***SD/MMC 0 init OK!!!*** > [187]Loading boot-pkg Succeed(index=1). > [190]Entry_name        = opensbi > [193]Entry_name        = dtb > [196]Entry_name        = u-boot > [199]Jump to second Boot. > > > U-Boot 2022.01-rc1-31813-gf3a0e980de-dirty (Jan 17 2022 - 13:27:57 +0100) > > CPU:   rv64imafdc > Model: Allwinner D1 NeZha > DRAM:  512 MiB > WDT:   Started watchdog@6011000 with servicing (16s timeout) > MMC:   mmc@4020000: 0, mmc@4021000: 1 > Loading Environment from nowhere... OK > In:    serial@2500000 > Out:   serial@2500000 > Err:   serial@2500000 > Net:   Could not get PHY for ethernet@4500000: addr 1 > No ethernet found. > > Hit any key to stop autoboot:  0 > switch to partitions #0, OK > mmc0 is current device > Scanning mmc 0:1... > libfdt fdt_check_header(): FDT_ERR_BADMAGIC > Scanning disk mmc@4020000.blk... > Scanning disk mmc@4021000.blk... > Disk mmc@4021000.blk not ready > Found 3 disks > ** Unable to read file ubootefi.var ** > Failed to load EFI variables > mdio_register: non unique device name 'ethernet@4500000' > Could not get PHY for ethernet@4500000: addr 1 > mdio_register: non unique device name 'ethernet@4500000' > Could not get PHY for ethernet@4500000: addr 1 > BootOrder not defined > EFI boot manager: Cannot load any image > Found EFI removable media binary efi/boot/bootriscv64.efi > 1409436 bytes read in 248 ms (5.4 MiB/s) > libfdt fdt_check_header(): FDT_ERR_BADMAGIC > Booting /efi\boot\bootriscv64.efi > > Consoles: EFI console >     Reading loader env vars from /efi/freebsd/loader.env > Setting currdev to disk0p1: > FreeBSD/riscv EFI loader, Revision 1.1 > (Fri Jan 14 13:21:23 CET 2022 root@legion) > >    Command line arguments: l >    Image base: 0x5e98c000 >    EFI version: 2.80 >    EFI Firmware: Das U-Boot (rev 8226.256) >    Console: comconsole (0) >    Load Path: /efi\boot\bootriscv64.efi >    Load Device: > /VenHw(e61d73b9-a384-4acc-aeab-82e828f3628b)/SD(0)/SD(0)/HD(1,GPT,1ab17495-7795-11ec-9e49-f875a47d4ead,0xa1f8,0x10418) > Trying ESP: > /VenHw(e61d73b9-a384-4acc-aeab-82e828f3628b)/SD(0)/SD(0)/HD(1,GPT,1ab17495-7795-11ec-9e49-f875a47d4ead,0xa1f8,0x10418) > Setting currdev to disk0p1: > Trying: > /VenHw(e61d73b9-a384-4acc-aeab-82e828f3628b)/SD(0)/SD(0)/HD(2,GPT,2973d4b3-7795-11ec-9e49-f875a47d4ead,0x1a610,0x114340) > Setting currdev to disk0p2: > Loading /boot/defaults/loader.conf > Loading /boot/defaults/loader.conf > Loading /boot/device.hints > Loading /boot/loader.conf > Loading /boot/loader.conf.local > / > >    ______               ____   _____ _____ >   |  ____|             |  _ \ / ____|  __ \ >   | |___ _ __ ___  ___ | |_) | (___ | |  | | >   |  ___| '__/ _ \/ _ \|  _ < \___ \| |  | | >   | |   | | |  __/  __/| |_) |____) | |__| | >   | |   | | |    |    ||     |      |      | >   |_|   |_|  \___|\___||____/|_____/|_____/ ```                        ` >                                                 s` > `.....---.......--.```   -/ >  +---------- Welcome to FreeBSD -----------+    +o .--` /y:`      +. >  |                                         | yo`:. :o      `+- >  |  1. Boot Multi user [Enter]             | y/ -/`   -o/ >  |  2. Boot Single user                    | .- ::/sy+:. >  |  3. Escape to loader prompt             | / `--  / >  |  4. Reboot                              | > `:                          :` >  |  5. Cons: Video                         | > `:                          :` >  |                                         | /                          / >  |  Options:                               | .-                        -. >  |  6. Kernel: default/kernel (1 of 1)     | --                      -. >  |  7. Boot Options                        | `:` `:` >  |                                         | .--             `--. >  |                                         | .---.....----. >  +-----------------------------------------+ >    Autoboot in 0 seconds. [Space] to pause > > Loading kernel... > /boot/kernel/kernel text=0x609ddc text=0x133abc data=0xf4420 > data=0xb54+0x1d73e4 syms=[0x8+0xcd188+0x8+0xee5ae] > Loading configured modules... > can't find '/etc/hostid' > can't find '/boot/entropy' > Using DTB provided by EFI at 0x47ef5000. > Kernel entry at 0x56a0002e... > Kernel args: (null) > > ----- > > And here it stops for  ~16 seconds then restarts, that's the watchdog > resetting it. > > So where do I go from here? > Hi Jakob, Looks like it bails somewhere in the initial kernel setup, before the first output to the console. This is a wide range, so it's difficult to say exactly where things are going wrong. I will say that generally FreeBSD is not expected to work on the D1; as far as I know you are the first to try it. This hardware has some quirks requiring special support, which we are entirely lacking. Specifically, there is one related to virtual memory management, which requires custom (spec-breaking) bits in the page tables to be set, to properly specify the attributes of physical and device memory. This _may_ have something to do with why it is failing where it is. It would take a motivated party to add the support required for this SoC, and I'm not aware of anyone currently taking this on. This board has caused some headaches in Linux-land for the same reasons, but there are more hands to do the work there. I just want to set the expectations properly :) If you wanted to debug this further, you might rebuild the kernel after adding 'options EARLY_PRINTF' to the config file, as this should enable a couple early outputs and narrow down the search slightly. Cheers, Mitchell > > Cheers, > > Jakob Alvermark > >