diff options
author | Bjorn Helgaas <bhelgaas@google.com> | 2012-07-10 10:36:09 -0400 |
---|---|---|
committer | Bjorn Helgaas <bhelgaas@google.com> | 2012-07-10 10:36:09 -0400 |
commit | 6ee53f4c38e70ba34777ad38807a50c1812ff36f (patch) | |
tree | 8a4eeef5923d28c2e4ab14f4559e686cc1fce455 | |
parent | d68e70c6e59ad08feca291c2790164d3231c425e (diff) | |
parent | 1c975931128c1128892981095a64fb8eabf240eb (diff) |
Merge branch 'pci/bjorn-p2p-bridge-windows' into next
* pci/bjorn-p2p-bridge-windows:
sparc/PCI: replace pci_cfg_fake_ranges() with pci_read_bridge_bases()
PCI: support sizing P2P bridge I/O windows with 1K granularity
PCI: reimplement P2P bridge 1K I/O windows (Intel P64H2)
PCI: allow P2P bridge windows starting at PCI bus address zero
Conflicts:
drivers/pci/probe.c
include/linux/pci.h
-rw-r--r-- | arch/sparc/kernel/pci.c | 89 | ||||
-rw-r--r-- | drivers/pci/probe.c | 31 | ||||
-rw-r--r-- | drivers/pci/quirks.c | 39 | ||||
-rw-r--r-- | drivers/pci/setup-bus.c | 39 | ||||
-rw-r--r-- | include/linux/pci.h | 1 | ||||
-rw-r--r-- | include/linux/pci_regs.h | 3 |
6 files changed, 53 insertions, 149 deletions
diff --git a/arch/sparc/kernel/pci.c b/arch/sparc/kernel/pci.c index 52ee0c7b2521..065b88c4f868 100644 --- a/arch/sparc/kernel/pci.c +++ b/arch/sparc/kernel/pci.c | |||
@@ -375,93 +375,6 @@ static void __devinit apb_calc_first_last(u8 map, u32 *first_p, u32 *last_p) | |||
375 | *last_p = last; | 375 | *last_p = last; |
376 | } | 376 | } |
377 | 377 | ||
378 | /* For PCI bus devices which lack a 'ranges' property we interrogate | ||
379 | * the config space values to set the resources, just like the generic | ||
380 | * Linux PCI probing code does. | ||
381 | */ | ||
382 | static void __devinit pci_cfg_fake_ranges(struct pci_dev *dev, | ||
383 | struct pci_bus *bus, | ||
384 | struct pci_pbm_info *pbm) | ||
385 | { | ||
386 | struct pci_bus_region region; | ||
387 | struct resource *res, res2; | ||
388 | u8 io_base_lo, io_limit_lo; | ||
389 | u16 mem_base_lo, mem_limit_lo; | ||
390 | unsigned long base, limit; | ||
391 | |||
392 | pci_read_config_byte(dev, PCI_IO_BASE, &io_base_lo); | ||
393 | pci_read_config_byte(dev, PCI_IO_LIMIT, &io_limit_lo); | ||
394 | base = (io_base_lo & PCI_IO_RANGE_MASK) << 8; | ||
395 | limit = (io_limit_lo & PCI_IO_RANGE_MASK) << 8; | ||
396 | |||
397 | if ((io_base_lo & PCI_IO_RANGE_TYPE_MASK) == PCI_IO_RANGE_TYPE_32) { | ||
398 | u16 io_base_hi, io_limit_hi; | ||
399 | |||
400 | pci_read_config_word(dev, PCI_IO_BASE_UPPER16, &io_base_hi); | ||
401 | pci_read_config_word(dev, PCI_IO_LIMIT_UPPER16, &io_limit_hi); | ||
402 | base |= (io_base_hi << 16); | ||
403 | limit |= (io_limit_hi << 16); | ||
404 | } | ||
405 | |||
406 | res = bus->resource[0]; | ||
407 | if (base <= limit) { | ||
408 | res->flags = (io_base_lo & PCI_IO_RANGE_TYPE_MASK) | IORESOURCE_IO; | ||
409 | res2.flags = res->flags; | ||
410 | region.start = base; | ||
411 | region.end = limit + 0xfff; | ||
412 | pcibios_bus_to_resource(dev, &res2, ®ion); | ||
413 | if (!res->start) | ||
414 | res->start = res2.start; | ||
415 | if (!res->end) | ||
416 | res->end = res2.end; | ||
417 | } | ||
418 | |||
419 | pci_read_config_word(dev, PCI_MEMORY_BASE, &mem_base_lo); | ||
420 | pci_read_config_word(dev, PCI_MEMORY_LIMIT, &mem_limit_lo); | ||
421 | base = (mem_base_lo & PCI_MEMORY_RANGE_MASK) << 16; | ||
422 | limit = (mem_limit_lo & PCI_MEMORY_RANGE_MASK) << 16; | ||
423 | |||
424 | res = bus->resource[1]; | ||
425 | if (base <= limit) { | ||
426 | res->flags = ((mem_base_lo & PCI_MEMORY_RANGE_TYPE_MASK) | | ||
427 | IORESOURCE_MEM); | ||
428 | region.start = base; | ||
429 | region.end = limit + 0xfffff; | ||
430 | pcibios_bus_to_resource(dev, res, ®ion); | ||
431 | } | ||
432 | |||
433 | pci_read_config_word(dev, PCI_PREF_MEMORY_BASE, &mem_base_lo); | ||
434 | pci_read_config_word(dev, PCI_PREF_MEMORY_LIMIT, &mem_limit_lo); | ||
435 | base = (mem_base_lo & PCI_PREF_RANGE_MASK) << 16; | ||
436 | limit = (mem_limit_lo & PCI_PREF_RANGE_MASK) << 16; | ||
437 | |||
438 | if ((mem_base_lo & PCI_PREF_RANGE_TYPE_MASK) == PCI_PREF_RANGE_TYPE_64) { | ||
439 | u32 mem_base_hi, mem_limit_hi; | ||
440 | |||
441 | pci_read_config_dword(dev, PCI_PREF_BASE_UPPER32, &mem_base_hi); | ||
442 | pci_read_config_dword(dev, PCI_PREF_LIMIT_UPPER32, &mem_limit_hi); | ||
443 | |||
444 | /* | ||
445 | * Some bridges set the base > limit by default, and some | ||
446 | * (broken) BIOSes do not initialize them. If we find | ||
447 | * this, just assume they are not being used. | ||
448 | */ | ||
449 | if (mem_base_hi <= mem_limit_hi) { | ||
450 | base |= ((long) mem_base_hi) << 32; | ||
451 | limit |= ((long) mem_limit_hi) << 32; | ||
452 | } | ||
453 | } | ||
454 | |||
455 | res = bus->resource[2]; | ||
456 | if (base <= limit) { | ||
457 | res->flags = ((mem_base_lo & PCI_MEMORY_RANGE_TYPE_MASK) | | ||
458 | IORESOURCE_MEM | IORESOURCE_PREFETCH); | ||
459 | region.start = base; | ||
460 | region.end = limit + 0xfffff; | ||
461 | pcibios_bus_to_resource(dev, res, ®ion); | ||
462 | } | ||
463 | } | ||
464 | |||
465 | /* Cook up fake bus resources for SUNW,simba PCI bridges which lack | 378 | /* Cook up fake bus resources for SUNW,simba PCI bridges which lack |
466 | * a proper 'ranges' property. | 379 | * a proper 'ranges' property. |
467 | */ | 380 | */ |
@@ -550,7 +463,7 @@ static void __devinit of_scan_pci_bridge(struct pci_pbm_info *pbm, | |||
550 | apb_fake_ranges(dev, bus, pbm); | 463 | apb_fake_ranges(dev, bus, pbm); |
551 | goto after_ranges; | 464 | goto after_ranges; |
552 | } else if (ranges == NULL) { | 465 | } else if (ranges == NULL) { |
553 | pci_cfg_fake_ranges(dev, bus, pbm); | 466 | pci_read_bridge_bases(bus); |
554 | goto after_ranges; | 467 | goto after_ranges; |
555 | } | 468 | } |
556 | i = 1; | 469 | i = 1; |
diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c index 5e5358a3dd92..6c143b4497ca 100644 --- a/drivers/pci/probe.c +++ b/drivers/pci/probe.c | |||
@@ -306,15 +306,23 @@ static void __devinit pci_read_bridge_io(struct pci_bus *child) | |||
306 | { | 306 | { |
307 | struct pci_dev *dev = child->self; | 307 | struct pci_dev *dev = child->self; |
308 | u8 io_base_lo, io_limit_lo; | 308 | u8 io_base_lo, io_limit_lo; |
309 | unsigned long base, limit; | 309 | unsigned long io_mask, io_granularity, base, limit; |
310 | struct pci_bus_region region; | 310 | struct pci_bus_region region; |
311 | struct resource *res, res2; | 311 | struct resource *res; |
312 | |||
313 | io_mask = PCI_IO_RANGE_MASK; | ||
314 | io_granularity = 0x1000; | ||
315 | if (dev->io_window_1k) { | ||
316 | /* Support 1K I/O space granularity */ | ||
317 | io_mask = PCI_IO_1K_RANGE_MASK; | ||
318 | io_granularity = 0x400; | ||
319 | } | ||
312 | 320 | ||
313 | res = child->resource[0]; | 321 | res = child->resource[0]; |
314 | pci_read_config_byte(dev, PCI_IO_BASE, &io_base_lo); | 322 | pci_read_config_byte(dev, PCI_IO_BASE, &io_base_lo); |
315 | pci_read_config_byte(dev, PCI_IO_LIMIT, &io_limit_lo); | 323 | pci_read_config_byte(dev, PCI_IO_LIMIT, &io_limit_lo); |
316 | base = (io_base_lo & PCI_IO_RANGE_MASK) << 8; | 324 | base = (io_base_lo & io_mask) << 8; |
317 | limit = (io_limit_lo & PCI_IO_RANGE_MASK) << 8; | 325 | limit = (io_limit_lo & io_mask) << 8; |
318 | 326 | ||
319 | if ((io_base_lo & PCI_IO_RANGE_TYPE_MASK) == PCI_IO_RANGE_TYPE_32) { | 327 | if ((io_base_lo & PCI_IO_RANGE_TYPE_MASK) == PCI_IO_RANGE_TYPE_32) { |
320 | u16 io_base_hi, io_limit_hi; | 328 | u16 io_base_hi, io_limit_hi; |
@@ -325,16 +333,11 @@ static void __devinit pci_read_bridge_io(struct pci_bus *child) | |||
325 | limit |= ((unsigned long) io_limit_hi << 16); | 333 | limit |= ((unsigned long) io_limit_hi << 16); |
326 | } | 334 | } |
327 | 335 | ||
328 | if (base && base <= limit) { | 336 | if (base <= limit) { |
329 | res->flags = (io_base_lo & PCI_IO_RANGE_TYPE_MASK) | IORESOURCE_IO; | 337 | res->flags = (io_base_lo & PCI_IO_RANGE_TYPE_MASK) | IORESOURCE_IO; |
330 | res2.flags = res->flags; | ||
331 | region.start = base; | 338 | region.start = base; |
332 | region.end = limit + 0xfff; | 339 | region.end = limit + io_granularity - 1; |
333 | pcibios_bus_to_resource(dev, &res2, ®ion); | 340 | pcibios_bus_to_resource(dev, res, ®ion); |
334 | if (!res->start) | ||
335 | res->start = res2.start; | ||
336 | if (!res->end) | ||
337 | res->end = res2.end; | ||
338 | dev_printk(KERN_DEBUG, &dev->dev, " bridge window %pR\n", res); | 341 | dev_printk(KERN_DEBUG, &dev->dev, " bridge window %pR\n", res); |
339 | } | 342 | } |
340 | } | 343 | } |
@@ -352,7 +355,7 @@ static void __devinit pci_read_bridge_mmio(struct pci_bus *child) | |||
352 | pci_read_config_word(dev, PCI_MEMORY_LIMIT, &mem_limit_lo); | 355 | pci_read_config_word(dev, PCI_MEMORY_LIMIT, &mem_limit_lo); |
353 | base = ((unsigned long) mem_base_lo & PCI_MEMORY_RANGE_MASK) << 16; | 356 | base = ((unsigned long) mem_base_lo & PCI_MEMORY_RANGE_MASK) << 16; |
354 | limit = ((unsigned long) mem_limit_lo & PCI_MEMORY_RANGE_MASK) << 16; | 357 | limit = ((unsigned long) mem_limit_lo & PCI_MEMORY_RANGE_MASK) << 16; |
355 | if (base && base <= limit) { | 358 | if (base <= limit) { |
356 | res->flags = (mem_base_lo & PCI_MEMORY_RANGE_TYPE_MASK) | IORESOURCE_MEM; | 359 | res->flags = (mem_base_lo & PCI_MEMORY_RANGE_TYPE_MASK) | IORESOURCE_MEM; |
357 | region.start = base; | 360 | region.start = base; |
358 | region.end = limit + 0xfffff; | 361 | region.end = limit + 0xfffff; |
@@ -399,7 +402,7 @@ static void __devinit pci_read_bridge_mmio_pref(struct pci_bus *child) | |||
399 | #endif | 402 | #endif |
400 | } | 403 | } |
401 | } | 404 | } |
402 | if (base && base <= limit) { | 405 | if (base <= limit) { |
403 | res->flags = (mem_base_lo & PCI_PREF_RANGE_TYPE_MASK) | | 406 | res->flags = (mem_base_lo & PCI_PREF_RANGE_TYPE_MASK) | |
404 | IORESOURCE_MEM | IORESOURCE_PREFETCH; | 407 | IORESOURCE_MEM | IORESOURCE_PREFETCH; |
405 | if (res->flags & PCI_PREF_RANGE_TYPE_64) | 408 | if (res->flags & PCI_PREF_RANGE_TYPE_64) |
diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c index 17741d3cabca..52f44b58945d 100644 --- a/drivers/pci/quirks.c +++ b/drivers/pci/quirks.c | |||
@@ -1938,53 +1938,16 @@ DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_NCR, PCI_DEVICE_ID_NCR_53C810, fixup_rev1 | |||
1938 | static void __devinit quirk_p64h2_1k_io(struct pci_dev *dev) | 1938 | static void __devinit quirk_p64h2_1k_io(struct pci_dev *dev) |
1939 | { | 1939 | { |
1940 | u16 en1k; | 1940 | u16 en1k; |
1941 | u8 io_base_lo, io_limit_lo; | ||
1942 | unsigned long base, limit; | ||
1943 | struct resource *res = dev->resource + PCI_BRIDGE_RESOURCES; | ||
1944 | 1941 | ||
1945 | pci_read_config_word(dev, 0x40, &en1k); | 1942 | pci_read_config_word(dev, 0x40, &en1k); |
1946 | 1943 | ||
1947 | if (en1k & 0x200) { | 1944 | if (en1k & 0x200) { |
1948 | dev_info(&dev->dev, "Enable I/O Space to 1KB granularity\n"); | 1945 | dev_info(&dev->dev, "Enable I/O Space to 1KB granularity\n"); |
1949 | 1946 | dev->io_window_1k = 1; | |
1950 | pci_read_config_byte(dev, PCI_IO_BASE, &io_base_lo); | ||
1951 | pci_read_config_byte(dev, PCI_IO_LIMIT, &io_limit_lo); | ||
1952 | base = (io_base_lo & (PCI_IO_RANGE_MASK | 0x0c)) << 8; | ||
1953 | limit = (io_limit_lo & (PCI_IO_RANGE_MASK | 0x0c)) << 8; | ||
1954 | |||
1955 | if (base <= limit) { | ||
1956 | res->start = base; | ||
1957 | res->end = limit + 0x3ff; | ||
1958 | } | ||
1959 | } | 1947 | } |
1960 | } | 1948 | } |
1961 | DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, 0x1460, quirk_p64h2_1k_io); | 1949 | DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, 0x1460, quirk_p64h2_1k_io); |
1962 | 1950 | ||
1963 | /* Fix the IOBL_ADR for 1k I/O space granularity on the Intel P64H2 | ||
1964 | * The IOBL_ADR gets re-written to 4k boundaries in pci_setup_bridge() | ||
1965 | * in drivers/pci/setup-bus.c | ||
1966 | */ | ||
1967 | static void __devinit quirk_p64h2_1k_io_fix_iobl(struct pci_dev *dev) | ||
1968 | { | ||
1969 | u16 en1k, iobl_adr, iobl_adr_1k; | ||
1970 | struct resource *res = dev->resource + PCI_BRIDGE_RESOURCES; | ||
1971 | |||
1972 | pci_read_config_word(dev, 0x40, &en1k); | ||
1973 | |||
1974 | if (en1k & 0x200) { | ||
1975 | pci_read_config_word(dev, PCI_IO_BASE, &iobl_adr); | ||
1976 | |||
1977 | iobl_adr_1k = iobl_adr | (res->start >> 8) | (res->end & 0xfc00); | ||
1978 | |||
1979 | if (iobl_adr != iobl_adr_1k) { | ||
1980 | dev_info(&dev->dev, "Fixing P64H2 IOBL_ADR from 0x%x to 0x%x for 1KB granularity\n", | ||
1981 | iobl_adr,iobl_adr_1k); | ||
1982 | pci_write_config_word(dev, PCI_IO_BASE, iobl_adr_1k); | ||
1983 | } | ||
1984 | } | ||
1985 | } | ||
1986 | DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x1460, quirk_p64h2_1k_io_fix_iobl); | ||
1987 | |||
1988 | /* Under some circumstances, AER is not linked with extended capabilities. | 1951 | /* Under some circumstances, AER is not linked with extended capabilities. |
1989 | * Force it to be linked by setting the corresponding control bit in the | 1952 | * Force it to be linked by setting the corresponding control bit in the |
1990 | * config space. | 1953 | * config space. |
diff --git a/drivers/pci/setup-bus.c b/drivers/pci/setup-bus.c index 561e41cf102d..fdb11770af1f 100644 --- a/drivers/pci/setup-bus.c +++ b/drivers/pci/setup-bus.c | |||
@@ -469,16 +469,23 @@ static void pci_setup_bridge_io(struct pci_bus *bus) | |||
469 | struct pci_dev *bridge = bus->self; | 469 | struct pci_dev *bridge = bus->self; |
470 | struct resource *res; | 470 | struct resource *res; |
471 | struct pci_bus_region region; | 471 | struct pci_bus_region region; |
472 | unsigned long io_mask; | ||
473 | u8 io_base_lo, io_limit_lo; | ||
472 | u32 l, io_upper16; | 474 | u32 l, io_upper16; |
473 | 475 | ||
476 | io_mask = PCI_IO_RANGE_MASK; | ||
477 | if (bridge->io_window_1k) | ||
478 | io_mask = PCI_IO_1K_RANGE_MASK; | ||
479 | |||
474 | /* Set up the top and bottom of the PCI I/O segment for this bus. */ | 480 | /* Set up the top and bottom of the PCI I/O segment for this bus. */ |
475 | res = bus->resource[0]; | 481 | res = bus->resource[0]; |
476 | pcibios_resource_to_bus(bridge, ®ion, res); | 482 | pcibios_resource_to_bus(bridge, ®ion, res); |
477 | if (res->flags & IORESOURCE_IO) { | 483 | if (res->flags & IORESOURCE_IO) { |
478 | pci_read_config_dword(bridge, PCI_IO_BASE, &l); | 484 | pci_read_config_dword(bridge, PCI_IO_BASE, &l); |
479 | l &= 0xffff0000; | 485 | l &= 0xffff0000; |
480 | l |= (region.start >> 8) & 0x00f0; | 486 | io_base_lo = (region.start >> 8) & io_mask; |
481 | l |= region.end & 0xf000; | 487 | io_limit_lo = (region.end >> 8) & io_mask; |
488 | l |= ((u32) io_limit_lo << 8) | io_base_lo; | ||
482 | /* Set up upper 16 bits of I/O base/limit. */ | 489 | /* Set up upper 16 bits of I/O base/limit. */ |
483 | io_upper16 = (region.end & 0xffff0000) | (region.start >> 16); | 490 | io_upper16 = (region.end & 0xffff0000) | (region.start >> 16); |
484 | dev_info(&bridge->dev, " bridge window %pR\n", res); | 491 | dev_info(&bridge->dev, " bridge window %pR\n", res); |
@@ -699,7 +706,7 @@ static resource_size_t calculate_memsize(resource_size_t size, | |||
699 | * @realloc_head : track the additional io window on this list | 706 | * @realloc_head : track the additional io window on this list |
700 | * | 707 | * |
701 | * Sizing the IO windows of the PCI-PCI bridge is trivial, | 708 | * Sizing the IO windows of the PCI-PCI bridge is trivial, |
702 | * since these windows have 4K granularity and the IO ranges | 709 | * since these windows have 1K or 4K granularity and the IO ranges |
703 | * of non-bridge PCI devices are limited to 256 bytes. | 710 | * of non-bridge PCI devices are limited to 256 bytes. |
704 | * We must be careful with the ISA aliasing though. | 711 | * We must be careful with the ISA aliasing though. |
705 | */ | 712 | */ |
@@ -710,10 +717,17 @@ static void pbus_size_io(struct pci_bus *bus, resource_size_t min_size, | |||
710 | struct resource *b_res = find_free_bus_resource(bus, IORESOURCE_IO); | 717 | struct resource *b_res = find_free_bus_resource(bus, IORESOURCE_IO); |
711 | unsigned long size = 0, size0 = 0, size1 = 0; | 718 | unsigned long size = 0, size0 = 0, size1 = 0; |
712 | resource_size_t children_add_size = 0; | 719 | resource_size_t children_add_size = 0; |
720 | resource_size_t min_align = 4096, align; | ||
713 | 721 | ||
714 | if (!b_res) | 722 | if (!b_res) |
715 | return; | 723 | return; |
716 | 724 | ||
725 | /* | ||
726 | * Per spec, I/O windows are 4K-aligned, but some bridges have an | ||
727 | * extension to support 1K alignment. | ||
728 | */ | ||
729 | if (bus->self->io_window_1k) | ||
730 | min_align = 1024; | ||
717 | list_for_each_entry(dev, &bus->devices, bus_list) { | 731 | list_for_each_entry(dev, &bus->devices, bus_list) { |
718 | int i; | 732 | int i; |
719 | 733 | ||
@@ -731,17 +745,25 @@ static void pbus_size_io(struct pci_bus *bus, resource_size_t min_size, | |||
731 | else | 745 | else |
732 | size1 += r_size; | 746 | size1 += r_size; |
733 | 747 | ||
748 | align = pci_resource_alignment(dev, r); | ||
749 | if (align > min_align) | ||
750 | min_align = align; | ||
751 | |||
734 | if (realloc_head) | 752 | if (realloc_head) |
735 | children_add_size += get_res_add_size(realloc_head, r); | 753 | children_add_size += get_res_add_size(realloc_head, r); |
736 | } | 754 | } |
737 | } | 755 | } |
756 | |||
757 | if (min_align > 4096) | ||
758 | min_align = 4096; | ||
759 | |||
738 | size0 = calculate_iosize(size, min_size, size1, | 760 | size0 = calculate_iosize(size, min_size, size1, |
739 | resource_size(b_res), 4096); | 761 | resource_size(b_res), min_align); |
740 | if (children_add_size > add_size) | 762 | if (children_add_size > add_size) |
741 | add_size = children_add_size; | 763 | add_size = children_add_size; |
742 | size1 = (!realloc_head || (realloc_head && !add_size)) ? size0 : | 764 | size1 = (!realloc_head || (realloc_head && !add_size)) ? size0 : |
743 | calculate_iosize(size, min_size, add_size + size1, | 765 | calculate_iosize(size, min_size, add_size + size1, |
744 | resource_size(b_res), 4096); | 766 | resource_size(b_res), min_align); |
745 | if (!size0 && !size1) { | 767 | if (!size0 && !size1) { |
746 | if (b_res->start || b_res->end) | 768 | if (b_res->start || b_res->end) |
747 | dev_info(&bus->self->dev, "disabling bridge window " | 769 | dev_info(&bus->self->dev, "disabling bridge window " |
@@ -750,12 +772,13 @@ static void pbus_size_io(struct pci_bus *bus, resource_size_t min_size, | |||
750 | b_res->flags = 0; | 772 | b_res->flags = 0; |
751 | return; | 773 | return; |
752 | } | 774 | } |
753 | /* Alignment of the IO window is always 4K */ | 775 | |
754 | b_res->start = 4096; | 776 | b_res->start = min_align; |
755 | b_res->end = b_res->start + size0 - 1; | 777 | b_res->end = b_res->start + size0 - 1; |
756 | b_res->flags |= IORESOURCE_STARTALIGN; | 778 | b_res->flags |= IORESOURCE_STARTALIGN; |
757 | if (size1 > size0 && realloc_head) { | 779 | if (size1 > size0 && realloc_head) { |
758 | add_to_list(realloc_head, bus->self, b_res, size1-size0, 4096); | 780 | add_to_list(realloc_head, bus->self, b_res, size1-size0, |
781 | min_align); | ||
759 | dev_printk(KERN_DEBUG, &bus->self->dev, "bridge window " | 782 | dev_printk(KERN_DEBUG, &bus->self->dev, "bridge window " |
760 | "%pR to %pR add_size %lx\n", b_res, | 783 | "%pR to %pR add_size %lx\n", b_res, |
761 | &bus->busn_res, size1-size0); | 784 | &bus->busn_res, size1-size0); |
diff --git a/include/linux/pci.h b/include/linux/pci.h index 85cffb823b4e..5faa8310eec9 100644 --- a/include/linux/pci.h +++ b/include/linux/pci.h | |||
@@ -333,6 +333,7 @@ struct pci_dev { | |||
333 | unsigned int __aer_firmware_first_valid:1; | 333 | unsigned int __aer_firmware_first_valid:1; |
334 | unsigned int __aer_firmware_first:1; | 334 | unsigned int __aer_firmware_first:1; |
335 | unsigned int broken_intx_masking:1; | 335 | unsigned int broken_intx_masking:1; |
336 | unsigned int io_window_1k:1; /* Intel P2P bridge 1K I/O windows */ | ||
336 | pci_dev_flags_t dev_flags; | 337 | pci_dev_flags_t dev_flags; |
337 | atomic_t enable_cnt; /* pci_enable_device has been called */ | 338 | atomic_t enable_cnt; /* pci_enable_device has been called */ |
338 | 339 | ||
diff --git a/include/linux/pci_regs.h b/include/linux/pci_regs.h index 80e8605b5f93..53274bff5773 100644 --- a/include/linux/pci_regs.h +++ b/include/linux/pci_regs.h | |||
@@ -126,7 +126,8 @@ | |||
126 | #define PCI_IO_RANGE_TYPE_MASK 0x0fUL /* I/O bridging type */ | 126 | #define PCI_IO_RANGE_TYPE_MASK 0x0fUL /* I/O bridging type */ |
127 | #define PCI_IO_RANGE_TYPE_16 0x00 | 127 | #define PCI_IO_RANGE_TYPE_16 0x00 |
128 | #define PCI_IO_RANGE_TYPE_32 0x01 | 128 | #define PCI_IO_RANGE_TYPE_32 0x01 |
129 | #define PCI_IO_RANGE_MASK (~0x0fUL) | 129 | #define PCI_IO_RANGE_MASK (~0x0fUL) /* Standard 4K I/O windows */ |
130 | #define PCI_IO_1K_RANGE_MASK (~0x03UL) /* Intel 1K I/O windows */ | ||
130 | #define PCI_SEC_STATUS 0x1e /* Secondary status register, only bit 14 used */ | 131 | #define PCI_SEC_STATUS 0x1e /* Secondary status register, only bit 14 used */ |
131 | #define PCI_MEMORY_BASE 0x20 /* Memory range behind */ | 132 | #define PCI_MEMORY_BASE 0x20 /* Memory range behind */ |
132 | #define PCI_MEMORY_LIMIT 0x22 | 133 | #define PCI_MEMORY_LIMIT 0x22 |