Microblaze init port - Kernel

This is a discussion on Microblaze init port - Kernel ; Hello everybody, this is first set of patches with Microblaze Linux kernel port. I tried to clean coding style and repair code with sparse. I tried to split patches to the smallest parts as were possible. Please be patient with ...

+ Reply to Thread
Page 1 of 3 1 2 3 LastLast
Results 1 to 20 of 42

Thread: Microblaze init port

  1. Microblaze init port

    Hello everybody,

    this is first set of patches with Microblaze Linux kernel port.
    I tried to clean coding style and repair code with sparse.

    I tried to split patches to the smallest parts as were possible.
    Please be patient with incorrect division - it was a lot of patches.

    I personally feel the biggest pain in header files.

    There are no comments in set of patches because I had no energy
    write it. I suppose we will discuss more about individual patches.

    I create pages for this longer process at www.monstr.eu - wiki page.
    I will store all patches in my internal git tree till setup public
    git server. And on my pages will be published tarballs.

    Thanks to John Williams and Steve Neuendorffer for help
    with clarification of individual patches.

    Have a fun,
    Michal Simek
    www.monstr.eu
    --
    To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
    the body of a message to majordomo@vger.kernel.org
    More majordomo info at http://vger.kernel.org/majordomo-info.html
    Please read the FAQ at http://www.tux.org/lkml/

  2. [PATCH 20/52] [microblaze] heartbeat file

    From: Michal Simek


    Signed-off-by: Michal Simek
    ---
    arch/microblaze/kernel/heartbeat.c | 40 ++++++++++++++++++++++++++++++++++++
    1 files changed, 40 insertions(+), 0 deletions(-)
    create mode 100644 arch/microblaze/kernel/heartbeat.c

    diff --git a/arch/microblaze/kernel/heartbeat.c b/arch/microblaze/kernel/heartbeat.c
    new file mode 100644
    index 0000000..e29aa1f
    --- /dev/null
    +++ b/arch/microblaze/kernel/heartbeat.c
    @@ -0,0 +1,40 @@
    +/*
    + * arch/microblaze/kernel/heartbeat.c
    + *
    + * This file is subject to the terms and conditions of the GNU General Public
    + * License. See the file "COPYING" in the main directory of this archive
    + * for more details.
    + *
    + * Copyright (C) 2006 Atmark Techno, Inc.
    + */
    +
    +#include
    +#include
    +#include
    +#include
    +
    +void heartbeat(void)
    +{
    +#if 0
    + static unsigned int cnt, period, dist;
    +
    + if (cnt == 0 || cnt == dist) {
    + iowrite32(1, CONFIG_XILINX_LEDS_4BIT_BASEADDR);
    + } else if (cnt == 7 || cnt == dist + 7) {
    + iowrite32(0, CONFIG_XILINX_LEDS_4BIT_BASEADDR);
    + }
    +
    + if (++cnt > period) {
    + cnt = 0;
    +
    + /*
    + * The hyperbolic function below modifies the heartbeat period
    + * length in dependency of the current (5min) load. It goes
    + * through the points f(0)=126, f(1)=86, f(5)=51, f(inf)->30.
    + */
    + period = ((672 << FSHIFT) / (5 * avenrun[0] +
    + (7 << FSHIFT))) + 30;
    + dist = period / 4;
    + }
    +#endif
    +}
    --
    1.5.4.rc4.14.g6fc74

    --
    To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
    the body of a message to majordomo@vger.kernel.org
    More majordomo info at http://vger.kernel.org/majordomo-info.html
    Please read the FAQ at http://www.tux.org/lkml/

  3. [PATCH 28/52] [microblaze] support for a.out

    From: Michal Simek


    Signed-off-by: Michal Simek
    ---
    include/asm-microblaze/a.out.h | 14 ++++++++++++++
    1 files changed, 14 insertions(+), 0 deletions(-)
    create mode 100644 include/asm-microblaze/a.out.h

    diff --git a/include/asm-microblaze/a.out.h b/include/asm-microblaze/a.out.h
    new file mode 100644
    index 0000000..63046bd
    --- /dev/null
    +++ b/include/asm-microblaze/a.out.h
    @@ -0,0 +1,14 @@
    +/*
    + * include/asm-microblaze/a.out.h
    + *
    + * This file is subject to the terms and conditions of the GNU General Public
    + * License. See the file "COPYING" in the main directory of this archive
    + * for more details.
    + *
    + * Copyright (C) 2006 Atmark Techno, Inc.
    + */
    +
    +#ifndef _ASM_A_OUT_H
    +#define _ASM_A_OUT_H
    +
    +#endif /* _ASM_A_OUT_H */
    --
    1.5.4.rc4.14.g6fc74

    --
    To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
    the body of a message to majordomo@vger.kernel.org
    More majordomo info at http://vger.kernel.org/majordomo-info.html
    Please read the FAQ at http://www.tux.org/lkml/

  4. [PATCH 33/52] [microblaze] bug headers files

    From: Michal Simek


    Signed-off-by: Michal Simek
    ---
    include/asm-microblaze/bug.h | 17 +++++++++++++++++
    include/asm-microblaze/bugs.h | 19 +++++++++++++++++++
    2 files changed, 36 insertions(+), 0 deletions(-)
    create mode 100644 include/asm-microblaze/bug.h
    create mode 100644 include/asm-microblaze/bugs.h

    diff --git a/include/asm-microblaze/bug.h b/include/asm-microblaze/bug.h
    new file mode 100644
    index 0000000..5e23942
    --- /dev/null
    +++ b/include/asm-microblaze/bug.h
    @@ -0,0 +1,17 @@
    +/*
    + * include/asm-microblaze/bug.h
    + *
    + * This file is subject to the terms and conditions of the GNU General Public
    + * License. See the file "COPYING" in the main directory of this archive
    + * for more details.
    + *
    + * Copyright (C) 2006 Atmark Techno, Inc.
    + */
    +
    +#ifndef _ASM_BUG_H
    +#define _ASM_BUG_H
    +
    +#include
    +#include
    +
    +#endif /* _ASM_BUG_H */
    diff --git a/include/asm-microblaze/bugs.h b/include/asm-microblaze/bugs.h
    new file mode 100644
    index 0000000..558d27b
    --- /dev/null
    +++ b/include/asm-microblaze/bugs.h
    @@ -0,0 +1,19 @@
    +/*
    + * include/asm-microblaze/bugs.h
    + *
    + * This file is subject to the terms and conditions of the GNU General Public
    + * License. See the file "COPYING" in the main directory of this archive
    + * for more details.
    + *
    + * Copyright (C) 2006 Atmark Techno, Inc.
    + */
    +
    +#ifndef _ASM_BUGS_H
    +#define _ASM_BUGS_H
    +
    +static inline void check_bugs(void)
    +{
    + /* nothing to do */
    +}
    +
    +#endif /* _ASM_BUGS_H */
    --
    1.5.4.rc4.14.g6fc74

    --
    To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
    the body of a message to majordomo@vger.kernel.org
    More majordomo info at http://vger.kernel.org/majordomo-info.html
    Please read the FAQ at http://www.tux.org/lkml/

  5. [PATCH 27/52] [microblaze] traps support

    From: Michal Simek


    Signed-off-by: Michal Simek
    ---
    arch/microblaze/kernel/traps.c | 88 ++++++++++++++++++++++++++++++++++++++++
    1 files changed, 88 insertions(+), 0 deletions(-)
    create mode 100644 arch/microblaze/kernel/traps.c

    diff --git a/arch/microblaze/kernel/traps.c b/arch/microblaze/kernel/traps.c
    new file mode 100644
    index 0000000..eb8202b
    --- /dev/null
    +++ b/arch/microblaze/kernel/traps.c
    @@ -0,0 +1,88 @@
    +/*
    + * arch/microblaze/kernel/traps.c
    + *
    + * This file is subject to the terms and conditions of the GNU General Public
    + * License. See the file "COPYING" in the main directory of this archive
    + * for more details.
    + *
    + * Copyright (C) 2006 Atmark Techno, Inc.
    + */
    +
    +#include
    +#include
    +#include
    +#include
    +
    +#include
    +#include
    +
    +void trap_init(void)
    +{
    + initialize_exception_handlers();
    + __enable_hw_exceptions();
    +}
    +
    +void __bad_xchg(volatile void *ptr, int size)
    +{
    + printk(KERN_INFO "xchg: bad data size: pc 0x%p, ptr 0x%p, size %d\n",
    + __builtin_return_address(0), ptr, size);
    + BUG();
    +}
    +EXPORT_SYMBOL(__bad_xchg);
    +
    +static int kstack_depth_to_print = 24;
    +
    +void show_trace(struct task_struct *task, unsigned long *stack)
    +{
    + unsigned long addr;
    +
    + if (!stack)
    + stack = (unsigned long *)&stack;
    +
    + printk(KERN_INFO "Call Trace: ");
    +#ifdef CONFIG_KALLSYMS
    + printk(KERN_INFO "\n");
    +#endif
    + while (!kstack_end(stack)) {
    + addr = *stack++;
    + if (__kernel_text_address(addr)) {
    + printk(KERN_INFO "[<%08lx>] ", addr);
    + print_symbol("%s\n", addr);
    + }
    + }
    + printk(KERN_INFO "\n");
    +}
    +
    +void show_stack(struct task_struct *task, unsigned long *sp)
    +{
    + unsigned long *stack;
    + int i;
    +
    + if (sp == NULL) {
    + if (task)
    + sp = (unsigned long *) ((struct thread_info *)
    + (task->stack))->cpu_context.sp;
    + else
    + sp = (unsigned long *)&sp;
    + }
    +
    + stack = sp;
    +
    + printk(KERN_INFO "\nStack:\n ");
    +
    + for (i = 0; i < kstack_depth_to_print; i++) {
    + if (kstack_end(sp))
    + break;
    + if (i && ((i % 8) == 0))
    + printk("\n ");
    + printk("%08lx ", *sp++);
    + }
    + printk("\n");
    + show_trace(task, stack);
    +}
    +
    +void dump_stack(void)
    +{
    + show_stack(NULL, NULL);
    +}
    +EXPORT_SYMBOL(dump_stack);
    --
    1.5.4.rc4.14.g6fc74

    --
    To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
    the body of a message to majordomo@vger.kernel.org
    More majordomo info at http://vger.kernel.org/majordomo-info.html
    Please read the FAQ at http://www.tux.org/lkml/

  6. [PATCH 13/52] [microblaze] PVR support, cpuinfo support

    From: Michal Simek


    Signed-off-by: Michal Simek
    ---
    arch/microblaze/kernel/cpu/mb.c | 115 ++++++++++++++++++++++++++++++++++++++
    arch/microblaze/kernel/cpu/pvr.c | 83 +++++++++++++++++++++++++++
    2 files changed, 198 insertions(+), 0 deletions(-)
    create mode 100644 arch/microblaze/kernel/cpu/mb.c
    create mode 100644 arch/microblaze/kernel/cpu/pvr.c

    diff --git a/arch/microblaze/kernel/cpu/mb.c b/arch/microblaze/kernel/cpu/mb.c
    new file mode 100644
    index 0000000..2e68c3f
    --- /dev/null
    +++ b/arch/microblaze/kernel/cpu/mb.c
    @@ -0,0 +1,115 @@
    +/*
    + * arch/microblaze/kernel/cpu/mb.c
    + *
    + * CPU-version specific code
    + *
    + * This file is subject to the terms and conditions of the GNU General Public
    + * License. See the file "COPYING" in the main directory of this archive
    + * for more details.
    + *
    + * Copyright (C) Michal Simek
    + * Copyright (C) 2006 PetaLogix
    + */
    +
    +#include
    +#include
    +#include
    +#include
    +#include
    +
    +#include
    +#include
    +#include
    +#include
    +#include
    +#include
    +#include
    +
    +static int show_cpuinfo(struct seq_file *m, void *v)
    +{
    + int count = 0;
    + char *fpga_family = "Unknown";
    + char *cpu_ver = "Unknown";
    + int i;
    +
    + /* Denormalised to get the fpga family string */
    + for (i = 0; family_string_lookup[i].s != NULL; i++) {
    + if (cpuinfo->fpga_family_code == family_string_lookup[i].k) {
    + fpga_family = family_string_lookup[i].s;
    + break;
    + }
    + }
    +
    + /* Denormalised to get the hw version string */
    + for (i = 0; cpu_ver_lookup[i].s != NULL; i++) {
    + if (cpuinfo->ver_code == cpu_ver_lookup[i].k) {
    + cpu_ver = cpu_ver_lookup[i].s;
    + break;
    + }
    + }
    +
    + count = seq_printf(m,
    + "CPU-Family: MicroBlaze\n"
    + "FPGA-Arch: %s\n"
    + "CPU-Ver: %s\n"
    + "CPU-MHz: %d.%02d\n"
    + "BogoMips: %lu.%02lu\n",
    + fpga_family,
    + cpu_ver,
    + cpuinfo->cpu_clock_freq /
    + 1000000,
    + cpuinfo->cpu_clock_freq %
    + 1000000,
    + loops_per_jiffy / (500000 / HZ),
    + (loops_per_jiffy / (5000 / HZ)) % 100);
    +
    + count += seq_printf(m,
    + "HW-Div:\t\t%s\n"
    + "HW-Shift:\t%s\n",
    + cpuinfo->use_divider ? "yes" : "no",
    + cpuinfo->use_barrel ? "yes" : "no");
    +
    + if (cpuinfo->use_icache)
    + count += seq_printf(m,
    + "Icache:\t\t%ukB\n",
    + cpuinfo->icache_size >> 10);
    + else
    + count += seq_printf(m, "Icache:\t\tno\n");
    +
    + if (cpuinfo->use_dcache)
    + count += seq_printf(m,
    + "Dcache:\t\t%ukB\n",
    + cpuinfo->dcache_size >> 10);
    + else
    + count += seq_printf(m, "Dcache:\t\tno\n");
    +
    + count += seq_printf(m,
    + "HW-Debug:\t%s\n",
    + cpuinfo->hw_debug ? "yes" : "no");
    +
    + return 0;
    +}
    +
    +static void *c_start(struct seq_file *m, loff_t *pos)
    +{
    + int i = *pos;
    +
    + return i < NR_CPUS ? (void *) (i + 1) : NULL;
    +}
    +
    +static void *c_next(struct seq_file *m, void *v, loff_t *pos)
    +{
    + ++*pos;
    + return c_start(m, pos);
    +}
    +
    +static void c_stop(struct seq_file *m, void *v)
    +{
    +}
    +
    +struct seq_operations cpuinfo_op = {
    + .start = c_start,
    + .next = c_next,
    + .stop = c_stop,
    + .show = show_cpuinfo,
    +};
    diff --git a/arch/microblaze/kernel/cpu/pvr.c b/arch/microblaze/kernel/cpu/pvr.c
    new file mode 100644
    index 0000000..37e3a45
    --- /dev/null
    +++ b/arch/microblaze/kernel/cpu/pvr.c
    @@ -0,0 +1,83 @@
    +/*
    + * arch/microblaze/kernel/cpu/pvr.c
    + *
    + * Support for MicroBlaze PVR (processor version register)
    + *
    + * (C) 2007 Michal Simek
    + * (C) 2007 John Williams
    + * (C) 2007 PetaLogix
    + */
    +
    +#include
    +#include
    +#include
    +#include
    +#include
    +
    +/*
    + * Until we get an assembler that knows about the pvr registers,
    + * this horrible cruft will have to do.
    + * That hardcoded opcode is mfs r3, rpvrNN
    + */
    +
    +#define get_single_pvr(pvrid, val) \
    +{ \
    + register unsigned tmp __asm__("r3"); \
    + tmp = 0x0; /* Prevent warning about unused */ \
    + __asm__ __volatile__ ( \
    + ".byte 0x94,0x60,0xa0, " #pvrid "\n\t" \
    + : "=r" (tmp):: "memory"); \
    + val = tmp; \
    +}
    +
    +/*
    + * Does the CPU support the PVR register?
    + * return value:
    + * 0: no PVR
    + * 1: simple PVR
    + * 2: full PVR
    + *
    + * This must work on all CPU versions, including those before the
    + * PVR was even an option.
    + */
    +
    +int cpu_has_pvr(void)
    +{
    + unsigned flags;
    + unsigned pvr0;
    + int ret = 0;
    +
    + local_irq_save(flags);
    +
    + /* PVR bit in MSR tells us if there is any support */
    + if (!(flags & PVR_MSR_BIT))
    + goto out;
    +
    + get_single_pvr(0x00, pvr0);
    + pr_debug("%s: pvr0 is 0x%08x\n", __FUNCTION__, pvr0);
    +
    + if (pvr0 & PVR0_PVR_FULL_MASK)
    + ret = 2;
    + else
    + ret = 1;
    +
    +out:
    + local_irq_restore(flags);
    + return ret;
    +}
    +
    +void get_pvr(struct pvr_s *p)
    +{
    + get_single_pvr(0, p->pvr[0]);
    + get_single_pvr(1, p->pvr[1]);
    + get_single_pvr(2, p->pvr[2]);
    + get_single_pvr(3, p->pvr[3]);
    + get_single_pvr(4, p->pvr[4]);
    + get_single_pvr(5, p->pvr[5]);
    + get_single_pvr(6, p->pvr[6]);
    + get_single_pvr(7, p->pvr[7]);
    + get_single_pvr(8, p->pvr[8]);
    + get_single_pvr(9, p->pvr[9]);
    + get_single_pvr(10, p->pvr[10]);
    + get_single_pvr(11, p->pvr[11]);
    +}
    --
    1.5.4.rc4.14.g6fc74

    --
    To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
    the body of a message to majordomo@vger.kernel.org
    More majordomo info at http://vger.kernel.org/majordomo-info.html
    Please read the FAQ at http://www.tux.org/lkml/

  7. [PATCH 32/52] [microblaze] includes SHM*, msgbuf

    From: Michal Simek


    Signed-off-by: Michal Simek
    ---
    include/asm-microblaze/msgbuf.h | 41 +++++++++++++++++++++++++++++
    include/asm-microblaze/shmbuf.h | 52 +++++++++++++++++++++++++++++++++++++
    include/asm-microblaze/shmparam.h | 16 +++++++++++
    3 files changed, 109 insertions(+), 0 deletions(-)
    create mode 100644 include/asm-microblaze/msgbuf.h
    create mode 100644 include/asm-microblaze/shmbuf.h
    create mode 100644 include/asm-microblaze/shmparam.h

    diff --git a/include/asm-microblaze/msgbuf.h b/include/asm-microblaze/msgbuf.h
    new file mode 100644
    index 0000000..3f4d164
    --- /dev/null
    +++ b/include/asm-microblaze/msgbuf.h
    @@ -0,0 +1,41 @@
    +/*
    + * include/asm-microblaze/msgbuf.h
    + *
    + * This file is subject to the terms and conditions of the GNU General Public
    + * License. See the file "COPYING" in the main directory of this archive
    + * for more details.
    + *
    + * Copyright (C) 2006 Atmark Techno, Inc.
    + */
    +
    +#ifndef _ASM_MSGBUF_H
    +#define _ASM_MSGBUF_H
    +
    +/*
    + * The msqid64_ds structure for m68k architecture.
    + * Note extra padding because this structure is passed back and forth
    + * between kernel and user space.
    + *
    + * Pad space is left for:
    + * - 64-bit time_t to solve y2038 problem
    + * - 2 miscellaneous 32-bit values
    + */
    +
    +struct msqid64_ds {
    + struct ipc64_perm msg_perm;
    + __kernel_time_t msg_stime; /* last msgsnd time */
    + unsigned long __unused1;
    + __kernel_time_t msg_rtime; /* last msgrcv time */
    + unsigned long __unused2;
    + __kernel_time_t msg_ctime; /* last change time */
    + unsigned long __unused3;
    + unsigned long msg_cbytes; /* current number of bytes on queue */
    + unsigned long msg_qnum; /* number of messages in queue */
    + unsigned long msg_qbytes; /* max number of bytes on queue */
    + __kernel_pid_t msg_lspid; /* pid of last msgsnd */
    + __kernel_pid_t msg_lrpid; /* last receive pid */
    + unsigned long __unused4;
    + unsigned long __unused5;
    +};
    +
    +#endif /* _ASM_MSGBUF_H */
    diff --git a/include/asm-microblaze/shmbuf.h b/include/asm-microblaze/shmbuf.h
    new file mode 100644
    index 0000000..5571e2f
    --- /dev/null
    +++ b/include/asm-microblaze/shmbuf.h
    @@ -0,0 +1,52 @@
    +/*
    + * include/asm-microblaze/shmbuf.h
    + *
    + * This file is subject to the terms and conditions of the GNU General Public
    + * License. See the file "COPYING" in the main directory of this archive
    + * for more details.
    + *
    + * Copyright (C) 2006 Atmark Techno, Inc.
    + */
    +
    +#ifndef _ASM_SHMBUF_H
    +#define _ASM_SHMBUF_H
    +
    +/*
    + * The shmid64_ds structure for m68k architecture.
    + * Note extra padding because this structure is passed back and forth
    + * between kernel and user space.
    + *
    + * Pad space is left for:
    + * - 64-bit time_t to solve y2038 problem
    + * - 2 miscellaneous 32-bit values
    + */
    +
    +struct shmid64_ds {
    + struct ipc64_perm shm_perm; /* operation perms */
    + size_t shm_segsz; /* size of segment (bytes) */
    + __kernel_time_t shm_atime; /* last attach time */
    + unsigned long __unused1;
    + __kernel_time_t shm_dtime; /* last detach time */
    + unsigned long __unused2;
    + __kernel_time_t shm_ctime; /* last change time */
    + unsigned long __unused3;
    + __kernel_pid_t shm_cpid; /* pid of creator */
    + __kernel_pid_t shm_lpid; /* pid of last operator */
    + unsigned long shm_nattch; /* no. of current attaches */
    + unsigned long __unused4;
    + unsigned long __unused5;
    +};
    +
    +struct shminfo64 {
    + unsigned long shmmax;
    + unsigned long shmmin;
    + unsigned long shmmni;
    + unsigned long shmseg;
    + unsigned long shmall;
    + unsigned long __unused1;
    + unsigned long __unused2;
    + unsigned long __unused3;
    + unsigned long __unused4;
    +};
    +
    +#endif /* _ASM_SHMBUF_H */
    diff --git a/include/asm-microblaze/shmparam.h b/include/asm-microblaze/shmparam.h
    new file mode 100644
    index 0000000..752498c
    --- /dev/null
    +++ b/include/asm-microblaze/shmparam.h
    @@ -0,0 +1,16 @@
    +/*
    + * include/asm-microblaze/shmparam.h
    + *
    + * This file is subject to the terms and conditions of the GNU General Public
    + * License. See the file "COPYING" in the main directory of this archive
    + * for more details.
    + *
    + * Copyright (C) 2006 Atmark Techno, Inc.
    + */
    +
    +#ifndef _ASM_SHMPARAM_H
    +#define _ASM_SHMPARAM_H
    +
    +#define SHMLBA PAGE_SIZE /* attach addr a multiple of this */
    +
    +#endif /* _ASM_SHMPARAM_H */
    --
    1.5.4.rc4.14.g6fc74

    --
    To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
    the body of a message to majordomo@vger.kernel.org
    More majordomo info at http://vger.kernel.org/majordomo-info.html
    Please read the FAQ at http://www.tux.org/lkml/

  8. [PATCH 18/52] [microblaze] early_printk support

    From: Michal Simek


    Signed-off-by: Michal Simek
    ---
    arch/microblaze/kernel/early_printk.c | 115 +++++++++++++++++++++++++++++++++
    1 files changed, 115 insertions(+), 0 deletions(-)
    create mode 100644 arch/microblaze/kernel/early_printk.c

    diff --git a/arch/microblaze/kernel/early_printk.c b/arch/microblaze/kernel/early_printk.c
    new file mode 100644
    index 0000000..0f533ff
    --- /dev/null
    +++ b/arch/microblaze/kernel/early_printk.c
    @@ -0,0 +1,115 @@
    +/*
    + * arch/microblaze/kernel/early_printk.c
    + *
    + * Copyright (C) 2007 Michal Simek
    + * Copyright (C) 2003-2006 Yasushi SHOJI
    + *
    + * Early printk support for Microblaze.
    + *
    + * Once we got some system without uart light, we need to refactor.
    + */
    +
    +#include
    +#include
    +#include
    +#include
    +#include
    +#include
    +#include
    +#include
    +#include
    +
    +#ifdef CONFIG_EARLY_PRINTK
    +#define BASE_ADDR ((unsigned char *)CONFIG_EARLY_PRINTK_UARTLITE_ADDRESS)
    +
    +#define RX_FIFO BASE_ADDR
    +#define TX_FIFO ((unsigned long *)(BASE_ADDR + 4))
    +#define STATUS ((unsigned long *)(BASE_ADDR + 8))
    +#define CONTROL ((unsigned long *)(BASE_ADDR + 12))
    +
    +static void early_printk_putc(char c)
    +{
    + while (ioread32(STATUS) & (1<<3));
    + iowrite32((c & 0xff), TX_FIFO);
    +}
    +
    +static void early_printk_write(struct console *unused,
    + const char *s, unsigned n)
    +{
    + while (*s && n-- > 0) {
    + early_printk_putc(*s);
    + if (*s == '\n')
    + early_printk_putc('\r');
    + s++;
    + }
    +}
    +
    +static struct console early_serial_console = {
    + .name = "earlyser",
    + .write = early_printk_write,
    + .flags = CON_PRINTBUFFER,
    + .index = -1,
    +};
    +
    +/* Direct interface for emergencies */
    +static struct console *early_console = &early_serial_console;
    +static int early_console_initialized;
    +
    +void early_printk(const char *fmt, ...)
    +{
    + char buf[512];
    + int n;
    + va_list ap;
    +
    + if (early_console_initialized) {
    + va_start(ap, fmt);
    + n = vscnprintf(buf, 512, fmt, ap);
    + early_console->write(early_console, buf, n);
    + va_end(ap);
    + }
    +}
    +
    +static int __initdata keep_early;
    +
    +int __init setup_early_printk(char *opt)
    +{
    + char *space;
    + char buf[256];
    +
    + if (early_console_initialized)
    + return 1;
    +
    + strlcpy(buf, opt, sizeof(buf));
    + space = strchr(buf, ' ');
    + if (space)
    + *space = 0;
    +
    + if (strstr(buf, "keep"))
    + keep_early = 1;
    +
    + early_console = &early_serial_console;
    + early_console_initialized = 1;
    + register_console(early_console);
    + return 0;
    +}
    +#if 0
    +static void __init disable_early_printk(void)
    +{
    + if (!early_console_initialized || !early_console)
    + return;
    + if (!keep_early) {
    + printk(KERN_INFO "disabling early console\n");
    + unregister_console(early_console);
    + early_console_initialized = 0;
    + } else
    + printk(KERN_INFO "keeping early console\n");
    +}
    +#endif
    +
    +__setup("earlyprintk=", setup_early_printk);
    +
    +#else
    +void early_printk(const char *fmt, ...)
    +{
    +}
    +#endif
    --
    1.5.4.rc4.14.g6fc74

    --
    To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
    the body of a message to majordomo@vger.kernel.org
    More majordomo info at http://vger.kernel.org/majordomo-info.html
    Please read the FAQ at http://www.tux.org/lkml/

  9. [PATCH 24/52] [microblaze] time support

    From: Michal Simek


    Signed-off-by: Michal Simek
    ---
    arch/microblaze/kernel/time.c | 90 ++++++++++++++++++++++++++++++++++++++++
    include/asm-microblaze/delay.h | 28 ++++++++++++
    include/asm-microblaze/timex.h | 21 +++++++++
    3 files changed, 139 insertions(+), 0 deletions(-)
    create mode 100644 arch/microblaze/kernel/time.c
    create mode 100644 include/asm-microblaze/delay.h
    create mode 100644 include/asm-microblaze/timex.h

    diff --git a/arch/microblaze/kernel/time.c b/arch/microblaze/kernel/time.c
    new file mode 100644
    index 0000000..d5ebdff
    --- /dev/null
    +++ b/arch/microblaze/kernel/time.c
    @@ -0,0 +1,90 @@
    +/*
    + * arch/microblaze/kernel/time.c
    + *
    + * This file is subject to the terms and conditions of the GNU General Public
    + * License. See the file "COPYING" in the main directory of this archive
    + * for more details.
    + *
    + * Copyright (C) 2006 Atmark Techno, Inc.
    + */
    +
    +#include
    +#include
    +#include
    +#include
    +#include
    +#include
    +#include
    +#include
    +
    +void time_init(void)
    +{
    + system_timer_init();
    +}
    +
    +int do_settimeofday(struct timespec *tv)
    +{
    + if ((unsigned long)tv->tv_nsec >= NSEC_PER_SEC)
    + return -EINVAL;
    +
    + write_seqlock_irq(&xtime_lock);
    +
    + /* This is revolting. We need to set the xtime.tv_nsec
    + * correctly. However, the value in this location is
    + * is value at the last tick.
    + * Discover what correction gettimeofday
    + * would have done, and then undo it!
    + */
    +#if 0
    + tv->tv_nsec -= mach_gettimeoffset() * 1000;
    +#endif
    +
    + while (tv->tv_nsec < 0) {
    + tv->tv_nsec += NSEC_PER_SEC;
    + tv->tv_sec--;
    + }
    +
    + xtime.tv_sec = tv->tv_sec;
    + xtime.tv_nsec = tv->tv_nsec;
    +
    + time_adjust = 0;
    + time_status |= STA_UNSYNC;
    + time_maxerror = NTP_PHASE_LIMIT;
    + time_esterror = NTP_PHASE_LIMIT;
    +
    + write_sequnlock_irq(&xtime_lock);
    + clock_was_set();
    + return 0;
    +}
    +EXPORT_SYMBOL(do_settimeofday);
    +
    +/*
    + * This version of gettimeofday has near microsecond resolution.
    + */
    +void do_gettimeofday(struct timeval *tv)
    +{
    + unsigned long seq;
    + unsigned long usec, sec;
    + /* unsigned long max_ntp_tick = tick_usec - tickadj; */
    +
    + do {
    + seq = read_seqbegin(&xtime_lock);
    + usec = do_gettimeoffset();
    + sec = xtime.tv_sec;
    + usec += (xtime.tv_nsec / 1000);
    + } while (read_seqretry(&xtime_lock, seq));
    +
    + while (usec >= 1000000) {
    + usec -= 1000000;
    + sec++;
    + }
    +
    + tv->tv_sec = sec;
    + tv->tv_usec = usec;
    +}
    +EXPORT_SYMBOL(do_gettimeofday);
    +
    +unsigned long long sched_clock(void)
    +{
    + return (unsigned long long)jiffies * (1000000000 / HZ);
    +}
    diff --git a/include/asm-microblaze/delay.h b/include/asm-microblaze/delay.h
    new file mode 100644
    index 0000000..1eaa74c
    --- /dev/null
    +++ b/include/asm-microblaze/delay.h
    @@ -0,0 +1,28 @@
    +/*
    + * include/asm-microblaze/delay.h
    + *
    + * This file is subject to the terms and conditions of the GNU General Public
    + * License. See the file "COPYING" in the main directory of this archive
    + * for more details.
    + *
    + * Copyright (C) 2006 Atmark Techno, Inc.
    + */
    +
    +#ifndef _ASM_DELAY_H
    +#define _ASM_DELAY_H
    +
    +extern inline void __delay(unsigned long loops)
    +{
    + asm volatile ("# __delay \n\t" \
    + "1: addi %0, %0, -1 \t\n" \
    + "bneid %0, 1b \t\n" \
    + "nop \t\n"
    + : "=r" (loops)
    + : "0" (loops));
    +}
    +
    +static inline void udelay(unsigned long usec)
    +{
    +}
    +
    +#endif /* _ASM_DELAY_H */
    diff --git a/include/asm-microblaze/timex.h b/include/asm-microblaze/timex.h
    new file mode 100644
    index 0000000..17d2f11
    --- /dev/null
    +++ b/include/asm-microblaze/timex.h
    @@ -0,0 +1,21 @@
    +/*
    + * include/asm-microblaze/timex.h
    + *
    + * This file is subject to the terms and conditions of the GNU General Public
    + * License. See the file "COPYING" in the main directory of this archive
    + * for more details.
    + *
    + * Copyright (C) 2006 Atmark Techno, Inc.
    + * FIXME -- need review
    + */
    +
    +#ifndef _ASM_TIMEX_H
    +#define _ASM_TIMEX_H
    +
    +#define CLOCK_TICK_RATE 1000 /* Timer input freq. */
    +
    +typedef unsigned long cycles_t;
    +
    +#define get_cycles() (0)
    +
    +#endif /* _ASM_TIMEX_H */
    --
    1.5.4.rc4.14.g6fc74

    --
    To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
    the body of a message to majordomo@vger.kernel.org
    More majordomo info at http://vger.kernel.org/majordomo-info.html
    Please read the FAQ at http://www.tux.org/lkml/

  10. [PATCH 23/52] [microblaze] process and init task function

    From: Michal Simek


    Signed-off-by: Michal Simek
    ---
    arch/microblaze/kernel/init_task.c | 31 +++++++++
    arch/microblaze/kernel/process.c | 129 ++++++++++++++++++++++++++++++++++++
    2 files changed, 160 insertions(+), 0 deletions(-)
    create mode 100644 arch/microblaze/kernel/init_task.c
    create mode 100644 arch/microblaze/kernel/process.c

    diff --git a/arch/microblaze/kernel/init_task.c b/arch/microblaze/kernel/init_task.c
    new file mode 100644
    index 0000000..7c6bce3
    --- /dev/null
    +++ b/arch/microblaze/kernel/init_task.c
    @@ -0,0 +1,31 @@
    +/*
    + * arch/microblaze/kernel/init_task.c
    + *
    + * This file is subject to the terms and conditions of the GNU General Public
    + * License. See the file "COPYING" in the main directory of this archive
    + * for more details.
    + *
    + * Copyright (C) 2006 Atmark Techno, Inc.
    + */
    +
    +#include
    +#include
    +#include
    +#include
    +#include
    +
    +#include
    +
    +static struct fs_struct init_fs = INIT_FS;
    +static struct files_struct init_files = INIT_FILES;
    +static struct signal_struct init_signals = INIT_SIGNALS(init_signals);
    +static struct sighand_struct init_sighand = INIT_SIGHAND(init_sighand);
    +struct mm_struct init_mm = INIT_MM(init_mm);
    +EXPORT_SYMBOL(init_mm);
    +
    +union thread_union init_thread_union
    + __attribute__((__section__(".data.init_task"))) =
    +{ INIT_THREAD_INFO(init_task) };
    +
    +struct task_struct init_task = INIT_TASK(init_task);
    +EXPORT_SYMBOL(init_task);
    diff --git a/arch/microblaze/kernel/process.c b/arch/microblaze/kernel/process.c
    new file mode 100644
    index 0000000..679fe19
    --- /dev/null
    +++ b/arch/microblaze/kernel/process.c
    @@ -0,0 +1,129 @@
    +/*
    + * arch/microblaze/kernel/process.c
    + *
    + * This file is subject to the terms and conditions of the GNU General Public
    + * License. See the file "COPYING" in the main directory of this archive
    + * for more details.
    + *
    + * Copyright (C) 2006 Atmark Techno, Inc.
    + */
    +
    +#include
    +#include
    +#include
    +
    +#include
    +
    +/* FIXME */
    +void show_regs(struct pt_regs *regs)
    +{
    + unsigned long *p;
    + int i;
    + printk(KERN_INFO "pc:\t0x%08lx\tsp:\t0x%08lx\n", regs->pc, regs->r1);
    + printk(KERN_INFO
    + "flags:\t0x%08lx\tear:\t0x%08lx\tesr:\t"
    + "0x%08lx\tfsr:\t0x%08lx\n",
    + regs->msr, regs->ear, regs->esr, regs->fsr);
    + printk(KERN_INFO
    + "r0:\t0x%08lx\tr1:\t0x%08lx\tr2:\t0x%08lx\tr3\t0x%0 8lx\n",
    + 0L, regs->r1, regs->r2, regs->r3);
    + for (i = 4, p = &(regs->r4); i < 32; i += 4, p += 4) {
    + printk(KERN_INFO "r%i:\t0x%08lx\tr%i:\t0x%08lx\tr%i:\t"
    + "0x%08lx\tr%i:\t0x%08lx\n",
    + i, *p, i+1, *(p+1), i+2, *(p+2), i+3, *(p+3));
    + }
    + printk(KERN_INFO "\n");
    +}
    +
    +void (*pm_power_off)(void) = NULL;
    +EXPORT_SYMBOL(pm_power_off);
    +
    +void cpu_idle(void)
    +{
    + set_thread_flag(TIF_POLLING_NRFLAG);
    +
    + while (1) {
    + while (!need_resched())
    + cpu_relax();
    +
    + preempt_enable_no_resched();
    + schedule();
    + preempt_disable();
    + }
    +}
    +
    +void flush_thread(void)
    +{
    +}
    +
    +int copy_thread(int nr, unsigned long clone_flags, unsigned long usp,
    + unsigned long unused,
    + struct task_struct *p, struct pt_regs *regs)
    +{
    + struct pt_regs *childregs = task_pt_regs(p);
    + struct thread_info *ti = task_thread_info(p);
    +
    + *childregs = *regs;
    +
    + if (user_mode(regs))
    + childregs->r1 = usp;
    + else
    + childregs->r1 = ((unsigned long) ti) + THREAD_SIZE;
    +
    + memset(&ti->cpu_context, 0, sizeof(struct cpu_context));
    + ti->cpu_context.sp = (unsigned long)childregs;
    + ti->cpu_context.msr = (unsigned long)childregs->msr;
    + ti->cpu_context.r15 = (unsigned long)ret_from_fork - 8;
    +
    + if (clone_flags & CLONE_SETTLS)
    + ;/* FIXME: not sure what to do */
    +
    + return 0;
    +}
    +
    +/*
    + * Return saved PC of a blocked thread.
    + * FIXME this needs to be checked
    + */
    +unsigned long thread_saved_pc(struct task_struct *tsk)
    +{
    + struct cpu_context *ctx =
    + &(((struct thread_info *)(tsk->stack))->cpu_context);
    +
    + /* Check whether the thread is blocked in resume() */
    + if (in_sched_functions(ctx->r15))
    + return ((unsigned long)ctx->r15);
    + else
    + return ctx->r14;
    +}
    +
    +static void kernel_thread_helper(int (*fn)(void *), void *arg)
    +{
    + fn(arg);
    + do_exit(-1);
    +}
    +
    +int kernel_thread(int (*fn)(void *), void *arg, unsigned long flags)
    +{
    + struct pt_regs regs;
    + int ret;
    +
    + memset(&regs, 0, sizeof(regs));
    + /* store them in non-volatile registers */
    + regs.r5 = (unsigned long)fn;
    + regs.r6 = (unsigned long)arg;
    + local_save_flags(regs.msr);
    + regs.pc = (unsigned long)kernel_thread_helper;
    + regs.kernel_mode = 1;
    +
    + ret = do_fork(flags | CLONE_VM | CLONE_UNTRACED, 0,
    + &regs, 0, NULL, NULL);
    +
    + return ret;
    +}
    +
    +unsigned long get_wchan(struct task_struct *p)
    +{
    +/* TBD (used by procfs) */
    + return 0;
    +}
    --
    1.5.4.rc4.14.g6fc74

    --
    To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
    the body of a message to majordomo@vger.kernel.org
    More majordomo info at http://vger.kernel.org/majordomo-info.html
    Please read the FAQ at http://www.tux.org/lkml/

  11. [PATCH 39/52] [microblaze] headers for irq

    From: Michal Simek


    Signed-off-by: Michal Simek
    ---
    include/asm-microblaze/hardirq.h | 31 +++++++++++++++++++++++++++++++
    include/asm-microblaze/hw_irq.h | 19 +++++++++++++++++++
    include/asm-microblaze/irq_regs.h | 19 +++++++++++++++++++
    3 files changed, 69 insertions(+), 0 deletions(-)
    create mode 100644 include/asm-microblaze/hardirq.h
    create mode 100644 include/asm-microblaze/hw_irq.h
    create mode 100644 include/asm-microblaze/irq_regs.h

    diff --git a/include/asm-microblaze/hardirq.h b/include/asm-microblaze/hardirq.h
    new file mode 100644
    index 0000000..61cd3c0
    --- /dev/null
    +++ b/include/asm-microblaze/hardirq.h
    @@ -0,0 +1,31 @@
    +/*
    + * include/asm-microblaze/hardirq.h
    + *
    + * This file is subject to the terms and conditions of the GNU General Public
    + * License. See the file "COPYING" in the main directory of this archive
    + * for more details.
    + *
    + * Copyright (C) 2006 Atmark Techno, Inc.
    + */
    +
    +#ifndef _ASM_HARDIRQ_H
    +#define _ASM_HARDIRQ_H
    +
    +#include
    +#include
    +#include
    +#include
    +#include
    +
    +/* should be defined in each interrupt controller driver */
    +extern unsigned int get_irq(struct pt_regs *regs);
    +
    +typedef struct {
    + unsigned int __softirq_pending;
    +} ____cacheline_aligned irq_cpustat_t;
    +
    +void ack_bad_irq(unsigned int irq);
    +
    +#include /* Standard mappings for irq_cpustat_t above */
    +
    +#endif /* _ASM_HARDIRQ_H */
    diff --git a/include/asm-microblaze/hw_irq.h b/include/asm-microblaze/hw_irq.h
    new file mode 100644
    index 0000000..e7a0956
    --- /dev/null
    +++ b/include/asm-microblaze/hw_irq.h
    @@ -0,0 +1,19 @@
    +/*
    + * include/asm-microblaze/hw_irq.h
    + *
    + * This file is subject to the terms and conditions of the GNU General Public
    + * License. See the file "COPYING" in the main directory of this archive
    + * for more details.
    + *
    + * Copyright (C) 2006 Atmark Techno, Inc.
    + */
    +
    +#ifndef _ASM_HW_IRQ_H
    +#define _ASM_HW_IRQ_H
    +
    +static inline void hw_resend_irq(struct hw_interrupt_type *h, unsigned int i)
    +{
    + /* Nothing to do */
    +}
    +
    +#endif /* _ASM_HW_IRQ_H */
    diff --git a/include/asm-microblaze/irq_regs.h b/include/asm-microblaze/irq_regs.h
    new file mode 100644
    index 0000000..702b051
    --- /dev/null
    +++ b/include/asm-microblaze/irq_regs.h
    @@ -0,0 +1,19 @@
    +/*
    + * include/asm-microblaze/irq_regs.h
    + *
    + * This file is subject to the terms and conditions of the GNU General Public
    + * License. See the file "COPYING" in the main directory of this archive
    + * for more details.
    + *
    + * Copyright (C) 2006 Atmark Techno, Inc.
    + */
    +
    +#ifndef _ASM_IRQ_REGS_H
    +#define _ASM_IRQ_REGS_H
    +
    +#include
    +
    +#endif /* _ASM_IRQ_REGS_H */
    +
    +
    +
    --
    1.5.4.rc4.14.g6fc74

    --
    To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
    the body of a message to majordomo@vger.kernel.org
    More majordomo info at http://vger.kernel.org/majordomo-info.html
    Please read the FAQ at http://www.tux.org/lkml/

  12. [PATCH 21/52] [microblaze] setup.c - system setting

    From: Michal Simek


    Signed-off-by: Michal Simek
    ---
    arch/microblaze/kernel/setup.c | 170 ++++++++++++++++++++++++++++++++++++++++
    1 files changed, 170 insertions(+), 0 deletions(-)
    create mode 100644 arch/microblaze/kernel/setup.c

    diff --git a/arch/microblaze/kernel/setup.c b/arch/microblaze/kernel/setup.c
    new file mode 100644
    index 0000000..1d05fac
    --- /dev/null
    +++ b/arch/microblaze/kernel/setup.c
    @@ -0,0 +1,170 @@
    +/*
    + * arch/microblaze/kernel/setup.c
    + *
    + * This file is subject to the terms and conditions of the GNU General Public
    + * License. See the file "COPYING" in the main directory of this archive
    + * for more details.
    + *
    + * Copyright (C) 2006 Atmark Techno, Inc.
    + */
    +
    +#include
    +#include
    +#include
    +#include
    +#include
    +#include
    +
    +#include
    +#include
    +#include
    +#include
    +#include
    +#include
    +#include
    +#include
    +#include
    +#include
    +
    +#include
    +#include
    +#include
    +
    +DEFINE_PER_CPU(unsigned int, KSP); /* Saved kernel stack pointer */
    +DEFINE_PER_CPU(unsigned int, KM); /* Kernel/user mode */
    +DEFINE_PER_CPU(unsigned int, ENTRY_SP); /* Saved SP on kernel entry */
    +DEFINE_PER_CPU(unsigned int, R11_SAVE); /* Temp variable for entry */
    +DEFINE_PER_CPU(unsigned int, CURRENT_SAVE); /* Saved current pointer */
    +
    +char command_line[COMMAND_LINE_SIZE];
    +static char default_command_line[COMMAND_LINE_SIZE] __initdata = CONFIG_CMDLINE;
    +
    +void __init setup_arch(char **cmdline_p)
    +{
    + console_verbose();
    +
    + unflatten_device_tree();
    + /* NOTE I think that this function is not necessary to call */
    + /* irq_early_init(); */
    + setup_cpuinfo();
    +
    + __flush_icache_all();
    + __enable_icache();
    +
    + __flush_dcache_all();
    + __enable_dcache();
    +
    + panic_timeout = 120;
    +
    + setup_memory();
    + paging_init();
    +
    +#ifdef CONFIG_VT
    +#if defined(CONFIG_XILINX_CONSOLE)
    + conswitchp = &xil_con;
    +#elif defined(CONFIG_DUMMY_CONSOLE)
    + conswitchp = &dummy_con;
    +#endif
    +#endif
    +}
    +
    +#ifdef CONFIG_MTD_UCLINUX_EBSS
    +/* Handle both romfs and cramfs types, without generating unnecessary
    + code (ie no point checking for CRAMFS if it's not even enabled) */
    +inline unsigned get_romfs_len(unsigned *addr)
    +{
    +#ifdef CONFIG_ROMFS_FS
    + if (memcmp(&addr[0], "-rom1fs-", 8) == 0) /* romfs */
    + return be32_to_cpu(addr[2]);
    +#endif
    +
    +#ifdef CONFIG_CRAMFS
    + if (addr[0] == le32_to_cpu(0x28cd3d45)) /* cramfs */
    + return le32_to_cpu(addr[1]);
    +#endif
    + return 0;
    +}
    +#endif /* CONFIG_MTD_UCLINUX_EBSS */
    +
    +void __init machine_early_init(const char *cmdline, unsigned int ram,
    + unsigned int fdt)
    +{
    + unsigned long *src, *dst = (unsigned long *)0x0;
    + early_printk("Ramdisk addr 0x%08x, FDT 0x%08x\n", ram, fdt);
    +
    +#ifdef CONFIG_MTD_UCLINUX_EBSS
    + {
    + int size;
    + unsigned int romfs_base;
    + romfs_base = (ram ? ram : (unsigned int)&__init_end);
    + /* if CONFIG_MTD_UCLINUX_EBSS is defined, assume ROMFS is at the
    + * end of kernel, which is ROMFS_LOCATION defined above. */
    + size = PAGE_ALIGN(get_romfs_len((unsigned *)romfs_base));
    + early_printk("Found romfs @ 0x%08x (0x%08x)\n",
    + romfs_base, size);
    + early_printk("#### klimit %p ####\n", klimit);
    + BUG_ON(size < 0); /* What else can we do? */
    +
    + /* Use memmove to handle likely case of memory overlap */
    + early_printk("Moving 0x%08x bytes from 0x%08x to 0x%08x\n",
    + size, romfs_base, &_ebss);
    + memmove(&_ebss, (int *)romfs_base, size);
    +
    + /* update klimit */
    + klimit += PAGE_ALIGN(size);
    + early_printk("New klimit: 0x%08x\n", klimit);
    + }
    +#endif
    +
    + memset(__bss_start, 0, __bss_stop-__bss_start);
    + memset(_ssbss, 0, _esbss-_ssbss);
    +
    + printk(KERN_NOTICE "Found FDT at 0x%08x\n", fdt);
    + early_init_devtree((void *)fdt);
    +
    + /* Copy command line passed from bootloader, or use default
    + if none provided, or forced */
    +#ifndef CONFIG_CMDLINE_FORCE
    + if (cmdline && cmdline[0] != '\0')
    + strlcpy(command_line, cmdline, COMMAND_LINE_SIZE);
    + else
    +#endif
    + strlcpy(command_line, default_command_line, COMMAND_LINE_SIZE);
    +
    + for (src = __ivt_start; src < __ivt_end; src++, dst++)
    + *dst = *src;
    +
    + /* Initialize global data */
    + per_cpu(KM, 0) = 0x1; /* We start in kernel mode */
    + per_cpu(CURRENT_SAVE, 0) = (unsigned long)current;
    +
    +}
    +
    +void machine_restart(char *cmd)
    +{
    + printk(KERN_NOTICE "Machine restart...\n");
    + dump_stack();
    + while (1)
    + ;
    +}
    +
    +void machine_shutdown(void)
    +{
    + printk(KERN_NOTICE "Machine shutdown...\n");
    + while (1)
    + ;
    +}
    +
    +void machine_halt(void)
    +{
    + printk(KERN_NOTICE "Machine halt...\n");
    + while (1)
    + ;
    +}
    +
    +void machine_power_off(void)
    +{
    + printk(KERN_NOTICE "Machine power off...\n");
    + while (1)
    + ;
    +}
    --
    1.5.4.rc4.14.g6fc74

    --
    To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
    the body of a message to majordomo@vger.kernel.org
    More majordomo info at http://vger.kernel.org/majordomo-info.html
    Please read the FAQ at http://www.tux.org/lkml/

  13. [PATCH 10/52] [microblaze] Generic dts file for platforms

    From: Michal Simek


    Signed-off-by: Michal Simek
    ---
    arch/microblaze/platform/generic/system.dts | 137 +++++++++++++++++++++++++++
    1 files changed, 137 insertions(+), 0 deletions(-)
    create mode 100644 arch/microblaze/platform/generic/system.dts

    diff --git a/arch/microblaze/platform/generic/system.dts b/arch/microblaze/platform/generic/system.dts
    new file mode 100644
    index 0000000..91eac31
    --- /dev/null
    +++ b/arch/microblaze/platform/generic/system.dts
    @@ -0,0 +1,137 @@
    +/*
    + * (C) Copyright 2007 Michal Simek
    + *
    + * Michal SIMEK
    + *
    + * This program is free software; you can redistribute it and/or
    + * modify it under the terms of the GNU General Public License as
    + * published by the Free Software Foundation; either version 2 of
    + * the License, or (at your option) any later version.
    + *
    + * This program is distributed in the hope that it will be useful,
    + * but WITHOUT ANY WARRANTY; without even the implied warranty of
    + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
    + * GNU General Public License for more details.
    + *
    + * You should have received a copy of the GNU General Public License
    + * along with this program; if not, write to the Free Software
    + * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
    + * MA 02111-1307 USA
    + *
    + * CAUTION: This file is automatically generated by libgen.
    + * Version: Xilinx EDK 9.2 EDK_Jm.16
    + * Generate by U-BOOT v4.00.b
    + */
    +
    +/ {
    + #address-cells = <1>;
    + #size-cells = <1>;
    + compatible = "ibm,opb";
    + model = "testing";
    + DDR_SDRAM_32Mx16: memory@44000000 {
    + device_type = "memory";
    + reg = < 44000000 2000000 >;
    + } ;
    + chosen {
    + bootargs = "root=mtdblock0";
    + } ;
    + cpus {
    + #address-cells = <1>;
    + #cpus = <1>;
    + #size-cells = <0>;
    + microblaze,5.00.c@0 {
    + clock-frequency = <3f940ab>;
    + d-cache-baseaddr = <44000000>;
    + d-cache-highaddr = <47ffffff>;
    + d-cache-line-size = <10>;
    + d-cache-size = <2000>;
    + device_type = "cpu";
    + i-cache-baseaddr = <44000000>;
    + i-cache-highaddr = <47ffffff>;
    + i-cache-line-size = <10>;
    + i-cache-size = <2000>;
    + reg = <0>;
    + timebase-frequency = <3f940ab>;
    + xlnx,addr-tag-bits = ;
    + xlnx,allow-dcache-wr = <1>;
    + xlnx,allow-icache-wr = <1>;
    + xlnx,cache-byte-size = <2000>;
    + xlnx,d-lmb = <1>;
    + xlnx,d-opb = <1>;
    + xlnx,data-size = <20>;
    + xlnx,dcache-addr-tag = ;
    + xlnx,dcache-byte-size = <2000>;
    + xlnx,dcache-line-len = <4>;
    + xlnx,dcache-use-fsl = <1>;
    + xlnx,debug-enabled = <1>;
    + xlnx,div-zero-exception = <0>;
    + xlnx,dopb-bus-exception = <0>;
    + xlnx,dynamic-bus-sizing = <1>;
    + xlnx,edge-is-positive = <1>;
    + xlnx,fpu-exception = <0>;
    + xlnx,fsl-data-size = <20>;
    + xlnx,fsl-links = <1>;
    + xlnx,i-lmb = <1>;
    + xlnx,i-opb = <1>;
    + xlnx,icache-line-len = <4>;
    + xlnx,icache-use-fsl = <1>;
    + xlnx,ill-opcode-exception = <0>;
    + xlnx,instance = "microblaze_0";
    + xlnx,interrupt-is-edge = <0>;
    + xlnx,iopb-bus-exception = <0>;
    + xlnx,number-of-pc-brk = <2>;
    + xlnx,number-of-rd-addr-brk = <0>;
    + xlnx,number-of-wr-addr-brk = <0>;
    + xlnx,opcode-0x0-illegal = <0>;
    + xlnx,pvr = <2>;
    + xlnx,pvr-user1 = <0>;
    + xlnx,pvr-user2 = <0>;
    + xlnx,reset-msr = <0>;
    + xlnx,sco = <0>;
    + xlnx,unaligned-exceptions = <0>;
    + xlnx,use-barrel = <1>;
    + xlnx,use-dcache = <1>;
    + xlnx,use-div = <1>;
    + xlnx,use-fpu = <0>;
    + xlnx,use-hw-mul = <1>;
    + xlnx,use-icache = <1>;
    + xlnx,use-msr-instr = <1>;
    + xlnx,use-pcmp-instr = <1>;
    + } ;
    + } ;
    + opb_v20 {
    + #address-cells = <1>;
    + #size-cells = <1>;
    + compatible = "xlnx,opb-v20-1.10.c", "xlnx,opb-v20";
    + RS232_DTE: serial@40600000 {
    + compatible = "xlnx,opb-uartlite-1.00.b", "xlnx,opb-uartlite", "xilinx,uartlite";
    + interrupt-parent = <&opb_intc_0>;
    + interrupts = < 2 0 >;
    + reg = < 40600000 10000 >;
    + xlnx,baudrate = <1c200>;
    + xlnx,clk-freq = <3f940ab>;
    + xlnx,data-bits = <8>;
    + xlnx,odd-parity = <0>;
    + xlnx,use-parity = <0>;
    + } ;
    + opb_intc_0: interrupt-controller@41200000 {
    + #interrupt-cells = <2>;
    + compatible = "xlnx,opb-intc-1.00.c", "xlnx,opb-intc";
    + interrupt-controller ;
    + reg = < 41200000 10000 >;
    + xlnx,num-intr-inputs = <5>;
    + } ;
    + opb_timer_0: opb-timer@41c00000 {
    + compatible = "xlnx,opb-timer-1.00.b", "xlnx,opb-timer";
    + interrupt-parent = <&opb_intc_0>;
    + interrupts = < 0 0 >;
    + reg = < 41c00000 10000 >;
    + xlnx,count-width = <20>;
    + xlnx,gen0-assert = <1>;
    + xlnx,gen1-assert = <1>;
    + xlnx,one-timer-only = <1>;
    + xlnx,trig0-assert = <1>;
    + xlnx,trig1-assert = <1>;
    + } ;
    + } ;
    +} ;
    --
    1.5.4.rc4.14.g6fc74

    --
    To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
    the body of a message to majordomo@vger.kernel.org
    More majordomo info at http://vger.kernel.org/majordomo-info.html
    Please read the FAQ at http://www.tux.org/lkml/

  14. [PATCH 37/52] [microblaze] headers for executables format FLAT, ELF

    From: Michal Simek


    Signed-off-by: Michal Simek
    ---
    include/asm-microblaze/elf.h | 24 +++++++++++
    include/asm-microblaze/flat.h | 93 +++++++++++++++++++++++++++++++++++++++++
    2 files changed, 117 insertions(+), 0 deletions(-)
    create mode 100644 include/asm-microblaze/elf.h
    create mode 100644 include/asm-microblaze/flat.h

    diff --git a/include/asm-microblaze/elf.h b/include/asm-microblaze/elf.h
    new file mode 100644
    index 0000000..8b95630
    --- /dev/null
    +++ b/include/asm-microblaze/elf.h
    @@ -0,0 +1,24 @@
    +/*
    + * include/asm-microblaze/elf.h
    + *
    + * This file is subject to the terms and conditions of the GNU General Public
    + * License. See the file "COPYING" in the main directory of this archive
    + * for more details.
    + *
    + * Copyright (C) 2006 Atmark Techno, Inc.
    + */
    +
    +#ifndef _ASM_ELF_H
    +#define _ASM_ELF_H
    +
    +#define EM_XILINX_MICROBLAZE 0xbaab
    +#define ELF_ARCH EM_XILINX_MICROBLAZE
    +
    +#define elf_check_arch(x) ((x)->e_machine == EM_XILINX_MICROBLAZE)
    +
    +/*
    + * These are used to set parameters in the core dumps.
    + */
    +#define ELF_CLASS ELFCLASS32
    +
    +#endif /* _ASM_ELF_H */
    diff --git a/include/asm-microblaze/flat.h b/include/asm-microblaze/flat.h
    new file mode 100644
    index 0000000..1f50a97
    --- /dev/null
    +++ b/include/asm-microblaze/flat.h
    @@ -0,0 +1,93 @@
    +/*
    + * include/asm-microblaze/flat.h
    + *
    + * uClinux flat-format executables
    + *
    + * Copyright (C) 2005 John Williams
    + *
    + * This file is subject to the terms and conditions of the GNU General
    + * Public License. See the file COPYING in the main directory of this
    + * archive for more details.
    + *
    + */
    +
    +#ifndef _MICROBLAZE_FLAT_H
    +#define _MICROBLAZE_FLAT_H
    +
    +#include
    +
    +#define flat_stack_align(sp) /* nothing needed */
    +#define flat_argvp_envp_on_stack() 0
    +#define flat_old_ram_flag(flags) (flags)
    +#define flat_reloc_valid(reloc, size) ((reloc) <= (size))
    +#define flat_set_persistent(relval, p) 0
    +
    +/*
    + * Microblaze works a little differently from other arches, because
    + * of the MICROBLAZE_64 reloc type. Here, a 32 bit address is split
    + * over two instructions, an 'imm' instruction which provides the top
    + * 16 bits, then the instruction "proper" which provides the low 16
    + * bits.
    + */
    +
    +/*
    + * Crack open a symbol reference and extract the address to be
    + * relocated. rp is a potentially unaligned pointer to the
    + * reference
    + */
    +
    +static inline unsigned long
    +flat_get_addr_from_rp(unsigned long *rp, unsigned long relval,
    + unsigned long flags, unsigned long *persistent)
    +{
    + unsigned long addr;
    + (void)flags;
    +
    + /* Is it a split 64/32 reference? */
    + if (relval & 0x80000000) {
    + /* Grab the two halves of the reference */
    + unsigned long val_hi, val_lo;
    +
    + val_hi = get_unaligned(rp);
    + val_lo = get_unaligned(rp+1);
    +
    + /* Crack the address out */
    + addr = ((val_hi & 0xffff) << 16) + (val_lo & 0xffff);
    + } else {
    + /* Get the address straight out */
    + addr = get_unaligned(rp);
    + }
    +
    + return addr;
    +}
    +
    +/*
    + * Insert an address into the symbol reference at rp. rp is potentially
    + * unaligned.
    + */
    +
    +static inline void
    +flat_put_addr_at_rp(unsigned long *rp, unsigned long addr, unsigned long relval)
    +{
    + /* Is this a split 64/32 reloc? */
    + if (relval & 0x80000000) {
    + /* Get the two "halves" */
    + unsigned long val_hi = get_unaligned(rp);
    + unsigned long val_lo = get_unaligned(rp + 1);
    +
    + /* insert the address */
    + val_hi = (val_hi & 0xffff0000) | addr >> 16;
    + val_lo = (val_lo & 0xffff0000) | (addr & 0xffff);
    +
    + /* store the two halves back into memory */
    + put_unaligned(val_hi, rp);
    + put_unaligned(val_lo, rp+1);
    + } else {
    + /* Put it straight in, no messing around */
    + put_unaligned(addr, rp);
    + }
    +}
    +
    +#define flat_get_relocate_addr(rel) (rel & 0x7fffffff)
    +
    +#endif /* _MICROBLAZE_FLAT_H */
    --
    1.5.4.rc4.14.g6fc74

    --
    To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
    the body of a message to majordomo@vger.kernel.org
    More majordomo info at http://vger.kernel.org/majordomo-info.html
    Please read the FAQ at http://www.tux.org/lkml/

  15. [PATCH 14/52] [microblaze] defconfig file

    From: Michal Simek


    Signed-off-by: Michal Simek
    ---
    arch/microblaze/defconfig | 449 +++++++++++++++++++++++++++++++++++++++++++++
    1 files changed, 449 insertions(+), 0 deletions(-)
    create mode 100644 arch/microblaze/defconfig

    diff --git a/arch/microblaze/defconfig b/arch/microblaze/defconfig
    new file mode 100644
    index 0000000..ea25a7b
    --- /dev/null
    +++ b/arch/microblaze/defconfig
    @@ -0,0 +1,449 @@
    +#
    +# Automatically generated make config: don't edit
    +# Linux kernel version: 2.6.24-rc5
    +# Fri Dec 21 12:18:34 2007
    +#
    +CONFIG_MICROBLAZE=y
    +# CONFIG_MMU is not set
    +# CONFIG_SWAP is not set
    +CONFIG_RWSEM_GENERIC_SPINLOCK=y
    +# CONFIG_ARCH_HAS_ILOG2_U32 is not set
    +# CONFIG_ARCH_HAS_ILOG2_U64 is not set
    +CONFIG_GENERIC_FIND_NEXT_BIT=y
    +CONFIG_GENERIC_HWEIGHT=y
    +CONFIG_GENERIC_HARDIRQS=y
    +CONFIG_GENERIC_IRQ_PROBE=y
    +CONFIG_GENERIC_CALIBRATE_DELAY=y
    +# CONFIG_PCI is not set
    +CONFIG_UID16=y
    +CONFIG_DEFCONFIG_LIST="arch/$ARCH/defconfig"
    +
    +#
    +# General setup
    +#
    +# CONFIG_EXPERIMENTAL is not set
    +CONFIG_BROKEN_ON_SMP=y
    +CONFIG_INIT_ENV_ARG_LIMIT=32
    +CONFIG_LOCALVERSION=""
    +# CONFIG_LOCALVERSION_AUTO is not set
    +# CONFIG_SYSVIPC is not set
    +# CONFIG_BSD_PROCESS_ACCT is not set
    +# CONFIG_IKCONFIG is not set
    +CONFIG_LOG_BUF_SHIFT=14
    +# CONFIG_CGROUPS is not set
    +CONFIG_FAIR_GROUP_SCHED=y
    +CONFIG_FAIR_USER_SCHED=y
    +# CONFIG_FAIR_CGROUP_SCHED is not set
    +# CONFIG_SYSFS_DEPRECATED is not set
    +# CONFIG_RELAY is not set
    +# CONFIG_BLK_DEV_INITRD is not set
    +CONFIG_SYSCTL=y
    +CONFIG_EMBEDDED=y
    +CONFIG_SYSCTL_SYSCALL=y
    +# CONFIG_KALLSYMS is not set
    +# CONFIG_HOTPLUG is not set
    +CONFIG_PRINTK=y
    +# CONFIG_BUG is not set
    +CONFIG_ELF_CORE=y
    +# CONFIG_BASE_FULL is not set
    +# CONFIG_FUTEX is not set
    +CONFIG_ANON_INODES=y
    +# CONFIG_EPOLL is not set
    +CONFIG_SIGNALFD=y
    +CONFIG_EVENTFD=y
    +CONFIG_VM_EVENT_COUNTERS=y
    +CONFIG_SLAB=y
    +# CONFIG_SLUB is not set
    +# CONFIG_SLOB is not set
    +CONFIG_TINY_SHMEM=y
    +CONFIG_BASE_SMALL=1
    +CONFIG_MODULES=y
    +CONFIG_MODULE_UNLOAD=y
    +# CONFIG_MODVERSIONS is not set
    +# CONFIG_MODULE_SRCVERSION_ALL is not set
    +# CONFIG_KMOD is not set
    +CONFIG_BLOCK=y
    +# CONFIG_LBD is not set
    +# CONFIG_BLK_DEV_IO_TRACE is not set
    +# CONFIG_LSF is not set
    +
    +#
    +# IO Schedulers
    +#
    +CONFIG_IOSCHED_NOOP=y
    +CONFIG_IOSCHED_AS=y
    +CONFIG_IOSCHED_DEADLINE=y
    +CONFIG_IOSCHED_CFQ=y
    +# CONFIG_DEFAULT_AS is not set
    +# CONFIG_DEFAULT_DEADLINE is not set
    +CONFIG_DEFAULT_CFQ=y
    +# CONFIG_DEFAULT_NOOP is not set
    +CONFIG_DEFAULT_IOSCHED="cfq"
    +
    +#
    +# Platform options
    +#
    +CONFIG_PLATFORM_GENERIC=y
    +CONFIG_ALLOW_EDIT_AUTO=y
    +
    +#
    +# Automatic platform settings from Kconfig.auto
    +#
    +CONFIG_KERNEL_BASE_ADDR=0x44000000
    +CONFIG_XILINX_ERAM_SIZE=0x02000000
    +
    +#
    +# Definitions for MICROBLAZE0
    +#
    +CONFIG_XILINX_MICROBLAZE0_FAMILY="spartan3e"
    +CONFIG_XILINX_MICROBLAZE0_HW_VER="5.00.c"
    +CONFIG_XILINX_MICROBLAZE0_USE_MSR_INSTR=1
    +CONFIG_XILINX_MICROBLAZE0_USE_BARREL=1
    +CONFIG_XILINX_MICROBLAZE0_USE_DIV=1
    +CONFIG_XILINX_MICROBLAZE0_USE_HW_MUL=1
    +CONFIG_XILINX_MICROBLAZE0_USE_FPU=0
    +
    +#
    +# Processor type and features
    +#
    +# CONFIG_PREEMPT is not set
    +# CONFIG_XILINX_UNCACHED_SHADOW is not set
    +# CONFIG_LARGE_ALLOCS is not set
    +
    +#
    +# Boot options
    +#
    +CONFIG_CMDLINE="root=/dev/mtdblock0"
    +CONFIG_CMDLINE_FORCE=y
    +CONFIG_OF=y
    +CONFIG_OF_DEVICE=y
    +CONFIG_FLATMEM=y
    +CONFIG_FLAT_NODE_MEM_MAP=y
    +# CONFIG_SPARSEMEM_STATIC is not set
    +# CONFIG_SPARSEMEM_VMEMMAP_ENABLE is not set
    +CONFIG_SPLIT_PTLOCK_CPUS=4
    +# CONFIG_RESOURCES_64BIT is not set
    +CONFIG_ZONE_DMA_FLAG=0
    +CONFIG_VIRT_TO_BUS=y
    +
    +#
    +# Exectuable file formats
    +#
    +CONFIG_BINFMT_FLAT=y
    +# CONFIG_BINFMT_ZFLAT is not set
    +# CONFIG_BINFMT_SHARED_FLAT is not set
    +# CONFIG_BINFMT_MISC is not set
    +
    +#
    +# Networking
    +#
    +# CONFIG_NET is not set
    +
    +#
    +# Device Drivers
    +#
    +
    +#
    +# Generic Driver Options
    +#
    +CONFIG_STANDALONE=y
    +# CONFIG_PREVENT_FIRMWARE_BUILD is not set
    +# CONFIG_SYS_HYPERVISOR is not set
    +CONFIG_MTD=y
    +# CONFIG_MTD_DEBUG is not set
    +CONFIG_MTD_CONCAT=y
    +CONFIG_MTD_PARTITIONS=y
    +# CONFIG_MTD_REDBOOT_PARTS is not set
    +CONFIG_MTD_CMDLINE_PARTS=y
    +
    +#
    +# User Modules And Translation Layers
    +#
    +CONFIG_MTD_CHAR=y
    +CONFIG_MTD_BLKDEVS=y
    +CONFIG_MTD_BLOCK=y
    +# CONFIG_FTL is not set
    +# CONFIG_NFTL is not set
    +# CONFIG_INFTL is not set
    +# CONFIG_RFD_FTL is not set
    +# CONFIG_SSFDC is not set
    +# CONFIG_MTD_OOPS is not set
    +
    +#
    +# RAM/ROM/Flash chip drivers
    +#
    +CONFIG_MTD_CFI=y
    +# CONFIG_MTD_JEDECPROBE is not set
    +CONFIG_MTD_GEN_PROBE=y
    +# CONFIG_MTD_CFI_ADV_OPTIONS is not set
    +CONFIG_MTD_MAP_BANK_WIDTH_1=y
    +CONFIG_MTD_MAP_BANK_WIDTH_2=y
    +CONFIG_MTD_MAP_BANK_WIDTH_4=y
    +# CONFIG_MTD_MAP_BANK_WIDTH_8 is not set
    +# CONFIG_MTD_MAP_BANK_WIDTH_16 is not set
    +# CONFIG_MTD_MAP_BANK_WIDTH_32 is not set
    +CONFIG_MTD_CFI_I1=y
    +CONFIG_MTD_CFI_I2=y
    +# CONFIG_MTD_CFI_I4 is not set
    +# CONFIG_MTD_CFI_I8 is not set
    +CONFIG_MTD_CFI_INTELEXT=y
    +CONFIG_MTD_CFI_AMDSTD=y
    +# CONFIG_MTD_CFI_STAA is not set
    +CONFIG_MTD_CFI_UTIL=y
    +CONFIG_MTD_RAM=y
    +# CONFIG_MTD_ROM is not set
    +# CONFIG_MTD_ABSENT is not set
    +
    +#
    +# Mapping drivers for chip access
    +#
    +# CONFIG_MTD_COMPLEX_MAPPINGS is not set
    +# CONFIG_MTD_PHYSMAP is not set
    +CONFIG_MTD_UCLINUX=y
    +# CONFIG_MTD_PLATRAM is not set
    +
    +#
    +# Self-contained MTD device drivers
    +#
    +# CONFIG_MTD_SLRAM is not set
    +# CONFIG_MTD_PHRAM is not set
    +# CONFIG_MTD_MTDRAM is not set
    +# CONFIG_MTD_BLOCK2MTD is not set
    +
    +#
    +# Disk-On-Chip Device Drivers
    +#
    +# CONFIG_MTD_DOC2000 is not set
    +# CONFIG_MTD_DOC2001 is not set
    +# CONFIG_MTD_DOC2001PLUS is not set
    +# CONFIG_MTD_NAND is not set
    +# CONFIG_MTD_ONENAND is not set
    +
    +#
    +# UBI - Unsorted block images
    +#
    +# CONFIG_MTD_UBI is not set
    +# CONFIG_PARPORT is not set
    +CONFIG_BLK_DEV=y
    +# CONFIG_BLK_DEV_COW_COMMON is not set
    +# CONFIG_BLK_DEV_LOOP is not set
    +CONFIG_BLK_DEV_RAM=y
    +CONFIG_BLK_DEV_RAM_COUNT=16
    +CONFIG_BLK_DEV_RAM_SIZE=8192
    +CONFIG_BLK_DEV_RAM_BLOCKSIZE=1024
    +# CONFIG_CDROM_PKTCDVD is not set
    +CONFIG_MISC_DEVICES=y
    +# CONFIG_EEPROM_93CX6 is not set
    +# CONFIG_IDE is not set
    +
    +#
    +# SCSI device support
    +#
    +# CONFIG_RAID_ATTRS is not set
    +# CONFIG_SCSI is not set
    +# CONFIG_SCSI_DMA is not set
    +# CONFIG_SCSI_NETLINK is not set
    +# CONFIG_ATA is not set
    +# CONFIG_MD is not set
    +# CONFIG_PHONE is not set
    +
    +#
    +# Input device support
    +#
    +# CONFIG_INPUT is not set
    +
    +#
    +# Hardware I/O ports
    +#
    +# CONFIG_SERIO is not set
    +# CONFIG_GAMEPORT is not set
    +
    +#
    +# Character devices
    +#
    +# CONFIG_VT is not set
    +# CONFIG_SERIAL_NONSTANDARD is not set
    +
    +#
    +# Serial drivers
    +#
    +# CONFIG_SERIAL_8250 is not set
    +
    +#
    +# Non-8250 serial port support
    +#
    +CONFIG_SERIAL_UARTLITE_CONSOLE=y
    +CONFIG_SERIAL_UARTLITE=y
    +CONFIG_SERIAL_CORE=y
    +CONFIG_SERIAL_CORE_CONSOLE=y
    +CONFIG_UNIX98_PTYS=y
    +CONFIG_LEGACY_PTYS=y
    +CONFIG_LEGACY_PTY_COUNT=256
    +# CONFIG_IPMI_HANDLER is not set
    +CONFIG_HW_RANDOM=y
    +# CONFIG_RTC is not set
    +# CONFIG_GEN_RTC is not set
    +# CONFIG_R3964 is not set
    +# CONFIG_RAW_DRIVER is not set
    +# CONFIG_I2C is not set
    +
    +#
    +# SPI support
    +#
    +# CONFIG_SPI is not set
    +# CONFIG_SPI_MASTER is not set
    +# CONFIG_W1 is not set
    +# CONFIG_POWER_SUPPLY is not set
    +# CONFIG_HWMON is not set
    +# CONFIG_WATCHDOG is not set
    +
    +#
    +# Sonics Silicon Backplane
    +#
    +CONFIG_SSB_POSSIBLE=y
    +# CONFIG_SSB is not set
    +
    +#
    +# Multifunction device drivers
    +#
    +# CONFIG_MFD_SM501 is not set
    +
    +#
    +# Multimedia devices
    +#
    +# CONFIG_VIDEO_DEV is not set
    +CONFIG_DAB=y
    +
    +#
    +# Graphics support
    +#
    +# CONFIG_VGASTATE is not set
    +CONFIG_VIDEO_OUTPUT_CONTROL=y
    +# CONFIG_FB is not set
    +# CONFIG_BACKLIGHT_LCD_SUPPORT is not set
    +
    +#
    +# Display device support
    +#
    +# CONFIG_DISPLAY_SUPPORT is not set
    +
    +#
    +# Sound
    +#
    +# CONFIG_SOUND is not set
    +CONFIG_USB_SUPPORT=y
    +# CONFIG_USB_ARCH_HAS_HCD is not set
    +# CONFIG_USB_ARCH_HAS_OHCI is not set
    +# CONFIG_USB_ARCH_HAS_EHCI is not set
    +
    +#
    +# NOTE: USB_STORAGE enables SCSI, and 'SCSI disk support'
    +#
    +
    +#
    +# USB Gadget Support
    +#
    +# CONFIG_USB_GADGET is not set
    +# CONFIG_MMC is not set
    +# CONFIG_NEW_LEDS is not set
    +# CONFIG_RTC_CLASS is not set
    +
    +#
    +# Userspace I/O
    +#
    +# CONFIG_UIO is not set
    +
    +#
    +# File systems
    +#
    +# CONFIG_EXT2_FS is not set
    +# CONFIG_EXT3_FS is not set
    +# CONFIG_REISERFS_FS is not set
    +# CONFIG_JFS_FS is not set
    +# CONFIG_FS_POSIX_ACL is not set
    +# CONFIG_XFS_FS is not set
    +# CONFIG_MINIX_FS is not set
    +CONFIG_ROMFS_FS=y
    +# CONFIG_INOTIFY is not set
    +# CONFIG_QUOTA is not set
    +# CONFIG_DNOTIFY is not set
    +# CONFIG_AUTOFS_FS is not set
    +# CONFIG_AUTOFS4_FS is not set
    +# CONFIG_FUSE_FS is not set
    +
    +#
    +# CD-ROM/DVD Filesystems
    +#
    +# CONFIG_ISO9660_FS is not set
    +# CONFIG_UDF_FS is not set
    +
    +#
    +# DOS/FAT/NT Filesystems
    +#
    +# CONFIG_MSDOS_FS is not set
    +# CONFIG_VFAT_FS is not set
    +# CONFIG_NTFS_FS is not set
    +
    +#
    +# Pseudo filesystems
    +#
    +CONFIG_PROC_FS=y
    +CONFIG_PROC_SYSCTL=y
    +CONFIG_SYSFS=y
    +# CONFIG_TMPFS is not set
    +# CONFIG_HUGETLB_PAGE is not set
    +
    +#
    +# Miscellaneous filesystems
    +#
    +# CONFIG_HFSPLUS_FS is not set
    +# CONFIG_JFFS2_FS is not set
    +CONFIG_CRAMFS=y
    +# CONFIG_VXFS_FS is not set
    +# CONFIG_HPFS_FS is not set
    +# CONFIG_QNX4FS_FS is not set
    +# CONFIG_SYSV_FS is not set
    +# CONFIG_UFS_FS is not set
    +
    +#
    +# Partition Types
    +#
    +# CONFIG_PARTITION_ADVANCED is not set
    +CONFIG_MSDOS_PARTITION=y
    +# CONFIG_NLS is not set
    +
    +#
    +# Kernel hacking
    +#
    +# CONFIG_PRINTK_TIME is not set
    +CONFIG_ENABLE_WARN_DEPRECATED=y
    +# CONFIG_ENABLE_MUST_CHECK is not set
    +# CONFIG_MAGIC_SYSRQ is not set
    +# CONFIG_UNUSED_SYMBOLS is not set
    +# CONFIG_DEBUG_FS is not set
    +# CONFIG_HEADERS_CHECK is not set
    +# CONFIG_DEBUG_KERNEL is not set
    +# CONFIG_SAMPLES is not set
    +CONFIG_EARLY_PRINTK=y
    +CONFIG_EARLY_PRINTK_UARTLITE_ADDRESS=0x40600000
    +
    +#
    +# Security options
    +#
    +# CONFIG_KEYS is not set
    +# CONFIG_SECURITY is not set
    +# CONFIG_CRYPTO is not set
    +
    +#
    +# Library routines
    +#
    +# CONFIG_CRC_CCITT is not set
    +# CONFIG_CRC16 is not set
    +# CONFIG_CRC_ITU_T is not set
    +# CONFIG_CRC32 is not set
    +# CONFIG_CRC7 is not set
    +# CONFIG_LIBCRC32C is not set
    +CONFIG_ZLIB_INFLATE=y
    +CONFIG_HAS_IOMEM=y
    +CONFIG_HAS_IOPORT=y
    +CONFIG_HAS_DMA=y
    --
    1.5.4.rc4.14.g6fc74

    --
    To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
    the body of a message to majordomo@vger.kernel.org
    More majordomo info at http://vger.kernel.org/majordomo-info.html
    Please read the FAQ at http://www.tux.org/lkml/

  16. [PATCH 17/52] [microblaze] checksum support

    From: Michal Simek


    Signed-off-by: Michal Simek
    ---
    arch/microblaze/lib/checksum.c | 159 +++++++++++++++++++++++++++++++++++++
    include/asm-microblaze/checksum.h | 101 +++++++++++++++++++++++
    2 files changed, 260 insertions(+), 0 deletions(-)
    create mode 100644 arch/microblaze/lib/checksum.c
    create mode 100644 include/asm-microblaze/checksum.h

    diff --git a/arch/microblaze/lib/checksum.c b/arch/microblaze/lib/checksum.c
    new file mode 100644
    index 0000000..21a6830
    --- /dev/null
    +++ b/arch/microblaze/lib/checksum.c
    @@ -0,0 +1,159 @@
    +/*
    + * INET An implementation of the TCP/IP protocol suite for the LINUX
    + * operating system. INET is implemented using the BSD Socket
    + * interface as the means of communication with the user level.
    + *
    + * IP/TCP/UDP checksumming routines
    + *
    + * Authors: Jorge Cwik,
    + * Arnt Gulbrandsen,
    + * Tom May,
    + * Andreas Schwab,
    + * Lots of code moved from tcp.c and ip.c; see those files
    + * for more names.
    + *
    + * 03/02/96 Jes Sorensen, Andreas Schwab, Roman Hodek:
    + * Fixed some nasty bugs, causing some horrible crashes.
    + * A: At some points, the sum (%0) was used as
    + * length-counter instead of the length counter
    + * (%1). Thanks to Roman Hodek for pointing this out.
    + * B: GCC seems to mess up if one uses too many
    + * data-registers to hold input values and one tries to
    + * specify d0 and d1 as scratch registers. Letting gcc choose these
    + * registers itself solves the problem.
    + *
    + * This program is free software; you can redistribute it and/or
    + * modify it under the terms of the GNU General Public License
    + * as published by the Free Software Foundation; either version
    + * 2 of the License, or (at your option) any later version.
    + */
    +
    +/* Revised by Kenneth Albanowski for m68knommu. Basic problem: unaligned access
    + kills, so most of the assembly has to go. */
    +
    +#include
    +#include
    +
    +static inline unsigned short from32to16(unsigned long x)
    +{
    + /* add up 16-bit and 16-bit for 16+c bit */
    + x = (x & 0xffff) + (x >> 16);
    + /* add up carry.. */
    + x = (x & 0xffff) + (x >> 16);
    + return x;
    +}
    +
    +static unsigned long do_csum(const unsigned char *buff, int len)
    +{
    + int odd, count;
    + unsigned long result = 0;
    +
    + if (len <= 0)
    + goto out;
    + odd = 1 & (unsigned long) buff;
    + if (odd) {
    + result = *buff;
    + len--;
    + buff++;
    + }
    + count = len >> 1; /* nr of 16-bit words.. */
    + if (count) {
    + if (2 & (unsigned long) buff) {
    + result += *(unsigned short *) buff;
    + count--;
    + len -= 2;
    + buff += 2;
    + }
    + count >>= 1; /* nr of 32-bit words.. */
    + if (count) {
    + unsigned long carry = 0;
    + do {
    + unsigned long w = *(unsigned long *) buff;
    + count--;
    + buff += 4;
    + result += carry;
    + result += w;
    + carry = (w > result);
    + } while (count);
    + result += carry;
    + result = (result & 0xffff) + (result >> 16);
    + }
    + if (len & 2) {
    + result += *(unsigned short *) buff;
    + buff += 2;
    + }
    + }
    + if (len & 1)
    + result += (*buff << 8);
    + result = from32to16(result);
    + if (odd)
    + result = ((result >> 8) & 0xff) | ((result & 0xff) << 8);
    +out:
    + return result;
    +}
    +
    +/*
    + * This is a version of ip_compute_csum() optimized for IP headers,
    + * which always checksum on 4 octet boundaries.
    + */
    +unsigned short ip_fast_csum(unsigned char *iph, unsigned int ihl)
    +{
    + return ~do_csum(iph, ihl*4);
    +}
    +
    +/*
    + * computes the checksum of a memory block at buff, length len,
    + * and adds in "sum" (32-bit)
    + *
    + * returns a 32-bit number suitable for feeding into itself
    + * or csum_tcpudp_magic
    + *
    + * this function must be called with even lengths, except
    + * for the last fragment, which may be odd
    + *
    + * it's best to have buff aligned on a 32-bit boundary
    + */
    +unsigned int csum_partial(const unsigned char *buff, int len, unsigned int sum)
    +{
    + unsigned int result = do_csum(buff, len);
    +
    + /* add in old sum, and carry.. */
    + result += sum;
    + if (sum > result)
    + result += 1;
    + return result;
    +}
    +
    +/*
    + * this routine is used for miscellaneous IP-like checksums, mainly
    + * in icmp.c
    + */
    +unsigned short ip_compute_csum(const unsigned char *buff, int len)
    +{
    + return ~do_csum(buff, len);
    +}
    +
    + /*
    + * copy from fs while checksumming, otherwise like csum_partial
    + */
    +
    +unsigned int
    +csum_partial_copy_from_user(const char *src, char *dst, int len, int sum,
    + int *csum_err)
    +{
    + if (csum_err)
    + *csum_err = 0;
    + memcpy(dst, src, len);
    + return csum_partial(dst, len, sum);
    +}
    +
    +/*
    + * copy from ds while checksumming, otherwise like csum_partial
    + */
    +
    +unsigned int
    +csum_partial_copy(const char *src, char *dst, int len, int sum)
    +{
    + memcpy(dst, src, len);
    + return csum_partial(dst, len, sum);
    +}
    diff --git a/include/asm-microblaze/checksum.h b/include/asm-microblaze/checksum.h
    new file mode 100644
    index 0000000..4b37bb5
    --- /dev/null
    +++ b/include/asm-microblaze/checksum.h
    @@ -0,0 +1,101 @@
    +/*
    + * include/asm-microblaze/checksum.h
    + *
    + * This file is subject to the terms and conditions of the GNU General Public
    + * License. See the file "COPYING" in the main directory of this archive
    + * for more details.
    + *
    + * Copyright (C) 2006 Atmark Techno, Inc.
    + */
    +
    +#ifndef _ASM_CHECKSUM_H
    +#define _ASM_CHECKSUM_H
    +
    +#include
    +
    +/*
    + * computes the checksum of a memory block at buff, length len,
    + * and adds in "sum" (32-bit)
    + *
    + * returns a 32-bit number suitable for feeding into itself
    + * or csum_tcpudp_magic
    + *
    + * this function must be called with even lengths, except
    + * for the last fragment, which may be odd
    + *
    + * it's best to have buff aligned on a 32-bit boundary
    + */
    +unsigned int csum_partial(const unsigned char *buff, int len,
    + unsigned int sum);
    +
    +/*
    + * the same as csum_partial, but copies from src while it
    + * checksums
    + *
    + * here even more important to align src and dst on a 32-bit (or even
    + * better 64-bit) boundary
    + */
    +unsigned int csum_partial_copy(const char *src, char *dst, int len, int sum);
    +
    +/*
    + * the same as csum_partial_copy, but copies from user space.
    + *
    + * here even more important to align src and dst on a 32-bit (or even
    + * better 64-bit) boundary
    + */
    +extern unsigned int csum_partial_copy_from_user(const char *src, char *dst,
    + int len, int sum, int *csum_err);
    +
    +#define csum_partial_copy_nocheck(src, dst, len, sum) \
    + csum_partial_copy((src), (dst), (len), (sum))
    +
    +/*
    + * This is a version of ip_compute_csum() optimized for IP headers,
    + * which always checksum on 4 octet boundaries.
    + *
    + */
    +extern unsigned short ip_fast_csum(unsigned char *iph, unsigned int ihl);
    +
    +/*
    + * Fold a partial checksum
    + */
    +static inline unsigned int csum_fold(unsigned int sum)
    +{
    + sum = (sum & 0xffff) + (sum >> 16);
    + sum = (sum & 0xffff) + (sum >> 16);
    + return ~sum;
    +}
    +
    +/*
    + * computes the checksum of the TCP/UDP pseudo-header
    + * returns a 16-bit checksum, already complemented
    + */
    +static inline unsigned int
    +csum_tcpudp_nofold(unsigned long saddr, unsigned long daddr, unsigned short len,
    + unsigned short proto, unsigned int sum)
    +{
    + __asm__("add %0, %4, %1\n\t"
    + "addc %0, %4, %2\n\t"
    + "addc %0, %4, %3\n\t"
    + "addc %0, %4, r0\n\t"
    + : "=d" (sum)
    + : "d" (saddr), "d" (daddr), "d" (len + proto),
    + "0"(sum));
    +
    + return sum;
    +}
    +
    +static inline unsigned short int
    +csum_tcpudp_magic(unsigned long saddr, unsigned long daddr, unsigned short len,
    + unsigned short proto, unsigned int sum)
    +{
    + return csum_fold(csum_tcpudp_nofold(saddr, daddr, len, proto, sum));
    +}
    +
    +/*
    + * this routine is used for miscellaneous IP-like checksums, mainly
    + * in icmp.c
    + */
    +extern unsigned short ip_compute_csum(const unsigned char *buff, int len);
    +
    +#endif /* _ASM_CHECKSUM_H */
    --
    1.5.4.rc4.14.g6fc74

    --
    To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
    the body of a message to majordomo@vger.kernel.org
    More majordomo info at http://vger.kernel.org/majordomo-info.html
    Please read the FAQ at http://www.tux.org/lkml/

  17. [PATCH 26/52] [microblaze] IPC support

    From: Michal Simek


    Signed-off-by: Michal Simek
    ---
    arch/microblaze/kernel/sys_microblaze.c | 331 +++++++++++++++++++++++++++++++
    include/asm-microblaze/ipc.h | 18 ++
    include/asm-microblaze/ipcbuf.h | 38 ++++
    3 files changed, 387 insertions(+), 0 deletions(-)
    create mode 100644 arch/microblaze/kernel/sys_microblaze.c
    create mode 100644 include/asm-microblaze/ipc.h
    create mode 100644 include/asm-microblaze/ipcbuf.h

    diff --git a/arch/microblaze/kernel/sys_microblaze.c b/arch/microblaze/kernel/sys_microblaze.c
    new file mode 100644
    index 0000000..a14328f
    --- /dev/null
    +++ b/arch/microblaze/kernel/sys_microblaze.c
    @@ -0,0 +1,331 @@
    +/*
    + * arch/microblaze/kernel/sys_microblaze.c
    + *
    + * This file is subject to the terms and conditions of the GNU General Public
    + * License. See the file "COPYING" in the main directory of this archive
    + * for more details.
    + *
    + * Copyright (C) 2006 Atmark Techno, Inc.
    + * Copyright (C) 2007 PetaLogix
    + *
    + * Authors:
    + * John Williams
    + * Yasushi SHOJI
    + * Tetsuya OHKAWA
    + */
    +
    +#include
    +#include
    +#include
    +#include
    +#include
    +#include
    +#include
    +#include
    +#include
    +#include
    +#include
    +#include
    +#include
    +#include
    +#include
    +#include
    +#include
    +
    +#include
    +#include
    +#include
    +#include
    +
    +/*
    + * sys_ipc() is the de-multiplexer for the SysV IPC calls..
    + *
    + * This is really horribly ugly.
    + */
    +int
    +sys_ipc(uint call, int first, int second, int third, void *ptr, long fifth)
    +{
    + int version, ret;
    +
    + version = call >> 16; /* hack for backward compatibility */
    + call &= 0xffff;
    +
    + ret = -EINVAL;
    + switch (call) {
    + case SEMOP:
    + ret = sys_semop(first, (struct sembuf *)ptr, second);
    + break;
    + case SEMGET:
    + ret = sys_semget(first, second, third);
    + break;
    + case SEMCTL:
    + {
    + union semun fourth;
    +
    + if (!ptr)
    + break;
    + if ((ret = access_ok(VERIFY_READ, ptr,
    + sizeof(long)) ? 0 : -EFAULT)
    + || (ret = get_user(fourth.__pad, (void **)ptr)))
    + break;
    + ret = sys_semctl(first, second, third, fourth);
    + break;
    + }
    + case MSGSND:
    + ret = sys_msgsnd(first, (struct msgbuf *) ptr, second, third);
    + break;
    + case MSGRCV:
    + switch (version) {
    + case 0: {
    + struct ipc_kludge tmp;
    +
    + if (!ptr)
    + break;
    + if ((ret = access_ok(VERIFY_READ, ptr,
    + sizeof(tmp)) ? 0 : -EFAULT)
    + || (ret = copy_from_user(&tmp,
    + (struct ipc_kludge *) ptr,
    + sizeof(tmp))))
    + break;
    + ret = sys_msgrcv(first, tmp.msgp, second, tmp.msgtyp,
    + third);
    + break;
    + }
    + default:
    + ret = sys_msgrcv(first, (struct msgbuf *) ptr,
    + second, fifth, third);
    + break;
    + }
    + break;
    + case MSGGET:
    + ret = sys_msgget((key_t) first, second);
    + break;
    + case MSGCTL:
    + ret = sys_msgctl(first, second, (struct msqid_ds *) ptr);
    + break;
    + case SHMAT:
    + switch (version) {
    + default: {
    + ulong raddr;
    +
    + if ((ret = access_ok(VERIFY_WRITE, (ulong *) third,
    + sizeof(ulong)) ? 0 : -EFAULT))
    + break;
    + ret = do_shmat(first, (char *) ptr, second, &raddr);
    + if (ret)
    + break;
    + ret = put_user(raddr, (ulong *) third);
    + break;
    + }
    + case 1: /* iBCS2 emulator entry point */
    + if (!segment_eq(get_fs(), get_ds()))
    + break;
    + ret = do_shmat(first, (char *) ptr, second,
    + (ulong *) third);
    + break;
    + }
    + break;
    + case SHMDT:
    + ret = sys_shmdt((char *)ptr);
    + break;
    + case SHMGET:
    + ret = sys_shmget(first, second, third);
    + break;
    + case SHMCTL:
    + ret = sys_shmctl(first, second, (struct shmid_ds *) ptr);
    + break;
    + }
    +
    + return ret;
    +}
    +
    +long execve(const char *filename, char **argv, char **envp)
    +{
    + struct pt_regs regs;
    + int ret;
    +
    + memset(&regs, 0, sizeof(struct pt_regs));
    + local_save_flags(regs.msr);
    + ret = do_execve((char *)filename, (char __user * __user *)argv,
    + (char __user * __user *)envp, &regs);
    +
    + if (ret < 0)
    + goto out;
    +
    + /*
    + * Save argc to the register structure for userspace.
    + */
    + regs.r5 = ret; /* FIXME */
    +
    + /*
    + * We were successful. We won't be returning to our caller, but
    + * instead to user space by manipulating the kernel stack.
    + */
    + asm volatile ("addk r5, r0, %0 \n\t"
    + "addk r6, r0, %1 \n\t"
    + /* copy regs to top of stack */
    + "brlid r15, memmove \n\t"
    + "addik r7, r0, %2 \n\t"
    + "brid ret_to_user \n\t"
    + /* reposition stack pointer */
    + "addk r1, r0, r3 \n\t"
    + :
    + : "r" (task_pt_regs(current)),
    + "r" (&regs),
    + "i" (sizeof(regs))
    + : "r1", "r3", "r5", "r6", "r7", "r15", "memory");
    +
    +out:
    + return ret;
    +}
    +EXPORT_SYMBOL(execve);
    +
    +asmlinkage int sys_vfork(struct pt_regs *regs)
    +{
    + return do_fork(CLONE_VFORK | CLONE_VM | SIGCHLD, regs->r1,
    + regs, 0, NULL, NULL);
    +}
    +
    +asmlinkage int sys_clone(int flags, unsigned long stack, struct pt_regs *regs)
    +{
    + if (!stack)
    + stack = regs->r1;
    + return do_fork(flags, stack, regs, 0, NULL, NULL);
    +}
    +
    +asmlinkage int sys_execve(char __user *filenamei, char __user * __user *argv,
    + char __user * __user *envp, struct pt_regs *regs)
    +{
    + int error;
    + char *filename;
    +
    + filename = getname(filenamei);
    + error = PTR_ERR(filename);
    + if (IS_ERR(filename))
    + goto out;
    + error = do_execve(filename, argv, envp, regs);
    + putname(filename);
    +out:
    + return error;
    +}
    +
    +asmlinkage int sys_pipe(unsigned long __user *fildes)
    +{
    + int fd[2];
    + int error;
    +
    + error = do_pipe(fd);
    + if (!error) {
    + if (copy_to_user(fildes, fd, 2*sizeof(int)))
    + error = -EFAULT;
    + }
    + return error;
    +}
    +
    +static inline unsigned long
    +do_mmap2(unsigned long addr, size_t len,
    + unsigned long prot, unsigned long flags,
    + unsigned long fd, unsigned long pgoff)
    +{
    + struct file *file = NULL;
    + int ret = -EBADF;
    +
    + flags &= ~(MAP_EXECUTABLE | MAP_DENYWRITE);
    + if (!(flags & MAP_ANONYMOUS))
    + if (!(file = fget(fd))) {
    + printk(KERN_INFO "no fd in mmap\r\n");
    + goto out;
    + }
    +
    + down_write(&current->mm->mmap_sem);
    + ret = do_mmap_pgoff(file, addr, len, prot, flags, pgoff);
    + up_write(&current->mm->mmap_sem);
    + if (file)
    + fput(file);
    +out:
    + return ret;
    +}
    +
    +unsigned long sys_mmap2(unsigned long addr, size_t len,
    + unsigned long prot, unsigned long flags,
    + unsigned long fd, unsigned long pgoff)
    +{
    + return do_mmap2(addr, len, prot, flags, fd, pgoff);
    +}
    +
    +unsigned long sys_mmap(unsigned long addr, size_t len,
    + unsigned long prot, unsigned long flags,
    + unsigned long fd, off_t offset)
    +{
    + int err = -EINVAL;
    +
    + if (offset & ~PAGE_MASK) {
    + printk(KERN_INFO "no pagemask in mmap\r\n");
    + goto out;
    + }
    +
    + err = do_mmap2(addr, len, prot, flags, fd, offset >> PAGE_SHIFT);
    +out:
    + return err;
    +}
    +
    +int sys_uname(struct old_utsname *name)
    +{
    + int err = -EFAULT;
    +
    + down_read(&uts_sem);
    + if (name && !copy_to_user(name, utsname(), sizeof(*name)))
    + err = 0;
    + up_read(&uts_sem);
    + return err;
    +}
    +
    +int sys_olduname(struct oldold_utsname *name)
    +{
    + int error;
    +
    + if (!name)
    + return -EFAULT;
    + if (!access_ok(VERIFY_WRITE, name, sizeof(struct oldold_utsname)))
    + return -EFAULT;
    +
    + down_read(&uts_sem);
    + error = __copy_to_user(&name->sysname, utsname()->sysname,
    + __OLD_UTS_LEN);
    + error -= __put_user(0, name->sysname + __OLD_UTS_LEN);
    + error -= __copy_to_user(&name->nodename, utsname()->nodename,
    + __OLD_UTS_LEN);
    + error -= __put_user(0, name->nodename + __OLD_UTS_LEN);
    + error -= __copy_to_user(&name->release, utsname()->release,
    + __OLD_UTS_LEN);
    + error -= __put_user(0, name->release + __OLD_UTS_LEN);
    + error -= __copy_to_user(&name->version, utsname()->version,
    + __OLD_UTS_LEN);
    + error -= __put_user(0, name->version + __OLD_UTS_LEN);
    + error -= __copy_to_user(&name->machine, utsname()->machine,
    + __OLD_UTS_LEN);
    + error = __put_user(0, name->machine + __OLD_UTS_LEN);
    + up_read(&uts_sem);
    +
    + error = error ? -EFAULT : 0;
    + return error;
    +}
    +
    +/*
    + * Do a system call from kernel instead of calling sys_execve so we
    + * end up with proper pt_regs.
    + */
    +int kernel_execve(const char *filename, char *const argv[], char *const envp[])
    +{
    + register const char *__a __asm__("r5") = filename;
    + register const void *__b __asm__("r6") = argv;
    + register const void *__c __asm__("r7") = envp;
    + register unsigned long __syscall __asm__("r12") = __NR_execve;
    + register unsigned long __ret __asm__("r3");
    + __asm__ __volatile__ ("brki r14, 0x8"
    + : "=r" (__ret), "=r" (__syscall)
    + : "1" (__syscall), "r" (__a), "r" (__b), "r" (__c)
    + : "r4", "r8", "r9",
    + "r10", "r11", "r14", "cc", "memory");
    + return __ret;
    +}
    diff --git a/include/asm-microblaze/ipc.h b/include/asm-microblaze/ipc.h
    new file mode 100644
    index 0000000..041b0eb
    --- /dev/null
    +++ b/include/asm-microblaze/ipc.h
    @@ -0,0 +1,18 @@
    +/*
    + * include/asm-microblaze/ipc.h
    + *
    + * This file is subject to the terms and conditions of the GNU General Public
    + * License. See the file "COPYING" in the main directory of this archive
    + * for more details.
    + *
    + * Copyright (C) 2006 Atmark Techno, Inc.
    + */
    +
    +#ifndef _ASM_IPC_H
    +#define _ASM_IPC_H
    +
    +#include
    +
    +#endif /* _ASM_IPC_H */
    +
    +
    diff --git a/include/asm-microblaze/ipcbuf.h b/include/asm-microblaze/ipcbuf.h
    new file mode 100644
    index 0000000..742768d
    --- /dev/null
    +++ b/include/asm-microblaze/ipcbuf.h
    @@ -0,0 +1,38 @@
    +/*
    + * include/asm-microblaze/ipcbuf.h
    + *
    + * This file is subject to the terms and conditions of the GNU General Public
    + * License. See the file "COPYING" in the main directory of this archive
    + * for more details.
    + *
    + * Copyright (C) 2006 Atmark Techno, Inc.
    + */
    +
    +#ifndef _ASM_IPCBUF_H
    +#define _ASM_IPCBUF_H
    +
    +/*
    + * The user_ipc_perm structure for m68k architecture.
    + * Note extra padding because this structure is passed back and forth
    + * between kernel and user space.
    + *
    + * Pad space is left for:
    + * - 32-bit mode_t and seq
    + * - 2 miscellaneous 32-bit values
    + */
    +
    +struct ipc64_perm {
    + __kernel_key_t key;
    + __kernel_uid32_t uid;
    + __kernel_gid32_t gid;
    + __kernel_uid32_t cuid;
    + __kernel_gid32_t cgid;
    + __kernel_mode_t mode;
    + unsigned short __pad1;
    + unsigned short seq;
    + unsigned short __pad2;
    + unsigned long __unused1;
    + unsigned long __unused2;
    +};
    +
    +#endif /* _ASM_IPCBUF_H */
    --
    1.5.4.rc4.14.g6fc74

    --
    To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
    the body of a message to majordomo@vger.kernel.org
    More majordomo info at http://vger.kernel.org/majordomo-info.html
    Please read the FAQ at http://www.tux.org/lkml/

  18. [PATCH 36/52] [microblaze] io.h IO operations

    From: Michal Simek


    Signed-off-by: Michal Simek
    ---
    include/asm-microblaze/io.h | 210 +++++++++++++++++++++++++++++++++++++++++++
    1 files changed, 210 insertions(+), 0 deletions(-)
    create mode 100644 include/asm-microblaze/io.h

    diff --git a/include/asm-microblaze/io.h b/include/asm-microblaze/io.h
    new file mode 100644
    index 0000000..a0a5401
    --- /dev/null
    +++ b/include/asm-microblaze/io.h
    @@ -0,0 +1,210 @@
    +/*
    + * include/asm-microblaze/io.h
    + *
    + * This file is subject to the terms and conditions of the GNU General Public
    + * License. See the file "COPYING" in the main directory of this archive
    + * for more details.
    + *
    + * Copyright (C) 2006 Atmark Techno, Inc.
    + */
    +
    +#ifndef _ASM_IO_H
    +#define _ASM_IO_H
    +
    +#include
    +#include
    +
    +static inline unsigned char __raw_readb(const volatile void *addr)
    +{
    + return *(volatile unsigned char __force *)addr;
    +}
    +static inline unsigned short __raw_readw(const volatile void *addr)
    +{
    + return *(volatile unsigned short __force *)addr;
    +}
    +static inline unsigned int __raw_readl(const volatile void *addr)
    +{
    + return *(volatile unsigned int __force *)addr;
    +}
    +static inline unsigned long __raw_readq(const volatile void *addr)
    +{
    + return *(volatile unsigned long __force *)addr;
    +}
    +static inline void __raw_writeb(unsigned char v, volatile void *addr)
    +{
    + *(volatile unsigned char __force *)addr = v;
    +}
    +static inline void __raw_writew(unsigned short v, volatile void *addr)
    +{
    + *(volatile unsigned short __force *)addr = v;
    +}
    +static inline void __raw_writel(unsigned int v, volatile void *addr)
    +{
    + *(volatile unsigned int __force *)addr = v;
    +}
    +static inline void __raw_writeq(unsigned long v, volatile void *addr)
    +{
    + *(volatile unsigned long __force *)addr = v;
    +}
    +
    +/*
    + * read (readb, readw, readl, readq) and write (writeb, writew,
    + * writel, writeq) accessors are for PCI and thus littel endian.
    + * Linux 2.4 for Microblaze had this wrong.
    + */
    +static inline unsigned char readb(const volatile void *addr)
    +{
    + return *(volatile unsigned char __force *)addr;
    +}
    +static inline unsigned short readw(const volatile void *addr)
    +{
    + return le16_to_cpu(*(volatile unsigned short __force *)addr);
    +}
    +static inline unsigned int readl(const volatile void *addr)
    +{
    + return le32_to_cpu(*(volatile unsigned int __force *)addr);
    +}
    +static inline void writeb(unsigned char v, volatile void *addr)
    +{
    + *(volatile unsigned char __force *)addr = v;
    +}
    +static inline void writew(unsigned short v, volatile void *addr)
    +{
    + *(volatile unsigned short __force *)addr = cpu_to_le16(v);
    +}
    +static inline void writel(unsigned int v, volatile void __iomem *addr)
    +{
    + *(volatile unsigned int __force *)addr = cpu_to_le32(v);
    +}
    +
    +/* ioread and iowrite variants. thease are for now same as __raw_
    + * variants of accessors. we might check for endianess in the feature
    + */
    +#define ioread8(addr) __raw_readb((u8 *)(addr))
    +#define ioread16(addr) __raw_readw((u16 *)(addr))
    +#define ioread32(addr) __raw_readl((u32 *)(addr))
    +#define iowrite8(v, addr) __raw_writeb((u8)(v), (u8 *)(addr))
    +#define iowrite16(v, addr) __raw_writew((u16)(v), (u16 *)(addr))
    +#define iowrite32(v, addr) __raw_writel((u32)(v), (u32 *)(addr))
    +
    +/* These are the definitions for the x86 IO instructions
    + * inb/inw/inl/outb/outw/outl, the "string" versions
    + * insb/insw/insl/outsb/outsw/outsl, and the "pausing" versions
    + * inb_p/inw_p/...
    + * The macros don't do byte-swapping.
    + */
    +#define inb(port) readb((u8 *)((port)))
    +#define outb(val, port) writeb((val), (u8 *)((unsigned long)(port)))
    +#define inw(port) readw((u16 *)((port)))
    +#define outw(val, port) writew((val), (u16 *)((unsigned long)(port)))
    +#define inl(port) readl((u32 *)((port)))
    +#define outl(val, port) writel((val), (u32 *)((unsigned long)(port)))
    +
    +#define inb_p(port) inb((port))
    +#define outb_p(val, port) outb((val), (port))
    +#define inw_p(port) inw((port))
    +#define outw_p(val, port) outw((val), (port))
    +#define inl_p(port) inl((port))
    +#define outl_p(val, port) outl((val), (port))
    +
    +#define memset_io(a, b, c) memset((void *)(a), (b), (c))
    +#define memcpy_fromio(a, b, c) memcpy((a), (void *)(b), (c))
    +#define memcpy_toio(a, b, c) memcpy((void *)(a), (b), (c))
    +
    +/**
    + * virt_to_phys - map virtual addresses to physical
    + * @address: address to remap
    + *
    + * The returned physical address is the physical (CPU) mapping for
    + * the memory address given. It is only valid to use this function on
    + * addresses directly mapped or allocated via kmalloc.
    + *
    + * This function does not give bus mappings for DMA transfers. In
    + * almost all conceivable cases a device driver should not be using
    + * this function
    + */
    +static inline unsigned long __iomem virt_to_phys(volatile void *address)
    +{
    + return __pa((unsigned long)address);
    +}
    +
    +#define virt_to_bus virt_to_phys
    +
    +/**
    + * phys_to_virt - map physical address to virtual
    + * @address: address to remap
    + *
    + * The returned virtual address is a current CPU mapping for
    + * the memory address given. It is only valid to use this function on
    + * addresses that have a kernel mapping
    + *
    + * This function does not handle bus mappings for DMA transfers. In
    + * almost all conceivable cases a device driver should not be using
    + * this function
    + */
    +static inline void *phys_to_virt(unsigned long address)
    +{
    + return (void *)__va(address);
    +}
    +
    +#define bus_to_virt(a) phys_to_virt(a)
    +
    +static inline void *__ioremap(unsigned long address, unsigned long size,
    + unsigned long flags)
    +{
    + return (void *)address;
    +}
    +
    +
    +#define IO_SPACE_LIMIT ~(0UL)
    +
    +#define ioremap(physaddr, size) ((void *)(unsigned long)(physaddr))
    +#define iounmap(addr) ((void)0)
    +#define ioremap_nocache(physaddr, size) ioremap(physaddr, size)
    +
    +/*
    + * Convert a physical pointer to a virtual kernel pointer for /dev/mem
    + * access
    + */
    +#define xlate_dev_mem_ptr(p) __va(p)
    +
    +/*
    + * Convert a virtual cached pointer to an uncached pointer
    + */
    +#define xlate_dev_kmem_ptr(p) p
    +
    +/*
    + * Big Endian
    + */
    +#define out_be32(a, v) __raw_writel((v), (a))
    +#define out_be16(a, v) __raw_writew((v), (a))
    +
    +#define in_be32(a) __raw_readl(a)
    +#define in_be16(a) __raw_readw(a)
    +
    +/*
    + * Little endian
    + */
    +
    +#define out_le32(a, v) __raw_writel(__cpu_to_le32(v), (a));
    +#define out_le16(a, v) __raw_writew(__cpu_to_le16(v), (a))
    +
    +#define in_le32(a) __le32_to_cpu(__raw_readl(a))
    +#define in_le16(a) __le16_to_cpu(__raw_readw(a))
    +
    +/* Byte ops */
    +#define out_8(a, v) __raw_writeb((v), (a))
    +#define in_8(a) __raw_readb(a)
    +
    +/* FIXME */
    +static inline void __iomem *ioport_map(unsigned long port, unsigned int len)
    +{
    + return (void __iomem *) (port);
    +}
    +
    +static inline void ioport_unmap(void __iomem *addr)
    +{
    + /* Nothing to do */
    +}
    +
    +#endif /* _ASM_IO_H */
    --
    1.5.4.rc4.14.g6fc74

    --
    To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
    the body of a message to majordomo@vger.kernel.org
    More majordomo info at http://vger.kernel.org/majordomo-info.html
    Please read the FAQ at http://www.tux.org/lkml/

  19. [PATCH 19/52] [microblaze] uaccess files

    From: Michal Simek


    Signed-off-by: Michal Simek
    ---
    arch/microblaze/lib/uaccess.c | 43 +++++++++++++
    include/asm-microblaze/uaccess.h | 126 ++++++++++++++++++++++++++++++++++++++
    2 files changed, 169 insertions(+), 0 deletions(-)
    create mode 100644 arch/microblaze/lib/uaccess.c
    create mode 100644 include/asm-microblaze/uaccess.h

    diff --git a/arch/microblaze/lib/uaccess.c b/arch/microblaze/lib/uaccess.c
    new file mode 100644
    index 0000000..be201a0
    --- /dev/null
    +++ b/arch/microblaze/lib/uaccess.c
    @@ -0,0 +1,43 @@
    +/*
    + * arch/microblaze/lib/uaccess.c
    + *
    + * This file is subject to the terms and conditions of the GNU General Public
    + * License. See the file "COPYING" in the main directory of this archive
    + * for more details.
    + *
    + * Copyright (C) 2006 Atmark Techno, Inc.
    + */
    +
    +#include
    +#include
    +
    +#include
    +
    +long strnlen_user(const char *s, long n)
    +{
    + return strlen(s) + 1;
    +}
    +
    +#define __do_strncpy_from_user(dst, src, count, res) \
    + do { \
    + char *tmp; \
    + strncpy(dst, src, count); \
    + for (tmp = dst; *tmp && count > 0; tmp++, count--) \
    + ; \
    + res = (tmp - dst); \
    + } while (0)
    +
    +long __strncpy_from_user(char *dst, const char *src, long count)
    +{
    + long res;
    + __do_strncpy_from_user(dst, src, count, res);
    + return res;
    +}
    +
    +long strncpy_from_user(char *dst, const char *src, long count)
    +{
    + long res = -EFAULT;
    + if (access_ok(VERIFY_READ, src, 1))
    + __do_strncpy_from_user(dst, src, count, res);
    + return res;
    +}
    diff --git a/include/asm-microblaze/uaccess.h b/include/asm-microblaze/uaccess.h
    new file mode 100644
    index 0000000..1ee4c63
    --- /dev/null
    +++ b/include/asm-microblaze/uaccess.h
    @@ -0,0 +1,126 @@
    +/*
    + * include/asm-microblaze/uaccess.h
    + *
    + * This file is subject to the terms and conditions of the GNU General Public
    + * License. See the file "COPYING" in the main directory of this archive
    + * for more details.
    + *
    + * Copyright (C) 2006 Atmark Techno, Inc.
    + */
    +
    +#ifndef _ASM_UACCESS_H
    +#define _ASM_UACCESS_H
    +
    +#include
    +#include
    +#include
    +#include
    +
    +#include /* RLIMIT_FSIZE */
    +/* #include */
    +
    +#define VERIFY_READ 0
    +#define VERIFY_WRITE 1
    +
    +extern int ___range_ok(unsigned long addr, unsigned long size);
    +
    +#define __range_ok(addr, size) \
    + ___range_ok((unsigned long)(addr), (unsigned long)(size))
    +
    +#define access_ok(type, addr, size) (__range_ok((addr), (size)) == 0)
    +#define __access_ok(add, size) (__range_ok((addr), (size)) == 0)
    +
    +extern inline int bad_user_access_length(void)
    +{
    + return 0;
    +}
    +
    +#define __get_user(var, ptr) \
    + ({ \
    + int __gu_err = 0; \
    + switch (sizeof(*(ptr))) { \
    + case 1: \
    + case 2: \
    + case 4: \
    + (var) = *(ptr); \
    + break; \
    + case 8: \
    + memcpy((void *) &(var), (ptr), 8); \
    + break; \
    + default: \
    + (var) = 0; \
    + __gu_err = __get_user_bad(); \
    + break; \
    + } \
    + __gu_err; \
    + })
    +
    +#define __get_user_bad() (bad_user_access_length (), (-EFAULT))
    +
    +#define __put_user(var, ptr) \
    + ({ \
    + int __pu_err = 0; \
    + switch (sizeof(*(ptr))) { \
    + case 1: \
    + case 2: \
    + case 4: \
    + *(ptr) = (var); \
    + break; \
    + case 8: { \
    + typeof(*(ptr)) __pu_val = var; \
    + memcpy(ptr, &__pu_val, sizeof(__pu_val));\
    + } \
    + break; \
    + default: \
    + __pu_err = __put_user_bad(); \
    + break; \
    + } \
    + __pu_err; \
    + })
    +
    +#define __put_user_bad() (bad_user_access_length (), (-EFAULT))
    +
    +#define put_user(x, ptr) __put_user(x, ptr)
    +#define get_user(x, ptr) __get_user(x, ptr)
    +
    +#define copy_to_user(to, from, n) (memcpy(to, from, n), 0)
    +#define copy_from_user(to, from, n) (memcpy(to, from, n), 0)
    +
    +#define __copy_to_user(to, from, n) (copy_to_user(to, from, n))
    +#define __copy_from_user(to, from, n) (copy_from_user(to, from, n))
    +#define __copy_to_user_inatomic(to, from, n) (__copy_to_user(to, from, n))
    +#define __copy_from_user_inatomic(to, from, n) (__copy_from_user(to, from, n))
    +
    +#define __clear_user(addr, n) (memset((void *)addr, 0, n), 0)
    +
    +/*
    + * The exception table consists of pairs of addresses: the first is the
    + * address of an instruction that is allowed to fault, and the second is
    + * the address at which the program should continue. No registers are
    + * modified, so it is entirely up to the continuation code to figure out
    + * what to do.
    + *
    + * All the routines below use bits of fixup code that are out of line
    + * with the main instruction path. This means when everything is well,
    + * we don't even have to jump over them. Further, they do not intrude
    + * on our cache or tlb entries.
    + */
    +struct exception_table_entry {
    + unsigned long insn, fixup;
    +};
    +
    +static inline unsigned long clear_user(void *addr, unsigned long size)
    +{
    + if (access_ok(VERIFY_WRITE, addr, size))
    + size = __clear_user(addr, size);
    + return size;
    +}
    +
    +/* Returns 0 if exception not found and fixup otherwise. */
    +extern unsigned long search_exception_table(unsigned long);
    +
    +extern long strncpy_from_user(char *dst, const char *src, long count);
    +extern long strnlen_user(const char *src, long count);
    +extern long __strncpy_from_user(char *dst, const char *src, long count);
    +
    +#endif /* _ASM_UACCESS_H */
    --
    1.5.4.rc4.14.g6fc74

    --
    To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
    the body of a message to majordomo@vger.kernel.org
    More majordomo info at http://vger.kernel.org/majordomo-info.html
    Please read the FAQ at http://www.tux.org/lkml/

  20. [PATCH 30/52] [microblaze] consistent allocation & page.h, ...

    From: Michal Simek


    Signed-off-by: Michal Simek
    ---
    arch/microblaze/mm/consistent.c | 176 ++++++++++++++++++++++++++++++++++++
    include/asm-microblaze/page.h | 117 ++++++++++++++++++++++++
    include/asm-microblaze/segment.h | 42 +++++++++
    include/asm-microblaze/unaligned.h | 16 ++++
    4 files changed, 351 insertions(+), 0 deletions(-)
    create mode 100644 arch/microblaze/mm/consistent.c
    create mode 100644 include/asm-microblaze/page.h
    create mode 100644 include/asm-microblaze/segment.h
    create mode 100644 include/asm-microblaze/unaligned.h

    diff --git a/arch/microblaze/mm/consistent.c b/arch/microblaze/mm/consistent.c
    new file mode 100644
    index 0000000..fe7057b
    --- /dev/null
    +++ b/arch/microblaze/mm/consistent.c
    @@ -0,0 +1,176 @@
    +/*
    + * Microblaze support for cache consistent memory.
    + * Copyright (C) 2005 John Williams
    + *
    + * based on
    + *
    + * PowerPC version derived from arch/arm/mm/consistent.c
    + * Copyright (C) 2001 Dan Malek (dmalek@jlc.net)
    + *
    + * linux/arch/arm/mm/consistent.c
    + *
    + * Copyright (C) 2000 Russell King
    + *
    + * Consistent memory allocators. Used for DMA devices that want to
    + * share uncached memory with the processor core.
    + * My crufty no-MMU approach is simple. In the HW platform we can optionally
    + * mirror the DDR up above the processor cacheable region. So, memory accessed
    + * in this mirror region will not be cached. It's alloced from the same
    + * pool as normal memory, but the handle we return is shifted up into the
    + * uncached region. This will no doubt cause big problems if memory allocated
    + * here is not also freed properly. --JW
    + *
    + * This program is free software; you can redistribute it and/or modify
    + * it under the terms of the GNU General Public License version 2 as
    + * published by the Free Software Foundation.
    + */
    +
    +#include
    +#include
    +#include
    +#include
    +#include
    +#include
    +#include
    +#include
    +#include
    +#include
    +#include
    +#include
    +#include
    +#include
    +#include
    +#include
    +#include
    +#include
    +#include
    +#include
    +
    +#include
    +#include
    +#include
    +#include
    +#include
    +#include
    +#include
    +#include
    +
    +#include "../../../mm/internal.h" /* set_page_count */
    +
    +void *consistent_alloc(gfp_t gfp, size_t size, dma_addr_t *dma_handle)
    +{
    + struct page *page, *end, *free;
    + unsigned long order;
    + void *ret, *virt;
    +
    + if (in_interrupt())
    + BUG();
    +
    + size = PAGE_ALIGN(size);
    + order = get_order(size);
    +
    + page = alloc_pages(gfp, order);
    + if (!page)
    + goto no_page;
    +
    + /*
    + * We could do with a page_to_phys and page_to_bus here.
    + */
    + virt = page_address(page);
    + /* *dma_handle = virt_to_bus(virt); */
    + ret = ioremap(virt_to_phys(virt), size);
    + if (!ret)
    + goto no_remap;
    +
    + /* Here's the magic! Note if the uncached shadow is not implemented,
    + it's up to the calling code to also test that condition and make
    + other arranegments, such as manually flushing the cache and so on.
    + */
    +#ifdef CONFIG_XILINX_UNCACHED_SHADOW
    + ret = (void *)((unsigned) ret | UNCACHED_SHADOW_MASK);
    +#endif
    + /* For !MMU, dma_handle is same as physical (shadowed) address */
    + *dma_handle = (dma_addr_t)ret;
    +
    + /*
    + * free wasted pages. We skip the first page since we know
    + * that it will have count = 1 and won't require freeing.
    + * We also mark the pages in use as reserved so that
    + * remap_page_range works.
    + */
    + page = virt_to_page(virt);
    + free = page + (size >> PAGE_SHIFT);
    + end = page + (1 << order);
    +
    + for (; page < end; page++) {
    + set_page_count(page, 1);
    + if (page >= free)
    + __free_page(page);
    + else
    + SetPageReserved(page);
    + }
    +
    + return ret;
    +no_remap:
    + __free_pages(page, order);
    +no_page:
    + return NULL;
    +}
    +
    +/*
    + * free page(s) as defined by the above mapping.
    + */
    +void consistent_free(void *vaddr)
    +{
    + if (in_interrupt())
    + BUG();
    +
    + /* Clear SHADOW_MASK bit in address, and free as per usual */
    +#ifdef CONFIG_XILINX_UNCACHED_SHADOW
    + vaddr = (void *)((unsigned)vaddr & ~UNCACHED_SHADOW_MASK);
    +#endif
    + vfree(vaddr);
    +}
    +
    +/*
    + * make an area consistent.
    + */
    +void consistent_sync(void *vaddr, size_t size, int direction)
    +{
    + unsigned long start;
    + unsigned long end;
    +
    + start = (unsigned long)vaddr;
    +
    + /* Convert start address back down to unshadowed memory region */
    +#ifdef CONFIG_XILINX_UNCACHED_SHADOW
    + start &= UNCACHED_SHADOW_MASK;
    +#endif
    + end = start+size;
    +
    + switch (direction) {
    + case PCI_DMA_NONE:
    + BUG();
    + case PCI_DMA_FROMDEVICE: /* invalidate only */
    + flush_dcache_range(start, end);
    + break;
    + case PCI_DMA_TODEVICE: /* writeback only */
    + flush_dcache_range(start, end);
    + break;
    + case PCI_DMA_BIDIRECTIONAL: /* writeback and invalidate */
    + flush_dcache_range(start, end);
    + break;
    + }
    +}
    +
    +/*
    + * consistent_sync_page makes memory consistent. identical
    + * to consistent_sync, but takes a struct page instead of a
    + * virtual address
    + */
    +void consistent_sync_page(struct page *page, unsigned long offset,
    + size_t size, int direction)
    +{
    + unsigned long start = (unsigned long)page_address(page) + offset;
    + consistent_sync((void *)start, size, direction);
    +}
    diff --git a/include/asm-microblaze/page.h b/include/asm-microblaze/page.h
    new file mode 100644
    index 0000000..b3c891f
    --- /dev/null
    +++ b/include/asm-microblaze/page.h
    @@ -0,0 +1,117 @@
    +/*
    + * include/asm-microblaze/page.h
    + *
    + * This file is subject to the terms and conditions of the GNU General Public
    + * License. See the file "COPYING" in the main directory of this archive
    + * for more details.
    + *
    + * Copyright (C) 2006 Atmark Techno, Inc.
    + */
    +
    +#ifndef _ASM_PAGE_H
    +#define _ASM_PAGE_H
    +
    +#include
    +#include
    +
    +/* PAGE_SHIFT determines the page size */
    +
    +#define PAGE_SHIFT (12)
    +#define PAGE_SIZE (1UL << PAGE_SHIFT)
    +#define PAGE_MASK (~(PAGE_SIZE-1))
    +
    +#ifdef __KERNEL__
    +
    +#include
    +
    +#ifndef __ASSEMBLY__
    +
    +#define get_user_page(vaddr) __get_free_page(GFP_KERNEL)
    +#define free_user_page(page, addr) free_page(addr)
    +
    +#define clear_page(pgaddr) memset((pgaddr), 0, PAGE_SIZE)
    +#define copy_page(to, from) memcpy((to), (from), PAGE_SIZE)
    +
    +#define clear_user_page(pgaddr, vaddr, page) memset((pgaddr), 0, PAGE_SIZE)
    +#define copy_user_page(vto, vfrom, vaddr, topg) \
    + memcpy((vto), (vfrom), PAGE_SIZE)
    +
    +/*
    + * These are used to make use of C type-checking..
    + */
    +typedef struct { unsigned long pte; } pte_t;
    +typedef struct { unsigned long ste[64]; } pmd_t;
    +typedef struct { pmd_t pue[1]; } pud_t;
    +typedef struct { pud_t pge[1]; } pgd_t;
    +typedef struct { unsigned long pgprot; } pgprot_t;
    +
    +#define pte_val(x) ((x).pte)
    +#define pmd_val(x) ((x).ste[0])
    +#define pud_val(x) ((x).pue[0])
    +#define pgd_val(x) ((x).pge[0])
    +#define pgprot_val(x) ((x).pgprot)
    +
    +#define __pte(x) ((pte_t) { (x) })
    +#define __pmd(x) ((pmd_t) { (x) })
    +#define __pgd(x) ((pgd_t) { (x) })
    +#define __pgprot(x) ((pgprot_t) { (x) })
    +
    +/* align addr on a size boundary - adjust address up/down if needed */
    +#define _ALIGN_UP(addr, size) (((addr)+((size)-1))&(~((size)-1)))
    +#define _ALIGN_DOWN(addr, size) ((addr)&(~((size)-1)))
    +
    +/* align addr on a size boundary - adjust address up if needed */
    +#define _ALIGN(addr, size) _ALIGN_UP(addr, size)
    +
    +/* to align the pointer to the (next) page boundary */
    +#define PAGE_ALIGN(addr) (((addr) + PAGE_SIZE - 1) & PAGE_MASK)
    +
    +extern unsigned int PAGE_OFFSET;
    +
    +/**
    + * Conversions for virtual address, physical address, pfn, and struct
    + * page are defined in the following files.
    + *
    + * virt -+
    + * | asm-microblaze/page.h
    + * phys -+
    + * | linux/pfn.h
    + * pfn -+
    + * | asm-generic/memory_model.h
    + * page -+
    + *
    + */
    +
    +extern unsigned long max_low_pfn;
    +extern unsigned long min_low_pfn;
    +extern unsigned long max_pfn;
    +
    +#define __pa(vaddr) ((unsigned long) (vaddr))
    +#define __va(paddr) ((void *) (paddr))
    +
    +#define phys_to_pfn(phys) (PFN_DOWN(phys))
    +#define pfn_to_phys(pfn) (PFN_PHYS(pfn))
    +
    +#define virt_to_pfn(vaddr) (phys_to_pfn((__pa(vaddr))))
    +#define pfn_to_virt(pfn) __va(pfn_to_phys((pfn)))
    +
    +#define virt_to_page(vaddr) (pfn_to_page(virt_to_pfn(vaddr)))
    +#define page_to_virt(page) (pfn_to_virt(page_to_pfn(page)))
    +
    +#define page_to_phys(page) (pfn_to_phys(page_to_pfn(page)))
    +#define page_to_bus(page) (page_to_phys(page))
    +#define phys_to_page(paddr) (pfn_to_page(phys_to_pfn(paddr)))
    +
    +#define pfn_valid(pfn) ((pfn) >= min_low_pfn && (pfn) < max_mapnr)
    +#define virt_addr_valid(vaddr) (pfn_valid(virt_to_pfn(vaddr)))
    +
    +#define ARCH_PFN_OFFSET (PAGE_OFFSET >> PAGE_SHIFT)
    +
    +#endif /* __ASSEMBLY__ */
    +
    +#endif /* __KERNEL__ */
    +
    +#include
    +#include
    +
    +#endif /* _ASM_PAGE_H */
    diff --git a/include/asm-microblaze/segment.h b/include/asm-microblaze/segment.h
    new file mode 100644
    index 0000000..bd8b633
    --- /dev/null
    +++ b/include/asm-microblaze/segment.h
    @@ -0,0 +1,42 @@
    +/*
    + * include/asm-microblaze/segment.h
    + *
    + * This file is subject to the terms and conditions of the GNU General Public
    + * License. See the file "COPYING" in the main directory of this archive
    + * for more details.
    + *
    + * Copyright (C) 2006 Atmark Techno, Inc.
    + *
    + */
    +
    +#ifndef _ASM_SEGMENT_H
    +#define _ASM_SEGMENT_H
    +
    +#ifndef __ASSEMBLY__
    +
    +typedef struct {
    + unsigned long seg;
    +} mm_segment_t;
    +
    +/*
    + * The fs value determines whether argument validity checking should be
    + * performed or not. If get_fs() == USER_DS, checking is performed, with
    + * get_fs() == KERNEL_DS, checking is bypassed.
    + *
    + * For historical reasons, these macros are grossly misnamed.
    + *
    + * For non-MMU arch like Microblaze, KERNEL_DS and USER_DS is equal.
    + */
    +#define KERNEL_DS ((mm_segment_t){0})
    +#define USER_DS KERNEL_DS
    +
    +#define get_ds() (KERNEL_DS)
    +#define get_fs() (current_thread_info()->addr_limit)
    +#define set_fs(x) \
    + do { current_thread_info()->addr_limit = (x); } while (0)
    +
    +#define segment_eq(a, b) ((a).seg == (b).seg)
    +
    +#endif /* __ASSEMBLY__ */
    +
    +#endif /* _ASM_SEGMENT_H */
    diff --git a/include/asm-microblaze/unaligned.h b/include/asm-microblaze/unaligned.h
    new file mode 100644
    index 0000000..edf79c2
    --- /dev/null
    +++ b/include/asm-microblaze/unaligned.h
    @@ -0,0 +1,16 @@
    +/*
    + * include/asm-microblaze/unaligned.h
    + *
    + * This file is subject to the terms and conditions of the GNU General Public
    + * License. See the file "COPYING" in the main directory of this archive
    + * for more details.
    + *
    + * Copyright (C) 2006 Atmark Techno, Inc.
    + */
    +
    +#ifndef _ASM_UNALIGNED_H
    +#define _ASM_UNALIGNED_H
    +
    +#include
    +
    +#endif /* _ASM_UNALIGNED_H */
    --
    1.5.4.rc4.14.g6fc74

    --
    To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
    the body of a message to majordomo@vger.kernel.org
    More majordomo info at http://vger.kernel.org/majordomo-info.html
    Please read the FAQ at http://www.tux.org/lkml/

+ Reply to Thread
Page 1 of 3 1 2 3 LastLast