Merge branch 'agp-patches' of git://git.kernel.org/pub/scm/linux/kernel/git/airlied/agp-2.6

* 'agp-patches' of git://git.kernel.org/pub/scm/linux/kernel/git/airlied/agp-2.6:
agp: remove flush_agp_mappings calls from new flush handling code
intel-agp: introduce IS_I915 and do some cleanups..
[intel_agp] fix name for G35 chipset
intel-agp: fixup resource handling in flush code.
intel-agp: add new chipset ID
agp: remove unnecessary pci_dev_put
agp: remove uid comparison as security check
fix AGP warning
agp/intel: Add chipset flushing support for i8xx chipsets.
intel-agp: add chipset flushing support
agp: add chipset flushing support to AGP interface

+276 -71
+1 -1
arch/x86/pci/i386.c
··· 72 72 } 73 73 } 74 74 } 75 - 75 + EXPORT_SYMBOL(pcibios_align_resource); 76 76 77 77 /* 78 78 * Handle resources of PCI devices. If the world were perfect, we could
+5 -1
drivers/char/agp/agp.h
··· 117 117 void (*free_by_type)(struct agp_memory *); 118 118 void *(*agp_alloc_page)(struct agp_bridge_data *); 119 119 void (*agp_destroy_page)(void *, int flags); 120 - int (*agp_type_to_mask_type) (struct agp_bridge_data *, int); 120 + int (*agp_type_to_mask_type) (struct agp_bridge_data *, int); 121 + void (*chipset_flush)(struct agp_bridge_data *); 121 122 }; 122 123 123 124 struct agp_bridge_data { ··· 236 235 #define I965_PGETBL_SIZE_512KB (0 << 1) 237 236 #define I965_PGETBL_SIZE_256KB (1 << 1) 238 237 #define I965_PGETBL_SIZE_128KB (2 << 1) 238 + #define I965_PGETBL_SIZE_1MB (3 << 1) 239 + #define I965_PGETBL_SIZE_2MB (4 << 1) 240 + #define I965_PGETBL_SIZE_1_5MB (5 << 1) 239 241 #define G33_PGETBL_SIZE_MASK (3 << 8) 240 242 #define G33_PGETBL_SIZE_1M (1 << 8) 241 243 #define G33_PGETBL_SIZE_2M (2 << 8)
-4
drivers/char/agp/amd-k7-agp.c
··· 436 436 return -ENODEV; 437 437 } 438 438 cap_ptr = pci_find_capability(gfxcard, PCI_CAP_ID_AGP); 439 - if (!cap_ptr) { 440 - pci_dev_put(gfxcard); 441 - continue; 442 - } 443 439 } 444 440 445 441 /* With so many variants of NVidia cards, it's simpler just
+1 -1
drivers/char/agp/backend.c
··· 43 43 * fix some real stupidity. It's only by chance we can bump 44 44 * past 0.99 at all due to some boolean logic error. */ 45 45 #define AGPGART_VERSION_MAJOR 0 46 - #define AGPGART_VERSION_MINOR 102 46 + #define AGPGART_VERSION_MINOR 103 47 47 static const struct agp_version agp_current_version = 48 48 { 49 49 .major = AGPGART_VERSION_MAJOR,
+4
drivers/char/agp/compat_ioctl.c
··· 273 273 case AGPIOC_UNBIND32: 274 274 ret_val = compat_agpioc_unbind_wrap(curr_priv, (void __user *) arg); 275 275 break; 276 + 277 + case AGPIOC_CHIPSET_FLUSH32: 278 + ret_val = agpioc_chipset_flush_wrap(curr_priv); 279 + break; 276 280 } 277 281 278 282 ioctl_out:
+2
drivers/char/agp/compat_ioctl.h
··· 39 39 #define AGPIOC_DEALLOCATE32 _IOW (AGPIOC_BASE, 7, compat_int_t) 40 40 #define AGPIOC_BIND32 _IOW (AGPIOC_BASE, 8, compat_uptr_t) 41 41 #define AGPIOC_UNBIND32 _IOW (AGPIOC_BASE, 9, compat_uptr_t) 42 + #define AGPIOC_CHIPSET_FLUSH32 _IO (AGPIOC_BASE, 10) 42 43 43 44 struct agp_info32 { 44 45 struct agp_version version; /* version of the driver */ ··· 102 101 struct agp_memory *agp_allocate_memory_wrap(size_t pg_count, u32 type); 103 102 struct agp_memory *agp_find_mem_by_key(int key); 104 103 struct agp_client *agp_find_client_by_pid(pid_t id); 104 + int agpioc_chipset_flush_wrap(struct agp_file_private *priv); 105 105 106 106 #endif /* _AGP_COMPAT_H */
+12 -1
drivers/char/agp/frontend.c
··· 689 689 set_bit(AGP_FF_ALLOW_CLIENT, &priv->access_flags); 690 690 priv->my_pid = current->pid; 691 691 692 - if ((current->uid == 0) || (current->suid == 0)) { 692 + if (capable(CAP_SYS_RAWIO)) { 693 693 /* Root priv, can be controller */ 694 694 set_bit(AGP_FF_ALLOW_CONTROLLER, &priv->access_flags); 695 695 } ··· 960 960 return agp_unbind_memory(memory); 961 961 } 962 962 963 + int agpioc_chipset_flush_wrap(struct agp_file_private *priv) 964 + { 965 + DBG(""); 966 + agp_flush_chipset(agp_bridge); 967 + return 0; 968 + } 969 + 963 970 static int agp_ioctl(struct inode *inode, struct file *file, 964 971 unsigned int cmd, unsigned long arg) 965 972 { ··· 1039 1032 1040 1033 case AGPIOC_UNBIND: 1041 1034 ret_val = agpioc_unbind_wrap(curr_priv, (void __user *) arg); 1035 + break; 1036 + 1037 + case AGPIOC_CHIPSET_FLUSH: 1038 + ret_val = agpioc_chipset_flush_wrap(curr_priv); 1042 1039 break; 1043 1040 } 1044 1041
+7
drivers/char/agp/generic.c
··· 80 80 return -1; 81 81 } 82 82 83 + void agp_flush_chipset(struct agp_bridge_data *bridge) 84 + { 85 + if (bridge->driver->chipset_flush) 86 + bridge->driver->chipset_flush(bridge); 87 + } 88 + EXPORT_SYMBOL(agp_flush_chipset); 89 + 83 90 /* 84 91 * Use kmalloc if possible for the page list. Otherwise fall back to 85 92 * vmalloc. This speeds things up and also saves memory for small AGP
+242 -63
drivers/char/agp/intel-agp.c
··· 14 14 #define PCI_DEVICE_ID_INTEL_E7221_IG 0x258a 15 15 #define PCI_DEVICE_ID_INTEL_82946GZ_HB 0x2970 16 16 #define PCI_DEVICE_ID_INTEL_82946GZ_IG 0x2972 17 - #define PCI_DEVICE_ID_INTEL_82965G_1_HB 0x2980 18 - #define PCI_DEVICE_ID_INTEL_82965G_1_IG 0x2982 17 + #define PCI_DEVICE_ID_INTEL_82G35_HB 0x2980 18 + #define PCI_DEVICE_ID_INTEL_82G35_IG 0x2982 19 19 #define PCI_DEVICE_ID_INTEL_82965Q_HB 0x2990 20 20 #define PCI_DEVICE_ID_INTEL_82965Q_IG 0x2992 21 21 #define PCI_DEVICE_ID_INTEL_82965G_HB 0x29A0 ··· 32 32 #define PCI_DEVICE_ID_INTEL_Q35_IG 0x29B2 33 33 #define PCI_DEVICE_ID_INTEL_Q33_HB 0x29D0 34 34 #define PCI_DEVICE_ID_INTEL_Q33_IG 0x29D2 35 + #define PCI_DEVICE_ID_INTEL_IGD_HB 0x2A40 36 + #define PCI_DEVICE_ID_INTEL_IGD_IG 0x2A42 37 + 38 + /* cover 915 and 945 variants */ 39 + #define IS_I915 (agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_E7221_HB || \ 40 + agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_82915G_HB || \ 41 + agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_82915GM_HB || \ 42 + agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_82945G_HB || \ 43 + agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_82945GM_HB || \ 44 + agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_82945GME_HB) 35 45 36 46 #define IS_I965 (agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_82946GZ_HB || \ 37 - agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_82965G_1_HB || \ 38 - agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_82965Q_HB || \ 39 - agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_82965G_HB || \ 40 - agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_82965GM_HB || \ 41 - agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_82965GME_HB) 47 + agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_82G35_HB || \ 48 + agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_82965Q_HB || \ 49 + agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_82965G_HB || \ 50 + agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_82965GM_HB || \ 51 + agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_82965GME_HB || \ 52 + agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_IGD_HB) 42 53 43 54 #define IS_G33 (agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_G33_HB || \ 44 55 agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_Q35_HB || \ ··· 82 71 #define I915_GMCH_GMS_STOLEN_64M (0x7 << 4) 83 72 #define G33_GMCH_GMS_STOLEN_128M (0x8 << 4) 84 73 #define G33_GMCH_GMS_STOLEN_256M (0x9 << 4) 74 + #define I915_IFPADDR 0x60 85 75 86 76 /* Intel 965G registers */ 87 77 #define I965_MSAC 0x62 78 + #define I965_IFPADDR 0x70 88 79 89 80 /* Intel 7505 registers */ 90 81 #define INTEL_I7505_APSIZE 0x74 ··· 128 115 * popup and for the GTT. 129 116 */ 130 117 int gtt_entries; /* i830+ */ 118 + union { 119 + void __iomem *i9xx_flush_page; 120 + void *i8xx_flush_page; 121 + }; 122 + struct page *i8xx_page; 123 + struct resource ifp_resource; 124 + int resource_valid; 131 125 } intel_private; 132 126 133 127 static int intel_i810_fetch_size(void) ··· 224 204 /* Exists to support ARGB cursors */ 225 205 static void *i8xx_alloc_pages(void) 226 206 { 227 - struct page * page; 207 + struct page *page; 228 208 229 209 page = alloc_pages(GFP_KERNEL | GFP_DMA32, 2); 230 210 if (page == NULL) ··· 453 433 static const int ddt[4] = { 0, 16, 32, 64 }; 454 434 int size; /* reserved space (in kb) at the top of stolen memory */ 455 435 456 - pci_read_config_word(agp_bridge->dev,I830_GMCH_CTRL,&gmch_ctrl); 436 + pci_read_config_word(agp_bridge->dev, I830_GMCH_CTRL, &gmch_ctrl); 457 437 458 438 if (IS_I965) { 459 439 u32 pgetbl_ctl; ··· 472 452 break; 473 453 case I965_PGETBL_SIZE_512KB: 474 454 size = 512; 455 + break; 456 + case I965_PGETBL_SIZE_1MB: 457 + size = 1024; 458 + break; 459 + case I965_PGETBL_SIZE_2MB: 460 + size = 2048; 461 + break; 462 + case I965_PGETBL_SIZE_1_5MB: 463 + size = 1024 + 512; 475 464 break; 476 465 default: 477 466 printk(KERN_INFO PFX "Unknown page table size, " ··· 552 523 break; 553 524 case I915_GMCH_GMS_STOLEN_48M: 554 525 /* Check it's really I915G */ 555 - if (agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_E7221_HB || 556 - agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_82915G_HB || 557 - agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_82915GM_HB || 558 - agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_82945G_HB || 559 - agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_82945GM_HB || 560 - agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_82945GME_HB || 561 - IS_I965 || IS_G33) 526 + if (IS_I915 || IS_I965 || IS_G33) 562 527 gtt_entries = MB(48) - KB(size); 563 528 else 564 529 gtt_entries = 0; 565 530 break; 566 531 case I915_GMCH_GMS_STOLEN_64M: 567 532 /* Check it's really I915G */ 568 - if (agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_E7221_HB || 569 - agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_82915G_HB || 570 - agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_82915GM_HB || 571 - agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_82945G_HB || 572 - agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_82945GM_HB || 573 - agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_82945GME_HB || 574 - IS_I965 || IS_G33) 533 + if (IS_I915 || IS_I965 || IS_G33) 575 534 gtt_entries = MB(64) - KB(size); 576 535 else 577 536 gtt_entries = 0; ··· 592 575 intel_private.gtt_entries = gtt_entries; 593 576 } 594 577 578 + static void intel_i830_fini_flush(void) 579 + { 580 + kunmap(intel_private.i8xx_page); 581 + intel_private.i8xx_flush_page = NULL; 582 + unmap_page_from_agp(intel_private.i8xx_page); 583 + 584 + __free_page(intel_private.i8xx_page); 585 + intel_private.i8xx_page = NULL; 586 + } 587 + 588 + static void intel_i830_setup_flush(void) 589 + { 590 + /* return if we've already set the flush mechanism up */ 591 + if (intel_private.i8xx_page) 592 + return; 593 + 594 + intel_private.i8xx_page = alloc_page(GFP_KERNEL | __GFP_ZERO | GFP_DMA32); 595 + if (!intel_private.i8xx_page) 596 + return; 597 + 598 + /* make page uncached */ 599 + map_page_into_agp(intel_private.i8xx_page); 600 + 601 + intel_private.i8xx_flush_page = kmap(intel_private.i8xx_page); 602 + if (!intel_private.i8xx_flush_page) 603 + intel_i830_fini_flush(); 604 + } 605 + 606 + static void intel_i830_chipset_flush(struct agp_bridge_data *bridge) 607 + { 608 + unsigned int *pg = intel_private.i8xx_flush_page; 609 + int i; 610 + 611 + for (i = 0; i < 256; i += 2) 612 + *(pg + i) = i; 613 + 614 + wmb(); 615 + } 616 + 595 617 /* The intel i830 automatically initializes the agp aperture during POST. 596 618 * Use the memory already set aside for in the GTT. 597 619 */ ··· 646 590 num_entries = size->num_entries; 647 591 agp_bridge->gatt_table_real = NULL; 648 592 649 - pci_read_config_dword(intel_private.pcidev,I810_MMADDR,&temp); 593 + pci_read_config_dword(intel_private.pcidev, I810_MMADDR, &temp); 650 594 temp &= 0xfff80000; 651 595 652 - intel_private.registers = ioremap(temp,128 * 4096); 596 + intel_private.registers = ioremap(temp, 128 * 4096); 653 597 if (!intel_private.registers) 654 598 return -ENOMEM; 655 599 ··· 689 633 return values[0].size; 690 634 } 691 635 692 - pci_read_config_word(agp_bridge->dev,I830_GMCH_CTRL,&gmch_ctrl); 636 + pci_read_config_word(agp_bridge->dev, I830_GMCH_CTRL, &gmch_ctrl); 693 637 694 638 if ((gmch_ctrl & I830_GMCH_MEM_MASK) == I830_GMCH_MEM_128M) { 695 639 agp_bridge->previous_size = agp_bridge->current_size = (void *) values; ··· 713 657 714 658 current_size = A_SIZE_FIX(agp_bridge->current_size); 715 659 716 - pci_read_config_dword(intel_private.pcidev,I810_GMADDR,&temp); 660 + pci_read_config_dword(intel_private.pcidev, I810_GMADDR, &temp); 717 661 agp_bridge->gart_bus_addr = (temp & PCI_BASE_ADDRESS_MEM_MASK); 718 662 719 - pci_read_config_word(agp_bridge->dev,I830_GMCH_CTRL,&gmch_ctrl); 663 + pci_read_config_word(agp_bridge->dev, I830_GMCH_CTRL, &gmch_ctrl); 720 664 gmch_ctrl |= I830_GMCH_ENABLED; 721 - pci_write_config_word(agp_bridge->dev,I830_GMCH_CTRL,gmch_ctrl); 665 + pci_write_config_word(agp_bridge->dev, I830_GMCH_CTRL, gmch_ctrl); 722 666 723 667 writel(agp_bridge->gatt_bus_addr|I810_PGETBL_ENABLED, intel_private.registers+I810_PGETBL_CTL); 724 668 readl(intel_private.registers+I810_PGETBL_CTL); /* PCI Posting. */ ··· 731 675 } 732 676 733 677 global_cache_flush(); 678 + 679 + intel_i830_setup_flush(); 734 680 return 0; 735 681 } 736 682 ··· 741 683 iounmap(intel_private.registers); 742 684 } 743 685 744 - static int intel_i830_insert_entries(struct agp_memory *mem,off_t pg_start, int type) 686 + static int intel_i830_insert_entries(struct agp_memory *mem, off_t pg_start, 687 + int type) 745 688 { 746 - int i,j,num_entries; 689 + int i, j, num_entries; 747 690 void *temp; 748 691 int ret = -EINVAL; 749 692 int mask_type; ··· 756 697 num_entries = A_SIZE_FIX(temp)->num_entries; 757 698 758 699 if (pg_start < intel_private.gtt_entries) { 759 - printk (KERN_DEBUG PFX "pg_start == 0x%.8lx,intel_private.gtt_entries == 0x%.8x\n", 760 - pg_start,intel_private.gtt_entries); 700 + printk(KERN_DEBUG PFX "pg_start == 0x%.8lx,intel_private.gtt_entries == 0x%.8x\n", 701 + pg_start, intel_private.gtt_entries); 761 702 762 - printk (KERN_INFO PFX "Trying to insert into local/stolen memory\n"); 703 + printk(KERN_INFO PFX "Trying to insert into local/stolen memory\n"); 763 704 goto out_err; 764 705 } 765 706 ··· 797 738 return ret; 798 739 } 799 740 800 - static int intel_i830_remove_entries(struct agp_memory *mem,off_t pg_start, 801 - int type) 741 + static int intel_i830_remove_entries(struct agp_memory *mem, off_t pg_start, 742 + int type) 802 743 { 803 744 int i; 804 745 ··· 806 747 return 0; 807 748 808 749 if (pg_start < intel_private.gtt_entries) { 809 - printk (KERN_INFO PFX "Trying to disable local/stolen memory\n"); 750 + printk(KERN_INFO PFX "Trying to disable local/stolen memory\n"); 810 751 return -EINVAL; 811 752 } 812 753 ··· 819 760 return 0; 820 761 } 821 762 822 - static struct agp_memory *intel_i830_alloc_by_type(size_t pg_count,int type) 763 + static struct agp_memory *intel_i830_alloc_by_type(size_t pg_count, int type) 823 764 { 824 765 if (type == AGP_PHYS_MEMORY) 825 766 return alloc_agpphysmem_i8xx(pg_count, type); 826 767 /* always return NULL for other allocation types for now */ 827 768 return NULL; 769 + } 770 + 771 + static int intel_alloc_chipset_flush_resource(void) 772 + { 773 + int ret; 774 + ret = pci_bus_alloc_resource(agp_bridge->dev->bus, &intel_private.ifp_resource, PAGE_SIZE, 775 + PAGE_SIZE, PCIBIOS_MIN_MEM, 0, 776 + pcibios_align_resource, agp_bridge->dev); 777 + 778 + return ret; 779 + } 780 + 781 + static void intel_i915_setup_chipset_flush(void) 782 + { 783 + int ret; 784 + u32 temp; 785 + 786 + pci_read_config_dword(agp_bridge->dev, I915_IFPADDR, &temp); 787 + if (!(temp & 0x1)) { 788 + intel_alloc_chipset_flush_resource(); 789 + intel_private.resource_valid = 1; 790 + pci_write_config_dword(agp_bridge->dev, I915_IFPADDR, (intel_private.ifp_resource.start & 0xffffffff) | 0x1); 791 + } else { 792 + temp &= ~1; 793 + 794 + intel_private.resource_valid = 1; 795 + intel_private.ifp_resource.start = temp; 796 + intel_private.ifp_resource.end = temp + PAGE_SIZE; 797 + ret = request_resource(&iomem_resource, &intel_private.ifp_resource); 798 + /* some BIOSes reserve this area in a pnp some don't */ 799 + if (ret) 800 + intel_private.resource_valid = 0; 801 + } 802 + } 803 + 804 + static void intel_i965_g33_setup_chipset_flush(void) 805 + { 806 + u32 temp_hi, temp_lo; 807 + int ret; 808 + 809 + pci_read_config_dword(agp_bridge->dev, I965_IFPADDR + 4, &temp_hi); 810 + pci_read_config_dword(agp_bridge->dev, I965_IFPADDR, &temp_lo); 811 + 812 + if (!(temp_lo & 0x1)) { 813 + 814 + intel_alloc_chipset_flush_resource(); 815 + 816 + intel_private.resource_valid = 1; 817 + pci_write_config_dword(agp_bridge->dev, I965_IFPADDR + 4, 818 + upper_32_bits(intel_private.ifp_resource.start)); 819 + pci_write_config_dword(agp_bridge->dev, I965_IFPADDR, (intel_private.ifp_resource.start & 0xffffffff) | 0x1); 820 + } else { 821 + u64 l64; 822 + 823 + temp_lo &= ~0x1; 824 + l64 = ((u64)temp_hi << 32) | temp_lo; 825 + 826 + intel_private.resource_valid = 1; 827 + intel_private.ifp_resource.start = l64; 828 + intel_private.ifp_resource.end = l64 + PAGE_SIZE; 829 + ret = request_resource(&iomem_resource, &intel_private.ifp_resource); 830 + /* some BIOSes reserve this area in a pnp some don't */ 831 + if (ret) 832 + intel_private.resource_valid = 0; 833 + } 834 + } 835 + 836 + static void intel_i9xx_setup_flush(void) 837 + { 838 + /* return if already configured */ 839 + if (intel_private.ifp_resource.start) 840 + return; 841 + 842 + /* setup a resource for this object */ 843 + intel_private.ifp_resource.name = "Intel Flush Page"; 844 + intel_private.ifp_resource.flags = IORESOURCE_MEM; 845 + 846 + /* Setup chipset flush for 915 */ 847 + if (IS_I965 || IS_G33) { 848 + intel_i965_g33_setup_chipset_flush(); 849 + } else { 850 + intel_i915_setup_chipset_flush(); 851 + } 852 + 853 + if (intel_private.ifp_resource.start) { 854 + intel_private.i9xx_flush_page = ioremap_nocache(intel_private.ifp_resource.start, PAGE_SIZE); 855 + if (!intel_private.i9xx_flush_page) 856 + printk(KERN_INFO "unable to ioremap flush page - no chipset flushing"); 857 + } 828 858 } 829 859 830 860 static int intel_i915_configure(void) ··· 929 781 930 782 agp_bridge->gart_bus_addr = (temp & PCI_BASE_ADDRESS_MEM_MASK); 931 783 932 - pci_read_config_word(agp_bridge->dev,I830_GMCH_CTRL,&gmch_ctrl); 784 + pci_read_config_word(agp_bridge->dev, I830_GMCH_CTRL, &gmch_ctrl); 933 785 gmch_ctrl |= I830_GMCH_ENABLED; 934 - pci_write_config_word(agp_bridge->dev,I830_GMCH_CTRL,gmch_ctrl); 786 + pci_write_config_word(agp_bridge->dev, I830_GMCH_CTRL, gmch_ctrl); 935 787 936 788 writel(agp_bridge->gatt_bus_addr|I810_PGETBL_ENABLED, intel_private.registers+I810_PGETBL_CTL); 937 789 readl(intel_private.registers+I810_PGETBL_CTL); /* PCI Posting. */ ··· 944 796 } 945 797 946 798 global_cache_flush(); 799 + 800 + intel_i9xx_setup_flush(); 801 + 947 802 return 0; 948 803 } 949 804 950 805 static void intel_i915_cleanup(void) 951 806 { 807 + if (intel_private.i9xx_flush_page) 808 + iounmap(intel_private.i9xx_flush_page); 809 + if (intel_private.resource_valid) 810 + release_resource(&intel_private.ifp_resource); 811 + intel_private.ifp_resource.start = 0; 812 + intel_private.resource_valid = 0; 952 813 iounmap(intel_private.gtt); 953 814 iounmap(intel_private.registers); 954 815 } 955 816 956 - static int intel_i915_insert_entries(struct agp_memory *mem,off_t pg_start, 957 - int type) 817 + static void intel_i915_chipset_flush(struct agp_bridge_data *bridge) 958 818 { 959 - int i,j,num_entries; 819 + if (intel_private.i9xx_flush_page) 820 + writel(1, intel_private.i9xx_flush_page); 821 + } 822 + 823 + static int intel_i915_insert_entries(struct agp_memory *mem, off_t pg_start, 824 + int type) 825 + { 826 + int i, j, num_entries; 960 827 void *temp; 961 828 int ret = -EINVAL; 962 829 int mask_type; ··· 983 820 num_entries = A_SIZE_FIX(temp)->num_entries; 984 821 985 822 if (pg_start < intel_private.gtt_entries) { 986 - printk (KERN_DEBUG PFX "pg_start == 0x%.8lx,intel_private.gtt_entries == 0x%.8x\n", 987 - pg_start,intel_private.gtt_entries); 823 + printk(KERN_DEBUG PFX "pg_start == 0x%.8lx,intel_private.gtt_entries == 0x%.8x\n", 824 + pg_start, intel_private.gtt_entries); 988 825 989 - printk (KERN_INFO PFX "Trying to insert into local/stolen memory\n"); 826 + printk(KERN_INFO PFX "Trying to insert into local/stolen memory\n"); 990 827 goto out_err; 991 828 } 992 829 ··· 1024 861 return ret; 1025 862 } 1026 863 1027 - static int intel_i915_remove_entries(struct agp_memory *mem,off_t pg_start, 1028 - int type) 864 + static int intel_i915_remove_entries(struct agp_memory *mem, off_t pg_start, 865 + int type) 1029 866 { 1030 867 int i; 1031 868 ··· 1033 870 return 0; 1034 871 1035 872 if (pg_start < intel_private.gtt_entries) { 1036 - printk (KERN_INFO PFX "Trying to disable local/stolen memory\n"); 873 + printk(KERN_INFO PFX "Trying to disable local/stolen memory\n"); 1037 874 return -EINVAL; 1038 875 } 1039 876 1040 - for (i = pg_start; i < (mem->page_count + pg_start); i++) { 877 + for (i = pg_start; i < (mem->page_count + pg_start); i++) 1041 878 writel(agp_bridge->scratch_page, intel_private.gtt+i); 1042 - } 879 + 1043 880 readl(intel_private.gtt+i-1); 1044 881 1045 882 agp_bridge->driver->tlb_flush(mem); ··· 1086 923 agp_bridge->gatt_table_real = NULL; 1087 924 1088 925 pci_read_config_dword(intel_private.pcidev, I915_MMADDR, &temp); 1089 - pci_read_config_dword(intel_private.pcidev, I915_PTEADDR,&temp2); 926 + pci_read_config_dword(intel_private.pcidev, I915_PTEADDR, &temp2); 1090 927 1091 928 if (IS_G33) 1092 929 gtt_map_size = 1024 * 1024; /* 1M on G33 */ ··· 1096 933 1097 934 temp &= 0xfff80000; 1098 935 1099 - intel_private.registers = ioremap(temp,128 * 4096); 936 + intel_private.registers = ioremap(temp, 128 * 4096); 1100 937 if (!intel_private.registers) { 1101 938 iounmap(intel_private.gtt); 1102 939 return -ENOMEM; ··· 1143 980 struct aper_size_info_fixed *size; 1144 981 int num_entries; 1145 982 u32 temp; 983 + int gtt_offset, gtt_size; 1146 984 1147 985 size = agp_bridge->current_size; 1148 986 page_order = size->page_order; ··· 1153 989 pci_read_config_dword(intel_private.pcidev, I915_MMADDR, &temp); 1154 990 1155 991 temp &= 0xfff00000; 1156 - intel_private.gtt = ioremap((temp + (512 * 1024)) , 512 * 1024); 1157 992 1158 - if (!intel_private.gtt) 1159 - return -ENOMEM; 993 + if (agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_IGD_HB) 994 + gtt_offset = gtt_size = MB(2); 995 + else 996 + gtt_offset = gtt_size = KB(512); 1160 997 998 + intel_private.gtt = ioremap((temp + gtt_offset) , gtt_size); 1161 999 1162 - intel_private.registers = ioremap(temp,128 * 4096); 1000 + if (!intel_private.gtt) 1001 + return -ENOMEM; 1002 + 1003 + intel_private.registers = ioremap(temp, 128 * 4096); 1163 1004 if (!intel_private.registers) { 1164 1005 iounmap(intel_private.gtt); 1165 1006 return -ENOMEM; ··· 1323 1154 /* the Intel 815 chipset spec. says that bits 29-31 in the 1324 1155 * ATTBASE register are reserved -> try not to write them */ 1325 1156 if (agp_bridge->gatt_bus_addr & INTEL_815_ATTBASE_MASK) { 1326 - printk (KERN_EMERG PFX "gatt bus addr too high"); 1157 + printk(KERN_EMERG PFX "gatt bus addr too high"); 1327 1158 return -EINVAL; 1328 1159 } 1329 1160 ··· 1465 1296 pci_write_config_byte(agp_bridge->dev, INTEL_I845_AGPM, temp2 | (1 << 1)); 1466 1297 /* clear any possible error conditions */ 1467 1298 pci_write_config_word(agp_bridge->dev, INTEL_I845_ERRSTS, 0x001c); 1299 + 1300 + intel_i830_setup_flush(); 1468 1301 return 0; 1469 1302 } 1470 1303 ··· 1723 1552 .agp_alloc_page = agp_generic_alloc_page, 1724 1553 .agp_destroy_page = agp_generic_destroy_page, 1725 1554 .agp_type_to_mask_type = intel_i830_type_to_mask_type, 1555 + .chipset_flush = intel_i830_chipset_flush, 1726 1556 }; 1727 1557 1728 1558 static const struct agp_bridge_driver intel_820_driver = { ··· 1820 1648 .agp_alloc_page = agp_generic_alloc_page, 1821 1649 .agp_destroy_page = agp_generic_destroy_page, 1822 1650 .agp_type_to_mask_type = agp_generic_type_to_mask_type, 1651 + .chipset_flush = intel_i830_chipset_flush, 1823 1652 }; 1824 1653 1825 1654 static const struct agp_bridge_driver intel_850_driver = { ··· 1894 1721 .agp_alloc_page = agp_generic_alloc_page, 1895 1722 .agp_destroy_page = agp_generic_destroy_page, 1896 1723 .agp_type_to_mask_type = intel_i830_type_to_mask_type, 1724 + .chipset_flush = intel_i915_chipset_flush, 1897 1725 }; 1898 1726 1899 1727 static const struct agp_bridge_driver intel_i965_driver = { ··· 1920 1746 .agp_alloc_page = agp_generic_alloc_page, 1921 1747 .agp_destroy_page = agp_generic_destroy_page, 1922 1748 .agp_type_to_mask_type = intel_i830_type_to_mask_type, 1749 + .chipset_flush = intel_i915_chipset_flush, 1923 1750 }; 1924 1751 1925 1752 static const struct agp_bridge_driver intel_7505_driver = { ··· 1970 1795 .agp_alloc_page = agp_generic_alloc_page, 1971 1796 .agp_destroy_page = agp_generic_destroy_page, 1972 1797 .agp_type_to_mask_type = intel_i830_type_to_mask_type, 1798 + .chipset_flush = intel_i915_chipset_flush, 1973 1799 }; 1974 1800 1975 1801 static int find_gmch(u16 device) ··· 1980 1804 gmch_device = pci_get_device(PCI_VENDOR_ID_INTEL, device, NULL); 1981 1805 if (gmch_device && PCI_FUNC(gmch_device->devfn) != 0) { 1982 1806 gmch_device = pci_get_device(PCI_VENDOR_ID_INTEL, 1983 - device, gmch_device); 1807 + device, gmch_device); 1984 1808 } 1985 1809 1986 1810 if (!gmch_device) ··· 2043 1867 NULL, &intel_915_driver }, 2044 1868 { PCI_DEVICE_ID_INTEL_82946GZ_HB, PCI_DEVICE_ID_INTEL_82946GZ_IG, 0, "946GZ", 2045 1869 NULL, &intel_i965_driver }, 2046 - { PCI_DEVICE_ID_INTEL_82965G_1_HB, PCI_DEVICE_ID_INTEL_82965G_1_IG, 0, "965G", 1870 + { PCI_DEVICE_ID_INTEL_82G35_HB, PCI_DEVICE_ID_INTEL_82G35_IG, 0, "G35", 2047 1871 NULL, &intel_i965_driver }, 2048 1872 { PCI_DEVICE_ID_INTEL_82965Q_HB, PCI_DEVICE_ID_INTEL_82965Q_IG, 0, "965Q", 2049 1873 NULL, &intel_i965_driver }, ··· 2061 1885 NULL, &intel_g33_driver }, 2062 1886 { PCI_DEVICE_ID_INTEL_Q33_HB, PCI_DEVICE_ID_INTEL_Q33_IG, 0, "Q33", 2063 1887 NULL, &intel_g33_driver }, 1888 + { PCI_DEVICE_ID_INTEL_IGD_HB, PCI_DEVICE_ID_INTEL_IGD_IG, 0, 1889 + "Intel Integrated Graphics Device", NULL, &intel_i965_driver }, 2064 1890 { 0, 0, 0, NULL, NULL, NULL } 2065 1891 }; 2066 1892 ··· 2102 1924 if (intel_agp_chipsets[i].name == NULL) { 2103 1925 if (cap_ptr) 2104 1926 printk(KERN_WARNING PFX "Unsupported Intel chipset" 2105 - "(device id: %04x)\n", pdev->device); 1927 + "(device id: %04x)\n", pdev->device); 2106 1928 agp_put_bridge(bridge); 2107 1929 return -ENODEV; 2108 1930 } ··· 2115 1937 intel_agp_chipsets[i].gmch_chip_id); 2116 1938 agp_put_bridge(bridge); 2117 1939 return -ENODEV; 2118 - } 1940 + } 2119 1941 2120 1942 bridge->dev = pdev; 2121 1943 bridge->capndx = cap_ptr; ··· 2245 2067 ID(PCI_DEVICE_ID_INTEL_82945GM_HB), 2246 2068 ID(PCI_DEVICE_ID_INTEL_82945GME_HB), 2247 2069 ID(PCI_DEVICE_ID_INTEL_82946GZ_HB), 2248 - ID(PCI_DEVICE_ID_INTEL_82965G_1_HB), 2070 + ID(PCI_DEVICE_ID_INTEL_82G35_HB), 2249 2071 ID(PCI_DEVICE_ID_INTEL_82965Q_HB), 2250 2072 ID(PCI_DEVICE_ID_INTEL_82965G_HB), 2251 2073 ID(PCI_DEVICE_ID_INTEL_82965GM_HB), ··· 2253 2075 ID(PCI_DEVICE_ID_INTEL_G33_HB), 2254 2076 ID(PCI_DEVICE_ID_INTEL_Q35_HB), 2255 2077 ID(PCI_DEVICE_ID_INTEL_Q33_HB), 2078 + ID(PCI_DEVICE_ID_INTEL_IGD_HB), 2256 2079 { } 2257 2080 }; 2258 2081
+1
include/linux/agp_backend.h
··· 109 109 extern void agp_enable(struct agp_bridge_data *, u32); 110 110 extern struct agp_bridge_data *agp_backend_acquire(struct pci_dev *); 111 111 extern void agp_backend_release(struct agp_bridge_data *); 112 + extern void agp_flush_chipset(struct agp_bridge_data *); 112 113 113 114 #endif /* __KERNEL__ */ 114 115 #endif /* _AGP_BACKEND_H */
+1
include/linux/agpgart.h
··· 38 38 #define AGPIOC_DEALLOCATE _IOW (AGPIOC_BASE, 7, int) 39 39 #define AGPIOC_BIND _IOW (AGPIOC_BASE, 8, struct agp_bind*) 40 40 #define AGPIOC_UNBIND _IOW (AGPIOC_BASE, 9, struct agp_unbind*) 41 + #define AGPIOC_CHIPSET_FLUSH _IO (AGPIOC_BASE, 10) 41 42 42 43 #define AGP_DEVICE "/dev/agpgart" 43 44