- fixes for changes in pci subsystem and power mgt. [2.6.9/2.6.10].
[packages/xorg-driver-video-nvidia.git] / X11-driver-nvidia-enable-pci.patch
1 --- NVIDIA-Linux-x86-1.0-6111-pkg1/usr/src/nv/nv.c.orig 2004-10-27 18:24:52.617102752 +0200
2 +++ NVIDIA-Linux-x86-1.0-6111-pkg1/usr/src/nv/nv.c      2004-10-27 18:26:34.998538408 +0200
3 @@ -1225,6 +1225,7 @@
4          {
5              nv_state_t *nv = NV_STATE_PTR(&nv_linux_devices[i]);
6              release_mem_region(nv->bar.regs.address, nv->bar.regs.size);
7 +            pci_disable_device(nv_linux_devices[i].dev);
8          }
9      }
10  
11 @@ -3517,6 +3518,28 @@
12          return -1;
13      }
14  
15 +    // enable io, mem, and bus-mastering in pci config space
16 +    if (pci_enable_device(dev) != 0)
17 +    {
18 +        nv_printf(NV_DBG_ERRORS,
19 +            "NVRM: pci_enable_device failed, aborting\n");
20 +        return -1;
21 +    }
22 +
23 +    // request ownership of our bars
24 +    // keeps other drivers from banging our registers.
25 +    // only do this for registers, as vesafb requests our framebuffer and will
26 +    // keep us from working properly
27 +    if (!request_mem_region(dev->resource[0].start,
28 +                            dev->resource[0].end - dev->resource[0].start + 1,
29 +                            "nvidia"))
30 +    {
31 +        nv_printf(NV_DBG_ERRORS,
32 +            "NVRM: pci_request_regions failed, aborting\n");
33 +        goto err_disable_dev;
34 +    }
35 +    pci_set_master(dev);
36 +
37      /* initialize bus-dependent config state */
38      nvl = &nv_linux_devices[num_nv_devices];
39      nv  = NV_STATE_PTR(nvl);
40 @@ -3546,7 +3569,7 @@
41          nv_printf(NV_DBG_ERRORS, "NVRM: Please check your BIOS settings.         \n");
42          nv_printf(NV_DBG_ERRORS, "NVRM: [Plug & Play OS   ] should be set to NO  \n");
43          nv_printf(NV_DBG_ERRORS, "NVRM: [Assign IRQ to VGA] should be set to YES \n");
44 -        return -1;
45 +        goto err_zero_dev;
46      }
47  
48      /* sanity check the IO apertures */
49 @@ -3570,39 +3593,9 @@
50                  nv->bar.fb.address, nv->bar.fb.size);
51          }
52  
53 -        /* Clear out the data */
54 -        os_mem_set(nvl, 0, sizeof(nv_linux_state_t));
55 -
56 -        return -1;
57 -    }
58 -
59 -    // request ownership of our bars
60 -    // keeps other drivers from banging our registers.
61 -    // only do this for registers, as vesafb requests our framebuffer and will
62 -    // keep us from working properly
63 -    if (!request_mem_region(nv->bar.regs.address, nv->bar.regs.size, "nvidia"))
64 -    {
65 -        nv_printf(NV_DBG_ERRORS,
66 -            "NVRM: pci_request_regions failed, aborting\n");
67 -
68 -        /* Clear out the data */
69 -        os_mem_set(nvl, 0, sizeof(nv_linux_state_t));
70 -
71 -        return -1;
72 +        goto err_zero_dev;
73      }
74  
75 -    // enable io, mem, and bus-mastering in pci config space
76 -    if (pci_enable_device(dev) != 0)
77 -    {
78 -        nv_printf(NV_DBG_ERRORS,
79 -            "NVRM: pci_enable_device failed, aborting\n");
80 -
81 -        pci_release_regions(dev);
82 -        os_mem_set(nvl, 0, sizeof(nv_linux_state_t));
83 -
84 -        return -1;
85 -    }
86 -    pci_set_master(nvl->dev);
87  
88  #if defined(NV_BUILD_NV_PAT_SUPPORT)
89      if (nvos_find_pci_express_capability(nvl->dev))
90 @@ -3619,13 +3612,7 @@
91      if (nv->bar.regs.map == NULL)
92      {
93          nv_printf(NV_DBG_ERRORS, "NVRM: failed to map registers!!\n");
94 -
95 -        pci_release_regions(dev);
96 -
97 -        /* Clear out the data */
98 -        os_mem_set(nvl, 0, sizeof(nv_linux_state_t));
99 -
100 -        return -1;
101 +        goto err_zero_dev;
102      }
103      nv->flags |= NV_FLAG_MAP_REGS_EARLY;
104  #endif
105 @@ -3642,6 +3629,15 @@
106      num_nv_devices++;
107  
108      return 0;
109 +
110 +err_zero_dev:
111 +    os_mem_set(nvl, 0, sizeof(nv_linux_state_t));
112 +    release_mem_region(dev->resource[0].start,
113 +                       dev->resource[0].end - dev->resource[0].start + 1);
114 +
115 +err_disable_dev:
116 +    pci_disable_device(dev);
117 +    return -1;
118  }
119  
120  int NV_API_CALL nv_no_incoherent_mappings
This page took 0.089555 seconds and 3 git commands to generate.