From nobody Thu May 2 16:48:43 2024 Delivered-To: importer@patchew.org Received-SPF: none (zoho.com: 80.81.252.135 is neither permitted nor denied by domain of seabios.org) client-ip=80.81.252.135; envelope-from=seabios-bounces@seabios.org; helo=mail.coreboot.org; Authentication-Results: mx.zoho.com; dkim=fail spf=none (zoho.com: 80.81.252.135 is neither permitted nor denied by domain of seabios.org) smtp.mailfrom=seabios-bounces@seabios.org; Return-Path: Received: from mail.coreboot.org (mail.coreboot.org [80.81.252.135]) by mx.zohomail.com with SMTPS id 1498870152905591.1631209909513; Fri, 30 Jun 2017 17:49:12 -0700 (PDT) Received: from [127.0.0.1] (helo=ra.coresystems.de) by mail.coreboot.org with esmtp (Exim 4.86_2) (envelope-from ) id 1dR6ZI-0007ff-Fk; Sat, 01 Jul 2017 02:47:25 +0200 Received: from mail-pg0-f68.google.com ([74.125.83.68]) by mail.coreboot.org with esmtps (TLSv1.2:ECDHE-RSA-AES128-GCM-SHA256:128) (Exim 4.86_2) (envelope-from ) id 1dR6Z3-0007af-4A for seabios@seabios.org; Sat, 01 Jul 2017 02:47:19 +0200 Received: by mail-pg0-f68.google.com with SMTP id j186so16831116pge.1 for ; Fri, 30 Jun 2017 17:48:33 -0700 (PDT) Received: from centos7.nutanix.com ([205.209.132.2]) by smtp.gmail.com with ESMTPSA id j14sm20285425pgt.7.2017.06.30.17.48.29 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 30 Jun 2017 17:48:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:subject:message-id:mime-version:content-disposition :user-agent; bh=U8puslMLCeB51Hq8zjCQsJDRar3bt0f/0BWoQWmU2Qs=; b=kz9OzYuyPRQce2X/XIvKwsmODfJvPygTBJkpiiJ7rWO2qbWDJ5EQj/HdF8NaeAKnBv a1XL4+tHsTIQE+gWZSlTM2PuEGGGfE9FiXzyZZv6mLTsgcN8vFRl9l9WwNmDY4ut1MWP LWiy9A4QXAi//2Kj4bnTrVkv6draJOL2YI3Cz6LI+LtS4jXNuQGBzsKnonE4qQD7xatE YCg6O1cxEq6eFjrPFzJY8i0piQNTpgA1T6Wiv6cBsPAhdHWAfFWZT/w7UTtC7U5Yuldg UAhmq5WWUv+Ka5mFLEFX70oWzLx7bJjrjJCCthBSDQR/jZXI9S3qMbAHtyb2+wC6wyhF Zvyg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:subject:message-id:mime-version :content-disposition:user-agent; bh=U8puslMLCeB51Hq8zjCQsJDRar3bt0f/0BWoQWmU2Qs=; b=T9D14xp2LNKZqOc5ist1YxGmsNE6ouZ0sN4cFNLcpAMxQ59CXEsVVj4RhLYqxSMEzv jkG+aTGYob+fTgNCckTxinl4Fmna2gFNxZej8Ba9qL+f56Oc58NhCARGT67quc7Bhqau TdfD92qcYPBokN77gzRfhc+ZLGTrufgqGtG+c1Wo//CA8EMM23+/fQd65WHQtg2o/ITt KoiCk0aNo1Q3B+dnEhWtEApqKXMeKp9AWg/SYEofop7PhsFN5PiS9VFKkShZOCTcxdgA TL0qGs57o8+cN2scb7W8dzowOUP/hT5Za7/J0bhIvCCQmbSAoMl/K0kcueg9sFUbl++B w9wA== X-Gm-Message-State: AKS2vOzGL4KUUTe9feKqUznGf+y1rzAyM/QGy/9dfolXfEMe+gogQPAg 8pPMwCf1jPnZXMXdX80= X-Received: by 10.99.125.20 with SMTP id y20mr3350064pgc.259.1498870110479; Fri, 30 Jun 2017 17:48:30 -0700 (PDT) Date: Fri, 30 Jun 2017 20:48:27 -0400 From: Gaurav Poothia To: seabios@seabios.org Message-ID: <20170701004827.GA19037@centos7.nutanix.com> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.21 (2010-09-15) X-Spam-Score: -7.3 (-------) Subject: [SeaBIOS] [PATCH] Support multiple hard disks in boot list. X-BeenThere: seabios@seabios.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SeaBIOS mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Transfer-Encoding: quoted-printable Errors-To: seabios-bounces@seabios.org Sender: "SeaBIOS" X-Duff: Orig. Duff, Duff Lite, Duff Dry, Duff Dark, Raspberry Duff, Lady Duff, Red Duff, Tartar Control Duff X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_4 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" If multiple disks in boot order and first is unbootable then fallback to other disks in list. Signed-off-by: Gaurav Poothia --- src/block.c | 3 ++- src/block.h | 2 +- src/boot.c | 30 +++++++++++++++++++----------- 3 files changed, 22 insertions(+), 13 deletions(-) diff --git a/src/block.c b/src/block.c index d104f6d..5c78533 100644 --- a/src/block.c +++ b/src/block.c @@ -238,7 +238,7 @@ add_drive(struct drive_s **idmap, u8 *count, struct dri= ve_s *drive) } =20 // Map a hard drive -void +int map_hd_drive(struct drive_s *drive) { ASSERT32FLAT(); @@ -252,6 +252,7 @@ map_hd_drive(struct drive_s *drive) =20 // Fill "fdpt" structure. fill_fdpt(drive, hdid); + return hdid; } =20 // Map a cd diff --git a/src/block.h b/src/block.h index f03ec38..68f2f32 100644 --- a/src/block.h +++ b/src/block.h @@ -109,7 +109,7 @@ extern u8 *bounce_buf_fl; struct drive_s *getDrive(u8 exttype, u8 extdriveoffset); int getDriveId(u8 exttype, struct drive_s *drive); void map_floppy_drive(struct drive_s *drive); -void map_hd_drive(struct drive_s *drive); +int map_hd_drive(struct drive_s *drive); void map_cd_drive(struct drive_s *drive); struct int13dpt_s; int fill_edd(struct segoff_s edd, struct drive_s *drive_gf); diff --git a/src/boot.c b/src/boot.c index 59623fb..9b9cf91 100644 --- a/src/boot.c +++ b/src/boot.c @@ -527,16 +527,16 @@ interactive_bootmenu(void) struct bev_s { int type; u32 vector; + // Applicable to hard disks only + int hdid; }; static struct bev_s BEV[20]; static int BEVCount; static int HaveHDBoot, HaveFDBoot; =20 static void -add_bev(int type, u32 vector) +add_bev(int type, u32 vector, int hdid) { - if (type =3D=3D IPL_TYPE_HARDDISK && HaveHDBoot++) - return; if (type =3D=3D IPL_TYPE_FLOPPY && HaveFDBoot++) return; if (BEVCount >=3D ARRAY_SIZE(BEV)) @@ -544,12 +544,15 @@ add_bev(int type, u32 vector) struct bev_s *bev =3D &BEV[BEVCount++]; bev->type =3D type; bev->vector =3D vector; + bev->hdid =3D hdid; } =20 + // Prepare for boot - show menu and run bcvs. void bcv_prepboot(void) { + int hdid =3D -1; if (! CONFIG_BOOT) return; =20 @@ -563,28 +566,30 @@ bcv_prepboot(void) switch (pos->type) { case IPL_TYPE_BCV: call_bcv(pos->vector.seg, pos->vector.offset); - add_bev(IPL_TYPE_HARDDISK, 0); + add_bev(IPL_TYPE_HARDDISK, 0, -1); break; case IPL_TYPE_FLOPPY: map_floppy_drive(pos->drive); - add_bev(IPL_TYPE_FLOPPY, 0); + add_bev(IPL_TYPE_FLOPPY, 0, -1); break; case IPL_TYPE_HARDDISK: - map_hd_drive(pos->drive); - add_bev(IPL_TYPE_HARDDISK, 0); + hdid =3D map_hd_drive(pos->drive); + add_bev(IPL_TYPE_HARDDISK, 0, hdid); + HaveHDBoot++; break; case IPL_TYPE_CDROM: map_cd_drive(pos->drive); // NO BREAK default: - add_bev(pos->type, pos->data); + add_bev(pos->type, pos->data, -1); break; } } =20 // If nothing added a floppy/hd boot - add it manually. - add_bev(IPL_TYPE_FLOPPY, 0); - add_bev(IPL_TYPE_HARDDISK, 0); + add_bev(IPL_TYPE_FLOPPY, 0, -1); + if (HaveHDBoot =3D=3D 0) + add_bev(IPL_TYPE_HARDDISK, 0, -1); } =20 =20 @@ -731,7 +736,10 @@ do_boot(int seq_nr) break; case IPL_TYPE_HARDDISK: printf("Booting from Hard Disk...\n"); - boot_disk(0x80, 1); + if (ie->hdid =3D=3D -1) + boot_disk(0x80 , 1); + else + boot_disk(0x80 + ie->hdid, 1); break; case IPL_TYPE_CDROM: boot_cdrom((void*)ie->vector); --=20 1.8.3.1 _______________________________________________ SeaBIOS mailing list SeaBIOS@seabios.org https://mail.coreboot.org/mailman/listinfo/seabios