* [PATCH] uninorth: Add module param 'aperture' for aperture size
2006-08-22 22:17 ` Benjamin Herrenschmidt
@ 2006-08-23 11:15 ` Michel Dänzer
2006-10-04 10:44 ` Michel Dänzer
1 sibling, 0 replies; 5+ messages in thread
From: Michel Dänzer @ 2006-08-23 11:15 UTC (permalink / raw)
To: davej; +Cc: linuxppc-dev
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>
---
Note that I made the default size 32 MB (instead of 64 MB as discussed on the
linuxppc-dev list) to make this patch independent of the other uninorth patch I
sent out.
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 78c8cb2..4770187 100644
--- a/drivers/char/agp/uninorth-agp.c
+++ b/drivers/char/agp/uninorth-agp.c
@@ -27,32 +27,42 @@ #include "agp.h"
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 (32 == values[i].size)
+ 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)
@@ -668,5 +678,11 @@ static void __exit agp_uninorth_cleanup(
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");
--
1.4.1.1
--
Earthling Michel Dänzer | http://tungstengraphics.com
Libre software enthusiast | Debian, X and DRI developer
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH] uninorth: Add module param 'aperture' for aperture size
2006-08-22 22:17 ` Benjamin Herrenschmidt
2006-08-23 11:15 ` [PATCH] " Michel Dänzer
@ 2006-10-04 10:44 ` Michel Dänzer
2006-10-04 12:24 ` Andreas Schwab
1 sibling, 1 reply; 5+ messages in thread
From: Michel Dänzer @ 2006-10-04 10:44 UTC (permalink / raw)
To: Dave Jones; +Cc: linuxppc-dev
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>
---
Any (N)ACKs on this would be much appreciated.
Note that I made the default size 32 MB (instead of 64 MB as discussed on the
linuxppc-dev list) to make this patch independent of the other uninorth patch I
sent out.
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 78c8cb2..4770187 100644
--- a/drivers/char/agp/uninorth-agp.c
+++ b/drivers/char/agp/uninorth-agp.c
@@ -27,32 +27,42 @@ #include "agp.h"
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 (32 == values[i].size)
+ 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)
@@ -668,5 +678,11 @@ static void __exit agp_uninorth_cleanup(
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");
--
1.4.1.1
--
Earthling Michel Dänzer | http://tungstengraphics.com
Libre software enthusiast | Debian, X and DRI developer
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] uninorth: Add module param 'aperture' for aperture size
2006-10-04 10:44 ` Michel Dänzer
@ 2006-10-04 12:24 ` Andreas Schwab
0 siblings, 0 replies; 5+ messages in thread
From: Andreas Schwab @ 2006-10-04 12:24 UTC (permalink / raw)
To: Michel Dänzer; +Cc: Dave Jones, linuxppc-dev
Michel Dänzer <michel@tungstengraphics.com> writes:
> + if (32 == values[i].size)
variable == value, please.
Andreas.
--
Andreas Schwab, SuSE Labs, schwab@suse.de
SuSE Linux Products GmbH, Maxfeldstraße 5, 90409 Nürnberg, Germany
PGP key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5
"And now for something completely different."
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH] uninorth: Add module param 'aperture' for aperture size
@ 2006-10-04 12:56 Michel Dänzer
2006-10-05 1:09 ` Benjamin Herrenschmidt
0 siblings, 1 reply; 5+ messages in thread
From: Michel Dänzer @ 2006-10-04 12:56 UTC (permalink / raw)
To: Dave Jones; +Cc: linuxppc-dev
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>
---
Reversed a 'value == variable' test, as suggested by Andreas Schwab (thanks!).
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 78c8cb2..c2b6f7d 100644
--- a/drivers/char/agp/uninorth-agp.c
+++ b/drivers/char/agp/uninorth-agp.c
@@ -27,32 +27,42 @@ #include "agp.h"
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)
@@ -668,5 +678,11 @@ static void __exit agp_uninorth_cleanup(
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");
--
1.4.2.1
--
Earthling Michel Dänzer | http://tungstengraphics.com
Libre software enthusiast | Debian, X and DRI developer
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] uninorth: Add module param 'aperture' for aperture size
2006-10-04 12:56 [PATCH] uninorth: Add module param 'aperture' for aperture size Michel Dänzer
@ 2006-10-05 1:09 ` Benjamin Herrenschmidt
0 siblings, 0 replies; 5+ messages in thread
From: Benjamin Herrenschmidt @ 2006-10-05 1:09 UTC (permalink / raw)
To: Michel Dänzer; +Cc: Dave Jones, linuxppc-dev
On Wed, 2006-10-04 at 14:56 +0200, Michel Dänzer wrote:
> 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>
(it should probably go in 2.6.19, patch has been around for some time)
> ---
>
> Reversed a 'value == variable' test, as suggested by Andreas Schwab (thanks!).
>
> 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 78c8cb2..c2b6f7d 100644
> --- a/drivers/char/agp/uninorth-agp.c
> +++ b/drivers/char/agp/uninorth-agp.c
> @@ -27,32 +27,42 @@ #include "agp.h"
> 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)
> @@ -668,5 +678,11 @@ static void __exit agp_uninorth_cleanup(
> 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");
> --
> 1.4.2.1
>
>
> --
> Earthling Michel Dänzer | http://tungstengraphics.com
> Libre software enthusiast | Debian, X and DRI developer
>
> _______________________________________________
> Linuxppc-dev mailing list
> Linuxppc-dev@ozlabs.org
> https://ozlabs.org/mailman/listinfo/linuxppc-dev
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2006-10-05 1:10 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-10-04 12:56 [PATCH] uninorth: Add module param 'aperture' for aperture size Michel Dänzer
2006-10-05 1:09 ` Benjamin Herrenschmidt
[not found] <115608447678-git-send-email->
[not found] ` <11560844762890-git-send-email->
2006-08-21 16:09 ` [PATCH 2/2] " Michel Dänzer
2006-08-22 7:25 ` Benjamin Herrenschmidt
2006-08-22 8:55 ` Michel Dänzer
2006-08-22 22:17 ` Benjamin Herrenschmidt
2006-08-23 11:15 ` [PATCH] " Michel Dänzer
2006-10-04 10:44 ` Michel Dänzer
2006-10-04 12:24 ` Andreas Schwab
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).