dev->agp_buffer_token = init->buffers_offset; 
static int i830_dma_initialize(drm_device_t *dev, 			       drm_i830_private_t *dev_priv,			       drm_i830_init_t *init){	struct list_head *list;   	memset(dev_priv, 0, sizeof(drm_i830_private_t));	list_for_each(list, &dev->maplist->head) {		drm_map_list_t *r_list = list_entry(list, drm_map_list_t, head);		if( r_list->map &&		    r_list->map->type == _DRM_SHM &&		    r_list->map->flags & _DRM_CONTAINS_LOCK ) {			dev_priv->sarea_map = r_list->map; 			break; 		} 	}	if(!dev_priv->sarea_map) {		dev->dev_private = (void *)dev_priv;		i830_dma_cleanup(dev);		DRM_ERROR("can not find sarea!\n");		return -EINVAL;	}	dev_priv->mmio_map = drm_core_findmap(dev, init->mmio_offset);	if(!dev_priv->mmio_map) {		dev->dev_private = (void *)dev_priv;		i830_dma_cleanup(dev);		DRM_ERROR("can not find mmio map!\n");		return -EINVAL;	}	dev->agp_buffer_map = drm_core_findmap(dev, init->buffers_offset);	if(!dev->agp_buffer_map) {		dev->dev_private = (void *)dev_priv;		i830_dma_cleanup(dev);		DRM_ERROR("can not find dma buffer map!\n");		return -EINVAL;	}	dev_priv->sarea_priv = (drm_i830_sarea_t *)		((u8 *)dev_priv->sarea_map->handle +		 init->sarea_priv_offset);   	dev_priv->ring.Start = init->ring_start;   	dev_priv->ring.End = init->ring_end;   	dev_priv->ring.Size = init->ring_size;   	dev_priv->ring.virtual_start = drm_ioremap(dev->agp->base + 						    init->ring_start, 						    init->ring_size, dev);   	if (dev_priv->ring.virtual_start == NULL) {		dev->dev_private = (void *) dev_priv;	   	i830_dma_cleanup(dev);	   	DRM_ERROR("can not ioremap virtual address for"			  " ring buffer\n");	   	return -ENOMEM;	}   	dev_priv->ring.tail_mask = dev_priv->ring.Size - 1;   	dev_priv->w = init->w;	dev_priv->h = init->h;	dev_priv->pitch = init->pitch;	dev_priv->back_offset = init->back_offset;	dev_priv->depth_offset = init->depth_offset;	dev_priv->front_offset = init->front_offset;	dev_priv->front_di1 = init->front_offset | init->pitch_bits;	dev_priv->back_di1 = init->back_offset | init->pitch_bits;	dev_priv->zi1 = init->depth_offset | init->pitch_bits;	DRM_DEBUG("front_di1 %x\n",    dev_priv->front_di1);	DRM_DEBUG("back_offset %x\n", dev_priv->back_offset);	DRM_DEBUG("back_di1 %x\n",    dev_priv->back_di1);	DRM_DEBUG("pitch_bits %x\n",    init->pitch_bits);	dev_priv->cpp = init->cpp;	/* We are using separate values as placeholders for mechanisms for	 * private backbuffer/depthbuffer usage.	 */	dev_priv->back_pitch = init->back_pitch;	dev_priv->depth_pitch = init->depth_pitch;	dev_priv->do_boxes = 0;	dev_priv->use_mi_batchbuffer_start = 0;   	/* Program Hardware Status Page */   	dev_priv->hw_status_page =		pci_alloc_consistent(dev->pdev, PAGE_SIZE,						&dev_priv->dma_status_page);   	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(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");      	/* Now we need to init our freelist */   	if(i830_freelist_init(dev, dev_priv) != 0) {		dev->dev_private = (void *)dev_priv;	   	i830_dma_cleanup(dev);	   	DRM_ERROR("Not enough space in the status page for"			  " the freelist\n");	   	return -ENOMEM;	}	dev->dev_private = (void *)dev_priv;   	return 0;}
4520	/local/tlutelli/issta_data/temp/c/2005_temp/2005/4520/d1f2b55ad2c11f46e30547a9f7754e99b478348e/i830_dma.c/buggy/drivers/char/drm/i830_dma.c