* [PATCH] Make CARDBUS_MEM_SIZE and CARDBUS_IO_SIZE customizable @ 2007-01-18 15:23 Atsushi Nemoto 2007-01-18 16:03 ` Ralf Baechle 0 siblings, 1 reply; 13+ messages in thread From: Atsushi Nemoto @ 2007-01-18 15:23 UTC (permalink / raw) To: linux-kernel; +Cc: linux-mips, akpm, ralf 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 for such platforms. Signed-off-by: Atsushi Nemoto <anemo@mba.ocn.ne.jp> --- diff --git a/drivers/pci/Kconfig b/drivers/pci/Kconfig index 3cfb0a3..6085d3d 100644 --- a/drivers/pci/Kconfig +++ b/drivers/pci/Kconfig @@ -60,3 +60,19 @@ config HT_IRQ This allows native hypertransport devices to use interrupts. If unsure say Y. + +config PCI_CARDBUS_IO_SIZE + int "CardBus IO window size (bytes)" + depends on PCI + default "256" + help + A fixed amount of bus space is reserved for CardBus bridges. + The default value is 256 bytes. + +config PCI_CARDBUS_MEM_SIZE + int "CardBus Memory window size (megabytes)" + depends on PCI + default "64" + help + A fixed amount of bus space is reserved for CardBus bridges. + The default value is 64 megabytes. diff --git a/drivers/pci/setup-bus.c b/drivers/pci/setup-bus.c index 89f3036..046c87b 100644 --- a/drivers/pci/setup-bus.c +++ b/drivers/pci/setup-bus.c @@ -40,8 +40,8 @@ * 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 CARDBUS_IO_SIZE CONFIG_PCI_CARDBUS_IO_SIZE +#define CARDBUS_MEM_SIZE (CONFIG_PCI_CARDBUS_MEM_SIZE * 1024 * 1024) static void __devinit pbus_assign_resources_sorted(struct pci_bus *bus) ^ permalink raw reply related [flat|nested] 13+ messages in thread
* Re: [PATCH] Make CARDBUS_MEM_SIZE and CARDBUS_IO_SIZE customizable 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 0 siblings, 2 replies; 13+ messages in thread From: Ralf Baechle @ 2007-01-18 16:03 UTC (permalink / raw) To: Atsushi Nemoto; +Cc: linux-kernel, linux-mips, akpm On Fri, Jan 19, 2007 at 12:23:46AM +0900, Atsushi Nemoto wrote: > 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 for such platforms. Patch looks technically ok to me, so feel free to add my Acked-by: line. The grief I have with this sort of patch is that this kind of detailed technical knowledge should not be required by a mortal configuring the Linux kernel. Ralf ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH] Make CARDBUS_MEM_SIZE and CARDBUS_IO_SIZE customizable 2007-01-18 16:03 ` Ralf Baechle @ 2007-01-18 16:14 ` Robert P. J. Day 2007-01-18 21:53 ` Andrew Morton 1 sibling, 0 replies; 13+ messages in thread From: Robert P. J. Day @ 2007-01-18 16:14 UTC (permalink / raw) To: Ralf Baechle; +Cc: Atsushi Nemoto, linux-kernel, linux-mips, akpm On Thu, 18 Jan 2007, Ralf Baechle wrote: > On Fri, Jan 19, 2007 at 12:23:46AM +0900, Atsushi Nemoto wrote: > > > 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 for such platforms. > > Patch looks technically ok to me, so feel free to add my Acked-by: > line. > > The grief I have with this sort of patch is that this kind of > detailed technical knowledge should not be required by a mortal > configuring the Linux kernel. that's why help info for options like that should always have a "If you're unsure about what to say here ..." paragraph. i'm big on stuff like that. :-) rday ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH] Make CARDBUS_MEM_SIZE and CARDBUS_IO_SIZE customizable 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 1 sibling, 1 reply; 13+ messages in thread From: Andrew Morton @ 2007-01-18 21:53 UTC (permalink / raw) To: Ralf Baechle; +Cc: anemo, linux-kernel, linux-mips > On Thu, 18 Jan 2007 16:03:38 +0000 Ralf Baechle <ralf@linux-mips.org> wrote: > On Fri, Jan 19, 2007 at 12:23:46AM +0900, Atsushi Nemoto wrote: > > > 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 for such platforms. > > Patch looks technically ok to me, so feel free to add my Acked-by: line. > > The grief I have with this sort of patch is that this kind of detailed > technical knowledge should not be required by a mortal configuring the > Linux kernel. > Yes, it does rater suck. A boot option/module parameter would be better. ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH] Make CARDBUS_MEM_SIZE and CARDBUS_IO_SIZE customizable 2007-01-18 21:53 ` Andrew Morton @ 2007-01-19 3:19 ` Atsushi Nemoto 2007-01-19 3:57 ` Atsushi Nemoto 0 siblings, 1 reply; 13+ messages in thread From: Atsushi Nemoto @ 2007-01-19 3:19 UTC (permalink / raw) To: akpm; +Cc: ralf, linux-kernel, linux-mips On Thu, 18 Jan 2007 13:53:26 -0800, Andrew Morton <akpm@osdl.org> wrote: > > Patch looks technically ok to me, so feel free to add my Acked-by: line. > > > > The grief I have with this sort of patch is that this kind of detailed > > technical knowledge should not be required by a mortal configuring the > > Linux kernel. > > > > Yes, it does rater suck. A boot option/module parameter would be better. OK, here is a revised patch which uses pci= option instead of config parameters. 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. Signed-off-by: Atsushi Nemoto <anemo@mba.ocn.ne.jp> --- Documentation/kernel-parameters.txt | 6 ++++++ drivers/pci/pci.c | 6 ++++++ drivers/pci/setup-bus.c | 27 +++++++++++++++------------ include/linux/pci.h | 3 +++ 4 files changed, 30 insertions(+), 12 deletions(-) diff --git a/Documentation/kernel-parameters.txt b/Documentation/kernel-parameters.txt index 25d2985..ace7a9a 100644 --- a/Documentation/kernel-parameters.txt +++ b/Documentation/kernel-parameters.txt @@ -1259,6 +1259,12 @@ and is between 256 and 4096 characters. This sorting is done to get a device order compatible with older (<= 2.4) kernels. nobfsort Don't sort PCI devices into breadth-first order. + cbiosize=nn[KMG] A fixed amount of bus space is + reserved for CardBus bridges. + The default value is 256 bytes. + cbmemsize=nn[KMG] A fixed amount of bus space is + reserved for CardBus bridges. + The default value is 64 megabytes. pcmv= [HW,PCMCIA] BadgePAD 4 diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c index 206c834..639069a 100644 --- 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; static void __devinit pbus_assign_resources_sorted(struct pci_bus *bus) @@ -415,12 +418,12 @@ pci_bus_size_cardbus(struct pci_bus *bus * Reserve some resources for CardBus. We reserve * a fixed amount of bus space for CardBus bridges. */ - b_res[0].start = CARDBUS_IO_SIZE; - b_res[0].end = b_res[0].start + CARDBUS_IO_SIZE - 1; + b_res[0].start = pci_cardbus_io_size; + b_res[0].end = b_res[0].start + pci_cardbus_io_size - 1; b_res[0].flags |= IORESOURCE_IO; - b_res[1].start = CARDBUS_IO_SIZE; - b_res[1].end = b_res[1].start + CARDBUS_IO_SIZE - 1; + b_res[1].start = pci_cardbus_io_size; + b_res[1].end = b_res[1].start + pci_cardbus_io_size - 1; b_res[1].flags |= IORESOURCE_IO; /* @@ -440,16 +443,16 @@ pci_bus_size_cardbus(struct pci_bus *bus * twice the size. */ if (ctrl & PCI_CB_BRIDGE_CTL_PREFETCH_MEM0) { - b_res[2].start = CARDBUS_MEM_SIZE; - b_res[2].end = b_res[2].start + CARDBUS_MEM_SIZE - 1; + b_res[2].start = pci_cardbus_mem_size; + b_res[2].end = b_res[2].start + pci_cardbus_mem_size - 1; b_res[2].flags |= IORESOURCE_MEM | IORESOURCE_PREFETCH; - b_res[3].start = CARDBUS_MEM_SIZE; - b_res[3].end = b_res[3].start + CARDBUS_MEM_SIZE - 1; + b_res[3].start = pci_cardbus_mem_size; + b_res[3].end = b_res[3].start + pci_cardbus_mem_size - 1; b_res[3].flags |= IORESOURCE_MEM; } else { - b_res[3].start = CARDBUS_MEM_SIZE * 2; - b_res[3].end = b_res[3].start + CARDBUS_MEM_SIZE * 2 - 1; + b_res[3].start = pci_cardbus_mem_size * 2; + b_res[3].end = b_res[3].start + pci_cardbus_mem_size * 2 - 1; b_res[3].flags |= IORESOURCE_MEM; } } diff --git a/include/linux/pci.h b/include/linux/pci.h index f3c617e..ff04c69 100644 --- a/include/linux/pci.h +++ b/include/linux/pci.h @@ -837,5 +837,8 @@ #define PCIPCI_VSFX 16 #define PCIPCI_ALIMAGIK 32 /* Need low latency setting */ #define PCIAGP_FAIL 64 /* No PCI to AGP DMA */ +extern unsigned long pci_cardbus_io_size; +extern unsigned long pci_cardbus_mem_size; + #endif /* __KERNEL__ */ #endif /* LINUX_PCI_H */ ^ permalink raw reply related [flat|nested] 13+ messages in thread
* Re: [PATCH] Make CARDBUS_MEM_SIZE and CARDBUS_IO_SIZE customizable 2007-01-19 3:19 ` Atsushi Nemoto @ 2007-01-19 3:57 ` Atsushi Nemoto 2007-01-22 13:57 ` Éric Piel 0 siblings, 1 reply; 13+ messages in thread From: Atsushi Nemoto @ 2007-01-19 3:57 UTC (permalink / raw) To: akpm; +Cc: ralf, linux-kernel, linux-mips On Fri, 19 Jan 2007 12:19:10 +0900 (JST), Atsushi Nemoto <anemo@mba.ocn.ne.jp> wrote: > OK, here is a revised patch which uses pci= option instead of config > parameters. Sorry, this patch would cause build failure if setup-bus.c was not built into kernel. Revised again. 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. Signed-off-by: Atsushi Nemoto <anemo@mba.ocn.ne.jp> --- Documentation/kernel-parameters.txt | 6 ++++++ drivers/pci/pci.c | 16 ++++++++++++++++ drivers/pci/setup-bus.c | 27 ++++++++++----------------- include/linux/pci.h | 3 +++ 4 files changed, 35 insertions(+), 17 deletions(-) diff --git a/Documentation/kernel-parameters.txt b/Documentation/kernel-parameters.txt index 25d2985..ace7a9a 100644 --- a/Documentation/kernel-parameters.txt +++ b/Documentation/kernel-parameters.txt @@ -1259,6 +1259,12 @@ and is between 256 and 4096 characters. This sorting is done to get a device order compatible with older (<= 2.4) kernels. nobfsort Don't sort PCI devices into breadth-first order. + cbiosize=nn[KMG] A fixed amount of bus space is + reserved for CardBus bridges. + The default value is 256 bytes. + cbmemsize=nn[KMG] A fixed amount of bus space is + reserved for CardBus bridges. + The default value is 64 megabytes. pcmv= [HW,PCMCIA] BadgePAD 4 diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c index 206c834..dc7f40e 100644 --- a/drivers/pci/pci.c +++ b/drivers/pci/pci.c @@ -1159,6 +1159,16 @@ static int __devinit pci_init(void) return 0; } +/* + * 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 */ +unsigned long pci_cardbus_io_size = DEFAULT_CARDBUS_IO_SIZE; +unsigned long pci_cardbus_mem_size = DEFAULT_CARDBUS_MEM_SIZE; + static int __devinit pci_setup(char *str) { while (str) { @@ -1168,6 +1178,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..3554f39 100644 --- a/drivers/pci/setup-bus.c +++ b/drivers/pci/setup-bus.c @@ -36,13 +36,6 @@ #endif #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 CARDBUS_IO_SIZE (256) -#define CARDBUS_MEM_SIZE (64*1024*1024) - static void __devinit pbus_assign_resources_sorted(struct pci_bus *bus) { @@ -415,12 +408,12 @@ pci_bus_size_cardbus(struct pci_bus *bus * Reserve some resources for CardBus. We reserve * a fixed amount of bus space for CardBus bridges. */ - b_res[0].start = CARDBUS_IO_SIZE; - b_res[0].end = b_res[0].start + CARDBUS_IO_SIZE - 1; + b_res[0].start = pci_cardbus_io_size; + b_res[0].end = b_res[0].start + pci_cardbus_io_size - 1; b_res[0].flags |= IORESOURCE_IO; - b_res[1].start = CARDBUS_IO_SIZE; - b_res[1].end = b_res[1].start + CARDBUS_IO_SIZE - 1; + b_res[1].start = pci_cardbus_io_size; + b_res[1].end = b_res[1].start + pci_cardbus_io_size - 1; b_res[1].flags |= IORESOURCE_IO; /* @@ -440,16 +433,16 @@ pci_bus_size_cardbus(struct pci_bus *bus * twice the size. */ if (ctrl & PCI_CB_BRIDGE_CTL_PREFETCH_MEM0) { - b_res[2].start = CARDBUS_MEM_SIZE; - b_res[2].end = b_res[2].start + CARDBUS_MEM_SIZE - 1; + b_res[2].start = pci_cardbus_mem_size; + b_res[2].end = b_res[2].start + pci_cardbus_mem_size - 1; b_res[2].flags |= IORESOURCE_MEM | IORESOURCE_PREFETCH; - b_res[3].start = CARDBUS_MEM_SIZE; - b_res[3].end = b_res[3].start + CARDBUS_MEM_SIZE - 1; + b_res[3].start = pci_cardbus_mem_size; + b_res[3].end = b_res[3].start + pci_cardbus_mem_size - 1; b_res[3].flags |= IORESOURCE_MEM; } else { - b_res[3].start = CARDBUS_MEM_SIZE * 2; - b_res[3].end = b_res[3].start + CARDBUS_MEM_SIZE * 2 - 1; + b_res[3].start = pci_cardbus_mem_size * 2; + b_res[3].end = b_res[3].start + pci_cardbus_mem_size * 2 - 1; b_res[3].flags |= IORESOURCE_MEM; } } diff --git a/include/linux/pci.h b/include/linux/pci.h index f3c617e..ff04c69 100644 --- a/include/linux/pci.h +++ b/include/linux/pci.h @@ -837,5 +837,8 @@ #define PCIPCI_VSFX 16 #define PCIPCI_ALIMAGIK 32 /* Need low latency setting */ #define PCIAGP_FAIL 64 /* No PCI to AGP DMA */ +extern unsigned long pci_cardbus_io_size; +extern unsigned long pci_cardbus_mem_size; + #endif /* __KERNEL__ */ #endif /* LINUX_PCI_H */ ^ permalink raw reply related [flat|nested] 13+ messages in thread
* Re: [PATCH] Make CARDBUS_MEM_SIZE and CARDBUS_IO_SIZE customizable 2007-01-19 3:57 ` Atsushi Nemoto @ 2007-01-22 13:57 ` Éric Piel 2007-01-22 14:32 ` Atsushi Nemoto 0 siblings, 1 reply; 13+ messages in thread From: Éric Piel @ 2007-01-22 13:57 UTC (permalink / raw) To: Atsushi Nemoto; +Cc: akpm, ralf, linux-kernel, linux-mips 01/19/2007 04:57 AM, Atsushi Nemoto wrote/a écrit: > On Fri, 19 Jan 2007 12:19:10 +0900 (JST), Atsushi Nemoto <anemo@mba.ocn.ne.jp> wrote: >> OK, here is a revised patch which uses pci= option instead of config >> parameters. > > Sorry, this patch would cause build failure if setup-bus.c was not > built into kernel. Revised again. > > > 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. : > > diff --git a/Documentation/kernel-parameters.txt b/Documentation/kernel-parameters.txt > index 25d2985..ace7a9a 100644 > --- a/Documentation/kernel-parameters.txt > +++ b/Documentation/kernel-parameters.txt > @@ -1259,6 +1259,12 @@ and is between 256 and 4096 characters. > This sorting is done to get a device > order compatible with older (<= 2.4) kernels. > nobfsort Don't sort PCI devices into breadth-first order. > + cbiosize=nn[KMG] A fixed amount of bus space is > + reserved for CardBus bridges. > + The default value is 256 bytes. > + cbmemsize=nn[KMG] A fixed amount of bus space is > + reserved for CardBus bridges. > + The default value is 64 megabytes. Hi, I've got the feeling that those two parameters don't do the same things, although they have the same description ;-) Maybe the texts could be: * The fixed amount of bus space which is reserved for the CardBus bridges IO window. * The fixed amount of bus space which is reserved for the CardBus bridges memory window. See you, Eric ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH] Make CARDBUS_MEM_SIZE and CARDBUS_IO_SIZE customizable 2007-01-22 13:57 ` Éric Piel @ 2007-01-22 14:32 ` Atsushi Nemoto 2007-01-22 15:17 ` Sergei Shtylyov 0 siblings, 1 reply; 13+ messages in thread From: Atsushi Nemoto @ 2007-01-22 14:32 UTC (permalink / raw) To: Eric.Piel; +Cc: akpm, ralf, linux-kernel, linux-mips On Mon, 22 Jan 2007 14:57:46 +0100, Éric Piel <Eric.Piel@lifl.fr> wrote: > > + cbiosize=nn[KMG] A fixed amount of bus space is > > + reserved for CardBus bridges. > > + The default value is 256 bytes. > > + cbmemsize=nn[KMG] A fixed amount of bus space is > > + reserved for CardBus bridges. > > + The default value is 64 megabytes. > Hi, I've got the feeling that those two parameters don't do the same > things, although they have the same description ;-) Maybe the texts > could be: > * The fixed amount of bus space which is reserved for the CardBus > bridges IO window. > * The fixed amount of bus space which is reserved for the CardBus > bridges memory window. Thanks for your comment. Updated. 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. Signed-off-by: Atsushi Nemoto <anemo@mba.ocn.ne.jp> --- Documentation/kernel-parameters.txt | 6 ++++++ drivers/pci/pci.c | 6 ++++++ drivers/pci/setup-bus.c | 27 +++++++++++++++------------ include/linux/pci.h | 3 +++ 4 files changed, 30 insertions(+), 12 deletions(-) diff --git a/Documentation/kernel-parameters.txt b/Documentation/kernel-parameters.txt index 25d2985..dc39989 100644 --- a/Documentation/kernel-parameters.txt +++ b/Documentation/kernel-parameters.txt @@ -1259,6 +1259,12 @@ and is between 256 and 4096 characters. This sorting is done to get a device order compatible with older (<= 2.4) kernels. nobfsort Don't sort PCI devices into breadth-first order. + cbiosize=nn[KMG] The fixed amount of bus space which is + reserved for the CardBus bridges IO window. + The default value is 256 bytes. + cbmemsize=nn[KMG] The fixed amount of bus space which is + reserved for the CardBus bridges memory window. + The default value is 64 megabytes. pcmv= [HW,PCMCIA] BadgePAD 4 diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c index 206c834..639069a 100644 --- 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 @@ * 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; static void __devinit pbus_assign_resources_sorted(struct pci_bus *bus) @@ -415,12 +418,12 @@ pci_bus_size_cardbus(struct pci_bus *bus * Reserve some resources for CardBus. We reserve * a fixed amount of bus space for CardBus bridges. */ - b_res[0].start = CARDBUS_IO_SIZE; - b_res[0].end = b_res[0].start + CARDBUS_IO_SIZE - 1; + b_res[0].start = pci_cardbus_io_size; + b_res[0].end = b_res[0].start + pci_cardbus_io_size - 1; b_res[0].flags |= IORESOURCE_IO; - b_res[1].start = CARDBUS_IO_SIZE; - b_res[1].end = b_res[1].start + CARDBUS_IO_SIZE - 1; + b_res[1].start = pci_cardbus_io_size; + b_res[1].end = b_res[1].start + pci_cardbus_io_size - 1; b_res[1].flags |= IORESOURCE_IO; /* @@ -440,16 +443,16 @@ pci_bus_size_cardbus(struct pci_bus *bus * twice the size. */ if (ctrl & PCI_CB_BRIDGE_CTL_PREFETCH_MEM0) { - b_res[2].start = CARDBUS_MEM_SIZE; - b_res[2].end = b_res[2].start + CARDBUS_MEM_SIZE - 1; + b_res[2].start = pci_cardbus_mem_size; + b_res[2].end = b_res[2].start + pci_cardbus_mem_size - 1; b_res[2].flags |= IORESOURCE_MEM | IORESOURCE_PREFETCH; - b_res[3].start = CARDBUS_MEM_SIZE; - b_res[3].end = b_res[3].start + CARDBUS_MEM_SIZE - 1; + b_res[3].start = pci_cardbus_mem_size; + b_res[3].end = b_res[3].start + pci_cardbus_mem_size - 1; b_res[3].flags |= IORESOURCE_MEM; } else { - b_res[3].start = CARDBUS_MEM_SIZE * 2; - b_res[3].end = b_res[3].start + CARDBUS_MEM_SIZE * 2 - 1; + b_res[3].start = pci_cardbus_mem_size * 2; + b_res[3].end = b_res[3].start + pci_cardbus_mem_size * 2 - 1; b_res[3].flags |= IORESOURCE_MEM; } } diff --git a/include/linux/pci.h b/include/linux/pci.h index f3c617e..ff04c69 100644 --- a/include/linux/pci.h +++ b/include/linux/pci.h @@ -837,5 +837,8 @@ extern int pci_pci_problems; #define PCIPCI_ALIMAGIK 32 /* Need low latency setting */ #define PCIAGP_FAIL 64 /* No PCI to AGP DMA */ +extern unsigned long pci_cardbus_io_size; +extern unsigned long pci_cardbus_mem_size; + #endif /* __KERNEL__ */ #endif /* LINUX_PCI_H */ ^ permalink raw reply related [flat|nested] 13+ messages in thread
* Re: [PATCH] Make CARDBUS_MEM_SIZE and CARDBUS_IO_SIZE customizable 2007-01-22 14:32 ` Atsushi Nemoto @ 2007-01-22 15:17 ` Sergei Shtylyov 2007-01-23 1:30 ` Atsushi Nemoto 0 siblings, 1 reply; 13+ messages in thread From: Sergei Shtylyov @ 2007-01-22 15:17 UTC (permalink / raw) To: Atsushi Nemoto; +Cc: Eric.Piel, akpm, ralf, linux-kernel, linux-mips Hello. Atsushi Nemoto 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. Sorry for grammatic nitpicking. :-) > diff --git a/Documentation/kernel-parameters.txt b/Documentation/kernel-parameters.txt > index 25d2985..dc39989 100644 > --- a/Documentation/kernel-parameters.txt > +++ b/Documentation/kernel-parameters.txt > @@ -1259,6 +1259,12 @@ and is between 256 and 4096 characters. > This sorting is done to get a device > order compatible with older (<= 2.4) kernels. > nobfsort Don't sort PCI devices into breadth-first order. > + cbiosize=nn[KMG] The fixed amount of bus space which is > + reserved for the CardBus bridges IO window. It shoyld be "bridge's"... > + The default value is 256 bytes. > + cbmemsize=nn[KMG] The fixed amount of bus space which is > + reserved for the CardBus bridges memory window. Ditto. > + The default value is 64 megabytes. > MBR, Sergei ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH] Make CARDBUS_MEM_SIZE and CARDBUS_IO_SIZE customizable 2007-01-22 15:17 ` Sergei Shtylyov @ 2007-01-23 1:30 ` Atsushi Nemoto 2007-01-24 7:45 ` Andrew Morton 0 siblings, 1 reply; 13+ messages in thread From: Atsushi Nemoto @ 2007-01-23 1:30 UTC (permalink / raw) To: sshtylyov; +Cc: Eric.Piel, akpm, ralf, linux-kernel, linux-mips On Mon, 22 Jan 2007 18:17:38 +0300, Sergei Shtylyov <sshtylyov@ru.mvista.com> wrote: > > + cbiosize=nn[KMG] The fixed amount of bus space which is > > + reserved for the CardBus bridges IO window. > > It shoyld be "bridge's"... Thanks. Updated again. 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. Signed-off-by: Atsushi Nemoto <anemo@mba.ocn.ne.jp> --- Documentation/kernel-parameters.txt | 6 ++++++ drivers/pci/pci.c | 6 ++++++ drivers/pci/setup-bus.c | 27 +++++++++++++++------------ include/linux/pci.h | 3 +++ 4 files changed, 30 insertions(+), 12 deletions(-) diff --git a/Documentation/kernel-parameters.txt b/Documentation/kernel-parameters.txt index 25d2985..a194b8f 100644 --- a/Documentation/kernel-parameters.txt +++ b/Documentation/kernel-parameters.txt @@ -1259,6 +1259,12 @@ and is between 256 and 4096 characters. This sorting is done to get a device order compatible with older (<= 2.4) kernels. nobfsort Don't sort PCI devices into breadth-first order. + cbiosize=nn[KMG] The fixed amount of bus space which is + reserved for the CardBus bridge's IO window. + The default value is 256 bytes. + cbmemsize=nn[KMG] The fixed amount of bus space which is + reserved for the CardBus bridge's memory + window. The default value is 64 megabytes. pcmv= [HW,PCMCIA] BadgePAD 4 diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c index 206c834..639069a 100644 --- 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; static void __devinit pbus_assign_resources_sorted(struct pci_bus *bus) @@ -415,12 +418,12 @@ pci_bus_size_cardbus(struct pci_bus *bus * Reserve some resources for CardBus. We reserve * a fixed amount of bus space for CardBus bridges. */ - b_res[0].start = CARDBUS_IO_SIZE; - b_res[0].end = b_res[0].start + CARDBUS_IO_SIZE - 1; + b_res[0].start = pci_cardbus_io_size; + b_res[0].end = b_res[0].start + pci_cardbus_io_size - 1; b_res[0].flags |= IORESOURCE_IO; - b_res[1].start = CARDBUS_IO_SIZE; - b_res[1].end = b_res[1].start + CARDBUS_IO_SIZE - 1; + b_res[1].start = pci_cardbus_io_size; + b_res[1].end = b_res[1].start + pci_cardbus_io_size - 1; b_res[1].flags |= IORESOURCE_IO; /* @@ -440,16 +443,16 @@ pci_bus_size_cardbus(struct pci_bus *bus * twice the size. */ if (ctrl & PCI_CB_BRIDGE_CTL_PREFETCH_MEM0) { - b_res[2].start = CARDBUS_MEM_SIZE; - b_res[2].end = b_res[2].start + CARDBUS_MEM_SIZE - 1; + b_res[2].start = pci_cardbus_mem_size; + b_res[2].end = b_res[2].start + pci_cardbus_mem_size - 1; b_res[2].flags |= IORESOURCE_MEM | IORESOURCE_PREFETCH; - b_res[3].start = CARDBUS_MEM_SIZE; - b_res[3].end = b_res[3].start + CARDBUS_MEM_SIZE - 1; + b_res[3].start = pci_cardbus_mem_size; + b_res[3].end = b_res[3].start + pci_cardbus_mem_size - 1; b_res[3].flags |= IORESOURCE_MEM; } else { - b_res[3].start = CARDBUS_MEM_SIZE * 2; - b_res[3].end = b_res[3].start + CARDBUS_MEM_SIZE * 2 - 1; + b_res[3].start = pci_cardbus_mem_size * 2; + b_res[3].end = b_res[3].start + pci_cardbus_mem_size * 2 - 1; b_res[3].flags |= IORESOURCE_MEM; } } diff --git a/include/linux/pci.h b/include/linux/pci.h index f3c617e..ff04c69 100644 --- a/include/linux/pci.h +++ b/include/linux/pci.h @@ -837,5 +837,8 @@ #define PCIPCI_VSFX 16 #define PCIPCI_ALIMAGIK 32 /* Need low latency setting */ #define PCIAGP_FAIL 64 /* No PCI to AGP DMA */ +extern unsigned long pci_cardbus_io_size; +extern unsigned long pci_cardbus_mem_size; + #endif /* __KERNEL__ */ #endif /* LINUX_PCI_H */ ^ permalink raw reply related [flat|nested] 13+ messages in thread
* Re: [PATCH] Make CARDBUS_MEM_SIZE and CARDBUS_IO_SIZE customizable 2007-01-23 1:30 ` Atsushi Nemoto @ 2007-01-24 7:45 ` Andrew Morton 2007-01-24 7:50 ` Andrew Morton 0 siblings, 1 reply; 13+ messages in thread From: Andrew Morton @ 2007-01-24 7:45 UTC (permalink / raw) To: Atsushi Nemoto; +Cc: sshtylyov, Eric.Piel, ralf, linux-kernel, linux-mips 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. ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH] Make CARDBUS_MEM_SIZE and CARDBUS_IO_SIZE customizable 2007-01-24 7:45 ` Andrew Morton @ 2007-01-24 7:50 ` Andrew Morton 2007-01-24 8:07 ` Atsushi Nemoto 0 siblings, 1 reply; 13+ messages in thread From: Andrew Morton @ 2007-01-24 7:50 UTC (permalink / raw) To: Atsushi Nemoto, sshtylyov, Eric.Piel, ralf, linux-kernel, linux-mips On Tue, 23 Jan 2007 23:45:07 -0800 Andrew Morton <akpm@osdl.org> wrote: > setup-bus.o is linked only on x86 oops, that's untrue. But it will break ppc32, I think. I suppose we can deprive the ppc32 guys of eight bytes of RAM. But putting cardbus things in pci.c seems wrong.. 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 @@ -21,6 +21,12 @@ unsigned int pci_pm_d3_delay = 10; +#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; + /** * pci_bus_max_busnr - returns maximum PCI bus number of given bus' children * @bus: pointer to PCI bus structure to search @@ -1213,11 +1219,9 @@ static int __devinit pci_setup(char *str if (!strcmp(str, "nomsi")) { pci_no_msi(); } else if (!strncmp(str, "cbiosize=", 9)) { - pci_cardbus_io_size = - memparse(str + 9, &str); + pci_cardbus_io_size = memparse(str + 9, &str); } else if (!strncmp(str, "cbmemsize=", 10)) { - pci_cardbus_mem_size = - memparse(str + 10, &str); + pci_cardbus_mem_size = memparse(str + 10, &str); } 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,16 +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 */ -unsigned long pci_cardbus_io_size = DEFAULT_CARDBUS_IO_SIZE; -unsigned long pci_cardbus_mem_size = DEFAULT_CARDBUS_MEM_SIZE; - static void __devinit pbus_assign_resources_sorted(struct pci_bus *bus) { _ ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH] Make CARDBUS_MEM_SIZE and CARDBUS_IO_SIZE customizable 2007-01-24 7:50 ` Andrew Morton @ 2007-01-24 8:07 ` Atsushi Nemoto 0 siblings, 0 replies; 13+ messages in thread From: Atsushi Nemoto @ 2007-01-24 8:07 UTC (permalink / raw) To: akpm; +Cc: sshtylyov, Eric.Piel, ralf, linux-kernel, linux-mips On Tue, 23 Jan 2007 23:50:29 -0800, Andrew Morton <akpm@osdl.org> wrote: > > setup-bus.o is linked only on x86 > > oops, that's untrue. But it will break ppc32, I think. Oh sorry for confusion, I had updated wrong version of the patch when applying comments from Eric and Sergei. Final shape in mm tree looks fine. Thank you. --- Atsushi Nemoto ^ permalink raw reply [flat|nested] 13+ messages in thread
end of thread, other threads:[~2007-01-24 8:07 UTC | newest] Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 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 2007-01-24 7:50 ` Andrew Morton 2007-01-24 8:07 ` Atsushi Nemoto
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.