diff options
author | H. Peter Anvin <hpa@zytor.com> | 2010-02-10 19:55:28 -0500 |
---|---|---|
committer | H. Peter Anvin <hpa@zytor.com> | 2010-02-10 19:55:28 -0500 |
commit | 84abd88a70090cf00f9e45c3a81680874f17626e (patch) | |
tree | 4f58b80057f6e1f5817af1dc33a5458b3dfc9a99 /arch/x86/pci/acpi.c | |
parent | 13ca0fcaa33f6b1984c4111b6ec5df42689fea6f (diff) | |
parent | e28cab42f384745c8a947a9ccd51e4aae52f5d51 (diff) |
Merge remote branch 'linus/master' into x86/bootmem
Diffstat (limited to 'arch/x86/pci/acpi.c')
-rw-r--r-- | arch/x86/pci/acpi.c | 74 |
1 files changed, 60 insertions, 14 deletions
diff --git a/arch/x86/pci/acpi.c b/arch/x86/pci/acpi.c index 1014eb4bfc37..959e548a7039 100644 --- a/arch/x86/pci/acpi.c +++ b/arch/x86/pci/acpi.c | |||
@@ -7,6 +7,7 @@ | |||
7 | #include <asm/pci_x86.h> | 7 | #include <asm/pci_x86.h> |
8 | 8 | ||
9 | struct pci_root_info { | 9 | struct pci_root_info { |
10 | struct acpi_device *bridge; | ||
10 | char *name; | 11 | char *name; |
11 | unsigned int res_num; | 12 | unsigned int res_num; |
12 | struct resource *res; | 13 | struct resource *res; |
@@ -58,6 +59,30 @@ bus_has_transparent_bridge(struct pci_bus *bus) | |||
58 | return false; | 59 | return false; |
59 | } | 60 | } |
60 | 61 | ||
62 | static void | ||
63 | align_resource(struct acpi_device *bridge, struct resource *res) | ||
64 | { | ||
65 | int align = (res->flags & IORESOURCE_MEM) ? 16 : 4; | ||
66 | |||
67 | /* | ||
68 | * Host bridge windows are not BARs, but the decoders on the PCI side | ||
69 | * that claim this address space have starting alignment and length | ||
70 | * constraints, so fix any obvious BIOS goofs. | ||
71 | */ | ||
72 | if (!IS_ALIGNED(res->start, align)) { | ||
73 | dev_printk(KERN_DEBUG, &bridge->dev, | ||
74 | "host bridge window %pR invalid; " | ||
75 | "aligning start to %d-byte boundary\n", res, align); | ||
76 | res->start &= ~(align - 1); | ||
77 | } | ||
78 | if (!IS_ALIGNED(res->end + 1, align)) { | ||
79 | dev_printk(KERN_DEBUG, &bridge->dev, | ||
80 | "host bridge window %pR invalid; " | ||
81 | "aligning end to %d-byte boundary\n", res, align); | ||
82 | res->end = ALIGN(res->end, align) - 1; | ||
83 | } | ||
84 | } | ||
85 | |||
61 | static acpi_status | 86 | static acpi_status |
62 | setup_resource(struct acpi_resource *acpi_res, void *data) | 87 | setup_resource(struct acpi_resource *acpi_res, void *data) |
63 | { | 88 | { |
@@ -91,11 +116,12 @@ setup_resource(struct acpi_resource *acpi_res, void *data) | |||
91 | start = addr.minimum + addr.translation_offset; | 116 | start = addr.minimum + addr.translation_offset; |
92 | end = start + addr.address_length - 1; | 117 | end = start + addr.address_length - 1; |
93 | if (info->res_num >= max_root_bus_resources) { | 118 | if (info->res_num >= max_root_bus_resources) { |
94 | printk(KERN_WARNING "PCI: Failed to allocate 0x%lx-0x%lx " | 119 | if (pci_probe & PCI_USE__CRS) |
95 | "from %s for %s due to _CRS returning more than " | 120 | printk(KERN_WARNING "PCI: Failed to allocate " |
96 | "%d resource descriptors\n", (unsigned long) start, | 121 | "0x%lx-0x%lx from %s for %s due to _CRS " |
97 | (unsigned long) end, root->name, info->name, | 122 | "returning more than %d resource descriptors\n", |
98 | max_root_bus_resources); | 123 | (unsigned long) start, (unsigned long) end, |
124 | root->name, info->name, max_root_bus_resources); | ||
99 | return AE_OK; | 125 | return AE_OK; |
100 | } | 126 | } |
101 | 127 | ||
@@ -105,14 +131,28 @@ setup_resource(struct acpi_resource *acpi_res, void *data) | |||
105 | res->start = start; | 131 | res->start = start; |
106 | res->end = end; | 132 | res->end = end; |
107 | res->child = NULL; | 133 | res->child = NULL; |
134 | align_resource(info->bridge, res); | ||
135 | |||
136 | if (!(pci_probe & PCI_USE__CRS)) { | ||
137 | dev_printk(KERN_DEBUG, &info->bridge->dev, | ||
138 | "host bridge window %pR (ignored)\n", res); | ||
139 | return AE_OK; | ||
140 | } | ||
108 | 141 | ||
109 | if (insert_resource(root, res)) { | 142 | if (insert_resource(root, res)) { |
110 | printk(KERN_ERR "PCI: Failed to allocate 0x%lx-0x%lx " | 143 | dev_err(&info->bridge->dev, |
111 | "from %s for %s\n", (unsigned long) res->start, | 144 | "can't allocate host bridge window %pR\n", res); |
112 | (unsigned long) res->end, root->name, info->name); | ||
113 | } else { | 145 | } else { |
114 | info->bus->resource[info->res_num] = res; | 146 | info->bus->resource[info->res_num] = res; |
115 | info->res_num++; | 147 | info->res_num++; |
148 | if (addr.translation_offset) | ||
149 | dev_info(&info->bridge->dev, "host bridge window %pR " | ||
150 | "(PCI address [%#llx-%#llx])\n", | ||
151 | res, res->start - addr.translation_offset, | ||
152 | res->end - addr.translation_offset); | ||
153 | else | ||
154 | dev_info(&info->bridge->dev, | ||
155 | "host bridge window %pR\n", res); | ||
116 | } | 156 | } |
117 | return AE_OK; | 157 | return AE_OK; |
118 | } | 158 | } |
@@ -124,6 +164,12 @@ get_current_resources(struct acpi_device *device, int busnum, | |||
124 | struct pci_root_info info; | 164 | struct pci_root_info info; |
125 | size_t size; | 165 | size_t size; |
126 | 166 | ||
167 | if (!(pci_probe & PCI_USE__CRS)) | ||
168 | dev_info(&device->dev, | ||
169 | "ignoring host bridge windows from ACPI; " | ||
170 | "boot with \"pci=use_crs\" to use them\n"); | ||
171 | |||
172 | info.bridge = device; | ||
127 | info.bus = bus; | 173 | info.bus = bus; |
128 | info.res_num = 0; | 174 | info.res_num = 0; |
129 | acpi_walk_resources(device->handle, METHOD_NAME__CRS, count_resource, | 175 | acpi_walk_resources(device->handle, METHOD_NAME__CRS, count_resource, |
@@ -163,8 +209,9 @@ struct pci_bus * __devinit pci_acpi_scan_root(struct acpi_device *device, int do | |||
163 | #endif | 209 | #endif |
164 | 210 | ||
165 | if (domain && !pci_domains_supported) { | 211 | if (domain && !pci_domains_supported) { |
166 | printk(KERN_WARNING "PCI: Multiple domains not supported " | 212 | printk(KERN_WARNING "pci_bus %04x:%02x: " |
167 | "(dom %d, bus %d)\n", domain, busnum); | 213 | "ignored (multiple domains not supported)\n", |
214 | domain, busnum); | ||
168 | return NULL; | 215 | return NULL; |
169 | } | 216 | } |
170 | 217 | ||
@@ -188,7 +235,8 @@ struct pci_bus * __devinit pci_acpi_scan_root(struct acpi_device *device, int do | |||
188 | */ | 235 | */ |
189 | sd = kzalloc(sizeof(*sd), GFP_KERNEL); | 236 | sd = kzalloc(sizeof(*sd), GFP_KERNEL); |
190 | if (!sd) { | 237 | if (!sd) { |
191 | printk(KERN_ERR "PCI: OOM, not probing PCI bus %02x\n", busnum); | 238 | printk(KERN_WARNING "pci_bus %04x:%02x: " |
239 | "ignored (out of memory)\n", domain, busnum); | ||
192 | return NULL; | 240 | return NULL; |
193 | } | 241 | } |
194 | 242 | ||
@@ -209,9 +257,7 @@ struct pci_bus * __devinit pci_acpi_scan_root(struct acpi_device *device, int do | |||
209 | } else { | 257 | } else { |
210 | bus = pci_create_bus(NULL, busnum, &pci_root_ops, sd); | 258 | bus = pci_create_bus(NULL, busnum, &pci_root_ops, sd); |
211 | if (bus) { | 259 | if (bus) { |
212 | if (pci_probe & PCI_USE__CRS) | 260 | get_current_resources(device, busnum, domain, bus); |
213 | get_current_resources(device, busnum, domain, | ||
214 | bus); | ||
215 | bus->subordinate = pci_scan_child_bus(bus); | 261 | bus->subordinate = pci_scan_child_bus(bus); |
216 | } | 262 | } |
217 | } | 263 | } |