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