diff options
-rw-r--r-- | drivers/pci/setup-bus.c | 4 | ||||
-rw-r--r-- | drivers/pcmcia/yenta_socket.c | 41 | ||||
-rw-r--r-- | include/linux/pci.h | 1 |
3 files changed, 21 insertions, 25 deletions
diff --git a/drivers/pci/setup-bus.c b/drivers/pci/setup-bus.c index 6b0e6464eb39..657be948baf7 100644 --- a/drivers/pci/setup-bus.c +++ b/drivers/pci/setup-bus.c | |||
@@ -77,8 +77,7 @@ pbus_assign_resources_sorted(struct pci_bus *bus) | |||
77 | } | 77 | } |
78 | } | 78 | } |
79 | 79 | ||
80 | static void __devinit | 80 | void pci_setup_cardbus(struct pci_bus *bus) |
81 | pci_setup_cardbus(struct pci_bus *bus) | ||
82 | { | 81 | { |
83 | struct pci_dev *bridge = bus->self; | 82 | struct pci_dev *bridge = bus->self; |
84 | struct pci_bus_region region; | 83 | struct pci_bus_region region; |
@@ -130,6 +129,7 @@ pci_setup_cardbus(struct pci_bus *bus) | |||
130 | region.end); | 129 | region.end); |
131 | } | 130 | } |
132 | } | 131 | } |
132 | EXPORT_SYMBOL(pci_setup_cardbus); | ||
133 | 133 | ||
134 | /* Initialize bridges with base/limit values we have collected. | 134 | /* Initialize bridges with base/limit values we have collected. |
135 | PCI-to-PCI Bridge Architecture Specification rev. 1.1 (1998) | 135 | PCI-to-PCI Bridge Architecture Specification rev. 1.1 (1998) |
diff --git a/drivers/pcmcia/yenta_socket.c b/drivers/pcmcia/yenta_socket.c index 0347a29f297b..271a52b7c2e6 100644 --- a/drivers/pcmcia/yenta_socket.c +++ b/drivers/pcmcia/yenta_socket.c | |||
@@ -667,7 +667,7 @@ static int yenta_search_res(struct yenta_socket *socket, struct resource *res, | |||
667 | return 0; | 667 | return 0; |
668 | } | 668 | } |
669 | 669 | ||
670 | static void yenta_allocate_res(struct yenta_socket *socket, int nr, unsigned type, int addr_start, int addr_end) | 670 | static int yenta_allocate_res(struct yenta_socket *socket, int nr, unsigned type, int addr_start, int addr_end) |
671 | { | 671 | { |
672 | struct resource *root, *res; | 672 | struct resource *root, *res; |
673 | struct pci_bus_region region; | 673 | struct pci_bus_region region; |
@@ -676,7 +676,7 @@ static void yenta_allocate_res(struct yenta_socket *socket, int nr, unsigned typ | |||
676 | res = socket->dev->resource + PCI_BRIDGE_RESOURCES + nr; | 676 | res = socket->dev->resource + PCI_BRIDGE_RESOURCES + nr; |
677 | /* Already allocated? */ | 677 | /* Already allocated? */ |
678 | if (res->parent) | 678 | if (res->parent) |
679 | return; | 679 | return 0; |
680 | 680 | ||
681 | /* The granularity of the memory limit is 4kB, on IO it's 4 bytes */ | 681 | /* The granularity of the memory limit is 4kB, on IO it's 4 bytes */ |
682 | mask = ~0xfff; | 682 | mask = ~0xfff; |
@@ -692,7 +692,7 @@ static void yenta_allocate_res(struct yenta_socket *socket, int nr, unsigned typ | |||
692 | pcibios_bus_to_resource(socket->dev, res, ®ion); | 692 | pcibios_bus_to_resource(socket->dev, res, ®ion); |
693 | root = pci_find_parent_resource(socket->dev, res); | 693 | root = pci_find_parent_resource(socket->dev, res); |
694 | if (root && (request_resource(root, res) == 0)) | 694 | if (root && (request_resource(root, res) == 0)) |
695 | return; | 695 | return 0; |
696 | printk(KERN_INFO "yenta %s: Preassigned resource %d busy or not available, reconfiguring...\n", | 696 | printk(KERN_INFO "yenta %s: Preassigned resource %d busy or not available, reconfiguring...\n", |
697 | pci_name(socket->dev), nr); | 697 | pci_name(socket->dev), nr); |
698 | } | 698 | } |
@@ -700,35 +700,27 @@ static void yenta_allocate_res(struct yenta_socket *socket, int nr, unsigned typ | |||
700 | if (type & IORESOURCE_IO) { | 700 | if (type & IORESOURCE_IO) { |
701 | if ((yenta_search_res(socket, res, BRIDGE_IO_MAX)) || | 701 | if ((yenta_search_res(socket, res, BRIDGE_IO_MAX)) || |
702 | (yenta_search_res(socket, res, BRIDGE_IO_ACC)) || | 702 | (yenta_search_res(socket, res, BRIDGE_IO_ACC)) || |
703 | (yenta_search_res(socket, res, BRIDGE_IO_MIN))) { | 703 | (yenta_search_res(socket, res, BRIDGE_IO_MIN))) |
704 | config_writel(socket, addr_start, res->start); | 704 | return 1; |
705 | config_writel(socket, addr_end, res->end); | ||
706 | return; | ||
707 | } | ||
708 | } else { | 705 | } else { |
709 | if (type & IORESOURCE_PREFETCH) { | 706 | if (type & IORESOURCE_PREFETCH) { |
710 | if ((yenta_search_res(socket, res, BRIDGE_MEM_MAX)) || | 707 | if ((yenta_search_res(socket, res, BRIDGE_MEM_MAX)) || |
711 | (yenta_search_res(socket, res, BRIDGE_MEM_ACC)) || | 708 | (yenta_search_res(socket, res, BRIDGE_MEM_ACC)) || |
712 | (yenta_search_res(socket, res, BRIDGE_MEM_MIN))) { | 709 | (yenta_search_res(socket, res, BRIDGE_MEM_MIN))) |
713 | config_writel(socket, addr_start, res->start); | 710 | return 1; |
714 | config_writel(socket, addr_end, res->end); | ||
715 | return; | ||
716 | } | ||
717 | /* Approximating prefetchable by non-prefetchable */ | 711 | /* Approximating prefetchable by non-prefetchable */ |
718 | res->flags = IORESOURCE_MEM; | 712 | res->flags = IORESOURCE_MEM; |
719 | } | 713 | } |
720 | if ((yenta_search_res(socket, res, BRIDGE_MEM_MAX)) || | 714 | if ((yenta_search_res(socket, res, BRIDGE_MEM_MAX)) || |
721 | (yenta_search_res(socket, res, BRIDGE_MEM_ACC)) || | 715 | (yenta_search_res(socket, res, BRIDGE_MEM_ACC)) || |
722 | (yenta_search_res(socket, res, BRIDGE_MEM_MIN))) { | 716 | (yenta_search_res(socket, res, BRIDGE_MEM_MIN))) |
723 | config_writel(socket, addr_start, res->start); | 717 | return 1; |
724 | config_writel(socket, addr_end, res->end); | ||
725 | return; | ||
726 | } | ||
727 | } | 718 | } |
728 | 719 | ||
729 | printk(KERN_INFO "yenta %s: no resource of type %x available, trying to continue...\n", | 720 | printk(KERN_INFO "yenta %s: no resource of type %x available, trying to continue...\n", |
730 | pci_name(socket->dev), type); | 721 | pci_name(socket->dev), type); |
731 | res->start = res->end = res->flags = 0; | 722 | res->start = res->end = res->flags = 0; |
723 | return 0; | ||
732 | } | 724 | } |
733 | 725 | ||
734 | /* | 726 | /* |
@@ -736,14 +728,17 @@ static void yenta_allocate_res(struct yenta_socket *socket, int nr, unsigned typ | |||
736 | */ | 728 | */ |
737 | static void yenta_allocate_resources(struct yenta_socket *socket) | 729 | static void yenta_allocate_resources(struct yenta_socket *socket) |
738 | { | 730 | { |
739 | yenta_allocate_res(socket, 0, IORESOURCE_IO, | 731 | int program = 0; |
732 | program += yenta_allocate_res(socket, 0, IORESOURCE_IO, | ||
740 | PCI_CB_IO_BASE_0, PCI_CB_IO_LIMIT_0); | 733 | PCI_CB_IO_BASE_0, PCI_CB_IO_LIMIT_0); |
741 | yenta_allocate_res(socket, 1, IORESOURCE_IO, | 734 | program += yenta_allocate_res(socket, 1, IORESOURCE_IO, |
742 | PCI_CB_IO_BASE_1, PCI_CB_IO_LIMIT_1); | 735 | PCI_CB_IO_BASE_1, PCI_CB_IO_LIMIT_1); |
743 | yenta_allocate_res(socket, 2, IORESOURCE_MEM|IORESOURCE_PREFETCH, | 736 | program += yenta_allocate_res(socket, 2, IORESOURCE_MEM|IORESOURCE_PREFETCH, |
744 | PCI_CB_MEMORY_BASE_0, PCI_CB_MEMORY_LIMIT_0); | 737 | PCI_CB_MEMORY_BASE_0, PCI_CB_MEMORY_LIMIT_0); |
745 | yenta_allocate_res(socket, 3, IORESOURCE_MEM, | 738 | program += yenta_allocate_res(socket, 3, IORESOURCE_MEM, |
746 | PCI_CB_MEMORY_BASE_1, PCI_CB_MEMORY_LIMIT_1); | 739 | PCI_CB_MEMORY_BASE_1, PCI_CB_MEMORY_LIMIT_1); |
740 | if (program) | ||
741 | pci_setup_cardbus(socket->dev->subordinate); | ||
747 | } | 742 | } |
748 | 743 | ||
749 | 744 | ||
@@ -758,7 +753,7 @@ static void yenta_free_resources(struct yenta_socket *socket) | |||
758 | res = socket->dev->resource + PCI_BRIDGE_RESOURCES + i; | 753 | res = socket->dev->resource + PCI_BRIDGE_RESOURCES + i; |
759 | if (res->start != 0 && res->end != 0) | 754 | if (res->start != 0 && res->end != 0) |
760 | release_resource(res); | 755 | release_resource(res); |
761 | res->start = res->end = 0; | 756 | res->start = res->end = res->flags = 0; |
762 | } | 757 | } |
763 | } | 758 | } |
764 | 759 | ||
diff --git a/include/linux/pci.h b/include/linux/pci.h index 6caaba0af469..c62e89270237 100644 --- a/include/linux/pci.h +++ b/include/linux/pci.h | |||
@@ -326,6 +326,7 @@ extern struct pci_dev *pci_dev_get(struct pci_dev *dev); | |||
326 | extern void pci_dev_put(struct pci_dev *dev); | 326 | extern void pci_dev_put(struct pci_dev *dev); |
327 | extern void pci_remove_bus(struct pci_bus *b); | 327 | extern void pci_remove_bus(struct pci_bus *b); |
328 | extern void pci_remove_bus_device(struct pci_dev *dev); | 328 | extern void pci_remove_bus_device(struct pci_dev *dev); |
329 | void pci_setup_cardbus(struct pci_bus *bus); | ||
329 | 330 | ||
330 | /* Generic PCI functions exported to card drivers */ | 331 | /* Generic PCI functions exported to card drivers */ |
331 | 332 | ||