aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/gpu/drm/gma500/psb_drv.c134
-rw-r--r--drivers/gpu/drm/gma500/psb_drv.h22
2 files changed, 76 insertions, 80 deletions
diff --git a/drivers/gpu/drm/gma500/psb_drv.c b/drivers/gpu/drm/gma500/psb_drv.c
index 37d651298525..8113e447afaf 100644
--- a/drivers/gpu/drm/gma500/psb_drv.c
+++ b/drivers/gpu/drm/gma500/psb_drv.c
@@ -36,50 +36,51 @@
36#include <acpi/video.h> 36#include <acpi/video.h>
37#include <linux/module.h> 37#include <linux/module.h>
38 38
39static int psb_probe(struct pci_dev *pdev, const struct pci_device_id *ent); 39static struct drm_driver driver;
40static int psb_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent);
40 41
41static DEFINE_PCI_DEVICE_TABLE(pciidlist) = { 42static DEFINE_PCI_DEVICE_TABLE(pciidlist) = {
42 { 0x8086, 0x8108, PCI_ANY_ID, PCI_ANY_ID, 0, 0, (long) &psb_chip_ops }, 43 { 0x8086, 0x8108, PCI_ANY_ID, PCI_ANY_ID, 0, 0, (long) &psb_chip_ops },
43 { 0x8086, 0x8109, PCI_ANY_ID, PCI_ANY_ID, 0, 0, (long) &psb_chip_ops }, 44 { 0x8086, 0x8109, PCI_ANY_ID, PCI_ANY_ID, 0, 0, (long) &psb_chip_ops },
44#if defined(CONFIG_DRM_GMA600) 45#if defined(CONFIG_DRM_GMA600)
45 { 0x8086, 0x4100, PCI_ANY_ID, PCI_ANY_ID, 0, 0, (long) &oaktrail_chip_ops},
46 { 0x8086, 0x4101, PCI_ANY_ID, PCI_ANY_ID, 0, 0, (long) &oaktrail_chip_ops},
47 { 0x8086, 0x4102, PCI_ANY_ID, PCI_ANY_ID, 0, 0, (long) &oaktrail_chip_ops},
48 { 0x8086, 0x4103, PCI_ANY_ID, PCI_ANY_ID, 0, 0, (long) &oaktrail_chip_ops},
49 { 0x8086, 0x4104, PCI_ANY_ID, PCI_ANY_ID, 0, 0, (long) &oaktrail_chip_ops},
50 { 0x8086, 0x4105, PCI_ANY_ID, PCI_ANY_ID, 0, 0, (long) &oaktrail_chip_ops},
51 { 0x8086, 0x4106, PCI_ANY_ID, PCI_ANY_ID, 0, 0, (long) &oaktrail_chip_ops},
52 { 0x8086, 0x4107, PCI_ANY_ID, PCI_ANY_ID, 0, 0, (long) &oaktrail_chip_ops},
53 /* Atom E620 */ 46 /* Atom E620 */
54 { 0x8086, 0x4108, PCI_ANY_ID, PCI_ANY_ID, 0, 0, (long) &oaktrail_chip_ops}, 47 { 0x8086, 0x4100, PCI_ANY_ID, PCI_ANY_ID, 0, 0, (long) &oaktrail_chip_ops },
48 { 0x8086, 0x4101, PCI_ANY_ID, PCI_ANY_ID, 0, 0, (long) &oaktrail_chip_ops },
49 { 0x8086, 0x4102, PCI_ANY_ID, PCI_ANY_ID, 0, 0, (long) &oaktrail_chip_ops },
50 { 0x8086, 0x4103, PCI_ANY_ID, PCI_ANY_ID, 0, 0, (long) &oaktrail_chip_ops },
51 { 0x8086, 0x4104, PCI_ANY_ID, PCI_ANY_ID, 0, 0, (long) &oaktrail_chip_ops },
52 { 0x8086, 0x4105, PCI_ANY_ID, PCI_ANY_ID, 0, 0, (long) &oaktrail_chip_ops },
53 { 0x8086, 0x4106, PCI_ANY_ID, PCI_ANY_ID, 0, 0, (long) &oaktrail_chip_ops },
54 { 0x8086, 0x4107, PCI_ANY_ID, PCI_ANY_ID, 0, 0, (long) &oaktrail_chip_ops },
55 { 0x8086, 0x4108, PCI_ANY_ID, PCI_ANY_ID, 0, 0, (long) &oaktrail_chip_ops },
55#endif 56#endif
56#if defined(CONFIG_DRM_MEDFIELD) 57#if defined(CONFIG_DRM_MEDFIELD)
57 {0x8086, 0x0130, PCI_ANY_ID, PCI_ANY_ID, 0, 0, (long) &mdfld_chip_ops}, 58 { 0x8086, 0x0130, PCI_ANY_ID, PCI_ANY_ID, 0, 0, (long) &mdfld_chip_ops },
58 {0x8086, 0x0131, PCI_ANY_ID, PCI_ANY_ID, 0, 0, (long) &mdfld_chip_ops}, 59 { 0x8086, 0x0131, PCI_ANY_ID, PCI_ANY_ID, 0, 0, (long) &mdfld_chip_ops },
59 {0x8086, 0x0132, PCI_ANY_ID, PCI_ANY_ID, 0, 0, (long) &mdfld_chip_ops}, 60 { 0x8086, 0x0132, PCI_ANY_ID, PCI_ANY_ID, 0, 0, (long) &mdfld_chip_ops },
60 {0x8086, 0x0133, PCI_ANY_ID, PCI_ANY_ID, 0, 0, (long) &mdfld_chip_ops}, 61 { 0x8086, 0x0133, PCI_ANY_ID, PCI_ANY_ID, 0, 0, (long) &mdfld_chip_ops },
61 {0x8086, 0x0134, PCI_ANY_ID, PCI_ANY_ID, 0, 0, (long) &mdfld_chip_ops}, 62 { 0x8086, 0x0134, PCI_ANY_ID, PCI_ANY_ID, 0, 0, (long) &mdfld_chip_ops },
62 {0x8086, 0x0135, PCI_ANY_ID, PCI_ANY_ID, 0, 0, (long) &mdfld_chip_ops}, 63 { 0x8086, 0x0135, PCI_ANY_ID, PCI_ANY_ID, 0, 0, (long) &mdfld_chip_ops },
63 {0x8086, 0x0136, PCI_ANY_ID, PCI_ANY_ID, 0, 0, (long) &mdfld_chip_ops}, 64 { 0x8086, 0x0136, PCI_ANY_ID, PCI_ANY_ID, 0, 0, (long) &mdfld_chip_ops },
64 {0x8086, 0x0137, PCI_ANY_ID, PCI_ANY_ID, 0, 0, (long) &mdfld_chip_ops}, 65 { 0x8086, 0x0137, PCI_ANY_ID, PCI_ANY_ID, 0, 0, (long) &mdfld_chip_ops },
65#endif 66#endif
66#if defined(CONFIG_DRM_GMA3600) 67#if defined(CONFIG_DRM_GMA3600)
67 { 0x8086, 0x0be0, PCI_ANY_ID, PCI_ANY_ID, 0, 0, (long) &cdv_chip_ops}, 68 { 0x8086, 0x0be0, PCI_ANY_ID, PCI_ANY_ID, 0, 0, (long) &cdv_chip_ops },
68 { 0x8086, 0x0be1, PCI_ANY_ID, PCI_ANY_ID, 0, 0, (long) &cdv_chip_ops}, 69 { 0x8086, 0x0be1, PCI_ANY_ID, PCI_ANY_ID, 0, 0, (long) &cdv_chip_ops },
69 { 0x8086, 0x0be2, PCI_ANY_ID, PCI_ANY_ID, 0, 0, (long) &cdv_chip_ops}, 70 { 0x8086, 0x0be2, PCI_ANY_ID, PCI_ANY_ID, 0, 0, (long) &cdv_chip_ops },
70 { 0x8086, 0x0be3, PCI_ANY_ID, PCI_ANY_ID, 0, 0, (long) &cdv_chip_ops}, 71 { 0x8086, 0x0be3, PCI_ANY_ID, PCI_ANY_ID, 0, 0, (long) &cdv_chip_ops },
71 { 0x8086, 0x0be4, PCI_ANY_ID, PCI_ANY_ID, 0, 0, (long) &cdv_chip_ops}, 72 { 0x8086, 0x0be4, PCI_ANY_ID, PCI_ANY_ID, 0, 0, (long) &cdv_chip_ops },
72 { 0x8086, 0x0be5, PCI_ANY_ID, PCI_ANY_ID, 0, 0, (long) &cdv_chip_ops}, 73 { 0x8086, 0x0be5, PCI_ANY_ID, PCI_ANY_ID, 0, 0, (long) &cdv_chip_ops },
73 { 0x8086, 0x0be6, PCI_ANY_ID, PCI_ANY_ID, 0, 0, (long) &cdv_chip_ops}, 74 { 0x8086, 0x0be6, PCI_ANY_ID, PCI_ANY_ID, 0, 0, (long) &cdv_chip_ops },
74 { 0x8086, 0x0be7, PCI_ANY_ID, PCI_ANY_ID, 0, 0, (long) &cdv_chip_ops}, 75 { 0x8086, 0x0be7, PCI_ANY_ID, PCI_ANY_ID, 0, 0, (long) &cdv_chip_ops },
75 { 0x8086, 0x0be8, PCI_ANY_ID, PCI_ANY_ID, 0, 0, (long) &cdv_chip_ops}, 76 { 0x8086, 0x0be8, PCI_ANY_ID, PCI_ANY_ID, 0, 0, (long) &cdv_chip_ops },
76 { 0x8086, 0x0be9, PCI_ANY_ID, PCI_ANY_ID, 0, 0, (long) &cdv_chip_ops}, 77 { 0x8086, 0x0be9, PCI_ANY_ID, PCI_ANY_ID, 0, 0, (long) &cdv_chip_ops },
77 { 0x8086, 0x0bea, PCI_ANY_ID, PCI_ANY_ID, 0, 0, (long) &cdv_chip_ops}, 78 { 0x8086, 0x0bea, PCI_ANY_ID, PCI_ANY_ID, 0, 0, (long) &cdv_chip_ops },
78 { 0x8086, 0x0beb, PCI_ANY_ID, PCI_ANY_ID, 0, 0, (long) &cdv_chip_ops}, 79 { 0x8086, 0x0beb, PCI_ANY_ID, PCI_ANY_ID, 0, 0, (long) &cdv_chip_ops },
79 { 0x8086, 0x0bec, PCI_ANY_ID, PCI_ANY_ID, 0, 0, (long) &cdv_chip_ops}, 80 { 0x8086, 0x0bec, PCI_ANY_ID, PCI_ANY_ID, 0, 0, (long) &cdv_chip_ops },
80 { 0x8086, 0x0bed, PCI_ANY_ID, PCI_ANY_ID, 0, 0, (long) &cdv_chip_ops}, 81 { 0x8086, 0x0bed, PCI_ANY_ID, PCI_ANY_ID, 0, 0, (long) &cdv_chip_ops },
81 { 0x8086, 0x0bee, PCI_ANY_ID, PCI_ANY_ID, 0, 0, (long) &cdv_chip_ops}, 82 { 0x8086, 0x0bee, PCI_ANY_ID, PCI_ANY_ID, 0, 0, (long) &cdv_chip_ops },
82 { 0x8086, 0x0bef, PCI_ANY_ID, PCI_ANY_ID, 0, 0, (long) &cdv_chip_ops}, 83 { 0x8086, 0x0bef, PCI_ANY_ID, PCI_ANY_ID, 0, 0, (long) &cdv_chip_ops },
83#endif 84#endif
84 { 0, } 85 { 0, }
85}; 86};
@@ -91,7 +92,7 @@ MODULE_DEVICE_TABLE(pci, pciidlist);
91static const struct drm_ioctl_desc psb_ioctls[] = { 92static const struct drm_ioctl_desc psb_ioctls[] = {
92}; 93};
93 94
94static void psb_lastclose(struct drm_device *dev) 95static void psb_driver_lastclose(struct drm_device *dev)
95{ 96{
96 int ret; 97 int ret;
97 struct drm_psb_private *dev_priv = dev->dev_private; 98 struct drm_psb_private *dev_priv = dev->dev_private;
@@ -118,11 +119,9 @@ static int psb_do_init(struct drm_device *dev)
118 return -EINVAL; 119 return -EINVAL;
119 } 120 }
120 121
121
122 stolen_gtt = (pg->stolen_size >> PAGE_SHIFT) * 4; 122 stolen_gtt = (pg->stolen_size >> PAGE_SHIFT) * 4;
123 stolen_gtt = (stolen_gtt + PAGE_SIZE - 1) >> PAGE_SHIFT; 123 stolen_gtt = (stolen_gtt + PAGE_SIZE - 1) >> PAGE_SHIFT;
124 stolen_gtt = 124 stolen_gtt = (stolen_gtt < pg->gtt_pages) ? stolen_gtt : pg->gtt_pages;
125 (stolen_gtt < pg->gtt_pages) ? stolen_gtt : pg->gtt_pages;
126 125
127 dev_priv->gatt_free_offset = pg->mmu_gatt_start + 126 dev_priv->gatt_free_offset = pg->mmu_gatt_start +
128 (stolen_gtt << PAGE_SHIFT) * 1024; 127 (stolen_gtt << PAGE_SHIFT) * 1024;
@@ -213,8 +212,7 @@ static int psb_driver_unload(struct drm_device *dev)
213 return 0; 212 return 0;
214} 213}
215 214
216 215static int psb_driver_load(struct drm_device *dev, unsigned long flags)
217static int psb_driver_load(struct drm_device *dev, unsigned long chipset)
218{ 216{
219 struct drm_psb_private *dev_priv; 217 struct drm_psb_private *dev_priv;
220 unsigned long resource_start, resource_len; 218 unsigned long resource_start, resource_len;
@@ -228,7 +226,7 @@ static int psb_driver_load(struct drm_device *dev, unsigned long chipset)
228 if (dev_priv == NULL) 226 if (dev_priv == NULL)
229 return -ENOMEM; 227 return -ENOMEM;
230 228
231 dev_priv->ops = (struct psb_ops *)chipset; 229 dev_priv->ops = (struct psb_ops *)flags;
232 dev_priv->dev = dev; 230 dev_priv->dev = dev;
233 dev->dev_private = (void *) dev_priv; 231 dev->dev_private = (void *) dev_priv;
234 232
@@ -344,9 +342,7 @@ static int psb_driver_load(struct drm_device *dev, unsigned long chipset)
344 drm_irq_install(dev); 342 drm_irq_install(dev);
345 343
346 dev->vblank_disable_allowed = true; 344 dev->vblank_disable_allowed = true;
347
348 dev->max_vblank_count = 0xffffff; /* only 24 bits of frame count */ 345 dev->max_vblank_count = 0xffffff; /* only 24 bits of frame count */
349
350 dev->driver->get_vblank_counter = psb_get_vblank_counter; 346 dev->driver->get_vblank_counter = psb_get_vblank_counter;
351 347
352 psb_modeset_init(dev); 348 psb_modeset_init(dev);
@@ -401,7 +397,7 @@ static int psb_driver_open(struct drm_device *dev, struct drm_file *priv)
401 return 0; 397 return 0;
402} 398}
403 399
404static void psb_driver_close(struct drm_device *dev, struct drm_file *priv) 400static void psb_driver_postclose(struct drm_device *dev, struct drm_file *priv)
405{ 401{
406} 402}
407 403
@@ -422,15 +418,21 @@ static long psb_unlocked_ioctl(struct file *filp, unsigned int cmd,
422 /* FIXME: do we need to wrap the other side of this */ 418 /* FIXME: do we need to wrap the other side of this */
423} 419}
424 420
425 421/*
426/* When a client dies: 422 * When a client dies:
427 * - Check for and clean up flipped page state 423 * - Check for and clean up flipped page state
428 */ 424 */
429static void psb_driver_preclose(struct drm_device *dev, struct drm_file *priv) 425static void psb_driver_preclose(struct drm_device *dev, struct drm_file *priv)
430{ 426{
431} 427}
432 428
433static void psb_remove(struct pci_dev *pdev) 429static int psb_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
430{
431 return drm_get_pci_dev(pdev, ent, &driver);
432}
433
434
435static void psb_pci_remove(struct pci_dev *pdev)
434{ 436{
435 struct drm_device *dev = pci_get_drvdata(pdev); 437 struct drm_device *dev = pci_get_drvdata(pdev);
436 drm_put_dev(dev); 438 drm_put_dev(dev);
@@ -465,11 +467,14 @@ static const struct file_operations psb_gem_fops = {
465 467
466static struct drm_driver driver = { 468static struct drm_driver driver = {
467 .driver_features = DRIVER_HAVE_IRQ | DRIVER_IRQ_SHARED | \ 469 .driver_features = DRIVER_HAVE_IRQ | DRIVER_IRQ_SHARED | \
468 DRIVER_MODESET | DRIVER_GEM , 470 DRIVER_MODESET | DRIVER_GEM,
469 .load = psb_driver_load, 471 .load = psb_driver_load,
470 .unload = psb_driver_unload, 472 .unload = psb_driver_unload,
473 .open = psb_driver_open,
474 .lastclose = psb_driver_lastclose,
475 .preclose = psb_driver_preclose,
476 .postclose = psb_driver_postclose,
471 477
472 .ioctls = psb_ioctls,
473 .num_ioctls = DRM_ARRAY_SIZE(psb_ioctls), 478 .num_ioctls = DRM_ARRAY_SIZE(psb_ioctls),
474 .device_is_agp = psb_driver_device_is_agp, 479 .device_is_agp = psb_driver_device_is_agp,
475 .irq_preinstall = psb_irq_preinstall, 480 .irq_preinstall = psb_irq_preinstall,
@@ -479,40 +484,31 @@ static struct drm_driver driver = {
479 .enable_vblank = psb_enable_vblank, 484 .enable_vblank = psb_enable_vblank,
480 .disable_vblank = psb_disable_vblank, 485 .disable_vblank = psb_disable_vblank,
481 .get_vblank_counter = psb_get_vblank_counter, 486 .get_vblank_counter = psb_get_vblank_counter,
482 .lastclose = psb_lastclose,
483 .open = psb_driver_open,
484 .preclose = psb_driver_preclose,
485 .postclose = psb_driver_close,
486 487
487 .gem_free_object = psb_gem_free_object, 488 .gem_free_object = psb_gem_free_object,
488 .gem_vm_ops = &psb_gem_vm_ops, 489 .gem_vm_ops = &psb_gem_vm_ops,
490
489 .dumb_create = psb_gem_dumb_create, 491 .dumb_create = psb_gem_dumb_create,
490 .dumb_map_offset = psb_gem_dumb_map_gtt, 492 .dumb_map_offset = psb_gem_dumb_map_gtt,
491 .dumb_destroy = drm_gem_dumb_destroy, 493 .dumb_destroy = drm_gem_dumb_destroy,
494 .ioctls = psb_ioctls,
492 .fops = &psb_gem_fops, 495 .fops = &psb_gem_fops,
493 .name = DRIVER_NAME, 496 .name = DRIVER_NAME,
494 .desc = DRIVER_DESC, 497 .desc = DRIVER_DESC,
495 .date = PSB_DRM_DRIVER_DATE, 498 .date = DRIVER_DATE,
496 .major = PSB_DRM_DRIVER_MAJOR, 499 .major = DRIVER_MAJOR,
497 .minor = PSB_DRM_DRIVER_MINOR, 500 .minor = DRIVER_MINOR,
498 .patchlevel = PSB_DRM_DRIVER_PATCHLEVEL 501 .patchlevel = DRIVER_PATCHLEVEL
499}; 502};
500 503
501static struct pci_driver psb_pci_driver = { 504static struct pci_driver psb_pci_driver = {
502 .name = DRIVER_NAME, 505 .name = DRIVER_NAME,
503 .id_table = pciidlist, 506 .id_table = pciidlist,
504 .probe = psb_probe, 507 .probe = psb_pci_probe,
505 .remove = psb_remove, 508 .remove = psb_pci_remove,
506 .driver = { 509 .driver.pm = &psb_pm_ops,
507 .pm = &psb_pm_ops,
508 }
509}; 510};
510 511
511static int psb_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
512{
513 return drm_get_pci_dev(pdev, ent, &driver);
514}
515
516static int __init psb_init(void) 512static int __init psb_init(void)
517{ 513{
518 return drm_pci_init(&driver, &psb_pci_driver); 514 return drm_pci_init(&driver, &psb_pci_driver);
@@ -526,6 +522,6 @@ static void __exit psb_exit(void)
526late_initcall(psb_init); 522late_initcall(psb_init);
527module_exit(psb_exit); 523module_exit(psb_exit);
528 524
529MODULE_AUTHOR("Alan Cox <alan@linux.intel.com> and others"); 525MODULE_AUTHOR(DRIVER_AUTHOR);
530MODULE_DESCRIPTION(DRIVER_DESC); 526MODULE_DESCRIPTION(DRIVER_DESC);
531MODULE_LICENSE("GPL"); 527MODULE_LICENSE(DRIVER_LICENSE);
diff --git a/drivers/gpu/drm/gma500/psb_drv.h b/drivers/gpu/drm/gma500/psb_drv.h
index d5421c072b6b..6f99be47b4f5 100644
--- a/drivers/gpu/drm/gma500/psb_drv.h
+++ b/drivers/gpu/drm/gma500/psb_drv.h
@@ -35,6 +35,17 @@
35#include "oaktrail.h" 35#include "oaktrail.h"
36#include "mmu.h" 36#include "mmu.h"
37 37
38#define DRIVER_AUTHOR "Alan Cox <alan@linux.intel.com> and others"
39#define DRIVER_LICENSE "GPL"
40
41#define DRIVER_NAME "gma500"
42#define DRIVER_DESC "DRM driver for the Intel GMA500, GMA600, GMA3600, GMA3650"
43#define DRIVER_DATE "20140314"
44
45#define DRIVER_MAJOR 1
46#define DRIVER_MINOR 0
47#define DRIVER_PATCHLEVEL 0
48
38/* Append new drm mode definition here, align with libdrm definition */ 49/* Append new drm mode definition here, align with libdrm definition */
39#define DRM_MODE_SCALE_NO_SCALE 2 50#define DRM_MODE_SCALE_NO_SCALE 2
40 51
@@ -50,17 +61,6 @@ enum {
50#define IS_MFLD(dev) (((dev)->pdev->device & 0xfff8) == 0x0130) 61#define IS_MFLD(dev) (((dev)->pdev->device & 0xfff8) == 0x0130)
51#define IS_CDV(dev) (((dev)->pdev->device & 0xfff0) == 0x0be0) 62#define IS_CDV(dev) (((dev)->pdev->device & 0xfff0) == 0x0be0)
52 63
53/*
54 * Driver definitions
55 */
56
57#define DRIVER_NAME "gma500"
58#define DRIVER_DESC "DRM driver for the Intel GMA500"
59
60#define PSB_DRM_DRIVER_DATE "2011-06-06"
61#define PSB_DRM_DRIVER_MAJOR 1
62#define PSB_DRM_DRIVER_MINOR 0
63#define PSB_DRM_DRIVER_PATCHLEVEL 0
64 64
65/* 65/*
66 * Hardware offsets 66 * Hardware offsets