diff options
Diffstat (limited to 'drivers/gpu/drm')
146 files changed, 5671 insertions, 2691 deletions
diff --git a/drivers/gpu/drm/ati_pcigart.c b/drivers/gpu/drm/ati_pcigart.c index 628eae3e9b83..a1fce68e3bbe 100644 --- a/drivers/gpu/drm/ati_pcigart.c +++ b/drivers/gpu/drm/ati_pcigart.c | |||
@@ -39,8 +39,7 @@ static int drm_ati_alloc_pcigart_table(struct drm_device *dev, | |||
39 | struct drm_ati_pcigart_info *gart_info) | 39 | struct drm_ati_pcigart_info *gart_info) |
40 | { | 40 | { |
41 | gart_info->table_handle = drm_pci_alloc(dev, gart_info->table_size, | 41 | gart_info->table_handle = drm_pci_alloc(dev, gart_info->table_size, |
42 | PAGE_SIZE, | 42 | PAGE_SIZE); |
43 | gart_info->table_mask); | ||
44 | if (gart_info->table_handle == NULL) | 43 | if (gart_info->table_handle == NULL) |
45 | return -ENOMEM; | 44 | return -ENOMEM; |
46 | 45 | ||
@@ -112,6 +111,13 @@ int drm_ati_pcigart_init(struct drm_device *dev, struct drm_ati_pcigart_info *ga | |||
112 | if (gart_info->gart_table_location == DRM_ATI_GART_MAIN) { | 111 | if (gart_info->gart_table_location == DRM_ATI_GART_MAIN) { |
113 | DRM_DEBUG("PCI: no table in VRAM: using normal RAM\n"); | 112 | DRM_DEBUG("PCI: no table in VRAM: using normal RAM\n"); |
114 | 113 | ||
114 | if (pci_set_dma_mask(dev->pdev, gart_info->table_mask)) { | ||
115 | DRM_ERROR("fail to set dma mask to 0x%Lx\n", | ||
116 | gart_info->table_mask); | ||
117 | ret = 1; | ||
118 | goto done; | ||
119 | } | ||
120 | |||
115 | ret = drm_ati_alloc_pcigart_table(dev, gart_info); | 121 | ret = drm_ati_alloc_pcigart_table(dev, gart_info); |
116 | if (ret) { | 122 | if (ret) { |
117 | DRM_ERROR("cannot allocate PCI GART page!\n"); | 123 | DRM_ERROR("cannot allocate PCI GART page!\n"); |
diff --git a/drivers/gpu/drm/drm_bufs.c b/drivers/gpu/drm/drm_bufs.c index 3d09e304f6f4..8417cc4c43f1 100644 --- a/drivers/gpu/drm/drm_bufs.c +++ b/drivers/gpu/drm/drm_bufs.c | |||
@@ -326,7 +326,7 @@ static int drm_addmap_core(struct drm_device * dev, resource_size_t offset, | |||
326 | * As we're limiting the address to 2^32-1 (or less), | 326 | * As we're limiting the address to 2^32-1 (or less), |
327 | * casting it down to 32 bits is no problem, but we | 327 | * casting it down to 32 bits is no problem, but we |
328 | * need to point to a 64bit variable first. */ | 328 | * need to point to a 64bit variable first. */ |
329 | dmah = drm_pci_alloc(dev, map->size, map->size, 0xffffffffUL); | 329 | dmah = drm_pci_alloc(dev, map->size, map->size); |
330 | if (!dmah) { | 330 | if (!dmah) { |
331 | kfree(map); | 331 | kfree(map); |
332 | return -ENOMEM; | 332 | return -ENOMEM; |
@@ -885,7 +885,7 @@ int drm_addbufs_pci(struct drm_device * dev, struct drm_buf_desc * request) | |||
885 | 885 | ||
886 | while (entry->buf_count < count) { | 886 | while (entry->buf_count < count) { |
887 | 887 | ||
888 | dmah = drm_pci_alloc(dev, PAGE_SIZE << page_order, 0x1000, 0xfffffffful); | 888 | dmah = drm_pci_alloc(dev, PAGE_SIZE << page_order, 0x1000); |
889 | 889 | ||
890 | if (!dmah) { | 890 | if (!dmah) { |
891 | /* Set count correctly so we free the proper amount. */ | 891 | /* Set count correctly so we free the proper amount. */ |
diff --git a/drivers/gpu/drm/drm_crtc.c b/drivers/gpu/drm/drm_crtc.c index 5124401f266a..d91fb8c0b7b3 100644 --- a/drivers/gpu/drm/drm_crtc.c +++ b/drivers/gpu/drm/drm_crtc.c | |||
@@ -158,6 +158,7 @@ static struct drm_conn_prop_enum_list drm_connector_enum_list[] = | |||
158 | { DRM_MODE_CONNECTOR_HDMIA, "HDMI Type A", 0 }, | 158 | { DRM_MODE_CONNECTOR_HDMIA, "HDMI Type A", 0 }, |
159 | { DRM_MODE_CONNECTOR_HDMIB, "HDMI Type B", 0 }, | 159 | { DRM_MODE_CONNECTOR_HDMIB, "HDMI Type B", 0 }, |
160 | { DRM_MODE_CONNECTOR_TV, "TV", 0 }, | 160 | { DRM_MODE_CONNECTOR_TV, "TV", 0 }, |
161 | { DRM_MODE_CONNECTOR_eDP, "Embedded DisplayPort", 0 }, | ||
161 | }; | 162 | }; |
162 | 163 | ||
163 | static struct drm_prop_enum_list drm_encoder_enum_list[] = | 164 | static struct drm_prop_enum_list drm_encoder_enum_list[] = |
diff --git a/drivers/gpu/drm/drm_crtc_helper.c b/drivers/gpu/drm/drm_crtc_helper.c index 4231d6db72ec..077313f0d47f 100644 --- a/drivers/gpu/drm/drm_crtc_helper.c +++ b/drivers/gpu/drm/drm_crtc_helper.c | |||
@@ -216,7 +216,7 @@ bool drm_helper_crtc_in_use(struct drm_crtc *crtc) | |||
216 | EXPORT_SYMBOL(drm_helper_crtc_in_use); | 216 | EXPORT_SYMBOL(drm_helper_crtc_in_use); |
217 | 217 | ||
218 | /** | 218 | /** |
219 | * drm_disable_unused_functions - disable unused objects | 219 | * drm_helper_disable_unused_functions - disable unused objects |
220 | * @dev: DRM device | 220 | * @dev: DRM device |
221 | * | 221 | * |
222 | * LOCKING: | 222 | * LOCKING: |
@@ -1032,7 +1032,7 @@ bool drm_helper_initial_config(struct drm_device *dev) | |||
1032 | /* | 1032 | /* |
1033 | * we shouldn't end up with no modes here. | 1033 | * we shouldn't end up with no modes here. |
1034 | */ | 1034 | */ |
1035 | WARN(!count, "No connectors reported connected with modes\n"); | 1035 | printk(KERN_INFO "No connectors reported conncted with modes\n"); |
1036 | 1036 | ||
1037 | drm_setup_crtcs(dev); | 1037 | drm_setup_crtcs(dev); |
1038 | 1038 | ||
@@ -1162,6 +1162,9 @@ EXPORT_SYMBOL(drm_helper_mode_fill_fb_struct); | |||
1162 | int drm_helper_resume_force_mode(struct drm_device *dev) | 1162 | int drm_helper_resume_force_mode(struct drm_device *dev) |
1163 | { | 1163 | { |
1164 | struct drm_crtc *crtc; | 1164 | struct drm_crtc *crtc; |
1165 | struct drm_encoder *encoder; | ||
1166 | struct drm_encoder_helper_funcs *encoder_funcs; | ||
1167 | struct drm_crtc_helper_funcs *crtc_funcs; | ||
1165 | int ret; | 1168 | int ret; |
1166 | 1169 | ||
1167 | list_for_each_entry(crtc, &dev->mode_config.crtc_list, head) { | 1170 | list_for_each_entry(crtc, &dev->mode_config.crtc_list, head) { |
@@ -1174,6 +1177,25 @@ int drm_helper_resume_force_mode(struct drm_device *dev) | |||
1174 | 1177 | ||
1175 | if (ret == false) | 1178 | if (ret == false) |
1176 | DRM_ERROR("failed to set mode on crtc %p\n", crtc); | 1179 | DRM_ERROR("failed to set mode on crtc %p\n", crtc); |
1180 | |||
1181 | /* Turn off outputs that were already powered off */ | ||
1182 | if (drm_helper_choose_crtc_dpms(crtc)) { | ||
1183 | list_for_each_entry(encoder, &dev->mode_config.encoder_list, head) { | ||
1184 | |||
1185 | if(encoder->crtc != crtc) | ||
1186 | continue; | ||
1187 | |||
1188 | encoder_funcs = encoder->helper_private; | ||
1189 | if (encoder_funcs->dpms) | ||
1190 | (*encoder_funcs->dpms) (encoder, | ||
1191 | drm_helper_choose_encoder_dpms(encoder)); | ||
1192 | |||
1193 | crtc_funcs = crtc->helper_private; | ||
1194 | if (crtc_funcs->dpms) | ||
1195 | (*crtc_funcs->dpms) (crtc, | ||
1196 | drm_helper_choose_crtc_dpms(crtc)); | ||
1197 | } | ||
1198 | } | ||
1177 | } | 1199 | } |
1178 | /* disable the unused connectors while restoring the modesetting */ | 1200 | /* disable the unused connectors while restoring the modesetting */ |
1179 | drm_helper_disable_unused_functions(dev); | 1201 | drm_helper_disable_unused_functions(dev); |
diff --git a/drivers/gpu/drm/drm_drv.c b/drivers/gpu/drm/drm_drv.c index ff2f1042cb44..766c46875a20 100644 --- a/drivers/gpu/drm/drm_drv.c +++ b/drivers/gpu/drm/drm_drv.c | |||
@@ -434,11 +434,11 @@ static int drm_version(struct drm_device *dev, void *data, | |||
434 | * Looks up the ioctl function in the ::ioctls table, checking for root | 434 | * Looks up the ioctl function in the ::ioctls table, checking for root |
435 | * previleges if so required, and dispatches to the respective function. | 435 | * previleges if so required, and dispatches to the respective function. |
436 | */ | 436 | */ |
437 | int drm_ioctl(struct inode *inode, struct file *filp, | 437 | long drm_ioctl(struct file *filp, |
438 | unsigned int cmd, unsigned long arg) | 438 | unsigned int cmd, unsigned long arg) |
439 | { | 439 | { |
440 | struct drm_file *file_priv = filp->private_data; | 440 | struct drm_file *file_priv = filp->private_data; |
441 | struct drm_device *dev = file_priv->minor->dev; | 441 | struct drm_device *dev; |
442 | struct drm_ioctl_desc *ioctl; | 442 | struct drm_ioctl_desc *ioctl; |
443 | drm_ioctl_t *func; | 443 | drm_ioctl_t *func; |
444 | unsigned int nr = DRM_IOCTL_NR(cmd); | 444 | unsigned int nr = DRM_IOCTL_NR(cmd); |
@@ -446,6 +446,7 @@ int drm_ioctl(struct inode *inode, struct file *filp, | |||
446 | char stack_kdata[128]; | 446 | char stack_kdata[128]; |
447 | char *kdata = NULL; | 447 | char *kdata = NULL; |
448 | 448 | ||
449 | dev = file_priv->minor->dev; | ||
449 | atomic_inc(&dev->ioctl_count); | 450 | atomic_inc(&dev->ioctl_count); |
450 | atomic_inc(&dev->counts[_DRM_STAT_IOCTLS]); | 451 | atomic_inc(&dev->counts[_DRM_STAT_IOCTLS]); |
451 | ++file_priv->ioctl_count; | 452 | ++file_priv->ioctl_count; |
@@ -501,7 +502,13 @@ int drm_ioctl(struct inode *inode, struct file *filp, | |||
501 | goto err_i1; | 502 | goto err_i1; |
502 | } | 503 | } |
503 | } | 504 | } |
504 | retcode = func(dev, kdata, file_priv); | 505 | if (ioctl->flags & DRM_UNLOCKED) |
506 | retcode = func(dev, kdata, file_priv); | ||
507 | else { | ||
508 | lock_kernel(); | ||
509 | retcode = func(dev, kdata, file_priv); | ||
510 | unlock_kernel(); | ||
511 | } | ||
505 | 512 | ||
506 | if (cmd & IOC_OUT) { | 513 | if (cmd & IOC_OUT) { |
507 | if (copy_to_user((void __user *)arg, kdata, | 514 | if (copy_to_user((void __user *)arg, kdata, |
diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c index c39b26f1abed..defcaf108460 100644 --- a/drivers/gpu/drm/drm_edid.c +++ b/drivers/gpu/drm/drm_edid.c | |||
@@ -911,23 +911,27 @@ static int drm_cvt_modes(struct drm_connector *connector, | |||
911 | struct drm_device *dev = connector->dev; | 911 | struct drm_device *dev = connector->dev; |
912 | struct cvt_timing *cvt; | 912 | struct cvt_timing *cvt; |
913 | const int rates[] = { 60, 85, 75, 60, 50 }; | 913 | const int rates[] = { 60, 85, 75, 60, 50 }; |
914 | const u8 empty[3] = { 0, 0, 0 }; | ||
914 | 915 | ||
915 | for (i = 0; i < 4; i++) { | 916 | for (i = 0; i < 4; i++) { |
916 | int width, height; | 917 | int uninitialized_var(width), height; |
917 | cvt = &(timing->data.other_data.data.cvt[i]); | 918 | cvt = &(timing->data.other_data.data.cvt[i]); |
918 | 919 | ||
919 | height = (cvt->code[0] + ((cvt->code[1] & 0xf0) << 8) + 1) * 2; | 920 | if (!memcmp(cvt->code, empty, 3)) |
920 | switch (cvt->code[1] & 0xc0) { | 921 | continue; |
922 | |||
923 | height = (cvt->code[0] + ((cvt->code[1] & 0xf0) << 4) + 1) * 2; | ||
924 | switch (cvt->code[1] & 0x0c) { | ||
921 | case 0x00: | 925 | case 0x00: |
922 | width = height * 4 / 3; | 926 | width = height * 4 / 3; |
923 | break; | 927 | break; |
924 | case 0x40: | 928 | case 0x04: |
925 | width = height * 16 / 9; | 929 | width = height * 16 / 9; |
926 | break; | 930 | break; |
927 | case 0x80: | 931 | case 0x08: |
928 | width = height * 16 / 10; | 932 | width = height * 16 / 10; |
929 | break; | 933 | break; |
930 | case 0xc0: | 934 | case 0x0c: |
931 | width = height * 15 / 9; | 935 | width = height * 15 / 9; |
932 | break; | 936 | break; |
933 | } | 937 | } |
diff --git a/drivers/gpu/drm/drm_fb_helper.c b/drivers/gpu/drm/drm_fb_helper.c index 1b49fa055f4f..1c2b7d44ec05 100644 --- a/drivers/gpu/drm/drm_fb_helper.c +++ b/drivers/gpu/drm/drm_fb_helper.c | |||
@@ -156,7 +156,7 @@ static bool drm_fb_helper_connector_parse_command_line(struct drm_connector *con | |||
156 | force = DRM_FORCE_ON; | 156 | force = DRM_FORCE_ON; |
157 | break; | 157 | break; |
158 | case 'D': | 158 | case 'D': |
159 | if ((connector->connector_type != DRM_MODE_CONNECTOR_DVII) || | 159 | if ((connector->connector_type != DRM_MODE_CONNECTOR_DVII) && |
160 | (connector->connector_type != DRM_MODE_CONNECTOR_HDMIB)) | 160 | (connector->connector_type != DRM_MODE_CONNECTOR_HDMIB)) |
161 | force = DRM_FORCE_ON; | 161 | force = DRM_FORCE_ON; |
162 | else | 162 | else |
@@ -606,11 +606,10 @@ int drm_fb_helper_check_var(struct fb_var_screeninfo *var, | |||
606 | return -EINVAL; | 606 | return -EINVAL; |
607 | 607 | ||
608 | /* Need to resize the fb object !!! */ | 608 | /* Need to resize the fb object !!! */ |
609 | if (var->xres > fb->width || var->yres > fb->height) { | 609 | if (var->bits_per_pixel > fb->bits_per_pixel || var->xres > fb->width || var->yres > fb->height) { |
610 | DRM_ERROR("Requested width/height is greater than current fb " | 610 | DRM_DEBUG("fb userspace requested width/height/bpp is greater than current fb " |
611 | "object %dx%d > %dx%d\n", var->xres, var->yres, | 611 | "object %dx%d-%d > %dx%d-%d\n", var->xres, var->yres, var->bits_per_pixel, |
612 | fb->width, fb->height); | 612 | fb->width, fb->height, fb->bits_per_pixel); |
613 | DRM_ERROR("Need resizing code.\n"); | ||
614 | return -EINVAL; | 613 | return -EINVAL; |
615 | } | 614 | } |
616 | 615 | ||
diff --git a/drivers/gpu/drm/drm_ioc32.c b/drivers/gpu/drm/drm_ioc32.c index 282d9fdf9f4e..d61d185cf040 100644 --- a/drivers/gpu/drm/drm_ioc32.c +++ b/drivers/gpu/drm/drm_ioc32.c | |||
@@ -104,7 +104,7 @@ static int compat_drm_version(struct file *file, unsigned int cmd, | |||
104 | &version->desc)) | 104 | &version->desc)) |
105 | return -EFAULT; | 105 | return -EFAULT; |
106 | 106 | ||
107 | err = drm_ioctl(file->f_path.dentry->d_inode, file, | 107 | err = drm_ioctl(file, |
108 | DRM_IOCTL_VERSION, (unsigned long)version); | 108 | DRM_IOCTL_VERSION, (unsigned long)version); |
109 | if (err) | 109 | if (err) |
110 | return err; | 110 | return err; |
@@ -145,8 +145,7 @@ static int compat_drm_getunique(struct file *file, unsigned int cmd, | |||
145 | &u->unique)) | 145 | &u->unique)) |
146 | return -EFAULT; | 146 | return -EFAULT; |
147 | 147 | ||
148 | err = drm_ioctl(file->f_path.dentry->d_inode, file, | 148 | err = drm_ioctl(file, DRM_IOCTL_GET_UNIQUE, (unsigned long)u); |
149 | DRM_IOCTL_GET_UNIQUE, (unsigned long)u); | ||
150 | if (err) | 149 | if (err) |
151 | return err; | 150 | return err; |
152 | 151 | ||
@@ -174,8 +173,7 @@ static int compat_drm_setunique(struct file *file, unsigned int cmd, | |||
174 | &u->unique)) | 173 | &u->unique)) |
175 | return -EFAULT; | 174 | return -EFAULT; |
176 | 175 | ||
177 | return drm_ioctl(file->f_path.dentry->d_inode, file, | 176 | return drm_ioctl(file, DRM_IOCTL_SET_UNIQUE, (unsigned long)u); |
178 | DRM_IOCTL_SET_UNIQUE, (unsigned long)u); | ||
179 | } | 177 | } |
180 | 178 | ||
181 | typedef struct drm_map32 { | 179 | typedef struct drm_map32 { |
@@ -205,8 +203,7 @@ static int compat_drm_getmap(struct file *file, unsigned int cmd, | |||
205 | if (__put_user(idx, &map->offset)) | 203 | if (__put_user(idx, &map->offset)) |
206 | return -EFAULT; | 204 | return -EFAULT; |
207 | 205 | ||
208 | err = drm_ioctl(file->f_path.dentry->d_inode, file, | 206 | err = drm_ioctl(file, DRM_IOCTL_GET_MAP, (unsigned long)map); |
209 | DRM_IOCTL_GET_MAP, (unsigned long)map); | ||
210 | if (err) | 207 | if (err) |
211 | return err; | 208 | return err; |
212 | 209 | ||
@@ -246,8 +243,7 @@ static int compat_drm_addmap(struct file *file, unsigned int cmd, | |||
246 | || __put_user(m32.flags, &map->flags)) | 243 | || __put_user(m32.flags, &map->flags)) |
247 | return -EFAULT; | 244 | return -EFAULT; |
248 | 245 | ||
249 | err = drm_ioctl(file->f_path.dentry->d_inode, file, | 246 | err = drm_ioctl(file, DRM_IOCTL_ADD_MAP, (unsigned long)map); |
250 | DRM_IOCTL_ADD_MAP, (unsigned long)map); | ||
251 | if (err) | 247 | if (err) |
252 | return err; | 248 | return err; |
253 | 249 | ||
@@ -284,8 +280,7 @@ static int compat_drm_rmmap(struct file *file, unsigned int cmd, | |||
284 | if (__put_user((void *)(unsigned long)handle, &map->handle)) | 280 | if (__put_user((void *)(unsigned long)handle, &map->handle)) |
285 | return -EFAULT; | 281 | return -EFAULT; |
286 | 282 | ||
287 | return drm_ioctl(file->f_path.dentry->d_inode, file, | 283 | return drm_ioctl(file, DRM_IOCTL_RM_MAP, (unsigned long)map); |
288 | DRM_IOCTL_RM_MAP, (unsigned long)map); | ||
289 | } | 284 | } |
290 | 285 | ||
291 | typedef struct drm_client32 { | 286 | typedef struct drm_client32 { |
@@ -314,8 +309,7 @@ static int compat_drm_getclient(struct file *file, unsigned int cmd, | |||
314 | if (__put_user(idx, &client->idx)) | 309 | if (__put_user(idx, &client->idx)) |
315 | return -EFAULT; | 310 | return -EFAULT; |
316 | 311 | ||
317 | err = drm_ioctl(file->f_path.dentry->d_inode, file, | 312 | err = drm_ioctl(file, DRM_IOCTL_GET_CLIENT, (unsigned long)client); |
318 | DRM_IOCTL_GET_CLIENT, (unsigned long)client); | ||
319 | if (err) | 313 | if (err) |
320 | return err; | 314 | return err; |
321 | 315 | ||
@@ -351,8 +345,7 @@ static int compat_drm_getstats(struct file *file, unsigned int cmd, | |||
351 | if (!access_ok(VERIFY_WRITE, stats, sizeof(*stats))) | 345 | if (!access_ok(VERIFY_WRITE, stats, sizeof(*stats))) |
352 | return -EFAULT; | 346 | return -EFAULT; |
353 | 347 | ||
354 | err = drm_ioctl(file->f_path.dentry->d_inode, file, | 348 | err = drm_ioctl(file, DRM_IOCTL_GET_STATS, (unsigned long)stats); |
355 | DRM_IOCTL_GET_STATS, (unsigned long)stats); | ||
356 | if (err) | 349 | if (err) |
357 | return err; | 350 | return err; |
358 | 351 | ||
@@ -395,8 +388,7 @@ static int compat_drm_addbufs(struct file *file, unsigned int cmd, | |||
395 | || __put_user(agp_start, &buf->agp_start)) | 388 | || __put_user(agp_start, &buf->agp_start)) |
396 | return -EFAULT; | 389 | return -EFAULT; |
397 | 390 | ||
398 | err = drm_ioctl(file->f_path.dentry->d_inode, file, | 391 | err = drm_ioctl(file, DRM_IOCTL_ADD_BUFS, (unsigned long)buf); |
399 | DRM_IOCTL_ADD_BUFS, (unsigned long)buf); | ||
400 | if (err) | 392 | if (err) |
401 | return err; | 393 | return err; |
402 | 394 | ||
@@ -427,8 +419,7 @@ static int compat_drm_markbufs(struct file *file, unsigned int cmd, | |||
427 | || __put_user(b32.high_mark, &buf->high_mark)) | 419 | || __put_user(b32.high_mark, &buf->high_mark)) |
428 | return -EFAULT; | 420 | return -EFAULT; |
429 | 421 | ||
430 | return drm_ioctl(file->f_path.dentry->d_inode, file, | 422 | return drm_ioctl(file, DRM_IOCTL_MARK_BUFS, (unsigned long)buf); |
431 | DRM_IOCTL_MARK_BUFS, (unsigned long)buf); | ||
432 | } | 423 | } |
433 | 424 | ||
434 | typedef struct drm_buf_info32 { | 425 | typedef struct drm_buf_info32 { |
@@ -469,8 +460,7 @@ static int compat_drm_infobufs(struct file *file, unsigned int cmd, | |||
469 | || __put_user(list, &request->list)) | 460 | || __put_user(list, &request->list)) |
470 | return -EFAULT; | 461 | return -EFAULT; |
471 | 462 | ||
472 | err = drm_ioctl(file->f_path.dentry->d_inode, file, | 463 | err = drm_ioctl(file, DRM_IOCTL_INFO_BUFS, (unsigned long)request); |
473 | DRM_IOCTL_INFO_BUFS, (unsigned long)request); | ||
474 | if (err) | 464 | if (err) |
475 | return err; | 465 | return err; |
476 | 466 | ||
@@ -531,8 +521,7 @@ static int compat_drm_mapbufs(struct file *file, unsigned int cmd, | |||
531 | || __put_user(list, &request->list)) | 521 | || __put_user(list, &request->list)) |
532 | return -EFAULT; | 522 | return -EFAULT; |
533 | 523 | ||
534 | err = drm_ioctl(file->f_path.dentry->d_inode, file, | 524 | err = drm_ioctl(file, DRM_IOCTL_MAP_BUFS, (unsigned long)request); |
535 | DRM_IOCTL_MAP_BUFS, (unsigned long)request); | ||
536 | if (err) | 525 | if (err) |
537 | return err; | 526 | return err; |
538 | 527 | ||
@@ -578,8 +567,7 @@ static int compat_drm_freebufs(struct file *file, unsigned int cmd, | |||
578 | &request->list)) | 567 | &request->list)) |
579 | return -EFAULT; | 568 | return -EFAULT; |
580 | 569 | ||
581 | return drm_ioctl(file->f_path.dentry->d_inode, file, | 570 | return drm_ioctl(file, DRM_IOCTL_FREE_BUFS, (unsigned long)request); |
582 | DRM_IOCTL_FREE_BUFS, (unsigned long)request); | ||
583 | } | 571 | } |
584 | 572 | ||
585 | typedef struct drm_ctx_priv_map32 { | 573 | typedef struct drm_ctx_priv_map32 { |
@@ -605,8 +593,7 @@ static int compat_drm_setsareactx(struct file *file, unsigned int cmd, | |||
605 | &request->handle)) | 593 | &request->handle)) |
606 | return -EFAULT; | 594 | return -EFAULT; |
607 | 595 | ||
608 | return drm_ioctl(file->f_path.dentry->d_inode, file, | 596 | return drm_ioctl(file, DRM_IOCTL_SET_SAREA_CTX, (unsigned long)request); |
609 | DRM_IOCTL_SET_SAREA_CTX, (unsigned long)request); | ||
610 | } | 597 | } |
611 | 598 | ||
612 | static int compat_drm_getsareactx(struct file *file, unsigned int cmd, | 599 | static int compat_drm_getsareactx(struct file *file, unsigned int cmd, |
@@ -628,8 +615,7 @@ static int compat_drm_getsareactx(struct file *file, unsigned int cmd, | |||
628 | if (__put_user(ctx_id, &request->ctx_id)) | 615 | if (__put_user(ctx_id, &request->ctx_id)) |
629 | return -EFAULT; | 616 | return -EFAULT; |
630 | 617 | ||
631 | err = drm_ioctl(file->f_path.dentry->d_inode, file, | 618 | err = drm_ioctl(file, DRM_IOCTL_GET_SAREA_CTX, (unsigned long)request); |
632 | DRM_IOCTL_GET_SAREA_CTX, (unsigned long)request); | ||
633 | if (err) | 619 | if (err) |
634 | return err; | 620 | return err; |
635 | 621 | ||
@@ -664,8 +650,7 @@ static int compat_drm_resctx(struct file *file, unsigned int cmd, | |||
664 | &res->contexts)) | 650 | &res->contexts)) |
665 | return -EFAULT; | 651 | return -EFAULT; |
666 | 652 | ||
667 | err = drm_ioctl(file->f_path.dentry->d_inode, file, | 653 | err = drm_ioctl(file, DRM_IOCTL_RES_CTX, (unsigned long)res); |
668 | DRM_IOCTL_RES_CTX, (unsigned long)res); | ||
669 | if (err) | 654 | if (err) |
670 | return err; | 655 | return err; |
671 | 656 | ||
@@ -718,8 +703,7 @@ static int compat_drm_dma(struct file *file, unsigned int cmd, | |||
718 | &d->request_sizes)) | 703 | &d->request_sizes)) |
719 | return -EFAULT; | 704 | return -EFAULT; |
720 | 705 | ||
721 | err = drm_ioctl(file->f_path.dentry->d_inode, file, | 706 | err = drm_ioctl(file, DRM_IOCTL_DMA, (unsigned long)d); |
722 | DRM_IOCTL_DMA, (unsigned long)d); | ||
723 | if (err) | 707 | if (err) |
724 | return err; | 708 | return err; |
725 | 709 | ||
@@ -751,8 +735,7 @@ static int compat_drm_agp_enable(struct file *file, unsigned int cmd, | |||
751 | if (put_user(m32.mode, &mode->mode)) | 735 | if (put_user(m32.mode, &mode->mode)) |
752 | return -EFAULT; | 736 | return -EFAULT; |
753 | 737 | ||
754 | return drm_ioctl(file->f_path.dentry->d_inode, file, | 738 | return drm_ioctl(file, DRM_IOCTL_AGP_ENABLE, (unsigned long)mode); |
755 | DRM_IOCTL_AGP_ENABLE, (unsigned long)mode); | ||
756 | } | 739 | } |
757 | 740 | ||
758 | typedef struct drm_agp_info32 { | 741 | typedef struct drm_agp_info32 { |
@@ -781,8 +764,7 @@ static int compat_drm_agp_info(struct file *file, unsigned int cmd, | |||
781 | if (!access_ok(VERIFY_WRITE, info, sizeof(*info))) | 764 | if (!access_ok(VERIFY_WRITE, info, sizeof(*info))) |
782 | return -EFAULT; | 765 | return -EFAULT; |
783 | 766 | ||
784 | err = drm_ioctl(file->f_path.dentry->d_inode, file, | 767 | err = drm_ioctl(file, DRM_IOCTL_AGP_INFO, (unsigned long)info); |
785 | DRM_IOCTL_AGP_INFO, (unsigned long)info); | ||
786 | if (err) | 768 | if (err) |
787 | return err; | 769 | return err; |
788 | 770 | ||
@@ -827,16 +809,14 @@ static int compat_drm_agp_alloc(struct file *file, unsigned int cmd, | |||
827 | || __put_user(req32.type, &request->type)) | 809 | || __put_user(req32.type, &request->type)) |
828 | return -EFAULT; | 810 | return -EFAULT; |
829 | 811 | ||
830 | err = drm_ioctl(file->f_path.dentry->d_inode, file, | 812 | err = drm_ioctl(file, DRM_IOCTL_AGP_ALLOC, (unsigned long)request); |
831 | DRM_IOCTL_AGP_ALLOC, (unsigned long)request); | ||
832 | if (err) | 813 | if (err) |
833 | return err; | 814 | return err; |
834 | 815 | ||
835 | if (__get_user(req32.handle, &request->handle) | 816 | if (__get_user(req32.handle, &request->handle) |
836 | || __get_user(req32.physical, &request->physical) | 817 | || __get_user(req32.physical, &request->physical) |
837 | || copy_to_user(argp, &req32, sizeof(req32))) { | 818 | || copy_to_user(argp, &req32, sizeof(req32))) { |
838 | drm_ioctl(file->f_path.dentry->d_inode, file, | 819 | drm_ioctl(file, DRM_IOCTL_AGP_FREE, (unsigned long)request); |
839 | DRM_IOCTL_AGP_FREE, (unsigned long)request); | ||
840 | return -EFAULT; | 820 | return -EFAULT; |
841 | } | 821 | } |
842 | 822 | ||
@@ -856,8 +836,7 @@ static int compat_drm_agp_free(struct file *file, unsigned int cmd, | |||
856 | || __put_user(handle, &request->handle)) | 836 | || __put_user(handle, &request->handle)) |
857 | return -EFAULT; | 837 | return -EFAULT; |
858 | 838 | ||
859 | return drm_ioctl(file->f_path.dentry->d_inode, file, | 839 | return drm_ioctl(file, DRM_IOCTL_AGP_FREE, (unsigned long)request); |
860 | DRM_IOCTL_AGP_FREE, (unsigned long)request); | ||
861 | } | 840 | } |
862 | 841 | ||
863 | typedef struct drm_agp_binding32 { | 842 | typedef struct drm_agp_binding32 { |
@@ -881,8 +860,7 @@ static int compat_drm_agp_bind(struct file *file, unsigned int cmd, | |||
881 | || __put_user(req32.offset, &request->offset)) | 860 | || __put_user(req32.offset, &request->offset)) |
882 | return -EFAULT; | 861 | return -EFAULT; |
883 | 862 | ||
884 | return drm_ioctl(file->f_path.dentry->d_inode, file, | 863 | return drm_ioctl(file, DRM_IOCTL_AGP_BIND, (unsigned long)request); |
885 | DRM_IOCTL_AGP_BIND, (unsigned long)request); | ||
886 | } | 864 | } |
887 | 865 | ||
888 | static int compat_drm_agp_unbind(struct file *file, unsigned int cmd, | 866 | static int compat_drm_agp_unbind(struct file *file, unsigned int cmd, |
@@ -898,8 +876,7 @@ static int compat_drm_agp_unbind(struct file *file, unsigned int cmd, | |||
898 | || __put_user(handle, &request->handle)) | 876 | || __put_user(handle, &request->handle)) |
899 | return -EFAULT; | 877 | return -EFAULT; |
900 | 878 | ||
901 | return drm_ioctl(file->f_path.dentry->d_inode, file, | 879 | return drm_ioctl(file, DRM_IOCTL_AGP_UNBIND, (unsigned long)request); |
902 | DRM_IOCTL_AGP_UNBIND, (unsigned long)request); | ||
903 | } | 880 | } |
904 | #endif /* __OS_HAS_AGP */ | 881 | #endif /* __OS_HAS_AGP */ |
905 | 882 | ||
@@ -923,8 +900,7 @@ static int compat_drm_sg_alloc(struct file *file, unsigned int cmd, | |||
923 | || __put_user(x, &request->size)) | 900 | || __put_user(x, &request->size)) |
924 | return -EFAULT; | 901 | return -EFAULT; |
925 | 902 | ||
926 | err = drm_ioctl(file->f_path.dentry->d_inode, file, | 903 | err = drm_ioctl(file, DRM_IOCTL_SG_ALLOC, (unsigned long)request); |
927 | DRM_IOCTL_SG_ALLOC, (unsigned long)request); | ||
928 | if (err) | 904 | if (err) |
929 | return err; | 905 | return err; |
930 | 906 | ||
@@ -950,8 +926,7 @@ static int compat_drm_sg_free(struct file *file, unsigned int cmd, | |||
950 | || __put_user(x << PAGE_SHIFT, &request->handle)) | 926 | || __put_user(x << PAGE_SHIFT, &request->handle)) |
951 | return -EFAULT; | 927 | return -EFAULT; |
952 | 928 | ||
953 | return drm_ioctl(file->f_path.dentry->d_inode, file, | 929 | return drm_ioctl(file, DRM_IOCTL_SG_FREE, (unsigned long)request); |
954 | DRM_IOCTL_SG_FREE, (unsigned long)request); | ||
955 | } | 930 | } |
956 | 931 | ||
957 | #if defined(CONFIG_X86) || defined(CONFIG_IA64) | 932 | #if defined(CONFIG_X86) || defined(CONFIG_IA64) |
@@ -981,8 +956,7 @@ static int compat_drm_update_draw(struct file *file, unsigned int cmd, | |||
981 | __put_user(update32.data, &request->data)) | 956 | __put_user(update32.data, &request->data)) |
982 | return -EFAULT; | 957 | return -EFAULT; |
983 | 958 | ||
984 | err = drm_ioctl(file->f_path.dentry->d_inode, file, | 959 | err = drm_ioctl(file, DRM_IOCTL_UPDATE_DRAW, (unsigned long)request); |
985 | DRM_IOCTL_UPDATE_DRAW, (unsigned long)request); | ||
986 | return err; | 960 | return err; |
987 | } | 961 | } |
988 | #endif | 962 | #endif |
@@ -1023,8 +997,7 @@ static int compat_drm_wait_vblank(struct file *file, unsigned int cmd, | |||
1023 | || __put_user(req32.request.signal, &request->request.signal)) | 997 | || __put_user(req32.request.signal, &request->request.signal)) |
1024 | return -EFAULT; | 998 | return -EFAULT; |
1025 | 999 | ||
1026 | err = drm_ioctl(file->f_path.dentry->d_inode, file, | 1000 | err = drm_ioctl(file, DRM_IOCTL_WAIT_VBLANK, (unsigned long)request); |
1027 | DRM_IOCTL_WAIT_VBLANK, (unsigned long)request); | ||
1028 | if (err) | 1001 | if (err) |
1029 | return err; | 1002 | return err; |
1030 | 1003 | ||
@@ -1094,16 +1067,14 @@ long drm_compat_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) | |||
1094 | * than always failing. | 1067 | * than always failing. |
1095 | */ | 1068 | */ |
1096 | if (nr >= ARRAY_SIZE(drm_compat_ioctls)) | 1069 | if (nr >= ARRAY_SIZE(drm_compat_ioctls)) |
1097 | return drm_ioctl(filp->f_dentry->d_inode, filp, cmd, arg); | 1070 | return drm_ioctl(filp, cmd, arg); |
1098 | 1071 | ||
1099 | fn = drm_compat_ioctls[nr]; | 1072 | fn = drm_compat_ioctls[nr]; |
1100 | 1073 | ||
1101 | lock_kernel(); /* XXX for now */ | ||
1102 | if (fn != NULL) | 1074 | if (fn != NULL) |
1103 | ret = (*fn) (filp, cmd, arg); | 1075 | ret = (*fn) (filp, cmd, arg); |
1104 | else | 1076 | else |
1105 | ret = drm_ioctl(filp->f_path.dentry->d_inode, filp, cmd, arg); | 1077 | ret = drm_ioctl(filp, cmd, arg); |
1106 | unlock_kernel(); | ||
1107 | 1078 | ||
1108 | return ret; | 1079 | return ret; |
1109 | } | 1080 | } |
diff --git a/drivers/gpu/drm/drm_irq.c b/drivers/gpu/drm/drm_irq.c index 7998ee66b317..b98384dbd9a7 100644 --- a/drivers/gpu/drm/drm_irq.c +++ b/drivers/gpu/drm/drm_irq.c | |||
@@ -115,6 +115,7 @@ void drm_vblank_cleanup(struct drm_device *dev) | |||
115 | 115 | ||
116 | dev->num_crtcs = 0; | 116 | dev->num_crtcs = 0; |
117 | } | 117 | } |
118 | EXPORT_SYMBOL(drm_vblank_cleanup); | ||
118 | 119 | ||
119 | int drm_vblank_init(struct drm_device *dev, int num_crtcs) | 120 | int drm_vblank_init(struct drm_device *dev, int num_crtcs) |
120 | { | 121 | { |
@@ -163,7 +164,6 @@ int drm_vblank_init(struct drm_device *dev, int num_crtcs) | |||
163 | } | 164 | } |
164 | 165 | ||
165 | dev->vblank_disable_allowed = 0; | 166 | dev->vblank_disable_allowed = 0; |
166 | |||
167 | return 0; | 167 | return 0; |
168 | 168 | ||
169 | err: | 169 | err: |
@@ -493,6 +493,9 @@ EXPORT_SYMBOL(drm_vblank_off); | |||
493 | */ | 493 | */ |
494 | void drm_vblank_pre_modeset(struct drm_device *dev, int crtc) | 494 | void drm_vblank_pre_modeset(struct drm_device *dev, int crtc) |
495 | { | 495 | { |
496 | /* vblank is not initialized (IRQ not installed ?) */ | ||
497 | if (!dev->num_crtcs) | ||
498 | return; | ||
496 | /* | 499 | /* |
497 | * To avoid all the problems that might happen if interrupts | 500 | * To avoid all the problems that might happen if interrupts |
498 | * were enabled/disabled around or between these calls, we just | 501 | * were enabled/disabled around or between these calls, we just |
diff --git a/drivers/gpu/drm/drm_mm.c b/drivers/gpu/drm/drm_mm.c index d7d7eac3ddd2..cdec32977129 100644 --- a/drivers/gpu/drm/drm_mm.c +++ b/drivers/gpu/drm/drm_mm.c | |||
@@ -358,7 +358,7 @@ struct drm_mm_node *drm_mm_search_free(const struct drm_mm *mm, | |||
358 | if (entry->size >= size + wasted) { | 358 | if (entry->size >= size + wasted) { |
359 | if (!best_match) | 359 | if (!best_match) |
360 | return entry; | 360 | return entry; |
361 | if (size < best_size) { | 361 | if (entry->size < best_size) { |
362 | best = entry; | 362 | best = entry; |
363 | best_size = entry->size; | 363 | best_size = entry->size; |
364 | } | 364 | } |
@@ -408,7 +408,7 @@ struct drm_mm_node *drm_mm_search_free_in_range(const struct drm_mm *mm, | |||
408 | if (entry->size >= size + wasted) { | 408 | if (entry->size >= size + wasted) { |
409 | if (!best_match) | 409 | if (!best_match) |
410 | return entry; | 410 | return entry; |
411 | if (size < best_size) { | 411 | if (entry->size < best_size) { |
412 | best = entry; | 412 | best = entry; |
413 | best_size = entry->size; | 413 | best_size = entry->size; |
414 | } | 414 | } |
diff --git a/drivers/gpu/drm/drm_modes.c b/drivers/gpu/drm/drm_modes.c index 6d81a02463a3..76d63394c776 100644 --- a/drivers/gpu/drm/drm_modes.c +++ b/drivers/gpu/drm/drm_modes.c | |||
@@ -1,9 +1,4 @@ | |||
1 | /* | 1 | /* |
2 | * The list_sort function is (presumably) licensed under the GPL (see the | ||
3 | * top level "COPYING" file for details). | ||
4 | * | ||
5 | * The remainder of this file is: | ||
6 | * | ||
7 | * Copyright © 1997-2003 by The XFree86 Project, Inc. | 2 | * Copyright © 1997-2003 by The XFree86 Project, Inc. |
8 | * Copyright © 2007 Dave Airlie | 3 | * Copyright © 2007 Dave Airlie |
9 | * Copyright © 2007-2008 Intel Corporation | 4 | * Copyright © 2007-2008 Intel Corporation |
@@ -36,6 +31,7 @@ | |||
36 | */ | 31 | */ |
37 | 32 | ||
38 | #include <linux/list.h> | 33 | #include <linux/list.h> |
34 | #include <linux/list_sort.h> | ||
39 | #include "drmP.h" | 35 | #include "drmP.h" |
40 | #include "drm.h" | 36 | #include "drm.h" |
41 | #include "drm_crtc.h" | 37 | #include "drm_crtc.h" |
@@ -855,6 +851,7 @@ EXPORT_SYMBOL(drm_mode_prune_invalid); | |||
855 | 851 | ||
856 | /** | 852 | /** |
857 | * drm_mode_compare - compare modes for favorability | 853 | * drm_mode_compare - compare modes for favorability |
854 | * @priv: unused | ||
858 | * @lh_a: list_head for first mode | 855 | * @lh_a: list_head for first mode |
859 | * @lh_b: list_head for second mode | 856 | * @lh_b: list_head for second mode |
860 | * | 857 | * |
@@ -868,7 +865,7 @@ EXPORT_SYMBOL(drm_mode_prune_invalid); | |||
868 | * Negative if @lh_a is better than @lh_b, zero if they're equivalent, or | 865 | * Negative if @lh_a is better than @lh_b, zero if they're equivalent, or |
869 | * positive if @lh_b is better than @lh_a. | 866 | * positive if @lh_b is better than @lh_a. |
870 | */ | 867 | */ |
871 | static int drm_mode_compare(struct list_head *lh_a, struct list_head *lh_b) | 868 | static int drm_mode_compare(void *priv, struct list_head *lh_a, struct list_head *lh_b) |
872 | { | 869 | { |
873 | struct drm_display_mode *a = list_entry(lh_a, struct drm_display_mode, head); | 870 | struct drm_display_mode *a = list_entry(lh_a, struct drm_display_mode, head); |
874 | struct drm_display_mode *b = list_entry(lh_b, struct drm_display_mode, head); | 871 | struct drm_display_mode *b = list_entry(lh_b, struct drm_display_mode, head); |
@@ -885,85 +882,6 @@ static int drm_mode_compare(struct list_head *lh_a, struct list_head *lh_b) | |||
885 | return diff; | 882 | return diff; |
886 | } | 883 | } |
887 | 884 | ||
888 | /* FIXME: what we don't have a list sort function? */ | ||
889 | /* list sort from Mark J Roberts (mjr@znex.org) */ | ||
890 | void list_sort(struct list_head *head, | ||
891 | int (*cmp)(struct list_head *a, struct list_head *b)) | ||
892 | { | ||
893 | struct list_head *p, *q, *e, *list, *tail, *oldhead; | ||
894 | int insize, nmerges, psize, qsize, i; | ||
895 | |||
896 | list = head->next; | ||
897 | list_del(head); | ||
898 | insize = 1; | ||
899 | for (;;) { | ||
900 | p = oldhead = list; | ||
901 | list = tail = NULL; | ||
902 | nmerges = 0; | ||
903 | |||
904 | while (p) { | ||
905 | nmerges++; | ||
906 | q = p; | ||
907 | psize = 0; | ||
908 | for (i = 0; i < insize; i++) { | ||
909 | psize++; | ||
910 | q = q->next == oldhead ? NULL : q->next; | ||
911 | if (!q) | ||
912 | break; | ||
913 | } | ||
914 | |||
915 | qsize = insize; | ||
916 | while (psize > 0 || (qsize > 0 && q)) { | ||
917 | if (!psize) { | ||
918 | e = q; | ||
919 | q = q->next; | ||
920 | qsize--; | ||
921 | if (q == oldhead) | ||
922 | q = NULL; | ||
923 | } else if (!qsize || !q) { | ||
924 | e = p; | ||
925 | p = p->next; | ||
926 | psize--; | ||
927 | if (p == oldhead) | ||
928 | p = NULL; | ||
929 | } else if (cmp(p, q) <= 0) { | ||
930 | e = p; | ||
931 | p = p->next; | ||
932 | psize--; | ||
933 | if (p == oldhead) | ||
934 | p = NULL; | ||
935 | } else { | ||
936 | e = q; | ||
937 | q = q->next; | ||
938 | qsize--; | ||
939 | if (q == oldhead) | ||
940 | q = NULL; | ||
941 | } | ||
942 | if (tail) | ||
943 | tail->next = e; | ||
944 | else | ||
945 | list = e; | ||
946 | e->prev = tail; | ||
947 | tail = e; | ||
948 | } | ||
949 | p = q; | ||
950 | } | ||
951 | |||
952 | tail->next = list; | ||
953 | list->prev = tail; | ||
954 | |||
955 | if (nmerges <= 1) | ||
956 | break; | ||
957 | |||
958 | insize *= 2; | ||
959 | } | ||
960 | |||
961 | head->next = list; | ||
962 | head->prev = list->prev; | ||
963 | list->prev->next = head; | ||
964 | list->prev = head; | ||
965 | } | ||
966 | |||
967 | /** | 885 | /** |
968 | * drm_mode_sort - sort mode list | 886 | * drm_mode_sort - sort mode list |
969 | * @mode_list: list to sort | 887 | * @mode_list: list to sort |
@@ -975,7 +893,7 @@ void list_sort(struct list_head *head, | |||
975 | */ | 893 | */ |
976 | void drm_mode_sort(struct list_head *mode_list) | 894 | void drm_mode_sort(struct list_head *mode_list) |
977 | { | 895 | { |
978 | list_sort(mode_list, drm_mode_compare); | 896 | list_sort(NULL, mode_list, drm_mode_compare); |
979 | } | 897 | } |
980 | EXPORT_SYMBOL(drm_mode_sort); | 898 | EXPORT_SYMBOL(drm_mode_sort); |
981 | 899 | ||
diff --git a/drivers/gpu/drm/drm_pci.c b/drivers/gpu/drm/drm_pci.c index 577094fb1995..e68ebf92fa2a 100644 --- a/drivers/gpu/drm/drm_pci.c +++ b/drivers/gpu/drm/drm_pci.c | |||
@@ -47,8 +47,7 @@ | |||
47 | /** | 47 | /** |
48 | * \brief Allocate a PCI consistent memory block, for DMA. | 48 | * \brief Allocate a PCI consistent memory block, for DMA. |
49 | */ | 49 | */ |
50 | drm_dma_handle_t *drm_pci_alloc(struct drm_device * dev, size_t size, size_t align, | 50 | drm_dma_handle_t *drm_pci_alloc(struct drm_device * dev, size_t size, size_t align) |
51 | dma_addr_t maxaddr) | ||
52 | { | 51 | { |
53 | drm_dma_handle_t *dmah; | 52 | drm_dma_handle_t *dmah; |
54 | #if 1 | 53 | #if 1 |
@@ -63,11 +62,6 @@ drm_dma_handle_t *drm_pci_alloc(struct drm_device * dev, size_t size, size_t ali | |||
63 | if (align > size) | 62 | if (align > size) |
64 | return NULL; | 63 | return NULL; |
65 | 64 | ||
66 | if (pci_set_dma_mask(dev->pdev, maxaddr) != 0) { | ||
67 | DRM_ERROR("Setting pci dma mask failed\n"); | ||
68 | return NULL; | ||
69 | } | ||
70 | |||
71 | dmah = kmalloc(sizeof(drm_dma_handle_t), GFP_KERNEL); | 65 | dmah = kmalloc(sizeof(drm_dma_handle_t), GFP_KERNEL); |
72 | if (!dmah) | 66 | if (!dmah) |
73 | return NULL; | 67 | return NULL; |
diff --git a/drivers/gpu/drm/i2c/ch7006_drv.c b/drivers/gpu/drm/i2c/ch7006_drv.c index 9422a74c8b54..81681a07a806 100644 --- a/drivers/gpu/drm/i2c/ch7006_drv.c +++ b/drivers/gpu/drm/i2c/ch7006_drv.c | |||
@@ -408,6 +408,11 @@ static int ch7006_probe(struct i2c_client *client, const struct i2c_device_id *i | |||
408 | 408 | ||
409 | ch7006_info(client, "Detected version ID: %x\n", val); | 409 | ch7006_info(client, "Detected version ID: %x\n", val); |
410 | 410 | ||
411 | /* I don't know what this is for, but otherwise I get no | ||
412 | * signal. | ||
413 | */ | ||
414 | ch7006_write(client, 0x3d, 0x0); | ||
415 | |||
411 | return 0; | 416 | return 0; |
412 | 417 | ||
413 | fail: | 418 | fail: |
diff --git a/drivers/gpu/drm/i2c/ch7006_mode.c b/drivers/gpu/drm/i2c/ch7006_mode.c index 87f5445092e8..e447dfb63890 100644 --- a/drivers/gpu/drm/i2c/ch7006_mode.c +++ b/drivers/gpu/drm/i2c/ch7006_mode.c | |||
@@ -427,11 +427,6 @@ void ch7006_state_load(struct i2c_client *client, | |||
427 | ch7006_load_reg(client, state, CH7006_SUBC_INC7); | 427 | ch7006_load_reg(client, state, CH7006_SUBC_INC7); |
428 | ch7006_load_reg(client, state, CH7006_PLL_CONTROL); | 428 | ch7006_load_reg(client, state, CH7006_PLL_CONTROL); |
429 | ch7006_load_reg(client, state, CH7006_CALC_SUBC_INC0); | 429 | ch7006_load_reg(client, state, CH7006_CALC_SUBC_INC0); |
430 | |||
431 | /* I don't know what this is for, but otherwise I get no | ||
432 | * signal. | ||
433 | */ | ||
434 | ch7006_write(client, 0x3d, 0x0); | ||
435 | } | 430 | } |
436 | 431 | ||
437 | void ch7006_state_save(struct i2c_client *client, | 432 | void ch7006_state_save(struct i2c_client *client, |
diff --git a/drivers/gpu/drm/i810/i810_dma.c b/drivers/gpu/drm/i810/i810_dma.c index 7d1d88cdf2dc..de32d22a8c39 100644 --- a/drivers/gpu/drm/i810/i810_dma.c +++ b/drivers/gpu/drm/i810/i810_dma.c | |||
@@ -115,7 +115,7 @@ static int i810_mmap_buffers(struct file *filp, struct vm_area_struct *vma) | |||
115 | static const struct file_operations i810_buffer_fops = { | 115 | static const struct file_operations i810_buffer_fops = { |
116 | .open = drm_open, | 116 | .open = drm_open, |
117 | .release = drm_release, | 117 | .release = drm_release, |
118 | .ioctl = drm_ioctl, | 118 | .unlocked_ioctl = drm_ioctl, |
119 | .mmap = i810_mmap_buffers, | 119 | .mmap = i810_mmap_buffers, |
120 | .fasync = drm_fasync, | 120 | .fasync = drm_fasync, |
121 | }; | 121 | }; |
diff --git a/drivers/gpu/drm/i810/i810_drv.c b/drivers/gpu/drm/i810/i810_drv.c index fabb9a817966..c1e02752e023 100644 --- a/drivers/gpu/drm/i810/i810_drv.c +++ b/drivers/gpu/drm/i810/i810_drv.c | |||
@@ -59,7 +59,7 @@ static struct drm_driver driver = { | |||
59 | .owner = THIS_MODULE, | 59 | .owner = THIS_MODULE, |
60 | .open = drm_open, | 60 | .open = drm_open, |
61 | .release = drm_release, | 61 | .release = drm_release, |
62 | .ioctl = drm_ioctl, | 62 | .unlocked_ioctl = drm_ioctl, |
63 | .mmap = drm_mmap, | 63 | .mmap = drm_mmap, |
64 | .poll = drm_poll, | 64 | .poll = drm_poll, |
65 | .fasync = drm_fasync, | 65 | .fasync = drm_fasync, |
diff --git a/drivers/gpu/drm/i830/i830_dma.c b/drivers/gpu/drm/i830/i830_dma.c index 877bf6cb14a4..06bd732e6463 100644 --- a/drivers/gpu/drm/i830/i830_dma.c +++ b/drivers/gpu/drm/i830/i830_dma.c | |||
@@ -117,7 +117,7 @@ static int i830_mmap_buffers(struct file *filp, struct vm_area_struct *vma) | |||
117 | static const struct file_operations i830_buffer_fops = { | 117 | static const struct file_operations i830_buffer_fops = { |
118 | .open = drm_open, | 118 | .open = drm_open, |
119 | .release = drm_release, | 119 | .release = drm_release, |
120 | .ioctl = drm_ioctl, | 120 | .unlocked_ioctl = drm_ioctl, |
121 | .mmap = i830_mmap_buffers, | 121 | .mmap = i830_mmap_buffers, |
122 | .fasync = drm_fasync, | 122 | .fasync = drm_fasync, |
123 | }; | 123 | }; |
diff --git a/drivers/gpu/drm/i830/i830_drv.c b/drivers/gpu/drm/i830/i830_drv.c index 389597e4a623..44f990bed8f4 100644 --- a/drivers/gpu/drm/i830/i830_drv.c +++ b/drivers/gpu/drm/i830/i830_drv.c | |||
@@ -70,7 +70,7 @@ static struct drm_driver driver = { | |||
70 | .owner = THIS_MODULE, | 70 | .owner = THIS_MODULE, |
71 | .open = drm_open, | 71 | .open = drm_open, |
72 | .release = drm_release, | 72 | .release = drm_release, |
73 | .ioctl = drm_ioctl, | 73 | .unlocked_ioctl = drm_ioctl, |
74 | .mmap = drm_mmap, | 74 | .mmap = drm_mmap, |
75 | .poll = drm_poll, | 75 | .poll = drm_poll, |
76 | .fasync = drm_fasync, | 76 | .fasync = drm_fasync, |
diff --git a/drivers/gpu/drm/i915/i915_debugfs.c b/drivers/gpu/drm/i915/i915_debugfs.c index 18476bf0b580..9c9998c4dceb 100644 --- a/drivers/gpu/drm/i915/i915_debugfs.c +++ b/drivers/gpu/drm/i915/i915_debugfs.c | |||
@@ -272,7 +272,7 @@ static void i915_dump_pages(struct seq_file *m, struct page **pages, int page_co | |||
272 | mem = kmap_atomic(pages[page], KM_USER0); | 272 | mem = kmap_atomic(pages[page], KM_USER0); |
273 | for (i = 0; i < PAGE_SIZE; i += 4) | 273 | for (i = 0; i < PAGE_SIZE; i += 4) |
274 | seq_printf(m, "%08x : %08x\n", i, mem[i / 4]); | 274 | seq_printf(m, "%08x : %08x\n", i, mem[i / 4]); |
275 | kunmap_atomic(pages[page], KM_USER0); | 275 | kunmap_atomic(mem, KM_USER0); |
276 | } | 276 | } |
277 | } | 277 | } |
278 | 278 | ||
@@ -386,34 +386,6 @@ out: | |||
386 | return 0; | 386 | return 0; |
387 | } | 387 | } |
388 | 388 | ||
389 | static int i915_registers_info(struct seq_file *m, void *data) { | ||
390 | struct drm_info_node *node = (struct drm_info_node *) m->private; | ||
391 | struct drm_device *dev = node->minor->dev; | ||
392 | drm_i915_private_t *dev_priv = dev->dev_private; | ||
393 | uint32_t reg; | ||
394 | |||
395 | #define DUMP_RANGE(start, end) \ | ||
396 | for (reg=start; reg < end; reg += 4) \ | ||
397 | seq_printf(m, "%08x\t%08x\n", reg, I915_READ(reg)); | ||
398 | |||
399 | DUMP_RANGE(0x00000, 0x00fff); /* VGA registers */ | ||
400 | DUMP_RANGE(0x02000, 0x02fff); /* instruction, memory, interrupt control registers */ | ||
401 | DUMP_RANGE(0x03000, 0x031ff); /* FENCE and PPGTT control registers */ | ||
402 | DUMP_RANGE(0x03200, 0x03fff); /* frame buffer compression registers */ | ||
403 | DUMP_RANGE(0x05000, 0x05fff); /* I/O control registers */ | ||
404 | DUMP_RANGE(0x06000, 0x06fff); /* clock control registers */ | ||
405 | DUMP_RANGE(0x07000, 0x07fff); /* 3D internal debug registers */ | ||
406 | DUMP_RANGE(0x07400, 0x088ff); /* GPE debug registers */ | ||
407 | DUMP_RANGE(0x0a000, 0x0afff); /* display palette registers */ | ||
408 | DUMP_RANGE(0x10000, 0x13fff); /* MMIO MCHBAR */ | ||
409 | DUMP_RANGE(0x30000, 0x3ffff); /* overlay registers */ | ||
410 | DUMP_RANGE(0x60000, 0x6ffff); /* display engine pipeline registers */ | ||
411 | DUMP_RANGE(0x70000, 0x72fff); /* display and cursor registers */ | ||
412 | DUMP_RANGE(0x73000, 0x73fff); /* performance counters */ | ||
413 | |||
414 | return 0; | ||
415 | } | ||
416 | |||
417 | static int | 389 | static int |
418 | i915_wedged_open(struct inode *inode, | 390 | i915_wedged_open(struct inode *inode, |
419 | struct file *filp) | 391 | struct file *filp) |
@@ -519,7 +491,6 @@ static int i915_wedged_create(struct dentry *root, struct drm_minor *minor) | |||
519 | } | 491 | } |
520 | 492 | ||
521 | static struct drm_info_list i915_debugfs_list[] = { | 493 | static struct drm_info_list i915_debugfs_list[] = { |
522 | {"i915_regs", i915_registers_info, 0}, | ||
523 | {"i915_gem_active", i915_gem_object_list_info, 0, (void *) ACTIVE_LIST}, | 494 | {"i915_gem_active", i915_gem_object_list_info, 0, (void *) ACTIVE_LIST}, |
524 | {"i915_gem_flushing", i915_gem_object_list_info, 0, (void *) FLUSHING_LIST}, | 495 | {"i915_gem_flushing", i915_gem_object_list_info, 0, (void *) FLUSHING_LIST}, |
525 | {"i915_gem_inactive", i915_gem_object_list_info, 0, (void *) INACTIVE_LIST}, | 496 | {"i915_gem_inactive", i915_gem_object_list_info, 0, (void *) INACTIVE_LIST}, |
diff --git a/drivers/gpu/drm/i915/i915_dma.c b/drivers/gpu/drm/i915/i915_dma.c index 701bfeac7f57..bbe47812e4b6 100644 --- a/drivers/gpu/drm/i915/i915_dma.c +++ b/drivers/gpu/drm/i915/i915_dma.c | |||
@@ -123,7 +123,7 @@ static int i915_init_phys_hws(struct drm_device *dev) | |||
123 | drm_i915_private_t *dev_priv = dev->dev_private; | 123 | drm_i915_private_t *dev_priv = dev->dev_private; |
124 | /* Program Hardware Status Page */ | 124 | /* Program Hardware Status Page */ |
125 | dev_priv->status_page_dmah = | 125 | dev_priv->status_page_dmah = |
126 | drm_pci_alloc(dev, PAGE_SIZE, PAGE_SIZE, 0xffffffff); | 126 | drm_pci_alloc(dev, PAGE_SIZE, PAGE_SIZE); |
127 | 127 | ||
128 | if (!dev_priv->status_page_dmah) { | 128 | if (!dev_priv->status_page_dmah) { |
129 | DRM_ERROR("Can not allocate hardware status page\n"); | 129 | DRM_ERROR("Can not allocate hardware status page\n"); |
@@ -813,9 +813,13 @@ static int i915_getparam(struct drm_device *dev, void *data, | |||
813 | case I915_PARAM_HAS_PAGEFLIPPING: | 813 | case I915_PARAM_HAS_PAGEFLIPPING: |
814 | value = 1; | 814 | value = 1; |
815 | break; | 815 | break; |
816 | case I915_PARAM_HAS_EXECBUF2: | ||
817 | /* depends on GEM */ | ||
818 | value = dev_priv->has_gem; | ||
819 | break; | ||
816 | default: | 820 | default: |
817 | DRM_DEBUG_DRIVER("Unknown parameter %d\n", | 821 | DRM_DEBUG_DRIVER("Unknown parameter %d\n", |
818 | param->param); | 822 | param->param); |
819 | return -EINVAL; | 823 | return -EINVAL; |
820 | } | 824 | } |
821 | 825 | ||
@@ -1117,7 +1121,8 @@ static void i915_setup_compression(struct drm_device *dev, int size) | |||
1117 | { | 1121 | { |
1118 | struct drm_i915_private *dev_priv = dev->dev_private; | 1122 | struct drm_i915_private *dev_priv = dev->dev_private; |
1119 | struct drm_mm_node *compressed_fb, *compressed_llb; | 1123 | struct drm_mm_node *compressed_fb, *compressed_llb; |
1120 | unsigned long cfb_base, ll_base; | 1124 | unsigned long cfb_base; |
1125 | unsigned long ll_base = 0; | ||
1121 | 1126 | ||
1122 | /* Leave 1M for line length buffer & misc. */ | 1127 | /* Leave 1M for line length buffer & misc. */ |
1123 | compressed_fb = drm_mm_search_free(&dev_priv->vram, size, 4096, 0); | 1128 | compressed_fb = drm_mm_search_free(&dev_priv->vram, size, 4096, 0); |
@@ -1200,14 +1205,6 @@ static int i915_load_modeset_init(struct drm_device *dev, | |||
1200 | dev->mode_config.fb_base = drm_get_resource_start(dev, fb_bar) & | 1205 | dev->mode_config.fb_base = drm_get_resource_start(dev, fb_bar) & |
1201 | 0xff000000; | 1206 | 0xff000000; |
1202 | 1207 | ||
1203 | if (IS_MOBILE(dev) || IS_I9XX(dev)) | ||
1204 | dev_priv->cursor_needs_physical = true; | ||
1205 | else | ||
1206 | dev_priv->cursor_needs_physical = false; | ||
1207 | |||
1208 | if (IS_I965G(dev) || IS_G33(dev)) | ||
1209 | dev_priv->cursor_needs_physical = false; | ||
1210 | |||
1211 | /* Basic memrange allocator for stolen space (aka vram) */ | 1208 | /* Basic memrange allocator for stolen space (aka vram) */ |
1212 | drm_mm_init(&dev_priv->vram, 0, prealloc_size); | 1209 | drm_mm_init(&dev_priv->vram, 0, prealloc_size); |
1213 | DRM_INFO("set up %ldM of stolen space\n", prealloc_size / (1024*1024)); | 1210 | DRM_INFO("set up %ldM of stolen space\n", prealloc_size / (1024*1024)); |
@@ -1257,6 +1254,8 @@ static int i915_load_modeset_init(struct drm_device *dev, | |||
1257 | if (ret) | 1254 | if (ret) |
1258 | goto destroy_ringbuffer; | 1255 | goto destroy_ringbuffer; |
1259 | 1256 | ||
1257 | intel_modeset_init(dev); | ||
1258 | |||
1260 | ret = drm_irq_install(dev); | 1259 | ret = drm_irq_install(dev); |
1261 | if (ret) | 1260 | if (ret) |
1262 | goto destroy_ringbuffer; | 1261 | goto destroy_ringbuffer; |
@@ -1271,8 +1270,6 @@ static int i915_load_modeset_init(struct drm_device *dev, | |||
1271 | 1270 | ||
1272 | I915_WRITE(INSTPM, (1 << 5) | (1 << 21)); | 1271 | I915_WRITE(INSTPM, (1 << 5) | (1 << 21)); |
1273 | 1272 | ||
1274 | intel_modeset_init(dev); | ||
1275 | |||
1276 | drm_helper_initial_config(dev); | 1273 | drm_helper_initial_config(dev); |
1277 | 1274 | ||
1278 | return 0; | 1275 | return 0; |
@@ -1360,7 +1357,7 @@ int i915_driver_load(struct drm_device *dev, unsigned long flags) | |||
1360 | { | 1357 | { |
1361 | struct drm_i915_private *dev_priv = dev->dev_private; | 1358 | struct drm_i915_private *dev_priv = dev->dev_private; |
1362 | resource_size_t base, size; | 1359 | resource_size_t base, size; |
1363 | int ret = 0, mmio_bar = IS_I9XX(dev) ? 0 : 1; | 1360 | int ret = 0, mmio_bar; |
1364 | uint32_t agp_size, prealloc_size, prealloc_start; | 1361 | uint32_t agp_size, prealloc_size, prealloc_start; |
1365 | 1362 | ||
1366 | /* i915 has 4 more counters */ | 1363 | /* i915 has 4 more counters */ |
@@ -1376,8 +1373,10 @@ int i915_driver_load(struct drm_device *dev, unsigned long flags) | |||
1376 | 1373 | ||
1377 | dev->dev_private = (void *)dev_priv; | 1374 | dev->dev_private = (void *)dev_priv; |
1378 | dev_priv->dev = dev; | 1375 | dev_priv->dev = dev; |
1376 | dev_priv->info = (struct intel_device_info *) flags; | ||
1379 | 1377 | ||
1380 | /* Add register map (needed for suspend/resume) */ | 1378 | /* Add register map (needed for suspend/resume) */ |
1379 | mmio_bar = IS_I9XX(dev) ? 0 : 1; | ||
1381 | base = drm_get_resource_start(dev, mmio_bar); | 1380 | base = drm_get_resource_start(dev, mmio_bar); |
1382 | size = drm_get_resource_len(dev, mmio_bar); | 1381 | size = drm_get_resource_len(dev, mmio_bar); |
1383 | 1382 | ||
@@ -1652,6 +1651,7 @@ struct drm_ioctl_desc i915_ioctls[] = { | |||
1652 | DRM_IOCTL_DEF(DRM_I915_HWS_ADDR, i915_set_status_page, DRM_AUTH|DRM_MASTER|DRM_ROOT_ONLY), | 1651 | DRM_IOCTL_DEF(DRM_I915_HWS_ADDR, i915_set_status_page, DRM_AUTH|DRM_MASTER|DRM_ROOT_ONLY), |
1653 | DRM_IOCTL_DEF(DRM_I915_GEM_INIT, i915_gem_init_ioctl, DRM_AUTH|DRM_MASTER|DRM_ROOT_ONLY), | 1652 | DRM_IOCTL_DEF(DRM_I915_GEM_INIT, i915_gem_init_ioctl, DRM_AUTH|DRM_MASTER|DRM_ROOT_ONLY), |
1654 | DRM_IOCTL_DEF(DRM_I915_GEM_EXECBUFFER, i915_gem_execbuffer, DRM_AUTH), | 1653 | DRM_IOCTL_DEF(DRM_I915_GEM_EXECBUFFER, i915_gem_execbuffer, DRM_AUTH), |
1654 | DRM_IOCTL_DEF(DRM_I915_GEM_EXECBUFFER2, i915_gem_execbuffer2, DRM_AUTH), | ||
1655 | DRM_IOCTL_DEF(DRM_I915_GEM_PIN, i915_gem_pin_ioctl, DRM_AUTH|DRM_ROOT_ONLY), | 1655 | DRM_IOCTL_DEF(DRM_I915_GEM_PIN, i915_gem_pin_ioctl, DRM_AUTH|DRM_ROOT_ONLY), |
1656 | DRM_IOCTL_DEF(DRM_I915_GEM_UNPIN, i915_gem_unpin_ioctl, DRM_AUTH|DRM_ROOT_ONLY), | 1656 | DRM_IOCTL_DEF(DRM_I915_GEM_UNPIN, i915_gem_unpin_ioctl, DRM_AUTH|DRM_ROOT_ONLY), |
1657 | DRM_IOCTL_DEF(DRM_I915_GEM_BUSY, i915_gem_busy_ioctl, DRM_AUTH), | 1657 | DRM_IOCTL_DEF(DRM_I915_GEM_BUSY, i915_gem_busy_ioctl, DRM_AUTH), |
diff --git a/drivers/gpu/drm/i915/i915_drv.c b/drivers/gpu/drm/i915/i915_drv.c index 2fa217862058..be631cc3e4dc 100644 --- a/drivers/gpu/drm/i915/i915_drv.c +++ b/drivers/gpu/drm/i915/i915_drv.c | |||
@@ -33,7 +33,6 @@ | |||
33 | #include "i915_drm.h" | 33 | #include "i915_drm.h" |
34 | #include "i915_drv.h" | 34 | #include "i915_drv.h" |
35 | 35 | ||
36 | #include "drm_pciids.h" | ||
37 | #include <linux/console.h> | 36 | #include <linux/console.h> |
38 | #include "drm_crtc_helper.h" | 37 | #include "drm_crtc_helper.h" |
39 | 38 | ||
@@ -48,8 +47,124 @@ module_param_named(powersave, i915_powersave, int, 0400); | |||
48 | 47 | ||
49 | static struct drm_driver driver; | 48 | static struct drm_driver driver; |
50 | 49 | ||
51 | static struct pci_device_id pciidlist[] = { | 50 | #define INTEL_VGA_DEVICE(id, info) { \ |
52 | i915_PCI_IDS | 51 | .class = PCI_CLASS_DISPLAY_VGA << 8, \ |
52 | .class_mask = 0xffff00, \ | ||
53 | .vendor = 0x8086, \ | ||
54 | .device = id, \ | ||
55 | .subvendor = PCI_ANY_ID, \ | ||
56 | .subdevice = PCI_ANY_ID, \ | ||
57 | .driver_data = (unsigned long) info } | ||
58 | |||
59 | const static struct intel_device_info intel_i830_info = { | ||
60 | .is_i8xx = 1, .is_mobile = 1, .cursor_needs_physical = 1, | ||
61 | }; | ||
62 | |||
63 | const static struct intel_device_info intel_845g_info = { | ||
64 | .is_i8xx = 1, | ||
65 | }; | ||
66 | |||
67 | const static struct intel_device_info intel_i85x_info = { | ||
68 | .is_i8xx = 1, .is_mobile = 1, .cursor_needs_physical = 1, | ||
69 | }; | ||
70 | |||
71 | const static struct intel_device_info intel_i865g_info = { | ||
72 | .is_i8xx = 1, | ||
73 | }; | ||
74 | |||
75 | const static struct intel_device_info intel_i915g_info = { | ||
76 | .is_i915g = 1, .is_i9xx = 1, .cursor_needs_physical = 1, | ||
77 | }; | ||
78 | const static struct intel_device_info intel_i915gm_info = { | ||
79 | .is_i9xx = 1, .is_mobile = 1, .has_fbc = 1, | ||
80 | .cursor_needs_physical = 1, | ||
81 | }; | ||
82 | const static struct intel_device_info intel_i945g_info = { | ||
83 | .is_i9xx = 1, .has_hotplug = 1, .cursor_needs_physical = 1, | ||
84 | }; | ||
85 | const static struct intel_device_info intel_i945gm_info = { | ||
86 | .is_i945gm = 1, .is_i9xx = 1, .is_mobile = 1, .has_fbc = 1, | ||
87 | .has_hotplug = 1, .cursor_needs_physical = 1, | ||
88 | }; | ||
89 | |||
90 | const static struct intel_device_info intel_i965g_info = { | ||
91 | .is_i965g = 1, .is_i9xx = 1, .has_hotplug = 1, | ||
92 | }; | ||
93 | |||
94 | const static struct intel_device_info intel_i965gm_info = { | ||
95 | .is_i965g = 1, .is_mobile = 1, .is_i965gm = 1, .is_i9xx = 1, | ||
96 | .is_mobile = 1, .has_fbc = 1, .has_rc6 = 1, | ||
97 | .has_hotplug = 1, | ||
98 | }; | ||
99 | |||
100 | const static struct intel_device_info intel_g33_info = { | ||
101 | .is_g33 = 1, .is_i9xx = 1, .need_gfx_hws = 1, | ||
102 | .has_hotplug = 1, | ||
103 | }; | ||
104 | |||
105 | const static struct intel_device_info intel_g45_info = { | ||
106 | .is_i965g = 1, .is_g4x = 1, .is_i9xx = 1, .need_gfx_hws = 1, | ||
107 | .has_pipe_cxsr = 1, | ||
108 | .has_hotplug = 1, | ||
109 | }; | ||
110 | |||
111 | const static struct intel_device_info intel_gm45_info = { | ||
112 | .is_i965g = 1, .is_mobile = 1, .is_g4x = 1, .is_i9xx = 1, | ||
113 | .is_mobile = 1, .need_gfx_hws = 1, .has_fbc = 1, .has_rc6 = 1, | ||
114 | .has_pipe_cxsr = 1, | ||
115 | .has_hotplug = 1, | ||
116 | }; | ||
117 | |||
118 | const static struct intel_device_info intel_pineview_info = { | ||
119 | .is_g33 = 1, .is_pineview = 1, .is_mobile = 1, .is_i9xx = 1, | ||
120 | .has_pipe_cxsr = 1, | ||
121 | .has_hotplug = 1, | ||
122 | }; | ||
123 | |||
124 | const static struct intel_device_info intel_ironlake_d_info = { | ||
125 | .is_ironlake = 1, .is_i965g = 1, .is_i9xx = 1, .need_gfx_hws = 1, | ||
126 | .has_pipe_cxsr = 1, | ||
127 | .has_hotplug = 1, | ||
128 | }; | ||
129 | |||
130 | const static struct intel_device_info intel_ironlake_m_info = { | ||
131 | .is_ironlake = 1, .is_mobile = 1, .is_i965g = 1, .is_i9xx = 1, | ||
132 | .need_gfx_hws = 1, .has_rc6 = 1, | ||
133 | .has_hotplug = 1, | ||
134 | }; | ||
135 | |||
136 | const static struct pci_device_id pciidlist[] = { | ||
137 | INTEL_VGA_DEVICE(0x3577, &intel_i830_info), | ||
138 | INTEL_VGA_DEVICE(0x2562, &intel_845g_info), | ||
139 | INTEL_VGA_DEVICE(0x3582, &intel_i85x_info), | ||
140 | INTEL_VGA_DEVICE(0x35e8, &intel_i85x_info), | ||
141 | INTEL_VGA_DEVICE(0x2572, &intel_i865g_info), | ||
142 | INTEL_VGA_DEVICE(0x2582, &intel_i915g_info), | ||
143 | INTEL_VGA_DEVICE(0x258a, &intel_i915g_info), | ||
144 | INTEL_VGA_DEVICE(0x2592, &intel_i915gm_info), | ||
145 | INTEL_VGA_DEVICE(0x2772, &intel_i945g_info), | ||
146 | INTEL_VGA_DEVICE(0x27a2, &intel_i945gm_info), | ||
147 | INTEL_VGA_DEVICE(0x27ae, &intel_i945gm_info), | ||
148 | INTEL_VGA_DEVICE(0x2972, &intel_i965g_info), | ||
149 | INTEL_VGA_DEVICE(0x2982, &intel_i965g_info), | ||
150 | INTEL_VGA_DEVICE(0x2992, &intel_i965g_info), | ||
151 | INTEL_VGA_DEVICE(0x29a2, &intel_i965g_info), | ||
152 | INTEL_VGA_DEVICE(0x29b2, &intel_g33_info), | ||
153 | INTEL_VGA_DEVICE(0x29c2, &intel_g33_info), | ||
154 | INTEL_VGA_DEVICE(0x29d2, &intel_g33_info), | ||
155 | INTEL_VGA_DEVICE(0x2a02, &intel_i965gm_info), | ||
156 | INTEL_VGA_DEVICE(0x2a12, &intel_i965gm_info), | ||
157 | INTEL_VGA_DEVICE(0x2a42, &intel_gm45_info), | ||
158 | INTEL_VGA_DEVICE(0x2e02, &intel_g45_info), | ||
159 | INTEL_VGA_DEVICE(0x2e12, &intel_g45_info), | ||
160 | INTEL_VGA_DEVICE(0x2e22, &intel_g45_info), | ||
161 | INTEL_VGA_DEVICE(0x2e32, &intel_g45_info), | ||
162 | INTEL_VGA_DEVICE(0x2e42, &intel_g45_info), | ||
163 | INTEL_VGA_DEVICE(0xa001, &intel_pineview_info), | ||
164 | INTEL_VGA_DEVICE(0xa011, &intel_pineview_info), | ||
165 | INTEL_VGA_DEVICE(0x0042, &intel_ironlake_d_info), | ||
166 | INTEL_VGA_DEVICE(0x0046, &intel_ironlake_m_info), | ||
167 | {0, 0, 0} | ||
53 | }; | 168 | }; |
54 | 169 | ||
55 | #if defined(CONFIG_DRM_I915_KMS) | 170 | #if defined(CONFIG_DRM_I915_KMS) |
@@ -284,6 +399,52 @@ i915_pci_resume(struct pci_dev *pdev) | |||
284 | return i915_resume(dev); | 399 | return i915_resume(dev); |
285 | } | 400 | } |
286 | 401 | ||
402 | static int | ||
403 | i915_pm_suspend(struct device *dev) | ||
404 | { | ||
405 | return i915_pci_suspend(to_pci_dev(dev), PMSG_SUSPEND); | ||
406 | } | ||
407 | |||
408 | static int | ||
409 | i915_pm_resume(struct device *dev) | ||
410 | { | ||
411 | return i915_pci_resume(to_pci_dev(dev)); | ||
412 | } | ||
413 | |||
414 | static int | ||
415 | i915_pm_freeze(struct device *dev) | ||
416 | { | ||
417 | return i915_pci_suspend(to_pci_dev(dev), PMSG_FREEZE); | ||
418 | } | ||
419 | |||
420 | static int | ||
421 | i915_pm_thaw(struct device *dev) | ||
422 | { | ||
423 | /* thaw during hibernate, do nothing! */ | ||
424 | return 0; | ||
425 | } | ||
426 | |||
427 | static int | ||
428 | i915_pm_poweroff(struct device *dev) | ||
429 | { | ||
430 | return i915_pci_suspend(to_pci_dev(dev), PMSG_HIBERNATE); | ||
431 | } | ||
432 | |||
433 | static int | ||
434 | i915_pm_restore(struct device *dev) | ||
435 | { | ||
436 | return i915_pci_resume(to_pci_dev(dev)); | ||
437 | } | ||
438 | |||
439 | const struct dev_pm_ops i915_pm_ops = { | ||
440 | .suspend = i915_pm_suspend, | ||
441 | .resume = i915_pm_resume, | ||
442 | .freeze = i915_pm_freeze, | ||
443 | .thaw = i915_pm_thaw, | ||
444 | .poweroff = i915_pm_poweroff, | ||
445 | .restore = i915_pm_restore, | ||
446 | }; | ||
447 | |||
287 | static struct vm_operations_struct i915_gem_vm_ops = { | 448 | static struct vm_operations_struct i915_gem_vm_ops = { |
288 | .fault = i915_gem_fault, | 449 | .fault = i915_gem_fault, |
289 | .open = drm_gem_vm_open, | 450 | .open = drm_gem_vm_open, |
@@ -329,7 +490,7 @@ static struct drm_driver driver = { | |||
329 | .owner = THIS_MODULE, | 490 | .owner = THIS_MODULE, |
330 | .open = drm_open, | 491 | .open = drm_open, |
331 | .release = drm_release, | 492 | .release = drm_release, |
332 | .ioctl = drm_ioctl, | 493 | .unlocked_ioctl = drm_ioctl, |
333 | .mmap = drm_gem_mmap, | 494 | .mmap = drm_gem_mmap, |
334 | .poll = drm_poll, | 495 | .poll = drm_poll, |
335 | .fasync = drm_fasync, | 496 | .fasync = drm_fasync, |
@@ -344,10 +505,7 @@ static struct drm_driver driver = { | |||
344 | .id_table = pciidlist, | 505 | .id_table = pciidlist, |
345 | .probe = i915_pci_probe, | 506 | .probe = i915_pci_probe, |
346 | .remove = i915_pci_remove, | 507 | .remove = i915_pci_remove, |
347 | #ifdef CONFIG_PM | 508 | .driver.pm = &i915_pm_ops, |
348 | .resume = i915_pci_resume, | ||
349 | .suspend = i915_pci_suspend, | ||
350 | #endif | ||
351 | }, | 509 | }, |
352 | 510 | ||
353 | .name = DRIVER_NAME, | 511 | .name = DRIVER_NAME, |
diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h index fbecac72f5bb..29dd67626967 100644 --- a/drivers/gpu/drm/i915/i915_drv.h +++ b/drivers/gpu/drm/i915/i915_drv.h | |||
@@ -172,9 +172,31 @@ struct drm_i915_display_funcs { | |||
172 | 172 | ||
173 | struct intel_overlay; | 173 | struct intel_overlay; |
174 | 174 | ||
175 | struct intel_device_info { | ||
176 | u8 is_mobile : 1; | ||
177 | u8 is_i8xx : 1; | ||
178 | u8 is_i915g : 1; | ||
179 | u8 is_i9xx : 1; | ||
180 | u8 is_i945gm : 1; | ||
181 | u8 is_i965g : 1; | ||
182 | u8 is_i965gm : 1; | ||
183 | u8 is_g33 : 1; | ||
184 | u8 need_gfx_hws : 1; | ||
185 | u8 is_g4x : 1; | ||
186 | u8 is_pineview : 1; | ||
187 | u8 is_ironlake : 1; | ||
188 | u8 has_fbc : 1; | ||
189 | u8 has_rc6 : 1; | ||
190 | u8 has_pipe_cxsr : 1; | ||
191 | u8 has_hotplug : 1; | ||
192 | u8 cursor_needs_physical : 1; | ||
193 | }; | ||
194 | |||
175 | typedef struct drm_i915_private { | 195 | typedef struct drm_i915_private { |
176 | struct drm_device *dev; | 196 | struct drm_device *dev; |
177 | 197 | ||
198 | const struct intel_device_info *info; | ||
199 | |||
178 | int has_gem; | 200 | int has_gem; |
179 | 201 | ||
180 | void __iomem *regs; | 202 | void __iomem *regs; |
@@ -232,8 +254,6 @@ typedef struct drm_i915_private { | |||
232 | int hangcheck_count; | 254 | int hangcheck_count; |
233 | uint32_t last_acthd; | 255 | uint32_t last_acthd; |
234 | 256 | ||
235 | bool cursor_needs_physical; | ||
236 | |||
237 | struct drm_mm vram; | 257 | struct drm_mm vram; |
238 | 258 | ||
239 | unsigned long cfb_size; | 259 | unsigned long cfb_size; |
@@ -287,8 +307,6 @@ typedef struct drm_i915_private { | |||
287 | u32 saveDSPACNTR; | 307 | u32 saveDSPACNTR; |
288 | u32 saveDSPBCNTR; | 308 | u32 saveDSPBCNTR; |
289 | u32 saveDSPARB; | 309 | u32 saveDSPARB; |
290 | u32 saveRENDERSTANDBY; | ||
291 | u32 savePWRCTXA; | ||
292 | u32 saveHWS; | 310 | u32 saveHWS; |
293 | u32 savePIPEACONF; | 311 | u32 savePIPEACONF; |
294 | u32 savePIPEBCONF; | 312 | u32 savePIPEBCONF; |
@@ -561,6 +579,7 @@ typedef struct drm_i915_private { | |||
561 | u16 orig_clock; | 579 | u16 orig_clock; |
562 | int child_dev_num; | 580 | int child_dev_num; |
563 | struct child_device_config *child_dev; | 581 | struct child_device_config *child_dev; |
582 | struct drm_connector *int_lvds_connector; | ||
564 | } drm_i915_private_t; | 583 | } drm_i915_private_t; |
565 | 584 | ||
566 | /** driver private structure attached to each drm_gem_object */ | 585 | /** driver private structure attached to each drm_gem_object */ |
@@ -794,6 +813,8 @@ int i915_gem_sw_finish_ioctl(struct drm_device *dev, void *data, | |||
794 | struct drm_file *file_priv); | 813 | struct drm_file *file_priv); |
795 | int i915_gem_execbuffer(struct drm_device *dev, void *data, | 814 | int i915_gem_execbuffer(struct drm_device *dev, void *data, |
796 | struct drm_file *file_priv); | 815 | struct drm_file *file_priv); |
816 | int i915_gem_execbuffer2(struct drm_device *dev, void *data, | ||
817 | struct drm_file *file_priv); | ||
797 | int i915_gem_pin_ioctl(struct drm_device *dev, void *data, | 818 | int i915_gem_pin_ioctl(struct drm_device *dev, void *data, |
798 | struct drm_file *file_priv); | 819 | struct drm_file *file_priv); |
799 | int i915_gem_unpin_ioctl(struct drm_device *dev, void *data, | 820 | int i915_gem_unpin_ioctl(struct drm_device *dev, void *data, |
@@ -860,6 +881,9 @@ void i915_gem_shrinker_exit(void); | |||
860 | void i915_gem_detect_bit_6_swizzle(struct drm_device *dev); | 881 | void i915_gem_detect_bit_6_swizzle(struct drm_device *dev); |
861 | void i915_gem_object_do_bit_17_swizzle(struct drm_gem_object *obj); | 882 | void i915_gem_object_do_bit_17_swizzle(struct drm_gem_object *obj); |
862 | void i915_gem_object_save_bit_17_swizzle(struct drm_gem_object *obj); | 883 | void i915_gem_object_save_bit_17_swizzle(struct drm_gem_object *obj); |
884 | bool i915_tiling_ok(struct drm_device *dev, int stride, int size, | ||
885 | int tiling_mode); | ||
886 | bool i915_obj_fenceable(struct drm_device *dev, struct drm_gem_object *obj); | ||
863 | 887 | ||
864 | /* i915_gem_debug.c */ | 888 | /* i915_gem_debug.c */ |
865 | void i915_gem_dump_object(struct drm_gem_object *obj, int len, | 889 | void i915_gem_dump_object(struct drm_gem_object *obj, int len, |
@@ -982,67 +1006,33 @@ extern void g4x_disable_fbc(struct drm_device *dev); | |||
982 | extern int i915_wrap_ring(struct drm_device * dev); | 1006 | extern int i915_wrap_ring(struct drm_device * dev); |
983 | extern int i915_wait_ring(struct drm_device * dev, int n, const char *caller); | 1007 | extern int i915_wait_ring(struct drm_device * dev, int n, const char *caller); |
984 | 1008 | ||
985 | #define IS_I830(dev) ((dev)->pci_device == 0x3577) | 1009 | #define INTEL_INFO(dev) (((struct drm_i915_private *) (dev)->dev_private)->info) |
986 | #define IS_845G(dev) ((dev)->pci_device == 0x2562) | 1010 | |
987 | #define IS_I85X(dev) ((dev)->pci_device == 0x3582) | 1011 | #define IS_I830(dev) ((dev)->pci_device == 0x3577) |
988 | #define IS_I865G(dev) ((dev)->pci_device == 0x2572) | 1012 | #define IS_845G(dev) ((dev)->pci_device == 0x2562) |
989 | #define IS_I8XX(dev) (IS_I830(dev) || IS_845G(dev) || IS_I85X(dev) || IS_I865G(dev)) | 1013 | #define IS_I85X(dev) ((dev)->pci_device == 0x3582) |
990 | 1014 | #define IS_I865G(dev) ((dev)->pci_device == 0x2572) | |
991 | #define IS_I915G(dev) ((dev)->pci_device == 0x2582 || (dev)->pci_device == 0x258a) | 1015 | #define IS_I8XX(dev) (INTEL_INFO(dev)->is_i8xx) |
992 | #define IS_I915GM(dev) ((dev)->pci_device == 0x2592) | 1016 | #define IS_I915G(dev) (INTEL_INFO(dev)->is_i915g) |
993 | #define IS_I945G(dev) ((dev)->pci_device == 0x2772) | 1017 | #define IS_I915GM(dev) ((dev)->pci_device == 0x2592) |
994 | #define IS_I945GM(dev) ((dev)->pci_device == 0x27A2 ||\ | 1018 | #define IS_I945G(dev) ((dev)->pci_device == 0x2772) |
995 | (dev)->pci_device == 0x27AE) | 1019 | #define IS_I945GM(dev) (INTEL_INFO(dev)->is_i945gm) |
996 | #define IS_I965G(dev) ((dev)->pci_device == 0x2972 || \ | 1020 | #define IS_I965G(dev) (INTEL_INFO(dev)->is_i965g) |
997 | (dev)->pci_device == 0x2982 || \ | 1021 | #define IS_I965GM(dev) (INTEL_INFO(dev)->is_i965gm) |
998 | (dev)->pci_device == 0x2992 || \ | 1022 | #define IS_GM45(dev) ((dev)->pci_device == 0x2A42) |
999 | (dev)->pci_device == 0x29A2 || \ | 1023 | #define IS_G4X(dev) (INTEL_INFO(dev)->is_g4x) |
1000 | (dev)->pci_device == 0x2A02 || \ | 1024 | #define IS_PINEVIEW_G(dev) ((dev)->pci_device == 0xa001) |
1001 | (dev)->pci_device == 0x2A12 || \ | 1025 | #define IS_PINEVIEW_M(dev) ((dev)->pci_device == 0xa011) |
1002 | (dev)->pci_device == 0x2A42 || \ | 1026 | #define IS_PINEVIEW(dev) (INTEL_INFO(dev)->is_pineview) |
1003 | (dev)->pci_device == 0x2E02 || \ | 1027 | #define IS_G33(dev) (INTEL_INFO(dev)->is_g33) |
1004 | (dev)->pci_device == 0x2E12 || \ | ||
1005 | (dev)->pci_device == 0x2E22 || \ | ||
1006 | (dev)->pci_device == 0x2E32 || \ | ||
1007 | (dev)->pci_device == 0x2E42 || \ | ||
1008 | (dev)->pci_device == 0x0042 || \ | ||
1009 | (dev)->pci_device == 0x0046) | ||
1010 | |||
1011 | #define IS_I965GM(dev) ((dev)->pci_device == 0x2A02 || \ | ||
1012 | (dev)->pci_device == 0x2A12) | ||
1013 | |||
1014 | #define IS_GM45(dev) ((dev)->pci_device == 0x2A42) | ||
1015 | |||
1016 | #define IS_G4X(dev) ((dev)->pci_device == 0x2E02 || \ | ||
1017 | (dev)->pci_device == 0x2E12 || \ | ||
1018 | (dev)->pci_device == 0x2E22 || \ | ||
1019 | (dev)->pci_device == 0x2E32 || \ | ||
1020 | (dev)->pci_device == 0x2E42 || \ | ||
1021 | IS_GM45(dev)) | ||
1022 | |||
1023 | #define IS_PINEVIEW_G(dev) ((dev)->pci_device == 0xa001) | ||
1024 | #define IS_PINEVIEW_M(dev) ((dev)->pci_device == 0xa011) | ||
1025 | #define IS_PINEVIEW(dev) (IS_PINEVIEW_G(dev) || IS_PINEVIEW_M(dev)) | ||
1026 | |||
1027 | #define IS_G33(dev) ((dev)->pci_device == 0x29C2 || \ | ||
1028 | (dev)->pci_device == 0x29B2 || \ | ||
1029 | (dev)->pci_device == 0x29D2 || \ | ||
1030 | (IS_PINEVIEW(dev))) | ||
1031 | |||
1032 | #define IS_IRONLAKE_D(dev) ((dev)->pci_device == 0x0042) | 1028 | #define IS_IRONLAKE_D(dev) ((dev)->pci_device == 0x0042) |
1033 | #define IS_IRONLAKE_M(dev) ((dev)->pci_device == 0x0046) | 1029 | #define IS_IRONLAKE_M(dev) ((dev)->pci_device == 0x0046) |
1034 | #define IS_IRONLAKE(dev) (IS_IRONLAKE_D(dev) || IS_IRONLAKE_M(dev)) | 1030 | #define IS_IRONLAKE(dev) (INTEL_INFO(dev)->is_ironlake) |
1035 | 1031 | #define IS_I9XX(dev) (INTEL_INFO(dev)->is_i9xx) | |
1036 | #define IS_I9XX(dev) (IS_I915G(dev) || IS_I915GM(dev) || IS_I945G(dev) || \ | 1032 | #define IS_MOBILE(dev) (INTEL_INFO(dev)->is_mobile) |
1037 | IS_I945GM(dev) || IS_I965G(dev) || IS_G33(dev) || \ | ||
1038 | IS_IRONLAKE(dev)) | ||
1039 | 1033 | ||
1040 | #define IS_MOBILE(dev) (IS_I830(dev) || IS_I85X(dev) || IS_I915GM(dev) || \ | 1034 | #define I915_NEED_GFX_HWS(dev) (INTEL_INFO(dev)->need_gfx_hws) |
1041 | IS_I945GM(dev) || IS_I965GM(dev) || IS_GM45(dev) || \ | ||
1042 | IS_PINEVIEW(dev) || IS_IRONLAKE_M(dev)) | ||
1043 | 1035 | ||
1044 | #define I915_NEED_GFX_HWS(dev) (IS_G33(dev) || IS_GM45(dev) || IS_G4X(dev) || \ | ||
1045 | IS_IRONLAKE(dev)) | ||
1046 | /* With the 945 and later, Y tiling got adjusted so that it was 32 128-byte | 1036 | /* With the 945 and later, Y tiling got adjusted so that it was 32 128-byte |
1047 | * rows, which changed the alignment requirements and fence programming. | 1037 | * rows, which changed the alignment requirements and fence programming. |
1048 | */ | 1038 | */ |
@@ -1054,17 +1044,14 @@ extern int i915_wait_ring(struct drm_device * dev, int n, const char *caller); | |||
1054 | #define SUPPORTS_EDP(dev) (IS_IRONLAKE_M(dev)) | 1044 | #define SUPPORTS_EDP(dev) (IS_IRONLAKE_M(dev)) |
1055 | #define SUPPORTS_TV(dev) (IS_I9XX(dev) && IS_MOBILE(dev) && \ | 1045 | #define SUPPORTS_TV(dev) (IS_I9XX(dev) && IS_MOBILE(dev) && \ |
1056 | !IS_IRONLAKE(dev) && !IS_PINEVIEW(dev)) | 1046 | !IS_IRONLAKE(dev) && !IS_PINEVIEW(dev)) |
1057 | #define I915_HAS_HOTPLUG(dev) (IS_I945G(dev) || IS_I945GM(dev) || IS_G33(dev) || IS_I965G(dev)) | 1047 | #define I915_HAS_HOTPLUG(dev) (INTEL_INFO(dev)->has_hotplug) |
1058 | /* dsparb controlled by hw only */ | 1048 | /* dsparb controlled by hw only */ |
1059 | #define DSPARB_HWCONTROL(dev) (IS_G4X(dev) || IS_IRONLAKE(dev)) | 1049 | #define DSPARB_HWCONTROL(dev) (IS_G4X(dev) || IS_IRONLAKE(dev)) |
1060 | 1050 | ||
1061 | #define HAS_FW_BLC(dev) (IS_I9XX(dev) || IS_G4X(dev) || IS_IRONLAKE(dev)) | 1051 | #define HAS_FW_BLC(dev) (IS_I9XX(dev) || IS_G4X(dev) || IS_IRONLAKE(dev)) |
1062 | #define HAS_PIPE_CXSR(dev) (IS_G4X(dev) || IS_IRONLAKE(dev)) | 1052 | #define HAS_PIPE_CXSR(dev) (INTEL_INFO(dev)->has_pipe_cxsr) |
1063 | #define I915_HAS_FBC(dev) (IS_MOBILE(dev) && \ | 1053 | #define I915_HAS_FBC(dev) (INTEL_INFO(dev)->has_fbc) |
1064 | (IS_I9XX(dev) || IS_GM45(dev)) && \ | 1054 | #define I915_HAS_RC6(dev) (INTEL_INFO(dev)->has_rc6) |
1065 | !IS_PINEVIEW(dev) && \ | ||
1066 | !IS_IRONLAKE(dev)) | ||
1067 | #define I915_HAS_RC6(dev) (IS_I965GM(dev) || IS_GM45(dev) || IS_IRONLAKE_M(dev)) | ||
1068 | 1055 | ||
1069 | #define PRIMARY_RINGBUFFER_SIZE (128*1024) | 1056 | #define PRIMARY_RINGBUFFER_SIZE (128*1024) |
1070 | 1057 | ||
diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c index 8c463cf2050a..2748609f05b3 100644 --- a/drivers/gpu/drm/i915/i915_gem.c +++ b/drivers/gpu/drm/i915/i915_gem.c | |||
@@ -2021,9 +2021,6 @@ i915_gem_object_unbind(struct drm_gem_object *obj) | |||
2021 | /* blow away mappings if mapped through GTT */ | 2021 | /* blow away mappings if mapped through GTT */ |
2022 | i915_gem_release_mmap(obj); | 2022 | i915_gem_release_mmap(obj); |
2023 | 2023 | ||
2024 | if (obj_priv->fence_reg != I915_FENCE_REG_NONE) | ||
2025 | i915_gem_clear_fence_reg(obj); | ||
2026 | |||
2027 | /* Move the object to the CPU domain to ensure that | 2024 | /* Move the object to the CPU domain to ensure that |
2028 | * any possible CPU writes while it's not in the GTT | 2025 | * any possible CPU writes while it's not in the GTT |
2029 | * are flushed when we go to remap it. This will | 2026 | * are flushed when we go to remap it. This will |
@@ -2039,6 +2036,10 @@ i915_gem_object_unbind(struct drm_gem_object *obj) | |||
2039 | 2036 | ||
2040 | BUG_ON(obj_priv->active); | 2037 | BUG_ON(obj_priv->active); |
2041 | 2038 | ||
2039 | /* release the fence reg _after_ flushing */ | ||
2040 | if (obj_priv->fence_reg != I915_FENCE_REG_NONE) | ||
2041 | i915_gem_clear_fence_reg(obj); | ||
2042 | |||
2042 | if (obj_priv->agp_mem != NULL) { | 2043 | if (obj_priv->agp_mem != NULL) { |
2043 | drm_unbind_agp(obj_priv->agp_mem); | 2044 | drm_unbind_agp(obj_priv->agp_mem); |
2044 | drm_free_agp(obj_priv->agp_mem, obj->size / PAGE_SIZE); | 2045 | drm_free_agp(obj_priv->agp_mem, obj->size / PAGE_SIZE); |
@@ -2581,9 +2582,6 @@ i915_gem_object_bind_to_gtt(struct drm_gem_object *obj, unsigned alignment) | |||
2581 | bool retry_alloc = false; | 2582 | bool retry_alloc = false; |
2582 | int ret; | 2583 | int ret; |
2583 | 2584 | ||
2584 | if (dev_priv->mm.suspended) | ||
2585 | return -EBUSY; | ||
2586 | |||
2587 | if (obj_priv->madv != I915_MADV_WILLNEED) { | 2585 | if (obj_priv->madv != I915_MADV_WILLNEED) { |
2588 | DRM_ERROR("Attempting to bind a purgeable object\n"); | 2586 | DRM_ERROR("Attempting to bind a purgeable object\n"); |
2589 | return -EINVAL; | 2587 | return -EINVAL; |
@@ -3198,7 +3196,7 @@ i915_gem_object_set_cpu_read_domain_range(struct drm_gem_object *obj, | |||
3198 | static int | 3196 | static int |
3199 | i915_gem_object_pin_and_relocate(struct drm_gem_object *obj, | 3197 | i915_gem_object_pin_and_relocate(struct drm_gem_object *obj, |
3200 | struct drm_file *file_priv, | 3198 | struct drm_file *file_priv, |
3201 | struct drm_i915_gem_exec_object *entry, | 3199 | struct drm_i915_gem_exec_object2 *entry, |
3202 | struct drm_i915_gem_relocation_entry *relocs) | 3200 | struct drm_i915_gem_relocation_entry *relocs) |
3203 | { | 3201 | { |
3204 | struct drm_device *dev = obj->dev; | 3202 | struct drm_device *dev = obj->dev; |
@@ -3206,12 +3204,35 @@ i915_gem_object_pin_and_relocate(struct drm_gem_object *obj, | |||
3206 | struct drm_i915_gem_object *obj_priv = obj->driver_private; | 3204 | struct drm_i915_gem_object *obj_priv = obj->driver_private; |
3207 | int i, ret; | 3205 | int i, ret; |
3208 | void __iomem *reloc_page; | 3206 | void __iomem *reloc_page; |
3207 | bool need_fence; | ||
3208 | |||
3209 | need_fence = entry->flags & EXEC_OBJECT_NEEDS_FENCE && | ||
3210 | obj_priv->tiling_mode != I915_TILING_NONE; | ||
3211 | |||
3212 | /* Check fence reg constraints and rebind if necessary */ | ||
3213 | if (need_fence && !i915_obj_fenceable(dev, obj)) | ||
3214 | i915_gem_object_unbind(obj); | ||
3209 | 3215 | ||
3210 | /* Choose the GTT offset for our buffer and put it there. */ | 3216 | /* Choose the GTT offset for our buffer and put it there. */ |
3211 | ret = i915_gem_object_pin(obj, (uint32_t) entry->alignment); | 3217 | ret = i915_gem_object_pin(obj, (uint32_t) entry->alignment); |
3212 | if (ret) | 3218 | if (ret) |
3213 | return ret; | 3219 | return ret; |
3214 | 3220 | ||
3221 | /* | ||
3222 | * Pre-965 chips need a fence register set up in order to | ||
3223 | * properly handle blits to/from tiled surfaces. | ||
3224 | */ | ||
3225 | if (need_fence) { | ||
3226 | ret = i915_gem_object_get_fence_reg(obj); | ||
3227 | if (ret != 0) { | ||
3228 | if (ret != -EBUSY && ret != -ERESTARTSYS) | ||
3229 | DRM_ERROR("Failure to install fence: %d\n", | ||
3230 | ret); | ||
3231 | i915_gem_object_unpin(obj); | ||
3232 | return ret; | ||
3233 | } | ||
3234 | } | ||
3235 | |||
3215 | entry->offset = obj_priv->gtt_offset; | 3236 | entry->offset = obj_priv->gtt_offset; |
3216 | 3237 | ||
3217 | /* Apply the relocations, using the GTT aperture to avoid cache | 3238 | /* Apply the relocations, using the GTT aperture to avoid cache |
@@ -3373,7 +3394,7 @@ i915_gem_object_pin_and_relocate(struct drm_gem_object *obj, | |||
3373 | */ | 3394 | */ |
3374 | static int | 3395 | static int |
3375 | i915_dispatch_gem_execbuffer(struct drm_device *dev, | 3396 | i915_dispatch_gem_execbuffer(struct drm_device *dev, |
3376 | struct drm_i915_gem_execbuffer *exec, | 3397 | struct drm_i915_gem_execbuffer2 *exec, |
3377 | struct drm_clip_rect *cliprects, | 3398 | struct drm_clip_rect *cliprects, |
3378 | uint64_t exec_offset) | 3399 | uint64_t exec_offset) |
3379 | { | 3400 | { |
@@ -3463,7 +3484,7 @@ i915_gem_ring_throttle(struct drm_device *dev, struct drm_file *file_priv) | |||
3463 | } | 3484 | } |
3464 | 3485 | ||
3465 | static int | 3486 | static int |
3466 | i915_gem_get_relocs_from_user(struct drm_i915_gem_exec_object *exec_list, | 3487 | i915_gem_get_relocs_from_user(struct drm_i915_gem_exec_object2 *exec_list, |
3467 | uint32_t buffer_count, | 3488 | uint32_t buffer_count, |
3468 | struct drm_i915_gem_relocation_entry **relocs) | 3489 | struct drm_i915_gem_relocation_entry **relocs) |
3469 | { | 3490 | { |
@@ -3478,8 +3499,10 @@ i915_gem_get_relocs_from_user(struct drm_i915_gem_exec_object *exec_list, | |||
3478 | } | 3499 | } |
3479 | 3500 | ||
3480 | *relocs = drm_calloc_large(reloc_count, sizeof(**relocs)); | 3501 | *relocs = drm_calloc_large(reloc_count, sizeof(**relocs)); |
3481 | if (*relocs == NULL) | 3502 | if (*relocs == NULL) { |
3503 | DRM_ERROR("failed to alloc relocs, count %d\n", reloc_count); | ||
3482 | return -ENOMEM; | 3504 | return -ENOMEM; |
3505 | } | ||
3483 | 3506 | ||
3484 | for (i = 0; i < buffer_count; i++) { | 3507 | for (i = 0; i < buffer_count; i++) { |
3485 | struct drm_i915_gem_relocation_entry __user *user_relocs; | 3508 | struct drm_i915_gem_relocation_entry __user *user_relocs; |
@@ -3503,7 +3526,7 @@ i915_gem_get_relocs_from_user(struct drm_i915_gem_exec_object *exec_list, | |||
3503 | } | 3526 | } |
3504 | 3527 | ||
3505 | static int | 3528 | static int |
3506 | i915_gem_put_relocs_to_user(struct drm_i915_gem_exec_object *exec_list, | 3529 | i915_gem_put_relocs_to_user(struct drm_i915_gem_exec_object2 *exec_list, |
3507 | uint32_t buffer_count, | 3530 | uint32_t buffer_count, |
3508 | struct drm_i915_gem_relocation_entry *relocs) | 3531 | struct drm_i915_gem_relocation_entry *relocs) |
3509 | { | 3532 | { |
@@ -3536,7 +3559,7 @@ err: | |||
3536 | } | 3559 | } |
3537 | 3560 | ||
3538 | static int | 3561 | static int |
3539 | i915_gem_check_execbuffer (struct drm_i915_gem_execbuffer *exec, | 3562 | i915_gem_check_execbuffer (struct drm_i915_gem_execbuffer2 *exec, |
3540 | uint64_t exec_offset) | 3563 | uint64_t exec_offset) |
3541 | { | 3564 | { |
3542 | uint32_t exec_start, exec_len; | 3565 | uint32_t exec_start, exec_len; |
@@ -3589,18 +3612,18 @@ i915_gem_wait_for_pending_flip(struct drm_device *dev, | |||
3589 | } | 3612 | } |
3590 | 3613 | ||
3591 | int | 3614 | int |
3592 | i915_gem_execbuffer(struct drm_device *dev, void *data, | 3615 | i915_gem_do_execbuffer(struct drm_device *dev, void *data, |
3593 | struct drm_file *file_priv) | 3616 | struct drm_file *file_priv, |
3617 | struct drm_i915_gem_execbuffer2 *args, | ||
3618 | struct drm_i915_gem_exec_object2 *exec_list) | ||
3594 | { | 3619 | { |
3595 | drm_i915_private_t *dev_priv = dev->dev_private; | 3620 | drm_i915_private_t *dev_priv = dev->dev_private; |
3596 | struct drm_i915_gem_execbuffer *args = data; | ||
3597 | struct drm_i915_gem_exec_object *exec_list = NULL; | ||
3598 | struct drm_gem_object **object_list = NULL; | 3621 | struct drm_gem_object **object_list = NULL; |
3599 | struct drm_gem_object *batch_obj; | 3622 | struct drm_gem_object *batch_obj; |
3600 | struct drm_i915_gem_object *obj_priv; | 3623 | struct drm_i915_gem_object *obj_priv; |
3601 | struct drm_clip_rect *cliprects = NULL; | 3624 | struct drm_clip_rect *cliprects = NULL; |
3602 | struct drm_i915_gem_relocation_entry *relocs; | 3625 | struct drm_i915_gem_relocation_entry *relocs; |
3603 | int ret, ret2, i, pinned = 0; | 3626 | int ret = 0, ret2, i, pinned = 0; |
3604 | uint64_t exec_offset; | 3627 | uint64_t exec_offset; |
3605 | uint32_t seqno, flush_domains, reloc_index; | 3628 | uint32_t seqno, flush_domains, reloc_index; |
3606 | int pin_tries, flips; | 3629 | int pin_tries, flips; |
@@ -3614,25 +3637,13 @@ i915_gem_execbuffer(struct drm_device *dev, void *data, | |||
3614 | DRM_ERROR("execbuf with %d buffers\n", args->buffer_count); | 3637 | DRM_ERROR("execbuf with %d buffers\n", args->buffer_count); |
3615 | return -EINVAL; | 3638 | return -EINVAL; |
3616 | } | 3639 | } |
3617 | /* Copy in the exec list from userland */ | ||
3618 | exec_list = drm_malloc_ab(sizeof(*exec_list), args->buffer_count); | ||
3619 | object_list = drm_malloc_ab(sizeof(*object_list), args->buffer_count); | 3640 | object_list = drm_malloc_ab(sizeof(*object_list), args->buffer_count); |
3620 | if (exec_list == NULL || object_list == NULL) { | 3641 | if (object_list == NULL) { |
3621 | DRM_ERROR("Failed to allocate exec or object list " | 3642 | DRM_ERROR("Failed to allocate object list for %d buffers\n", |
3622 | "for %d buffers\n", | ||
3623 | args->buffer_count); | 3643 | args->buffer_count); |
3624 | ret = -ENOMEM; | 3644 | ret = -ENOMEM; |
3625 | goto pre_mutex_err; | 3645 | goto pre_mutex_err; |
3626 | } | 3646 | } |
3627 | ret = copy_from_user(exec_list, | ||
3628 | (struct drm_i915_relocation_entry __user *) | ||
3629 | (uintptr_t) args->buffers_ptr, | ||
3630 | sizeof(*exec_list) * args->buffer_count); | ||
3631 | if (ret != 0) { | ||
3632 | DRM_ERROR("copy %d exec entries failed %d\n", | ||
3633 | args->buffer_count, ret); | ||
3634 | goto pre_mutex_err; | ||
3635 | } | ||
3636 | 3647 | ||
3637 | if (args->num_cliprects != 0) { | 3648 | if (args->num_cliprects != 0) { |
3638 | cliprects = kcalloc(args->num_cliprects, sizeof(*cliprects), | 3649 | cliprects = kcalloc(args->num_cliprects, sizeof(*cliprects), |
@@ -3884,20 +3895,6 @@ err: | |||
3884 | 3895 | ||
3885 | mutex_unlock(&dev->struct_mutex); | 3896 | mutex_unlock(&dev->struct_mutex); |
3886 | 3897 | ||
3887 | if (!ret) { | ||
3888 | /* Copy the new buffer offsets back to the user's exec list. */ | ||
3889 | ret = copy_to_user((struct drm_i915_relocation_entry __user *) | ||
3890 | (uintptr_t) args->buffers_ptr, | ||
3891 | exec_list, | ||
3892 | sizeof(*exec_list) * args->buffer_count); | ||
3893 | if (ret) { | ||
3894 | ret = -EFAULT; | ||
3895 | DRM_ERROR("failed to copy %d exec entries " | ||
3896 | "back to user (%d)\n", | ||
3897 | args->buffer_count, ret); | ||
3898 | } | ||
3899 | } | ||
3900 | |||
3901 | /* Copy the updated relocations out regardless of current error | 3898 | /* Copy the updated relocations out regardless of current error |
3902 | * state. Failure to update the relocs would mean that the next | 3899 | * state. Failure to update the relocs would mean that the next |
3903 | * time userland calls execbuf, it would do so with presumed offset | 3900 | * time userland calls execbuf, it would do so with presumed offset |
@@ -3914,12 +3911,158 @@ err: | |||
3914 | 3911 | ||
3915 | pre_mutex_err: | 3912 | pre_mutex_err: |
3916 | drm_free_large(object_list); | 3913 | drm_free_large(object_list); |
3917 | drm_free_large(exec_list); | ||
3918 | kfree(cliprects); | 3914 | kfree(cliprects); |
3919 | 3915 | ||
3920 | return ret; | 3916 | return ret; |
3921 | } | 3917 | } |
3922 | 3918 | ||
3919 | /* | ||
3920 | * Legacy execbuffer just creates an exec2 list from the original exec object | ||
3921 | * list array and passes it to the real function. | ||
3922 | */ | ||
3923 | int | ||
3924 | i915_gem_execbuffer(struct drm_device *dev, void *data, | ||
3925 | struct drm_file *file_priv) | ||
3926 | { | ||
3927 | struct drm_i915_gem_execbuffer *args = data; | ||
3928 | struct drm_i915_gem_execbuffer2 exec2; | ||
3929 | struct drm_i915_gem_exec_object *exec_list = NULL; | ||
3930 | struct drm_i915_gem_exec_object2 *exec2_list = NULL; | ||
3931 | int ret, i; | ||
3932 | |||
3933 | #if WATCH_EXEC | ||
3934 | DRM_INFO("buffers_ptr %d buffer_count %d len %08x\n", | ||
3935 | (int) args->buffers_ptr, args->buffer_count, args->batch_len); | ||
3936 | #endif | ||
3937 | |||
3938 | if (args->buffer_count < 1) { | ||
3939 | DRM_ERROR("execbuf with %d buffers\n", args->buffer_count); | ||
3940 | return -EINVAL; | ||
3941 | } | ||
3942 | |||
3943 | /* Copy in the exec list from userland */ | ||
3944 | exec_list = drm_malloc_ab(sizeof(*exec_list), args->buffer_count); | ||
3945 | exec2_list = drm_malloc_ab(sizeof(*exec2_list), args->buffer_count); | ||
3946 | if (exec_list == NULL || exec2_list == NULL) { | ||
3947 | DRM_ERROR("Failed to allocate exec list for %d buffers\n", | ||
3948 | args->buffer_count); | ||
3949 | drm_free_large(exec_list); | ||
3950 | drm_free_large(exec2_list); | ||
3951 | return -ENOMEM; | ||
3952 | } | ||
3953 | ret = copy_from_user(exec_list, | ||
3954 | (struct drm_i915_relocation_entry __user *) | ||
3955 | (uintptr_t) args->buffers_ptr, | ||
3956 | sizeof(*exec_list) * args->buffer_count); | ||
3957 | if (ret != 0) { | ||
3958 | DRM_ERROR("copy %d exec entries failed %d\n", | ||
3959 | args->buffer_count, ret); | ||
3960 | drm_free_large(exec_list); | ||
3961 | drm_free_large(exec2_list); | ||
3962 | return -EFAULT; | ||
3963 | } | ||
3964 | |||
3965 | for (i = 0; i < args->buffer_count; i++) { | ||
3966 | exec2_list[i].handle = exec_list[i].handle; | ||
3967 | exec2_list[i].relocation_count = exec_list[i].relocation_count; | ||
3968 | exec2_list[i].relocs_ptr = exec_list[i].relocs_ptr; | ||
3969 | exec2_list[i].alignment = exec_list[i].alignment; | ||
3970 | exec2_list[i].offset = exec_list[i].offset; | ||
3971 | if (!IS_I965G(dev)) | ||
3972 | exec2_list[i].flags = EXEC_OBJECT_NEEDS_FENCE; | ||
3973 | else | ||
3974 | exec2_list[i].flags = 0; | ||
3975 | } | ||
3976 | |||
3977 | exec2.buffers_ptr = args->buffers_ptr; | ||
3978 | exec2.buffer_count = args->buffer_count; | ||
3979 | exec2.batch_start_offset = args->batch_start_offset; | ||
3980 | exec2.batch_len = args->batch_len; | ||
3981 | exec2.DR1 = args->DR1; | ||
3982 | exec2.DR4 = args->DR4; | ||
3983 | exec2.num_cliprects = args->num_cliprects; | ||
3984 | exec2.cliprects_ptr = args->cliprects_ptr; | ||
3985 | exec2.flags = 0; | ||
3986 | |||
3987 | ret = i915_gem_do_execbuffer(dev, data, file_priv, &exec2, exec2_list); | ||
3988 | if (!ret) { | ||
3989 | /* Copy the new buffer offsets back to the user's exec list. */ | ||
3990 | for (i = 0; i < args->buffer_count; i++) | ||
3991 | exec_list[i].offset = exec2_list[i].offset; | ||
3992 | /* ... and back out to userspace */ | ||
3993 | ret = copy_to_user((struct drm_i915_relocation_entry __user *) | ||
3994 | (uintptr_t) args->buffers_ptr, | ||
3995 | exec_list, | ||
3996 | sizeof(*exec_list) * args->buffer_count); | ||
3997 | if (ret) { | ||
3998 | ret = -EFAULT; | ||
3999 | DRM_ERROR("failed to copy %d exec entries " | ||
4000 | "back to user (%d)\n", | ||
4001 | args->buffer_count, ret); | ||
4002 | } | ||
4003 | } else { | ||
4004 | DRM_ERROR("i915_gem_do_execbuffer returns %d\n", ret); | ||
4005 | } | ||
4006 | |||
4007 | drm_free_large(exec_list); | ||
4008 | drm_free_large(exec2_list); | ||
4009 | return ret; | ||
4010 | } | ||
4011 | |||
4012 | int | ||
4013 | i915_gem_execbuffer2(struct drm_device *dev, void *data, | ||
4014 | struct drm_file *file_priv) | ||
4015 | { | ||
4016 | struct drm_i915_gem_execbuffer2 *args = data; | ||
4017 | struct drm_i915_gem_exec_object2 *exec2_list = NULL; | ||
4018 | int ret; | ||
4019 | |||
4020 | #if WATCH_EXEC | ||
4021 | DRM_INFO("buffers_ptr %d buffer_count %d len %08x\n", | ||
4022 | (int) args->buffers_ptr, args->buffer_count, args->batch_len); | ||
4023 | #endif | ||
4024 | |||
4025 | if (args->buffer_count < 1) { | ||
4026 | DRM_ERROR("execbuf2 with %d buffers\n", args->buffer_count); | ||
4027 | return -EINVAL; | ||
4028 | } | ||
4029 | |||
4030 | exec2_list = drm_malloc_ab(sizeof(*exec2_list), args->buffer_count); | ||
4031 | if (exec2_list == NULL) { | ||
4032 | DRM_ERROR("Failed to allocate exec list for %d buffers\n", | ||
4033 | args->buffer_count); | ||
4034 | return -ENOMEM; | ||
4035 | } | ||
4036 | ret = copy_from_user(exec2_list, | ||
4037 | (struct drm_i915_relocation_entry __user *) | ||
4038 | (uintptr_t) args->buffers_ptr, | ||
4039 | sizeof(*exec2_list) * args->buffer_count); | ||
4040 | if (ret != 0) { | ||
4041 | DRM_ERROR("copy %d exec entries failed %d\n", | ||
4042 | args->buffer_count, ret); | ||
4043 | drm_free_large(exec2_list); | ||
4044 | return -EFAULT; | ||
4045 | } | ||
4046 | |||
4047 | ret = i915_gem_do_execbuffer(dev, data, file_priv, args, exec2_list); | ||
4048 | if (!ret) { | ||
4049 | /* Copy the new buffer offsets back to the user's exec list. */ | ||
4050 | ret = copy_to_user((struct drm_i915_relocation_entry __user *) | ||
4051 | (uintptr_t) args->buffers_ptr, | ||
4052 | exec2_list, | ||
4053 | sizeof(*exec2_list) * args->buffer_count); | ||
4054 | if (ret) { | ||
4055 | ret = -EFAULT; | ||
4056 | DRM_ERROR("failed to copy %d exec entries " | ||
4057 | "back to user (%d)\n", | ||
4058 | args->buffer_count, ret); | ||
4059 | } | ||
4060 | } | ||
4061 | |||
4062 | drm_free_large(exec2_list); | ||
4063 | return ret; | ||
4064 | } | ||
4065 | |||
3923 | int | 4066 | int |
3924 | i915_gem_object_pin(struct drm_gem_object *obj, uint32_t alignment) | 4067 | i915_gem_object_pin(struct drm_gem_object *obj, uint32_t alignment) |
3925 | { | 4068 | { |
@@ -3933,19 +4076,7 @@ i915_gem_object_pin(struct drm_gem_object *obj, uint32_t alignment) | |||
3933 | if (ret) | 4076 | if (ret) |
3934 | return ret; | 4077 | return ret; |
3935 | } | 4078 | } |
3936 | /* | 4079 | |
3937 | * Pre-965 chips need a fence register set up in order to | ||
3938 | * properly handle tiled surfaces. | ||
3939 | */ | ||
3940 | if (!IS_I965G(dev) && obj_priv->tiling_mode != I915_TILING_NONE) { | ||
3941 | ret = i915_gem_object_get_fence_reg(obj); | ||
3942 | if (ret != 0) { | ||
3943 | if (ret != -EBUSY && ret != -ERESTARTSYS) | ||
3944 | DRM_ERROR("Failure to install fence: %d\n", | ||
3945 | ret); | ||
3946 | return ret; | ||
3947 | } | ||
3948 | } | ||
3949 | obj_priv->pin_count++; | 4080 | obj_priv->pin_count++; |
3950 | 4081 | ||
3951 | /* If the object is not active and not pending a flush, | 4082 | /* If the object is not active and not pending a flush, |
@@ -4708,7 +4839,7 @@ int i915_gem_init_phys_object(struct drm_device *dev, | |||
4708 | 4839 | ||
4709 | phys_obj->id = id; | 4840 | phys_obj->id = id; |
4710 | 4841 | ||
4711 | phys_obj->handle = drm_pci_alloc(dev, size, 0, 0xffffffff); | 4842 | phys_obj->handle = drm_pci_alloc(dev, size, 0); |
4712 | if (!phys_obj->handle) { | 4843 | if (!phys_obj->handle) { |
4713 | ret = -ENOMEM; | 4844 | ret = -ENOMEM; |
4714 | goto kfree_obj; | 4845 | goto kfree_obj; |
diff --git a/drivers/gpu/drm/i915/i915_gem_tiling.c b/drivers/gpu/drm/i915/i915_gem_tiling.c index 30d6af6c09bb..df278b2685bf 100644 --- a/drivers/gpu/drm/i915/i915_gem_tiling.c +++ b/drivers/gpu/drm/i915/i915_gem_tiling.c | |||
@@ -304,35 +304,39 @@ i915_gem_detect_bit_6_swizzle(struct drm_device *dev) | |||
304 | 304 | ||
305 | 305 | ||
306 | /** | 306 | /** |
307 | * Returns the size of the fence for a tiled object of the given size. | 307 | * Returns whether an object is currently fenceable. If not, it may need |
308 | * to be unbound and have its pitch adjusted. | ||
308 | */ | 309 | */ |
309 | static int | 310 | bool |
310 | i915_get_fence_size(struct drm_device *dev, int size) | 311 | i915_obj_fenceable(struct drm_device *dev, struct drm_gem_object *obj) |
311 | { | 312 | { |
312 | int i; | 313 | struct drm_i915_gem_object *obj_priv = obj->driver_private; |
313 | int start; | ||
314 | 314 | ||
315 | if (IS_I965G(dev)) { | 315 | if (IS_I965G(dev)) { |
316 | /* The 965 can have fences at any page boundary. */ | 316 | /* The 965 can have fences at any page boundary. */ |
317 | return ALIGN(size, 4096); | 317 | if (obj->size & 4095) |
318 | return false; | ||
319 | return true; | ||
320 | } else if (IS_I9XX(dev)) { | ||
321 | if (obj_priv->gtt_offset & ~I915_FENCE_START_MASK) | ||
322 | return false; | ||
318 | } else { | 323 | } else { |
319 | /* Align the size to a power of two greater than the smallest | 324 | if (obj_priv->gtt_offset & ~I830_FENCE_START_MASK) |
320 | * fence size. | 325 | return false; |
321 | */ | 326 | } |
322 | if (IS_I9XX(dev)) | ||
323 | start = 1024 * 1024; | ||
324 | else | ||
325 | start = 512 * 1024; | ||
326 | 327 | ||
327 | for (i = start; i < size; i <<= 1) | 328 | /* Power of two sized... */ |
328 | ; | 329 | if (obj->size & (obj->size - 1)) |
330 | return false; | ||
329 | 331 | ||
330 | return i; | 332 | /* Objects must be size aligned as well */ |
331 | } | 333 | if (obj_priv->gtt_offset & (obj->size - 1)) |
334 | return false; | ||
335 | return true; | ||
332 | } | 336 | } |
333 | 337 | ||
334 | /* Check pitch constriants for all chips & tiling formats */ | 338 | /* Check pitch constriants for all chips & tiling formats */ |
335 | static bool | 339 | bool |
336 | i915_tiling_ok(struct drm_device *dev, int stride, int size, int tiling_mode) | 340 | i915_tiling_ok(struct drm_device *dev, int stride, int size, int tiling_mode) |
337 | { | 341 | { |
338 | int tile_width; | 342 | int tile_width; |
@@ -384,12 +388,6 @@ i915_tiling_ok(struct drm_device *dev, int stride, int size, int tiling_mode) | |||
384 | if (stride & (stride - 1)) | 388 | if (stride & (stride - 1)) |
385 | return false; | 389 | return false; |
386 | 390 | ||
387 | /* We don't 0handle the aperture area covered by the fence being bigger | ||
388 | * than the object size. | ||
389 | */ | ||
390 | if (i915_get_fence_size(dev, size) != size) | ||
391 | return false; | ||
392 | |||
393 | return true; | 391 | return true; |
394 | } | 392 | } |
395 | 393 | ||
diff --git a/drivers/gpu/drm/i915/i915_ioc32.c b/drivers/gpu/drm/i915/i915_ioc32.c index 1fe68a251b75..13b028994b2b 100644 --- a/drivers/gpu/drm/i915/i915_ioc32.c +++ b/drivers/gpu/drm/i915/i915_ioc32.c | |||
@@ -66,8 +66,7 @@ static int compat_i915_batchbuffer(struct file *file, unsigned int cmd, | |||
66 | &batchbuffer->cliprects)) | 66 | &batchbuffer->cliprects)) |
67 | return -EFAULT; | 67 | return -EFAULT; |
68 | 68 | ||
69 | return drm_ioctl(file->f_path.dentry->d_inode, file, | 69 | return drm_ioctl(file, DRM_IOCTL_I915_BATCHBUFFER, |
70 | DRM_IOCTL_I915_BATCHBUFFER, | ||
71 | (unsigned long)batchbuffer); | 70 | (unsigned long)batchbuffer); |
72 | } | 71 | } |
73 | 72 | ||
@@ -102,8 +101,8 @@ static int compat_i915_cmdbuffer(struct file *file, unsigned int cmd, | |||
102 | &cmdbuffer->cliprects)) | 101 | &cmdbuffer->cliprects)) |
103 | return -EFAULT; | 102 | return -EFAULT; |
104 | 103 | ||
105 | return drm_ioctl(file->f_path.dentry->d_inode, file, | 104 | return drm_ioctl(file, DRM_IOCTL_I915_CMDBUFFER, |
106 | DRM_IOCTL_I915_CMDBUFFER, (unsigned long)cmdbuffer); | 105 | (unsigned long)cmdbuffer); |
107 | } | 106 | } |
108 | 107 | ||
109 | typedef struct drm_i915_irq_emit32 { | 108 | typedef struct drm_i915_irq_emit32 { |
@@ -125,8 +124,8 @@ static int compat_i915_irq_emit(struct file *file, unsigned int cmd, | |||
125 | &request->irq_seq)) | 124 | &request->irq_seq)) |
126 | return -EFAULT; | 125 | return -EFAULT; |
127 | 126 | ||
128 | return drm_ioctl(file->f_path.dentry->d_inode, file, | 127 | return drm_ioctl(file, DRM_IOCTL_I915_IRQ_EMIT, |
129 | DRM_IOCTL_I915_IRQ_EMIT, (unsigned long)request); | 128 | (unsigned long)request); |
130 | } | 129 | } |
131 | typedef struct drm_i915_getparam32 { | 130 | typedef struct drm_i915_getparam32 { |
132 | int param; | 131 | int param; |
@@ -149,8 +148,8 @@ static int compat_i915_getparam(struct file *file, unsigned int cmd, | |||
149 | &request->value)) | 148 | &request->value)) |
150 | return -EFAULT; | 149 | return -EFAULT; |
151 | 150 | ||
152 | return drm_ioctl(file->f_path.dentry->d_inode, file, | 151 | return drm_ioctl(file, DRM_IOCTL_I915_GETPARAM, |
153 | DRM_IOCTL_I915_GETPARAM, (unsigned long)request); | 152 | (unsigned long)request); |
154 | } | 153 | } |
155 | 154 | ||
156 | typedef struct drm_i915_mem_alloc32 { | 155 | typedef struct drm_i915_mem_alloc32 { |
@@ -178,8 +177,8 @@ static int compat_i915_alloc(struct file *file, unsigned int cmd, | |||
178 | &request->region_offset)) | 177 | &request->region_offset)) |
179 | return -EFAULT; | 178 | return -EFAULT; |
180 | 179 | ||
181 | return drm_ioctl(file->f_path.dentry->d_inode, file, | 180 | return drm_ioctl(file, DRM_IOCTL_I915_ALLOC, |
182 | DRM_IOCTL_I915_ALLOC, (unsigned long)request); | 181 | (unsigned long)request); |
183 | } | 182 | } |
184 | 183 | ||
185 | drm_ioctl_compat_t *i915_compat_ioctls[] = { | 184 | drm_ioctl_compat_t *i915_compat_ioctls[] = { |
@@ -211,12 +210,10 @@ long i915_compat_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) | |||
211 | if (nr < DRM_COMMAND_BASE + DRM_ARRAY_SIZE(i915_compat_ioctls)) | 210 | if (nr < DRM_COMMAND_BASE + DRM_ARRAY_SIZE(i915_compat_ioctls)) |
212 | fn = i915_compat_ioctls[nr - DRM_COMMAND_BASE]; | 211 | fn = i915_compat_ioctls[nr - DRM_COMMAND_BASE]; |
213 | 212 | ||
214 | lock_kernel(); /* XXX for now */ | ||
215 | if (fn != NULL) | 213 | if (fn != NULL) |
216 | ret = (*fn) (filp, cmd, arg); | 214 | ret = (*fn) (filp, cmd, arg); |
217 | else | 215 | else |
218 | ret = drm_ioctl(filp->f_path.dentry->d_inode, filp, cmd, arg); | 216 | ret = drm_ioctl(filp, cmd, arg); |
219 | unlock_kernel(); | ||
220 | 217 | ||
221 | return ret; | 218 | return ret; |
222 | } | 219 | } |
diff --git a/drivers/gpu/drm/i915/i915_irq.c b/drivers/gpu/drm/i915/i915_irq.c index 85f4c5de97e2..7cd8110051b6 100644 --- a/drivers/gpu/drm/i915/i915_irq.c +++ b/drivers/gpu/drm/i915/i915_irq.c | |||
@@ -313,6 +313,8 @@ irqreturn_t ironlake_irq_handler(struct drm_device *dev) | |||
313 | dev_priv->mm.irq_gem_seqno = seqno; | 313 | dev_priv->mm.irq_gem_seqno = seqno; |
314 | trace_i915_gem_request_complete(dev, seqno); | 314 | trace_i915_gem_request_complete(dev, seqno); |
315 | DRM_WAKEUP(&dev_priv->irq_queue); | 315 | DRM_WAKEUP(&dev_priv->irq_queue); |
316 | dev_priv->hangcheck_count = 0; | ||
317 | mod_timer(&dev_priv->hangcheck_timer, jiffies + DRM_I915_HANGCHECK_PERIOD); | ||
316 | } | 318 | } |
317 | 319 | ||
318 | if (de_iir & DE_GSE) | 320 | if (de_iir & DE_GSE) |
@@ -1084,6 +1086,10 @@ void i915_driver_irq_preinstall(struct drm_device * dev) | |||
1084 | (void) I915_READ(IER); | 1086 | (void) I915_READ(IER); |
1085 | } | 1087 | } |
1086 | 1088 | ||
1089 | /* | ||
1090 | * Must be called after intel_modeset_init or hotplug interrupts won't be | ||
1091 | * enabled correctly. | ||
1092 | */ | ||
1087 | int i915_driver_irq_postinstall(struct drm_device *dev) | 1093 | int i915_driver_irq_postinstall(struct drm_device *dev) |
1088 | { | 1094 | { |
1089 | drm_i915_private_t *dev_priv = (drm_i915_private_t *) dev->dev_private; | 1095 | drm_i915_private_t *dev_priv = (drm_i915_private_t *) dev->dev_private; |
@@ -1106,19 +1112,23 @@ int i915_driver_irq_postinstall(struct drm_device *dev) | |||
1106 | if (I915_HAS_HOTPLUG(dev)) { | 1112 | if (I915_HAS_HOTPLUG(dev)) { |
1107 | u32 hotplug_en = I915_READ(PORT_HOTPLUG_EN); | 1113 | u32 hotplug_en = I915_READ(PORT_HOTPLUG_EN); |
1108 | 1114 | ||
1109 | /* Leave other bits alone */ | 1115 | /* Note HDMI and DP share bits */ |
1110 | hotplug_en |= HOTPLUG_EN_MASK; | 1116 | if (dev_priv->hotplug_supported_mask & HDMIB_HOTPLUG_INT_STATUS) |
1117 | hotplug_en |= HDMIB_HOTPLUG_INT_EN; | ||
1118 | if (dev_priv->hotplug_supported_mask & HDMIC_HOTPLUG_INT_STATUS) | ||
1119 | hotplug_en |= HDMIC_HOTPLUG_INT_EN; | ||
1120 | if (dev_priv->hotplug_supported_mask & HDMID_HOTPLUG_INT_STATUS) | ||
1121 | hotplug_en |= HDMID_HOTPLUG_INT_EN; | ||
1122 | if (dev_priv->hotplug_supported_mask & SDVOC_HOTPLUG_INT_STATUS) | ||
1123 | hotplug_en |= SDVOC_HOTPLUG_INT_EN; | ||
1124 | if (dev_priv->hotplug_supported_mask & SDVOB_HOTPLUG_INT_STATUS) | ||
1125 | hotplug_en |= SDVOB_HOTPLUG_INT_EN; | ||
1126 | if (dev_priv->hotplug_supported_mask & CRT_HOTPLUG_INT_STATUS) | ||
1127 | hotplug_en |= CRT_HOTPLUG_INT_EN; | ||
1128 | /* Ignore TV since it's buggy */ | ||
1129 | |||
1111 | I915_WRITE(PORT_HOTPLUG_EN, hotplug_en); | 1130 | I915_WRITE(PORT_HOTPLUG_EN, hotplug_en); |
1112 | 1131 | ||
1113 | dev_priv->hotplug_supported_mask = CRT_HOTPLUG_INT_STATUS | | ||
1114 | TV_HOTPLUG_INT_STATUS | SDVOC_HOTPLUG_INT_STATUS | | ||
1115 | SDVOB_HOTPLUG_INT_STATUS; | ||
1116 | if (IS_G4X(dev)) { | ||
1117 | dev_priv->hotplug_supported_mask |= | ||
1118 | HDMIB_HOTPLUG_INT_STATUS | | ||
1119 | HDMIC_HOTPLUG_INT_STATUS | | ||
1120 | HDMID_HOTPLUG_INT_STATUS; | ||
1121 | } | ||
1122 | /* Enable in IER... */ | 1132 | /* Enable in IER... */ |
1123 | enable_mask |= I915_DISPLAY_PORT_INTERRUPT; | 1133 | enable_mask |= I915_DISPLAY_PORT_INTERRUPT; |
1124 | /* and unmask in IMR */ | 1134 | /* and unmask in IMR */ |
diff --git a/drivers/gpu/drm/i915/i915_reg.h b/drivers/gpu/drm/i915/i915_reg.h index 974b3cf70618..149d360d64a3 100644 --- a/drivers/gpu/drm/i915/i915_reg.h +++ b/drivers/gpu/drm/i915/i915_reg.h | |||
@@ -879,13 +879,6 @@ | |||
879 | #define CRT_HOTPLUG_DETECT_VOLTAGE_475MV (1 << 2) | 879 | #define CRT_HOTPLUG_DETECT_VOLTAGE_475MV (1 << 2) |
880 | #define CRT_HOTPLUG_MASK (0x3fc) /* Bits 9-2 */ | 880 | #define CRT_HOTPLUG_MASK (0x3fc) /* Bits 9-2 */ |
881 | #define CRT_FORCE_HOTPLUG_MASK 0xfffffe1f | 881 | #define CRT_FORCE_HOTPLUG_MASK 0xfffffe1f |
882 | #define HOTPLUG_EN_MASK (HDMIB_HOTPLUG_INT_EN | \ | ||
883 | HDMIC_HOTPLUG_INT_EN | \ | ||
884 | HDMID_HOTPLUG_INT_EN | \ | ||
885 | SDVOB_HOTPLUG_INT_EN | \ | ||
886 | SDVOC_HOTPLUG_INT_EN | \ | ||
887 | CRT_HOTPLUG_INT_EN) | ||
888 | |||
889 | 882 | ||
890 | #define PORT_HOTPLUG_STAT 0x61114 | 883 | #define PORT_HOTPLUG_STAT 0x61114 |
891 | #define HDMIB_HOTPLUG_INT_STATUS (1 << 29) | 884 | #define HDMIB_HOTPLUG_INT_STATUS (1 << 29) |
@@ -982,6 +975,8 @@ | |||
982 | #define LVDS_PORT_EN (1 << 31) | 975 | #define LVDS_PORT_EN (1 << 31) |
983 | /* Selects pipe B for LVDS data. Must be set on pre-965. */ | 976 | /* Selects pipe B for LVDS data. Must be set on pre-965. */ |
984 | #define LVDS_PIPEB_SELECT (1 << 30) | 977 | #define LVDS_PIPEB_SELECT (1 << 30) |
978 | /* LVDS dithering flag on 965/g4x platform */ | ||
979 | #define LVDS_ENABLE_DITHER (1 << 25) | ||
985 | /* Enable border for unscaled (or aspect-scaled) display */ | 980 | /* Enable border for unscaled (or aspect-scaled) display */ |
986 | #define LVDS_BORDER_ENABLE (1 << 15) | 981 | #define LVDS_BORDER_ENABLE (1 << 15) |
987 | /* | 982 | /* |
@@ -1751,6 +1746,8 @@ | |||
1751 | 1746 | ||
1752 | /* Display & cursor control */ | 1747 | /* Display & cursor control */ |
1753 | 1748 | ||
1749 | /* dithering flag on Ironlake */ | ||
1750 | #define PIPE_ENABLE_DITHER (1 << 4) | ||
1754 | /* Pipe A */ | 1751 | /* Pipe A */ |
1755 | #define PIPEADSL 0x70000 | 1752 | #define PIPEADSL 0x70000 |
1756 | #define PIPEACONF 0x70008 | 1753 | #define PIPEACONF 0x70008 |
diff --git a/drivers/gpu/drm/i915/i915_suspend.c b/drivers/gpu/drm/i915/i915_suspend.c index d5ebb00a9d49..a3b90c9561dc 100644 --- a/drivers/gpu/drm/i915/i915_suspend.c +++ b/drivers/gpu/drm/i915/i915_suspend.c | |||
@@ -732,12 +732,6 @@ int i915_save_state(struct drm_device *dev) | |||
732 | 732 | ||
733 | pci_read_config_byte(dev->pdev, LBB, &dev_priv->saveLBB); | 733 | pci_read_config_byte(dev->pdev, LBB, &dev_priv->saveLBB); |
734 | 734 | ||
735 | /* Render Standby */ | ||
736 | if (I915_HAS_RC6(dev)) { | ||
737 | dev_priv->saveRENDERSTANDBY = I915_READ(MCHBAR_RENDER_STANDBY); | ||
738 | dev_priv->savePWRCTXA = I915_READ(PWRCTXA); | ||
739 | } | ||
740 | |||
741 | /* Hardware status page */ | 735 | /* Hardware status page */ |
742 | dev_priv->saveHWS = I915_READ(HWS_PGA); | 736 | dev_priv->saveHWS = I915_READ(HWS_PGA); |
743 | 737 | ||
@@ -793,12 +787,6 @@ int i915_restore_state(struct drm_device *dev) | |||
793 | 787 | ||
794 | pci_write_config_byte(dev->pdev, LBB, dev_priv->saveLBB); | 788 | pci_write_config_byte(dev->pdev, LBB, dev_priv->saveLBB); |
795 | 789 | ||
796 | /* Render Standby */ | ||
797 | if (I915_HAS_RC6(dev)) { | ||
798 | I915_WRITE(MCHBAR_RENDER_STANDBY, dev_priv->saveRENDERSTANDBY); | ||
799 | I915_WRITE(PWRCTXA, dev_priv->savePWRCTXA); | ||
800 | } | ||
801 | |||
802 | /* Hardware status page */ | 790 | /* Hardware status page */ |
803 | I915_WRITE(HWS_PGA, dev_priv->saveHWS); | 791 | I915_WRITE(HWS_PGA, dev_priv->saveHWS); |
804 | 792 | ||
diff --git a/drivers/gpu/drm/i915/intel_crt.c b/drivers/gpu/drm/i915/intel_crt.c index 9f3d3e563414..ddefc871edfe 100644 --- a/drivers/gpu/drm/i915/intel_crt.c +++ b/drivers/gpu/drm/i915/intel_crt.c | |||
@@ -548,4 +548,6 @@ void intel_crt_init(struct drm_device *dev) | |||
548 | drm_connector_helper_add(connector, &intel_crt_connector_helper_funcs); | 548 | drm_connector_helper_add(connector, &intel_crt_connector_helper_funcs); |
549 | 549 | ||
550 | drm_sysfs_connector_add(connector); | 550 | drm_sysfs_connector_add(connector); |
551 | |||
552 | dev_priv->hotplug_supported_mask |= CRT_HOTPLUG_INT_STATUS; | ||
551 | } | 553 | } |
diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c index 52cd9b006da2..002612fae717 100644 --- a/drivers/gpu/drm/i915/intel_display.c +++ b/drivers/gpu/drm/i915/intel_display.c | |||
@@ -262,6 +262,14 @@ struct intel_limit { | |||
262 | #define IRONLAKE_P2_LVDS_FAST 7 /* double channel */ | 262 | #define IRONLAKE_P2_LVDS_FAST 7 /* double channel */ |
263 | #define IRONLAKE_P2_DOT_LIMIT 225000 /* 225Mhz */ | 263 | #define IRONLAKE_P2_DOT_LIMIT 225000 /* 225Mhz */ |
264 | 264 | ||
265 | #define IRONLAKE_P_DISPLAY_PORT_MIN 10 | ||
266 | #define IRONLAKE_P_DISPLAY_PORT_MAX 20 | ||
267 | #define IRONLAKE_P2_DISPLAY_PORT_FAST 10 | ||
268 | #define IRONLAKE_P2_DISPLAY_PORT_SLOW 10 | ||
269 | #define IRONLAKE_P2_DISPLAY_PORT_LIMIT 0 | ||
270 | #define IRONLAKE_P1_DISPLAY_PORT_MIN 1 | ||
271 | #define IRONLAKE_P1_DISPLAY_PORT_MAX 2 | ||
272 | |||
265 | static bool | 273 | static bool |
266 | intel_find_best_PLL(const intel_limit_t *limit, struct drm_crtc *crtc, | 274 | intel_find_best_PLL(const intel_limit_t *limit, struct drm_crtc *crtc, |
267 | int target, int refclk, intel_clock_t *best_clock); | 275 | int target, int refclk, intel_clock_t *best_clock); |
@@ -271,9 +279,6 @@ intel_find_best_reduced_PLL(const intel_limit_t *limit, struct drm_crtc *crtc, | |||
271 | static bool | 279 | static bool |
272 | intel_g4x_find_best_PLL(const intel_limit_t *limit, struct drm_crtc *crtc, | 280 | intel_g4x_find_best_PLL(const intel_limit_t *limit, struct drm_crtc *crtc, |
273 | int target, int refclk, intel_clock_t *best_clock); | 281 | int target, int refclk, intel_clock_t *best_clock); |
274 | static bool | ||
275 | intel_ironlake_find_best_PLL(const intel_limit_t *limit, struct drm_crtc *crtc, | ||
276 | int target, int refclk, intel_clock_t *best_clock); | ||
277 | 282 | ||
278 | static bool | 283 | static bool |
279 | intel_find_pll_g4x_dp(const intel_limit_t *, struct drm_crtc *crtc, | 284 | intel_find_pll_g4x_dp(const intel_limit_t *, struct drm_crtc *crtc, |
@@ -496,7 +501,7 @@ static const intel_limit_t intel_limits_ironlake_sdvo = { | |||
496 | .p2 = { .dot_limit = IRONLAKE_P2_DOT_LIMIT, | 501 | .p2 = { .dot_limit = IRONLAKE_P2_DOT_LIMIT, |
497 | .p2_slow = IRONLAKE_P2_SDVO_DAC_SLOW, | 502 | .p2_slow = IRONLAKE_P2_SDVO_DAC_SLOW, |
498 | .p2_fast = IRONLAKE_P2_SDVO_DAC_FAST }, | 503 | .p2_fast = IRONLAKE_P2_SDVO_DAC_FAST }, |
499 | .find_pll = intel_ironlake_find_best_PLL, | 504 | .find_pll = intel_g4x_find_best_PLL, |
500 | }; | 505 | }; |
501 | 506 | ||
502 | static const intel_limit_t intel_limits_ironlake_lvds = { | 507 | static const intel_limit_t intel_limits_ironlake_lvds = { |
@@ -511,7 +516,30 @@ static const intel_limit_t intel_limits_ironlake_lvds = { | |||
511 | .p2 = { .dot_limit = IRONLAKE_P2_DOT_LIMIT, | 516 | .p2 = { .dot_limit = IRONLAKE_P2_DOT_LIMIT, |
512 | .p2_slow = IRONLAKE_P2_LVDS_SLOW, | 517 | .p2_slow = IRONLAKE_P2_LVDS_SLOW, |
513 | .p2_fast = IRONLAKE_P2_LVDS_FAST }, | 518 | .p2_fast = IRONLAKE_P2_LVDS_FAST }, |
514 | .find_pll = intel_ironlake_find_best_PLL, | 519 | .find_pll = intel_g4x_find_best_PLL, |
520 | }; | ||
521 | |||
522 | static const intel_limit_t intel_limits_ironlake_display_port = { | ||
523 | .dot = { .min = IRONLAKE_DOT_MIN, | ||
524 | .max = IRONLAKE_DOT_MAX }, | ||
525 | .vco = { .min = IRONLAKE_VCO_MIN, | ||
526 | .max = IRONLAKE_VCO_MAX}, | ||
527 | .n = { .min = IRONLAKE_N_MIN, | ||
528 | .max = IRONLAKE_N_MAX }, | ||
529 | .m = { .min = IRONLAKE_M_MIN, | ||
530 | .max = IRONLAKE_M_MAX }, | ||
531 | .m1 = { .min = IRONLAKE_M1_MIN, | ||
532 | .max = IRONLAKE_M1_MAX }, | ||
533 | .m2 = { .min = IRONLAKE_M2_MIN, | ||
534 | .max = IRONLAKE_M2_MAX }, | ||
535 | .p = { .min = IRONLAKE_P_DISPLAY_PORT_MIN, | ||
536 | .max = IRONLAKE_P_DISPLAY_PORT_MAX }, | ||
537 | .p1 = { .min = IRONLAKE_P1_DISPLAY_PORT_MIN, | ||
538 | .max = IRONLAKE_P1_DISPLAY_PORT_MAX}, | ||
539 | .p2 = { .dot_limit = IRONLAKE_P2_DISPLAY_PORT_LIMIT, | ||
540 | .p2_slow = IRONLAKE_P2_DISPLAY_PORT_SLOW, | ||
541 | .p2_fast = IRONLAKE_P2_DISPLAY_PORT_FAST }, | ||
542 | .find_pll = intel_find_pll_ironlake_dp, | ||
515 | }; | 543 | }; |
516 | 544 | ||
517 | static const intel_limit_t *intel_ironlake_limit(struct drm_crtc *crtc) | 545 | static const intel_limit_t *intel_ironlake_limit(struct drm_crtc *crtc) |
@@ -519,6 +547,9 @@ static const intel_limit_t *intel_ironlake_limit(struct drm_crtc *crtc) | |||
519 | const intel_limit_t *limit; | 547 | const intel_limit_t *limit; |
520 | if (intel_pipe_has_type(crtc, INTEL_OUTPUT_LVDS)) | 548 | if (intel_pipe_has_type(crtc, INTEL_OUTPUT_LVDS)) |
521 | limit = &intel_limits_ironlake_lvds; | 549 | limit = &intel_limits_ironlake_lvds; |
550 | else if (intel_pipe_has_type(crtc, INTEL_OUTPUT_DISPLAYPORT) || | ||
551 | HAS_eDP) | ||
552 | limit = &intel_limits_ironlake_display_port; | ||
522 | else | 553 | else |
523 | limit = &intel_limits_ironlake_sdvo; | 554 | limit = &intel_limits_ironlake_sdvo; |
524 | 555 | ||
@@ -791,7 +822,13 @@ intel_g4x_find_best_PLL(const intel_limit_t *limit, struct drm_crtc *crtc, | |||
791 | found = false; | 822 | found = false; |
792 | 823 | ||
793 | if (intel_pipe_has_type(crtc, INTEL_OUTPUT_LVDS)) { | 824 | if (intel_pipe_has_type(crtc, INTEL_OUTPUT_LVDS)) { |
794 | if ((I915_READ(LVDS) & LVDS_CLKB_POWER_MASK) == | 825 | int lvds_reg; |
826 | |||
827 | if (IS_IRONLAKE(dev)) | ||
828 | lvds_reg = PCH_LVDS; | ||
829 | else | ||
830 | lvds_reg = LVDS; | ||
831 | if ((I915_READ(lvds_reg) & LVDS_CLKB_POWER_MASK) == | ||
795 | LVDS_CLKB_POWER_UP) | 832 | LVDS_CLKB_POWER_UP) |
796 | clock.p2 = limit->p2.p2_fast; | 833 | clock.p2 = limit->p2.p2_fast; |
797 | else | 834 | else |
@@ -839,6 +876,11 @@ intel_find_pll_ironlake_dp(const intel_limit_t *limit, struct drm_crtc *crtc, | |||
839 | { | 876 | { |
840 | struct drm_device *dev = crtc->dev; | 877 | struct drm_device *dev = crtc->dev; |
841 | intel_clock_t clock; | 878 | intel_clock_t clock; |
879 | |||
880 | /* return directly when it is eDP */ | ||
881 | if (HAS_eDP) | ||
882 | return true; | ||
883 | |||
842 | if (target < 200000) { | 884 | if (target < 200000) { |
843 | clock.n = 1; | 885 | clock.n = 1; |
844 | clock.p1 = 2; | 886 | clock.p1 = 2; |
@@ -857,68 +899,6 @@ intel_find_pll_ironlake_dp(const intel_limit_t *limit, struct drm_crtc *crtc, | |||
857 | return true; | 899 | return true; |
858 | } | 900 | } |
859 | 901 | ||
860 | static bool | ||
861 | intel_ironlake_find_best_PLL(const intel_limit_t *limit, struct drm_crtc *crtc, | ||
862 | int target, int refclk, intel_clock_t *best_clock) | ||
863 | { | ||
864 | struct drm_device *dev = crtc->dev; | ||
865 | struct drm_i915_private *dev_priv = dev->dev_private; | ||
866 | intel_clock_t clock; | ||
867 | int err_most = 47; | ||
868 | int err_min = 10000; | ||
869 | |||
870 | /* eDP has only 2 clock choice, no n/m/p setting */ | ||
871 | if (HAS_eDP) | ||
872 | return true; | ||
873 | |||
874 | if (intel_pipe_has_type(crtc, INTEL_OUTPUT_DISPLAYPORT)) | ||
875 | return intel_find_pll_ironlake_dp(limit, crtc, target, | ||
876 | refclk, best_clock); | ||
877 | |||
878 | if (intel_pipe_has_type(crtc, INTEL_OUTPUT_LVDS)) { | ||
879 | if ((I915_READ(PCH_LVDS) & LVDS_CLKB_POWER_MASK) == | ||
880 | LVDS_CLKB_POWER_UP) | ||
881 | clock.p2 = limit->p2.p2_fast; | ||
882 | else | ||
883 | clock.p2 = limit->p2.p2_slow; | ||
884 | } else { | ||
885 | if (target < limit->p2.dot_limit) | ||
886 | clock.p2 = limit->p2.p2_slow; | ||
887 | else | ||
888 | clock.p2 = limit->p2.p2_fast; | ||
889 | } | ||
890 | |||
891 | memset(best_clock, 0, sizeof(*best_clock)); | ||
892 | for (clock.p1 = limit->p1.max; clock.p1 >= limit->p1.min; clock.p1--) { | ||
893 | /* based on hardware requriment prefer smaller n to precision */ | ||
894 | for (clock.n = limit->n.min; clock.n <= limit->n.max; clock.n++) { | ||
895 | /* based on hardware requirment prefere larger m1,m2 */ | ||
896 | for (clock.m1 = limit->m1.max; | ||
897 | clock.m1 >= limit->m1.min; clock.m1--) { | ||
898 | for (clock.m2 = limit->m2.max; | ||
899 | clock.m2 >= limit->m2.min; clock.m2--) { | ||
900 | int this_err; | ||
901 | |||
902 | intel_clock(dev, refclk, &clock); | ||
903 | if (!intel_PLL_is_valid(crtc, &clock)) | ||
904 | continue; | ||
905 | this_err = abs((10000 - (target*10000/clock.dot))); | ||
906 | if (this_err < err_most) { | ||
907 | *best_clock = clock; | ||
908 | /* found on first matching */ | ||
909 | goto out; | ||
910 | } else if (this_err < err_min) { | ||
911 | *best_clock = clock; | ||
912 | err_min = this_err; | ||
913 | } | ||
914 | } | ||
915 | } | ||
916 | } | ||
917 | } | ||
918 | out: | ||
919 | return true; | ||
920 | } | ||
921 | |||
922 | /* DisplayPort has only two frequencies, 162MHz and 270MHz */ | 902 | /* DisplayPort has only two frequencies, 162MHz and 270MHz */ |
923 | static bool | 903 | static bool |
924 | intel_find_pll_g4x_dp(const intel_limit_t *limit, struct drm_crtc *crtc, | 904 | intel_find_pll_g4x_dp(const intel_limit_t *limit, struct drm_crtc *crtc, |
@@ -1493,6 +1473,10 @@ static void ironlake_crtc_dpms(struct drm_crtc *crtc, int mode) | |||
1493 | int trans_vsync_reg = (pipe == 0) ? TRANS_VSYNC_A : TRANS_VSYNC_B; | 1473 | int trans_vsync_reg = (pipe == 0) ? TRANS_VSYNC_A : TRANS_VSYNC_B; |
1494 | u32 temp; | 1474 | u32 temp; |
1495 | int tries = 5, j, n; | 1475 | int tries = 5, j, n; |
1476 | u32 pipe_bpc; | ||
1477 | |||
1478 | temp = I915_READ(pipeconf_reg); | ||
1479 | pipe_bpc = temp & PIPE_BPC_MASK; | ||
1496 | 1480 | ||
1497 | /* XXX: When our outputs are all unaware of DPMS modes other than off | 1481 | /* XXX: When our outputs are all unaware of DPMS modes other than off |
1498 | * and on, we should map those modes to DRM_MODE_DPMS_OFF in the CRTC. | 1482 | * and on, we should map those modes to DRM_MODE_DPMS_OFF in the CRTC. |
@@ -1524,6 +1508,12 @@ static void ironlake_crtc_dpms(struct drm_crtc *crtc, int mode) | |||
1524 | 1508 | ||
1525 | /* enable PCH FDI RX PLL, wait warmup plus DMI latency */ | 1509 | /* enable PCH FDI RX PLL, wait warmup plus DMI latency */ |
1526 | temp = I915_READ(fdi_rx_reg); | 1510 | temp = I915_READ(fdi_rx_reg); |
1511 | /* | ||
1512 | * make the BPC in FDI Rx be consistent with that in | ||
1513 | * pipeconf reg. | ||
1514 | */ | ||
1515 | temp &= ~(0x7 << 16); | ||
1516 | temp |= (pipe_bpc << 11); | ||
1527 | I915_WRITE(fdi_rx_reg, temp | FDI_RX_PLL_ENABLE | | 1517 | I915_WRITE(fdi_rx_reg, temp | FDI_RX_PLL_ENABLE | |
1528 | FDI_SEL_PCDCLK | | 1518 | FDI_SEL_PCDCLK | |
1529 | FDI_DP_PORT_WIDTH_X4); /* default 4 lanes */ | 1519 | FDI_DP_PORT_WIDTH_X4); /* default 4 lanes */ |
@@ -1666,6 +1656,12 @@ static void ironlake_crtc_dpms(struct drm_crtc *crtc, int mode) | |||
1666 | 1656 | ||
1667 | /* enable PCH transcoder */ | 1657 | /* enable PCH transcoder */ |
1668 | temp = I915_READ(transconf_reg); | 1658 | temp = I915_READ(transconf_reg); |
1659 | /* | ||
1660 | * make the BPC in transcoder be consistent with | ||
1661 | * that in pipeconf reg. | ||
1662 | */ | ||
1663 | temp &= ~PIPE_BPC_MASK; | ||
1664 | temp |= pipe_bpc; | ||
1669 | I915_WRITE(transconf_reg, temp | TRANS_ENABLE); | 1665 | I915_WRITE(transconf_reg, temp | TRANS_ENABLE); |
1670 | I915_READ(transconf_reg); | 1666 | I915_READ(transconf_reg); |
1671 | 1667 | ||
@@ -1745,6 +1741,9 @@ static void ironlake_crtc_dpms(struct drm_crtc *crtc, int mode) | |||
1745 | I915_READ(fdi_tx_reg); | 1741 | I915_READ(fdi_tx_reg); |
1746 | 1742 | ||
1747 | temp = I915_READ(fdi_rx_reg); | 1743 | temp = I915_READ(fdi_rx_reg); |
1744 | /* BPC in FDI rx is consistent with that in pipeconf */ | ||
1745 | temp &= ~(0x07 << 16); | ||
1746 | temp |= (pipe_bpc << 11); | ||
1748 | I915_WRITE(fdi_rx_reg, temp & ~FDI_RX_ENABLE); | 1747 | I915_WRITE(fdi_rx_reg, temp & ~FDI_RX_ENABLE); |
1749 | I915_READ(fdi_rx_reg); | 1748 | I915_READ(fdi_rx_reg); |
1750 | 1749 | ||
@@ -1789,7 +1788,12 @@ static void ironlake_crtc_dpms(struct drm_crtc *crtc, int mode) | |||
1789 | } | 1788 | } |
1790 | } | 1789 | } |
1791 | } | 1790 | } |
1792 | 1791 | temp = I915_READ(transconf_reg); | |
1792 | /* BPC in transcoder is consistent with that in pipeconf */ | ||
1793 | temp &= ~PIPE_BPC_MASK; | ||
1794 | temp |= pipe_bpc; | ||
1795 | I915_WRITE(transconf_reg, temp); | ||
1796 | I915_READ(transconf_reg); | ||
1793 | udelay(100); | 1797 | udelay(100); |
1794 | 1798 | ||
1795 | /* disable PCH DPLL */ | 1799 | /* disable PCH DPLL */ |
@@ -2448,7 +2452,7 @@ static void pineview_enable_cxsr(struct drm_device *dev, unsigned long clock, | |||
2448 | * A value of 5us seems to be a good balance; safe for very low end | 2452 | * A value of 5us seems to be a good balance; safe for very low end |
2449 | * platforms but not overly aggressive on lower latency configs. | 2453 | * platforms but not overly aggressive on lower latency configs. |
2450 | */ | 2454 | */ |
2451 | const static int latency_ns = 5000; | 2455 | static const int latency_ns = 5000; |
2452 | 2456 | ||
2453 | static int i9xx_get_fifo_size(struct drm_device *dev, int plane) | 2457 | static int i9xx_get_fifo_size(struct drm_device *dev, int plane) |
2454 | { | 2458 | { |
@@ -2559,7 +2563,7 @@ static void g4x_update_wm(struct drm_device *dev, int planea_clock, | |||
2559 | /* Calc sr entries for one plane configs */ | 2563 | /* Calc sr entries for one plane configs */ |
2560 | if (sr_hdisplay && (!planea_clock || !planeb_clock)) { | 2564 | if (sr_hdisplay && (!planea_clock || !planeb_clock)) { |
2561 | /* self-refresh has much higher latency */ | 2565 | /* self-refresh has much higher latency */ |
2562 | const static int sr_latency_ns = 12000; | 2566 | static const int sr_latency_ns = 12000; |
2563 | 2567 | ||
2564 | sr_clock = planea_clock ? planea_clock : planeb_clock; | 2568 | sr_clock = planea_clock ? planea_clock : planeb_clock; |
2565 | line_time_us = ((sr_hdisplay * 1000) / sr_clock); | 2569 | line_time_us = ((sr_hdisplay * 1000) / sr_clock); |
@@ -2598,7 +2602,7 @@ static void i965_update_wm(struct drm_device *dev, int planea_clock, | |||
2598 | /* Calc sr entries for one plane configs */ | 2602 | /* Calc sr entries for one plane configs */ |
2599 | if (sr_hdisplay && (!planea_clock || !planeb_clock)) { | 2603 | if (sr_hdisplay && (!planea_clock || !planeb_clock)) { |
2600 | /* self-refresh has much higher latency */ | 2604 | /* self-refresh has much higher latency */ |
2601 | const static int sr_latency_ns = 12000; | 2605 | static const int sr_latency_ns = 12000; |
2602 | 2606 | ||
2603 | sr_clock = planea_clock ? planea_clock : planeb_clock; | 2607 | sr_clock = planea_clock ? planea_clock : planeb_clock; |
2604 | line_time_us = ((sr_hdisplay * 1000) / sr_clock); | 2608 | line_time_us = ((sr_hdisplay * 1000) / sr_clock); |
@@ -2667,7 +2671,7 @@ static void i9xx_update_wm(struct drm_device *dev, int planea_clock, | |||
2667 | if (HAS_FW_BLC(dev) && sr_hdisplay && | 2671 | if (HAS_FW_BLC(dev) && sr_hdisplay && |
2668 | (!planea_clock || !planeb_clock)) { | 2672 | (!planea_clock || !planeb_clock)) { |
2669 | /* self-refresh has much higher latency */ | 2673 | /* self-refresh has much higher latency */ |
2670 | const static int sr_latency_ns = 6000; | 2674 | static const int sr_latency_ns = 6000; |
2671 | 2675 | ||
2672 | sr_clock = planea_clock ? planea_clock : planeb_clock; | 2676 | sr_clock = planea_clock ? planea_clock : planeb_clock; |
2673 | line_time_us = ((sr_hdisplay * 1000) / sr_clock); | 2677 | line_time_us = ((sr_hdisplay * 1000) / sr_clock); |
@@ -2969,6 +2973,18 @@ static int intel_crtc_mode_set(struct drm_crtc *crtc, | |||
2969 | 2973 | ||
2970 | /* determine panel color depth */ | 2974 | /* determine panel color depth */ |
2971 | temp = I915_READ(pipeconf_reg); | 2975 | temp = I915_READ(pipeconf_reg); |
2976 | temp &= ~PIPE_BPC_MASK; | ||
2977 | if (is_lvds) { | ||
2978 | int lvds_reg = I915_READ(PCH_LVDS); | ||
2979 | /* the BPC will be 6 if it is 18-bit LVDS panel */ | ||
2980 | if ((lvds_reg & LVDS_A3_POWER_MASK) == LVDS_A3_POWER_UP) | ||
2981 | temp |= PIPE_8BPC; | ||
2982 | else | ||
2983 | temp |= PIPE_6BPC; | ||
2984 | } else | ||
2985 | temp |= PIPE_8BPC; | ||
2986 | I915_WRITE(pipeconf_reg, temp); | ||
2987 | I915_READ(pipeconf_reg); | ||
2972 | 2988 | ||
2973 | switch (temp & PIPE_BPC_MASK) { | 2989 | switch (temp & PIPE_BPC_MASK) { |
2974 | case PIPE_8BPC: | 2990 | case PIPE_8BPC: |
@@ -3195,7 +3211,20 @@ static int intel_crtc_mode_set(struct drm_crtc *crtc, | |||
3195 | * appropriately here, but we need to look more thoroughly into how | 3211 | * appropriately here, but we need to look more thoroughly into how |
3196 | * panels behave in the two modes. | 3212 | * panels behave in the two modes. |
3197 | */ | 3213 | */ |
3198 | 3214 | /* set the dithering flag */ | |
3215 | if (IS_I965G(dev)) { | ||
3216 | if (dev_priv->lvds_dither) { | ||
3217 | if (IS_IRONLAKE(dev)) | ||
3218 | pipeconf |= PIPE_ENABLE_DITHER; | ||
3219 | else | ||
3220 | lvds |= LVDS_ENABLE_DITHER; | ||
3221 | } else { | ||
3222 | if (IS_IRONLAKE(dev)) | ||
3223 | pipeconf &= ~PIPE_ENABLE_DITHER; | ||
3224 | else | ||
3225 | lvds &= ~LVDS_ENABLE_DITHER; | ||
3226 | } | ||
3227 | } | ||
3199 | I915_WRITE(lvds_reg, lvds); | 3228 | I915_WRITE(lvds_reg, lvds); |
3200 | I915_READ(lvds_reg); | 3229 | I915_READ(lvds_reg); |
3201 | } | 3230 | } |
@@ -3385,7 +3414,7 @@ static int intel_crtc_cursor_set(struct drm_crtc *crtc, | |||
3385 | 3414 | ||
3386 | /* we only need to pin inside GTT if cursor is non-phy */ | 3415 | /* we only need to pin inside GTT if cursor is non-phy */ |
3387 | mutex_lock(&dev->struct_mutex); | 3416 | mutex_lock(&dev->struct_mutex); |
3388 | if (!dev_priv->cursor_needs_physical) { | 3417 | if (!dev_priv->info->cursor_needs_physical) { |
3389 | ret = i915_gem_object_pin(bo, PAGE_SIZE); | 3418 | ret = i915_gem_object_pin(bo, PAGE_SIZE); |
3390 | if (ret) { | 3419 | if (ret) { |
3391 | DRM_ERROR("failed to pin cursor bo\n"); | 3420 | DRM_ERROR("failed to pin cursor bo\n"); |
@@ -3420,7 +3449,7 @@ static int intel_crtc_cursor_set(struct drm_crtc *crtc, | |||
3420 | I915_WRITE(base, addr); | 3449 | I915_WRITE(base, addr); |
3421 | 3450 | ||
3422 | if (intel_crtc->cursor_bo) { | 3451 | if (intel_crtc->cursor_bo) { |
3423 | if (dev_priv->cursor_needs_physical) { | 3452 | if (dev_priv->info->cursor_needs_physical) { |
3424 | if (intel_crtc->cursor_bo != bo) | 3453 | if (intel_crtc->cursor_bo != bo) |
3425 | i915_gem_detach_phys_object(dev, intel_crtc->cursor_bo); | 3454 | i915_gem_detach_phys_object(dev, intel_crtc->cursor_bo); |
3426 | } else | 3455 | } else |
@@ -3779,125 +3808,6 @@ static void intel_gpu_idle_timer(unsigned long arg) | |||
3779 | queue_work(dev_priv->wq, &dev_priv->idle_work); | 3808 | queue_work(dev_priv->wq, &dev_priv->idle_work); |
3780 | } | 3809 | } |
3781 | 3810 | ||
3782 | void intel_increase_renderclock(struct drm_device *dev, bool schedule) | ||
3783 | { | ||
3784 | drm_i915_private_t *dev_priv = dev->dev_private; | ||
3785 | |||
3786 | if (IS_IRONLAKE(dev)) | ||
3787 | return; | ||
3788 | |||
3789 | if (!dev_priv->render_reclock_avail) { | ||
3790 | DRM_DEBUG_DRIVER("not reclocking render clock\n"); | ||
3791 | return; | ||
3792 | } | ||
3793 | |||
3794 | /* Restore render clock frequency to original value */ | ||
3795 | if (IS_G4X(dev) || IS_I9XX(dev)) | ||
3796 | pci_write_config_word(dev->pdev, GCFGC, dev_priv->orig_clock); | ||
3797 | else if (IS_I85X(dev)) | ||
3798 | pci_write_config_word(dev->pdev, HPLLCC, dev_priv->orig_clock); | ||
3799 | DRM_DEBUG_DRIVER("increasing render clock frequency\n"); | ||
3800 | |||
3801 | /* Schedule downclock */ | ||
3802 | if (schedule) | ||
3803 | mod_timer(&dev_priv->idle_timer, jiffies + | ||
3804 | msecs_to_jiffies(GPU_IDLE_TIMEOUT)); | ||
3805 | } | ||
3806 | |||
3807 | void intel_decrease_renderclock(struct drm_device *dev) | ||
3808 | { | ||
3809 | drm_i915_private_t *dev_priv = dev->dev_private; | ||
3810 | |||
3811 | if (IS_IRONLAKE(dev)) | ||
3812 | return; | ||
3813 | |||
3814 | if (!dev_priv->render_reclock_avail) { | ||
3815 | DRM_DEBUG_DRIVER("not reclocking render clock\n"); | ||
3816 | return; | ||
3817 | } | ||
3818 | |||
3819 | if (IS_G4X(dev)) { | ||
3820 | u16 gcfgc; | ||
3821 | |||
3822 | /* Adjust render clock... */ | ||
3823 | pci_read_config_word(dev->pdev, GCFGC, &gcfgc); | ||
3824 | |||
3825 | /* Down to minimum... */ | ||
3826 | gcfgc &= ~GM45_GC_RENDER_CLOCK_MASK; | ||
3827 | gcfgc |= GM45_GC_RENDER_CLOCK_266_MHZ; | ||
3828 | |||
3829 | pci_write_config_word(dev->pdev, GCFGC, gcfgc); | ||
3830 | } else if (IS_I965G(dev)) { | ||
3831 | u16 gcfgc; | ||
3832 | |||
3833 | /* Adjust render clock... */ | ||
3834 | pci_read_config_word(dev->pdev, GCFGC, &gcfgc); | ||
3835 | |||
3836 | /* Down to minimum... */ | ||
3837 | gcfgc &= ~I965_GC_RENDER_CLOCK_MASK; | ||
3838 | gcfgc |= I965_GC_RENDER_CLOCK_267_MHZ; | ||
3839 | |||
3840 | pci_write_config_word(dev->pdev, GCFGC, gcfgc); | ||
3841 | } else if (IS_I945G(dev) || IS_I945GM(dev)) { | ||
3842 | u16 gcfgc; | ||
3843 | |||
3844 | /* Adjust render clock... */ | ||
3845 | pci_read_config_word(dev->pdev, GCFGC, &gcfgc); | ||
3846 | |||
3847 | /* Down to minimum... */ | ||
3848 | gcfgc &= ~I945_GC_RENDER_CLOCK_MASK; | ||
3849 | gcfgc |= I945_GC_RENDER_CLOCK_166_MHZ; | ||
3850 | |||
3851 | pci_write_config_word(dev->pdev, GCFGC, gcfgc); | ||
3852 | } else if (IS_I915G(dev)) { | ||
3853 | u16 gcfgc; | ||
3854 | |||
3855 | /* Adjust render clock... */ | ||
3856 | pci_read_config_word(dev->pdev, GCFGC, &gcfgc); | ||
3857 | |||
3858 | /* Down to minimum... */ | ||
3859 | gcfgc &= ~I915_GC_RENDER_CLOCK_MASK; | ||
3860 | gcfgc |= I915_GC_RENDER_CLOCK_166_MHZ; | ||
3861 | |||
3862 | pci_write_config_word(dev->pdev, GCFGC, gcfgc); | ||
3863 | } else if (IS_I85X(dev)) { | ||
3864 | u16 hpllcc; | ||
3865 | |||
3866 | /* Adjust render clock... */ | ||
3867 | pci_read_config_word(dev->pdev, HPLLCC, &hpllcc); | ||
3868 | |||
3869 | /* Up to maximum... */ | ||
3870 | hpllcc &= ~GC_CLOCK_CONTROL_MASK; | ||
3871 | hpllcc |= GC_CLOCK_133_200; | ||
3872 | |||
3873 | pci_write_config_word(dev->pdev, HPLLCC, hpllcc); | ||
3874 | } | ||
3875 | DRM_DEBUG_DRIVER("decreasing render clock frequency\n"); | ||
3876 | } | ||
3877 | |||
3878 | /* Note that no increase function is needed for this - increase_renderclock() | ||
3879 | * will also rewrite these bits | ||
3880 | */ | ||
3881 | void intel_decrease_displayclock(struct drm_device *dev) | ||
3882 | { | ||
3883 | if (IS_IRONLAKE(dev)) | ||
3884 | return; | ||
3885 | |||
3886 | if (IS_I945G(dev) || IS_I945GM(dev) || IS_I915G(dev) || | ||
3887 | IS_I915GM(dev)) { | ||
3888 | u16 gcfgc; | ||
3889 | |||
3890 | /* Adjust render clock... */ | ||
3891 | pci_read_config_word(dev->pdev, GCFGC, &gcfgc); | ||
3892 | |||
3893 | /* Down to minimum... */ | ||
3894 | gcfgc &= ~0xf0; | ||
3895 | gcfgc |= 0x80; | ||
3896 | |||
3897 | pci_write_config_word(dev->pdev, GCFGC, gcfgc); | ||
3898 | } | ||
3899 | } | ||
3900 | |||
3901 | #define CRTC_IDLE_TIMEOUT 1000 /* ms */ | 3811 | #define CRTC_IDLE_TIMEOUT 1000 /* ms */ |
3902 | 3812 | ||
3903 | static void intel_crtc_idle_timer(unsigned long arg) | 3813 | static void intel_crtc_idle_timer(unsigned long arg) |
@@ -4011,12 +3921,6 @@ static void intel_idle_update(struct work_struct *work) | |||
4011 | 3921 | ||
4012 | mutex_lock(&dev->struct_mutex); | 3922 | mutex_lock(&dev->struct_mutex); |
4013 | 3923 | ||
4014 | /* GPU isn't processing, downclock it. */ | ||
4015 | if (!dev_priv->busy) { | ||
4016 | intel_decrease_renderclock(dev); | ||
4017 | intel_decrease_displayclock(dev); | ||
4018 | } | ||
4019 | |||
4020 | list_for_each_entry(crtc, &dev->mode_config.crtc_list, head) { | 3924 | list_for_each_entry(crtc, &dev->mode_config.crtc_list, head) { |
4021 | /* Skip inactive CRTCs */ | 3925 | /* Skip inactive CRTCs */ |
4022 | if (!crtc->fb) | 3926 | if (!crtc->fb) |
@@ -4050,13 +3954,11 @@ void intel_mark_busy(struct drm_device *dev, struct drm_gem_object *obj) | |||
4050 | if (!drm_core_check_feature(dev, DRIVER_MODESET)) | 3954 | if (!drm_core_check_feature(dev, DRIVER_MODESET)) |
4051 | return; | 3955 | return; |
4052 | 3956 | ||
4053 | if (!dev_priv->busy) { | 3957 | if (!dev_priv->busy) |
4054 | dev_priv->busy = true; | 3958 | dev_priv->busy = true; |
4055 | intel_increase_renderclock(dev, true); | 3959 | else |
4056 | } else { | ||
4057 | mod_timer(&dev_priv->idle_timer, jiffies + | 3960 | mod_timer(&dev_priv->idle_timer, jiffies + |
4058 | msecs_to_jiffies(GPU_IDLE_TIMEOUT)); | 3961 | msecs_to_jiffies(GPU_IDLE_TIMEOUT)); |
4059 | } | ||
4060 | 3962 | ||
4061 | list_for_each_entry(crtc, &dev->mode_config.crtc_list, head) { | 3963 | list_for_each_entry(crtc, &dev->mode_config.crtc_list, head) { |
4062 | if (!crtc->fb) | 3964 | if (!crtc->fb) |
@@ -4400,29 +4302,43 @@ static void intel_setup_outputs(struct drm_device *dev) | |||
4400 | bool found = false; | 4302 | bool found = false; |
4401 | 4303 | ||
4402 | if (I915_READ(SDVOB) & SDVO_DETECTED) { | 4304 | if (I915_READ(SDVOB) & SDVO_DETECTED) { |
4305 | DRM_DEBUG_KMS("probing SDVOB\n"); | ||
4403 | found = intel_sdvo_init(dev, SDVOB); | 4306 | found = intel_sdvo_init(dev, SDVOB); |
4404 | if (!found && SUPPORTS_INTEGRATED_HDMI(dev)) | 4307 | if (!found && SUPPORTS_INTEGRATED_HDMI(dev)) { |
4308 | DRM_DEBUG_KMS("probing HDMI on SDVOB\n"); | ||
4405 | intel_hdmi_init(dev, SDVOB); | 4309 | intel_hdmi_init(dev, SDVOB); |
4310 | } | ||
4406 | 4311 | ||
4407 | if (!found && SUPPORTS_INTEGRATED_DP(dev)) | 4312 | if (!found && SUPPORTS_INTEGRATED_DP(dev)) { |
4313 | DRM_DEBUG_KMS("probing DP_B\n"); | ||
4408 | intel_dp_init(dev, DP_B); | 4314 | intel_dp_init(dev, DP_B); |
4315 | } | ||
4409 | } | 4316 | } |
4410 | 4317 | ||
4411 | /* Before G4X SDVOC doesn't have its own detect register */ | 4318 | /* Before G4X SDVOC doesn't have its own detect register */ |
4412 | 4319 | ||
4413 | if (I915_READ(SDVOB) & SDVO_DETECTED) | 4320 | if (I915_READ(SDVOB) & SDVO_DETECTED) { |
4321 | DRM_DEBUG_KMS("probing SDVOC\n"); | ||
4414 | found = intel_sdvo_init(dev, SDVOC); | 4322 | found = intel_sdvo_init(dev, SDVOC); |
4323 | } | ||
4415 | 4324 | ||
4416 | if (!found && (I915_READ(SDVOC) & SDVO_DETECTED)) { | 4325 | if (!found && (I915_READ(SDVOC) & SDVO_DETECTED)) { |
4417 | 4326 | ||
4418 | if (SUPPORTS_INTEGRATED_HDMI(dev)) | 4327 | if (SUPPORTS_INTEGRATED_HDMI(dev)) { |
4328 | DRM_DEBUG_KMS("probing HDMI on SDVOC\n"); | ||
4419 | intel_hdmi_init(dev, SDVOC); | 4329 | intel_hdmi_init(dev, SDVOC); |
4420 | if (SUPPORTS_INTEGRATED_DP(dev)) | 4330 | } |
4331 | if (SUPPORTS_INTEGRATED_DP(dev)) { | ||
4332 | DRM_DEBUG_KMS("probing DP_C\n"); | ||
4421 | intel_dp_init(dev, DP_C); | 4333 | intel_dp_init(dev, DP_C); |
4334 | } | ||
4422 | } | 4335 | } |
4423 | 4336 | ||
4424 | if (SUPPORTS_INTEGRATED_DP(dev) && (I915_READ(DP_D) & DP_DETECTED)) | 4337 | if (SUPPORTS_INTEGRATED_DP(dev) && |
4338 | (I915_READ(DP_D) & DP_DETECTED)) { | ||
4339 | DRM_DEBUG_KMS("probing DP_D\n"); | ||
4425 | intel_dp_init(dev, DP_D); | 4340 | intel_dp_init(dev, DP_D); |
4341 | } | ||
4426 | } else if (IS_I8XX(dev)) | 4342 | } else if (IS_I8XX(dev)) |
4427 | intel_dvo_init(dev); | 4343 | intel_dvo_init(dev); |
4428 | 4344 | ||
@@ -4527,6 +4443,42 @@ static const struct drm_mode_config_funcs intel_mode_funcs = { | |||
4527 | .fb_changed = intelfb_probe, | 4443 | .fb_changed = intelfb_probe, |
4528 | }; | 4444 | }; |
4529 | 4445 | ||
4446 | static struct drm_gem_object * | ||
4447 | intel_alloc_power_context(struct drm_device *dev) | ||
4448 | { | ||
4449 | struct drm_gem_object *pwrctx; | ||
4450 | int ret; | ||
4451 | |||
4452 | pwrctx = drm_gem_object_alloc(dev, 4096); | ||
4453 | if (!pwrctx) { | ||
4454 | DRM_DEBUG("failed to alloc power context, RC6 disabled\n"); | ||
4455 | return NULL; | ||
4456 | } | ||
4457 | |||
4458 | mutex_lock(&dev->struct_mutex); | ||
4459 | ret = i915_gem_object_pin(pwrctx, 4096); | ||
4460 | if (ret) { | ||
4461 | DRM_ERROR("failed to pin power context: %d\n", ret); | ||
4462 | goto err_unref; | ||
4463 | } | ||
4464 | |||
4465 | ret = i915_gem_object_set_to_gtt_domain(pwrctx, 1); | ||
4466 | if (ret) { | ||
4467 | DRM_ERROR("failed to set-domain on power context: %d\n", ret); | ||
4468 | goto err_unpin; | ||
4469 | } | ||
4470 | mutex_unlock(&dev->struct_mutex); | ||
4471 | |||
4472 | return pwrctx; | ||
4473 | |||
4474 | err_unpin: | ||
4475 | i915_gem_object_unpin(pwrctx); | ||
4476 | err_unref: | ||
4477 | drm_gem_object_unreference(pwrctx); | ||
4478 | mutex_unlock(&dev->struct_mutex); | ||
4479 | return NULL; | ||
4480 | } | ||
4481 | |||
4530 | void intel_init_clock_gating(struct drm_device *dev) | 4482 | void intel_init_clock_gating(struct drm_device *dev) |
4531 | { | 4483 | { |
4532 | struct drm_i915_private *dev_priv = dev->dev_private; | 4484 | struct drm_i915_private *dev_priv = dev->dev_private; |
@@ -4579,42 +4531,27 @@ void intel_init_clock_gating(struct drm_device *dev) | |||
4579 | * GPU can automatically power down the render unit if given a page | 4531 | * GPU can automatically power down the render unit if given a page |
4580 | * to save state. | 4532 | * to save state. |
4581 | */ | 4533 | */ |
4582 | if (I915_HAS_RC6(dev)) { | 4534 | if (I915_HAS_RC6(dev) && drm_core_check_feature(dev, DRIVER_MODESET)) { |
4583 | struct drm_gem_object *pwrctx; | 4535 | struct drm_i915_gem_object *obj_priv = NULL; |
4584 | struct drm_i915_gem_object *obj_priv; | ||
4585 | int ret; | ||
4586 | 4536 | ||
4587 | if (dev_priv->pwrctx) { | 4537 | if (dev_priv->pwrctx) { |
4588 | obj_priv = dev_priv->pwrctx->driver_private; | 4538 | obj_priv = dev_priv->pwrctx->driver_private; |
4589 | } else { | 4539 | } else { |
4590 | pwrctx = drm_gem_object_alloc(dev, 4096); | 4540 | struct drm_gem_object *pwrctx; |
4591 | if (!pwrctx) { | ||
4592 | DRM_DEBUG("failed to alloc power context, " | ||
4593 | "RC6 disabled\n"); | ||
4594 | goto out; | ||
4595 | } | ||
4596 | 4541 | ||
4597 | ret = i915_gem_object_pin(pwrctx, 4096); | 4542 | pwrctx = intel_alloc_power_context(dev); |
4598 | if (ret) { | 4543 | if (pwrctx) { |
4599 | DRM_ERROR("failed to pin power context: %d\n", | 4544 | dev_priv->pwrctx = pwrctx; |
4600 | ret); | 4545 | obj_priv = pwrctx->driver_private; |
4601 | drm_gem_object_unreference(pwrctx); | ||
4602 | goto out; | ||
4603 | } | 4546 | } |
4604 | |||
4605 | i915_gem_object_set_to_gtt_domain(pwrctx, 1); | ||
4606 | |||
4607 | dev_priv->pwrctx = pwrctx; | ||
4608 | obj_priv = pwrctx->driver_private; | ||
4609 | } | 4547 | } |
4610 | 4548 | ||
4611 | I915_WRITE(PWRCTXA, obj_priv->gtt_offset | PWRCTX_EN); | 4549 | if (obj_priv) { |
4612 | I915_WRITE(MCHBAR_RENDER_STANDBY, | 4550 | I915_WRITE(PWRCTXA, obj_priv->gtt_offset | PWRCTX_EN); |
4613 | I915_READ(MCHBAR_RENDER_STANDBY) & ~RCX_SW_EXIT); | 4551 | I915_WRITE(MCHBAR_RENDER_STANDBY, |
4552 | I915_READ(MCHBAR_RENDER_STANDBY) & ~RCX_SW_EXIT); | ||
4553 | } | ||
4614 | } | 4554 | } |
4615 | |||
4616 | out: | ||
4617 | return; | ||
4618 | } | 4555 | } |
4619 | 4556 | ||
4620 | /* Set up chip specific display functions */ | 4557 | /* Set up chip specific display functions */ |
@@ -4770,7 +4707,6 @@ void intel_modeset_cleanup(struct drm_device *dev) | |||
4770 | del_timer_sync(&intel_crtc->idle_timer); | 4707 | del_timer_sync(&intel_crtc->idle_timer); |
4771 | } | 4708 | } |
4772 | 4709 | ||
4773 | intel_increase_renderclock(dev, false); | ||
4774 | del_timer_sync(&dev_priv->idle_timer); | 4710 | del_timer_sync(&dev_priv->idle_timer); |
4775 | 4711 | ||
4776 | if (dev_priv->display.disable_fbc) | 4712 | if (dev_priv->display.disable_fbc) |
diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c index 4e7aa8b7b938..1349d9fd01c4 100644 --- a/drivers/gpu/drm/i915/intel_dp.c +++ b/drivers/gpu/drm/i915/intel_dp.c | |||
@@ -1402,14 +1402,20 @@ intel_dp_init(struct drm_device *dev, int output_reg) | |||
1402 | break; | 1402 | break; |
1403 | case DP_B: | 1403 | case DP_B: |
1404 | case PCH_DP_B: | 1404 | case PCH_DP_B: |
1405 | dev_priv->hotplug_supported_mask |= | ||
1406 | HDMIB_HOTPLUG_INT_STATUS; | ||
1405 | name = "DPDDC-B"; | 1407 | name = "DPDDC-B"; |
1406 | break; | 1408 | break; |
1407 | case DP_C: | 1409 | case DP_C: |
1408 | case PCH_DP_C: | 1410 | case PCH_DP_C: |
1411 | dev_priv->hotplug_supported_mask |= | ||
1412 | HDMIC_HOTPLUG_INT_STATUS; | ||
1409 | name = "DPDDC-C"; | 1413 | name = "DPDDC-C"; |
1410 | break; | 1414 | break; |
1411 | case DP_D: | 1415 | case DP_D: |
1412 | case PCH_DP_D: | 1416 | case PCH_DP_D: |
1417 | dev_priv->hotplug_supported_mask |= | ||
1418 | HDMID_HOTPLUG_INT_STATUS; | ||
1413 | name = "DPDDC-D"; | 1419 | name = "DPDDC-D"; |
1414 | break; | 1420 | break; |
1415 | } | 1421 | } |
diff --git a/drivers/gpu/drm/i915/intel_hdmi.c b/drivers/gpu/drm/i915/intel_hdmi.c index f04dbbe7d400..06431941b233 100644 --- a/drivers/gpu/drm/i915/intel_hdmi.c +++ b/drivers/gpu/drm/i915/intel_hdmi.c | |||
@@ -303,21 +303,26 @@ void intel_hdmi_init(struct drm_device *dev, int sdvox_reg) | |||
303 | if (sdvox_reg == SDVOB) { | 303 | if (sdvox_reg == SDVOB) { |
304 | intel_output->clone_mask = (1 << INTEL_HDMIB_CLONE_BIT); | 304 | intel_output->clone_mask = (1 << INTEL_HDMIB_CLONE_BIT); |
305 | intel_output->ddc_bus = intel_i2c_create(dev, GPIOE, "HDMIB"); | 305 | intel_output->ddc_bus = intel_i2c_create(dev, GPIOE, "HDMIB"); |
306 | dev_priv->hotplug_supported_mask |= HDMIB_HOTPLUG_INT_STATUS; | ||
306 | } else if (sdvox_reg == SDVOC) { | 307 | } else if (sdvox_reg == SDVOC) { |
307 | intel_output->clone_mask = (1 << INTEL_HDMIC_CLONE_BIT); | 308 | intel_output->clone_mask = (1 << INTEL_HDMIC_CLONE_BIT); |
308 | intel_output->ddc_bus = intel_i2c_create(dev, GPIOD, "HDMIC"); | 309 | intel_output->ddc_bus = intel_i2c_create(dev, GPIOD, "HDMIC"); |
310 | dev_priv->hotplug_supported_mask |= HDMIC_HOTPLUG_INT_STATUS; | ||
309 | } else if (sdvox_reg == HDMIB) { | 311 | } else if (sdvox_reg == HDMIB) { |
310 | intel_output->clone_mask = (1 << INTEL_HDMID_CLONE_BIT); | 312 | intel_output->clone_mask = (1 << INTEL_HDMID_CLONE_BIT); |
311 | intel_output->ddc_bus = intel_i2c_create(dev, PCH_GPIOE, | 313 | intel_output->ddc_bus = intel_i2c_create(dev, PCH_GPIOE, |
312 | "HDMIB"); | 314 | "HDMIB"); |
315 | dev_priv->hotplug_supported_mask |= HDMIB_HOTPLUG_INT_STATUS; | ||
313 | } else if (sdvox_reg == HDMIC) { | 316 | } else if (sdvox_reg == HDMIC) { |
314 | intel_output->clone_mask = (1 << INTEL_HDMIE_CLONE_BIT); | 317 | intel_output->clone_mask = (1 << INTEL_HDMIE_CLONE_BIT); |
315 | intel_output->ddc_bus = intel_i2c_create(dev, PCH_GPIOD, | 318 | intel_output->ddc_bus = intel_i2c_create(dev, PCH_GPIOD, |
316 | "HDMIC"); | 319 | "HDMIC"); |
320 | dev_priv->hotplug_supported_mask |= HDMIC_HOTPLUG_INT_STATUS; | ||
317 | } else if (sdvox_reg == HDMID) { | 321 | } else if (sdvox_reg == HDMID) { |
318 | intel_output->clone_mask = (1 << INTEL_HDMIF_CLONE_BIT); | 322 | intel_output->clone_mask = (1 << INTEL_HDMIF_CLONE_BIT); |
319 | intel_output->ddc_bus = intel_i2c_create(dev, PCH_GPIOF, | 323 | intel_output->ddc_bus = intel_i2c_create(dev, PCH_GPIOF, |
320 | "HDMID"); | 324 | "HDMID"); |
325 | dev_priv->hotplug_supported_mask |= HDMID_HOTPLUG_INT_STATUS; | ||
321 | } | 326 | } |
322 | if (!intel_output->ddc_bus) | 327 | if (!intel_output->ddc_bus) |
323 | goto err_connector; | 328 | goto err_connector; |
diff --git a/drivers/gpu/drm/i915/intel_lvds.c b/drivers/gpu/drm/i915/intel_lvds.c index 3118ce274e67..f4b4aa242df1 100644 --- a/drivers/gpu/drm/i915/intel_lvds.c +++ b/drivers/gpu/drm/i915/intel_lvds.c | |||
@@ -608,6 +608,13 @@ static const struct dmi_system_id bad_lid_status[] = { | |||
608 | DMI_MATCH(DMI_PRODUCT_NAME, "Aspire one"), | 608 | DMI_MATCH(DMI_PRODUCT_NAME, "Aspire one"), |
609 | }, | 609 | }, |
610 | }, | 610 | }, |
611 | { | ||
612 | .ident = "PC-81005", | ||
613 | .matches = { | ||
614 | DMI_MATCH(DMI_SYS_VENDOR, "MALATA"), | ||
615 | DMI_MATCH(DMI_PRODUCT_NAME, "PC-81005"), | ||
616 | }, | ||
617 | }, | ||
611 | { } | 618 | { } |
612 | }; | 619 | }; |
613 | 620 | ||
@@ -679,7 +686,14 @@ static int intel_lid_notify(struct notifier_block *nb, unsigned long val, | |||
679 | struct drm_i915_private *dev_priv = | 686 | struct drm_i915_private *dev_priv = |
680 | container_of(nb, struct drm_i915_private, lid_notifier); | 687 | container_of(nb, struct drm_i915_private, lid_notifier); |
681 | struct drm_device *dev = dev_priv->dev; | 688 | struct drm_device *dev = dev_priv->dev; |
689 | struct drm_connector *connector = dev_priv->int_lvds_connector; | ||
682 | 690 | ||
691 | /* | ||
692 | * check and update the status of LVDS connector after receiving | ||
693 | * the LID nofication event. | ||
694 | */ | ||
695 | if (connector) | ||
696 | connector->status = connector->funcs->detect(connector); | ||
683 | if (!acpi_lid_open()) { | 697 | if (!acpi_lid_open()) { |
684 | dev_priv->modeset_on_lid = 1; | 698 | dev_priv->modeset_on_lid = 1; |
685 | return NOTIFY_OK; | 699 | return NOTIFY_OK; |
@@ -854,65 +868,6 @@ static const struct dmi_system_id intel_no_lvds[] = { | |||
854 | { } /* terminating entry */ | 868 | { } /* terminating entry */ |
855 | }; | 869 | }; |
856 | 870 | ||
857 | #ifdef CONFIG_ACPI | ||
858 | /* | ||
859 | * check_lid_device -- check whether @handle is an ACPI LID device. | ||
860 | * @handle: ACPI device handle | ||
861 | * @level : depth in the ACPI namespace tree | ||
862 | * @context: the number of LID device when we find the device | ||
863 | * @rv: a return value to fill if desired (Not use) | ||
864 | */ | ||
865 | static acpi_status | ||
866 | check_lid_device(acpi_handle handle, u32 level, void *context, | ||
867 | void **return_value) | ||
868 | { | ||
869 | struct acpi_device *acpi_dev; | ||
870 | int *lid_present = context; | ||
871 | |||
872 | acpi_dev = NULL; | ||
873 | /* Get the acpi device for device handle */ | ||
874 | if (acpi_bus_get_device(handle, &acpi_dev) || !acpi_dev) { | ||
875 | /* If there is no ACPI device for handle, return */ | ||
876 | return AE_OK; | ||
877 | } | ||
878 | |||
879 | if (!strncmp(acpi_device_hid(acpi_dev), "PNP0C0D", 7)) | ||
880 | *lid_present = 1; | ||
881 | |||
882 | return AE_OK; | ||
883 | } | ||
884 | |||
885 | /** | ||
886 | * check whether there exists the ACPI LID device by enumerating the ACPI | ||
887 | * device tree. | ||
888 | */ | ||
889 | static int intel_lid_present(void) | ||
890 | { | ||
891 | int lid_present = 0; | ||
892 | |||
893 | if (acpi_disabled) { | ||
894 | /* If ACPI is disabled, there is no ACPI device tree to | ||
895 | * check, so assume the LID device would have been present. | ||
896 | */ | ||
897 | return 1; | ||
898 | } | ||
899 | |||
900 | acpi_walk_namespace(ACPI_TYPE_DEVICE, ACPI_ROOT_OBJECT, | ||
901 | ACPI_UINT32_MAX, | ||
902 | check_lid_device, NULL, &lid_present, NULL); | ||
903 | |||
904 | return lid_present; | ||
905 | } | ||
906 | #else | ||
907 | static int intel_lid_present(void) | ||
908 | { | ||
909 | /* In the absence of ACPI built in, assume that the LID device would | ||
910 | * have been present. | ||
911 | */ | ||
912 | return 1; | ||
913 | } | ||
914 | #endif | ||
915 | |||
916 | /** | 871 | /** |
917 | * intel_find_lvds_downclock - find the reduced downclock for LVDS in EDID | 872 | * intel_find_lvds_downclock - find the reduced downclock for LVDS in EDID |
918 | * @dev: drm device | 873 | * @dev: drm device |
@@ -1031,12 +986,8 @@ void intel_lvds_init(struct drm_device *dev) | |||
1031 | if (dmi_check_system(intel_no_lvds)) | 986 | if (dmi_check_system(intel_no_lvds)) |
1032 | return; | 987 | return; |
1033 | 988 | ||
1034 | /* | 989 | if (!lvds_is_present_in_vbt(dev)) { |
1035 | * Assume LVDS is present if there's an ACPI lid device or if the | 990 | DRM_DEBUG_KMS("LVDS is not present in VBT\n"); |
1036 | * device is present in the VBT. | ||
1037 | */ | ||
1038 | if (!lvds_is_present_in_vbt(dev) && !intel_lid_present()) { | ||
1039 | DRM_DEBUG_KMS("LVDS is not present in VBT and no lid detected\n"); | ||
1040 | return; | 991 | return; |
1041 | } | 992 | } |
1042 | 993 | ||
@@ -1180,6 +1131,8 @@ out: | |||
1180 | DRM_DEBUG_KMS("lid notifier registration failed\n"); | 1131 | DRM_DEBUG_KMS("lid notifier registration failed\n"); |
1181 | dev_priv->lid_notifier.notifier_call = NULL; | 1132 | dev_priv->lid_notifier.notifier_call = NULL; |
1182 | } | 1133 | } |
1134 | /* keep the LVDS connector */ | ||
1135 | dev_priv->int_lvds_connector = connector; | ||
1183 | drm_sysfs_connector_add(connector); | 1136 | drm_sysfs_connector_add(connector); |
1184 | return; | 1137 | return; |
1185 | 1138 | ||
diff --git a/drivers/gpu/drm/i915/intel_sdvo.c b/drivers/gpu/drm/i915/intel_sdvo.c index 24a3dc99716c..de5144c8c153 100644 --- a/drivers/gpu/drm/i915/intel_sdvo.c +++ b/drivers/gpu/drm/i915/intel_sdvo.c | |||
@@ -2662,6 +2662,7 @@ static void intel_sdvo_create_enhance_property(struct drm_connector *connector) | |||
2662 | 2662 | ||
2663 | bool intel_sdvo_init(struct drm_device *dev, int output_device) | 2663 | bool intel_sdvo_init(struct drm_device *dev, int output_device) |
2664 | { | 2664 | { |
2665 | struct drm_i915_private *dev_priv = dev->dev_private; | ||
2665 | struct drm_connector *connector; | 2666 | struct drm_connector *connector; |
2666 | struct intel_output *intel_output; | 2667 | struct intel_output *intel_output; |
2667 | struct intel_sdvo_priv *sdvo_priv; | 2668 | struct intel_sdvo_priv *sdvo_priv; |
@@ -2708,10 +2709,12 @@ bool intel_sdvo_init(struct drm_device *dev, int output_device) | |||
2708 | intel_output->ddc_bus = intel_i2c_create(dev, GPIOE, "SDVOB DDC BUS"); | 2709 | intel_output->ddc_bus = intel_i2c_create(dev, GPIOE, "SDVOB DDC BUS"); |
2709 | sdvo_priv->analog_ddc_bus = intel_i2c_create(dev, GPIOA, | 2710 | sdvo_priv->analog_ddc_bus = intel_i2c_create(dev, GPIOA, |
2710 | "SDVOB/VGA DDC BUS"); | 2711 | "SDVOB/VGA DDC BUS"); |
2712 | dev_priv->hotplug_supported_mask |= SDVOB_HOTPLUG_INT_STATUS; | ||
2711 | } else { | 2713 | } else { |
2712 | intel_output->ddc_bus = intel_i2c_create(dev, GPIOE, "SDVOC DDC BUS"); | 2714 | intel_output->ddc_bus = intel_i2c_create(dev, GPIOE, "SDVOC DDC BUS"); |
2713 | sdvo_priv->analog_ddc_bus = intel_i2c_create(dev, GPIOA, | 2715 | sdvo_priv->analog_ddc_bus = intel_i2c_create(dev, GPIOA, |
2714 | "SDVOC/VGA DDC BUS"); | 2716 | "SDVOC/VGA DDC BUS"); |
2717 | dev_priv->hotplug_supported_mask |= SDVOC_HOTPLUG_INT_STATUS; | ||
2715 | } | 2718 | } |
2716 | 2719 | ||
2717 | if (intel_output->ddc_bus == NULL) | 2720 | if (intel_output->ddc_bus == NULL) |
diff --git a/drivers/gpu/drm/i915/intel_tv.c b/drivers/gpu/drm/i915/intel_tv.c index 552ec110b741..1d5b9b7b033f 100644 --- a/drivers/gpu/drm/i915/intel_tv.c +++ b/drivers/gpu/drm/i915/intel_tv.c | |||
@@ -1840,6 +1840,8 @@ intel_tv_init(struct drm_device *dev) | |||
1840 | drm_connector_attach_property(connector, | 1840 | drm_connector_attach_property(connector, |
1841 | dev->mode_config.tv_bottom_margin_property, | 1841 | dev->mode_config.tv_bottom_margin_property, |
1842 | tv_priv->margin[TV_MARGIN_BOTTOM]); | 1842 | tv_priv->margin[TV_MARGIN_BOTTOM]); |
1843 | |||
1844 | dev_priv->hotplug_supported_mask |= TV_HOTPLUG_INT_STATUS; | ||
1843 | out: | 1845 | out: |
1844 | drm_sysfs_connector_add(connector); | 1846 | drm_sysfs_connector_add(connector); |
1845 | } | 1847 | } |
diff --git a/drivers/gpu/drm/mga/mga_drv.c b/drivers/gpu/drm/mga/mga_drv.c index 97ee566ef749..ddfe16197b59 100644 --- a/drivers/gpu/drm/mga/mga_drv.c +++ b/drivers/gpu/drm/mga/mga_drv.c | |||
@@ -68,7 +68,7 @@ static struct drm_driver driver = { | |||
68 | .owner = THIS_MODULE, | 68 | .owner = THIS_MODULE, |
69 | .open = drm_open, | 69 | .open = drm_open, |
70 | .release = drm_release, | 70 | .release = drm_release, |
71 | .ioctl = drm_ioctl, | 71 | .unlocked_ioctl = drm_ioctl, |
72 | .mmap = drm_mmap, | 72 | .mmap = drm_mmap, |
73 | .poll = drm_poll, | 73 | .poll = drm_poll, |
74 | .fasync = drm_fasync, | 74 | .fasync = drm_fasync, |
diff --git a/drivers/gpu/drm/mga/mga_ioc32.c b/drivers/gpu/drm/mga/mga_ioc32.c index 30d00478ddee..c1f877b7bac1 100644 --- a/drivers/gpu/drm/mga/mga_ioc32.c +++ b/drivers/gpu/drm/mga/mga_ioc32.c | |||
@@ -100,8 +100,7 @@ static int compat_mga_init(struct file *file, unsigned int cmd, | |||
100 | if (err) | 100 | if (err) |
101 | return -EFAULT; | 101 | return -EFAULT; |
102 | 102 | ||
103 | return drm_ioctl(file->f_path.dentry->d_inode, file, | 103 | return drm_ioctl(file, DRM_IOCTL_MGA_INIT, (unsigned long)init); |
104 | DRM_IOCTL_MGA_INIT, (unsigned long)init); | ||
105 | } | 104 | } |
106 | 105 | ||
107 | typedef struct drm_mga_getparam32 { | 106 | typedef struct drm_mga_getparam32 { |
@@ -125,8 +124,7 @@ static int compat_mga_getparam(struct file *file, unsigned int cmd, | |||
125 | &getparam->value)) | 124 | &getparam->value)) |
126 | return -EFAULT; | 125 | return -EFAULT; |
127 | 126 | ||
128 | return drm_ioctl(file->f_path.dentry->d_inode, file, | 127 | return drm_ioctl(file, DRM_IOCTL_MGA_GETPARAM, (unsigned long)getparam); |
129 | DRM_IOCTL_MGA_GETPARAM, (unsigned long)getparam); | ||
130 | } | 128 | } |
131 | 129 | ||
132 | typedef struct drm_mga_drm_bootstrap32 { | 130 | typedef struct drm_mga_drm_bootstrap32 { |
@@ -166,8 +164,7 @@ static int compat_mga_dma_bootstrap(struct file *file, unsigned int cmd, | |||
166 | || __put_user(dma_bootstrap32.agp_size, &dma_bootstrap->agp_size)) | 164 | || __put_user(dma_bootstrap32.agp_size, &dma_bootstrap->agp_size)) |
167 | return -EFAULT; | 165 | return -EFAULT; |
168 | 166 | ||
169 | err = drm_ioctl(file->f_path.dentry->d_inode, file, | 167 | err = drm_ioctl(file, DRM_IOCTL_MGA_DMA_BOOTSTRAP, |
170 | DRM_IOCTL_MGA_DMA_BOOTSTRAP, | ||
171 | (unsigned long)dma_bootstrap); | 168 | (unsigned long)dma_bootstrap); |
172 | if (err) | 169 | if (err) |
173 | return err; | 170 | return err; |
@@ -220,12 +217,10 @@ long mga_compat_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) | |||
220 | if (nr < DRM_COMMAND_BASE + DRM_ARRAY_SIZE(mga_compat_ioctls)) | 217 | if (nr < DRM_COMMAND_BASE + DRM_ARRAY_SIZE(mga_compat_ioctls)) |
221 | fn = mga_compat_ioctls[nr - DRM_COMMAND_BASE]; | 218 | fn = mga_compat_ioctls[nr - DRM_COMMAND_BASE]; |
222 | 219 | ||
223 | lock_kernel(); /* XXX for now */ | ||
224 | if (fn != NULL) | 220 | if (fn != NULL) |
225 | ret = (*fn) (filp, cmd, arg); | 221 | ret = (*fn) (filp, cmd, arg); |
226 | else | 222 | else |
227 | ret = drm_ioctl(filp->f_path.dentry->d_inode, filp, cmd, arg); | 223 | ret = drm_ioctl(filp, cmd, arg); |
228 | unlock_kernel(); | ||
229 | 224 | ||
230 | return ret; | 225 | return ret; |
231 | } | 226 | } |
diff --git a/drivers/gpu/drm/nouveau/Kconfig b/drivers/gpu/drm/nouveau/Kconfig index b1bc1ea182b8..1175429da102 100644 --- a/drivers/gpu/drm/nouveau/Kconfig +++ b/drivers/gpu/drm/nouveau/Kconfig | |||
@@ -30,12 +30,11 @@ config DRM_NOUVEAU_DEBUG | |||
30 | via debugfs. | 30 | via debugfs. |
31 | 31 | ||
32 | menu "I2C encoder or helper chips" | 32 | menu "I2C encoder or helper chips" |
33 | depends on DRM && I2C | 33 | depends on DRM && DRM_KMS_HELPER && I2C |
34 | 34 | ||
35 | config DRM_I2C_CH7006 | 35 | config DRM_I2C_CH7006 |
36 | tristate "Chrontel ch7006 TV encoder" | 36 | tristate "Chrontel ch7006 TV encoder" |
37 | depends on DRM_NOUVEAU | 37 | default m if DRM_NOUVEAU |
38 | default m | ||
39 | help | 38 | help |
40 | Support for Chrontel ch7006 and similar TV encoders, found | 39 | Support for Chrontel ch7006 and similar TV encoders, found |
41 | on some nVidia video cards. | 40 | on some nVidia video cards. |
diff --git a/drivers/gpu/drm/nouveau/Makefile b/drivers/gpu/drm/nouveau/Makefile index 1d90d4d0144f..48c290b5da8c 100644 --- a/drivers/gpu/drm/nouveau/Makefile +++ b/drivers/gpu/drm/nouveau/Makefile | |||
@@ -8,14 +8,15 @@ nouveau-y := nouveau_drv.o nouveau_state.o nouveau_channel.o nouveau_mem.o \ | |||
8 | nouveau_sgdma.o nouveau_dma.o \ | 8 | nouveau_sgdma.o nouveau_dma.o \ |
9 | nouveau_bo.o nouveau_fence.o nouveau_gem.o nouveau_ttm.o \ | 9 | nouveau_bo.o nouveau_fence.o nouveau_gem.o nouveau_ttm.o \ |
10 | nouveau_hw.o nouveau_calc.o nouveau_bios.o nouveau_i2c.o \ | 10 | nouveau_hw.o nouveau_calc.o nouveau_bios.o nouveau_i2c.o \ |
11 | nouveau_display.o nouveau_connector.o nouveau_fbcon.o \ | 11 | nouveau_display.o nouveau_connector.o nouveau_fbcon.o \ |
12 | nouveau_dp.o \ | 12 | nouveau_dp.o nouveau_grctx.o \ |
13 | nv04_timer.o \ | 13 | nv04_timer.o \ |
14 | nv04_mc.o nv40_mc.o nv50_mc.o \ | 14 | nv04_mc.o nv40_mc.o nv50_mc.o \ |
15 | nv04_fb.o nv10_fb.o nv40_fb.o \ | 15 | nv04_fb.o nv10_fb.o nv40_fb.o \ |
16 | nv04_fifo.o nv10_fifo.o nv40_fifo.o nv50_fifo.o \ | 16 | nv04_fifo.o nv10_fifo.o nv40_fifo.o nv50_fifo.o \ |
17 | nv04_graph.o nv10_graph.o nv20_graph.o \ | 17 | nv04_graph.o nv10_graph.o nv20_graph.o \ |
18 | nv40_graph.o nv50_graph.o \ | 18 | nv40_graph.o nv50_graph.o \ |
19 | nv40_grctx.o \ | ||
19 | nv04_instmem.o nv50_instmem.o \ | 20 | nv04_instmem.o nv50_instmem.o \ |
20 | nv50_crtc.o nv50_dac.o nv50_sor.o \ | 21 | nv50_crtc.o nv50_dac.o nv50_sor.o \ |
21 | nv50_cursor.o nv50_display.o nv50_fbcon.o \ | 22 | nv50_cursor.o nv50_display.o nv50_fbcon.o \ |
diff --git a/drivers/gpu/drm/nouveau/nouveau_bios.c b/drivers/gpu/drm/nouveau/nouveau_bios.c index 5eec5ed69489..ba143972769f 100644 --- a/drivers/gpu/drm/nouveau/nouveau_bios.c +++ b/drivers/gpu/drm/nouveau/nouveau_bios.c | |||
@@ -181,43 +181,42 @@ struct methods { | |||
181 | const char desc[8]; | 181 | const char desc[8]; |
182 | void (*loadbios)(struct drm_device *, uint8_t *); | 182 | void (*loadbios)(struct drm_device *, uint8_t *); |
183 | const bool rw; | 183 | const bool rw; |
184 | int score; | ||
185 | }; | 184 | }; |
186 | 185 | ||
187 | static struct methods nv04_methods[] = { | 186 | static struct methods nv04_methods[] = { |
188 | { "PROM", load_vbios_prom, false }, | 187 | { "PROM", load_vbios_prom, false }, |
189 | { "PRAMIN", load_vbios_pramin, true }, | 188 | { "PRAMIN", load_vbios_pramin, true }, |
190 | { "PCIROM", load_vbios_pci, true }, | 189 | { "PCIROM", load_vbios_pci, true }, |
191 | { } | ||
192 | }; | 190 | }; |
193 | 191 | ||
194 | static struct methods nv50_methods[] = { | 192 | static struct methods nv50_methods[] = { |
195 | { "PRAMIN", load_vbios_pramin, true }, | 193 | { "PRAMIN", load_vbios_pramin, true }, |
196 | { "PROM", load_vbios_prom, false }, | 194 | { "PROM", load_vbios_prom, false }, |
197 | { "PCIROM", load_vbios_pci, true }, | 195 | { "PCIROM", load_vbios_pci, true }, |
198 | { } | ||
199 | }; | 196 | }; |
200 | 197 | ||
198 | #define METHODCNT 3 | ||
199 | |||
201 | static bool NVShadowVBIOS(struct drm_device *dev, uint8_t *data) | 200 | static bool NVShadowVBIOS(struct drm_device *dev, uint8_t *data) |
202 | { | 201 | { |
203 | struct drm_nouveau_private *dev_priv = dev->dev_private; | 202 | struct drm_nouveau_private *dev_priv = dev->dev_private; |
204 | struct methods *methods, *method; | 203 | struct methods *methods; |
204 | int i; | ||
205 | int testscore = 3; | 205 | int testscore = 3; |
206 | int scores[METHODCNT]; | ||
206 | 207 | ||
207 | if (nouveau_vbios) { | 208 | if (nouveau_vbios) { |
208 | method = nv04_methods; | 209 | methods = nv04_methods; |
209 | while (method->loadbios) { | 210 | for (i = 0; i < METHODCNT; i++) |
210 | if (!strcasecmp(nouveau_vbios, method->desc)) | 211 | if (!strcasecmp(nouveau_vbios, methods[i].desc)) |
211 | break; | 212 | break; |
212 | method++; | ||
213 | } | ||
214 | 213 | ||
215 | if (method->loadbios) { | 214 | if (i < METHODCNT) { |
216 | NV_INFO(dev, "Attempting to use BIOS image from %s\n", | 215 | NV_INFO(dev, "Attempting to use BIOS image from %s\n", |
217 | method->desc); | 216 | methods[i].desc); |
218 | 217 | ||
219 | method->loadbios(dev, data); | 218 | methods[i].loadbios(dev, data); |
220 | if (score_vbios(dev, data, method->rw)) | 219 | if (score_vbios(dev, data, methods[i].rw)) |
221 | return true; | 220 | return true; |
222 | } | 221 | } |
223 | 222 | ||
@@ -229,28 +228,24 @@ static bool NVShadowVBIOS(struct drm_device *dev, uint8_t *data) | |||
229 | else | 228 | else |
230 | methods = nv50_methods; | 229 | methods = nv50_methods; |
231 | 230 | ||
232 | method = methods; | 231 | for (i = 0; i < METHODCNT; i++) { |
233 | while (method->loadbios) { | ||
234 | NV_TRACE(dev, "Attempting to load BIOS image from %s\n", | 232 | NV_TRACE(dev, "Attempting to load BIOS image from %s\n", |
235 | method->desc); | 233 | methods[i].desc); |
236 | data[0] = data[1] = 0; /* avoid reuse of previous image */ | 234 | data[0] = data[1] = 0; /* avoid reuse of previous image */ |
237 | method->loadbios(dev, data); | 235 | methods[i].loadbios(dev, data); |
238 | method->score = score_vbios(dev, data, method->rw); | 236 | scores[i] = score_vbios(dev, data, methods[i].rw); |
239 | if (method->score == testscore) | 237 | if (scores[i] == testscore) |
240 | return true; | 238 | return true; |
241 | method++; | ||
242 | } | 239 | } |
243 | 240 | ||
244 | while (--testscore > 0) { | 241 | while (--testscore > 0) { |
245 | method = methods; | 242 | for (i = 0; i < METHODCNT; i++) { |
246 | while (method->loadbios) { | 243 | if (scores[i] == testscore) { |
247 | if (method->score == testscore) { | ||
248 | NV_TRACE(dev, "Using BIOS image from %s\n", | 244 | NV_TRACE(dev, "Using BIOS image from %s\n", |
249 | method->desc); | 245 | methods[i].desc); |
250 | method->loadbios(dev, data); | 246 | methods[i].loadbios(dev, data); |
251 | return true; | 247 | return true; |
252 | } | 248 | } |
253 | method++; | ||
254 | } | 249 | } |
255 | } | 250 | } |
256 | 251 | ||
@@ -261,10 +256,7 @@ static bool NVShadowVBIOS(struct drm_device *dev, uint8_t *data) | |||
261 | struct init_tbl_entry { | 256 | struct init_tbl_entry { |
262 | char *name; | 257 | char *name; |
263 | uint8_t id; | 258 | uint8_t id; |
264 | int length; | 259 | int (*handler)(struct nvbios *, uint16_t, struct init_exec *); |
265 | int length_offset; | ||
266 | int length_multiplier; | ||
267 | bool (*handler)(struct nvbios *, uint16_t, struct init_exec *); | ||
268 | }; | 260 | }; |
269 | 261 | ||
270 | struct bit_entry { | 262 | struct bit_entry { |
@@ -820,7 +812,7 @@ static uint32_t get_tmds_index_reg(struct drm_device *dev, uint8_t mlv) | |||
820 | } | 812 | } |
821 | } | 813 | } |
822 | 814 | ||
823 | static bool | 815 | static int |
824 | init_io_restrict_prog(struct nvbios *bios, uint16_t offset, | 816 | init_io_restrict_prog(struct nvbios *bios, uint16_t offset, |
825 | struct init_exec *iexec) | 817 | struct init_exec *iexec) |
826 | { | 818 | { |
@@ -852,9 +844,10 @@ init_io_restrict_prog(struct nvbios *bios, uint16_t offset, | |||
852 | uint32_t reg = ROM32(bios->data[offset + 7]); | 844 | uint32_t reg = ROM32(bios->data[offset + 7]); |
853 | uint8_t config; | 845 | uint8_t config; |
854 | uint32_t configval; | 846 | uint32_t configval; |
847 | int len = 11 + count * 4; | ||
855 | 848 | ||
856 | if (!iexec->execute) | 849 | if (!iexec->execute) |
857 | return true; | 850 | return len; |
858 | 851 | ||
859 | BIOSLOG(bios, "0x%04X: Port: 0x%04X, Index: 0x%02X, Mask: 0x%02X, " | 852 | BIOSLOG(bios, "0x%04X: Port: 0x%04X, Index: 0x%02X, Mask: 0x%02X, " |
860 | "Shift: 0x%02X, Count: 0x%02X, Reg: 0x%08X\n", | 853 | "Shift: 0x%02X, Count: 0x%02X, Reg: 0x%08X\n", |
@@ -865,7 +858,7 @@ init_io_restrict_prog(struct nvbios *bios, uint16_t offset, | |||
865 | NV_ERROR(bios->dev, | 858 | NV_ERROR(bios->dev, |
866 | "0x%04X: Config 0x%02X exceeds maximal bound 0x%02X\n", | 859 | "0x%04X: Config 0x%02X exceeds maximal bound 0x%02X\n", |
867 | offset, config, count); | 860 | offset, config, count); |
868 | return false; | 861 | return 0; |
869 | } | 862 | } |
870 | 863 | ||
871 | configval = ROM32(bios->data[offset + 11 + config * 4]); | 864 | configval = ROM32(bios->data[offset + 11 + config * 4]); |
@@ -874,10 +867,10 @@ init_io_restrict_prog(struct nvbios *bios, uint16_t offset, | |||
874 | 867 | ||
875 | bios_wr32(bios, reg, configval); | 868 | bios_wr32(bios, reg, configval); |
876 | 869 | ||
877 | return true; | 870 | return len; |
878 | } | 871 | } |
879 | 872 | ||
880 | static bool | 873 | static int |
881 | init_repeat(struct nvbios *bios, uint16_t offset, struct init_exec *iexec) | 874 | init_repeat(struct nvbios *bios, uint16_t offset, struct init_exec *iexec) |
882 | { | 875 | { |
883 | /* | 876 | /* |
@@ -912,10 +905,10 @@ init_repeat(struct nvbios *bios, uint16_t offset, struct init_exec *iexec) | |||
912 | 905 | ||
913 | iexec->repeat = false; | 906 | iexec->repeat = false; |
914 | 907 | ||
915 | return true; | 908 | return 2; |
916 | } | 909 | } |
917 | 910 | ||
918 | static bool | 911 | static int |
919 | init_io_restrict_pll(struct nvbios *bios, uint16_t offset, | 912 | init_io_restrict_pll(struct nvbios *bios, uint16_t offset, |
920 | struct init_exec *iexec) | 913 | struct init_exec *iexec) |
921 | { | 914 | { |
@@ -951,9 +944,10 @@ init_io_restrict_pll(struct nvbios *bios, uint16_t offset, | |||
951 | uint32_t reg = ROM32(bios->data[offset + 8]); | 944 | uint32_t reg = ROM32(bios->data[offset + 8]); |
952 | uint8_t config; | 945 | uint8_t config; |
953 | uint16_t freq; | 946 | uint16_t freq; |
947 | int len = 12 + count * 2; | ||
954 | 948 | ||
955 | if (!iexec->execute) | 949 | if (!iexec->execute) |
956 | return true; | 950 | return len; |
957 | 951 | ||
958 | BIOSLOG(bios, "0x%04X: Port: 0x%04X, Index: 0x%02X, Mask: 0x%02X, " | 952 | BIOSLOG(bios, "0x%04X: Port: 0x%04X, Index: 0x%02X, Mask: 0x%02X, " |
959 | "Shift: 0x%02X, IO Flag Condition: 0x%02X, " | 953 | "Shift: 0x%02X, IO Flag Condition: 0x%02X, " |
@@ -966,7 +960,7 @@ init_io_restrict_pll(struct nvbios *bios, uint16_t offset, | |||
966 | NV_ERROR(bios->dev, | 960 | NV_ERROR(bios->dev, |
967 | "0x%04X: Config 0x%02X exceeds maximal bound 0x%02X\n", | 961 | "0x%04X: Config 0x%02X exceeds maximal bound 0x%02X\n", |
968 | offset, config, count); | 962 | offset, config, count); |
969 | return false; | 963 | return 0; |
970 | } | 964 | } |
971 | 965 | ||
972 | freq = ROM16(bios->data[offset + 12 + config * 2]); | 966 | freq = ROM16(bios->data[offset + 12 + config * 2]); |
@@ -986,10 +980,10 @@ init_io_restrict_pll(struct nvbios *bios, uint16_t offset, | |||
986 | 980 | ||
987 | setPLL(bios, reg, freq * 10); | 981 | setPLL(bios, reg, freq * 10); |
988 | 982 | ||
989 | return true; | 983 | return len; |
990 | } | 984 | } |
991 | 985 | ||
992 | static bool | 986 | static int |
993 | init_end_repeat(struct nvbios *bios, uint16_t offset, struct init_exec *iexec) | 987 | init_end_repeat(struct nvbios *bios, uint16_t offset, struct init_exec *iexec) |
994 | { | 988 | { |
995 | /* | 989 | /* |
@@ -1007,12 +1001,12 @@ init_end_repeat(struct nvbios *bios, uint16_t offset, struct init_exec *iexec) | |||
1007 | * we're not in repeat mode | 1001 | * we're not in repeat mode |
1008 | */ | 1002 | */ |
1009 | if (iexec->repeat) | 1003 | if (iexec->repeat) |
1010 | return false; | 1004 | return 0; |
1011 | 1005 | ||
1012 | return true; | 1006 | return 1; |
1013 | } | 1007 | } |
1014 | 1008 | ||
1015 | static bool | 1009 | static int |
1016 | init_copy(struct nvbios *bios, uint16_t offset, struct init_exec *iexec) | 1010 | init_copy(struct nvbios *bios, uint16_t offset, struct init_exec *iexec) |
1017 | { | 1011 | { |
1018 | /* | 1012 | /* |
@@ -1041,7 +1035,7 @@ init_copy(struct nvbios *bios, uint16_t offset, struct init_exec *iexec) | |||
1041 | uint8_t crtcdata; | 1035 | uint8_t crtcdata; |
1042 | 1036 | ||
1043 | if (!iexec->execute) | 1037 | if (!iexec->execute) |
1044 | return true; | 1038 | return 11; |
1045 | 1039 | ||
1046 | BIOSLOG(bios, "0x%04X: Reg: 0x%08X, Shift: 0x%02X, SrcMask: 0x%02X, " | 1040 | BIOSLOG(bios, "0x%04X: Reg: 0x%08X, Shift: 0x%02X, SrcMask: 0x%02X, " |
1047 | "Port: 0x%04X, Index: 0x%02X, Mask: 0x%02X\n", | 1041 | "Port: 0x%04X, Index: 0x%02X, Mask: 0x%02X\n", |
@@ -1060,10 +1054,10 @@ init_copy(struct nvbios *bios, uint16_t offset, struct init_exec *iexec) | |||
1060 | crtcdata |= (uint8_t)data; | 1054 | crtcdata |= (uint8_t)data; |
1061 | bios_idxprt_wr(bios, crtcport, crtcindex, crtcdata); | 1055 | bios_idxprt_wr(bios, crtcport, crtcindex, crtcdata); |
1062 | 1056 | ||
1063 | return true; | 1057 | return 11; |
1064 | } | 1058 | } |
1065 | 1059 | ||
1066 | static bool | 1060 | static int |
1067 | init_not(struct nvbios *bios, uint16_t offset, struct init_exec *iexec) | 1061 | init_not(struct nvbios *bios, uint16_t offset, struct init_exec *iexec) |
1068 | { | 1062 | { |
1069 | /* | 1063 | /* |
@@ -1079,10 +1073,10 @@ init_not(struct nvbios *bios, uint16_t offset, struct init_exec *iexec) | |||
1079 | BIOSLOG(bios, "0x%04X: ------ Executing following commands ------\n", offset); | 1073 | BIOSLOG(bios, "0x%04X: ------ Executing following commands ------\n", offset); |
1080 | 1074 | ||
1081 | iexec->execute = !iexec->execute; | 1075 | iexec->execute = !iexec->execute; |
1082 | return true; | 1076 | return 1; |
1083 | } | 1077 | } |
1084 | 1078 | ||
1085 | static bool | 1079 | static int |
1086 | init_io_flag_condition(struct nvbios *bios, uint16_t offset, | 1080 | init_io_flag_condition(struct nvbios *bios, uint16_t offset, |
1087 | struct init_exec *iexec) | 1081 | struct init_exec *iexec) |
1088 | { | 1082 | { |
@@ -1100,7 +1094,7 @@ init_io_flag_condition(struct nvbios *bios, uint16_t offset, | |||
1100 | uint8_t cond = bios->data[offset + 1]; | 1094 | uint8_t cond = bios->data[offset + 1]; |
1101 | 1095 | ||
1102 | if (!iexec->execute) | 1096 | if (!iexec->execute) |
1103 | return true; | 1097 | return 2; |
1104 | 1098 | ||
1105 | if (io_flag_condition_met(bios, offset, cond)) | 1099 | if (io_flag_condition_met(bios, offset, cond)) |
1106 | BIOSLOG(bios, "0x%04X: Condition fulfilled -- continuing to execute\n", offset); | 1100 | BIOSLOG(bios, "0x%04X: Condition fulfilled -- continuing to execute\n", offset); |
@@ -1109,10 +1103,10 @@ init_io_flag_condition(struct nvbios *bios, uint16_t offset, | |||
1109 | iexec->execute = false; | 1103 | iexec->execute = false; |
1110 | } | 1104 | } |
1111 | 1105 | ||
1112 | return true; | 1106 | return 2; |
1113 | } | 1107 | } |
1114 | 1108 | ||
1115 | static bool | 1109 | static int |
1116 | init_idx_addr_latched(struct nvbios *bios, uint16_t offset, | 1110 | init_idx_addr_latched(struct nvbios *bios, uint16_t offset, |
1117 | struct init_exec *iexec) | 1111 | struct init_exec *iexec) |
1118 | { | 1112 | { |
@@ -1140,11 +1134,12 @@ init_idx_addr_latched(struct nvbios *bios, uint16_t offset, | |||
1140 | uint32_t mask = ROM32(bios->data[offset + 9]); | 1134 | uint32_t mask = ROM32(bios->data[offset + 9]); |
1141 | uint32_t data = ROM32(bios->data[offset + 13]); | 1135 | uint32_t data = ROM32(bios->data[offset + 13]); |
1142 | uint8_t count = bios->data[offset + 17]; | 1136 | uint8_t count = bios->data[offset + 17]; |
1137 | int len = 18 + count * 2; | ||
1143 | uint32_t value; | 1138 | uint32_t value; |
1144 | int i; | 1139 | int i; |
1145 | 1140 | ||
1146 | if (!iexec->execute) | 1141 | if (!iexec->execute) |
1147 | return true; | 1142 | return len; |
1148 | 1143 | ||
1149 | BIOSLOG(bios, "0x%04X: ControlReg: 0x%08X, DataReg: 0x%08X, " | 1144 | BIOSLOG(bios, "0x%04X: ControlReg: 0x%08X, DataReg: 0x%08X, " |
1150 | "Mask: 0x%08X, Data: 0x%08X, Count: 0x%02X\n", | 1145 | "Mask: 0x%08X, Data: 0x%08X, Count: 0x%02X\n", |
@@ -1164,10 +1159,10 @@ init_idx_addr_latched(struct nvbios *bios, uint16_t offset, | |||
1164 | bios_wr32(bios, controlreg, value); | 1159 | bios_wr32(bios, controlreg, value); |
1165 | } | 1160 | } |
1166 | 1161 | ||
1167 | return true; | 1162 | return len; |
1168 | } | 1163 | } |
1169 | 1164 | ||
1170 | static bool | 1165 | static int |
1171 | init_io_restrict_pll2(struct nvbios *bios, uint16_t offset, | 1166 | init_io_restrict_pll2(struct nvbios *bios, uint16_t offset, |
1172 | struct init_exec *iexec) | 1167 | struct init_exec *iexec) |
1173 | { | 1168 | { |
@@ -1196,25 +1191,26 @@ init_io_restrict_pll2(struct nvbios *bios, uint16_t offset, | |||
1196 | uint8_t shift = bios->data[offset + 5]; | 1191 | uint8_t shift = bios->data[offset + 5]; |
1197 | uint8_t count = bios->data[offset + 6]; | 1192 | uint8_t count = bios->data[offset + 6]; |
1198 | uint32_t reg = ROM32(bios->data[offset + 7]); | 1193 | uint32_t reg = ROM32(bios->data[offset + 7]); |
1194 | int len = 11 + count * 4; | ||
1199 | uint8_t config; | 1195 | uint8_t config; |
1200 | uint32_t freq; | 1196 | uint32_t freq; |
1201 | 1197 | ||
1202 | if (!iexec->execute) | 1198 | if (!iexec->execute) |
1203 | return true; | 1199 | return len; |
1204 | 1200 | ||
1205 | BIOSLOG(bios, "0x%04X: Port: 0x%04X, Index: 0x%02X, Mask: 0x%02X, " | 1201 | BIOSLOG(bios, "0x%04X: Port: 0x%04X, Index: 0x%02X, Mask: 0x%02X, " |
1206 | "Shift: 0x%02X, Count: 0x%02X, Reg: 0x%08X\n", | 1202 | "Shift: 0x%02X, Count: 0x%02X, Reg: 0x%08X\n", |
1207 | offset, crtcport, crtcindex, mask, shift, count, reg); | 1203 | offset, crtcport, crtcindex, mask, shift, count, reg); |
1208 | 1204 | ||
1209 | if (!reg) | 1205 | if (!reg) |
1210 | return true; | 1206 | return len; |
1211 | 1207 | ||
1212 | config = (bios_idxprt_rd(bios, crtcport, crtcindex) & mask) >> shift; | 1208 | config = (bios_idxprt_rd(bios, crtcport, crtcindex) & mask) >> shift; |
1213 | if (config > count) { | 1209 | if (config > count) { |
1214 | NV_ERROR(bios->dev, | 1210 | NV_ERROR(bios->dev, |
1215 | "0x%04X: Config 0x%02X exceeds maximal bound 0x%02X\n", | 1211 | "0x%04X: Config 0x%02X exceeds maximal bound 0x%02X\n", |
1216 | offset, config, count); | 1212 | offset, config, count); |
1217 | return false; | 1213 | return 0; |
1218 | } | 1214 | } |
1219 | 1215 | ||
1220 | freq = ROM32(bios->data[offset + 11 + config * 4]); | 1216 | freq = ROM32(bios->data[offset + 11 + config * 4]); |
@@ -1224,10 +1220,10 @@ init_io_restrict_pll2(struct nvbios *bios, uint16_t offset, | |||
1224 | 1220 | ||
1225 | setPLL(bios, reg, freq); | 1221 | setPLL(bios, reg, freq); |
1226 | 1222 | ||
1227 | return true; | 1223 | return len; |
1228 | } | 1224 | } |
1229 | 1225 | ||
1230 | static bool | 1226 | static int |
1231 | init_pll2(struct nvbios *bios, uint16_t offset, struct init_exec *iexec) | 1227 | init_pll2(struct nvbios *bios, uint16_t offset, struct init_exec *iexec) |
1232 | { | 1228 | { |
1233 | /* | 1229 | /* |
@@ -1244,16 +1240,16 @@ init_pll2(struct nvbios *bios, uint16_t offset, struct init_exec *iexec) | |||
1244 | uint32_t freq = ROM32(bios->data[offset + 5]); | 1240 | uint32_t freq = ROM32(bios->data[offset + 5]); |
1245 | 1241 | ||
1246 | if (!iexec->execute) | 1242 | if (!iexec->execute) |
1247 | return true; | 1243 | return 9; |
1248 | 1244 | ||
1249 | BIOSLOG(bios, "0x%04X: Reg: 0x%04X, Freq: %dkHz\n", | 1245 | BIOSLOG(bios, "0x%04X: Reg: 0x%04X, Freq: %dkHz\n", |
1250 | offset, reg, freq); | 1246 | offset, reg, freq); |
1251 | 1247 | ||
1252 | setPLL(bios, reg, freq); | 1248 | setPLL(bios, reg, freq); |
1253 | return true; | 1249 | return 9; |
1254 | } | 1250 | } |
1255 | 1251 | ||
1256 | static bool | 1252 | static int |
1257 | init_i2c_byte(struct nvbios *bios, uint16_t offset, struct init_exec *iexec) | 1253 | init_i2c_byte(struct nvbios *bios, uint16_t offset, struct init_exec *iexec) |
1258 | { | 1254 | { |
1259 | /* | 1255 | /* |
@@ -1277,12 +1273,13 @@ init_i2c_byte(struct nvbios *bios, uint16_t offset, struct init_exec *iexec) | |||
1277 | uint8_t i2c_index = bios->data[offset + 1]; | 1273 | uint8_t i2c_index = bios->data[offset + 1]; |
1278 | uint8_t i2c_address = bios->data[offset + 2]; | 1274 | uint8_t i2c_address = bios->data[offset + 2]; |
1279 | uint8_t count = bios->data[offset + 3]; | 1275 | uint8_t count = bios->data[offset + 3]; |
1276 | int len = 4 + count * 3; | ||
1280 | struct nouveau_i2c_chan *chan; | 1277 | struct nouveau_i2c_chan *chan; |
1281 | struct i2c_msg msg; | 1278 | struct i2c_msg msg; |
1282 | int i; | 1279 | int i; |
1283 | 1280 | ||
1284 | if (!iexec->execute) | 1281 | if (!iexec->execute) |
1285 | return true; | 1282 | return len; |
1286 | 1283 | ||
1287 | BIOSLOG(bios, "0x%04X: DCBI2CIndex: 0x%02X, I2CAddress: 0x%02X, " | 1284 | BIOSLOG(bios, "0x%04X: DCBI2CIndex: 0x%02X, I2CAddress: 0x%02X, " |
1288 | "Count: 0x%02X\n", | 1285 | "Count: 0x%02X\n", |
@@ -1290,7 +1287,7 @@ init_i2c_byte(struct nvbios *bios, uint16_t offset, struct init_exec *iexec) | |||
1290 | 1287 | ||
1291 | chan = init_i2c_device_find(bios->dev, i2c_index); | 1288 | chan = init_i2c_device_find(bios->dev, i2c_index); |
1292 | if (!chan) | 1289 | if (!chan) |
1293 | return false; | 1290 | return 0; |
1294 | 1291 | ||
1295 | for (i = 0; i < count; i++) { | 1292 | for (i = 0; i < count; i++) { |
1296 | uint8_t i2c_reg = bios->data[offset + 4 + i * 3]; | 1293 | uint8_t i2c_reg = bios->data[offset + 4 + i * 3]; |
@@ -1303,7 +1300,7 @@ init_i2c_byte(struct nvbios *bios, uint16_t offset, struct init_exec *iexec) | |||
1303 | msg.len = 1; | 1300 | msg.len = 1; |
1304 | msg.buf = &value; | 1301 | msg.buf = &value; |
1305 | if (i2c_transfer(&chan->adapter, &msg, 1) != 1) | 1302 | if (i2c_transfer(&chan->adapter, &msg, 1) != 1) |
1306 | return false; | 1303 | return 0; |
1307 | 1304 | ||
1308 | BIOSLOG(bios, "0x%04X: I2CReg: 0x%02X, Value: 0x%02X, " | 1305 | BIOSLOG(bios, "0x%04X: I2CReg: 0x%02X, Value: 0x%02X, " |
1309 | "Mask: 0x%02X, Data: 0x%02X\n", | 1306 | "Mask: 0x%02X, Data: 0x%02X\n", |
@@ -1317,14 +1314,14 @@ init_i2c_byte(struct nvbios *bios, uint16_t offset, struct init_exec *iexec) | |||
1317 | msg.len = 1; | 1314 | msg.len = 1; |
1318 | msg.buf = &value; | 1315 | msg.buf = &value; |
1319 | if (i2c_transfer(&chan->adapter, &msg, 1) != 1) | 1316 | if (i2c_transfer(&chan->adapter, &msg, 1) != 1) |
1320 | return false; | 1317 | return 0; |
1321 | } | 1318 | } |
1322 | } | 1319 | } |
1323 | 1320 | ||
1324 | return true; | 1321 | return len; |
1325 | } | 1322 | } |
1326 | 1323 | ||
1327 | static bool | 1324 | static int |
1328 | init_zm_i2c_byte(struct nvbios *bios, uint16_t offset, struct init_exec *iexec) | 1325 | init_zm_i2c_byte(struct nvbios *bios, uint16_t offset, struct init_exec *iexec) |
1329 | { | 1326 | { |
1330 | /* | 1327 | /* |
@@ -1346,12 +1343,13 @@ init_zm_i2c_byte(struct nvbios *bios, uint16_t offset, struct init_exec *iexec) | |||
1346 | uint8_t i2c_index = bios->data[offset + 1]; | 1343 | uint8_t i2c_index = bios->data[offset + 1]; |
1347 | uint8_t i2c_address = bios->data[offset + 2]; | 1344 | uint8_t i2c_address = bios->data[offset + 2]; |
1348 | uint8_t count = bios->data[offset + 3]; | 1345 | uint8_t count = bios->data[offset + 3]; |
1346 | int len = 4 + count * 2; | ||
1349 | struct nouveau_i2c_chan *chan; | 1347 | struct nouveau_i2c_chan *chan; |
1350 | struct i2c_msg msg; | 1348 | struct i2c_msg msg; |
1351 | int i; | 1349 | int i; |
1352 | 1350 | ||
1353 | if (!iexec->execute) | 1351 | if (!iexec->execute) |
1354 | return true; | 1352 | return len; |
1355 | 1353 | ||
1356 | BIOSLOG(bios, "0x%04X: DCBI2CIndex: 0x%02X, I2CAddress: 0x%02X, " | 1354 | BIOSLOG(bios, "0x%04X: DCBI2CIndex: 0x%02X, I2CAddress: 0x%02X, " |
1357 | "Count: 0x%02X\n", | 1355 | "Count: 0x%02X\n", |
@@ -1359,7 +1357,7 @@ init_zm_i2c_byte(struct nvbios *bios, uint16_t offset, struct init_exec *iexec) | |||
1359 | 1357 | ||
1360 | chan = init_i2c_device_find(bios->dev, i2c_index); | 1358 | chan = init_i2c_device_find(bios->dev, i2c_index); |
1361 | if (!chan) | 1359 | if (!chan) |
1362 | return false; | 1360 | return 0; |
1363 | 1361 | ||
1364 | for (i = 0; i < count; i++) { | 1362 | for (i = 0; i < count; i++) { |
1365 | uint8_t i2c_reg = bios->data[offset + 4 + i * 2]; | 1363 | uint8_t i2c_reg = bios->data[offset + 4 + i * 2]; |
@@ -1374,14 +1372,14 @@ init_zm_i2c_byte(struct nvbios *bios, uint16_t offset, struct init_exec *iexec) | |||
1374 | msg.len = 1; | 1372 | msg.len = 1; |
1375 | msg.buf = &data; | 1373 | msg.buf = &data; |
1376 | if (i2c_transfer(&chan->adapter, &msg, 1) != 1) | 1374 | if (i2c_transfer(&chan->adapter, &msg, 1) != 1) |
1377 | return false; | 1375 | return 0; |
1378 | } | 1376 | } |
1379 | } | 1377 | } |
1380 | 1378 | ||
1381 | return true; | 1379 | return len; |
1382 | } | 1380 | } |
1383 | 1381 | ||
1384 | static bool | 1382 | static int |
1385 | init_zm_i2c(struct nvbios *bios, uint16_t offset, struct init_exec *iexec) | 1383 | init_zm_i2c(struct nvbios *bios, uint16_t offset, struct init_exec *iexec) |
1386 | { | 1384 | { |
1387 | /* | 1385 | /* |
@@ -1401,13 +1399,14 @@ init_zm_i2c(struct nvbios *bios, uint16_t offset, struct init_exec *iexec) | |||
1401 | uint8_t i2c_index = bios->data[offset + 1]; | 1399 | uint8_t i2c_index = bios->data[offset + 1]; |
1402 | uint8_t i2c_address = bios->data[offset + 2]; | 1400 | uint8_t i2c_address = bios->data[offset + 2]; |
1403 | uint8_t count = bios->data[offset + 3]; | 1401 | uint8_t count = bios->data[offset + 3]; |
1402 | int len = 4 + count; | ||
1404 | struct nouveau_i2c_chan *chan; | 1403 | struct nouveau_i2c_chan *chan; |
1405 | struct i2c_msg msg; | 1404 | struct i2c_msg msg; |
1406 | uint8_t data[256]; | 1405 | uint8_t data[256]; |
1407 | int i; | 1406 | int i; |
1408 | 1407 | ||
1409 | if (!iexec->execute) | 1408 | if (!iexec->execute) |
1410 | return true; | 1409 | return len; |
1411 | 1410 | ||
1412 | BIOSLOG(bios, "0x%04X: DCBI2CIndex: 0x%02X, I2CAddress: 0x%02X, " | 1411 | BIOSLOG(bios, "0x%04X: DCBI2CIndex: 0x%02X, I2CAddress: 0x%02X, " |
1413 | "Count: 0x%02X\n", | 1412 | "Count: 0x%02X\n", |
@@ -1415,7 +1414,7 @@ init_zm_i2c(struct nvbios *bios, uint16_t offset, struct init_exec *iexec) | |||
1415 | 1414 | ||
1416 | chan = init_i2c_device_find(bios->dev, i2c_index); | 1415 | chan = init_i2c_device_find(bios->dev, i2c_index); |
1417 | if (!chan) | 1416 | if (!chan) |
1418 | return false; | 1417 | return 0; |
1419 | 1418 | ||
1420 | for (i = 0; i < count; i++) { | 1419 | for (i = 0; i < count; i++) { |
1421 | data[i] = bios->data[offset + 4 + i]; | 1420 | data[i] = bios->data[offset + 4 + i]; |
@@ -1429,13 +1428,13 @@ init_zm_i2c(struct nvbios *bios, uint16_t offset, struct init_exec *iexec) | |||
1429 | msg.len = count; | 1428 | msg.len = count; |
1430 | msg.buf = data; | 1429 | msg.buf = data; |
1431 | if (i2c_transfer(&chan->adapter, &msg, 1) != 1) | 1430 | if (i2c_transfer(&chan->adapter, &msg, 1) != 1) |
1432 | return false; | 1431 | return 0; |
1433 | } | 1432 | } |
1434 | 1433 | ||
1435 | return true; | 1434 | return len; |
1436 | } | 1435 | } |
1437 | 1436 | ||
1438 | static bool | 1437 | static int |
1439 | init_tmds(struct nvbios *bios, uint16_t offset, struct init_exec *iexec) | 1438 | init_tmds(struct nvbios *bios, uint16_t offset, struct init_exec *iexec) |
1440 | { | 1439 | { |
1441 | /* | 1440 | /* |
@@ -1460,7 +1459,7 @@ init_tmds(struct nvbios *bios, uint16_t offset, struct init_exec *iexec) | |||
1460 | uint32_t reg, value; | 1459 | uint32_t reg, value; |
1461 | 1460 | ||
1462 | if (!iexec->execute) | 1461 | if (!iexec->execute) |
1463 | return true; | 1462 | return 5; |
1464 | 1463 | ||
1465 | BIOSLOG(bios, "0x%04X: MagicLookupValue: 0x%02X, TMDSAddr: 0x%02X, " | 1464 | BIOSLOG(bios, "0x%04X: MagicLookupValue: 0x%02X, TMDSAddr: 0x%02X, " |
1466 | "Mask: 0x%02X, Data: 0x%02X\n", | 1465 | "Mask: 0x%02X, Data: 0x%02X\n", |
@@ -1468,7 +1467,7 @@ init_tmds(struct nvbios *bios, uint16_t offset, struct init_exec *iexec) | |||
1468 | 1467 | ||
1469 | reg = get_tmds_index_reg(bios->dev, mlv); | 1468 | reg = get_tmds_index_reg(bios->dev, mlv); |
1470 | if (!reg) | 1469 | if (!reg) |
1471 | return false; | 1470 | return 0; |
1472 | 1471 | ||
1473 | bios_wr32(bios, reg, | 1472 | bios_wr32(bios, reg, |
1474 | tmdsaddr | NV_PRAMDAC_FP_TMDS_CONTROL_WRITE_DISABLE); | 1473 | tmdsaddr | NV_PRAMDAC_FP_TMDS_CONTROL_WRITE_DISABLE); |
@@ -1476,10 +1475,10 @@ init_tmds(struct nvbios *bios, uint16_t offset, struct init_exec *iexec) | |||
1476 | bios_wr32(bios, reg + 4, value); | 1475 | bios_wr32(bios, reg + 4, value); |
1477 | bios_wr32(bios, reg, tmdsaddr); | 1476 | bios_wr32(bios, reg, tmdsaddr); |
1478 | 1477 | ||
1479 | return true; | 1478 | return 5; |
1480 | } | 1479 | } |
1481 | 1480 | ||
1482 | static bool | 1481 | static int |
1483 | init_zm_tmds_group(struct nvbios *bios, uint16_t offset, | 1482 | init_zm_tmds_group(struct nvbios *bios, uint16_t offset, |
1484 | struct init_exec *iexec) | 1483 | struct init_exec *iexec) |
1485 | { | 1484 | { |
@@ -1500,18 +1499,19 @@ init_zm_tmds_group(struct nvbios *bios, uint16_t offset, | |||
1500 | 1499 | ||
1501 | uint8_t mlv = bios->data[offset + 1]; | 1500 | uint8_t mlv = bios->data[offset + 1]; |
1502 | uint8_t count = bios->data[offset + 2]; | 1501 | uint8_t count = bios->data[offset + 2]; |
1502 | int len = 3 + count * 2; | ||
1503 | uint32_t reg; | 1503 | uint32_t reg; |
1504 | int i; | 1504 | int i; |
1505 | 1505 | ||
1506 | if (!iexec->execute) | 1506 | if (!iexec->execute) |
1507 | return true; | 1507 | return len; |
1508 | 1508 | ||
1509 | BIOSLOG(bios, "0x%04X: MagicLookupValue: 0x%02X, Count: 0x%02X\n", | 1509 | BIOSLOG(bios, "0x%04X: MagicLookupValue: 0x%02X, Count: 0x%02X\n", |
1510 | offset, mlv, count); | 1510 | offset, mlv, count); |
1511 | 1511 | ||
1512 | reg = get_tmds_index_reg(bios->dev, mlv); | 1512 | reg = get_tmds_index_reg(bios->dev, mlv); |
1513 | if (!reg) | 1513 | if (!reg) |
1514 | return false; | 1514 | return 0; |
1515 | 1515 | ||
1516 | for (i = 0; i < count; i++) { | 1516 | for (i = 0; i < count; i++) { |
1517 | uint8_t tmdsaddr = bios->data[offset + 3 + i * 2]; | 1517 | uint8_t tmdsaddr = bios->data[offset + 3 + i * 2]; |
@@ -1521,10 +1521,10 @@ init_zm_tmds_group(struct nvbios *bios, uint16_t offset, | |||
1521 | bios_wr32(bios, reg, tmdsaddr); | 1521 | bios_wr32(bios, reg, tmdsaddr); |
1522 | } | 1522 | } |
1523 | 1523 | ||
1524 | return true; | 1524 | return len; |
1525 | } | 1525 | } |
1526 | 1526 | ||
1527 | static bool | 1527 | static int |
1528 | init_cr_idx_adr_latch(struct nvbios *bios, uint16_t offset, | 1528 | init_cr_idx_adr_latch(struct nvbios *bios, uint16_t offset, |
1529 | struct init_exec *iexec) | 1529 | struct init_exec *iexec) |
1530 | { | 1530 | { |
@@ -1547,11 +1547,12 @@ init_cr_idx_adr_latch(struct nvbios *bios, uint16_t offset, | |||
1547 | uint8_t crtcindex2 = bios->data[offset + 2]; | 1547 | uint8_t crtcindex2 = bios->data[offset + 2]; |
1548 | uint8_t baseaddr = bios->data[offset + 3]; | 1548 | uint8_t baseaddr = bios->data[offset + 3]; |
1549 | uint8_t count = bios->data[offset + 4]; | 1549 | uint8_t count = bios->data[offset + 4]; |
1550 | int len = 5 + count; | ||
1550 | uint8_t oldaddr, data; | 1551 | uint8_t oldaddr, data; |
1551 | int i; | 1552 | int i; |
1552 | 1553 | ||
1553 | if (!iexec->execute) | 1554 | if (!iexec->execute) |
1554 | return true; | 1555 | return len; |
1555 | 1556 | ||
1556 | BIOSLOG(bios, "0x%04X: Index1: 0x%02X, Index2: 0x%02X, " | 1557 | BIOSLOG(bios, "0x%04X: Index1: 0x%02X, Index2: 0x%02X, " |
1557 | "BaseAddr: 0x%02X, Count: 0x%02X\n", | 1558 | "BaseAddr: 0x%02X, Count: 0x%02X\n", |
@@ -1568,10 +1569,10 @@ init_cr_idx_adr_latch(struct nvbios *bios, uint16_t offset, | |||
1568 | 1569 | ||
1569 | bios_idxprt_wr(bios, NV_CIO_CRX__COLOR, crtcindex1, oldaddr); | 1570 | bios_idxprt_wr(bios, NV_CIO_CRX__COLOR, crtcindex1, oldaddr); |
1570 | 1571 | ||
1571 | return true; | 1572 | return len; |
1572 | } | 1573 | } |
1573 | 1574 | ||
1574 | static bool | 1575 | static int |
1575 | init_cr(struct nvbios *bios, uint16_t offset, struct init_exec *iexec) | 1576 | init_cr(struct nvbios *bios, uint16_t offset, struct init_exec *iexec) |
1576 | { | 1577 | { |
1577 | /* | 1578 | /* |
@@ -1592,7 +1593,7 @@ init_cr(struct nvbios *bios, uint16_t offset, struct init_exec *iexec) | |||
1592 | uint8_t value; | 1593 | uint8_t value; |
1593 | 1594 | ||
1594 | if (!iexec->execute) | 1595 | if (!iexec->execute) |
1595 | return true; | 1596 | return 4; |
1596 | 1597 | ||
1597 | BIOSLOG(bios, "0x%04X: Index: 0x%02X, Mask: 0x%02X, Data: 0x%02X\n", | 1598 | BIOSLOG(bios, "0x%04X: Index: 0x%02X, Mask: 0x%02X, Data: 0x%02X\n", |
1598 | offset, crtcindex, mask, data); | 1599 | offset, crtcindex, mask, data); |
@@ -1601,10 +1602,10 @@ init_cr(struct nvbios *bios, uint16_t offset, struct init_exec *iexec) | |||
1601 | value |= data; | 1602 | value |= data; |
1602 | bios_idxprt_wr(bios, NV_CIO_CRX__COLOR, crtcindex, value); | 1603 | bios_idxprt_wr(bios, NV_CIO_CRX__COLOR, crtcindex, value); |
1603 | 1604 | ||
1604 | return true; | 1605 | return 4; |
1605 | } | 1606 | } |
1606 | 1607 | ||
1607 | static bool | 1608 | static int |
1608 | init_zm_cr(struct nvbios *bios, uint16_t offset, struct init_exec *iexec) | 1609 | init_zm_cr(struct nvbios *bios, uint16_t offset, struct init_exec *iexec) |
1609 | { | 1610 | { |
1610 | /* | 1611 | /* |
@@ -1621,14 +1622,14 @@ init_zm_cr(struct nvbios *bios, uint16_t offset, struct init_exec *iexec) | |||
1621 | uint8_t data = bios->data[offset + 2]; | 1622 | uint8_t data = bios->data[offset + 2]; |
1622 | 1623 | ||
1623 | if (!iexec->execute) | 1624 | if (!iexec->execute) |
1624 | return true; | 1625 | return 3; |
1625 | 1626 | ||
1626 | bios_idxprt_wr(bios, NV_CIO_CRX__COLOR, crtcindex, data); | 1627 | bios_idxprt_wr(bios, NV_CIO_CRX__COLOR, crtcindex, data); |
1627 | 1628 | ||
1628 | return true; | 1629 | return 3; |
1629 | } | 1630 | } |
1630 | 1631 | ||
1631 | static bool | 1632 | static int |
1632 | init_zm_cr_group(struct nvbios *bios, uint16_t offset, struct init_exec *iexec) | 1633 | init_zm_cr_group(struct nvbios *bios, uint16_t offset, struct init_exec *iexec) |
1633 | { | 1634 | { |
1634 | /* | 1635 | /* |
@@ -1645,18 +1646,19 @@ init_zm_cr_group(struct nvbios *bios, uint16_t offset, struct init_exec *iexec) | |||
1645 | */ | 1646 | */ |
1646 | 1647 | ||
1647 | uint8_t count = bios->data[offset + 1]; | 1648 | uint8_t count = bios->data[offset + 1]; |
1649 | int len = 2 + count * 2; | ||
1648 | int i; | 1650 | int i; |
1649 | 1651 | ||
1650 | if (!iexec->execute) | 1652 | if (!iexec->execute) |
1651 | return true; | 1653 | return len; |
1652 | 1654 | ||
1653 | for (i = 0; i < count; i++) | 1655 | for (i = 0; i < count; i++) |
1654 | init_zm_cr(bios, offset + 2 + 2 * i - 1, iexec); | 1656 | init_zm_cr(bios, offset + 2 + 2 * i - 1, iexec); |
1655 | 1657 | ||
1656 | return true; | 1658 | return len; |
1657 | } | 1659 | } |
1658 | 1660 | ||
1659 | static bool | 1661 | static int |
1660 | init_condition_time(struct nvbios *bios, uint16_t offset, | 1662 | init_condition_time(struct nvbios *bios, uint16_t offset, |
1661 | struct init_exec *iexec) | 1663 | struct init_exec *iexec) |
1662 | { | 1664 | { |
@@ -1680,7 +1682,7 @@ init_condition_time(struct nvbios *bios, uint16_t offset, | |||
1680 | unsigned cnt; | 1682 | unsigned cnt; |
1681 | 1683 | ||
1682 | if (!iexec->execute) | 1684 | if (!iexec->execute) |
1683 | return true; | 1685 | return 3; |
1684 | 1686 | ||
1685 | if (retries > 100) | 1687 | if (retries > 100) |
1686 | retries = 100; | 1688 | retries = 100; |
@@ -1711,10 +1713,10 @@ init_condition_time(struct nvbios *bios, uint16_t offset, | |||
1711 | iexec->execute = false; | 1713 | iexec->execute = false; |
1712 | } | 1714 | } |
1713 | 1715 | ||
1714 | return true; | 1716 | return 3; |
1715 | } | 1717 | } |
1716 | 1718 | ||
1717 | static bool | 1719 | static int |
1718 | init_zm_reg_sequence(struct nvbios *bios, uint16_t offset, | 1720 | init_zm_reg_sequence(struct nvbios *bios, uint16_t offset, |
1719 | struct init_exec *iexec) | 1721 | struct init_exec *iexec) |
1720 | { | 1722 | { |
@@ -1734,10 +1736,11 @@ init_zm_reg_sequence(struct nvbios *bios, uint16_t offset, | |||
1734 | 1736 | ||
1735 | uint32_t basereg = ROM32(bios->data[offset + 1]); | 1737 | uint32_t basereg = ROM32(bios->data[offset + 1]); |
1736 | uint32_t count = bios->data[offset + 5]; | 1738 | uint32_t count = bios->data[offset + 5]; |
1739 | int len = 6 + count * 4; | ||
1737 | int i; | 1740 | int i; |
1738 | 1741 | ||
1739 | if (!iexec->execute) | 1742 | if (!iexec->execute) |
1740 | return true; | 1743 | return len; |
1741 | 1744 | ||
1742 | BIOSLOG(bios, "0x%04X: BaseReg: 0x%08X, Count: 0x%02X\n", | 1745 | BIOSLOG(bios, "0x%04X: BaseReg: 0x%08X, Count: 0x%02X\n", |
1743 | offset, basereg, count); | 1746 | offset, basereg, count); |
@@ -1749,10 +1752,10 @@ init_zm_reg_sequence(struct nvbios *bios, uint16_t offset, | |||
1749 | bios_wr32(bios, reg, data); | 1752 | bios_wr32(bios, reg, data); |
1750 | } | 1753 | } |
1751 | 1754 | ||
1752 | return true; | 1755 | return len; |
1753 | } | 1756 | } |
1754 | 1757 | ||
1755 | static bool | 1758 | static int |
1756 | init_sub_direct(struct nvbios *bios, uint16_t offset, struct init_exec *iexec) | 1759 | init_sub_direct(struct nvbios *bios, uint16_t offset, struct init_exec *iexec) |
1757 | { | 1760 | { |
1758 | /* | 1761 | /* |
@@ -1768,7 +1771,7 @@ init_sub_direct(struct nvbios *bios, uint16_t offset, struct init_exec *iexec) | |||
1768 | uint16_t sub_offset = ROM16(bios->data[offset + 1]); | 1771 | uint16_t sub_offset = ROM16(bios->data[offset + 1]); |
1769 | 1772 | ||
1770 | if (!iexec->execute) | 1773 | if (!iexec->execute) |
1771 | return true; | 1774 | return 3; |
1772 | 1775 | ||
1773 | BIOSLOG(bios, "0x%04X: Executing subroutine at 0x%04X\n", | 1776 | BIOSLOG(bios, "0x%04X: Executing subroutine at 0x%04X\n", |
1774 | offset, sub_offset); | 1777 | offset, sub_offset); |
@@ -1777,10 +1780,10 @@ init_sub_direct(struct nvbios *bios, uint16_t offset, struct init_exec *iexec) | |||
1777 | 1780 | ||
1778 | BIOSLOG(bios, "0x%04X: End of 0x%04X subroutine\n", offset, sub_offset); | 1781 | BIOSLOG(bios, "0x%04X: End of 0x%04X subroutine\n", offset, sub_offset); |
1779 | 1782 | ||
1780 | return true; | 1783 | return 3; |
1781 | } | 1784 | } |
1782 | 1785 | ||
1783 | static bool | 1786 | static int |
1784 | init_copy_nv_reg(struct nvbios *bios, uint16_t offset, struct init_exec *iexec) | 1787 | init_copy_nv_reg(struct nvbios *bios, uint16_t offset, struct init_exec *iexec) |
1785 | { | 1788 | { |
1786 | /* | 1789 | /* |
@@ -1808,7 +1811,7 @@ init_copy_nv_reg(struct nvbios *bios, uint16_t offset, struct init_exec *iexec) | |||
1808 | uint32_t srcvalue, dstvalue; | 1811 | uint32_t srcvalue, dstvalue; |
1809 | 1812 | ||
1810 | if (!iexec->execute) | 1813 | if (!iexec->execute) |
1811 | return true; | 1814 | return 22; |
1812 | 1815 | ||
1813 | BIOSLOG(bios, "0x%04X: SrcReg: 0x%08X, Shift: 0x%02X, SrcMask: 0x%08X, " | 1816 | BIOSLOG(bios, "0x%04X: SrcReg: 0x%08X, Shift: 0x%02X, SrcMask: 0x%08X, " |
1814 | "Xor: 0x%08X, DstReg: 0x%08X, DstMask: 0x%08X\n", | 1817 | "Xor: 0x%08X, DstReg: 0x%08X, DstMask: 0x%08X\n", |
@@ -1827,10 +1830,10 @@ init_copy_nv_reg(struct nvbios *bios, uint16_t offset, struct init_exec *iexec) | |||
1827 | 1830 | ||
1828 | bios_wr32(bios, dstreg, dstvalue | srcvalue); | 1831 | bios_wr32(bios, dstreg, dstvalue | srcvalue); |
1829 | 1832 | ||
1830 | return true; | 1833 | return 22; |
1831 | } | 1834 | } |
1832 | 1835 | ||
1833 | static bool | 1836 | static int |
1834 | init_zm_index_io(struct nvbios *bios, uint16_t offset, struct init_exec *iexec) | 1837 | init_zm_index_io(struct nvbios *bios, uint16_t offset, struct init_exec *iexec) |
1835 | { | 1838 | { |
1836 | /* | 1839 | /* |
@@ -1848,14 +1851,14 @@ init_zm_index_io(struct nvbios *bios, uint16_t offset, struct init_exec *iexec) | |||
1848 | uint8_t data = bios->data[offset + 4]; | 1851 | uint8_t data = bios->data[offset + 4]; |
1849 | 1852 | ||
1850 | if (!iexec->execute) | 1853 | if (!iexec->execute) |
1851 | return true; | 1854 | return 5; |
1852 | 1855 | ||
1853 | bios_idxprt_wr(bios, crtcport, crtcindex, data); | 1856 | bios_idxprt_wr(bios, crtcport, crtcindex, data); |
1854 | 1857 | ||
1855 | return true; | 1858 | return 5; |
1856 | } | 1859 | } |
1857 | 1860 | ||
1858 | static bool | 1861 | static int |
1859 | init_compute_mem(struct nvbios *bios, uint16_t offset, struct init_exec *iexec) | 1862 | init_compute_mem(struct nvbios *bios, uint16_t offset, struct init_exec *iexec) |
1860 | { | 1863 | { |
1861 | /* | 1864 | /* |
@@ -1904,7 +1907,7 @@ init_compute_mem(struct nvbios *bios, uint16_t offset, struct init_exec *iexec) | |||
1904 | struct drm_nouveau_private *dev_priv = bios->dev->dev_private; | 1907 | struct drm_nouveau_private *dev_priv = bios->dev->dev_private; |
1905 | 1908 | ||
1906 | if (dev_priv->card_type >= NV_50) | 1909 | if (dev_priv->card_type >= NV_50) |
1907 | return true; | 1910 | return 1; |
1908 | 1911 | ||
1909 | /* | 1912 | /* |
1910 | * On every card I've seen, this step gets done for us earlier in | 1913 | * On every card I've seen, this step gets done for us earlier in |
@@ -1922,10 +1925,10 @@ init_compute_mem(struct nvbios *bios, uint16_t offset, struct init_exec *iexec) | |||
1922 | /* write back the saved configuration value */ | 1925 | /* write back the saved configuration value */ |
1923 | bios_wr32(bios, NV_PFB_CFG0, bios->state.saved_nv_pfb_cfg0); | 1926 | bios_wr32(bios, NV_PFB_CFG0, bios->state.saved_nv_pfb_cfg0); |
1924 | 1927 | ||
1925 | return true; | 1928 | return 1; |
1926 | } | 1929 | } |
1927 | 1930 | ||
1928 | static bool | 1931 | static int |
1929 | init_reset(struct nvbios *bios, uint16_t offset, struct init_exec *iexec) | 1932 | init_reset(struct nvbios *bios, uint16_t offset, struct init_exec *iexec) |
1930 | { | 1933 | { |
1931 | /* | 1934 | /* |
@@ -1959,10 +1962,10 @@ init_reset(struct nvbios *bios, uint16_t offset, struct init_exec *iexec) | |||
1959 | pci_nv_20 &= ~NV_PBUS_PCI_NV_20_ROM_SHADOW_ENABLED; /* 0xfffffffe */ | 1962 | pci_nv_20 &= ~NV_PBUS_PCI_NV_20_ROM_SHADOW_ENABLED; /* 0xfffffffe */ |
1960 | bios_wr32(bios, NV_PBUS_PCI_NV_20, pci_nv_20); | 1963 | bios_wr32(bios, NV_PBUS_PCI_NV_20, pci_nv_20); |
1961 | 1964 | ||
1962 | return true; | 1965 | return 13; |
1963 | } | 1966 | } |
1964 | 1967 | ||
1965 | static bool | 1968 | static int |
1966 | init_configure_mem(struct nvbios *bios, uint16_t offset, | 1969 | init_configure_mem(struct nvbios *bios, uint16_t offset, |
1967 | struct init_exec *iexec) | 1970 | struct init_exec *iexec) |
1968 | { | 1971 | { |
@@ -1983,7 +1986,7 @@ init_configure_mem(struct nvbios *bios, uint16_t offset, | |||
1983 | uint32_t reg, data; | 1986 | uint32_t reg, data; |
1984 | 1987 | ||
1985 | if (bios->major_version > 2) | 1988 | if (bios->major_version > 2) |
1986 | return false; | 1989 | return 0; |
1987 | 1990 | ||
1988 | bios_idxprt_wr(bios, NV_VIO_SRX, NV_VIO_SR_CLOCK_INDEX, bios_idxprt_rd( | 1991 | bios_idxprt_wr(bios, NV_VIO_SRX, NV_VIO_SR_CLOCK_INDEX, bios_idxprt_rd( |
1989 | bios, NV_VIO_SRX, NV_VIO_SR_CLOCK_INDEX) | 0x20); | 1992 | bios, NV_VIO_SRX, NV_VIO_SR_CLOCK_INDEX) | 0x20); |
@@ -2015,10 +2018,10 @@ init_configure_mem(struct nvbios *bios, uint16_t offset, | |||
2015 | bios_wr32(bios, reg, data); | 2018 | bios_wr32(bios, reg, data); |
2016 | } | 2019 | } |
2017 | 2020 | ||
2018 | return true; | 2021 | return 1; |
2019 | } | 2022 | } |
2020 | 2023 | ||
2021 | static bool | 2024 | static int |
2022 | init_configure_clk(struct nvbios *bios, uint16_t offset, | 2025 | init_configure_clk(struct nvbios *bios, uint16_t offset, |
2023 | struct init_exec *iexec) | 2026 | struct init_exec *iexec) |
2024 | { | 2027 | { |
@@ -2038,7 +2041,7 @@ init_configure_clk(struct nvbios *bios, uint16_t offset, | |||
2038 | int clock; | 2041 | int clock; |
2039 | 2042 | ||
2040 | if (bios->major_version > 2) | 2043 | if (bios->major_version > 2) |
2041 | return false; | 2044 | return 0; |
2042 | 2045 | ||
2043 | clock = ROM16(bios->data[meminitoffs + 4]) * 10; | 2046 | clock = ROM16(bios->data[meminitoffs + 4]) * 10; |
2044 | setPLL(bios, NV_PRAMDAC_NVPLL_COEFF, clock); | 2047 | setPLL(bios, NV_PRAMDAC_NVPLL_COEFF, clock); |
@@ -2048,10 +2051,10 @@ init_configure_clk(struct nvbios *bios, uint16_t offset, | |||
2048 | clock *= 2; | 2051 | clock *= 2; |
2049 | setPLL(bios, NV_PRAMDAC_MPLL_COEFF, clock); | 2052 | setPLL(bios, NV_PRAMDAC_MPLL_COEFF, clock); |
2050 | 2053 | ||
2051 | return true; | 2054 | return 1; |
2052 | } | 2055 | } |
2053 | 2056 | ||
2054 | static bool | 2057 | static int |
2055 | init_configure_preinit(struct nvbios *bios, uint16_t offset, | 2058 | init_configure_preinit(struct nvbios *bios, uint16_t offset, |
2056 | struct init_exec *iexec) | 2059 | struct init_exec *iexec) |
2057 | { | 2060 | { |
@@ -2071,15 +2074,15 @@ init_configure_preinit(struct nvbios *bios, uint16_t offset, | |||
2071 | uint8_t cr3c = ((straps << 2) & 0xf0) | (straps & (1 << 6)); | 2074 | uint8_t cr3c = ((straps << 2) & 0xf0) | (straps & (1 << 6)); |
2072 | 2075 | ||
2073 | if (bios->major_version > 2) | 2076 | if (bios->major_version > 2) |
2074 | return false; | 2077 | return 0; |
2075 | 2078 | ||
2076 | bios_idxprt_wr(bios, NV_CIO_CRX__COLOR, | 2079 | bios_idxprt_wr(bios, NV_CIO_CRX__COLOR, |
2077 | NV_CIO_CRE_SCRATCH4__INDEX, cr3c); | 2080 | NV_CIO_CRE_SCRATCH4__INDEX, cr3c); |
2078 | 2081 | ||
2079 | return true; | 2082 | return 1; |
2080 | } | 2083 | } |
2081 | 2084 | ||
2082 | static bool | 2085 | static int |
2083 | init_io(struct nvbios *bios, uint16_t offset, struct init_exec *iexec) | 2086 | init_io(struct nvbios *bios, uint16_t offset, struct init_exec *iexec) |
2084 | { | 2087 | { |
2085 | /* | 2088 | /* |
@@ -2099,7 +2102,7 @@ init_io(struct nvbios *bios, uint16_t offset, struct init_exec *iexec) | |||
2099 | uint8_t data = bios->data[offset + 4]; | 2102 | uint8_t data = bios->data[offset + 4]; |
2100 | 2103 | ||
2101 | if (!iexec->execute) | 2104 | if (!iexec->execute) |
2102 | return true; | 2105 | return 5; |
2103 | 2106 | ||
2104 | BIOSLOG(bios, "0x%04X: Port: 0x%04X, Mask: 0x%02X, Data: 0x%02X\n", | 2107 | BIOSLOG(bios, "0x%04X: Port: 0x%04X, Mask: 0x%02X, Data: 0x%02X\n", |
2105 | offset, crtcport, mask, data); | 2108 | offset, crtcport, mask, data); |
@@ -2158,15 +2161,15 @@ init_io(struct nvbios *bios, uint16_t offset, struct init_exec *iexec) | |||
2158 | for (i = 0; i < 2; i++) | 2161 | for (i = 0; i < 2; i++) |
2159 | bios_wr32(bios, 0x614108 + (i*0x800), bios_rd32( | 2162 | bios_wr32(bios, 0x614108 + (i*0x800), bios_rd32( |
2160 | bios, 0x614108 + (i*0x800)) & 0x0fffffff); | 2163 | bios, 0x614108 + (i*0x800)) & 0x0fffffff); |
2161 | return true; | 2164 | return 5; |
2162 | } | 2165 | } |
2163 | 2166 | ||
2164 | bios_port_wr(bios, crtcport, (bios_port_rd(bios, crtcport) & mask) | | 2167 | bios_port_wr(bios, crtcport, (bios_port_rd(bios, crtcport) & mask) | |
2165 | data); | 2168 | data); |
2166 | return true; | 2169 | return 5; |
2167 | } | 2170 | } |
2168 | 2171 | ||
2169 | static bool | 2172 | static int |
2170 | init_sub(struct nvbios *bios, uint16_t offset, struct init_exec *iexec) | 2173 | init_sub(struct nvbios *bios, uint16_t offset, struct init_exec *iexec) |
2171 | { | 2174 | { |
2172 | /* | 2175 | /* |
@@ -2181,7 +2184,7 @@ init_sub(struct nvbios *bios, uint16_t offset, struct init_exec *iexec) | |||
2181 | uint8_t sub = bios->data[offset + 1]; | 2184 | uint8_t sub = bios->data[offset + 1]; |
2182 | 2185 | ||
2183 | if (!iexec->execute) | 2186 | if (!iexec->execute) |
2184 | return true; | 2187 | return 2; |
2185 | 2188 | ||
2186 | BIOSLOG(bios, "0x%04X: Calling script %d\n", offset, sub); | 2189 | BIOSLOG(bios, "0x%04X: Calling script %d\n", offset, sub); |
2187 | 2190 | ||
@@ -2191,10 +2194,10 @@ init_sub(struct nvbios *bios, uint16_t offset, struct init_exec *iexec) | |||
2191 | 2194 | ||
2192 | BIOSLOG(bios, "0x%04X: End of script %d\n", offset, sub); | 2195 | BIOSLOG(bios, "0x%04X: End of script %d\n", offset, sub); |
2193 | 2196 | ||
2194 | return true; | 2197 | return 2; |
2195 | } | 2198 | } |
2196 | 2199 | ||
2197 | static bool | 2200 | static int |
2198 | init_ram_condition(struct nvbios *bios, uint16_t offset, | 2201 | init_ram_condition(struct nvbios *bios, uint16_t offset, |
2199 | struct init_exec *iexec) | 2202 | struct init_exec *iexec) |
2200 | { | 2203 | { |
@@ -2215,7 +2218,7 @@ init_ram_condition(struct nvbios *bios, uint16_t offset, | |||
2215 | uint8_t data; | 2218 | uint8_t data; |
2216 | 2219 | ||
2217 | if (!iexec->execute) | 2220 | if (!iexec->execute) |
2218 | return true; | 2221 | return 3; |
2219 | 2222 | ||
2220 | data = bios_rd32(bios, NV_PFB_BOOT_0) & mask; | 2223 | data = bios_rd32(bios, NV_PFB_BOOT_0) & mask; |
2221 | 2224 | ||
@@ -2229,10 +2232,10 @@ init_ram_condition(struct nvbios *bios, uint16_t offset, | |||
2229 | iexec->execute = false; | 2232 | iexec->execute = false; |
2230 | } | 2233 | } |
2231 | 2234 | ||
2232 | return true; | 2235 | return 3; |
2233 | } | 2236 | } |
2234 | 2237 | ||
2235 | static bool | 2238 | static int |
2236 | init_nv_reg(struct nvbios *bios, uint16_t offset, struct init_exec *iexec) | 2239 | init_nv_reg(struct nvbios *bios, uint16_t offset, struct init_exec *iexec) |
2237 | { | 2240 | { |
2238 | /* | 2241 | /* |
@@ -2251,17 +2254,17 @@ init_nv_reg(struct nvbios *bios, uint16_t offset, struct init_exec *iexec) | |||
2251 | uint32_t data = ROM32(bios->data[offset + 9]); | 2254 | uint32_t data = ROM32(bios->data[offset + 9]); |
2252 | 2255 | ||
2253 | if (!iexec->execute) | 2256 | if (!iexec->execute) |
2254 | return true; | 2257 | return 13; |
2255 | 2258 | ||
2256 | BIOSLOG(bios, "0x%04X: Reg: 0x%08X, Mask: 0x%08X, Data: 0x%08X\n", | 2259 | BIOSLOG(bios, "0x%04X: Reg: 0x%08X, Mask: 0x%08X, Data: 0x%08X\n", |
2257 | offset, reg, mask, data); | 2260 | offset, reg, mask, data); |
2258 | 2261 | ||
2259 | bios_wr32(bios, reg, (bios_rd32(bios, reg) & mask) | data); | 2262 | bios_wr32(bios, reg, (bios_rd32(bios, reg) & mask) | data); |
2260 | 2263 | ||
2261 | return true; | 2264 | return 13; |
2262 | } | 2265 | } |
2263 | 2266 | ||
2264 | static bool | 2267 | static int |
2265 | init_macro(struct nvbios *bios, uint16_t offset, struct init_exec *iexec) | 2268 | init_macro(struct nvbios *bios, uint16_t offset, struct init_exec *iexec) |
2266 | { | 2269 | { |
2267 | /* | 2270 | /* |
@@ -2285,7 +2288,7 @@ init_macro(struct nvbios *bios, uint16_t offset, struct init_exec *iexec) | |||
2285 | int i; | 2288 | int i; |
2286 | 2289 | ||
2287 | if (!iexec->execute) | 2290 | if (!iexec->execute) |
2288 | return true; | 2291 | return 2; |
2289 | 2292 | ||
2290 | BIOSLOG(bios, "0x%04X: Macro: 0x%02X, MacroTableIndex: 0x%02X, " | 2293 | BIOSLOG(bios, "0x%04X: Macro: 0x%02X, MacroTableIndex: 0x%02X, " |
2291 | "Count: 0x%02X\n", | 2294 | "Count: 0x%02X\n", |
@@ -2300,10 +2303,10 @@ init_macro(struct nvbios *bios, uint16_t offset, struct init_exec *iexec) | |||
2300 | bios_wr32(bios, reg, data); | 2303 | bios_wr32(bios, reg, data); |
2301 | } | 2304 | } |
2302 | 2305 | ||
2303 | return true; | 2306 | return 2; |
2304 | } | 2307 | } |
2305 | 2308 | ||
2306 | static bool | 2309 | static int |
2307 | init_done(struct nvbios *bios, uint16_t offset, struct init_exec *iexec) | 2310 | init_done(struct nvbios *bios, uint16_t offset, struct init_exec *iexec) |
2308 | { | 2311 | { |
2309 | /* | 2312 | /* |
@@ -2315,10 +2318,10 @@ init_done(struct nvbios *bios, uint16_t offset, struct init_exec *iexec) | |||
2315 | */ | 2318 | */ |
2316 | 2319 | ||
2317 | /* mild retval abuse to stop parsing this table */ | 2320 | /* mild retval abuse to stop parsing this table */ |
2318 | return false; | 2321 | return 0; |
2319 | } | 2322 | } |
2320 | 2323 | ||
2321 | static bool | 2324 | static int |
2322 | init_resume(struct nvbios *bios, uint16_t offset, struct init_exec *iexec) | 2325 | init_resume(struct nvbios *bios, uint16_t offset, struct init_exec *iexec) |
2323 | { | 2326 | { |
2324 | /* | 2327 | /* |
@@ -2330,15 +2333,15 @@ init_resume(struct nvbios *bios, uint16_t offset, struct init_exec *iexec) | |||
2330 | */ | 2333 | */ |
2331 | 2334 | ||
2332 | if (iexec->execute) | 2335 | if (iexec->execute) |
2333 | return true; | 2336 | return 1; |
2334 | 2337 | ||
2335 | iexec->execute = true; | 2338 | iexec->execute = true; |
2336 | BIOSLOG(bios, "0x%04X: ---- Executing following commands ----\n", offset); | 2339 | BIOSLOG(bios, "0x%04X: ---- Executing following commands ----\n", offset); |
2337 | 2340 | ||
2338 | return true; | 2341 | return 1; |
2339 | } | 2342 | } |
2340 | 2343 | ||
2341 | static bool | 2344 | static int |
2342 | init_time(struct nvbios *bios, uint16_t offset, struct init_exec *iexec) | 2345 | init_time(struct nvbios *bios, uint16_t offset, struct init_exec *iexec) |
2343 | { | 2346 | { |
2344 | /* | 2347 | /* |
@@ -2353,7 +2356,7 @@ init_time(struct nvbios *bios, uint16_t offset, struct init_exec *iexec) | |||
2353 | unsigned time = ROM16(bios->data[offset + 1]); | 2356 | unsigned time = ROM16(bios->data[offset + 1]); |
2354 | 2357 | ||
2355 | if (!iexec->execute) | 2358 | if (!iexec->execute) |
2356 | return true; | 2359 | return 3; |
2357 | 2360 | ||
2358 | BIOSLOG(bios, "0x%04X: Sleeping for 0x%04X microseconds\n", | 2361 | BIOSLOG(bios, "0x%04X: Sleeping for 0x%04X microseconds\n", |
2359 | offset, time); | 2362 | offset, time); |
@@ -2363,10 +2366,10 @@ init_time(struct nvbios *bios, uint16_t offset, struct init_exec *iexec) | |||
2363 | else | 2366 | else |
2364 | msleep((time + 900) / 1000); | 2367 | msleep((time + 900) / 1000); |
2365 | 2368 | ||
2366 | return true; | 2369 | return 3; |
2367 | } | 2370 | } |
2368 | 2371 | ||
2369 | static bool | 2372 | static int |
2370 | init_condition(struct nvbios *bios, uint16_t offset, struct init_exec *iexec) | 2373 | init_condition(struct nvbios *bios, uint16_t offset, struct init_exec *iexec) |
2371 | { | 2374 | { |
2372 | /* | 2375 | /* |
@@ -2383,7 +2386,7 @@ init_condition(struct nvbios *bios, uint16_t offset, struct init_exec *iexec) | |||
2383 | uint8_t cond = bios->data[offset + 1]; | 2386 | uint8_t cond = bios->data[offset + 1]; |
2384 | 2387 | ||
2385 | if (!iexec->execute) | 2388 | if (!iexec->execute) |
2386 | return true; | 2389 | return 2; |
2387 | 2390 | ||
2388 | BIOSLOG(bios, "0x%04X: Condition: 0x%02X\n", offset, cond); | 2391 | BIOSLOG(bios, "0x%04X: Condition: 0x%02X\n", offset, cond); |
2389 | 2392 | ||
@@ -2394,10 +2397,10 @@ init_condition(struct nvbios *bios, uint16_t offset, struct init_exec *iexec) | |||
2394 | iexec->execute = false; | 2397 | iexec->execute = false; |
2395 | } | 2398 | } |
2396 | 2399 | ||
2397 | return true; | 2400 | return 2; |
2398 | } | 2401 | } |
2399 | 2402 | ||
2400 | static bool | 2403 | static int |
2401 | init_io_condition(struct nvbios *bios, uint16_t offset, struct init_exec *iexec) | 2404 | init_io_condition(struct nvbios *bios, uint16_t offset, struct init_exec *iexec) |
2402 | { | 2405 | { |
2403 | /* | 2406 | /* |
@@ -2414,7 +2417,7 @@ init_io_condition(struct nvbios *bios, uint16_t offset, struct init_exec *iexec) | |||
2414 | uint8_t cond = bios->data[offset + 1]; | 2417 | uint8_t cond = bios->data[offset + 1]; |
2415 | 2418 | ||
2416 | if (!iexec->execute) | 2419 | if (!iexec->execute) |
2417 | return true; | 2420 | return 2; |
2418 | 2421 | ||
2419 | BIOSLOG(bios, "0x%04X: IO condition: 0x%02X\n", offset, cond); | 2422 | BIOSLOG(bios, "0x%04X: IO condition: 0x%02X\n", offset, cond); |
2420 | 2423 | ||
@@ -2425,10 +2428,10 @@ init_io_condition(struct nvbios *bios, uint16_t offset, struct init_exec *iexec) | |||
2425 | iexec->execute = false; | 2428 | iexec->execute = false; |
2426 | } | 2429 | } |
2427 | 2430 | ||
2428 | return true; | 2431 | return 2; |
2429 | } | 2432 | } |
2430 | 2433 | ||
2431 | static bool | 2434 | static int |
2432 | init_index_io(struct nvbios *bios, uint16_t offset, struct init_exec *iexec) | 2435 | init_index_io(struct nvbios *bios, uint16_t offset, struct init_exec *iexec) |
2433 | { | 2436 | { |
2434 | /* | 2437 | /* |
@@ -2451,7 +2454,7 @@ init_index_io(struct nvbios *bios, uint16_t offset, struct init_exec *iexec) | |||
2451 | uint8_t value; | 2454 | uint8_t value; |
2452 | 2455 | ||
2453 | if (!iexec->execute) | 2456 | if (!iexec->execute) |
2454 | return true; | 2457 | return 6; |
2455 | 2458 | ||
2456 | BIOSLOG(bios, "0x%04X: Port: 0x%04X, Index: 0x%02X, Mask: 0x%02X, " | 2459 | BIOSLOG(bios, "0x%04X: Port: 0x%04X, Index: 0x%02X, Mask: 0x%02X, " |
2457 | "Data: 0x%02X\n", | 2460 | "Data: 0x%02X\n", |
@@ -2460,10 +2463,10 @@ init_index_io(struct nvbios *bios, uint16_t offset, struct init_exec *iexec) | |||
2460 | value = (bios_idxprt_rd(bios, crtcport, crtcindex) & mask) | data; | 2463 | value = (bios_idxprt_rd(bios, crtcport, crtcindex) & mask) | data; |
2461 | bios_idxprt_wr(bios, crtcport, crtcindex, value); | 2464 | bios_idxprt_wr(bios, crtcport, crtcindex, value); |
2462 | 2465 | ||
2463 | return true; | 2466 | return 6; |
2464 | } | 2467 | } |
2465 | 2468 | ||
2466 | static bool | 2469 | static int |
2467 | init_pll(struct nvbios *bios, uint16_t offset, struct init_exec *iexec) | 2470 | init_pll(struct nvbios *bios, uint16_t offset, struct init_exec *iexec) |
2468 | { | 2471 | { |
2469 | /* | 2472 | /* |
@@ -2481,16 +2484,16 @@ init_pll(struct nvbios *bios, uint16_t offset, struct init_exec *iexec) | |||
2481 | uint16_t freq = ROM16(bios->data[offset + 5]); | 2484 | uint16_t freq = ROM16(bios->data[offset + 5]); |
2482 | 2485 | ||
2483 | if (!iexec->execute) | 2486 | if (!iexec->execute) |
2484 | return true; | 2487 | return 7; |
2485 | 2488 | ||
2486 | BIOSLOG(bios, "0x%04X: Reg: 0x%08X, Freq: %d0kHz\n", offset, reg, freq); | 2489 | BIOSLOG(bios, "0x%04X: Reg: 0x%08X, Freq: %d0kHz\n", offset, reg, freq); |
2487 | 2490 | ||
2488 | setPLL(bios, reg, freq * 10); | 2491 | setPLL(bios, reg, freq * 10); |
2489 | 2492 | ||
2490 | return true; | 2493 | return 7; |
2491 | } | 2494 | } |
2492 | 2495 | ||
2493 | static bool | 2496 | static int |
2494 | init_zm_reg(struct nvbios *bios, uint16_t offset, struct init_exec *iexec) | 2497 | init_zm_reg(struct nvbios *bios, uint16_t offset, struct init_exec *iexec) |
2495 | { | 2498 | { |
2496 | /* | 2499 | /* |
@@ -2507,17 +2510,17 @@ init_zm_reg(struct nvbios *bios, uint16_t offset, struct init_exec *iexec) | |||
2507 | uint32_t value = ROM32(bios->data[offset + 5]); | 2510 | uint32_t value = ROM32(bios->data[offset + 5]); |
2508 | 2511 | ||
2509 | if (!iexec->execute) | 2512 | if (!iexec->execute) |
2510 | return true; | 2513 | return 9; |
2511 | 2514 | ||
2512 | if (reg == 0x000200) | 2515 | if (reg == 0x000200) |
2513 | value |= 1; | 2516 | value |= 1; |
2514 | 2517 | ||
2515 | bios_wr32(bios, reg, value); | 2518 | bios_wr32(bios, reg, value); |
2516 | 2519 | ||
2517 | return true; | 2520 | return 9; |
2518 | } | 2521 | } |
2519 | 2522 | ||
2520 | static bool | 2523 | static int |
2521 | init_ram_restrict_pll(struct nvbios *bios, uint16_t offset, | 2524 | init_ram_restrict_pll(struct nvbios *bios, uint16_t offset, |
2522 | struct init_exec *iexec) | 2525 | struct init_exec *iexec) |
2523 | { | 2526 | { |
@@ -2543,14 +2546,15 @@ init_ram_restrict_pll(struct nvbios *bios, uint16_t offset, | |||
2543 | uint8_t type = bios->data[offset + 1]; | 2546 | uint8_t type = bios->data[offset + 1]; |
2544 | uint32_t freq = ROM32(bios->data[offset + 2 + (index * 4)]); | 2547 | uint32_t freq = ROM32(bios->data[offset + 2 + (index * 4)]); |
2545 | uint8_t *pll_limits = &bios->data[bios->pll_limit_tbl_ptr], *entry; | 2548 | uint8_t *pll_limits = &bios->data[bios->pll_limit_tbl_ptr], *entry; |
2549 | int len = 2 + bios->ram_restrict_group_count * 4; | ||
2546 | int i; | 2550 | int i; |
2547 | 2551 | ||
2548 | if (!iexec->execute) | 2552 | if (!iexec->execute) |
2549 | return true; | 2553 | return len; |
2550 | 2554 | ||
2551 | if (!bios->pll_limit_tbl_ptr || (pll_limits[0] & 0xf0) != 0x30) { | 2555 | if (!bios->pll_limit_tbl_ptr || (pll_limits[0] & 0xf0) != 0x30) { |
2552 | NV_ERROR(dev, "PLL limits table not version 3.x\n"); | 2556 | NV_ERROR(dev, "PLL limits table not version 3.x\n"); |
2553 | return true; /* deliberate, allow default clocks to remain */ | 2557 | return len; /* deliberate, allow default clocks to remain */ |
2554 | } | 2558 | } |
2555 | 2559 | ||
2556 | entry = pll_limits + pll_limits[1]; | 2560 | entry = pll_limits + pll_limits[1]; |
@@ -2563,15 +2567,15 @@ init_ram_restrict_pll(struct nvbios *bios, uint16_t offset, | |||
2563 | offset, type, reg, freq); | 2567 | offset, type, reg, freq); |
2564 | 2568 | ||
2565 | setPLL(bios, reg, freq); | 2569 | setPLL(bios, reg, freq); |
2566 | return true; | 2570 | return len; |
2567 | } | 2571 | } |
2568 | } | 2572 | } |
2569 | 2573 | ||
2570 | NV_ERROR(dev, "PLL type 0x%02x not found in PLL limits table", type); | 2574 | NV_ERROR(dev, "PLL type 0x%02x not found in PLL limits table", type); |
2571 | return true; | 2575 | return len; |
2572 | } | 2576 | } |
2573 | 2577 | ||
2574 | static bool | 2578 | static int |
2575 | init_8c(struct nvbios *bios, uint16_t offset, struct init_exec *iexec) | 2579 | init_8c(struct nvbios *bios, uint16_t offset, struct init_exec *iexec) |
2576 | { | 2580 | { |
2577 | /* | 2581 | /* |
@@ -2581,10 +2585,10 @@ init_8c(struct nvbios *bios, uint16_t offset, struct init_exec *iexec) | |||
2581 | * | 2585 | * |
2582 | */ | 2586 | */ |
2583 | 2587 | ||
2584 | return true; | 2588 | return 1; |
2585 | } | 2589 | } |
2586 | 2590 | ||
2587 | static bool | 2591 | static int |
2588 | init_8d(struct nvbios *bios, uint16_t offset, struct init_exec *iexec) | 2592 | init_8d(struct nvbios *bios, uint16_t offset, struct init_exec *iexec) |
2589 | { | 2593 | { |
2590 | /* | 2594 | /* |
@@ -2594,10 +2598,10 @@ init_8d(struct nvbios *bios, uint16_t offset, struct init_exec *iexec) | |||
2594 | * | 2598 | * |
2595 | */ | 2599 | */ |
2596 | 2600 | ||
2597 | return true; | 2601 | return 1; |
2598 | } | 2602 | } |
2599 | 2603 | ||
2600 | static bool | 2604 | static int |
2601 | init_gpio(struct nvbios *bios, uint16_t offset, struct init_exec *iexec) | 2605 | init_gpio(struct nvbios *bios, uint16_t offset, struct init_exec *iexec) |
2602 | { | 2606 | { |
2603 | /* | 2607 | /* |
@@ -2615,14 +2619,17 @@ init_gpio(struct nvbios *bios, uint16_t offset, struct init_exec *iexec) | |||
2615 | const uint8_t *gpio_entry; | 2619 | const uint8_t *gpio_entry; |
2616 | int i; | 2620 | int i; |
2617 | 2621 | ||
2622 | if (!iexec->execute) | ||
2623 | return 1; | ||
2624 | |||
2618 | if (bios->bdcb.version != 0x40) { | 2625 | if (bios->bdcb.version != 0x40) { |
2619 | NV_ERROR(bios->dev, "DCB table not version 4.0\n"); | 2626 | NV_ERROR(bios->dev, "DCB table not version 4.0\n"); |
2620 | return false; | 2627 | return 0; |
2621 | } | 2628 | } |
2622 | 2629 | ||
2623 | if (!bios->bdcb.gpio_table_ptr) { | 2630 | if (!bios->bdcb.gpio_table_ptr) { |
2624 | NV_WARN(bios->dev, "Invalid pointer to INIT_8E table\n"); | 2631 | NV_WARN(bios->dev, "Invalid pointer to INIT_8E table\n"); |
2625 | return false; | 2632 | return 0; |
2626 | } | 2633 | } |
2627 | 2634 | ||
2628 | gpio_entry = gpio_table + gpio_table[1]; | 2635 | gpio_entry = gpio_table + gpio_table[1]; |
@@ -2660,13 +2667,10 @@ init_gpio(struct nvbios *bios, uint16_t offset, struct init_exec *iexec) | |||
2660 | bios_wr32(bios, r, v); | 2667 | bios_wr32(bios, r, v); |
2661 | } | 2668 | } |
2662 | 2669 | ||
2663 | return true; | 2670 | return 1; |
2664 | } | 2671 | } |
2665 | 2672 | ||
2666 | /* hack to avoid moving the itbl_entry array before this function */ | 2673 | static int |
2667 | int init_ram_restrict_zm_reg_group_blocklen; | ||
2668 | |||
2669 | static bool | ||
2670 | init_ram_restrict_zm_reg_group(struct nvbios *bios, uint16_t offset, | 2674 | init_ram_restrict_zm_reg_group(struct nvbios *bios, uint16_t offset, |
2671 | struct init_exec *iexec) | 2675 | struct init_exec *iexec) |
2672 | { | 2676 | { |
@@ -2692,21 +2696,21 @@ init_ram_restrict_zm_reg_group(struct nvbios *bios, uint16_t offset, | |||
2692 | uint8_t regincrement = bios->data[offset + 5]; | 2696 | uint8_t regincrement = bios->data[offset + 5]; |
2693 | uint8_t count = bios->data[offset + 6]; | 2697 | uint8_t count = bios->data[offset + 6]; |
2694 | uint32_t strap_ramcfg, data; | 2698 | uint32_t strap_ramcfg, data; |
2695 | uint16_t blocklen; | 2699 | /* previously set by 'M' BIT table */ |
2700 | uint16_t blocklen = bios->ram_restrict_group_count * 4; | ||
2701 | int len = 7 + count * blocklen; | ||
2696 | uint8_t index; | 2702 | uint8_t index; |
2697 | int i; | 2703 | int i; |
2698 | 2704 | ||
2699 | /* previously set by 'M' BIT table */ | ||
2700 | blocklen = init_ram_restrict_zm_reg_group_blocklen; | ||
2701 | 2705 | ||
2702 | if (!iexec->execute) | 2706 | if (!iexec->execute) |
2703 | return true; | 2707 | return len; |
2704 | 2708 | ||
2705 | if (!blocklen) { | 2709 | if (!blocklen) { |
2706 | NV_ERROR(bios->dev, | 2710 | NV_ERROR(bios->dev, |
2707 | "0x%04X: Zero block length - has the M table " | 2711 | "0x%04X: Zero block length - has the M table " |
2708 | "been parsed?\n", offset); | 2712 | "been parsed?\n", offset); |
2709 | return false; | 2713 | return 0; |
2710 | } | 2714 | } |
2711 | 2715 | ||
2712 | strap_ramcfg = (bios_rd32(bios, NV_PEXTDEV_BOOT_0) >> 2) & 0xf; | 2716 | strap_ramcfg = (bios_rd32(bios, NV_PEXTDEV_BOOT_0) >> 2) & 0xf; |
@@ -2724,10 +2728,10 @@ init_ram_restrict_zm_reg_group(struct nvbios *bios, uint16_t offset, | |||
2724 | reg += regincrement; | 2728 | reg += regincrement; |
2725 | } | 2729 | } |
2726 | 2730 | ||
2727 | return true; | 2731 | return len; |
2728 | } | 2732 | } |
2729 | 2733 | ||
2730 | static bool | 2734 | static int |
2731 | init_copy_zm_reg(struct nvbios *bios, uint16_t offset, struct init_exec *iexec) | 2735 | init_copy_zm_reg(struct nvbios *bios, uint16_t offset, struct init_exec *iexec) |
2732 | { | 2736 | { |
2733 | /* | 2737 | /* |
@@ -2744,14 +2748,14 @@ init_copy_zm_reg(struct nvbios *bios, uint16_t offset, struct init_exec *iexec) | |||
2744 | uint32_t dstreg = ROM32(bios->data[offset + 5]); | 2748 | uint32_t dstreg = ROM32(bios->data[offset + 5]); |
2745 | 2749 | ||
2746 | if (!iexec->execute) | 2750 | if (!iexec->execute) |
2747 | return true; | 2751 | return 9; |
2748 | 2752 | ||
2749 | bios_wr32(bios, dstreg, bios_rd32(bios, srcreg)); | 2753 | bios_wr32(bios, dstreg, bios_rd32(bios, srcreg)); |
2750 | 2754 | ||
2751 | return true; | 2755 | return 9; |
2752 | } | 2756 | } |
2753 | 2757 | ||
2754 | static bool | 2758 | static int |
2755 | init_zm_reg_group_addr_latched(struct nvbios *bios, uint16_t offset, | 2759 | init_zm_reg_group_addr_latched(struct nvbios *bios, uint16_t offset, |
2756 | struct init_exec *iexec) | 2760 | struct init_exec *iexec) |
2757 | { | 2761 | { |
@@ -2769,20 +2773,21 @@ init_zm_reg_group_addr_latched(struct nvbios *bios, uint16_t offset, | |||
2769 | 2773 | ||
2770 | uint32_t reg = ROM32(bios->data[offset + 1]); | 2774 | uint32_t reg = ROM32(bios->data[offset + 1]); |
2771 | uint8_t count = bios->data[offset + 5]; | 2775 | uint8_t count = bios->data[offset + 5]; |
2776 | int len = 6 + count * 4; | ||
2772 | int i; | 2777 | int i; |
2773 | 2778 | ||
2774 | if (!iexec->execute) | 2779 | if (!iexec->execute) |
2775 | return true; | 2780 | return len; |
2776 | 2781 | ||
2777 | for (i = 0; i < count; i++) { | 2782 | for (i = 0; i < count; i++) { |
2778 | uint32_t data = ROM32(bios->data[offset + 6 + 4 * i]); | 2783 | uint32_t data = ROM32(bios->data[offset + 6 + 4 * i]); |
2779 | bios_wr32(bios, reg, data); | 2784 | bios_wr32(bios, reg, data); |
2780 | } | 2785 | } |
2781 | 2786 | ||
2782 | return true; | 2787 | return len; |
2783 | } | 2788 | } |
2784 | 2789 | ||
2785 | static bool | 2790 | static int |
2786 | init_reserved(struct nvbios *bios, uint16_t offset, struct init_exec *iexec) | 2791 | init_reserved(struct nvbios *bios, uint16_t offset, struct init_exec *iexec) |
2787 | { | 2792 | { |
2788 | /* | 2793 | /* |
@@ -2793,10 +2798,10 @@ init_reserved(struct nvbios *bios, uint16_t offset, struct init_exec *iexec) | |||
2793 | * Seemingly does nothing | 2798 | * Seemingly does nothing |
2794 | */ | 2799 | */ |
2795 | 2800 | ||
2796 | return true; | 2801 | return 1; |
2797 | } | 2802 | } |
2798 | 2803 | ||
2799 | static bool | 2804 | static int |
2800 | init_96(struct nvbios *bios, uint16_t offset, struct init_exec *iexec) | 2805 | init_96(struct nvbios *bios, uint16_t offset, struct init_exec *iexec) |
2801 | { | 2806 | { |
2802 | /* | 2807 | /* |
@@ -2829,13 +2834,13 @@ init_96(struct nvbios *bios, uint16_t offset, struct init_exec *iexec) | |||
2829 | val <<= bios->data[offset + 16]; | 2834 | val <<= bios->data[offset + 16]; |
2830 | 2835 | ||
2831 | if (!iexec->execute) | 2836 | if (!iexec->execute) |
2832 | return true; | 2837 | return 17; |
2833 | 2838 | ||
2834 | bios_wr32(bios, reg, (bios_rd32(bios, reg) & mask) | val); | 2839 | bios_wr32(bios, reg, (bios_rd32(bios, reg) & mask) | val); |
2835 | return true; | 2840 | return 17; |
2836 | } | 2841 | } |
2837 | 2842 | ||
2838 | static bool | 2843 | static int |
2839 | init_97(struct nvbios *bios, uint16_t offset, struct init_exec *iexec) | 2844 | init_97(struct nvbios *bios, uint16_t offset, struct init_exec *iexec) |
2840 | { | 2845 | { |
2841 | /* | 2846 | /* |
@@ -2859,13 +2864,13 @@ init_97(struct nvbios *bios, uint16_t offset, struct init_exec *iexec) | |||
2859 | val = (val & mask) | ((val + add) & ~mask); | 2864 | val = (val & mask) | ((val + add) & ~mask); |
2860 | 2865 | ||
2861 | if (!iexec->execute) | 2866 | if (!iexec->execute) |
2862 | return true; | 2867 | return 13; |
2863 | 2868 | ||
2864 | bios_wr32(bios, reg, val); | 2869 | bios_wr32(bios, reg, val); |
2865 | return true; | 2870 | return 13; |
2866 | } | 2871 | } |
2867 | 2872 | ||
2868 | static bool | 2873 | static int |
2869 | init_auxch(struct nvbios *bios, uint16_t offset, struct init_exec *iexec) | 2874 | init_auxch(struct nvbios *bios, uint16_t offset, struct init_exec *iexec) |
2870 | { | 2875 | { |
2871 | /* | 2876 | /* |
@@ -2883,32 +2888,33 @@ init_auxch(struct nvbios *bios, uint16_t offset, struct init_exec *iexec) | |||
2883 | struct drm_device *dev = bios->dev; | 2888 | struct drm_device *dev = bios->dev; |
2884 | struct nouveau_i2c_chan *auxch; | 2889 | struct nouveau_i2c_chan *auxch; |
2885 | uint32_t addr = ROM32(bios->data[offset + 1]); | 2890 | uint32_t addr = ROM32(bios->data[offset + 1]); |
2886 | uint8_t len = bios->data[offset + 5]; | 2891 | uint8_t count = bios->data[offset + 5]; |
2892 | int len = 6 + count * 2; | ||
2887 | int ret, i; | 2893 | int ret, i; |
2888 | 2894 | ||
2889 | if (!bios->display.output) { | 2895 | if (!bios->display.output) { |
2890 | NV_ERROR(dev, "INIT_AUXCH: no active output\n"); | 2896 | NV_ERROR(dev, "INIT_AUXCH: no active output\n"); |
2891 | return false; | 2897 | return 0; |
2892 | } | 2898 | } |
2893 | 2899 | ||
2894 | auxch = init_i2c_device_find(dev, bios->display.output->i2c_index); | 2900 | auxch = init_i2c_device_find(dev, bios->display.output->i2c_index); |
2895 | if (!auxch) { | 2901 | if (!auxch) { |
2896 | NV_ERROR(dev, "INIT_AUXCH: couldn't get auxch %d\n", | 2902 | NV_ERROR(dev, "INIT_AUXCH: couldn't get auxch %d\n", |
2897 | bios->display.output->i2c_index); | 2903 | bios->display.output->i2c_index); |
2898 | return false; | 2904 | return 0; |
2899 | } | 2905 | } |
2900 | 2906 | ||
2901 | if (!iexec->execute) | 2907 | if (!iexec->execute) |
2902 | return true; | 2908 | return len; |
2903 | 2909 | ||
2904 | offset += 6; | 2910 | offset += 6; |
2905 | for (i = 0; i < len; i++, offset += 2) { | 2911 | for (i = 0; i < count; i++, offset += 2) { |
2906 | uint8_t data; | 2912 | uint8_t data; |
2907 | 2913 | ||
2908 | ret = nouveau_dp_auxch(auxch, 9, addr, &data, 1); | 2914 | ret = nouveau_dp_auxch(auxch, 9, addr, &data, 1); |
2909 | if (ret) { | 2915 | if (ret) { |
2910 | NV_ERROR(dev, "INIT_AUXCH: rd auxch fail %d\n", ret); | 2916 | NV_ERROR(dev, "INIT_AUXCH: rd auxch fail %d\n", ret); |
2911 | return false; | 2917 | return 0; |
2912 | } | 2918 | } |
2913 | 2919 | ||
2914 | data &= bios->data[offset + 0]; | 2920 | data &= bios->data[offset + 0]; |
@@ -2917,14 +2923,14 @@ init_auxch(struct nvbios *bios, uint16_t offset, struct init_exec *iexec) | |||
2917 | ret = nouveau_dp_auxch(auxch, 8, addr, &data, 1); | 2923 | ret = nouveau_dp_auxch(auxch, 8, addr, &data, 1); |
2918 | if (ret) { | 2924 | if (ret) { |
2919 | NV_ERROR(dev, "INIT_AUXCH: wr auxch fail %d\n", ret); | 2925 | NV_ERROR(dev, "INIT_AUXCH: wr auxch fail %d\n", ret); |
2920 | return false; | 2926 | return 0; |
2921 | } | 2927 | } |
2922 | } | 2928 | } |
2923 | 2929 | ||
2924 | return true; | 2930 | return len; |
2925 | } | 2931 | } |
2926 | 2932 | ||
2927 | static bool | 2933 | static int |
2928 | init_zm_auxch(struct nvbios *bios, uint16_t offset, struct init_exec *iexec) | 2934 | init_zm_auxch(struct nvbios *bios, uint16_t offset, struct init_exec *iexec) |
2929 | { | 2935 | { |
2930 | /* | 2936 | /* |
@@ -2941,106 +2947,99 @@ init_zm_auxch(struct nvbios *bios, uint16_t offset, struct init_exec *iexec) | |||
2941 | struct drm_device *dev = bios->dev; | 2947 | struct drm_device *dev = bios->dev; |
2942 | struct nouveau_i2c_chan *auxch; | 2948 | struct nouveau_i2c_chan *auxch; |
2943 | uint32_t addr = ROM32(bios->data[offset + 1]); | 2949 | uint32_t addr = ROM32(bios->data[offset + 1]); |
2944 | uint8_t len = bios->data[offset + 5]; | 2950 | uint8_t count = bios->data[offset + 5]; |
2951 | int len = 6 + count; | ||
2945 | int ret, i; | 2952 | int ret, i; |
2946 | 2953 | ||
2947 | if (!bios->display.output) { | 2954 | if (!bios->display.output) { |
2948 | NV_ERROR(dev, "INIT_ZM_AUXCH: no active output\n"); | 2955 | NV_ERROR(dev, "INIT_ZM_AUXCH: no active output\n"); |
2949 | return false; | 2956 | return 0; |
2950 | } | 2957 | } |
2951 | 2958 | ||
2952 | auxch = init_i2c_device_find(dev, bios->display.output->i2c_index); | 2959 | auxch = init_i2c_device_find(dev, bios->display.output->i2c_index); |
2953 | if (!auxch) { | 2960 | if (!auxch) { |
2954 | NV_ERROR(dev, "INIT_ZM_AUXCH: couldn't get auxch %d\n", | 2961 | NV_ERROR(dev, "INIT_ZM_AUXCH: couldn't get auxch %d\n", |
2955 | bios->display.output->i2c_index); | 2962 | bios->display.output->i2c_index); |
2956 | return false; | 2963 | return 0; |
2957 | } | 2964 | } |
2958 | 2965 | ||
2959 | if (!iexec->execute) | 2966 | if (!iexec->execute) |
2960 | return true; | 2967 | return len; |
2961 | 2968 | ||
2962 | offset += 6; | 2969 | offset += 6; |
2963 | for (i = 0; i < len; i++, offset++) { | 2970 | for (i = 0; i < count; i++, offset++) { |
2964 | ret = nouveau_dp_auxch(auxch, 8, addr, &bios->data[offset], 1); | 2971 | ret = nouveau_dp_auxch(auxch, 8, addr, &bios->data[offset], 1); |
2965 | if (ret) { | 2972 | if (ret) { |
2966 | NV_ERROR(dev, "INIT_ZM_AUXCH: wr auxch fail %d\n", ret); | 2973 | NV_ERROR(dev, "INIT_ZM_AUXCH: wr auxch fail %d\n", ret); |
2967 | return false; | 2974 | return 0; |
2968 | } | 2975 | } |
2969 | } | 2976 | } |
2970 | 2977 | ||
2971 | return true; | 2978 | return len; |
2972 | } | 2979 | } |
2973 | 2980 | ||
2974 | static struct init_tbl_entry itbl_entry[] = { | 2981 | static struct init_tbl_entry itbl_entry[] = { |
2975 | /* command name , id , length , offset , mult , command handler */ | 2982 | /* command name , id , length , offset , mult , command handler */ |
2976 | /* INIT_PROG (0x31, 15, 10, 4) removed due to no example of use */ | 2983 | /* INIT_PROG (0x31, 15, 10, 4) removed due to no example of use */ |
2977 | { "INIT_IO_RESTRICT_PROG" , 0x32, 11 , 6 , 4 , init_io_restrict_prog }, | 2984 | { "INIT_IO_RESTRICT_PROG" , 0x32, init_io_restrict_prog }, |
2978 | { "INIT_REPEAT" , 0x33, 2 , 0 , 0 , init_repeat }, | 2985 | { "INIT_REPEAT" , 0x33, init_repeat }, |
2979 | { "INIT_IO_RESTRICT_PLL" , 0x34, 12 , 7 , 2 , init_io_restrict_pll }, | 2986 | { "INIT_IO_RESTRICT_PLL" , 0x34, init_io_restrict_pll }, |
2980 | { "INIT_END_REPEAT" , 0x36, 1 , 0 , 0 , init_end_repeat }, | 2987 | { "INIT_END_REPEAT" , 0x36, init_end_repeat }, |
2981 | { "INIT_COPY" , 0x37, 11 , 0 , 0 , init_copy }, | 2988 | { "INIT_COPY" , 0x37, init_copy }, |
2982 | { "INIT_NOT" , 0x38, 1 , 0 , 0 , init_not }, | 2989 | { "INIT_NOT" , 0x38, init_not }, |
2983 | { "INIT_IO_FLAG_CONDITION" , 0x39, 2 , 0 , 0 , init_io_flag_condition }, | 2990 | { "INIT_IO_FLAG_CONDITION" , 0x39, init_io_flag_condition }, |
2984 | { "INIT_INDEX_ADDRESS_LATCHED" , 0x49, 18 , 17 , 2 , init_idx_addr_latched }, | 2991 | { "INIT_INDEX_ADDRESS_LATCHED" , 0x49, init_idx_addr_latched }, |
2985 | { "INIT_IO_RESTRICT_PLL2" , 0x4A, 11 , 6 , 4 , init_io_restrict_pll2 }, | 2992 | { "INIT_IO_RESTRICT_PLL2" , 0x4A, init_io_restrict_pll2 }, |
2986 | { "INIT_PLL2" , 0x4B, 9 , 0 , 0 , init_pll2 }, | 2993 | { "INIT_PLL2" , 0x4B, init_pll2 }, |
2987 | { "INIT_I2C_BYTE" , 0x4C, 4 , 3 , 3 , init_i2c_byte }, | 2994 | { "INIT_I2C_BYTE" , 0x4C, init_i2c_byte }, |
2988 | { "INIT_ZM_I2C_BYTE" , 0x4D, 4 , 3 , 2 , init_zm_i2c_byte }, | 2995 | { "INIT_ZM_I2C_BYTE" , 0x4D, init_zm_i2c_byte }, |
2989 | { "INIT_ZM_I2C" , 0x4E, 4 , 3 , 1 , init_zm_i2c }, | 2996 | { "INIT_ZM_I2C" , 0x4E, init_zm_i2c }, |
2990 | { "INIT_TMDS" , 0x4F, 5 , 0 , 0 , init_tmds }, | 2997 | { "INIT_TMDS" , 0x4F, init_tmds }, |
2991 | { "INIT_ZM_TMDS_GROUP" , 0x50, 3 , 2 , 2 , init_zm_tmds_group }, | 2998 | { "INIT_ZM_TMDS_GROUP" , 0x50, init_zm_tmds_group }, |
2992 | { "INIT_CR_INDEX_ADDRESS_LATCHED" , 0x51, 5 , 4 , 1 , init_cr_idx_adr_latch }, | 2999 | { "INIT_CR_INDEX_ADDRESS_LATCHED" , 0x51, init_cr_idx_adr_latch }, |
2993 | { "INIT_CR" , 0x52, 4 , 0 , 0 , init_cr }, | 3000 | { "INIT_CR" , 0x52, init_cr }, |
2994 | { "INIT_ZM_CR" , 0x53, 3 , 0 , 0 , init_zm_cr }, | 3001 | { "INIT_ZM_CR" , 0x53, init_zm_cr }, |
2995 | { "INIT_ZM_CR_GROUP" , 0x54, 2 , 1 , 2 , init_zm_cr_group }, | 3002 | { "INIT_ZM_CR_GROUP" , 0x54, init_zm_cr_group }, |
2996 | { "INIT_CONDITION_TIME" , 0x56, 3 , 0 , 0 , init_condition_time }, | 3003 | { "INIT_CONDITION_TIME" , 0x56, init_condition_time }, |
2997 | { "INIT_ZM_REG_SEQUENCE" , 0x58, 6 , 5 , 4 , init_zm_reg_sequence }, | 3004 | { "INIT_ZM_REG_SEQUENCE" , 0x58, init_zm_reg_sequence }, |
2998 | /* INIT_INDIRECT_REG (0x5A, 7, 0, 0) removed due to no example of use */ | 3005 | /* INIT_INDIRECT_REG (0x5A, 7, 0, 0) removed due to no example of use */ |
2999 | { "INIT_SUB_DIRECT" , 0x5B, 3 , 0 , 0 , init_sub_direct }, | 3006 | { "INIT_SUB_DIRECT" , 0x5B, init_sub_direct }, |
3000 | { "INIT_COPY_NV_REG" , 0x5F, 22 , 0 , 0 , init_copy_nv_reg }, | 3007 | { "INIT_COPY_NV_REG" , 0x5F, init_copy_nv_reg }, |
3001 | { "INIT_ZM_INDEX_IO" , 0x62, 5 , 0 , 0 , init_zm_index_io }, | 3008 | { "INIT_ZM_INDEX_IO" , 0x62, init_zm_index_io }, |
3002 | { "INIT_COMPUTE_MEM" , 0x63, 1 , 0 , 0 , init_compute_mem }, | 3009 | { "INIT_COMPUTE_MEM" , 0x63, init_compute_mem }, |
3003 | { "INIT_RESET" , 0x65, 13 , 0 , 0 , init_reset }, | 3010 | { "INIT_RESET" , 0x65, init_reset }, |
3004 | { "INIT_CONFIGURE_MEM" , 0x66, 1 , 0 , 0 , init_configure_mem }, | 3011 | { "INIT_CONFIGURE_MEM" , 0x66, init_configure_mem }, |
3005 | { "INIT_CONFIGURE_CLK" , 0x67, 1 , 0 , 0 , init_configure_clk }, | 3012 | { "INIT_CONFIGURE_CLK" , 0x67, init_configure_clk }, |
3006 | { "INIT_CONFIGURE_PREINIT" , 0x68, 1 , 0 , 0 , init_configure_preinit }, | 3013 | { "INIT_CONFIGURE_PREINIT" , 0x68, init_configure_preinit }, |
3007 | { "INIT_IO" , 0x69, 5 , 0 , 0 , init_io }, | 3014 | { "INIT_IO" , 0x69, init_io }, |
3008 | { "INIT_SUB" , 0x6B, 2 , 0 , 0 , init_sub }, | 3015 | { "INIT_SUB" , 0x6B, init_sub }, |
3009 | { "INIT_RAM_CONDITION" , 0x6D, 3 , 0 , 0 , init_ram_condition }, | 3016 | { "INIT_RAM_CONDITION" , 0x6D, init_ram_condition }, |
3010 | { "INIT_NV_REG" , 0x6E, 13 , 0 , 0 , init_nv_reg }, | 3017 | { "INIT_NV_REG" , 0x6E, init_nv_reg }, |
3011 | { "INIT_MACRO" , 0x6F, 2 , 0 , 0 , init_macro }, | 3018 | { "INIT_MACRO" , 0x6F, init_macro }, |
3012 | { "INIT_DONE" , 0x71, 1 , 0 , 0 , init_done }, | 3019 | { "INIT_DONE" , 0x71, init_done }, |
3013 | { "INIT_RESUME" , 0x72, 1 , 0 , 0 , init_resume }, | 3020 | { "INIT_RESUME" , 0x72, init_resume }, |
3014 | /* INIT_RAM_CONDITION2 (0x73, 9, 0, 0) removed due to no example of use */ | 3021 | /* INIT_RAM_CONDITION2 (0x73, 9, 0, 0) removed due to no example of use */ |
3015 | { "INIT_TIME" , 0x74, 3 , 0 , 0 , init_time }, | 3022 | { "INIT_TIME" , 0x74, init_time }, |
3016 | { "INIT_CONDITION" , 0x75, 2 , 0 , 0 , init_condition }, | 3023 | { "INIT_CONDITION" , 0x75, init_condition }, |
3017 | { "INIT_IO_CONDITION" , 0x76, 2 , 0 , 0 , init_io_condition }, | 3024 | { "INIT_IO_CONDITION" , 0x76, init_io_condition }, |
3018 | { "INIT_INDEX_IO" , 0x78, 6 , 0 , 0 , init_index_io }, | 3025 | { "INIT_INDEX_IO" , 0x78, init_index_io }, |
3019 | { "INIT_PLL" , 0x79, 7 , 0 , 0 , init_pll }, | 3026 | { "INIT_PLL" , 0x79, init_pll }, |
3020 | { "INIT_ZM_REG" , 0x7A, 9 , 0 , 0 , init_zm_reg }, | 3027 | { "INIT_ZM_REG" , 0x7A, init_zm_reg }, |
3021 | /* INIT_RAM_RESTRICT_PLL's length is adjusted by the BIT M table */ | 3028 | { "INIT_RAM_RESTRICT_PLL" , 0x87, init_ram_restrict_pll }, |
3022 | { "INIT_RAM_RESTRICT_PLL" , 0x87, 2 , 0 , 0 , init_ram_restrict_pll }, | 3029 | { "INIT_8C" , 0x8C, init_8c }, |
3023 | { "INIT_8C" , 0x8C, 1 , 0 , 0 , init_8c }, | 3030 | { "INIT_8D" , 0x8D, init_8d }, |
3024 | { "INIT_8D" , 0x8D, 1 , 0 , 0 , init_8d }, | 3031 | { "INIT_GPIO" , 0x8E, init_gpio }, |
3025 | { "INIT_GPIO" , 0x8E, 1 , 0 , 0 , init_gpio }, | 3032 | { "INIT_RAM_RESTRICT_ZM_REG_GROUP" , 0x8F, init_ram_restrict_zm_reg_group }, |
3026 | /* INIT_RAM_RESTRICT_ZM_REG_GROUP's mult is loaded by M table in BIT */ | 3033 | { "INIT_COPY_ZM_REG" , 0x90, init_copy_zm_reg }, |
3027 | { "INIT_RAM_RESTRICT_ZM_REG_GROUP" , 0x8F, 7 , 6 , 0 , init_ram_restrict_zm_reg_group }, | 3034 | { "INIT_ZM_REG_GROUP_ADDRESS_LATCHED" , 0x91, init_zm_reg_group_addr_latched }, |
3028 | { "INIT_COPY_ZM_REG" , 0x90, 9 , 0 , 0 , init_copy_zm_reg }, | 3035 | { "INIT_RESERVED" , 0x92, init_reserved }, |
3029 | { "INIT_ZM_REG_GROUP_ADDRESS_LATCHED" , 0x91, 6 , 5 , 4 , init_zm_reg_group_addr_latched }, | 3036 | { "INIT_96" , 0x96, init_96 }, |
3030 | { "INIT_RESERVED" , 0x92, 1 , 0 , 0 , init_reserved }, | 3037 | { "INIT_97" , 0x97, init_97 }, |
3031 | { "INIT_96" , 0x96, 17 , 0 , 0 , init_96 }, | 3038 | { "INIT_AUXCH" , 0x98, init_auxch }, |
3032 | { "INIT_97" , 0x97, 13 , 0 , 0 , init_97 }, | 3039 | { "INIT_ZM_AUXCH" , 0x99, init_zm_auxch }, |
3033 | { "INIT_AUXCH" , 0x98, 6 , 5 , 2 , init_auxch }, | 3040 | { NULL , 0 , NULL } |
3034 | { "INIT_ZM_AUXCH" , 0x99, 6 , 5 , 1 , init_zm_auxch }, | ||
3035 | { NULL , 0 , 0 , 0 , 0 , NULL } | ||
3036 | }; | 3041 | }; |
3037 | 3042 | ||
3038 | static unsigned int get_init_table_entry_length(struct nvbios *bios, unsigned int offset, int i) | ||
3039 | { | ||
3040 | /* Calculates the length of a given init table entry. */ | ||
3041 | return itbl_entry[i].length + bios->data[offset + itbl_entry[i].length_offset]*itbl_entry[i].length_multiplier; | ||
3042 | } | ||
3043 | |||
3044 | #define MAX_TABLE_OPS 1000 | 3043 | #define MAX_TABLE_OPS 1000 |
3045 | 3044 | ||
3046 | static int | 3045 | static int |
@@ -3056,7 +3055,7 @@ parse_init_table(struct nvbios *bios, unsigned int offset, | |||
3056 | * is changed back to EXECUTE. | 3055 | * is changed back to EXECUTE. |
3057 | */ | 3056 | */ |
3058 | 3057 | ||
3059 | int count = 0, i; | 3058 | int count = 0, i, res; |
3060 | uint8_t id; | 3059 | uint8_t id; |
3061 | 3060 | ||
3062 | /* | 3061 | /* |
@@ -3076,22 +3075,21 @@ parse_init_table(struct nvbios *bios, unsigned int offset, | |||
3076 | offset, itbl_entry[i].id, itbl_entry[i].name); | 3075 | offset, itbl_entry[i].id, itbl_entry[i].name); |
3077 | 3076 | ||
3078 | /* execute eventual command handler */ | 3077 | /* execute eventual command handler */ |
3079 | if (itbl_entry[i].handler) | 3078 | res = (*itbl_entry[i].handler)(bios, offset, iexec); |
3080 | if (!(*itbl_entry[i].handler)(bios, offset, iexec)) | 3079 | if (!res) |
3081 | break; | 3080 | break; |
3081 | /* | ||
3082 | * Add the offset of the current command including all data | ||
3083 | * of that command. The offset will then be pointing on the | ||
3084 | * next op code. | ||
3085 | */ | ||
3086 | offset += res; | ||
3082 | } else { | 3087 | } else { |
3083 | NV_ERROR(bios->dev, | 3088 | NV_ERROR(bios->dev, |
3084 | "0x%04X: Init table command not found: " | 3089 | "0x%04X: Init table command not found: " |
3085 | "0x%02X\n", offset, id); | 3090 | "0x%02X\n", offset, id); |
3086 | return -ENOENT; | 3091 | return -ENOENT; |
3087 | } | 3092 | } |
3088 | |||
3089 | /* | ||
3090 | * Add the offset of the current command including all data | ||
3091 | * of that command. The offset will then be pointing on the | ||
3092 | * next op code. | ||
3093 | */ | ||
3094 | offset += get_init_table_entry_length(bios, offset, i); | ||
3095 | } | 3093 | } |
3096 | 3094 | ||
3097 | if (offset >= bios->length) | 3095 | if (offset >= bios->length) |
@@ -3854,7 +3852,7 @@ nouveau_bios_run_display_table(struct drm_device *dev, struct dcb_entry *dcbent, | |||
3854 | * script tables is a pointer to the script to execute. | 3852 | * script tables is a pointer to the script to execute. |
3855 | */ | 3853 | */ |
3856 | 3854 | ||
3857 | NV_DEBUG(dev, "Searching for output entry for %d %d %d\n", | 3855 | NV_DEBUG_KMS(dev, "Searching for output entry for %d %d %d\n", |
3858 | dcbent->type, dcbent->location, dcbent->or); | 3856 | dcbent->type, dcbent->location, dcbent->or); |
3859 | otable = bios_output_config_match(dev, dcbent, table[1] + | 3857 | otable = bios_output_config_match(dev, dcbent, table[1] + |
3860 | bios->display.script_table_ptr, | 3858 | bios->display.script_table_ptr, |
@@ -3884,7 +3882,7 @@ nouveau_bios_run_display_table(struct drm_device *dev, struct dcb_entry *dcbent, | |||
3884 | if (pxclk == 0) { | 3882 | if (pxclk == 0) { |
3885 | script = ROM16(otable[6]); | 3883 | script = ROM16(otable[6]); |
3886 | if (!script) { | 3884 | if (!script) { |
3887 | NV_DEBUG(dev, "output script 0 not found\n"); | 3885 | NV_DEBUG_KMS(dev, "output script 0 not found\n"); |
3888 | return 1; | 3886 | return 1; |
3889 | } | 3887 | } |
3890 | 3888 | ||
@@ -3894,7 +3892,7 @@ nouveau_bios_run_display_table(struct drm_device *dev, struct dcb_entry *dcbent, | |||
3894 | if (pxclk == -1) { | 3892 | if (pxclk == -1) { |
3895 | script = ROM16(otable[8]); | 3893 | script = ROM16(otable[8]); |
3896 | if (!script) { | 3894 | if (!script) { |
3897 | NV_DEBUG(dev, "output script 1 not found\n"); | 3895 | NV_DEBUG_KMS(dev, "output script 1 not found\n"); |
3898 | return 1; | 3896 | return 1; |
3899 | } | 3897 | } |
3900 | 3898 | ||
@@ -3907,7 +3905,7 @@ nouveau_bios_run_display_table(struct drm_device *dev, struct dcb_entry *dcbent, | |||
3907 | else | 3905 | else |
3908 | script = 0; | 3906 | script = 0; |
3909 | if (!script) { | 3907 | if (!script) { |
3910 | NV_DEBUG(dev, "output script 2 not found\n"); | 3908 | NV_DEBUG_KMS(dev, "output script 2 not found\n"); |
3911 | return 1; | 3909 | return 1; |
3912 | } | 3910 | } |
3913 | 3911 | ||
@@ -3931,7 +3929,7 @@ nouveau_bios_run_display_table(struct drm_device *dev, struct dcb_entry *dcbent, | |||
3931 | if (script) | 3929 | if (script) |
3932 | script = clkcmptable(bios, script, -pxclk); | 3930 | script = clkcmptable(bios, script, -pxclk); |
3933 | if (!script) { | 3931 | if (!script) { |
3934 | NV_DEBUG(dev, "clock script 1 not found\n"); | 3932 | NV_DEBUG_KMS(dev, "clock script 1 not found\n"); |
3935 | return 1; | 3933 | return 1; |
3936 | } | 3934 | } |
3937 | 3935 | ||
@@ -4606,10 +4604,6 @@ parse_bit_M_tbl_entry(struct drm_device *dev, struct nvbios *bios, | |||
4606 | * stuff that we don't use - their use currently unknown | 4604 | * stuff that we don't use - their use currently unknown |
4607 | */ | 4605 | */ |
4608 | 4606 | ||
4609 | uint16_t rr_strap_xlat; | ||
4610 | uint8_t rr_group_count; | ||
4611 | int i; | ||
4612 | |||
4613 | /* | 4607 | /* |
4614 | * Older bios versions don't have a sufficiently long table for | 4608 | * Older bios versions don't have a sufficiently long table for |
4615 | * what we want | 4609 | * what we want |
@@ -4618,24 +4612,13 @@ parse_bit_M_tbl_entry(struct drm_device *dev, struct nvbios *bios, | |||
4618 | return 0; | 4612 | return 0; |
4619 | 4613 | ||
4620 | if (bitentry->id[1] < 2) { | 4614 | if (bitentry->id[1] < 2) { |
4621 | rr_group_count = bios->data[bitentry->offset + 2]; | 4615 | bios->ram_restrict_group_count = bios->data[bitentry->offset + 2]; |
4622 | rr_strap_xlat = ROM16(bios->data[bitentry->offset + 3]); | 4616 | bios->ram_restrict_tbl_ptr = ROM16(bios->data[bitentry->offset + 3]); |
4623 | } else { | 4617 | } else { |
4624 | rr_group_count = bios->data[bitentry->offset + 0]; | 4618 | bios->ram_restrict_group_count = bios->data[bitentry->offset + 0]; |
4625 | rr_strap_xlat = ROM16(bios->data[bitentry->offset + 1]); | 4619 | bios->ram_restrict_tbl_ptr = ROM16(bios->data[bitentry->offset + 1]); |
4626 | } | 4620 | } |
4627 | 4621 | ||
4628 | /* adjust length of INIT_87 */ | ||
4629 | for (i = 0; itbl_entry[i].name && (itbl_entry[i].id != 0x87); i++); | ||
4630 | itbl_entry[i].length += rr_group_count * 4; | ||
4631 | |||
4632 | /* set up multiplier for INIT_RAM_RESTRICT_ZM_REG_GROUP */ | ||
4633 | for (; itbl_entry[i].name && (itbl_entry[i].id != 0x8f); i++); | ||
4634 | itbl_entry[i].length_multiplier = rr_group_count * 4; | ||
4635 | |||
4636 | init_ram_restrict_zm_reg_group_blocklen = itbl_entry[i].length_multiplier; | ||
4637 | bios->ram_restrict_tbl_ptr = rr_strap_xlat; | ||
4638 | |||
4639 | return 0; | 4622 | return 0; |
4640 | } | 4623 | } |
4641 | 4624 | ||
@@ -5234,7 +5217,7 @@ parse_dcb_connector_table(struct nvbios *bios) | |||
5234 | int i; | 5217 | int i; |
5235 | 5218 | ||
5236 | if (!bios->bdcb.connector_table_ptr) { | 5219 | if (!bios->bdcb.connector_table_ptr) { |
5237 | NV_DEBUG(dev, "No DCB connector table present\n"); | 5220 | NV_DEBUG_KMS(dev, "No DCB connector table present\n"); |
5238 | return; | 5221 | return; |
5239 | } | 5222 | } |
5240 | 5223 | ||
diff --git a/drivers/gpu/drm/nouveau/nouveau_bios.h b/drivers/gpu/drm/nouveau/nouveau_bios.h index 1d5f10bd78ed..058e98c76d89 100644 --- a/drivers/gpu/drm/nouveau/nouveau_bios.h +++ b/drivers/gpu/drm/nouveau/nouveau_bios.h | |||
@@ -227,6 +227,7 @@ struct nvbios { | |||
227 | 227 | ||
228 | uint16_t pll_limit_tbl_ptr; | 228 | uint16_t pll_limit_tbl_ptr; |
229 | uint16_t ram_restrict_tbl_ptr; | 229 | uint16_t ram_restrict_tbl_ptr; |
230 | uint8_t ram_restrict_group_count; | ||
230 | 231 | ||
231 | uint16_t some_script_ptr; /* BIT I + 14 */ | 232 | uint16_t some_script_ptr; /* BIT I + 14 */ |
232 | uint16_t init96_tbl_ptr; /* BIT I + 16 */ | 233 | uint16_t init96_tbl_ptr; /* BIT I + 16 */ |
diff --git a/drivers/gpu/drm/nouveau/nouveau_bo.c b/drivers/gpu/drm/nouveau/nouveau_bo.c index aa2dfbc3e351..e342a418d434 100644 --- a/drivers/gpu/drm/nouveau/nouveau_bo.c +++ b/drivers/gpu/drm/nouveau/nouveau_bo.c | |||
@@ -33,10 +33,13 @@ | |||
33 | #include "nouveau_drv.h" | 33 | #include "nouveau_drv.h" |
34 | #include "nouveau_dma.h" | 34 | #include "nouveau_dma.h" |
35 | 35 | ||
36 | #include <linux/log2.h> | ||
37 | |||
36 | static void | 38 | static void |
37 | nouveau_bo_del_ttm(struct ttm_buffer_object *bo) | 39 | nouveau_bo_del_ttm(struct ttm_buffer_object *bo) |
38 | { | 40 | { |
39 | struct drm_nouveau_private *dev_priv = nouveau_bdev(bo->bdev); | 41 | struct drm_nouveau_private *dev_priv = nouveau_bdev(bo->bdev); |
42 | struct drm_device *dev = dev_priv->dev; | ||
40 | struct nouveau_bo *nvbo = nouveau_bo(bo); | 43 | struct nouveau_bo *nvbo = nouveau_bo(bo); |
41 | 44 | ||
42 | ttm_bo_kunmap(&nvbo->kmap); | 45 | ttm_bo_kunmap(&nvbo->kmap); |
@@ -44,12 +47,87 @@ nouveau_bo_del_ttm(struct ttm_buffer_object *bo) | |||
44 | if (unlikely(nvbo->gem)) | 47 | if (unlikely(nvbo->gem)) |
45 | DRM_ERROR("bo %p still attached to GEM object\n", bo); | 48 | DRM_ERROR("bo %p still attached to GEM object\n", bo); |
46 | 49 | ||
50 | if (nvbo->tile) | ||
51 | nv10_mem_expire_tiling(dev, nvbo->tile, NULL); | ||
52 | |||
47 | spin_lock(&dev_priv->ttm.bo_list_lock); | 53 | spin_lock(&dev_priv->ttm.bo_list_lock); |
48 | list_del(&nvbo->head); | 54 | list_del(&nvbo->head); |
49 | spin_unlock(&dev_priv->ttm.bo_list_lock); | 55 | spin_unlock(&dev_priv->ttm.bo_list_lock); |
50 | kfree(nvbo); | 56 | kfree(nvbo); |
51 | } | 57 | } |
52 | 58 | ||
59 | static void | ||
60 | nouveau_bo_fixup_align(struct drm_device *dev, | ||
61 | uint32_t tile_mode, uint32_t tile_flags, | ||
62 | int *align, int *size) | ||
63 | { | ||
64 | struct drm_nouveau_private *dev_priv = dev->dev_private; | ||
65 | |||
66 | /* | ||
67 | * Some of the tile_flags have a periodic structure of N*4096 bytes, | ||
68 | * align to to that as well as the page size. Overallocate memory to | ||
69 | * avoid corruption of other buffer objects. | ||
70 | */ | ||
71 | if (dev_priv->card_type == NV_50) { | ||
72 | uint32_t block_size = nouveau_mem_fb_amount(dev) >> 15; | ||
73 | int i; | ||
74 | |||
75 | switch (tile_flags) { | ||
76 | case 0x1800: | ||
77 | case 0x2800: | ||
78 | case 0x4800: | ||
79 | case 0x7a00: | ||
80 | *size = roundup(*size, block_size); | ||
81 | if (is_power_of_2(block_size)) { | ||
82 | *size += 3 * block_size; | ||
83 | for (i = 1; i < 10; i++) { | ||
84 | *align = 12 * i * block_size; | ||
85 | if (!(*align % 65536)) | ||
86 | break; | ||
87 | } | ||
88 | } else { | ||
89 | *size += 6 * block_size; | ||
90 | for (i = 1; i < 10; i++) { | ||
91 | *align = 8 * i * block_size; | ||
92 | if (!(*align % 65536)) | ||
93 | break; | ||
94 | } | ||
95 | } | ||
96 | break; | ||
97 | default: | ||
98 | break; | ||
99 | } | ||
100 | |||
101 | } else { | ||
102 | if (tile_mode) { | ||
103 | if (dev_priv->chipset >= 0x40) { | ||
104 | *align = 65536; | ||
105 | *size = roundup(*size, 64 * tile_mode); | ||
106 | |||
107 | } else if (dev_priv->chipset >= 0x30) { | ||
108 | *align = 32768; | ||
109 | *size = roundup(*size, 64 * tile_mode); | ||
110 | |||
111 | } else if (dev_priv->chipset >= 0x20) { | ||
112 | *align = 16384; | ||
113 | *size = roundup(*size, 64 * tile_mode); | ||
114 | |||
115 | } else if (dev_priv->chipset >= 0x10) { | ||
116 | *align = 16384; | ||
117 | *size = roundup(*size, 32 * tile_mode); | ||
118 | } | ||
119 | } | ||
120 | } | ||
121 | |||
122 | /* ALIGN works only on powers of two. */ | ||
123 | *size = roundup(*size, PAGE_SIZE); | ||
124 | |||
125 | if (dev_priv->card_type == NV_50) { | ||
126 | *size = roundup(*size, 65536); | ||
127 | *align = max(65536, *align); | ||
128 | } | ||
129 | } | ||
130 | |||
53 | int | 131 | int |
54 | nouveau_bo_new(struct drm_device *dev, struct nouveau_channel *chan, | 132 | nouveau_bo_new(struct drm_device *dev, struct nouveau_channel *chan, |
55 | int size, int align, uint32_t flags, uint32_t tile_mode, | 133 | int size, int align, uint32_t flags, uint32_t tile_mode, |
@@ -58,7 +136,7 @@ nouveau_bo_new(struct drm_device *dev, struct nouveau_channel *chan, | |||
58 | { | 136 | { |
59 | struct drm_nouveau_private *dev_priv = dev->dev_private; | 137 | struct drm_nouveau_private *dev_priv = dev->dev_private; |
60 | struct nouveau_bo *nvbo; | 138 | struct nouveau_bo *nvbo; |
61 | int ret, n = 0; | 139 | int ret = 0; |
62 | 140 | ||
63 | nvbo = kzalloc(sizeof(struct nouveau_bo), GFP_KERNEL); | 141 | nvbo = kzalloc(sizeof(struct nouveau_bo), GFP_KERNEL); |
64 | if (!nvbo) | 142 | if (!nvbo) |
@@ -70,59 +148,14 @@ nouveau_bo_new(struct drm_device *dev, struct nouveau_channel *chan, | |||
70 | nvbo->tile_mode = tile_mode; | 148 | nvbo->tile_mode = tile_mode; |
71 | nvbo->tile_flags = tile_flags; | 149 | nvbo->tile_flags = tile_flags; |
72 | 150 | ||
73 | /* | 151 | nouveau_bo_fixup_align(dev, tile_mode, tile_flags, &align, &size); |
74 | * Some of the tile_flags have a periodic structure of N*4096 bytes, | ||
75 | * align to to that as well as the page size. Overallocate memory to | ||
76 | * avoid corruption of other buffer objects. | ||
77 | */ | ||
78 | switch (tile_flags) { | ||
79 | case 0x1800: | ||
80 | case 0x2800: | ||
81 | case 0x4800: | ||
82 | case 0x7a00: | ||
83 | if (dev_priv->chipset >= 0xA0) { | ||
84 | /* This is based on high end cards with 448 bits | ||
85 | * memory bus, could be different elsewhere.*/ | ||
86 | size += 6 * 28672; | ||
87 | /* 8 * 28672 is the actual alignment requirement, | ||
88 | * but we must also align to page size. */ | ||
89 | align = 2 * 8 * 28672; | ||
90 | } else if (dev_priv->chipset >= 0x90) { | ||
91 | size += 3 * 16384; | ||
92 | align = 12 * 16834; | ||
93 | } else { | ||
94 | size += 3 * 8192; | ||
95 | /* 12 * 8192 is the actual alignment requirement, | ||
96 | * but we must also align to page size. */ | ||
97 | align = 2 * 12 * 8192; | ||
98 | } | ||
99 | break; | ||
100 | default: | ||
101 | break; | ||
102 | } | ||
103 | |||
104 | align >>= PAGE_SHIFT; | 152 | align >>= PAGE_SHIFT; |
105 | 153 | ||
106 | size = (size + (PAGE_SIZE - 1)) & ~(PAGE_SIZE - 1); | ||
107 | if (dev_priv->card_type == NV_50) { | ||
108 | size = (size + 65535) & ~65535; | ||
109 | if (align < (65536 / PAGE_SIZE)) | ||
110 | align = (65536 / PAGE_SIZE); | ||
111 | } | ||
112 | |||
113 | if (flags & TTM_PL_FLAG_VRAM) | ||
114 | nvbo->placements[n++] = TTM_PL_FLAG_VRAM | TTM_PL_MASK_CACHING; | ||
115 | if (flags & TTM_PL_FLAG_TT) | ||
116 | nvbo->placements[n++] = TTM_PL_FLAG_TT | TTM_PL_MASK_CACHING; | ||
117 | nvbo->placement.fpfn = 0; | 154 | nvbo->placement.fpfn = 0; |
118 | nvbo->placement.lpfn = mappable ? dev_priv->fb_mappable_pages : 0; | 155 | nvbo->placement.lpfn = mappable ? dev_priv->fb_mappable_pages : 0; |
119 | nvbo->placement.placement = nvbo->placements; | 156 | nouveau_bo_placement_set(nvbo, flags); |
120 | nvbo->placement.busy_placement = nvbo->placements; | ||
121 | nvbo->placement.num_placement = n; | ||
122 | nvbo->placement.num_busy_placement = n; | ||
123 | 157 | ||
124 | nvbo->channel = chan; | 158 | nvbo->channel = chan; |
125 | nouveau_bo_placement_set(nvbo, flags); | ||
126 | ret = ttm_bo_init(&dev_priv->ttm.bdev, &nvbo->bo, size, | 159 | ret = ttm_bo_init(&dev_priv->ttm.bdev, &nvbo->bo, size, |
127 | ttm_bo_type_device, &nvbo->placement, align, 0, | 160 | ttm_bo_type_device, &nvbo->placement, align, 0, |
128 | false, NULL, size, nouveau_bo_del_ttm); | 161 | false, NULL, size, nouveau_bo_del_ttm); |
@@ -154,6 +187,11 @@ nouveau_bo_placement_set(struct nouveau_bo *nvbo, uint32_t memtype) | |||
154 | nvbo->placement.busy_placement = nvbo->placements; | 187 | nvbo->placement.busy_placement = nvbo->placements; |
155 | nvbo->placement.num_placement = n; | 188 | nvbo->placement.num_placement = n; |
156 | nvbo->placement.num_busy_placement = n; | 189 | nvbo->placement.num_busy_placement = n; |
190 | |||
191 | if (nvbo->pin_refcnt) { | ||
192 | while (n--) | ||
193 | nvbo->placements[n] |= TTM_PL_FLAG_NO_EVICT; | ||
194 | } | ||
157 | } | 195 | } |
158 | 196 | ||
159 | int | 197 | int |
@@ -400,16 +438,23 @@ nouveau_bo_evict_flags(struct ttm_buffer_object *bo, struct ttm_placement *pl) | |||
400 | struct nouveau_bo *nvbo = nouveau_bo(bo); | 438 | struct nouveau_bo *nvbo = nouveau_bo(bo); |
401 | 439 | ||
402 | switch (bo->mem.mem_type) { | 440 | switch (bo->mem.mem_type) { |
441 | case TTM_PL_VRAM: | ||
442 | nouveau_bo_placement_set(nvbo, TTM_PL_FLAG_TT | | ||
443 | TTM_PL_FLAG_SYSTEM); | ||
444 | break; | ||
403 | default: | 445 | default: |
404 | nouveau_bo_placement_set(nvbo, TTM_PL_FLAG_SYSTEM); | 446 | nouveau_bo_placement_set(nvbo, TTM_PL_FLAG_SYSTEM); |
405 | break; | 447 | break; |
406 | } | 448 | } |
449 | |||
450 | *pl = nvbo->placement; | ||
407 | } | 451 | } |
408 | 452 | ||
409 | 453 | ||
410 | /* GPU-assisted copy using NV_MEMORY_TO_MEMORY_FORMAT, can access | 454 | /* GPU-assisted copy using NV_MEMORY_TO_MEMORY_FORMAT, can access |
411 | * TTM_PL_{VRAM,TT} directly. | 455 | * TTM_PL_{VRAM,TT} directly. |
412 | */ | 456 | */ |
457 | |||
413 | static int | 458 | static int |
414 | nouveau_bo_move_accel_cleanup(struct nouveau_channel *chan, | 459 | nouveau_bo_move_accel_cleanup(struct nouveau_channel *chan, |
415 | struct nouveau_bo *nvbo, bool evict, bool no_wait, | 460 | struct nouveau_bo *nvbo, bool evict, bool no_wait, |
@@ -444,22 +489,20 @@ nouveau_bo_mem_ctxdma(struct nouveau_bo *nvbo, struct nouveau_channel *chan, | |||
444 | } | 489 | } |
445 | 490 | ||
446 | static int | 491 | static int |
447 | nouveau_bo_move_m2mf(struct ttm_buffer_object *bo, int evict, int no_wait, | 492 | nouveau_bo_move_m2mf(struct ttm_buffer_object *bo, int evict, bool intr, |
448 | struct ttm_mem_reg *old_mem, struct ttm_mem_reg *new_mem) | 493 | int no_wait, struct ttm_mem_reg *new_mem) |
449 | { | 494 | { |
450 | struct nouveau_bo *nvbo = nouveau_bo(bo); | 495 | struct nouveau_bo *nvbo = nouveau_bo(bo); |
451 | struct drm_nouveau_private *dev_priv = nouveau_bdev(bo->bdev); | 496 | struct drm_nouveau_private *dev_priv = nouveau_bdev(bo->bdev); |
497 | struct ttm_mem_reg *old_mem = &bo->mem; | ||
452 | struct nouveau_channel *chan; | 498 | struct nouveau_channel *chan; |
453 | uint64_t src_offset, dst_offset; | 499 | uint64_t src_offset, dst_offset; |
454 | uint32_t page_count; | 500 | uint32_t page_count; |
455 | int ret; | 501 | int ret; |
456 | 502 | ||
457 | chan = nvbo->channel; | 503 | chan = nvbo->channel; |
458 | if (!chan || nvbo->tile_flags || nvbo->no_vm) { | 504 | if (!chan || nvbo->tile_flags || nvbo->no_vm) |
459 | chan = dev_priv->channel; | 505 | chan = dev_priv->channel; |
460 | if (!chan) | ||
461 | return -EINVAL; | ||
462 | } | ||
463 | 506 | ||
464 | src_offset = old_mem->mm_node->start << PAGE_SHIFT; | 507 | src_offset = old_mem->mm_node->start << PAGE_SHIFT; |
465 | dst_offset = new_mem->mm_node->start << PAGE_SHIFT; | 508 | dst_offset = new_mem->mm_node->start << PAGE_SHIFT; |
@@ -539,7 +582,7 @@ nouveau_bo_move_flipd(struct ttm_buffer_object *bo, bool evict, bool intr, | |||
539 | 582 | ||
540 | placement.fpfn = placement.lpfn = 0; | 583 | placement.fpfn = placement.lpfn = 0; |
541 | placement.num_placement = placement.num_busy_placement = 1; | 584 | placement.num_placement = placement.num_busy_placement = 1; |
542 | placement.placement = &placement_memtype; | 585 | placement.placement = placement.busy_placement = &placement_memtype; |
543 | 586 | ||
544 | tmp_mem = *new_mem; | 587 | tmp_mem = *new_mem; |
545 | tmp_mem.mm_node = NULL; | 588 | tmp_mem.mm_node = NULL; |
@@ -551,7 +594,7 @@ nouveau_bo_move_flipd(struct ttm_buffer_object *bo, bool evict, bool intr, | |||
551 | if (ret) | 594 | if (ret) |
552 | goto out; | 595 | goto out; |
553 | 596 | ||
554 | ret = nouveau_bo_move_m2mf(bo, true, no_wait, &bo->mem, &tmp_mem); | 597 | ret = nouveau_bo_move_m2mf(bo, true, intr, no_wait, &tmp_mem); |
555 | if (ret) | 598 | if (ret) |
556 | goto out; | 599 | goto out; |
557 | 600 | ||
@@ -577,7 +620,7 @@ nouveau_bo_move_flips(struct ttm_buffer_object *bo, bool evict, bool intr, | |||
577 | 620 | ||
578 | placement.fpfn = placement.lpfn = 0; | 621 | placement.fpfn = placement.lpfn = 0; |
579 | placement.num_placement = placement.num_busy_placement = 1; | 622 | placement.num_placement = placement.num_busy_placement = 1; |
580 | placement.placement = &placement_memtype; | 623 | placement.placement = placement.busy_placement = &placement_memtype; |
581 | 624 | ||
582 | tmp_mem = *new_mem; | 625 | tmp_mem = *new_mem; |
583 | tmp_mem.mm_node = NULL; | 626 | tmp_mem.mm_node = NULL; |
@@ -589,7 +632,7 @@ nouveau_bo_move_flips(struct ttm_buffer_object *bo, bool evict, bool intr, | |||
589 | if (ret) | 632 | if (ret) |
590 | goto out; | 633 | goto out; |
591 | 634 | ||
592 | ret = nouveau_bo_move_m2mf(bo, true, no_wait, &bo->mem, new_mem); | 635 | ret = nouveau_bo_move_m2mf(bo, evict, intr, no_wait, new_mem); |
593 | if (ret) | 636 | if (ret) |
594 | goto out; | 637 | goto out; |
595 | 638 | ||
@@ -604,51 +647,106 @@ out: | |||
604 | } | 647 | } |
605 | 648 | ||
606 | static int | 649 | static int |
607 | nouveau_bo_move(struct ttm_buffer_object *bo, bool evict, bool intr, | 650 | nouveau_bo_vm_bind(struct ttm_buffer_object *bo, struct ttm_mem_reg *new_mem, |
608 | bool no_wait, struct ttm_mem_reg *new_mem) | 651 | struct nouveau_tile_reg **new_tile) |
609 | { | 652 | { |
610 | struct drm_nouveau_private *dev_priv = nouveau_bdev(bo->bdev); | 653 | struct drm_nouveau_private *dev_priv = nouveau_bdev(bo->bdev); |
611 | struct nouveau_bo *nvbo = nouveau_bo(bo); | ||
612 | struct drm_device *dev = dev_priv->dev; | 654 | struct drm_device *dev = dev_priv->dev; |
613 | struct ttm_mem_reg *old_mem = &bo->mem; | 655 | struct nouveau_bo *nvbo = nouveau_bo(bo); |
656 | uint64_t offset; | ||
614 | int ret; | 657 | int ret; |
615 | 658 | ||
616 | if (dev_priv->card_type == NV_50 && new_mem->mem_type == TTM_PL_VRAM && | 659 | if (nvbo->no_vm || new_mem->mem_type != TTM_PL_VRAM) { |
617 | !nvbo->no_vm) { | 660 | /* Nothing to do. */ |
618 | uint64_t offset = new_mem->mm_node->start << PAGE_SHIFT; | 661 | *new_tile = NULL; |
662 | return 0; | ||
663 | } | ||
619 | 664 | ||
665 | offset = new_mem->mm_node->start << PAGE_SHIFT; | ||
666 | |||
667 | if (dev_priv->card_type == NV_50) { | ||
620 | ret = nv50_mem_vm_bind_linear(dev, | 668 | ret = nv50_mem_vm_bind_linear(dev, |
621 | offset + dev_priv->vm_vram_base, | 669 | offset + dev_priv->vm_vram_base, |
622 | new_mem->size, nvbo->tile_flags, | 670 | new_mem->size, nvbo->tile_flags, |
623 | offset); | 671 | offset); |
624 | if (ret) | 672 | if (ret) |
625 | return ret; | 673 | return ret; |
674 | |||
675 | } else if (dev_priv->card_type >= NV_10) { | ||
676 | *new_tile = nv10_mem_set_tiling(dev, offset, new_mem->size, | ||
677 | nvbo->tile_mode); | ||
626 | } | 678 | } |
627 | 679 | ||
628 | if (dev_priv->init_state != NOUVEAU_CARD_INIT_DONE) | 680 | return 0; |
629 | return ttm_bo_move_memcpy(bo, evict, no_wait, new_mem); | 681 | } |
682 | |||
683 | static void | ||
684 | nouveau_bo_vm_cleanup(struct ttm_buffer_object *bo, | ||
685 | struct nouveau_tile_reg *new_tile, | ||
686 | struct nouveau_tile_reg **old_tile) | ||
687 | { | ||
688 | struct drm_nouveau_private *dev_priv = nouveau_bdev(bo->bdev); | ||
689 | struct drm_device *dev = dev_priv->dev; | ||
630 | 690 | ||
691 | if (dev_priv->card_type >= NV_10 && | ||
692 | dev_priv->card_type < NV_50) { | ||
693 | if (*old_tile) | ||
694 | nv10_mem_expire_tiling(dev, *old_tile, bo->sync_obj); | ||
695 | |||
696 | *old_tile = new_tile; | ||
697 | } | ||
698 | } | ||
699 | |||
700 | static int | ||
701 | nouveau_bo_move(struct ttm_buffer_object *bo, bool evict, bool intr, | ||
702 | bool no_wait, struct ttm_mem_reg *new_mem) | ||
703 | { | ||
704 | struct drm_nouveau_private *dev_priv = nouveau_bdev(bo->bdev); | ||
705 | struct nouveau_bo *nvbo = nouveau_bo(bo); | ||
706 | struct ttm_mem_reg *old_mem = &bo->mem; | ||
707 | struct nouveau_tile_reg *new_tile = NULL; | ||
708 | int ret = 0; | ||
709 | |||
710 | ret = nouveau_bo_vm_bind(bo, new_mem, &new_tile); | ||
711 | if (ret) | ||
712 | return ret; | ||
713 | |||
714 | /* Software copy if the card isn't up and running yet. */ | ||
715 | if (dev_priv->init_state != NOUVEAU_CARD_INIT_DONE || | ||
716 | !dev_priv->channel) { | ||
717 | ret = ttm_bo_move_memcpy(bo, evict, no_wait, new_mem); | ||
718 | goto out; | ||
719 | } | ||
720 | |||
721 | /* Fake bo copy. */ | ||
631 | if (old_mem->mem_type == TTM_PL_SYSTEM && !bo->ttm) { | 722 | if (old_mem->mem_type == TTM_PL_SYSTEM && !bo->ttm) { |
632 | BUG_ON(bo->mem.mm_node != NULL); | 723 | BUG_ON(bo->mem.mm_node != NULL); |
633 | bo->mem = *new_mem; | 724 | bo->mem = *new_mem; |
634 | new_mem->mm_node = NULL; | 725 | new_mem->mm_node = NULL; |
635 | return 0; | 726 | goto out; |
636 | } | 727 | } |
637 | 728 | ||
638 | if (new_mem->mem_type == TTM_PL_SYSTEM) { | 729 | /* Hardware assisted copy. */ |
639 | if (old_mem->mem_type == TTM_PL_SYSTEM) | 730 | if (new_mem->mem_type == TTM_PL_SYSTEM) |
640 | return ttm_bo_move_memcpy(bo, evict, no_wait, new_mem); | 731 | ret = nouveau_bo_move_flipd(bo, evict, intr, no_wait, new_mem); |
641 | if (nouveau_bo_move_flipd(bo, evict, intr, no_wait, new_mem)) | 732 | else if (old_mem->mem_type == TTM_PL_SYSTEM) |
642 | return ttm_bo_move_memcpy(bo, evict, no_wait, new_mem); | 733 | ret = nouveau_bo_move_flips(bo, evict, intr, no_wait, new_mem); |
643 | } else if (old_mem->mem_type == TTM_PL_SYSTEM) { | 734 | else |
644 | if (nouveau_bo_move_flips(bo, evict, intr, no_wait, new_mem)) | 735 | ret = nouveau_bo_move_m2mf(bo, evict, intr, no_wait, new_mem); |
645 | return ttm_bo_move_memcpy(bo, evict, no_wait, new_mem); | ||
646 | } else { | ||
647 | if (nouveau_bo_move_m2mf(bo, evict, no_wait, old_mem, new_mem)) | ||
648 | return ttm_bo_move_memcpy(bo, evict, no_wait, new_mem); | ||
649 | } | ||
650 | 736 | ||
651 | return 0; | 737 | if (!ret) |
738 | goto out; | ||
739 | |||
740 | /* Fallback to software copy. */ | ||
741 | ret = ttm_bo_move_memcpy(bo, evict, no_wait, new_mem); | ||
742 | |||
743 | out: | ||
744 | if (ret) | ||
745 | nouveau_bo_vm_cleanup(bo, NULL, &new_tile); | ||
746 | else | ||
747 | nouveau_bo_vm_cleanup(bo, new_tile, &nvbo->tile); | ||
748 | |||
749 | return ret; | ||
652 | } | 750 | } |
653 | 751 | ||
654 | static int | 752 | static int |
diff --git a/drivers/gpu/drm/nouveau/nouveau_channel.c b/drivers/gpu/drm/nouveau/nouveau_channel.c index 9aaa972f8822..343d718a9667 100644 --- a/drivers/gpu/drm/nouveau/nouveau_channel.c +++ b/drivers/gpu/drm/nouveau/nouveau_channel.c | |||
@@ -158,6 +158,8 @@ nouveau_channel_alloc(struct drm_device *dev, struct nouveau_channel **chan_ret, | |||
158 | return ret; | 158 | return ret; |
159 | } | 159 | } |
160 | 160 | ||
161 | nouveau_dma_pre_init(chan); | ||
162 | |||
161 | /* Locate channel's user control regs */ | 163 | /* Locate channel's user control regs */ |
162 | if (dev_priv->card_type < NV_40) | 164 | if (dev_priv->card_type < NV_40) |
163 | user = NV03_USER(channel); | 165 | user = NV03_USER(channel); |
@@ -235,47 +237,6 @@ nouveau_channel_alloc(struct drm_device *dev, struct nouveau_channel **chan_ret, | |||
235 | return 0; | 237 | return 0; |
236 | } | 238 | } |
237 | 239 | ||
238 | int | ||
239 | nouveau_channel_idle(struct nouveau_channel *chan) | ||
240 | { | ||
241 | struct drm_device *dev = chan->dev; | ||
242 | struct drm_nouveau_private *dev_priv = dev->dev_private; | ||
243 | struct nouveau_engine *engine = &dev_priv->engine; | ||
244 | uint32_t caches; | ||
245 | int idle; | ||
246 | |||
247 | if (!chan) { | ||
248 | NV_ERROR(dev, "no channel...\n"); | ||
249 | return 1; | ||
250 | } | ||
251 | |||
252 | caches = nv_rd32(dev, NV03_PFIFO_CACHES); | ||
253 | nv_wr32(dev, NV03_PFIFO_CACHES, caches & ~1); | ||
254 | |||
255 | if (engine->fifo.channel_id(dev) != chan->id) { | ||
256 | struct nouveau_gpuobj *ramfc = | ||
257 | chan->ramfc ? chan->ramfc->gpuobj : NULL; | ||
258 | |||
259 | if (!ramfc) { | ||
260 | NV_ERROR(dev, "No RAMFC for channel %d\n", chan->id); | ||
261 | return 1; | ||
262 | } | ||
263 | |||
264 | engine->instmem.prepare_access(dev, false); | ||
265 | if (nv_ro32(dev, ramfc, 0) != nv_ro32(dev, ramfc, 1)) | ||
266 | idle = 0; | ||
267 | else | ||
268 | idle = 1; | ||
269 | engine->instmem.finish_access(dev); | ||
270 | } else { | ||
271 | idle = (nv_rd32(dev, NV04_PFIFO_CACHE1_DMA_GET) == | ||
272 | nv_rd32(dev, NV04_PFIFO_CACHE1_DMA_PUT)); | ||
273 | } | ||
274 | |||
275 | nv_wr32(dev, NV03_PFIFO_CACHES, caches); | ||
276 | return idle; | ||
277 | } | ||
278 | |||
279 | /* stops a fifo */ | 240 | /* stops a fifo */ |
280 | void | 241 | void |
281 | nouveau_channel_free(struct nouveau_channel *chan) | 242 | nouveau_channel_free(struct nouveau_channel *chan) |
@@ -414,7 +375,9 @@ nouveau_ioctl_fifo_alloc(struct drm_device *dev, void *data, | |||
414 | init->subchan[0].grclass = 0x0039; | 375 | init->subchan[0].grclass = 0x0039; |
415 | else | 376 | else |
416 | init->subchan[0].grclass = 0x5039; | 377 | init->subchan[0].grclass = 0x5039; |
417 | init->nr_subchan = 1; | 378 | init->subchan[1].handle = NvSw; |
379 | init->subchan[1].grclass = NV_SW; | ||
380 | init->nr_subchan = 2; | ||
418 | 381 | ||
419 | /* Named memory object area */ | 382 | /* Named memory object area */ |
420 | ret = drm_gem_handle_create(file_priv, chan->notifier_bo->gem, | 383 | ret = drm_gem_handle_create(file_priv, chan->notifier_bo->gem, |
diff --git a/drivers/gpu/drm/nouveau/nouveau_connector.c b/drivers/gpu/drm/nouveau/nouveau_connector.c index 032cf098fa1c..5a10deb8bdbd 100644 --- a/drivers/gpu/drm/nouveau/nouveau_connector.c +++ b/drivers/gpu/drm/nouveau/nouveau_connector.c | |||
@@ -86,7 +86,7 @@ nouveau_connector_destroy(struct drm_connector *drm_connector) | |||
86 | struct nouveau_connector *connector = nouveau_connector(drm_connector); | 86 | struct nouveau_connector *connector = nouveau_connector(drm_connector); |
87 | struct drm_device *dev = connector->base.dev; | 87 | struct drm_device *dev = connector->base.dev; |
88 | 88 | ||
89 | NV_DEBUG(dev, "\n"); | 89 | NV_DEBUG_KMS(dev, "\n"); |
90 | 90 | ||
91 | if (!connector) | 91 | if (!connector) |
92 | return; | 92 | return; |
@@ -420,7 +420,7 @@ nouveau_connector_native_mode(struct nouveau_connector *connector) | |||
420 | /* Use preferred mode if there is one.. */ | 420 | /* Use preferred mode if there is one.. */ |
421 | list_for_each_entry(mode, &connector->base.probed_modes, head) { | 421 | list_for_each_entry(mode, &connector->base.probed_modes, head) { |
422 | if (mode->type & DRM_MODE_TYPE_PREFERRED) { | 422 | if (mode->type & DRM_MODE_TYPE_PREFERRED) { |
423 | NV_DEBUG(dev, "native mode from preferred\n"); | 423 | NV_DEBUG_KMS(dev, "native mode from preferred\n"); |
424 | return drm_mode_duplicate(dev, mode); | 424 | return drm_mode_duplicate(dev, mode); |
425 | } | 425 | } |
426 | } | 426 | } |
@@ -445,7 +445,7 @@ nouveau_connector_native_mode(struct nouveau_connector *connector) | |||
445 | largest = mode; | 445 | largest = mode; |
446 | } | 446 | } |
447 | 447 | ||
448 | NV_DEBUG(dev, "native mode from largest: %dx%d@%d\n", | 448 | NV_DEBUG_KMS(dev, "native mode from largest: %dx%d@%d\n", |
449 | high_w, high_h, high_v); | 449 | high_w, high_h, high_v); |
450 | return largest ? drm_mode_duplicate(dev, largest) : NULL; | 450 | return largest ? drm_mode_duplicate(dev, largest) : NULL; |
451 | } | 451 | } |
@@ -725,7 +725,7 @@ nouveau_connector_create(struct drm_device *dev, int index, int type) | |||
725 | struct drm_encoder *encoder; | 725 | struct drm_encoder *encoder; |
726 | int ret; | 726 | int ret; |
727 | 727 | ||
728 | NV_DEBUG(dev, "\n"); | 728 | NV_DEBUG_KMS(dev, "\n"); |
729 | 729 | ||
730 | nv_connector = kzalloc(sizeof(*nv_connector), GFP_KERNEL); | 730 | nv_connector = kzalloc(sizeof(*nv_connector), GFP_KERNEL); |
731 | if (!nv_connector) | 731 | if (!nv_connector) |
diff --git a/drivers/gpu/drm/nouveau/nouveau_dma.c b/drivers/gpu/drm/nouveau/nouveau_dma.c index 703553687b20..7afbe8b40d51 100644 --- a/drivers/gpu/drm/nouveau/nouveau_dma.c +++ b/drivers/gpu/drm/nouveau/nouveau_dma.c | |||
@@ -29,12 +29,22 @@ | |||
29 | #include "nouveau_drv.h" | 29 | #include "nouveau_drv.h" |
30 | #include "nouveau_dma.h" | 30 | #include "nouveau_dma.h" |
31 | 31 | ||
32 | void | ||
33 | nouveau_dma_pre_init(struct nouveau_channel *chan) | ||
34 | { | ||
35 | chan->dma.max = (chan->pushbuf_bo->bo.mem.size >> 2) - 2; | ||
36 | chan->dma.put = 0; | ||
37 | chan->dma.cur = chan->dma.put; | ||
38 | chan->dma.free = chan->dma.max - chan->dma.cur; | ||
39 | } | ||
40 | |||
32 | int | 41 | int |
33 | nouveau_dma_init(struct nouveau_channel *chan) | 42 | nouveau_dma_init(struct nouveau_channel *chan) |
34 | { | 43 | { |
35 | struct drm_device *dev = chan->dev; | 44 | struct drm_device *dev = chan->dev; |
36 | struct drm_nouveau_private *dev_priv = dev->dev_private; | 45 | struct drm_nouveau_private *dev_priv = dev->dev_private; |
37 | struct nouveau_gpuobj *m2mf = NULL; | 46 | struct nouveau_gpuobj *m2mf = NULL; |
47 | struct nouveau_gpuobj *nvsw = NULL; | ||
38 | int ret, i; | 48 | int ret, i; |
39 | 49 | ||
40 | /* Create NV_MEMORY_TO_MEMORY_FORMAT for buffer moves */ | 50 | /* Create NV_MEMORY_TO_MEMORY_FORMAT for buffer moves */ |
@@ -47,6 +57,15 @@ nouveau_dma_init(struct nouveau_channel *chan) | |||
47 | if (ret) | 57 | if (ret) |
48 | return ret; | 58 | return ret; |
49 | 59 | ||
60 | /* Create an NV_SW object for various sync purposes */ | ||
61 | ret = nouveau_gpuobj_sw_new(chan, NV_SW, &nvsw); | ||
62 | if (ret) | ||
63 | return ret; | ||
64 | |||
65 | ret = nouveau_gpuobj_ref_add(dev, chan, NvSw, nvsw, NULL); | ||
66 | if (ret) | ||
67 | return ret; | ||
68 | |||
50 | /* NV_MEMORY_TO_MEMORY_FORMAT requires a notifier object */ | 69 | /* NV_MEMORY_TO_MEMORY_FORMAT requires a notifier object */ |
51 | ret = nouveau_notifier_alloc(chan, NvNotify0, 32, &chan->m2mf_ntfy); | 70 | ret = nouveau_notifier_alloc(chan, NvNotify0, 32, &chan->m2mf_ntfy); |
52 | if (ret) | 71 | if (ret) |
@@ -64,12 +83,6 @@ nouveau_dma_init(struct nouveau_channel *chan) | |||
64 | return ret; | 83 | return ret; |
65 | } | 84 | } |
66 | 85 | ||
67 | /* Initialise DMA vars */ | ||
68 | chan->dma.max = (chan->pushbuf_bo->bo.mem.size >> 2) - 2; | ||
69 | chan->dma.put = 0; | ||
70 | chan->dma.cur = chan->dma.put; | ||
71 | chan->dma.free = chan->dma.max - chan->dma.cur; | ||
72 | |||
73 | /* Insert NOPS for NOUVEAU_DMA_SKIPS */ | 86 | /* Insert NOPS for NOUVEAU_DMA_SKIPS */ |
74 | ret = RING_SPACE(chan, NOUVEAU_DMA_SKIPS); | 87 | ret = RING_SPACE(chan, NOUVEAU_DMA_SKIPS); |
75 | if (ret) | 88 | if (ret) |
@@ -87,6 +100,13 @@ nouveau_dma_init(struct nouveau_channel *chan) | |||
87 | BEGIN_RING(chan, NvSubM2MF, NV_MEMORY_TO_MEMORY_FORMAT_DMA_NOTIFY, 1); | 100 | BEGIN_RING(chan, NvSubM2MF, NV_MEMORY_TO_MEMORY_FORMAT_DMA_NOTIFY, 1); |
88 | OUT_RING(chan, NvNotify0); | 101 | OUT_RING(chan, NvNotify0); |
89 | 102 | ||
103 | /* Initialise NV_SW */ | ||
104 | ret = RING_SPACE(chan, 2); | ||
105 | if (ret) | ||
106 | return ret; | ||
107 | BEGIN_RING(chan, NvSubSw, 0, 1); | ||
108 | OUT_RING(chan, NvSw); | ||
109 | |||
90 | /* Sit back and pray the channel works.. */ | 110 | /* Sit back and pray the channel works.. */ |
91 | FIRE_RING(chan); | 111 | FIRE_RING(chan); |
92 | 112 | ||
@@ -113,7 +133,7 @@ READ_GET(struct nouveau_channel *chan, uint32_t *get) | |||
113 | 133 | ||
114 | val = nvchan_rd32(chan, chan->user_get); | 134 | val = nvchan_rd32(chan, chan->user_get); |
115 | if (val < chan->pushbuf_base || | 135 | if (val < chan->pushbuf_base || |
116 | val >= chan->pushbuf_base + chan->pushbuf_bo->bo.mem.size) { | 136 | val > chan->pushbuf_base + (chan->dma.max << 2)) { |
117 | /* meaningless to dma_wait() except to know whether the | 137 | /* meaningless to dma_wait() except to know whether the |
118 | * GPU has stalled or not | 138 | * GPU has stalled or not |
119 | */ | 139 | */ |
diff --git a/drivers/gpu/drm/nouveau/nouveau_dma.h b/drivers/gpu/drm/nouveau/nouveau_dma.h index 04e85d8f757e..dabfd655f93e 100644 --- a/drivers/gpu/drm/nouveau/nouveau_dma.h +++ b/drivers/gpu/drm/nouveau/nouveau_dma.h | |||
@@ -46,10 +46,11 @@ | |||
46 | /* Hardcoded object assignments to subchannels (subchannel id). */ | 46 | /* Hardcoded object assignments to subchannels (subchannel id). */ |
47 | enum { | 47 | enum { |
48 | NvSubM2MF = 0, | 48 | NvSubM2MF = 0, |
49 | NvSub2D = 1, | 49 | NvSubSw = 1, |
50 | NvSubCtxSurf2D = 1, | 50 | NvSub2D = 2, |
51 | NvSubGdiRect = 2, | 51 | NvSubCtxSurf2D = 2, |
52 | NvSubImageBlit = 3 | 52 | NvSubGdiRect = 3, |
53 | NvSubImageBlit = 4 | ||
53 | }; | 54 | }; |
54 | 55 | ||
55 | /* Object handles. */ | 56 | /* Object handles. */ |
@@ -67,6 +68,7 @@ enum { | |||
67 | NvClipRect = 0x8000000b, | 68 | NvClipRect = 0x8000000b, |
68 | NvGdiRect = 0x8000000c, | 69 | NvGdiRect = 0x8000000c, |
69 | NvImageBlit = 0x8000000d, | 70 | NvImageBlit = 0x8000000d, |
71 | NvSw = 0x8000000e, | ||
70 | 72 | ||
71 | /* G80+ display objects */ | 73 | /* G80+ display objects */ |
72 | NvEvoVRAM = 0x01000000, | 74 | NvEvoVRAM = 0x01000000, |
diff --git a/drivers/gpu/drm/nouveau/nouveau_dp.c b/drivers/gpu/drm/nouveau/nouveau_dp.c index de61f4640e12..9e2926c48579 100644 --- a/drivers/gpu/drm/nouveau/nouveau_dp.c +++ b/drivers/gpu/drm/nouveau/nouveau_dp.c | |||
@@ -187,7 +187,7 @@ nouveau_dp_link_train_adjust(struct drm_encoder *encoder, uint8_t *config) | |||
187 | if (ret) | 187 | if (ret) |
188 | return false; | 188 | return false; |
189 | 189 | ||
190 | NV_DEBUG(dev, "\t\tadjust 0x%02x 0x%02x\n", request[0], request[1]); | 190 | NV_DEBUG_KMS(dev, "\t\tadjust 0x%02x 0x%02x\n", request[0], request[1]); |
191 | 191 | ||
192 | /* Keep all lanes at the same level.. */ | 192 | /* Keep all lanes at the same level.. */ |
193 | for (i = 0; i < nv_encoder->dp.link_nr; i++) { | 193 | for (i = 0; i < nv_encoder->dp.link_nr; i++) { |
@@ -228,7 +228,7 @@ nouveau_dp_link_train_commit(struct drm_encoder *encoder, uint8_t *config) | |||
228 | int or = nv_encoder->or, link = !(nv_encoder->dcb->sorconf.link & 1); | 228 | int or = nv_encoder->or, link = !(nv_encoder->dcb->sorconf.link & 1); |
229 | int dpe_headerlen, ret, i; | 229 | int dpe_headerlen, ret, i; |
230 | 230 | ||
231 | NV_DEBUG(dev, "\t\tconfig 0x%02x 0x%02x 0x%02x 0x%02x\n", | 231 | NV_DEBUG_KMS(dev, "\t\tconfig 0x%02x 0x%02x 0x%02x 0x%02x\n", |
232 | config[0], config[1], config[2], config[3]); | 232 | config[0], config[1], config[2], config[3]); |
233 | 233 | ||
234 | dpe = nouveau_bios_dp_table(dev, nv_encoder->dcb, &dpe_headerlen); | 234 | dpe = nouveau_bios_dp_table(dev, nv_encoder->dcb, &dpe_headerlen); |
@@ -276,12 +276,12 @@ nouveau_dp_link_train(struct drm_encoder *encoder) | |||
276 | bool cr_done, cr_max_vs, eq_done; | 276 | bool cr_done, cr_max_vs, eq_done; |
277 | int ret = 0, i, tries, voltage; | 277 | int ret = 0, i, tries, voltage; |
278 | 278 | ||
279 | NV_DEBUG(dev, "link training!!\n"); | 279 | NV_DEBUG_KMS(dev, "link training!!\n"); |
280 | train: | 280 | train: |
281 | cr_done = eq_done = false; | 281 | cr_done = eq_done = false; |
282 | 282 | ||
283 | /* set link configuration */ | 283 | /* set link configuration */ |
284 | NV_DEBUG(dev, "\tbegin train: bw %d, lanes %d\n", | 284 | NV_DEBUG_KMS(dev, "\tbegin train: bw %d, lanes %d\n", |
285 | nv_encoder->dp.link_bw, nv_encoder->dp.link_nr); | 285 | nv_encoder->dp.link_bw, nv_encoder->dp.link_nr); |
286 | 286 | ||
287 | ret = nouveau_dp_link_bw_set(encoder, nv_encoder->dp.link_bw); | 287 | ret = nouveau_dp_link_bw_set(encoder, nv_encoder->dp.link_bw); |
@@ -297,7 +297,7 @@ train: | |||
297 | return false; | 297 | return false; |
298 | 298 | ||
299 | /* clock recovery */ | 299 | /* clock recovery */ |
300 | NV_DEBUG(dev, "\tbegin cr\n"); | 300 | NV_DEBUG_KMS(dev, "\tbegin cr\n"); |
301 | ret = nouveau_dp_link_train_set(encoder, DP_TRAINING_PATTERN_1); | 301 | ret = nouveau_dp_link_train_set(encoder, DP_TRAINING_PATTERN_1); |
302 | if (ret) | 302 | if (ret) |
303 | goto stop; | 303 | goto stop; |
@@ -314,7 +314,7 @@ train: | |||
314 | ret = auxch_rd(encoder, DP_LANE0_1_STATUS, status, 2); | 314 | ret = auxch_rd(encoder, DP_LANE0_1_STATUS, status, 2); |
315 | if (ret) | 315 | if (ret) |
316 | break; | 316 | break; |
317 | NV_DEBUG(dev, "\t\tstatus: 0x%02x 0x%02x\n", | 317 | NV_DEBUG_KMS(dev, "\t\tstatus: 0x%02x 0x%02x\n", |
318 | status[0], status[1]); | 318 | status[0], status[1]); |
319 | 319 | ||
320 | cr_done = true; | 320 | cr_done = true; |
@@ -346,7 +346,7 @@ train: | |||
346 | goto stop; | 346 | goto stop; |
347 | 347 | ||
348 | /* channel equalisation */ | 348 | /* channel equalisation */ |
349 | NV_DEBUG(dev, "\tbegin eq\n"); | 349 | NV_DEBUG_KMS(dev, "\tbegin eq\n"); |
350 | ret = nouveau_dp_link_train_set(encoder, DP_TRAINING_PATTERN_2); | 350 | ret = nouveau_dp_link_train_set(encoder, DP_TRAINING_PATTERN_2); |
351 | if (ret) | 351 | if (ret) |
352 | goto stop; | 352 | goto stop; |
@@ -357,7 +357,7 @@ train: | |||
357 | ret = auxch_rd(encoder, DP_LANE0_1_STATUS, status, 3); | 357 | ret = auxch_rd(encoder, DP_LANE0_1_STATUS, status, 3); |
358 | if (ret) | 358 | if (ret) |
359 | break; | 359 | break; |
360 | NV_DEBUG(dev, "\t\tstatus: 0x%02x 0x%02x\n", | 360 | NV_DEBUG_KMS(dev, "\t\tstatus: 0x%02x 0x%02x\n", |
361 | status[0], status[1]); | 361 | status[0], status[1]); |
362 | 362 | ||
363 | eq_done = true; | 363 | eq_done = true; |
@@ -395,9 +395,9 @@ stop: | |||
395 | 395 | ||
396 | /* retry at a lower setting, if possible */ | 396 | /* retry at a lower setting, if possible */ |
397 | if (!ret && !(eq_done && cr_done)) { | 397 | if (!ret && !(eq_done && cr_done)) { |
398 | NV_DEBUG(dev, "\twe failed\n"); | 398 | NV_DEBUG_KMS(dev, "\twe failed\n"); |
399 | if (nv_encoder->dp.link_bw != DP_LINK_BW_1_62) { | 399 | if (nv_encoder->dp.link_bw != DP_LINK_BW_1_62) { |
400 | NV_DEBUG(dev, "retry link training at low rate\n"); | 400 | NV_DEBUG_KMS(dev, "retry link training at low rate\n"); |
401 | nv_encoder->dp.link_bw = DP_LINK_BW_1_62; | 401 | nv_encoder->dp.link_bw = DP_LINK_BW_1_62; |
402 | goto train; | 402 | goto train; |
403 | } | 403 | } |
@@ -418,7 +418,7 @@ nouveau_dp_detect(struct drm_encoder *encoder) | |||
418 | if (ret) | 418 | if (ret) |
419 | return false; | 419 | return false; |
420 | 420 | ||
421 | NV_DEBUG(dev, "encoder: link_bw %d, link_nr %d\n" | 421 | NV_DEBUG_KMS(dev, "encoder: link_bw %d, link_nr %d\n" |
422 | "display: link_bw %d, link_nr %d version 0x%02x\n", | 422 | "display: link_bw %d, link_nr %d version 0x%02x\n", |
423 | nv_encoder->dcb->dpconf.link_bw, | 423 | nv_encoder->dcb->dpconf.link_bw, |
424 | nv_encoder->dcb->dpconf.link_nr, | 424 | nv_encoder->dcb->dpconf.link_nr, |
@@ -446,7 +446,7 @@ nouveau_dp_auxch(struct nouveau_i2c_chan *auxch, int cmd, int addr, | |||
446 | uint32_t tmp, ctrl, stat = 0, data32[4] = {}; | 446 | uint32_t tmp, ctrl, stat = 0, data32[4] = {}; |
447 | int ret = 0, i, index = auxch->rd; | 447 | int ret = 0, i, index = auxch->rd; |
448 | 448 | ||
449 | NV_DEBUG(dev, "ch %d cmd %d addr 0x%x len %d\n", index, cmd, addr, data_nr); | 449 | NV_DEBUG_KMS(dev, "ch %d cmd %d addr 0x%x len %d\n", index, cmd, addr, data_nr); |
450 | 450 | ||
451 | tmp = nv_rd32(dev, NV50_AUXCH_CTRL(auxch->rd)); | 451 | tmp = nv_rd32(dev, NV50_AUXCH_CTRL(auxch->rd)); |
452 | nv_wr32(dev, NV50_AUXCH_CTRL(auxch->rd), tmp | 0x00100000); | 452 | nv_wr32(dev, NV50_AUXCH_CTRL(auxch->rd), tmp | 0x00100000); |
@@ -472,7 +472,7 @@ nouveau_dp_auxch(struct nouveau_i2c_chan *auxch, int cmd, int addr, | |||
472 | if (!(cmd & 1)) { | 472 | if (!(cmd & 1)) { |
473 | memcpy(data32, data, data_nr); | 473 | memcpy(data32, data, data_nr); |
474 | for (i = 0; i < 4; i++) { | 474 | for (i = 0; i < 4; i++) { |
475 | NV_DEBUG(dev, "wr %d: 0x%08x\n", i, data32[i]); | 475 | NV_DEBUG_KMS(dev, "wr %d: 0x%08x\n", i, data32[i]); |
476 | nv_wr32(dev, NV50_AUXCH_DATA_OUT(index, i), data32[i]); | 476 | nv_wr32(dev, NV50_AUXCH_DATA_OUT(index, i), data32[i]); |
477 | } | 477 | } |
478 | } | 478 | } |
@@ -504,7 +504,7 @@ nouveau_dp_auxch(struct nouveau_i2c_chan *auxch, int cmd, int addr, | |||
504 | if (cmd & 1) { | 504 | if (cmd & 1) { |
505 | for (i = 0; i < 4; i++) { | 505 | for (i = 0; i < 4; i++) { |
506 | data32[i] = nv_rd32(dev, NV50_AUXCH_DATA_IN(index, i)); | 506 | data32[i] = nv_rd32(dev, NV50_AUXCH_DATA_IN(index, i)); |
507 | NV_DEBUG(dev, "rd %d: 0x%08x\n", i, data32[i]); | 507 | NV_DEBUG_KMS(dev, "rd %d: 0x%08x\n", i, data32[i]); |
508 | } | 508 | } |
509 | memcpy(data, data32, data_nr); | 509 | memcpy(data, data32, data_nr); |
510 | } | 510 | } |
diff --git a/drivers/gpu/drm/nouveau/nouveau_drv.c b/drivers/gpu/drm/nouveau/nouveau_drv.c index 35249c35118f..06eb993e0883 100644 --- a/drivers/gpu/drm/nouveau/nouveau_drv.c +++ b/drivers/gpu/drm/nouveau/nouveau_drv.c | |||
@@ -35,6 +35,10 @@ | |||
35 | 35 | ||
36 | #include "drm_pciids.h" | 36 | #include "drm_pciids.h" |
37 | 37 | ||
38 | MODULE_PARM_DESC(ctxfw, "Use external firmware blob for grctx init (NV40)"); | ||
39 | int nouveau_ctxfw = 0; | ||
40 | module_param_named(ctxfw, nouveau_ctxfw, int, 0400); | ||
41 | |||
38 | MODULE_PARM_DESC(noagp, "Disable AGP"); | 42 | MODULE_PARM_DESC(noagp, "Disable AGP"); |
39 | int nouveau_noagp; | 43 | int nouveau_noagp; |
40 | module_param_named(noagp, nouveau_noagp, int, 0400); | 44 | module_param_named(noagp, nouveau_noagp, int, 0400); |
@@ -273,7 +277,7 @@ nouveau_pci_resume(struct pci_dev *pdev) | |||
273 | 277 | ||
274 | for (i = 0; i < dev_priv->engine.fifo.channels; i++) { | 278 | for (i = 0; i < dev_priv->engine.fifo.channels; i++) { |
275 | chan = dev_priv->fifos[i]; | 279 | chan = dev_priv->fifos[i]; |
276 | if (!chan) | 280 | if (!chan || !chan->pushbuf_bo) |
277 | continue; | 281 | continue; |
278 | 282 | ||
279 | for (j = 0; j < NOUVEAU_DMA_SKIPS; j++) | 283 | for (j = 0; j < NOUVEAU_DMA_SKIPS; j++) |
@@ -341,7 +345,7 @@ static struct drm_driver driver = { | |||
341 | .owner = THIS_MODULE, | 345 | .owner = THIS_MODULE, |
342 | .open = drm_open, | 346 | .open = drm_open, |
343 | .release = drm_release, | 347 | .release = drm_release, |
344 | .ioctl = drm_ioctl, | 348 | .unlocked_ioctl = drm_ioctl, |
345 | .mmap = nouveau_ttm_mmap, | 349 | .mmap = nouveau_ttm_mmap, |
346 | .poll = drm_poll, | 350 | .poll = drm_poll, |
347 | .fasync = drm_fasync, | 351 | .fasync = drm_fasync, |
diff --git a/drivers/gpu/drm/nouveau/nouveau_drv.h b/drivers/gpu/drm/nouveau/nouveau_drv.h index 88b4c7b77e7f..026419fe8791 100644 --- a/drivers/gpu/drm/nouveau/nouveau_drv.h +++ b/drivers/gpu/drm/nouveau/nouveau_drv.h | |||
@@ -54,15 +54,24 @@ struct nouveau_fpriv { | |||
54 | #include "nouveau_drm.h" | 54 | #include "nouveau_drm.h" |
55 | #include "nouveau_reg.h" | 55 | #include "nouveau_reg.h" |
56 | #include "nouveau_bios.h" | 56 | #include "nouveau_bios.h" |
57 | struct nouveau_grctx; | ||
57 | 58 | ||
58 | #define MAX_NUM_DCB_ENTRIES 16 | 59 | #define MAX_NUM_DCB_ENTRIES 16 |
59 | 60 | ||
60 | #define NOUVEAU_MAX_CHANNEL_NR 128 | 61 | #define NOUVEAU_MAX_CHANNEL_NR 128 |
62 | #define NOUVEAU_MAX_TILE_NR 15 | ||
61 | 63 | ||
62 | #define NV50_VM_MAX_VRAM (2*1024*1024*1024ULL) | 64 | #define NV50_VM_MAX_VRAM (2*1024*1024*1024ULL) |
63 | #define NV50_VM_BLOCK (512*1024*1024ULL) | 65 | #define NV50_VM_BLOCK (512*1024*1024ULL) |
64 | #define NV50_VM_VRAM_NR (NV50_VM_MAX_VRAM / NV50_VM_BLOCK) | 66 | #define NV50_VM_VRAM_NR (NV50_VM_MAX_VRAM / NV50_VM_BLOCK) |
65 | 67 | ||
68 | struct nouveau_tile_reg { | ||
69 | struct nouveau_fence *fence; | ||
70 | uint32_t addr; | ||
71 | uint32_t size; | ||
72 | bool used; | ||
73 | }; | ||
74 | |||
66 | struct nouveau_bo { | 75 | struct nouveau_bo { |
67 | struct ttm_buffer_object bo; | 76 | struct ttm_buffer_object bo; |
68 | struct ttm_placement placement; | 77 | struct ttm_placement placement; |
@@ -82,6 +91,7 @@ struct nouveau_bo { | |||
82 | 91 | ||
83 | uint32_t tile_mode; | 92 | uint32_t tile_mode; |
84 | uint32_t tile_flags; | 93 | uint32_t tile_flags; |
94 | struct nouveau_tile_reg *tile; | ||
85 | 95 | ||
86 | struct drm_gem_object *gem; | 96 | struct drm_gem_object *gem; |
87 | struct drm_file *cpu_filp; | 97 | struct drm_file *cpu_filp; |
@@ -276,8 +286,13 @@ struct nouveau_timer_engine { | |||
276 | }; | 286 | }; |
277 | 287 | ||
278 | struct nouveau_fb_engine { | 288 | struct nouveau_fb_engine { |
289 | int num_tiles; | ||
290 | |||
279 | int (*init)(struct drm_device *dev); | 291 | int (*init)(struct drm_device *dev); |
280 | void (*takedown)(struct drm_device *dev); | 292 | void (*takedown)(struct drm_device *dev); |
293 | |||
294 | void (*set_region_tiling)(struct drm_device *dev, int i, uint32_t addr, | ||
295 | uint32_t size, uint32_t pitch); | ||
281 | }; | 296 | }; |
282 | 297 | ||
283 | struct nouveau_fifo_engine { | 298 | struct nouveau_fifo_engine { |
@@ -291,6 +306,8 @@ struct nouveau_fifo_engine { | |||
291 | void (*disable)(struct drm_device *); | 306 | void (*disable)(struct drm_device *); |
292 | void (*enable)(struct drm_device *); | 307 | void (*enable)(struct drm_device *); |
293 | bool (*reassign)(struct drm_device *, bool enable); | 308 | bool (*reassign)(struct drm_device *, bool enable); |
309 | bool (*cache_flush)(struct drm_device *dev); | ||
310 | bool (*cache_pull)(struct drm_device *dev, bool enable); | ||
294 | 311 | ||
295 | int (*channel_id)(struct drm_device *); | 312 | int (*channel_id)(struct drm_device *); |
296 | 313 | ||
@@ -317,6 +334,7 @@ struct nouveau_pgraph_engine { | |||
317 | bool accel_blocked; | 334 | bool accel_blocked; |
318 | void *ctxprog; | 335 | void *ctxprog; |
319 | void *ctxvals; | 336 | void *ctxvals; |
337 | int grctx_size; | ||
320 | 338 | ||
321 | int (*init)(struct drm_device *); | 339 | int (*init)(struct drm_device *); |
322 | void (*takedown)(struct drm_device *); | 340 | void (*takedown)(struct drm_device *); |
@@ -328,6 +346,9 @@ struct nouveau_pgraph_engine { | |||
328 | void (*destroy_context)(struct nouveau_channel *); | 346 | void (*destroy_context)(struct nouveau_channel *); |
329 | int (*load_context)(struct nouveau_channel *); | 347 | int (*load_context)(struct nouveau_channel *); |
330 | int (*unload_context)(struct drm_device *); | 348 | int (*unload_context)(struct drm_device *); |
349 | |||
350 | void (*set_region_tiling)(struct drm_device *dev, int i, uint32_t addr, | ||
351 | uint32_t size, uint32_t pitch); | ||
331 | }; | 352 | }; |
332 | 353 | ||
333 | struct nouveau_engine { | 354 | struct nouveau_engine { |
@@ -546,6 +567,12 @@ struct drm_nouveau_private { | |||
546 | unsigned long sg_handle; | 567 | unsigned long sg_handle; |
547 | } gart_info; | 568 | } gart_info; |
548 | 569 | ||
570 | /* nv10-nv40 tiling regions */ | ||
571 | struct { | ||
572 | struct nouveau_tile_reg reg[NOUVEAU_MAX_TILE_NR]; | ||
573 | spinlock_t lock; | ||
574 | } tile; | ||
575 | |||
549 | /* G8x/G9x virtual address space */ | 576 | /* G8x/G9x virtual address space */ |
550 | uint64_t vm_gart_base; | 577 | uint64_t vm_gart_base; |
551 | uint64_t vm_gart_size; | 578 | uint64_t vm_gart_size; |
@@ -647,6 +674,7 @@ extern int nouveau_fbpercrtc; | |||
647 | extern char *nouveau_tv_norm; | 674 | extern char *nouveau_tv_norm; |
648 | extern int nouveau_reg_debug; | 675 | extern int nouveau_reg_debug; |
649 | extern char *nouveau_vbios; | 676 | extern char *nouveau_vbios; |
677 | extern int nouveau_ctxfw; | ||
650 | 678 | ||
651 | /* nouveau_state.c */ | 679 | /* nouveau_state.c */ |
652 | extern void nouveau_preclose(struct drm_device *dev, struct drm_file *); | 680 | extern void nouveau_preclose(struct drm_device *dev, struct drm_file *); |
@@ -682,6 +710,13 @@ extern void nouveau_mem_release(struct drm_file *, struct mem_block *heap); | |||
682 | extern int nouveau_mem_init(struct drm_device *); | 710 | extern int nouveau_mem_init(struct drm_device *); |
683 | extern int nouveau_mem_init_agp(struct drm_device *); | 711 | extern int nouveau_mem_init_agp(struct drm_device *); |
684 | extern void nouveau_mem_close(struct drm_device *); | 712 | extern void nouveau_mem_close(struct drm_device *); |
713 | extern struct nouveau_tile_reg *nv10_mem_set_tiling(struct drm_device *dev, | ||
714 | uint32_t addr, | ||
715 | uint32_t size, | ||
716 | uint32_t pitch); | ||
717 | extern void nv10_mem_expire_tiling(struct drm_device *dev, | ||
718 | struct nouveau_tile_reg *tile, | ||
719 | struct nouveau_fence *fence); | ||
685 | extern int nv50_mem_vm_bind_linear(struct drm_device *, uint64_t virt, | 720 | extern int nv50_mem_vm_bind_linear(struct drm_device *, uint64_t virt, |
686 | uint32_t size, uint32_t flags, | 721 | uint32_t size, uint32_t flags, |
687 | uint64_t phys); | 722 | uint64_t phys); |
@@ -710,7 +745,6 @@ extern int nouveau_channel_alloc(struct drm_device *dev, | |||
710 | struct drm_file *file_priv, | 745 | struct drm_file *file_priv, |
711 | uint32_t fb_ctxdma, uint32_t tt_ctxdma); | 746 | uint32_t fb_ctxdma, uint32_t tt_ctxdma); |
712 | extern void nouveau_channel_free(struct nouveau_channel *); | 747 | extern void nouveau_channel_free(struct nouveau_channel *); |
713 | extern int nouveau_channel_idle(struct nouveau_channel *chan); | ||
714 | 748 | ||
715 | /* nouveau_object.c */ | 749 | /* nouveau_object.c */ |
716 | extern int nouveau_gpuobj_early_init(struct drm_device *); | 750 | extern int nouveau_gpuobj_early_init(struct drm_device *); |
@@ -753,6 +787,8 @@ extern int nouveau_gpuobj_gart_dma_new(struct nouveau_channel *, | |||
753 | uint32_t *o_ret); | 787 | uint32_t *o_ret); |
754 | extern int nouveau_gpuobj_gr_new(struct nouveau_channel *, int class, | 788 | extern int nouveau_gpuobj_gr_new(struct nouveau_channel *, int class, |
755 | struct nouveau_gpuobj **); | 789 | struct nouveau_gpuobj **); |
790 | extern int nouveau_gpuobj_sw_new(struct nouveau_channel *, int class, | ||
791 | struct nouveau_gpuobj **); | ||
756 | extern int nouveau_ioctl_grobj_alloc(struct drm_device *, void *data, | 792 | extern int nouveau_ioctl_grobj_alloc(struct drm_device *, void *data, |
757 | struct drm_file *); | 793 | struct drm_file *); |
758 | extern int nouveau_ioctl_gpuobj_free(struct drm_device *, void *data, | 794 | extern int nouveau_ioctl_gpuobj_free(struct drm_device *, void *data, |
@@ -801,6 +837,7 @@ nouveau_debugfs_channel_fini(struct nouveau_channel *chan) | |||
801 | #endif | 837 | #endif |
802 | 838 | ||
803 | /* nouveau_dma.c */ | 839 | /* nouveau_dma.c */ |
840 | extern void nouveau_dma_pre_init(struct nouveau_channel *); | ||
804 | extern int nouveau_dma_init(struct nouveau_channel *); | 841 | extern int nouveau_dma_init(struct nouveau_channel *); |
805 | extern int nouveau_dma_wait(struct nouveau_channel *, int size); | 842 | extern int nouveau_dma_wait(struct nouveau_channel *, int size); |
806 | 843 | ||
@@ -876,16 +913,22 @@ extern void nv04_fb_takedown(struct drm_device *); | |||
876 | /* nv10_fb.c */ | 913 | /* nv10_fb.c */ |
877 | extern int nv10_fb_init(struct drm_device *); | 914 | extern int nv10_fb_init(struct drm_device *); |
878 | extern void nv10_fb_takedown(struct drm_device *); | 915 | extern void nv10_fb_takedown(struct drm_device *); |
916 | extern void nv10_fb_set_region_tiling(struct drm_device *, int, uint32_t, | ||
917 | uint32_t, uint32_t); | ||
879 | 918 | ||
880 | /* nv40_fb.c */ | 919 | /* nv40_fb.c */ |
881 | extern int nv40_fb_init(struct drm_device *); | 920 | extern int nv40_fb_init(struct drm_device *); |
882 | extern void nv40_fb_takedown(struct drm_device *); | 921 | extern void nv40_fb_takedown(struct drm_device *); |
922 | extern void nv40_fb_set_region_tiling(struct drm_device *, int, uint32_t, | ||
923 | uint32_t, uint32_t); | ||
883 | 924 | ||
884 | /* nv04_fifo.c */ | 925 | /* nv04_fifo.c */ |
885 | extern int nv04_fifo_init(struct drm_device *); | 926 | extern int nv04_fifo_init(struct drm_device *); |
886 | extern void nv04_fifo_disable(struct drm_device *); | 927 | extern void nv04_fifo_disable(struct drm_device *); |
887 | extern void nv04_fifo_enable(struct drm_device *); | 928 | extern void nv04_fifo_enable(struct drm_device *); |
888 | extern bool nv04_fifo_reassign(struct drm_device *, bool); | 929 | extern bool nv04_fifo_reassign(struct drm_device *, bool); |
930 | extern bool nv04_fifo_cache_flush(struct drm_device *); | ||
931 | extern bool nv04_fifo_cache_pull(struct drm_device *, bool); | ||
889 | extern int nv04_fifo_channel_id(struct drm_device *); | 932 | extern int nv04_fifo_channel_id(struct drm_device *); |
890 | extern int nv04_fifo_create_context(struct nouveau_channel *); | 933 | extern int nv04_fifo_create_context(struct nouveau_channel *); |
891 | extern void nv04_fifo_destroy_context(struct nouveau_channel *); | 934 | extern void nv04_fifo_destroy_context(struct nouveau_channel *); |
@@ -938,6 +981,8 @@ extern void nv10_graph_destroy_context(struct nouveau_channel *); | |||
938 | extern int nv10_graph_load_context(struct nouveau_channel *); | 981 | extern int nv10_graph_load_context(struct nouveau_channel *); |
939 | extern int nv10_graph_unload_context(struct drm_device *); | 982 | extern int nv10_graph_unload_context(struct drm_device *); |
940 | extern void nv10_graph_context_switch(struct drm_device *); | 983 | extern void nv10_graph_context_switch(struct drm_device *); |
984 | extern void nv10_graph_set_region_tiling(struct drm_device *, int, uint32_t, | ||
985 | uint32_t, uint32_t); | ||
941 | 986 | ||
942 | /* nv20_graph.c */ | 987 | /* nv20_graph.c */ |
943 | extern struct nouveau_pgraph_object_class nv20_graph_grclass[]; | 988 | extern struct nouveau_pgraph_object_class nv20_graph_grclass[]; |
@@ -949,6 +994,8 @@ extern int nv20_graph_unload_context(struct drm_device *); | |||
949 | extern int nv20_graph_init(struct drm_device *); | 994 | extern int nv20_graph_init(struct drm_device *); |
950 | extern void nv20_graph_takedown(struct drm_device *); | 995 | extern void nv20_graph_takedown(struct drm_device *); |
951 | extern int nv30_graph_init(struct drm_device *); | 996 | extern int nv30_graph_init(struct drm_device *); |
997 | extern void nv20_graph_set_region_tiling(struct drm_device *, int, uint32_t, | ||
998 | uint32_t, uint32_t); | ||
952 | 999 | ||
953 | /* nv40_graph.c */ | 1000 | /* nv40_graph.c */ |
954 | extern struct nouveau_pgraph_object_class nv40_graph_grclass[]; | 1001 | extern struct nouveau_pgraph_object_class nv40_graph_grclass[]; |
@@ -959,9 +1006,9 @@ extern int nv40_graph_create_context(struct nouveau_channel *); | |||
959 | extern void nv40_graph_destroy_context(struct nouveau_channel *); | 1006 | extern void nv40_graph_destroy_context(struct nouveau_channel *); |
960 | extern int nv40_graph_load_context(struct nouveau_channel *); | 1007 | extern int nv40_graph_load_context(struct nouveau_channel *); |
961 | extern int nv40_graph_unload_context(struct drm_device *); | 1008 | extern int nv40_graph_unload_context(struct drm_device *); |
962 | extern int nv40_grctx_init(struct drm_device *); | 1009 | extern void nv40_grctx_init(struct nouveau_grctx *); |
963 | extern void nv40_grctx_fini(struct drm_device *); | 1010 | extern void nv40_graph_set_region_tiling(struct drm_device *, int, uint32_t, |
964 | extern void nv40_grctx_vals_load(struct drm_device *, struct nouveau_gpuobj *); | 1011 | uint32_t, uint32_t); |
965 | 1012 | ||
966 | /* nv50_graph.c */ | 1013 | /* nv50_graph.c */ |
967 | extern struct nouveau_pgraph_object_class nv50_graph_grclass[]; | 1014 | extern struct nouveau_pgraph_object_class nv50_graph_grclass[]; |
@@ -975,6 +1022,12 @@ extern int nv50_graph_load_context(struct nouveau_channel *); | |||
975 | extern int nv50_graph_unload_context(struct drm_device *); | 1022 | extern int nv50_graph_unload_context(struct drm_device *); |
976 | extern void nv50_graph_context_switch(struct drm_device *); | 1023 | extern void nv50_graph_context_switch(struct drm_device *); |
977 | 1024 | ||
1025 | /* nouveau_grctx.c */ | ||
1026 | extern int nouveau_grctx_prog_load(struct drm_device *); | ||
1027 | extern void nouveau_grctx_vals_load(struct drm_device *, | ||
1028 | struct nouveau_gpuobj *); | ||
1029 | extern void nouveau_grctx_fini(struct drm_device *); | ||
1030 | |||
978 | /* nv04_instmem.c */ | 1031 | /* nv04_instmem.c */ |
979 | extern int nv04_instmem_init(struct drm_device *); | 1032 | extern int nv04_instmem_init(struct drm_device *); |
980 | extern void nv04_instmem_takedown(struct drm_device *); | 1033 | extern void nv04_instmem_takedown(struct drm_device *); |
@@ -1023,8 +1076,7 @@ extern long nouveau_compat_ioctl(struct file *file, unsigned int cmd, | |||
1023 | 1076 | ||
1024 | /* nv04_dac.c */ | 1077 | /* nv04_dac.c */ |
1025 | extern int nv04_dac_create(struct drm_device *dev, struct dcb_entry *entry); | 1078 | extern int nv04_dac_create(struct drm_device *dev, struct dcb_entry *entry); |
1026 | extern enum drm_connector_status nv17_dac_detect(struct drm_encoder *encoder, | 1079 | extern uint32_t nv17_dac_sample_load(struct drm_encoder *encoder); |
1027 | struct drm_connector *connector); | ||
1028 | extern int nv04_dac_output_offset(struct drm_encoder *encoder); | 1080 | extern int nv04_dac_output_offset(struct drm_encoder *encoder); |
1029 | extern void nv04_dac_update_dacclk(struct drm_encoder *encoder, bool enable); | 1081 | extern void nv04_dac_update_dacclk(struct drm_encoder *encoder, bool enable); |
1030 | 1082 | ||
@@ -1042,9 +1094,6 @@ extern int nv04_tv_create(struct drm_device *dev, struct dcb_entry *entry); | |||
1042 | 1094 | ||
1043 | /* nv17_tv.c */ | 1095 | /* nv17_tv.c */ |
1044 | extern int nv17_tv_create(struct drm_device *dev, struct dcb_entry *entry); | 1096 | extern int nv17_tv_create(struct drm_device *dev, struct dcb_entry *entry); |
1045 | extern enum drm_connector_status nv17_tv_detect(struct drm_encoder *encoder, | ||
1046 | struct drm_connector *connector, | ||
1047 | uint32_t pin_mask); | ||
1048 | 1097 | ||
1049 | /* nv04_display.c */ | 1098 | /* nv04_display.c */ |
1050 | extern int nv04_display_create(struct drm_device *); | 1099 | extern int nv04_display_create(struct drm_device *); |
@@ -1207,14 +1256,24 @@ static inline void nv_wo32(struct drm_device *dev, struct nouveau_gpuobj *obj, | |||
1207 | pci_name(d->pdev), ##arg) | 1256 | pci_name(d->pdev), ##arg) |
1208 | #ifndef NV_DEBUG_NOTRACE | 1257 | #ifndef NV_DEBUG_NOTRACE |
1209 | #define NV_DEBUG(d, fmt, arg...) do { \ | 1258 | #define NV_DEBUG(d, fmt, arg...) do { \ |
1210 | if (drm_debug) { \ | 1259 | if (drm_debug & DRM_UT_DRIVER) { \ |
1260 | NV_PRINTK(KERN_DEBUG, d, "%s:%d - " fmt, __func__, \ | ||
1261 | __LINE__, ##arg); \ | ||
1262 | } \ | ||
1263 | } while (0) | ||
1264 | #define NV_DEBUG_KMS(d, fmt, arg...) do { \ | ||
1265 | if (drm_debug & DRM_UT_KMS) { \ | ||
1211 | NV_PRINTK(KERN_DEBUG, d, "%s:%d - " fmt, __func__, \ | 1266 | NV_PRINTK(KERN_DEBUG, d, "%s:%d - " fmt, __func__, \ |
1212 | __LINE__, ##arg); \ | 1267 | __LINE__, ##arg); \ |
1213 | } \ | 1268 | } \ |
1214 | } while (0) | 1269 | } while (0) |
1215 | #else | 1270 | #else |
1216 | #define NV_DEBUG(d, fmt, arg...) do { \ | 1271 | #define NV_DEBUG(d, fmt, arg...) do { \ |
1217 | if (drm_debug) \ | 1272 | if (drm_debug & DRM_UT_DRIVER) \ |
1273 | NV_PRINTK(KERN_DEBUG, d, fmt, ##arg); \ | ||
1274 | } while (0) | ||
1275 | #define NV_DEBUG_KMS(d, fmt, arg...) do { \ | ||
1276 | if (drm_debug & DRM_UT_KMS) \ | ||
1218 | NV_PRINTK(KERN_DEBUG, d, fmt, ##arg); \ | 1277 | NV_PRINTK(KERN_DEBUG, d, fmt, ##arg); \ |
1219 | } while (0) | 1278 | } while (0) |
1220 | #endif | 1279 | #endif |
@@ -1273,14 +1332,14 @@ nv_two_reg_pll(struct drm_device *dev) | |||
1273 | return false; | 1332 | return false; |
1274 | } | 1333 | } |
1275 | 1334 | ||
1276 | #define NV50_NVSW 0x0000506e | 1335 | #define NV_SW 0x0000506e |
1277 | #define NV50_NVSW_DMA_SEMAPHORE 0x00000060 | 1336 | #define NV_SW_DMA_SEMAPHORE 0x00000060 |
1278 | #define NV50_NVSW_SEMAPHORE_OFFSET 0x00000064 | 1337 | #define NV_SW_SEMAPHORE_OFFSET 0x00000064 |
1279 | #define NV50_NVSW_SEMAPHORE_ACQUIRE 0x00000068 | 1338 | #define NV_SW_SEMAPHORE_ACQUIRE 0x00000068 |
1280 | #define NV50_NVSW_SEMAPHORE_RELEASE 0x0000006c | 1339 | #define NV_SW_SEMAPHORE_RELEASE 0x0000006c |
1281 | #define NV50_NVSW_DMA_VBLSEM 0x0000018c | 1340 | #define NV_SW_DMA_VBLSEM 0x0000018c |
1282 | #define NV50_NVSW_VBLSEM_OFFSET 0x00000400 | 1341 | #define NV_SW_VBLSEM_OFFSET 0x00000400 |
1283 | #define NV50_NVSW_VBLSEM_RELEASE_VALUE 0x00000404 | 1342 | #define NV_SW_VBLSEM_RELEASE_VALUE 0x00000404 |
1284 | #define NV50_NVSW_VBLSEM_RELEASE 0x00000408 | 1343 | #define NV_SW_VBLSEM_RELEASE 0x00000408 |
1285 | 1344 | ||
1286 | #endif /* __NOUVEAU_DRV_H__ */ | 1345 | #endif /* __NOUVEAU_DRV_H__ */ |
diff --git a/drivers/gpu/drm/nouveau/nouveau_fbcon.c b/drivers/gpu/drm/nouveau/nouveau_fbcon.c index 36e8c5e4503a..0b05c869e0e7 100644 --- a/drivers/gpu/drm/nouveau/nouveau_fbcon.c +++ b/drivers/gpu/drm/nouveau/nouveau_fbcon.c | |||
@@ -58,14 +58,13 @@ nouveau_fbcon_sync(struct fb_info *info) | |||
58 | struct nouveau_channel *chan = dev_priv->channel; | 58 | struct nouveau_channel *chan = dev_priv->channel; |
59 | int ret, i; | 59 | int ret, i; |
60 | 60 | ||
61 | if (!chan->accel_done || | 61 | if (!chan || !chan->accel_done || |
62 | info->state != FBINFO_STATE_RUNNING || | 62 | info->state != FBINFO_STATE_RUNNING || |
63 | info->flags & FBINFO_HWACCEL_DISABLED) | 63 | info->flags & FBINFO_HWACCEL_DISABLED) |
64 | return 0; | 64 | return 0; |
65 | 65 | ||
66 | if (RING_SPACE(chan, 4)) { | 66 | if (RING_SPACE(chan, 4)) { |
67 | NV_ERROR(dev, "GPU lockup - switching to software fbcon\n"); | 67 | nouveau_fbcon_gpu_lockup(info); |
68 | info->flags |= FBINFO_HWACCEL_DISABLED; | ||
69 | return 0; | 68 | return 0; |
70 | } | 69 | } |
71 | 70 | ||
@@ -86,8 +85,7 @@ nouveau_fbcon_sync(struct fb_info *info) | |||
86 | } | 85 | } |
87 | 86 | ||
88 | if (ret) { | 87 | if (ret) { |
89 | NV_ERROR(dev, "GPU lockup - switching to software fbcon\n"); | 88 | nouveau_fbcon_gpu_lockup(info); |
90 | info->flags |= FBINFO_HWACCEL_DISABLED; | ||
91 | return 0; | 89 | return 0; |
92 | } | 90 | } |
93 | 91 | ||
@@ -212,11 +210,11 @@ nouveau_fbcon_create(struct drm_device *dev, uint32_t fb_width, | |||
212 | 210 | ||
213 | mode_cmd.bpp = surface_bpp; | 211 | mode_cmd.bpp = surface_bpp; |
214 | mode_cmd.pitch = mode_cmd.width * (mode_cmd.bpp >> 3); | 212 | mode_cmd.pitch = mode_cmd.width * (mode_cmd.bpp >> 3); |
215 | mode_cmd.pitch = ALIGN(mode_cmd.pitch, 256); | 213 | mode_cmd.pitch = roundup(mode_cmd.pitch, 256); |
216 | mode_cmd.depth = surface_depth; | 214 | mode_cmd.depth = surface_depth; |
217 | 215 | ||
218 | size = mode_cmd.pitch * mode_cmd.height; | 216 | size = mode_cmd.pitch * mode_cmd.height; |
219 | size = ALIGN(size, PAGE_SIZE); | 217 | size = roundup(size, PAGE_SIZE); |
220 | 218 | ||
221 | ret = nouveau_gem_new(dev, dev_priv->channel, size, 0, TTM_PL_FLAG_VRAM, | 219 | ret = nouveau_gem_new(dev, dev_priv->channel, size, 0, TTM_PL_FLAG_VRAM, |
222 | 0, 0x0000, false, true, &nvbo); | 220 | 0, 0x0000, false, true, &nvbo); |
@@ -318,14 +316,16 @@ nouveau_fbcon_create(struct drm_device *dev, uint32_t fb_width, | |||
318 | par->nouveau_fb = nouveau_fb; | 316 | par->nouveau_fb = nouveau_fb; |
319 | par->dev = dev; | 317 | par->dev = dev; |
320 | 318 | ||
321 | switch (dev_priv->card_type) { | 319 | if (dev_priv->channel) { |
322 | case NV_50: | 320 | switch (dev_priv->card_type) { |
323 | nv50_fbcon_accel_init(info); | 321 | case NV_50: |
324 | break; | 322 | nv50_fbcon_accel_init(info); |
325 | default: | 323 | break; |
326 | nv04_fbcon_accel_init(info); | 324 | default: |
327 | break; | 325 | nv04_fbcon_accel_init(info); |
328 | }; | 326 | break; |
327 | }; | ||
328 | } | ||
329 | 329 | ||
330 | nouveau_fbcon_zfill(dev); | 330 | nouveau_fbcon_zfill(dev); |
331 | 331 | ||
@@ -347,7 +347,7 @@ out: | |||
347 | int | 347 | int |
348 | nouveau_fbcon_probe(struct drm_device *dev) | 348 | nouveau_fbcon_probe(struct drm_device *dev) |
349 | { | 349 | { |
350 | NV_DEBUG(dev, "\n"); | 350 | NV_DEBUG_KMS(dev, "\n"); |
351 | 351 | ||
352 | return drm_fb_helper_single_fb_probe(dev, 32, nouveau_fbcon_create); | 352 | return drm_fb_helper_single_fb_probe(dev, 32, nouveau_fbcon_create); |
353 | } | 353 | } |
@@ -378,3 +378,12 @@ nouveau_fbcon_remove(struct drm_device *dev, struct drm_framebuffer *fb) | |||
378 | 378 | ||
379 | return 0; | 379 | return 0; |
380 | } | 380 | } |
381 | |||
382 | void nouveau_fbcon_gpu_lockup(struct fb_info *info) | ||
383 | { | ||
384 | struct nouveau_fbcon_par *par = info->par; | ||
385 | struct drm_device *dev = par->dev; | ||
386 | |||
387 | NV_ERROR(dev, "GPU lockup - switching to software fbcon\n"); | ||
388 | info->flags |= FBINFO_HWACCEL_DISABLED; | ||
389 | } | ||
diff --git a/drivers/gpu/drm/nouveau/nouveau_fbcon.h b/drivers/gpu/drm/nouveau/nouveau_fbcon.h index 8531140fedbc..462e0b87b4bd 100644 --- a/drivers/gpu/drm/nouveau/nouveau_fbcon.h +++ b/drivers/gpu/drm/nouveau/nouveau_fbcon.h | |||
@@ -43,5 +43,6 @@ void nouveau_fbcon_zfill(struct drm_device *dev); | |||
43 | int nv04_fbcon_accel_init(struct fb_info *info); | 43 | int nv04_fbcon_accel_init(struct fb_info *info); |
44 | int nv50_fbcon_accel_init(struct fb_info *info); | 44 | int nv50_fbcon_accel_init(struct fb_info *info); |
45 | 45 | ||
46 | void nouveau_fbcon_gpu_lockup(struct fb_info *info); | ||
46 | #endif /* __NV50_FBCON_H__ */ | 47 | #endif /* __NV50_FBCON_H__ */ |
47 | 48 | ||
diff --git a/drivers/gpu/drm/nouveau/nouveau_fence.c b/drivers/gpu/drm/nouveau/nouveau_fence.c index dacac9a0842a..faddf53ff9ed 100644 --- a/drivers/gpu/drm/nouveau/nouveau_fence.c +++ b/drivers/gpu/drm/nouveau/nouveau_fence.c | |||
@@ -142,7 +142,7 @@ nouveau_fence_emit(struct nouveau_fence *fence) | |||
142 | list_add_tail(&fence->entry, &chan->fence.pending); | 142 | list_add_tail(&fence->entry, &chan->fence.pending); |
143 | spin_unlock_irqrestore(&chan->fence.lock, flags); | 143 | spin_unlock_irqrestore(&chan->fence.lock, flags); |
144 | 144 | ||
145 | BEGIN_RING(chan, NvSubM2MF, USE_REFCNT ? 0x0050 : 0x0150, 1); | 145 | BEGIN_RING(chan, NvSubSw, USE_REFCNT ? 0x0050 : 0x0150, 1); |
146 | OUT_RING(chan, fence->sequence); | 146 | OUT_RING(chan, fence->sequence); |
147 | FIRE_RING(chan); | 147 | FIRE_RING(chan); |
148 | 148 | ||
diff --git a/drivers/gpu/drm/nouveau/nouveau_gem.c b/drivers/gpu/drm/nouveau/nouveau_gem.c index 18fd8ac9fca7..2009db2426c3 100644 --- a/drivers/gpu/drm/nouveau/nouveau_gem.c +++ b/drivers/gpu/drm/nouveau/nouveau_gem.c | |||
@@ -220,7 +220,6 @@ nouveau_gem_set_domain(struct drm_gem_object *gem, uint32_t read_domains, | |||
220 | } | 220 | } |
221 | 221 | ||
222 | struct validate_op { | 222 | struct validate_op { |
223 | struct nouveau_fence *fence; | ||
224 | struct list_head vram_list; | 223 | struct list_head vram_list; |
225 | struct list_head gart_list; | 224 | struct list_head gart_list; |
226 | struct list_head both_list; | 225 | struct list_head both_list; |
@@ -252,17 +251,11 @@ validate_fini_list(struct list_head *list, struct nouveau_fence *fence) | |||
252 | } | 251 | } |
253 | 252 | ||
254 | static void | 253 | static void |
255 | validate_fini(struct validate_op *op, bool success) | 254 | validate_fini(struct validate_op *op, struct nouveau_fence* fence) |
256 | { | 255 | { |
257 | struct nouveau_fence *fence = op->fence; | 256 | validate_fini_list(&op->vram_list, fence); |
258 | 257 | validate_fini_list(&op->gart_list, fence); | |
259 | if (unlikely(!success)) | 258 | validate_fini_list(&op->both_list, fence); |
260 | op->fence = NULL; | ||
261 | |||
262 | validate_fini_list(&op->vram_list, op->fence); | ||
263 | validate_fini_list(&op->gart_list, op->fence); | ||
264 | validate_fini_list(&op->both_list, op->fence); | ||
265 | nouveau_fence_unref((void *)&fence); | ||
266 | } | 259 | } |
267 | 260 | ||
268 | static int | 261 | static int |
@@ -420,10 +413,6 @@ nouveau_gem_pushbuf_validate(struct nouveau_channel *chan, | |||
420 | INIT_LIST_HEAD(&op->gart_list); | 413 | INIT_LIST_HEAD(&op->gart_list); |
421 | INIT_LIST_HEAD(&op->both_list); | 414 | INIT_LIST_HEAD(&op->both_list); |
422 | 415 | ||
423 | ret = nouveau_fence_new(chan, &op->fence, false); | ||
424 | if (ret) | ||
425 | return ret; | ||
426 | |||
427 | if (nr_buffers == 0) | 416 | if (nr_buffers == 0) |
428 | return 0; | 417 | return 0; |
429 | 418 | ||
@@ -541,6 +530,7 @@ nouveau_gem_ioctl_pushbuf(struct drm_device *dev, void *data, | |||
541 | struct drm_nouveau_gem_pushbuf_bo *bo = NULL; | 530 | struct drm_nouveau_gem_pushbuf_bo *bo = NULL; |
542 | struct nouveau_channel *chan; | 531 | struct nouveau_channel *chan; |
543 | struct validate_op op; | 532 | struct validate_op op; |
533 | struct nouveau_fence* fence = 0; | ||
544 | uint32_t *pushbuf = NULL; | 534 | uint32_t *pushbuf = NULL; |
545 | int ret = 0, do_reloc = 0, i; | 535 | int ret = 0, do_reloc = 0, i; |
546 | 536 | ||
@@ -597,7 +587,7 @@ nouveau_gem_ioctl_pushbuf(struct drm_device *dev, void *data, | |||
597 | 587 | ||
598 | OUT_RINGp(chan, pushbuf, req->nr_dwords); | 588 | OUT_RINGp(chan, pushbuf, req->nr_dwords); |
599 | 589 | ||
600 | ret = nouveau_fence_emit(op.fence); | 590 | ret = nouveau_fence_new(chan, &fence, true); |
601 | if (ret) { | 591 | if (ret) { |
602 | NV_ERROR(dev, "error fencing pushbuf: %d\n", ret); | 592 | NV_ERROR(dev, "error fencing pushbuf: %d\n", ret); |
603 | WIND_RING(chan); | 593 | WIND_RING(chan); |
@@ -605,7 +595,7 @@ nouveau_gem_ioctl_pushbuf(struct drm_device *dev, void *data, | |||
605 | } | 595 | } |
606 | 596 | ||
607 | if (nouveau_gem_pushbuf_sync(chan)) { | 597 | if (nouveau_gem_pushbuf_sync(chan)) { |
608 | ret = nouveau_fence_wait(op.fence, NULL, false, false); | 598 | ret = nouveau_fence_wait(fence, NULL, false, false); |
609 | if (ret) { | 599 | if (ret) { |
610 | for (i = 0; i < req->nr_dwords; i++) | 600 | for (i = 0; i < req->nr_dwords; i++) |
611 | NV_ERROR(dev, "0x%08x\n", pushbuf[i]); | 601 | NV_ERROR(dev, "0x%08x\n", pushbuf[i]); |
@@ -614,7 +604,8 @@ nouveau_gem_ioctl_pushbuf(struct drm_device *dev, void *data, | |||
614 | } | 604 | } |
615 | 605 | ||
616 | out: | 606 | out: |
617 | validate_fini(&op, ret == 0); | 607 | validate_fini(&op, fence); |
608 | nouveau_fence_unref((void**)&fence); | ||
618 | mutex_unlock(&dev->struct_mutex); | 609 | mutex_unlock(&dev->struct_mutex); |
619 | kfree(pushbuf); | 610 | kfree(pushbuf); |
620 | kfree(bo); | 611 | kfree(bo); |
@@ -634,6 +625,7 @@ nouveau_gem_ioctl_pushbuf_call(struct drm_device *dev, void *data, | |||
634 | struct drm_gem_object *gem; | 625 | struct drm_gem_object *gem; |
635 | struct nouveau_bo *pbbo; | 626 | struct nouveau_bo *pbbo; |
636 | struct validate_op op; | 627 | struct validate_op op; |
628 | struct nouveau_fence* fence = 0; | ||
637 | int i, ret = 0, do_reloc = 0; | 629 | int i, ret = 0, do_reloc = 0; |
638 | 630 | ||
639 | NOUVEAU_CHECK_INITIALISED_WITH_RETURN; | 631 | NOUVEAU_CHECK_INITIALISED_WITH_RETURN; |
@@ -772,7 +764,7 @@ nouveau_gem_ioctl_pushbuf_call(struct drm_device *dev, void *data, | |||
772 | OUT_RING(chan, 0); | 764 | OUT_RING(chan, 0); |
773 | } | 765 | } |
774 | 766 | ||
775 | ret = nouveau_fence_emit(op.fence); | 767 | ret = nouveau_fence_new(chan, &fence, true); |
776 | if (ret) { | 768 | if (ret) { |
777 | NV_ERROR(dev, "error fencing pushbuf: %d\n", ret); | 769 | NV_ERROR(dev, "error fencing pushbuf: %d\n", ret); |
778 | WIND_RING(chan); | 770 | WIND_RING(chan); |
@@ -780,7 +772,8 @@ nouveau_gem_ioctl_pushbuf_call(struct drm_device *dev, void *data, | |||
780 | } | 772 | } |
781 | 773 | ||
782 | out: | 774 | out: |
783 | validate_fini(&op, ret == 0); | 775 | validate_fini(&op, fence); |
776 | nouveau_fence_unref((void**)&fence); | ||
784 | mutex_unlock(&dev->struct_mutex); | 777 | mutex_unlock(&dev->struct_mutex); |
785 | kfree(bo); | 778 | kfree(bo); |
786 | 779 | ||
diff --git a/drivers/gpu/drm/nouveau/nouveau_grctx.c b/drivers/gpu/drm/nouveau/nouveau_grctx.c new file mode 100644 index 000000000000..419f4c2b3b89 --- /dev/null +++ b/drivers/gpu/drm/nouveau/nouveau_grctx.c | |||
@@ -0,0 +1,161 @@ | |||
1 | /* | ||
2 | * Copyright 2009 Red Hat Inc. | ||
3 | * | ||
4 | * Permission is hereby granted, free of charge, to any person obtaining a | ||
5 | * copy of this software and associated documentation files (the "Software"), | ||
6 | * to deal in the Software without restriction, including without limitation | ||
7 | * the rights to use, copy, modify, merge, publish, distribute, sublicense, | ||
8 | * and/or sell copies of the Software, and to permit persons to whom the | ||
9 | * Software is furnished to do so, subject to the following conditions: | ||
10 | * | ||
11 | * The above copyright notice and this permission notice shall be included in | ||
12 | * all copies or substantial portions of the Software. | ||
13 | * | ||
14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL | ||
17 | * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR | ||
18 | * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, | ||
19 | * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR | ||
20 | * OTHER DEALINGS IN THE SOFTWARE. | ||
21 | * | ||
22 | * Authors: Ben Skeggs | ||
23 | */ | ||
24 | |||
25 | #include <linux/firmware.h> | ||
26 | |||
27 | #include "drmP.h" | ||
28 | #include "nouveau_drv.h" | ||
29 | |||
30 | struct nouveau_ctxprog { | ||
31 | uint32_t signature; | ||
32 | uint8_t version; | ||
33 | uint16_t length; | ||
34 | uint32_t data[]; | ||
35 | } __attribute__ ((packed)); | ||
36 | |||
37 | struct nouveau_ctxvals { | ||
38 | uint32_t signature; | ||
39 | uint8_t version; | ||
40 | uint32_t length; | ||
41 | struct { | ||
42 | uint32_t offset; | ||
43 | uint32_t value; | ||
44 | } data[]; | ||
45 | } __attribute__ ((packed)); | ||
46 | |||
47 | int | ||
48 | nouveau_grctx_prog_load(struct drm_device *dev) | ||
49 | { | ||
50 | struct drm_nouveau_private *dev_priv = dev->dev_private; | ||
51 | struct nouveau_pgraph_engine *pgraph = &dev_priv->engine.graph; | ||
52 | const int chipset = dev_priv->chipset; | ||
53 | const struct firmware *fw; | ||
54 | const struct nouveau_ctxprog *cp; | ||
55 | const struct nouveau_ctxvals *cv; | ||
56 | char name[32]; | ||
57 | int ret, i; | ||
58 | |||
59 | if (pgraph->accel_blocked) | ||
60 | return -ENODEV; | ||
61 | |||
62 | if (!pgraph->ctxprog) { | ||
63 | sprintf(name, "nouveau/nv%02x.ctxprog", chipset); | ||
64 | ret = request_firmware(&fw, name, &dev->pdev->dev); | ||
65 | if (ret) { | ||
66 | NV_ERROR(dev, "No ctxprog for NV%02x\n", chipset); | ||
67 | return ret; | ||
68 | } | ||
69 | |||
70 | pgraph->ctxprog = kmalloc(fw->size, GFP_KERNEL); | ||
71 | if (!pgraph->ctxprog) { | ||
72 | NV_ERROR(dev, "OOM copying ctxprog\n"); | ||
73 | release_firmware(fw); | ||
74 | return -ENOMEM; | ||
75 | } | ||
76 | memcpy(pgraph->ctxprog, fw->data, fw->size); | ||
77 | |||
78 | cp = pgraph->ctxprog; | ||
79 | if (le32_to_cpu(cp->signature) != 0x5043564e || | ||
80 | cp->version != 0 || | ||
81 | le16_to_cpu(cp->length) != ((fw->size - 7) / 4)) { | ||
82 | NV_ERROR(dev, "ctxprog invalid\n"); | ||
83 | release_firmware(fw); | ||
84 | nouveau_grctx_fini(dev); | ||
85 | return -EINVAL; | ||
86 | } | ||
87 | release_firmware(fw); | ||
88 | } | ||
89 | |||
90 | if (!pgraph->ctxvals) { | ||
91 | sprintf(name, "nouveau/nv%02x.ctxvals", chipset); | ||
92 | ret = request_firmware(&fw, name, &dev->pdev->dev); | ||
93 | if (ret) { | ||
94 | NV_ERROR(dev, "No ctxvals for NV%02x\n", chipset); | ||
95 | nouveau_grctx_fini(dev); | ||
96 | return ret; | ||
97 | } | ||
98 | |||
99 | pgraph->ctxvals = kmalloc(fw->size, GFP_KERNEL); | ||
100 | if (!pgraph->ctxprog) { | ||
101 | NV_ERROR(dev, "OOM copying ctxprog\n"); | ||
102 | release_firmware(fw); | ||
103 | nouveau_grctx_fini(dev); | ||
104 | return -ENOMEM; | ||
105 | } | ||
106 | memcpy(pgraph->ctxvals, fw->data, fw->size); | ||
107 | |||
108 | cv = (void *)pgraph->ctxvals; | ||
109 | if (le32_to_cpu(cv->signature) != 0x5643564e || | ||
110 | cv->version != 0 || | ||
111 | le32_to_cpu(cv->length) != ((fw->size - 9) / 8)) { | ||
112 | NV_ERROR(dev, "ctxvals invalid\n"); | ||
113 | release_firmware(fw); | ||
114 | nouveau_grctx_fini(dev); | ||
115 | return -EINVAL; | ||
116 | } | ||
117 | release_firmware(fw); | ||
118 | } | ||
119 | |||
120 | cp = pgraph->ctxprog; | ||
121 | |||
122 | nv_wr32(dev, NV40_PGRAPH_CTXCTL_UCODE_INDEX, 0); | ||
123 | for (i = 0; i < le16_to_cpu(cp->length); i++) | ||
124 | nv_wr32(dev, NV40_PGRAPH_CTXCTL_UCODE_DATA, | ||
125 | le32_to_cpu(cp->data[i])); | ||
126 | |||
127 | return 0; | ||
128 | } | ||
129 | |||
130 | void | ||
131 | nouveau_grctx_fini(struct drm_device *dev) | ||
132 | { | ||
133 | struct drm_nouveau_private *dev_priv = dev->dev_private; | ||
134 | struct nouveau_pgraph_engine *pgraph = &dev_priv->engine.graph; | ||
135 | |||
136 | if (pgraph->ctxprog) { | ||
137 | kfree(pgraph->ctxprog); | ||
138 | pgraph->ctxprog = NULL; | ||
139 | } | ||
140 | |||
141 | if (pgraph->ctxvals) { | ||
142 | kfree(pgraph->ctxprog); | ||
143 | pgraph->ctxvals = NULL; | ||
144 | } | ||
145 | } | ||
146 | |||
147 | void | ||
148 | nouveau_grctx_vals_load(struct drm_device *dev, struct nouveau_gpuobj *ctx) | ||
149 | { | ||
150 | struct drm_nouveau_private *dev_priv = dev->dev_private; | ||
151 | struct nouveau_pgraph_engine *pgraph = &dev_priv->engine.graph; | ||
152 | struct nouveau_ctxvals *cv = pgraph->ctxvals; | ||
153 | int i; | ||
154 | |||
155 | if (!cv) | ||
156 | return; | ||
157 | |||
158 | for (i = 0; i < le32_to_cpu(cv->length); i++) | ||
159 | nv_wo32(dev, ctx, le32_to_cpu(cv->data[i].offset), | ||
160 | le32_to_cpu(cv->data[i].value)); | ||
161 | } | ||
diff --git a/drivers/gpu/drm/nouveau/nouveau_grctx.h b/drivers/gpu/drm/nouveau/nouveau_grctx.h new file mode 100644 index 000000000000..5d39c4ce8006 --- /dev/null +++ b/drivers/gpu/drm/nouveau/nouveau_grctx.h | |||
@@ -0,0 +1,133 @@ | |||
1 | #ifndef __NOUVEAU_GRCTX_H__ | ||
2 | #define __NOUVEAU_GRCTX_H__ | ||
3 | |||
4 | struct nouveau_grctx { | ||
5 | struct drm_device *dev; | ||
6 | |||
7 | enum { | ||
8 | NOUVEAU_GRCTX_PROG, | ||
9 | NOUVEAU_GRCTX_VALS | ||
10 | } mode; | ||
11 | void *data; | ||
12 | |||
13 | uint32_t ctxprog_max; | ||
14 | uint32_t ctxprog_len; | ||
15 | uint32_t ctxprog_reg; | ||
16 | int ctxprog_label[32]; | ||
17 | uint32_t ctxvals_pos; | ||
18 | uint32_t ctxvals_base; | ||
19 | }; | ||
20 | |||
21 | #ifdef CP_CTX | ||
22 | static inline void | ||
23 | cp_out(struct nouveau_grctx *ctx, uint32_t inst) | ||
24 | { | ||
25 | uint32_t *ctxprog = ctx->data; | ||
26 | |||
27 | if (ctx->mode != NOUVEAU_GRCTX_PROG) | ||
28 | return; | ||
29 | |||
30 | BUG_ON(ctx->ctxprog_len == ctx->ctxprog_max); | ||
31 | ctxprog[ctx->ctxprog_len++] = inst; | ||
32 | } | ||
33 | |||
34 | static inline void | ||
35 | cp_lsr(struct nouveau_grctx *ctx, uint32_t val) | ||
36 | { | ||
37 | cp_out(ctx, CP_LOAD_SR | val); | ||
38 | } | ||
39 | |||
40 | static inline void | ||
41 | cp_ctx(struct nouveau_grctx *ctx, uint32_t reg, uint32_t length) | ||
42 | { | ||
43 | ctx->ctxprog_reg = (reg - 0x00400000) >> 2; | ||
44 | |||
45 | ctx->ctxvals_base = ctx->ctxvals_pos; | ||
46 | ctx->ctxvals_pos = ctx->ctxvals_base + length; | ||
47 | |||
48 | if (length > (CP_CTX_COUNT >> CP_CTX_COUNT_SHIFT)) { | ||
49 | cp_lsr(ctx, length); | ||
50 | length = 0; | ||
51 | } | ||
52 | |||
53 | cp_out(ctx, CP_CTX | (length << CP_CTX_COUNT_SHIFT) | ctx->ctxprog_reg); | ||
54 | } | ||
55 | |||
56 | static inline void | ||
57 | cp_name(struct nouveau_grctx *ctx, int name) | ||
58 | { | ||
59 | uint32_t *ctxprog = ctx->data; | ||
60 | int i; | ||
61 | |||
62 | if (ctx->mode != NOUVEAU_GRCTX_PROG) | ||
63 | return; | ||
64 | |||
65 | ctx->ctxprog_label[name] = ctx->ctxprog_len; | ||
66 | for (i = 0; i < ctx->ctxprog_len; i++) { | ||
67 | if ((ctxprog[i] & 0xfff00000) != 0xff400000) | ||
68 | continue; | ||
69 | if ((ctxprog[i] & CP_BRA_IP) != ((name) << CP_BRA_IP_SHIFT)) | ||
70 | continue; | ||
71 | ctxprog[i] = (ctxprog[i] & 0x00ff00ff) | | ||
72 | (ctx->ctxprog_len << CP_BRA_IP_SHIFT); | ||
73 | } | ||
74 | } | ||
75 | |||
76 | static inline void | ||
77 | _cp_bra(struct nouveau_grctx *ctx, u32 mod, int flag, int state, int name) | ||
78 | { | ||
79 | int ip = 0; | ||
80 | |||
81 | if (mod != 2) { | ||
82 | ip = ctx->ctxprog_label[name] << CP_BRA_IP_SHIFT; | ||
83 | if (ip == 0) | ||
84 | ip = 0xff000000 | (name << CP_BRA_IP_SHIFT); | ||
85 | } | ||
86 | |||
87 | cp_out(ctx, CP_BRA | (mod << 18) | ip | flag | | ||
88 | (state ? 0 : CP_BRA_IF_CLEAR)); | ||
89 | } | ||
90 | #define cp_bra(c,f,s,n) _cp_bra((c), 0, CP_FLAG_##f, CP_FLAG_##f##_##s, n) | ||
91 | #ifdef CP_BRA_MOD | ||
92 | #define cp_cal(c,f,s,n) _cp_bra((c), 1, CP_FLAG_##f, CP_FLAG_##f##_##s, n) | ||
93 | #define cp_ret(c,f,s) _cp_bra((c), 2, CP_FLAG_##f, CP_FLAG_##f##_##s, 0) | ||
94 | #endif | ||
95 | |||
96 | static inline void | ||
97 | _cp_wait(struct nouveau_grctx *ctx, int flag, int state) | ||
98 | { | ||
99 | cp_out(ctx, CP_WAIT | flag | (state ? CP_WAIT_SET : 0)); | ||
100 | } | ||
101 | #define cp_wait(c,f,s) _cp_wait((c), CP_FLAG_##f, CP_FLAG_##f##_##s) | ||
102 | |||
103 | static inline void | ||
104 | _cp_set(struct nouveau_grctx *ctx, int flag, int state) | ||
105 | { | ||
106 | cp_out(ctx, CP_SET | flag | (state ? CP_SET_1 : 0)); | ||
107 | } | ||
108 | #define cp_set(c,f,s) _cp_set((c), CP_FLAG_##f, CP_FLAG_##f##_##s) | ||
109 | |||
110 | static inline void | ||
111 | cp_pos(struct nouveau_grctx *ctx, int offset) | ||
112 | { | ||
113 | ctx->ctxvals_pos = offset; | ||
114 | ctx->ctxvals_base = ctx->ctxvals_pos; | ||
115 | |||
116 | cp_lsr(ctx, ctx->ctxvals_pos); | ||
117 | cp_out(ctx, CP_SET_CONTEXT_POINTER); | ||
118 | } | ||
119 | |||
120 | static inline void | ||
121 | gr_def(struct nouveau_grctx *ctx, uint32_t reg, uint32_t val) | ||
122 | { | ||
123 | if (ctx->mode != NOUVEAU_GRCTX_VALS) | ||
124 | return; | ||
125 | |||
126 | reg = (reg - 0x00400000) / 4; | ||
127 | reg = (reg - ctx->ctxprog_reg) + ctx->ctxvals_base; | ||
128 | |||
129 | nv_wo32(ctx->dev, ctx->data, reg, val); | ||
130 | } | ||
131 | #endif | ||
132 | |||
133 | #endif | ||
diff --git a/drivers/gpu/drm/nouveau/nouveau_ioc32.c b/drivers/gpu/drm/nouveau/nouveau_ioc32.c index a2c30f4611ba..475ba810bba3 100644 --- a/drivers/gpu/drm/nouveau/nouveau_ioc32.c +++ b/drivers/gpu/drm/nouveau/nouveau_ioc32.c | |||
@@ -61,12 +61,10 @@ long nouveau_compat_ioctl(struct file *filp, unsigned int cmd, | |||
61 | if (nr < DRM_COMMAND_BASE + DRM_ARRAY_SIZE(mga_compat_ioctls)) | 61 | if (nr < DRM_COMMAND_BASE + DRM_ARRAY_SIZE(mga_compat_ioctls)) |
62 | fn = nouveau_compat_ioctls[nr - DRM_COMMAND_BASE]; | 62 | fn = nouveau_compat_ioctls[nr - DRM_COMMAND_BASE]; |
63 | #endif | 63 | #endif |
64 | lock_kernel(); /* XXX for now */ | ||
65 | if (fn != NULL) | 64 | if (fn != NULL) |
66 | ret = (*fn)(filp, cmd, arg); | 65 | ret = (*fn)(filp, cmd, arg); |
67 | else | 66 | else |
68 | ret = drm_ioctl(filp->f_dentry->d_inode, filp, cmd, arg); | 67 | ret = drm_ioctl(filp, cmd, arg); |
69 | unlock_kernel(); | ||
70 | 68 | ||
71 | return ret; | 69 | return ret; |
72 | } | 70 | } |
diff --git a/drivers/gpu/drm/nouveau/nouveau_irq.c b/drivers/gpu/drm/nouveau/nouveau_irq.c index 370c72c968d1..919a619ca7fa 100644 --- a/drivers/gpu/drm/nouveau/nouveau_irq.c +++ b/drivers/gpu/drm/nouveau/nouveau_irq.c | |||
@@ -635,6 +635,7 @@ nv50_pgraph_irq_handler(struct drm_device *dev) | |||
635 | 635 | ||
636 | if ((nv_rd32(dev, 0x400500) & isb) != isb) | 636 | if ((nv_rd32(dev, 0x400500) & isb) != isb) |
637 | nv_wr32(dev, 0x400500, nv_rd32(dev, 0x400500) | isb); | 637 | nv_wr32(dev, 0x400500, nv_rd32(dev, 0x400500) | isb); |
638 | nv_wr32(dev, 0x400824, nv_rd32(dev, 0x400824) & ~(1 << 31)); | ||
638 | } | 639 | } |
639 | 640 | ||
640 | nv_wr32(dev, NV03_PMC_INTR_0, NV_PMC_INTR_0_PGRAPH_PENDING); | 641 | nv_wr32(dev, NV03_PMC_INTR_0, NV_PMC_INTR_0_PGRAPH_PENDING); |
diff --git a/drivers/gpu/drm/nouveau/nouveau_mem.c b/drivers/gpu/drm/nouveau/nouveau_mem.c index 5158a12f7844..fb9bdd6edf1f 100644 --- a/drivers/gpu/drm/nouveau/nouveau_mem.c +++ b/drivers/gpu/drm/nouveau/nouveau_mem.c | |||
@@ -192,6 +192,92 @@ void nouveau_mem_release(struct drm_file *file_priv, struct mem_block *heap) | |||
192 | } | 192 | } |
193 | 193 | ||
194 | /* | 194 | /* |
195 | * NV10-NV40 tiling helpers | ||
196 | */ | ||
197 | |||
198 | static void | ||
199 | nv10_mem_set_region_tiling(struct drm_device *dev, int i, uint32_t addr, | ||
200 | uint32_t size, uint32_t pitch) | ||
201 | { | ||
202 | struct drm_nouveau_private *dev_priv = dev->dev_private; | ||
203 | struct nouveau_fifo_engine *pfifo = &dev_priv->engine.fifo; | ||
204 | struct nouveau_fb_engine *pfb = &dev_priv->engine.fb; | ||
205 | struct nouveau_pgraph_engine *pgraph = &dev_priv->engine.graph; | ||
206 | struct nouveau_tile_reg *tile = &dev_priv->tile.reg[i]; | ||
207 | |||
208 | tile->addr = addr; | ||
209 | tile->size = size; | ||
210 | tile->used = !!pitch; | ||
211 | nouveau_fence_unref((void **)&tile->fence); | ||
212 | |||
213 | if (!pfifo->cache_flush(dev)) | ||
214 | return; | ||
215 | |||
216 | pfifo->reassign(dev, false); | ||
217 | pfifo->cache_flush(dev); | ||
218 | pfifo->cache_pull(dev, false); | ||
219 | |||
220 | nouveau_wait_for_idle(dev); | ||
221 | |||
222 | pgraph->set_region_tiling(dev, i, addr, size, pitch); | ||
223 | pfb->set_region_tiling(dev, i, addr, size, pitch); | ||
224 | |||
225 | pfifo->cache_pull(dev, true); | ||
226 | pfifo->reassign(dev, true); | ||
227 | } | ||
228 | |||
229 | struct nouveau_tile_reg * | ||
230 | nv10_mem_set_tiling(struct drm_device *dev, uint32_t addr, uint32_t size, | ||
231 | uint32_t pitch) | ||
232 | { | ||
233 | struct drm_nouveau_private *dev_priv = dev->dev_private; | ||
234 | struct nouveau_fb_engine *pfb = &dev_priv->engine.fb; | ||
235 | struct nouveau_tile_reg *tile = dev_priv->tile.reg, *found = NULL; | ||
236 | int i; | ||
237 | |||
238 | spin_lock(&dev_priv->tile.lock); | ||
239 | |||
240 | for (i = 0; i < pfb->num_tiles; i++) { | ||
241 | if (tile[i].used) | ||
242 | /* Tile region in use. */ | ||
243 | continue; | ||
244 | |||
245 | if (tile[i].fence && | ||
246 | !nouveau_fence_signalled(tile[i].fence, NULL)) | ||
247 | /* Pending tile region. */ | ||
248 | continue; | ||
249 | |||
250 | if (max(tile[i].addr, addr) < | ||
251 | min(tile[i].addr + tile[i].size, addr + size)) | ||
252 | /* Kill an intersecting tile region. */ | ||
253 | nv10_mem_set_region_tiling(dev, i, 0, 0, 0); | ||
254 | |||
255 | if (pitch && !found) { | ||
256 | /* Free tile region. */ | ||
257 | nv10_mem_set_region_tiling(dev, i, addr, size, pitch); | ||
258 | found = &tile[i]; | ||
259 | } | ||
260 | } | ||
261 | |||
262 | spin_unlock(&dev_priv->tile.lock); | ||
263 | |||
264 | return found; | ||
265 | } | ||
266 | |||
267 | void | ||
268 | nv10_mem_expire_tiling(struct drm_device *dev, struct nouveau_tile_reg *tile, | ||
269 | struct nouveau_fence *fence) | ||
270 | { | ||
271 | if (fence) { | ||
272 | /* Mark it as pending. */ | ||
273 | tile->fence = fence; | ||
274 | nouveau_fence_ref(fence); | ||
275 | } | ||
276 | |||
277 | tile->used = false; | ||
278 | } | ||
279 | |||
280 | /* | ||
195 | * NV50 VM helpers | 281 | * NV50 VM helpers |
196 | */ | 282 | */ |
197 | int | 283 | int |
@@ -513,6 +599,7 @@ nouveau_mem_init(struct drm_device *dev) | |||
513 | 599 | ||
514 | INIT_LIST_HEAD(&dev_priv->ttm.bo_list); | 600 | INIT_LIST_HEAD(&dev_priv->ttm.bo_list); |
515 | spin_lock_init(&dev_priv->ttm.bo_list_lock); | 601 | spin_lock_init(&dev_priv->ttm.bo_list_lock); |
602 | spin_lock_init(&dev_priv->tile.lock); | ||
516 | 603 | ||
517 | dev_priv->fb_available_size = nouveau_mem_fb_amount(dev); | 604 | dev_priv->fb_available_size = nouveau_mem_fb_amount(dev); |
518 | 605 | ||
diff --git a/drivers/gpu/drm/nouveau/nouveau_object.c b/drivers/gpu/drm/nouveau/nouveau_object.c index 93379bb81bea..6c2cf81716df 100644 --- a/drivers/gpu/drm/nouveau/nouveau_object.c +++ b/drivers/gpu/drm/nouveau/nouveau_object.c | |||
@@ -881,7 +881,7 @@ nouveau_gpuobj_gr_new(struct nouveau_channel *chan, int class, | |||
881 | return 0; | 881 | return 0; |
882 | } | 882 | } |
883 | 883 | ||
884 | static int | 884 | int |
885 | nouveau_gpuobj_sw_new(struct nouveau_channel *chan, int class, | 885 | nouveau_gpuobj_sw_new(struct nouveau_channel *chan, int class, |
886 | struct nouveau_gpuobj **gpuobj_ret) | 886 | struct nouveau_gpuobj **gpuobj_ret) |
887 | { | 887 | { |
diff --git a/drivers/gpu/drm/nouveau/nouveau_reg.h b/drivers/gpu/drm/nouveau/nouveau_reg.h index fa1b0e7165b9..251f1b3b38b9 100644 --- a/drivers/gpu/drm/nouveau/nouveau_reg.h +++ b/drivers/gpu/drm/nouveau/nouveau_reg.h | |||
@@ -349,19 +349,19 @@ | |||
349 | #define NV04_PGRAPH_BLEND 0x00400824 | 349 | #define NV04_PGRAPH_BLEND 0x00400824 |
350 | #define NV04_PGRAPH_STORED_FMT 0x00400830 | 350 | #define NV04_PGRAPH_STORED_FMT 0x00400830 |
351 | #define NV04_PGRAPH_PATT_COLORRAM 0x00400900 | 351 | #define NV04_PGRAPH_PATT_COLORRAM 0x00400900 |
352 | #define NV40_PGRAPH_TILE0(i) (0x00400900 + (i*16)) | 352 | #define NV20_PGRAPH_TILE(i) (0x00400900 + (i*16)) |
353 | #define NV40_PGRAPH_TLIMIT0(i) (0x00400904 + (i*16)) | 353 | #define NV20_PGRAPH_TLIMIT(i) (0x00400904 + (i*16)) |
354 | #define NV40_PGRAPH_TSIZE0(i) (0x00400908 + (i*16)) | 354 | #define NV20_PGRAPH_TSIZE(i) (0x00400908 + (i*16)) |
355 | #define NV40_PGRAPH_TSTATUS0(i) (0x0040090C + (i*16)) | 355 | #define NV20_PGRAPH_TSTATUS(i) (0x0040090C + (i*16)) |
356 | #define NV10_PGRAPH_TILE(i) (0x00400B00 + (i*16)) | 356 | #define NV10_PGRAPH_TILE(i) (0x00400B00 + (i*16)) |
357 | #define NV10_PGRAPH_TLIMIT(i) (0x00400B04 + (i*16)) | 357 | #define NV10_PGRAPH_TLIMIT(i) (0x00400B04 + (i*16)) |
358 | #define NV10_PGRAPH_TSIZE(i) (0x00400B08 + (i*16)) | 358 | #define NV10_PGRAPH_TSIZE(i) (0x00400B08 + (i*16)) |
359 | #define NV10_PGRAPH_TSTATUS(i) (0x00400B0C + (i*16)) | 359 | #define NV10_PGRAPH_TSTATUS(i) (0x00400B0C + (i*16)) |
360 | #define NV04_PGRAPH_U_RAM 0x00400D00 | 360 | #define NV04_PGRAPH_U_RAM 0x00400D00 |
361 | #define NV47_PGRAPH_TILE0(i) (0x00400D00 + (i*16)) | 361 | #define NV47_PGRAPH_TILE(i) (0x00400D00 + (i*16)) |
362 | #define NV47_PGRAPH_TLIMIT0(i) (0x00400D04 + (i*16)) | 362 | #define NV47_PGRAPH_TLIMIT(i) (0x00400D04 + (i*16)) |
363 | #define NV47_PGRAPH_TSIZE0(i) (0x00400D08 + (i*16)) | 363 | #define NV47_PGRAPH_TSIZE(i) (0x00400D08 + (i*16)) |
364 | #define NV47_PGRAPH_TSTATUS0(i) (0x00400D0C + (i*16)) | 364 | #define NV47_PGRAPH_TSTATUS(i) (0x00400D0C + (i*16)) |
365 | #define NV04_PGRAPH_V_RAM 0x00400D40 | 365 | #define NV04_PGRAPH_V_RAM 0x00400D40 |
366 | #define NV04_PGRAPH_W_RAM 0x00400D80 | 366 | #define NV04_PGRAPH_W_RAM 0x00400D80 |
367 | #define NV10_PGRAPH_COMBINER0_IN_ALPHA 0x00400E40 | 367 | #define NV10_PGRAPH_COMBINER0_IN_ALPHA 0x00400E40 |
diff --git a/drivers/gpu/drm/nouveau/nouveau_state.c b/drivers/gpu/drm/nouveau/nouveau_state.c index 2ed41d339f6a..09b9a46dfc0e 100644 --- a/drivers/gpu/drm/nouveau/nouveau_state.c +++ b/drivers/gpu/drm/nouveau/nouveau_state.c | |||
@@ -76,6 +76,8 @@ static int nouveau_init_engine_ptrs(struct drm_device *dev) | |||
76 | engine->fifo.disable = nv04_fifo_disable; | 76 | engine->fifo.disable = nv04_fifo_disable; |
77 | engine->fifo.enable = nv04_fifo_enable; | 77 | engine->fifo.enable = nv04_fifo_enable; |
78 | engine->fifo.reassign = nv04_fifo_reassign; | 78 | engine->fifo.reassign = nv04_fifo_reassign; |
79 | engine->fifo.cache_flush = nv04_fifo_cache_flush; | ||
80 | engine->fifo.cache_pull = nv04_fifo_cache_pull; | ||
79 | engine->fifo.channel_id = nv04_fifo_channel_id; | 81 | engine->fifo.channel_id = nv04_fifo_channel_id; |
80 | engine->fifo.create_context = nv04_fifo_create_context; | 82 | engine->fifo.create_context = nv04_fifo_create_context; |
81 | engine->fifo.destroy_context = nv04_fifo_destroy_context; | 83 | engine->fifo.destroy_context = nv04_fifo_destroy_context; |
@@ -100,6 +102,7 @@ static int nouveau_init_engine_ptrs(struct drm_device *dev) | |||
100 | engine->timer.takedown = nv04_timer_takedown; | 102 | engine->timer.takedown = nv04_timer_takedown; |
101 | engine->fb.init = nv10_fb_init; | 103 | engine->fb.init = nv10_fb_init; |
102 | engine->fb.takedown = nv10_fb_takedown; | 104 | engine->fb.takedown = nv10_fb_takedown; |
105 | engine->fb.set_region_tiling = nv10_fb_set_region_tiling; | ||
103 | engine->graph.grclass = nv10_graph_grclass; | 106 | engine->graph.grclass = nv10_graph_grclass; |
104 | engine->graph.init = nv10_graph_init; | 107 | engine->graph.init = nv10_graph_init; |
105 | engine->graph.takedown = nv10_graph_takedown; | 108 | engine->graph.takedown = nv10_graph_takedown; |
@@ -109,12 +112,15 @@ static int nouveau_init_engine_ptrs(struct drm_device *dev) | |||
109 | engine->graph.fifo_access = nv04_graph_fifo_access; | 112 | engine->graph.fifo_access = nv04_graph_fifo_access; |
110 | engine->graph.load_context = nv10_graph_load_context; | 113 | engine->graph.load_context = nv10_graph_load_context; |
111 | engine->graph.unload_context = nv10_graph_unload_context; | 114 | engine->graph.unload_context = nv10_graph_unload_context; |
115 | engine->graph.set_region_tiling = nv10_graph_set_region_tiling; | ||
112 | engine->fifo.channels = 32; | 116 | engine->fifo.channels = 32; |
113 | engine->fifo.init = nv10_fifo_init; | 117 | engine->fifo.init = nv10_fifo_init; |
114 | engine->fifo.takedown = nouveau_stub_takedown; | 118 | engine->fifo.takedown = nouveau_stub_takedown; |
115 | engine->fifo.disable = nv04_fifo_disable; | 119 | engine->fifo.disable = nv04_fifo_disable; |
116 | engine->fifo.enable = nv04_fifo_enable; | 120 | engine->fifo.enable = nv04_fifo_enable; |
117 | engine->fifo.reassign = nv04_fifo_reassign; | 121 | engine->fifo.reassign = nv04_fifo_reassign; |
122 | engine->fifo.cache_flush = nv04_fifo_cache_flush; | ||
123 | engine->fifo.cache_pull = nv04_fifo_cache_pull; | ||
118 | engine->fifo.channel_id = nv10_fifo_channel_id; | 124 | engine->fifo.channel_id = nv10_fifo_channel_id; |
119 | engine->fifo.create_context = nv10_fifo_create_context; | 125 | engine->fifo.create_context = nv10_fifo_create_context; |
120 | engine->fifo.destroy_context = nv10_fifo_destroy_context; | 126 | engine->fifo.destroy_context = nv10_fifo_destroy_context; |
@@ -139,6 +145,7 @@ static int nouveau_init_engine_ptrs(struct drm_device *dev) | |||
139 | engine->timer.takedown = nv04_timer_takedown; | 145 | engine->timer.takedown = nv04_timer_takedown; |
140 | engine->fb.init = nv10_fb_init; | 146 | engine->fb.init = nv10_fb_init; |
141 | engine->fb.takedown = nv10_fb_takedown; | 147 | engine->fb.takedown = nv10_fb_takedown; |
148 | engine->fb.set_region_tiling = nv10_fb_set_region_tiling; | ||
142 | engine->graph.grclass = nv20_graph_grclass; | 149 | engine->graph.grclass = nv20_graph_grclass; |
143 | engine->graph.init = nv20_graph_init; | 150 | engine->graph.init = nv20_graph_init; |
144 | engine->graph.takedown = nv20_graph_takedown; | 151 | engine->graph.takedown = nv20_graph_takedown; |
@@ -148,12 +155,15 @@ static int nouveau_init_engine_ptrs(struct drm_device *dev) | |||
148 | engine->graph.fifo_access = nv04_graph_fifo_access; | 155 | engine->graph.fifo_access = nv04_graph_fifo_access; |
149 | engine->graph.load_context = nv20_graph_load_context; | 156 | engine->graph.load_context = nv20_graph_load_context; |
150 | engine->graph.unload_context = nv20_graph_unload_context; | 157 | engine->graph.unload_context = nv20_graph_unload_context; |
158 | engine->graph.set_region_tiling = nv20_graph_set_region_tiling; | ||
151 | engine->fifo.channels = 32; | 159 | engine->fifo.channels = 32; |
152 | engine->fifo.init = nv10_fifo_init; | 160 | engine->fifo.init = nv10_fifo_init; |
153 | engine->fifo.takedown = nouveau_stub_takedown; | 161 | engine->fifo.takedown = nouveau_stub_takedown; |
154 | engine->fifo.disable = nv04_fifo_disable; | 162 | engine->fifo.disable = nv04_fifo_disable; |
155 | engine->fifo.enable = nv04_fifo_enable; | 163 | engine->fifo.enable = nv04_fifo_enable; |
156 | engine->fifo.reassign = nv04_fifo_reassign; | 164 | engine->fifo.reassign = nv04_fifo_reassign; |
165 | engine->fifo.cache_flush = nv04_fifo_cache_flush; | ||
166 | engine->fifo.cache_pull = nv04_fifo_cache_pull; | ||
157 | engine->fifo.channel_id = nv10_fifo_channel_id; | 167 | engine->fifo.channel_id = nv10_fifo_channel_id; |
158 | engine->fifo.create_context = nv10_fifo_create_context; | 168 | engine->fifo.create_context = nv10_fifo_create_context; |
159 | engine->fifo.destroy_context = nv10_fifo_destroy_context; | 169 | engine->fifo.destroy_context = nv10_fifo_destroy_context; |
@@ -178,6 +188,7 @@ static int nouveau_init_engine_ptrs(struct drm_device *dev) | |||
178 | engine->timer.takedown = nv04_timer_takedown; | 188 | engine->timer.takedown = nv04_timer_takedown; |
179 | engine->fb.init = nv10_fb_init; | 189 | engine->fb.init = nv10_fb_init; |
180 | engine->fb.takedown = nv10_fb_takedown; | 190 | engine->fb.takedown = nv10_fb_takedown; |
191 | engine->fb.set_region_tiling = nv10_fb_set_region_tiling; | ||
181 | engine->graph.grclass = nv30_graph_grclass; | 192 | engine->graph.grclass = nv30_graph_grclass; |
182 | engine->graph.init = nv30_graph_init; | 193 | engine->graph.init = nv30_graph_init; |
183 | engine->graph.takedown = nv20_graph_takedown; | 194 | engine->graph.takedown = nv20_graph_takedown; |
@@ -187,12 +198,15 @@ static int nouveau_init_engine_ptrs(struct drm_device *dev) | |||
187 | engine->graph.destroy_context = nv20_graph_destroy_context; | 198 | engine->graph.destroy_context = nv20_graph_destroy_context; |
188 | engine->graph.load_context = nv20_graph_load_context; | 199 | engine->graph.load_context = nv20_graph_load_context; |
189 | engine->graph.unload_context = nv20_graph_unload_context; | 200 | engine->graph.unload_context = nv20_graph_unload_context; |
201 | engine->graph.set_region_tiling = nv20_graph_set_region_tiling; | ||
190 | engine->fifo.channels = 32; | 202 | engine->fifo.channels = 32; |
191 | engine->fifo.init = nv10_fifo_init; | 203 | engine->fifo.init = nv10_fifo_init; |
192 | engine->fifo.takedown = nouveau_stub_takedown; | 204 | engine->fifo.takedown = nouveau_stub_takedown; |
193 | engine->fifo.disable = nv04_fifo_disable; | 205 | engine->fifo.disable = nv04_fifo_disable; |
194 | engine->fifo.enable = nv04_fifo_enable; | 206 | engine->fifo.enable = nv04_fifo_enable; |
195 | engine->fifo.reassign = nv04_fifo_reassign; | 207 | engine->fifo.reassign = nv04_fifo_reassign; |
208 | engine->fifo.cache_flush = nv04_fifo_cache_flush; | ||
209 | engine->fifo.cache_pull = nv04_fifo_cache_pull; | ||
196 | engine->fifo.channel_id = nv10_fifo_channel_id; | 210 | engine->fifo.channel_id = nv10_fifo_channel_id; |
197 | engine->fifo.create_context = nv10_fifo_create_context; | 211 | engine->fifo.create_context = nv10_fifo_create_context; |
198 | engine->fifo.destroy_context = nv10_fifo_destroy_context; | 212 | engine->fifo.destroy_context = nv10_fifo_destroy_context; |
@@ -218,6 +232,7 @@ static int nouveau_init_engine_ptrs(struct drm_device *dev) | |||
218 | engine->timer.takedown = nv04_timer_takedown; | 232 | engine->timer.takedown = nv04_timer_takedown; |
219 | engine->fb.init = nv40_fb_init; | 233 | engine->fb.init = nv40_fb_init; |
220 | engine->fb.takedown = nv40_fb_takedown; | 234 | engine->fb.takedown = nv40_fb_takedown; |
235 | engine->fb.set_region_tiling = nv40_fb_set_region_tiling; | ||
221 | engine->graph.grclass = nv40_graph_grclass; | 236 | engine->graph.grclass = nv40_graph_grclass; |
222 | engine->graph.init = nv40_graph_init; | 237 | engine->graph.init = nv40_graph_init; |
223 | engine->graph.takedown = nv40_graph_takedown; | 238 | engine->graph.takedown = nv40_graph_takedown; |
@@ -227,12 +242,15 @@ static int nouveau_init_engine_ptrs(struct drm_device *dev) | |||
227 | engine->graph.destroy_context = nv40_graph_destroy_context; | 242 | engine->graph.destroy_context = nv40_graph_destroy_context; |
228 | engine->graph.load_context = nv40_graph_load_context; | 243 | engine->graph.load_context = nv40_graph_load_context; |
229 | engine->graph.unload_context = nv40_graph_unload_context; | 244 | engine->graph.unload_context = nv40_graph_unload_context; |
245 | engine->graph.set_region_tiling = nv40_graph_set_region_tiling; | ||
230 | engine->fifo.channels = 32; | 246 | engine->fifo.channels = 32; |
231 | engine->fifo.init = nv40_fifo_init; | 247 | engine->fifo.init = nv40_fifo_init; |
232 | engine->fifo.takedown = nouveau_stub_takedown; | 248 | engine->fifo.takedown = nouveau_stub_takedown; |
233 | engine->fifo.disable = nv04_fifo_disable; | 249 | engine->fifo.disable = nv04_fifo_disable; |
234 | engine->fifo.enable = nv04_fifo_enable; | 250 | engine->fifo.enable = nv04_fifo_enable; |
235 | engine->fifo.reassign = nv04_fifo_reassign; | 251 | engine->fifo.reassign = nv04_fifo_reassign; |
252 | engine->fifo.cache_flush = nv04_fifo_cache_flush; | ||
253 | engine->fifo.cache_pull = nv04_fifo_cache_pull; | ||
236 | engine->fifo.channel_id = nv10_fifo_channel_id; | 254 | engine->fifo.channel_id = nv10_fifo_channel_id; |
237 | engine->fifo.create_context = nv40_fifo_create_context; | 255 | engine->fifo.create_context = nv40_fifo_create_context; |
238 | engine->fifo.destroy_context = nv40_fifo_destroy_context; | 256 | engine->fifo.destroy_context = nv40_fifo_destroy_context; |
@@ -299,12 +317,57 @@ nouveau_vga_set_decode(void *priv, bool state) | |||
299 | return VGA_RSRC_NORMAL_IO | VGA_RSRC_NORMAL_MEM; | 317 | return VGA_RSRC_NORMAL_IO | VGA_RSRC_NORMAL_MEM; |
300 | } | 318 | } |
301 | 319 | ||
320 | static int | ||
321 | nouveau_card_init_channel(struct drm_device *dev) | ||
322 | { | ||
323 | struct drm_nouveau_private *dev_priv = dev->dev_private; | ||
324 | struct nouveau_gpuobj *gpuobj; | ||
325 | int ret; | ||
326 | |||
327 | ret = nouveau_channel_alloc(dev, &dev_priv->channel, | ||
328 | (struct drm_file *)-2, | ||
329 | NvDmaFB, NvDmaTT); | ||
330 | if (ret) | ||
331 | return ret; | ||
332 | |||
333 | gpuobj = NULL; | ||
334 | ret = nouveau_gpuobj_dma_new(dev_priv->channel, NV_CLASS_DMA_IN_MEMORY, | ||
335 | 0, nouveau_mem_fb_amount(dev), | ||
336 | NV_DMA_ACCESS_RW, NV_DMA_TARGET_VIDMEM, | ||
337 | &gpuobj); | ||
338 | if (ret) | ||
339 | goto out_err; | ||
340 | |||
341 | ret = nouveau_gpuobj_ref_add(dev, dev_priv->channel, NvDmaVRAM, | ||
342 | gpuobj, NULL); | ||
343 | if (ret) | ||
344 | goto out_err; | ||
345 | |||
346 | gpuobj = NULL; | ||
347 | ret = nouveau_gpuobj_gart_dma_new(dev_priv->channel, 0, | ||
348 | dev_priv->gart_info.aper_size, | ||
349 | NV_DMA_ACCESS_RW, &gpuobj, NULL); | ||
350 | if (ret) | ||
351 | goto out_err; | ||
352 | |||
353 | ret = nouveau_gpuobj_ref_add(dev, dev_priv->channel, NvDmaGART, | ||
354 | gpuobj, NULL); | ||
355 | if (ret) | ||
356 | goto out_err; | ||
357 | |||
358 | return 0; | ||
359 | out_err: | ||
360 | nouveau_gpuobj_del(dev, &gpuobj); | ||
361 | nouveau_channel_free(dev_priv->channel); | ||
362 | dev_priv->channel = NULL; | ||
363 | return ret; | ||
364 | } | ||
365 | |||
302 | int | 366 | int |
303 | nouveau_card_init(struct drm_device *dev) | 367 | nouveau_card_init(struct drm_device *dev) |
304 | { | 368 | { |
305 | struct drm_nouveau_private *dev_priv = dev->dev_private; | 369 | struct drm_nouveau_private *dev_priv = dev->dev_private; |
306 | struct nouveau_engine *engine; | 370 | struct nouveau_engine *engine; |
307 | struct nouveau_gpuobj *gpuobj; | ||
308 | int ret; | 371 | int ret; |
309 | 372 | ||
310 | NV_DEBUG(dev, "prev state = %d\n", dev_priv->init_state); | 373 | NV_DEBUG(dev, "prev state = %d\n", dev_priv->init_state); |
@@ -317,7 +380,7 @@ nouveau_card_init(struct drm_device *dev) | |||
317 | /* Initialise internal driver API hooks */ | 380 | /* Initialise internal driver API hooks */ |
318 | ret = nouveau_init_engine_ptrs(dev); | 381 | ret = nouveau_init_engine_ptrs(dev); |
319 | if (ret) | 382 | if (ret) |
320 | return ret; | 383 | goto out; |
321 | engine = &dev_priv->engine; | 384 | engine = &dev_priv->engine; |
322 | dev_priv->init_state = NOUVEAU_CARD_INIT_FAILED; | 385 | dev_priv->init_state = NOUVEAU_CARD_INIT_FAILED; |
323 | 386 | ||
@@ -325,12 +388,12 @@ nouveau_card_init(struct drm_device *dev) | |||
325 | if (drm_core_check_feature(dev, DRIVER_MODESET)) { | 388 | if (drm_core_check_feature(dev, DRIVER_MODESET)) { |
326 | ret = nouveau_bios_init(dev); | 389 | ret = nouveau_bios_init(dev); |
327 | if (ret) | 390 | if (ret) |
328 | return ret; | 391 | goto out; |
329 | } | 392 | } |
330 | 393 | ||
331 | ret = nouveau_gpuobj_early_init(dev); | 394 | ret = nouveau_gpuobj_early_init(dev); |
332 | if (ret) | 395 | if (ret) |
333 | return ret; | 396 | goto out_bios; |
334 | 397 | ||
335 | /* Initialise instance memory, must happen before mem_init so we | 398 | /* Initialise instance memory, must happen before mem_init so we |
336 | * know exactly how much VRAM we're able to use for "normal" | 399 | * know exactly how much VRAM we're able to use for "normal" |
@@ -338,100 +401,68 @@ nouveau_card_init(struct drm_device *dev) | |||
338 | */ | 401 | */ |
339 | ret = engine->instmem.init(dev); | 402 | ret = engine->instmem.init(dev); |
340 | if (ret) | 403 | if (ret) |
341 | return ret; | 404 | goto out_gpuobj_early; |
342 | 405 | ||
343 | /* Setup the memory manager */ | 406 | /* Setup the memory manager */ |
344 | ret = nouveau_mem_init(dev); | 407 | ret = nouveau_mem_init(dev); |
345 | if (ret) | 408 | if (ret) |
346 | return ret; | 409 | goto out_instmem; |
347 | 410 | ||
348 | ret = nouveau_gpuobj_init(dev); | 411 | ret = nouveau_gpuobj_init(dev); |
349 | if (ret) | 412 | if (ret) |
350 | return ret; | 413 | goto out_mem; |
351 | 414 | ||
352 | /* PMC */ | 415 | /* PMC */ |
353 | ret = engine->mc.init(dev); | 416 | ret = engine->mc.init(dev); |
354 | if (ret) | 417 | if (ret) |
355 | return ret; | 418 | goto out_gpuobj; |
356 | 419 | ||
357 | /* PTIMER */ | 420 | /* PTIMER */ |
358 | ret = engine->timer.init(dev); | 421 | ret = engine->timer.init(dev); |
359 | if (ret) | 422 | if (ret) |
360 | return ret; | 423 | goto out_mc; |
361 | 424 | ||
362 | /* PFB */ | 425 | /* PFB */ |
363 | ret = engine->fb.init(dev); | 426 | ret = engine->fb.init(dev); |
364 | if (ret) | 427 | if (ret) |
365 | return ret; | 428 | goto out_timer; |
366 | 429 | ||
367 | /* PGRAPH */ | 430 | /* PGRAPH */ |
368 | ret = engine->graph.init(dev); | 431 | ret = engine->graph.init(dev); |
369 | if (ret) | 432 | if (ret) |
370 | return ret; | 433 | goto out_fb; |
371 | 434 | ||
372 | /* PFIFO */ | 435 | /* PFIFO */ |
373 | ret = engine->fifo.init(dev); | 436 | ret = engine->fifo.init(dev); |
374 | if (ret) | 437 | if (ret) |
375 | return ret; | 438 | goto out_graph; |
376 | 439 | ||
377 | /* this call irq_preinstall, register irq handler and | 440 | /* this call irq_preinstall, register irq handler and |
378 | * call irq_postinstall | 441 | * call irq_postinstall |
379 | */ | 442 | */ |
380 | ret = drm_irq_install(dev); | 443 | ret = drm_irq_install(dev); |
381 | if (ret) | 444 | if (ret) |
382 | return ret; | 445 | goto out_fifo; |
383 | 446 | ||
384 | ret = drm_vblank_init(dev, 0); | 447 | ret = drm_vblank_init(dev, 0); |
385 | if (ret) | 448 | if (ret) |
386 | return ret; | 449 | goto out_irq; |
387 | 450 | ||
388 | /* what about PVIDEO/PCRTC/PRAMDAC etc? */ | 451 | /* what about PVIDEO/PCRTC/PRAMDAC etc? */ |
389 | 452 | ||
390 | ret = nouveau_channel_alloc(dev, &dev_priv->channel, | 453 | if (!engine->graph.accel_blocked) { |
391 | (struct drm_file *)-2, | 454 | ret = nouveau_card_init_channel(dev); |
392 | NvDmaFB, NvDmaTT); | 455 | if (ret) |
393 | if (ret) | 456 | goto out_irq; |
394 | return ret; | ||
395 | |||
396 | gpuobj = NULL; | ||
397 | ret = nouveau_gpuobj_dma_new(dev_priv->channel, NV_CLASS_DMA_IN_MEMORY, | ||
398 | 0, nouveau_mem_fb_amount(dev), | ||
399 | NV_DMA_ACCESS_RW, NV_DMA_TARGET_VIDMEM, | ||
400 | &gpuobj); | ||
401 | if (ret) | ||
402 | return ret; | ||
403 | |||
404 | ret = nouveau_gpuobj_ref_add(dev, dev_priv->channel, NvDmaVRAM, | ||
405 | gpuobj, NULL); | ||
406 | if (ret) { | ||
407 | nouveau_gpuobj_del(dev, &gpuobj); | ||
408 | return ret; | ||
409 | } | ||
410 | |||
411 | gpuobj = NULL; | ||
412 | ret = nouveau_gpuobj_gart_dma_new(dev_priv->channel, 0, | ||
413 | dev_priv->gart_info.aper_size, | ||
414 | NV_DMA_ACCESS_RW, &gpuobj, NULL); | ||
415 | if (ret) | ||
416 | return ret; | ||
417 | |||
418 | ret = nouveau_gpuobj_ref_add(dev, dev_priv->channel, NvDmaGART, | ||
419 | gpuobj, NULL); | ||
420 | if (ret) { | ||
421 | nouveau_gpuobj_del(dev, &gpuobj); | ||
422 | return ret; | ||
423 | } | 457 | } |
424 | 458 | ||
425 | if (drm_core_check_feature(dev, DRIVER_MODESET)) { | 459 | if (drm_core_check_feature(dev, DRIVER_MODESET)) { |
426 | if (dev_priv->card_type >= NV_50) { | 460 | if (dev_priv->card_type >= NV_50) |
427 | ret = nv50_display_create(dev); | 461 | ret = nv50_display_create(dev); |
428 | if (ret) | 462 | else |
429 | return ret; | ||
430 | } else { | ||
431 | ret = nv04_display_create(dev); | 463 | ret = nv04_display_create(dev); |
432 | if (ret) | 464 | if (ret) |
433 | return ret; | 465 | goto out_irq; |
434 | } | ||
435 | } | 466 | } |
436 | 467 | ||
437 | ret = nouveau_backlight_init(dev); | 468 | ret = nouveau_backlight_init(dev); |
@@ -444,6 +475,32 @@ nouveau_card_init(struct drm_device *dev) | |||
444 | drm_helper_initial_config(dev); | 475 | drm_helper_initial_config(dev); |
445 | 476 | ||
446 | return 0; | 477 | return 0; |
478 | |||
479 | out_irq: | ||
480 | drm_irq_uninstall(dev); | ||
481 | out_fifo: | ||
482 | engine->fifo.takedown(dev); | ||
483 | out_graph: | ||
484 | engine->graph.takedown(dev); | ||
485 | out_fb: | ||
486 | engine->fb.takedown(dev); | ||
487 | out_timer: | ||
488 | engine->timer.takedown(dev); | ||
489 | out_mc: | ||
490 | engine->mc.takedown(dev); | ||
491 | out_gpuobj: | ||
492 | nouveau_gpuobj_takedown(dev); | ||
493 | out_mem: | ||
494 | nouveau_mem_close(dev); | ||
495 | out_instmem: | ||
496 | engine->instmem.takedown(dev); | ||
497 | out_gpuobj_early: | ||
498 | nouveau_gpuobj_late_takedown(dev); | ||
499 | out_bios: | ||
500 | nouveau_bios_takedown(dev); | ||
501 | out: | ||
502 | vga_client_register(dev->pdev, NULL, NULL, NULL); | ||
503 | return ret; | ||
447 | } | 504 | } |
448 | 505 | ||
449 | static void nouveau_card_takedown(struct drm_device *dev) | 506 | static void nouveau_card_takedown(struct drm_device *dev) |
@@ -585,7 +642,10 @@ int nouveau_load(struct drm_device *dev, unsigned long flags) | |||
585 | dev_priv->chipset = (reg0 & 0xff00000) >> 20; | 642 | dev_priv->chipset = (reg0 & 0xff00000) >> 20; |
586 | /* NV04 or NV05 */ | 643 | /* NV04 or NV05 */ |
587 | } else if ((reg0 & 0xff00fff0) == 0x20004000) { | 644 | } else if ((reg0 & 0xff00fff0) == 0x20004000) { |
588 | dev_priv->chipset = 0x04; | 645 | if (reg0 & 0x00f00000) |
646 | dev_priv->chipset = 0x05; | ||
647 | else | ||
648 | dev_priv->chipset = 0x04; | ||
589 | } else | 649 | } else |
590 | dev_priv->chipset = 0xff; | 650 | dev_priv->chipset = 0xff; |
591 | 651 | ||
@@ -665,8 +725,8 @@ static void nouveau_close(struct drm_device *dev) | |||
665 | { | 725 | { |
666 | struct drm_nouveau_private *dev_priv = dev->dev_private; | 726 | struct drm_nouveau_private *dev_priv = dev->dev_private; |
667 | 727 | ||
668 | /* In the case of an error dev_priv may not be be allocated yet */ | 728 | /* In the case of an error dev_priv may not be allocated yet */ |
669 | if (dev_priv && dev_priv->card_type) | 729 | if (dev_priv) |
670 | nouveau_card_takedown(dev); | 730 | nouveau_card_takedown(dev); |
671 | } | 731 | } |
672 | 732 | ||
diff --git a/drivers/gpu/drm/nouveau/nouveau_ttm.c b/drivers/gpu/drm/nouveau/nouveau_ttm.c index 187eb84e4da5..c385d50f041b 100644 --- a/drivers/gpu/drm/nouveau/nouveau_ttm.c +++ b/drivers/gpu/drm/nouveau/nouveau_ttm.c | |||
@@ -28,45 +28,17 @@ | |||
28 | 28 | ||
29 | #include "nouveau_drv.h" | 29 | #include "nouveau_drv.h" |
30 | 30 | ||
31 | static struct vm_operations_struct nouveau_ttm_vm_ops; | ||
32 | static const struct vm_operations_struct *ttm_vm_ops; | ||
33 | |||
34 | static int | ||
35 | nouveau_ttm_fault(struct vm_area_struct *vma, struct vm_fault *vmf) | ||
36 | { | ||
37 | struct ttm_buffer_object *bo = vma->vm_private_data; | ||
38 | int ret; | ||
39 | |||
40 | if (unlikely(bo == NULL)) | ||
41 | return VM_FAULT_NOPAGE; | ||
42 | |||
43 | ret = ttm_vm_ops->fault(vma, vmf); | ||
44 | return ret; | ||
45 | } | ||
46 | |||
47 | int | 31 | int |
48 | nouveau_ttm_mmap(struct file *filp, struct vm_area_struct *vma) | 32 | nouveau_ttm_mmap(struct file *filp, struct vm_area_struct *vma) |
49 | { | 33 | { |
50 | struct drm_file *file_priv = filp->private_data; | 34 | struct drm_file *file_priv = filp->private_data; |
51 | struct drm_nouveau_private *dev_priv = | 35 | struct drm_nouveau_private *dev_priv = |
52 | file_priv->minor->dev->dev_private; | 36 | file_priv->minor->dev->dev_private; |
53 | int ret; | ||
54 | 37 | ||
55 | if (unlikely(vma->vm_pgoff < DRM_FILE_PAGE_OFFSET)) | 38 | if (unlikely(vma->vm_pgoff < DRM_FILE_PAGE_OFFSET)) |
56 | return drm_mmap(filp, vma); | 39 | return drm_mmap(filp, vma); |
57 | 40 | ||
58 | ret = ttm_bo_mmap(filp, vma, &dev_priv->ttm.bdev); | 41 | return ttm_bo_mmap(filp, vma, &dev_priv->ttm.bdev); |
59 | if (unlikely(ret != 0)) | ||
60 | return ret; | ||
61 | |||
62 | if (unlikely(ttm_vm_ops == NULL)) { | ||
63 | ttm_vm_ops = vma->vm_ops; | ||
64 | nouveau_ttm_vm_ops = *ttm_vm_ops; | ||
65 | nouveau_ttm_vm_ops.fault = &nouveau_ttm_fault; | ||
66 | } | ||
67 | |||
68 | vma->vm_ops = &nouveau_ttm_vm_ops; | ||
69 | return 0; | ||
70 | } | 42 | } |
71 | 43 | ||
72 | static int | 44 | static int |
diff --git a/drivers/gpu/drm/nouveau/nv04_crtc.c b/drivers/gpu/drm/nouveau/nv04_crtc.c index b91363606055..d2f143ed97c1 100644 --- a/drivers/gpu/drm/nouveau/nv04_crtc.c +++ b/drivers/gpu/drm/nouveau/nv04_crtc.c | |||
@@ -143,10 +143,10 @@ static void nv_crtc_calc_state_ext(struct drm_crtc *crtc, struct drm_display_mod | |||
143 | state->pllsel |= nv_crtc->index ? PLLSEL_VPLL2_MASK : PLLSEL_VPLL1_MASK; | 143 | state->pllsel |= nv_crtc->index ? PLLSEL_VPLL2_MASK : PLLSEL_VPLL1_MASK; |
144 | 144 | ||
145 | if (pv->NM2) | 145 | if (pv->NM2) |
146 | NV_TRACE(dev, "vpll: n1 %d n2 %d m1 %d m2 %d log2p %d\n", | 146 | NV_DEBUG_KMS(dev, "vpll: n1 %d n2 %d m1 %d m2 %d log2p %d\n", |
147 | pv->N1, pv->N2, pv->M1, pv->M2, pv->log2P); | 147 | pv->N1, pv->N2, pv->M1, pv->M2, pv->log2P); |
148 | else | 148 | else |
149 | NV_TRACE(dev, "vpll: n %d m %d log2p %d\n", | 149 | NV_DEBUG_KMS(dev, "vpll: n %d m %d log2p %d\n", |
150 | pv->N1, pv->M1, pv->log2P); | 150 | pv->N1, pv->M1, pv->log2P); |
151 | 151 | ||
152 | nv_crtc->cursor.set_offset(nv_crtc, nv_crtc->cursor.offset); | 152 | nv_crtc->cursor.set_offset(nv_crtc, nv_crtc->cursor.offset); |
@@ -160,7 +160,7 @@ nv_crtc_dpms(struct drm_crtc *crtc, int mode) | |||
160 | unsigned char seq1 = 0, crtc17 = 0; | 160 | unsigned char seq1 = 0, crtc17 = 0; |
161 | unsigned char crtc1A; | 161 | unsigned char crtc1A; |
162 | 162 | ||
163 | NV_TRACE(dev, "Setting dpms mode %d on CRTC %d\n", mode, | 163 | NV_DEBUG_KMS(dev, "Setting dpms mode %d on CRTC %d\n", mode, |
164 | nv_crtc->index); | 164 | nv_crtc->index); |
165 | 165 | ||
166 | if (nv_crtc->last_dpms == mode) /* Don't do unnecesary mode changes. */ | 166 | if (nv_crtc->last_dpms == mode) /* Don't do unnecesary mode changes. */ |
@@ -603,7 +603,7 @@ nv_crtc_mode_set(struct drm_crtc *crtc, struct drm_display_mode *mode, | |||
603 | struct nouveau_crtc *nv_crtc = nouveau_crtc(crtc); | 603 | struct nouveau_crtc *nv_crtc = nouveau_crtc(crtc); |
604 | struct drm_nouveau_private *dev_priv = dev->dev_private; | 604 | struct drm_nouveau_private *dev_priv = dev->dev_private; |
605 | 605 | ||
606 | NV_DEBUG(dev, "CTRC mode on CRTC %d:\n", nv_crtc->index); | 606 | NV_DEBUG_KMS(dev, "CTRC mode on CRTC %d:\n", nv_crtc->index); |
607 | drm_mode_debug_printmodeline(adjusted_mode); | 607 | drm_mode_debug_printmodeline(adjusted_mode); |
608 | 608 | ||
609 | /* unlock must come after turning off FP_TG_CONTROL in output_prepare */ | 609 | /* unlock must come after turning off FP_TG_CONTROL in output_prepare */ |
@@ -703,7 +703,7 @@ static void nv_crtc_destroy(struct drm_crtc *crtc) | |||
703 | { | 703 | { |
704 | struct nouveau_crtc *nv_crtc = nouveau_crtc(crtc); | 704 | struct nouveau_crtc *nv_crtc = nouveau_crtc(crtc); |
705 | 705 | ||
706 | NV_DEBUG(crtc->dev, "\n"); | 706 | NV_DEBUG_KMS(crtc->dev, "\n"); |
707 | 707 | ||
708 | if (!nv_crtc) | 708 | if (!nv_crtc) |
709 | return; | 709 | return; |
diff --git a/drivers/gpu/drm/nouveau/nv04_dac.c b/drivers/gpu/drm/nouveau/nv04_dac.c index a5fa51714e87..d0e038d28948 100644 --- a/drivers/gpu/drm/nouveau/nv04_dac.c +++ b/drivers/gpu/drm/nouveau/nv04_dac.c | |||
@@ -205,23 +205,22 @@ out: | |||
205 | NVWriteVgaSeq(dev, 0, NV_VIO_SR_CLOCK_INDEX, saved_seq1); | 205 | NVWriteVgaSeq(dev, 0, NV_VIO_SR_CLOCK_INDEX, saved_seq1); |
206 | 206 | ||
207 | if (blue == 0x18) { | 207 | if (blue == 0x18) { |
208 | NV_TRACE(dev, "Load detected on head A\n"); | 208 | NV_INFO(dev, "Load detected on head A\n"); |
209 | return connector_status_connected; | 209 | return connector_status_connected; |
210 | } | 210 | } |
211 | 211 | ||
212 | return connector_status_disconnected; | 212 | return connector_status_disconnected; |
213 | } | 213 | } |
214 | 214 | ||
215 | enum drm_connector_status nv17_dac_detect(struct drm_encoder *encoder, | 215 | uint32_t nv17_dac_sample_load(struct drm_encoder *encoder) |
216 | struct drm_connector *connector) | ||
217 | { | 216 | { |
218 | struct drm_device *dev = encoder->dev; | 217 | struct drm_device *dev = encoder->dev; |
219 | struct drm_nouveau_private *dev_priv = dev->dev_private; | 218 | struct drm_nouveau_private *dev_priv = dev->dev_private; |
220 | struct dcb_entry *dcb = nouveau_encoder(encoder)->dcb; | 219 | struct dcb_entry *dcb = nouveau_encoder(encoder)->dcb; |
221 | uint32_t testval, regoffset = nv04_dac_output_offset(encoder); | 220 | uint32_t sample, testval, regoffset = nv04_dac_output_offset(encoder); |
222 | uint32_t saved_powerctrl_2 = 0, saved_powerctrl_4 = 0, saved_routput, | 221 | uint32_t saved_powerctrl_2 = 0, saved_powerctrl_4 = 0, saved_routput, |
223 | saved_rtest_ctrl, saved_gpio0, saved_gpio1, temp, routput; | 222 | saved_rtest_ctrl, saved_gpio0, saved_gpio1, temp, routput; |
224 | int head, present = 0; | 223 | int head; |
225 | 224 | ||
226 | #define RGB_TEST_DATA(r, g, b) (r << 0 | g << 10 | b << 20) | 225 | #define RGB_TEST_DATA(r, g, b) (r << 0 | g << 10 | b << 20) |
227 | if (dcb->type == OUTPUT_TV) { | 226 | if (dcb->type == OUTPUT_TV) { |
@@ -287,13 +286,7 @@ enum drm_connector_status nv17_dac_detect(struct drm_encoder *encoder, | |||
287 | temp | NV_PRAMDAC_TEST_CONTROL_TP_INS_EN_ASSERTED); | 286 | temp | NV_PRAMDAC_TEST_CONTROL_TP_INS_EN_ASSERTED); |
288 | msleep(5); | 287 | msleep(5); |
289 | 288 | ||
290 | temp = NVReadRAMDAC(dev, 0, NV_PRAMDAC_TEST_CONTROL + regoffset); | 289 | sample = NVReadRAMDAC(dev, 0, NV_PRAMDAC_TEST_CONTROL + regoffset); |
291 | |||
292 | if (dcb->type == OUTPUT_TV) | ||
293 | present = (nv17_tv_detect(encoder, connector, temp) | ||
294 | == connector_status_connected); | ||
295 | else | ||
296 | present = temp & NV_PRAMDAC_TEST_CONTROL_SENSEB_ALLHI; | ||
297 | 290 | ||
298 | temp = NVReadRAMDAC(dev, head, NV_PRAMDAC_TEST_CONTROL); | 291 | temp = NVReadRAMDAC(dev, head, NV_PRAMDAC_TEST_CONTROL); |
299 | NVWriteRAMDAC(dev, head, NV_PRAMDAC_TEST_CONTROL, | 292 | NVWriteRAMDAC(dev, head, NV_PRAMDAC_TEST_CONTROL, |
@@ -310,15 +303,25 @@ enum drm_connector_status nv17_dac_detect(struct drm_encoder *encoder, | |||
310 | nv17_gpio_set(dev, DCB_GPIO_TVDAC1, saved_gpio1); | 303 | nv17_gpio_set(dev, DCB_GPIO_TVDAC1, saved_gpio1); |
311 | nv17_gpio_set(dev, DCB_GPIO_TVDAC0, saved_gpio0); | 304 | nv17_gpio_set(dev, DCB_GPIO_TVDAC0, saved_gpio0); |
312 | 305 | ||
313 | if (present) { | 306 | return sample; |
314 | NV_INFO(dev, "Load detected on output %c\n", '@' + ffs(dcb->or)); | 307 | } |
308 | |||
309 | static enum drm_connector_status | ||
310 | nv17_dac_detect(struct drm_encoder *encoder, struct drm_connector *connector) | ||
311 | { | ||
312 | struct drm_device *dev = encoder->dev; | ||
313 | struct dcb_entry *dcb = nouveau_encoder(encoder)->dcb; | ||
314 | uint32_t sample = nv17_dac_sample_load(encoder); | ||
315 | |||
316 | if (sample & NV_PRAMDAC_TEST_CONTROL_SENSEB_ALLHI) { | ||
317 | NV_INFO(dev, "Load detected on output %c\n", | ||
318 | '@' + ffs(dcb->or)); | ||
315 | return connector_status_connected; | 319 | return connector_status_connected; |
320 | } else { | ||
321 | return connector_status_disconnected; | ||
316 | } | 322 | } |
317 | |||
318 | return connector_status_disconnected; | ||
319 | } | 323 | } |
320 | 324 | ||
321 | |||
322 | static bool nv04_dac_mode_fixup(struct drm_encoder *encoder, | 325 | static bool nv04_dac_mode_fixup(struct drm_encoder *encoder, |
323 | struct drm_display_mode *mode, | 326 | struct drm_display_mode *mode, |
324 | struct drm_display_mode *adjusted_mode) | 327 | struct drm_display_mode *adjusted_mode) |
@@ -350,14 +353,10 @@ static void nv04_dac_mode_set(struct drm_encoder *encoder, | |||
350 | struct drm_display_mode *mode, | 353 | struct drm_display_mode *mode, |
351 | struct drm_display_mode *adjusted_mode) | 354 | struct drm_display_mode *adjusted_mode) |
352 | { | 355 | { |
353 | struct nouveau_encoder *nv_encoder = nouveau_encoder(encoder); | ||
354 | struct drm_device *dev = encoder->dev; | 356 | struct drm_device *dev = encoder->dev; |
355 | struct drm_nouveau_private *dev_priv = dev->dev_private; | 357 | struct drm_nouveau_private *dev_priv = dev->dev_private; |
356 | int head = nouveau_crtc(encoder->crtc)->index; | 358 | int head = nouveau_crtc(encoder->crtc)->index; |
357 | 359 | ||
358 | NV_TRACE(dev, "%s called for encoder %d\n", __func__, | ||
359 | nv_encoder->dcb->index); | ||
360 | |||
361 | if (nv_gf4_disp_arch(dev)) { | 360 | if (nv_gf4_disp_arch(dev)) { |
362 | struct drm_encoder *rebind; | 361 | struct drm_encoder *rebind; |
363 | uint32_t dac_offset = nv04_dac_output_offset(encoder); | 362 | uint32_t dac_offset = nv04_dac_output_offset(encoder); |
@@ -466,7 +465,7 @@ static void nv04_dac_destroy(struct drm_encoder *encoder) | |||
466 | { | 465 | { |
467 | struct nouveau_encoder *nv_encoder = nouveau_encoder(encoder); | 466 | struct nouveau_encoder *nv_encoder = nouveau_encoder(encoder); |
468 | 467 | ||
469 | NV_DEBUG(encoder->dev, "\n"); | 468 | NV_DEBUG_KMS(encoder->dev, "\n"); |
470 | 469 | ||
471 | drm_encoder_cleanup(encoder); | 470 | drm_encoder_cleanup(encoder); |
472 | kfree(nv_encoder); | 471 | kfree(nv_encoder); |
diff --git a/drivers/gpu/drm/nouveau/nv04_dfp.c b/drivers/gpu/drm/nouveau/nv04_dfp.c index e5b33339d595..483f875bdb6a 100644 --- a/drivers/gpu/drm/nouveau/nv04_dfp.c +++ b/drivers/gpu/drm/nouveau/nv04_dfp.c | |||
@@ -261,7 +261,7 @@ static void nv04_dfp_mode_set(struct drm_encoder *encoder, | |||
261 | struct drm_display_mode *output_mode = &nv_encoder->mode; | 261 | struct drm_display_mode *output_mode = &nv_encoder->mode; |
262 | uint32_t mode_ratio, panel_ratio; | 262 | uint32_t mode_ratio, panel_ratio; |
263 | 263 | ||
264 | NV_DEBUG(dev, "Output mode on CRTC %d:\n", nv_crtc->index); | 264 | NV_DEBUG_KMS(dev, "Output mode on CRTC %d:\n", nv_crtc->index); |
265 | drm_mode_debug_printmodeline(output_mode); | 265 | drm_mode_debug_printmodeline(output_mode); |
266 | 266 | ||
267 | /* Initialize the FP registers in this CRTC. */ | 267 | /* Initialize the FP registers in this CRTC. */ |
@@ -413,7 +413,9 @@ static void nv04_dfp_commit(struct drm_encoder *encoder) | |||
413 | struct dcb_entry *dcbe = nv_encoder->dcb; | 413 | struct dcb_entry *dcbe = nv_encoder->dcb; |
414 | int head = nouveau_crtc(encoder->crtc)->index; | 414 | int head = nouveau_crtc(encoder->crtc)->index; |
415 | 415 | ||
416 | NV_TRACE(dev, "%s called for encoder %d\n", __func__, nv_encoder->dcb->index); | 416 | NV_INFO(dev, "Output %s is running on CRTC %d using output %c\n", |
417 | drm_get_connector_name(&nouveau_encoder_connector_get(nv_encoder)->base), | ||
418 | nv_crtc->index, '@' + ffs(nv_encoder->dcb->or)); | ||
417 | 419 | ||
418 | if (dcbe->type == OUTPUT_TMDS) | 420 | if (dcbe->type == OUTPUT_TMDS) |
419 | run_tmds_table(dev, dcbe, head, nv_encoder->mode.clock); | 421 | run_tmds_table(dev, dcbe, head, nv_encoder->mode.clock); |
@@ -550,7 +552,7 @@ static void nv04_dfp_destroy(struct drm_encoder *encoder) | |||
550 | { | 552 | { |
551 | struct nouveau_encoder *nv_encoder = nouveau_encoder(encoder); | 553 | struct nouveau_encoder *nv_encoder = nouveau_encoder(encoder); |
552 | 554 | ||
553 | NV_DEBUG(encoder->dev, "\n"); | 555 | NV_DEBUG_KMS(encoder->dev, "\n"); |
554 | 556 | ||
555 | drm_encoder_cleanup(encoder); | 557 | drm_encoder_cleanup(encoder); |
556 | kfree(nv_encoder); | 558 | kfree(nv_encoder); |
diff --git a/drivers/gpu/drm/nouveau/nv04_display.c b/drivers/gpu/drm/nouveau/nv04_display.c index b47c757ff48b..ef77215fa5b9 100644 --- a/drivers/gpu/drm/nouveau/nv04_display.c +++ b/drivers/gpu/drm/nouveau/nv04_display.c | |||
@@ -99,10 +99,11 @@ nv04_display_create(struct drm_device *dev) | |||
99 | uint16_t connector[16] = { 0 }; | 99 | uint16_t connector[16] = { 0 }; |
100 | int i, ret; | 100 | int i, ret; |
101 | 101 | ||
102 | NV_DEBUG(dev, "\n"); | 102 | NV_DEBUG_KMS(dev, "\n"); |
103 | 103 | ||
104 | if (nv_two_heads(dev)) | 104 | if (nv_two_heads(dev)) |
105 | nv04_display_store_initial_head_owner(dev); | 105 | nv04_display_store_initial_head_owner(dev); |
106 | nouveau_hw_save_vga_fonts(dev, 1); | ||
106 | 107 | ||
107 | drm_mode_config_init(dev); | 108 | drm_mode_config_init(dev); |
108 | drm_mode_create_scaling_mode_property(dev); | 109 | drm_mode_create_scaling_mode_property(dev); |
@@ -203,8 +204,6 @@ nv04_display_create(struct drm_device *dev) | |||
203 | /* Save previous state */ | 204 | /* Save previous state */ |
204 | NVLockVgaCrtcs(dev, false); | 205 | NVLockVgaCrtcs(dev, false); |
205 | 206 | ||
206 | nouveau_hw_save_vga_fonts(dev, 1); | ||
207 | |||
208 | list_for_each_entry(crtc, &dev->mode_config.crtc_list, head) | 207 | list_for_each_entry(crtc, &dev->mode_config.crtc_list, head) |
209 | crtc->funcs->save(crtc); | 208 | crtc->funcs->save(crtc); |
210 | 209 | ||
@@ -223,7 +222,7 @@ nv04_display_destroy(struct drm_device *dev) | |||
223 | struct drm_encoder *encoder; | 222 | struct drm_encoder *encoder; |
224 | struct drm_crtc *crtc; | 223 | struct drm_crtc *crtc; |
225 | 224 | ||
226 | NV_DEBUG(dev, "\n"); | 225 | NV_DEBUG_KMS(dev, "\n"); |
227 | 226 | ||
228 | /* Turn every CRTC off. */ | 227 | /* Turn every CRTC off. */ |
229 | list_for_each_entry(crtc, &dev->mode_config.crtc_list, head) { | 228 | list_for_each_entry(crtc, &dev->mode_config.crtc_list, head) { |
@@ -246,9 +245,9 @@ nv04_display_destroy(struct drm_device *dev) | |||
246 | list_for_each_entry(crtc, &dev->mode_config.crtc_list, head) | 245 | list_for_each_entry(crtc, &dev->mode_config.crtc_list, head) |
247 | crtc->funcs->restore(crtc); | 246 | crtc->funcs->restore(crtc); |
248 | 247 | ||
249 | nouveau_hw_save_vga_fonts(dev, 0); | ||
250 | |||
251 | drm_mode_config_cleanup(dev); | 248 | drm_mode_config_cleanup(dev); |
249 | |||
250 | nouveau_hw_save_vga_fonts(dev, 0); | ||
252 | } | 251 | } |
253 | 252 | ||
254 | void | 253 | void |
diff --git a/drivers/gpu/drm/nouveau/nv04_fbcon.c b/drivers/gpu/drm/nouveau/nv04_fbcon.c index 09a31071ee58..d910873c1368 100644 --- a/drivers/gpu/drm/nouveau/nv04_fbcon.c +++ b/drivers/gpu/drm/nouveau/nv04_fbcon.c | |||
@@ -39,8 +39,7 @@ nv04_fbcon_copyarea(struct fb_info *info, const struct fb_copyarea *region) | |||
39 | return; | 39 | return; |
40 | 40 | ||
41 | if (!(info->flags & FBINFO_HWACCEL_DISABLED) && RING_SPACE(chan, 4)) { | 41 | if (!(info->flags & FBINFO_HWACCEL_DISABLED) && RING_SPACE(chan, 4)) { |
42 | NV_ERROR(dev, "GPU lockup - switching to software fbcon\n"); | 42 | nouveau_fbcon_gpu_lockup(info); |
43 | info->flags |= FBINFO_HWACCEL_DISABLED; | ||
44 | } | 43 | } |
45 | 44 | ||
46 | if (info->flags & FBINFO_HWACCEL_DISABLED) { | 45 | if (info->flags & FBINFO_HWACCEL_DISABLED) { |
@@ -62,14 +61,12 @@ nv04_fbcon_fillrect(struct fb_info *info, const struct fb_fillrect *rect) | |||
62 | struct drm_device *dev = par->dev; | 61 | struct drm_device *dev = par->dev; |
63 | struct drm_nouveau_private *dev_priv = dev->dev_private; | 62 | struct drm_nouveau_private *dev_priv = dev->dev_private; |
64 | struct nouveau_channel *chan = dev_priv->channel; | 63 | struct nouveau_channel *chan = dev_priv->channel; |
65 | uint32_t color = ((uint32_t *) info->pseudo_palette)[rect->color]; | ||
66 | 64 | ||
67 | if (info->state != FBINFO_STATE_RUNNING) | 65 | if (info->state != FBINFO_STATE_RUNNING) |
68 | return; | 66 | return; |
69 | 67 | ||
70 | if (!(info->flags & FBINFO_HWACCEL_DISABLED) && RING_SPACE(chan, 7)) { | 68 | if (!(info->flags & FBINFO_HWACCEL_DISABLED) && RING_SPACE(chan, 7)) { |
71 | NV_ERROR(dev, "GPU lockup - switching to software fbcon\n"); | 69 | nouveau_fbcon_gpu_lockup(info); |
72 | info->flags |= FBINFO_HWACCEL_DISABLED; | ||
73 | } | 70 | } |
74 | 71 | ||
75 | if (info->flags & FBINFO_HWACCEL_DISABLED) { | 72 | if (info->flags & FBINFO_HWACCEL_DISABLED) { |
@@ -80,7 +77,11 @@ nv04_fbcon_fillrect(struct fb_info *info, const struct fb_fillrect *rect) | |||
80 | BEGIN_RING(chan, NvSubGdiRect, 0x02fc, 1); | 77 | BEGIN_RING(chan, NvSubGdiRect, 0x02fc, 1); |
81 | OUT_RING(chan, (rect->rop != ROP_COPY) ? 1 : 3); | 78 | OUT_RING(chan, (rect->rop != ROP_COPY) ? 1 : 3); |
82 | BEGIN_RING(chan, NvSubGdiRect, 0x03fc, 1); | 79 | BEGIN_RING(chan, NvSubGdiRect, 0x03fc, 1); |
83 | OUT_RING(chan, color); | 80 | if (info->fix.visual == FB_VISUAL_TRUECOLOR || |
81 | info->fix.visual == FB_VISUAL_DIRECTCOLOR) | ||
82 | OUT_RING(chan, ((uint32_t *)info->pseudo_palette)[rect->color]); | ||
83 | else | ||
84 | OUT_RING(chan, rect->color); | ||
84 | BEGIN_RING(chan, NvSubGdiRect, 0x0400, 2); | 85 | BEGIN_RING(chan, NvSubGdiRect, 0x0400, 2); |
85 | OUT_RING(chan, (rect->dx << 16) | rect->dy); | 86 | OUT_RING(chan, (rect->dx << 16) | rect->dy); |
86 | OUT_RING(chan, (rect->width << 16) | rect->height); | 87 | OUT_RING(chan, (rect->width << 16) | rect->height); |
@@ -109,8 +110,7 @@ nv04_fbcon_imageblit(struct fb_info *info, const struct fb_image *image) | |||
109 | } | 110 | } |
110 | 111 | ||
111 | if (!(info->flags & FBINFO_HWACCEL_DISABLED) && RING_SPACE(chan, 8)) { | 112 | if (!(info->flags & FBINFO_HWACCEL_DISABLED) && RING_SPACE(chan, 8)) { |
112 | NV_ERROR(dev, "GPU lockup - switching to software fbcon\n"); | 113 | nouveau_fbcon_gpu_lockup(info); |
113 | info->flags |= FBINFO_HWACCEL_DISABLED; | ||
114 | } | 114 | } |
115 | 115 | ||
116 | if (info->flags & FBINFO_HWACCEL_DISABLED) { | 116 | if (info->flags & FBINFO_HWACCEL_DISABLED) { |
@@ -144,8 +144,7 @@ nv04_fbcon_imageblit(struct fb_info *info, const struct fb_image *image) | |||
144 | int iter_len = dsize > 128 ? 128 : dsize; | 144 | int iter_len = dsize > 128 ? 128 : dsize; |
145 | 145 | ||
146 | if (RING_SPACE(chan, iter_len + 1)) { | 146 | if (RING_SPACE(chan, iter_len + 1)) { |
147 | NV_ERROR(dev, "GPU lockup - switching to software fbcon\n"); | 147 | nouveau_fbcon_gpu_lockup(info); |
148 | info->flags |= FBINFO_HWACCEL_DISABLED; | ||
149 | cfb_imageblit(info, image); | 148 | cfb_imageblit(info, image); |
150 | return; | 149 | return; |
151 | } | 150 | } |
@@ -184,6 +183,7 @@ nv04_fbcon_accel_init(struct fb_info *info) | |||
184 | struct drm_device *dev = par->dev; | 183 | struct drm_device *dev = par->dev; |
185 | struct drm_nouveau_private *dev_priv = dev->dev_private; | 184 | struct drm_nouveau_private *dev_priv = dev->dev_private; |
186 | struct nouveau_channel *chan = dev_priv->channel; | 185 | struct nouveau_channel *chan = dev_priv->channel; |
186 | const int sub = NvSubCtxSurf2D; | ||
187 | int surface_fmt, pattern_fmt, rect_fmt; | 187 | int surface_fmt, pattern_fmt, rect_fmt; |
188 | int ret; | 188 | int ret; |
189 | 189 | ||
@@ -242,30 +242,29 @@ nv04_fbcon_accel_init(struct fb_info *info) | |||
242 | return ret; | 242 | return ret; |
243 | 243 | ||
244 | if (RING_SPACE(chan, 49)) { | 244 | if (RING_SPACE(chan, 49)) { |
245 | NV_ERROR(dev, "GPU lockup - switching to software fbcon\n"); | 245 | nouveau_fbcon_gpu_lockup(info); |
246 | info->flags |= FBINFO_HWACCEL_DISABLED; | ||
247 | return 0; | 246 | return 0; |
248 | } | 247 | } |
249 | 248 | ||
250 | BEGIN_RING(chan, 1, 0x0000, 1); | 249 | BEGIN_RING(chan, sub, 0x0000, 1); |
251 | OUT_RING(chan, NvCtxSurf2D); | 250 | OUT_RING(chan, NvCtxSurf2D); |
252 | BEGIN_RING(chan, 1, 0x0184, 2); | 251 | BEGIN_RING(chan, sub, 0x0184, 2); |
253 | OUT_RING(chan, NvDmaFB); | 252 | OUT_RING(chan, NvDmaFB); |
254 | OUT_RING(chan, NvDmaFB); | 253 | OUT_RING(chan, NvDmaFB); |
255 | BEGIN_RING(chan, 1, 0x0300, 4); | 254 | BEGIN_RING(chan, sub, 0x0300, 4); |
256 | OUT_RING(chan, surface_fmt); | 255 | OUT_RING(chan, surface_fmt); |
257 | OUT_RING(chan, info->fix.line_length | (info->fix.line_length << 16)); | 256 | OUT_RING(chan, info->fix.line_length | (info->fix.line_length << 16)); |
258 | OUT_RING(chan, info->fix.smem_start - dev->mode_config.fb_base); | 257 | OUT_RING(chan, info->fix.smem_start - dev->mode_config.fb_base); |
259 | OUT_RING(chan, info->fix.smem_start - dev->mode_config.fb_base); | 258 | OUT_RING(chan, info->fix.smem_start - dev->mode_config.fb_base); |
260 | 259 | ||
261 | BEGIN_RING(chan, 1, 0x0000, 1); | 260 | BEGIN_RING(chan, sub, 0x0000, 1); |
262 | OUT_RING(chan, NvRop); | 261 | OUT_RING(chan, NvRop); |
263 | BEGIN_RING(chan, 1, 0x0300, 1); | 262 | BEGIN_RING(chan, sub, 0x0300, 1); |
264 | OUT_RING(chan, 0x55); | 263 | OUT_RING(chan, 0x55); |
265 | 264 | ||
266 | BEGIN_RING(chan, 1, 0x0000, 1); | 265 | BEGIN_RING(chan, sub, 0x0000, 1); |
267 | OUT_RING(chan, NvImagePatt); | 266 | OUT_RING(chan, NvImagePatt); |
268 | BEGIN_RING(chan, 1, 0x0300, 8); | 267 | BEGIN_RING(chan, sub, 0x0300, 8); |
269 | OUT_RING(chan, pattern_fmt); | 268 | OUT_RING(chan, pattern_fmt); |
270 | #ifdef __BIG_ENDIAN | 269 | #ifdef __BIG_ENDIAN |
271 | OUT_RING(chan, 2); | 270 | OUT_RING(chan, 2); |
@@ -279,9 +278,9 @@ nv04_fbcon_accel_init(struct fb_info *info) | |||
279 | OUT_RING(chan, ~0); | 278 | OUT_RING(chan, ~0); |
280 | OUT_RING(chan, ~0); | 279 | OUT_RING(chan, ~0); |
281 | 280 | ||
282 | BEGIN_RING(chan, 1, 0x0000, 1); | 281 | BEGIN_RING(chan, sub, 0x0000, 1); |
283 | OUT_RING(chan, NvClipRect); | 282 | OUT_RING(chan, NvClipRect); |
284 | BEGIN_RING(chan, 1, 0x0300, 2); | 283 | BEGIN_RING(chan, sub, 0x0300, 2); |
285 | OUT_RING(chan, 0); | 284 | OUT_RING(chan, 0); |
286 | OUT_RING(chan, (info->var.yres_virtual << 16) | info->var.xres_virtual); | 285 | OUT_RING(chan, (info->var.yres_virtual << 16) | info->var.xres_virtual); |
287 | 286 | ||
diff --git a/drivers/gpu/drm/nouveau/nv04_fifo.c b/drivers/gpu/drm/nouveau/nv04_fifo.c index 0c3cd53c7313..f31347b8c9b0 100644 --- a/drivers/gpu/drm/nouveau/nv04_fifo.c +++ b/drivers/gpu/drm/nouveau/nv04_fifo.c | |||
@@ -71,6 +71,40 @@ nv04_fifo_reassign(struct drm_device *dev, bool enable) | |||
71 | return (reassign == 1); | 71 | return (reassign == 1); |
72 | } | 72 | } |
73 | 73 | ||
74 | bool | ||
75 | nv04_fifo_cache_flush(struct drm_device *dev) | ||
76 | { | ||
77 | struct drm_nouveau_private *dev_priv = dev->dev_private; | ||
78 | struct nouveau_timer_engine *ptimer = &dev_priv->engine.timer; | ||
79 | uint64_t start = ptimer->read(dev); | ||
80 | |||
81 | do { | ||
82 | if (nv_rd32(dev, NV03_PFIFO_CACHE1_GET) == | ||
83 | nv_rd32(dev, NV03_PFIFO_CACHE1_PUT)) | ||
84 | return true; | ||
85 | |||
86 | } while (ptimer->read(dev) - start < 100000000); | ||
87 | |||
88 | NV_ERROR(dev, "Timeout flushing the PFIFO cache.\n"); | ||
89 | |||
90 | return false; | ||
91 | } | ||
92 | |||
93 | bool | ||
94 | nv04_fifo_cache_pull(struct drm_device *dev, bool enable) | ||
95 | { | ||
96 | uint32_t pull = nv_rd32(dev, NV04_PFIFO_CACHE1_PULL0); | ||
97 | |||
98 | if (enable) { | ||
99 | nv_wr32(dev, NV04_PFIFO_CACHE1_PULL0, pull | 1); | ||
100 | } else { | ||
101 | nv_wr32(dev, NV04_PFIFO_CACHE1_PULL0, pull & ~1); | ||
102 | nv_wr32(dev, NV04_PFIFO_CACHE1_HASH, 0); | ||
103 | } | ||
104 | |||
105 | return !!(pull & 1); | ||
106 | } | ||
107 | |||
74 | int | 108 | int |
75 | nv04_fifo_channel_id(struct drm_device *dev) | 109 | nv04_fifo_channel_id(struct drm_device *dev) |
76 | { | 110 | { |
diff --git a/drivers/gpu/drm/nouveau/nv04_graph.c b/drivers/gpu/drm/nouveau/nv04_graph.c index 396ee92118f6..e260986ea65a 100644 --- a/drivers/gpu/drm/nouveau/nv04_graph.c +++ b/drivers/gpu/drm/nouveau/nv04_graph.c | |||
@@ -28,6 +28,10 @@ | |||
28 | #include "nouveau_drv.h" | 28 | #include "nouveau_drv.h" |
29 | 29 | ||
30 | static uint32_t nv04_graph_ctx_regs[] = { | 30 | static uint32_t nv04_graph_ctx_regs[] = { |
31 | 0x0040053c, | ||
32 | 0x00400544, | ||
33 | 0x00400540, | ||
34 | 0x00400548, | ||
31 | NV04_PGRAPH_CTX_SWITCH1, | 35 | NV04_PGRAPH_CTX_SWITCH1, |
32 | NV04_PGRAPH_CTX_SWITCH2, | 36 | NV04_PGRAPH_CTX_SWITCH2, |
33 | NV04_PGRAPH_CTX_SWITCH3, | 37 | NV04_PGRAPH_CTX_SWITCH3, |
@@ -102,69 +106,69 @@ static uint32_t nv04_graph_ctx_regs[] = { | |||
102 | NV04_PGRAPH_PATT_COLOR0, | 106 | NV04_PGRAPH_PATT_COLOR0, |
103 | NV04_PGRAPH_PATT_COLOR1, | 107 | NV04_PGRAPH_PATT_COLOR1, |
104 | NV04_PGRAPH_PATT_COLORRAM+0x00, | 108 | NV04_PGRAPH_PATT_COLORRAM+0x00, |
105 | NV04_PGRAPH_PATT_COLORRAM+0x01, | ||
106 | NV04_PGRAPH_PATT_COLORRAM+0x02, | ||
107 | NV04_PGRAPH_PATT_COLORRAM+0x03, | ||
108 | NV04_PGRAPH_PATT_COLORRAM+0x04, | 109 | NV04_PGRAPH_PATT_COLORRAM+0x04, |
109 | NV04_PGRAPH_PATT_COLORRAM+0x05, | ||
110 | NV04_PGRAPH_PATT_COLORRAM+0x06, | ||
111 | NV04_PGRAPH_PATT_COLORRAM+0x07, | ||
112 | NV04_PGRAPH_PATT_COLORRAM+0x08, | 110 | NV04_PGRAPH_PATT_COLORRAM+0x08, |
113 | NV04_PGRAPH_PATT_COLORRAM+0x09, | 111 | NV04_PGRAPH_PATT_COLORRAM+0x0c, |
114 | NV04_PGRAPH_PATT_COLORRAM+0x0A, | ||
115 | NV04_PGRAPH_PATT_COLORRAM+0x0B, | ||
116 | NV04_PGRAPH_PATT_COLORRAM+0x0C, | ||
117 | NV04_PGRAPH_PATT_COLORRAM+0x0D, | ||
118 | NV04_PGRAPH_PATT_COLORRAM+0x0E, | ||
119 | NV04_PGRAPH_PATT_COLORRAM+0x0F, | ||
120 | NV04_PGRAPH_PATT_COLORRAM+0x10, | 112 | NV04_PGRAPH_PATT_COLORRAM+0x10, |
121 | NV04_PGRAPH_PATT_COLORRAM+0x11, | ||
122 | NV04_PGRAPH_PATT_COLORRAM+0x12, | ||
123 | NV04_PGRAPH_PATT_COLORRAM+0x13, | ||
124 | NV04_PGRAPH_PATT_COLORRAM+0x14, | 113 | NV04_PGRAPH_PATT_COLORRAM+0x14, |
125 | NV04_PGRAPH_PATT_COLORRAM+0x15, | ||
126 | NV04_PGRAPH_PATT_COLORRAM+0x16, | ||
127 | NV04_PGRAPH_PATT_COLORRAM+0x17, | ||
128 | NV04_PGRAPH_PATT_COLORRAM+0x18, | 114 | NV04_PGRAPH_PATT_COLORRAM+0x18, |
129 | NV04_PGRAPH_PATT_COLORRAM+0x19, | 115 | NV04_PGRAPH_PATT_COLORRAM+0x1c, |
130 | NV04_PGRAPH_PATT_COLORRAM+0x1A, | ||
131 | NV04_PGRAPH_PATT_COLORRAM+0x1B, | ||
132 | NV04_PGRAPH_PATT_COLORRAM+0x1C, | ||
133 | NV04_PGRAPH_PATT_COLORRAM+0x1D, | ||
134 | NV04_PGRAPH_PATT_COLORRAM+0x1E, | ||
135 | NV04_PGRAPH_PATT_COLORRAM+0x1F, | ||
136 | NV04_PGRAPH_PATT_COLORRAM+0x20, | 116 | NV04_PGRAPH_PATT_COLORRAM+0x20, |
137 | NV04_PGRAPH_PATT_COLORRAM+0x21, | ||
138 | NV04_PGRAPH_PATT_COLORRAM+0x22, | ||
139 | NV04_PGRAPH_PATT_COLORRAM+0x23, | ||
140 | NV04_PGRAPH_PATT_COLORRAM+0x24, | 117 | NV04_PGRAPH_PATT_COLORRAM+0x24, |
141 | NV04_PGRAPH_PATT_COLORRAM+0x25, | ||
142 | NV04_PGRAPH_PATT_COLORRAM+0x26, | ||
143 | NV04_PGRAPH_PATT_COLORRAM+0x27, | ||
144 | NV04_PGRAPH_PATT_COLORRAM+0x28, | 118 | NV04_PGRAPH_PATT_COLORRAM+0x28, |
145 | NV04_PGRAPH_PATT_COLORRAM+0x29, | 119 | NV04_PGRAPH_PATT_COLORRAM+0x2c, |
146 | NV04_PGRAPH_PATT_COLORRAM+0x2A, | ||
147 | NV04_PGRAPH_PATT_COLORRAM+0x2B, | ||
148 | NV04_PGRAPH_PATT_COLORRAM+0x2C, | ||
149 | NV04_PGRAPH_PATT_COLORRAM+0x2D, | ||
150 | NV04_PGRAPH_PATT_COLORRAM+0x2E, | ||
151 | NV04_PGRAPH_PATT_COLORRAM+0x2F, | ||
152 | NV04_PGRAPH_PATT_COLORRAM+0x30, | 120 | NV04_PGRAPH_PATT_COLORRAM+0x30, |
153 | NV04_PGRAPH_PATT_COLORRAM+0x31, | ||
154 | NV04_PGRAPH_PATT_COLORRAM+0x32, | ||
155 | NV04_PGRAPH_PATT_COLORRAM+0x33, | ||
156 | NV04_PGRAPH_PATT_COLORRAM+0x34, | 121 | NV04_PGRAPH_PATT_COLORRAM+0x34, |
157 | NV04_PGRAPH_PATT_COLORRAM+0x35, | ||
158 | NV04_PGRAPH_PATT_COLORRAM+0x36, | ||
159 | NV04_PGRAPH_PATT_COLORRAM+0x37, | ||
160 | NV04_PGRAPH_PATT_COLORRAM+0x38, | 122 | NV04_PGRAPH_PATT_COLORRAM+0x38, |
161 | NV04_PGRAPH_PATT_COLORRAM+0x39, | 123 | NV04_PGRAPH_PATT_COLORRAM+0x3c, |
162 | NV04_PGRAPH_PATT_COLORRAM+0x3A, | 124 | NV04_PGRAPH_PATT_COLORRAM+0x40, |
163 | NV04_PGRAPH_PATT_COLORRAM+0x3B, | 125 | NV04_PGRAPH_PATT_COLORRAM+0x44, |
164 | NV04_PGRAPH_PATT_COLORRAM+0x3C, | 126 | NV04_PGRAPH_PATT_COLORRAM+0x48, |
165 | NV04_PGRAPH_PATT_COLORRAM+0x3D, | 127 | NV04_PGRAPH_PATT_COLORRAM+0x4c, |
166 | NV04_PGRAPH_PATT_COLORRAM+0x3E, | 128 | NV04_PGRAPH_PATT_COLORRAM+0x50, |
167 | NV04_PGRAPH_PATT_COLORRAM+0x3F, | 129 | NV04_PGRAPH_PATT_COLORRAM+0x54, |
130 | NV04_PGRAPH_PATT_COLORRAM+0x58, | ||
131 | NV04_PGRAPH_PATT_COLORRAM+0x5c, | ||
132 | NV04_PGRAPH_PATT_COLORRAM+0x60, | ||
133 | NV04_PGRAPH_PATT_COLORRAM+0x64, | ||
134 | NV04_PGRAPH_PATT_COLORRAM+0x68, | ||
135 | NV04_PGRAPH_PATT_COLORRAM+0x6c, | ||
136 | NV04_PGRAPH_PATT_COLORRAM+0x70, | ||
137 | NV04_PGRAPH_PATT_COLORRAM+0x74, | ||
138 | NV04_PGRAPH_PATT_COLORRAM+0x78, | ||
139 | NV04_PGRAPH_PATT_COLORRAM+0x7c, | ||
140 | NV04_PGRAPH_PATT_COLORRAM+0x80, | ||
141 | NV04_PGRAPH_PATT_COLORRAM+0x84, | ||
142 | NV04_PGRAPH_PATT_COLORRAM+0x88, | ||
143 | NV04_PGRAPH_PATT_COLORRAM+0x8c, | ||
144 | NV04_PGRAPH_PATT_COLORRAM+0x90, | ||
145 | NV04_PGRAPH_PATT_COLORRAM+0x94, | ||
146 | NV04_PGRAPH_PATT_COLORRAM+0x98, | ||
147 | NV04_PGRAPH_PATT_COLORRAM+0x9c, | ||
148 | NV04_PGRAPH_PATT_COLORRAM+0xa0, | ||
149 | NV04_PGRAPH_PATT_COLORRAM+0xa4, | ||
150 | NV04_PGRAPH_PATT_COLORRAM+0xa8, | ||
151 | NV04_PGRAPH_PATT_COLORRAM+0xac, | ||
152 | NV04_PGRAPH_PATT_COLORRAM+0xb0, | ||
153 | NV04_PGRAPH_PATT_COLORRAM+0xb4, | ||
154 | NV04_PGRAPH_PATT_COLORRAM+0xb8, | ||
155 | NV04_PGRAPH_PATT_COLORRAM+0xbc, | ||
156 | NV04_PGRAPH_PATT_COLORRAM+0xc0, | ||
157 | NV04_PGRAPH_PATT_COLORRAM+0xc4, | ||
158 | NV04_PGRAPH_PATT_COLORRAM+0xc8, | ||
159 | NV04_PGRAPH_PATT_COLORRAM+0xcc, | ||
160 | NV04_PGRAPH_PATT_COLORRAM+0xd0, | ||
161 | NV04_PGRAPH_PATT_COLORRAM+0xd4, | ||
162 | NV04_PGRAPH_PATT_COLORRAM+0xd8, | ||
163 | NV04_PGRAPH_PATT_COLORRAM+0xdc, | ||
164 | NV04_PGRAPH_PATT_COLORRAM+0xe0, | ||
165 | NV04_PGRAPH_PATT_COLORRAM+0xe4, | ||
166 | NV04_PGRAPH_PATT_COLORRAM+0xe8, | ||
167 | NV04_PGRAPH_PATT_COLORRAM+0xec, | ||
168 | NV04_PGRAPH_PATT_COLORRAM+0xf0, | ||
169 | NV04_PGRAPH_PATT_COLORRAM+0xf4, | ||
170 | NV04_PGRAPH_PATT_COLORRAM+0xf8, | ||
171 | NV04_PGRAPH_PATT_COLORRAM+0xfc, | ||
168 | NV04_PGRAPH_PATTERN, | 172 | NV04_PGRAPH_PATTERN, |
169 | 0x0040080c, | 173 | 0x0040080c, |
170 | NV04_PGRAPH_PATTERN_SHAPE, | 174 | NV04_PGRAPH_PATTERN_SHAPE, |
@@ -247,14 +251,6 @@ static uint32_t nv04_graph_ctx_regs[] = { | |||
247 | 0x004004f8, | 251 | 0x004004f8, |
248 | 0x0040047c, | 252 | 0x0040047c, |
249 | 0x004004fc, | 253 | 0x004004fc, |
250 | 0x0040053c, | ||
251 | 0x00400544, | ||
252 | 0x00400540, | ||
253 | 0x00400548, | ||
254 | 0x00400560, | ||
255 | 0x00400568, | ||
256 | 0x00400564, | ||
257 | 0x0040056c, | ||
258 | 0x00400534, | 254 | 0x00400534, |
259 | 0x00400538, | 255 | 0x00400538, |
260 | 0x00400514, | 256 | 0x00400514, |
@@ -341,9 +337,8 @@ static uint32_t nv04_graph_ctx_regs[] = { | |||
341 | 0x00400500, | 337 | 0x00400500, |
342 | 0x00400504, | 338 | 0x00400504, |
343 | NV04_PGRAPH_VALID1, | 339 | NV04_PGRAPH_VALID1, |
344 | NV04_PGRAPH_VALID2 | 340 | NV04_PGRAPH_VALID2, |
345 | 341 | NV04_PGRAPH_DEBUG_3 | |
346 | |||
347 | }; | 342 | }; |
348 | 343 | ||
349 | struct graph_state { | 344 | struct graph_state { |
@@ -388,6 +383,18 @@ nv04_graph_context_switch(struct drm_device *dev) | |||
388 | pgraph->fifo_access(dev, true); | 383 | pgraph->fifo_access(dev, true); |
389 | } | 384 | } |
390 | 385 | ||
386 | static uint32_t *ctx_reg(struct graph_state *ctx, uint32_t reg) | ||
387 | { | ||
388 | int i; | ||
389 | |||
390 | for (i = 0; i < ARRAY_SIZE(nv04_graph_ctx_regs); i++) { | ||
391 | if (nv04_graph_ctx_regs[i] == reg) | ||
392 | return &ctx->nv04[i]; | ||
393 | } | ||
394 | |||
395 | return NULL; | ||
396 | } | ||
397 | |||
391 | int nv04_graph_create_context(struct nouveau_channel *chan) | 398 | int nv04_graph_create_context(struct nouveau_channel *chan) |
392 | { | 399 | { |
393 | struct graph_state *pgraph_ctx; | 400 | struct graph_state *pgraph_ctx; |
@@ -398,15 +405,8 @@ int nv04_graph_create_context(struct nouveau_channel *chan) | |||
398 | if (pgraph_ctx == NULL) | 405 | if (pgraph_ctx == NULL) |
399 | return -ENOMEM; | 406 | return -ENOMEM; |
400 | 407 | ||
401 | /* dev_priv->fifos[channel].pgraph_ctx_user = channel << 24; */ | 408 | *ctx_reg(pgraph_ctx, NV04_PGRAPH_DEBUG_3) = 0xfad4ff31; |
402 | pgraph_ctx->nv04[0] = 0x0001ffff; | 409 | |
403 | /* is it really needed ??? */ | ||
404 | #if 0 | ||
405 | dev_priv->fifos[channel].pgraph_ctx[1] = | ||
406 | nv_rd32(dev, NV_PGRAPH_DEBUG_4); | ||
407 | dev_priv->fifos[channel].pgraph_ctx[2] = | ||
408 | nv_rd32(dev, 0x004006b0); | ||
409 | #endif | ||
410 | return 0; | 410 | return 0; |
411 | } | 411 | } |
412 | 412 | ||
@@ -429,9 +429,13 @@ int nv04_graph_load_context(struct nouveau_channel *chan) | |||
429 | nv_wr32(dev, nv04_graph_ctx_regs[i], pgraph_ctx->nv04[i]); | 429 | nv_wr32(dev, nv04_graph_ctx_regs[i], pgraph_ctx->nv04[i]); |
430 | 430 | ||
431 | nv_wr32(dev, NV04_PGRAPH_CTX_CONTROL, 0x10010100); | 431 | nv_wr32(dev, NV04_PGRAPH_CTX_CONTROL, 0x10010100); |
432 | nv_wr32(dev, NV04_PGRAPH_CTX_USER, chan->id << 24); | 432 | |
433 | tmp = nv_rd32(dev, NV04_PGRAPH_CTX_USER) & 0x00ffffff; | ||
434 | nv_wr32(dev, NV04_PGRAPH_CTX_USER, tmp | chan->id << 24); | ||
435 | |||
433 | tmp = nv_rd32(dev, NV04_PGRAPH_FFINTFC_ST2); | 436 | tmp = nv_rd32(dev, NV04_PGRAPH_FFINTFC_ST2); |
434 | nv_wr32(dev, NV04_PGRAPH_FFINTFC_ST2, tmp & 0x000fffff); | 437 | nv_wr32(dev, NV04_PGRAPH_FFINTFC_ST2, tmp & 0x000fffff); |
438 | |||
435 | return 0; | 439 | return 0; |
436 | } | 440 | } |
437 | 441 | ||
@@ -494,7 +498,7 @@ int nv04_graph_init(struct drm_device *dev) | |||
494 | nv_wr32(dev, NV04_PGRAPH_STATE , 0xFFFFFFFF); | 498 | nv_wr32(dev, NV04_PGRAPH_STATE , 0xFFFFFFFF); |
495 | nv_wr32(dev, NV04_PGRAPH_CTX_CONTROL , 0x10000100); | 499 | nv_wr32(dev, NV04_PGRAPH_CTX_CONTROL , 0x10000100); |
496 | tmp = nv_rd32(dev, NV04_PGRAPH_CTX_USER) & 0x00ffffff; | 500 | tmp = nv_rd32(dev, NV04_PGRAPH_CTX_USER) & 0x00ffffff; |
497 | tmp |= dev_priv->engine.fifo.channels << 24; | 501 | tmp |= (dev_priv->engine.fifo.channels - 1) << 24; |
498 | nv_wr32(dev, NV04_PGRAPH_CTX_USER, tmp); | 502 | nv_wr32(dev, NV04_PGRAPH_CTX_USER, tmp); |
499 | 503 | ||
500 | /* These don't belong here, they're part of a per-channel context */ | 504 | /* These don't belong here, they're part of a per-channel context */ |
@@ -533,7 +537,7 @@ nv04_graph_mthd_set_operation(struct nouveau_channel *chan, int grclass, | |||
533 | int mthd, uint32_t data) | 537 | int mthd, uint32_t data) |
534 | { | 538 | { |
535 | struct drm_device *dev = chan->dev; | 539 | struct drm_device *dev = chan->dev; |
536 | uint32_t instance = nv_rd32(dev, NV04_PGRAPH_CTX_SWITCH4) & 0xffff; | 540 | uint32_t instance = (nv_rd32(dev, NV04_PGRAPH_CTX_SWITCH4) & 0xffff) << 4; |
537 | int subc = (nv_rd32(dev, NV04_PGRAPH_TRAPPED_ADDR) >> 13) & 0x7; | 541 | int subc = (nv_rd32(dev, NV04_PGRAPH_TRAPPED_ADDR) >> 13) & 0x7; |
538 | uint32_t tmp; | 542 | uint32_t tmp; |
539 | 543 | ||
@@ -543,11 +547,11 @@ nv04_graph_mthd_set_operation(struct nouveau_channel *chan, int grclass, | |||
543 | 547 | ||
544 | nv_wi32(dev, instance, tmp); | 548 | nv_wi32(dev, instance, tmp); |
545 | nv_wr32(dev, NV04_PGRAPH_CTX_SWITCH1, tmp); | 549 | nv_wr32(dev, NV04_PGRAPH_CTX_SWITCH1, tmp); |
546 | nv_wr32(dev, NV04_PGRAPH_CTX_CACHE1 + subc, tmp); | 550 | nv_wr32(dev, NV04_PGRAPH_CTX_CACHE1 + (subc<<2), tmp); |
547 | return 0; | 551 | return 0; |
548 | } | 552 | } |
549 | 553 | ||
550 | static struct nouveau_pgraph_object_method nv04_graph_mthds_m2mf[] = { | 554 | static struct nouveau_pgraph_object_method nv04_graph_mthds_sw[] = { |
551 | { 0x0150, nv04_graph_mthd_set_ref }, | 555 | { 0x0150, nv04_graph_mthd_set_ref }, |
552 | {} | 556 | {} |
553 | }; | 557 | }; |
@@ -558,7 +562,7 @@ static struct nouveau_pgraph_object_method nv04_graph_mthds_set_operation[] = { | |||
558 | }; | 562 | }; |
559 | 563 | ||
560 | struct nouveau_pgraph_object_class nv04_graph_grclass[] = { | 564 | struct nouveau_pgraph_object_class nv04_graph_grclass[] = { |
561 | { 0x0039, false, nv04_graph_mthds_m2mf }, | 565 | { 0x0039, false, NULL }, |
562 | { 0x004a, false, nv04_graph_mthds_set_operation }, /* gdirect */ | 566 | { 0x004a, false, nv04_graph_mthds_set_operation }, /* gdirect */ |
563 | { 0x005f, false, nv04_graph_mthds_set_operation }, /* imageblit */ | 567 | { 0x005f, false, nv04_graph_mthds_set_operation }, /* imageblit */ |
564 | { 0x0061, false, nv04_graph_mthds_set_operation }, /* ifc */ | 568 | { 0x0061, false, nv04_graph_mthds_set_operation }, /* ifc */ |
@@ -574,6 +578,7 @@ struct nouveau_pgraph_object_class nv04_graph_grclass[] = { | |||
574 | { 0x0053, false, NULL }, /* surf3d */ | 578 | { 0x0053, false, NULL }, /* surf3d */ |
575 | { 0x0054, false, NULL }, /* tex_tri */ | 579 | { 0x0054, false, NULL }, /* tex_tri */ |
576 | { 0x0055, false, NULL }, /* multitex_tri */ | 580 | { 0x0055, false, NULL }, /* multitex_tri */ |
581 | { 0x506e, true, nv04_graph_mthds_sw }, | ||
577 | {} | 582 | {} |
578 | }; | 583 | }; |
579 | 584 | ||
diff --git a/drivers/gpu/drm/nouveau/nv10_fb.c b/drivers/gpu/drm/nouveau/nv10_fb.c index 79e2d104d70a..cc5cda44e501 100644 --- a/drivers/gpu/drm/nouveau/nv10_fb.c +++ b/drivers/gpu/drm/nouveau/nv10_fb.c | |||
@@ -3,17 +3,37 @@ | |||
3 | #include "nouveau_drv.h" | 3 | #include "nouveau_drv.h" |
4 | #include "nouveau_drm.h" | 4 | #include "nouveau_drm.h" |
5 | 5 | ||
6 | void | ||
7 | nv10_fb_set_region_tiling(struct drm_device *dev, int i, uint32_t addr, | ||
8 | uint32_t size, uint32_t pitch) | ||
9 | { | ||
10 | struct drm_nouveau_private *dev_priv = dev->dev_private; | ||
11 | uint32_t limit = max(1u, addr + size) - 1; | ||
12 | |||
13 | if (pitch) { | ||
14 | if (dev_priv->card_type >= NV_20) | ||
15 | addr |= 1; | ||
16 | else | ||
17 | addr |= 1 << 31; | ||
18 | } | ||
19 | |||
20 | nv_wr32(dev, NV10_PFB_TLIMIT(i), limit); | ||
21 | nv_wr32(dev, NV10_PFB_TSIZE(i), pitch); | ||
22 | nv_wr32(dev, NV10_PFB_TILE(i), addr); | ||
23 | } | ||
24 | |||
6 | int | 25 | int |
7 | nv10_fb_init(struct drm_device *dev) | 26 | nv10_fb_init(struct drm_device *dev) |
8 | { | 27 | { |
9 | uint32_t fb_bar_size; | 28 | struct drm_nouveau_private *dev_priv = dev->dev_private; |
29 | struct nouveau_fb_engine *pfb = &dev_priv->engine.fb; | ||
10 | int i; | 30 | int i; |
11 | 31 | ||
12 | fb_bar_size = drm_get_resource_len(dev, 0) - 1; | 32 | pfb->num_tiles = NV10_PFB_TILE__SIZE; |
13 | for (i = 0; i < NV10_PFB_TILE__SIZE; i++) { | 33 | |
14 | nv_wr32(dev, NV10_PFB_TILE(i), 0); | 34 | /* Turn all the tiling regions off. */ |
15 | nv_wr32(dev, NV10_PFB_TLIMIT(i), fb_bar_size); | 35 | for (i = 0; i < pfb->num_tiles; i++) |
16 | } | 36 | pfb->set_region_tiling(dev, i, 0, 0, 0); |
17 | 37 | ||
18 | return 0; | 38 | return 0; |
19 | } | 39 | } |
diff --git a/drivers/gpu/drm/nouveau/nv10_graph.c b/drivers/gpu/drm/nouveau/nv10_graph.c index 6bf6804bb0ef..fcf2cdd19493 100644 --- a/drivers/gpu/drm/nouveau/nv10_graph.c +++ b/drivers/gpu/drm/nouveau/nv10_graph.c | |||
@@ -389,49 +389,50 @@ struct graph_state { | |||
389 | int nv10[ARRAY_SIZE(nv10_graph_ctx_regs)]; | 389 | int nv10[ARRAY_SIZE(nv10_graph_ctx_regs)]; |
390 | int nv17[ARRAY_SIZE(nv17_graph_ctx_regs)]; | 390 | int nv17[ARRAY_SIZE(nv17_graph_ctx_regs)]; |
391 | struct pipe_state pipe_state; | 391 | struct pipe_state pipe_state; |
392 | uint32_t lma_window[4]; | ||
392 | }; | 393 | }; |
393 | 394 | ||
395 | #define PIPE_SAVE(dev, state, addr) \ | ||
396 | do { \ | ||
397 | int __i; \ | ||
398 | nv_wr32(dev, NV10_PGRAPH_PIPE_ADDRESS, addr); \ | ||
399 | for (__i = 0; __i < ARRAY_SIZE(state); __i++) \ | ||
400 | state[__i] = nv_rd32(dev, NV10_PGRAPH_PIPE_DATA); \ | ||
401 | } while (0) | ||
402 | |||
403 | #define PIPE_RESTORE(dev, state, addr) \ | ||
404 | do { \ | ||
405 | int __i; \ | ||
406 | nv_wr32(dev, NV10_PGRAPH_PIPE_ADDRESS, addr); \ | ||
407 | for (__i = 0; __i < ARRAY_SIZE(state); __i++) \ | ||
408 | nv_wr32(dev, NV10_PGRAPH_PIPE_DATA, state[__i]); \ | ||
409 | } while (0) | ||
410 | |||
394 | static void nv10_graph_save_pipe(struct nouveau_channel *chan) | 411 | static void nv10_graph_save_pipe(struct nouveau_channel *chan) |
395 | { | 412 | { |
396 | struct drm_device *dev = chan->dev; | 413 | struct drm_device *dev = chan->dev; |
397 | struct graph_state *pgraph_ctx = chan->pgraph_ctx; | 414 | struct graph_state *pgraph_ctx = chan->pgraph_ctx; |
398 | struct pipe_state *fifo_pipe_state = &pgraph_ctx->pipe_state; | 415 | struct pipe_state *pipe = &pgraph_ctx->pipe_state; |
399 | int i; | 416 | |
400 | #define PIPE_SAVE(addr) \ | 417 | PIPE_SAVE(dev, pipe->pipe_0x4400, 0x4400); |
401 | do { \ | 418 | PIPE_SAVE(dev, pipe->pipe_0x0200, 0x0200); |
402 | nv_wr32(dev, NV10_PGRAPH_PIPE_ADDRESS, addr); \ | 419 | PIPE_SAVE(dev, pipe->pipe_0x6400, 0x6400); |
403 | for (i = 0; i < ARRAY_SIZE(fifo_pipe_state->pipe_##addr); i++) \ | 420 | PIPE_SAVE(dev, pipe->pipe_0x6800, 0x6800); |
404 | fifo_pipe_state->pipe_##addr[i] = nv_rd32(dev, NV10_PGRAPH_PIPE_DATA); \ | 421 | PIPE_SAVE(dev, pipe->pipe_0x6c00, 0x6c00); |
405 | } while (0) | 422 | PIPE_SAVE(dev, pipe->pipe_0x7000, 0x7000); |
406 | 423 | PIPE_SAVE(dev, pipe->pipe_0x7400, 0x7400); | |
407 | PIPE_SAVE(0x4400); | 424 | PIPE_SAVE(dev, pipe->pipe_0x7800, 0x7800); |
408 | PIPE_SAVE(0x0200); | 425 | PIPE_SAVE(dev, pipe->pipe_0x0040, 0x0040); |
409 | PIPE_SAVE(0x6400); | 426 | PIPE_SAVE(dev, pipe->pipe_0x0000, 0x0000); |
410 | PIPE_SAVE(0x6800); | ||
411 | PIPE_SAVE(0x6c00); | ||
412 | PIPE_SAVE(0x7000); | ||
413 | PIPE_SAVE(0x7400); | ||
414 | PIPE_SAVE(0x7800); | ||
415 | PIPE_SAVE(0x0040); | ||
416 | PIPE_SAVE(0x0000); | ||
417 | |||
418 | #undef PIPE_SAVE | ||
419 | } | 427 | } |
420 | 428 | ||
421 | static void nv10_graph_load_pipe(struct nouveau_channel *chan) | 429 | static void nv10_graph_load_pipe(struct nouveau_channel *chan) |
422 | { | 430 | { |
423 | struct drm_device *dev = chan->dev; | 431 | struct drm_device *dev = chan->dev; |
424 | struct graph_state *pgraph_ctx = chan->pgraph_ctx; | 432 | struct graph_state *pgraph_ctx = chan->pgraph_ctx; |
425 | struct pipe_state *fifo_pipe_state = &pgraph_ctx->pipe_state; | 433 | struct pipe_state *pipe = &pgraph_ctx->pipe_state; |
426 | int i; | ||
427 | uint32_t xfmode0, xfmode1; | 434 | uint32_t xfmode0, xfmode1; |
428 | #define PIPE_RESTORE(addr) \ | 435 | int i; |
429 | do { \ | ||
430 | nv_wr32(dev, NV10_PGRAPH_PIPE_ADDRESS, addr); \ | ||
431 | for (i = 0; i < ARRAY_SIZE(fifo_pipe_state->pipe_##addr); i++) \ | ||
432 | nv_wr32(dev, NV10_PGRAPH_PIPE_DATA, fifo_pipe_state->pipe_##addr[i]); \ | ||
433 | } while (0) | ||
434 | |||
435 | 436 | ||
436 | nouveau_wait_for_idle(dev); | 437 | nouveau_wait_for_idle(dev); |
437 | /* XXX check haiku comments */ | 438 | /* XXX check haiku comments */ |
@@ -457,24 +458,22 @@ static void nv10_graph_load_pipe(struct nouveau_channel *chan) | |||
457 | nv_wr32(dev, NV10_PGRAPH_PIPE_DATA, 0x00000008); | 458 | nv_wr32(dev, NV10_PGRAPH_PIPE_DATA, 0x00000008); |
458 | 459 | ||
459 | 460 | ||
460 | PIPE_RESTORE(0x0200); | 461 | PIPE_RESTORE(dev, pipe->pipe_0x0200, 0x0200); |
461 | nouveau_wait_for_idle(dev); | 462 | nouveau_wait_for_idle(dev); |
462 | 463 | ||
463 | /* restore XFMODE */ | 464 | /* restore XFMODE */ |
464 | nv_wr32(dev, NV10_PGRAPH_XFMODE0, xfmode0); | 465 | nv_wr32(dev, NV10_PGRAPH_XFMODE0, xfmode0); |
465 | nv_wr32(dev, NV10_PGRAPH_XFMODE1, xfmode1); | 466 | nv_wr32(dev, NV10_PGRAPH_XFMODE1, xfmode1); |
466 | PIPE_RESTORE(0x6400); | 467 | PIPE_RESTORE(dev, pipe->pipe_0x6400, 0x6400); |
467 | PIPE_RESTORE(0x6800); | 468 | PIPE_RESTORE(dev, pipe->pipe_0x6800, 0x6800); |
468 | PIPE_RESTORE(0x6c00); | 469 | PIPE_RESTORE(dev, pipe->pipe_0x6c00, 0x6c00); |
469 | PIPE_RESTORE(0x7000); | 470 | PIPE_RESTORE(dev, pipe->pipe_0x7000, 0x7000); |
470 | PIPE_RESTORE(0x7400); | 471 | PIPE_RESTORE(dev, pipe->pipe_0x7400, 0x7400); |
471 | PIPE_RESTORE(0x7800); | 472 | PIPE_RESTORE(dev, pipe->pipe_0x7800, 0x7800); |
472 | PIPE_RESTORE(0x4400); | 473 | PIPE_RESTORE(dev, pipe->pipe_0x4400, 0x4400); |
473 | PIPE_RESTORE(0x0000); | 474 | PIPE_RESTORE(dev, pipe->pipe_0x0000, 0x0000); |
474 | PIPE_RESTORE(0x0040); | 475 | PIPE_RESTORE(dev, pipe->pipe_0x0040, 0x0040); |
475 | nouveau_wait_for_idle(dev); | 476 | nouveau_wait_for_idle(dev); |
476 | |||
477 | #undef PIPE_RESTORE | ||
478 | } | 477 | } |
479 | 478 | ||
480 | static void nv10_graph_create_pipe(struct nouveau_channel *chan) | 479 | static void nv10_graph_create_pipe(struct nouveau_channel *chan) |
@@ -808,6 +807,20 @@ void nv10_graph_destroy_context(struct nouveau_channel *chan) | |||
808 | chan->pgraph_ctx = NULL; | 807 | chan->pgraph_ctx = NULL; |
809 | } | 808 | } |
810 | 809 | ||
810 | void | ||
811 | nv10_graph_set_region_tiling(struct drm_device *dev, int i, uint32_t addr, | ||
812 | uint32_t size, uint32_t pitch) | ||
813 | { | ||
814 | uint32_t limit = max(1u, addr + size) - 1; | ||
815 | |||
816 | if (pitch) | ||
817 | addr |= 1 << 31; | ||
818 | |||
819 | nv_wr32(dev, NV10_PGRAPH_TLIMIT(i), limit); | ||
820 | nv_wr32(dev, NV10_PGRAPH_TSIZE(i), pitch); | ||
821 | nv_wr32(dev, NV10_PGRAPH_TILE(i), addr); | ||
822 | } | ||
823 | |||
811 | int nv10_graph_init(struct drm_device *dev) | 824 | int nv10_graph_init(struct drm_device *dev) |
812 | { | 825 | { |
813 | struct drm_nouveau_private *dev_priv = dev->dev_private; | 826 | struct drm_nouveau_private *dev_priv = dev->dev_private; |
@@ -832,21 +845,16 @@ int nv10_graph_init(struct drm_device *dev) | |||
832 | (1<<31)); | 845 | (1<<31)); |
833 | if (dev_priv->chipset >= 0x17) { | 846 | if (dev_priv->chipset >= 0x17) { |
834 | nv_wr32(dev, NV10_PGRAPH_DEBUG_4, 0x1f000000); | 847 | nv_wr32(dev, NV10_PGRAPH_DEBUG_4, 0x1f000000); |
848 | nv_wr32(dev, 0x400a10, 0x3ff3fb6); | ||
849 | nv_wr32(dev, 0x400838, 0x2f8684); | ||
850 | nv_wr32(dev, 0x40083c, 0x115f3f); | ||
835 | nv_wr32(dev, 0x004006b0, 0x40000020); | 851 | nv_wr32(dev, 0x004006b0, 0x40000020); |
836 | } else | 852 | } else |
837 | nv_wr32(dev, NV10_PGRAPH_DEBUG_4, 0x00000000); | 853 | nv_wr32(dev, NV10_PGRAPH_DEBUG_4, 0x00000000); |
838 | 854 | ||
839 | /* copy tile info from PFB */ | 855 | /* Turn all the tiling regions off. */ |
840 | for (i = 0; i < NV10_PFB_TILE__SIZE; i++) { | 856 | for (i = 0; i < NV10_PFB_TILE__SIZE; i++) |
841 | nv_wr32(dev, NV10_PGRAPH_TILE(i), | 857 | nv10_graph_set_region_tiling(dev, i, 0, 0, 0); |
842 | nv_rd32(dev, NV10_PFB_TILE(i))); | ||
843 | nv_wr32(dev, NV10_PGRAPH_TLIMIT(i), | ||
844 | nv_rd32(dev, NV10_PFB_TLIMIT(i))); | ||
845 | nv_wr32(dev, NV10_PGRAPH_TSIZE(i), | ||
846 | nv_rd32(dev, NV10_PFB_TSIZE(i))); | ||
847 | nv_wr32(dev, NV10_PGRAPH_TSTATUS(i), | ||
848 | nv_rd32(dev, NV10_PFB_TSTATUS(i))); | ||
849 | } | ||
850 | 858 | ||
851 | nv_wr32(dev, NV10_PGRAPH_CTX_SWITCH1, 0x00000000); | 859 | nv_wr32(dev, NV10_PGRAPH_CTX_SWITCH1, 0x00000000); |
852 | nv_wr32(dev, NV10_PGRAPH_CTX_SWITCH2, 0x00000000); | 860 | nv_wr32(dev, NV10_PGRAPH_CTX_SWITCH2, 0x00000000); |
@@ -867,6 +875,115 @@ void nv10_graph_takedown(struct drm_device *dev) | |||
867 | { | 875 | { |
868 | } | 876 | } |
869 | 877 | ||
878 | static int | ||
879 | nv17_graph_mthd_lma_window(struct nouveau_channel *chan, int grclass, | ||
880 | int mthd, uint32_t data) | ||
881 | { | ||
882 | struct drm_device *dev = chan->dev; | ||
883 | struct graph_state *ctx = chan->pgraph_ctx; | ||
884 | struct pipe_state *pipe = &ctx->pipe_state; | ||
885 | struct drm_nouveau_private *dev_priv = dev->dev_private; | ||
886 | struct nouveau_pgraph_engine *pgraph = &dev_priv->engine.graph; | ||
887 | uint32_t pipe_0x0040[1], pipe_0x64c0[8], pipe_0x6a80[3], pipe_0x6ab0[3]; | ||
888 | uint32_t xfmode0, xfmode1; | ||
889 | int i; | ||
890 | |||
891 | ctx->lma_window[(mthd - 0x1638) / 4] = data; | ||
892 | |||
893 | if (mthd != 0x1644) | ||
894 | return 0; | ||
895 | |||
896 | nouveau_wait_for_idle(dev); | ||
897 | |||
898 | PIPE_SAVE(dev, pipe_0x0040, 0x0040); | ||
899 | PIPE_SAVE(dev, pipe->pipe_0x0200, 0x0200); | ||
900 | |||
901 | PIPE_RESTORE(dev, ctx->lma_window, 0x6790); | ||
902 | |||
903 | nouveau_wait_for_idle(dev); | ||
904 | |||
905 | xfmode0 = nv_rd32(dev, NV10_PGRAPH_XFMODE0); | ||
906 | xfmode1 = nv_rd32(dev, NV10_PGRAPH_XFMODE1); | ||
907 | |||
908 | PIPE_SAVE(dev, pipe->pipe_0x4400, 0x4400); | ||
909 | PIPE_SAVE(dev, pipe_0x64c0, 0x64c0); | ||
910 | PIPE_SAVE(dev, pipe_0x6ab0, 0x6ab0); | ||
911 | PIPE_SAVE(dev, pipe_0x6a80, 0x6a80); | ||
912 | |||
913 | nouveau_wait_for_idle(dev); | ||
914 | |||
915 | nv_wr32(dev, NV10_PGRAPH_XFMODE0, 0x10000000); | ||
916 | nv_wr32(dev, NV10_PGRAPH_XFMODE1, 0x00000000); | ||
917 | nv_wr32(dev, NV10_PGRAPH_PIPE_ADDRESS, 0x000064c0); | ||
918 | for (i = 0; i < 4; i++) | ||
919 | nv_wr32(dev, NV10_PGRAPH_PIPE_DATA, 0x3f800000); | ||
920 | for (i = 0; i < 4; i++) | ||
921 | nv_wr32(dev, NV10_PGRAPH_PIPE_DATA, 0x00000000); | ||
922 | |||
923 | nv_wr32(dev, NV10_PGRAPH_PIPE_ADDRESS, 0x00006ab0); | ||
924 | for (i = 0; i < 3; i++) | ||
925 | nv_wr32(dev, NV10_PGRAPH_PIPE_DATA, 0x3f800000); | ||
926 | |||
927 | nv_wr32(dev, NV10_PGRAPH_PIPE_ADDRESS, 0x00006a80); | ||
928 | for (i = 0; i < 3; i++) | ||
929 | nv_wr32(dev, NV10_PGRAPH_PIPE_DATA, 0x00000000); | ||
930 | |||
931 | nv_wr32(dev, NV10_PGRAPH_PIPE_ADDRESS, 0x00000040); | ||
932 | nv_wr32(dev, NV10_PGRAPH_PIPE_DATA, 0x00000008); | ||
933 | |||
934 | PIPE_RESTORE(dev, pipe->pipe_0x0200, 0x0200); | ||
935 | |||
936 | nouveau_wait_for_idle(dev); | ||
937 | |||
938 | PIPE_RESTORE(dev, pipe_0x0040, 0x0040); | ||
939 | |||
940 | nv_wr32(dev, NV10_PGRAPH_XFMODE0, xfmode0); | ||
941 | nv_wr32(dev, NV10_PGRAPH_XFMODE1, xfmode1); | ||
942 | |||
943 | PIPE_RESTORE(dev, pipe_0x64c0, 0x64c0); | ||
944 | PIPE_RESTORE(dev, pipe_0x6ab0, 0x6ab0); | ||
945 | PIPE_RESTORE(dev, pipe_0x6a80, 0x6a80); | ||
946 | PIPE_RESTORE(dev, pipe->pipe_0x4400, 0x4400); | ||
947 | |||
948 | nv_wr32(dev, NV10_PGRAPH_PIPE_ADDRESS, 0x000000c0); | ||
949 | nv_wr32(dev, NV10_PGRAPH_PIPE_DATA, 0x00000000); | ||
950 | |||
951 | nouveau_wait_for_idle(dev); | ||
952 | |||
953 | pgraph->fifo_access(dev, true); | ||
954 | |||
955 | return 0; | ||
956 | } | ||
957 | |||
958 | static int | ||
959 | nv17_graph_mthd_lma_enable(struct nouveau_channel *chan, int grclass, | ||
960 | int mthd, uint32_t data) | ||
961 | { | ||
962 | struct drm_device *dev = chan->dev; | ||
963 | struct drm_nouveau_private *dev_priv = dev->dev_private; | ||
964 | struct nouveau_pgraph_engine *pgraph = &dev_priv->engine.graph; | ||
965 | |||
966 | nouveau_wait_for_idle(dev); | ||
967 | |||
968 | nv_wr32(dev, NV10_PGRAPH_DEBUG_4, | ||
969 | nv_rd32(dev, NV10_PGRAPH_DEBUG_4) | 0x1 << 8); | ||
970 | nv_wr32(dev, 0x004006b0, | ||
971 | nv_rd32(dev, 0x004006b0) | 0x8 << 24); | ||
972 | |||
973 | pgraph->fifo_access(dev, true); | ||
974 | |||
975 | return 0; | ||
976 | } | ||
977 | |||
978 | static struct nouveau_pgraph_object_method nv17_graph_celsius_mthds[] = { | ||
979 | { 0x1638, nv17_graph_mthd_lma_window }, | ||
980 | { 0x163c, nv17_graph_mthd_lma_window }, | ||
981 | { 0x1640, nv17_graph_mthd_lma_window }, | ||
982 | { 0x1644, nv17_graph_mthd_lma_window }, | ||
983 | { 0x1658, nv17_graph_mthd_lma_enable }, | ||
984 | {} | ||
985 | }; | ||
986 | |||
870 | struct nouveau_pgraph_object_class nv10_graph_grclass[] = { | 987 | struct nouveau_pgraph_object_class nv10_graph_grclass[] = { |
871 | { 0x0030, false, NULL }, /* null */ | 988 | { 0x0030, false, NULL }, /* null */ |
872 | { 0x0039, false, NULL }, /* m2mf */ | 989 | { 0x0039, false, NULL }, /* m2mf */ |
@@ -887,6 +1004,6 @@ struct nouveau_pgraph_object_class nv10_graph_grclass[] = { | |||
887 | { 0x0095, false, NULL }, /* multitex_tri */ | 1004 | { 0x0095, false, NULL }, /* multitex_tri */ |
888 | { 0x0056, false, NULL }, /* celcius (nv10) */ | 1005 | { 0x0056, false, NULL }, /* celcius (nv10) */ |
889 | { 0x0096, false, NULL }, /* celcius (nv11) */ | 1006 | { 0x0096, false, NULL }, /* celcius (nv11) */ |
890 | { 0x0099, false, NULL }, /* celcius (nv17) */ | 1007 | { 0x0099, false, nv17_graph_celsius_mthds }, /* celcius (nv17) */ |
891 | {} | 1008 | {} |
892 | }; | 1009 | }; |
diff --git a/drivers/gpu/drm/nouveau/nv17_tv.c b/drivers/gpu/drm/nouveau/nv17_tv.c index 46cfd9c60478..58b917c3341b 100644 --- a/drivers/gpu/drm/nouveau/nv17_tv.c +++ b/drivers/gpu/drm/nouveau/nv17_tv.c | |||
@@ -33,13 +33,103 @@ | |||
33 | #include "nouveau_hw.h" | 33 | #include "nouveau_hw.h" |
34 | #include "nv17_tv.h" | 34 | #include "nv17_tv.h" |
35 | 35 | ||
36 | enum drm_connector_status nv17_tv_detect(struct drm_encoder *encoder, | 36 | static uint32_t nv42_tv_sample_load(struct drm_encoder *encoder) |
37 | struct drm_connector *connector, | ||
38 | uint32_t pin_mask) | ||
39 | { | 37 | { |
38 | struct drm_device *dev = encoder->dev; | ||
39 | struct drm_nouveau_private *dev_priv = dev->dev_private; | ||
40 | uint32_t testval, regoffset = nv04_dac_output_offset(encoder); | ||
41 | uint32_t gpio0, gpio1, fp_htotal, fp_hsync_start, fp_hsync_end, | ||
42 | fp_control, test_ctrl, dacclk, ctv_14, ctv_1c, ctv_6c; | ||
43 | uint32_t sample = 0; | ||
44 | int head; | ||
45 | |||
46 | #define RGB_TEST_DATA(r, g, b) (r << 0 | g << 10 | b << 20) | ||
47 | testval = RGB_TEST_DATA(0x82, 0xeb, 0x82); | ||
48 | if (dev_priv->vbios->tvdactestval) | ||
49 | testval = dev_priv->vbios->tvdactestval; | ||
50 | |||
51 | dacclk = NVReadRAMDAC(dev, 0, NV_PRAMDAC_DACCLK + regoffset); | ||
52 | head = (dacclk & 0x100) >> 8; | ||
53 | |||
54 | /* Save the previous state. */ | ||
55 | gpio1 = nv17_gpio_get(dev, DCB_GPIO_TVDAC1); | ||
56 | gpio0 = nv17_gpio_get(dev, DCB_GPIO_TVDAC0); | ||
57 | fp_htotal = NVReadRAMDAC(dev, head, NV_PRAMDAC_FP_HTOTAL); | ||
58 | fp_hsync_start = NVReadRAMDAC(dev, head, NV_PRAMDAC_FP_HSYNC_START); | ||
59 | fp_hsync_end = NVReadRAMDAC(dev, head, NV_PRAMDAC_FP_HSYNC_END); | ||
60 | fp_control = NVReadRAMDAC(dev, head, NV_PRAMDAC_FP_TG_CONTROL); | ||
61 | test_ctrl = NVReadRAMDAC(dev, 0, NV_PRAMDAC_TEST_CONTROL + regoffset); | ||
62 | ctv_1c = NVReadRAMDAC(dev, head, 0x680c1c); | ||
63 | ctv_14 = NVReadRAMDAC(dev, head, 0x680c14); | ||
64 | ctv_6c = NVReadRAMDAC(dev, head, 0x680c6c); | ||
65 | |||
66 | /* Prepare the DAC for load detection. */ | ||
67 | nv17_gpio_set(dev, DCB_GPIO_TVDAC1, true); | ||
68 | nv17_gpio_set(dev, DCB_GPIO_TVDAC0, true); | ||
69 | |||
70 | NVWriteRAMDAC(dev, head, NV_PRAMDAC_FP_HTOTAL, 1343); | ||
71 | NVWriteRAMDAC(dev, head, NV_PRAMDAC_FP_HSYNC_START, 1047); | ||
72 | NVWriteRAMDAC(dev, head, NV_PRAMDAC_FP_HSYNC_END, 1183); | ||
73 | NVWriteRAMDAC(dev, head, NV_PRAMDAC_FP_TG_CONTROL, | ||
74 | NV_PRAMDAC_FP_TG_CONTROL_DISPEN_POS | | ||
75 | NV_PRAMDAC_FP_TG_CONTROL_WIDTH_12 | | ||
76 | NV_PRAMDAC_FP_TG_CONTROL_READ_PROG | | ||
77 | NV_PRAMDAC_FP_TG_CONTROL_HSYNC_POS | | ||
78 | NV_PRAMDAC_FP_TG_CONTROL_VSYNC_POS); | ||
79 | |||
80 | NVWriteRAMDAC(dev, 0, NV_PRAMDAC_TEST_CONTROL + regoffset, 0); | ||
81 | |||
82 | NVWriteRAMDAC(dev, 0, NV_PRAMDAC_DACCLK + regoffset, | ||
83 | (dacclk & ~0xff) | 0x22); | ||
84 | msleep(1); | ||
85 | NVWriteRAMDAC(dev, 0, NV_PRAMDAC_DACCLK + regoffset, | ||
86 | (dacclk & ~0xff) | 0x21); | ||
87 | |||
88 | NVWriteRAMDAC(dev, head, 0x680c1c, 1 << 20); | ||
89 | NVWriteRAMDAC(dev, head, 0x680c14, 4 << 16); | ||
90 | |||
91 | /* Sample pin 0x4 (usually S-video luma). */ | ||
92 | NVWriteRAMDAC(dev, head, 0x680c6c, testval >> 10 & 0x3ff); | ||
93 | msleep(20); | ||
94 | sample |= NVReadRAMDAC(dev, 0, NV_PRAMDAC_TEST_CONTROL + regoffset) | ||
95 | & 0x4 << 28; | ||
96 | |||
97 | /* Sample the remaining pins. */ | ||
98 | NVWriteRAMDAC(dev, head, 0x680c6c, testval & 0x3ff); | ||
99 | msleep(20); | ||
100 | sample |= NVReadRAMDAC(dev, 0, NV_PRAMDAC_TEST_CONTROL + regoffset) | ||
101 | & 0xa << 28; | ||
102 | |||
103 | /* Restore the previous state. */ | ||
104 | NVWriteRAMDAC(dev, head, 0x680c1c, ctv_1c); | ||
105 | NVWriteRAMDAC(dev, head, 0x680c14, ctv_14); | ||
106 | NVWriteRAMDAC(dev, head, 0x680c6c, ctv_6c); | ||
107 | NVWriteRAMDAC(dev, 0, NV_PRAMDAC_DACCLK + regoffset, dacclk); | ||
108 | NVWriteRAMDAC(dev, 0, NV_PRAMDAC_TEST_CONTROL + regoffset, test_ctrl); | ||
109 | NVWriteRAMDAC(dev, head, NV_PRAMDAC_FP_TG_CONTROL, fp_control); | ||
110 | NVWriteRAMDAC(dev, head, NV_PRAMDAC_FP_HSYNC_END, fp_hsync_end); | ||
111 | NVWriteRAMDAC(dev, head, NV_PRAMDAC_FP_HSYNC_START, fp_hsync_start); | ||
112 | NVWriteRAMDAC(dev, head, NV_PRAMDAC_FP_HTOTAL, fp_htotal); | ||
113 | nv17_gpio_set(dev, DCB_GPIO_TVDAC1, gpio1); | ||
114 | nv17_gpio_set(dev, DCB_GPIO_TVDAC0, gpio0); | ||
115 | |||
116 | return sample; | ||
117 | } | ||
118 | |||
119 | static enum drm_connector_status | ||
120 | nv17_tv_detect(struct drm_encoder *encoder, struct drm_connector *connector) | ||
121 | { | ||
122 | struct drm_device *dev = encoder->dev; | ||
123 | struct drm_nouveau_private *dev_priv = dev->dev_private; | ||
124 | struct drm_mode_config *conf = &dev->mode_config; | ||
40 | struct nv17_tv_encoder *tv_enc = to_tv_enc(encoder); | 125 | struct nv17_tv_encoder *tv_enc = to_tv_enc(encoder); |
126 | struct dcb_entry *dcb = tv_enc->base.dcb; | ||
41 | 127 | ||
42 | tv_enc->pin_mask = pin_mask >> 28 & 0xe; | 128 | if (dev_priv->chipset == 0x42 || |
129 | dev_priv->chipset == 0x43) | ||
130 | tv_enc->pin_mask = nv42_tv_sample_load(encoder) >> 28 & 0xe; | ||
131 | else | ||
132 | tv_enc->pin_mask = nv17_dac_sample_load(encoder) >> 28 & 0xe; | ||
43 | 133 | ||
44 | switch (tv_enc->pin_mask) { | 134 | switch (tv_enc->pin_mask) { |
45 | case 0x2: | 135 | case 0x2: |
@@ -50,7 +140,7 @@ enum drm_connector_status nv17_tv_detect(struct drm_encoder *encoder, | |||
50 | tv_enc->subconnector = DRM_MODE_SUBCONNECTOR_SVIDEO; | 140 | tv_enc->subconnector = DRM_MODE_SUBCONNECTOR_SVIDEO; |
51 | break; | 141 | break; |
52 | case 0xe: | 142 | case 0xe: |
53 | if (nouveau_encoder(encoder)->dcb->tvconf.has_component_output) | 143 | if (dcb->tvconf.has_component_output) |
54 | tv_enc->subconnector = DRM_MODE_SUBCONNECTOR_Component; | 144 | tv_enc->subconnector = DRM_MODE_SUBCONNECTOR_Component; |
55 | else | 145 | else |
56 | tv_enc->subconnector = DRM_MODE_SUBCONNECTOR_SCART; | 146 | tv_enc->subconnector = DRM_MODE_SUBCONNECTOR_SCART; |
@@ -61,11 +151,16 @@ enum drm_connector_status nv17_tv_detect(struct drm_encoder *encoder, | |||
61 | } | 151 | } |
62 | 152 | ||
63 | drm_connector_property_set_value(connector, | 153 | drm_connector_property_set_value(connector, |
64 | encoder->dev->mode_config.tv_subconnector_property, | 154 | conf->tv_subconnector_property, |
65 | tv_enc->subconnector); | 155 | tv_enc->subconnector); |
66 | 156 | ||
67 | return tv_enc->subconnector ? connector_status_connected : | 157 | if (tv_enc->subconnector) { |
68 | connector_status_disconnected; | 158 | NV_INFO(dev, "Load detected on output %c\n", |
159 | '@' + ffs(dcb->or)); | ||
160 | return connector_status_connected; | ||
161 | } else { | ||
162 | return connector_status_disconnected; | ||
163 | } | ||
69 | } | 164 | } |
70 | 165 | ||
71 | static const struct { | 166 | static const struct { |
@@ -219,7 +314,7 @@ static void nv17_tv_dpms(struct drm_encoder *encoder, int mode) | |||
219 | return; | 314 | return; |
220 | nouveau_encoder(encoder)->last_dpms = mode; | 315 | nouveau_encoder(encoder)->last_dpms = mode; |
221 | 316 | ||
222 | NV_TRACE(dev, "Setting dpms mode %d on TV encoder (output %d)\n", | 317 | NV_INFO(dev, "Setting dpms mode %d on TV encoder (output %d)\n", |
223 | mode, nouveau_encoder(encoder)->dcb->index); | 318 | mode, nouveau_encoder(encoder)->dcb->index); |
224 | 319 | ||
225 | regs->ptv_200 &= ~1; | 320 | regs->ptv_200 &= ~1; |
@@ -619,7 +714,7 @@ static void nv17_tv_destroy(struct drm_encoder *encoder) | |||
619 | { | 714 | { |
620 | struct nv17_tv_encoder *tv_enc = to_tv_enc(encoder); | 715 | struct nv17_tv_encoder *tv_enc = to_tv_enc(encoder); |
621 | 716 | ||
622 | NV_DEBUG(encoder->dev, "\n"); | 717 | NV_DEBUG_KMS(encoder->dev, "\n"); |
623 | 718 | ||
624 | drm_encoder_cleanup(encoder); | 719 | drm_encoder_cleanup(encoder); |
625 | kfree(tv_enc); | 720 | kfree(tv_enc); |
@@ -633,7 +728,7 @@ static struct drm_encoder_helper_funcs nv17_tv_helper_funcs = { | |||
633 | .prepare = nv17_tv_prepare, | 728 | .prepare = nv17_tv_prepare, |
634 | .commit = nv17_tv_commit, | 729 | .commit = nv17_tv_commit, |
635 | .mode_set = nv17_tv_mode_set, | 730 | .mode_set = nv17_tv_mode_set, |
636 | .detect = nv17_dac_detect, | 731 | .detect = nv17_tv_detect, |
637 | }; | 732 | }; |
638 | 733 | ||
639 | static struct drm_encoder_slave_funcs nv17_tv_slave_funcs = { | 734 | static struct drm_encoder_slave_funcs nv17_tv_slave_funcs = { |
diff --git a/drivers/gpu/drm/nouveau/nv20_graph.c b/drivers/gpu/drm/nouveau/nv20_graph.c index 18ba74f19703..d6fc0a82f03d 100644 --- a/drivers/gpu/drm/nouveau/nv20_graph.c +++ b/drivers/gpu/drm/nouveau/nv20_graph.c | |||
@@ -514,6 +514,27 @@ nv20_graph_rdi(struct drm_device *dev) | |||
514 | nouveau_wait_for_idle(dev); | 514 | nouveau_wait_for_idle(dev); |
515 | } | 515 | } |
516 | 516 | ||
517 | void | ||
518 | nv20_graph_set_region_tiling(struct drm_device *dev, int i, uint32_t addr, | ||
519 | uint32_t size, uint32_t pitch) | ||
520 | { | ||
521 | uint32_t limit = max(1u, addr + size) - 1; | ||
522 | |||
523 | if (pitch) | ||
524 | addr |= 1; | ||
525 | |||
526 | nv_wr32(dev, NV20_PGRAPH_TLIMIT(i), limit); | ||
527 | nv_wr32(dev, NV20_PGRAPH_TSIZE(i), pitch); | ||
528 | nv_wr32(dev, NV20_PGRAPH_TILE(i), addr); | ||
529 | |||
530 | nv_wr32(dev, NV10_PGRAPH_RDI_INDEX, 0x00EA0030 + 4 * i); | ||
531 | nv_wr32(dev, NV10_PGRAPH_RDI_DATA, limit); | ||
532 | nv_wr32(dev, NV10_PGRAPH_RDI_INDEX, 0x00EA0050 + 4 * i); | ||
533 | nv_wr32(dev, NV10_PGRAPH_RDI_DATA, pitch); | ||
534 | nv_wr32(dev, NV10_PGRAPH_RDI_INDEX, 0x00EA0010 + 4 * i); | ||
535 | nv_wr32(dev, NV10_PGRAPH_RDI_DATA, addr); | ||
536 | } | ||
537 | |||
517 | int | 538 | int |
518 | nv20_graph_init(struct drm_device *dev) | 539 | nv20_graph_init(struct drm_device *dev) |
519 | { | 540 | { |
@@ -572,27 +593,10 @@ nv20_graph_init(struct drm_device *dev) | |||
572 | nv_wr32(dev, NV10_PGRAPH_RDI_DATA , 0x00000030); | 593 | nv_wr32(dev, NV10_PGRAPH_RDI_DATA , 0x00000030); |
573 | } | 594 | } |
574 | 595 | ||
575 | /* copy tile info from PFB */ | 596 | /* Turn all the tiling regions off. */ |
576 | for (i = 0; i < NV10_PFB_TILE__SIZE; i++) { | 597 | for (i = 0; i < NV10_PFB_TILE__SIZE; i++) |
577 | nv_wr32(dev, 0x00400904 + i * 0x10, | 598 | nv20_graph_set_region_tiling(dev, i, 0, 0, 0); |
578 | nv_rd32(dev, NV10_PFB_TLIMIT(i))); | 599 | |
579 | /* which is NV40_PGRAPH_TLIMIT0(i) ?? */ | ||
580 | nv_wr32(dev, NV10_PGRAPH_RDI_INDEX, 0x00EA0030 + i * 4); | ||
581 | nv_wr32(dev, NV10_PGRAPH_RDI_DATA, | ||
582 | nv_rd32(dev, NV10_PFB_TLIMIT(i))); | ||
583 | nv_wr32(dev, 0x00400908 + i * 0x10, | ||
584 | nv_rd32(dev, NV10_PFB_TSIZE(i))); | ||
585 | /* which is NV40_PGRAPH_TSIZE0(i) ?? */ | ||
586 | nv_wr32(dev, NV10_PGRAPH_RDI_INDEX, 0x00EA0050 + i * 4); | ||
587 | nv_wr32(dev, NV10_PGRAPH_RDI_DATA, | ||
588 | nv_rd32(dev, NV10_PFB_TSIZE(i))); | ||
589 | nv_wr32(dev, 0x00400900 + i * 0x10, | ||
590 | nv_rd32(dev, NV10_PFB_TILE(i))); | ||
591 | /* which is NV40_PGRAPH_TILE0(i) ?? */ | ||
592 | nv_wr32(dev, NV10_PGRAPH_RDI_INDEX, 0x00EA0010 + i * 4); | ||
593 | nv_wr32(dev, NV10_PGRAPH_RDI_DATA, | ||
594 | nv_rd32(dev, NV10_PFB_TILE(i))); | ||
595 | } | ||
596 | for (i = 0; i < 8; i++) { | 600 | for (i = 0; i < 8; i++) { |
597 | nv_wr32(dev, 0x400980 + i * 4, nv_rd32(dev, 0x100300 + i * 4)); | 601 | nv_wr32(dev, 0x400980 + i * 4, nv_rd32(dev, 0x100300 + i * 4)); |
598 | nv_wr32(dev, NV10_PGRAPH_RDI_INDEX, 0x00EA0090 + i * 4); | 602 | nv_wr32(dev, NV10_PGRAPH_RDI_INDEX, 0x00EA0090 + i * 4); |
@@ -704,18 +708,9 @@ nv30_graph_init(struct drm_device *dev) | |||
704 | 708 | ||
705 | nv_wr32(dev, 0x4000c0, 0x00000016); | 709 | nv_wr32(dev, 0x4000c0, 0x00000016); |
706 | 710 | ||
707 | /* copy tile info from PFB */ | 711 | /* Turn all the tiling regions off. */ |
708 | for (i = 0; i < NV10_PFB_TILE__SIZE; i++) { | 712 | for (i = 0; i < NV10_PFB_TILE__SIZE; i++) |
709 | nv_wr32(dev, 0x00400904 + i * 0x10, | 713 | nv20_graph_set_region_tiling(dev, i, 0, 0, 0); |
710 | nv_rd32(dev, NV10_PFB_TLIMIT(i))); | ||
711 | /* which is NV40_PGRAPH_TLIMIT0(i) ?? */ | ||
712 | nv_wr32(dev, 0x00400908 + i * 0x10, | ||
713 | nv_rd32(dev, NV10_PFB_TSIZE(i))); | ||
714 | /* which is NV40_PGRAPH_TSIZE0(i) ?? */ | ||
715 | nv_wr32(dev, 0x00400900 + i * 0x10, | ||
716 | nv_rd32(dev, NV10_PFB_TILE(i))); | ||
717 | /* which is NV40_PGRAPH_TILE0(i) ?? */ | ||
718 | } | ||
719 | 714 | ||
720 | nv_wr32(dev, NV10_PGRAPH_CTX_CONTROL, 0x10000100); | 715 | nv_wr32(dev, NV10_PGRAPH_CTX_CONTROL, 0x10000100); |
721 | nv_wr32(dev, NV10_PGRAPH_STATE , 0xFFFFFFFF); | 716 | nv_wr32(dev, NV10_PGRAPH_STATE , 0xFFFFFFFF); |
diff --git a/drivers/gpu/drm/nouveau/nv40_fb.c b/drivers/gpu/drm/nouveau/nv40_fb.c index ca1d27107a8e..3cd07d8d5bd7 100644 --- a/drivers/gpu/drm/nouveau/nv40_fb.c +++ b/drivers/gpu/drm/nouveau/nv40_fb.c | |||
@@ -3,12 +3,37 @@ | |||
3 | #include "nouveau_drv.h" | 3 | #include "nouveau_drv.h" |
4 | #include "nouveau_drm.h" | 4 | #include "nouveau_drm.h" |
5 | 5 | ||
6 | void | ||
7 | nv40_fb_set_region_tiling(struct drm_device *dev, int i, uint32_t addr, | ||
8 | uint32_t size, uint32_t pitch) | ||
9 | { | ||
10 | struct drm_nouveau_private *dev_priv = dev->dev_private; | ||
11 | uint32_t limit = max(1u, addr + size) - 1; | ||
12 | |||
13 | if (pitch) | ||
14 | addr |= 1; | ||
15 | |||
16 | switch (dev_priv->chipset) { | ||
17 | case 0x40: | ||
18 | nv_wr32(dev, NV10_PFB_TLIMIT(i), limit); | ||
19 | nv_wr32(dev, NV10_PFB_TSIZE(i), pitch); | ||
20 | nv_wr32(dev, NV10_PFB_TILE(i), addr); | ||
21 | break; | ||
22 | |||
23 | default: | ||
24 | nv_wr32(dev, NV40_PFB_TLIMIT(i), limit); | ||
25 | nv_wr32(dev, NV40_PFB_TSIZE(i), pitch); | ||
26 | nv_wr32(dev, NV40_PFB_TILE(i), addr); | ||
27 | break; | ||
28 | } | ||
29 | } | ||
30 | |||
6 | int | 31 | int |
7 | nv40_fb_init(struct drm_device *dev) | 32 | nv40_fb_init(struct drm_device *dev) |
8 | { | 33 | { |
9 | struct drm_nouveau_private *dev_priv = dev->dev_private; | 34 | struct drm_nouveau_private *dev_priv = dev->dev_private; |
10 | uint32_t fb_bar_size, tmp; | 35 | struct nouveau_fb_engine *pfb = &dev_priv->engine.fb; |
11 | int num_tiles; | 36 | uint32_t tmp; |
12 | int i; | 37 | int i; |
13 | 38 | ||
14 | /* This is strictly a NV4x register (don't know about NV5x). */ | 39 | /* This is strictly a NV4x register (don't know about NV5x). */ |
@@ -23,35 +48,23 @@ nv40_fb_init(struct drm_device *dev) | |||
23 | case 0x45: | 48 | case 0x45: |
24 | tmp = nv_rd32(dev, NV10_PFB_CLOSE_PAGE2); | 49 | tmp = nv_rd32(dev, NV10_PFB_CLOSE_PAGE2); |
25 | nv_wr32(dev, NV10_PFB_CLOSE_PAGE2, tmp & ~(1 << 15)); | 50 | nv_wr32(dev, NV10_PFB_CLOSE_PAGE2, tmp & ~(1 << 15)); |
26 | num_tiles = NV10_PFB_TILE__SIZE; | 51 | pfb->num_tiles = NV10_PFB_TILE__SIZE; |
27 | break; | 52 | break; |
28 | case 0x46: /* G72 */ | 53 | case 0x46: /* G72 */ |
29 | case 0x47: /* G70 */ | 54 | case 0x47: /* G70 */ |
30 | case 0x49: /* G71 */ | 55 | case 0x49: /* G71 */ |
31 | case 0x4b: /* G73 */ | 56 | case 0x4b: /* G73 */ |
32 | case 0x4c: /* C51 (G7X version) */ | 57 | case 0x4c: /* C51 (G7X version) */ |
33 | num_tiles = NV40_PFB_TILE__SIZE_1; | 58 | pfb->num_tiles = NV40_PFB_TILE__SIZE_1; |
34 | break; | 59 | break; |
35 | default: | 60 | default: |
36 | num_tiles = NV40_PFB_TILE__SIZE_0; | 61 | pfb->num_tiles = NV40_PFB_TILE__SIZE_0; |
37 | break; | 62 | break; |
38 | } | 63 | } |
39 | 64 | ||
40 | fb_bar_size = drm_get_resource_len(dev, 0) - 1; | 65 | /* Turn all the tiling regions off. */ |
41 | switch (dev_priv->chipset) { | 66 | for (i = 0; i < pfb->num_tiles; i++) |
42 | case 0x40: | 67 | pfb->set_region_tiling(dev, i, 0, 0, 0); |
43 | for (i = 0; i < num_tiles; i++) { | ||
44 | nv_wr32(dev, NV10_PFB_TILE(i), 0); | ||
45 | nv_wr32(dev, NV10_PFB_TLIMIT(i), fb_bar_size); | ||
46 | } | ||
47 | break; | ||
48 | default: | ||
49 | for (i = 0; i < num_tiles; i++) { | ||
50 | nv_wr32(dev, NV40_PFB_TILE(i), 0); | ||
51 | nv_wr32(dev, NV40_PFB_TLIMIT(i), fb_bar_size); | ||
52 | } | ||
53 | break; | ||
54 | } | ||
55 | 68 | ||
56 | return 0; | 69 | return 0; |
57 | } | 70 | } |
diff --git a/drivers/gpu/drm/nouveau/nv40_graph.c b/drivers/gpu/drm/nouveau/nv40_graph.c index 7e8547cb5833..53e8afe1dcd1 100644 --- a/drivers/gpu/drm/nouveau/nv40_graph.c +++ b/drivers/gpu/drm/nouveau/nv40_graph.c | |||
@@ -24,36 +24,10 @@ | |||
24 | * | 24 | * |
25 | */ | 25 | */ |
26 | 26 | ||
27 | #include <linux/firmware.h> | ||
28 | |||
29 | #include "drmP.h" | 27 | #include "drmP.h" |
30 | #include "drm.h" | 28 | #include "drm.h" |
31 | #include "nouveau_drv.h" | 29 | #include "nouveau_drv.h" |
32 | 30 | #include "nouveau_grctx.h" | |
33 | MODULE_FIRMWARE("nouveau/nv40.ctxprog"); | ||
34 | MODULE_FIRMWARE("nouveau/nv40.ctxvals"); | ||
35 | MODULE_FIRMWARE("nouveau/nv41.ctxprog"); | ||
36 | MODULE_FIRMWARE("nouveau/nv41.ctxvals"); | ||
37 | MODULE_FIRMWARE("nouveau/nv42.ctxprog"); | ||
38 | MODULE_FIRMWARE("nouveau/nv42.ctxvals"); | ||
39 | MODULE_FIRMWARE("nouveau/nv43.ctxprog"); | ||
40 | MODULE_FIRMWARE("nouveau/nv43.ctxvals"); | ||
41 | MODULE_FIRMWARE("nouveau/nv44.ctxprog"); | ||
42 | MODULE_FIRMWARE("nouveau/nv44.ctxvals"); | ||
43 | MODULE_FIRMWARE("nouveau/nv46.ctxprog"); | ||
44 | MODULE_FIRMWARE("nouveau/nv46.ctxvals"); | ||
45 | MODULE_FIRMWARE("nouveau/nv47.ctxprog"); | ||
46 | MODULE_FIRMWARE("nouveau/nv47.ctxvals"); | ||
47 | MODULE_FIRMWARE("nouveau/nv49.ctxprog"); | ||
48 | MODULE_FIRMWARE("nouveau/nv49.ctxvals"); | ||
49 | MODULE_FIRMWARE("nouveau/nv4a.ctxprog"); | ||
50 | MODULE_FIRMWARE("nouveau/nv4a.ctxvals"); | ||
51 | MODULE_FIRMWARE("nouveau/nv4b.ctxprog"); | ||
52 | MODULE_FIRMWARE("nouveau/nv4b.ctxvals"); | ||
53 | MODULE_FIRMWARE("nouveau/nv4c.ctxprog"); | ||
54 | MODULE_FIRMWARE("nouveau/nv4c.ctxvals"); | ||
55 | MODULE_FIRMWARE("nouveau/nv4e.ctxprog"); | ||
56 | MODULE_FIRMWARE("nouveau/nv4e.ctxvals"); | ||
57 | 31 | ||
58 | struct nouveau_channel * | 32 | struct nouveau_channel * |
59 | nv40_graph_channel(struct drm_device *dev) | 33 | nv40_graph_channel(struct drm_device *dev) |
@@ -83,27 +57,30 @@ nv40_graph_create_context(struct nouveau_channel *chan) | |||
83 | { | 57 | { |
84 | struct drm_device *dev = chan->dev; | 58 | struct drm_device *dev = chan->dev; |
85 | struct drm_nouveau_private *dev_priv = dev->dev_private; | 59 | struct drm_nouveau_private *dev_priv = dev->dev_private; |
86 | struct nouveau_gpuobj *ctx; | 60 | struct nouveau_pgraph_engine *pgraph = &dev_priv->engine.graph; |
87 | int ret; | 61 | int ret; |
88 | 62 | ||
89 | /* Allocate a 175KiB block of PRAMIN to store the context. This | 63 | ret = nouveau_gpuobj_new_ref(dev, chan, NULL, 0, pgraph->grctx_size, |
90 | * is massive overkill for a lot of chipsets, but it should be safe | 64 | 16, NVOBJ_FLAG_ZERO_ALLOC, |
91 | * until we're able to implement this properly (will happen at more | 65 | &chan->ramin_grctx); |
92 | * or less the same time we're able to write our own context programs. | ||
93 | */ | ||
94 | ret = nouveau_gpuobj_new_ref(dev, chan, NULL, 0, 175*1024, 16, | ||
95 | NVOBJ_FLAG_ZERO_ALLOC, | ||
96 | &chan->ramin_grctx); | ||
97 | if (ret) | 66 | if (ret) |
98 | return ret; | 67 | return ret; |
99 | ctx = chan->ramin_grctx->gpuobj; | ||
100 | 68 | ||
101 | /* Initialise default context values */ | 69 | /* Initialise default context values */ |
102 | dev_priv->engine.instmem.prepare_access(dev, true); | 70 | dev_priv->engine.instmem.prepare_access(dev, true); |
103 | nv40_grctx_vals_load(dev, ctx); | 71 | if (!pgraph->ctxprog) { |
104 | nv_wo32(dev, ctx, 0, ctx->im_pramin->start); | 72 | struct nouveau_grctx ctx = {}; |
105 | dev_priv->engine.instmem.finish_access(dev); | ||
106 | 73 | ||
74 | ctx.dev = chan->dev; | ||
75 | ctx.mode = NOUVEAU_GRCTX_VALS; | ||
76 | ctx.data = chan->ramin_grctx->gpuobj; | ||
77 | nv40_grctx_init(&ctx); | ||
78 | } else { | ||
79 | nouveau_grctx_vals_load(dev, chan->ramin_grctx->gpuobj); | ||
80 | } | ||
81 | nv_wo32(dev, chan->ramin_grctx->gpuobj, 0, | ||
82 | chan->ramin_grctx->gpuobj->im_pramin->start); | ||
83 | dev_priv->engine.instmem.finish_access(dev); | ||
107 | return 0; | 84 | return 0; |
108 | } | 85 | } |
109 | 86 | ||
@@ -204,137 +181,46 @@ nv40_graph_unload_context(struct drm_device *dev) | |||
204 | return ret; | 181 | return ret; |
205 | } | 182 | } |
206 | 183 | ||
207 | struct nouveau_ctxprog { | ||
208 | uint32_t signature; | ||
209 | uint8_t version; | ||
210 | uint16_t length; | ||
211 | uint32_t data[]; | ||
212 | } __attribute__ ((packed)); | ||
213 | |||
214 | struct nouveau_ctxvals { | ||
215 | uint32_t signature; | ||
216 | uint8_t version; | ||
217 | uint32_t length; | ||
218 | struct { | ||
219 | uint32_t offset; | ||
220 | uint32_t value; | ||
221 | } data[]; | ||
222 | } __attribute__ ((packed)); | ||
223 | |||
224 | int | ||
225 | nv40_grctx_init(struct drm_device *dev) | ||
226 | { | ||
227 | struct drm_nouveau_private *dev_priv = dev->dev_private; | ||
228 | struct nouveau_pgraph_engine *pgraph = &dev_priv->engine.graph; | ||
229 | const int chipset = dev_priv->chipset; | ||
230 | const struct firmware *fw; | ||
231 | const struct nouveau_ctxprog *cp; | ||
232 | const struct nouveau_ctxvals *cv; | ||
233 | char name[32]; | ||
234 | int ret, i; | ||
235 | |||
236 | pgraph->accel_blocked = true; | ||
237 | |||
238 | if (!pgraph->ctxprog) { | ||
239 | sprintf(name, "nouveau/nv%02x.ctxprog", chipset); | ||
240 | ret = request_firmware(&fw, name, &dev->pdev->dev); | ||
241 | if (ret) { | ||
242 | NV_ERROR(dev, "No ctxprog for NV%02x\n", chipset); | ||
243 | return ret; | ||
244 | } | ||
245 | |||
246 | pgraph->ctxprog = kmalloc(fw->size, GFP_KERNEL); | ||
247 | if (!pgraph->ctxprog) { | ||
248 | NV_ERROR(dev, "OOM copying ctxprog\n"); | ||
249 | release_firmware(fw); | ||
250 | return -ENOMEM; | ||
251 | } | ||
252 | memcpy(pgraph->ctxprog, fw->data, fw->size); | ||
253 | |||
254 | cp = pgraph->ctxprog; | ||
255 | if (le32_to_cpu(cp->signature) != 0x5043564e || | ||
256 | cp->version != 0 || | ||
257 | le16_to_cpu(cp->length) != ((fw->size - 7) / 4)) { | ||
258 | NV_ERROR(dev, "ctxprog invalid\n"); | ||
259 | release_firmware(fw); | ||
260 | nv40_grctx_fini(dev); | ||
261 | return -EINVAL; | ||
262 | } | ||
263 | release_firmware(fw); | ||
264 | } | ||
265 | |||
266 | if (!pgraph->ctxvals) { | ||
267 | sprintf(name, "nouveau/nv%02x.ctxvals", chipset); | ||
268 | ret = request_firmware(&fw, name, &dev->pdev->dev); | ||
269 | if (ret) { | ||
270 | NV_ERROR(dev, "No ctxvals for NV%02x\n", chipset); | ||
271 | nv40_grctx_fini(dev); | ||
272 | return ret; | ||
273 | } | ||
274 | |||
275 | pgraph->ctxvals = kmalloc(fw->size, GFP_KERNEL); | ||
276 | if (!pgraph->ctxprog) { | ||
277 | NV_ERROR(dev, "OOM copying ctxprog\n"); | ||
278 | release_firmware(fw); | ||
279 | nv40_grctx_fini(dev); | ||
280 | return -ENOMEM; | ||
281 | } | ||
282 | memcpy(pgraph->ctxvals, fw->data, fw->size); | ||
283 | |||
284 | cv = (void *)pgraph->ctxvals; | ||
285 | if (le32_to_cpu(cv->signature) != 0x5643564e || | ||
286 | cv->version != 0 || | ||
287 | le32_to_cpu(cv->length) != ((fw->size - 9) / 8)) { | ||
288 | NV_ERROR(dev, "ctxvals invalid\n"); | ||
289 | release_firmware(fw); | ||
290 | nv40_grctx_fini(dev); | ||
291 | return -EINVAL; | ||
292 | } | ||
293 | release_firmware(fw); | ||
294 | } | ||
295 | |||
296 | cp = pgraph->ctxprog; | ||
297 | |||
298 | nv_wr32(dev, NV40_PGRAPH_CTXCTL_UCODE_INDEX, 0); | ||
299 | for (i = 0; i < le16_to_cpu(cp->length); i++) | ||
300 | nv_wr32(dev, NV40_PGRAPH_CTXCTL_UCODE_DATA, | ||
301 | le32_to_cpu(cp->data[i])); | ||
302 | |||
303 | pgraph->accel_blocked = false; | ||
304 | return 0; | ||
305 | } | ||
306 | |||
307 | void | 184 | void |
308 | nv40_grctx_fini(struct drm_device *dev) | 185 | nv40_graph_set_region_tiling(struct drm_device *dev, int i, uint32_t addr, |
186 | uint32_t size, uint32_t pitch) | ||
309 | { | 187 | { |
310 | struct drm_nouveau_private *dev_priv = dev->dev_private; | 188 | struct drm_nouveau_private *dev_priv = dev->dev_private; |
311 | struct nouveau_pgraph_engine *pgraph = &dev_priv->engine.graph; | 189 | uint32_t limit = max(1u, addr + size) - 1; |
312 | |||
313 | if (pgraph->ctxprog) { | ||
314 | kfree(pgraph->ctxprog); | ||
315 | pgraph->ctxprog = NULL; | ||
316 | } | ||
317 | 190 | ||
318 | if (pgraph->ctxvals) { | 191 | if (pitch) |
319 | kfree(pgraph->ctxprog); | 192 | addr |= 1; |
320 | pgraph->ctxvals = NULL; | ||
321 | } | ||
322 | } | ||
323 | 193 | ||
324 | void | 194 | switch (dev_priv->chipset) { |
325 | nv40_grctx_vals_load(struct drm_device *dev, struct nouveau_gpuobj *ctx) | 195 | case 0x44: |
326 | { | 196 | case 0x4a: |
327 | struct drm_nouveau_private *dev_priv = dev->dev_private; | 197 | case 0x4e: |
328 | struct nouveau_pgraph_engine *pgraph = &dev_priv->engine.graph; | 198 | nv_wr32(dev, NV20_PGRAPH_TSIZE(i), pitch); |
329 | struct nouveau_ctxvals *cv = pgraph->ctxvals; | 199 | nv_wr32(dev, NV20_PGRAPH_TLIMIT(i), limit); |
330 | int i; | 200 | nv_wr32(dev, NV20_PGRAPH_TILE(i), addr); |
201 | break; | ||
331 | 202 | ||
332 | if (!cv) | 203 | case 0x46: |
333 | return; | 204 | case 0x47: |
205 | case 0x49: | ||
206 | case 0x4b: | ||
207 | nv_wr32(dev, NV47_PGRAPH_TSIZE(i), pitch); | ||
208 | nv_wr32(dev, NV47_PGRAPH_TLIMIT(i), limit); | ||
209 | nv_wr32(dev, NV47_PGRAPH_TILE(i), addr); | ||
210 | nv_wr32(dev, NV40_PGRAPH_TSIZE1(i), pitch); | ||
211 | nv_wr32(dev, NV40_PGRAPH_TLIMIT1(i), limit); | ||
212 | nv_wr32(dev, NV40_PGRAPH_TILE1(i), addr); | ||
213 | break; | ||
334 | 214 | ||
335 | for (i = 0; i < le32_to_cpu(cv->length); i++) | 215 | default: |
336 | nv_wo32(dev, ctx, le32_to_cpu(cv->data[i].offset), | 216 | nv_wr32(dev, NV20_PGRAPH_TSIZE(i), pitch); |
337 | le32_to_cpu(cv->data[i].value)); | 217 | nv_wr32(dev, NV20_PGRAPH_TLIMIT(i), limit); |
218 | nv_wr32(dev, NV20_PGRAPH_TILE(i), addr); | ||
219 | nv_wr32(dev, NV40_PGRAPH_TSIZE1(i), pitch); | ||
220 | nv_wr32(dev, NV40_PGRAPH_TLIMIT1(i), limit); | ||
221 | nv_wr32(dev, NV40_PGRAPH_TILE1(i), addr); | ||
222 | break; | ||
223 | } | ||
338 | } | 224 | } |
339 | 225 | ||
340 | /* | 226 | /* |
@@ -351,7 +237,8 @@ nv40_graph_init(struct drm_device *dev) | |||
351 | { | 237 | { |
352 | struct drm_nouveau_private *dev_priv = | 238 | struct drm_nouveau_private *dev_priv = |
353 | (struct drm_nouveau_private *)dev->dev_private; | 239 | (struct drm_nouveau_private *)dev->dev_private; |
354 | uint32_t vramsz, tmp; | 240 | struct nouveau_fb_engine *pfb = &dev_priv->engine.fb; |
241 | uint32_t vramsz; | ||
355 | int i, j; | 242 | int i, j; |
356 | 243 | ||
357 | nv_wr32(dev, NV03_PMC_ENABLE, nv_rd32(dev, NV03_PMC_ENABLE) & | 244 | nv_wr32(dev, NV03_PMC_ENABLE, nv_rd32(dev, NV03_PMC_ENABLE) & |
@@ -359,7 +246,26 @@ nv40_graph_init(struct drm_device *dev) | |||
359 | nv_wr32(dev, NV03_PMC_ENABLE, nv_rd32(dev, NV03_PMC_ENABLE) | | 246 | nv_wr32(dev, NV03_PMC_ENABLE, nv_rd32(dev, NV03_PMC_ENABLE) | |
360 | NV_PMC_ENABLE_PGRAPH); | 247 | NV_PMC_ENABLE_PGRAPH); |
361 | 248 | ||
362 | nv40_grctx_init(dev); | 249 | if (nouveau_ctxfw) { |
250 | nouveau_grctx_prog_load(dev); | ||
251 | dev_priv->engine.graph.grctx_size = 175 * 1024; | ||
252 | } | ||
253 | |||
254 | if (!dev_priv->engine.graph.ctxprog) { | ||
255 | struct nouveau_grctx ctx = {}; | ||
256 | uint32_t cp[256]; | ||
257 | |||
258 | ctx.dev = dev; | ||
259 | ctx.mode = NOUVEAU_GRCTX_PROG; | ||
260 | ctx.data = cp; | ||
261 | ctx.ctxprog_max = 256; | ||
262 | nv40_grctx_init(&ctx); | ||
263 | dev_priv->engine.graph.grctx_size = ctx.ctxvals_pos * 4; | ||
264 | |||
265 | nv_wr32(dev, NV40_PGRAPH_CTXCTL_UCODE_INDEX, 0); | ||
266 | for (i = 0; i < ctx.ctxprog_len; i++) | ||
267 | nv_wr32(dev, NV40_PGRAPH_CTXCTL_UCODE_DATA, cp[i]); | ||
268 | } | ||
363 | 269 | ||
364 | /* No context present currently */ | 270 | /* No context present currently */ |
365 | nv_wr32(dev, NV40_PGRAPH_CTXCTL_CUR, 0x00000000); | 271 | nv_wr32(dev, NV40_PGRAPH_CTXCTL_CUR, 0x00000000); |
@@ -429,74 +335,9 @@ nv40_graph_init(struct drm_device *dev) | |||
429 | nv_wr32(dev, 0x400b38, 0x2ffff800); | 335 | nv_wr32(dev, 0x400b38, 0x2ffff800); |
430 | nv_wr32(dev, 0x400b3c, 0x00006000); | 336 | nv_wr32(dev, 0x400b3c, 0x00006000); |
431 | 337 | ||
432 | /* copy tile info from PFB */ | 338 | /* Turn all the tiling regions off. */ |
433 | switch (dev_priv->chipset) { | 339 | for (i = 0; i < pfb->num_tiles; i++) |
434 | case 0x40: /* vanilla NV40 */ | 340 | nv40_graph_set_region_tiling(dev, i, 0, 0, 0); |
435 | for (i = 0; i < NV10_PFB_TILE__SIZE; i++) { | ||
436 | tmp = nv_rd32(dev, NV10_PFB_TILE(i)); | ||
437 | nv_wr32(dev, NV40_PGRAPH_TILE0(i), tmp); | ||
438 | nv_wr32(dev, NV40_PGRAPH_TILE1(i), tmp); | ||
439 | tmp = nv_rd32(dev, NV10_PFB_TLIMIT(i)); | ||
440 | nv_wr32(dev, NV40_PGRAPH_TLIMIT0(i), tmp); | ||
441 | nv_wr32(dev, NV40_PGRAPH_TLIMIT1(i), tmp); | ||
442 | tmp = nv_rd32(dev, NV10_PFB_TSIZE(i)); | ||
443 | nv_wr32(dev, NV40_PGRAPH_TSIZE0(i), tmp); | ||
444 | nv_wr32(dev, NV40_PGRAPH_TSIZE1(i), tmp); | ||
445 | tmp = nv_rd32(dev, NV10_PFB_TSTATUS(i)); | ||
446 | nv_wr32(dev, NV40_PGRAPH_TSTATUS0(i), tmp); | ||
447 | nv_wr32(dev, NV40_PGRAPH_TSTATUS1(i), tmp); | ||
448 | } | ||
449 | break; | ||
450 | case 0x44: | ||
451 | case 0x4a: | ||
452 | case 0x4e: /* NV44-based cores don't have 0x406900? */ | ||
453 | for (i = 0; i < NV40_PFB_TILE__SIZE_0; i++) { | ||
454 | tmp = nv_rd32(dev, NV40_PFB_TILE(i)); | ||
455 | nv_wr32(dev, NV40_PGRAPH_TILE0(i), tmp); | ||
456 | tmp = nv_rd32(dev, NV40_PFB_TLIMIT(i)); | ||
457 | nv_wr32(dev, NV40_PGRAPH_TLIMIT0(i), tmp); | ||
458 | tmp = nv_rd32(dev, NV40_PFB_TSIZE(i)); | ||
459 | nv_wr32(dev, NV40_PGRAPH_TSIZE0(i), tmp); | ||
460 | tmp = nv_rd32(dev, NV40_PFB_TSTATUS(i)); | ||
461 | nv_wr32(dev, NV40_PGRAPH_TSTATUS0(i), tmp); | ||
462 | } | ||
463 | break; | ||
464 | case 0x46: | ||
465 | case 0x47: | ||
466 | case 0x49: | ||
467 | case 0x4b: /* G7X-based cores */ | ||
468 | for (i = 0; i < NV40_PFB_TILE__SIZE_1; i++) { | ||
469 | tmp = nv_rd32(dev, NV40_PFB_TILE(i)); | ||
470 | nv_wr32(dev, NV47_PGRAPH_TILE0(i), tmp); | ||
471 | nv_wr32(dev, NV40_PGRAPH_TILE1(i), tmp); | ||
472 | tmp = nv_rd32(dev, NV40_PFB_TLIMIT(i)); | ||
473 | nv_wr32(dev, NV47_PGRAPH_TLIMIT0(i), tmp); | ||
474 | nv_wr32(dev, NV40_PGRAPH_TLIMIT1(i), tmp); | ||
475 | tmp = nv_rd32(dev, NV40_PFB_TSIZE(i)); | ||
476 | nv_wr32(dev, NV47_PGRAPH_TSIZE0(i), tmp); | ||
477 | nv_wr32(dev, NV40_PGRAPH_TSIZE1(i), tmp); | ||
478 | tmp = nv_rd32(dev, NV40_PFB_TSTATUS(i)); | ||
479 | nv_wr32(dev, NV47_PGRAPH_TSTATUS0(i), tmp); | ||
480 | nv_wr32(dev, NV40_PGRAPH_TSTATUS1(i), tmp); | ||
481 | } | ||
482 | break; | ||
483 | default: /* everything else */ | ||
484 | for (i = 0; i < NV40_PFB_TILE__SIZE_0; i++) { | ||
485 | tmp = nv_rd32(dev, NV40_PFB_TILE(i)); | ||
486 | nv_wr32(dev, NV40_PGRAPH_TILE0(i), tmp); | ||
487 | nv_wr32(dev, NV40_PGRAPH_TILE1(i), tmp); | ||
488 | tmp = nv_rd32(dev, NV40_PFB_TLIMIT(i)); | ||
489 | nv_wr32(dev, NV40_PGRAPH_TLIMIT0(i), tmp); | ||
490 | nv_wr32(dev, NV40_PGRAPH_TLIMIT1(i), tmp); | ||
491 | tmp = nv_rd32(dev, NV40_PFB_TSIZE(i)); | ||
492 | nv_wr32(dev, NV40_PGRAPH_TSIZE0(i), tmp); | ||
493 | nv_wr32(dev, NV40_PGRAPH_TSIZE1(i), tmp); | ||
494 | tmp = nv_rd32(dev, NV40_PFB_TSTATUS(i)); | ||
495 | nv_wr32(dev, NV40_PGRAPH_TSTATUS0(i), tmp); | ||
496 | nv_wr32(dev, NV40_PGRAPH_TSTATUS1(i), tmp); | ||
497 | } | ||
498 | break; | ||
499 | } | ||
500 | 341 | ||
501 | /* begin RAM config */ | 342 | /* begin RAM config */ |
502 | vramsz = drm_get_resource_len(dev, 0) - 1; | 343 | vramsz = drm_get_resource_len(dev, 0) - 1; |
@@ -539,6 +380,7 @@ nv40_graph_init(struct drm_device *dev) | |||
539 | 380 | ||
540 | void nv40_graph_takedown(struct drm_device *dev) | 381 | void nv40_graph_takedown(struct drm_device *dev) |
541 | { | 382 | { |
383 | nouveau_grctx_fini(dev); | ||
542 | } | 384 | } |
543 | 385 | ||
544 | struct nouveau_pgraph_object_class nv40_graph_grclass[] = { | 386 | struct nouveau_pgraph_object_class nv40_graph_grclass[] = { |
diff --git a/drivers/gpu/drm/nouveau/nv40_grctx.c b/drivers/gpu/drm/nouveau/nv40_grctx.c new file mode 100644 index 000000000000..11b11c31f543 --- /dev/null +++ b/drivers/gpu/drm/nouveau/nv40_grctx.c | |||
@@ -0,0 +1,678 @@ | |||
1 | /* | ||
2 | * Copyright 2009 Red Hat Inc. | ||
3 | * | ||
4 | * Permission is hereby granted, free of charge, to any person obtaining a | ||
5 | * copy of this software and associated documentation files (the "Software"), | ||
6 | * to deal in the Software without restriction, including without limitation | ||
7 | * the rights to use, copy, modify, merge, publish, distribute, sublicense, | ||
8 | * and/or sell copies of the Software, and to permit persons to whom the | ||
9 | * Software is furnished to do so, subject to the following conditions: | ||
10 | * | ||
11 | * The above copyright notice and this permission notice shall be included in | ||
12 | * all copies or substantial portions of the Software. | ||
13 | * | ||
14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL | ||
17 | * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR | ||
18 | * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, | ||
19 | * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR | ||
20 | * OTHER DEALINGS IN THE SOFTWARE. | ||
21 | * | ||
22 | * Authors: Ben Skeggs | ||
23 | */ | ||
24 | |||
25 | /* NVIDIA context programs handle a number of other conditions which are | ||
26 | * not implemented in our versions. It's not clear why NVIDIA context | ||
27 | * programs have this code, nor whether it's strictly necessary for | ||
28 | * correct operation. We'll implement additional handling if/when we | ||
29 | * discover it's necessary. | ||
30 | * | ||
31 | * - On context save, NVIDIA set 0x400314 bit 0 to 1 if the "3D state" | ||
32 | * flag is set, this gets saved into the context. | ||
33 | * - On context save, the context program for all cards load nsource | ||
34 | * into a flag register and check for ILLEGAL_MTHD. If it's set, | ||
35 | * opcode 0x60000d is called before resuming normal operation. | ||
36 | * - Some context programs check more conditions than the above. NV44 | ||
37 | * checks: ((nsource & 0x0857) || (0x400718 & 0x0100) || (intr & 0x0001)) | ||
38 | * and calls 0x60000d before resuming normal operation. | ||
39 | * - At the very beginning of NVIDIA's context programs, flag 9 is checked | ||
40 | * and if true 0x800001 is called with count=0, pos=0, the flag is cleared | ||
41 | * and then the ctxprog is aborted. It looks like a complicated NOP, | ||
42 | * its purpose is unknown. | ||
43 | * - In the section of code that loads the per-vs state, NVIDIA check | ||
44 | * flag 10. If it's set, they only transfer the small 0x300 byte block | ||
45 | * of state + the state for a single vs as opposed to the state for | ||
46 | * all vs units. It doesn't seem likely that it'll occur in normal | ||
47 | * operation, especially seeing as it appears NVIDIA may have screwed | ||
48 | * up the ctxprogs for some cards and have an invalid instruction | ||
49 | * rather than a cp_lsr(ctx, dwords_for_1_vs_unit) instruction. | ||
50 | * - There's a number of places where context offset 0 (where we place | ||
51 | * the PRAMIN offset of the context) is loaded into either 0x408000, | ||
52 | * 0x408004 or 0x408008. Not sure what's up there either. | ||
53 | * - The ctxprogs for some cards save 0x400a00 again during the cleanup | ||
54 | * path for auto-loadctx. | ||
55 | */ | ||
56 | |||
57 | #define CP_FLAG_CLEAR 0 | ||
58 | #define CP_FLAG_SET 1 | ||
59 | #define CP_FLAG_SWAP_DIRECTION ((0 * 32) + 0) | ||
60 | #define CP_FLAG_SWAP_DIRECTION_LOAD 0 | ||
61 | #define CP_FLAG_SWAP_DIRECTION_SAVE 1 | ||
62 | #define CP_FLAG_USER_SAVE ((0 * 32) + 5) | ||
63 | #define CP_FLAG_USER_SAVE_NOT_PENDING 0 | ||
64 | #define CP_FLAG_USER_SAVE_PENDING 1 | ||
65 | #define CP_FLAG_USER_LOAD ((0 * 32) + 6) | ||
66 | #define CP_FLAG_USER_LOAD_NOT_PENDING 0 | ||
67 | #define CP_FLAG_USER_LOAD_PENDING 1 | ||
68 | #define CP_FLAG_STATUS ((3 * 32) + 0) | ||
69 | #define CP_FLAG_STATUS_IDLE 0 | ||
70 | #define CP_FLAG_STATUS_BUSY 1 | ||
71 | #define CP_FLAG_AUTO_SAVE ((3 * 32) + 4) | ||
72 | #define CP_FLAG_AUTO_SAVE_NOT_PENDING 0 | ||
73 | #define CP_FLAG_AUTO_SAVE_PENDING 1 | ||
74 | #define CP_FLAG_AUTO_LOAD ((3 * 32) + 5) | ||
75 | #define CP_FLAG_AUTO_LOAD_NOT_PENDING 0 | ||
76 | #define CP_FLAG_AUTO_LOAD_PENDING 1 | ||
77 | #define CP_FLAG_UNK54 ((3 * 32) + 6) | ||
78 | #define CP_FLAG_UNK54_CLEAR 0 | ||
79 | #define CP_FLAG_UNK54_SET 1 | ||
80 | #define CP_FLAG_ALWAYS ((3 * 32) + 8) | ||
81 | #define CP_FLAG_ALWAYS_FALSE 0 | ||
82 | #define CP_FLAG_ALWAYS_TRUE 1 | ||
83 | #define CP_FLAG_UNK57 ((3 * 32) + 9) | ||
84 | #define CP_FLAG_UNK57_CLEAR 0 | ||
85 | #define CP_FLAG_UNK57_SET 1 | ||
86 | |||
87 | #define CP_CTX 0x00100000 | ||
88 | #define CP_CTX_COUNT 0x000fc000 | ||
89 | #define CP_CTX_COUNT_SHIFT 14 | ||
90 | #define CP_CTX_REG 0x00003fff | ||
91 | #define CP_LOAD_SR 0x00200000 | ||
92 | #define CP_LOAD_SR_VALUE 0x000fffff | ||
93 | #define CP_BRA 0x00400000 | ||
94 | #define CP_BRA_IP 0x0000ff00 | ||
95 | #define CP_BRA_IP_SHIFT 8 | ||
96 | #define CP_BRA_IF_CLEAR 0x00000080 | ||
97 | #define CP_BRA_FLAG 0x0000007f | ||
98 | #define CP_WAIT 0x00500000 | ||
99 | #define CP_WAIT_SET 0x00000080 | ||
100 | #define CP_WAIT_FLAG 0x0000007f | ||
101 | #define CP_SET 0x00700000 | ||
102 | #define CP_SET_1 0x00000080 | ||
103 | #define CP_SET_FLAG 0x0000007f | ||
104 | #define CP_NEXT_TO_SWAP 0x00600007 | ||
105 | #define CP_NEXT_TO_CURRENT 0x00600009 | ||
106 | #define CP_SET_CONTEXT_POINTER 0x0060000a | ||
107 | #define CP_END 0x0060000e | ||
108 | #define CP_LOAD_MAGIC_UNK01 0x00800001 /* unknown */ | ||
109 | #define CP_LOAD_MAGIC_NV44TCL 0x00800029 /* per-vs state (0x4497) */ | ||
110 | #define CP_LOAD_MAGIC_NV40TCL 0x00800041 /* per-vs state (0x4097) */ | ||
111 | |||
112 | #include "drmP.h" | ||
113 | #include "nouveau_drv.h" | ||
114 | #include "nouveau_grctx.h" | ||
115 | |||
116 | /* TODO: | ||
117 | * - get vs count from 0x1540 | ||
118 | * - document unimplemented bits compared to nvidia | ||
119 | * - nsource handling | ||
120 | * - R0 & 0x0200 handling | ||
121 | * - single-vs handling | ||
122 | * - 400314 bit 0 | ||
123 | */ | ||
124 | |||
125 | static int | ||
126 | nv40_graph_4097(struct drm_device *dev) | ||
127 | { | ||
128 | struct drm_nouveau_private *dev_priv = dev->dev_private; | ||
129 | |||
130 | if ((dev_priv->chipset & 0xf0) == 0x60) | ||
131 | return 0; | ||
132 | |||
133 | return !!(0x0baf & (1 << dev_priv->chipset)); | ||
134 | } | ||
135 | |||
136 | static int | ||
137 | nv40_graph_vs_count(struct drm_device *dev) | ||
138 | { | ||
139 | struct drm_nouveau_private *dev_priv = dev->dev_private; | ||
140 | |||
141 | switch (dev_priv->chipset) { | ||
142 | case 0x47: | ||
143 | case 0x49: | ||
144 | case 0x4b: | ||
145 | return 8; | ||
146 | case 0x40: | ||
147 | return 6; | ||
148 | case 0x41: | ||
149 | case 0x42: | ||
150 | return 5; | ||
151 | case 0x43: | ||
152 | case 0x44: | ||
153 | case 0x46: | ||
154 | case 0x4a: | ||
155 | return 3; | ||
156 | case 0x4c: | ||
157 | case 0x4e: | ||
158 | case 0x67: | ||
159 | default: | ||
160 | return 1; | ||
161 | } | ||
162 | } | ||
163 | |||
164 | |||
165 | enum cp_label { | ||
166 | cp_check_load = 1, | ||
167 | cp_setup_auto_load, | ||
168 | cp_setup_load, | ||
169 | cp_setup_save, | ||
170 | cp_swap_state, | ||
171 | cp_swap_state3d_3_is_save, | ||
172 | cp_prepare_exit, | ||
173 | cp_exit, | ||
174 | }; | ||
175 | |||
176 | static void | ||
177 | nv40_graph_construct_general(struct nouveau_grctx *ctx) | ||
178 | { | ||
179 | struct drm_nouveau_private *dev_priv = ctx->dev->dev_private; | ||
180 | int i; | ||
181 | |||
182 | cp_ctx(ctx, 0x4000a4, 1); | ||
183 | gr_def(ctx, 0x4000a4, 0x00000008); | ||
184 | cp_ctx(ctx, 0x400144, 58); | ||
185 | gr_def(ctx, 0x400144, 0x00000001); | ||
186 | cp_ctx(ctx, 0x400314, 1); | ||
187 | gr_def(ctx, 0x400314, 0x00000000); | ||
188 | cp_ctx(ctx, 0x400400, 10); | ||
189 | cp_ctx(ctx, 0x400480, 10); | ||
190 | cp_ctx(ctx, 0x400500, 19); | ||
191 | gr_def(ctx, 0x400514, 0x00040000); | ||
192 | gr_def(ctx, 0x400524, 0x55555555); | ||
193 | gr_def(ctx, 0x400528, 0x55555555); | ||
194 | gr_def(ctx, 0x40052c, 0x55555555); | ||
195 | gr_def(ctx, 0x400530, 0x55555555); | ||
196 | cp_ctx(ctx, 0x400560, 6); | ||
197 | gr_def(ctx, 0x400568, 0x0000ffff); | ||
198 | gr_def(ctx, 0x40056c, 0x0000ffff); | ||
199 | cp_ctx(ctx, 0x40057c, 5); | ||
200 | cp_ctx(ctx, 0x400710, 3); | ||
201 | gr_def(ctx, 0x400710, 0x20010001); | ||
202 | gr_def(ctx, 0x400714, 0x0f73ef00); | ||
203 | cp_ctx(ctx, 0x400724, 1); | ||
204 | gr_def(ctx, 0x400724, 0x02008821); | ||
205 | cp_ctx(ctx, 0x400770, 3); | ||
206 | if (dev_priv->chipset == 0x40) { | ||
207 | cp_ctx(ctx, 0x400814, 4); | ||
208 | cp_ctx(ctx, 0x400828, 5); | ||
209 | cp_ctx(ctx, 0x400840, 5); | ||
210 | gr_def(ctx, 0x400850, 0x00000040); | ||
211 | cp_ctx(ctx, 0x400858, 4); | ||
212 | gr_def(ctx, 0x400858, 0x00000040); | ||
213 | gr_def(ctx, 0x40085c, 0x00000040); | ||
214 | gr_def(ctx, 0x400864, 0x80000000); | ||
215 | cp_ctx(ctx, 0x40086c, 9); | ||
216 | gr_def(ctx, 0x40086c, 0x80000000); | ||
217 | gr_def(ctx, 0x400870, 0x80000000); | ||
218 | gr_def(ctx, 0x400874, 0x80000000); | ||
219 | gr_def(ctx, 0x400878, 0x80000000); | ||
220 | gr_def(ctx, 0x400888, 0x00000040); | ||
221 | gr_def(ctx, 0x40088c, 0x80000000); | ||
222 | cp_ctx(ctx, 0x4009c0, 8); | ||
223 | gr_def(ctx, 0x4009cc, 0x80000000); | ||
224 | gr_def(ctx, 0x4009dc, 0x80000000); | ||
225 | } else { | ||
226 | cp_ctx(ctx, 0x400840, 20); | ||
227 | if (!nv40_graph_4097(ctx->dev)) { | ||
228 | for (i = 0; i < 8; i++) | ||
229 | gr_def(ctx, 0x400860 + (i * 4), 0x00000001); | ||
230 | } | ||
231 | gr_def(ctx, 0x400880, 0x00000040); | ||
232 | gr_def(ctx, 0x400884, 0x00000040); | ||
233 | gr_def(ctx, 0x400888, 0x00000040); | ||
234 | cp_ctx(ctx, 0x400894, 11); | ||
235 | gr_def(ctx, 0x400894, 0x00000040); | ||
236 | if (nv40_graph_4097(ctx->dev)) { | ||
237 | for (i = 0; i < 8; i++) | ||
238 | gr_def(ctx, 0x4008a0 + (i * 4), 0x80000000); | ||
239 | } | ||
240 | cp_ctx(ctx, 0x4008e0, 2); | ||
241 | cp_ctx(ctx, 0x4008f8, 2); | ||
242 | if (dev_priv->chipset == 0x4c || | ||
243 | (dev_priv->chipset & 0xf0) == 0x60) | ||
244 | cp_ctx(ctx, 0x4009f8, 1); | ||
245 | } | ||
246 | cp_ctx(ctx, 0x400a00, 73); | ||
247 | gr_def(ctx, 0x400b0c, 0x0b0b0b0c); | ||
248 | cp_ctx(ctx, 0x401000, 4); | ||
249 | cp_ctx(ctx, 0x405004, 1); | ||
250 | switch (dev_priv->chipset) { | ||
251 | case 0x47: | ||
252 | case 0x49: | ||
253 | case 0x4b: | ||
254 | cp_ctx(ctx, 0x403448, 1); | ||
255 | gr_def(ctx, 0x403448, 0x00001010); | ||
256 | break; | ||
257 | default: | ||
258 | cp_ctx(ctx, 0x403440, 1); | ||
259 | switch (dev_priv->chipset) { | ||
260 | case 0x40: | ||
261 | gr_def(ctx, 0x403440, 0x00000010); | ||
262 | break; | ||
263 | case 0x44: | ||
264 | case 0x46: | ||
265 | case 0x4a: | ||
266 | gr_def(ctx, 0x403440, 0x00003010); | ||
267 | break; | ||
268 | case 0x41: | ||
269 | case 0x42: | ||
270 | case 0x43: | ||
271 | case 0x4c: | ||
272 | case 0x4e: | ||
273 | case 0x67: | ||
274 | default: | ||
275 | gr_def(ctx, 0x403440, 0x00001010); | ||
276 | break; | ||
277 | } | ||
278 | break; | ||
279 | } | ||
280 | } | ||
281 | |||
282 | static void | ||
283 | nv40_graph_construct_state3d(struct nouveau_grctx *ctx) | ||
284 | { | ||
285 | struct drm_nouveau_private *dev_priv = ctx->dev->dev_private; | ||
286 | int i; | ||
287 | |||
288 | if (dev_priv->chipset == 0x40) { | ||
289 | cp_ctx(ctx, 0x401880, 51); | ||
290 | gr_def(ctx, 0x401940, 0x00000100); | ||
291 | } else | ||
292 | if (dev_priv->chipset == 0x46 || dev_priv->chipset == 0x47 || | ||
293 | dev_priv->chipset == 0x49 || dev_priv->chipset == 0x4b) { | ||
294 | cp_ctx(ctx, 0x401880, 32); | ||
295 | for (i = 0; i < 16; i++) | ||
296 | gr_def(ctx, 0x401880 + (i * 4), 0x00000111); | ||
297 | if (dev_priv->chipset == 0x46) | ||
298 | cp_ctx(ctx, 0x401900, 16); | ||
299 | cp_ctx(ctx, 0x401940, 3); | ||
300 | } | ||
301 | cp_ctx(ctx, 0x40194c, 18); | ||
302 | gr_def(ctx, 0x401954, 0x00000111); | ||
303 | gr_def(ctx, 0x401958, 0x00080060); | ||
304 | gr_def(ctx, 0x401974, 0x00000080); | ||
305 | gr_def(ctx, 0x401978, 0xffff0000); | ||
306 | gr_def(ctx, 0x40197c, 0x00000001); | ||
307 | gr_def(ctx, 0x401990, 0x46400000); | ||
308 | if (dev_priv->chipset == 0x40) { | ||
309 | cp_ctx(ctx, 0x4019a0, 2); | ||
310 | cp_ctx(ctx, 0x4019ac, 5); | ||
311 | } else { | ||
312 | cp_ctx(ctx, 0x4019a0, 1); | ||
313 | cp_ctx(ctx, 0x4019b4, 3); | ||
314 | } | ||
315 | gr_def(ctx, 0x4019bc, 0xffff0000); | ||
316 | switch (dev_priv->chipset) { | ||
317 | case 0x46: | ||
318 | case 0x47: | ||
319 | case 0x49: | ||
320 | case 0x4b: | ||
321 | cp_ctx(ctx, 0x4019c0, 18); | ||
322 | for (i = 0; i < 16; i++) | ||
323 | gr_def(ctx, 0x4019c0 + (i * 4), 0x88888888); | ||
324 | break; | ||
325 | } | ||
326 | cp_ctx(ctx, 0x401a08, 8); | ||
327 | gr_def(ctx, 0x401a10, 0x0fff0000); | ||
328 | gr_def(ctx, 0x401a14, 0x0fff0000); | ||
329 | gr_def(ctx, 0x401a1c, 0x00011100); | ||
330 | cp_ctx(ctx, 0x401a2c, 4); | ||
331 | cp_ctx(ctx, 0x401a44, 26); | ||
332 | for (i = 0; i < 16; i++) | ||
333 | gr_def(ctx, 0x401a44 + (i * 4), 0x07ff0000); | ||
334 | gr_def(ctx, 0x401a8c, 0x4b7fffff); | ||
335 | if (dev_priv->chipset == 0x40) { | ||
336 | cp_ctx(ctx, 0x401ab8, 3); | ||
337 | } else { | ||
338 | cp_ctx(ctx, 0x401ab8, 1); | ||
339 | cp_ctx(ctx, 0x401ac0, 1); | ||
340 | } | ||
341 | cp_ctx(ctx, 0x401ad0, 8); | ||
342 | gr_def(ctx, 0x401ad0, 0x30201000); | ||
343 | gr_def(ctx, 0x401ad4, 0x70605040); | ||
344 | gr_def(ctx, 0x401ad8, 0xb8a89888); | ||
345 | gr_def(ctx, 0x401adc, 0xf8e8d8c8); | ||
346 | cp_ctx(ctx, 0x401b10, dev_priv->chipset == 0x40 ? 2 : 1); | ||
347 | gr_def(ctx, 0x401b10, 0x40100000); | ||
348 | cp_ctx(ctx, 0x401b18, dev_priv->chipset == 0x40 ? 6 : 5); | ||
349 | gr_def(ctx, 0x401b28, dev_priv->chipset == 0x40 ? | ||
350 | 0x00000004 : 0x00000000); | ||
351 | cp_ctx(ctx, 0x401b30, 25); | ||
352 | gr_def(ctx, 0x401b34, 0x0000ffff); | ||
353 | gr_def(ctx, 0x401b68, 0x435185d6); | ||
354 | gr_def(ctx, 0x401b6c, 0x2155b699); | ||
355 | gr_def(ctx, 0x401b70, 0xfedcba98); | ||
356 | gr_def(ctx, 0x401b74, 0x00000098); | ||
357 | gr_def(ctx, 0x401b84, 0xffffffff); | ||
358 | gr_def(ctx, 0x401b88, 0x00ff7000); | ||
359 | gr_def(ctx, 0x401b8c, 0x0000ffff); | ||
360 | if (dev_priv->chipset != 0x44 && dev_priv->chipset != 0x4a && | ||
361 | dev_priv->chipset != 0x4e) | ||
362 | cp_ctx(ctx, 0x401b94, 1); | ||
363 | cp_ctx(ctx, 0x401b98, 8); | ||
364 | gr_def(ctx, 0x401b9c, 0x00ff0000); | ||
365 | cp_ctx(ctx, 0x401bc0, 9); | ||
366 | gr_def(ctx, 0x401be0, 0x00ffff00); | ||
367 | cp_ctx(ctx, 0x401c00, 192); | ||
368 | for (i = 0; i < 16; i++) { /* fragment texture units */ | ||
369 | gr_def(ctx, 0x401c40 + (i * 4), 0x00018488); | ||
370 | gr_def(ctx, 0x401c80 + (i * 4), 0x00028202); | ||
371 | gr_def(ctx, 0x401d00 + (i * 4), 0x0000aae4); | ||
372 | gr_def(ctx, 0x401d40 + (i * 4), 0x01012000); | ||
373 | gr_def(ctx, 0x401d80 + (i * 4), 0x00080008); | ||
374 | gr_def(ctx, 0x401e00 + (i * 4), 0x00100008); | ||
375 | } | ||
376 | for (i = 0; i < 4; i++) { /* vertex texture units */ | ||
377 | gr_def(ctx, 0x401e90 + (i * 4), 0x0001bc80); | ||
378 | gr_def(ctx, 0x401ea0 + (i * 4), 0x00000202); | ||
379 | gr_def(ctx, 0x401ec0 + (i * 4), 0x00000008); | ||
380 | gr_def(ctx, 0x401ee0 + (i * 4), 0x00080008); | ||
381 | } | ||
382 | cp_ctx(ctx, 0x400f5c, 3); | ||
383 | gr_def(ctx, 0x400f5c, 0x00000002); | ||
384 | cp_ctx(ctx, 0x400f84, 1); | ||
385 | } | ||
386 | |||
387 | static void | ||
388 | nv40_graph_construct_state3d_2(struct nouveau_grctx *ctx) | ||
389 | { | ||
390 | struct drm_nouveau_private *dev_priv = ctx->dev->dev_private; | ||
391 | int i; | ||
392 | |||
393 | cp_ctx(ctx, 0x402000, 1); | ||
394 | cp_ctx(ctx, 0x402404, dev_priv->chipset == 0x40 ? 1 : 2); | ||
395 | switch (dev_priv->chipset) { | ||
396 | case 0x40: | ||
397 | gr_def(ctx, 0x402404, 0x00000001); | ||
398 | break; | ||
399 | case 0x4c: | ||
400 | case 0x4e: | ||
401 | case 0x67: | ||
402 | gr_def(ctx, 0x402404, 0x00000020); | ||
403 | break; | ||
404 | case 0x46: | ||
405 | case 0x49: | ||
406 | case 0x4b: | ||
407 | gr_def(ctx, 0x402404, 0x00000421); | ||
408 | break; | ||
409 | default: | ||
410 | gr_def(ctx, 0x402404, 0x00000021); | ||
411 | } | ||
412 | if (dev_priv->chipset != 0x40) | ||
413 | gr_def(ctx, 0x402408, 0x030c30c3); | ||
414 | switch (dev_priv->chipset) { | ||
415 | case 0x44: | ||
416 | case 0x46: | ||
417 | case 0x4a: | ||
418 | case 0x4c: | ||
419 | case 0x4e: | ||
420 | case 0x67: | ||
421 | cp_ctx(ctx, 0x402440, 1); | ||
422 | gr_def(ctx, 0x402440, 0x00011001); | ||
423 | break; | ||
424 | default: | ||
425 | break; | ||
426 | } | ||
427 | cp_ctx(ctx, 0x402480, dev_priv->chipset == 0x40 ? 8 : 9); | ||
428 | gr_def(ctx, 0x402488, 0x3e020200); | ||
429 | gr_def(ctx, 0x40248c, 0x00ffffff); | ||
430 | switch (dev_priv->chipset) { | ||
431 | case 0x40: | ||
432 | gr_def(ctx, 0x402490, 0x60103f00); | ||
433 | break; | ||
434 | case 0x47: | ||
435 | gr_def(ctx, 0x402490, 0x40103f00); | ||
436 | break; | ||
437 | case 0x41: | ||
438 | case 0x42: | ||
439 | case 0x49: | ||
440 | case 0x4b: | ||
441 | gr_def(ctx, 0x402490, 0x20103f00); | ||
442 | break; | ||
443 | default: | ||
444 | gr_def(ctx, 0x402490, 0x0c103f00); | ||
445 | break; | ||
446 | } | ||
447 | gr_def(ctx, 0x40249c, dev_priv->chipset <= 0x43 ? | ||
448 | 0x00020000 : 0x00040000); | ||
449 | cp_ctx(ctx, 0x402500, 31); | ||
450 | gr_def(ctx, 0x402530, 0x00008100); | ||
451 | if (dev_priv->chipset == 0x40) | ||
452 | cp_ctx(ctx, 0x40257c, 6); | ||
453 | cp_ctx(ctx, 0x402594, 16); | ||
454 | cp_ctx(ctx, 0x402800, 17); | ||
455 | gr_def(ctx, 0x402800, 0x00000001); | ||
456 | switch (dev_priv->chipset) { | ||
457 | case 0x47: | ||
458 | case 0x49: | ||
459 | case 0x4b: | ||
460 | cp_ctx(ctx, 0x402864, 1); | ||
461 | gr_def(ctx, 0x402864, 0x00001001); | ||
462 | cp_ctx(ctx, 0x402870, 3); | ||
463 | gr_def(ctx, 0x402878, 0x00000003); | ||
464 | if (dev_priv->chipset != 0x47) { /* belong at end!! */ | ||
465 | cp_ctx(ctx, 0x402900, 1); | ||
466 | cp_ctx(ctx, 0x402940, 1); | ||
467 | cp_ctx(ctx, 0x402980, 1); | ||
468 | cp_ctx(ctx, 0x4029c0, 1); | ||
469 | cp_ctx(ctx, 0x402a00, 1); | ||
470 | cp_ctx(ctx, 0x402a40, 1); | ||
471 | cp_ctx(ctx, 0x402a80, 1); | ||
472 | cp_ctx(ctx, 0x402ac0, 1); | ||
473 | } | ||
474 | break; | ||
475 | case 0x40: | ||
476 | cp_ctx(ctx, 0x402844, 1); | ||
477 | gr_def(ctx, 0x402844, 0x00000001); | ||
478 | cp_ctx(ctx, 0x402850, 1); | ||
479 | break; | ||
480 | default: | ||
481 | cp_ctx(ctx, 0x402844, 1); | ||
482 | gr_def(ctx, 0x402844, 0x00001001); | ||
483 | cp_ctx(ctx, 0x402850, 2); | ||
484 | gr_def(ctx, 0x402854, 0x00000003); | ||
485 | break; | ||
486 | } | ||
487 | |||
488 | cp_ctx(ctx, 0x402c00, 4); | ||
489 | gr_def(ctx, 0x402c00, dev_priv->chipset == 0x40 ? | ||
490 | 0x80800001 : 0x00888001); | ||
491 | switch (dev_priv->chipset) { | ||
492 | case 0x47: | ||
493 | case 0x49: | ||
494 | case 0x4b: | ||
495 | cp_ctx(ctx, 0x402c20, 40); | ||
496 | for (i = 0; i < 32; i++) | ||
497 | gr_def(ctx, 0x402c40 + (i * 4), 0xffffffff); | ||
498 | cp_ctx(ctx, 0x4030b8, 13); | ||
499 | gr_def(ctx, 0x4030dc, 0x00000005); | ||
500 | gr_def(ctx, 0x4030e8, 0x0000ffff); | ||
501 | break; | ||
502 | default: | ||
503 | cp_ctx(ctx, 0x402c10, 4); | ||
504 | if (dev_priv->chipset == 0x40) | ||
505 | cp_ctx(ctx, 0x402c20, 36); | ||
506 | else | ||
507 | if (dev_priv->chipset <= 0x42) | ||
508 | cp_ctx(ctx, 0x402c20, 24); | ||
509 | else | ||
510 | if (dev_priv->chipset <= 0x4a) | ||
511 | cp_ctx(ctx, 0x402c20, 16); | ||
512 | else | ||
513 | cp_ctx(ctx, 0x402c20, 8); | ||
514 | cp_ctx(ctx, 0x402cb0, dev_priv->chipset == 0x40 ? 12 : 13); | ||
515 | gr_def(ctx, 0x402cd4, 0x00000005); | ||
516 | if (dev_priv->chipset != 0x40) | ||
517 | gr_def(ctx, 0x402ce0, 0x0000ffff); | ||
518 | break; | ||
519 | } | ||
520 | |||
521 | cp_ctx(ctx, 0x403400, dev_priv->chipset == 0x40 ? 4 : 3); | ||
522 | cp_ctx(ctx, 0x403410, dev_priv->chipset == 0x40 ? 4 : 3); | ||
523 | cp_ctx(ctx, 0x403420, nv40_graph_vs_count(ctx->dev)); | ||
524 | for (i = 0; i < nv40_graph_vs_count(ctx->dev); i++) | ||
525 | gr_def(ctx, 0x403420 + (i * 4), 0x00005555); | ||
526 | |||
527 | if (dev_priv->chipset != 0x40) { | ||
528 | cp_ctx(ctx, 0x403600, 1); | ||
529 | gr_def(ctx, 0x403600, 0x00000001); | ||
530 | } | ||
531 | cp_ctx(ctx, 0x403800, 1); | ||
532 | |||
533 | cp_ctx(ctx, 0x403c18, 1); | ||
534 | gr_def(ctx, 0x403c18, 0x00000001); | ||
535 | switch (dev_priv->chipset) { | ||
536 | case 0x46: | ||
537 | case 0x47: | ||
538 | case 0x49: | ||
539 | case 0x4b: | ||
540 | cp_ctx(ctx, 0x405018, 1); | ||
541 | gr_def(ctx, 0x405018, 0x08e00001); | ||
542 | cp_ctx(ctx, 0x405c24, 1); | ||
543 | gr_def(ctx, 0x405c24, 0x000e3000); | ||
544 | break; | ||
545 | } | ||
546 | if (dev_priv->chipset != 0x4e) | ||
547 | cp_ctx(ctx, 0x405800, 11); | ||
548 | cp_ctx(ctx, 0x407000, 1); | ||
549 | } | ||
550 | |||
551 | static void | ||
552 | nv40_graph_construct_state3d_3(struct nouveau_grctx *ctx) | ||
553 | { | ||
554 | int len = nv40_graph_4097(ctx->dev) ? 0x0684 : 0x0084; | ||
555 | |||
556 | cp_out (ctx, 0x300000); | ||
557 | cp_lsr (ctx, len - 4); | ||
558 | cp_bra (ctx, SWAP_DIRECTION, SAVE, cp_swap_state3d_3_is_save); | ||
559 | cp_lsr (ctx, len); | ||
560 | cp_name(ctx, cp_swap_state3d_3_is_save); | ||
561 | cp_out (ctx, 0x800001); | ||
562 | |||
563 | ctx->ctxvals_pos += len; | ||
564 | } | ||
565 | |||
566 | static void | ||
567 | nv40_graph_construct_shader(struct nouveau_grctx *ctx) | ||
568 | { | ||
569 | struct drm_device *dev = ctx->dev; | ||
570 | struct drm_nouveau_private *dev_priv = dev->dev_private; | ||
571 | struct nouveau_gpuobj *obj = ctx->data; | ||
572 | int vs, vs_nr, vs_len, vs_nr_b0, vs_nr_b1, b0_offset, b1_offset; | ||
573 | int offset, i; | ||
574 | |||
575 | vs_nr = nv40_graph_vs_count(ctx->dev); | ||
576 | vs_nr_b0 = 363; | ||
577 | vs_nr_b1 = dev_priv->chipset == 0x40 ? 128 : 64; | ||
578 | if (dev_priv->chipset == 0x40) { | ||
579 | b0_offset = 0x2200/4; /* 33a0 */ | ||
580 | b1_offset = 0x55a0/4; /* 1500 */ | ||
581 | vs_len = 0x6aa0/4; | ||
582 | } else | ||
583 | if (dev_priv->chipset == 0x41 || dev_priv->chipset == 0x42) { | ||
584 | b0_offset = 0x2200/4; /* 2200 */ | ||
585 | b1_offset = 0x4400/4; /* 0b00 */ | ||
586 | vs_len = 0x4f00/4; | ||
587 | } else { | ||
588 | b0_offset = 0x1d40/4; /* 2200 */ | ||
589 | b1_offset = 0x3f40/4; /* 0b00 : 0a40 */ | ||
590 | vs_len = nv40_graph_4097(dev) ? 0x4a40/4 : 0x4980/4; | ||
591 | } | ||
592 | |||
593 | cp_lsr(ctx, vs_len * vs_nr + 0x300/4); | ||
594 | cp_out(ctx, nv40_graph_4097(dev) ? 0x800041 : 0x800029); | ||
595 | |||
596 | offset = ctx->ctxvals_pos; | ||
597 | ctx->ctxvals_pos += (0x0300/4 + (vs_nr * vs_len)); | ||
598 | |||
599 | if (ctx->mode != NOUVEAU_GRCTX_VALS) | ||
600 | return; | ||
601 | |||
602 | offset += 0x0280/4; | ||
603 | for (i = 0; i < 16; i++, offset += 2) | ||
604 | nv_wo32(dev, obj, offset, 0x3f800000); | ||
605 | |||
606 | for (vs = 0; vs < vs_nr; vs++, offset += vs_len) { | ||
607 | for (i = 0; i < vs_nr_b0 * 6; i += 6) | ||
608 | nv_wo32(dev, obj, offset + b0_offset + i, 0x00000001); | ||
609 | for (i = 0; i < vs_nr_b1 * 4; i += 4) | ||
610 | nv_wo32(dev, obj, offset + b1_offset + i, 0x3f800000); | ||
611 | } | ||
612 | } | ||
613 | |||
614 | void | ||
615 | nv40_grctx_init(struct nouveau_grctx *ctx) | ||
616 | { | ||
617 | /* decide whether we're loading/unloading the context */ | ||
618 | cp_bra (ctx, AUTO_SAVE, PENDING, cp_setup_save); | ||
619 | cp_bra (ctx, USER_SAVE, PENDING, cp_setup_save); | ||
620 | |||
621 | cp_name(ctx, cp_check_load); | ||
622 | cp_bra (ctx, AUTO_LOAD, PENDING, cp_setup_auto_load); | ||
623 | cp_bra (ctx, USER_LOAD, PENDING, cp_setup_load); | ||
624 | cp_bra (ctx, ALWAYS, TRUE, cp_exit); | ||
625 | |||
626 | /* setup for context load */ | ||
627 | cp_name(ctx, cp_setup_auto_load); | ||
628 | cp_wait(ctx, STATUS, IDLE); | ||
629 | cp_out (ctx, CP_NEXT_TO_SWAP); | ||
630 | cp_name(ctx, cp_setup_load); | ||
631 | cp_wait(ctx, STATUS, IDLE); | ||
632 | cp_set (ctx, SWAP_DIRECTION, LOAD); | ||
633 | cp_out (ctx, 0x00910880); /* ?? */ | ||
634 | cp_out (ctx, 0x00901ffe); /* ?? */ | ||
635 | cp_out (ctx, 0x01940000); /* ?? */ | ||
636 | cp_lsr (ctx, 0x20); | ||
637 | cp_out (ctx, 0x0060000b); /* ?? */ | ||
638 | cp_wait(ctx, UNK57, CLEAR); | ||
639 | cp_out (ctx, 0x0060000c); /* ?? */ | ||
640 | cp_bra (ctx, ALWAYS, TRUE, cp_swap_state); | ||
641 | |||
642 | /* setup for context save */ | ||
643 | cp_name(ctx, cp_setup_save); | ||
644 | cp_set (ctx, SWAP_DIRECTION, SAVE); | ||
645 | |||
646 | /* general PGRAPH state */ | ||
647 | cp_name(ctx, cp_swap_state); | ||
648 | cp_pos (ctx, 0x00020/4); | ||
649 | nv40_graph_construct_general(ctx); | ||
650 | cp_wait(ctx, STATUS, IDLE); | ||
651 | |||
652 | /* 3D state, block 1 */ | ||
653 | cp_bra (ctx, UNK54, CLEAR, cp_prepare_exit); | ||
654 | nv40_graph_construct_state3d(ctx); | ||
655 | cp_wait(ctx, STATUS, IDLE); | ||
656 | |||
657 | /* 3D state, block 2 */ | ||
658 | nv40_graph_construct_state3d_2(ctx); | ||
659 | |||
660 | /* Some other block of "random" state */ | ||
661 | nv40_graph_construct_state3d_3(ctx); | ||
662 | |||
663 | /* Per-vertex shader state */ | ||
664 | cp_pos (ctx, ctx->ctxvals_pos); | ||
665 | nv40_graph_construct_shader(ctx); | ||
666 | |||
667 | /* pre-exit state updates */ | ||
668 | cp_name(ctx, cp_prepare_exit); | ||
669 | cp_bra (ctx, SWAP_DIRECTION, SAVE, cp_check_load); | ||
670 | cp_bra (ctx, USER_SAVE, PENDING, cp_exit); | ||
671 | cp_out (ctx, CP_NEXT_TO_CURRENT); | ||
672 | |||
673 | cp_name(ctx, cp_exit); | ||
674 | cp_set (ctx, USER_SAVE, NOT_PENDING); | ||
675 | cp_set (ctx, USER_LOAD, NOT_PENDING); | ||
676 | cp_out (ctx, CP_END); | ||
677 | } | ||
678 | |||
diff --git a/drivers/gpu/drm/nouveau/nv50_crtc.c b/drivers/gpu/drm/nouveau/nv50_crtc.c index f8e28a1e44e7..118d3285fd8c 100644 --- a/drivers/gpu/drm/nouveau/nv50_crtc.c +++ b/drivers/gpu/drm/nouveau/nv50_crtc.c | |||
@@ -45,7 +45,7 @@ nv50_crtc_lut_load(struct drm_crtc *crtc) | |||
45 | void __iomem *lut = nvbo_kmap_obj_iovirtual(nv_crtc->lut.nvbo); | 45 | void __iomem *lut = nvbo_kmap_obj_iovirtual(nv_crtc->lut.nvbo); |
46 | int i; | 46 | int i; |
47 | 47 | ||
48 | NV_DEBUG(crtc->dev, "\n"); | 48 | NV_DEBUG_KMS(crtc->dev, "\n"); |
49 | 49 | ||
50 | for (i = 0; i < 256; i++) { | 50 | for (i = 0; i < 256; i++) { |
51 | writew(nv_crtc->lut.r[i] >> 2, lut + 8*i + 0); | 51 | writew(nv_crtc->lut.r[i] >> 2, lut + 8*i + 0); |
@@ -68,8 +68,8 @@ nv50_crtc_blank(struct nouveau_crtc *nv_crtc, bool blanked) | |||
68 | struct nouveau_channel *evo = dev_priv->evo; | 68 | struct nouveau_channel *evo = dev_priv->evo; |
69 | int index = nv_crtc->index, ret; | 69 | int index = nv_crtc->index, ret; |
70 | 70 | ||
71 | NV_DEBUG(dev, "index %d\n", nv_crtc->index); | 71 | NV_DEBUG_KMS(dev, "index %d\n", nv_crtc->index); |
72 | NV_DEBUG(dev, "%s\n", blanked ? "blanked" : "unblanked"); | 72 | NV_DEBUG_KMS(dev, "%s\n", blanked ? "blanked" : "unblanked"); |
73 | 73 | ||
74 | if (blanked) { | 74 | if (blanked) { |
75 | nv_crtc->cursor.hide(nv_crtc, false); | 75 | nv_crtc->cursor.hide(nv_crtc, false); |
@@ -139,7 +139,7 @@ nv50_crtc_set_dither(struct nouveau_crtc *nv_crtc, bool on, bool update) | |||
139 | struct nouveau_channel *evo = dev_priv->evo; | 139 | struct nouveau_channel *evo = dev_priv->evo; |
140 | int ret; | 140 | int ret; |
141 | 141 | ||
142 | NV_DEBUG(dev, "\n"); | 142 | NV_DEBUG_KMS(dev, "\n"); |
143 | 143 | ||
144 | ret = RING_SPACE(evo, 2 + (update ? 2 : 0)); | 144 | ret = RING_SPACE(evo, 2 + (update ? 2 : 0)); |
145 | if (ret) { | 145 | if (ret) { |
@@ -193,7 +193,7 @@ nv50_crtc_set_scale(struct nouveau_crtc *nv_crtc, int scaling_mode, bool update) | |||
193 | uint32_t outX, outY, horiz, vert; | 193 | uint32_t outX, outY, horiz, vert; |
194 | int ret; | 194 | int ret; |
195 | 195 | ||
196 | NV_DEBUG(dev, "\n"); | 196 | NV_DEBUG_KMS(dev, "\n"); |
197 | 197 | ||
198 | switch (scaling_mode) { | 198 | switch (scaling_mode) { |
199 | case DRM_MODE_SCALE_NONE: | 199 | case DRM_MODE_SCALE_NONE: |
@@ -301,7 +301,7 @@ nv50_crtc_destroy(struct drm_crtc *crtc) | |||
301 | struct drm_device *dev = crtc->dev; | 301 | struct drm_device *dev = crtc->dev; |
302 | struct nouveau_crtc *nv_crtc = nouveau_crtc(crtc); | 302 | struct nouveau_crtc *nv_crtc = nouveau_crtc(crtc); |
303 | 303 | ||
304 | NV_DEBUG(dev, "\n"); | 304 | NV_DEBUG_KMS(dev, "\n"); |
305 | 305 | ||
306 | if (!crtc) | 306 | if (!crtc) |
307 | return; | 307 | return; |
@@ -433,7 +433,7 @@ nv50_crtc_prepare(struct drm_crtc *crtc) | |||
433 | struct drm_device *dev = crtc->dev; | 433 | struct drm_device *dev = crtc->dev; |
434 | struct drm_encoder *encoder; | 434 | struct drm_encoder *encoder; |
435 | 435 | ||
436 | NV_DEBUG(dev, "index %d\n", nv_crtc->index); | 436 | NV_DEBUG_KMS(dev, "index %d\n", nv_crtc->index); |
437 | 437 | ||
438 | /* Disconnect all unused encoders. */ | 438 | /* Disconnect all unused encoders. */ |
439 | list_for_each_entry(encoder, &dev->mode_config.encoder_list, head) { | 439 | list_for_each_entry(encoder, &dev->mode_config.encoder_list, head) { |
@@ -458,7 +458,7 @@ nv50_crtc_commit(struct drm_crtc *crtc) | |||
458 | struct nouveau_crtc *nv_crtc = nouveau_crtc(crtc); | 458 | struct nouveau_crtc *nv_crtc = nouveau_crtc(crtc); |
459 | int ret; | 459 | int ret; |
460 | 460 | ||
461 | NV_DEBUG(dev, "index %d\n", nv_crtc->index); | 461 | NV_DEBUG_KMS(dev, "index %d\n", nv_crtc->index); |
462 | 462 | ||
463 | nv50_crtc_blank(nv_crtc, false); | 463 | nv50_crtc_blank(nv_crtc, false); |
464 | 464 | ||
@@ -497,7 +497,7 @@ nv50_crtc_do_mode_set_base(struct drm_crtc *crtc, int x, int y, | |||
497 | struct nouveau_framebuffer *fb = nouveau_framebuffer(drm_fb); | 497 | struct nouveau_framebuffer *fb = nouveau_framebuffer(drm_fb); |
498 | int ret, format; | 498 | int ret, format; |
499 | 499 | ||
500 | NV_DEBUG(dev, "index %d\n", nv_crtc->index); | 500 | NV_DEBUG_KMS(dev, "index %d\n", nv_crtc->index); |
501 | 501 | ||
502 | switch (drm_fb->depth) { | 502 | switch (drm_fb->depth) { |
503 | case 8: | 503 | case 8: |
@@ -612,7 +612,7 @@ nv50_crtc_mode_set(struct drm_crtc *crtc, struct drm_display_mode *mode, | |||
612 | 612 | ||
613 | *nv_crtc->mode = *adjusted_mode; | 613 | *nv_crtc->mode = *adjusted_mode; |
614 | 614 | ||
615 | NV_DEBUG(dev, "index %d\n", nv_crtc->index); | 615 | NV_DEBUG_KMS(dev, "index %d\n", nv_crtc->index); |
616 | 616 | ||
617 | hsync_dur = adjusted_mode->hsync_end - adjusted_mode->hsync_start; | 617 | hsync_dur = adjusted_mode->hsync_end - adjusted_mode->hsync_start; |
618 | vsync_dur = adjusted_mode->vsync_end - adjusted_mode->vsync_start; | 618 | vsync_dur = adjusted_mode->vsync_end - adjusted_mode->vsync_start; |
@@ -706,7 +706,7 @@ nv50_crtc_create(struct drm_device *dev, int index) | |||
706 | struct nouveau_crtc *nv_crtc = NULL; | 706 | struct nouveau_crtc *nv_crtc = NULL; |
707 | int ret, i; | 707 | int ret, i; |
708 | 708 | ||
709 | NV_DEBUG(dev, "\n"); | 709 | NV_DEBUG_KMS(dev, "\n"); |
710 | 710 | ||
711 | nv_crtc = kzalloc(sizeof(*nv_crtc), GFP_KERNEL); | 711 | nv_crtc = kzalloc(sizeof(*nv_crtc), GFP_KERNEL); |
712 | if (!nv_crtc) | 712 | if (!nv_crtc) |
diff --git a/drivers/gpu/drm/nouveau/nv50_cursor.c b/drivers/gpu/drm/nouveau/nv50_cursor.c index e2e79a8f220d..753e723adb3a 100644 --- a/drivers/gpu/drm/nouveau/nv50_cursor.c +++ b/drivers/gpu/drm/nouveau/nv50_cursor.c | |||
@@ -41,7 +41,7 @@ nv50_cursor_show(struct nouveau_crtc *nv_crtc, bool update) | |||
41 | struct drm_device *dev = nv_crtc->base.dev; | 41 | struct drm_device *dev = nv_crtc->base.dev; |
42 | int ret; | 42 | int ret; |
43 | 43 | ||
44 | NV_DEBUG(dev, "\n"); | 44 | NV_DEBUG_KMS(dev, "\n"); |
45 | 45 | ||
46 | if (update && nv_crtc->cursor.visible) | 46 | if (update && nv_crtc->cursor.visible) |
47 | return; | 47 | return; |
@@ -76,7 +76,7 @@ nv50_cursor_hide(struct nouveau_crtc *nv_crtc, bool update) | |||
76 | struct drm_device *dev = nv_crtc->base.dev; | 76 | struct drm_device *dev = nv_crtc->base.dev; |
77 | int ret; | 77 | int ret; |
78 | 78 | ||
79 | NV_DEBUG(dev, "\n"); | 79 | NV_DEBUG_KMS(dev, "\n"); |
80 | 80 | ||
81 | if (update && !nv_crtc->cursor.visible) | 81 | if (update && !nv_crtc->cursor.visible) |
82 | return; | 82 | return; |
@@ -116,7 +116,7 @@ nv50_cursor_set_pos(struct nouveau_crtc *nv_crtc, int x, int y) | |||
116 | static void | 116 | static void |
117 | nv50_cursor_set_offset(struct nouveau_crtc *nv_crtc, uint32_t offset) | 117 | nv50_cursor_set_offset(struct nouveau_crtc *nv_crtc, uint32_t offset) |
118 | { | 118 | { |
119 | NV_DEBUG(nv_crtc->base.dev, "\n"); | 119 | NV_DEBUG_KMS(nv_crtc->base.dev, "\n"); |
120 | if (offset == nv_crtc->cursor.offset) | 120 | if (offset == nv_crtc->cursor.offset) |
121 | return; | 121 | return; |
122 | 122 | ||
@@ -143,7 +143,7 @@ nv50_cursor_fini(struct nouveau_crtc *nv_crtc) | |||
143 | struct drm_device *dev = nv_crtc->base.dev; | 143 | struct drm_device *dev = nv_crtc->base.dev; |
144 | int idx = nv_crtc->index; | 144 | int idx = nv_crtc->index; |
145 | 145 | ||
146 | NV_DEBUG(dev, "\n"); | 146 | NV_DEBUG_KMS(dev, "\n"); |
147 | 147 | ||
148 | nv_wr32(dev, NV50_PDISPLAY_CURSOR_CURSOR_CTRL2(idx), 0); | 148 | nv_wr32(dev, NV50_PDISPLAY_CURSOR_CURSOR_CTRL2(idx), 0); |
149 | if (!nv_wait(NV50_PDISPLAY_CURSOR_CURSOR_CTRL2(idx), | 149 | if (!nv_wait(NV50_PDISPLAY_CURSOR_CURSOR_CTRL2(idx), |
diff --git a/drivers/gpu/drm/nouveau/nv50_dac.c b/drivers/gpu/drm/nouveau/nv50_dac.c index fb5838e3be24..f08f042a8e10 100644 --- a/drivers/gpu/drm/nouveau/nv50_dac.c +++ b/drivers/gpu/drm/nouveau/nv50_dac.c | |||
@@ -44,7 +44,7 @@ nv50_dac_disconnect(struct nouveau_encoder *nv_encoder) | |||
44 | struct nouveau_channel *evo = dev_priv->evo; | 44 | struct nouveau_channel *evo = dev_priv->evo; |
45 | int ret; | 45 | int ret; |
46 | 46 | ||
47 | NV_DEBUG(dev, "Disconnecting DAC %d\n", nv_encoder->or); | 47 | NV_DEBUG_KMS(dev, "Disconnecting DAC %d\n", nv_encoder->or); |
48 | 48 | ||
49 | ret = RING_SPACE(evo, 2); | 49 | ret = RING_SPACE(evo, 2); |
50 | if (ret) { | 50 | if (ret) { |
@@ -81,11 +81,11 @@ nv50_dac_detect(struct drm_encoder *encoder, struct drm_connector *connector) | |||
81 | /* Use bios provided value if possible. */ | 81 | /* Use bios provided value if possible. */ |
82 | if (dev_priv->vbios->dactestval) { | 82 | if (dev_priv->vbios->dactestval) { |
83 | load_pattern = dev_priv->vbios->dactestval; | 83 | load_pattern = dev_priv->vbios->dactestval; |
84 | NV_DEBUG(dev, "Using bios provided load_pattern of %d\n", | 84 | NV_DEBUG_KMS(dev, "Using bios provided load_pattern of %d\n", |
85 | load_pattern); | 85 | load_pattern); |
86 | } else { | 86 | } else { |
87 | load_pattern = 340; | 87 | load_pattern = 340; |
88 | NV_DEBUG(dev, "Using default load_pattern of %d\n", | 88 | NV_DEBUG_KMS(dev, "Using default load_pattern of %d\n", |
89 | load_pattern); | 89 | load_pattern); |
90 | } | 90 | } |
91 | 91 | ||
@@ -103,9 +103,9 @@ nv50_dac_detect(struct drm_encoder *encoder, struct drm_connector *connector) | |||
103 | status = connector_status_connected; | 103 | status = connector_status_connected; |
104 | 104 | ||
105 | if (status == connector_status_connected) | 105 | if (status == connector_status_connected) |
106 | NV_DEBUG(dev, "Load was detected on output with or %d\n", or); | 106 | NV_DEBUG_KMS(dev, "Load was detected on output with or %d\n", or); |
107 | else | 107 | else |
108 | NV_DEBUG(dev, "Load was not detected on output with or %d\n", or); | 108 | NV_DEBUG_KMS(dev, "Load was not detected on output with or %d\n", or); |
109 | 109 | ||
110 | return status; | 110 | return status; |
111 | } | 111 | } |
@@ -118,7 +118,7 @@ nv50_dac_dpms(struct drm_encoder *encoder, int mode) | |||
118 | uint32_t val; | 118 | uint32_t val; |
119 | int or = nv_encoder->or; | 119 | int or = nv_encoder->or; |
120 | 120 | ||
121 | NV_DEBUG(dev, "or %d mode %d\n", or, mode); | 121 | NV_DEBUG_KMS(dev, "or %d mode %d\n", or, mode); |
122 | 122 | ||
123 | /* wait for it to be done */ | 123 | /* wait for it to be done */ |
124 | if (!nv_wait(NV50_PDISPLAY_DAC_DPMS_CTRL(or), | 124 | if (!nv_wait(NV50_PDISPLAY_DAC_DPMS_CTRL(or), |
@@ -173,7 +173,7 @@ nv50_dac_mode_fixup(struct drm_encoder *encoder, struct drm_display_mode *mode, | |||
173 | struct nouveau_encoder *nv_encoder = nouveau_encoder(encoder); | 173 | struct nouveau_encoder *nv_encoder = nouveau_encoder(encoder); |
174 | struct nouveau_connector *connector; | 174 | struct nouveau_connector *connector; |
175 | 175 | ||
176 | NV_DEBUG(encoder->dev, "or %d\n", nv_encoder->or); | 176 | NV_DEBUG_KMS(encoder->dev, "or %d\n", nv_encoder->or); |
177 | 177 | ||
178 | connector = nouveau_encoder_connector_get(nv_encoder); | 178 | connector = nouveau_encoder_connector_get(nv_encoder); |
179 | if (!connector) { | 179 | if (!connector) { |
@@ -213,7 +213,7 @@ nv50_dac_mode_set(struct drm_encoder *encoder, struct drm_display_mode *mode, | |||
213 | uint32_t mode_ctl = 0, mode_ctl2 = 0; | 213 | uint32_t mode_ctl = 0, mode_ctl2 = 0; |
214 | int ret; | 214 | int ret; |
215 | 215 | ||
216 | NV_DEBUG(dev, "or %d\n", nv_encoder->or); | 216 | NV_DEBUG_KMS(dev, "or %d\n", nv_encoder->or); |
217 | 217 | ||
218 | nv50_dac_dpms(encoder, DRM_MODE_DPMS_ON); | 218 | nv50_dac_dpms(encoder, DRM_MODE_DPMS_ON); |
219 | 219 | ||
@@ -264,7 +264,7 @@ nv50_dac_destroy(struct drm_encoder *encoder) | |||
264 | if (!encoder) | 264 | if (!encoder) |
265 | return; | 265 | return; |
266 | 266 | ||
267 | NV_DEBUG(encoder->dev, "\n"); | 267 | NV_DEBUG_KMS(encoder->dev, "\n"); |
268 | 268 | ||
269 | drm_encoder_cleanup(encoder); | 269 | drm_encoder_cleanup(encoder); |
270 | kfree(nv_encoder); | 270 | kfree(nv_encoder); |
@@ -280,7 +280,7 @@ nv50_dac_create(struct drm_device *dev, struct dcb_entry *entry) | |||
280 | struct nouveau_encoder *nv_encoder; | 280 | struct nouveau_encoder *nv_encoder; |
281 | struct drm_encoder *encoder; | 281 | struct drm_encoder *encoder; |
282 | 282 | ||
283 | NV_DEBUG(dev, "\n"); | 283 | NV_DEBUG_KMS(dev, "\n"); |
284 | NV_INFO(dev, "Detected a DAC output\n"); | 284 | NV_INFO(dev, "Detected a DAC output\n"); |
285 | 285 | ||
286 | nv_encoder = kzalloc(sizeof(*nv_encoder), GFP_KERNEL); | 286 | nv_encoder = kzalloc(sizeof(*nv_encoder), GFP_KERNEL); |
diff --git a/drivers/gpu/drm/nouveau/nv50_display.c b/drivers/gpu/drm/nouveau/nv50_display.c index 12c5ee63495b..90f0bf59fbcd 100644 --- a/drivers/gpu/drm/nouveau/nv50_display.c +++ b/drivers/gpu/drm/nouveau/nv50_display.c | |||
@@ -188,7 +188,7 @@ nv50_display_init(struct drm_device *dev) | |||
188 | uint64_t start; | 188 | uint64_t start; |
189 | int ret, i; | 189 | int ret, i; |
190 | 190 | ||
191 | NV_DEBUG(dev, "\n"); | 191 | NV_DEBUG_KMS(dev, "\n"); |
192 | 192 | ||
193 | nv_wr32(dev, 0x00610184, nv_rd32(dev, 0x00614004)); | 193 | nv_wr32(dev, 0x00610184, nv_rd32(dev, 0x00614004)); |
194 | /* | 194 | /* |
@@ -232,7 +232,7 @@ nv50_display_init(struct drm_device *dev) | |||
232 | nv_wr32(dev, NV50_PDISPLAY_UNK_380, 0); | 232 | nv_wr32(dev, NV50_PDISPLAY_UNK_380, 0); |
233 | /* RAM is clamped to 256 MiB. */ | 233 | /* RAM is clamped to 256 MiB. */ |
234 | ram_amount = nouveau_mem_fb_amount(dev); | 234 | ram_amount = nouveau_mem_fb_amount(dev); |
235 | NV_DEBUG(dev, "ram_amount %d\n", ram_amount); | 235 | NV_DEBUG_KMS(dev, "ram_amount %d\n", ram_amount); |
236 | if (ram_amount > 256*1024*1024) | 236 | if (ram_amount > 256*1024*1024) |
237 | ram_amount = 256*1024*1024; | 237 | ram_amount = 256*1024*1024; |
238 | nv_wr32(dev, NV50_PDISPLAY_RAM_AMOUNT, ram_amount - 1); | 238 | nv_wr32(dev, NV50_PDISPLAY_RAM_AMOUNT, ram_amount - 1); |
@@ -398,7 +398,7 @@ static int nv50_display_disable(struct drm_device *dev) | |||
398 | struct drm_crtc *drm_crtc; | 398 | struct drm_crtc *drm_crtc; |
399 | int ret, i; | 399 | int ret, i; |
400 | 400 | ||
401 | NV_DEBUG(dev, "\n"); | 401 | NV_DEBUG_KMS(dev, "\n"); |
402 | 402 | ||
403 | list_for_each_entry(drm_crtc, &dev->mode_config.crtc_list, head) { | 403 | list_for_each_entry(drm_crtc, &dev->mode_config.crtc_list, head) { |
404 | struct nouveau_crtc *crtc = nouveau_crtc(drm_crtc); | 404 | struct nouveau_crtc *crtc = nouveau_crtc(drm_crtc); |
@@ -469,7 +469,7 @@ int nv50_display_create(struct drm_device *dev) | |||
469 | uint32_t connector[16] = {}; | 469 | uint32_t connector[16] = {}; |
470 | int ret, i; | 470 | int ret, i; |
471 | 471 | ||
472 | NV_DEBUG(dev, "\n"); | 472 | NV_DEBUG_KMS(dev, "\n"); |
473 | 473 | ||
474 | /* init basic kernel modesetting */ | 474 | /* init basic kernel modesetting */ |
475 | drm_mode_config_init(dev); | 475 | drm_mode_config_init(dev); |
@@ -573,7 +573,7 @@ int nv50_display_destroy(struct drm_device *dev) | |||
573 | { | 573 | { |
574 | struct drm_nouveau_private *dev_priv = dev->dev_private; | 574 | struct drm_nouveau_private *dev_priv = dev->dev_private; |
575 | 575 | ||
576 | NV_DEBUG(dev, "\n"); | 576 | NV_DEBUG_KMS(dev, "\n"); |
577 | 577 | ||
578 | drm_mode_config_cleanup(dev); | 578 | drm_mode_config_cleanup(dev); |
579 | 579 | ||
@@ -617,7 +617,7 @@ nv50_display_irq_head(struct drm_device *dev, int *phead, | |||
617 | * CRTC separately, and submission will be blocked by the GPU | 617 | * CRTC separately, and submission will be blocked by the GPU |
618 | * until we handle each in turn. | 618 | * until we handle each in turn. |
619 | */ | 619 | */ |
620 | NV_DEBUG(dev, "0x610030: 0x%08x\n", unk30); | 620 | NV_DEBUG_KMS(dev, "0x610030: 0x%08x\n", unk30); |
621 | head = ffs((unk30 >> 9) & 3) - 1; | 621 | head = ffs((unk30 >> 9) & 3) - 1; |
622 | if (head < 0) | 622 | if (head < 0) |
623 | return -EINVAL; | 623 | return -EINVAL; |
@@ -661,7 +661,7 @@ nv50_display_irq_head(struct drm_device *dev, int *phead, | |||
661 | or = i; | 661 | or = i; |
662 | } | 662 | } |
663 | 663 | ||
664 | NV_DEBUG(dev, "type %d, or %d\n", type, or); | 664 | NV_DEBUG_KMS(dev, "type %d, or %d\n", type, or); |
665 | if (type == OUTPUT_ANY) { | 665 | if (type == OUTPUT_ANY) { |
666 | NV_ERROR(dev, "unknown encoder!!\n"); | 666 | NV_ERROR(dev, "unknown encoder!!\n"); |
667 | return -1; | 667 | return -1; |
@@ -690,9 +690,21 @@ nv50_display_script_select(struct drm_device *dev, struct dcb_entry *dcbent, | |||
690 | int pxclk) | 690 | int pxclk) |
691 | { | 691 | { |
692 | struct drm_nouveau_private *dev_priv = dev->dev_private; | 692 | struct drm_nouveau_private *dev_priv = dev->dev_private; |
693 | struct nouveau_connector *nv_connector = NULL; | ||
694 | struct drm_encoder *encoder; | ||
693 | struct nvbios *bios = &dev_priv->VBIOS; | 695 | struct nvbios *bios = &dev_priv->VBIOS; |
694 | uint32_t mc, script = 0, or; | 696 | uint32_t mc, script = 0, or; |
695 | 697 | ||
698 | list_for_each_entry(encoder, &dev->mode_config.encoder_list, head) { | ||
699 | struct nouveau_encoder *nv_encoder = nouveau_encoder(encoder); | ||
700 | |||
701 | if (nv_encoder->dcb != dcbent) | ||
702 | continue; | ||
703 | |||
704 | nv_connector = nouveau_encoder_connector_get(nv_encoder); | ||
705 | break; | ||
706 | } | ||
707 | |||
696 | or = ffs(dcbent->or) - 1; | 708 | or = ffs(dcbent->or) - 1; |
697 | mc = nv50_display_mode_ctrl(dev, dcbent->type != OUTPUT_ANALOG, or); | 709 | mc = nv50_display_mode_ctrl(dev, dcbent->type != OUTPUT_ANALOG, or); |
698 | switch (dcbent->type) { | 710 | switch (dcbent->type) { |
@@ -711,6 +723,11 @@ nv50_display_script_select(struct drm_device *dev, struct dcb_entry *dcbent, | |||
711 | } else | 723 | } else |
712 | if (bios->fp.strapless_is_24bit & 1) | 724 | if (bios->fp.strapless_is_24bit & 1) |
713 | script |= 0x0200; | 725 | script |= 0x0200; |
726 | |||
727 | if (nv_connector && nv_connector->edid && | ||
728 | (nv_connector->edid->revision >= 4) && | ||
729 | (nv_connector->edid->input & 0x70) >= 0x20) | ||
730 | script |= 0x0200; | ||
714 | } | 731 | } |
715 | 732 | ||
716 | if (nouveau_uscript_lvds >= 0) { | 733 | if (nouveau_uscript_lvds >= 0) { |
@@ -811,7 +828,7 @@ nv50_display_unk20_handler(struct drm_device *dev) | |||
811 | pclk = nv_rd32(dev, NV50_PDISPLAY_CRTC_P(head, CLOCK)) & 0x3fffff; | 828 | pclk = nv_rd32(dev, NV50_PDISPLAY_CRTC_P(head, CLOCK)) & 0x3fffff; |
812 | script = nv50_display_script_select(dev, dcbent, pclk); | 829 | script = nv50_display_script_select(dev, dcbent, pclk); |
813 | 830 | ||
814 | NV_DEBUG(dev, "head %d pxclk: %dKHz\n", head, pclk); | 831 | NV_DEBUG_KMS(dev, "head %d pxclk: %dKHz\n", head, pclk); |
815 | 832 | ||
816 | if (dcbent->type != OUTPUT_DP) | 833 | if (dcbent->type != OUTPUT_DP) |
817 | nouveau_bios_run_display_table(dev, dcbent, 0, -2); | 834 | nouveau_bios_run_display_table(dev, dcbent, 0, -2); |
@@ -870,7 +887,7 @@ nv50_display_irq_handler_bh(struct work_struct *work) | |||
870 | uint32_t intr0 = nv_rd32(dev, NV50_PDISPLAY_INTR_0); | 887 | uint32_t intr0 = nv_rd32(dev, NV50_PDISPLAY_INTR_0); |
871 | uint32_t intr1 = nv_rd32(dev, NV50_PDISPLAY_INTR_1); | 888 | uint32_t intr1 = nv_rd32(dev, NV50_PDISPLAY_INTR_1); |
872 | 889 | ||
873 | NV_DEBUG(dev, "PDISPLAY_INTR_BH 0x%08x 0x%08x\n", intr0, intr1); | 890 | NV_DEBUG_KMS(dev, "PDISPLAY_INTR_BH 0x%08x 0x%08x\n", intr0, intr1); |
874 | 891 | ||
875 | if (intr1 & NV50_PDISPLAY_INTR_1_CLK_UNK10) | 892 | if (intr1 & NV50_PDISPLAY_INTR_1_CLK_UNK10) |
876 | nv50_display_unk10_handler(dev); | 893 | nv50_display_unk10_handler(dev); |
@@ -974,7 +991,7 @@ nv50_display_irq_handler(struct drm_device *dev) | |||
974 | uint32_t intr1 = nv_rd32(dev, NV50_PDISPLAY_INTR_1); | 991 | uint32_t intr1 = nv_rd32(dev, NV50_PDISPLAY_INTR_1); |
975 | uint32_t clock; | 992 | uint32_t clock; |
976 | 993 | ||
977 | NV_DEBUG(dev, "PDISPLAY_INTR 0x%08x 0x%08x\n", intr0, intr1); | 994 | NV_DEBUG_KMS(dev, "PDISPLAY_INTR 0x%08x 0x%08x\n", intr0, intr1); |
978 | 995 | ||
979 | if (!intr0 && !(intr1 & ~delayed)) | 996 | if (!intr0 && !(intr1 & ~delayed)) |
980 | break; | 997 | break; |
diff --git a/drivers/gpu/drm/nouveau/nv50_fbcon.c b/drivers/gpu/drm/nouveau/nv50_fbcon.c index 6bcc6d39e9b0..e4f279ee61cf 100644 --- a/drivers/gpu/drm/nouveau/nv50_fbcon.c +++ b/drivers/gpu/drm/nouveau/nv50_fbcon.c | |||
@@ -16,9 +16,7 @@ nv50_fbcon_fillrect(struct fb_info *info, const struct fb_fillrect *rect) | |||
16 | 16 | ||
17 | if (!(info->flags & FBINFO_HWACCEL_DISABLED) && | 17 | if (!(info->flags & FBINFO_HWACCEL_DISABLED) && |
18 | RING_SPACE(chan, rect->rop == ROP_COPY ? 7 : 11)) { | 18 | RING_SPACE(chan, rect->rop == ROP_COPY ? 7 : 11)) { |
19 | NV_ERROR(dev, "GPU lockup - switching to software fbcon\n"); | 19 | nouveau_fbcon_gpu_lockup(info); |
20 | |||
21 | info->flags |= FBINFO_HWACCEL_DISABLED; | ||
22 | } | 20 | } |
23 | 21 | ||
24 | if (info->flags & FBINFO_HWACCEL_DISABLED) { | 22 | if (info->flags & FBINFO_HWACCEL_DISABLED) { |
@@ -31,7 +29,11 @@ nv50_fbcon_fillrect(struct fb_info *info, const struct fb_fillrect *rect) | |||
31 | OUT_RING(chan, 1); | 29 | OUT_RING(chan, 1); |
32 | } | 30 | } |
33 | BEGIN_RING(chan, NvSub2D, 0x0588, 1); | 31 | BEGIN_RING(chan, NvSub2D, 0x0588, 1); |
34 | OUT_RING(chan, rect->color); | 32 | if (info->fix.visual == FB_VISUAL_TRUECOLOR || |
33 | info->fix.visual == FB_VISUAL_DIRECTCOLOR) | ||
34 | OUT_RING(chan, ((uint32_t *)info->pseudo_palette)[rect->color]); | ||
35 | else | ||
36 | OUT_RING(chan, rect->color); | ||
35 | BEGIN_RING(chan, NvSub2D, 0x0600, 4); | 37 | BEGIN_RING(chan, NvSub2D, 0x0600, 4); |
36 | OUT_RING(chan, rect->dx); | 38 | OUT_RING(chan, rect->dx); |
37 | OUT_RING(chan, rect->dy); | 39 | OUT_RING(chan, rect->dy); |
@@ -56,9 +58,7 @@ nv50_fbcon_copyarea(struct fb_info *info, const struct fb_copyarea *region) | |||
56 | return; | 58 | return; |
57 | 59 | ||
58 | if (!(info->flags & FBINFO_HWACCEL_DISABLED) && RING_SPACE(chan, 12)) { | 60 | if (!(info->flags & FBINFO_HWACCEL_DISABLED) && RING_SPACE(chan, 12)) { |
59 | NV_ERROR(dev, "GPU lockup - switching to software fbcon\n"); | 61 | nouveau_fbcon_gpu_lockup(info); |
60 | |||
61 | info->flags |= FBINFO_HWACCEL_DISABLED; | ||
62 | } | 62 | } |
63 | 63 | ||
64 | if (info->flags & FBINFO_HWACCEL_DISABLED) { | 64 | if (info->flags & FBINFO_HWACCEL_DISABLED) { |
@@ -101,8 +101,7 @@ nv50_fbcon_imageblit(struct fb_info *info, const struct fb_image *image) | |||
101 | } | 101 | } |
102 | 102 | ||
103 | if (!(info->flags & FBINFO_HWACCEL_DISABLED) && RING_SPACE(chan, 11)) { | 103 | if (!(info->flags & FBINFO_HWACCEL_DISABLED) && RING_SPACE(chan, 11)) { |
104 | NV_ERROR(dev, "GPU lockup - switching to software fbcon\n"); | 104 | nouveau_fbcon_gpu_lockup(info); |
105 | info->flags |= FBINFO_HWACCEL_DISABLED; | ||
106 | } | 105 | } |
107 | 106 | ||
108 | if (info->flags & FBINFO_HWACCEL_DISABLED) { | 107 | if (info->flags & FBINFO_HWACCEL_DISABLED) { |
@@ -135,9 +134,7 @@ nv50_fbcon_imageblit(struct fb_info *info, const struct fb_image *image) | |||
135 | int push = dwords > 2047 ? 2047 : dwords; | 134 | int push = dwords > 2047 ? 2047 : dwords; |
136 | 135 | ||
137 | if (RING_SPACE(chan, push + 1)) { | 136 | if (RING_SPACE(chan, push + 1)) { |
138 | NV_ERROR(dev, | 137 | nouveau_fbcon_gpu_lockup(info); |
139 | "GPU lockup - switching to software fbcon\n"); | ||
140 | info->flags |= FBINFO_HWACCEL_DISABLED; | ||
141 | cfb_imageblit(info, image); | 138 | cfb_imageblit(info, image); |
142 | return; | 139 | return; |
143 | } | 140 | } |
@@ -199,7 +196,7 @@ nv50_fbcon_accel_init(struct fb_info *info) | |||
199 | 196 | ||
200 | ret = RING_SPACE(chan, 59); | 197 | ret = RING_SPACE(chan, 59); |
201 | if (ret) { | 198 | if (ret) { |
202 | NV_ERROR(dev, "GPU lockup - switching to software fbcon\n"); | 199 | nouveau_fbcon_gpu_lockup(info); |
203 | return ret; | 200 | return ret; |
204 | } | 201 | } |
205 | 202 | ||
diff --git a/drivers/gpu/drm/nouveau/nv50_fifo.c b/drivers/gpu/drm/nouveau/nv50_fifo.c index 77ae1aaa0bce..39caf167587d 100644 --- a/drivers/gpu/drm/nouveau/nv50_fifo.c +++ b/drivers/gpu/drm/nouveau/nv50_fifo.c | |||
@@ -384,8 +384,8 @@ nv50_fifo_load_context(struct nouveau_channel *chan) | |||
384 | nv_wr32(dev, NV40_PFIFO_CACHE1_DATA(ptr), | 384 | nv_wr32(dev, NV40_PFIFO_CACHE1_DATA(ptr), |
385 | nv_ro32(dev, cache, (ptr * 2) + 1)); | 385 | nv_ro32(dev, cache, (ptr * 2) + 1)); |
386 | } | 386 | } |
387 | nv_wr32(dev, 0x3210, cnt << 2); | 387 | nv_wr32(dev, NV03_PFIFO_CACHE1_PUT, cnt << 2); |
388 | nv_wr32(dev, 0x3270, 0); | 388 | nv_wr32(dev, NV03_PFIFO_CACHE1_GET, 0); |
389 | 389 | ||
390 | /* guessing that all the 0x34xx regs aren't on NV50 */ | 390 | /* guessing that all the 0x34xx regs aren't on NV50 */ |
391 | if (!IS_G80) { | 391 | if (!IS_G80) { |
@@ -398,8 +398,6 @@ nv50_fifo_load_context(struct nouveau_channel *chan) | |||
398 | 398 | ||
399 | dev_priv->engine.instmem.finish_access(dev); | 399 | dev_priv->engine.instmem.finish_access(dev); |
400 | 400 | ||
401 | nv_wr32(dev, NV03_PFIFO_CACHE1_GET, 0); | ||
402 | nv_wr32(dev, NV03_PFIFO_CACHE1_PUT, 0); | ||
403 | nv_wr32(dev, NV03_PFIFO_CACHE1_PUSH1, chan->id | (1<<16)); | 401 | nv_wr32(dev, NV03_PFIFO_CACHE1_PUSH1, chan->id | (1<<16)); |
404 | return 0; | 402 | return 0; |
405 | } | 403 | } |
@@ -416,7 +414,7 @@ nv50_fifo_unload_context(struct drm_device *dev) | |||
416 | NV_DEBUG(dev, "\n"); | 414 | NV_DEBUG(dev, "\n"); |
417 | 415 | ||
418 | chid = pfifo->channel_id(dev); | 416 | chid = pfifo->channel_id(dev); |
419 | if (chid < 0 || chid >= dev_priv->engine.fifo.channels) | 417 | if (chid < 1 || chid >= dev_priv->engine.fifo.channels - 1) |
420 | return 0; | 418 | return 0; |
421 | 419 | ||
422 | chan = dev_priv->fifos[chid]; | 420 | chan = dev_priv->fifos[chid]; |
diff --git a/drivers/gpu/drm/nouveau/nv50_graph.c b/drivers/gpu/drm/nouveau/nv50_graph.c index 177d8229336f..ca79f32be44c 100644 --- a/drivers/gpu/drm/nouveau/nv50_graph.c +++ b/drivers/gpu/drm/nouveau/nv50_graph.c | |||
@@ -107,9 +107,13 @@ nv50_graph_init_regs(struct drm_device *dev) | |||
107 | static int | 107 | static int |
108 | nv50_graph_init_ctxctl(struct drm_device *dev) | 108 | nv50_graph_init_ctxctl(struct drm_device *dev) |
109 | { | 109 | { |
110 | struct drm_nouveau_private *dev_priv = dev->dev_private; | ||
111 | |||
110 | NV_DEBUG(dev, "\n"); | 112 | NV_DEBUG(dev, "\n"); |
111 | 113 | ||
112 | nv40_grctx_init(dev); | 114 | nouveau_grctx_prog_load(dev); |
115 | if (!dev_priv->engine.graph.ctxprog) | ||
116 | dev_priv->engine.graph.accel_blocked = true; | ||
113 | 117 | ||
114 | nv_wr32(dev, 0x400320, 4); | 118 | nv_wr32(dev, 0x400320, 4); |
115 | nv_wr32(dev, NV40_PGRAPH_CTXCTL_CUR, 0); | 119 | nv_wr32(dev, NV40_PGRAPH_CTXCTL_CUR, 0); |
@@ -140,7 +144,7 @@ void | |||
140 | nv50_graph_takedown(struct drm_device *dev) | 144 | nv50_graph_takedown(struct drm_device *dev) |
141 | { | 145 | { |
142 | NV_DEBUG(dev, "\n"); | 146 | NV_DEBUG(dev, "\n"); |
143 | nv40_grctx_fini(dev); | 147 | nouveau_grctx_fini(dev); |
144 | } | 148 | } |
145 | 149 | ||
146 | void | 150 | void |
@@ -207,7 +211,7 @@ nv50_graph_create_context(struct nouveau_channel *chan) | |||
207 | dev_priv->engine.instmem.finish_access(dev); | 211 | dev_priv->engine.instmem.finish_access(dev); |
208 | 212 | ||
209 | dev_priv->engine.instmem.prepare_access(dev, true); | 213 | dev_priv->engine.instmem.prepare_access(dev, true); |
210 | nv40_grctx_vals_load(dev, ctx); | 214 | nouveau_grctx_vals_load(dev, ctx); |
211 | nv_wo32(dev, ctx, 0x00000/4, chan->ramin->instance >> 12); | 215 | nv_wo32(dev, ctx, 0x00000/4, chan->ramin->instance >> 12); |
212 | if ((dev_priv->chipset & 0xf0) == 0xa0) | 216 | if ((dev_priv->chipset & 0xf0) == 0xa0) |
213 | nv_wo32(dev, ctx, 0x00004/4, 0x00000000); | 217 | nv_wo32(dev, ctx, 0x00004/4, 0x00000000); |
diff --git a/drivers/gpu/drm/nouveau/nv50_sor.c b/drivers/gpu/drm/nouveau/nv50_sor.c index 8c280463a664..e395c16d30f5 100644 --- a/drivers/gpu/drm/nouveau/nv50_sor.c +++ b/drivers/gpu/drm/nouveau/nv50_sor.c | |||
@@ -44,7 +44,7 @@ nv50_sor_disconnect(struct nouveau_encoder *nv_encoder) | |||
44 | struct nouveau_channel *evo = dev_priv->evo; | 44 | struct nouveau_channel *evo = dev_priv->evo; |
45 | int ret; | 45 | int ret; |
46 | 46 | ||
47 | NV_DEBUG(dev, "Disconnecting SOR %d\n", nv_encoder->or); | 47 | NV_DEBUG_KMS(dev, "Disconnecting SOR %d\n", nv_encoder->or); |
48 | 48 | ||
49 | ret = RING_SPACE(evo, 2); | 49 | ret = RING_SPACE(evo, 2); |
50 | if (ret) { | 50 | if (ret) { |
@@ -70,7 +70,7 @@ nv50_sor_dp_link_train(struct drm_encoder *encoder) | |||
70 | } | 70 | } |
71 | 71 | ||
72 | if (dpe->script0) { | 72 | if (dpe->script0) { |
73 | NV_DEBUG(dev, "SOR-%d: running DP script 0\n", nv_encoder->or); | 73 | NV_DEBUG_KMS(dev, "SOR-%d: running DP script 0\n", nv_encoder->or); |
74 | nouveau_bios_run_init_table(dev, le16_to_cpu(dpe->script0), | 74 | nouveau_bios_run_init_table(dev, le16_to_cpu(dpe->script0), |
75 | nv_encoder->dcb); | 75 | nv_encoder->dcb); |
76 | } | 76 | } |
@@ -79,7 +79,7 @@ nv50_sor_dp_link_train(struct drm_encoder *encoder) | |||
79 | NV_ERROR(dev, "SOR-%d: link training failed\n", nv_encoder->or); | 79 | NV_ERROR(dev, "SOR-%d: link training failed\n", nv_encoder->or); |
80 | 80 | ||
81 | if (dpe->script1) { | 81 | if (dpe->script1) { |
82 | NV_DEBUG(dev, "SOR-%d: running DP script 1\n", nv_encoder->or); | 82 | NV_DEBUG_KMS(dev, "SOR-%d: running DP script 1\n", nv_encoder->or); |
83 | nouveau_bios_run_init_table(dev, le16_to_cpu(dpe->script1), | 83 | nouveau_bios_run_init_table(dev, le16_to_cpu(dpe->script1), |
84 | nv_encoder->dcb); | 84 | nv_encoder->dcb); |
85 | } | 85 | } |
@@ -93,7 +93,7 @@ nv50_sor_dpms(struct drm_encoder *encoder, int mode) | |||
93 | uint32_t val; | 93 | uint32_t val; |
94 | int or = nv_encoder->or; | 94 | int or = nv_encoder->or; |
95 | 95 | ||
96 | NV_DEBUG(dev, "or %d mode %d\n", or, mode); | 96 | NV_DEBUG_KMS(dev, "or %d mode %d\n", or, mode); |
97 | 97 | ||
98 | /* wait for it to be done */ | 98 | /* wait for it to be done */ |
99 | if (!nv_wait(NV50_PDISPLAY_SOR_DPMS_CTRL(or), | 99 | if (!nv_wait(NV50_PDISPLAY_SOR_DPMS_CTRL(or), |
@@ -142,7 +142,7 @@ nv50_sor_mode_fixup(struct drm_encoder *encoder, struct drm_display_mode *mode, | |||
142 | struct nouveau_encoder *nv_encoder = nouveau_encoder(encoder); | 142 | struct nouveau_encoder *nv_encoder = nouveau_encoder(encoder); |
143 | struct nouveau_connector *connector; | 143 | struct nouveau_connector *connector; |
144 | 144 | ||
145 | NV_DEBUG(encoder->dev, "or %d\n", nv_encoder->or); | 145 | NV_DEBUG_KMS(encoder->dev, "or %d\n", nv_encoder->or); |
146 | 146 | ||
147 | connector = nouveau_encoder_connector_get(nv_encoder); | 147 | connector = nouveau_encoder_connector_get(nv_encoder); |
148 | if (!connector) { | 148 | if (!connector) { |
@@ -182,7 +182,7 @@ nv50_sor_mode_set(struct drm_encoder *encoder, struct drm_display_mode *mode, | |||
182 | uint32_t mode_ctl = 0; | 182 | uint32_t mode_ctl = 0; |
183 | int ret; | 183 | int ret; |
184 | 184 | ||
185 | NV_DEBUG(dev, "or %d\n", nv_encoder->or); | 185 | NV_DEBUG_KMS(dev, "or %d\n", nv_encoder->or); |
186 | 186 | ||
187 | nv50_sor_dpms(encoder, DRM_MODE_DPMS_ON); | 187 | nv50_sor_dpms(encoder, DRM_MODE_DPMS_ON); |
188 | 188 | ||
@@ -246,7 +246,7 @@ nv50_sor_destroy(struct drm_encoder *encoder) | |||
246 | if (!encoder) | 246 | if (!encoder) |
247 | return; | 247 | return; |
248 | 248 | ||
249 | NV_DEBUG(encoder->dev, "\n"); | 249 | NV_DEBUG_KMS(encoder->dev, "\n"); |
250 | 250 | ||
251 | drm_encoder_cleanup(encoder); | 251 | drm_encoder_cleanup(encoder); |
252 | 252 | ||
@@ -265,7 +265,7 @@ nv50_sor_create(struct drm_device *dev, struct dcb_entry *entry) | |||
265 | bool dum; | 265 | bool dum; |
266 | int type; | 266 | int type; |
267 | 267 | ||
268 | NV_DEBUG(dev, "\n"); | 268 | NV_DEBUG_KMS(dev, "\n"); |
269 | 269 | ||
270 | switch (entry->type) { | 270 | switch (entry->type) { |
271 | case OUTPUT_TMDS: | 271 | case OUTPUT_TMDS: |
diff --git a/drivers/gpu/drm/r128/r128_drv.c b/drivers/gpu/drm/r128/r128_drv.c index 601f4c0e5da5..b806fdcc7170 100644 --- a/drivers/gpu/drm/r128/r128_drv.c +++ b/drivers/gpu/drm/r128/r128_drv.c | |||
@@ -64,7 +64,7 @@ static struct drm_driver driver = { | |||
64 | .owner = THIS_MODULE, | 64 | .owner = THIS_MODULE, |
65 | .open = drm_open, | 65 | .open = drm_open, |
66 | .release = drm_release, | 66 | .release = drm_release, |
67 | .ioctl = drm_ioctl, | 67 | .unlocked_ioctl = drm_ioctl, |
68 | .mmap = drm_mmap, | 68 | .mmap = drm_mmap, |
69 | .poll = drm_poll, | 69 | .poll = drm_poll, |
70 | .fasync = drm_fasync, | 70 | .fasync = drm_fasync, |
diff --git a/drivers/gpu/drm/r128/r128_ioc32.c b/drivers/gpu/drm/r128/r128_ioc32.c index d3cb676eee84..51c99fc4dd38 100644 --- a/drivers/gpu/drm/r128/r128_ioc32.c +++ b/drivers/gpu/drm/r128/r128_ioc32.c | |||
@@ -95,8 +95,7 @@ static int compat_r128_init(struct file *file, unsigned int cmd, | |||
95 | &init->agp_textures_offset)) | 95 | &init->agp_textures_offset)) |
96 | return -EFAULT; | 96 | return -EFAULT; |
97 | 97 | ||
98 | return drm_ioctl(file->f_path.dentry->d_inode, file, | 98 | return drm_ioctl(file, DRM_IOCTL_R128_INIT, (unsigned long)init); |
99 | DRM_IOCTL_R128_INIT, (unsigned long)init); | ||
100 | } | 99 | } |
101 | 100 | ||
102 | typedef struct drm_r128_depth32 { | 101 | typedef struct drm_r128_depth32 { |
@@ -129,8 +128,7 @@ static int compat_r128_depth(struct file *file, unsigned int cmd, | |||
129 | &depth->mask)) | 128 | &depth->mask)) |
130 | return -EFAULT; | 129 | return -EFAULT; |
131 | 130 | ||
132 | return drm_ioctl(file->f_path.dentry->d_inode, file, | 131 | return drm_ioctl(file, DRM_IOCTL_R128_DEPTH, (unsigned long)depth); |
133 | DRM_IOCTL_R128_DEPTH, (unsigned long)depth); | ||
134 | 132 | ||
135 | } | 133 | } |
136 | 134 | ||
@@ -153,8 +151,7 @@ static int compat_r128_stipple(struct file *file, unsigned int cmd, | |||
153 | &stipple->mask)) | 151 | &stipple->mask)) |
154 | return -EFAULT; | 152 | return -EFAULT; |
155 | 153 | ||
156 | return drm_ioctl(file->f_path.dentry->d_inode, file, | 154 | return drm_ioctl(file, DRM_IOCTL_R128_STIPPLE, (unsigned long)stipple); |
157 | DRM_IOCTL_R128_STIPPLE, (unsigned long)stipple); | ||
158 | } | 155 | } |
159 | 156 | ||
160 | typedef struct drm_r128_getparam32 { | 157 | typedef struct drm_r128_getparam32 { |
@@ -178,8 +175,7 @@ static int compat_r128_getparam(struct file *file, unsigned int cmd, | |||
178 | &getparam->value)) | 175 | &getparam->value)) |
179 | return -EFAULT; | 176 | return -EFAULT; |
180 | 177 | ||
181 | return drm_ioctl(file->f_path.dentry->d_inode, file, | 178 | return drm_ioctl(file, DRM_IOCTL_R128_GETPARAM, (unsigned long)getparam); |
182 | DRM_IOCTL_R128_GETPARAM, (unsigned long)getparam); | ||
183 | } | 179 | } |
184 | 180 | ||
185 | drm_ioctl_compat_t *r128_compat_ioctls[] = { | 181 | drm_ioctl_compat_t *r128_compat_ioctls[] = { |
@@ -210,12 +206,10 @@ long r128_compat_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) | |||
210 | if (nr < DRM_COMMAND_BASE + DRM_ARRAY_SIZE(r128_compat_ioctls)) | 206 | if (nr < DRM_COMMAND_BASE + DRM_ARRAY_SIZE(r128_compat_ioctls)) |
211 | fn = r128_compat_ioctls[nr - DRM_COMMAND_BASE]; | 207 | fn = r128_compat_ioctls[nr - DRM_COMMAND_BASE]; |
212 | 208 | ||
213 | lock_kernel(); /* XXX for now */ | ||
214 | if (fn != NULL) | 209 | if (fn != NULL) |
215 | ret = (*fn) (filp, cmd, arg); | 210 | ret = (*fn) (filp, cmd, arg); |
216 | else | 211 | else |
217 | ret = drm_ioctl(filp->f_path.dentry->d_inode, filp, cmd, arg); | 212 | ret = drm_ioctl(filp, cmd, arg); |
218 | unlock_kernel(); | ||
219 | 213 | ||
220 | return ret; | 214 | return ret; |
221 | } | 215 | } |
diff --git a/drivers/gpu/drm/radeon/Makefile b/drivers/gpu/drm/radeon/Makefile index b5f5fe75e6af..1cc7b937b1ea 100644 --- a/drivers/gpu/drm/radeon/Makefile +++ b/drivers/gpu/drm/radeon/Makefile | |||
@@ -24,6 +24,9 @@ $(obj)/rv515_reg_safe.h: $(src)/reg_srcs/rv515 $(obj)/mkregtable | |||
24 | $(obj)/r300_reg_safe.h: $(src)/reg_srcs/r300 $(obj)/mkregtable | 24 | $(obj)/r300_reg_safe.h: $(src)/reg_srcs/r300 $(obj)/mkregtable |
25 | $(call if_changed,mkregtable) | 25 | $(call if_changed,mkregtable) |
26 | 26 | ||
27 | $(obj)/r420_reg_safe.h: $(src)/reg_srcs/r420 $(obj)/mkregtable | ||
28 | $(call if_changed,mkregtable) | ||
29 | |||
27 | $(obj)/rs600_reg_safe.h: $(src)/reg_srcs/rs600 $(obj)/mkregtable | 30 | $(obj)/rs600_reg_safe.h: $(src)/reg_srcs/rs600 $(obj)/mkregtable |
28 | $(call if_changed,mkregtable) | 31 | $(call if_changed,mkregtable) |
29 | 32 | ||
@@ -35,6 +38,8 @@ $(obj)/rv515.o: $(obj)/rv515_reg_safe.h | |||
35 | 38 | ||
36 | $(obj)/r300.o: $(obj)/r300_reg_safe.h | 39 | $(obj)/r300.o: $(obj)/r300_reg_safe.h |
37 | 40 | ||
41 | $(obj)/r420.o: $(obj)/r420_reg_safe.h | ||
42 | |||
38 | $(obj)/rs600.o: $(obj)/rs600_reg_safe.h | 43 | $(obj)/rs600.o: $(obj)/rs600_reg_safe.h |
39 | 44 | ||
40 | radeon-y := radeon_drv.o radeon_cp.o radeon_state.o radeon_mem.o \ | 45 | radeon-y := radeon_drv.o radeon_cp.o radeon_state.o radeon_mem.o \ |
diff --git a/drivers/gpu/drm/radeon/ObjectID.h b/drivers/gpu/drm/radeon/ObjectID.h index 6d0183c61d3b..c714179d1bfa 100644 --- a/drivers/gpu/drm/radeon/ObjectID.h +++ b/drivers/gpu/drm/radeon/ObjectID.h | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright 2006-2007 Advanced Micro Devices, Inc. | 2 | * Copyright 2006-2007 Advanced Micro Devices, Inc. |
3 | * | 3 | * |
4 | * Permission is hereby granted, free of charge, to any person obtaining a | 4 | * Permission is hereby granted, free of charge, to any person obtaining a |
5 | * copy of this software and associated documentation files (the "Software"), | 5 | * copy of this software and associated documentation files (the "Software"), |
@@ -41,14 +41,14 @@ | |||
41 | /****************************************************/ | 41 | /****************************************************/ |
42 | /* Encoder Object ID Definition */ | 42 | /* Encoder Object ID Definition */ |
43 | /****************************************************/ | 43 | /****************************************************/ |
44 | #define ENCODER_OBJECT_ID_NONE 0x00 | 44 | #define ENCODER_OBJECT_ID_NONE 0x00 |
45 | 45 | ||
46 | /* Radeon Class Display Hardware */ | 46 | /* Radeon Class Display Hardware */ |
47 | #define ENCODER_OBJECT_ID_INTERNAL_LVDS 0x01 | 47 | #define ENCODER_OBJECT_ID_INTERNAL_LVDS 0x01 |
48 | #define ENCODER_OBJECT_ID_INTERNAL_TMDS1 0x02 | 48 | #define ENCODER_OBJECT_ID_INTERNAL_TMDS1 0x02 |
49 | #define ENCODER_OBJECT_ID_INTERNAL_TMDS2 0x03 | 49 | #define ENCODER_OBJECT_ID_INTERNAL_TMDS2 0x03 |
50 | #define ENCODER_OBJECT_ID_INTERNAL_DAC1 0x04 | 50 | #define ENCODER_OBJECT_ID_INTERNAL_DAC1 0x04 |
51 | #define ENCODER_OBJECT_ID_INTERNAL_DAC2 0x05 /* TV/CV DAC */ | 51 | #define ENCODER_OBJECT_ID_INTERNAL_DAC2 0x05 /* TV/CV DAC */ |
52 | #define ENCODER_OBJECT_ID_INTERNAL_SDVOA 0x06 | 52 | #define ENCODER_OBJECT_ID_INTERNAL_SDVOA 0x06 |
53 | #define ENCODER_OBJECT_ID_INTERNAL_SDVOB 0x07 | 53 | #define ENCODER_OBJECT_ID_INTERNAL_SDVOB 0x07 |
54 | 54 | ||
@@ -56,11 +56,11 @@ | |||
56 | #define ENCODER_OBJECT_ID_SI170B 0x08 | 56 | #define ENCODER_OBJECT_ID_SI170B 0x08 |
57 | #define ENCODER_OBJECT_ID_CH7303 0x09 | 57 | #define ENCODER_OBJECT_ID_CH7303 0x09 |
58 | #define ENCODER_OBJECT_ID_CH7301 0x0A | 58 | #define ENCODER_OBJECT_ID_CH7301 0x0A |
59 | #define ENCODER_OBJECT_ID_INTERNAL_DVO1 0x0B /* This belongs to Radeon Class Display Hardware */ | 59 | #define ENCODER_OBJECT_ID_INTERNAL_DVO1 0x0B /* This belongs to Radeon Class Display Hardware */ |
60 | #define ENCODER_OBJECT_ID_EXTERNAL_SDVOA 0x0C | 60 | #define ENCODER_OBJECT_ID_EXTERNAL_SDVOA 0x0C |
61 | #define ENCODER_OBJECT_ID_EXTERNAL_SDVOB 0x0D | 61 | #define ENCODER_OBJECT_ID_EXTERNAL_SDVOB 0x0D |
62 | #define ENCODER_OBJECT_ID_TITFP513 0x0E | 62 | #define ENCODER_OBJECT_ID_TITFP513 0x0E |
63 | #define ENCODER_OBJECT_ID_INTERNAL_LVTM1 0x0F /* not used for Radeon */ | 63 | #define ENCODER_OBJECT_ID_INTERNAL_LVTM1 0x0F /* not used for Radeon */ |
64 | #define ENCODER_OBJECT_ID_VT1623 0x10 | 64 | #define ENCODER_OBJECT_ID_VT1623 0x10 |
65 | #define ENCODER_OBJECT_ID_HDMI_SI1930 0x11 | 65 | #define ENCODER_OBJECT_ID_HDMI_SI1930 0x11 |
66 | #define ENCODER_OBJECT_ID_HDMI_INTERNAL 0x12 | 66 | #define ENCODER_OBJECT_ID_HDMI_INTERNAL 0x12 |
@@ -68,9 +68,9 @@ | |||
68 | #define ENCODER_OBJECT_ID_INTERNAL_KLDSCP_TMDS1 0x13 | 68 | #define ENCODER_OBJECT_ID_INTERNAL_KLDSCP_TMDS1 0x13 |
69 | #define ENCODER_OBJECT_ID_INTERNAL_KLDSCP_DVO1 0x14 | 69 | #define ENCODER_OBJECT_ID_INTERNAL_KLDSCP_DVO1 0x14 |
70 | #define ENCODER_OBJECT_ID_INTERNAL_KLDSCP_DAC1 0x15 | 70 | #define ENCODER_OBJECT_ID_INTERNAL_KLDSCP_DAC1 0x15 |
71 | #define ENCODER_OBJECT_ID_INTERNAL_KLDSCP_DAC2 0x16 /* Shared with CV/TV and CRT */ | 71 | #define ENCODER_OBJECT_ID_INTERNAL_KLDSCP_DAC2 0x16 /* Shared with CV/TV and CRT */ |
72 | #define ENCODER_OBJECT_ID_SI178 0X17 /* External TMDS (dual link, no HDCP.) */ | 72 | #define ENCODER_OBJECT_ID_SI178 0X17 /* External TMDS (dual link, no HDCP.) */ |
73 | #define ENCODER_OBJECT_ID_MVPU_FPGA 0x18 /* MVPU FPGA chip */ | 73 | #define ENCODER_OBJECT_ID_MVPU_FPGA 0x18 /* MVPU FPGA chip */ |
74 | #define ENCODER_OBJECT_ID_INTERNAL_DDI 0x19 | 74 | #define ENCODER_OBJECT_ID_INTERNAL_DDI 0x19 |
75 | #define ENCODER_OBJECT_ID_VT1625 0x1A | 75 | #define ENCODER_OBJECT_ID_VT1625 0x1A |
76 | #define ENCODER_OBJECT_ID_HDMI_SI1932 0x1B | 76 | #define ENCODER_OBJECT_ID_HDMI_SI1932 0x1B |
@@ -86,7 +86,7 @@ | |||
86 | /****************************************************/ | 86 | /****************************************************/ |
87 | /* Connector Object ID Definition */ | 87 | /* Connector Object ID Definition */ |
88 | /****************************************************/ | 88 | /****************************************************/ |
89 | #define CONNECTOR_OBJECT_ID_NONE 0x00 | 89 | #define CONNECTOR_OBJECT_ID_NONE 0x00 |
90 | #define CONNECTOR_OBJECT_ID_SINGLE_LINK_DVI_I 0x01 | 90 | #define CONNECTOR_OBJECT_ID_SINGLE_LINK_DVI_I 0x01 |
91 | #define CONNECTOR_OBJECT_ID_DUAL_LINK_DVI_I 0x02 | 91 | #define CONNECTOR_OBJECT_ID_DUAL_LINK_DVI_I 0x02 |
92 | #define CONNECTOR_OBJECT_ID_SINGLE_LINK_DVI_D 0x03 | 92 | #define CONNECTOR_OBJECT_ID_SINGLE_LINK_DVI_D 0x03 |
@@ -96,7 +96,7 @@ | |||
96 | #define CONNECTOR_OBJECT_ID_SVIDEO 0x07 | 96 | #define CONNECTOR_OBJECT_ID_SVIDEO 0x07 |
97 | #define CONNECTOR_OBJECT_ID_YPbPr 0x08 | 97 | #define CONNECTOR_OBJECT_ID_YPbPr 0x08 |
98 | #define CONNECTOR_OBJECT_ID_D_CONNECTOR 0x09 | 98 | #define CONNECTOR_OBJECT_ID_D_CONNECTOR 0x09 |
99 | #define CONNECTOR_OBJECT_ID_9PIN_DIN 0x0A /* Supports both CV & TV */ | 99 | #define CONNECTOR_OBJECT_ID_9PIN_DIN 0x0A /* Supports both CV & TV */ |
100 | #define CONNECTOR_OBJECT_ID_SCART 0x0B | 100 | #define CONNECTOR_OBJECT_ID_SCART 0x0B |
101 | #define CONNECTOR_OBJECT_ID_HDMI_TYPE_A 0x0C | 101 | #define CONNECTOR_OBJECT_ID_HDMI_TYPE_A 0x0C |
102 | #define CONNECTOR_OBJECT_ID_HDMI_TYPE_B 0x0D | 102 | #define CONNECTOR_OBJECT_ID_HDMI_TYPE_B 0x0D |
@@ -106,6 +106,8 @@ | |||
106 | #define CONNECTOR_OBJECT_ID_CROSSFIRE 0x11 | 106 | #define CONNECTOR_OBJECT_ID_CROSSFIRE 0x11 |
107 | #define CONNECTOR_OBJECT_ID_HARDCODE_DVI 0x12 | 107 | #define CONNECTOR_OBJECT_ID_HARDCODE_DVI 0x12 |
108 | #define CONNECTOR_OBJECT_ID_DISPLAYPORT 0x13 | 108 | #define CONNECTOR_OBJECT_ID_DISPLAYPORT 0x13 |
109 | #define CONNECTOR_OBJECT_ID_eDP 0x14 | ||
110 | #define CONNECTOR_OBJECT_ID_MXM 0x15 | ||
109 | 111 | ||
110 | /* deleted */ | 112 | /* deleted */ |
111 | 113 | ||
@@ -116,6 +118,14 @@ | |||
116 | #define ROUTER_OBJECT_ID_I2C_EXTENDER_CNTL 0x01 | 118 | #define ROUTER_OBJECT_ID_I2C_EXTENDER_CNTL 0x01 |
117 | 119 | ||
118 | /****************************************************/ | 120 | /****************************************************/ |
121 | /* Generic Object ID Definition */ | ||
122 | /****************************************************/ | ||
123 | #define GENERIC_OBJECT_ID_NONE 0x00 | ||
124 | #define GENERIC_OBJECT_ID_GLSYNC 0x01 | ||
125 | #define GENERIC_OBJECT_ID_PX2_NON_DRIVABLE 0x02 | ||
126 | #define GENERIC_OBJECT_ID_MXM_OPM 0x03 | ||
127 | |||
128 | /****************************************************/ | ||
119 | /* Graphics Object ENUM ID Definition */ | 129 | /* Graphics Object ENUM ID Definition */ |
120 | /****************************************************/ | 130 | /****************************************************/ |
121 | #define GRAPH_OBJECT_ENUM_ID1 0x01 | 131 | #define GRAPH_OBJECT_ENUM_ID1 0x01 |
@@ -124,6 +134,7 @@ | |||
124 | #define GRAPH_OBJECT_ENUM_ID4 0x04 | 134 | #define GRAPH_OBJECT_ENUM_ID4 0x04 |
125 | #define GRAPH_OBJECT_ENUM_ID5 0x05 | 135 | #define GRAPH_OBJECT_ENUM_ID5 0x05 |
126 | #define GRAPH_OBJECT_ENUM_ID6 0x06 | 136 | #define GRAPH_OBJECT_ENUM_ID6 0x06 |
137 | #define GRAPH_OBJECT_ENUM_ID7 0x07 | ||
127 | 138 | ||
128 | /****************************************************/ | 139 | /****************************************************/ |
129 | /* Graphics Object ID Bit definition */ | 140 | /* Graphics Object ID Bit definition */ |
@@ -133,35 +144,35 @@ | |||
133 | #define RESERVED1_ID_MASK 0x0800 | 144 | #define RESERVED1_ID_MASK 0x0800 |
134 | #define OBJECT_TYPE_MASK 0x7000 | 145 | #define OBJECT_TYPE_MASK 0x7000 |
135 | #define RESERVED2_ID_MASK 0x8000 | 146 | #define RESERVED2_ID_MASK 0x8000 |
136 | 147 | ||
137 | #define OBJECT_ID_SHIFT 0x00 | 148 | #define OBJECT_ID_SHIFT 0x00 |
138 | #define ENUM_ID_SHIFT 0x08 | 149 | #define ENUM_ID_SHIFT 0x08 |
139 | #define OBJECT_TYPE_SHIFT 0x0C | 150 | #define OBJECT_TYPE_SHIFT 0x0C |
140 | 151 | ||
152 | |||
141 | /****************************************************/ | 153 | /****************************************************/ |
142 | /* Graphics Object family definition */ | 154 | /* Graphics Object family definition */ |
143 | /****************************************************/ | 155 | /****************************************************/ |
144 | #define CONSTRUCTOBJECTFAMILYID(GRAPHICS_OBJECT_TYPE, GRAPHICS_OBJECT_ID) \ | 156 | #define CONSTRUCTOBJECTFAMILYID(GRAPHICS_OBJECT_TYPE, GRAPHICS_OBJECT_ID) (GRAPHICS_OBJECT_TYPE << OBJECT_TYPE_SHIFT | \ |
145 | (GRAPHICS_OBJECT_TYPE << OBJECT_TYPE_SHIFT | \ | 157 | GRAPHICS_OBJECT_ID << OBJECT_ID_SHIFT) |
146 | GRAPHICS_OBJECT_ID << OBJECT_ID_SHIFT) | ||
147 | /****************************************************/ | 158 | /****************************************************/ |
148 | /* GPU Object ID definition - Shared with BIOS */ | 159 | /* GPU Object ID definition - Shared with BIOS */ |
149 | /****************************************************/ | 160 | /****************************************************/ |
150 | #define GPU_ENUM_ID1 (GRAPH_OBJECT_TYPE_GPU << OBJECT_TYPE_SHIFT |\ | 161 | #define GPU_ENUM_ID1 ( GRAPH_OBJECT_TYPE_GPU << OBJECT_TYPE_SHIFT |\ |
151 | GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT) | 162 | GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT) |
152 | 163 | ||
153 | /****************************************************/ | 164 | /****************************************************/ |
154 | /* Encoder Object ID definition - Shared with BIOS */ | 165 | /* Encoder Object ID definition - Shared with BIOS */ |
155 | /****************************************************/ | 166 | /****************************************************/ |
156 | /* | 167 | /* |
157 | #define ENCODER_INTERNAL_LVDS_ENUM_ID1 0x2101 | 168 | #define ENCODER_INTERNAL_LVDS_ENUM_ID1 0x2101 |
158 | #define ENCODER_INTERNAL_TMDS1_ENUM_ID1 0x2102 | 169 | #define ENCODER_INTERNAL_TMDS1_ENUM_ID1 0x2102 |
159 | #define ENCODER_INTERNAL_TMDS2_ENUM_ID1 0x2103 | 170 | #define ENCODER_INTERNAL_TMDS2_ENUM_ID1 0x2103 |
160 | #define ENCODER_INTERNAL_DAC1_ENUM_ID1 0x2104 | 171 | #define ENCODER_INTERNAL_DAC1_ENUM_ID1 0x2104 |
161 | #define ENCODER_INTERNAL_DAC2_ENUM_ID1 0x2105 | 172 | #define ENCODER_INTERNAL_DAC2_ENUM_ID1 0x2105 |
162 | #define ENCODER_INTERNAL_SDVOA_ENUM_ID1 0x2106 | 173 | #define ENCODER_INTERNAL_SDVOA_ENUM_ID1 0x2106 |
163 | #define ENCODER_INTERNAL_SDVOB_ENUM_ID1 0x2107 | 174 | #define ENCODER_INTERNAL_SDVOB_ENUM_ID1 0x2107 |
164 | #define ENCODER_SIL170B_ENUM_ID1 0x2108 | 175 | #define ENCODER_SIL170B_ENUM_ID1 0x2108 |
165 | #define ENCODER_CH7303_ENUM_ID1 0x2109 | 176 | #define ENCODER_CH7303_ENUM_ID1 0x2109 |
166 | #define ENCODER_CH7301_ENUM_ID1 0x210A | 177 | #define ENCODER_CH7301_ENUM_ID1 0x210A |
167 | #define ENCODER_INTERNAL_DVO1_ENUM_ID1 0x210B | 178 | #define ENCODER_INTERNAL_DVO1_ENUM_ID1 0x210B |
@@ -175,8 +186,8 @@ | |||
175 | #define ENCODER_INTERNAL_KLDSCP_TMDS1_ENUM_ID1 0x2113 | 186 | #define ENCODER_INTERNAL_KLDSCP_TMDS1_ENUM_ID1 0x2113 |
176 | #define ENCODER_INTERNAL_KLDSCP_DVO1_ENUM_ID1 0x2114 | 187 | #define ENCODER_INTERNAL_KLDSCP_DVO1_ENUM_ID1 0x2114 |
177 | #define ENCODER_INTERNAL_KLDSCP_DAC1_ENUM_ID1 0x2115 | 188 | #define ENCODER_INTERNAL_KLDSCP_DAC1_ENUM_ID1 0x2115 |
178 | #define ENCODER_INTERNAL_KLDSCP_DAC2_ENUM_ID1 0x2116 | 189 | #define ENCODER_INTERNAL_KLDSCP_DAC2_ENUM_ID1 0x2116 |
179 | #define ENCODER_SI178_ENUM_ID1 0x2117 | 190 | #define ENCODER_SI178_ENUM_ID1 0x2117 |
180 | #define ENCODER_MVPU_FPGA_ENUM_ID1 0x2118 | 191 | #define ENCODER_MVPU_FPGA_ENUM_ID1 0x2118 |
181 | #define ENCODER_INTERNAL_DDI_ENUM_ID1 0x2119 | 192 | #define ENCODER_INTERNAL_DDI_ENUM_ID1 0x2119 |
182 | #define ENCODER_VT1625_ENUM_ID1 0x211A | 193 | #define ENCODER_VT1625_ENUM_ID1 0x211A |
@@ -185,205 +196,169 @@ | |||
185 | #define ENCODER_DP_DP501_ENUM_ID1 0x211D | 196 | #define ENCODER_DP_DP501_ENUM_ID1 0x211D |
186 | #define ENCODER_INTERNAL_UNIPHY_ENUM_ID1 0x211E | 197 | #define ENCODER_INTERNAL_UNIPHY_ENUM_ID1 0x211E |
187 | */ | 198 | */ |
188 | #define ENCODER_INTERNAL_LVDS_ENUM_ID1 \ | 199 | #define ENCODER_INTERNAL_LVDS_ENUM_ID1 ( GRAPH_OBJECT_TYPE_ENCODER << OBJECT_TYPE_SHIFT |\ |
189 | (GRAPH_OBJECT_TYPE_ENCODER << OBJECT_TYPE_SHIFT |\ | 200 | GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\ |
190 | GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\ | 201 | ENCODER_OBJECT_ID_INTERNAL_LVDS << OBJECT_ID_SHIFT) |
191 | ENCODER_OBJECT_ID_INTERNAL_LVDS << OBJECT_ID_SHIFT) | 202 | |
192 | 203 | #define ENCODER_INTERNAL_TMDS1_ENUM_ID1 ( GRAPH_OBJECT_TYPE_ENCODER << OBJECT_TYPE_SHIFT |\ | |
193 | #define ENCODER_INTERNAL_TMDS1_ENUM_ID1 \ | 204 | GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\ |
194 | (GRAPH_OBJECT_TYPE_ENCODER << OBJECT_TYPE_SHIFT |\ | 205 | ENCODER_OBJECT_ID_INTERNAL_TMDS1 << OBJECT_ID_SHIFT) |
195 | GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\ | 206 | |
196 | ENCODER_OBJECT_ID_INTERNAL_TMDS1 << OBJECT_ID_SHIFT) | 207 | #define ENCODER_INTERNAL_TMDS2_ENUM_ID1 ( GRAPH_OBJECT_TYPE_ENCODER << OBJECT_TYPE_SHIFT |\ |
197 | 208 | GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\ | |
198 | #define ENCODER_INTERNAL_TMDS2_ENUM_ID1 \ | 209 | ENCODER_OBJECT_ID_INTERNAL_TMDS2 << OBJECT_ID_SHIFT) |
199 | (GRAPH_OBJECT_TYPE_ENCODER << OBJECT_TYPE_SHIFT |\ | 210 | |
200 | GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\ | 211 | #define ENCODER_INTERNAL_DAC1_ENUM_ID1 ( GRAPH_OBJECT_TYPE_ENCODER << OBJECT_TYPE_SHIFT |\ |
201 | ENCODER_OBJECT_ID_INTERNAL_TMDS2 << OBJECT_ID_SHIFT) | 212 | GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\ |
202 | 213 | ENCODER_OBJECT_ID_INTERNAL_DAC1 << OBJECT_ID_SHIFT) | |
203 | #define ENCODER_INTERNAL_DAC1_ENUM_ID1 \ | 214 | |
204 | (GRAPH_OBJECT_TYPE_ENCODER << OBJECT_TYPE_SHIFT |\ | 215 | #define ENCODER_INTERNAL_DAC2_ENUM_ID1 ( GRAPH_OBJECT_TYPE_ENCODER << OBJECT_TYPE_SHIFT |\ |
205 | GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\ | 216 | GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\ |
206 | ENCODER_OBJECT_ID_INTERNAL_DAC1 << OBJECT_ID_SHIFT) | 217 | ENCODER_OBJECT_ID_INTERNAL_DAC2 << OBJECT_ID_SHIFT) |
207 | 218 | ||
208 | #define ENCODER_INTERNAL_DAC2_ENUM_ID1 \ | 219 | #define ENCODER_INTERNAL_SDVOA_ENUM_ID1 ( GRAPH_OBJECT_TYPE_ENCODER << OBJECT_TYPE_SHIFT |\ |
209 | (GRAPH_OBJECT_TYPE_ENCODER << OBJECT_TYPE_SHIFT |\ | 220 | GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\ |
210 | GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\ | 221 | ENCODER_OBJECT_ID_INTERNAL_SDVOA << OBJECT_ID_SHIFT) |
211 | ENCODER_OBJECT_ID_INTERNAL_DAC2 << OBJECT_ID_SHIFT) | 222 | |
212 | 223 | #define ENCODER_INTERNAL_SDVOA_ENUM_ID2 ( GRAPH_OBJECT_TYPE_ENCODER << OBJECT_TYPE_SHIFT |\ | |
213 | #define ENCODER_INTERNAL_SDVOA_ENUM_ID1 \ | 224 | GRAPH_OBJECT_ENUM_ID2 << ENUM_ID_SHIFT |\ |
214 | (GRAPH_OBJECT_TYPE_ENCODER << OBJECT_TYPE_SHIFT |\ | 225 | ENCODER_OBJECT_ID_INTERNAL_SDVOA << OBJECT_ID_SHIFT) |
215 | GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\ | 226 | |
216 | ENCODER_OBJECT_ID_INTERNAL_SDVOA << OBJECT_ID_SHIFT) | 227 | #define ENCODER_INTERNAL_SDVOB_ENUM_ID1 ( GRAPH_OBJECT_TYPE_ENCODER << OBJECT_TYPE_SHIFT |\ |
217 | 228 | GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\ | |
218 | #define ENCODER_INTERNAL_SDVOA_ENUM_ID2 \ | 229 | ENCODER_OBJECT_ID_INTERNAL_SDVOB << OBJECT_ID_SHIFT) |
219 | (GRAPH_OBJECT_TYPE_ENCODER << OBJECT_TYPE_SHIFT |\ | 230 | |
220 | GRAPH_OBJECT_ENUM_ID2 << ENUM_ID_SHIFT |\ | 231 | #define ENCODER_SIL170B_ENUM_ID1 ( GRAPH_OBJECT_TYPE_ENCODER << OBJECT_TYPE_SHIFT |\ |
221 | ENCODER_OBJECT_ID_INTERNAL_SDVOA << OBJECT_ID_SHIFT) | 232 | GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\ |
222 | 233 | ENCODER_OBJECT_ID_SI170B << OBJECT_ID_SHIFT) | |
223 | #define ENCODER_INTERNAL_SDVOB_ENUM_ID1 \ | 234 | |
224 | (GRAPH_OBJECT_TYPE_ENCODER << OBJECT_TYPE_SHIFT |\ | 235 | #define ENCODER_CH7303_ENUM_ID1 ( GRAPH_OBJECT_TYPE_ENCODER << OBJECT_TYPE_SHIFT |\ |
225 | GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\ | 236 | GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\ |
226 | ENCODER_OBJECT_ID_INTERNAL_SDVOB << OBJECT_ID_SHIFT) | 237 | ENCODER_OBJECT_ID_CH7303 << OBJECT_ID_SHIFT) |
227 | 238 | ||
228 | #define ENCODER_SIL170B_ENUM_ID1 \ | 239 | #define ENCODER_CH7301_ENUM_ID1 ( GRAPH_OBJECT_TYPE_ENCODER << OBJECT_TYPE_SHIFT |\ |
229 | (GRAPH_OBJECT_TYPE_ENCODER << OBJECT_TYPE_SHIFT |\ | 240 | GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\ |
230 | GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\ | 241 | ENCODER_OBJECT_ID_CH7301 << OBJECT_ID_SHIFT) |
231 | ENCODER_OBJECT_ID_SI170B << OBJECT_ID_SHIFT) | 242 | |
232 | 243 | #define ENCODER_INTERNAL_DVO1_ENUM_ID1 ( GRAPH_OBJECT_TYPE_ENCODER << OBJECT_TYPE_SHIFT |\ | |
233 | #define ENCODER_CH7303_ENUM_ID1 \ | 244 | GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\ |
234 | (GRAPH_OBJECT_TYPE_ENCODER << OBJECT_TYPE_SHIFT |\ | 245 | ENCODER_OBJECT_ID_INTERNAL_DVO1 << OBJECT_ID_SHIFT) |
235 | GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\ | 246 | |
236 | ENCODER_OBJECT_ID_CH7303 << OBJECT_ID_SHIFT) | 247 | #define ENCODER_EXTERNAL_SDVOA_ENUM_ID1 ( GRAPH_OBJECT_TYPE_ENCODER << OBJECT_TYPE_SHIFT |\ |
237 | 248 | GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\ | |
238 | #define ENCODER_CH7301_ENUM_ID1 \ | 249 | ENCODER_OBJECT_ID_EXTERNAL_SDVOA << OBJECT_ID_SHIFT) |
239 | (GRAPH_OBJECT_TYPE_ENCODER << OBJECT_TYPE_SHIFT |\ | 250 | |
240 | GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\ | 251 | #define ENCODER_EXTERNAL_SDVOA_ENUM_ID2 ( GRAPH_OBJECT_TYPE_ENCODER << OBJECT_TYPE_SHIFT |\ |
241 | ENCODER_OBJECT_ID_CH7301 << OBJECT_ID_SHIFT) | 252 | GRAPH_OBJECT_ENUM_ID2 << ENUM_ID_SHIFT |\ |
242 | 253 | ENCODER_OBJECT_ID_EXTERNAL_SDVOA << OBJECT_ID_SHIFT) | |
243 | #define ENCODER_INTERNAL_DVO1_ENUM_ID1 \ | 254 | |
244 | (GRAPH_OBJECT_TYPE_ENCODER << OBJECT_TYPE_SHIFT |\ | 255 | |
245 | GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\ | 256 | #define ENCODER_EXTERNAL_SDVOB_ENUM_ID1 ( GRAPH_OBJECT_TYPE_ENCODER << OBJECT_TYPE_SHIFT |\ |
246 | ENCODER_OBJECT_ID_INTERNAL_DVO1 << OBJECT_ID_SHIFT) | 257 | GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\ |
247 | 258 | ENCODER_OBJECT_ID_EXTERNAL_SDVOB << OBJECT_ID_SHIFT) | |
248 | #define ENCODER_EXTERNAL_SDVOA_ENUM_ID1 \ | 259 | |
249 | (GRAPH_OBJECT_TYPE_ENCODER << OBJECT_TYPE_SHIFT |\ | 260 | |
250 | GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\ | 261 | #define ENCODER_TITFP513_ENUM_ID1 ( GRAPH_OBJECT_TYPE_ENCODER << OBJECT_TYPE_SHIFT |\ |
251 | ENCODER_OBJECT_ID_EXTERNAL_SDVOA << OBJECT_ID_SHIFT) | 262 | GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\ |
252 | 263 | ENCODER_OBJECT_ID_TITFP513 << OBJECT_ID_SHIFT) | |
253 | #define ENCODER_EXTERNAL_SDVOA_ENUM_ID2 \ | 264 | |
254 | (GRAPH_OBJECT_TYPE_ENCODER << OBJECT_TYPE_SHIFT |\ | 265 | #define ENCODER_INTERNAL_LVTM1_ENUM_ID1 ( GRAPH_OBJECT_TYPE_ENCODER << OBJECT_TYPE_SHIFT |\ |
255 | GRAPH_OBJECT_ENUM_ID2 << ENUM_ID_SHIFT |\ | 266 | GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\ |
256 | ENCODER_OBJECT_ID_EXTERNAL_SDVOA << OBJECT_ID_SHIFT) | 267 | ENCODER_OBJECT_ID_INTERNAL_LVTM1 << OBJECT_ID_SHIFT) |
257 | 268 | ||
258 | #define ENCODER_EXTERNAL_SDVOB_ENUM_ID1 \ | 269 | #define ENCODER_VT1623_ENUM_ID1 ( GRAPH_OBJECT_TYPE_ENCODER << OBJECT_TYPE_SHIFT |\ |
259 | (GRAPH_OBJECT_TYPE_ENCODER << OBJECT_TYPE_SHIFT |\ | 270 | GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\ |
260 | GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\ | 271 | ENCODER_OBJECT_ID_VT1623 << OBJECT_ID_SHIFT) |
261 | ENCODER_OBJECT_ID_EXTERNAL_SDVOB << OBJECT_ID_SHIFT) | 272 | |
262 | 273 | #define ENCODER_HDMI_SI1930_ENUM_ID1 ( GRAPH_OBJECT_TYPE_ENCODER << OBJECT_TYPE_SHIFT |\ | |
263 | #define ENCODER_TITFP513_ENUM_ID1 \ | 274 | GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\ |
264 | (GRAPH_OBJECT_TYPE_ENCODER << OBJECT_TYPE_SHIFT |\ | 275 | ENCODER_OBJECT_ID_HDMI_SI1930 << OBJECT_ID_SHIFT) |
265 | GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\ | 276 | |
266 | ENCODER_OBJECT_ID_TITFP513 << OBJECT_ID_SHIFT) | 277 | #define ENCODER_HDMI_INTERNAL_ENUM_ID1 ( GRAPH_OBJECT_TYPE_ENCODER << OBJECT_TYPE_SHIFT |\ |
267 | 278 | GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\ | |
268 | #define ENCODER_INTERNAL_LVTM1_ENUM_ID1 \ | 279 | ENCODER_OBJECT_ID_HDMI_INTERNAL << OBJECT_ID_SHIFT) |
269 | (GRAPH_OBJECT_TYPE_ENCODER << OBJECT_TYPE_SHIFT |\ | 280 | |
270 | GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\ | 281 | #define ENCODER_INTERNAL_KLDSCP_TMDS1_ENUM_ID1 ( GRAPH_OBJECT_TYPE_ENCODER << OBJECT_TYPE_SHIFT |\ |
271 | ENCODER_OBJECT_ID_INTERNAL_LVTM1 << OBJECT_ID_SHIFT) | 282 | GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\ |
272 | 283 | ENCODER_OBJECT_ID_INTERNAL_KLDSCP_TMDS1 << OBJECT_ID_SHIFT) | |
273 | #define ENCODER_VT1623_ENUM_ID1 \ | 284 | |
274 | (GRAPH_OBJECT_TYPE_ENCODER << OBJECT_TYPE_SHIFT |\ | 285 | |
275 | GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\ | 286 | #define ENCODER_INTERNAL_KLDSCP_TMDS1_ENUM_ID2 ( GRAPH_OBJECT_TYPE_ENCODER << OBJECT_TYPE_SHIFT |\ |
276 | ENCODER_OBJECT_ID_VT1623 << OBJECT_ID_SHIFT) | 287 | GRAPH_OBJECT_ENUM_ID2 << ENUM_ID_SHIFT |\ |
277 | 288 | ENCODER_OBJECT_ID_INTERNAL_KLDSCP_TMDS1 << OBJECT_ID_SHIFT) | |
278 | #define ENCODER_HDMI_SI1930_ENUM_ID1 \ | 289 | |
279 | (GRAPH_OBJECT_TYPE_ENCODER << OBJECT_TYPE_SHIFT |\ | 290 | |
280 | GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\ | 291 | #define ENCODER_INTERNAL_KLDSCP_DVO1_ENUM_ID1 ( GRAPH_OBJECT_TYPE_ENCODER << OBJECT_TYPE_SHIFT |\ |
281 | ENCODER_OBJECT_ID_HDMI_SI1930 << OBJECT_ID_SHIFT) | 292 | GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\ |
282 | 293 | ENCODER_OBJECT_ID_INTERNAL_KLDSCP_DVO1 << OBJECT_ID_SHIFT) | |
283 | #define ENCODER_HDMI_INTERNAL_ENUM_ID1 \ | 294 | |
284 | (GRAPH_OBJECT_TYPE_ENCODER << OBJECT_TYPE_SHIFT |\ | 295 | #define ENCODER_INTERNAL_KLDSCP_DAC1_ENUM_ID1 ( GRAPH_OBJECT_TYPE_ENCODER << OBJECT_TYPE_SHIFT |\ |
285 | GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\ | 296 | GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\ |
286 | ENCODER_OBJECT_ID_HDMI_INTERNAL << OBJECT_ID_SHIFT) | 297 | ENCODER_OBJECT_ID_INTERNAL_KLDSCP_DAC1 << OBJECT_ID_SHIFT) |
287 | 298 | ||
288 | #define ENCODER_INTERNAL_KLDSCP_TMDS1_ENUM_ID1 \ | 299 | #define ENCODER_INTERNAL_KLDSCP_DAC2_ENUM_ID1 ( GRAPH_OBJECT_TYPE_ENCODER << OBJECT_TYPE_SHIFT |\ |
289 | (GRAPH_OBJECT_TYPE_ENCODER << OBJECT_TYPE_SHIFT |\ | 300 | GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\ |
290 | GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\ | 301 | ENCODER_OBJECT_ID_INTERNAL_KLDSCP_DAC2 << OBJECT_ID_SHIFT) // Shared with CV/TV and CRT |
291 | ENCODER_OBJECT_ID_INTERNAL_KLDSCP_TMDS1 << OBJECT_ID_SHIFT) | 302 | |
292 | 303 | #define ENCODER_SI178_ENUM_ID1 ( GRAPH_OBJECT_TYPE_ENCODER << OBJECT_TYPE_SHIFT |\ | |
293 | #define ENCODER_INTERNAL_KLDSCP_TMDS1_ENUM_ID2 \ | 304 | GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\ |
294 | (GRAPH_OBJECT_TYPE_ENCODER << OBJECT_TYPE_SHIFT |\ | 305 | ENCODER_OBJECT_ID_SI178 << OBJECT_ID_SHIFT) |
295 | GRAPH_OBJECT_ENUM_ID2 << ENUM_ID_SHIFT |\ | 306 | |
296 | ENCODER_OBJECT_ID_INTERNAL_KLDSCP_TMDS1 << OBJECT_ID_SHIFT) | 307 | #define ENCODER_MVPU_FPGA_ENUM_ID1 ( GRAPH_OBJECT_TYPE_ENCODER << OBJECT_TYPE_SHIFT |\ |
297 | 308 | GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\ | |
298 | #define ENCODER_INTERNAL_KLDSCP_DVO1_ENUM_ID1 \ | 309 | ENCODER_OBJECT_ID_MVPU_FPGA << OBJECT_ID_SHIFT) |
299 | (GRAPH_OBJECT_TYPE_ENCODER << OBJECT_TYPE_SHIFT |\ | 310 | |
300 | GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\ | 311 | #define ENCODER_INTERNAL_DDI_ENUM_ID1 ( GRAPH_OBJECT_TYPE_ENCODER << OBJECT_TYPE_SHIFT |\ |
301 | ENCODER_OBJECT_ID_INTERNAL_KLDSCP_DVO1 << OBJECT_ID_SHIFT) | 312 | GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\ |
302 | 313 | ENCODER_OBJECT_ID_INTERNAL_DDI << OBJECT_ID_SHIFT) | |
303 | #define ENCODER_INTERNAL_KLDSCP_DAC1_ENUM_ID1 \ | 314 | |
304 | (GRAPH_OBJECT_TYPE_ENCODER << OBJECT_TYPE_SHIFT |\ | 315 | #define ENCODER_VT1625_ENUM_ID1 ( GRAPH_OBJECT_TYPE_ENCODER << OBJECT_TYPE_SHIFT |\ |
305 | GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\ | 316 | GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\ |
306 | ENCODER_OBJECT_ID_INTERNAL_KLDSCP_DAC1 << OBJECT_ID_SHIFT) | 317 | ENCODER_OBJECT_ID_VT1625 << OBJECT_ID_SHIFT) |
307 | 318 | ||
308 | #define ENCODER_INTERNAL_KLDSCP_DAC2_ENUM_ID1 \ | 319 | #define ENCODER_HDMI_SI1932_ENUM_ID1 ( GRAPH_OBJECT_TYPE_ENCODER << OBJECT_TYPE_SHIFT |\ |
309 | (GRAPH_OBJECT_TYPE_ENCODER << OBJECT_TYPE_SHIFT |\ | 320 | GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\ |
310 | GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\ | 321 | ENCODER_OBJECT_ID_HDMI_SI1932 << OBJECT_ID_SHIFT) |
311 | ENCODER_OBJECT_ID_INTERNAL_KLDSCP_DAC2 << OBJECT_ID_SHIFT) /* Shared with CV/TV and CRT */ | 322 | |
312 | 323 | #define ENCODER_DP_DP501_ENUM_ID1 ( GRAPH_OBJECT_TYPE_ENCODER << OBJECT_TYPE_SHIFT |\ | |
313 | #define ENCODER_SI178_ENUM_ID1 \ | 324 | GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\ |
314 | (GRAPH_OBJECT_TYPE_ENCODER << OBJECT_TYPE_SHIFT |\ | 325 | ENCODER_OBJECT_ID_DP_DP501 << OBJECT_ID_SHIFT) |
315 | GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\ | 326 | |
316 | ENCODER_OBJECT_ID_SI178 << OBJECT_ID_SHIFT) | 327 | #define ENCODER_DP_AN9801_ENUM_ID1 ( GRAPH_OBJECT_TYPE_ENCODER << OBJECT_TYPE_SHIFT |\ |
317 | 328 | GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\ | |
318 | #define ENCODER_MVPU_FPGA_ENUM_ID1 \ | 329 | ENCODER_OBJECT_ID_DP_AN9801 << OBJECT_ID_SHIFT) |
319 | (GRAPH_OBJECT_TYPE_ENCODER << OBJECT_TYPE_SHIFT |\ | 330 | |
320 | GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\ | 331 | #define ENCODER_INTERNAL_UNIPHY_ENUM_ID1 ( GRAPH_OBJECT_TYPE_ENCODER << OBJECT_TYPE_SHIFT |\ |
321 | ENCODER_OBJECT_ID_MVPU_FPGA << OBJECT_ID_SHIFT) | 332 | GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\ |
322 | 333 | ENCODER_OBJECT_ID_INTERNAL_UNIPHY << OBJECT_ID_SHIFT) | |
323 | #define ENCODER_INTERNAL_DDI_ENUM_ID1 \ | 334 | |
324 | (GRAPH_OBJECT_TYPE_ENCODER << OBJECT_TYPE_SHIFT |\ | 335 | #define ENCODER_INTERNAL_UNIPHY_ENUM_ID2 ( GRAPH_OBJECT_TYPE_ENCODER << OBJECT_TYPE_SHIFT |\ |
325 | GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\ | 336 | GRAPH_OBJECT_ENUM_ID2 << ENUM_ID_SHIFT |\ |
326 | ENCODER_OBJECT_ID_INTERNAL_DDI << OBJECT_ID_SHIFT) | 337 | ENCODER_OBJECT_ID_INTERNAL_UNIPHY << OBJECT_ID_SHIFT) |
327 | 338 | ||
328 | #define ENCODER_VT1625_ENUM_ID1 \ | 339 | #define ENCODER_INTERNAL_KLDSCP_LVTMA_ENUM_ID1 ( GRAPH_OBJECT_TYPE_ENCODER << OBJECT_TYPE_SHIFT |\ |
329 | (GRAPH_OBJECT_TYPE_ENCODER << OBJECT_TYPE_SHIFT |\ | 340 | GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\ |
330 | GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\ | 341 | ENCODER_OBJECT_ID_INTERNAL_KLDSCP_LVTMA << OBJECT_ID_SHIFT) |
331 | ENCODER_OBJECT_ID_VT1625 << OBJECT_ID_SHIFT) | 342 | |
332 | 343 | #define ENCODER_INTERNAL_UNIPHY1_ENUM_ID1 ( GRAPH_OBJECT_TYPE_ENCODER << OBJECT_TYPE_SHIFT |\ | |
333 | #define ENCODER_HDMI_SI1932_ENUM_ID1 \ | 344 | GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\ |
334 | (GRAPH_OBJECT_TYPE_ENCODER << OBJECT_TYPE_SHIFT |\ | 345 | ENCODER_OBJECT_ID_INTERNAL_UNIPHY1 << OBJECT_ID_SHIFT) |
335 | GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\ | 346 | |
336 | ENCODER_OBJECT_ID_HDMI_SI1932 << OBJECT_ID_SHIFT) | 347 | #define ENCODER_INTERNAL_UNIPHY1_ENUM_ID2 ( GRAPH_OBJECT_TYPE_ENCODER << OBJECT_TYPE_SHIFT |\ |
337 | 348 | GRAPH_OBJECT_ENUM_ID2 << ENUM_ID_SHIFT |\ | |
338 | #define ENCODER_DP_DP501_ENUM_ID1 \ | 349 | ENCODER_OBJECT_ID_INTERNAL_UNIPHY1 << OBJECT_ID_SHIFT) |
339 | (GRAPH_OBJECT_TYPE_ENCODER << OBJECT_TYPE_SHIFT |\ | 350 | |
340 | GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\ | 351 | #define ENCODER_INTERNAL_UNIPHY2_ENUM_ID1 ( GRAPH_OBJECT_TYPE_ENCODER << OBJECT_TYPE_SHIFT |\ |
341 | ENCODER_OBJECT_ID_DP_DP501 << OBJECT_ID_SHIFT) | 352 | GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\ |
342 | 353 | ENCODER_OBJECT_ID_INTERNAL_UNIPHY2 << OBJECT_ID_SHIFT) | |
343 | #define ENCODER_DP_AN9801_ENUM_ID1 \ | 354 | |
344 | (GRAPH_OBJECT_TYPE_ENCODER << OBJECT_TYPE_SHIFT |\ | 355 | #define ENCODER_INTERNAL_UNIPHY2_ENUM_ID2 ( GRAPH_OBJECT_TYPE_ENCODER << OBJECT_TYPE_SHIFT |\ |
345 | GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\ | 356 | GRAPH_OBJECT_ENUM_ID2 << ENUM_ID_SHIFT |\ |
346 | ENCODER_OBJECT_ID_DP_AN9801 << OBJECT_ID_SHIFT) | 357 | ENCODER_OBJECT_ID_INTERNAL_UNIPHY2 << OBJECT_ID_SHIFT) |
347 | 358 | ||
348 | #define ENCODER_INTERNAL_UNIPHY_ENUM_ID1 \ | 359 | #define ENCODER_GENERAL_EXTERNAL_DVO_ENUM_ID1 ( GRAPH_OBJECT_TYPE_ENCODER << OBJECT_TYPE_SHIFT |\ |
349 | (GRAPH_OBJECT_TYPE_ENCODER << OBJECT_TYPE_SHIFT |\ | 360 | GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\ |
350 | GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\ | 361 | ENCODER_OBJECT_ID_GENERAL_EXTERNAL_DVO << OBJECT_ID_SHIFT) |
351 | ENCODER_OBJECT_ID_INTERNAL_UNIPHY << OBJECT_ID_SHIFT) | ||
352 | |||
353 | #define ENCODER_INTERNAL_UNIPHY_ENUM_ID2 \ | ||
354 | (GRAPH_OBJECT_TYPE_ENCODER << OBJECT_TYPE_SHIFT |\ | ||
355 | GRAPH_OBJECT_ENUM_ID2 << ENUM_ID_SHIFT |\ | ||
356 | ENCODER_OBJECT_ID_INTERNAL_UNIPHY << OBJECT_ID_SHIFT) | ||
357 | |||
358 | #define ENCODER_INTERNAL_KLDSCP_LVTMA_ENUM_ID1 \ | ||
359 | (GRAPH_OBJECT_TYPE_ENCODER << OBJECT_TYPE_SHIFT |\ | ||
360 | GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\ | ||
361 | ENCODER_OBJECT_ID_INTERNAL_KLDSCP_LVTMA << OBJECT_ID_SHIFT) | ||
362 | |||
363 | #define ENCODER_INTERNAL_UNIPHY1_ENUM_ID1 \ | ||
364 | (GRAPH_OBJECT_TYPE_ENCODER << OBJECT_TYPE_SHIFT |\ | ||
365 | GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\ | ||
366 | ENCODER_OBJECT_ID_INTERNAL_UNIPHY1 << OBJECT_ID_SHIFT) | ||
367 | |||
368 | #define ENCODER_INTERNAL_UNIPHY1_ENUM_ID2 \ | ||
369 | (GRAPH_OBJECT_TYPE_ENCODER << OBJECT_TYPE_SHIFT |\ | ||
370 | GRAPH_OBJECT_ENUM_ID2 << ENUM_ID_SHIFT |\ | ||
371 | ENCODER_OBJECT_ID_INTERNAL_UNIPHY1 << OBJECT_ID_SHIFT) | ||
372 | |||
373 | #define ENCODER_INTERNAL_UNIPHY2_ENUM_ID1 \ | ||
374 | (GRAPH_OBJECT_TYPE_ENCODER << OBJECT_TYPE_SHIFT |\ | ||
375 | GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\ | ||
376 | ENCODER_OBJECT_ID_INTERNAL_UNIPHY2 << OBJECT_ID_SHIFT) | ||
377 | |||
378 | #define ENCODER_INTERNAL_UNIPHY2_ENUM_ID2 \ | ||
379 | (GRAPH_OBJECT_TYPE_ENCODER << OBJECT_TYPE_SHIFT |\ | ||
380 | GRAPH_OBJECT_ENUM_ID2 << ENUM_ID_SHIFT |\ | ||
381 | ENCODER_OBJECT_ID_INTERNAL_UNIPHY2 << OBJECT_ID_SHIFT) | ||
382 | |||
383 | #define ENCODER_GENERAL_EXTERNAL_DVO_ENUM_ID1 \ | ||
384 | (GRAPH_OBJECT_TYPE_ENCODER << OBJECT_TYPE_SHIFT |\ | ||
385 | GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\ | ||
386 | ENCODER_OBJECT_ID_GENERAL_EXTERNAL_DVO << OBJECT_ID_SHIFT) | ||
387 | 362 | ||
388 | /****************************************************/ | 363 | /****************************************************/ |
389 | /* Connector Object ID definition - Shared with BIOS */ | 364 | /* Connector Object ID definition - Shared with BIOS */ |
@@ -406,167 +381,253 @@ | |||
406 | #define CONNECTOR_7PIN_DIN_ENUM_ID1 0x310F | 381 | #define CONNECTOR_7PIN_DIN_ENUM_ID1 0x310F |
407 | #define CONNECTOR_PCIE_CONNECTOR_ENUM_ID1 0x3110 | 382 | #define CONNECTOR_PCIE_CONNECTOR_ENUM_ID1 0x3110 |
408 | */ | 383 | */ |
409 | #define CONNECTOR_LVDS_ENUM_ID1 \ | 384 | #define CONNECTOR_LVDS_ENUM_ID1 ( GRAPH_OBJECT_TYPE_CONNECTOR << OBJECT_TYPE_SHIFT |\ |
410 | (GRAPH_OBJECT_TYPE_CONNECTOR << OBJECT_TYPE_SHIFT |\ | 385 | GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\ |
411 | GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\ | 386 | CONNECTOR_OBJECT_ID_LVDS << OBJECT_ID_SHIFT) |
412 | CONNECTOR_OBJECT_ID_LVDS << OBJECT_ID_SHIFT) | 387 | |
413 | 388 | #define CONNECTOR_LVDS_ENUM_ID2 ( GRAPH_OBJECT_TYPE_CONNECTOR << OBJECT_TYPE_SHIFT |\ | |
414 | #define CONNECTOR_SINGLE_LINK_DVI_I_ENUM_ID1 \ | 389 | GRAPH_OBJECT_ENUM_ID2 << ENUM_ID_SHIFT |\ |
415 | (GRAPH_OBJECT_TYPE_CONNECTOR << OBJECT_TYPE_SHIFT |\ | 390 | CONNECTOR_OBJECT_ID_LVDS << OBJECT_ID_SHIFT) |
416 | GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\ | 391 | |
417 | CONNECTOR_OBJECT_ID_SINGLE_LINK_DVI_I << OBJECT_ID_SHIFT) | 392 | #define CONNECTOR_eDP_ENUM_ID1 ( GRAPH_OBJECT_TYPE_CONNECTOR << OBJECT_TYPE_SHIFT |\ |
418 | 393 | GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\ | |
419 | #define CONNECTOR_SINGLE_LINK_DVI_I_ENUM_ID2 \ | 394 | CONNECTOR_OBJECT_ID_eDP << OBJECT_ID_SHIFT) |
420 | (GRAPH_OBJECT_TYPE_CONNECTOR << OBJECT_TYPE_SHIFT |\ | 395 | |
421 | GRAPH_OBJECT_ENUM_ID2 << ENUM_ID_SHIFT |\ | 396 | #define CONNECTOR_eDP_ENUM_ID2 ( GRAPH_OBJECT_TYPE_CONNECTOR << OBJECT_TYPE_SHIFT |\ |
422 | CONNECTOR_OBJECT_ID_SINGLE_LINK_DVI_I << OBJECT_ID_SHIFT) | 397 | GRAPH_OBJECT_ENUM_ID2 << ENUM_ID_SHIFT |\ |
423 | 398 | CONNECTOR_OBJECT_ID_eDP << OBJECT_ID_SHIFT) | |
424 | #define CONNECTOR_DUAL_LINK_DVI_I_ENUM_ID1 \ | 399 | |
425 | (GRAPH_OBJECT_TYPE_CONNECTOR << OBJECT_TYPE_SHIFT |\ | 400 | #define CONNECTOR_SINGLE_LINK_DVI_I_ENUM_ID1 ( GRAPH_OBJECT_TYPE_CONNECTOR << OBJECT_TYPE_SHIFT |\ |
426 | GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\ | 401 | GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\ |
427 | CONNECTOR_OBJECT_ID_DUAL_LINK_DVI_I << OBJECT_ID_SHIFT) | 402 | CONNECTOR_OBJECT_ID_SINGLE_LINK_DVI_I << OBJECT_ID_SHIFT) |
428 | 403 | ||
429 | #define CONNECTOR_DUAL_LINK_DVI_I_ENUM_ID2 \ | 404 | #define CONNECTOR_SINGLE_LINK_DVI_I_ENUM_ID2 ( GRAPH_OBJECT_TYPE_CONNECTOR << OBJECT_TYPE_SHIFT |\ |
430 | (GRAPH_OBJECT_TYPE_CONNECTOR << OBJECT_TYPE_SHIFT |\ | 405 | GRAPH_OBJECT_ENUM_ID2 << ENUM_ID_SHIFT |\ |
431 | GRAPH_OBJECT_ENUM_ID2 << ENUM_ID_SHIFT |\ | 406 | CONNECTOR_OBJECT_ID_SINGLE_LINK_DVI_I << OBJECT_ID_SHIFT) |
432 | CONNECTOR_OBJECT_ID_DUAL_LINK_DVI_I << OBJECT_ID_SHIFT) | 407 | |
433 | 408 | #define CONNECTOR_DUAL_LINK_DVI_I_ENUM_ID1 ( GRAPH_OBJECT_TYPE_CONNECTOR << OBJECT_TYPE_SHIFT |\ | |
434 | #define CONNECTOR_SINGLE_LINK_DVI_D_ENUM_ID1 \ | 409 | GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\ |
435 | (GRAPH_OBJECT_TYPE_CONNECTOR << OBJECT_TYPE_SHIFT |\ | 410 | CONNECTOR_OBJECT_ID_DUAL_LINK_DVI_I << OBJECT_ID_SHIFT) |
436 | GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\ | 411 | |
437 | CONNECTOR_OBJECT_ID_SINGLE_LINK_DVI_D << OBJECT_ID_SHIFT) | 412 | #define CONNECTOR_DUAL_LINK_DVI_I_ENUM_ID2 ( GRAPH_OBJECT_TYPE_CONNECTOR << OBJECT_TYPE_SHIFT |\ |
438 | 413 | GRAPH_OBJECT_ENUM_ID2 << ENUM_ID_SHIFT |\ | |
439 | #define CONNECTOR_SINGLE_LINK_DVI_D_ENUM_ID2 \ | 414 | CONNECTOR_OBJECT_ID_DUAL_LINK_DVI_I << OBJECT_ID_SHIFT) |
440 | (GRAPH_OBJECT_TYPE_CONNECTOR << OBJECT_TYPE_SHIFT |\ | 415 | |
441 | GRAPH_OBJECT_ENUM_ID2 << ENUM_ID_SHIFT |\ | 416 | #define CONNECTOR_SINGLE_LINK_DVI_D_ENUM_ID1 ( GRAPH_OBJECT_TYPE_CONNECTOR << OBJECT_TYPE_SHIFT |\ |
442 | CONNECTOR_OBJECT_ID_SINGLE_LINK_DVI_D << OBJECT_ID_SHIFT) | 417 | GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\ |
443 | 418 | CONNECTOR_OBJECT_ID_SINGLE_LINK_DVI_D << OBJECT_ID_SHIFT) | |
444 | #define CONNECTOR_DUAL_LINK_DVI_D_ENUM_ID1 \ | 419 | |
445 | (GRAPH_OBJECT_TYPE_CONNECTOR << OBJECT_TYPE_SHIFT |\ | 420 | #define CONNECTOR_SINGLE_LINK_DVI_D_ENUM_ID2 ( GRAPH_OBJECT_TYPE_CONNECTOR << OBJECT_TYPE_SHIFT |\ |
446 | GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\ | 421 | GRAPH_OBJECT_ENUM_ID2 << ENUM_ID_SHIFT |\ |
447 | CONNECTOR_OBJECT_ID_DUAL_LINK_DVI_D << OBJECT_ID_SHIFT) | 422 | CONNECTOR_OBJECT_ID_SINGLE_LINK_DVI_D << OBJECT_ID_SHIFT) |
448 | 423 | ||
449 | #define CONNECTOR_VGA_ENUM_ID1 \ | 424 | #define CONNECTOR_DUAL_LINK_DVI_D_ENUM_ID1 ( GRAPH_OBJECT_TYPE_CONNECTOR << OBJECT_TYPE_SHIFT |\ |
450 | (GRAPH_OBJECT_TYPE_CONNECTOR << OBJECT_TYPE_SHIFT |\ | 425 | GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\ |
451 | GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\ | 426 | CONNECTOR_OBJECT_ID_DUAL_LINK_DVI_D << OBJECT_ID_SHIFT) |
452 | CONNECTOR_OBJECT_ID_VGA << OBJECT_ID_SHIFT) | 427 | |
453 | 428 | #define CONNECTOR_DUAL_LINK_DVI_D_ENUM_ID2 ( GRAPH_OBJECT_TYPE_CONNECTOR << OBJECT_TYPE_SHIFT |\ | |
454 | #define CONNECTOR_VGA_ENUM_ID2 \ | 429 | GRAPH_OBJECT_ENUM_ID2 << ENUM_ID_SHIFT |\ |
455 | (GRAPH_OBJECT_TYPE_CONNECTOR << OBJECT_TYPE_SHIFT |\ | 430 | CONNECTOR_OBJECT_ID_DUAL_LINK_DVI_D << OBJECT_ID_SHIFT) |
456 | GRAPH_OBJECT_ENUM_ID2 << ENUM_ID_SHIFT |\ | 431 | |
457 | CONNECTOR_OBJECT_ID_VGA << OBJECT_ID_SHIFT) | 432 | #define CONNECTOR_DUAL_LINK_DVI_D_ENUM_ID3 ( GRAPH_OBJECT_TYPE_CONNECTOR << OBJECT_TYPE_SHIFT |\ |
458 | 433 | GRAPH_OBJECT_ENUM_ID3 << ENUM_ID_SHIFT |\ | |
459 | #define CONNECTOR_COMPOSITE_ENUM_ID1 \ | 434 | CONNECTOR_OBJECT_ID_DUAL_LINK_DVI_D << OBJECT_ID_SHIFT) |
460 | (GRAPH_OBJECT_TYPE_CONNECTOR << OBJECT_TYPE_SHIFT |\ | 435 | |
461 | GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\ | 436 | #define CONNECTOR_VGA_ENUM_ID1 ( GRAPH_OBJECT_TYPE_CONNECTOR << OBJECT_TYPE_SHIFT |\ |
462 | CONNECTOR_OBJECT_ID_COMPOSITE << OBJECT_ID_SHIFT) | 437 | GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\ |
463 | 438 | CONNECTOR_OBJECT_ID_VGA << OBJECT_ID_SHIFT) | |
464 | #define CONNECTOR_SVIDEO_ENUM_ID1 \ | 439 | |
465 | (GRAPH_OBJECT_TYPE_CONNECTOR << OBJECT_TYPE_SHIFT |\ | 440 | #define CONNECTOR_VGA_ENUM_ID2 ( GRAPH_OBJECT_TYPE_CONNECTOR << OBJECT_TYPE_SHIFT |\ |
466 | GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\ | 441 | GRAPH_OBJECT_ENUM_ID2 << ENUM_ID_SHIFT |\ |
467 | CONNECTOR_OBJECT_ID_SVIDEO << OBJECT_ID_SHIFT) | 442 | CONNECTOR_OBJECT_ID_VGA << OBJECT_ID_SHIFT) |
468 | 443 | ||
469 | #define CONNECTOR_YPbPr_ENUM_ID1 \ | 444 | #define CONNECTOR_COMPOSITE_ENUM_ID1 ( GRAPH_OBJECT_TYPE_CONNECTOR << OBJECT_TYPE_SHIFT |\ |
470 | (GRAPH_OBJECT_TYPE_CONNECTOR << OBJECT_TYPE_SHIFT |\ | 445 | GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\ |
471 | GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\ | 446 | CONNECTOR_OBJECT_ID_COMPOSITE << OBJECT_ID_SHIFT) |
472 | CONNECTOR_OBJECT_ID_YPbPr << OBJECT_ID_SHIFT) | 447 | |
473 | 448 | #define CONNECTOR_COMPOSITE_ENUM_ID2 ( GRAPH_OBJECT_TYPE_CONNECTOR << OBJECT_TYPE_SHIFT |\ | |
474 | #define CONNECTOR_D_CONNECTOR_ENUM_ID1 \ | 449 | GRAPH_OBJECT_ENUM_ID2 << ENUM_ID_SHIFT |\ |
475 | (GRAPH_OBJECT_TYPE_CONNECTOR << OBJECT_TYPE_SHIFT |\ | 450 | CONNECTOR_OBJECT_ID_COMPOSITE << OBJECT_ID_SHIFT) |
476 | GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\ | 451 | |
477 | CONNECTOR_OBJECT_ID_D_CONNECTOR << OBJECT_ID_SHIFT) | 452 | #define CONNECTOR_SVIDEO_ENUM_ID1 ( GRAPH_OBJECT_TYPE_CONNECTOR << OBJECT_TYPE_SHIFT |\ |
478 | 453 | GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\ | |
479 | #define CONNECTOR_9PIN_DIN_ENUM_ID1 \ | 454 | CONNECTOR_OBJECT_ID_SVIDEO << OBJECT_ID_SHIFT) |
480 | (GRAPH_OBJECT_TYPE_CONNECTOR << OBJECT_TYPE_SHIFT |\ | 455 | |
481 | GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\ | 456 | #define CONNECTOR_SVIDEO_ENUM_ID2 ( GRAPH_OBJECT_TYPE_CONNECTOR << OBJECT_TYPE_SHIFT |\ |
482 | CONNECTOR_OBJECT_ID_9PIN_DIN << OBJECT_ID_SHIFT) | 457 | GRAPH_OBJECT_ENUM_ID2 << ENUM_ID_SHIFT |\ |
483 | 458 | CONNECTOR_OBJECT_ID_SVIDEO << OBJECT_ID_SHIFT) | |
484 | #define CONNECTOR_SCART_ENUM_ID1 \ | 459 | |
485 | (GRAPH_OBJECT_TYPE_CONNECTOR << OBJECT_TYPE_SHIFT |\ | 460 | #define CONNECTOR_YPbPr_ENUM_ID1 ( GRAPH_OBJECT_TYPE_CONNECTOR << OBJECT_TYPE_SHIFT |\ |
486 | GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\ | 461 | GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\ |
487 | CONNECTOR_OBJECT_ID_SCART << OBJECT_ID_SHIFT) | 462 | CONNECTOR_OBJECT_ID_YPbPr << OBJECT_ID_SHIFT) |
488 | 463 | ||
489 | #define CONNECTOR_HDMI_TYPE_A_ENUM_ID1 \ | 464 | #define CONNECTOR_YPbPr_ENUM_ID2 ( GRAPH_OBJECT_TYPE_CONNECTOR << OBJECT_TYPE_SHIFT |\ |
490 | (GRAPH_OBJECT_TYPE_CONNECTOR << OBJECT_TYPE_SHIFT |\ | 465 | GRAPH_OBJECT_ENUM_ID2 << ENUM_ID_SHIFT |\ |
491 | GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\ | 466 | CONNECTOR_OBJECT_ID_YPbPr << OBJECT_ID_SHIFT) |
492 | CONNECTOR_OBJECT_ID_HDMI_TYPE_A << OBJECT_ID_SHIFT) | 467 | |
493 | 468 | #define CONNECTOR_D_CONNECTOR_ENUM_ID1 ( GRAPH_OBJECT_TYPE_CONNECTOR << OBJECT_TYPE_SHIFT |\ | |
494 | #define CONNECTOR_HDMI_TYPE_B_ENUM_ID1 \ | 469 | GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\ |
495 | (GRAPH_OBJECT_TYPE_CONNECTOR << OBJECT_TYPE_SHIFT |\ | 470 | CONNECTOR_OBJECT_ID_D_CONNECTOR << OBJECT_ID_SHIFT) |
496 | GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\ | 471 | |
497 | CONNECTOR_OBJECT_ID_HDMI_TYPE_B << OBJECT_ID_SHIFT) | 472 | #define CONNECTOR_D_CONNECTOR_ENUM_ID2 ( GRAPH_OBJECT_TYPE_CONNECTOR << OBJECT_TYPE_SHIFT |\ |
498 | 473 | GRAPH_OBJECT_ENUM_ID2 << ENUM_ID_SHIFT |\ | |
499 | #define CONNECTOR_7PIN_DIN_ENUM_ID1 \ | 474 | CONNECTOR_OBJECT_ID_D_CONNECTOR << OBJECT_ID_SHIFT) |
500 | (GRAPH_OBJECT_TYPE_CONNECTOR << OBJECT_TYPE_SHIFT |\ | 475 | |
501 | GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\ | 476 | #define CONNECTOR_9PIN_DIN_ENUM_ID1 ( GRAPH_OBJECT_TYPE_CONNECTOR << OBJECT_TYPE_SHIFT |\ |
502 | CONNECTOR_OBJECT_ID_7PIN_DIN << OBJECT_ID_SHIFT) | 477 | GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\ |
503 | 478 | CONNECTOR_OBJECT_ID_9PIN_DIN << OBJECT_ID_SHIFT) | |
504 | #define CONNECTOR_PCIE_CONNECTOR_ENUM_ID1 \ | 479 | |
505 | (GRAPH_OBJECT_TYPE_CONNECTOR << OBJECT_TYPE_SHIFT |\ | 480 | #define CONNECTOR_9PIN_DIN_ENUM_ID2 ( GRAPH_OBJECT_TYPE_CONNECTOR << OBJECT_TYPE_SHIFT |\ |
506 | GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\ | 481 | GRAPH_OBJECT_ENUM_ID2 << ENUM_ID_SHIFT |\ |
507 | CONNECTOR_OBJECT_ID_PCIE_CONNECTOR << OBJECT_ID_SHIFT) | 482 | CONNECTOR_OBJECT_ID_9PIN_DIN << OBJECT_ID_SHIFT) |
508 | 483 | ||
509 | #define CONNECTOR_PCIE_CONNECTOR_ENUM_ID2 \ | 484 | #define CONNECTOR_SCART_ENUM_ID1 ( GRAPH_OBJECT_TYPE_CONNECTOR << OBJECT_TYPE_SHIFT |\ |
510 | (GRAPH_OBJECT_TYPE_CONNECTOR << OBJECT_TYPE_SHIFT |\ | 485 | GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\ |
511 | GRAPH_OBJECT_ENUM_ID2 << ENUM_ID_SHIFT |\ | 486 | CONNECTOR_OBJECT_ID_SCART << OBJECT_ID_SHIFT) |
512 | CONNECTOR_OBJECT_ID_PCIE_CONNECTOR << OBJECT_ID_SHIFT) | 487 | |
513 | 488 | #define CONNECTOR_SCART_ENUM_ID2 ( GRAPH_OBJECT_TYPE_CONNECTOR << OBJECT_TYPE_SHIFT |\ | |
514 | #define CONNECTOR_CROSSFIRE_ENUM_ID1 \ | 489 | GRAPH_OBJECT_ENUM_ID2 << ENUM_ID_SHIFT |\ |
515 | (GRAPH_OBJECT_TYPE_CONNECTOR << OBJECT_TYPE_SHIFT |\ | 490 | CONNECTOR_OBJECT_ID_SCART << OBJECT_ID_SHIFT) |
516 | GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\ | 491 | |
517 | CONNECTOR_OBJECT_ID_CROSSFIRE << OBJECT_ID_SHIFT) | 492 | #define CONNECTOR_HDMI_TYPE_A_ENUM_ID1 ( GRAPH_OBJECT_TYPE_CONNECTOR << OBJECT_TYPE_SHIFT |\ |
518 | 493 | GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\ | |
519 | #define CONNECTOR_CROSSFIRE_ENUM_ID2 \ | 494 | CONNECTOR_OBJECT_ID_HDMI_TYPE_A << OBJECT_ID_SHIFT) |
520 | (GRAPH_OBJECT_TYPE_CONNECTOR << OBJECT_TYPE_SHIFT |\ | 495 | |
521 | GRAPH_OBJECT_ENUM_ID2 << ENUM_ID_SHIFT |\ | 496 | #define CONNECTOR_HDMI_TYPE_A_ENUM_ID2 ( GRAPH_OBJECT_TYPE_CONNECTOR << OBJECT_TYPE_SHIFT |\ |
522 | CONNECTOR_OBJECT_ID_CROSSFIRE << OBJECT_ID_SHIFT) | 497 | GRAPH_OBJECT_ENUM_ID2 << ENUM_ID_SHIFT |\ |
523 | 498 | CONNECTOR_OBJECT_ID_HDMI_TYPE_A << OBJECT_ID_SHIFT) | |
524 | #define CONNECTOR_HARDCODE_DVI_ENUM_ID1 \ | 499 | |
525 | (GRAPH_OBJECT_TYPE_CONNECTOR << OBJECT_TYPE_SHIFT |\ | 500 | #define CONNECTOR_HDMI_TYPE_A_ENUM_ID3 ( GRAPH_OBJECT_TYPE_CONNECTOR << OBJECT_TYPE_SHIFT |\ |
526 | GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\ | 501 | GRAPH_OBJECT_ENUM_ID3 << ENUM_ID_SHIFT |\ |
527 | CONNECTOR_OBJECT_ID_HARDCODE_DVI << OBJECT_ID_SHIFT) | 502 | CONNECTOR_OBJECT_ID_HDMI_TYPE_A << OBJECT_ID_SHIFT) |
528 | 503 | ||
529 | #define CONNECTOR_HARDCODE_DVI_ENUM_ID2 \ | 504 | #define CONNECTOR_HDMI_TYPE_B_ENUM_ID1 ( GRAPH_OBJECT_TYPE_CONNECTOR << OBJECT_TYPE_SHIFT |\ |
530 | (GRAPH_OBJECT_TYPE_CONNECTOR << OBJECT_TYPE_SHIFT |\ | 505 | GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\ |
531 | GRAPH_OBJECT_ENUM_ID2 << ENUM_ID_SHIFT |\ | 506 | CONNECTOR_OBJECT_ID_HDMI_TYPE_B << OBJECT_ID_SHIFT) |
532 | CONNECTOR_OBJECT_ID_HARDCODE_DVI << OBJECT_ID_SHIFT) | 507 | |
533 | 508 | #define CONNECTOR_HDMI_TYPE_B_ENUM_ID2 ( GRAPH_OBJECT_TYPE_CONNECTOR << OBJECT_TYPE_SHIFT |\ | |
534 | #define CONNECTOR_DISPLAYPORT_ENUM_ID1 \ | 509 | GRAPH_OBJECT_ENUM_ID2 << ENUM_ID_SHIFT |\ |
535 | (GRAPH_OBJECT_TYPE_CONNECTOR << OBJECT_TYPE_SHIFT |\ | 510 | CONNECTOR_OBJECT_ID_HDMI_TYPE_B << OBJECT_ID_SHIFT) |
536 | GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\ | 511 | |
537 | CONNECTOR_OBJECT_ID_DISPLAYPORT << OBJECT_ID_SHIFT) | 512 | #define CONNECTOR_7PIN_DIN_ENUM_ID1 ( GRAPH_OBJECT_TYPE_CONNECTOR << OBJECT_TYPE_SHIFT |\ |
538 | 513 | GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\ | |
539 | #define CONNECTOR_DISPLAYPORT_ENUM_ID2 \ | 514 | CONNECTOR_OBJECT_ID_7PIN_DIN << OBJECT_ID_SHIFT) |
540 | (GRAPH_OBJECT_TYPE_CONNECTOR << OBJECT_TYPE_SHIFT |\ | 515 | #define CONNECTOR_7PIN_DIN_ENUM_ID2 ( GRAPH_OBJECT_TYPE_CONNECTOR << OBJECT_TYPE_SHIFT |\ |
541 | GRAPH_OBJECT_ENUM_ID2 << ENUM_ID_SHIFT |\ | 516 | GRAPH_OBJECT_ENUM_ID2 << ENUM_ID_SHIFT |\ |
542 | CONNECTOR_OBJECT_ID_DISPLAYPORT << OBJECT_ID_SHIFT) | 517 | CONNECTOR_OBJECT_ID_7PIN_DIN << OBJECT_ID_SHIFT) |
543 | 518 | ||
544 | #define CONNECTOR_DISPLAYPORT_ENUM_ID3 \ | 519 | #define CONNECTOR_PCIE_CONNECTOR_ENUM_ID1 ( GRAPH_OBJECT_TYPE_CONNECTOR << OBJECT_TYPE_SHIFT |\ |
545 | (GRAPH_OBJECT_TYPE_CONNECTOR << OBJECT_TYPE_SHIFT |\ | 520 | GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\ |
546 | GRAPH_OBJECT_ENUM_ID3 << ENUM_ID_SHIFT |\ | 521 | CONNECTOR_OBJECT_ID_PCIE_CONNECTOR << OBJECT_ID_SHIFT) |
547 | CONNECTOR_OBJECT_ID_DISPLAYPORT << OBJECT_ID_SHIFT) | 522 | |
548 | 523 | #define CONNECTOR_PCIE_CONNECTOR_ENUM_ID2 ( GRAPH_OBJECT_TYPE_CONNECTOR << OBJECT_TYPE_SHIFT |\ | |
549 | #define CONNECTOR_DISPLAYPORT_ENUM_ID4 \ | 524 | GRAPH_OBJECT_ENUM_ID2 << ENUM_ID_SHIFT |\ |
550 | (GRAPH_OBJECT_TYPE_CONNECTOR << OBJECT_TYPE_SHIFT |\ | 525 | CONNECTOR_OBJECT_ID_PCIE_CONNECTOR << OBJECT_ID_SHIFT) |
551 | GRAPH_OBJECT_ENUM_ID4 << ENUM_ID_SHIFT |\ | 526 | |
552 | CONNECTOR_OBJECT_ID_DISPLAYPORT << OBJECT_ID_SHIFT) | 527 | #define CONNECTOR_CROSSFIRE_ENUM_ID1 ( GRAPH_OBJECT_TYPE_CONNECTOR << OBJECT_TYPE_SHIFT |\ |
528 | GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\ | ||
529 | CONNECTOR_OBJECT_ID_CROSSFIRE << OBJECT_ID_SHIFT) | ||
530 | |||
531 | #define CONNECTOR_CROSSFIRE_ENUM_ID2 ( GRAPH_OBJECT_TYPE_CONNECTOR << OBJECT_TYPE_SHIFT |\ | ||
532 | GRAPH_OBJECT_ENUM_ID2 << ENUM_ID_SHIFT |\ | ||
533 | CONNECTOR_OBJECT_ID_CROSSFIRE << OBJECT_ID_SHIFT) | ||
534 | |||
535 | |||
536 | #define CONNECTOR_HARDCODE_DVI_ENUM_ID1 ( GRAPH_OBJECT_TYPE_CONNECTOR << OBJECT_TYPE_SHIFT |\ | ||
537 | GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\ | ||
538 | CONNECTOR_OBJECT_ID_HARDCODE_DVI << OBJECT_ID_SHIFT) | ||
539 | |||
540 | #define CONNECTOR_HARDCODE_DVI_ENUM_ID2 ( GRAPH_OBJECT_TYPE_CONNECTOR << OBJECT_TYPE_SHIFT |\ | ||
541 | GRAPH_OBJECT_ENUM_ID2 << ENUM_ID_SHIFT |\ | ||
542 | CONNECTOR_OBJECT_ID_HARDCODE_DVI << OBJECT_ID_SHIFT) | ||
543 | |||
544 | #define CONNECTOR_DISPLAYPORT_ENUM_ID1 ( GRAPH_OBJECT_TYPE_CONNECTOR << OBJECT_TYPE_SHIFT |\ | ||
545 | GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\ | ||
546 | CONNECTOR_OBJECT_ID_DISPLAYPORT << OBJECT_ID_SHIFT) | ||
547 | |||
548 | #define CONNECTOR_DISPLAYPORT_ENUM_ID2 ( GRAPH_OBJECT_TYPE_CONNECTOR << OBJECT_TYPE_SHIFT |\ | ||
549 | GRAPH_OBJECT_ENUM_ID2 << ENUM_ID_SHIFT |\ | ||
550 | CONNECTOR_OBJECT_ID_DISPLAYPORT << OBJECT_ID_SHIFT) | ||
551 | |||
552 | #define CONNECTOR_DISPLAYPORT_ENUM_ID3 ( GRAPH_OBJECT_TYPE_CONNECTOR << OBJECT_TYPE_SHIFT |\ | ||
553 | GRAPH_OBJECT_ENUM_ID3 << ENUM_ID_SHIFT |\ | ||
554 | CONNECTOR_OBJECT_ID_DISPLAYPORT << OBJECT_ID_SHIFT) | ||
555 | |||
556 | #define CONNECTOR_DISPLAYPORT_ENUM_ID4 ( GRAPH_OBJECT_TYPE_CONNECTOR << OBJECT_TYPE_SHIFT |\ | ||
557 | GRAPH_OBJECT_ENUM_ID4 << ENUM_ID_SHIFT |\ | ||
558 | CONNECTOR_OBJECT_ID_DISPLAYPORT << OBJECT_ID_SHIFT) | ||
559 | |||
560 | #define CONNECTOR_DISPLAYPORT_ENUM_ID5 ( GRAPH_OBJECT_TYPE_CONNECTOR << OBJECT_TYPE_SHIFT |\ | ||
561 | GRAPH_OBJECT_ENUM_ID5 << ENUM_ID_SHIFT |\ | ||
562 | CONNECTOR_OBJECT_ID_DISPLAYPORT << OBJECT_ID_SHIFT) | ||
563 | |||
564 | #define CONNECTOR_DISPLAYPORT_ENUM_ID6 ( GRAPH_OBJECT_TYPE_CONNECTOR << OBJECT_TYPE_SHIFT |\ | ||
565 | GRAPH_OBJECT_ENUM_ID6 << ENUM_ID_SHIFT |\ | ||
566 | CONNECTOR_OBJECT_ID_DISPLAYPORT << OBJECT_ID_SHIFT) | ||
567 | |||
568 | #define CONNECTOR_MXM_ENUM_ID1 ( GRAPH_OBJECT_TYPE_CONNECTOR << OBJECT_TYPE_SHIFT |\ | ||
569 | GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\ | ||
570 | CONNECTOR_OBJECT_ID_MXM << OBJECT_ID_SHIFT) //Mapping to MXM_DP_A | ||
571 | |||
572 | #define CONNECTOR_MXM_ENUM_ID2 ( GRAPH_OBJECT_TYPE_CONNECTOR << OBJECT_TYPE_SHIFT |\ | ||
573 | GRAPH_OBJECT_ENUM_ID2 << ENUM_ID_SHIFT |\ | ||
574 | CONNECTOR_OBJECT_ID_MXM << OBJECT_ID_SHIFT) //Mapping to MXM_DP_B | ||
575 | |||
576 | #define CONNECTOR_MXM_ENUM_ID3 ( GRAPH_OBJECT_TYPE_CONNECTOR << OBJECT_TYPE_SHIFT |\ | ||
577 | GRAPH_OBJECT_ENUM_ID3 << ENUM_ID_SHIFT |\ | ||
578 | CONNECTOR_OBJECT_ID_MXM << OBJECT_ID_SHIFT) //Mapping to MXM_DP_C | ||
579 | |||
580 | #define CONNECTOR_MXM_ENUM_ID4 ( GRAPH_OBJECT_TYPE_CONNECTOR << OBJECT_TYPE_SHIFT |\ | ||
581 | GRAPH_OBJECT_ENUM_ID4 << ENUM_ID_SHIFT |\ | ||
582 | CONNECTOR_OBJECT_ID_MXM << OBJECT_ID_SHIFT) //Mapping to MXM_DP_D | ||
583 | |||
584 | #define CONNECTOR_MXM_ENUM_ID5 ( GRAPH_OBJECT_TYPE_CONNECTOR << OBJECT_TYPE_SHIFT |\ | ||
585 | GRAPH_OBJECT_ENUM_ID5 << ENUM_ID_SHIFT |\ | ||
586 | CONNECTOR_OBJECT_ID_MXM << OBJECT_ID_SHIFT) //Mapping to MXM_LVDS_TXxx | ||
587 | |||
588 | #define CONNECTOR_MXM_ENUM_ID6 ( GRAPH_OBJECT_TYPE_CONNECTOR << OBJECT_TYPE_SHIFT |\ | ||
589 | GRAPH_OBJECT_ENUM_ID6 << ENUM_ID_SHIFT |\ | ||
590 | CONNECTOR_OBJECT_ID_MXM << OBJECT_ID_SHIFT) //Mapping to MXM_LVDS_UXxx | ||
591 | |||
592 | #define CONNECTOR_MXM_ENUM_ID7 ( GRAPH_OBJECT_TYPE_CONNECTOR << OBJECT_TYPE_SHIFT |\ | ||
593 | GRAPH_OBJECT_ENUM_ID7 << ENUM_ID_SHIFT |\ | ||
594 | CONNECTOR_OBJECT_ID_MXM << OBJECT_ID_SHIFT) //Mapping to MXM_DAC | ||
553 | 595 | ||
554 | /****************************************************/ | 596 | /****************************************************/ |
555 | /* Router Object ID definition - Shared with BIOS */ | 597 | /* Router Object ID definition - Shared with BIOS */ |
556 | /****************************************************/ | 598 | /****************************************************/ |
557 | #define ROUTER_I2C_EXTENDER_CNTL_ENUM_ID1 \ | 599 | #define ROUTER_I2C_EXTENDER_CNTL_ENUM_ID1 ( GRAPH_OBJECT_TYPE_ROUTER << OBJECT_TYPE_SHIFT |\ |
558 | (GRAPH_OBJECT_TYPE_ROUTER << OBJECT_TYPE_SHIFT |\ | 600 | GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\ |
559 | GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\ | 601 | ROUTER_OBJECT_ID_I2C_EXTENDER_CNTL << OBJECT_ID_SHIFT) |
560 | ROUTER_OBJECT_ID_I2C_EXTENDER_CNTL << OBJECT_ID_SHIFT) | ||
561 | 602 | ||
562 | /* deleted */ | 603 | /* deleted */ |
563 | 604 | ||
564 | /****************************************************/ | 605 | /****************************************************/ |
606 | /* Generic Object ID definition - Shared with BIOS */ | ||
607 | /****************************************************/ | ||
608 | #define GENERICOBJECT_GLSYNC_ENUM_ID1 (GRAPH_OBJECT_TYPE_GENERIC << OBJECT_TYPE_SHIFT |\ | ||
609 | GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\ | ||
610 | GENERIC_OBJECT_ID_GLSYNC << OBJECT_ID_SHIFT) | ||
611 | |||
612 | #define GENERICOBJECT_PX2_NON_DRIVABLE_ID1 (GRAPH_OBJECT_TYPE_GENERIC << OBJECT_TYPE_SHIFT |\ | ||
613 | GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\ | ||
614 | GENERIC_OBJECT_ID_PX2_NON_DRIVABLE<< OBJECT_ID_SHIFT) | ||
615 | |||
616 | #define GENERICOBJECT_PX2_NON_DRIVABLE_ID2 (GRAPH_OBJECT_TYPE_GENERIC << OBJECT_TYPE_SHIFT |\ | ||
617 | GRAPH_OBJECT_ENUM_ID2 << ENUM_ID_SHIFT |\ | ||
618 | GENERIC_OBJECT_ID_PX2_NON_DRIVABLE<< OBJECT_ID_SHIFT) | ||
619 | |||
620 | #define GENERICOBJECT_MXM_OPM_ENUM_ID1 (GRAPH_OBJECT_TYPE_GENERIC << OBJECT_TYPE_SHIFT |\ | ||
621 | GRAPH_OBJECT_ENUM_ID1 << ENUM_ID_SHIFT |\ | ||
622 | GENERIC_OBJECT_ID_MXM_OPM << OBJECT_ID_SHIFT) | ||
623 | |||
624 | /****************************************************/ | ||
565 | /* Object Cap definition - Shared with BIOS */ | 625 | /* Object Cap definition - Shared with BIOS */ |
566 | /****************************************************/ | 626 | /****************************************************/ |
567 | #define GRAPHICS_OBJECT_CAP_I2C 0x00000001L | 627 | #define GRAPHICS_OBJECT_CAP_I2C 0x00000001L |
568 | #define GRAPHICS_OBJECT_CAP_TABLE_ID 0x00000002L | 628 | #define GRAPHICS_OBJECT_CAP_TABLE_ID 0x00000002L |
569 | 629 | ||
630 | |||
570 | #define GRAPHICS_OBJECT_I2CCOMMAND_TABLE_ID 0x01 | 631 | #define GRAPHICS_OBJECT_I2CCOMMAND_TABLE_ID 0x01 |
571 | #define GRAPHICS_OBJECT_HOTPLUGDETECTIONINTERUPT_TABLE_ID 0x02 | 632 | #define GRAPHICS_OBJECT_HOTPLUGDETECTIONINTERUPT_TABLE_ID 0x02 |
572 | #define GRAPHICS_OBJECT_ENCODER_OUTPUT_PROTECTION_TABLE_ID 0x03 | 633 | #define GRAPHICS_OBJECT_ENCODER_OUTPUT_PROTECTION_TABLE_ID 0x03 |
@@ -575,4 +636,8 @@ | |||
575 | #pragma pack() | 636 | #pragma pack() |
576 | #endif | 637 | #endif |
577 | 638 | ||
578 | #endif /*GRAPHICTYPE */ | 639 | #endif /*GRAPHICTYPE */ |
640 | |||
641 | |||
642 | |||
643 | |||
diff --git a/drivers/gpu/drm/radeon/atom.c b/drivers/gpu/drm/radeon/atom.c index 6578d19dff93..388140a7e651 100644 --- a/drivers/gpu/drm/radeon/atom.c +++ b/drivers/gpu/drm/radeon/atom.c | |||
@@ -58,6 +58,7 @@ typedef struct { | |||
58 | } atom_exec_context; | 58 | } atom_exec_context; |
59 | 59 | ||
60 | int atom_debug = 0; | 60 | int atom_debug = 0; |
61 | static void atom_execute_table_locked(struct atom_context *ctx, int index, uint32_t * params); | ||
61 | void atom_execute_table(struct atom_context *ctx, int index, uint32_t * params); | 62 | void atom_execute_table(struct atom_context *ctx, int index, uint32_t * params); |
62 | 63 | ||
63 | static uint32_t atom_arg_mask[8] = | 64 | static uint32_t atom_arg_mask[8] = |
@@ -573,7 +574,7 @@ static void atom_op_calltable(atom_exec_context *ctx, int *ptr, int arg) | |||
573 | else | 574 | else |
574 | SDEBUG(" table: %d\n", idx); | 575 | SDEBUG(" table: %d\n", idx); |
575 | if (U16(ctx->ctx->cmd_table + 4 + 2 * idx)) | 576 | if (U16(ctx->ctx->cmd_table + 4 + 2 * idx)) |
576 | atom_execute_table(ctx->ctx, idx, ctx->ps + ctx->ps_shift); | 577 | atom_execute_table_locked(ctx->ctx, idx, ctx->ps + ctx->ps_shift); |
577 | } | 578 | } |
578 | 579 | ||
579 | static void atom_op_clear(atom_exec_context *ctx, int *ptr, int arg) | 580 | static void atom_op_clear(atom_exec_context *ctx, int *ptr, int arg) |
@@ -1040,7 +1041,7 @@ static struct { | |||
1040 | atom_op_shr, ATOM_ARG_MC}, { | 1041 | atom_op_shr, ATOM_ARG_MC}, { |
1041 | atom_op_debug, 0},}; | 1042 | atom_op_debug, 0},}; |
1042 | 1043 | ||
1043 | void atom_execute_table(struct atom_context *ctx, int index, uint32_t * params) | 1044 | static void atom_execute_table_locked(struct atom_context *ctx, int index, uint32_t * params) |
1044 | { | 1045 | { |
1045 | int base = CU16(ctx->cmd_table + 4 + 2 * index); | 1046 | int base = CU16(ctx->cmd_table + 4 + 2 * index); |
1046 | int len, ws, ps, ptr; | 1047 | int len, ws, ps, ptr; |
@@ -1092,6 +1093,13 @@ void atom_execute_table(struct atom_context *ctx, int index, uint32_t * params) | |||
1092 | kfree(ectx.ws); | 1093 | kfree(ectx.ws); |
1093 | } | 1094 | } |
1094 | 1095 | ||
1096 | void atom_execute_table(struct atom_context *ctx, int index, uint32_t * params) | ||
1097 | { | ||
1098 | mutex_lock(&ctx->mutex); | ||
1099 | atom_execute_table_locked(ctx, index, params); | ||
1100 | mutex_unlock(&ctx->mutex); | ||
1101 | } | ||
1102 | |||
1095 | static int atom_iio_len[] = { 1, 2, 3, 3, 3, 3, 4, 4, 4, 3 }; | 1103 | static int atom_iio_len[] = { 1, 2, 3, 3, 3, 3, 4, 4, 4, 3 }; |
1096 | 1104 | ||
1097 | static void atom_index_iio(struct atom_context *ctx, int base) | 1105 | static void atom_index_iio(struct atom_context *ctx, int base) |
diff --git a/drivers/gpu/drm/radeon/atom.h b/drivers/gpu/drm/radeon/atom.h index 6671848e5ea1..47fd943f6d14 100644 --- a/drivers/gpu/drm/radeon/atom.h +++ b/drivers/gpu/drm/radeon/atom.h | |||
@@ -120,6 +120,7 @@ struct card_info { | |||
120 | 120 | ||
121 | struct atom_context { | 121 | struct atom_context { |
122 | struct card_info *card; | 122 | struct card_info *card; |
123 | struct mutex mutex; | ||
123 | void *bios; | 124 | void *bios; |
124 | uint32_t cmd_table, data_table; | 125 | uint32_t cmd_table, data_table; |
125 | uint16_t *iio; | 126 | uint16_t *iio; |
diff --git a/drivers/gpu/drm/radeon/atombios.h b/drivers/gpu/drm/radeon/atombios.h index 5f48515c77a7..91ad0d1c1b17 100644 --- a/drivers/gpu/drm/radeon/atombios.h +++ b/drivers/gpu/drm/radeon/atombios.h | |||
@@ -4690,6 +4690,205 @@ typedef struct _ATOM_POWERPLAY_INFO_V3 { | |||
4690 | ATOM_POWERMODE_INFO_V3 asPowerPlayInfo[ATOM_MAX_NUMBEROF_POWER_BLOCK]; | 4690 | ATOM_POWERMODE_INFO_V3 asPowerPlayInfo[ATOM_MAX_NUMBEROF_POWER_BLOCK]; |
4691 | } ATOM_POWERPLAY_INFO_V3; | 4691 | } ATOM_POWERPLAY_INFO_V3; |
4692 | 4692 | ||
4693 | /* New PPlib */ | ||
4694 | /**************************************************************************/ | ||
4695 | typedef struct _ATOM_PPLIB_THERMALCONTROLLER | ||
4696 | |||
4697 | { | ||
4698 | UCHAR ucType; // one of ATOM_PP_THERMALCONTROLLER_* | ||
4699 | UCHAR ucI2cLine; // as interpreted by DAL I2C | ||
4700 | UCHAR ucI2cAddress; | ||
4701 | UCHAR ucFanParameters; // Fan Control Parameters. | ||
4702 | UCHAR ucFanMinRPM; // Fan Minimum RPM (hundreds) -- for display purposes only. | ||
4703 | UCHAR ucFanMaxRPM; // Fan Maximum RPM (hundreds) -- for display purposes only. | ||
4704 | UCHAR ucReserved; // ---- | ||
4705 | UCHAR ucFlags; // to be defined | ||
4706 | } ATOM_PPLIB_THERMALCONTROLLER; | ||
4707 | |||
4708 | #define ATOM_PP_FANPARAMETERS_TACHOMETER_PULSES_PER_REVOLUTION_MASK 0x0f | ||
4709 | #define ATOM_PP_FANPARAMETERS_NOFAN 0x80 // No fan is connected to this controller. | ||
4710 | |||
4711 | #define ATOM_PP_THERMALCONTROLLER_NONE 0 | ||
4712 | #define ATOM_PP_THERMALCONTROLLER_LM63 1 // Not used by PPLib | ||
4713 | #define ATOM_PP_THERMALCONTROLLER_ADM1032 2 // Not used by PPLib | ||
4714 | #define ATOM_PP_THERMALCONTROLLER_ADM1030 3 // Not used by PPLib | ||
4715 | #define ATOM_PP_THERMALCONTROLLER_MUA6649 4 // Not used by PPLib | ||
4716 | #define ATOM_PP_THERMALCONTROLLER_LM64 5 | ||
4717 | #define ATOM_PP_THERMALCONTROLLER_F75375 6 // Not used by PPLib | ||
4718 | #define ATOM_PP_THERMALCONTROLLER_RV6xx 7 | ||
4719 | #define ATOM_PP_THERMALCONTROLLER_RV770 8 | ||
4720 | #define ATOM_PP_THERMALCONTROLLER_ADT7473 9 | ||
4721 | |||
4722 | typedef struct _ATOM_PPLIB_STATE | ||
4723 | { | ||
4724 | UCHAR ucNonClockStateIndex; | ||
4725 | UCHAR ucClockStateIndices[1]; // variable-sized | ||
4726 | } ATOM_PPLIB_STATE; | ||
4727 | |||
4728 | //// ATOM_PPLIB_POWERPLAYTABLE::ulPlatformCaps | ||
4729 | #define ATOM_PP_PLATFORM_CAP_BACKBIAS 1 | ||
4730 | #define ATOM_PP_PLATFORM_CAP_POWERPLAY 2 | ||
4731 | #define ATOM_PP_PLATFORM_CAP_SBIOSPOWERSOURCE 4 | ||
4732 | #define ATOM_PP_PLATFORM_CAP_ASPM_L0s 8 | ||
4733 | #define ATOM_PP_PLATFORM_CAP_ASPM_L1 16 | ||
4734 | #define ATOM_PP_PLATFORM_CAP_HARDWAREDC 32 | ||
4735 | #define ATOM_PP_PLATFORM_CAP_GEMINIPRIMARY 64 | ||
4736 | #define ATOM_PP_PLATFORM_CAP_STEPVDDC 128 | ||
4737 | #define ATOM_PP_PLATFORM_CAP_VOLTAGECONTROL 256 | ||
4738 | #define ATOM_PP_PLATFORM_CAP_SIDEPORTCONTROL 512 | ||
4739 | #define ATOM_PP_PLATFORM_CAP_TURNOFFPLL_ASPML1 1024 | ||
4740 | #define ATOM_PP_PLATFORM_CAP_HTLINKCONTROL 2048 | ||
4741 | |||
4742 | typedef struct _ATOM_PPLIB_POWERPLAYTABLE | ||
4743 | { | ||
4744 | ATOM_COMMON_TABLE_HEADER sHeader; | ||
4745 | |||
4746 | UCHAR ucDataRevision; | ||
4747 | |||
4748 | UCHAR ucNumStates; | ||
4749 | UCHAR ucStateEntrySize; | ||
4750 | UCHAR ucClockInfoSize; | ||
4751 | UCHAR ucNonClockSize; | ||
4752 | |||
4753 | // offset from start of this table to array of ucNumStates ATOM_PPLIB_STATE structures | ||
4754 | USHORT usStateArrayOffset; | ||
4755 | |||
4756 | // offset from start of this table to array of ASIC-specific structures, | ||
4757 | // currently ATOM_PPLIB_CLOCK_INFO. | ||
4758 | USHORT usClockInfoArrayOffset; | ||
4759 | |||
4760 | // offset from start of this table to array of ATOM_PPLIB_NONCLOCK_INFO | ||
4761 | USHORT usNonClockInfoArrayOffset; | ||
4762 | |||
4763 | USHORT usBackbiasTime; // in microseconds | ||
4764 | USHORT usVoltageTime; // in microseconds | ||
4765 | USHORT usTableSize; //the size of this structure, or the extended structure | ||
4766 | |||
4767 | ULONG ulPlatformCaps; // See ATOM_PPLIB_CAPS_* | ||
4768 | |||
4769 | ATOM_PPLIB_THERMALCONTROLLER sThermalController; | ||
4770 | |||
4771 | USHORT usBootClockInfoOffset; | ||
4772 | USHORT usBootNonClockInfoOffset; | ||
4773 | |||
4774 | } ATOM_PPLIB_POWERPLAYTABLE; | ||
4775 | |||
4776 | //// ATOM_PPLIB_NONCLOCK_INFO::usClassification | ||
4777 | #define ATOM_PPLIB_CLASSIFICATION_UI_MASK 0x0007 | ||
4778 | #define ATOM_PPLIB_CLASSIFICATION_UI_SHIFT 0 | ||
4779 | #define ATOM_PPLIB_CLASSIFICATION_UI_NONE 0 | ||
4780 | #define ATOM_PPLIB_CLASSIFICATION_UI_BATTERY 1 | ||
4781 | #define ATOM_PPLIB_CLASSIFICATION_UI_BALANCED 3 | ||
4782 | #define ATOM_PPLIB_CLASSIFICATION_UI_PERFORMANCE 5 | ||
4783 | // 2, 4, 6, 7 are reserved | ||
4784 | |||
4785 | #define ATOM_PPLIB_CLASSIFICATION_BOOT 0x0008 | ||
4786 | #define ATOM_PPLIB_CLASSIFICATION_THERMAL 0x0010 | ||
4787 | #define ATOM_PPLIB_CLASSIFICATION_LIMITEDPOWERSOURCE 0x0020 | ||
4788 | #define ATOM_PPLIB_CLASSIFICATION_REST 0x0040 | ||
4789 | #define ATOM_PPLIB_CLASSIFICATION_FORCED 0x0080 | ||
4790 | #define ATOM_PPLIB_CLASSIFICATION_3DPERFORMANCE 0x0100 | ||
4791 | #define ATOM_PPLIB_CLASSIFICATION_OVERDRIVETEMPLATE 0x0200 | ||
4792 | #define ATOM_PPLIB_CLASSIFICATION_UVDSTATE 0x0400 | ||
4793 | #define ATOM_PPLIB_CLASSIFICATION_3DLOW 0x0800 | ||
4794 | #define ATOM_PPLIB_CLASSIFICATION_ACPI 0x1000 | ||
4795 | // remaining 3 bits are reserved | ||
4796 | |||
4797 | //// ATOM_PPLIB_NONCLOCK_INFO::ulCapsAndSettings | ||
4798 | #define ATOM_PPLIB_SINGLE_DISPLAY_ONLY 0x00000001 | ||
4799 | #define ATOM_PPLIB_SUPPORTS_VIDEO_PLAYBACK 0x00000002 | ||
4800 | |||
4801 | // 0 is 2.5Gb/s, 1 is 5Gb/s | ||
4802 | #define ATOM_PPLIB_PCIE_LINK_SPEED_MASK 0x00000004 | ||
4803 | #define ATOM_PPLIB_PCIE_LINK_SPEED_SHIFT 2 | ||
4804 | |||
4805 | // lanes - 1: 1, 2, 4, 8, 12, 16 permitted by PCIE spec | ||
4806 | #define ATOM_PPLIB_PCIE_LINK_WIDTH_MASK 0x000000F8 | ||
4807 | #define ATOM_PPLIB_PCIE_LINK_WIDTH_SHIFT 3 | ||
4808 | |||
4809 | // lookup into reduced refresh-rate table | ||
4810 | #define ATOM_PPLIB_LIMITED_REFRESHRATE_VALUE_MASK 0x00000F00 | ||
4811 | #define ATOM_PPLIB_LIMITED_REFRESHRATE_VALUE_SHIFT 8 | ||
4812 | |||
4813 | #define ATOM_PPLIB_LIMITED_REFRESHRATE_UNLIMITED 0 | ||
4814 | #define ATOM_PPLIB_LIMITED_REFRESHRATE_50HZ 1 | ||
4815 | // 2-15 TBD as needed. | ||
4816 | |||
4817 | #define ATOM_PPLIB_SOFTWARE_DISABLE_LOADBALANCING 0x00001000 | ||
4818 | #define ATOM_PPLIB_SOFTWARE_ENABLE_SLEEP_FOR_TIMESTAMPS 0x00002000 | ||
4819 | #define ATOM_PPLIB_ENABLE_VARIBRIGHT 0x00008000 | ||
4820 | |||
4821 | #define ATOM_PPLIB_DISALLOW_ON_DC 0x00004000 | ||
4822 | |||
4823 | // Contained in an array starting at the offset | ||
4824 | // in ATOM_PPLIB_POWERPLAYTABLE::usNonClockInfoArrayOffset. | ||
4825 | // referenced from ATOM_PPLIB_STATE_INFO::ucNonClockStateIndex | ||
4826 | typedef struct _ATOM_PPLIB_NONCLOCK_INFO | ||
4827 | { | ||
4828 | USHORT usClassification; | ||
4829 | UCHAR ucMinTemperature; | ||
4830 | UCHAR ucMaxTemperature; | ||
4831 | ULONG ulCapsAndSettings; | ||
4832 | UCHAR ucRequiredPower; | ||
4833 | UCHAR ucUnused1[3]; | ||
4834 | } ATOM_PPLIB_NONCLOCK_INFO; | ||
4835 | |||
4836 | // Contained in an array starting at the offset | ||
4837 | // in ATOM_PPLIB_POWERPLAYTABLE::usClockInfoArrayOffset. | ||
4838 | // referenced from ATOM_PPLIB_STATE::ucClockStateIndices | ||
4839 | typedef struct _ATOM_PPLIB_R600_CLOCK_INFO | ||
4840 | { | ||
4841 | USHORT usEngineClockLow; | ||
4842 | UCHAR ucEngineClockHigh; | ||
4843 | |||
4844 | USHORT usMemoryClockLow; | ||
4845 | UCHAR ucMemoryClockHigh; | ||
4846 | |||
4847 | USHORT usVDDC; | ||
4848 | USHORT usUnused1; | ||
4849 | USHORT usUnused2; | ||
4850 | |||
4851 | ULONG ulFlags; // ATOM_PPLIB_R600_FLAGS_* | ||
4852 | |||
4853 | } ATOM_PPLIB_R600_CLOCK_INFO; | ||
4854 | |||
4855 | // ulFlags in ATOM_PPLIB_R600_CLOCK_INFO | ||
4856 | #define ATOM_PPLIB_R600_FLAGS_PCIEGEN2 1 | ||
4857 | #define ATOM_PPLIB_R600_FLAGS_UVDSAFE 2 | ||
4858 | #define ATOM_PPLIB_R600_FLAGS_BACKBIASENABLE 4 | ||
4859 | #define ATOM_PPLIB_R600_FLAGS_MEMORY_ODT_OFF 8 | ||
4860 | #define ATOM_PPLIB_R600_FLAGS_MEMORY_DLL_OFF 16 | ||
4861 | |||
4862 | typedef struct _ATOM_PPLIB_RS780_CLOCK_INFO | ||
4863 | |||
4864 | { | ||
4865 | USHORT usLowEngineClockLow; // Low Engine clock in MHz (the same way as on the R600). | ||
4866 | UCHAR ucLowEngineClockHigh; | ||
4867 | USHORT usHighEngineClockLow; // High Engine clock in MHz. | ||
4868 | UCHAR ucHighEngineClockHigh; | ||
4869 | USHORT usMemoryClockLow; // For now one of the ATOM_PPLIB_RS780_SPMCLK_XXXX constants. | ||
4870 | UCHAR ucMemoryClockHigh; // Currentyl unused. | ||
4871 | UCHAR ucPadding; // For proper alignment and size. | ||
4872 | USHORT usVDDC; // For the 780, use: None, Low, High, Variable | ||
4873 | UCHAR ucMaxHTLinkWidth; // From SBIOS - {2, 4, 8, 16} | ||
4874 | UCHAR ucMinHTLinkWidth; // From SBIOS - {2, 4, 8, 16}. Effective only if CDLW enabled. Minimum down stream width could be bigger as display BW requriement. | ||
4875 | USHORT usHTLinkFreq; // See definition ATOM_PPLIB_RS780_HTLINKFREQ_xxx or in MHz(>=200). | ||
4876 | ULONG ulFlags; | ||
4877 | } ATOM_PPLIB_RS780_CLOCK_INFO; | ||
4878 | |||
4879 | #define ATOM_PPLIB_RS780_VOLTAGE_NONE 0 | ||
4880 | #define ATOM_PPLIB_RS780_VOLTAGE_LOW 1 | ||
4881 | #define ATOM_PPLIB_RS780_VOLTAGE_HIGH 2 | ||
4882 | #define ATOM_PPLIB_RS780_VOLTAGE_VARIABLE 3 | ||
4883 | |||
4884 | #define ATOM_PPLIB_RS780_SPMCLK_NONE 0 // We cannot change the side port memory clock, leave it as it is. | ||
4885 | #define ATOM_PPLIB_RS780_SPMCLK_LOW 1 | ||
4886 | #define ATOM_PPLIB_RS780_SPMCLK_HIGH 2 | ||
4887 | |||
4888 | #define ATOM_PPLIB_RS780_HTLINKFREQ_NONE 0 | ||
4889 | #define ATOM_PPLIB_RS780_HTLINKFREQ_LOW 1 | ||
4890 | #define ATOM_PPLIB_RS780_HTLINKFREQ_HIGH 2 | ||
4891 | |||
4693 | /**************************************************************************/ | 4892 | /**************************************************************************/ |
4694 | 4893 | ||
4695 | /* Following definitions are for compatiblity issue in different SW components. */ | 4894 | /* Following definitions are for compatiblity issue in different SW components. */ |
diff --git a/drivers/gpu/drm/radeon/atombios_dp.c b/drivers/gpu/drm/radeon/atombios_dp.c index 0d63c4436e7c..3eb0ca5b3d73 100644 --- a/drivers/gpu/drm/radeon/atombios_dp.c +++ b/drivers/gpu/drm/radeon/atombios_dp.c | |||
@@ -468,7 +468,8 @@ void radeon_dp_set_link_config(struct drm_connector *connector, | |||
468 | struct radeon_connector *radeon_connector; | 468 | struct radeon_connector *radeon_connector; |
469 | struct radeon_connector_atom_dig *dig_connector; | 469 | struct radeon_connector_atom_dig *dig_connector; |
470 | 470 | ||
471 | if (connector->connector_type != DRM_MODE_CONNECTOR_DisplayPort) | 471 | if ((connector->connector_type != DRM_MODE_CONNECTOR_DisplayPort) || |
472 | (connector->connector_type != DRM_MODE_CONNECTOR_eDP)) | ||
472 | return; | 473 | return; |
473 | 474 | ||
474 | radeon_connector = to_radeon_connector(connector); | 475 | radeon_connector = to_radeon_connector(connector); |
@@ -582,7 +583,8 @@ void dp_link_train(struct drm_encoder *encoder, | |||
582 | u8 train_set[4]; | 583 | u8 train_set[4]; |
583 | int i; | 584 | int i; |
584 | 585 | ||
585 | if (connector->connector_type != DRM_MODE_CONNECTOR_DisplayPort) | 586 | if ((connector->connector_type != DRM_MODE_CONNECTOR_DisplayPort) || |
587 | (connector->connector_type != DRM_MODE_CONNECTOR_eDP)) | ||
586 | return; | 588 | return; |
587 | 589 | ||
588 | if (!radeon_encoder->enc_priv) | 590 | if (!radeon_encoder->enc_priv) |
diff --git a/drivers/gpu/drm/radeon/mkregtable.c b/drivers/gpu/drm/radeon/mkregtable.c index 0d79577c1576..607241c6a8a9 100644 --- a/drivers/gpu/drm/radeon/mkregtable.c +++ b/drivers/gpu/drm/radeon/mkregtable.c | |||
@@ -661,8 +661,10 @@ static int parser_auth(struct table *t, const char *filename) | |||
661 | fseek(file, 0, SEEK_SET); | 661 | fseek(file, 0, SEEK_SET); |
662 | 662 | ||
663 | /* get header */ | 663 | /* get header */ |
664 | if (fgets(buf, 1024, file) == NULL) | 664 | if (fgets(buf, 1024, file) == NULL) { |
665 | fclose(file); | ||
665 | return -1; | 666 | return -1; |
667 | } | ||
666 | 668 | ||
667 | /* first line will contain the last register | 669 | /* first line will contain the last register |
668 | * and gpu name */ | 670 | * and gpu name */ |
diff --git a/drivers/gpu/drm/radeon/r100.c b/drivers/gpu/drm/radeon/r100.c index 84e5df766d3f..8760d66e058a 100644 --- a/drivers/gpu/drm/radeon/r100.c +++ b/drivers/gpu/drm/radeon/r100.c | |||
@@ -131,7 +131,8 @@ void r100_hpd_init(struct radeon_device *rdev) | |||
131 | break; | 131 | break; |
132 | } | 132 | } |
133 | } | 133 | } |
134 | r100_irq_set(rdev); | 134 | if (rdev->irq.installed) |
135 | r100_irq_set(rdev); | ||
135 | } | 136 | } |
136 | 137 | ||
137 | void r100_hpd_fini(struct radeon_device *rdev) | 138 | void r100_hpd_fini(struct radeon_device *rdev) |
@@ -243,6 +244,11 @@ int r100_irq_set(struct radeon_device *rdev) | |||
243 | { | 244 | { |
244 | uint32_t tmp = 0; | 245 | uint32_t tmp = 0; |
245 | 246 | ||
247 | if (!rdev->irq.installed) { | ||
248 | WARN(1, "Can't enable IRQ/MSI because no handler is installed.\n"); | ||
249 | WREG32(R_000040_GEN_INT_CNTL, 0); | ||
250 | return -EINVAL; | ||
251 | } | ||
246 | if (rdev->irq.sw_int) { | 252 | if (rdev->irq.sw_int) { |
247 | tmp |= RADEON_SW_INT_ENABLE; | 253 | tmp |= RADEON_SW_INT_ENABLE; |
248 | } | 254 | } |
@@ -356,6 +362,11 @@ void r100_fence_ring_emit(struct radeon_device *rdev, | |||
356 | /* Wait until IDLE & CLEAN */ | 362 | /* Wait until IDLE & CLEAN */ |
357 | radeon_ring_write(rdev, PACKET0(0x1720, 0)); | 363 | radeon_ring_write(rdev, PACKET0(0x1720, 0)); |
358 | radeon_ring_write(rdev, (1 << 16) | (1 << 17)); | 364 | radeon_ring_write(rdev, (1 << 16) | (1 << 17)); |
365 | radeon_ring_write(rdev, PACKET0(RADEON_HOST_PATH_CNTL, 0)); | ||
366 | radeon_ring_write(rdev, rdev->config.r100.hdp_cntl | | ||
367 | RADEON_HDP_READ_BUFFER_INVALIDATE); | ||
368 | radeon_ring_write(rdev, PACKET0(RADEON_HOST_PATH_CNTL, 0)); | ||
369 | radeon_ring_write(rdev, rdev->config.r100.hdp_cntl); | ||
359 | /* Emit fence sequence & fire IRQ */ | 370 | /* Emit fence sequence & fire IRQ */ |
360 | radeon_ring_write(rdev, PACKET0(rdev->fence_drv.scratch_reg, 0)); | 371 | radeon_ring_write(rdev, PACKET0(rdev->fence_drv.scratch_reg, 0)); |
361 | radeon_ring_write(rdev, fence->seq); | 372 | radeon_ring_write(rdev, fence->seq); |
@@ -1713,14 +1724,6 @@ void r100_gpu_init(struct radeon_device *rdev) | |||
1713 | r100_hdp_reset(rdev); | 1724 | r100_hdp_reset(rdev); |
1714 | } | 1725 | } |
1715 | 1726 | ||
1716 | void r100_hdp_flush(struct radeon_device *rdev) | ||
1717 | { | ||
1718 | u32 tmp; | ||
1719 | tmp = RREG32(RADEON_HOST_PATH_CNTL); | ||
1720 | tmp |= RADEON_HDP_READ_BUFFER_INVALIDATE; | ||
1721 | WREG32(RADEON_HOST_PATH_CNTL, tmp); | ||
1722 | } | ||
1723 | |||
1724 | void r100_hdp_reset(struct radeon_device *rdev) | 1727 | void r100_hdp_reset(struct radeon_device *rdev) |
1725 | { | 1728 | { |
1726 | uint32_t tmp; | 1729 | uint32_t tmp; |
@@ -2881,6 +2884,10 @@ int r100_cs_track_check(struct radeon_device *rdev, struct r100_cs_track *track) | |||
2881 | 2884 | ||
2882 | for (i = 0; i < track->num_cb; i++) { | 2885 | for (i = 0; i < track->num_cb; i++) { |
2883 | if (track->cb[i].robj == NULL) { | 2886 | if (track->cb[i].robj == NULL) { |
2887 | if (!(track->fastfill || track->color_channel_mask || | ||
2888 | track->blend_read_enable)) { | ||
2889 | continue; | ||
2890 | } | ||
2884 | DRM_ERROR("[drm] No buffer for color buffer %d !\n", i); | 2891 | DRM_ERROR("[drm] No buffer for color buffer %d !\n", i); |
2885 | return -EINVAL; | 2892 | return -EINVAL; |
2886 | } | 2893 | } |
@@ -3309,6 +3316,7 @@ static int r100_startup(struct radeon_device *rdev) | |||
3309 | } | 3316 | } |
3310 | /* Enable IRQ */ | 3317 | /* Enable IRQ */ |
3311 | r100_irq_set(rdev); | 3318 | r100_irq_set(rdev); |
3319 | rdev->config.r100.hdp_cntl = RREG32(RADEON_HOST_PATH_CNTL); | ||
3312 | /* 1M ring buffer */ | 3320 | /* 1M ring buffer */ |
3313 | r = r100_cp_init(rdev, 1024 * 1024); | 3321 | r = r100_cp_init(rdev, 1024 * 1024); |
3314 | if (r) { | 3322 | if (r) { |
@@ -3367,6 +3375,7 @@ void r100_fini(struct radeon_device *rdev) | |||
3367 | radeon_gem_fini(rdev); | 3375 | radeon_gem_fini(rdev); |
3368 | if (rdev->flags & RADEON_IS_PCI) | 3376 | if (rdev->flags & RADEON_IS_PCI) |
3369 | r100_pci_gart_fini(rdev); | 3377 | r100_pci_gart_fini(rdev); |
3378 | radeon_agp_fini(rdev); | ||
3370 | radeon_irq_kms_fini(rdev); | 3379 | radeon_irq_kms_fini(rdev); |
3371 | radeon_fence_driver_fini(rdev); | 3380 | radeon_fence_driver_fini(rdev); |
3372 | radeon_bo_fini(rdev); | 3381 | radeon_bo_fini(rdev); |
diff --git a/drivers/gpu/drm/radeon/r100_track.h b/drivers/gpu/drm/radeon/r100_track.h index 7188c3778ee2..b27a6999d219 100644 --- a/drivers/gpu/drm/radeon/r100_track.h +++ b/drivers/gpu/drm/radeon/r100_track.h | |||
@@ -67,13 +67,15 @@ struct r100_cs_track { | |||
67 | unsigned immd_dwords; | 67 | unsigned immd_dwords; |
68 | unsigned num_arrays; | 68 | unsigned num_arrays; |
69 | unsigned max_indx; | 69 | unsigned max_indx; |
70 | unsigned color_channel_mask; | ||
70 | struct r100_cs_track_array arrays[11]; | 71 | struct r100_cs_track_array arrays[11]; |
71 | struct r100_cs_track_cb cb[R300_MAX_CB]; | 72 | struct r100_cs_track_cb cb[R300_MAX_CB]; |
72 | struct r100_cs_track_cb zb; | 73 | struct r100_cs_track_cb zb; |
73 | struct r100_cs_track_texture textures[R300_TRACK_MAX_TEXTURE]; | 74 | struct r100_cs_track_texture textures[R300_TRACK_MAX_TEXTURE]; |
74 | bool z_enabled; | 75 | bool z_enabled; |
75 | bool separate_cube; | 76 | bool separate_cube; |
76 | 77 | bool fastfill; | |
78 | bool blend_read_enable; | ||
77 | }; | 79 | }; |
78 | 80 | ||
79 | int r100_cs_track_check(struct radeon_device *rdev, struct r100_cs_track *track); | 81 | int r100_cs_track_check(struct radeon_device *rdev, struct r100_cs_track *track); |
diff --git a/drivers/gpu/drm/radeon/r300.c b/drivers/gpu/drm/radeon/r300.c index 83490c2b5061..0051d11b907c 100644 --- a/drivers/gpu/drm/radeon/r300.c +++ b/drivers/gpu/drm/radeon/r300.c | |||
@@ -36,7 +36,15 @@ | |||
36 | #include "rv350d.h" | 36 | #include "rv350d.h" |
37 | #include "r300_reg_safe.h" | 37 | #include "r300_reg_safe.h" |
38 | 38 | ||
39 | /* This files gather functions specifics to: r300,r350,rv350,rv370,rv380 */ | 39 | /* This files gather functions specifics to: r300,r350,rv350,rv370,rv380 |
40 | * | ||
41 | * GPU Errata: | ||
42 | * - HOST_PATH_CNTL: r300 family seems to dislike write to HOST_PATH_CNTL | ||
43 | * using MMIO to flush host path read cache, this lead to HARDLOCKUP. | ||
44 | * However, scheduling such write to the ring seems harmless, i suspect | ||
45 | * the CP read collide with the flush somehow, or maybe the MC, hard to | ||
46 | * tell. (Jerome Glisse) | ||
47 | */ | ||
40 | 48 | ||
41 | /* | 49 | /* |
42 | * rv370,rv380 PCIE GART | 50 | * rv370,rv380 PCIE GART |
@@ -178,6 +186,11 @@ void r300_fence_ring_emit(struct radeon_device *rdev, | |||
178 | /* Wait until IDLE & CLEAN */ | 186 | /* Wait until IDLE & CLEAN */ |
179 | radeon_ring_write(rdev, PACKET0(0x1720, 0)); | 187 | radeon_ring_write(rdev, PACKET0(0x1720, 0)); |
180 | radeon_ring_write(rdev, (1 << 17) | (1 << 16) | (1 << 9)); | 188 | radeon_ring_write(rdev, (1 << 17) | (1 << 16) | (1 << 9)); |
189 | radeon_ring_write(rdev, PACKET0(RADEON_HOST_PATH_CNTL, 0)); | ||
190 | radeon_ring_write(rdev, rdev->config.r300.hdp_cntl | | ||
191 | RADEON_HDP_READ_BUFFER_INVALIDATE); | ||
192 | radeon_ring_write(rdev, PACKET0(RADEON_HOST_PATH_CNTL, 0)); | ||
193 | radeon_ring_write(rdev, rdev->config.r300.hdp_cntl); | ||
181 | /* Emit fence sequence & fire IRQ */ | 194 | /* Emit fence sequence & fire IRQ */ |
182 | radeon_ring_write(rdev, PACKET0(rdev->fence_drv.scratch_reg, 0)); | 195 | radeon_ring_write(rdev, PACKET0(rdev->fence_drv.scratch_reg, 0)); |
183 | radeon_ring_write(rdev, fence->seq); | 196 | radeon_ring_write(rdev, fence->seq); |
@@ -887,6 +900,14 @@ static int r300_packet0_check(struct radeon_cs_parser *p, | |||
887 | track->textures[i].cpp = 1; | 900 | track->textures[i].cpp = 1; |
888 | track->textures[i].compress_format = R100_TRACK_COMP_DXT1; | 901 | track->textures[i].compress_format = R100_TRACK_COMP_DXT1; |
889 | break; | 902 | break; |
903 | case R300_TX_FORMAT_ATI2N: | ||
904 | if (p->rdev->family < CHIP_R420) { | ||
905 | DRM_ERROR("Invalid texture format %u\n", | ||
906 | (idx_value & 0x1F)); | ||
907 | return -EINVAL; | ||
908 | } | ||
909 | /* The same rules apply as for DXT3/5. */ | ||
910 | /* Pass through. */ | ||
890 | case R300_TX_FORMAT_DXT3: | 911 | case R300_TX_FORMAT_DXT3: |
891 | case R300_TX_FORMAT_DXT5: | 912 | case R300_TX_FORMAT_DXT5: |
892 | track->textures[i].cpp = 1; | 913 | track->textures[i].cpp = 1; |
@@ -951,6 +972,16 @@ static int r300_packet0_check(struct radeon_cs_parser *p, | |||
951 | track->textures[i].width_11 = tmp; | 972 | track->textures[i].width_11 = tmp; |
952 | tmp = ((idx_value >> 16) & 1) << 11; | 973 | tmp = ((idx_value >> 16) & 1) << 11; |
953 | track->textures[i].height_11 = tmp; | 974 | track->textures[i].height_11 = tmp; |
975 | |||
976 | /* ATI1N */ | ||
977 | if (idx_value & (1 << 14)) { | ||
978 | /* The same rules apply as for DXT1. */ | ||
979 | track->textures[i].compress_format = | ||
980 | R100_TRACK_COMP_DXT1; | ||
981 | } | ||
982 | } else if (idx_value & (1 << 14)) { | ||
983 | DRM_ERROR("Forbidden bit TXFORMAT_MSB\n"); | ||
984 | return -EINVAL; | ||
954 | } | 985 | } |
955 | break; | 986 | break; |
956 | case 0x4480: | 987 | case 0x4480: |
@@ -992,6 +1023,18 @@ static int r300_packet0_check(struct radeon_cs_parser *p, | |||
992 | } | 1023 | } |
993 | ib[idx] = idx_value + ((u32)reloc->lobj.gpu_offset); | 1024 | ib[idx] = idx_value + ((u32)reloc->lobj.gpu_offset); |
994 | break; | 1025 | break; |
1026 | case 0x4e0c: | ||
1027 | /* RB3D_COLOR_CHANNEL_MASK */ | ||
1028 | track->color_channel_mask = idx_value; | ||
1029 | break; | ||
1030 | case 0x4d1c: | ||
1031 | /* ZB_BW_CNTL */ | ||
1032 | track->fastfill = !!(idx_value & (1 << 2)); | ||
1033 | break; | ||
1034 | case 0x4e04: | ||
1035 | /* RB3D_BLENDCNTL */ | ||
1036 | track->blend_read_enable = !!(idx_value & (1 << 2)); | ||
1037 | break; | ||
995 | case 0x4be8: | 1038 | case 0x4be8: |
996 | /* valid register only on RV530 */ | 1039 | /* valid register only on RV530 */ |
997 | if (p->rdev->family == CHIP_RV530) | 1040 | if (p->rdev->family == CHIP_RV530) |
@@ -1228,6 +1271,7 @@ static int r300_startup(struct radeon_device *rdev) | |||
1228 | } | 1271 | } |
1229 | /* Enable IRQ */ | 1272 | /* Enable IRQ */ |
1230 | r100_irq_set(rdev); | 1273 | r100_irq_set(rdev); |
1274 | rdev->config.r300.hdp_cntl = RREG32(RADEON_HOST_PATH_CNTL); | ||
1231 | /* 1M ring buffer */ | 1275 | /* 1M ring buffer */ |
1232 | r = r100_cp_init(rdev, 1024 * 1024); | 1276 | r = r100_cp_init(rdev, 1024 * 1024); |
1233 | if (r) { | 1277 | if (r) { |
@@ -1292,6 +1336,7 @@ void r300_fini(struct radeon_device *rdev) | |||
1292 | rv370_pcie_gart_fini(rdev); | 1336 | rv370_pcie_gart_fini(rdev); |
1293 | if (rdev->flags & RADEON_IS_PCI) | 1337 | if (rdev->flags & RADEON_IS_PCI) |
1294 | r100_pci_gart_fini(rdev); | 1338 | r100_pci_gart_fini(rdev); |
1339 | radeon_agp_fini(rdev); | ||
1295 | radeon_irq_kms_fini(rdev); | 1340 | radeon_irq_kms_fini(rdev); |
1296 | radeon_fence_driver_fini(rdev); | 1341 | radeon_fence_driver_fini(rdev); |
1297 | radeon_bo_fini(rdev); | 1342 | radeon_bo_fini(rdev); |
diff --git a/drivers/gpu/drm/radeon/r300_cmdbuf.c b/drivers/gpu/drm/radeon/r300_cmdbuf.c index cb2e470f97d4..34bffa0e4b73 100644 --- a/drivers/gpu/drm/radeon/r300_cmdbuf.c +++ b/drivers/gpu/drm/radeon/r300_cmdbuf.c | |||
@@ -990,7 +990,7 @@ static inline int r300_emit_r500fp(drm_radeon_private_t *dev_priv, | |||
990 | int sz; | 990 | int sz; |
991 | int addr; | 991 | int addr; |
992 | int type; | 992 | int type; |
993 | int clamp; | 993 | int isclamp; |
994 | int stride; | 994 | int stride; |
995 | RING_LOCALS; | 995 | RING_LOCALS; |
996 | 996 | ||
@@ -999,10 +999,10 @@ static inline int r300_emit_r500fp(drm_radeon_private_t *dev_priv, | |||
999 | addr = ((header.r500fp.adrhi_flags & 1) << 8) | header.r500fp.adrlo; | 999 | addr = ((header.r500fp.adrhi_flags & 1) << 8) | header.r500fp.adrlo; |
1000 | 1000 | ||
1001 | type = !!(header.r500fp.adrhi_flags & R500FP_CONSTANT_TYPE); | 1001 | type = !!(header.r500fp.adrhi_flags & R500FP_CONSTANT_TYPE); |
1002 | clamp = !!(header.r500fp.adrhi_flags & R500FP_CONSTANT_CLAMP); | 1002 | isclamp = !!(header.r500fp.adrhi_flags & R500FP_CONSTANT_CLAMP); |
1003 | 1003 | ||
1004 | addr |= (type << 16); | 1004 | addr |= (type << 16); |
1005 | addr |= (clamp << 17); | 1005 | addr |= (isclamp << 17); |
1006 | 1006 | ||
1007 | stride = type ? 4 : 6; | 1007 | stride = type ? 4 : 6; |
1008 | 1008 | ||
diff --git a/drivers/gpu/drm/radeon/r300_reg.h b/drivers/gpu/drm/radeon/r300_reg.h index 4b7afef35a65..1735a2b69580 100644 --- a/drivers/gpu/drm/radeon/r300_reg.h +++ b/drivers/gpu/drm/radeon/r300_reg.h | |||
@@ -900,6 +900,7 @@ | |||
900 | # define R300_TX_FORMAT_FL_I32 0x1B | 900 | # define R300_TX_FORMAT_FL_I32 0x1B |
901 | # define R300_TX_FORMAT_FL_I32A32 0x1C | 901 | # define R300_TX_FORMAT_FL_I32A32 0x1C |
902 | # define R300_TX_FORMAT_FL_R32G32B32A32 0x1D | 902 | # define R300_TX_FORMAT_FL_R32G32B32A32 0x1D |
903 | # define R300_TX_FORMAT_ATI2N 0x1F | ||
903 | /* alpha modes, convenience mostly */ | 904 | /* alpha modes, convenience mostly */ |
904 | /* if you have alpha, pick constant appropriate to the | 905 | /* if you have alpha, pick constant appropriate to the |
905 | number of channels (1 for I8, 2 for I8A8, 4 for R8G8B8A8, etc */ | 906 | number of channels (1 for I8, 2 for I8A8, 4 for R8G8B8A8, etc */ |
diff --git a/drivers/gpu/drm/radeon/r420.c b/drivers/gpu/drm/radeon/r420.c index c05a7270cf0c..053404e71a9d 100644 --- a/drivers/gpu/drm/radeon/r420.c +++ b/drivers/gpu/drm/radeon/r420.c | |||
@@ -30,7 +30,15 @@ | |||
30 | #include "radeon_reg.h" | 30 | #include "radeon_reg.h" |
31 | #include "radeon.h" | 31 | #include "radeon.h" |
32 | #include "atom.h" | 32 | #include "atom.h" |
33 | #include "r100d.h" | ||
33 | #include "r420d.h" | 34 | #include "r420d.h" |
35 | #include "r420_reg_safe.h" | ||
36 | |||
37 | static void r420_set_reg_safe(struct radeon_device *rdev) | ||
38 | { | ||
39 | rdev->config.r300.reg_safe_bm = r420_reg_safe_bm; | ||
40 | rdev->config.r300.reg_safe_bm_size = ARRAY_SIZE(r420_reg_safe_bm); | ||
41 | } | ||
34 | 42 | ||
35 | int r420_mc_init(struct radeon_device *rdev) | 43 | int r420_mc_init(struct radeon_device *rdev) |
36 | { | 44 | { |
@@ -165,6 +173,34 @@ static void r420_clock_resume(struct radeon_device *rdev) | |||
165 | WREG32_PLL(R_00000D_SCLK_CNTL, sclk_cntl); | 173 | WREG32_PLL(R_00000D_SCLK_CNTL, sclk_cntl); |
166 | } | 174 | } |
167 | 175 | ||
176 | static void r420_cp_errata_init(struct radeon_device *rdev) | ||
177 | { | ||
178 | /* RV410 and R420 can lock up if CP DMA to host memory happens | ||
179 | * while the 2D engine is busy. | ||
180 | * | ||
181 | * The proper workaround is to queue a RESYNC at the beginning | ||
182 | * of the CP init, apparently. | ||
183 | */ | ||
184 | radeon_scratch_get(rdev, &rdev->config.r300.resync_scratch); | ||
185 | radeon_ring_lock(rdev, 8); | ||
186 | radeon_ring_write(rdev, PACKET0(R300_CP_RESYNC_ADDR, 1)); | ||
187 | radeon_ring_write(rdev, rdev->config.r300.resync_scratch); | ||
188 | radeon_ring_write(rdev, 0xDEADBEEF); | ||
189 | radeon_ring_unlock_commit(rdev); | ||
190 | } | ||
191 | |||
192 | static void r420_cp_errata_fini(struct radeon_device *rdev) | ||
193 | { | ||
194 | /* Catch the RESYNC we dispatched all the way back, | ||
195 | * at the very beginning of the CP init. | ||
196 | */ | ||
197 | radeon_ring_lock(rdev, 8); | ||
198 | radeon_ring_write(rdev, PACKET0(R300_RB3D_DSTCACHE_CTLSTAT, 0)); | ||
199 | radeon_ring_write(rdev, R300_RB3D_DC_FINISH); | ||
200 | radeon_ring_unlock_commit(rdev); | ||
201 | radeon_scratch_free(rdev, rdev->config.r300.resync_scratch); | ||
202 | } | ||
203 | |||
168 | static int r420_startup(struct radeon_device *rdev) | 204 | static int r420_startup(struct radeon_device *rdev) |
169 | { | 205 | { |
170 | int r; | 206 | int r; |
@@ -190,12 +226,14 @@ static int r420_startup(struct radeon_device *rdev) | |||
190 | r420_pipes_init(rdev); | 226 | r420_pipes_init(rdev); |
191 | /* Enable IRQ */ | 227 | /* Enable IRQ */ |
192 | r100_irq_set(rdev); | 228 | r100_irq_set(rdev); |
229 | rdev->config.r300.hdp_cntl = RREG32(RADEON_HOST_PATH_CNTL); | ||
193 | /* 1M ring buffer */ | 230 | /* 1M ring buffer */ |
194 | r = r100_cp_init(rdev, 1024 * 1024); | 231 | r = r100_cp_init(rdev, 1024 * 1024); |
195 | if (r) { | 232 | if (r) { |
196 | dev_err(rdev->dev, "failled initializing CP (%d).\n", r); | 233 | dev_err(rdev->dev, "failled initializing CP (%d).\n", r); |
197 | return r; | 234 | return r; |
198 | } | 235 | } |
236 | r420_cp_errata_init(rdev); | ||
199 | r = r100_wb_init(rdev); | 237 | r = r100_wb_init(rdev); |
200 | if (r) { | 238 | if (r) { |
201 | dev_err(rdev->dev, "failled initializing WB (%d).\n", r); | 239 | dev_err(rdev->dev, "failled initializing WB (%d).\n", r); |
@@ -238,6 +276,7 @@ int r420_resume(struct radeon_device *rdev) | |||
238 | 276 | ||
239 | int r420_suspend(struct radeon_device *rdev) | 277 | int r420_suspend(struct radeon_device *rdev) |
240 | { | 278 | { |
279 | r420_cp_errata_fini(rdev); | ||
241 | r100_cp_disable(rdev); | 280 | r100_cp_disable(rdev); |
242 | r100_wb_disable(rdev); | 281 | r100_wb_disable(rdev); |
243 | r100_irq_disable(rdev); | 282 | r100_irq_disable(rdev); |
@@ -346,7 +385,7 @@ int r420_init(struct radeon_device *rdev) | |||
346 | if (r) | 385 | if (r) |
347 | return r; | 386 | return r; |
348 | } | 387 | } |
349 | r300_set_reg_safe(rdev); | 388 | r420_set_reg_safe(rdev); |
350 | rdev->accel_working = true; | 389 | rdev->accel_working = true; |
351 | r = r420_startup(rdev); | 390 | r = r420_startup(rdev); |
352 | if (r) { | 391 | if (r) { |
diff --git a/drivers/gpu/drm/radeon/r520.c b/drivers/gpu/drm/radeon/r520.c index 0f3843b6dac7..9a189072f2b9 100644 --- a/drivers/gpu/drm/radeon/r520.c +++ b/drivers/gpu/drm/radeon/r520.c | |||
@@ -186,6 +186,7 @@ static int r520_startup(struct radeon_device *rdev) | |||
186 | } | 186 | } |
187 | /* Enable IRQ */ | 187 | /* Enable IRQ */ |
188 | rs600_irq_set(rdev); | 188 | rs600_irq_set(rdev); |
189 | rdev->config.r300.hdp_cntl = RREG32(RADEON_HOST_PATH_CNTL); | ||
189 | /* 1M ring buffer */ | 190 | /* 1M ring buffer */ |
190 | r = r100_cp_init(rdev, 1024 * 1024); | 191 | r = r100_cp_init(rdev, 1024 * 1024); |
191 | if (r) { | 192 | if (r) { |
diff --git a/drivers/gpu/drm/radeon/r600.c b/drivers/gpu/drm/radeon/r600.c index a0ac3c134b1b..c0651991c3e4 100644 --- a/drivers/gpu/drm/radeon/r600.c +++ b/drivers/gpu/drm/radeon/r600.c | |||
@@ -285,7 +285,8 @@ void r600_hpd_init(struct radeon_device *rdev) | |||
285 | } | 285 | } |
286 | } | 286 | } |
287 | } | 287 | } |
288 | r600_irq_set(rdev); | 288 | if (rdev->irq.installed) |
289 | r600_irq_set(rdev); | ||
289 | } | 290 | } |
290 | 291 | ||
291 | void r600_hpd_fini(struct radeon_device *rdev) | 292 | void r600_hpd_fini(struct radeon_device *rdev) |
@@ -726,6 +727,10 @@ int r600_mc_init(struct radeon_device *rdev) | |||
726 | a.full = rfixed_const(100); | 727 | a.full = rfixed_const(100); |
727 | rdev->pm.sclk.full = rfixed_const(rdev->clock.default_sclk); | 728 | rdev->pm.sclk.full = rfixed_const(rdev->clock.default_sclk); |
728 | rdev->pm.sclk.full = rfixed_div(rdev->pm.sclk, a); | 729 | rdev->pm.sclk.full = rfixed_div(rdev->pm.sclk, a); |
730 | |||
731 | if (rdev->flags & RADEON_IS_IGP) | ||
732 | rdev->mc.igp_sideport_enabled = radeon_atombios_sideport_present(rdev); | ||
733 | |||
729 | return 0; | 734 | return 0; |
730 | } | 735 | } |
731 | 736 | ||
@@ -1384,11 +1389,6 @@ void r600_pciep_wreg(struct radeon_device *rdev, u32 reg, u32 v) | |||
1384 | (void)RREG32(PCIE_PORT_DATA); | 1389 | (void)RREG32(PCIE_PORT_DATA); |
1385 | } | 1390 | } |
1386 | 1391 | ||
1387 | void r600_hdp_flush(struct radeon_device *rdev) | ||
1388 | { | ||
1389 | WREG32(R_005480_HDP_MEM_COHERENCY_FLUSH_CNTL, 0x1); | ||
1390 | } | ||
1391 | |||
1392 | /* | 1392 | /* |
1393 | * CP & Ring | 1393 | * CP & Ring |
1394 | */ | 1394 | */ |
@@ -1785,6 +1785,8 @@ void r600_fence_ring_emit(struct radeon_device *rdev, | |||
1785 | radeon_ring_write(rdev, PACKET3(PACKET3_SET_CONFIG_REG, 1)); | 1785 | radeon_ring_write(rdev, PACKET3(PACKET3_SET_CONFIG_REG, 1)); |
1786 | radeon_ring_write(rdev, ((rdev->fence_drv.scratch_reg - PACKET3_SET_CONFIG_REG_OFFSET) >> 2)); | 1786 | radeon_ring_write(rdev, ((rdev->fence_drv.scratch_reg - PACKET3_SET_CONFIG_REG_OFFSET) >> 2)); |
1787 | radeon_ring_write(rdev, fence->seq); | 1787 | radeon_ring_write(rdev, fence->seq); |
1788 | radeon_ring_write(rdev, PACKET0(R_005480_HDP_MEM_COHERENCY_FLUSH_CNTL, 0)); | ||
1789 | radeon_ring_write(rdev, 1); | ||
1788 | /* CP_INTERRUPT packet 3 no longer exists, use packet 0 */ | 1790 | /* CP_INTERRUPT packet 3 no longer exists, use packet 0 */ |
1789 | radeon_ring_write(rdev, PACKET0(CP_INT_STATUS, 0)); | 1791 | radeon_ring_write(rdev, PACKET0(CP_INT_STATUS, 0)); |
1790 | radeon_ring_write(rdev, RB_INT_STAT); | 1792 | radeon_ring_write(rdev, RB_INT_STAT); |
@@ -2089,8 +2091,7 @@ void r600_fini(struct radeon_device *rdev) | |||
2089 | radeon_gem_fini(rdev); | 2091 | radeon_gem_fini(rdev); |
2090 | radeon_fence_driver_fini(rdev); | 2092 | radeon_fence_driver_fini(rdev); |
2091 | radeon_clocks_fini(rdev); | 2093 | radeon_clocks_fini(rdev); |
2092 | if (rdev->flags & RADEON_IS_AGP) | 2094 | radeon_agp_fini(rdev); |
2093 | radeon_agp_fini(rdev); | ||
2094 | radeon_bo_fini(rdev); | 2095 | radeon_bo_fini(rdev); |
2095 | radeon_atombios_fini(rdev); | 2096 | radeon_atombios_fini(rdev); |
2096 | kfree(rdev->bios); | 2097 | kfree(rdev->bios); |
@@ -2461,6 +2462,10 @@ int r600_irq_set(struct radeon_device *rdev) | |||
2461 | u32 mode_int = 0; | 2462 | u32 mode_int = 0; |
2462 | u32 hpd1, hpd2, hpd3, hpd4 = 0, hpd5 = 0, hpd6 = 0; | 2463 | u32 hpd1, hpd2, hpd3, hpd4 = 0, hpd5 = 0, hpd6 = 0; |
2463 | 2464 | ||
2465 | if (!rdev->irq.installed) { | ||
2466 | WARN(1, "Can't enable IRQ/MSI because no handler is installed.\n"); | ||
2467 | return -EINVAL; | ||
2468 | } | ||
2464 | /* don't enable anything if the ih is disabled */ | 2469 | /* don't enable anything if the ih is disabled */ |
2465 | if (!rdev->ih.enabled) | 2470 | if (!rdev->ih.enabled) |
2466 | return 0; | 2471 | return 0; |
diff --git a/drivers/gpu/drm/radeon/r600_blit_kms.c b/drivers/gpu/drm/radeon/r600_blit_kms.c index 9aecafb51b66..8787ea89dc6e 100644 --- a/drivers/gpu/drm/radeon/r600_blit_kms.c +++ b/drivers/gpu/drm/radeon/r600_blit_kms.c | |||
@@ -577,9 +577,9 @@ int r600_blit_prepare_copy(struct radeon_device *rdev, int size_bytes) | |||
577 | ring_size = num_loops * dwords_per_loop; | 577 | ring_size = num_loops * dwords_per_loop; |
578 | /* set default + shaders */ | 578 | /* set default + shaders */ |
579 | ring_size += 40; /* shaders + def state */ | 579 | ring_size += 40; /* shaders + def state */ |
580 | ring_size += 5; /* fence emit for VB IB */ | 580 | ring_size += 7; /* fence emit for VB IB */ |
581 | ring_size += 5; /* done copy */ | 581 | ring_size += 5; /* done copy */ |
582 | ring_size += 5; /* fence emit for done copy */ | 582 | ring_size += 7; /* fence emit for done copy */ |
583 | r = radeon_ring_lock(rdev, ring_size); | 583 | r = radeon_ring_lock(rdev, ring_size); |
584 | WARN_ON(r); | 584 | WARN_ON(r); |
585 | 585 | ||
diff --git a/drivers/gpu/drm/radeon/r600_cs.c b/drivers/gpu/drm/radeon/r600_cs.c index 0d820764f340..44060b92d9e6 100644 --- a/drivers/gpu/drm/radeon/r600_cs.c +++ b/drivers/gpu/drm/radeon/r600_cs.c | |||
@@ -170,7 +170,7 @@ static int r600_cs_packet_next_reloc_nomm(struct radeon_cs_parser *p, | |||
170 | idx, relocs_chunk->length_dw); | 170 | idx, relocs_chunk->length_dw); |
171 | return -EINVAL; | 171 | return -EINVAL; |
172 | } | 172 | } |
173 | *cs_reloc = &p->relocs[0]; | 173 | *cs_reloc = p->relocs; |
174 | (*cs_reloc)->lobj.gpu_offset = (u64)relocs_chunk->kdata[idx + 3] << 32; | 174 | (*cs_reloc)->lobj.gpu_offset = (u64)relocs_chunk->kdata[idx + 3] << 32; |
175 | (*cs_reloc)->lobj.gpu_offset |= relocs_chunk->kdata[idx + 0]; | 175 | (*cs_reloc)->lobj.gpu_offset |= relocs_chunk->kdata[idx + 0]; |
176 | return 0; | 176 | return 0; |
@@ -717,7 +717,7 @@ static int r600_cs_parser_relocs_legacy(struct radeon_cs_parser *p) | |||
717 | if (p->chunk_relocs_idx == -1) { | 717 | if (p->chunk_relocs_idx == -1) { |
718 | return 0; | 718 | return 0; |
719 | } | 719 | } |
720 | p->relocs = kcalloc(1, sizeof(struct radeon_cs_reloc), GFP_KERNEL); | 720 | p->relocs = kzalloc(sizeof(struct radeon_cs_reloc), GFP_KERNEL); |
721 | if (p->relocs == NULL) { | 721 | if (p->relocs == NULL) { |
722 | return -ENOMEM; | 722 | return -ENOMEM; |
723 | } | 723 | } |
diff --git a/drivers/gpu/drm/radeon/radeon.h b/drivers/gpu/drm/radeon/radeon.h index cd650fd3964e..eb5f99b9469d 100644 --- a/drivers/gpu/drm/radeon/radeon.h +++ b/drivers/gpu/drm/radeon/radeon.h | |||
@@ -162,6 +162,7 @@ struct radeon_fence_driver { | |||
162 | struct list_head created; | 162 | struct list_head created; |
163 | struct list_head emited; | 163 | struct list_head emited; |
164 | struct list_head signaled; | 164 | struct list_head signaled; |
165 | bool initialized; | ||
165 | }; | 166 | }; |
166 | 167 | ||
167 | struct radeon_fence { | 168 | struct radeon_fence { |
@@ -202,8 +203,9 @@ struct radeon_surface_reg { | |||
202 | struct radeon_mman { | 203 | struct radeon_mman { |
203 | struct ttm_bo_global_ref bo_global_ref; | 204 | struct ttm_bo_global_ref bo_global_ref; |
204 | struct ttm_global_reference mem_global_ref; | 205 | struct ttm_global_reference mem_global_ref; |
205 | bool mem_global_referenced; | ||
206 | struct ttm_bo_device bdev; | 206 | struct ttm_bo_device bdev; |
207 | bool mem_global_referenced; | ||
208 | bool initialized; | ||
207 | }; | 209 | }; |
208 | 210 | ||
209 | struct radeon_bo { | 211 | struct radeon_bo { |
@@ -317,10 +319,12 @@ struct radeon_mc { | |||
317 | u64 real_vram_size; | 319 | u64 real_vram_size; |
318 | int vram_mtrr; | 320 | int vram_mtrr; |
319 | bool vram_is_ddr; | 321 | bool vram_is_ddr; |
322 | bool igp_sideport_enabled; | ||
320 | }; | 323 | }; |
321 | 324 | ||
322 | int radeon_mc_setup(struct radeon_device *rdev); | 325 | int radeon_mc_setup(struct radeon_device *rdev); |
323 | 326 | bool radeon_combios_sideport_present(struct radeon_device *rdev); | |
327 | bool radeon_atombios_sideport_present(struct radeon_device *rdev); | ||
324 | 328 | ||
325 | /* | 329 | /* |
326 | * GPU scratch registers structures, functions & helpers | 330 | * GPU scratch registers structures, functions & helpers |
@@ -652,7 +656,6 @@ struct radeon_asic { | |||
652 | uint32_t offset, uint32_t obj_size); | 656 | uint32_t offset, uint32_t obj_size); |
653 | int (*clear_surface_reg)(struct radeon_device *rdev, int reg); | 657 | int (*clear_surface_reg)(struct radeon_device *rdev, int reg); |
654 | void (*bandwidth_update)(struct radeon_device *rdev); | 658 | void (*bandwidth_update)(struct radeon_device *rdev); |
655 | void (*hdp_flush)(struct radeon_device *rdev); | ||
656 | void (*hpd_init)(struct radeon_device *rdev); | 659 | void (*hpd_init)(struct radeon_device *rdev); |
657 | void (*hpd_fini)(struct radeon_device *rdev); | 660 | void (*hpd_fini)(struct radeon_device *rdev); |
658 | bool (*hpd_sense)(struct radeon_device *rdev, enum radeon_hpd_id hpd); | 661 | bool (*hpd_sense)(struct radeon_device *rdev, enum radeon_hpd_id hpd); |
@@ -665,11 +668,14 @@ struct radeon_asic { | |||
665 | struct r100_asic { | 668 | struct r100_asic { |
666 | const unsigned *reg_safe_bm; | 669 | const unsigned *reg_safe_bm; |
667 | unsigned reg_safe_bm_size; | 670 | unsigned reg_safe_bm_size; |
671 | u32 hdp_cntl; | ||
668 | }; | 672 | }; |
669 | 673 | ||
670 | struct r300_asic { | 674 | struct r300_asic { |
671 | const unsigned *reg_safe_bm; | 675 | const unsigned *reg_safe_bm; |
672 | unsigned reg_safe_bm_size; | 676 | unsigned reg_safe_bm_size; |
677 | u32 resync_scratch; | ||
678 | u32 hdp_cntl; | ||
673 | }; | 679 | }; |
674 | 680 | ||
675 | struct r600_asic { | 681 | struct r600_asic { |
@@ -1005,7 +1011,6 @@ static inline void radeon_ring_write(struct radeon_device *rdev, uint32_t v) | |||
1005 | #define radeon_set_surface_reg(rdev, r, f, p, o, s) ((rdev)->asic->set_surface_reg((rdev), (r), (f), (p), (o), (s))) | 1011 | #define radeon_set_surface_reg(rdev, r, f, p, o, s) ((rdev)->asic->set_surface_reg((rdev), (r), (f), (p), (o), (s))) |
1006 | #define radeon_clear_surface_reg(rdev, r) ((rdev)->asic->clear_surface_reg((rdev), (r))) | 1012 | #define radeon_clear_surface_reg(rdev, r) ((rdev)->asic->clear_surface_reg((rdev), (r))) |
1007 | #define radeon_bandwidth_update(rdev) (rdev)->asic->bandwidth_update((rdev)) | 1013 | #define radeon_bandwidth_update(rdev) (rdev)->asic->bandwidth_update((rdev)) |
1008 | #define radeon_hdp_flush(rdev) (rdev)->asic->hdp_flush((rdev)) | ||
1009 | #define radeon_hpd_init(rdev) (rdev)->asic->hpd_init((rdev)) | 1014 | #define radeon_hpd_init(rdev) (rdev)->asic->hpd_init((rdev)) |
1010 | #define radeon_hpd_fini(rdev) (rdev)->asic->hpd_fini((rdev)) | 1015 | #define radeon_hpd_fini(rdev) (rdev)->asic->hpd_fini((rdev)) |
1011 | #define radeon_hpd_sense(rdev, hpd) (rdev)->asic->hpd_sense((rdev), (hpd)) | 1016 | #define radeon_hpd_sense(rdev, hpd) (rdev)->asic->hpd_sense((rdev), (hpd)) |
diff --git a/drivers/gpu/drm/radeon/radeon_agp.c b/drivers/gpu/drm/radeon/radeon_agp.c index 54bf49a6d676..220f454ea9fa 100644 --- a/drivers/gpu/drm/radeon/radeon_agp.c +++ b/drivers/gpu/drm/radeon/radeon_agp.c | |||
@@ -252,10 +252,8 @@ void radeon_agp_resume(struct radeon_device *rdev) | |||
252 | void radeon_agp_fini(struct radeon_device *rdev) | 252 | void radeon_agp_fini(struct radeon_device *rdev) |
253 | { | 253 | { |
254 | #if __OS_HAS_AGP | 254 | #if __OS_HAS_AGP |
255 | if (rdev->flags & RADEON_IS_AGP) { | 255 | if (rdev->ddev->agp && rdev->ddev->agp->acquired) { |
256 | if (rdev->ddev->agp && rdev->ddev->agp->acquired) { | 256 | drm_agp_release(rdev->ddev); |
257 | drm_agp_release(rdev->ddev); | ||
258 | } | ||
259 | } | 257 | } |
260 | #endif | 258 | #endif |
261 | } | 259 | } |
diff --git a/drivers/gpu/drm/radeon/radeon_asic.h b/drivers/gpu/drm/radeon/radeon_asic.h index 636116bedcb4..f2fbd2e4e9df 100644 --- a/drivers/gpu/drm/radeon/radeon_asic.h +++ b/drivers/gpu/drm/radeon/radeon_asic.h | |||
@@ -33,6 +33,7 @@ | |||
33 | */ | 33 | */ |
34 | uint32_t radeon_legacy_get_engine_clock(struct radeon_device *rdev); | 34 | uint32_t radeon_legacy_get_engine_clock(struct radeon_device *rdev); |
35 | void radeon_legacy_set_engine_clock(struct radeon_device *rdev, uint32_t eng_clock); | 35 | void radeon_legacy_set_engine_clock(struct radeon_device *rdev, uint32_t eng_clock); |
36 | uint32_t radeon_legacy_get_memory_clock(struct radeon_device *rdev); | ||
36 | void radeon_legacy_set_clock_gating(struct radeon_device *rdev, int enable); | 37 | void radeon_legacy_set_clock_gating(struct radeon_device *rdev, int enable); |
37 | 38 | ||
38 | uint32_t radeon_atom_get_engine_clock(struct radeon_device *rdev); | 39 | uint32_t radeon_atom_get_engine_clock(struct radeon_device *rdev); |
@@ -76,7 +77,6 @@ int r100_clear_surface_reg(struct radeon_device *rdev, int reg); | |||
76 | void r100_bandwidth_update(struct radeon_device *rdev); | 77 | void r100_bandwidth_update(struct radeon_device *rdev); |
77 | void r100_ring_ib_execute(struct radeon_device *rdev, struct radeon_ib *ib); | 78 | void r100_ring_ib_execute(struct radeon_device *rdev, struct radeon_ib *ib); |
78 | int r100_ring_test(struct radeon_device *rdev); | 79 | int r100_ring_test(struct radeon_device *rdev); |
79 | void r100_hdp_flush(struct radeon_device *rdev); | ||
80 | void r100_hpd_init(struct radeon_device *rdev); | 80 | void r100_hpd_init(struct radeon_device *rdev); |
81 | void r100_hpd_fini(struct radeon_device *rdev); | 81 | void r100_hpd_fini(struct radeon_device *rdev); |
82 | bool r100_hpd_sense(struct radeon_device *rdev, enum radeon_hpd_id hpd); | 82 | bool r100_hpd_sense(struct radeon_device *rdev, enum radeon_hpd_id hpd); |
@@ -106,14 +106,13 @@ static struct radeon_asic r100_asic = { | |||
106 | .copy = &r100_copy_blit, | 106 | .copy = &r100_copy_blit, |
107 | .get_engine_clock = &radeon_legacy_get_engine_clock, | 107 | .get_engine_clock = &radeon_legacy_get_engine_clock, |
108 | .set_engine_clock = &radeon_legacy_set_engine_clock, | 108 | .set_engine_clock = &radeon_legacy_set_engine_clock, |
109 | .get_memory_clock = NULL, | 109 | .get_memory_clock = &radeon_legacy_get_memory_clock, |
110 | .set_memory_clock = NULL, | 110 | .set_memory_clock = NULL, |
111 | .set_pcie_lanes = NULL, | 111 | .set_pcie_lanes = NULL, |
112 | .set_clock_gating = &radeon_legacy_set_clock_gating, | 112 | .set_clock_gating = &radeon_legacy_set_clock_gating, |
113 | .set_surface_reg = r100_set_surface_reg, | 113 | .set_surface_reg = r100_set_surface_reg, |
114 | .clear_surface_reg = r100_clear_surface_reg, | 114 | .clear_surface_reg = r100_clear_surface_reg, |
115 | .bandwidth_update = &r100_bandwidth_update, | 115 | .bandwidth_update = &r100_bandwidth_update, |
116 | .hdp_flush = &r100_hdp_flush, | ||
117 | .hpd_init = &r100_hpd_init, | 116 | .hpd_init = &r100_hpd_init, |
118 | .hpd_fini = &r100_hpd_fini, | 117 | .hpd_fini = &r100_hpd_fini, |
119 | .hpd_sense = &r100_hpd_sense, | 118 | .hpd_sense = &r100_hpd_sense, |
@@ -166,14 +165,13 @@ static struct radeon_asic r300_asic = { | |||
166 | .copy = &r100_copy_blit, | 165 | .copy = &r100_copy_blit, |
167 | .get_engine_clock = &radeon_legacy_get_engine_clock, | 166 | .get_engine_clock = &radeon_legacy_get_engine_clock, |
168 | .set_engine_clock = &radeon_legacy_set_engine_clock, | 167 | .set_engine_clock = &radeon_legacy_set_engine_clock, |
169 | .get_memory_clock = NULL, | 168 | .get_memory_clock = &radeon_legacy_get_memory_clock, |
170 | .set_memory_clock = NULL, | 169 | .set_memory_clock = NULL, |
171 | .set_pcie_lanes = &rv370_set_pcie_lanes, | 170 | .set_pcie_lanes = &rv370_set_pcie_lanes, |
172 | .set_clock_gating = &radeon_legacy_set_clock_gating, | 171 | .set_clock_gating = &radeon_legacy_set_clock_gating, |
173 | .set_surface_reg = r100_set_surface_reg, | 172 | .set_surface_reg = r100_set_surface_reg, |
174 | .clear_surface_reg = r100_clear_surface_reg, | 173 | .clear_surface_reg = r100_clear_surface_reg, |
175 | .bandwidth_update = &r100_bandwidth_update, | 174 | .bandwidth_update = &r100_bandwidth_update, |
176 | .hdp_flush = &r100_hdp_flush, | ||
177 | .hpd_init = &r100_hpd_init, | 175 | .hpd_init = &r100_hpd_init, |
178 | .hpd_fini = &r100_hpd_fini, | 176 | .hpd_fini = &r100_hpd_fini, |
179 | .hpd_sense = &r100_hpd_sense, | 177 | .hpd_sense = &r100_hpd_sense, |
@@ -217,7 +215,6 @@ static struct radeon_asic r420_asic = { | |||
217 | .set_surface_reg = r100_set_surface_reg, | 215 | .set_surface_reg = r100_set_surface_reg, |
218 | .clear_surface_reg = r100_clear_surface_reg, | 216 | .clear_surface_reg = r100_clear_surface_reg, |
219 | .bandwidth_update = &r100_bandwidth_update, | 217 | .bandwidth_update = &r100_bandwidth_update, |
220 | .hdp_flush = &r100_hdp_flush, | ||
221 | .hpd_init = &r100_hpd_init, | 218 | .hpd_init = &r100_hpd_init, |
222 | .hpd_fini = &r100_hpd_fini, | 219 | .hpd_fini = &r100_hpd_fini, |
223 | .hpd_sense = &r100_hpd_sense, | 220 | .hpd_sense = &r100_hpd_sense, |
@@ -259,14 +256,13 @@ static struct radeon_asic rs400_asic = { | |||
259 | .copy = &r100_copy_blit, | 256 | .copy = &r100_copy_blit, |
260 | .get_engine_clock = &radeon_legacy_get_engine_clock, | 257 | .get_engine_clock = &radeon_legacy_get_engine_clock, |
261 | .set_engine_clock = &radeon_legacy_set_engine_clock, | 258 | .set_engine_clock = &radeon_legacy_set_engine_clock, |
262 | .get_memory_clock = NULL, | 259 | .get_memory_clock = &radeon_legacy_get_memory_clock, |
263 | .set_memory_clock = NULL, | 260 | .set_memory_clock = NULL, |
264 | .set_pcie_lanes = NULL, | 261 | .set_pcie_lanes = NULL, |
265 | .set_clock_gating = &radeon_legacy_set_clock_gating, | 262 | .set_clock_gating = &radeon_legacy_set_clock_gating, |
266 | .set_surface_reg = r100_set_surface_reg, | 263 | .set_surface_reg = r100_set_surface_reg, |
267 | .clear_surface_reg = r100_clear_surface_reg, | 264 | .clear_surface_reg = r100_clear_surface_reg, |
268 | .bandwidth_update = &r100_bandwidth_update, | 265 | .bandwidth_update = &r100_bandwidth_update, |
269 | .hdp_flush = &r100_hdp_flush, | ||
270 | .hpd_init = &r100_hpd_init, | 266 | .hpd_init = &r100_hpd_init, |
271 | .hpd_fini = &r100_hpd_fini, | 267 | .hpd_fini = &r100_hpd_fini, |
272 | .hpd_sense = &r100_hpd_sense, | 268 | .hpd_sense = &r100_hpd_sense, |
@@ -323,7 +319,6 @@ static struct radeon_asic rs600_asic = { | |||
323 | .set_pcie_lanes = NULL, | 319 | .set_pcie_lanes = NULL, |
324 | .set_clock_gating = &radeon_atom_set_clock_gating, | 320 | .set_clock_gating = &radeon_atom_set_clock_gating, |
325 | .bandwidth_update = &rs600_bandwidth_update, | 321 | .bandwidth_update = &rs600_bandwidth_update, |
326 | .hdp_flush = &r100_hdp_flush, | ||
327 | .hpd_init = &rs600_hpd_init, | 322 | .hpd_init = &rs600_hpd_init, |
328 | .hpd_fini = &rs600_hpd_fini, | 323 | .hpd_fini = &rs600_hpd_fini, |
329 | .hpd_sense = &rs600_hpd_sense, | 324 | .hpd_sense = &rs600_hpd_sense, |
@@ -371,7 +366,6 @@ static struct radeon_asic rs690_asic = { | |||
371 | .set_surface_reg = r100_set_surface_reg, | 366 | .set_surface_reg = r100_set_surface_reg, |
372 | .clear_surface_reg = r100_clear_surface_reg, | 367 | .clear_surface_reg = r100_clear_surface_reg, |
373 | .bandwidth_update = &rs690_bandwidth_update, | 368 | .bandwidth_update = &rs690_bandwidth_update, |
374 | .hdp_flush = &r100_hdp_flush, | ||
375 | .hpd_init = &rs600_hpd_init, | 369 | .hpd_init = &rs600_hpd_init, |
376 | .hpd_fini = &rs600_hpd_fini, | 370 | .hpd_fini = &rs600_hpd_fini, |
377 | .hpd_sense = &rs600_hpd_sense, | 371 | .hpd_sense = &rs600_hpd_sense, |
@@ -423,7 +417,6 @@ static struct radeon_asic rv515_asic = { | |||
423 | .set_surface_reg = r100_set_surface_reg, | 417 | .set_surface_reg = r100_set_surface_reg, |
424 | .clear_surface_reg = r100_clear_surface_reg, | 418 | .clear_surface_reg = r100_clear_surface_reg, |
425 | .bandwidth_update = &rv515_bandwidth_update, | 419 | .bandwidth_update = &rv515_bandwidth_update, |
426 | .hdp_flush = &r100_hdp_flush, | ||
427 | .hpd_init = &rs600_hpd_init, | 420 | .hpd_init = &rs600_hpd_init, |
428 | .hpd_fini = &rs600_hpd_fini, | 421 | .hpd_fini = &rs600_hpd_fini, |
429 | .hpd_sense = &rs600_hpd_sense, | 422 | .hpd_sense = &rs600_hpd_sense, |
@@ -466,7 +459,6 @@ static struct radeon_asic r520_asic = { | |||
466 | .set_surface_reg = r100_set_surface_reg, | 459 | .set_surface_reg = r100_set_surface_reg, |
467 | .clear_surface_reg = r100_clear_surface_reg, | 460 | .clear_surface_reg = r100_clear_surface_reg, |
468 | .bandwidth_update = &rv515_bandwidth_update, | 461 | .bandwidth_update = &rv515_bandwidth_update, |
469 | .hdp_flush = &r100_hdp_flush, | ||
470 | .hpd_init = &rs600_hpd_init, | 462 | .hpd_init = &rs600_hpd_init, |
471 | .hpd_fini = &rs600_hpd_fini, | 463 | .hpd_fini = &rs600_hpd_fini, |
472 | .hpd_sense = &rs600_hpd_sense, | 464 | .hpd_sense = &rs600_hpd_sense, |
@@ -507,7 +499,6 @@ int r600_ring_test(struct radeon_device *rdev); | |||
507 | int r600_copy_blit(struct radeon_device *rdev, | 499 | int r600_copy_blit(struct radeon_device *rdev, |
508 | uint64_t src_offset, uint64_t dst_offset, | 500 | uint64_t src_offset, uint64_t dst_offset, |
509 | unsigned num_pages, struct radeon_fence *fence); | 501 | unsigned num_pages, struct radeon_fence *fence); |
510 | void r600_hdp_flush(struct radeon_device *rdev); | ||
511 | void r600_hpd_init(struct radeon_device *rdev); | 502 | void r600_hpd_init(struct radeon_device *rdev); |
512 | void r600_hpd_fini(struct radeon_device *rdev); | 503 | void r600_hpd_fini(struct radeon_device *rdev); |
513 | bool r600_hpd_sense(struct radeon_device *rdev, enum radeon_hpd_id hpd); | 504 | bool r600_hpd_sense(struct radeon_device *rdev, enum radeon_hpd_id hpd); |
@@ -543,7 +534,6 @@ static struct radeon_asic r600_asic = { | |||
543 | .set_surface_reg = r600_set_surface_reg, | 534 | .set_surface_reg = r600_set_surface_reg, |
544 | .clear_surface_reg = r600_clear_surface_reg, | 535 | .clear_surface_reg = r600_clear_surface_reg, |
545 | .bandwidth_update = &rv515_bandwidth_update, | 536 | .bandwidth_update = &rv515_bandwidth_update, |
546 | .hdp_flush = &r600_hdp_flush, | ||
547 | .hpd_init = &r600_hpd_init, | 537 | .hpd_init = &r600_hpd_init, |
548 | .hpd_fini = &r600_hpd_fini, | 538 | .hpd_fini = &r600_hpd_fini, |
549 | .hpd_sense = &r600_hpd_sense, | 539 | .hpd_sense = &r600_hpd_sense, |
@@ -588,7 +578,6 @@ static struct radeon_asic rv770_asic = { | |||
588 | .set_surface_reg = r600_set_surface_reg, | 578 | .set_surface_reg = r600_set_surface_reg, |
589 | .clear_surface_reg = r600_clear_surface_reg, | 579 | .clear_surface_reg = r600_clear_surface_reg, |
590 | .bandwidth_update = &rv515_bandwidth_update, | 580 | .bandwidth_update = &rv515_bandwidth_update, |
591 | .hdp_flush = &r600_hdp_flush, | ||
592 | .hpd_init = &r600_hpd_init, | 581 | .hpd_init = &r600_hpd_init, |
593 | .hpd_fini = &r600_hpd_fini, | 582 | .hpd_fini = &r600_hpd_fini, |
594 | .hpd_sense = &r600_hpd_sense, | 583 | .hpd_sense = &r600_hpd_sense, |
diff --git a/drivers/gpu/drm/radeon/radeon_atombios.c b/drivers/gpu/drm/radeon/radeon_atombios.c index 12a0c760e7ff..fa82ca74324e 100644 --- a/drivers/gpu/drm/radeon/radeon_atombios.c +++ b/drivers/gpu/drm/radeon/radeon_atombios.c | |||
@@ -114,6 +114,7 @@ static inline struct radeon_i2c_bus_rec radeon_lookup_i2c_gpio(struct radeon_dev | |||
114 | i2c.i2c_id = gpio->sucI2cId.ucAccess; | 114 | i2c.i2c_id = gpio->sucI2cId.ucAccess; |
115 | 115 | ||
116 | i2c.valid = true; | 116 | i2c.valid = true; |
117 | break; | ||
117 | } | 118 | } |
118 | } | 119 | } |
119 | 120 | ||
@@ -345,7 +346,9 @@ const int object_connector_convert[] = { | |||
345 | DRM_MODE_CONNECTOR_Unknown, | 346 | DRM_MODE_CONNECTOR_Unknown, |
346 | DRM_MODE_CONNECTOR_Unknown, | 347 | DRM_MODE_CONNECTOR_Unknown, |
347 | DRM_MODE_CONNECTOR_Unknown, | 348 | DRM_MODE_CONNECTOR_Unknown, |
348 | DRM_MODE_CONNECTOR_DisplayPort | 349 | DRM_MODE_CONNECTOR_DisplayPort, |
350 | DRM_MODE_CONNECTOR_eDP, | ||
351 | DRM_MODE_CONNECTOR_Unknown | ||
349 | }; | 352 | }; |
350 | 353 | ||
351 | bool radeon_get_atom_connector_info_from_object_table(struct drm_device *dev) | 354 | bool radeon_get_atom_connector_info_from_object_table(struct drm_device *dev) |
@@ -745,8 +748,7 @@ bool radeon_get_atom_connector_info_from_supported_devices_table(struct | |||
745 | else | 748 | else |
746 | radeon_add_legacy_encoder(dev, | 749 | radeon_add_legacy_encoder(dev, |
747 | radeon_get_encoder_id(dev, | 750 | radeon_get_encoder_id(dev, |
748 | (1 << | 751 | (1 << i), |
749 | i), | ||
750 | dac), | 752 | dac), |
751 | (1 << i)); | 753 | (1 << i)); |
752 | } | 754 | } |
@@ -758,32 +760,30 @@ bool radeon_get_atom_connector_info_from_supported_devices_table(struct | |||
758 | if (bios_connectors[j].valid && (i != j)) { | 760 | if (bios_connectors[j].valid && (i != j)) { |
759 | if (bios_connectors[i].line_mux == | 761 | if (bios_connectors[i].line_mux == |
760 | bios_connectors[j].line_mux) { | 762 | bios_connectors[j].line_mux) { |
761 | if (((bios_connectors[i]. | 763 | /* make sure not to combine LVDS */ |
762 | devices & | 764 | if (bios_connectors[i].devices & (ATOM_DEVICE_LCD_SUPPORT)) { |
763 | (ATOM_DEVICE_DFP_SUPPORT)) | 765 | bios_connectors[i].line_mux = 53; |
764 | && (bios_connectors[j]. | 766 | bios_connectors[i].ddc_bus.valid = false; |
765 | devices & | 767 | continue; |
766 | (ATOM_DEVICE_CRT_SUPPORT))) | 768 | } |
767 | || | 769 | if (bios_connectors[j].devices & (ATOM_DEVICE_LCD_SUPPORT)) { |
768 | ((bios_connectors[j]. | 770 | bios_connectors[j].line_mux = 53; |
769 | devices & | 771 | bios_connectors[j].ddc_bus.valid = false; |
770 | (ATOM_DEVICE_DFP_SUPPORT)) | 772 | continue; |
771 | && (bios_connectors[i]. | 773 | } |
772 | devices & | 774 | /* combine analog and digital for DVI-I */ |
773 | (ATOM_DEVICE_CRT_SUPPORT)))) { | 775 | if (((bios_connectors[i].devices & (ATOM_DEVICE_DFP_SUPPORT)) && |
774 | bios_connectors[i]. | 776 | (bios_connectors[j].devices & (ATOM_DEVICE_CRT_SUPPORT))) || |
775 | devices |= | 777 | ((bios_connectors[j].devices & (ATOM_DEVICE_DFP_SUPPORT)) && |
776 | bios_connectors[j]. | 778 | (bios_connectors[i].devices & (ATOM_DEVICE_CRT_SUPPORT)))) { |
777 | devices; | 779 | bios_connectors[i].devices |= |
778 | bios_connectors[i]. | 780 | bios_connectors[j].devices; |
779 | connector_type = | 781 | bios_connectors[i].connector_type = |
780 | DRM_MODE_CONNECTOR_DVII; | 782 | DRM_MODE_CONNECTOR_DVII; |
781 | if (bios_connectors[j].devices & | 783 | if (bios_connectors[j].devices & (ATOM_DEVICE_DFP_SUPPORT)) |
782 | (ATOM_DEVICE_DFP_SUPPORT)) | ||
783 | bios_connectors[i].hpd = | 784 | bios_connectors[i].hpd = |
784 | bios_connectors[j].hpd; | 785 | bios_connectors[j].hpd; |
785 | bios_connectors[j]. | 786 | bios_connectors[j].valid = false; |
786 | valid = false; | ||
787 | } | 787 | } |
788 | } | 788 | } |
789 | } | 789 | } |
@@ -938,6 +938,43 @@ bool radeon_atom_get_clock_info(struct drm_device *dev) | |||
938 | return false; | 938 | return false; |
939 | } | 939 | } |
940 | 940 | ||
941 | union igp_info { | ||
942 | struct _ATOM_INTEGRATED_SYSTEM_INFO info; | ||
943 | struct _ATOM_INTEGRATED_SYSTEM_INFO_V2 info_2; | ||
944 | }; | ||
945 | |||
946 | bool radeon_atombios_sideport_present(struct radeon_device *rdev) | ||
947 | { | ||
948 | struct radeon_mode_info *mode_info = &rdev->mode_info; | ||
949 | int index = GetIndexIntoMasterTable(DATA, IntegratedSystemInfo); | ||
950 | union igp_info *igp_info; | ||
951 | u8 frev, crev; | ||
952 | u16 data_offset; | ||
953 | |||
954 | atom_parse_data_header(mode_info->atom_context, index, NULL, &frev, | ||
955 | &crev, &data_offset); | ||
956 | |||
957 | igp_info = (union igp_info *)(mode_info->atom_context->bios + | ||
958 | data_offset); | ||
959 | |||
960 | if (igp_info) { | ||
961 | switch (crev) { | ||
962 | case 1: | ||
963 | if (igp_info->info.ucMemoryType & 0xf0) | ||
964 | return true; | ||
965 | break; | ||
966 | case 2: | ||
967 | if (igp_info->info_2.ucMemoryType & 0x0f) | ||
968 | return true; | ||
969 | break; | ||
970 | default: | ||
971 | DRM_ERROR("Unsupported IGP table: %d %d\n", frev, crev); | ||
972 | break; | ||
973 | } | ||
974 | } | ||
975 | return false; | ||
976 | } | ||
977 | |||
941 | bool radeon_atombios_get_tmds_info(struct radeon_encoder *encoder, | 978 | bool radeon_atombios_get_tmds_info(struct radeon_encoder *encoder, |
942 | struct radeon_encoder_int_tmds *tmds) | 979 | struct radeon_encoder_int_tmds *tmds) |
943 | { | 980 | { |
@@ -1029,6 +1066,7 @@ static struct radeon_atom_ss *radeon_atombios_get_ss_info(struct | |||
1029 | ss->delay = ss_info->asSS_Info[i].ucSS_Delay; | 1066 | ss->delay = ss_info->asSS_Info[i].ucSS_Delay; |
1030 | ss->range = ss_info->asSS_Info[i].ucSS_Range; | 1067 | ss->range = ss_info->asSS_Info[i].ucSS_Range; |
1031 | ss->refdiv = ss_info->asSS_Info[i].ucRecommendedRef_Div; | 1068 | ss->refdiv = ss_info->asSS_Info[i].ucRecommendedRef_Div; |
1069 | break; | ||
1032 | } | 1070 | } |
1033 | } | 1071 | } |
1034 | } | 1072 | } |
@@ -1234,6 +1272,61 @@ bool radeon_atom_get_tv_timings(struct radeon_device *rdev, int index, | |||
1234 | return true; | 1272 | return true; |
1235 | } | 1273 | } |
1236 | 1274 | ||
1275 | enum radeon_tv_std | ||
1276 | radeon_atombios_get_tv_info(struct radeon_device *rdev) | ||
1277 | { | ||
1278 | struct radeon_mode_info *mode_info = &rdev->mode_info; | ||
1279 | int index = GetIndexIntoMasterTable(DATA, AnalogTV_Info); | ||
1280 | uint16_t data_offset; | ||
1281 | uint8_t frev, crev; | ||
1282 | struct _ATOM_ANALOG_TV_INFO *tv_info; | ||
1283 | enum radeon_tv_std tv_std = TV_STD_NTSC; | ||
1284 | |||
1285 | atom_parse_data_header(mode_info->atom_context, index, NULL, &frev, &crev, &data_offset); | ||
1286 | |||
1287 | tv_info = (struct _ATOM_ANALOG_TV_INFO *)(mode_info->atom_context->bios + data_offset); | ||
1288 | |||
1289 | switch (tv_info->ucTV_BootUpDefaultStandard) { | ||
1290 | case ATOM_TV_NTSC: | ||
1291 | tv_std = TV_STD_NTSC; | ||
1292 | DRM_INFO("Default TV standard: NTSC\n"); | ||
1293 | break; | ||
1294 | case ATOM_TV_NTSCJ: | ||
1295 | tv_std = TV_STD_NTSC_J; | ||
1296 | DRM_INFO("Default TV standard: NTSC-J\n"); | ||
1297 | break; | ||
1298 | case ATOM_TV_PAL: | ||
1299 | tv_std = TV_STD_PAL; | ||
1300 | DRM_INFO("Default TV standard: PAL\n"); | ||
1301 | break; | ||
1302 | case ATOM_TV_PALM: | ||
1303 | tv_std = TV_STD_PAL_M; | ||
1304 | DRM_INFO("Default TV standard: PAL-M\n"); | ||
1305 | break; | ||
1306 | case ATOM_TV_PALN: | ||
1307 | tv_std = TV_STD_PAL_N; | ||
1308 | DRM_INFO("Default TV standard: PAL-N\n"); | ||
1309 | break; | ||
1310 | case ATOM_TV_PALCN: | ||
1311 | tv_std = TV_STD_PAL_CN; | ||
1312 | DRM_INFO("Default TV standard: PAL-CN\n"); | ||
1313 | break; | ||
1314 | case ATOM_TV_PAL60: | ||
1315 | tv_std = TV_STD_PAL_60; | ||
1316 | DRM_INFO("Default TV standard: PAL-60\n"); | ||
1317 | break; | ||
1318 | case ATOM_TV_SECAM: | ||
1319 | tv_std = TV_STD_SECAM; | ||
1320 | DRM_INFO("Default TV standard: SECAM\n"); | ||
1321 | break; | ||
1322 | default: | ||
1323 | tv_std = TV_STD_NTSC; | ||
1324 | DRM_INFO("Unknown TV standard; defaulting to NTSC\n"); | ||
1325 | break; | ||
1326 | } | ||
1327 | return tv_std; | ||
1328 | } | ||
1329 | |||
1237 | struct radeon_encoder_tv_dac * | 1330 | struct radeon_encoder_tv_dac * |
1238 | radeon_atombios_get_tv_dac_info(struct radeon_encoder *encoder) | 1331 | radeon_atombios_get_tv_dac_info(struct radeon_encoder *encoder) |
1239 | { | 1332 | { |
@@ -1269,6 +1362,7 @@ radeon_atombios_get_tv_dac_info(struct radeon_encoder *encoder) | |||
1269 | dac = dac_info->ucDAC2_NTSC_DAC_Adjustment; | 1362 | dac = dac_info->ucDAC2_NTSC_DAC_Adjustment; |
1270 | tv_dac->ntsc_tvdac_adj = (bg << 16) | (dac << 20); | 1363 | tv_dac->ntsc_tvdac_adj = (bg << 16) | (dac << 20); |
1271 | 1364 | ||
1365 | tv_dac->tv_std = radeon_atombios_get_tv_info(rdev); | ||
1272 | } | 1366 | } |
1273 | return tv_dac; | 1367 | return tv_dac; |
1274 | } | 1368 | } |
diff --git a/drivers/gpu/drm/radeon/radeon_clocks.c b/drivers/gpu/drm/radeon/radeon_clocks.c index b062109efbee..812f24dbc2a8 100644 --- a/drivers/gpu/drm/radeon/radeon_clocks.c +++ b/drivers/gpu/drm/radeon/radeon_clocks.c | |||
@@ -62,7 +62,7 @@ uint32_t radeon_legacy_get_engine_clock(struct radeon_device *rdev) | |||
62 | } | 62 | } |
63 | 63 | ||
64 | /* 10 khz */ | 64 | /* 10 khz */ |
65 | static uint32_t radeon_legacy_get_memory_clock(struct radeon_device *rdev) | 65 | uint32_t radeon_legacy_get_memory_clock(struct radeon_device *rdev) |
66 | { | 66 | { |
67 | struct radeon_pll *mpll = &rdev->clock.mpll; | 67 | struct radeon_pll *mpll = &rdev->clock.mpll; |
68 | uint32_t fb_div, ref_div, post_div, mclk; | 68 | uint32_t fb_div, ref_div, post_div, mclk; |
diff --git a/drivers/gpu/drm/radeon/radeon_combios.c b/drivers/gpu/drm/radeon/radeon_combios.c index c5021a3445de..7914455c96ca 100644 --- a/drivers/gpu/drm/radeon/radeon_combios.c +++ b/drivers/gpu/drm/radeon/radeon_combios.c | |||
@@ -595,6 +595,48 @@ bool radeon_combios_get_clock_info(struct drm_device *dev) | |||
595 | return false; | 595 | return false; |
596 | } | 596 | } |
597 | 597 | ||
598 | bool radeon_combios_sideport_present(struct radeon_device *rdev) | ||
599 | { | ||
600 | struct drm_device *dev = rdev->ddev; | ||
601 | u16 igp_info; | ||
602 | |||
603 | igp_info = combios_get_table_offset(dev, COMBIOS_INTEGRATED_SYSTEM_INFO_TABLE); | ||
604 | |||
605 | if (igp_info) { | ||
606 | if (RBIOS16(igp_info + 0x4)) | ||
607 | return true; | ||
608 | } | ||
609 | return false; | ||
610 | } | ||
611 | |||
612 | static const uint32_t default_primarydac_adj[CHIP_LAST] = { | ||
613 | 0x00000808, /* r100 */ | ||
614 | 0x00000808, /* rv100 */ | ||
615 | 0x00000808, /* rs100 */ | ||
616 | 0x00000808, /* rv200 */ | ||
617 | 0x00000808, /* rs200 */ | ||
618 | 0x00000808, /* r200 */ | ||
619 | 0x00000808, /* rv250 */ | ||
620 | 0x00000000, /* rs300 */ | ||
621 | 0x00000808, /* rv280 */ | ||
622 | 0x00000808, /* r300 */ | ||
623 | 0x00000808, /* r350 */ | ||
624 | 0x00000808, /* rv350 */ | ||
625 | 0x00000808, /* rv380 */ | ||
626 | 0x00000808, /* r420 */ | ||
627 | 0x00000808, /* r423 */ | ||
628 | 0x00000808, /* rv410 */ | ||
629 | 0x00000000, /* rs400 */ | ||
630 | 0x00000000, /* rs480 */ | ||
631 | }; | ||
632 | |||
633 | static void radeon_legacy_get_primary_dac_info_from_table(struct radeon_device *rdev, | ||
634 | struct radeon_encoder_primary_dac *p_dac) | ||
635 | { | ||
636 | p_dac->ps2_pdac_adj = default_primarydac_adj[rdev->family]; | ||
637 | return; | ||
638 | } | ||
639 | |||
598 | struct radeon_encoder_primary_dac *radeon_combios_get_primary_dac_info(struct | 640 | struct radeon_encoder_primary_dac *radeon_combios_get_primary_dac_info(struct |
599 | radeon_encoder | 641 | radeon_encoder |
600 | *encoder) | 642 | *encoder) |
@@ -604,20 +646,20 @@ struct radeon_encoder_primary_dac *radeon_combios_get_primary_dac_info(struct | |||
604 | uint16_t dac_info; | 646 | uint16_t dac_info; |
605 | uint8_t rev, bg, dac; | 647 | uint8_t rev, bg, dac; |
606 | struct radeon_encoder_primary_dac *p_dac = NULL; | 648 | struct radeon_encoder_primary_dac *p_dac = NULL; |
649 | int found = 0; | ||
607 | 650 | ||
608 | if (rdev->bios == NULL) | 651 | p_dac = kzalloc(sizeof(struct radeon_encoder_primary_dac), |
652 | GFP_KERNEL); | ||
653 | |||
654 | if (!p_dac) | ||
609 | return NULL; | 655 | return NULL; |
610 | 656 | ||
657 | if (rdev->bios == NULL) | ||
658 | goto out; | ||
659 | |||
611 | /* check CRT table */ | 660 | /* check CRT table */ |
612 | dac_info = combios_get_table_offset(dev, COMBIOS_CRT_INFO_TABLE); | 661 | dac_info = combios_get_table_offset(dev, COMBIOS_CRT_INFO_TABLE); |
613 | if (dac_info) { | 662 | if (dac_info) { |
614 | p_dac = | ||
615 | kzalloc(sizeof(struct radeon_encoder_primary_dac), | ||
616 | GFP_KERNEL); | ||
617 | |||
618 | if (!p_dac) | ||
619 | return NULL; | ||
620 | |||
621 | rev = RBIOS8(dac_info) & 0x3; | 663 | rev = RBIOS8(dac_info) & 0x3; |
622 | if (rev < 2) { | 664 | if (rev < 2) { |
623 | bg = RBIOS8(dac_info + 0x2) & 0xf; | 665 | bg = RBIOS8(dac_info + 0x2) & 0xf; |
@@ -628,17 +670,20 @@ struct radeon_encoder_primary_dac *radeon_combios_get_primary_dac_info(struct | |||
628 | dac = RBIOS8(dac_info + 0x3) & 0xf; | 670 | dac = RBIOS8(dac_info + 0x3) & 0xf; |
629 | p_dac->ps2_pdac_adj = (bg << 8) | (dac); | 671 | p_dac->ps2_pdac_adj = (bg << 8) | (dac); |
630 | } | 672 | } |
631 | 673 | found = 1; | |
632 | } | 674 | } |
633 | 675 | ||
676 | out: | ||
677 | if (!found) /* fallback to defaults */ | ||
678 | radeon_legacy_get_primary_dac_info_from_table(rdev, p_dac); | ||
679 | |||
634 | return p_dac; | 680 | return p_dac; |
635 | } | 681 | } |
636 | 682 | ||
637 | static enum radeon_tv_std | 683 | enum radeon_tv_std |
638 | radeon_combios_get_tv_info(struct radeon_encoder *encoder) | 684 | radeon_combios_get_tv_info(struct radeon_device *rdev) |
639 | { | 685 | { |
640 | struct drm_device *dev = encoder->base.dev; | 686 | struct drm_device *dev = rdev->ddev; |
641 | struct radeon_device *rdev = dev->dev_private; | ||
642 | uint16_t tv_info; | 687 | uint16_t tv_info; |
643 | enum radeon_tv_std tv_std = TV_STD_NTSC; | 688 | enum radeon_tv_std tv_std = TV_STD_NTSC; |
644 | 689 | ||
@@ -779,7 +824,7 @@ struct radeon_encoder_tv_dac *radeon_combios_get_tv_dac_info(struct | |||
779 | tv_dac->ntsc_tvdac_adj = (bg << 16) | (dac << 20); | 824 | tv_dac->ntsc_tvdac_adj = (bg << 16) | (dac << 20); |
780 | found = 1; | 825 | found = 1; |
781 | } | 826 | } |
782 | tv_dac->tv_std = radeon_combios_get_tv_info(encoder); | 827 | tv_dac->tv_std = radeon_combios_get_tv_info(rdev); |
783 | } | 828 | } |
784 | if (!found) { | 829 | if (!found) { |
785 | /* then check CRT table */ | 830 | /* then check CRT table */ |
diff --git a/drivers/gpu/drm/radeon/radeon_connectors.c b/drivers/gpu/drm/radeon/radeon_connectors.c index 5eece186e03c..9da10dd5df80 100644 --- a/drivers/gpu/drm/radeon/radeon_connectors.c +++ b/drivers/gpu/drm/radeon/radeon_connectors.c | |||
@@ -49,8 +49,10 @@ void radeon_connector_hotplug(struct drm_connector *connector) | |||
49 | if (radeon_connector->hpd.hpd != RADEON_HPD_NONE) | 49 | if (radeon_connector->hpd.hpd != RADEON_HPD_NONE) |
50 | radeon_hpd_set_polarity(rdev, radeon_connector->hpd.hpd); | 50 | radeon_hpd_set_polarity(rdev, radeon_connector->hpd.hpd); |
51 | 51 | ||
52 | if (connector->connector_type == DRM_MODE_CONNECTOR_DisplayPort) { | 52 | if ((connector->connector_type == DRM_MODE_CONNECTOR_DisplayPort) || |
53 | if (radeon_dp_getsinktype(radeon_connector) == CONNECTOR_OBJECT_ID_DISPLAYPORT) { | 53 | (connector->connector_type == DRM_MODE_CONNECTOR_eDP)) { |
54 | if ((radeon_dp_getsinktype(radeon_connector) == CONNECTOR_OBJECT_ID_DISPLAYPORT) || | ||
55 | (radeon_dp_getsinktype(radeon_connector) == CONNECTOR_OBJECT_ID_eDP)) { | ||
54 | if (radeon_dp_needs_link_train(radeon_connector)) { | 56 | if (radeon_dp_needs_link_train(radeon_connector)) { |
55 | if (connector->encoder) | 57 | if (connector->encoder) |
56 | dp_link_train(connector->encoder, connector); | 58 | dp_link_train(connector->encoder, connector); |
@@ -208,6 +210,18 @@ static struct drm_display_mode *radeon_fp_native_mode(struct drm_encoder *encode | |||
208 | drm_mode_set_name(mode); | 210 | drm_mode_set_name(mode); |
209 | 211 | ||
210 | DRM_DEBUG("Adding native panel mode %s\n", mode->name); | 212 | DRM_DEBUG("Adding native panel mode %s\n", mode->name); |
213 | } else if (native_mode->hdisplay != 0 && | ||
214 | native_mode->vdisplay != 0) { | ||
215 | /* mac laptops without an edid */ | ||
216 | /* Note that this is not necessarily the exact panel mode, | ||
217 | * but an approximation based on the cvt formula. For these | ||
218 | * systems we should ideally read the mode info out of the | ||
219 | * registers or add a mode table, but this works and is much | ||
220 | * simpler. | ||
221 | */ | ||
222 | mode = drm_cvt_mode(dev, native_mode->hdisplay, native_mode->vdisplay, 60, true, false, false); | ||
223 | mode->type = DRM_MODE_TYPE_PREFERRED | DRM_MODE_TYPE_DRIVER; | ||
224 | DRM_DEBUG("Adding cvt approximation of native panel mode %s\n", mode->name); | ||
211 | } | 225 | } |
212 | return mode; | 226 | return mode; |
213 | } | 227 | } |
@@ -603,7 +617,7 @@ static enum drm_connector_status radeon_vga_detect(struct drm_connector *connect | |||
603 | ret = connector_status_connected; | 617 | ret = connector_status_connected; |
604 | } | 618 | } |
605 | } else { | 619 | } else { |
606 | if (radeon_connector->dac_load_detect) { | 620 | if (radeon_connector->dac_load_detect && encoder) { |
607 | encoder_funcs = encoder->helper_private; | 621 | encoder_funcs = encoder->helper_private; |
608 | ret = encoder_funcs->detect(encoder, connector); | 622 | ret = encoder_funcs->detect(encoder, connector); |
609 | } | 623 | } |
@@ -955,7 +969,8 @@ static enum drm_connector_status radeon_dp_detect(struct drm_connector *connecto | |||
955 | } | 969 | } |
956 | 970 | ||
957 | sink_type = radeon_dp_getsinktype(radeon_connector); | 971 | sink_type = radeon_dp_getsinktype(radeon_connector); |
958 | if (sink_type == CONNECTOR_OBJECT_ID_DISPLAYPORT) { | 972 | if ((sink_type == CONNECTOR_OBJECT_ID_DISPLAYPORT) || |
973 | (sink_type == CONNECTOR_OBJECT_ID_eDP)) { | ||
959 | if (radeon_dp_getdpcd(radeon_connector)) { | 974 | if (radeon_dp_getdpcd(radeon_connector)) { |
960 | radeon_dig_connector->dp_sink_type = sink_type; | 975 | radeon_dig_connector->dp_sink_type = sink_type; |
961 | ret = connector_status_connected; | 976 | ret = connector_status_connected; |
@@ -980,7 +995,8 @@ static int radeon_dp_mode_valid(struct drm_connector *connector, | |||
980 | 995 | ||
981 | /* XXX check mode bandwidth */ | 996 | /* XXX check mode bandwidth */ |
982 | 997 | ||
983 | if (radeon_dig_connector->dp_sink_type == CONNECTOR_OBJECT_ID_DISPLAYPORT) | 998 | if ((radeon_dig_connector->dp_sink_type == CONNECTOR_OBJECT_ID_DISPLAYPORT) || |
999 | (radeon_dig_connector->dp_sink_type == CONNECTOR_OBJECT_ID_eDP)) | ||
984 | return radeon_dp_mode_valid_helper(radeon_connector, mode); | 1000 | return radeon_dp_mode_valid_helper(radeon_connector, mode); |
985 | else | 1001 | else |
986 | return MODE_OK; | 1002 | return MODE_OK; |
@@ -1133,6 +1149,7 @@ radeon_add_atom_connector(struct drm_device *dev, | |||
1133 | subpixel_order = SubPixelHorizontalRGB; | 1149 | subpixel_order = SubPixelHorizontalRGB; |
1134 | break; | 1150 | break; |
1135 | case DRM_MODE_CONNECTOR_DisplayPort: | 1151 | case DRM_MODE_CONNECTOR_DisplayPort: |
1152 | case DRM_MODE_CONNECTOR_eDP: | ||
1136 | radeon_dig_connector = kzalloc(sizeof(struct radeon_connector_atom_dig), GFP_KERNEL); | 1153 | radeon_dig_connector = kzalloc(sizeof(struct radeon_connector_atom_dig), GFP_KERNEL); |
1137 | if (!radeon_dig_connector) | 1154 | if (!radeon_dig_connector) |
1138 | goto failed; | 1155 | goto failed; |
@@ -1145,10 +1162,16 @@ radeon_add_atom_connector(struct drm_device *dev, | |||
1145 | goto failed; | 1162 | goto failed; |
1146 | if (i2c_bus->valid) { | 1163 | if (i2c_bus->valid) { |
1147 | /* add DP i2c bus */ | 1164 | /* add DP i2c bus */ |
1148 | radeon_dig_connector->dp_i2c_bus = radeon_i2c_create_dp(dev, i2c_bus, "DP-auxch"); | 1165 | if (connector_type == DRM_MODE_CONNECTOR_eDP) |
1166 | radeon_dig_connector->dp_i2c_bus = radeon_i2c_create_dp(dev, i2c_bus, "eDP-auxch"); | ||
1167 | else | ||
1168 | radeon_dig_connector->dp_i2c_bus = radeon_i2c_create_dp(dev, i2c_bus, "DP-auxch"); | ||
1149 | if (!radeon_dig_connector->dp_i2c_bus) | 1169 | if (!radeon_dig_connector->dp_i2c_bus) |
1150 | goto failed; | 1170 | goto failed; |
1151 | radeon_connector->ddc_bus = radeon_i2c_create(dev, i2c_bus, "DP"); | 1171 | if (connector_type == DRM_MODE_CONNECTOR_eDP) |
1172 | radeon_connector->ddc_bus = radeon_i2c_create(dev, i2c_bus, "eDP"); | ||
1173 | else | ||
1174 | radeon_connector->ddc_bus = radeon_i2c_create(dev, i2c_bus, "DP"); | ||
1152 | if (!radeon_connector->ddc_bus) | 1175 | if (!radeon_connector->ddc_bus) |
1153 | goto failed; | 1176 | goto failed; |
1154 | } | 1177 | } |
@@ -1171,7 +1194,7 @@ radeon_add_atom_connector(struct drm_device *dev, | |||
1171 | 1); | 1194 | 1); |
1172 | drm_connector_attach_property(&radeon_connector->base, | 1195 | drm_connector_attach_property(&radeon_connector->base, |
1173 | rdev->mode_info.tv_std_property, | 1196 | rdev->mode_info.tv_std_property, |
1174 | 1); | 1197 | radeon_atombios_get_tv_info(rdev)); |
1175 | } | 1198 | } |
1176 | break; | 1199 | break; |
1177 | case DRM_MODE_CONNECTOR_LVDS: | 1200 | case DRM_MODE_CONNECTOR_LVDS: |
@@ -1315,7 +1338,7 @@ radeon_add_legacy_connector(struct drm_device *dev, | |||
1315 | 1); | 1338 | 1); |
1316 | drm_connector_attach_property(&radeon_connector->base, | 1339 | drm_connector_attach_property(&radeon_connector->base, |
1317 | rdev->mode_info.tv_std_property, | 1340 | rdev->mode_info.tv_std_property, |
1318 | 1); | 1341 | radeon_combios_get_tv_info(rdev)); |
1319 | } | 1342 | } |
1320 | break; | 1343 | break; |
1321 | case DRM_MODE_CONNECTOR_LVDS: | 1344 | case DRM_MODE_CONNECTOR_LVDS: |
diff --git a/drivers/gpu/drm/radeon/radeon_cp.c b/drivers/gpu/drm/radeon/radeon_cp.c index 0b2f9c2ad2c1..06123ba31d31 100644 --- a/drivers/gpu/drm/radeon/radeon_cp.c +++ b/drivers/gpu/drm/radeon/radeon_cp.c | |||
@@ -2145,6 +2145,7 @@ int radeon_master_create(struct drm_device *dev, struct drm_master *master) | |||
2145 | &master_priv->sarea); | 2145 | &master_priv->sarea); |
2146 | if (ret) { | 2146 | if (ret) { |
2147 | DRM_ERROR("SAREA setup failed\n"); | 2147 | DRM_ERROR("SAREA setup failed\n"); |
2148 | kfree(master_priv); | ||
2148 | return ret; | 2149 | return ret; |
2149 | } | 2150 | } |
2150 | master_priv->sarea_priv = master_priv->sarea->handle + sizeof(struct drm_sarea); | 2151 | master_priv->sarea_priv = master_priv->sarea->handle + sizeof(struct drm_sarea); |
diff --git a/drivers/gpu/drm/radeon/radeon_device.c b/drivers/gpu/drm/radeon/radeon_device.c index 02bcdb1240c0..0c51f8e46613 100644 --- a/drivers/gpu/drm/radeon/radeon_device.c +++ b/drivers/gpu/drm/radeon/radeon_device.c | |||
@@ -391,6 +391,12 @@ int radeon_asic_init(struct radeon_device *rdev) | |||
391 | /* FIXME: not supported yet */ | 391 | /* FIXME: not supported yet */ |
392 | return -EINVAL; | 392 | return -EINVAL; |
393 | } | 393 | } |
394 | |||
395 | if (rdev->flags & RADEON_IS_IGP) { | ||
396 | rdev->asic->get_memory_clock = NULL; | ||
397 | rdev->asic->set_memory_clock = NULL; | ||
398 | } | ||
399 | |||
394 | return 0; | 400 | return 0; |
395 | } | 401 | } |
396 | 402 | ||
@@ -481,6 +487,7 @@ int radeon_atombios_init(struct radeon_device *rdev) | |||
481 | atom_card_info->pll_write = cail_pll_write; | 487 | atom_card_info->pll_write = cail_pll_write; |
482 | 488 | ||
483 | rdev->mode_info.atom_context = atom_parse(atom_card_info, rdev->bios); | 489 | rdev->mode_info.atom_context = atom_parse(atom_card_info, rdev->bios); |
490 | mutex_init(&rdev->mode_info.atom_context->mutex); | ||
484 | radeon_atom_initialize_bios_scratch_regs(rdev->ddev); | 491 | radeon_atom_initialize_bios_scratch_regs(rdev->ddev); |
485 | atom_allocate_fb_scratch(rdev->mode_info.atom_context); | 492 | atom_allocate_fb_scratch(rdev->mode_info.atom_context); |
486 | return 0; | 493 | return 0; |
@@ -539,9 +546,72 @@ void radeon_agp_disable(struct radeon_device *rdev) | |||
539 | } | 546 | } |
540 | } | 547 | } |
541 | 548 | ||
542 | /* | 549 | void radeon_check_arguments(struct radeon_device *rdev) |
543 | * Radeon device. | 550 | { |
544 | */ | 551 | /* vramlimit must be a power of two */ |
552 | switch (radeon_vram_limit) { | ||
553 | case 0: | ||
554 | case 4: | ||
555 | case 8: | ||
556 | case 16: | ||
557 | case 32: | ||
558 | case 64: | ||
559 | case 128: | ||
560 | case 256: | ||
561 | case 512: | ||
562 | case 1024: | ||
563 | case 2048: | ||
564 | case 4096: | ||
565 | break; | ||
566 | default: | ||
567 | dev_warn(rdev->dev, "vram limit (%d) must be a power of 2\n", | ||
568 | radeon_vram_limit); | ||
569 | radeon_vram_limit = 0; | ||
570 | break; | ||
571 | } | ||
572 | radeon_vram_limit = radeon_vram_limit << 20; | ||
573 | /* gtt size must be power of two and greater or equal to 32M */ | ||
574 | switch (radeon_gart_size) { | ||
575 | case 4: | ||
576 | case 8: | ||
577 | case 16: | ||
578 | dev_warn(rdev->dev, "gart size (%d) too small forcing to 512M\n", | ||
579 | radeon_gart_size); | ||
580 | radeon_gart_size = 512; | ||
581 | break; | ||
582 | case 32: | ||
583 | case 64: | ||
584 | case 128: | ||
585 | case 256: | ||
586 | case 512: | ||
587 | case 1024: | ||
588 | case 2048: | ||
589 | case 4096: | ||
590 | break; | ||
591 | default: | ||
592 | dev_warn(rdev->dev, "gart size (%d) must be a power of 2\n", | ||
593 | radeon_gart_size); | ||
594 | radeon_gart_size = 512; | ||
595 | break; | ||
596 | } | ||
597 | rdev->mc.gtt_size = radeon_gart_size * 1024 * 1024; | ||
598 | /* AGP mode can only be -1, 1, 2, 4, 8 */ | ||
599 | switch (radeon_agpmode) { | ||
600 | case -1: | ||
601 | case 0: | ||
602 | case 1: | ||
603 | case 2: | ||
604 | case 4: | ||
605 | case 8: | ||
606 | break; | ||
607 | default: | ||
608 | dev_warn(rdev->dev, "invalid AGP mode %d (valid mode: " | ||
609 | "-1, 0, 1, 2, 4, 8)\n", radeon_agpmode); | ||
610 | radeon_agpmode = 0; | ||
611 | break; | ||
612 | } | ||
613 | } | ||
614 | |||
545 | int radeon_device_init(struct radeon_device *rdev, | 615 | int radeon_device_init(struct radeon_device *rdev, |
546 | struct drm_device *ddev, | 616 | struct drm_device *ddev, |
547 | struct pci_dev *pdev, | 617 | struct pci_dev *pdev, |
@@ -580,9 +650,9 @@ int radeon_device_init(struct radeon_device *rdev, | |||
580 | 650 | ||
581 | /* Set asic functions */ | 651 | /* Set asic functions */ |
582 | r = radeon_asic_init(rdev); | 652 | r = radeon_asic_init(rdev); |
583 | if (r) { | 653 | if (r) |
584 | return r; | 654 | return r; |
585 | } | 655 | radeon_check_arguments(rdev); |
586 | 656 | ||
587 | if (rdev->flags & RADEON_IS_AGP && radeon_agpmode == -1) { | 657 | if (rdev->flags & RADEON_IS_AGP && radeon_agpmode == -1) { |
588 | radeon_agp_disable(rdev); | 658 | radeon_agp_disable(rdev); |
@@ -663,16 +733,18 @@ void radeon_device_fini(struct radeon_device *rdev) | |||
663 | */ | 733 | */ |
664 | int radeon_suspend_kms(struct drm_device *dev, pm_message_t state) | 734 | int radeon_suspend_kms(struct drm_device *dev, pm_message_t state) |
665 | { | 735 | { |
666 | struct radeon_device *rdev = dev->dev_private; | 736 | struct radeon_device *rdev; |
667 | struct drm_crtc *crtc; | 737 | struct drm_crtc *crtc; |
668 | int r; | 738 | int r; |
669 | 739 | ||
670 | if (dev == NULL || rdev == NULL) { | 740 | if (dev == NULL || dev->dev_private == NULL) { |
671 | return -ENODEV; | 741 | return -ENODEV; |
672 | } | 742 | } |
673 | if (state.event == PM_EVENT_PRETHAW) { | 743 | if (state.event == PM_EVENT_PRETHAW) { |
674 | return 0; | 744 | return 0; |
675 | } | 745 | } |
746 | rdev = dev->dev_private; | ||
747 | |||
676 | /* unpin the front buffers */ | 748 | /* unpin the front buffers */ |
677 | list_for_each_entry(crtc, &dev->mode_config.crtc_list, head) { | 749 | list_for_each_entry(crtc, &dev->mode_config.crtc_list, head) { |
678 | struct radeon_framebuffer *rfb = to_radeon_framebuffer(crtc->fb); | 750 | struct radeon_framebuffer *rfb = to_radeon_framebuffer(crtc->fb); |
diff --git a/drivers/gpu/drm/radeon/radeon_display.c b/drivers/gpu/drm/radeon/radeon_display.c index a133b833e45d..0ec491ead2ff 100644 --- a/drivers/gpu/drm/radeon/radeon_display.c +++ b/drivers/gpu/drm/radeon/radeon_display.c | |||
@@ -234,7 +234,7 @@ static const char *encoder_names[34] = { | |||
234 | "INTERNAL_UNIPHY2", | 234 | "INTERNAL_UNIPHY2", |
235 | }; | 235 | }; |
236 | 236 | ||
237 | static const char *connector_names[13] = { | 237 | static const char *connector_names[15] = { |
238 | "Unknown", | 238 | "Unknown", |
239 | "VGA", | 239 | "VGA", |
240 | "DVI-I", | 240 | "DVI-I", |
@@ -248,6 +248,8 @@ static const char *connector_names[13] = { | |||
248 | "DisplayPort", | 248 | "DisplayPort", |
249 | "HDMI-A", | 249 | "HDMI-A", |
250 | "HDMI-B", | 250 | "HDMI-B", |
251 | "TV", | ||
252 | "eDP", | ||
251 | }; | 253 | }; |
252 | 254 | ||
253 | static const char *hpd_names[7] = { | 255 | static const char *hpd_names[7] = { |
@@ -329,8 +331,11 @@ static bool radeon_setup_enc_conn(struct drm_device *dev) | |||
329 | ret = radeon_get_atom_connector_info_from_object_table(dev); | 331 | ret = radeon_get_atom_connector_info_from_object_table(dev); |
330 | else | 332 | else |
331 | ret = radeon_get_atom_connector_info_from_supported_devices_table(dev); | 333 | ret = radeon_get_atom_connector_info_from_supported_devices_table(dev); |
332 | } else | 334 | } else { |
333 | ret = radeon_get_legacy_connector_info_from_bios(dev); | 335 | ret = radeon_get_legacy_connector_info_from_bios(dev); |
336 | if (ret == false) | ||
337 | ret = radeon_get_legacy_connector_info_from_table(dev); | ||
338 | } | ||
334 | } else { | 339 | } else { |
335 | if (!ASIC_IS_AVIVO(rdev)) | 340 | if (!ASIC_IS_AVIVO(rdev)) |
336 | ret = radeon_get_legacy_connector_info_from_table(dev); | 341 | ret = radeon_get_legacy_connector_info_from_table(dev); |
@@ -349,7 +354,8 @@ int radeon_ddc_get_modes(struct radeon_connector *radeon_connector) | |||
349 | { | 354 | { |
350 | int ret = 0; | 355 | int ret = 0; |
351 | 356 | ||
352 | if (radeon_connector->base.connector_type == DRM_MODE_CONNECTOR_DisplayPort) { | 357 | if ((radeon_connector->base.connector_type == DRM_MODE_CONNECTOR_DisplayPort) || |
358 | (radeon_connector->base.connector_type == DRM_MODE_CONNECTOR_eDP)) { | ||
353 | struct radeon_connector_atom_dig *dig = radeon_connector->con_priv; | 359 | struct radeon_connector_atom_dig *dig = radeon_connector->con_priv; |
354 | if (dig->dp_i2c_bus) | 360 | if (dig->dp_i2c_bus) |
355 | radeon_connector->edid = drm_get_edid(&radeon_connector->base, &dig->dp_i2c_bus->adapter); | 361 | radeon_connector->edid = drm_get_edid(&radeon_connector->base, &dig->dp_i2c_bus->adapter); |
@@ -739,7 +745,7 @@ static struct drm_prop_enum_list radeon_tv_std_enum_list[] = | |||
739 | { TV_STD_SECAM, "secam" }, | 745 | { TV_STD_SECAM, "secam" }, |
740 | }; | 746 | }; |
741 | 747 | ||
742 | int radeon_modeset_create_props(struct radeon_device *rdev) | 748 | static int radeon_modeset_create_props(struct radeon_device *rdev) |
743 | { | 749 | { |
744 | int i, sz; | 750 | int i, sz; |
745 | 751 | ||
diff --git a/drivers/gpu/drm/radeon/radeon_drv.c b/drivers/gpu/drm/radeon/radeon_drv.c index dbd56ef82f9c..8ba3de7994d4 100644 --- a/drivers/gpu/drm/radeon/radeon_drv.c +++ b/drivers/gpu/drm/radeon/radeon_drv.c | |||
@@ -196,7 +196,7 @@ static struct drm_driver driver_old = { | |||
196 | .owner = THIS_MODULE, | 196 | .owner = THIS_MODULE, |
197 | .open = drm_open, | 197 | .open = drm_open, |
198 | .release = drm_release, | 198 | .release = drm_release, |
199 | .ioctl = drm_ioctl, | 199 | .unlocked_ioctl = drm_ioctl, |
200 | .mmap = drm_mmap, | 200 | .mmap = drm_mmap, |
201 | .poll = drm_poll, | 201 | .poll = drm_poll, |
202 | .fasync = drm_fasync, | 202 | .fasync = drm_fasync, |
@@ -284,7 +284,7 @@ static struct drm_driver kms_driver = { | |||
284 | .owner = THIS_MODULE, | 284 | .owner = THIS_MODULE, |
285 | .open = drm_open, | 285 | .open = drm_open, |
286 | .release = drm_release, | 286 | .release = drm_release, |
287 | .ioctl = drm_ioctl, | 287 | .unlocked_ioctl = drm_ioctl, |
288 | .mmap = radeon_mmap, | 288 | .mmap = radeon_mmap, |
289 | .poll = drm_poll, | 289 | .poll = drm_poll, |
290 | .fasync = drm_fasync, | 290 | .fasync = drm_fasync, |
diff --git a/drivers/gpu/drm/radeon/radeon_encoders.c b/drivers/gpu/drm/radeon/radeon_encoders.c index 0d1d908e5225..82eb551970b9 100644 --- a/drivers/gpu/drm/radeon/radeon_encoders.c +++ b/drivers/gpu/drm/radeon/radeon_encoders.c | |||
@@ -233,6 +233,8 @@ static bool radeon_atom_mode_fixup(struct drm_encoder *encoder, | |||
233 | if (!ASIC_IS_AVIVO(rdev)) { | 233 | if (!ASIC_IS_AVIVO(rdev)) { |
234 | adjusted_mode->hdisplay = mode->hdisplay; | 234 | adjusted_mode->hdisplay = mode->hdisplay; |
235 | adjusted_mode->vdisplay = mode->vdisplay; | 235 | adjusted_mode->vdisplay = mode->vdisplay; |
236 | adjusted_mode->crtc_hdisplay = mode->hdisplay; | ||
237 | adjusted_mode->crtc_vdisplay = mode->vdisplay; | ||
236 | } | 238 | } |
237 | adjusted_mode->base.id = mode_id; | 239 | adjusted_mode->base.id = mode_id; |
238 | } | 240 | } |
@@ -495,9 +497,9 @@ atombios_digital_setup(struct drm_encoder *encoder, int action) | |||
495 | args.v1.ucMisc |= PANEL_ENCODER_MISC_HDMI_TYPE; | 497 | args.v1.ucMisc |= PANEL_ENCODER_MISC_HDMI_TYPE; |
496 | args.v1.usPixelClock = cpu_to_le16(radeon_encoder->pixel_clock / 10); | 498 | args.v1.usPixelClock = cpu_to_le16(radeon_encoder->pixel_clock / 10); |
497 | if (radeon_encoder->devices & (ATOM_DEVICE_LCD_SUPPORT)) { | 499 | if (radeon_encoder->devices & (ATOM_DEVICE_LCD_SUPPORT)) { |
498 | if (dig->lvds_misc & (1 << 0)) | 500 | if (dig->lvds_misc & ATOM_PANEL_MISC_DUAL) |
499 | args.v1.ucMisc |= PANEL_ENCODER_MISC_DUAL; | 501 | args.v1.ucMisc |= PANEL_ENCODER_MISC_DUAL; |
500 | if (dig->lvds_misc & (1 << 1)) | 502 | if (dig->lvds_misc & ATOM_PANEL_MISC_888RGB) |
501 | args.v1.ucMisc |= (1 << 1); | 503 | args.v1.ucMisc |= (1 << 1); |
502 | } else { | 504 | } else { |
503 | if (dig_connector->linkb) | 505 | if (dig_connector->linkb) |
@@ -524,18 +526,18 @@ atombios_digital_setup(struct drm_encoder *encoder, int action) | |||
524 | args.v2.ucTemporal = 0; | 526 | args.v2.ucTemporal = 0; |
525 | args.v2.ucFRC = 0; | 527 | args.v2.ucFRC = 0; |
526 | if (radeon_encoder->devices & (ATOM_DEVICE_LCD_SUPPORT)) { | 528 | if (radeon_encoder->devices & (ATOM_DEVICE_LCD_SUPPORT)) { |
527 | if (dig->lvds_misc & (1 << 0)) | 529 | if (dig->lvds_misc & ATOM_PANEL_MISC_DUAL) |
528 | args.v2.ucMisc |= PANEL_ENCODER_MISC_DUAL; | 530 | args.v2.ucMisc |= PANEL_ENCODER_MISC_DUAL; |
529 | if (dig->lvds_misc & (1 << 5)) { | 531 | if (dig->lvds_misc & ATOM_PANEL_MISC_SPATIAL) { |
530 | args.v2.ucSpatial = PANEL_ENCODER_SPATIAL_DITHER_EN; | 532 | args.v2.ucSpatial = PANEL_ENCODER_SPATIAL_DITHER_EN; |
531 | if (dig->lvds_misc & (1 << 1)) | 533 | if (dig->lvds_misc & ATOM_PANEL_MISC_888RGB) |
532 | args.v2.ucSpatial |= PANEL_ENCODER_SPATIAL_DITHER_DEPTH; | 534 | args.v2.ucSpatial |= PANEL_ENCODER_SPATIAL_DITHER_DEPTH; |
533 | } | 535 | } |
534 | if (dig->lvds_misc & (1 << 6)) { | 536 | if (dig->lvds_misc & ATOM_PANEL_MISC_TEMPORAL) { |
535 | args.v2.ucTemporal = PANEL_ENCODER_TEMPORAL_DITHER_EN; | 537 | args.v2.ucTemporal = PANEL_ENCODER_TEMPORAL_DITHER_EN; |
536 | if (dig->lvds_misc & (1 << 1)) | 538 | if (dig->lvds_misc & ATOM_PANEL_MISC_888RGB) |
537 | args.v2.ucTemporal |= PANEL_ENCODER_TEMPORAL_DITHER_DEPTH; | 539 | args.v2.ucTemporal |= PANEL_ENCODER_TEMPORAL_DITHER_DEPTH; |
538 | if (((dig->lvds_misc >> 2) & 0x3) == 2) | 540 | if (((dig->lvds_misc >> ATOM_PANEL_MISC_GREY_LEVEL_SHIFT) & 0x3) == 2) |
539 | args.v2.ucTemporal |= PANEL_ENCODER_TEMPORAL_LEVEL_4; | 541 | args.v2.ucTemporal |= PANEL_ENCODER_TEMPORAL_LEVEL_4; |
540 | } | 542 | } |
541 | } else { | 543 | } else { |
@@ -594,21 +596,23 @@ atombios_get_encoder_mode(struct drm_encoder *encoder) | |||
594 | return ATOM_ENCODER_MODE_LVDS; | 596 | return ATOM_ENCODER_MODE_LVDS; |
595 | break; | 597 | break; |
596 | case DRM_MODE_CONNECTOR_DisplayPort: | 598 | case DRM_MODE_CONNECTOR_DisplayPort: |
599 | case DRM_MODE_CONNECTOR_eDP: | ||
597 | radeon_dig_connector = radeon_connector->con_priv; | 600 | radeon_dig_connector = radeon_connector->con_priv; |
598 | if (radeon_dig_connector->dp_sink_type == CONNECTOR_OBJECT_ID_DISPLAYPORT) | 601 | if ((radeon_dig_connector->dp_sink_type == CONNECTOR_OBJECT_ID_DISPLAYPORT) || |
602 | (radeon_dig_connector->dp_sink_type == CONNECTOR_OBJECT_ID_eDP)) | ||
599 | return ATOM_ENCODER_MODE_DP; | 603 | return ATOM_ENCODER_MODE_DP; |
600 | else if (drm_detect_hdmi_monitor(radeon_connector->edid)) | 604 | else if (drm_detect_hdmi_monitor(radeon_connector->edid)) |
601 | return ATOM_ENCODER_MODE_HDMI; | 605 | return ATOM_ENCODER_MODE_HDMI; |
602 | else | 606 | else |
603 | return ATOM_ENCODER_MODE_DVI; | 607 | return ATOM_ENCODER_MODE_DVI; |
604 | break; | 608 | break; |
605 | case CONNECTOR_DVI_A: | 609 | case DRM_MODE_CONNECTOR_DVIA: |
606 | case CONNECTOR_VGA: | 610 | case DRM_MODE_CONNECTOR_VGA: |
607 | return ATOM_ENCODER_MODE_CRT; | 611 | return ATOM_ENCODER_MODE_CRT; |
608 | break; | 612 | break; |
609 | case CONNECTOR_STV: | 613 | case DRM_MODE_CONNECTOR_Composite: |
610 | case CONNECTOR_CTV: | 614 | case DRM_MODE_CONNECTOR_SVIDEO: |
611 | case CONNECTOR_DIN: | 615 | case DRM_MODE_CONNECTOR_9PinDIN: |
612 | /* fix me */ | 616 | /* fix me */ |
613 | return ATOM_ENCODER_MODE_TV; | 617 | return ATOM_ENCODER_MODE_TV; |
614 | /*return ATOM_ENCODER_MODE_CV;*/ | 618 | /*return ATOM_ENCODER_MODE_CV;*/ |
diff --git a/drivers/gpu/drm/radeon/radeon_fence.c b/drivers/gpu/drm/radeon/radeon_fence.c index cb4cd97ae39f..8495d4e32e18 100644 --- a/drivers/gpu/drm/radeon/radeon_fence.c +++ b/drivers/gpu/drm/radeon/radeon_fence.c | |||
@@ -140,16 +140,15 @@ int radeon_fence_create(struct radeon_device *rdev, struct radeon_fence **fence) | |||
140 | 140 | ||
141 | bool radeon_fence_signaled(struct radeon_fence *fence) | 141 | bool radeon_fence_signaled(struct radeon_fence *fence) |
142 | { | 142 | { |
143 | struct radeon_device *rdev = fence->rdev; | ||
144 | unsigned long irq_flags; | 143 | unsigned long irq_flags; |
145 | bool signaled = false; | 144 | bool signaled = false; |
146 | 145 | ||
147 | if (rdev->gpu_lockup) { | 146 | if (!fence) |
148 | return true; | 147 | return true; |
149 | } | 148 | |
150 | if (fence == NULL) { | 149 | if (fence->rdev->gpu_lockup) |
151 | return true; | 150 | return true; |
152 | } | 151 | |
153 | write_lock_irqsave(&fence->rdev->fence_drv.lock, irq_flags); | 152 | write_lock_irqsave(&fence->rdev->fence_drv.lock, irq_flags); |
154 | signaled = fence->signaled; | 153 | signaled = fence->signaled; |
155 | /* if we are shuting down report all fence as signaled */ | 154 | /* if we are shuting down report all fence as signaled */ |
@@ -324,7 +323,7 @@ int radeon_fence_driver_init(struct radeon_device *rdev) | |||
324 | write_lock_irqsave(&rdev->fence_drv.lock, irq_flags); | 323 | write_lock_irqsave(&rdev->fence_drv.lock, irq_flags); |
325 | r = radeon_scratch_get(rdev, &rdev->fence_drv.scratch_reg); | 324 | r = radeon_scratch_get(rdev, &rdev->fence_drv.scratch_reg); |
326 | if (r) { | 325 | if (r) { |
327 | DRM_ERROR("Fence failed to get a scratch register."); | 326 | dev_err(rdev->dev, "fence failed to get scratch register\n"); |
328 | write_unlock_irqrestore(&rdev->fence_drv.lock, irq_flags); | 327 | write_unlock_irqrestore(&rdev->fence_drv.lock, irq_flags); |
329 | return r; | 328 | return r; |
330 | } | 329 | } |
@@ -335,9 +334,10 @@ int radeon_fence_driver_init(struct radeon_device *rdev) | |||
335 | INIT_LIST_HEAD(&rdev->fence_drv.signaled); | 334 | INIT_LIST_HEAD(&rdev->fence_drv.signaled); |
336 | rdev->fence_drv.count_timeout = 0; | 335 | rdev->fence_drv.count_timeout = 0; |
337 | init_waitqueue_head(&rdev->fence_drv.queue); | 336 | init_waitqueue_head(&rdev->fence_drv.queue); |
337 | rdev->fence_drv.initialized = true; | ||
338 | write_unlock_irqrestore(&rdev->fence_drv.lock, irq_flags); | 338 | write_unlock_irqrestore(&rdev->fence_drv.lock, irq_flags); |
339 | if (radeon_debugfs_fence_init(rdev)) { | 339 | if (radeon_debugfs_fence_init(rdev)) { |
340 | DRM_ERROR("Failed to register debugfs file for fence !\n"); | 340 | dev_err(rdev->dev, "fence debugfs file creation failed\n"); |
341 | } | 341 | } |
342 | return 0; | 342 | return 0; |
343 | } | 343 | } |
@@ -346,11 +346,13 @@ void radeon_fence_driver_fini(struct radeon_device *rdev) | |||
346 | { | 346 | { |
347 | unsigned long irq_flags; | 347 | unsigned long irq_flags; |
348 | 348 | ||
349 | if (!rdev->fence_drv.initialized) | ||
350 | return; | ||
349 | wake_up_all(&rdev->fence_drv.queue); | 351 | wake_up_all(&rdev->fence_drv.queue); |
350 | write_lock_irqsave(&rdev->fence_drv.lock, irq_flags); | 352 | write_lock_irqsave(&rdev->fence_drv.lock, irq_flags); |
351 | radeon_scratch_free(rdev, rdev->fence_drv.scratch_reg); | 353 | radeon_scratch_free(rdev, rdev->fence_drv.scratch_reg); |
352 | write_unlock_irqrestore(&rdev->fence_drv.lock, irq_flags); | 354 | write_unlock_irqrestore(&rdev->fence_drv.lock, irq_flags); |
353 | DRM_INFO("radeon: fence finalized\n"); | 355 | rdev->fence_drv.initialized = false; |
354 | } | 356 | } |
355 | 357 | ||
356 | 358 | ||
diff --git a/drivers/gpu/drm/radeon/radeon_gem.c b/drivers/gpu/drm/radeon/radeon_gem.c index 60df2d7e7e4c..0e1325e18534 100644 --- a/drivers/gpu/drm/radeon/radeon_gem.c +++ b/drivers/gpu/drm/radeon/radeon_gem.c | |||
@@ -131,7 +131,6 @@ int radeon_gem_set_domain(struct drm_gem_object *gobj, | |||
131 | printk(KERN_ERR "Failed to wait for object !\n"); | 131 | printk(KERN_ERR "Failed to wait for object !\n"); |
132 | return r; | 132 | return r; |
133 | } | 133 | } |
134 | radeon_hdp_flush(robj->rdev); | ||
135 | } | 134 | } |
136 | return 0; | 135 | return 0; |
137 | } | 136 | } |
@@ -312,7 +311,6 @@ int radeon_gem_wait_idle_ioctl(struct drm_device *dev, void *data, | |||
312 | mutex_lock(&dev->struct_mutex); | 311 | mutex_lock(&dev->struct_mutex); |
313 | drm_gem_object_unreference(gobj); | 312 | drm_gem_object_unreference(gobj); |
314 | mutex_unlock(&dev->struct_mutex); | 313 | mutex_unlock(&dev->struct_mutex); |
315 | radeon_hdp_flush(robj->rdev); | ||
316 | return r; | 314 | return r; |
317 | } | 315 | } |
318 | 316 | ||
diff --git a/drivers/gpu/drm/radeon/radeon_ioc32.c b/drivers/gpu/drm/radeon/radeon_ioc32.c index a1bf11de308a..48b7cea31e08 100644 --- a/drivers/gpu/drm/radeon/radeon_ioc32.c +++ b/drivers/gpu/drm/radeon/radeon_ioc32.c | |||
@@ -92,8 +92,7 @@ static int compat_radeon_cp_init(struct file *file, unsigned int cmd, | |||
92 | &init->gart_textures_offset)) | 92 | &init->gart_textures_offset)) |
93 | return -EFAULT; | 93 | return -EFAULT; |
94 | 94 | ||
95 | return drm_ioctl(file->f_path.dentry->d_inode, file, | 95 | return drm_ioctl(file, DRM_IOCTL_RADEON_CP_INIT, (unsigned long)init); |
96 | DRM_IOCTL_RADEON_CP_INIT, (unsigned long)init); | ||
97 | } | 96 | } |
98 | 97 | ||
99 | typedef struct drm_radeon_clear32 { | 98 | typedef struct drm_radeon_clear32 { |
@@ -125,8 +124,7 @@ static int compat_radeon_cp_clear(struct file *file, unsigned int cmd, | |||
125 | &clr->depth_boxes)) | 124 | &clr->depth_boxes)) |
126 | return -EFAULT; | 125 | return -EFAULT; |
127 | 126 | ||
128 | return drm_ioctl(file->f_path.dentry->d_inode, file, | 127 | return drm_ioctl(file, DRM_IOCTL_RADEON_CLEAR, (unsigned long)clr); |
129 | DRM_IOCTL_RADEON_CLEAR, (unsigned long)clr); | ||
130 | } | 128 | } |
131 | 129 | ||
132 | typedef struct drm_radeon_stipple32 { | 130 | typedef struct drm_radeon_stipple32 { |
@@ -149,8 +147,7 @@ static int compat_radeon_cp_stipple(struct file *file, unsigned int cmd, | |||
149 | &request->mask)) | 147 | &request->mask)) |
150 | return -EFAULT; | 148 | return -EFAULT; |
151 | 149 | ||
152 | return drm_ioctl(file->f_path.dentry->d_inode, file, | 150 | return drm_ioctl(file, DRM_IOCTL_RADEON_STIPPLE, (unsigned long)request); |
153 | DRM_IOCTL_RADEON_STIPPLE, (unsigned long)request); | ||
154 | } | 151 | } |
155 | 152 | ||
156 | typedef struct drm_radeon_tex_image32 { | 153 | typedef struct drm_radeon_tex_image32 { |
@@ -204,8 +201,7 @@ static int compat_radeon_cp_texture(struct file *file, unsigned int cmd, | |||
204 | &image->data)) | 201 | &image->data)) |
205 | return -EFAULT; | 202 | return -EFAULT; |
206 | 203 | ||
207 | return drm_ioctl(file->f_path.dentry->d_inode, file, | 204 | return drm_ioctl(file, DRM_IOCTL_RADEON_TEXTURE, (unsigned long)request); |
208 | DRM_IOCTL_RADEON_TEXTURE, (unsigned long)request); | ||
209 | } | 205 | } |
210 | 206 | ||
211 | typedef struct drm_radeon_vertex2_32 { | 207 | typedef struct drm_radeon_vertex2_32 { |
@@ -238,8 +234,7 @@ static int compat_radeon_cp_vertex2(struct file *file, unsigned int cmd, | |||
238 | &request->prim)) | 234 | &request->prim)) |
239 | return -EFAULT; | 235 | return -EFAULT; |
240 | 236 | ||
241 | return drm_ioctl(file->f_path.dentry->d_inode, file, | 237 | return drm_ioctl(file, DRM_IOCTL_RADEON_VERTEX2, (unsigned long)request); |
242 | DRM_IOCTL_RADEON_VERTEX2, (unsigned long)request); | ||
243 | } | 238 | } |
244 | 239 | ||
245 | typedef struct drm_radeon_cmd_buffer32 { | 240 | typedef struct drm_radeon_cmd_buffer32 { |
@@ -268,8 +263,7 @@ static int compat_radeon_cp_cmdbuf(struct file *file, unsigned int cmd, | |||
268 | &request->boxes)) | 263 | &request->boxes)) |
269 | return -EFAULT; | 264 | return -EFAULT; |
270 | 265 | ||
271 | return drm_ioctl(file->f_path.dentry->d_inode, file, | 266 | return drm_ioctl(file, DRM_IOCTL_RADEON_CMDBUF, (unsigned long)request); |
272 | DRM_IOCTL_RADEON_CMDBUF, (unsigned long)request); | ||
273 | } | 267 | } |
274 | 268 | ||
275 | typedef struct drm_radeon_getparam32 { | 269 | typedef struct drm_radeon_getparam32 { |
@@ -293,8 +287,7 @@ static int compat_radeon_cp_getparam(struct file *file, unsigned int cmd, | |||
293 | &request->value)) | 287 | &request->value)) |
294 | return -EFAULT; | 288 | return -EFAULT; |
295 | 289 | ||
296 | return drm_ioctl(file->f_path.dentry->d_inode, file, | 290 | return drm_ioctl(file, DRM_IOCTL_RADEON_GETPARAM, (unsigned long)request); |
297 | DRM_IOCTL_RADEON_GETPARAM, (unsigned long)request); | ||
298 | } | 291 | } |
299 | 292 | ||
300 | typedef struct drm_radeon_mem_alloc32 { | 293 | typedef struct drm_radeon_mem_alloc32 { |
@@ -322,8 +315,7 @@ static int compat_radeon_mem_alloc(struct file *file, unsigned int cmd, | |||
322 | &request->region_offset)) | 315 | &request->region_offset)) |
323 | return -EFAULT; | 316 | return -EFAULT; |
324 | 317 | ||
325 | return drm_ioctl(file->f_path.dentry->d_inode, file, | 318 | return drm_ioctl(file, DRM_IOCTL_RADEON_ALLOC, (unsigned long)request); |
326 | DRM_IOCTL_RADEON_ALLOC, (unsigned long)request); | ||
327 | } | 319 | } |
328 | 320 | ||
329 | typedef struct drm_radeon_irq_emit32 { | 321 | typedef struct drm_radeon_irq_emit32 { |
@@ -345,8 +337,7 @@ static int compat_radeon_irq_emit(struct file *file, unsigned int cmd, | |||
345 | &request->irq_seq)) | 337 | &request->irq_seq)) |
346 | return -EFAULT; | 338 | return -EFAULT; |
347 | 339 | ||
348 | return drm_ioctl(file->f_path.dentry->d_inode, file, | 340 | return drm_ioctl(file, DRM_IOCTL_RADEON_IRQ_EMIT, (unsigned long)request); |
349 | DRM_IOCTL_RADEON_IRQ_EMIT, (unsigned long)request); | ||
350 | } | 341 | } |
351 | 342 | ||
352 | /* The two 64-bit arches where alignof(u64)==4 in 32-bit code */ | 343 | /* The two 64-bit arches where alignof(u64)==4 in 32-bit code */ |
@@ -372,8 +363,7 @@ static int compat_radeon_cp_setparam(struct file *file, unsigned int cmd, | |||
372 | &request->value)) | 363 | &request->value)) |
373 | return -EFAULT; | 364 | return -EFAULT; |
374 | 365 | ||
375 | return drm_ioctl(file->f_dentry->d_inode, file, | 366 | return drm_ioctl(file, DRM_IOCTL_RADEON_SETPARAM, (unsigned long) request); |
376 | DRM_IOCTL_RADEON_SETPARAM, (unsigned long) request); | ||
377 | } | 367 | } |
378 | #else | 368 | #else |
379 | #define compat_radeon_cp_setparam NULL | 369 | #define compat_radeon_cp_setparam NULL |
@@ -413,12 +403,10 @@ long radeon_compat_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) | |||
413 | if (nr < DRM_COMMAND_BASE + DRM_ARRAY_SIZE(radeon_compat_ioctls)) | 403 | if (nr < DRM_COMMAND_BASE + DRM_ARRAY_SIZE(radeon_compat_ioctls)) |
414 | fn = radeon_compat_ioctls[nr - DRM_COMMAND_BASE]; | 404 | fn = radeon_compat_ioctls[nr - DRM_COMMAND_BASE]; |
415 | 405 | ||
416 | lock_kernel(); /* XXX for now */ | ||
417 | if (fn != NULL) | 406 | if (fn != NULL) |
418 | ret = (*fn) (filp, cmd, arg); | 407 | ret = (*fn) (filp, cmd, arg); |
419 | else | 408 | else |
420 | ret = drm_ioctl(filp->f_path.dentry->d_inode, filp, cmd, arg); | 409 | ret = drm_ioctl(filp, cmd, arg); |
421 | unlock_kernel(); | ||
422 | 410 | ||
423 | return ret; | 411 | return ret; |
424 | } | 412 | } |
@@ -431,9 +419,7 @@ long radeon_kms_compat_ioctl(struct file *filp, unsigned int cmd, unsigned long | |||
431 | if (nr < DRM_COMMAND_BASE) | 419 | if (nr < DRM_COMMAND_BASE) |
432 | return drm_compat_ioctl(filp, cmd, arg); | 420 | return drm_compat_ioctl(filp, cmd, arg); |
433 | 421 | ||
434 | lock_kernel(); /* XXX for now */ | 422 | ret = drm_ioctl(filp, cmd, arg); |
435 | ret = drm_ioctl(filp->f_path.dentry->d_inode, filp, cmd, arg); | ||
436 | unlock_kernel(); | ||
437 | 423 | ||
438 | return ret; | 424 | return ret; |
439 | } | 425 | } |
diff --git a/drivers/gpu/drm/radeon/radeon_irq.c b/drivers/gpu/drm/radeon/radeon_irq.c index b79ecc4a7cc4..2f349a300195 100644 --- a/drivers/gpu/drm/radeon/radeon_irq.c +++ b/drivers/gpu/drm/radeon/radeon_irq.c | |||
@@ -289,16 +289,16 @@ int radeon_irq_emit(struct drm_device *dev, void *data, struct drm_file *file_pr | |||
289 | drm_radeon_irq_emit_t *emit = data; | 289 | drm_radeon_irq_emit_t *emit = data; |
290 | int result; | 290 | int result; |
291 | 291 | ||
292 | if ((dev_priv->flags & RADEON_FAMILY_MASK) >= CHIP_R600) | ||
293 | return -EINVAL; | ||
294 | |||
295 | LOCK_TEST_WITH_RETURN(dev, file_priv); | ||
296 | |||
297 | if (!dev_priv) { | 292 | if (!dev_priv) { |
298 | DRM_ERROR("called with no initialization\n"); | 293 | DRM_ERROR("called with no initialization\n"); |
299 | return -EINVAL; | 294 | return -EINVAL; |
300 | } | 295 | } |
301 | 296 | ||
297 | if ((dev_priv->flags & RADEON_FAMILY_MASK) >= CHIP_R600) | ||
298 | return -EINVAL; | ||
299 | |||
300 | LOCK_TEST_WITH_RETURN(dev, file_priv); | ||
301 | |||
302 | result = radeon_emit_irq(dev); | 302 | result = radeon_emit_irq(dev); |
303 | 303 | ||
304 | if (DRM_COPY_TO_USER(emit->irq_seq, &result, sizeof(int))) { | 304 | if (DRM_COPY_TO_USER(emit->irq_seq, &result, sizeof(int))) { |
diff --git a/drivers/gpu/drm/radeon/radeon_irq_kms.c b/drivers/gpu/drm/radeon/radeon_irq_kms.c index 9223296fe37b..3cfd60fd0083 100644 --- a/drivers/gpu/drm/radeon/radeon_irq_kms.c +++ b/drivers/gpu/drm/radeon/radeon_irq_kms.c | |||
@@ -97,6 +97,7 @@ void radeon_driver_irq_uninstall_kms(struct drm_device *dev) | |||
97 | rdev->irq.sw_int = false; | 97 | rdev->irq.sw_int = false; |
98 | for (i = 0; i < 2; i++) { | 98 | for (i = 0; i < 2; i++) { |
99 | rdev->irq.crtc_vblank_int[i] = false; | 99 | rdev->irq.crtc_vblank_int[i] = false; |
100 | rdev->irq.hpd[i] = false; | ||
100 | } | 101 | } |
101 | radeon_irq_set(rdev); | 102 | radeon_irq_set(rdev); |
102 | } | 103 | } |
@@ -128,17 +129,22 @@ int radeon_irq_kms_init(struct radeon_device *rdev) | |||
128 | DRM_INFO("radeon: using MSI.\n"); | 129 | DRM_INFO("radeon: using MSI.\n"); |
129 | } | 130 | } |
130 | } | 131 | } |
131 | drm_irq_install(rdev->ddev); | ||
132 | rdev->irq.installed = true; | 132 | rdev->irq.installed = true; |
133 | r = drm_irq_install(rdev->ddev); | ||
134 | if (r) { | ||
135 | rdev->irq.installed = false; | ||
136 | return r; | ||
137 | } | ||
133 | DRM_INFO("radeon: irq initialized.\n"); | 138 | DRM_INFO("radeon: irq initialized.\n"); |
134 | return 0; | 139 | return 0; |
135 | } | 140 | } |
136 | 141 | ||
137 | void radeon_irq_kms_fini(struct radeon_device *rdev) | 142 | void radeon_irq_kms_fini(struct radeon_device *rdev) |
138 | { | 143 | { |
144 | drm_vblank_cleanup(rdev->ddev); | ||
139 | if (rdev->irq.installed) { | 145 | if (rdev->irq.installed) { |
140 | rdev->irq.installed = false; | ||
141 | drm_irq_uninstall(rdev->ddev); | 146 | drm_irq_uninstall(rdev->ddev); |
147 | rdev->irq.installed = false; | ||
142 | if (rdev->msi_enabled) | 148 | if (rdev->msi_enabled) |
143 | pci_disable_msi(rdev->pdev); | 149 | pci_disable_msi(rdev->pdev); |
144 | } | 150 | } |
diff --git a/drivers/gpu/drm/radeon/radeon_legacy_crtc.c b/drivers/gpu/drm/radeon/radeon_legacy_crtc.c index b82ede98e152..cc27485a07ad 100644 --- a/drivers/gpu/drm/radeon/radeon_legacy_crtc.c +++ b/drivers/gpu/drm/radeon/radeon_legacy_crtc.c | |||
@@ -43,8 +43,7 @@ static void radeon_overscan_setup(struct drm_crtc *crtc, | |||
43 | } | 43 | } |
44 | 44 | ||
45 | static void radeon_legacy_rmx_mode_set(struct drm_crtc *crtc, | 45 | static void radeon_legacy_rmx_mode_set(struct drm_crtc *crtc, |
46 | struct drm_display_mode *mode, | 46 | struct drm_display_mode *mode) |
47 | struct drm_display_mode *adjusted_mode) | ||
48 | { | 47 | { |
49 | struct drm_device *dev = crtc->dev; | 48 | struct drm_device *dev = crtc->dev; |
50 | struct radeon_device *rdev = dev->dev_private; | 49 | struct radeon_device *rdev = dev->dev_private; |
@@ -1059,7 +1058,7 @@ static int radeon_crtc_mode_set(struct drm_crtc *crtc, | |||
1059 | radeon_set_pll(crtc, adjusted_mode); | 1058 | radeon_set_pll(crtc, adjusted_mode); |
1060 | radeon_overscan_setup(crtc, adjusted_mode); | 1059 | radeon_overscan_setup(crtc, adjusted_mode); |
1061 | if (radeon_crtc->crtc_id == 0) { | 1060 | if (radeon_crtc->crtc_id == 0) { |
1062 | radeon_legacy_rmx_mode_set(crtc, mode, adjusted_mode); | 1061 | radeon_legacy_rmx_mode_set(crtc, adjusted_mode); |
1063 | } else { | 1062 | } else { |
1064 | if (radeon_crtc->rmx_type != RMX_OFF) { | 1063 | if (radeon_crtc->rmx_type != RMX_OFF) { |
1065 | /* FIXME: only first crtc has rmx what should we | 1064 | /* FIXME: only first crtc has rmx what should we |
diff --git a/drivers/gpu/drm/radeon/radeon_legacy_encoders.c b/drivers/gpu/drm/radeon/radeon_legacy_encoders.c index df00515e81fa..981508ff7037 100644 --- a/drivers/gpu/drm/radeon/radeon_legacy_encoders.c +++ b/drivers/gpu/drm/radeon/radeon_legacy_encoders.c | |||
@@ -207,6 +207,8 @@ static bool radeon_legacy_mode_fixup(struct drm_encoder *encoder, | |||
207 | *adjusted_mode = *native_mode; | 207 | *adjusted_mode = *native_mode; |
208 | adjusted_mode->hdisplay = mode->hdisplay; | 208 | adjusted_mode->hdisplay = mode->hdisplay; |
209 | adjusted_mode->vdisplay = mode->vdisplay; | 209 | adjusted_mode->vdisplay = mode->vdisplay; |
210 | adjusted_mode->crtc_hdisplay = mode->hdisplay; | ||
211 | adjusted_mode->crtc_vdisplay = mode->vdisplay; | ||
210 | adjusted_mode->base.id = mode_id; | 212 | adjusted_mode->base.id = mode_id; |
211 | } | 213 | } |
212 | 214 | ||
diff --git a/drivers/gpu/drm/radeon/radeon_legacy_tv.c b/drivers/gpu/drm/radeon/radeon_legacy_tv.c index 3a12bb0c0563..417684daef4c 100644 --- a/drivers/gpu/drm/radeon/radeon_legacy_tv.c +++ b/drivers/gpu/drm/radeon/radeon_legacy_tv.c | |||
@@ -77,7 +77,7 @@ struct radeon_tv_mode_constants { | |||
77 | unsigned pix_to_tv; | 77 | unsigned pix_to_tv; |
78 | }; | 78 | }; |
79 | 79 | ||
80 | static const uint16_t hor_timing_NTSC[] = { | 80 | static const uint16_t hor_timing_NTSC[MAX_H_CODE_TIMING_LEN] = { |
81 | 0x0007, | 81 | 0x0007, |
82 | 0x003f, | 82 | 0x003f, |
83 | 0x0263, | 83 | 0x0263, |
@@ -98,7 +98,7 @@ static const uint16_t hor_timing_NTSC[] = { | |||
98 | 0 | 98 | 0 |
99 | }; | 99 | }; |
100 | 100 | ||
101 | static const uint16_t vert_timing_NTSC[] = { | 101 | static const uint16_t vert_timing_NTSC[MAX_V_CODE_TIMING_LEN] = { |
102 | 0x2001, | 102 | 0x2001, |
103 | 0x200d, | 103 | 0x200d, |
104 | 0x1006, | 104 | 0x1006, |
@@ -115,7 +115,7 @@ static const uint16_t vert_timing_NTSC[] = { | |||
115 | 0 | 115 | 0 |
116 | }; | 116 | }; |
117 | 117 | ||
118 | static const uint16_t hor_timing_PAL[] = { | 118 | static const uint16_t hor_timing_PAL[MAX_H_CODE_TIMING_LEN] = { |
119 | 0x0007, | 119 | 0x0007, |
120 | 0x0058, | 120 | 0x0058, |
121 | 0x027c, | 121 | 0x027c, |
@@ -136,7 +136,7 @@ static const uint16_t hor_timing_PAL[] = { | |||
136 | 0 | 136 | 0 |
137 | }; | 137 | }; |
138 | 138 | ||
139 | static const uint16_t vert_timing_PAL[] = { | 139 | static const uint16_t vert_timing_PAL[MAX_V_CODE_TIMING_LEN] = { |
140 | 0x2001, | 140 | 0x2001, |
141 | 0x200c, | 141 | 0x200c, |
142 | 0x1005, | 142 | 0x1005, |
@@ -623,9 +623,9 @@ void radeon_legacy_tv_mode_set(struct drm_encoder *encoder, | |||
623 | } | 623 | } |
624 | flicker_removal = (tmp + 500) / 1000; | 624 | flicker_removal = (tmp + 500) / 1000; |
625 | 625 | ||
626 | if (flicker_removal < 3) | 626 | if (flicker_removal < 2) |
627 | flicker_removal = 3; | 627 | flicker_removal = 2; |
628 | for (i = 0; i < 6; ++i) { | 628 | for (i = 0; i < ARRAY_SIZE(SLOPE_limit); ++i) { |
629 | if (flicker_removal == SLOPE_limit[i]) | 629 | if (flicker_removal == SLOPE_limit[i]) |
630 | break; | 630 | break; |
631 | } | 631 | } |
diff --git a/drivers/gpu/drm/radeon/radeon_mode.h b/drivers/gpu/drm/radeon/radeon_mode.h index 3dcbe130c422..91cb041cb40d 100644 --- a/drivers/gpu/drm/radeon/radeon_mode.h +++ b/drivers/gpu/drm/radeon/radeon_mode.h | |||
@@ -46,32 +46,6 @@ struct radeon_device; | |||
46 | #define to_radeon_encoder(x) container_of(x, struct radeon_encoder, base) | 46 | #define to_radeon_encoder(x) container_of(x, struct radeon_encoder, base) |
47 | #define to_radeon_framebuffer(x) container_of(x, struct radeon_framebuffer, base) | 47 | #define to_radeon_framebuffer(x) container_of(x, struct radeon_framebuffer, base) |
48 | 48 | ||
49 | enum radeon_connector_type { | ||
50 | CONNECTOR_NONE, | ||
51 | CONNECTOR_VGA, | ||
52 | CONNECTOR_DVI_I, | ||
53 | CONNECTOR_DVI_D, | ||
54 | CONNECTOR_DVI_A, | ||
55 | CONNECTOR_STV, | ||
56 | CONNECTOR_CTV, | ||
57 | CONNECTOR_LVDS, | ||
58 | CONNECTOR_DIGITAL, | ||
59 | CONNECTOR_SCART, | ||
60 | CONNECTOR_HDMI_TYPE_A, | ||
61 | CONNECTOR_HDMI_TYPE_B, | ||
62 | CONNECTOR_0XC, | ||
63 | CONNECTOR_0XD, | ||
64 | CONNECTOR_DIN, | ||
65 | CONNECTOR_DISPLAY_PORT, | ||
66 | CONNECTOR_UNSUPPORTED | ||
67 | }; | ||
68 | |||
69 | enum radeon_dvi_type { | ||
70 | DVI_AUTO, | ||
71 | DVI_DIGITAL, | ||
72 | DVI_ANALOG | ||
73 | }; | ||
74 | |||
75 | enum radeon_rmx_type { | 49 | enum radeon_rmx_type { |
76 | RMX_OFF, | 50 | RMX_OFF, |
77 | RMX_FULL, | 51 | RMX_FULL, |
@@ -88,6 +62,7 @@ enum radeon_tv_std { | |||
88 | TV_STD_SCART_PAL, | 62 | TV_STD_SCART_PAL, |
89 | TV_STD_SECAM, | 63 | TV_STD_SECAM, |
90 | TV_STD_PAL_CN, | 64 | TV_STD_PAL_CN, |
65 | TV_STD_PAL_N, | ||
91 | }; | 66 | }; |
92 | 67 | ||
93 | /* radeon gpio-based i2c | 68 | /* radeon gpio-based i2c |
@@ -395,6 +370,11 @@ struct radeon_framebuffer { | |||
395 | struct drm_gem_object *obj; | 370 | struct drm_gem_object *obj; |
396 | }; | 371 | }; |
397 | 372 | ||
373 | extern enum radeon_tv_std | ||
374 | radeon_combios_get_tv_info(struct radeon_device *rdev); | ||
375 | extern enum radeon_tv_std | ||
376 | radeon_atombios_get_tv_info(struct radeon_device *rdev); | ||
377 | |||
398 | extern void radeon_connector_hotplug(struct drm_connector *connector); | 378 | extern void radeon_connector_hotplug(struct drm_connector *connector); |
399 | extern bool radeon_dp_needs_link_train(struct radeon_connector *radeon_connector); | 379 | extern bool radeon_dp_needs_link_train(struct radeon_connector *radeon_connector); |
400 | extern int radeon_dp_mode_valid_helper(struct radeon_connector *radeon_connector, | 380 | extern int radeon_dp_mode_valid_helper(struct radeon_connector *radeon_connector, |
diff --git a/drivers/gpu/drm/radeon/radeon_object.c b/drivers/gpu/drm/radeon/radeon_object.c index d9ffe1f56e8f..4e636de877b2 100644 --- a/drivers/gpu/drm/radeon/radeon_object.c +++ b/drivers/gpu/drm/radeon/radeon_object.c | |||
@@ -221,8 +221,9 @@ int radeon_bo_unpin(struct radeon_bo *bo) | |||
221 | int radeon_bo_evict_vram(struct radeon_device *rdev) | 221 | int radeon_bo_evict_vram(struct radeon_device *rdev) |
222 | { | 222 | { |
223 | if (rdev->flags & RADEON_IS_IGP) { | 223 | if (rdev->flags & RADEON_IS_IGP) { |
224 | /* Useless to evict on IGP chips */ | 224 | if (rdev->mc.igp_sideport_enabled == false) |
225 | return 0; | 225 | /* Useless to evict on IGP chips */ |
226 | return 0; | ||
226 | } | 227 | } |
227 | return ttm_bo_evict_mm(&rdev->mman.bdev, TTM_PL_VRAM); | 228 | return ttm_bo_evict_mm(&rdev->mman.bdev, TTM_PL_VRAM); |
228 | } | 229 | } |
diff --git a/drivers/gpu/drm/radeon/radeon_test.c b/drivers/gpu/drm/radeon/radeon_test.c index 391c973ec4db..9f5e2f929da9 100644 --- a/drivers/gpu/drm/radeon/radeon_test.c +++ b/drivers/gpu/drm/radeon/radeon_test.c | |||
@@ -42,8 +42,8 @@ void radeon_test_moves(struct radeon_device *rdev) | |||
42 | /* Number of tests = | 42 | /* Number of tests = |
43 | * (Total GTT - IB pool - writeback page - ring buffer) / test size | 43 | * (Total GTT - IB pool - writeback page - ring buffer) / test size |
44 | */ | 44 | */ |
45 | n = (rdev->mc.gtt_size - RADEON_IB_POOL_SIZE*64*1024 - RADEON_GPU_PAGE_SIZE - | 45 | n = ((u32)(rdev->mc.gtt_size - RADEON_IB_POOL_SIZE*64*1024 - RADEON_GPU_PAGE_SIZE - |
46 | rdev->cp.ring_size) / size; | 46 | rdev->cp.ring_size)) / size; |
47 | 47 | ||
48 | gtt_obj = kzalloc(n * sizeof(*gtt_obj), GFP_KERNEL); | 48 | gtt_obj = kzalloc(n * sizeof(*gtt_obj), GFP_KERNEL); |
49 | if (!gtt_obj) { | 49 | if (!gtt_obj) { |
diff --git a/drivers/gpu/drm/radeon/radeon_ttm.c b/drivers/gpu/drm/radeon/radeon_ttm.c index d7fd160cc671..3b0c07b444a2 100644 --- a/drivers/gpu/drm/radeon/radeon_ttm.c +++ b/drivers/gpu/drm/radeon/radeon_ttm.c | |||
@@ -494,6 +494,7 @@ int radeon_ttm_init(struct radeon_device *rdev) | |||
494 | DRM_ERROR("failed initializing buffer object driver(%d).\n", r); | 494 | DRM_ERROR("failed initializing buffer object driver(%d).\n", r); |
495 | return r; | 495 | return r; |
496 | } | 496 | } |
497 | rdev->mman.initialized = true; | ||
497 | r = ttm_bo_init_mm(&rdev->mman.bdev, TTM_PL_VRAM, | 498 | r = ttm_bo_init_mm(&rdev->mman.bdev, TTM_PL_VRAM, |
498 | rdev->mc.real_vram_size >> PAGE_SHIFT); | 499 | rdev->mc.real_vram_size >> PAGE_SHIFT); |
499 | if (r) { | 500 | if (r) { |
@@ -541,6 +542,8 @@ void radeon_ttm_fini(struct radeon_device *rdev) | |||
541 | { | 542 | { |
542 | int r; | 543 | int r; |
543 | 544 | ||
545 | if (!rdev->mman.initialized) | ||
546 | return; | ||
544 | if (rdev->stollen_vga_memory) { | 547 | if (rdev->stollen_vga_memory) { |
545 | r = radeon_bo_reserve(rdev->stollen_vga_memory, false); | 548 | r = radeon_bo_reserve(rdev->stollen_vga_memory, false); |
546 | if (r == 0) { | 549 | if (r == 0) { |
@@ -554,6 +557,7 @@ void radeon_ttm_fini(struct radeon_device *rdev) | |||
554 | ttm_bo_device_release(&rdev->mman.bdev); | 557 | ttm_bo_device_release(&rdev->mman.bdev); |
555 | radeon_gart_fini(rdev); | 558 | radeon_gart_fini(rdev); |
556 | radeon_ttm_global_fini(rdev); | 559 | radeon_ttm_global_fini(rdev); |
560 | rdev->mman.initialized = false; | ||
557 | DRM_INFO("radeon: ttm finalized\n"); | 561 | DRM_INFO("radeon: ttm finalized\n"); |
558 | } | 562 | } |
559 | 563 | ||
diff --git a/drivers/gpu/drm/radeon/reg_srcs/r420 b/drivers/gpu/drm/radeon/reg_srcs/r420 new file mode 100644 index 000000000000..989f7a020832 --- /dev/null +++ b/drivers/gpu/drm/radeon/reg_srcs/r420 | |||
@@ -0,0 +1,795 @@ | |||
1 | r420 0x4f60 | ||
2 | 0x1434 SRC_Y_X | ||
3 | 0x1438 DST_Y_X | ||
4 | 0x143C DST_HEIGHT_WIDTH | ||
5 | 0x146C DP_GUI_MASTER_CNTL | ||
6 | 0x1474 BRUSH_Y_X | ||
7 | 0x1478 DP_BRUSH_BKGD_CLR | ||
8 | 0x147C DP_BRUSH_FRGD_CLR | ||
9 | 0x1480 BRUSH_DATA0 | ||
10 | 0x1484 BRUSH_DATA1 | ||
11 | 0x1598 DST_WIDTH_HEIGHT | ||
12 | 0x15C0 CLR_CMP_CNTL | ||
13 | 0x15C4 CLR_CMP_CLR_SRC | ||
14 | 0x15C8 CLR_CMP_CLR_DST | ||
15 | 0x15CC CLR_CMP_MSK | ||
16 | 0x15D8 DP_SRC_FRGD_CLR | ||
17 | 0x15DC DP_SRC_BKGD_CLR | ||
18 | 0x1600 DST_LINE_START | ||
19 | 0x1604 DST_LINE_END | ||
20 | 0x1608 DST_LINE_PATCOUNT | ||
21 | 0x16C0 DP_CNTL | ||
22 | 0x16CC DP_WRITE_MSK | ||
23 | 0x16D0 DP_CNTL_XDIR_YDIR_YMAJOR | ||
24 | 0x16E8 DEFAULT_SC_BOTTOM_RIGHT | ||
25 | 0x16EC SC_TOP_LEFT | ||
26 | 0x16F0 SC_BOTTOM_RIGHT | ||
27 | 0x16F4 SRC_SC_BOTTOM_RIGHT | ||
28 | 0x1714 DSTCACHE_CTLSTAT | ||
29 | 0x1720 WAIT_UNTIL | ||
30 | 0x172C RBBM_GUICNTL | ||
31 | 0x1D98 VAP_VPORT_XSCALE | ||
32 | 0x1D9C VAP_VPORT_XOFFSET | ||
33 | 0x1DA0 VAP_VPORT_YSCALE | ||
34 | 0x1DA4 VAP_VPORT_YOFFSET | ||
35 | 0x1DA8 VAP_VPORT_ZSCALE | ||
36 | 0x1DAC VAP_VPORT_ZOFFSET | ||
37 | 0x2080 VAP_CNTL | ||
38 | 0x2090 VAP_OUT_VTX_FMT_0 | ||
39 | 0x2094 VAP_OUT_VTX_FMT_1 | ||
40 | 0x20B0 VAP_VTE_CNTL | ||
41 | 0x2138 VAP_VF_MIN_VTX_INDX | ||
42 | 0x2140 VAP_CNTL_STATUS | ||
43 | 0x2150 VAP_PROG_STREAM_CNTL_0 | ||
44 | 0x2154 VAP_PROG_STREAM_CNTL_1 | ||
45 | 0x2158 VAP_PROG_STREAM_CNTL_2 | ||
46 | 0x215C VAP_PROG_STREAM_CNTL_3 | ||
47 | 0x2160 VAP_PROG_STREAM_CNTL_4 | ||
48 | 0x2164 VAP_PROG_STREAM_CNTL_5 | ||
49 | 0x2168 VAP_PROG_STREAM_CNTL_6 | ||
50 | 0x216C VAP_PROG_STREAM_CNTL_7 | ||
51 | 0x2180 VAP_VTX_STATE_CNTL | ||
52 | 0x2184 VAP_VSM_VTX_ASSM | ||
53 | 0x2188 VAP_VTX_STATE_IND_REG_0 | ||
54 | 0x218C VAP_VTX_STATE_IND_REG_1 | ||
55 | 0x2190 VAP_VTX_STATE_IND_REG_2 | ||
56 | 0x2194 VAP_VTX_STATE_IND_REG_3 | ||
57 | 0x2198 VAP_VTX_STATE_IND_REG_4 | ||
58 | 0x219C VAP_VTX_STATE_IND_REG_5 | ||
59 | 0x21A0 VAP_VTX_STATE_IND_REG_6 | ||
60 | 0x21A4 VAP_VTX_STATE_IND_REG_7 | ||
61 | 0x21A8 VAP_VTX_STATE_IND_REG_8 | ||
62 | 0x21AC VAP_VTX_STATE_IND_REG_9 | ||
63 | 0x21B0 VAP_VTX_STATE_IND_REG_10 | ||
64 | 0x21B4 VAP_VTX_STATE_IND_REG_11 | ||
65 | 0x21B8 VAP_VTX_STATE_IND_REG_12 | ||
66 | 0x21BC VAP_VTX_STATE_IND_REG_13 | ||
67 | 0x21C0 VAP_VTX_STATE_IND_REG_14 | ||
68 | 0x21C4 VAP_VTX_STATE_IND_REG_15 | ||
69 | 0x21DC VAP_PSC_SGN_NORM_CNTL | ||
70 | 0x21E0 VAP_PROG_STREAM_CNTL_EXT_0 | ||
71 | 0x21E4 VAP_PROG_STREAM_CNTL_EXT_1 | ||
72 | 0x21E8 VAP_PROG_STREAM_CNTL_EXT_2 | ||
73 | 0x21EC VAP_PROG_STREAM_CNTL_EXT_3 | ||
74 | 0x21F0 VAP_PROG_STREAM_CNTL_EXT_4 | ||
75 | 0x21F4 VAP_PROG_STREAM_CNTL_EXT_5 | ||
76 | 0x21F8 VAP_PROG_STREAM_CNTL_EXT_6 | ||
77 | 0x21FC VAP_PROG_STREAM_CNTL_EXT_7 | ||
78 | 0x2200 VAP_PVS_VECTOR_INDX_REG | ||
79 | 0x2204 VAP_PVS_VECTOR_DATA_REG | ||
80 | 0x2208 VAP_PVS_VECTOR_DATA_REG_128 | ||
81 | 0x221C VAP_CLIP_CNTL | ||
82 | 0x2220 VAP_GB_VERT_CLIP_ADJ | ||
83 | 0x2224 VAP_GB_VERT_DISC_ADJ | ||
84 | 0x2228 VAP_GB_HORZ_CLIP_ADJ | ||
85 | 0x222C VAP_GB_HORZ_DISC_ADJ | ||
86 | 0x2230 VAP_PVS_FLOW_CNTL_ADDRS_0 | ||
87 | 0x2234 VAP_PVS_FLOW_CNTL_ADDRS_1 | ||
88 | 0x2238 VAP_PVS_FLOW_CNTL_ADDRS_2 | ||
89 | 0x223C VAP_PVS_FLOW_CNTL_ADDRS_3 | ||
90 | 0x2240 VAP_PVS_FLOW_CNTL_ADDRS_4 | ||
91 | 0x2244 VAP_PVS_FLOW_CNTL_ADDRS_5 | ||
92 | 0x2248 VAP_PVS_FLOW_CNTL_ADDRS_6 | ||
93 | 0x224C VAP_PVS_FLOW_CNTL_ADDRS_7 | ||
94 | 0x2250 VAP_PVS_FLOW_CNTL_ADDRS_8 | ||
95 | 0x2254 VAP_PVS_FLOW_CNTL_ADDRS_9 | ||
96 | 0x2258 VAP_PVS_FLOW_CNTL_ADDRS_10 | ||
97 | 0x225C VAP_PVS_FLOW_CNTL_ADDRS_11 | ||
98 | 0x2260 VAP_PVS_FLOW_CNTL_ADDRS_12 | ||
99 | 0x2264 VAP_PVS_FLOW_CNTL_ADDRS_13 | ||
100 | 0x2268 VAP_PVS_FLOW_CNTL_ADDRS_14 | ||
101 | 0x226C VAP_PVS_FLOW_CNTL_ADDRS_15 | ||
102 | 0x2284 VAP_PVS_STATE_FLUSH_REG | ||
103 | 0x2288 VAP_PVS_VTX_TIMEOUT_REG | ||
104 | 0x2290 VAP_PVS_FLOW_CNTL_LOOP_INDEX_0 | ||
105 | 0x2294 VAP_PVS_FLOW_CNTL_LOOP_INDEX_1 | ||
106 | 0x2298 VAP_PVS_FLOW_CNTL_LOOP_INDEX_2 | ||
107 | 0x229C VAP_PVS_FLOW_CNTL_LOOP_INDEX_3 | ||
108 | 0x22A0 VAP_PVS_FLOW_CNTL_LOOP_INDEX_4 | ||
109 | 0x22A4 VAP_PVS_FLOW_CNTL_LOOP_INDEX_5 | ||
110 | 0x22A8 VAP_PVS_FLOW_CNTL_LOOP_INDEX_6 | ||
111 | 0x22AC VAP_PVS_FLOW_CNTL_LOOP_INDEX_7 | ||
112 | 0x22B0 VAP_PVS_FLOW_CNTL_LOOP_INDEX_8 | ||
113 | 0x22B4 VAP_PVS_FLOW_CNTL_LOOP_INDEX_9 | ||
114 | 0x22B8 VAP_PVS_FLOW_CNTL_LOOP_INDEX_10 | ||
115 | 0x22BC VAP_PVS_FLOW_CNTL_LOOP_INDEX_11 | ||
116 | 0x22C0 VAP_PVS_FLOW_CNTL_LOOP_INDEX_12 | ||
117 | 0x22C4 VAP_PVS_FLOW_CNTL_LOOP_INDEX_13 | ||
118 | 0x22C8 VAP_PVS_FLOW_CNTL_LOOP_INDEX_14 | ||
119 | 0x22CC VAP_PVS_FLOW_CNTL_LOOP_INDEX_15 | ||
120 | 0x22D0 VAP_PVS_CODE_CNTL_0 | ||
121 | 0x22D4 VAP_PVS_CONST_CNTL | ||
122 | 0x22D8 VAP_PVS_CODE_CNTL_1 | ||
123 | 0x22DC VAP_PVS_FLOW_CNTL_OPC | ||
124 | 0x342C RB2D_DSTCACHE_CTLSTAT | ||
125 | 0x4000 GB_VAP_RASTER_VTX_FMT_0 | ||
126 | 0x4004 GB_VAP_RASTER_VTX_FMT_1 | ||
127 | 0x4008 GB_ENABLE | ||
128 | 0x401C GB_SELECT | ||
129 | 0x4020 GB_AA_CONFIG | ||
130 | 0x4024 GB_FIFO_SIZE | ||
131 | 0x4100 TX_INVALTAGS | ||
132 | 0x4200 GA_POINT_S0 | ||
133 | 0x4204 GA_POINT_T0 | ||
134 | 0x4208 GA_POINT_S1 | ||
135 | 0x420C GA_POINT_T1 | ||
136 | 0x4214 GA_TRIANGLE_STIPPLE | ||
137 | 0x421C GA_POINT_SIZE | ||
138 | 0x4230 GA_POINT_MINMAX | ||
139 | 0x4234 GA_LINE_CNTL | ||
140 | 0x4238 GA_LINE_STIPPLE_CONFIG | ||
141 | 0x4260 GA_LINE_STIPPLE_VALUE | ||
142 | 0x4264 GA_LINE_S0 | ||
143 | 0x4268 GA_LINE_S1 | ||
144 | 0x4278 GA_COLOR_CONTROL | ||
145 | 0x427C GA_SOLID_RG | ||
146 | 0x4280 GA_SOLID_BA | ||
147 | 0x4288 GA_POLY_MODE | ||
148 | 0x428C GA_ROUND_MODE | ||
149 | 0x4290 GA_OFFSET | ||
150 | 0x4294 GA_FOG_SCALE | ||
151 | 0x4298 GA_FOG_OFFSET | ||
152 | 0x42A0 SU_TEX_WRAP | ||
153 | 0x42A4 SU_POLY_OFFSET_FRONT_SCALE | ||
154 | 0x42A8 SU_POLY_OFFSET_FRONT_OFFSET | ||
155 | 0x42AC SU_POLY_OFFSET_BACK_SCALE | ||
156 | 0x42B0 SU_POLY_OFFSET_BACK_OFFSET | ||
157 | 0x42B4 SU_POLY_OFFSET_ENABLE | ||
158 | 0x42B8 SU_CULL_MODE | ||
159 | 0x42C0 SU_DEPTH_SCALE | ||
160 | 0x42C4 SU_DEPTH_OFFSET | ||
161 | 0x42C8 SU_REG_DEST | ||
162 | 0x4300 RS_COUNT | ||
163 | 0x4304 RS_INST_COUNT | ||
164 | 0x4310 RS_IP_0 | ||
165 | 0x4314 RS_IP_1 | ||
166 | 0x4318 RS_IP_2 | ||
167 | 0x431C RS_IP_3 | ||
168 | 0x4320 RS_IP_4 | ||
169 | 0x4324 RS_IP_5 | ||
170 | 0x4328 RS_IP_6 | ||
171 | 0x432C RS_IP_7 | ||
172 | 0x4330 RS_INST_0 | ||
173 | 0x4334 RS_INST_1 | ||
174 | 0x4338 RS_INST_2 | ||
175 | 0x433C RS_INST_3 | ||
176 | 0x4340 RS_INST_4 | ||
177 | 0x4344 RS_INST_5 | ||
178 | 0x4348 RS_INST_6 | ||
179 | 0x434C RS_INST_7 | ||
180 | 0x4350 RS_INST_8 | ||
181 | 0x4354 RS_INST_9 | ||
182 | 0x4358 RS_INST_10 | ||
183 | 0x435C RS_INST_11 | ||
184 | 0x4360 RS_INST_12 | ||
185 | 0x4364 RS_INST_13 | ||
186 | 0x4368 RS_INST_14 | ||
187 | 0x436C RS_INST_15 | ||
188 | 0x43A4 SC_HYPERZ_EN | ||
189 | 0x43A8 SC_EDGERULE | ||
190 | 0x43B0 SC_CLIP_0_A | ||
191 | 0x43B4 SC_CLIP_0_B | ||
192 | 0x43B8 SC_CLIP_1_A | ||
193 | 0x43BC SC_CLIP_1_B | ||
194 | 0x43C0 SC_CLIP_2_A | ||
195 | 0x43C4 SC_CLIP_2_B | ||
196 | 0x43C8 SC_CLIP_3_A | ||
197 | 0x43CC SC_CLIP_3_B | ||
198 | 0x43D0 SC_CLIP_RULE | ||
199 | 0x43E0 SC_SCISSOR0 | ||
200 | 0x43E8 SC_SCREENDOOR | ||
201 | 0x4440 TX_FILTER1_0 | ||
202 | 0x4444 TX_FILTER1_1 | ||
203 | 0x4448 TX_FILTER1_2 | ||
204 | 0x444C TX_FILTER1_3 | ||
205 | 0x4450 TX_FILTER1_4 | ||
206 | 0x4454 TX_FILTER1_5 | ||
207 | 0x4458 TX_FILTER1_6 | ||
208 | 0x445C TX_FILTER1_7 | ||
209 | 0x4460 TX_FILTER1_8 | ||
210 | 0x4464 TX_FILTER1_9 | ||
211 | 0x4468 TX_FILTER1_10 | ||
212 | 0x446C TX_FILTER1_11 | ||
213 | 0x4470 TX_FILTER1_12 | ||
214 | 0x4474 TX_FILTER1_13 | ||
215 | 0x4478 TX_FILTER1_14 | ||
216 | 0x447C TX_FILTER1_15 | ||
217 | 0x4580 TX_CHROMA_KEY_0 | ||
218 | 0x4584 TX_CHROMA_KEY_1 | ||
219 | 0x4588 TX_CHROMA_KEY_2 | ||
220 | 0x458C TX_CHROMA_KEY_3 | ||
221 | 0x4590 TX_CHROMA_KEY_4 | ||
222 | 0x4594 TX_CHROMA_KEY_5 | ||
223 | 0x4598 TX_CHROMA_KEY_6 | ||
224 | 0x459C TX_CHROMA_KEY_7 | ||
225 | 0x45A0 TX_CHROMA_KEY_8 | ||
226 | 0x45A4 TX_CHROMA_KEY_9 | ||
227 | 0x45A8 TX_CHROMA_KEY_10 | ||
228 | 0x45AC TX_CHROMA_KEY_11 | ||
229 | 0x45B0 TX_CHROMA_KEY_12 | ||
230 | 0x45B4 TX_CHROMA_KEY_13 | ||
231 | 0x45B8 TX_CHROMA_KEY_14 | ||
232 | 0x45BC TX_CHROMA_KEY_15 | ||
233 | 0x45C0 TX_BORDER_COLOR_0 | ||
234 | 0x45C4 TX_BORDER_COLOR_1 | ||
235 | 0x45C8 TX_BORDER_COLOR_2 | ||
236 | 0x45CC TX_BORDER_COLOR_3 | ||
237 | 0x45D0 TX_BORDER_COLOR_4 | ||
238 | 0x45D4 TX_BORDER_COLOR_5 | ||
239 | 0x45D8 TX_BORDER_COLOR_6 | ||
240 | 0x45DC TX_BORDER_COLOR_7 | ||
241 | 0x45E0 TX_BORDER_COLOR_8 | ||
242 | 0x45E4 TX_BORDER_COLOR_9 | ||
243 | 0x45E8 TX_BORDER_COLOR_10 | ||
244 | 0x45EC TX_BORDER_COLOR_11 | ||
245 | 0x45F0 TX_BORDER_COLOR_12 | ||
246 | 0x45F4 TX_BORDER_COLOR_13 | ||
247 | 0x45F8 TX_BORDER_COLOR_14 | ||
248 | 0x45FC TX_BORDER_COLOR_15 | ||
249 | 0x4600 US_CONFIG | ||
250 | 0x4604 US_PIXSIZE | ||
251 | 0x4608 US_CODE_OFFSET | ||
252 | 0x460C US_RESET | ||
253 | 0x4610 US_CODE_ADDR_0 | ||
254 | 0x4614 US_CODE_ADDR_1 | ||
255 | 0x4618 US_CODE_ADDR_2 | ||
256 | 0x461C US_CODE_ADDR_3 | ||
257 | 0x4620 US_TEX_INST_0 | ||
258 | 0x4624 US_TEX_INST_1 | ||
259 | 0x4628 US_TEX_INST_2 | ||
260 | 0x462C US_TEX_INST_3 | ||
261 | 0x4630 US_TEX_INST_4 | ||
262 | 0x4634 US_TEX_INST_5 | ||
263 | 0x4638 US_TEX_INST_6 | ||
264 | 0x463C US_TEX_INST_7 | ||
265 | 0x4640 US_TEX_INST_8 | ||
266 | 0x4644 US_TEX_INST_9 | ||
267 | 0x4648 US_TEX_INST_10 | ||
268 | 0x464C US_TEX_INST_11 | ||
269 | 0x4650 US_TEX_INST_12 | ||
270 | 0x4654 US_TEX_INST_13 | ||
271 | 0x4658 US_TEX_INST_14 | ||
272 | 0x465C US_TEX_INST_15 | ||
273 | 0x4660 US_TEX_INST_16 | ||
274 | 0x4664 US_TEX_INST_17 | ||
275 | 0x4668 US_TEX_INST_18 | ||
276 | 0x466C US_TEX_INST_19 | ||
277 | 0x4670 US_TEX_INST_20 | ||
278 | 0x4674 US_TEX_INST_21 | ||
279 | 0x4678 US_TEX_INST_22 | ||
280 | 0x467C US_TEX_INST_23 | ||
281 | 0x4680 US_TEX_INST_24 | ||
282 | 0x4684 US_TEX_INST_25 | ||
283 | 0x4688 US_TEX_INST_26 | ||
284 | 0x468C US_TEX_INST_27 | ||
285 | 0x4690 US_TEX_INST_28 | ||
286 | 0x4694 US_TEX_INST_29 | ||
287 | 0x4698 US_TEX_INST_30 | ||
288 | 0x469C US_TEX_INST_31 | ||
289 | 0x46A4 US_OUT_FMT_0 | ||
290 | 0x46A8 US_OUT_FMT_1 | ||
291 | 0x46AC US_OUT_FMT_2 | ||
292 | 0x46B0 US_OUT_FMT_3 | ||
293 | 0x46B4 US_W_FMT | ||
294 | 0x46B8 US_CODE_BANK | ||
295 | 0x46BC US_CODE_EXT | ||
296 | 0x46C0 US_ALU_RGB_ADDR_0 | ||
297 | 0x46C4 US_ALU_RGB_ADDR_1 | ||
298 | 0x46C8 US_ALU_RGB_ADDR_2 | ||
299 | 0x46CC US_ALU_RGB_ADDR_3 | ||
300 | 0x46D0 US_ALU_RGB_ADDR_4 | ||
301 | 0x46D4 US_ALU_RGB_ADDR_5 | ||
302 | 0x46D8 US_ALU_RGB_ADDR_6 | ||
303 | 0x46DC US_ALU_RGB_ADDR_7 | ||
304 | 0x46E0 US_ALU_RGB_ADDR_8 | ||
305 | 0x46E4 US_ALU_RGB_ADDR_9 | ||
306 | 0x46E8 US_ALU_RGB_ADDR_10 | ||
307 | 0x46EC US_ALU_RGB_ADDR_11 | ||
308 | 0x46F0 US_ALU_RGB_ADDR_12 | ||
309 | 0x46F4 US_ALU_RGB_ADDR_13 | ||
310 | 0x46F8 US_ALU_RGB_ADDR_14 | ||
311 | 0x46FC US_ALU_RGB_ADDR_15 | ||
312 | 0x4700 US_ALU_RGB_ADDR_16 | ||
313 | 0x4704 US_ALU_RGB_ADDR_17 | ||
314 | 0x4708 US_ALU_RGB_ADDR_18 | ||
315 | 0x470C US_ALU_RGB_ADDR_19 | ||
316 | 0x4710 US_ALU_RGB_ADDR_20 | ||
317 | 0x4714 US_ALU_RGB_ADDR_21 | ||
318 | 0x4718 US_ALU_RGB_ADDR_22 | ||
319 | 0x471C US_ALU_RGB_ADDR_23 | ||
320 | 0x4720 US_ALU_RGB_ADDR_24 | ||
321 | 0x4724 US_ALU_RGB_ADDR_25 | ||
322 | 0x4728 US_ALU_RGB_ADDR_26 | ||
323 | 0x472C US_ALU_RGB_ADDR_27 | ||
324 | 0x4730 US_ALU_RGB_ADDR_28 | ||
325 | 0x4734 US_ALU_RGB_ADDR_29 | ||
326 | 0x4738 US_ALU_RGB_ADDR_30 | ||
327 | 0x473C US_ALU_RGB_ADDR_31 | ||
328 | 0x4740 US_ALU_RGB_ADDR_32 | ||
329 | 0x4744 US_ALU_RGB_ADDR_33 | ||
330 | 0x4748 US_ALU_RGB_ADDR_34 | ||
331 | 0x474C US_ALU_RGB_ADDR_35 | ||
332 | 0x4750 US_ALU_RGB_ADDR_36 | ||
333 | 0x4754 US_ALU_RGB_ADDR_37 | ||
334 | 0x4758 US_ALU_RGB_ADDR_38 | ||
335 | 0x475C US_ALU_RGB_ADDR_39 | ||
336 | 0x4760 US_ALU_RGB_ADDR_40 | ||
337 | 0x4764 US_ALU_RGB_ADDR_41 | ||
338 | 0x4768 US_ALU_RGB_ADDR_42 | ||
339 | 0x476C US_ALU_RGB_ADDR_43 | ||
340 | 0x4770 US_ALU_RGB_ADDR_44 | ||
341 | 0x4774 US_ALU_RGB_ADDR_45 | ||
342 | 0x4778 US_ALU_RGB_ADDR_46 | ||
343 | 0x477C US_ALU_RGB_ADDR_47 | ||
344 | 0x4780 US_ALU_RGB_ADDR_48 | ||
345 | 0x4784 US_ALU_RGB_ADDR_49 | ||
346 | 0x4788 US_ALU_RGB_ADDR_50 | ||
347 | 0x478C US_ALU_RGB_ADDR_51 | ||
348 | 0x4790 US_ALU_RGB_ADDR_52 | ||
349 | 0x4794 US_ALU_RGB_ADDR_53 | ||
350 | 0x4798 US_ALU_RGB_ADDR_54 | ||
351 | 0x479C US_ALU_RGB_ADDR_55 | ||
352 | 0x47A0 US_ALU_RGB_ADDR_56 | ||
353 | 0x47A4 US_ALU_RGB_ADDR_57 | ||
354 | 0x47A8 US_ALU_RGB_ADDR_58 | ||
355 | 0x47AC US_ALU_RGB_ADDR_59 | ||
356 | 0x47B0 US_ALU_RGB_ADDR_60 | ||
357 | 0x47B4 US_ALU_RGB_ADDR_61 | ||
358 | 0x47B8 US_ALU_RGB_ADDR_62 | ||
359 | 0x47BC US_ALU_RGB_ADDR_63 | ||
360 | 0x47C0 US_ALU_ALPHA_ADDR_0 | ||
361 | 0x47C4 US_ALU_ALPHA_ADDR_1 | ||
362 | 0x47C8 US_ALU_ALPHA_ADDR_2 | ||
363 | 0x47CC US_ALU_ALPHA_ADDR_3 | ||
364 | 0x47D0 US_ALU_ALPHA_ADDR_4 | ||
365 | 0x47D4 US_ALU_ALPHA_ADDR_5 | ||
366 | 0x47D8 US_ALU_ALPHA_ADDR_6 | ||
367 | 0x47DC US_ALU_ALPHA_ADDR_7 | ||
368 | 0x47E0 US_ALU_ALPHA_ADDR_8 | ||
369 | 0x47E4 US_ALU_ALPHA_ADDR_9 | ||
370 | 0x47E8 US_ALU_ALPHA_ADDR_10 | ||
371 | 0x47EC US_ALU_ALPHA_ADDR_11 | ||
372 | 0x47F0 US_ALU_ALPHA_ADDR_12 | ||
373 | 0x47F4 US_ALU_ALPHA_ADDR_13 | ||
374 | 0x47F8 US_ALU_ALPHA_ADDR_14 | ||
375 | 0x47FC US_ALU_ALPHA_ADDR_15 | ||
376 | 0x4800 US_ALU_ALPHA_ADDR_16 | ||
377 | 0x4804 US_ALU_ALPHA_ADDR_17 | ||
378 | 0x4808 US_ALU_ALPHA_ADDR_18 | ||
379 | 0x480C US_ALU_ALPHA_ADDR_19 | ||
380 | 0x4810 US_ALU_ALPHA_ADDR_20 | ||
381 | 0x4814 US_ALU_ALPHA_ADDR_21 | ||
382 | 0x4818 US_ALU_ALPHA_ADDR_22 | ||
383 | 0x481C US_ALU_ALPHA_ADDR_23 | ||
384 | 0x4820 US_ALU_ALPHA_ADDR_24 | ||
385 | 0x4824 US_ALU_ALPHA_ADDR_25 | ||
386 | 0x4828 US_ALU_ALPHA_ADDR_26 | ||
387 | 0x482C US_ALU_ALPHA_ADDR_27 | ||
388 | 0x4830 US_ALU_ALPHA_ADDR_28 | ||
389 | 0x4834 US_ALU_ALPHA_ADDR_29 | ||
390 | 0x4838 US_ALU_ALPHA_ADDR_30 | ||
391 | 0x483C US_ALU_ALPHA_ADDR_31 | ||
392 | 0x4840 US_ALU_ALPHA_ADDR_32 | ||
393 | 0x4844 US_ALU_ALPHA_ADDR_33 | ||
394 | 0x4848 US_ALU_ALPHA_ADDR_34 | ||
395 | 0x484C US_ALU_ALPHA_ADDR_35 | ||
396 | 0x4850 US_ALU_ALPHA_ADDR_36 | ||
397 | 0x4854 US_ALU_ALPHA_ADDR_37 | ||
398 | 0x4858 US_ALU_ALPHA_ADDR_38 | ||
399 | 0x485C US_ALU_ALPHA_ADDR_39 | ||
400 | 0x4860 US_ALU_ALPHA_ADDR_40 | ||
401 | 0x4864 US_ALU_ALPHA_ADDR_41 | ||
402 | 0x4868 US_ALU_ALPHA_ADDR_42 | ||
403 | 0x486C US_ALU_ALPHA_ADDR_43 | ||
404 | 0x4870 US_ALU_ALPHA_ADDR_44 | ||
405 | 0x4874 US_ALU_ALPHA_ADDR_45 | ||
406 | 0x4878 US_ALU_ALPHA_ADDR_46 | ||
407 | 0x487C US_ALU_ALPHA_ADDR_47 | ||
408 | 0x4880 US_ALU_ALPHA_ADDR_48 | ||
409 | 0x4884 US_ALU_ALPHA_ADDR_49 | ||
410 | 0x4888 US_ALU_ALPHA_ADDR_50 | ||
411 | 0x488C US_ALU_ALPHA_ADDR_51 | ||
412 | 0x4890 US_ALU_ALPHA_ADDR_52 | ||
413 | 0x4894 US_ALU_ALPHA_ADDR_53 | ||
414 | 0x4898 US_ALU_ALPHA_ADDR_54 | ||
415 | 0x489C US_ALU_ALPHA_ADDR_55 | ||
416 | 0x48A0 US_ALU_ALPHA_ADDR_56 | ||
417 | 0x48A4 US_ALU_ALPHA_ADDR_57 | ||
418 | 0x48A8 US_ALU_ALPHA_ADDR_58 | ||
419 | 0x48AC US_ALU_ALPHA_ADDR_59 | ||
420 | 0x48B0 US_ALU_ALPHA_ADDR_60 | ||
421 | 0x48B4 US_ALU_ALPHA_ADDR_61 | ||
422 | 0x48B8 US_ALU_ALPHA_ADDR_62 | ||
423 | 0x48BC US_ALU_ALPHA_ADDR_63 | ||
424 | 0x48C0 US_ALU_RGB_INST_0 | ||
425 | 0x48C4 US_ALU_RGB_INST_1 | ||
426 | 0x48C8 US_ALU_RGB_INST_2 | ||
427 | 0x48CC US_ALU_RGB_INST_3 | ||
428 | 0x48D0 US_ALU_RGB_INST_4 | ||
429 | 0x48D4 US_ALU_RGB_INST_5 | ||
430 | 0x48D8 US_ALU_RGB_INST_6 | ||
431 | 0x48DC US_ALU_RGB_INST_7 | ||
432 | 0x48E0 US_ALU_RGB_INST_8 | ||
433 | 0x48E4 US_ALU_RGB_INST_9 | ||
434 | 0x48E8 US_ALU_RGB_INST_10 | ||
435 | 0x48EC US_ALU_RGB_INST_11 | ||
436 | 0x48F0 US_ALU_RGB_INST_12 | ||
437 | 0x48F4 US_ALU_RGB_INST_13 | ||
438 | 0x48F8 US_ALU_RGB_INST_14 | ||
439 | 0x48FC US_ALU_RGB_INST_15 | ||
440 | 0x4900 US_ALU_RGB_INST_16 | ||
441 | 0x4904 US_ALU_RGB_INST_17 | ||
442 | 0x4908 US_ALU_RGB_INST_18 | ||
443 | 0x490C US_ALU_RGB_INST_19 | ||
444 | 0x4910 US_ALU_RGB_INST_20 | ||
445 | 0x4914 US_ALU_RGB_INST_21 | ||
446 | 0x4918 US_ALU_RGB_INST_22 | ||
447 | 0x491C US_ALU_RGB_INST_23 | ||
448 | 0x4920 US_ALU_RGB_INST_24 | ||
449 | 0x4924 US_ALU_RGB_INST_25 | ||
450 | 0x4928 US_ALU_RGB_INST_26 | ||
451 | 0x492C US_ALU_RGB_INST_27 | ||
452 | 0x4930 US_ALU_RGB_INST_28 | ||
453 | 0x4934 US_ALU_RGB_INST_29 | ||
454 | 0x4938 US_ALU_RGB_INST_30 | ||
455 | 0x493C US_ALU_RGB_INST_31 | ||
456 | 0x4940 US_ALU_RGB_INST_32 | ||
457 | 0x4944 US_ALU_RGB_INST_33 | ||
458 | 0x4948 US_ALU_RGB_INST_34 | ||
459 | 0x494C US_ALU_RGB_INST_35 | ||
460 | 0x4950 US_ALU_RGB_INST_36 | ||
461 | 0x4954 US_ALU_RGB_INST_37 | ||
462 | 0x4958 US_ALU_RGB_INST_38 | ||
463 | 0x495C US_ALU_RGB_INST_39 | ||
464 | 0x4960 US_ALU_RGB_INST_40 | ||
465 | 0x4964 US_ALU_RGB_INST_41 | ||
466 | 0x4968 US_ALU_RGB_INST_42 | ||
467 | 0x496C US_ALU_RGB_INST_43 | ||
468 | 0x4970 US_ALU_RGB_INST_44 | ||
469 | 0x4974 US_ALU_RGB_INST_45 | ||
470 | 0x4978 US_ALU_RGB_INST_46 | ||
471 | 0x497C US_ALU_RGB_INST_47 | ||
472 | 0x4980 US_ALU_RGB_INST_48 | ||
473 | 0x4984 US_ALU_RGB_INST_49 | ||
474 | 0x4988 US_ALU_RGB_INST_50 | ||
475 | 0x498C US_ALU_RGB_INST_51 | ||
476 | 0x4990 US_ALU_RGB_INST_52 | ||
477 | 0x4994 US_ALU_RGB_INST_53 | ||
478 | 0x4998 US_ALU_RGB_INST_54 | ||
479 | 0x499C US_ALU_RGB_INST_55 | ||
480 | 0x49A0 US_ALU_RGB_INST_56 | ||
481 | 0x49A4 US_ALU_RGB_INST_57 | ||
482 | 0x49A8 US_ALU_RGB_INST_58 | ||
483 | 0x49AC US_ALU_RGB_INST_59 | ||
484 | 0x49B0 US_ALU_RGB_INST_60 | ||
485 | 0x49B4 US_ALU_RGB_INST_61 | ||
486 | 0x49B8 US_ALU_RGB_INST_62 | ||
487 | 0x49BC US_ALU_RGB_INST_63 | ||
488 | 0x49C0 US_ALU_ALPHA_INST_0 | ||
489 | 0x49C4 US_ALU_ALPHA_INST_1 | ||
490 | 0x49C8 US_ALU_ALPHA_INST_2 | ||
491 | 0x49CC US_ALU_ALPHA_INST_3 | ||
492 | 0x49D0 US_ALU_ALPHA_INST_4 | ||
493 | 0x49D4 US_ALU_ALPHA_INST_5 | ||
494 | 0x49D8 US_ALU_ALPHA_INST_6 | ||
495 | 0x49DC US_ALU_ALPHA_INST_7 | ||
496 | 0x49E0 US_ALU_ALPHA_INST_8 | ||
497 | 0x49E4 US_ALU_ALPHA_INST_9 | ||
498 | 0x49E8 US_ALU_ALPHA_INST_10 | ||
499 | 0x49EC US_ALU_ALPHA_INST_11 | ||
500 | 0x49F0 US_ALU_ALPHA_INST_12 | ||
501 | 0x49F4 US_ALU_ALPHA_INST_13 | ||
502 | 0x49F8 US_ALU_ALPHA_INST_14 | ||
503 | 0x49FC US_ALU_ALPHA_INST_15 | ||
504 | 0x4A00 US_ALU_ALPHA_INST_16 | ||
505 | 0x4A04 US_ALU_ALPHA_INST_17 | ||
506 | 0x4A08 US_ALU_ALPHA_INST_18 | ||
507 | 0x4A0C US_ALU_ALPHA_INST_19 | ||
508 | 0x4A10 US_ALU_ALPHA_INST_20 | ||
509 | 0x4A14 US_ALU_ALPHA_INST_21 | ||
510 | 0x4A18 US_ALU_ALPHA_INST_22 | ||
511 | 0x4A1C US_ALU_ALPHA_INST_23 | ||
512 | 0x4A20 US_ALU_ALPHA_INST_24 | ||
513 | 0x4A24 US_ALU_ALPHA_INST_25 | ||
514 | 0x4A28 US_ALU_ALPHA_INST_26 | ||
515 | 0x4A2C US_ALU_ALPHA_INST_27 | ||
516 | 0x4A30 US_ALU_ALPHA_INST_28 | ||
517 | 0x4A34 US_ALU_ALPHA_INST_29 | ||
518 | 0x4A38 US_ALU_ALPHA_INST_30 | ||
519 | 0x4A3C US_ALU_ALPHA_INST_31 | ||
520 | 0x4A40 US_ALU_ALPHA_INST_32 | ||
521 | 0x4A44 US_ALU_ALPHA_INST_33 | ||
522 | 0x4A48 US_ALU_ALPHA_INST_34 | ||
523 | 0x4A4C US_ALU_ALPHA_INST_35 | ||
524 | 0x4A50 US_ALU_ALPHA_INST_36 | ||
525 | 0x4A54 US_ALU_ALPHA_INST_37 | ||
526 | 0x4A58 US_ALU_ALPHA_INST_38 | ||
527 | 0x4A5C US_ALU_ALPHA_INST_39 | ||
528 | 0x4A60 US_ALU_ALPHA_INST_40 | ||
529 | 0x4A64 US_ALU_ALPHA_INST_41 | ||
530 | 0x4A68 US_ALU_ALPHA_INST_42 | ||
531 | 0x4A6C US_ALU_ALPHA_INST_43 | ||
532 | 0x4A70 US_ALU_ALPHA_INST_44 | ||
533 | 0x4A74 US_ALU_ALPHA_INST_45 | ||
534 | 0x4A78 US_ALU_ALPHA_INST_46 | ||
535 | 0x4A7C US_ALU_ALPHA_INST_47 | ||
536 | 0x4A80 US_ALU_ALPHA_INST_48 | ||
537 | 0x4A84 US_ALU_ALPHA_INST_49 | ||
538 | 0x4A88 US_ALU_ALPHA_INST_50 | ||
539 | 0x4A8C US_ALU_ALPHA_INST_51 | ||
540 | 0x4A90 US_ALU_ALPHA_INST_52 | ||
541 | 0x4A94 US_ALU_ALPHA_INST_53 | ||
542 | 0x4A98 US_ALU_ALPHA_INST_54 | ||
543 | 0x4A9C US_ALU_ALPHA_INST_55 | ||
544 | 0x4AA0 US_ALU_ALPHA_INST_56 | ||
545 | 0x4AA4 US_ALU_ALPHA_INST_57 | ||
546 | 0x4AA8 US_ALU_ALPHA_INST_58 | ||
547 | 0x4AAC US_ALU_ALPHA_INST_59 | ||
548 | 0x4AB0 US_ALU_ALPHA_INST_60 | ||
549 | 0x4AB4 US_ALU_ALPHA_INST_61 | ||
550 | 0x4AB8 US_ALU_ALPHA_INST_62 | ||
551 | 0x4ABC US_ALU_ALPHA_INST_63 | ||
552 | 0x4AC0 US_ALU_EXT_ADDR_0 | ||
553 | 0x4AC4 US_ALU_EXT_ADDR_1 | ||
554 | 0x4AC8 US_ALU_EXT_ADDR_2 | ||
555 | 0x4ACC US_ALU_EXT_ADDR_3 | ||
556 | 0x4AD0 US_ALU_EXT_ADDR_4 | ||
557 | 0x4AD4 US_ALU_EXT_ADDR_5 | ||
558 | 0x4AD8 US_ALU_EXT_ADDR_6 | ||
559 | 0x4ADC US_ALU_EXT_ADDR_7 | ||
560 | 0x4AE0 US_ALU_EXT_ADDR_8 | ||
561 | 0x4AE4 US_ALU_EXT_ADDR_9 | ||
562 | 0x4AE8 US_ALU_EXT_ADDR_10 | ||
563 | 0x4AEC US_ALU_EXT_ADDR_11 | ||
564 | 0x4AF0 US_ALU_EXT_ADDR_12 | ||
565 | 0x4AF4 US_ALU_EXT_ADDR_13 | ||
566 | 0x4AF8 US_ALU_EXT_ADDR_14 | ||
567 | 0x4AFC US_ALU_EXT_ADDR_15 | ||
568 | 0x4B00 US_ALU_EXT_ADDR_16 | ||
569 | 0x4B04 US_ALU_EXT_ADDR_17 | ||
570 | 0x4B08 US_ALU_EXT_ADDR_18 | ||
571 | 0x4B0C US_ALU_EXT_ADDR_19 | ||
572 | 0x4B10 US_ALU_EXT_ADDR_20 | ||
573 | 0x4B14 US_ALU_EXT_ADDR_21 | ||
574 | 0x4B18 US_ALU_EXT_ADDR_22 | ||
575 | 0x4B1C US_ALU_EXT_ADDR_23 | ||
576 | 0x4B20 US_ALU_EXT_ADDR_24 | ||
577 | 0x4B24 US_ALU_EXT_ADDR_25 | ||
578 | 0x4B28 US_ALU_EXT_ADDR_26 | ||
579 | 0x4B2C US_ALU_EXT_ADDR_27 | ||
580 | 0x4B30 US_ALU_EXT_ADDR_28 | ||
581 | 0x4B34 US_ALU_EXT_ADDR_29 | ||
582 | 0x4B38 US_ALU_EXT_ADDR_30 | ||
583 | 0x4B3C US_ALU_EXT_ADDR_31 | ||
584 | 0x4B40 US_ALU_EXT_ADDR_32 | ||
585 | 0x4B44 US_ALU_EXT_ADDR_33 | ||
586 | 0x4B48 US_ALU_EXT_ADDR_34 | ||
587 | 0x4B4C US_ALU_EXT_ADDR_35 | ||
588 | 0x4B50 US_ALU_EXT_ADDR_36 | ||
589 | 0x4B54 US_ALU_EXT_ADDR_37 | ||
590 | 0x4B58 US_ALU_EXT_ADDR_38 | ||
591 | 0x4B5C US_ALU_EXT_ADDR_39 | ||
592 | 0x4B60 US_ALU_EXT_ADDR_40 | ||
593 | 0x4B64 US_ALU_EXT_ADDR_41 | ||
594 | 0x4B68 US_ALU_EXT_ADDR_42 | ||
595 | 0x4B6C US_ALU_EXT_ADDR_43 | ||
596 | 0x4B70 US_ALU_EXT_ADDR_44 | ||
597 | 0x4B74 US_ALU_EXT_ADDR_45 | ||
598 | 0x4B78 US_ALU_EXT_ADDR_46 | ||
599 | 0x4B7C US_ALU_EXT_ADDR_47 | ||
600 | 0x4B80 US_ALU_EXT_ADDR_48 | ||
601 | 0x4B84 US_ALU_EXT_ADDR_49 | ||
602 | 0x4B88 US_ALU_EXT_ADDR_50 | ||
603 | 0x4B8C US_ALU_EXT_ADDR_51 | ||
604 | 0x4B90 US_ALU_EXT_ADDR_52 | ||
605 | 0x4B94 US_ALU_EXT_ADDR_53 | ||
606 | 0x4B98 US_ALU_EXT_ADDR_54 | ||
607 | 0x4B9C US_ALU_EXT_ADDR_55 | ||
608 | 0x4BA0 US_ALU_EXT_ADDR_56 | ||
609 | 0x4BA4 US_ALU_EXT_ADDR_57 | ||
610 | 0x4BA8 US_ALU_EXT_ADDR_58 | ||
611 | 0x4BAC US_ALU_EXT_ADDR_59 | ||
612 | 0x4BB0 US_ALU_EXT_ADDR_60 | ||
613 | 0x4BB4 US_ALU_EXT_ADDR_61 | ||
614 | 0x4BB8 US_ALU_EXT_ADDR_62 | ||
615 | 0x4BBC US_ALU_EXT_ADDR_63 | ||
616 | 0x4BC0 FG_FOG_BLEND | ||
617 | 0x4BC4 FG_FOG_FACTOR | ||
618 | 0x4BC8 FG_FOG_COLOR_R | ||
619 | 0x4BCC FG_FOG_COLOR_G | ||
620 | 0x4BD0 FG_FOG_COLOR_B | ||
621 | 0x4BD4 FG_ALPHA_FUNC | ||
622 | 0x4BD8 FG_DEPTH_SRC | ||
623 | 0x4C00 US_ALU_CONST_R_0 | ||
624 | 0x4C04 US_ALU_CONST_G_0 | ||
625 | 0x4C08 US_ALU_CONST_B_0 | ||
626 | 0x4C0C US_ALU_CONST_A_0 | ||
627 | 0x4C10 US_ALU_CONST_R_1 | ||
628 | 0x4C14 US_ALU_CONST_G_1 | ||
629 | 0x4C18 US_ALU_CONST_B_1 | ||
630 | 0x4C1C US_ALU_CONST_A_1 | ||
631 | 0x4C20 US_ALU_CONST_R_2 | ||
632 | 0x4C24 US_ALU_CONST_G_2 | ||
633 | 0x4C28 US_ALU_CONST_B_2 | ||
634 | 0x4C2C US_ALU_CONST_A_2 | ||
635 | 0x4C30 US_ALU_CONST_R_3 | ||
636 | 0x4C34 US_ALU_CONST_G_3 | ||
637 | 0x4C38 US_ALU_CONST_B_3 | ||
638 | 0x4C3C US_ALU_CONST_A_3 | ||
639 | 0x4C40 US_ALU_CONST_R_4 | ||
640 | 0x4C44 US_ALU_CONST_G_4 | ||
641 | 0x4C48 US_ALU_CONST_B_4 | ||
642 | 0x4C4C US_ALU_CONST_A_4 | ||
643 | 0x4C50 US_ALU_CONST_R_5 | ||
644 | 0x4C54 US_ALU_CONST_G_5 | ||
645 | 0x4C58 US_ALU_CONST_B_5 | ||
646 | 0x4C5C US_ALU_CONST_A_5 | ||
647 | 0x4C60 US_ALU_CONST_R_6 | ||
648 | 0x4C64 US_ALU_CONST_G_6 | ||
649 | 0x4C68 US_ALU_CONST_B_6 | ||
650 | 0x4C6C US_ALU_CONST_A_6 | ||
651 | 0x4C70 US_ALU_CONST_R_7 | ||
652 | 0x4C74 US_ALU_CONST_G_7 | ||
653 | 0x4C78 US_ALU_CONST_B_7 | ||
654 | 0x4C7C US_ALU_CONST_A_7 | ||
655 | 0x4C80 US_ALU_CONST_R_8 | ||
656 | 0x4C84 US_ALU_CONST_G_8 | ||
657 | 0x4C88 US_ALU_CONST_B_8 | ||
658 | 0x4C8C US_ALU_CONST_A_8 | ||
659 | 0x4C90 US_ALU_CONST_R_9 | ||
660 | 0x4C94 US_ALU_CONST_G_9 | ||
661 | 0x4C98 US_ALU_CONST_B_9 | ||
662 | 0x4C9C US_ALU_CONST_A_9 | ||
663 | 0x4CA0 US_ALU_CONST_R_10 | ||
664 | 0x4CA4 US_ALU_CONST_G_10 | ||
665 | 0x4CA8 US_ALU_CONST_B_10 | ||
666 | 0x4CAC US_ALU_CONST_A_10 | ||
667 | 0x4CB0 US_ALU_CONST_R_11 | ||
668 | 0x4CB4 US_ALU_CONST_G_11 | ||
669 | 0x4CB8 US_ALU_CONST_B_11 | ||
670 | 0x4CBC US_ALU_CONST_A_11 | ||
671 | 0x4CC0 US_ALU_CONST_R_12 | ||
672 | 0x4CC4 US_ALU_CONST_G_12 | ||
673 | 0x4CC8 US_ALU_CONST_B_12 | ||
674 | 0x4CCC US_ALU_CONST_A_12 | ||
675 | 0x4CD0 US_ALU_CONST_R_13 | ||
676 | 0x4CD4 US_ALU_CONST_G_13 | ||
677 | 0x4CD8 US_ALU_CONST_B_13 | ||
678 | 0x4CDC US_ALU_CONST_A_13 | ||
679 | 0x4CE0 US_ALU_CONST_R_14 | ||
680 | 0x4CE4 US_ALU_CONST_G_14 | ||
681 | 0x4CE8 US_ALU_CONST_B_14 | ||
682 | 0x4CEC US_ALU_CONST_A_14 | ||
683 | 0x4CF0 US_ALU_CONST_R_15 | ||
684 | 0x4CF4 US_ALU_CONST_G_15 | ||
685 | 0x4CF8 US_ALU_CONST_B_15 | ||
686 | 0x4CFC US_ALU_CONST_A_15 | ||
687 | 0x4D00 US_ALU_CONST_R_16 | ||
688 | 0x4D04 US_ALU_CONST_G_16 | ||
689 | 0x4D08 US_ALU_CONST_B_16 | ||
690 | 0x4D0C US_ALU_CONST_A_16 | ||
691 | 0x4D10 US_ALU_CONST_R_17 | ||
692 | 0x4D14 US_ALU_CONST_G_17 | ||
693 | 0x4D18 US_ALU_CONST_B_17 | ||
694 | 0x4D1C US_ALU_CONST_A_17 | ||
695 | 0x4D20 US_ALU_CONST_R_18 | ||
696 | 0x4D24 US_ALU_CONST_G_18 | ||
697 | 0x4D28 US_ALU_CONST_B_18 | ||
698 | 0x4D2C US_ALU_CONST_A_18 | ||
699 | 0x4D30 US_ALU_CONST_R_19 | ||
700 | 0x4D34 US_ALU_CONST_G_19 | ||
701 | 0x4D38 US_ALU_CONST_B_19 | ||
702 | 0x4D3C US_ALU_CONST_A_19 | ||
703 | 0x4D40 US_ALU_CONST_R_20 | ||
704 | 0x4D44 US_ALU_CONST_G_20 | ||
705 | 0x4D48 US_ALU_CONST_B_20 | ||
706 | 0x4D4C US_ALU_CONST_A_20 | ||
707 | 0x4D50 US_ALU_CONST_R_21 | ||
708 | 0x4D54 US_ALU_CONST_G_21 | ||
709 | 0x4D58 US_ALU_CONST_B_21 | ||
710 | 0x4D5C US_ALU_CONST_A_21 | ||
711 | 0x4D60 US_ALU_CONST_R_22 | ||
712 | 0x4D64 US_ALU_CONST_G_22 | ||
713 | 0x4D68 US_ALU_CONST_B_22 | ||
714 | 0x4D6C US_ALU_CONST_A_22 | ||
715 | 0x4D70 US_ALU_CONST_R_23 | ||
716 | 0x4D74 US_ALU_CONST_G_23 | ||
717 | 0x4D78 US_ALU_CONST_B_23 | ||
718 | 0x4D7C US_ALU_CONST_A_23 | ||
719 | 0x4D80 US_ALU_CONST_R_24 | ||
720 | 0x4D84 US_ALU_CONST_G_24 | ||
721 | 0x4D88 US_ALU_CONST_B_24 | ||
722 | 0x4D8C US_ALU_CONST_A_24 | ||
723 | 0x4D90 US_ALU_CONST_R_25 | ||
724 | 0x4D94 US_ALU_CONST_G_25 | ||
725 | 0x4D98 US_ALU_CONST_B_25 | ||
726 | 0x4D9C US_ALU_CONST_A_25 | ||
727 | 0x4DA0 US_ALU_CONST_R_26 | ||
728 | 0x4DA4 US_ALU_CONST_G_26 | ||
729 | 0x4DA8 US_ALU_CONST_B_26 | ||
730 | 0x4DAC US_ALU_CONST_A_26 | ||
731 | 0x4DB0 US_ALU_CONST_R_27 | ||
732 | 0x4DB4 US_ALU_CONST_G_27 | ||
733 | 0x4DB8 US_ALU_CONST_B_27 | ||
734 | 0x4DBC US_ALU_CONST_A_27 | ||
735 | 0x4DC0 US_ALU_CONST_R_28 | ||
736 | 0x4DC4 US_ALU_CONST_G_28 | ||
737 | 0x4DC8 US_ALU_CONST_B_28 | ||
738 | 0x4DCC US_ALU_CONST_A_28 | ||
739 | 0x4DD0 US_ALU_CONST_R_29 | ||
740 | 0x4DD4 US_ALU_CONST_G_29 | ||
741 | 0x4DD8 US_ALU_CONST_B_29 | ||
742 | 0x4DDC US_ALU_CONST_A_29 | ||
743 | 0x4DE0 US_ALU_CONST_R_30 | ||
744 | 0x4DE4 US_ALU_CONST_G_30 | ||
745 | 0x4DE8 US_ALU_CONST_B_30 | ||
746 | 0x4DEC US_ALU_CONST_A_30 | ||
747 | 0x4DF0 US_ALU_CONST_R_31 | ||
748 | 0x4DF4 US_ALU_CONST_G_31 | ||
749 | 0x4DF8 US_ALU_CONST_B_31 | ||
750 | 0x4DFC US_ALU_CONST_A_31 | ||
751 | 0x4E04 RB3D_BLENDCNTL_R3 | ||
752 | 0x4E08 RB3D_ABLENDCNTL_R3 | ||
753 | 0x4E0C RB3D_COLOR_CHANNEL_MASK | ||
754 | 0x4E10 RB3D_CONSTANT_COLOR | ||
755 | 0x4E14 RB3D_COLOR_CLEAR_VALUE | ||
756 | 0x4E18 RB3D_ROPCNTL_R3 | ||
757 | 0x4E1C RB3D_CLRCMP_FLIPE_R3 | ||
758 | 0x4E20 RB3D_CLRCMP_CLR_R3 | ||
759 | 0x4E24 RB3D_CLRCMP_MSK_R3 | ||
760 | 0x4E48 RB3D_DEBUG_CTL | ||
761 | 0x4E4C RB3D_DSTCACHE_CTLSTAT_R3 | ||
762 | 0x4E50 RB3D_DITHER_CTL | ||
763 | 0x4E54 RB3D_CMASK_OFFSET0 | ||
764 | 0x4E58 RB3D_CMASK_OFFSET1 | ||
765 | 0x4E5C RB3D_CMASK_OFFSET2 | ||
766 | 0x4E60 RB3D_CMASK_OFFSET3 | ||
767 | 0x4E64 RB3D_CMASK_PITCH0 | ||
768 | 0x4E68 RB3D_CMASK_PITCH1 | ||
769 | 0x4E6C RB3D_CMASK_PITCH2 | ||
770 | 0x4E70 RB3D_CMASK_PITCH3 | ||
771 | 0x4E74 RB3D_CMASK_WRINDEX | ||
772 | 0x4E78 RB3D_CMASK_DWORD | ||
773 | 0x4E7C RB3D_CMASK_RDINDEX | ||
774 | 0x4E80 RB3D_AARESOLVE_OFFSET | ||
775 | 0x4E84 RB3D_AARESOLVE_PITCH | ||
776 | 0x4E88 RB3D_AARESOLVE_CTL | ||
777 | 0x4EA0 RB3D_DISCARD_SRC_PIXEL_LTE_THRESHOLD | ||
778 | 0x4EA4 RB3D_DISCARD_SRC_PIXEL_GTE_THRESHOLD | ||
779 | 0x4F04 ZB_ZSTENCILCNTL | ||
780 | 0x4F08 ZB_STENCILREFMASK | ||
781 | 0x4F14 ZB_ZTOP | ||
782 | 0x4F18 ZB_ZCACHE_CTLSTAT | ||
783 | 0x4F1C ZB_BW_CNTL | ||
784 | 0x4F28 ZB_DEPTHCLEARVALUE | ||
785 | 0x4F30 ZB_ZMASK_OFFSET | ||
786 | 0x4F34 ZB_ZMASK_PITCH | ||
787 | 0x4F38 ZB_ZMASK_WRINDEX | ||
788 | 0x4F3C ZB_ZMASK_DWORD | ||
789 | 0x4F40 ZB_ZMASK_RDINDEX | ||
790 | 0x4F44 ZB_HIZ_OFFSET | ||
791 | 0x4F48 ZB_HIZ_WRINDEX | ||
792 | 0x4F4C ZB_HIZ_DWORD | ||
793 | 0x4F50 ZB_HIZ_RDINDEX | ||
794 | 0x4F54 ZB_HIZ_PITCH | ||
795 | 0x4F58 ZB_ZPASS_DATA | ||
diff --git a/drivers/gpu/drm/radeon/reg_srcs/rs600 b/drivers/gpu/drm/radeon/reg_srcs/rs600 index 8e3c0b807add..6801b865d1c4 100644 --- a/drivers/gpu/drm/radeon/reg_srcs/rs600 +++ b/drivers/gpu/drm/radeon/reg_srcs/rs600 | |||
@@ -153,7 +153,7 @@ rs600 0x6d40 | |||
153 | 0x42A4 SU_POLY_OFFSET_FRONT_SCALE | 153 | 0x42A4 SU_POLY_OFFSET_FRONT_SCALE |
154 | 0x42A8 SU_POLY_OFFSET_FRONT_OFFSET | 154 | 0x42A8 SU_POLY_OFFSET_FRONT_OFFSET |
155 | 0x42AC SU_POLY_OFFSET_BACK_SCALE | 155 | 0x42AC SU_POLY_OFFSET_BACK_SCALE |
156 | 0x42B0 SU_POLY_OFFSET_BACK_OFFSET | 156 | 0x42B0 SU_POLY_OFFSET_BACK_OFFSET |
157 | 0x42B4 SU_POLY_OFFSET_ENABLE | 157 | 0x42B4 SU_POLY_OFFSET_ENABLE |
158 | 0x42B8 SU_CULL_MODE | 158 | 0x42B8 SU_CULL_MODE |
159 | 0x42C0 SU_DEPTH_SCALE | 159 | 0x42C0 SU_DEPTH_SCALE |
@@ -291,6 +291,8 @@ rs600 0x6d40 | |||
291 | 0x46AC US_OUT_FMT_2 | 291 | 0x46AC US_OUT_FMT_2 |
292 | 0x46B0 US_OUT_FMT_3 | 292 | 0x46B0 US_OUT_FMT_3 |
293 | 0x46B4 US_W_FMT | 293 | 0x46B4 US_W_FMT |
294 | 0x46B8 US_CODE_BANK | ||
295 | 0x46BC US_CODE_EXT | ||
294 | 0x46C0 US_ALU_RGB_ADDR_0 | 296 | 0x46C0 US_ALU_RGB_ADDR_0 |
295 | 0x46C4 US_ALU_RGB_ADDR_1 | 297 | 0x46C4 US_ALU_RGB_ADDR_1 |
296 | 0x46C8 US_ALU_RGB_ADDR_2 | 298 | 0x46C8 US_ALU_RGB_ADDR_2 |
@@ -547,6 +549,70 @@ rs600 0x6d40 | |||
547 | 0x4AB4 US_ALU_ALPHA_INST_61 | 549 | 0x4AB4 US_ALU_ALPHA_INST_61 |
548 | 0x4AB8 US_ALU_ALPHA_INST_62 | 550 | 0x4AB8 US_ALU_ALPHA_INST_62 |
549 | 0x4ABC US_ALU_ALPHA_INST_63 | 551 | 0x4ABC US_ALU_ALPHA_INST_63 |
552 | 0x4AC0 US_ALU_EXT_ADDR_0 | ||
553 | 0x4AC4 US_ALU_EXT_ADDR_1 | ||
554 | 0x4AC8 US_ALU_EXT_ADDR_2 | ||
555 | 0x4ACC US_ALU_EXT_ADDR_3 | ||
556 | 0x4AD0 US_ALU_EXT_ADDR_4 | ||
557 | 0x4AD4 US_ALU_EXT_ADDR_5 | ||
558 | 0x4AD8 US_ALU_EXT_ADDR_6 | ||
559 | 0x4ADC US_ALU_EXT_ADDR_7 | ||
560 | 0x4AE0 US_ALU_EXT_ADDR_8 | ||
561 | 0x4AE4 US_ALU_EXT_ADDR_9 | ||
562 | 0x4AE8 US_ALU_EXT_ADDR_10 | ||
563 | 0x4AEC US_ALU_EXT_ADDR_11 | ||
564 | 0x4AF0 US_ALU_EXT_ADDR_12 | ||
565 | 0x4AF4 US_ALU_EXT_ADDR_13 | ||
566 | 0x4AF8 US_ALU_EXT_ADDR_14 | ||
567 | 0x4AFC US_ALU_EXT_ADDR_15 | ||
568 | 0x4B00 US_ALU_EXT_ADDR_16 | ||
569 | 0x4B04 US_ALU_EXT_ADDR_17 | ||
570 | 0x4B08 US_ALU_EXT_ADDR_18 | ||
571 | 0x4B0C US_ALU_EXT_ADDR_19 | ||
572 | 0x4B10 US_ALU_EXT_ADDR_20 | ||
573 | 0x4B14 US_ALU_EXT_ADDR_21 | ||
574 | 0x4B18 US_ALU_EXT_ADDR_22 | ||
575 | 0x4B1C US_ALU_EXT_ADDR_23 | ||
576 | 0x4B20 US_ALU_EXT_ADDR_24 | ||
577 | 0x4B24 US_ALU_EXT_ADDR_25 | ||
578 | 0x4B28 US_ALU_EXT_ADDR_26 | ||
579 | 0x4B2C US_ALU_EXT_ADDR_27 | ||
580 | 0x4B30 US_ALU_EXT_ADDR_28 | ||
581 | 0x4B34 US_ALU_EXT_ADDR_29 | ||
582 | 0x4B38 US_ALU_EXT_ADDR_30 | ||
583 | 0x4B3C US_ALU_EXT_ADDR_31 | ||
584 | 0x4B40 US_ALU_EXT_ADDR_32 | ||
585 | 0x4B44 US_ALU_EXT_ADDR_33 | ||
586 | 0x4B48 US_ALU_EXT_ADDR_34 | ||
587 | 0x4B4C US_ALU_EXT_ADDR_35 | ||
588 | 0x4B50 US_ALU_EXT_ADDR_36 | ||
589 | 0x4B54 US_ALU_EXT_ADDR_37 | ||
590 | 0x4B58 US_ALU_EXT_ADDR_38 | ||
591 | 0x4B5C US_ALU_EXT_ADDR_39 | ||
592 | 0x4B60 US_ALU_EXT_ADDR_40 | ||
593 | 0x4B64 US_ALU_EXT_ADDR_41 | ||
594 | 0x4B68 US_ALU_EXT_ADDR_42 | ||
595 | 0x4B6C US_ALU_EXT_ADDR_43 | ||
596 | 0x4B70 US_ALU_EXT_ADDR_44 | ||
597 | 0x4B74 US_ALU_EXT_ADDR_45 | ||
598 | 0x4B78 US_ALU_EXT_ADDR_46 | ||
599 | 0x4B7C US_ALU_EXT_ADDR_47 | ||
600 | 0x4B80 US_ALU_EXT_ADDR_48 | ||
601 | 0x4B84 US_ALU_EXT_ADDR_49 | ||
602 | 0x4B88 US_ALU_EXT_ADDR_50 | ||
603 | 0x4B8C US_ALU_EXT_ADDR_51 | ||
604 | 0x4B90 US_ALU_EXT_ADDR_52 | ||
605 | 0x4B94 US_ALU_EXT_ADDR_53 | ||
606 | 0x4B98 US_ALU_EXT_ADDR_54 | ||
607 | 0x4B9C US_ALU_EXT_ADDR_55 | ||
608 | 0x4BA0 US_ALU_EXT_ADDR_56 | ||
609 | 0x4BA4 US_ALU_EXT_ADDR_57 | ||
610 | 0x4BA8 US_ALU_EXT_ADDR_58 | ||
611 | 0x4BAC US_ALU_EXT_ADDR_59 | ||
612 | 0x4BB0 US_ALU_EXT_ADDR_60 | ||
613 | 0x4BB4 US_ALU_EXT_ADDR_61 | ||
614 | 0x4BB8 US_ALU_EXT_ADDR_62 | ||
615 | 0x4BBC US_ALU_EXT_ADDR_63 | ||
550 | 0x4BC0 FG_FOG_BLEND | 616 | 0x4BC0 FG_FOG_BLEND |
551 | 0x4BC4 FG_FOG_FACTOR | 617 | 0x4BC4 FG_FOG_FACTOR |
552 | 0x4BC8 FG_FOG_COLOR_R | 618 | 0x4BC8 FG_FOG_COLOR_R |
diff --git a/drivers/gpu/drm/radeon/reg_srcs/rv515 b/drivers/gpu/drm/radeon/reg_srcs/rv515 index 0102a0d5735c..38abf63bf2cd 100644 --- a/drivers/gpu/drm/radeon/reg_srcs/rv515 +++ b/drivers/gpu/drm/radeon/reg_srcs/rv515 | |||
@@ -161,7 +161,12 @@ rv515 0x6d40 | |||
161 | 0x401C GB_SELECT | 161 | 0x401C GB_SELECT |
162 | 0x4020 GB_AA_CONFIG | 162 | 0x4020 GB_AA_CONFIG |
163 | 0x4024 GB_FIFO_SIZE | 163 | 0x4024 GB_FIFO_SIZE |
164 | 0x4028 GB_Z_PEQ_CONFIG | ||
164 | 0x4100 TX_INVALTAGS | 165 | 0x4100 TX_INVALTAGS |
166 | 0x4114 SU_TEX_WRAP_PS3 | ||
167 | 0x4118 PS3_ENABLE | ||
168 | 0x411c PS3_VTX_FMT | ||
169 | 0x4120 PS3_TEX_SOURCE | ||
165 | 0x4200 GA_POINT_S0 | 170 | 0x4200 GA_POINT_S0 |
166 | 0x4204 GA_POINT_T0 | 171 | 0x4204 GA_POINT_T0 |
167 | 0x4208 GA_POINT_S1 | 172 | 0x4208 GA_POINT_S1 |
@@ -171,6 +176,7 @@ rv515 0x6d40 | |||
171 | 0x4230 GA_POINT_MINMAX | 176 | 0x4230 GA_POINT_MINMAX |
172 | 0x4234 GA_LINE_CNTL | 177 | 0x4234 GA_LINE_CNTL |
173 | 0x4238 GA_LINE_STIPPLE_CONFIG | 178 | 0x4238 GA_LINE_STIPPLE_CONFIG |
179 | 0x4258 GA_COLOR_CONTROL_PS3 | ||
174 | 0x4260 GA_LINE_STIPPLE_VALUE | 180 | 0x4260 GA_LINE_STIPPLE_VALUE |
175 | 0x4264 GA_LINE_S0 | 181 | 0x4264 GA_LINE_S0 |
176 | 0x4268 GA_LINE_S1 | 182 | 0x4268 GA_LINE_S1 |
diff --git a/drivers/gpu/drm/radeon/rs400.c b/drivers/gpu/drm/radeon/rs400.c index 368415df5f3a..9f5418983e2a 100644 --- a/drivers/gpu/drm/radeon/rs400.c +++ b/drivers/gpu/drm/radeon/rs400.c | |||
@@ -356,6 +356,7 @@ static int rs400_mc_init(struct radeon_device *rdev) | |||
356 | rdev->mc.vram_location = G_00015C_MC_FB_START(tmp) << 16; | 356 | rdev->mc.vram_location = G_00015C_MC_FB_START(tmp) << 16; |
357 | rdev->mc.gtt_location = 0xFFFFFFFFUL; | 357 | rdev->mc.gtt_location = 0xFFFFFFFFUL; |
358 | r = radeon_mc_setup(rdev); | 358 | r = radeon_mc_setup(rdev); |
359 | rdev->mc.igp_sideport_enabled = radeon_combios_sideport_present(rdev); | ||
359 | if (r) | 360 | if (r) |
360 | return r; | 361 | return r; |
361 | return 0; | 362 | return 0; |
@@ -395,6 +396,7 @@ static int rs400_startup(struct radeon_device *rdev) | |||
395 | return r; | 396 | return r; |
396 | /* Enable IRQ */ | 397 | /* Enable IRQ */ |
397 | r100_irq_set(rdev); | 398 | r100_irq_set(rdev); |
399 | rdev->config.r300.hdp_cntl = RREG32(RADEON_HOST_PATH_CNTL); | ||
398 | /* 1M ring buffer */ | 400 | /* 1M ring buffer */ |
399 | r = r100_cp_init(rdev, 1024 * 1024); | 401 | r = r100_cp_init(rdev, 1024 * 1024); |
400 | if (r) { | 402 | if (r) { |
diff --git a/drivers/gpu/drm/radeon/rs600.c b/drivers/gpu/drm/radeon/rs600.c index 4f8ea4260572..d5255751e7b3 100644 --- a/drivers/gpu/drm/radeon/rs600.c +++ b/drivers/gpu/drm/radeon/rs600.c | |||
@@ -56,6 +56,7 @@ int rs600_mc_init(struct radeon_device *rdev) | |||
56 | rdev->mc.vram_location = G_000004_MC_FB_START(tmp) << 16; | 56 | rdev->mc.vram_location = G_000004_MC_FB_START(tmp) << 16; |
57 | rdev->mc.gtt_location = 0xffffffffUL; | 57 | rdev->mc.gtt_location = 0xffffffffUL; |
58 | r = radeon_mc_setup(rdev); | 58 | r = radeon_mc_setup(rdev); |
59 | rdev->mc.igp_sideport_enabled = radeon_atombios_sideport_present(rdev); | ||
59 | if (r) | 60 | if (r) |
60 | return r; | 61 | return r; |
61 | return 0; | 62 | return 0; |
@@ -134,7 +135,8 @@ void rs600_hpd_init(struct radeon_device *rdev) | |||
134 | break; | 135 | break; |
135 | } | 136 | } |
136 | } | 137 | } |
137 | rs600_irq_set(rdev); | 138 | if (rdev->irq.installed) |
139 | rs600_irq_set(rdev); | ||
138 | } | 140 | } |
139 | 141 | ||
140 | void rs600_hpd_fini(struct radeon_device *rdev) | 142 | void rs600_hpd_fini(struct radeon_device *rdev) |
@@ -315,6 +317,11 @@ int rs600_irq_set(struct radeon_device *rdev) | |||
315 | u32 hpd2 = RREG32(R_007D18_DC_HOT_PLUG_DETECT2_INT_CONTROL) & | 317 | u32 hpd2 = RREG32(R_007D18_DC_HOT_PLUG_DETECT2_INT_CONTROL) & |
316 | ~S_007D18_DC_HOT_PLUG_DETECT2_INT_EN(1); | 318 | ~S_007D18_DC_HOT_PLUG_DETECT2_INT_EN(1); |
317 | 319 | ||
320 | if (!rdev->irq.installed) { | ||
321 | WARN(1, "Can't enable IRQ/MSI because no handler is installed.\n"); | ||
322 | WREG32(R_000040_GEN_INT_CNTL, 0); | ||
323 | return -EINVAL; | ||
324 | } | ||
318 | if (rdev->irq.sw_int) { | 325 | if (rdev->irq.sw_int) { |
319 | tmp |= S_000040_SW_INT_EN(1); | 326 | tmp |= S_000040_SW_INT_EN(1); |
320 | } | 327 | } |
@@ -396,7 +403,7 @@ int rs600_irq_process(struct radeon_device *rdev) | |||
396 | } | 403 | } |
397 | while (status || r500_disp_int) { | 404 | while (status || r500_disp_int) { |
398 | /* SW interrupt */ | 405 | /* SW interrupt */ |
399 | if (G_000040_SW_INT_EN(status)) | 406 | if (G_000044_SW_INT(status)) |
400 | radeon_fence_process(rdev); | 407 | radeon_fence_process(rdev); |
401 | /* Vertical blank interrupts */ | 408 | /* Vertical blank interrupts */ |
402 | if (G_007EDC_LB_D1_VBLANK_INTERRUPT(r500_disp_int)) | 409 | if (G_007EDC_LB_D1_VBLANK_INTERRUPT(r500_disp_int)) |
@@ -553,6 +560,7 @@ static int rs600_startup(struct radeon_device *rdev) | |||
553 | return r; | 560 | return r; |
554 | /* Enable IRQ */ | 561 | /* Enable IRQ */ |
555 | rs600_irq_set(rdev); | 562 | rs600_irq_set(rdev); |
563 | rdev->config.r300.hdp_cntl = RREG32(RADEON_HOST_PATH_CNTL); | ||
556 | /* 1M ring buffer */ | 564 | /* 1M ring buffer */ |
557 | r = r100_cp_init(rdev, 1024 * 1024); | 565 | r = r100_cp_init(rdev, 1024 * 1024); |
558 | if (r) { | 566 | if (r) { |
diff --git a/drivers/gpu/drm/radeon/rs690.c b/drivers/gpu/drm/radeon/rs690.c index 1e22f52d6039..cd31da913771 100644 --- a/drivers/gpu/drm/radeon/rs690.c +++ b/drivers/gpu/drm/radeon/rs690.c | |||
@@ -172,6 +172,7 @@ static int rs690_mc_init(struct radeon_device *rdev) | |||
172 | rdev->mc.vram_location = G_000100_MC_FB_START(tmp) << 16; | 172 | rdev->mc.vram_location = G_000100_MC_FB_START(tmp) << 16; |
173 | rdev->mc.gtt_location = 0xFFFFFFFFUL; | 173 | rdev->mc.gtt_location = 0xFFFFFFFFUL; |
174 | r = radeon_mc_setup(rdev); | 174 | r = radeon_mc_setup(rdev); |
175 | rdev->mc.igp_sideport_enabled = radeon_atombios_sideport_present(rdev); | ||
175 | if (r) | 176 | if (r) |
176 | return r; | 177 | return r; |
177 | return 0; | 178 | return 0; |
@@ -625,6 +626,7 @@ static int rs690_startup(struct radeon_device *rdev) | |||
625 | return r; | 626 | return r; |
626 | /* Enable IRQ */ | 627 | /* Enable IRQ */ |
627 | rs600_irq_set(rdev); | 628 | rs600_irq_set(rdev); |
629 | rdev->config.r300.hdp_cntl = RREG32(RADEON_HOST_PATH_CNTL); | ||
628 | /* 1M ring buffer */ | 630 | /* 1M ring buffer */ |
629 | r = r100_cp_init(rdev, 1024 * 1024); | 631 | r = r100_cp_init(rdev, 1024 * 1024); |
630 | if (r) { | 632 | if (r) { |
diff --git a/drivers/gpu/drm/radeon/rv515.c b/drivers/gpu/drm/radeon/rv515.c index 59632a506b46..62756717b044 100644 --- a/drivers/gpu/drm/radeon/rv515.c +++ b/drivers/gpu/drm/radeon/rv515.c | |||
@@ -479,6 +479,7 @@ static int rv515_startup(struct radeon_device *rdev) | |||
479 | } | 479 | } |
480 | /* Enable IRQ */ | 480 | /* Enable IRQ */ |
481 | rs600_irq_set(rdev); | 481 | rs600_irq_set(rdev); |
482 | rdev->config.r300.hdp_cntl = RREG32(RADEON_HOST_PATH_CNTL); | ||
482 | /* 1M ring buffer */ | 483 | /* 1M ring buffer */ |
483 | r = r100_cp_init(rdev, 1024 * 1024); | 484 | r = r100_cp_init(rdev, 1024 * 1024); |
484 | if (r) { | 485 | if (r) { |
diff --git a/drivers/gpu/drm/radeon/rv770.c b/drivers/gpu/drm/radeon/rv770.c index 3bcb66e52786..59c71245fb91 100644 --- a/drivers/gpu/drm/radeon/rv770.c +++ b/drivers/gpu/drm/radeon/rv770.c | |||
@@ -1096,8 +1096,7 @@ void rv770_fini(struct radeon_device *rdev) | |||
1096 | radeon_gem_fini(rdev); | 1096 | radeon_gem_fini(rdev); |
1097 | radeon_fence_driver_fini(rdev); | 1097 | radeon_fence_driver_fini(rdev); |
1098 | radeon_clocks_fini(rdev); | 1098 | radeon_clocks_fini(rdev); |
1099 | if (rdev->flags & RADEON_IS_AGP) | 1099 | radeon_agp_fini(rdev); |
1100 | radeon_agp_fini(rdev); | ||
1101 | radeon_bo_fini(rdev); | 1100 | radeon_bo_fini(rdev); |
1102 | radeon_atombios_fini(rdev); | 1101 | radeon_atombios_fini(rdev); |
1103 | kfree(rdev->bios); | 1102 | kfree(rdev->bios); |
diff --git a/drivers/gpu/drm/savage/savage_drv.c b/drivers/gpu/drm/savage/savage_drv.c index eee52aa92a7c..021de44c15ab 100644 --- a/drivers/gpu/drm/savage/savage_drv.c +++ b/drivers/gpu/drm/savage/savage_drv.c | |||
@@ -50,7 +50,7 @@ static struct drm_driver driver = { | |||
50 | .owner = THIS_MODULE, | 50 | .owner = THIS_MODULE, |
51 | .open = drm_open, | 51 | .open = drm_open, |
52 | .release = drm_release, | 52 | .release = drm_release, |
53 | .ioctl = drm_ioctl, | 53 | .unlocked_ioctl = drm_ioctl, |
54 | .mmap = drm_mmap, | 54 | .mmap = drm_mmap, |
55 | .poll = drm_poll, | 55 | .poll = drm_poll, |
56 | .fasync = drm_fasync, | 56 | .fasync = drm_fasync, |
diff --git a/drivers/gpu/drm/sis/sis_drv.c b/drivers/gpu/drm/sis/sis_drv.c index e725cc0b1155..4fd1f067d380 100644 --- a/drivers/gpu/drm/sis/sis_drv.c +++ b/drivers/gpu/drm/sis/sis_drv.c | |||
@@ -80,7 +80,7 @@ static struct drm_driver driver = { | |||
80 | .owner = THIS_MODULE, | 80 | .owner = THIS_MODULE, |
81 | .open = drm_open, | 81 | .open = drm_open, |
82 | .release = drm_release, | 82 | .release = drm_release, |
83 | .ioctl = drm_ioctl, | 83 | .unlocked_ioctl = drm_ioctl, |
84 | .mmap = drm_mmap, | 84 | .mmap = drm_mmap, |
85 | .poll = drm_poll, | 85 | .poll = drm_poll, |
86 | .fasync = drm_fasync, | 86 | .fasync = drm_fasync, |
diff --git a/drivers/gpu/drm/tdfx/tdfx_drv.c b/drivers/gpu/drm/tdfx/tdfx_drv.c index 012ff2e356b2..ec5a43e65722 100644 --- a/drivers/gpu/drm/tdfx/tdfx_drv.c +++ b/drivers/gpu/drm/tdfx/tdfx_drv.c | |||
@@ -48,7 +48,7 @@ static struct drm_driver driver = { | |||
48 | .owner = THIS_MODULE, | 48 | .owner = THIS_MODULE, |
49 | .open = drm_open, | 49 | .open = drm_open, |
50 | .release = drm_release, | 50 | .release = drm_release, |
51 | .ioctl = drm_ioctl, | 51 | .unlocked_ioctl = drm_ioctl, |
52 | .mmap = drm_mmap, | 52 | .mmap = drm_mmap, |
53 | .poll = drm_poll, | 53 | .poll = drm_poll, |
54 | .fasync = drm_fasync, | 54 | .fasync = drm_fasync, |
diff --git a/drivers/gpu/drm/via/via_drv.c b/drivers/gpu/drm/via/via_drv.c index bc2f51843005..7a1b210401e0 100644 --- a/drivers/gpu/drm/via/via_drv.c +++ b/drivers/gpu/drm/via/via_drv.c | |||
@@ -58,7 +58,7 @@ static struct drm_driver driver = { | |||
58 | .owner = THIS_MODULE, | 58 | .owner = THIS_MODULE, |
59 | .open = drm_open, | 59 | .open = drm_open, |
60 | .release = drm_release, | 60 | .release = drm_release, |
61 | .ioctl = drm_ioctl, | 61 | .unlocked_ioctl = drm_ioctl, |
62 | .mmap = drm_mmap, | 62 | .mmap = drm_mmap, |
63 | .poll = drm_poll, | 63 | .poll = drm_poll, |
64 | .fasync = drm_fasync, | 64 | .fasync = drm_fasync, |
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c b/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c index 7b48bb3b63b2..1db1ef30be2b 100644 --- a/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c | |||
@@ -103,37 +103,39 @@ | |||
103 | */ | 103 | */ |
104 | 104 | ||
105 | static struct drm_ioctl_desc vmw_ioctls[] = { | 105 | static struct drm_ioctl_desc vmw_ioctls[] = { |
106 | VMW_IOCTL_DEF(DRM_IOCTL_VMW_GET_PARAM, vmw_getparam_ioctl, 0), | 106 | VMW_IOCTL_DEF(DRM_IOCTL_VMW_GET_PARAM, vmw_getparam_ioctl, |
107 | DRM_AUTH | DRM_UNLOCKED), | ||
107 | VMW_IOCTL_DEF(DRM_IOCTL_VMW_ALLOC_DMABUF, vmw_dmabuf_alloc_ioctl, | 108 | VMW_IOCTL_DEF(DRM_IOCTL_VMW_ALLOC_DMABUF, vmw_dmabuf_alloc_ioctl, |
108 | 0), | 109 | DRM_AUTH | DRM_UNLOCKED), |
109 | VMW_IOCTL_DEF(DRM_IOCTL_VMW_UNREF_DMABUF, vmw_dmabuf_unref_ioctl, | 110 | VMW_IOCTL_DEF(DRM_IOCTL_VMW_UNREF_DMABUF, vmw_dmabuf_unref_ioctl, |
110 | 0), | 111 | DRM_AUTH | DRM_UNLOCKED), |
111 | VMW_IOCTL_DEF(DRM_IOCTL_VMW_CURSOR_BYPASS, | 112 | VMW_IOCTL_DEF(DRM_IOCTL_VMW_CURSOR_BYPASS, |
112 | vmw_kms_cursor_bypass_ioctl, 0), | 113 | vmw_kms_cursor_bypass_ioctl, |
114 | DRM_MASTER | DRM_CONTROL_ALLOW | DRM_UNLOCKED), | ||
113 | 115 | ||
114 | VMW_IOCTL_DEF(DRM_IOCTL_VMW_CONTROL_STREAM, vmw_overlay_ioctl, | 116 | VMW_IOCTL_DEF(DRM_IOCTL_VMW_CONTROL_STREAM, vmw_overlay_ioctl, |
115 | 0), | 117 | DRM_MASTER | DRM_CONTROL_ALLOW | DRM_UNLOCKED), |
116 | VMW_IOCTL_DEF(DRM_IOCTL_VMW_CLAIM_STREAM, vmw_stream_claim_ioctl, | 118 | VMW_IOCTL_DEF(DRM_IOCTL_VMW_CLAIM_STREAM, vmw_stream_claim_ioctl, |
117 | 0), | 119 | DRM_MASTER | DRM_CONTROL_ALLOW | DRM_UNLOCKED), |
118 | VMW_IOCTL_DEF(DRM_IOCTL_VMW_UNREF_STREAM, vmw_stream_unref_ioctl, | 120 | VMW_IOCTL_DEF(DRM_IOCTL_VMW_UNREF_STREAM, vmw_stream_unref_ioctl, |
119 | 0), | 121 | DRM_MASTER | DRM_CONTROL_ALLOW | DRM_UNLOCKED), |
120 | 122 | ||
121 | VMW_IOCTL_DEF(DRM_IOCTL_VMW_CREATE_CONTEXT, vmw_context_define_ioctl, | 123 | VMW_IOCTL_DEF(DRM_IOCTL_VMW_CREATE_CONTEXT, vmw_context_define_ioctl, |
122 | 0), | 124 | DRM_AUTH | DRM_UNLOCKED), |
123 | VMW_IOCTL_DEF(DRM_IOCTL_VMW_UNREF_CONTEXT, vmw_context_destroy_ioctl, | 125 | VMW_IOCTL_DEF(DRM_IOCTL_VMW_UNREF_CONTEXT, vmw_context_destroy_ioctl, |
124 | 0), | 126 | DRM_AUTH | DRM_UNLOCKED), |
125 | VMW_IOCTL_DEF(DRM_IOCTL_VMW_CREATE_SURFACE, vmw_surface_define_ioctl, | 127 | VMW_IOCTL_DEF(DRM_IOCTL_VMW_CREATE_SURFACE, vmw_surface_define_ioctl, |
126 | 0), | 128 | DRM_AUTH | DRM_UNLOCKED), |
127 | VMW_IOCTL_DEF(DRM_IOCTL_VMW_UNREF_SURFACE, vmw_surface_destroy_ioctl, | 129 | VMW_IOCTL_DEF(DRM_IOCTL_VMW_UNREF_SURFACE, vmw_surface_destroy_ioctl, |
128 | 0), | 130 | DRM_AUTH | DRM_UNLOCKED), |
129 | VMW_IOCTL_DEF(DRM_IOCTL_VMW_REF_SURFACE, vmw_surface_reference_ioctl, | 131 | VMW_IOCTL_DEF(DRM_IOCTL_VMW_REF_SURFACE, vmw_surface_reference_ioctl, |
130 | 0), | 132 | DRM_AUTH | DRM_UNLOCKED), |
131 | VMW_IOCTL_DEF(DRM_IOCTL_VMW_EXECBUF, vmw_execbuf_ioctl, | 133 | VMW_IOCTL_DEF(DRM_IOCTL_VMW_EXECBUF, vmw_execbuf_ioctl, |
132 | 0), | 134 | DRM_AUTH | DRM_UNLOCKED), |
133 | VMW_IOCTL_DEF(DRM_IOCTL_VMW_FIFO_DEBUG, vmw_fifo_debug_ioctl, | 135 | VMW_IOCTL_DEF(DRM_IOCTL_VMW_FIFO_DEBUG, vmw_fifo_debug_ioctl, |
134 | 0), | 136 | DRM_AUTH | DRM_ROOT_ONLY | DRM_MASTER | DRM_UNLOCKED), |
135 | VMW_IOCTL_DEF(DRM_IOCTL_VMW_FENCE_WAIT, vmw_fence_wait_ioctl, | 137 | VMW_IOCTL_DEF(DRM_IOCTL_VMW_FENCE_WAIT, vmw_fence_wait_ioctl, |
136 | 0) | 138 | DRM_AUTH | DRM_UNLOCKED) |
137 | }; | 139 | }; |
138 | 140 | ||
139 | static struct pci_device_id vmw_pci_id_list[] = { | 141 | static struct pci_device_id vmw_pci_id_list[] = { |
@@ -460,11 +462,9 @@ static long vmw_unlocked_ioctl(struct file *filp, unsigned int cmd, | |||
460 | struct drm_file *file_priv = filp->private_data; | 462 | struct drm_file *file_priv = filp->private_data; |
461 | struct drm_device *dev = file_priv->minor->dev; | 463 | struct drm_device *dev = file_priv->minor->dev; |
462 | unsigned int nr = DRM_IOCTL_NR(cmd); | 464 | unsigned int nr = DRM_IOCTL_NR(cmd); |
463 | long ret; | ||
464 | 465 | ||
465 | /* | 466 | /* |
466 | * The driver private ioctls and TTM ioctls should be | 467 | * Do extra checking on driver private ioctls. |
467 | * thread-safe. | ||
468 | */ | 468 | */ |
469 | 469 | ||
470 | if ((nr >= DRM_COMMAND_BASE) && (nr < DRM_COMMAND_END) | 470 | if ((nr >= DRM_COMMAND_BASE) && (nr < DRM_COMMAND_END) |
@@ -477,18 +477,9 @@ static long vmw_unlocked_ioctl(struct file *filp, unsigned int cmd, | |||
477 | nr - DRM_COMMAND_BASE); | 477 | nr - DRM_COMMAND_BASE); |
478 | return -EINVAL; | 478 | return -EINVAL; |
479 | } | 479 | } |
480 | return drm_ioctl(filp->f_path.dentry->d_inode, | ||
481 | filp, cmd, arg); | ||
482 | } | 480 | } |
483 | 481 | ||
484 | /* | 482 | return drm_ioctl(filp, cmd, arg); |
485 | * Not all old drm ioctls are thread-safe. | ||
486 | */ | ||
487 | |||
488 | lock_kernel(); | ||
489 | ret = drm_ioctl(filp->f_path.dentry->d_inode, filp, cmd, arg); | ||
490 | unlock_kernel(); | ||
491 | return ret; | ||
492 | } | 483 | } |
493 | 484 | ||
494 | static int vmw_firstopen(struct drm_device *dev) | 485 | static int vmw_firstopen(struct drm_device *dev) |
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_drv.h b/drivers/gpu/drm/vmwgfx/vmwgfx_drv.h index 43546d09d1b0..e61bd85b6975 100644 --- a/drivers/gpu/drm/vmwgfx/vmwgfx_drv.h +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_drv.h | |||
@@ -123,6 +123,7 @@ struct vmw_sw_context{ | |||
123 | uint32_t last_cid; | 123 | uint32_t last_cid; |
124 | bool cid_valid; | 124 | bool cid_valid; |
125 | uint32_t last_sid; | 125 | uint32_t last_sid; |
126 | uint32_t sid_translation; | ||
126 | bool sid_valid; | 127 | bool sid_valid; |
127 | struct ttm_object_file *tfile; | 128 | struct ttm_object_file *tfile; |
128 | struct list_head validate_nodes; | 129 | struct list_head validate_nodes; |
@@ -317,9 +318,10 @@ extern void vmw_surface_res_free(struct vmw_resource *res); | |||
317 | extern int vmw_surface_init(struct vmw_private *dev_priv, | 318 | extern int vmw_surface_init(struct vmw_private *dev_priv, |
318 | struct vmw_surface *srf, | 319 | struct vmw_surface *srf, |
319 | void (*res_free) (struct vmw_resource *res)); | 320 | void (*res_free) (struct vmw_resource *res)); |
320 | extern int vmw_user_surface_lookup(struct vmw_private *dev_priv, | 321 | extern int vmw_user_surface_lookup_handle(struct vmw_private *dev_priv, |
321 | struct ttm_object_file *tfile, | 322 | struct ttm_object_file *tfile, |
322 | int sid, struct vmw_surface **out); | 323 | uint32_t handle, |
324 | struct vmw_surface **out); | ||
323 | extern int vmw_surface_destroy_ioctl(struct drm_device *dev, void *data, | 325 | extern int vmw_surface_destroy_ioctl(struct drm_device *dev, void *data, |
324 | struct drm_file *file_priv); | 326 | struct drm_file *file_priv); |
325 | extern int vmw_surface_define_ioctl(struct drm_device *dev, void *data, | 327 | extern int vmw_surface_define_ioctl(struct drm_device *dev, void *data, |
@@ -328,7 +330,7 @@ extern int vmw_surface_reference_ioctl(struct drm_device *dev, void *data, | |||
328 | struct drm_file *file_priv); | 330 | struct drm_file *file_priv); |
329 | extern int vmw_surface_check(struct vmw_private *dev_priv, | 331 | extern int vmw_surface_check(struct vmw_private *dev_priv, |
330 | struct ttm_object_file *tfile, | 332 | struct ttm_object_file *tfile, |
331 | int id); | 333 | uint32_t handle, int *id); |
332 | extern void vmw_dmabuf_bo_free(struct ttm_buffer_object *bo); | 334 | extern void vmw_dmabuf_bo_free(struct ttm_buffer_object *bo); |
333 | extern int vmw_dmabuf_init(struct vmw_private *dev_priv, | 335 | extern int vmw_dmabuf_init(struct vmw_private *dev_priv, |
334 | struct vmw_dma_buffer *vmw_bo, | 336 | struct vmw_dma_buffer *vmw_bo, |
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_execbuf.c b/drivers/gpu/drm/vmwgfx/vmwgfx_execbuf.c index 7a39f3e6dc2c..2e92da567403 100644 --- a/drivers/gpu/drm/vmwgfx/vmwgfx_execbuf.c +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_execbuf.c | |||
@@ -73,21 +73,32 @@ static int vmw_cmd_cid_check(struct vmw_private *dev_priv, | |||
73 | 73 | ||
74 | static int vmw_cmd_sid_check(struct vmw_private *dev_priv, | 74 | static int vmw_cmd_sid_check(struct vmw_private *dev_priv, |
75 | struct vmw_sw_context *sw_context, | 75 | struct vmw_sw_context *sw_context, |
76 | uint32_t sid) | 76 | uint32_t *sid) |
77 | { | 77 | { |
78 | if (unlikely((!sw_context->sid_valid || sid != sw_context->last_sid) && | 78 | if (*sid == SVGA3D_INVALID_ID) |
79 | sid != SVGA3D_INVALID_ID)) { | 79 | return 0; |
80 | int ret = vmw_surface_check(dev_priv, sw_context->tfile, sid); | 80 | |
81 | if (unlikely((!sw_context->sid_valid || | ||
82 | *sid != sw_context->last_sid))) { | ||
83 | int real_id; | ||
84 | int ret = vmw_surface_check(dev_priv, sw_context->tfile, | ||
85 | *sid, &real_id); | ||
81 | 86 | ||
82 | if (unlikely(ret != 0)) { | 87 | if (unlikely(ret != 0)) { |
83 | DRM_ERROR("Could ot find or use surface %u\n", | 88 | DRM_ERROR("Could ot find or use surface 0x%08x " |
84 | (unsigned) sid); | 89 | "address 0x%08lx\n", |
90 | (unsigned int) *sid, | ||
91 | (unsigned long) sid); | ||
85 | return ret; | 92 | return ret; |
86 | } | 93 | } |
87 | 94 | ||
88 | sw_context->last_sid = sid; | 95 | sw_context->last_sid = *sid; |
89 | sw_context->sid_valid = true; | 96 | sw_context->sid_valid = true; |
90 | } | 97 | *sid = real_id; |
98 | sw_context->sid_translation = real_id; | ||
99 | } else | ||
100 | *sid = sw_context->sid_translation; | ||
101 | |||
91 | return 0; | 102 | return 0; |
92 | } | 103 | } |
93 | 104 | ||
@@ -107,7 +118,8 @@ static int vmw_cmd_set_render_target_check(struct vmw_private *dev_priv, | |||
107 | return ret; | 118 | return ret; |
108 | 119 | ||
109 | cmd = container_of(header, struct vmw_sid_cmd, header); | 120 | cmd = container_of(header, struct vmw_sid_cmd, header); |
110 | return vmw_cmd_sid_check(dev_priv, sw_context, cmd->body.target.sid); | 121 | ret = vmw_cmd_sid_check(dev_priv, sw_context, &cmd->body.target.sid); |
122 | return ret; | ||
111 | } | 123 | } |
112 | 124 | ||
113 | static int vmw_cmd_surface_copy_check(struct vmw_private *dev_priv, | 125 | static int vmw_cmd_surface_copy_check(struct vmw_private *dev_priv, |
@@ -121,10 +133,10 @@ static int vmw_cmd_surface_copy_check(struct vmw_private *dev_priv, | |||
121 | int ret; | 133 | int ret; |
122 | 134 | ||
123 | cmd = container_of(header, struct vmw_sid_cmd, header); | 135 | cmd = container_of(header, struct vmw_sid_cmd, header); |
124 | ret = vmw_cmd_sid_check(dev_priv, sw_context, cmd->body.src.sid); | 136 | ret = vmw_cmd_sid_check(dev_priv, sw_context, &cmd->body.src.sid); |
125 | if (unlikely(ret != 0)) | 137 | if (unlikely(ret != 0)) |
126 | return ret; | 138 | return ret; |
127 | return vmw_cmd_sid_check(dev_priv, sw_context, cmd->body.dest.sid); | 139 | return vmw_cmd_sid_check(dev_priv, sw_context, &cmd->body.dest.sid); |
128 | } | 140 | } |
129 | 141 | ||
130 | static int vmw_cmd_stretch_blt_check(struct vmw_private *dev_priv, | 142 | static int vmw_cmd_stretch_blt_check(struct vmw_private *dev_priv, |
@@ -138,10 +150,10 @@ static int vmw_cmd_stretch_blt_check(struct vmw_private *dev_priv, | |||
138 | int ret; | 150 | int ret; |
139 | 151 | ||
140 | cmd = container_of(header, struct vmw_sid_cmd, header); | 152 | cmd = container_of(header, struct vmw_sid_cmd, header); |
141 | ret = vmw_cmd_sid_check(dev_priv, sw_context, cmd->body.src.sid); | 153 | ret = vmw_cmd_sid_check(dev_priv, sw_context, &cmd->body.src.sid); |
142 | if (unlikely(ret != 0)) | 154 | if (unlikely(ret != 0)) |
143 | return ret; | 155 | return ret; |
144 | return vmw_cmd_sid_check(dev_priv, sw_context, cmd->body.dest.sid); | 156 | return vmw_cmd_sid_check(dev_priv, sw_context, &cmd->body.dest.sid); |
145 | } | 157 | } |
146 | 158 | ||
147 | static int vmw_cmd_blt_surf_screen_check(struct vmw_private *dev_priv, | 159 | static int vmw_cmd_blt_surf_screen_check(struct vmw_private *dev_priv, |
@@ -154,7 +166,7 @@ static int vmw_cmd_blt_surf_screen_check(struct vmw_private *dev_priv, | |||
154 | } *cmd; | 166 | } *cmd; |
155 | 167 | ||
156 | cmd = container_of(header, struct vmw_sid_cmd, header); | 168 | cmd = container_of(header, struct vmw_sid_cmd, header); |
157 | return vmw_cmd_sid_check(dev_priv, sw_context, cmd->body.srcImage.sid); | 169 | return vmw_cmd_sid_check(dev_priv, sw_context, &cmd->body.srcImage.sid); |
158 | } | 170 | } |
159 | 171 | ||
160 | static int vmw_cmd_present_check(struct vmw_private *dev_priv, | 172 | static int vmw_cmd_present_check(struct vmw_private *dev_priv, |
@@ -167,7 +179,7 @@ static int vmw_cmd_present_check(struct vmw_private *dev_priv, | |||
167 | } *cmd; | 179 | } *cmd; |
168 | 180 | ||
169 | cmd = container_of(header, struct vmw_sid_cmd, header); | 181 | cmd = container_of(header, struct vmw_sid_cmd, header); |
170 | return vmw_cmd_sid_check(dev_priv, sw_context, cmd->body.sid); | 182 | return vmw_cmd_sid_check(dev_priv, sw_context, &cmd->body.sid); |
171 | } | 183 | } |
172 | 184 | ||
173 | static int vmw_cmd_dma(struct vmw_private *dev_priv, | 185 | static int vmw_cmd_dma(struct vmw_private *dev_priv, |
@@ -187,12 +199,7 @@ static int vmw_cmd_dma(struct vmw_private *dev_priv, | |||
187 | uint32_t cur_validate_node; | 199 | uint32_t cur_validate_node; |
188 | struct ttm_validate_buffer *val_buf; | 200 | struct ttm_validate_buffer *val_buf; |
189 | 201 | ||
190 | |||
191 | cmd = container_of(header, struct vmw_dma_cmd, header); | 202 | cmd = container_of(header, struct vmw_dma_cmd, header); |
192 | ret = vmw_cmd_sid_check(dev_priv, sw_context, cmd->dma.host.sid); | ||
193 | if (unlikely(ret != 0)) | ||
194 | return ret; | ||
195 | |||
196 | handle = cmd->dma.guest.ptr.gmrId; | 203 | handle = cmd->dma.guest.ptr.gmrId; |
197 | ret = vmw_user_dmabuf_lookup(sw_context->tfile, handle, &vmw_bo); | 204 | ret = vmw_user_dmabuf_lookup(sw_context->tfile, handle, &vmw_bo); |
198 | if (unlikely(ret != 0)) { | 205 | if (unlikely(ret != 0)) { |
@@ -228,14 +235,23 @@ static int vmw_cmd_dma(struct vmw_private *dev_priv, | |||
228 | ++sw_context->cur_val_buf; | 235 | ++sw_context->cur_val_buf; |
229 | } | 236 | } |
230 | 237 | ||
231 | ret = vmw_user_surface_lookup(dev_priv, sw_context->tfile, | 238 | ret = vmw_user_surface_lookup_handle(dev_priv, sw_context->tfile, |
232 | cmd->dma.host.sid, &srf); | 239 | cmd->dma.host.sid, &srf); |
233 | if (ret) { | 240 | if (ret) { |
234 | DRM_ERROR("could not find surface\n"); | 241 | DRM_ERROR("could not find surface\n"); |
235 | goto out_no_reloc; | 242 | goto out_no_reloc; |
236 | } | 243 | } |
237 | 244 | ||
245 | /** | ||
246 | * Patch command stream with device SID. | ||
247 | */ | ||
248 | |||
249 | cmd->dma.host.sid = srf->res.id; | ||
238 | vmw_kms_cursor_snoop(srf, sw_context->tfile, bo, header); | 250 | vmw_kms_cursor_snoop(srf, sw_context->tfile, bo, header); |
251 | /** | ||
252 | * FIXME: May deadlock here when called from the | ||
253 | * command parsing code. | ||
254 | */ | ||
239 | vmw_surface_unreference(&srf); | 255 | vmw_surface_unreference(&srf); |
240 | 256 | ||
241 | out_no_reloc: | 257 | out_no_reloc: |
@@ -243,6 +259,90 @@ out_no_reloc: | |||
243 | return ret; | 259 | return ret; |
244 | } | 260 | } |
245 | 261 | ||
262 | static int vmw_cmd_draw(struct vmw_private *dev_priv, | ||
263 | struct vmw_sw_context *sw_context, | ||
264 | SVGA3dCmdHeader *header) | ||
265 | { | ||
266 | struct vmw_draw_cmd { | ||
267 | SVGA3dCmdHeader header; | ||
268 | SVGA3dCmdDrawPrimitives body; | ||
269 | } *cmd; | ||
270 | SVGA3dVertexDecl *decl = (SVGA3dVertexDecl *)( | ||
271 | (unsigned long)header + sizeof(*cmd)); | ||
272 | SVGA3dPrimitiveRange *range; | ||
273 | uint32_t i; | ||
274 | uint32_t maxnum; | ||
275 | int ret; | ||
276 | |||
277 | ret = vmw_cmd_cid_check(dev_priv, sw_context, header); | ||
278 | if (unlikely(ret != 0)) | ||
279 | return ret; | ||
280 | |||
281 | cmd = container_of(header, struct vmw_draw_cmd, header); | ||
282 | maxnum = (header->size - sizeof(cmd->body)) / sizeof(*decl); | ||
283 | |||
284 | if (unlikely(cmd->body.numVertexDecls > maxnum)) { | ||
285 | DRM_ERROR("Illegal number of vertex declarations.\n"); | ||
286 | return -EINVAL; | ||
287 | } | ||
288 | |||
289 | for (i = 0; i < cmd->body.numVertexDecls; ++i, ++decl) { | ||
290 | ret = vmw_cmd_sid_check(dev_priv, sw_context, | ||
291 | &decl->array.surfaceId); | ||
292 | if (unlikely(ret != 0)) | ||
293 | return ret; | ||
294 | } | ||
295 | |||
296 | maxnum = (header->size - sizeof(cmd->body) - | ||
297 | cmd->body.numVertexDecls * sizeof(*decl)) / sizeof(*range); | ||
298 | if (unlikely(cmd->body.numRanges > maxnum)) { | ||
299 | DRM_ERROR("Illegal number of index ranges.\n"); | ||
300 | return -EINVAL; | ||
301 | } | ||
302 | |||
303 | range = (SVGA3dPrimitiveRange *) decl; | ||
304 | for (i = 0; i < cmd->body.numRanges; ++i, ++range) { | ||
305 | ret = vmw_cmd_sid_check(dev_priv, sw_context, | ||
306 | &range->indexArray.surfaceId); | ||
307 | if (unlikely(ret != 0)) | ||
308 | return ret; | ||
309 | } | ||
310 | return 0; | ||
311 | } | ||
312 | |||
313 | |||
314 | static int vmw_cmd_tex_state(struct vmw_private *dev_priv, | ||
315 | struct vmw_sw_context *sw_context, | ||
316 | SVGA3dCmdHeader *header) | ||
317 | { | ||
318 | struct vmw_tex_state_cmd { | ||
319 | SVGA3dCmdHeader header; | ||
320 | SVGA3dCmdSetTextureState state; | ||
321 | }; | ||
322 | |||
323 | SVGA3dTextureState *last_state = (SVGA3dTextureState *) | ||
324 | ((unsigned long) header + header->size + sizeof(header)); | ||
325 | SVGA3dTextureState *cur_state = (SVGA3dTextureState *) | ||
326 | ((unsigned long) header + sizeof(struct vmw_tex_state_cmd)); | ||
327 | int ret; | ||
328 | |||
329 | ret = vmw_cmd_cid_check(dev_priv, sw_context, header); | ||
330 | if (unlikely(ret != 0)) | ||
331 | return ret; | ||
332 | |||
333 | for (; cur_state < last_state; ++cur_state) { | ||
334 | if (likely(cur_state->name != SVGA3D_TS_BIND_TEXTURE)) | ||
335 | continue; | ||
336 | |||
337 | ret = vmw_cmd_sid_check(dev_priv, sw_context, | ||
338 | &cur_state->value); | ||
339 | if (unlikely(ret != 0)) | ||
340 | return ret; | ||
341 | } | ||
342 | |||
343 | return 0; | ||
344 | } | ||
345 | |||
246 | 346 | ||
247 | typedef int (*vmw_cmd_func) (struct vmw_private *, | 347 | typedef int (*vmw_cmd_func) (struct vmw_private *, |
248 | struct vmw_sw_context *, | 348 | struct vmw_sw_context *, |
@@ -264,7 +364,7 @@ static vmw_cmd_func vmw_cmd_funcs[SVGA_3D_CMD_MAX] = { | |||
264 | VMW_CMD_DEF(SVGA_3D_CMD_SETRENDERSTATE, &vmw_cmd_cid_check), | 364 | VMW_CMD_DEF(SVGA_3D_CMD_SETRENDERSTATE, &vmw_cmd_cid_check), |
265 | VMW_CMD_DEF(SVGA_3D_CMD_SETRENDERTARGET, | 365 | VMW_CMD_DEF(SVGA_3D_CMD_SETRENDERTARGET, |
266 | &vmw_cmd_set_render_target_check), | 366 | &vmw_cmd_set_render_target_check), |
267 | VMW_CMD_DEF(SVGA_3D_CMD_SETTEXTURESTATE, &vmw_cmd_cid_check), | 367 | VMW_CMD_DEF(SVGA_3D_CMD_SETTEXTURESTATE, &vmw_cmd_tex_state), |
268 | VMW_CMD_DEF(SVGA_3D_CMD_SETMATERIAL, &vmw_cmd_cid_check), | 368 | VMW_CMD_DEF(SVGA_3D_CMD_SETMATERIAL, &vmw_cmd_cid_check), |
269 | VMW_CMD_DEF(SVGA_3D_CMD_SETLIGHTDATA, &vmw_cmd_cid_check), | 369 | VMW_CMD_DEF(SVGA_3D_CMD_SETLIGHTDATA, &vmw_cmd_cid_check), |
270 | VMW_CMD_DEF(SVGA_3D_CMD_SETLIGHTENABLED, &vmw_cmd_cid_check), | 370 | VMW_CMD_DEF(SVGA_3D_CMD_SETLIGHTENABLED, &vmw_cmd_cid_check), |
@@ -276,7 +376,7 @@ static vmw_cmd_func vmw_cmd_funcs[SVGA_3D_CMD_MAX] = { | |||
276 | VMW_CMD_DEF(SVGA_3D_CMD_SHADER_DESTROY, &vmw_cmd_cid_check), | 376 | VMW_CMD_DEF(SVGA_3D_CMD_SHADER_DESTROY, &vmw_cmd_cid_check), |
277 | VMW_CMD_DEF(SVGA_3D_CMD_SET_SHADER, &vmw_cmd_cid_check), | 377 | VMW_CMD_DEF(SVGA_3D_CMD_SET_SHADER, &vmw_cmd_cid_check), |
278 | VMW_CMD_DEF(SVGA_3D_CMD_SET_SHADER_CONST, &vmw_cmd_cid_check), | 378 | VMW_CMD_DEF(SVGA_3D_CMD_SET_SHADER_CONST, &vmw_cmd_cid_check), |
279 | VMW_CMD_DEF(SVGA_3D_CMD_DRAW_PRIMITIVES, &vmw_cmd_cid_check), | 379 | VMW_CMD_DEF(SVGA_3D_CMD_DRAW_PRIMITIVES, &vmw_cmd_draw), |
280 | VMW_CMD_DEF(SVGA_3D_CMD_SETSCISSORRECT, &vmw_cmd_cid_check), | 380 | VMW_CMD_DEF(SVGA_3D_CMD_SETSCISSORRECT, &vmw_cmd_cid_check), |
281 | VMW_CMD_DEF(SVGA_3D_CMD_BEGIN_QUERY, &vmw_cmd_cid_check), | 381 | VMW_CMD_DEF(SVGA_3D_CMD_BEGIN_QUERY, &vmw_cmd_cid_check), |
282 | VMW_CMD_DEF(SVGA_3D_CMD_END_QUERY, &vmw_cmd_cid_check), | 382 | VMW_CMD_DEF(SVGA_3D_CMD_END_QUERY, &vmw_cmd_cid_check), |
@@ -291,6 +391,7 @@ static int vmw_cmd_check(struct vmw_private *dev_priv, | |||
291 | void *buf, uint32_t *size) | 391 | void *buf, uint32_t *size) |
292 | { | 392 | { |
293 | uint32_t cmd_id; | 393 | uint32_t cmd_id; |
394 | uint32_t size_remaining = *size; | ||
294 | SVGA3dCmdHeader *header = (SVGA3dCmdHeader *) buf; | 395 | SVGA3dCmdHeader *header = (SVGA3dCmdHeader *) buf; |
295 | int ret; | 396 | int ret; |
296 | 397 | ||
@@ -304,6 +405,9 @@ static int vmw_cmd_check(struct vmw_private *dev_priv, | |||
304 | *size = le32_to_cpu(header->size) + sizeof(SVGA3dCmdHeader); | 405 | *size = le32_to_cpu(header->size) + sizeof(SVGA3dCmdHeader); |
305 | 406 | ||
306 | cmd_id -= SVGA_3D_CMD_BASE; | 407 | cmd_id -= SVGA_3D_CMD_BASE; |
408 | if (unlikely(*size > size_remaining)) | ||
409 | goto out_err; | ||
410 | |||
307 | if (unlikely(cmd_id >= SVGA_3D_CMD_MAX - SVGA_3D_CMD_BASE)) | 411 | if (unlikely(cmd_id >= SVGA_3D_CMD_MAX - SVGA_3D_CMD_BASE)) |
308 | goto out_err; | 412 | goto out_err; |
309 | 413 | ||
@@ -326,6 +430,7 @@ static int vmw_cmd_check_all(struct vmw_private *dev_priv, | |||
326 | int ret; | 430 | int ret; |
327 | 431 | ||
328 | while (cur_size > 0) { | 432 | while (cur_size > 0) { |
433 | size = cur_size; | ||
329 | ret = vmw_cmd_check(dev_priv, sw_context, buf, &size); | 434 | ret = vmw_cmd_check(dev_priv, sw_context, buf, &size); |
330 | if (unlikely(ret != 0)) | 435 | if (unlikely(ret != 0)) |
331 | return ret; | 436 | return ret; |
@@ -386,7 +491,7 @@ static int vmw_validate_single_buffer(struct vmw_private *dev_priv, | |||
386 | return 0; | 491 | return 0; |
387 | 492 | ||
388 | ret = vmw_gmr_bind(dev_priv, bo); | 493 | ret = vmw_gmr_bind(dev_priv, bo); |
389 | if (likely(ret == 0 || ret == -ERESTART)) | 494 | if (likely(ret == 0 || ret == -ERESTARTSYS)) |
390 | return ret; | 495 | return ret; |
391 | 496 | ||
392 | 497 | ||
@@ -429,7 +534,7 @@ int vmw_execbuf_ioctl(struct drm_device *dev, void *data, | |||
429 | 534 | ||
430 | ret = mutex_lock_interruptible(&dev_priv->cmdbuf_mutex); | 535 | ret = mutex_lock_interruptible(&dev_priv->cmdbuf_mutex); |
431 | if (unlikely(ret != 0)) { | 536 | if (unlikely(ret != 0)) { |
432 | ret = -ERESTART; | 537 | ret = -ERESTARTSYS; |
433 | goto out_no_cmd_mutex; | 538 | goto out_no_cmd_mutex; |
434 | } | 539 | } |
435 | 540 | ||
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_fifo.c b/drivers/gpu/drm/vmwgfx/vmwgfx_fifo.c index 76b0693e2458..01feb48af333 100644 --- a/drivers/gpu/drm/vmwgfx/vmwgfx_fifo.c +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_fifo.c | |||
@@ -191,7 +191,7 @@ static int vmw_fifo_wait_noirq(struct vmw_private *dev_priv, | |||
191 | } | 191 | } |
192 | schedule_timeout(1); | 192 | schedule_timeout(1); |
193 | if (interruptible && signal_pending(current)) { | 193 | if (interruptible && signal_pending(current)) { |
194 | ret = -ERESTART; | 194 | ret = -ERESTARTSYS; |
195 | break; | 195 | break; |
196 | } | 196 | } |
197 | } | 197 | } |
@@ -237,9 +237,7 @@ static int vmw_fifo_wait(struct vmw_private *dev_priv, | |||
237 | (dev_priv->fifo_queue, | 237 | (dev_priv->fifo_queue, |
238 | !vmw_fifo_is_full(dev_priv, bytes), timeout); | 238 | !vmw_fifo_is_full(dev_priv, bytes), timeout); |
239 | 239 | ||
240 | if (unlikely(ret == -ERESTARTSYS)) | 240 | if (unlikely(ret == 0)) |
241 | ret = -ERESTART; | ||
242 | else if (unlikely(ret == 0)) | ||
243 | ret = -EBUSY; | 241 | ret = -EBUSY; |
244 | else if (likely(ret > 0)) | 242 | else if (likely(ret > 0)) |
245 | ret = 0; | 243 | ret = 0; |
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_irq.c b/drivers/gpu/drm/vmwgfx/vmwgfx_irq.c index 9e0f0306eedb..d40086fc8647 100644 --- a/drivers/gpu/drm/vmwgfx/vmwgfx_irq.c +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_irq.c | |||
@@ -155,7 +155,7 @@ int vmw_fallback_wait(struct vmw_private *dev_priv, | |||
155 | TASK_UNINTERRUPTIBLE); | 155 | TASK_UNINTERRUPTIBLE); |
156 | } | 156 | } |
157 | if (interruptible && signal_pending(current)) { | 157 | if (interruptible && signal_pending(current)) { |
158 | ret = -ERESTART; | 158 | ret = -ERESTARTSYS; |
159 | break; | 159 | break; |
160 | } | 160 | } |
161 | } | 161 | } |
@@ -218,9 +218,7 @@ int vmw_wait_fence(struct vmw_private *dev_priv, | |||
218 | vmw_fence_signaled(dev_priv, sequence), | 218 | vmw_fence_signaled(dev_priv, sequence), |
219 | timeout); | 219 | timeout); |
220 | 220 | ||
221 | if (unlikely(ret == -ERESTARTSYS)) | 221 | if (unlikely(ret == 0)) |
222 | ret = -ERESTART; | ||
223 | else if (unlikely(ret == 0)) | ||
224 | ret = -EBUSY; | 222 | ret = -EBUSY; |
225 | else if (likely(ret > 0)) | 223 | else if (likely(ret > 0)) |
226 | ret = 0; | 224 | ret = 0; |
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c b/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c index e9403be446fe..b1af76e371c3 100644 --- a/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c | |||
@@ -106,8 +106,8 @@ int vmw_du_crtc_cursor_set(struct drm_crtc *crtc, struct drm_file *file_priv, | |||
106 | int ret; | 106 | int ret; |
107 | 107 | ||
108 | if (handle) { | 108 | if (handle) { |
109 | ret = vmw_user_surface_lookup(dev_priv, tfile, | 109 | ret = vmw_user_surface_lookup_handle(dev_priv, tfile, |
110 | handle, &surface); | 110 | handle, &surface); |
111 | if (!ret) { | 111 | if (!ret) { |
112 | if (!surface->snooper.image) { | 112 | if (!surface->snooper.image) { |
113 | DRM_ERROR("surface not suitable for cursor\n"); | 113 | DRM_ERROR("surface not suitable for cursor\n"); |
@@ -704,8 +704,8 @@ static struct drm_framebuffer *vmw_kms_fb_create(struct drm_device *dev, | |||
704 | struct vmw_dma_buffer *bo = NULL; | 704 | struct vmw_dma_buffer *bo = NULL; |
705 | int ret; | 705 | int ret; |
706 | 706 | ||
707 | ret = vmw_user_surface_lookup(dev_priv, tfile, | 707 | ret = vmw_user_surface_lookup_handle(dev_priv, tfile, |
708 | mode_cmd->handle, &surface); | 708 | mode_cmd->handle, &surface); |
709 | if (ret) | 709 | if (ret) |
710 | goto try_dmabuf; | 710 | goto try_dmabuf; |
711 | 711 | ||
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_resource.c b/drivers/gpu/drm/vmwgfx/vmwgfx_resource.c index a1ceed0c8e07..c012d5927f65 100644 --- a/drivers/gpu/drm/vmwgfx/vmwgfx_resource.c +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_resource.c | |||
@@ -488,28 +488,44 @@ static void vmw_user_surface_free(struct vmw_resource *res) | |||
488 | kfree(user_srf); | 488 | kfree(user_srf); |
489 | } | 489 | } |
490 | 490 | ||
491 | int vmw_user_surface_lookup(struct vmw_private *dev_priv, | 491 | int vmw_user_surface_lookup_handle(struct vmw_private *dev_priv, |
492 | struct ttm_object_file *tfile, | 492 | struct ttm_object_file *tfile, |
493 | int sid, struct vmw_surface **out) | 493 | uint32_t handle, struct vmw_surface **out) |
494 | { | 494 | { |
495 | struct vmw_resource *res; | 495 | struct vmw_resource *res; |
496 | struct vmw_surface *srf; | 496 | struct vmw_surface *srf; |
497 | struct vmw_user_surface *user_srf; | 497 | struct vmw_user_surface *user_srf; |
498 | struct ttm_base_object *base; | ||
499 | int ret = -EINVAL; | ||
498 | 500 | ||
499 | res = vmw_resource_lookup(dev_priv, &dev_priv->surface_idr, sid); | 501 | base = ttm_base_object_lookup(tfile, handle); |
500 | if (unlikely(res == NULL)) | 502 | if (unlikely(base == NULL)) |
501 | return -EINVAL; | 503 | return -EINVAL; |
502 | 504 | ||
503 | if (res->res_free != &vmw_user_surface_free) | 505 | if (unlikely(base->object_type != VMW_RES_SURFACE)) |
504 | return -EINVAL; | 506 | goto out_bad_resource; |
505 | 507 | ||
506 | srf = container_of(res, struct vmw_surface, res); | 508 | user_srf = container_of(base, struct vmw_user_surface, base); |
507 | user_srf = container_of(srf, struct vmw_user_surface, srf); | 509 | srf = &user_srf->srf; |
508 | if (user_srf->base.tfile != tfile && !user_srf->base.shareable) | 510 | res = &srf->res; |
509 | return -EPERM; | 511 | |
512 | read_lock(&dev_priv->resource_lock); | ||
513 | |||
514 | if (!res->avail || res->res_free != &vmw_user_surface_free) { | ||
515 | read_unlock(&dev_priv->resource_lock); | ||
516 | goto out_bad_resource; | ||
517 | } | ||
518 | |||
519 | kref_get(&res->kref); | ||
520 | read_unlock(&dev_priv->resource_lock); | ||
510 | 521 | ||
511 | *out = srf; | 522 | *out = srf; |
512 | return 0; | 523 | ret = 0; |
524 | |||
525 | out_bad_resource: | ||
526 | ttm_base_object_unref(&base); | ||
527 | |||
528 | return ret; | ||
513 | } | 529 | } |
514 | 530 | ||
515 | static void vmw_user_surface_base_release(struct ttm_base_object **p_base) | 531 | static void vmw_user_surface_base_release(struct ttm_base_object **p_base) |
@@ -526,35 +542,10 @@ static void vmw_user_surface_base_release(struct ttm_base_object **p_base) | |||
526 | int vmw_surface_destroy_ioctl(struct drm_device *dev, void *data, | 542 | int vmw_surface_destroy_ioctl(struct drm_device *dev, void *data, |
527 | struct drm_file *file_priv) | 543 | struct drm_file *file_priv) |
528 | { | 544 | { |
529 | struct vmw_private *dev_priv = vmw_priv(dev); | ||
530 | struct vmw_resource *res; | ||
531 | struct vmw_surface *srf; | ||
532 | struct vmw_user_surface *user_srf; | ||
533 | struct drm_vmw_surface_arg *arg = (struct drm_vmw_surface_arg *)data; | 545 | struct drm_vmw_surface_arg *arg = (struct drm_vmw_surface_arg *)data; |
534 | struct ttm_object_file *tfile = vmw_fpriv(file_priv)->tfile; | 546 | struct ttm_object_file *tfile = vmw_fpriv(file_priv)->tfile; |
535 | int ret = 0; | ||
536 | |||
537 | res = vmw_resource_lookup(dev_priv, &dev_priv->surface_idr, arg->sid); | ||
538 | if (unlikely(res == NULL)) | ||
539 | return -EINVAL; | ||
540 | |||
541 | if (res->res_free != &vmw_user_surface_free) { | ||
542 | ret = -EINVAL; | ||
543 | goto out; | ||
544 | } | ||
545 | 547 | ||
546 | srf = container_of(res, struct vmw_surface, res); | 548 | return ttm_ref_object_base_unref(tfile, arg->sid, TTM_REF_USAGE); |
547 | user_srf = container_of(srf, struct vmw_user_surface, srf); | ||
548 | if (user_srf->base.tfile != tfile && !user_srf->base.shareable) { | ||
549 | ret = -EPERM; | ||
550 | goto out; | ||
551 | } | ||
552 | |||
553 | ttm_ref_object_base_unref(tfile, user_srf->base.hash.key, | ||
554 | TTM_REF_USAGE); | ||
555 | out: | ||
556 | vmw_resource_unreference(&res); | ||
557 | return ret; | ||
558 | } | 549 | } |
559 | 550 | ||
560 | int vmw_surface_define_ioctl(struct drm_device *dev, void *data, | 551 | int vmw_surface_define_ioctl(struct drm_device *dev, void *data, |
@@ -649,7 +640,10 @@ int vmw_surface_define_ioctl(struct drm_device *dev, void *data, | |||
649 | } | 640 | } |
650 | srf->snooper.crtc = NULL; | 641 | srf->snooper.crtc = NULL; |
651 | 642 | ||
652 | rep->sid = res->id; | 643 | rep->sid = user_srf->base.hash.key; |
644 | if (rep->sid == SVGA3D_INVALID_ID) | ||
645 | DRM_ERROR("Created bad Surface ID.\n"); | ||
646 | |||
653 | vmw_resource_unreference(&res); | 647 | vmw_resource_unreference(&res); |
654 | return 0; | 648 | return 0; |
655 | out_err1: | 649 | out_err1: |
@@ -662,39 +656,33 @@ out_err0: | |||
662 | int vmw_surface_reference_ioctl(struct drm_device *dev, void *data, | 656 | int vmw_surface_reference_ioctl(struct drm_device *dev, void *data, |
663 | struct drm_file *file_priv) | 657 | struct drm_file *file_priv) |
664 | { | 658 | { |
665 | struct vmw_private *dev_priv = vmw_priv(dev); | ||
666 | union drm_vmw_surface_reference_arg *arg = | 659 | union drm_vmw_surface_reference_arg *arg = |
667 | (union drm_vmw_surface_reference_arg *)data; | 660 | (union drm_vmw_surface_reference_arg *)data; |
668 | struct drm_vmw_surface_arg *req = &arg->req; | 661 | struct drm_vmw_surface_arg *req = &arg->req; |
669 | struct drm_vmw_surface_create_req *rep = &arg->rep; | 662 | struct drm_vmw_surface_create_req *rep = &arg->rep; |
670 | struct ttm_object_file *tfile = vmw_fpriv(file_priv)->tfile; | 663 | struct ttm_object_file *tfile = vmw_fpriv(file_priv)->tfile; |
671 | struct vmw_resource *res; | ||
672 | struct vmw_surface *srf; | 664 | struct vmw_surface *srf; |
673 | struct vmw_user_surface *user_srf; | 665 | struct vmw_user_surface *user_srf; |
674 | struct drm_vmw_size __user *user_sizes; | 666 | struct drm_vmw_size __user *user_sizes; |
675 | int ret; | 667 | struct ttm_base_object *base; |
668 | int ret = -EINVAL; | ||
676 | 669 | ||
677 | res = vmw_resource_lookup(dev_priv, &dev_priv->surface_idr, req->sid); | 670 | base = ttm_base_object_lookup(tfile, req->sid); |
678 | if (unlikely(res == NULL)) | 671 | if (unlikely(base == NULL)) { |
672 | DRM_ERROR("Could not find surface to reference.\n"); | ||
679 | return -EINVAL; | 673 | return -EINVAL; |
680 | |||
681 | if (res->res_free != &vmw_user_surface_free) { | ||
682 | ret = -EINVAL; | ||
683 | goto out; | ||
684 | } | 674 | } |
685 | 675 | ||
686 | srf = container_of(res, struct vmw_surface, res); | 676 | if (unlikely(base->object_type != VMW_RES_SURFACE)) |
687 | user_srf = container_of(srf, struct vmw_user_surface, srf); | 677 | goto out_bad_resource; |
688 | if (user_srf->base.tfile != tfile && !user_srf->base.shareable) { | 678 | |
689 | DRM_ERROR("Tried to reference none shareable surface\n"); | 679 | user_srf = container_of(base, struct vmw_user_surface, base); |
690 | ret = -EPERM; | 680 | srf = &user_srf->srf; |
691 | goto out; | ||
692 | } | ||
693 | 681 | ||
694 | ret = ttm_ref_object_add(tfile, &user_srf->base, TTM_REF_USAGE, NULL); | 682 | ret = ttm_ref_object_add(tfile, &user_srf->base, TTM_REF_USAGE, NULL); |
695 | if (unlikely(ret != 0)) { | 683 | if (unlikely(ret != 0)) { |
696 | DRM_ERROR("Could not add a reference to a surface.\n"); | 684 | DRM_ERROR("Could not add a reference to a surface.\n"); |
697 | goto out; | 685 | goto out_no_reference; |
698 | } | 686 | } |
699 | 687 | ||
700 | rep->flags = srf->flags; | 688 | rep->flags = srf->flags; |
@@ -706,40 +694,43 @@ int vmw_surface_reference_ioctl(struct drm_device *dev, void *data, | |||
706 | if (user_sizes) | 694 | if (user_sizes) |
707 | ret = copy_to_user(user_sizes, srf->sizes, | 695 | ret = copy_to_user(user_sizes, srf->sizes, |
708 | srf->num_sizes * sizeof(*srf->sizes)); | 696 | srf->num_sizes * sizeof(*srf->sizes)); |
709 | if (unlikely(ret != 0)) { | 697 | if (unlikely(ret != 0)) |
710 | DRM_ERROR("copy_to_user failed %p %u\n", | 698 | DRM_ERROR("copy_to_user failed %p %u\n", |
711 | user_sizes, srf->num_sizes); | 699 | user_sizes, srf->num_sizes); |
712 | /** | 700 | out_bad_resource: |
713 | * FIXME: Unreference surface here? | 701 | out_no_reference: |
714 | */ | 702 | ttm_base_object_unref(&base); |
715 | goto out; | 703 | |
716 | } | ||
717 | out: | ||
718 | vmw_resource_unreference(&res); | ||
719 | return ret; | 704 | return ret; |
720 | } | 705 | } |
721 | 706 | ||
722 | int vmw_surface_check(struct vmw_private *dev_priv, | 707 | int vmw_surface_check(struct vmw_private *dev_priv, |
723 | struct ttm_object_file *tfile, | 708 | struct ttm_object_file *tfile, |
724 | int id) | 709 | uint32_t handle, int *id) |
725 | { | 710 | { |
726 | struct vmw_resource *res; | 711 | struct ttm_base_object *base; |
727 | int ret = 0; | 712 | struct vmw_user_surface *user_srf; |
728 | 713 | ||
729 | read_lock(&dev_priv->resource_lock); | 714 | int ret = -EPERM; |
730 | res = idr_find(&dev_priv->surface_idr, id); | ||
731 | if (res && res->avail) { | ||
732 | struct vmw_surface *srf = | ||
733 | container_of(res, struct vmw_surface, res); | ||
734 | struct vmw_user_surface *usrf = | ||
735 | container_of(srf, struct vmw_user_surface, srf); | ||
736 | 715 | ||
737 | if (usrf->base.tfile != tfile && !usrf->base.shareable) | 716 | base = ttm_base_object_lookup(tfile, handle); |
738 | ret = -EPERM; | 717 | if (unlikely(base == NULL)) |
739 | } else | 718 | return -EINVAL; |
740 | ret = -EINVAL; | 719 | |
741 | read_unlock(&dev_priv->resource_lock); | 720 | if (unlikely(base->object_type != VMW_RES_SURFACE)) |
721 | goto out_bad_surface; | ||
742 | 722 | ||
723 | user_srf = container_of(base, struct vmw_user_surface, base); | ||
724 | *id = user_srf->srf.res.id; | ||
725 | ret = 0; | ||
726 | |||
727 | out_bad_surface: | ||
728 | /** | ||
729 | * FIXME: May deadlock here when called from the | ||
730 | * command parsing code. | ||
731 | */ | ||
732 | |||
733 | ttm_base_object_unref(&base); | ||
743 | return ret; | 734 | return ret; |
744 | } | 735 | } |
745 | 736 | ||