From patchwork Wed Jan 9 05:17:07 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amos Kong X-Patchwork-Id: 210621 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id A6DBD2C00D7 for ; Wed, 9 Jan 2013 16:17:23 +1100 (EST) Received: from localhost ([::1]:41568 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Tso2T-0002DR-On for incoming@patchwork.ozlabs.org; Wed, 09 Jan 2013 00:17:21 -0500 Received: from eggs.gnu.org ([208.118.235.92]:55874) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Tso2M-0002DF-FS for qemu-devel@nongnu.org; Wed, 09 Jan 2013 00:17:15 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Tso2J-0000mG-TA for qemu-devel@nongnu.org; Wed, 09 Jan 2013 00:17:14 -0500 Received: from mx1.redhat.com ([209.132.183.28]:56873) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Tso2J-0000m1-L2 for qemu-devel@nongnu.org; Wed, 09 Jan 2013 00:17:11 -0500 Received: from int-mx02.intmail.prod.int.phx2.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id r095HA6g002568 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Wed, 9 Jan 2013 00:17:10 -0500 Received: from dhcp-8-167.nay.redhat.com ([10.66.7.126]) by int-mx02.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id r095H6la015740; Wed, 9 Jan 2013 00:17:07 -0500 From: Amos Kong To: seabios@seabios.org Date: Wed, 9 Jan 2013 13:17:07 +0800 Message-Id: <1357708627-14094-1-git-send-email-akong@redhat.com> In-Reply-To: <20130109040042.GC26614@morn.localdomain> References: <20130109040042.GC26614@morn.localdomain> X-Scanned-By: MIMEDefang 2.67 on 10.5.11.12 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 209.132.183.28 Cc: Amos Kong , kevin@koconnor.net, dallan@redhat.com, qemu-devel@nongnu.org, gleb@redhat.com Subject: [Qemu-devel] [SeaBIOS PATCH v3] boot: add a new type to halt booting X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Current seabios will try to boot from selected devices first, if they are all failed, seabios will also try to boot from un-selected devices. For example: @ qemu-kvm -boot order=n,menu=on ... Guest will boot from network first, if it's failed, guest will try to boot from other un-selected devices (floppy, cdrom, disk) one by one. We need to make it configurable. This patch added a new type, qemu can add "HALT" at the end of bootindex string, then seabios will halt booting after trying to boot from selected devices. Signed-off-by: Kevin O'Connor Signed-off-by: Amos Kong --- v3: add a new type to halt booting (Kevin) diff --git a/src/boot.c b/src/boot.c index c67cc7f..eea2354 100644 --- a/src/boot.c +++ b/src/boot.c @@ -291,6 +291,7 @@ static struct bootentry_s *BootList; #define IPL_TYPE_CBFS 0x20 #define IPL_TYPE_BEV 0x80 #define IPL_TYPE_BCV 0x81 +#define IPL_TYPE_HALT 0xf0 static void bootentry_add(int type, int prio, u32 data, const char *desc) @@ -488,6 +489,11 @@ boot_prep(void) interactive_bootmenu(); wait_threads(); + int haltprio = find_prio("HALT"); + + if (haltprio >= 0) + bootentry_add(IPL_TYPE_HALT, haltprio, 0, "HALT"); + // Map drives and populate BEV list struct bootentry_s *pos = BootList; while (pos) { @@ -672,6 +678,9 @@ do_boot(int seq_nr) case IPL_TYPE_BEV: boot_rom(ie->vector); break; + case IPL_TYPE_HALT: + boot_fail(); + break; } // Boot failed: invoke the boot recovery function