Skip to content

Commit

Permalink
OpenRISC: Headers
Browse files Browse the repository at this point in the history
Signed-off-by: Jonas Bonn <jonas@southpole.se>
Reviewed-by: Arnd Bergmann <arnd@arndb.de>
  • Loading branch information
Jonas Bonn committed Jul 22, 2011
1 parent 769a8a9 commit 58e0166
Show file tree
Hide file tree
Showing 22 changed files with 1,404 additions and 0 deletions.
1 change: 1 addition & 0 deletions arch/openrisc/include/asm/asm-offsets.h
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
#include <generated/asm-offsets.h>
59 changes: 59 additions & 0 deletions arch/openrisc/include/asm/bitops.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
/*
* OpenRISC Linux
*
* Linux architectural port borrowing liberally from similar works of
* others. All original copyrights apply as per the original source
* declaration.
*
* OpenRISC implementation:
* Copyright (C) 2003 Matjaz Breskvar <phoenix@bsemi.com>
* Copyright (C) 2010-2011 Jonas Bonn <jonas@southpole.se>
* et al.
*
* 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.
*/

#ifndef __ASM_OPENRISC_BITOPS_H
#define __ASM_OPENRISC_BITOPS_H

/*
* Where we haven't written assembly versions yet, we fall back to the
* generic implementations. Otherwise, we pull in our (hopefully)
* optimized versions.
*/

#include <linux/irqflags.h>
#include <linux/compiler.h>

/*
* clear_bit may not imply a memory barrier
*/
#ifndef smp_mb__before_clear_bit
#define smp_mb__before_clear_bit() smp_mb()
#define smp_mb__after_clear_bit() smp_mb()
#endif

#include <asm/bitops/__ffs.h>
#include <asm-generic/bitops/ffz.h>
#include <asm/bitops/fls.h>
#include <asm/bitops/__fls.h>
#include <asm-generic/bitops/fls64.h>
#include <asm-generic/bitops/find.h>

#ifndef _LINUX_BITOPS_H
#error only <linux/bitops.h> can be included directly
#endif

#include <asm-generic/bitops/sched.h>
#include <asm/bitops/ffs.h>
#include <asm-generic/bitops/hweight.h>
#include <asm-generic/bitops/lock.h>

#include <asm-generic/bitops/atomic.h>
#include <asm-generic/bitops/non-atomic.h>
#include <asm-generic/bitops/ext2-atomic.h>

#endif /* __ASM_GENERIC_BITOPS_H */
33 changes: 33 additions & 0 deletions arch/openrisc/include/asm/bitops/__ffs.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
/*
* OpenRISC Linux
*
* Copyright (C) 2010-2011 Jonas Bonn <jonas@southpole.se>
*
* 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.
*/

#ifndef __ASM_OPENRISC___FFS_H
#define __ASM_OPENRISC___FFS_H


#ifdef CONFIG_OPENRISC_HAVE_INST_FF1

static inline unsigned long __ffs(unsigned long x)
{
int ret;

__asm__ ("l.ff1 %0,%1"
: "=r" (ret)
: "r" (x));

return ret-1;
}

#else
#include <asm-generic/bitops/__ffs.h>
#endif

#endif /* __ASM_OPENRISC___FFS_H */
33 changes: 33 additions & 0 deletions arch/openrisc/include/asm/bitops/__fls.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
/*
* OpenRISC Linux
*
* Copyright (C) 2010-2011 Jonas Bonn <jonas@southpole.se>
*
* 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.
*/

#ifndef __ASM_OPENRISC___FLS_H
#define __ASM_OPENRISC___FLS_H


#ifdef CONFIG_OPENRISC_HAVE_INST_FL1

static inline unsigned long __fls(unsigned long x)
{
int ret;

__asm__ ("l.fl1 %0,%1"
: "=r" (ret)
: "r" (x));

return ret-1;
}

#else
#include <asm-generic/bitops/__fls.h>
#endif

#endif /* __ASM_OPENRISC___FLS_H */
32 changes: 32 additions & 0 deletions arch/openrisc/include/asm/bitops/ffs.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
/*
* OpenRISC Linux
*
* Copyright (C) 2010-2011 Jonas Bonn <jonas@southpole.se>
*
* 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.
*/

#ifndef __ASM_OPENRISC_FFS_H
#define __ASM_OPENRISC_FFS_H

#ifdef CONFIG_OPENRISC_HAVE_INST_FF1

static inline int ffs(int x)
{
int ret;

__asm__ ("l.ff1 %0,%1"
: "=r" (ret)
: "r" (x));

return ret;
}

#else
#include <asm-generic/bitops/ffs.h>
#endif

#endif /* __ASM_OPENRISC_FFS_H */
33 changes: 33 additions & 0 deletions arch/openrisc/include/asm/bitops/fls.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
/*
* OpenRISC Linux
*
* Copyright (C) 2010-2011 Jonas Bonn <jonas@southpole.se>
*
* 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.
*/

#ifndef __ASM_OPENRISC_FLS_H
#define __ASM_OPENRISC_FLS_H


#ifdef CONFIG_OPENRISC_HAVE_INST_FL1

static inline int fls(int x)
{
int ret;

__asm__ ("l.fl1 %0,%1"
: "=r" (ret)
: "r" (x));

return ret;
}

#else
#include <asm-generic/bitops/fls.h>
#endif

#endif /* __ASM_OPENRISC_FLS_H */
1 change: 1 addition & 0 deletions arch/openrisc/include/asm/byteorder.h
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
#include <linux/byteorder/big_endian.h>
34 changes: 34 additions & 0 deletions arch/openrisc/include/asm/cpuinfo.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
/*
* OpenRISC Linux
*
* Linux architectural port borrowing liberally from similar works of
* others. All original copyrights apply as per the original source
* declaration.
*
* OpenRISC implementation:
* Copyright (C) 2003 Matjaz Breskvar <phoenix@bsemi.com>
* Copyright (C) 2010-2011 Jonas Bonn <jonas@southpole.se>
* et al.
*
* 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.
*/

#ifndef __ASM_OPENRISC_CPUINFO_H
#define __ASM_OPENRISC_CPUINFO_H

struct cpuinfo {
u32 clock_frequency;

u32 icache_size;
u32 icache_block_size;

u32 dcache_size;
u32 dcache_block_size;
};

extern struct cpuinfo cpuinfo;

#endif /* __ASM_OPENRISC_CPUINFO_H */
24 changes: 24 additions & 0 deletions arch/openrisc/include/asm/delay.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
/*
* OpenRISC Linux
*
* Linux architectural port borrowing liberally from similar works of
* others. All original copyrights apply as per the original source
* declaration.
*
* OpenRISC implementation:
* Copyright (C) 2010-2011 Jonas Bonn <jonas@southpole.se>
*
* 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.
*/

#ifndef __ASM_OPENRISC_DELAY_H
#define __ASM_OPENRISC_DELAY_H

#include <asm-generic/delay.h>

extern unsigned long loops_per_jiffy;

#endif
108 changes: 108 additions & 0 deletions arch/openrisc/include/asm/elf.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
/*
* OpenRISC Linux
*
* Linux architectural port borrowing liberally from similar works of
* others. All original copyrights apply as per the original source
* declaration.
*
* OpenRISC implementation:
* Copyright (C) 2003 Matjaz Breskvar <phoenix@bsemi.com>
* Copyright (C) 2010-2011 Jonas Bonn <jonas@southpole.se>
* et al.
*
* 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.
*/

#ifndef __ASM_OPENRISC_ELF_H
#define __ASM_OPENRISC_ELF_H

/*
* ELF register definitions..
*/
#include <linux/types.h>
#include <linux/ptrace.h>


/* The OR1K relocation types... not all relevant for module loader */
#define R_OR32_NONE 0
#define R_OR32_32 1
#define R_OR32_16 2
#define R_OR32_8 3
#define R_OR32_CONST 4
#define R_OR32_CONSTH 5
#define R_OR32_JUMPTARG 6
#define R_OR32_VTINHERIT 7
#define R_OR32_VTENTRY 8

typedef unsigned long elf_greg_t;

/*
* Note that NGREG is defined to ELF_NGREG in include/linux/elfcore.h, and is
* thus exposed to user-space.
*/
#define ELF_NGREG (sizeof(struct user_regs_struct) / sizeof(elf_greg_t))
typedef elf_greg_t elf_gregset_t[ELF_NGREG];

/* A placeholder; OR32 does not have fp support yes, so no fp regs for now. */
typedef unsigned long elf_fpregset_t;

/* This should be moved to include/linux/elf.h */
#define EM_OR32 0x8472
#define EM_OPENRISC 92 /* OpenRISC 32-bit embedded processor */

/*
* These are used to set parameters in the core dumps.
*/
#define ELF_ARCH EM_OR32
#define ELF_CLASS ELFCLASS32
#define ELF_DATA ELFDATA2MSB

#ifdef __KERNEL__

/*
* This is used to ensure we don't load something for the wrong architecture.
*/

#define elf_check_arch(x) \
(((x)->e_machine == EM_OR32) || ((x)->e_machine == EM_OPENRISC))

/* This is the location that an ET_DYN program is loaded if exec'ed. Typical
use of this is to invoke "./ld.so someprog" to test out a new version of
the loader. We need to make sure that it is out of the way of the program
that it will "exec", and that there is sufficient room for the brk. */

#define ELF_ET_DYN_BASE (0x08000000)

/*
* Enable dump using regset.
* This covers all of general/DSP/FPU regs.
*/
#define CORE_DUMP_USE_REGSET

#define ELF_EXEC_PAGESIZE 8192

extern void dump_elf_thread(elf_greg_t *dest, struct pt_regs *pt);
#define ELF_CORE_COPY_REGS(dest, regs) dump_elf_thread(dest, regs);

/* This yields a mask that user programs can use to figure out what
instruction set this cpu supports. This could be done in userspace,
but it's not easy, and we've already done it here. */

#define ELF_HWCAP (0)

/* This yields a string that ld.so will use to load implementation
specific libraries for optimization. This is more specific in
intent than poking at uname or /proc/cpuinfo.
For the moment, we have only optimizations for the Intel generations,
but that could change... */

#define ELF_PLATFORM (NULL)

#define SET_PERSONALITY(ex) set_personality(PER_LINUX)

#endif /* __KERNEL__ */
#endif
Loading

0 comments on commit 58e0166

Please sign in to comment.