[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>

authored by Michel D�nzer and committed by Dave Jones 18088748 2cc1a413

+33 -17
+33 -17
drivers/char/agp/uninorth-agp.c
··· 27 static int uninorth_rev; 28 static int is_u3; 29 30 31 static int uninorth_fetch_size(void) 32 { 33 - int i; 34 - u32 temp; 35 - struct aper_size_info_32 *values; 36 37 - pci_read_config_dword(agp_bridge->dev, UNI_N_CFG_GART_BASE, &temp); 38 - temp &= ~(0xfffff000); 39 - values = A_SIZE_32(agp_bridge->driver->aperture_sizes); 40 41 - for (i = 0; i < agp_bridge->driver->num_aperture_sizes; i++) { 42 - if (temp == values[i].size_value) { 43 - agp_bridge->previous_size = 44 - agp_bridge->current_size = (void *) (values + i); 45 - agp_bridge->aperture_size_idx = i; 46 - return values[i].size; 47 } 48 } 49 50 - agp_bridge->previous_size = 51 - agp_bridge->current_size = (void *) (values + 1); 52 - agp_bridge->aperture_size_idx = 1; 53 - return values[1].size; 54 55 - return 0; 56 } 57 58 static void uninorth_tlbflush(struct agp_memory *mem) ··· 692 693 module_init(agp_uninorth_init); 694 module_exit(agp_uninorth_cleanup); 695 696 MODULE_AUTHOR("Ben Herrenschmidt & Paul Mackerras"); 697 MODULE_LICENSE("GPL");
··· 27 static int uninorth_rev; 28 static int is_u3; 29 30 + static char __devinitdata *aperture = NULL; 31 32 static int uninorth_fetch_size(void) 33 { 34 + int i, size = 0; 35 + struct aper_size_info_32 *values = 36 + A_SIZE_32(agp_bridge->driver->aperture_sizes); 37 38 + if (aperture) { 39 + char *save = aperture; 40 41 + size = memparse(aperture, &aperture) >> 20; 42 + aperture = save; 43 + 44 + for (i = 0; i < agp_bridge->driver->num_aperture_sizes; i++) 45 + if (size == values[i].size) 46 + break; 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; 53 } 54 } 55 56 + if (!size) { 57 + for (i = 0; i < agp_bridge->driver->num_aperture_sizes; i++) 58 + if (values[i].size == 32) 59 + break; 60 + } 61 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; 66 } 67 68 static void uninorth_tlbflush(struct agp_memory *mem) ··· 682 683 module_init(agp_uninorth_init); 684 module_exit(agp_uninorth_cleanup); 685 + 686 + module_param(aperture, charp, 0); 687 + MODULE_PARM_DESC(aperture, 688 + "Aperture size, must be power of two between 4MB and an\n" 689 + "\t\tupper limit specific to the UniNorth revision.\n" 690 + "\t\tDefault: 32M"); 691 692 MODULE_AUTHOR("Ben Herrenschmidt & Paul Mackerras"); 693 MODULE_LICENSE("GPL");