Lines Matching +full:mmu +full:- +full:500
1 // SPDX-License-Identifier: GPL-2.0-only
3 * Copyright (c) 2007-2011, Intel Corporation.
42 * to the different groups of PowerVR 5-series chip designs
46 * PowerVR SGX535 - Poulsbo - Intel GMA 500, Intel Atom Z5xx
47 * PowerVR SGX535 - Moorestown - Intel GMA 600
48 * PowerVR SGX535 - Oaktrail - Intel GMA 600, Intel Atom Z6xx, E6xx
49 * PowerVR SGX540 - Medfield - Intel Atom Z2460
50 * PowerVR SGX544MP2 - Medfield -
51 * PowerVR SGX545 - Cedartrail - Intel GMA 3600, Intel Atom D2500, N2600
52 * PowerVR SGX545 - Cedartrail - Intel GMA 3650, Intel Atom D2550, D2700,
109 struct drm_psb_private *dev_priv = dev->dev_private; in psb_do_init()
110 struct psb_gtt *pg = &dev_priv->gtt; in psb_do_init()
114 if (pg->mmu_gatt_start & 0x0FFFFFFF) { in psb_do_init()
115 dev_err(dev->dev, "Gatt must be 256M aligned. This is a bug.\n"); in psb_do_init()
116 return -EINVAL; in psb_do_init()
119 stolen_gtt = (pg->stolen_size >> PAGE_SHIFT) * 4; in psb_do_init()
120 stolen_gtt = (stolen_gtt + PAGE_SIZE - 1) >> PAGE_SHIFT; in psb_do_init()
121 stolen_gtt = (stolen_gtt < pg->gtt_pages) ? stolen_gtt : pg->gtt_pages; in psb_do_init()
123 dev_priv->gatt_free_offset = pg->mmu_gatt_start + in psb_do_init()
126 spin_lock_init(&dev_priv->irqmask_lock); in psb_do_init()
127 spin_lock_init(&dev_priv->lock_2d); in psb_do_init()
133 /* Do not bypass any MMU access, let them pagefault instead */ in psb_do_init()
141 PSB_WSGX32(pg->gatt_start, PSB_CR_BIF_TWOD_REQ_BASE); in psb_do_init()
149 struct drm_psb_private *dev_priv = dev->dev_private; in psb_driver_unload()
154 if (dev_priv->backlight_device) in psb_driver_unload()
158 if (dev_priv->ops->chip_teardown) in psb_driver_unload()
159 dev_priv->ops->chip_teardown(dev); in psb_driver_unload()
163 if (dev_priv->pf_pd) { in psb_driver_unload()
164 psb_mmu_free_pagedir(dev_priv->pf_pd); in psb_driver_unload()
165 dev_priv->pf_pd = NULL; in psb_driver_unload()
167 if (dev_priv->mmu) { in psb_driver_unload()
168 struct psb_gtt *pg = &dev_priv->gtt; in psb_driver_unload()
170 down_read(&pg->sem); in psb_driver_unload()
173 (dev_priv->mmu), in psb_driver_unload()
174 pg->mmu_gatt_start, in psb_driver_unload()
175 dev_priv->vram_stolen_size >> PAGE_SHIFT); in psb_driver_unload()
176 up_read(&pg->sem); in psb_driver_unload()
177 psb_mmu_driver_takedown(dev_priv->mmu); in psb_driver_unload()
178 dev_priv->mmu = NULL; in psb_driver_unload()
181 if (dev_priv->scratch_page) { in psb_driver_unload()
182 set_pages_wb(dev_priv->scratch_page, 1); in psb_driver_unload()
183 __free_page(dev_priv->scratch_page); in psb_driver_unload()
184 dev_priv->scratch_page = NULL; in psb_driver_unload()
186 if (dev_priv->vdc_reg) { in psb_driver_unload()
187 iounmap(dev_priv->vdc_reg); in psb_driver_unload()
188 dev_priv->vdc_reg = NULL; in psb_driver_unload()
190 if (dev_priv->sgx_reg) { in psb_driver_unload()
191 iounmap(dev_priv->sgx_reg); in psb_driver_unload()
192 dev_priv->sgx_reg = NULL; in psb_driver_unload()
194 if (dev_priv->aux_reg) { in psb_driver_unload()
195 iounmap(dev_priv->aux_reg); in psb_driver_unload()
196 dev_priv->aux_reg = NULL; in psb_driver_unload()
198 pci_dev_put(dev_priv->aux_pdev); in psb_driver_unload()
199 pci_dev_put(dev_priv->lpc_pdev); in psb_driver_unload()
205 dev->dev_private = NULL; in psb_driver_unload()
215 int ret = -ENOMEM; in psb_driver_load()
223 return -ENOMEM; in psb_driver_load()
225 dev_priv->ops = (struct psb_ops *)flags; in psb_driver_load()
226 dev_priv->dev = dev; in psb_driver_load()
227 dev->dev_private = (void *) dev_priv; in psb_driver_load()
229 pg = &dev_priv->gtt; in psb_driver_load()
231 pci_set_master(dev->pdev); in psb_driver_load()
233 dev_priv->num_pipe = dev_priv->ops->pipes; in psb_driver_load()
235 resource_start = pci_resource_start(dev->pdev, PSB_MMIO_RESOURCE); in psb_driver_load()
237 dev_priv->vdc_reg = in psb_driver_load()
239 if (!dev_priv->vdc_reg) in psb_driver_load()
242 dev_priv->sgx_reg = ioremap(resource_start + dev_priv->ops->sgx_offset, in psb_driver_load()
244 if (!dev_priv->sgx_reg) in psb_driver_load()
248 int domain = pci_domain_nr(dev->pdev->bus); in psb_driver_load()
250 dev_priv->aux_pdev = in psb_driver_load()
254 if (dev_priv->aux_pdev) { in psb_driver_load()
255 resource_start = pci_resource_start(dev_priv->aux_pdev, in psb_driver_load()
257 resource_len = pci_resource_len(dev_priv->aux_pdev, in psb_driver_load()
259 dev_priv->aux_reg = ioremap(resource_start, in psb_driver_load()
261 if (!dev_priv->aux_reg) in psb_driver_load()
267 dev_priv->aux_reg = dev_priv->vdc_reg; in psb_driver_load()
270 dev_priv->gmbus_reg = dev_priv->aux_reg; in psb_driver_load()
272 dev_priv->lpc_pdev = in psb_driver_load()
275 if (dev_priv->lpc_pdev) { in psb_driver_load()
276 pci_read_config_word(dev_priv->lpc_pdev, PSB_LPC_GBA, in psb_driver_load()
277 &dev_priv->lpc_gpio_base); in psb_driver_load()
278 pci_write_config_dword(dev_priv->lpc_pdev, PSB_LPC_GBA, in psb_driver_load()
279 (u32)dev_priv->lpc_gpio_base | (1L<<31)); in psb_driver_load()
280 pci_read_config_word(dev_priv->lpc_pdev, PSB_LPC_GBA, in psb_driver_load()
281 &dev_priv->lpc_gpio_base); in psb_driver_load()
282 dev_priv->lpc_gpio_base &= 0xffc0; in psb_driver_load()
283 if (dev_priv->lpc_gpio_base) in psb_driver_load()
285 dev_priv->lpc_gpio_base); in psb_driver_load()
287 pci_dev_put(dev_priv->lpc_pdev); in psb_driver_load()
288 dev_priv->lpc_pdev = NULL; in psb_driver_load()
292 dev_priv->gmbus_reg = dev_priv->vdc_reg; in psb_driver_load()
297 ret = dev_priv->ops->chip_setup(dev); in psb_driver_load()
304 ret = -ENOMEM; in psb_driver_load()
306 dev_priv->scratch_page = alloc_page(GFP_DMA32 | __GFP_ZERO); in psb_driver_load()
307 if (!dev_priv->scratch_page) in psb_driver_load()
310 set_pages_uc(dev_priv->scratch_page, 1); in psb_driver_load()
316 dev_priv->mmu = psb_mmu_driver_init(dev, 1, 0, 0); in psb_driver_load()
317 if (!dev_priv->mmu) in psb_driver_load()
320 dev_priv->pf_pd = psb_mmu_alloc_pd(dev_priv->mmu, 1, 0); in psb_driver_load()
321 if (!dev_priv->pf_pd) in psb_driver_load()
328 /* Add stolen memory to SGX MMU */ in psb_driver_load()
329 down_read(&pg->sem); in psb_driver_load()
330 ret = psb_mmu_insert_pfn_sequence(psb_mmu_get_default_pd(dev_priv->mmu), in psb_driver_load()
331 dev_priv->stolen_base >> PAGE_SHIFT, in psb_driver_load()
332 pg->gatt_start, in psb_driver_load()
333 pg->stolen_size >> PAGE_SHIFT, 0); in psb_driver_load()
334 up_read(&pg->sem); in psb_driver_load()
336 psb_mmu_set_pd_context(psb_mmu_get_default_pd(dev_priv->mmu), 0); in psb_driver_load()
337 psb_mmu_set_pd_context(dev_priv->pf_pd, 1); in psb_driver_load()
345 ret = drm_vblank_init(dev, dev_priv->num_pipe); in psb_driver_load()
353 dev_priv->vdc_irq_mask = 0; in psb_driver_load()
354 dev_priv->pipestat[0] = 0; in psb_driver_load()
355 dev_priv->pipestat[1] = 0; in psb_driver_load()
356 dev_priv->pipestat[2] = 0; in psb_driver_load()
357 spin_lock_irqsave(&dev_priv->irqmask_lock, irqflags); in psb_driver_load()
361 spin_unlock_irqrestore(&dev_priv->irqmask_lock, irqflags); in psb_driver_load()
363 drm_irq_install(dev, dev->pdev->irq); in psb_driver_load()
365 dev->max_vblank_count = 0xffffff; /* only 24 bits of frame count */ in psb_driver_load()
372 list_for_each_entry(connector, &dev->mode_config.connector_list, in psb_driver_load()
376 switch (gma_encoder->type) { in psb_driver_load()
389 pm_runtime_enable(&dev->pdev->dev); in psb_driver_load()
390 pm_runtime_set_active(&dev->pdev->dev); in psb_driver_load()
403 bd->props.brightness = bd->ops->get_brightness(bd); in get_brightness()
412 struct drm_file *file_priv = filp->private_data; in psb_unlocked_ioctl()
413 struct drm_device *dev = file_priv->minor->dev; in psb_unlocked_ioctl()
414 struct drm_psb_private *dev_priv = dev->dev_private; in psb_unlocked_ioctl()
417 if (runtime_allowed == 1 && dev_priv->is_lvds_on) { in psb_unlocked_ioctl()
419 pm_runtime_allow(&dev->pdev->dev); in psb_unlocked_ioctl()
420 dev_priv->rpm_enabled = 1; in psb_unlocked_ioctl()
435 dev = drm_dev_alloc(&driver, &pdev->dev); in psb_pci_probe()
441 dev->pdev = pdev; in psb_pci_probe()
444 ret = psb_driver_load(dev, ent->driver_data); in psb_pci_probe()
448 ret = drm_dev_register(dev, ent->driver_data); in psb_pci_probe()