diff options
author | Linus Torvalds <torvalds@woody.osdl.org> | 2006-11-22 12:37:54 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.osdl.org> | 2006-11-22 12:37:54 -0500 |
commit | 7d915a38985d2826acbdc9dc9cca8a93e23e5278 (patch) | |
tree | 6954d28e1e835a9043c1f201c0791c390e528e7f /drivers/char/agp | |
parent | b42172fc7b569a0ef2b0fa38d71382969074c0e2 (diff) |
[AGP] Fix intel 965 AGP memory mapping function
This introduces a i965-specific "mask_memory()" function that knows
about the extended physical addresses that the i965 supports. This
allows us to correctly map in physical memory in the >4GB range into the
GTT.
Also simplify/clean-up the i965 case for the aperture sizing by just
returning the fixed 512kB size from "fetch_size()". We don't really
care that not all of the aperture may be visible - the only thing that
cares about the aperture size is the Intel "stolen memory" calculation,
which depends on the fixed size.
Cc: Keith Packard <keithp@keithp.com>
Cc: Eric Anholt <eric@anholt.net>
Cc: Dave Jones <davej@redhat.com>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'drivers/char/agp')
-rw-r--r-- | drivers/char/agp/intel-agp.c | 31 |
1 files changed, 24 insertions, 7 deletions
diff --git a/drivers/char/agp/intel-agp.c b/drivers/char/agp/intel-agp.c index d1ede7db5a12..aceece71a85d 100644 --- a/drivers/char/agp/intel-agp.c +++ b/drivers/char/agp/intel-agp.c | |||
@@ -387,11 +387,7 @@ static void intel_i830_init_gtt_entries(void) | |||
387 | /* We obtain the size of the GTT, which is also stored (for some | 387 | /* We obtain the size of the GTT, which is also stored (for some |
388 | * reason) at the top of stolen memory. Then we add 4KB to that | 388 | * reason) at the top of stolen memory. Then we add 4KB to that |
389 | * for the video BIOS popup, which is also stored in there. */ | 389 | * for the video BIOS popup, which is also stored in there. */ |
390 | 390 | size = agp_bridge->driver->fetch_size() + 4; | |
391 | if (IS_I965) | ||
392 | size = 512 + 4; | ||
393 | else | ||
394 | size = agp_bridge->driver->fetch_size() + 4; | ||
395 | 391 | ||
396 | if (agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_82830_HB || | 392 | if (agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_82830_HB || |
397 | agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_82845G_HB) { | 393 | agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_82845G_HB) { |
@@ -805,6 +801,26 @@ static int intel_i915_create_gatt_table(struct agp_bridge_data *bridge) | |||
805 | 801 | ||
806 | return 0; | 802 | return 0; |
807 | } | 803 | } |
804 | |||
805 | /* | ||
806 | * The i965 supports 36-bit physical addresses, but to keep | ||
807 | * the format of the GTT the same, the bits that don't fit | ||
808 | * in a 32-bit word are shifted down to bits 4..7. | ||
809 | * | ||
810 | * Gcc is smart enough to notice that "(addr >> 28) & 0xf0" | ||
811 | * is always zero on 32-bit architectures, so no need to make | ||
812 | * this conditional. | ||
813 | */ | ||
814 | static unsigned long intel_i965_mask_memory(struct agp_bridge_data *bridge, | ||
815 | unsigned long addr, int type) | ||
816 | { | ||
817 | /* Shift high bits down */ | ||
818 | addr |= (addr >> 28) & 0xf0; | ||
819 | |||
820 | /* Type checking must be done elsewhere */ | ||
821 | return addr | bridge->driver->masks[type].mask; | ||
822 | } | ||
823 | |||
808 | static int intel_i965_fetch_size(void) | 824 | static int intel_i965_fetch_size(void) |
809 | { | 825 | { |
810 | struct aper_size_info_fixed *values; | 826 | struct aper_size_info_fixed *values; |
@@ -832,7 +848,8 @@ static int intel_i965_fetch_size(void) | |||
832 | 848 | ||
833 | agp_bridge->previous_size = agp_bridge->current_size = (void *)(values + offset); | 849 | agp_bridge->previous_size = agp_bridge->current_size = (void *)(values + offset); |
834 | 850 | ||
835 | return values[offset].size; | 851 | /* The i965 GTT is always sized as if it had a 512kB aperture size */ |
852 | return 512; | ||
836 | } | 853 | } |
837 | 854 | ||
838 | /* The intel i965 automatically initializes the agp aperture during POST. | 855 | /* The intel i965 automatically initializes the agp aperture during POST. |
@@ -1584,7 +1601,7 @@ static struct agp_bridge_driver intel_i965_driver = { | |||
1584 | .fetch_size = intel_i965_fetch_size, | 1601 | .fetch_size = intel_i965_fetch_size, |
1585 | .cleanup = intel_i915_cleanup, | 1602 | .cleanup = intel_i915_cleanup, |
1586 | .tlb_flush = intel_i810_tlbflush, | 1603 | .tlb_flush = intel_i810_tlbflush, |
1587 | .mask_memory = intel_i810_mask_memory, | 1604 | .mask_memory = intel_i965_mask_memory, |
1588 | .masks = intel_i810_masks, | 1605 | .masks = intel_i810_masks, |
1589 | .agp_enable = intel_i810_agp_enable, | 1606 | .agp_enable = intel_i810_agp_enable, |
1590 | .cache_flush = global_cache_flush, | 1607 | .cache_flush = global_cache_flush, |