i460-agp.c (ea248bcaadd5bafe4217357e1e511ac55639bcf3) i460-agp.c (4e57b6817880946a3a78d5d8cad1ace363f7e449)
1/*
2 * For documentation on the i460 AGP interface, see Chapter 7 (AGP Subsystem) of
3 * the "Intel 460GTX Chipset Software Developer's Manual":
4 * http://developer.intel.com/design/itanium/downloads/24870401s.htm
5 */
6/*
7 * 460GX support by Chris Ahna <christopher.j.ahna@intel.com>
8 * Clean up & simplification by David Mosberger-Tang <davidm@hpl.hp.com>
9 */
10#include <linux/module.h>
11#include <linux/pci.h>
12#include <linux/init.h>
1/*
2 * For documentation on the i460 AGP interface, see Chapter 7 (AGP Subsystem) of
3 * the "Intel 460GTX Chipset Software Developer's Manual":
4 * http://developer.intel.com/design/itanium/downloads/24870401s.htm
5 */
6/*
7 * 460GX support by Chris Ahna <christopher.j.ahna@intel.com>
8 * Clean up & simplification by David Mosberger-Tang <davidm@hpl.hp.com>
9 */
10#include <linux/module.h>
11#include <linux/pci.h>
12#include <linux/init.h>
13#include <linux/string.h>
14#include <linux/slab.h>
13#include <linux/agp_backend.h>
14
15#include "agp.h"
16
17#define INTEL_I460_BAPBASE 0x98
18#define INTEL_I460_GXBCTL 0xa0
19#define INTEL_I460_AGPSIZ 0xa2
20#define INTEL_I460_ATTBASE 0xfe200000

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

220 (scratch & 0x02) | I460_GXBCTL_OOG | I460_GXBCTL_BWC);
221
222 /*
223 * Initialize partial allocation trackers if a GART page is bigger than a kernel
224 * page.
225 */
226 if (I460_IO_PAGE_SHIFT > PAGE_SHIFT) {
227 size = current_size->num_entries * sizeof(i460.lp_desc[0]);
15#include <linux/agp_backend.h>
16
17#include "agp.h"
18
19#define INTEL_I460_BAPBASE 0x98
20#define INTEL_I460_GXBCTL 0xa0
21#define INTEL_I460_AGPSIZ 0xa2
22#define INTEL_I460_ATTBASE 0xfe200000

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

222 (scratch & 0x02) | I460_GXBCTL_OOG | I460_GXBCTL_BWC);
223
224 /*
225 * Initialize partial allocation trackers if a GART page is bigger than a kernel
226 * page.
227 */
228 if (I460_IO_PAGE_SHIFT > PAGE_SHIFT) {
229 size = current_size->num_entries * sizeof(i460.lp_desc[0]);
228 i460.lp_desc = kzalloc(size, GFP_KERNEL);
230 i460.lp_desc = kmalloc(size, GFP_KERNEL);
229 if (!i460.lp_desc)
230 return -ENOMEM;
231 if (!i460.lp_desc)
232 return -ENOMEM;
233 memset(i460.lp_desc, 0, size);
231 }
232 return 0;
233}
234
235static int i460_create_gatt_table (struct agp_bridge_data *bridge)
236{
237 int page_order, num_entries, i;
238 void *temp;

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

358
359 lpage = (void *) __get_free_pages(GFP_KERNEL, order);
360 if (!lpage) {
361 printk(KERN_ERR PFX "Couldn't alloc 4M GART page...\n");
362 return -ENOMEM;
363 }
364
365 map_size = ((I460_KPAGES_PER_IOPAGE + BITS_PER_LONG - 1) & -BITS_PER_LONG)/8;
234 }
235 return 0;
236}
237
238static int i460_create_gatt_table (struct agp_bridge_data *bridge)
239{
240 int page_order, num_entries, i;
241 void *temp;

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

361
362 lpage = (void *) __get_free_pages(GFP_KERNEL, order);
363 if (!lpage) {
364 printk(KERN_ERR PFX "Couldn't alloc 4M GART page...\n");
365 return -ENOMEM;
366 }
367
368 map_size = ((I460_KPAGES_PER_IOPAGE + BITS_PER_LONG - 1) & -BITS_PER_LONG)/8;
366 lp->alloced_map = kzalloc(map_size, GFP_KERNEL);
369 lp->alloced_map = kmalloc(map_size, GFP_KERNEL);
367 if (!lp->alloced_map) {
368 free_pages((unsigned long) lpage, order);
369 printk(KERN_ERR PFX "Out of memory, we're in trouble...\n");
370 return -ENOMEM;
371 }
370 if (!lp->alloced_map) {
371 free_pages((unsigned long) lpage, order);
372 printk(KERN_ERR PFX "Out of memory, we're in trouble...\n");
373 return -ENOMEM;
374 }
375 memset(lp->alloced_map, 0, map_size);
372
373 lp->paddr = virt_to_gart(lpage);
374 lp->refcount = 0;
375 atomic_add(I460_KPAGES_PER_IOPAGE, &agp_bridge->current_memory_agp);
376 return 0;
377}
378
379static void i460_free_large_page (struct lp_desc *lp)

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

610 .subdevice = PCI_ANY_ID,
611 },
612 { }
613};
614
615MODULE_DEVICE_TABLE(pci, agp_intel_i460_pci_table);
616
617static struct pci_driver agp_intel_i460_pci_driver = {
376
377 lp->paddr = virt_to_gart(lpage);
378 lp->refcount = 0;
379 atomic_add(I460_KPAGES_PER_IOPAGE, &agp_bridge->current_memory_agp);
380 return 0;
381}
382
383static void i460_free_large_page (struct lp_desc *lp)

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

614 .subdevice = PCI_ANY_ID,
615 },
616 { }
617};
618
619MODULE_DEVICE_TABLE(pci, agp_intel_i460_pci_table);
620
621static struct pci_driver agp_intel_i460_pci_driver = {
618 .owner = THIS_MODULE,
619 .name = "agpgart-intel-i460",
620 .id_table = agp_intel_i460_pci_table,
621 .probe = agp_intel_i460_probe,
622 .remove = __devexit_p(agp_intel_i460_remove),
623};
624
625static int __init agp_intel_i460_init(void)
626{

--- 15 unchanged lines hidden ---
622 .name = "agpgart-intel-i460",
623 .id_table = agp_intel_i460_pci_table,
624 .probe = agp_intel_i460_probe,
625 .remove = __devexit_p(agp_intel_i460_remove),
626};
627
628static int __init agp_intel_i460_init(void)
629{

--- 15 unchanged lines hidden ---