Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | /* |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2 | * Copyright (C) 2001 Allan Trautman, IBM Corporation |
Stephen Rothwell | 1dee202 | 2007-12-07 16:10:22 +1100 | [diff] [blame^] | 3 | * Copyright (C) 2005,2007 Stephen Rothwell, IBM Corp |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4 | * |
| 5 | * iSeries specific routines for PCI. |
Stephen Rothwell | d387899 | 2005-09-28 02:50:25 +1000 | [diff] [blame] | 6 | * |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7 | * Based on code from pci.c and iSeries_pci.c 32bit |
| 8 | * |
| 9 | * This program is free software; you can redistribute it and/or modify |
| 10 | * it under the terms of the GNU General Public License as published by |
| 11 | * the Free Software Foundation; either version 2 of the License, or |
| 12 | * (at your option) any later version. |
Stephen Rothwell | d387899 | 2005-09-28 02:50:25 +1000 | [diff] [blame] | 13 | * |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 14 | * This program is distributed in the hope that it will be useful, |
| 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 17 | * GNU General Public License for more details. |
Stephen Rothwell | d387899 | 2005-09-28 02:50:25 +1000 | [diff] [blame] | 18 | * |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 19 | * You should have received a copy of the GNU General Public License |
| 20 | * along with this program; if not, write to the Free Software |
| 21 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
| 22 | */ |
| 23 | #include <linux/kernel.h> |
Stephen Rothwell | d387899 | 2005-09-28 02:50:25 +1000 | [diff] [blame] | 24 | #include <linux/list.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 25 | #include <linux/string.h> |
| 26 | #include <linux/init.h> |
| 27 | #include <linux/module.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 28 | #include <linux/pci.h> |
| 29 | |
Stephen Rothwell | 1dee202 | 2007-12-07 16:10:22 +1100 | [diff] [blame^] | 30 | #include <asm/types.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 31 | #include <asm/io.h> |
| 32 | #include <asm/irq.h> |
| 33 | #include <asm/prom.h> |
| 34 | #include <asm/machdep.h> |
| 35 | #include <asm/pci-bridge.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 36 | #include <asm/iommu.h> |
Stephen Rothwell | 426c1a1 | 2005-10-14 14:51:42 +1000 | [diff] [blame] | 37 | #include <asm/abs_addr.h> |
Stephen Rothwell | caf8132 | 2006-09-21 18:00:00 +1000 | [diff] [blame] | 38 | #include <asm/firmware.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 39 | |
Stephen Rothwell | 1dee202 | 2007-12-07 16:10:22 +1100 | [diff] [blame^] | 40 | #include <asm/iseries/hv_types.h> |
Kelly Daly | 8021b8a | 2005-11-02 11:41:12 +1100 | [diff] [blame] | 41 | #include <asm/iseries/hv_call_xm.h> |
Kelly Daly | bbc8b62 | 2005-11-02 15:10:38 +1100 | [diff] [blame] | 42 | #include <asm/iseries/mf.h> |
Stephen Rothwell | c7f0e8c | 2006-04-27 17:23:32 +1000 | [diff] [blame] | 43 | #include <asm/iseries/iommu.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 44 | |
Stephen Rothwell | d387899 | 2005-09-28 02:50:25 +1000 | [diff] [blame] | 45 | #include <asm/ppc-pci.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 46 | |
Stephen Rothwell | b08567cb | 2005-09-28 23:37:01 +1000 | [diff] [blame] | 47 | #include "irq.h" |
Stephen Rothwell | 426c1a1 | 2005-10-14 14:51:42 +1000 | [diff] [blame] | 48 | #include "pci.h" |
Stephen Rothwell | c6d2ea9 | 2005-10-14 17:16:17 +1000 | [diff] [blame] | 49 | #include "call_pci.h" |
Stephen Rothwell | b08567cb | 2005-09-28 23:37:01 +1000 | [diff] [blame] | 50 | |
Stephen Rothwell | b9b1812 | 2007-12-07 01:48:14 +1100 | [diff] [blame] | 51 | #define PCI_RETRY_MAX 3 |
| 52 | static int limit_pci_retries = 1; /* Set Retry Error on. */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 53 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 54 | /* |
| 55 | * Table defines |
| 56 | * Each Entry size is 4 MB * 1024 Entries = 4GB I/O address space. |
| 57 | */ |
| 58 | #define IOMM_TABLE_MAX_ENTRIES 1024 |
| 59 | #define IOMM_TABLE_ENTRY_SIZE 0x0000000000400000UL |
| 60 | #define BASE_IO_MEMORY 0xE000000000000000UL |
| 61 | |
Stephen Rothwell | b58b7f9 | 2006-05-19 16:42:49 +1000 | [diff] [blame] | 62 | static unsigned long max_io_memory = BASE_IO_MEMORY; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 63 | static long current_iomm_table_entry; |
| 64 | |
| 65 | /* |
| 66 | * Lookup Tables. |
| 67 | */ |
Stephen Rothwell | b58b7f9 | 2006-05-19 16:42:49 +1000 | [diff] [blame] | 68 | static struct device_node *iomm_table[IOMM_TABLE_MAX_ENTRIES]; |
| 69 | static u8 iobar_table[IOMM_TABLE_MAX_ENTRIES]; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 70 | |
Stephen Rothwell | b58b7f9 | 2006-05-19 16:42:49 +1000 | [diff] [blame] | 71 | static const char pci_io_text[] = "iSeries PCI I/O"; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 72 | static DEFINE_SPINLOCK(iomm_table_lock); |
| 73 | |
| 74 | /* |
Stephen Rothwell | 2cd1008 | 2007-12-07 01:55:50 +1100 | [diff] [blame] | 75 | * Generate a Direct Select Address for the Hypervisor |
| 76 | */ |
| 77 | static inline u64 iseries_ds_addr(struct device_node *node) |
| 78 | { |
| 79 | struct pci_dn *pdn = PCI_DN(node); |
| 80 | |
| 81 | return ((u64)pdn->busno << 48) + ((u64)pdn->bussubno << 40) |
| 82 | + ((u64)0x10 << 32); |
| 83 | } |
| 84 | |
| 85 | /* |
Stephen Rothwell | 1dee202 | 2007-12-07 16:10:22 +1100 | [diff] [blame^] | 86 | * Size of Bus VPD data |
| 87 | */ |
| 88 | #define BUS_VPDSIZE 1024 |
| 89 | |
| 90 | /* |
| 91 | * Bus Vpd Tags |
| 92 | */ |
| 93 | #define VPD_END_OF_AREA 0x79 |
| 94 | #define VPD_ID_STRING 0x82 |
| 95 | #define VPD_VENDOR_AREA 0x84 |
| 96 | |
| 97 | /* |
| 98 | * Mfg Area Tags |
| 99 | */ |
| 100 | #define VPD_FRU_FRAME_ID 0x4649 /* "FI" */ |
| 101 | #define VPD_SLOT_MAP_FORMAT 0x4D46 /* "MF" */ |
| 102 | #define VPD_SLOT_MAP 0x534D /* "SM" */ |
| 103 | |
| 104 | /* |
| 105 | * Structures of the areas |
| 106 | */ |
| 107 | struct mfg_vpd_area { |
| 108 | u16 tag; |
| 109 | u8 length; |
| 110 | u8 data1; |
| 111 | u8 data2; |
| 112 | }; |
| 113 | #define MFG_ENTRY_SIZE 3 |
| 114 | |
| 115 | struct slot_map { |
| 116 | u8 agent; |
| 117 | u8 secondary_agent; |
| 118 | u8 phb; |
| 119 | char card_location[3]; |
| 120 | char parms[8]; |
| 121 | char reserved[2]; |
| 122 | }; |
| 123 | #define SLOT_ENTRY_SIZE 16 |
| 124 | |
| 125 | /* |
| 126 | * Parse the Slot Area |
| 127 | */ |
| 128 | static void __init iseries_parse_slot_area(struct slot_map *map, int len, |
| 129 | HvAgentId agent, u8 *phb, char card[4]) |
| 130 | { |
| 131 | /* |
| 132 | * Parse Slot label until we find the one requested |
| 133 | */ |
| 134 | while (len > 0) { |
| 135 | if (map->agent == agent) { |
| 136 | /* |
| 137 | * If Phb wasn't found, grab the entry first one found. |
| 138 | */ |
| 139 | if (*phb == 0xff) |
| 140 | *phb = map->phb; |
| 141 | /* Found it, extract the data. */ |
| 142 | if (map->phb == *phb) { |
| 143 | memcpy(card, &map->card_location, 3); |
| 144 | card[3] = 0; |
| 145 | break; |
| 146 | } |
| 147 | } |
| 148 | /* Point to the next Slot */ |
| 149 | map = (struct slot_map *)((char *)map + SLOT_ENTRY_SIZE); |
| 150 | len -= SLOT_ENTRY_SIZE; |
| 151 | } |
| 152 | } |
| 153 | |
| 154 | /* |
| 155 | * Parse the Mfg Area |
| 156 | */ |
| 157 | static void __init iseries_parse_mfg_area(struct mfg_vpd_area *area, int len, |
| 158 | HvAgentId agent, u8 *phb, u8 *frame, char card[4]) |
| 159 | { |
| 160 | u16 slot_map_fmt = 0; |
| 161 | |
| 162 | /* Parse Mfg Data */ |
| 163 | while (len > 0) { |
| 164 | int mfg_tag_len = area->length; |
| 165 | /* Frame ID (FI 4649020310 ) */ |
| 166 | if (area->tag == VPD_FRU_FRAME_ID) |
| 167 | *frame = area->data1; |
| 168 | /* Slot Map Format (MF 4D46020004 ) */ |
| 169 | else if (area->tag == VPD_SLOT_MAP_FORMAT) |
| 170 | slot_map_fmt = (area->data1 * 256) |
| 171 | + area->data2; |
| 172 | /* Slot Map (SM 534D90 */ |
| 173 | else if (area->tag == VPD_SLOT_MAP) { |
| 174 | struct slot_map *slot_map; |
| 175 | |
| 176 | if (slot_map_fmt == 0x1004) |
| 177 | slot_map = (struct slot_map *)((char *)area |
| 178 | + MFG_ENTRY_SIZE + 1); |
| 179 | else |
| 180 | slot_map = (struct slot_map *)((char *)area |
| 181 | + MFG_ENTRY_SIZE); |
| 182 | iseries_parse_slot_area(slot_map, mfg_tag_len, |
| 183 | agent, phb, card); |
| 184 | } |
| 185 | /* |
| 186 | * Point to the next Mfg Area |
| 187 | * Use defined size, sizeof give wrong answer |
| 188 | */ |
| 189 | area = (struct mfg_vpd_area *)((char *)area + mfg_tag_len |
| 190 | + MFG_ENTRY_SIZE); |
| 191 | len -= (mfg_tag_len + MFG_ENTRY_SIZE); |
| 192 | } |
| 193 | } |
| 194 | |
| 195 | /* |
| 196 | * Look for "BUS".. Data is not Null terminated. |
| 197 | * PHBID of 0xFF indicates PHB was not found in VPD Data. |
| 198 | */ |
| 199 | static u8 __init iseries_parse_phbid(u8 *area, int len) |
| 200 | { |
| 201 | while (len > 0) { |
| 202 | if ((*area == 'B') && (*(area + 1) == 'U') |
| 203 | && (*(area + 2) == 'S')) { |
| 204 | area += 3; |
| 205 | while (*area == ' ') |
| 206 | area++; |
| 207 | return *area & 0x0F; |
| 208 | } |
| 209 | area++; |
| 210 | len--; |
| 211 | } |
| 212 | return 0xff; |
| 213 | } |
| 214 | |
| 215 | /* |
| 216 | * Parse out the VPD Areas |
| 217 | */ |
| 218 | static void __init iseries_parse_vpd(u8 *data, int data_len, |
| 219 | HvAgentId agent, u8 *frame, char card[4]) |
| 220 | { |
| 221 | u8 phb = 0xff; |
| 222 | |
| 223 | while (data_len > 0) { |
| 224 | int len; |
| 225 | u8 tag = *data; |
| 226 | |
| 227 | if (tag == VPD_END_OF_AREA) |
| 228 | break; |
| 229 | len = *(data + 1) + (*(data + 2) * 256); |
| 230 | data += 3; |
| 231 | data_len -= 3; |
| 232 | if (tag == VPD_ID_STRING) |
| 233 | phb = iseries_parse_phbid(data, len); |
| 234 | else if (tag == VPD_VENDOR_AREA) |
| 235 | iseries_parse_mfg_area((struct mfg_vpd_area *)data, len, |
| 236 | agent, &phb, frame, card); |
| 237 | /* Point to next Area. */ |
| 238 | data += len; |
| 239 | data_len -= len; |
| 240 | } |
| 241 | } |
| 242 | |
| 243 | static int __init iseries_get_location_code(u16 bus, HvAgentId agent, |
| 244 | u8 *frame, char card[4]) |
| 245 | { |
| 246 | int status = 0; |
| 247 | int bus_vpd_len = 0; |
| 248 | u8 *bus_vpd = kmalloc(BUS_VPDSIZE, GFP_KERNEL); |
| 249 | |
| 250 | if (bus_vpd == NULL) { |
| 251 | printk("PCI: Bus VPD Buffer allocation failure.\n"); |
| 252 | return 0; |
| 253 | } |
| 254 | bus_vpd_len = HvCallPci_getBusVpd(bus, iseries_hv_addr(bus_vpd), |
| 255 | BUS_VPDSIZE); |
| 256 | if (bus_vpd_len == 0) { |
| 257 | printk("PCI: Bus VPD Buffer zero length.\n"); |
| 258 | goto out_free; |
| 259 | } |
| 260 | /* printk("PCI: bus_vpd: %p, %d\n",bus_vpd, bus_vpd_len); */ |
| 261 | /* Make sure this is what I think it is */ |
| 262 | if (*bus_vpd != VPD_ID_STRING) { |
| 263 | printk("PCI: Bus VPD Buffer missing starting tag.\n"); |
| 264 | goto out_free; |
| 265 | } |
| 266 | iseries_parse_vpd(bus_vpd, bus_vpd_len, agent, frame, card); |
| 267 | status = 1; |
| 268 | out_free: |
| 269 | kfree(bus_vpd); |
| 270 | return status; |
| 271 | } |
| 272 | |
| 273 | /* |
| 274 | * Prints the device information. |
| 275 | * - Pass in pci_dev* pointer to the device. |
| 276 | * - Pass in the device count |
| 277 | * |
| 278 | * Format: |
| 279 | * PCI: Bus 0, Device 26, Vendor 0x12AE Frame 1, Card C10 Ethernet |
| 280 | * controller |
| 281 | */ |
| 282 | static void __init iseries_device_information(struct pci_dev *pdev, int count, |
| 283 | u16 bus, HvSubBusNumber subbus) |
| 284 | { |
| 285 | u8 frame = 0; |
| 286 | char card[4]; |
| 287 | HvAgentId agent; |
| 288 | |
| 289 | agent = ISERIES_PCI_AGENTID(ISERIES_GET_DEVICE_FROM_SUBBUS(subbus), |
| 290 | ISERIES_GET_FUNCTION_FROM_SUBBUS(subbus)); |
| 291 | |
| 292 | if (iseries_get_location_code(bus, agent, &frame, card)) { |
| 293 | printk("%d. PCI: Bus%3d, Device%3d, Vendor %04X Frame%3d, " |
| 294 | "Card %4s 0x%04X\n", count, bus, |
| 295 | PCI_SLOT(pdev->devfn), pdev->vendor, frame, |
| 296 | card, (int)(pdev->class >> 8)); |
| 297 | } |
| 298 | } |
| 299 | |
| 300 | /* |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 301 | * iomm_table_allocate_entry |
| 302 | * |
| 303 | * Adds pci_dev entry in address translation table |
| 304 | * |
| 305 | * - Allocates the number of entries required in table base on BAR |
| 306 | * size. |
| 307 | * - Allocates starting at BASE_IO_MEMORY and increases. |
| 308 | * - The size is round up to be a multiple of entry size. |
| 309 | * - CurrentIndex is incremented to keep track of the last entry. |
| 310 | * - Builds the resource entry for allocated BARs. |
| 311 | */ |
Stephen Rothwell | 1e10590 | 2007-11-19 17:03:59 +1100 | [diff] [blame] | 312 | static void __init iomm_table_allocate_entry(struct pci_dev *dev, int bar_num) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 313 | { |
| 314 | struct resource *bar_res = &dev->resource[bar_num]; |
| 315 | long bar_size = pci_resource_len(dev, bar_num); |
| 316 | |
| 317 | /* |
| 318 | * No space to allocate, quick exit, skip Allocation. |
| 319 | */ |
| 320 | if (bar_size == 0) |
| 321 | return; |
| 322 | /* |
| 323 | * Set Resource values. |
| 324 | */ |
| 325 | spin_lock(&iomm_table_lock); |
| 326 | bar_res->name = pci_io_text; |
Stephen Rothwell | b58b7f9 | 2006-05-19 16:42:49 +1000 | [diff] [blame] | 327 | bar_res->start = BASE_IO_MEMORY + |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 328 | IOMM_TABLE_ENTRY_SIZE * current_iomm_table_entry; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 329 | bar_res->end = bar_res->start + bar_size - 1; |
| 330 | /* |
| 331 | * Allocate the number of table entries needed for BAR. |
| 332 | */ |
| 333 | while (bar_size > 0 ) { |
| 334 | iomm_table[current_iomm_table_entry] = dev->sysdata; |
| 335 | iobar_table[current_iomm_table_entry] = bar_num; |
| 336 | bar_size -= IOMM_TABLE_ENTRY_SIZE; |
| 337 | ++current_iomm_table_entry; |
| 338 | } |
| 339 | max_io_memory = BASE_IO_MEMORY + |
Stephen Rothwell | b58b7f9 | 2006-05-19 16:42:49 +1000 | [diff] [blame] | 340 | IOMM_TABLE_ENTRY_SIZE * current_iomm_table_entry; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 341 | spin_unlock(&iomm_table_lock); |
| 342 | } |
| 343 | |
| 344 | /* |
| 345 | * allocate_device_bars |
| 346 | * |
| 347 | * - Allocates ALL pci_dev BAR's and updates the resources with the |
| 348 | * BAR value. BARS with zero length will have the resources |
| 349 | * The HvCallPci_getBarParms is used to get the size of the BAR |
| 350 | * space. It calls iomm_table_allocate_entry to allocate |
| 351 | * each entry. |
| 352 | * - Loops through The Bar resources(0 - 5) including the ROM |
| 353 | * is resource(6). |
| 354 | */ |
Stephen Rothwell | 1e10590 | 2007-11-19 17:03:59 +1100 | [diff] [blame] | 355 | static void __init allocate_device_bars(struct pci_dev *dev) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 356 | { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 357 | int bar_num; |
| 358 | |
Stephen Rothwell | b58b7f9 | 2006-05-19 16:42:49 +1000 | [diff] [blame] | 359 | for (bar_num = 0; bar_num <= PCI_ROM_RESOURCE; ++bar_num) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 360 | iomm_table_allocate_entry(dev, bar_num); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 361 | } |
| 362 | |
| 363 | /* |
| 364 | * Log error information to system console. |
| 365 | * Filter out the device not there errors. |
| 366 | * PCI: EADs Connect Failed 0x18.58.10 Rc: 0x00xx |
| 367 | * PCI: Read Vendor Failed 0x18.58.10 Rc: 0x00xx |
| 368 | * PCI: Connect Bus Unit Failed 0x18.58.10 Rc: 0x00xx |
| 369 | */ |
Stephen Rothwell | 7a73bd7 | 2007-12-07 01:49:27 +1100 | [diff] [blame] | 370 | static void pci_log_error(char *error, int bus, int subbus, |
| 371 | int agent, int hv_res) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 372 | { |
Stephen Rothwell | 7a73bd7 | 2007-12-07 01:49:27 +1100 | [diff] [blame] | 373 | if (hv_res == 0x0302) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 374 | return; |
| 375 | printk(KERN_ERR "PCI: %s Failed: 0x%02X.%02X.%02X Rc: 0x%04X", |
Stephen Rothwell | 7a73bd7 | 2007-12-07 01:49:27 +1100 | [diff] [blame] | 376 | error, bus, subbus, agent, hv_res); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 377 | } |
| 378 | |
| 379 | /* |
Stephen Rothwell | 9103eb7 | 2007-12-07 01:46:40 +1100 | [diff] [blame] | 380 | * Look down the chain to find the matching Device Device |
| 381 | */ |
Stephen Rothwell | 7a73bd7 | 2007-12-07 01:49:27 +1100 | [diff] [blame] | 382 | static struct device_node *find_device_node(int bus, int devfn) |
Stephen Rothwell | 9103eb7 | 2007-12-07 01:46:40 +1100 | [diff] [blame] | 383 | { |
| 384 | struct device_node *node; |
| 385 | |
| 386 | for (node = NULL; (node = of_find_all_nodes(node)); ) { |
| 387 | struct pci_dn *pdn = PCI_DN(node); |
| 388 | |
| 389 | if (pdn && (bus == pdn->busno) && (devfn == pdn->devfn)) |
| 390 | return node; |
| 391 | } |
| 392 | return NULL; |
| 393 | } |
| 394 | |
| 395 | /* |
Stephen Rothwell | d387899 | 2005-09-28 02:50:25 +1000 | [diff] [blame] | 396 | * iSeries_pci_final_fixup(void) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 397 | */ |
| 398 | void __init iSeries_pci_final_fixup(void) |
| 399 | { |
| 400 | struct pci_dev *pdev = NULL; |
Stephen Rothwell | 252e75a | 2005-09-28 14:40:40 +1000 | [diff] [blame] | 401 | struct device_node *node; |
Stephen Rothwell | 7a73bd7 | 2007-12-07 01:49:27 +1100 | [diff] [blame] | 402 | int num_dev = 0; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 403 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 404 | /* Fix up at the device node and pci_dev relationship */ |
| 405 | mf_display_src(0xC9000100); |
| 406 | |
| 407 | printk("pcibios_final_fixup\n"); |
| 408 | for_each_pci_dev(pdev) { |
Stephen Rothwell | 3f17863 | 2007-12-07 01:51:48 +1100 | [diff] [blame] | 409 | const u32 *agent; |
Stephen Rothwell | 3b32c16 | 2007-12-07 01:56:55 +1100 | [diff] [blame] | 410 | const u32 *sub_bus; |
Stephen Rothwell | 5376174 | 2007-12-07 01:58:01 +1100 | [diff] [blame] | 411 | unsigned char bus = pdev->bus->number; |
Stephen Rothwell | 3f17863 | 2007-12-07 01:51:48 +1100 | [diff] [blame] | 412 | |
Stephen Rothwell | 5376174 | 2007-12-07 01:58:01 +1100 | [diff] [blame] | 413 | node = find_device_node(bus, pdev->devfn); |
| 414 | printk("pci dev %p (%x.%x), node %p\n", pdev, bus, |
| 415 | pdev->devfn, node); |
Stephen Rothwell | 3f17863 | 2007-12-07 01:51:48 +1100 | [diff] [blame] | 416 | if (!node) { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 417 | printk("PCI: Device Tree not found for 0x%016lX\n", |
| 418 | (unsigned long)pdev); |
Stephen Rothwell | 3f17863 | 2007-12-07 01:51:48 +1100 | [diff] [blame] | 419 | continue; |
| 420 | } |
| 421 | |
Stephen Rothwell | 3f17863 | 2007-12-07 01:51:48 +1100 | [diff] [blame] | 422 | agent = of_get_property(node, "linux,agent-id", NULL); |
Stephen Rothwell | 3b32c16 | 2007-12-07 01:56:55 +1100 | [diff] [blame] | 423 | sub_bus = of_get_property(node, "linux,subbus", NULL); |
Stephen Rothwell | 5376174 | 2007-12-07 01:58:01 +1100 | [diff] [blame] | 424 | if (agent && sub_bus) { |
| 425 | u8 irq = iSeries_allocate_IRQ(bus, 0, *sub_bus); |
Stephen Rothwell | 3f17863 | 2007-12-07 01:51:48 +1100 | [diff] [blame] | 426 | int err; |
| 427 | |
Stephen Rothwell | 5376174 | 2007-12-07 01:58:01 +1100 | [diff] [blame] | 428 | err = HvCallXm_connectBusUnit(bus, *sub_bus, |
Stephen Rothwell | 3f17863 | 2007-12-07 01:51:48 +1100 | [diff] [blame] | 429 | *agent, irq); |
| 430 | if (err) |
| 431 | pci_log_error("Connect Bus Unit", |
Stephen Rothwell | 5376174 | 2007-12-07 01:58:01 +1100 | [diff] [blame] | 432 | bus, *sub_bus, *agent, err); |
Stephen Rothwell | 3f17863 | 2007-12-07 01:51:48 +1100 | [diff] [blame] | 433 | else { |
Stephen Rothwell | 5376174 | 2007-12-07 01:58:01 +1100 | [diff] [blame] | 434 | err = HvCallPci_configStore8(bus, *sub_bus, |
| 435 | *agent, PCI_INTERRUPT_LINE, irq); |
Stephen Rothwell | 3f17863 | 2007-12-07 01:51:48 +1100 | [diff] [blame] | 436 | if (err) |
| 437 | pci_log_error("PciCfgStore Irq Failed!", |
Stephen Rothwell | 5376174 | 2007-12-07 01:58:01 +1100 | [diff] [blame] | 438 | bus, *sub_bus, *agent, err); |
Stephen Rothwell | 3f17863 | 2007-12-07 01:51:48 +1100 | [diff] [blame] | 439 | else |
| 440 | pdev->irq = irq; |
| 441 | } |
| 442 | } |
| 443 | |
| 444 | num_dev++; |
| 445 | pdev->sysdata = node; |
| 446 | PCI_DN(node)->pcidev = pdev; |
| 447 | allocate_device_bars(pdev); |
Stephen Rothwell | cd9afb3 | 2007-12-07 16:08:33 +1100 | [diff] [blame] | 448 | iseries_device_information(pdev, num_dev, bus, *sub_bus); |
Stephen Rothwell | 3f17863 | 2007-12-07 01:51:48 +1100 | [diff] [blame] | 449 | iommu_devnode_init_iSeries(pdev, node); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 450 | } |
| 451 | iSeries_activate_IRQs(); |
| 452 | mf_display_src(0xC9000200); |
| 453 | } |
| 454 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 455 | /* |
| 456 | * Config space read and write functions. |
| 457 | * For now at least, we look for the device node for the bus and devfn |
| 458 | * that we are asked to access. It may be possible to translate the devfn |
| 459 | * to a subbus and deviceid more directly. |
| 460 | */ |
| 461 | static u64 hv_cfg_read_func[4] = { |
| 462 | HvCallPciConfigLoad8, HvCallPciConfigLoad16, |
| 463 | HvCallPciConfigLoad32, HvCallPciConfigLoad32 |
| 464 | }; |
| 465 | |
| 466 | static u64 hv_cfg_write_func[4] = { |
| 467 | HvCallPciConfigStore8, HvCallPciConfigStore16, |
| 468 | HvCallPciConfigStore32, HvCallPciConfigStore32 |
| 469 | }; |
| 470 | |
| 471 | /* |
| 472 | * Read PCI config space |
| 473 | */ |
| 474 | static int iSeries_pci_read_config(struct pci_bus *bus, unsigned int devfn, |
| 475 | int offset, int size, u32 *val) |
| 476 | { |
Stephen Rothwell | 7a73bd7 | 2007-12-07 01:49:27 +1100 | [diff] [blame] | 477 | struct device_node *node = find_device_node(bus->number, devfn); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 478 | u64 fn; |
| 479 | struct HvCallPci_LoadReturn ret; |
| 480 | |
| 481 | if (node == NULL) |
| 482 | return PCIBIOS_DEVICE_NOT_FOUND; |
| 483 | if (offset > 255) { |
| 484 | *val = ~0; |
| 485 | return PCIBIOS_BAD_REGISTER_NUMBER; |
| 486 | } |
| 487 | |
| 488 | fn = hv_cfg_read_func[(size - 1) & 3]; |
Stephen Rothwell | 20f48cc | 2005-10-14 16:49:58 +1000 | [diff] [blame] | 489 | HvCall3Ret16(fn, &ret, iseries_ds_addr(node), offset, 0); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 490 | |
| 491 | if (ret.rc != 0) { |
| 492 | *val = ~0; |
| 493 | return PCIBIOS_DEVICE_NOT_FOUND; /* or something */ |
| 494 | } |
| 495 | |
| 496 | *val = ret.value; |
| 497 | return 0; |
| 498 | } |
| 499 | |
| 500 | /* |
| 501 | * Write PCI config space |
| 502 | */ |
| 503 | |
| 504 | static int iSeries_pci_write_config(struct pci_bus *bus, unsigned int devfn, |
| 505 | int offset, int size, u32 val) |
| 506 | { |
Stephen Rothwell | 7a73bd7 | 2007-12-07 01:49:27 +1100 | [diff] [blame] | 507 | struct device_node *node = find_device_node(bus->number, devfn); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 508 | u64 fn; |
| 509 | u64 ret; |
| 510 | |
| 511 | if (node == NULL) |
| 512 | return PCIBIOS_DEVICE_NOT_FOUND; |
| 513 | if (offset > 255) |
| 514 | return PCIBIOS_BAD_REGISTER_NUMBER; |
| 515 | |
| 516 | fn = hv_cfg_write_func[(size - 1) & 3]; |
Stephen Rothwell | 20f48cc | 2005-10-14 16:49:58 +1000 | [diff] [blame] | 517 | ret = HvCall4(fn, iseries_ds_addr(node), offset, val, 0); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 518 | |
| 519 | if (ret != 0) |
| 520 | return PCIBIOS_DEVICE_NOT_FOUND; |
| 521 | |
| 522 | return 0; |
| 523 | } |
| 524 | |
| 525 | static struct pci_ops iSeries_pci_ops = { |
| 526 | .read = iSeries_pci_read_config, |
| 527 | .write = iSeries_pci_write_config |
| 528 | }; |
| 529 | |
| 530 | /* |
| 531 | * Check Return Code |
| 532 | * -> On Failure, print and log information. |
| 533 | * Increment Retry Count, if exceeds max, panic partition. |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 534 | * |
| 535 | * PCI: Device 23.90 ReadL I/O Error( 0): 0x1234 |
| 536 | * PCI: Device 23.90 ReadL Retry( 1) |
| 537 | * PCI: Device 23.90 ReadL Retry Successful(1) |
| 538 | */ |
Stephen Rothwell | 7a73bd7 | 2007-12-07 01:49:27 +1100 | [diff] [blame] | 539 | static int check_return_code(char *type, struct device_node *dn, |
Stephen Rothwell | a2ebaf2 | 2005-06-21 17:15:47 -0700 | [diff] [blame] | 540 | int *retry, u64 ret) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 541 | { |
| 542 | if (ret != 0) { |
Stephen Rothwell | 7a73bd7 | 2007-12-07 01:49:27 +1100 | [diff] [blame] | 543 | struct pci_dn *pdn = PCI_DN(dn); |
Stephen Rothwell | 252e75a | 2005-09-28 14:40:40 +1000 | [diff] [blame] | 544 | |
Stephen Rothwell | a2ebaf2 | 2005-06-21 17:15:47 -0700 | [diff] [blame] | 545 | (*retry)++; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 546 | printk("PCI: %s: Device 0x%04X:%02X I/O Error(%2d): 0x%04X\n", |
Stephen Rothwell | 7a73bd7 | 2007-12-07 01:49:27 +1100 | [diff] [blame] | 547 | type, pdn->busno, pdn->devfn, |
Stephen Rothwell | a2ebaf2 | 2005-06-21 17:15:47 -0700 | [diff] [blame] | 548 | *retry, (int)ret); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 549 | /* |
| 550 | * Bump the retry and check for retry count exceeded. |
| 551 | * If, Exceeded, panic the system. |
| 552 | */ |
Stephen Rothwell | b9b1812 | 2007-12-07 01:48:14 +1100 | [diff] [blame] | 553 | if (((*retry) > PCI_RETRY_MAX) && |
| 554 | (limit_pci_retries > 0)) { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 555 | mf_display_src(0xB6000103); |
Stephen Rothwell | a2ebaf2 | 2005-06-21 17:15:47 -0700 | [diff] [blame] | 556 | panic_timeout = 0; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 557 | panic("PCI: Hardware I/O Error, SRC B6000103, " |
| 558 | "Automatic Reboot Disabled.\n"); |
| 559 | } |
| 560 | return -1; /* Retry Try */ |
| 561 | } |
Stephen Rothwell | a2ebaf2 | 2005-06-21 17:15:47 -0700 | [diff] [blame] | 562 | return 0; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 563 | } |
| 564 | |
| 565 | /* |
| 566 | * Translate the I/O Address into a device node, bar, and bar offset. |
| 567 | * Note: Make sure the passed variable end up on the stack to avoid |
| 568 | * the exposure of being device global. |
| 569 | */ |
Stephen Rothwell | 252e75a | 2005-09-28 14:40:40 +1000 | [diff] [blame] | 570 | static inline struct device_node *xlate_iomm_address( |
Stephen Rothwell | 7a73bd7 | 2007-12-07 01:49:27 +1100 | [diff] [blame] | 571 | const volatile void __iomem *addr, |
Stephen Rothwell | 0d416f2 | 2007-12-07 01:52:45 +1100 | [diff] [blame] | 572 | u64 *dsaptr, u64 *bar_offset, const char *func) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 573 | { |
Stephen Rothwell | 7a73bd7 | 2007-12-07 01:49:27 +1100 | [diff] [blame] | 574 | unsigned long orig_addr; |
| 575 | unsigned long base_addr; |
| 576 | unsigned long ind; |
| 577 | struct device_node *dn; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 578 | |
Stephen Rothwell | 7a73bd7 | 2007-12-07 01:49:27 +1100 | [diff] [blame] | 579 | orig_addr = (unsigned long __force)addr; |
Stephen Rothwell | 0d416f2 | 2007-12-07 01:52:45 +1100 | [diff] [blame] | 580 | if ((orig_addr < BASE_IO_MEMORY) || (orig_addr >= max_io_memory)) { |
| 581 | static unsigned long last_jiffies; |
| 582 | static int num_printed; |
| 583 | |
| 584 | if ((jiffies - last_jiffies) > 60 * HZ) { |
| 585 | last_jiffies = jiffies; |
| 586 | num_printed = 0; |
| 587 | } |
| 588 | if (num_printed++ < 10) |
| 589 | printk(KERN_ERR |
| 590 | "iSeries_%s: invalid access at IO address %p\n", |
| 591 | func, addr); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 592 | return NULL; |
Stephen Rothwell | 0d416f2 | 2007-12-07 01:52:45 +1100 | [diff] [blame] | 593 | } |
Stephen Rothwell | 7a73bd7 | 2007-12-07 01:49:27 +1100 | [diff] [blame] | 594 | base_addr = orig_addr - BASE_IO_MEMORY; |
| 595 | ind = base_addr / IOMM_TABLE_ENTRY_SIZE; |
| 596 | dn = iomm_table[ind]; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 597 | |
Stephen Rothwell | 7a73bd7 | 2007-12-07 01:49:27 +1100 | [diff] [blame] | 598 | if (dn != NULL) { |
| 599 | int barnum = iobar_table[ind]; |
| 600 | *dsaptr = iseries_ds_addr(dn) | (barnum << 24); |
| 601 | *bar_offset = base_addr % IOMM_TABLE_ENTRY_SIZE; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 602 | } else |
Stephen Rothwell | 7a73bd7 | 2007-12-07 01:49:27 +1100 | [diff] [blame] | 603 | panic("PCI: Invalid PCI IO address detected!\n"); |
| 604 | return dn; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 605 | } |
| 606 | |
| 607 | /* |
| 608 | * Read MM I/O Instructions for the iSeries |
| 609 | * On MM I/O error, all ones are returned and iSeries_pci_IoError is cal |
Benjamin Herrenschmidt | 4cb3cee | 2006-11-11 17:25:10 +1100 | [diff] [blame] | 610 | * else, data is returned in Big Endian format. |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 611 | */ |
Stephen Rothwell | 3448938 | 2007-12-07 01:53:44 +1100 | [diff] [blame] | 612 | static u8 iseries_readb(const volatile void __iomem *addr) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 613 | { |
Stephen Rothwell | 7a73bd7 | 2007-12-07 01:49:27 +1100 | [diff] [blame] | 614 | u64 bar_offset; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 615 | u64 dsa; |
Stephen Rothwell | a2ebaf2 | 2005-06-21 17:15:47 -0700 | [diff] [blame] | 616 | int retry = 0; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 617 | struct HvCallPci_LoadReturn ret; |
Stephen Rothwell | 7a73bd7 | 2007-12-07 01:49:27 +1100 | [diff] [blame] | 618 | struct device_node *dn = |
Stephen Rothwell | 0d416f2 | 2007-12-07 01:52:45 +1100 | [diff] [blame] | 619 | xlate_iomm_address(addr, &dsa, &bar_offset, "read_byte"); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 620 | |
Stephen Rothwell | 0d416f2 | 2007-12-07 01:52:45 +1100 | [diff] [blame] | 621 | if (dn == NULL) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 622 | return 0xff; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 623 | do { |
Stephen Rothwell | 7a73bd7 | 2007-12-07 01:49:27 +1100 | [diff] [blame] | 624 | HvCall3Ret16(HvCallPciBarLoad8, &ret, dsa, bar_offset, 0); |
| 625 | } while (check_return_code("RDB", dn, &retry, ret.rc) != 0); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 626 | |
Benjamin Herrenschmidt | 4cb3cee | 2006-11-11 17:25:10 +1100 | [diff] [blame] | 627 | return ret.value; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 628 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 629 | |
Stephen Rothwell | 3448938 | 2007-12-07 01:53:44 +1100 | [diff] [blame] | 630 | static u16 iseries_readw_be(const volatile void __iomem *addr) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 631 | { |
Stephen Rothwell | 7a73bd7 | 2007-12-07 01:49:27 +1100 | [diff] [blame] | 632 | u64 bar_offset; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 633 | u64 dsa; |
Stephen Rothwell | a2ebaf2 | 2005-06-21 17:15:47 -0700 | [diff] [blame] | 634 | int retry = 0; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 635 | struct HvCallPci_LoadReturn ret; |
Stephen Rothwell | 7a73bd7 | 2007-12-07 01:49:27 +1100 | [diff] [blame] | 636 | struct device_node *dn = |
Stephen Rothwell | 0d416f2 | 2007-12-07 01:52:45 +1100 | [diff] [blame] | 637 | xlate_iomm_address(addr, &dsa, &bar_offset, "read_word"); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 638 | |
Stephen Rothwell | 0d416f2 | 2007-12-07 01:52:45 +1100 | [diff] [blame] | 639 | if (dn == NULL) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 640 | return 0xffff; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 641 | do { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 642 | HvCall3Ret16(HvCallPciBarLoad16, &ret, dsa, |
Stephen Rothwell | 7a73bd7 | 2007-12-07 01:49:27 +1100 | [diff] [blame] | 643 | bar_offset, 0); |
| 644 | } while (check_return_code("RDW", dn, &retry, ret.rc) != 0); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 645 | |
Benjamin Herrenschmidt | 4cb3cee | 2006-11-11 17:25:10 +1100 | [diff] [blame] | 646 | return ret.value; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 647 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 648 | |
Stephen Rothwell | 3448938 | 2007-12-07 01:53:44 +1100 | [diff] [blame] | 649 | static u32 iseries_readl_be(const volatile void __iomem *addr) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 650 | { |
Stephen Rothwell | 7a73bd7 | 2007-12-07 01:49:27 +1100 | [diff] [blame] | 651 | u64 bar_offset; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 652 | u64 dsa; |
Stephen Rothwell | a2ebaf2 | 2005-06-21 17:15:47 -0700 | [diff] [blame] | 653 | int retry = 0; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 654 | struct HvCallPci_LoadReturn ret; |
Stephen Rothwell | 7a73bd7 | 2007-12-07 01:49:27 +1100 | [diff] [blame] | 655 | struct device_node *dn = |
Stephen Rothwell | 0d416f2 | 2007-12-07 01:52:45 +1100 | [diff] [blame] | 656 | xlate_iomm_address(addr, &dsa, &bar_offset, "read_long"); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 657 | |
Stephen Rothwell | 0d416f2 | 2007-12-07 01:52:45 +1100 | [diff] [blame] | 658 | if (dn == NULL) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 659 | return 0xffffffff; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 660 | do { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 661 | HvCall3Ret16(HvCallPciBarLoad32, &ret, dsa, |
Stephen Rothwell | 7a73bd7 | 2007-12-07 01:49:27 +1100 | [diff] [blame] | 662 | bar_offset, 0); |
| 663 | } while (check_return_code("RDL", dn, &retry, ret.rc) != 0); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 664 | |
Benjamin Herrenschmidt | 4cb3cee | 2006-11-11 17:25:10 +1100 | [diff] [blame] | 665 | return ret.value; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 666 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 667 | |
| 668 | /* |
| 669 | * Write MM I/O Instructions for the iSeries |
| 670 | * |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 671 | */ |
Stephen Rothwell | 3448938 | 2007-12-07 01:53:44 +1100 | [diff] [blame] | 672 | static void iseries_writeb(u8 data, volatile void __iomem *addr) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 673 | { |
Stephen Rothwell | 7a73bd7 | 2007-12-07 01:49:27 +1100 | [diff] [blame] | 674 | u64 bar_offset; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 675 | u64 dsa; |
Stephen Rothwell | a2ebaf2 | 2005-06-21 17:15:47 -0700 | [diff] [blame] | 676 | int retry = 0; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 677 | u64 rc; |
Stephen Rothwell | 7a73bd7 | 2007-12-07 01:49:27 +1100 | [diff] [blame] | 678 | struct device_node *dn = |
Stephen Rothwell | 0d416f2 | 2007-12-07 01:52:45 +1100 | [diff] [blame] | 679 | xlate_iomm_address(addr, &dsa, &bar_offset, "write_byte"); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 680 | |
Stephen Rothwell | 0d416f2 | 2007-12-07 01:52:45 +1100 | [diff] [blame] | 681 | if (dn == NULL) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 682 | return; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 683 | do { |
Stephen Rothwell | 7a73bd7 | 2007-12-07 01:49:27 +1100 | [diff] [blame] | 684 | rc = HvCall4(HvCallPciBarStore8, dsa, bar_offset, data, 0); |
| 685 | } while (check_return_code("WWB", dn, &retry, rc) != 0); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 686 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 687 | |
Stephen Rothwell | 3448938 | 2007-12-07 01:53:44 +1100 | [diff] [blame] | 688 | static void iseries_writew_be(u16 data, volatile void __iomem *addr) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 689 | { |
Stephen Rothwell | 7a73bd7 | 2007-12-07 01:49:27 +1100 | [diff] [blame] | 690 | u64 bar_offset; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 691 | u64 dsa; |
Stephen Rothwell | a2ebaf2 | 2005-06-21 17:15:47 -0700 | [diff] [blame] | 692 | int retry = 0; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 693 | u64 rc; |
Stephen Rothwell | 7a73bd7 | 2007-12-07 01:49:27 +1100 | [diff] [blame] | 694 | struct device_node *dn = |
Stephen Rothwell | 0d416f2 | 2007-12-07 01:52:45 +1100 | [diff] [blame] | 695 | xlate_iomm_address(addr, &dsa, &bar_offset, "write_word"); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 696 | |
Stephen Rothwell | 0d416f2 | 2007-12-07 01:52:45 +1100 | [diff] [blame] | 697 | if (dn == NULL) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 698 | return; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 699 | do { |
Stephen Rothwell | 7a73bd7 | 2007-12-07 01:49:27 +1100 | [diff] [blame] | 700 | rc = HvCall4(HvCallPciBarStore16, dsa, bar_offset, data, 0); |
| 701 | } while (check_return_code("WWW", dn, &retry, rc) != 0); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 702 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 703 | |
Stephen Rothwell | 3448938 | 2007-12-07 01:53:44 +1100 | [diff] [blame] | 704 | static void iseries_writel_be(u32 data, volatile void __iomem *addr) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 705 | { |
Stephen Rothwell | 7a73bd7 | 2007-12-07 01:49:27 +1100 | [diff] [blame] | 706 | u64 bar_offset; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 707 | u64 dsa; |
Stephen Rothwell | a2ebaf2 | 2005-06-21 17:15:47 -0700 | [diff] [blame] | 708 | int retry = 0; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 709 | u64 rc; |
Stephen Rothwell | 7a73bd7 | 2007-12-07 01:49:27 +1100 | [diff] [blame] | 710 | struct device_node *dn = |
Stephen Rothwell | 0d416f2 | 2007-12-07 01:52:45 +1100 | [diff] [blame] | 711 | xlate_iomm_address(addr, &dsa, &bar_offset, "write_long"); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 712 | |
Stephen Rothwell | 0d416f2 | 2007-12-07 01:52:45 +1100 | [diff] [blame] | 713 | if (dn == NULL) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 714 | return; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 715 | do { |
Stephen Rothwell | 7a73bd7 | 2007-12-07 01:49:27 +1100 | [diff] [blame] | 716 | rc = HvCall4(HvCallPciBarStore32, dsa, bar_offset, data, 0); |
| 717 | } while (check_return_code("WWL", dn, &retry, rc) != 0); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 718 | } |
Stephen Rothwell | caf8132 | 2006-09-21 18:00:00 +1000 | [diff] [blame] | 719 | |
Benjamin Herrenschmidt | 4cb3cee | 2006-11-11 17:25:10 +1100 | [diff] [blame] | 720 | static u16 iseries_readw(const volatile void __iomem *addr) |
Stephen Rothwell | caf8132 | 2006-09-21 18:00:00 +1000 | [diff] [blame] | 721 | { |
Stephen Rothwell | 3448938 | 2007-12-07 01:53:44 +1100 | [diff] [blame] | 722 | return le16_to_cpu(iseries_readw_be(addr)); |
Stephen Rothwell | caf8132 | 2006-09-21 18:00:00 +1000 | [diff] [blame] | 723 | } |
Stephen Rothwell | caf8132 | 2006-09-21 18:00:00 +1000 | [diff] [blame] | 724 | |
Benjamin Herrenschmidt | 4cb3cee | 2006-11-11 17:25:10 +1100 | [diff] [blame] | 725 | static u32 iseries_readl(const volatile void __iomem *addr) |
Stephen Rothwell | caf8132 | 2006-09-21 18:00:00 +1000 | [diff] [blame] | 726 | { |
Stephen Rothwell | 3448938 | 2007-12-07 01:53:44 +1100 | [diff] [blame] | 727 | return le32_to_cpu(iseries_readl_be(addr)); |
Stephen Rothwell | caf8132 | 2006-09-21 18:00:00 +1000 | [diff] [blame] | 728 | } |
Stephen Rothwell | caf8132 | 2006-09-21 18:00:00 +1000 | [diff] [blame] | 729 | |
Benjamin Herrenschmidt | 4cb3cee | 2006-11-11 17:25:10 +1100 | [diff] [blame] | 730 | static void iseries_writew(u16 data, volatile void __iomem *addr) |
Stephen Rothwell | caf8132 | 2006-09-21 18:00:00 +1000 | [diff] [blame] | 731 | { |
Stephen Rothwell | 3448938 | 2007-12-07 01:53:44 +1100 | [diff] [blame] | 732 | iseries_writew_be(cpu_to_le16(data), addr); |
Stephen Rothwell | caf8132 | 2006-09-21 18:00:00 +1000 | [diff] [blame] | 733 | } |
Stephen Rothwell | caf8132 | 2006-09-21 18:00:00 +1000 | [diff] [blame] | 734 | |
Benjamin Herrenschmidt | 4cb3cee | 2006-11-11 17:25:10 +1100 | [diff] [blame] | 735 | static void iseries_writel(u32 data, volatile void __iomem *addr) |
Stephen Rothwell | caf8132 | 2006-09-21 18:00:00 +1000 | [diff] [blame] | 736 | { |
Stephen Rothwell | 3448938 | 2007-12-07 01:53:44 +1100 | [diff] [blame] | 737 | iseries_writel(cpu_to_le32(data), addr); |
Stephen Rothwell | caf8132 | 2006-09-21 18:00:00 +1000 | [diff] [blame] | 738 | } |
Stephen Rothwell | caf8132 | 2006-09-21 18:00:00 +1000 | [diff] [blame] | 739 | |
Benjamin Herrenschmidt | 4cb3cee | 2006-11-11 17:25:10 +1100 | [diff] [blame] | 740 | static void iseries_readsb(const volatile void __iomem *addr, void *buf, |
| 741 | unsigned long count) |
Stephen Rothwell | caf8132 | 2006-09-21 18:00:00 +1000 | [diff] [blame] | 742 | { |
Benjamin Herrenschmidt | 4cb3cee | 2006-11-11 17:25:10 +1100 | [diff] [blame] | 743 | u8 *dst = buf; |
| 744 | while(count-- > 0) |
Stephen Rothwell | 3448938 | 2007-12-07 01:53:44 +1100 | [diff] [blame] | 745 | *(dst++) = iseries_readb(addr); |
Stephen Rothwell | caf8132 | 2006-09-21 18:00:00 +1000 | [diff] [blame] | 746 | } |
Stephen Rothwell | caf8132 | 2006-09-21 18:00:00 +1000 | [diff] [blame] | 747 | |
Benjamin Herrenschmidt | 4cb3cee | 2006-11-11 17:25:10 +1100 | [diff] [blame] | 748 | static void iseries_readsw(const volatile void __iomem *addr, void *buf, |
| 749 | unsigned long count) |
Stephen Rothwell | caf8132 | 2006-09-21 18:00:00 +1000 | [diff] [blame] | 750 | { |
Benjamin Herrenschmidt | 4cb3cee | 2006-11-11 17:25:10 +1100 | [diff] [blame] | 751 | u16 *dst = buf; |
| 752 | while(count-- > 0) |
Stephen Rothwell | 3448938 | 2007-12-07 01:53:44 +1100 | [diff] [blame] | 753 | *(dst++) = iseries_readw_be(addr); |
Stephen Rothwell | caf8132 | 2006-09-21 18:00:00 +1000 | [diff] [blame] | 754 | } |
Stephen Rothwell | caf8132 | 2006-09-21 18:00:00 +1000 | [diff] [blame] | 755 | |
Benjamin Herrenschmidt | 4cb3cee | 2006-11-11 17:25:10 +1100 | [diff] [blame] | 756 | static void iseries_readsl(const volatile void __iomem *addr, void *buf, |
| 757 | unsigned long count) |
Stephen Rothwell | caf8132 | 2006-09-21 18:00:00 +1000 | [diff] [blame] | 758 | { |
Benjamin Herrenschmidt | 4cb3cee | 2006-11-11 17:25:10 +1100 | [diff] [blame] | 759 | u32 *dst = buf; |
| 760 | while(count-- > 0) |
Stephen Rothwell | 3448938 | 2007-12-07 01:53:44 +1100 | [diff] [blame] | 761 | *(dst++) = iseries_readl_be(addr); |
Stephen Rothwell | caf8132 | 2006-09-21 18:00:00 +1000 | [diff] [blame] | 762 | } |
Stephen Rothwell | caf8132 | 2006-09-21 18:00:00 +1000 | [diff] [blame] | 763 | |
Benjamin Herrenschmidt | 4cb3cee | 2006-11-11 17:25:10 +1100 | [diff] [blame] | 764 | static void iseries_writesb(volatile void __iomem *addr, const void *buf, |
| 765 | unsigned long count) |
Stephen Rothwell | caf8132 | 2006-09-21 18:00:00 +1000 | [diff] [blame] | 766 | { |
Benjamin Herrenschmidt | 4cb3cee | 2006-11-11 17:25:10 +1100 | [diff] [blame] | 767 | const u8 *src = buf; |
| 768 | while(count-- > 0) |
Stephen Rothwell | 3448938 | 2007-12-07 01:53:44 +1100 | [diff] [blame] | 769 | iseries_writeb(*(src++), addr); |
Stephen Rothwell | caf8132 | 2006-09-21 18:00:00 +1000 | [diff] [blame] | 770 | } |
Stephen Rothwell | caf8132 | 2006-09-21 18:00:00 +1000 | [diff] [blame] | 771 | |
Benjamin Herrenschmidt | 4cb3cee | 2006-11-11 17:25:10 +1100 | [diff] [blame] | 772 | static void iseries_writesw(volatile void __iomem *addr, const void *buf, |
| 773 | unsigned long count) |
Stephen Rothwell | caf8132 | 2006-09-21 18:00:00 +1000 | [diff] [blame] | 774 | { |
Benjamin Herrenschmidt | 4cb3cee | 2006-11-11 17:25:10 +1100 | [diff] [blame] | 775 | const u16 *src = buf; |
| 776 | while(count-- > 0) |
Stephen Rothwell | 3448938 | 2007-12-07 01:53:44 +1100 | [diff] [blame] | 777 | iseries_writew_be(*(src++), addr); |
Stephen Rothwell | caf8132 | 2006-09-21 18:00:00 +1000 | [diff] [blame] | 778 | } |
Stephen Rothwell | caf8132 | 2006-09-21 18:00:00 +1000 | [diff] [blame] | 779 | |
Benjamin Herrenschmidt | 4cb3cee | 2006-11-11 17:25:10 +1100 | [diff] [blame] | 780 | static void iseries_writesl(volatile void __iomem *addr, const void *buf, |
| 781 | unsigned long count) |
Stephen Rothwell | caf8132 | 2006-09-21 18:00:00 +1000 | [diff] [blame] | 782 | { |
Benjamin Herrenschmidt | 4cb3cee | 2006-11-11 17:25:10 +1100 | [diff] [blame] | 783 | const u32 *src = buf; |
| 784 | while(count-- > 0) |
Stephen Rothwell | 3448938 | 2007-12-07 01:53:44 +1100 | [diff] [blame] | 785 | iseries_writel_be(*(src++), addr); |
Stephen Rothwell | caf8132 | 2006-09-21 18:00:00 +1000 | [diff] [blame] | 786 | } |
Stephen Rothwell | caf8132 | 2006-09-21 18:00:00 +1000 | [diff] [blame] | 787 | |
Benjamin Herrenschmidt | 4cb3cee | 2006-11-11 17:25:10 +1100 | [diff] [blame] | 788 | static void iseries_memset_io(volatile void __iomem *addr, int c, |
| 789 | unsigned long n) |
Stephen Rothwell | caf8132 | 2006-09-21 18:00:00 +1000 | [diff] [blame] | 790 | { |
Benjamin Herrenschmidt | 4cb3cee | 2006-11-11 17:25:10 +1100 | [diff] [blame] | 791 | volatile char __iomem *d = addr; |
Stephen Rothwell | caf8132 | 2006-09-21 18:00:00 +1000 | [diff] [blame] | 792 | |
Benjamin Herrenschmidt | 4cb3cee | 2006-11-11 17:25:10 +1100 | [diff] [blame] | 793 | while (n-- > 0) |
Stephen Rothwell | 3448938 | 2007-12-07 01:53:44 +1100 | [diff] [blame] | 794 | iseries_writeb(c, d++); |
Benjamin Herrenschmidt | 4cb3cee | 2006-11-11 17:25:10 +1100 | [diff] [blame] | 795 | } |
| 796 | |
| 797 | static void iseries_memcpy_fromio(void *dest, const volatile void __iomem *src, |
| 798 | unsigned long n) |
Stephen Rothwell | caf8132 | 2006-09-21 18:00:00 +1000 | [diff] [blame] | 799 | { |
Benjamin Herrenschmidt | 4cb3cee | 2006-11-11 17:25:10 +1100 | [diff] [blame] | 800 | char *d = dest; |
| 801 | const volatile char __iomem *s = src; |
Stephen Rothwell | caf8132 | 2006-09-21 18:00:00 +1000 | [diff] [blame] | 802 | |
Benjamin Herrenschmidt | 4cb3cee | 2006-11-11 17:25:10 +1100 | [diff] [blame] | 803 | while (n-- > 0) |
Stephen Rothwell | 3448938 | 2007-12-07 01:53:44 +1100 | [diff] [blame] | 804 | *d++ = iseries_readb(s++); |
Stephen Rothwell | caf8132 | 2006-09-21 18:00:00 +1000 | [diff] [blame] | 805 | } |
Stephen Rothwell | caf8132 | 2006-09-21 18:00:00 +1000 | [diff] [blame] | 806 | |
Benjamin Herrenschmidt | 4cb3cee | 2006-11-11 17:25:10 +1100 | [diff] [blame] | 807 | static void iseries_memcpy_toio(volatile void __iomem *dest, const void *src, |
| 808 | unsigned long n) |
Stephen Rothwell | caf8132 | 2006-09-21 18:00:00 +1000 | [diff] [blame] | 809 | { |
Benjamin Herrenschmidt | 4cb3cee | 2006-11-11 17:25:10 +1100 | [diff] [blame] | 810 | const char *s = src; |
| 811 | volatile char __iomem *d = dest; |
Stephen Rothwell | caf8132 | 2006-09-21 18:00:00 +1000 | [diff] [blame] | 812 | |
Benjamin Herrenschmidt | 4cb3cee | 2006-11-11 17:25:10 +1100 | [diff] [blame] | 813 | while (n-- > 0) |
Stephen Rothwell | 3448938 | 2007-12-07 01:53:44 +1100 | [diff] [blame] | 814 | iseries_writeb(*s++, d++); |
Stephen Rothwell | caf8132 | 2006-09-21 18:00:00 +1000 | [diff] [blame] | 815 | } |
Stephen Rothwell | caf8132 | 2006-09-21 18:00:00 +1000 | [diff] [blame] | 816 | |
Benjamin Herrenschmidt | 4cb3cee | 2006-11-11 17:25:10 +1100 | [diff] [blame] | 817 | /* We only set MMIO ops. The default PIO ops will be default |
| 818 | * to the MMIO ops + pci_io_base which is 0 on iSeries as |
| 819 | * expected so both should work. |
| 820 | * |
| 821 | * Note that we don't implement the readq/writeq versions as |
| 822 | * I don't know of an HV call for doing so. Thus, the default |
| 823 | * operation will be used instead, which will fault a the value |
| 824 | * return by iSeries for MMIO addresses always hits a non mapped |
| 825 | * area. This is as good as the BUG() we used to have there. |
| 826 | */ |
| 827 | static struct ppc_pci_io __initdata iseries_pci_io = { |
| 828 | .readb = iseries_readb, |
| 829 | .readw = iseries_readw, |
| 830 | .readl = iseries_readl, |
| 831 | .readw_be = iseries_readw_be, |
| 832 | .readl_be = iseries_readl_be, |
| 833 | .writeb = iseries_writeb, |
| 834 | .writew = iseries_writew, |
| 835 | .writel = iseries_writel, |
| 836 | .writew_be = iseries_writew_be, |
| 837 | .writel_be = iseries_writel_be, |
| 838 | .readsb = iseries_readsb, |
| 839 | .readsw = iseries_readsw, |
| 840 | .readsl = iseries_readsl, |
| 841 | .writesb = iseries_writesb, |
| 842 | .writesw = iseries_writesw, |
| 843 | .writesl = iseries_writesl, |
| 844 | .memset_io = iseries_memset_io, |
| 845 | .memcpy_fromio = iseries_memcpy_fromio, |
| 846 | .memcpy_toio = iseries_memcpy_toio, |
| 847 | }; |
| 848 | |
| 849 | /* |
| 850 | * iSeries_pcibios_init |
| 851 | * |
| 852 | * Description: |
| 853 | * This function checks for all possible system PCI host bridges that connect |
| 854 | * PCI buses. The system hypervisor is queried as to the guest partition |
| 855 | * ownership status. A pci_controller is built for any bus which is partially |
| 856 | * owned or fully owned by this guest partition. |
| 857 | */ |
| 858 | void __init iSeries_pcibios_init(void) |
Stephen Rothwell | caf8132 | 2006-09-21 18:00:00 +1000 | [diff] [blame] | 859 | { |
Benjamin Herrenschmidt | 4cb3cee | 2006-11-11 17:25:10 +1100 | [diff] [blame] | 860 | struct pci_controller *phb; |
| 861 | struct device_node *root = of_find_node_by_path("/"); |
| 862 | struct device_node *node = NULL; |
Stephen Rothwell | caf8132 | 2006-09-21 18:00:00 +1000 | [diff] [blame] | 863 | |
Benjamin Herrenschmidt | 4cb3cee | 2006-11-11 17:25:10 +1100 | [diff] [blame] | 864 | /* Install IO hooks */ |
| 865 | ppc_pci_io = iseries_pci_io; |
| 866 | |
Stephen Rothwell | 9ccc4fd | 2007-12-07 02:03:23 +1100 | [diff] [blame] | 867 | pci_probe_only = 1; |
| 868 | |
Benjamin Herrenschmidt | 3d5134e | 2007-06-04 15:15:36 +1000 | [diff] [blame] | 869 | /* iSeries has no IO space in the common sense, it needs to set |
| 870 | * the IO base to 0 |
| 871 | */ |
| 872 | pci_io_base = 0; |
| 873 | |
Benjamin Herrenschmidt | 4cb3cee | 2006-11-11 17:25:10 +1100 | [diff] [blame] | 874 | if (root == NULL) { |
| 875 | printk(KERN_CRIT "iSeries_pcibios_init: can't find root " |
| 876 | "of device tree\n"); |
| 877 | return; |
| 878 | } |
| 879 | while ((node = of_get_next_child(root, node)) != NULL) { |
| 880 | HvBusNumber bus; |
| 881 | const u32 *busp; |
| 882 | |
| 883 | if ((node->type == NULL) || (strcmp(node->type, "pci") != 0)) |
| 884 | continue; |
| 885 | |
Stephen Rothwell | e2eb639 | 2007-04-03 22:26:41 +1000 | [diff] [blame] | 886 | busp = of_get_property(node, "bus-range", NULL); |
Benjamin Herrenschmidt | 4cb3cee | 2006-11-11 17:25:10 +1100 | [diff] [blame] | 887 | if (busp == NULL) |
| 888 | continue; |
| 889 | bus = *busp; |
| 890 | printk("bus %d appears to exist\n", bus); |
| 891 | phb = pcibios_alloc_controller(node); |
| 892 | if (phb == NULL) |
| 893 | continue; |
Stephen Rothwell | 6207e81 | 2007-12-07 02:04:33 +1100 | [diff] [blame] | 894 | /* All legacy iSeries PHBs are in domain zero */ |
| 895 | phb->global_number = 0; |
Benjamin Herrenschmidt | 4cb3cee | 2006-11-11 17:25:10 +1100 | [diff] [blame] | 896 | |
Kumar Gala | bf440b7 | 2007-06-27 00:19:08 -0500 | [diff] [blame] | 897 | phb->pci_mem_offset = bus; |
Benjamin Herrenschmidt | 4cb3cee | 2006-11-11 17:25:10 +1100 | [diff] [blame] | 898 | phb->first_busno = bus; |
| 899 | phb->last_busno = bus; |
| 900 | phb->ops = &iSeries_pci_ops; |
| 901 | } |
| 902 | |
| 903 | of_node_put(root); |
| 904 | |
| 905 | pci_devs_phb_init(); |
Stephen Rothwell | caf8132 | 2006-09-21 18:00:00 +1000 | [diff] [blame] | 906 | } |
Stephen Rothwell | caf8132 | 2006-09-21 18:00:00 +1000 | [diff] [blame] | 907 | |