From nobody Thu Dec 26 12:13:47 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of seabios.org designates 78.46.105.101 as permitted sender) client-ip=78.46.105.101; envelope-from=seabios-bounces@seabios.org; helo=coreboot.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of seabios.org designates 78.46.105.101 as permitted sender) smtp.mailfrom=seabios-bounces@seabios.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from coreboot.org (coreboot.org [78.46.105.101]) by mx.zohomail.com with SMTPS id 1683105802702595.9346778428945; Wed, 3 May 2023 02:23:22 -0700 (PDT) Received: from authenticated-user (PRIMARY_HOSTNAME [PUBLIC_IP]) by coreboot.org (Postfix) with ESMTPA id 4541627371; Wed, 3 May 2023 09:23:18 +0000 (UTC) Received: from authenticated-user (PRIMARY_HOSTNAME [PUBLIC_IP]) by coreboot.org (Postfix) with ESMTP id 4FF8F22C8E for ; Wed, 3 May 2023 09:22:06 +0000 (UTC) Received: from authenticated-user (PRIMARY_HOSTNAME [PUBLIC_IP]) [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-61-_RZXCSatPmK2Vjs8Ztx41Q-1; Wed, 03 May 2023 05:22:03 -0400 Received: from authenticated-user (PRIMARY_HOSTNAME [PUBLIC_IP]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 3E5731C0519D for ; Wed, 3 May 2023 09:22:03 +0000 (UTC) Received: from authenticated-user (PRIMARY_HOSTNAME [PUBLIC_IP]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 0F7F21121331; Wed, 3 May 2023 09:22:03 +0000 (UTC) Received: from authenticated-user (PRIMARY_HOSTNAME [PUBLIC_IP]) id 94CAB1804A40; Wed, 3 May 2023 11:22:01 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1683105725; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=GMBahBT03LaxmbskWXEBJ4FJoNnue5ShstwY4zreFrM=; b=HhXRO+kVHQq7IMk+ULUu4dWtRj4TsQepTOUgH8pixbQWRdjnGAdlRhG5CY6eSPMwyg+uKr 3VzE6y4PRqAXwfOP3aqJUWFCW1CbE++YU9s3df40cxh2FZFN6UdXCTTlQhfpeIWgZtPiQ0 JmypY98IW/RA8mJhGiNJ3dpnLukPs2M= X-MC-Unique: _RZXCSatPmK2Vjs8Ztx41Q-1 From: Gerd Hoffmann To: seabios@seabios.org Date: Wed, 3 May 2023 11:22:00 +0200 Message-Id: <20230503092201.487130-2-kraxel@redhat.com> In-Reply-To: <20230503092201.487130-1-kraxel@redhat.com> References: <20230503092201.487130-1-kraxel@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.3 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Message-ID-Hash: VEY5LPR6T4SG6ITINEYRLLIGXGXHSPCY X-Message-ID-Hash: VEY5LPR6T4SG6ITINEYRLLIGXGXHSPCY X-MailFrom: kraxel@redhat.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-seabios.seabios.org-0; header-match-seabios.seabios.org-1; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: Gerd Hoffmann X-Mailman-Version: 3.3.6b1 Precedence: list Subject: [SeaBIOS] [PATCH 1/2] add hwerr_printf function for threads List-Id: SeaBIOS mailing list Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: Content-Transfer-Encoding: quoted-printable Authentication-Results: coreboot.org; auth=pass smtp.auth=mailman@coreboot.org smtp.mailfrom=seabios-bounces@seabios.org X-Spamd-Bar: --- X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1683105803403100001 Content-Type: text/plain; charset="utf-8"; x-default="true" Printing to the screen from threads doesn't work, because that involves a switch to real mode for using int10h services. Add a string buffer and hwerr_printf() helper functions to store error messages. Print the buffer later, after device initialization, from main thread in case it is not empty. Signed-off-by: Gerd Hoffmann --- src/output.h | 5 +++++ src/output.c | 17 +++++++++++++++++ src/post.c | 4 ++++ 3 files changed, 26 insertions(+) diff --git a/src/output.h b/src/output.h index 14288cf505d8..4548d2d4abc2 100644 --- a/src/output.h +++ b/src/output.h @@ -16,6 +16,11 @@ char * znprintf(size_t size, const char *fmt, ...) __attribute__ ((format (printf, 2, 3))); void __dprintf(const char *fmt, ...) __attribute__ ((format (printf, 1, 2))); + +extern char hwerror_str[512]; +void hwerr_printf(const char *fmt, ...) + __attribute__ ((format (printf, 1, 2))); + struct bregs; void __debug_enter(struct bregs *regs, const char *fname); void __debug_isr(const char *fname); diff --git a/src/output.c b/src/output.c index 0184444c8f21..8c9d6b8fb1e0 100644 --- a/src/output.c +++ b/src/output.c @@ -419,6 +419,23 @@ snprintf(char *str, size_t size, const char *fmt, ...) return end - str; } =20 +char hwerror_str[512]; +struct snprintfinfo hwerror_info =3D { + .info =3D { putc_str }, + .str =3D hwerror_str, + .end =3D hwerror_str + sizeof(hwerror_str) - 1, +}; + +void +hwerr_printf(const char *fmt, ...) +{ + ASSERT32FLAT(); + va_list args; + va_start(args, fmt); + bvprintf(&hwerror_info.info, fmt, args); + va_end(args); +} + // Build a formatted string - malloc'ing the memory. char * znprintf(size_t size, const char *fmt, ...) diff --git a/src/post.c b/src/post.c index f93106a1c9c9..3e85da43060f 100644 --- a/src/post.c +++ b/src/post.c @@ -216,6 +216,10 @@ maininit(void) device_hardware_setup(); wait_threads(); } + if (hwerror_str[0]) + printf("\n" + "hardware setup errors:\n" + "%s", hwerror_str); =20 // Run option roms optionrom_setup(); --=20 2.40.1 _______________________________________________ SeaBIOS mailing list -- seabios@seabios.org To unsubscribe send an email to seabios-leave@seabios.org From nobody Thu Dec 26 12:13:47 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of seabios.org designates 78.46.105.101 as permitted sender) client-ip=78.46.105.101; envelope-from=seabios-bounces@seabios.org; helo=coreboot.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of seabios.org designates 78.46.105.101 as permitted sender) smtp.mailfrom=seabios-bounces@seabios.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from coreboot.org (coreboot.org [78.46.105.101]) by mx.zohomail.com with SMTPS id 168310581679374.2431636818767; Wed, 3 May 2023 02:23:36 -0700 (PDT) Received: from authenticated-user (PRIMARY_HOSTNAME [PUBLIC_IP]) by coreboot.org (Postfix) with ESMTPA id C1CE120CDA; Wed, 3 May 2023 09:23:32 +0000 (UTC) Received: from authenticated-user (PRIMARY_HOSTNAME [PUBLIC_IP]) by coreboot.org (Postfix) with ESMTP id DB3D122EB1 for ; Wed, 3 May 2023 09:22:07 +0000 (UTC) Received: from authenticated-user (PRIMARY_HOSTNAME [PUBLIC_IP]) [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-517-k4S14Hk1OWqvBzy8QzCszA-1; Wed, 03 May 2023 05:22:05 -0400 Received: from authenticated-user (PRIMARY_HOSTNAME [PUBLIC_IP]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 23B783C1068C for ; Wed, 3 May 2023 09:22:05 +0000 (UTC) Received: from authenticated-user (PRIMARY_HOSTNAME [PUBLIC_IP]) by smtp.corp.redhat.com (Postfix) with ESMTPS id E39D2C15BAD; Wed, 3 May 2023 09:22:04 +0000 (UTC) Received: from authenticated-user (PRIMARY_HOSTNAME [PUBLIC_IP]) id A1B0C1804A41; Wed, 3 May 2023 11:22:01 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1683105726; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=oaPLxwJcPEhzsB8UYJCQxwt+S/o2P+UMcijNL3fi+Wg=; b=VmOpNa5YONj6yUihdC8xBo4MN9l5jc62EVDZsgDAGWR1nWEu0ygsMAS5thOarDylqJxT2+ cxwFzOy+u5F6GnQVTmfR7XGKkr4wM33utLO9W1khoXZYXXVpTkUMaYelPqfZMRQ8cDkU0h zX1Tk7nnky0S6mZg/CUINc1jygwulwA= X-MC-Unique: k4S14Hk1OWqvBzy8QzCszA-1 From: Gerd Hoffmann To: seabios@seabios.org Date: Wed, 3 May 2023 11:22:01 +0200 Message-Id: <20230503092201.487130-3-kraxel@redhat.com> In-Reply-To: <20230503092201.487130-1-kraxel@redhat.com> References: <20230503092201.487130-1-kraxel@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.8 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Message-ID-Hash: KNW4FO3TQENEEDK2533BOIDIP6CEPMQ7 X-Message-ID-Hash: KNW4FO3TQENEEDK2533BOIDIP6CEPMQ7 X-MailFrom: kraxel@redhat.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-seabios.seabios.org-0; header-match-seabios.seabios.org-1; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: Gerd Hoffmann X-Mailman-Version: 3.3.6b1 Precedence: list Subject: [SeaBIOS] [PATCH 2/2] display error message for blocksizes != 512 List-Id: SeaBIOS mailing list Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: Content-Transfer-Encoding: quoted-printable Authentication-Results: coreboot.org; auth=pass smtp.auth=mailman@coreboot.org smtp.mailfrom=seabios-bounces@seabios.org X-Spamd-Bar: --- X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1683105817427100001 Content-Type: text/plain; charset="utf-8"; x-default="true" This actually happens in case users try to use 4k sectors with seabios. Printing the error to the screen instead of only the debug log helps users to figure why their guest doesn't boot. Signed-off-by: Gerd Hoffmann --- src/hw/blockcmd.c | 2 +- src/hw/virtio-blk.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/hw/blockcmd.c b/src/hw/blockcmd.c index 6b6fea970748..ff88680b16b6 100644 --- a/src/hw/blockcmd.c +++ b/src/hw/blockcmd.c @@ -336,7 +336,7 @@ scsi_drive_setup(struct drive_s *drive, const char *s, = int prio) // 64-bit LBA anyway. drive->blksize =3D be32_to_cpu(capdata.blksize); if (drive->blksize !=3D DISK_SECTOR_SIZE) { - dprintf(1, "%s: unsupported block size %d\n", s, drive->blksize); + hwerr_printf("%s: unsupported block size %d\n", s, drive->blksize); return -1; } drive->sectors =3D (u64)be32_to_cpu(capdata.sectors) + 1; diff --git a/src/hw/virtio-blk.c b/src/hw/virtio-blk.c index e087fe4fb0e3..9d2bcb0f38f4 100644 --- a/src/hw/virtio-blk.c +++ b/src/hw/virtio-blk.c @@ -193,8 +193,8 @@ init_virtio_blk(void *data) vdrive->drive.blksize =3D DISK_SECTOR_SIZE; } if (vdrive->drive.blksize !=3D DISK_SECTOR_SIZE) { - dprintf(1, "virtio-blk %pP block size %d is unsupported\n", - pci, vdrive->drive.blksize); + hwerr_printf("virtio-blk %pP block size %d is unsupported\n", + pci, vdrive->drive.blksize); goto fail; } dprintf(3, "virtio-blk %pP blksize=3D%d sectors=3D%u size_max=3D%u= " --=20 2.40.1 _______________________________________________ SeaBIOS mailing list -- seabios@seabios.org To unsubscribe send an email to seabios-leave@seabios.org