All of lore.kernel.org
 help / color / mirror / Atom feed
From: Terence Ripperda <tripperda@nvidia.com>
To: Bjorn Helgaas <bjorn.helgaas@hp.com>
Cc: Terence Ripperda <tripperda@nvidia.com>,
	Alan Cox <alan@lxorguk.ukuu.org.uk>,
	Michael Geithe <warpy@gmx.de>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	mastergoon@gmail.com
Subject: Re: 2.6.8.1-mm2 (nvidia breakage)
Date: Mon, 23 Aug 2004 14:01:31 -0500	[thread overview]
Message-ID: <20040823190131.GC1303@hygelac> (raw)
In-Reply-To: <200408230930.18659.bjorn.helgaas@hp.com>

[-- Attachment #1: Type: text/plain, Size: 407 bytes --]

On Mon, Aug 23, 2004 at 09:30:18AM -0600, bjorn.helgaas@hp.com wrote:
> Of course, the nvidia driver still won't work
> because it's looking at pci_dev->irq before calling pci_enable_device(),
> but that's a separate issue.

as Alan pointed out, the video device is bios configured, so may not
be hit by this. nonetheless, we've applied a patch along these lines
to our internal codebase.

Thanks,
Terence


[-- Attachment #2: nv_enable_pci.patch --]
[-- Type: text/plain, Size: 3640 bytes --]

--- nv/nv.c	2004-08-23 13:58:15.000000000 -0500
+++ nv.new/nv.c	2004-08-23 13:58:35.000000000 -0500
@@ -1225,6 +1225,7 @@
         {
             nv_state_t *nv = NV_STATE_PTR(&nv_linux_devices[i]);
             release_mem_region(nv->bar.regs.address, nv->bar.regs.size);
+            pci_disable_device(nv_linux_devices[i].dev);
         }
     }
 
@@ -3516,6 +3517,28 @@
         return -1;
     }
 
+    // enable io, mem, and bus-mastering in pci config space
+    if (pci_enable_device(dev) != 0)
+    {
+        nv_printf(NV_DBG_ERRORS,
+            "NVRM: pci_enable_device failed, aborting\n");
+        return -1;
+    }
+
+    // request ownership of our bars
+    // keeps other drivers from banging our registers.
+    // only do this for registers, as vesafb requests our framebuffer and will
+    // keep us from working properly
+    if (!request_mem_region(dev->resource[0].start,
+                            dev->resource[0].end - dev->resource[0].start + 1,
+                            "nvidia"))
+    {
+        nv_printf(NV_DBG_ERRORS,
+            "NVRM: pci_request_regions failed, aborting\n");
+        goto err_disable_dev;
+    }
+    pci_set_master(dev);
+
     /* initialize bus-dependent config state */
     nvl = &nv_linux_devices[num_nv_devices];
     nv  = NV_STATE_PTR(nvl);
@@ -3545,7 +3568,7 @@
         nv_printf(NV_DBG_ERRORS, "NVRM: Please check your BIOS settings.         \n");
         nv_printf(NV_DBG_ERRORS, "NVRM: [Plug & Play OS   ] should be set to NO  \n");
         nv_printf(NV_DBG_ERRORS, "NVRM: [Assign IRQ to VGA] should be set to YES \n");
-        return -1;
+        goto err_zero_dev;
     }
 
     /* sanity check the IO apertures */
@@ -3569,39 +3592,9 @@
                 nv->bar.fb.address, nv->bar.fb.size);
         }
 
-        /* Clear out the data */
-        os_mem_set(nvl, 0, sizeof(nv_linux_state_t));
-
-        return -1;
-    }
-
-    // request ownership of our bars
-    // keeps other drivers from banging our registers.
-    // only do this for registers, as vesafb requests our framebuffer and will
-    // keep us from working properly
-    if (!request_mem_region(nv->bar.regs.address, nv->bar.regs.size, "nvidia"))
-    {
-        nv_printf(NV_DBG_ERRORS,
-            "NVRM: pci_request_regions failed, aborting\n");
-
-        /* Clear out the data */
-        os_mem_set(nvl, 0, sizeof(nv_linux_state_t));
-
-        return -1;
+        goto err_zero_dev;
     }
 
-    // enable io, mem, and bus-mastering in pci config space
-    if (pci_enable_device(dev) != 0)
-    {
-        nv_printf(NV_DBG_ERRORS,
-            "NVRM: pci_enable_device failed, aborting\n");
-
-        pci_release_regions(dev);
-        os_mem_set(nvl, 0, sizeof(nv_linux_state_t));
-
-        return -1;
-    }
-    pci_set_master(nvl->dev);
 
 #if defined(NV_BUILD_NV_PAT_SUPPORT)
     if (nvos_find_pci_express_capability(nvl->dev))
@@ -3618,13 +3611,7 @@
     if (nv->bar.regs.map == NULL)
     {
         nv_printf(NV_DBG_ERRORS, "NVRM: failed to map registers!!\n");
-
-        pci_release_regions(dev);
-
-        /* Clear out the data */
-        os_mem_set(nvl, 0, sizeof(nv_linux_state_t));
-
-        return -1;
+        goto err_zero_dev;
     }
     nv->flags |= NV_FLAG_MAP_REGS_EARLY;
 #endif
@@ -3641,6 +3628,15 @@
     num_nv_devices++;
 
     return 0;
+
+err_zero_dev:
+    os_mem_set(nvl, 0, sizeof(nv_linux_state_t));
+    release_mem_region(dev->resource[0].start,
+                       dev->resource[0].end - dev->resource[0].start + 1);
+
+err_disable_dev:
+    pci_disable_device(dev);
+    return -1;
 }
 
 int NV_API_CALL nv_no_incoherent_mappings

  reply	other threads:[~2004-08-23 20:12 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20040819092654.27bb9adf.akpm@osdl.org>
2004-08-19 16:51 ` 2.6.8.1-mm2 (nvidia breakage) Bjorn Helgaas
2004-08-19 17:53   ` Alan Cox
2004-08-19 21:51     ` Terence Ripperda
2004-08-19 22:03       ` Bjorn Helgaas
2004-08-19 22:22         ` Alan Cox
2004-08-19 22:58         ` Terence Ripperda
2004-08-20 15:53           ` Bjorn Helgaas
2004-08-20 16:24             ` Michael Geithe
2004-08-20 19:04             ` Terence Ripperda
2004-08-23 15:30           ` Bjorn Helgaas
2004-08-23 19:01             ` Terence Ripperda [this message]
2004-08-24 15:26               ` Bjorn Helgaas
2004-08-24 17:22                 ` Terence Ripperda
2004-08-24 17:36                 ` Roland Dreier
2004-08-24 22:03                   ` Terence Ripperda
2004-08-24 22:35                     ` 2.6.8.1-mm2 (nvidia breakage) [u] Martin Schlemmer [c]
2004-08-24  5:17 2.6.8.1-mm2 (nvidia breakage) Michael Geithe

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=20040823190131.GC1303@hygelac \
    --to=tripperda@nvidia.com \
    --cc=alan@lxorguk.ukuu.org.uk \
    --cc=bjorn.helgaas@hp.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mastergoon@gmail.com \
    --cc=warpy@gmx.de \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.