···272272 unsigned long start_here = __pa((u32)*((unsigned long *)273273 pSeries_secondary_smp_init));274274 unsigned int pcpu;275275+ int start_cpu;275276276277 if (cpu_isset(lcpu, of_spin_map))277278 /* Already started by OF and sitting in spin loop */···283282 /* Fixup atomic count: it exited inside IRQ handler. */284283 paca[lcpu].__current->thread_info->preempt_count = 0;285284286286- status = rtas_call(rtas_token("start-cpu"), 3, 1, NULL,287287- pcpu, start_here, lcpu);285285+ /* 286286+ * If the RTAS start-cpu token does not exist then presume the287287+ * cpu is already spinning.288288+ */289289+ start_cpu = rtas_token("start-cpu");290290+ if (start_cpu == RTAS_UNKNOWN_SERVICE)291291+ return 1;292292+293293+ status = rtas_call(start_cpu, 3, 1, NULL, pcpu, start_here, lcpu);288294 if (status != 0) {289295 printk(KERN_ERR "start-cpu failed: %i\n", status);290296 return 0;291297 }298298+292299 return 1;293300}294301
+337-92
arch/ppc64/kernel/pci.c
···51515252EXPORT_SYMBOL(io_page_mask);53535454+#ifdef CONFIG_PPC_MULTIPLATFORM5555+static void fixup_resource(struct resource *res, struct pci_dev *dev);5656+static void do_bus_setup(struct pci_bus *bus);5757+#endif54585559unsigned int pcibios_assign_all_busses(void)5660{···229225}230226#endif231227228228+#ifdef CONFIG_PPC_MULTIPLATFORM229229+static u32 get_int_prop(struct device_node *np, const char *name, u32 def)230230+{231231+ u32 *prop;232232+ int len;233233+234234+ prop = (u32 *) get_property(np, name, &len);235235+ if (prop && len >= 4)236236+ return *prop;237237+ return def;238238+}239239+240240+static unsigned int pci_parse_of_flags(u32 addr0)241241+{242242+ unsigned int flags = 0;243243+244244+ if (addr0 & 0x02000000) {245245+ flags |= IORESOURCE_MEM;246246+ if (addr0 & 0x40000000)247247+ flags |= IORESOURCE_PREFETCH;248248+ } else if (addr0 & 0x01000000)249249+ flags |= IORESOURCE_IO;250250+ return flags;251251+}252252+253253+#define GET_64BIT(prop, i) ((((u64) (prop)[(i)]) << 32) | (prop)[(i)+1])254254+255255+static void pci_parse_of_addrs(struct device_node *node, struct pci_dev *dev)256256+{257257+ u64 base, size;258258+ unsigned int flags;259259+ struct resource *res;260260+ u32 *addrs, i;261261+ int proplen;262262+263263+ addrs = (u32 *) get_property(node, "assigned-addresses", &proplen);264264+ if (!addrs)265265+ return;266266+ for (; proplen >= 20; proplen -= 20, addrs += 5) {267267+ flags = pci_parse_of_flags(addrs[0]);268268+ if (!flags)269269+ continue;270270+ base = GET_64BIT(addrs, 1);271271+ size = GET_64BIT(addrs, 3);272272+ if (!size)273273+ continue;274274+ i = addrs[0] & 0xff;275275+ if (PCI_BASE_ADDRESS_0 <= i && i <= PCI_BASE_ADDRESS_5) {276276+ res = &dev->resource[(i - PCI_BASE_ADDRESS_0) >> 2];277277+ } else if (i == dev->rom_base_reg) {278278+ res = &dev->resource[PCI_ROM_RESOURCE];279279+ flags |= IORESOURCE_READONLY | IORESOURCE_CACHEABLE;280280+ } else {281281+ printk(KERN_ERR "PCI: bad cfg reg num 0x%x\n", i);282282+ continue;283283+ }284284+ res->start = base;285285+ res->end = base + size - 1;286286+ res->flags = flags;287287+ res->name = pci_name(dev);288288+ fixup_resource(res, dev);289289+ }290290+}291291+292292+static struct pci_dev *of_create_pci_dev(struct device_node *node,293293+ struct pci_bus *bus, int devfn)294294+{295295+ struct pci_dev *dev;296296+ const char *type;297297+298298+ dev = kmalloc(sizeof(struct pci_dev), GFP_KERNEL);299299+ if (!dev)300300+ return NULL;301301+ type = get_property(node, "device_type", NULL);302302+ if (type == NULL)303303+ type = "";304304+305305+ memset(dev, 0, sizeof(struct pci_dev));306306+ dev->bus = bus;307307+ dev->sysdata = node;308308+ dev->dev.parent = bus->bridge;309309+ dev->dev.bus = &pci_bus_type;310310+ dev->devfn = devfn;311311+ dev->multifunction = 0; /* maybe a lie? */312312+313313+ dev->vendor = get_int_prop(node, "vendor-id", 0xffff);314314+ dev->device = get_int_prop(node, "device-id", 0xffff);315315+ dev->subsystem_vendor = get_int_prop(node, "subsystem-vendor-id", 0);316316+ dev->subsystem_device = get_int_prop(node, "subsystem-id", 0);317317+318318+ dev->cfg_size = 256; /*pci_cfg_space_size(dev);*/319319+320320+ sprintf(pci_name(dev), "%04x:%02x:%02x.%d", pci_domain_nr(bus),321321+ dev->bus->number, PCI_SLOT(devfn), PCI_FUNC(devfn));322322+ dev->class = get_int_prop(node, "class-code", 0);323323+324324+ dev->current_state = 4; /* unknown power state */325325+326326+ if (!strcmp(type, "pci")) {327327+ /* a PCI-PCI bridge */328328+ dev->hdr_type = PCI_HEADER_TYPE_BRIDGE;329329+ dev->rom_base_reg = PCI_ROM_ADDRESS1;330330+ } else if (!strcmp(type, "cardbus")) {331331+ dev->hdr_type = PCI_HEADER_TYPE_CARDBUS;332332+ } else {333333+ dev->hdr_type = PCI_HEADER_TYPE_NORMAL;334334+ dev->rom_base_reg = PCI_ROM_ADDRESS;335335+ dev->irq = NO_IRQ;336336+ if (node->n_intrs > 0) {337337+ dev->irq = node->intrs[0].line;338338+ pci_write_config_byte(dev, PCI_INTERRUPT_LINE,339339+ dev->irq);340340+ }341341+ }342342+343343+ pci_parse_of_addrs(node, dev);344344+345345+ pci_device_add(dev, bus);346346+347347+ /* XXX pci_scan_msi_device(dev); */348348+349349+ return dev;350350+}351351+352352+static void of_scan_pci_bridge(struct device_node *node, struct pci_dev *dev);353353+354354+static void __devinit of_scan_bus(struct device_node *node,355355+ struct pci_bus *bus)356356+{357357+ struct device_node *child = NULL;358358+ u32 *reg;359359+ int reglen, devfn;360360+ struct pci_dev *dev;361361+362362+ while ((child = of_get_next_child(node, child)) != NULL) {363363+ reg = (u32 *) get_property(child, "reg", ®len);364364+ if (reg == NULL || reglen < 20)365365+ continue;366366+ devfn = (reg[0] >> 8) & 0xff;367367+ /* create a new pci_dev for this device */368368+ dev = of_create_pci_dev(child, bus, devfn);369369+ if (!dev)370370+ continue;371371+ if (dev->hdr_type == PCI_HEADER_TYPE_BRIDGE ||372372+ dev->hdr_type == PCI_HEADER_TYPE_CARDBUS)373373+ of_scan_pci_bridge(child, dev);374374+ }375375+376376+ do_bus_setup(bus);377377+}378378+379379+static void __devinit of_scan_pci_bridge(struct device_node *node,380380+ struct pci_dev *dev)381381+{382382+ struct pci_bus *bus;383383+ u32 *busrange, *ranges;384384+ int len, i, mode;385385+ struct resource *res;386386+ unsigned int flags;387387+ u64 size;388388+389389+ /* parse bus-range property */390390+ busrange = (u32 *) get_property(node, "bus-range", &len);391391+ if (busrange == NULL || len != 8) {392392+ printk(KERN_ERR "Can't get bus-range for PCI-PCI bridge %s\n",393393+ node->full_name);394394+ return;395395+ }396396+ ranges = (u32 *) get_property(node, "ranges", &len);397397+ if (ranges == NULL) {398398+ printk(KERN_ERR "Can't get ranges for PCI-PCI bridge %s\n",399399+ node->full_name);400400+ return;401401+ }402402+403403+ bus = pci_add_new_bus(dev->bus, dev, busrange[0]);404404+ if (!bus) {405405+ printk(KERN_ERR "Failed to create pci bus for %s\n",406406+ node->full_name);407407+ return;408408+ }409409+410410+ bus->primary = dev->bus->number;411411+ bus->subordinate = busrange[1];412412+ bus->bridge_ctl = 0;413413+ bus->sysdata = node;414414+415415+ /* parse ranges property */416416+ /* PCI #address-cells == 3 and #size-cells == 2 always */417417+ res = &dev->resource[PCI_BRIDGE_RESOURCES];418418+ for (i = 0; i < PCI_NUM_RESOURCES - PCI_BRIDGE_RESOURCES; ++i) {419419+ res->flags = 0;420420+ bus->resource[i] = res;421421+ ++res;422422+ }423423+ i = 1;424424+ for (; len >= 32; len -= 32, ranges += 8) {425425+ flags = pci_parse_of_flags(ranges[0]);426426+ size = GET_64BIT(ranges, 6);427427+ if (flags == 0 || size == 0)428428+ continue;429429+ if (flags & IORESOURCE_IO) {430430+ res = bus->resource[0];431431+ if (res->flags) {432432+ printk(KERN_ERR "PCI: ignoring extra I/O range"433433+ " for bridge %s\n", node->full_name);434434+ continue;435435+ }436436+ } else {437437+ if (i >= PCI_NUM_RESOURCES - PCI_BRIDGE_RESOURCES) {438438+ printk(KERN_ERR "PCI: too many memory ranges"439439+ " for bridge %s\n", node->full_name);440440+ continue;441441+ }442442+ res = bus->resource[i];443443+ ++i;444444+ }445445+ res->start = GET_64BIT(ranges, 1);446446+ res->end = res->start + size - 1;447447+ res->flags = flags;448448+ fixup_resource(res, dev);449449+ }450450+ sprintf(bus->name, "PCI Bus %04x:%02x", pci_domain_nr(bus),451451+ bus->number);452452+453453+ mode = PCI_PROBE_NORMAL;454454+ if (ppc_md.pci_probe_mode)455455+ mode = ppc_md.pci_probe_mode(bus);456456+ if (mode == PCI_PROBE_DEVTREE)457457+ of_scan_bus(node, bus);458458+ else if (mode == PCI_PROBE_NORMAL)459459+ pci_scan_child_bus(bus);460460+}461461+#endif /* CONFIG_PPC_MULTIPLATFORM */462462+463463+static void __devinit scan_phb(struct pci_controller *hose)464464+{465465+ struct pci_bus *bus;466466+ struct device_node *node = hose->arch_data;467467+ int i, mode;468468+ struct resource *res;469469+470470+ bus = pci_create_bus(NULL, hose->first_busno, hose->ops, node);471471+ if (bus == NULL) {472472+ printk(KERN_ERR "Failed to create bus for PCI domain %04x\n",473473+ hose->global_number);474474+ return;475475+ }476476+ bus->secondary = hose->first_busno;477477+ hose->bus = bus;478478+479479+ bus->resource[0] = res = &hose->io_resource;480480+ if (res->flags && request_resource(&ioport_resource, res))481481+ printk(KERN_ERR "Failed to request PCI IO region "482482+ "on PCI domain %04x\n", hose->global_number);483483+484484+ for (i = 0; i < 3; ++i) {485485+ res = &hose->mem_resources[i];486486+ bus->resource[i+1] = res;487487+ if (res->flags && request_resource(&iomem_resource, res))488488+ printk(KERN_ERR "Failed to request PCI memory region "489489+ "on PCI domain %04x\n", hose->global_number);490490+ }491491+492492+ mode = PCI_PROBE_NORMAL;493493+#ifdef CONFIG_PPC_MULTIPLATFORM494494+ if (ppc_md.pci_probe_mode)495495+ mode = ppc_md.pci_probe_mode(bus);496496+ if (mode == PCI_PROBE_DEVTREE) {497497+ bus->subordinate = hose->last_busno;498498+ of_scan_bus(node, bus);499499+ }500500+#endif /* CONFIG_PPC_MULTIPLATFORM */501501+ if (mode == PCI_PROBE_NORMAL)502502+ hose->last_busno = bus->subordinate = pci_scan_child_bus(bus);503503+ pci_bus_add_devices(bus);504504+}505505+232506static int __init pcibios_init(void)233507{234508 struct pci_controller *hose, *tmp;235235- struct pci_bus *bus;236509237510 /* For now, override phys_mem_access_prot. If we need it,238511 * later, we may move that initialization to each ppc_md···523242 printk("PCI: Probing PCI hardware\n");524243525244 /* Scan all of the recorded PCI controllers. */526526- list_for_each_entry_safe(hose, tmp, &hose_list, list_node) {527527- hose->last_busno = 0xff;528528- bus = pci_scan_bus(hose->first_busno, hose->ops,529529- hose->arch_data);530530- hose->bus = bus;531531- hose->last_busno = bus->subordinate;532532- }245245+ list_for_each_entry_safe(hose, tmp, &hose_list, list_node)246246+ scan_phb(hose);533247534248#ifndef CONFIG_PPC_ISERIES535249 if (pci_probe_only)···1096820/*1097821 * ppc64 can have multifunction devices that do not respond to function 0.1098822 * In this case we must scan all functions.823823+ * XXX this can go now, we use the OF device tree in all the824824+ * cases that caused problems. -- paulus1099825 */1100826int pcibios_scan_all_fns(struct pci_bus *bus, int devfn)1101827{11021102- struct device_node *busdn, *dn;11031103-11041104- if (bus->self)11051105- busdn = pci_device_to_OF_node(bus->self);11061106- else11071107- busdn = bus->sysdata; /* must be a phb */11081108-11091109- if (busdn == NULL)11101110- return 0;11111111-11121112- /*11131113- * Check to see if there is any of the 8 functions are in the11141114- * device tree. If they are then we need to scan all the11151115- * functions of this slot.11161116- */11171117- for (dn = busdn->child; dn; dn = dn->sibling) {11181118- struct pci_dn *pdn = dn->data;11191119- if (pdn && (pdn->devfn >> 3) == (devfn >> 3))11201120- return 1;11211121- }11221122-1123828 return 0;1124829}1125830831831+static void __devinit fixup_resource(struct resource *res, struct pci_dev *dev)832832+{833833+ struct pci_controller *hose = pci_bus_to_host(dev->bus);834834+ unsigned long start, end, mask, offset;835835+836836+ if (res->flags & IORESOURCE_IO) {837837+ offset = (unsigned long)hose->io_base_virt - pci_io_base;838838+839839+ start = res->start += offset;840840+ end = res->end += offset;841841+842842+ /* Need to allow IO access to pages that are in the843843+ ISA range */844844+ if (start < MAX_ISA_PORT) {845845+ if (end > MAX_ISA_PORT)846846+ end = MAX_ISA_PORT;847847+848848+ start >>= PAGE_SHIFT;849849+ end >>= PAGE_SHIFT;850850+851851+ /* get the range of pages for the map */852852+ mask = ((1 << (end+1)) - 1) ^ ((1 << start) - 1);853853+ io_page_mask |= mask;854854+ }855855+ } else if (res->flags & IORESOURCE_MEM) {856856+ res->start += hose->pci_mem_offset;857857+ res->end += hose->pci_mem_offset;858858+ }859859+}11268601127861void __devinit pcibios_fixup_device_resources(struct pci_dev *dev,11281128- struct pci_bus *bus)862862+ struct pci_bus *bus)1129863{1130864 /* Update device resources. */11311131- struct pci_controller *hose = pci_bus_to_host(bus);1132865 int i;113386611341134- for (i = 0; i < PCI_NUM_RESOURCES; i++) {11351135- if (dev->resource[i].flags & IORESOURCE_IO) {11361136- unsigned long offset = (unsigned long)hose->io_base_virt11371137- - pci_io_base;11381138- unsigned long start, end, mask;11391139-11401140- start = dev->resource[i].start += offset;11411141- end = dev->resource[i].end += offset;11421142-11431143- /* Need to allow IO access to pages that are in the11441144- ISA range */11451145- if (start < MAX_ISA_PORT) {11461146- if (end > MAX_ISA_PORT)11471147- end = MAX_ISA_PORT;11481148-11491149- start >>= PAGE_SHIFT;11501150- end >>= PAGE_SHIFT;11511151-11521152- /* get the range of pages for the map */11531153- mask = ((1 << (end+1))-1) ^ ((1 << start)-1);11541154- io_page_mask |= mask;11551155- }11561156- }11571157- else if (dev->resource[i].flags & IORESOURCE_MEM) {11581158- dev->resource[i].start += hose->pci_mem_offset;11591159- dev->resource[i].end += hose->pci_mem_offset;11601160- }11611161- }867867+ for (i = 0; i < PCI_NUM_RESOURCES; i++)868868+ if (dev->resource[i].flags)869869+ fixup_resource(&dev->resource[i], dev);1162870}1163871EXPORT_SYMBOL(pcibios_fixup_device_resources);116487211651165-void __devinit pcibios_fixup_bus(struct pci_bus *bus)873873+static void __devinit do_bus_setup(struct pci_bus *bus)1166874{11671167- struct pci_controller *hose = pci_bus_to_host(bus);11681168- struct pci_dev *dev = bus->self;11691169- struct resource *res;11701170- int i;11711171-11721172- if (!dev) {11731173- /* Root bus. */11741174-11751175- hose->bus = bus;11761176- bus->resource[0] = res = &hose->io_resource;11771177-11781178- if (res->flags && request_resource(&ioport_resource, res))11791179- printk(KERN_ERR "Failed to request IO on "11801180- "PCI domain %d\n", pci_domain_nr(bus));11811181-11821182- for (i = 0; i < 3; ++i) {11831183- res = &hose->mem_resources[i];11841184- bus->resource[i+1] = res;11851185- if (res->flags && request_resource(&iomem_resource, res))11861186- printk(KERN_ERR "Failed to request MEM on "11871187- "PCI domain %d\n",11881188- pci_domain_nr(bus));11891189- }11901190- } else if (pci_probe_only &&11911191- (dev->class >> 8) == PCI_CLASS_BRIDGE_PCI) {11921192- /* This is a subordinate bridge */11931193-11941194- pci_read_bridge_bases(bus);11951195- pcibios_fixup_device_resources(dev, bus);11961196- }875875+ struct pci_dev *dev;11978761198877 ppc_md.iommu_bus_setup(bus);1199878···11579261158927 if (ppc_md.irq_bus_setup)1159928 ppc_md.irq_bus_setup(bus);929929+}930930+931931+void __devinit pcibios_fixup_bus(struct pci_bus *bus)932932+{933933+ struct pci_dev *dev = bus->self;934934+935935+ if (dev && pci_probe_only &&936936+ (dev->class >> 8) == PCI_CLASS_BRIDGE_PCI) {937937+ /* This is a subordinate bridge */938938+939939+ pci_read_bridge_bases(bus);940940+ pcibios_fixup_device_resources(dev, bus);941941+ }942942+943943+ do_bus_setup(bus);11609441161945 if (!pci_probe_only)1162946 return;116394711641164- list_for_each_entry(dev, &bus->devices, bus_list) {948948+ list_for_each_entry(dev, &bus->devices, bus_list)1165949 if ((dev->class >> 8) != PCI_CLASS_BRIDGE_PCI)1166950 pcibios_fixup_device_resources(dev, bus);11671167- }1168951}1169952EXPORT_SYMBOL(pcibios_fixup_bus);1170953
+28-28
arch/ppc64/kernel/pmac_pci.c
···388388 * the reg address cell, we shall fix that by killing struct389389 * reg_property and using some accessor functions instead390390 */391391- hose->first_busno = 0xf0;391391+ hose->first_busno = 0xf0;392392 hose->last_busno = 0xff;393393 has_uninorth = 1;394394 hose->ops = ¯isc_pci_ops;···473473 continue;474474 } 475475 cur++;476476- DBG("U3/HT: hole, %d end at %08lx, %d start at %08lx\n",476476+ DBG("U3/HT: hole, %d end at %08lx, %d start at %08lx\n",477477 cur-1, res->start - 1, cur, res->end + 1);478478 hose->mem_resources[cur].name = np->full_name;479479 hose->mem_resources[cur].flags = IORESOURCE_MEM;···603603 char* disp_name;604604 int *bus_range;605605 int primary = 1;606606- struct property *of_prop;606606+ struct property *of_prop;607607608608 DBG("Adding PCI host bridge %s\n", dev->full_name);609609610610- bus_range = (int *) get_property(dev, "bus-range", &len);611611- if (bus_range == NULL || len < 2 * sizeof(int)) {612612- printk(KERN_WARNING "Can't get bus-range for %s, assume bus 0\n",613613- dev->full_name);614614- }610610+ bus_range = (int *) get_property(dev, "bus-range", &len);611611+ if (bus_range == NULL || len < 2 * sizeof(int)) {612612+ printk(KERN_WARNING "Can't get bus-range for %s, assume bus 0\n",613613+ dev->full_name);614614+ }615615616616 hose = alloc_bootmem(sizeof(struct pci_controller));617617 if (hose == NULL)618618 return -ENOMEM;619619- pci_setup_pci_controller(hose);619619+ pci_setup_pci_controller(hose);620620621621- hose->arch_data = dev;622622- hose->first_busno = bus_range ? bus_range[0] : 0;623623- hose->last_busno = bus_range ? bus_range[1] : 0xff;621621+ hose->arch_data = dev;622622+ hose->first_busno = bus_range ? bus_range[0] : 0;623623+ hose->last_busno = bus_range ? bus_range[1] : 0xff;624624625625 of_prop = alloc_bootmem(sizeof(struct property) +626626 sizeof(hose->global_number));···634634 }635635636636 disp_name = NULL;637637- if (device_is_compatible(dev, "u3-agp")) {638638- setup_u3_agp(hose);639639- disp_name = "U3-AGP";640640- primary = 0;641641- } else if (device_is_compatible(dev, "u3-ht")) {642642- setup_u3_ht(hose);643643- disp_name = "U3-HT";644644- primary = 1;645645- }646646- printk(KERN_INFO "Found %s PCI host bridge. Firmware bus number: %d->%d\n",647647- disp_name, hose->first_busno, hose->last_busno);637637+ if (device_is_compatible(dev, "u3-agp")) {638638+ setup_u3_agp(hose);639639+ disp_name = "U3-AGP";640640+ primary = 0;641641+ } else if (device_is_compatible(dev, "u3-ht")) {642642+ setup_u3_ht(hose);643643+ disp_name = "U3-HT";644644+ primary = 1;645645+ }646646+ printk(KERN_INFO "Found %s PCI host bridge. Firmware bus number: %d->%d\n",647647+ disp_name, hose->first_busno, hose->last_busno);648648649649- /* Interpret the "ranges" property */650650- /* This also maps the I/O region and sets isa_io/mem_base */651651- pmac_process_bridge_OF_ranges(hose, dev, primary);649649+ /* Interpret the "ranges" property */650650+ /* This also maps the I/O region and sets isa_io/mem_base */651651+ pmac_process_bridge_OF_ranges(hose, dev, primary);652652653653- /* Fixup "bus-range" OF property */654654- fixup_bus_range(dev);653653+ /* Fixup "bus-range" OF property */654654+ fixup_bus_range(dev);655655656656 return 0;657657}
+13
arch/ppc64/kernel/pmac_setup.c
···477477 return 1;478478}479479480480+static int pmac_probe_mode(struct pci_bus *bus)481481+{482482+ struct device_node *node = bus->sysdata;483483+484484+ /* We need to use normal PCI probing for the AGP bus,485485+ since the device for the AGP bridge isn't in the tree. */486486+ if (bus->self == NULL && device_is_compatible(node, "u3-agp"))487487+ return PCI_PROBE_NORMAL;488488+489489+ return PCI_PROBE_DEVTREE;490490+}491491+480492struct machdep_calls __initdata pmac_md = {481493#ifdef CONFIG_HOTPLUG_CPU482494 .cpu_die = generic_mach_cpu_die,···500488 .init_IRQ = pmac_init_IRQ,501489 .get_irq = mpic_get_irq,502490 .pcibios_fixup = pmac_pcibios_fixup,491491+ .pci_probe_mode = pmac_probe_mode,503492 .restart = pmac_restart,504493 .power_off = pmac_power_off,505494 .halt = pmac_halt,
+34
arch/ppc64/kernel/process.c
···5454#include <asm/sections.h>5555#include <asm/tlbflush.h>5656#include <asm/time.h>5757+#include <asm/plpar_wrappers.h>57585859#ifndef CONFIG_SMP5960struct task_struct *last_task_used_math = NULL;···164163165164#endif /* CONFIG_ALTIVEC */166165166166+static void set_dabr_spr(unsigned long val)167167+{168168+ mtspr(SPRN_DABR, val);169169+}170170+171171+int set_dabr(unsigned long dabr)172172+{173173+ int ret = 0;174174+175175+ if (firmware_has_feature(FW_FEATURE_XDABR)) {176176+ /* We want to catch accesses from kernel and userspace */177177+ unsigned long flags = H_DABRX_KERNEL|H_DABRX_USER;178178+ ret = plpar_set_xdabr(dabr, flags);179179+ } else if (firmware_has_feature(FW_FEATURE_DABR)) {180180+ ret = plpar_set_dabr(dabr);181181+ } else {182182+ set_dabr_spr(dabr);183183+ }184184+185185+ return ret;186186+}187187+167188DEFINE_PER_CPU(struct cpu_usage, cpu_usage_array);189189+static DEFINE_PER_CPU(unsigned long, current_dabr);168190169191struct task_struct *__switch_to(struct task_struct *prev,170192 struct task_struct *new)···221197 if (new->thread.regs && last_task_used_altivec == new)222198 new->thread.regs->msr |= MSR_VEC;223199#endif /* CONFIG_ALTIVEC */200200+201201+ if (unlikely(__get_cpu_var(current_dabr) != new->thread.dabr)) {202202+ set_dabr(new->thread.dabr);203203+ __get_cpu_var(current_dabr) = new->thread.dabr;204204+ }224205225206 flush_tlb_pending();226207···363334 last_task_used_altivec = NULL;364335#endif /* CONFIG_ALTIVEC */365336#endif /* CONFIG_SMP */337337+338338+ if (current->thread.dabr) {339339+ current->thread.dabr = 0;340340+ set_dabr(0);341341+ }366342}367343368344void
+28
arch/ppc64/kernel/ptrace.c
···1717 * this archive for more details.1818 */19192020+#include <linux/config.h>2021#include <linux/kernel.h>2122#include <linux/sched.h>2223#include <linux/mm.h>···207206 break;208207 }209208209209+ case PTRACE_GET_DEBUGREG: {210210+ ret = -EINVAL;211211+ /* We only support one DABR and no IABRS at the moment */212212+ if (addr > 0)213213+ break;214214+ ret = put_user(child->thread.dabr,215215+ (unsigned long __user *)data);216216+ break;217217+ }218218+219219+ case PTRACE_SET_DEBUGREG:220220+ ret = ptrace_set_debugreg(child, addr, data);221221+210222 case PTRACE_DETACH:211223 ret = ptrace_detach(child, data);212224 break;···287273 }288274 break;289275 }276276+277277+#ifdef CONFIG_ALTIVEC278278+ case PTRACE_GETVRREGS:279279+ /* Get the child altivec register state. */280280+ flush_altivec_to_thread(child);281281+ ret = get_vrregs((unsigned long __user *)data, child);282282+ break;283283+284284+ case PTRACE_SETVRREGS:285285+ /* Set the child altivec register state. */286286+ flush_altivec_to_thread(child);287287+ ret = set_vrregs(child, (unsigned long __user *)data);288288+ break;289289+#endif290290291291 default:292292 ret = ptrace_request(child, request, addr, data);
+31-3
arch/ppc64/kernel/ptrace32.c
···1717 * this archive for more details.1818 */19192020+#include <linux/config.h>2021#include <linux/kernel.h>2122#include <linux/sched.h>2223#include <linux/mm.h>···338337 break;339338 }340339340340+ case PTRACE_GET_DEBUGREG: {341341+ ret = -EINVAL;342342+ /* We only support one DABR and no IABRS at the moment */343343+ if (addr > 0)344344+ break;345345+ ret = put_user(child->thread.dabr, (u32 __user *)data);346346+ break;347347+ }348348+349349+ case PTRACE_SET_DEBUGREG:350350+ ret = ptrace_set_debugreg(child, addr, data);351351+ break;352352+341353 case PTRACE_DETACH:342354 ret = ptrace_detach(child, data);343355 break;···419405 break;420406 }421407422422- case PTRACE_GETEVENTMSG:423423- ret = put_user(child->ptrace_message, (unsigned int __user *) data);424424- break;408408+ case PTRACE_GETEVENTMSG:409409+ ret = put_user(child->ptrace_message, (unsigned int __user *) data);410410+ break;411411+412412+#ifdef CONFIG_ALTIVEC413413+ case PTRACE_GETVRREGS:414414+ /* Get the child altivec register state. */415415+ flush_altivec_to_thread(child);416416+ ret = get_vrregs((unsigned long __user *)data, child);417417+ break;418418+419419+ case PTRACE_SETVRREGS:420420+ /* Set the child altivec register state. */421421+ flush_altivec_to_thread(child);422422+ ret = set_vrregs(child, (unsigned long __user *)data);423423+ break;424424+#endif425425426426 default:427427 ret = ptrace_request(child, request, addr, data);
-2
arch/ppc64/kernel/ras.c
···5959/* This is true if we are using the firmware NMI handler (typically LPAR) */6060extern int fwnmi_active;61616262-extern void _exception(int signr, struct pt_regs *regs, int code, unsigned long addr);6363-6462static int ras_get_sensor_state_token;6563static int ras_check_exception_token;6664
-16
arch/ppc64/kernel/setup.c
···10641064#define PPC64_LINUX_FUNCTION 0x0f00000010651065#define PPC64_IPL_MESSAGE 0xc000000010661066#define PPC64_TERM_MESSAGE 0xb000000010671067-#define PPC64_ATTN_MESSAGE 0xa000000010681068-#define PPC64_DUMP_MESSAGE 0xd00000001069106710701068static void ppc64_do_msg(unsigned int src, const char *msg)10711069{···10891091{10901092 ppc64_do_msg(PPC64_LINUX_FUNCTION|PPC64_TERM_MESSAGE|src, msg);10911093 printk("[terminate]%04x %s\n", src, msg);10921092-}10931093-10941094-/* Print something that needs attention (device error, etc) */10951095-void ppc64_attention_msg(unsigned int src, const char *msg)10961096-{10971097- ppc64_do_msg(PPC64_LINUX_FUNCTION|PPC64_ATTN_MESSAGE|src, msg);10981098- printk("[attention]%04x %s\n", src, msg);10991099-}11001100-11011101-/* Print a dump progress message. */11021102-void ppc64_dump_msg(unsigned int src, const char *msg)11031103-{11041104- ppc64_do_msg(PPC64_LINUX_FUNCTION|PPC64_DUMP_MESSAGE|src, msg);11051105- printk("[dump]%04x %s\n", src, msg);11061094}1107109511081096/* This should only be called on processor 0 during calibrate decr */
+9
arch/ppc64/kernel/signal.c
···550550 /* Whee! Actually deliver the signal. */551551 if (TRAP(regs) == 0x0C00)552552 syscall_restart(regs, &ka);553553+554554+ /*555555+ * Reenable the DABR before delivering the signal to556556+ * user space. The DABR will have been cleared if it557557+ * triggered inside the kernel.558558+ */559559+ if (current->thread.dabr)560560+ set_dabr(current->thread.dabr);561561+553562 return handle_signal(signr, &ka, &info, oldset, regs);554563 }555564
+8
arch/ppc64/kernel/signal32.c
···970970 newsp = regs->gpr[1];971971 newsp &= ~0xfUL;972972973973+ /*974974+ * Reenable the DABR before delivering the signal to975975+ * user space. The DABR will have been cleared if it976976+ * triggered inside the kernel.977977+ */978978+ if (current->thread.dabr)979979+ set_dabr(current->thread.dabr);980980+973981 /* Whee! Actually deliver the signal. */974982 if (ka.sa.sa_flags & SA_SIGINFO)975983 ret = handle_rt_signal32(signr, &ka, &info, oldset, regs, newsp);
+22-22
arch/ppc64/kernel/xics.c
···3838static void xics_end_irq(unsigned int irq);3939static void xics_set_affinity(unsigned int irq_nr, cpumask_t cpumask);40404141-struct hw_interrupt_type xics_pic = {4141+static struct hw_interrupt_type xics_pic = {4242 .typename = " XICS ",4343 .startup = xics_startup,4444 .enable = xics_enable_irq,···4848 .set_affinity = xics_set_affinity4949};50505151-struct hw_interrupt_type xics_8259_pic = {5151+static struct hw_interrupt_type xics_8259_pic = {5252 .typename = " XICS/8259",5353 .ack = xics_mask_and_ack_irq,5454};···8989static int xics_irq_8259_cascade = 0;9090static int xics_irq_8259_cascade_real = 0;9191static unsigned int default_server = 0xFF;9292-/* also referenced in smp.c... */9393-unsigned int default_distrib_server = 0;9494-unsigned int interrupt_server_size = 8;9292+static unsigned int default_distrib_server = 0;9393+static unsigned int interrupt_server_size = 8;95949695/*9796 * XICS only has a single IPI, so encode the messages per CPU···9899struct xics_ipi_struct xics_ipi_message[NR_CPUS] __cacheline_aligned;99100100101/* RTAS service tokens */101101-int ibm_get_xive;102102-int ibm_set_xive;103103-int ibm_int_on;104104-int ibm_int_off;102102+static int ibm_get_xive;103103+static int ibm_set_xive;104104+static int ibm_int_on;105105+static int ibm_int_off;105106106107typedef struct {107108 int (*xirr_info_get)(int cpu);···283284 call_status = rtas_call(ibm_set_xive, 3, 1, NULL, irq, server,284285 DEFAULT_PRIORITY);285286 if (call_status != 0) {286286- printk(KERN_ERR "xics_enable_irq: irq=%d: ibm_set_xive "287287- "returned %x\n", irq, call_status);287287+ printk(KERN_ERR "xics_enable_irq: irq=%u: ibm_set_xive "288288+ "returned %d\n", irq, call_status);289289+ printk("set_xive %x, server %x\n", ibm_set_xive, server);288290 return;289291 }290292291293 /* Now unmask the interrupt (often a no-op) */292294 call_status = rtas_call(ibm_int_on, 1, 1, NULL, irq);293295 if (call_status != 0) {294294- printk(KERN_ERR "xics_enable_irq: irq=%d: ibm_int_on "295295- "returned %x\n", irq, call_status);296296+ printk(KERN_ERR "xics_enable_irq: irq=%u: ibm_int_on "297297+ "returned %d\n", irq, call_status);296298 return;297299 }298300}···308308309309 call_status = rtas_call(ibm_int_off, 1, 1, NULL, irq);310310 if (call_status != 0) {311311- printk(KERN_ERR "xics_disable_real_irq: irq=%d: "312312- "ibm_int_off returned %x\n", irq, call_status);311311+ printk(KERN_ERR "xics_disable_real_irq: irq=%u: "312312+ "ibm_int_off returned %d\n", irq, call_status);313313 return;314314 }315315···317317 /* Have to set XIVE to 0xff to be able to remove a slot */318318 call_status = rtas_call(ibm_set_xive, 3, 1, NULL, irq, server, 0xff);319319 if (call_status != 0) {320320- printk(KERN_ERR "xics_disable_irq: irq=%d: ibm_set_xive(0xff)"321321- " returned %x\n", irq, call_status);320320+ printk(KERN_ERR "xics_disable_irq: irq=%u: ibm_set_xive(0xff)"321321+ " returned %d\n", irq, call_status);322322 return;323323 }324324}···380380 if (irq == NO_IRQ)381381 irq = real_irq_to_virt_slowpath(vec);382382 if (irq == NO_IRQ) {383383- printk(KERN_ERR "Interrupt %d (real) is invalid,"383383+ printk(KERN_ERR "Interrupt %u (real) is invalid,"384384 " disabling it.\n", vec);385385 xics_disable_real_irq(vec);386386 } else···622622 status = rtas_call(ibm_get_xive, 1, 3, xics_status, irq);623623624624 if (status) {625625- printk(KERN_ERR "xics_set_affinity: irq=%d ibm,get-xive "625625+ printk(KERN_ERR "xics_set_affinity: irq=%u ibm,get-xive "626626 "returns %d\n", irq, status);627627 return;628628 }···641641 irq, newmask, xics_status[1]);642642643643 if (status) {644644- printk(KERN_ERR "xics_set_affinity: irq=%d ibm,set-xive "644644+ printk(KERN_ERR "xics_set_affinity: irq=%u ibm,set-xive "645645 "returns %d\n", irq, status);646646 return;647647 }···720720721721 status = rtas_call(ibm_get_xive, 1, 3, xics_status, irq);722722 if (status) {723723- printk(KERN_ERR "migrate_irqs_away: irq=%d "723723+ printk(KERN_ERR "migrate_irqs_away: irq=%u "724724 "ibm,get-xive returns %d\n",725725 virq, status);726726 goto unlock;···734734 if (xics_status[0] != get_hard_smp_processor_id(cpu))735735 goto unlock;736736737737- printk(KERN_WARNING "IRQ %d affinity broken off cpu %u\n",737737+ printk(KERN_WARNING "IRQ %u affinity broken off cpu %u\n",738738 virq, cpu);739739740740 /* Reset affinity to all cpus */
+25-6
arch/ppc64/mm/fault.c
···7777 return 0;7878}79798080+static void do_dabr(struct pt_regs *regs, unsigned long error_code)8181+{8282+ siginfo_t info;8383+8484+ if (notify_die(DIE_DABR_MATCH, "dabr_match", regs, error_code,8585+ 11, SIGSEGV) == NOTIFY_STOP)8686+ return;8787+8888+ if (debugger_dabr_match(regs))8989+ return;9090+9191+ /* Clear the DABR */9292+ set_dabr(0);9393+9494+ /* Deliver the signal to userspace */9595+ info.si_signo = SIGTRAP;9696+ info.si_errno = 0;9797+ info.si_code = TRAP_HWBKPT;9898+ info.si_addr = (void __user *)regs->nip;9999+ force_sig_info(SIGTRAP, &info, current);100100+}101101+80102/*81103 * The error_code parameter is82104 * - DSISR for a non-SLB data access fault,···133111 if (!user_mode(regs) && (address >= TASK_SIZE))134112 return SIGSEGV;135113136136- if (error_code & DSISR_DABRMATCH) {137137- if (notify_die(DIE_DABR_MATCH, "dabr_match", regs, error_code,138138- 11, SIGSEGV) == NOTIFY_STOP)139139- return 0;140140- if (debugger_dabr_match(regs))141141- return 0;114114+ if (error_code & DSISR_DABRMATCH) {115115+ do_dabr(regs, error_code);116116+ return 0;142117 }143118144119 if (in_atomic() || mm == NULL) {
···586586{587587 if ((regs->msr & (MSR_IR|MSR_PR|MSR_SF)) != (MSR_IR|MSR_SF))588588 return 0;589589+ if (dabr.enabled == 0)590590+ return 0;589591 xmon_core(regs, 0);590592 return 1;591593}···628626 }629627630628 return 0;631631-}632632-633633-/* On systems with a hypervisor, we can't set the DABR634634- (data address breakpoint register) directly. */635635-static void set_controlled_dabr(unsigned long val)636636-{637637-#ifdef CONFIG_PPC_PSERIES638638- if (systemcfg->platform == PLATFORM_PSERIES_LPAR) {639639- int rc = plpar_hcall_norets(H_SET_DABR, val);640640- if (rc != H_Success)641641- xmon_printf("Warning: setting DABR failed (%d)\n", rc);642642- } else643643-#endif644644- set_dabr(val);645629}646630647631static struct bpt *at_breakpoint(unsigned long pc)···716728static void insert_cpu_bpts(void)717729{718730 if (dabr.enabled)719719- set_controlled_dabr(dabr.address | (dabr.enabled & 7));731731+ set_dabr(dabr.address | (dabr.enabled & 7));720732 if (iabr && cpu_has_feature(CPU_FTR_IABR))721733 set_iabr(iabr->address722734 | (iabr->enabled & (BP_IABR|BP_IABR_TE)));···744756745757static void remove_cpu_bpts(void)746758{747747- set_controlled_dabr(0);759759+ set_dabr(0);748760 if (cpu_has_feature(CPU_FTR_IABR))749761 set_iabr(0);750762}
+5-1
drivers/w1/w1_ds2433.c
···1515#include <linux/delay.h>1616#ifdef CONFIG_W1_F23_CRC1717#include <linux/crc16.h>1818+1919+#define CRC16_INIT 02020+#define CRC16_VALID 0xb0012121+1822#endif19232024#include "w1.h"···218214#ifdef CONFIG_W1_F23_CRC219215 /* can only write full blocks in cached mode */220216 if ((off & W1_PAGE_MASK) || (count & W1_PAGE_MASK)) {221221- dev_err(&sl->dev, "invalid offset/count off=%d cnt=%d\n",217217+ dev_err(&sl->dev, "invalid offset/count off=%d cnt=%zd\n",222218 (int)off, count);223219 return -EINVAL;224220 }
+8
include/asm-powerpc/siginfo.h
···15151616#include <asm-generic/siginfo.h>17171818+/*1919+ * SIGTRAP si_codes2020+ */2121+#define TRAP_BRANCH (__SI_FAULT|3) /* process taken branch trap */2222+#define TRAP_HWBKPT (__SI_FAULT|4) /* hardware breakpoint or watchpoint */2323+#undef NSIGTRAP2424+#define NSIGTRAP 42525+1826#endif /* _ASM_POWERPC_SIGINFO_H */
+7
include/asm-ppc/ptrace.h
···142142#define PTRACE_GETEVRREGS 20143143#define PTRACE_SETEVRREGS 21144144145145+/*146146+ * Get or set a debug register. The first 16 are DABR registers and the147147+ * second 16 are IABR registers.148148+ */149149+#define PTRACE_GET_DEBUGREG 25150150+#define PTRACE_SET_DEBUGREG 26151151+145152#endif
···88888989 /* PCI stuff */9090 void (*pcibios_fixup)(void);9191+ int (*pci_probe_mode)(struct pci_bus *);91929293 void (*restart)(char *cmd);9394 void (*power_off)(void);···174173void ppc64_boot_msg(unsigned int src, const char *msg);175174/* Print a termination message (print only -- does not stop the kernel) */176175void ppc64_terminate_msg(unsigned int src, const char *msg);177177-/* Print something that needs attention (device error, etc) */178178-void ppc64_attention_msg(unsigned int src, const char *msg);179179-/* Print a dump progress message. */180180-void ppc64_dump_msg(unsigned int src, const char *msg);181176182177static inline void log_error(char *buf, unsigned int err_type, int fatal)183178{
+5
include/asm-ppc64/pci-bridge.h
···119119 return PCI_DN(busdn)->phb;120120}121121122122+/* Return values for ppc_md.pci_probe_mode function */123123+#define PCI_PROBE_NONE -1 /* Don't look at this bus at all */124124+#define PCI_PROBE_NORMAL 0 /* Do normal PCI probing */125125+#define PCI_PROBE_DEVTREE 1 /* Instantiate from device tree */126126+122127#endif123128#endif /* __KERNEL__ */
+9
include/asm-ppc64/plpar_wrappers.h
···107107 lbuf[1]);108108}109109110110+static inline long plpar_set_xdabr(unsigned long address, unsigned long flags)111111+{112112+ return plpar_hcall_norets(H_SET_XDABR, address, flags);113113+}114114+115115+static inline long plpar_set_dabr(unsigned long val)116116+{117117+ return plpar_hcall_norets(H_SET_DABR, val);118118+}110119111120#endif /* _PPC64_PLPAR_WRAPPERS_H */
+1
include/asm-ppc64/processor.h
···433433 unsigned long start_tb; /* Start purr when proc switched in */434434 unsigned long accum_tb; /* Total accumilated purr for process */435435 unsigned long vdso_base; /* base of the vDSO library */436436+ unsigned long dabr; /* Data address breakpoint register */436437#ifdef CONFIG_ALTIVEC437438 /* Complete AltiVec register set */438439 vector128 vr[32] __attribute((aligned(16)));
+92
include/asm-ppc64/ptrace-common.h
···11111212#ifndef _PPC64_PTRACE_COMMON_H1313#define _PPC64_PTRACE_COMMON_H1414+1515+#include <linux/config.h>1616+#include <asm/system.h>1717+1418/*1519 * Set of msr bits that gdb can change on behalf of a process.1620 */···7167 if (regs != NULL)7268 regs->msr &= ~MSR_SE;7369 clear_ti_thread_flag(task->thread_info, TIF_SINGLESTEP);7070+}7171+7272+#ifdef CONFIG_ALTIVEC7373+/*7474+ * Get/set all the altivec registers vr0..vr31, vscr, vrsave, in one go.7575+ * The transfer totals 34 quadword. Quadwords 0-31 contain the7676+ * corresponding vector registers. Quadword 32 contains the vscr as the7777+ * last word (offset 12) within that quadword. Quadword 33 contains the7878+ * vrsave as the first word (offset 0) within the quadword.7979+ *8080+ * This definition of the VMX state is compatible with the current PPC328181+ * ptrace interface. This allows signal handling and ptrace to use the8282+ * same structures. This also simplifies the implementation of a bi-arch8383+ * (combined (32- and 64-bit) gdb.8484+ */8585+8686+/*8787+ * Get contents of AltiVec register state in task TASK8888+ */8989+static inline int get_vrregs(unsigned long __user *data,9090+ struct task_struct *task)9191+{9292+ unsigned long regsize;9393+9494+ /* copy AltiVec registers VR[0] .. VR[31] */9595+ regsize = 32 * sizeof(vector128);9696+ if (copy_to_user(data, task->thread.vr, regsize))9797+ return -EFAULT;9898+ data += (regsize / sizeof(unsigned long));9999+100100+ /* copy VSCR */101101+ regsize = 1 * sizeof(vector128);102102+ if (copy_to_user(data, &task->thread.vscr, regsize))103103+ return -EFAULT;104104+ data += (regsize / sizeof(unsigned long));105105+106106+ /* copy VRSAVE */107107+ if (put_user(task->thread.vrsave, (u32 __user *)data))108108+ return -EFAULT;109109+110110+ return 0;111111+}112112+113113+/*114114+ * Write contents of AltiVec register state into task TASK.115115+ */116116+static inline int set_vrregs(struct task_struct *task,117117+ unsigned long __user *data)118118+{119119+ unsigned long regsize;120120+121121+ /* copy AltiVec registers VR[0] .. VR[31] */122122+ regsize = 32 * sizeof(vector128);123123+ if (copy_from_user(task->thread.vr, data, regsize))124124+ return -EFAULT;125125+ data += (regsize / sizeof(unsigned long));126126+127127+ /* copy VSCR */128128+ regsize = 1 * sizeof(vector128);129129+ if (copy_from_user(&task->thread.vscr, data, regsize))130130+ return -EFAULT;131131+ data += (regsize / sizeof(unsigned long));132132+133133+ /* copy VRSAVE */134134+ if (get_user(task->thread.vrsave, (u32 __user *)data))135135+ return -EFAULT;136136+137137+ return 0;138138+}139139+#endif140140+141141+static inline int ptrace_set_debugreg(struct task_struct *task,142142+ unsigned long addr, unsigned long data)143143+{144144+ /* We only support one DABR and no IABRS at the moment */145145+ if (addr > 0)146146+ return -EINVAL;147147+148148+ /* The bottom 3 bits are flags */149149+ if ((data & ~0x7UL) >= TASK_SIZE)150150+ return -EIO;151151+152152+ /* Ensure translation is on */153153+ if (data && !(data & DABR_TRANSLATION))154154+ return -EIO;155155+156156+ task->thread.dabr = data;157157+ return 0;74158}7515976160#endif /* _PPC64_PTRACE_COMMON_H */
+76-52
include/asm-ppc64/ptrace.h
···2525 */26262727#ifndef __ASSEMBLY__2828-#define PPC_REG unsigned long2828+2929struct pt_regs {3030- PPC_REG gpr[32];3131- PPC_REG nip;3232- PPC_REG msr;3333- PPC_REG orig_gpr3; /* Used for restarting system calls */3434- PPC_REG ctr;3535- PPC_REG link;3636- PPC_REG xer;3737- PPC_REG ccr;3838- PPC_REG softe; /* Soft enabled/disabled */3939- PPC_REG trap; /* Reason for being here */4040- PPC_REG dar; /* Fault registers */4141- PPC_REG dsisr;4242- PPC_REG result; /* Result of a system call */3030+ unsigned long gpr[32];3131+ unsigned long nip;3232+ unsigned long msr;3333+ unsigned long orig_gpr3; /* Used for restarting system calls */3434+ unsigned long ctr;3535+ unsigned long link;3636+ unsigned long xer;3737+ unsigned long ccr;3838+ unsigned long softe; /* Soft enabled/disabled */3939+ unsigned long trap; /* Reason for being here */4040+ unsigned long dar; /* Fault registers */4141+ unsigned long dsisr;4242+ unsigned long result; /* Result of a system call */4343};44444545-#define PPC_REG_32 unsigned int4645struct pt_regs32 {4747- PPC_REG_32 gpr[32];4848- PPC_REG_32 nip;4949- PPC_REG_32 msr;5050- PPC_REG_32 orig_gpr3; /* Used for restarting system calls */5151- PPC_REG_32 ctr;5252- PPC_REG_32 link;5353- PPC_REG_32 xer;5454- PPC_REG_32 ccr;5555- PPC_REG_32 mq; /* 601 only (not used at present) */5656- /* Used on APUS to hold IPL value. */5757- PPC_REG_32 trap; /* Reason for being here */5858- PPC_REG_32 dar; /* Fault registers */5959- PPC_REG_32 dsisr;6060- PPC_REG_32 result; /* Result of a system call */4646+ unsigned int gpr[32];4747+ unsigned int nip;4848+ unsigned int msr;4949+ unsigned int orig_gpr3; /* Used for restarting system calls */5050+ unsigned int ctr;5151+ unsigned int link;5252+ unsigned int xer;5353+ unsigned int ccr;5454+ unsigned int mq; /* 601 only (not used at present) */5555+ unsigned int trap; /* Reason for being here */5656+ unsigned int dar; /* Fault registers */5757+ unsigned int dsisr;5858+ unsigned int result; /* Result of a system call */6159};6060+6161+#ifdef __KERNEL__62626363#define instruction_pointer(regs) ((regs)->nip)6464+6465#ifdef CONFIG_SMP6566extern unsigned long profile_pc(struct pt_regs *regs);6667#else6768#define profile_pc(regs) instruction_pointer(regs)6869#endif6969-7070-#endif /* __ASSEMBLY__ */7171-7272-#define STACK_FRAME_OVERHEAD 112 /* size of minimum stack frame */7373-7474-/* Size of dummy stack frame allocated when calling signal handler. */7575-#define __SIGNAL_FRAMESIZE 1287676-#define __SIGNAL_FRAMESIZE32 6477707871#define user_mode(regs) ((((regs)->msr) >> MSR_PR_LG) & 0x1)7972···8188#define FULL_REGS(regs) (((regs)->trap & 1) == 0)8289#define TRAP(regs) ((regs)->trap & ~0xF)8390#define CHECK_FULL_REGS(regs) BUG_ON(regs->trap & 1)9191+9292+#endif /* __KERNEL__ */9393+9494+#endif /* __ASSEMBLY__ */9595+9696+#define STACK_FRAME_OVERHEAD 112 /* size of minimum stack frame */9797+9898+/* Size of dummy stack frame allocated when calling signal handler. */9999+#define __SIGNAL_FRAMESIZE 128100100+#define __SIGNAL_FRAMESIZE32 648410185102/*86103 * Offsets used by 'ptrace' system call interface.···138135#define PT_XER 37139136#define PT_CCR 38140137#define PT_SOFTE 39138138+#define PT_TRAP 40139139+#define PT_DAR 41140140+#define PT_DSISR 42141141#define PT_RESULT 43142142143143#define PT_FPR0 48144144145145-/* Kernel and userspace will both use this PT_FPSCR value. 32-bit apps will have146146- * visibility to the asm-ppc/ptrace.h header instead of this one.145145+/*146146+ * Kernel and userspace will both use this PT_FPSCR value. 32-bit apps will147147+ * have visibility to the asm-ppc/ptrace.h header instead of this one.147148 */148148-#define PT_FPSCR (PT_FPR0 + 32) /* each FP reg occupies 1 slot in 64-bit space */149149+#define PT_FPSCR (PT_FPR0 + 32) /* each FP reg occupies 1 slot in 64-bit space */149150150151#ifdef __KERNEL__151151-#define PT_FPSCR32 (PT_FPR0 + 2*32 + 1) /* each FP reg occupies 2 32-bit userspace slots */152152+#define PT_FPSCR32 (PT_FPR0 + 2*32 + 1) /* each FP reg occupies 2 32-bit userspace slots */152153#endif153154154155#define PT_VR0 82 /* each Vector reg occupies 2 slots in 64-bit */···180173#define PTRACE_GETVRREGS 18181174#define PTRACE_SETVRREGS 19182175183183-/* Additional PTRACE requests implemented on PowerPC. */184184-#define PPC_PTRACE_GETREGS 0x99 /* Get GPRs 0 - 31 */185185-#define PPC_PTRACE_SETREGS 0x98 /* Set GPRs 0 - 31 */186186-#define PPC_PTRACE_GETFPREGS 0x97 /* Get FPRs 0 - 31 */187187-#define PPC_PTRACE_SETFPREGS 0x96 /* Set FPRs 0 - 31 */188188-#define PPC_PTRACE_PEEKTEXT_3264 0x95 /* Read word at location ADDR on a 64-bit process from a 32-bit process. */189189-#define PPC_PTRACE_PEEKDATA_3264 0x94 /* Read word at location ADDR on a 64-bit process from a 32-bit process. */190190-#define PPC_PTRACE_POKETEXT_3264 0x93 /* Write word at location ADDR on a 64-bit process from a 32-bit process. */191191-#define PPC_PTRACE_POKEDATA_3264 0x92 /* Write word at location ADDR on a 64-bit process from a 32-bit process. */192192-#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. */193193-#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. */176176+/*177177+ * While we dont have 64bit book E processors, we need to reserve the178178+ * relevant ptrace calls for 32bit compatibility.179179+ */180180+#if 0181181+#define PTRACE_GETEVRREGS 20182182+#define PTRACE_SETEVRREGS 21183183+#endif194184185185+/*186186+ * Get or set a debug register. The first 16 are DABR registers and the187187+ * second 16 are IABR registers.188188+ */189189+#define PTRACE_GET_DEBUGREG 25190190+#define PTRACE_SET_DEBUGREG 26191191+192192+/* Additional PTRACE requests implemented on PowerPC. */193193+#define PPC_PTRACE_GETREGS 0x99 /* Get GPRs 0 - 31 */194194+#define PPC_PTRACE_SETREGS 0x98 /* Set GPRs 0 - 31 */195195+#define PPC_PTRACE_GETFPREGS 0x97 /* Get FPRs 0 - 31 */196196+#define PPC_PTRACE_SETFPREGS 0x96 /* Set FPRs 0 - 31 */197197+198198+/* Calls to trace a 64bit program from a 32bit program */199199+#define PPC_PTRACE_PEEKTEXT_3264 0x95200200+#define PPC_PTRACE_PEEKDATA_3264 0x94201201+#define PPC_PTRACE_POKETEXT_3264 0x93202202+#define PPC_PTRACE_POKEDATA_3264 0x92203203+#define PPC_PTRACE_PEEKUSR_3264 0x91204204+#define PPC_PTRACE_POKEUSR_3264 0x90195205196206#endif /* _PPC64_PTRACE_H */
+3
include/asm-ppc64/system.h
···101101static inline int debugger_fault_handler(struct pt_regs *regs) { return 0; }102102#endif103103104104+extern int set_dabr(unsigned long dabr);105105+extern void _exception(int signr, struct pt_regs *regs, int code,106106+ unsigned long addr);104107extern int fix_alignment(struct pt_regs *regs);105108extern void bad_page_fault(struct pt_regs *regs, unsigned long address,106109 int sig);
+1-15
include/linux/crc16.h
···11/*22 * crc16.h - CRC-16 routine33 *44- * Implements the standard CRC-16, as used with 1-wire devices:44+ * Implements the standard CRC-16:55 * Width 1666 * Poly 0x8005 (x^16 + x^15 + x^2 + 1)77 * Init 088- *99- * For 1-wire devices, the CRC is stored inverted, LSB-first1010- *1111- * Example buffer with the CRC attached:1212- * 31 32 33 34 35 36 37 38 39 C2 441313- *1414- * The CRC over a buffer with the CRC attached is 0xB001.1515- * So, if (crc16(0, buf, size) == 0xB001) then the buffer is valid.1616- *1717- * Refer to "Application Note 937: Book of iButton Standards" for details.1818- * http://www.maxim-ic.com/appnotes.cfm/appnote_number/937198 *209 * Copyright (c) 2005 Ben Gardner <bgardner@wabtec.com>2110 *···1627#define __CRC16_H17281829#include <linux/types.h>1919-2020-#define CRC16_INIT 02121-#define CRC16_VALID 0xb00122302331extern u16 const crc16_table[256];2432