Commit 269dc512 authored by Dave Airlie's avatar Dave Airlie Committed by Dave Airlie

drm: bring savage inline with latest CVS

apply some whitespace cleanup and add wrappers for MTRR for OS calls

From: Eric Anholt <anholt@freebsd.org> + Dave Airlie <airlied@linux.ie>
Signed-off-by: default avatarDave Airlie <airlied@linux.ie>
parent 3528af1b
...@@ -750,6 +750,21 @@ static inline int drm_core_has_MTRR(struct drm_device *dev) ...@@ -750,6 +750,21 @@ static inline int drm_core_has_MTRR(struct drm_device *dev)
{ {
return drm_core_check_feature(dev, DRIVER_USE_MTRR); return drm_core_check_feature(dev, DRIVER_USE_MTRR);
} }
#define DRM_MTRR_WC MTRR_TYPE_WRCOMB
static inline int drm_mtrr_add(unsigned long offset, unsigned long size,
unsigned int flags)
{
return mtrr_add(offset, size, flags, 1);
}
static inline int drm_mtrr_del(int handle, unsigned long offset,
unsigned long size, unsigned int flags)
{
return mtrr_del(handle, offset, size);
}
#else #else
#define drm_core_has_MTRR(dev) (0) #define drm_core_has_MTRR(dev) (0)
#endif #endif
......
...@@ -584,21 +584,18 @@ int savage_driver_firstopen(drm_device_t *dev) ...@@ -584,21 +584,18 @@ int savage_driver_firstopen(drm_device_t *dev)
dev_priv->mtrr[0].base = fb_base; dev_priv->mtrr[0].base = fb_base;
dev_priv->mtrr[0].size = 0x01000000; dev_priv->mtrr[0].size = 0x01000000;
dev_priv->mtrr[0].handle = dev_priv->mtrr[0].handle =
mtrr_add(dev_priv->mtrr[0].base, drm_mtrr_add(dev_priv->mtrr[0].base,
dev_priv->mtrr[0].size, MTRR_TYPE_WRCOMB, dev_priv->mtrr[0].size, DRM_MTRR_WC);
1);
dev_priv->mtrr[1].base = fb_base + 0x02000000; dev_priv->mtrr[1].base = fb_base + 0x02000000;
dev_priv->mtrr[1].size = 0x02000000; dev_priv->mtrr[1].size = 0x02000000;
dev_priv->mtrr[1].handle = dev_priv->mtrr[1].handle =
mtrr_add(dev_priv->mtrr[1].base, drm_mtrr_add(dev_priv->mtrr[1].base,
dev_priv->mtrr[1].size, MTRR_TYPE_WRCOMB, dev_priv->mtrr[1].size, DRM_MTRR_WC);
1);
dev_priv->mtrr[2].base = fb_base + 0x04000000; dev_priv->mtrr[2].base = fb_base + 0x04000000;
dev_priv->mtrr[2].size = 0x04000000; dev_priv->mtrr[2].size = 0x04000000;
dev_priv->mtrr[2].handle = dev_priv->mtrr[2].handle =
mtrr_add(dev_priv->mtrr[2].base, drm_mtrr_add(dev_priv->mtrr[2].base,
dev_priv->mtrr[2].size, MTRR_TYPE_WRCOMB, dev_priv->mtrr[2].size, DRM_MTRR_WC);
1);
} else { } else {
DRM_ERROR("strange pci_resource_len %08lx\n", DRM_ERROR("strange pci_resource_len %08lx\n",
drm_get_resource_len(dev, 0)); drm_get_resource_len(dev, 0));
...@@ -618,9 +615,8 @@ int savage_driver_firstopen(drm_device_t *dev) ...@@ -618,9 +615,8 @@ int savage_driver_firstopen(drm_device_t *dev)
dev_priv->mtrr[0].base = fb_base; dev_priv->mtrr[0].base = fb_base;
dev_priv->mtrr[0].size = 0x08000000; dev_priv->mtrr[0].size = 0x08000000;
dev_priv->mtrr[0].handle = dev_priv->mtrr[0].handle =
mtrr_add(dev_priv->mtrr[0].base, drm_mtrr_add(dev_priv->mtrr[0].base,
dev_priv->mtrr[0].size, MTRR_TYPE_WRCOMB, dev_priv->mtrr[0].size, DRM_MTRR_WC);
1);
} else { } else {
DRM_ERROR("strange pci_resource_len %08lx\n", DRM_ERROR("strange pci_resource_len %08lx\n",
drm_get_resource_len(dev, 1)); drm_get_resource_len(dev, 1));
...@@ -664,9 +660,9 @@ void savage_driver_lastclose(drm_device_t *dev) ...@@ -664,9 +660,9 @@ void savage_driver_lastclose(drm_device_t *dev)
for (i = 0; i < 3; ++i) for (i = 0; i < 3; ++i)
if (dev_priv->mtrr[i].handle >= 0) if (dev_priv->mtrr[i].handle >= 0)
mtrr_del(dev_priv->mtrr[i].handle, drm_mtrr_del(dev_priv->mtrr[i].handle,
dev_priv->mtrr[i].base, dev_priv->mtrr[i].base,
dev_priv->mtrr[i].size); dev_priv->mtrr[i].size, DRM_MTRR_WC);
} }
int savage_driver_unload(drm_device_t *dev) int savage_driver_unload(drm_device_t *dev)
...@@ -1008,8 +1004,7 @@ static int savage_bci_event_wait(DRM_IOCTL_ARGS) ...@@ -1008,8 +1004,7 @@ static int savage_bci_event_wait(DRM_IOCTL_ARGS)
* DMA buffer management * DMA buffer management
*/ */
static int savage_bci_get_buffers(DRMFILE filp, drm_device_t * dev, static int savage_bci_get_buffers(DRMFILE filp, drm_device_t *dev, drm_dma_t *d)
drm_dma_t * d)
{ {
drm_buf_t *buf; drm_buf_t *buf;
int i; int i;
...@@ -1071,7 +1066,7 @@ int savage_bci_buffers(DRM_IOCTL_ARGS) ...@@ -1071,7 +1066,7 @@ int savage_bci_buffers(DRM_IOCTL_ARGS)
return ret; return ret;
} }
void savage_reclaim_buffers(drm_device_t * dev, DRMFILE filp) void savage_reclaim_buffers(drm_device_t *dev, DRMFILE filp)
{ {
drm_device_dma_t *dma = dev->dma; drm_device_dma_t *dma = dev->dma;
drm_savage_private_t *dev_priv = dev->dev_private; drm_savage_private_t *dev_priv = dev->dev_private;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment