aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/nouveau/nouveau_agp.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/gpu/drm/nouveau/nouveau_agp.c')
-rw-r--r--drivers/gpu/drm/nouveau/nouveau_agp.c33
1 files changed, 15 insertions, 18 deletions
diff --git a/drivers/gpu/drm/nouveau/nouveau_agp.c b/drivers/gpu/drm/nouveau/nouveau_agp.c
index 51666daddb94..1f6f6ba6847a 100644
--- a/drivers/gpu/drm/nouveau/nouveau_agp.c
+++ b/drivers/gpu/drm/nouveau/nouveau_agp.c
@@ -1,7 +1,5 @@
1#include <linux/module.h> 1#include <linux/module.h>
2 2
3#include <core/device.h>
4
5#include "nouveau_drm.h" 3#include "nouveau_drm.h"
6#include "nouveau_agp.h" 4#include "nouveau_agp.h"
7#include "nouveau_reg.h" 5#include "nouveau_reg.h"
@@ -29,7 +27,7 @@ static struct nouveau_agpmode_quirk nouveau_agpmode_quirk_list[] = {
29static unsigned long 27static unsigned long
30get_agp_mode(struct nouveau_drm *drm, const struct drm_agp_info *info) 28get_agp_mode(struct nouveau_drm *drm, const struct drm_agp_info *info)
31{ 29{
32 struct nouveau_device *device = nv_device(drm->device); 30 struct nvif_device *device = &drm->device;
33 struct nouveau_agpmode_quirk *quirk = nouveau_agpmode_quirk_list; 31 struct nouveau_agpmode_quirk *quirk = nouveau_agpmode_quirk_list;
34 int agpmode = nouveau_agpmode; 32 int agpmode = nouveau_agpmode;
35 unsigned long mode = info->mode; 33 unsigned long mode = info->mode;
@@ -38,7 +36,7 @@ get_agp_mode(struct nouveau_drm *drm, const struct drm_agp_info *info)
38 * FW seems to be broken on nv18, it makes the card lock up 36 * FW seems to be broken on nv18, it makes the card lock up
39 * randomly. 37 * randomly.
40 */ 38 */
41 if (device->chipset == 0x18) 39 if (device->info.chipset == 0x18)
42 mode &= ~PCI_AGP_COMMAND_FW; 40 mode &= ~PCI_AGP_COMMAND_FW;
43 41
44 /* 42 /*
@@ -47,10 +45,10 @@ get_agp_mode(struct nouveau_drm *drm, const struct drm_agp_info *info)
47 while (agpmode == -1 && quirk->hostbridge_vendor) { 45 while (agpmode == -1 && quirk->hostbridge_vendor) {
48 if (info->id_vendor == quirk->hostbridge_vendor && 46 if (info->id_vendor == quirk->hostbridge_vendor &&
49 info->id_device == quirk->hostbridge_device && 47 info->id_device == quirk->hostbridge_device &&
50 device->pdev->vendor == quirk->chip_vendor && 48 nvkm_device(device)->pdev->vendor == quirk->chip_vendor &&
51 device->pdev->device == quirk->chip_device) { 49 nvkm_device(device)->pdev->device == quirk->chip_device) {
52 agpmode = quirk->mode; 50 agpmode = quirk->mode;
53 nv_info(device, "Forcing agp mode to %dX. Use agpmode to override.\n", 51 NV_INFO(drm, "Forcing agp mode to %dX. Use agpmode to override.\n",
54 agpmode); 52 agpmode);
55 break; 53 break;
56 } 54 }
@@ -104,7 +102,7 @@ void
104nouveau_agp_reset(struct nouveau_drm *drm) 102nouveau_agp_reset(struct nouveau_drm *drm)
105{ 103{
106#if __OS_HAS_AGP 104#if __OS_HAS_AGP
107 struct nouveau_device *device = nv_device(drm->device); 105 struct nvif_device *device = &drm->device;
108 struct drm_device *dev = drm->dev; 106 struct drm_device *dev = drm->dev;
109 u32 save[2]; 107 u32 save[2];
110 int ret; 108 int ret;
@@ -115,7 +113,7 @@ nouveau_agp_reset(struct nouveau_drm *drm)
115 /* First of all, disable fast writes, otherwise if it's 113 /* First of all, disable fast writes, otherwise if it's
116 * already enabled in the AGP bridge and we disable the card's 114 * already enabled in the AGP bridge and we disable the card's
117 * AGP controller we might be locking ourselves out of it. */ 115 * AGP controller we might be locking ourselves out of it. */
118 if ((nv_rd32(device, NV04_PBUS_PCI_NV_19) | 116 if ((nvif_rd32(device, NV04_PBUS_PCI_NV_19) |
119 dev->agp->mode) & PCI_AGP_COMMAND_FW) { 117 dev->agp->mode) & PCI_AGP_COMMAND_FW) {
120 struct drm_agp_info info; 118 struct drm_agp_info info;
121 struct drm_agp_mode mode; 119 struct drm_agp_mode mode;
@@ -134,15 +132,15 @@ nouveau_agp_reset(struct nouveau_drm *drm)
134 132
135 133
136 /* clear busmaster bit, and disable AGP */ 134 /* clear busmaster bit, and disable AGP */
137 save[0] = nv_mask(device, NV04_PBUS_PCI_NV_1, 0x00000004, 0x00000000); 135 save[0] = nvif_mask(device, NV04_PBUS_PCI_NV_1, 0x00000004, 0x00000000);
138 nv_wr32(device, NV04_PBUS_PCI_NV_19, 0); 136 nvif_wr32(device, NV04_PBUS_PCI_NV_19, 0);
139 137
140 /* reset PGRAPH, PFIFO and PTIMER */ 138 /* reset PGRAPH, PFIFO and PTIMER */
141 save[1] = nv_mask(device, 0x000200, 0x00011100, 0x00000000); 139 save[1] = nvif_mask(device, 0x000200, 0x00011100, 0x00000000);
142 nv_mask(device, 0x000200, 0x00011100, save[1]); 140 nvif_mask(device, 0x000200, 0x00011100, save[1]);
143 141
144 /* and restore bustmaster bit (gives effect of resetting AGP) */ 142 /* and restore bustmaster bit (gives effect of resetting AGP) */
145 nv_wr32(device, NV04_PBUS_PCI_NV_1, save[0]); 143 nvif_wr32(device, NV04_PBUS_PCI_NV_1, save[0]);
146#endif 144#endif
147} 145}
148 146
@@ -150,7 +148,6 @@ void
150nouveau_agp_init(struct nouveau_drm *drm) 148nouveau_agp_init(struct nouveau_drm *drm)
151{ 149{
152#if __OS_HAS_AGP 150#if __OS_HAS_AGP
153 struct nouveau_device *device = nv_device(drm->device);
154 struct drm_device *dev = drm->dev; 151 struct drm_device *dev = drm->dev;
155 struct drm_agp_info info; 152 struct drm_agp_info info;
156 struct drm_agp_mode mode; 153 struct drm_agp_mode mode;
@@ -162,13 +159,13 @@ nouveau_agp_init(struct nouveau_drm *drm)
162 159
163 ret = drm_agp_acquire(dev); 160 ret = drm_agp_acquire(dev);
164 if (ret) { 161 if (ret) {
165 nv_error(device, "unable to acquire AGP: %d\n", ret); 162 NV_ERROR(drm, "unable to acquire AGP: %d\n", ret);
166 return; 163 return;
167 } 164 }
168 165
169 ret = drm_agp_info(dev, &info); 166 ret = drm_agp_info(dev, &info);
170 if (ret) { 167 if (ret) {
171 nv_error(device, "unable to get AGP info: %d\n", ret); 168 NV_ERROR(drm, "unable to get AGP info: %d\n", ret);
172 return; 169 return;
173 } 170 }
174 171
@@ -177,7 +174,7 @@ nouveau_agp_init(struct nouveau_drm *drm)
177 174
178 ret = drm_agp_enable(dev, mode); 175 ret = drm_agp_enable(dev, mode);
179 if (ret) { 176 if (ret) {
180 nv_error(device, "unable to enable AGP: %d\n", ret); 177 NV_ERROR(drm, "unable to enable AGP: %d\n", ret);
181 return; 178 return;
182 } 179 }
183 180