From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pj1-f46.google.com (mail-pj1-f46.google.com [209.85.216.46]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5CA23410D3B for ; Fri, 31 Jul 2026 12:19:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.216.46 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785500371; cv=none; b=FDvvGLjljtk3UbZAjlmDNeT0Bmoq8TF7r6ia1oZIwvTqSTYfQplU2c9xGdYWhrM3XMXU5GzHs4zusl05T2QY4QXcrwLyzicTz9VmSp6WcS254GbEJrdJKR57N7Ow99FxF6kFeAvxSDxO1l9thVHYv9h0ngZ+uzKt/qbzJheumo8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785500371; c=relaxed/simple; bh=S5Pj/mZuEKVhW+Yo2GzUHV6Shsf5sPXE3yXbPmQc2X0=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=eiRiVsADxX16h3+At+S9d91sFLtMQI0R9fhV+qt07Uift7s+k5f3ZEliOgQDyZCwEBAxI9DwGb54Ba4h/LXeMRpEOcWnbLSs+kCGUqpGP6WEZvQAtWgS8D6hpmacERLl8/LkPMEc5l5LWD0mGvYAvVuZytDZ4BmojwBH1z64gZo= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=0x0f.com; spf=pass smtp.mailfrom=0x0f.com; dkim=pass (1024-bit key) header.d=0x0f.com header.i=@0x0f.com header.b=Nf5rSxhS; arc=none smtp.client-ip=209.85.216.46 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=0x0f.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=0x0f.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=0x0f.com header.i=@0x0f.com header.b="Nf5rSxhS" Received: by mail-pj1-f46.google.com with SMTP id 98e67ed59e1d1-38a0c7e841fso1158959a91.2 for ; Fri, 31 Jul 2026 05:19:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=0x0f.com; s=google; t=1785500368; x=1786105168; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=QGIvsiAITywJ0rNp56g69w0ITDJR/V//o9H2LeZBivE=; b=Nf5rSxhSYuZ/gvX3cgBF5Mi8wcZrNwRdfLaO59GU3Ta0KwdkaSW7VxfRRv7vap3/YV hb2EJUih5CsdnTawvHdPIGYNXZBo1E8bn0tjm6UlJmlliVzZ/ozbBR5PWHGEu7qN9GCp hLx1P4bvWH5oXMMorW8zH5WziAifi6vf73laU= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1785500368; x=1786105168; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to:content-type; bh=QGIvsiAITywJ0rNp56g69w0ITDJR/V//o9H2LeZBivE=; b=Y8fmJTS1IKd+WPsODDEzXVIySTgM4nboaZTBLSRAxwRzlN/kb5tGDMfem+nM8VWexv Hv6V4DnwKOJ2z3caUcphULqwfV+D5bTZmxn9A9uIPReh9VFbv0J2BGZovb+Ugzy7hEly XEBBfsizr9P8UDGc+pSWRKNKAKLIr/qdHJrkhYyD/zLXOFbjqNGtjpBDtXBQlO5HXH4M xEluDEcj/y88tBPGN62ghuJHrGdoufgEm90MDTs1aIU5KLPq3fiE3Z9yhV8qSGpxAgXm 4MxTuTev9iPHZ8vgeJsNlmRhA7KIT1gWyGQQumS5geQtzI0xHPjDNGvFXmgSZ85zqJs3 5ZSw== X-Forwarded-Encrypted: i=1; AHgh+RqqQlQsaODIvYzCWcifJizldkYLdxSs8YMNfBAX/hAe1ZIDVQiaVTrA5KwFI5yBa/SmnsszjJ1tzPqhUzo=@vger.kernel.org X-Gm-Message-State: AOJu0Yy965W6nlIYg1YGT+coGITPn13K1ffZtbmGUtT9ewUV1IyakTPi RAKRLjUcWcRSRJioY2SY6qxtTr5EWtKZPSQi7MgtvdMwEk+DZOkXVspuCx/af83wqRQ= X-Gm-Gg: AR+sD10fVZvNk24cnpnfyx3rxJw0v5JxUsi8RgdvJ24rijR+j3rXe8ejbCwqYsmRD9M HjqpsIHivy94fRuTQ2We22TLjNsLKXbBC9Zpfv/d1FN/opmdNdLG/AXLHeRe2THLfJB/P2iK+1h U00EqLNXl8QmbhwzdJbRxDvsTIXhzz+4ZEM/gFL/ACCrdOPTDEM9YZJ126ZyLTa+NOoji34pTQ+ hmPP5/Jb8R2TIKe84Ohxm55+5gkeINwelN+uAKnQB4ONylIfQd05Eg7QhAueoEUuXX0C2ZPTZdl eGmhTLRxwZDW73MoFW4o+eLxM8YUrJ3sypo8VI9emU2vP2E2EYCquFS3prr2j4BGZeT5OqkC1pa P+YPP2Hs0UB0CaVMr1NC4NYDBzXy2ZgUD7XG31mMMNKbzLFYCTzH3AievnjDPAns6SpXf8Nmmip nrLMEOb+ODNwqJzcNMpW+T0s0AjRd6jv1YUDa7ahi48kKr0SNkNN0= X-Received: by 2002:a17:90b:1b03:b0:387:e0db:3faa with SMTP id 98e67ed59e1d1-38fb13e34bdmr1636318a91.35.1785500367635; Fri, 31 Jul 2026 05:19:27 -0700 (PDT) Received: from shiro ([2400:4162:2428:2ffe:77cc:841c:1fc1:22d4]) by smtp.googlemail.com with ESMTPSA id 98e67ed59e1d1-38fb2b8c5c5sm321981a91.4.2026.07.31.05.19.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 31 Jul 2026 05:19:26 -0700 (PDT) From: Daniel Palmer To: deller@gmx.de Cc: linux-fbdev@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, Daniel Palmer Subject: [PATCH v2 2/5] fbdev: tdfxfb: Attempt to detect if the card wasn't booted Date: Fri, 31 Jul 2026 21:19:11 +0900 Message-ID: <20260731121915.3362232-3-daniel@0x0f.com> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260731121915.3362232-1-daniel@0x0f.com> References: <20260731121915.3362232-1-daniel@0x0f.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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 checking the contents of the draminit0 register versus what is in the config table seems to be enough. Signed-off-by: Daniel Palmer --- drivers/video/fbdev/tdfxfb.c | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/drivers/video/fbdev/tdfxfb.c b/drivers/video/fbdev/tdfxfb.c index e92658274411..465c46edf6e7 100644 --- a/drivers/video/fbdev/tdfxfb.c +++ b/drivers/video/fbdev/tdfxfb.c @@ -414,6 +414,34 @@ 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 + * one of the dram config registers matches what is in the config + * table if there is one. + */ +static int tdfxfb_hw_init(struct fb_info *info, struct pci_dev *pdev) +{ + struct tdfx_par *par = info->par; + struct tdfx_bios_cfg cfg; + bool have_cfg = tdfxfb_get_bios_cfg(pdev, &cfg); + + /* + * Can't tell if the card is booted or not, + * also cannot boot it. Card might not function. + */ + if (!have_cfg) + return 0; + + /* Card is, probably, already configured. */ + if (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; @@ -1509,6 +1537,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