aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/pci
diff options
context:
space:
mode:
authorAtsushi Nemoto <anemo@mba.ocn.ne.jp>2007-02-05 19:36:06 -0500
committerGreg Kroah-Hartman <gregkh@suse.de>2007-02-16 18:30:10 -0500
commit4516a618a76eae6eb1b37259ad49f39b7b7f33d8 (patch)
tree9122bdc9e596064542f14b23450ac24e18af1c4d /drivers/pci
parent26ba05e4c66ad3fafe08412ffcf8c328cc4640b0 (diff)
PCI: Make CARDBUS_MEM_SIZE and CARDBUS_IO_SIZE boot options
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> Cc: Daniel Ritz <daniel.ritz@gmx.ch> Cc: Ralf Baechle <ralf@linux-mips.org> Cc: Ivan Kokshaysky <ink@jurassic.park.msu.ru> Cc: Dominik Brodowski <linux@dominikbrodowski.net> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/pci')
-rw-r--r--drivers/pci/pci.c10
-rw-r--r--drivers/pci/setup-bus.c27
2 files changed, 20 insertions, 17 deletions
diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c
index a7b869e24650..1e74e1ee8bd8 100644
--- a/drivers/pci/pci.c
+++ b/drivers/pci/pci.c
@@ -21,6 +21,12 @@
21 21
22unsigned int pci_pm_d3_delay = 10; 22unsigned int pci_pm_d3_delay = 10;
23 23
24#define DEFAULT_CARDBUS_IO_SIZE (256)
25#define DEFAULT_CARDBUS_MEM_SIZE (64*1024*1024)
26/* pci=cbmemsize=nnM,cbiosize=nn can override this */
27unsigned long pci_cardbus_io_size = DEFAULT_CARDBUS_IO_SIZE;
28unsigned long pci_cardbus_mem_size = DEFAULT_CARDBUS_MEM_SIZE;
29
24/** 30/**
25 * pci_bus_max_busnr - returns maximum PCI bus number of given bus' children 31 * pci_bus_max_busnr - returns maximum PCI bus number of given bus' children
26 * @bus: pointer to PCI bus structure to search 32 * @bus: pointer to PCI bus structure to search
@@ -1333,6 +1339,10 @@ static int __devinit pci_setup(char *str)
1333 if (*str && (str = pcibios_setup(str)) && *str) { 1339 if (*str && (str = pcibios_setup(str)) && *str) {
1334 if (!strcmp(str, "nomsi")) { 1340 if (!strcmp(str, "nomsi")) {
1335 pci_no_msi(); 1341 pci_no_msi();
1342 } else if (!strncmp(str, "cbiosize=", 9)) {
1343 pci_cardbus_io_size = memparse(str + 9, &str);
1344 } else if (!strncmp(str, "cbmemsize=", 10)) {
1345 pci_cardbus_mem_size = memparse(str + 10, &str);
1336 } else { 1346 } else {
1337 printk(KERN_ERR "PCI: Unknown option `%s'\n", 1347 printk(KERN_ERR "PCI: Unknown option `%s'\n",
1338 str); 1348 str);
diff --git a/drivers/pci/setup-bus.c b/drivers/pci/setup-bus.c
index 89f3036f0de8..3554f3948814 100644
--- a/drivers/pci/setup-bus.c
+++ b/drivers/pci/setup-bus.c
@@ -36,13 +36,6 @@
36 36
37#define ROUND_UP(x, a) (((x) + (a) - 1) & ~((a) - 1)) 37#define ROUND_UP(x, a) (((x) + (a) - 1) & ~((a) - 1))
38 38
39/*
40 * FIXME: IO should be max 256 bytes. However, since we may
41 * have a P2P bridge below a cardbus bridge, we need 4K.
42 */
43#define CARDBUS_IO_SIZE (256)
44#define CARDBUS_MEM_SIZE (64*1024*1024)
45
46static void __devinit 39static void __devinit
47pbus_assign_resources_sorted(struct pci_bus *bus) 40pbus_assign_resources_sorted(struct pci_bus *bus)
48{ 41{
@@ -415,12 +408,12 @@ pci_bus_size_cardbus(struct pci_bus *bus)
415 * Reserve some resources for CardBus. We reserve 408 * Reserve some resources for CardBus. We reserve
416 * a fixed amount of bus space for CardBus bridges. 409 * a fixed amount of bus space for CardBus bridges.
417 */ 410 */
418 b_res[0].start = CARDBUS_IO_SIZE; 411 b_res[0].start = pci_cardbus_io_size;
419 b_res[0].end = b_res[0].start + CARDBUS_IO_SIZE - 1; 412 b_res[0].end = b_res[0].start + pci_cardbus_io_size - 1;
420 b_res[0].flags |= IORESOURCE_IO; 413 b_res[0].flags |= IORESOURCE_IO;
421 414
422 b_res[1].start = CARDBUS_IO_SIZE; 415 b_res[1].start = pci_cardbus_io_size;
423 b_res[1].end = b_res[1].start + CARDBUS_IO_SIZE - 1; 416 b_res[1].end = b_res[1].start + pci_cardbus_io_size - 1;
424 b_res[1].flags |= IORESOURCE_IO; 417 b_res[1].flags |= IORESOURCE_IO;
425 418
426 /* 419 /*
@@ -440,16 +433,16 @@ pci_bus_size_cardbus(struct pci_bus *bus)
440 * twice the size. 433 * twice the size.
441 */ 434 */
442 if (ctrl & PCI_CB_BRIDGE_CTL_PREFETCH_MEM0) { 435 if (ctrl & PCI_CB_BRIDGE_CTL_PREFETCH_MEM0) {
443 b_res[2].start = CARDBUS_MEM_SIZE; 436 b_res[2].start = pci_cardbus_mem_size;
444 b_res[2].end = b_res[2].start + CARDBUS_MEM_SIZE - 1; 437 b_res[2].end = b_res[2].start + pci_cardbus_mem_size - 1;
445 b_res[2].flags |= IORESOURCE_MEM | IORESOURCE_PREFETCH; 438 b_res[2].flags |= IORESOURCE_MEM | IORESOURCE_PREFETCH;
446 439
447 b_res[3].start = CARDBUS_MEM_SIZE; 440 b_res[3].start = pci_cardbus_mem_size;
448 b_res[3].end = b_res[3].start + CARDBUS_MEM_SIZE - 1; 441 b_res[3].end = b_res[3].start + pci_cardbus_mem_size - 1;
449 b_res[3].flags |= IORESOURCE_MEM; 442 b_res[3].flags |= IORESOURCE_MEM;
450 } else { 443 } else {
451 b_res[3].start = CARDBUS_MEM_SIZE * 2; 444 b_res[3].start = pci_cardbus_mem_size * 2;
452 b_res[3].end = b_res[3].start + CARDBUS_MEM_SIZE * 2 - 1; 445 b_res[3].end = b_res[3].start + pci_cardbus_mem_size * 2 - 1;
453 b_res[3].flags |= IORESOURCE_MEM; 446 b_res[3].flags |= IORESOURCE_MEM;
454 } 447 }
455} 448}