/[linux-patches]/genpatches-2.6/tags/2.6.13-4/1005_1_pci_assign_unassigned_resources-update.patch
Gentoo

Contents of /genpatches-2.6/tags/2.6.13-4/1005_1_pci_assign_unassigned_resources-update.patch

Parent Directory Parent Directory | Revision Log Revision Log


Revision 168 - (show annotations) (download)
Sun Sep 18 11:19:29 2005 UTC (8 years, 10 months ago) by dsd
File size: 4540 byte(s)
2.6.13-4 release
1 From stable-bounces@linux.kernel.org Mon Sep 5 07:12:23 2005
2 Date: Mon, 5 Sep 2005 07:12:21 -0700 (PDT)
3 From: Linus Torvalds <torvalds@osdl.org>
4 To: stable@kernel.org
5 Subject: [PATCH] x86: pci_assign_unassigned_resources() update
6
7 From: Ivan Kokshaysky <ink@jurassic.park.msu.ru>
8
9 I had some time to think about PCI assign issues in 2.6.13-rc series.
10
11 The major problem here is that we call pci_assign_unassigned_resources()
12 way too early - at subsys_initcall level. Therefore we give no chances
13 to ACPI and PnP routines (called at fs_initcall level) to reserve their
14 respective resources properly, as the comments in drivers/pnp/system.c
15 and drivers/acpi/motherboard.c suggest:
16
17 /**
18 * Reserve motherboard resources after PCI claim BARs,
19 * but before PCI assign resources for uninitialized PCI devices
20 */
21
22 So I moved the pci_assign_unassigned_resources() call to
23 pcibios_assign_resources() (fs_initcall), which should hopefully fix a
24 lot of problems and make PCIBIOS_MIN_IO tweaks unnecessary.
25
26 Other changes:
27 - remove resource assignment code from pcibios_assign_resources(), since
28 it duplicates pci_assign_unassigned_resources() functionality and
29 actually does nothing in 2.6.13;
30 - modify ROM assignment code as per Ben's suggestion: try to use firmware
31 settings by default (if PCI_ASSIGN_ROMS is not set);
32 - set CARDBUS_IO_SIZE back to 4K as it's a wonderful stress test for
33 various setups.
34
35 Confirmed by Tero Roponen <teanropo@cc.jyu.fi> (who had problems with
36 the 4kB CardBus IO size previously).
37
38 Signed-off-by: Linus Torvalds <torvalds@osdl.org>
39 Signed-off-by: Chris Wright <chrisw@osdl.org>
40 Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
41 ---
42 arch/i386/pci/common.c | 1
43 arch/i386/pci/i386.c | 49 +++++++++++++++---------------------------------
44 drivers/pci/setup-bus.c | 2 -
45 3 files changed, 17 insertions(+), 35 deletions(-)
46
47 Index: linux-2.6.13.y/arch/i386/pci/common.c
48 ===================================================================
49 --- linux-2.6.13.y.orig/arch/i386/pci/common.c
50 +++ linux-2.6.13.y/arch/i386/pci/common.c
51 @@ -165,7 +165,6 @@ static int __init pcibios_init(void)
52 if ((pci_probe & PCI_BIOS_SORT) && !(pci_probe & PCI_NO_SORT))
53 pcibios_sort();
54 #endif
55 - pci_assign_unassigned_resources();
56 return 0;
57 }
58
59 Index: linux-2.6.13.y/arch/i386/pci/i386.c
60 ===================================================================
61 --- linux-2.6.13.y.orig/arch/i386/pci/i386.c
62 +++ linux-2.6.13.y/arch/i386/pci/i386.c
63 @@ -170,43 +170,26 @@ static void __init pcibios_allocate_reso
64 static int __init pcibios_assign_resources(void)
65 {
66 struct pci_dev *dev = NULL;
67 - int idx;
68 - struct resource *r;
69 + struct resource *r, *pr;
70
71 - for_each_pci_dev(dev) {
72 - int class = dev->class >> 8;
73 -
74 - /* Don't touch classless devices and host bridges */
75 - if (!class || class == PCI_CLASS_BRIDGE_HOST)
76 - continue;
77 -
78 - for(idx=0; idx<6; idx++) {
79 - r = &dev->resource[idx];
80 -
81 - /*
82 - * Don't touch IDE controllers and I/O ports of video cards!
83 - */
84 - if ((class == PCI_CLASS_STORAGE_IDE && idx < 4) ||
85 - (class == PCI_CLASS_DISPLAY_VGA && (r->flags & IORESOURCE_IO)))
86 - continue;
87 -
88 - /*
89 - * We shall assign a new address to this resource, either because
90 - * the BIOS forgot to do so or because we have decided the old
91 - * address was unusable for some reason.
92 - */
93 - if (!r->start && r->end)
94 - pci_assign_resource(dev, idx);
95 - }
96 -
97 - if (pci_probe & PCI_ASSIGN_ROMS) {
98 + if (!(pci_probe & PCI_ASSIGN_ROMS)) {
99 + /* Try to use BIOS settings for ROMs, otherwise let
100 + pci_assign_unassigned_resources() allocate the new
101 + addresses. */
102 + for_each_pci_dev(dev) {
103 r = &dev->resource[PCI_ROM_RESOURCE];
104 - r->end -= r->start;
105 - r->start = 0;
106 - if (r->end)
107 - pci_assign_resource(dev, PCI_ROM_RESOURCE);
108 + if (!r->flags || !r->start)
109 + continue;
110 + pr = pci_find_parent_resource(dev, r);
111 + if (!pr || request_resource(pr, r) < 0) {
112 + r->end -= r->start;
113 + r->start = 0;
114 + }
115 }
116 }
117 +
118 + pci_assign_unassigned_resources();
119 +
120 return 0;
121 }
122
123 Index: linux-2.6.13.y/drivers/pci/setup-bus.c
124 ===================================================================
125 --- linux-2.6.13.y.orig/drivers/pci/setup-bus.c
126 +++ linux-2.6.13.y/drivers/pci/setup-bus.c
127 @@ -40,7 +40,7 @@
128 * FIXME: IO should be max 256 bytes. However, since we may
129 * have a P2P bridge below a cardbus bridge, we need 4K.
130 */
131 -#define CARDBUS_IO_SIZE (256)
132 +#define CARDBUS_IO_SIZE (4*1024)
133 #define CARDBUS_MEM_SIZE (32*1024*1024)
134
135 static void __devinit

  ViewVC Help
Powered by ViewVC 1.1.20