From nobody Sat Dec 21 15:41:25 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=pass; spf=pass (zohomail.com: domain of seabios.org designates 78.46.105.101 as permitted sender) smtp.mailfrom=seabios-bounces@seabios.org; dmarc=pass(p=reject dis=none) header.from=seabios.org ARC-Seal: i=1; a=rsa-sha256; t=1708794516; cv=none; d=zohomail.com; s=zohoarc; b=QrF/o9JXnqNlAcApkxUU76GA1SYONc777fxgCcE13tGWLVVeWY31FJeAdFJp1goTdwXPYiWvHBm9YkDJkg5v3v76oiXFK2unGdAErYZZSUZHugK2MeEaYYQo0Cb+Danb6EZWs+01GLunF7XgPGXOrxMBEmerKmzVcYrBFYZiD/c= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1708794516; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Owner:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:Reply-To:References:Subject:Subject:To:To:Message-Id; bh=wutlzwpmCk4XxduM7j//HMQmxThNnWqk/nmbATlO2Rc=; b=POsh1/VvrZcjsxyYebS3uFVXaA33JEOxzwLPU8YrhwE/+a+i7AMJloDpILM0N1xU0tEoqbzihno8JcF1HXm+ectn8NKKvz19FIBdgs7aEgcQqNAAyjYuIjIxmeZLf3SZkmzbrlwBDPdBSgc5KOiWQeFEjqtSLugBezcar+tgicw= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of seabios.org designates 78.46.105.101 as permitted sender) smtp.mailfrom=seabios-bounces@seabios.org; dmarc=pass header.from= (p=reject dis=none) Return-Path: Received: from coreboot.org (coreboot.org [78.46.105.101]) by mx.zohomail.com with SMTPS id 1708794516471109.15176237914307; Sat, 24 Feb 2024 09:08:36 -0800 (PST) Received: from authenticated-user (PRIMARY_HOSTNAME [PUBLIC_IP]) by coreboot.org (Postfix) with ESMTPA id 11DAC218B5; Sat, 24 Feb 2024 17:08:29 +0000 (UTC) Received: from authenticated-user (PRIMARY_HOSTNAME [PUBLIC_IP]) by coreboot.org (Postfix) with ESMTP id B8743218C1 for ; Sat, 24 Feb 2024 17:08:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=seabios.org; s=dkim; t=1708794512; h=from:from:sender:reply-to: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:list-id:list-owner: list-unsubscribe:list-subscribe:list-post; bh=wutlzwpmCk4XxduM7j//HMQmxThNnWqk/nmbATlO2Rc=; b=Q7wkMDyyXSSvQLlRdaC4OYf5jMMzDrwOYUrIlu61hkTV7rYI4DghX3rIzXeqYA4n9Wj+x/ GPjXneeaLYQWBJgdzSOf8H6pEFIZUUiCPgJ9tHd64bLMgwgEdJUVBTpZjbAEcqkbV+ESjN /89P07EeMdaEGuzy7MvmE17TCiOmu3k= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=protonmail.com; s=protonmail3; t=1708794489; x=1709053689; bh=m26UPMX3aoNj7h8aMUcsZeeCS+sA+zT48FzduMJcWB8=; h=Date:To:From:Cc:Subject:Message-ID:In-Reply-To:References: Feedback-ID:From:To:Cc:Date:Subject:Reply-To:Feedback-ID: Message-ID:BIMI-Selector; b=siAYn78QvOyOOyXcoipwSFVNHP8rhlalKhriOqCA9AaQik+ENNdw846zDvOY++NoV +BiRGhSf3XWl8tKWauLateoNnSu5LbaERuIBs2v0BCfm3VYZ/uhl4G/kLO7qMTt4Ob 5CsSo15M3f/8nAwWw1avCcDLjnA+rAzwIpUJgq2LgCk26eiOTeJ7VO/m0GKTgi7iMI mxdDHGOjcu07llUcrtHphVi5KOdD4Nppi9RDVDyOOfldQCuVi9lgoD0LVIG1IhJFyh 8jJQtIXa4zTLo76+eoxDOBxVVgNbtSKlJmASXtbjtotMaOi6vSi8wBhiqPsORxBVdn l+X8bmtRv1IIg== Date: Sat, 24 Feb 2024 17:07:59 +0000 To: Paul Menzel Message-ID: In-Reply-To: References: Feedback-ID: 17651516:user:proton MIME-Version: 1.0 Message-ID-Hash: 5R5W5NSBRKXP2NNIZV66ZSOKQNPCQCA2 X-Message-ID-Hash: 5R5W5NSBRKXP2NNIZV66ZSOKQNPCQCA2 X-MailFrom: riku.viitanen@protonmail.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: seabios@seabios.org X-Mailman-Version: 3.3.6b1 Precedence: list Subject: [SeaBIOS] Re: [PATCH v2 2/2] Add basic MXM 3.0 interrupt support List-Id: SeaBIOS mailing list Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: From: Riku Viitanen via SeaBIOS Reply-To: Riku Viitanen 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: pass (identity @seabios.org) X-ZM-MESSAGEID: 1708794518593100001 Content-Type: text/plain; charset="utf-8" VGAROMs on MXM graphics cards need certain int15h functions present to function properly. On HP EliteBook 8560w with coreboot and Quadro 2000M, this warning is displayed for 30 seconds, making every boot extremely slow: ERROR: Valid MXM Structure not found POST halted for 30 seconds, P-state limited to P10... This patch implements the minimum functionality to get rid of it: the functions 0 and 1, version 3.0 of the specification [1]. Older version 2.1 is not implemented. Functions are enabled only if romfile "mxm-30-sis" exists. These functions are specific to the MXM revision, but not the board or GPU. Some boards might require more of the optional functions to be implemented, however. - Function 0 returns information about supported functions and revision. - Function 1 returns a pointer to a MXM configuration structure in low memory. This is copied from romfile "mxm-30-sis". It can be extracted from vendor BIOS, by using this same interrupt. I wrote a tool [2] to do that from Linux. TEST: HP EliteBook 8560w boots without error and delay, graphics work. [1]: MXM Graphics Module Software Specification Version 3.0, Revision 1.1 [2]: https://codeberg.org/Riku_V/mxmdump/ Signed-off-by: Riku Viitanen Acked-by: Paul Menzel --- src/Kconfig | 2 +- src/optionroms.c | 8 ++++++ src/vgahooks.c | 70 ++++++++++++++++++++++++++++++++++++++++++++++++ src/vgahooks.h | 8 ++++++ 4 files changed, 87 insertions(+), 1 deletion(-) create mode 100644 src/vgahooks.h diff --git a/src/Kconfig b/src/Kconfig index 3a8ffa15..8cadad2c 100644 --- a/src/Kconfig +++ b/src/Kconfig @@ -452,7 +452,7 @@ menu "BIOS interfaces" default y help Support int 155f BIOS callbacks specific to some Intel and - VIA on-board vga devices. + VIA on-board vga devices and MXM graphics cards. =20 config DISABLE_A20 bool "Disable A20" diff --git a/src/optionroms.c b/src/optionroms.c index e906ab97..4e6a1ad1 100644 --- a/src/optionroms.c +++ b/src/optionroms.c @@ -22,6 +22,7 @@ #include "string.h" // memset #include "util.h" // get_pnp_offset #include "tcgbios.h" // tpm_* +#include "vgahooks.h" // MXM30SIS =20 static int EnforceChecksum, S3ResumeVga, RunPCIroms; =20 @@ -463,6 +464,13 @@ vgarom_setup(void) RunPCIroms =3D romfile_loadint("etc/pci-optionrom-exec", 2); ScreenAndDebug =3D romfile_loadint("etc/screen-and-debug", 1); =20 + // Load MXM 3.0 System Information Structure, if it exists + void *mxm_sis =3D romfile_loadfile_low("mxm-30-sis", NULL); + if (mxm_sis) + MXM30SIS =3D (u32)mxm_sis; + else + MXM30SIS =3D 0; + // Clear option rom memory memset((void*)BUILD_ROM_START, 0, rom_get_max() - BUILD_ROM_START); =20 diff --git a/src/vgahooks.c b/src/vgahooks.c index 1f149532..25e91f20 100644 --- a/src/vgahooks.c +++ b/src/vgahooks.c @@ -18,8 +18,10 @@ #define VH_VIA 1 #define VH_INTEL 2 #define VH_SMI 3 +#define VH_MXM 4 =20 int VGAHookHandlerType VARFSEG; +u32 MXM30SIS VARFSEG; =20 static void handle_155fXX(struct bregs *regs) @@ -296,6 +298,71 @@ winent_mb6047_setup(struct pci_device *pci) SmiBootDisplay =3D 0x02; } =20 +/**************************************************************** + * MXM VGA hooks + ****************************************************************/ + +// Function 0: Return Specification Support Level +static void +mxm_V30_F00(struct bregs *regs) +{ + regs->ax =3D 0x005f; // Success + regs->bl =3D 0x30; // MXM 3.0 + regs->cx =3D 0x0003; // Supported Functions + set_success(regs); +} + +// Function 1: Return a Pointer to the MXM Structure +static void +mxm_V30_F01(struct bregs *regs) +{ + switch (regs->cx) { + case 0x0030: + regs->ax =3D 0x005f; // Success + regs->es =3D GET_GLOBAL(MXM30SIS)/16; + regs->di =3D GET_GLOBAL(MXM30SIS)%16; + set_success(regs); + break; + default: + handle_155fXX(regs); + break; + } +} + +static void +mxm_V30(struct bregs *regs) +{ + switch (regs->bx) { + case 0xff00: mxm_V30_F00(regs); break; + case 0xff01: mxm_V30_F01(regs); break; + default: handle_155fXX(regs); break; + } +} + +static void +mxm_155f80(struct bregs *regs) +{ + // TODO: implement other versions, like 2.1 + mxm_V30(regs); +} + +static void +mxm_155f(struct bregs *regs) +{ + switch (regs->al) { + case 0x80: mxm_155f80(regs); break; + default: handle_155fXX(regs); break; + } +} + +void +mxm_setup(void) +{ + VGAHookHandlerType =3D VH_MXM; +} + + + /**************************************************************** * Entry and setup ****************************************************************/ @@ -313,6 +380,7 @@ handle_155f(struct bregs *regs) switch (htype) { case VH_VIA: via_155f(regs); break; case VH_INTEL: intel_155f(regs); break; + case VH_MXM: mxm_155f(regs); break; default: handle_155fXX(regs); break; } } @@ -352,4 +420,6 @@ vgahook_setup(struct pci_device *pci) via_setup(pci); else if (pci->vendor =3D=3D PCI_VENDOR_ID_INTEL) intel_setup(pci); + else if (GET_GLOBAL(MXM30SIS)) + mxm_setup(); } diff --git a/src/vgahooks.h b/src/vgahooks.h new file mode 100644 index 00000000..c9113714 --- /dev/null +++ b/src/vgahooks.h @@ -0,0 +1,8 @@ +#ifndef __VGAHOOKS_H +#define __VGAHOOKS_H + +#include "types.h" // u32 + +extern u32 MXM30SIS; + +#endif // vgahooks.h --=20 2.43.2 _______________________________________________ SeaBIOS mailing list -- seabios@seabios.org To unsubscribe send an email to seabios-leave@seabios.org