From nobody Sat Apr 27 04:31:15 2024 Delivered-To: importer@patchew.org Received-SPF: none (zoho.com: 78.46.105.101 is neither permitted nor denied by domain of seabios.org) client-ip=78.46.105.101; envelope-from=seabios-bounces@seabios.org; helo=coreboot.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=none (zoho.com: 78.46.105.101 is neither permitted nor denied by domain of seabios.org) smtp.mailfrom=seabios-bounces@seabios.org; dmarc=fail(p=none dis=none) header.from=oracle.com ARC-Seal: i=1; a=rsa-sha256; t=1560332296; cv=none; d=zoho.com; s=zohoarc; b=ZJhM2avTFFk9gcYgDtyfHVaoxOZA3tNhpQTT3SYq1cXIDzwkgnX1QS5Sra5t/LtTosTgYRyCL6fQyAl/9KcAWm86VFslYp7m/nRk2HsqfHGavUGdOlkPoamLbwdSXXc3FrBSTvpn9fmWSeRKhsRzwMfPkOu1TGGyakX+iYolZxw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1560332296; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Subject:To:ARC-Authentication-Results; bh=kT/dxkiURIPH4buGo7tRyrnWw8zYzq19ZK9MMI+9MTw=; b=PudlkryOo53SFut3bPk4mf3ezY+UAGRN57LijBB/hVFXpKv5uskK/MgfqlTp6ppF7+FOjfq0Ly0HBPD5Ey7rqUqzCAJEYac3I4QxyZYryY6wakgkcIqVihwwq7koFtENwOHO+c2vVCWUtzhgAUaac4jEMzo8hfJ8AgU/EHDGjkM= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=fail; spf=none (zoho.com: 78.46.105.101 is neither permitted nor denied by domain of seabios.org) smtp.mailfrom=seabios-bounces@seabios.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from coreboot.org (coreboot.org [78.46.105.101]) by mx.zohomail.com with SMTPS id 1560332296405937.2725188840037; Wed, 12 Jun 2019 02:38:16 -0700 (PDT) Received: from [192.168.203.99] (mailu_mailman-core_1.mailu_default [192.168.203.99]) by coreboot.org (Postfix) with ESMTP id 8A3B612E2ECB; Wed, 12 Jun 2019 09:38:11 +0000 (UTC) Received: from userp2120.oracle.com (userp2120.oracle.com [156.151.31.85]) by coreboot.org (Postfix) with ESMTP id DDB5912E2EC2 for ; Wed, 12 Jun 2019 09:37:53 +0000 (UTC) Received: from pps.filterd (userp2120.oracle.com [127.0.0.1]) by userp2120.oracle.com (8.16.0.27/8.16.0.27) with SMTP id x5C9YERk193659; Wed, 12 Jun 2019 09:37:23 GMT Received: from aserp3030.oracle.com (aserp3030.oracle.com [141.146.126.71]) by userp2120.oracle.com with ESMTP id 2t05nqt7dm-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 12 Jun 2019 09:37:23 +0000 Received: from pps.filterd (aserp3030.oracle.com [127.0.0.1]) by aserp3030.oracle.com (8.16.0.27/8.16.0.27) with SMTP id x5C9atrD052470; Wed, 12 Jun 2019 09:37:22 GMT Received: from aserv0121.oracle.com (aserv0121.oracle.com [141.146.126.235]) by aserp3030.oracle.com with ESMTP id 2t04hyu8pm-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 12 Jun 2019 09:37:22 +0000 Received: from abhmp0004.oracle.com (abhmp0004.oracle.com [141.146.116.10]) by aserv0121.oracle.com (8.14.4/8.13.8) with ESMTP id x5C9bMWp015059; Wed, 12 Jun 2019 09:37:22 GMT Received: from nexus.ravello.local (/213.57.127.2) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Wed, 12 Jun 2019 02:37:21 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references; s=corp-2018-07-02; bh=OYAdHOPURsCre48CEcT538KIau1WSKYRwQ/T56tPA7k=; b=mYQigMsayh+pnLDPk1kRPQ/1ppCia19uZ+lgfpkCALOAQnPWUUT+xui0DQ0Jq/aQ0pKr r1kRIgpvoGcgDgN3tunA+3cwWwL7cWd9sU9wTi2mSNPPgc9zv7QscqeZRa9RNfCCBN/j eSxkJoEe9ke4BnfFVxppM8rezSuElPG1St9ZSc09dqMklpyx13wC5FmHJ/TUkHeI7PiW KlLhwdFsDIRv3nOiXlalUljzibq58f2yfR+M5iK47rkOJ0m4Xl42fCaCg36w+fFp6xbw UDh5s8AcrKR89z2MdFnDUV0RetPwh6e+AoVn/YX15BZ+epnY2exVLY5D/63TBO7bCmlh tw== From: Sam Eiderman To: seabios@seabios.org, kraxel@redhat.com, kevin@koconnor.net, kwolf@redhat.com, qemu-block@nongnu.org, mreitz@redhat.com Date: Wed, 12 Jun 2019 12:37:00 +0300 Message-Id: <20190612093704.47175-2-shmuel.eiderman@oracle.com> X-Mailer: git-send-email 2.13.3 In-Reply-To: <20190612093704.47175-1-shmuel.eiderman@oracle.com> References: <20190612093704.47175-1-shmuel.eiderman@oracle.com> X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9285 signatures=668687 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=2 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 mlxscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1810050000 definitions=main-1906120066 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9285 signatures=668687 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 priorityscore=1501 malwarescore=0 suspectscore=2 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1810050000 definitions=main-1906120066 Message-ID-Hash: KEEZGU27UKD6NALEICFQYYMADMOXMNWE X-Message-ID-Hash: KEEZGU27UKD6NALEICFQYYMADMOXMNWE X-MailFrom: shmuel.eiderman@oracle.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; suspicious-header CC: arbel.moshe@oracle.com, karl.heubaum@oracle.com X-Mailman-Version: 3.2.2 Precedence: list Subject: [SeaBIOS] [PATCH 1/5] geometry: Read LCHS from fw_cfg List-Id: SeaBIOS mailing list Archived-At: List-Archive: List-Help: List-Post: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Spamd-Bar: ++++ X-Spam-Level: **** Authentication-Results: coreboot.org X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" Read boot device information from fw_cfg. Boot device information will contain logical geometry (LCHS) values, but it is implemented in a manner which allows extension. By receiving LCHS values directly from QEMU through fw_cfg we will be able to support logical geometries which can not be inferred by SeaBIOS itself. (For instance: A 8GB virtio-blk hard drive which was originally created as an IDE and must report LCHS of */32/63 for its operating system to function will always break under SeaBIOS since a LARGE/LBA translation will be used, causing the number of reported logical heads to be > 32.) The only LCHS paravirtual interface available at the moment is for IDE disks (rtc_read() in get_translation()) and it's limited to a maximum of 4 disks (this code existed in SeaBIOS's translation function before SCSI and VirtIO were even introduced). This is why we create a new interface which allows passing LCHS information per hdd. As mentioned, this interface may be easily extended to support more information per hdd. Boot device information is serialized in the following way: * struct_size (u32) * device path (sz string) * device information (struct_size) ... * device path (sz string) * device information (struct_size) Device path is a null terminated string in the "Open Firmware" device path format, the same path as used in bootorder. Reviewed-by: Karl Heubaum Reviewed-by: Arbel Moshe Signed-off-by: Sam Eiderman --- src/boot.c | 87 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++= ++++ 1 file changed, 87 insertions(+) diff --git a/src/boot.c b/src/boot.c index 5acf94fe..461de86e 100644 --- a/src/boot.c +++ b/src/boot.c @@ -24,6 +24,92 @@ =20 =20 /**************************************************************** + * Boot device parameters + ****************************************************************/ + +typedef struct BootDeviceSerialized { + u32 lcyls; + u32 lheads; + u32 lsecs; +} PACKED BootDeviceSerialized; + +typedef struct BootDevice { + char *name; + u32 lcyls; + u32 lheads; + u32 lsecs; +} BootDevice; + +static BootDevice *BootDevices VARVERIFY32INIT; +static int BootDeviceCount; + +static void +loadBootDevices(void) +{ + BootDeviceCount =3D 0; + int fsize; + char *f =3D romfile_loadfile("bootdevices", &fsize); + if (!f) + return; + + if (fsize < sizeof(u32)) + return; + + u32 struct_size =3D *((u32 *)f); + if (struct_size < sizeof(BootDeviceSerialized)) + return; + + fsize -=3D sizeof(u32); + f +=3D sizeof(u32); + + int i; + int str_found =3D 0; + + for (i =3D 0; i < fsize; i++) { + if (f[i] !=3D '\0') + str_found =3D 1; + else if (f[i] =3D=3D '\0' && str_found) { + str_found =3D 0; + i++; + if (i + struct_size > fsize) + break; + i +=3D struct_size - 1; + BootDeviceCount++; + } else + break; + } + + BootDevices =3D malloc_tmphigh(BootDeviceCount * sizeof(BootDevice)); + if (!BootDevices) { + warn_noalloc(); + free(f); + BootDeviceCount =3D 0; + return; + } + + dprintf(1, "boot devices:\n"); + + BootDeviceSerialized *blk; + BootDevice *d; + + for (i =3D 0; i < BootDeviceCount; i++) { + d =3D &BootDevices[i]; + d->name =3D f; + f +=3D strlen(f) + 1; + + blk =3D (BootDeviceSerialized *)f; + d->lcyls =3D blk->lcyls; + d->lheads =3D blk->lheads; + d->lsecs =3D blk->lsecs; + f +=3D struct_size; + + dprintf(1, "%s: (%u, %u, %u)\n", + d->name, d->lcyls, d->lheads, d->lsecs); + } +} + + +/**************************************************************** * Boot priority ordering ****************************************************************/ =20 @@ -288,6 +374,7 @@ boot_init(void) BootRetryTime =3D romfile_loadint("etc/boot-fail-wait", 60*1000); =20 loadBootOrder(); + loadBootDevices(); } =20 =20 --=20 2.13.3 _______________________________________________ SeaBIOS mailing list -- seabios@seabios.org To unsubscribe send an email to seabios-leave@seabios.org