summaryrefslogtreecommitdiff
path: root/shared-core/i915_mem.c
AgeCommit message (Collapse)Author
2008-01-03drm: cleanup DRM_DEBUG() parametersMárton Németh
As DRM_DEBUG macro already prints out the __FUNCTION__ string (see drivers/char/drm/drmP.h), it is not worth doing this again. At some other places the ending "\n" was added. airlied:- I cleaned up a few that this patch missed also
2007-11-05drm: remove lots of spurious whitespace.Dave Airlie
Kernel "cleanfile" script run.
2007-07-20Replace DRM_IOCTL_ARGS with (dev, data, file_priv) and remove DRM_DEVICE.Eric Anholt
The data is now in kernel space, copied in/out as appropriate according to the This results in DRM_COPY_{TO,FROM}_USER going away, and error paths to deal with those failures. This also means that XFree86 4.2.0 support for i810 DRM is lost.
2007-07-20Replace filp in ioctl arguments with drm_file *file_priv.Eric Anholt
As a fallout, replace filp storage with file_priv storage for "unique identifier of a client" all over the DRM. There is a 1:1 mapping, so this should be a noop. This could be a minor performance improvement, as everything on Linux dereferenced filp to get file_priv anyway, while only the mmap ioctls went the other direction.
2007-07-20Remove DRM_ERR OS macro.Eric Anholt
This was used to make all ioctl handlers return -errno on linux and errno on *BSD. Instead, just return -errno in shared code, and flip sign on return from shared code to *BSD code.
2007-07-16drm: remove drmP.h internal typedefsDave Airlie
2007-07-16drm: detypedef drm.h and fixup all problemsDave Airlie
2006-01-23Fix CMDBUFFER path, add heap destroy and flesh out sarea for rotationAlan Hourihane
(Tungsten Graphics)
2005-11-28Assert an MIT copyright on sis_drm.h, since one was lacking and I createdEric Anholt
that particular file. Its contents have changed a good bit since the original sis code, and the original sis code didn't care much about attribution since it routinely disclaims Precision Insight/VA Linux from responsibility. Also, adjust formatting around license headers (have a comment open immediately before the "Copyright" line, not as a runon of any previous comments) for automatic processing into FreeBSD, where /*- is used to signal the beginning of license headers for automatic compilation of license lists.
2005-11-11remove extra spacesDave Airlie
2005-06-06Fix copyrightsAlan Hourihane
2004-09-30Lindent of core build. Drivers checked for no binary diffs. A few filesJon Smirl
weren't Lindent's because their comments didn't convert very well. A bunch of other minor clean up with no code implact included.
2004-09-27First check in for DRM that splits core from personality modulesJon Smirl
2004-08-30drm-memory patch, cleans up alloc/free and makes calloc look more libc likeDave Airlie
2004-08-27run i915 through lindentDave Airlie
2004-07-31fixes for using userspace pointers found by sparse utilityDave Airlie
From: Dave Airlie
2004-07-25sync up with current 2.6 kernel bk tree - mostly __user annotationsDave Airlie
2004-07-20Add NULLs instead of 0 for i915Dave Airlie
2004-06-10i915.o drm driverKeith Whitwell
="hl ppc"> #define MGA_WARP_CODE_ALIGN 256 /* in bytes */ #define WARP_UCODE_SIZE( which ) \ ((sizeof(which) / MGA_WARP_CODE_ALIGN + 1) * MGA_WARP_CODE_ALIGN) #define WARP_UCODE_INSTALL( which, where ) \ do { \ DRM_DEBUG( " pcbase = 0x%08lx vcbase = %p\n", pcbase, vcbase );\ dev_priv->warp_pipe_phys[where] = pcbase; \ memcpy( vcbase, which, sizeof(which) ); \ pcbase += WARP_UCODE_SIZE( which ); \ vcbase += WARP_UCODE_SIZE( which ); \ } while (0) static const unsigned int mga_warp_g400_microcode_size = (WARP_UCODE_SIZE(warp_g400_tgz) + WARP_UCODE_SIZE(warp_g400_tgza) + WARP_UCODE_SIZE(warp_g400_tgzaf) + WARP_UCODE_SIZE(warp_g400_tgzf) + WARP_UCODE_SIZE(warp_g400_tgzs) + WARP_UCODE_SIZE(warp_g400_tgzsa) + WARP_UCODE_SIZE(warp_g400_tgzsaf) + WARP_UCODE_SIZE(warp_g400_tgzsf) + WARP_UCODE_SIZE(warp_g400_t2gz) + WARP_UCODE_SIZE(warp_g400_t2gza) + WARP_UCODE_SIZE(warp_g400_t2gzaf) + WARP_UCODE_SIZE(warp_g400_t2gzf) + WARP_UCODE_SIZE(warp_g400_t2gzs) + WARP_UCODE_SIZE(warp_g400_t2gzsa) + WARP_UCODE_SIZE(warp_g400_t2gzsaf) + WARP_UCODE_SIZE(warp_g400_t2gzsf)); static const unsigned int mga_warp_g200_microcode_size = (WARP_UCODE_SIZE(warp_g200_tgz) + WARP_UCODE_SIZE(warp_g200_tgza) + WARP_UCODE_SIZE(warp_g200_tgzaf) + WARP_UCODE_SIZE(warp_g200_tgzf) + WARP_UCODE_SIZE(warp_g200_tgzs) + WARP_UCODE_SIZE(warp_g200_tgzsa) + WARP_UCODE_SIZE(warp_g200_tgzsaf) + WARP_UCODE_SIZE(warp_g200_tgzsf)); unsigned int mga_warp_microcode_size(const drm_mga_private_t * dev_priv) { switch (dev_priv->chipset) { case MGA_CARD_TYPE_G400: case MGA_CARD_TYPE_G550: return PAGE_ALIGN(mga_warp_g400_microcode_size); case MGA_CARD_TYPE_G200: return PAGE_ALIGN(mga_warp_g200_microcode_size); default: DRM_ERROR("Unknown chipset value: 0x%x\n", dev_priv->chipset); return 0; } } static int mga_warp_install_g400_microcode(drm_mga_private_t * dev_priv) { unsigned char *vcbase = dev_priv->warp->handle; unsigned long pcbase = dev_priv->warp->offset; memset(dev_priv->warp_pipe_phys, 0, sizeof(dev_priv->warp_pipe_phys)); WARP_UCODE_INSTALL(warp_g400_tgz, MGA_WARP_TGZ); WARP_UCODE_INSTALL(warp_g400_tgzf, MGA_WARP_TGZF); WARP_UCODE_INSTALL(warp_g400_tgza, MGA_WARP_TGZA); WARP_UCODE_INSTALL(warp_g400_tgzaf, MGA_WARP_TGZAF); WARP_UCODE_INSTALL(warp_g400_tgzs, MGA_WARP_TGZS); WARP_UCODE_INSTALL(warp_g400_tgzsf, MGA_WARP_TGZSF); WARP_UCODE_INSTALL(warp_g400_tgzsa, MGA_WARP_TGZSA); WARP_UCODE_INSTALL(warp_g400_tgzsaf, MGA_WARP_TGZSAF); WARP_UCODE_INSTALL(warp_g400_t2gz, MGA_WARP_T2GZ); WARP_UCODE_INSTALL(warp_g400_t2gzf, MGA_WARP_T2GZF); WARP_UCODE_INSTALL(warp_g400_t2gza, MGA_WARP_T2GZA); WARP_UCODE_INSTALL(warp_g400_t2gzaf, MGA_WARP_T2GZAF); WARP_UCODE_INSTALL(warp_g400_t2gzs, MGA_WARP_T2GZS); WARP_UCODE_INSTALL(warp_g400_t2gzsf, MGA_WARP_T2GZSF); WARP_UCODE_INSTALL(warp_g400_t2gzsa, MGA_WARP_T2GZSA); WARP_UCODE_INSTALL(warp_g400_t2gzsaf, MGA_WARP_T2GZSAF); return 0; } static int mga_warp_install_g200_microcode(drm_mga_private_t * dev_priv) { unsigned char *vcbase = dev_priv->warp->handle; unsigned long pcbase = dev_priv->warp->offset; memset(dev_priv->warp_pipe_phys, 0, sizeof(dev_priv->warp_pipe_phys)); WARP_UCODE_INSTALL(warp_g200_tgz, MGA_WARP_TGZ); WARP_UCODE_INSTALL(warp_g200_tgzf, MGA_WARP_TGZF); WARP_UCODE_INSTALL(warp_g200_tgza, MGA_WARP_TGZA); WARP_UCODE_INSTALL(warp_g200_tgzaf, MGA_WARP_TGZAF); WARP_UCODE_INSTALL(warp_g200_tgzs, MGA_WARP_TGZS); WARP_UCODE_INSTALL(warp_g200_tgzsf, MGA_WARP_TGZSF); WARP_UCODE_INSTALL(warp_g200_tgzsa, MGA_WARP_TGZSA); WARP_UCODE_INSTALL(warp_g200_tgzsaf, MGA_WARP_TGZSAF); return 0; } int mga_warp_install_microcode(drm_mga_private_t * dev_priv) { const unsigned int size = mga_warp_microcode_size(dev_priv); DRM_DEBUG("MGA ucode size = %d bytes\n", size); if (size > dev_priv->warp->size) { DRM_ERROR("microcode too large! (%u > %lu)\n", size, dev_priv->warp->size); return DRM_ERR(ENOMEM); } switch (dev_priv->chipset) { case MGA_CARD_TYPE_G400: case MGA_CARD_TYPE_G550: return mga_warp_install_g400_microcode(dev_priv); case MGA_CARD_TYPE_G200: return mga_warp_install_g200_microcode(dev_priv); default: return DRM_ERR(EINVAL); } } #define WMISC_EXPECTED (MGA_WUCODECACHE_ENABLE | MGA_WMASTER_ENABLE) int mga_warp_init(drm_mga_private_t * dev_priv) { u32 wmisc; /* FIXME: Get rid of these damned magic numbers... */ switch (dev_priv->chipset) { case MGA_CARD_TYPE_G400: case MGA_CARD_TYPE_G550: MGA_WRITE(MGA_WIADDR2, MGA_WMODE_SUSPEND); MGA_WRITE(MGA_WGETMSB, 0x00000E00); MGA_WRITE(MGA_WVRTXSZ, 0x00001807); MGA_WRITE(MGA_WACCEPTSEQ, 0x18000000); break; case MGA_CARD_TYPE_G200: MGA_WRITE(MGA_WIADDR, MGA_WMODE_SUSPEND); MGA_WRITE(MGA_WGETMSB, 0x1606); MGA_WRITE(MGA_WVRTXSZ, 7); break; default: return DRM_ERR(EINVAL); } MGA_WRITE(MGA_WMISC, (MGA_WUCODECACHE_ENABLE | MGA_WMASTER_ENABLE | MGA_WCACHEFLUSH_ENABLE)); wmisc = MGA_READ(MGA_WMISC); if (wmisc != WMISC_EXPECTED) { DRM_ERROR("WARP engine config failed! 0x%x != 0x%x\n", wmisc, WMISC_EXPECTED); return DRM_ERR(EINVAL); } return 0; }