From nobody Fri Jul 26 23:43:43 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