diff options
| author | Bjorn Helgaas <bjorn.helgaas@hp.com> | 2009-10-27 15:26:47 -0400 |
|---|---|---|
| committer | Jesse Barnes <jbarnes@virtuousgeek.org> | 2009-11-04 16:06:41 -0500 |
| commit | c7dabef8a2c59e6a3de9d66fc35fb6a43ef7172d (patch) | |
| tree | 0f8b0021e693a0e380ef9026083b59d0909dffc6 /drivers/pci/setup-bus.c | |
| parent | 4fd8bdc567e70c02fab7eeaaa7d2a64232add789 (diff) | |
vsprintf: use %pR, %pr instead of %pRt, %pRf
Jesse accidentally applied v1 [1] of the patchset instead of v2 [2]. This
is the diff between v1 and v2.
The changes in this patch are:
- tidied vsprintf stack buffer to shrink and compute size more
accurately
- use %pR for decoding and %pr for "raw" (with type and flags) instead
of adding %pRt and %pRf
[1] http://lkml.org/lkml/2009/10/6/491
[2] http://lkml.org/lkml/2009/10/13/441
Signed-off-by: Bjorn Helgaas <bjorn.helgaas@hp.com>
Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
Diffstat (limited to 'drivers/pci/setup-bus.c')
| -rw-r--r-- | drivers/pci/setup-bus.c | 79 |
1 files changed, 36 insertions, 43 deletions
diff --git a/drivers/pci/setup-bus.c b/drivers/pci/setup-bus.c index ceb75333862b..ed6916bac675 100644 --- a/drivers/pci/setup-bus.c +++ b/drivers/pci/setup-bus.c | |||
| @@ -71,53 +71,50 @@ static void pbus_assign_resources_sorted(const struct pci_bus *bus) | |||
| 71 | void pci_setup_cardbus(struct pci_bus *bus) | 71 | void pci_setup_cardbus(struct pci_bus *bus) |
| 72 | { | 72 | { |
| 73 | struct pci_dev *bridge = bus->self; | 73 | struct pci_dev *bridge = bus->self; |
| 74 | struct resource *res; | ||
| 74 | struct pci_bus_region region; | 75 | struct pci_bus_region region; |
| 75 | 76 | ||
| 76 | dev_info(&bridge->dev, "CardBus bridge, secondary bus %04x:%02x\n", | 77 | dev_info(&bridge->dev, "CardBus bridge, secondary bus %04x:%02x\n", |
| 77 | pci_domain_nr(bus), bus->number); | 78 | pci_domain_nr(bus), bus->number); |
| 78 | 79 | ||
| 79 | pcibios_resource_to_bus(bridge, ®ion, bus->resource[0]); | 80 | res = bus->resource[0]; |
| 80 | if (bus->resource[0]->flags & IORESOURCE_IO) { | 81 | pcibios_resource_to_bus(bridge, ®ion, res); |
| 82 | if (res->flags & IORESOURCE_IO) { | ||
| 81 | /* | 83 | /* |
| 82 | * The IO resource is allocated a range twice as large as it | 84 | * The IO resource is allocated a range twice as large as it |
| 83 | * would normally need. This allows us to set both IO regs. | 85 | * would normally need. This allows us to set both IO regs. |
| 84 | */ | 86 | */ |
| 85 | dev_info(&bridge->dev, " IO window: %#08lx-%#08lx\n", | 87 | dev_info(&bridge->dev, " bridge window %pR\n", res); |
| 86 | (unsigned long)region.start, | ||
| 87 | (unsigned long)region.end); | ||
| 88 | pci_write_config_dword(bridge, PCI_CB_IO_BASE_0, | 88 | pci_write_config_dword(bridge, PCI_CB_IO_BASE_0, |
| 89 | region.start); | 89 | region.start); |
| 90 | pci_write_config_dword(bridge, PCI_CB_IO_LIMIT_0, | 90 | pci_write_config_dword(bridge, PCI_CB_IO_LIMIT_0, |
| 91 | region.end); | 91 | region.end); |
| 92 | } | 92 | } |
| 93 | 93 | ||
| 94 | pcibios_resource_to_bus(bridge, ®ion, bus->resource[1]); | 94 | res = bus->resource[1]; |
| 95 | if (bus->resource[1]->flags & IORESOURCE_IO) { | 95 | pcibios_resource_to_bus(bridge, ®ion, res); |
| 96 | dev_info(&bridge->dev, " IO window: %#08lx-%#08lx\n", | 96 | if (res->flags & IORESOURCE_IO) { |
| 97 | (unsigned long)region.start, | 97 | dev_info(&bridge->dev, " bridge window %pR\n", res); |
| 98 | (unsigned long)region.end); | ||
| 99 | pci_write_config_dword(bridge, PCI_CB_IO_BASE_1, | 98 | pci_write_config_dword(bridge, PCI_CB_IO_BASE_1, |
| 100 | region.start); | 99 | region.start); |
| 101 | pci_write_config_dword(bridge, PCI_CB_IO_LIMIT_1, | 100 | pci_write_config_dword(bridge, PCI_CB_IO_LIMIT_1, |
| 102 | region.end); | 101 | region.end); |
| 103 | } | 102 | } |
| 104 | 103 | ||
| 105 | pcibios_resource_to_bus(bridge, ®ion, bus->resource[2]); | 104 | res = bus->resource[2]; |
| 106 | if (bus->resource[2]->flags & IORESOURCE_MEM) { | 105 | pcibios_resource_to_bus(bridge, ®ion, res); |
| 107 | dev_info(&bridge->dev, " PREFETCH window: %#08lx-%#08lx\n", | 106 | if (res->flags & IORESOURCE_MEM) { |
| 108 | (unsigned long)region.start, | 107 | dev_info(&bridge->dev, " bridge window %pR\n", res); |
| 109 | (unsigned long)region.end); | ||
| 110 | pci_write_config_dword(bridge, PCI_CB_MEMORY_BASE_0, | 108 | pci_write_config_dword(bridge, PCI_CB_MEMORY_BASE_0, |
| 111 | region.start); | 109 | region.start); |
| 112 | pci_write_config_dword(bridge, PCI_CB_MEMORY_LIMIT_0, | 110 | pci_write_config_dword(bridge, PCI_CB_MEMORY_LIMIT_0, |
| 113 | region.end); | 111 | region.end); |
| 114 | } | 112 | } |
| 115 | 113 | ||
| 116 | pcibios_resource_to_bus(bridge, ®ion, bus->resource[3]); | 114 | res = bus->resource[3]; |
| 117 | if (bus->resource[3]->flags & IORESOURCE_MEM) { | 115 | pcibios_resource_to_bus(bridge, ®ion, res); |
| 118 | dev_info(&bridge->dev, " MEM window: %#08lx-%#08lx\n", | 116 | if (res->flags & IORESOURCE_MEM) { |
| 119 | (unsigned long)region.start, | 117 | dev_info(&bridge->dev, " bridge window %pR\n", res); |
| 120 | (unsigned long)region.end); | ||
| 121 | pci_write_config_dword(bridge, PCI_CB_MEMORY_BASE_1, | 118 | pci_write_config_dword(bridge, PCI_CB_MEMORY_BASE_1, |
| 122 | region.start); | 119 | region.start); |
| 123 | pci_write_config_dword(bridge, PCI_CB_MEMORY_LIMIT_1, | 120 | pci_write_config_dword(bridge, PCI_CB_MEMORY_LIMIT_1, |
| @@ -140,6 +137,7 @@ EXPORT_SYMBOL(pci_setup_cardbus); | |||
| 140 | static void pci_setup_bridge(struct pci_bus *bus) | 137 | static void pci_setup_bridge(struct pci_bus *bus) |
| 141 | { | 138 | { |
| 142 | struct pci_dev *bridge = bus->self; | 139 | struct pci_dev *bridge = bus->self; |
| 140 | struct resource *res; | ||
| 143 | struct pci_bus_region region; | 141 | struct pci_bus_region region; |
| 144 | u32 l, bu, lu, io_upper16; | 142 | u32 l, bu, lu, io_upper16; |
| 145 | int pref_mem64; | 143 | int pref_mem64; |
| @@ -151,23 +149,22 @@ static void pci_setup_bridge(struct pci_bus *bus) | |||
| 151 | pci_domain_nr(bus), bus->number); | 149 | pci_domain_nr(bus), bus->number); |
| 152 | 150 | ||
| 153 | /* Set up the top and bottom of the PCI I/O segment for this bus. */ | 151 | /* Set up the top and bottom of the PCI I/O segment for this bus. */ |
| 154 | pcibios_resource_to_bus(bridge, ®ion, bus->resource[0]); | 152 | res = bus->resource[0]; |
| 155 | if (bus->resource[0]->flags & IORESOURCE_IO) { | 153 | pcibios_resource_to_bus(bridge, ®ion, res); |
| 154 | if (res->flags & IORESOURCE_IO) { | ||
| 156 | pci_read_config_dword(bridge, PCI_IO_BASE, &l); | 155 | pci_read_config_dword(bridge, PCI_IO_BASE, &l); |
| 157 | l &= 0xffff0000; | 156 | l &= 0xffff0000; |
| 158 | l |= (region.start >> 8) & 0x00f0; | 157 | l |= (region.start >> 8) & 0x00f0; |
| 159 | l |= region.end & 0xf000; | 158 | l |= region.end & 0xf000; |
| 160 | /* Set up upper 16 bits of I/O base/limit. */ | 159 | /* Set up upper 16 bits of I/O base/limit. */ |
| 161 | io_upper16 = (region.end & 0xffff0000) | (region.start >> 16); | 160 | io_upper16 = (region.end & 0xffff0000) | (region.start >> 16); |
| 162 | dev_info(&bridge->dev, " IO window: %#04lx-%#04lx\n", | 161 | dev_info(&bridge->dev, " bridge window %pR\n", res); |
| 163 | (unsigned long)region.start, | ||
| 164 | (unsigned long)region.end); | ||
| 165 | } | 162 | } |
| 166 | else { | 163 | else { |
| 167 | /* Clear upper 16 bits of I/O base/limit. */ | 164 | /* Clear upper 16 bits of I/O base/limit. */ |
| 168 | io_upper16 = 0; | 165 | io_upper16 = 0; |
| 169 | l = 0x00f0; | 166 | l = 0x00f0; |
| 170 | dev_info(&bridge->dev, " IO window: disabled\n"); | 167 | dev_info(&bridge->dev, " bridge window [io disabled]\n"); |
| 171 | } | 168 | } |
| 172 | /* Temporarily disable the I/O range before updating PCI_IO_BASE. */ | 169 | /* Temporarily disable the I/O range before updating PCI_IO_BASE. */ |
| 173 | pci_write_config_dword(bridge, PCI_IO_BASE_UPPER16, 0x0000ffff); | 170 | pci_write_config_dword(bridge, PCI_IO_BASE_UPPER16, 0x0000ffff); |
| @@ -178,17 +175,16 @@ static void pci_setup_bridge(struct pci_bus *bus) | |||
| 178 | 175 | ||
| 179 | /* Set up the top and bottom of the PCI Memory segment | 176 | /* Set up the top and bottom of the PCI Memory segment |
| 180 | for this bus. */ | 177 | for this bus. */ |
| 181 | pcibios_resource_to_bus(bridge, ®ion, bus->resource[1]); | 178 | res = bus->resource[1]; |
| 182 | if (bus->resource[1]->flags & IORESOURCE_MEM) { | 179 | pcibios_resource_to_bus(bridge, ®ion, res); |
| 180 | if (res->flags & IORESOURCE_MEM) { | ||
| 183 | l = (region.start >> 16) & 0xfff0; | 181 | l = (region.start >> 16) & 0xfff0; |
| 184 | l |= region.end & 0xfff00000; | 182 | l |= region.end & 0xfff00000; |
| 185 | dev_info(&bridge->dev, " MEM window: %#08lx-%#08lx\n", | 183 | dev_info(&bridge->dev, " bridge window %pR\n", res); |
| 186 | (unsigned long)region.start, | ||
| 187 | (unsigned long)region.end); | ||
| 188 | } | 184 | } |
| 189 | else { | 185 | else { |
| 190 | l = 0x0000fff0; | 186 | l = 0x0000fff0; |
| 191 | dev_info(&bridge->dev, " MEM window: disabled\n"); | 187 | dev_info(&bridge->dev, " bridge window [mem disabled]\n"); |
| 192 | } | 188 | } |
| 193 | pci_write_config_dword(bridge, PCI_MEMORY_BASE, l); | 189 | pci_write_config_dword(bridge, PCI_MEMORY_BASE, l); |
| 194 | 190 | ||
| @@ -200,24 +196,21 @@ static void pci_setup_bridge(struct pci_bus *bus) | |||
| 200 | /* Set up PREF base/limit. */ | 196 | /* Set up PREF base/limit. */ |
| 201 | pref_mem64 = 0; | 197 | pref_mem64 = 0; |
| 202 | bu = lu = 0; | 198 | bu = lu = 0; |
| 203 | pcibios_resource_to_bus(bridge, ®ion, bus->resource[2]); | 199 | res = bus->resource[2]; |
| 204 | if (bus->resource[2]->flags & IORESOURCE_PREFETCH) { | 200 | pcibios_resource_to_bus(bridge, ®ion, res); |
| 205 | int width = 8; | 201 | if (res->flags & IORESOURCE_PREFETCH) { |
| 206 | l = (region.start >> 16) & 0xfff0; | 202 | l = (region.start >> 16) & 0xfff0; |
| 207 | l |= region.end & 0xfff00000; | 203 | l |= region.end & 0xfff00000; |
| 208 | if (bus->resource[2]->flags & IORESOURCE_MEM_64) { | 204 | if (res->flags & IORESOURCE_MEM_64) { |
| 209 | pref_mem64 = 1; | 205 | pref_mem64 = 1; |
| 210 | bu = upper_32_bits(region.start); | 206 | bu = upper_32_bits(region.start); |
| 211 | lu = upper_32_bits(region.end); | 207 | lu = upper_32_bits(region.end); |
| 212 | width = 16; | ||
| 213 | } | 208 | } |
| 214 | dev_info(&bridge->dev, " PREFETCH window: %#0*llx-%#0*llx\n", | 209 | dev_info(&bridge->dev, " bridge window %pR\n", res); |
| 215 | width, (unsigned long long)region.start, | ||
| 216 | width, (unsigned long long)region.end); | ||
| 217 | } | 210 | } |
| 218 | else { | 211 | else { |
| 219 | l = 0x0000fff0; | 212 | l = 0x0000fff0; |
| 220 | dev_info(&bridge->dev, " PREFETCH window: disabled\n"); | 213 | dev_info(&bridge->dev, " bridge window [mem pref disabled]\n"); |
| 221 | } | 214 | } |
| 222 | pci_write_config_dword(bridge, PCI_PREF_MEMORY_BASE, l); | 215 | pci_write_config_dword(bridge, PCI_PREF_MEMORY_BASE, l); |
| 223 | 216 | ||
| @@ -391,7 +384,7 @@ static int pbus_size_mem(struct pci_bus *bus, unsigned long mask, | |||
| 391 | order = __ffs(align) - 20; | 384 | order = __ffs(align) - 20; |
| 392 | if (order > 11) { | 385 | if (order > 11) { |
| 393 | dev_warn(&dev->dev, "BAR %d: bad alignment %llx: " | 386 | dev_warn(&dev->dev, "BAR %d: bad alignment %llx: " |
| 394 | "%pRt\n", i, (unsigned long long)align, r); | 387 | "%pR\n", i, (unsigned long long)align, r); |
| 395 | r->flags = 0; | 388 | r->flags = 0; |
| 396 | continue; | 389 | continue; |
| 397 | } | 390 | } |
| @@ -582,7 +575,7 @@ static void pci_bus_dump_res(struct pci_bus *bus) | |||
| 582 | if (!res || !res->end) | 575 | if (!res || !res->end) |
| 583 | continue; | 576 | continue; |
| 584 | 577 | ||
| 585 | dev_printk(KERN_DEBUG, &bus->dev, "resource %d %pRt\n", i, res); | 578 | dev_printk(KERN_DEBUG, &bus->dev, "resource %d %pR\n", i, res); |
| 586 | } | 579 | } |
| 587 | } | 580 | } |
| 588 | 581 | ||
