Commit 1f421cf6 authored by Anton Blanchard's avatar Anton Blanchard

Merge samba.org:/scratch/anton/linux-2.5

into samba.org:/scratch/anton/linux-2.5_ppc64_work
parents a94a71d6 828bb5f4
...@@ -156,6 +156,14 @@ S: University of Calgary ...@@ -156,6 +156,14 @@ S: University of Calgary
S: Calgary, Alberta S: Calgary, Alberta
S: Canada S: Canada
N: Miles Bader
E: miles@gnu.org
D: v850 port (uClinux)
S: NEC Corporation
S: 1753 Shimonumabe, Nakahara-ku
S: Kawasaki 211-8666
S: Japan
N: Ralf Baechle N: Ralf Baechle
E: ralf@gnu.org E: ralf@gnu.org
P: 1024/AF7B30C1 CF 97 C2 CC 6D AE A7 FE C8 BA 9C FC 88 DE 32 C3 P: 1024/AF7B30C1 CF 97 C2 CC 6D AE A7 FE C8 BA 9C FC 88 DE 32 C3
......
...@@ -27,7 +27,7 @@ create_params (unsigned long *buffer) ...@@ -27,7 +27,7 @@ create_params (unsigned long *buffer)
/* Head of the taglist */ /* Head of the taglist */
tag->hdr.tag = ATAG_CORE; tag->hdr.tag = ATAG_CORE;
tag->hdr.size = tag_size(tag_core); tag->hdr.size = tag_size(tag_core);
tag->u.core.flags = FLAG_READONLY; tag->u.core.flags = 1;
tag->u.core.pagesize = PAGE_SIZE; tag->u.core.pagesize = PAGE_SIZE;
tag->u.core.rootdev = 0; tag->u.core.rootdev = 0;
......
This diff is collapsed.
...@@ -17,7 +17,6 @@ ...@@ -17,7 +17,6 @@
#include <linux/personality.h> #include <linux/personality.h>
#include <linux/stddef.h> #include <linux/stddef.h>
#include <linux/signal.h> #include <linux/signal.h>
#include <linux/sched.h>
#include <linux/init.h> #include <linux/init.h>
#include <asm/ptrace.h> #include <asm/ptrace.h>
...@@ -64,13 +63,13 @@ static void arthur_lcall7(int nr, struct pt_regs *regs) ...@@ -64,13 +63,13 @@ static void arthur_lcall7(int nr, struct pt_regs *regs)
} }
static struct exec_domain arthur_exec_domain = { static struct exec_domain arthur_exec_domain = {
"Arthur", /* name */ .name = "Arthur",
arthur_lcall7, .handler = arthur_lcall7,
PER_RISCOS, PER_RISCOS, .pers_low = PER_RISCOS,
arthur_to_linux_signals, .pers_high = PER_RISCOS,
linux_to_arthur_signals, .signal_map = arthur_to_linux_signals,
THIS_MODULE, .signal_invmap = linux_to_arthur_signals,
NULL /* Nothing after this in the list. */ .module = THIS_MODULE,
}; };
/* /*
...@@ -78,12 +77,12 @@ static struct exec_domain arthur_exec_domain = { ...@@ -78,12 +77,12 @@ static struct exec_domain arthur_exec_domain = {
* processes are using it. * processes are using it.
*/ */
int __init arthur_init(void) static int __init arthur_init(void)
{ {
return register_exec_domain(&arthur_exec_domain); return register_exec_domain(&arthur_exec_domain);
} }
void __exit arthur_exit(void) static void __exit arthur_exit(void)
{ {
unregister_exec_domain(&arthur_exec_domain); unregister_exec_domain(&arthur_exec_domain);
} }
......
...@@ -20,7 +20,7 @@ static int ...@@ -20,7 +20,7 @@ static int
via82c505_read_config(struct pci_bus *bus, unsigned int devfn, int where, via82c505_read_config(struct pci_bus *bus, unsigned int devfn, int where,
int size, u32 *value) int size, u32 *value)
{ {
outl(CONFIG_CMD(dev,where),0xCF8); outl(CONFIG_CMD(bus,devfn,where),0xCF8);
switch (size) { switch (size) {
case 1: case 1:
*value=inb(0xCFC + (where&3)); *value=inb(0xCFC + (where&3));
...@@ -36,7 +36,7 @@ via82c505_read_config(struct pci_bus *bus, unsigned int devfn, int where, ...@@ -36,7 +36,7 @@ via82c505_read_config(struct pci_bus *bus, unsigned int devfn, int where,
} }
static int static int
via82c505_write_config(struct pci_bus *bus, unsigned int devfn, int where via82c505_write_config(struct pci_bus *bus, unsigned int devfn, int where,
int size, u32 value) int size, u32 value)
{ {
outl(CONFIG_CMD(bus,devfn,where),0xCF8); outl(CONFIG_CMD(bus,devfn,where),0xCF8);
...@@ -61,8 +61,6 @@ static struct pci_ops via82c505_ops = { ...@@ -61,8 +61,6 @@ static struct pci_ops via82c505_ops = {
void __init via82c505_preinit(void *sysdata) void __init via82c505_preinit(void *sysdata)
{ {
struct pci_bus *bus;
printk(KERN_DEBUG "PCI: VIA 82c505\n"); printk(KERN_DEBUG "PCI: VIA 82c505\n");
if (!request_region(0xA8,2,"via config")) { if (!request_region(0xA8,2,"via config")) {
printk(KERN_WARNING"VIA 82c505: Unable to request region 0xA8\n"); printk(KERN_WARNING"VIA 82c505: Unable to request region 0xA8\n");
......
...@@ -305,7 +305,7 @@ static struct cpufreq_driver sa1110_driver = { ...@@ -305,7 +305,7 @@ static struct cpufreq_driver sa1110_driver = {
.verify = sa11x0_verify_speed, .verify = sa11x0_verify_speed,
.setpolicy = sa1110_setspeed, .setpolicy = sa1110_setspeed,
.policy = &sa1110_policy, .policy = &sa1110_policy,
.cpu_min_freq[0] = 59000, .cpu_min_freq = { 59000, },
}; };
static int __init sa1110_clk_init(void) static int __init sa1110_clk_init(void)
......
...@@ -21,5 +21,5 @@ extern void sa1110_mb_disable(void); ...@@ -21,5 +21,5 @@ extern void sa1110_mb_disable(void);
struct cpufreq_policy; struct cpufreq_policy;
extern unsigned int sa11x0_freq_to_ppcr(unsigned int khz); extern unsigned int sa11x0_freq_to_ppcr(unsigned int khz);
extern void sa11x0_verify_speed(struct cpufreq_policy *policy); extern int sa11x0_verify_speed(struct cpufreq_policy *policy);
extern unsigned int sa11x0_getspeed(void); extern unsigned int sa11x0_getspeed(void);
This diff is collapsed.
...@@ -63,6 +63,8 @@ menu "Processor type and features" ...@@ -63,6 +63,8 @@ menu "Processor type and features"
bool "NA85E2C-FPGA" bool "NA85E2C-FPGA"
config V850E2_ANNA config V850E2_ANNA
bool "Anna" bool "Anna"
config V850E_AS85EP1
bool "AS85EP1"
endchoice endchoice
......
...@@ -22,6 +22,9 @@ CFLAGS += -ffixed-r16 -mno-prolog-function ...@@ -22,6 +22,9 @@ CFLAGS += -ffixed-r16 -mno-prolog-function
CFLAGS += -fno-builtin CFLAGS += -fno-builtin
CFLAGS += -D__linux__ -DUTS_SYSNAME=\"uClinux\" CFLAGS += -D__linux__ -DUTS_SYSNAME=\"uClinux\"
LDFLAGS_BLOB := -b binary --oformat elf32-little
OBJCOPY_FLAGS_BLOB := -I binary -O elf32-little -B v850e
HEAD := $(arch_dir)/kernel/head.o $(arch_dir)/kernel/init_task.o HEAD := $(arch_dir)/kernel/head.o $(arch_dir)/kernel/init_task.o
core-y += $(arch_dir)/kernel/ core-y += $(arch_dir)/kernel/
...@@ -40,10 +43,8 @@ core-y += root_fs_image.o ...@@ -40,10 +43,8 @@ core-y += root_fs_image.o
# This results in it being built anew each time, but that's alright. # This results in it being built anew each time, but that's alright.
root_fs_image.o: root_fs_image_force root_fs_image.o: root_fs_image_force
# Note that we use the build-system's objcopy, as the v850 tools are fairly
# old, and don't have the --rename-section option.
root_fs_image_force: $(ROOT_FS_IMAGE) root_fs_image_force: $(ROOT_FS_IMAGE)
objcopy -I binary -O elf32-little -B i386 --rename-section .data=.root,alloc,load,readonly,data,contents $< root_fs_image.o $(OBJCOPY) $(OBJCOPY_FLAGS_BLOB) --rename-section .data=.root,alloc,load,readonly,data,contents $< root_fs_image.o
endif endif
......
...@@ -80,6 +80,11 @@ SECTIONS { ...@@ -80,6 +80,11 @@ SECTIONS {
__root_fs_image_start = . ; __root_fs_image_start = . ;
*(.root) *(.root)
__root_fs_image_end = . ; __root_fs_image_end = . ;
. = ALIGN (4) ;
___initramfs_start = . ;
*(.init.ramfs)
___initramfs_end = . ;
} > ROM } > ROM
__rom_copy_src_start = . ; __rom_copy_src_start = . ;
......
...@@ -103,6 +103,12 @@ SECTIONS { ...@@ -103,6 +103,12 @@ SECTIONS {
*(.initcall7.init) *(.initcall7.init)
. = ALIGN (4) ; . = ALIGN (4) ;
___initcall_end = . ; ___initcall_end = . ;
. = ALIGN (4) ;
___initramfs_start = . ;
*(.init.ramfs)
___initramfs_end = . ;
__init_end = . ; __init_end = . ;
__kram_end = . ; __kram_end = . ;
......
/* Linker script for the NEC AS85EP1 V850E evaluation board
(CONFIG_V850E_AS85EP1). */
/* Note, all symbols are prefixed with an extra `_' for compatibility with
the existing linux sources. */
_jiffies = _jiffies_64 ;
MEMORY {
/* 1MB of internal memory ($BFbB"L?Na(BRAM). */
iMEM0 : ORIGIN = 0, LENGTH = 0x00100000
/* 1MB of static RAM. */
SRAM : ORIGIN = 0x00400000, LENGTH = 0x00100000
/* About 58MB of DRAM. This can actually be at one of two positions,
determined by jump JP3; we have to use the first position because the
second is partially out of processor instruction addressing range
(though in the second position there's actually 64MB available). */
SDRAM : ORIGIN = 0x00600000, LENGTH = 0x039F8000
}
SECTIONS {
.resetv : {
__intv_start = . ;
*(.intv.reset) /* Reset vector */
} > iMEM0
.text : {
__kram_start = . ;
__stext = . ;
*(.text)
*(.exit.text) /* 2.5 convention */
*(.text.exit) /* 2.4 convention */
*(.text.lock)
*(.exitcall.exit)
__real_etext = . ; /* There may be data after here. */
*(.rodata)
. = ALIGN (0x4) ;
*(.kstrtab)
. = ALIGN (4) ;
*(.call_table_data)
*(.call_table_text)
. = ALIGN (16) ; /* Exception table. */
___start___ex_table = . ;
*(__ex_table)
___stop___ex_table = . ;
___start___ksymtab = . ;/* Kernel symbol table. */
*(__ksymtab)
___stop___ksymtab = . ;
. = ALIGN (4) ;
__etext = . ;
} > SRAM
.data ALIGN (0x4) : {
__sdata = . ;
___data_start = . ;
*(.data)
*(.exit.data) /* 2.5 convention */
*(.data.exit) /* 2.4 convention */
. = ALIGN (16) ;
*(.data.cacheline_aligned)
. = ALIGN (0x2000) ;
*(.data.init_task)
. = ALIGN (0x2000) ;
__edata = . ;
} > SRAM
.bss ALIGN (0x4) : {
__sbss = . ;
*(.bss)
*(COMMON)
. = ALIGN (4) ;
__init_stack_end = . ;
__ebss = . ;
} > SRAM
.init ALIGN (4096) : {
__init_start = . ;
*(.init.text) /* 2.5 convention */
*(.init.data)
*(.text.init) /* 2.4 convention */
*(.data.init)
. = ALIGN (16) ;
___setup_start = . ;
*(.init.setup) /* 2.5 convention */
*(.setup.init) /* 2.4 convention */
___setup_end = . ;
___initcall_start = . ;
*(.initcall.init)
*(.initcall1.init)
*(.initcall2.init)
*(.initcall3.init)
*(.initcall4.init)
*(.initcall5.init)
*(.initcall6.init)
*(.initcall7.init)
. = ALIGN (4) ;
___initcall_end = . ;
. = ALIGN (4) ;
___initramfs_start = . ;
*(.init.ramfs)
___initramfs_end = . ;
/* We stick most of the interrupt vectors here; they'll be
copied into the proper location by the early init code (we
can't put them directly in the right place because of
hardware bugs). The vectors shouldn't need to be
relocated, so we don't have to use `> ... AT> ...' to
split the load/vm addresses (and we can't because of
problems with the loader). */
. = ALIGN (0x10) ;
__intv_copy_src_start = . ;
*(.intv.common) /* Vectors common to all v850e proc. */
*(.intv.mach) /* Machine-specific int. vectors. */
. = ALIGN (0x10) ;
__intv_copy_src_end = . ;
/* This is here so that when we free init memory, the initial
load-area of the interrupt vectors is freed too. */
__init_end = . ;
__kram_end = . ;
__bootmap = . ;
. = . + 4096 ; /* enough for 128MB. */
} > SRAM
/* Where we end up putting the vectors. */
__intv_copy_dst_start = 0x10 ;
__intv_copy_dst_end = __intv_copy_dst_start + (__intv_copy_src_end - __intv_copy_src_start) ;
__intv_end = __intv_copy_dst_end ;
/* Device contents for the root filesystem. */
.root : {
. = ALIGN (4096) ;
__root_fs_image_start = . ;
*(.root)
__root_fs_image_end = . ;
} > SDRAM
}
...@@ -15,11 +15,12 @@ obj-y += intv.o entry.o process.o syscalls.o time.o semaphore.o setup.o \ ...@@ -15,11 +15,12 @@ obj-y += intv.o entry.o process.o syscalls.o time.o semaphore.o setup.o \
signal.o irq.o mach.o ptrace.o bug.o signal.o irq.o mach.o ptrace.o bug.o
export-objs += v850_ksyms.o rte_mb_a_pci.o export-objs += v850_ksyms.o rte_mb_a_pci.o
obj-$(CONFIG_MODULES) += v850_ksyms.o obj-$(CONFIG_MODULES) += module.o v850_ksyms.o
# chip-specific code # chip-specific code
obj-$(CONFIG_V850E_MA1) += ma.o nb85e_utils.o nb85e_timer_d.o obj-$(CONFIG_V850E_MA1) += ma.o nb85e_utils.o nb85e_timer_d.o
obj-$(CONFIG_V850E_NB85E) += nb85e_intc.o obj-$(CONFIG_V850E_NB85E) += nb85e_intc.o
obj-$(CONFIG_V850E2_ANNA) += anna.o nb85e_intc.o nb85e_utils.o nb85e_timer_d.o obj-$(CONFIG_V850E2_ANNA) += anna.o nb85e_intc.o nb85e_utils.o nb85e_timer_d.o
obj-$(CONFIG_V850E_AS85EP1) += as85ep1.o nb85e_intc.o nb85e_utils.o nb85e_timer_d.o
# platform-specific code # platform-specific code
obj-$(CONFIG_V850E_SIM) += sim.o simcons.o obj-$(CONFIG_V850E_SIM) += sim.o simcons.o
obj-$(CONFIG_V850E2_SIM85E2C) += sim85e2c.o nb85e_intc.o memcons.o obj-$(CONFIG_V850E2_SIM85E2C) += sim85e2c.o nb85e_intc.o memcons.o
......
...@@ -27,11 +27,14 @@ ...@@ -27,11 +27,14 @@
#include "mach.h" #include "mach.h"
/* SRAM and SDRAM are vaguely contiguous (with a hole in between; see /* SRAM and SDRAM are vaguely contiguous (with a big hole in between; see
mach_reserve_bootmem for details), so just use both as one big area. */ mach_reserve_bootmem for details); use both as one big area. */
#define RAM_START SRAM_ADDR #define RAM_START SRAM_ADDR
#define RAM_END (SDRAM_ADDR + SDRAM_SIZE) #define RAM_END (SDRAM_ADDR + SDRAM_SIZE)
/* The bits of this port are connected to an 8-LED bar-graph. */
#define LEDS_PORT 0
static void anna_led_tick (void); static void anna_led_tick (void);
...@@ -44,7 +47,7 @@ void __init mach_early_init (void) ...@@ -44,7 +47,7 @@ void __init mach_early_init (void)
ANNA_BPC = 0; ANNA_BPC = 0;
ANNA_BSC = 0xAAAA; ANNA_BSC = 0xAAAA;
ANNA_BEC = 0; ANNA_BEC = 0;
ANNA_BHC = 0x00FF; /* icache all memory, dcache none */ ANNA_BHC = 0xFFFF; /* icache all memory, dcache all */
ANNA_BCT(0) = 0xB088; ANNA_BCT(0) = 0xB088;
ANNA_BCT(1) = 0x0008; ANNA_BCT(1) = 0x0008;
ANNA_DWC(0) = 0x0027; ANNA_DWC(0) = 0x0027;
...@@ -60,17 +63,11 @@ void __init mach_early_init (void) ...@@ -60,17 +63,11 @@ void __init mach_early_init (void)
void __init mach_setup (char **cmdline) void __init mach_setup (char **cmdline)
{ {
printk (KERN_INFO
"CPU: %s\n"
"Platform: %s\n",
CPU_MODEL_LONG,
PLATFORM_LONG);
#ifdef CONFIG_V850E_NB85E_UART_CONSOLE #ifdef CONFIG_V850E_NB85E_UART_CONSOLE
nb85e_uart_cons_init (1); nb85e_uart_cons_init (1);
#endif #endif
ANNA_PORT_PM (0) = 0; /* Make all LED pins output pins. */ ANNA_PORT_PM (LEDS_PORT) = 0; /* Make all LED pins output pins. */
mach_tick = anna_led_tick; mach_tick = anna_led_tick;
} }
...@@ -138,7 +135,7 @@ void machine_halt (void) ...@@ -138,7 +135,7 @@ void machine_halt (void)
disable_reset_guard (); disable_reset_guard ();
#endif #endif
local_irq_disable (); /* Ignore all interrupts. */ local_irq_disable (); /* Ignore all interrupts. */
ANNA_PORT_IO(0) = 0xAA; /* Note that we halted. */ ANNA_PORT_IO(LEDS_PORT) = 0xAA; /* Note that we halted. */
for (;;) for (;;)
asm ("halt; nop; nop; nop; nop; nop"); asm ("halt; nop; nop; nop; nop; nop");
} }
...@@ -191,9 +188,9 @@ static void anna_led_tick () ...@@ -191,9 +188,9 @@ static void anna_led_tick ()
if (pos + dir <= max_pos) { if (pos + dir <= max_pos) {
/* Each bit of port 0 has a LED. */ /* Each bit of port 0 has a LED. */
clear_bit (pos, &ANNA_PORT_IO(0)); clear_bit (pos, &ANNA_PORT_IO(LEDS_PORT));
pos += dir; pos += dir;
set_bit (pos, &ANNA_PORT_IO(0)); set_bit (pos, &ANNA_PORT_IO(LEDS_PORT));
} }
} }
......
/*
* arch/v850/kernel/as85ep1.c -- AS85EP1 V850E evaluation chip/board
*
* Copyright (C) 2002 NEC Corporation
* Copyright (C) 2002 Miles Bader <miles@gnu.org>
*
* This file is subject to the terms and conditions of the GNU General
* Public License. See the file COPYING in the main directory of this
* archive for more details.
*
* Written by Miles Bader <miles@gnu.org>
*/
#include <linux/config.h>
#include <linux/kernel.h>
#include <linux/init.h>
#include <linux/bootmem.h>
#include <linux/major.h>
#include <linux/irq.h>
#include <asm/machdep.h>
#include <asm/atomic.h>
#include <asm/page.h>
#include <asm/nb85e_timer_d.h>
#include <asm/nb85e_uart.h>
#include "mach.h"
/* SRAM and SDRAM are vaguely contiguous (with a big hole in between; see
mach_reserve_bootmem for details); use both as one big area. */
#define RAM_START SRAM_ADDR
#define RAM_END (SDRAM_ADDR + SDRAM_SIZE)
/* The bits of this port are connected to an 8-LED bar-graph. */
#define LEDS_PORT 4
static void as85ep1_led_tick (void);
extern char _intv_copy_src_start, _intv_copy_src_end;
extern char _intv_copy_dst_start;
void __init mach_early_init (void)
{
const u32 *src;
register u32 *dst asm ("ep");
AS85EP1_CSC(0) = 0x0403;
AS85EP1_BCT(0) = 0xB8B8;
AS85EP1_DWC(0) = 0x0104;
AS85EP1_BCC = 0x0012;
AS85EP1_ASC = 0;
AS85EP1_LBS = 0x00A9;
AS85EP1_RFS(1) = 0x8205;
AS85EP1_RFS(3) = 0x8205;
AS85EP1_SCR(1) = 0x20A9;
AS85EP1_SCR(3) = 0x20A9;
AS85EP1_PORT_PMC(6) = 0xFF; /* A20-25, A0,A1 $BM-8z(B */
AS85EP1_PORT_PMC(7) = 0x0E; /* CS1,2,3 $BM-8z(B */
AS85EP1_PORT_PMC(9) = 0xFF; /* D16-23 $BM-8z(B */
AS85EP1_PORT_PMC(10) = 0xFF; /* D24-31 $BM-8z(B */
AS85EP1_IRAMM = 0x3; /* $BFbB"L?Na(BRAM$B$O!V(Bwrite-mode$B!W$K$J$j$^$9(B */
/* The early chip we have is buggy, so that writing the interrupt
vectors into low RAM may screw up, so for non-ROM kernels, we
only rely on the reset vector being downloaded, and copy the
rest of the interrupt vectors into place here. The specific bug
is that writing address N, where (N & 0x10) == 0x10, will _also_
write to address (N - 0x10). We avoid this (effectively) by
writing in 16-byte chunks backwards from the end. */
src = (u32 *)(((u32)&_intv_copy_src_end - 1) & ~0xF);
dst = (u32 *)&_intv_copy_dst_start
+ (src - (u32 *)&_intv_copy_src_start);
do {
u32 t0 = src[0], t1 = src[1], t2 = src[2], t3 = src[3];
dst[0] = t0; dst[1] = t1; dst[2] = t2; dst[3] = t3;
dst -= 4;
src -= 4;
} while (src > (u32 *)&_intv_copy_src_start);
AS85EP1_IRAMM = 0x0; /* $BFbB"L?Na(BRAM$B$O!V(Bread-mode$B!W$K$J$j$^$9(B */
nb85e_intc_disable_irqs ();
}
void __init mach_setup (char **cmdline)
{
#ifdef CONFIG_V850E_NB85E_UART_CONSOLE
nb85e_uart_cons_init (1);
#endif
AS85EP1_PORT_PMC (LEDS_PORT) = 0; /* Make the LEDs port an I/O port. */
AS85EP1_PORT_PM (LEDS_PORT) = 0; /* Make all the bits output pins. */
mach_tick = as85ep1_led_tick;
ROOT_DEV = MKDEV (BLKMEM_MAJOR, 0);
}
void __init mach_get_physical_ram (unsigned long *ram_start,
unsigned long *ram_len)
{
*ram_start = RAM_START;
*ram_len = RAM_END - RAM_START;
}
void __init mach_reserve_bootmem ()
{
extern char _root_fs_image_start, _root_fs_image_end;
u32 root_fs_image_start = (u32)&_root_fs_image_start;
u32 root_fs_image_end = (u32)&_root_fs_image_end;
/* We can't use the space between SRAM and SDRAM, so prevent the
kernel from trying. */
reserve_bootmem (SRAM_ADDR + SRAM_SIZE,
SDRAM_ADDR - (SRAM_ADDR + SRAM_SIZE));
/* Reserve the memory used by the root filesystem image if it's
in RAM. */
if (root_fs_image_end > root_fs_image_start
&& root_fs_image_start >= RAM_START
&& root_fs_image_start < RAM_END)
reserve_bootmem (root_fs_image_start,
root_fs_image_end - root_fs_image_start);
}
void mach_gettimeofday (struct timeval *tv)
{
tv->tv_sec = 0;
tv->tv_usec = 0;
}
void __init mach_sched_init (struct irqaction *timer_action)
{
/* Start hardware timer. */
nb85e_timer_d_configure (0, HZ);
/* Install timer interrupt handler. */
setup_irq (IRQ_INTCMD(0), timer_action);
}
static struct nb85e_intc_irq_init irq_inits[] = {
{ "IRQ", 0, NUM_MACH_IRQS, 1, 7 },
{ "CCC", IRQ_INTCCC(0), IRQ_INTCCC_NUM, 1, 5 },
{ "CMD", IRQ_INTCMD(0), IRQ_INTCMD_NUM, 1, 5 },
{ "SRE", IRQ_INTSRE(0), IRQ_INTSRE_NUM, 3, 3 },
{ "SR", IRQ_INTSR(0), IRQ_INTSR_NUM, 3, 4 },
{ "ST", IRQ_INTST(0), IRQ_INTST_NUM, 3, 5 },
{ 0 }
};
#define NUM_IRQ_INITS ((sizeof irq_inits / sizeof irq_inits[0]) - 1)
static struct hw_interrupt_type hw_itypes[NUM_IRQ_INITS];
void __init mach_init_irqs (void)
{
nb85e_intc_init_irq_types (irq_inits, hw_itypes);
}
void machine_restart (char *__unused)
{
#ifdef CONFIG_RESET_GUARD
disable_reset_guard ();
#endif
asm ("jmp r0"); /* Jump to the reset vector. */
}
void machine_halt (void)
{
#ifdef CONFIG_RESET_GUARD
disable_reset_guard ();
#endif
local_irq_disable (); /* Ignore all interrupts. */
AS85EP1_PORT_IO (LEDS_PORT) = 0xAA; /* Note that we halted. */
for (;;)
asm ("halt; nop; nop; nop; nop; nop");
}
void machine_power_off (void)
{
machine_halt ();
}
/* Called before configuring an on-chip UART. */
void as85ep1_uart_pre_configure (unsigned chan, unsigned cflags, unsigned baud)
{
/* Make the shared uart/port pins be uart pins. */
AS85EP1_PORT_PMC(3) |= (0x5 << chan);
/* The AS85EP1 connects some general-purpose I/O pins on the CPU to
the RTS/CTS lines of UART 1's serial connection. I/O pins P53
and P54 are RTS and CTS respectively. */
if (chan == 1) {
/* Put P53 & P54 in I/O port mode. */
AS85EP1_PORT_PMC(5) &= ~0x18;
/* Make P53 an output, and P54 an input. */
AS85EP1_PORT_PM(5) |= 0x10;
}
}
/* Minimum and maximum bounds for the moving upper LED boundary in the
clock tick display. */
#define MIN_MAX_POS 0
#define MAX_MAX_POS 7
/* There are MAX_MAX_POS^2 - MIN_MAX_POS^2 cycles in the animation, so if
we pick 6 and 0 as above, we get 49 cycles, which is when divided into
the standard 100 value for HZ, gives us an almost 1s total time. */
#define TICKS_PER_FRAME \
(HZ / (MAX_MAX_POS * MAX_MAX_POS - MIN_MAX_POS * MIN_MAX_POS))
static void as85ep1_led_tick ()
{
static unsigned counter = 0;
if (++counter == TICKS_PER_FRAME) {
static int pos = 0, max_pos = MAX_MAX_POS, dir = 1;
if (dir > 0 && pos == max_pos) {
dir = -1;
if (max_pos == MIN_MAX_POS)
max_pos = MAX_MAX_POS;
else
max_pos--;
} else {
if (dir < 0 && pos == 0)
dir = 1;
if (pos + dir <= max_pos) {
/* Each bit of port 0 has a LED. */
set_bit (pos, &AS85EP1_PORT_IO(LEDS_PORT));
pos += dir;
clear_bit (pos, &AS85EP1_PORT_IO(LEDS_PORT));
}
}
counter = 0;
}
}
...@@ -60,3 +60,76 @@ void unexpected_reset (unsigned long ret_addr, unsigned long kmode, ...@@ -60,3 +60,76 @@ void unexpected_reset (unsigned long ret_addr, unsigned long kmode,
machine_halt (); machine_halt ();
} }
#endif /* CONFIG_RESET_GUARD */ #endif /* CONFIG_RESET_GUARD */
struct spec_reg_name {
const char *name;
int gpr;
};
struct spec_reg_name spec_reg_names[] = {
{ "sp", GPR_SP },
{ "gp", GPR_GP },
{ "tp", GPR_TP },
{ "ep", GPR_EP },
{ "lp", GPR_LP },
{ 0, 0 }
};
void show_regs (struct pt_regs *regs)
{
int gpr_base, gpr_offs;
printk (" pc 0x%08lx psw 0x%08lx kernel_mode %d\n",
regs->pc, regs->psw, regs->kernel_mode);
printk (" ctpc 0x%08lx ctpsw 0x%08lx ctbp 0x%08lx\n",
regs->ctpc, regs->ctpsw, regs->ctbp);
for (gpr_base = 0; gpr_base < NUM_GPRS; gpr_base += 4) {
for (gpr_offs = 0; gpr_offs < 4; gpr_offs++) {
int gpr = gpr_base + gpr_offs;
long val = regs->gpr[gpr];
struct spec_reg_name *srn;
for (srn = spec_reg_names; srn->name; srn++)
if (srn->gpr == gpr)
break;
if (srn->name)
printk ("%7s 0x%08lx", srn->name, val);
else
printk (" r%02d 0x%08lx", gpr, val);
}
printk ("\n");
}
}
void show_stack (unsigned long *sp)
{
unsigned long end;
unsigned long addr = (unsigned long)sp;
if (! addr)
addr = stack_addr ();
addr = addr & ~3;
end = (addr + THREAD_SIZE - 1) & THREAD_MASK;
while (addr < end) {
printk ("%8lX: ", addr);
while (addr < end) {
printk (" %8lX", *(unsigned long *)addr);
addr += sizeof (unsigned long);
if (! (addr & 0xF))
break;
}
printk ("\n");
}
}
void dump_stack ()
{
show_stack (0);
}
...@@ -657,6 +657,12 @@ G_ENTRY(irq): ...@@ -657,6 +657,12 @@ G_ENTRY(irq):
shl 16, r6 // clear upper 16 bits shl 16, r6 // clear upper 16 bits
shr 20, r6 // shift back, and remove lower nibble shr 20, r6 // shift back, and remove lower nibble
add -8, r6 // remove bias for irqs add -8, r6 // remove bias for irqs
// If the IRQ index is negative, it's actually one of the exception
// traps below 0x80 (currently, the illegal instruction trap, and
// the `debug trap'). Handle these separately.
bn exception
// Call the high-level interrupt handling code. // Call the high-level interrupt handling code.
jarl CSYM(handle_irq), lp jarl CSYM(handle_irq), lp
// fall through // fall through
...@@ -665,6 +671,23 @@ G_ENTRY(irq): ...@@ -665,6 +671,23 @@ G_ENTRY(irq):
handlers, below). */ handlers, below). */
ret_from_irq: ret_from_irq:
RETURN(IRQ) RETURN(IRQ)
exception:
mov hilo(ret_from_irq), lp // where the handler should return
cmp -2, r6
bne 1f
// illegal instruction exception
addi SIGILL, r0, r6 // Arg 0: signal number
mov CURRENT_TASK, r7 // Arg 1: task
jr CSYM(force_sig) // tail call
1: cmp -1, r6
bne bad_trap_wrapper
// `dbtrap' exception
movea PTO, sp, r6 // Arg 0: user regs
jr CSYM(debug_trap) // tail call
END(irq) END(irq)
...@@ -692,44 +715,7 @@ G_ENTRY(nmi): ...@@ -692,44 +715,7 @@ G_ENTRY(nmi):
jarl CSYM(handle_irq), lp jarl CSYM(handle_irq), lp
RETURN(NMI) RETURN(NMI)
END(nmi0) END(nmi)
/*
* Illegal instruction trap.
*
* The stack-pointer (r3) should have already been saved to the memory
* location ENTRY_SP (the reason for this is that the interrupt vectors may be
* beyond a 22-bit signed offset jump from the actual interrupt handler, and
* this allows them to save the stack-pointer and use that register to do an
* indirect jump).
*/
G_ENTRY(illegal_instruction):
SAVE_STATE (IRQ, r0, ENTRY_SP) // Save registers.
ei
addi SIGILL, r0, r6 // Arg 0: signal number
mov CURRENT_TASK, r7 // Arg 1: task
mov hilo(ret_from_irq), lp // where the handler should return
jr CSYM(force_sig)
END(illegal_instruction)
/*
* `Debug' trap
*
* The stack-pointer (r3) should have already been saved to the memory
* location ENTRY_SP (the reason for this is that the interrupt vectors may be
* beyond a 22-bit signed offset jump from the actual interrupt handler, and
* this allows them to save the stack-pointer and use that register to do an
* indirect jump).
*/
G_ENTRY(dbtrap):
SAVE_STATE (IRQ, r0, ENTRY_SP) // Save registers.
ei
movea PTO, sp, r6 // Arg 0: user regs
mov hilo(ret_from_irq), lp // where the handler should return
jr CSYM(debug_trap)
END(dbtrap)
/* /*
...@@ -771,8 +757,7 @@ C_END(switch_thread) ...@@ -771,8 +757,7 @@ C_END(switch_thread)
.data .data
.align 4 .align 4
.globl CSYM(trap_table) C_DATA(trap_table):
CSYM(trap_table):
.long bad_trap_wrapper // trap 0, doesn't use trap table. .long bad_trap_wrapper // trap 0, doesn't use trap table.
.long syscall_long // trap 1, `long' syscall. .long syscall_long // trap 1, `long' syscall.
.long bad_trap_wrapper .long bad_trap_wrapper
...@@ -789,13 +774,13 @@ CSYM(trap_table): ...@@ -789,13 +774,13 @@ CSYM(trap_table):
.long bad_trap_wrapper .long bad_trap_wrapper
.long bad_trap_wrapper .long bad_trap_wrapper
.long bad_trap_wrapper .long bad_trap_wrapper
C_END(trap_table)
.section .rodata .section .rodata
.align 4 .align 4
.globl CSYM(sys_call_table) C_DATA(sys_call_table):
CSYM(sys_call_table):
.long CSYM(sys_ni_syscall) // 0 - old "setup()" system call .long CSYM(sys_ni_syscall) // 0 - old "setup()" system call
.long CSYM(sys_exit) .long CSYM(sys_exit)
.long sys_fork_wrapper .long sys_fork_wrapper
...@@ -923,10 +908,10 @@ CSYM(sys_call_table): ...@@ -923,10 +908,10 @@ CSYM(sys_call_table):
.long CSYM(sys_adjtimex) .long CSYM(sys_adjtimex)
.long CSYM(sys_ni_syscall) // 125 - sys_mprotect .long CSYM(sys_ni_syscall) // 125 - sys_mprotect
.long CSYM(sys_sigprocmask) .long CSYM(sys_sigprocmask)
.long CSYM(sys_create_module) .long CSYM(sys_ni_syscall) // sys_create_module
.long CSYM(sys_init_module) .long CSYM(sys_init_module)
.long CSYM(sys_delete_module) .long CSYM(sys_delete_module)
.long CSYM(sys_get_kernel_syms) // 130 .long CSYM(sys_ni_syscall) // 130 - sys_get_kernel_syms
.long CSYM(sys_quotactl) .long CSYM(sys_quotactl)
.long CSYM(sys_getpgid) .long CSYM(sys_getpgid)
.long CSYM(sys_fchdir) .long CSYM(sys_fchdir)
...@@ -963,7 +948,7 @@ CSYM(sys_call_table): ...@@ -963,7 +948,7 @@ CSYM(sys_call_table):
.long CSYM(sys_setresuid) .long CSYM(sys_setresuid)
.long CSYM(sys_getresuid) // 165 .long CSYM(sys_getresuid) // 165
.long CSYM(sys_ni_syscall) // for vm86 .long CSYM(sys_ni_syscall) // for vm86
.long CSYM(sys_query_module) .long CSYM(sys_ni_syscall) // sys_query_module
.long CSYM(sys_poll) .long CSYM(sys_poll)
.long CSYM(sys_nfsservctl) .long CSYM(sys_nfsservctl)
.long CSYM(sys_setresgid) // 170 .long CSYM(sys_setresgid) // 170
...@@ -1003,3 +988,4 @@ CSYM(sys_call_table): ...@@ -1003,3 +988,4 @@ CSYM(sys_call_table):
.long CSYM(sys_ni_syscall) // sys_madvise .long CSYM(sys_ni_syscall) // sys_madvise
.space (NR_syscalls-205)*4 .space (NR_syscalls-205)*4
C_END(sys_call_table)
...@@ -73,8 +73,6 @@ void __init mach_early_init (void) ...@@ -73,8 +73,6 @@ void __init mach_early_init (void)
void __init mach_setup (char **cmdline) void __init mach_setup (char **cmdline)
{ {
printk (KERN_INFO "CPU: NEC V850E2 (NA85E2C FPGA implementation)\n");
memcons_setup (); memcons_setup ();
/* Setup up NMI0 to copy the registers to a known memory location. /* Setup up NMI0 to copy the registers to a known memory location.
......
...@@ -14,11 +14,10 @@ ...@@ -14,11 +14,10 @@
#include <linux/types.h> #include <linux/types.h>
#include <linux/init.h> #include <linux/init.h>
#include <linux/irq.h> #include <linux/irq.h>
#include <linux/sched.h> /* For some unfathomable reason, #include <linux/interrupt.h>
request_irq/free_irq are declared here. */ #include <linux/signal.h>
#include <asm/machdep.h> #include <asm/machdep.h>
#include <asm/irq.h>
/* The number of shared GINT interrupts. */ /* The number of shared GINT interrupts. */
...@@ -72,7 +71,7 @@ int gbus_int_irq_enabled (unsigned irq) ...@@ -72,7 +71,7 @@ int gbus_int_irq_enabled (unsigned irq)
} }
/* Disable all GBUS irqs. */ /* Disable all GBUS irqs. */
int gbus_int_disable_irqs () void gbus_int_disable_irqs ()
{ {
unsigned w, n; unsigned w, n;
for (w = 0; w < GBUS_INT_NUM_WORDS; w++) for (w = 0; w < GBUS_INT_NUM_WORDS; w++)
...@@ -183,7 +182,7 @@ void __init gbus_int_init_irq_types (struct gbus_int_irq_init *inits, ...@@ -183,7 +182,7 @@ void __init gbus_int_init_irq_types (struct gbus_int_irq_init *inits,
{ {
struct gbus_int_irq_init *init; struct gbus_int_irq_init *init;
for (init = inits; init->name; init++) { for (init = inits; init->name; init++) {
int i; unsigned i;
struct hw_interrupt_type *hwit = hw_irq_types++; struct hw_interrupt_type *hwit = hw_irq_types++;
hwit->typename = init->name; hwit->typename = init->name;
...@@ -200,7 +199,7 @@ void __init gbus_int_init_irq_types (struct gbus_int_irq_init *inits, ...@@ -200,7 +199,7 @@ void __init gbus_int_init_irq_types (struct gbus_int_irq_init *inits,
/* Set the interrupt priorities. */ /* Set the interrupt priorities. */
for (i = 0; i < init->num; i++) { for (i = 0; i < init->num; i++) {
int j; unsigned j;
for (j = 0; j < NUM_USED_GINTS; j++) for (j = 0; j < NUM_USED_GINTS; j++)
if (used_gint[j].priority > init->priority) if (used_gint[j].priority > init->priority)
break; break;
...@@ -222,7 +221,7 @@ static struct hw_interrupt_type gint_hw_itypes[NUM_USED_GINTS]; ...@@ -222,7 +221,7 @@ static struct hw_interrupt_type gint_hw_itypes[NUM_USED_GINTS];
/* GBUS interrupts themselves. */ /* GBUS interrupts themselves. */
__init struct gbus_int_irq_init gbus_irq_inits[] = { struct gbus_int_irq_init gbus_irq_inits[] __initdata = {
/* First set defaults. */ /* First set defaults. */
{ "GBUS_INT", IRQ_GBUS_INT(0), IRQ_GBUS_INT_NUM, 1, 6}, { "GBUS_INT", IRQ_GBUS_INT(0), IRQ_GBUS_INT_NUM, 1, 6},
{ 0 } { 0 }
...@@ -236,7 +235,7 @@ static struct hw_interrupt_type gbus_hw_itypes[NUM_GBUS_IRQ_INITS]; ...@@ -236,7 +235,7 @@ static struct hw_interrupt_type gbus_hw_itypes[NUM_GBUS_IRQ_INITS];
/* Initialize GBUS interrupts. */ /* Initialize GBUS interrupts. */
void __init gbus_int_init_irqs (void) void __init gbus_int_init_irqs (void)
{ {
int i; unsigned i;
/* First initialize the shared gint interrupts. */ /* First initialize the shared gint interrupts. */
for (i = 0; i < NUM_USED_GINTS; i++) { for (i = 0; i < NUM_USED_GINTS; i++) {
......
...@@ -118,4 +118,4 @@ C_ENTRY(start): ...@@ -118,4 +118,4 @@ C_ENTRY(start):
// Start Linux kernel. // Start Linux kernel.
mov hilo(CSYM(machine_halt)), lp mov hilo(CSYM(machine_halt)), lp
jr CSYM(start_kernel) jr CSYM(start_kernel)
END(start) C_END(start)
...@@ -52,10 +52,10 @@ ...@@ -52,10 +52,10 @@
JUMP_TO_HANDLER (trap, ENTRY_SP) // TRAP1n JUMP_TO_HANDLER (trap, ENTRY_SP) // TRAP1n
.balign 0x10 .balign 0x10
JUMP_TO_HANDLER (illegal_instruction, ENTRY_SP) // illegal insn trap JUMP_TO_HANDLER (irq, ENTRY_SP) // illegal insn trap
.balign 0x10 .balign 0x10
JUMP_TO_HANDLER (dbtrap, ENTRY_SP) // DBTRAP insn JUMP_TO_HANDLER (irq, ENTRY_SP) // DBTRAP insn
/* Hardware interrupt vectors. */ /* Hardware interrupt vectors. */
......
...@@ -252,7 +252,7 @@ unsigned int handle_irq (int irq, struct pt_regs *regs) ...@@ -252,7 +252,7 @@ unsigned int handle_irq (int irq, struct pt_regs *regs)
unsigned int status; unsigned int status;
irq_enter(); irq_enter();
kstat.irqs[cpu][irq]++; kstat_cpu(cpu).irqs[irq]++;
spin_lock(&desc->lock); spin_lock(&desc->lock);
desc->handler->ack(irq); desc->handler->ack(irq);
/* /*
......
/*
* arch/v850/kernel/module.c -- Architecture-specific module functions
*
* Copyright (C) 2002 NEC Corporation
* Copyright (C) 2002 Miles Bader <miles@gnu.org>
* Copyright (C) 2001 Rusty Russell
*
* This file is subject to the terms and conditions of the GNU General
* Public License. See the file COPYING in the main directory of this
* archive for more details.
*
* Written by Miles Bader <miles@gnu.org>
*
* Derived in part from arch/ppc/kernel/module.c
*/
#include <linux/kernel.h>
#include <linux/vmalloc.h>
#include <linux/moduleloader.h>
#include <linux/elf.h>
#if 0
#define DEBUGP printk
#else
#define DEBUGP(fmt , ...)
#endif
void *module_alloc (unsigned long size)
{
return size == 0 ? 0 : vmalloc (size);
}
void module_free (struct module *mod, void *module_region)
{
vfree (module_region);
/* FIXME: If module_region == mod->init_region, trim exception
table entries. */
}
int module_finalize (const Elf_Ehdr *hdr, const Elf_Shdr *sechdrs,
struct module *mod)
{
return 0;
}
/* Count how many different relocations (different symbol, different
addend) */
static unsigned int count_relocs(const Elf32_Rela *rela, unsigned int num)
{
unsigned int i, j, ret = 0;
/* Sure, this is order(n^2), but it's usually short, and not
time critical */
for (i = 0; i < num; i++) {
for (j = 0; j < i; j++) {
/* If this addend appeared before, it's
already been counted */
if (ELF32_R_SYM(rela[i].r_info)
== ELF32_R_SYM(rela[j].r_info)
&& rela[i].r_addend == rela[j].r_addend)
break;
}
if (j == i) ret++;
}
return ret;
}
/* Get the potential trampolines size required of the init and
non-init sections */
static unsigned long get_plt_size(const Elf32_Ehdr *hdr,
const Elf32_Shdr *sechdrs,
const char *secstrings,
int is_init)
{
unsigned long ret = 0;
unsigned i;
/* Everything marked ALLOC (this includes the exported
symbols) */
for (i = 1; i < hdr->e_shnum; i++) {
/* If it's called *.init*, and we're not init, we're
not interested */
if ((strstr(secstrings + sechdrs[i].sh_name, ".init") != 0)
!= is_init)
continue;
if (sechdrs[i].sh_type == SHT_RELA) {
DEBUGP("Found relocations in section %u\n", i);
DEBUGP("Ptr: %p. Number: %u\n",
(void *)hdr + sechdrs[i].sh_offset,
sechdrs[i].sh_size / sizeof(Elf32_Rela));
ret += count_relocs((void *)hdr
+ sechdrs[i].sh_offset,
sechdrs[i].sh_size
/ sizeof(Elf32_Rela))
* sizeof(struct v850_plt_entry);
}
}
return ret;
}
long module_core_size (const Elf32_Ehdr *hdr, const Elf32_Shdr *sechdrs,
const char *secstrings, struct module *mod)
{
mod->arch.core_plt_offset = (mod->core_size + 3) & ~3;
return mod->core_size + get_plt_size (hdr, sechdrs, secstrings, 1);
}
long module_init_size (const Elf32_Ehdr *hdr, const Elf32_Shdr *sechdrs,
const char *secstrings, struct module *mod)
{
mod->arch.init_plt_offset = (mod->init_size + 3) & ~3;
return mod->init_size + get_plt_size (hdr, sechdrs, secstrings, 1);
}
int apply_relocate (Elf32_Shdr *sechdrs, const char *strtab,
unsigned int symindex, unsigned int relsec,
struct module *mod)
{
printk ("Barf\n");
return -ENOEXEC;
}
/* Set up a trampoline in the PLT to bounce us to the distant function */
static uint32_t do_plt_call(void *location, Elf32_Addr val, struct module *mod)
{
struct v850_plt_entry *entry;
/* Instructions used to do the indirect jump. */
uint32_t tramp[2];
/* We have to trash a register, so we assume that any control
transfer more than 21-bits away must be a function call
(so we can use a call-clobbered register). */
tramp[0] = 0x0621 + ((val & 0xffff) << 16); /* mov sym, r1 ... */
tramp[1] = ((val >> 16) & 0xffff) + 0x610000; /* ...; jmp r1 */
/* Init, or core PLT? */
if (location >= mod->module_core
&& location < mod->module_core + mod->arch.core_plt_offset)
entry = mod->module_core + mod->arch.core_plt_offset;
else
entry = mod->module_init + mod->arch.init_plt_offset;
/* Find this entry, or if that fails, the next avail. entry */
while (entry->tramp[0])
if (entry->tramp[0] == tramp[0] && entry->tramp[1] == tramp[1])
return (uint32_t)entry;
else
entry++;
entry->tramp[0] = tramp[0];
entry->tramp[1] = tramp[1];
return (uint32_t)entry;
}
int apply_relocate_add (Elf32_Shdr *sechdrs, const char *strtab,
unsigned int symindex, unsigned int relsec,
struct module *mod)
{
unsigned int i;
Elf32_Rela *rela = (void *)sechdrs[relsec].sh_offset;
DEBUGP ("Applying relocate section %u to %u\n", relsec,
sechdrs[relsec].sh_info);
for (i = 0; i < sechdrs[relsec].sh_size / sizeof (*rela); i++) {
/* This is where to make the change */
uint32_t *loc
= ((void *)sechdrs[sechdrs[relsec].sh_info].sh_offset
+ rela[i].r_offset);
/* This is the symbol it is referring to */
Elf32_Sym *sym
= ((Elf32_Sym *)sechdrs[symindex].sh_offset
+ ELF32_R_SYM (rela[i].r_info));
uint32_t val = sym->st_value;
if (! val) {
printk (KERN_WARNING "%s: Unknown symbol %s\n",
mod->name, strtab + sym->st_name);
return -ENOENT;
}
val += rela[i].r_addend;
switch (ELF32_R_TYPE (rela[i].r_info)) {
case R_V850_32:
/* We write two shorts instead of a long because even
32-bit insns only need half-word alignment, but
32-bit data writes need to be long-word aligned. */
val += ((uint16_t *)loc)[0];
val += ((uint16_t *)loc)[1] << 16;
((uint16_t *)loc)[0] = val & 0xffff;
((uint16_t *)loc)[1] = (val >> 16) & 0xffff;
break;
case R_V850_22_PCREL:
/* Maybe jump indirectly via a PLT table entry. */
if ((int32_t)(val - (uint32_t)loc) > 0x1fffff
|| (int32_t)(val - (uint32_t)loc) < -0x200000)
val = do_plt_call (loc, val, mod);
val -= (uint32_t)loc;
/* We write two shorts instead of a long because
even 32-bit insns only need half-word alignment,
but 32-bit data writes need to be long-word
aligned. */
((uint16_t *)loc)[0] =
(*(uint16_t *)loc & 0xffc0) /* opcode + reg */
| ((val >> 16) & 0xffc03f); /* offs high */
((uint16_t *)loc)[1] =
(val & 0xffff); /* offs low */
break;
default:
printk (KERN_ERR "module %s: Unknown reloc: %u\n",
mod->name, ELF32_R_TYPE (rela[i].r_info));
return -ENOEXEC;
}
}
return 0;
}
...@@ -33,7 +33,7 @@ void __init nb85e_intc_init_irq_types (struct nb85e_intc_irq_init *inits, ...@@ -33,7 +33,7 @@ void __init nb85e_intc_init_irq_types (struct nb85e_intc_irq_init *inits,
{ {
struct nb85e_intc_irq_init *init; struct nb85e_intc_irq_init *init;
for (init = inits; init->name; init++) { for (init = inits; init->name; init++) {
int i; unsigned i;
struct hw_interrupt_type *hwit = hw_irq_types++; struct hw_interrupt_type *hwit = hw_irq_types++;
hwit->typename = init->name; hwit->typename = init->name;
......
...@@ -2,8 +2,8 @@ ...@@ -2,8 +2,8 @@
* include/asm-v850/nb85e_utils.h -- Utility functions associated with * include/asm-v850/nb85e_utils.h -- Utility functions associated with
* the NB85E cpu core * the NB85E cpu core
* *
* Copyright (C) 2001 NEC Corporation * Copyright (C) 2001,02 NEC Corporation
* Copyright (C) 2001 Miles Bader <miles@gnu.org> * Copyright (C) 2001,02 Miles Bader <miles@gnu.org>
* *
* This file is subject to the terms and conditions of the GNU General * This file is subject to the terms and conditions of the GNU General
* Public License. See the file COPYING in the main directory of this * Public License. See the file COPYING in the main directory of this
...@@ -40,7 +40,7 @@ int calc_counter_params (unsigned long base_freq, ...@@ -40,7 +40,7 @@ int calc_counter_params (unsigned long base_freq,
/* Find the lowest clock divider setting that can represent RATE. */ /* Find the lowest clock divider setting that can represent RATE. */
for (_divlog2 = min_divlog2; _divlog2 <= max_divlog2; _divlog2++) { for (_divlog2 = min_divlog2; _divlog2 <= max_divlog2; _divlog2++) {
/* Minimum interrupt rate possible using this divider. */ /* Minimum interrupt rate possible using this divider. */
int min_int_rate unsigned min_int_rate
= (base_freq >> _divlog2) >> counter_size; = (base_freq >> _divlog2) >> counter_size;
if (min_int_rate <= rate) { if (min_int_rate <= rate) {
......
...@@ -58,49 +58,6 @@ void cpu_idle (void) ...@@ -58,49 +58,6 @@ void cpu_idle (void)
(*idle) (); (*idle) ();
} }
struct spec_reg_name {
const char *name;
int gpr;
};
struct spec_reg_name spec_reg_names[] = {
{ "sp", GPR_SP },
{ "gp", GPR_GP },
{ "tp", GPR_TP },
{ "ep", GPR_EP },
{ "lp", GPR_LP },
{ 0, 0 }
};
void show_regs (struct pt_regs *regs)
{
int gpr_base, gpr_offs;
printk (" pc 0x%08lx psw 0x%08lx kernel_mode %d\n",
regs->pc, regs->psw, regs->kernel_mode);
printk (" ctpc 0x%08lx ctpsw 0x%08lx ctbp 0x%08lx\n",
regs->ctpc, regs->ctpsw, regs->ctbp);
for (gpr_base = 0; gpr_base < NUM_GPRS; gpr_base += 4) {
for (gpr_offs = 0; gpr_offs < 4; gpr_offs++) {
int gpr = gpr_base + gpr_offs;
long val = regs->gpr[gpr];
struct spec_reg_name *srn;
for (srn = spec_reg_names; srn->name; srn++)
if (srn->gpr == gpr)
break;
if (srn->name)
printk ("%7s 0x%08lx", srn->name, val);
else
printk (" r%02d 0x%08lx", gpr, val);
}
printk ("\n");
}
}
/* /*
* This is the mechanism for creating a new kernel thread. * This is the mechanism for creating a new kernel thread.
* *
...@@ -231,7 +188,7 @@ int sys_execve (char *name, char **argv, char **envp, struct pt_regs *regs) ...@@ -231,7 +188,7 @@ int sys_execve (char *name, char **argv, char **envp, struct pt_regs *regs)
are in entry.S). */ are in entry.S). */
int fork_common (int flags, unsigned long new_sp, struct pt_regs *regs) int fork_common (int flags, unsigned long new_sp, struct pt_regs *regs)
{ {
struct task_struct *p = do_fork (flags, new_sp, regs, 0, 0); struct task_struct *p = do_fork (flags, new_sp, regs, 0, 0, 0);
return IS_ERR (p) ? PTR_ERR (p) : p->pid; return IS_ERR (p) ? PTR_ERR (p) : p->pid;
} }
......
...@@ -60,25 +60,11 @@ void __init mach_early_init (void) ...@@ -60,25 +60,11 @@ void __init mach_early_init (void)
void __init mach_setup (char **cmdline) void __init mach_setup (char **cmdline)
{ {
printk (KERN_INFO
"CPU: %s\n"
"Platform: %s%s\n",
CPU_MODEL_LONG,
PLATFORM_LONG,
#ifdef CONFIG_ROM_KERNEL
""
#elif defined (CONFIG_RTE_CB_MULTI)
" (with Multi ROM monitor)"
#else
" (with ROM monitor)"
#endif
);
/* Probe for Mother-A, and print a message if we find it. */ /* Probe for Mother-A, and print a message if we find it. */
*(volatile long *)MB_A_SRAM_ADDR = 0xDEADBEEF; *(volatile unsigned long *)MB_A_SRAM_ADDR = 0xDEADBEEF;
if (*(volatile long *)MB_A_SRAM_ADDR == 0xDEADBEEF) { if (*(volatile unsigned long *)MB_A_SRAM_ADDR == 0xDEADBEEF) {
*(volatile long *)MB_A_SRAM_ADDR = 0x12345678; *(volatile unsigned long *)MB_A_SRAM_ADDR = 0x12345678;
if (*(volatile long *)MB_A_SRAM_ADDR == 0x12345678) if (*(volatile unsigned long *)MB_A_SRAM_ADDR == 0x12345678)
printk (KERN_INFO printk (KERN_INFO
" NEC SolutionGear/Midas lab" " NEC SolutionGear/Midas lab"
" RTE-MOTHER-A motherboard\n"); " RTE-MOTHER-A motherboard\n");
......
...@@ -109,10 +109,12 @@ static loff_t leds_dev_lseek (struct file *file, loff_t offs, int whence) ...@@ -109,10 +109,12 @@ static loff_t leds_dev_lseek (struct file *file, loff_t offs, int whence)
else if (whence == 2) else if (whence == 2)
offs += LED_NUM_DIGITS; /* end-relative */ offs += LED_NUM_DIGITS; /* end-relative */
if (offs >= 0 && offs <= LED_NUM_DIGITS) if (offs < 0 || offs > LED_NUM_DIGITS)
file->f_pos = offs;
else
return -EINVAL; return -EINVAL;
file->f_pos = offs;
return 0;
} }
static struct file_operations leds_fops = { static struct file_operations leds_fops = {
......
...@@ -239,7 +239,7 @@ static void __devinit pcibios_assign_resources (void) ...@@ -239,7 +239,7 @@ static void __devinit pcibios_assign_resources (void)
struct resource *r; struct resource *r;
pci_for_each_dev (dev) { pci_for_each_dev (dev) {
int di_num; unsigned di_num;
unsigned class = dev->class >> 8; unsigned class = dev->class >> 8;
if (class && class != PCI_CLASS_BRIDGE_HOST) { if (class && class != PCI_CLASS_BRIDGE_HOST) {
......
...@@ -78,6 +78,9 @@ void __init setup_arch (char **cmdline) ...@@ -78,6 +78,9 @@ void __init setup_arch (char **cmdline)
/* ... and tell the kernel about it. */ /* ... and tell the kernel about it. */
init_mem_alloc (ram_start, ram_len); init_mem_alloc (ram_start, ram_len);
printk (KERN_INFO "CPU: %s\nPlatform: %s\n",
CPU_MODEL_LONG, PLATFORM_LONG);
/* do machine-specific setups. */ /* do machine-specific setups. */
mach_setup (cmdline); mach_setup (cmdline);
...@@ -267,6 +270,16 @@ init_mem_alloc (unsigned long ram_start, unsigned long ram_len) ...@@ -267,6 +270,16 @@ init_mem_alloc (unsigned long ram_start, unsigned long ram_len)
zones_size[ZONE_DMA] zones_size[ZONE_DMA]
= ADDR_TO_PAGE (ram_len + (ram_start - PAGE_OFFSET)); = ADDR_TO_PAGE (ram_len + (ram_start - PAGE_OFFSET));
/* The allocator is very picky about the address of the first
allocatable page -- it must be at least as aligned as the
maximum allocation -- so try to detect cases where it will get
confused and signal them at compile time (this is a common
problem when porting to a new platform with ). There is a
similar runtime check in free_area_init_core. */
#if ((PAGE_OFFSET >> PAGE_SHIFT) & ((1UL << (MAX_ORDER - 1)) - 1))
#error MAX_ORDER is too large for given PAGE_OFFSET (use CONFIG_FORCE_MAX_ZONEORDER to change it)
#endif
free_area_init_node (0, NODE_DATA(0), 0, zones_size, free_area_init_node (0, NODE_DATA(0), 0, zones_size,
ADDR_TO_PAGE (PAGE_OFFSET), 0); ADDR_TO_PAGE (PAGE_OFFSET), 0);
mem_map = NODE_DATA(0)->node_mem_map; mem_map = NODE_DATA(0)->node_mem_map;
......
...@@ -512,9 +512,10 @@ int do_signal(struct pt_regs *regs, sigset_t *oldset) ...@@ -512,9 +512,10 @@ int do_signal(struct pt_regs *regs, sigset_t *oldset)
/* Did we come from a system call? */ /* Did we come from a system call? */
if (PT_REGS_SYSCALL (regs)) { if (PT_REGS_SYSCALL (regs)) {
/* Restart the system call - no handlers present */ /* Restart the system call - no handlers present */
if (regs->gpr[GPR_RVAL] == -ERESTARTNOHAND || if (regs->gpr[GPR_RVAL] == (v850_reg_t)-ERESTARTNOHAND ||
regs->gpr[GPR_RVAL] == -ERESTARTSYS || regs->gpr[GPR_RVAL] == (v850_reg_t)-ERESTARTSYS ||
regs->gpr[GPR_RVAL] == -ERESTARTNOINTR) { regs->gpr[GPR_RVAL] == (v850_reg_t)-ERESTARTNOINTR)
{
regs->gpr[12] = PT_REGS_SYSCALL (regs); regs->gpr[12] = PT_REGS_SYSCALL (regs);
regs->pc -= 4; /* Size of `trap 0' insn. */ regs->pc -= 4; /* Size of `trap 0' insn. */
} }
......
...@@ -42,8 +42,6 @@ void __init mach_setup (char **cmdline) ...@@ -42,8 +42,6 @@ void __init mach_setup (char **cmdline)
const char *err; const char *err;
unsigned long root_dev_addr, root_dev_len; unsigned long root_dev_addr, root_dev_len;
printk (KERN_INFO "CPU: NEC V850E (GDB simulator)\n");
simcons_setup (); simcons_setup ();
printk (KERN_INFO "Reading root filesystem: %s", ROOT_FS); printk (KERN_INFO "Reading root filesystem: %s", ROOT_FS);
......
...@@ -79,8 +79,6 @@ void __init mach_early_init (void) ...@@ -79,8 +79,6 @@ void __init mach_early_init (void)
void __init mach_setup (char **cmdline) void __init mach_setup (char **cmdline)
{ {
printk (KERN_INFO "CPU: NEC V850E2 (sim85e2c simulator)\n");
memcons_setup (); memcons_setup ();
} }
......
...@@ -154,5 +154,5 @@ void simcons_setup (void) ...@@ -154,5 +154,5 @@ void simcons_setup (void)
{ {
V850_SIM_SYSCALL (make_raw, 0); V850_SIM_SYSCALL (make_raw, 0);
register_console (&simcons); register_console (&simcons);
printk (KERN_INFO "Console: GDB/v850e simulator stdio\n"); printk (KERN_INFO "Console: GDB V850E simulator stdio\n");
} }
...@@ -27,6 +27,9 @@ EXPORT_SYMBOL (trap_table); ...@@ -27,6 +27,9 @@ EXPORT_SYMBOL (trap_table);
extern void dump_thread (struct pt_regs *, struct user *); extern void dump_thread (struct pt_regs *, struct user *);
EXPORT_SYMBOL (dump_thread); EXPORT_SYMBOL (dump_thread);
EXPORT_SYMBOL (kernel_thread); EXPORT_SYMBOL (kernel_thread);
EXPORT_SYMBOL (enable_irq);
EXPORT_SYMBOL (disable_irq);
EXPORT_SYMBOL (disable_irq_nosync);
EXPORT_SYMBOL (__bug); EXPORT_SYMBOL (__bug);
/* Networking helper routines. */ /* Networking helper routines. */
...@@ -46,7 +49,6 @@ EXPORT_SYMBOL_NOVERS (strchr); ...@@ -46,7 +49,6 @@ EXPORT_SYMBOL_NOVERS (strchr);
EXPORT_SYMBOL_NOVERS (strlen); EXPORT_SYMBOL_NOVERS (strlen);
EXPORT_SYMBOL_NOVERS (strnlen); EXPORT_SYMBOL_NOVERS (strnlen);
EXPORT_SYMBOL_NOVERS (strpbrk); EXPORT_SYMBOL_NOVERS (strpbrk);
EXPORT_SYMBOL_NOVERS (strtok);
EXPORT_SYMBOL_NOVERS (strrchr); EXPORT_SYMBOL_NOVERS (strrchr);
EXPORT_SYMBOL_NOVERS (strstr); EXPORT_SYMBOL_NOVERS (strstr);
EXPORT_SYMBOL_NOVERS (memset); EXPORT_SYMBOL_NOVERS (memset);
......
...@@ -93,6 +93,11 @@ SECTIONS { ...@@ -93,6 +93,11 @@ SECTIONS {
*(.initcall7.init) *(.initcall7.init)
. = ALIGN (4) ; . = ALIGN (4) ;
___initcall_end = . ; ___initcall_end = . ;
. = ALIGN (4) ;
___initramfs_start = . ;
*(.init.ramfs)
___initramfs_end = . ;
} > SRAM } > SRAM
/* This provides address at which the interrupt vectors are /* This provides address at which the interrupt vectors are
......
...@@ -45,9 +45,14 @@ SECTIONS { ...@@ -45,9 +45,14 @@ SECTIONS {
___stop___ksymtab = . ; ___stop___ksymtab = . ;
. = ALIGN (4) ; . = ALIGN (4) ;
__etext = . ; __etext = . ;
. = ALIGN (4) ;
___initramfs_start = . ;
*(.init.ramfs)
___initramfs_end = . ;
} > ROM } > ROM
__data_load_start = . ; __rom_copy_src_start = . ;
.data : { .data : {
__kram_start = . ; __kram_start = . ;
......
...@@ -98,10 +98,15 @@ SECTIONS { ...@@ -98,10 +98,15 @@ SECTIONS {
*(.initcall7.init) *(.initcall7.init)
. = ALIGN (4) ; . = ALIGN (4) ;
___initcall_end = . ; ___initcall_end = . ;
. = ALIGN (4) ;
___initramfs_start = . ;
*(.init.ramfs)
___initramfs_end = . ;
} > SDRAM } > SDRAM
/* This provides address at which the interrupt vectors are /* The address at which the interrupt vectors are initially
initially loaded by the loader. */ loaded by the loader. */
__intv_load_start = ALIGN (0x10) ; __intv_load_start = ALIGN (0x10) ;
/* Interrupt vector space. Because we're using the monitor /* Interrupt vector space. Because we're using the monitor
......
...@@ -96,6 +96,12 @@ SECTIONS { ...@@ -96,6 +96,12 @@ SECTIONS {
*(.initcall7.init) *(.initcall7.init)
. = ALIGN (4) ; . = ALIGN (4) ;
___initcall_end = . ; ___initcall_end = . ;
. = ALIGN (4) ;
___initramfs_start = . ;
*(.init.ramfs)
___initramfs_end = . ;
__init_end = . ; __init_end = . ;
__kram_end = . ; __kram_end = . ;
......
...@@ -86,6 +86,12 @@ SECTIONS { ...@@ -86,6 +86,12 @@ SECTIONS {
*(.initcall7.init) *(.initcall7.init)
. = ALIGN (4) ; . = ALIGN (4) ;
___initcall_end = . ; ___initcall_end = . ;
. = ALIGN (4) ;
___initramfs_start = . ;
*(.init.ramfs)
___initramfs_end = . ;
__init_end = . ; __init_end = . ;
} > IRAM } > IRAM
......
...@@ -20,6 +20,10 @@ ...@@ -20,6 +20,10 @@
# endif # endif
#endif #endif
#ifdef CONFIG_V850E_AS85EP1
# include "as85ep1.ld"
#endif
#ifdef CONFIG_RTE_CB_MA1 #ifdef CONFIG_RTE_CB_MA1
# ifdef CONFIG_ROM_KERNEL # ifdef CONFIG_ROM_KERNEL
# include "rte_ma1_cb-rom.ld" # include "rte_ma1_cb-rom.ld"
......
...@@ -2,7 +2,6 @@ ...@@ -2,7 +2,6 @@
# Makefile for the acorn character device drivers. # Makefile for the acorn character device drivers.
# #
# All the objects that export symbols.
obj-arc := keyb_arc.o defkeymap-acorn.o obj-arc := keyb_arc.o defkeymap-acorn.o
obj-$(CONFIG_ARCH_ACORN) += i2c.o pcf8583.o obj-$(CONFIG_ARCH_ACORN) += i2c.o pcf8583.o
......
...@@ -137,10 +137,10 @@ ...@@ -137,10 +137,10 @@
#include <linux/signal.h> #include <linux/signal.h>
#include <linux/errno.h> #include <linux/errno.h>
#include <linux/proc_fs.h> #include <linux/proc_fs.h>
#include <linux/stat.h>
#include <linux/ioport.h> #include <linux/ioport.h>
#include <linux/blk.h> #include <linux/blk.h>
#include <linux/delay.h> #include <linux/delay.h>
#include <linux/interrupt.h>
#include <linux/init.h> #include <linux/init.h>
#include <asm/bitops.h> #include <asm/bitops.h>
......
/*
* ARXE SCSI card driver
*
* Copyright (C) 1997-2000 Russell King
*
* Changes to support ARXE 16-bit SCSI card by Stefan Hanske
*/
#ifndef ARXE_SCSI_H
#define ARXE_SCSI_H
#define MANU_ARXE 0x0041
#define PROD_ARXE_SCSI 0x00be
extern int arxescsi_detect (Scsi_Host_Template *);
extern int arxescsi_release (struct Scsi_Host *);
extern const char *arxescsi_info (struct Scsi_Host *);
extern int arxescsi_proc_info (char *buffer, char **start, off_t offset,
int length, int hostno, int inout);
#ifndef NULL
#define NULL ((void *)0)
#endif
#ifndef CAN_QUEUE
/*
* Default queue size
*/
#define CAN_QUEUE 1
#endif
#ifndef CMD_PER_LUN
#define CMD_PER_LUN 1
#endif
#ifndef SCSI_ID
/*
* Default SCSI host ID
*/
#define SCSI_ID 7
#endif
#include <scsi/scsicam.h>
#include "fas216.h"
#define ARXEScsi { \
proc_info: arxescsi_proc_info, \
name: "ARXE SCSI card", \
detect: arxescsi_detect, \
release: arxescsi_release, \
info: arxescsi_info, \
can_queue: CAN_QUEUE, \
this_id: SCSI_ID, \
sg_tablesize: SG_ALL, \
cmd_per_lun: CMD_PER_LUN, \
use_clustering: DISABLE_CLUSTERING, \
command: fas216_command, \
queuecommand: fas216_queue_command, \
eh_host_reset_handler: fas216_eh_host_reset, \
eh_bus_reset_handler: fas216_eh_bus_reset, \
eh_device_reset_handler: fas216_eh_device_reset, \
eh_abort_handler: fas216_eh_abort, \
}
#ifndef HOSTS_C
typedef struct {
FAS216_Info info;
/* other info... */
unsigned int cstatus; /* card status register */
unsigned int dmaarea; /* Pseudo DMA area */
} ARXEScsi_Info;
#define CSTATUS_IRQ (1 << 0)
#define CSTATUS_DRQ (1 << 0)
#endif /* HOSTS_C */
#endif /* ARXE_SCSI_H */
...@@ -23,10 +23,8 @@ ...@@ -23,10 +23,8 @@
#include <linux/ioport.h> #include <linux/ioport.h>
#include <linux/sched.h> #include <linux/sched.h>
#include <linux/proc_fs.h> #include <linux/proc_fs.h>
#include <linux/unistd.h>
#include <linux/stat.h>
#include <linux/delay.h> #include <linux/delay.h>
#include <linux/pci.h> #include <linux/interrupt.h>
#include <linux/init.h> #include <linux/init.h>
#include <asm/dma.h> #include <asm/dma.h>
......
...@@ -29,10 +29,8 @@ ...@@ -29,10 +29,8 @@
#include <linux/ioport.h> #include <linux/ioport.h>
#include <linux/sched.h> #include <linux/sched.h>
#include <linux/proc_fs.h> #include <linux/proc_fs.h>
#include <linux/unistd.h>
#include <linux/stat.h>
#include <linux/delay.h> #include <linux/delay.h>
#include <linux/pci.h> #include <linux/interrupt.h>
#include <linux/init.h> #include <linux/init.h>
#include <asm/io.h> #include <asm/io.h>
......
...@@ -44,8 +44,6 @@ ...@@ -44,8 +44,6 @@
#include <linux/ioport.h> #include <linux/ioport.h>
#include <linux/sched.h> #include <linux/sched.h>
#include <linux/proc_fs.h> #include <linux/proc_fs.h>
#include <linux/unistd.h>
#include <linux/stat.h>
#include <linux/delay.h> #include <linux/delay.h>
#include <linux/init.h> #include <linux/init.h>
......
...@@ -14,10 +14,8 @@ ...@@ -14,10 +14,8 @@
#include <linux/ioport.h> #include <linux/ioport.h>
#include <linux/sched.h> #include <linux/sched.h>
#include <linux/proc_fs.h> #include <linux/proc_fs.h>
#include <linux/unistd.h>
#include <linux/stat.h>
#include <linux/delay.h> #include <linux/delay.h>
#include <linux/pci.h> #include <linux/interrupt.h>
#include <linux/init.h> #include <linux/init.h>
#include <asm/dma.h> #include <asm/dma.h>
......
...@@ -29,6 +29,7 @@ ...@@ -29,6 +29,7 @@
#include <linux/types.h> #include <linux/types.h>
#include <linux/compatmac.h> #include <linux/compatmac.h>
#include <linux/proc_fs.h> #include <linux/proc_fs.h>
#include <linux/seq_file.h>
#include "acpi_bus.h" #include "acpi_bus.h"
#include "acpi_drivers.h" #include "acpi_drivers.h"
...@@ -53,6 +54,7 @@ MODULE_LICENSE("GPL"); ...@@ -53,6 +54,7 @@ MODULE_LICENSE("GPL");
int acpi_ac_add (struct acpi_device *device); int acpi_ac_add (struct acpi_device *device);
int acpi_ac_remove (struct acpi_device *device, int type); int acpi_ac_remove (struct acpi_device *device, int type);
static int acpi_ac_open_fs(struct inode *inode, struct file *file);
static struct acpi_driver acpi_ac_driver = { static struct acpi_driver acpi_ac_driver = {
.name = ACPI_AC_DRIVER_NAME, .name = ACPI_AC_DRIVER_NAME,
...@@ -69,6 +71,12 @@ struct acpi_ac { ...@@ -69,6 +71,12 @@ struct acpi_ac {
unsigned long state; unsigned long state;
}; };
static struct file_operations acpi_ac_fops = {
.open = acpi_ac_open_fs,
.read = seq_read,
.llseek = seq_lseek,
.release = single_release,
};
/* -------------------------------------------------------------------------- /* --------------------------------------------------------------------------
AC Adapter Management AC Adapter Management
...@@ -103,53 +111,40 @@ acpi_ac_get_state ( ...@@ -103,53 +111,40 @@ acpi_ac_get_state (
struct proc_dir_entry *acpi_ac_dir = NULL; struct proc_dir_entry *acpi_ac_dir = NULL;
static int int acpi_ac_seq_show(struct seq_file *seq, void *offset)
acpi_ac_read_state (
char *page,
char **start,
off_t off,
int count,
int *eof,
void *data)
{ {
struct acpi_ac *ac = (struct acpi_ac *) data; struct acpi_ac *ac = (struct acpi_ac *) seq->private;
char *p = page;
int len = 0;
ACPI_FUNCTION_TRACE("acpi_ac_read_state"); ACPI_FUNCTION_TRACE("acpi_ac_seq_show");
if (!ac || (off != 0)) if (!ac)
goto end; return 0;
if (acpi_ac_get_state(ac)) { if (acpi_ac_get_state(ac)) {
p += sprintf(p, "ERROR: Unable to read AC Adapter state\n"); seq_puts(seq, "ERROR: Unable to read AC Adapter state\n");
goto end; return 0;
} }
p += sprintf(p, "state: "); seq_puts(seq, "state: ");
switch (ac->state) { switch (ac->state) {
case ACPI_AC_STATUS_OFFLINE: case ACPI_AC_STATUS_OFFLINE:
p += sprintf(p, "off-line\n"); seq_puts(seq, "off-line\n");
break; break;
case ACPI_AC_STATUS_ONLINE: case ACPI_AC_STATUS_ONLINE:
p += sprintf(p, "on-line\n"); seq_puts(seq, "on-line\n");
break; break;
default: default:
p += sprintf(p, "unknown\n"); seq_puts(seq, "unknown\n");
break; break;
} }
end: return 0;
len = (p - page);
if (len <= off+count) *eof = 1;
*start = page + off;
len -= off;
if (len>count) len = count;
if (len<0) len = 0;
return_VALUE(len);
} }
static int acpi_ac_open_fs(struct inode *inode, struct file *file)
{
return single_open(file, acpi_ac_seq_show, PDE(inode)->data);
}
static int static int
acpi_ac_add_fs ( acpi_ac_add_fs (
...@@ -174,7 +169,7 @@ acpi_ac_add_fs ( ...@@ -174,7 +169,7 @@ acpi_ac_add_fs (
"Unable to create '%s' fs entry\n", "Unable to create '%s' fs entry\n",
ACPI_AC_FILE_STATE)); ACPI_AC_FILE_STATE));
else { else {
entry->read_proc = acpi_ac_read_state; entry->proc_fops = &acpi_ac_fops;
entry->data = acpi_driver_data(device); entry->data = acpi_driver_data(device);
} }
......
...@@ -29,6 +29,7 @@ ...@@ -29,6 +29,7 @@
#include <linux/types.h> #include <linux/types.h>
#include <linux/compatmac.h> #include <linux/compatmac.h>
#include <linux/proc_fs.h> #include <linux/proc_fs.h>
#include <linux/seq_file.h>
#include "acpi_bus.h" #include "acpi_bus.h"
#include "acpi_drivers.h" #include "acpi_drivers.h"
...@@ -69,6 +70,7 @@ MODULE_LICENSE("GPL"); ...@@ -69,6 +70,7 @@ MODULE_LICENSE("GPL");
int acpi_button_add (struct acpi_device *device); int acpi_button_add (struct acpi_device *device);
int acpi_button_remove (struct acpi_device *device, int type); int acpi_button_remove (struct acpi_device *device, int type);
static int acpi_button_open_fs(struct inode *inode, struct file *file);
static struct acpi_driver acpi_button_driver = { static struct acpi_driver acpi_button_driver = {
.name = ACPI_BUTTON_DRIVER_NAME, .name = ACPI_BUTTON_DRIVER_NAME,
...@@ -87,6 +89,12 @@ struct acpi_button { ...@@ -87,6 +89,12 @@ struct acpi_button {
unsigned long pushed; unsigned long pushed;
}; };
static struct file_operations acpi_button_fops = {
.open = acpi_button_open_fs,
.read = seq_read,
.llseek = seq_lseek,
.release = single_release,
};
/* -------------------------------------------------------------------------- /* --------------------------------------------------------------------------
FS Interface (/proc) FS Interface (/proc)
...@@ -94,38 +102,25 @@ struct acpi_button { ...@@ -94,38 +102,25 @@ struct acpi_button {
static struct proc_dir_entry *acpi_button_dir = NULL; static struct proc_dir_entry *acpi_button_dir = NULL;
static int static int acpi_button_seq_show(struct seq_file *seq, void *offset)
acpi_button_read_info (
char *page,
char **start,
off_t off,
int count,
int *eof,
void *data)
{ {
struct acpi_button *button = (struct acpi_button *) data; struct acpi_button *button = (struct acpi_button *) seq->private;
char *p = page;
int len = 0;
ACPI_FUNCTION_TRACE("acpi_button_read_info"); ACPI_FUNCTION_TRACE("acpi_button_seq_show");
if (!button || !button->device) if (!button || !button->device)
goto end; return 0;
p += sprintf(p, "type: %s\n", seq_printf(seq, "type: %s\n",
acpi_device_name(button->device)); acpi_device_name(button->device));
end: return 0;
len = (p - page);
if (len <= off+count) *eof = 1;
*start = page + off;
len -= off;
if (len>count) len = count;
if (len<0) len = 0;
return_VALUE(len);
} }
static int acpi_button_open_fs(struct inode *inode, struct file *file)
{
return single_open(file, acpi_button_seq_show, PDE(inode)->data);
}
static int static int
acpi_button_add_fs ( acpi_button_add_fs (
...@@ -170,7 +165,7 @@ acpi_button_add_fs ( ...@@ -170,7 +165,7 @@ acpi_button_add_fs (
"Unable to create '%s' fs entry\n", "Unable to create '%s' fs entry\n",
ACPI_BUTTON_FILE_INFO)); ACPI_BUTTON_FILE_INFO));
else { else {
entry->read_proc = acpi_button_read_info; entry->proc_fops = &acpi_button_fops;
entry->data = acpi_driver_data(device); entry->data = acpi_driver_data(device);
} }
......
/******************************************************************************* /*******************************************************************************
* *
* Module Name: dsmthdat - control method arguments and local variables * Module Name: dsmthdat - control method arguments and local variables
* $Revision: 64 $ * $Revision: 66 $
* *
******************************************************************************/ ******************************************************************************/
...@@ -28,6 +28,7 @@ ...@@ -28,6 +28,7 @@
#include "acdispat.h" #include "acdispat.h"
#include "amlcode.h" #include "amlcode.h"
#include "acnamesp.h" #include "acnamesp.h"
#include "acinterp.h"
#define _COMPONENT ACPI_DISPATCHER #define _COMPONENT ACPI_DISPATCHER
...@@ -274,6 +275,7 @@ acpi_ds_method_data_get_node ( ...@@ -274,6 +275,7 @@ acpi_ds_method_data_get_node (
* RETURN: Status * RETURN: Status
* *
* DESCRIPTION: Insert an object onto the method stack at entry Opcode:Index. * DESCRIPTION: Insert an object onto the method stack at entry Opcode:Index.
* Note: There is no "implicit conversion" for locals.
* *
******************************************************************************/ ******************************************************************************/
...@@ -286,11 +288,17 @@ acpi_ds_method_data_set_value ( ...@@ -286,11 +288,17 @@ acpi_ds_method_data_set_value (
{ {
acpi_status status; acpi_status status;
acpi_namespace_node *node; acpi_namespace_node *node;
acpi_operand_object *new_desc = object;
ACPI_FUNCTION_TRACE ("Ds_method_data_set_value"); ACPI_FUNCTION_TRACE ("Ds_method_data_set_value");
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
"obj %p op %X, ref count = %d [%s]\n", object,
opcode, object->common.reference_count,
acpi_ut_get_type_name (object->common.type)));
/* Get the namespace node for the arg/local */ /* Get the namespace node for the arg/local */
status = acpi_ds_method_data_get_node (opcode, index, walk_state, &node); status = acpi_ds_method_data_get_node (opcode, index, walk_state, &node);
...@@ -298,14 +306,30 @@ acpi_ds_method_data_set_value ( ...@@ -298,14 +306,30 @@ acpi_ds_method_data_set_value (
return_ACPI_STATUS (status); return_ACPI_STATUS (status);
} }
/*
* If the object has just been created and is not attached to anything,
* (the reference count is 1), then we can just store it directly into
* the arg/local. Otherwise, we must copy it.
*/
if (object->common.reference_count > 1) {
status = acpi_ut_copy_iobject_to_iobject (object, &new_desc, walk_state);
if (ACPI_FAILURE (status)) {
return_ACPI_STATUS (status);
}
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Object Copied %p, new %p\n",
object, new_desc));
}
else {
/* Increment ref count so object can't be deleted while installed */ /* Increment ref count so object can't be deleted while installed */
acpi_ut_add_reference (object); acpi_ut_add_reference (new_desc);
}
/* Install the object into the stack entry */ /* Install the object */
node->object = object; node->object = new_desc;
return_ACPI_STATUS (AE_OK); return_ACPI_STATUS (status);
} }
...@@ -560,7 +584,8 @@ acpi_ds_store_object_to_local ( ...@@ -560,7 +584,8 @@ acpi_ds_store_object_to_local (
current_obj_desc = acpi_ns_get_attached_object (node); current_obj_desc = acpi_ns_get_attached_object (node);
if (current_obj_desc == obj_desc) { if (current_obj_desc == obj_desc) {
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Obj=%p already installed!\n", obj_desc)); ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Obj=%p already installed!\n",
obj_desc));
return_ACPI_STATUS (status); return_ACPI_STATUS (status);
} }
...@@ -609,16 +634,12 @@ acpi_ds_store_object_to_local ( ...@@ -609,16 +634,12 @@ acpi_ds_store_object_to_local (
"Arg (%p) is an Obj_ref(Node), storing in node %p\n", "Arg (%p) is an Obj_ref(Node), storing in node %p\n",
obj_desc, current_obj_desc)); obj_desc, current_obj_desc));
/* Detach an existing object from the referenced Node */
acpi_ns_detach_object (current_obj_desc->reference.object);
/* /*
* Store this object into the Node * Store this object to the Node
* (perform the indirect store) * (perform the indirect store)
*/ */
status = acpi_ns_attach_object (current_obj_desc->reference.object, status = acpi_ex_store_object_to_node (obj_desc,
obj_desc, ACPI_GET_OBJECT_TYPE (obj_desc)); current_obj_desc->reference.object, walk_state);
return_ACPI_STATUS (status); return_ACPI_STATUS (status);
} }
} }
......
/****************************************************************************** /******************************************************************************
* *
* Module Name: evevent - Fixed and General Purpose Even handling and dispatch * Module Name: evevent - Fixed and General Purpose Even handling and dispatch
* $Revision: 96 $ * $Revision: 99 $
* *
*****************************************************************************/ *****************************************************************************/
...@@ -331,11 +331,8 @@ acpi_ev_gpe_initialize (void) ...@@ -331,11 +331,8 @@ acpi_ev_gpe_initialize (void)
* FADT table contain zeros. The GPE0_LEN and GPE1_LEN do not need * FADT table contain zeros. The GPE0_LEN and GPE1_LEN do not need
* to be the same size." * to be the same size."
*/ */
acpi_gbl_gpe_block_info[0].address_space_id = acpi_gbl_FADT->Xgpe0_blk.address_space_id; acpi_gbl_gpe_block_info[0].register_count = 0;
acpi_gbl_gpe_block_info[1].address_space_id = acpi_gbl_FADT->Xgpe1_blk.address_space_id; acpi_gbl_gpe_block_info[1].register_count = 0;
acpi_gbl_gpe_block_info[0].register_count = (u16) ACPI_DIV_16 (acpi_gbl_FADT->Xgpe0_blk.register_bit_width);
acpi_gbl_gpe_block_info[1].register_count = (u16) ACPI_DIV_16 (acpi_gbl_FADT->Xgpe1_blk.register_bit_width);
acpi_gbl_gpe_block_info[0].block_address = &acpi_gbl_FADT->Xgpe0_blk; acpi_gbl_gpe_block_info[0].block_address = &acpi_gbl_FADT->Xgpe0_blk;
acpi_gbl_gpe_block_info[1].block_address = &acpi_gbl_FADT->Xgpe1_blk; acpi_gbl_gpe_block_info[1].block_address = &acpi_gbl_FADT->Xgpe1_blk;
...@@ -343,28 +340,25 @@ acpi_ev_gpe_initialize (void) ...@@ -343,28 +340,25 @@ acpi_ev_gpe_initialize (void)
acpi_gbl_gpe_block_info[0].block_base_number = 0; acpi_gbl_gpe_block_info[0].block_base_number = 0;
acpi_gbl_gpe_block_info[1].block_base_number = acpi_gbl_FADT->gpe1_base; acpi_gbl_gpe_block_info[1].block_base_number = acpi_gbl_FADT->gpe1_base;
/* Warn and exit if there are no GPE registers */
acpi_gbl_gpe_register_count = acpi_gbl_gpe_block_info[0].register_count +
acpi_gbl_gpe_block_info[1].register_count;
if (!acpi_gbl_gpe_register_count) {
ACPI_REPORT_WARNING (("There are no GPE blocks defined in the FADT\n"));
return_ACPI_STATUS (AE_OK);
}
/* /*
* Determine the maximum GPE number for this machine. * Determine the maximum GPE number for this machine.
* Note: both GPE0 and GPE1 are optional, and either can exist without * Note: both GPE0 and GPE1 are optional, and either can exist without
* the other * the other.
* If EITHER the register length OR the block address are zero, then that
* particular block is not supported.
*/ */
if (acpi_gbl_gpe_block_info[0].register_count) { if (acpi_gbl_FADT->Xgpe0_blk.register_bit_width && ACPI_GET_ADDRESS (acpi_gbl_FADT->Xgpe0_blk.address)) {
/* GPE block 0 exists */ /* GPE block 0 exists (has length and address > 0) */
acpi_gbl_gpe_block_info[0].register_count = (u16) ACPI_DIV_16 (acpi_gbl_FADT->Xgpe0_blk.register_bit_width);
acpi_gbl_gpe_number_max = ACPI_MUL_8 (acpi_gbl_gpe_block_info[0].register_count) - 1; acpi_gbl_gpe_number_max = ACPI_MUL_8 (acpi_gbl_gpe_block_info[0].register_count) - 1;
} }
if (acpi_gbl_gpe_block_info[1].register_count) { if (acpi_gbl_FADT->Xgpe1_blk.register_bit_width && ACPI_GET_ADDRESS (acpi_gbl_FADT->Xgpe1_blk.address)) {
/* GPE block 1 exists */ /* GPE block 1 exists (has length and address > 0) */
acpi_gbl_gpe_block_info[1].register_count = (u16) ACPI_DIV_16 (acpi_gbl_FADT->Xgpe1_blk.register_bit_width);
/* Check for GPE0/GPE1 overlap (if both banks exist) */ /* Check for GPE0/GPE1 overlap (if both banks exist) */
...@@ -385,6 +379,15 @@ acpi_ev_gpe_initialize (void) ...@@ -385,6 +379,15 @@ acpi_ev_gpe_initialize (void)
(ACPI_MUL_8 (acpi_gbl_gpe_block_info[1].register_count) - 1); (ACPI_MUL_8 (acpi_gbl_gpe_block_info[1].register_count) - 1);
} }
/* Warn and exit if there are no GPE registers */
acpi_gbl_gpe_register_count = acpi_gbl_gpe_block_info[0].register_count +
acpi_gbl_gpe_block_info[1].register_count;
if (!acpi_gbl_gpe_register_count) {
ACPI_REPORT_WARNING (("There are no GPE blocks defined in the FADT\n"));
return_ACPI_STATUS (AE_OK);
}
/* Check for Max GPE number out-of-range */ /* Check for Max GPE number out-of-range */
if (acpi_gbl_gpe_number_max > ACPI_GPE_MAX) { if (acpi_gbl_gpe_number_max > ACPI_GPE_MAX) {
...@@ -460,8 +463,8 @@ acpi_ev_gpe_initialize (void) ...@@ -460,8 +463,8 @@ acpi_ev_gpe_initialize (void)
+ i + i
+ acpi_gbl_gpe_block_info[gpe_block].register_count)); + acpi_gbl_gpe_block_info[gpe_block].register_count));
gpe_register_info->status_address.address_space_id = acpi_gbl_gpe_block_info[gpe_block].address_space_id; gpe_register_info->status_address.address_space_id = acpi_gbl_gpe_block_info[gpe_block].block_address->address_space_id;
gpe_register_info->enable_address.address_space_id = acpi_gbl_gpe_block_info[gpe_block].address_space_id; gpe_register_info->enable_address.address_space_id = acpi_gbl_gpe_block_info[gpe_block].block_address->address_space_id;
gpe_register_info->status_address.register_bit_width = 8; gpe_register_info->status_address.register_bit_width = 8;
gpe_register_info->enable_address.register_bit_width = 8; gpe_register_info->enable_address.register_bit_width = 8;
gpe_register_info->status_address.register_bit_offset = 8; gpe_register_info->status_address.register_bit_offset = 8;
...@@ -615,7 +618,7 @@ acpi_ev_save_method_info ( ...@@ -615,7 +618,7 @@ acpi_ev_save_method_info (
* for use during dispatch of this GPE. * for use during dispatch of this GPE.
*/ */
acpi_gbl_gpe_number_info [gpe_number_index].type = type; acpi_gbl_gpe_number_info [gpe_number_index].type = type;
acpi_gbl_gpe_number_info [gpe_number_index].method_handle = obj_handle; acpi_gbl_gpe_number_info [gpe_number_index].method_node = (acpi_namespace_node *) obj_handle;
/* /*
* Enable the GPE (SCIs should be disabled at this point) * Enable the GPE (SCIs should be disabled at this point)
...@@ -625,7 +628,7 @@ acpi_ev_save_method_info ( ...@@ -625,7 +628,7 @@ acpi_ev_save_method_info (
return (status); return (status);
} }
ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Registered GPE method %s as GPE number %X\n", ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Registered GPE method %s as GPE number %2.2X\n",
name, gpe_number)); name, gpe_number));
return (AE_OK); return (AE_OK);
} }
...@@ -805,15 +808,16 @@ acpi_ev_asynch_execute_gpe_method ( ...@@ -805,15 +808,16 @@ acpi_ev_asynch_execute_gpe_method (
return_VOID; return_VOID;
} }
if (gpe_info.method_handle) { if (gpe_info.method_node) {
/* /*
* Invoke the GPE Method (_Lxx, _Exx): * Invoke the GPE Method (_Lxx, _Exx):
* (Evaluate the _Lxx/_Exx control method that corresponds to this GPE.) * (Evaluate the _Lxx/_Exx control method that corresponds to this GPE.)
*/ */
status = acpi_ns_evaluate_by_handle (gpe_info.method_handle, NULL, NULL); status = acpi_ns_evaluate_by_handle (gpe_info.method_node, NULL, NULL);
if (ACPI_FAILURE (status)) { if (ACPI_FAILURE (status)) {
ACPI_REPORT_ERROR (("%s while evaluating GPE%X method\n", ACPI_REPORT_ERROR (("%s while evaluating method [%4.4s] for GPE[%2.2X]\n",
acpi_format_exception (status), gpe_number)); acpi_format_exception (status),
gpe_info.method_node->name.ascii, gpe_number));
} }
} }
...@@ -881,7 +885,7 @@ acpi_ev_gpe_dispatch ( ...@@ -881,7 +885,7 @@ acpi_ev_gpe_dispatch (
if (gpe_info->type & ACPI_EVENT_EDGE_TRIGGERED) { if (gpe_info->type & ACPI_EVENT_EDGE_TRIGGERED) {
status = acpi_hw_clear_gpe (gpe_number); status = acpi_hw_clear_gpe (gpe_number);
if (ACPI_FAILURE (status)) { if (ACPI_FAILURE (status)) {
ACPI_REPORT_ERROR (("Acpi_ev_gpe_dispatch: Unable to clear GPE[%X]\n", gpe_number)); ACPI_REPORT_ERROR (("Acpi_ev_gpe_dispatch: Unable to clear GPE[%2.2X]\n", gpe_number));
return_VALUE (ACPI_INTERRUPT_NOT_HANDLED); return_VALUE (ACPI_INTERRUPT_NOT_HANDLED);
} }
} }
...@@ -898,14 +902,14 @@ acpi_ev_gpe_dispatch ( ...@@ -898,14 +902,14 @@ acpi_ev_gpe_dispatch (
gpe_info->handler (gpe_info->context); gpe_info->handler (gpe_info->context);
} }
else if (gpe_info->method_handle) { else if (gpe_info->method_node) {
/* /*
* Disable GPE, so it doesn't keep firing before the method has a * Disable GPE, so it doesn't keep firing before the method has a
* chance to run. * chance to run.
*/ */
status = acpi_hw_disable_gpe (gpe_number); status = acpi_hw_disable_gpe (gpe_number);
if (ACPI_FAILURE (status)) { if (ACPI_FAILURE (status)) {
ACPI_REPORT_ERROR (("Acpi_ev_gpe_dispatch: Unable to disable GPE[%X]\n", gpe_number)); ACPI_REPORT_ERROR (("Acpi_ev_gpe_dispatch: Unable to disable GPE[%2.2X]\n", gpe_number));
return_VALUE (ACPI_INTERRUPT_NOT_HANDLED); return_VALUE (ACPI_INTERRUPT_NOT_HANDLED);
} }
...@@ -915,13 +919,13 @@ acpi_ev_gpe_dispatch ( ...@@ -915,13 +919,13 @@ acpi_ev_gpe_dispatch (
if (ACPI_FAILURE (acpi_os_queue_for_execution (OSD_PRIORITY_GPE, if (ACPI_FAILURE (acpi_os_queue_for_execution (OSD_PRIORITY_GPE,
acpi_ev_asynch_execute_gpe_method, acpi_ev_asynch_execute_gpe_method,
ACPI_TO_POINTER (gpe_number)))) { ACPI_TO_POINTER (gpe_number)))) {
ACPI_REPORT_ERROR (("Acpi_ev_gpe_dispatch: Unable to queue handler for GPE[%X], event is disabled\n", gpe_number)); ACPI_REPORT_ERROR (("Acpi_ev_gpe_dispatch: Unable to queue handler for GPE[%2.2X], event is disabled\n", gpe_number));
} }
} }
else { else {
/* No handler or method to run! */ /* No handler or method to run! */
ACPI_REPORT_ERROR (("Acpi_ev_gpe_dispatch: No handler or method for GPE[%X], disabling event\n", gpe_number)); ACPI_REPORT_ERROR (("Acpi_ev_gpe_dispatch: No handler or method for GPE[%2.2X], disabling event\n", gpe_number));
/* /*
* Disable the GPE. The GPE will remain disabled until the ACPI * Disable the GPE. The GPE will remain disabled until the ACPI
...@@ -929,7 +933,7 @@ acpi_ev_gpe_dispatch ( ...@@ -929,7 +933,7 @@ acpi_ev_gpe_dispatch (
*/ */
status = acpi_hw_disable_gpe (gpe_number); status = acpi_hw_disable_gpe (gpe_number);
if (ACPI_FAILURE (status)) { if (ACPI_FAILURE (status)) {
ACPI_REPORT_ERROR (("Acpi_ev_gpe_dispatch: Unable to disable GPE[%X]\n", gpe_number)); ACPI_REPORT_ERROR (("Acpi_ev_gpe_dispatch: Unable to disable GPE[%2.2X]\n", gpe_number));
return_VALUE (ACPI_INTERRUPT_NOT_HANDLED); return_VALUE (ACPI_INTERRUPT_NOT_HANDLED);
} }
} }
...@@ -940,7 +944,7 @@ acpi_ev_gpe_dispatch ( ...@@ -940,7 +944,7 @@ acpi_ev_gpe_dispatch (
if (gpe_info->type & ACPI_EVENT_LEVEL_TRIGGERED) { if (gpe_info->type & ACPI_EVENT_LEVEL_TRIGGERED) {
status = acpi_hw_clear_gpe (gpe_number); status = acpi_hw_clear_gpe (gpe_number);
if (ACPI_FAILURE (status)) { if (ACPI_FAILURE (status)) {
ACPI_REPORT_ERROR (("Acpi_ev_gpe_dispatch: Unable to clear GPE[%X]\n", gpe_number)); ACPI_REPORT_ERROR (("Acpi_ev_gpe_dispatch: Unable to clear GPE[%2.2X]\n", gpe_number));
return_VALUE (ACPI_INTERRUPT_NOT_HANDLED); return_VALUE (ACPI_INTERRUPT_NOT_HANDLED);
} }
} }
......
/****************************************************************************** /******************************************************************************
* *
* Module Name: evrgnini- ACPI Address_space (Op_region) init * Module Name: evrgnini- ACPI Address_space (Op_region) init
* $Revision: 63 $ * $Revision: 64 $
* *
*****************************************************************************/ *****************************************************************************/
...@@ -269,6 +269,11 @@ acpi_ev_pci_config_region_setup ( ...@@ -269,6 +269,11 @@ acpi_ev_pci_config_region_setup (
pci_id->bus = ACPI_LOWORD (temp); pci_id->bus = ACPI_LOWORD (temp);
} }
/*
* Complete this device's Pci_id
*/
acpi_os_derive_pci_id (node, region_obj->region.node, &pci_id);
*region_context = pci_id; *region_context = pci_id;
return_ACPI_STATUS (AE_OK); return_ACPI_STATUS (AE_OK);
} }
......
/****************************************************************************** /******************************************************************************
* *
* Name: acconfig.h - Global configuration constants * Name: acconfig.h - Global configuration constants
* $Revision: 118 $ * $Revision: 119 $
* *
*****************************************************************************/ *****************************************************************************/
...@@ -54,7 +54,7 @@ ...@@ -54,7 +54,7 @@
/* Version string */ /* Version string */
#define ACPI_CA_VERSION 0x20021115 #define ACPI_CA_VERSION 0x20021122
/* Version of ACPI supported */ /* Version of ACPI supported */
......
/****************************************************************************** /******************************************************************************
* *
* Name: aclocal.h - Internal data types used across the ACPI subsystem * Name: aclocal.h - Internal data types used across the ACPI subsystem
* $Revision: 179 $ * $Revision: 181 $
* *
*****************************************************************************/ *****************************************************************************/
...@@ -301,7 +301,6 @@ typedef struct ...@@ -301,7 +301,6 @@ typedef struct
typedef struct typedef struct
{ {
u8 address_space_id;
acpi_generic_address *block_address; acpi_generic_address *block_address;
u16 register_count; u16 register_count;
u8 block_base_number; u8 block_base_number;
...@@ -330,7 +329,7 @@ typedef struct ...@@ -330,7 +329,7 @@ typedef struct
typedef struct typedef struct
{ {
acpi_handle method_handle; /* Method handle for direct (fast) execution */ acpi_namespace_node *method_node; /* Method node for this GPE level */
acpi_gpe_handler handler; /* Address of handler, if any */ acpi_gpe_handler handler; /* Address of handler, if any */
void *context; /* Context to be passed to handler */ void *context; /* Context to be passed to handler */
u8 type; /* Level or Edge */ u8 type; /* Level or Edge */
......
...@@ -246,6 +246,14 @@ acpi_os_write_pci_configuration ( ...@@ -246,6 +246,14 @@ acpi_os_write_pci_configuration (
acpi_integer value, acpi_integer value,
u32 width); u32 width);
/*
* Interim function needed for PCI IRQ routing
*/
void
acpi_os_derive_pci_id(
acpi_handle rhandle,
acpi_handle chandle,
acpi_pci_id **pci_id);
/* /*
* Miscellaneous * Miscellaneous
......
...@@ -36,6 +36,7 @@ ...@@ -36,6 +36,7 @@
#include <linux/delay.h> #include <linux/delay.h>
#include <linux/workqueue.h> #include <linux/workqueue.h>
#include <asm/io.h> #include <asm/io.h>
#include "acpi_bus.h"
#include "acpi.h" #include "acpi.h"
#ifdef CONFIG_ACPI_EFI #ifdef CONFIG_ACPI_EFI
...@@ -483,6 +484,44 @@ acpi_os_write_pci_configuration ( ...@@ -483,6 +484,44 @@ acpi_os_write_pci_configuration (
return (result ? AE_ERROR : AE_OK); return (result ? AE_ERROR : AE_OK);
} }
/* TODO: Rewrite this code!!! */
void
acpi_os_derive_pci_id (
acpi_handle rhandle, /* upper bound */
acpi_handle chandle, /* current node */
acpi_pci_id **id)
{
acpi_handle handle;
acpi_pci_id *pci_id = *id;
acpi_status status;
unsigned long temp;
acpi_object_type type;
u8 tu8;
acpi_get_parent(chandle, &handle);
if (handle != rhandle) {
acpi_os_derive_pci_id(rhandle, handle, &pci_id);
status = acpi_get_type(handle, &type);
if ( (ACPI_FAILURE(status)) || (type != ACPI_TYPE_DEVICE) )
return;
status = acpi_evaluate_integer(handle, METHOD_NAME__ADR, NULL, &temp);
if (ACPI_SUCCESS(status)) {
pci_id->device = ACPI_HIWORD (ACPI_LODWORD (temp));
pci_id->function = ACPI_LOWORD (ACPI_LODWORD (temp));
/* any nicer way to get bus number of bridge ? */
status = acpi_os_read_pci_configuration(pci_id, 0x0e, &tu8, 8);
if (ACPI_SUCCESS(status) && (tu8 & 0x7f) == 1) {
status = acpi_os_read_pci_configuration(pci_id, 0x19, &tu8, 8);
if (ACPI_SUCCESS(status))
pci_id->bus = tu8;
}
}
}
}
#else /*!CONFIG_ACPI_PCI*/ #else /*!CONFIG_ACPI_PCI*/
acpi_status acpi_status
......
/****************************************************************************** /******************************************************************************
* *
* Module Name: psopcode - Parser/Interpreter opcode information table * Module Name: psopcode - Parser/Interpreter opcode information table
* $Revision: 73 $ * $Revision: 74 $
* *
*****************************************************************************/ *****************************************************************************/
...@@ -734,7 +734,7 @@ NATIVE_CHAR * ...@@ -734,7 +734,7 @@ NATIVE_CHAR *
acpi_ps_get_opcode_name ( acpi_ps_get_opcode_name (
u16 opcode) u16 opcode)
{ {
#ifdef ACPI_DISASSEMBLER #if defined(ACPI_DISASSEMBLER) || defined (ACPI_DEBUG_OUTPUT)
const acpi_opcode_info *op; const acpi_opcode_info *op;
......
...@@ -29,6 +29,7 @@ ...@@ -29,6 +29,7 @@
#include <linux/types.h> #include <linux/types.h>
#include <linux/compatmac.h> #include <linux/compatmac.h>
#include <linux/proc_fs.h> #include <linux/proc_fs.h>
#include <linux/seq_file.h>
#include "acpi_bus.h" #include "acpi_bus.h"
#include "acpi_drivers.h" #include "acpi_drivers.h"
...@@ -48,6 +49,7 @@ ACPI_MODULE_NAME ("acpi_power") ...@@ -48,6 +49,7 @@ ACPI_MODULE_NAME ("acpi_power")
int acpi_power_add (struct acpi_device *device); int acpi_power_add (struct acpi_device *device);
int acpi_power_remove (struct acpi_device *device, int type); int acpi_power_remove (struct acpi_device *device, int type);
static int acpi_power_open_fs(struct inode *inode, struct file *file);
static struct acpi_driver acpi_power_driver = { static struct acpi_driver acpi_power_driver = {
.name = ACPI_POWER_DRIVER_NAME, .name = ACPI_POWER_DRIVER_NAME,
...@@ -71,6 +73,12 @@ struct acpi_power_resource ...@@ -71,6 +73,12 @@ struct acpi_power_resource
static struct list_head acpi_power_resource_list; static struct list_head acpi_power_resource_list;
static struct file_operations acpi_power_fops = {
.open = acpi_power_open_fs,
.read = seq_read,
.llseek = seq_lseek,
.release = single_release,
};
/* -------------------------------------------------------------------------- /* --------------------------------------------------------------------------
Power Resource Management Power Resource Management
...@@ -379,58 +387,45 @@ acpi_power_transition ( ...@@ -379,58 +387,45 @@ acpi_power_transition (
struct proc_dir_entry *acpi_power_dir = NULL; struct proc_dir_entry *acpi_power_dir = NULL;
static int acpi_power_seq_show(struct seq_file *seq, void *offset)
static int
acpi_power_read_status (
char *page,
char **start,
off_t off,
int count,
int *eof,
void *data)
{ {
struct acpi_power_resource *resource = NULL; struct acpi_power_resource *resource = NULL;
char *p = page;
int len;
ACPI_FUNCTION_TRACE("acpi_power_read_status"); ACPI_FUNCTION_TRACE("acpi_power_seq_show");
if (!data || (off != 0)) resource = (struct acpi_power_resource *)seq->private;
goto end;
resource = (struct acpi_power_resource *) data; if (!resource)
goto end;
p += sprintf(p, "state: "); seq_puts(seq, "state: ");
switch (resource->state) { switch (resource->state) {
case ACPI_POWER_RESOURCE_STATE_ON: case ACPI_POWER_RESOURCE_STATE_ON:
p += sprintf(p, "on\n"); seq_puts(seq, "on\n");
break; break;
case ACPI_POWER_RESOURCE_STATE_OFF: case ACPI_POWER_RESOURCE_STATE_OFF:
p += sprintf(p, "off\n"); seq_puts(seq, "off\n");
break; break;
default: default:
p += sprintf(p, "unknown\n"); seq_puts(seq, "unknown\n");
break; break;
} }
p += sprintf(p, "system level: S%d\n", seq_printf(seq, "system level: S%d\n"
resource->system_level); "order: %d\n"
p += sprintf(p, "order: %d\n", "reference count: %d\n",
resource->order); resource->system_level,
p += sprintf(p, "reference count: %d\n", resource->order,
resource->references); resource->references);
end: end:
len = (p - page); return 0;
if (len <= off+count) *eof = 1;
*start = page + off;
len -= off;
if (len>count) len = count;
if (len<0) len = 0;
return_VALUE(len);
} }
static int acpi_power_open_fs(struct inode *inode, struct file *file)
{
return single_open(file, acpi_power_seq_show, PDE(inode)->data);
}
static int static int
acpi_power_add_fs ( acpi_power_add_fs (
...@@ -458,7 +453,7 @@ acpi_power_add_fs ( ...@@ -458,7 +453,7 @@ acpi_power_add_fs (
"Unable to create '%s' fs entry\n", "Unable to create '%s' fs entry\n",
ACPI_POWER_FILE_STATUS)); ACPI_POWER_FILE_STATUS));
else { else {
entry->read_proc = acpi_power_read_status; entry->proc_fops = &acpi_power_fops;
entry->data = acpi_driver_data(device); entry->data = acpi_driver_data(device);
} }
......
This diff is collapsed.
...@@ -15,6 +15,7 @@ ...@@ -15,6 +15,7 @@
#include <linux/pm.h> #include <linux/pm.h>
#include <linux/device.h> #include <linux/device.h>
#include <linux/suspend.h> #include <linux/suspend.h>
#include <linux/seq_file.h>
#include <asm/uaccess.h> #include <asm/uaccess.h>
#include <asm/acpi.h> #include <asm/acpi.h>
...@@ -32,8 +33,25 @@ ACPI_MODULE_NAME ("sleep") ...@@ -32,8 +33,25 @@ ACPI_MODULE_NAME ("sleep")
#define ACPI_SYSTEM_FILE_SLEEP "sleep" #define ACPI_SYSTEM_FILE_SLEEP "sleep"
#define ACPI_SYSTEM_FILE_ALARM "alarm" #define ACPI_SYSTEM_FILE_ALARM "alarm"
static int acpi_system_sleep_open_fs(struct inode *inode, struct file *file);
static int acpi_system_alarm_open_fs(struct inode *inode, struct file *file);
static u8 sleep_states[ACPI_S_STATE_COUNT]; static u8 sleep_states[ACPI_S_STATE_COUNT];
static struct file_operations acpi_system_sleep_fops = {
.open = acpi_system_sleep_open_fs,
.read = seq_read,
.llseek = seq_lseek,
.release = single_release,
};
static struct file_operations acpi_system_alarm_fops = {
.open = acpi_system_alarm_open_fs,
.read = seq_read,
.llseek = seq_lseek,
.release = single_release,
};
static void static void
acpi_power_off (void) acpi_power_off (void)
{ {
...@@ -271,43 +289,26 @@ acpi_suspend ( ...@@ -271,43 +289,26 @@ acpi_suspend (
return status; return status;
} }
static int acpi_system_sleep_seq_show(struct seq_file *seq, void *offset)
static int
acpi_system_read_sleep (
char *page,
char **start,
off_t off,
int count,
int *eof,
void *data)
{ {
char *p = page;
int size;
int i; int i;
ACPI_FUNCTION_TRACE("acpi_system_read_sleep"); ACPI_FUNCTION_TRACE("acpi_system_sleep_seq_show");
if (off != 0)
goto end;
for (i = 0; i <= ACPI_STATE_S5; i++) { for (i = 0; i <= ACPI_STATE_S5; i++) {
if (sleep_states[i]) if (sleep_states[i])
p += sprintf(p,"S%d ", i); seq_printf(seq,"S%d ", i);
} }
p += sprintf(p, "\n"); seq_puts(seq, "\n");
end: return 0;
size = (p - page);
if (size <= off+count) *eof = 1;
*start = page + off;
size -= off;
if (size>count) size = count;
if (size<0) size = 0;
return_VALUE(size);
} }
static int acpi_system_sleep_open_fs(struct inode *inode, struct file *file)
{
return single_open(file, acpi_system_sleep_seq_show, PDE(inode)->data);
}
static int static int
acpi_system_write_sleep ( acpi_system_write_sleep (
...@@ -349,25 +350,12 @@ acpi_system_write_sleep ( ...@@ -349,25 +350,12 @@ acpi_system_write_sleep (
return_VALUE(count); return_VALUE(count);
} }
static int acpi_system_alarm_seq_show(struct seq_file *seq, void *offset)
static int
acpi_system_read_alarm (
char *page,
char **start,
off_t off,
int count,
int *eof,
void *context)
{ {
char *p = page;
int size = 0;
u32 sec, min, hr; u32 sec, min, hr;
u32 day, mo, yr; u32 day, mo, yr;
ACPI_FUNCTION_TRACE("acpi_system_read_alarm"); ACPI_FUNCTION_TRACE("acpi_system_alarm_seq_show");
if (off != 0)
goto end;
spin_lock(&rtc_lock); spin_lock(&rtc_lock);
...@@ -427,21 +415,19 @@ acpi_system_read_alarm ( ...@@ -427,21 +415,19 @@ acpi_system_read_alarm (
yr += 2000; yr += 2000;
#endif #endif
p += sprintf(p,"%4.4u-", yr); seq_printf(seq,"%4.4u-", yr);
p += (mo > 12) ? sprintf(p, "**-") : sprintf(p, "%2.2u-", mo); (mo > 12) ? seq_puts(seq, "**-") : seq_printf(seq, "%2.2u-", mo);
p += (day > 31) ? sprintf(p, "** ") : sprintf(p, "%2.2u ", day); (day > 31) ? seq_puts(seq, "** ") : seq_printf(seq, "%2.2u ", day);
p += (hr > 23) ? sprintf(p, "**:") : sprintf(p, "%2.2u:", hr); (hr > 23) ? seq_puts(seq, "**:") : seq_printf(seq, "%2.2u:", hr);
p += (min > 59) ? sprintf(p, "**:") : sprintf(p, "%2.2u:", min); (min > 59) ? seq_puts(seq, "**:") : seq_printf(seq, "%2.2u:", min);
p += (sec > 59) ? sprintf(p, "**\n") : sprintf(p, "%2.2u\n", sec); (sec > 59) ? seq_puts(seq, "**\n") : seq_printf(seq, "%2.2u\n", sec);
end: return 0;
size = p - page; }
if (size < count) *eof = 1;
else if (size > count) size = count; static int acpi_system_alarm_open_fs(struct inode *inode, struct file *file)
if (size < 0) size = 0; {
*start = page; return single_open(file, acpi_system_alarm_seq_show, PDE(inode)->data);
return_VALUE(size);
} }
...@@ -687,7 +673,7 @@ static int __init acpi_sleep_init(void) ...@@ -687,7 +673,7 @@ static int __init acpi_sleep_init(void)
"Unable to create '%s' fs entry\n", "Unable to create '%s' fs entry\n",
ACPI_SYSTEM_FILE_SLEEP)); ACPI_SYSTEM_FILE_SLEEP));
else { else {
entry->read_proc = acpi_system_read_sleep; entry->proc_fops = &acpi_system_sleep_fops;
entry->write_proc = acpi_system_write_sleep; entry->write_proc = acpi_system_write_sleep;
} }
...@@ -699,7 +685,7 @@ static int __init acpi_sleep_init(void) ...@@ -699,7 +685,7 @@ static int __init acpi_sleep_init(void)
"Unable to create '%s' fs entry\n", "Unable to create '%s' fs entry\n",
ACPI_SYSTEM_FILE_ALARM)); ACPI_SYSTEM_FILE_ALARM));
else { else {
entry->read_proc = acpi_system_read_alarm; entry->proc_fops = &acpi_system_alarm_fops;
entry->write_proc = acpi_system_write_alarm; entry->write_proc = acpi_system_write_alarm;
} }
......
This diff is collapsed.
...@@ -41,6 +41,7 @@ ...@@ -41,6 +41,7 @@
#include <linux/init.h> #include <linux/init.h>
#include <linux/types.h> #include <linux/types.h>
#include <linux/proc_fs.h> #include <linux/proc_fs.h>
#include <linux/seq_file.h>
#include <linux/version.h> #include <linux/version.h>
#include <acconfig.h> #include <acconfig.h>
...@@ -100,6 +101,47 @@ MODULE_LICENSE("GPL"); ...@@ -100,6 +101,47 @@ MODULE_LICENSE("GPL");
#define HCI_VIDEO_OUT_CRT 0x2 #define HCI_VIDEO_OUT_CRT 0x2
#define HCI_VIDEO_OUT_TV 0x4 #define HCI_VIDEO_OUT_TV 0x4
static int toshiba_lcd_open_fs(struct inode *inode, struct file *file);
static int toshiba_video_open_fs(struct inode *inode, struct file *file);
static int toshiba_fan_open_fs(struct inode *inode, struct file *file);
static int toshiba_keys_open_fs(struct inode *inode, struct file *file);
static int toshiba_version_open_fs(struct inode *inode, struct file *file);
static struct file_operations toshiba_lcd_fops = {
.open = toshiba_lcd_open_fs,
.read = seq_read,
.llseek = seq_lseek,
.release = single_release,
};
static struct file_operations toshiba_video_fops = {
.open = toshiba_video_open_fs,
.read = seq_read,
.llseek = seq_lseek,
.release = single_release,
};
static struct file_operations toshiba_fan_fops = {
.open = toshiba_fan_open_fs,
.read = seq_read,
.llseek = seq_lseek,
.release = single_release,
};
static struct file_operations toshiba_keys_fops = {
.open = toshiba_keys_open_fs,
.read = seq_read,
.llseek = seq_lseek,
.release = single_release,
};
static struct file_operations toshiba_version_fops = {
.open = toshiba_version_open_fs,
.read = seq_read,
.llseek = seq_lseek,
.release = single_release,
};
/* utility /* utility
*/ */
...@@ -126,22 +168,6 @@ snscanf(const char* str, int n, const char* format, ...) ...@@ -126,22 +168,6 @@ snscanf(const char* str, int n, const char* format, ...)
return result; return result;
} }
/* This is the common code at the end of every proc read handler. I don't
* understand it yet.
*/
static int
end_proc_read(const char* p, char* page, off_t off, int count,
char** start, int* eof)
{
int len = (p - page);
if (len <= off+count) *eof = 1;
*start = page + off;
len -= off;
if (len>count) len = count;
if (len<0) len = 0;
return len;
}
/* acpi interface wrappers /* acpi interface wrappers
*/ */
...@@ -259,29 +285,27 @@ static int key_event_valid; ...@@ -259,29 +285,27 @@ static int key_event_valid;
/* proc file handlers /* proc file handlers
*/ */
static int static int toshiba_lcd_seq_show(struct seq_file *seq, void *offset)
proc_read_lcd(char* page, char** start, off_t off, int count, int* eof,
void* context)
{ {
char* p = page;
u32 hci_result; u32 hci_result;
u32 value; u32 value;
if (off != 0) goto end;
hci_read1(HCI_LCD_BRIGHTNESS, &value, &hci_result); hci_read1(HCI_LCD_BRIGHTNESS, &value, &hci_result);
if (hci_result == HCI_SUCCESS) { if (hci_result == HCI_SUCCESS) {
value = value >> HCI_LCD_BRIGHTNESS_SHIFT; value = value >> HCI_LCD_BRIGHTNESS_SHIFT;
p += sprintf(p, "brightness: %d\n", value); seq_printf(seq, "brightness: %d\n"
p += sprintf(p, "brightness_levels: %d\n", "brightness_levels: %d\n",
value,
HCI_LCD_BRIGHTNESS_LEVELS); HCI_LCD_BRIGHTNESS_LEVELS);
} else { } else
p += sprintf(p, "ERROR\n"); seq_puts(seq, "ERROR\n");
goto end;
}
end: return 0;
return end_proc_read(p, page, off, count, start, eof); }
static int toshiba_lcd_open_fs(struct inode *inode, struct file *file)
{
return single_open(file, toshiba_lcd_seq_show, NULL);
} }
static int static int
...@@ -306,31 +330,31 @@ proc_write_lcd(struct file* file, const char* buffer, unsigned long count, ...@@ -306,31 +330,31 @@ proc_write_lcd(struct file* file, const char* buffer, unsigned long count,
return count; return count;
} }
static int static int toshiba_video_seq_show(struct seq_file *seq, void *offset)
proc_read_video(char* page, char** start, off_t off, int count, int* eof,
void* context)
{ {
char* p = page;
u32 hci_result; u32 hci_result;
u32 value; u32 value;
if (off != 0) goto end;
hci_read1(HCI_VIDEO_OUT, &value, &hci_result); hci_read1(HCI_VIDEO_OUT, &value, &hci_result);
if (hci_result == HCI_SUCCESS) { if (hci_result == HCI_SUCCESS) {
int is_lcd = (value & HCI_VIDEO_OUT_LCD) ? 1 : 0; int is_lcd = (value & HCI_VIDEO_OUT_LCD) ? 1 : 0;
int is_crt = (value & HCI_VIDEO_OUT_CRT) ? 1 : 0; int is_crt = (value & HCI_VIDEO_OUT_CRT) ? 1 : 0;
int is_tv = (value & HCI_VIDEO_OUT_TV ) ? 1 : 0; int is_tv = (value & HCI_VIDEO_OUT_TV ) ? 1 : 0;
p += sprintf(p, "lcd_out: %d\n", is_lcd); seq_printf(seq, "lcd_out: %d\n"
p += sprintf(p, "crt_out: %d\n", is_crt); "crt_out: %d\n"
p += sprintf(p, "tv_out: %d\n", is_tv); "tv_out: %d\n",
} else { is_lcd,
p += sprintf(p, "ERROR\n"); is_crt,
goto end; is_tv);
} } else
seq_puts(seq, "ERROR\n");
return 0;
}
end: static int toshiba_video_open_fs(struct inode *inode, struct file *file)
return end_proc_read(p, page, off, count, start, eof); {
return single_open(file, toshiba_video_seq_show, NULL);
} }
static int static int
...@@ -376,27 +400,26 @@ proc_write_video(struct file* file, const char* buffer, unsigned long count, ...@@ -376,27 +400,26 @@ proc_write_video(struct file* file, const char* buffer, unsigned long count,
return count; return count;
} }
static int static int toshiba_fan_seq_show(struct seq_file *seq, void *offset)
proc_read_fan(char* page, char** start, off_t off, int count, int* eof,
void* context)
{ {
char* p = page;
u32 hci_result; u32 hci_result;
u32 value; u32 value;
if (off != 0) goto end;
hci_read1(HCI_FAN, &value, &hci_result); hci_read1(HCI_FAN, &value, &hci_result);
if (hci_result == HCI_SUCCESS) { if (hci_result == HCI_SUCCESS) {
p += sprintf(p, "running: %d\n", (value > 0)); seq_printf(seq, "running: %d\n"
p += sprintf(p, "force_on: %d\n", force_fan); "force_on: %d\n",
} else { (value > 0),
p += sprintf(p, "ERROR\n"); force_fan);
goto end; } else
} seq_puts(seq, "ERROR\n");
return 0;
}
end: static int toshiba_fan_open_fs(struct inode *inode, struct file *file)
return end_proc_read(p, page, off, count, start, eof); {
return single_open(file, toshiba_fan_seq_show, NULL);
} }
static int static int
...@@ -420,16 +443,11 @@ proc_write_fan(struct file* file, const char* buffer, unsigned long count, ...@@ -420,16 +443,11 @@ proc_write_fan(struct file* file, const char* buffer, unsigned long count,
return count; return count;
} }
static int static int toshiba_keys_seq_show(struct seq_file *seq, void *offset)
proc_read_keys(char* page, char** start, off_t off, int count, int* eof,
void* context)
{ {
char* p = page;
u32 hci_result; u32 hci_result;
u32 value; u32 value;
if (off != 0) goto end;
if (!key_event_valid) { if (!key_event_valid) {
hci_read1(HCI_SYSTEM_EVENT, &value, &hci_result); hci_read1(HCI_SYSTEM_EVENT, &value, &hci_result);
if (hci_result == HCI_SUCCESS) { if (hci_result == HCI_SUCCESS) {
...@@ -438,16 +456,23 @@ proc_read_keys(char* page, char** start, off_t off, int count, int* eof, ...@@ -438,16 +456,23 @@ proc_read_keys(char* page, char** start, off_t off, int count, int* eof,
} else if (hci_result == HCI_EMPTY) { } else if (hci_result == HCI_EMPTY) {
/* better luck next time */ /* better luck next time */
} else { } else {
p += sprintf(p, "ERROR\n"); seq_puts(seq, "ERROR\n");
goto end; goto end;
} }
} }
p += sprintf(p, "hotkey_ready: %d\n", key_event_valid); seq_printf(seq, "hotkey_ready: %d\n"
p += sprintf(p, "hotkey: 0x%04x\n", last_key_event); "hotkey: 0x%04x\n",
key_event_valid,
last_key_event);
end: end:
return end_proc_read(p, page, off, count, start, eof); return 0;
}
static int toshiba_keys_open_fs(struct inode *inode, struct file *file)
{
return single_open(file, toshiba_keys_seq_show, NULL);
} }
static int static int
...@@ -466,20 +491,19 @@ proc_write_keys(struct file* file, const char* buffer, unsigned long count, ...@@ -466,20 +491,19 @@ proc_write_keys(struct file* file, const char* buffer, unsigned long count,
return count; return count;
} }
static int static int toshiba_version_seq_show(struct seq_file *seq, void *offset)
proc_read_version(char* page, char** start, off_t off, int count, int* eof,
void* context)
{ {
char* p = page; seq_printf(seq, "driver: %s\n"
"proc_interface: %d\n",
if (off != 0) goto end; TOSHIBA_ACPI_VERSION,
p += sprintf(p, "driver: %s\n", TOSHIBA_ACPI_VERSION);
p += sprintf(p, "proc_interface: %d\n",
PROC_INTERFACE_VERSION); PROC_INTERFACE_VERSION);
end: return 0;
return end_proc_read(p, page, off, count, start, eof); }
static int toshiba_version_open_fs(struct inode *inode, struct file *file)
{
return single_open(file, toshiba_version_seq_show, NULL);
} }
/* proc and module init /* proc and module init
...@@ -490,24 +514,38 @@ add_device(void) ...@@ -490,24 +514,38 @@ add_device(void)
{ {
struct proc_dir_entry* proc; struct proc_dir_entry* proc;
proc = create_proc_read_entry(PROC_LCD, S_IFREG | S_IRUGO | S_IWUSR, proc = create_proc_entry(PROC_LCD, S_IFREG | S_IRUGO | S_IWUSR,
toshiba_proc_dir, proc_read_lcd, 0); toshiba_proc_dir);
if (proc) proc->write_proc = proc_write_lcd; if (proc) {
proc->proc_fops = &toshiba_lcd_fops;
proc->write_proc = proc_write_lcd;
}
proc = create_proc_read_entry(PROC_VIDEO, S_IFREG | S_IRUGO | S_IWUSR, proc = create_proc_entry(PROC_VIDEO, S_IFREG | S_IRUGO | S_IWUSR,
toshiba_proc_dir, proc_read_video, 0); toshiba_proc_dir);
if (proc) proc->write_proc = proc_write_video; if (proc) {
proc->proc_fops = &toshiba_video_fops;
proc->write_proc = proc_write_video;
}
proc = create_proc_read_entry(PROC_FAN, S_IFREG | S_IRUGO | S_IWUSR, proc = create_proc_entry(PROC_FAN, S_IFREG | S_IRUGO | S_IWUSR,
toshiba_proc_dir, proc_read_fan, 0); toshiba_proc_dir);
if (proc) proc->write_proc = proc_write_fan; if (proc) {
proc->proc_fops = &toshiba_fan_fops;
proc->write_proc = proc_write_fan;
}
proc = create_proc_read_entry(PROC_KEYS, S_IFREG | S_IRUGO | S_IWUSR, proc = create_proc_entry(PROC_KEYS, S_IFREG | S_IRUGO | S_IWUSR,
toshiba_proc_dir, proc_read_keys, 0); toshiba_proc_dir);
if (proc) proc->write_proc = proc_write_keys; if (proc) {
proc->proc_fops = &toshiba_keys_fops;
proc->write_proc = proc_write_keys;
}
proc = create_proc_read_entry(PROC_VERSION, S_IFREG | S_IRUGO | S_IWUSR, proc = create_proc_entry(PROC_VERSION, S_IFREG | S_IRUGO | S_IWUSR,
toshiba_proc_dir, proc_read_version, 0); toshiba_proc_dir);
if (proc)
proc->proc_fops = &toshiba_version_fops;
return(AE_OK); return(AE_OK);
} }
......
/****************************************************************************** /******************************************************************************
* *
* Module Name: utcopy - Internal to external object translation utilities * Module Name: utcopy - Internal to external object translation utilities
* $Revision: 105 $ * $Revision: 106 $
* *
*****************************************************************************/ *****************************************************************************/
...@@ -419,7 +419,8 @@ acpi_ut_copy_esimple_to_isimple ( ...@@ -419,7 +419,8 @@ acpi_ut_copy_esimple_to_isimple (
case ACPI_TYPE_STRING: case ACPI_TYPE_STRING:
internal_object->string.pointer = ACPI_MEM_CALLOCATE ((ACPI_SIZE) external_object->string.length + 1); internal_object->string.pointer =
ACPI_MEM_CALLOCATE ((ACPI_SIZE) external_object->string.length + 1);
if (!internal_object->string.pointer) { if (!internal_object->string.pointer) {
return_ACPI_STATUS (AE_NO_MEMORY); return_ACPI_STATUS (AE_NO_MEMORY);
} }
...@@ -434,7 +435,8 @@ acpi_ut_copy_esimple_to_isimple ( ...@@ -434,7 +435,8 @@ acpi_ut_copy_esimple_to_isimple (
case ACPI_TYPE_BUFFER: case ACPI_TYPE_BUFFER:
internal_object->buffer.pointer = ACPI_MEM_CALLOCATE (external_object->buffer.length); internal_object->buffer.pointer =
ACPI_MEM_CALLOCATE (external_object->buffer.length);
if (!internal_object->buffer.pointer) { if (!internal_object->buffer.pointer) {
return_ACPI_STATUS (AE_NO_MEMORY); return_ACPI_STATUS (AE_NO_MEMORY);
} }
...@@ -474,7 +476,7 @@ acpi_ut_copy_esimple_to_isimple ( ...@@ -474,7 +476,7 @@ acpi_ut_copy_esimple_to_isimple (
* *Buffer - Where the object is returned * *Buffer - Where the object is returned
* *Space_used - Where the length of the object is returned * *Space_used - Where the length of the object is returned
* *
* RETURN: Status - the status of the call * RETURN: Status
* *
* DESCRIPTION: This function is called to place a package object in a user * DESCRIPTION: This function is called to place a package object in a user
* buffer. A package object by definition contains other objects. * buffer. A package object by definition contains other objects.
...@@ -607,7 +609,8 @@ acpi_ut_copy_simple_object ( ...@@ -607,7 +609,8 @@ acpi_ut_copy_simple_object (
/* Copy the entire source object over the destination object*/ /* Copy the entire source object over the destination object*/
ACPI_MEMCPY ((char *) dest_desc, (char *) source_desc, sizeof (acpi_operand_object)); ACPI_MEMCPY ((char *) dest_desc, (char *) source_desc,
sizeof (acpi_operand_object));
/* Restore the saved fields */ /* Restore the saved fields */
...@@ -687,12 +690,16 @@ acpi_ut_copy_ielement_to_ielement ( ...@@ -687,12 +690,16 @@ acpi_ut_copy_ielement_to_ielement (
&state->pkg.dest_object->package.elements[this_index]; &state->pkg.dest_object->package.elements[this_index];
switch (object_type) { switch (object_type) {
case 0: case ACPI_COPY_TYPE_SIMPLE:
/* A null source object indicates a (legal) null package element */
if (source_object) {
/* /*
* This is a simple object, just copy it * This is a simple object, just copy it
*/ */
target_object = acpi_ut_create_internal_object (ACPI_GET_OBJECT_TYPE (source_object)); target_object = acpi_ut_create_internal_object (
ACPI_GET_OBJECT_TYPE (source_object));
if (!target_object) { if (!target_object) {
return (AE_NO_MEMORY); return (AE_NO_MEMORY);
} }
...@@ -703,10 +710,16 @@ acpi_ut_copy_ielement_to_ielement ( ...@@ -703,10 +710,16 @@ acpi_ut_copy_ielement_to_ielement (
} }
*this_target_ptr = target_object; *this_target_ptr = target_object;
}
else {
/* Pass through a null element */
*this_target_ptr = NULL;
}
break; break;
case 1: case ACPI_COPY_TYPE_PACKAGE:
/* /*
* This object is a package - go down another nesting level * This object is a package - go down another nesting level
...@@ -720,6 +733,17 @@ acpi_ut_copy_ielement_to_ielement ( ...@@ -720,6 +733,17 @@ acpi_ut_copy_ielement_to_ielement (
target_object->package.count = source_object->package.count; target_object->package.count = source_object->package.count;
target_object->common.flags = source_object->common.flags; target_object->common.flags = source_object->common.flags;
/*
* Create the object array
*/
target_object->package.elements =
ACPI_MEM_CALLOCATE (((ACPI_SIZE) source_object->package.count + 1) *
sizeof (void *));
if (!target_object->package.elements) {
ACPI_MEM_FREE (target_object);
return (AE_NO_MEMORY);
}
/* /*
* Pass the new package object back to the package walk routine * Pass the new package object back to the package walk routine
*/ */
......
/******************************************************************************* /*******************************************************************************
* *
* Module Name: utmisc - common utility procedures * Module Name: utmisc - common utility procedures
* $Revision: 86 $ * $Revision: 87 $
* *
******************************************************************************/ ******************************************************************************/
...@@ -475,7 +475,6 @@ acpi_ut_strupr ( ...@@ -475,7 +475,6 @@ acpi_ut_strupr (
string++; string++;
} }
return (src_string); return (src_string);
} }
...@@ -575,7 +574,6 @@ acpi_ut_create_mutex ( ...@@ -575,7 +574,6 @@ acpi_ut_create_mutex (
return_ACPI_STATUS (AE_BAD_PARAMETER); return_ACPI_STATUS (AE_BAD_PARAMETER);
} }
if (!acpi_gbl_acpi_mutex_info[mutex_id].mutex) { if (!acpi_gbl_acpi_mutex_info[mutex_id].mutex) {
status = acpi_os_create_semaphore (1, 1, status = acpi_os_create_semaphore (1, 1,
&acpi_gbl_acpi_mutex_info[mutex_id].mutex); &acpi_gbl_acpi_mutex_info[mutex_id].mutex);
...@@ -613,7 +611,6 @@ acpi_ut_delete_mutex ( ...@@ -613,7 +611,6 @@ acpi_ut_delete_mutex (
return_ACPI_STATUS (AE_BAD_PARAMETER); return_ACPI_STATUS (AE_BAD_PARAMETER);
} }
status = acpi_os_delete_semaphore (acpi_gbl_acpi_mutex_info[mutex_id].mutex); status = acpi_os_delete_semaphore (acpi_gbl_acpi_mutex_info[mutex_id].mutex);
acpi_gbl_acpi_mutex_info[mutex_id].mutex = NULL; acpi_gbl_acpi_mutex_info[mutex_id].mutex = NULL;
...@@ -651,7 +648,6 @@ acpi_ut_acquire_mutex ( ...@@ -651,7 +648,6 @@ acpi_ut_acquire_mutex (
return (AE_BAD_PARAMETER); return (AE_BAD_PARAMETER);
} }
this_thread_id = acpi_os_get_thread_id (); this_thread_id = acpi_os_get_thread_id ();
/* /*
...@@ -679,7 +675,6 @@ acpi_ut_acquire_mutex ( ...@@ -679,7 +675,6 @@ acpi_ut_acquire_mutex (
} }
} }
ACPI_DEBUG_PRINT ((ACPI_DB_MUTEX, ACPI_DEBUG_PRINT ((ACPI_DB_MUTEX,
"Thread %X attempting to acquire Mutex [%s]\n", "Thread %X attempting to acquire Mutex [%s]\n",
this_thread_id, acpi_ut_get_mutex_name (mutex_id))); this_thread_id, acpi_ut_get_mutex_name (mutex_id)));
...@@ -693,7 +688,6 @@ acpi_ut_acquire_mutex ( ...@@ -693,7 +688,6 @@ acpi_ut_acquire_mutex (
acpi_gbl_acpi_mutex_info[mutex_id].use_count++; acpi_gbl_acpi_mutex_info[mutex_id].use_count++;
acpi_gbl_acpi_mutex_info[mutex_id].owner_id = this_thread_id; acpi_gbl_acpi_mutex_info[mutex_id].owner_id = this_thread_id;
} }
else { else {
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Thread %X could not acquire Mutex [%s] %s\n", ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Thread %X could not acquire Mutex [%s] %s\n",
this_thread_id, acpi_ut_get_mutex_name (mutex_id), this_thread_id, acpi_ut_get_mutex_name (mutex_id),
...@@ -737,7 +731,6 @@ acpi_ut_release_mutex ( ...@@ -737,7 +731,6 @@ acpi_ut_release_mutex (
return (AE_BAD_PARAMETER); return (AE_BAD_PARAMETER);
} }
/* /*
* Mutex must be acquired in order to release it! * Mutex must be acquired in order to release it!
*/ */
...@@ -749,7 +742,6 @@ acpi_ut_release_mutex ( ...@@ -749,7 +742,6 @@ acpi_ut_release_mutex (
return (AE_NOT_ACQUIRED); return (AE_NOT_ACQUIRED);
} }
/* /*
* Deadlock prevention. Check if this thread owns any mutexes of value * Deadlock prevention. Check if this thread owns any mutexes of value
* greater than this one. If so, the thread has violated the mutex * greater than this one. If so, the thread has violated the mutex
...@@ -770,7 +762,6 @@ acpi_ut_release_mutex ( ...@@ -770,7 +762,6 @@ acpi_ut_release_mutex (
} }
} }
/* Mark unlocked FIRST */ /* Mark unlocked FIRST */
acpi_gbl_acpi_mutex_info[mutex_id].owner_id = ACPI_MUTEX_NOT_ACQUIRED; acpi_gbl_acpi_mutex_info[mutex_id].owner_id = ACPI_MUTEX_NOT_ACQUIRED;
...@@ -828,7 +819,6 @@ acpi_ut_create_update_state_and_push ( ...@@ -828,7 +819,6 @@ acpi_ut_create_update_state_and_push (
return (AE_NO_MEMORY); return (AE_NO_MEMORY);
} }
acpi_ut_push_generic_state (state_list, state); acpi_ut_push_generic_state (state_list, state);
return (AE_OK); return (AE_OK);
} }
...@@ -866,7 +856,6 @@ acpi_ut_create_pkg_state_and_push ( ...@@ -866,7 +856,6 @@ acpi_ut_create_pkg_state_and_push (
return (AE_NO_MEMORY); return (AE_NO_MEMORY);
} }
acpi_ut_push_generic_state (state_list, state); acpi_ut_push_generic_state (state_list, state);
return (AE_OK); return (AE_OK);
} }
...@@ -1129,7 +1118,6 @@ acpi_ut_create_control_state ( ...@@ -1129,7 +1118,6 @@ acpi_ut_create_control_state (
return_PTR (NULL); return_PTR (NULL);
} }
/* Init fields specific to the control struct */ /* Init fields specific to the control struct */
state->common.data_type = ACPI_DESC_TYPE_STATE_CONTROL; state->common.data_type = ACPI_DESC_TYPE_STATE_CONTROL;
...@@ -1224,6 +1212,8 @@ acpi_ut_walk_package_tree ( ...@@ -1224,6 +1212,8 @@ acpi_ut_walk_package_tree (
} }
while (state) { while (state) {
/* Get one element of the package */
this_index = state->pkg.index; this_index = state->pkg.index;
this_source_obj = (acpi_operand_object *) this_source_obj = (acpi_operand_object *)
state->pkg.source_object->package.elements[this_index]; state->pkg.source_object->package.elements[this_index];
...@@ -1324,6 +1314,7 @@ acpi_ut_generate_checksum ( ...@@ -1324,6 +1314,7 @@ acpi_ut_generate_checksum (
u32 i; u32 i;
signed char sum = 0; signed char sum = 0;
for (i = 0; i < length; i++) { for (i = 0; i < length; i++) {
sum = (signed char) (sum + buffer[i]); sum = (signed char) (sum + buffer[i]);
} }
......
...@@ -20,6 +20,7 @@ ...@@ -20,6 +20,7 @@
#include <linux/sched.h> #include <linux/sched.h>
#include <linux/vmalloc.h> #include <linux/vmalloc.h>
#include <linux/smp.h> #include <linux/smp.h>
#include <linux/errno.h>
#include "cpu_buffer.h" #include "cpu_buffer.h"
#include "oprof.h" #include "oprof.h"
......
...@@ -6,13 +6,14 @@ ...@@ -6,13 +6,14 @@
*/ */
#include <linux/config.h> #include <linux/config.h>
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/sched.h>
#include <linux/errno.h> #include <linux/errno.h>
#include <linux/interrupt.h>
#include <linux/init.h> #include <linux/init.h>
#include <asm/hardware.h> #include <asm/hardware.h>
#include <asm/mach-types.h> #include <asm/mach-types.h>
#include <asm/irq.h> #include <asm/irq.h>
#include <asm/signal.h>
#include <asm/arch/assabet.h> #include <asm/arch/assabet.h>
#include "sa1100_generic.h" #include "sa1100_generic.h"
......
...@@ -31,40 +31,41 @@ ...@@ -31,40 +31,41 @@
* *
* PCM Vcc: * PCM Vcc:
* *
* PCM Vcc on BadgePAD 4 can be jumpered for 3.3V (short pins 1 and 3 * PCM Vcc on BadgePAD 4 can be jumpered for 3v3 (short pins 1 and 3
* on JP6) or 5V (short pins 3 and 5 on JP6). N.B., 5V supply rail * on JP6) or 5v0 (short pins 3 and 5 on JP6).
* is enabled by the SA-1110's BADGE4_GPIO_PCMEN5V (GPIO 24).
* *
* PCM Vpp: * PCM Vpp:
* *
* PCM Vpp on BadgePAD 4 can be jumpered for 12V (short pins 2 and 4 * PCM Vpp on BadgePAD 4 can be jumpered for 12v0 (short pins 4 and 6
* on JP6) or tied to PCM Vcc (short pins 4 and 6 on JP6). N.B., 12V * on JP6) or tied to PCM Vcc (short pins 2 and 4 on JP6). N.B.,
* operation requires that the power supply actually supply 12V. * 12v0 operation requires that the power supply actually supply 12v0
* via pin 7 of JP7.
* *
* CF Vcc: * CF Vcc:
* *
* CF Vcc on BadgePAD 4 can be jumpered either for 3.3V (short pins 1 * CF Vcc on BadgePAD 4 can be jumpered either for 3v3 (short pins 1
* and 2 on JP10) or 5V (short pins 2 and 3 on JP10). The note above * and 2 on JP10) or 5v0 (short pins 2 and 3 on JP10).
* about the 5V supply rail applies.
* *
* There's no way programmatically to determine how a given board is * Unfortunately there's no way programmatically to determine how a
* jumpered. This code assumes a default jumpering: 5V PCM Vcc (pins * given board is jumpered. This code assumes a default jumpering
* 3 and 5 shorted) and PCM Vpp = PCM Vcc (pins 4 and 6 shorted) and * as described below.
* no jumpering for CF Vcc. If this isn't correct, Override these *
* defaults with a pcmv setup argument: pcmv=<pcm vcc>,<pcm vpp>,<cf * If the defaults aren't correct, you may override them with a pcmv
* vcc>. E.g. pcmv=33,120,50 indicates 3.3V PCM Vcc, 12.0V PCM Vpp, * setup argument: pcmv=<pcm vcc>,<pcm vpp>,<cf vcc>. The units are
* and 5.0V CF Vcc. * tenths of volts; e.g. pcmv=33,120,50 indicates 3v3 PCM Vcc, 12v0
* PCM Vpp, and 5v0 CF Vcc.
* *
*/ */
static int badge4_pcmvcc = 50; static int badge4_pcmvcc = 50; /* pins 3 and 5 jumpered on JP6 */
static int badge4_pcmvpp = 50; static int badge4_pcmvpp = 50; /* pins 2 and 4 jumpered on JP6 */
static int badge4_cfvcc = 33; static int badge4_cfvcc = 33; /* pins 1 and 2 jumpered on JP10 */
static int badge4_pcmcia_init(struct pcmcia_init *init) static int badge4_pcmcia_init(struct pcmcia_init *init)
{ {
printk(KERN_INFO __FUNCTION__ printk(KERN_INFO
": badge4_pcmvcc=%d, badge4_pcmvpp=%d, badge4_cfvcc=%d\n", "%s: badge4_pcmvcc=%d, badge4_pcmvpp=%d, badge4_cfvcc=%d\n",
__FUNCTION__,
badge4_pcmvcc, badge4_pcmvpp, badge4_cfvcc); badge4_pcmvcc, badge4_pcmvpp, badge4_cfvcc);
return sa1111_pcmcia_init(init); return sa1111_pcmcia_init(init);
...@@ -74,7 +75,7 @@ static int badge4_pcmcia_shutdown(void) ...@@ -74,7 +75,7 @@ static int badge4_pcmcia_shutdown(void)
{ {
int rc = sa1111_pcmcia_shutdown(); int rc = sa1111_pcmcia_shutdown();
/* be sure to disable 5V use */ /* be sure to disable 5v0 use */
badge4_set_5V(BADGE4_5V_PCMCIA_SOCK0, 0); badge4_set_5V(BADGE4_5V_PCMCIA_SOCK0, 0);
badge4_set_5V(BADGE4_5V_PCMCIA_SOCK1, 0); badge4_set_5V(BADGE4_5V_PCMCIA_SOCK1, 0);
...@@ -105,7 +106,8 @@ badge4_pcmcia_configure_socket(const struct pcmcia_configure *conf) ...@@ -105,7 +106,8 @@ badge4_pcmcia_configure_socket(const struct pcmcia_configure *conf)
(conf->vcc != badge4_pcmvcc)) { (conf->vcc != badge4_pcmvcc)) {
complain_about_jumpering(__FUNCTION__, "pcmvcc", complain_about_jumpering(__FUNCTION__, "pcmvcc",
badge4_pcmvcc, conf->vcc); badge4_pcmvcc, conf->vcc);
return -1; // Apply power regardless of the jumpering.
// return -1;
} }
if ((conf->vpp != 0) && if ((conf->vpp != 0) &&
(conf->vpp != badge4_pcmvpp)) { (conf->vpp != badge4_pcmvpp)) {
...@@ -156,7 +158,7 @@ static struct pcmcia_low_level badge4_pcmcia_ops = { ...@@ -156,7 +158,7 @@ static struct pcmcia_low_level badge4_pcmcia_ops = {
.socket_suspend = sa1111_pcmcia_socket_suspend, .socket_suspend = sa1111_pcmcia_socket_suspend,
}; };
int __init pcmcia_badge4_init(void) int pcmcia_badge4_init(void)
{ {
int ret = -ENODEV; int ret = -ENODEV;
...@@ -166,7 +168,7 @@ int __init pcmcia_badge4_init(void) ...@@ -166,7 +168,7 @@ int __init pcmcia_badge4_init(void)
return ret; return ret;
} }
void __exit pcmcia_badge4_exit(void) void __devexit pcmcia_badge4_exit(void)
{ {
sa1100_unregister_pcmcia(&badge4_pcmcia_ops); sa1100_unregister_pcmcia(&badge4_pcmcia_ops);
} }
......
...@@ -7,9 +7,9 @@ ...@@ -7,9 +7,9 @@
*/ */
#include <linux/module.h> #include <linux/module.h>
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/sched.h>
#include <linux/ioport.h> #include <linux/ioport.h>
#include <linux/device.h> #include <linux/device.h>
#include <linux/interrupt.h>
#include <linux/init.h> #include <linux/init.h>
#include <asm/hardware.h> #include <asm/hardware.h>
......
...@@ -55,8 +55,6 @@ static int __devinit serial_card_probe(struct expansion_card *ec, const struct e ...@@ -55,8 +55,6 @@ static int __devinit serial_card_probe(struct expansion_card *ec, const struct e
unsigned long cardaddr, address; unsigned long cardaddr, address;
int port; int port;
ecard_claim (ec);
info = kmalloc(sizeof(struct serial_card_info), GFP_KERNEL); info = kmalloc(sizeof(struct serial_card_info), GFP_KERNEL);
if (!info) if (!info)
return -ENOMEM; return -ENOMEM;
...@@ -64,6 +62,8 @@ static int __devinit serial_card_probe(struct expansion_card *ec, const struct e ...@@ -64,6 +62,8 @@ static int __devinit serial_card_probe(struct expansion_card *ec, const struct e
memset(info, 0, sizeof(struct serial_card_info)); memset(info, 0, sizeof(struct serial_card_info));
info->num_ports = type->num_ports; info->num_ports = type->num_ports;
ecard_set_drvdata(ec, info);
cardaddr = ecard_address(ec, type->type, type->speed); cardaddr = ecard_address(ec, type->type, type->speed);
for (port = 0; port < info->num_ports; port ++) { for (port = 0; port < info->num_ports; port ++) {
...@@ -98,8 +98,6 @@ static void __devexit serial_card_remove(struct expansion_card *ec) ...@@ -98,8 +98,6 @@ static void __devexit serial_card_remove(struct expansion_card *ec)
} }
kfree(info); kfree(info);
ecard_release(ec);
} }
static struct serial_card_type atomwide_type = { static struct serial_card_type atomwide_type = {
......
...@@ -365,7 +365,7 @@ config SERIAL_SUNSAB ...@@ -365,7 +365,7 @@ config SERIAL_SUNSAB
config V850E_NB85E_UART config V850E_NB85E_UART
bool "NEC V850E on-chip UART support" bool "NEC V850E on-chip UART support"
depends on V850E_NB85E || V850E2_ANNA depends on V850E_NB85E || V850E2_ANNA || V850E_AS85EP1
default y default y
config V850E_NB85E_UART_CONSOLE config V850E_NB85E_UART_CONSOLE
......
...@@ -25,10 +25,10 @@ ...@@ -25,10 +25,10 @@
/* Initial UART state. This may be overridden by machine-dependent headers. */ /* Initial UART state. This may be overridden by machine-dependent headers. */
#ifndef NB85E_UART_INIT_BAUD #ifndef NB85E_UART_INIT_BAUD
#define NB85E_UART_INIT_BAUD 38400 #define NB85E_UART_INIT_BAUD 115200
#endif #endif
#ifndef NB85E_UART_INIT_CFLAGS #ifndef NB85E_UART_INIT_CFLAGS
#define NB85E_UART_INIT_CFLAGS (B38400 | CS8 | CREAD) #define NB85E_UART_INIT_CFLAGS (B115200 | CS8 | CREAD)
#endif #endif
/* A string used for prefixing printed descriptions; since the same UART /* A string used for prefixing printed descriptions; since the same UART
...@@ -304,7 +304,7 @@ void nb85e_uart_tx (struct uart_port *port) ...@@ -304,7 +304,7 @@ void nb85e_uart_tx (struct uart_port *port)
port->icount.tx++; port->icount.tx++;
if (uart_circ_chars_pending (xmit) < WAKEUP_CHARS) if (uart_circ_chars_pending (xmit) < WAKEUP_CHARS)
uart_event (port, EVT_WRITE_WAKEUP); uart_write_wakeup (port);
} }
no_xmit: no_xmit:
......
...@@ -42,6 +42,6 @@ ide_init_default_hwifs(void) ...@@ -42,6 +42,6 @@ ide_init_default_hwifs(void)
ide_init_hwif_ports(&hw, 0x1f0, 0x3f6, NULL); ide_init_hwif_ports(&hw, 0x1f0, 0x3f6, NULL);
hw.irq = 14; hw.irq = 14;
ide_register_hw(&hw); ide_register_hw(&hw,NULL);
} }
...@@ -7,5 +7,6 @@ ...@@ -7,5 +7,6 @@
#define NR_IRQS 16 #define NR_IRQS 16
#define IRQ_ISA_KEYBOARD 1 #define IRQ_ISA_KEYBOARD 1
#define RTC_IRQ 8
#define AUX_IRQ 12 #define AUX_IRQ 12
#define IRQ_HARDDISK 14 #define IRQ_HARDDISK 14
...@@ -38,6 +38,4 @@ ...@@ -38,6 +38,4 @@
#define __bus_to_virt__is_a_macro #define __bus_to_virt__is_a_macro
#define __bus_to_virt(x) __phys_to_virt(x) #define __bus_to_virt(x) __phys_to_virt(x)
#define isa_virt_to_bus virt_to_bus
#endif #endif
...@@ -3,3 +3,5 @@ ...@@ -3,3 +3,5 @@
* *
* by Alexander Schulz * by Alexander Schulz
*/ */
#define CLOCK_TICK_RATE 1193180
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
#define ELF_THUMB_OK(x) \ #define ELF_THUMB_OK(x) \
(( (elf_hwcap & HWCAP_THUMB) && ((x)->e_entry & 1) == 1) || \ (( (elf_hwcap & HWCAP_THUMB) && ((x)->e_entry & 1) == 1) || \
(!(elf_hwcap & HWCAP_THUMB) && ((x)->e_entry & 3) == 0)) ((x)->e_entry & 3) == 0)
#define ELF_26BIT_OK(x) \ #define ELF_26BIT_OK(x) \
(( (elf_hwcap & HWCAP_26BIT) && (x)->e_flags & EF_ARM_APCS26) || \ (( (elf_hwcap & HWCAP_26BIT) && (x)->e_flags & EF_ARM_APCS26) || \
......
#ifdef _ASMARM_SUSPEND_H #ifndef _ASMARM_SUSPEND_H
#define _ASMARM_SUSPEND_H #define _ASMARM_SUSPEND_H
#endif #endif
...@@ -127,6 +127,22 @@ extern void anna_uart_pre_configure (unsigned chan, ...@@ -127,6 +127,22 @@ extern void anna_uart_pre_configure (unsigned chan,
unsigned cflags, unsigned baud); unsigned cflags, unsigned baud);
#endif #endif
/* This board supports RTS/CTS for the on-chip UART, but only for channel 1. */
/* CTS for UART channel 1 is pin P37 (bit 7 of port 3). */
#define NB85E_UART_CTS(chan) ((chan) == 1 ? !(ANNA_PORT_IO(3) & 0x80) : 1)
/* RTS for UART channel 1 is pin P07 (bit 7 of port 0). */
#define NB85E_UART_SET_RTS(chan, val) \
do { \
if (chan == 1) { \
unsigned old = ANNA_PORT_IO(0); \
if (val) \
ANNA_PORT_IO(0) = old & ~0x80; \
else \
ANNA_PORT_IO(0) = old | 0x80; \
} \
} while (0)
/* Timer C details. */ /* Timer C details. */
#define NB85E_TIMER_C_BASE_ADDR 0xFFFFF600 #define NB85E_TIMER_C_BASE_ADDR 0xFFFFF600
......
This diff is collapsed.
...@@ -16,6 +16,10 @@ ...@@ -16,6 +16,10 @@
.globl name; \ .globl name; \
.type name,@function; \ .type name,@function; \
name name
#define G_DATA(name) \
.globl name; \
.type name,@object; \
name
#define END(name) \ #define END(name) \
.size name,.-name .size name,.-name
...@@ -23,3 +27,6 @@ ...@@ -23,3 +27,6 @@
.align 4; \ .align 4; \
.type name,@function; \ .type name,@function; \
name name
#define L_DATA(name) \
.type name,@object; \
name
...@@ -20,6 +20,7 @@ ...@@ -20,6 +20,7 @@
#define C_SYMBOL_NAME(name) macrology_paste(_, name) #define C_SYMBOL_NAME(name) macrology_paste(_, name)
#define C_SYMBOL_STRING(name) macrology_stringify(C_SYMBOL_NAME(name)) #define C_SYMBOL_STRING(name) macrology_stringify(C_SYMBOL_NAME(name))
#define C_ENTRY(name) G_ENTRY(C_SYMBOL_NAME(name)) #define C_ENTRY(name) G_ENTRY(C_SYMBOL_NAME(name))
#define C_DATA(name) G_DATA(C_SYMBOL_NAME(name))
#define C_END(name) END(C_SYMBOL_NAME(name)) #define C_END(name) END(C_SYMBOL_NAME(name))
#endif /* __V850_CLINKAGE_H__ */ #endif /* __V850_CLINKAGE_H__ */
...@@ -19,7 +19,8 @@ typedef struct user_fpu_struct elf_fpregset_t; ...@@ -19,7 +19,8 @@ typedef struct user_fpu_struct elf_fpregset_t;
/* /*
* This is used to ensure we don't load something for the wrong architecture. * This is used to ensure we don't load something for the wrong architecture.
*/ */
#define elf_check_arch(x) ( (x)->e_machine == EM_CYGNUS_V850 ) #define elf_check_arch(x) \
((x)->e_machine == EM_V850 || (x)->e_machine == EM_CYGNUS_V850)
/* /*
* These are used to set parameters in the core dumps. * These are used to set parameters in the core dumps.
......
...@@ -20,7 +20,10 @@ ...@@ -20,7 +20,10 @@
#define CPU_ARCH "v850e2" #define CPU_ARCH "v850e2"
#define CPU_MODEL "FPGA NA85E2C/V850E2" #define CPU_MODEL "v850e2/fpga85e2c"
#define CPU_MODEL_LONG "NEC V850E2/NA85E2C"
#define PLATFORM "fpga85e2c"
#define PLATFORM_LONG "NA85E2C FPGA implementation"
/* `external ram'. */ /* `external ram'. */
......
...@@ -65,7 +65,7 @@ extern void gbus_int_disable_irq (unsigned irq); ...@@ -65,7 +65,7 @@ extern void gbus_int_disable_irq (unsigned irq);
/* Return true if interrupt handling for interrupt IRQ is enabled. */ /* Return true if interrupt handling for interrupt IRQ is enabled. */
extern int gbus_int_irq_enabled (unsigned irq); extern int gbus_int_irq_enabled (unsigned irq);
/* Disable all GBUS irqs. */ /* Disable all GBUS irqs. */
extern int gbus_int_disable_irqs (void); extern void gbus_int_disable_irqs (void);
/* Clear any pending interrupts for IRQ. */ /* Clear any pending interrupts for IRQ. */
extern void gbus_int_clear_pending_irq (unsigned irq); extern void gbus_int_clear_pending_irq (unsigned irq);
/* Return true if interrupt IRQ is pending (but disabled). */ /* Return true if interrupt IRQ is pending (but disabled). */
......
...@@ -3,6 +3,7 @@ ...@@ -3,6 +3,7 @@
#include <linux/config.h> #include <linux/config.h>
#include <linux/threads.h> #include <linux/threads.h>
#include <linux/cache.h>
typedef struct { typedef struct {
unsigned int __softirq_pending; unsigned int __softirq_pending;
......
...@@ -52,6 +52,17 @@ typedef void (*irq_handler_t)(int irq, void *data, struct pt_regs *regs); ...@@ -52,6 +52,17 @@ typedef void (*irq_handler_t)(int irq, void *data, struct pt_regs *regs);
interrupt. */ interrupt. */
extern unsigned int handle_irq (int irq, struct pt_regs *regs); extern unsigned int handle_irq (int irq, struct pt_regs *regs);
/* Enable interrupt handling on an irq. */
extern void enable_irq(unsigned int irq);
/* Disable an irq and wait for completion. */
extern void disable_irq (unsigned int irq);
/* Disable an irq without waiting. */
extern void disable_irq_nosync (unsigned int irq);
#endif /* !__ASSEMBLY__ */ #endif /* !__ASSEMBLY__ */
#endif /* __V850_IRQ_H__ */ #endif /* __V850_IRQ_H__ */
...@@ -24,10 +24,13 @@ ...@@ -24,10 +24,13 @@
#include <asm/teg.h> #include <asm/teg.h>
#endif #endif
/* Anna is both a chip _and_ a platform, so put it in the middle... */ /* These are both chips _and_ platforms, so put them in the middle... */
#ifdef CONFIG_V850E2_ANNA #ifdef CONFIG_V850E2_ANNA
#include <asm/anna.h> #include <asm/anna.h>
#endif #endif
#ifdef CONFIG_V850E_AS85EP1
#include <asm/as85ep1.h>
#endif
/* platforms */ /* platforms */
#ifdef CONFIG_RTE_CB_MA1 #ifdef CONFIG_RTE_CB_MA1
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
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