From: Daniel Palmer <daniel@0x0f.com>
To: deller@gmx.de
Cc: linux-fbdev@vger.kernel.org, dri-devel@lists.freedesktop.org,
linux-kernel@vger.kernel.org, Daniel Palmer <daniel@0x0f.com>
Subject: [PATCH 2/5] fbdev: tdfxfb: Attempt to detect if the card wasn't booted
Date: Fri, 31 Jul 2026 03:26:37 +0900 [thread overview]
Message-ID: <20260730182640.2808572-3-daniel@0x0f.com> (raw)
In-Reply-To: <20260730182640.2808572-1-daniel@0x0f.com>
Until now a card had to have been booted by its video BIOS
otherwise the driver would probe, create the fb etc but there
would be no output on the display.
There doesn't seem to be a documented way work out if the BIOS
ran or not. Checking if the values in registers match what is
in the config table in the BIOS seems to be the only option.
On my 16MB Voodoo 3 3000 the registers show 4MB of memory when
unbooted. Checking 4MB != 16MB is enough decide if to reject
the card or not for my machine at least.
Signed-off-by: Daniel Palmer <daniel@0x0f.com>
---
drivers/video/fbdev/tdfxfb.c | 22 ++++++++++++++++++++++
1 file changed, 22 insertions(+)
diff --git a/drivers/video/fbdev/tdfxfb.c b/drivers/video/fbdev/tdfxfb.c
index fa554b09a0a6..1d8bffe1e9fd 100644
--- a/drivers/video/fbdev/tdfxfb.c
+++ b/drivers/video/fbdev/tdfxfb.c
@@ -410,6 +410,25 @@ static bool tdfxfb_get_bios_cfg(struct pci_dev *pdev,
return false;
}
+/*
+ * Try to work out if the card was booted or not, just checks
+ * if the register reported memory amount matches what the BIOS
+ * reports for now.
+ */
+static int tdfxfb_hw_init(struct fb_info *info, struct pci_dev *pdev)
+{
+ struct tdfx_par *par = info->par;
+ struct tdfx_bios_cfg cfg;
+
+ if (tdfxfb_get_bios_cfg(pdev, &cfg) &&
+ tdfx_inl(par, DRAMINIT0) == le32_to_cpu(cfg.draminit0))
+ return 0;
+
+ dev_err(&pdev->dev,
+ "Card hasn't booted and is unusable\n");
+ return -ENODEV;
+}
+
static void do_write_regs(struct fb_info *info, struct banshee_reg *reg)
{
struct tdfx_par *par = info->par;
@@ -1505,6 +1524,9 @@ static int tdfxfb_probe(struct pci_dev *pdev, const struct pci_device_id *id)
goto out_err_regbase;
}
+ if (tdfxfb_hw_init(info, pdev))
+ goto out_err_regbase;
+
info->fix.smem_start = pci_resource_start(pdev, 1);
info->fix.smem_len = do_lfb_size(default_par, pdev->device);
if (!info->fix.smem_len) {
--
2.53.0
next prev parent reply other threads:[~2026-07-30 18:27 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-30 18:26 [PATCH 0/5] fbdev: tdfxfb: Make "unbooted" cards work Daniel Palmer
2026-07-30 18:26 ` [PATCH 1/5] fbdev: tdfxfb: Add helper to read config table from BIOS Daniel Palmer
2026-07-30 18:26 ` Daniel Palmer [this message]
2026-07-30 18:26 ` [PATCH 3/5] fbdev: tdfxfb: Manually boot unbooted cards Daniel Palmer
2026-07-30 18:26 ` [PATCH 4/5] fbdev: tdfxfb: Wake the VGA core before programming the CRTC Daniel Palmer
2026-07-30 18:26 ` [PATCH 5/5] fbdev: tdfxfb: Program the initial video mode Daniel Palmer
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260730182640.2808572-3-daniel@0x0f.com \
--to=daniel@0x0f.com \
--cc=deller@gmx.de \
--cc=dri-devel@lists.freedesktop.org \
--cc=linux-fbdev@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox