parent
b8685affe6
commit
b02bad1286
@ -0,0 +1,108 @@ |
||||
/*
|
||||
* (C) Copyright 2007 |
||||
* Nobuhiro Iwamatsu <iwamatsu@nigauri.org> |
||||
* |
||||
* See file CREDITS for list of people who contributed to this |
||||
* project. |
||||
* |
||||
* 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 |
||||
*/ |
||||
|
||||
#include <common.h> |
||||
#include <command.h> |
||||
#include <asm/processor.h> |
||||
#include <asm/io.h> |
||||
|
||||
/*
|
||||
* Jump to P2 area. |
||||
* When handling TLB or caches, we need to do it from P2 area. |
||||
*/ |
||||
#define jump_to_P2() \ |
||||
do { \
|
||||
unsigned long __dummy; \
|
||||
__asm__ __volatile__( \
|
||||
"mov.l 1f, %0\n\t" \
|
||||
"or %1, %0\n\t" \
|
||||
"jmp @%0\n\t" \
|
||||
" nop\n\t" \
|
||||
".balign 4\n" \
|
||||
"1: .long 2f\n" \
|
||||
"2:" \
|
||||
: "=&r" (__dummy) \
|
||||
: "r" (0x20000000)); \
|
||||
} while (0) |
||||
|
||||
/*
|
||||
* Back to P1 area. |
||||
*/ |
||||
#define back_to_P1() \ |
||||
do { \
|
||||
unsigned long __dummy; \
|
||||
__asm__ __volatile__( \
|
||||
"nop;nop;nop;nop;nop;nop;nop\n\t" \
|
||||
"mov.l 1f, %0\n\t" \
|
||||
"jmp @%0\n\t" \
|
||||
" nop\n\t" \
|
||||
".balign 4\n" \
|
||||
"1: .long 2f\n" \
|
||||
"2:" \
|
||||
: "=&r" (__dummy)); \
|
||||
} while (0) |
||||
|
||||
#define CACHE_VALID 1 |
||||
#define CACHE_UPDATED 2 |
||||
|
||||
static inline void cache_wback_all(void) |
||||
{ |
||||
unsigned long addr, data, i, j; |
||||
|
||||
jump_to_P2(); |
||||
for (i = 0; i < CACHE_OC_NUM_ENTRIES; i++){ |
||||
for (j = 0; j < CACHE_OC_NUM_WAYS; j++) { |
||||
addr = CACHE_OC_ADDRESS_ARRAY | (j << CACHE_OC_WAY_SHIFT) |
||||
| (i << CACHE_OC_ENTRY_SHIFT); |
||||
data = inl(addr); |
||||
if (data & CACHE_UPDATED) { |
||||
data &= ~CACHE_UPDATED; |
||||
outl(data, addr); |
||||
} |
||||
} |
||||
} |
||||
back_to_P1(); |
||||
} |
||||
|
||||
|
||||
#define CACHE_ENABLE 0 |
||||
#define CACHE_DISABLE 1 |
||||
|
||||
int cache_control(unsigned int cmd) |
||||
{ |
||||
unsigned long ccr; |
||||
|
||||
jump_to_P2(); |
||||
ccr = inl(CCR); |
||||
|
||||
if (ccr & CCR_CACHE_ENABLE) |
||||
cache_wback_all(); |
||||
|
||||
if (cmd == CACHE_DISABLE) |
||||
outl(CCR_CACHE_STOP, CCR); |
||||
else |
||||
outl(CCR_CACHE_INIT, CCR); |
||||
back_to_P1(); |
||||
|
||||
return 0; |
||||
} |
@ -1,13 +1,166 @@ |
||||
#ifndef __ASM_SH_BITOPS_H_ |
||||
#define __ASM_SH_BITOPS_H_ |
||||
|
||||
extern void set_bit(int nr, volatile void * a); |
||||
extern void clear_bit(int nr, volatile void * a); |
||||
extern int test_and_clear_bit(int nr, volatile void * a); |
||||
extern void change_bit(unsigned long nr, volatile void *addr); |
||||
extern int test_and_set_bit(int nr, volatile void * a); |
||||
extern int test_and_change_bit(int nr, volatile void * addr); |
||||
extern int test_bit(int nr, volatile void * a); |
||||
extern int ffs(int i); |
||||
#ifndef __ASM_SH_BITOPS_H |
||||
#define __ASM_SH_BITOPS_H |
||||
|
||||
#ifdef __KERNEL__ |
||||
//#include <asm/system.h>
|
||||
#include <asm/irqflags.h> |
||||
/* For __swab32 */ |
||||
#include <asm/byteorder.h> |
||||
|
||||
static inline void set_bit(int nr, volatile void * addr) |
||||
{ |
||||
int mask; |
||||
volatile unsigned int *a = addr; |
||||
unsigned long flags; |
||||
|
||||
a += nr >> 5; |
||||
mask = 1 << (nr & 0x1f); |
||||
local_irq_save(flags); |
||||
*a |= mask; |
||||
local_irq_restore(flags); |
||||
} |
||||
|
||||
/*
|
||||
* clear_bit() doesn't provide any barrier for the compiler. |
||||
*/ |
||||
#define smp_mb__before_clear_bit() barrier() |
||||
#define smp_mb__after_clear_bit() barrier() |
||||
static inline void clear_bit(int nr, volatile void * addr) |
||||
{ |
||||
int mask; |
||||
volatile unsigned int *a = addr; |
||||
unsigned long flags; |
||||
|
||||
a += nr >> 5; |
||||
mask = 1 << (nr & 0x1f); |
||||
local_irq_save(flags); |
||||
*a &= ~mask; |
||||
local_irq_restore(flags); |
||||
} |
||||
|
||||
static inline void change_bit(int nr, volatile void * addr) |
||||
{ |
||||
int mask; |
||||
volatile unsigned int *a = addr; |
||||
unsigned long flags; |
||||
|
||||
a += nr >> 5; |
||||
mask = 1 << (nr & 0x1f); |
||||
local_irq_save(flags); |
||||
*a ^= mask; |
||||
local_irq_restore(flags); |
||||
} |
||||
|
||||
static inline int test_and_set_bit(int nr, volatile void * addr) |
||||
{ |
||||
int mask, retval; |
||||
volatile unsigned int *a = addr; |
||||
unsigned long flags; |
||||
|
||||
a += nr >> 5; |
||||
mask = 1 << (nr & 0x1f); |
||||
local_irq_save(flags); |
||||
retval = (mask & *a) != 0; |
||||
*a |= mask; |
||||
local_irq_restore(flags); |
||||
|
||||
return retval; |
||||
} |
||||
|
||||
static inline int test_and_clear_bit(int nr, volatile void * addr) |
||||
{ |
||||
int mask, retval; |
||||
volatile unsigned int *a = addr; |
||||
unsigned long flags; |
||||
|
||||
a += nr >> 5; |
||||
mask = 1 << (nr & 0x1f); |
||||
local_irq_save(flags); |
||||
retval = (mask & *a) != 0; |
||||
*a &= ~mask; |
||||
local_irq_restore(flags); |
||||
|
||||
return retval; |
||||
} |
||||
|
||||
static inline int test_and_change_bit(int nr, volatile void * addr) |
||||
{ |
||||
int mask, retval; |
||||
volatile unsigned int *a = addr; |
||||
unsigned long flags; |
||||
|
||||
a += nr >> 5; |
||||
mask = 1 << (nr & 0x1f); |
||||
local_irq_save(flags); |
||||
retval = (mask & *a) != 0; |
||||
*a ^= mask; |
||||
local_irq_restore(flags); |
||||
|
||||
return retval; |
||||
} |
||||
|
||||
//#include <asm-generic/bitops/non-atomic.h>
|
||||
|
||||
static inline unsigned long ffz(unsigned long word) |
||||
{ |
||||
unsigned long result; |
||||
|
||||
__asm__("1:\n\t" |
||||
"shlr %1\n\t" |
||||
"bt/s 1b\n\t" |
||||
" add #1, %0" |
||||
: "=r" (result), "=r" (word) |
||||
: "0" (~0L), "1" (word) |
||||
: "t"); |
||||
return result; |
||||
} |
||||
|
||||
/**
|
||||
* ffs - find first bit in word. |
||||
* @word: The word to search |
||||
* |
||||
* Undefined if no bit exists, so code should check against 0 first. |
||||
*/ |
||||
static inline int ffs(int x) |
||||
{ |
||||
int r = 1; |
||||
|
||||
if (!x) |
||||
return 0; |
||||
if (!(x & 0xffff)) { |
||||
x >>= 16; |
||||
r += 16; |
||||
} |
||||
if (!(x & 0xff)) { |
||||
x >>= 8; |
||||
r += 8; |
||||
} |
||||
if (!(x & 0xf)) { |
||||
x >>= 4; |
||||
r += 4; |
||||
} |
||||
if (!(x & 3)) { |
||||
x >>= 2; |
||||
r += 2; |
||||
} |
||||
if (!(x & 1)) { |
||||
x >>= 1; |
||||
r += 1; |
||||
} |
||||
return r; |
||||
} |
||||
|
||||
#if 0 |
||||
#include <asm-generic/bitops/find.h> |
||||
#include <asm-generic/bitops/ffs.h> |
||||
#include <asm-generic/bitops/hweight.h> |
||||
#include <asm-generic/bitops/sched.h> |
||||
#include <asm-generic/bitops/ext2-non-atomic.h> |
||||
#include <asm-generic/bitops/ext2-atomic.h> |
||||
#include <asm-generic/bitops/minix.h> |
||||
#include <asm-generic/bitops/fls.h> |
||||
#include <asm-generic/bitops/fls64.h> |
||||
#endif |
||||
#endif /* __KERNEL__ */ |
||||
|
||||
#endif /* __ASM_SH_BITOPS_H */ |
||||
|
@ -1,10 +1,48 @@ |
||||
/*
|
||||
* (C) Copyright 2007 Nobuhiro Iwamatsu <iwamatsu@nigauri.org> |
||||
* |
||||
* 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 |
||||
*/ |
||||
|
||||
#ifndef _ASM_CPU_SH4_H_ |
||||
#define _ASM_CPU_SH4_H_ |
||||
|
||||
/* cache control */ |
||||
#define CCR_CACHE_STOP 0x00000808 |
||||
#define CCR_CACHE_ENABLE 0x00000101 |
||||
#define CCR_CACHE_ICI 0x00000800 |
||||
|
||||
#define CACHE_OC_ADDRESS_ARRAY 0xf4000000 |
||||
#define CACHE_OC_WAY_SHIFT 14 |
||||
#define CACHE_OC_NUM_ENTRIES 512 |
||||
#define CACHE_OC_ENTRY_SHIFT 5 |
||||
//#define CACHE_OC_NUM_WAYS 1
|
||||
|
||||
#if defined (CONFIG_CPU_SH7750) |
||||
#include <asm/cpu_sh7750.h> |
||||
#elif defined (CONFIG_CPU_SH7780) |
||||
#include <asm/cpu_sh7780.h> |
||||
//#ifdef CONFIG_CPU_TYPE_R
|
||||
//#define CCR_CACHE_INIT 0x8000090d /* EMODE,ICI,ICE(16k),OCI,P1-wb,OCE(32k) */
|
||||
//#else
|
||||
//#define CCR_CACHE_INIT 0x0000090b
|
||||
//#endif
|
||||
#elif defined (CONFIG_CPU_SH7722) |
||||
#include <asm/cpu_sh7722.h> |
||||
//#define CCR_CACHE_INIT 0x0000090d
|
||||
#else |
||||
#error "Unknown SH4 variant" |
||||
#endif |
||||
#endif |
||||
|
||||
#endif /* _ASM_CPU_SH4_H_ */ |
||||
|
@ -0,0 +1,156 @@ |
||||
/*
|
||||
* U-boot - errno.h Error number defines |
||||
* |
||||
* Copyright (c) 2005-2007 Analog Devices Inc. |
||||
* |
||||
* See file CREDITS for list of people who contributed to this |
||||
* project. |
||||
* |
||||
* 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., 51 Franklin St, Fifth Floor, Boston, |
||||
* MA 02110-1301 USA |
||||
*/ |
||||
|
||||
#ifndef _BLACKFIN_ERRNO_H |
||||
#define _BLACKFIN_ERRNO_H |
||||
|
||||
#define EPERM 1 /* Operation not permitted */ |
||||
#define ENOENT 2 /* No such file or directory */ |
||||
#define ESRCH 3 /* No such process */ |
||||
#define EINTR 4 /* Interrupted system call */ |
||||
#define EIO 5 /* I/O error */ |
||||
#define ENXIO 6 /* No such device or address */ |
||||
#define E2BIG 7 /* Arg list too long */ |
||||
#define ENOEXEC 8 /* Exec format error */ |
||||
#define EBADF 9 /* Bad file number */ |
||||
#define ECHILD 10 /* No child processes */ |
||||
#define EAGAIN 11 /* Try again */ |
||||
#define ENOMEM 12 /* Out of memory */ |
||||
#define EACCES 13 /* Permission denied */ |
||||
#define EFAULT 14 /* Bad address */ |
||||
#define ENOTBLK 15 /* Block device required */ |
||||
#define EBUSY 16 /* Device or resource busy */ |
||||
#define EEXIST 17 /* File exists */ |
||||
#define EXDEV 18 /* Cross-device link */ |
||||
#define ENODEV 19 /* No such device */ |
||||
#define ENOTDIR 20 /* Not a directory */ |
||||
#define EISDIR 21 /* Is a directory */ |
||||
#define EINVAL 22 /* Invalid argument */ |
||||
#define ENFILE 23 /* File table overflow */ |
||||
#define EMFILE 24 /* Too many open files */ |
||||
#define ENOTTY 25 /* Not a typewriter */ |
||||
#define ETXTBSY 26 /* Text file busy */ |
||||
#define EFBIG 27 /* File too large */ |
||||
#define ENOSPC 28 /* No space left on device */ |
||||
#define ESPIPE 29 /* Illegal seek */ |
||||
#define EROFS 30 /* Read-only file system */ |
||||
#define EMLINK 31 /* Too many links */ |
||||
#define EPIPE 32 /* Broken pipe */ |
||||
#define EDOM 33 /* Math argument out of domain of func */ |
||||
#define ERANGE 34 /* Math result not representable */ |
||||
#define EDEADLK 35 /* Resource deadlock would occur */ |
||||
#define ENAMETOOLONG 36 /* File name too long */ |
||||
#define ENOLCK 37 /* No record locks available */ |
||||
#define ENOSYS 38 /* Function not implemented */ |
||||
#define ENOTEMPTY 39 /* Directory not empty */ |
||||
#define ELOOP 40 /* Too many symbolic links encountered */ |
||||
#define EWOULDBLOCK EAGAIN /* Operation would block */ |
||||
#define ENOMSG 42 /* No message of desired type */ |
||||
#define EIDRM 43 /* Identifier removed */ |
||||
#define ECHRNG 44 /* Channel number out of range */ |
||||
#define EL2NSYNC 45 /* Level 2 not synchronized */ |
||||
#define EL3HLT 46 /* Level 3 halted */ |
||||
#define EL3RST 47 /* Level 3 reset */ |
||||
#define ELNRNG 48 /* Link number out of range */ |
||||
#define EUNATCH 49 /* Protocol driver not attached */ |
||||
#define ENOCSI 50 /* No CSI structure available */ |
||||
#define EL2HLT 51 /* Level 2 halted */ |
||||
#define EBADE 52 /* Invalid exchange */ |
||||
#define EBADR 53 /* Invalid request descriptor */ |
||||
#define EXFULL 54 /* Exchange full */ |
||||
#define ENOANO 55 /* No anode */ |
||||
#define EBADRQC 56 /* Invalid request code */ |
||||
#define EBADSLT 57 /* Invalid slot */ |
||||
|
||||
#define EDEADLOCK EDEADLK |
||||
|
||||
#define EBFONT 59 /* Bad font file format */ |
||||
#define ENOSTR 60 /* Device not a stream */ |
||||
#define ENODATA 61 /* No data available */ |
||||
#define ETIME 62 /* Timer expired */ |
||||
#define ENOSR 63 /* Out of streams resources */ |
||||
#define ENONET 64 /* Machine is not on the network */ |
||||
#define ENOPKG 65 /* Package not installed */ |
||||
#define EREMOTE 66 /* Object is remote */ |
||||
#define ENOLINK 67 /* Link has been severed */ |
||||
#define EADV 68 /* Advertise error */ |
||||
#define ESRMNT 69 /* Srmount error */ |
||||
#define ECOMM 70 /* Communication error on send */ |
||||
#define EPROTO 71 /* Protocol error */ |
||||
#define EMULTIHOP 72 /* Multihop attempted */ |
||||
#define EDOTDOT 73 /* RFS specific error */ |
||||
#define EBADMSG 74 /* Not a data message */ |
||||
#define EOVERFLOW 75 /* Value too large for defined data type */ |
||||
#define ENOTUNIQ 76 /* Name not unique on network */ |
||||
#define EBADFD 77 /* File descriptor in bad state */ |
||||
#define EREMCHG 78 /* Remote address changed */ |
||||
#define ELIBACC 79 /* Can not access a needed shared library */ |
||||
#define ELIBBAD 80 /* Accessing a corrupted shared library */ |
||||
#define ELIBSCN 81 /* .lib section in a.out corrupted */ |
||||
#define ELIBMAX 82 /* Attempting to link in too many shared libraries */ |
||||
#define ELIBEXEC 83 /* Cannot exec a shared library directly */ |
||||
#define EILSEQ 84 /* Illegal byte sequence */ |
||||
#define ERESTART 85 /* Interrupted system call should be restarted */ |
||||
#define ESTRPIPE 86 /* Streams pipe error */ |
||||
#define EUSERS 87 /* Too many users */ |
||||
#define ENOTSOCK 88 /* Socket operation on non-socket */ |
||||
#define EDESTADDRREQ 89 /* Destination address required */ |
||||
#define EMSGSIZE 90 /* Message too long */ |
||||
#define EPROTOTYPE 91 /* Protocol wrong type for socket */ |
||||
#define ENOPROTOOPT 92 /* Protocol not available */ |
||||
#define EPROTONOSUPPORT 93 /* Protocol not supported */ |
||||
#define ESOCKTNOSUPPORT 94 /* Socket type not supported */ |
||||
#define EOPNOTSUPP 95 /* Operation not supported on transport endpoint */ |
||||
#define EPFNOSUPPORT 96 /* Protocol family not supported */ |
||||
#define EAFNOSUPPORT 97 /* Address family not supported by protocol */ |
||||
#define EADDRINUSE 98 /* Address already in use */ |
||||
#define EADDRNOTAVAIL 99 /* Cannot assign requested address */ |
||||
#define ENETDOWN 100 /* Network is down */ |
||||
#define ENETUNREACH 101 /* Network is unreachable */ |
||||
#define ENETRESET 102 /* Network dropped connection because of reset */ |
||||
#define ECONNABORTED 103 /* Software caused connection abort */ |
||||
#define ECONNRESET 104 /* Connection reset by peer */ |
||||
#define ENOBUFS 105 /* No buffer space available */ |
||||
#define EISCONN 106 /* Transport endpoint is already connected */ |
||||
#define ENOTCONN 107 /* Transport endpoint is not connected */ |
||||
#define ESHUTDOWN 108 /* Cannot send after transport endpoint shutdown */ |
||||
#define ETOOMANYREFS 109 /* Too many references: cannot splice */ |
||||
#define ETIMEDOUT 110 /* Connection timed out */ |
||||
#define ECONNREFUSED 111 /* Connection refused */ |
||||
#define EHOSTDOWN 112 /* Host is down */ |
||||
#define EHOSTUNREACH 113 /* No route to host */ |
||||
#define EALREADY 114 /* Operation already in progress */ |
||||
#define EINPROGRESS 115 /* Operation now in progress */ |
||||
#define ESTALE 116 /* Stale NFS file handle */ |
||||
#define EUCLEAN 117 /* Structure needs cleaning */ |
||||
#define ENOTNAM 118 /* Not a XENIX named type file */ |
||||
#define ENAVAIL 119 /* No XENIX semaphores available */ |
||||
#define EISNAM 120 /* Is a named type file */ |
||||
#define EREMOTEIO 121 /* Remote I/O error */ |
||||
#define EDQUOT 122 /* Quota exceeded */ |
||||
|
||||
#define ENOMEDIUM 123 /* No medium found */ |
||||
#define EMEDIUMTYPE 124 /* Wrong medium type */ |
||||
|
||||
#endif |
@ -0,0 +1,126 @@ |
||||
#ifndef __ASM_SH_IRQFLAGS_H |
||||
#define __ASM_SH_IRQFLAGS_H |
||||
|
||||
static inline void raw_local_irq_enable(void) |
||||
{ |
||||
unsigned long __dummy0, __dummy1; |
||||
|
||||
__asm__ __volatile__ ( |
||||
"stc sr, %0\n\t" |
||||
"and %1, %0\n\t" |
||||
#ifdef CONFIG_CPU_HAS_SR_RB |
||||
"stc r6_bank, %1\n\t" |
||||
"or %1, %0\n\t" |
||||
#endif |
||||
"ldc %0, sr\n\t" |
||||
: "=&r" (__dummy0), "=r" (__dummy1) |
||||
: "1" (~0x000000f0) |
||||
: "memory" |
||||
); |
||||
} |
||||
|
||||
static inline void raw_local_irq_disable(void) |
||||
{ |
||||
unsigned long flags; |
||||
|
||||
__asm__ __volatile__ ( |
||||
"stc sr, %0\n\t" |
||||
"or #0xf0, %0\n\t" |
||||
"ldc %0, sr\n\t" |
||||
: "=&z" (flags) |
||||
: /* no inputs */ |
||||
: "memory" |
||||
); |
||||
} |
||||
|
||||
static inline void set_bl_bit(void) |
||||
{ |
||||
unsigned long __dummy0, __dummy1; |
||||
|
||||
__asm__ __volatile__ ( |
||||
"stc sr, %0\n\t" |
||||
"or %2, %0\n\t" |
||||
"and %3, %0\n\t" |
||||
"ldc %0, sr\n\t" |
||||
: "=&r" (__dummy0), "=r" (__dummy1) |
||||
: "r" (0x10000000), "r" (0xffffff0f) |
||||
: "memory" |
||||
); |
||||
} |
||||
|
||||
static inline void clear_bl_bit(void) |
||||
{ |
||||
unsigned long __dummy0, __dummy1; |
||||
|
||||
__asm__ __volatile__ ( |
||||
"stc sr, %0\n\t" |
||||
"and %2, %0\n\t" |
||||
"ldc %0, sr\n\t" |
||||
: "=&r" (__dummy0), "=r" (__dummy1) |
||||
: "1" (~0x10000000) |
||||
: "memory" |
||||
); |
||||
} |
||||
|
||||
static inline unsigned long __raw_local_save_flags(void) |
||||
{ |
||||
unsigned long flags; |
||||
|
||||
__asm__ __volatile__ ( |
||||
"stc sr, %0\n\t" |
||||
"and #0xf0, %0\n\t" |
||||
: "=&z" (flags) |
||||
: /* no inputs */ |
||||
: "memory" |
||||
); |
||||
|
||||
return flags; |
||||
} |
||||
|
||||
#define raw_local_save_flags(flags) \ |
||||
do { (flags) = __raw_local_save_flags(); } while (0) |
||||
|
||||
static inline int raw_irqs_disabled_flags(unsigned long flags) |
||||
{ |
||||
return (flags != 0); |
||||
} |
||||
|
||||
static inline int raw_irqs_disabled(void) |
||||
{ |
||||
unsigned long flags = __raw_local_save_flags(); |
||||
|
||||
return raw_irqs_disabled_flags(flags); |
||||
} |
||||
|
||||
static inline unsigned long __raw_local_irq_save(void) |
||||
{ |
||||
unsigned long flags, __dummy; |
||||
|
||||
__asm__ __volatile__ ( |
||||
"stc sr, %1\n\t" |
||||
"mov %1, %0\n\t" |
||||
"or #0xf0, %0\n\t" |
||||
"ldc %0, sr\n\t" |
||||
"mov %1, %0\n\t" |
||||
"and #0xf0, %0\n\t" |
||||
: "=&z" (flags), "=&r" (__dummy) |
||||
: /* no inputs */ |
||||
: "memory" |
||||
); |
||||
|
||||
return flags; |
||||
} |
||||
|
||||
#define raw_local_irq_save(flags) \ |
||||
do { (flags) = __raw_local_irq_save(); } while (0) |
||||
|
||||
#define local_irq_save raw_local_irq_save |
||||
|
||||
static inline void raw_local_irq_restore(unsigned long flags) |
||||
{ |
||||
if ((flags & 0xf0) != 0xf0) |
||||
raw_local_irq_enable(); |
||||
} |
||||
#define local_irq_restore raw_local_irq_restore |
||||
|
||||
#endif /* __ASM_SH_IRQFLAGS_H */ |
@ -0,0 +1,24 @@ |
||||
#
|
||||
# (C) Copyright 2000-2002
|
||||
# Wolfgang Denk, DENX Software Engineering, wd@denx.de.
|
||||
#
|
||||
# See file CREDITS for list of people who contributed to this
|
||||
# project.
|
||||
#
|
||||
# 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
|
||||
#
|
||||
|
||||
PLATFORM_CPPFLAGS += -DCONFIG_SH -D__SH__
|
Loading…
Reference in new issue