aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/pci
diff options
context:
space:
mode:
authorIngo Molnar <mingo@elte.hu>2008-08-29 02:09:23 -0400
committerH. Peter Anvin <hpa@zytor.com>2008-09-04 11:39:25 -0400
commita5444d15b611cf2ffe2bc52aaf11f2ac51882f89 (patch)
treefced46b371542946ee91b0fa5dcbe4ca14f7454c /arch/x86/pci
parent58f7c98850a226d3fb05b1095af9f7c4ea3507ba (diff)
x86: split e820 reserved entries record to late v4
this one replaces: | commit a2bd7274b47124d2fc4dfdb8c0591f545ba749dd | Author: Yinghai Lu <yhlu.kernel@gmail.com> | Date: Mon Aug 25 00:56:08 2008 -0700 | | x86: fix HPET regression in 2.6.26 versus 2.6.25, check hpet against BAR, v3 v2: insert e820 reserve resources before pnp_system_init v3: fix merging problem in tip/x86/core v4: address Linus's review about comments and condition in _late() Signed-off-by: Yinghai Lu <yhlu.kernel@gmail.com> Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'arch/x86/pci')
-rw-r--r--arch/x86/pci/i386.c80
1 files changed, 2 insertions, 78 deletions
diff --git a/arch/x86/pci/i386.c b/arch/x86/pci/i386.c
index 40811efaa25a..844df0cbbd3e 100644
--- a/arch/x86/pci/i386.c
+++ b/arch/x86/pci/i386.c
@@ -31,11 +31,8 @@
31#include <linux/ioport.h> 31#include <linux/ioport.h>
32#include <linux/errno.h> 32#include <linux/errno.h>
33#include <linux/bootmem.h> 33#include <linux/bootmem.h>
34#include <linux/acpi.h>
35 34
36#include <asm/pat.h> 35#include <asm/pat.h>
37#include <asm/hpet.h>
38#include <asm/io_apic.h>
39#include <asm/e820.h> 36#include <asm/e820.h>
40 37
41#include "pci.h" 38#include "pci.h"
@@ -81,77 +78,6 @@ pcibios_align_resource(void *data, struct resource *res,
81} 78}
82EXPORT_SYMBOL(pcibios_align_resource); 79EXPORT_SYMBOL(pcibios_align_resource);
83 80
84static int check_res_with_valid(struct pci_dev *dev, struct resource *res)
85{
86 unsigned long base;
87 unsigned long size;
88 int i;
89
90 base = res->start;
91 size = (res->start == 0 && res->end == res->start) ? 0 :
92 (res->end - res->start + 1);
93
94 if (!base || !size)
95 return 0;
96
97#ifdef CONFIG_HPET_TIMER
98 /* for hpet */
99 if (base == hpet_address && (res->flags & IORESOURCE_MEM)) {
100 dev_info(&dev->dev, "BAR has HPET at %08lx-%08lx\n",
101 base, base + size - 1);
102 return 1;
103 }
104#endif
105
106#ifdef CONFIG_X86_IO_APIC
107 for (i = 0; i < nr_ioapics; i++) {
108 unsigned long ioapic_phys = mp_ioapics[i].mp_apicaddr;
109
110 if (base == ioapic_phys && (res->flags & IORESOURCE_MEM)) {
111 dev_info(&dev->dev, "BAR has ioapic at %08lx-%08lx\n",
112 base, base + size - 1);
113 return 1;
114 }
115 }
116#endif
117
118#ifdef CONFIG_PCI_MMCONFIG
119 for (i = 0; i < pci_mmcfg_config_num; i++) {
120 unsigned long addr;
121
122 addr = pci_mmcfg_config[i].address;
123 if (base == addr && (res->flags & IORESOURCE_MEM)) {
124 dev_info(&dev->dev, "BAR has MMCONFIG at %08lx-%08lx\n",
125 base, base + size - 1);
126 return 1;
127 }
128 }
129#endif
130
131 return 0;
132}
133
134static int check_platform(struct pci_dev *dev, struct resource *res)
135{
136 struct resource *root = NULL;
137
138 /*
139 * forcibly insert it into the
140 * resource tree
141 */
142 if (res->flags & IORESOURCE_MEM)
143 root = &iomem_resource;
144 else if (res->flags & IORESOURCE_IO)
145 root = &ioport_resource;
146
147 if (root && check_res_with_valid(dev, res)) {
148 insert_resource(root, res);
149
150 return 1;
151 }
152
153 return 0;
154}
155/* 81/*
156 * Handle resources of PCI devices. If the world were perfect, we could 82 * Handle resources of PCI devices. If the world were perfect, we could
157 * just allocate all the resource regions and do nothing more. It isn't. 83 * just allocate all the resource regions and do nothing more. It isn't.
@@ -203,8 +129,6 @@ static void __init pcibios_allocate_bus_resources(struct list_head *bus_list)
203 pr = pci_find_parent_resource(dev, r); 129 pr = pci_find_parent_resource(dev, r);
204 if (!r->start || !pr || 130 if (!r->start || !pr ||
205 request_resource(pr, r) < 0) { 131 request_resource(pr, r) < 0) {
206 if (check_platform(dev, r))
207 continue;
208 dev_err(&dev->dev, "BAR %d: can't allocate resource\n", idx); 132 dev_err(&dev->dev, "BAR %d: can't allocate resource\n", idx);
209 /* 133 /*
210 * Something is wrong with the region. 134 * Something is wrong with the region.
@@ -246,8 +170,6 @@ static void __init pcibios_allocate_resources(int pass)
246 r->flags, disabled, pass); 170 r->flags, disabled, pass);
247 pr = pci_find_parent_resource(dev, r); 171 pr = pci_find_parent_resource(dev, r);
248 if (!pr || request_resource(pr, r) < 0) { 172 if (!pr || request_resource(pr, r) < 0) {
249 if (check_platform(dev, r))
250 continue;
251 dev_err(&dev->dev, "BAR %d: can't allocate resource\n", idx); 173 dev_err(&dev->dev, "BAR %d: can't allocate resource\n", idx);
252 /* We'll assign a new address later */ 174 /* We'll assign a new address later */
253 r->end -= r->start; 175 r->end -= r->start;
@@ -306,6 +228,8 @@ void __init pcibios_resource_survey(void)
306 pcibios_allocate_bus_resources(&pci_root_buses); 228 pcibios_allocate_bus_resources(&pci_root_buses);
307 pcibios_allocate_resources(0); 229 pcibios_allocate_resources(0);
308 pcibios_allocate_resources(1); 230 pcibios_allocate_resources(1);
231
232 e820_reserve_resources_late();
309} 233}
310 234
311/** 235/**