dca.c (885b201056e942f7deb66496b5c501d2a35d6c04) dca.c (3372de5813e4da8305002ff6ffbfc0c7012cb319)
1/*
2 * Intel I/OAT DMA Linux driver
3 * Copyright(c) 2007 - 2009 Intel Corporation.
4 *
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms and conditions of the GNU General Public License,
7 * version 2, as published by the Free Software Foundation.
8 *

--- 118 unchanged lines hidden (view full) ---

127 pdev = to_pci_dev(dev);
128 for (i = 0; i < ioatdca->max_requesters; i++) {
129 if (ioatdca->req_slots[i].pdev == pdev)
130 return 1;
131 }
132 return 0;
133}
134
1/*
2 * Intel I/OAT DMA Linux driver
3 * Copyright(c) 2007 - 2009 Intel Corporation.
4 *
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms and conditions of the GNU General Public License,
7 * version 2, as published by the Free Software Foundation.
8 *

--- 118 unchanged lines hidden (view full) ---

127 pdev = to_pci_dev(dev);
128 for (i = 0; i < ioatdca->max_requesters; i++) {
129 if (ioatdca->req_slots[i].pdev == pdev)
130 return 1;
131 }
132 return 0;
133}
134
135static int ioat3_dca_add_requester(struct dca_provider *dca, struct device *dev)
135static int ioat_dca_add_requester(struct dca_provider *dca, struct device *dev)
136{
137 struct ioat_dca_priv *ioatdca = dca_priv(dca);
138 struct pci_dev *pdev;
139 int i;
140 u16 id;
141 u16 global_req_table;
142
143 /* This implementation only supports PCI-Express */

--- 17 unchanged lines hidden (view full) ---

161 ioatdca->iobase + global_req_table + (i * 4));
162 return i;
163 }
164 }
165 /* Error, ioatdma->requester_count is out of whack */
166 return -EFAULT;
167}
168
136{
137 struct ioat_dca_priv *ioatdca = dca_priv(dca);
138 struct pci_dev *pdev;
139 int i;
140 u16 id;
141 u16 global_req_table;
142
143 /* This implementation only supports PCI-Express */

--- 17 unchanged lines hidden (view full) ---

161 ioatdca->iobase + global_req_table + (i * 4));
162 return i;
163 }
164 }
165 /* Error, ioatdma->requester_count is out of whack */
166 return -EFAULT;
167}
168
169static int ioat3_dca_remove_requester(struct dca_provider *dca,
169static int ioat_dca_remove_requester(struct dca_provider *dca,
170 struct device *dev)
171{
172 struct ioat_dca_priv *ioatdca = dca_priv(dca);
173 struct pci_dev *pdev;
174 int i;
175 u16 global_req_table;
176
177 /* This implementation only supports PCI-Express */

--- 10 unchanged lines hidden (view full) ---

188 ioatdca->req_slots[i].rid = 0;
189 ioatdca->requester_count--;
190 return i;
191 }
192 }
193 return -ENODEV;
194}
195
170 struct device *dev)
171{
172 struct ioat_dca_priv *ioatdca = dca_priv(dca);
173 struct pci_dev *pdev;
174 int i;
175 u16 global_req_table;
176
177 /* This implementation only supports PCI-Express */

--- 10 unchanged lines hidden (view full) ---

188 ioatdca->req_slots[i].rid = 0;
189 ioatdca->requester_count--;
190 return i;
191 }
192 }
193 return -ENODEV;
194}
195
196static u8 ioat3_dca_get_tag(struct dca_provider *dca,
196static u8 ioat_dca_get_tag(struct dca_provider *dca,
197 struct device *dev,
198 int cpu)
199{
200 u8 tag;
201
202 struct ioat_dca_priv *ioatdca = dca_priv(dca);
203 int i, apic_id, bit, value;
204 u8 entry;

--- 14 unchanged lines hidden (view full) ---

219 value = (entry & DCA3_TAG_MAP_LITERAL_VAL) ? 1 : 0;
220 }
221 tag |= (value << i);
222 }
223
224 return tag;
225}
226
197 struct device *dev,
198 int cpu)
199{
200 u8 tag;
201
202 struct ioat_dca_priv *ioatdca = dca_priv(dca);
203 int i, apic_id, bit, value;
204 u8 entry;

--- 14 unchanged lines hidden (view full) ---

219 value = (entry & DCA3_TAG_MAP_LITERAL_VAL) ? 1 : 0;
220 }
221 tag |= (value << i);
222 }
223
224 return tag;
225}
226
227static struct dca_ops ioat3_dca_ops = {
228 .add_requester = ioat3_dca_add_requester,
229 .remove_requester = ioat3_dca_remove_requester,
230 .get_tag = ioat3_dca_get_tag,
227static struct dca_ops ioat_dca_ops = {
228 .add_requester = ioat_dca_add_requester,
229 .remove_requester = ioat_dca_remove_requester,
230 .get_tag = ioat_dca_get_tag,
231 .dev_managed = ioat_dca_dev_managed,
232};
233
231 .dev_managed = ioat_dca_dev_managed,
232};
233
234static int ioat3_dca_count_dca_slots(void *iobase, u16 dca_offset)
234static int ioat_dca_count_dca_slots(void *iobase, u16 dca_offset)
235{
236 int slots = 0;
237 u32 req;
238 u16 global_req_table;
239
240 global_req_table = readw(iobase + dca_offset + IOAT3_DCA_GREQID_OFFSET);
241 if (global_req_table == 0)
242 return 0;

--- 18 unchanged lines hidden (view full) ---

261 */
262 return ((tag_map[0] == DCA_TAG_MAP_VALID) &&
263 (tag_map[1] == DCA_TAG_MAP_VALID) &&
264 (tag_map[2] == DCA_TAG_MAP_VALID) &&
265 (tag_map[3] == DCA_TAG_MAP_VALID) &&
266 (tag_map[4] == DCA_TAG_MAP_VALID));
267}
268
235{
236 int slots = 0;
237 u32 req;
238 u16 global_req_table;
239
240 global_req_table = readw(iobase + dca_offset + IOAT3_DCA_GREQID_OFFSET);
241 if (global_req_table == 0)
242 return 0;

--- 18 unchanged lines hidden (view full) ---

261 */
262 return ((tag_map[0] == DCA_TAG_MAP_VALID) &&
263 (tag_map[1] == DCA_TAG_MAP_VALID) &&
264 (tag_map[2] == DCA_TAG_MAP_VALID) &&
265 (tag_map[3] == DCA_TAG_MAP_VALID) &&
266 (tag_map[4] == DCA_TAG_MAP_VALID));
267}
268
269struct dca_provider *ioat3_dca_init(struct pci_dev *pdev, void __iomem *iobase)
269struct dca_provider *ioat_dca_init(struct pci_dev *pdev, void __iomem *iobase)
270{
271 struct dca_provider *dca;
272 struct ioat_dca_priv *ioatdca;
273 int slots;
274 int i;
275 int err;
276 u16 dca_offset;
277 u16 csi_fsb_control;

--- 10 unchanged lines hidden (view full) ---

288
289 if (!system_has_dca_enabled(pdev))
290 return NULL;
291
292 dca_offset = readw(iobase + IOAT_DCAOFFSET_OFFSET);
293 if (dca_offset == 0)
294 return NULL;
295
270{
271 struct dca_provider *dca;
272 struct ioat_dca_priv *ioatdca;
273 int slots;
274 int i;
275 int err;
276 u16 dca_offset;
277 u16 csi_fsb_control;

--- 10 unchanged lines hidden (view full) ---

288
289 if (!system_has_dca_enabled(pdev))
290 return NULL;
291
292 dca_offset = readw(iobase + IOAT_DCAOFFSET_OFFSET);
293 if (dca_offset == 0)
294 return NULL;
295
296 slots = ioat3_dca_count_dca_slots(iobase, dca_offset);
296 slots = ioat_dca_count_dca_slots(iobase, dca_offset);
297 if (slots == 0)
298 return NULL;
299
297 if (slots == 0)
298 return NULL;
299
300 dca = alloc_dca_provider(&ioat3_dca_ops,
300 dca = alloc_dca_provider(&ioat_dca_ops,
301 sizeof(*ioatdca)
302 + (sizeof(struct ioat_dca_slot) * slots));
303 if (!dca)
304 return NULL;
305
306 ioatdca = dca_priv(dca);
307 ioatdca->iobase = iobase;
308 ioatdca->dca_base = iobase + dca_offset;

--- 46 unchanged lines hidden ---
301 sizeof(*ioatdca)
302 + (sizeof(struct ioat_dca_slot) * slots));
303 if (!dca)
304 return NULL;
305
306 ioatdca = dca_priv(dca);
307 ioatdca->iobase = iobase;
308 ioatdca->dca_base = iobase + dca_offset;

--- 46 unchanged lines hidden ---