Skip to content

Commit

Permalink
[AGPGART] uninorth: Add module param 'aperture' for aperture size
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Michel D�nzer authored and Dave Jones committed Oct 15, 2006
1 parent 2cc1a41 commit 1808874
Showing 1 changed file with 35 additions and 19 deletions.
54 changes: 35 additions & 19 deletions drivers/char/agp/uninorth-agp.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,32 +27,42 @@
static int uninorth_rev;
static int is_u3;

static char __devinitdata *aperture = NULL;

static int uninorth_fetch_size(void)
{
int i;
u32 temp;
struct aper_size_info_32 *values;

pci_read_config_dword(agp_bridge->dev, UNI_N_CFG_GART_BASE, &temp);
temp &= ~(0xfffff000);
values = A_SIZE_32(agp_bridge->driver->aperture_sizes);

for (i = 0; i < agp_bridge->driver->num_aperture_sizes; i++) {
if (temp == values[i].size_value) {
agp_bridge->previous_size =
agp_bridge->current_size = (void *) (values + i);
agp_bridge->aperture_size_idx = i;
return values[i].size;
int i, size = 0;
struct aper_size_info_32 *values =
A_SIZE_32(agp_bridge->driver->aperture_sizes);

if (aperture) {
char *save = aperture;

size = memparse(aperture, &aperture) >> 20;
aperture = save;

for (i = 0; i < agp_bridge->driver->num_aperture_sizes; i++)
if (size == values[i].size)
break;

if (i == agp_bridge->driver->num_aperture_sizes) {
printk(KERN_ERR PFX "Invalid aperture size, using"
" default\n");
size = 0;
aperture = NULL;
}
}

agp_bridge->previous_size =
agp_bridge->current_size = (void *) (values + 1);
agp_bridge->aperture_size_idx = 1;
return values[1].size;
if (!size) {
for (i = 0; i < agp_bridge->driver->num_aperture_sizes; i++)
if (values[i].size == 32)
break;
}

return 0;
agp_bridge->previous_size =
agp_bridge->current_size = (void *)(values + i);
agp_bridge->aperture_size_idx = i;
return values[i].size;
}

static void uninorth_tlbflush(struct agp_memory *mem)
Expand Down Expand Up @@ -683,5 +693,11 @@ static void __exit agp_uninorth_cleanup(void)
module_init(agp_uninorth_init);
module_exit(agp_uninorth_cleanup);

module_param(aperture, charp, 0);
MODULE_PARM_DESC(aperture,
"Aperture size, must be power of two between 4MB and an\n"
"\t\tupper limit specific to the UniNorth revision.\n"
"\t\tDefault: 32M");

MODULE_AUTHOR("Ben Herrenschmidt & Paul Mackerras");
MODULE_LICENSE("GPL");

0 comments on commit 1808874

Please sign in to comment.