summaryrefslogtreecommitdiffstats
path: root/patches/boot_time_opt_guest/0106-pci-probe.patch
diff options
context:
space:
mode:
Diffstat (limited to 'patches/boot_time_opt_guest/0106-pci-probe.patch')
-rw-r--r--patches/boot_time_opt_guest/0106-pci-probe.patch123
1 files changed, 123 insertions, 0 deletions
diff --git a/patches/boot_time_opt_guest/0106-pci-probe.patch b/patches/boot_time_opt_guest/0106-pci-probe.patch
new file mode 100644
index 0000000..5045926
--- /dev/null
+++ b/patches/boot_time_opt_guest/0106-pci-probe.patch
@@ -0,0 +1,123 @@
1From b225caf8f743b9f5f9e84d0df711ee0c17e049ae Mon Sep 17 00:00:00 2001
2From: Arjan van de Ven <arjan@linux.intel.com>
3Date: Wed, 11 Feb 2015 16:53:08 -0600
4Subject: [PATCH 106/114] pci: probe
5
6Author: Arjan van de Ven <arjan@linux.intel.com>
7
8Signed-off-by: Miguel Bernal Marin <miguel.bernal.marin@linux.intel.com>
9---
10 drivers/pci/probe.c | 43 ++++++++++++++++++++++++++++++++++++++++---
11 1 file changed, 40 insertions(+), 3 deletions(-)
12
13diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c
14index 204960e70333..7399a06698da 100644
15--- a/drivers/pci/probe.c
16+++ b/drivers/pci/probe.c
17@@ -182,6 +182,10 @@ int __pci_read_base(struct pci_dev *dev, enum pci_bar_type type,
18
19 mask = type ? PCI_ROM_ADDRESS_MASK : ~0;
20
21+ res->name = pci_name(dev);
22+
23+ printk("clr: Starting probe for %s\n", res->name);
24+
25 /* No printks while decoding is disabled! */
26 if (!dev->mmio_always_on) {
27 pci_read_config_word(dev, PCI_COMMAND, &orig_cmd);
28@@ -191,8 +195,6 @@ int __pci_read_base(struct pci_dev *dev, enum pci_bar_type type,
29 }
30 }
31
32- res->name = pci_name(dev);
33-
34 pci_read_config_dword(dev, pos, &l);
35 pci_write_config_dword(dev, pos, l | mask);
36 pci_read_config_dword(dev, pos, &sz);
37@@ -324,6 +326,8 @@ static void pci_read_bases(struct pci_dev *dev, unsigned int howmany, int rom)
38 if (dev->non_compliant_bars)
39 return;
40
41+ printk("clr: pci_read_bases start\n");
42+
43 for (pos = 0; pos < howmany; pos++) {
44 struct resource *res = &dev->resource[pos];
45 reg = PCI_BASE_ADDRESS_0 + (pos << 2);
46@@ -332,11 +336,13 @@ static void pci_read_bases(struct pci_dev *dev, unsigned int howmany, int rom)
47
48 if (rom) {
49 struct resource *res = &dev->resource[PCI_ROM_RESOURCE];
50+ printk("clr: rom path\n");
51 dev->rom_base_reg = rom;
52 res->flags = IORESOURCE_MEM | IORESOURCE_PREFETCH |
53 IORESOURCE_READONLY | IORESOURCE_SIZEALIGN;
54 __pci_read_base(dev, pci_bar_mem32, res, rom);
55 }
56+ printk("clr: pci_read_bases end\n");
57 }
58
59 static void pci_read_bridge_io(struct pci_bus *child)
60@@ -1311,6 +1317,28 @@ static void pci_msi_setup_pci_dev(struct pci_dev *dev)
61 pci_msix_clear_and_set_ctrl(dev, PCI_MSIX_FLAGS_ENABLE, 0);
62 }
63
64+static int guess_bar_count(int class)
65+{
66+ if (class == 0x068000)
67+ return 0;
68+ if (class == 0x020000)
69+ return 2;
70+ if (class == 0x010000)
71+ return 2;
72+ if (class == 0x00ff00)
73+ return 1;
74+ return 6;
75+}
76+
77+static int has_rom(int class, int rom)
78+{
79+ if (class == 0x020000)
80+ return 0;
81+ if (class == 0x010000 || class == 0x00ff00)
82+ return 0;
83+ return rom;
84+}
85+
86 /**
87 * pci_setup_device - fill in class and map information of a device
88 * @dev: the device structure to fill
89@@ -1329,6 +1357,9 @@ int pci_setup_device(struct pci_dev *dev)
90 int pos = 0;
91 struct pci_bus_region region;
92 struct resource *res;
93+ int maxbar;
94+
95+ printk("clr: pci_setup_device start\n");
96
97 if (pci_read_config_byte(dev, PCI_HEADER_TYPE, &hdr_type))
98 return -EIO;
99@@ -1383,7 +1414,11 @@ int pci_setup_device(struct pci_dev *dev)
100 if (class == PCI_CLASS_BRIDGE_PCI)
101 goto bad;
102 pci_read_irq(dev);
103- pci_read_bases(dev, 6, PCI_ROM_ADDRESS);
104+
105+ maxbar = guess_bar_count(dev->class);
106+
107+ if (class != PCI_CLASS_STORAGE_IDE)
108+ pci_read_bases(dev, maxbar, has_rom(dev->class, PCI_ROM_ADDRESS));
109 pci_read_config_word(dev, PCI_SUBSYSTEM_VENDOR_ID, &dev->subsystem_vendor);
110 pci_read_config_word(dev, PCI_SUBSYSTEM_ID, &dev->subsystem_device);
111
112@@ -1468,6 +1503,8 @@ int pci_setup_device(struct pci_dev *dev)
113 dev->class = PCI_CLASS_NOT_DEFINED << 8;
114 }
115
116+ printk("clr: pci_setup_device end\n");
117+
118 /* We found a fine healthy device, go go go... */
119 return 0;
120 }
121--
1222.11.1
123