Merge git://git.kernel.org/pub/scm/linux/kernel/git/paulus/powerpc-merge

+896 -436
+10 -1
arch/powerpc/Kconfig
··· 275 275 select PPC_I8259 276 276 select PPC_RTAS 277 277 select RTAS_ERROR_LOGGING 278 + select PPC_UDBG_16550 278 279 default y 279 280 280 281 config PPC_CHRP ··· 285 284 select PPC_INDIRECT_PCI 286 285 select PPC_RTAS 287 286 select PPC_MPC106 287 + select PPC_UDBG_16550 288 288 default y 289 289 290 290 config PPC_PMAC ··· 308 306 depends on PPC_MULTIPLATFORM && PPC32 && BROKEN 309 307 select PPC_I8259 310 308 select PPC_INDIRECT_PCI 309 + select PPC_UDBG_16550 311 310 default y 312 311 313 312 config PPC_MAPLE ··· 317 314 select U3_DART 318 315 select MPIC_BROKEN_U3 319 316 select GENERIC_TBSYNC 317 + select PPC_UDBG_16550 320 318 default n 321 319 help 322 320 This option enables support for the Maple 970FX Evaluation Board. ··· 328 324 depends on PPC_MULTIPLATFORM && PPC64 329 325 select PPC_RTAS 330 326 select MMIO_NVRAM 327 + select PPC_UDBG_16550 331 328 332 329 config PPC_OF 333 330 def_bool y ··· 375 370 depends on PPC_MAPLE 376 371 default y 377 372 373 + config PPC_UDBG_16550 374 + bool 375 + default n 376 + 378 377 config CELL_IIC 379 378 depends on PPC_CELL 380 379 bool ··· 412 403 413 404 config GENERIC_TBSYNC 414 405 bool 415 - default y if CONFIG_PPC32 && CONFIG_SMP 406 + default y if PPC32 && SMP 416 407 default n 417 408 418 409 source "drivers/cpufreq/Kconfig"
+1 -1
arch/powerpc/kernel/Makefile
··· 54 54 obj-$(CONFIG_6xx) += idle_6xx.o 55 55 obj-$(CONFIG_SMP) += smp.o 56 56 obj-$(CONFIG_KPROBES) += kprobes.o 57 - obj-$(CONFIG_SERIAL_8250) += legacy_serial.o udbg_16550.o 57 + obj-$(CONFIG_PPC_UDBG_16550) += legacy_serial.o udbg_16550.o 58 58 module-$(CONFIG_PPC64) += module_64.o 59 59 obj-$(CONFIG_MODULES) += $(module-y) 60 60
+1 -1
arch/powerpc/kernel/pci_64.c
··· 381 381 dev->subsystem_vendor = get_int_prop(node, "subsystem-vendor-id", 0); 382 382 dev->subsystem_device = get_int_prop(node, "subsystem-id", 0); 383 383 384 - dev->cfg_size = 256; /*pci_cfg_space_size(dev);*/ 384 + dev->cfg_size = pci_cfg_space_size(dev); 385 385 386 386 sprintf(pci_name(dev), "%04x:%02x:%02x.%d", pci_domain_nr(bus), 387 387 dev->bus->number, PCI_SLOT(devfn), PCI_FUNC(devfn));
-1
arch/powerpc/kernel/ppc_ksyms.c
··· 244 244 extern long mol_trampoline; 245 245 EXPORT_SYMBOL(mol_trampoline); /* For MOL */ 246 246 EXPORT_SYMBOL(flush_hash_pages); /* For MOL */ 247 - EXPORT_SYMBOL_GPL(__handle_mm_fault); /* For MOL */ 248 247 #ifdef CONFIG_SMP 249 248 extern int mmu_hash_lock; 250 249 EXPORT_SYMBOL(mmu_hash_lock); /* For MOL */
+1 -1
arch/powerpc/kernel/rtas_pci.c
··· 72 72 return 0; 73 73 } 74 74 75 - static int rtas_read_config(struct pci_dn *pdn, int where, int size, u32 *val) 75 + int rtas_read_config(struct pci_dn *pdn, int where, int size, u32 *val) 76 76 { 77 77 int returnval = -1; 78 78 unsigned long buid, addr;
-2
arch/powerpc/kernel/setup_32.c
··· 299 299 if (ppc_md.init_early) 300 300 ppc_md.init_early(); 301 301 302 - #ifdef CONFIG_SERIAL_8250 303 302 find_legacy_serial_ports(); 304 - #endif 305 303 finish_device_tree(); 306 304 307 305 smp_setup_cpu_maps();
-2
arch/powerpc/kernel/setup_64.c
··· 472 472 * hash table management for us, thus ioremap works. We do that early 473 473 * so that further code can be debugged 474 474 */ 475 - #ifdef CONFIG_SERIAL_8250 476 475 find_legacy_serial_ports(); 477 - #endif 478 476 479 477 /* 480 478 * "Finish" the device-tree, that is do the actual parsing of
-24
arch/powerpc/kernel/sys_ppc32.c
··· 552 552 return ret; 553 553 } 554 554 555 - asmlinkage int compat_sys_pciconfig_read(u32 bus, u32 dfn, u32 off, u32 len, u32 ubuf) 556 - { 557 - return sys_pciconfig_read((unsigned long) bus, 558 - (unsigned long) dfn, 559 - (unsigned long) off, 560 - (unsigned long) len, 561 - compat_ptr(ubuf)); 562 - } 563 - 564 - asmlinkage int compat_sys_pciconfig_write(u32 bus, u32 dfn, u32 off, u32 len, u32 ubuf) 565 - { 566 - return sys_pciconfig_write((unsigned long) bus, 567 - (unsigned long) dfn, 568 - (unsigned long) off, 569 - (unsigned long) len, 570 - compat_ptr(ubuf)); 571 - } 572 - 573 - asmlinkage int compat_sys_pciconfig_iobase(u32 which, u32 in_bus, u32 in_devfn) 574 - { 575 - return sys_pciconfig_iobase(which, in_bus, in_devfn); 576 - } 577 - 578 - 579 555 /* Note: it is necessary to treat mode as an unsigned int, 580 556 * with the corresponding cast to a signed int to insure that the 581 557 * proper conversion (sign extension) between the register representation of a signed int (msr in 32-bit mode)
+3 -3
arch/powerpc/kernel/systbl.S
··· 239 239 SYSX(sys_ni_syscall,sys_stat64,sys_stat64) 240 240 SYSX(sys_ni_syscall,sys_lstat64,sys_lstat64) 241 241 SYSX(sys_ni_syscall,sys_fstat64,sys_fstat64) 242 - COMPAT_SYS(pciconfig_read) 243 - COMPAT_SYS(pciconfig_write) 244 - COMPAT_SYS(pciconfig_iobase) 242 + SYSCALL(pciconfig_read) 243 + SYSCALL(pciconfig_write) 244 + SYSCALL(pciconfig_iobase) 245 245 SYSCALL(ni_syscall) 246 246 SYSCALL(getdents64) 247 247 SYSCALL(pivot_root)
+1 -1
arch/powerpc/mm/pgtable_64.c
··· 174 174 pa = addr & PAGE_MASK; 175 175 size = PAGE_ALIGN(addr + size) - pa; 176 176 177 - if (size == 0) 177 + if ((size == 0) || (pa == 0)) 178 178 return NULL; 179 179 180 180 if (mem_init_done) {
-3
arch/powerpc/platforms/maple/setup.c
··· 71 71 #define DBG(fmt...) 72 72 #endif 73 73 74 - extern void generic_find_legacy_serial_ports(u64 *physport, 75 - unsigned int *default_speed); 76 - 77 74 static void maple_restart(char *cmd) 78 75 { 79 76 unsigned int maple_nvram_base;
+1 -1
arch/powerpc/platforms/pseries/Makefile
··· 4 4 obj-$(CONFIG_IBMVIO) += vio.o 5 5 obj-$(CONFIG_XICS) += xics.o 6 6 obj-$(CONFIG_SCANLOG) += scanlog.o 7 - obj-$(CONFIG_EEH) += eeh.o eeh_event.o 7 + obj-$(CONFIG_EEH) += eeh.o eeh_cache.o eeh_driver.o eeh_event.o 8 8 9 9 obj-$(CONFIG_HVC_CONSOLE) += hvconsole.o 10 10 obj-$(CONFIG_HVCS) += hvcserver.o
+132 -357
arch/powerpc/platforms/pseries/eeh.c
··· 76 76 */ 77 77 #define EEH_MAX_FAILS 100000 78 78 79 - /* Misc forward declaraions */ 80 - static void eeh_save_bars(struct pci_dev * pdev, struct pci_dn *pdn); 81 - 82 79 /* RTAS tokens */ 83 80 static int ibm_set_eeh_option; 84 81 static int ibm_set_slot_reset; 85 82 static int ibm_read_slot_reset_state; 86 83 static int ibm_read_slot_reset_state2; 87 84 static int ibm_slot_error_detail; 85 + static int ibm_get_config_addr_info; 86 + static int ibm_configure_bridge; 88 87 89 88 int eeh_subsystem_enabled; 90 89 EXPORT_SYMBOL(eeh_subsystem_enabled); ··· 97 98 static int eeh_error_buf_size; 98 99 99 100 /* System monitoring statistics */ 100 - static DEFINE_PER_CPU(unsigned long, no_device); 101 - static DEFINE_PER_CPU(unsigned long, no_dn); 102 - static DEFINE_PER_CPU(unsigned long, no_cfg_addr); 103 - static DEFINE_PER_CPU(unsigned long, ignored_check); 104 - static DEFINE_PER_CPU(unsigned long, total_mmio_ffs); 105 - static DEFINE_PER_CPU(unsigned long, false_positives); 106 - static DEFINE_PER_CPU(unsigned long, ignored_failures); 107 - static DEFINE_PER_CPU(unsigned long, slot_resets); 101 + static unsigned long no_device; 102 + static unsigned long no_dn; 103 + static unsigned long no_cfg_addr; 104 + static unsigned long ignored_check; 105 + static unsigned long total_mmio_ffs; 106 + static unsigned long false_positives; 107 + static unsigned long ignored_failures; 108 + static unsigned long slot_resets; 108 109 109 - /** 110 - * The pci address cache subsystem. This subsystem places 111 - * PCI device address resources into a red-black tree, sorted 112 - * according to the address range, so that given only an i/o 113 - * address, the corresponding PCI device can be **quickly** 114 - * found. It is safe to perform an address lookup in an interrupt 115 - * context; this ability is an important feature. 116 - * 117 - * Currently, the only customer of this code is the EEH subsystem; 118 - * thus, this code has been somewhat tailored to suit EEH better. 119 - * In particular, the cache does *not* hold the addresses of devices 120 - * for which EEH is not enabled. 121 - * 122 - * (Implementation Note: The RB tree seems to be better/faster 123 - * than any hash algo I could think of for this problem, even 124 - * with the penalty of slow pointer chases for d-cache misses). 125 - */ 126 - struct pci_io_addr_range 127 - { 128 - struct rb_node rb_node; 129 - unsigned long addr_lo; 130 - unsigned long addr_hi; 131 - struct pci_dev *pcidev; 132 - unsigned int flags; 133 - }; 134 - 135 - static struct pci_io_addr_cache 136 - { 137 - struct rb_root rb_root; 138 - spinlock_t piar_lock; 139 - } pci_io_addr_cache_root; 140 - 141 - static inline struct pci_dev *__pci_get_device_by_addr(unsigned long addr) 142 - { 143 - struct rb_node *n = pci_io_addr_cache_root.rb_root.rb_node; 144 - 145 - while (n) { 146 - struct pci_io_addr_range *piar; 147 - piar = rb_entry(n, struct pci_io_addr_range, rb_node); 148 - 149 - if (addr < piar->addr_lo) { 150 - n = n->rb_left; 151 - } else { 152 - if (addr > piar->addr_hi) { 153 - n = n->rb_right; 154 - } else { 155 - pci_dev_get(piar->pcidev); 156 - return piar->pcidev; 157 - } 158 - } 159 - } 160 - 161 - return NULL; 162 - } 163 - 164 - /** 165 - * pci_get_device_by_addr - Get device, given only address 166 - * @addr: mmio (PIO) phys address or i/o port number 167 - * 168 - * Given an mmio phys address, or a port number, find a pci device 169 - * that implements this address. Be sure to pci_dev_put the device 170 - * when finished. I/O port numbers are assumed to be offset 171 - * from zero (that is, they do *not* have pci_io_addr added in). 172 - * It is safe to call this function within an interrupt. 173 - */ 174 - static struct pci_dev *pci_get_device_by_addr(unsigned long addr) 175 - { 176 - struct pci_dev *dev; 177 - unsigned long flags; 178 - 179 - spin_lock_irqsave(&pci_io_addr_cache_root.piar_lock, flags); 180 - dev = __pci_get_device_by_addr(addr); 181 - spin_unlock_irqrestore(&pci_io_addr_cache_root.piar_lock, flags); 182 - return dev; 183 - } 184 - 185 - #ifdef DEBUG 186 - /* 187 - * Handy-dandy debug print routine, does nothing more 188 - * than print out the contents of our addr cache. 189 - */ 190 - static void pci_addr_cache_print(struct pci_io_addr_cache *cache) 191 - { 192 - struct rb_node *n; 193 - int cnt = 0; 194 - 195 - n = rb_first(&cache->rb_root); 196 - while (n) { 197 - struct pci_io_addr_range *piar; 198 - piar = rb_entry(n, struct pci_io_addr_range, rb_node); 199 - printk(KERN_DEBUG "PCI: %s addr range %d [%lx-%lx]: %s\n", 200 - (piar->flags & IORESOURCE_IO) ? "i/o" : "mem", cnt, 201 - piar->addr_lo, piar->addr_hi, pci_name(piar->pcidev)); 202 - cnt++; 203 - n = rb_next(n); 204 - } 205 - } 206 - #endif 207 - 208 - /* Insert address range into the rb tree. */ 209 - static struct pci_io_addr_range * 210 - pci_addr_cache_insert(struct pci_dev *dev, unsigned long alo, 211 - unsigned long ahi, unsigned int flags) 212 - { 213 - struct rb_node **p = &pci_io_addr_cache_root.rb_root.rb_node; 214 - struct rb_node *parent = NULL; 215 - struct pci_io_addr_range *piar; 216 - 217 - /* Walk tree, find a place to insert into tree */ 218 - while (*p) { 219 - parent = *p; 220 - piar = rb_entry(parent, struct pci_io_addr_range, rb_node); 221 - if (ahi < piar->addr_lo) { 222 - p = &parent->rb_left; 223 - } else if (alo > piar->addr_hi) { 224 - p = &parent->rb_right; 225 - } else { 226 - if (dev != piar->pcidev || 227 - alo != piar->addr_lo || ahi != piar->addr_hi) { 228 - printk(KERN_WARNING "PIAR: overlapping address range\n"); 229 - } 230 - return piar; 231 - } 232 - } 233 - piar = (struct pci_io_addr_range *)kmalloc(sizeof(struct pci_io_addr_range), GFP_ATOMIC); 234 - if (!piar) 235 - return NULL; 236 - 237 - piar->addr_lo = alo; 238 - piar->addr_hi = ahi; 239 - piar->pcidev = dev; 240 - piar->flags = flags; 241 - 242 - #ifdef DEBUG 243 - printk(KERN_DEBUG "PIAR: insert range=[%lx:%lx] dev=%s\n", 244 - alo, ahi, pci_name (dev)); 245 - #endif 246 - 247 - rb_link_node(&piar->rb_node, parent, p); 248 - rb_insert_color(&piar->rb_node, &pci_io_addr_cache_root.rb_root); 249 - 250 - return piar; 251 - } 252 - 253 - static void __pci_addr_cache_insert_device(struct pci_dev *dev) 254 - { 255 - struct device_node *dn; 256 - struct pci_dn *pdn; 257 - int i; 258 - int inserted = 0; 259 - 260 - dn = pci_device_to_OF_node(dev); 261 - if (!dn) { 262 - printk(KERN_WARNING "PCI: no pci dn found for dev=%s\n", pci_name(dev)); 263 - return; 264 - } 265 - 266 - /* Skip any devices for which EEH is not enabled. */ 267 - pdn = PCI_DN(dn); 268 - if (!(pdn->eeh_mode & EEH_MODE_SUPPORTED) || 269 - pdn->eeh_mode & EEH_MODE_NOCHECK) { 270 - #ifdef DEBUG 271 - printk(KERN_INFO "PCI: skip building address cache for=%s - %s\n", 272 - pci_name(dev), pdn->node->full_name); 273 - #endif 274 - return; 275 - } 276 - 277 - /* The cache holds a reference to the device... */ 278 - pci_dev_get(dev); 279 - 280 - /* Walk resources on this device, poke them into the tree */ 281 - for (i = 0; i < DEVICE_COUNT_RESOURCE; i++) { 282 - unsigned long start = pci_resource_start(dev,i); 283 - unsigned long end = pci_resource_end(dev,i); 284 - unsigned int flags = pci_resource_flags(dev,i); 285 - 286 - /* We are interested only bus addresses, not dma or other stuff */ 287 - if (0 == (flags & (IORESOURCE_IO | IORESOURCE_MEM))) 288 - continue; 289 - if (start == 0 || ~start == 0 || end == 0 || ~end == 0) 290 - continue; 291 - pci_addr_cache_insert(dev, start, end, flags); 292 - inserted = 1; 293 - } 294 - 295 - /* If there was nothing to add, the cache has no reference... */ 296 - if (!inserted) 297 - pci_dev_put(dev); 298 - } 299 - 300 - /** 301 - * pci_addr_cache_insert_device - Add a device to the address cache 302 - * @dev: PCI device whose I/O addresses we are interested in. 303 - * 304 - * In order to support the fast lookup of devices based on addresses, 305 - * we maintain a cache of devices that can be quickly searched. 306 - * This routine adds a device to that cache. 307 - */ 308 - static void pci_addr_cache_insert_device(struct pci_dev *dev) 309 - { 310 - unsigned long flags; 311 - 312 - spin_lock_irqsave(&pci_io_addr_cache_root.piar_lock, flags); 313 - __pci_addr_cache_insert_device(dev); 314 - spin_unlock_irqrestore(&pci_io_addr_cache_root.piar_lock, flags); 315 - } 316 - 317 - static inline void __pci_addr_cache_remove_device(struct pci_dev *dev) 318 - { 319 - struct rb_node *n; 320 - int removed = 0; 321 - 322 - restart: 323 - n = rb_first(&pci_io_addr_cache_root.rb_root); 324 - while (n) { 325 - struct pci_io_addr_range *piar; 326 - piar = rb_entry(n, struct pci_io_addr_range, rb_node); 327 - 328 - if (piar->pcidev == dev) { 329 - rb_erase(n, &pci_io_addr_cache_root.rb_root); 330 - removed = 1; 331 - kfree(piar); 332 - goto restart; 333 - } 334 - n = rb_next(n); 335 - } 336 - 337 - /* The cache no longer holds its reference to this device... */ 338 - if (removed) 339 - pci_dev_put(dev); 340 - } 341 - 342 - /** 343 - * pci_addr_cache_remove_device - remove pci device from addr cache 344 - * @dev: device to remove 345 - * 346 - * Remove a device from the addr-cache tree. 347 - * This is potentially expensive, since it will walk 348 - * the tree multiple times (once per resource). 349 - * But so what; device removal doesn't need to be that fast. 350 - */ 351 - static void pci_addr_cache_remove_device(struct pci_dev *dev) 352 - { 353 - unsigned long flags; 354 - 355 - spin_lock_irqsave(&pci_io_addr_cache_root.piar_lock, flags); 356 - __pci_addr_cache_remove_device(dev); 357 - spin_unlock_irqrestore(&pci_io_addr_cache_root.piar_lock, flags); 358 - } 359 - 360 - /** 361 - * pci_addr_cache_build - Build a cache of I/O addresses 362 - * 363 - * Build a cache of pci i/o addresses. This cache will be used to 364 - * find the pci device that corresponds to a given address. 365 - * This routine scans all pci busses to build the cache. 366 - * Must be run late in boot process, after the pci controllers 367 - * have been scaned for devices (after all device resources are known). 368 - */ 369 - void __init pci_addr_cache_build(void) 370 - { 371 - struct device_node *dn; 372 - struct pci_dev *dev = NULL; 373 - 374 - if (!eeh_subsystem_enabled) 375 - return; 376 - 377 - spin_lock_init(&pci_io_addr_cache_root.piar_lock); 378 - 379 - while ((dev = pci_get_device(PCI_ANY_ID, PCI_ANY_ID, dev)) != NULL) { 380 - /* Ignore PCI bridges ( XXX why ??) */ 381 - if ((dev->class >> 16) == PCI_BASE_CLASS_BRIDGE) { 382 - continue; 383 - } 384 - pci_addr_cache_insert_device(dev); 385 - 386 - /* Save the BAR's; firmware doesn't restore these after EEH reset */ 387 - dn = pci_device_to_OF_node(dev); 388 - eeh_save_bars(dev, PCI_DN(dn)); 389 - } 390 - 391 - #ifdef DEBUG 392 - /* Verify tree built up above, echo back the list of addrs. */ 393 - pci_addr_cache_print(&pci_io_addr_cache_root); 394 - #endif 395 - } 110 + #define IS_BRIDGE(class_code) (((class_code)<<16) == PCI_BASE_CLASS_BRIDGE) 396 111 397 112 /* --------------------------------------------------------------- */ 398 - /* Above lies the PCI Address Cache. Below lies the EEH event infrastructure */ 113 + /* Below lies the EEH event infrastructure */ 399 114 400 115 void eeh_slot_error_detail (struct pci_dn *pdn, int severity) 401 116 { 117 + int config_addr; 402 118 unsigned long flags; 403 119 int rc; 404 120 ··· 121 407 spin_lock_irqsave(&slot_errbuf_lock, flags); 122 408 memset(slot_errbuf, 0, eeh_error_buf_size); 123 409 410 + /* Use PE configuration address, if present */ 411 + config_addr = pdn->eeh_config_addr; 412 + if (pdn->eeh_pe_config_addr) 413 + config_addr = pdn->eeh_pe_config_addr; 414 + 124 415 rc = rtas_call(ibm_slot_error_detail, 125 - 8, 1, NULL, pdn->eeh_config_addr, 416 + 8, 1, NULL, config_addr, 126 417 BUID_HI(pdn->phb->buid), 127 418 BUID_LO(pdn->phb->buid), NULL, 0, 128 419 virt_to_phys(slot_errbuf), ··· 147 428 static int read_slot_reset_state(struct pci_dn *pdn, int rets[]) 148 429 { 149 430 int token, outputs; 431 + int config_addr; 150 432 151 433 if (ibm_read_slot_reset_state2 != RTAS_UNKNOWN_SERVICE) { 152 434 token = ibm_read_slot_reset_state2; ··· 158 438 outputs = 3; 159 439 } 160 440 161 - return rtas_call(token, 3, outputs, rets, pdn->eeh_config_addr, 441 + /* Use PE configuration address, if present */ 442 + config_addr = pdn->eeh_config_addr; 443 + if (pdn->eeh_pe_config_addr) 444 + config_addr = pdn->eeh_pe_config_addr; 445 + 446 + return rtas_call(token, 3, outputs, rets, config_addr, 162 447 BUID_HI(pdn->phb->buid), BUID_LO(pdn->phb->buid)); 163 448 } 164 449 ··· 187 462 /** 188 463 * Return the "partitionable endpoint" (pe) under which this device lies 189 464 */ 190 - static struct device_node * find_device_pe(struct device_node *dn) 465 + struct device_node * find_device_pe(struct device_node *dn) 191 466 { 192 467 while ((dn->parent) && PCI_DN(dn->parent) && 193 468 (PCI_DN(dn->parent)->eeh_mode & EEH_MODE_SUPPORTED)) { ··· 210 485 if (PCI_DN(dn)) { 211 486 PCI_DN(dn)->eeh_mode |= mode_flag; 212 487 488 + /* Mark the pci device driver too */ 489 + struct pci_dev *dev = PCI_DN(dn)->pcidev; 490 + if (dev && dev->driver) 491 + dev->error_state = pci_channel_io_frozen; 492 + 213 493 if (dn->child) 214 494 __eeh_mark_slot (dn->child, mode_flag); 215 495 } ··· 225 495 void eeh_mark_slot (struct device_node *dn, int mode_flag) 226 496 { 227 497 dn = find_device_pe (dn); 498 + 499 + /* Back up one, since config addrs might be shared */ 500 + if (PCI_DN(dn) && PCI_DN(dn)->eeh_pe_config_addr) 501 + dn = dn->parent; 502 + 228 503 PCI_DN(dn)->eeh_mode |= mode_flag; 229 504 __eeh_mark_slot (dn->child, mode_flag); 230 505 } ··· 251 516 { 252 517 unsigned long flags; 253 518 spin_lock_irqsave(&confirm_error_lock, flags); 519 + 254 520 dn = find_device_pe (dn); 521 + 522 + /* Back up one, since config addrs might be shared */ 523 + if (PCI_DN(dn) && PCI_DN(dn)->eeh_pe_config_addr) 524 + dn = dn->parent; 525 + 255 526 PCI_DN(dn)->eeh_mode &= ~mode_flag; 256 527 PCI_DN(dn)->eeh_check_count = 0; 257 528 __eeh_clear_slot (dn->child, mode_flag); ··· 285 544 int rets[3]; 286 545 unsigned long flags; 287 546 struct pci_dn *pdn; 547 + enum pci_channel_state state; 288 548 int rc = 0; 289 549 290 - __get_cpu_var(total_mmio_ffs)++; 550 + total_mmio_ffs++; 291 551 292 552 if (!eeh_subsystem_enabled) 293 553 return 0; 294 554 295 555 if (!dn) { 296 - __get_cpu_var(no_dn)++; 556 + no_dn++; 297 557 return 0; 298 558 } 299 559 pdn = PCI_DN(dn); ··· 302 560 /* Access to IO BARs might get this far and still not want checking. */ 303 561 if (!(pdn->eeh_mode & EEH_MODE_SUPPORTED) || 304 562 pdn->eeh_mode & EEH_MODE_NOCHECK) { 305 - __get_cpu_var(ignored_check)++; 563 + ignored_check++; 306 564 #ifdef DEBUG 307 565 printk ("EEH:ignored check (%x) for %s %s\n", 308 566 pdn->eeh_mode, pci_name (dev), dn->full_name); ··· 310 568 return 0; 311 569 } 312 570 313 - if (!pdn->eeh_config_addr) { 314 - __get_cpu_var(no_cfg_addr)++; 571 + if (!pdn->eeh_config_addr && !pdn->eeh_pe_config_addr) { 572 + no_cfg_addr++; 315 573 return 0; 316 574 } 317 575 ··· 353 611 if (ret != 0) { 354 612 printk(KERN_WARNING "EEH: read_slot_reset_state() failed; rc=%d dn=%s\n", 355 613 ret, dn->full_name); 356 - __get_cpu_var(false_positives)++; 614 + false_positives++; 357 615 rc = 0; 358 616 goto dn_unlock; 359 617 } ··· 362 620 if (rets[1] != 1) { 363 621 printk(KERN_WARNING "EEH: event on unsupported device, rc=%d dn=%s\n", 364 622 ret, dn->full_name); 365 - __get_cpu_var(false_positives)++; 623 + false_positives++; 366 624 rc = 0; 367 625 goto dn_unlock; 368 626 } 369 627 370 628 /* If not the kind of error we know about, punt. */ 371 629 if (rets[0] != 2 && rets[0] != 4 && rets[0] != 5) { 372 - __get_cpu_var(false_positives)++; 630 + false_positives++; 373 631 rc = 0; 374 632 goto dn_unlock; 375 633 } ··· 377 635 /* Note that config-io to empty slots may fail; 378 636 * we recognize empty because they don't have children. */ 379 637 if ((rets[0] == 5) && (dn->child == NULL)) { 380 - __get_cpu_var(false_positives)++; 638 + false_positives++; 381 639 rc = 0; 382 640 goto dn_unlock; 383 641 } 384 642 385 - __get_cpu_var(slot_resets)++; 643 + slot_resets++; 386 644 387 645 /* Avoid repeated reports of this failure, including problems 388 646 * with other functions on this device, and functions under ··· 390 648 eeh_mark_slot (dn, EEH_MODE_ISOLATED); 391 649 spin_unlock_irqrestore(&confirm_error_lock, flags); 392 650 393 - eeh_send_failure_event (dn, dev, rets[0], rets[2]); 394 - 651 + state = pci_channel_io_normal; 652 + if ((rets[0] == 2) || (rets[0] == 4)) 653 + state = pci_channel_io_frozen; 654 + if (rets[0] == 5) 655 + state = pci_channel_io_perm_failure; 656 + eeh_send_failure_event (dn, dev, state, rets[2]); 657 + 395 658 /* Most EEH events are due to device driver bugs. Having 396 659 * a stack trace will help the device-driver authors figure 397 660 * out what happened. So print that out. */ ··· 432 685 addr = eeh_token_to_phys((unsigned long __force) token); 433 686 dev = pci_get_device_by_addr(addr); 434 687 if (!dev) { 435 - __get_cpu_var(no_device)++; 688 + no_device++; 436 689 return val; 437 690 } 438 691 ··· 463 716 if (rc) return rc; 464 717 465 718 if (rets[1] == 0) return -1; /* EEH is not supported */ 466 - if (rets[0] == 0) return 0; /* Oll Korrect */ 719 + if (rets[0] == 0) return 0; /* Oll Korrect */ 467 720 if (rets[0] == 5) { 468 721 if (rets[2] == 0) return -1; /* permanently unavailable */ 469 722 return rets[2]; /* number of millisecs to wait */ 470 723 } 724 + if (rets[0] == 1) 725 + return 250; 726 + 727 + printk (KERN_ERR "EEH: Slot unavailable: rc=%d, rets=%d %d %d\n", 728 + rc, rets[0], rets[1], rets[2]); 471 729 return -1; 472 730 } 473 731 ··· 489 737 static void 490 738 rtas_pci_slot_reset(struct pci_dn *pdn, int state) 491 739 { 740 + int config_addr; 492 741 int rc; 493 742 494 743 BUG_ON (pdn==NULL); ··· 500 747 return; 501 748 } 502 749 750 + /* Use PE configuration address, if present */ 751 + config_addr = pdn->eeh_config_addr; 752 + if (pdn->eeh_pe_config_addr) 753 + config_addr = pdn->eeh_pe_config_addr; 754 + 503 755 rc = rtas_call(ibm_set_slot_reset,4,1, NULL, 504 - pdn->eeh_config_addr, 756 + config_addr, 505 757 BUID_HI(pdn->phb->buid), 506 758 BUID_LO(pdn->phb->buid), 507 759 state); ··· 519 761 520 762 /** rtas_set_slot_reset -- assert the pci #RST line for 1/4 second 521 763 * dn -- device node to be reset. 764 + * 765 + * Return 0 if success, else a non-zero value. 522 766 */ 523 767 524 - void 768 + int 525 769 rtas_set_slot_reset(struct pci_dn *pdn) 526 770 { 527 771 int i, rc; ··· 553 793 * ready to be used; if not, wait for recovery. */ 554 794 for (i=0; i<10; i++) { 555 795 rc = eeh_slot_availability (pdn); 556 - if (rc <= 0) break; 796 + if (rc < 0) 797 + printk (KERN_ERR "EEH: failed (%d) to reset slot %s\n", rc, pdn->node->full_name); 798 + if (rc == 0) 799 + return 0; 800 + if (rc < 0) 801 + return -1; 557 802 558 803 msleep (rc+100); 559 804 } 805 + 806 + rc = eeh_slot_availability (pdn); 807 + if (rc) 808 + printk (KERN_ERR "EEH: timeout resetting slot %s\n", pdn->node->full_name); 809 + 810 + return rc; 560 811 } 561 812 562 813 /* ------------------------------------------------------- */ ··· 622 851 if (!pdn) 623 852 return; 624 853 625 - if (! pdn->eeh_is_bridge) 854 + if ((pdn->eeh_mode & EEH_MODE_SUPPORTED) && !IS_BRIDGE(pdn->class_code)) 626 855 __restore_bars (pdn); 627 856 628 857 dn = pdn->node->child; ··· 640 869 * PCI devices are added individuallly; but, for the restore, 641 870 * an entire slot is reset at a time. 642 871 */ 643 - static void eeh_save_bars(struct pci_dev * pdev, struct pci_dn *pdn) 872 + static void eeh_save_bars(struct pci_dn *pdn) 644 873 { 645 874 int i; 646 875 647 - if (!pdev || !pdn ) 876 + if (!pdn ) 648 877 return; 649 878 650 879 for (i = 0; i < 16; i++) 651 - pci_read_config_dword(pdev, i * 4, &pdn->config_space[i]); 652 - 653 - if (pdev->hdr_type == PCI_HEADER_TYPE_BRIDGE) 654 - pdn->eeh_is_bridge = 1; 880 + rtas_read_config(pdn, i * 4, 4, &pdn->config_space[i]); 655 881 } 656 882 657 883 void 658 884 rtas_configure_bridge(struct pci_dn *pdn) 659 885 { 660 - int token = rtas_token ("ibm,configure-bridge"); 886 + int config_addr; 661 887 int rc; 662 888 663 - if (token == RTAS_UNKNOWN_SERVICE) 664 - return; 665 - rc = rtas_call(token,3,1, NULL, 666 - pdn->eeh_config_addr, 889 + /* Use PE configuration address, if present */ 890 + config_addr = pdn->eeh_config_addr; 891 + if (pdn->eeh_pe_config_addr) 892 + config_addr = pdn->eeh_pe_config_addr; 893 + 894 + rc = rtas_call(ibm_configure_bridge,3,1, NULL, 895 + config_addr, 667 896 BUID_HI(pdn->phb->buid), 668 897 BUID_LO(pdn->phb->buid)); 669 898 if (rc) { ··· 698 927 int enable; 699 928 struct pci_dn *pdn = PCI_DN(dn); 700 929 930 + pdn->class_code = 0; 701 931 pdn->eeh_mode = 0; 702 932 pdn->eeh_check_count = 0; 703 933 pdn->eeh_freeze_count = 0; ··· 715 943 pdn->eeh_mode |= EEH_MODE_NOCHECK; 716 944 return NULL; 717 945 } 946 + pdn->class_code = *class_code; 718 947 719 948 /* 720 949 * Now decide if we are going to "Disable" EEH checking ··· 726 953 * But there are a few cases like display devices that make sense. 727 954 */ 728 955 enable = 1; /* i.e. we will do checking */ 956 + #if 0 729 957 if ((*class_code >> 16) == PCI_BASE_CLASS_DISPLAY) 730 958 enable = 0; 959 + #endif 731 960 732 961 if (!enable) 733 962 pdn->eeh_mode |= EEH_MODE_NOCHECK; ··· 748 973 eeh_subsystem_enabled = 1; 749 974 pdn->eeh_mode |= EEH_MODE_SUPPORTED; 750 975 pdn->eeh_config_addr = regs[0]; 976 + 977 + /* If the newer, better, ibm,get-config-addr-info is supported, 978 + * then use that instead. */ 979 + pdn->eeh_pe_config_addr = 0; 980 + if (ibm_get_config_addr_info != RTAS_UNKNOWN_SERVICE) { 981 + unsigned int rets[2]; 982 + ret = rtas_call (ibm_get_config_addr_info, 4, 2, rets, 983 + pdn->eeh_config_addr, 984 + info->buid_hi, info->buid_lo, 985 + 0); 986 + if (ret == 0) 987 + pdn->eeh_pe_config_addr = rets[0]; 988 + } 751 989 #ifdef DEBUG 752 - printk(KERN_DEBUG "EEH: %s: eeh enabled\n", dn->full_name); 990 + printk(KERN_DEBUG "EEH: %s: eeh enabled, config=%x pe_config=%x\n", 991 + dn->full_name, pdn->eeh_config_addr, pdn->eeh_pe_config_addr); 753 992 #endif 754 993 } else { 755 994 ··· 782 993 dn->full_name); 783 994 } 784 995 996 + eeh_save_bars(pdn); 785 997 return NULL; 786 998 } 787 999 ··· 816 1026 ibm_read_slot_reset_state2 = rtas_token("ibm,read-slot-reset-state2"); 817 1027 ibm_read_slot_reset_state = rtas_token("ibm,read-slot-reset-state"); 818 1028 ibm_slot_error_detail = rtas_token("ibm,slot-error-detail"); 1029 + ibm_get_config_addr_info = rtas_token("ibm,get-config-addr-info"); 1030 + ibm_configure_bridge = rtas_token ("ibm,configure-bridge"); 819 1031 820 1032 if (ibm_set_eeh_option == RTAS_UNKNOWN_SERVICE) 821 1033 return; ··· 872 1080 if (!dn || !PCI_DN(dn)) 873 1081 return; 874 1082 phb = PCI_DN(dn)->phb; 875 - if (NULL == phb || 0 == phb->buid) { 876 - printk(KERN_WARNING "EEH: Expected buid but found none for %s\n", 877 - dn->full_name); 878 - dump_stack(); 1083 + 1084 + /* USB Bus children of PCI devices will not have BUID's */ 1085 + if (NULL == phb || 0 == phb->buid) 879 1086 return; 880 - } 881 1087 882 1088 info.buid_hi = BUID_HI(phb->buid); 883 1089 info.buid_lo = BUID_LO(phb->buid); ··· 917 1127 pdn->pcidev = dev; 918 1128 919 1129 pci_addr_cache_insert_device (dev); 920 - eeh_save_bars(dev, pdn); 921 1130 } 922 1131 EXPORT_SYMBOL_GPL(eeh_add_device_late); 923 1132 ··· 964 1175 965 1176 static int proc_eeh_show(struct seq_file *m, void *v) 966 1177 { 967 - unsigned int cpu; 968 - unsigned long ffs = 0, positives = 0, failures = 0; 969 - unsigned long resets = 0; 970 - unsigned long no_dev = 0, no_dn = 0, no_cfg = 0, no_check = 0; 971 - 972 - for_each_cpu(cpu) { 973 - ffs += per_cpu(total_mmio_ffs, cpu); 974 - positives += per_cpu(false_positives, cpu); 975 - failures += per_cpu(ignored_failures, cpu); 976 - resets += per_cpu(slot_resets, cpu); 977 - no_dev += per_cpu(no_device, cpu); 978 - no_dn += per_cpu(no_dn, cpu); 979 - no_cfg += per_cpu(no_cfg_addr, cpu); 980 - no_check += per_cpu(ignored_check, cpu); 981 - } 982 - 983 1178 if (0 == eeh_subsystem_enabled) { 984 1179 seq_printf(m, "EEH Subsystem is globally disabled\n"); 985 - seq_printf(m, "eeh_total_mmio_ffs=%ld\n", ffs); 1180 + seq_printf(m, "eeh_total_mmio_ffs=%ld\n", total_mmio_ffs); 986 1181 } else { 987 1182 seq_printf(m, "EEH Subsystem is enabled\n"); 988 1183 seq_printf(m, ··· 978 1205 "eeh_false_positives=%ld\n" 979 1206 "eeh_ignored_failures=%ld\n" 980 1207 "eeh_slot_resets=%ld\n", 981 - no_dev, no_dn, no_cfg, no_check, 982 - ffs, positives, failures, resets); 1208 + no_device, no_dn, no_cfg_addr, 1209 + ignored_check, total_mmio_ffs, 1210 + false_positives, ignored_failures, 1211 + slot_resets); 983 1212 } 984 1213 985 1214 return 0;
+316
arch/powerpc/platforms/pseries/eeh_cache.c
··· 1 + /* 2 + * eeh_cache.c 3 + * PCI address cache; allows the lookup of PCI devices based on I/O address 4 + * 5 + * Copyright (C) 2004 Linas Vepstas <linas@austin.ibm.com> IBM Corporation 6 + * 7 + * This program is free software; you can redistribute it and/or modify 8 + * it under the terms of the GNU General Public License as published by 9 + * the Free Software Foundation; either version 2 of the License, or 10 + * (at your option) any later version. 11 + * 12 + * This program is distributed in the hope that it will be useful, 13 + * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 + * GNU General Public License for more details. 16 + * 17 + * You should have received a copy of the GNU General Public License 18 + * along with this program; if not, write to the Free Software 19 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 20 + */ 21 + 22 + #include <linux/list.h> 23 + #include <linux/pci.h> 24 + #include <linux/rbtree.h> 25 + #include <linux/spinlock.h> 26 + #include <asm/atomic.h> 27 + #include <asm/pci-bridge.h> 28 + #include <asm/ppc-pci.h> 29 + 30 + #undef DEBUG 31 + 32 + /** 33 + * The pci address cache subsystem. This subsystem places 34 + * PCI device address resources into a red-black tree, sorted 35 + * according to the address range, so that given only an i/o 36 + * address, the corresponding PCI device can be **quickly** 37 + * found. It is safe to perform an address lookup in an interrupt 38 + * context; this ability is an important feature. 39 + * 40 + * Currently, the only customer of this code is the EEH subsystem; 41 + * thus, this code has been somewhat tailored to suit EEH better. 42 + * In particular, the cache does *not* hold the addresses of devices 43 + * for which EEH is not enabled. 44 + * 45 + * (Implementation Note: The RB tree seems to be better/faster 46 + * than any hash algo I could think of for this problem, even 47 + * with the penalty of slow pointer chases for d-cache misses). 48 + */ 49 + struct pci_io_addr_range 50 + { 51 + struct rb_node rb_node; 52 + unsigned long addr_lo; 53 + unsigned long addr_hi; 54 + struct pci_dev *pcidev; 55 + unsigned int flags; 56 + }; 57 + 58 + static struct pci_io_addr_cache 59 + { 60 + struct rb_root rb_root; 61 + spinlock_t piar_lock; 62 + } pci_io_addr_cache_root; 63 + 64 + static inline struct pci_dev *__pci_get_device_by_addr(unsigned long addr) 65 + { 66 + struct rb_node *n = pci_io_addr_cache_root.rb_root.rb_node; 67 + 68 + while (n) { 69 + struct pci_io_addr_range *piar; 70 + piar = rb_entry(n, struct pci_io_addr_range, rb_node); 71 + 72 + if (addr < piar->addr_lo) { 73 + n = n->rb_left; 74 + } else { 75 + if (addr > piar->addr_hi) { 76 + n = n->rb_right; 77 + } else { 78 + pci_dev_get(piar->pcidev); 79 + return piar->pcidev; 80 + } 81 + } 82 + } 83 + 84 + return NULL; 85 + } 86 + 87 + /** 88 + * pci_get_device_by_addr - Get device, given only address 89 + * @addr: mmio (PIO) phys address or i/o port number 90 + * 91 + * Given an mmio phys address, or a port number, find a pci device 92 + * that implements this address. Be sure to pci_dev_put the device 93 + * when finished. I/O port numbers are assumed to be offset 94 + * from zero (that is, they do *not* have pci_io_addr added in). 95 + * It is safe to call this function within an interrupt. 96 + */ 97 + struct pci_dev *pci_get_device_by_addr(unsigned long addr) 98 + { 99 + struct pci_dev *dev; 100 + unsigned long flags; 101 + 102 + spin_lock_irqsave(&pci_io_addr_cache_root.piar_lock, flags); 103 + dev = __pci_get_device_by_addr(addr); 104 + spin_unlock_irqrestore(&pci_io_addr_cache_root.piar_lock, flags); 105 + return dev; 106 + } 107 + 108 + #ifdef DEBUG 109 + /* 110 + * Handy-dandy debug print routine, does nothing more 111 + * than print out the contents of our addr cache. 112 + */ 113 + static void pci_addr_cache_print(struct pci_io_addr_cache *cache) 114 + { 115 + struct rb_node *n; 116 + int cnt = 0; 117 + 118 + n = rb_first(&cache->rb_root); 119 + while (n) { 120 + struct pci_io_addr_range *piar; 121 + piar = rb_entry(n, struct pci_io_addr_range, rb_node); 122 + printk(KERN_DEBUG "PCI: %s addr range %d [%lx-%lx]: %s\n", 123 + (piar->flags & IORESOURCE_IO) ? "i/o" : "mem", cnt, 124 + piar->addr_lo, piar->addr_hi, pci_name(piar->pcidev)); 125 + cnt++; 126 + n = rb_next(n); 127 + } 128 + } 129 + #endif 130 + 131 + /* Insert address range into the rb tree. */ 132 + static struct pci_io_addr_range * 133 + pci_addr_cache_insert(struct pci_dev *dev, unsigned long alo, 134 + unsigned long ahi, unsigned int flags) 135 + { 136 + struct rb_node **p = &pci_io_addr_cache_root.rb_root.rb_node; 137 + struct rb_node *parent = NULL; 138 + struct pci_io_addr_range *piar; 139 + 140 + /* Walk tree, find a place to insert into tree */ 141 + while (*p) { 142 + parent = *p; 143 + piar = rb_entry(parent, struct pci_io_addr_range, rb_node); 144 + if (ahi < piar->addr_lo) { 145 + p = &parent->rb_left; 146 + } else if (alo > piar->addr_hi) { 147 + p = &parent->rb_right; 148 + } else { 149 + if (dev != piar->pcidev || 150 + alo != piar->addr_lo || ahi != piar->addr_hi) { 151 + printk(KERN_WARNING "PIAR: overlapping address range\n"); 152 + } 153 + return piar; 154 + } 155 + } 156 + piar = (struct pci_io_addr_range *)kmalloc(sizeof(struct pci_io_addr_range), GFP_ATOMIC); 157 + if (!piar) 158 + return NULL; 159 + 160 + piar->addr_lo = alo; 161 + piar->addr_hi = ahi; 162 + piar->pcidev = dev; 163 + piar->flags = flags; 164 + 165 + #ifdef DEBUG 166 + printk(KERN_DEBUG "PIAR: insert range=[%lx:%lx] dev=%s\n", 167 + alo, ahi, pci_name (dev)); 168 + #endif 169 + 170 + rb_link_node(&piar->rb_node, parent, p); 171 + rb_insert_color(&piar->rb_node, &pci_io_addr_cache_root.rb_root); 172 + 173 + return piar; 174 + } 175 + 176 + static void __pci_addr_cache_insert_device(struct pci_dev *dev) 177 + { 178 + struct device_node *dn; 179 + struct pci_dn *pdn; 180 + int i; 181 + int inserted = 0; 182 + 183 + dn = pci_device_to_OF_node(dev); 184 + if (!dn) { 185 + printk(KERN_WARNING "PCI: no pci dn found for dev=%s\n", pci_name(dev)); 186 + return; 187 + } 188 + 189 + /* Skip any devices for which EEH is not enabled. */ 190 + pdn = PCI_DN(dn); 191 + if (!(pdn->eeh_mode & EEH_MODE_SUPPORTED) || 192 + pdn->eeh_mode & EEH_MODE_NOCHECK) { 193 + #ifdef DEBUG 194 + printk(KERN_INFO "PCI: skip building address cache for=%s - %s\n", 195 + pci_name(dev), pdn->node->full_name); 196 + #endif 197 + return; 198 + } 199 + 200 + /* The cache holds a reference to the device... */ 201 + pci_dev_get(dev); 202 + 203 + /* Walk resources on this device, poke them into the tree */ 204 + for (i = 0; i < DEVICE_COUNT_RESOURCE; i++) { 205 + unsigned long start = pci_resource_start(dev,i); 206 + unsigned long end = pci_resource_end(dev,i); 207 + unsigned int flags = pci_resource_flags(dev,i); 208 + 209 + /* We are interested only bus addresses, not dma or other stuff */ 210 + if (0 == (flags & (IORESOURCE_IO | IORESOURCE_MEM))) 211 + continue; 212 + if (start == 0 || ~start == 0 || end == 0 || ~end == 0) 213 + continue; 214 + pci_addr_cache_insert(dev, start, end, flags); 215 + inserted = 1; 216 + } 217 + 218 + /* If there was nothing to add, the cache has no reference... */ 219 + if (!inserted) 220 + pci_dev_put(dev); 221 + } 222 + 223 + /** 224 + * pci_addr_cache_insert_device - Add a device to the address cache 225 + * @dev: PCI device whose I/O addresses we are interested in. 226 + * 227 + * In order to support the fast lookup of devices based on addresses, 228 + * we maintain a cache of devices that can be quickly searched. 229 + * This routine adds a device to that cache. 230 + */ 231 + void pci_addr_cache_insert_device(struct pci_dev *dev) 232 + { 233 + unsigned long flags; 234 + 235 + spin_lock_irqsave(&pci_io_addr_cache_root.piar_lock, flags); 236 + __pci_addr_cache_insert_device(dev); 237 + spin_unlock_irqrestore(&pci_io_addr_cache_root.piar_lock, flags); 238 + } 239 + 240 + static inline void __pci_addr_cache_remove_device(struct pci_dev *dev) 241 + { 242 + struct rb_node *n; 243 + int removed = 0; 244 + 245 + restart: 246 + n = rb_first(&pci_io_addr_cache_root.rb_root); 247 + while (n) { 248 + struct pci_io_addr_range *piar; 249 + piar = rb_entry(n, struct pci_io_addr_range, rb_node); 250 + 251 + if (piar->pcidev == dev) { 252 + rb_erase(n, &pci_io_addr_cache_root.rb_root); 253 + removed = 1; 254 + kfree(piar); 255 + goto restart; 256 + } 257 + n = rb_next(n); 258 + } 259 + 260 + /* The cache no longer holds its reference to this device... */ 261 + if (removed) 262 + pci_dev_put(dev); 263 + } 264 + 265 + /** 266 + * pci_addr_cache_remove_device - remove pci device from addr cache 267 + * @dev: device to remove 268 + * 269 + * Remove a device from the addr-cache tree. 270 + * This is potentially expensive, since it will walk 271 + * the tree multiple times (once per resource). 272 + * But so what; device removal doesn't need to be that fast. 273 + */ 274 + void pci_addr_cache_remove_device(struct pci_dev *dev) 275 + { 276 + unsigned long flags; 277 + 278 + spin_lock_irqsave(&pci_io_addr_cache_root.piar_lock, flags); 279 + __pci_addr_cache_remove_device(dev); 280 + spin_unlock_irqrestore(&pci_io_addr_cache_root.piar_lock, flags); 281 + } 282 + 283 + /** 284 + * pci_addr_cache_build - Build a cache of I/O addresses 285 + * 286 + * Build a cache of pci i/o addresses. This cache will be used to 287 + * find the pci device that corresponds to a given address. 288 + * This routine scans all pci busses to build the cache. 289 + * Must be run late in boot process, after the pci controllers 290 + * have been scaned for devices (after all device resources are known). 291 + */ 292 + void __init pci_addr_cache_build(void) 293 + { 294 + struct device_node *dn; 295 + struct pci_dev *dev = NULL; 296 + 297 + spin_lock_init(&pci_io_addr_cache_root.piar_lock); 298 + 299 + while ((dev = pci_get_device(PCI_ANY_ID, PCI_ANY_ID, dev)) != NULL) { 300 + /* Ignore PCI bridges */ 301 + if ((dev->class >> 16) == PCI_BASE_CLASS_BRIDGE) 302 + continue; 303 + 304 + pci_addr_cache_insert_device(dev); 305 + 306 + dn = pci_device_to_OF_node(dev); 307 + pci_dev_get (dev); /* matching put is in eeh_remove_device() */ 308 + PCI_DN(dn)->pcidev = dev; 309 + } 310 + 311 + #ifdef DEBUG 312 + /* Verify tree built up above, echo back the list of addrs. */ 313 + pci_addr_cache_print(&pci_io_addr_cache_root); 314 + #endif 315 + } 316 +
+376
arch/powerpc/platforms/pseries/eeh_driver.c
··· 1 + /* 2 + * PCI Error Recovery Driver for RPA-compliant PPC64 platform. 3 + * Copyright (C) 2004, 2005 Linas Vepstas <linas@linas.org> 4 + * 5 + * All rights reserved. 6 + * 7 + * This program is free software; you can redistribute it and/or modify 8 + * it under the terms of the GNU General Public License as published by 9 + * the Free Software Foundation; either version 2 of the License, or (at 10 + * your option) any later version. 11 + * 12 + * This program is distributed in the hope that it will be useful, but 13 + * WITHOUT ANY WARRANTY; without even the implied warranty of 14 + * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or 15 + * NON INFRINGEMENT. See the GNU General Public License for more 16 + * details. 17 + * 18 + * You should have received a copy of the GNU General Public License 19 + * along with this program; if not, write to the Free Software 20 + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 21 + * 22 + * Send feedback to <linas@us.ibm.com> 23 + * 24 + */ 25 + #include <linux/delay.h> 26 + #include <linux/irq.h> 27 + #include <linux/interrupt.h> 28 + #include <linux/notifier.h> 29 + #include <linux/pci.h> 30 + #include <asm/eeh.h> 31 + #include <asm/eeh_event.h> 32 + #include <asm/ppc-pci.h> 33 + #include <asm/pci-bridge.h> 34 + #include <asm/prom.h> 35 + #include <asm/rtas.h> 36 + 37 + 38 + static inline const char * pcid_name (struct pci_dev *pdev) 39 + { 40 + if (pdev->dev.driver) 41 + return pdev->dev.driver->name; 42 + return ""; 43 + } 44 + 45 + #ifdef DEBUG 46 + static void print_device_node_tree (struct pci_dn *pdn, int dent) 47 + { 48 + int i; 49 + if (!pdn) return; 50 + for (i=0;i<dent; i++) 51 + printk(" "); 52 + printk("dn=%s mode=%x \tcfg_addr=%x pe_addr=%x \tfull=%s\n", 53 + pdn->node->name, pdn->eeh_mode, pdn->eeh_config_addr, 54 + pdn->eeh_pe_config_addr, pdn->node->full_name); 55 + dent += 3; 56 + struct device_node *pc = pdn->node->child; 57 + while (pc) { 58 + print_device_node_tree(PCI_DN(pc), dent); 59 + pc = pc->sibling; 60 + } 61 + } 62 + #endif 63 + 64 + /** 65 + * irq_in_use - return true if this irq is being used 66 + */ 67 + static int irq_in_use(unsigned int irq) 68 + { 69 + int rc = 0; 70 + unsigned long flags; 71 + struct irq_desc *desc = irq_desc + irq; 72 + 73 + spin_lock_irqsave(&desc->lock, flags); 74 + if (desc->action) 75 + rc = 1; 76 + spin_unlock_irqrestore(&desc->lock, flags); 77 + return rc; 78 + } 79 + 80 + /* ------------------------------------------------------- */ 81 + /** eeh_report_error - report an EEH error to each device, 82 + * collect up and merge the device responses. 83 + */ 84 + 85 + static void eeh_report_error(struct pci_dev *dev, void *userdata) 86 + { 87 + enum pci_ers_result rc, *res = userdata; 88 + struct pci_driver *driver = dev->driver; 89 + 90 + dev->error_state = pci_channel_io_frozen; 91 + 92 + if (!driver) 93 + return; 94 + 95 + if (irq_in_use (dev->irq)) { 96 + struct device_node *dn = pci_device_to_OF_node(dev); 97 + PCI_DN(dn)->eeh_mode |= EEH_MODE_IRQ_DISABLED; 98 + disable_irq_nosync(dev->irq); 99 + } 100 + if (!driver->err_handler) 101 + return; 102 + if (!driver->err_handler->error_detected) 103 + return; 104 + 105 + rc = driver->err_handler->error_detected (dev, pci_channel_io_frozen); 106 + if (*res == PCI_ERS_RESULT_NONE) *res = rc; 107 + if (*res == PCI_ERS_RESULT_NEED_RESET) return; 108 + if (*res == PCI_ERS_RESULT_DISCONNECT && 109 + rc == PCI_ERS_RESULT_NEED_RESET) *res = rc; 110 + } 111 + 112 + /** eeh_report_reset -- tell this device that the pci slot 113 + * has been reset. 114 + */ 115 + 116 + static void eeh_report_reset(struct pci_dev *dev, void *userdata) 117 + { 118 + struct pci_driver *driver = dev->driver; 119 + struct device_node *dn = pci_device_to_OF_node(dev); 120 + 121 + if (!driver) 122 + return; 123 + 124 + if ((PCI_DN(dn)->eeh_mode) & EEH_MODE_IRQ_DISABLED) { 125 + PCI_DN(dn)->eeh_mode &= ~EEH_MODE_IRQ_DISABLED; 126 + enable_irq(dev->irq); 127 + } 128 + if (!driver->err_handler) 129 + return; 130 + if (!driver->err_handler->slot_reset) 131 + return; 132 + 133 + driver->err_handler->slot_reset(dev); 134 + } 135 + 136 + static void eeh_report_resume(struct pci_dev *dev, void *userdata) 137 + { 138 + struct pci_driver *driver = dev->driver; 139 + 140 + dev->error_state = pci_channel_io_normal; 141 + 142 + if (!driver) 143 + return; 144 + if (!driver->err_handler) 145 + return; 146 + if (!driver->err_handler->resume) 147 + return; 148 + 149 + driver->err_handler->resume(dev); 150 + } 151 + 152 + static void eeh_report_failure(struct pci_dev *dev, void *userdata) 153 + { 154 + struct pci_driver *driver = dev->driver; 155 + 156 + dev->error_state = pci_channel_io_perm_failure; 157 + 158 + if (!driver) 159 + return; 160 + 161 + if (irq_in_use (dev->irq)) { 162 + struct device_node *dn = pci_device_to_OF_node(dev); 163 + PCI_DN(dn)->eeh_mode |= EEH_MODE_IRQ_DISABLED; 164 + disable_irq_nosync(dev->irq); 165 + } 166 + if (!driver->err_handler) 167 + return; 168 + if (!driver->err_handler->error_detected) 169 + return; 170 + driver->err_handler->error_detected(dev, pci_channel_io_perm_failure); 171 + } 172 + 173 + /* ------------------------------------------------------- */ 174 + /** 175 + * handle_eeh_events -- reset a PCI device after hard lockup. 176 + * 177 + * pSeries systems will isolate a PCI slot if the PCI-Host 178 + * bridge detects address or data parity errors, DMA's 179 + * occuring to wild addresses (which usually happen due to 180 + * bugs in device drivers or in PCI adapter firmware). 181 + * Slot isolations also occur if #SERR, #PERR or other misc 182 + * PCI-related errors are detected. 183 + * 184 + * Recovery process consists of unplugging the device driver 185 + * (which generated hotplug events to userspace), then issuing 186 + * a PCI #RST to the device, then reconfiguring the PCI config 187 + * space for all bridges & devices under this slot, and then 188 + * finally restarting the device drivers (which cause a second 189 + * set of hotplug events to go out to userspace). 190 + */ 191 + 192 + /** 193 + * eeh_reset_device() -- perform actual reset of a pci slot 194 + * Args: bus: pointer to the pci bus structure corresponding 195 + * to the isolated slot. A non-null value will 196 + * cause all devices under the bus to be removed 197 + * and then re-added. 198 + * pe_dn: pointer to a "Partionable Endpoint" device node. 199 + * This is the top-level structure on which pci 200 + * bus resets can be performed. 201 + */ 202 + 203 + static int eeh_reset_device (struct pci_dn *pe_dn, struct pci_bus *bus) 204 + { 205 + int rc; 206 + if (bus) 207 + pcibios_remove_pci_devices(bus); 208 + 209 + /* Reset the pci controller. (Asserts RST#; resets config space). 210 + * Reconfigure bridges and devices. Don't try to bring the system 211 + * up if the reset failed for some reason. */ 212 + rc = rtas_set_slot_reset(pe_dn); 213 + if (rc) 214 + return rc; 215 + 216 + /* New-style config addrs might be shared across multiple devices, 217 + * Walk over all functions on this device */ 218 + if (pe_dn->eeh_pe_config_addr) { 219 + struct device_node *pe = pe_dn->node; 220 + pe = pe->parent->child; 221 + while (pe) { 222 + struct pci_dn *ppe = PCI_DN(pe); 223 + if (pe_dn->eeh_pe_config_addr == ppe->eeh_pe_config_addr) { 224 + rtas_configure_bridge(ppe); 225 + eeh_restore_bars(ppe); 226 + } 227 + pe = pe->sibling; 228 + } 229 + } else { 230 + rtas_configure_bridge(pe_dn); 231 + eeh_restore_bars(pe_dn); 232 + } 233 + 234 + /* Give the system 5 seconds to finish running the user-space 235 + * hotplug shutdown scripts, e.g. ifdown for ethernet. Yes, 236 + * this is a hack, but if we don't do this, and try to bring 237 + * the device up before the scripts have taken it down, 238 + * potentially weird things happen. 239 + */ 240 + if (bus) { 241 + ssleep (5); 242 + pcibios_add_pci_devices(bus); 243 + } 244 + 245 + return 0; 246 + } 247 + 248 + /* The longest amount of time to wait for a pci device 249 + * to come back on line, in seconds. 250 + */ 251 + #define MAX_WAIT_FOR_RECOVERY 15 252 + 253 + void handle_eeh_events (struct eeh_event *event) 254 + { 255 + struct device_node *frozen_dn; 256 + struct pci_dn *frozen_pdn; 257 + struct pci_bus *frozen_bus; 258 + int rc = 0; 259 + enum pci_ers_result result = PCI_ERS_RESULT_NONE; 260 + 261 + frozen_dn = find_device_pe(event->dn); 262 + frozen_bus = pcibios_find_pci_bus(frozen_dn); 263 + 264 + if (!frozen_dn) { 265 + printk(KERN_ERR "EEH: Error: Cannot find partition endpoint for %s\n", 266 + pci_name(event->dev)); 267 + return; 268 + } 269 + 270 + /* There are two different styles for coming up with the PE. 271 + * In the old style, it was the highest EEH-capable device 272 + * which was always an EADS pci bridge. In the new style, 273 + * there might not be any EADS bridges, and even when there are, 274 + * the firmware marks them as "EEH incapable". So another 275 + * two-step is needed to find the pci bus.. */ 276 + if (!frozen_bus) 277 + frozen_bus = pcibios_find_pci_bus (frozen_dn->parent); 278 + 279 + if (!frozen_bus) { 280 + printk(KERN_ERR "EEH: Cannot find PCI bus for %s\n", 281 + frozen_dn->full_name); 282 + return; 283 + } 284 + 285 + #if 0 286 + /* We may get "permanent failure" messages on empty slots. 287 + * These are false alarms. Empty slots have no child dn. */ 288 + if ((event->state == pci_channel_io_perm_failure) && (frozen_device == NULL)) 289 + return; 290 + #endif 291 + 292 + frozen_pdn = PCI_DN(frozen_dn); 293 + frozen_pdn->eeh_freeze_count++; 294 + 295 + if (frozen_pdn->eeh_freeze_count > EEH_MAX_ALLOWED_FREEZES) 296 + goto hard_fail; 297 + 298 + /* If the reset state is a '5' and the time to reset is 0 (infinity) 299 + * or is more then 15 seconds, then mark this as a permanent failure. 300 + */ 301 + if ((event->state == pci_channel_io_perm_failure) && 302 + ((event->time_unavail <= 0) || 303 + (event->time_unavail > MAX_WAIT_FOR_RECOVERY*1000))) 304 + goto hard_fail; 305 + 306 + eeh_slot_error_detail(frozen_pdn, 1 /* Temporary Error */); 307 + printk(KERN_WARNING 308 + "EEH: This PCI device has failed %d times since last reboot: %s - %s\n", 309 + frozen_pdn->eeh_freeze_count, 310 + pci_name (frozen_pdn->pcidev), 311 + pcid_name(frozen_pdn->pcidev)); 312 + 313 + /* Walk the various device drivers attached to this slot through 314 + * a reset sequence, giving each an opportunity to do what it needs 315 + * to accomplish the reset. Each child gets a report of the 316 + * status ... if any child can't handle the reset, then the entire 317 + * slot is dlpar removed and added. 318 + */ 319 + pci_walk_bus(frozen_bus, eeh_report_error, &result); 320 + 321 + /* If all device drivers were EEH-unaware, then shut 322 + * down all of the device drivers, and hope they 323 + * go down willingly, without panicing the system. 324 + */ 325 + if (result == PCI_ERS_RESULT_NONE) { 326 + rc = eeh_reset_device(frozen_pdn, frozen_bus); 327 + if (rc) 328 + goto hard_fail; 329 + } 330 + 331 + /* If any device called out for a reset, then reset the slot */ 332 + if (result == PCI_ERS_RESULT_NEED_RESET) { 333 + rc = eeh_reset_device(frozen_pdn, NULL); 334 + if (rc) 335 + goto hard_fail; 336 + pci_walk_bus(frozen_bus, eeh_report_reset, 0); 337 + } 338 + 339 + /* If all devices reported they can proceed, the re-enable PIO */ 340 + if (result == PCI_ERS_RESULT_CAN_RECOVER) { 341 + /* XXX Not supported; we brute-force reset the device */ 342 + rc = eeh_reset_device(frozen_pdn, NULL); 343 + if (rc) 344 + goto hard_fail; 345 + pci_walk_bus(frozen_bus, eeh_report_reset, 0); 346 + } 347 + 348 + /* Tell all device drivers that they can resume operations */ 349 + pci_walk_bus(frozen_bus, eeh_report_resume, 0); 350 + 351 + return; 352 + 353 + hard_fail: 354 + /* 355 + * About 90% of all real-life EEH failures in the field 356 + * are due to poorly seated PCI cards. Only 10% or so are 357 + * due to actual, failed cards. 358 + */ 359 + printk(KERN_ERR 360 + "EEH: PCI device %s - %s has failed %d times \n" 361 + "and has been permanently disabled. Please try reseating\n" 362 + "this device or replacing it.\n", 363 + pci_name (frozen_pdn->pcidev), 364 + pcid_name(frozen_pdn->pcidev), 365 + frozen_pdn->eeh_freeze_count); 366 + 367 + eeh_slot_error_detail(frozen_pdn, 2 /* Permanent Error */); 368 + 369 + /* Notify all devices that they're about to go down. */ 370 + pci_walk_bus(frozen_bus, eeh_report_failure, 0); 371 + 372 + /* Shut down the device drivers for good. */ 373 + pcibios_remove_pci_devices(frozen_bus); 374 + } 375 + 376 + /* ---------- end of file ---------- */
+12 -27
arch/powerpc/platforms/pseries/eeh_event.c
··· 21 21 #include <linux/list.h> 22 22 #include <linux/pci.h> 23 23 #include <asm/eeh_event.h> 24 + #include <asm/ppc-pci.h> 24 25 25 26 /** Overview: 26 27 * EEH error states may be detected within exception handlers; ··· 36 35 LIST_HEAD(eeh_eventlist); 37 36 static void eeh_thread_launcher(void *); 38 37 DECLARE_WORK(eeh_event_wq, eeh_thread_launcher, NULL); 39 - 40 - /** 41 - * eeh_panic - call panic() for an eeh event that cannot be handled. 42 - * The philosophy of this routine is that it is better to panic and 43 - * halt the OS than it is to risk possible data corruption by 44 - * oblivious device drivers that don't know better. 45 - * 46 - * @dev pci device that had an eeh event 47 - * @reset_state current reset state of the device slot 48 - */ 49 - static void eeh_panic(struct pci_dev *dev, int reset_state) 50 - { 51 - /* 52 - * Since the panic_on_oops sysctl is used to halt the system 53 - * in light of potential corruption, we can use it here. 54 - */ 55 - if (panic_on_oops) { 56 - panic("EEH: MMIO failure (%d) on device:%s\n", reset_state, 57 - pci_name(dev)); 58 - } 59 - else { 60 - printk(KERN_INFO "EEH: Ignored MMIO failure (%d) on device:%s\n", 61 - reset_state, pci_name(dev)); 62 - } 63 - } 64 38 65 39 /** 66 40 * eeh_event_handler - dispatch EEH events. The detection of a frozen ··· 58 82 59 83 spin_lock_irqsave(&eeh_eventlist_lock, flags); 60 84 event = NULL; 85 + 86 + /* Unqueue the event, get ready to process. */ 61 87 if (!list_empty(&eeh_eventlist)) { 62 88 event = list_entry(eeh_eventlist.next, struct eeh_event, list); 63 89 list_del(&event->list); 64 90 } 91 + 92 + if (event) 93 + eeh_mark_slot(event->dn, EEH_MODE_RECOVERING); 94 + 65 95 spin_unlock_irqrestore(&eeh_eventlist_lock, flags); 66 96 if (event == NULL) 67 97 break; ··· 75 93 printk(KERN_INFO "EEH: Detected PCI bus error on device %s\n", 76 94 pci_name(event->dev)); 77 95 78 - eeh_panic (event->dev, event->state); 96 + handle_eeh_events(event); 79 97 98 + eeh_clear_slot(event->dn, EEH_MODE_RECOVERING); 99 + 100 + pci_dev_put(event->dev); 80 101 kfree(event); 81 102 } 82 103 ··· 107 122 */ 108 123 int eeh_send_failure_event (struct device_node *dn, 109 124 struct pci_dev *dev, 110 - int state, 125 + enum pci_channel_state state, 111 126 int time_unavail) 112 127 { 113 128 unsigned long flags;
+1 -1
drivers/ide/pci/via82cxxx.c
··· 439 439 hwif->speedproc = &via_set_drive; 440 440 441 441 442 - #if defined(CONFIG_PPC_MULTIPLATFORM) && defined(CONFIG_PPC32) 442 + #if defined(CONFIG_PPC_CHRP) && defined(CONFIG_PPC32) 443 443 if(_machine == _MACH_chrp && _chrp_type == _CHRP_Pegasos) { 444 444 hwif->irq = hwif->channel ? 15 : 14; 445 445 }
+5 -3
include/asm-powerpc/eeh.h
··· 34 34 extern int eeh_subsystem_enabled; 35 35 36 36 /* Values for eeh_mode bits in device_node */ 37 - #define EEH_MODE_SUPPORTED (1<<0) 38 - #define EEH_MODE_NOCHECK (1<<1) 39 - #define EEH_MODE_ISOLATED (1<<2) 37 + #define EEH_MODE_SUPPORTED (1<<0) 38 + #define EEH_MODE_NOCHECK (1<<1) 39 + #define EEH_MODE_ISOLATED (1<<2) 40 + #define EEH_MODE_RECOVERING (1<<3) 41 + #define EEH_MODE_IRQ_DISABLED (1<<4) 40 42 41 43 /* Max number of EEH freezes allowed before we consider the device 42 44 * to be permanently disabled. */
+5 -2
include/asm-powerpc/eeh_event.h
··· 30 30 struct list_head list; 31 31 struct device_node *dn; /* struct device node */ 32 32 struct pci_dev *dev; /* affected device */ 33 - int state; 33 + enum pci_channel_state state; /* PCI bus state for the affected device */ 34 34 int time_unavail; /* milliseconds until device might be available */ 35 35 }; 36 36 ··· 47 47 */ 48 48 int eeh_send_failure_event (struct device_node *dn, 49 49 struct pci_dev *dev, 50 - int reset_state, 50 + enum pci_channel_state state, 51 51 int time_unavail); 52 + 53 + /* Main recovery function */ 54 + void handle_eeh_events (struct eeh_event *); 52 55 53 56 #endif /* __KERNEL__ */ 54 57 #endif /* ASM_PPC64_EEH_EVENT_H */
+5 -4
include/asm-powerpc/pci-bridge.h
··· 61 61 struct iommu_table; 62 62 63 63 struct pci_dn { 64 - int busno; /* for pci devices */ 65 - int bussubno; /* for pci devices */ 66 - int devfn; /* for pci devices */ 64 + int busno; /* pci bus number */ 65 + int bussubno; /* pci subordinate bus number */ 66 + int devfn; /* pci device and function number */ 67 + int class_code; /* pci device class */ 67 68 68 69 #ifdef CONFIG_PPC_PSERIES 69 70 int eeh_mode; /* See eeh.h for possible EEH_MODEs */ 70 71 int eeh_config_addr; 72 + int eeh_pe_config_addr; /* new-style partition endpoint address */ 71 73 int eeh_check_count; /* # times driver ignored error */ 72 74 int eeh_freeze_count; /* # times this device froze up. */ 73 - int eeh_is_bridge; /* device is pci-to-pci bridge */ 74 75 #endif 75 76 int pci_ext_config_space; /* for pci devices */ 76 77 struct pci_controller *phb; /* for pci devices */
+22 -1
include/asm-powerpc/ppc-pci.h
··· 52 52 53 53 /* ---- EEH internal-use-only related routines ---- */ 54 54 #ifdef CONFIG_EEH 55 + 56 + void pci_addr_cache_insert_device(struct pci_dev *dev); 57 + void pci_addr_cache_remove_device(struct pci_dev *dev); 58 + void pci_addr_cache_build(void); 59 + struct pci_dev *pci_get_device_by_addr(unsigned long addr); 60 + 61 + /** 62 + * eeh_slot_error_detail -- record and EEH error condition to the log 63 + * @severity: 1 if temporary, 2 if permanent failure. 64 + * 65 + * Obtains the the EEH error details from the RTAS subsystem, 66 + * and then logs these details with the RTAS error log system. 67 + */ 68 + void eeh_slot_error_detail (struct pci_dn *pdn, int severity); 69 + 55 70 /** 56 71 * rtas_set_slot_reset -- unfreeze a frozen slot 57 72 * ··· 74 59 * does this by asserting the PCI #RST line for 1/8th of 75 60 * a second; this routine will sleep while the adapter is 76 61 * being reset. 62 + * 63 + * Returns a non-zero value if the reset failed. 77 64 */ 78 - void rtas_set_slot_reset (struct pci_dn *); 65 + int rtas_set_slot_reset (struct pci_dn *); 79 66 80 67 /** 81 68 * eeh_restore_bars - Restore device configuration info. ··· 101 84 void rtas_configure_bridge(struct pci_dn *); 102 85 103 86 int rtas_write_config(struct pci_dn *, int where, int size, u32 val); 87 + int rtas_read_config(struct pci_dn *, int where, int size, u32 *val); 104 88 105 89 /** 106 90 * mark and clear slots: find "partition endpoint" PE and set or ··· 109 91 */ 110 92 void eeh_mark_slot (struct device_node *dn, int mode_flag); 111 93 void eeh_clear_slot (struct device_node *dn, int mode_flag); 94 + 95 + /* Find the associated "Partiationable Endpoint" PE */ 96 + struct device_node * find_device_pe(struct device_node *dn); 112 97 113 98 #endif 114 99
+4
include/asm-powerpc/serial.h
··· 15 15 /* Default baud base if not found in device-tree */ 16 16 #define BASE_BAUD ( 1843200 / 16 ) 17 17 18 + #ifdef CONFIG_PPC_UDBG_16550 18 19 extern void find_legacy_serial_ports(void); 20 + #else 21 + #define find_legacy_serial_ports() do { } while (0) 22 + #endif 19 23 20 24 #endif /* _PPC64_SERIAL_H */