From owner-svn-src-all@freebsd.org Thu Sep 1 22:24:32 2016 Return-Path: Delivered-To: svn-src-all@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 2004FBCCAEF; Thu, 1 Sep 2016 22:24:32 +0000 (UTC) (envelope-from nwhitehorn@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 mx1.freebsd.org (Postfix) with ESMTPS id C9DFC1A1; Thu, 1 Sep 2016 22:24:31 +0000 (UTC) (envelope-from nwhitehorn@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u81MOVkU089580; Thu, 1 Sep 2016 22:24:31 GMT (envelope-from nwhitehorn@FreeBSD.org) Received: (from nwhitehorn@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u81MOV1Q089579; Thu, 1 Sep 2016 22:24:31 GMT (envelope-from nwhitehorn@FreeBSD.org) Message-Id: <201609012224.u81MOV1Q089579@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: nwhitehorn set sender to nwhitehorn@FreeBSD.org using -f From: Nathan Whitehorn Date: Thu, 1 Sep 2016 22:24:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r305249 - stable/11/sys/boot/powerpc/boot1.chrp X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 01 Sep 2016 22:24:32 -0000 Author: nwhitehorn Date: Thu Sep 1 22:24:30 2016 New Revision: 305249 URL: https://svnweb.freebsd.org/changeset/base/305249 Log: MFC r305036: Some versions of SLOF do not append the partition number to the boot device argument to the stage-1 bootloader. In such cases, boot1 would only try to read the entire device rather than checking for partitions. Instead of panic'ing, fall back to reading the partitions as normal in such situations. This was preventing boot of installed systems on some versions of PowerKVM. PR: kern/211599 Modified: stable/11/sys/boot/powerpc/boot1.chrp/boot1.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/boot/powerpc/boot1.chrp/boot1.c ============================================================================== --- stable/11/sys/boot/powerpc/boot1.chrp/boot1.c Thu Sep 1 21:30:12 2016 (r305248) +++ stable/11/sys/boot/powerpc/boot1.chrp/boot1.c Thu Sep 1 22:24:30 2016 (r305249) @@ -137,7 +137,9 @@ ofw_init(void *vpd, int res, int (*openf p = bootpath; while (*p != '\0') { + /* Truncate partition ID */ if (*p == ':') { + ofw_close(bootdev); *(++p) = '\0'; break; } @@ -419,31 +421,40 @@ main(int ac, char **av) memcpy(bootpath_full,bootpath,len+1); - if (bootpath_full[len-1] == ':') { - for (i = 0; i < 16; i++) { - if (i < 10) { - bootpath_full[len] = i + '0'; - bootpath_full[len+1] = '\0'; - } else { - bootpath_full[len] = '1'; - bootpath_full[len+1] = i - 10 + '0'; - bootpath_full[len+2] = '\0'; - } - - if (domount(bootpath_full,1) >= 0) - break; - - if (bootdev > 0) - ofw_close(bootdev); + if (bootpath_full[len-1] != ':') { + /* First try full volume */ + if (domount(bootpath_full,1) == 0) + goto out; + + /* Add a : so that we try partitions if that fails */ + if (bootdev > 0) + ofw_close(bootdev); + bootpath_full[len] = ':'; + len += 1; + } + + /* Loop through first 16 partitions to find a UFS one */ + for (i = 0; i < 16; i++) { + if (i < 10) { + bootpath_full[len] = i + '0'; + bootpath_full[len+1] = '\0'; + } else { + bootpath_full[len] = '1'; + bootpath_full[len+1] = i - 10 + '0'; + bootpath_full[len+2] = '\0'; } + + if (domount(bootpath_full,1) >= 0) + break; - if (i >= 16) - panic("domount"); - } else { - if (domount(bootpath_full,0) == -1) - panic("domount"); + if (bootdev > 0) + ofw_close(bootdev); } + if (i >= 16) + panic("domount"); + +out: printf(" Boot volume: %s\n",bootpath_full); ofw_setprop(chosenh, "bootargs", bootpath_full, len+2); load(path);