Skip to content

Commit

Permalink
[PATCH] frv: implement and export various things required by modules
Browse files Browse the repository at this point in the history
Export 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]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
dhowells authored and Linus Torvalds committed Jan 9, 2006
1 parent 8369ce4 commit 4023440
Show file tree
Hide file tree
Showing 14 changed files with 155 additions and 14 deletions.
25 changes: 18 additions & 7 deletions arch/frv/kernel/frv_ksyms.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 */

Expand Down Expand Up @@ -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);
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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);
Expand All @@ -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);
17 changes: 17 additions & 0 deletions arch/frv/kernel/irq.c
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -496,6 +505,8 @@ void free_irq(unsigned int irq, void *dev_id)
}
}

EXPORT_SYMBOL(free_irq);

/*
* IRQ autodetection code..
*
Expand All @@ -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).
Expand All @@ -542,6 +555,8 @@ unsigned int probe_irq_mask(unsigned long xmask)
return 0;
}

EXPORT_SYMBOL(probe_irq_mask);

/*
* Return the one interrupt that triggered (this can
* handle any interrupt source).
Expand Down Expand Up @@ -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)
{
Expand Down
2 changes: 2 additions & 0 deletions arch/frv/kernel/pm.c
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand All @@ -27,6 +28,7 @@
#include "local.h"

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

extern void frv_change_cmode(int);

Expand Down
3 changes: 3 additions & 0 deletions arch/frv/kernel/time.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -218,6 +220,7 @@ int do_settimeofday(struct timespec *tv)
clock_was_set();
return 0;
}

EXPORT_SYMBOL(do_settimeofday);

/*
Expand Down
3 changes: 3 additions & 0 deletions arch/frv/kernel/traps.c
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down Expand Up @@ -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)
{
}
Expand Down
7 changes: 7 additions & 0 deletions arch/frv/kernel/uaccess.c
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
*/

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

/*****************************************************************************/
Expand Down Expand Up @@ -58,8 +59,11 @@ long strncpy_from_user(char *dst, const char *src, long count)
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)
Expand Down Expand Up @@ -92,4 +96,7 @@ long strnlen_user(const char *src, long count)
}

return p - src + 1; /* return length including NUL */

} /* end strnlen_user() */

EXPORT_SYMBOL(strnlen_user);
2 changes: 1 addition & 1 deletion arch/frv/lib/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
45 changes: 45 additions & 0 deletions arch/frv/lib/__ucmpdi2.S
Original file line number Diff line number Diff line change
@@ -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
31 changes: 25 additions & 6 deletions arch/frv/lib/checksum.c
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@

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

static inline unsigned short from32to16(unsigned long x)
{
Expand Down Expand Up @@ -115,34 +116,52 @@ unsigned int csum_partial(const unsigned char * buff, int len, unsigned int sum)
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);
8 changes: 8 additions & 0 deletions arch/frv/mb93090-mb00/pci-dma-nommu.c
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,8 @@ void *dma_alloc_coherent(struct device *hwdev, size_t size, dma_addr_t *dma_hand
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;
Expand All @@ -102,6 +104,8 @@ void dma_free_coherent(struct device *hwdev, size_t size, void *vaddr, dma_addr_
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.
Expand All @@ -120,6 +124,8 @@ dma_addr_t dma_map_single(struct device *dev, void *ptr, size_t size,
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
Expand Down Expand Up @@ -150,3 +156,5 @@ int dma_map_sg(struct device *dev, struct scatterlist *sg, int nents,

return nents;
}

EXPORT_SYMBOL(dma_map_sg);
Loading

0 comments on commit 4023440

Please sign in to comment.