From nobody Sat Jul 25 07:59:52 2026 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=1784742111; cv=none; d=zohomail.com; s=zohoarc; b=jHjmyE/dYUiUFYhJ9AxUtptxv47yk19eQ4M7XGmW50H+urdDNiLvkW3BKrQMlqJgUQgAhFHYlPWuazfv3SQKWoijofjneH6wcH89fB/ewj9p5v8MLQIDDqHCeqUW0eU8011Rkoc9w18JklNXelEEO8/r+jt4FTV862dJAYM6O40= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1784742111; 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=Te8h1tCzNDSAm3TGXMcuVX/+mNvfWKgMjl6hiLZmXWs=; b=getzmGnbr+BsZHkr/SeJBm6pI9eUQohRdrl+l5AcLjCWoqUnbbrskXPU/fw/oZQ89KyI7NjoYdxJ4nbcuFs/fxkc0y0NCxzE1XGy3xNI31FXQRdRFTC3rrpkF0xv8LKWnnci9vK9KRLavqOO/iMfHPjb1MOn0rKDhE8CaeYxkrs= 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 (mail.coreboot.org [78.46.105.101]) by mx.zohomail.com with SMTPS id 1784742111413439.82509947482754; Wed, 22 Jul 2026 10:41:51 -0700 (PDT) Received: from authenticated-user (PRIMARY_HOSTNAME [PUBLIC_IP]) by coreboot.org (Postfix) with ESMTPA id 91B1554E508; Wed, 22 Jul 2026 17:41:47 +0000 (UTC) Received: from authenticated-user (PRIMARY_HOSTNAME [PUBLIC_IP]) [109.224.244.22]) by coreboot.org (Postfix) with ESMTP id 40AFB54E307 for ; Wed, 22 Jul 2026 17:41:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=seabios.org; s=dkim; t=1784742107; 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=Te8h1tCzNDSAm3TGXMcuVX/+mNvfWKgMjl6hiLZmXWs=; b=ZJEMbwYV4DqvhO6Vq9zI9Em+/IGxtfeqGqx14oytVNnznQtSSXCL4oC0Wb7USy0c1gKSC3 TO3JA1L2MBRLphZOcIMpoCuD4NqbHOAp7fOiWGThQPRO7bTCtRa8Pp/w+rjfr838WP/p/S rvia6RPbZsEwqanZNqP0YiPA2tQGvDI= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=koconnor.net; s=protonmail3; t=1784742084; x=1785001284; bh=BMUDYuOSrBCs6W9pZTneciJSz/U3rU8MVcgSW8EU354=; 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=vIOENVfhLbJtIz4K+3AaUQjb2Xk3oK8UIGG5kqACXJWMZ1Zhirn3oBwAC7LlaXGx0 Kq4DKeQfb4TveoA12i5WpIl7Fdq6FDyiDOQeUn+8TCT6ZWkmoTeuBcU6QfBN57JEoA V0RWvJfb9q7HWpn/+TBhZb6pcpzQMxdOKSV0J5ncJSUS2e+m+CzVZTUMwFiGiVVlmY PCkCFAzn4LnHPbjL0wQnXXHUkAOYa22vSJ9TRkvKPLSalqO/bN2XtSxjQUm3tmxPBK sF0iSCI1X9a6q/5MVDE0/B9lQIfaaO/fDuV1FDpvVo+wWW5di/kBGRTbffaAxpQtaQ Ibc65PQvgu2nw== Date: Wed, 22 Jul 2026 17:41:16 +0000 To: Chad Jablonski Message-ID: In-Reply-To: <20260722024658.1214775-1-chad@jablonski.xyz> References: <20260722024658.1214775-1-chad@jablonski.xyz> Feedback-ID: 132158305:user:proton X-Pm-Message-ID: 2a440db2765554224ca3306530bb1aeee4610260 MIME-Version: 1.0 Message-ID-Hash: F3S45J2MB2BPTGAO6MKVKYBVCZPLXZZ5 X-Message-ID-Hash: F3S45J2MB2BPTGAO6MKVKYBVCZPLXZZ5 X-MailFrom: kevin@koconnor.net X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; header-match-seabios.seabios.org-0; header-match-seabios.seabios.org-1; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header Cc: seabios@seabios.org, BALATON Zoltan , Gerd Hoffmann X-Mailman-Version: 3.3.11b1 Precedence: list Subject: [SeaBIOS] Re: [PATCH] ati-vga: Fix bios tables for radeon KMS driver List-Id: SeaBIOS mailing list Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: From: Kevin O'Connor via SeaBIOS Reply-To: Kevin O'Connor 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: 1784742113532158500 Content-Type: text/plain; charset="utf-8" On Tue, Jul 21, 2026 at 10:46:58PM -0400, Chad Jablonski wrote: > This fixes two issues when running ati-vga with model=3Drv100 under QEMU > using a KMS driver. >=20 > First, the radeon KMS driver does an additional check when looking up COM= BIOS > table entries. It checks a header size field to validate that the entry > falls in the header region. Prior to this patch that size field is zero > which causes the driver to fallback to another method (CLOCK_CNTL > registers) also resulting in bad values and a division by zero. >=20 > 0x60 matches what I've observed in the bios of a Radeon QY (RV100) > (PCI 1002:5159). But I don't think the value is actually important > other than needing to be large enough to encompass the table entries > used here. >=20 > Second, the connector info section needs a non-zero value in the DDC > type field. Zero causes the radeon driver to fail to initialize the DDC > bus and then no connectors are found. DDC_DVI (0x2) is used here so that > the GPIO_DVI_DDC register is used for the radeon. From what I have seen > r128 drivers ignore this field entirely. >=20 > Tested on Debian Squeeze (Linux 2.6.32) and Debian Trixie (Linux 6.12.94). >=20 > Signed-off-by: Chad Jablonski Thanks. It seems the ati-tables.S code was introduced by Gerd, so hopefully he'll be able to review. That said, is there any reason why this code needs to be in assembler? It should be simpler to maintain the code if we can use C code instead. Perhaps something like the below (untested). I'm just guessing on table sizes, alignments, and field names so the example could likely be improved. -Kevin commit eb5ccb59b40dceedec8b381df4a6b6b7cb4193f5 Author: Kevin O'Connor Date: Wed Jul 22 13:12:58 2026 -0400 atiext: Implement ATI tables in atiext.c =20 Move the definitions in ati-tables.S to atiext.c . =20 Signed-off-by: Kevin O'Connor diff --git a/vgasrc/ati-tables.S b/vgasrc/ati-tables.S deleted file mode 100644 index cdbde2f..0000000 --- a/vgasrc/ati-tables.S +++ /dev/null @@ -1,43 +0,0 @@ -// -// Fake ati bios tables. -// -// aty128fb and radeonfb try to gather informations from these tables, -// so add some stuff here to make the drivers happy. Specifically -// radeonfb needs the pll information, otherwise it'll crash with a -// division by zero ... -// - .org 0x48 - .word _ati_main - - // main info - .org 0x50 -_ati_main: - .org 0x50 + 0x30 - .word _ati_pll - .org 0x50 + 0x50 - .word _ati_connector - - // pll info - .org 0x100 -_ati_pll: - .word 0 // ??? (not used by radeonfb) - .word 0 - .word 0 - .word 0 - .word 23000 // sclk - .word 23000 // mclk - .word 0 - .word 2700 // ref_clk - .word 4 // ref_div - .long 12000 // ppll_min - .long 35000 // ppll_max - - // connector info - .org 0x140 -_ati_connector: - .byte 0x10 // one chip - .byte 0x01 // one connector - .word 0x3000 // type DVI-I - .word 0 // end of list - - .org 0x200 diff --git a/vgasrc/atiext.c b/vgasrc/atiext.c index 69dfd46..f003eea 100644 --- a/vgasrc/atiext.c +++ b/vgasrc/atiext.c @@ -338,6 +338,65 @@ static void ati_i2c_edid_rage128(void) dprintf(1, "ati: ... %s\n", valid ? "good" : "invalid"); } =20 +/**************************************************************** + * Fake ati bios tables + ****************************************************************/ + +// aty128fb and radeonfb try to gather informations from these tables, +// so add some stuff here to make the drivers happy. Specifically +// radeonfb needs the pll information, otherwise it'll crash with a +// division by zero ... +struct ati_main_table_s { + u8 pad_0[48]; + u16 pll_table; + u8 pad_50[30]; + u16 connector_table; + u8 pad_82[94]; +} PACKED; + +struct ati_pll_table_s { + u8 pad_0[8]; + u16 sclk; + u16 mclk; + u8 pad_12[2]; + u16 ref_clk; + u16 ref_div; + u32 ppll_min; + u32 ppll_max; + u8 pad_26[38]; +} PACKED; + +struct ati_connector_table_s { + u8 num_chip; + u8 num_connector; + u16 flags; + u16 next; +} PACKED; + +extern u16 _rom_header_ati_table_anchor; +static struct ati_main_table_s ati_main_table VAR16 __aligned(16); +static struct ati_pll_table_s ati_pll_table VAR16 __aligned(16) =3D { + .sclk =3D 23000, + .mclk =3D 23000, + .ref_clk =3D 2700, + .ref_div =3D 4, + .ppll_min =3D 12000, + .ppll_max =3D 35000, +}; +static struct ati_connector_table_s ati_connector_table VAR16 __aligned(16= ) =3D { + .num_chip =3D 0x10, + .num_connector =3D 1, + .flags =3D 0x3000, +}; + +static void +ati_table_setup(void) +{ + SET_VGA(ati_main_table.pll_table, (u32)&ati_pll_table); + SET_VGA(ati_main_table.connector_table, (u32)&ati_connector_table); + SET_VGA(_rom_header_ati_table_anchor, (u32)&ati_main_table); +} + /**************************************************************** * init ****************************************************************/ @@ -379,6 +438,8 @@ ati_setup(void) SET_VGA(VBE_total_memory, totalmem); SET_VGA(ati_io_addr, io_addr); =20 + ati_table_setup(); + // Validate modes struct generic_svga_mode *m =3D svga_modes; unsigned int mcount =3D GET_GLOBAL(svga_mcount); diff --git a/vgasrc/vgaentry.S b/vgasrc/vgaentry.S index f9624fc..14e557a 100644 --- a/vgasrc/vgaentry.S +++ b/vgasrc/vgaentry.S @@ -41,7 +41,11 @@ _rom_header_signature: .asciz "IBM" =20 #if CONFIG_VGA_ATI -#include "ati-tables.S" + .org 0x48 + .global _rom_header_ati_table_anchor +_rom_header_ati_table_anchor: + .word 0 + .align 16 #endif =20 /**************************************************************** _______________________________________________ SeaBIOS mailing list -- seabios@seabios.org To unsubscribe send an email to seabios-leave@seabios.org