Lines Matching refs:buf
69 void saa7164_buffer_display(struct saa7164_buffer *buf) in saa7164_buffer_display() argument
71 struct saa7164_dev *dev = buf->port->dev; in saa7164_buffer_display()
75 __func__, buf, buf->idx); in saa7164_buffer_display()
77 buf->cpu, (long long)buf->dma, buf->pci_size); in saa7164_buffer_display()
79 buf->pt_cpu, (long long)buf->pt_dma, buf->pt_size); in saa7164_buffer_display()
85 i, buf->pt_cpu, (u64)*(buf->pt_cpu)); in saa7164_buffer_display()
96 struct saa7164_buffer *buf = NULL; in saa7164_buffer_alloc() local
105 buf = kzalloc(sizeof(struct saa7164_buffer), GFP_KERNEL); in saa7164_buffer_alloc()
106 if (!buf) { in saa7164_buffer_alloc()
111 buf->idx = -1; in saa7164_buffer_alloc()
112 buf->port = port; in saa7164_buffer_alloc()
113 buf->flags = SAA7164_BUFFER_FREE; in saa7164_buffer_alloc()
114 buf->pos = 0; in saa7164_buffer_alloc()
115 buf->actual_size = params->pitch * params->numberoflines; in saa7164_buffer_alloc()
116 buf->crc = 0; in saa7164_buffer_alloc()
118 buf->pci_size = SAA7164_PT_ENTRIES * 0x1000; in saa7164_buffer_alloc()
119 buf->pt_size = (SAA7164_PT_ENTRIES * sizeof(u64)) + 0x1000; in saa7164_buffer_alloc()
122 buf->cpu = pci_alloc_consistent(port->dev->pci, buf->pci_size, in saa7164_buffer_alloc()
123 &buf->dma); in saa7164_buffer_alloc()
124 if (!buf->cpu) in saa7164_buffer_alloc()
127 buf->pt_cpu = pci_alloc_consistent(port->dev->pci, buf->pt_size, in saa7164_buffer_alloc()
128 &buf->pt_dma); in saa7164_buffer_alloc()
129 if (!buf->pt_cpu) in saa7164_buffer_alloc()
133 memset(buf->cpu, 0xff, buf->pci_size); in saa7164_buffer_alloc()
134 buf->crc = crc32(0, buf->cpu, buf->actual_size); in saa7164_buffer_alloc()
135 memset(buf->pt_cpu, 0xff, buf->pt_size); in saa7164_buffer_alloc()
138 __func__, buf, params->numpagetables); in saa7164_buffer_alloc()
140 buf->cpu, (long)buf->dma, buf->pci_size); in saa7164_buffer_alloc()
142 buf->pt_cpu, (long)buf->pt_dma, buf->pt_size); in saa7164_buffer_alloc()
147 *(buf->pt_cpu + i) = buf->dma + (i * 0x1000); /* TODO */ in saa7164_buffer_alloc()
149 i, buf->pt_cpu, (u64)*(buf->pt_cpu)); in saa7164_buffer_alloc()
156 pci_free_consistent(port->dev->pci, buf->pci_size, buf->cpu, buf->dma); in saa7164_buffer_alloc()
158 kfree(buf); in saa7164_buffer_alloc()
160 buf = NULL; in saa7164_buffer_alloc()
162 return buf; in saa7164_buffer_alloc()
165 int saa7164_buffer_dealloc(struct saa7164_buffer *buf) in saa7164_buffer_dealloc() argument
169 if (!buf || !buf->port) in saa7164_buffer_dealloc()
171 dev = buf->port->dev; in saa7164_buffer_dealloc()
174 __func__, buf); in saa7164_buffer_dealloc()
176 if (buf->flags != SAA7164_BUFFER_FREE) in saa7164_buffer_dealloc()
179 pci_free_consistent(dev->pci, buf->pci_size, buf->cpu, buf->dma); in saa7164_buffer_dealloc()
180 pci_free_consistent(dev->pci, buf->pt_size, buf->pt_cpu, buf->pt_dma); in saa7164_buffer_dealloc()
182 kfree(buf); in saa7164_buffer_dealloc()
202 int saa7164_buffer_activate(struct saa7164_buffer *buf, int i) in saa7164_buffer_activate() argument
204 struct saa7164_port *port = buf->port; in saa7164_buffer_activate()
212 buf->idx = i; /* Note of which buffer list index position we occupy */ in saa7164_buffer_activate()
213 buf->flags = SAA7164_BUFFER_BUSY; in saa7164_buffer_activate()
214 buf->pos = 0; in saa7164_buffer_activate()
218 saa7164_writel(port->bufptr32h + ((sizeof(u32) * 2) * i), buf->pt_dma); in saa7164_buffer_activate()
223 buf->idx, in saa7164_buffer_activate()
230 buf->idx); in saa7164_buffer_activate()
239 struct saa7164_buffer *buf; in saa7164_buffer_cfg_port() local
268 buf = list_entry(c, struct saa7164_buffer, list); in saa7164_buffer_cfg_port()
270 if (buf->flags != SAA7164_BUFFER_FREE) in saa7164_buffer_cfg_port()
274 saa7164_buffer_activate(buf, i); in saa7164_buffer_cfg_port()
289 struct saa7164_user_buffer *buf; in saa7164_buffer_alloc_user() local
291 buf = kzalloc(sizeof(struct saa7164_user_buffer), GFP_KERNEL); in saa7164_buffer_alloc_user()
292 if (!buf) in saa7164_buffer_alloc_user()
295 buf->data = kzalloc(len, GFP_KERNEL); in saa7164_buffer_alloc_user()
297 if (!buf->data) { in saa7164_buffer_alloc_user()
298 kfree(buf); in saa7164_buffer_alloc_user()
302 buf->actual_size = len; in saa7164_buffer_alloc_user()
303 buf->pos = 0; in saa7164_buffer_alloc_user()
304 buf->crc = 0; in saa7164_buffer_alloc_user()
307 __func__, buf); in saa7164_buffer_alloc_user()
309 return buf; in saa7164_buffer_alloc_user()
312 void saa7164_buffer_dealloc_user(struct saa7164_user_buffer *buf) in saa7164_buffer_dealloc_user() argument
314 if (!buf) in saa7164_buffer_dealloc_user()
317 kfree(buf->data); in saa7164_buffer_dealloc_user()
318 buf->data = NULL; in saa7164_buffer_dealloc_user()
320 kfree(buf); in saa7164_buffer_dealloc_user()