Merge branch 'master' of /pub/scm/linux/kernel/git/torvalds/linux-2.6

+800 -288
+1 -1
arch/ppc64/kernel/iSeries_pci.c
··· 252 252 phb = (struct pci_controller *)kmalloc(sizeof(struct pci_controller), GFP_KERNEL); 253 253 if (phb == NULL) 254 254 return -ENOMEM; 255 - pci_setup_pci_controller(phb); 255 + pci_setup_pci_controller(phb); 256 256 257 257 phb->pci_mem_offset = phb->local_number = bus; 258 258 phb->first_busno = bus;
+27 -27
arch/ppc64/kernel/maple_pci.c
··· 283 283 * the reg address cell, we shall fix that by killing struct 284 284 * reg_property and using some accessor functions instead 285 285 */ 286 - hose->first_busno = 0xf0; 286 + hose->first_busno = 0xf0; 287 287 hose->last_busno = 0xff; 288 288 hose->ops = &u3_agp_pci_ops; 289 289 hose->cfg_addr = ioremap(0xf0000000 + 0x800000, 0x1000); ··· 315 315 char* disp_name; 316 316 int *bus_range; 317 317 int primary = 1; 318 - struct property *of_prop; 318 + struct property *of_prop; 319 319 320 320 DBG("Adding PCI host bridge %s\n", dev->full_name); 321 321 322 - bus_range = (int *) get_property(dev, "bus-range", &len); 323 - if (bus_range == NULL || len < 2 * sizeof(int)) { 324 - printk(KERN_WARNING "Can't get bus-range for %s, assume bus 0\n", 325 - dev->full_name); 326 - } 322 + bus_range = (int *) get_property(dev, "bus-range", &len); 323 + if (bus_range == NULL || len < 2 * sizeof(int)) { 324 + printk(KERN_WARNING "Can't get bus-range for %s, assume bus 0\n", 325 + dev->full_name); 326 + } 327 327 328 328 hose = alloc_bootmem(sizeof(struct pci_controller)); 329 329 if (hose == NULL) 330 330 return -ENOMEM; 331 - pci_setup_pci_controller(hose); 331 + pci_setup_pci_controller(hose); 332 332 333 - hose->arch_data = dev; 334 - hose->first_busno = bus_range ? bus_range[0] : 0; 335 - hose->last_busno = bus_range ? bus_range[1] : 0xff; 333 + hose->arch_data = dev; 334 + hose->first_busno = bus_range ? bus_range[0] : 0; 335 + hose->last_busno = bus_range ? bus_range[1] : 0xff; 336 336 337 337 of_prop = alloc_bootmem(sizeof(struct property) + 338 338 sizeof(hose->global_number)); ··· 346 346 } 347 347 348 348 disp_name = NULL; 349 - if (device_is_compatible(dev, "u3-agp")) { 350 - setup_u3_agp(hose); 351 - disp_name = "U3-AGP"; 352 - primary = 0; 353 - } else if (device_is_compatible(dev, "u3-ht")) { 354 - setup_u3_ht(hose); 355 - disp_name = "U3-HT"; 356 - primary = 1; 357 - } 358 - printk(KERN_INFO "Found %s PCI host bridge. Firmware bus number: %d->%d\n", 359 - disp_name, hose->first_busno, hose->last_busno); 349 + if (device_is_compatible(dev, "u3-agp")) { 350 + setup_u3_agp(hose); 351 + disp_name = "U3-AGP"; 352 + primary = 0; 353 + } else if (device_is_compatible(dev, "u3-ht")) { 354 + setup_u3_ht(hose); 355 + disp_name = "U3-HT"; 356 + primary = 1; 357 + } 358 + printk(KERN_INFO "Found %s PCI host bridge. Firmware bus number: %d->%d\n", 359 + disp_name, hose->first_busno, hose->last_busno); 360 360 361 - /* Interpret the "ranges" property */ 362 - /* This also maps the I/O region and sets isa_io/mem_base */ 363 - pci_process_bridge_OF_ranges(hose, dev); 361 + /* Interpret the "ranges" property */ 362 + /* This also maps the I/O region and sets isa_io/mem_base */ 363 + pci_process_bridge_OF_ranges(hose, dev); 364 364 pci_setup_phb_io(hose, primary); 365 365 366 - /* Fixup "bus-range" OF property */ 367 - fixup_bus_range(dev); 366 + /* Fixup "bus-range" OF property */ 367 + fixup_bus_range(dev); 368 368 369 369 return 0; 370 370 }
+8
arch/ppc64/kernel/pSeries_setup.c
··· 590 590 return 0; 591 591 } 592 592 593 + static int pSeries_pci_probe_mode(struct pci_bus *bus) 594 + { 595 + if (systemcfg->platform & PLATFORM_LPAR) 596 + return PCI_PROBE_DEVTREE; 597 + return PCI_PROBE_NORMAL; 598 + } 599 + 593 600 struct machdep_calls __initdata pSeries_md = { 594 601 .probe = pSeries_probe, 595 602 .setup_arch = pSeries_setup_arch, ··· 604 597 .get_cpuinfo = pSeries_get_cpuinfo, 605 598 .log_error = pSeries_log_error, 606 599 .pcibios_fixup = pSeries_final_fixup, 600 + .pci_probe_mode = pSeries_pci_probe_mode, 607 601 .irq_bus_setup = pSeries_irq_bus_setup, 608 602 .restart = rtas_restart, 609 603 .power_off = rtas_power_off,
+11 -2
arch/ppc64/kernel/pSeries_smp.c
··· 272 272 unsigned long start_here = __pa((u32)*((unsigned long *) 273 273 pSeries_secondary_smp_init)); 274 274 unsigned int pcpu; 275 + int start_cpu; 275 276 276 277 if (cpu_isset(lcpu, of_spin_map)) 277 278 /* Already started by OF and sitting in spin loop */ ··· 283 282 /* Fixup atomic count: it exited inside IRQ handler. */ 284 283 paca[lcpu].__current->thread_info->preempt_count = 0; 285 284 286 - status = rtas_call(rtas_token("start-cpu"), 3, 1, NULL, 287 - pcpu, start_here, lcpu); 285 + /* 286 + * If the RTAS start-cpu token does not exist then presume the 287 + * cpu is already spinning. 288 + */ 289 + start_cpu = rtas_token("start-cpu"); 290 + if (start_cpu == RTAS_UNKNOWN_SERVICE) 291 + return 1; 292 + 293 + status = rtas_call(start_cpu, 3, 1, NULL, pcpu, start_here, lcpu); 288 294 if (status != 0) { 289 295 printk(KERN_ERR "start-cpu failed: %i\n", status); 290 296 return 0; 291 297 } 298 + 292 299 return 1; 293 300 } 294 301
+337 -92
arch/ppc64/kernel/pci.c
··· 51 51 52 52 EXPORT_SYMBOL(io_page_mask); 53 53 54 + #ifdef CONFIG_PPC_MULTIPLATFORM 55 + static void fixup_resource(struct resource *res, struct pci_dev *dev); 56 + static void do_bus_setup(struct pci_bus *bus); 57 + #endif 54 58 55 59 unsigned int pcibios_assign_all_busses(void) 56 60 { ··· 229 225 } 230 226 #endif 231 227 228 + #ifdef CONFIG_PPC_MULTIPLATFORM 229 + static u32 get_int_prop(struct device_node *np, const char *name, u32 def) 230 + { 231 + u32 *prop; 232 + int len; 233 + 234 + prop = (u32 *) get_property(np, name, &len); 235 + if (prop && len >= 4) 236 + return *prop; 237 + return def; 238 + } 239 + 240 + static unsigned int pci_parse_of_flags(u32 addr0) 241 + { 242 + unsigned int flags = 0; 243 + 244 + if (addr0 & 0x02000000) { 245 + flags |= IORESOURCE_MEM; 246 + if (addr0 & 0x40000000) 247 + flags |= IORESOURCE_PREFETCH; 248 + } else if (addr0 & 0x01000000) 249 + flags |= IORESOURCE_IO; 250 + return flags; 251 + } 252 + 253 + #define GET_64BIT(prop, i) ((((u64) (prop)[(i)]) << 32) | (prop)[(i)+1]) 254 + 255 + static void pci_parse_of_addrs(struct device_node *node, struct pci_dev *dev) 256 + { 257 + u64 base, size; 258 + unsigned int flags; 259 + struct resource *res; 260 + u32 *addrs, i; 261 + int proplen; 262 + 263 + addrs = (u32 *) get_property(node, "assigned-addresses", &proplen); 264 + if (!addrs) 265 + return; 266 + for (; proplen >= 20; proplen -= 20, addrs += 5) { 267 + flags = pci_parse_of_flags(addrs[0]); 268 + if (!flags) 269 + continue; 270 + base = GET_64BIT(addrs, 1); 271 + size = GET_64BIT(addrs, 3); 272 + if (!size) 273 + continue; 274 + i = addrs[0] & 0xff; 275 + if (PCI_BASE_ADDRESS_0 <= i && i <= PCI_BASE_ADDRESS_5) { 276 + res = &dev->resource[(i - PCI_BASE_ADDRESS_0) >> 2]; 277 + } else if (i == dev->rom_base_reg) { 278 + res = &dev->resource[PCI_ROM_RESOURCE]; 279 + flags |= IORESOURCE_READONLY | IORESOURCE_CACHEABLE; 280 + } else { 281 + printk(KERN_ERR "PCI: bad cfg reg num 0x%x\n", i); 282 + continue; 283 + } 284 + res->start = base; 285 + res->end = base + size - 1; 286 + res->flags = flags; 287 + res->name = pci_name(dev); 288 + fixup_resource(res, dev); 289 + } 290 + } 291 + 292 + static struct pci_dev *of_create_pci_dev(struct device_node *node, 293 + struct pci_bus *bus, int devfn) 294 + { 295 + struct pci_dev *dev; 296 + const char *type; 297 + 298 + dev = kmalloc(sizeof(struct pci_dev), GFP_KERNEL); 299 + if (!dev) 300 + return NULL; 301 + type = get_property(node, "device_type", NULL); 302 + if (type == NULL) 303 + type = ""; 304 + 305 + memset(dev, 0, sizeof(struct pci_dev)); 306 + dev->bus = bus; 307 + dev->sysdata = node; 308 + dev->dev.parent = bus->bridge; 309 + dev->dev.bus = &pci_bus_type; 310 + dev->devfn = devfn; 311 + dev->multifunction = 0; /* maybe a lie? */ 312 + 313 + dev->vendor = get_int_prop(node, "vendor-id", 0xffff); 314 + dev->device = get_int_prop(node, "device-id", 0xffff); 315 + dev->subsystem_vendor = get_int_prop(node, "subsystem-vendor-id", 0); 316 + dev->subsystem_device = get_int_prop(node, "subsystem-id", 0); 317 + 318 + dev->cfg_size = 256; /*pci_cfg_space_size(dev);*/ 319 + 320 + sprintf(pci_name(dev), "%04x:%02x:%02x.%d", pci_domain_nr(bus), 321 + dev->bus->number, PCI_SLOT(devfn), PCI_FUNC(devfn)); 322 + dev->class = get_int_prop(node, "class-code", 0); 323 + 324 + dev->current_state = 4; /* unknown power state */ 325 + 326 + if (!strcmp(type, "pci")) { 327 + /* a PCI-PCI bridge */ 328 + dev->hdr_type = PCI_HEADER_TYPE_BRIDGE; 329 + dev->rom_base_reg = PCI_ROM_ADDRESS1; 330 + } else if (!strcmp(type, "cardbus")) { 331 + dev->hdr_type = PCI_HEADER_TYPE_CARDBUS; 332 + } else { 333 + dev->hdr_type = PCI_HEADER_TYPE_NORMAL; 334 + dev->rom_base_reg = PCI_ROM_ADDRESS; 335 + dev->irq = NO_IRQ; 336 + if (node->n_intrs > 0) { 337 + dev->irq = node->intrs[0].line; 338 + pci_write_config_byte(dev, PCI_INTERRUPT_LINE, 339 + dev->irq); 340 + } 341 + } 342 + 343 + pci_parse_of_addrs(node, dev); 344 + 345 + pci_device_add(dev, bus); 346 + 347 + /* XXX pci_scan_msi_device(dev); */ 348 + 349 + return dev; 350 + } 351 + 352 + static void of_scan_pci_bridge(struct device_node *node, struct pci_dev *dev); 353 + 354 + static void __devinit of_scan_bus(struct device_node *node, 355 + struct pci_bus *bus) 356 + { 357 + struct device_node *child = NULL; 358 + u32 *reg; 359 + int reglen, devfn; 360 + struct pci_dev *dev; 361 + 362 + while ((child = of_get_next_child(node, child)) != NULL) { 363 + reg = (u32 *) get_property(child, "reg", &reglen); 364 + if (reg == NULL || reglen < 20) 365 + continue; 366 + devfn = (reg[0] >> 8) & 0xff; 367 + /* create a new pci_dev for this device */ 368 + dev = of_create_pci_dev(child, bus, devfn); 369 + if (!dev) 370 + continue; 371 + if (dev->hdr_type == PCI_HEADER_TYPE_BRIDGE || 372 + dev->hdr_type == PCI_HEADER_TYPE_CARDBUS) 373 + of_scan_pci_bridge(child, dev); 374 + } 375 + 376 + do_bus_setup(bus); 377 + } 378 + 379 + static void __devinit of_scan_pci_bridge(struct device_node *node, 380 + struct pci_dev *dev) 381 + { 382 + struct pci_bus *bus; 383 + u32 *busrange, *ranges; 384 + int len, i, mode; 385 + struct resource *res; 386 + unsigned int flags; 387 + u64 size; 388 + 389 + /* parse bus-range property */ 390 + busrange = (u32 *) get_property(node, "bus-range", &len); 391 + if (busrange == NULL || len != 8) { 392 + printk(KERN_ERR "Can't get bus-range for PCI-PCI bridge %s\n", 393 + node->full_name); 394 + return; 395 + } 396 + ranges = (u32 *) get_property(node, "ranges", &len); 397 + if (ranges == NULL) { 398 + printk(KERN_ERR "Can't get ranges for PCI-PCI bridge %s\n", 399 + node->full_name); 400 + return; 401 + } 402 + 403 + bus = pci_add_new_bus(dev->bus, dev, busrange[0]); 404 + if (!bus) { 405 + printk(KERN_ERR "Failed to create pci bus for %s\n", 406 + node->full_name); 407 + return; 408 + } 409 + 410 + bus->primary = dev->bus->number; 411 + bus->subordinate = busrange[1]; 412 + bus->bridge_ctl = 0; 413 + bus->sysdata = node; 414 + 415 + /* parse ranges property */ 416 + /* PCI #address-cells == 3 and #size-cells == 2 always */ 417 + res = &dev->resource[PCI_BRIDGE_RESOURCES]; 418 + for (i = 0; i < PCI_NUM_RESOURCES - PCI_BRIDGE_RESOURCES; ++i) { 419 + res->flags = 0; 420 + bus->resource[i] = res; 421 + ++res; 422 + } 423 + i = 1; 424 + for (; len >= 32; len -= 32, ranges += 8) { 425 + flags = pci_parse_of_flags(ranges[0]); 426 + size = GET_64BIT(ranges, 6); 427 + if (flags == 0 || size == 0) 428 + continue; 429 + if (flags & IORESOURCE_IO) { 430 + res = bus->resource[0]; 431 + if (res->flags) { 432 + printk(KERN_ERR "PCI: ignoring extra I/O range" 433 + " for bridge %s\n", node->full_name); 434 + continue; 435 + } 436 + } else { 437 + if (i >= PCI_NUM_RESOURCES - PCI_BRIDGE_RESOURCES) { 438 + printk(KERN_ERR "PCI: too many memory ranges" 439 + " for bridge %s\n", node->full_name); 440 + continue; 441 + } 442 + res = bus->resource[i]; 443 + ++i; 444 + } 445 + res->start = GET_64BIT(ranges, 1); 446 + res->end = res->start + size - 1; 447 + res->flags = flags; 448 + fixup_resource(res, dev); 449 + } 450 + sprintf(bus->name, "PCI Bus %04x:%02x", pci_domain_nr(bus), 451 + bus->number); 452 + 453 + mode = PCI_PROBE_NORMAL; 454 + if (ppc_md.pci_probe_mode) 455 + mode = ppc_md.pci_probe_mode(bus); 456 + if (mode == PCI_PROBE_DEVTREE) 457 + of_scan_bus(node, bus); 458 + else if (mode == PCI_PROBE_NORMAL) 459 + pci_scan_child_bus(bus); 460 + } 461 + #endif /* CONFIG_PPC_MULTIPLATFORM */ 462 + 463 + static void __devinit scan_phb(struct pci_controller *hose) 464 + { 465 + struct pci_bus *bus; 466 + struct device_node *node = hose->arch_data; 467 + int i, mode; 468 + struct resource *res; 469 + 470 + bus = pci_create_bus(NULL, hose->first_busno, hose->ops, node); 471 + if (bus == NULL) { 472 + printk(KERN_ERR "Failed to create bus for PCI domain %04x\n", 473 + hose->global_number); 474 + return; 475 + } 476 + bus->secondary = hose->first_busno; 477 + hose->bus = bus; 478 + 479 + bus->resource[0] = res = &hose->io_resource; 480 + if (res->flags && request_resource(&ioport_resource, res)) 481 + printk(KERN_ERR "Failed to request PCI IO region " 482 + "on PCI domain %04x\n", hose->global_number); 483 + 484 + for (i = 0; i < 3; ++i) { 485 + res = &hose->mem_resources[i]; 486 + bus->resource[i+1] = res; 487 + if (res->flags && request_resource(&iomem_resource, res)) 488 + printk(KERN_ERR "Failed to request PCI memory region " 489 + "on PCI domain %04x\n", hose->global_number); 490 + } 491 + 492 + mode = PCI_PROBE_NORMAL; 493 + #ifdef CONFIG_PPC_MULTIPLATFORM 494 + if (ppc_md.pci_probe_mode) 495 + mode = ppc_md.pci_probe_mode(bus); 496 + if (mode == PCI_PROBE_DEVTREE) { 497 + bus->subordinate = hose->last_busno; 498 + of_scan_bus(node, bus); 499 + } 500 + #endif /* CONFIG_PPC_MULTIPLATFORM */ 501 + if (mode == PCI_PROBE_NORMAL) 502 + hose->last_busno = bus->subordinate = pci_scan_child_bus(bus); 503 + pci_bus_add_devices(bus); 504 + } 505 + 232 506 static int __init pcibios_init(void) 233 507 { 234 508 struct pci_controller *hose, *tmp; 235 - struct pci_bus *bus; 236 509 237 510 /* For now, override phys_mem_access_prot. If we need it, 238 511 * later, we may move that initialization to each ppc_md ··· 523 242 printk("PCI: Probing PCI hardware\n"); 524 243 525 244 /* Scan all of the recorded PCI controllers. */ 526 - list_for_each_entry_safe(hose, tmp, &hose_list, list_node) { 527 - hose->last_busno = 0xff; 528 - bus = pci_scan_bus(hose->first_busno, hose->ops, 529 - hose->arch_data); 530 - hose->bus = bus; 531 - hose->last_busno = bus->subordinate; 532 - } 245 + list_for_each_entry_safe(hose, tmp, &hose_list, list_node) 246 + scan_phb(hose); 533 247 534 248 #ifndef CONFIG_PPC_ISERIES 535 249 if (pci_probe_only) ··· 1096 820 /* 1097 821 * ppc64 can have multifunction devices that do not respond to function 0. 1098 822 * In this case we must scan all functions. 823 + * XXX this can go now, we use the OF device tree in all the 824 + * cases that caused problems. -- paulus 1099 825 */ 1100 826 int pcibios_scan_all_fns(struct pci_bus *bus, int devfn) 1101 827 { 1102 - struct device_node *busdn, *dn; 1103 - 1104 - if (bus->self) 1105 - busdn = pci_device_to_OF_node(bus->self); 1106 - else 1107 - busdn = bus->sysdata; /* must be a phb */ 1108 - 1109 - if (busdn == NULL) 1110 - return 0; 1111 - 1112 - /* 1113 - * Check to see if there is any of the 8 functions are in the 1114 - * device tree. If they are then we need to scan all the 1115 - * functions of this slot. 1116 - */ 1117 - for (dn = busdn->child; dn; dn = dn->sibling) { 1118 - struct pci_dn *pdn = dn->data; 1119 - if (pdn && (pdn->devfn >> 3) == (devfn >> 3)) 1120 - return 1; 1121 - } 1122 - 1123 828 return 0; 1124 829 } 1125 830 831 + static void __devinit fixup_resource(struct resource *res, struct pci_dev *dev) 832 + { 833 + struct pci_controller *hose = pci_bus_to_host(dev->bus); 834 + unsigned long start, end, mask, offset; 835 + 836 + if (res->flags & IORESOURCE_IO) { 837 + offset = (unsigned long)hose->io_base_virt - pci_io_base; 838 + 839 + start = res->start += offset; 840 + end = res->end += offset; 841 + 842 + /* Need to allow IO access to pages that are in the 843 + ISA range */ 844 + if (start < MAX_ISA_PORT) { 845 + if (end > MAX_ISA_PORT) 846 + end = MAX_ISA_PORT; 847 + 848 + start >>= PAGE_SHIFT; 849 + end >>= PAGE_SHIFT; 850 + 851 + /* get the range of pages for the map */ 852 + mask = ((1 << (end+1)) - 1) ^ ((1 << start) - 1); 853 + io_page_mask |= mask; 854 + } 855 + } else if (res->flags & IORESOURCE_MEM) { 856 + res->start += hose->pci_mem_offset; 857 + res->end += hose->pci_mem_offset; 858 + } 859 + } 1126 860 1127 861 void __devinit pcibios_fixup_device_resources(struct pci_dev *dev, 1128 - struct pci_bus *bus) 862 + struct pci_bus *bus) 1129 863 { 1130 864 /* Update device resources. */ 1131 - struct pci_controller *hose = pci_bus_to_host(bus); 1132 865 int i; 1133 866 1134 - for (i = 0; i < PCI_NUM_RESOURCES; i++) { 1135 - if (dev->resource[i].flags & IORESOURCE_IO) { 1136 - unsigned long offset = (unsigned long)hose->io_base_virt 1137 - - pci_io_base; 1138 - unsigned long start, end, mask; 1139 - 1140 - start = dev->resource[i].start += offset; 1141 - end = dev->resource[i].end += offset; 1142 - 1143 - /* Need to allow IO access to pages that are in the 1144 - ISA range */ 1145 - if (start < MAX_ISA_PORT) { 1146 - if (end > MAX_ISA_PORT) 1147 - end = MAX_ISA_PORT; 1148 - 1149 - start >>= PAGE_SHIFT; 1150 - end >>= PAGE_SHIFT; 1151 - 1152 - /* get the range of pages for the map */ 1153 - mask = ((1 << (end+1))-1) ^ ((1 << start)-1); 1154 - io_page_mask |= mask; 1155 - } 1156 - } 1157 - else if (dev->resource[i].flags & IORESOURCE_MEM) { 1158 - dev->resource[i].start += hose->pci_mem_offset; 1159 - dev->resource[i].end += hose->pci_mem_offset; 1160 - } 1161 - } 867 + for (i = 0; i < PCI_NUM_RESOURCES; i++) 868 + if (dev->resource[i].flags) 869 + fixup_resource(&dev->resource[i], dev); 1162 870 } 1163 871 EXPORT_SYMBOL(pcibios_fixup_device_resources); 1164 872 1165 - void __devinit pcibios_fixup_bus(struct pci_bus *bus) 873 + static void __devinit do_bus_setup(struct pci_bus *bus) 1166 874 { 1167 - struct pci_controller *hose = pci_bus_to_host(bus); 1168 - struct pci_dev *dev = bus->self; 1169 - struct resource *res; 1170 - int i; 1171 - 1172 - if (!dev) { 1173 - /* Root bus. */ 1174 - 1175 - hose->bus = bus; 1176 - bus->resource[0] = res = &hose->io_resource; 1177 - 1178 - if (res->flags && request_resource(&ioport_resource, res)) 1179 - printk(KERN_ERR "Failed to request IO on " 1180 - "PCI domain %d\n", pci_domain_nr(bus)); 1181 - 1182 - for (i = 0; i < 3; ++i) { 1183 - res = &hose->mem_resources[i]; 1184 - bus->resource[i+1] = res; 1185 - if (res->flags && request_resource(&iomem_resource, res)) 1186 - printk(KERN_ERR "Failed to request MEM on " 1187 - "PCI domain %d\n", 1188 - pci_domain_nr(bus)); 1189 - } 1190 - } else if (pci_probe_only && 1191 - (dev->class >> 8) == PCI_CLASS_BRIDGE_PCI) { 1192 - /* This is a subordinate bridge */ 1193 - 1194 - pci_read_bridge_bases(bus); 1195 - pcibios_fixup_device_resources(dev, bus); 1196 - } 875 + struct pci_dev *dev; 1197 876 1198 877 ppc_md.iommu_bus_setup(bus); 1199 878 ··· 1157 926 1158 927 if (ppc_md.irq_bus_setup) 1159 928 ppc_md.irq_bus_setup(bus); 929 + } 930 + 931 + void __devinit pcibios_fixup_bus(struct pci_bus *bus) 932 + { 933 + struct pci_dev *dev = bus->self; 934 + 935 + if (dev && pci_probe_only && 936 + (dev->class >> 8) == PCI_CLASS_BRIDGE_PCI) { 937 + /* This is a subordinate bridge */ 938 + 939 + pci_read_bridge_bases(bus); 940 + pcibios_fixup_device_resources(dev, bus); 941 + } 942 + 943 + do_bus_setup(bus); 1160 944 1161 945 if (!pci_probe_only) 1162 946 return; 1163 947 1164 - list_for_each_entry(dev, &bus->devices, bus_list) { 948 + list_for_each_entry(dev, &bus->devices, bus_list) 1165 949 if ((dev->class >> 8) != PCI_CLASS_BRIDGE_PCI) 1166 950 pcibios_fixup_device_resources(dev, bus); 1167 - } 1168 951 } 1169 952 EXPORT_SYMBOL(pcibios_fixup_bus); 1170 953
+28 -28
arch/ppc64/kernel/pmac_pci.c
··· 388 388 * the reg address cell, we shall fix that by killing struct 389 389 * reg_property and using some accessor functions instead 390 390 */ 391 - hose->first_busno = 0xf0; 391 + hose->first_busno = 0xf0; 392 392 hose->last_busno = 0xff; 393 393 has_uninorth = 1; 394 394 hose->ops = &macrisc_pci_ops; ··· 473 473 continue; 474 474 } 475 475 cur++; 476 - DBG("U3/HT: hole, %d end at %08lx, %d start at %08lx\n", 476 + DBG("U3/HT: hole, %d end at %08lx, %d start at %08lx\n", 477 477 cur-1, res->start - 1, cur, res->end + 1); 478 478 hose->mem_resources[cur].name = np->full_name; 479 479 hose->mem_resources[cur].flags = IORESOURCE_MEM; ··· 603 603 char* disp_name; 604 604 int *bus_range; 605 605 int primary = 1; 606 - struct property *of_prop; 606 + struct property *of_prop; 607 607 608 608 DBG("Adding PCI host bridge %s\n", dev->full_name); 609 609 610 - bus_range = (int *) get_property(dev, "bus-range", &len); 611 - if (bus_range == NULL || len < 2 * sizeof(int)) { 612 - printk(KERN_WARNING "Can't get bus-range for %s, assume bus 0\n", 613 - dev->full_name); 614 - } 610 + bus_range = (int *) get_property(dev, "bus-range", &len); 611 + if (bus_range == NULL || len < 2 * sizeof(int)) { 612 + printk(KERN_WARNING "Can't get bus-range for %s, assume bus 0\n", 613 + dev->full_name); 614 + } 615 615 616 616 hose = alloc_bootmem(sizeof(struct pci_controller)); 617 617 if (hose == NULL) 618 618 return -ENOMEM; 619 - pci_setup_pci_controller(hose); 619 + pci_setup_pci_controller(hose); 620 620 621 - hose->arch_data = dev; 622 - hose->first_busno = bus_range ? bus_range[0] : 0; 623 - hose->last_busno = bus_range ? bus_range[1] : 0xff; 621 + hose->arch_data = dev; 622 + hose->first_busno = bus_range ? bus_range[0] : 0; 623 + hose->last_busno = bus_range ? bus_range[1] : 0xff; 624 624 625 625 of_prop = alloc_bootmem(sizeof(struct property) + 626 626 sizeof(hose->global_number)); ··· 634 634 } 635 635 636 636 disp_name = NULL; 637 - if (device_is_compatible(dev, "u3-agp")) { 638 - setup_u3_agp(hose); 639 - disp_name = "U3-AGP"; 640 - primary = 0; 641 - } else if (device_is_compatible(dev, "u3-ht")) { 642 - setup_u3_ht(hose); 643 - disp_name = "U3-HT"; 644 - primary = 1; 645 - } 646 - printk(KERN_INFO "Found %s PCI host bridge. Firmware bus number: %d->%d\n", 647 - disp_name, hose->first_busno, hose->last_busno); 637 + if (device_is_compatible(dev, "u3-agp")) { 638 + setup_u3_agp(hose); 639 + disp_name = "U3-AGP"; 640 + primary = 0; 641 + } else if (device_is_compatible(dev, "u3-ht")) { 642 + setup_u3_ht(hose); 643 + disp_name = "U3-HT"; 644 + primary = 1; 645 + } 646 + printk(KERN_INFO "Found %s PCI host bridge. Firmware bus number: %d->%d\n", 647 + disp_name, hose->first_busno, hose->last_busno); 648 648 649 - /* Interpret the "ranges" property */ 650 - /* This also maps the I/O region and sets isa_io/mem_base */ 651 - pmac_process_bridge_OF_ranges(hose, dev, primary); 649 + /* Interpret the "ranges" property */ 650 + /* This also maps the I/O region and sets isa_io/mem_base */ 651 + pmac_process_bridge_OF_ranges(hose, dev, primary); 652 652 653 - /* Fixup "bus-range" OF property */ 654 - fixup_bus_range(dev); 653 + /* Fixup "bus-range" OF property */ 654 + fixup_bus_range(dev); 655 655 656 656 return 0; 657 657 }
+13
arch/ppc64/kernel/pmac_setup.c
··· 477 477 return 1; 478 478 } 479 479 480 + static int pmac_probe_mode(struct pci_bus *bus) 481 + { 482 + struct device_node *node = bus->sysdata; 483 + 484 + /* We need to use normal PCI probing for the AGP bus, 485 + since the device for the AGP bridge isn't in the tree. */ 486 + if (bus->self == NULL && device_is_compatible(node, "u3-agp")) 487 + return PCI_PROBE_NORMAL; 488 + 489 + return PCI_PROBE_DEVTREE; 490 + } 491 + 480 492 struct machdep_calls __initdata pmac_md = { 481 493 #ifdef CONFIG_HOTPLUG_CPU 482 494 .cpu_die = generic_mach_cpu_die, ··· 500 488 .init_IRQ = pmac_init_IRQ, 501 489 .get_irq = mpic_get_irq, 502 490 .pcibios_fixup = pmac_pcibios_fixup, 491 + .pci_probe_mode = pmac_probe_mode, 503 492 .restart = pmac_restart, 504 493 .power_off = pmac_power_off, 505 494 .halt = pmac_halt,
+34
arch/ppc64/kernel/process.c
··· 54 54 #include <asm/sections.h> 55 55 #include <asm/tlbflush.h> 56 56 #include <asm/time.h> 57 + #include <asm/plpar_wrappers.h> 57 58 58 59 #ifndef CONFIG_SMP 59 60 struct task_struct *last_task_used_math = NULL; ··· 164 163 165 164 #endif /* CONFIG_ALTIVEC */ 166 165 166 + static void set_dabr_spr(unsigned long val) 167 + { 168 + mtspr(SPRN_DABR, val); 169 + } 170 + 171 + int set_dabr(unsigned long dabr) 172 + { 173 + int ret = 0; 174 + 175 + if (firmware_has_feature(FW_FEATURE_XDABR)) { 176 + /* We want to catch accesses from kernel and userspace */ 177 + unsigned long flags = H_DABRX_KERNEL|H_DABRX_USER; 178 + ret = plpar_set_xdabr(dabr, flags); 179 + } else if (firmware_has_feature(FW_FEATURE_DABR)) { 180 + ret = plpar_set_dabr(dabr); 181 + } else { 182 + set_dabr_spr(dabr); 183 + } 184 + 185 + return ret; 186 + } 187 + 167 188 DEFINE_PER_CPU(struct cpu_usage, cpu_usage_array); 189 + static DEFINE_PER_CPU(unsigned long, current_dabr); 168 190 169 191 struct task_struct *__switch_to(struct task_struct *prev, 170 192 struct task_struct *new) ··· 221 197 if (new->thread.regs && last_task_used_altivec == new) 222 198 new->thread.regs->msr |= MSR_VEC; 223 199 #endif /* CONFIG_ALTIVEC */ 200 + 201 + if (unlikely(__get_cpu_var(current_dabr) != new->thread.dabr)) { 202 + set_dabr(new->thread.dabr); 203 + __get_cpu_var(current_dabr) = new->thread.dabr; 204 + } 224 205 225 206 flush_tlb_pending(); 226 207 ··· 363 334 last_task_used_altivec = NULL; 364 335 #endif /* CONFIG_ALTIVEC */ 365 336 #endif /* CONFIG_SMP */ 337 + 338 + if (current->thread.dabr) { 339 + current->thread.dabr = 0; 340 + set_dabr(0); 341 + } 366 342 } 367 343 368 344 void
+28
arch/ppc64/kernel/ptrace.c
··· 17 17 * this archive for more details. 18 18 */ 19 19 20 + #include <linux/config.h> 20 21 #include <linux/kernel.h> 21 22 #include <linux/sched.h> 22 23 #include <linux/mm.h> ··· 207 206 break; 208 207 } 209 208 209 + case PTRACE_GET_DEBUGREG: { 210 + ret = -EINVAL; 211 + /* We only support one DABR and no IABRS at the moment */ 212 + if (addr > 0) 213 + break; 214 + ret = put_user(child->thread.dabr, 215 + (unsigned long __user *)data); 216 + break; 217 + } 218 + 219 + case PTRACE_SET_DEBUGREG: 220 + ret = ptrace_set_debugreg(child, addr, data); 221 + 210 222 case PTRACE_DETACH: 211 223 ret = ptrace_detach(child, data); 212 224 break; ··· 287 273 } 288 274 break; 289 275 } 276 + 277 + #ifdef CONFIG_ALTIVEC 278 + case PTRACE_GETVRREGS: 279 + /* Get the child altivec register state. */ 280 + flush_altivec_to_thread(child); 281 + ret = get_vrregs((unsigned long __user *)data, child); 282 + break; 283 + 284 + case PTRACE_SETVRREGS: 285 + /* Set the child altivec register state. */ 286 + flush_altivec_to_thread(child); 287 + ret = set_vrregs(child, (unsigned long __user *)data); 288 + break; 289 + #endif 290 290 291 291 default: 292 292 ret = ptrace_request(child, request, addr, data);
+31 -3
arch/ppc64/kernel/ptrace32.c
··· 17 17 * this archive for more details. 18 18 */ 19 19 20 + #include <linux/config.h> 20 21 #include <linux/kernel.h> 21 22 #include <linux/sched.h> 22 23 #include <linux/mm.h> ··· 338 337 break; 339 338 } 340 339 340 + case PTRACE_GET_DEBUGREG: { 341 + ret = -EINVAL; 342 + /* We only support one DABR and no IABRS at the moment */ 343 + if (addr > 0) 344 + break; 345 + ret = put_user(child->thread.dabr, (u32 __user *)data); 346 + break; 347 + } 348 + 349 + case PTRACE_SET_DEBUGREG: 350 + ret = ptrace_set_debugreg(child, addr, data); 351 + break; 352 + 341 353 case PTRACE_DETACH: 342 354 ret = ptrace_detach(child, data); 343 355 break; ··· 419 405 break; 420 406 } 421 407 422 - case PTRACE_GETEVENTMSG: 423 - ret = put_user(child->ptrace_message, (unsigned int __user *) data); 424 - break; 408 + case PTRACE_GETEVENTMSG: 409 + ret = put_user(child->ptrace_message, (unsigned int __user *) data); 410 + break; 411 + 412 + #ifdef CONFIG_ALTIVEC 413 + case PTRACE_GETVRREGS: 414 + /* Get the child altivec register state. */ 415 + flush_altivec_to_thread(child); 416 + ret = get_vrregs((unsigned long __user *)data, child); 417 + break; 418 + 419 + case PTRACE_SETVRREGS: 420 + /* Set the child altivec register state. */ 421 + flush_altivec_to_thread(child); 422 + ret = set_vrregs(child, (unsigned long __user *)data); 423 + break; 424 + #endif 425 425 426 426 default: 427 427 ret = ptrace_request(child, request, addr, data);
-2
arch/ppc64/kernel/ras.c
··· 59 59 /* This is true if we are using the firmware NMI handler (typically LPAR) */ 60 60 extern int fwnmi_active; 61 61 62 - extern void _exception(int signr, struct pt_regs *regs, int code, unsigned long addr); 63 - 64 62 static int ras_get_sensor_state_token; 65 63 static int ras_check_exception_token; 66 64
-16
arch/ppc64/kernel/setup.c
··· 1064 1064 #define PPC64_LINUX_FUNCTION 0x0f000000 1065 1065 #define PPC64_IPL_MESSAGE 0xc0000000 1066 1066 #define PPC64_TERM_MESSAGE 0xb0000000 1067 - #define PPC64_ATTN_MESSAGE 0xa0000000 1068 - #define PPC64_DUMP_MESSAGE 0xd0000000 1069 1067 1070 1068 static void ppc64_do_msg(unsigned int src, const char *msg) 1071 1069 { ··· 1089 1091 { 1090 1092 ppc64_do_msg(PPC64_LINUX_FUNCTION|PPC64_TERM_MESSAGE|src, msg); 1091 1093 printk("[terminate]%04x %s\n", src, msg); 1092 - } 1093 - 1094 - /* Print something that needs attention (device error, etc) */ 1095 - void ppc64_attention_msg(unsigned int src, const char *msg) 1096 - { 1097 - ppc64_do_msg(PPC64_LINUX_FUNCTION|PPC64_ATTN_MESSAGE|src, msg); 1098 - printk("[attention]%04x %s\n", src, msg); 1099 - } 1100 - 1101 - /* Print a dump progress message. */ 1102 - void ppc64_dump_msg(unsigned int src, const char *msg) 1103 - { 1104 - ppc64_do_msg(PPC64_LINUX_FUNCTION|PPC64_DUMP_MESSAGE|src, msg); 1105 - printk("[dump]%04x %s\n", src, msg); 1106 1094 } 1107 1095 1108 1096 /* This should only be called on processor 0 during calibrate decr */
+9
arch/ppc64/kernel/signal.c
··· 550 550 /* Whee! Actually deliver the signal. */ 551 551 if (TRAP(regs) == 0x0C00) 552 552 syscall_restart(regs, &ka); 553 + 554 + /* 555 + * Reenable the DABR before delivering the signal to 556 + * user space. The DABR will have been cleared if it 557 + * triggered inside the kernel. 558 + */ 559 + if (current->thread.dabr) 560 + set_dabr(current->thread.dabr); 561 + 553 562 return handle_signal(signr, &ka, &info, oldset, regs); 554 563 } 555 564
+8
arch/ppc64/kernel/signal32.c
··· 970 970 newsp = regs->gpr[1]; 971 971 newsp &= ~0xfUL; 972 972 973 + /* 974 + * Reenable the DABR before delivering the signal to 975 + * user space. The DABR will have been cleared if it 976 + * triggered inside the kernel. 977 + */ 978 + if (current->thread.dabr) 979 + set_dabr(current->thread.dabr); 980 + 973 981 /* Whee! Actually deliver the signal. */ 974 982 if (ka.sa.sa_flags & SA_SIGINFO) 975 983 ret = handle_rt_signal32(signr, &ka, &info, oldset, regs, newsp);
+22 -22
arch/ppc64/kernel/xics.c
··· 38 38 static void xics_end_irq(unsigned int irq); 39 39 static void xics_set_affinity(unsigned int irq_nr, cpumask_t cpumask); 40 40 41 - struct hw_interrupt_type xics_pic = { 41 + static struct hw_interrupt_type xics_pic = { 42 42 .typename = " XICS ", 43 43 .startup = xics_startup, 44 44 .enable = xics_enable_irq, ··· 48 48 .set_affinity = xics_set_affinity 49 49 }; 50 50 51 - struct hw_interrupt_type xics_8259_pic = { 51 + static struct hw_interrupt_type xics_8259_pic = { 52 52 .typename = " XICS/8259", 53 53 .ack = xics_mask_and_ack_irq, 54 54 }; ··· 89 89 static int xics_irq_8259_cascade = 0; 90 90 static int xics_irq_8259_cascade_real = 0; 91 91 static unsigned int default_server = 0xFF; 92 - /* also referenced in smp.c... */ 93 - unsigned int default_distrib_server = 0; 94 - unsigned int interrupt_server_size = 8; 92 + static unsigned int default_distrib_server = 0; 93 + static unsigned int interrupt_server_size = 8; 95 94 96 95 /* 97 96 * XICS only has a single IPI, so encode the messages per CPU ··· 98 99 struct xics_ipi_struct xics_ipi_message[NR_CPUS] __cacheline_aligned; 99 100 100 101 /* RTAS service tokens */ 101 - int ibm_get_xive; 102 - int ibm_set_xive; 103 - int ibm_int_on; 104 - int ibm_int_off; 102 + static int ibm_get_xive; 103 + static int ibm_set_xive; 104 + static int ibm_int_on; 105 + static int ibm_int_off; 105 106 106 107 typedef struct { 107 108 int (*xirr_info_get)(int cpu); ··· 283 284 call_status = rtas_call(ibm_set_xive, 3, 1, NULL, irq, server, 284 285 DEFAULT_PRIORITY); 285 286 if (call_status != 0) { 286 - printk(KERN_ERR "xics_enable_irq: irq=%d: ibm_set_xive " 287 - "returned %x\n", irq, call_status); 287 + printk(KERN_ERR "xics_enable_irq: irq=%u: ibm_set_xive " 288 + "returned %d\n", irq, call_status); 289 + printk("set_xive %x, server %x\n", ibm_set_xive, server); 288 290 return; 289 291 } 290 292 291 293 /* Now unmask the interrupt (often a no-op) */ 292 294 call_status = rtas_call(ibm_int_on, 1, 1, NULL, irq); 293 295 if (call_status != 0) { 294 - printk(KERN_ERR "xics_enable_irq: irq=%d: ibm_int_on " 295 - "returned %x\n", irq, call_status); 296 + printk(KERN_ERR "xics_enable_irq: irq=%u: ibm_int_on " 297 + "returned %d\n", irq, call_status); 296 298 return; 297 299 } 298 300 } ··· 308 308 309 309 call_status = rtas_call(ibm_int_off, 1, 1, NULL, irq); 310 310 if (call_status != 0) { 311 - printk(KERN_ERR "xics_disable_real_irq: irq=%d: " 312 - "ibm_int_off returned %x\n", irq, call_status); 311 + printk(KERN_ERR "xics_disable_real_irq: irq=%u: " 312 + "ibm_int_off returned %d\n", irq, call_status); 313 313 return; 314 314 } 315 315 ··· 317 317 /* Have to set XIVE to 0xff to be able to remove a slot */ 318 318 call_status = rtas_call(ibm_set_xive, 3, 1, NULL, irq, server, 0xff); 319 319 if (call_status != 0) { 320 - printk(KERN_ERR "xics_disable_irq: irq=%d: ibm_set_xive(0xff)" 321 - " returned %x\n", irq, call_status); 320 + printk(KERN_ERR "xics_disable_irq: irq=%u: ibm_set_xive(0xff)" 321 + " returned %d\n", irq, call_status); 322 322 return; 323 323 } 324 324 } ··· 380 380 if (irq == NO_IRQ) 381 381 irq = real_irq_to_virt_slowpath(vec); 382 382 if (irq == NO_IRQ) { 383 - printk(KERN_ERR "Interrupt %d (real) is invalid," 383 + printk(KERN_ERR "Interrupt %u (real) is invalid," 384 384 " disabling it.\n", vec); 385 385 xics_disable_real_irq(vec); 386 386 } else ··· 622 622 status = rtas_call(ibm_get_xive, 1, 3, xics_status, irq); 623 623 624 624 if (status) { 625 - printk(KERN_ERR "xics_set_affinity: irq=%d ibm,get-xive " 625 + printk(KERN_ERR "xics_set_affinity: irq=%u ibm,get-xive " 626 626 "returns %d\n", irq, status); 627 627 return; 628 628 } ··· 641 641 irq, newmask, xics_status[1]); 642 642 643 643 if (status) { 644 - printk(KERN_ERR "xics_set_affinity: irq=%d ibm,set-xive " 644 + printk(KERN_ERR "xics_set_affinity: irq=%u ibm,set-xive " 645 645 "returns %d\n", irq, status); 646 646 return; 647 647 } ··· 720 720 721 721 status = rtas_call(ibm_get_xive, 1, 3, xics_status, irq); 722 722 if (status) { 723 - printk(KERN_ERR "migrate_irqs_away: irq=%d " 723 + printk(KERN_ERR "migrate_irqs_away: irq=%u " 724 724 "ibm,get-xive returns %d\n", 725 725 virq, status); 726 726 goto unlock; ··· 734 734 if (xics_status[0] != get_hard_smp_processor_id(cpu)) 735 735 goto unlock; 736 736 737 - printk(KERN_WARNING "IRQ %d affinity broken off cpu %u\n", 737 + printk(KERN_WARNING "IRQ %u affinity broken off cpu %u\n", 738 738 virq, cpu); 739 739 740 740 /* Reset affinity to all cpus */
+25 -6
arch/ppc64/mm/fault.c
··· 77 77 return 0; 78 78 } 79 79 80 + static void do_dabr(struct pt_regs *regs, unsigned long error_code) 81 + { 82 + siginfo_t info; 83 + 84 + if (notify_die(DIE_DABR_MATCH, "dabr_match", regs, error_code, 85 + 11, SIGSEGV) == NOTIFY_STOP) 86 + return; 87 + 88 + if (debugger_dabr_match(regs)) 89 + return; 90 + 91 + /* Clear the DABR */ 92 + set_dabr(0); 93 + 94 + /* Deliver the signal to userspace */ 95 + info.si_signo = SIGTRAP; 96 + info.si_errno = 0; 97 + info.si_code = TRAP_HWBKPT; 98 + info.si_addr = (void __user *)regs->nip; 99 + force_sig_info(SIGTRAP, &info, current); 100 + } 101 + 80 102 /* 81 103 * The error_code parameter is 82 104 * - DSISR for a non-SLB data access fault, ··· 133 111 if (!user_mode(regs) && (address >= TASK_SIZE)) 134 112 return SIGSEGV; 135 113 136 - if (error_code & DSISR_DABRMATCH) { 137 - if (notify_die(DIE_DABR_MATCH, "dabr_match", regs, error_code, 138 - 11, SIGSEGV) == NOTIFY_STOP) 139 - return 0; 140 - if (debugger_dabr_match(regs)) 141 - return 0; 114 + if (error_code & DSISR_DABRMATCH) { 115 + do_dabr(regs, error_code); 116 + return 0; 142 117 } 143 118 144 119 if (in_atomic() || mm == NULL) {
-1
arch/ppc64/xmon/privinst.h
··· 46 46 GSETSPR(1008, hid0) 47 47 GSETSPR(1009, hid1) 48 48 GSETSPR(1010, iabr) 49 - GSETSPR(1013, dabr) 50 49 GSETSPR(1023, pir) 51 50 52 51 static inline void store_inst(void *p)
+4 -16
arch/ppc64/xmon/xmon.c
··· 586 586 { 587 587 if ((regs->msr & (MSR_IR|MSR_PR|MSR_SF)) != (MSR_IR|MSR_SF)) 588 588 return 0; 589 + if (dabr.enabled == 0) 590 + return 0; 589 591 xmon_core(regs, 0); 590 592 return 1; 591 593 } ··· 628 626 } 629 627 630 628 return 0; 631 - } 632 - 633 - /* On systems with a hypervisor, we can't set the DABR 634 - (data address breakpoint register) directly. */ 635 - static void set_controlled_dabr(unsigned long val) 636 - { 637 - #ifdef CONFIG_PPC_PSERIES 638 - if (systemcfg->platform == PLATFORM_PSERIES_LPAR) { 639 - int rc = plpar_hcall_norets(H_SET_DABR, val); 640 - if (rc != H_Success) 641 - xmon_printf("Warning: setting DABR failed (%d)\n", rc); 642 - } else 643 - #endif 644 - set_dabr(val); 645 629 } 646 630 647 631 static struct bpt *at_breakpoint(unsigned long pc) ··· 716 728 static void insert_cpu_bpts(void) 717 729 { 718 730 if (dabr.enabled) 719 - set_controlled_dabr(dabr.address | (dabr.enabled & 7)); 731 + set_dabr(dabr.address | (dabr.enabled & 7)); 720 732 if (iabr && cpu_has_feature(CPU_FTR_IABR)) 721 733 set_iabr(iabr->address 722 734 | (iabr->enabled & (BP_IABR|BP_IABR_TE))); ··· 744 756 745 757 static void remove_cpu_bpts(void) 746 758 { 747 - set_controlled_dabr(0); 759 + set_dabr(0); 748 760 if (cpu_has_feature(CPU_FTR_IABR)) 749 761 set_iabr(0); 750 762 }
+5 -1
drivers/w1/w1_ds2433.c
··· 15 15 #include <linux/delay.h> 16 16 #ifdef CONFIG_W1_F23_CRC 17 17 #include <linux/crc16.h> 18 + 19 + #define CRC16_INIT 0 20 + #define CRC16_VALID 0xb001 21 + 18 22 #endif 19 23 20 24 #include "w1.h" ··· 218 214 #ifdef CONFIG_W1_F23_CRC 219 215 /* can only write full blocks in cached mode */ 220 216 if ((off & W1_PAGE_MASK) || (count & W1_PAGE_MASK)) { 221 - dev_err(&sl->dev, "invalid offset/count off=%d cnt=%d\n", 217 + dev_err(&sl->dev, "invalid offset/count off=%d cnt=%zd\n", 222 218 (int)off, count); 223 219 return -EINVAL; 224 220 }
+8
include/asm-powerpc/siginfo.h
··· 15 15 16 16 #include <asm-generic/siginfo.h> 17 17 18 + /* 19 + * SIGTRAP si_codes 20 + */ 21 + #define TRAP_BRANCH (__SI_FAULT|3) /* process taken branch trap */ 22 + #define TRAP_HWBKPT (__SI_FAULT|4) /* hardware breakpoint or watchpoint */ 23 + #undef NSIGTRAP 24 + #define NSIGTRAP 4 25 + 18 26 #endif /* _ASM_POWERPC_SIGINFO_H */
+7
include/asm-ppc/ptrace.h
··· 142 142 #define PTRACE_GETEVRREGS 20 143 143 #define PTRACE_SETEVRREGS 21 144 144 145 + /* 146 + * Get or set a debug register. The first 16 are DABR registers and the 147 + * second 16 are IABR registers. 148 + */ 149 + #define PTRACE_GET_DEBUGREG 25 150 + #define PTRACE_SET_DEBUGREG 26 151 + 145 152 #endif
+6
include/asm-ppc64/hvcall.h
··· 56 56 #define H_PP1 (1UL<<(63-62)) 57 57 #define H_PP2 (1UL<<(63-63)) 58 58 59 + /* DABRX flags */ 60 + #define H_DABRX_HYPERVISOR (1UL<<(63-61)) 61 + #define H_DABRX_KERNEL (1UL<<(63-62)) 62 + #define H_DABRX_USER (1UL<<(63-63)) 63 + 59 64 /* pSeries hypervisor opcodes */ 60 65 #define H_REMOVE 0x04 61 66 #define H_ENTER 0x08 ··· 106 101 #define H_VIO_SIGNAL 0x104 107 102 #define H_SEND_CRQ 0x108 108 103 #define H_COPY_RDMA 0x110 104 + #define H_SET_XDABR 0x134 109 105 #define H_STUFF_TCE 0x138 110 106 #define H_PUT_TCE_INDIRECT 0x13C 111 107 #define H_VTERM_PARTNER_INFO 0x150
+1 -4
include/asm-ppc64/machdep.h
··· 88 88 89 89 /* PCI stuff */ 90 90 void (*pcibios_fixup)(void); 91 + int (*pci_probe_mode)(struct pci_bus *); 91 92 92 93 void (*restart)(char *cmd); 93 94 void (*power_off)(void); ··· 174 173 void ppc64_boot_msg(unsigned int src, const char *msg); 175 174 /* Print a termination message (print only -- does not stop the kernel) */ 176 175 void ppc64_terminate_msg(unsigned int src, const char *msg); 177 - /* Print something that needs attention (device error, etc) */ 178 - void ppc64_attention_msg(unsigned int src, const char *msg); 179 - /* Print a dump progress message. */ 180 - void ppc64_dump_msg(unsigned int src, const char *msg); 181 176 182 177 static inline void log_error(char *buf, unsigned int err_type, int fatal) 183 178 {
+5
include/asm-ppc64/pci-bridge.h
··· 119 119 return PCI_DN(busdn)->phb; 120 120 } 121 121 122 + /* Return values for ppc_md.pci_probe_mode function */ 123 + #define PCI_PROBE_NONE -1 /* Don't look at this bus at all */ 124 + #define PCI_PROBE_NORMAL 0 /* Do normal PCI probing */ 125 + #define PCI_PROBE_DEVTREE 1 /* Instantiate from device tree */ 126 + 122 127 #endif 123 128 #endif /* __KERNEL__ */
+9
include/asm-ppc64/plpar_wrappers.h
··· 107 107 lbuf[1]); 108 108 } 109 109 110 + static inline long plpar_set_xdabr(unsigned long address, unsigned long flags) 111 + { 112 + return plpar_hcall_norets(H_SET_XDABR, address, flags); 113 + } 114 + 115 + static inline long plpar_set_dabr(unsigned long val) 116 + { 117 + return plpar_hcall_norets(H_SET_DABR, val); 118 + } 110 119 111 120 #endif /* _PPC64_PLPAR_WRAPPERS_H */
+1
include/asm-ppc64/processor.h
··· 433 433 unsigned long start_tb; /* Start purr when proc switched in */ 434 434 unsigned long accum_tb; /* Total accumilated purr for process */ 435 435 unsigned long vdso_base; /* base of the vDSO library */ 436 + unsigned long dabr; /* Data address breakpoint register */ 436 437 #ifdef CONFIG_ALTIVEC 437 438 /* Complete AltiVec register set */ 438 439 vector128 vr[32] __attribute((aligned(16)));
+92
include/asm-ppc64/ptrace-common.h
··· 11 11 12 12 #ifndef _PPC64_PTRACE_COMMON_H 13 13 #define _PPC64_PTRACE_COMMON_H 14 + 15 + #include <linux/config.h> 16 + #include <asm/system.h> 17 + 14 18 /* 15 19 * Set of msr bits that gdb can change on behalf of a process. 16 20 */ ··· 71 67 if (regs != NULL) 72 68 regs->msr &= ~MSR_SE; 73 69 clear_ti_thread_flag(task->thread_info, TIF_SINGLESTEP); 70 + } 71 + 72 + #ifdef CONFIG_ALTIVEC 73 + /* 74 + * Get/set all the altivec registers vr0..vr31, vscr, vrsave, in one go. 75 + * The transfer totals 34 quadword. Quadwords 0-31 contain the 76 + * corresponding vector registers. Quadword 32 contains the vscr as the 77 + * last word (offset 12) within that quadword. Quadword 33 contains the 78 + * vrsave as the first word (offset 0) within the quadword. 79 + * 80 + * This definition of the VMX state is compatible with the current PPC32 81 + * ptrace interface. This allows signal handling and ptrace to use the 82 + * same structures. This also simplifies the implementation of a bi-arch 83 + * (combined (32- and 64-bit) gdb. 84 + */ 85 + 86 + /* 87 + * Get contents of AltiVec register state in task TASK 88 + */ 89 + static inline int get_vrregs(unsigned long __user *data, 90 + struct task_struct *task) 91 + { 92 + unsigned long regsize; 93 + 94 + /* copy AltiVec registers VR[0] .. VR[31] */ 95 + regsize = 32 * sizeof(vector128); 96 + if (copy_to_user(data, task->thread.vr, regsize)) 97 + return -EFAULT; 98 + data += (regsize / sizeof(unsigned long)); 99 + 100 + /* copy VSCR */ 101 + regsize = 1 * sizeof(vector128); 102 + if (copy_to_user(data, &task->thread.vscr, regsize)) 103 + return -EFAULT; 104 + data += (regsize / sizeof(unsigned long)); 105 + 106 + /* copy VRSAVE */ 107 + if (put_user(task->thread.vrsave, (u32 __user *)data)) 108 + return -EFAULT; 109 + 110 + return 0; 111 + } 112 + 113 + /* 114 + * Write contents of AltiVec register state into task TASK. 115 + */ 116 + static inline int set_vrregs(struct task_struct *task, 117 + unsigned long __user *data) 118 + { 119 + unsigned long regsize; 120 + 121 + /* copy AltiVec registers VR[0] .. VR[31] */ 122 + regsize = 32 * sizeof(vector128); 123 + if (copy_from_user(task->thread.vr, data, regsize)) 124 + return -EFAULT; 125 + data += (regsize / sizeof(unsigned long)); 126 + 127 + /* copy VSCR */ 128 + regsize = 1 * sizeof(vector128); 129 + if (copy_from_user(&task->thread.vscr, data, regsize)) 130 + return -EFAULT; 131 + data += (regsize / sizeof(unsigned long)); 132 + 133 + /* copy VRSAVE */ 134 + if (get_user(task->thread.vrsave, (u32 __user *)data)) 135 + return -EFAULT; 136 + 137 + return 0; 138 + } 139 + #endif 140 + 141 + static inline int ptrace_set_debugreg(struct task_struct *task, 142 + unsigned long addr, unsigned long data) 143 + { 144 + /* We only support one DABR and no IABRS at the moment */ 145 + if (addr > 0) 146 + return -EINVAL; 147 + 148 + /* The bottom 3 bits are flags */ 149 + if ((data & ~0x7UL) >= TASK_SIZE) 150 + return -EIO; 151 + 152 + /* Ensure translation is on */ 153 + if (data && !(data & DABR_TRANSLATION)) 154 + return -EIO; 155 + 156 + task->thread.dabr = data; 157 + return 0; 74 158 } 75 159 76 160 #endif /* _PPC64_PTRACE_COMMON_H */
+76 -52
include/asm-ppc64/ptrace.h
··· 25 25 */ 26 26 27 27 #ifndef __ASSEMBLY__ 28 - #define PPC_REG unsigned long 28 + 29 29 struct pt_regs { 30 - PPC_REG gpr[32]; 31 - PPC_REG nip; 32 - PPC_REG msr; 33 - PPC_REG orig_gpr3; /* Used for restarting system calls */ 34 - PPC_REG ctr; 35 - PPC_REG link; 36 - PPC_REG xer; 37 - PPC_REG ccr; 38 - PPC_REG softe; /* Soft enabled/disabled */ 39 - PPC_REG trap; /* Reason for being here */ 40 - PPC_REG dar; /* Fault registers */ 41 - PPC_REG dsisr; 42 - PPC_REG result; /* Result of a system call */ 30 + unsigned long gpr[32]; 31 + unsigned long nip; 32 + unsigned long msr; 33 + unsigned long orig_gpr3; /* Used for restarting system calls */ 34 + unsigned long ctr; 35 + unsigned long link; 36 + unsigned long xer; 37 + unsigned long ccr; 38 + unsigned long softe; /* Soft enabled/disabled */ 39 + unsigned long trap; /* Reason for being here */ 40 + unsigned long dar; /* Fault registers */ 41 + unsigned long dsisr; 42 + unsigned long result; /* Result of a system call */ 43 43 }; 44 44 45 - #define PPC_REG_32 unsigned int 46 45 struct pt_regs32 { 47 - PPC_REG_32 gpr[32]; 48 - PPC_REG_32 nip; 49 - PPC_REG_32 msr; 50 - PPC_REG_32 orig_gpr3; /* Used for restarting system calls */ 51 - PPC_REG_32 ctr; 52 - PPC_REG_32 link; 53 - PPC_REG_32 xer; 54 - PPC_REG_32 ccr; 55 - PPC_REG_32 mq; /* 601 only (not used at present) */ 56 - /* Used on APUS to hold IPL value. */ 57 - PPC_REG_32 trap; /* Reason for being here */ 58 - PPC_REG_32 dar; /* Fault registers */ 59 - PPC_REG_32 dsisr; 60 - PPC_REG_32 result; /* Result of a system call */ 46 + unsigned int gpr[32]; 47 + unsigned int nip; 48 + unsigned int msr; 49 + unsigned int orig_gpr3; /* Used for restarting system calls */ 50 + unsigned int ctr; 51 + unsigned int link; 52 + unsigned int xer; 53 + unsigned int ccr; 54 + unsigned int mq; /* 601 only (not used at present) */ 55 + unsigned int trap; /* Reason for being here */ 56 + unsigned int dar; /* Fault registers */ 57 + unsigned int dsisr; 58 + unsigned int result; /* Result of a system call */ 61 59 }; 60 + 61 + #ifdef __KERNEL__ 62 62 63 63 #define instruction_pointer(regs) ((regs)->nip) 64 + 64 65 #ifdef CONFIG_SMP 65 66 extern unsigned long profile_pc(struct pt_regs *regs); 66 67 #else 67 68 #define profile_pc(regs) instruction_pointer(regs) 68 69 #endif 69 - 70 - #endif /* __ASSEMBLY__ */ 71 - 72 - #define STACK_FRAME_OVERHEAD 112 /* size of minimum stack frame */ 73 - 74 - /* Size of dummy stack frame allocated when calling signal handler. */ 75 - #define __SIGNAL_FRAMESIZE 128 76 - #define __SIGNAL_FRAMESIZE32 64 77 70 78 71 #define user_mode(regs) ((((regs)->msr) >> MSR_PR_LG) & 0x1) 79 72 ··· 81 88 #define FULL_REGS(regs) (((regs)->trap & 1) == 0) 82 89 #define TRAP(regs) ((regs)->trap & ~0xF) 83 90 #define CHECK_FULL_REGS(regs) BUG_ON(regs->trap & 1) 91 + 92 + #endif /* __KERNEL__ */ 93 + 94 + #endif /* __ASSEMBLY__ */ 95 + 96 + #define STACK_FRAME_OVERHEAD 112 /* size of minimum stack frame */ 97 + 98 + /* Size of dummy stack frame allocated when calling signal handler. */ 99 + #define __SIGNAL_FRAMESIZE 128 100 + #define __SIGNAL_FRAMESIZE32 64 84 101 85 102 /* 86 103 * Offsets used by 'ptrace' system call interface. ··· 138 135 #define PT_XER 37 139 136 #define PT_CCR 38 140 137 #define PT_SOFTE 39 138 + #define PT_TRAP 40 139 + #define PT_DAR 41 140 + #define PT_DSISR 42 141 141 #define PT_RESULT 43 142 142 143 143 #define PT_FPR0 48 144 144 145 - /* Kernel and userspace will both use this PT_FPSCR value. 32-bit apps will have 146 - * visibility to the asm-ppc/ptrace.h header instead of this one. 145 + /* 146 + * Kernel and userspace will both use this PT_FPSCR value. 32-bit apps will 147 + * have visibility to the asm-ppc/ptrace.h header instead of this one. 147 148 */ 148 - #define PT_FPSCR (PT_FPR0 + 32) /* each FP reg occupies 1 slot in 64-bit space */ 149 + #define PT_FPSCR (PT_FPR0 + 32) /* each FP reg occupies 1 slot in 64-bit space */ 149 150 150 151 #ifdef __KERNEL__ 151 - #define PT_FPSCR32 (PT_FPR0 + 2*32 + 1) /* each FP reg occupies 2 32-bit userspace slots */ 152 + #define PT_FPSCR32 (PT_FPR0 + 2*32 + 1) /* each FP reg occupies 2 32-bit userspace slots */ 152 153 #endif 153 154 154 155 #define PT_VR0 82 /* each Vector reg occupies 2 slots in 64-bit */ ··· 180 173 #define PTRACE_GETVRREGS 18 181 174 #define PTRACE_SETVRREGS 19 182 175 183 - /* Additional PTRACE requests implemented on PowerPC. */ 184 - #define PPC_PTRACE_GETREGS 0x99 /* Get GPRs 0 - 31 */ 185 - #define PPC_PTRACE_SETREGS 0x98 /* Set GPRs 0 - 31 */ 186 - #define PPC_PTRACE_GETFPREGS 0x97 /* Get FPRs 0 - 31 */ 187 - #define PPC_PTRACE_SETFPREGS 0x96 /* Set FPRs 0 - 31 */ 188 - #define PPC_PTRACE_PEEKTEXT_3264 0x95 /* Read word at location ADDR on a 64-bit process from a 32-bit process. */ 189 - #define PPC_PTRACE_PEEKDATA_3264 0x94 /* Read word at location ADDR on a 64-bit process from a 32-bit process. */ 190 - #define PPC_PTRACE_POKETEXT_3264 0x93 /* Write word at location ADDR on a 64-bit process from a 32-bit process. */ 191 - #define PPC_PTRACE_POKEDATA_3264 0x92 /* Write word at location ADDR on a 64-bit process from a 32-bit process. */ 192 - #define PPC_PTRACE_PEEKUSR_3264 0x91 /* Read a register (specified by ADDR) out of the "user area" on a 64-bit process from a 32-bit process. */ 193 - #define PPC_PTRACE_POKEUSR_3264 0x90 /* Write DATA into location ADDR within the "user area" on a 64-bit process from a 32-bit process. */ 176 + /* 177 + * While we dont have 64bit book E processors, we need to reserve the 178 + * relevant ptrace calls for 32bit compatibility. 179 + */ 180 + #if 0 181 + #define PTRACE_GETEVRREGS 20 182 + #define PTRACE_SETEVRREGS 21 183 + #endif 194 184 185 + /* 186 + * Get or set a debug register. The first 16 are DABR registers and the 187 + * second 16 are IABR registers. 188 + */ 189 + #define PTRACE_GET_DEBUGREG 25 190 + #define PTRACE_SET_DEBUGREG 26 191 + 192 + /* Additional PTRACE requests implemented on PowerPC. */ 193 + #define PPC_PTRACE_GETREGS 0x99 /* Get GPRs 0 - 31 */ 194 + #define PPC_PTRACE_SETREGS 0x98 /* Set GPRs 0 - 31 */ 195 + #define PPC_PTRACE_GETFPREGS 0x97 /* Get FPRs 0 - 31 */ 196 + #define PPC_PTRACE_SETFPREGS 0x96 /* Set FPRs 0 - 31 */ 197 + 198 + /* Calls to trace a 64bit program from a 32bit program */ 199 + #define PPC_PTRACE_PEEKTEXT_3264 0x95 200 + #define PPC_PTRACE_PEEKDATA_3264 0x94 201 + #define PPC_PTRACE_POKETEXT_3264 0x93 202 + #define PPC_PTRACE_POKEDATA_3264 0x92 203 + #define PPC_PTRACE_PEEKUSR_3264 0x91 204 + #define PPC_PTRACE_POKEUSR_3264 0x90 195 205 196 206 #endif /* _PPC64_PTRACE_H */
+3
include/asm-ppc64/system.h
··· 101 101 static inline int debugger_fault_handler(struct pt_regs *regs) { return 0; } 102 102 #endif 103 103 104 + extern int set_dabr(unsigned long dabr); 105 + extern void _exception(int signr, struct pt_regs *regs, int code, 106 + unsigned long addr); 104 107 extern int fix_alignment(struct pt_regs *regs); 105 108 extern void bad_page_fault(struct pt_regs *regs, unsigned long address, 106 109 int sig);
+1 -15
include/linux/crc16.h
··· 1 1 /* 2 2 * crc16.h - CRC-16 routine 3 3 * 4 - * Implements the standard CRC-16, as used with 1-wire devices: 4 + * Implements the standard CRC-16: 5 5 * Width 16 6 6 * Poly 0x8005 (x^16 + x^15 + x^2 + 1) 7 7 * Init 0 8 - * 9 - * For 1-wire devices, the CRC is stored inverted, LSB-first 10 - * 11 - * Example buffer with the CRC attached: 12 - * 31 32 33 34 35 36 37 38 39 C2 44 13 - * 14 - * The CRC over a buffer with the CRC attached is 0xB001. 15 - * So, if (crc16(0, buf, size) == 0xB001) then the buffer is valid. 16 - * 17 - * Refer to "Application Note 937: Book of iButton Standards" for details. 18 - * http://www.maxim-ic.com/appnotes.cfm/appnote_number/937 19 8 * 20 9 * Copyright (c) 2005 Ben Gardner <bgardner@wabtec.com> 21 10 * ··· 16 27 #define __CRC16_H 17 28 18 29 #include <linux/types.h> 19 - 20 - #define CRC16_INIT 0 21 - #define CRC16_VALID 0xb001 22 30 23 31 extern u16 const crc16_table[256]; 24 32