Commit d8762748 authored by Linus Torvalds's avatar Linus Torvalds

Merge master.kernel.org:/pub/scm/linux/kernel/git/airlied/drm-2.6

Manual fixups for some clashes due to re-indenting.
parents ce463370 a4e62fa0
/** /**
* \file ati_pcigart.h * \file ati_pcigart.c
* ATI PCI GART support * ATI PCI GART support
* *
* \author Gareth Hughes <gareth@valinux.com> * \author Gareth Hughes <gareth@valinux.com>
...@@ -52,85 +52,91 @@ ...@@ -52,85 +52,91 @@
# define ATI_MAX_PCIGART_PAGES 8192 /**< 32 MB aperture, 4K pages */ # define ATI_MAX_PCIGART_PAGES 8192 /**< 32 MB aperture, 4K pages */
# define ATI_PCIGART_PAGE_SIZE 4096 /**< PCI GART page size */ # define ATI_PCIGART_PAGE_SIZE 4096 /**< PCI GART page size */
static unsigned long drm_ati_alloc_pcigart_table( void ) static unsigned long drm_ati_alloc_pcigart_table(void)
{ {
unsigned long address; unsigned long address;
struct page *page; struct page *page;
int i; int i;
DRM_DEBUG( "%s\n", __FUNCTION__ ); DRM_DEBUG("%s\n", __FUNCTION__);
address = __get_free_pages( GFP_KERNEL, ATI_PCIGART_TABLE_ORDER ); address = __get_free_pages(GFP_KERNEL, ATI_PCIGART_TABLE_ORDER);
if ( address == 0UL ) { if (address == 0UL) {
return 0; return 0;
} }
page = virt_to_page( address ); page = virt_to_page(address);
for ( i = 0 ; i < ATI_PCIGART_TABLE_PAGES ; i++, page++ ) { for (i = 0; i < ATI_PCIGART_TABLE_PAGES; i++, page++) {
get_page(page); get_page(page);
SetPageReserved( page ); SetPageReserved(page);
} }
DRM_DEBUG( "%s: returning 0x%08lx\n", __FUNCTION__, address ); DRM_DEBUG("%s: returning 0x%08lx\n", __FUNCTION__, address);
return address; return address;
} }
static void drm_ati_free_pcigart_table( unsigned long address ) static void drm_ati_free_pcigart_table(unsigned long address)
{ {
struct page *page; struct page *page;
int i; int i;
DRM_DEBUG( "%s\n", __FUNCTION__ ); DRM_DEBUG("%s\n", __FUNCTION__);
page = virt_to_page( address ); page = virt_to_page(address);
for ( i = 0 ; i < ATI_PCIGART_TABLE_PAGES ; i++, page++ ) { for (i = 0; i < ATI_PCIGART_TABLE_PAGES; i++, page++) {
__put_page(page); __put_page(page);
ClearPageReserved( page ); ClearPageReserved(page);
} }
free_pages( address, ATI_PCIGART_TABLE_ORDER ); free_pages(address, ATI_PCIGART_TABLE_ORDER);
} }
int drm_ati_pcigart_cleanup( drm_device_t *dev, int drm_ati_pcigart_cleanup(drm_device_t * dev,
unsigned long addr, drm_ati_pcigart_info * gart_info)
dma_addr_t bus_addr)
{ {
drm_sg_mem_t *entry = dev->sg; drm_sg_mem_t *entry = dev->sg;
unsigned long pages; unsigned long pages;
int i; int i;
/* we need to support large memory configurations */ /* we need to support large memory configurations */
if ( !entry ) { if (!entry) {
DRM_ERROR( "no scatter/gather memory!\n" ); DRM_ERROR("no scatter/gather memory!\n");
return 0; return 0;
} }
if ( bus_addr ) { if (gart_info->bus_addr) {
pci_unmap_single(dev->pdev, bus_addr, if (gart_info->gart_table_location == DRM_ATI_GART_MAIN) {
ATI_PCIGART_TABLE_PAGES * PAGE_SIZE, pci_unmap_single(dev->pdev, gart_info->bus_addr,
PCI_DMA_TODEVICE); ATI_PCIGART_TABLE_PAGES * PAGE_SIZE,
PCI_DMA_TODEVICE);
}
pages = ( entry->pages <= ATI_MAX_PCIGART_PAGES ) pages = (entry->pages <= ATI_MAX_PCIGART_PAGES)
? entry->pages : ATI_MAX_PCIGART_PAGES; ? entry->pages : ATI_MAX_PCIGART_PAGES;
for ( i = 0 ; i < pages ; i++ ) { for (i = 0; i < pages; i++) {
if ( !entry->busaddr[i] ) break; if (!entry->busaddr[i])
break;
pci_unmap_single(dev->pdev, entry->busaddr[i], pci_unmap_single(dev->pdev, entry->busaddr[i],
PAGE_SIZE, PCI_DMA_TODEVICE); PAGE_SIZE, PCI_DMA_TODEVICE);
} }
if (gart_info->gart_table_location == DRM_ATI_GART_MAIN)
gart_info->bus_addr = 0;
} }
if ( addr ) { if (gart_info->gart_table_location == DRM_ATI_GART_MAIN
drm_ati_free_pcigart_table( addr ); && gart_info->addr) {
drm_ati_free_pcigart_table(gart_info->addr);
gart_info->addr = 0;
} }
return 1; return 1;
} }
EXPORT_SYMBOL(drm_ati_pcigart_cleanup); EXPORT_SYMBOL(drm_ati_pcigart_cleanup);
int drm_ati_pcigart_init( drm_device_t *dev, int drm_ati_pcigart_init(drm_device_t * dev, drm_ati_pcigart_info * gart_info)
unsigned long *addr,
dma_addr_t *bus_addr)
{ {
drm_sg_mem_t *entry = dev->sg; drm_sg_mem_t *entry = dev->sg;
unsigned long address = 0; unsigned long address = 0;
...@@ -138,48 +144,57 @@ int drm_ati_pcigart_init( drm_device_t *dev, ...@@ -138,48 +144,57 @@ int drm_ati_pcigart_init( drm_device_t *dev,
u32 *pci_gart, page_base, bus_address = 0; u32 *pci_gart, page_base, bus_address = 0;
int i, j, ret = 0; int i, j, ret = 0;
if ( !entry ) { if (!entry) {
DRM_ERROR( "no scatter/gather memory!\n" ); DRM_ERROR("no scatter/gather memory!\n");
goto done; goto done;
} }
address = drm_ati_alloc_pcigart_table(); if (gart_info->gart_table_location == DRM_ATI_GART_MAIN) {
if ( !address ) { DRM_DEBUG("PCI: no table in VRAM: using normal RAM\n");
DRM_ERROR( "cannot allocate PCI GART page!\n" );
goto done;
}
if ( !dev->pdev ) { address = drm_ati_alloc_pcigart_table();
DRM_ERROR( "PCI device unknown!\n" ); if (!address) {
goto done; DRM_ERROR("cannot allocate PCI GART page!\n");
} goto done;
}
bus_address = pci_map_single(dev->pdev, (void *)address, if (!dev->pdev) {
ATI_PCIGART_TABLE_PAGES * PAGE_SIZE, DRM_ERROR("PCI device unknown!\n");
PCI_DMA_TODEVICE); goto done;
if (bus_address == 0) { }
DRM_ERROR( "unable to map PCIGART pages!\n" );
drm_ati_free_pcigart_table( address ); bus_address = pci_map_single(dev->pdev, (void *)address,
address = 0; ATI_PCIGART_TABLE_PAGES *
goto done; PAGE_SIZE, PCI_DMA_TODEVICE);
if (bus_address == 0) {
DRM_ERROR("unable to map PCIGART pages!\n");
drm_ati_free_pcigart_table(address);
address = 0;
goto done;
}
} else {
address = gart_info->addr;
bus_address = gart_info->bus_addr;
DRM_DEBUG("PCI: Gart Table: VRAM %08X mapped at %08lX\n",
bus_address, address);
} }
pci_gart = (u32 *)address; pci_gart = (u32 *) address;
pages = ( entry->pages <= ATI_MAX_PCIGART_PAGES ) pages = (entry->pages <= ATI_MAX_PCIGART_PAGES)
? entry->pages : ATI_MAX_PCIGART_PAGES; ? entry->pages : ATI_MAX_PCIGART_PAGES;
memset( pci_gart, 0, ATI_MAX_PCIGART_PAGES * sizeof(u32) ); memset(pci_gart, 0, ATI_MAX_PCIGART_PAGES * sizeof(u32));
for ( i = 0 ; i < pages ; i++ ) { for (i = 0; i < pages; i++) {
/* we need to support large memory configurations */ /* we need to support large memory configurations */
entry->busaddr[i] = pci_map_single(dev->pdev, entry->busaddr[i] = pci_map_single(dev->pdev,
page_address( entry->pagelist[i] ), page_address(entry->
PAGE_SIZE, pagelist[i]),
PCI_DMA_TODEVICE); PAGE_SIZE, PCI_DMA_TODEVICE);
if (entry->busaddr[i] == 0) { if (entry->busaddr[i] == 0) {
DRM_ERROR( "unable to map PCIGART pages!\n" ); DRM_ERROR("unable to map PCIGART pages!\n");
drm_ati_pcigart_cleanup( dev, address, bus_address ); drm_ati_pcigart_cleanup(dev, gart_info);
address = 0; address = 0;
bus_address = 0; bus_address = 0;
goto done; goto done;
...@@ -187,7 +202,11 @@ int drm_ati_pcigart_init( drm_device_t *dev, ...@@ -187,7 +202,11 @@ int drm_ati_pcigart_init( drm_device_t *dev,
page_base = (u32) entry->busaddr[i]; page_base = (u32) entry->busaddr[i];
for (j = 0; j < (PAGE_SIZE / ATI_PCIGART_PAGE_SIZE); j++) { for (j = 0; j < (PAGE_SIZE / ATI_PCIGART_PAGE_SIZE); j++) {
*pci_gart++ = cpu_to_le32( page_base ); if (gart_info->is_pcie)
*pci_gart = (cpu_to_le32(page_base) >> 8) | 0xc;
else
*pci_gart = cpu_to_le32(page_base);
*pci_gart++;
page_base += ATI_PCIGART_PAGE_SIZE; page_base += ATI_PCIGART_PAGE_SIZE;
} }
} }
...@@ -200,9 +219,10 @@ int drm_ati_pcigart_init( drm_device_t *dev, ...@@ -200,9 +219,10 @@ int drm_ati_pcigart_init( drm_device_t *dev,
mb(); mb();
#endif #endif
done: done:
*addr = address; gart_info->addr = address;
*bus_addr = bus_address; gart_info->bus_addr = bus_address;
return ret; return ret;
} }
EXPORT_SYMBOL(drm_ati_pcigart_init); EXPORT_SYMBOL(drm_ati_pcigart_init);
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
/** /**
* \file drm_auth.h * \file drm_auth.c
* IOCTLs for authentication * IOCTLs for authentication
* *
* \author Rickard E. (Rik) Faith <faith@valinux.com> * \author Rickard E. (Rik) Faith <faith@valinux.com>
...@@ -46,7 +46,7 @@ ...@@ -46,7 +46,7 @@
*/ */
static int drm_hash_magic(drm_magic_t magic) static int drm_hash_magic(drm_magic_t magic)
{ {
return magic & (DRM_HASH_SIZE-1); return magic & (DRM_HASH_SIZE - 1);
} }
/** /**
...@@ -59,11 +59,11 @@ static int drm_hash_magic(drm_magic_t magic) ...@@ -59,11 +59,11 @@ static int drm_hash_magic(drm_magic_t magic)
* the one with matching magic number, while holding the drm_device::struct_sem * the one with matching magic number, while holding the drm_device::struct_sem
* lock. * lock.
*/ */
static drm_file_t *drm_find_file(drm_device_t *dev, drm_magic_t magic) static drm_file_t *drm_find_file(drm_device_t * dev, drm_magic_t magic)
{ {
drm_file_t *retval = NULL; drm_file_t *retval = NULL;
drm_magic_entry_t *pt; drm_magic_entry_t *pt;
int hash = drm_hash_magic(magic); int hash = drm_hash_magic(magic);
down(&dev->struct_sem); down(&dev->struct_sem);
for (pt = dev->magiclist[hash].head; pt; pt = pt->next) { for (pt = dev->magiclist[hash].head; pt; pt = pt->next) {
...@@ -78,7 +78,7 @@ static drm_file_t *drm_find_file(drm_device_t *dev, drm_magic_t magic) ...@@ -78,7 +78,7 @@ static drm_file_t *drm_find_file(drm_device_t *dev, drm_magic_t magic)
/** /**
* Adds a magic number. * Adds a magic number.
* *
* \param dev DRM device. * \param dev DRM device.
* \param priv file private data. * \param priv file private data.
* \param magic magic number. * \param magic magic number.
...@@ -87,28 +87,30 @@ static drm_file_t *drm_find_file(drm_device_t *dev, drm_magic_t magic) ...@@ -87,28 +87,30 @@ static drm_file_t *drm_find_file(drm_device_t *dev, drm_magic_t magic)
* associated the magic number hash key in drm_device::magiclist, while holding * associated the magic number hash key in drm_device::magiclist, while holding
* the drm_device::struct_sem lock. * the drm_device::struct_sem lock.
*/ */
static int drm_add_magic(drm_device_t *dev, drm_file_t *priv, drm_magic_t magic) static int drm_add_magic(drm_device_t * dev, drm_file_t * priv,
drm_magic_t magic)
{ {
int hash; int hash;
drm_magic_entry_t *entry; drm_magic_entry_t *entry;
DRM_DEBUG("%d\n", magic); DRM_DEBUG("%d\n", magic);
hash = drm_hash_magic(magic); hash = drm_hash_magic(magic);
entry = drm_alloc(sizeof(*entry), DRM_MEM_MAGIC); entry = drm_alloc(sizeof(*entry), DRM_MEM_MAGIC);
if (!entry) return -ENOMEM; if (!entry)
return -ENOMEM;
memset(entry, 0, sizeof(*entry)); memset(entry, 0, sizeof(*entry));
entry->magic = magic; entry->magic = magic;
entry->priv = priv; entry->priv = priv;
entry->next = NULL; entry->next = NULL;
down(&dev->struct_sem); down(&dev->struct_sem);
if (dev->magiclist[hash].tail) { if (dev->magiclist[hash].tail) {
dev->magiclist[hash].tail->next = entry; dev->magiclist[hash].tail->next = entry;
dev->magiclist[hash].tail = entry; dev->magiclist[hash].tail = entry;
} else { } else {
dev->magiclist[hash].head = entry; dev->magiclist[hash].head = entry;
dev->magiclist[hash].tail = entry; dev->magiclist[hash].tail = entry;
} }
up(&dev->struct_sem); up(&dev->struct_sem);
...@@ -117,19 +119,18 @@ static int drm_add_magic(drm_device_t *dev, drm_file_t *priv, drm_magic_t magic) ...@@ -117,19 +119,18 @@ static int drm_add_magic(drm_device_t *dev, drm_file_t *priv, drm_magic_t magic)
/** /**
* Remove a magic number. * Remove a magic number.
* *
* \param dev DRM device. * \param dev DRM device.
* \param magic magic number. * \param magic magic number.
* *
* Searches and unlinks the entry in drm_device::magiclist with the magic * Searches and unlinks the entry in drm_device::magiclist with the magic
* number hash key, while holding the drm_device::struct_sem lock. * number hash key, while holding the drm_device::struct_sem lock.
*/ */
static int drm_remove_magic(drm_device_t *dev, drm_magic_t magic) static int drm_remove_magic(drm_device_t * dev, drm_magic_t magic)
{ {
drm_magic_entry_t *prev = NULL; drm_magic_entry_t *prev = NULL;
drm_magic_entry_t *pt; drm_magic_entry_t *pt;
int hash; int hash;
DRM_DEBUG("%d\n", magic); DRM_DEBUG("%d\n", magic);
hash = drm_hash_magic(magic); hash = drm_hash_magic(magic);
...@@ -171,21 +172,22 @@ static int drm_remove_magic(drm_device_t *dev, drm_magic_t magic) ...@@ -171,21 +172,22 @@ static int drm_remove_magic(drm_device_t *dev, drm_magic_t magic)
* filp. * filp.
*/ */
int drm_getmagic(struct inode *inode, struct file *filp, int drm_getmagic(struct inode *inode, struct file *filp,
unsigned int cmd, unsigned long arg) unsigned int cmd, unsigned long arg)
{ {
static drm_magic_t sequence = 0; static drm_magic_t sequence = 0;
static DEFINE_SPINLOCK(lock); static DEFINE_SPINLOCK(lock);
drm_file_t *priv = filp->private_data; drm_file_t *priv = filp->private_data;
drm_device_t *dev = priv->head->dev; drm_device_t *dev = priv->head->dev;
drm_auth_t auth; drm_auth_t auth;
/* Find unique magic */ /* Find unique magic */
if (priv->magic) { if (priv->magic) {
auth.magic = priv->magic; auth.magic = priv->magic;
} else { } else {
do { do {
spin_lock(&lock); spin_lock(&lock);
if (!sequence) ++sequence; /* reserve 0 */ if (!sequence)
++sequence; /* reserve 0 */
auth.magic = sequence++; auth.magic = sequence++;
spin_unlock(&lock); spin_unlock(&lock);
} while (drm_find_file(dev, auth.magic)); } while (drm_find_file(dev, auth.magic));
...@@ -194,7 +196,7 @@ int drm_getmagic(struct inode *inode, struct file *filp, ...@@ -194,7 +196,7 @@ int drm_getmagic(struct inode *inode, struct file *filp,
} }
DRM_DEBUG("%u\n", auth.magic); DRM_DEBUG("%u\n", auth.magic);
if (copy_to_user((drm_auth_t __user *)arg, &auth, sizeof(auth))) if (copy_to_user((drm_auth_t __user *) arg, &auth, sizeof(auth)))
return -EFAULT; return -EFAULT;
return 0; return 0;
} }
...@@ -211,14 +213,14 @@ int drm_getmagic(struct inode *inode, struct file *filp, ...@@ -211,14 +213,14 @@ int drm_getmagic(struct inode *inode, struct file *filp,
* Checks if \p filp is associated with the magic number passed in \arg. * Checks if \p filp is associated with the magic number passed in \arg.
*/ */
int drm_authmagic(struct inode *inode, struct file *filp, int drm_authmagic(struct inode *inode, struct file *filp,
unsigned int cmd, unsigned long arg) unsigned int cmd, unsigned long arg)
{ {
drm_file_t *priv = filp->private_data; drm_file_t *priv = filp->private_data;
drm_device_t *dev = priv->head->dev; drm_device_t *dev = priv->head->dev;
drm_auth_t auth; drm_auth_t auth;
drm_file_t *file; drm_file_t *file;
if (copy_from_user(&auth, (drm_auth_t __user *)arg, sizeof(auth))) if (copy_from_user(&auth, (drm_auth_t __user *) arg, sizeof(auth)))
return -EFAULT; return -EFAULT;
DRM_DEBUG("%u\n", auth.magic); DRM_DEBUG("%u\n", auth.magic);
if ((file = drm_find_file(dev, auth.magic))) { if ((file = drm_find_file(dev, auth.magic))) {
......
This diff is collapsed.
This diff is collapsed.
/** /**
* \file drm_dma.h * \file drm_dma.c
* DMA IOCTL and function support * DMA IOCTL and function support
* *
* \author Rickard E. (Rik) Faith <faith@valinux.com> * \author Rickard E. (Rik) Faith <faith@valinux.com>
...@@ -37,23 +37,23 @@ ...@@ -37,23 +37,23 @@
/** /**
* Initialize the DMA data. * Initialize the DMA data.
* *
* \param dev DRM device. * \param dev DRM device.
* \return zero on success or a negative value on failure. * \return zero on success or a negative value on failure.
* *
* Allocate and initialize a drm_device_dma structure. * Allocate and initialize a drm_device_dma structure.
*/ */
int drm_dma_setup( drm_device_t *dev ) int drm_dma_setup(drm_device_t * dev)
{ {
int i; int i;
dev->dma = drm_alloc( sizeof(*dev->dma), DRM_MEM_DRIVER ); dev->dma = drm_alloc(sizeof(*dev->dma), DRM_MEM_DRIVER);
if ( !dev->dma ) if (!dev->dma)
return -ENOMEM; return -ENOMEM;
memset( dev->dma, 0, sizeof(*dev->dma) ); memset(dev->dma, 0, sizeof(*dev->dma));
for ( i = 0 ; i <= DRM_MAX_ORDER ; i++ ) for (i = 0; i <= DRM_MAX_ORDER; i++)
memset(&dev->dma->bufs[i], 0, sizeof(dev->dma->bufs[0])); memset(&dev->dma->bufs[i], 0, sizeof(dev->dma->bufs[0]));
return 0; return 0;
...@@ -67,14 +67,15 @@ int drm_dma_setup( drm_device_t *dev ) ...@@ -67,14 +67,15 @@ int drm_dma_setup( drm_device_t *dev )
* Free all pages associated with DMA buffers, the buffers and pages lists, and * Free all pages associated with DMA buffers, the buffers and pages lists, and
* finally the the drm_device::dma structure itself. * finally the the drm_device::dma structure itself.
*/ */
void drm_dma_takedown(drm_device_t *dev) void drm_dma_takedown(drm_device_t * dev)
{ {
drm_device_dma_t *dma = dev->dma; drm_device_dma_t *dma = dev->dma;
int i, j; int i, j;
if (!dma) return; if (!dma)
return;
/* Clear dma buffers */ /* Clear dma buffers */
for (i = 0; i <= DRM_MAX_ORDER; i++) { for (i = 0; i <= DRM_MAX_ORDER; i++) {
if (dma->bufs[i].seg_count) { if (dma->bufs[i].seg_count) {
DRM_DEBUG("order %d: buf_count = %d," DRM_DEBUG("order %d: buf_count = %d,"
...@@ -85,64 +86,63 @@ void drm_dma_takedown(drm_device_t *dev) ...@@ -85,64 +86,63 @@ void drm_dma_takedown(drm_device_t *dev)
for (j = 0; j < dma->bufs[i].seg_count; j++) { for (j = 0; j < dma->bufs[i].seg_count; j++) {
if (dma->bufs[i].seglist[j]) { if (dma->bufs[i].seglist[j]) {
drm_free_pages(dma->bufs[i].seglist[j], drm_free_pages(dma->bufs[i].seglist[j],
dma->bufs[i].page_order, dma->bufs[i].page_order,
DRM_MEM_DMA); DRM_MEM_DMA);
} }
} }
drm_free(dma->bufs[i].seglist, drm_free(dma->bufs[i].seglist,
dma->bufs[i].seg_count dma->bufs[i].seg_count
* sizeof(*dma->bufs[0].seglist), * sizeof(*dma->bufs[0].seglist), DRM_MEM_SEGS);
DRM_MEM_SEGS);
} }
if (dma->bufs[i].buf_count) { if (dma->bufs[i].buf_count) {
for (j = 0; j < dma->bufs[i].buf_count; j++) { for (j = 0; j < dma->bufs[i].buf_count; j++) {
if (dma->bufs[i].buflist[j].dev_private) { if (dma->bufs[i].buflist[j].dev_private) {
drm_free(dma->bufs[i].buflist[j].dev_private, drm_free(dma->bufs[i].buflist[j].
dma->bufs[i].buflist[j].dev_priv_size, dev_private,
DRM_MEM_BUFS); dma->bufs[i].buflist[j].
dev_priv_size, DRM_MEM_BUFS);
} }
} }
drm_free(dma->bufs[i].buflist, drm_free(dma->bufs[i].buflist,
dma->bufs[i].buf_count * dma->bufs[i].buf_count *
sizeof(*dma->bufs[0].buflist), sizeof(*dma->bufs[0].buflist), DRM_MEM_BUFS);
DRM_MEM_BUFS);
} }
} }
if (dma->buflist) { if (dma->buflist) {
drm_free(dma->buflist, drm_free(dma->buflist,
dma->buf_count * sizeof(*dma->buflist), dma->buf_count * sizeof(*dma->buflist), DRM_MEM_BUFS);
DRM_MEM_BUFS);
} }
if (dma->pagelist) { if (dma->pagelist) {
drm_free(dma->pagelist, drm_free(dma->pagelist,
dma->page_count * sizeof(*dma->pagelist), dma->page_count * sizeof(*dma->pagelist),
DRM_MEM_PAGES); DRM_MEM_PAGES);
} }
drm_free(dev->dma, sizeof(*dev->dma), DRM_MEM_DRIVER); drm_free(dev->dma, sizeof(*dev->dma), DRM_MEM_DRIVER);
dev->dma = NULL; dev->dma = NULL;
} }
/** /**
* Free a buffer. * Free a buffer.
* *
* \param dev DRM device. * \param dev DRM device.
* \param buf buffer to free. * \param buf buffer to free.
* *
* Resets the fields of \p buf. * Resets the fields of \p buf.
*/ */
void drm_free_buffer(drm_device_t *dev, drm_buf_t *buf) void drm_free_buffer(drm_device_t * dev, drm_buf_t * buf)
{ {
if (!buf) return; if (!buf)
return;
buf->waiting = 0; buf->waiting = 0;
buf->pending = 0; buf->pending = 0;
buf->filp = NULL; buf->filp = NULL;
buf->used = 0; buf->used = 0;
if (drm_core_check_feature(dev, DRIVER_DMA_QUEUE) && waitqueue_active(&buf->dma_wait)) { if (drm_core_check_feature(dev, DRIVER_DMA_QUEUE)
&& waitqueue_active(&buf->dma_wait)) {
wake_up_interruptible(&buf->dma_wait); wake_up_interruptible(&buf->dma_wait);
} }
} }
...@@ -154,12 +154,13 @@ void drm_free_buffer(drm_device_t *dev, drm_buf_t *buf) ...@@ -154,12 +154,13 @@ void drm_free_buffer(drm_device_t *dev, drm_buf_t *buf)
* *
* Frees each buffer associated with \p filp not already on the hardware. * Frees each buffer associated with \p filp not already on the hardware.
*/ */
void drm_core_reclaim_buffers(drm_device_t *dev, struct file *filp) void drm_core_reclaim_buffers(drm_device_t * dev, struct file *filp)
{ {
drm_device_dma_t *dma = dev->dma; drm_device_dma_t *dma = dev->dma;
int i; int i;
if (!dma) return; if (!dma)
return;
for (i = 0; i < dma->buf_count; i++) { for (i = 0; i < dma->buf_count; i++) {
if (dma->buflist[i]->filp == filp) { if (dma->buflist[i]->filp == filp) {
switch (dma->buflist[i]->list) { switch (dma->buflist[i]->list) {
...@@ -176,5 +177,5 @@ void drm_core_reclaim_buffers(drm_device_t *dev, struct file *filp) ...@@ -176,5 +177,5 @@ void drm_core_reclaim_buffers(drm_device_t *dev, struct file *filp)
} }
} }
} }
EXPORT_SYMBOL(drm_core_reclaim_buffers);
EXPORT_SYMBOL(drm_core_reclaim_buffers);
/** /**
* \file drm_drawable.h * \file drm_drawable.c
* IOCTLs for drawables * IOCTLs for drawables
* *
* \author Rickard E. (Rik) Faith <faith@valinux.com> * \author Rickard E. (Rik) Faith <faith@valinux.com>
...@@ -37,20 +37,20 @@ ...@@ -37,20 +37,20 @@
/** No-op. */ /** No-op. */
int drm_adddraw(struct inode *inode, struct file *filp, int drm_adddraw(struct inode *inode, struct file *filp,
unsigned int cmd, unsigned long arg) unsigned int cmd, unsigned long arg)
{ {
drm_draw_t draw; drm_draw_t draw;
draw.handle = 0; /* NOOP */ draw.handle = 0; /* NOOP */
DRM_DEBUG("%d\n", draw.handle); DRM_DEBUG("%d\n", draw.handle);
if (copy_to_user((drm_draw_t __user *)arg, &draw, sizeof(draw))) if (copy_to_user((drm_draw_t __user *) arg, &draw, sizeof(draw)))
return -EFAULT; return -EFAULT;
return 0; return 0;
} }
/** No-op. */ /** No-op. */
int drm_rmdraw(struct inode *inode, struct file *filp, int drm_rmdraw(struct inode *inode, struct file *filp,
unsigned int cmd, unsigned long arg) unsigned int cmd, unsigned long arg)
{ {
return 0; /* NOOP */ return 0; /* NOOP */
} }
This diff is collapsed.
This diff is collapsed.
/** /**
* \file drm_init.h * \file drm_init.c
* Setup/Cleanup for DRM * Setup/Cleanup for DRM
* *
* \author Rickard E. (Rik) Faith <faith@valinux.com> * \author Rickard E. (Rik) Faith <faith@valinux.com>
...@@ -43,10 +43,11 @@ ...@@ -43,10 +43,11 @@
int drm_cpu_valid(void) int drm_cpu_valid(void)
{ {
#if defined(__i386__) #if defined(__i386__)
if (boot_cpu_data.x86 == 3) return 0; /* No cmpxchg on a 386 */ if (boot_cpu_data.x86 == 3)
return 0; /* No cmpxchg on a 386 */
#endif #endif
#if defined(__sparc__) && !defined(__sparc_v9__) #if defined(__sparc__) && !defined(__sparc_v9__)
return 0; /* No cmpxchg before v9 sparc. */ return 0; /* No cmpxchg before v9 sparc. */
#endif #endif
return 1; return 1;
} }
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
...@@ -3,7 +3,6 @@ ...@@ -3,7 +3,6 @@
* OS abstraction macros. * OS abstraction macros.
*/ */
#include <linux/interrupt.h> /* For task queue support */ #include <linux/interrupt.h> /* For task queue support */
#include <linux/delay.h> #include <linux/delay.h>
...@@ -47,25 +46,25 @@ ...@@ -47,25 +46,25 @@
#else #else
/* define some dummy types for non AGP supporting kernels */ /* define some dummy types for non AGP supporting kernels */
struct no_agp_kern { struct no_agp_kern {
unsigned long aper_base; unsigned long aper_base;
unsigned long aper_size; unsigned long aper_size;
}; };
#define DRM_AGP_MEM int #define DRM_AGP_MEM int
#define DRM_AGP_KERN struct no_agp_kern #define DRM_AGP_KERN struct no_agp_kern
#endif #endif
#if !(__OS_HAS_MTRR) #if !(__OS_HAS_MTRR)
static __inline__ int mtrr_add (unsigned long base, unsigned long size, static __inline__ int mtrr_add(unsigned long base, unsigned long size,
unsigned int type, char increment) unsigned int type, char increment)
{ {
return -ENODEV; return -ENODEV;
} }
static __inline__ int mtrr_del (int reg, unsigned long base, static __inline__ int mtrr_del(int reg, unsigned long base, unsigned long size)
unsigned long size)
{ {
return -ENODEV; return -ENODEV;
} }
#define MTRR_TYPE_WRCOMB 1 #define MTRR_TYPE_WRCOMB 1
#endif #endif
...@@ -99,7 +98,7 @@ static __inline__ int mtrr_del (int reg, unsigned long base, ...@@ -99,7 +98,7 @@ static __inline__ int mtrr_del (int reg, unsigned long base,
#define DRM_GET_PRIV_WITH_RETURN(_priv, _filp) _priv = _filp->private_data #define DRM_GET_PRIV_WITH_RETURN(_priv, _filp) _priv = _filp->private_data
/** /**
* Get the pointer to the SAREA. * Get the pointer to the SAREA.
* *
* Searches the SAREA on the mapping lists and points drm_device::sarea to it. * Searches the SAREA on the mapping lists and points drm_device::sarea to it.
...@@ -143,7 +142,5 @@ do { \ ...@@ -143,7 +142,5 @@ do { \
remove_wait_queue(&(queue), &entry); \ remove_wait_queue(&(queue), &entry); \
} while (0) } while (0)
#define DRM_WAKEUP( queue ) wake_up_interruptible( queue ) #define DRM_WAKEUP( queue ) wake_up_interruptible( queue )
#define DRM_INIT_WAITQUEUE( queue ) init_waitqueue_head( queue ) #define DRM_INIT_WAITQUEUE( queue ) init_waitqueue_head( queue )
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
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