From: Dave A. <ai...@us...> - 2003-06-10 02:08:38
|
Update of /cvsroot/linux-vax/kernel-2.4/arch/sparc64/kernel In directory sc8-pr-cvs1:/tmp/cvs-serv23180/arch/sparc64/kernel Modified Files: central.c check_asm.sh ioctl32.c iommu_common.c iommu_common.h pci_common.c pci_psycho.c power.c process.c rtrap.S smp.c sys_sparc.c time.c Log Message: DA: sync to Marcelo 2.4.18 + remove init_mmap (no longer needed) Index: central.c =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/arch/sparc64/kernel/central.c,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- central.c 10 Apr 2002 15:21:23 -0000 1.2 +++ central.c 10 Jun 2003 01:46:16 -0000 1.3 @@ -67,6 +67,7 @@ if (rngc == nranges) /* oops */ prom_printf("adjust_regs: Could not find range with matching bus type...\n"); regp[regc].which_io = rangep[rngc].ot_parent_space; + regp[regc].phys_addr -= rangep[rngc].ot_child_base; regp[regc].phys_addr += rangep[rngc].ot_parent_base; } } Index: check_asm.sh =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/arch/sparc64/kernel/check_asm.sh,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- check_asm.sh 10 Apr 2002 15:21:23 -0000 1.2 +++ check_asm.sh 10 Jun 2003 01:46:16 -0000 1.3 @@ -1,12 +1,12 @@ #!/bin/sh case $1 in -printf) - sed -n -e '/struct[ ]*'$2'_struct[ ]*{/,/};/p' < $3 | sed '/struct[ ]*'$2'_struct[ ]*{/d;/:[0-9]*[ ]*;/d;/^[ ]*$/d;/};/d;s/^[ ]*//;s/volatile[ ]*//;s/\(unsigned\|signed\|struct\)[ ]*//;s/\(\[\|__attribute__\).*;[ ]*$//;s/(\*//;s/)(.*)//;s/;[ ]*$//;s/^[^ ]*[ ]*//;s/,/\ + sed -n -e '/^#/d;/struct[ ]*'$2'_struct[ ]*{/,/};/p' < $3 | sed '/struct[ ]*'$2'_struct[ ]*{/d;/:[0-9]*[ ]*;/d;/^[ ]*$/d;/};/d;s/^[ ]*//;s/volatile[ ]*//;s/\(unsigned\|signed\|struct\)[ ]*//;s/\(\[\|__attribute__\).*;[ ]*$//;s/(\*//;s/)(.*)//;s/;[ ]*$//;s/^[^ ]*[ ]*//;s/,/\ /g' | sed 's/^[ *]*//;s/[ ]*$//;s/^.*$/printf ("#define AOFF_'$2'_\0 0x%08x\\n", check_asm_data[i++]); printf("#define ASIZ_'$2'_\0 0x%08x\\n", check_asm_data[i++]);/' >> $4 echo "printf (\"#define ASIZ_$2\\t0x%08x\\n\", check_asm_data[i++]);" >> $4 ;; -data) - sed -n -e '/struct[ ]*'$2'_struct[ ]*{/,/};/p' < $3 | sed '/struct[ ]*'$2'_struct[ ]*{/d;/:[0-9]*[ ]*;/d;/^[ ]*$/d;/};/d;s/^[ ]*//;s/volatile[ ]*//;s/\(unsigned\|signed\|struct\)[ ]*//;s/\(\[\|__attribute__\).*;[ ]*$//;s/(\*//;s/)(.*)//;s/;[ ]*$//;s/^[^ ]*[ ]*//;s/,/\ + sed -n -e '/^#/d;/struct[ ]*'$2'_struct[ ]*{/,/};/p' < $3 | sed '/struct[ ]*'$2'_struct[ ]*{/d;/:[0-9]*[ ]*;/d;/^[ ]*$/d;/};/d;s/^[ ]*//;s/volatile[ ]*//;s/\(unsigned\|signed\|struct\)[ ]*//;s/\(\[\|__attribute__\).*;[ ]*$//;s/(\*//;s/)(.*)//;s/;[ ]*$//;s/^[^ ]*[ ]*//;s/,/\ /g' | sed 's/^[ *]*//;s/[ ]*$//;s/^.*$/ ((char *)\&((struct '$2'_struct *)0)->\0) - ((char *)((struct '$2'_struct *)0)), sizeof(((struct '$2'_struct *)0)->\0),/' >> $4 echo " sizeof(struct $2_struct)," >> $4 ;; Index: ioctl32.c =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/arch/sparc64/kernel/ioctl32.c,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- ioctl32.c 10 Jun 2003 01:13:18 -0000 1.3 +++ ioctl32.c 10 Jun 2003 01:46:16 -0000 1.4 @@ -472,6 +472,7 @@ return -ENODEV; strcpy(ifr32.ifr_name, dev->name); + dev_put(dev); err = copy_to_user((struct ifreq32 *)arg, &ifr32, sizeof(struct ifreq32)); return (err ? -EFAULT : 0); @@ -1580,12 +1581,17 @@ } err |= __get_user(sbp32, &sg_io32->sbp); - sg_io64.sbp = kmalloc(64, GFP_KERNEL); + sg_io64.sbp = kmalloc(sg_io64.mx_sb_len, GFP_KERNEL); if (!sg_io64.sbp) { err = -ENOMEM; goto out; } - memset(sg_io64.sbp, 0, 64); + if (copy_from_user(sg_io64.sbp, + (void *) A(sbp32), + sg_io64.mx_sb_len)) { + err = -EFAULT; + goto out; + } err |= __get_user(dxferp32, &sg_io32->dxferp); if (sg_io64.iovec_count) { @@ -1633,7 +1639,7 @@ err |= __put_user(sg_io64.resid, &sg_io32->resid); err |= __put_user(sg_io64.duration, &sg_io32->duration); err |= __put_user(sg_io64.info, &sg_io32->info); - err |= copy_to_user((void *)A(sbp32), sg_io64.sbp, 64); + err |= copy_to_user((void *)A(sbp32), sg_io64.sbp, sg_io64.mx_sb_len); if (sg_io64.dxferp) { if (sg_io64.iovec_count) err |= copy_back_sg_iovec(&sg_io64, dxferp32); Index: iommu_common.c =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/arch/sparc64/kernel/iommu_common.c,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- iommu_common.c 10 Apr 2002 15:21:23 -0000 1.2 +++ iommu_common.c 10 Jun 2003 01:46:17 -0000 1.3 @@ -66,7 +66,9 @@ daddr = dma_sg->dma_address; sglen = sg->length; - sgaddr = (unsigned long) sg->address; + sgaddr = (unsigned long) (sg->address ? + sg->address : + page_address(sg->page) + sg->offset); while (dlen > 0) { unsigned long paddr; @@ -116,7 +118,9 @@ sg++; if (--nents <= 0) break; - sgaddr = (unsigned long) sg->address; + sgaddr = (unsigned long) (sg->address ? + sg->address : + page_address(sg->page) + sg->offset); sglen = sg->length; } if (dlen < 0) { @@ -197,14 +201,21 @@ unsigned long prev; u32 dent_addr, dent_len; - prev = (unsigned long) sg->address; + prev = (unsigned long) (sg->address ? + sg->address : + page_address(sg->page) + sg->offset); prev += (unsigned long) (dent_len = sg->length); - dent_addr = (u32) ((unsigned long)sg->address & (IO_PAGE_SIZE - 1UL)); + dent_addr = (u32) ((unsigned long)(sg->address ? + sg->address : + page_address(sg->page) + sg->offset) + & (IO_PAGE_SIZE - 1UL)); while (--nents) { unsigned long addr; sg++; - addr = (unsigned long) sg->address; + addr = (unsigned long) (sg->address ? + sg->address : + page_address(sg->page) + sg->offset); if (! VCONTIG(prev, addr)) { dma_sg->dma_address = dent_addr; dma_sg->dma_length = dent_len; Index: iommu_common.h =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/arch/sparc64/kernel/iommu_common.h,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- iommu_common.h 10 Apr 2002 15:21:23 -0000 1.2 +++ iommu_common.h 10 Jun 2003 01:46:17 -0000 1.3 @@ -6,8 +6,9 @@ #include <linux/kernel.h> #include <linux/types.h> +#include <linux/sched.h> +#include <linux/mm.h> -#include <asm/page.h> #include <asm/iommu.h> #include <asm/scatterlist.h> Index: pci_common.c =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/arch/sparc64/kernel/pci_common.c,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- pci_common.c 10 Apr 2002 15:21:23 -0000 1.2 +++ pci_common.c 10 Jun 2003 01:46:17 -0000 1.3 @@ -183,6 +183,17 @@ pcp->prom_name[err] = 0; else pcp->prom_name[0] = 0; + + err = prom_getproperty(device_prom_node, + "assigned-addresses", + (char *)pcp->prom_assignments, + sizeof(pcp->prom_assignments)); + if (err == 0 || err == -1) + pcp->num_prom_assignments = 0; + else + pcp->num_prom_assignments = + (err / sizeof(pcp->prom_assignments[0])); + if (strcmp(pcp->prom_name, "ebus") == 0) { struct linux_prom_ebus_ranges erng[PROM_PCIRNG_MAX]; int iter; @@ -208,16 +219,6 @@ ap->size_lo = ep->size; } pcp->num_prom_assignments = err; - } else { - err = prom_getproperty(device_prom_node, - "assigned-addresses", - (char *)pcp->prom_assignments, - sizeof(pcp->prom_assignments)); - if (err == 0 || err == -1) - pcp->num_prom_assignments = 0; - else - pcp->num_prom_assignments = - (err / sizeof(pcp->prom_assignments[0])); } fixup_obp_assignments(pdev, pcp); @@ -668,6 +669,20 @@ unsigned int prom_irq; int prom_node = pcp->prom_node; int err; + + /* If this is an empty EBUS device, sometimes OBP fails to + * give it a valid fully specified interrupts property. + * The EBUS hooked up to SunHME on PCI I/O boards of + * Ex000 systems is one such case. + * + * The interrupt is not important so just ignore it. + */ + if (pdev->vendor == PCI_VENDOR_ID_SUN && + pdev->device == PCI_DEVICE_ID_SUN_EBUS && + !prom_getchild(prom_node)) { + pdev->irq = 0; + return; + } err = prom_getproperty(prom_node, "interrupts", (char *)&prom_irq, sizeof(prom_irq)); Index: pci_psycho.c =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/arch/sparc64/kernel/pci_psycho.c,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- pci_psycho.c 10 Jun 2003 01:13:18 -0000 1.3 +++ pci_psycho.c 10 Jun 2003 01:46:17 -0000 1.4 @@ -1480,8 +1480,7 @@ { unsigned int busrange[2]; struct pci_pbm_info *pbm; - char namebuf[64]; - int err, len; + int err; if (is_pbm_a) { pbm = &p->pbm_A; @@ -1490,13 +1489,7 @@ pbm->mem_space.start = p->controller_regs + PSYCHO_MEMSPACE_A; } else { pbm = &p->pbm_B; - pbm->pci_first_slot = 1; - len = prom_getproperty(prom_root_node, "name", - namebuf, sizeof(namebuf)); - if (len > 0) { - if (!strcmp(namebuf, "SUNW,Ultra-1-Engine")) - pbm->pci_first_slot = 2; - } + pbm->pci_first_slot = 2; pbm->io_space.start = p->controller_regs + PSYCHO_IOSPACE_B; pbm->mem_space.start = p->controller_regs + PSYCHO_MEMSPACE_B; } Index: power.c =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/arch/sparc64/kernel/power.c,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- power.c 10 Apr 2002 15:21:23 -0000 1.2 +++ power.c 10 Jun 2003 01:46:17 -0000 1.3 @@ -61,7 +61,7 @@ sprintf(current->comm, "powerd"); again: - while(button_pressed == 0) { + while (button_pressed == 0) { spin_lock_irq(¤t->sigmask_lock); flush_signals(current); spin_unlock_irq(¤t->sigmask_lock); @@ -98,16 +98,19 @@ found: power_reg = (unsigned long)ioremap(edev->resource[0].start, 0x4); printk("power: Control reg at %016lx ... ", power_reg); - if (kernel_thread(powerd, 0, CLONE_FS) < 0) { - printk("Failed to start power daemon.\n"); - return; - } - printk("powerd running.\n"); - if (edev->irqs[0] != 0) { + if (edev->irqs[0] != PCI_IRQ_NONE) { + if (kernel_thread(powerd, 0, CLONE_FS) < 0) { + printk("Failed to start power daemon.\n"); + return; + } + printk("powerd running.\n"); + if (request_irq(edev->irqs[0], power_handler, SA_SHIRQ, "power", (void *) power_reg) < 0) printk("power: Error, cannot register IRQ handler.\n"); + } else { + printk("not using powerd.\n"); } } #endif /* CONFIG_PCI */ Index: process.c =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/arch/sparc64/kernel/process.c,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- process.c 10 Jun 2003 01:13:18 -0000 1.3 +++ process.c 10 Jun 2003 01:46:17 -0000 1.4 @@ -471,6 +471,7 @@ csp += STACK_BIAS; psp += STACK_BIAS; __get_user(fp, &(((struct reg_window *)psp)->ins[6])); + fp += STACK_BIAS; } else __get_user(fp, &(((struct reg_window32 *)psp)->ins[6])); Index: rtrap.S =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/arch/sparc64/kernel/rtrap.S,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- rtrap.S 10 Jun 2003 01:13:18 -0000 1.3 +++ rtrap.S 10 Jun 2003 01:46:17 -0000 1.4 @@ -40,8 +40,7 @@ __handle_user_windows: call fault_in_user_windows wrpr %g0, RTRAP_PSTATE, %pstate - ba,pt %xcc, __handle_user_windows_continue - wrpr %g0, RTRAP_PSTATE_IRQOFF, %pstate + wrpr %g0, RTRAP_PSTATE_IRQOFF, %pstate /* Redo sched+sig checks */ ldx [%g6 + AOFF_task_need_resched], %l0 brz,pt %l0, 1f Index: smp.c =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/arch/sparc64/kernel/smp.c,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- smp.c 10 Jun 2003 01:13:18 -0000 1.3 +++ smp.c 10 Jun 2003 01:46:17 -0000 1.4 @@ -218,7 +218,7 @@ atomic_inc(&init_mm.mm_count); current->active_mm = &init_mm; - while (!smp_processors_ready) + while (!smp_threads_ready) membar("#LoadLoad"); } @@ -269,7 +269,7 @@ continue; if ((cpucount + 1) == max_cpus) - break; + goto ignorecpu; if (cpu_present_map & (1UL << i)) { unsigned long entry = (unsigned long)(&sparc64_cpu_startup); unsigned long cookie = (unsigned long)(&cpu_new_task); @@ -314,13 +314,15 @@ } } if (!callin_flag) { +ignorecpu: cpu_present_map &= ~(1UL << i); __cpu_number_map[i] = -1; } } cpu_new_task = NULL; if (cpucount == 0) { - printk("Error: only one processor found.\n"); + if (max_cpus != 1) + printk("Error: only one processor found.\n"); cpu_present_map = (1UL << smp_processor_id()); } else { unsigned long bogosum = 0; @@ -676,6 +678,39 @@ atomic_inc(&dcpage_flushes_xcall); #endif } + } +} + +void flush_dcache_page_all(struct mm_struct *mm, struct page *page) +{ + if (smp_processors_ready) { + unsigned long mask = cpu_present_map & ~(1UL << smp_processor_id()); + u64 data0; + +#ifdef CONFIG_DEBUG_DCFLUSH + atomic_inc(&dcpage_flushes); +#endif + if (mask == 0UL) + goto flush_self; + if (tlb_type == spitfire) { + data0 = ((u64)&xcall_flush_dcache_page_spitfire); + if (page->mapping != NULL) + data0 |= ((u64)1 << 32); + spitfire_xcall_deliver(data0, + __pa(page->virtual), + (u64) page->virtual, + mask); + } else { + data0 = ((u64)&xcall_flush_dcache_page_cheetah); + cheetah_xcall_deliver(data0, + __pa(page->virtual), + 0, mask); + } +#ifdef CONFIG_DEBUG_DCFLUSH + atomic_inc(&dcpage_flushes_xcall); +#endif + flush_self: + __local_flush_dcache_page(page); } } Index: sys_sparc.c =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/arch/sparc64/kernel/sys_sparc.c,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- sys_sparc.c 10 Jun 2003 01:13:19 -0000 1.3 +++ sys_sparc.c 10 Jun 2003 01:46:17 -0000 1.4 @@ -40,12 +40,15 @@ return PAGE_SIZE; } -#define COLOUR_ALIGN(addr) (((addr)+SHMLBA-1)&~(SHMLBA-1)) +#define COLOUR_ALIGN(addr,pgoff) \ + ((((addr)+SHMLBA-1)&~(SHMLBA-1)) + \ + (((pgoff)<<PAGE_SHIFT) & (SHMLBA-1))) unsigned long arch_get_unmapped_area(struct file *filp, unsigned long addr, unsigned long len, unsigned long pgoff, unsigned long flags) { struct vm_area_struct * vmm; unsigned long task_size = TASK_SIZE; + int do_color_align; if (flags & MAP_FIXED) { /* We do not accept a shared mapping if it would violate @@ -63,11 +66,14 @@ if (!addr) addr = TASK_UNMAPPED_BASE; - if (flags & MAP_SHARED) - addr = COLOUR_ALIGN(addr); + do_color_align = 0; + if (filp || (flags & MAP_SHARED)) + do_color_align = 1; + + if (do_color_align) + addr = COLOUR_ALIGN(addr, pgoff); else addr = PAGE_ALIGN(addr); - task_size -= len; for (vmm = find_vma(current->mm, addr); ; vmm = vmm->vm_next) { @@ -81,8 +87,8 @@ if (!vmm || addr + len <= vmm->vm_start) return addr; addr = vmm->vm_end; - if (flags & MAP_SHARED) - addr = COLOUR_ALIGN(addr); + if (do_color_align) + addr = COLOUR_ALIGN(addr, pgoff); } } Index: time.c =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/arch/sparc64/kernel/time.c,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- time.c 10 Jun 2003 01:13:19 -0000 1.3 +++ time.c 10 Jun 2003 01:46:18 -0000 1.4 @@ -330,8 +330,6 @@ #endif u8 tmp; - do_get_fast_time = do_gettimeofday; - if (!mregs && !dregs) { prom_printf("Something wrong, clock regs not mapped yet.\n"); prom_halt(); |