From owner-svn-src-head@freebsd.org Sun Jul 19 23:34:53 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 19C2B36CD42; Sun, 19 Jul 2020 23:34:53 +0000 (UTC) (envelope-from mhorne@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (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 "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4B91Rc7283z4Bty; Sun, 19 Jul 2020 23:34:52 +0000 (UTC) (envelope-from mhorne@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D3F8523943; Sun, 19 Jul 2020 23:34:52 +0000 (UTC) (envelope-from mhorne@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 06JNYq43064881; Sun, 19 Jul 2020 23:34:52 GMT (envelope-from mhorne@FreeBSD.org) Received: (from mhorne@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 06JNYqAR064880; Sun, 19 Jul 2020 23:34:52 GMT (envelope-from mhorne@FreeBSD.org) Message-Id: <202007192334.06JNYqAR064880@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mhorne set sender to mhorne@FreeBSD.org using -f From: Mitchell Horne Date: Sun, 19 Jul 2020 23:34:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r363345 - head/sys/riscv/riscv X-SVN-Group: head X-SVN-Commit-Author: mhorne X-SVN-Commit-Paths: head/sys/riscv/riscv X-SVN-Commit-Revision: 363345 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 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: Sun, 19 Jul 2020 23:34:53 -0000 Author: mhorne Date: Sun Jul 19 23:34:52 2020 New Revision: 363345 URL: https://svnweb.freebsd.org/changeset/base/363345 Log: riscv: look for bootargs in FDT The FDT may contain a short /chosen/bootargs string which we should pass to boot_parse_cmdline. Notably, this allows the use of qemu's -append option to pass things like -s to boot to single user mode. Submitted by: Nathaniel Filardo Reviewed by: mhorne MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D25544 Modified: head/sys/riscv/riscv/machdep.c Modified: head/sys/riscv/riscv/machdep.c ============================================================================== --- head/sys/riscv/riscv/machdep.c Sun Jul 19 23:34:01 2020 (r363344) +++ head/sys/riscv/riscv/machdep.c Sun Jul 19 23:34:52 2020 (r363345) @@ -40,6 +40,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include #include @@ -800,6 +801,19 @@ fake_preload_metadata(struct riscv_bootparams *rvbp) rvbp->kern_phys, rvbp->kern_phys + (lastaddr - KERNBASE)); } +#ifdef FDT +static void +parse_fdt_bootargs(void) +{ + char bootargs[512]; + + bootargs[sizeof(bootargs) - 1] = '\0'; + if (fdt_get_chosen_bootargs(bootargs, sizeof(bootargs) - 1) == 0) { + boothowto |= boot_parse_cmdline(bootargs); + } +} +#endif + static vm_offset_t parse_metadata(void) { @@ -829,6 +843,8 @@ parse_metadata(void) #endif #ifdef FDT try_load_dtb(kmdp); + if (kern_envp == NULL) + parse_fdt_bootargs(); #endif return (lastaddr); }