Lines Matching refs:buf
55 void saa7164_buffer_display(struct saa7164_buffer *buf) in saa7164_buffer_display() argument
57 struct saa7164_dev *dev = buf->port->dev; in saa7164_buffer_display()
61 __func__, buf, buf->idx); in saa7164_buffer_display()
63 buf->cpu, (long long)buf->dma, buf->pci_size); in saa7164_buffer_display()
65 buf->pt_cpu, (long long)buf->pt_dma, buf->pt_size); in saa7164_buffer_display()
71 i, buf->pt_cpu, (u64)*(buf->pt_cpu)); in saa7164_buffer_display()
82 struct saa7164_buffer *buf = NULL; in saa7164_buffer_alloc() local
91 buf = kzalloc(sizeof(*buf), GFP_KERNEL); in saa7164_buffer_alloc()
92 if (!buf) in saa7164_buffer_alloc()
95 buf->idx = -1; in saa7164_buffer_alloc()
96 buf->port = port; in saa7164_buffer_alloc()
97 buf->flags = SAA7164_BUFFER_FREE; in saa7164_buffer_alloc()
98 buf->pos = 0; in saa7164_buffer_alloc()
99 buf->actual_size = params->pitch * params->numberoflines; in saa7164_buffer_alloc()
100 buf->crc = 0; in saa7164_buffer_alloc()
102 buf->pci_size = SAA7164_PT_ENTRIES * 0x1000; in saa7164_buffer_alloc()
103 buf->pt_size = (SAA7164_PT_ENTRIES * sizeof(u64)) + 0x1000; in saa7164_buffer_alloc()
106 buf->cpu = pci_alloc_consistent(port->dev->pci, buf->pci_size, in saa7164_buffer_alloc()
107 &buf->dma); in saa7164_buffer_alloc()
108 if (!buf->cpu) in saa7164_buffer_alloc()
111 buf->pt_cpu = pci_alloc_consistent(port->dev->pci, buf->pt_size, in saa7164_buffer_alloc()
112 &buf->pt_dma); in saa7164_buffer_alloc()
113 if (!buf->pt_cpu) in saa7164_buffer_alloc()
117 memset(buf->cpu, 0xff, buf->pci_size); in saa7164_buffer_alloc()
118 buf->crc = crc32(0, buf->cpu, buf->actual_size); in saa7164_buffer_alloc()
119 memset(buf->pt_cpu, 0xff, buf->pt_size); in saa7164_buffer_alloc()
122 __func__, buf, params->numpagetables); in saa7164_buffer_alloc()
124 buf->cpu, (long)buf->dma, buf->pci_size); in saa7164_buffer_alloc()
126 buf->pt_cpu, (long)buf->pt_dma, buf->pt_size); in saa7164_buffer_alloc()
131 *(buf->pt_cpu + i) = buf->dma + (i * 0x1000); /* TODO */ in saa7164_buffer_alloc()
133 i, buf->pt_cpu, (u64)*(buf->pt_cpu)); in saa7164_buffer_alloc()
140 pci_free_consistent(port->dev->pci, buf->pci_size, buf->cpu, buf->dma); in saa7164_buffer_alloc()
142 kfree(buf); in saa7164_buffer_alloc()
144 buf = NULL; in saa7164_buffer_alloc()
146 return buf; in saa7164_buffer_alloc()
149 int saa7164_buffer_dealloc(struct saa7164_buffer *buf) in saa7164_buffer_dealloc() argument
153 if (!buf || !buf->port) in saa7164_buffer_dealloc()
155 dev = buf->port->dev; in saa7164_buffer_dealloc()
158 __func__, buf); in saa7164_buffer_dealloc()
160 if (buf->flags != SAA7164_BUFFER_FREE) in saa7164_buffer_dealloc()
163 pci_free_consistent(dev->pci, buf->pci_size, buf->cpu, buf->dma); in saa7164_buffer_dealloc()
164 pci_free_consistent(dev->pci, buf->pt_size, buf->pt_cpu, buf->pt_dma); in saa7164_buffer_dealloc()
166 kfree(buf); in saa7164_buffer_dealloc()
186 int saa7164_buffer_activate(struct saa7164_buffer *buf, int i) in saa7164_buffer_activate() argument
188 struct saa7164_port *port = buf->port; in saa7164_buffer_activate()
196 buf->idx = i; /* Note of which buffer list index position we occupy */ in saa7164_buffer_activate()
197 buf->flags = SAA7164_BUFFER_BUSY; in saa7164_buffer_activate()
198 buf->pos = 0; in saa7164_buffer_activate()
202 saa7164_writel(port->bufptr32h + ((sizeof(u32) * 2) * i), buf->pt_dma); in saa7164_buffer_activate()
206 buf->idx, in saa7164_buffer_activate()
213 buf->idx); in saa7164_buffer_activate()
222 struct saa7164_buffer *buf; in saa7164_buffer_cfg_port() local
251 buf = list_entry(c, struct saa7164_buffer, list); in saa7164_buffer_cfg_port()
253 BUG_ON(buf->flags != SAA7164_BUFFER_FREE); in saa7164_buffer_cfg_port()
256 saa7164_buffer_activate(buf, i); in saa7164_buffer_cfg_port()
271 struct saa7164_user_buffer *buf; in saa7164_buffer_alloc_user() local
273 buf = kzalloc(sizeof(*buf), GFP_KERNEL); in saa7164_buffer_alloc_user()
274 if (!buf) in saa7164_buffer_alloc_user()
277 buf->data = kzalloc(len, GFP_KERNEL); in saa7164_buffer_alloc_user()
279 if (!buf->data) { in saa7164_buffer_alloc_user()
280 kfree(buf); in saa7164_buffer_alloc_user()
284 buf->actual_size = len; in saa7164_buffer_alloc_user()
285 buf->pos = 0; in saa7164_buffer_alloc_user()
286 buf->crc = 0; in saa7164_buffer_alloc_user()
289 __func__, buf); in saa7164_buffer_alloc_user()
291 return buf; in saa7164_buffer_alloc_user()
294 void saa7164_buffer_dealloc_user(struct saa7164_user_buffer *buf) in saa7164_buffer_dealloc_user() argument
296 if (!buf) in saa7164_buffer_dealloc_user()
299 kfree(buf->data); in saa7164_buffer_dealloc_user()
300 buf->data = NULL; in saa7164_buffer_dealloc_user()
302 kfree(buf); in saa7164_buffer_dealloc_user()