The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@osdl.org>
To: Atsushi Nemoto <anemo@mba.ocn.ne.jp>
Cc: sshtylyov@ru.mvista.com, Eric.Piel@lifl.fr, ralf@linux-mips.org,
	linux-kernel@vger.kernel.org, linux-mips@linux-mips.org
Subject: Re: [PATCH] Make CARDBUS_MEM_SIZE and CARDBUS_IO_SIZE customizable
Date: Tue, 23 Jan 2007 23:45:07 -0800	[thread overview]
Message-ID: <20070123234507.08f63b5e.akpm@osdl.org> (raw)
In-Reply-To: <20070123.103027.126140726.nemoto@toshiba-tops.co.jp>

On Tue, 23 Jan 2007 10:30:27 +0900 (JST)
Atsushi Nemoto <anemo@mba.ocn.ne.jp> wrote:

> Subject: [PATCH] Make CARDBUS_MEM_SIZE and CARDBUS_IO_SIZE customizable
> 
> CARDBUS_MEM_SIZE was increased to 64MB on 2.6.20-rc2, but larger size
> might result in allocation failure for the reserving itself on some
> platforms (for example typical 32bit MIPS).  Make it (and
> CARDBUS_IO_SIZE too) customizable by "pci=" option for such platforms.
> 
> ...
>
> --- a/drivers/pci/pci.c
> +++ b/drivers/pci/pci.c
> @@ -1168,6 +1168,12 @@ static int __devinit pci_setup(char *str
>  		if (*str && (str = pcibios_setup(str)) && *str) {
>  			if (!strcmp(str, "nomsi")) {
>  				pci_no_msi();
> +			} else if (!strncmp(str, "cbiosize=", 9)) {
> +				pci_cardbus_io_size =
> +					memparse(str + 9, &str);
> +			} else if (!strncmp(str, "cbmemsize=", 10)) {
> +				pci_cardbus_mem_size =
> +					memparse(str + 10, &str);
>  			} else {
>  				printk(KERN_ERR "PCI: Unknown option `%s'\n",
>  						str);
> diff --git a/drivers/pci/setup-bus.c b/drivers/pci/setup-bus.c
> index 89f3036..1dfc288 100644
> --- a/drivers/pci/setup-bus.c
> +++ b/drivers/pci/setup-bus.c
> @@ -40,8 +40,11 @@ #define ROUND_UP(x, a)		(((x) + (a) - 1)
>   * FIXME: IO should be max 256 bytes.  However, since we may
>   * have a P2P bridge below a cardbus bridge, we need 4K.
>   */
> -#define CARDBUS_IO_SIZE		(256)
> -#define CARDBUS_MEM_SIZE	(64*1024*1024)
> +#define DEFAULT_CARDBUS_IO_SIZE		(256)
> +#define DEFAULT_CARDBUS_MEM_SIZE	(64*1024*1024)
> +/* pci=cbmemsize=nnM,cbiosize=nn can override this */
> +unsigned long pci_cardbus_io_size = DEFAULT_CARDBUS_IO_SIZE;
> +unsigned long pci_cardbus_mem_size = DEFAULT_CARDBUS_MEM_SIZE;

setup-bus.o is linked only on x86, so your patch will cause all other
pci-using architectures to not link.

An easy fix is to move the definitions of pci_cardbus_io_size and
pci_cardbus_mem_size into pci.c.  An ugly, fragile but more efficient fix
is, reluctantly:

diff -puN drivers/pci/pci.c~make-cardbus_mem_size-and-cardbus_io_size-boot-options-fix drivers/pci/pci.c
--- a/drivers/pci/pci.c~make-cardbus_mem_size-and-cardbus_io_size-boot-options-fix
+++ a/drivers/pci/pci.c
@@ -1212,13 +1212,15 @@ static int __devinit pci_setup(char *str
 		if (*str && (str = pcibios_setup(str)) && *str) {
 			if (!strcmp(str, "nomsi")) {
 				pci_no_msi();
-			} else if (!strncmp(str, "cbiosize=", 9)) {
-				pci_cardbus_io_size =
-					memparse(str + 9, &str);
+			}
+#ifdef CONFIG_X86
+			else if (!strncmp(str, "cbiosize=", 9)) {
+				pci_cardbus_io_size = memparse(str + 9, &str);
 			} else if (!strncmp(str, "cbmemsize=", 10)) {
-				pci_cardbus_mem_size =
-					memparse(str + 10, &str);
-			} else {
+				pci_cardbus_mem_size = memparse(str + 10, &str);
+			}
+#endif
+			else {
 				printk(KERN_ERR "PCI: Unknown option `%s'\n",
 						str);
 			}
diff -puN drivers/pci/setup-bus.c~make-cardbus_mem_size-and-cardbus_io_size-boot-options-fix drivers/pci/setup-bus.c
--- a/drivers/pci/setup-bus.c~make-cardbus_mem_size-and-cardbus_io_size-boot-options-fix
+++ a/drivers/pci/setup-bus.c
@@ -36,10 +36,6 @@
 
 #define ROUND_UP(x, a)		(((x) + (a) - 1) & ~((a) - 1))
 
-/*
- * FIXME: IO should be max 256 bytes.  However, since we may
- * have a P2P bridge below a cardbus bridge, we need 4K.
- */
 #define DEFAULT_CARDBUS_IO_SIZE		(256)
 #define DEFAULT_CARDBUS_MEM_SIZE	(64*1024*1024)
 /* pci=cbmemsize=nnM,cbiosize=nn can override this */
_


Perhaps we should move the cbiosize= and cbmemsize= handlers over into
setup-bus.c.  The implementation would be cleaner, but then we wouldn't be
able to use the pci= namespace.


  reply	other threads:[~2007-01-24  7:48 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-01-18 15:23 [PATCH] Make CARDBUS_MEM_SIZE and CARDBUS_IO_SIZE customizable Atsushi Nemoto
2007-01-18 16:03 ` Ralf Baechle
2007-01-18 16:14   ` Robert P. J. Day
2007-01-18 21:53   ` Andrew Morton
2007-01-19  3:19     ` Atsushi Nemoto
2007-01-19  3:57       ` Atsushi Nemoto
2007-01-22 13:57         ` Éric Piel
2007-01-22 14:32           ` Atsushi Nemoto
2007-01-22 15:17             ` Sergei Shtylyov
2007-01-23  1:30               ` Atsushi Nemoto
2007-01-24  7:45                 ` Andrew Morton [this message]
2007-01-24  7:50                   ` Andrew Morton
2007-01-24  8:07                     ` Atsushi Nemoto

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20070123234507.08f63b5e.akpm@osdl.org \
    --to=akpm@osdl.org \
    --cc=Eric.Piel@lifl.fr \
    --cc=anemo@mba.ocn.ne.jp \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mips@linux-mips.org \
    --cc=ralf@linux-mips.org \
    --cc=sshtylyov@ru.mvista.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox