From nobody Sun Dec 22 05:44:52 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=1713090683; cv=none; d=zohomail.com; s=zohoarc; b=mhAe6mVzOD915eF5YO5qpEl6/hK53Qq2ZP6LSY/XCdffNADnbjSx8J728/daZLNGFBMmrdVopdThaNuNltTjGtV0pJ9+gnk2BtRUu995MYH2xVwzt56rzytCJgHkkq/QwETnQq5oDNqoBg28OuYZMVka5Z6aZNgGydT5hmpacCU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1713090683; h=Content-Type:Content-Transfer-Encoding:Date:Date:From:From:List-Subscribe:List-Post:List-Owner:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:Reply-To:Subject:Subject:To:To:Message-Id:Cc; bh=arftEkwu1BWxzUyndrt4u7KaLqFifsUnN/SXj/hlruY=; b=fr1S9iv8UXgwI/aHRDoq31Gn3v051iuYAk2JSfp2QYohbBVeNzwGeYRVd5SZTYst0EoFBph5EWXJwN52Q+sxo87bC9DMEJNxEA5CMSQe6buF2ahHEc3R/+1qAlBW9/KS21pP0WqmbfuBeSlB86wsRVO0D4mgs7mqcHyBaz7OXPU= 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 1713090683777102.96974911974917; Sun, 14 Apr 2024 03:31:23 -0700 (PDT) Received: from authenticated-user (PRIMARY_HOSTNAME [PUBLIC_IP]) by coreboot.org (Postfix) with ESMTPA id BB4A817CA1B; Sun, 14 Apr 2024 10:31:18 +0000 (UTC) Received: from authenticated-user (PRIMARY_HOSTNAME [PUBLIC_IP]) by coreboot.org (Postfix) with ESMTP id C1E39172165 for ; Sun, 14 Apr 2024 10:31:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=seabios.org; s=dkim; t=1713090680; h=from:from:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding:in-reply-to: references:list-id:list-owner:list-unsubscribe:list-subscribe:list-post; bh=arftEkwu1BWxzUyndrt4u7KaLqFifsUnN/SXj/hlruY=; b=brWRIPD4UIYUFbEfhrr9l03BRWrPwqC7P77cFK94T30hpd5K4XEzAtyE8JL36CGyWIORbS DjUcCVuo8QETQM9I0zC1pjjgQLrFjgLnX5ZPehtFzekLoZmBne7rL3JMYZcDLqXIp8gnmn 5mHROwDq+LcY28Dsh4ZFEBvINX39Kp8= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=protonmail.com; s=protonmail3; t=1713090660; x=1713349860; bh=8VDcqItfUDOuzX50H/o8u35TUIJhey6REgJEsowO2js=; h=Date:To:From:Subject:Message-ID:Feedback-ID:From:To:Cc:Date: Subject:Reply-To:Feedback-ID:Message-ID:BIMI-Selector; b=ZP7w4HvKJG/n4tZZ271dCXBpdCwrb4Q7v2x4eUUY+ODg20gvx72+fCmRFdVfwgvmU kMv++sO9zpB80vXtpwFo761J92eUblbu15r6ADe6TLxtvzofAOuMIUC5PTIZSXZWNI UOFrEMwokmadQsrWuD6DK7OCQXiYRkVOpRQPTXCVNsgq9DiOEzhuHRsFP/C0mePmoh PzkfEi6LT+bqNDxNR7FRNWUMCs3POrMR3Te7uKV7Ck5DEdCya8qs7aT0JTVAAGdtv3 a1WOzMe4e5YW0LdTY1culec50YpmQyEBjeREqOmIpnVLtz935PIVYCZ8BArKkVPd9g 2ZZrL6HjB8GVA== Date: Sun, 14 Apr 2024 10:30:55 +0000 To: "seabios@seabios.org" Message-ID: Feedback-ID: 17651516:user:proton MIME-Version: 1.0 Message-ID-Hash: VFMRF44PBRAL3IZOWMEE7L5TQE6BAOSG X-Message-ID-Hash: VFMRF44PBRAL3IZOWMEE7L5TQE6BAOSG 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 X-Mailman-Version: 3.3.6b1 Precedence: list Subject: [SeaBIOS] [PATCH v4] 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: 1713090685523100001 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 riku.viitanen@protonmail.com --- src/vgahooks.c | 79 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 79 insertions(+) diff --git a/src/vgahooks.c b/src/vgahooks.c index 1f149532..6adf5b9b 100644 --- a/src/vgahooks.c +++ b/src/vgahooks.c @@ -11,13 +11,16 @@ #include "hw/pcidevice.h" // pci_find_device #include "hw/pci_ids.h" // PCI_VENDOR_ID_VIA #include "hw/pci_regs.h" // PCI_VENDOR_ID +#include "malloc.h" // malloc_low #include "output.h" // dprintf +#include "romfile.h" // struct romfile_s, romfile_find #include "string.h" // strcmp #include "util.h" // handle_155f, handle_157f =20 #define VH_VIA 1 #define VH_INTEL 2 #define VH_SMI 3 +#define VH_MXM30 4 =20 int VGAHookHandlerType VARFSEG; =20 @@ -296,6 +299,77 @@ winent_mb6047_setup(struct pci_device *pci) SmiBootDisplay =3D 0x02; } =20 +/**************************************************************** + * MXM 3.0 hooks + ****************************************************************/ + +void *MXM30SIS VARFSEG; + +/* Function 0: Return Specification Support Level */ +static void +mxm30_F00(struct bregs *regs) +{ + regs->ax =3D 0x005f; /* Success */ + regs->bl =3D 0x30; /* MXM version 3.0 */ + regs->cx =3D (1<<0) | (1<<1); /* Supported functions */ + set_success(regs); +} + +/* Function 1: Return Pointer to MXM System Information Structure */ +static void +mxm30_F01(struct bregs *regs) +{ + switch (regs->cx) { + case 0x0030: + regs->ax =3D 0x005f; /* Success */ + regs->es =3D (u32)GET_GLOBAL(MXM30SIS)/16; + regs->di =3D (u32)GET_GLOBAL(MXM30SIS)%16; + set_success(regs); + break; + default: + handle_155fXX(regs); + break; + } +} + +static void +mxm30_155f80(struct bregs *regs) +{ + switch (regs->bx) { + case 0xff00: mxm30_F00(regs); break; + case 0xff01: mxm30_F01(regs); break; + default: handle_155fXX(regs); break; + } +} + +static void +mxm30_155f(struct bregs *regs) +{ + switch (regs->al) { + case 0x80: mxm30_155f80(regs); break; + default: handle_155fXX(regs); break; + } +} + +static void +mxm30_setup(struct romfile_s *sis_file) +{ + /* Load MXM System Information Structure into low memory */ + MXM30SIS =3D malloc_low(sis_file->size); + if (!MXM30SIS) { + warn_noalloc(); + return; + } + int ret =3D sis_file->copy(sis_file, MXM30SIS, sis_file->size); + if (ret < 0) { + free(MXM30SIS); + MXM30SIS =3D NULL; + return; + } + + VGAHookHandlerType =3D VH_MXM30; +} + /**************************************************************** * Entry and setup ****************************************************************/ @@ -313,6 +387,7 @@ handle_155f(struct bregs *regs) switch (htype) { case VH_VIA: via_155f(regs); break; case VH_INTEL: intel_155f(regs); break; + case VH_MXM30: mxm30_155f(regs); break; default: handle_155fXX(regs); break; } } @@ -340,6 +415,8 @@ vgahook_setup(struct pci_device *pci) if (!CONFIG_VGAHOOKS) return; =20 + struct romfile_s *mxm30sis =3D romfile_find("mxm-30-sis"); + if (strcmp(CBvendor, "KONTRON") =3D=3D 0 && strcmp(CBpart, "986LCD-M")= =3D=3D 0) kontron_setup(pci); else if (strcmp(CBvendor, "GETAC") =3D=3D 0 && strcmp(CBpart, "P470") = =3D=3D 0) @@ -352,4 +429,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 (mxm30sis !=3D NULL) + mxm30_setup(mxm30sis); } --=20 2.44.0 _______________________________________________ SeaBIOS mailing list -- seabios@seabios.org To unsubscribe send an email to seabios-leave@seabios.org