2006-01-06 16:36:29

by David Howells

[permalink] [raw]
Subject: [PATCH 0/17] FRV: Permit compilation with allmodconfig

The attached patches permit the FRV arch to be mostly compiled with
allmodconfig, barring compiler errors.


2006-01-06 16:29:52

by David Howells

[permalink] [raw]
Subject: [PATCH 2/17] FRV: Drop 8/16-bit xchg and cmpxchg

The attached patch drops support for 8-bit and 16-bit xchg and cmpxchg
emulation and implements 32-bit xchg with the SWAP/SWAPI instruction.

Signed-Off-By: David Howells <[email protected]>
---
warthog>diffstat -p1 frv-atomic-2615.diff
arch/frv/lib/atomic-ops.S | 92 --------------------------------------------
include/asm-frv/atomic.h | 96 ++--------------------------------------------
2 files changed, 5 insertions(+), 183 deletions(-)

diff -uNrp /warthog/kernels/linux-2.6.15/arch/frv/lib/atomic-ops.S linux-2.6.15-frv/arch/frv/lib/atomic-ops.S
--- /warthog/kernels/linux-2.6.15/arch/frv/lib/atomic-ops.S 2005-03-02 12:07:44.000000000 +0000
+++ linux-2.6.15-frv/arch/frv/lib/atomic-ops.S 2006-01-06 14:43:43.000000000 +0000
@@ -129,48 +129,6 @@ atomic_sub_return:

###############################################################################
#
-# uint8_t __xchg_8(uint8_t i, uint8_t *v)
-#
-###############################################################################
- .globl __xchg_8
- .type __xchg_8,@function
-__xchg_8:
- or.p gr8,gr8,gr10
-0:
- orcc gr0,gr0,gr0,icc3 /* set ICC3.Z */
- ckeq icc3,cc7
- ldub.p @(gr9,gr0),gr8 /* LD.P/ORCR must be atomic */
- orcr cc7,cc7,cc3 /* set CC3 to true */
- cstb.p gr10,@(gr9,gr0) ,cc3,#1
- corcc gr29,gr29,gr0 ,cc3,#1 /* clear ICC3.Z if store happens */
- beq icc3,#0,0b
- bralr
-
- .size __xchg_8, .-__xchg_8
-
-###############################################################################
-#
-# uint16_t __xchg_16(uint16_t i, uint16_t *v)
-#
-###############################################################################
- .globl __xchg_16
- .type __xchg_16,@function
-__xchg_16:
- or.p gr8,gr8,gr10
-0:
- orcc gr0,gr0,gr0,icc3 /* set ICC3.Z */
- ckeq icc3,cc7
- lduh.p @(gr9,gr0),gr8 /* LD.P/ORCR must be atomic */
- orcr cc7,cc7,cc3 /* set CC3 to true */
- csth.p gr10,@(gr9,gr0) ,cc3,#1
- corcc gr29,gr29,gr0 ,cc3,#1 /* clear ICC3.Z if store happens */
- beq icc3,#0,0b
- bralr
-
- .size __xchg_16, .-__xchg_16
-
-###############################################################################
-#
# uint32_t __xchg_32(uint32_t i, uint32_t *v)
#
###############################################################################
@@ -192,56 +150,6 @@ __xchg_32:

###############################################################################
#
-# uint8_t __cmpxchg_8(uint8_t *v, uint8_t test, uint8_t new)
-#
-###############################################################################
- .globl __cmpxchg_8
- .type __cmpxchg_8,@function
-__cmpxchg_8:
- or.p gr8,gr8,gr11
-0:
- orcc gr0,gr0,gr0,icc3
- ckeq icc3,cc7
- ldub.p @(gr11,gr0),gr8
- orcr cc7,cc7,cc3
- sub gr8,gr9,gr7
- sllicc gr7,#24,gr0,icc0
- bne icc0,#0,1f
- cstb.p gr10,@(gr11,gr0) ,cc3,#1
- corcc gr29,gr29,gr0 ,cc3,#1
- beq icc3,#0,0b
-1:
- bralr
-
- .size __cmpxchg_8, .-__cmpxchg_8
-
-###############################################################################
-#
-# uint16_t __cmpxchg_16(uint16_t *v, uint16_t test, uint16_t new)
-#
-###############################################################################
- .globl __cmpxchg_16
- .type __cmpxchg_16,@function
-__cmpxchg_16:
- or.p gr8,gr8,gr11
-0:
- orcc gr0,gr0,gr0,icc3
- ckeq icc3,cc7
- lduh.p @(gr11,gr0),gr8
- orcr cc7,cc7,cc3
- sub gr8,gr9,gr7
- sllicc gr7,#16,gr0,icc0
- bne icc0,#0,1f
- csth.p gr10,@(gr11,gr0) ,cc3,#1
- corcc gr29,gr29,gr0 ,cc3,#1
- beq icc3,#0,0b
-1:
- bralr
-
- .size __cmpxchg_16, .-__cmpxchg_16
-
-###############################################################################
-#
# uint32_t __cmpxchg_32(uint32_t *v, uint32_t test, uint32_t new)
#
###############################################################################
diff -uNrp /warthog/kernels/linux-2.6.15/include/asm-frv/atomic.h linux-2.6.15-frv/include/asm-frv/atomic.h
--- /warthog/kernels/linux-2.6.15/include/asm-frv/atomic.h 2006-01-04 12:39:38.000000000 +0000
+++ linux-2.6.15-frv/include/asm-frv/atomic.h 2006-01-06 14:43:43.000000000 +0000
@@ -218,51 +218,12 @@ extern unsigned long atomic_test_and_XOR
__typeof__(*(ptr)) __xg_orig; \
\
switch (sizeof(__xg_orig)) { \
- case 1: \
- asm volatile( \
- "0: \n" \
- " orcc gr0,gr0,gr0,icc3 \n" \
- " ckeq icc3,cc7 \n" \
- " ldub.p %M0,%1 \n" \
- " orcr cc7,cc7,cc3 \n" \
- " cstb.p %2,%M0 ,cc3,#1 \n" \
- " corcc gr29,gr29,gr0 ,cc3,#1 \n" \
- " beq icc3,#0,0b \n" \
- : "+U"(*__xg_ptr), "=&r"(__xg_orig) \
- : "r"(x) \
- : "memory", "cc7", "cc3", "icc3" \
- ); \
- break; \
- \
- case 2: \
- asm volatile( \
- "0: \n" \
- " orcc gr0,gr0,gr0,icc3 \n" \
- " ckeq icc3,cc7 \n" \
- " lduh.p %M0,%1 \n" \
- " orcr cc7,cc7,cc3 \n" \
- " csth.p %2,%M0 ,cc3,#1 \n" \
- " corcc gr29,gr29,gr0 ,cc3,#1 \n" \
- " beq icc3,#0,0b \n" \
- : "+U"(*__xg_ptr), "=&r"(__xg_orig) \
- : "r"(x) \
- : "memory", "cc7", "cc3", "icc3" \
- ); \
- break; \
- \
case 4: \
asm volatile( \
- "0: \n" \
- " orcc gr0,gr0,gr0,icc3 \n" \
- " ckeq icc3,cc7 \n" \
- " ld.p %M0,%1 \n" \
- " orcr cc7,cc7,cc3 \n" \
- " cst.p %2,%M0 ,cc3,#1 \n" \
- " corcc gr29,gr29,gr0 ,cc3,#1 \n" \
- " beq icc3,#0,0b \n" \
- : "+U"(*__xg_ptr), "=&r"(__xg_orig) \
+ "swap%I0 %2,%M0" \
+ : "+m"(*__xg_ptr), "=&r"(__xg_orig) \
: "r"(x) \
- : "memory", "cc7", "cc3", "icc3" \
+ : "memory" \
); \
break; \
\
@@ -277,8 +238,6 @@ extern unsigned long atomic_test_and_XOR

#else

-extern uint8_t __xchg_8 (uint8_t i, volatile void *v);
-extern uint16_t __xchg_16(uint16_t i, volatile void *v);
extern uint32_t __xchg_32(uint32_t i, volatile void *v);

#define xchg(ptr, x) \
@@ -287,8 +246,6 @@ extern uint32_t __xchg_32(uint32_t i, vo
__typeof__(*(ptr)) __xg_orig; \
\
switch (sizeof(__xg_orig)) { \
- case 1: __xg_orig = (__typeof__(*(ptr))) __xchg_8 ((uint8_t) x, __xg_ptr); break; \
- case 2: __xg_orig = (__typeof__(*(ptr))) __xchg_16((uint16_t) x, __xg_ptr); break; \
case 4: __xg_orig = (__typeof__(*(ptr))) __xchg_32((uint32_t) x, __xg_ptr); break; \
default: \
__xg_orig = 0; \
@@ -318,46 +275,6 @@ extern uint32_t __xchg_32(uint32_t i, vo
__typeof__(*(ptr)) __xg_new = (new); \
\
switch (sizeof(__xg_orig)) { \
- case 1: \
- asm volatile( \
- "0: \n" \
- " orcc gr0,gr0,gr0,icc3 \n" \
- " ckeq icc3,cc7 \n" \
- " ldub.p %M0,%1 \n" \
- " orcr cc7,cc7,cc3 \n" \
- " sub%I4 %1,%4,%2 \n" \
- " sllcc %2,#24,gr0,icc0 \n" \
- " bne icc0,#0,1f \n" \
- " cstb.p %3,%M0 ,cc3,#1 \n" \
- " corcc gr29,gr29,gr0 ,cc3,#1 \n" \
- " beq icc3,#0,0b \n" \
- "1: \n" \
- : "+U"(*__xg_ptr), "=&r"(__xg_orig), "=&r"(__xg_tmp) \
- : "r"(__xg_new), "NPr"(__xg_test) \
- : "memory", "cc7", "cc3", "icc3", "icc0" \
- ); \
- break; \
- \
- case 2: \
- asm volatile( \
- "0: \n" \
- " orcc gr0,gr0,gr0,icc3 \n" \
- " ckeq icc3,cc7 \n" \
- " lduh.p %M0,%1 \n" \
- " orcr cc7,cc7,cc3 \n" \
- " sub%I4 %1,%4,%2 \n" \
- " sllcc %2,#16,gr0,icc0 \n" \
- " bne icc0,#0,1f \n" \
- " csth.p %3,%M0 ,cc3,#1 \n" \
- " corcc gr29,gr29,gr0 ,cc3,#1 \n" \
- " beq icc3,#0,0b \n" \
- "1: \n" \
- : "+U"(*__xg_ptr), "=&r"(__xg_orig), "=&r"(__xg_tmp) \
- : "r"(__xg_new), "NPr"(__xg_test) \
- : "memory", "cc7", "cc3", "icc3", "icc0" \
- ); \
- break; \
- \
case 4: \
asm volatile( \
"0: \n" \
@@ -388,8 +305,6 @@ extern uint32_t __xchg_32(uint32_t i, vo

#else

-extern uint8_t __cmpxchg_8 (uint8_t *v, uint8_t test, uint8_t new);
-extern uint16_t __cmpxchg_16(uint16_t *v, uint16_t test, uint16_t new);
extern uint32_t __cmpxchg_32(uint32_t *v, uint32_t test, uint32_t new);

#define cmpxchg(ptr, test, new) \
@@ -400,8 +315,6 @@ extern uint32_t __cmpxchg_32(uint32_t *v
__typeof__(*(ptr)) __xg_new = (new); \
\
switch (sizeof(__xg_orig)) { \
- case 1: __xg_orig = __cmpxchg_8 (__xg_ptr, __xg_test, __xg_new); break; \
- case 2: __xg_orig = __cmpxchg_16(__xg_ptr, __xg_test, __xg_new); break; \
case 4: __xg_orig = __cmpxchg_32(__xg_ptr, __xg_test, __xg_new); break; \
default: \
__xg_orig = 0; \
@@ -414,7 +327,7 @@ extern uint32_t __cmpxchg_32(uint32_t *v

#endif

-#define atomic_cmpxchg(v, old, new) ((int)cmpxchg(&((v)->counter), old, new))
+#define atomic_cmpxchg(v, old, new) (cmpxchg(&((v)->counter), old, new))

#define atomic_add_unless(v, a, u) \
({ \
@@ -424,6 +337,7 @@ extern uint32_t __cmpxchg_32(uint32_t *v
c = old; \
c != (u); \
})
+
#define atomic_inc_not_zero(v) atomic_add_unless((v), 1, 0)

#endif /* _ASM_ATOMIC_H */

2006-01-06 16:29:49

by David Howells

[permalink] [raw]
Subject: [PATCH 17/17] FRV: Stop XFS from accessing sem count directly

The attached patch stops the XFS from accessing the internals of a semaphore
directly. On the FRV arch, which XFS does does not work. This alternative
implementation was supplied by Al Viro.

If Ingo Molnar's mutexes are going to be accepted into the kernel, then this
patch should be dropped.

Signed-Off-By: David Howells <[email protected]>
---
warthog>diffstat -p1 xfs-sema-2615.diff
fs/xfs/linux-2.6/sema.h | 5 ++++-
fs/xfs/quota/xfs_dquot.h | 4 ++--
fs/xfs/quota/xfs_dquot_item.c | 4 ++--
fs/xfs/xfs_iget.c | 2 +-
fs/xfs/xfs_inode.c | 4 ++--
fs/xfs/xfs_inode_item.c | 6 +++---
6 files changed, 14 insertions(+), 11 deletions(-)

diff -uNrp /warthog/kernels/linux-2.6.15/fs/xfs/linux-2.6/sema.h linux-2.6.15-frv/fs/xfs/linux-2.6/sema.h
--- /warthog/kernels/linux-2.6.15/fs/xfs/linux-2.6/sema.h 2006-01-04 12:39:36.000000000 +0000
+++ linux-2.6.15-frv/fs/xfs/linux-2.6/sema.h 2006-01-06 14:43:43.000000000 +0000
@@ -34,8 +34,11 @@ typedef struct semaphore sema_t;
#define initnsema(sp, val, name) sema_init(sp, val)
#define psema(sp, b) down(sp)
#define vsema(sp) up(sp)
-#define valusema(sp) (atomic_read(&(sp)->count))
#define freesema(sema)
+static inline int sem_is_locked(sema_t *sp)
+{
+ return down_trylock(sp) || (up(sp), 0);
+}

/*
* Map cpsema (try to get the sema) to down_trylock. We need to switch
diff -uNrp /warthog/kernels/linux-2.6.15/fs/xfs/quota/xfs_dquot.h linux-2.6.15-frv/fs/xfs/quota/xfs_dquot.h
--- /warthog/kernels/linux-2.6.15/fs/xfs/quota/xfs_dquot.h 2006-01-04 12:39:36.000000000 +0000
+++ linux-2.6.15-frv/fs/xfs/quota/xfs_dquot.h 2006-01-06 14:43:43.000000000 +0000
@@ -119,7 +119,7 @@ XFS_DQ_IS_LOCKED(xfs_dquot_t *dqp)
*/
#define xfs_dqflock(dqp) { psema(&((dqp)->q_flock), PINOD | PRECALC);\
(dqp)->dq_flags |= XFS_DQ_FLOCKED; }
-#define xfs_dqfunlock(dqp) { ASSERT(valusema(&((dqp)->q_flock)) <= 0); \
+#define xfs_dqfunlock(dqp) { ASSERT(sem_is_locked(&((dqp)->q_flock))); \
vsema(&((dqp)->q_flock)); \
(dqp)->dq_flags &= ~(XFS_DQ_FLOCKED); }

@@ -128,7 +128,7 @@ XFS_DQ_IS_LOCKED(xfs_dquot_t *dqp)
#define XFS_DQ_PINUNLOCK(dqp, s) mutex_spinunlock( \
&(XFS_DQ_TO_QINF(dqp)->qi_pinlock), s)

-#define XFS_DQ_IS_FLUSH_LOCKED(dqp) (valusema(&((dqp)->q_flock)) <= 0)
+#define XFS_DQ_IS_FLUSH_LOCKED(dqp) (sem_is_locked(&((dqp)->q_flock)))
#define XFS_DQ_IS_ON_FREELIST(dqp) ((dqp)->dq_flnext != (dqp))
#define XFS_DQ_IS_DIRTY(dqp) ((dqp)->dq_flags & XFS_DQ_DIRTY)
#define XFS_QM_ISUDQ(dqp) ((dqp)->dq_flags & XFS_DQ_USER)
diff -uNrp /warthog/kernels/linux-2.6.15/fs/xfs/quota/xfs_dquot_item.c linux-2.6.15-frv/fs/xfs/quota/xfs_dquot_item.c
--- /warthog/kernels/linux-2.6.15/fs/xfs/quota/xfs_dquot_item.c 2006-01-04 12:39:36.000000000 +0000
+++ linux-2.6.15-frv/fs/xfs/quota/xfs_dquot_item.c 2006-01-06 14:43:43.000000000 +0000
@@ -246,7 +246,7 @@ xfs_qm_dquot_logitem_pushbuf(
* inode flush completed and the inode was taken off the AIL.
* So, just get out.
*/
- if ((valusema(&(dqp->q_flock)) > 0) ||
+ if (!sem_is_locked(&(dqp->q_flock)) ||
((qip->qli_item.li_flags & XFS_LI_IN_AIL) == 0)) {
qip->qli_pushbuf_flag = 0;
xfs_dqunlock(dqp);
@@ -259,7 +259,7 @@ xfs_qm_dquot_logitem_pushbuf(
if (bp != NULL) {
if (XFS_BUF_ISDELAYWRITE(bp)) {
dopush = ((qip->qli_item.li_flags & XFS_LI_IN_AIL) &&
- (valusema(&(dqp->q_flock)) <= 0));
+ sem_is_locked(&(dqp->q_flock)));
qip->qli_pushbuf_flag = 0;
xfs_dqunlock(dqp);

diff -uNrp /warthog/kernels/linux-2.6.15/fs/xfs/xfs_iget.c linux-2.6.15-frv/fs/xfs/xfs_iget.c
--- /warthog/kernels/linux-2.6.15/fs/xfs/xfs_iget.c 2006-01-04 12:39:37.000000000 +0000
+++ linux-2.6.15-frv/fs/xfs/xfs_iget.c 2006-01-06 14:43:43.000000000 +0000
@@ -1041,6 +1041,6 @@ xfs_iflock_nowait(xfs_inode_t *ip)
void
xfs_ifunlock(xfs_inode_t *ip)
{
- ASSERT(valusema(&(ip->i_flock)) <= 0);
+ ASSERT(sem_is_locked(&(ip->i_flock)));
vsema(&(ip->i_flock));
}
diff -uNrp /warthog/kernels/linux-2.6.15/fs/xfs/xfs_inode.c linux-2.6.15-frv/fs/xfs/xfs_inode.c
--- /warthog/kernels/linux-2.6.15/fs/xfs/xfs_inode.c 2006-01-04 12:39:37.000000000 +0000
+++ linux-2.6.15-frv/fs/xfs/xfs_inode.c 2006-01-06 14:43:43.000000000 +0000
@@ -3061,7 +3061,7 @@ xfs_iflush(
XFS_STATS_INC(xs_iflush_count);

ASSERT(ismrlocked(&ip->i_lock, MR_UPDATE|MR_ACCESS));
- ASSERT(valusema(&ip->i_flock) <= 0);
+ ASSERT(sem_is_locked(&(ip->i_flock)));
ASSERT(ip->i_d.di_format != XFS_DINODE_FMT_BTREE ||
ip->i_d.di_nextents > ip->i_df.if_ext_max);

@@ -3319,7 +3319,7 @@ xfs_iflush_int(
SPLDECL(s);

ASSERT(ismrlocked(&ip->i_lock, MR_UPDATE|MR_ACCESS));
- ASSERT(valusema(&ip->i_flock) <= 0);
+ ASSERT(sem_is_locked(&(ip->i_flock)));
ASSERT(ip->i_d.di_format != XFS_DINODE_FMT_BTREE ||
ip->i_d.di_nextents > ip->i_df.if_ext_max);

diff -uNrp /warthog/kernels/linux-2.6.15/fs/xfs/xfs_inode_item.c linux-2.6.15-frv/fs/xfs/xfs_inode_item.c
--- /warthog/kernels/linux-2.6.15/fs/xfs/xfs_inode_item.c 2006-01-04 12:39:37.000000000 +0000
+++ linux-2.6.15-frv/fs/xfs/xfs_inode_item.c 2006-01-06 14:43:43.000000000 +0000
@@ -789,7 +789,7 @@ xfs_inode_item_pushbuf(
* inode flush completed and the inode was taken off the AIL.
* So, just get out.
*/
- if ((valusema(&(ip->i_flock)) > 0) ||
+ if (!sem_is_locked(&(ip->i_flock)) ||
((iip->ili_item.li_flags & XFS_LI_IN_AIL) == 0)) {
iip->ili_pushbuf_flag = 0;
xfs_iunlock(ip, XFS_ILOCK_SHARED);
@@ -811,7 +811,7 @@ xfs_inode_item_pushbuf(
* If not, we can flush it async.
*/
dopush = ((iip->ili_item.li_flags & XFS_LI_IN_AIL) &&
- (valusema(&(ip->i_flock)) <= 0));
+ sem_is_locked(&(ip->i_flock)));
iip->ili_pushbuf_flag = 0;
xfs_iunlock(ip, XFS_ILOCK_SHARED);
xfs_buftrace("INODE ITEM PUSH", bp);
@@ -859,7 +859,7 @@ xfs_inode_item_push(
ip = iip->ili_inode;

ASSERT(ismrlocked(&(ip->i_lock), MR_ACCESS));
- ASSERT(valusema(&(ip->i_flock)) <= 0);
+ ASSERT(sem_is_locked(&(ip->i_flock)));
/*
* Since we were able to lock the inode's flush lock and
* we found it on the AIL, the inode must be dirty. This

2006-01-06 16:30:35

by David Howells

[permalink] [raw]
Subject: [PATCH 16/17] FRV: Fix uninitialised variable in serverworks driver

The attached patch fixes an uninitialised variable warning in the serverworks
driver.

Signed-Off-By: David Howells <[email protected]>
---
warthog>diffstat -p1 serverworks-2615.diff
drivers/ide/pci/serverworks.c | 2 +-
1 files changed, 1 insertion(+), 1 deletion(-)

diff -uNrp /warthog/kernels/linux-2.6.15/drivers/ide/pci/serverworks.c linux-2.6.15-frv/drivers/ide/pci/serverworks.c
--- /warthog/kernels/linux-2.6.15/drivers/ide/pci/serverworks.c 2005-08-30 13:56:16.000000000 +0100
+++ linux-2.6.15-frv/drivers/ide/pci/serverworks.c 2006-01-06 14:43:43.000000000 +0000
@@ -69,7 +69,7 @@ static int check_in_drive_lists (ide_dri
static u8 svwks_ratemask (ide_drive_t *drive)
{
struct pci_dev *dev = HWIF(drive)->pci_dev;
- u8 mode;
+ u8 mode = 0;

if (!svwks_revision)
pci_read_config_byte(dev, PCI_REVISION_ID, &svwks_revision);

2006-01-06 16:30:37

by David Howells

[permalink] [raw]
Subject: [PATCH 7/17] FRV: Add module support stubs

The attached patch adds stubs for FRV module support.

Signed-Off-By: David Howells <[email protected]>
---
warthog>diffstat -p1 frv-modules-2615.diff
arch/frv/kernel/Makefile | 1
arch/frv/kernel/module.c | 80 +++++++++++++++++++++++++++++++++++++++++++++++
include/asm-frv/module.h | 16 +++++++--
3 files changed, 93 insertions(+), 4 deletions(-)

diff -uNrp /warthog/kernels/linux-2.6.15/arch/frv/kernel/Makefile linux-2.6.15-frv/arch/frv/kernel/Makefile
--- /warthog/kernels/linux-2.6.15/arch/frv/kernel/Makefile 2005-03-02 12:07:44.000000000 +0000
+++ linux-2.6.15-frv/arch/frv/kernel/Makefile 2006-01-06 14:43:43.000000000 +0000
@@ -20,3 +20,4 @@ obj-$(CONFIG_FUJITSU_MB93493) += irq-mb9
obj-$(CONFIG_PM) += pm.o cmode.o
obj-$(CONFIG_MB93093_PDK) += pm-mb93093.o
obj-$(CONFIG_SYSCTL) += sysctl.o
+obj-$(CONFIG_MODULES) += module.o
diff -uNrp /warthog/kernels/linux-2.6.15/arch/frv/kernel/module.c linux-2.6.15-frv/arch/frv/kernel/module.c
--- /warthog/kernels/linux-2.6.15/arch/frv/kernel/module.c 1970-01-01 01:00:00.000000000 +0100
+++ linux-2.6.15-frv/arch/frv/kernel/module.c 2006-01-06 14:43:43.000000000 +0000
@@ -0,0 +1,80 @@
+/* module.c: FRV specific module loading bits
+ *
+ * Copyright (C) 2006 Red Hat, Inc. All Rights Reserved.
+ * Written by David Howells ([email protected])
+ * - Derived from arch/i386/kernel/module.c, Copyright (C) 2001 Rusty Russell.
+ *
+ * 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.
+ */
+#include <linux/moduleloader.h>
+#include <linux/elf.h>
+#include <linux/vmalloc.h>
+#include <linux/fs.h>
+#include <linux/string.h>
+#include <linux/kernel.h>
+
+#if 0
+#define DEBUGP printk
+#else
+#define DEBUGP(fmt...)
+#endif
+
+void *module_alloc(unsigned long size)
+{
+ if (size == 0)
+ return NULL;
+
+ return vmalloc_exec(size);
+}
+
+
+/* Free memory returned from module_alloc */
+void module_free(struct module *mod, void *module_region)
+{
+ vfree(module_region);
+ /* FIXME: If module_region == mod->init_region, trim exception
+ table entries. */
+}
+
+/* We don't need anything special. */
+int module_frob_arch_sections(Elf_Ehdr *hdr,
+ Elf_Shdr *sechdrs,
+ char *secstrings,
+ struct module *mod)
+{
+ return 0;
+}
+
+int apply_relocate(Elf32_Shdr *sechdrs,
+ const char *strtab,
+ unsigned int symindex,
+ unsigned int relsec,
+ struct module *me)
+{
+ printk(KERN_ERR "module %s: ADD RELOCATION unsupported\n", me->name);
+ return -ENOEXEC;
+}
+
+int apply_relocate_add(Elf32_Shdr *sechdrs,
+ const char *strtab,
+ unsigned int symindex,
+ unsigned int relsec,
+ struct module *me)
+{
+ printk(KERN_ERR "module %s: ADD RELOCATION unsupported\n", me->name);
+ return -ENOEXEC;
+}
+
+int module_finalize(const Elf_Ehdr *hdr,
+ const Elf_Shdr *sechdrs,
+ struct module *me)
+{
+ return 0;
+}
+
+void module_arch_cleanup(struct module *mod)
+{
+}
diff -uNrp /warthog/kernels/linux-2.6.15/include/asm-frv/module.h linux-2.6.15-frv/include/asm-frv/module.h
--- /warthog/kernels/linux-2.6.15/include/asm-frv/module.h 2005-03-02 12:08:45.000000000 +0000
+++ linux-2.6.15-frv/include/asm-frv/module.h 2006-01-06 14:43:43.000000000 +0000
@@ -11,10 +11,18 @@
#ifndef _ASM_MODULE_H
#define _ASM_MODULE_H

-#define module_map(x) vmalloc(x)
-#define module_unmap(x) vfree(x)
-#define module_arch_init(x) (0)
-#define arch_init_modules(x) do { } while (0)
+struct mod_arch_specific
+{
+};
+
+#define Elf_Shdr Elf32_Shdr
+#define Elf_Sym Elf32_Sym
+#define Elf_Ehdr Elf32_Ehdr
+
+/*
+ * Include the architecture version.
+ */
+#define MODULE_ARCH_VERMAGIC __stringify(PROCESSOR_MODEL_NAME) " "

#endif /* _ASM_MODULE_H */

2006-01-06 16:31:20

by David Howells

[permalink] [raw]
Subject: [PATCH 3/17] FRV: Drop unsupported debugging features

The attached patch drops support for debugging features that aren't supported
on FRV:

(*) EARLY_PRINTK

The on-chip UARTs are set up early enough that this isn't required,
and VGA support isn't available. There's also a gdbstub available.

(*) DEBUG_PAGEALLOC

This can't be easily be done since we use huge static mappings to
cover the kernel, not pages.

Signed-Off-By: David Howells <[email protected]>
---
warthog>diffstat -p1 frv-debugging-2615.diff
arch/frv/Kconfig.debug | 22 ----------------------
1 files changed, 22 deletions(-)

diff -uNrp /warthog/kernels/linux-2.6.15/arch/frv/Kconfig.debug linux-2.6.15-frv/arch/frv/Kconfig.debug
--- /warthog/kernels/linux-2.6.15/arch/frv/Kconfig.debug 2005-06-22 13:51:25.000000000 +0100
+++ linux-2.6.15-frv/arch/frv/Kconfig.debug 2006-01-06 14:43:43.000000000 +0000
@@ -2,32 +2,10 @@ menu "Kernel hacking"

source "lib/Kconfig.debug"

-config EARLY_PRINTK
- bool "Early printk"
- depends on EMBEDDED && DEBUG_KERNEL
- default n
- help
- Write kernel log output directly into the VGA buffer or to a serial
- port.
-
- This is useful for kernel debugging when your machine crashes very
- early before the console code is initialized. For normal operation
- it is not recommended because it looks ugly and doesn't cooperate
- with klogd/syslogd or the X server. You should normally N here,
- unless you want to debug such a crash.
-
config DEBUG_STACKOVERFLOW
bool "Check for stack overflows"
depends on DEBUG_KERNEL

-config DEBUG_PAGEALLOC
- bool "Page alloc debugging"
- depends on DEBUG_KERNEL
- help
- Unmap pages from the kernel linear mapping after free_pages().
- This results in a large slowdown, but helps to find certain types
- of memory corruptions.
-
config GDBSTUB
bool "Remote GDB kernel debugging"
depends on DEBUG_KERNEL

2006-01-06 16:31:24

by David Howells

[permalink] [raw]
Subject: [PATCH 9/17] FRV: Fix PCMCIA configuration

The attached patch fixes PCMCIA configuration for FRV by including the stock
PCMCIA configuration description file.

Signed-Off-By: David Howells <[email protected]>
---
warthog>diffstat -p1 frv-pcmcia-2615.diff
arch/frv/Kconfig | 18 +-----------------
1 files changed, 1 insertion(+), 17 deletions(-)

diff -uNrp /warthog/kernels/linux-2.6.15/arch/frv/Kconfig linux-2.6.15-frv/arch/frv/Kconfig
--- /warthog/kernels/linux-2.6.15/arch/frv/Kconfig 2005-08-30 13:56:10.000000000 +0100
+++ linux-2.6.15-frv/arch/frv/Kconfig 2006-01-06 14:43:43.000000000 +0000
@@ -305,23 +310,7 @@ config RESERVE_DMA_COHERENT

source "drivers/pci/Kconfig"

-config PCMCIA
- tristate "Use PCMCIA"
- help
- Say Y here if you want to attach PCMCIA- or PC-cards to your FR-V
- board. These are credit-card size devices such as network cards,
- modems or hard drives often used with laptops computers. There are
- actually two varieties of these cards: the older 16 bit PCMCIA cards
- and the newer 32 bit CardBus cards. If you want to use CardBus
- cards, you need to say Y here and also to "CardBus support" below.
-
- To use your PC-cards, you will need supporting software from David
- Hinds pcmcia-cs package (see the file <file:Documentation/Changes>
- for location). Please also read the PCMCIA-HOWTO, available from
- <http://www.tldp.org/docs.html#howto>.
-
- To compile this driver as modules, choose M here: the
- modules will be called pcmcia_core and ds.
+source "drivers/pcmcia/Kconfig"

#config MATH_EMULATION
# bool "Math emulation support (EXPERIMENTAL)"

2006-01-06 16:32:11

by David Howells

[permalink] [raw]
Subject: [PATCH 1/17] FRV: Suppress configuration of certain features for FRV

The attached patch suppresses configuration of certain features for the FRV
arch as they can't be built for FRV at the moment:

(*) RTC

(*) HISAX_*

(*) PARPORT_PC

(*) VGA_CONSOLE

(*) BINFMT_ELF

Signed-Off-By: David Howells <[email protected]>
---
warthog>diffstat -p1 frv-deconfig-2615.diff
drivers/char/Kconfig | 4 ++--
drivers/isdn/hisax/Kconfig | 10 +++++-----
drivers/parport/Kconfig | 2 +-
drivers/video/console/Kconfig | 2 +-
fs/Kconfig.binfmt | 2 +-
5 files changed, 10 insertions(+), 10 deletions(-)

diff -uNrp /warthog/kernels/linux-2.6.15/drivers/char/Kconfig linux-2.6.15-frv/drivers/char/Kconfig
--- /warthog/kernels/linux-2.6.15/drivers/char/Kconfig 2006-01-04 12:39:24.000000000 +0000
+++ linux-2.6.15-frv/drivers/char/Kconfig 2006-01-06 14:45:11.000000000 +0000
@@ -687,7 +687,7 @@ config NVRAM

config RTC
tristate "Enhanced Real Time Clock Support"
- depends on !PPC32 && !PARISC && !IA64 && !M68K && (!SPARC || PCI)
+ depends on !PPC32 && !PARISC && !IA64 && !M68K && (!SPARC || PCI) && !FRV
---help---
If you say Y here and create a character special file /dev/rtc with
major number 10 and minor number 135 using mknod ("man mknod"), you
@@ -735,7 +735,7 @@ config SGI_IP27_RTC

config GEN_RTC
tristate "Generic /dev/rtc emulation"
- depends on RTC!=y && !IA64 && !ARM && !M32R && !SPARC
+ depends on RTC!=y && !IA64 && !ARM && !M32R && !SPARC && !FRV
---help---
If you say Y here and create a character special file /dev/rtc with
major number 10 and minor number 135 using mknod ("man mknod"), you
diff -uNrp /warthog/kernels/linux-2.6.15/drivers/isdn/hisax/Kconfig linux-2.6.15-frv/drivers/isdn/hisax/Kconfig
--- /warthog/kernels/linux-2.6.15/drivers/isdn/hisax/Kconfig 2006-01-04 12:39:26.000000000 +0000
+++ linux-2.6.15-frv/drivers/isdn/hisax/Kconfig 2006-01-06 14:43:43.000000000 +0000
@@ -110,7 +110,7 @@ config HISAX_16_3

config HISAX_TELESPCI
bool "Teles PCI"
- depends on PCI && (BROKEN || !(SPARC || PPC || PARISC || M68K))
+ depends on PCI && (BROKEN || !(SPARC || PPC || PARISC || M68K || FRV))
help
This enables HiSax support for the Teles PCI.
See <file:Documentation/isdn/README.HiSax> on how to configure it.
@@ -238,7 +238,7 @@ config HISAX_MIC

config HISAX_NETJET
bool "NETjet card"
- depends on PCI && (BROKEN || !(SPARC || PPC || PARISC || M68K))
+ depends on PCI && (BROKEN || !(SPARC || PPC || PARISC || M68K || FRV))
help
This enables HiSax support for the NetJet from Traverse
Technologies.
@@ -249,7 +249,7 @@ config HISAX_NETJET

config HISAX_NETJET_U
bool "NETspider U card"
- depends on PCI && (BROKEN || !(SPARC || PPC || PARISC || M68K))
+ depends on PCI && (BROKEN || !(SPARC || PPC || PARISC || M68K || FRV))
help
This enables HiSax support for the Netspider U interface ISDN card
from Traverse Technologies.
@@ -317,7 +317,7 @@ config HISAX_GAZEL

config HISAX_HFC_PCI
bool "HFC PCI-Bus cards"
- depends on PCI && (BROKEN || !(SPARC || PPC || PARISC || M68K))
+ depends on PCI && (BROKEN || !(SPARC || PPC || PARISC || M68K || FRV))
help
This enables HiSax support for the HFC-S PCI 2BDS0 based cards.

@@ -344,7 +344,7 @@ config HISAX_HFC_SX

config HISAX_ENTERNOW_PCI
bool "Formula-n enter:now PCI card"
- depends on PCI && (BROKEN || !(SPARC || PPC || PARISC || M68K))
+ depends on PCI && (BROKEN || !(SPARC || PPC || PARISC || M68K || FRV))
help
This enables HiSax support for the Formula-n enter:now PCI
ISDN card.
diff -uNrp /warthog/kernels/linux-2.6.15/drivers/parport/Kconfig linux-2.6.15-frv/drivers/parport/Kconfig
--- /warthog/kernels/linux-2.6.15/drivers/parport/Kconfig 2005-08-30 13:56:21.000000000 +0100
+++ linux-2.6.15-frv/drivers/parport/Kconfig 2006-01-06 14:43:43.000000000 +0000
@@ -34,7 +34,7 @@ config PARPORT

config PARPORT_PC
tristate "PC-style hardware"
- depends on PARPORT && (!SPARC64 || PCI) && !SPARC32 && !M32R
+ depends on PARPORT && (!SPARC64 || PCI) && !SPARC32 && !M32R && !FRV
---help---
You should say Y here if you have a PC-style parallel port. All
IBM PC compatible computers and some Alphas have PC-style
diff -uNrp /warthog/kernels/linux-2.6.15/drivers/video/console/Kconfig linux-2.6.15-frv/drivers/video/console/Kconfig
--- /warthog/kernels/linux-2.6.15/drivers/video/console/Kconfig 2006-01-04 12:39:34.000000000 +0000
+++ linux-2.6.15-frv/drivers/video/console/Kconfig 2006-01-06 14:46:13.000000000 +0000
@@ -6,7 +6,7 @@ menu "Console display driver support"

config VGA_CONSOLE
bool "VGA text console" if EMBEDDED || !X86
- depends on !ARCH_ACORN && !ARCH_EBSA110 && !4xx && !8xx && !SPARC && !M68K && !PARISC && !ARCH_VERSATILE
+ depends on !ARCH_ACORN && !ARCH_EBSA110 && !4xx && !8xx && !SPARC && !M68K && !PARISC && !FRV && !ARCH_VERSATILE
default y
help
Saying Y here will allow you to use Linux in text mode through a
diff -uNrp /warthog/kernels/linux-2.6.15/fs/Kconfig.binfmt linux-2.6.15-frv/fs/Kconfig.binfmt
--- /warthog/kernels/linux-2.6.15/fs/Kconfig.binfmt 2006-01-04 12:39:35.000000000 +0000
+++ linux-2.6.15-frv/fs/Kconfig.binfmt 2006-01-06 14:43:43.000000000 +0000
@@ -1,6 +1,6 @@
config BINFMT_ELF
bool "Kernel support for ELF binaries"
- depends on MMU
+ depends on MMU && (BROKEN || !FRV)
default y
---help---
ELF (Executable and Linkable Format) is a format for libraries and

2006-01-06 16:31:23

by David Howells

[permalink] [raw]
Subject: [PATCH 10/17] FRV: Force serial driver inclusion

The attached patch forces the 8230 serial driver to be built in if the on-CPU
UARTs are to be used. It can't be used as a module because the arch setup
needs to call into it.

Signed-Off-By: David Howells <[email protected]>
---
warthog>diffstat -p1 frv-serial-2615.diff
arch/frv/Kconfig | 5 +++++
arch/frv/kernel/setup.c | 2 ++
2 files changed, 7 insertions(+)

diff -uNrp /warthog/kernels/linux-2.6.15/arch/frv/Kconfig linux-2.6.15-frv/arch/frv/Kconfig
--- /warthog/kernels/linux-2.6.15/arch/frv/Kconfig 2005-08-30 13:56:10.000000000 +0100
+++ linux-2.6.15-frv/arch/frv/Kconfig 2006-01-06 14:43:43.000000000 +0000
@@ -274,6 +274,11 @@ config GPREL_DATA_NONE

endchoice

+config FRV_ONCPU_SERIAL
+ bool "Use on-CPU serial ports"
+ select SERIAL_8250
+ default y
+
config PCI
bool "Use PCI"
depends on MB93090_MB00
diff -uNrp /warthog/kernels/linux-2.6.15/arch/frv/kernel/setup.c linux-2.6.15-frv/arch/frv/kernel/setup.c
--- /warthog/kernels/linux-2.6.15/arch/frv/kernel/setup.c 2005-08-30 13:56:10.000000000 +0100
+++ linux-2.6.15-frv/arch/frv/kernel/setup.c 2006-01-06 14:43:43.000000000 +0000
@@ -787,6 +787,7 @@ void __init setup_arch(char **cmdline_p)
#endif

/* register those serial ports that are available */
+#ifdef CONFIG_FRV_ONCPU_SERIAL
#ifndef CONFIG_GDBSTUB_UART0
__reg(UART0_BASE + UART_IER * 8) = 0;
early_serial_setup(&__frv_uart0);
@@ -795,6 +796,7 @@ void __init setup_arch(char **cmdline_p)
__reg(UART1_BASE + UART_IER * 8) = 0;
early_serial_setup(&__frv_uart1);
#endif
+#endif

#if defined(CONFIG_CHR_DEV_FLASH) || defined(CONFIG_BLK_DEV_FLASH)
/* we need to initialize the Flashrom device here since we might

2006-01-06 16:32:09

by David Howells

[permalink] [raw]
Subject: [PATCH 5/17] FRV: Support module exception tables

The attached patch fixes the exception table handling so that modules
exceptions are dealt with.

Signed-Off-By: David Howells <[email protected]>
---
warthog>diffstat -p1 frv-extab-2615.diff
arch/frv/mm/extable.c | 34 +++++++++-------------------------
1 files changed, 9 insertions(+), 25 deletions(-)

diff -uNrp /warthog/kernels/linux-2.6.15/arch/frv/mm/extable.c linux-2.6.15-frv/arch/frv/mm/extable.c
--- /warthog/kernels/linux-2.6.15/arch/frv/mm/extable.c 2005-03-02 12:07:44.000000000 +0000
+++ linux-2.6.15-frv/arch/frv/mm/extable.c 2006-01-06 14:43:43.000000000 +0000
@@ -43,7 +43,7 @@ static inline unsigned long search_one_t
*/
unsigned long search_exception_table(unsigned long pc)
{
- unsigned long ret = 0;
+ const struct exception_table_entry *extab;

/* determine if the fault lay during a memcpy_user or a memset_user */
if (__frame->lr == (unsigned long) &__memset_user_error_lr &&
@@ -55,9 +55,10 @@ unsigned long search_exception_table(uns
*/
return (unsigned long) &__memset_user_error_handler;
}
- else if (__frame->lr == (unsigned long) &__memcpy_user_error_lr &&
- (unsigned long) &memcpy <= pc && pc < (unsigned long) &__memcpy_end
- ) {
+
+ if (__frame->lr == (unsigned long) &__memcpy_user_error_lr &&
+ (unsigned long) &memcpy <= pc && pc < (unsigned long) &__memcpy_end
+ ) {
/* the fault occurred in a protected memset
* - we search for the return address (in LR) instead of the program counter
* - it was probably during a copy_to/from_user()
@@ -65,27 +66,10 @@ unsigned long search_exception_table(uns
return (unsigned long) &__memcpy_user_error_handler;
}

-#ifndef CONFIG_MODULES
- /* there is only the kernel to search. */
- ret = search_one_table(__start___ex_table, __stop___ex_table - 1, pc);
- return ret;
-
-#else
- /* the kernel is the last "module" -- no need to treat it special */
- unsigned long flags;
- struct module *mp;
+ extab = search_exception_tables(pc);
+ if (extab)
+ return extab->fixup;

- spin_lock_irqsave(&modlist_lock, flags);
-
- for (mp = module_list; mp != NULL; mp = mp->next) {
- if (mp->ex_table_start == NULL || !(mp->flags & (MOD_RUNNING | MOD_INITIALIZING)))
- continue;
- ret = search_one_table(mp->ex_table_start, mp->ex_table_end - 1, pc);
- if (ret)
- break;
- }
+ return 0;

- spin_unlock_irqrestore(&modlist_lock, flags);
- return ret;
-#endif
} /* end search_exception_table() */

2006-01-06 16:33:04

by David Howells

[permalink] [raw]
Subject: [PATCH 4/17] FRV: Implement and export various things required by modules

The attached patch exports a number of features required to build all the
modules. It also implements the following simple features:

(*) csum_partial_copy_from_user() for MMU as well as no-MMU.

(*) __ucmpdi2().

so that they can be exported too.

Signed-Off-By: David Howells <[email protected]>
---
warthog>diffstat -p1 frv-exports-2615.diff
arch/frv/kernel/frv_ksyms.c | 25 +++++++++++++-----
arch/frv/kernel/irq.c | 17 ++++++++++++
arch/frv/kernel/pm.c | 2 +
arch/frv/kernel/time.c | 3 ++
arch/frv/kernel/traps.c | 3 ++
arch/frv/kernel/uaccess.c | 7 +++++
arch/frv/lib/Makefile | 2 -
arch/frv/lib/__ucmpdi2.S | 45 ++++++++++++++++++++++++++++++++++
arch/frv/lib/checksum.c | 31 ++++++++++++++++++-----
arch/frv/mb93090-mb00/pci-dma-nommu.c | 8 ++++++
arch/frv/mb93090-mb00/pci-dma.c | 10 +++++++
arch/frv/mm/cache-page.c | 5 +++
arch/frv/mm/highmem.c | 8 ++++++
lib/find_next_bit.c | 3 ++
14 files changed, 155 insertions(+), 14 deletions(-)

diff -uNrp /warthog/kernels/linux-2.6.15/arch/frv/kernel/frv_ksyms.c linux-2.6.15-frv/arch/frv/kernel/frv_ksyms.c
--- /warthog/kernels/linux-2.6.15/arch/frv/kernel/frv_ksyms.c 2005-11-01 13:18:57.000000000 +0000
+++ linux-2.6.15-frv/arch/frv/kernel/frv_ksyms.c 2006-01-06 14:43:43.000000000 +0000
@@ -16,10 +16,11 @@
#include <asm/semaphore.h>
#include <asm/checksum.h>
#include <asm/hardirq.h>
-#include <asm/current.h>
+#include <asm/cacheflush.h>

extern void dump_thread(struct pt_regs *, struct user *);
extern long __memcpy_user(void *dst, const void *src, size_t count);
+extern long __memset_user(void *dst, const void *src, size_t count);

/* platform dependent support */

@@ -50,7 +51,11 @@ EXPORT_SYMBOL(disable_irq);
EXPORT_SYMBOL(__res_bus_clock_speed_HZ);
EXPORT_SYMBOL(__page_offset);
EXPORT_SYMBOL(__memcpy_user);
-EXPORT_SYMBOL(flush_dcache_page);
+EXPORT_SYMBOL(__memset_user);
+EXPORT_SYMBOL(frv_dcache_writeback);
+EXPORT_SYMBOL(frv_cache_invalidate);
+EXPORT_SYMBOL(frv_icache_invalidate);
+EXPORT_SYMBOL(frv_cache_wback_inv);

#ifndef CONFIG_MMU
EXPORT_SYMBOL(memory_start);
@@ -72,6 +77,9 @@ EXPORT_SYMBOL(memcmp);
EXPORT_SYMBOL(memscan);
EXPORT_SYMBOL(memmove);

+EXPORT_SYMBOL(__outsl_ns);
+EXPORT_SYMBOL(__insl_ns);
+
EXPORT_SYMBOL(get_wchan);

#ifdef CONFIG_FRV_OUTOFLINE_ATOMIC_OPS
@@ -80,14 +88,13 @@ EXPORT_SYMBOL(atomic_test_and_OR_mask);
EXPORT_SYMBOL(atomic_test_and_XOR_mask);
EXPORT_SYMBOL(atomic_add_return);
EXPORT_SYMBOL(atomic_sub_return);
-EXPORT_SYMBOL(__xchg_8);
-EXPORT_SYMBOL(__xchg_16);
EXPORT_SYMBOL(__xchg_32);
-EXPORT_SYMBOL(__cmpxchg_8);
-EXPORT_SYMBOL(__cmpxchg_16);
EXPORT_SYMBOL(__cmpxchg_32);
#endif

+EXPORT_SYMBOL(__debug_bug_printk);
+EXPORT_SYMBOL(__delay_loops_MHz);
+
/*
* libgcc functions - functions that are used internally by the
* compiler... (prototypes are not correct though, but that
@@ -101,6 +108,8 @@ extern void __divdi3(void);
extern void __lshrdi3(void);
extern void __moddi3(void);
extern void __muldi3(void);
+extern void __mulll(void);
+extern void __umulll(void);
extern void __negdi2(void);
extern void __ucmpdi2(void);
extern void __udivdi3(void);
@@ -116,8 +125,10 @@ EXPORT_SYMBOL(__ashrdi3);
EXPORT_SYMBOL(__lshrdi3);
//EXPORT_SYMBOL(__moddi3);
EXPORT_SYMBOL(__muldi3);
+EXPORT_SYMBOL(__mulll);
+EXPORT_SYMBOL(__umulll);
EXPORT_SYMBOL(__negdi2);
-//EXPORT_SYMBOL(__ucmpdi2);
+EXPORT_SYMBOL(__ucmpdi2);
//EXPORT_SYMBOL(__udivdi3);
//EXPORT_SYMBOL(__udivmoddi4);
//EXPORT_SYMBOL(__umoddi3);
diff -uNrp /warthog/kernels/linux-2.6.15/arch/frv/kernel/irq.c linux-2.6.15-frv/arch/frv/kernel/irq.c
--- /warthog/kernels/linux-2.6.15/arch/frv/kernel/irq.c 2005-03-02 12:07:44.000000000 +0000
+++ linux-2.6.15-frv/arch/frv/kernel/irq.c 2006-01-06 14:43:43.000000000 +0000
@@ -32,6 +32,7 @@
#include <linux/irq.h>
#include <linux/proc_fs.h>
#include <linux/seq_file.h>
+#include <linux/module.h>

#include <asm/atomic.h>
#include <asm/io.h>
@@ -178,6 +179,8 @@ void disable_irq_nosync(unsigned int irq
spin_unlock_irqrestore(&level->lock, flags);
}

+EXPORT_SYMBOL(disable_irq_nosync);
+
/**
* disable_irq - disable an irq and wait for completion
* @irq: Interrupt to disable
@@ -204,6 +207,8 @@ void disable_irq(unsigned int irq)
#endif
}

+EXPORT_SYMBOL(disable_irq);
+
/**
* enable_irq - enable handling of an irq
* @irq: Interrupt to enable
@@ -268,6 +273,8 @@ void enable_irq(unsigned int irq)
spin_unlock_irqrestore(&level->lock, flags);
}

+EXPORT_SYMBOL(enable_irq);
+
/*****************************************************************************/
/*
* handles all normal device IRQ's
@@ -425,6 +432,8 @@ int request_irq(unsigned int irq,
return retval;
}

+EXPORT_SYMBOL(request_irq);
+
/**
* free_irq - free an interrupt
* @irq: Interrupt line to free
@@ -496,6 +505,8 @@ void free_irq(unsigned int irq, void *de
}
}

+EXPORT_SYMBOL(free_irq);
+
/*
* IRQ autodetection code..
*
@@ -519,6 +530,8 @@ unsigned long probe_irq_on(void)
return 0;
}

+EXPORT_SYMBOL(probe_irq_on);
+
/*
* Return a mask of triggered interrupts (this
* can handle only legacy ISA interrupts).
@@ -542,6 +555,8 @@ unsigned int probe_irq_mask(unsigned lon
return 0;
}

+EXPORT_SYMBOL(probe_irq_mask);
+
/*
* Return the one interrupt that triggered (this can
* handle any interrupt source).
@@ -571,6 +586,8 @@ int probe_irq_off(unsigned long xmask)
return -1;
}

+EXPORT_SYMBOL(probe_irq_off);
+
/* this was setup_x86_irq but it seems pretty generic */
int setup_irq(unsigned int irq, struct irqaction *new)
{
diff -uNrp /warthog/kernels/linux-2.6.15/arch/frv/kernel/pm.c linux-2.6.15-frv/arch/frv/kernel/pm.c
--- /warthog/kernels/linux-2.6.15/arch/frv/kernel/pm.c 2006-01-04 12:39:18.000000000 +0000
+++ linux-2.6.15-frv/arch/frv/kernel/pm.c 2006-01-06 14:43:43.000000000 +0000
@@ -13,6 +13,7 @@

#include <linux/config.h>
#include <linux/init.h>
+#include <linux/module.h>
#include <linux/pm.h>
#include <linux/pm_legacy.h>
#include <linux/sched.h>
@@ -27,6 +28,7 @@
#include "local.h"

void (*pm_power_off)(void);
+EXPORT_SYMBOL(pm_power_off);

extern void frv_change_cmode(int);

diff -uNrp /warthog/kernels/linux-2.6.15/arch/frv/kernel/time.c linux-2.6.15-frv/arch/frv/kernel/time.c
--- /warthog/kernels/linux-2.6.15/arch/frv/kernel/time.c 2006-01-04 12:39:18.000000000 +0000
+++ linux-2.6.15-frv/arch/frv/kernel/time.c 2006-01-06 14:43:43.000000000 +0000
@@ -189,6 +189,8 @@ void do_gettimeofday(struct timeval *tv)
tv->tv_usec = usec;
}

+EXPORT_SYMBOL(do_gettimeofday);
+
int do_settimeofday(struct timespec *tv)
{
time_t wtm_sec, sec = tv->tv_sec;
@@ -218,6 +220,7 @@ int do_settimeofday(struct timespec *tv)
clock_was_set();
return 0;
}
+
EXPORT_SYMBOL(do_settimeofday);

/*
diff -uNrp /warthog/kernels/linux-2.6.15/arch/frv/kernel/traps.c linux-2.6.15-frv/arch/frv/kernel/traps.c
--- /warthog/kernels/linux-2.6.15/arch/frv/kernel/traps.c 2005-03-02 12:07:44.000000000 +0000
+++ linux-2.6.15-frv/arch/frv/kernel/traps.c 2006-01-06 14:43:43.000000000 +0000
@@ -19,6 +19,7 @@
#include <linux/string.h>
#include <linux/linkage.h>
#include <linux/init.h>
+#include <linux/module.h>

#include <asm/setup.h>
#include <asm/fpu.h>
@@ -250,6 +251,8 @@ void dump_stack(void)
show_stack(NULL, NULL);
}

+EXPORT_SYMBOL(dump_stack);
+
void show_stack(struct task_struct *task, unsigned long *sp)
{
}
diff -uNrp /warthog/kernels/linux-2.6.15/arch/frv/kernel/uaccess.c linux-2.6.15-frv/arch/frv/kernel/uaccess.c
--- /warthog/kernels/linux-2.6.15/arch/frv/kernel/uaccess.c 2005-03-02 12:07:44.000000000 +0000
+++ linux-2.6.15-frv/arch/frv/kernel/uaccess.c 2006-01-06 14:43:43.000000000 +0000
@@ -10,6 +10,7 @@
*/

#include <linux/mm.h>
+#include <linux/module.h>
#include <asm/uaccess.h>

/*****************************************************************************/
@@ -58,8 +59,11 @@ long strncpy_from_user(char *dst, const
memset(p, 0, count); /* clear remainder of buffer [security] */

return err;
+
} /* end strncpy_from_user() */

+EXPORT_SYMBOL(strncpy_from_user);
+
/*****************************************************************************/
/*
* Return the size of a string (including the ending 0)
@@ -92,4 +96,7 @@ long strnlen_user(const char *src, long
}

return p - src + 1; /* return length including NUL */
+
} /* end strnlen_user() */
+
+EXPORT_SYMBOL(strnlen_user);
diff -uNrp /warthog/kernels/linux-2.6.15/arch/frv/lib/checksum.c linux-2.6.15-frv/arch/frv/lib/checksum.c
--- /warthog/kernels/linux-2.6.15/arch/frv/lib/checksum.c 2005-03-02 12:07:44.000000000 +0000
+++ linux-2.6.15-frv/arch/frv/lib/checksum.c 2006-01-06 14:43:43.000000000 +0000
@@ -33,6 +33,7 @@

#include <net/checksum.h>
#include <asm/checksum.h>
+#include <linux/module.h>

static inline unsigned short from32to16(unsigned long x)
{
@@ -115,34 +116,52 @@ unsigned int csum_partial(const unsigned
return result;
}

+EXPORT_SYMBOL(csum_partial);
+
/*
* 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);
+ return ~do_csum(buff, len);
}

+EXPORT_SYMBOL(ip_compute_csum);
+
/*
* 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)
+csum_partial_copy_from_user(const char __user *src, char *dst,
+ int len, int sum, int *csum_err)
{
- if (csum_err) *csum_err = 0;
- memcpy(dst, src, len);
+ int rem;
+
+ if (csum_err)
+ *csum_err = 0;
+
+ rem = copy_from_user(dst, src, len);
+ if (rem != 0) {
+ if (csum_err)
+ *csum_err = -EFAULT;
+ memset(dst + len - rem, 0, rem);
+ len = rem;
+ }
+
return csum_partial(dst, len, sum);
}

+EXPORT_SYMBOL(csum_partial_copy_from_user);
+
/*
* 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);
}
+
+EXPORT_SYMBOL(csum_partial_copy);
diff -uNrp /warthog/kernels/linux-2.6.15/arch/frv/lib/Makefile linux-2.6.15-frv/arch/frv/lib/Makefile
--- /warthog/kernels/linux-2.6.15/arch/frv/lib/Makefile 2005-03-02 12:07:44.000000000 +0000
+++ linux-2.6.15-frv/arch/frv/lib/Makefile 2006-01-06 14:43:43.000000000 +0000
@@ -3,6 +3,6 @@
#

lib-y := \
- __ashldi3.o __lshrdi3.o __muldi3.o __ashrdi3.o __negdi2.o \
+ __ashldi3.o __lshrdi3.o __muldi3.o __ashrdi3.o __negdi2.o __ucmpdi2.o \
checksum.o memcpy.o memset.o atomic-ops.o \
outsl_ns.o outsl_sw.o insl_ns.o insl_sw.o cache.o
diff -uNrp /warthog/kernels/linux-2.6.15/arch/frv/lib/__ucmpdi2.S linux-2.6.15-frv/arch/frv/lib/__ucmpdi2.S
--- /warthog/kernels/linux-2.6.15/arch/frv/lib/__ucmpdi2.S 1970-01-01 01:00:00.000000000 +0100
+++ linux-2.6.15-frv/arch/frv/lib/__ucmpdi2.S 2006-01-06 14:43:43.000000000 +0000
@@ -0,0 +1,45 @@
+/* __ucmpdi2.S: 64-bit unsigned compare
+ *
+ * Copyright (C) 2006 Red Hat, Inc. All Rights Reserved.
+ * Written by David Howells ([email protected])
+ *
+ * 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.
+ */
+
+
+ .text
+ .p2align 4
+
+###############################################################################
+#
+# int __ucmpdi2(unsigned long long a [GR8:GR9],
+# unsigned long long b [GR10:GR11])
+#
+# - returns 0, 1, or 2 as a <, =, > b respectively.
+#
+###############################################################################
+ .globl __ucmpdi2
+ .type __ucmpdi2,@function
+__ucmpdi2:
+ or.p gr8,gr0,gr4
+ subcc gr8,gr10,gr0,icc0
+ setlos.p #0,gr8
+ bclr icc0,#2 ; a.msw < b.msw
+
+ setlos.p #2,gr8
+ bhilr icc0,#0 ; a.msw > b.msw
+
+ subcc.p gr9,gr11,gr0,icc1
+ setlos #0,gr8
+ setlos.p #2,gr9
+ setlos #1,gr7
+ cknc icc1,cc6
+ cor.p gr9,gr0,gr8, cc6,#1
+ cckls icc1,cc4, cc6,#1
+ andcr cc6,cc4,cc4
+ cor gr7,gr0,gr8, cc4,#1
+ bralr
+ .size __ucmpdi2, .-__ucmpdi2
diff -uNrp /warthog/kernels/linux-2.6.15/arch/frv/mb93090-mb00/pci-dma.c linux-2.6.15-frv/arch/frv/mb93090-mb00/pci-dma.c
--- /warthog/kernels/linux-2.6.15/arch/frv/mb93090-mb00/pci-dma.c 2006-01-04 12:39:18.000000000 +0000
+++ linux-2.6.15-frv/arch/frv/mb93090-mb00/pci-dma.c 2006-01-06 14:43:43.000000000 +0000
@@ -28,11 +28,15 @@ void *dma_alloc_coherent(struct device *
return ret;
}

+EXPORT_SYMBOL(dma_alloc_coherent);
+
void dma_free_coherent(struct device *hwdev, size_t size, void *vaddr, dma_addr_t dma_handle)
{
consistent_free(vaddr);
}

+EXPORT_SYMBOL(dma_free_coherent);
+
/*
* Map a single buffer of the indicated size for DMA in streaming mode.
* The 32-bit bus address to use is returned.
@@ -51,6 +55,8 @@ dma_addr_t dma_map_single(struct device
return virt_to_bus(ptr);
}

+EXPORT_SYMBOL(dma_map_single);
+
/*
* Map a set of buffers described by scatterlist in streaming
* mode for DMA. This is the scather-gather version of the
@@ -96,6 +102,8 @@ int dma_map_sg(struct device *dev, struc
return nents;
}

+EXPORT_SYMBOL(dma_map_sg);
+
dma_addr_t dma_map_page(struct device *dev, struct page *page, unsigned long offset,
size_t size, enum dma_data_direction direction)
{
@@ -103,3 +111,5 @@ dma_addr_t dma_map_page(struct device *d
flush_dcache_page(page);
return (dma_addr_t) page_to_phys(page) + offset;
}
+
+EXPORT_SYMBOL(dma_map_page);
diff -uNrp /warthog/kernels/linux-2.6.15/arch/frv/mb93090-mb00/pci-dma-nommu.c linux-2.6.15-frv/arch/frv/mb93090-mb00/pci-dma-nommu.c
--- /warthog/kernels/linux-2.6.15/arch/frv/mb93090-mb00/pci-dma-nommu.c 2006-01-04 12:39:18.000000000 +0000
+++ linux-2.6.15-frv/arch/frv/mb93090-mb00/pci-dma-nommu.c 2006-01-06 14:43:43.000000000 +0000
@@ -83,6 +83,8 @@ void *dma_alloc_coherent(struct device *
return NULL;
}

+EXPORT_SYMBOL(dma_alloc_coherent);
+
void dma_free_coherent(struct device *hwdev, size_t size, void *vaddr, dma_addr_t dma_handle)
{
struct dma_alloc_record *rec;
@@ -102,6 +104,8 @@ void dma_free_coherent(struct device *hw
BUG();
}

+EXPORT_SYMBOL(dma_free_coherent);
+
/*
* Map a single buffer of the indicated size for DMA in streaming mode.
* The 32-bit bus address to use is returned.
@@ -120,6 +124,8 @@ dma_addr_t dma_map_single(struct device
return virt_to_bus(ptr);
}

+EXPORT_SYMBOL(dma_map_single);
+
/*
* Map a set of buffers described by scatterlist in streaming
* mode for DMA. This is the scather-gather version of the
@@ -150,3 +156,5 @@ int dma_map_sg(struct device *dev, struc

return nents;
}
+
+EXPORT_SYMBOL(dma_map_sg);
diff -uNrp /warthog/kernels/linux-2.6.15/arch/frv/mm/cache-page.c linux-2.6.15-frv/arch/frv/mm/cache-page.c
--- /warthog/kernels/linux-2.6.15/arch/frv/mm/cache-page.c 2005-03-02 12:07:44.000000000 +0000
+++ linux-2.6.15-frv/arch/frv/mm/cache-page.c 2006-01-06 14:43:43.000000000 +0000
@@ -11,6 +11,7 @@
#include <linux/sched.h>
#include <linux/mm.h>
#include <linux/highmem.h>
+#include <linux/module.h>
#include <asm/pgalloc.h>

/*****************************************************************************/
@@ -38,6 +39,8 @@ void flush_dcache_page(struct page *page

} /* end flush_dcache_page() */

+EXPORT_SYMBOL(flush_dcache_page);
+
/*****************************************************************************/
/*
* ICI takes a virtual address and the page may not currently have one
@@ -64,3 +67,5 @@ void flush_icache_user_range(struct vm_a
}

} /* end flush_icache_user_range() */
+
+EXPORT_SYMBOL(flush_icache_user_range);
diff -uNrp /warthog/kernels/linux-2.6.15/arch/frv/mm/highmem.c linux-2.6.15-frv/arch/frv/mm/highmem.c
--- /warthog/kernels/linux-2.6.15/arch/frv/mm/highmem.c 2005-03-02 12:07:44.000000000 +0000
+++ linux-2.6.15-frv/arch/frv/mm/highmem.c 2006-01-06 14:43:43.000000000 +0000
@@ -9,6 +9,7 @@
* 2 of the License, or (at your option) any later version.
*/
#include <linux/highmem.h>
+#include <linux/module.h>

void *kmap(struct page *page)
{
@@ -18,6 +19,8 @@ void *kmap(struct page *page)
return kmap_high(page);
}

+EXPORT_SYMBOL(kmap);
+
void kunmap(struct page *page)
{
if (in_interrupt())
@@ -27,7 +30,12 @@ void kunmap(struct page *page)
kunmap_high(page);
}

+EXPORT_SYMBOL(kunmap);
+
struct page *kmap_atomic_to_page(void *ptr)
{
return virt_to_page(ptr);
}
+
+
+EXPORT_SYMBOL(kmap_atomic_to_page);
diff -uNrp /warthog/kernels/linux-2.6.15/lib/find_next_bit.c linux-2.6.15-frv/lib/find_next_bit.c
--- /warthog/kernels/linux-2.6.15/lib/find_next_bit.c 2005-03-02 12:09:02.000000000 +0000
+++ linux-2.6.15-frv/lib/find_next_bit.c 2006-01-06 14:43:43.000000000 +0000
@@ -10,6 +10,7 @@
*/

#include <linux/bitops.h>
+#include <linux/module.h>

int find_next_bit(const unsigned long *addr, int size, int offset)
{
@@ -53,3 +54,5 @@ int find_next_bit(const unsigned long *a

return offset;
}
+
+EXPORT_SYMBOL(find_next_bit);

2006-01-06 16:32:10

by David Howells

[permalink] [raw]
Subject: [PATCH 13/17] FRV: Fix uninitialised variable in atm nicstar driver

The attached patch fixes an uninitialised variable warning in the atm nicstar
driver.

Signed-Off-By: David Howells <[email protected]>
---
warthog>diffstat -p1 atm-nicstar-2615.diff
drivers/atm/nicstar.c | 5 ++---
1 files changed, 2 insertions(+), 3 deletions(-)

diff -uNrp /warthog/kernels/linux-2.6.15/drivers/atm/nicstar.c linux-2.6.15-frv/drivers/atm/nicstar.c
--- /warthog/kernels/linux-2.6.15/drivers/atm/nicstar.c 2005-11-01 13:19:04.000000000 +0000
+++ linux-2.6.15-frv/drivers/atm/nicstar.c 2006-01-06 14:43:43.000000000 +0000
@@ -2126,8 +2126,7 @@ static void process_rsq(ns_dev *card)

if (!ns_rsqe_valid(card->rsq.next))
return;
- while (ns_rsqe_valid(card->rsq.next))
- {
+ do {
dequeue_rx(card, card->rsq.next);
ns_rsqe_init(card->rsq.next);
previous = card->rsq.next;
@@ -2135,7 +2134,7 @@ static void process_rsq(ns_dev *card)
card->rsq.next = card->rsq.base;
else
card->rsq.next++;
- }
+ } while (ns_rsqe_valid(card->rsq.next));
writel((((u32) previous) - ((u32) card->rsq.base)),
card->membase + RSQH);
}

2006-01-06 16:33:06

by David Howells

[permalink] [raw]
Subject: [PATCH 12/17] FRV: Miscellaneous changes

The attached patch fixes a number of miscellanous items:

(1) Declare lock sections in the linker script.

(2) Recurse in the correct manner in the arch makefile.

(3) asm/bug.h requires asm/linkage.h to be included first. One C file puts
asm/bug.h first.

(4) Add an empty RTC header file to avoid missing header file errors.

(5) sg_dma_address() should use the dma_address member of a scatter list.

(6) Add trivial pci_unmap support.

(7) Add pgprot_noncached()

(8) Discard u_quad_t.

(9) Use ~0UL rather than ULONG_MAX in unistd.h in case the latter isn't
declared.

(10) Add an empty VGA header file to avoid missing header file errors.

(11) Add an XOR header file to use the generic XOR stuff.

Signed-Off-By: David Howells <[email protected]>
---
warthog>diffstat -p1 frv-misc-2615.diff
arch/frv/Makefile | 6 +++---
arch/frv/kernel/vmlinux.lds.S | 1 +
include/asm-frv/bug.h | 1 +
include/asm-frv/dma-mapping.h | 2 +-
include/asm-frv/mc146818rtc.h | 16 ++++++++++++++++
include/asm-frv/pci.h | 8 ++++++++
include/asm-frv/pgtable.h | 5 +++++
include/asm-frv/types.h | 1 -
include/asm-frv/unistd.h | 2 +-
include/asm-frv/vga.h | 17 +++++++++++++++++
include/asm-frv/xor.h | 1 +
11 files changed, 54 insertions(+), 6 deletions(-)

diff -uNrp /warthog/kernels/linux-2.6.15/arch/frv/kernel/vmlinux.lds.S linux-2.6.15-frv/arch/frv/kernel/vmlinux.lds.S
--- /warthog/kernels/linux-2.6.15/arch/frv/kernel/vmlinux.lds.S 2005-03-02 12:07:44.000000000 +0000
+++ linux-2.6.15-frv/arch/frv/kernel/vmlinux.lds.S 2006-01-06 14:43:43.000000000 +0000
@@ -112,6 +112,7 @@ SECTIONS
#endif
)
SCHED_TEXT
+ LOCK_TEXT
*(.fixup)
*(.gnu.warning)
*(.exitcall.exit)
diff -uNrp /warthog/kernels/linux-2.6.15/arch/frv/Makefile linux-2.6.15-frv/arch/frv/Makefile
--- /warthog/kernels/linux-2.6.15/arch/frv/Makefile 2005-03-02 12:07:44.000000000 +0000
+++ linux-2.6.15-frv/arch/frv/Makefile 2006-01-06 14:43:43.000000000 +0000
@@ -109,10 +109,10 @@ bootstrap:
$(Q)$(MAKEBOOT) bootstrap

archmrproper:
- $(Q)$(MAKE) -C arch/frv/boot mrproper
+ $(Q)$(MAKE) $(build)=arch/frv/boot mrproper

archclean:
- $(Q)$(MAKE) -C arch/frv/boot clean
+ $(Q)$(MAKE) $(build)=arch/frv/boot clean

archdep: scripts/mkdep symlinks
- $(Q)$(MAKE) -C arch/frv/boot dep
+ $(Q)$(MAKE) $(build)=arch/frv/boot dep
diff -uNrp /warthog/kernels/linux-2.6.15/include/asm-frv/bug.h linux-2.6.15-frv/include/asm-frv/bug.h
--- /warthog/kernels/linux-2.6.15/include/asm-frv/bug.h 2005-06-22 13:52:26.000000000 +0100
+++ linux-2.6.15-frv/include/asm-frv/bug.h 2006-01-06 14:43:43.000000000 +0000
@@ -12,6 +12,7 @@
#define _ASM_BUG_H

#include <linux/config.h>
+#include <linux/linkage.h>

#ifdef CONFIG_BUG
/*
diff -uNrp /warthog/kernels/linux-2.6.15/include/asm-frv/mc146818rtc.h linux-2.6.15-frv/include/asm-frv/mc146818rtc.h
--- /warthog/kernels/linux-2.6.15/include/asm-frv/mc146818rtc.h 1970-01-01 01:00:00.000000000 +0100
+++ linux-2.6.15-frv/include/asm-frv/mc146818rtc.h 2006-01-06 14:43:43.000000000 +0000
@@ -0,0 +1,16 @@
+/* mc146818rtc.h: RTC defs
+ *
+ * Copyright (C) 2005 Red Hat, Inc. All Rights Reserved.
+ * Written by David Howells ([email protected])
+ *
+ * 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_MC146818RTC_H
+#define _ASM_MC146818RTC_H
+
+
+#endif /* _ASM_MC146818RTC_H */
diff -uNrp /warthog/kernels/linux-2.6.15/include/asm-frv/dma-mapping.h linux-2.6.15-frv/include/asm-frv/dma-mapping.h
--- /warthog/kernels/linux-2.6.15/include/asm-frv/dma-mapping.h 2006-01-04 12:39:38.000000000 +0000
+++ linux-2.6.15-frv/include/asm-frv/dma-mapping.h 2006-01-06 14:43:43.000000000 +0000
@@ -23,7 +23,7 @@ void dma_free_coherent(struct device *de
* returns, or alternatively stop on the first sg_dma_len(sg) which
* is 0.
*/
-#define sg_dma_address(sg) ((unsigned long) (page_to_phys((sg)->page) + (sg)->offset))
+#define sg_dma_address(sg) ((sg)->dma_address)
#define sg_dma_len(sg) ((sg)->length)

/*
diff -uNrp /warthog/kernels/linux-2.6.15/include/asm-frv/pci.h linux-2.6.15-frv/include/asm-frv/pci.h
--- /warthog/kernels/linux-2.6.15/include/asm-frv/pci.h 2006-01-04 12:39:38.000000000 +0000
+++ linux-2.6.15-frv/include/asm-frv/pci.h 2006-01-06 14:43:43.000000000 +0000
@@ -57,6 +57,14 @@ extern void pci_free_consistent(struct p
*/
#define PCI_DMA_BUS_IS_PHYS (1)

+/* pci_unmap_{page,single} is a nop so... */
+#define DECLARE_PCI_UNMAP_ADDR(ADDR_NAME)
+#define DECLARE_PCI_UNMAP_LEN(LEN_NAME)
+#define pci_unmap_addr(PTR, ADDR_NAME) (0)
+#define pci_unmap_addr_set(PTR, ADDR_NAME, VAL) do { } while (0)
+#define pci_unmap_len(PTR, LEN_NAME) (0)
+#define pci_unmap_len_set(PTR, LEN_NAME, VAL) do { } while (0)
+
#ifdef CONFIG_PCI
static inline void pci_dma_burst_advice(struct pci_dev *pdev,
enum pci_dma_burst_strategy *strat,
diff -uNrp /warthog/kernels/linux-2.6.15/include/asm-frv/pgtable.h linux-2.6.15-frv/include/asm-frv/pgtable.h
--- /warthog/kernels/linux-2.6.15/include/asm-frv/pgtable.h 2006-01-04 12:39:38.000000000 +0000
+++ linux-2.6.15-frv/include/asm-frv/pgtable.h 2006-01-06 14:43:43.000000000 +0000
@@ -421,6 +421,11 @@ static inline void ptep_set_wrprotect(st
}

/*
+ * Macro to mark a page protection value as "uncacheable"
+ */
+#define pgprot_noncached(prot) (__pgprot(pgprot_val(prot) | _PAGE_NOCACHE))
+
+/*
* Conversion functions: convert a page and protection to a page entry,
* and a page entry and page directory to the page they refer to.
*/
diff -uNrp /warthog/kernels/linux-2.6.15/include/asm-frv/types.h linux-2.6.15-frv/include/asm-frv/types.h
--- /warthog/kernels/linux-2.6.15/include/asm-frv/types.h 2005-11-01 13:19:17.000000000 +0000
+++ linux-2.6.15-frv/include/asm-frv/types.h 2006-01-06 14:43:43.000000000 +0000
@@ -59,7 +59,6 @@ typedef unsigned int u32;

typedef signed long long s64;
typedef unsigned long long u64;
-typedef u64 u_quad_t;

/* Dma addresses are 32-bits wide. */

diff -uNrp /warthog/kernels/linux-2.6.15/include/asm-frv/unistd.h linux-2.6.15-frv/include/asm-frv/unistd.h
--- /warthog/kernels/linux-2.6.15/include/asm-frv/unistd.h 2005-06-22 13:52:26.000000000 +0100
+++ linux-2.6.15-frv/include/asm-frv/unistd.h 2006-01-06 14:43:43.000000000 +0000
@@ -313,7 +313,7 @@ do { \
unsigned long __sr2 = (res); \
if (__builtin_expect(__sr2 >= (unsigned long)(-4095), 0)) { \
errno = (-__sr2); \
- __sr2 = ULONG_MAX; \
+ __sr2 = ~0UL; \
} \
return (type) __sr2; \
} while (0)
diff -uNrp /warthog/kernels/linux-2.6.15/include/asm-frv/vga.h linux-2.6.15-frv/include/asm-frv/vga.h
--- /warthog/kernels/linux-2.6.15/include/asm-frv/vga.h 1970-01-01 01:00:00.000000000 +0100
+++ linux-2.6.15-frv/include/asm-frv/vga.h 2006-01-06 14:43:43.000000000 +0000
@@ -0,0 +1,17 @@
+/* vga.h: VGA register stuff
+ *
+ * Copyright (C) 2006 Red Hat, Inc. All Rights Reserved.
+ * Written by David Howells ([email protected])
+ *
+ * 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_VGA_H
+#define _ASM_VGA_H
+
+
+
+#endif /* _ASM_VGA_H */
diff -uNrp /warthog/kernels/linux-2.6.15/include/asm-frv/xor.h linux-2.6.15-frv/include/asm-frv/xor.h
--- /warthog/kernels/linux-2.6.15/include/asm-frv/xor.h 1970-01-01 01:00:00.000000000 +0100
+++ linux-2.6.15-frv/include/asm-frv/xor.h 2006-01-06 14:43:43.000000000 +0000
@@ -0,0 +1 @@
+#include <asm-generic/xor.h>

2006-01-06 16:36:29

by David Howells

[permalink] [raw]
Subject: [PATCH 8/17] FRV: Add pci_iomap

The attached patch implements pci_iomap() for FRV.

Signed-Off-By: David Howells <[email protected]>
---
warthog>diffstat -p1 frv-pci-iomap-2615.diff
arch/frv/mb93090-mb00/Makefile | 2 +-
arch/frv/mb93090-mb00/pci-iomap.c | 29 +++++++++++++++++++++++++++++
2 files changed, 30 insertions(+), 1 deletion(-)

diff -uNrp /warthog/kernels/linux-2.6.15/arch/frv/mb93090-mb00/Makefile linux-2.6.15-frv/arch/frv/mb93090-mb00/Makefile
--- /warthog/kernels/linux-2.6.15/arch/frv/mb93090-mb00/Makefile 2005-03-02 12:07:44.000000000 +0000
+++ linux-2.6.15-frv/arch/frv/mb93090-mb00/Makefile 2006-01-06 14:43:43.000000000 +0000
@@ -3,7 +3,7 @@
#

ifeq "$(CONFIG_PCI)" "y"
-obj-y := pci-frv.o pci-irq.o pci-vdk.o
+obj-y := pci-frv.o pci-irq.o pci-vdk.o pci-iomap.o

ifeq "$(CONFIG_MMU)" "y"
obj-y += pci-dma.o
diff -uNrp /warthog/kernels/linux-2.6.15/arch/frv/mb93090-mb00/pci-iomap.c linux-2.6.15-frv/arch/frv/mb93090-mb00/pci-iomap.c
--- /warthog/kernels/linux-2.6.15/arch/frv/mb93090-mb00/pci-iomap.c 1970-01-01 01:00:00.000000000 +0100
+++ linux-2.6.15-frv/arch/frv/mb93090-mb00/pci-iomap.c 2006-01-06 14:43:43.000000000 +0000
@@ -0,0 +1,29 @@
+/* pci-iomap.c: description
+ *
+ * Copyright (C) 2006 Red Hat, Inc. All Rights Reserved.
+ * Written by David Howells ([email protected])
+ *
+ * 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.
+ */
+#include <linux/pci.h>
+#include <linux/module.h>
+
+void __iomem *pci_iomap(struct pci_dev *dev, int bar, unsigned long maxlen)
+{
+ unsigned long start = pci_resource_start(dev, bar);
+ unsigned long len = pci_resource_len(dev, bar);
+ unsigned long flags = pci_resource_flags(dev, bar);
+
+ if (!len || !start)
+ return NULL;
+
+ if ((flags & IORESOURCE_IO) || (flags & IORESOURCE_MEM))
+ return (void __iomem *) start;
+
+ return NULL;
+}
+
+EXPORT_SYMBOL(pci_iomap);

2006-01-06 16:37:31

by David Howells

[permalink] [raw]
Subject: [PATCH 15/17] FRV: Export __rcuref_hash

The attached patch exports __rcuref_hash which is required by some modules.

Signed-Off-By: David Howells <[email protected]>
---
warthog>diffstat -p1 rcu-export-2615.diff
kernel/rcupdate.c | 1 +
1 files changed, 1 insertion(+)

diff -uNrp /warthog/kernels/linux-2.6.15/kernel/rcupdate.c linux-2.6.15-frv/kernel/rcupdate.c
--- /warthog/kernels/linux-2.6.15/kernel/rcupdate.c 2006-01-04 12:39:43.000000000 +0000
+++ linux-2.6.15-frv/kernel/rcupdate.c 2006-01-06 14:43:43.000000000 +0000
@@ -564,3 +564,4 @@ EXPORT_SYMBOL(call_rcu); /* WARNING: GP
EXPORT_SYMBOL(call_rcu_bh); /* WARNING: GPL-only in April 2006. */
EXPORT_SYMBOL_GPL(synchronize_rcu);
EXPORT_SYMBOL(synchronize_kernel); /* WARNING: GPL-only in April 2006. */
+EXPORT_SYMBOL_GPL(__rcuref_hash);

2006-01-06 16:36:31

by David Howells

[permalink] [raw]
Subject: [PATCH 6/17] FRV: Supply various missing I/O access primitives

The attached patch supplies various I/O access primitives that are missing for
the FRV arch:

(*) mmiowb()

(*) read*_relaxed()

(*) ioport_*map()

(*) ioread*(), iowrite*(), ioread*_rep() and iowrite*_rep()

(*) pci_io*map()

(*) check_signature()

The patch also makes __is_PCI_addr() more efficient.

Signed-Off-By: David Howells <[email protected]>
---
warthog>diffstat -p1 frv-io-2615.diff
include/asm-frv/io.h | 123 ++++++++++++++++++++++++++++++++++++++++++++++
include/asm-frv/mb-regs.h | 4 +
2 files changed, 127 insertions(+)

diff -uNrp /warthog/kernels/linux-2.6.15/include/asm-frv/io.h linux-2.6.15-frv/include/asm-frv/io.h
--- /warthog/kernels/linux-2.6.15/include/asm-frv/io.h 2005-06-22 13:52:26.000000000 +0100
+++ linux-2.6.15-frv/include/asm-frv/io.h 2006-01-06 14:43:43.000000000 +0000
@@ -18,6 +18,7 @@
#ifdef __KERNEL__

#include <linux/config.h>
+#include <linux/types.h>
#include <asm/virtconvert.h>
#include <asm/string.h>
#include <asm/mb-regs.h>
@@ -104,6 +105,8 @@ static inline void __insl(unsigned long
__insl_sw(addr, buf, len);
}

+#define mmiowb() mb()
+
/*
* make the short names macros so specific devices
* can override them as required
@@ -209,6 +212,10 @@ static inline uint32_t readl(const volat
return ret;
}

+#define readb_relaxed readb
+#define readw_relaxed readw
+#define readl_relaxed readl
+
static inline void writeb(uint8_t datum, volatile void __iomem *addr)
{
__builtin_write8((volatile uint8_t __force *) addr, datum);
@@ -268,11 +275,106 @@ static inline void __iomem *ioremap_full

extern void iounmap(void __iomem *addr);

+static inline void __iomem *ioport_map(unsigned long port, unsigned int nr)
+{
+ return (void __iomem *) port;
+}
+
+static inline void ioport_unmap(void __iomem *p)
+{
+}
+
static inline void flush_write_buffers(void)
{
__asm__ __volatile__ ("membar" : : :"memory");
}

+/*
+ * do appropriate I/O accesses for token type
+ */
+static inline unsigned int ioread8(void __iomem *p)
+{
+ return __builtin_read8(p);
+}
+
+static inline unsigned int ioread16(void __iomem *p)
+{
+ uint16_t ret = __builtin_read16(p);
+ if (__is_PCI_addr(p))
+ ret = _swapw(ret);
+ return ret;
+}
+
+static inline unsigned int ioread32(void __iomem *p)
+{
+ uint32_t ret = __builtin_read32(p);
+ if (__is_PCI_addr(p))
+ ret = _swapl(ret);
+ return ret;
+}
+
+static inline void iowrite8(u8 val, void __iomem *p)
+{
+ __builtin_write8(p, val);
+ if (__is_PCI_MEM(p))
+ __flush_PCI_writes();
+}
+
+static inline void iowrite16(u16 val, void __iomem *p)
+{
+ if (__is_PCI_addr(p))
+ val = _swapw(val);
+ __builtin_write16(p, val);
+ if (__is_PCI_MEM(p))
+ __flush_PCI_writes();
+}
+
+static inline void iowrite32(u32 val, void __iomem *p)
+{
+ if (__is_PCI_addr(p))
+ val = _swapl(val);
+ __builtin_write32(p, val);
+ if (__is_PCI_MEM(p))
+ __flush_PCI_writes();
+}
+
+static inline void ioread8_rep(void __iomem *p, void *dst, unsigned long count)
+{
+ io_insb((unsigned long) p, dst, count);
+}
+
+static inline void ioread16_rep(void __iomem *p, void *dst, unsigned long count)
+{
+ io_insw((unsigned long) p, dst, count);
+}
+
+static inline void ioread32_rep(void __iomem *p, void *dst, unsigned long count)
+{
+ __insl_ns((unsigned long) p, dst, count);
+}
+
+static inline void iowrite8_rep(void __iomem *p, const void *src, unsigned long count)
+{
+ io_outsb((unsigned long) p, src, count);
+}
+
+static inline void iowrite16_rep(void __iomem *p, const void *src, unsigned long count)
+{
+ io_outsw((unsigned long) p, src, count);
+}
+
+static inline void iowrite32_rep(void __iomem *p, const void *src, unsigned long count)
+{
+ __outsl_ns((unsigned long) p, src, count);
+}
+
+/* Create a virtual mapping cookie for a PCI BAR (memory or IO) */
+struct pci_dev;
+extern void __iomem *pci_iomap(struct pci_dev *dev, int bar, unsigned long max);
+static inline void pci_iounmap(struct pci_dev *dev, void __iomem *p)
+{
+}
+

/*
* Convert a physical pointer to a virtual kernel pointer for /dev/mem
@@ -284,6 +386,27 @@ static inline void flush_write_buffers(v
* Convert a virtual cached pointer to an uncached pointer
*/
#define xlate_dev_kmem_ptr(p) p
+
+/*
+ * Check BIOS signature
+ */
+static inline int check_signature(volatile void __iomem *io_addr,
+ const unsigned char *signature, int length)
+{
+ int retval = 0;
+
+ do {
+ if (readb(io_addr) != *signature)
+ goto out;
+ io_addr++;
+ signature++;
+ length--;
+ } while (length);
+
+ retval = 1;
+out:
+ return retval;
+}

#endif /* __KERNEL__ */

diff -uNrp /warthog/kernels/linux-2.6.15/include/asm-frv/mb-regs.h linux-2.6.15-frv/include/asm-frv/mb-regs.h
--- /warthog/kernels/linux-2.6.15/include/asm-frv/mb-regs.h 2005-03-02 12:08:45.000000000 +0000
+++ linux-2.6.15-frv/include/asm-frv/mb-regs.h 2006-01-06 14:43:43.000000000 +0000
@@ -68,6 +68,9 @@ do { \
#define __is_PCI_MEM(addr) \
((unsigned long)(addr) - __region_PCI_MEM < 0x08000000UL)

+#define __is_PCI_addr(addr) \
+ ((unsigned long)(addr) - __region_PCI_IO < 0x0c000000UL)
+
#define __get_CLKSW() ({ *(volatile unsigned long *)(__region_CS2 + 0x0130000cUL) & 0xffUL; })
#define __get_CLKIN() (__get_CLKSW() * 125U * 100000U / 24U)

@@ -149,6 +152,7 @@ do { \

#define __is_PCI_IO(addr) 0 /* no PCI */
#define __is_PCI_MEM(addr) 0
+#define __is_PCI_addr(addr) 0
#define __region_PCI_IO 0
#define __region_PCI_MEM 0
#define __flush_PCI_writes() do { } while(0)

2006-01-06 16:36:46

by David Howells

[permalink] [raw]
Subject: [PATCH 11/17] FRV: Make get_user macro cast pointers

The attached patch makes the get_user macro cast the source pointer to an
appropriate type for the specified size.

Signed-Off-By: David Howells <[email protected]>
---
warthog>diffstat -p1 frv-uaccess-2615.diff
include/asm-frv/uaccess.h | 8 ++++----
1 files changed, 4 insertions(+), 4 deletions(-)

diff -uNrp /warthog/kernels/linux-2.6.15/include/asm-frv/uaccess.h linux-2.6.15-frv/include/asm-frv/uaccess.h
--- /warthog/kernels/linux-2.6.15/include/asm-frv/uaccess.h 2005-11-01 13:19:17.000000000 +0000
+++ linux-2.6.15-frv/include/asm-frv/uaccess.h 2006-01-06 14:43:43.000000000 +0000
@@ -180,16 +180,16 @@ do { \
\
switch (sizeof(*(ptr))) { \
case 1: \
- __get_user_asm(__gu_err, __gu_val, ptr, "ub", "=r"); \
+ __get_user_asm(__gu_err, *(u8*)&__gu_val, ptr, "ub", "=r"); \
break; \
case 2: \
- __get_user_asm(__gu_err, __gu_val, ptr, "uh", "=r"); \
+ __get_user_asm(__gu_err, *(u16*)&__gu_val, ptr, "uh", "=r"); \
break; \
case 4: \
- __get_user_asm(__gu_err, __gu_val, ptr, "", "=r"); \
+ __get_user_asm(__gu_err, *(u32*)&__gu_val, ptr, "", "=r"); \
break; \
case 8: \
- __get_user_asm(__gu_err, __gu_val, ptr, "d", "=e"); \
+ __get_user_asm(__gu_err, *(u64*)&__gu_val, ptr, "d", "=e"); \
break; \
default: \
__gu_err = __get_user_bad(); \

2006-01-06 16:38:19

by David Howells

[permalink] [raw]
Subject: [PATCH 14/17] FRV: Stop the IEEE1394 nodemanager from accessing sem count directly

The attached patch stops the IEEE1394 nodemanager from accessing the internals
of a semaphore directly. On the FRV arch, what it does does not work, and
there's a macro for doing what it wants.

Signed-Off-By: David Howells <[email protected]>
---
warthog>diffstat -p1 ieee1394-2615.diff
drivers/ieee1394/nodemgr.c | 2 +-
1 files changed, 1 insertion(+), 1 deletion(-)

diff -uNrp /warthog/kernels/linux-2.6.15/drivers/ieee1394/nodemgr.c linux-2.6.15-frv/drivers/ieee1394/nodemgr.c
--- /warthog/kernels/linux-2.6.15/drivers/ieee1394/nodemgr.c 2006-01-04 12:39:26.000000000 +0000
+++ linux-2.6.15-frv/drivers/ieee1394/nodemgr.c 2006-01-06 14:43:43.000000000 +0000
@@ -284,7 +284,7 @@ static DEVICE_ATTR(bus_options,S_IRUGO,f
static ssize_t fw_show_ne_tlabels_free(struct device *dev, struct device_attribute *attr, char *buf)
{
struct node_entry *ne = container_of(dev, struct node_entry, device);
- return sprintf(buf, "%d\n", atomic_read(&ne->tpool->count.count) + 1);
+ return sprintf(buf, "%d\n", sem_getcount(&ne->tpool->count) + 1);
}
static DEVICE_ATTR(tlabels_free,S_IRUGO,fw_show_ne_tlabels_free,NULL);

2006-01-06 16:59:42

by Eric Dumazet

[permalink] [raw]
Subject: Re: [PATCH 15/17] FRV: Export __rcuref_hash

David Howells a ?crit :
> The attached patch exports __rcuref_hash which is required by some modules.
>
> Signed-Off-By: David Howells <[email protected]>
> ---
> warthog>diffstat -p1 rcu-export-2615.diff
> kernel/rcupdate.c | 1 +
> 1 files changed, 1 insertion(+)
>
> diff -uNrp /warthog/kernels/linux-2.6.15/kernel/rcupdate.c linux-2.6.15-frv/kernel/rcupdate.c
> --- /warthog/kernels/linux-2.6.15/kernel/rcupdate.c 2006-01-04 12:39:43.000000000 +0000
> +++ linux-2.6.15-frv/kernel/rcupdate.c 2006-01-06 14:43:43.000000000 +0000
> @@ -564,3 +564,4 @@ EXPORT_SYMBOL(call_rcu); /* WARNING: GP
> EXPORT_SYMBOL(call_rcu_bh); /* WARNING: GPL-only in April 2006. */
> EXPORT_SYMBOL_GPL(synchronize_rcu);
> EXPORT_SYMBOL(synchronize_kernel); /* WARNING: GPL-only in April 2006. */
> +EXPORT_SYMBOL_GPL(__rcuref_hash);

NACK

This break all platforms were __HAVE_ARCH_CMPXCHG is defined, since they have
no __rcuref_hash

Eric

2006-01-06 17:19:43

by Jan Dittmer

[permalink] [raw]
Subject: Re: [PATCH 0/17] FRV: Permit compilation with allmodconfig

David Howells wrote:
> The attached patches permit the FRV arch to be mostly compiled with
> allmodconfig, barring compiler errors.

What are the required and known working gcc and binutils versions
for that?

Thanks,

Jan