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
S: Calgary, Alberta
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
E: ralf@gnu.org
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)
/* Head of the taglist */
tag->hdr.tag = ATAG_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.rootdev = 0;
......
......@@ -40,6 +40,7 @@ CONFIG_KMOD=y
# CONFIG_ARCH_CLPS7500 is not set
# CONFIG_ARCH_CLPS711X is not set
# CONFIG_ARCH_CO285 is not set
# CONFIG_ARCH_PXA is not set
# CONFIG_ARCH_EBSA110 is not set
# CONFIG_ARCH_CAMELOT is not set
# CONFIG_ARCH_FOOTBRIDGE is not set
......@@ -109,6 +110,12 @@ CONFIG_ARCH_SHARK=y
# CONFIG_SA1100_USB_CHAR is not set
# CONFIG_H3600_SLEEVE is not set
#
# Intel PXA250/210 Implementations
#
# CONFIG_ARCH_LUBBOCK is not set
# CONFIG_ARCH_PXA_IDP is not set
#
# CLPS711X/EP721X Implementations
#
......@@ -120,6 +127,19 @@ CONFIG_ARCH_SHARK=y
# CONFIG_ARCH_FORTUNET is not set
# CONFIG_ARCH_EP7211 is not set
# CONFIG_ARCH_EP7212 is not set
#
# IOP310 Implementation Options
#
# CONFIG_ARCH_IQ80310 is not set
#
# IOP310 Chipset Features
#
# CONFIG_IOP310_AAU is not set
# CONFIG_IOP310_DMA is not set
# CONFIG_IOP310_MU is not set
# CONFIG_IOP310_PMON is not set
# CONFIG_ARCH_ACORN is not set
# CONFIG_FOOTBRIDGE is not set
# CONFIG_FOOTBRIDGE_HOST is not set
......@@ -159,6 +179,9 @@ CONFIG_PCI_HOST_VIA82C505=y
CONFIG_ISA=y
CONFIG_ISA_DMA=y
# CONFIG_FIQ is not set
# CONFIG_ZBOOT_ROM is not set
CONFIG_ZBOOT_ROM_TEXT=0
CONFIG_ZBOOT_ROM_BSS=0
# CONFIG_PCI_NAMES is not set
# CONFIG_HOTPLUG is not set
# CONFIG_PCMCIA is not set
......@@ -177,10 +200,11 @@ CONFIG_BINFMT_ELF=y
# CONFIG_PREEMPT is not set
# CONFIG_APM is not set
# CONFIG_ARTHUR is not set
CONFIG_CMDLINE=""
CONFIG_LEDS=y
CONFIG_LEDS_TIMER=y
# CONFIG_LEDS_CPU is not set
# CONFIG_ALIGNMENT_TRAP is not set
CONFIG_ALIGNMENT_TRAP=y
#
# Parallel port support
......@@ -200,6 +224,11 @@ CONFIG_PARPORT_PC_CML1=y
# CONFIG_PARPORT_OTHER is not set
# CONFIG_PARPORT_1284 is not set
#
# Memory Technology Devices (MTD)
#
# CONFIG_MTD is not set
#
# Plug and Play configuration
#
......@@ -217,6 +246,7 @@ CONFIG_PARPORT_PC_CML1=y
# CONFIG_BLK_CPQ_CISS_DA is not set
# CONFIG_CISS_SCSI_TAPE is not set
# CONFIG_BLK_DEV_DAC960 is not set
# CONFIG_BLK_DEV_UMEM is not set
CONFIG_BLK_DEV_LOOP=y
# CONFIG_BLK_DEV_NBD is not set
CONFIG_BLK_DEV_RAM=y
......@@ -254,7 +284,6 @@ CONFIG_INET=y
# CONFIG_INET_ECN is not set
# CONFIG_SYN_COOKIES is not set
# CONFIG_IPV6 is not set
# CONFIG_KHTTPD is not set
# CONFIG_ATM is not set
# CONFIG_VLAN_8021Q is not set
......@@ -263,6 +292,11 @@ CONFIG_INET=y
#
# CONFIG_IPX is not set
# CONFIG_ATALK is not set
#
# Appletalk devices
#
# CONFIG_DEV_APPLETALK is not set
# CONFIG_DECNET is not set
# CONFIG_BRIDGE is not set
# CONFIG_X25 is not set
......@@ -378,7 +412,7 @@ CONFIG_CS89x0=y
# CONFIG_WAN is not set
#
# "Tulip" family network device support
# Tulip family network device support
#
# CONFIG_NET_TULIP is not set
......@@ -393,38 +427,66 @@ CONFIG_CS89x0=y
# CONFIG_IRDA is not set
#
# ATA/IDE/MFM/RLL support
# ATA/ATAPI/MFM/RLL support
#
CONFIG_IDE=y
#
# ATA and ATAPI Block devices
#
CONFIG_BLK_DEV_IDE=y
#
# Please see Documentation/ide.txt for help/info on IDE drives
#
# CONFIG_BLK_DEV_HD_IDE is not set
# CONFIG_BLK_DEV_HD is not set
CONFIG_BLK_DEV_IDEDISK=y
# CONFIG_IDEDISK_MULTI_MODE is not set
# CONFIG_IDEDISK_STROKE is not set
# CONFIG_BLK_DEV_IDECS is not set
CONFIG_ATAPI=y
CONFIG_BLK_DEV_IDECD=y
# CONFIG_BLK_DEV_IDETAPE is not set
CONFIG_BLK_DEV_IDEFLOPPY=y
# CONFIG_BLK_DEV_IDESCSI is not set
# CONFIG_BLK_DEV_IDECS is not set
#
# IDE chipset support
# ATA host controller support
#
# CONFIG_BLK_DEV_RZ1000 is not set
# CONFIG_BLK_DEV_CMD640 is not set
# CONFIG_BLK_DEV_CMD640_ENHANCED is not set
# CONFIG_BLK_DEV_ISAPNP is not set
# CONFIG_BLK_DEV_RZ1000 is not set
#
# PCI host controller support
#
# CONFIG_BLK_DEV_OFFBOARD is not set
# CONFIG_IDEPCI_SHARE_IRQ is not set
# CONFIG_BLK_DEV_IDEDMA_PCI is not set
# CONFIG_IDEDMA_PCI_AUTO is not set
# CONFIG_IDEDMA_ONLYDISK is not set
# CONFIG_BLK_DEV_IDEDMA is not set
# CONFIG_BLK_DEV_IDE_TCQ is not set
# CONFIG_BLK_DEV_IDE_TCQ_DEFAULT is not set
# CONFIG_IDEDMA_NEW_DRIVE_LISTINGS is not set
# CONFIG_BLK_DEV_AEC62XX is not set
# CONFIG_AEC6280_BURST is not set
# CONFIG_BLK_DEV_ALI15X3 is not set
# CONFIG_WDC_ALI15X3 is not set
# CONFIG_BLK_DEV_AMD74XX is not set
# CONFIG_BLK_DEV_CMD64X is not set
# CONFIG_BLK_DEV_CY82C693 is not set
# CONFIG_BLK_DEV_CS5530 is not set
# CONFIG_BLK_DEV_HPT34X is not set
# CONFIG_HPT34X_AUTODMA is not set
# CONFIG_BLK_DEV_HPT366 is not set
# CONFIG_BLK_DEV_PIIX is not set
# CONFIG_BLK_DEV_NS87415 is not set
# CONFIG_BLK_DEV_OPTI621 is not set
# CONFIG_BLK_DEV_PDC202XX is not set
# CONFIG_PDC202XX_BURST is not set
# CONFIG_PDC202XX_FORCE is not set
# CONFIG_BLK_DEV_SVWKS is not set
# CONFIG_BLK_DEV_SIS5513 is not set
# CONFIG_BLK_DEV_TRM290 is not set
# CONFIG_BLK_DEV_VIA82CXXX is not set
# CONFIG_BLK_DEV_SL82C105 is not set
# CONFIG_IDE_CHIPSETS is not set
# CONFIG_IDEDMA_IVB is not set
# CONFIG_IDEDMA_AUTO is not set
# CONFIG_BLK_DEV_ATARAID is not set
# CONFIG_BLK_DEV_ATARAID_PDC is not set
......@@ -451,6 +513,7 @@ CONFIG_CHR_DEV_SG=m
# Some SCSI devices (e.g. CD jukebox) support multiple LUNs
#
# CONFIG_SCSI_MULTI_LUN is not set
# CONFIG_SCSI_REPORT_LUNS is not set
# CONFIG_SCSI_CONSTANTS is not set
# CONFIG_SCSI_LOGGING is not set
......@@ -462,7 +525,6 @@ CONFIG_CHR_DEV_SG=m
# CONFIG_SCSI_ACARD is not set
# CONFIG_SCSI_AHA152X is not set
# CONFIG_SCSI_AHA1542 is not set
# CONFIG_SCSI_AHA1740 is not set
# CONFIG_SCSI_AIC7XXX is not set
# CONFIG_SCSI_AIC7XXX_OLD is not set
# CONFIG_SCSI_DPT_I2O is not set
......@@ -522,42 +584,60 @@ CONFIG_CHR_DEV_SG=m
#
# ISDN subsystem
#
# CONFIG_ISDN is not set
# CONFIG_ISDN_BOOL is not set
#
# Input device support
#
# CONFIG_INPUT is not set
#
# Userland interfaces
#
# CONFIG_INPUT_KEYBDEV is not set
# CONFIG_INPUT_MOUSEDEV is not set
# CONFIG_INPUT_MOUSEDEV_PSAUX is not set
# CONFIG_INPUT_JOYDEV is not set
# CONFIG_INPUT_TSDEV is not set
# CONFIG_INPUT_TSLIBDEV is not set
# CONFIG_INPUT_EVDEV is not set
# CONFIG_INPUT_EVBUG is not set
# CONFIG_INPUT_UINPUT is not set
#
# Input I/O drivers
#
# CONFIG_GAMEPORT is not set
CONFIG_SOUND_GAMEPORT=y
# CONFIG_GAMEPORT_NS558 is not set
# CONFIG_GAMEPORT_L4 is not set
# CONFIG_INPUT_EMU10K1 is not set
# CONFIG_GAMEPORT_PCIGAME is not set
# CONFIG_GAMEPORT_EMU10K1 is not set
# CONFIG_GAMEPORT_VORTEX is not set
# CONFIG_GAMEPORT_FM801 is not set
# CONFIG_GAMEPORT_CS461x is not set
# CONFIG_SERIO is not set
# CONFIG_SERIO_I8042 is not set
# CONFIG_SERIO_SERPORT is not set
# CONFIG_SERIO_CT82C710 is not set
# CONFIG_SERIO_PARKBD is not set
#
# Input Device Drivers
#
#
# Character devices
#
CONFIG_VT=y
CONFIG_VT_CONSOLE=y
CONFIG_SERIAL=y
CONFIG_SERIAL_CONSOLE=y
# CONFIG_SERIAL_EXTENDED is not set
# CONFIG_SERIAL_NONSTANDARD is not set
#
# Serial drivers
#
# CONFIG_SERIAL_8250 is not set
# CONFIG_SERIAL_8250_CONSOLE is not set
CONFIG_SERIAL_8250=y
CONFIG_SERIAL_8250_CONSOLE=y
# CONFIG_SERIAL_8250_CS is not set
# CONFIG_SERIAL_8250_EXTENDED is not set
# CONFIG_SERIAL_8250_MANY_PORTS is not set
# CONFIG_SERIAL_8250_SHARE_IRQ is not set
......@@ -568,10 +648,6 @@ CONFIG_SERIAL_CONSOLE=y
#
# Non-8250 serial port support
#
#
# ARM Serial drivers
#
# CONFIG_ATOMWIDE_SERIAL is not set
# CONFIG_DUALSP_SERIAL is not set
# CONFIG_SERIAL_ANAKIN is not set
......@@ -580,6 +656,7 @@ CONFIG_SERIAL_CONSOLE=y
# CONFIG_SERIAL_AMBA_CONSOLE is not set
# CONFIG_SERIAL_CLPS711X is not set
# CONFIG_SERIAL_CLPS711X_CONSOLE is not set
# CONFIG_SERIAL_CLPS711X_OLD_NAME is not set
# CONFIG_SERIAL_21285 is not set
# CONFIG_SERIAL_21285_OLD is not set
# CONFIG_SERIAL_21285_CONSOLE is not set
......@@ -587,6 +664,8 @@ CONFIG_SERIAL_CONSOLE=y
# CONFIG_SERIAL_UART00_CONSOLE is not set
# CONFIG_SERIAL_SA1100 is not set
# CONFIG_SERIAL_SA1100_CONSOLE is not set
CONFIG_SERIAL_CORE=y
CONFIG_SERIAL_CORE_CONSOLE=y
CONFIG_UNIX98_PTYS=y
CONFIG_UNIX98_PTY_COUNT=256
CONFIG_PRINTER=m
......@@ -615,17 +694,13 @@ CONFIG_PRINTER=m
# Mice
#
# CONFIG_BUSMOUSE is not set
CONFIG_MOUSE=y
CONFIG_PSMOUSE=y
# CONFIG_82C710_MOUSE is not set
# CONFIG_PC110_PAD is not set
# CONFIG_QIC02_TAPE is not set
#
# Watchdog Cards
#
# CONFIG_WATCHDOG is not set
# CONFIG_INTEL_RNG is not set
# CONFIG_NVRAM is not set
CONFIG_RTC=y
# CONFIG_DTLK is not set
......@@ -638,6 +713,7 @@ CONFIG_RTC=y
# CONFIG_FTAPE is not set
# CONFIG_AGP is not set
# CONFIG_DRM is not set
# CONFIG_RAW_DRIVER is not set
#
# Multimedia devices
......@@ -648,6 +724,8 @@ CONFIG_RTC=y
# File systems
#
# CONFIG_QUOTA is not set
# CONFIG_QFMT_V1 is not set
# CONFIG_QFMT_V2 is not set
# CONFIG_AUTOFS_FS is not set
# CONFIG_AUTOFS4_FS is not set
# CONFIG_REISERFS_FS is not set
......@@ -711,6 +789,7 @@ CONFIG_NFS_FS=y
# CONFIG_NFSD_TCP is not set
CONFIG_SUNRPC=y
CONFIG_LOCKD=y
# CONFIG_EXPORTFS is not set
# CONFIG_SMB_FS is not set
# CONFIG_NCP_FS is not set
# CONFIG_NCPFS_PACKET_SIGNING is not set
......@@ -741,6 +820,7 @@ CONFIG_MSDOS_PARTITION=y
# CONFIG_SGI_PARTITION is not set
# CONFIG_ULTRIX_PARTITION is not set
# CONFIG_SUN_PARTITION is not set
# CONFIG_EFI_PARTITION is not set
# CONFIG_SMB_NLS is not set
CONFIG_NLS=y
......@@ -769,6 +849,7 @@ CONFIG_NLS_CODEPAGE_850=y
# CONFIG_NLS_CODEPAGE_949 is not set
# CONFIG_NLS_CODEPAGE_874 is not set
# CONFIG_NLS_ISO8859_8 is not set
# CONFIG_NLS_CODEPAGE_1250 is not set
# CONFIG_NLS_CODEPAGE_1251 is not set
CONFIG_NLS_ISO8859_1=y
# CONFIG_NLS_ISO8859_2 is not set
......@@ -788,8 +869,6 @@ CONFIG_NLS_ISO8859_1=y
#
# Console drivers
#
CONFIG_PC_KEYB=y
CONFIG_PC_KEYMAP=y
# CONFIG_VGA_CONSOLE is not set
#
......@@ -797,7 +876,6 @@ CONFIG_PC_KEYMAP=y
#
CONFIG_FB=y
CONFIG_DUMMY_CONSOLE=y
# CONFIG_FB_RIVA is not set
# CONFIG_FB_CLGEN is not set
# CONFIG_FB_PM2 is not set
# CONFIG_FB_PM3 is not set
......@@ -806,6 +884,7 @@ CONFIG_DUMMY_CONSOLE=y
# CONFIG_FB_CLPS711X is not set
# CONFIG_FB_SA1100 is not set
CONFIG_FB_CYBER2000=y
# CONFIG_FB_RIVA is not set
# CONFIG_FB_MATROX is not set
# CONFIG_FB_ATY is not set
# CONFIG_FB_RADEON is not set
......@@ -814,6 +893,8 @@ CONFIG_FB_CYBER2000=y
# CONFIG_FB_NEOMAGIC is not set
# CONFIG_FB_3DFX is not set
# CONFIG_FB_VOODOO1 is not set
# CONFIG_FB_TRIDENT is not set
# CONFIG_FB_PM3 is not set
# CONFIG_FB_VIRTUAL is not set
# CONFIG_FBCON_ADVANCED is not set
CONFIG_FBCON_CFB8=y
......@@ -903,6 +984,8 @@ CONFIG_SOUND_SB=m
# Console Switches
#
# CONFIG_SWITCHES is not set
# CONFIG_SWITCHES_SA1100 is not set
# CONFIG_SWITCHES_UCB1X00 is not set
#
# USB support
......@@ -931,6 +1014,11 @@ CONFIG_DEBUG_USER=y
# CONFIG_DEBUG_DC21285_PORT is not set
# CONFIG_DEBUG_CLPS711X_UART2 is not set
#
# Security options
#
CONFIG_SECURITY_CAPABILITIES=y
#
# Library routines
#
......
......@@ -17,7 +17,6 @@
#include <linux/personality.h>
#include <linux/stddef.h>
#include <linux/signal.h>
#include <linux/sched.h>
#include <linux/init.h>
#include <asm/ptrace.h>
......@@ -64,13 +63,13 @@ static void arthur_lcall7(int nr, struct pt_regs *regs)
}
static struct exec_domain arthur_exec_domain = {
"Arthur", /* name */
arthur_lcall7,
PER_RISCOS, PER_RISCOS,
arthur_to_linux_signals,
linux_to_arthur_signals,
THIS_MODULE,
NULL /* Nothing after this in the list. */
.name = "Arthur",
.handler = arthur_lcall7,
.pers_low = PER_RISCOS,
.pers_high = PER_RISCOS,
.signal_map = arthur_to_linux_signals,
.signal_invmap = linux_to_arthur_signals,
.module = THIS_MODULE,
};
/*
......@@ -78,12 +77,12 @@ static struct exec_domain arthur_exec_domain = {
* processes are using it.
*/
int __init arthur_init(void)
static int __init arthur_init(void)
{
return register_exec_domain(&arthur_exec_domain);
}
void __exit arthur_exit(void)
static void __exit arthur_exit(void)
{
unregister_exec_domain(&arthur_exec_domain);
}
......
......@@ -20,7 +20,7 @@ static int
via82c505_read_config(struct pci_bus *bus, unsigned int devfn, int where,
int size, u32 *value)
{
outl(CONFIG_CMD(dev,where),0xCF8);
outl(CONFIG_CMD(bus,devfn,where),0xCF8);
switch (size) {
case 1:
*value=inb(0xCFC + (where&3));
......@@ -36,7 +36,7 @@ via82c505_read_config(struct pci_bus *bus, unsigned int devfn, int where,
}
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)
{
outl(CONFIG_CMD(bus,devfn,where),0xCF8);
......@@ -61,8 +61,6 @@ static struct pci_ops via82c505_ops = {
void __init via82c505_preinit(void *sysdata)
{
struct pci_bus *bus;
printk(KERN_DEBUG "PCI: VIA 82c505\n");
if (!request_region(0xA8,2,"via config")) {
printk(KERN_WARNING"VIA 82c505: Unable to request region 0xA8\n");
......
......@@ -305,7 +305,7 @@ static struct cpufreq_driver sa1110_driver = {
.verify = sa11x0_verify_speed,
.setpolicy = sa1110_setspeed,
.policy = &sa1110_policy,
.cpu_min_freq[0] = 59000,
.cpu_min_freq = { 59000, },
};
static int __init sa1110_clk_init(void)
......
......@@ -21,5 +21,5 @@ extern void sa1110_mb_disable(void);
struct cpufreq_policy;
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);
......@@ -31,6 +31,14 @@
#define DPRINTK(...) do { } while (0)
#endif
//#define STATS
#ifdef STATS
#define DO_STATS(X) do { X ; } while (0)
#else
#define DO_STATS(X) do { } while (0)
#endif
/* ************************************************** */
struct safe_buffer {
struct list_head node;
......@@ -50,10 +58,24 @@ LIST_HEAD(safe_buffers);
#define SIZE_SMALL 1024
#define SIZE_LARGE (16*1024)
#define SIZE_LARGE (4*1024)
static struct pci_pool *small_buffer_pool, *large_buffer_pool;
#ifdef STATS
static unsigned long sbp_allocs __initdata = 0;
static unsigned long lbp_allocs __initdata = 0;
static unsigned long total_allocs __initdata= 0;
static void print_alloc_stats(void)
{
printk(KERN_INFO
"sa1111_pcibuf: sbp: %lu, lbp: %lu, other: %lu, total: %lu\n",
sbp_allocs, lbp_allocs,
total_allocs - sbp_allocs - lbp_allocs, total_allocs);
}
#endif
static int __init
create_safe_buffer_pools(void)
{
......@@ -81,6 +103,10 @@ create_safe_buffer_pools(void)
return -1;
}
printk(KERN_INFO
"sa1111_pcibuf: buffer sizes: small=%u, large=%u\n",
SIZE_SMALL, SIZE_LARGE);
return 0;
}
......@@ -108,6 +134,8 @@ alloc_safe_buffer(struct pci_dev *hwdev, void *ptr, size_t size, int direction)
DPRINTK("%s(ptr=%p, size=%d, direction=%d)\n",
__func__, ptr, size, direction);
DO_STATS ( total_allocs++ );
buf = kmalloc(sizeof(struct safe_buffer), GFP_ATOMIC);
if (buf == 0) {
printk(KERN_WARNING "%s: kmalloc failed\n", __func__);
......@@ -117,12 +145,14 @@ alloc_safe_buffer(struct pci_dev *hwdev, void *ptr, size_t size, int direction)
if (size <= SIZE_SMALL) {
pool = small_buffer_pool;
safe = pci_pool_alloc(pool, GFP_ATOMIC, &safe_dma_addr);
DO_STATS ( sbp_allocs++ );
} else if (size <= SIZE_LARGE) {
pool = large_buffer_pool;
safe = pci_pool_alloc(pool, GFP_ATOMIC, &safe_dma_addr);
DO_STATS ( lbp_allocs++ );
} else {
printk(KERN_DEBUG
"sa111_pcibuf: resorting to pci_alloc_consistent\n");
pool = 0;
safe = pci_alloc_consistent(SA1111_FAKE_PCIDEV, size,
&safe_dma_addr);
......@@ -136,6 +166,11 @@ alloc_safe_buffer(struct pci_dev *hwdev, void *ptr, size_t size, int direction)
return 0;
}
#ifdef STATS
if (total_allocs % 1000 == 0)
print_alloc_stats();
#endif
BUG_ON(sa1111_check_dma_bug(safe_dma_addr)); // paranoia
buf->ptr = ptr;
......@@ -204,37 +239,39 @@ dma_range_is_safe(dma_addr_t addr, size_t size)
return ((physaddr + size - 1) < (1<<20));
}
/*
* see if a buffer address is in an 'unsafe' range. if it is
* allocate a 'safe' buffer and copy the unsafe buffer into it.
* substitute the safe buffer for the unsafe one.
* (basically move the buffer from an unsafe area to a safe one)
*/
dma_addr_t
sa1111_map_single(struct pci_dev *hwdev, void *ptr, size_t size, int direction)
{
unsigned long flags;
dma_addr_t dma_addr;
/* ************************************************** */
DPRINTK("%s(hwdev=%p,ptr=%p,size=%d,dir=%x)\n",
__func__, hwdev, ptr, size, direction);
#ifdef STATS
static unsigned long map_op_count __initdata = 0;
static unsigned long bounce_count __initdata = 0;
BUG_ON(hwdev != SA1111_FAKE_PCIDEV);
BUG_ON(direction == PCI_DMA_NONE);
static void print_map_stats(void)
{
printk(KERN_INFO
"sa1111_pcibuf: map_op_count=%lu, bounce_count=%lu\n",
map_op_count, bounce_count);
}
#endif
local_irq_save(flags);
static dma_addr_t
map_single(struct pci_dev *hwdev, void *ptr, size_t size, int direction)
{
dma_addr_t dma_addr;
DO_STATS ( map_op_count++ );
dma_addr = virt_to_bus(ptr);
if (!dma_range_is_safe(dma_addr, size)) {
struct safe_buffer *buf;
DO_STATS ( bounce_count++ ) ;
buf = alloc_safe_buffer(hwdev, ptr, size, direction);
if (buf == 0) {
printk(KERN_ERR
"%s: unable to map unsafe buffer %p!\n",
__func__, ptr);
local_irq_restore(flags);
return 0;
}
......@@ -256,33 +293,22 @@ sa1111_map_single(struct pci_dev *hwdev, void *ptr, size_t size, int direction)
consistent_sync(ptr, size, direction);
}
local_irq_restore(flags);
#ifdef STATS
if (map_op_count % 1000 == 0)
print_map_stats();
#endif
return dma_addr;
}
/*
* see if a mapped address was really a "safe" buffer and if so, copy
* the data from the safe buffer back to the unsafe buffer and free up
* the safe buffer. (basically return things back to the way they
* should be)
*/
void
sa1111_unmap_single(struct pci_dev *hwdev, dma_addr_t dma_addr,
size_t size, int direction)
static void
unmap_single(struct pci_dev *hwdev, dma_addr_t dma_addr,
size_t size, int direction)
{
unsigned long flags;
struct safe_buffer *buf;
DPRINTK("%s(hwdev=%p,ptr=%p,size=%d,dir=%x)\n",
__func__, hwdev, (void *) dma_addr, size, direction);
BUG_ON(hwdev != SA1111_FAKE_PCIDEV);
BUG_ON(direction == PCI_DMA_NONE);
local_irq_save(flags);
buf = find_safe_buffer(dma_addr);
if (buf) {
BUG_ON(buf->size != size);
BUG_ON(buf->direction != direction);
......@@ -292,6 +318,9 @@ sa1111_unmap_single(struct pci_dev *hwdev, dma_addr_t dma_addr,
buf->ptr, (void *) virt_to_bus(buf->ptr),
buf->safe, (void *) buf->safe_dma_addr);
DO_STATS ( bounce_count++ );
if ((direction == PCI_DMA_FROMDEVICE) ||
(direction == PCI_DMA_BIDIRECTIONAL)) {
DPRINTK("%s: copy back from safe %p, to unsafe %p size %d\n",
......@@ -300,39 +329,16 @@ sa1111_unmap_single(struct pci_dev *hwdev, dma_addr_t dma_addr,
}
free_safe_buffer(buf);
}
local_irq_restore(flags);
}
int
sa1111_map_sg(struct pci_dev *hwdev, struct scatterlist *sg,
int nents, int direction)
{
BUG(); /* Not implemented. */
}
void
sa1111_unmap_sg(struct pci_dev *hwdev, struct scatterlist *sg, int nents,
int direction)
{
BUG(); /* Not implemented. */
}
void
sa1111_dma_sync_single(struct pci_dev *hwdev, dma_addr_t dma_addr,
static void
sync_single(struct pci_dev *hwdev, dma_addr_t dma_addr,
size_t size, int direction)
{
unsigned long flags;
struct safe_buffer *buf;
DPRINTK("%s(hwdev=%p,ptr=%p,size=%d,dir=%x)\n",
__func__, hwdev, (void *) dma_addr, size, direction);
BUG_ON(hwdev != SA1111_FAKE_PCIDEV);
local_irq_save(flags);
buf = find_safe_buffer(dma_addr);
if (buf) {
BUG_ON(buf->size != size);
BUG_ON(buf->direction != direction);
......@@ -342,6 +348,8 @@ sa1111_dma_sync_single(struct pci_dev *hwdev, dma_addr_t dma_addr,
buf->ptr, (void *) virt_to_bus(buf->ptr),
buf->safe, (void *) buf->safe_dma_addr);
DO_STATS ( bounce_count++ );
switch (direction) {
case PCI_DMA_FROMDEVICE:
DPRINTK("%s: copy back from safe %p, to unsafe %p size %d\n",
......@@ -362,15 +370,159 @@ sa1111_dma_sync_single(struct pci_dev *hwdev, dma_addr_t dma_addr,
} else {
consistent_sync(bus_to_virt(dma_addr), size, direction);
}
}
/* ************************************************** */
/*
* see if a buffer address is in an 'unsafe' range. if it is
* allocate a 'safe' buffer and copy the unsafe buffer into it.
* substitute the safe buffer for the unsafe one.
* (basically move the buffer from an unsafe area to a safe one)
*/
dma_addr_t
sa1111_map_single(struct pci_dev *hwdev, void *ptr, size_t size, int direction)
{
unsigned long flags;
dma_addr_t dma_addr;
DPRINTK("%s(hwdev=%p,ptr=%p,size=%d,dir=%x)\n",
__func__, hwdev, ptr, size, direction);
BUG_ON(hwdev != SA1111_FAKE_PCIDEV);
BUG_ON(direction == PCI_DMA_NONE);
local_irq_save(flags);
dma_addr = map_single(hwdev, ptr, size, direction);
local_irq_restore(flags);
return dma_addr;
}
/*
* see if a mapped address was really a "safe" buffer and if so, copy
* the data from the safe buffer back to the unsafe buffer and free up
* the safe buffer. (basically return things back to the way they
* should be)
*/
void
sa1111_unmap_single(struct pci_dev *hwdev, dma_addr_t dma_addr,
size_t size, int direction)
{
unsigned long flags;
DPRINTK("%s(hwdev=%p,ptr=%p,size=%d,dir=%x)\n",
__func__, hwdev, (void *) dma_addr, size, direction);
BUG_ON(hwdev != SA1111_FAKE_PCIDEV);
BUG_ON(direction == PCI_DMA_NONE);
local_irq_save(flags);
unmap_single(hwdev, dma_addr, size, direction);
local_irq_restore(flags);
}
int
sa1111_map_sg(struct pci_dev *hwdev, struct scatterlist *sg,
int nents, int direction)
{
unsigned long flags;
int i;
DPRINTK("%s(hwdev=%p,sg=%p,nents=%d,dir=%x)\n",
__func__, hwdev, sg, nents, direction);
BUG_ON(hwdev != SA1111_FAKE_PCIDEV);
BUG_ON(direction == PCI_DMA_NONE);
local_irq_save(flags);
for (i = 0; i < nents; i++, sg++) {
struct page *page = sg->page;
unsigned int offset = sg->offset;
unsigned int length = sg->length;
void *ptr = page_address(page) + offset;
sg->dma_address =
map_single(hwdev, ptr, length, direction);
}
local_irq_restore(flags);
return nents;
}
void
sa1111_unmap_sg(struct pci_dev *hwdev, struct scatterlist *sg, int nents,
int direction)
{
unsigned long flags;
int i;
DPRINTK("%s(hwdev=%p,sg=%p,nents=%d,dir=%x)\n",
__func__, hwdev, sg, nents, direction);
BUG_ON(hwdev != SA1111_FAKE_PCIDEV);
BUG_ON(direction == PCI_DMA_NONE);
local_irq_save(flags);
for (i = 0; i < nents; i++, sg++) {
dma_addr_t dma_addr = sg->dma_address;
unsigned int length = sg->length;
unmap_single(hwdev, dma_addr, length, direction);
}
local_irq_restore(flags);
}
void
sa1111_dma_sync_single(struct pci_dev *hwdev, dma_addr_t dma_addr,
size_t size, int direction)
{
unsigned long flags;
DPRINTK("%s(hwdev=%p,ptr=%p,size=%d,dir=%x)\n",
__func__, hwdev, (void *) dma_addr, size, direction);
BUG_ON(hwdev != SA1111_FAKE_PCIDEV);
local_irq_save(flags);
sync_single(hwdev, dma_addr, size, direction);
local_irq_restore(flags);
}
void
sa1111_dma_sync_sg(struct pci_dev *hwdev, struct scatterlist *sg,
int nelems, int direction)
int nents, int direction)
{
BUG(); /* Not implemented. */
unsigned long flags;
int i;
DPRINTK("%s(hwdev=%p,sg=%p,nents=%d,dir=%x)\n",
__func__, hwdev, sg, nents, direction);
BUG_ON(hwdev != SA1111_FAKE_PCIDEV);
BUG_ON(direction == PCI_DMA_NONE);
local_irq_save(flags);
for (i = 0; i < nents; i++, sg++) {
dma_addr_t dma_addr = sg->dma_address;
unsigned int length = sg->length;
sync_single(hwdev, dma_addr, length, direction);
}
local_irq_restore(flags);
}
EXPORT_SYMBOL(sa1111_map_single);
......@@ -399,6 +551,11 @@ static void __exit sa1111_pcibuf_exit(void)
{
BUG_ON(!list_empty(&safe_buffers));
#ifdef STATS
print_alloc_stats();
print_map_stats();
#endif
destroy_safe_buffer_pools();
}
module_exit(sa1111_pcibuf_exit);
......
......@@ -63,6 +63,8 @@ menu "Processor type and features"
bool "NA85E2C-FPGA"
config V850E2_ANNA
bool "Anna"
config V850E_AS85EP1
bool "AS85EP1"
endchoice
......
......@@ -22,6 +22,9 @@ CFLAGS += -ffixed-r16 -mno-prolog-function
CFLAGS += -fno-builtin
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
core-y += $(arch_dir)/kernel/
......@@ -40,10 +43,8 @@ core-y += root_fs_image.o
# This results in it being built anew each time, but that's alright.
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)
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
......
......@@ -80,6 +80,11 @@ SECTIONS {
__root_fs_image_start = . ;
*(.root)
__root_fs_image_end = . ;
. = ALIGN (4) ;
___initramfs_start = . ;
*(.init.ramfs)
___initramfs_end = . ;
} > ROM
__rom_copy_src_start = . ;
......
......@@ -103,6 +103,12 @@ SECTIONS {
*(.initcall7.init)
. = ALIGN (4) ;
___initcall_end = . ;
. = ALIGN (4) ;
___initramfs_start = . ;
*(.init.ramfs)
___initramfs_end = . ;
__init_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 \
signal.o irq.o mach.o ptrace.o bug.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
obj-$(CONFIG_V850E_MA1) += ma.o nb85e_utils.o nb85e_timer_d.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_V850E_AS85EP1) += as85ep1.o nb85e_intc.o nb85e_utils.o nb85e_timer_d.o
# platform-specific code
obj-$(CONFIG_V850E_SIM) += sim.o simcons.o
obj-$(CONFIG_V850E2_SIM85E2C) += sim85e2c.o nb85e_intc.o memcons.o
......
......@@ -27,11 +27,14 @@
#include "mach.h"
/* SRAM and SDRAM are vaguely contiguous (with a hole in between; see
mach_reserve_bootmem for details), so just use both as one big area. */
/* 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 0
static void anna_led_tick (void);
......@@ -44,7 +47,7 @@ void __init mach_early_init (void)
ANNA_BPC = 0;
ANNA_BSC = 0xAAAA;
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(1) = 0x0008;
ANNA_DWC(0) = 0x0027;
......@@ -60,17 +63,11 @@ void __init mach_early_init (void)
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
nb85e_uart_cons_init (1);
#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;
}
......@@ -138,7 +135,7 @@ void machine_halt (void)
disable_reset_guard ();
#endif
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 (;;)
asm ("halt; nop; nop; nop; nop; nop");
}
......@@ -191,9 +188,9 @@ static void anna_led_tick ()
if (pos + dir <= max_pos) {
/* 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;
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,
machine_halt ();
}
#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):
shl 16, r6 // clear upper 16 bits
shr 20, r6 // shift back, and remove lower nibble
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.
jarl CSYM(handle_irq), lp
// fall through
......@@ -665,6 +671,23 @@ G_ENTRY(irq):
handlers, below). */
ret_from_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)
......@@ -692,44 +715,7 @@ G_ENTRY(nmi):
jarl CSYM(handle_irq), lp
RETURN(NMI)
END(nmi0)
/*
* 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)
END(nmi)
/*
......@@ -771,8 +757,7 @@ C_END(switch_thread)
.data
.align 4
.globl CSYM(trap_table)
CSYM(trap_table):
C_DATA(trap_table):
.long bad_trap_wrapper // trap 0, doesn't use trap table.
.long syscall_long // trap 1, `long' syscall.
.long bad_trap_wrapper
......@@ -789,13 +774,13 @@ CSYM(trap_table):
.long bad_trap_wrapper
.long bad_trap_wrapper
.long bad_trap_wrapper
C_END(trap_table)
.section .rodata
.align 4
.globl CSYM(sys_call_table)
CSYM(sys_call_table):
C_DATA(sys_call_table):
.long CSYM(sys_ni_syscall) // 0 - old "setup()" system call
.long CSYM(sys_exit)
.long sys_fork_wrapper
......@@ -923,10 +908,10 @@ CSYM(sys_call_table):
.long CSYM(sys_adjtimex)
.long CSYM(sys_ni_syscall) // 125 - sys_mprotect
.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_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_getpgid)
.long CSYM(sys_fchdir)
......@@ -963,7 +948,7 @@ CSYM(sys_call_table):
.long CSYM(sys_setresuid)
.long CSYM(sys_getresuid) // 165
.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_nfsservctl)
.long CSYM(sys_setresgid) // 170
......@@ -1003,3 +988,4 @@ CSYM(sys_call_table):
.long CSYM(sys_ni_syscall) // sys_madvise
.space (NR_syscalls-205)*4
C_END(sys_call_table)
......@@ -73,8 +73,6 @@ void __init mach_early_init (void)
void __init mach_setup (char **cmdline)
{
printk (KERN_INFO "CPU: NEC V850E2 (NA85E2C FPGA implementation)\n");
memcons_setup ();
/* Setup up NMI0 to copy the registers to a known memory location.
......
......@@ -14,11 +14,10 @@
#include <linux/types.h>
#include <linux/init.h>
#include <linux/irq.h>
#include <linux/sched.h> /* For some unfathomable reason,
request_irq/free_irq are declared here. */
#include <linux/interrupt.h>
#include <linux/signal.h>
#include <asm/machdep.h>
#include <asm/irq.h>
/* The number of shared GINT interrupts. */
......@@ -72,7 +71,7 @@ int gbus_int_irq_enabled (unsigned irq)
}
/* Disable all GBUS irqs. */
int gbus_int_disable_irqs ()
void gbus_int_disable_irqs ()
{
unsigned w, n;
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,
{
struct gbus_int_irq_init *init;
for (init = inits; init->name; init++) {
int i;
unsigned i;
struct hw_interrupt_type *hwit = hw_irq_types++;
hwit->typename = init->name;
......@@ -200,7 +199,7 @@ void __init gbus_int_init_irq_types (struct gbus_int_irq_init *inits,
/* Set the interrupt priorities. */
for (i = 0; i < init->num; i++) {
int j;
unsigned j;
for (j = 0; j < NUM_USED_GINTS; j++)
if (used_gint[j].priority > init->priority)
break;
......@@ -222,7 +221,7 @@ static struct hw_interrupt_type gint_hw_itypes[NUM_USED_GINTS];
/* GBUS interrupts themselves. */
__init struct gbus_int_irq_init gbus_irq_inits[] = {
struct gbus_int_irq_init gbus_irq_inits[] __initdata = {
/* First set defaults. */
{ "GBUS_INT", IRQ_GBUS_INT(0), IRQ_GBUS_INT_NUM, 1, 6},
{ 0 }
......@@ -236,7 +235,7 @@ static struct hw_interrupt_type gbus_hw_itypes[NUM_GBUS_IRQ_INITS];
/* Initialize GBUS interrupts. */
void __init gbus_int_init_irqs (void)
{
int i;
unsigned i;
/* First initialize the shared gint interrupts. */
for (i = 0; i < NUM_USED_GINTS; i++) {
......
......@@ -118,4 +118,4 @@ C_ENTRY(start):
// Start Linux kernel.
mov hilo(CSYM(machine_halt)), lp
jr CSYM(start_kernel)
END(start)
C_END(start)
......@@ -52,10 +52,10 @@
JUMP_TO_HANDLER (trap, ENTRY_SP) // TRAP1n
.balign 0x10
JUMP_TO_HANDLER (illegal_instruction, ENTRY_SP) // illegal insn trap
JUMP_TO_HANDLER (irq, ENTRY_SP) // illegal insn trap
.balign 0x10
JUMP_TO_HANDLER (dbtrap, ENTRY_SP) // DBTRAP insn
JUMP_TO_HANDLER (irq, ENTRY_SP) // DBTRAP insn
/* Hardware interrupt vectors. */
......
......@@ -252,7 +252,7 @@ unsigned int handle_irq (int irq, struct pt_regs *regs)
unsigned int status;
irq_enter();
kstat.irqs[cpu][irq]++;
kstat_cpu(cpu).irqs[irq]++;
spin_lock(&desc->lock);
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,
{
struct nb85e_intc_irq_init *init;
for (init = inits; init->name; init++) {
int i;
unsigned i;
struct hw_interrupt_type *hwit = hw_irq_types++;
hwit->typename = init->name;
......
......@@ -2,8 +2,8 @@
* include/asm-v850/nb85e_utils.h -- Utility functions associated with
* the NB85E cpu core
*
* Copyright (C) 2001 NEC Corporation
* Copyright (C) 2001 Miles Bader <miles@gnu.org>
* Copyright (C) 2001,02 NEC Corporation
* Copyright (C) 2001,02 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
......@@ -40,7 +40,7 @@ int calc_counter_params (unsigned long base_freq,
/* Find the lowest clock divider setting that can represent RATE. */
for (_divlog2 = min_divlog2; _divlog2 <= max_divlog2; _divlog2++) {
/* Minimum interrupt rate possible using this divider. */
int min_int_rate
unsigned min_int_rate
= (base_freq >> _divlog2) >> counter_size;
if (min_int_rate <= rate) {
......
......@@ -58,49 +58,6 @@ void cpu_idle (void)
(*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.
*
......@@ -231,7 +188,7 @@ int sys_execve (char *name, char **argv, char **envp, struct pt_regs *regs)
are in entry.S). */
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;
}
......
......@@ -24,7 +24,7 @@ static int cpuinfo_print (struct seq_file *m, void *v)
#else
seq_printf (m, "CPU-Model: %s\n", CPU_MODEL);
#endif
#ifdef CPU_CLOCK_FREQ
seq_printf (m, "CPU-Clock: %ld (%ld MHz)\n",
(long)CPU_CLOCK_FREQ,
......
......@@ -60,25 +60,11 @@ void __init mach_early_init (void)
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. */
*(volatile long *)MB_A_SRAM_ADDR = 0xDEADBEEF;
if (*(volatile long *)MB_A_SRAM_ADDR == 0xDEADBEEF) {
*(volatile long *)MB_A_SRAM_ADDR = 0x12345678;
if (*(volatile long *)MB_A_SRAM_ADDR == 0x12345678)
*(volatile unsigned long *)MB_A_SRAM_ADDR = 0xDEADBEEF;
if (*(volatile unsigned long *)MB_A_SRAM_ADDR == 0xDEADBEEF) {
*(volatile unsigned long *)MB_A_SRAM_ADDR = 0x12345678;
if (*(volatile unsigned long *)MB_A_SRAM_ADDR == 0x12345678)
printk (KERN_INFO
" NEC SolutionGear/Midas lab"
" RTE-MOTHER-A motherboard\n");
......
......@@ -109,10 +109,12 @@ static loff_t leds_dev_lseek (struct file *file, loff_t offs, int whence)
else if (whence == 2)
offs += LED_NUM_DIGITS; /* end-relative */
if (offs >= 0 && offs <= LED_NUM_DIGITS)
file->f_pos = offs;
else
if (offs < 0 || offs > LED_NUM_DIGITS)
return -EINVAL;
file->f_pos = offs;
return 0;
}
static struct file_operations leds_fops = {
......
......@@ -239,7 +239,7 @@ static void __devinit pcibios_assign_resources (void)
struct resource *r;
pci_for_each_dev (dev) {
int di_num;
unsigned di_num;
unsigned class = dev->class >> 8;
if (class && class != PCI_CLASS_BRIDGE_HOST) {
......
......@@ -78,6 +78,9 @@ void __init setup_arch (char **cmdline)
/* ... and tell the kernel about it. */
init_mem_alloc (ram_start, ram_len);
printk (KERN_INFO "CPU: %s\nPlatform: %s\n",
CPU_MODEL_LONG, PLATFORM_LONG);
/* do machine-specific setups. */
mach_setup (cmdline);
......@@ -267,6 +270,16 @@ init_mem_alloc (unsigned long ram_start, unsigned long ram_len)
zones_size[ZONE_DMA]
= 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,
ADDR_TO_PAGE (PAGE_OFFSET), 0);
mem_map = NODE_DATA(0)->node_mem_map;
......
......@@ -512,9 +512,10 @@ int do_signal(struct pt_regs *regs, sigset_t *oldset)
/* Did we come from a system call? */
if (PT_REGS_SYSCALL (regs)) {
/* Restart the system call - no handlers present */
if (regs->gpr[GPR_RVAL] == -ERESTARTNOHAND ||
regs->gpr[GPR_RVAL] == -ERESTARTSYS ||
regs->gpr[GPR_RVAL] == -ERESTARTNOINTR) {
if (regs->gpr[GPR_RVAL] == (v850_reg_t)-ERESTARTNOHAND ||
regs->gpr[GPR_RVAL] == (v850_reg_t)-ERESTARTSYS ||
regs->gpr[GPR_RVAL] == (v850_reg_t)-ERESTARTNOINTR)
{
regs->gpr[12] = PT_REGS_SYSCALL (regs);
regs->pc -= 4; /* Size of `trap 0' insn. */
}
......
......@@ -42,8 +42,6 @@ void __init mach_setup (char **cmdline)
const char *err;
unsigned long root_dev_addr, root_dev_len;
printk (KERN_INFO "CPU: NEC V850E (GDB simulator)\n");
simcons_setup ();
printk (KERN_INFO "Reading root filesystem: %s", ROOT_FS);
......
......@@ -79,8 +79,6 @@ void __init mach_early_init (void)
void __init mach_setup (char **cmdline)
{
printk (KERN_INFO "CPU: NEC V850E2 (sim85e2c simulator)\n");
memcons_setup ();
}
......
......@@ -154,5 +154,5 @@ void simcons_setup (void)
{
V850_SIM_SYSCALL (make_raw, 0);
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);
extern void dump_thread (struct pt_regs *, struct user *);
EXPORT_SYMBOL (dump_thread);
EXPORT_SYMBOL (kernel_thread);
EXPORT_SYMBOL (enable_irq);
EXPORT_SYMBOL (disable_irq);
EXPORT_SYMBOL (disable_irq_nosync);
EXPORT_SYMBOL (__bug);
/* Networking helper routines. */
......@@ -46,7 +49,6 @@ EXPORT_SYMBOL_NOVERS (strchr);
EXPORT_SYMBOL_NOVERS (strlen);
EXPORT_SYMBOL_NOVERS (strnlen);
EXPORT_SYMBOL_NOVERS (strpbrk);
EXPORT_SYMBOL_NOVERS (strtok);
EXPORT_SYMBOL_NOVERS (strrchr);
EXPORT_SYMBOL_NOVERS (strstr);
EXPORT_SYMBOL_NOVERS (memset);
......
......@@ -93,6 +93,11 @@ SECTIONS {
*(.initcall7.init)
. = ALIGN (4) ;
___initcall_end = . ;
. = ALIGN (4) ;
___initramfs_start = . ;
*(.init.ramfs)
___initramfs_end = . ;
} > SRAM
/* This provides address at which the interrupt vectors are
......
......@@ -45,9 +45,14 @@ SECTIONS {
___stop___ksymtab = . ;
. = ALIGN (4) ;
__etext = . ;
. = ALIGN (4) ;
___initramfs_start = . ;
*(.init.ramfs)
___initramfs_end = . ;
} > ROM
__data_load_start = . ;
__rom_copy_src_start = . ;
.data : {
__kram_start = . ;
......
......@@ -98,10 +98,15 @@ SECTIONS {
*(.initcall7.init)
. = ALIGN (4) ;
___initcall_end = . ;
. = ALIGN (4) ;
___initramfs_start = . ;
*(.init.ramfs)
___initramfs_end = . ;
} > SDRAM
/* This provides address at which the interrupt vectors are
initially loaded by the loader. */
/* The address at which the interrupt vectors are initially
loaded by the loader. */
__intv_load_start = ALIGN (0x10) ;
/* Interrupt vector space. Because we're using the monitor
......
......@@ -96,6 +96,12 @@ SECTIONS {
*(.initcall7.init)
. = ALIGN (4) ;
___initcall_end = . ;
. = ALIGN (4) ;
___initramfs_start = . ;
*(.init.ramfs)
___initramfs_end = . ;
__init_end = . ;
__kram_end = . ;
......
......@@ -86,6 +86,12 @@ SECTIONS {
*(.initcall7.init)
. = ALIGN (4) ;
___initcall_end = . ;
. = ALIGN (4) ;
___initramfs_start = . ;
*(.init.ramfs)
___initramfs_end = . ;
__init_end = . ;
} > IRAM
......
......@@ -20,6 +20,10 @@
# endif
#endif
#ifdef CONFIG_V850E_AS85EP1
# include "as85ep1.ld"
#endif
#ifdef CONFIG_RTE_CB_MA1
# ifdef CONFIG_ROM_KERNEL
# include "rte_ma1_cb-rom.ld"
......
......@@ -2,7 +2,6 @@
# Makefile for the acorn character device drivers.
#
# All the objects that export symbols.
obj-arc := keyb_arc.o defkeymap-acorn.o
obj-$(CONFIG_ARCH_ACORN) += i2c.o pcf8583.o
......
......@@ -137,10 +137,10 @@
#include <linux/signal.h>
#include <linux/errno.h>
#include <linux/proc_fs.h>
#include <linux/stat.h>
#include <linux/ioport.h>
#include <linux/blk.h>
#include <linux/delay.h>
#include <linux/interrupt.h>
#include <linux/init.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 @@
#include <linux/ioport.h>
#include <linux/sched.h>
#include <linux/proc_fs.h>
#include <linux/unistd.h>
#include <linux/stat.h>
#include <linux/delay.h>
#include <linux/pci.h>
#include <linux/interrupt.h>
#include <linux/init.h>
#include <asm/dma.h>
......
......@@ -29,10 +29,8 @@
#include <linux/ioport.h>
#include <linux/sched.h>
#include <linux/proc_fs.h>
#include <linux/unistd.h>
#include <linux/stat.h>
#include <linux/delay.h>
#include <linux/pci.h>
#include <linux/interrupt.h>
#include <linux/init.h>
#include <asm/io.h>
......
......@@ -44,8 +44,6 @@
#include <linux/ioport.h>
#include <linux/sched.h>
#include <linux/proc_fs.h>
#include <linux/unistd.h>
#include <linux/stat.h>
#include <linux/delay.h>
#include <linux/init.h>
......
......@@ -14,10 +14,8 @@
#include <linux/ioport.h>
#include <linux/sched.h>
#include <linux/proc_fs.h>
#include <linux/unistd.h>
#include <linux/stat.h>
#include <linux/delay.h>
#include <linux/pci.h>
#include <linux/interrupt.h>
#include <linux/init.h>
#include <asm/dma.h>
......
......@@ -29,6 +29,7 @@
#include <linux/types.h>
#include <linux/compatmac.h>
#include <linux/proc_fs.h>
#include <linux/seq_file.h>
#include "acpi_bus.h"
#include "acpi_drivers.h"
......@@ -53,6 +54,7 @@ MODULE_LICENSE("GPL");
int acpi_ac_add (struct acpi_device *device);
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 = {
.name = ACPI_AC_DRIVER_NAME,
......@@ -69,6 +71,12 @@ struct acpi_ac {
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
......@@ -103,53 +111,40 @@ acpi_ac_get_state (
struct proc_dir_entry *acpi_ac_dir = NULL;
static int
acpi_ac_read_state (
char *page,
char **start,
off_t off,
int count,
int *eof,
void *data)
int acpi_ac_seq_show(struct seq_file *seq, void *offset)
{
struct acpi_ac *ac = (struct acpi_ac *) data;
char *p = page;
int len = 0;
struct acpi_ac *ac = (struct acpi_ac *) seq->private;
ACPI_FUNCTION_TRACE("acpi_ac_read_state");
ACPI_FUNCTION_TRACE("acpi_ac_seq_show");
if (!ac || (off != 0))
goto end;
if (!ac)
return 0;
if (acpi_ac_get_state(ac)) {
p += sprintf(p, "ERROR: Unable to read AC Adapter state\n");
goto end;
seq_puts(seq, "ERROR: Unable to read AC Adapter state\n");
return 0;
}
p += sprintf(p, "state: ");
seq_puts(seq, "state: ");
switch (ac->state) {
case ACPI_AC_STATUS_OFFLINE:
p += sprintf(p, "off-line\n");
seq_puts(seq, "off-line\n");
break;
case ACPI_AC_STATUS_ONLINE:
p += sprintf(p, "on-line\n");
seq_puts(seq, "on-line\n");
break;
default:
p += sprintf(p, "unknown\n");
seq_puts(seq, "unknown\n");
break;
}
end:
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);
return 0;
}
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
acpi_ac_add_fs (
......@@ -174,7 +169,7 @@ acpi_ac_add_fs (
"Unable to create '%s' fs entry\n",
ACPI_AC_FILE_STATE));
else {
entry->read_proc = acpi_ac_read_state;
entry->proc_fops = &acpi_ac_fops;
entry->data = acpi_driver_data(device);
}
......
......@@ -29,6 +29,7 @@
#include <linux/types.h>
#include <linux/compatmac.h>
#include <linux/proc_fs.h>
#include <linux/seq_file.h>
#include "acpi_bus.h"
#include "acpi_drivers.h"
......@@ -69,6 +70,7 @@ MODULE_LICENSE("GPL");
int acpi_button_add (struct acpi_device *device);
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 = {
.name = ACPI_BUTTON_DRIVER_NAME,
......@@ -87,6 +89,12 @@ struct acpi_button {
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)
......@@ -94,39 +102,26 @@ struct acpi_button {
static struct proc_dir_entry *acpi_button_dir = NULL;
static int
acpi_button_read_info (
char *page,
char **start,
off_t off,
int count,
int *eof,
void *data)
static int acpi_button_seq_show(struct seq_file *seq, void *offset)
{
struct acpi_button *button = (struct acpi_button *) data;
char *p = page;
int len = 0;
struct acpi_button *button = (struct acpi_button *) seq->private;
ACPI_FUNCTION_TRACE("acpi_button_read_info");
ACPI_FUNCTION_TRACE("acpi_button_seq_show");
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));
end:
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);
return 0;
}
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
acpi_button_add_fs (
struct acpi_device *device)
......@@ -170,7 +165,7 @@ acpi_button_add_fs (
"Unable to create '%s' fs entry\n",
ACPI_BUTTON_FILE_INFO));
else {
entry->read_proc = acpi_button_read_info;
entry->proc_fops = &acpi_button_fops;
entry->data = acpi_driver_data(device);
}
......
/*******************************************************************************
*
* Module Name: dsmthdat - control method arguments and local variables
* $Revision: 64 $
* $Revision: 66 $
*
******************************************************************************/
......@@ -28,6 +28,7 @@
#include "acdispat.h"
#include "amlcode.h"
#include "acnamesp.h"
#include "acinterp.h"
#define _COMPONENT ACPI_DISPATCHER
......@@ -274,6 +275,7 @@ acpi_ds_method_data_get_node (
* RETURN: Status
*
* 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 (
{
acpi_status status;
acpi_namespace_node *node;
acpi_operand_object *new_desc = object;
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 */
status = acpi_ds_method_data_get_node (opcode, index, walk_state, &node);
......@@ -298,14 +306,30 @@ acpi_ds_method_data_set_value (
return_ACPI_STATUS (status);
}
/* Increment ref count so object can't be deleted while installed */
/*
* 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_ut_add_reference (object);
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 */
acpi_ut_add_reference (new_desc);
}
/* Install the object into the stack entry */
/* Install the object */
node->object = object;
return_ACPI_STATUS (AE_OK);
node->object = new_desc;
return_ACPI_STATUS (status);
}
......@@ -560,7 +584,8 @@ acpi_ds_store_object_to_local (
current_obj_desc = acpi_ns_get_attached_object (node);
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);
}
......@@ -609,16 +634,12 @@ acpi_ds_store_object_to_local (
"Arg (%p) is an Obj_ref(Node), storing in node %p\n",
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)
*/
status = acpi_ns_attach_object (current_obj_desc->reference.object,
obj_desc, ACPI_GET_OBJECT_TYPE (obj_desc));
status = acpi_ex_store_object_to_node (obj_desc,
current_obj_desc->reference.object, walk_state);
return_ACPI_STATUS (status);
}
}
......
/******************************************************************************
*
* Module Name: evevent - Fixed and General Purpose Even handling and dispatch
* $Revision: 96 $
* $Revision: 99 $
*
*****************************************************************************/
......@@ -331,11 +331,8 @@ acpi_ev_gpe_initialize (void)
* FADT table contain zeros. The GPE0_LEN and GPE1_LEN do not need
* 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[1].address_space_id = acpi_gbl_FADT->Xgpe1_blk.address_space_id;
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].register_count = 0;
acpi_gbl_gpe_block_info[1].register_count = 0;
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;
......@@ -343,28 +340,25 @@ acpi_ev_gpe_initialize (void)
acpi_gbl_gpe_block_info[0].block_base_number = 0;
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.
* 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) {
/* GPE block 0 exists */
if (acpi_gbl_FADT->Xgpe0_blk.register_bit_width && ACPI_GET_ADDRESS (acpi_gbl_FADT->Xgpe0_blk.address)) {
/* GPE block 0 exists (has length and address > 0) */
acpi_gbl_gpe_number_max = ACPI_MUL_8 (acpi_gbl_gpe_block_info[0].register_count) - 1;
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;
}
if (acpi_gbl_gpe_block_info[1].register_count) {
/* GPE block 1 exists */
if (acpi_gbl_FADT->Xgpe1_blk.register_bit_width && ACPI_GET_ADDRESS (acpi_gbl_FADT->Xgpe1_blk.address)) {
/* 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) */
......@@ -385,6 +379,15 @@ acpi_ev_gpe_initialize (void)
(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 */
if (acpi_gbl_gpe_number_max > ACPI_GPE_MAX) {
......@@ -460,8 +463,8 @@ acpi_ev_gpe_initialize (void)
+ i
+ 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->enable_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].block_address->address_space_id;
gpe_register_info->status_address.register_bit_width = 8;
gpe_register_info->enable_address.register_bit_width = 8;
gpe_register_info->status_address.register_bit_offset = 8;
......@@ -565,7 +568,7 @@ acpi_ev_save_method_info (
/* Extract the name from the object and convert to a string */
ACPI_MOVE_UNALIGNED32_TO_32 (name,
&((acpi_namespace_node *) obj_handle)->name.integer);
&((acpi_namespace_node *) obj_handle)->name.integer);
name[ACPI_NAME_SIZE] = 0;
/*
......@@ -614,8 +617,8 @@ acpi_ev_save_method_info (
* Now we can add this information to the Gpe_info block
* 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].method_handle = obj_handle;
acpi_gbl_gpe_number_info [gpe_number_index].type = type;
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)
......@@ -625,7 +628,7 @@ acpi_ev_save_method_info (
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));
return (AE_OK);
}
......@@ -805,15 +808,16 @@ acpi_ev_asynch_execute_gpe_method (
return_VOID;
}
if (gpe_info.method_handle) {
if (gpe_info.method_node) {
/*
* Invoke the GPE Method (_Lxx, _Exx):
* (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)) {
ACPI_REPORT_ERROR (("%s while evaluating GPE%X method\n",
acpi_format_exception (status), gpe_number));
ACPI_REPORT_ERROR (("%s while evaluating method [%4.4s] for GPE[%2.2X]\n",
acpi_format_exception (status),
gpe_info.method_node->name.ascii, gpe_number));
}
}
......@@ -881,7 +885,7 @@ acpi_ev_gpe_dispatch (
if (gpe_info->type & ACPI_EVENT_EDGE_TRIGGERED) {
status = acpi_hw_clear_gpe (gpe_number);
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);
}
}
......@@ -898,14 +902,14 @@ acpi_ev_gpe_dispatch (
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
* chance to run.
*/
status = acpi_hw_disable_gpe (gpe_number);
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);
}
......@@ -915,13 +919,13 @@ acpi_ev_gpe_dispatch (
if (ACPI_FAILURE (acpi_os_queue_for_execution (OSD_PRIORITY_GPE,
acpi_ev_asynch_execute_gpe_method,
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 {
/* 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
......@@ -929,7 +933,7 @@ acpi_ev_gpe_dispatch (
*/
status = acpi_hw_disable_gpe (gpe_number);
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);
}
}
......@@ -940,7 +944,7 @@ acpi_ev_gpe_dispatch (
if (gpe_info->type & ACPI_EVENT_LEVEL_TRIGGERED) {
status = acpi_hw_clear_gpe (gpe_number);
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);
}
}
......
/******************************************************************************
*
* Module Name: evrgnini- ACPI Address_space (Op_region) init
* $Revision: 63 $
* $Revision: 64 $
*
*****************************************************************************/
......@@ -269,6 +269,11 @@ acpi_ev_pci_config_region_setup (
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;
return_ACPI_STATUS (AE_OK);
}
......
/******************************************************************************
*
* Name: acconfig.h - Global configuration constants
* $Revision: 118 $
* $Revision: 119 $
*
*****************************************************************************/
......@@ -54,7 +54,7 @@
/* Version string */
#define ACPI_CA_VERSION 0x20021115
#define ACPI_CA_VERSION 0x20021122
/* Version of ACPI supported */
......
/******************************************************************************
*
* Name: aclocal.h - Internal data types used across the ACPI subsystem
* $Revision: 179 $
* $Revision: 181 $
*
*****************************************************************************/
......@@ -301,7 +301,6 @@ typedef struct
typedef struct
{
u8 address_space_id;
acpi_generic_address *block_address;
u16 register_count;
u8 block_base_number;
......@@ -330,7 +329,7 @@ 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 */
void *context; /* Context to be passed to handler */
u8 type; /* Level or Edge */
......
......@@ -246,6 +246,14 @@ acpi_os_write_pci_configuration (
acpi_integer value,
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
......
......@@ -36,6 +36,7 @@
#include <linux/delay.h>
#include <linux/workqueue.h>
#include <asm/io.h>
#include "acpi_bus.h"
#include "acpi.h"
#ifdef CONFIG_ACPI_EFI
......@@ -483,6 +484,44 @@ acpi_os_write_pci_configuration (
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*/
acpi_status
......
/******************************************************************************
*
* Module Name: psopcode - Parser/Interpreter opcode information table
* $Revision: 73 $
* $Revision: 74 $
*
*****************************************************************************/
......@@ -734,7 +734,7 @@ NATIVE_CHAR *
acpi_ps_get_opcode_name (
u16 opcode)
{
#ifdef ACPI_DISASSEMBLER
#if defined(ACPI_DISASSEMBLER) || defined (ACPI_DEBUG_OUTPUT)
const acpi_opcode_info *op;
......
......@@ -29,6 +29,7 @@
#include <linux/types.h>
#include <linux/compatmac.h>
#include <linux/proc_fs.h>
#include <linux/seq_file.h>
#include "acpi_bus.h"
#include "acpi_drivers.h"
......@@ -48,6 +49,7 @@ ACPI_MODULE_NAME ("acpi_power")
int acpi_power_add (struct acpi_device *device);
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 = {
.name = ACPI_POWER_DRIVER_NAME,
......@@ -71,6 +73,12 @@ struct acpi_power_resource
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
......@@ -379,58 +387,45 @@ acpi_power_transition (
struct proc_dir_entry *acpi_power_dir = NULL;
static int
acpi_power_read_status (
char *page,
char **start,
off_t off,
int count,
int *eof,
void *data)
static int acpi_power_seq_show(struct seq_file *seq, void *offset)
{
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))
goto end;
resource = (struct acpi_power_resource *)seq->private;
resource = (struct acpi_power_resource *) data;
if (!resource)
goto end;
p += sprintf(p, "state: ");
seq_puts(seq, "state: ");
switch (resource->state) {
case ACPI_POWER_RESOURCE_STATE_ON:
p += sprintf(p, "on\n");
seq_puts(seq, "on\n");
break;
case ACPI_POWER_RESOURCE_STATE_OFF:
p += sprintf(p, "off\n");
seq_puts(seq, "off\n");
break;
default:
p += sprintf(p, "unknown\n");
seq_puts(seq, "unknown\n");
break;
}
p += sprintf(p, "system level: S%d\n",
resource->system_level);
p += sprintf(p, "order: %d\n",
resource->order);
p += sprintf(p, "reference count: %d\n",
resource->references);
seq_printf(seq, "system level: S%d\n"
"order: %d\n"
"reference count: %d\n",
resource->system_level,
resource->order,
resource->references);
end:
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);
return 0;
}
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
acpi_power_add_fs (
......@@ -458,7 +453,7 @@ acpi_power_add_fs (
"Unable to create '%s' fs entry\n",
ACPI_POWER_FILE_STATUS));
else {
entry->read_proc = acpi_power_read_status;
entry->proc_fops = &acpi_power_fops;
entry->data = acpi_driver_data(device);
}
......
......@@ -40,6 +40,7 @@
#include <asm/delay.h>
#include <linux/compatmac.h>
#include <linux/proc_fs.h>
#include <linux/seq_file.h>
#include "acpi_bus.h"
#include "acpi_drivers.h"
......@@ -90,6 +91,11 @@ MODULE_LICENSE("GPL");
static int acpi_processor_add (struct acpi_device *device);
static int acpi_processor_remove (struct acpi_device *device, int type);
static int acpi_processor_info_open_fs(struct inode *inode, struct file *file);
static int acpi_processor_throttling_open_fs(struct inode *inode, struct file *file);
static int acpi_processor_power_open_fs(struct inode *inode, struct file *file);
static int acpi_processor_limit_open_fs(struct inode *inode, struct file *file);
static struct acpi_driver acpi_processor_driver = {
.name = ACPI_PROCESSOR_DRIVER_NAME,
......@@ -224,6 +230,34 @@ struct acpi_processor_errata {
} piix4;
};
static struct file_operations acpi_processor_info_fops = {
.open = acpi_processor_info_open_fs,
.read = seq_read,
.llseek = seq_lseek,
.release = single_release,
};
static struct file_operations acpi_processor_power_fops = {
.open = acpi_processor_power_open_fs,
.read = seq_read,
.llseek = seq_lseek,
.release = single_release,
};
static struct file_operations acpi_processor_throttling_fops = {
.open = acpi_processor_throttling_open_fs,
.read = seq_read,
.llseek = seq_lseek,
.release = single_release,
};
static struct file_operations acpi_processor_limit_fops = {
.open = acpi_processor_limit_open_fs,
.read = seq_read,
.llseek = seq_lseek,
.release = single_release,
};
static struct acpi_processor *processors[NR_CPUS];
static struct acpi_processor_errata errata;
static void (*pm_idle_save)(void) = NULL;
......@@ -231,6 +265,13 @@ static void (*pm_idle_save)(void) = NULL;
#ifdef CONFIG_ACPI_PROCESSOR_PERF
static unsigned int cpufreq_usage_count = 0;
static struct cpufreq_driver *acpi_cpufreq_driver;
static int acpi_processor_perf_open_fs(struct inode *inode, struct file *file);
static struct file_operations acpi_processor_perf_fops = {
.open = acpi_processor_perf_open_fs,
.read = seq_read,
.llseek = seq_lseek,
.release = single_release,
};
#endif
......@@ -1884,174 +1925,132 @@ acpi_cpufreq_exit (
struct proc_dir_entry *acpi_processor_dir = NULL;
static int
acpi_processor_read_info (
char *page,
char **start,
off_t off,
int count,
int *eof,
void *data)
static int acpi_processor_info_seq_show(struct seq_file *seq, void *offset)
{
struct acpi_processor *pr = (struct acpi_processor *) data;
char *p = page;
int len = 0;
struct acpi_processor *pr = (struct acpi_processor *)seq->private;
ACPI_FUNCTION_TRACE("acpi_processor_read_info");
ACPI_FUNCTION_TRACE("acpi_processor_info_seq_show");
if (!pr || (off != 0))
if (!pr)
goto end;
p += sprintf(p, "processor id: %d\n",
pr->id);
p += sprintf(p, "acpi id: %d\n",
pr->acpi_id);
p += sprintf(p, "bus mastering control: %s\n",
pr->flags.bm_control ? "yes" : "no");
p += sprintf(p, "power management: %s\n",
pr->flags.power ? "yes" : "no");
p += sprintf(p, "throttling control: %s\n",
pr->flags.throttling ? "yes" : "no");
p += sprintf(p, "performance management: %s\n",
pr->flags.performance ? "yes" : "no");
p += sprintf(p, "limit interface: %s\n",
pr->flags.limit ? "yes" : "no");
seq_printf(seq, "processor id: %d\n"
"acpi id: %d\n"
"bus mastering control: %s\n"
"power management: %s\n"
"throttling control: %s\n"
"performance management: %s\n"
"limit interface: %s\n",
pr->id,
pr->acpi_id,
pr->flags.bm_control ? "yes" : "no",
pr->flags.power ? "yes" : "no",
pr->flags.throttling ? "yes" : "no",
pr->flags.performance ? "yes" : "no",
pr->flags.limit ? "yes" : "no");
end:
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);
return 0;
}
static int acpi_processor_info_open_fs(struct inode *inode, struct file *file)
{
return single_open(file, acpi_processor_info_seq_show,
PDE(inode)->data);
}
static int
acpi_processor_read_power (
char *page,
char **start,
off_t off,
int count,
int *eof,
void *data)
static int acpi_processor_power_seq_show(struct seq_file *seq, void *offset)
{
struct acpi_processor *pr = (struct acpi_processor *) data;
char *p = page;
int len = 0;
struct acpi_processor *pr = (struct acpi_processor *)seq->private;
int i = 0;
ACPI_FUNCTION_TRACE("acpi_processor_read_power");
ACPI_FUNCTION_TRACE("acpi_processor_power_seq_show");
if (!pr || (off != 0))
if (!pr)
goto end;
p += sprintf(p, "active state: C%d\n",
pr->power.state);
p += sprintf(p, "default state: C%d\n",
pr->power.default_state);
seq_printf(seq, "active state: C%d\n"
"default state: C%d\n"
"bus master activity: %08x\n",
pr->power.state,
pr->power.default_state,
pr->power.bm_activity);
p += sprintf(p, "bus master activity: %08x\n",
pr->power.bm_activity);
seq_puts(seq, "states:\n");
p += sprintf(p, "states:\n");
for (i=1; i<ACPI_C_STATE_COUNT; i++) {
p += sprintf(p, " %cC%d: ",
for (i = 1; i < ACPI_C_STATE_COUNT; i++) {
seq_printf(seq, " %cC%d: ",
(i == pr->power.state?'*':' '), i);
if (!pr->power.states[i].valid) {
p += sprintf(p, "<not supported>\n");
seq_puts(seq, "<not supported>\n");
continue;
}
if (pr->power.states[i].promotion.state)
p += sprintf(p, "promotion[C%d] ",
seq_printf(seq, "promotion[C%d] ",
pr->power.states[i].promotion.state);
else
p += sprintf(p, "promotion[--] ");
seq_puts(seq, "promotion[--] ");
if (pr->power.states[i].demotion.state)
p += sprintf(p, "demotion[C%d] ",
seq_printf(seq, "demotion[C%d] ",
pr->power.states[i].demotion.state);
else
p += sprintf(p, "demotion[--] ");
seq_puts(seq, "demotion[--] ");
p += sprintf(p, "latency[%03d] usage[%08d]\n",
seq_printf(seq, "latency[%03d] usage[%08d]\n",
pr->power.states[i].latency,
pr->power.states[i].usage);
}
end:
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);
return 0;
}
static int acpi_processor_power_open_fs(struct inode *inode, struct file *file)
{
return single_open(file, acpi_processor_power_seq_show,
PDE(inode)->data);
}
#ifdef CONFIG_ACPI_PROCESSOR_PERF
static int
acpi_processor_read_performance (
char *page,
char **start,
off_t off,
int count,
int *eof,
void *data)
static int acpi_processor_perf_seq_show(struct seq_file *seq, void *offset)
{
struct acpi_processor *pr = (struct acpi_processor *) data;
char *p = page;
int len = 0;
struct acpi_processor *pr = (struct acpi_processor *)seq->private;
int i = 0;
ACPI_FUNCTION_TRACE("acpi_processor_read_performance");
ACPI_FUNCTION_TRACE("acpi_processor_perf_seq_show");
if (!pr || (off != 0))
if (!pr)
goto end;
if (!pr->flags.performance) {
p += sprintf(p, "<not supported>\n");
seq_puts(seq, "<not supported>\n");
goto end;
}
p += sprintf(p, "state count: %d\n",
pr->performance.state_count);
p += sprintf(p, "active state: P%d\n",
pr->performance.state);
p += sprintf(p, "states:\n");
seq_printf(seq, "state count: %d\n"
"active state: P%d\n",
pr->performance.state_count,
pr->performance.state);
for (i=0; i<pr->performance.state_count; i++)
p += sprintf(p, " %cP%d: %d MHz, %d mW, %d uS\n",
seq_puts(seq, "states:\n");
for (i = 0; i < pr->performance.state_count; i++)
seq_printf(seq, " %cP%d: %d MHz, %d mW, %d uS\n",
(i == pr->performance.state?'*':' '), i,
(u32) pr->performance.states[i].core_frequency,
(u32) pr->performance.states[i].power,
(u32) pr->performance.states[i].transition_latency);
end:
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);
return 0;
}
static int acpi_processor_perf_open_fs(struct inode *inode, struct file *file)
{
return single_open(file, acpi_processor_perf_seq_show,
PDE(inode)->data);
}
static int
......@@ -2091,63 +2090,49 @@ acpi_processor_write_performance (
}
#endif
static int
acpi_processor_read_throttling (
char *page,
char **start,
off_t off,
int count,
int *eof,
void *data)
static int acpi_processor_throttling_seq_show(struct seq_file *seq, void *offset)
{
struct acpi_processor *pr = (struct acpi_processor *) data;
char *p = page;
int len = 0;
struct acpi_processor *pr = (struct acpi_processor *)seq->private;
int i = 0;
int result = 0;
ACPI_FUNCTION_TRACE("acpi_processor_read_throttling");
ACPI_FUNCTION_TRACE("acpi_processor_throttling_seq_show");
if (!pr || (off != 0))
if (!pr)
goto end;
if (!(pr->throttling.state_count > 0)) {
p += sprintf(p, "<not supported>\n");
seq_puts(seq, "<not supported>\n");
goto end;
}
result = acpi_processor_get_throttling(pr);
if (result) {
p += sprintf(p, "Could not determine current throttling state.\n");
seq_puts(seq, "Could not determine current throttling state.\n");
goto end;
}
p += sprintf(p, "state count: %d\n",
pr->throttling.state_count);
p += sprintf(p, "active state: T%d\n",
pr->throttling.state);
seq_printf(seq, "state count: %d\n"
"active state: T%d\n",
pr->throttling.state_count,
pr->throttling.state);
p += sprintf(p, "states:\n");
for (i=0; i<pr->throttling.state_count; i++)
p += sprintf(p, " %cT%d: %02d%%\n",
seq_puts(seq, "states:\n");
for (i = 0; i < pr->throttling.state_count; i++)
seq_printf(seq, " %cT%d: %02d%%\n",
(i == pr->throttling.state?'*':' '), i,
(pr->throttling.states[i].performance?pr->throttling.states[i].performance/10:0));
end:
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);
return 0;
}
static int acpi_processor_throttling_open_fs(struct inode *inode, struct file *file)
{
return single_open(file, acpi_processor_throttling_seq_show,
PDE(inode)->data);
}
static int
acpi_processor_write_throttling (
......@@ -2178,53 +2163,38 @@ acpi_processor_write_throttling (
return_VALUE(count);
}
static int
acpi_processor_read_limit (
char *page,
char **start,
off_t off,
int count,
int *eof,
void *data)
static int acpi_processor_limit_seq_show(struct seq_file *seq, void *offset)
{
struct acpi_processor *pr = (struct acpi_processor *) data;
char *p = page;
int len = 0;
struct acpi_processor *pr = (struct acpi_processor *)seq->private;
ACPI_FUNCTION_TRACE("acpi_processor_read_limit");
ACPI_FUNCTION_TRACE("acpi_processor_limit_seq_show");
if (!pr || (off != 0))
if (!pr)
goto end;
if (!pr->flags.limit) {
p += sprintf(p, "<not supported>\n");
seq_puts(seq, "<not supported>\n");
goto end;
}
p += sprintf(p, "active limit: P%d:T%d\n",
pr->limit.state.px, pr->limit.state.tx);
p += sprintf(p, "platform limit: P%d:T0\n",
pr->flags.performance?pr->performance.platform_limit:0);
p += sprintf(p, "user limit: P%d:T%d\n",
pr->limit.user.px, pr->limit.user.tx);
p += sprintf(p, "thermal limit: P%d:T%d\n",
pr->limit.thermal.px, pr->limit.thermal.tx);
seq_printf(seq, "active limit: P%d:T%d\n"
"platform limit: P%d:T0\n"
"user limit: P%d:T%d\n"
"thermal limit: P%d:T%d\n",
pr->limit.state.px, pr->limit.state.tx,
pr->flags.performance?pr->performance.platform_limit:0,
pr->limit.user.px, pr->limit.user.tx,
pr->limit.thermal.px, pr->limit.thermal.tx);
end:
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);
return 0;
}
static int acpi_processor_limit_open_fs(struct inode *inode, struct file *file)
{
return single_open(file, acpi_processor_limit_seq_show,
PDE(inode)->data);
}
static int
acpi_processor_write_limit (
......@@ -2304,7 +2274,7 @@ acpi_processor_add_fs (
"Unable to create '%s' fs entry\n",
ACPI_PROCESSOR_FILE_INFO));
else {
entry->read_proc = acpi_processor_read_info;
entry->proc_fops = &acpi_processor_info_fops;
entry->data = acpi_driver_data(device);
}
......@@ -2316,7 +2286,7 @@ acpi_processor_add_fs (
"Unable to create '%s' fs entry\n",
ACPI_PROCESSOR_FILE_POWER));
else {
entry->read_proc = acpi_processor_read_power;
entry->proc_fops = &acpi_processor_power_fops;
entry->data = acpi_driver_data(device);
}
......@@ -2329,7 +2299,7 @@ acpi_processor_add_fs (
"Unable to create '%s' fs entry\n",
ACPI_PROCESSOR_FILE_PERFORMANCE));
else {
entry->read_proc = acpi_processor_read_performance;
entry->proc_fops = &acpi_processor_perf_fops;
entry->write_proc = acpi_processor_write_performance;
entry->data = acpi_driver_data(device);
}
......@@ -2343,7 +2313,7 @@ acpi_processor_add_fs (
"Unable to create '%s' fs entry\n",
ACPI_PROCESSOR_FILE_THROTTLING));
else {
entry->read_proc = acpi_processor_read_throttling;
entry->proc_fops = &acpi_processor_throttling_fops;
entry->write_proc = acpi_processor_write_throttling;
entry->data = acpi_driver_data(device);
}
......@@ -2356,7 +2326,7 @@ acpi_processor_add_fs (
"Unable to create '%s' fs entry\n",
ACPI_PROCESSOR_FILE_LIMIT));
else {
entry->read_proc = acpi_processor_read_limit;
entry->proc_fops = &acpi_processor_limit_fops;
entry->write_proc = acpi_processor_write_limit;
entry->data = acpi_driver_data(device);
}
......
......@@ -15,6 +15,7 @@
#include <linux/pm.h>
#include <linux/device.h>
#include <linux/suspend.h>
#include <linux/seq_file.h>
#include <asm/uaccess.h>
#include <asm/acpi.h>
......@@ -32,8 +33,25 @@ ACPI_MODULE_NAME ("sleep")
#define ACPI_SYSTEM_FILE_SLEEP "sleep"
#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 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
acpi_power_off (void)
{
......@@ -271,43 +289,26 @@ acpi_suspend (
return status;
}
static int
acpi_system_read_sleep (
char *page,
char **start,
off_t off,
int count,
int *eof,
void *data)
static int acpi_system_sleep_seq_show(struct seq_file *seq, void *offset)
{
char *p = page;
int size;
int i;
ACPI_FUNCTION_TRACE("acpi_system_read_sleep");
if (off != 0)
goto end;
ACPI_FUNCTION_TRACE("acpi_system_sleep_seq_show");
for (i = 0; i <= ACPI_STATE_S5; 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:
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);
return 0;
}
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
acpi_system_write_sleep (
......@@ -349,25 +350,12 @@ acpi_system_write_sleep (
return_VALUE(count);
}
static int
acpi_system_read_alarm (
char *page,
char **start,
off_t off,
int count,
int *eof,
void *context)
static int acpi_system_alarm_seq_show(struct seq_file *seq, void *offset)
{
char *p = page;
int size = 0;
u32 sec, min, hr;
u32 day, mo, yr;
ACPI_FUNCTION_TRACE("acpi_system_read_alarm");
if (off != 0)
goto end;
ACPI_FUNCTION_TRACE("acpi_system_alarm_seq_show");
spin_lock(&rtc_lock);
......@@ -427,21 +415,19 @@ acpi_system_read_alarm (
yr += 2000;
#endif
p += sprintf(p,"%4.4u-", yr);
p += (mo > 12) ? sprintf(p, "**-") : sprintf(p, "%2.2u-", mo);
p += (day > 31) ? sprintf(p, "** ") : sprintf(p, "%2.2u ", day);
p += (hr > 23) ? sprintf(p, "**:") : sprintf(p, "%2.2u:", hr);
p += (min > 59) ? sprintf(p, "**:") : sprintf(p, "%2.2u:", min);
p += (sec > 59) ? sprintf(p, "**\n") : sprintf(p, "%2.2u\n", sec);
end:
size = p - page;
if (size < count) *eof = 1;
else if (size > count) size = count;
if (size < 0) size = 0;
*start = page;
return_VALUE(size);
seq_printf(seq,"%4.4u-", yr);
(mo > 12) ? seq_puts(seq, "**-") : seq_printf(seq, "%2.2u-", mo);
(day > 31) ? seq_puts(seq, "** ") : seq_printf(seq, "%2.2u ", day);
(hr > 23) ? seq_puts(seq, "**:") : seq_printf(seq, "%2.2u:", hr);
(min > 59) ? seq_puts(seq, "**:") : seq_printf(seq, "%2.2u:", min);
(sec > 59) ? seq_puts(seq, "**\n") : seq_printf(seq, "%2.2u\n", sec);
return 0;
}
static int acpi_system_alarm_open_fs(struct inode *inode, struct file *file)
{
return single_open(file, acpi_system_alarm_seq_show, PDE(inode)->data);
}
......@@ -687,7 +673,7 @@ static int __init acpi_sleep_init(void)
"Unable to create '%s' fs entry\n",
ACPI_SYSTEM_FILE_SLEEP));
else {
entry->read_proc = acpi_system_read_sleep;
entry->proc_fops = &acpi_system_sleep_fops;
entry->write_proc = acpi_system_write_sleep;
}
......@@ -699,7 +685,7 @@ static int __init acpi_sleep_init(void)
"Unable to create '%s' fs entry\n",
ACPI_SYSTEM_FILE_ALARM));
else {
entry->read_proc = acpi_system_read_alarm;
entry->proc_fops = &acpi_system_alarm_fops;
entry->write_proc = acpi_system_write_alarm;
}
......
......@@ -39,6 +39,7 @@
#include <linux/proc_fs.h>
#include <linux/sched.h>
#include <linux/kmod.h>
#include <linux/seq_file.h>
#include "acpi_bus.h"
#include "acpi_drivers.h"
......@@ -79,6 +80,11 @@ MODULE_PARM_DESC(tzp, "Thermal zone polling frequency, in 1/10 seconds.\n");
static int acpi_thermal_add (struct acpi_device *device);
static int acpi_thermal_remove (struct acpi_device *device, int type);
static int acpi_thermal_state_open_fs(struct inode *inode, struct file *file);
static int acpi_thermal_temp_open_fs(struct inode *inode, struct file *file);
static int acpi_thermal_trip_open_fs(struct inode *inode, struct file *file);
static int acpi_thermal_cooling_open_fs(struct inode *inode, struct file *file);
static int acpi_thermal_polling_open_fs(struct inode *inode, struct file *file);
static struct acpi_driver acpi_thermal_driver = {
.name = ACPI_THERMAL_DRIVER_NAME,
......@@ -157,6 +163,40 @@ struct acpi_thermal {
struct timer_list timer;
};
static struct file_operations acpi_thermal_state_fops = {
.open = acpi_thermal_state_open_fs,
.read = seq_read,
.llseek = seq_lseek,
.release = single_release,
};
static struct file_operations acpi_thermal_temp_fops = {
.open = acpi_thermal_temp_open_fs,
.read = seq_read,
.llseek = seq_lseek,
.release = single_release,
};
static struct file_operations acpi_thermal_trip_fops = {
.open = acpi_thermal_trip_open_fs,
.read = seq_read,
.llseek = seq_lseek,
.release = single_release,
};
static struct file_operations acpi_thermal_cooling_fops = {
.open = acpi_thermal_cooling_open_fs,
.read = seq_read,
.llseek = seq_lseek,
.release = single_release,
};
static struct file_operations acpi_thermal_polling_fops = {
.open = acpi_thermal_polling_open_fs,
.read = seq_read,
.llseek = seq_lseek,
.release = single_release,
};
/* --------------------------------------------------------------------------
Thermal Zone Management
......@@ -720,154 +760,119 @@ acpi_thermal_check (
struct proc_dir_entry *acpi_thermal_dir = NULL;
static int
acpi_thermal_read_state (
char *page,
char **start,
off_t off,
int count,
int *eof,
void *data)
static int acpi_thermal_state_seq_show(struct seq_file *seq, void *offset)
{
struct acpi_thermal *tz = (struct acpi_thermal *) data;
char *p = page;
int len = 0;
struct acpi_thermal *tz = (struct acpi_thermal *)seq->private;
ACPI_FUNCTION_TRACE("acpi_thermal_read_state");
ACPI_FUNCTION_TRACE("acpi_thermal_state_seq_show");
if (!tz || (off != 0))
if (!tz)
goto end;
p += sprintf(p, "state: ");
seq_puts(seq, "state: ");
if (!tz->state.critical && !tz->state.hot && !tz->state.passive && !tz->state.active)
p += sprintf(p, "ok\n");
seq_puts(seq, "ok\n");
else {
if (tz->state.critical)
p += sprintf(p, "critical ");
seq_puts(seq, "critical ");
if (tz->state.hot)
p += sprintf(p, "hot ");
seq_puts(seq, "hot ");
if (tz->state.passive)
p += sprintf(p, "passive ");
seq_puts(seq, "passive ");
if (tz->state.active)
p += sprintf(p, "active[%d]", tz->state.active_index);
p += sprintf(p, "\n");
seq_printf(seq, "active[%d]", tz->state.active_index);
seq_puts(seq, "\n");
}
end:
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);
return 0;
}
static int acpi_thermal_state_open_fs(struct inode *inode, struct file *file)
{
return single_open(file, acpi_thermal_state_seq_show, PDE(inode)->data);
}
static int
acpi_thermal_read_temperature (
char *page,
char **start,
off_t off,
int count,
int *eof,
void *data)
static int acpi_thermal_temp_seq_show(struct seq_file *seq, void *offset)
{
int result = 0;
struct acpi_thermal *tz = (struct acpi_thermal *) data;
char *p = page;
int len = 0;
struct acpi_thermal *tz = (struct acpi_thermal *)seq->private;
ACPI_FUNCTION_TRACE("acpi_thermal_read_temperature");
ACPI_FUNCTION_TRACE("acpi_thermal_temp_seq_show");
if (!tz || (off != 0))
if (!tz)
goto end;
result = acpi_thermal_get_temperature(tz);
if (result)
goto end;
p += sprintf(p, "temperature: %ld C\n",
seq_printf(seq, "temperature: %ld C\n",
KELVIN_TO_CELSIUS(tz->temperature));
end:
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);
return 0;
}
static int acpi_thermal_temp_open_fs(struct inode *inode, struct file *file)
{
return single_open(file, acpi_thermal_temp_seq_show, PDE(inode)->data);
}
static int
acpi_thermal_read_trip_points (
char *page,
char **start,
off_t off,
int count,
int *eof,
void *data)
static int acpi_thermal_trip_seq_show(struct seq_file *seq, void *offset)
{
struct acpi_thermal *tz = (struct acpi_thermal *) data;
char *p = page;
int len = 0;
struct acpi_thermal *tz = (struct acpi_thermal *)seq->private;
int i = 0;
int j = 0;
ACPI_FUNCTION_TRACE("acpi_thermal_read_trip_points");
ACPI_FUNCTION_TRACE("acpi_thermal_trip_seq_show");
if (!tz || (off != 0))
if (!tz)
goto end;
if (tz->trips.critical.flags.valid)
p += sprintf(p, "critical (S5): %ld C\n",
seq_printf(seq, "critical (S5): %ld C\n",
KELVIN_TO_CELSIUS(tz->trips.critical.temperature));
if (tz->trips.hot.flags.valid)
p += sprintf(p, "hot (S4): %ld C\n",
seq_printf(seq, "hot (S4): %ld C\n",
KELVIN_TO_CELSIUS(tz->trips.hot.temperature));
if (tz->trips.passive.flags.valid) {
p += sprintf(p, "passive: %ld C: tc1=%lu tc2=%lu tsp=%lu devices=",
seq_printf(seq, "passive: %ld C: tc1=%lu tc2=%lu tsp=%lu devices=",
KELVIN_TO_CELSIUS(tz->trips.passive.temperature),
tz->trips.passive.tc1,
tz->trips.passive.tc2,
tz->trips.passive.tsp);
for (j=0; j<tz->trips.passive.devices.count; j++) {
p += sprintf(p, "0x%p ", tz->trips.passive.devices.handles[j]);
seq_printf(seq, "0x%p ", tz->trips.passive.devices.handles[j]);
}
p += sprintf(p, "\n");
seq_puts(seq, "\n");
}
for (i=0; i<ACPI_THERMAL_MAX_ACTIVE; i++) {
for (i = 0; i < ACPI_THERMAL_MAX_ACTIVE; i++) {
if (!(tz->trips.active[i].flags.valid))
break;
p += sprintf(p, "active[%d]: %ld C: devices=",
seq_printf(seq, "active[%d]: %ld C: devices=",
i, KELVIN_TO_CELSIUS(tz->trips.active[i].temperature));
for (j=0; j<tz->trips.active[i].devices.count; j++)
p += sprintf(p, "0x%p ",
for (j = 0; j < tz->trips.active[i].devices.count; j++)
seq_printf(seq, "0x%p ",
tz->trips.active[i].devices.handles[j]);
p += sprintf(p, "\n");
seq_puts(seq, "\n");
}
end:
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);
return 0;
}
static int acpi_thermal_trip_open_fs(struct inode *inode, struct file *file)
{
return single_open(file, acpi_thermal_trip_seq_show, PDE(inode)->data);
}
static int
acpi_thermal_write_trip_points (
......@@ -909,43 +914,32 @@ acpi_thermal_write_trip_points (
}
static int
acpi_thermal_read_cooling_mode (
char *page,
char **start,
off_t off,
int count,
int *eof,
void *data)
static int acpi_thermal_cooling_seq_show(struct seq_file *seq, void *offset)
{
struct acpi_thermal *tz = (struct acpi_thermal *) data;
char *p = page;
int len = 0;
struct acpi_thermal *tz = (struct acpi_thermal *)seq->private;
ACPI_FUNCTION_TRACE("acpi_thermal_read_cooling_mode");
ACPI_FUNCTION_TRACE("acpi_thermal_cooling_seq_show");
if (!tz || (off != 0))
if (!tz)
goto end;
if (!tz->flags.cooling_mode) {
p += sprintf(p, "<not supported>\n");
seq_puts(seq, "<not supported>\n");
goto end;
}
p += sprintf(p, "cooling mode: %s\n",
seq_printf(seq, "cooling mode: %s\n",
tz->cooling_mode?"passive":"active");
end:
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);
return 0;
}
static int acpi_thermal_cooling_open_fs(struct inode *inode, struct file *file)
{
return single_open(file, acpi_thermal_cooling_seq_show,
PDE(inode)->data);
}
static int
acpi_thermal_write_cooling_mode (
......@@ -980,43 +974,32 @@ acpi_thermal_write_cooling_mode (
}
static int
acpi_thermal_read_polling (
char *page,
char **start,
off_t off,
int count,
int *eof,
void *data)
static int acpi_thermal_polling_seq_show(struct seq_file *seq, void *offset)
{
struct acpi_thermal *tz = (struct acpi_thermal *) data;
char *p = page;
int len = 0;
struct acpi_thermal *tz = (struct acpi_thermal *)seq->private;
ACPI_FUNCTION_TRACE("acpi_thermal_read_polling");
ACPI_FUNCTION_TRACE("acpi_thermal_polling_seq_show");
if (!tz || (off != 0))
if (!tz)
goto end;
if (!tz->polling_frequency) {
p += sprintf(p, "<polling disabled>\n");
seq_puts(seq, "<polling disabled>\n");
goto end;
}
p += sprintf(p, "polling frequency: %lu seconds\n",
seq_printf(seq, "polling frequency: %lu seconds\n",
(tz->polling_frequency / 10));
end:
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);
return 0;
}
static int acpi_thermal_polling_open_fs(struct inode *inode, struct file *file)
{
return single_open(file, acpi_thermal_polling_seq_show,
PDE(inode)->data);
}
static int
acpi_thermal_write_polling (
......@@ -1075,7 +1058,7 @@ acpi_thermal_add_fs (
"Unable to create '%s' fs entry\n",
ACPI_THERMAL_FILE_STATE));
else {
entry->read_proc = acpi_thermal_read_state;
entry->proc_fops = &acpi_thermal_state_fops;
entry->data = acpi_driver_data(device);
}
......@@ -1087,7 +1070,7 @@ acpi_thermal_add_fs (
"Unable to create '%s' fs entry\n",
ACPI_THERMAL_FILE_TEMPERATURE));
else {
entry->read_proc = acpi_thermal_read_temperature;
entry->proc_fops = &acpi_thermal_temp_fops;
entry->data = acpi_driver_data(device);
}
......@@ -1099,7 +1082,7 @@ acpi_thermal_add_fs (
"Unable to create '%s' fs entry\n",
ACPI_THERMAL_FILE_POLLING_FREQ));
else {
entry->read_proc = acpi_thermal_read_trip_points;
entry->proc_fops = &acpi_thermal_trip_fops;
entry->write_proc = acpi_thermal_write_trip_points;
entry->data = acpi_driver_data(device);
}
......@@ -1112,7 +1095,7 @@ acpi_thermal_add_fs (
"Unable to create '%s' fs entry\n",
ACPI_THERMAL_FILE_COOLING_MODE));
else {
entry->read_proc = acpi_thermal_read_cooling_mode;
entry->proc_fops = &acpi_thermal_cooling_fops;
entry->write_proc = acpi_thermal_write_cooling_mode;
entry->data = acpi_driver_data(device);
}
......@@ -1125,7 +1108,7 @@ acpi_thermal_add_fs (
"Unable to create '%s' fs entry\n",
ACPI_THERMAL_FILE_POLLING_FREQ));
else {
entry->read_proc = acpi_thermal_read_polling;
entry->proc_fops = &acpi_thermal_polling_fops;
entry->write_proc = acpi_thermal_write_polling;
entry->data = acpi_driver_data(device);
}
......
......@@ -41,6 +41,7 @@
#include <linux/init.h>
#include <linux/types.h>
#include <linux/proc_fs.h>
#include <linux/seq_file.h>
#include <linux/version.h>
#include <acconfig.h>
......@@ -100,6 +101,47 @@ MODULE_LICENSE("GPL");
#define HCI_VIDEO_OUT_CRT 0x2
#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
*/
......@@ -126,22 +168,6 @@ snscanf(const char* str, int n, const char* format, ...)
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
*/
......@@ -259,29 +285,27 @@ static int key_event_valid;
/* proc file handlers
*/
static int
proc_read_lcd(char* page, char** start, off_t off, int count, int* eof,
void* context)
static int toshiba_lcd_seq_show(struct seq_file *seq, void *offset)
{
char* p = page;
u32 hci_result;
u32 value;
if (off != 0) goto end;
hci_read1(HCI_LCD_BRIGHTNESS, &value, &hci_result);
if (hci_result == HCI_SUCCESS) {
value = value >> HCI_LCD_BRIGHTNESS_SHIFT;
p += sprintf(p, "brightness: %d\n", value);
p += sprintf(p, "brightness_levels: %d\n",
HCI_LCD_BRIGHTNESS_LEVELS);
} else {
p += sprintf(p, "ERROR\n");
goto end;
}
seq_printf(seq, "brightness: %d\n"
"brightness_levels: %d\n",
value,
HCI_LCD_BRIGHTNESS_LEVELS);
} else
seq_puts(seq, "ERROR\n");
return 0;
}
end:
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
......@@ -306,31 +330,31 @@ proc_write_lcd(struct file* file, const char* buffer, unsigned long count,
return count;
}
static int
proc_read_video(char* page, char** start, off_t off, int count, int* eof,
void* context)
static int toshiba_video_seq_show(struct seq_file *seq, void *offset)
{
char* p = page;
u32 hci_result;
u32 value;
if (off != 0) goto end;
hci_read1(HCI_VIDEO_OUT, &value, &hci_result);
if (hci_result == HCI_SUCCESS) {
int is_lcd = (value & HCI_VIDEO_OUT_LCD) ? 1 : 0;
int is_crt = (value & HCI_VIDEO_OUT_CRT) ? 1 : 0;
int is_tv = (value & HCI_VIDEO_OUT_TV ) ? 1 : 0;
p += sprintf(p, "lcd_out: %d\n", is_lcd);
p += sprintf(p, "crt_out: %d\n", is_crt);
p += sprintf(p, "tv_out: %d\n", is_tv);
} else {
p += sprintf(p, "ERROR\n");
goto end;
}
seq_printf(seq, "lcd_out: %d\n"
"crt_out: %d\n"
"tv_out: %d\n",
is_lcd,
is_crt,
is_tv);
} else
seq_puts(seq, "ERROR\n");
return 0;
}
end:
return end_proc_read(p, page, off, count, start, eof);
static int toshiba_video_open_fs(struct inode *inode, struct file *file)
{
return single_open(file, toshiba_video_seq_show, NULL);
}
static int
......@@ -376,27 +400,26 @@ proc_write_video(struct file* file, const char* buffer, unsigned long count,
return count;
}
static int
proc_read_fan(char* page, char** start, off_t off, int count, int* eof,
void* context)
static int toshiba_fan_seq_show(struct seq_file *seq, void *offset)
{
char* p = page;
u32 hci_result;
u32 value;
if (off != 0) goto end;
hci_read1(HCI_FAN, &value, &hci_result);
if (hci_result == HCI_SUCCESS) {
p += sprintf(p, "running: %d\n", (value > 0));
p += sprintf(p, "force_on: %d\n", force_fan);
} else {
p += sprintf(p, "ERROR\n");
goto end;
}
seq_printf(seq, "running: %d\n"
"force_on: %d\n",
(value > 0),
force_fan);
} else
seq_puts(seq, "ERROR\n");
return 0;
}
end:
return end_proc_read(p, page, off, count, start, eof);
static int toshiba_fan_open_fs(struct inode *inode, struct file *file)
{
return single_open(file, toshiba_fan_seq_show, NULL);
}
static int
......@@ -420,16 +443,11 @@ proc_write_fan(struct file* file, const char* buffer, unsigned long count,
return count;
}
static int
proc_read_keys(char* page, char** start, off_t off, int count, int* eof,
void* context)
static int toshiba_keys_seq_show(struct seq_file *seq, void *offset)
{
char* p = page;
u32 hci_result;
u32 value;
if (off != 0) goto end;
if (!key_event_valid) {
hci_read1(HCI_SYSTEM_EVENT, &value, &hci_result);
if (hci_result == HCI_SUCCESS) {
......@@ -438,16 +456,23 @@ proc_read_keys(char* page, char** start, off_t off, int count, int* eof,
} else if (hci_result == HCI_EMPTY) {
/* better luck next time */
} else {
p += sprintf(p, "ERROR\n");
seq_puts(seq, "ERROR\n");
goto end;
}
}
p += sprintf(p, "hotkey_ready: %d\n", key_event_valid);
p += sprintf(p, "hotkey: 0x%04x\n", last_key_event);
seq_printf(seq, "hotkey_ready: %d\n"
"hotkey: 0x%04x\n",
key_event_valid,
last_key_event);
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
......@@ -466,20 +491,19 @@ proc_write_keys(struct file* file, const char* buffer, unsigned long count,
return count;
}
static int
proc_read_version(char* page, char** start, off_t off, int count, int* eof,
void* context)
static int toshiba_version_seq_show(struct seq_file *seq, void *offset)
{
char* p = page;
if (off != 0) goto end;
seq_printf(seq, "driver: %s\n"
"proc_interface: %d\n",
TOSHIBA_ACPI_VERSION,
PROC_INTERFACE_VERSION);
p += sprintf(p, "driver: %s\n", TOSHIBA_ACPI_VERSION);
p += sprintf(p, "proc_interface: %d\n",
PROC_INTERFACE_VERSION);
return 0;
}
end:
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
......@@ -490,24 +514,38 @@ add_device(void)
{
struct proc_dir_entry* proc;
proc = create_proc_read_entry(PROC_LCD, S_IFREG | S_IRUGO | S_IWUSR,
toshiba_proc_dir, proc_read_lcd, 0);
if (proc) proc->write_proc = proc_write_lcd;
proc = create_proc_entry(PROC_LCD, S_IFREG | S_IRUGO | S_IWUSR,
toshiba_proc_dir);
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,
toshiba_proc_dir, proc_read_video, 0);
if (proc) proc->write_proc = proc_write_video;
proc = create_proc_entry(PROC_VIDEO, S_IFREG | S_IRUGO | S_IWUSR,
toshiba_proc_dir);
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,
toshiba_proc_dir, proc_read_fan, 0);
if (proc) proc->write_proc = proc_write_fan;
proc = create_proc_entry(PROC_FAN, S_IFREG | S_IRUGO | S_IWUSR,
toshiba_proc_dir);
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,
toshiba_proc_dir, proc_read_keys, 0);
if (proc) proc->write_proc = proc_write_keys;
proc = create_proc_entry(PROC_KEYS, S_IFREG | S_IRUGO | S_IWUSR,
toshiba_proc_dir);
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,
toshiba_proc_dir, proc_read_version, 0);
proc = create_proc_entry(PROC_VERSION, S_IFREG | S_IRUGO | S_IWUSR,
toshiba_proc_dir);
if (proc)
proc->proc_fops = &toshiba_version_fops;
return(AE_OK);
}
......
/******************************************************************************
*
* Module Name: utcopy - Internal to external object translation utilities
* $Revision: 105 $
* $Revision: 106 $
*
*****************************************************************************/
......@@ -419,7 +419,8 @@ acpi_ut_copy_esimple_to_isimple (
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) {
return_ACPI_STATUS (AE_NO_MEMORY);
}
......@@ -434,7 +435,8 @@ acpi_ut_copy_esimple_to_isimple (
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) {
return_ACPI_STATUS (AE_NO_MEMORY);
}
......@@ -471,10 +473,10 @@ acpi_ut_copy_esimple_to_isimple (
* FUNCTION: Acpi_ut_copy_epackage_to_ipackage
*
* PARAMETERS: *Internal_object - Pointer to the object we are returning
* *Buffer - Where the object is returned
* *Space_used - Where the length of the object is returned
* *Buffer - Where 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
* buffer. A package object by definition contains other objects.
......@@ -607,7 +609,8 @@ acpi_ut_copy_simple_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 */
......@@ -687,26 +690,36 @@ acpi_ut_copy_ielement_to_ielement (
&state->pkg.dest_object->package.elements[this_index];
switch (object_type) {
case 0:
case ACPI_COPY_TYPE_SIMPLE:
/*
* This is a simple object, just copy it
*/
target_object = acpi_ut_create_internal_object (ACPI_GET_OBJECT_TYPE (source_object));
if (!target_object) {
return (AE_NO_MEMORY);
}
/* A null source object indicates a (legal) null package element */
status = acpi_ut_copy_simple_object (source_object, target_object);
if (ACPI_FAILURE (status)) {
return (status);
if (source_object) {
/*
* This is a simple object, just copy it
*/
target_object = acpi_ut_create_internal_object (
ACPI_GET_OBJECT_TYPE (source_object));
if (!target_object) {
return (AE_NO_MEMORY);
}
status = acpi_ut_copy_simple_object (source_object, target_object);
if (ACPI_FAILURE (status)) {
return (status);
}
*this_target_ptr = target_object;
}
else {
/* Pass through a null element */
*this_target_ptr = target_object;
*this_target_ptr = NULL;
}
break;
case 1:
case ACPI_COPY_TYPE_PACKAGE:
/*
* This object is a package - go down another nesting level
......@@ -720,6 +733,17 @@ acpi_ut_copy_ielement_to_ielement (
target_object->package.count = source_object->package.count;
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
*/
......
/*******************************************************************************
*
* Module Name: utmisc - common utility procedures
* $Revision: 86 $
* $Revision: 87 $
*
******************************************************************************/
......@@ -475,7 +475,6 @@ acpi_ut_strupr (
string++;
}
return (src_string);
}
......@@ -575,7 +574,6 @@ acpi_ut_create_mutex (
return_ACPI_STATUS (AE_BAD_PARAMETER);
}
if (!acpi_gbl_acpi_mutex_info[mutex_id].mutex) {
status = acpi_os_create_semaphore (1, 1,
&acpi_gbl_acpi_mutex_info[mutex_id].mutex);
......@@ -613,7 +611,6 @@ acpi_ut_delete_mutex (
return_ACPI_STATUS (AE_BAD_PARAMETER);
}
status = acpi_os_delete_semaphore (acpi_gbl_acpi_mutex_info[mutex_id].mutex);
acpi_gbl_acpi_mutex_info[mutex_id].mutex = NULL;
......@@ -651,7 +648,6 @@ acpi_ut_acquire_mutex (
return (AE_BAD_PARAMETER);
}
this_thread_id = acpi_os_get_thread_id ();
/*
......@@ -679,7 +675,6 @@ acpi_ut_acquire_mutex (
}
}
ACPI_DEBUG_PRINT ((ACPI_DB_MUTEX,
"Thread %X attempting to acquire Mutex [%s]\n",
this_thread_id, acpi_ut_get_mutex_name (mutex_id)));
......@@ -693,7 +688,6 @@ acpi_ut_acquire_mutex (
acpi_gbl_acpi_mutex_info[mutex_id].use_count++;
acpi_gbl_acpi_mutex_info[mutex_id].owner_id = this_thread_id;
}
else {
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),
......@@ -737,7 +731,6 @@ acpi_ut_release_mutex (
return (AE_BAD_PARAMETER);
}
/*
* Mutex must be acquired in order to release it!
*/
......@@ -749,7 +742,6 @@ acpi_ut_release_mutex (
return (AE_NOT_ACQUIRED);
}
/*
* Deadlock prevention. Check if this thread owns any mutexes of value
* greater than this one. If so, the thread has violated the mutex
......@@ -770,7 +762,6 @@ acpi_ut_release_mutex (
}
}
/* Mark unlocked FIRST */
acpi_gbl_acpi_mutex_info[mutex_id].owner_id = ACPI_MUTEX_NOT_ACQUIRED;
......@@ -828,7 +819,6 @@ acpi_ut_create_update_state_and_push (
return (AE_NO_MEMORY);
}
acpi_ut_push_generic_state (state_list, state);
return (AE_OK);
}
......@@ -866,7 +856,6 @@ acpi_ut_create_pkg_state_and_push (
return (AE_NO_MEMORY);
}
acpi_ut_push_generic_state (state_list, state);
return (AE_OK);
}
......@@ -1129,7 +1118,6 @@ acpi_ut_create_control_state (
return_PTR (NULL);
}
/* Init fields specific to the control struct */
state->common.data_type = ACPI_DESC_TYPE_STATE_CONTROL;
......@@ -1224,6 +1212,8 @@ acpi_ut_walk_package_tree (
}
while (state) {
/* Get one element of the package */
this_index = state->pkg.index;
this_source_obj = (acpi_operand_object *)
state->pkg.source_object->package.elements[this_index];
......@@ -1324,6 +1314,7 @@ acpi_ut_generate_checksum (
u32 i;
signed char sum = 0;
for (i = 0; i < length; i++) {
sum = (signed char) (sum + buffer[i]);
}
......
......@@ -20,6 +20,7 @@
#include <linux/sched.h>
#include <linux/vmalloc.h>
#include <linux/smp.h>
#include <linux/errno.h>
#include "cpu_buffer.h"
#include "oprof.h"
......
......@@ -6,13 +6,14 @@
*/
#include <linux/config.h>
#include <linux/kernel.h>
#include <linux/sched.h>
#include <linux/errno.h>
#include <linux/interrupt.h>
#include <linux/init.h>
#include <asm/hardware.h>
#include <asm/mach-types.h>
#include <asm/irq.h>
#include <asm/signal.h>
#include <asm/arch/assabet.h>
#include "sa1100_generic.h"
......
......@@ -31,40 +31,41 @@
*
* PCM Vcc:
*
* PCM Vcc on BadgePAD 4 can be jumpered for 3.3V (short pins 1 and 3
* on JP6) or 5V (short pins 3 and 5 on JP6). N.B., 5V supply rail
* is enabled by the SA-1110's BADGE4_GPIO_PCMEN5V (GPIO 24).
* PCM Vcc on BadgePAD 4 can be jumpered for 3v3 (short pins 1 and 3
* on JP6) or 5v0 (short pins 3 and 5 on JP6).
*
* PCM Vpp:
*
* PCM Vpp on BadgePAD 4 can be jumpered for 12V (short pins 2 and 4
* on JP6) or tied to PCM Vcc (short pins 4 and 6 on JP6). N.B., 12V
* operation requires that the power supply actually supply 12V.
* PCM Vpp on BadgePAD 4 can be jumpered for 12v0 (short pins 4 and 6
* on JP6) or tied to PCM Vcc (short pins 2 and 4 on JP6). N.B.,
* 12v0 operation requires that the power supply actually supply 12v0
* via pin 7 of JP7.
*
* CF Vcc:
*
* CF Vcc on BadgePAD 4 can be jumpered either for 3.3V (short pins 1
* and 2 on JP10) or 5V (short pins 2 and 3 on JP10). The note above
* about the 5V supply rail applies.
* CF Vcc on BadgePAD 4 can be jumpered either for 3v3 (short pins 1
* and 2 on JP10) or 5v0 (short pins 2 and 3 on JP10).
*
* There's no way programmatically to determine how a given board is
* jumpered. This code assumes a default jumpering: 5V PCM Vcc (pins
* 3 and 5 shorted) and PCM Vpp = PCM Vcc (pins 4 and 6 shorted) and
* no jumpering for CF Vcc. If this isn't correct, Override these
* defaults with a pcmv setup argument: pcmv=<pcm vcc>,<pcm vpp>,<cf
* vcc>. E.g. pcmv=33,120,50 indicates 3.3V PCM Vcc, 12.0V PCM Vpp,
* and 5.0V CF Vcc.
* Unfortunately there's no way programmatically to determine how a
* given board is jumpered. This code assumes a default jumpering
* as described below.
*
* If the defaults aren't correct, you may override them with a pcmv
* setup argument: pcmv=<pcm vcc>,<pcm vpp>,<cf vcc>. The units are
* 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_pcmvpp = 50;
static int badge4_cfvcc = 33;
static int badge4_pcmvcc = 50; /* pins 3 and 5 jumpered on JP6 */
static int badge4_pcmvpp = 50; /* pins 2 and 4 jumpered on JP6 */
static int badge4_cfvcc = 33; /* pins 1 and 2 jumpered on JP10 */
static int badge4_pcmcia_init(struct pcmcia_init *init)
{
printk(KERN_INFO __FUNCTION__
": badge4_pcmvcc=%d, badge4_pcmvpp=%d, badge4_cfvcc=%d\n",
printk(KERN_INFO
"%s: badge4_pcmvcc=%d, badge4_pcmvpp=%d, badge4_cfvcc=%d\n",
__FUNCTION__,
badge4_pcmvcc, badge4_pcmvpp, badge4_cfvcc);
return sa1111_pcmcia_init(init);
......@@ -74,7 +75,7 @@ static int badge4_pcmcia_shutdown(void)
{
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_SOCK1, 0);
......@@ -105,7 +106,8 @@ badge4_pcmcia_configure_socket(const struct pcmcia_configure *conf)
(conf->vcc != badge4_pcmvcc)) {
complain_about_jumpering(__FUNCTION__, "pcmvcc",
badge4_pcmvcc, conf->vcc);
return -1;
// Apply power regardless of the jumpering.
// return -1;
}
if ((conf->vpp != 0) &&
(conf->vpp != badge4_pcmvpp)) {
......@@ -156,7 +158,7 @@ static struct pcmcia_low_level badge4_pcmcia_ops = {
.socket_suspend = sa1111_pcmcia_socket_suspend,
};
int __init pcmcia_badge4_init(void)
int pcmcia_badge4_init(void)
{
int ret = -ENODEV;
......@@ -166,7 +168,7 @@ int __init pcmcia_badge4_init(void)
return ret;
}
void __exit pcmcia_badge4_exit(void)
void __devexit pcmcia_badge4_exit(void)
{
sa1100_unregister_pcmcia(&badge4_pcmcia_ops);
}
......
......@@ -7,9 +7,9 @@
*/
#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/sched.h>
#include <linux/ioport.h>
#include <linux/device.h>
#include <linux/interrupt.h>
#include <linux/init.h>
#include <asm/hardware.h>
......
......@@ -55,8 +55,6 @@ static int __devinit serial_card_probe(struct expansion_card *ec, const struct e
unsigned long cardaddr, address;
int port;
ecard_claim (ec);
info = kmalloc(sizeof(struct serial_card_info), GFP_KERNEL);
if (!info)
return -ENOMEM;
......@@ -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));
info->num_ports = type->num_ports;
ecard_set_drvdata(ec, info);
cardaddr = ecard_address(ec, type->type, type->speed);
for (port = 0; port < info->num_ports; port ++) {
......@@ -98,8 +98,6 @@ static void __devexit serial_card_remove(struct expansion_card *ec)
}
kfree(info);
ecard_release(ec);
}
static struct serial_card_type atomwide_type = {
......
......@@ -365,7 +365,7 @@ config SERIAL_SUNSAB
config V850E_NB85E_UART
bool "NEC V850E on-chip UART support"
depends on V850E_NB85E || V850E2_ANNA
depends on V850E_NB85E || V850E2_ANNA || V850E_AS85EP1
default y
config V850E_NB85E_UART_CONSOLE
......
......@@ -25,10 +25,10 @@
/* Initial UART state. This may be overridden by machine-dependent headers. */
#ifndef NB85E_UART_INIT_BAUD
#define NB85E_UART_INIT_BAUD 38400
#define NB85E_UART_INIT_BAUD 115200
#endif
#ifndef NB85E_UART_INIT_CFLAGS
#define NB85E_UART_INIT_CFLAGS (B38400 | CS8 | CREAD)
#define NB85E_UART_INIT_CFLAGS (B115200 | CS8 | CREAD)
#endif
/* A string used for prefixing printed descriptions; since the same UART
......@@ -304,7 +304,7 @@ void nb85e_uart_tx (struct uart_port *port)
port->icount.tx++;
if (uart_circ_chars_pending (xmit) < WAKEUP_CHARS)
uart_event (port, EVT_WRITE_WAKEUP);
uart_write_wakeup (port);
}
no_xmit:
......
......@@ -42,6 +42,6 @@ ide_init_default_hwifs(void)
ide_init_hwif_ports(&hw, 0x1f0, 0x3f6, NULL);
hw.irq = 14;
ide_register_hw(&hw);
ide_register_hw(&hw,NULL);
}
......@@ -7,5 +7,6 @@
#define NR_IRQS 16
#define IRQ_ISA_KEYBOARD 1
#define RTC_IRQ 8
#define AUX_IRQ 12
#define IRQ_HARDDISK 14
......@@ -38,6 +38,4 @@
#define __bus_to_virt__is_a_macro
#define __bus_to_virt(x) __phys_to_virt(x)
#define isa_virt_to_bus virt_to_bus
#endif
......@@ -3,3 +3,5 @@
*
* by Alexander Schulz
*/
#define CLOCK_TICK_RATE 1193180
......@@ -13,7 +13,7 @@
#define ELF_THUMB_OK(x) \
(( (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) \
(( (elf_hwcap & HWCAP_26BIT) && (x)->e_flags & EF_ARM_APCS26) || \
......
#ifdef _ASMARM_SUSPEND_H
#ifndef _ASMARM_SUSPEND_H
#define _ASMARM_SUSPEND_H
#endif
......@@ -127,6 +127,22 @@ extern void anna_uart_pre_configure (unsigned chan,
unsigned cflags, unsigned baud);
#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. */
#define NB85E_TIMER_C_BASE_ADDR 0xFFFFF600
......
/*
* include/asm-v850/as85ep1.h -- AS85EP1 evaluation CPU chip/board
*
* Copyright (C) 2001,2002 NEC Corporation
* Copyright (C) 2001,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>
*/
#ifndef __V850_AS85EP1_H__
#define __V850_AS85EP1_H__
#define CPU_ARCH "v850e"
#define CPU_MODEL "as85ep1"
#define CPU_MODEL_LONG "NEC V850E/AS85EP1"
#define PLATFORM "AS85EP1"
#define PLATFORM_LONG "NEC V850E/AS85EP1 evaluation board"
#define CPU_CLOCK_FREQ 96000000 /* 96MHz */
#define SYS_CLOCK_FREQ CPU_CLOCK_FREQ
/* 1MB of static RAM. */
#define SRAM_ADDR 0x00400000
#define SRAM_SIZE 0x00100000 /* 1MB */
/* 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). */
#define SDRAM_ADDR 0x00600000
#define SDRAM_SIZE 0x039F8000 /* approx 58MB */
/* For <asm/page.h> */
#define PAGE_OFFSET SRAM_ADDR
/* We use on-chip RAM, for a few miscellaneous variables that must be
accessible using a load instruction relative to R0. The AS85EP1 chip
16K of internal RAM located slightly before I/O space. */
#define R0_RAM_ADDR 0xFFFF8000
/* AS85EP1 specific control registers. */
#define AS85EP1_CSC_ADDR(n) (0xFFFFF060 + (n) * 2)
#define AS85EP1_CSC(n) (*(volatile u16 *)AS85EP1_CSC_ADDR(n))
#define AS85EP1_BSC_ADDR 0xFFFFF066
#define AS85EP1_BSC (*(volatile u16 *)AS85EP1_BSC_ADDR)
#define AS85EP1_BCT_ADDR(n) (0xFFFFF480 + (n) * 2)
#define AS85EP1_BCT(n) (*(volatile u16 *)AS85EP1_BCT_ADDR(n))
#define AS85EP1_DWC_ADDR(n) (0xFFFFF484 + (n) * 2)
#define AS85EP1_DWC(n) (*(volatile u16 *)AS85EP1_DWC_ADDR(n))
#define AS85EP1_BCC_ADDR 0xFFFFF488
#define AS85EP1_BCC (*(volatile u16 *)AS85EP1_BCC_ADDR)
#define AS85EP1_ASC_ADDR 0xFFFFF48A
#define AS85EP1_ASC (*(volatile u16 *)AS85EP1_ASC_ADDR)
#define AS85EP1_BCP_ADDR 0xFFFFF48C
#define AS85EP1_BCP (*(volatile u16 *)AS85EP1_BCP_ADDR)
#define AS85EP1_LBS_ADDR 0xFFFFF48E
#define AS85EP1_LBS (*(volatile u16 *)AS85EP1_LBS_ADDR)
#define AS85EP1_BMC_ADDR 0xFFFFF498
#define AS85EP1_BMC (*(volatile u16 *)AS85EP1_BMC_ADDR)
#define AS85EP1_PRC_ADDR 0xFFFFF49A
#define AS85EP1_PRC (*(volatile u16 *)AS85EP1_PRC_ADDR)
#define AS85EP1_SCR_ADDR(n) (0xFFFFF4A0 + (n) * 4)
#define AS85EP1_SCR(n) (*(volatile u16 *)AS85EP1_SCR_ADDR(n))
#define AS85EP1_RFS_ADDR(n) (0xFFFFF4A2 + (n) * 4)
#define AS85EP1_RFS(n) (*(volatile u16 *)AS85EP1_RFS_ADDR(n))
#define AS85EP1_IRAMM_ADDR 0xFFFFF80A
#define AS85EP1_IRAMM (*(volatile u8 *)AS85EP1_IRAMM_ADDR)
/* I/O port P0-P13. */
/* Direct I/O. Bits 0-7 are pins Pn0-Pn7. */
#define AS85EP1_PORT_IO_ADDR(n) (0xFFFFF400 + (n) * 2)
#define AS85EP1_PORT_IO(n) (*(volatile u8 *)AS85EP1_PORT_IO_ADDR(n))
/* Port mode (for direct I/O, 0 = output, 1 = input). */
#define AS85EP1_PORT_PM_ADDR(n) (0xFFFFF420 + (n) * 2)
#define AS85EP1_PORT_PM(n) (*(volatile u8 *)AS85EP1_PORT_PM_ADDR(n))
/* Port mode control (0 = direct I/O mode, 1 = alternative I/O mode). */
#define AS85EP1_PORT_PMC_ADDR(n) (0xFFFFF440 + (n) * 2)
#define AS85EP1_PORT_PMC(n) (*(volatile u8 *)AS85EP1_PORT_PMC_ADDR(n))
/* NB85E-style interrupt system. */
#include <asm/nb85e_intc.h>
/* Hardware-specific interrupt numbers (in the kernel IRQ namespace). */
#define IRQ_INTCCC(n) (0x0C + (n))
#define IRQ_INTCCC_NUM 8
#define IRQ_INTCMD(n) (0x14 + (n)) /* interval timer interrupts 0-5 */
#define IRQ_INTCMD_NUM 6
#define IRQ_INTSRE(n) (0x1E + (n)*3) /* UART 0-1 reception error */
#define IRQ_INTSRE_NUM 2
#define IRQ_INTSR(n) (0x1F + (n)*3) /* UART 0-1 reception completion */
#define IRQ_INTSR_NUM 2
#define IRQ_INTST(n) (0x20 + (n)*3) /* UART 0-1 transmission completion */
#define IRQ_INTST_NUM 2
#define NUM_CPU_IRQS 64
#ifndef __ASSEMBLY__
/* Initialize chip interrupts. */
extern void as85ep1_init_irqs (void);
#endif
/* AS85EP1 UART details (basically the same as the V850E/MA1, but 2 channels). */
#define NB85E_UART_NUM_CHANNELS 2
#define NB85E_UART_BASE_FREQ (SYS_CLOCK_FREQ / 4)
#define NB85E_UART_CHIP_NAME "V850E/NA85E"
/* This is a function that gets called before configuring the UART. */
#define NB85E_UART_PRE_CONFIGURE as85ep1_uart_pre_configure
#ifndef __ASSEMBLY__
extern void as85ep1_uart_pre_configure (unsigned chan,
unsigned cflags, unsigned baud);
#endif
/* This board supports RTS/CTS for the on-chip UART, but only for channel 1. */
/* CTS for UART channel 1 is pin P54 (bit 4 of port 5). */
#define NB85E_UART_CTS(chan) ((chan) == 1 ? !(AS85EP1_PORT_IO(5) & 0x10) : 1)
/* RTS for UART channel 1 is pin P53 (bit 3 of port 5). */
#define NB85E_UART_SET_RTS(chan, val) \
do { \
if (chan == 1) { \
unsigned old = AS85EP1_PORT_IO(5); \
if (val) \
AS85EP1_PORT_IO(5) = old & ~0x8; \
else \
AS85EP1_PORT_IO(5) = old | 0x8; \
} \
} while (0)
/* Timer C details. */
#define NB85E_TIMER_C_BASE_ADDR 0xFFFFF600
/* Timer D details (the AS85EP1 actually has 5 of these; should change later). */
#define NB85E_TIMER_D_BASE_ADDR 0xFFFFF540
#define NB85E_TIMER_D_TMD_BASE_ADDR (NB85E_TIMER_D_BASE_ADDR + 0x0)
#define NB85E_TIMER_D_CMD_BASE_ADDR (NB85E_TIMER_D_BASE_ADDR + 0x2)
#define NB85E_TIMER_D_TMCD_BASE_ADDR (NB85E_TIMER_D_BASE_ADDR + 0x4)
#define NB85E_TIMER_D_BASE_FREQ SYS_CLOCK_FREQ
#define NB85E_TIMER_D_TMCD_CS_MIN 2 /* min 2^2 divider */
/* For <asm/param.h> */
#ifndef HZ
#define HZ 100
#endif
#endif /* __V850_AS85EP1_H__ */
......@@ -16,6 +16,10 @@
.globl name; \
.type name,@function; \
name
#define G_DATA(name) \
.globl name; \
.type name,@object; \
name
#define END(name) \
.size name,.-name
......@@ -23,3 +27,6 @@
.align 4; \
.type name,@function; \
name
#define L_DATA(name) \
.type name,@object; \
name
......@@ -20,6 +20,7 @@
#define C_SYMBOL_NAME(name) macrology_paste(_, name)
#define C_SYMBOL_STRING(name) macrology_stringify(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))
#endif /* __V850_CLINKAGE_H__ */
......@@ -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.
*/
#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.
......
......@@ -19,8 +19,11 @@
#include <asm/clinkage.h>
#define CPU_ARCH "v850e2"
#define CPU_MODEL "FPGA NA85E2C/V850E2"
#define CPU_ARCH "v850e2"
#define CPU_MODEL "v850e2/fpga85e2c"
#define CPU_MODEL_LONG "NEC V850E2/NA85E2C"
#define PLATFORM "fpga85e2c"
#define PLATFORM_LONG "NA85E2C FPGA implementation"
/* `external ram'. */
......
......@@ -65,7 +65,7 @@ extern void gbus_int_disable_irq (unsigned irq);
/* Return true if interrupt handling for interrupt IRQ is enabled. */
extern int gbus_int_irq_enabled (unsigned irq);
/* Disable all GBUS irqs. */
extern int gbus_int_disable_irqs (void);
extern void gbus_int_disable_irqs (void);
/* Clear any pending interrupts for IRQ. */
extern void gbus_int_clear_pending_irq (unsigned irq);
/* Return true if interrupt IRQ is pending (but disabled). */
......
......@@ -3,6 +3,7 @@
#include <linux/config.h>
#include <linux/threads.h>
#include <linux/cache.h>
typedef struct {
unsigned int __softirq_pending;
......
......@@ -52,6 +52,17 @@ typedef void (*irq_handler_t)(int irq, void *data, struct pt_regs *regs);
interrupt. */
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 /* __V850_IRQ_H__ */
......@@ -24,10 +24,13 @@
#include <asm/teg.h>
#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
#include <asm/anna.h>
#endif
#ifdef CONFIG_V850E_AS85EP1
#include <asm/as85ep1.h>
#endif
/* platforms */
#ifdef CONFIG_RTE_CB_MA1
......
......@@ -3,20 +3,40 @@
*
* Copyright (C) 2001,02 NEC Corporation
* Copyright (C) 2001,02 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 include/asm-ppc/module.h
*/
#ifndef __V850_MODULE_H__
#define __V850_MODULE_H__
#define arch_init_modules(x) ((void)0)
#define module_arch_init(x) (0)
#define module_map(sz) vmalloc (sz)
#define module_unmap(sz) vfree (sz)
#define MODULE_SYMBOL_PREFIX "_"
struct v850_plt_entry
{
/* Indirect jump instruction sequence (6-byte mov + 2-byte jr). */
unsigned long tramp[2];
};
struct mod_arch_specific
{
/* How much of the core is actually taken up with core (then
we know the rest is for the PLT). */
unsigned int core_plt_offset;
/* Same for init. */
unsigned int init_plt_offset;
};
#define Elf_Shdr Elf32_Shdr
#define Elf_Sym Elf32_Sym
#define Elf_Ehdr Elf32_Ehdr
#endif /* __V850_MODULE_H__ */
......@@ -43,6 +43,9 @@
#define NB85E_UART_BRGC_ADDR(n) (NB85E_UART_BASE_ADDR(n) + 0x7)
#endif
#ifndef NB85E_UART_CKSR_MAX_FREQ
#define NB85E_UART_CKSR_MAX_FREQ (25*1000*1000)
#endif
/* UART config registers. */
#define NB85E_UART_ASIM(n) (*(volatile u8 *)NB85E_UART_ASIM_ADDR(n))
......@@ -81,7 +84,6 @@
/* UART baud-rate generator control registers. */
#define NB85E_UART_CKSR(n) (*(volatile u8 *)NB85E_UART_CKSR_ADDR(n))
#define NB85E_UART_CKSR_MAX 11
#define NB85E_UART_CKSR_MAX_FREQ (25*1000*1000)
#define NB85E_UART_BRGC(n) (*(volatile u8 *)NB85E_UART_BRGC_ADDR(n))
......
......@@ -3,4 +3,12 @@
#include <asm-generic/percpu.h>
/* This is a stupid hack to satisfy some grotty implicit include-file
dependency; basically, <linux/smp.h> uses BUG_ON, which calls BUG, but
doesn't include the necessary headers to define it. In the twisted
festering mess of includes this must all be resolved somehow on other
platforms, but I haven't the faintest idea how, and don't care; here will
do, even though doesn't actually make any sense. */
#include <asm/page.h>
#endif /* __V850_PERCPU_H__ */
......@@ -30,6 +30,12 @@
*/
#define TASK_SIZE (0xFFFFFFFF)
/*
* This decides where the kernel will search for a free chunk of vm
* space during mmap's. We won't be using it.
*/
#define TASK_UNMAPPED_BASE 0
#ifndef __ASSEMBLY__
......
......@@ -16,7 +16,10 @@
#define CPU_ARCH "v850e"
#define CPU_MODEL "GDB/v850e simulator"
#define CPU_MODEL "v850e"
#define CPU_MODEL_LONG "NEC V850E"
#define PLATFORM "gdb/v850e"
#define PLATFORM_LONG "GDB V850E simulator"
/* We use a wierd value for RAM, not just 0, for testing purposes.
......
......@@ -16,8 +16,11 @@
#define __V850_SIM85E2C_H__
#define CPU_ARCH "v850e2"
#define CPU_MODEL "sim85e2c simulator"
#define CPU_ARCH "v850e2"
#define CPU_MODEL "v850e2"
#define CPU_MODEL_LONG "NEC V850E2"
#define PLATFORM "sim85e2c"
#define PLATFORM_LONG "SIM85E2C V850E2 simulator"
/* Various memory areas supported by the simulator.
......
......@@ -46,13 +46,13 @@ struct stat64 {
unsigned long __unused4; /* future possible st_blocks high bits */
unsigned long st_atime;
unsigned long __unused5;
unsigned long st_atime_nsec;
unsigned long st_mtime;
unsigned long __unused6;
unsigned long st_mtime_nsec;
unsigned long st_ctime;
unsigned long __unused7; /* high 32 bits of ctime someday */
unsigned long st_ctime_nsec;
unsigned long __unused8;
};
......
......@@ -239,11 +239,18 @@
#define SYSCALL_SHORT_CLOBBERS SYSCALL_CLOBBERS, "r13", "r14"
/* User programs sometimes end up including this header file
(indirectly, via uClibc header files), so I'm a bit nervous just
including <linux/compiler.h>. */
#if !defined(__builtin_expect) && __GNUC__ == 2 && __GNUC_MINOR__ < 96
#define __builtin_expect(x, expected_value) (x)
#endif
#define __syscall_return(type, res) \
do { \
/* user-visible error numbers are in the range -1 - -124: \
see <asm-v850/errno.h> */ \
if ((unsigned long)(res) >= (unsigned long)(-125)) { \
if (__builtin_expect ((unsigned long)(res) >= (unsigned long)(-125), 0)) { \
errno = -(res); \
res = -1; \
} \
......@@ -340,6 +347,30 @@ type name (atype a, btype b, ctype c, dtype d, etype e) \
__syscall_return (type, __ret); \
}
#if __GNUC__ < 3
/* In older versions of gcc, `asm' statements with more than 10
input/output arguments produce a fatal error. To work around this
problem, we use two versions, one for gcc-3.x and one for earlier
versions of gcc (the `earlier gcc' version doesn't work with gcc-3.x
because gcc-3.x doesn't allow clobbers to also be input arguments). */
#define __SYSCALL6_TRAP(syscall, ret, a, b, c, d, e, f) \
__asm__ __volatile__ ("trap " SYSCALL_LONG_TRAP \
: "=r" (ret), "=r" (syscall) \
: "1" (syscall), \
"r" (a), "r" (b), "r" (c), "r" (d), \
"r" (e), "r" (f) \
: SYSCALL_CLOBBERS, SYSCALL_ARG4, SYSCALL_ARG5);
#else /* __GNUC__ >= 3 */
#define __SYSCALL6_TRAP(syscall, ret, a, b, c, d, e, f) \
__asm__ __volatile__ ("trap " SYSCALL_LONG_TRAP \
: "=r" (ret), "=r" (syscall), \
"=r" (e), "=r" (f) \
: "1" (syscall), \
"r" (a), "r" (b), "r" (c), "r" (d), \
"2" (e), "3" (f) \
: SYSCALL_CLOBBERS);
#endif
#define _syscall6(type, name, atype, a, btype, b, ctype, c, dtype, d, etype, e, ftype, f) \
type name (atype a, btype b, ctype c, dtype d, etype e, ftype f) \
{ \
......@@ -351,13 +382,7 @@ type name (atype a, btype b, ctype c, dtype d, etype e, ftype f) \
register etype __f __asm__ (SYSCALL_ARG5) = f; \
register unsigned long __syscall __asm__ (SYSCALL_NUM) = __NR_##name; \
register unsigned long __ret __asm__ (SYSCALL_RET); \
__asm__ __volatile__ ("trap " SYSCALL_LONG_TRAP \
: "=r" (__ret), "=r" (__syscall), \
"=r" (__e), "=r" (__f) \
: "1" (__syscall), \
"r" (__a), "r" (__b), "r" (__c), "r" (__d), \
"2" (__e), "3" (__f) \
: SYSCALL_CLOBBERS); \
__SYSCALL6_TRAP(__syscall, __ret, __a, __b, __c, __d, __e, __f); \
__syscall_return (type, __ret); \
}
......@@ -398,8 +423,8 @@ extern inline pid_t wait(int * wait_stat)
/*
* "Conditional" syscalls
*/
#define cond_syscall(name) \
asm (".weak\t" C_SYMBOL_STRING(name) ";" \
#define cond_syscall(name) \
asm (".weak\t" C_SYMBOL_STRING(name) ";" \
".set\t" C_SYMBOL_STRING(name) "," C_SYMBOL_STRING(sys_ni_syscall));
#if 0
/* This doesn't work if there's a function prototype for NAME visible,
......
......@@ -55,6 +55,10 @@
#define PORT_SUNZILOG 38
#define PORT_SUNSAB 39
/* NEC v850. */
#define PORT_NB85E_UART 40
#ifdef __KERNEL__
#include <linux/config.h>
......
......@@ -1189,7 +1189,7 @@ asmlinkage long sys_getrlimit(unsigned int resource, struct rlimit *rlim)
? -EFAULT : 0;
}
#if !defined(__ia64__)
#if !defined(__ia64__) && !defined(CONFIG_V850)
/*
* Back compatibility for getrlimit. Needed for some apps.
......
......@@ -9,7 +9,6 @@
*
* Filler routines for DMA buffers
*/
#define __ASSEMBLY__
#include <linux/linkage.h>
#include <asm/assembler.h>
#include <asm/hardware.h>
......
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