From owner-svn-src-head@freebsd.org Sat Mar 26 14:07:58 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 948A7ADE877 for ; Sat, 26 Mar 2016 14:07:58 +0000 (UTC) (envelope-from oliver.pinter@hardenedbsd.org) Received: from mail-wm0-x22b.google.com (mail-wm0-x22b.google.com [IPv6:2a00:1450:400c:c09::22b]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 2F1511172 for ; Sat, 26 Mar 2016 14:07:58 +0000 (UTC) (envelope-from oliver.pinter@hardenedbsd.org) Received: by mail-wm0-x22b.google.com with SMTP id u125so41000853wmg.1 for ; Sat, 26 Mar 2016 07:07:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=hardenedbsd-org.20150623.gappssmtp.com; s=20150623; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc; bh=JI/ELhHlgKzQrSElYnk3myeg5L7OZf+iu2J9ioxuirQ=; b=p6t/y8fPoR/wuWBpWTf5UF889EtFD+hnUzPmZGug/pOpZ94YaFoX/DbzcqYQ8CNycA TQq71dO11OJRPY7d+ksvSscJHS1TZSDtfNl05si4E7mUTYQejNdNRP29If00vQU1T3lu 1T7r4JsEVdbiNyppbZjzVlsSgjTcTHfFx2xjBe3BqHiVGAHe9tGFd1rUM1wBt1nJ05E7 coEV6SAxh4hXr4qGrZPwRP4j/2s+7LybJfTOSATcRn1pP74ZzLKK389xV6d6t/Dqp9Kz DqZjryQSHcsm92sVjhQo/+ENb44fS7SRQoyrtIdlwTxSVxgZj/EshSvIotnMe1OITvSd Mk4w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:date :message-id:subject:from:to:cc; bh=JI/ELhHlgKzQrSElYnk3myeg5L7OZf+iu2J9ioxuirQ=; b=g9U0zXo03hApuO9QOGuLZINmgXSMnT+sIOk4+NhqcXxzKqBhY9Z3oCUFO5iiGoKAO5 y5UCrDgLnMScSu1GaJVnaY1drXOeei2fe05eMbH+FzfjC3BK4Y0yXwvyhA8D6DZmnCUN x4EOaX075wQuHWqAgSlC71RvTZtrn4npUZEl92L1sAN1/ESiekvos+P27PhA+YAo4mPF RkK8CjK2Eml1ujrKEHKCWK4hY9yyJDeeC+vQd8P/qClFsZbu/Gn7dRkxyIzP37Ks4kcr Q2AC7FgBDPkhwK1tUV2Aos0wK5JDoQItejjHmCscVJHNqDpyOZbyAO8kCfWtVujKME64 8gaA== X-Gm-Message-State: AD7BkJJk6wYZSwV9JSrL/55p4aN9uLlmlyDpH8ukSZWMEMdHBGy2gy8DHQTwIapmD8BTp3n8ags2WooUtgHRoMyp MIME-Version: 1.0 X-Received: by 10.194.77.193 with SMTP id u1mr19969580wjw.73.1459001275800; Sat, 26 Mar 2016 07:07:55 -0700 (PDT) Received: by 10.194.243.98 with HTTP; Sat, 26 Mar 2016 07:07:55 -0700 (PDT) In-Reply-To: <201603260655.u2Q6ttWj077457@repo.freebsd.org> References: <201603260655.u2Q6ttWj077457@repo.freebsd.org> Date: Sat, 26 Mar 2016 15:07:55 +0100 Message-ID: Subject: Re: svn commit: r297284 - in head/sys/arm: arm at91 conf include From: Oliver Pinter To: Michal Meloun , Andrew Turner Cc: "src-committers@freebsd.org" , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" Content-Type: text/plain; charset=UTF-8 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 26 Mar 2016 14:07:58 -0000 Hi Michal! Is there any chance to add similar workaround to arm64 kernel too? There are some arm64 devices without UEFI for example Odroid C2 and Beelink Mini MX... Thanks, Oliver On Sat, Mar 26, 2016 at 7:55 AM, Michal Meloun wrote: > Author: mmel > Date: Sat Mar 26 06:55:55 2016 > New Revision: 297284 > URL: https://svnweb.freebsd.org/changeset/base/297284 > > Log: > ARM: Teach LINUX_BOOT_ABI to recognize DT blob. > This allow us to boot FreeBSD kernel (using uImage encapsulation) directly > from U-boot using 'bootm' command or by Android fastboot loader. > For now, kernel uImage must be marked as Linux, but we can add support for > FreeBSD into U-Boot later. > > Modified: > head/sys/arm/arm/machdep.c > head/sys/arm/at91/board_tsc4370.c > head/sys/arm/conf/TEGRA124 > head/sys/arm/include/machdep.h > > Modified: head/sys/arm/arm/machdep.c > ============================================================================== > --- head/sys/arm/arm/machdep.c Sat Mar 26 03:46:12 2016 (r297283) > +++ head/sys/arm/arm/machdep.c Sat Mar 26 06:55:55 2016 (r297284) > @@ -115,6 +115,7 @@ __FBSDID("$FreeBSD$"); > #include > > #ifdef FDT > +#include > #include > #include > #endif > @@ -959,7 +960,8 @@ makectx(struct trapframe *tf, struct pcb > * Fake up a boot descriptor table > */ > vm_offset_t > -fake_preload_metadata(struct arm_boot_params *abp __unused) > +fake_preload_metadata(struct arm_boot_params *abp __unused, void *dtb_ptr, > + size_t dtb_size) > { > #ifdef DDB > vm_offset_t zstart = 0, zend = 0; > @@ -997,6 +999,16 @@ fake_preload_metadata(struct arm_boot_pa > } else > #endif > lastaddr = (vm_offset_t)&end; > + if (dtb_ptr != NULL) { > + /* Copy DTB to KVA space and insert it into module chain. */ > + lastaddr = roundup(lastaddr, sizeof(int)); > + fake_preload[i++] = MODINFO_METADATA | MODINFOMD_DTBP; > + fake_preload[i++] = sizeof(uint32_t); > + fake_preload[i++] = (uint32_t)lastaddr; > + memmove((void *)lastaddr, dtb_ptr, dtb_size); > + lastaddr += dtb_size; > + lastaddr = roundup(lastaddr, sizeof(int)); > + } > fake_preload[i++] = 0; > fake_preload[i] = 0; > preload_metadata = (void *)fake_preload; > @@ -1023,20 +1035,35 @@ linux_parse_boot_param(struct arm_boot_p > struct arm_lbabi_tag *walker; > uint32_t revision; > uint64_t serial; > +#ifdef FDT > + struct fdt_header *dtb_ptr; > + uint32_t dtb_size; > +#endif > > /* > * Linux boot ABI: r0 = 0, r1 is the board type (!= 0) and r2 > * is atags or dtb pointer. If all of these aren't satisfied, > - * then punt. > + * then punt. Unfortunately, it looks like DT enabled kernels > + * doesn't uses board type and U-Boot delivers 0 in r1 for them. > */ > - if (!(abp->abp_r0 == 0 && abp->abp_r1 != 0 && abp->abp_r2 != 0)) > - return 0; > + if (abp->abp_r0 != 0 || abp->abp_r2 == 0) > + return (0); > +#ifdef FDT > + /* Test if r2 point to valid DTB. */ > + dtb_ptr = (struct fdt_header *)abp->abp_r2; > + if (fdt_check_header(dtb_ptr) == 0) { > + dtb_size = fdt_totalsize(dtb_ptr); > + return (fake_preload_metadata(abp, dtb_ptr, dtb_size)); > + } > +#endif > + /* Old, ATAG based boot must have board type set. */ > + if (abp->abp_r1 == 0) > + return (0); > > board_id = abp->abp_r1; > walker = (struct arm_lbabi_tag *) > (abp->abp_r2 + KERNVIRTADDR - abp->abp_physaddr); > > - /* xxx - Need to also look for binary device tree */ > if (ATAG_TAG(walker) != ATAG_CORE) > return 0; > > @@ -1077,7 +1104,7 @@ linux_parse_boot_param(struct arm_boot_p > > init_static_kenv(NULL, 0); > > - return fake_preload_metadata(abp); > + return fake_preload_metadata(abp, NULL, 0); > } > #endif > > @@ -1135,7 +1162,7 @@ default_parse_boot_param(struct arm_boot > return lastaddr; > #endif > /* Fall back to hardcoded metadata. */ > - lastaddr = fake_preload_metadata(abp); > + lastaddr = fake_preload_metadata(abp, NULL, 0); > > return lastaddr; > } > > Modified: head/sys/arm/at91/board_tsc4370.c > ============================================================================== > --- head/sys/arm/at91/board_tsc4370.c Sat Mar 26 03:46:12 2016 (r297283) > +++ head/sys/arm/at91/board_tsc4370.c Sat Mar 26 06:55:55 2016 (r297284) > @@ -601,7 +601,7 @@ parse_boot_param(struct arm_boot_params > inkernel_bootinfo = *(struct tsc_bootinfo *)(abp->abp_r1); > } > > - return fake_preload_metadata(abp); > + return fake_preload_metadata(abp, NULL, 0); > } > > ARM_BOARD(NONE, "TSC4370 Controller Board"); > > Modified: head/sys/arm/conf/TEGRA124 > ============================================================================== > --- head/sys/arm/conf/TEGRA124 Sat Mar 26 03:46:12 2016 (r297283) > +++ head/sys/arm/conf/TEGRA124 Sat Mar 26 06:55:55 2016 (r297284) > @@ -28,6 +28,7 @@ options SCHED_ULE # ULE scheduler > options PLATFORM # Platform based SoC > options PLATFORM_SMP > options SMP # Enable multiple cores > +options LINUX_BOOT_ABI > > # Debugging for use in -current > makeoptions DEBUG=-g # Build kernel with gdb(1) debug symbols > > Modified: head/sys/arm/include/machdep.h > ============================================================================== > --- head/sys/arm/include/machdep.h Sat Mar 26 03:46:12 2016 (r297283) > +++ head/sys/arm/include/machdep.h Sat Mar 26 06:55:55 2016 (r297284) > @@ -37,7 +37,8 @@ struct arm_boot_params; > vm_offset_t default_parse_boot_param(struct arm_boot_params *abp); > vm_offset_t freebsd_parse_boot_param(struct arm_boot_params *abp); > vm_offset_t linux_parse_boot_param(struct arm_boot_params *abp); > -vm_offset_t fake_preload_metadata(struct arm_boot_params *abp); > +vm_offset_t fake_preload_metadata(struct arm_boot_params *abp, > + void *dtb_ptr, size_t dtb_size); > vm_offset_t parse_boot_param(struct arm_boot_params *abp); > void arm_generic_initclocks(void); > > _______________________________________________ > svn-src-head@freebsd.org mailing list > https://lists.freebsd.org/mailman/listinfo/svn-src-head > To unsubscribe, send any mail to "svn-src-head-unsubscribe@freebsd.org"