summaryrefslogtreecommitdiff
path: root/linux-core
diff options
context:
space:
mode:
authorKeith Whitwell <keith@tungstengraphics.com>2003-04-26 21:33:44 +0000
committerKeith Whitwell <keith@tungstengraphics.com>2003-04-26 21:33:44 +0000
commitf5844cea13ba330beaeebb171eca1580efba62c6 (patch)
treea6f82faac5c75bee44e39e7bb4eda0048849b59a /linux-core
parent2c40a56393102bb0fb21e183bf5a08b0eea35c57 (diff)
2.5.x sync patch from Linus Torvalds
Diffstat (limited to 'linux-core')
-rw-r--r--linux-core/drm_memory.h5
-rw-r--r--linux-core/drm_memory_debug.h5
-rw-r--r--linux-core/drm_os_linux.h2
-rw-r--r--linux-core/i810_dma.c22
-rw-r--r--linux-core/i810_drv.h2
-rw-r--r--linux-core/i830_dma.c32
-rw-r--r--linux-core/i830_drv.h2
7 files changed, 30 insertions, 40 deletions
diff --git a/linux-core/drm_memory.h b/linux-core/drm_memory.h
index b5a01749..ae5737f1 100644
--- a/linux-core/drm_memory.h
+++ b/linux-core/drm_memory.h
@@ -32,7 +32,6 @@
#define __NO_VERSION__
#include <linux/config.h>
#include "drmP.h"
-#include <linux/wrapper.h>
/* Cut down version of drm_memory_debug.h, which used to be called
* drm_memory.h. If you want the debug functionality, change 0 to 1
@@ -95,7 +94,7 @@ unsigned long DRM(alloc_pages)(int order, int area)
for (addr = address, sz = bytes;
sz > 0;
addr += PAGE_SIZE, sz -= PAGE_SIZE) {
- mem_map_reserve(virt_to_page(addr));
+ SetPageReserved(virt_to_page(addr));
}
return address;
@@ -114,7 +113,7 @@ void DRM(free_pages)(unsigned long address, int order, int area)
for (addr = address, sz = bytes;
sz > 0;
addr += PAGE_SIZE, sz -= PAGE_SIZE) {
- mem_map_unreserve(virt_to_page(addr));
+ ClearPageReserved(virt_to_page(addr));
}
free_pages(address, order);
diff --git a/linux-core/drm_memory_debug.h b/linux-core/drm_memory_debug.h
index 138de873..f4fd2425 100644
--- a/linux-core/drm_memory_debug.h
+++ b/linux-core/drm_memory_debug.h
@@ -32,7 +32,6 @@
#define __NO_VERSION__
#include <linux/config.h>
#include "drmP.h"
-#include <linux/wrapper.h>
typedef struct drm_mem_stats {
const char *name;
@@ -232,7 +231,7 @@ unsigned long DRM(alloc_pages)(int order, int area)
for (addr = address, sz = bytes;
sz > 0;
addr += PAGE_SIZE, sz -= PAGE_SIZE) {
- mem_map_reserve(virt_to_page(addr));
+ SetPageReserved(virt_to_page(addr));
}
return address;
@@ -253,7 +252,7 @@ void DRM(free_pages)(unsigned long address, int order, int area)
for (addr = address, sz = bytes;
sz > 0;
addr += PAGE_SIZE, sz -= PAGE_SIZE) {
- mem_map_unreserve(virt_to_page(addr));
+ ClearPageReserved(virt_to_page(addr));
}
free_pages(address, order);
}
diff --git a/linux-core/drm_os_linux.h b/linux-core/drm_os_linux.h
index b760c169..eed91766 100644
--- a/linux-core/drm_os_linux.h
+++ b/linux-core/drm_os_linux.h
@@ -70,7 +70,7 @@ do { \
current->state = TASK_INTERRUPTIBLE; \
if (condition) \
break; \
- if((signed)(end - jiffies) <= 0) { \
+ if (time_after_eq(jiffies, end)) { \
ret = -EBUSY; \
break; \
} \
diff --git a/linux-core/i810_dma.c b/linux-core/i810_dma.c
index a3727164..30b7dfcf 100644
--- a/linux-core/i810_dma.c
+++ b/linux-core/i810_dma.c
@@ -62,7 +62,7 @@ static inline void i810_print_status_page(drm_device_t *dev)
{
drm_device_dma_t *dma = dev->dma;
drm_i810_private_t *dev_priv = dev->dev_private;
- u32 *temp = (u32 *)dev_priv->hw_status_page;
+ u32 *temp = dev_priv->hw_status_page;
int i;
DRM_DEBUG( "hw_status: Interrupt Status : %x\n", temp[0]);
@@ -247,9 +247,9 @@ static int i810_dma_cleanup(drm_device_t *dev)
DRM(ioremapfree)((void *) dev_priv->ring.virtual_start,
dev_priv->ring.Size);
}
- if(dev_priv->hw_status_page != 0UL) {
+ if (dev_priv->hw_status_page) {
pci_free_consistent(dev->pdev, PAGE_SIZE,
- (void *)dev_priv->hw_status_page,
+ dev_priv->hw_status_page,
dev_priv->dma_status_page);
/* Need to rewrite hardware status page */
I810_WRITE(0x02080, 0x1ffff000);
@@ -412,16 +412,16 @@ static int i810_dma_initialize(drm_device_t *dev,
/* Program Hardware Status Page */
dev_priv->hw_status_page =
- (unsigned long) pci_alloc_consistent(dev->pdev, PAGE_SIZE,
+ pci_alloc_consistent(dev->pdev, PAGE_SIZE,
&dev_priv->dma_status_page);
- if(dev_priv->hw_status_page == 0UL) {
+ if (!dev_priv->hw_status_page) {
dev->dev_private = (void *)dev_priv;
i810_dma_cleanup(dev);
DRM_ERROR("Can not allocate hardware status page\n");
return -ENOMEM;
}
- memset((void *) dev_priv->hw_status_page, 0, PAGE_SIZE);
- DRM_DEBUG("hw status page @ %lx\n", dev_priv->hw_status_page);
+ memset(dev_priv->hw_status_page, 0, PAGE_SIZE);
+ DRM_DEBUG("hw status page @ %p\n", dev_priv->hw_status_page);
I810_WRITE(0x02080, dev_priv->dma_status_page);
DRM_DEBUG("Enabled hardware status page\n");
@@ -906,7 +906,7 @@ int i810_dma_vertex(struct inode *inode, struct file *filp,
drm_device_t *dev = priv->dev;
drm_device_dma_t *dma = dev->dma;
drm_i810_private_t *dev_priv = (drm_i810_private_t *)dev->dev_private;
- u32 *hw_status = (u32 *)dev_priv->hw_status_page;
+ u32 *hw_status = dev_priv->hw_status_page;
drm_i810_sarea_t *sarea_priv = (drm_i810_sarea_t *)
dev_priv->sarea_priv;
drm_i810_vertex_t vertex;
@@ -982,7 +982,7 @@ int i810_getage(struct inode *inode, struct file *filp, unsigned int cmd,
drm_file_t *priv = filp->private_data;
drm_device_t *dev = priv->dev;
drm_i810_private_t *dev_priv = (drm_i810_private_t *)dev->dev_private;
- u32 *hw_status = (u32 *)dev_priv->hw_status_page;
+ u32 *hw_status = dev_priv->hw_status_page;
drm_i810_sarea_t *sarea_priv = (drm_i810_sarea_t *)
dev_priv->sarea_priv;
@@ -998,7 +998,7 @@ int i810_getbuf(struct inode *inode, struct file *filp, unsigned int cmd,
int retcode = 0;
drm_i810_dma_t d;
drm_i810_private_t *dev_priv = (drm_i810_private_t *)dev->dev_private;
- u32 *hw_status = (u32 *)dev_priv->hw_status_page;
+ u32 *hw_status = dev_priv->hw_status_page;
drm_i810_sarea_t *sarea_priv = (drm_i810_sarea_t *)
dev_priv->sarea_priv;
@@ -1107,7 +1107,7 @@ int i810_dma_mc(struct inode *inode, struct file *filp,
drm_device_t *dev = priv->dev;
drm_device_dma_t *dma = dev->dma;
drm_i810_private_t *dev_priv = (drm_i810_private_t *)dev->dev_private;
- u32 *hw_status = (u32 *)dev_priv->hw_status_page;
+ u32 *hw_status = dev_priv->hw_status_page;
drm_i810_sarea_t *sarea_priv = (drm_i810_sarea_t *)
dev_priv->sarea_priv;
drm_i810_mc_t mc;
diff --git a/linux-core/i810_drv.h b/linux-core/i810_drv.h
index bbb570bc..27166449 100644
--- a/linux-core/i810_drv.h
+++ b/linux-core/i810_drv.h
@@ -61,7 +61,7 @@ typedef struct drm_i810_private {
drm_i810_sarea_t *sarea_priv;
drm_i810_ring_buffer_t ring;
- unsigned long hw_status_page;
+ void *hw_status_page;
unsigned long counter;
dma_addr_t dma_status_page;
diff --git a/linux-core/i830_dma.c b/linux-core/i830_dma.c
index 6a41d2b5..d206d5b5 100644
--- a/linux-core/i830_dma.c
+++ b/linux-core/i830_dma.c
@@ -59,19 +59,11 @@
#define up_write up
#endif
-#ifndef LockPage
-#define LockPage(page) set_bit(PG_locked, &(page)->flags)
-#endif
-#ifndef UnlockPage
-#define UnlockPage(page) unlock_page(page)
-#endif
-
-
static inline void i830_print_status_page(drm_device_t *dev)
{
drm_device_dma_t *dma = dev->dma;
drm_i830_private_t *dev_priv = dev->dev_private;
- u32 *temp = (u32 *)dev_priv->hw_status_page;
+ u32 *temp = dev_priv->hw_status_page;
int i;
DRM_DEBUG( "hw_status: Interrupt Status : %x\n", temp[0]);
@@ -181,10 +173,10 @@ static int i830_map_buffer(drm_buf_t *buf, struct file *filp)
buf->bus_address);
dev_priv->mmap_buffer = NULL;
filp->f_op = old_fops;
- if ((unsigned long)buf_priv->virtual > -1024UL) {
+ if (IS_ERR(buf_priv->virtual)) {
/* Real error */
DRM_ERROR("mmap error\n");
- retcode = (signed int)buf_priv->virtual;
+ retcode = PTR_ERR(buf_priv->virtual);
buf_priv->virtual = 0;
}
up_write( &current->mm->mmap_sem );
@@ -255,9 +247,9 @@ static int i830_dma_cleanup(drm_device_t *dev)
DRM(ioremapfree)((void *) dev_priv->ring.virtual_start,
dev_priv->ring.Size);
}
- if(dev_priv->hw_status_page != 0UL) {
+ if (dev_priv->hw_status_page) {
pci_free_consistent(dev->pdev, PAGE_SIZE,
- (void *)dev_priv->hw_status_page,
+ dev_priv->hw_status_page,
dev_priv->dma_status_page);
/* Need to rewrite hardware status page */
I830_WRITE(0x02080, 0x1ffff000);
@@ -449,16 +441,16 @@ static int i830_dma_initialize(drm_device_t *dev,
/* Program Hardware Status Page */
dev_priv->hw_status_page =
- (unsigned long) pci_alloc_consistent(dev->pdev, PAGE_SIZE,
+ pci_alloc_consistent(dev->pdev, PAGE_SIZE,
&dev_priv->dma_status_page);
- if(dev_priv->hw_status_page == 0UL) {
+ if (!dev_priv->hw_status_page) {
dev->dev_private = (void *)dev_priv;
i830_dma_cleanup(dev);
DRM_ERROR("Can not allocate hardware status page\n");
return -ENOMEM;
}
- memset((void *) dev_priv->hw_status_page, 0, PAGE_SIZE);
- DRM_DEBUG("hw status page @ %lx\n", dev_priv->hw_status_page);
+ memset(dev_priv->hw_status_page, 0, PAGE_SIZE);
+ DRM_DEBUG("hw status page @ %p\n", dev_priv->hw_status_page);
I830_WRITE(0x02080, dev_priv->dma_status_page);
DRM_DEBUG("Enabled hardware status page\n");
@@ -1350,7 +1342,7 @@ int i830_dma_vertex(struct inode *inode, struct file *filp,
drm_device_t *dev = priv->dev;
drm_device_dma_t *dma = dev->dma;
drm_i830_private_t *dev_priv = (drm_i830_private_t *)dev->dev_private;
- u32 *hw_status = (u32 *)dev_priv->hw_status_page;
+ u32 *hw_status = dev_priv->hw_status_page;
drm_i830_sarea_t *sarea_priv = (drm_i830_sarea_t *)
dev_priv->sarea_priv;
drm_i830_vertex_t vertex;
@@ -1475,7 +1467,7 @@ int i830_getage(struct inode *inode, struct file *filp, unsigned int cmd,
drm_file_t *priv = filp->private_data;
drm_device_t *dev = priv->dev;
drm_i830_private_t *dev_priv = (drm_i830_private_t *)dev->dev_private;
- u32 *hw_status = (u32 *)dev_priv->hw_status_page;
+ u32 *hw_status = dev_priv->hw_status_page;
drm_i830_sarea_t *sarea_priv = (drm_i830_sarea_t *)
dev_priv->sarea_priv;
@@ -1491,7 +1483,7 @@ int i830_getbuf(struct inode *inode, struct file *filp, unsigned int cmd,
int retcode = 0;
drm_i830_dma_t d;
drm_i830_private_t *dev_priv = (drm_i830_private_t *)dev->dev_private;
- u32 *hw_status = (u32 *)dev_priv->hw_status_page;
+ u32 *hw_status = dev_priv->hw_status_page;
drm_i830_sarea_t *sarea_priv = (drm_i830_sarea_t *)
dev_priv->sarea_priv;
diff --git a/linux-core/i830_drv.h b/linux-core/i830_drv.h
index 37313afd..6b172ece 100644
--- a/linux-core/i830_drv.h
+++ b/linux-core/i830_drv.h
@@ -61,7 +61,7 @@ typedef struct drm_i830_private {
drm_i830_sarea_t *sarea_priv;
drm_i830_ring_buffer_t ring;
- unsigned long hw_status_page;
+ void * hw_status_page;
unsigned long counter;
dma_addr_t dma_status_page;