mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2024-12-14 12:46:49 +07:00
6c56e8adc0
UAPI Changes: - Add support for DMA-BUF HEAPS. Cross-subsystem Changes: - mipi dsi definition updates, pulled into drm-intel as well. - Add lockdep annotations for dma_resv vs mmap_sem and fs_reclaim. - Remove support for dma-buf kmap/kunmap. - Constify fb_ops in all fbdev drivers, including drm drivers and drm-core, and media as well. Core Changes: - Small cleanups to ttm. - Fix SCDC definition. - Assorted cleanups to core. - Add todo to remove load/unload hooks, and use generic fbdev emulation. - Assorted documentation updates. - Use blocking ww lock in ttm fault handler. - Remove drm_fb_helper_fbdev_setup/teardown. - Warning fixes with W=1 for atomic. - Use drm_debug_enabled() instead of drm_debug flag testing in various drivers. - Fallback to nontiled mode in fbdev emulation when not all tiles are present. (Later on reverted) - Various kconfig indentation fixes in core and drivers. - Fix freeing transactions in dp-mst correctly. - Sean Paul is steping down as core maintainer. :-( - Add lockdep annotations for atomic locks vs dma-resv. - Prevent use-after-free for a bad job in drm_scheduler. - Fill out all block sizes in the P01x and P210 definitions. - Avoid division by zero in drm/rect, and fix bounds. - Add drm/rect selftests. - Add aspect ratio and alternate clocks for HDMI 4k modes. - Add todo for drm_framebuffer_funcs and fb_create cleanup. - Drop DRM_AUTH for prime import/export ioctls. - Clear DP-MST payload id tables downstream when initializating. - Fix for DSC throughput definition. - Add extra FEC definitions. - Fix fake offset in drm_gem_object_funs.mmap. - Stop using encoder->bridge in core directly - Handle bridge chaining slightly better. - Add backlight support to drm/panel, and use it in many panel drivers. - Increase max number of y420 modes from 128 to 256, as preparation to add the new modes. Driver Changes: - Small fixes all over. - Fix documentation in vkms. - Fix mmap_sem vs dma_resv in nouveau. - Small cleanup in komeda. - Add page flip support in gma500 for psb/cdv. - Add ddc symlink in the connector sysfs directory for many drivers. - Add support for analogic an6345, and fix small bugs in it. - Add atomic modesetting support to ast. - Fix radeon fault handler VMA race. - Switch udl to use generic shmem helpers. - Unconditional vblank handling for mcde. - Miscellaneous fixes to mcde. - Tweak debug output from komeda using debugfs. - Add gamma and color transform support to komeda for DOU-IPS. - Add support for sony acx424AKP panel. - Various small cleanups to gma500. - Use generic fbdev emulation in udl, and replace udl_framebuffer with generic implementation. - Add support for Logic PD Type 28 panel. - Use drm_panel_* wrapper functions in exynos/tegra/msm. - Add devicetree bindings for generic DSI panels. - Don't include drm_pci.h directly in many drivers. - Add support for begin/end_cpu_access in udmabuf. - Stop using drm_get_pci_dev in gma500 and mga200. - Fixes to UDL damage handling, and use dma_buf_begin/end_cpu_access. - Add devfreq thermal support to panfrost. - Fix hotplug with daisy chained monitors by removing VCPI when disabling topology manager. - meson: Add support for OSD1 plane AFBC commit. - Stop displaying garbage when toggling ast primary plane on/off. - More cleanups and fixes to UDL. - Add D32 suport to komeda. - Remove globle copy of drm_dev in gma500. - Add support for Boe Himax8279d MIPI-DSI LCD panel. - Add support for ingenic JZ4770 panel. - Small null pointer deference fix in ingenic. - Remove support for the special tfp420 driver, as there is a generic way to do it. -----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEEuXvWqAysSYEJGuVH/lWMcqZwE8MFAl34lkkACgkQ/lWMcqZw E8M76g//WRYl9fWnV063s44FBVJYjGxaus0vQJSGidaPCIE6Ep6TNjXp8DVzV82M HR79P9glL02DC9B8pflioNNXdIRGSVk/FJcKVB2seFAqEFCAknvWDM/X/y+mOUpp fUeFl+Znlwx3YlM8f4Qujdbm+CbTewfbya4VAWeWd8XG2V8jfq5cmODPPlUMNenZ J6Ja+W3ph741uSIfAKaP69LVJgOcuUjXINE4SWhRk/i5QF3GIRej/A7ZjWGLQ/t2 2zUUF7EiCzhPomM40H3ddKtXb4ZjNJuc5pOD4GpxR8ciNbe2gUOHEZ5aenwYBdsU 5MwbxNKyMbKXATtn3yv3fSc4jH3DtmEKpmovONeO8ZDBrQBnxeYa3tQvfkNghA2f acoZMzYUImV+ft6DMIgpXppASvo7mQYDAbLPOGEJ9E44AL4UP00jesEjnK5FOHSR 3BEzGUnK/6QL5zFNPni8YZQ8dan4jDIno1mqIV+cQ4WCGlaKckzIWO6243Bf13b/ kROSJpgWkiK6Ngq0ofhD0MHyT/m1QnqUzWRKTJhRtPflSWRBsDZqWCQ5Vx1QlNIE /HfTNbTpXWwa+5wXbbB8TkDw5t9cQGnR+QcrEd9HgoIec7B5Re8rx9i0TJAT4N05 03RCQCecSfD8gwKd2wgaFIpFGRl9lTdLYSpffSmyL2X5a20lZhM= =b15X -----END PGP SIGNATURE----- Merge tag 'drm-misc-next-2019-12-16' of git://anongit.freedesktop.org/drm/drm-misc into drm-next drm-misc-next for v5.6: UAPI Changes: - Add support for DMA-BUF HEAPS. Cross-subsystem Changes: - mipi dsi definition updates, pulled into drm-intel as well. - Add lockdep annotations for dma_resv vs mmap_sem and fs_reclaim. - Remove support for dma-buf kmap/kunmap. - Constify fb_ops in all fbdev drivers, including drm drivers and drm-core, and media as well. Core Changes: - Small cleanups to ttm. - Fix SCDC definition. - Assorted cleanups to core. - Add todo to remove load/unload hooks, and use generic fbdev emulation. - Assorted documentation updates. - Use blocking ww lock in ttm fault handler. - Remove drm_fb_helper_fbdev_setup/teardown. - Warning fixes with W=1 for atomic. - Use drm_debug_enabled() instead of drm_debug flag testing in various drivers. - Fallback to nontiled mode in fbdev emulation when not all tiles are present. (Later on reverted) - Various kconfig indentation fixes in core and drivers. - Fix freeing transactions in dp-mst correctly. - Sean Paul is steping down as core maintainer. :-( - Add lockdep annotations for atomic locks vs dma-resv. - Prevent use-after-free for a bad job in drm_scheduler. - Fill out all block sizes in the P01x and P210 definitions. - Avoid division by zero in drm/rect, and fix bounds. - Add drm/rect selftests. - Add aspect ratio and alternate clocks for HDMI 4k modes. - Add todo for drm_framebuffer_funcs and fb_create cleanup. - Drop DRM_AUTH for prime import/export ioctls. - Clear DP-MST payload id tables downstream when initializating. - Fix for DSC throughput definition. - Add extra FEC definitions. - Fix fake offset in drm_gem_object_funs.mmap. - Stop using encoder->bridge in core directly - Handle bridge chaining slightly better. - Add backlight support to drm/panel, and use it in many panel drivers. - Increase max number of y420 modes from 128 to 256, as preparation to add the new modes. Driver Changes: - Small fixes all over. - Fix documentation in vkms. - Fix mmap_sem vs dma_resv in nouveau. - Small cleanup in komeda. - Add page flip support in gma500 for psb/cdv. - Add ddc symlink in the connector sysfs directory for many drivers. - Add support for analogic an6345, and fix small bugs in it. - Add atomic modesetting support to ast. - Fix radeon fault handler VMA race. - Switch udl to use generic shmem helpers. - Unconditional vblank handling for mcde. - Miscellaneous fixes to mcde. - Tweak debug output from komeda using debugfs. - Add gamma and color transform support to komeda for DOU-IPS. - Add support for sony acx424AKP panel. - Various small cleanups to gma500. - Use generic fbdev emulation in udl, and replace udl_framebuffer with generic implementation. - Add support for Logic PD Type 28 panel. - Use drm_panel_* wrapper functions in exynos/tegra/msm. - Add devicetree bindings for generic DSI panels. - Don't include drm_pci.h directly in many drivers. - Add support for begin/end_cpu_access in udmabuf. - Stop using drm_get_pci_dev in gma500 and mga200. - Fixes to UDL damage handling, and use dma_buf_begin/end_cpu_access. - Add devfreq thermal support to panfrost. - Fix hotplug with daisy chained monitors by removing VCPI when disabling topology manager. - meson: Add support for OSD1 plane AFBC commit. - Stop displaying garbage when toggling ast primary plane on/off. - More cleanups and fixes to UDL. - Add D32 suport to komeda. - Remove globle copy of drm_dev in gma500. - Add support for Boe Himax8279d MIPI-DSI LCD panel. - Add support for ingenic JZ4770 panel. - Small null pointer deference fix in ingenic. - Remove support for the special tfp420 driver, as there is a generic way to do it. Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch> From: Maarten Lankhorst <maarten.lankhorst@linux.intel.com> Link: https://patchwork.freedesktop.org/patch/msgid/ba73535a-9334-5302-2e1f-5208bd7390bd@linux.intel.com
212 lines
4.6 KiB
C
212 lines
4.6 KiB
C
// SPDX-License-Identifier: GPL-2.0-only
|
|
/*
|
|
* Copyright 2010 Matt Turner.
|
|
* Copyright 2012 Red Hat
|
|
*
|
|
* Authors: Matthew Garrett
|
|
* Matt Turner
|
|
* Dave Airlie
|
|
*/
|
|
|
|
#include <linux/pci.h>
|
|
|
|
#include <drm/drm_crtc_helper.h>
|
|
#include <drm/drm_gem_framebuffer_helper.h>
|
|
|
|
#include "mgag200_drv.h"
|
|
|
|
static const struct drm_mode_config_funcs mga_mode_funcs = {
|
|
.fb_create = drm_gem_fb_create
|
|
};
|
|
|
|
static int mga_probe_vram(struct mga_device *mdev, void __iomem *mem)
|
|
{
|
|
int offset;
|
|
int orig;
|
|
int test1, test2;
|
|
int orig1, orig2;
|
|
unsigned int vram_size;
|
|
|
|
/* Probe */
|
|
orig = ioread16(mem);
|
|
iowrite16(0, mem);
|
|
|
|
vram_size = mdev->mc.vram_window;
|
|
|
|
if ((mdev->type == G200_EW3) && (vram_size >= 0x1000000)) {
|
|
vram_size = vram_size - 0x400000;
|
|
}
|
|
|
|
for (offset = 0x100000; offset < vram_size; offset += 0x4000) {
|
|
orig1 = ioread8(mem + offset);
|
|
orig2 = ioread8(mem + offset + 0x100);
|
|
|
|
iowrite16(0xaa55, mem + offset);
|
|
iowrite16(0xaa55, mem + offset + 0x100);
|
|
|
|
test1 = ioread16(mem + offset);
|
|
test2 = ioread16(mem);
|
|
|
|
iowrite16(orig1, mem + offset);
|
|
iowrite16(orig2, mem + offset + 0x100);
|
|
|
|
if (test1 != 0xaa55) {
|
|
break;
|
|
}
|
|
|
|
if (test2) {
|
|
break;
|
|
}
|
|
}
|
|
|
|
iowrite16(orig, mem);
|
|
return offset - 65536;
|
|
}
|
|
|
|
/* Map the framebuffer from the card and configure the core */
|
|
static int mga_vram_init(struct mga_device *mdev)
|
|
{
|
|
void __iomem *mem;
|
|
|
|
/* BAR 0 is VRAM */
|
|
mdev->mc.vram_base = pci_resource_start(mdev->dev->pdev, 0);
|
|
mdev->mc.vram_window = pci_resource_len(mdev->dev->pdev, 0);
|
|
|
|
if (!devm_request_mem_region(mdev->dev->dev, mdev->mc.vram_base, mdev->mc.vram_window,
|
|
"mgadrmfb_vram")) {
|
|
DRM_ERROR("can't reserve VRAM\n");
|
|
return -ENXIO;
|
|
}
|
|
|
|
mem = pci_iomap(mdev->dev->pdev, 0, 0);
|
|
if (!mem)
|
|
return -ENOMEM;
|
|
|
|
mdev->mc.vram_size = mga_probe_vram(mdev, mem);
|
|
|
|
pci_iounmap(mdev->dev->pdev, mem);
|
|
|
|
return 0;
|
|
}
|
|
|
|
static int mgag200_device_init(struct drm_device *dev,
|
|
uint32_t flags)
|
|
{
|
|
struct mga_device *mdev = dev->dev_private;
|
|
int ret, option;
|
|
|
|
mdev->flags = mgag200_flags_from_driver_data(flags);
|
|
mdev->type = mgag200_type_from_driver_data(flags);
|
|
|
|
/* Hardcode the number of CRTCs to 1 */
|
|
mdev->num_crtc = 1;
|
|
|
|
pci_read_config_dword(dev->pdev, PCI_MGA_OPTION, &option);
|
|
mdev->has_sdram = !(option & (1 << 14));
|
|
|
|
/* BAR 0 is the framebuffer, BAR 1 contains registers */
|
|
mdev->rmmio_base = pci_resource_start(mdev->dev->pdev, 1);
|
|
mdev->rmmio_size = pci_resource_len(mdev->dev->pdev, 1);
|
|
|
|
if (!devm_request_mem_region(mdev->dev->dev, mdev->rmmio_base, mdev->rmmio_size,
|
|
"mgadrmfb_mmio")) {
|
|
DRM_ERROR("can't reserve mmio registers\n");
|
|
return -ENOMEM;
|
|
}
|
|
|
|
mdev->rmmio = pcim_iomap(dev->pdev, 1, 0);
|
|
if (mdev->rmmio == NULL)
|
|
return -ENOMEM;
|
|
|
|
/* stash G200 SE model number for later use */
|
|
if (IS_G200_SE(mdev)) {
|
|
mdev->unique_rev_id = RREG32(0x1e24);
|
|
DRM_DEBUG("G200 SE unique revision id is 0x%x\n",
|
|
mdev->unique_rev_id);
|
|
}
|
|
|
|
ret = mga_vram_init(mdev);
|
|
if (ret)
|
|
return ret;
|
|
|
|
mdev->bpp_shifts[0] = 0;
|
|
mdev->bpp_shifts[1] = 1;
|
|
mdev->bpp_shifts[2] = 0;
|
|
mdev->bpp_shifts[3] = 2;
|
|
return 0;
|
|
}
|
|
|
|
/*
|
|
* Functions here will be called by the core once it's bound the driver to
|
|
* a PCI device
|
|
*/
|
|
|
|
|
|
int mgag200_driver_load(struct drm_device *dev, unsigned long flags)
|
|
{
|
|
struct mga_device *mdev;
|
|
int r;
|
|
|
|
mdev = devm_kzalloc(dev->dev, sizeof(struct mga_device), GFP_KERNEL);
|
|
if (mdev == NULL)
|
|
return -ENOMEM;
|
|
dev->dev_private = (void *)mdev;
|
|
mdev->dev = dev;
|
|
|
|
r = mgag200_device_init(dev, flags);
|
|
if (r) {
|
|
dev_err(&dev->pdev->dev, "Fatal error during GPU init: %d\n", r);
|
|
return r;
|
|
}
|
|
r = mgag200_mm_init(mdev);
|
|
if (r)
|
|
goto err_mm;
|
|
|
|
drm_mode_config_init(dev);
|
|
dev->mode_config.funcs = (void *)&mga_mode_funcs;
|
|
if (IS_G200_SE(mdev) && mdev->vram_fb_available < (2048*1024))
|
|
dev->mode_config.preferred_depth = 16;
|
|
else
|
|
dev->mode_config.preferred_depth = 32;
|
|
dev->mode_config.prefer_shadow = 1;
|
|
|
|
r = mgag200_modeset_init(mdev);
|
|
if (r) {
|
|
dev_err(&dev->pdev->dev, "Fatal error during modeset init: %d\n", r);
|
|
goto err_modeset;
|
|
}
|
|
|
|
r = mgag200_cursor_init(mdev);
|
|
if (r)
|
|
dev_warn(&dev->pdev->dev,
|
|
"Could not initialize cursors. Not doing hardware cursors.\n");
|
|
|
|
r = drm_fbdev_generic_setup(mdev->dev, 0);
|
|
if (r)
|
|
goto err_modeset;
|
|
|
|
return 0;
|
|
|
|
err_modeset:
|
|
drm_mode_config_cleanup(dev);
|
|
mgag200_cursor_fini(mdev);
|
|
mgag200_mm_fini(mdev);
|
|
err_mm:
|
|
dev->dev_private = NULL;
|
|
|
|
return r;
|
|
}
|
|
|
|
void mgag200_driver_unload(struct drm_device *dev)
|
|
{
|
|
struct mga_device *mdev = dev->dev_private;
|
|
|
|
if (mdev == NULL)
|
|
return;
|
|
mgag200_modeset_fini(mdev);
|
|
drm_mode_config_cleanup(dev);
|
|
mgag200_cursor_fini(mdev);
|
|
mgag200_mm_fini(mdev);
|
|
dev->dev_private = NULL;
|
|
}
|