Commit e9322f66 authored by Anton Altaparmakov's avatar Anton Altaparmakov

Merge bk://linus.bkbits.net/linux-2.5 into cantab.net:/usr/src/tng

parents efa1546d 5e8a4a7d
......@@ -8,12 +8,11 @@
# Copyright (C) 1994 by Linus Torvalds
#
LINKFLAGS = -static -T bootloader.lds #-N -relax
USE_STANDARD_AS_RULE := true
EXTRA_AFLAGS := -traditional
.S.s:
$(CPP) $(AFLAGS) -traditional -o $*.o $<
.S.o:
$(CC) $(AFLAGS) -traditional -c -o $*.o $<
LINKFLAGS = -static -T bootloader.lds #-N -relax
OBJECTS = head.o main.o
BPOBJECTS = head.o bootp.o
......
......@@ -7,13 +7,12 @@
#
# Note 2! The CFLAGS definitions are now in the main makefile...
.S.s:
$(CPP) $(CFLAGS) $(AFLAGS) -o $*.s $<
.S.o:
$(CC) $(CFLAGS) $(AFLAGS) -c -o $*.o $<
USE_STANDARD_AS_RULE := true
O_TARGET := kernel.o
EXTRA_AFLAGS := $(CFLAGS)
export-objs := alpha_ksyms.o
obj-y := entry.o traps.o process.o init_task.o osf_sys.o irq.o irq_alpha.o \
......
......@@ -2,10 +2,9 @@
# Makefile for alpha-specific library files..
#
.S.s:
$(CPP) -D__ASSEMBLY__ $(CFLAGS) -o $*.s $<
.S.o:
$(CC) -D__ASSEMBLY__ $(CFLAGS) -c -o $*.o $<
USE_STANDARD_AS_RULE := true
EXTRA_AFLAGS := $(CFLAGS)
# Many of these routines have implementations tuned for ev6.
# Choose them iff we're targeting ev6 specifically.
......
......@@ -14,14 +14,12 @@ ifeq ($(CONFIG_CPU_26),y)
ZRELADDR = 0x02080000
PARAMS_PHYS = 0x0207c000
INITRD_PHYS = 0x02180000
INITRD_VIRT = 0x02180000
endif
ifeq ($(CONFIG_ARCH_RPC),y)
ZRELADDR = 0x10008000
PARAMS_PHYS = 0x10000100
INITRD_PHYS = 0x18000000
INITRD_VIRT = 0xc8000000
endif
ifeq ($(CONFIG_ARCH_CLPS7500),y)
......@@ -32,7 +30,6 @@ ifeq ($(CONFIG_ARCH_EBSA110),y)
ZRELADDR = 0x00008000
PARAMS_PHYS = 0x00000400
INITRD_PHYS = 0x00800000
INITRD_VIRT = 0xc0800000
endif
ifeq ($(CONFIG_ARCH_SHARK),y)
......@@ -44,14 +41,12 @@ ifeq ($(CONFIG_FOOTBRIDGE),y)
ZRELADDR = 0x00008000
PARAMS_PHYS = 0x00000100
INITRD_PHYS = 0x00800000
INITRD_VIRT = 0xc0800000
endif
ifeq ($(CONFIG_ARCH_INTEGRATOR),y)
ZRELADDR = 0x00008000
PARAMS_PHYS = 0x00000100
INITRD_PHYS = 0x00800000
INITRD_VIRT = 0xc0800000
endif
ifeq ($(CONFIG_ARCH_CAMELOT),y)
......@@ -75,11 +70,9 @@ endif
# Should probably have some agreement on these...
ifeq ($(CONFIG_ARCH_P720T),y)
INITRD_PHYS = 0xc0400000
INITRD_VIRT = 0xc0400000
endif
ifeq ($(CONFIG_ARCH_CDB89712),y)
INITRD_PHYS = 0x00700000
INITRD_VIRT = 0xc0300000
endif
ifeq ($(CONFIG_ARCH_SA1100),y)
......@@ -119,7 +112,7 @@ ZTEXTADDR =0
ZBSSADDR =ALIGN(4)
endif
export SYSTEM ZTEXTADDR ZBSSADDR ZRELADDR INITRD_PHYS INITRD_VIRT PARAMS_PHYS
export SYSTEM ZTEXTADDR ZBSSADDR ZRELADDR INITRD_PHYS PARAMS_PHYS
Image: $(CONFIGURE) $(SYSTEM)
$(OBJCOPY) -O binary -R .note -R .comment -S $(SYSTEM) $@
......@@ -139,7 +132,7 @@ bootp/bootp: zImage initrd
@$(MAKE) -C bootp bootp
initrd:
@test "$(INITRD_VIRT)" != "" || (echo This architecture does not support INITRD; exit -1)
@test "$(INITRD_PHYS)" != "" || (echo This architecture does not support INITRD; exit -1)
@test "$(INITRD)" != "" || (echo You must specify INITRD; exit -1)
install: $(CONFIGURE) Image
......
......@@ -5,7 +5,6 @@
ZSYSTEM =$(TOPDIR)/arch/arm/boot/zImage
ZLDFLAGS =-p -X -T bootp.lds \
--defsym initrd_addr=$(INITRD_PHYS) \
--defsym initrd_virt=$(INITRD_VIRT) \
--defsym params=$(PARAMS_PHYS) \
--defsym kernel_addr=$(ZTEXTADDR)
......
......@@ -102,8 +102,8 @@ data: .word initrd_start
.word kernel_len
.word 0x54410001 @ r4 = ATAG_CORE
.word 0x54410005 @ r5 = ATAG_INITRD
.word initrd_virt @ r6
.word 0x54420005 @ r5 = ATAG_INITRD
.word initrd_addr @ r6
.word initrd_len @ r7
.word params @ r8
......
......@@ -151,7 +151,7 @@ not_angel:
add r1, r1, r0 @ table. This fixes up the
str r1, [r6], #4 @ C references.
cmp r6, ip
blt 1b
blo 1b
not_relocated: mov r0, #0
1: str r0, [r2], #4 @ clear bss
......@@ -159,7 +159,7 @@ not_relocated: mov r0, #0
str r0, [r2], #4
str r0, [r2], #4
cmp r2, r3
blt 1b
blo 1b
mrc p15, 0, r6, c0, c0 @ get processor ID
bl cache_on
......@@ -206,7 +206,7 @@ not_relocated: mov r0, #0
ldmia r2!, {r8 - r13}
stmia r1!, {r8 - r13}
cmp r2, r3
blt 1b
blo 1b
bl cache_clean_flush
add pc, r5, r0 @ call relocation code
......@@ -270,9 +270,9 @@ __cache_on: sub r3, r4, #16384 @ Page directory size
orr r1, r1, #3 << 10
add r2, r3, #16384
1: cmp r1, r8 @ if virt > start of RAM
orrge r1, r1, #0x0c @ set cacheable, bufferable
orrhs r1, r1, #0x0c @ set cacheable, bufferable
cmp r1, r9 @ if virt > end of RAM
bicge r1, r1, #0x0c @ clear cacheable, bufferable
bichs r1, r1, #0x0c @ clear cacheable, bufferable
str r1, [r0], #4 @ 1:1 mapping
add r1, r1, #1048576
teq r0, r2
......@@ -330,7 +330,7 @@ reloc_start: add r8, r5, r0
.endr
cmp r5, r8
blt 1b
blo 1b
debug_reloc_end
call_kernel: bl cache_clean_flush
......@@ -396,6 +396,12 @@ proc_types:
b __armv4_cache_off
mov pc, lr
.word 0x41129200 @ ARM920T
.word 0xff00fff0
b __cache_on
b __armv4_cache_off
b __armv4_cache_flush
.word 0x4401a100 @ sa110 / sa1100
.word 0xffffffe0
b __cache_on
......
......@@ -464,20 +464,8 @@ bool 'Power Management support' CONFIG_PM
dep_bool 'Preemptible Kernel (experimental)' CONFIG_PREEMPT $CONFIG_CPU_32 $CONFIG_EXPERIMENTAL
dep_tristate 'Advanced Power Management Emulation' CONFIG_APM $CONFIG_PM
dep_tristate 'RISC OS personality' CONFIG_ARTHUR $CONFIG_CPU_32
string 'Default kernel command string' CONFIG_CMDLINE ""
if [ "$CONFIG_ARCH_EBSA110" = "y" -o \
"$CONFIG_ARCH_SA1100" = "y" -o \
"$CONFIG_ARCH_CLPS7500" = "y" -o \
"$CONFIG_ARCH_PERSONAL_SERVER" = "y" -o \
"$CONFIG_ARCH_CATS" = "y" -o \
"$CONFIG_ARCH_P720T" = "y" -o \
"$CONFIG_ARCH_CDB89712" = "y" -o \
"$CONFIG_ARCH_CAMELOT" = "y" -o \
"$CONFIG_ARCH_ANAKIN" = "y" -o \
"$CONFIG_ARCH_IOP310" = "y" -o \
"$CONFIG_ARCH_ADIFCC" = "y" ]; then
string 'Default kernel command string' CONFIG_CMDLINE ""
fi
if [ "$CONFIG_ARCH_NETWINDER" = "y" -o \
"$CONFIG_ARCH_EBSA110" = "y" -o \
"$CONFIG_ARCH_EBSA285" = "y" -o \
......
......@@ -849,7 +849,7 @@ CONFIG_USB_DEBUG=y
#
# CONFIG_USB_UHCI is not set
# CONFIG_USB_UHCI_ALT is not set
CONFIG_USB_OHCI=y
# CONFIG_USB_OHCI is not set
CONFIG_USB_OHCI_SA1111=y
#
......
......@@ -182,7 +182,6 @@ EXPORT_SYMBOL_NOVERS(strchr);
EXPORT_SYMBOL_NOVERS(strlen);
EXPORT_SYMBOL_NOVERS(strnlen);
EXPORT_SYMBOL_NOVERS(strpbrk);
EXPORT_SYMBOL_NOVERS(strsep);
EXPORT_SYMBOL_NOVERS(strrchr);
EXPORT_SYMBOL_NOVERS(strstr);
EXPORT_SYMBOL_NOVERS(memset);
......
......@@ -9,6 +9,11 @@
*
* We keep the old params compatibility cruft in one place (here)
* so we don't end up with lots of mess around other places.
*
* NOTE:
* The old struct param_struct is deprecated, but it will be kept in
* the kernel for 5 years from now (2001). This will allow boot loaders
* to convert to the new struct tag way.
*/
#include <linux/config.h>
#include <linux/types.h>
......@@ -22,6 +27,59 @@
#include <asm/mach/arch.h>
/*
* Usage:
* - do not go blindly adding fields, add them at the end
* - when adding fields, don't rely on the address until
* a patch from me has been released
* - unused fields should be zero (for future expansion)
* - this structure is relatively short-lived - only
* guaranteed to contain useful data in setup_arch()
*
* This is the old deprecated way to pass parameters to the kernel
*/
struct param_struct {
union {
struct {
unsigned long page_size; /* 0 */
unsigned long nr_pages; /* 4 */
unsigned long ramdisk_size; /* 8 */
unsigned long flags; /* 12 */
#define FLAG_READONLY 1
#define FLAG_RDLOAD 4
#define FLAG_RDPROMPT 8
unsigned long rootdev; /* 16 */
unsigned long video_num_cols; /* 20 */
unsigned long video_num_rows; /* 24 */
unsigned long video_x; /* 28 */
unsigned long video_y; /* 32 */
unsigned long memc_control_reg; /* 36 */
unsigned char sounddefault; /* 40 */
unsigned char adfsdrives; /* 41 */
unsigned char bytes_per_char_h; /* 42 */
unsigned char bytes_per_char_v; /* 43 */
unsigned long pages_in_bank[4]; /* 44 */
unsigned long pages_in_vram; /* 60 */
unsigned long initrd_start; /* 64 */
unsigned long initrd_size; /* 68 */
unsigned long rd_start; /* 72 */
unsigned long system_rev; /* 76 */
unsigned long system_serial_low; /* 80 */
unsigned long system_serial_high; /* 84 */
unsigned long mem_fclk_21285; /* 88 */
} s;
char unused[256];
} u1;
union {
char paths[8][128];
struct {
unsigned long magic;
char n[1024 - sizeof(unsigned long)];
} s;
} u2;
char commandline[COMMAND_LINE_SIZE];
};
static struct tag * __init memtag(struct tag *tag, unsigned long start, unsigned long size)
{
tag = tag_next(tag);
......@@ -33,7 +91,7 @@ static struct tag * __init memtag(struct tag *tag, unsigned long start, unsigned
return tag;
}
static void __init build_tag_list(struct param_struct *params, void *taglist, int mem_init)
static void __init build_tag_list(struct param_struct *params, void *taglist)
{
struct tag *tag = taglist;
......@@ -44,6 +102,22 @@ static void __init build_tag_list(struct param_struct *params, void *taglist, in
"trying to continue\n");
return;
}
#ifdef CONFIG_ARCH_NETWINDER
if (params->u1.s.nr_pages != 0x02000 &&
params->u1.s.nr_pages != 0x04000 &&
params->u1.s.nr_pages != 0x08000 &&
params->u1.s.nr_pages != 0x10000) {
printk(KERN_WARNING "Warning: bad NeTTrom parameters "
"detected, using defaults\n");
params->u1.s.nr_pages = 0x1000; /* 16MB */
params->u1.s.ramdisk_size = 0;
params->u1.s.flags = FLAG_READONLY;
params->u1.s.initrd_start = 0;
params->u1.s.initrd_size = 0;
params->u1.s.rd_start = 0;
}
#endif
tag->hdr.tag = ATAG_CORE;
tag->hdr.size = tag_size(tag_core);
......@@ -76,17 +150,15 @@ static void __init build_tag_list(struct param_struct *params, void *taglist, in
tag->hdr.size = tag_size(tag_revision);
tag->u.revision.rev = params->u1.s.system_rev;
if (mem_init) {
#ifdef CONFIG_ARCH_ACORN
if (machine_is_riscpc()) {
int i;
for (i = 0; i < 4; i++)
tag = memtag(tag, PHYS_OFFSET + (i << 26),
params->u1.s.pages_in_bank[i] * PAGE_SIZE);
} else
if (machine_is_riscpc()) {
int i;
for (i = 0; i < 4; i++)
tag = memtag(tag, PHYS_OFFSET + (i << 26),
params->u1.s.pages_in_bank[i] * PAGE_SIZE);
} else
#endif
tag = memtag(tag, PHYS_OFFSET, params->u1.s.nr_pages * PAGE_SIZE);
}
tag = memtag(tag, PHYS_OFFSET, params->u1.s.nr_pages * PAGE_SIZE);
#ifdef CONFIG_FOOTBRIDGE
if (params->u1.s.mem_fclk_21285) {
......@@ -97,6 +169,23 @@ static void __init build_tag_list(struct param_struct *params, void *taglist, in
}
#endif
#ifdef CONFIG_ARCH_EBSA285
if (machine_is_ebsa285()) {
tag = tag_next(tag);
tag->hdr.tag = ATAG_VIDEOTEXT;
tag->hdr.size = tag_size(tag_videotext);
tag->u.videotext.x = params->u1.s.video_x;
tag->u.videotext.y = params->u1.s.video_y;
tag->u.videotext.video_page = 0;
tag->u.videotext.video_mode = 0;
tag->u.videotext.video_cols = params->u1.s.video_num_cols;
tag->u.videotext.video_ega_bx = 0;
tag->u.videotext.video_lines = params->u1.s.video_num_rows;
tag->u.videotext.video_isvga = 1;
tag->u.videotext.video_points = 8;
}
#endif
#ifdef CONFIG_ARCH_ACORN
tag = tag_next(tag);
tag->hdr.tag = ATAG_ACORN;
......@@ -114,14 +203,22 @@ static void __init build_tag_list(struct param_struct *params, void *taglist, in
strcpy(tag->u.cmdline.cmdline, params->commandline);
tag = tag_next(tag);
tag->hdr.tag = 0;
tag->hdr.tag = ATAG_NONE;
tag->hdr.size = 0;
memmove(params, taglist, ((int)tag) - ((int)taglist) +
sizeof(struct tag_header));
}
void __init convert_to_tag_list(struct param_struct *params, int mem_init)
void __init convert_to_tag_list(struct tag *tags)
{
struct param_struct *params = (struct param_struct *)tags;
build_tag_list(params, &params->u2);
}
void __init squash_mem_tags(struct tag *tag)
{
build_tag_list(params, &params->u2, mem_init);
for (; tag->hdr.size; tag = tag_next(tag))
if (tag->hdr.tag == ATAG_MEM)
tag->hdr.tag = ATAG_NONE;
}
......@@ -799,8 +799,7 @@ __und_svc: sub sp, sp, #S_FRAME_SIZE
adrsvc al, r9, 1f @ r9 = normal FP return
bl call_fpe @ lr = undefined instr return
mov r0, r5 @ unsigned long pc
mov r1, sp @ struct pt_regs *regs
mov r0, sp @ struct pt_regs *regs
bl do_undefinstr
1: set_cpsr_c r0, #PSR_I_BIT | MODE_SVC
......@@ -926,8 +925,7 @@ call_fpe: get_thread_info r10 @ get current thread
ldr pc, [r4] @ Call FP module USR entry point
fpundefinstr: set_cpsr_c r0, #MODE_SVC @ Enable interrupts
mov r0, lr
mov r1, sp
mov r0, sp
adrsvc al, lr, ret_from_exception
b do_undefinstr
......
......@@ -45,7 +45,7 @@ static inline struct pt_regs *
get_user_regs(struct task_struct *task)
{
return (struct pt_regs *)
((unsigned long)task + 8192 - sizeof(struct pt_regs));
((unsigned long)task->thread_info + 8192 - sizeof(struct pt_regs));
}
/*
......
......@@ -35,10 +35,6 @@
#define MEM_SIZE (16*1024*1024)
#endif
#ifndef CONFIG_CMDLINE
#define CONFIG_CMDLINE ""
#endif
#ifdef CONFIG_PREEMPT
spinlock_t kernel_flag __cacheline_aligned_in_smp = SPIN_LOCK_UNLOCKED;
#endif
......@@ -57,7 +53,8 @@ __setup("fpe=", fpe_setup);
extern unsigned int mem_fclk_21285;
extern void paging_init(struct meminfo *, struct machine_desc *desc);
extern void convert_to_tag_list(struct param_struct *params, int mem_init);
extern void convert_to_tag_list(struct tag *tags);
extern void squash_mem_tags(struct tag *tag);
extern void bootmem_init(struct meminfo *);
extern void reboot_setup(char *str);
extern int root_mountflags;
......@@ -517,6 +514,20 @@ static int __init parse_tag_initrd(const struct tag *tag)
__tagtable(ATAG_INITRD, parse_tag_initrd);
static int __init parse_tag_initrd2(const struct tag *tag)
{
unsigned long start = 0;
if (tag->u.initrd.size) {
start = (unsigned long)phys_to_virt(tag->u.initrd.start);
setup_initrd(start, tag->u.initrd.size);
}
return 0;
}
__tagtable(ATAG_INITRD2, parse_tag_initrd2);
static int __init parse_tag_serialnr(const struct tag *tag)
{
system_serial_low = tag->u.serialnr.low;
......@@ -575,14 +586,29 @@ static void __init parse_tags(const struct tag *t)
t->hdr.tag);
}
/*
* This holds our defaults.
*/
static struct init_tags {
struct tag_header hdr1;
struct tag_core core;
struct tag_header hdr2;
struct tag_mem32 mem;
struct tag_header hdr3;
} init_tags __initdata = {
{ tag_size(tag_core), ATAG_CORE },
{ 1, PAGE_SIZE, 0xff },
{ tag_size(tag_mem32), ATAG_MEM },
{ MEM_SIZE, PHYS_OFFSET },
{ 0, ATAG_NONE }
};
void __init setup_arch(char **cmdline_p)
{
struct tag *tags = NULL;
struct tag *tags = (struct tag *)&init_tags;
struct machine_desc *mdesc;
char *from = default_command_line;
ROOT_DEV = mk_kdev(0, 255);
setup_processor();
mdesc = setup_machine(machine_arch_type);
machine_name = mdesc->name;
......@@ -593,29 +619,22 @@ void __init setup_arch(char **cmdline_p)
if (mdesc->param_offset)
tags = phys_to_virt(mdesc->param_offset);
/*
* Do the machine-specific fixups before we parse the
* parameters or tags.
*/
if (mdesc->fixup)
mdesc->fixup(mdesc, (struct param_struct *)tags,
&from, &meminfo);
/*
* If we have the old style parameters, convert them to
* a tag list before.
* a tag list.
*/
if (tags && tags->hdr.tag != ATAG_CORE)
convert_to_tag_list((struct param_struct *)tags,
meminfo.nr_banks == 0);
if (tags->hdr.tag != ATAG_CORE)
convert_to_tag_list(tags);
if (tags->hdr.tag != ATAG_CORE)
tags = (struct tag *)&init_tags;
if (tags && tags->hdr.tag == ATAG_CORE)
parse_tags(tags);
if (mdesc->fixup)
mdesc->fixup(mdesc, tags, &from, &meminfo);
if (meminfo.nr_banks == 0) {
meminfo.nr_banks = 1;
meminfo.bank[0].start = PHYS_OFFSET;
meminfo.bank[0].size = MEM_SIZE;
if (tags->hdr.tag == ATAG_CORE) {
if (meminfo.nr_banks != 0)
squash_mem_tags(tags);
parse_tags(tags);
}
init_mm.start_code = (unsigned long) &_text;
......
......@@ -116,7 +116,7 @@ static void dump_instr(struct pt_regs *regs)
static void dump_stack(struct task_struct *tsk, unsigned long sp)
{
dump_mem("Stack: ", sp - 16, 8192+(unsigned long)tsk->thread_info);
dump_mem("Stack: ", sp, 8192+(unsigned long)tsk->thread_info);
}
static void dump_backtrace(struct pt_regs *regs, struct task_struct *tsk)
......@@ -132,7 +132,7 @@ static void dump_backtrace(struct pt_regs *regs, struct task_struct *tsk)
} else if (verify_stack(fp)) {
printk("invalid frame pointer 0x%08x", fp);
ok = 0;
} else if (fp < 4096+(unsigned long)tsk->thread_info)
} else if (fp < (unsigned long)(tsk->thread_info + 1))
printk("frame pointer underflow");
printk("\n");
......@@ -167,8 +167,8 @@ NORET_TYPE void die(const char *str, struct pt_regs *regs, int err)
printk("Internal error: %s: %x\n", str, err);
printk("CPU: %d\n", smp_processor_id());
show_regs(regs);
printk("Process %s (pid: %d, stackpage=%08lx)\n",
current->comm, current->pid, 4096+(unsigned long)tsk);
printk("Process %s (pid: %d, stack limit = 0x%p)\n",
current->comm, current->pid, tsk->thread_info + 1);
if (!user_mode(regs) || in_interrupt()) {
mm_segment_t fs;
......@@ -201,7 +201,7 @@ void die_if_kernel(const char *str, struct pt_regs *regs, int err)
die(str, regs, err);
}
asmlinkage void do_undefinstr(int address, struct pt_regs *regs, int mode)
asmlinkage void do_undefinstr(struct pt_regs *regs)
{
unsigned long *pc;
siginfo_t info;
......@@ -229,7 +229,7 @@ asmlinkage void do_undefinstr(int address, struct pt_regs *regs, int mode)
force_sig_info(SIGILL, &info, current);
die_if_kernel("Oops - undefined instruction", regs, mode);
die_if_kernel("Oops - undefined instruction", regs, 0);
}
#ifdef CONFIG_CPU_26
......
......@@ -137,19 +137,19 @@ FN_ENTRY
4: ands len, len, #3
beq .done
load1l r5
load1l r4
tst len, #2
mov r4, r5, lsr #byte(0)
mov r5, r4, lsr #byte(0)
beq .exit
adcs sum, sum, r5, push #16
strb r4, [dst], #1
mov r4, r5, lsr #byte(1)
strb r4, [dst], #1
mov r4, r5, lsr #byte(2)
adcs sum, sum, r4, push #16
strb r5, [dst], #1
mov r5, r4, lsr #byte(1)
strb r5, [dst], #1
mov r5, r4, lsr #byte(2)
.exit: tst len, #1
strneb r4, [dst], #1
andne r4, r4, #255
adcnes sum, sum, r4, lsl #byte(0)
strneb r5, [dst], #1
andne r5, r5, #255
adcnes sum, sum, r5, lsl #byte(0)
/*
* If the dst pointer was not 16-bit aligned, we
......@@ -210,17 +210,17 @@ FN_ENTRY
orr r4, r4, r5, push #24
str r4, [dst], #4
adcs sum, sum, r4
mov r4, r5, pull #8
4: ands len, len, #3
beq .done
mov r4, r5, lsr #byte(1)
mov r5, r4, lsr #byte(0)
tst len, #2
beq .exit
bic r5, r5, #0xff << byte(0)
adcs sum, sum, r5, push #8
strb r4, [dst], #1
mov r4, r5, lsr #byte(2)
strb r4, [dst], #1
mov r4, r5, lsr #byte(3)
adcs sum, sum, r4, push #16
strb r5, [dst], #1
mov r5, r4, lsr #byte(1)
strb r5, [dst], #1
mov r5, r4, lsr #byte(2)
b .exit
.src2_aligned: mov r4, r5, pull #16
......@@ -262,18 +262,19 @@ FN_ENTRY
orr r4, r4, r5, push #16
str r4, [dst], #4
adcs sum, sum, r4
mov r4, r5, pull #16
4: ands len, len, #3
beq .done
mov r4, r5, lsr #byte(2)
mov r5, r4, lsr #byte(0)
tst len, #2
beq .exit
adcs sum, sum, r5, pull #16
strb r4, [dst], #1
mov r4, r5, lsr #byte(3)
strb r4, [dst], #1
adcs sum, sum, r4
strb r5, [dst], #1
mov r5, r4, lsr #byte(1)
strb r5, [dst], #1
tst len, #1
beq .done
load1b r4
load1b r5
b .exit
.src3_aligned: mov r4, r5, pull #24
......@@ -315,16 +316,17 @@ FN_ENTRY
orr r4, r4, r5, push #8
str r4, [dst], #4
adcs sum, sum, r4
mov r4, r5, pull #24
4: ands len, len, #3
beq .done
mov r4, r5, lsr #byte(3)
mov r5, r4, lsr #byte(0)
tst len, #2
beq .exit
adcs sum, sum, r5, pull #24
strb r4, [dst], #1
load1l r5
mov r4, r5, lsr #byte(0)
strb r4, [dst], #1
strb r5, [dst], #1
adcs sum, sum, r4
load1l r4
mov r5, r4, lsr #byte(0)
strb r5, [dst], #1
adcs sum, sum, r4, push #24
mov r4, r5, lsr #byte(1)
mov r5, r4, lsr #byte(1)
b .exit
......@@ -22,7 +22,7 @@ extern void adifcc_map_io(void);
extern void adifcc_init_irq(void);
static void __init
fixup_adifcc(struct machine_desc *desc, struct param_struct *params,
fixup_adifcc(struct machine_desc *desc, struct tag *tags,
char **cmdline, struct meminfo *mi)
{
#ifdef CONFIG_ARCH_ADI_EVB
......
......@@ -27,7 +27,7 @@ extern void anakin_map_io(void);
extern void genarch_init_irq(void);
static void __init
fixup_anakin(struct machine_desc *desc, struct param_struct *unused,
fixup_anakin(struct machine_desc *desc, struct tag *tag,
char **cmdline, struct meminfo *mi)
{
ROOT_DEV = mk_kdev(RAMDISK_MAJOR, 0);
......
......@@ -45,7 +45,7 @@ static struct map_desc cdb89712_io_desc[] __initdata = {
};
static void __init
fixup_cdb89712(struct machine_desc *desc, struct param_struct *params,
fixup_cdb89712(struct machine_desc *desc, struct tag *tags,
char **cmdline, struct meminfo *mi)
{
}
......
......@@ -27,7 +27,7 @@ extern void clps711x_init_irq(void);
extern void clps711x_map_io(void);
static void __init
fixup_clep7312(struct machine_desc *desc, struct param_struct *params,
fixup_clep7312(struct machine_desc *desc, struct tag *tags,
char **cmdline, struct meminfo *mi)
{
mi->nr_banks=1;
......
......@@ -29,7 +29,7 @@ extern void clps711x_init_irq(void);
extern void edb7211_map_io(void);
static void __init
fixup_edb7211(struct machine_desc *desc, struct param_struct *params,
fixup_edb7211(struct machine_desc *desc, struct tag *tags,
char **cmdline, struct meminfo *mi)
{
/*
......
......@@ -53,7 +53,7 @@ typedef struct tag_IMAGE_PARAMS
#define IMAGE_PARAMS_PHYS 0xC01F0000
static void __init
fortunet_fixup(struct machine_desc *desc, struct param_struct *params,
fortunet_fixup(struct machine_desc *desc, struct tag *tags,
char **cmdline, struct meminfo *mi)
{
IMAGE_PARAMS *ip;
......
......@@ -49,11 +49,9 @@ static struct map_desc p720t_io_desc[] __initdata = {
};
static void __init
fixup_p720t(struct machine_desc *desc, struct param_struct *params,
fixup_p720t(struct machine_desc *desc, struct tag *tag,
char **cmdline, struct meminfo *mi)
{
struct tag *tag = (struct tag *)params;
/*
* Our bootloader doesn't setup any tags (yet).
*/
......
......@@ -35,7 +35,7 @@ extern void epxa10db_init_irq(void);
static void __init
epxa10db_fixup(struct machine_desc *desc, struct param_struct *params,
epxa10db_fixup(struct machine_desc *desc, struct tag *tags,
char **cmdline, struct meminfo *mi)
{
......
......@@ -36,25 +36,11 @@ static int __init parse_tag_memclk(const struct tag *tag)
__tagtable(ATAG_MEMCLK, parse_tag_memclk);
#ifdef CONFIG_ARCH_EBSA285
static void __init
fixup_ebsa285(struct machine_desc *desc, struct param_struct *params,
char **cmdline, struct meminfo *mi)
{
#if defined(CONFIG_VGA_CONSOLE) || defined(CONFIG_DUMMY_CONSOLE)
ORIG_X = params->u1.s.video_x;
ORIG_Y = params->u1.s.video_y;
ORIG_VIDEO_COLS = params->u1.s.video_num_cols;
ORIG_VIDEO_LINES = params->u1.s.video_num_rows;
#endif
}
MACHINE_START(EBSA285, "EBSA285")
MAINTAINER("Russell King")
BOOT_MEM(0x00000000, DC21285_ARMCSR_BASE, 0xfe000000)
BOOT_PARAMS(0x00000100)
VIDEO(0x000a0000, 0x000bffff)
FIXUP(fixup_ebsa285)
MAPIO(footbridge_map_io)
INITIRQ(footbridge_init_irq)
MACHINE_END
......@@ -67,7 +53,7 @@ MACHINE_END
* the parameter page.
*/
static void __init
fixup_netwinder(struct machine_desc *desc, struct param_struct *params,
fixup_netwinder(struct machine_desc *desc, struct tag *tags,
char **cmdline, struct meminfo *mi)
{
#ifdef CONFIG_ISAPNP
......@@ -80,21 +66,6 @@ fixup_netwinder(struct machine_desc *desc, struct param_struct *params,
*/
isapnp_disable = 1;
#endif
if (params->u1.s.nr_pages != 0x02000 &&
params->u1.s.nr_pages != 0x04000 &&
params->u1.s.nr_pages != 0x08000 &&
params->u1.s.nr_pages != 0x10000) {
printk(KERN_WARNING "Warning: bad NeTTrom parameters "
"detected, using defaults\n");
params->u1.s.nr_pages = 0x1000; /* 16MB */
params->u1.s.ramdisk_size = 0;
params->u1.s.flags = FLAG_READONLY;
params->u1.s.initrd_start = 0;
params->u1.s.initrd_size = 0;
params->u1.s.rd_start = 0;
}
}
MACHINE_START(NETWINDER, "Rebel-NetWinder")
......@@ -116,7 +87,7 @@ MACHINE_END
* hard reboots fail on early boards.
*/
static void __init
fixup_cats(struct machine_desc *desc, struct param_struct *unused,
fixup_cats(struct machine_desc *desc, struct tag *tags,
char **cmdline, struct meminfo *mi)
{
ORIG_VIDEO_LINES = 25;
......@@ -138,7 +109,7 @@ MACHINE_END
#ifdef CONFIG_ARCH_CO285
static void __init
fixup_coebsa285(struct machine_desc *desc, struct param_struct *unused,
fixup_coebsa285(struct machine_desc *desc, struct tag *tags,
char **cmdline, struct meminfo *mi)
{
extern unsigned long boot_memory_end;
......
......@@ -51,7 +51,7 @@ static struct kmi_info integrator_mouse __initdata = {
#endif
static void __init
integrator_fixup(struct machine_desc *desc, struct param_struct *unused,
integrator_fixup(struct machine_desc *desc, struct tag *tags,
char **cmdline, struct meminfo *mi)
{
#ifdef CONFIG_KMI_KEYB
......
......@@ -33,10 +33,10 @@
/*
* Logical Physical
* e8000000 40000000 PCI memory
* ec000000 62000000 PCI config space
* ed000000 61000000 PCI V3 regs
* ee000000 60000000 PCI IO
* e8000000 40000000 PCI memory PHYS_PCI_MEM_BASE (max 512M)
* ec000000 61000000 PCI config space PHYS_PCI_CONFIG_BASE (max 16M)
* ed000000 62000000 PCI V3 regs PHYS_PCI_V3_BASE (max 64k)
* ee000000 60000000 PCI IO PHYS_PCI_IO_BASE (max 16M)
* ef000000 Cache flush
* f1000000 10000000 Core module registers
* f1100000 11000000 System controller registers
......@@ -67,7 +67,7 @@ static struct map_desc integrator_io_desc[] __initdata = {
{ IO_ADDRESS(INTEGRATOR_GPIO_BASE), INTEGRATOR_GPIO_BASE, SZ_4K , DOMAIN_IO, 0, 1},
{ PCI_MEMORY_VADDR, PHYS_PCI_MEM_BASE, SZ_16M , DOMAIN_IO, 0, 1},
{ PCI_CONFIG_VADDR, PHYS_PCI_CONFIG_BASE, SZ_16M , DOMAIN_IO, 0, 1},
{ PCI_V3_VADDR, PHYS_PCI_V3_BASE, SZ_512K , DOMAIN_IO, 0, 1},
{ PCI_V3_VADDR, PHYS_PCI_V3_BASE, SZ_64K , DOMAIN_IO, 0, 1},
{ PCI_IO_VADDR, PHYS_PCI_IO_BASE, SZ_64K , DOMAIN_IO, 0, 1},
LAST_DESC
};
......
......@@ -50,7 +50,7 @@
* 40000000 - 4FFFFFFF PCI memory. 256M non-prefetchable
* 50000000 - 5FFFFFFF PCI memory. 256M prefetchable
* 60000000 - 60FFFFFF PCI IO. 16M
* 68000000 - 68FFFFFF PCI Configuration. 16M
* 61000000 - 61FFFFFF PCI Configuration. 16M
*
* There are three V3 windows, each described by a pair of V3 registers.
* These are LB_BASE0/LB_MAP0, LB_BASE1/LB_MAP1 and LB_BASE2/LB_MAP2.
......@@ -58,14 +58,6 @@
* can be used either for PCI I/O or for I20 accesses. By default, uHAL
* uses this only for PCI IO space.
*
* PCI Memory is mapped so that assigned addresses in PCI Memory match
* local bus memory addresses. In other words, if a PCI device is assigned
* address 80200000 then that address is a valid local bus address as well
* as a valid PCI Memory address. PCI IO addresses are mapped to start
* at zero. This means that local bus address 60000000 maps to PCI IO address
* 00000000 and so on. Device driver writers need to be aware of this
* distinction.
*
* Normally these spaces are mapped using the following base registers:
*
* Usage Local Bus Memory Base/Map registers used
......@@ -73,7 +65,7 @@
* Mem 40000000 - 4FFFFFFF LB_BASE0/LB_MAP0
* Mem 50000000 - 5FFFFFFF LB_BASE1/LB_MAP1
* IO 60000000 - 60FFFFFF LB_BASE2/LB_MAP2
* Cfg 68000000 - 68FFFFFF
* Cfg 61000000 - 61FFFFFF
*
* This means that I20 and PCI configuration space accesses will fail.
* When PCI configuration accesses are needed (via the uHAL PCI
......@@ -84,7 +76,7 @@
* Mem 40000000 - 4FFFFFFF LB_BASE0/LB_MAP0
* Mem 50000000 - 5FFFFFFF LB_BASE0/LB_MAP0
* IO 60000000 - 60FFFFFF LB_BASE2/LB_MAP2
* Cfg 68000000 - 68FFFFFF LB_BASE1/LB_MAP1
* Cfg 61000000 - 61FFFFFF LB_BASE1/LB_MAP1
*
* To make this work, the code depends on overlapping windows working.
* The V3 chip translates an address by checking its range within
......@@ -174,10 +166,10 @@
static spinlock_t v3_lock = SPIN_LOCK_UNLOCKED;
#define PCI_BUS_NONMEM_START 0x00000000
#define PCI_BUS_NONMEM_SIZE 0x10000000
#define PCI_BUS_NONMEM_SIZE SZ_256M
#define PCI_BUS_PREMEM_START 0x10000000
#define PCI_BUS_PREMEM_SIZE 0x10000000
#define PCI_BUS_PREMEM_START PCI_BUS_NONMEM_START + PCI_BUS_NONMEM_SIZE
#define PCI_BUS_PREMEM_SIZE SZ_256M
#if PCI_BUS_NONMEM_START & 0x000fffff
#error PCI_BUS_NONMEM_START must be megabyte aligned
......@@ -400,15 +392,15 @@ static struct pci_ops pci_v3_ops = {
static struct resource non_mem = {
name: "PCI non-prefetchable",
start: 0x40000000 + PCI_BUS_NONMEM_START,
end: 0x40000000 + PCI_BUS_NONMEM_START + PCI_BUS_NONMEM_SIZE - 1,
start: PHYS_PCI_MEM_BASE + PCI_BUS_NONMEM_START,
end: PHYS_PCI_MEM_BASE + PCI_BUS_NONMEM_START + PCI_BUS_NONMEM_SIZE - 1,
flags: IORESOURCE_MEM,
};
static struct resource pre_mem = {
name: "PCI prefetchable",
start: 0x40000000 + PCI_BUS_PREMEM_START,
end: 0x40000000 + PCI_BUS_PREMEM_START + PCI_BUS_PREMEM_SIZE - 1,
start: PHYS_PCI_MEM_BASE + PCI_BUS_PREMEM_START,
end: PHYS_PCI_MEM_BASE + PCI_BUS_PREMEM_START + PCI_BUS_PREMEM_SIZE - 1,
flags: IORESOURCE_MEM | IORESOURCE_PREFETCH,
};
......@@ -433,7 +425,7 @@ static int __init pci_v3_setup_resources(struct resource **resource)
*/
resource[0] = &ioport_resource;
resource[1] = &non_mem;
resource[2] = &pre_mem;
// resource[2] = &pre_mem;
return 1;
}
......@@ -530,7 +522,7 @@ int __init pci_v3_setup(int nr, struct pci_sys_data *sys)
int ret = 0;
if (nr == 0) {
sys->mem_offset = 0x40000000;
sys->mem_offset = PHYS_PCI_MEM_BASE;
ret = pci_v3_setup_resources(sys->resource);
}
......
......@@ -26,7 +26,7 @@ extern void iq80310_map_io(void);
extern void iq80310_init_irq(void);
static void __init
fixup_iq80310(struct machine_desc *desc, struct param_struct *params,
fixup_iq80310(struct machine_desc *desc, struct tag *tags,
char **cmdline, struct meminfo *mi)
{
system_rev = (*(volatile unsigned int*)0xfe830000) & 0x0f;
......
......@@ -83,7 +83,7 @@ static void __init l7200_map_io(void)
}
static void __init
fixup_l7200(struct machine_desc *desc, struct param_struct *unused,
fixup_l7200(struct machine_desc *desc, struct tag *tags,
char **cmdline, struct meminfo *mi)
{
mi->nr_banks = 1;
......
......@@ -69,7 +69,7 @@ static void __init idp_init_irq(void)
}
static void __init
fixup_idp(struct machine_desc *desc, struct param_struct *params,
fixup_idp(struct machine_desc *desc, struct tag *tags,
char **cmdline, struct meminfo *mi)
{
#ifdef PXA_IDP_REV02
......
......@@ -120,7 +120,7 @@ static int __init lubbock_init(void)
__initcall(lubbock_init);
static void __init
fixup_lubbock(struct machine_desc *desc, struct param_struct *params,
fixup_lubbock(struct machine_desc *desc, struct tag *tags,
char **cmdline, struct meminfo *mi)
{
SET_BANK (0, 0xa0000000, 64*1024*1024);
......
......@@ -61,7 +61,7 @@ __tagtable(ATAG_ACORN, parse_tag_acorn);
#endif
static void __init
fixup_riscpc(struct machine_desc *desc, struct param_struct *unusd,
fixup_riscpc(struct machine_desc *desc, struct tag *tags,
char **cmdline, struct meminfo *mi)
{
/*
......
......@@ -82,7 +82,7 @@ static void __init adsbitsy_init_irq(void)
*/
static void __init
fixup_adsbitsy(struct machine_desc *desc, struct param_struct *params,
fixup_adsbitsy(struct machine_desc *desc, struct tag *tags,
char **cmdline, struct meminfo *mi)
{
SET_BANK( 0, 0xc0000000, 32*1024*1024 );
......
......@@ -103,7 +103,6 @@ static int __init assabet_init(void)
* or BCR_clear().
*/
ASSABET_BCR = BCR_value = ASSABET_BCR_DB1111;
NCR_0 = 0;
#ifndef CONFIG_ASSABET_NEPONSET
printk( "Warning: Neponset detected but full support "
......@@ -159,13 +158,11 @@ static void __init get_assabet_scr(void)
SCR_value = scr;
}
extern void convert_to_tag_list(struct param_struct *params, int mem_init);
static void __init
fixup_assabet(struct machine_desc *desc, struct param_struct *params,
fixup_assabet(struct machine_desc *desc, struct tag *tags,
char **cmdline, struct meminfo *mi)
{
struct tag *t = (struct tag *)params;
struct tag *t = tags;
/* This must be done before any call to machine_has_neponset() */
map_sa1100_gpio_regs();
......@@ -174,12 +171,6 @@ fixup_assabet(struct machine_desc *desc, struct param_struct *params,
if (machine_has_neponset())
printk("Neponset expansion board detected\n");
/*
* Apparantly bootldr uses a param_struct. Groan.
*/
if (t->hdr.tag != ATAG_CORE)
convert_to_tag_list(params, 1);
if (t->hdr.tag != ATAG_CORE) {
t->hdr.tag = ATAG_CORE;
t->hdr.size = tag_size(tag_core);
......@@ -319,17 +310,16 @@ static void __init assabet_map_io(void)
sa1100_map_io();
iotable_init(assabet_io_desc);
if (machine_has_neponset()) {
#ifdef CONFIG_ASSABET_NEPONSET
/*
* We map Neponset registers even if it isn't present since
* many drivers will try to probe their stuff (and fail).
* This is still more friendly than a kernel paging request
* crash.
*/
neponset_map_io();
/*
* We map Neponset registers even if it isn't present since
* many drivers will try to probe their stuff (and fail).
* This is still more friendly than a kernel paging request
* crash.
*/
neponset_map_io();
#endif
if (machine_has_neponset()) {
/*
* When Neponset is attached, the first UART should be
* UART3. That's what Angel is doing and many documents
......
......@@ -143,13 +143,6 @@ void badge4_set_5V(unsigned subsystem, int on)
EXPORT_SYMBOL(badge4_set_5V);
static void __init
fixup_badge4(struct machine_desc *desc, struct param_struct *params,
char **cmdline, struct meminfo *mi)
{
/* nothing needed here */
}
static struct map_desc badge4_io_desc[] __initdata = {
/* virtual physical length domain r w c b */
{0xf1000000, 0x08000000, 0x00100000, DOMAIN_IO, 0,1,0,0},/* SRAM bank 1 */
......@@ -170,7 +163,6 @@ static void __init badge4_map_io(void)
MACHINE_START(BADGE4, "Hewlett-Packard Laboratories BadgePAD 4")
BOOT_MEM(0xc0000000, 0x80000000, 0xf8000000)
BOOT_PARAMS(0xc0000100)
FIXUP(fixup_badge4)
MAPIO(badge4_map_io)
INITIRQ(sa1100_init_irq)
MACHINE_END
......@@ -23,7 +23,7 @@
static void __init
fixup_brutus(struct machine_desc *desc, struct param_struct *params,
fixup_brutus(struct machine_desc *desc, struct tag *tags,
char **cmdline, struct meminfo *mi)
{
SET_BANK( 0, 0xc0000000, 4*1024*1024 );
......
......@@ -36,7 +36,7 @@ static void __init cerf_init_irq(void)
}
static void __init
fixup_cerf(struct machine_desc *desc, struct param_struct *params,
fixup_cerf(struct machine_desc *desc, struct tag *tags,
char **cmdline, struct meminfo *mi)
{
#if defined(CONFIG_SA1100_CERF_64MB)
......
......@@ -17,7 +17,7 @@
static void __init
fixup_empeg(struct machine_desc *desc, struct param_struct *params,
fixup_empeg(struct machine_desc *desc, struct tag *tags,
char **cmdline, struct meminfo *mi)
{
SET_BANK( 0, 0xc0000000, 4*1024*1024 );
......
......@@ -152,13 +152,9 @@ __initcall(flexanet_init);
static void __init
fixup_flexanet(struct machine_desc *desc, struct param_struct *params,
fixup_flexanet(struct machine_desc *desc, struct tag *tags,
char **cmdline, struct meminfo *mi)
{
int status;
unsigned long now;
/* fixed RAM size, by now (64MB) */
SET_BANK( 0, 0xc0000000, 64*1024*1024 );
mi->nr_banks = 1;
......
......@@ -52,7 +52,7 @@ static int __init freebird_init(void)
__initcall(freebird_init);
static void __init
fixup_freebird(struct machine_desc *desc, struct param_struct *params,
fixup_freebird(struct machine_desc *desc, struct tag *tags,
char **cmdline, struct meminfo *mi)
{
#ifdef CONFIG_SA1100_FREEBIRD_OLD
......
......@@ -125,7 +125,7 @@ static void __init graphicsclient_init_irq(void)
*/
static void __init
fixup_graphicsclient(struct machine_desc *desc, struct param_struct *params,
fixup_graphicsclient(struct machine_desc *desc, struct tag *tags,
char **cmdline, struct meminfo *mi)
{
SET_BANK( 0, 0xc0000000, 16*1024*1024 );
......
......@@ -157,7 +157,7 @@ static void __init graphicsmaster_init_irq(void)
*/
static void __init
fixup_graphicsmaster(struct machine_desc *desc, struct param_struct *params,
fixup_graphicsmaster(struct machine_desc *desc, struct tag *tags,
char **cmdline, struct meminfo *mi)
{
SET_BANK( 0, 0xc0000000, 16*1024*1024 );
......
......@@ -55,7 +55,7 @@ __initcall(init_huw_cs3);
static void __init
fixup_huw_webpanel(struct machine_desc *desc, struct param_struct *params,
fixup_huw_webpanel(struct machine_desc *desc, struct tag *tags,
char **cmdline, struct meminfo *mi)
{
/**
......
......@@ -40,32 +40,30 @@ static void sa1100_manual_rerun(unsigned int irq)
irq_desc[irq].handle(irq, &irq_desc[irq], &regs);
}
/*
* To get the GPIO number from an IRQ number
*/
#define GPIO_11_27_IRQ(i) ((i) - 21)
#define GPIO11_27_MASK(irq) (1 << GPIO_11_27_IRQ(irq))
static int sa1100_gpio_type(unsigned int irq, unsigned int type)
{
unsigned int mask;
printk(KERN_DEBUG "IRQ%d: ", irq);
if (irq <= 10)
mask = 1 << irq;
else
mask = GPIO11_27_MASK(irq);
if (type & __IRQT_RISEDGE) {
printk("rising ");
GPIO_IRQ_rising_edge |= mask;
} else
GPIO_IRQ_rising_edge &= ~mask;
if (type & __IRQT_FALEDGE) {
printk("falling ");
GPIO_IRQ_falling_edge |= mask;
} else
GPIO_IRQ_falling_edge &= ~mask;
printk("edges\n");
GRER = GPIO_IRQ_rising_edge & GPIO_IRQ_mask;
GFER = GPIO_IRQ_falling_edge & GPIO_IRQ_mask;
......
......@@ -17,7 +17,7 @@
static void __init
fixup_itsy(struct machine_desc *desc, struct param_struct *params,
fixup_itsy(struct machine_desc *desc, struct tag *tags,
char **cmdline, struct meminfo *mi)
{
SET_BANK( 0, 0xc0000000, 16*1024*1024 );
......
......@@ -57,7 +57,7 @@ __initcall(jornada720_init);
static void __init
fixup_jornada720(struct machine_desc *desc, struct param_struct *params,
fixup_jornada720(struct machine_desc *desc, struct tag *tags,
char **cmdline, struct meminfo *mi)
{
SET_BANK( 0, 0xc0000000, 32*1024*1024 );
......
......@@ -17,7 +17,7 @@
static void __init
fixup_nanoengine(struct machine_desc *desc, struct param_struct *params,
fixup_nanoengine(struct machine_desc *desc, struct tag *tags,
char **cmdline, struct meminfo *mi)
{
SET_BANK( 0, 0xc0000000, 32*1024*1024 );
......
......@@ -84,7 +84,7 @@ neponset_irq_handler(unsigned int irq, struct irqdesc *desc, struct pt_regs *reg
}
}
static void __init neponset_init_irq(void)
static inline void __init neponset_init_irq(void)
{
/*
* Install handler for GPIO25.
......@@ -102,6 +102,64 @@ static void __init neponset_init_irq(void)
set_irq_flags(IRQ_NEPONSET_USAR, IRQF_VALID | IRQF_PROBE);
}
static void neponset_set_mctrl(struct uart_port *port, u_int mctrl)
{
u_int mdm_ctl0 = MDM_CTL_0;
if (port->mapbase == _Ser1UTCR0) {
if (mctrl & TIOCM_RTS)
mdm_ctl0 &= ~MDM_CTL0_RTS2;
else
mdm_ctl0 |= MDM_CTL0_RTS2;
if (mctrl & TIOCM_DTR)
mdm_ctl0 &= ~MDM_CTL0_DTR2;
else
mdm_ctl0 |= MDM_CTL0_DTR2;
} else if (port->mapbase == _Ser3UTCR0) {
if (mctrl & TIOCM_RTS)
mdm_ctl0 &= ~MDM_CTL0_RTS1;
else
mdm_ctl0 |= MDM_CTL0_RTS1;
if (mctrl & TIOCM_DTR)
mdm_ctl0 &= ~MDM_CTL0_DTR1;
else
mdm_ctl0 |= MDM_CTL0_DTR1;
}
MDM_CTL_0 = mdm_ctl0;
}
static u_int neponset_get_mctrl(struct uart_port *port)
{
u_int ret = TIOCM_CD | TIOCM_CTS | TIOCM_DSR;
u_int mdm_ctl1 = MDM_CTL_1;
if (port->mapbase == _Ser1UTCR0) {
if (mdm_ctl1 & MDM_CTL1_DCD2)
ret &= ~TIOCM_CD;
if (mdm_ctl1 & MDM_CTL1_CTS2)
ret &= ~TIOCM_CTS;
if (mdm_ctl1 & MDM_CTL1_DSR2)
ret &= ~TIOCM_DSR;
} else if (port->mapbase == _Ser3UTCR0) {
if (mdm_ctl1 & MDM_CTL1_DCD1)
ret &= ~TIOCM_CD;
if (mdm_ctl1 & MDM_CTL1_CTS1)
ret &= ~TIOCM_CTS;
if (mdm_ctl1 & MDM_CTL1_DSR1)
ret &= ~TIOCM_DSR;
}
return ret;
}
static struct sa1100_port_fns neponset_port_fns __initdata = {
set_mctrl: neponset_set_mctrl,
get_mctrl: neponset_get_mctrl,
};
static int __init neponset_init(void)
{
int ret;
......@@ -134,12 +192,14 @@ static int __init neponset_init(void)
if (ret)
return ret;
sa1100_register_uart_fns(&neponset_port_fns);
neponset_init_irq();
/*
* Disable GPIO 0/1 drivers so the buttons work on the module.
*/
NCR_0 |= NCR_GP01_OFF;
NCR_0 = NCR_GP01_OFF;
/*
* Neponset has SA1111 connected to CS4. We know that after
......@@ -162,67 +222,7 @@ static struct map_desc neponset_io_desc[] __initdata = {
LAST_DESC
};
static void neponset_set_mctrl(struct uart_port *port, u_int mctrl)
{
u_int mdm_ctl0 = MDM_CTL_0;
if (port->mapbase == _Ser1UTCR0) {
if (mctrl & TIOCM_RTS)
mdm_ctl0 &= ~MDM_CTL0_RTS2;
else
mdm_ctl0 |= MDM_CTL0_RTS2;
if (mctrl & TIOCM_DTR)
mdm_ctl0 &= ~MDM_CTL0_DTR2;
else
mdm_ctl0 |= MDM_CTL0_DTR2;
} else if (port->mapbase == _Ser3UTCR0) {
if (mctrl & TIOCM_RTS)
mdm_ctl0 &= ~MDM_CTL0_RTS1;
else
mdm_ctl0 |= MDM_CTL0_RTS1;
if (mctrl & TIOCM_DTR)
mdm_ctl0 &= ~MDM_CTL0_DTR1;
else
mdm_ctl0 |= MDM_CTL0_DTR1;
}
MDM_CTL_0 = mdm_ctl0;
}
static u_int neponset_get_mctrl(struct uart_port *port)
{
u_int ret = TIOCM_CD | TIOCM_CTS | TIOCM_DSR;
u_int mdm_ctl1 = MDM_CTL_1;
if (port->mapbase == _Ser1UTCR0) {
if (mdm_ctl1 & MDM_CTL1_DCD2)
ret &= ~TIOCM_CD;
if (mdm_ctl1 & MDM_CTL1_CTS2)
ret &= ~TIOCM_CTS;
if (mdm_ctl1 & MDM_CTL1_DSR2)
ret &= ~TIOCM_DSR;
} else if (port->mapbase == _Ser3UTCR0) {
if (mdm_ctl1 & MDM_CTL1_DCD1)
ret &= ~TIOCM_CD;
if (mdm_ctl1 & MDM_CTL1_CTS1)
ret &= ~TIOCM_CTS;
if (mdm_ctl1 & MDM_CTL1_DSR1)
ret &= ~TIOCM_DSR;
}
return ret;
}
static struct sa1100_port_fns neponset_port_fns __initdata = {
set_mctrl: neponset_set_mctrl,
get_mctrl: neponset_get_mctrl,
};
void __init neponset_map_io(void)
{
iotable_init(neponset_io_desc);
if (machine_has_neponset())
sa1100_register_uart_fns(&neponset_port_fns);
}
......@@ -41,7 +41,7 @@ static int __init omnimeter_init(void)
__initcall(omnimeter_init);
static void __init
fixup_omnimeter(struct machine_desc *desc, struct param_struct *params,
fixup_omnimeter(struct machine_desc *desc, struct tag *tags,
char **cmdline, struct meminfo *mi)
{
SET_BANK( 0, 0xc0000000, 16*1024*1024 );
......
......@@ -17,7 +17,7 @@
static void __init
fixup_pangolin(struct machine_desc *desc, struct param_struct *params,
fixup_pangolin(struct machine_desc *desc, struct tag *tags,
char **cmdline, struct meminfo *mi)
{
SET_BANK( 0, 0xc0000000, 128*1024*1024 );
......
......@@ -57,7 +57,7 @@ static void __init pfs168_init_irq(void)
static void __init
fixup_pfs168(struct machine_desc *desc, struct param_struct *params,
fixup_pfs168(struct machine_desc *desc, struct tag *tags,
char **cmdline, struct meminfo *mi)
{
SET_BANK( 0, 0xc0000000, 16*1024*1024 );
......
......@@ -16,7 +16,7 @@
#include "generic.h"
static void __init
fixup_pleb(struct machine_desc *desc, struct param_struct *params,
fixup_pleb(struct machine_desc *desc, struct tag *tags,
char **cmdline, struct meminfo *mi)
{
SET_BANK(0, 0xc0000000, 16*1024*1024);
......
......@@ -17,7 +17,7 @@
static void __init
fixup_sherman(struct machine_desc *desc, struct param_struct *params,
fixup_sherman(struct machine_desc *desc, struct tag *tags,
char **cmdline, struct meminfo *mi)
{
SET_BANK( 0, 0xc0000000, 64*1024*1024 );
......
......@@ -41,7 +41,7 @@ void clear_cs3_bit(int value)
}
static void __init
fixup_simpad(struct machine_desc *desc, struct param_struct *params,
fixup_simpad(struct machine_desc *desc, struct tag *tags,
char **cmdline, struct meminfo *mi)
{
#ifdef CONFIG_SA1100_SIMPAD_DRAM_64MB /* DRAM */
......
......@@ -74,7 +74,7 @@
/* init funcs */
static void __init fixup_system3(struct machine_desc *desc,
struct param_struct *params, char **cmdline, struct meminfo *mi);
struct tag *tags, char **cmdline, struct meminfo *mi);
static int __init system3_init(void);
static void __init system3_init_irq(void);
static void __init system3_map_io(void);
......@@ -87,8 +87,6 @@ static int sdram_notifier(struct notifier_block *nb, unsigned long event, void *
static void system3_lcd_power(int on);
static void system3_backlight_power(int on);
extern void convert_to_tag_list(struct param_struct *params, int mem_init);
/**********************************************************************
* global data
......@@ -239,7 +237,7 @@ static int sdram_notifier(struct notifier_block *nb, unsigned long event,
*
*/
static void __init fixup_system3(struct machine_desc *desc,
struct param_struct *params, char **cmdline, struct meminfo *mi)
struct tag *tags, char **cmdline, struct meminfo *mi)
{
DPRINTK( "%s\n", "START" );
......
......@@ -42,7 +42,7 @@ __initcall(victor_init);
static void __init
fixup_victor(struct machine_desc *desc, struct param_struct *params,
fixup_victor(struct machine_desc *desc, struct tag *tags,
char **cmdline, struct meminfo *mi)
{
SET_BANK( 0, 0xc0000000, 4*1024*1024 );
......
......@@ -58,7 +58,7 @@ __initcall(xp860_init);
static void __init
fixup_xp860(struct machine_desc *desc, struct param_struct *params,
fixup_xp860(struct machine_desc *desc, struct tag *tags,
char **cmdline, struct meminfo *mi)
{
SET_BANK( 0, 0xc0000000, 32*1024*1024 );
......
......@@ -29,15 +29,21 @@ obj-$(CONFIG_DISCONTIGMEM) += discontig.o
# Select the processor-specific files
p-$(CONFIG_CPU_26) += proc-arm2,3.o
# ARMv3
p-$(CONFIG_CPU_ARM610) += proc-arm6,7.o tlb-v3.o copypage-v3.o
p-$(CONFIG_CPU_ARM710) += proc-arm6,7.o tlb-v3.o copypage-v3.o
p-$(CONFIG_CPU_ARM720T) += proc-arm720.o tlb-v4.o copypage-v4.o abort-lv4t.o
p-$(CONFIG_CPU_ARM920T) += proc-arm920.o tlb-v4wb.o copypage-v4.o abort-ev4t.o
p-$(CONFIG_CPU_ARM922T) += proc-arm922.o tlb-v4wb.o copypage-v4.o abort-ev4t.o
p-$(CONFIG_CPU_ARM926T) += proc-arm926.o tlb-v4wb.o copypage-v4.o abort-ev5ej.o
p-$(CONFIG_CPU_ARM1020) += proc-arm1020.o tlb-v4wb.o copypage-v4.o abort-ev4t.o
p-$(CONFIG_CPU_SA110) += proc-sa110.o tlb-v4wb.o copypage-v4.o copypage-v4mc.o abort-ev4.o minicache.o
p-$(CONFIG_CPU_SA1100) += proc-sa110.o tlb-v4wb.o copypage-v4.o copypage-v4mc.o abort-ev4.o minicache.o
# ARMv4
p-$(CONFIG_CPU_ARM720T) += proc-arm720.o tlb-v4.o copypage-v4wt.o abort-lv4t.o
p-$(CONFIG_CPU_ARM920T) += proc-arm920.o tlb-v4wb.o copypage-v4wb.o abort-ev4t.o
p-$(CONFIG_CPU_ARM922T) += proc-arm922.o tlb-v4wb.o copypage-v4wb.o abort-ev4t.o
p-$(CONFIG_CPU_ARM1020) += proc-arm1020.o tlb-v4wb.o copypage-v4wb.o abort-ev4t.o
p-$(CONFIG_CPU_SA110) += proc-sa110.o tlb-v4wb.o copypage-v4wb.o abort-ev4.o minicache.o
p-$(CONFIG_CPU_SA1100) += proc-sa110.o tlb-v4wb.o copypage-v4mc.o abort-ev4.o minicache.o
# ARMv5
p-$(CONFIG_CPU_ARM926T) += proc-arm926.o tlb-v4wb.o copypage-v4wb.o abort-ev5ej.o
p-$(CONFIG_CPU_XSCALE) += proc-xscale.o tlb-v4wb.o copypage-v5te.o abort-ev4t.o minicache.o
obj-y += $(sort $(p-y))
......
......@@ -52,7 +52,8 @@ void *consistent_alloc(int gfp, size_t size, dma_addr_t *dma_handle)
goto no_page;
*dma_handle = page_to_bus(page);
ret = __ioremap(page_to_phys(page), size, 0);
ret = __ioremap(page_to_pfn(page) << PAGE_SHIFT, size, 0,
PAGE_SIZE << order);
if (!ret)
goto no_remap;
......
......@@ -26,7 +26,7 @@
* instruction. If your processor does not supply this, you have to write your
* own copy_user_page that does the right thing.
*/
ENTRY(v4_copy_user_page)
ENTRY(v4wb_copy_user_page)
stmfd sp!, {r4, lr} @ 2
mov r2, #PAGE_SZ/64 @ 1
ldmia r1!, {r3, r4, ip, lr} @ 4
......@@ -51,7 +51,7 @@ ENTRY(v4_copy_user_page)
*
* Same story as above.
*/
ENTRY(v4_clear_user_page)
ENTRY(v4wb_clear_user_page)
str lr, [sp, #-4]!
mov r1, #PAGE_SZ/64 @ 1
mov r2, #0 @ 1
......@@ -71,7 +71,7 @@ ENTRY(v4_clear_user_page)
.section ".text.init", #alloc, #execinstr
ENTRY(v4_user_fns)
.long v4_clear_user_page
.long v4_copy_user_page
ENTRY(v4wb_user_fns)
.long v4wb_clear_user_page
.long v4wb_copy_user_page
/*
* linux/arch/arm/lib/copypage-v4.S
*
* Copyright (C) 1995-1999 Russell King
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*
* ASM optimised string functions
*
* This is for CPUs with a writethrough cache and 'flush ID cache' is
* the only supported cache operation.
*/
#include <linux/linkage.h>
#include <asm/constants.h>
.text
.align 5
/*
* ARMv4 optimised copy_user_page
*
* Since we have writethrough caches, we don't have to worry about
* dirty data in the cache. However, we do have to ensure that
* subsequent reads are up to date.
*/
ENTRY(v4wt_copy_user_page)
stmfd sp!, {r4, lr} @ 2
mov r2, #PAGE_SZ/64 @ 1
ldmia r1!, {r3, r4, ip, lr} @ 4
1: stmia r0!, {r3, r4, ip, lr} @ 4
ldmia r1!, {r3, r4, ip, lr} @ 4+1
stmia r0!, {r3, r4, ip, lr} @ 4
ldmia r1!, {r3, r4, ip, lr} @ 4
stmia r0!, {r3, r4, ip, lr} @ 4
ldmia r1!, {r3, r4, ip, lr} @ 4
subs r2, r2, #1 @ 1
stmia r0!, {r3, r4, ip, lr} @ 4
ldmneia r1!, {r3, r4, ip, lr} @ 4
bne 1b @ 1
mcr p15, 0, r2, c7, c7, 0 @ flush ID cache
ldmfd sp!, {r4, pc} @ 3
.align 5
/*
* ARMv4 optimised clear_user_page
*
* Same story as above.
*/
ENTRY(v4wt_clear_user_page)
str lr, [sp, #-4]!
mov r1, #PAGE_SZ/64 @ 1
mov r2, #0 @ 1
mov r3, #0 @ 1
mov ip, #0 @ 1
mov lr, #0 @ 1
1: stmia r0!, {r2, r3, ip, lr} @ 4
stmia r0!, {r2, r3, ip, lr} @ 4
stmia r0!, {r2, r3, ip, lr} @ 4
stmia r0!, {r2, r3, ip, lr} @ 4
subs r1, r1, #1 @ 1
bne 1b @ 1
mcr p15, 0, r2, c7, c7, 0 @ flush ID cache
ldr pc, [sp], #4
.section ".text.init", #alloc, #execinstr
ENTRY(v4wt_user_fns)
.long v4wt_clear_user_page
.long v4wt_copy_user_page
......@@ -557,5 +557,5 @@ __arm1020_proc_info:
.long cpu_arm1020_info
.long arm1020_processor_functions
.long v4wbi_tlb_fns
.long v4_user_fns
.long v4wb_user_fns
.size __arm1020_proc_info, . - __arm1020_proc_info
......@@ -261,5 +261,5 @@ __arm720_proc_info:
.long cpu_arm720_info @ info
.long arm720_processor_functions
.long v4_tlb_fns
.long v4_user_fns
.long v4wt_user_fns
.size __arm720_proc_info, . - __arm720_proc_info
......@@ -543,5 +543,5 @@ __arm920_proc_info:
.long cpu_arm920_info
.long arm920_processor_functions
.long v4wbi_tlb_fns
.long v4_user_fns
.long v4wb_user_fns
.size __arm920_proc_info, . - __arm920_proc_info
......@@ -544,5 +544,5 @@ __arm922_proc_info:
.long cpu_arm922_info
.long arm922_processor_functions
.long v4wbi_tlb_fns
.long v4_user_fns
.long v4wb_user_fns
.size __arm922_proc_info, . - __arm922_proc_info
......@@ -542,5 +542,5 @@ __arm926_proc_info:
.long cpu_arm926_info
.long arm926_processor_functions
.long v4wbi_tlb_fns
.long v4_user_fns
.long v4wb_user_fns
.size __arm926_proc_info, . - __arm926_proc_info
......@@ -611,6 +611,7 @@ cpu_elf_name:
.section ".proc.info", #alloc, #execinstr
#ifdef CONFIG_CPU_SA110
.type __sa110_proc_info,#object
__sa110_proc_info:
.long 0x4401a100
......@@ -623,9 +624,11 @@ __sa110_proc_info:
.long cpu_sa110_info
.long sa110_processor_functions
.long v4wb_tlb_fns
.long v4_user_fns
.long v4wb_user_fns
.size __sa110_proc_info, . - __sa110_proc_info
#endif
#ifdef CONFIG_CPU_SA1100
.type __sa1100_proc_info,#object
__sa1100_proc_info:
.long 0x4401a110
......@@ -655,3 +658,4 @@ __sa1110_proc_info:
.long v4wb_tlb_fns
.long v4_mc_user_fns
.size __sa1110_proc_info, . - __sa1110_proc_info
#endif
......@@ -55,14 +55,13 @@ ENTRY(v4_flush_user_tlb_range)
eors r3, ip, r3 @ == mm ?
movne pc, lr @ no, we dont do anything
vma_vm_flags ip, r2
.v4_flush_kern_tlb_range:
bic r0, r0, #0x0ff
bic r0, r0, #0xf00
1: mcr p15, 0, r0, c8, c6, 1 @ invalidate D TLB entry
1: mcr p15, 0, r0, c8, c7, 1 @ invalidate TLB entry
add r0, r0, #PAGE_SZ
cmp r0, r1
blo 1b
tst ip, #VM_EXEC
mcrne p15, 0, r3, c8, c5, 0 @ invalidate I TLB
mov pc, lr
/*
......@@ -80,9 +79,8 @@ ENTRY(v4_flush_user_tlb_page)
teq r2, r3 @ equal
movne pc, lr @ no
vma_vm_flags r2, r1
mcr p15, 0, r0, c8, c6, 1 @ invalidate D TLB entry
tst r2, #VM_EXEC
mcrne p15, 0, r3, c8, c5, 0 @ invalidate I TLB
.v4_flush_kern_tlb_page:
mcr p15, 0, r0, c8, c7, 1 @ invalidate TLB entry
mov pc, lr
/*
......@@ -94,16 +92,8 @@ ENTRY(v4_flush_user_tlb_page)
* - start - virtual address (may not be aligned)
* - end - virtual address (may not be aligned)
*/
.align 5
ENTRY(v4_flush_kern_tlb_range)
bic r0, r0, #0x0ff
bic r0, r0, #0xf00
1: mcr p15, 0, r0, c8, c6, 1 @ invalidate D TLB entry
add r0, r0, #PAGE_SZ
cmp r0, r1
blo 1b
mcr p15, 0, r3, c8, c5, 0 @ invalidate I TLB
mov pc, lr
.globl v4_flush_kern_tlb_range
.equ v4_flush_kern_tlb_range, .v4_flush_kern_tlb_range
/*
......@@ -115,9 +105,8 @@ ENTRY(v4_flush_kern_tlb_range)
*
* - kaddr - Kernel virtual memory address
*/
ENTRY(v4_flush_kern_tlb_page)
mcr p15, 0, r0, c8, c6, 1 @ invalidate D TLB entry
mov pc, lr
.globl v4_flush_kern_tlb_page
.equ v4_flush_kern_tlb_page, .v4_flush_kern_tlb_page
.section ".text.init", #alloc, #execinstr
......
......@@ -8,10 +8,7 @@
#
# Note 2! The CFLAGS definitions are now in the main makefile...
# These assembly files can't be assembld with -traditional, so we
# need another build rule than the one in the toplevel Makefile.
.S.o:
$(CC) $(AFLAGS) -c $< -o $*.o
USE_STANDARD_AS_RULE := true
all: kernel.o head.o
......
......@@ -2,10 +2,12 @@
# Makefile for Etrax-specific library files..
#
.S.o:
$(CC) -D__ASSEMBLY__ $(AFLAGS) -traditional -c $< -o $*.o
USE_STANDARD_AS_RULE := true
L_TARGET = lib.a
EXTRA_AFLAGS := -traditional
obj-y = checksum.o checksumcopy.o string.o usercopy.o memset.o csumcpfruser.o
include $(TOPDIR)/Rules.make
......@@ -7,8 +7,9 @@
#
# Note 2! The CFLAGS definitions are now in the main makefile...
.S.o:
$(CC) $(AFLAGS) -traditional -c -o $*.o $<
USE_STANDARD_AS_RULE := true
EXTRA_AFLAGS := -traditional
OS_TARGET := fpsp.o
......
......@@ -4,8 +4,9 @@
# License. See the file "README.legal" in the main directory of this archive
# for more details.
.S.o:
$(CC) $(AFLAGS) -traditional -c -o $*.o $<
USE_STANDARD_AS_RULE := true
EXTRA_AFLAGS := -traditional
OS_TARGET := ifpsp.o
......
......@@ -7,8 +7,9 @@
#
# Note 2! The CFLAGS definitions are now in the main makefile...
.S.o:
$(CC) $(AFLAGS) -traditional -c $< -o $*.o
USE_STANDARD_AS_RULE := true
EXTRA_AFLAGS := -traditional
ifndef CONFIG_SUN3
all: head.o kernel.o
......
......@@ -2,11 +2,12 @@
# Makefile for m68k-specific library files..
#
.S.o:
$(CC) $(AFLAGS) -traditional -c $< -o $@
USE_STANDARD_AS_RULE := true
L_TARGET = lib.a
EXTRA_AFLAGS := -traditional
obj-y := ashldi3.o ashrdi3.o lshrdi3.o muldi3.o \
checksum.o memcmp.o memcpy.o memset.o semaphore.o
......
......@@ -7,10 +7,12 @@
#
# Note 2! The CFLAGS definitions are now in the main makefile...
.S.o:
$(CC) $(EXTRA_CFLAGS) $(AFLAGS) -traditional -c $< -o $*.o
USE_STANDARD_AS_RULE := true
#EXTRA_CFLAGS=-DFPU_EMU_DEBUG
EXTRA_AFLAGS := -traditional
#EXTRA_AFLAGS += -DFPU_EMU_DEBUG
#EXTRA_CFLAGS += -DFPU_EMU_DEBUG
O_TARGET := mathemu.o
......
#
q#
# Makefile for Linux arch/m68k/sun3 source directory
#
# Note! Dependencies are done automagically by 'make dep', which also
......@@ -7,9 +7,6 @@
#
# Note 2! The CFLAGS definitions are now in the main makefile...
.S.o:
$(CC) $(AFLAGS) -traditional -Wa,-m68020 -c $< -o $*.o
O_TARGET := sun3.o
export-objs := sun3_ksyms.o
......
......@@ -10,10 +10,9 @@
# unless it's something special (ie not a .c file).
#
.S.s:
$(CPP) $(CFLAGS) $< -o $*.s
.S.o:
$(CC) $(CFLAGS) -c $< -o $*.o
USE_STANDARD_AS_RULE := true
EXTRA_AFLAGS := $(CFLAGS)
all: au1000.o
......
......@@ -10,11 +10,6 @@
# unless it's something special (ie not a .c file).
#
.S.s:
$(CPP) $(CFLAGS) $< -o $*.s
.S.o:
$(CC) $(CFLAGS) -c $< -o $*.o
all: pb1000.o
O_TARGET := pb1000.o
......
......@@ -6,11 +6,6 @@
# Copyright (C) 1995, 1998, 2001 by Ralf Baechle
#
.S.s:
$(CPP) $(CFLAGS) $< -o $*.s
.S.o:
$(CC) $(CFLAGS) -c $< -o $*.o
OBJS = milo.o a.out.o
#
......
......@@ -9,10 +9,9 @@
# Note 2! The CFLAGS definitions are now in the main makefile...
#
.S.s:
$(CPP) $(CFLAGS) $< -o $*.s
.S.o:
$(CC) $(CFLAGS) -c $< -o $*.o
USE_STANDARD_AS_RULE := true
EXTRA_AFLAGS := $(CFLAGS)
O_TARGET = ddb5074.a
......
......@@ -9,10 +9,9 @@
# Note 2! The CFLAGS definitions are now in the main makefile...
#
.S.s:
$(CPP) $(CFLAGS) $< -o $*.s
.S.o:
$(CC) $(CFLAGS) -c $< -o $*.o
USE_STANDARD_AS_RULE := true
EXTRA_AFLAGS := $(CFLAGS)
O_TARGET = ddb5476.a
......
......@@ -6,11 +6,6 @@
# unless it's something special (ie not a .c file).
#
.S.s:
$(CPP) $(CFLAGS) $< -o $*.s
.S.o:
$(CC) $(CFLAGS) -c $< -o $*.o
O_TARGET:= ddb5xxx.o
obj-y += irq.o irq_cpu.o nile4.o prom.o pci.o pci_auto.o rtc_ds1386.o
......
......@@ -6,10 +6,9 @@
# unless it's something special (ie not a .c file).
#
.S.s:
$(CPP) $(CFLAGS) $< -o $*.s
.S.o:
$(CC) $(CFLAGS) -c $< -o $*.o
USE_STANDARD_AS_RULE := true
EXTRA_AFLAGS := $(CFLAGS)
O_TARGET:= ddb5477.o
......
......@@ -6,10 +6,7 @@
# unless it's something special (ie not a .c file).
#
.S.s:
$(CPP) $(AFLAGS) $< -o $@
.S.o:
$(CC) $(AFLAGS) -c $< -o $@
USE_STANDARD_AS_RULE := true
O_TARGET := dec.o
......
......@@ -6,11 +6,6 @@
# unless it's something special (ie not a .c file).
#
.S.s:
$(CPP) $(CFLAGS) $< -o $*.s
.S.o:
$(CC) $(CFLAGS) -c $< -o $*.o
netboot: all
mipsel-linux-ld -N -G 0 -T ld.ecoff ../../boot/zImage \
dec_boot.o ramdisk.img -o nbImage
......
......@@ -8,10 +8,9 @@
#
# Note 2! The CFLAGS definitions are now in the main makefile...
.S.s:
$(CPP) $(CFLAGS) $< -o $*.s
.S.o:
$(CC) $(CFLAGS) -c $< -o $*.o
USE_STANDARD_AS_RULE := true
EXTRA_AFLAGS := $(CFLAGS)
OBJS = init.o memory.o cmdline.o identify.o locore.o
......
......@@ -6,11 +6,6 @@
# unless it's something special (ie not a .c file).
#
.S.s:
$(CPP) $(CFLAGS) $< -o $*.s
.S.o:
$(CC) $(CFLAGS) -c $< -o $*.o
O_TARGET:= gt64120.o
obj-y := gt_irq.o pci.o
......
......@@ -6,10 +6,9 @@
# unless it's something special (ie not a .c file).
#
.S.s:
$(CPP) $(CFLAGS) $< -o $*.s
.S.o:
$(CC) $(CFLAGS) -c $< -o $*.o
USE_STANDARD_AS_RULE := true
EXTRA_AFLAGS := $(CFLAGS)
O_TARGET:= momenco_ocelot.o
......
......@@ -10,10 +10,9 @@
# unless it's something special (ie not a .c file).
#
.S.s:
$(CPP) $(CFLAGS) $< -o $*.s
.S.o:
$(CC) $(CFLAGS) -c $< -o $*.o
USE_STANDARD_AS_RULE := true
EXTRA_AFLAGS := $(CFLAGS)
all: it8172.o
......
......@@ -11,11 +11,6 @@
# unless it's something special (ie not a .c file).
#
.S.s:
$(CPP) $(CFLAGS) $< -o $*.s
.S.o:
$(CC) $(CFLAGS) -c $< -o $*.o
all: ivr.o
O_TARGET := ivr.o
......
......@@ -11,11 +11,6 @@
# unless it's something special (ie not a .c file).
#
.S.s:
$(CPP) $(CFLAGS) $< -o $*.s
.S.o:
$(CC) $(CFLAGS) -c $< -o $*.o
all: ite.o
O_TARGET := ite.o
......
......@@ -6,10 +6,9 @@
# unless it's something special (ie not a .c file).
#
.S.s:
$(CPP) $(CFLAGS) $< -o $@
.S.o:
$(CC) $(CFLAGS) -c $< -o $@
USE_STANDARD_AS_RULE := true
EXTRA_AFLAGS := $(CFLAGS)
all: jazz.o
......
......@@ -6,12 +6,9 @@
# unless it's something special (ie not a .c file).
#
.S.s:
$(CPP) $(AFLAGS) $< -o $@
.S.o:
$(CC) $(AFLAGS) -c $< -o $@
USE_STANDARD_AS_RULE := true
EXTRA_AFLAGS = -mips3 -mcpu=r4000
# EXTRA_AFLAGS = -mips3 -mcpu=r4000 # not used?
all: kernel.o head.o init_task.o
......
......@@ -2,13 +2,12 @@
# Makefile for MIPS-specific library files..
#
.S.s:
$(CPP) $(CFLAGS) $< -o $*.s
.S.o:
$(CC) $(CFLAGS) -c $< -o $*.o
USE_STANDARD_AS_RULE := true;
L_TARGET = lib.a
EXTRA_AFLAGS := $(CFLAGS)
obj-y += csum_partial.o csum_partial_copy.o \
rtc-std.o rtc-no.o memcpy.o memset.o \
watch.o strlen_user.o strncpy_user.o \
......
......@@ -6,11 +6,6 @@
# unless it's something special (ie not a .c file).
#
.S.o:
$(CC) $(CFLAGS) -c $< -o $*.o
EXTRA_ASFLAGS = -mips2 -mcpu=r4000
O_TARGET:= fpu_emulator.o
obj-y := cp1emu.o ieee754m.o ieee754d.o ieee754dp.o ieee754sp.o ieee754.o \
......
......@@ -28,11 +28,6 @@
#
# Note 2! The CFLAGS definitions are now in the main makefile...
.S.s:
$(CPP) $(CFLAGS) $< -o $*.s
.S.o:
$(CC) $(CFLAGS) -c $< -o $*.o
all: atlas.o
O_TARGET := atlas.o
......
......@@ -27,10 +27,9 @@
#
# Note 2! The CFLAGS definitions are now in the main makefile...
.S.s:
$(CPP) $(CFLAGS) $< -o $*.s
.S.o:
$(CC) $(CFLAGS) -c $< -o $*.o
USE_STANDARD_AS_RULE := true
EXTRA_AFLAGS := $(CFLAGS)
O_TARGET := mipsboards.o
......
......@@ -28,11 +28,6 @@
#
# Note 2! The CFLAGS definitions are now in the main makefile...
.S.s:
$(CPP) $(CFLAGS) $< -o $*.s
.S.o:
$(CC) $(CFLAGS) -c $< -o $*.o
O_TARGET := malta.o
obj-y := malta_int.o malta_rtc.o malta_setup.o
......
......@@ -6,10 +6,7 @@
# unless it's something special (ie not a .c file).
#
.S.s:
$(CPP) $(AFLAGS) $< -o $@
.S.o:
$(CC) $(AFLAGS) -c $< -o $@
USE_STANDARD_AS_RULE := true
O_TARGET := nino.o
......
......@@ -8,10 +8,9 @@
#
# Note 2! The CFLAGS definitions are now in the main makefile...
.S.s:
$(CPP) $(CFLAGS) $< -o $*.s
.S.o:
$(CC) $(CFLAGS) -c $< -o $*.o
USE_STANDARD_AS_RULE := true
EXTRA_AFLAGS := $(CFLAGS)
O_TARGET := ip22-kern.o
......
......@@ -6,10 +6,9 @@
# unless it's something special (ie not a .c file).
#
.S.s:
$(CPP) $(CFLAGS) $< -o $*.s
.S.o:
$(CC) $(CFLAGS) -c $< -o $*.o
USE_STANDARD_AS_RULE := true
EXTRA_AFLAGS := $(CFLAGS)
all: sni.o int-handler.o
......
......@@ -7,11 +7,6 @@
#
TARGET := $(TOPDIR)/include/asm-$(ARCH)/offset.h
.S.s:
$(CPP) $(CFLAGS) $< -o $*.s
.S.o:
$(CC) $(CFLAGS) -c $< -o $*.o
$(TARGET): offset.h
cmp -s $^ $@ || (cp $^ $(TARGET).new && mv $(TARGET).new $(TARGET))
......@@ -22,7 +17,7 @@ offset.s: offset.c $(TOPDIR)/include/linux/autoconf.h
clean:
rm -f offset.[hs] $(TARGET).new
mrproper:
rm -f offset.[hs] $(TARGET).new
rm -f $(TARGET)
......
......@@ -6,11 +6,6 @@
# Copyright (C) 1995, 1998, 1999 by Ralf Baechle
#
.S.s:
$(CPP) $(CFLAGS) $< -o $*.s
.S.o:
$(CC) $(CFLAGS) -c $< -o $*.o
#
# Some DECstations need all possible sections of an ECOFF executable
#
......
......@@ -6,8 +6,9 @@
# unless it's something special (ie not a .c file).
#
.S.o:
$(CC) $(CFLAGS) $(CFLAGS_$@) -c $< -o $*.o
USE_STANDARD_AS_RULE := true
EXTRA_AFLAGS := $(CFLAGS)
all: kernel.o head.o init_task.o
......@@ -25,7 +26,7 @@ obj-$(CONFIG_MIPS32_COMPAT) += linux32.o scall_o32.o signal32.o ioctl32.o
obj-$(CONFIG_BINFMT_ELF32) += binfmt_elf32.o
obj-$(CONFIG_SMP) += smp.o
CFLAGS_r4k_genex.o := -P
CFLAGS_r4k_tlb_glue.o := -P
AFLAGS_r4k_genex.o := -P
AFLAGS_r4k_tlb_glue.o := -P
include $(TOPDIR)/Rules.make
......@@ -2,10 +2,9 @@
# Makefile for MIPS-specific library files..
#
.S.s:
$(CPP) $(CFLAGS) $< -o $*.s
.S.o:
$(CC) $(CFLAGS) -c $< -o $*.o
USE_STANDARD_AS_RULE := true
EXTRA_AFLAGS := $(CFLAGS)
L_TARGET = lib.a
......
......@@ -6,11 +6,6 @@
# unless it's something special (ie not a .c file).
#
.S.o:
$(CC) $(CFLAGS) -c $< -o $*.o
EXTRA_ASFLAGS = -mips2 -mcpu=r4000
O_TARGET:= fpu_emulator.o
obj-y := cp1emu.o ieee754m.o ieee754d.o ieee754dp.o ieee754sp.o ieee754.o \
......
......@@ -28,11 +28,6 @@
#
# Note 2! The CFLAGS definitions are now in the main makefile...
.S.s:
$(CPP) $(CFLAGS) $< -o $*.s
.S.o:
$(CC) $(CFLAGS) -c $< -o $*.o
all: atlas.o
O_TARGET := atlas.o
......
......@@ -27,10 +27,9 @@
#
# Note 2! The CFLAGS definitions are now in the main makefile...
.S.s:
$(CPP) $(CFLAGS) $< -o $*.s
.S.o:
$(CC) $(CFLAGS) -c $< -o $*.o
USE_STANDARD_AS_RULE := true
EXTRA_AFLAGS := $(CFLAGS)
all: mipsboards.o
......
......@@ -28,11 +28,6 @@
#
# Note 2! The CFLAGS definitions are now in the main makefile...
.S.s:
$(CPP) $(CFLAGS) $< -o $*.s
.S.o:
$(CC) $(CFLAGS) -c $< -o $*.o
all: malta.o
O_TARGET := malta.o
......
......@@ -3,10 +3,9 @@
# under Linux.
#
.S.s:
$(CPP) $(CFLAGS) $< -o $*.s
.S.o:
$(CC) $(CFLAGS) -c $< -o $*.o
USE_STANDARD_AS_RULE := true
EXTRA_AFLAGS := $(CFLAGS)
L_TARGET = ip22.a
......
......@@ -2,10 +2,9 @@
# Makefile for the IP27 specific kernel interface routines under Linux.
#
.S.s:
$(CPP) $(CFLAGS) $< -o $*.s
.S.o:
$(CC) $(CFLAGS) -c $< -o $*.o
USE_STANDARD_AS_RULE := true
EXTRA_AFLAGS := $(CFLAGS)
O_TARGET = ip27.o
......
......@@ -8,10 +8,9 @@
#
# Note 2! The CFLAGS definitions are now in the main makefile...
.S.s:
$(CPP) $(CFLAGS) $< -o $*.s
.S.o:
$(CC) $(CFLAGS) -c $< -o $*.o
USE_STANDARD_AS_RULE := true
EXTRA_AFLAGS := $(CFLAGS)
O_TARGET := ip32-kern.a
......
......@@ -7,11 +7,6 @@
#
TARGET := $(TOPDIR)/include/asm-$(ARCH)/offset.h
.S.s:
$(CPP) $(CFLAGS) $< -o $*.s
.S.o:
$(CC) $(CFLAGS) -c $< -o $*.o
$(TARGET): offset.h
cmp -s $^ $@ || (cp $^ $(TARGET).new && mv $(TARGET).new $(TARGET))
......@@ -22,7 +17,7 @@ offset.s: offset.c $(TOPDIR)/include/linux/autoconf.h
clean:
rm -f offset.[hs] $(TARGET).new
mrproper:
rm -f offset.[hs] $(TARGET).new
rm -f $(TARGET)
......
......@@ -2,12 +2,12 @@
# Makefile for parisc-specific library files..
#
USE_STANDARD_AS_RULE := true
L_TARGET = lib.a
L_OBJS = lusercopy.o bitops.o checksum.o
obj-y := lusercopy.o bitops.o checksum.o
.S.o:
$(CC) -D__ASSEMBLY__ $(AFLAGS) -traditional -c $< -o $*.o
EXTRA_AFLAGS := -traditional
include $(TOPDIR)/Rules.make
......@@ -7,11 +7,6 @@
#
TARGET := $(TOPDIR)/include/asm-$(ARCH)/offset.h
.S.s:
$(CPP) $(CFLAGS) $< -o $*.s
.S.o:
$(CC) $(CFLAGS) -c $< -o $*.o
all: $(TARGET)
$(TARGET): offset.h
......
......@@ -7,14 +7,15 @@
#
# Note 2! The CFLAGS definition is now in the main makefile...
USE_STANDARD_AS_RULE := true
OBJCOPY = $(CROSS_COMPILE)objcopy
O_TARGET :=
include $(TOPDIR)/Rules.make
EXTRA_AFLAGS := -traditional
.S.o:
$(CC) -D__ASSEMBLY__ $(AFLAGS) -traditional -c $< -o $*.o
include $(TOPDIR)/Rules.make
%.lnk: %.o
$(LD) -Ttext 0x0 -o $@ $<
......
......@@ -7,13 +7,14 @@
#
# Note 2! The CFLAGS definitions are now in the main makefile...
.S.o:
$(CC) -D__ASSEMBLY__ $(AFLAGS) -traditional -c $< -o $*.o
USE_STANDARD_AS_RULE := true
all: kernel.o head.o init_task.o
O_TARGET := kernel.o
EXTRA_AFLAGS := -traditional
export-objs := debug.o ebcdic.o irq.o s390_ext.o smp.o s390_ksyms.o
obj-y := entry.o bitmap.o traps.o time.o process.o irq.o \
setup.o sys_s390.o ptrace.o signal.o cpcmd.o ebcdic.o \
......
......@@ -2,16 +2,12 @@
# Makefile for s390-specific library files..
#
ifdef SMP
.S.o:
$(CC) -D__ASSEMBLY__ $(AFLAGS) -traditional -c $< -o $*.o
else
.S.o:
$(CC) -D__ASSEMBLY__ -traditional -c $< -o $*.o
endif
USE_STANDARD_AS_RULE := true
L_TARGET = lib.a
EXTRA_AFLAGS := -traditional
obj-y = checksum.o delay.o memset.o misaligned.o strcmp.o strncpy.o uaccess.o
export-objs += misaligned.o
......
......@@ -7,14 +7,15 @@
#
# Note 2! The CFLAGS definition is now in the main makefile...
USE_STANDARD_AS_RULE := true
OBJCOPY = $(CROSS_COMPILE)objcopy
O_TARGET :=
include $(TOPDIR)/Rules.make
.S.o:
$(CC) -D__ASSEMBLY__ $(AFLAGS) -traditional -c $< -o $*.o
EXTRA_AFLAGS := -traditional
%.lnk: %.o
$(LD) -Ttext 0x0 -o $@ $<
......
......@@ -7,13 +7,14 @@
#
# Note 2! The CFLAGS definitions are now in the main makefile...
.S.o:
$(CC) -D__ASSEMBLY__ $(AFLAGS) -traditional -c $< -o $*.o
USE_STANDARD_AS_RULE := true
all: kernel.o head.o init_task.o
O_TARGET := kernel.o
EXTRA_AFLAGS := -traditional
export-objs := debug.o ebcdic.o irq.o s390_ext.o smp.o s390_ksyms.o \
exec32.o
......
......@@ -2,16 +2,12 @@
# Makefile for s390-specific library files..
#
ifdef SMP
.S.o:
$(CC) -D__ASSEMBLY__ $(AFLAGS) -traditional -c $< -o $*.o
else
.S.o:
$(CC) -D__ASSEMBLY__ -traditional -c $< -o $*.o
endif
USE_STANDARD_AS_RULE := true
L_TARGET = lib.a
EXTRA_AFLAGS := -traditional
obj-y = checksum.o delay.o memset.o misaligned.o strcmp.o strncpy.o uaccess.o
export-objs += misaligned.o
......
......@@ -7,18 +7,16 @@
#
# Note 2! The CFLAGS definitions are now in the main makefile...
SH = $(CONFIG_SHELL)
.S.s:
$(CPP) $(AFLAGS) -ansi $< -o $*.s
USE_STANDARD_AS_RULE := true
.S.o:
$(CC) $(AFLAGS) -ansi -c $< -o $*.o
SH = $(CONFIG_SHELL)
all: kernel.o head.o init_task.o
O_TARGET := kernel.o
EXTRA_AFLAGS := -ansi
export-objs := sparc_ksyms.o
IRQ_OBJS := irq.o sun4m_irq.o sun4c_irq.o sun4d_irq.o
obj-y := entry.o wof.o wuf.o etrap.o rtrap.o traps.o ${IRQ_OBJS} \
......
......@@ -2,14 +2,12 @@
# Makefile for Sparc library files..
#
.S.s:
$(CPP) $(AFLAGS) -ansi -DST_DIV0=0x2 $< -o $*.s
.S.o:
$(CC) $(AFLAGS) -ansi -DST_DIV0=0x2 -c $< -o $*.o
USE_STANDARD_AS_RULE := true
L_TARGET = lib.a
EXTRA_AFLAGS := -ansi -DST_DIV0=0x02
obj-y := mul.o rem.o sdiv.o udiv.o umul.o urem.o ashrdi3.o memcpy.o memset.o \
strlen.o checksum.o blockops.o memscan.o memcmp.o strncmp.o \
strncpy_from_user.o divdi3.o udivdi3.o strlen_user.o \
......
......@@ -7,15 +7,12 @@
#
# Note 2! The CFLAGS definition is now in the main makefile...
USE_STANDARD_AS_RULE := true
O_TARGET := math-emu.o
obj-y := math.o ashldi3.o
.S.s:
$(CPP) $(AFLAGS) -ansi $< -o $*.s
.S.o:
$(CC) $(AFLAGS) -ansi -c $< -o $*.o
EXTRA_AFLAGS := -ansi
EXTRA_CFLAGS = -I. -I$(TOPDIR)/include/math-emu -w
include $(TOPDIR)/Rules.make
......@@ -7,8 +7,8 @@
#
# Note 2! The CFLAGS definition is now in the main makefile...
.S.o:
$(CC) $(AFLAGS) -ansi -c -o $*.o $<
USE_STANDARD_AS_RULE := true
EXTRA_AFLAGS := -ansi
O_TARGET := mm.o
obj-y := fault.o init.o loadmmu.o generic.o extable.o btfixup.o
......
......@@ -6,11 +6,11 @@ O_TARGET := vmlinux-obj.o
# Objects that export symbols.
export-objs := kcapi.o capiutil.o capifs.o
export-objs := kcapi.o capiutil.o capilib.o capifs.o
# Multipart objects.
kernelcapi-objs := kcapi.o capiutil.o
kernelcapi-objs := kcapi.o capiutil.o capilib.o
# Ordering constraints: kernelcapi.o first
......
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/isdn/capilli.h>
#define DBG(format, arg...) do { \
printk(KERN_DEBUG __FUNCTION__ ": " format "\n" , ## arg); \
} while (0)
struct capilib_msgidqueue {
struct capilib_msgidqueue *next;
u16 msgid;
};
struct capilib_ncci {
struct list_head list;
u16 applid;
u32 ncci;
u32 winsize;
int nmsg;
struct capilib_msgidqueue *msgidqueue;
struct capilib_msgidqueue *msgidlast;
struct capilib_msgidqueue *msgidfree;
struct capilib_msgidqueue msgidpool[CAPI_MAXDATAWINDOW];
};
// ---------------------------------------------------------------------------
// NCCI Handling
static inline void mq_init(struct capilib_ncci * np)
{
int i;
np->msgidqueue = 0;
np->msgidlast = 0;
np->nmsg = 0;
memset(np->msgidpool, 0, sizeof(np->msgidpool));
np->msgidfree = &np->msgidpool[0];
for (i = 1; i < np->winsize; i++) {
np->msgidpool[i].next = np->msgidfree;
np->msgidfree = &np->msgidpool[i];
}
}
static inline int mq_enqueue(struct capilib_ncci * np, u16 msgid)
{
struct capilib_msgidqueue *mq;
if ((mq = np->msgidfree) == 0)
return 0;
np->msgidfree = mq->next;
mq->msgid = msgid;
mq->next = 0;
if (np->msgidlast)
np->msgidlast->next = mq;
np->msgidlast = mq;
if (!np->msgidqueue)
np->msgidqueue = mq;
np->nmsg++;
return 1;
}
static inline int mq_dequeue(struct capilib_ncci * np, u16 msgid)
{
struct capilib_msgidqueue **pp;
for (pp = &np->msgidqueue; *pp; pp = &(*pp)->next) {
if ((*pp)->msgid == msgid) {
struct capilib_msgidqueue *mq = *pp;
*pp = mq->next;
if (mq == np->msgidlast)
np->msgidlast = 0;
mq->next = np->msgidfree;
np->msgidfree = mq;
np->nmsg--;
return 1;
}
}
return 0;
}
void capilib_new_ncci(struct list_head *head, u16 applid, u32 ncci, u32 winsize)
{
struct capilib_ncci *np;
np = kmalloc(sizeof(*np), GFP_ATOMIC);
if (!np) {
printk(KERN_WARNING "capilib_new_ncci: no memory.\n");
return;
}
if (winsize > CAPI_MAXDATAWINDOW) {
printk(KERN_ERR "capi_new_ncci: winsize %d too big\n",
winsize);
winsize = CAPI_MAXDATAWINDOW;
}
np->applid = applid;
np->ncci = ncci;
np->winsize = winsize;
mq_init(np);
list_add_tail(&np->list, head);
DBG("kcapi: appl %d ncci 0x%x up", applid, ncci);
}
EXPORT_SYMBOL(capilib_new_ncci);
void capilib_free_ncci(struct list_head *head, u16 applid, u32 ncci)
{
struct list_head *l;
struct capilib_ncci *np;
list_for_each(l, head) {
np = list_entry(l, struct capilib_ncci, list);
if (np->applid != applid)
continue;
if (np->ncci != ncci)
continue;
printk(KERN_INFO "kcapi: appl %d ncci 0x%x down\n", applid, ncci);
list_del(&np->list);
kfree(np);
return;
}
printk(KERN_ERR "capilib_free_ncci: ncci 0x%x not found\n", ncci);
}
EXPORT_SYMBOL(capilib_free_ncci);
void capilib_release_appl(struct list_head *head, u16 applid)
{
struct list_head *l, *n;
struct capilib_ncci *np;
list_for_each_safe(l, n, head) {
np = list_entry(l, struct capilib_ncci, list);
if (np->applid != applid)
continue;
printk(KERN_INFO "kcapi: appl %d ncci 0x%x forced down\n", applid, np->ncci);
list_del(&np->list);
kfree(np);
}
}
EXPORT_SYMBOL(capilib_release_appl);
void capilib_release(struct list_head *head)
{
struct list_head *l, *n;
struct capilib_ncci *np;
list_for_each_safe(l, n, head) {
np = list_entry(l, struct capilib_ncci, list);
printk(KERN_INFO "kcapi: appl %d ncci 0x%x forced down\n", np->applid, np->ncci);
list_del(&np->list);
kfree(np);
}
}
EXPORT_SYMBOL(capilib_release);
u16 capilib_data_b3_req(struct list_head *head, u16 applid, u32 ncci, u16 msgid)
{
struct list_head *l;
struct capilib_ncci *np;
list_for_each(l, head) {
np = list_entry(l, struct capilib_ncci, list);
if (np->applid != applid)
continue;
if (np->ncci != ncci)
continue;
if (mq_enqueue(np, msgid) == 0)
return CAPI_SENDQUEUEFULL;
return CAPI_NOERROR;
}
printk(KERN_ERR "capilib_data_b3_req: ncci 0x%x not found\n", ncci);
return CAPI_NOERROR;
}
EXPORT_SYMBOL(capilib_data_b3_req);
void capilib_data_b3_conf(struct list_head *head, u16 applid, u32 ncci, u16 msgid)
{
struct list_head *l;
struct capilib_ncci *np;
list_for_each(l, head) {
np = list_entry(l, struct capilib_ncci, list);
if (np->applid != applid)
continue;
if (np->ncci != ncci)
continue;
if (mq_dequeue(np, msgid) == 0) {
printk(KERN_ERR "kcapi: msgid %hu ncci 0x%x not on queue\n",
msgid, ncci);
}
return;
}
printk(KERN_ERR "capilib_data_b3_conf: ncci 0x%x not found\n", ncci);
}
EXPORT_SYMBOL(capilib_data_b3_conf);
......@@ -55,23 +55,6 @@ MODULE_PARM(showcapimsgs, "i");
/* ------------------------------------------------------------- */
struct msgidqueue {
struct msgidqueue *next;
u16 msgid;
};
struct capi_ncci {
struct capi_ncci *next;
u16 applid;
u32 ncci;
u32 winsize;
int nmsg;
struct msgidqueue *msgidqueue;
struct msgidqueue *msgidlast;
struct msgidqueue *msgidfree;
struct msgidqueue msgidpool[CAPI_MAXDATAWINDOW];
};
struct capi_appl {
u16 applid;
capi_register_params rparam;
......@@ -245,45 +228,6 @@ static int proc_applications_read_proc(char *page, char **start, off_t off,
return len;
}
/*
* /proc/capi/ncci:
* applid ncci winsize nblk
*/
static int proc_ncci_read_proc(char *page, char **start, off_t off,
int count, int *eof, void *data)
{
struct capi_appl *ap;
struct capi_ncci *np;
int i;
int len = 0;
for (i=1; i <= CAPI_MAXAPPL; i++) {
ap = get_capi_appl_by_nr(i);
if (!ap) continue;
for (np = ap->nccilist; np; np = np->next) {
len += sprintf(page+len, "%d 0x%x %d %d\n",
np->applid,
np->ncci,
np->winsize,
np->nmsg);
if (len <= off) {
off -= len;
len = 0;
} else {
if (len-off > count)
goto endloop;
}
}
}
endloop:
*start = page+off;
if (len < count)
*eof = 1;
if (len>count) len = count;
if (len<0) len = 0;
return len;
}
/*
* /proc/capi/driver:
* driver ncontroller
......@@ -477,7 +421,6 @@ static struct procfsentries {
} procfsentries[] = {
{ "capi", S_IFDIR, 0 },
{ "capi/applications", 0 , proc_applications_read_proc },
{ "capi/ncci", 0 , proc_ncci_read_proc },
{ "capi/driver", 0 , proc_driver_read_proc },
{ "capi/users", 0 , proc_users_read_proc },
{ "capi/controller", 0 , proc_controller_read_proc },
......@@ -525,26 +468,9 @@ static void register_appl(struct capi_ctr *card, u16 applid, capi_register_param
static void release_appl(struct capi_ctr *card, u16 applid)
{
struct capi_appl *ap = get_capi_appl_by_nr(applid);
struct capi_ncci **pp, **nextpp;
DBG("");
DBG("applid %#x", applid);
for (pp = &ap->nccilist; *pp; pp = nextpp) {
if (NCCI2CTRL((*pp)->ncci) == card->cnr) {
struct capi_ncci *np = *pp;
*pp = np->next;
printk(KERN_INFO "kcapi: appl %d ncci 0x%x down!\n", applid, np->ncci);
kfree(np);
ap->nncci--;
nextpp = pp;
} else {
nextpp = &(*pp)->next;
}
}
card->driver->release_appl(card, applid);
capi_ctr_put(card);
}
......@@ -679,130 +605,12 @@ static void notify_handler(void *dummy)
MOD_DEC_USE_COUNT;
}
/* -------- NCCI Handling ------------------------------------- */
static inline void mq_init(struct capi_ncci * np)
{
int i;
np->msgidqueue = 0;
np->msgidlast = 0;
np->nmsg = 0;
memset(np->msgidpool, 0, sizeof(np->msgidpool));
np->msgidfree = &np->msgidpool[0];
for (i = 1; i < np->winsize; i++) {
np->msgidpool[i].next = np->msgidfree;
np->msgidfree = &np->msgidpool[i];
}
}
static inline int mq_enqueue(struct capi_ncci * np, u16 msgid)
{
struct msgidqueue *mq;
if ((mq = np->msgidfree) == 0)
return 0;
np->msgidfree = mq->next;
mq->msgid = msgid;
mq->next = 0;
if (np->msgidlast)
np->msgidlast->next = mq;
np->msgidlast = mq;
if (!np->msgidqueue)
np->msgidqueue = mq;
np->nmsg++;
return 1;
}
static inline int mq_dequeue(struct capi_ncci * np, u16 msgid)
{
struct msgidqueue **pp;
for (pp = &np->msgidqueue; *pp; pp = &(*pp)->next) {
if ((*pp)->msgid == msgid) {
struct msgidqueue *mq = *pp;
*pp = mq->next;
if (mq == np->msgidlast)
np->msgidlast = 0;
mq->next = np->msgidfree;
np->msgidfree = mq;
np->nmsg--;
return 1;
}
}
return 0;
}
/*
* ncci management
*/
static void controllercb_new_ncci(struct capi_ctr * card,
u16 appl, u32 ncci, u32 winsize)
{
struct capi_ncci *np;
struct capi_appl *ap = get_capi_appl_by_nr(appl);
if (!ap) {
printk(KERN_ERR "avmb1_handle_new_ncci: illegal appl %d\n", appl);
return;
}
if ((np = (struct capi_ncci *) kmalloc(sizeof(struct capi_ncci), GFP_ATOMIC)) == 0) {
printk(KERN_ERR "capi_new_ncci: alloc failed ncci 0x%x\n", ncci);
return;
}
if (winsize > CAPI_MAXDATAWINDOW) {
printk(KERN_ERR "capi_new_ncci: winsize %d too big, set to %d\n",
winsize, CAPI_MAXDATAWINDOW);
winsize = CAPI_MAXDATAWINDOW;
}
np->applid = appl;
np->ncci = ncci;
np->winsize = winsize;
mq_init(np);
np->next = ap->nccilist;
ap->nccilist = np;
ap->nncci++;
printk(KERN_INFO "kcapi: appl %d ncci 0x%x up\n", appl, ncci);
}
static void controllercb_free_ncci(struct capi_ctr * card,
u16 appl, u32 ncci)
{
struct capi_ncci **pp;
struct capi_appl *ap = get_capi_appl_by_nr(appl);
if (!ap) {
printk(KERN_ERR "free_ncci: illegal appl %d\n", appl);
return;
}
for (pp = &ap->nccilist; *pp; pp = &(*pp)->next) {
if ((*pp)->ncci == ncci) {
struct capi_ncci *np = *pp;
*pp = np->next;
kfree(np);
ap->nncci--;
printk(KERN_INFO "kcapi: appl %d ncci 0x%x down\n", appl, ncci);
return;
}
}
printk(KERN_ERR "free_ncci: ncci 0x%x not found\n", ncci);
}
static struct capi_ncci *find_ncci(struct capi_appl * app, u32 ncci)
{
struct capi_ncci *np;
for (np = app->nccilist; np; np = np->next) {
if (np->ncci == ncci)
return np;
}
return 0;
}
/* -------- Receiver ------------------------------------------ */
static void recv_handler(void *dummy)
{
struct sk_buff *skb;
struct capi_appl *ap;
struct capi_ncci *np;
while ((skb = skb_dequeue(&recv_queue)) != 0) {
ap = get_capi_appl_by_nr(CAPIMSG_APPID(skb->data));
......@@ -818,13 +626,6 @@ static void recv_handler(void *dummy)
kfree_skb(skb);
continue;
}
if ( CAPIMSG_COMMAND(skb->data) == CAPI_DATA_B3
&& CAPIMSG_SUBCOMMAND(skb->data) == CAPI_CONF
&& (np = find_ncci(ap, CAPIMSG_NCCI(skb->data))) != 0
&& mq_dequeue(np, CAPIMSG_MSGID(skb->data)) == 0) {
printk(KERN_ERR "kcapi: msgid %hu ncci 0x%x not on queue\n",
CAPIMSG_MSGID(skb->data), np->ncci);
}
if ( CAPIMSG_COMMAND(skb->data) == CAPI_DATA_B3
&& CAPIMSG_SUBCOMMAND(skb->data) == CAPI_IND) {
ap->nrecvdatapkt++;
......@@ -917,22 +718,9 @@ static void controllercb_reseted(struct capi_ctr * card)
for (appl = 1; appl <= CAPI_MAXAPPL; appl++) {
struct capi_appl *ap = get_capi_appl_by_nr(appl);
struct capi_ncci **pp, **nextpp;
if (!ap)
continue;
for (pp = &ap->nccilist; *pp; pp = nextpp) {
if (NCCI2CTRL((*pp)->ncci) == card->cnr) {
struct capi_ncci *np = *pp;
*pp = np->next;
printk(KERN_INFO "kcapi: appl %d ncci 0x%x forced down!\n", appl, np->ncci);
kfree(np);
nextpp = pp;
} else {
nextpp = &(*pp)->next;
}
}
capi_ctr_put(card);
}
......@@ -993,8 +781,6 @@ attach_capi_ctr(struct capi_driver *driver, char *name, void *driverdata)
card->suspend_output = controllercb_suspend_output;
card->resume_output = controllercb_resume_output;
card->handle_capimsg = controllercb_handle_capimsg;
card->new_ncci = controllercb_new_ncci;
card->free_ncci = controllercb_free_ncci;
list_add_tail(&card->driver_list, &driver->contr_head);
driver->ncontroller++;
......@@ -1185,7 +971,6 @@ static u16 capi_put_message(u16 applid, struct sk_buff *skb)
{
struct capi_ctr *card;
struct capi_appl *ap;
struct capi_ncci *np;
int showctl = 0;
u8 cmd, subcmd;
......@@ -1213,9 +998,6 @@ static u16 capi_put_message(u16 applid, struct sk_buff *skb)
subcmd = CAPIMSG_SUBCOMMAND(skb->data);
if (cmd == CAPI_DATA_B3 && subcmd== CAPI_REQ) {
if ((np = find_ncci(ap, CAPIMSG_NCCI(skb->data))) != 0
&& mq_enqueue(np, CAPIMSG_MSGID(skb->data)) == 0)
return CAPI_SENDQUEUEFULL;
card->nsentdatapkt++;
ap->nsentdatapkt++;
if (card->traceflag > 2) showctl |= 2;
......@@ -1239,8 +1021,7 @@ static u16 capi_put_message(u16 applid, struct sk_buff *skb)
}
}
card->driver->send_message(card, skb);
return CAPI_NOERROR;
return card->driver->send_message(card, skb);
}
static u16 capi_get_message(u16 applid, struct sk_buff **msgp)
......@@ -1354,54 +1135,13 @@ static struct capi_driver *find_driver(char *name)
static int old_capi_manufacturer(unsigned int cmd, void *data)
{
avmb1_loadandconfigdef ldef;
avmb1_extcarddef cdef;
avmb1_resetdef rdef;
avmb1_getdef gdef;
struct capi_driver *driver;
struct capi_ctr *card;
capicardparams cparams;
capiloaddata ldata;
int retval;
switch (cmd) {
case AVMB1_ADDCARD:
case AVMB1_ADDCARD_WITH_TYPE:
if (cmd == AVMB1_ADDCARD) {
if ((retval = copy_from_user((void *) &cdef, data,
sizeof(avmb1_carddef))))
return retval;
cdef.cardtype = AVM_CARDTYPE_B1;
} else {
if ((retval = copy_from_user((void *) &cdef, data,
sizeof(avmb1_extcarddef))))
return retval;
}
cparams.port = cdef.port;
cparams.irq = cdef.irq;
cparams.cardnr = cdef.cardnr;
switch (cdef.cardtype) {
case AVM_CARDTYPE_B1:
driver = find_driver("b1isa");
break;
case AVM_CARDTYPE_T1:
driver = find_driver("t1isa");
break;
default:
driver = 0;
break;
}
if (!driver) {
printk(KERN_ERR "kcapi: driver not loaded.\n");
return -EIO;
}
if (!driver->add_card) {
printk(KERN_ERR "kcapi: driver has no add card function.\n");
return -EIO;
}
return driver->add_card(driver, &cparams);
case AVMB1_LOAD:
case AVMB1_LOAD_AND_CONFIG:
......@@ -1417,6 +1157,7 @@ static int old_capi_manufacturer(unsigned int cmd, void *data)
return retval;
}
card = get_capi_ctr_by_nr(ldef.contr);
card = capi_ctr_get(card);
if (!card)
return -ESRCH;
if (card->driver->load_firmware == 0) {
......@@ -1450,6 +1191,7 @@ static int old_capi_manufacturer(unsigned int cmd, void *data)
if (retval) {
card->cardstate = CARD_DETECTED;
capi_ctr_put(card);
return retval;
}
......@@ -1458,9 +1200,12 @@ static int old_capi_manufacturer(unsigned int cmd, void *data)
set_current_state(TASK_INTERRUPTIBLE);
schedule_timeout(HZ/10); /* 0.1 sec */
if (signal_pending(current))
if (signal_pending(current)) {
capi_ctr_put(card);
return -EINTR;
}
}
capi_ctr_put(card);
return 0;
case AVMB1_RESETCARD:
......@@ -1505,30 +1250,6 @@ static int old_capi_manufacturer(unsigned int cmd, void *data)
return retval;
return 0;
case AVMB1_REMOVECARD:
if ((retval = copy_from_user((void *) &rdef, data,
sizeof(avmb1_resetdef))))
return retval;
card = get_capi_ctr_by_nr(rdef.contr);
if (!card)
return -ESRCH;
if (card->cardstate != CARD_DETECTED)
return -EBUSY;
card->driver->remove_ctr(card);
while (cards[rdef.contr]) {
set_current_state(TASK_INTERRUPTIBLE);
schedule_timeout(HZ/10); /* 0.1 sec */
if (signal_pending(current))
return -EINTR;
}
return 0;
}
return -EINVAL;
}
......@@ -1541,8 +1262,6 @@ static int capi_manufacturer(unsigned int cmd, void *data)
switch (cmd) {
#ifdef CONFIG_AVMB1_COMPAT
case AVMB1_ADDCARD:
case AVMB1_ADDCARD_WITH_TYPE:
case AVMB1_LOAD:
case AVMB1_LOAD_AND_CONFIG:
case AVMB1_RESETCARD:
......@@ -1568,37 +1287,6 @@ static int capi_manufacturer(unsigned int cmd, void *data)
return 0;
}
case KCAPI_CMD_ADDCARD:
{
struct capi_driver *driver;
capicardparams cparams;
kcapi_carddef cdef;
if ((retval = copy_from_user((void *) &cdef, data,
sizeof(cdef))))
return retval;
cparams.port = cdef.port;
cparams.irq = cdef.irq;
cparams.membase = cdef.membase;
cparams.cardnr = cdef.cardnr;
cparams.cardtype = 0;
cdef.driver[sizeof(cdef.driver)-1] = 0;
if ((driver = find_driver(cdef.driver)) == 0) {
printk(KERN_ERR "kcapi: driver \"%s\" not loaded.\n",
cdef.driver);
return -ESRCH;
}
if (!driver->add_card) {
printk(KERN_ERR "kcapi: driver \"%s\" has no add card function.\n", cdef.driver);
return -EIO;
}
return driver->add_card(driver, &cparams);
}
default:
printk(KERN_ERR "kcapi: manufacturer command %d unknown.\n",
cmd);
......
......@@ -69,6 +69,7 @@ typedef struct avmctrl_info {
struct avmcard *card;
struct capi_ctr *capi_ctrl;
struct list_head ncci_head;
} avmctrl_info;
typedef struct avmcard {
......@@ -536,6 +537,7 @@ static inline void b1_setinterrupt(unsigned int base, unsigned irq,
}
/* b1.c */
void b1_set_revision(struct capi_driver *driver, char *rev);
avmcard *b1_alloc_card(int nr_controllers);
void b1_free_card(avmcard *card);
int b1_detect(unsigned int base, enum avmcardtype cardtype);
......@@ -549,7 +551,7 @@ void b1_reset_ctr(struct capi_ctr *ctrl);
void b1_register_appl(struct capi_ctr *ctrl, u16 appl,
capi_register_params *rp);
void b1_release_appl(struct capi_ctr *ctrl, u16 appl);
void b1_send_message(struct capi_ctr *ctrl, struct sk_buff *skb);
u16 b1_send_message(struct capi_ctr *ctrl, struct sk_buff *skb);
void b1_parse_version(avmctrl_info *card);
void b1_interrupt(int interrupt, void *devptr, struct pt_regs *regs);
......@@ -560,7 +562,6 @@ avmcard_dmainfo *avmcard_dma_alloc(char *name, struct pci_dev *,
long rsize, long ssize);
void avmcard_dma_free(avmcard_dmainfo *);
/* b1dma.c */
int b1pciv4_detect(avmcard *card);
int t1pci_detect(avmcard *card);
......@@ -574,7 +575,7 @@ void b1dma_register_appl(struct capi_ctr *ctrl,
u16 appl,
capi_register_params *rp);
void b1dma_release_appl(struct capi_ctr *ctrl, u16 appl);
void b1dma_send_message(struct capi_ctr *ctrl, struct sk_buff *skb);
u16 b1dma_send_message(struct capi_ctr *ctrl, struct sk_buff *skb);
int b1dmactl_read_proc(char *page, char **start, off_t off,
int count, int *eof, struct capi_ctr *ctrl);
......
......@@ -59,6 +59,21 @@ int b1_irq_table[16] =
/* ------------------------------------------------------------- */
void b1_set_revision(struct capi_driver *driver, char *rev)
{
char *p;
if ((p = strchr(rev, ':')) != 0 && p[1]) {
strncpy(driver->revision, p + 2, sizeof(driver->revision));
driver->revision[sizeof(driver->revision)-1] = 0;
if ((p = strchr(driver->revision, '$')) != 0 && p > driver->revision)
*(p-1) = 0;
}
printk(KERN_INFO "%s: revision %s\n", driver->name, driver->revision);
}
/* ------------------------------------------------------------- */
avmcard *b1_alloc_card(int nr_controllers)
{
avmcard *card;
......@@ -80,6 +95,7 @@ avmcard *b1_alloc_card(int nr_controllers)
card->ctrlinfo = cinfo;
for (i = 0; i < nr_controllers; i++) {
INIT_LIST_HEAD(&cinfo[i].ncci_head);
cinfo[i].card = card;
}
spin_lock_init(&card->lock);
......@@ -331,6 +347,7 @@ void b1_reset_ctr(struct capi_ctr *ctrl)
b1_reset(port);
memset(cinfo->version, 0, sizeof(cinfo->version));
capilib_release(&cinfo->ncci_head);
ctrl->reseted(ctrl);
}
......@@ -366,6 +383,8 @@ void b1_release_appl(struct capi_ctr *ctrl, u16 appl)
unsigned int port = card->port;
unsigned long flags;
capilib_release_appl(&cinfo->ncci_head, appl);
save_flags(flags);
cli();
b1_put_byte(port, SEND_RELEASE);
......@@ -373,7 +392,7 @@ void b1_release_appl(struct capi_ctr *ctrl, u16 appl)
restore_flags(flags);
}
void b1_send_message(struct capi_ctr *ctrl, struct sk_buff *skb)
u16 b1_send_message(struct capi_ctr *ctrl, struct sk_buff *skb)
{
avmctrl_info *cinfo = (avmctrl_info *)(ctrl->driverdata);
avmcard *card = cinfo->card;
......@@ -382,20 +401,36 @@ void b1_send_message(struct capi_ctr *ctrl, struct sk_buff *skb)
u16 len = CAPIMSG_LEN(skb->data);
u8 cmd = CAPIMSG_COMMAND(skb->data);
u8 subcmd = CAPIMSG_SUBCOMMAND(skb->data);
u16 dlen, retval;
save_flags(flags);
cli();
if (CAPICMD(cmd, subcmd) == CAPI_DATA_B3_REQ) {
u16 dlen = CAPIMSG_DATALEN(skb->data);
retval = capilib_data_b3_req(&cinfo->ncci_head,
CAPIMSG_APPID(skb->data),
CAPIMSG_NCCI(skb->data),
CAPIMSG_MSGID(skb->data));
if (retval != CAPI_NOERROR)
goto out;
dlen = CAPIMSG_DATALEN(skb->data);
save_flags(flags);
cli();
b1_put_byte(port, SEND_DATA_B3_REQ);
b1_put_slice(port, skb->data, len);
b1_put_slice(port, skb->data + len, dlen);
restore_flags(flags);
} else {
retval = CAPI_NOERROR;
save_flags(flags);
cli();
b1_put_byte(port, SEND_MESSAGE);
b1_put_slice(port, skb->data, len);
restore_flags(flags);
}
restore_flags(flags);
out:
dev_kfree_skb_any(skb);
return retval;
}
/* ------------------------------------------------------------- */
......@@ -525,6 +560,11 @@ void b1_interrupt(int interrupt, void *devptr, struct pt_regs *regs)
card->name);
} else {
memcpy(skb_put(skb, MsgLen), card->msgbuf, MsgLen);
if (CAPIMSG_CMD(skb->data) == CAPI_DATA_B3_CONF)
capilib_data_b3_conf(&cinfo->ncci_head, ApplId,
CAPIMSG_NCCI(skb->data),
CAPIMSG_MSGID(skb->data));
ctrl->handle_capimsg(ctrl, ApplId, skb);
}
break;
......@@ -535,7 +575,7 @@ void b1_interrupt(int interrupt, void *devptr, struct pt_regs *regs)
NCCI = b1_get_word(card->port);
WindowSize = b1_get_word(card->port);
ctrl->new_ncci(ctrl, ApplId, NCCI, WindowSize);
capilib_new_ncci(&cinfo->ncci_head, ApplId, NCCI, WindowSize);
break;
......@@ -545,8 +585,8 @@ void b1_interrupt(int interrupt, void *devptr, struct pt_regs *regs)
NCCI = b1_get_word(card->port);
if (NCCI != 0xffffffff)
ctrl->free_ncci(ctrl, ApplId, NCCI);
capilib_free_ncci(&cinfo->ncci_head, ApplId, NCCI);
break;
case RECEIVE_START:
......@@ -738,6 +778,7 @@ EXPORT_SYMBOL(avmcard_dma_free);
EXPORT_SYMBOL(b1_irq_table);
EXPORT_SYMBOL(b1_set_revision);
EXPORT_SYMBOL(b1_alloc_card);
EXPORT_SYMBOL(b1_free_card);
EXPORT_SYMBOL(b1_detect);
......
......@@ -488,6 +488,11 @@ static void b1dma_handle_rx(avmcard *card)
card->name);
} else {
memcpy(skb_put(skb, MsgLen), card->msgbuf, MsgLen);
if (CAPIMSG_CMD(skb->data) == CAPI_DATA_B3_CONF)
capilib_data_b3_conf(&cinfo->ncci_head, ApplId,
CAPIMSG_NCCI(skb->data),
CAPIMSG_MSGID(skb->data));
ctrl->handle_capimsg(ctrl, ApplId, skb);
}
break;
......@@ -498,7 +503,7 @@ static void b1dma_handle_rx(avmcard *card)
NCCI = _get_word(&p);
WindowSize = _get_word(&p);
ctrl->new_ncci(ctrl, ApplId, NCCI, WindowSize);
capilib_new_ncci(&cinfo->ncci_head, ApplId, NCCI, WindowSize);
break;
......@@ -508,7 +513,7 @@ static void b1dma_handle_rx(avmcard *card)
NCCI = _get_word(&p);
if (NCCI != 0xffffffff)
ctrl->free_ncci(ctrl, ApplId, NCCI);
capilib_free_ncci(&cinfo->ncci_head, ApplId, NCCI);
break;
......@@ -734,6 +739,7 @@ void b1dma_reset_ctr(struct capi_ctr *ctrl)
b1dma_reset(card);
memset(cinfo->version, 0, sizeof(cinfo->version));
capilib_release(&cinfo->ncci_head);
ctrl->reseted(ctrl);
}
......@@ -785,6 +791,8 @@ void b1dma_release_appl(struct capi_ctr *ctrl, u16 appl)
struct sk_buff *skb;
void *p;
capilib_release_appl(&cinfo->ncci_head, appl);
skb = alloc_skb(7, GFP_ATOMIC);
if (!skb) {
printk(KERN_CRIT "%s: no memory, lost release appl.\n",
......@@ -804,12 +812,24 @@ void b1dma_release_appl(struct capi_ctr *ctrl, u16 appl)
/* ------------------------------------------------------------- */
void b1dma_send_message(struct capi_ctr *ctrl, struct sk_buff *skb)
u16 b1dma_send_message(struct capi_ctr *ctrl, struct sk_buff *skb)
{
avmctrl_info *cinfo = (avmctrl_info *)(ctrl->driverdata);
avmcard *card = cinfo->card;
u16 retval = CAPI_NOERROR;
b1dma_queue_tx(card, skb);
if (CAPIMSG_CMD(skb->data) == CAPI_DATA_B3_REQ) {
retval = capilib_data_b3_req(&cinfo->ncci_head,
CAPIMSG_APPID(skb->data),
CAPIMSG_NCCI(skb->data),
CAPIMSG_MSGID(skb->data));
}
if (retval == CAPI_NOERROR)
b1dma_queue_tx(card, skb);
else
dev_kfree_skb_any(skb);
return retval;
}
/* ------------------------------------------------------------- */
......
......@@ -18,6 +18,7 @@
#include <linux/ioport.h>
#include <linux/capi.h>
#include <linux/init.h>
#include <linux/pci.h>
#include <asm/io.h>
#include <linux/isdn/capicmd.h>
#include <linux/isdn/capiutil.h>
......@@ -34,33 +35,31 @@ MODULE_LICENSE("GPL");
/* ------------------------------------------------------------- */
static void b1isa_remove_ctr(struct capi_ctr *ctrl)
static struct capi_driver b1isa_driver;
static void b1isa_remove(struct pci_dev *pdev)
{
avmctrl_info *cinfo = (avmctrl_info *)(ctrl->driverdata);
avmctrl_info *cinfo = pci_get_drvdata(pdev);
avmcard *card = cinfo->card;
unsigned int port = card->port;
unsigned int port = cinfo->card->port;
b1_reset(port);
b1_reset(port);
detach_capi_ctr(ctrl);
detach_capi_ctr(cinfo->capi_ctrl);
free_irq(card->irq, card);
release_region(card->port, AVMB1_PORTLEN);
b1_free_card(card);
MOD_DEC_USE_COUNT;
}
/* ------------------------------------------------------------- */
static int b1isa_add_card(struct capi_driver *driver, struct capicardparams *p)
static int __init b1isa_probe(struct pci_dev *pdev)
{
avmctrl_info *cinfo;
avmcard *card;
int retval;
MOD_INC_USE_COUNT;
card = b1_alloc_card(1);
if (!card) {
printk(KERN_WARNING "b1isa: no memory.\n");
......@@ -70,10 +69,10 @@ static int b1isa_add_card(struct capi_driver *driver, struct capicardparams *p)
cinfo = card->ctrlinfo;
sprintf(card->name, "b1isa-%x", p->port);
card->port = p->port;
card->irq = p->irq;
card->port = pci_resource_start(pdev, 0);
card->irq = pdev->irq;
card->cardtype = avm_b1isa;
sprintf(card->name, "b1isa-%x", card->port);
if ( card->port != 0x150 && card->port != 0x250
&& card->port != 0x300 && card->port != 0x340) {
......@@ -107,7 +106,7 @@ static int b1isa_add_card(struct capi_driver *driver, struct capicardparams *p)
b1_reset(card->port);
b1_getrevision(card);
cinfo->capi_ctrl = attach_capi_ctr(driver, card->name, cinfo);
cinfo->capi_ctrl = attach_capi_ctr(&b1isa_driver, card->name, cinfo);
if (!cinfo->capi_ctrl) {
printk(KERN_ERR "b1isa: attach controller failed.\n");
retval = -EBUSY;
......@@ -116,8 +115,9 @@ static int b1isa_add_card(struct capi_driver *driver, struct capicardparams *p)
printk(KERN_INFO
"%s: AVM B1 ISA at i/o %#x, irq %d, revision %d\n",
driver->name, card->port, card->irq, card->revision);
b1isa_driver.name, card->port, card->irq, card->revision);
pci_set_drvdata(pdev, cinfo);
return 0;
err_free_irq:
......@@ -127,7 +127,6 @@ static int b1isa_add_card(struct capi_driver *driver, struct capicardparams *p)
err_free:
b1_free_card(card);
err:
MOD_DEC_USE_COUNT;
return retval;
}
......@@ -155,7 +154,6 @@ static struct capi_driver b1isa_driver = {
revision: "0.0",
load_firmware: b1_load_firmware,
reset_ctr: b1_reset_ctr,
remove_ctr: b1isa_remove_ctr,
register_appl: b1_register_appl,
release_appl: b1_release_appl,
send_message: b1_send_message,
......@@ -163,34 +161,63 @@ static struct capi_driver b1isa_driver = {
procinfo: b1isa_procinfo,
ctr_read_proc: b1ctl_read_proc,
driver_read_proc: 0, /* use standard driver_read_proc */
add_card: b1isa_add_card,
};
#define MAX_CARDS 4
static struct pci_dev isa_dev[MAX_CARDS];
static int io[MAX_CARDS];
static int irq[MAX_CARDS];
MODULE_PARM(io, "1-" __MODULE_STRING(MAX_CARDS) "i");
MODULE_PARM(irq, "1-" __MODULE_STRING(MAX_CARDS) "i");
MODULE_PARM_DESC(io, "I/O base address(es)");
MODULE_PARM_DESC(irq, "IRQ number(s) (assigned)");
static int __init b1isa_init(void)
{
struct capi_driver *driver = &b1isa_driver;
char *p;
int i, retval;
int found = 0;
MOD_INC_USE_COUNT;
if ((p = strchr(revision, ':')) != 0 && p[1]) {
strncpy(driver->revision, p + 2, sizeof(driver->revision));
driver->revision[sizeof(driver->revision)-1] = 0;
if ((p = strchr(driver->revision, '$')) != 0 && p > driver->revision)
*(p-1) = 0;
}
b1_set_revision(&b1isa_driver, revision);
attach_capi_driver(&b1isa_driver);
for (i = 0; i < MAX_CARDS; i++) {
if (!io[i])
break;
printk(KERN_INFO "%s: revision %s\n", driver->name, driver->revision);
isa_dev[i].resource[0].start = io[i];
isa_dev[i].irq_resource[0].start = irq[i];
attach_capi_driver(driver);
if (b1isa_probe(&isa_dev[i]) == 0)
found++;
}
if (found == 0) {
retval = -ENODEV;
goto err;
}
retval = 0;
goto out;
err:
detach_capi_driver(&b1isa_driver);
out:
MOD_DEC_USE_COUNT;
return 0;
return retval;
}
static void __exit b1isa_exit(void)
{
detach_capi_driver(&b1isa_driver);
int i;
for (i = 0; i < MAX_CARDS; i++) {
if (!io[i])
break;
b1isa_remove(&isa_dev[i]);
}
detach_capi_driver(&b1isa_driver);
}
module_init(b1isa_init);
......
......@@ -60,16 +60,14 @@ static char *b1pci_procinfo(struct capi_ctr *ctrl)
/* ------------------------------------------------------------- */
static int b1pci_add_card(struct capi_driver *driver,
struct capicardparams *p,
struct pci_dev *dev)
static int b1pci_probe(struct capi_driver *driver,
struct capicardparams *p,
struct pci_dev *pdev)
{
avmcard *card;
avmctrl_info *cinfo;
int retval;
MOD_INC_USE_COUNT;
card = b1_alloc_card(1);
if (!card) {
printk(KERN_WARNING "%s: no memory.\n", driver->name);
......@@ -127,6 +125,7 @@ static int b1pci_add_card(struct capi_driver *driver,
driver->name, card->port, card->irq, card->revision);
}
pci_set_drvdata(pdev, card);
return 0;
err_free_irq:
......@@ -136,26 +135,22 @@ static int b1pci_add_card(struct capi_driver *driver,
err_free:
b1_free_card(card);
err:
MOD_DEC_USE_COUNT;
return retval;
}
static void b1pci_remove_ctr(struct capi_ctr *ctrl)
static void b1pci_remove(struct pci_dev *pdev)
{
avmctrl_info *cinfo = (avmctrl_info *)(ctrl->driverdata);
avmcard *card = cinfo->card;
avmcard *card = pci_get_drvdata(pdev);
avmctrl_info *cinfo = card->ctrlinfo;
unsigned int port = card->port;
b1_reset(port);
b1_reset(port);
detach_capi_ctr(ctrl);
detach_capi_ctr(cinfo->capi_ctrl);
free_irq(card->irq, card);
release_region(card->port, AVMB1_PORTLEN);
ctrl->driverdata = 0;
b1_free_card(card);
MOD_DEC_USE_COUNT;
}
/* ------------------------------------------------------------- */
......@@ -166,7 +161,6 @@ static struct capi_driver b1pci_driver = {
revision: "0.0",
load_firmware: b1_load_firmware,
reset_ctr: b1_reset_ctr,
remove_ctr: b1pci_remove_ctr,
register_appl: b1_register_appl,
release_appl: b1_release_appl,
send_message: b1_send_message,
......@@ -174,8 +168,6 @@ static struct capi_driver b1pci_driver = {
procinfo: b1pci_procinfo,
ctr_read_proc: b1ctl_read_proc,
driver_read_proc: 0, /* use standard driver_read_proc */
add_card: 0, /* no add_card function */
};
#ifdef CONFIG_ISDN_DRV_AVMB1_B1PCIV4
......@@ -200,16 +192,14 @@ static char *b1pciv4_procinfo(struct capi_ctr *ctrl)
/* ------------------------------------------------------------- */
static int b1pciv4_add_card(struct capi_driver *driver,
struct capicardparams *p,
struct pci_dev *dev)
static int b1pciv4_probe(struct capi_driver *driver,
struct capicardparams *p,
struct pci_dev *pdev)
{
avmcard *card;
avmctrl_info *cinfo;
int retval;
MOD_INC_USE_COUNT;
card = b1_alloc_card(1);
if (!card) {
printk(KERN_WARNING "%s: no memory.\n", driver->name);
......@@ -217,7 +207,7 @@ static int b1pciv4_add_card(struct capi_driver *driver,
goto err;
}
card->dma = avmcard_dma_alloc(driver->name, dev, 2048+128, 2048+128);
card->dma = avmcard_dma_alloc(driver->name, pdev, 2048+128, 2048+128);
if (!card->dma) {
printk(KERN_WARNING "%s: dma alloc.\n", driver->name);
retval = -ENOMEM;
......@@ -280,6 +270,7 @@ static int b1pciv4_add_card(struct capi_driver *driver,
driver->name, card->port, card->irq,
card->membase, card->revision);
pci_set_drvdata(pdev, card);
return 0;
err_free_irq:
......@@ -293,27 +284,23 @@ static int b1pciv4_add_card(struct capi_driver *driver,
err_free:
b1_free_card(card);
err:
MOD_DEC_USE_COUNT;
return retval;
}
static void b1pciv4_remove_ctr(struct capi_ctr *ctrl)
static void b1pciv4_remove(struct pci_dev *pdev)
{
avmctrl_info *cinfo = (avmctrl_info *)(ctrl->driverdata);
avmcard *card = cinfo->card;
avmcard *card = pci_get_drvdata(pdev);
avmctrl_info *cinfo = card->ctrlinfo;
b1dma_reset(card);
detach_capi_ctr(ctrl);
detach_capi_ctr(cinfo->capi_ctrl);
free_irq(card->irq, card);
iounmap(card->mbase);
release_region(card->port, AVMB1_PORTLEN);
ctrl->driverdata = 0;
avmcard_dma_free(card->dma);
b1_free_card(card);
MOD_DEC_USE_COUNT;
}
/* ------------------------------------------------------------- */
......@@ -325,7 +312,6 @@ static struct capi_driver b1pciv4_driver = {
revision: "0.0",
load_firmware: b1dma_load_firmware,
reset_ctr: b1dma_reset_ctr,
remove_ctr: b1pciv4_remove_ctr,
register_appl: b1dma_register_appl,
release_appl: b1dma_release_appl,
send_message: b1dma_send_message,
......@@ -333,42 +319,40 @@ static struct capi_driver b1pciv4_driver = {
procinfo: b1pciv4_procinfo,
ctr_read_proc: b1dmactl_read_proc,
driver_read_proc: 0, /* use standard driver_read_proc */
add_card: 0, /* no add_card function */
};
#endif /* CONFIG_ISDN_DRV_AVMB1_B1PCIV4 */
static int __devinit b1pci_probe(struct pci_dev *dev,
const struct pci_device_id *ent)
static int __devinit b1pci_pci_probe(struct pci_dev *pdev,
const struct pci_device_id *ent)
{
struct capi_driver *driver = &b1pci_driver;
struct capicardparams param;
int retval;
if (pci_enable_device(dev) < 0) {
if (pci_enable_device(pdev) < 0) {
printk(KERN_ERR "%s: failed to enable AVM-B1\n",
driver->name);
return -ENODEV;
}
param.irq = dev->irq;
param.irq = pdev->irq;
if (pci_resource_start(dev, 2)) { /* B1 PCI V4 */
if (pci_resource_start(pdev, 2)) { /* B1 PCI V4 */
#ifdef CONFIG_ISDN_DRV_AVMB1_B1PCIV4
driver = &b1pciv4_driver;
pci_set_master(dev);
pci_set_master(pdev);
#endif
param.membase = pci_resource_start(dev, 0);
param.port = pci_resource_start(dev, 2);
param.membase = pci_resource_start(pdev, 0);
param.port = pci_resource_start(pdev, 2);
printk(KERN_INFO
"%s: PCI BIOS reports AVM-B1 V4 at i/o %#x, irq %d, mem %#x\n",
driver->name, param.port, param.irq, param.membase);
#ifdef CONFIG_ISDN_DRV_AVMB1_B1PCIV4
retval = b1pciv4_add_card(driver, &param, dev);
retval = b1pciv4_probe(driver, &param, pdev);
#else
retval = b1pci_add_card(driver, &param, dev);
retval = b1pci_probe(driver, &param, pdev);
#endif
if (retval != 0) {
printk(KERN_ERR
......@@ -377,12 +361,12 @@ static int __devinit b1pci_probe(struct pci_dev *dev,
}
} else {
param.membase = 0;
param.port = pci_resource_start(dev, 1);
param.port = pci_resource_start(pdev, 1);
printk(KERN_INFO
"%s: PCI BIOS reports AVM-B1 at i/o %#x, irq %d\n",
driver->name, param.port, param.irq);
retval = b1pci_add_card(driver, &param, dev);
retval = b1pci_probe(driver, &param, pdev);
if (retval != 0) {
printk(KERN_ERR
"%s: no AVM-B1 at i/o %#x, irq %d detected\n",
......@@ -392,68 +376,60 @@ static int __devinit b1pci_probe(struct pci_dev *dev,
return retval;
}
static void __devexit b1pci_pci_remove(struct pci_dev *pdev)
{
avmcard *card = pci_get_drvdata(pdev);
if (card->dma)
b1pciv4_remove(pdev);
else
b1pci_remove(pdev);
}
static struct pci_driver b1pci_pci_driver = {
name: "b1pci",
id_table: b1pci_pci_tbl,
probe: b1pci_probe,
probe: b1pci_pci_probe,
remove: __devexit_p(b1pci_pci_remove),
};
static int __init b1pci_init(void)
{
struct capi_driver *driver = &b1pci_driver;
#ifdef CONFIG_ISDN_DRV_AVMB1_B1PCIV4
struct capi_driver *driverv4 = &b1pciv4_driver;
#endif
char *p;
int ncards;
int retval;
MOD_INC_USE_COUNT;
if ((p = strchr(revision, ':')) != 0 && p[1]) {
strncpy(driver->revision, p + 2, sizeof(driver->revision));
driver->revision[sizeof(driver->revision)-1] = 0;
if ((p = strchr(driver->revision, '$')) != 0 && p > driver->revision)
*(p-1) = 0;
}
b1_set_revision(&b1pci_driver, revision);
attach_capi_driver(&b1pci_driver);
#ifdef CONFIG_ISDN_DRV_AVMB1_B1PCIV4
if ((p = strchr(revision, ':')) != 0 && p[1]) {
strncpy(driverv4->revision, p + 2, sizeof(driverv4->revision));
driverv4->revision[sizeof(driverv4->revision)-1] = 0;
if ((p = strchr(driverv4->revision, '$')) != 0 && p > driverv4->revision)
*(p-1) = 0;
}
b1_set_revision(&b1pciv4_driver, revision);
attach_capi_driver(&b1pciv4_driver);
#endif
printk(KERN_INFO "%s: revision %s\n", driver->name, driver->revision);
attach_capi_driver(driver);
#ifdef CONFIG_ISDN_DRV_AVMB1_B1PCIV4
printk(KERN_INFO "%s: revision %s\n", driverv4->name, driverv4->revision);
retval = pci_module_init(&b1pci_pci_driver);
if (retval < 0)
goto err;
attach_capi_driver(driverv4);
#endif
printk(KERN_INFO "%s: %d B1-PCI card(s) detected\n",
b1pci_driver.name, retval);
retval = 0;
goto out;
ncards = pci_register_driver(&b1pci_pci_driver);
if (ncards) {
printk(KERN_INFO "%s: %d B1-PCI card(s) detected\n",
driver->name, ncards);
MOD_DEC_USE_COUNT;
return 0;
}
printk(KERN_ERR "%s: NO B1-PCI card detected\n", driver->name);
pci_unregister_driver(&b1pci_pci_driver);
detach_capi_driver(driver);
err:
detach_capi_driver(&b1pci_driver);
#ifdef CONFIG_ISDN_DRV_AVMB1_B1PCIV4
detach_capi_driver(driverv4);
detach_capi_driver(&b1pciv4_driver);
#endif
out:
MOD_DEC_USE_COUNT;
return -ENODEV;
return retval;
}
static void __exit b1pci_exit(void)
{
pci_unregister_driver(&b1pci_pci_driver);
detach_capi_driver(&b1pci_driver);
#ifdef CONFIG_ISDN_DRV_AVMB1_B1PCIV4
detach_capi_driver(&b1pciv4_driver);
......
......@@ -47,8 +47,6 @@ static void b1pcmcia_remove_ctr(struct capi_ctr *ctrl)
detach_capi_ctr(ctrl);
free_irq(card->irq, card);
b1_free_card(card);
MOD_DEC_USE_COUNT;
}
/* ------------------------------------------------------------- */
......@@ -63,8 +61,6 @@ static int b1pcmcia_add_card(struct capi_driver *driver,
char *cardname;
int retval;
MOD_INC_USE_COUNT;
card = b1_alloc_card(1);
if (!card) {
printk(KERN_WARNING "%s: no memory.\n", driver->name);
......@@ -123,7 +119,6 @@ static int b1pcmcia_add_card(struct capi_driver *driver,
err_free:
b1_free_card(card);
err:
MOD_DEC_USE_COUNT;
return retval;
}
......@@ -153,7 +148,6 @@ static struct capi_driver b1pcmcia_driver = {
revision: "0.0",
load_firmware: b1_load_firmware,
reset_ctr: b1_reset_ctr,
remove_ctr: b1pcmcia_remove_ctr,
register_appl: b1_register_appl,
release_appl: b1_release_appl,
send_message: b1_send_message,
......@@ -161,8 +155,6 @@ static struct capi_driver b1pcmcia_driver = {
procinfo: b1pcmcia_procinfo,
ctr_read_proc: b1ctl_read_proc,
driver_read_proc: 0, /* use standard driver_read_proc */
add_card: 0,
};
/* ------------------------------------------------------------- */
......@@ -208,30 +200,18 @@ EXPORT_SYMBOL(b1pcmcia_delcard);
static int __init b1pcmcia_init(void)
{
struct capi_driver *driver = &b1pcmcia_driver;
char *p;
int retval = 0;
MOD_INC_USE_COUNT;
if ((p = strchr(revision, ':')) != 0 && p[1]) {
strncpy(driver->revision, p + 2, sizeof(driver->revision));
driver->revision[sizeof(driver->revision)-1] = 0;
if ((p = strchr(driver->revision, '$')) != 0 && p > driver->revision)
*(p-1) = 0;
}
printk(KERN_INFO "%s: revision %s\n", driver->name, driver->revision);
attach_capi_driver(driver);
b1_set_revision(&b1pcmcia_driver, revision);
attach_capi_driver(&b1pcmcia_driver);
MOD_DEC_USE_COUNT;
return retval;
return 0;
}
static void __exit b1pcmcia_exit(void)
{
detach_capi_driver(&b1pcmcia_driver);
detach_capi_driver(&b1pcmcia_driver);
}
module_init(b1pcmcia_init);
......
......@@ -548,6 +548,7 @@ static void c4_handle_rx(avmcard *card)
MsgLen = _get_slice(&p, card->msgbuf);
cidx = CAPIMSG_CONTROLLER(card->msgbuf)-card->cardnr;
if (cidx >= card->nlogcontr) cidx = 0;
cinfo = &card->ctrlinfo[cidx];
ctrl = card->ctrlinfo[cidx].capi_ctrl;
if (!(skb = alloc_skb(MsgLen, GFP_ATOMIC))) {
......@@ -555,6 +556,11 @@ static void c4_handle_rx(avmcard *card)
card->name);
} else {
memcpy(skb_put(skb, MsgLen), card->msgbuf, MsgLen);
if (CAPIMSG_CMD(skb->data) == CAPI_DATA_B3_CONF)
capilib_data_b3_conf(&cinfo->ncci_head, ApplId,
CAPIMSG_NCCI(skb->data),
CAPIMSG_MSGID(skb->data));
ctrl->handle_capimsg(ctrl, ApplId, skb);
}
break;
......@@ -566,9 +572,8 @@ static void c4_handle_rx(avmcard *card)
WindowSize = _get_word(&p);
cidx = (NCCI&0x7f) - card->cardnr;
if (cidx >= card->nlogcontr) cidx = 0;
ctrl = card->ctrlinfo[cidx].capi_ctrl;
ctrl->new_ncci(ctrl, ApplId, NCCI, WindowSize);
capilib_new_ncci(&card->ctrlinfo[cidx].ncci_head, ApplId, NCCI, WindowSize);
break;
......@@ -580,9 +585,7 @@ static void c4_handle_rx(avmcard *card)
if (NCCI != 0xffffffff) {
cidx = (NCCI&0x7f) - card->cardnr;
if (cidx >= card->nlogcontr) cidx = 0;
ctrl = card->ctrlinfo[cidx].capi_ctrl;
if (ctrl)
ctrl->free_ncci(ctrl, ApplId, NCCI);
capilib_free_ncci(&card->ctrlinfo[cidx].ncci_head, ApplId, NCCI);
}
break;
......@@ -675,6 +678,7 @@ static void c4_handle_interrupt(avmcard *card)
for (i=0; i < 4; i++) {
avmctrl_info *cinfo = &card->ctrlinfo[i];
memset(cinfo->version, 0, sizeof(cinfo->version));
capilib_release(&cinfo->ncci_head);
if (cinfo->capi_ctrl)
cinfo->capi_ctrl->reseted(cinfo->capi_ctrl);
}
......@@ -897,9 +901,9 @@ void c4_reset_ctr(struct capi_ctr *ctrl)
card->nlogcontr = 0;
}
static void c4_remove_ctr(struct capi_ctr *ctrl)
static void c4_remove(struct pci_dev *pdev)
{
avmcard *card = ((avmctrl_info *)(ctrl->driverdata))->card;
avmcard *card = pci_get_drvdata(pdev);
avmctrl_info *cinfo;
int i;
......@@ -916,11 +920,8 @@ static void c4_remove_ctr(struct capi_ctr *ctrl)
free_irq(card->irq, card);
iounmap(card->mbase);
release_region(card->port, AVMB1_PORTLEN);
ctrl->driverdata = 0;
avmcard_dma_free(card->dma);
b1_free_card(card);
MOD_DEC_USE_COUNT;
}
/* ------------------------------------------------------------- */
......@@ -974,6 +975,8 @@ void c4_release_appl(struct capi_ctr *ctrl, u16 appl)
struct sk_buff *skb;
void *p;
capilib_release_appl(&cinfo->ncci_head, appl);
if (ctrl->cnr == card->cardnr) {
skb = alloc_skb(7, GFP_ATOMIC);
if (!skb) {
......@@ -996,12 +999,25 @@ void c4_release_appl(struct capi_ctr *ctrl, u16 appl)
/* ------------------------------------------------------------- */
static void c4_send_message(struct capi_ctr *ctrl, struct sk_buff *skb)
static u16 c4_send_message(struct capi_ctr *ctrl, struct sk_buff *skb)
{
avmctrl_info *cinfo = (avmctrl_info *)(ctrl->driverdata);
avmcard *card = cinfo->card;
skb_queue_tail(&card->dma->send_queue, skb);
c4_dispatch_tx(card);
u16 retval = CAPI_NOERROR;
if (CAPIMSG_CMD(skb->data) == CAPI_DATA_B3_REQ) {
retval = capilib_data_b3_req(&cinfo->ncci_head,
CAPIMSG_APPID(skb->data),
CAPIMSG_NCCI(skb->data),
CAPIMSG_MSGID(skb->data));
}
if (retval == CAPI_NOERROR) {
skb_queue_tail(&card->dma->send_queue, skb);
c4_dispatch_tx(card);
} else {
dev_kfree_skb_any(skb);
}
return retval;
}
/* ------------------------------------------------------------- */
......@@ -1102,8 +1118,6 @@ static int c4_add_card(struct capi_driver *driver,
int retval;
int i;
MOD_INC_USE_COUNT;
card = b1_alloc_card(nr_controllers);
if (!card) {
printk(KERN_WARNING "%s: no memory.\n", driver->name);
......@@ -1189,7 +1203,6 @@ static int c4_add_card(struct capi_driver *driver,
err_free:
b1_free_card(card);
err:
MOD_DEC_USE_COUNT;
return retval;
}
......@@ -1201,7 +1214,6 @@ static struct capi_driver c2_driver = {
revision: "0.0",
load_firmware: c4_load_firmware,
reset_ctr: c4_reset_ctr,
remove_ctr: c4_remove_ctr,
register_appl: c4_register_appl,
release_appl: c4_release_appl,
send_message: c4_send_message,
......@@ -1209,8 +1221,6 @@ static struct capi_driver c2_driver = {
procinfo: c4_procinfo,
ctr_read_proc: c4_read_proc,
driver_read_proc: 0, /* use standard driver_read_proc */
add_card: 0, /* no add_card function */
};
static struct capi_driver c4_driver = {
......@@ -1219,7 +1229,6 @@ static struct capi_driver c4_driver = {
revision: "0.0",
load_firmware: c4_load_firmware,
reset_ctr: c4_reset_ctr,
remove_ctr: c4_remove_ctr,
register_appl: c4_register_appl,
release_appl: c4_release_appl,
send_message: c4_send_message,
......@@ -1227,26 +1236,8 @@ static struct capi_driver c4_driver = {
procinfo: c4_procinfo,
ctr_read_proc: c4_read_proc,
driver_read_proc: 0, /* use standard driver_read_proc */
add_card: 0, /* no add_card function */
};
static int c4_attach_driver (struct capi_driver * driver)
{
char *p;
if ((p = strchr(revision, ':')) != 0 && p[1]) {
strncpy(driver->revision, p + 2, sizeof(driver->revision));
driver->revision[sizeof(driver->revision)-1] = 0;
if ((p = strchr(driver->revision, '$')) != 0 && p > driver->revision)
*(p-1) = 0;
}
printk(KERN_INFO "%s: revision %s\n", driver->name, driver->revision);
attach_capi_driver(driver);
return 0;
}
static int __devinit c4_probe(struct pci_dev *dev,
const struct pci_device_id *ent)
{
......@@ -1284,40 +1275,37 @@ static struct pci_driver c4_pci_driver = {
name: "c4",
id_table: c4_pci_tbl,
probe: c4_probe,
remove: c4_remove,
};
static int __init c4_init(void)
{
int retval;
int ncards;
MOD_INC_USE_COUNT;
retval = c4_attach_driver (&c4_driver);
if (retval) {
MOD_DEC_USE_COUNT;
return retval;
}
b1_set_revision(&c2_driver, revision);
attach_capi_driver(&c2_driver);
retval = c4_attach_driver (&c2_driver);
if (retval) {
MOD_DEC_USE_COUNT;
return retval;
}
b1_set_revision(&c4_driver, revision);
attach_capi_driver(&c4_driver);
ncards = pci_register_driver(&c4_pci_driver);
if (ncards) {
printk(KERN_INFO "%s: %d C4/C2 card(s) detected\n",
c4_driver.name, ncards);
MOD_DEC_USE_COUNT;
return 0;
}
printk(KERN_ERR "%s: NO C4/C2 card detected\n", c4_driver.name);
pci_unregister_driver(&c4_pci_driver);
detach_capi_driver(&c4_driver);
retval = pci_module_init(&c4_pci_driver);
if (retval < 0)
goto err;
printk(KERN_INFO "%s: %d C4/C2 card(s) detected\n",
c4_driver.name, retval);
retval = 0;
goto out;
err:
detach_capi_driver(&c2_driver);
detach_capi_driver(&c4_driver);
out:
MOD_DEC_USE_COUNT;
return -ENODEV;
return retval;
}
static void __exit c4_exit(void)
......
......@@ -17,8 +17,10 @@
#include <linux/interrupt.h>
#include <linux/ioport.h>
#include <linux/capi.h>
#include <linux/netdevice.h>
#include <linux/kernelcapi.h>
#include <linux/init.h>
#include <linux/pci.h>
#include <asm/io.h>
#include <linux/isdn/capicmd.h>
#include <linux/isdn/capiutil.h>
......@@ -35,6 +37,8 @@ MODULE_LICENSE("GPL");
/* ------------------------------------------------------------- */
static struct capi_driver t1isa_driver;
static int hema_irq_table[16] =
{0,
0,
......@@ -174,6 +178,11 @@ static void t1isa_interrupt(int interrupt, void *devptr, struct pt_regs *regs)
card->name);
} else {
memcpy(skb_put(skb, MsgLen), card->msgbuf, MsgLen);
if (CAPIMSG_CMD(skb->data) == CAPI_DATA_B3)
capilib_data_b3_conf(&cinfo->ncci_head, ApplId,
CAPIMSG_NCCI(skb->data),
CAPIMSG_MSGID(skb->data));
ctrl->handle_capimsg(ctrl, ApplId, skb);
}
break;
......@@ -184,7 +193,7 @@ static void t1isa_interrupt(int interrupt, void *devptr, struct pt_regs *regs)
NCCI = b1_get_word(card->port);
WindowSize = b1_get_word(card->port);
ctrl->new_ncci(ctrl, ApplId, NCCI, WindowSize);
capilib_new_ncci(&cinfo->ncci_head, ApplId, NCCI, WindowSize);
break;
......@@ -194,7 +203,7 @@ static void t1isa_interrupt(int interrupt, void *devptr, struct pt_regs *regs)
NCCI = b1_get_word(card->port);
if (NCCI != 0xffffffff)
ctrl->free_ncci(ctrl, ApplId, NCCI);
capilib_free_ncci(&cinfo->ncci_head, ApplId, NCCI);
break;
......@@ -313,12 +322,13 @@ void t1isa_reset_ctr(struct capi_ctr *ctrl)
b1_reset(port);
memset(cinfo->version, 0, sizeof(cinfo->version));
capilib_release(&cinfo->ncci_head);
ctrl->reseted(ctrl);
}
static void t1isa_remove_ctr(struct capi_ctr *ctrl)
static void t1isa_remove(struct pci_dev *pdev)
{
avmctrl_info *cinfo = (avmctrl_info *)(ctrl->driverdata);
avmctrl_info *cinfo = pci_get_drvdata(pdev);
avmcard *card = cinfo->card;
unsigned int port = card->port;
......@@ -327,99 +337,82 @@ static void t1isa_remove_ctr(struct capi_ctr *ctrl)
b1_reset(port);
t1_reset(port);
detach_capi_ctr(ctrl);
detach_capi_ctr(cinfo->capi_ctrl);
free_irq(card->irq, card);
release_region(card->port, AVMB1_PORTLEN);
b1_free_card(card);
MOD_DEC_USE_COUNT;
}
/* ------------------------------------------------------------- */
static int t1isa_add_card(struct capi_driver *driver, struct capicardparams *p)
static int __init t1isa_probe(struct pci_dev *pdev)
{
struct capi_ctr *ctrl;
struct list_head *l;
avmctrl_info *cinfo;
avmcard *card;
int retval;
MOD_INC_USE_COUNT;
static int cardnr = 1;
card = b1_alloc_card(1);
if (!card) {
printk(KERN_WARNING "%s: no memory.\n", driver->name);
printk(KERN_WARNING "%s: no memory.\n", t1isa_driver.name);
retval = -ENOMEM;
goto err;
}
cinfo = card->ctrlinfo;
sprintf(card->name, "t1isa-%x", p->port);
card->port = p->port;
card->irq = p->irq;
card->port = pci_resource_start(pdev, 0);
card->irq = pdev->irq;
card->cardtype = avm_t1isa;
card->cardnr = p->cardnr;
card->cardnr = cardnr++;
sprintf(card->name, "t1isa-%x", card->port);
if (!(((card->port & 0x7) == 0) && ((card->port & 0x30) != 0x30))) {
printk(KERN_WARNING "%s: illegal port 0x%x.\n",
driver->name, card->port);
t1isa_driver.name, card->port);
retval = -EINVAL;
goto err_free;
}
if (hema_irq_table[card->irq & 0xf] == 0) {
printk(KERN_WARNING "%s: irq %d not valid.\n",
driver->name, card->irq);
t1isa_driver.name, card->irq);
retval = -EINVAL;
goto err_free;
}
list_for_each(l, &driver->contr_head) {
avmcard *cardp;
ctrl = list_entry(l, struct capi_ctr, driver_list);
cardp = ((avmctrl_info *)(ctrl->driverdata))->card;
if (cardp->cardnr == card->cardnr) {
printk(KERN_WARNING "%s: card with number %d already installed at 0x%x.\n",
driver->name, card->cardnr, cardp->port);
retval = -EINVAL;
goto err_free;
}
}
if (!request_region(card->port, AVMB1_PORTLEN, card->name)) {
printk(KERN_WARNING "%s: ports 0x%03x-0x%03x in use.\n",
driver->name, card->port, card->port + AVMB1_PORTLEN);
printk(KERN_INFO "%s: ports 0x%03x-0x%03x in use.\n",
t1isa_driver.name, card->port, card->port + AVMB1_PORTLEN);
retval = -EBUSY;
goto err_free;
}
retval = request_irq(card->irq, t1isa_interrupt, 0, card->name, card);
if (retval) {
printk(KERN_ERR "%s: unable to get IRQ %d.\n",
driver->name, card->irq);
printk(KERN_INFO "%s: unable to get IRQ %d.\n",
t1isa_driver.name, card->irq);
retval = -EBUSY;
goto err_release_region;
}
if ((retval = t1_detectandinit(card->port, card->irq, card->cardnr)) != 0) {
printk(KERN_NOTICE "%s: NO card at 0x%x (%d)\n",
driver->name, card->port, retval);
printk(KERN_INFO "%s: NO card at 0x%x (%d)\n",
t1isa_driver.name, card->port, retval);
retval = -ENODEV;
goto err_free_irq;
}
t1_disable_irq(card->port);
b1_reset(card->port);
cinfo->capi_ctrl = attach_capi_ctr(driver, card->name, cinfo);
cinfo->capi_ctrl = attach_capi_ctr(&t1isa_driver, card->name, cinfo);
if (!cinfo->capi_ctrl) {
printk(KERN_ERR "%s: attach controller failed.\n",
driver->name);
printk(KERN_INFO "%s: attach controller failed.\n",
t1isa_driver.name);
retval = -EBUSY;
goto err_free_irq;
}
printk(KERN_INFO
"%s: AVM T1 ISA at i/o %#x, irq %d, card %d\n",
driver->name, card->port, card->irq, card->cardnr);
printk(KERN_INFO "%s: AVM T1 ISA at i/o %#x, irq %d, card %d\n",
t1isa_driver.name, card->port, card->irq, card->cardnr);
pci_set_drvdata(pdev, cinfo);
return 0;
err_free_irq:
......@@ -429,11 +422,10 @@ static int t1isa_add_card(struct capi_driver *driver, struct capicardparams *p)
err_free:
b1_free_card(card);
err:
MOD_DEC_USE_COUNT;
return retval;
}
static void t1isa_send_message(struct capi_ctr *ctrl, struct sk_buff *skb)
static u16 t1isa_send_message(struct capi_ctr *ctrl, struct sk_buff *skb)
{
avmctrl_info *cinfo = (avmctrl_info *)(ctrl->driverdata);
avmcard *card = cinfo->card;
......@@ -442,20 +434,36 @@ static void t1isa_send_message(struct capi_ctr *ctrl, struct sk_buff *skb)
u16 len = CAPIMSG_LEN(skb->data);
u8 cmd = CAPIMSG_COMMAND(skb->data);
u8 subcmd = CAPIMSG_SUBCOMMAND(skb->data);
u16 dlen, retval;
save_flags(flags);
cli();
if (CAPICMD(cmd, subcmd) == CAPI_DATA_B3_REQ) {
u16 dlen = CAPIMSG_DATALEN(skb->data);
retval = capilib_data_b3_req(&cinfo->ncci_head,
CAPIMSG_APPID(skb->data),
CAPIMSG_NCCI(skb->data),
CAPIMSG_MSGID(skb->data));
if (retval != CAPI_NOERROR)
goto out;
dlen = CAPIMSG_DATALEN(skb->data);
save_flags(flags);
cli();
b1_put_byte(port, SEND_DATA_B3_REQ);
t1_put_slice(port, skb->data, len);
t1_put_slice(port, skb->data + len, dlen);
restore_flags(flags);
} else {
retval = CAPI_NOERROR;
save_flags(flags);
cli();
b1_put_byte(port, SEND_MESSAGE);
t1_put_slice(port, skb->data, len);
restore_flags(flags);
}
restore_flags(flags);
dev_kfree_skb(skb);
out:
dev_kfree_skb_any(skb);
return retval;
}
/* ------------------------------------------------------------- */
......@@ -484,7 +492,6 @@ static struct capi_driver t1isa_driver = {
revision: "0.0",
load_firmware: t1isa_load_firmware,
reset_ctr: t1isa_reset_ctr,
remove_ctr: t1isa_remove_ctr,
register_appl: b1_register_appl,
release_appl: b1_release_appl,
send_message: t1isa_send_message,
......@@ -492,36 +499,63 @@ static struct capi_driver t1isa_driver = {
procinfo: t1isa_procinfo,
ctr_read_proc: b1ctl_read_proc,
driver_read_proc: 0, /* use standard driver_read_proc */
add_card: t1isa_add_card,
};
#define MAX_CARDS 4
static struct pci_dev isa_dev[MAX_CARDS];
static int io[MAX_CARDS];
static int irq[MAX_CARDS];
MODULE_PARM(io, "1-" __MODULE_STRING(MAX_CARDS) "i");
MODULE_PARM(irq, "1-" __MODULE_STRING(MAX_CARDS) "i");
MODULE_PARM_DESC(io, "I/O base address(es)");
MODULE_PARM_DESC(irq, "IRQ number(s) (assigned)");
static int __init t1isa_init(void)
{
struct capi_driver *driver = &t1isa_driver;
char *p;
int retval = 0;
int i, retval;
int found = 0;
MOD_INC_USE_COUNT;
if ((p = strchr(revision, ':')) != 0 && p[1]) {
strncpy(driver->revision, p + 2, sizeof(driver->revision));
driver->revision[sizeof(driver->revision)-1] = 0;
if ((p = strchr(driver->revision, '$')) != 0 && p > driver->revision)
*(p-1) = 0;
}
b1_set_revision(&t1isa_driver, revision);
attach_capi_driver(&t1isa_driver);
printk(KERN_INFO "%s: revision %s\n", driver->name, driver->revision);
for (i = 0; i < MAX_CARDS; i++) {
if (!io[i])
break;
isa_dev[i].resource[0].start = io[i];
isa_dev[i].irq_resource[0].start = irq[i];
attach_capi_driver(driver);
if (t1isa_probe(&isa_dev[i]) == 0)
found++;
}
if (found == 0) {
retval = -ENODEV;
goto err;
}
retval = 0;
goto out;
err:
detach_capi_driver(&t1isa_driver);
out:
MOD_DEC_USE_COUNT;
return retval;
}
static void __exit t1isa_exit(void)
{
detach_capi_driver(&t1isa_driver);
int i;
for (i = 0; i < MAX_CARDS; i++) {
if (!io[i])
break;
t1isa_remove(&isa_dev[i]);
}
detach_capi_driver(&t1isa_driver);
}
module_init(t1isa_init);
......
......@@ -47,14 +47,12 @@ MODULE_LICENSE("GPL");
static int t1pci_add_card(struct capi_driver *driver,
struct capicardparams *p,
struct pci_dev *dev)
struct pci_dev *pdev)
{
avmcard *card;
avmctrl_info *cinfo;
int retval;
MOD_INC_USE_COUNT;
card = b1_alloc_card(1);
if (!card) {
printk(KERN_WARNING "%s: no memory.\n", driver->name);
......@@ -62,7 +60,7 @@ static int t1pci_add_card(struct capi_driver *driver,
goto err;
}
card->dma = avmcard_dma_alloc(driver->name, dev, 2048+128, 2048+128);
card->dma = avmcard_dma_alloc(driver->name, pdev, 2048+128, 2048+128);
if (!card->dma) {
printk(KERN_WARNING "%s: no memory.\n", driver->name);
retval = -ENOMEM;
......@@ -127,6 +125,7 @@ static int t1pci_add_card(struct capi_driver *driver,
"%s: AVM T1 PCI at i/o %#x, irq %d, mem %#lx\n",
driver->name, card->port, card->irq, card->membase);
pci_set_drvdata(pdev, card);
return 0;
err_free_irq:
......@@ -140,28 +139,24 @@ static int t1pci_add_card(struct capi_driver *driver,
err_free:
b1_free_card(card);
err:
MOD_DEC_USE_COUNT;
return retval;
}
/* ------------------------------------------------------------- */
static void t1pci_remove_ctr(struct capi_ctr *ctrl)
static void t1pci_remove(struct pci_dev *pdev)
{
avmctrl_info *cinfo = (avmctrl_info *)(ctrl->driverdata);
avmcard *card = cinfo->card;
avmcard *card = pci_get_drvdata(pdev);
avmctrl_info *cinfo = card->ctrlinfo;
b1dma_reset(card);
detach_capi_ctr(ctrl);
detach_capi_ctr(cinfo->capi_ctrl);
free_irq(card->irq, card);
iounmap(card->mbase);
release_region(card->port, AVMB1_PORTLEN);
ctrl->driverdata = 0;
avmcard_dma_free(card->dma);
b1_free_card(card);
MOD_DEC_USE_COUNT;
}
/* ------------------------------------------------------------- */
......@@ -190,7 +185,6 @@ static struct capi_driver t1pci_driver = {
revision: "0.0",
load_firmware: b1dma_load_firmware,
reset_ctr: b1dma_reset_ctr,
remove_ctr: t1pci_remove_ctr,
register_appl: b1dma_register_appl,
release_appl: b1dma_release_appl,
send_message: b1dma_send_message,
......@@ -198,8 +192,6 @@ static struct capi_driver t1pci_driver = {
procinfo: t1pci_procinfo,
ctr_read_proc: b1dmactl_read_proc,
driver_read_proc: 0, /* use standard driver_read_proc */
add_card: 0, /* no add_card function */
};
/* ------------------------------------------------------------- */
......@@ -240,38 +232,32 @@ static struct pci_driver t1pci_pci_driver = {
name: "t1pci",
id_table: t1pci_pci_tbl,
probe: t1pci_probe,
remove: t1pci_remove,
};
static int __init t1pci_init(void)
{
struct capi_driver *driver = &t1pci_driver;
char *p;
int ncards;
int retval;
MOD_INC_USE_COUNT;
if ((p = strchr(revision, ':')) != 0 && p[1]) {
strncpy(driver->revision, p + 2, sizeof(driver->revision) - 1);
if ((p = strchr(driver->revision, '$')) != 0 && p > driver->revision)
*(p-1) = 0;
}
b1_set_revision(&t1pci_driver, revision);
attach_capi_driver(&t1pci_driver);
printk(KERN_INFO "%s: revision %s\n", driver->name, driver->revision);
retval = pci_register_driver(&t1pci_pci_driver);
if (retval < 0)
goto err;
attach_capi_driver(&t1pci_driver);
printk(KERN_INFO "%s: %d T1-PCI card(s) detected\n",
t1pci_driver.name, retval);
retval = 0;
goto out;
ncards = pci_register_driver(&t1pci_pci_driver);
if (ncards) {
printk(KERN_INFO "%s: %d T1-PCI card(s) detected\n",
driver->name, ncards);
MOD_DEC_USE_COUNT;
return 0;
}
printk(KERN_ERR "%s: NO T1-PCI card detected\n", driver->name);
pci_unregister_driver(&t1pci_pci_driver);
err:
detach_capi_driver(&t1pci_driver);
out:
MOD_DEC_USE_COUNT;
return -ENODEV;
return retval;
}
static void __exit t1pci_exit(void)
......
......@@ -15,7 +15,7 @@
#include <linux/signal.h>
#include <linux/kernel.h>
#include <linux/skbuff.h>
#include <linux/netdevice.h>
#define VER_DRIVER 0
#define VER_CARDTYPE 1
......@@ -62,9 +62,12 @@ Kernel-Capi callback reset_ctr
void
hycapi_reset_ctr(struct capi_ctr *ctrl)
{
hycapictrl_info *cinfo = ctrl->driverdata;
#ifdef HYCAPI_PRINTFNAMES
printk(KERN_NOTICE "HYCAPI hycapi_reset_ctr\n");
#endif
capilib_release(&cinfo->ncci_head);
ctrl->reseted(ctrl);
}
......@@ -269,6 +272,9 @@ static void hycapi_release_internal(struct capi_ctr *ctrl, __u16 appl)
__u16 len;
__u8 _command = 0xa1, _subcommand = 0x80;
__u16 MessageNumber = 0x0000;
capilib_release_appl(&cinfo->ncci_head, appl);
#ifdef HYCAPI_PRINTFNAMES
printk(KERN_NOTICE "hycapi_release_appl\n");
#endif
......@@ -373,12 +379,14 @@ firmware-releases that do not check the MsgLen-Indication!
***************************************************************/
void hycapi_send_message(struct capi_ctr *ctrl, struct sk_buff *skb)
u16 hycapi_send_message(struct capi_ctr *ctrl, struct sk_buff *skb)
{
__u16 appl_id;
int _len, _len2;
__u8 msghead[64];
hycapictrl_info *cinfo = ctrl->driverdata;
u16 retval = CAPI_NOERROR;
appl_id = CAPIMSG_APPID(skb->data);
switch(_hycapi_appCheck(appl_id, ctrl->cnr))
{
......@@ -392,12 +400,13 @@ void hycapi_send_message(struct capi_ctr *ctrl, struct sk_buff *skb)
break;
default:
printk(KERN_ERR "HYCAPI: Controller mixup!\n");
return;
retval = CAPI_ILLAPPNR;
goto out;
}
switch(CAPIMSG_CMD(skb->data)) {
case CAPI_DISCONNECT_B3_RESP:
ctrl->free_ncci(ctrl, appl_id,
CAPIMSG_NCCI(skb->data));
capilib_free_ncci(&cinfo->ncci_head, appl_id,
CAPIMSG_NCCI(skb->data));
break;
case CAPI_DATA_B3_REQ:
_len = CAPIMSG_LEN(skb->data);
......@@ -407,6 +416,10 @@ void hycapi_send_message(struct capi_ctr *ctrl, struct sk_buff *skb)
memcpy(skb->data + _len2, msghead, 22);
skb_pull(skb, _len2);
CAPIMSG_SETLEN(skb->data, 22);
retval = capilib_data_b3_req(&cinfo->ncci_head,
CAPIMSG_APPID(skb->data),
CAPIMSG_NCCI(skb->data),
CAPIMSG_MSGID(skb->data));
}
break;
case CAPI_LISTEN_REQ:
......@@ -423,7 +436,13 @@ void hycapi_send_message(struct capi_ctr *ctrl, struct sk_buff *skb)
default:
break;
}
hycapi_sendmsg_internal(ctrl, skb);
out:
if (retval == CAPI_NOERROR)
hycapi_sendmsg_internal(ctrl, skb);
else
dev_kfree_skb_any(skb);
return retval;
}
/*********************************************************************
......@@ -575,8 +594,8 @@ hycapi_rx_capipkt(hysdn_card * card, uchar * buf, word len)
switch(info)
{
case 0:
ctrl->new_ncci(ctrl, ApplId, CAPIMSG_NCCI(skb->data),
hycapi_applications[ApplId-1].rp.datablkcnt);
capilib_new_ncci(&cinfo->ncci_head, ApplId, CAPIMSG_NCCI(skb->data),
hycapi_applications[ApplId-1].rp.datablkcnt);
break;
case 0x0001:
......@@ -604,9 +623,14 @@ hycapi_rx_capipkt(hysdn_card * card, uchar * buf, word len)
}
break;
case CAPI_CONNECT_B3_IND:
ctrl->new_ncci(ctrl, ApplId,
CAPIMSG_NCCI(skb->data),
hycapi_applications[ApplId-1].rp.datablkcnt);
capilib_new_ncci(&cinfo->ncci_head, ApplId,
CAPIMSG_NCCI(skb->data),
hycapi_applications[ApplId-1].rp.datablkcnt);
break;
case CAPI_DATA_B3_CONF:
capilib_data_b3_conf(&cinfo->ncci_head, ApplId,
CAPIMSG_NCCI(skb->data),
CAPIMSG_MSGID(skb->data));
break;
default:
break;
......@@ -669,7 +693,6 @@ static struct capi_driver hycapi_driver = {
revision: "0.0",
load_firmware: hycapi_load_firmware,
reset_ctr: hycapi_reset_ctr,
remove_ctr: hycapi_remove_ctr,
register_appl: hycapi_register_appl,
release_appl: hycapi_release_appl,
send_message: hycapi_send_message,
......@@ -677,8 +700,6 @@ static struct capi_driver hycapi_driver = {
procinfo: hycapi_procinfo,
ctr_read_proc: hycapi_read_proc,
driver_read_proc: 0, /* use standard driver_read_proc */
add_card: 0, /* no add_card function */
};
......@@ -786,6 +807,7 @@ hycapi_capi_create(hysdn_card *card)
card->hyctrlinfo = cinfo;
cinfo->card = card;
spin_lock_init(&cinfo->lock);
INIT_LIST_HEAD(&cinfo->ncci_head);
switch (card->brdtype) {
case BD_PCCARD: strcpy(cinfo->cardname,"HYSDN Hycard"); break;
......
......@@ -213,6 +213,8 @@ typedef struct HYSDN_CARD {
int in_idx, out_idx; /* indexes to buffer ring */
int sk_count; /* number of buffers currently in ring */
struct sk_buff *tx_skb; /* buffer for tx operation */
struct list_head ncci_head;
} *hyctrlinfo;
#endif /* CONFIG_HYSDN_CAPI */
} hysdn_card;
......@@ -284,7 +286,7 @@ extern void hycapi_remove_ctr(struct capi_ctr *);
extern void hycapi_register_appl(struct capi_ctr *, __u16 appl,
capi_register_params *);
extern void hycapi_release_appl(struct capi_ctr *, __u16 appl);
extern void hycapi_send_message(struct capi_ctr *, struct sk_buff *skb);
extern u16 hycapi_send_message(struct capi_ctr *, struct sk_buff *skb);
extern char *hycapi_procinfo(struct capi_ctr *);
extern int hycapi_read_proc(char *page, char **start, off_t off,
int count, int *eof, struct capi_ctr *card);
......
......@@ -55,7 +55,6 @@ CONFIG_PLX_HERMES
Support for these adaptors is so far still incomplete and buggy.
You have been warned.
Prism 2.5 PCI 802.11b adaptor support
CONFIG_PCI_HERMES
Enable support for PCI and mini-PCI 802.11b wireless NICs based on
the Prism 2.5 chipset. These are true PCI cards, not the 802.11b
......
/* airport.c 0.11a
/* airport.c 0.11b
*
* A driver for "Hermes" chipset based Apple Airport wireless
* card.
......@@ -42,7 +42,7 @@
#include "hermes.h"
#include "orinoco.h"
static char version[] __initdata = "airport.c 0.11a (Benjamin Herrenschmidt <benh@kernel.crashing.org>)";
static char version[] __initdata = "airport.c 0.11b (Benjamin Herrenschmidt <benh@kernel.crashing.org>)";
MODULE_AUTHOR("Benjamin Herrenschmidt <benh@kernel.crashing.org>");
MODULE_DESCRIPTION("Driver for the Apple Airport wireless card.");
MODULE_LICENSE("Dual MPL/GPL");
......@@ -270,8 +270,8 @@ airport_attach(struct device_node* of_node)
static void
airport_detach(struct net_device *dev)
{
struct orinoco_private *priv = (struct orinoco_private *)dev->priv;
struct airport *card = (struct airport *)priv->card;
struct orinoco_private *priv = dev->priv;
struct airport *card = priv->card;
/* Unregister proc entry */
orinoco_proc_dev_cleanup(priv);
......@@ -299,7 +299,7 @@ airport_detach(struct net_device *dev)
current->state = TASK_UNINTERRUPTIBLE;
schedule_timeout(HZ);
kfree(card);
kfree(dev);
} /* airport_detach */
static int __init
......
/* orinoco.c 0.11a - (formerly known as dldwd_cs.c and orinoco_cs.c)
/* orinoco.c 0.11b - (formerly known as dldwd_cs.c and orinoco_cs.c)
*
* A driver for Hermes or Prism 2 chipset based PCMCIA wireless
* adaptors, with Lucent/Agere, Intersil or Symbol firmware.
......@@ -256,7 +256,7 @@
* o Fixes for recent Symbol firmwares which lack AP density
* (Pavel Roskin).
*
* v0.11 -> v0.11a - 29 Apr 2002 - David Gibson
* v0.11 -> v0.11b - 29 Apr 2002 - David Gibson
* o Handle different register spacing, necessary for Prism 2.5
* PCI adaptors (Steve Hill).
* o Cleaned up initialization of card structures in orinoco_cs
......@@ -274,15 +274,21 @@
* o Makefile changes for better integration into David Hinds
* pcmcia-cs package.
*
* v0.11a -> v0.11b - 1 May 2002 - David Gibson
* o Better error reporting in orinoco_plx_init_one()
* o Fixed multiple bad kfree() bugs introduced by the
* alloc_orinocodev() changes.
*
* TODO
* o Re-assess our encapsulation detection strategy
* o New wireless extensions API
* o Handle de-encapsulation within network layer, provide 802.11
* headers
* o Fix possible races in SPY handling.
* o Disconnect wireless extensions from fundamental configuration.
*
* o Convert /proc debugging stuff to seqfile
* o Use multiple Tx buffers */
* o Use multiple Tx buffers
*/
/* Notes on locking:
*
* The basic principle of operation is that everything except the
......@@ -351,7 +357,7 @@
#define SPY_NUMBER(priv) 0
#endif /* WIRELESS_SPY */
static char version[] __initdata = "orinoco.c 0.11a (David Gibson <hermes@gibson.dropbear.id.au> and others)";
static char version[] __initdata = "orinoco.c 0.11b (David Gibson <hermes@gibson.dropbear.id.au> and others)";
MODULE_AUTHOR("David Gibson <hermes@gibson.dropbear.id.au>");
MODULE_DESCRIPTION("Driver for Lucent Orinoco, Prism II based and similar wireless cards");
#ifdef MODULE_LICENSE
......
/* orinoco_cs.c 0.11a - (formerly known as dldwd_cs.c)
/* orinoco_cs.c 0.11b - (formerly known as dldwd_cs.c)
*
* A driver for "Hermes" chipset based PCMCIA wireless adaptors, such
* as the Lucent WavelanIEEE/Orinoco cards and their OEM (Cabletron/
......@@ -47,7 +47,7 @@
/*====================================================================*/
static char version[] __initdata = "orinoco_cs.c 0.11a (David Gibson <hermes@gibson.dropbear.id.au> and others)";
static char version[] __initdata = "orinoco_cs.c 0.11b (David Gibson <hermes@gibson.dropbear.id.au> and others)";
MODULE_AUTHOR("David Gibson <hermes@gibson.dropbear.id.au>");
MODULE_DESCRIPTION("Driver for PCMCIA Lucent Orinoco, Prism II based and similar wireless cards");
......@@ -373,6 +373,7 @@ orinoco_cs_detach(dev_link_t * link)
{
dev_link_t **linkp;
struct orinoco_private *priv = link->priv;
struct net_device *dev = priv->ndev;
TRACE_ENTER("orinoco");
......@@ -408,9 +409,9 @@ orinoco_cs_detach(dev_link_t * link)
if (link->dev) {
DEBUG(0, "orinoco_cs: About to unregister net device %p\n",
priv->ndev);
unregister_netdev(priv->ndev);
unregister_netdev(dev);
}
kfree(priv->card);
kfree(dev);
out:
TRACE_EXIT("orinoco");
......
/* orinoco_plx.c 0.11a
/* orinoco_plx.c 0.11b
*
* Driver for Prism II devices which would usually be driven by orinoco_cs,
* but are connected to the PCI bus by a PLX9052.
......@@ -134,7 +134,7 @@ not have time for a while..
#include "hermes.h"
#include "orinoco.h"
static char version[] __initdata = "orinoco_plx.c 0.11a (Daniel Barlow <dan@telent.net>)";
static char version[] __initdata = "orinoco_plx.c 0.11b (Daniel Barlow <dan@telent.net>)";
MODULE_AUTHOR("Daniel Barlow <dan@telent.net>");
MODULE_DESCRIPTION("Driver for wireless LAN cards using the PLX9052 PCI bridge");
#ifdef MODULE_LICENSE
......@@ -284,7 +284,7 @@ static int orinoco_plx_init_one(struct pci_dev *pdev,
hermes_struct_init(&(priv->hw), dev->base_addr,
HERMES_IO, HERMES_16BIT_REGSPACING);
pci_set_drvdata(pdev, priv);
pci_set_drvdata(pdev, dev);
err = request_irq(pdev->irq, orinoco_plx_interrupt, SA_SHIRQ, dev->name, priv);
if (err) {
......@@ -337,12 +337,12 @@ static int orinoco_plx_init_one(struct pci_dev *pdev,
static void __devexit orinoco_plx_remove_one(struct pci_dev *pdev)
{
struct orinoco_private *priv = pci_get_drvdata(pdev);
struct net_device *dev = priv->ndev;
struct net_device *dev = pci_get_drvdata(pdev);
struct orinoco_private *priv = dev->priv;
TRACE_ENTER("orinoco_plx");
if (!priv)
if (! dev)
BUG();
orinoco_proc_dev_cleanup(priv);
......@@ -352,7 +352,7 @@ static void __devexit orinoco_plx_remove_one(struct pci_dev *pdev)
if (dev->irq)
free_irq(dev->irq, priv);
kfree(priv);
kfree(dev);
release_region(pci_resource_start(pdev, 3), pci_resource_len(pdev, 3));
......
......@@ -77,7 +77,7 @@ void adfs_write_inode(struct inode *inode,int unused);
int adfs_notify_change(struct dentry *dentry, struct iattr *attr);
/* map.c */
extern int adfs_map_lookup(struct super_block *sb, int frag_id, int offset);
extern int adfs_map_lookup(struct super_block *sb, unsigned int frag_id, unsigned int offset);
extern unsigned int adfs_map_free(struct super_block *sb);
/* Misc */
......
......@@ -24,7 +24,7 @@
/*
* For future. This should probably be per-directory.
*/
static rwlock_t adfs_dir_lock;
static rwlock_t adfs_dir_lock = RW_LOCK_UNLOCKED;
static int
adfs_readdir(struct file *filp, void *dirent, filldir_t filldir)
......
/*
* linux/fs/adfs/map.c
*
* Copyright (C) 1997-1999 Russell King
* Copyright (C) 1997-2002 Russell King
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
......@@ -13,30 +13,64 @@
#include <linux/adfs_fs.h>
#include <linux/spinlock.h>
#include <asm/unaligned.h>
#include "adfs.h"
/*
* The ADFS map is basically a set of sectors. Each sector is called a
* zone which contains a bitstream made up of variable sized fragments.
* Each bit refers to a set of bytes in the filesystem, defined by
* log2bpmb. This may be larger or smaller than the sector size, but
* the overall size it describes will always be a round number of
* sectors. A fragment id is always idlen bits long.
*
* < idlen > < n > <1>
* +---------+-------//---------+---+
* | frag id | 0000....000000 | 1 |
* +---------+-------//---------+---+
*
* The physical disk space used by a fragment is taken from the start of
* the fragment id up to and including the '1' bit - ie, idlen + n + 1
* bits.
*
* A fragment id can be repeated multiple times in the whole map for
* large or fragmented files. The first map zone a fragment starts in
* is given by fragment id / ids_per_zone - this allows objects to start
* from any zone on the disk.
*
* Free space is described by a linked list of fragments. Each free
* fragment describes free space in the same way as the other fragments,
* however, the frag id specifies an offset (in map bits) from the end
* of this fragment to the start of the next free fragment.
*
* Objects stored on the disk are allocated object ids (we use these as
* our inode numbers.) Object ids contain a fragment id and an optional
* offset. This allows a directory fragment to contain small files
* associated with that directory.
*/
/*
* For the future...
*/
static rwlock_t adfs_map_lock;
static rwlock_t adfs_map_lock = RW_LOCK_UNLOCKED;
/*
* This is fun. We need to load up to 19 bits from the map at an
* arbitary bit alignment. (We're limited to 19 bits by F+ version 2).
*/
#define GET_FRAG_ID(_map,_start,_idmask) \
({ \
unsigned long _v2, _frag; \
unsigned int _tmp; \
_tmp = _start >> 5; \
_frag = le32_to_cpu(_map[_tmp]); \
_v2 = le32_to_cpu(_map[_tmp + 1]); \
_tmp = start & 31; \
_frag = (_frag >> _tmp) | (_v2 << (32 - _tmp)); \
unsigned char *_m = _map + (_start >> 3); \
u32 _frag = get_unaligned((u32 *)_m); \
_frag >>= (_start & 7); \
_frag & _idmask; \
})
/*
* return the map bit offset of the fragment frag_id in
* the zone dm.
* Note that the loop is optimised for best asm code -
* look at the output of:
* return the map bit offset of the fragment frag_id in the zone dm.
* Note that the loop is optimised for best asm code - look at the
* output of:
* gcc -D__KERNEL__ -O2 -I../../include -o - -S map.c
*/
static int
......@@ -44,14 +78,13 @@ lookup_zone(const struct adfs_discmap *dm, const unsigned int idlen,
const unsigned int frag_id, unsigned int *offset)
{
const unsigned int mapsize = dm->dm_endbit;
const unsigned int idmask = (1 << idlen) - 1;
unsigned long *map = ((unsigned long *)dm->dm_bh->b_data) + 1;
const u32 idmask = (1 << idlen) - 1;
unsigned char *map = dm->dm_bh->b_data + 4;
unsigned int start = dm->dm_startbit;
unsigned int mapptr;
u32 frag;
do {
unsigned long frag;
frag = GET_FRAG_ID(map, start, idmask);
mapptr = start + idlen;
......@@ -59,15 +92,17 @@ lookup_zone(const struct adfs_discmap *dm, const unsigned int idlen,
* find end of fragment
*/
{
unsigned long v2;
u32 v, *_map = (u32 *)map;
while ((v2 = map[mapptr >> 5] >> (mapptr & 31)) == 0) {
v = le32_to_cpu(_map[mapptr >> 5]) >> (mapptr & 31);
while (v == 0) {
mapptr = (mapptr & ~31) + 32;
if (mapptr >= mapsize)
goto error;
v = le32_to_cpu(_map[mapptr >> 5]);
}
mapptr += 1 + ffz(~v2);
mapptr += 1 + ffz(~v);
}
if (frag == frag_id)
......@@ -75,8 +110,11 @@ lookup_zone(const struct adfs_discmap *dm, const unsigned int idlen,
again:
start = mapptr;
} while (mapptr < mapsize);
return -1;
error:
printk(KERN_ERR "adfs: oversized fragment 0x%x at 0x%x-0x%x\n",
frag, start, mapptr);
return -1;
found:
......@@ -102,10 +140,10 @@ scan_free_map(struct adfs_sb_info *asb, struct adfs_discmap *dm)
const unsigned int mapsize = dm->dm_endbit + 32;
const unsigned int idlen = asb->s_idlen;
const unsigned int frag_idlen = idlen <= 15 ? idlen : 15;
const unsigned int idmask = (1 << frag_idlen) - 1;
unsigned long *map = (unsigned long *)dm->dm_bh->b_data;
const u32 idmask = (1 << frag_idlen) - 1;
unsigned char *map = dm->dm_bh->b_data;
unsigned int start = 8, mapptr;
unsigned long frag;
u32 frag;
unsigned long total = 0;
/*
......@@ -133,15 +171,17 @@ scan_free_map(struct adfs_sb_info *asb, struct adfs_discmap *dm)
* find end of fragment
*/
{
unsigned long v2;
u32 v, *_map = (u32 *)map;
while ((v2 = map[mapptr >> 5] >> (mapptr & 31)) == 0) {
v = le32_to_cpu(_map[mapptr >> 5]) >> (mapptr & 31);
while (v == 0) {
mapptr = (mapptr & ~31) + 32;
if (mapptr >= mapsize)
goto error;
v = le32_to_cpu(_map[mapptr >> 5]);
}
mapptr += 1 + ffz(~v2);
mapptr += 1 + ffz(~v);
}
total += mapptr - start;
......@@ -212,7 +252,9 @@ adfs_map_free(struct super_block *sb)
return signed_asl(total, asb->s_map2blk);
}
int adfs_map_lookup (struct super_block *sb, int frag_id, int offset)
int
adfs_map_lookup(struct super_block *sb, unsigned int frag_id,
unsigned int offset)
{
struct adfs_sb_info *asb = &sb->u.adfs_sb;
unsigned int zone, mapoff;
......@@ -245,12 +287,12 @@ int adfs_map_lookup (struct super_block *sb, int frag_id, int offset)
return secoff + signed_asl(result, asb->s_map2blk);
}
adfs_error(sb, "fragment %04X at offset %d not found in map",
adfs_error(sb, "fragment 0x%04x at offset %d not found in map",
frag_id, offset);
return 0;
bad_fragment:
adfs_error(sb, "fragment %X is invalid (zone = %d, max = %d)",
adfs_error(sb, "invalid fragment 0x%04x (zone = %d, max = %d)",
frag_id, zone, asb->s_map_size);
return 0;
}
......@@ -64,43 +64,9 @@ static int adfs_checkdiscrecord(struct adfs_discrecord *dr)
if (dr->disc_size_high >> dr->log2secsize)
return 1;
/*
* The following checks are not required for F+
* stage 1.
*/
#if 0
/* idlen must be smaller be no greater than 15 */
if (dr->idlen > 15)
return 1;
/* nzones must be less than 128 for the root
* directory to be addressable
*/
if (dr->nzones >= 128 && dr->nzones_high == 0)
return 1;
/* root must be of the form 0x2.. */
if ((le32_to_cpu(dr->root) & 0xffffff00) != 0x00000200)
return 1;
#else
/*
* Stage 2 F+ does not require the following check
*/
#if 0
/* idlen must be no greater than 16 v2 [1.0] */
if (dr->idlen > 16)
return 1;
/* we can't handle F+ discs yet */
if (dr->format_version || dr->root_size)
return 1;
#else
/* idlen must be no greater than 19 v2 [1.0] */
if (dr->idlen > 19)
return 1;
#endif
#endif
/* reserved bytes should be zero */
for (i = 0; i < sizeof(dr->unused52); i++)
......
......@@ -120,9 +120,10 @@
(((unsigned long)(addr) - PAGE_OFFSET) >> NODE_MAX_MEM_SHIFT)
/*
* Given a physical address, convert it to a node id.
* Given a page frame number, convert it to a node id.
*/
#define PHYS_TO_NID(addr) KVADDR_TO_NID(__phys_to_virt(addr))
#define PFN_TO_NID(pfn) \
(((pfn) - PHYS_PFN_OFFSET) >> (NODE_MAX_MEM_SHIFT - PAGE_SHIFT))
/*
* Given a kaddr, ADDR_TO_MAPBASE finds the owning node of the memory
......@@ -131,30 +132,15 @@
#define ADDR_TO_MAPBASE(kaddr) \
NODE_MEM_MAP(KVADDR_TO_NID((unsigned long)(kaddr)))
#define PFN_TO_MAPBASE(pfn) NODE_MEM_MAP(PFN_TO_NID(pfn))
/*
* Given a kaddr, LOCAL_MAR_NR finds the owning node of the memory
* and returns the index corresponding to the appropriate page in the
* node's mem_map.
*/
#define LOCAL_MAP_NR(kaddr) \
(((unsigned long)(kaddr)-LOCAL_BASE_ADDR((kaddr))) >> PAGE_SHIFT)
/*
* Given a kaddr, virt_to_page returns a pointer to the corresponding
* mem_map entry.
*/
#define virt_to_page(kaddr) \
(ADDR_TO_MAPBASE(kaddr) + LOCAL_MAP_NR(kaddr))
/*
* VALID_PAGE returns a non-zero value if given page pointer is valid.
* This assumes all node's mem_maps are stored within the node they refer to.
*/
#define VALID_PAGE(page) \
({ unsigned int node = KVADDR_TO_NID(page); \
( (node < NR_NODES) && \
((unsigned)((page) - NODE_MEM_MAP(node)) < NODE_DATA(node)->node_size) ); \
})
#define LOCAL_MAP_NR(addr) \
(((unsigned long)(addr) & (NODE_MAX_MEM_SIZE - 1)) >> PAGE_SHIFT)
/*
* The PS7211 allows up to 256MB max per DRAM bank, but the EDB7211
......@@ -167,40 +153,13 @@
#define NODE_MAX_MEM_SHIFT 24
#define NODE_MAX_MEM_SIZE (1<<NODE_MAX_MEM_SHIFT)
/*
* Given a mem_map_t, LOCAL_MAP_BASE finds the owning node for the
* physical page and returns the kaddr for the mem_map of that node.
*/
#define LOCAL_MAP_BASE(page) \
NODE_MEM_MAP(KVADDR_TO_NID((unsigned long)(page)))
/*
* Given a kaddr, LOCAL_BASE_ADDR finds the owning node of the memory
* and returns the kaddr corresponding to first physical page in the
* node's mem_map.
*/
#define LOCAL_BASE_ADDR(kaddr) ((unsigned long)(kaddr) & ~(NODE_MAX_MEM_SIZE-1))
/*
* With discontigmem, the conceptual mem_map array starts from PAGE_OFFSET.
* Given a kaddr, MAP_NR returns the appropriate global mem_map index so
* it matches the corresponding node's local mem_map.
*/
#define MAP_NR(kaddr) (LOCAL_MAP_NR((kaddr)) + \
(((unsigned long)ADDR_TO_MAPBASE((kaddr)) - PAGE_OFFSET) / \
sizeof(mem_map_t)))
#else
#define PHYS_TO_NID(addr) (0)
#define PFN_TO_NID(pfn) (0)
#endif /* CONFIG_DISCONTIGMEM */
#endif /* CONFIG_ARCH_EDB7211 */
#ifndef PHYS_TO_NID
#define PHYS_TO_NID(addr) (0)
#endif
#endif
......@@ -129,7 +129,6 @@ void __init time_init(void)
timer2->TimerControl = 0;
timer1->TimerLoad = TIMER_RELOAD;
timer1->TimerValue = TIMER_RELOAD;
timer1->TimerControl = TIMER_CTRL | 0x40; /* periodic */
/*
......
......@@ -22,6 +22,16 @@
#include "bitfield.h"
/*
* SA1100 CS line to physical address
*/
#define SA1100_CS0_PHYS 0x00000000
#define SA1100_CS1_PHYS 0x08000000
#define SA1100_CS2_PHYS 0x10000000
#define SA1100_CS3_PHYS 0x18000000
#define SA1100_CS4_PHYS 0x40000000
#define SA1100_CS5_PHYS 0x48000000
/*
* Personal Computer Memory Card International Association (PCMCIA) sockets
......
......@@ -23,15 +23,6 @@
#define UNCACHEABLE_ADDR 0xfa050000
/*
* Those are statically mapped PCMCIA IO space for designs using it as a
* generic IO bus, typically with ISA parts, hardwired IDE interfaces, etc.
* The actual PCMCIA code is mapping required IO region at run time.
*/
#define PCMCIA_IO_0_BASE 0xf6000000
#define PCMCIA_IO_1_BASE 0xf7000000
/*
* We requires absolute addresses i.e. (PCMCIA_IO_0_BASE + 0x3f8) for
* in*()/out*() macros to be usable for all cases.
......
......@@ -60,11 +60,6 @@
#define IRQ_GPIO26 47
#define IRQ_GPIO27 48
/*
* To get the GPIO number from an IRQ number
*/
#define GPIO_11_27_IRQ(i) ((i) - 21)
/*
* The next 16 interrupts are for board specific purposes. Since
* the kernel can only run on one machine at a time, we can re-use
......
......@@ -79,49 +79,36 @@
/*
* Given a kernel address, find the home node of the underlying memory.
*/
#define KVADDR_TO_NID(addr) \
(((unsigned long)(addr) - 0xc0000000) >> 27)
#define KVADDR_TO_NID(addr) (((unsigned long)(addr) - PAGE_OFFSET) >> 27)
/*
* Given a physical address, convert it to a node id.
* Given a page frame number, convert it to a node id.
*/
#define PHYS_TO_NID(addr) KVADDR_TO_NID(__phys_to_virt(addr))
#define PFN_TO_NID(pfn) (((pfn) - PHYS_PFN_OFFSET) >> (27 - PAGE_SHIFT))
/*
* Given a kaddr, ADDR_TO_MAPBASE finds the owning node of the memory
* and returns the mem_map of that node.
* and return the mem_map of that node.
*/
#define ADDR_TO_MAPBASE(kaddr) \
NODE_MEM_MAP(KVADDR_TO_NID((unsigned long)(kaddr)))
#define ADDR_TO_MAPBASE(kaddr) NODE_MEM_MAP(KVADDR_TO_NID(kaddr))
/*
* Given a kaddr, LOCAL_MEM_MAP finds the owning node of the memory
* and returns the index corresponding to the appropriate page in the
* node's mem_map.
* Given a page frame number, find the owning node of the memory
* and return the mem_map of that node.
*/
#define LOCAL_MAP_NR(kvaddr) \
(((unsigned long)(kvaddr) & 0x07ffffff) >> PAGE_SHIFT)
#define PFN_TO_MAPBASE(pfn) NODE_MEM_MAP(PFN_TO_NID(pfn))
/*
* Given a kaddr, virt_to_page returns a pointer to the corresponding
* mem_map entry.
*/
#define virt_to_page(kaddr) \
(ADDR_TO_MAPBASE(kaddr) + LOCAL_MAP_NR(kaddr))
/*
* VALID_PAGE returns a non-zero value if given page pointer is valid.
* This assumes all node's mem_maps are stored within the node they refer to.
* Given a kaddr, LOCAL_MEM_MAP finds the owning node of the memory
* and returns the index corresponding to the appropriate page in the
* node's mem_map.
*/
#define VALID_PAGE(page) \
({ unsigned int node = KVADDR_TO_NID(page); \
( (node < NR_NODES) && \
((unsigned)((page) - NODE_MEM_MAP(node)) < NODE_DATA(node)->node_size) ); \
})
#define LOCAL_MAP_NR(addr) \
(((unsigned long)(addr) & 0x07ffffff) >> PAGE_SHIFT)
#else
#define PHYS_TO_NID(addr) (0)
#define PFN_TO_NID(addr) (0)
#endif
......
......@@ -158,7 +158,8 @@
*
* We have the following to choose from:
* v3 - ARMv3
* v4 - ARMv4 without minicache
* v4wt - ARMv4 with writethrough cache, without minicache
* v4wb - ARMv4 with writeback cache, without minicache
* v4_mc - ARMv4 with minicache
* v5te_mc - ARMv5TE with minicache
*/
......@@ -173,13 +174,21 @@
# endif
#endif
#if defined(CONFIG_CPU_ARM720T) || defined(CONFIG_CPU_ARM920T) || \
defined(CONFIG_CPU_ARM922T) || defined(CONFIG_CPU_ARM926T) || \
defined(CONFIG_CPU_SA110) || defined(CONFIG_CPU_ARM1020)
#if defined(CONFIG_CPU_ARM720T)
# ifdef _USER
# define MULTI_USER 1
# else
# define _USER v4wt
# endif
#endif
#if defined(CONFIG_CPU_ARM920T) || defined(CONFIG_CPU_ARM922T) || \
defined(CONFIG_CPU_ARM926T) || defined(CONFIG_CPU_SA110) || \
defined(CONFIG_CPU_ARM1020)
# ifdef _USER
# define MULTI_USER 1
# else
# define _USER v4
# define _USER v4wb
# endif
#endif
......
......@@ -269,24 +269,6 @@ extern void *consistent_alloc(int gfp, size_t size, dma_addr_t *handle);
extern void consistent_free(void *vaddr, size_t size, dma_addr_t handle);
extern void consistent_sync(void *vaddr, size_t size, int rw);
/*
* Change "struct page" to physical address.
*/
#ifdef CONFIG_DISCONTIGMEM
#define page_to_phys(page) \
((((page) - page_zone(page)->zone_mem_map) << PAGE_SHIFT) \
+ page_zone(page)->zone_start_paddr)
#else
#define page_to_phys(page) \
(PHYS_OFFSET + (((page) - mem_map) << PAGE_SHIFT))
#endif
/*
* We should really eliminate virt_to_bus() here - it's depreciated.
*/
#define page_to_bus(page) \
(virt_to_bus(page_address(page)))
/*
* can the hardware map this into one segment or not, given no other
* constraints.
......
/*
* linux/include/asm-arm/memory.h
*
* Copyright (C) 2000 Russell King
* Copyright (C) 2000-2002 Russell King
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*
* Note: this file should not be included by non-asm/.h files
*
* Modifications:
*/
#ifndef __ASM_ARM_MEMORY_H
#define __ASM_ARM_MEMORY_H
#include <linux/config.h>
#include <asm/arch/memory.h>
static inline unsigned long virt_to_phys(volatile void *x)
/*
* PFNs are used to describe any physical page; this means
* PFN 0 == physical address 0.
*
* This is the PFN of the first RAM page in the kernel
* direct-mapped view. We assume this is the first page
* of RAM in the mem_map as well.
*/
#define PHYS_PFN_OFFSET (PHYS_OFFSET >> PAGE_SHIFT)
/*
* These are *only* valid on the kernel direct mapped RAM memory.
*/
static inline unsigned long virt_to_phys(void *x)
{
return __virt_to_phys((unsigned long)(x));
}
......@@ -26,10 +38,77 @@ static inline void *phys_to_virt(unsigned long x)
return (void *)(__phys_to_virt((unsigned long)(x)));
}
#define __pa(x) __virt_to_phys((unsigned long)(x))
#define __va(x) ((void *)__phys_to_virt((unsigned long)(x)))
/*
* Virtual <-> DMA view memory address translations
* Again, these are *only* valid on the kernel direct mapped RAM
* memory. Use of these is *depreciated*.
*/
#define virt_to_bus(x) (__virt_to_bus((unsigned long)(x)))
#define bus_to_virt(x) ((void *)(__bus_to_virt((unsigned long)(x))))
/*
* Conversion between a struct page and a physical address.
*
* Note: when converting an unknown physical address to a
* struct page, the resulting pointer must be validated
* using VALID_PAGE(). It must return an invalid struct page
* for any physical address not corresponding to a system
* RAM address.
*
* page_to_pfn(page) convert a struct page * to a PFN number
* pfn_to_page(pfn) convert a _valid_ PFN number to struct page *
* pfn_valid(pfn) indicates whether a PFN number is valid
*
* virt_to_page(k) convert a _valid_ virtual address to struct page *
* virt_addr_valid(k) indicates whether a virtual address is valid
*/
#ifndef CONFIG_DISCONTIGMEM
#define page_to_pfn(page) (((page) - mem_map) + PHYS_PFN_OFFSET)
#define pfn_to_page(pfn) ((mem_map + (pfn)) - PHYS_PFN_OFFSET)
#define pfn_valid(pfn) ((pfn) >= PHYS_PFN_OFFSET && (pfn) < max_mapnr)
#define virt_to_page(kaddr) (pfn_to_page(__pa(kaddr) >> PAGE_SHIFT))
#define virt_addr_valid(kaddr) ((kaddr) >= PAGE_OFFSET && (kaddr) < (unsigned long)high_memory)
#else
/*
* This is more complex. We have a set of mem_map arrays spread
* around in memory.
*/
#define page_to_pfn(page) \
(((page) - page_zone(page)->zone_mem_map) \
+ (page_zone(page)->zone_start_paddr >> PAGE_SHIFT))
#define pfn_to_page(pfn) \
(PFN_TO_MAPBASE(pfn) + LOCAL_MAP_NR((pfn) << PAGE_SHIFT))
#define pfn_valid(pfn) (PFN_TO_NID(pfn) < NR_NODES)
#define virt_to_page(kaddr) \
(ADDR_TO_MAPBASE(kaddr) + LOCAL_MAP_NR(kaddr))
#define virt_addr_valid(kaddr) (KVADDR_TO_NID(kaddr) < NR_NODES)
/*
* Common discontigmem stuff.
* PHYS_TO_NID is used by the ARM kernel/setup.c
*/
#define PHYS_TO_NID(addr) PFN_TO_NID((addr) >> PAGE_SHIFT)
#endif
/*
* For BIO. "will die". Kill me when bio_to_phys() and bvec_to_phys() die.
*/
#define page_to_phys(page) (page_to_pfn(page) << PAGE_SHIFT)
/*
* We should really eliminate virt_to_bus() here - it's depreciated.
*/
#define page_to_bus(page) (virt_to_bus(page_address(page)))
#endif
......@@ -125,18 +125,9 @@ static inline int get_order(unsigned long size)
return order;
}
#endif /* !__ASSEMBLY__ */
#include <asm/arch/memory.h>
#define __pa(x) __virt_to_phys((unsigned long)(x))
#define __va(x) ((void *)__phys_to_virt((unsigned long)(x)))
#include <asm/memory.h>
#ifndef CONFIG_DISCONTIGMEM
#define virt_to_page(kaddr) (mem_map + (__pa(kaddr) >> PAGE_SHIFT) - \
(PHYS_OFFSET >> PAGE_SHIFT))
#define VALID_PAGE(page) ((page - mem_map) < max_mapnr)
#endif
#endif /* !__ASSEMBLY__ */
#define VM_DATA_DEFAULT_FLAGS (VM_READ | VM_WRITE | VM_EXEC | \
VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC)
......
......@@ -11,7 +11,7 @@
#define _ASMARM_PGTABLE_H
#include <linux/config.h>
#include <asm/arch/memory.h>
#include <asm/memory.h>
#include <asm/arch/vmalloc.h>
/*
......@@ -79,21 +79,12 @@ extern void __pgd_error(const char *file, int line, unsigned long val);
extern struct page *empty_zero_page;
#define ZERO_PAGE(vaddr) (empty_zero_page)
#define pte_pfn(pte) (pte_val(pte) >> PAGE_SHIFT)
#define pfn_pte(pfn,prot) (__pte(((pfn) << PAGE_SHIFT) | pgprot_val(prot)))
#define pte_none(pte) (!pte_val(pte))
#define pte_clear(ptep) set_pte((ptep), __pte(0))
#ifndef CONFIG_DISCONTIGMEM
#define pte_page(x) (mem_map + (pte_val((x)) >> PAGE_SHIFT) - \
(PHYS_OFFSET >> PAGE_SHIFT))
#else
/*
* I'm not happy with this - we needlessly convert a physical address
* to a virtual one, and then immediately back to a physical address,
* which, if __va and __pa are expensive causes twice the expense for
* zero gain. --rmk
*/
#define pte_page(x) (virt_to_page(__va(pte_val((x)))))
#endif
#define pte_page(pte) (pfn_to_page(pte_pfn(pte)))
#define pmd_none(pmd) (!pmd_val(pmd))
#define pmd_present(pmd) (pmd_val(pmd))
......@@ -107,12 +98,7 @@ extern struct page *empty_zero_page;
* Conversion functions: convert a page and protection to a page entry,
* and a page entry and page directory to the page they refer to.
*/
static inline pte_t mk_pte_phys(unsigned long physpage, pgprot_t pgprot)
{
return __pte(physpage | pgprot_val(pgprot));
}
#define mk_pte(page,pgprot) mk_pte_phys(__pa(page_address(page)), pgprot)
#define mk_pte(page,prot) pfn_pte(page_to_pfn(page),prot)
/*
* The "pgd_xxx()" functions here are trivial for a folded two-level
......
......@@ -10,77 +10,12 @@
* Structure passed to kernel to tell it about the
* hardware it's running on. See linux/Documentation/arm/Setup
* for more info.
*
* NOTE:
* This file contains two ways to pass information from the boot
* loader to the kernel. The old struct param_struct is deprecated,
* but it will be kept in the kernel for 5 years from now
* (2001). This will allow boot loaders to convert to the new struct
* tag way.
*/
#ifndef __ASMARM_SETUP_H
#define __ASMARM_SETUP_H
/*
* Usage:
* - do not go blindly adding fields, add them at the end
* - when adding fields, don't rely on the address until
* a patch from me has been released
* - unused fields should be zero (for future expansion)
* - this structure is relatively short-lived - only
* guaranteed to contain useful data in setup_arch()
*/
#define COMMAND_LINE_SIZE 1024
/* This is the old deprecated way to pass parameters to the kernel */
struct param_struct {
union {
struct {
unsigned long page_size; /* 0 */
unsigned long nr_pages; /* 4 */
unsigned long ramdisk_size; /* 8 */
unsigned long flags; /* 12 */
#define FLAG_READONLY 1
#define FLAG_RDLOAD 4
#define FLAG_RDPROMPT 8
unsigned long rootdev; /* 16 */
unsigned long video_num_cols; /* 20 */
unsigned long video_num_rows; /* 24 */
unsigned long video_x; /* 28 */
unsigned long video_y; /* 32 */
unsigned long memc_control_reg; /* 36 */
unsigned char sounddefault; /* 40 */
unsigned char adfsdrives; /* 41 */
unsigned char bytes_per_char_h; /* 42 */
unsigned char bytes_per_char_v; /* 43 */
unsigned long pages_in_bank[4]; /* 44 */
unsigned long pages_in_vram; /* 60 */
unsigned long initrd_start; /* 64 */
unsigned long initrd_size; /* 68 */
unsigned long rd_start; /* 72 */
unsigned long system_rev; /* 76 */
unsigned long system_serial_low; /* 80 */
unsigned long system_serial_high; /* 84 */
unsigned long mem_fclk_21285; /* 88 */
} s;
char unused[256];
} u1;
union {
char paths[8][128];
struct {
unsigned long magic;
char n[1024 - sizeof(unsigned long)];
} s;
} u2;
char commandline[COMMAND_LINE_SIZE];
};
/*
* The new way of passing information: a list of tagged entries
*/
/* The list ends with an ATAG_NONE node. */
#define ATAG_NONE 0x00000000
......@@ -131,8 +66,15 @@ struct tag_ramdisk {
};
/* describes where the compressed ramdisk image lives */
/*
* this one accidentally used virtual addresses - as such,
* its depreciated.
*/
#define ATAG_INITRD 0x54410005
/* describes where the compressed ramdisk image lives */
#define ATAG_INITRD2 0x54420005
struct tag_initrd {
u32 start; /* physical start address */
u32 size; /* size of compressed ramdisk image in bytes */
......
......@@ -61,12 +61,12 @@ typedef struct avmb1_extcarddef {
} avmb1_extcarddef;
#define AVMB1_LOAD 0 /* load image to card */
#define AVMB1_ADDCARD 1 /* add a new card */
#define AVMB1_ADDCARD 1 /* add a new card - OBSOLETE */
#define AVMB1_RESETCARD 2 /* reset a card */
#define AVMB1_LOAD_AND_CONFIG 3 /* load image and config to card */
#define AVMB1_ADDCARD_WITH_TYPE 4 /* add a new card, with cardtype */
#define AVMB1_GET_CARDINFO 5 /* get cardtype */
#define AVMB1_REMOVECARD 6 /* remove a card (useful for T1) */
#define AVMB1_REMOVECARD 6 /* remove a card - OBSOLETE */
#define AVMB1_REGISTERCARD_IS_OBSOLETE
......
......@@ -12,7 +12,10 @@
#ifndef __CAPILLI_H__
#define __CAPILLI_H__
#include <linux/kernel.h>
#include <linux/list.h>
#include <linux/capi.h>
#include <linux/kernelcapi.h>
typedef struct capiloaddatapart {
int user; /* data in userspace ? */
......@@ -60,10 +63,6 @@ struct capi_ctr {
void (*handle_capimsg)(struct capi_ctr * card,
__u16 appl, struct sk_buff *skb);
void (*new_ncci)(struct capi_ctr * card,
__u16 appl, __u32 ncci, __u32 winsize);
void (*free_ncci)(struct capi_ctr * card, __u16 appl, __u32 ncci);
/* management information for kcapi */
unsigned long nrecvctlpkt;
......@@ -81,11 +80,10 @@ struct capi_driver {
char revision[32];
int (*load_firmware)(struct capi_ctr *, capiloaddata *);
void (*reset_ctr)(struct capi_ctr *);
void (*remove_ctr)(struct capi_ctr *);
void (*register_appl)(struct capi_ctr *, __u16 appl,
capi_register_params *);
void (*release_appl)(struct capi_ctr *, __u16 appl);
void (*send_message)(struct capi_ctr *, struct sk_buff *skb);
u16 (*send_message)(struct capi_ctr *, struct sk_buff *skb);
char *(*procinfo)(struct capi_ctr *);
int (*ctr_read_proc)(char *page, char **start, off_t off,
......@@ -93,8 +91,6 @@ struct capi_driver {
int (*driver_read_proc)(char *page, char **start, off_t off,
int count, int *eof, struct capi_driver *driver);
int (*add_card)(struct capi_driver *driver, capicardparams *data);
/* intitialized by kcapi */
struct list_head contr_head; /* list of controllers */
struct list_head driver_list;
......@@ -109,4 +105,16 @@ void detach_capi_driver(struct capi_driver *driver);
struct capi_ctr *attach_capi_ctr(struct capi_driver *driver, char *name, void *data);
int detach_capi_ctr(struct capi_ctr *);
// ---------------------------------------------------------------------------
// library functions for use by hardware controller drivers
void capilib_new_ncci(struct list_head *head, u16 applid, u32 ncci, u32 winsize);
void capilib_free_ncci(struct list_head *head, u16 applid, u32 ncci);
void capilib_release_appl(struct list_head *head, u16 applid);
void capilib_release(struct list_head *head);
void capilib_data_b3_conf(struct list_head *head, u16 applid, u32 ncci, u16 msgid);
u16 capilib_data_b3_req(struct list_head *head, u16 applid, u32 ncci, u16 msgid);
#endif /* __CAPILLI_H__ */
......@@ -32,7 +32,7 @@ typedef struct kcapi_carddef {
/* new ioctls >= 10 */
#define KCAPI_CMD_TRACE 10
#define KCAPI_CMD_ADDCARD 11 /* add card to named driver */
#define KCAPI_CMD_ADDCARD 11 /* OBSOLETE */
/*
* flag > 2 => trace also data
......@@ -47,6 +47,8 @@ typedef struct kcapi_carddef {
#ifdef __KERNEL__
#include <linux/skbuff.h>
struct capi_interface {
__u16 (*capi_isinstalled) (void);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment