You can subscribe to this list here.
2000 |
Jan
|
Feb
|
Mar
(9) |
Apr
(27) |
May
(5) |
Jun
(8) |
Jul
(50) |
Aug
(286) |
Sep
(2) |
Oct
(43) |
Nov
(4) |
Dec
(12) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2001 |
Jan
(79) |
Feb
(102) |
Mar
(29) |
Apr
(2) |
May
(22) |
Jun
(41) |
Jul
(11) |
Aug
(28) |
Sep
(58) |
Oct
(4) |
Nov
(18) |
Dec
(8) |
2002 |
Jan
(2) |
Feb
(2) |
Mar
(1) |
Apr
(478) |
May
(469) |
Jun
(78) |
Jul
(16) |
Aug
(2) |
Sep
(7) |
Oct
(47) |
Nov
(5) |
Dec
(227) |
2003 |
Jan
(155) |
Feb
(188) |
Mar
(160) |
Apr
(172) |
May
(41) |
Jun
(205) |
Jul
(104) |
Aug
(289) |
Sep
(31) |
Oct
|
Nov
|
Dec
|
2004 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(1) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: Andy P. <at...@us...> - 2001-07-31 17:33:29
|
Update of /cvsroot/linux-vax/kernel-2.4/include/asm-vax In directory usw-pr-cvs1:/tmp/cvs-serv1125 Modified Files: irq.h ka43.h processor.h ptrace.h sigcontext.h vsa.h Added Files: ucontext.h Log Message: New mm layer + start of signal handling + misc fixes --- NEW FILE --- #ifndef _ASM_VAX_UCONTEXT_H #define _ASM_VAX_UCONTEXT_H /* atp Jul 2001, taken from other ports */ struct ucontext { unsigned long uc_flags; struct ucontext *uc_link; stack_t uc_stack; struct sigcontext uc_mcontext; sigset_t uc_sigmask; /* mask last for extensibility */ }; #endif /* _ASM_VAX_UCONTEXT_H */ Index: irq.h =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/include/asm-vax/irq.h,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- irq.h 2001/02/16 00:54:26 1.2 +++ irq.h 2001/07/31 17:33:26 1.3 @@ -18,7 +18,8 @@ #define NO_IRQ 1023 #endif -#define INT_STACK_SIZE 8192 +/* atp Jul 01 increased this to three pages - my M38 needs it for some reason */ +#define INT_STACK_SIZE 12288 #ifndef __ASSEMBLY__ Index: ka43.h =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/include/asm-vax/ka43.h,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- ka43.h 2001/06/26 19:01:11 1.3 +++ ka43.h 2001/07/31 17:33:26 1.4 @@ -158,5 +158,7 @@ #endif /* __ASSEMBLY */ +extern void ka43_diagmem_remap(unsigned long int address, unsigned long int size); + #endif /* __VAX_KA43_H */ Index: processor.h =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/include/asm-vax/processor.h,v retrieving revision 1.8 retrieving revision 1.9 diff -u -r1.8 -r1.9 --- processor.h 2001/06/10 22:40:09 1.8 +++ processor.h 2001/07/31 17:33:26 1.9 @@ -5,7 +5,7 @@ #include <asm/pcb.h> /* process control block definition */ #include <asm/page.h> #include <asm/vaxcpu.h> /* CPU type definitions */ - +#include <asm/mm/task.h> /* task memory space defines */ /* * Default implementation of macro that returns current * instruction pointer ("program counter"). @@ -25,18 +25,6 @@ } vax_cpu; -/* - * * User space process size: 2GB (default). - * */ -#define TASK_SIZE (PAGE_OFFSET) - -/* This decides where the kernel will search for a free chunk of vm - * * space during mmap's. - * */ -/*#define TASK_UNMAPPED_BASE (TASK_SIZE / 3)*/ -/* Put the MMAP base at 32MB into the process memory space... - we currently allocate 48MB per process */ -#define TASK_UNMAPPED_BASE (32*1024*1024) /* from alpha port */ Index: ptrace.h =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/include/asm-vax/ptrace.h,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- ptrace.h 2001/01/23 16:51:27 1.2 +++ ptrace.h 2001/07/31 17:33:26 1.3 @@ -1,3 +1,4 @@ +/* ptrace.h linux vax porting team 1998-2001 */ #ifndef _VAX_PTRACE_H #define _VAX_PTRACE_H Index: sigcontext.h =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/include/asm-vax/sigcontext.h,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- sigcontext.h 2001/01/17 16:18:52 1.1 +++ sigcontext.h 2001/07/31 17:33:26 1.2 @@ -5,12 +5,27 @@ #include <asm/ptrace.h> -struct sigcontext_struct { - unsigned long _unused[4]; - int signal; - unsigned long handler; - unsigned long oldmask; - struct pt_regs *regs; +//struct sigcontext_struct { +// unsigned long _unused[4]; +// int signal; +// unsigned long handler; +// unsigned long oldmask; +// struct pt_regs *regs; +//}; + +/* This struct is saved by setup_frame in signal.c, to keep the current context while + a signal handler is executed. It's restored by sys_sigreturn. + + To keep things simple, we use pt_regs here even though normally you just specify + the list of regs to save. Then we can use copy_from_user on the entire regs instead + of a bunch of get_user's as well... + +*/ + +struct sigcontext { + struct pt_regs regs; /* needs to be first */ + unsigned long oldmask; + unsigned long usp; /* usp before stacking this gunk on it */ }; #endif Index: vsa.h =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/include/asm-vax/vsa.h,v retrieving revision 1.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- vsa.h 2001/06/17 11:43:45 1.4 +++ vsa.h 2001/07/31 17:33:26 1.5 @@ -30,6 +30,9 @@ extern int vsbus_disable_int(int bit_nr); extern int vsbus_clear_int(int bit_nr); extern int vsbus_probe_irq(void); +extern int vsbus_probe_irq_on(void); +extern unsigned char vsbus_probe_irq_report(void); + #define VSA_BASE_REGS 0x20080000 |
From: Andy P. <at...@us...> - 2001-07-31 17:28:29
|
Update of /cvsroot/linux-vax/kernel-2.4/arch/vax In directory usw-pr-cvs1:/tmp/cvs-serv32129 Modified Files: Makefile defconfig Log Message: New mm layer, start of signals implementation + other misc fixes Index: Makefile =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/arch/vax/Makefile,v retrieving revision 1.8 retrieving revision 1.9 diff -u -r1.8 -r1.9 --- Makefile 2001/06/24 19:34:56 1.8 +++ Makefile 2001/07/31 17:28:26 1.9 @@ -63,9 +63,11 @@ dd if=/dev/zero of=header.bin bs=512 count=1 mv -f header.bin vmlinux.SYS cat vmlinux.bin >> vmlinux.SYS + # this is helpful for low level debuggery -# rm -f vmlinux.lst -# $(OBJDUMP) -D vmlinux > vmlinux.lst +listfile: + rm -f vmlinux.lst + $(OBJDUMP) -D vmlinux > vmlinux.lst # This target will only re-compile stuff that's changed in arch/vax mopbootx: linkonly Index: defconfig =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/arch/vax/defconfig,v retrieving revision 1.6 retrieving revision 1.7 diff -u -r1.6 -r1.7 --- defconfig 2001/02/22 22:15:41 1.6 +++ defconfig 2001/07/31 17:28:26 1.7 @@ -218,8 +218,8 @@ # # Kernel hacking -# -CONFIG_DEBUG_MALLOC=y +# This appears to be missing bits... +#CONFIG_DEBUG_MALLOC=n CONFIG_MAGIC_SYSRQ=y CONFIG_PROFILE=y CONFIG_PROFILE_SHIFT=2 |
From: Andy P. <at...@us...> - 2001-07-31 17:28:29
|
Update of /cvsroot/linux-vax/kernel-2.4/arch/vax/boot In directory usw-pr-cvs1:/tmp/cvs-serv32129/boot Modified Files: head.S tmp_init.c Log Message: New mm layer, start of signals implementation + other misc fixes Index: head.S =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/arch/vax/boot/head.S,v retrieving revision 1.11 retrieving revision 1.12 diff -u -r1.11 -r1.12 --- head.S 2001/07/02 12:09:24 1.11 +++ head.S 2001/07/31 17:28:26 1.12 @@ -198,13 +198,17 @@ # PAGE_OFFSET here is 0x80000000 - the start of system space. # # swapper_pg_dir is actually a pgd_t. The spt is the third entry. -# p0br/p0lr, p1br/p1lr, sbr/slr +# see include/asm-vax/mm/pagelet.h for details of the pgd_t structure. +# # First find a suitable start position for the SPT. This must be # longword aligned - addl3 $4, r9, r5 # R9 holds kernel end - bicl2 $3, r5 # R5 is R9 rounded up to longword aligned +# +# Correction, for 3100/85 it needs to be page aligned. + + addl3 $0x200, r9, r5 # R9 holds kernel end + bicl2 $0x1ff, r5 # R5 is R9 rounded up to page aligned moval swapper_pg_dir, r0 - movl r5, 16(r0) # save address of base of system page table + movl r5, 48(r0) # save address of base of system page table # Fill in the main part of the SPT (the entries that map physical # memory) @@ -253,8 +257,8 @@ blssu sparefill2 # system page table is setup. Save SPT length and zap processor registers moval swapper_pg_dir, r0 - movl r7, 20(r0) - mtpr 16(r0), $PR_SBR # set SBR + movl r7, 52(r0) + mtpr 48(r0), $PR_SBR # set SBR mtpr r7, $PR_SLR # set SLR # PCBB # set up the process control block. Some machines need a valid PCB for @@ -273,7 +277,7 @@ calls $0, VAX_start_mm # do that ole black magic # made it moval swapper_pg_dir, r0 - addl2 $PAGE_OFFSET, 16(r0) # fix up our reference to the system page tbl. + addl2 $PAGE_OFFSET, 48(r0) # fix up our reference to the system page tbl. addl2 $PAGE_OFFSET, iomap_base # ... and the IOMAP PTEs addl2 $PAGE_OFFSET, vmallocmap_base # ... and the IOMAP PTEs addl2 $PAGE_OFFSET, mv # fix up machine vector pointer Index: tmp_init.c =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/arch/vax/boot/tmp_init.c,v retrieving revision 1.9 retrieving revision 1.10 diff -u -r1.9 -r1.10 --- tmp_init.c 2001/03/04 23:45:50 1.9 +++ tmp_init.c 2001/07/31 17:28:26 1.10 @@ -31,7 +31,7 @@ #include <asm/bugs.h> -extern void init_IRQ(void); +/* extern void init_IRQ(void); extern void sched_init(void); extern void time_init(void); extern void calibrate_delay(void); @@ -60,13 +60,15 @@ extern void fork_init(unsigned long); extern void cpu_idle(void); - +*/ + /* stuff that is declared in head.S */ extern unsigned long int phys_start; /* physical address of kernel*/ extern unsigned long int virt_start; /* virtual address of kernel */ extern unsigned long int boot_ap; /* argument pointer */ extern unsigned long int boot_r11; /* rpb pointer */ extern unsigned long int boot_scb; /* scb pointer */ +extern unsigned long int iomap_base; /* head.S copies the RPB into this structure */ struct rpb_struct boot_rpb; @@ -104,6 +106,9 @@ * bit of arch-specific C code before starting the main start_kernel */ +#define IOMAP_START (PAGE_OFFSET+((iomap_base-swapper_pg_dir[2].br)<<(PAGELET_SHIFT-2))) + + void vax_start_kernel(void) { /* set the number of 4k pages */ @@ -141,168 +146,12 @@ max_hwpfn, max_pfn, max_hwpfn/2); printk("CPU type: %s, SID: %08x\n", mv->cpu_type_str(), vax_cpu.sid); - + + printk("VM: mapped physical from %x to %x, iomap from %x\n", PAGE_OFFSET, PAGE_OFFSET+(max_hwpfn*512), IOMAP_START); + printk("VM: vmalloc from %x to %x\n", VMALLOC_START, VMALLOC_END); + printk("VM: ptemap from %x to %x for %d processes\n",TASKPTE_START, TASKPTE_END,TASK_MAXUPRC); printk("calling start_kernel...\n"); start_kernel(); -} - -void tmp_start_kernel(void) -{ - char * command_line; - unsigned long mempages; - -/* - * Interrupts are still disabled. Do necessary setups, then - * enable them - */ - /* set the number of 4k pages */ - max_pfn = max_hwpfn/8; - - /* Protect us from interrupt stack overflows */ - guard_int_stack(); - - /* If it is possible to register a console for your - machine at this point in the boot sequence, do so - in post_vm_init(). Otherwise, implement mv->console_init() - which will be called later. */ - - mv->post_vm_init(); - - #ifdef __SMP__ - static int boot_cpu = 1; - /* "current" has been set up, we need to load it now */ - if (!boot_cpu) - initialize_secondary(); - boot_cpu = 0; - #endif - - /* - * Interrupts are still disabled. Do necessary setups, then - * enable them - */ - lock_kernel(); - printk(linux_banner); - - printk("RPB info: l_pfncnt: %08x, .l_vmb_version: %08x .l_badpgs: %08x\n", - boot_rpb.l_pfncnt, boot_rpb.l_vmb_version, boot_rpb.l_badpgs); - - printk("Physical memory: %08x HW pagelets, %08lx pages (%dKB)\n", - max_hwpfn, max_pfn, max_hwpfn/2); - - setup_arch(&command_line); - - printk("CPU type: %s, SID: %08x\n", mv->cpu_type_str(), vax_cpu.sid); - - trap_init(); - init_IRQ(); - sched_init(); - time_init(); - softirq_init(); - - console_init(); - - kmem_cache_init(); - - printk("Dropping IPL to 0 to allow clock interrupts\n"); - - sti(); - - calibrate_delay(); - - /* mem_init finishes up memory init. It places all remaining - memory on the free list */ - - mem_init(); - kmem_cache_sizes_init(); - -#ifdef CONFIG_PROC_FS - proc_root_init(); -#endif - - mempages = num_physpages; - - fork_init(mempages); - proc_caches_init(); - vfs_caches_init(mempages); - buffer_init(mempages); - page_cache_init(mempages); - kiobuf_setup(); - signals_init(); - inode_init(mempages); - -#if defined(CONFIG_SYSVIPC) - ipc_init(); -#endif -#if defined(CONFIG_QUOTA) - dquot_init_hash(); -#endif - - check_bugs(); - printk("POSIX conformance testing by UNIFIX\n"); - - kernel_thread(tmp_init, NULL, CLONE_FS | CLONE_FILES | CLONE_SIGHAND); - - unlock_kernel(); - - current->need_resched = 1; - cpu_idle(); - - printk("\nThis is as far as we've got... - halting\n"); - machine_halt(); -} - -static void __init do_initcalls(void) -{ - initcall_t *call; - - call = &__initcall_start; - do { - (*call)(); - call++; - } while (call < &__initcall_end); - - /* Make sure there is no pending stuff from the initcall sequence */ - flush_scheduled_tasks(); -} - -static void tmp_do_basic_setup(void) -{ - /* - * Tell the world that we're going to be the grim - * reaper of innocent orphaned children. - * - * We don't want people to have to make incorrect - * assumptions about where in the task array this - * can be found. - */ - child_reaper = current; - - if (mv->init_devices) { - mv->init_devices(); - } - -#if defined(CONFIG_NET) - sock_init(); -#endif - - start_context_thread(); - do_initcalls(); - - /* .. filesystems .. */ - filesystem_setup(); - - /* Mount the root filesystem.. */ - mount_root(); - -} - -static int tmp_init(void * unused) -{ - printk("tmp_init: in init thread\n"); - - tmp_do_basic_setup(); - - panic("No init found."); } |
From: Andy P. <at...@us...> - 2001-07-31 17:28:29
|
Update of /cvsroot/linux-vax/kernel-2.4/arch/vax/mm In directory usw-pr-cvs1:/tmp/cvs-serv32129/mm Modified Files: fault.c init.c pgalloc.c pgtable.c Log Message: New mm layer, start of signals implementation + other misc fixes Index: fault.c =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/arch/vax/mm/fault.c,v retrieving revision 1.6 retrieving revision 1.7 diff -u -r1.6 -r1.7 --- fault.c 2001/06/26 18:59:00 1.6 +++ fault.c 2001/07/31 17:28:26 1.7 @@ -35,6 +35,7 @@ * it off to handle_mm_fault(). * * reason: + * reason == 0 means kernel translation not valid fault in SPT. * bit 0 = length violation * bit 1 = fault during PPTE reference * bit 2 = fault-on-read if 0, fault-on-write if 1 @@ -57,8 +58,9 @@ struct mm_struct *mm = NULL; unsigned fixup; -#if VAX_MM_DEBUG - printk("mmfault: fault at %8X\n", address); +#ifdef VAX_MM_DEBUG + printk("mmfault: fault at %8x, pc %8x, psl %8x, reason %8x\n",info->addr, info->pc, info->psl, info->reason); + printk("mmfault:p0br %8lx, p0lr %8lx, p1br %8lx, p1lr %8lx\n",Xmfpr(PR_P0BR),Xmfpr(PR_P0LR),Xmfpr(PR_P1BR),Xmfpr(PR_P1LR)); #endif /* This check, and the mm != NULL checks later, will be removed later, once we actually have a 'current' properly defined */ @@ -72,20 +74,27 @@ goto no_context; down (&mm->mmap_sem); + vma = find_vma(mm, address); + if (!vma) goto bad_area; + if (vma->vm_start <= address) goto good_area; + if (!(vma->vm_flags & VM_GROWSDOWN)) goto bad_area; + if (expand_stack(vma, address)) goto bad_area; + /* * Ok, we have a good vm_area for this memory access, so * we can handle it.. */ good_area: + if (reason & REASON_WRITE) { if (!(vma->vm_flags & VM_WRITE)) goto bad_area; @@ -96,7 +105,8 @@ } survive: { - int fault = handle_mm_fault(mm, vma, address, reason & REASON_WRITE); + int fault; + fault = handle_mm_fault(mm, vma, address, reason & REASON_WRITE); if (!fault) goto do_sigbus; if (fault < 0) @@ -111,10 +121,16 @@ */ bad_area: up(&mm->mmap_sem); + printk("\nStack dump\n"); + hex_dump((void *)(regs->r1), 256); + show_regs(regs); + show_cpu_regs(); - if (user_mode(regs)) { + if (user_mode(regs)) { printk("do_page_fault: sending SIGSEGV\n"); force_sig(SIGSEGV, current); + /* signals arent implemented yet */ + machine_halt(); return; } @@ -212,13 +228,14 @@ struct accvio_info *info = (struct accvio_info *)excep_info; static int active; + /* This active flag is just a temporary hack to help catch accvios in the page fault handler. It will have to go eventually as it's not SMP safe */ if (!active) { /* active = 1;*/ do_page_fault(info, regs); -#if VAX_MM_DEBUG +#ifdef VAX_MM_DEBUG printk("finished fault\n"); #endif active = 0; Index: init.c =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/arch/vax/mm/init.c,v retrieving revision 1.14 retrieving revision 1.15 diff -u -r1.14 -r1.15 --- init.c 2001/06/26 18:59:00 1.14 +++ init.c 2001/07/31 17:28:26 1.15 @@ -14,15 +14,16 @@ #include <asm/pgalloc.h> #include <asm/rpb.h> -#undef VAX_INIT_DEBUG +#define VAX_INIT_DEBUG static unsigned long totalram_pages; -unsigned long max_pfn; /* number of 4k pfns */ unsigned long empty_zero_page[PAGE_SIZE / sizeof(unsigned long)] __attribute__ ((__aligned__(PAGE_SIZE))); +pte_t *pg0; + #ifndef CONFIG_SMP struct pgtable_cache_struct quicklists; #endif @@ -38,23 +39,51 @@ /* * In other architectures, paging_init sets up the kernel's page tables. - * In Linux/VAX, this is already done by the early boot code. + * In Linux/VAX, this is already done by the early boot code. For the + * physical RAM. In this routine we initialise the remaining areas of + * the memory, and system page table. */ void __init paging_init() { - unsigned long zones_size[MAX_NR_ZONES] = { 0, 0, 0 }; - unsigned int max_dma, max_norm; + hwpte_t *pte, *lastpte; + unsigned int ii; - max_dma = virt_to_phys((char *)MAX_DMA_ADDRESS) >> PAGE_SHIFT; + /* sort out page table. */ + pg0 = (pte_t *)SPT_BASE; + + /* FIXME: This is where the VMALLOC stuff from head.S should go */ - /* max_pfn is the number of 4k ptes */ - if (max_pfn < max_dma) { - zones_size[ZONE_DMA] = max_pfn; - } else { - zones_size[ZONE_DMA] = max_dma; - zones_size[ZONE_NORMAL] = max_pfn - max_dma; + printk("VAXMM: Initialising mm layer for %d tasks of size %dMB\n",TASK_MAXUPRC,(TASK_WSMAX>>20)); + /* Size the process page table slots. See asm/mm/task.h for details + * The _START and _END macros are from pgtable.h + * This is all in PAGELETS and HWPTES, hence no set_pte + */ + pte = (hwpte_t *)GET_SPTE_VIRT(VMALLOC_END); + lastpte = (hwpte_t *)GET_SPTE_VIRT(TASKPTE_START); + ii=0; + /* clear this area */ + while (pte<lastpte) { + *pte++ = __hwpte(0x00000000); + ii++; + } + /* this is stored in hwptes */ + SPT_LEN += ii; + + pte = (hwpte_t *)GET_SPTE_VIRT(TASKPTE_START); + lastpte = pte + SPT_HWPTES_TASKPTE; + /* clear this area */ + while (pte<lastpte) { + *pte++ = __hwpte(0x00000000); } - free_area_init(zones_size); + /* this is stored in hwptes */ + SPT_LEN += SPT_HWPTES_TASKPTE; + __mtpr(SPT_LEN, PR_SLR); + flush_tlb(); + + printk("VAXMM: system page table base %8lx, length (bytes) %8lx length (ptes) %8lx\n",SPT_BASE,SPT_SIZE,SPT_LEN); + + /* clear the quicklists structure */ + memset(&quicklists,0,sizeof(quicklists)); } #if DEBUG_POISON @@ -107,73 +136,6 @@ } printk("Freeing unused kernel memory: %dk freed\n", (&__init_end - &__init_begin) >> 10); -} - - -/* page table stuff */ - -/* get_pte_kernel_slow. allocate a page of PTEs for the S0 pagetable. - * See comments in include/asm/mm/pgalloc.h for get_pte_kernel. - */ -pte_t *get_pte_kernel_slow(pmd_t * pmd, unsigned long address) -{ - return (pte_t *) NULL; -} - -/* just want a page here - quite simple */ -pte_t *get_pte_slow(pmd_t * pmd, unsigned long address) -{ - unsigned long pte; - - pte = (unsigned long) __get_free_page(GFP_KERNEL); - - if (pte) { - return (pte_t *) pte; - } else { - return NULL; - } - return NULL; -} - -/* remap a given page to be part of a contiguous page table for p0/1 space */ -void remap_and_clear_pte_page(pgd_t *pagetable, pte_t *page, unsigned long pte_page) -{ - unsigned long page_physical_address, page_virtual_address, page_s0_address; - pte_t *S0pte; - pte_t tpte; - pte_t *newpage; - pgd_t *sys_pgd = swapper_pg_dir+2; - /* address in S0 space is page pointer */ - /* find the entry in the SPTE corresponding to this page */ - - page_physical_address=__pa(page); - S0pte = pte_offset(sys_pgd, page_physical_address); - - /* S0pte = (pte_t *)((__pa(page) >> PAGELET_SHIFT)+sys_pgd->br);*/ - -#if VAX_INIT_DEBUG - printk("remap: virt addr %p, pteval %8lX , S0pte %p, %8lX\n", page, pte_val(*page), S0pte, pte_val(*S0pte)); -#endif - if (!pte_present(*S0pte)) - { - unsigned long phy_addr; - pgd_t *ret = (pgd_t *)__get_free_page(GFP_KERNEL); - /* we have address in S0 of free page */ - /* need to remap this free page to the address in S0 where we are */ - /* Get the phy address of the page */ - //spte = pte_offset(sys_pgd, ((unsigned long)ret - PAGE_OFFSET)); - clear_page((void *)ret); - pte_clear(S0pte); - tpte = __mk_pte((void *)ret, (pgprot_t)PAGE_KERNEL); - - set_pte(S0pte, tpte); - /* grab a free page */ - printk("S0 page invalid, %p %8lX\n", ret, pte_val(tpte)); - return; - } - /* zero out these pte's */ - // clear_page((void *) page); - return; } void Index: pgalloc.c =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/arch/vax/mm/pgalloc.c,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- pgalloc.c 2001/06/27 09:17:41 1.1 +++ pgalloc.c 2001/07/31 17:28:26 1.2 @@ -3,23 +3,294 @@ * pgalloc.c Routines from include/asm-vax/mm/pgalloc.h * Allocation of page table entries and so forth. * - * Copyright atp Jun 2001 + * Copyright atp Jun 2001 - complete rewrite. + * * GNU GPL */ #include <linux/sched.h> #include <linux/mm.h> - +#include <asm/page.h> +#include <asm/pgtable.h> #include <asm/pgalloc.h> +#include <asm/mmu_context.h> + +#undef VAX_MM_PGALLOC_DEBUG + +/* + * allocate a pgd. We don't - at present, need to worry about + * maintaining a bit map as we put pgds that are finished with + * on our quicklists pool + */ +pgd_t *get_pgd_fast(void) +{ + unsigned long *ret; + + if ((ret = pgd_quicklist) != NULL) { + pgd_quicklist = (unsigned long *)(*ret); + ret[0] = 0; + pgtable_cache_size--; + } + return (pgd_t *)ret; +} + +/* allocate a pgd */ +pgd_t *pgd_alloc(void) +{ + /* this is rather wasteful, as only a few longwords are + * used in the entire 4kb page. Perhaps we can do something + * smarter here by using the quicklists to pack the pgds into + * a single page. */ + pgd_t *ret; + unsigned long taskslot; + + /* grab a pgd off the cache */ + ret = get_pgd_fast(); + + if (!ret) { + /* check if we have run out of balance slots */ + if (pgd_slots_used >= TASK_MAXUPRC) return (pgd_t *)NULL; + ret = (pgd_t *)__get_free_page(GFP_KERNEL); + taskslot = GET_TASKSLOT(pgd_slots_used); + /* one more slot used */ + pgd_slots_used++; + ret[0].pmd = 0; /* These are blank */ + ret[1].pmd = 0; + + } else { + /* pgd_clear keeps this */ + taskslot=ret->slot; + } + + if (ret) { + + /* set the values of the base + length registers */ + ret[0].br = taskslot+ (P0PTE_OFFSET); /* skip the PMD */ + ret[0].lr = 0x0; + /* this comes in handy later */ + ret[0].slot = taskslot; + /* p1br points at what would be page mapping 0x40000000 */ + ret[1].br = taskslot+ (P1PTE_OFFSET) - 0x800000 ; + /* This is the unmapped number of PTEs */ + ret[1].lr = 0x40000; + ret[1].slot = taskslot; + + ret[0].segment = 0; + ret[1].segment = 1; + +#ifdef VAX_MM_PGALLOC_DEBUG + printk(KERN_DEBUG "VAXMM:pgd_alloc: p0: %8lX, %8lX, p1: %8lX, %8lx, slot %ld, taskslot %8lx\n", ret[0].br, ret[0].lr, ret[1].br, ret[1].lr, pgd_slots_used-1, ret[0].slot); +#endif + /* set the s0 region, from the master copy in swapper_pg_dir */ + memcpy(ret + USER_PTRS_PER_PGD, swapper_pg_dir + USER_PTRS_PER_PGD, (PTRS_PER_PGD - USER_PTRS_PER_PGD) * sizeof(pgd_t)); + } + return ret; +} + +void pgd_clear(pgd_t * pgdp) +{ + /* wipe a pgd structure carefully -- this is probably overkill */ + pgdp->pmd=0; + pgdp->pmd2=0; + + if (pgdp->segment) { + /* p1br points at what would be page mapping 0x40000000 */ + pgdp->br = pgdp->slot+ (P1PTE_OFFSET) - 0x800000 ; + /* This is the unmapped number of PTEs */ + pgdp->lr = 0x40000; + } else { + pgdp->br = pgdp->slot+ (P0PTE_OFFSET); /* skip the PMD */ + pgdp->lr = 0x0; + } +} + +/* bit of a null op - grab a page off the list - pmd_alloc does the real work */ +pmd_t *get_pmd_slow(void) +{ + return (pmd_t *) __get_free_page(GFP_KERNEL); +} + +/* allocate a 'pmd'. In fact we will set it here too, to avoid confusion */ +pmd_t * pmd_alloc(pgd_t *pgd, unsigned long address) +{ + /* we want to allocate two pages and remap them into the + * appropriate pmd slot in the taskslot. */ + + unsigned int is_p1; + pmd_t *pmdpage; + pmd_t *s0addr; + unsigned long adjaddr; + + is_p1 = pgd->segment; + adjaddr = (address >> PMD_SHIFT) & (PTRS_PER_PMD - 1); + + /* sanity check */ + /* FIXME: is this pgd_none? */ + if (pgd->pmd) { +#ifdef VAX_MM_PGALLOC_DEBUG + printk(KERN_DEBUG "VAXMM: Calling pmd_alloc on already allocated page (pgd=%8p,pmd=%8lx)\n",pgd,pgd->pmd); +#endif + return (pmd_t *)pgd->pmd+adjaddr; + } + + /* grab the first page */ + pmdpage = get_pmd_fast(); + + if (!pmdpage) { + /* didnt work */ + pmdpage = get_pmd_slow(); + } + if (!pmdpage) { + /* didnt work again - give up */ + printk(KERN_ERR "VAXMM: unable to allocate a pmd for pgd (%8p)\n",pgd ); + return NULL; + } + /* calculate which bit of the page table area this page fits into */ + + s0addr = (pmd_t *)pgd->slot; /* base of the slot */ + + s0addr += (is_p1) ? (P1PMD_OFFSET/sizeof(pmd_t)): (P0PMD_OFFSET/sizeof(pmd_t)); + + /* remap and clear this page */ + remap_and_clear_pte_page(s0addr, (pte_t *)pmdpage); + + /* this is the first page in our pmd table. */ + pgd->pmd=(unsigned long)s0addr; + + /* now, do the same for the second */ + pmdpage = get_pmd_fast(); + + if (!pmdpage) { + pmdpage = get_pmd_slow(); + } + if (!pmdpage) { + printk(KERN_ERR "VAXMM: unable to allocate a pmd for pgd (%8p)\n",pgd ); + free_pmd_fast(get_pageaddr_from_pte(pgd->pmd)); + remap_pte_invalidate(pgd->pmd); + return NULL; + } + + s0addr += (PAGE_SIZE/sizeof(pmd_t)); -/* misc comments FIXME: sort and discard */ + remap_and_clear_pte_page(s0addr, (pte_t *)pmdpage); + /* and the second page in our pmd table. */ + pgd->pmd2=(unsigned long)s0addr; + +#ifdef VAX_MM_PGALLOC_DEBUG + printk(KERN_DEBUG "VAXMM: pmd_alloc: pgd %8p, pgd->br %8lx, pgd->lr %8lx, \n\tpgd->pmd %8lx, pgd->pmd2 %8lx\n",pgd,pgd->br, pgd->lr, pgd->pmd,pgd->pmd2); +#endif + /* pages allocated, now store the backpointer we need in pte_alloc + * in the last slot in the address slot. Comfortably beyond where + * we expect to really be allocating memory. */ + pmdpage = (pmd_t *)pgd->pmd; + + /* FIXME: I _really_ dont like this flag. */ + pmd_val(pmdpage[PGD_SPECIAL]) = (unsigned long)pgd | 0x1; + + return (pmd_t *) pgd->pmd+adjaddr; +} + +/* This inverts the remapping done in remap_and_clear */ +unsigned long get_pageaddr_from_pte(pte_t *ptep) +{ + unsigned long addr; + pte_t *s0pte; + + s0pte = GET_SPTE_VIRT(ptep); + + addr = (unsigned long)(((pte_val(*s0pte)&PAGELET_PFN_MASK)<<PAGELET_SHIFT)|PAGE_OFFSET); +// printk("get_pageaddr: ptep %p, spte %8lx, *spte %8lx, addr %8lx\n",ptep,s0pte,pte_val(*s0pte),addr); + return addr; +} + +/* free a 'pmd'. */ +void pmd_free(pmd_t *pmd) +{ + pmd_t *pmdp; + pmdp = pmd+(PAGE_SIZE/4); +#ifdef VAX_MM_PGALLOC_DEBUG + printk(KERN_DEBUG "VAXMM:pmd_free: freeing pmd %p, pmd2 %p\n",pmd,pmdp); +#endif + free_pmd_slow(get_pageaddr_from_pte(pmdp)); + free_pmd_slow(get_pageaddr_from_pte(pmd)); + /* invalidate the S0 ptes that map this */ + remap_pte_invalidate(pmd); + remap_pte_invalidate(pmdp); +} + +/* remap a given page to be part of a contiguous page table for p0/1 space + * + * This is like remap_pte_range in memory.c but VAX specific + * + * s0addr is the address in S0 space that we need to remap the page + * pointed to pte_page to. We also clear the page pointed at by pte_page + */ +void remap_and_clear_pte_page(pmd_t *s0addr, pte_t *pte_page) +{ + + pte_t *s0pte; + + /* sanity checks */ + if (!s0addr) { + printk(KERN_ERR "VAXMM: null S0 address in remap_and_clear_pte_page!\n"); + return; + } + if (!pte_page) { + printk(KERN_ERR "VAXMM: null pte_page in remap_and_clear_pte_page!\n"); + return; + } + + /* locate the S0 pte that describes the page pointed to by s0addr */ + + s0pte = GET_SPTE_VIRT(s0addr); + + /* is it already pointing somewhere? */ +#ifdef VAX_MM_PGALLOC_DEBUG + if (pte_present(*s0pte)) { + printk(KERN_DEBUG "VAXMM: S0 pte %8p already valid in remap_and_clear_pte_page??\n",s0pte); + } +#endif + + page_clear(pte_page); + + /* zap the map */ + set_pte(s0pte,__mk_pte(pte_page,__pgprot(_PAGE_VALID|_PAGE_KW))); +// print_pte(s0pte); + flush_tlb_all(); + +} + +/* invalidate the S0 pte that was remapped to point at this page */ +void remap_pte_invalidate(pmd_t *s0addr) +{ + pte_t *s0pte; + + /* sanity checks */ + if (!s0addr) { + printk(KERN_ERR "VAXMM: null S0 address in remap_and_clear_pte_page!\n"); + return; + } + /* locate the S0 pte that describes the page pointed to by s0addr */ + + s0pte = GET_SPTE_VIRT(s0addr); + + set_pte(s0pte, pte_mkinvalid(*s0pte)); +// print_pte(s0pte); + /* FIXME: these flush_tlb_alls need replacing with flush_tlb_8 */ + flush_tlb_all(); + +// __flush_tlb_one(s0addr); +} -/* It is called from mm/vmalloc.c in alloc_area_pmd() +/* + * Notes on pte_alloc_kernel() + * + * It is called from mm/vmalloc.c in alloc_area_pmd() * - * It needs to be physically contiguous with the rest of the + * Any extension to the SPT needs to be physically contiguous with the rest of the * system page table. * Things to consider: - * If you want to allocate a pagetable to hold a pte for a given + * If you want to allocate a page to hold a pte for a * new S0 address, (where this address is higher than SBR+SLR) then that * new page table page must be allocated at the exact physical page * That maps that S0 address. I.e. @@ -27,17 +298,22 @@ * page containing the address * * PFN = ( (X-PAGE_OFFSET) >> PAGE_SHIFT) + * * PTE address (physical memory) = (PFN*4)+SBR * Physical page address = (PTE address) & ~(PAGE_MASK) * SLR = ((Physical page address + (1<<PAGE_SHIFT)) - SBR) / 4. * - * * If that physical page is already occupied, the contents must * be ejected. This takes time, and can lead to deadlock, particularly * if a dirty page needs to be written to disk/swap. * Also, any physical pages that are in between the previous end of the * system page table, and the new end (SBR+SLR) will need to be cleared, * otherwise random rubbish will end up in the system page table. + * + * This requirement of a contiguous range of physical pages, at a precise + * address range is hard to meet on a system that has been running for any + * length of time. + * * One way to do this by "locking up the machine", moving the contents * of the physical pages needed to pages on the freelist, rewriting the PTE's * to point at the new physical pages, and then allocating and expanding @@ -53,119 +329,210 @@ * * - we still need to implement this ... linux still calls it .. * - D.A. May 2001. + * + * - Indeed, however, the implementation is still not obvious to me. + * atp July 2001. */ + + pte_t * pte_alloc_kernel(pmd_t * pmd, unsigned long address) { pgd_t *pgdptr = (pgd_t *)pmd; /* note the lr in the system pgd is in PAGELETS.... shift it down to give page view */ +//printk("pte_allock: pmd, %p, address %8lx\n",pmd,address); if ((address >> PAGE_SHIFT) < (pgdptr->lr>>3)) return pte_offset(pmd, address); else return NULL; } + /* - * allocate a page, to hold page table entries. - * for a user process. + * Allocate a page, to hold page table entries for a user process. + * * We grab a random page. The only catch is that it must be virtually * contiguous within the P0 or P1 page tables, which are held in S0 * space. So, we remap the page table area in S0 space too. + * + * The idea here is that a given task has an area in kernel + * address space that is TASK_WSMAX+TASK_STKSIZE in size (plus a few other bits). + * This space is initially unmapped. If the process needs to expand its page table + * (by mapping a page beyond the end of the relevant process page table) + * It can as long as it doesnt go beyond TASK_WSMAX in P0 and TASK_STKSIZE in P1. + * See asm-vax/mm/task.h for details. + * + * We make use of the knowledge that the pmd is a single block, to work back + * to the pgd, which is where the base and length register values are held. + * + * pmd is a pointer to the slot in our bogus pmd table we want to use. */ + + pte_t * pte_alloc(pmd_t * pmd, unsigned long address) { - unsigned long pte_number, pte_page, pte_page_offset; - pgd_t *pgdptr = (pgd_t *)pmd; - pte_t *newpte= NULL; - - printk("pte_alloc: address %ld\n", address); - /* Deal with P0 vs P1 spaces */ - /* need to handle error cases */ - if (address < 0x40000000) - { - pte_number = (address >> PAGE_SHIFT); - pte_page = (pte_number >> SIZEOF_PTE_LOG2); - pte_page_offset = pte_number & (PTRS_PER_PTE - 1); - if ((pte_number) < (pgdptr->lr)) { - newpte = pte_offset(pmd, address); + pgd_t *pgdp; + pmd_t *pmd_basep, *s0addr; + unsigned long int current_last_page,is_p1,target_page,npages,pte_number,adjusted_address; + pte_t *pte_page; + pmd_t *pmdi; + long int direction,ii; + + pmd_basep = ((unsigned long)pmd & PTE_TASK_MASK); /* base of the pmd */ + +#ifdef VAX_MM_PGALLOC_DEBUG + printk(KERN_DEBUG "VAXMM:pte_alloc: pmd_basep %8lx, pmd %8lx, pmd_val %8lx, address %8lx, pmd_index %8lx\n",pmd_basep,pmd,pmd_val(*pmd),address,pmd_index(address)); +#endif + pgdp = (pgd_t *)(pmd_val(pmd_basep[PGD_SPECIAL]) & ~0x1); + + + /* FIXME: should test pgdp. this is pointless otherwise */ + if ((!pgdp)||(pgd_none(*pgdp))) { + printk(KERN_ERR "VAXMM: Bad PGD (%8p, from pmd %8p) in pte_alloc\n",pgdp,pmd_basep); + return NULL; + } + if (pgdp->pmd != (unsigned long)pmd_basep) { + printk(KERN_ERR "VAXMM: Mismatched PGD (%8p, has pmd %8lx from pmd %8p) in pte_alloc\n",pgdp,pgdp->pmd,pmd_basep); + return NULL; + } + + is_p1=pgdp->segment; + +// printk(KERN_DEBUG "ptealloc:pgd %8p, pgd->segment %ld, pgd->br %8lx, pgd->lr %lx, pgd->slot %8lx\n",pgdp,pgdp->segment,pgdp->br,pgdp->lr,pgdp->slot); + + /* make an adjusted address + calculate linear page table entry */ + + adjusted_address = (((pmd-pmd_basep))<<(PAGE_SHIFT+7))+ (address&~PMD_MASK); + if (is_p1){ + adjusted_address |= 0x40000000; + pte_number = (adjusted_address - 0x40000000) >> PAGE_SHIFT; + } else { + pte_number = (adjusted_address>>PAGE_SHIFT); + } + + /* FIXME: check against WSMAX */ + + /* check that the pte we want isnt already allocated */ + if (is_p1) { + if ((pte_number) > (pgdp->lr)) { +#ifdef VAX_MM_PGALLOC_DEBUG + printk(KERN_DEBUG "VAXMM: pte_alloc called on already allocated page (pte %8lx, lr %8lx)\n",pte_number,pgdp->lr); +#endif + return pte_offset(pmd, adjusted_address); } - } - else - { - address-=0x40000000; - pte_number = (address>>PAGE_SHIFT); - pte_page = (pte_number >> SIZEOF_PTE_LOG2); - pte_page_offset = pte_number & (PTRS_PER_PTE - 1); - if ((pte_number) > (pgdptr->lr)) { - newpte = pte_offset(pmd, address); + } else { + if ((pte_number) < (pgdp->lr)) { +#ifdef VAX_MM_PGALLOC_DEBUG + printk(KERN_DEBUG "VAXMM: pte_alloc called on already allocated page (pte %8lx, lr %8lx)\n",pte_number,pgdp->lr); +#endif + return pte_offset(pmd, adjusted_address); + } + } + + /* find the current last page in the page table */ + current_last_page = (pgdp->lr >> 7) - 1; /* 128 PTE's per page */ + target_page = pmd_index(adjusted_address); + + if (is_p1) { + npages = current_last_page - target_page + 1; + /* The s0 address of the current end page in the page table is + * current_last_page * 128 ptes/page * 32 bytes/pte_t + base reg */ + + s0addr = (((current_last_page)<<7)*BYTES_PER_PTE_T)+pgdp->br; + direction = -1; + pmdi = pmd_basep+(current_last_page); + } else { + npages = target_page - current_last_page; + s0addr = (((current_last_page + 1)<<7)*BYTES_PER_PTE_T)+pgdp->br; + direction = 1; + pmdi = pmd_basep+(current_last_page + 1); + } + for (ii=0; ii<npages; ii++) { + if (!(pte_page=pte_alloc_one(pmdi))) { + printk(KERN_ERR "VAXMM: Unable to expand process page table (pgd=%8p)\n",pgdp); + return NULL; } + + /* remap and clear this page */ + remap_and_clear_pte_page(s0addr, pte_page); + + /* set the pmd */ + pmd_val(*pmdi) = (unsigned long) s0addr; + + /* increment/decrement length register. */ + pgdp->lr += (direction*128); + s0addr += (direction * (PAGE_SIZE>>2)); + pmdi += direction; + + } + + /* if task == current, the hw registers need to be set */ + if (is_p1) { + if (current->thread.pcb.p1br == pgdp->br) { + current->thread.pcb.p1lr = pgdp->lr * 8; + set_vaxmm_regs_p1(pgdp); + + } + } else { + if (current->thread.pcb.p0br == pgdp->br) { + current->thread.pcb.p0lr = pgdp->lr * 8; + set_vaxmm_regs_p0(pgdp); + } + } + /* we flush tlb anways as we have touched S0 page tables */ + flush_tlb_all(); + return pte_offset(pmd, adjusted_address); + +} /* pte_alloc */ - } +/* allocate a page for the page table */ +pte_t * pte_alloc_one(pmd_t *pmd) +{ + if (pmd_none(*pmd)) { + pte_t *page = get_pte_fast(); + + if (!page) return get_pte_slow(); + return page; + } + return (pte_t *) pmd_val(*pmd); +} - if (newpte) - { - remap_and_clear_pte_page((pgd_t *)pmd, newpte, pte_page); - /* make sure a page in S0 space is mapped */ +/* free the page after recovering the original address */ +void pte_free(pte_t *pte) +{ + free_pte_fast(get_pageaddr_from_pte(pte)); + /* invalidate the S0 pte that maps this */ + remap_pte_invalidate(pte); +} - } - return newpte; +/* Find an entry in the third-level page table.. */ +pte_t * pte_offset(pmd_t * dir, unsigned long address) +{ + return (pmd_val(*dir)+(((address>>PAGE_SHIFT)&(PTRS_PER_PTE-1))<<SIZEOF_PTE_LOG2)); +} - /* old 2.2 code commented out for now .. in case it is of any use - to anyone later - D.A. May 2001 */ -#if 0 - /* calculate the offset of the requested pte in this pagetable page */ - unsigned long pte_number, pte_page, pte_page_offset; - pgd_t *pgdptr = (pgd_t *)pmd; - unsigned long t2; - pte_t *page; - - pte_number = (address >> PAGE_SHIFT); - pte_page = (pte_number >> SIZEOF_PTE_LOG2); - pte_page_offset = pte_number & (PTRS_PER_PTE - 1); - - /* do we have a pgd base and length set ? */ - /* The p0br and p1br should be setup at process initialisation. */ - if (pmd_none(*pmd)) { - printk("Got pmd_none\n"); - return NULL; - } - - /* do we need to allocate another page(s) */ - - - /* this is already inside the page table region, and allocated */ - /* return the virtual address of the pte. (base registers for p0 and p1 */ - /* refer to virtual addresses in S0 space) so no _va() is needed */ - if (pte_number < (pgdptr->lr)) { - return (pte_t *) (pgdptr->br + pte_number*BYTES_PER_PTE_T); - } - - /* The address lies outside the current page table - by how much?*/ - /* FIXME: Maximum task size, defined by max p0 pagetable size */ - - /* number of pages to allocate */ - t2 = ((pte_number - pgdptr->lr) >> SIZEOF_PTE_LOG2) + 1 ; - - while (t2--) { - /* grab a page off the quicklist */ - page = get_pte_fast(); - /* or allocate a new one if none left */ - if (!page) page = get_pte_slow(pmd, address); - - /* run out of pages - out of memory */ - /* FIXME: is there anything else we need to do to signal failure?*/ - if (!page) { - printk("%s:%d: run out of free pages building page table at pte %08lx.\n", __FILE__, __LINE__, pgdptr->lr); - return NULL; - } - /* map this page into the S0 page table at the right point */ - remap_and_clear_pte_page((pgd_t *)pmd, page, pte_page); - - /* add this page of PTEs to the length register */ - /* FIXME: handle reverse P1 region... */ - pgdptr->lr += PTRS_PER_PTE; - } - return (pte_t *)( pgdptr->br + pte_number*BYTES_PER_PTE_T); -#endif /* if 0 */ +/* get_pte_kernel_slow. allocate a page of PTEs for the S0 pagetable. + * See comments in include/asm/mm/pgalloc.h for get_pte_kernel. + */ +pte_t *get_pte_kernel_slow(pmd_t * pmd, unsigned long address) +{ + return (pte_t *) NULL; } + +/* just want a page here - quite simple */ +/* bit of a null op - grab a page off the list - pte_alloc does the real work */ +pte_t *get_pte_slow(void) +{ + unsigned long pte; + + pte = (unsigned long) __get_free_page(GFP_KERNEL); + + if (pte) { + return (pte_t *) pte; + } else { + return NULL; + } + return NULL; +} + Index: pgtable.c =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/arch/vax/mm/pgtable.c,v retrieving revision 1.5 retrieving revision 1.6 diff -u -r1.5 -r1.6 --- pgtable.c 2001/05/19 12:01:02 1.5 +++ pgtable.c 2001/07/31 17:28:26 1.6 @@ -1,13 +1,15 @@ /* * $Id$ * - * handle bits of VAX memory management + * handle bits of VAX memory management + * atp 2000 */ #include <linux/sched.h> #include <linux/mm.h> #include <asm/pgalloc.h> +#include <asm/mmu_context.h> /* Note the factor of 8 in the length registers */ void set_page_dir(struct task_struct * tsk, pgd_t * pgdir) @@ -22,10 +24,7 @@ /* This doesnt sound like a great idea... perhaps setipl(31) would be a good idea here */ if (tsk == current) { - __mtpr(tsk->thread.pcb.p0br, PR_P0BR ); - __mtpr(tsk->thread.pcb.p0lr, PR_P0LR ); - __mtpr(tsk->thread.pcb.p1br, PR_P1BR ); - __mtpr(tsk->thread.pcb.p1lr, PR_P1LR ); + set_vaxmm_regs(pgdir); flush_tlb_all(); } } |
Update of /cvsroot/linux-vax/kernel-2.4/arch/vax/kernel In directory usw-pr-cvs1:/tmp/cvs-serv32129/kernel Modified Files: cpu_ka42.c cpu_ka43.c cpu_ka46.c interrupt.c process.c reboot.c setup.c signal.c syscall.c Log Message: New mm layer, start of signals implementation + other misc fixes Index: cpu_ka42.c =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/arch/vax/kernel/cpu_ka42.c,v retrieving revision 1.5 retrieving revision 1.6 diff -u -r1.5 -r1.6 --- cpu_ka42.c 2001/06/26 18:59:00 1.5 +++ cpu_ka42.c 2001/07/31 17:28:26 1.6 @@ -28,6 +28,7 @@ unsigned int sidex; }; + struct ka42_machine_vector mv_ka42 = { { ka42_pre_vm_init, Index: cpu_ka43.c =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/arch/vax/kernel/cpu_ka43.c,v retrieving revision 1.6 retrieving revision 1.7 diff -u -r1.6 -r1.7 --- cpu_ka43.c 2001/06/26 18:59:00 1.6 +++ cpu_ka43.c 2001/07/31 17:28:26 1.7 @@ -10,6 +10,7 @@ * Fixed the cache initializing, added the functions * ka43_cache_disbale/enable/clear and moved some stuff around. * atp jun 2001 - machine check implementation + * atp Jul 2001 - diagmem remap functions */ #include <linux/types.h> /* For NULL */ @@ -22,6 +23,7 @@ #include <asm/mv.h> #include <asm/vaxcpu.h> #include <asm/vsa.h> +#include <asm/mm/tlb.h> #include <asm/ka43.h> void ka43_pre_vm_init(void); @@ -188,12 +190,12 @@ /* tell us all about it */ printk("KA43: machine check %d (0x%x)\n", ka43frame->mc43_code, ka43frame->mc43_code); printk("KA43: reason: %s\n", ka43_mctype[ka43frame->mc43_code & 0xff]); - + printk("KA43: at addr %x, pc %x, psl %x\n",ka43frame->mc43_addr,ka43frame->mc43_pc,ka43frame->mc43_psl); /* fixme check restart and first part done flags */ if ((ka43frame->mc43_code & KA43_MC_RESTART) || (ka43frame->mc43_psl & KA43_PSL_FPDONE)) { - printk("ka43_mchk: recovering from machine-check.\n"); + printk("KA43: recovering from machine-check.\n"); ka43_cache_reset(); /* reset caches */ return; /* go on; */ } @@ -202,4 +204,32 @@ printk("KA43: Machine Check - unknown error state - halting\n"); machine_halt(); +} + +/* slap the KA43_DIAGMEM bit on an area of S0 memory - used by drivers */ +/* size is the size of the region in bytes */ +void ka43_diagmem_remap(unsigned long int address, unsigned long int size) +{ + /* + * The KA43 seems to be nicely fscked up... All physical memory + * is accessible from 0x00000000 up (as normal) and also from + * 0x28000000 (KA43_DIAGMEM) in IO space. In order to reliably + * share memory with the LANCE, we _must_ read and write to this + * shared memory via the DIAGMEM region. Maybe this bypasses + * caches or something... If you don't do this you get evil + * "memory read parity error" machine checks. + */ + + /* You MUST remember to clear the DIAGMEM bits in these PTEs + before giving the pages back to free_pages() */ + + int i; + pte_t *p = GET_SPTE_VIRT(address); + + printk(KERN_DEBUG "KA43: enabling KA43_DIAGMEM for memory from (%8lx) to (%8lx)\n",address, address+size); + + for (i=0; i<(size>>PAGE_SHIFT); i++, p++) { + set_pte(p, __pte(pte_val(*p) | (KA43_DIAGMEM >> PAGELET_SHIFT))); + __flush_tlb_one(address + i * PAGE_SIZE); + } } Index: cpu_ka46.c =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/arch/vax/kernel/cpu_ka46.c,v retrieving revision 1.6 retrieving revision 1.7 diff -u -r1.6 -r1.7 --- cpu_ka46.c 2001/06/26 18:59:00 1.6 +++ cpu_ka46.c 2001/07/31 17:28:26 1.7 @@ -16,6 +16,7 @@ #include <asm/mtpr.h> #include <asm/mv.h> #include <asm/vaxcpu.h> +#include <asm/vsa.h> #include <asm/ka46.h> void ka46_pre_vm_init(void); Index: interrupt.c =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/arch/vax/kernel/interrupt.c,v retrieving revision 1.12 retrieving revision 1.13 diff -u -r1.12 -r1.13 --- interrupt.c 2001/06/26 18:59:00 1.12 +++ interrupt.c 2001/07/31 17:28:26 1.13 @@ -75,7 +75,7 @@ /* asm("movl %0, r2\n" "movl %1 ,r3\n" "movl %2 ,r4\n" - "halt" : : "g"(q), "g"(t), "g"(s) ); */ + "halt" : : "g"(q), "g"(t), "g"(s) );*/ set_pte(q, p); __flush_tlb_one(interrupt_stack[smp_processor_id()]); Index: process.c =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/arch/vax/kernel/process.c,v retrieving revision 1.9 retrieving revision 1.10 diff -u -r1.9 -r1.10 --- process.c 2001/05/27 16:17:42 1.9 +++ process.c 2001/07/31 17:28:26 1.10 @@ -193,12 +193,12 @@ newsp = regs->sp; } -/* printk("sys_clone: calling do_fork(0x%08lx, 0x%08lx, 0x%p)\n", - clone_flags, newsp, regs); */ + printk("sys_clone: calling do_fork(0x%08lx, 0x%08lx, 0x%p)\n", + clone_flags, newsp, regs); retval = do_fork(clone_flags, newsp, regs, 0); -/* printk("sys_clone: do_fork() returned %d\n", retval); */ + printk("sys_clone: do_fork() returned %d\n", retval); return retval; } Index: reboot.c =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/arch/vax/kernel/reboot.c,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- reboot.c 2001/06/26 18:59:00 1.2 +++ reboot.c 2001/07/31 17:28:26 1.3 @@ -62,6 +62,7 @@ { if (mv->mcheck == NULL) { printk("machine check - CPU specific handler not implemented - halting\n"); + show_cpu_regs(); machine_halt(); } mv->mcheck(stkframe); Index: setup.c =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/arch/vax/kernel/setup.c,v retrieving revision 1.9 retrieving revision 1.10 diff -u -r1.9 -r1.10 --- setup.c 2001/06/26 18:59:00 1.9 +++ setup.c 2001/07/31 17:28:26 1.10 @@ -28,6 +28,7 @@ /* Defined in arch/vax/mm/init.c */ extern void paging_init(void); +unsigned long max_pfn; /* number of 4k pfns */ /* Linker will put this at the end of the kernel image */ extern char _end; @@ -56,6 +57,8 @@ void __init setup_arch(char **cmdline_p) { + unsigned long zones_size[MAX_NR_ZONES] = { 0, 0, 0 }; + unsigned int max_dma; unsigned long bootmap_size; unsigned long region_start; unsigned long region_len; @@ -74,8 +77,13 @@ /* Get the SID */ vax_cpu.sid = __mfpr(PR_SID); - /* Initialize bootmem */ + /* We expand the system page table in paging_init, so + * it comes before the bootmem allocator. */ + paging_init(); + + /* Initialize bootmem */ + /* We don't have any holes in our physical memory layout, so we throw everything into the bootmem allocator. Eventually, we will get smarter and use the bad page lists @@ -96,15 +104,26 @@ printk("calling free_bootmem(start=%08lx, len=%08lx)\n", region_start, region_len); free_bootmem(region_start, region_len); + - region_start = __pa(SPT_BASE + SPT_SIZE); + region_start = __pa(SPT_BASE + SPT_SIZE); region_len = (max_pfn << PAGE_SHIFT) - __pa(SPT_BASE + SPT_SIZE); printk("calling free_bootmem(start=%08lx, len=%08lx)\n", region_start, region_len); free_bootmem(region_start, region_len); + + max_dma = virt_to_phys((char *)MAX_DMA_ADDRESS) >> PAGE_SHIFT; + + /* max_pfn is the number of 4k ptes */ + if (max_pfn < max_dma) { + zones_size[ZONE_DMA] = max_pfn; + } else { + zones_size[ZONE_DMA] = max_dma; + zones_size[ZONE_NORMAL] = max_pfn - max_dma; + } - paging_init(); + free_area_init(zones_size); /* Set up the initial PCB. We can refer to current because head.S has already set us up on the kernel stack of task 0. */ Index: signal.c =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/arch/vax/kernel/signal.c,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- signal.c 2001/05/27 16:35:13 1.2 +++ signal.c 2001/07/31 17:28:26 1.3 @@ -3,10 +3,13 @@ This file contains the standard functions that the arch-independent kernel expects for signal handling + + Copyright, 1998-2001 atp, kenn, airlied. + + atp Jul 2001, signal handling, based on S390/Intel version. */ -#include <linux/config.h> #include <linux/sched.h> #include <linux/mm.h> #include <linux/smp.h> @@ -17,23 +20,157 @@ #include <linux/wait.h> #include <linux/ptrace.h> #include <linux/unistd.h> - -#include <asm/bitops.h> -#include <asm/pgalloc.h> +#include <linux/stddef.h> +#include <asm/ucontext.h> #include <asm/uaccess.h> -/* FIXME: obviously, these need to be filled in... */ +#define _BLOCKABLE (~(sigmask(SIGKILL) | sigmask(SIGSTOP))) -int sys_sigaction(void) -{ - return -ENOSYS; -} +asmlinkage int FASTCALL(do_signal(struct pt_regs *regs, sigset_t *oldset)); -int sys_sigsuspend(void) +int copy_siginfo_to_user(siginfo_t *to, siginfo_t *from) { + if (!access_ok (VERIFY_WRITE, to, sizeof(siginfo_t))) + return -EFAULT; + if (from->si_code < 0) + return __copy_to_user(to, from, sizeof(siginfo_t)); + else { + int err; + + /* If you change siginfo_t structure, please be sure + this code is fixed accordingly. + It should never copy any pad contained in the structure + to avoid security leaks, but must copy the generic + 3 ints plus the relevant union member. */ + err = __put_user(from->si_signo, &to->si_signo); + err |= __put_user(from->si_errno, &to->si_errno); + err |= __put_user((short)from->si_code, &to->si_code); + /* First 32bits of unions are always present. */ + err |= __put_user(from->si_pid, &to->si_pid); + switch (from->si_code >> 16) { + case __SI_FAULT >> 16: + break; + case __SI_CHLD >> 16: + err |= __put_user(from->si_utime, &to->si_utime); + err |= __put_user(from->si_stime, &to->si_stime); + err |= __put_user(from->si_status, &to->si_status); + default: + err |= __put_user(from->si_uid, &to->si_uid); + break; + /* case __SI_RT: This is not generated by the kernel as of now. */ + } + return err; + } +} + +/* + * Atomically swap in the new signal mask, and wait for a signal. + */ +asmlinkage int +sys_sigsuspend(struct pt_regs * regs,int history0, int history1, old_sigset_t mask) +{ + sigset_t saveset; + + mask &= _BLOCKABLE; + spin_lock_irq(¤t->sigmask_lock); + saveset = current->blocked; + siginitset(¤t->blocked, mask); + recalc_sigpending(current); + spin_unlock_irq(¤t->sigmask_lock); + regs->r2 = -EINTR; + + while (1) { + set_current_state(TASK_INTERRUPTIBLE); + schedule(); + if (do_signal(regs, &saveset)) + return -EINTR; + } +} + +asmlinkage int +sys_rt_sigsuspend(struct pt_regs * regs,sigset_t *unewset, size_t sigsetsize) +{ + sigset_t saveset, newset; + + /* XXX: Don't preclude handling different sized sigset_t's. */ + if (sigsetsize != sizeof(sigset_t)) + return -EINVAL; + + if (copy_from_user(&newset, unewset, sizeof(newset))) + return -EFAULT; + sigdelsetmask(&newset, ~_BLOCKABLE); + + spin_lock_irq(¤t->sigmask_lock); + saveset = current->blocked; + current->blocked = newset; + recalc_sigpending(current); + spin_unlock_irq(¤t->sigmask_lock); + regs->r2 = -EINTR; + + while (1) { + set_current_state(TASK_INTERRUPTIBLE); + schedule(); + if (do_signal(regs, &saveset)) + return -EINTR; + } +} + +asmlinkage int +sys_sigaction(int sig, const struct old_sigaction *act, + struct old_sigaction *oact) +{ + struct k_sigaction new_ka, old_ka; + int ret; + + if (act) { + old_sigset_t mask; + if (verify_area(VERIFY_READ, act, sizeof(*act)) || + __get_user(new_ka.sa.sa_handler, &act->sa_handler) || + __get_user(new_ka.sa.sa_restorer, &act->sa_restorer)) + return -EFAULT; + __get_user(new_ka.sa.sa_flags, &act->sa_flags); + __get_user(mask, &act->sa_mask); + siginitset(&new_ka.sa.sa_mask, mask); + } + + ret = do_sigaction(sig, act ? &new_ka : NULL, oact ? &old_ka : NULL); + + if (!ret && oact) { + if (verify_area(VERIFY_WRITE, oact, sizeof(*oact)) || + __put_user(old_ka.sa.sa_handler, &oact->sa_handler) || + __put_user(old_ka.sa.sa_restorer, &oact->sa_restorer)) + return -EFAULT; + __put_user(old_ka.sa.sa_flags, &oact->sa_flags); + __put_user(old_ka.sa.sa_mask.sig[0], &oact->sa_mask); + } + + return ret; +} +asmlinkage int +sys_sigaltstack(const stack_t *uss, stack_t *uoss, struct pt_regs *regs) +{ + return do_sigaltstack(uss, uoss, regs->sp); /* is ->sp the right one FIXME: check */ +} + + +/* + * Do a signal return; undo the signal stack. + */ + +struct sigframe { + struct sigcontext sc; + unsigned long extramask[_NSIG_WORDS-1]; + unsigned char retcode[8]; /* trampoline code */ +}; + +struct rt_sigframe { + struct siginfo *pinfo; + void *puc; + struct siginfo info; + struct ucontext uc; + unsigned char retcode[8]; /* trampoline code */ +}; - return -ENOSYS; -} int sys_sigreturn(void) { @@ -45,48 +182,5 @@ return -ENOSYS; } -int sys_rt_sigsuspend(void) -{ - return -ENOSYS; -} -int sys_sigaltstack(void) -{ - return -ENOSYS; -} -int copy_siginfo_to_user(siginfo_t *to, siginfo_t *from) -{ - if (!access_ok (VERIFY_WRITE, to, sizeof(siginfo_t))) - return -EFAULT; - if (from->si_code < 0) - return __copy_to_user(to, from, sizeof(siginfo_t)); - else { - int err; - - /* If you change siginfo_t structure, please be sure - this code is fixed accordingly. - It should never copy any pad contained in the structure - to avoid security leaks, but must copy the generic - 3 ints plus the relevant union member. */ - err = __put_user(from->si_signo, &to->si_signo); - err |= __put_user(from->si_errno, &to->si_errno); - err |= __put_user((short)from->si_code, &to->si_code); - /* First 32bits of unions are always present. */ - err |= __put_user(from->si_pid, &to->si_pid); - switch (from->si_code >> 16) { - case __SI_FAULT >> 16: - break; - case __SI_CHLD >> 16: - err |= __put_user(from->si_utime, &to->si_utime); - err |= __put_user(from->si_stime, &to->si_stime); - err |= __put_user(from->si_status, &to->si_status); - default: - err |= __put_user(from->si_uid, &to->si_uid); - break; - /* case __SI_RT: This is not generated by the kernel as of now. */ - } - return err; - } - -} Index: syscall.c =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/arch/vax/kernel/syscall.c,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- syscall.c 2001/01/29 00:58:54 1.3 +++ syscall.c 2001/07/31 17:28:26 1.4 @@ -78,7 +78,7 @@ nr_args = *user_ap; } -/* printk("Dispatching syscall %d with %d args\n", chmk_arg, nr_args); */ +/* printk("Dispatching syscall %d with %d args\n", chmk_arg, nr_args);*/ /* We pass all the user-supplied args plus the pointer to the regs to the syscall function. If the syscall is implemented @@ -115,7 +115,7 @@ "g"(-EFAULT) : "r0","r1","r2","r3","r4","r5" /* clobbers*/ ); -/* printk("syscall %d returned %ld (0x%08lx)\n", chmk_arg, regs->r0, regs->r0); */ +/* printk("syscall %d returned %ld (0x%08lx)\n", chmk_arg, regs->r0, regs->r0);*/ return; } |
From: Dave A. <ai...@us...> - 2001-07-21 11:58:56
|
Update of /cvsroot/linux-vax/kernel-2.4/include/asm-vax/mm In directory usw-pr-cvs1:/tmp/cvs-serv1555 Modified Files: pgtable.h Log Message: DA: SPT_SIZE define is wrong.. or we use it wrong in setup.c .. I fixed it here.. others might like to fix setup.c .. not really sure which is the right way... Index: pgtable.h =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/include/asm-vax/mm/pgtable.h,v retrieving revision 1.12 retrieving revision 1.13 diff -u -r1.12 -r1.13 --- pgtable.h 2001/06/10 10:20:42 1.12 +++ pgtable.h 2001/07/21 11:58:51 1.13 @@ -42,13 +42,14 @@ /* entries is (1024 * 1024) >> PAGELET_SIZE */ #define SPT_HWPTES_IOMAP (SPT_MAX_IOMAP<<1) #define SPT_PTES_IOMAP (SPT_MAX_IOMAP >> 2) - /*/>> (PAGE_SHIFT-10)) */ + /*>> (PAGE_SHIFT-10)) */ /* FIXME: (PAGE_SHIFT-10) is hardwired here to 2. asm bug in head.S */ #define SPT_HWPTES_VMALLOC (SPT_MAX_VMALLOC << 1) #define SPT_PTES_VMALLOC (SPT_MAX_VMALLOC >> 2) #define SPT_BASE ((unsigned long)( (swapper_pg_dir[2]).br )) -#define SPT_SIZE ((unsigned long)( (swapper_pg_dir[2]).lr )) +/* Length register is in words.. shift left 2 to get bytes */ +#define SPT_SIZE ((unsigned long)( (swapper_pg_dir[2]).lr ) << 2) /* I'm not sure these are ok. I've only tested the results of * These in the interrupt guard page routine in arch/vax/kernel/interrupt.c |
From: Andy P. <at...@us...> - 2001-07-02 12:09:27
|
Update of /cvsroot/linux-vax/kernel-2.4/arch/vax/boot In directory usw-pr-cvs1:/tmp/cvs-serv28164 Modified Files: head.S Log Message: PCB initialisation code prior to VM start. Index: head.S =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/arch/vax/boot/head.S,v retrieving revision 1.10 retrieving revision 1.11 diff -u -r1.10 -r1.11 --- head.S 2001/06/24 19:34:56 1.10 +++ head.S 2001/07/02 12:09:24 1.11 @@ -3,6 +3,10 @@ # start of boot. entry point # this assumes vmb has does most of the hard work (ie uvax rom vmb) # save useful registers. jump to c in boot.c +# +# TBD: Some of this stuff could do with being rewritten in C +# Some of this stuff could be in .init sections and thrown away. +# #include <asm/mtpr.h> /* Processor register definitions */ #include <asm/mv.h> /* machine vector definitions */ @@ -252,11 +256,21 @@ movl r7, 20(r0) mtpr 16(r0), $PR_SBR # set SBR mtpr r7, $PR_SLR # set SLR +# PCBB +# set up the process control block. Some machines need a valid PCB for +# mm to work properly. +# We should use the pcb for the init task for this, but Since this bit +# should be done in C, rather than hardwiring offsets, I have put a fake +# PCB in a throwaway .init section below. + moval fake_pcb,r9 + movl $PAGE_OFFSET,88(r9) # p1br + mtpr r9, $PR_PCBB # no need to TBIA - memory mapping not enabled +# ready to turn on VM moval msg_starting_vm, r10 jsb printstr jsb crlf - calls $0, VAX_start_mm + calls $0, VAX_start_mm # do that ole black magic # made it moval swapper_pg_dir, r0 addl2 $PAGE_OFFSET, 16(r0) # fix up our reference to the system page tbl. @@ -371,3 +385,8 @@ cpu_type: .int 0x00000000 prom_sidex: .int 0x00000000 +# our dummy pcb +.section .data.init +.globl fake_pcb +fake_pcb: .fill 24,4,0x00000000 + |
From: Andy P. <at...@us...> - 2001-06-27 09:17:45
|
Update of /cvsroot/linux-vax/kernel-2.4/arch/vax/mm In directory usw-pr-cvs1:/tmp/cvs-serv21707 Added Files: pgalloc.c Log Message: missing pgalloc.c from memory reorganisation --- NEW FILE --- /* $Id: pgalloc.c,v 1.1 2001/06/27 09:17:41 atp Exp $ * * pgalloc.c Routines from include/asm-vax/mm/pgalloc.h * Allocation of page table entries and so forth. * * Copyright atp Jun 2001 * GNU GPL */ #include <linux/sched.h> #include <linux/mm.h> #include <asm/pgalloc.h> /* misc comments FIXME: sort and discard */ /* It is called from mm/vmalloc.c in alloc_area_pmd() * * It needs to be physically contiguous with the rest of the * system page table. * Things to consider: * If you want to allocate a pagetable to hold a pte for a given * new S0 address, (where this address is higher than SBR+SLR) then that * new page table page must be allocated at the exact physical page * That maps that S0 address. I.e. * To map a virtual address X you need to allocate the physical * page containing the address * * PFN = ( (X-PAGE_OFFSET) >> PAGE_SHIFT) * PTE address (physical memory) = (PFN*4)+SBR * Physical page address = (PTE address) & ~(PAGE_MASK) * SLR = ((Physical page address + (1<<PAGE_SHIFT)) - SBR) / 4. * * * If that physical page is already occupied, the contents must * be ejected. This takes time, and can lead to deadlock, particularly * if a dirty page needs to be written to disk/swap. * Also, any physical pages that are in between the previous end of the * system page table, and the new end (SBR+SLR) will need to be cleared, * otherwise random rubbish will end up in the system page table. * One way to do this by "locking up the machine", moving the contents * of the physical pages needed to pages on the freelist, rewriting the PTE's * to point at the new physical pages, and then allocating and expanding * the system page table. No scheduling allowed. Also how you locate all * of the references to a given physical page so that you can rewrite them * without conducting a thorough search of all page tables (possibly * incurring page faults for those P0 page tables that have been swapped out) * is not clear. * * * - At present I'm ducking this. We fix the S0 page table size at * boot time, and disallow dynamic expansion. atp Feb 2001. * * - we still need to implement this ... linux still calls it .. * - D.A. May 2001. */ pte_t * pte_alloc_kernel(pmd_t * pmd, unsigned long address) { pgd_t *pgdptr = (pgd_t *)pmd; /* note the lr in the system pgd is in PAGELETS.... shift it down to give page view */ if ((address >> PAGE_SHIFT) < (pgdptr->lr>>3)) return pte_offset(pmd, address); else return NULL; } /* * allocate a page, to hold page table entries. * for a user process. * We grab a random page. The only catch is that it must be virtually * contiguous within the P0 or P1 page tables, which are held in S0 * space. So, we remap the page table area in S0 space too. */ pte_t * pte_alloc(pmd_t * pmd, unsigned long address) { unsigned long pte_number, pte_page, pte_page_offset; pgd_t *pgdptr = (pgd_t *)pmd; pte_t *newpte= NULL; printk("pte_alloc: address %ld\n", address); /* Deal with P0 vs P1 spaces */ /* need to handle error cases */ if (address < 0x40000000) { pte_number = (address >> PAGE_SHIFT); pte_page = (pte_number >> SIZEOF_PTE_LOG2); pte_page_offset = pte_number & (PTRS_PER_PTE - 1); if ((pte_number) < (pgdptr->lr)) { newpte = pte_offset(pmd, address); } } else { address-=0x40000000; pte_number = (address>>PAGE_SHIFT); pte_page = (pte_number >> SIZEOF_PTE_LOG2); pte_page_offset = pte_number & (PTRS_PER_PTE - 1); if ((pte_number) > (pgdptr->lr)) { newpte = pte_offset(pmd, address); } } if (newpte) { remap_and_clear_pte_page((pgd_t *)pmd, newpte, pte_page); /* make sure a page in S0 space is mapped */ } return newpte; /* old 2.2 code commented out for now .. in case it is of any use to anyone later - D.A. May 2001 */ #if 0 /* calculate the offset of the requested pte in this pagetable page */ unsigned long pte_number, pte_page, pte_page_offset; pgd_t *pgdptr = (pgd_t *)pmd; unsigned long t2; pte_t *page; pte_number = (address >> PAGE_SHIFT); pte_page = (pte_number >> SIZEOF_PTE_LOG2); pte_page_offset = pte_number & (PTRS_PER_PTE - 1); /* do we have a pgd base and length set ? */ /* The p0br and p1br should be setup at process initialisation. */ if (pmd_none(*pmd)) { printk("Got pmd_none\n"); return NULL; } /* do we need to allocate another page(s) */ /* this is already inside the page table region, and allocated */ /* return the virtual address of the pte. (base registers for p0 and p1 */ /* refer to virtual addresses in S0 space) so no _va() is needed */ if (pte_number < (pgdptr->lr)) { return (pte_t *) (pgdptr->br + pte_number*BYTES_PER_PTE_T); } /* The address lies outside the current page table - by how much?*/ /* FIXME: Maximum task size, defined by max p0 pagetable size */ /* number of pages to allocate */ t2 = ((pte_number - pgdptr->lr) >> SIZEOF_PTE_LOG2) + 1 ; while (t2--) { /* grab a page off the quicklist */ page = get_pte_fast(); /* or allocate a new one if none left */ if (!page) page = get_pte_slow(pmd, address); /* run out of pages - out of memory */ /* FIXME: is there anything else we need to do to signal failure?*/ if (!page) { printk("%s:%d: run out of free pages building page table at pte %08lx.\n", __FILE__, __LINE__, pgdptr->lr); return NULL; } /* map this page into the S0 page table at the right point */ remap_and_clear_pte_page((pgd_t *)pmd, page, pte_page); /* add this page of PTEs to the length register */ /* FIXME: handle reverse P1 region... */ pgdptr->lr += PTRS_PER_PTE; } return (pte_t *)( pgdptr->br + pte_number*BYTES_PER_PTE_T); #endif /* if 0 */ } |
From: Andy P. <at...@us...> - 2001-06-26 19:01:15
|
Update of /cvsroot/linux-vax/kernel-2.4/include/asm-vax/mm In directory usw-pr-cvs1:/tmp/cvs-serv19188/mm Modified Files: pgalloc.h Log Message: machine check implementation Index: pgalloc.h =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/include/asm-vax/mm/pgalloc.h,v retrieving revision 1.7 retrieving revision 1.8 diff -u -r1.7 -r1.8 --- pgalloc.h 2001/06/17 12:39:19 1.7 +++ pgalloc.h 2001/06/26 19:01:11 1.8 @@ -166,162 +166,10 @@ #define pgd_free(pgd) free_pgd_slow(pgd) #define pgd_alloc() get_pgd_fast() +/* atp jun 01, moved these to arch/vax/mm/pgalloc.c */ /* Allocate a new page for a page table for the kernel */ -/* It is called from mm/vmalloc.c in alloc_area_pmd() - * - * It needs to be physically contiguous with the rest of the - * system page table. - * Things to consider: - * If you want to allocate a pagetable to hold a pte for a given - * new S0 address, (where this address is higher than SBR+SLR) then that - * new page table page must be allocated at the exact physical page - * That maps that S0 address. I.e. - * To map a virtual address X you need to allocate the physical - * page containing the address - * - * PFN = ( (X-PAGE_OFFSET) >> PAGE_SHIFT) - * PTE address (physical memory) = (PFN*4)+SBR - * Physical page address = (PTE address) & ~(PAGE_MASK) - * SLR = ((Physical page address + (1<<PAGE_SHIFT)) - SBR) / 4. - * - * - * If that physical page is already occupied, the contents must - * be ejected. This takes time, and can lead to deadlock, particularly - * if a dirty page needs to be written to disk/swap. - * Also, any physical pages that are in between the previous end of the - * system page table, and the new end (SBR+SLR) will need to be cleared, - * otherwise random rubbish will end up in the system page table. - * One way to do this by "locking up the machine", moving the contents - * of the physical pages needed to pages on the freelist, rewriting the PTE's - * to point at the new physical pages, and then allocating and expanding - * the system page table. No scheduling allowed. Also how you locate all - * of the references to a given physical page so that you can rewrite them - * without conducting a thorough search of all page tables (possibly - * incurring page faults for those P0 page tables that have been swapped out) - * is not clear. - * - * - * - At present I'm ducking this. We fix the S0 page table size at - * boot time, and disallow dynamic expansion. atp Feb 2001. - * - * - we still need to implement this ... linux still calls it .. - * - D.A. May 2001. - */ -extern inline pte_t * pte_alloc_kernel(pmd_t * pmd, unsigned long address) -{ - pgd_t *pgdptr = (pgd_t *)pmd; - - /* note the lr in the system pgd is in PAGELETS.... shift it down to - give page view */ - if ((address >> PAGE_SHIFT) < (pgdptr->lr>>3)) - return pte_offset(pmd, address); - else - return NULL; -} - -/* - * allocate a page, to hold page table entries. - * for a user process. - * We grab a random page. The only catch is that it must be virtually - * contiguous within the P0 or P1 page tables, which are held in S0 - * space. So, we remap the page table area in S0 space too. - */ -extern inline pte_t * pte_alloc(pmd_t * pmd, unsigned long address) -{ - unsigned long pte_number, pte_page, pte_page_offset; - pgd_t *pgdptr = (pgd_t *)pmd; - pte_t *newpte= NULL; - - /* Deal with P0 vs P1 spaces */ - /* need to handle error cases */ - if (address < 0x40000000) - { - pte_number = (address >> PAGE_SHIFT); - pte_page = (pte_number >> SIZEOF_PTE_LOG2); - pte_page_offset = pte_number & (PTRS_PER_PTE - 1); - if ((pte_number) < (pgdptr->lr)) { - newpte = pte_offset(pmd, address); - } - } - else - { - address-=0x40000000; - pte_number = (address>>PAGE_SHIFT); - pte_page = (pte_number >> SIZEOF_PTE_LOG2); - pte_page_offset = pte_number & (PTRS_PER_PTE - 1); - if ((pte_number) > (pgdptr->lr)) { - newpte = pte_offset(pmd, address); - } - - } - - if (newpte) - { - remap_and_clear_pte_page((pgd_t *)pmd, newpte, pte_page); - /* make sure a page in S0 space is mapped */ - - } - return newpte; - - /* old 2.2 code commented out for now .. in case it is of any use - to anyone later - D.A. May 2001 */ -#if 0 - /* calculate the offset of the requested pte in this pagetable page */ - unsigned long pte_number, pte_page, pte_page_offset; - pgd_t *pgdptr = (pgd_t *)pmd; - unsigned long t2; - pte_t *page; - - pte_number = (address >> PAGE_SHIFT); - pte_page = (pte_number >> SIZEOF_PTE_LOG2); - pte_page_offset = pte_number & (PTRS_PER_PTE - 1); - - /* do we have a pgd base and length set ? */ - /* The p0br and p1br should be setup at process initialisation. */ - if (pmd_none(*pmd)) { - printk("Got pmd_none\n"); - return NULL; - } - - /* do we need to allocate another page(s) */ - - - /* this is already inside the page table region, and allocated */ - /* return the virtual address of the pte. (base registers for p0 and p1 */ - /* refer to virtual addresses in S0 space) so no _va() is needed */ - if (pte_number < (pgdptr->lr)) { - return (pte_t *) (pgdptr->br + pte_number*BYTES_PER_PTE_T); - } - - /* The address lies outside the current page table - by how much?*/ - /* FIXME: Maximum task size, defined by max p0 pagetable size */ - - /* number of pages to allocate */ - t2 = ((pte_number - pgdptr->lr) >> SIZEOF_PTE_LOG2) + 1 ; - - while (t2--) { - /* grab a page off the quicklist */ - page = get_pte_fast(); - /* or allocate a new one if none left */ - if (!page) page = get_pte_slow(pmd, address); - - /* run out of pages - out of memory */ - /* FIXME: is there anything else we need to do to signal failure?*/ - if (!page) { - printk("%s:%d: run out of free pages building page table at pte %08lx.\n", __FILE__, __LINE__, pgdptr->lr); - return NULL; - } - /* map this page into the S0 page table at the right point */ - remap_and_clear_pte_page((pgd_t *)pmd, page, pte_page); - - /* add this page of PTEs to the length register */ - /* FIXME: handle reverse P1 region... */ - pgdptr->lr += PTRS_PER_PTE; - } - return (pte_t *)( pgdptr->br + pte_number*BYTES_PER_PTE_T); -#endif /* if 0 */ -} - +extern pte_t *pte_alloc_kernel(pmd_t *pmd, unsigned long address); +extern pte_t *pte_alloc(pmd_t *pmd, unsigned long address); /* * allocating and freeing a pmd is trivial: the 1-entry pmd is |
From: Andy P. <at...@us...> - 2001-06-26 19:01:15
|
Update of /cvsroot/linux-vax/kernel-2.4/include/asm-vax In directory usw-pr-cvs1:/tmp/cvs-serv19188 Modified Files: mv.h ka43.h scb.h Log Message: machine check implementation Index: mv.h =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/include/asm-vax/mv.h,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- mv.h 2001/01/17 16:18:52 1.1 +++ mv.h 2001/06/26 19:01:11 1.2 @@ -30,6 +30,8 @@ void (*reboot)(void); /* If implemented, these are called from */ void (*halt)(void); /* machine_restart/_halt */ + + void (*mcheck)(void *); /* machine check handler */ void (*init_devices)(void); /* Optional */ @@ -51,8 +53,9 @@ #define MV_CONSOLE_INIT 24 #define MV_REBOOT 28 #define MV_HALT 32 -#define MV_INIT_DEVICES 36 -#define MV_CPU_TYPE_STR 40 +#define MV_MCHECK 36 +#define MV_INIT_DEVICES 40 +#define MV_CPU_TYPE_STR 44 #ifndef __ASSEMBLY__ Index: ka43.h =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/include/asm-vax/ka43.h,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- ka43.h 2001/03/04 23:53:25 1.2 +++ ka43.h 2001/06/26 19:01:11 1.3 @@ -5,6 +5,8 @@ * * Taken from NetBSD * + * atp. jun 01 machine check stuff lifted from NetBSD. Thanks ragge!. + * */ #ifndef __VAX_KA43_H @@ -114,6 +116,45 @@ unsigned short pad7; unsigned short diagtme; /* Diagnostic time register */ }; + +struct ka43_mcframe { /* Format of KA43 machine check frame: */ + int mc43_bcnt; /* byte count, always 24 (0x18) */ + int mc43_code; /* machine check type code and restart bit */ + int mc43_addr; /* most recent (faulting?) virtual address */ + int mc43_viba; /* contents of VIBA register */ + int mc43_sisr; /* ICCS bit 6 and SISR bits 15:0 */ + int mc43_istate; /* internal state */ + int mc43_sc; /* shift count register */ + int mc43_pc; /* trapped PC */ + int mc43_psl; /* trapped PSL */ +}; + +#define KA43_MC_RESTART 0x00008000 /* Restart possible*/ +#define KA43_PSL_FPDONE 0x00010000 /* First Part Done */ + +static char *ka43_mctype[] = { + "no error (0)", /* Code 0: No error */ + "FPA: protocol error", /* Code 1-5: FPA errors */ + "FPA: illegal opcode", + "FPA: operand parity error", + "FPA: unknown status", + "FPA: result parity error", + "unused (6)", /* Code 6-7: Unused */ + "unused (7)", + "MMU error (TLB miss)", /* Code 8-9: MMU errors */ + "MMU error (TLB hit)", + "HW interrupt at unused IPL", /* Code 10: Interrupt error */ + "MOVCx impossible state", /* Code 11-13: Microcode errors */ + "undefined trap code (i-box)", + "undefined control store address", + "unused (14)", /* Code 14-15: Unused */ + "unused (15)", + "PC tag or data parity error", /* Code 16: Cache error */ + "data bus parity error", /* Code 17: Read error */ + "data bus error (NXM)", /* Code 18: Write error */ + "undefined data bus state", /* Code 19: Bus error */ +}; +#define MC43_MAX 19 #endif /* __ASSEMBLY */ Index: scb.h =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/include/asm-vax/scb.h,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- scb.h 2001/01/17 16:18:52 1.1 +++ scb.h 2001/06/26 19:01:11 1.2 @@ -74,6 +74,7 @@ #define SCB_CHMU 0x13 #define SCB_BUSERR1 0x14 #define SCB_BUSERR2 0x15 +#define SCB_MEMCORR 0x15 /* corrected read memory handler */ #define SCB_BUSERR3 0x16 #define SCB_BUSERR4 0x17 #define SCB_BUSERR5 0x18 |
From: Andy P. <at...@us...> - 2001-06-26 18:59:03
|
Update of /cvsroot/linux-vax/kernel-2.4/arch/vax/mm In directory usw-pr-cvs1:/tmp/cvs-serv18447/mm Modified Files: Makefile fault.c init.c Log Message: machine check fixes. separate pgalloc.h routines into arch/vax/mm/pgalloc.c Index: Makefile =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/arch/vax/mm/Makefile,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- Makefile 2001/03/04 23:44:43 1.3 +++ Makefile 2001/06/26 18:59:00 1.4 @@ -12,7 +12,7 @@ all: mm.o O_TARGET := mm.o -obj-y := init.o pgtable.o ioremap.o extable.o fault.o +obj-y := init.o pgtable.o pgalloc.o ioremap.o extable.o fault.o OX_OBJS := MX_OBJS := Index: fault.c =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/arch/vax/mm/fault.c,v retrieving revision 1.5 retrieving revision 1.6 diff -u -r1.5 -r1.6 --- fault.c 2001/05/20 13:25:11 1.5 +++ fault.c 2001/06/26 18:59:00 1.6 @@ -45,6 +45,7 @@ #define REASON_PPTEREF (1<<1) #define REASON_WRITE (1<<2) +#undef VAX_MM_DEBUG static void do_page_fault(struct accvio_info *info, struct pt_regs *regs) @@ -56,7 +57,9 @@ struct mm_struct *mm = NULL; unsigned fixup; +#if VAX_MM_DEBUG printk("mmfault: fault at %8X\n", address); +#endif /* This check, and the mm != NULL checks later, will be removed later, once we actually have a 'current' properly defined */ if (tsk != NULL) { @@ -215,7 +218,9 @@ if (!active) { /* active = 1;*/ do_page_fault(info, regs); +#if VAX_MM_DEBUG printk("finished fault\n"); +#endif active = 0; } else { Index: init.c =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/arch/vax/mm/init.c,v retrieving revision 1.13 retrieving revision 1.14 diff -u -r1.13 -r1.14 --- init.c 2001/06/16 19:41:44 1.13 +++ init.c 2001/06/26 18:59:00 1.14 @@ -14,6 +14,8 @@ #include <asm/pgalloc.h> #include <asm/rpb.h> +#undef VAX_INIT_DEBUG + static unsigned long totalram_pages; unsigned long max_pfn; /* number of 4k pfns */ @@ -148,9 +150,10 @@ S0pte = pte_offset(sys_pgd, page_physical_address); /* S0pte = (pte_t *)((__pa(page) >> PAGELET_SHIFT)+sys_pgd->br);*/ - - printk("remap: virt addr %p, pteval %8lX , S0pte %p, %8lX\n", page, pte_val(*page), S0pte, pte_val(*S0pte)); +#if VAX_INIT_DEBUG + printk("remap: virt addr %p, pteval %8lX , S0pte %p, %8lX\n", page, pte_val(*page), S0pte, pte_val(*S0pte)); +#endif if (!pte_present(*S0pte)) { unsigned long phy_addr; |
From: Andy P. <at...@us...> - 2001-06-26 18:59:03
|
Update of /cvsroot/linux-vax/kernel-2.4/arch/vax/kernel In directory usw-pr-cvs1:/tmp/cvs-serv18447/kernel Modified Files: cpu_generic.c cpu_ka410.c cpu_ka42.c cpu_ka43.c cpu_ka46.c cpu_ka55.c cpu_ka630.c cpu_ka640.c cpu_ka650.c cpu_ka660.c entry.S interrupt.c interrupt.h reboot.c setup.c Log Message: machine check fixes. separate pgalloc.h routines into arch/vax/mm/pgalloc.c Index: cpu_generic.c =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/arch/vax/kernel/cpu_generic.c,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- cpu_generic.c 2001/01/17 16:13:57 1.1 +++ cpu_generic.c 2001/06/26 18:59:00 1.2 @@ -11,6 +11,19 @@ * Stuff that is specific to a given CPU can be found in cpu_XXX.c */ +/* + * Generic reboot and halt functions are in reboot.c + * CPUs that need to do special stuff in their halt and reboot functions + * should point to their own functions in their machine vector, + * otherwise they can leave NULL in the machine vector slots for these + * functions + * + * atp. This holds for machine check functions too. Leave a NULL if you + * just want a halt instruction on receipt of a machine check. + * See VARM Chapter 5 for details on machine check frames. + */ + + #include <asm/dz11.h> #include <asm/io.h> /* For ioremap() */ #include <asm/mtpr.h> @@ -71,6 +84,7 @@ : "r2" ); } + int ka46_48_49_prom_getchar(void) { /* Not yet implemented */ @@ -102,6 +116,7 @@ only be used after VM is enabled and the DZ11 registers have been mapped by map_dz11_regs(). */ + /* This gets set to non-NULL once the I/O page has been mapped */ volatile struct dz11_regs *dz11_addr = NULL; @@ -109,6 +124,7 @@ console. Normally it is line 3 */ static unsigned int dz11_line; + /* stuff a char out of a DZ11-compatible serial chip */ void dz11_putchar(int c) { @@ -148,6 +164,7 @@ while ( ((txcs = dz11_addr->csr ) & DZ11_CSR_TRDY) == 0) ; } + int dz11_getchar(void) { /* Not yet implemented */ @@ -164,11 +181,5 @@ dz11_addr = ioremap(dz11_phys_addr, sizeof(*dz11_addr)); } - -/* - * Generic reboot and halt functions. CPUs that need to do special stuff - * here should point to their own functions in their machine vector, - * otherwise they can leave NULL in the machine vector slots for these - * functions - */ + Index: cpu_ka410.c =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/arch/vax/kernel/cpu_ka410.c,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- cpu_ka410.c 2001/01/17 16:13:57 1.1 +++ cpu_ka410.c 2001/06/26 18:59:00 1.2 @@ -38,6 +38,8 @@ NULL, /* reboot */ NULL, /* halt */ + + NULL, /* mcheck - machine check */ NULL, /* init_devices */ Index: cpu_ka42.c =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/arch/vax/kernel/cpu_ka42.c,v retrieving revision 1.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- cpu_ka42.c 2001/02/22 22:36:42 1.4 +++ cpu_ka42.c 2001/06/26 18:59:00 1.5 @@ -43,6 +43,7 @@ NULL, /* reboot */ NULL, /* halt */ + NULL, /* mcheck - machine check */ ka42_init_devices, /* init_devices */ Index: cpu_ka43.c =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/arch/vax/kernel/cpu_ka43.c,v retrieving revision 1.5 retrieving revision 1.6 diff -u -r1.5 -r1.6 --- cpu_ka43.c 2001/03/04 23:50:30 1.5 +++ cpu_ka43.c 2001/06/26 18:59:00 1.6 @@ -9,6 +9,7 @@ * 2000/04/01 Mattias Nordlund * Fixed the cache initializing, added the functions * ka43_cache_disbale/enable/clear and moved some stuff around. + * atp jun 2001 - machine check implementation */ #include <linux/types.h> /* For NULL */ @@ -28,6 +29,7 @@ void ka43_cache_disable(volatile unsigned int *creg_addr); void ka43_cache_clear(volatile unsigned int *ctag_addr); void ka43_cache_enable(volatile unsigned int *creg_addr); +void ka43_mcheck(void *stkframe); void ka43_init_devices(void); @@ -35,6 +37,14 @@ /* Internal CPU register space */ static volatile struct ka43_cpu_regs *cpu_regs; +/* We keep the cache page remaps handy incase we want to reset the cache + - see the machine check etc.. + - perhaps we should bung this in the mv too. + atp jun 01 + */ +static volatile unsigned int *ka43_ctag_addr; +static volatile unsigned int *ka43_creg_addr; + struct ka43_machine_vector { struct vax_mv mv; @@ -56,7 +66,8 @@ NULL, /* reboot */ NULL, /* halt */ - + ka43_mcheck, /* mcheck - machine check */ + ka43_init_devices, ka43_cpu_type_str @@ -73,18 +84,16 @@ mv_ka43.sidex = *(unsigned int *)RIGEL_SIDEX_ADDR; } +/* dont call ka43_cache_reset before this function (unlikely) */ void ka43_post_vm_init(void) { - volatile unsigned int *ctag_addr; - volatile unsigned int *creg_addr; - init_dz11_console(0x200A0000, 3); dz_serial_console_init(0, 0); cpu_regs = ioremap(KA43_CPU_BASE, KA43_CPU_SIZE); - creg_addr = ioremap(KA43_CH2_CREG, 1); - ctag_addr = ioremap(KA43_CT2_BASE, KA43_CT2_SIZE); + ka43_creg_addr = ioremap(KA43_CH2_CREG, 1); + ka43_ctag_addr = ioremap(KA43_CT2_BASE, KA43_CT2_SIZE); /* Disable parity on DMA and CPU memory accesses. Don't know what the story is with this, but VMS seems do this too... */ @@ -93,13 +102,10 @@ /* * Resetting the cache involves disabling it, then clear it and enable again. */ - ka43_cache_disable(creg_addr); - ka43_cache_clear(ctag_addr); - ka43_cache_enable(creg_addr); - - /* Don't need these mappings any more */ - iounmap((void *)ctag_addr); - iounmap((void *)creg_addr); + ka43_cache_disable(ka43_creg_addr); + ka43_cache_clear(ka43_ctag_addr); + ka43_cache_enable(ka43_creg_addr); + } void ka43_cache_disable(volatile unsigned int *creg_addr) @@ -148,6 +154,16 @@ } } +void ka43_cache_reset(void) +{ + /* + * Resetting the cache involves disabling it, then clear it and enable again. + */ + ka43_cache_disable(ka43_creg_addr); + ka43_cache_clear(ka43_ctag_addr); + ka43_cache_enable(ka43_creg_addr); +} + void ka43_init_devices(void) { #ifdef CONFIG_VSBUS @@ -161,4 +177,29 @@ return "KA43"; } +/* if this seems very similar to the netbsd implementation, then + * it is. After all how many ways can you check a sequence of flags? + */ +void ka43_mcheck(void *stkframe) +{ + /* map the frame to the stack */ + struct ka43_mcframe *ka43frame = (struct ka43_mcframe *)stkframe; + + /* tell us all about it */ + printk("KA43: machine check %d (0x%x)\n", ka43frame->mc43_code, ka43frame->mc43_code); + printk("KA43: reason: %s\n", ka43_mctype[ka43frame->mc43_code & 0xff]); + + /* fixme check restart and first part done flags */ + + if ((ka43frame->mc43_code & KA43_MC_RESTART) || + (ka43frame->mc43_psl & KA43_PSL_FPDONE)) { + printk("ka43_mchk: recovering from machine-check.\n"); + ka43_cache_reset(); /* reset caches */ + return; /* go on; */ + } + + /* Unknown error state, panic/halt the machine */ + printk("KA43: Machine Check - unknown error state - halting\n"); + machine_halt(); +} Index: cpu_ka46.c =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/arch/vax/kernel/cpu_ka46.c,v retrieving revision 1.5 retrieving revision 1.6 diff -u -r1.5 -r1.6 --- cpu_ka46.c 2001/02/22 22:36:42 1.5 +++ cpu_ka46.c 2001/06/26 18:59:00 1.6 @@ -48,7 +48,8 @@ NULL, /* reboot */ NULL, /* halt */ - + NULL, /* mcheck - machine check */ + ka46_init_devices, /* init_devices */ ka46_cpu_type_str Index: cpu_ka55.c =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/arch/vax/kernel/cpu_ka55.c,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- cpu_ka55.c 2001/02/11 23:47:25 1.3 +++ cpu_ka55.c 2001/06/26 18:59:00 1.4 @@ -46,7 +46,8 @@ NULL, /* halt */ NULL, /* init_devices */ - + NULL, /* mcheck - machine check */ + ka55_cpu_type_str }, 0 /* System ID Extension from ROM */ Index: cpu_ka630.c =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/arch/vax/kernel/cpu_ka630.c,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- cpu_ka630.c 2001/01/17 16:13:57 1.1 +++ cpu_ka630.c 2001/06/26 18:59:00 1.2 @@ -39,7 +39,8 @@ NULL, /* reboot */ NULL, /* halt */ - + NULL, /* mcheck - machine check */ + NULL, /* init_devices */ ka630_cpu_type_str Index: cpu_ka640.c =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/arch/vax/kernel/cpu_ka640.c,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- cpu_ka640.c 2001/01/17 16:13:57 1.1 +++ cpu_ka640.c 2001/06/26 18:59:00 1.2 @@ -40,7 +40,8 @@ NULL, /* reboot */ NULL, /* halt */ - + NULL, /* mcheck - machine check */ + NULL, /* init_devices */ ka640_cpu_type_str Index: cpu_ka650.c =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/arch/vax/kernel/cpu_ka650.c,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- cpu_ka650.c 2001/01/17 16:13:57 1.1 +++ cpu_ka650.c 2001/06/26 18:59:00 1.2 @@ -40,7 +40,8 @@ NULL, /* reboot */ NULL, /* halt */ - + NULL, /* mcheck - machine check */ + NULL, /* init_devices */ ka650_cpu_type_str Index: cpu_ka660.c =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/arch/vax/kernel/cpu_ka660.c,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- cpu_ka660.c 2001/01/17 16:13:57 1.1 +++ cpu_ka660.c 2001/06/26 18:59:00 1.2 @@ -44,7 +44,8 @@ NULL, /* reboot */ NULL, /* halt */ - + NULL, /* mcheck - machine check */ + NULL, /* init_devices */ ka660_cpu_type_str Index: entry.S =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/arch/vax/kernel/entry.S,v retrieving revision 1.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- entry.S 2001/05/27 12:34:13 1.4 +++ entry.S 2001/06/26 18:59:00 1.5 @@ -5,6 +5,7 @@ Copyright Dec 1998 atp. Copyright 2000, Kenn Humborg <ke...@li...> + 2001 atp. Additions for Machine check handling. */ #include <linux/sys.h> @@ -12,7 +13,7 @@ /* irqvec_handler is the generic handler for all interrupts and exceptions for which a driver (or other code) has registered - a handler. We are responsible for + a handler. Except machine checks. We are responsible for o saving all registers @@ -28,6 +29,7 @@ See Documentation/vax/interrupts.txt for the gory details */ + .globl irqvec_handler irqvec_handler: /* At this point stack looks like: @@ -218,6 +220,34 @@ popr $0x3fff /* restore R0 to FP */ moval 4(sp), sp /* Remove handler_PC */ rei + +/* mcheck_handler is the handler for machine check exceptions. + This is here, because its easier to special case it, and deal with + the machine dependent number of longwords than warp the generic + registration methods to deal with it + atp jun 2001 + */ +/* ensure longword alignment */ +.align 2 +.globl machine_check_handler +machine_check_handler: +/* Note this doesnt use the usual exception registration, as we dont + * know in advance how many longwords of exception info have been pushed. + * + * The interrupt stack at this point looks like this + * SP: longword count of exception info + * exception longwords + * : + * PC + * PSL + */ + pushr $0x3f /* push all registers in case we can restart */ + pushab 24(sp) /* address of stack slot which holds byte count */ + calls $1, machine_check /* in reboot.c */ + popr $0x3f /* spring them off */ + addl2 (sp)+,sp /* get rid of the machine check frame */ + + rei /* dismiss */ .data .globl sys_call_table Index: interrupt.c =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/arch/vax/kernel/interrupt.c,v retrieving revision 1.11 retrieving revision 1.12 diff -u -r1.11 -r1.12 --- interrupt.c 2001/05/27 13:25:29 1.11 +++ interrupt.c 2001/06/26 18:59:00 1.12 @@ -94,17 +94,27 @@ SCB_VECTOR(i) = &stray_handlers[i].inst_jsb; } + flush_icache(); } void trap_init(void) { - /* Initialize the SCB with the stray interrupt/exception + extern void machine_check_handler(void); + void *mhandler; + + /* Initialize the SCB with the stray interrupt/exception handlers. Some of these will be overridden later as device drivers hook up to their interrupts. */ setup_scb(); + /* Install the specific machine check handler in entry.S + * bits 0-1 must contain 1. machine check handler is longword aligned + */ + mhandler = (void *)(machine_check_handler) + 1; + scb.scb.mcheck = mhandler; + /* And tell the hardware to use this SCB */ __mtpr(__pa(&scb), PR_SCBB); @@ -137,10 +147,11 @@ } /* Perhaps this should be done in CPU-specific code? */ - if (register_excep_handler(0x15, corrected_read_handler, 0, 0)) { + if (register_excep_handler(SCB_MEMCORR, corrected_read_handler, 0, 0)) { printk("Panic: unable to register corrected read handler\n"); machine_halt(); } + } void init_IRQ(void) Index: interrupt.h =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/arch/vax/kernel/interrupt.h,v retrieving revision 1.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- interrupt.h 2001/01/29 00:56:19 1.4 +++ interrupt.h 2001/06/26 18:59:00 1.5 @@ -65,4 +65,3 @@ extern void reserved_instr_handler(struct pt_regs *regs, void *excep_info); extern void corrected_read_handler(struct pt_regs *regs, void *excep_info); extern void syscall_handler(struct pt_regs *regs, void *excep_info); - Index: reboot.c =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/arch/vax/kernel/reboot.c,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- reboot.c 2001/01/17 16:13:57 1.1 +++ reboot.c 2001/06/26 18:59:00 1.2 @@ -3,7 +3,9 @@ This file contains the standard functions that the arch-independent kernel expects for halting, rebooting and powering off the machine. - + + It also contains the machine check dispatcher + The real work will be done by cpu-specific code via the machine vector. Eventually... @@ -49,6 +51,20 @@ mv->halt(); while (1); +} + +/* This is called directly, from entry.S + * It checks for a cpu specific machine check handler and hands over to it. + * Otherwise it will just halt, as there is no way to recover without a + * sensible cpu specific routine + */ +void machine_check(void *stkframe) +{ + if (mv->mcheck == NULL) { + printk("machine check - CPU specific handler not implemented - halting\n"); + machine_halt(); + } + mv->mcheck(stkframe); } Index: setup.c =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/arch/vax/kernel/setup.c,v retrieving revision 1.8 retrieving revision 1.9 diff -u -r1.8 -r1.9 --- setup.c 2001/06/08 20:11:10 1.8 +++ setup.c 2001/06/26 18:59:00 1.9 @@ -65,7 +65,7 @@ * atp -- have a temporary one. * Shouldn't we use strcpy here? */ - memcpy(command_line, "root=/dev/nfs nfsroot=/tftpboot/vaxroot\0",54); + memcpy(command_line, "root=/dev/nfs nfsroot=/tftpboot/vaxroot rw debug\0",63); *cmdline_p = command_line; /* Save unparsed command line copy for /proc/cmdline */ memcpy(saved_command_line, command_line, COMMAND_LINE_SIZE); |
From: Andy P. <at...@us...> - 2001-06-26 18:59:03
|
Update of /cvsroot/linux-vax/kernel-2.4/arch/vax/boot In directory usw-pr-cvs1:/tmp/cvs-serv18447/boot Modified Files: mmstart.S Log Message: machine check fixes. separate pgalloc.h routines into arch/vax/mm/pgalloc.c Index: mmstart.S =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/arch/vax/boot/mmstart.S,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- mmstart.S 2001/01/17 16:13:57 1.1 +++ mmstart.S 2001/06/26 18:59:00 1.2 @@ -68,6 +68,7 @@ mtpr $PAGE_OFFSET, $PR_P0BR # Clear out P0BR, P0LR - do not mtpr $0, $PR_P0LR # need them anymore + mtpr $0, $PR_TBIA # clear tlb after touching BRs. ret .globl PK_str1 |
From: Andy P. <at...@us...> - 2001-06-24 19:56:01
|
Update of /cvsroot/linux-vax/www/htdocs In directory usw-pr-cvs1:/tmp/cvs-serv6098 Modified Files: index.html Log Message: mopd notice Index: index.html =================================================================== RCS file: /cvsroot/linux-vax/www/htdocs/index.html,v retrieving revision 1.15 retrieving revision 1.16 diff -u -r1.15 -r1.16 --- index.html 2001/06/16 12:11:02 1.15 +++ index.html 2001/06/24 19:55:58 1.16 @@ -43,6 +43,15 @@ <!-- News entry boundary --> <TR VALIGN=TOP NOSAVE> +<TD>24 Jun 2001</TD> + +<TD NOSAVE> +Mopd, uLibc and busybox now in CVS. +<P> +</td> +<!-- News entry boundary --> + +<TR VALIGN=TOP NOSAVE> <TD>16 JUNE 2001</TD> <TD NOSAVE> |
From: Andy P. <at...@us...> - 2001-06-24 19:35:05
|
Update of /cvsroot/linux-vax/kernel-2.4/arch/vax In directory usw-pr-cvs1:/tmp/cvs-serv2641 Modified Files: Makefile Log Message: Fix to machine vector overwrite bug. Index: Makefile =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/arch/vax/Makefile,v retrieving revision 1.7 retrieving revision 1.8 diff -u -r1.7 -r1.8 --- Makefile 2001/02/21 00:16:56 1.7 +++ Makefile 2001/06/24 19:34:56 1.8 @@ -63,6 +63,9 @@ dd if=/dev/zero of=header.bin bs=512 count=1 mv -f header.bin vmlinux.SYS cat vmlinux.bin >> vmlinux.SYS +# this is helpful for low level debuggery +# rm -f vmlinux.lst +# $(OBJDUMP) -D vmlinux > vmlinux.lst # This target will only re-compile stuff that's changed in arch/vax mopbootx: linkonly @@ -118,6 +121,7 @@ fastdep: archclean: + rm -f vmlinux.* vmlinux cd $(TOPDIR)/arch/vax ; rm -f *.out TEST.BIN TEST.SYS header.bin archmrproper: |
From: Andy P. <at...@us...> - 2001-06-24 19:35:04
|
Update of /cvsroot/linux-vax/kernel-2.4/arch/vax/boot In directory usw-pr-cvs1:/tmp/cvs-serv2641/boot Modified Files: head.S Log Message: Fix to machine vector overwrite bug. Index: head.S =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/arch/vax/boot/head.S,v retrieving revision 1.9 retrieving revision 1.10 diff -u -r1.9 -r1.10 --- head.S 2001/06/10 10:35:27 1.9 +++ head.S 2001/06/24 19:34:56 1.10 @@ -27,7 +27,6 @@ movl r11, boot_r11 mfpr $PR_SCBB, boot_scb - jsb identify_cpu # now fix up the machine vector entries. (They currently contain @@ -35,10 +34,9 @@ # the pointers to the functions we use before VM init to point # into the newly-loaded kernel image.) movl mv, r2 - moval start, r3 - subl2 $PAGE_OFFSET+KERNEL_START_PHYS, r3 + subl2 $PAGE_OFFSET+KERNEL_START_PHYS, r3 addl2 r3, MV_PRE_VM_PUTCHAR(r2) addl2 r3, MV_PRE_VM_GETCHAR(r2) addl2 r3, MV_CPU_TYPE_STR(r2) @@ -47,9 +45,9 @@ subl2 $PAGE_OFFSET, MV_PRE_VM_INIT(r2) # print the cpu type - jsb crlf + jsb crlf movab msg_cpu_type, r10 - jsb printstr + jsb printstr movl mv, r10 calls $0, *MV_CPU_TYPE_STR(r10) @@ -80,6 +78,15 @@ jsb printint jsb crlf +# Save off the current machine vector address in boot_mv, because it +# lies in the .bss section and it will get clobbered real soon... +# - atp. in fact it gets clobbered real quick, if your kernel is +# larger than about 950k, as the relocation code clobbers it, along +# with every thing else poking its head above $KERNEL_START_PHYS, +# like the entire .bss section. + + movl mv, boot_mv + # copy the loaded image higher up in physical RAM #chunks of 65535B data are moved top-to-bottom while #inside one chunk the data is moved bottom-to-top. @@ -108,10 +115,6 @@ movc3 r6,(r1),(r3) copy_done: -# Save off the current machine vector address in R11, because it -# lies in the .bss section and it will get clobbered real soon... - - movl mv, r11 # # Next we have to fill the .bss section will zeros. We do it now # instead of when we are preparing the loadable image because it @@ -154,9 +157,9 @@ # made it, note that sp is still down there # halt -# fix up the machine vector pointer (by restoring it from R11 and +# fix up the machine vector pointer (by restoring it from boot_mv and # adding in the distance that the kernel was re-located) - addl3 r2, r11, mv + addl3 r2, boot_mv, mv movl mv, r3 #and the pre-vm i/o functions @@ -359,6 +362,11 @@ boot_r11: .int 0x00000000 .globl boot_scb boot_scb: .int 0x00000000 +# +# This is here because we need a safe place to store it as we +# relocate around in memory. It may be handy later. +.globl boot_mv +boot_mv: .int 0x00000000 cpu_type: .int 0x00000000 prom_sidex: .int 0x00000000 |
From: Dave A. <ai...@us...> - 2001-06-17 12:39:22
|
Update of /cvsroot/linux-vax/kernel-2.4/include/asm-vax/mm In directory usw-pr-cvs1:/tmp/cvs-serv21038 Modified Files: pgalloc.h Log Message: DA: free the vmalloc'ed area for the pgd, fix free_pte_slow to just clear the pte.. Index: pgalloc.h =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/include/asm-vax/mm/pgalloc.h,v retrieving revision 1.6 retrieving revision 1.7 diff -u -r1.6 -r1.7 --- pgalloc.h 2001/06/16 16:58:45 1.6 +++ pgalloc.h 2001/06/17 12:39:19 1.7 @@ -126,6 +126,7 @@ extern __inline__ void free_pgd_slow(pgd_t *pgd) { + vfree((void *)pgd[0].br); free_page((unsigned long)pgd); } @@ -153,9 +154,11 @@ pgtable_cache_size++; } +/* we don't allocate any space for pte, just clear the one passed to us */ extern __inline__ void free_pte_slow(pte_t *pte) { - free_page((unsigned long)pte); + pte_clear(pte); +/* free_page((unsigned long)pte);*/ } #define pte_free_kernel(pte) free_pte_slow(pte) |
From: Dave A. <ai...@us...> - 2001-06-17 12:34:08
|
Update of /cvsroot/linux-vax/kernel-2.4/include/asm-vax/mm In directory usw-pr-cvs1:/tmp/cvs-serv20152/include/asm-vax/mm Modified Files: pagelet_pmd.h Log Message: DA: remove clear from pmd_clear .. make it a nop... reasons given in comment Index: pagelet_pmd.h =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/include/asm-vax/mm/pagelet_pmd.h,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- pagelet_pmd.h 2001/02/15 01:17:23 1.1 +++ pagelet_pmd.h 2001/06/17 12:34:05 1.2 @@ -40,9 +40,14 @@ extern inline int pmd_bad(pmd_t pmd) { return (pmd_val(pmd) == 0); } extern inline int pmd_present(pmd_t pmd) { return (pmd_val(pmd) != 0); } /* This is just zeroing out the base and length registers */ +/* FIXME: or validate code - I removed the zero'ing of the pmd, + pmd are parts of pgds, and if we clear the br/lr of the P0 pmd, + the zeroth member of pgd, we lose the vmalloc address so can't + do vfree. - D.A. June 2001 +*/ extern inline void pmd_clear(pmd_t * pmdp) { - pmd_val(pmdp[0]) = 0; - pmd_val(pmdp[1]) = 0; + /* pmd_val(pmdp[0]) = 0; + pmd_val(pmdp[1]) = 0;*/ } |
From: Dave A. <ai...@us...> - 2001-06-17 11:43:49
|
Update of /cvsroot/linux-vax/kernel-2.4/drivers/net In directory usw-pr-cvs1:/tmp/cvs-serv6885/drivers/net Modified Files: vaxlance.c Log Message: DA: added autoprobe support for vsbus to dz/vaxlance.. needs a lot of testing on machines that aren't mine Index: vaxlance.c =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/drivers/net/vaxlance.c,v retrieving revision 1.11 retrieving revision 1.12 diff -u -r1.11 -r1.12 --- vaxlance.c 2001/06/16 14:05:30 1.11 +++ vaxlance.c 2001/06/17 11:43:45 1.12 @@ -997,6 +997,8 @@ /* prom checks */ #if 0 /* If this is dead code, let's remove it... - KPH 2001-03-04 */ + /* not sure if its dead it might just not work on the VAX I have + does anyone know if VAX store test pattern in EEPROM */ /* First, check for test pattern */ if (esar[0x60] != 0xff && esar[0x64] != 0x00 && esar[0x68] != 0x55 && esar[0x6c] != 0xaa) { @@ -1029,17 +1031,38 @@ /* Don't need this any more */ iounmap(esar); - lp->vsbus_int=5; + // lp->vsbus_int=5; +#ifdef CONFIG_VSBUS + { + int num, irq; + autoirq_setup(0); + vsbus_probe_irq_on(); + writereg(&ll->rap, LE_CSR0); + writereg(&ll->rdp, LE_C0_INEA|LE_C0_INIT); + writecsr0(ll, LE_C0_INEA|LE_C0_INIT); + udelay(1000); + num=vsbus_probe_irq_report(); + irq=autoirq_report(0); + if (num) + lp->vsbus_int=num; + } +#endif #ifdef VAX_LANCE_AUTOPROBE_IRQ printk("Autoprobing LANCE interrupt vector..."); - vsbus_enable_int(lp->vsbus_int); - autoirq_setup(0); + autoirq_setup(0); + vsbus_enable_int(lp->vsbus_int); lance_stop(ll); + writereg(&ll->rap, LE_CSR0); + writereg(&ll->rdp, LE_C0_INEA|LE_C0_INIT); +#ifdef CONFIG_VSBUS + /*lp->vsbus_int=vsbus_probe_irq_report();*/ +#endif + /* Shouldn't we really load CSR1/2 with the address of a reasonable init block, just in case the LANCE goes and does something wild with whatever garbage it's currently @@ -1053,7 +1076,7 @@ vsbus_clear_int(lp->vsbus_int); if (dev->irq) - printk(" probed IRQ %d\n", dev->irq); + printk(" probed IRQ %d, vsbus %d\n", dev->irq, lp->vsbus_int); else { dev->irq=0x94; |
From: Dave A. <ai...@us...> - 2001-06-17 11:43:49
|
Update of /cvsroot/linux-vax/kernel-2.4/drivers/char In directory usw-pr-cvs1:/tmp/cvs-serv6885/drivers/char Modified Files: dz.c dz.h Log Message: DA: added autoprobe support for vsbus to dz/vaxlance.. needs a lot of testing on machines that aren't mine Index: dz.c =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/drivers/char/dz.c,v retrieving revision 1.5 retrieving revision 1.6 diff -u -r1.5 -r1.6 --- dz.c 2001/06/09 14:07:38 1.5 +++ dz.c 2001/06/17 11:43:44 1.6 @@ -66,6 +66,7 @@ #include <asm/irq.h> #ifdef CONFIG_VAX +#include <asm/vsa.h> #include <asm/dz11.h> volatile struct dz11_regs *dz11_addr; #else @@ -398,7 +399,7 @@ if (status & DZ_RDONE) receive_chars (info); /* the receive function */ - vsbus_clear_int(7); + vsbus_clear_int(dz_vsbus_rx_int); } @@ -413,7 +414,7 @@ if (status & DZ_TRDY) transmit_chars (info); - vsbus_clear_int(6); + vsbus_clear_int(dz_vsbus_tx_int); } #else @@ -526,8 +527,8 @@ dz_out (info, DZ_CSR, tmp); #ifdef CONFIG_VAX - vsbus_enable_int(6); - vsbus_enable_int(7); + vsbus_enable_int(dz_vsbus_rx_int); + vsbus_enable_int(dz_vsbus_tx_int); #endif info->xmit_cnt = info->xmit_head = info->xmit_tail = 0; @@ -1434,7 +1435,7 @@ if (! info->port) return 0; #ifdef CONFIG_VAX - printk("ttyS%d at 0x%04x (irq = %d, %d)\n", info->line, info->port, SERIAL_RX, SERIAL_TX); + printk("ttyS%d at 0x%04x\n", info->line, info->port); #else printk("ttyS%d at 0x%04x (irq = %d)\n", info->line, info->port, SERIAL); #endif @@ -1453,29 +1454,45 @@ is updated... in request_irq - to immediatedly obliterate it is unwise. */ restore_flags(flags); -#if 0 +#if CONFIG_VAX { short i; - - + unsigned char num; autoirq_setup(0); - vsbus_enable_int(6); + vsbus_probe_irq_on(); i = dz_in(info, DZ_TCR); dz_out(info, DZ_CSR, DZ_MSE|DZ_TIE); dz_out(info, DZ_TCR, 0); - udelay(100); + udelay(1000); dz_out(info, DZ_TCR, 1); udelay(10000); + dz_out(info, DZ_TCR, i); + num=vsbus_probe_irq_report(); + irq=autoirq_report(0); + if (num) + { + dz_vsbus_tx_int=num; + dz_vsbus_rx_int=num+1; + } + autoirq_setup(0); + + vsbus_enable_int(num); + + i = dz_in(info, DZ_TCR); + dz_out(info, DZ_CSR, DZ_MSE|DZ_TIE); + dz_out(info, DZ_TCR, 0); + udelay(1000); dz_out(info, DZ_TCR, 1); - vsbus_clear_int(6); - irq=autoirq_report(100); + udelay(10000); + dz_out(info, DZ_TCR, i); + vsbus_clear_int(num); + vsbus_disable_int(num); + irq=autoirq_report(100); } - printk("going for IRQ %d\n", irq); -#endif -#ifdef CONFIG_VAX - if (request_irq (SERIAL_TX, dz_interrupt_tx, SA_INTERRUPT, "DZ", lines[0])) + printk("dz.c: using irq rx %d, irq tx %d\n", irq-1, irq); + if (request_irq (irq, dz_interrupt_tx, SA_INTERRUPT, "DZ", lines[0])) panic ("Unable to register DZ interrupt\n"); - if (request_irq (SERIAL_RX, dz_interrupt_rx, SA_INTERRUPT, "DZ", lines[0])) + if (request_irq (irq-1, dz_interrupt_rx, SA_INTERRUPT, "DZ", lines[0])) panic ("Unable to register DZ interrupt\n"); #else if (request_irq (SERIAL, dz_interrupt_rx, SA_INTERRUPT, "DZ", lines[0])) Index: dz.h =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/drivers/char/dz.h,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- dz.h 2001/06/09 14:07:38 1.3 +++ dz.h 2001/06/17 11:43:44 1.4 @@ -192,6 +192,9 @@ static int serial_refcount; +#ifdef CONFIG_VAX +static unsigned char dz_vsbus_rx_int, dz_vsbus_tx_int; +#endif /* * tmp_buf is used as a temporary buffer by serial_write. We need to * lock it in case the copy_from_user blocks while swapping in a page, |
From: Dave A. <ai...@us...> - 2001-06-17 11:43:49
|
Update of /cvsroot/linux-vax/kernel-2.4/drivers/vsbus In directory usw-pr-cvs1:/tmp/cvs-serv6885/drivers/vsbus Modified Files: vsbus.c Log Message: DA: added autoprobe support for vsbus to dz/vaxlance.. needs a lot of testing on machines that aren't mine Index: vsbus.c =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/drivers/vsbus/vsbus.c,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- vsbus.c 2001/02/26 11:31:35 1.3 +++ vsbus.c 2001/06/17 11:43:45 1.4 @@ -8,6 +8,9 @@ */ #include <asm/vsa.h> #include <asm/io.h> +#include <linux/delay.h> +#include <linux/interrupt.h> +#include <linux/bitops.h> struct vsbus { struct vs_cpu *vs_cpu_ptr; @@ -17,10 +20,22 @@ int vsbus_setup(void) { + unsigned long irqs; + sys_vs.vs_cpu_ptr=(void *)ioremap(VSA_BASE_REGS, 128); - sys_vs.vs_cpu_ptr->vc_intclr=0xFF; + irqs=probe_irq_on(); + sys_vs.vs_cpu_ptr->vc_intmsk=0; + sys_vs.vs_cpu_ptr->vc_intclr=0xFF; + // printk("vsbus: Getting Interrupt Mask\n"); + udelay(100000); + sys_vs.vs_mask=sys_vs.vs_cpu_ptr->vc_intreq; + sys_vs.vs_cpu_ptr->vc_intmsk=0; /*~sys_vs.vs_mask;*/ + + probe_irq_off(irqs); + printk("vsbus: interrupt mask %x\n", sys_vs.vs_mask); + return 0; } @@ -38,7 +53,26 @@ return 0; } -int vsbus_probe_irq(void) +int vsbus_disable_int(int bit_nr) { + sys_vs.vs_cpu_ptr->vc_intmsk&=~(1<<bit_nr); return 0; +} + +int vsbus_probe_irq_on(void) +{ + printk("vsbus: probing set mask ~%2X\n", sys_vs.vs_mask); + sys_vs.vs_cpu_ptr->vc_intmsk = sys_vs.vs_mask; + sys_vs.vs_cpu_ptr->vc_intclr=0xff; + return 0; +} + +unsigned char vsbus_probe_irq_report(void) +{ + unsigned char x, y; + + x=sys_vs.vs_cpu_ptr->vc_intreq; + y = x & ~sys_vs.vs_mask; + printk("vsbus: probe returning %2X, %2X\n", x, ffs(y)); + return ffs(y)-1; } |
From: Dave A. <ai...@us...> - 2001-06-17 11:43:49
|
Update of /cvsroot/linux-vax/kernel-2.4/include/asm-vax In directory usw-pr-cvs1:/tmp/cvs-serv6885/include/asm-vax Modified Files: vsa.h Log Message: DA: added autoprobe support for vsbus to dz/vaxlance.. needs a lot of testing on machines that aren't mine Index: vsa.h =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/include/asm-vax/vsa.h,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- vsa.h 2001/02/22 22:20:31 1.3 +++ vsa.h 2001/06/17 11:43:45 1.4 @@ -8,16 +8,26 @@ struct vs_cpu { unsigned long vs_hltcod; unsigned long vc_410msr; - unsigned long vc_410cear; /* VS2K */ - unsigned char vc_intmsk; /* Interrupt mask register */ - unsigned char vc_vdcorg; /* Mono display origin */ - unsigned char vc_vdcsel; /* Video interrupt select */ - unsigned char vc_intreq; /* Interrupt request register */ + unsigned long vc_410cear; /* VS2K */ + unsigned char vc_intmsk; /* Interrupt mask register */ + unsigned char vc_vdcorg; /* Mono display origin */ + unsigned char vc_vdcsel; /* Video interrupt select */ + unsigned char vc_intreq; /* Interrupt request register */ #define vc_intclr vc_intreq + unsigned short vc_diagdsp; + unsigned short pad4; + unsigned long vc_parctl; +#define vc_bwf0 vc_parctl + unsigned short pad5; + unsigned short pad6; + unsigned short vc_diagtimu; + unsigned short vc_diagtme; +#define vc_diagtimm vc_diagtme }; extern int vsbus_setup(void); extern int vsbus_enable_int(int bit_nr); +extern int vsbus_disable_int(int bit_nr); extern int vsbus_clear_int(int bit_nr); extern int vsbus_probe_irq(void); |
From: Andy P. <at...@us...> - 2001-06-16 19:42:14
|
Update of /cvsroot/linux-vax/kernel-2.4/arch/vax In directory usw-pr-cvs1:/tmp/cvs-serv6505 Modified Files: config.in Log Message: CONFIG_DEBUG_MALLOC is dead Index: config.in =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/arch/vax/config.in,v retrieving revision 1.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- config.in 2001/02/22 22:15:07 1.4 +++ config.in 2001/06/16 19:42:11 1.5 @@ -163,7 +163,8 @@ mainmenu_option next_comment comment 'Kernel hacking' -bool 'Debug kmalloc/kfree' CONFIG_DEBUG_MALLOC +# This appears to have died. +#bool 'Debug kmalloc/kfree' CONFIG_DEBUG_MALLOC bool 'Magic SysRq key' CONFIG_MAGIC_SYSRQ bool 'Kernel profiling support' CONFIG_PROFILE if [ "$CONFIG_PROFILE" = "y" ]; then |
From: Andy P. <at...@us...> - 2001-06-16 19:41:47
|
Update of /cvsroot/linux-vax/kernel-2.4/arch/vax/mm In directory usw-pr-cvs1:/tmp/cvs-serv6297 Modified Files: init.c Log Message: added functions free_initrd_mem show_mem to get rid of link errors Index: init.c =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/arch/vax/mm/init.c,v retrieving revision 1.12 retrieving revision 1.13 diff -u -r1.12 -r1.13 --- init.c 2001/06/16 14:05:30 1.12 +++ init.c 2001/06/16 19:41:44 1.13 @@ -107,17 +107,6 @@ (&__init_end - &__init_begin) >> 10); } -void si_meminfo(struct sysinfo *val) -{ - val->totalram = totalram_pages; - val->sharedram = 0; - val->freeram = nr_free_pages(); - val->bufferram = atomic_read(&buffermem_pages); - val->totalhigh = 0; - val->freehigh = 0; - val->mem_unit = PAGE_SIZE; - return; -} /* page table stuff */ @@ -184,3 +173,59 @@ return; } +void +show_mem(void) +{ + long i,free = 0,total = 0,reserved = 0; + long shared = 0, cached = 0; + + printk("\nMem-info:\n"); + show_free_areas(); + printk("Free swap: %6dkB\n",nr_swap_pages<<(PAGE_SHIFT-10)); + i = max_mapnr; + while (i-- > 0) { + total++; + if (PageReserved(mem_map+i)) + reserved++; + else if (PageSwapCache(mem_map+i)) + cached++; + else if (!page_count(mem_map+i)) + free++; + else + shared += atomic_read(&mem_map[i].count) - 1; + } + printk("%ld pages of RAM\n",total); + printk("%ld free pages\n",free); + printk("%ld reserved pages\n",reserved); + printk("%ld pages shared\n",shared); + printk("%ld pages swap cached\n",cached); + printk("%ld pages in page table cache\n",pgtable_cache_size); + show_buffers(); +} + + +#ifdef CONFIG_BLK_DEV_INITRD +void free_initrd_mem(unsigned long start, unsigned long end) +{ + if (start < end) + printk ("Freeing initrd memory: %ldk freed\n", (end - start) >> 10); + for (; start < end; start += PAGE_SIZE) { + ClearPageReserved(virt_to_page(start)); + set_page_count(virt_to_page(start), 1); + free_page(start); + totalram_pages++; + } +} +#endif + +void si_meminfo(struct sysinfo *val) +{ + val->totalram = totalram_pages; + val->sharedram = 0; + val->freeram = nr_free_pages(); + val->bufferram = atomic_read(&buffermem_pages); + val->totalhigh = 0; + val->freehigh = 0; + val->mem_unit = PAGE_SIZE; + return; +} |
From: Dave A. <ai...@us...> - 2001-06-16 16:58:49
|
Update of /cvsroot/linux-vax/kernel-2.4/include/asm-vax/mm In directory usw-pr-cvs1:/tmp/cvs-serv16223/include/asm-vax/mm Modified Files: pgalloc.h Log Message: DA: back out my change to vmalloc unnecessary .. can just zero in pgalloc.h Index: pgalloc.h =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/include/asm-vax/mm/pgalloc.h,v retrieving revision 1.5 retrieving revision 1.6 diff -u -r1.5 -r1.6 --- pgalloc.h 2001/06/16 11:33:10 1.5 +++ pgalloc.h 2001/06/16 16:58:45 1.6 @@ -82,6 +82,13 @@ /* Allocate space for the p0/p1 page tables */ /* allocate 192 pages at 4096 bytes each for page tables? */ ret[0].br = (unsigned long)vmalloc(192 * PAGE_SIZE); + if (ret[0].br==0) + { + printk("page_tables:vmalloc failed to allocate a page directory\n"); + BUG(); + return NULL; + } + memset((void *)ret[0].br, 0, 192*PAGE_SIZE); ret[0].lr = ((160*PAGE_SIZE)>>SIZEOF_PTE_LOG2); /* the p1br needs to be set back from the end of the p1 ptes */ ret[1].br = (ret[0].br - 0x800000) + (192*PAGE_SIZE); |