diff options
author | David Mosberger <davidm@napali.hpl.hp.com> | 2005-04-04 16:29:43 -0400 |
---|---|---|
committer | Dave Jones <davej@redhat.com> | 2005-06-07 15:35:44 -0400 |
commit | 66bb8bf8b235ba4d37fda14375827864977c6a3e (patch) | |
tree | 830da5361c73af24b309f6ecc6b87482eb4f1c32 /drivers | |
parent | 07eee78ea8ba2d0b7b20551c35a3e7dd158d50bb (diff) |
[PATCH] Replace check_bridge_mode() with (bridge->mode & AGSTAT_MODE_3_0).
[AGPGART] Replace check_bridge_mode() with (bridge->mode & AGSTAT_MODE_3_0).
As mentioned earlier, the current check_bridge_mode() code assumes
that AGP bridges are PCI devices. This isn't always true. Definitely
not for HP zx1 chipset and the same seems to be the case for SGI's AGP
bridge.
The patch below fixes the problem by picking up the AGP_MODE_3_0 bit
from bridge->mode. I feel like I may be missing something, since I
can't see any reason why check_bridge_mode() wasn't doing that in the
first place. According to the AGP 3.0 specs, the AGP_MODE_3_0 bit is
determined during the hardware reset and cannot be changed, so it
seems to me it should be safe to pick it up from bridge->mode.
With the patch applied, I can definitely use AGP acceleration both
with AGP 2.0 and AGP 3.0 (one with an Nvidia card, the other with an
ATI FireGL card).
Unless someone spots a problem, please apply this patch so 3d
acceleration can work on zx1 boxes again.
This makes AGP work again on machines with an AGP bridge that isn't a
PCI device.
Signed-off-by: David Mosberger-Tang <davidm@hpl.hp.com>
Signed-off-by: Dave Jones <davej@redhat.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/char/agp/generic.c | 19 |
1 files changed, 3 insertions, 16 deletions
diff --git a/drivers/char/agp/generic.c b/drivers/char/agp/generic.c index d62505b5d25a..f0079e991bdc 100644 --- a/drivers/char/agp/generic.c +++ b/drivers/char/agp/generic.c | |||
@@ -295,19 +295,6 @@ int agp_num_entries(void) | |||
295 | EXPORT_SYMBOL_GPL(agp_num_entries); | 295 | EXPORT_SYMBOL_GPL(agp_num_entries); |
296 | 296 | ||
297 | 297 | ||
298 | static int check_bridge_mode(struct pci_dev *dev) | ||
299 | { | ||
300 | u32 agp3; | ||
301 | u8 cap_ptr; | ||
302 | |||
303 | cap_ptr = pci_find_capability(dev, PCI_CAP_ID_AGP); | ||
304 | pci_read_config_dword(dev, cap_ptr+AGPSTAT, &agp3); | ||
305 | if (agp3 & AGPSTAT_MODE_3_0) | ||
306 | return 1; | ||
307 | return 0; | ||
308 | } | ||
309 | |||
310 | |||
311 | /** | 298 | /** |
312 | * agp_copy_info - copy bridge state information | 299 | * agp_copy_info - copy bridge state information |
313 | * | 300 | * |
@@ -328,7 +315,7 @@ int agp_copy_info(struct agp_bridge_data *bridge, struct agp_kern_info *info) | |||
328 | info->version.minor = bridge->version->minor; | 315 | info->version.minor = bridge->version->minor; |
329 | info->chipset = SUPPORTED; | 316 | info->chipset = SUPPORTED; |
330 | info->device = bridge->dev; | 317 | info->device = bridge->dev; |
331 | if (check_bridge_mode(bridge->dev)) | 318 | if (bridge->mode & AGPSTAT_MODE_3_0) |
332 | info->mode = bridge->mode & ~AGP3_RESERVED_MASK; | 319 | info->mode = bridge->mode & ~AGP3_RESERVED_MASK; |
333 | else | 320 | else |
334 | info->mode = bridge->mode & ~AGP2_RESERVED_MASK; | 321 | info->mode = bridge->mode & ~AGP2_RESERVED_MASK; |
@@ -661,7 +648,7 @@ u32 agp_collect_device_status(struct agp_bridge_data *bridge, u32 requested_mode | |||
661 | bridge_agpstat &= ~AGPSTAT_FW; | 648 | bridge_agpstat &= ~AGPSTAT_FW; |
662 | 649 | ||
663 | /* Check to see if we are operating in 3.0 mode */ | 650 | /* Check to see if we are operating in 3.0 mode */ |
664 | if (check_bridge_mode(agp_bridge->dev)) | 651 | if (agp_bridge->mode & AGPSTAT_MODE_3_0) |
665 | agp_v3_parse_one(&requested_mode, &bridge_agpstat, &vga_agpstat); | 652 | agp_v3_parse_one(&requested_mode, &bridge_agpstat, &vga_agpstat); |
666 | else | 653 | else |
667 | agp_v2_parse_one(&requested_mode, &bridge_agpstat, &vga_agpstat); | 654 | agp_v2_parse_one(&requested_mode, &bridge_agpstat, &vga_agpstat); |
@@ -732,7 +719,7 @@ void agp_generic_enable(struct agp_bridge_data *bridge, u32 requested_mode) | |||
732 | 719 | ||
733 | /* Do AGP version specific frobbing. */ | 720 | /* Do AGP version specific frobbing. */ |
734 | if (bridge->major_version >= 3) { | 721 | if (bridge->major_version >= 3) { |
735 | if (check_bridge_mode(bridge->dev)) { | 722 | if (bridge->mode & AGPSTAT_MODE_3_0) { |
736 | /* If we have 3.5, we can do the isoch stuff. */ | 723 | /* If we have 3.5, we can do the isoch stuff. */ |
737 | if (bridge->minor_version >= 5) | 724 | if (bridge->minor_version >= 5) |
738 | agp_3_5_enable(bridge); | 725 | agp_3_5_enable(bridge); |