diff options
author | Michel Dänzer <michel@tungstengraphics.com> | 2006-10-04 08:56:44 -0400 |
---|---|---|
committer | Dave Jones <davej@redhat.com> | 2006-10-15 19:49:59 -0400 |
commit | 18088748d2a493ce9f6adf0be7f833b04041807e (patch) | |
tree | 21c4007de30d9abe6ef50354f6368ff35dea9a71 | |
parent | 2cc1a4134f51b4aff7c7486d857e6773f493e370 (diff) |
[AGPGART] uninorth: Add module param 'aperture' for aperture size
In contrast to most if not all PC BIOSes, OpenFirmware (OF) on PowerMacs with
UniNorth bridges does not allow changing the aperture size. The size set up by
OF is usually 16 MB, which is too low for graphics intensive environments.
Hence, add a module parameter that allows changing the aperture size at driver
initialization time. When the parameter is not specified, the default is 32 MB.
Signed-off-by: Michel Dänzer <michel@tungstengraphics.com>
Acked-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Dave Jones <davej@redhat.com>
-rw-r--r-- | drivers/char/agp/uninorth-agp.c | 54 |
1 files changed, 35 insertions, 19 deletions
diff --git a/drivers/char/agp/uninorth-agp.c b/drivers/char/agp/uninorth-agp.c index 91b71e750ee1..dffc19382f7e 100644 --- a/drivers/char/agp/uninorth-agp.c +++ b/drivers/char/agp/uninorth-agp.c | |||
@@ -27,32 +27,42 @@ | |||
27 | static int uninorth_rev; | 27 | static int uninorth_rev; |
28 | static int is_u3; | 28 | static int is_u3; |
29 | 29 | ||
30 | static char __devinitdata *aperture = NULL; | ||
30 | 31 | ||
31 | static int uninorth_fetch_size(void) | 32 | static int uninorth_fetch_size(void) |
32 | { | 33 | { |
33 | int i; | 34 | int i, size = 0; |
34 | u32 temp; | 35 | struct aper_size_info_32 *values = |
35 | struct aper_size_info_32 *values; | 36 | A_SIZE_32(agp_bridge->driver->aperture_sizes); |
36 | 37 | ||
37 | pci_read_config_dword(agp_bridge->dev, UNI_N_CFG_GART_BASE, &temp); | 38 | if (aperture) { |
38 | temp &= ~(0xfffff000); | 39 | char *save = aperture; |
39 | values = A_SIZE_32(agp_bridge->driver->aperture_sizes); | 40 | |
40 | 41 | size = memparse(aperture, &aperture) >> 20; | |
41 | for (i = 0; i < agp_bridge->driver->num_aperture_sizes; i++) { | 42 | aperture = save; |
42 | if (temp == values[i].size_value) { | 43 | |
43 | agp_bridge->previous_size = | 44 | for (i = 0; i < agp_bridge->driver->num_aperture_sizes; i++) |
44 | agp_bridge->current_size = (void *) (values + i); | 45 | if (size == values[i].size) |
45 | agp_bridge->aperture_size_idx = i; | 46 | break; |
46 | return values[i].size; | 47 | |
48 | if (i == agp_bridge->driver->num_aperture_sizes) { | ||
49 | printk(KERN_ERR PFX "Invalid aperture size, using" | ||
50 | " default\n"); | ||
51 | size = 0; | ||
52 | aperture = NULL; | ||
47 | } | 53 | } |
48 | } | 54 | } |
49 | 55 | ||
50 | agp_bridge->previous_size = | 56 | if (!size) { |
51 | agp_bridge->current_size = (void *) (values + 1); | 57 | for (i = 0; i < agp_bridge->driver->num_aperture_sizes; i++) |
52 | agp_bridge->aperture_size_idx = 1; | 58 | if (values[i].size == 32) |
53 | return values[1].size; | 59 | break; |
60 | } | ||
54 | 61 | ||
55 | return 0; | 62 | agp_bridge->previous_size = |
63 | agp_bridge->current_size = (void *)(values + i); | ||
64 | agp_bridge->aperture_size_idx = i; | ||
65 | return values[i].size; | ||
56 | } | 66 | } |
57 | 67 | ||
58 | static void uninorth_tlbflush(struct agp_memory *mem) | 68 | static void uninorth_tlbflush(struct agp_memory *mem) |
@@ -683,5 +693,11 @@ static void __exit agp_uninorth_cleanup(void) | |||
683 | module_init(agp_uninorth_init); | 693 | module_init(agp_uninorth_init); |
684 | module_exit(agp_uninorth_cleanup); | 694 | module_exit(agp_uninorth_cleanup); |
685 | 695 | ||
696 | module_param(aperture, charp, 0); | ||
697 | MODULE_PARM_DESC(aperture, | ||
698 | "Aperture size, must be power of two between 4MB and an\n" | ||
699 | "\t\tupper limit specific to the UniNorth revision.\n" | ||
700 | "\t\tDefault: 32M"); | ||
701 | |||
686 | MODULE_AUTHOR("Ben Herrenschmidt & Paul Mackerras"); | 702 | MODULE_AUTHOR("Ben Herrenschmidt & Paul Mackerras"); |
687 | MODULE_LICENSE("GPL"); | 703 | MODULE_LICENSE("GPL"); |