Commit 367b062b authored by Richard Russon's avatar Richard Russon

Merge flatcap.org:/home/flatcap/backup/bk/ntfs-2.6

into flatcap.org:/home/flatcap/backup/bk/ntfs-2.6-devel
parents 5c680da2 403f2912
......@@ -80,6 +80,16 @@ config PPC_PMAC
select ADB_PMU
select U3_DART
config PPC_MAPLE
depends on PPC_MULTIPLATFORM
bool " Maple 970FX Evaluation Board"
select U3_DART
select MPIC_BROKEN_U3
default n
help
This option enables support for the Maple 970FX Evaluation Board.
For more informations, refer to http://www.970eval.com
config PPC
bool
default y
......@@ -120,6 +130,11 @@ config U3_DART
depends on PPC_MULTIPLATFORM
default n
config MPIC_BROKEN_U3
bool
depends on PPC_MAPLE
default y
config PPC_PMAC64
bool
depends on PPC_PMAC
......
......@@ -55,11 +55,13 @@ drivers-$(CONFIG_OPROFILE) += arch/ppc64/oprofile/
boot := arch/ppc64/boot
boottarget-$(CONFIG_PPC_PSERIES) := zImage zImage.initrd
boottarget-$(CONFIG_PPC_MAPLE) := zImage zImage.initrd
boottarget-$(CONFIG_PPC_ISERIES) := vmlinux.sminitrd vmlinux.initrd vmlinux.sm
$(boottarget-y): vmlinux
$(Q)$(MAKE) $(build)=$(boot) $(boot)/$@
bootimage-$(CONFIG_PPC_PSERIES) := zImage
bootimage-$(CONFIG_PPC_MAPLE) := zImage
bootimage-$(CONFIG_PPC_ISERIES) := vmlinux
BOOTIMAGE := $(bootimage-y)
install: vmlinux
......
This diff is collapsed.
......@@ -50,12 +50,15 @@ obj-$(CONFIG_IBMVIO) += vio.o
obj-$(CONFIG_PPC_PMAC) += pmac_setup.o pmac_feature.o pmac_pci.o \
pmac_time.o pmac_nvram.o pmac_low_i2c.o
obj-$(CONFIG_PPC_MAPLE) += maple_setup.o maple_pci.o maple_time.o
obj-$(CONFIG_U3_DART) += u3_iommu.o
ifdef CONFIG_SMP
obj-$(CONFIG_PPC_PMAC) += pmac_smp.o smp-tbsync.o
obj-$(CONFIG_PPC_ISERIES) += iSeries_smp.o
obj-$(CONFIG_PPC_PSERIES) += pSeries_smp.o
obj-$(CONFIG_PPC_MAPLE) += smp-tbsync.o
endif
obj-$(CONFIG_ALTIVEC) += vecemu.o vector.o
......
......@@ -22,6 +22,7 @@
#include <linux/cpu.h>
#include <linux/module.h>
#include <linux/sysctl.h>
#include <linux/smp.h>
#include <asm/system.h>
#include <asm/processor.h>
......@@ -363,12 +364,13 @@ int idle_setup(void)
}
}
#endif /* CONFIG_PPC_PSERIES */
#ifdef CONFIG_PPC_PMAC
if (systemcfg->platform == PLATFORM_POWERMAC) {
#ifndef CONFIG_PPC_ISERIES
if (systemcfg->platform == PLATFORM_POWERMAC ||
systemcfg->platform == PLATFORM_MAPLE) {
printk(KERN_INFO "Using native/NAP idle loop\n");
idle_loop = native_idle;
}
#endif /* CONFIG_PPC_PMAC */
#endif /* CONFIG_PPC_ISERIES */
return 1;
}
......@@ -192,7 +192,7 @@ static unsigned long get_purr(void);
* is coming, but at this time is still problematic, so for now this
* function will return 0.
*/
static unsigned long get_purr()
static unsigned long get_purr(void)
{
unsigned long sum_purr = 0;
return sum_purr;
......@@ -524,10 +524,10 @@ static int lparcfg_open(struct inode *inode, struct file *file)
}
struct file_operations lparcfg_fops = {
owner:THIS_MODULE,
read:seq_read,
open:lparcfg_open,
release:single_release,
.owner = THIS_MODULE,
.read = seq_read,
.open = lparcfg_open,
.release = single_release,
};
int __init lparcfg_init(void)
......
This diff is collapsed.
/*
* arch/ppc64/kernel/maple_setup.c
*
* (c) Copyright 2004 Benjamin Herrenschmidt (benh@kernel.crashing.org),
* IBM Corp.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version
* 2 of the License, or (at your option) any later version.
*
*/
#define DEBUG
#include <linux/config.h>
#include <linux/init.h>
#include <linux/errno.h>
#include <linux/sched.h>
#include <linux/kernel.h>
#include <linux/mm.h>
#include <linux/stddef.h>
#include <linux/unistd.h>
#include <linux/ptrace.h>
#include <linux/slab.h>
#include <linux/user.h>
#include <linux/a.out.h>
#include <linux/tty.h>
#include <linux/string.h>
#include <linux/delay.h>
#include <linux/ioport.h>
#include <linux/major.h>
#include <linux/initrd.h>
#include <linux/vt_kern.h>
#include <linux/console.h>
#include <linux/ide.h>
#include <linux/pci.h>
#include <linux/adb.h>
#include <linux/cuda.h>
#include <linux/pmu.h>
#include <linux/irq.h>
#include <linux/seq_file.h>
#include <linux/root_dev.h>
#include <linux/serial.h>
#include <linux/smp.h>
#include <asm/processor.h>
#include <asm/sections.h>
#include <asm/prom.h>
#include <asm/system.h>
#include <asm/pgtable.h>
#include <asm/bitops.h>
#include <asm/io.h>
#include <asm/pci-bridge.h>
#include <asm/iommu.h>
#include <asm/machdep.h>
#include <asm/dma.h>
#include <asm/cputable.h>
#include <asm/time.h>
#include <asm/of_device.h>
#include <asm/lmb.h>
#include "mpic.h"
#ifdef DEBUG
#define DBG(fmt...) udbg_printf(fmt)
#else
#define DBG(fmt...)
#endif
extern int maple_set_rtc_time(struct rtc_time *tm);
extern void maple_get_rtc_time(struct rtc_time *tm);
extern void maple_get_boot_time(struct rtc_time *tm);
extern void maple_calibrate_decr(void);
extern void maple_pci_init(void);
extern void maple_pcibios_fixup(void);
extern int maple_pci_get_legacy_ide_irq(struct pci_dev *dev, int channel);
extern void generic_find_legacy_serial_ports(unsigned int *default_speed);
static void maple_restart(char *cmd)
{
}
static void maple_power_off(void)
{
}
static void maple_halt(void)
{
}
#ifdef CONFIG_SMP
struct smp_ops_t maple_smp_ops = {
.probe = smp_mpic_probe,
.message_pass = smp_mpic_message_pass,
.kick_cpu = smp_generic_kick_cpu,
.setup_cpu = smp_mpic_setup_cpu,
.give_timebase = smp_generic_give_timebase,
.take_timebase = smp_generic_take_timebase,
};
#endif /* CONFIG_SMP */
void __init maple_setup_arch(void)
{
/* init to some ~sane value until calibrate_delay() runs */
loops_per_jiffy = 50000000;
/* Setup SMP callback */
#ifdef CONFIG_SMP
smp_ops = &maple_smp_ops;
#endif
/* Setup the PCI DMA to "direct" by default. May be overriden
* by iommu later on
*/
pci_dma_init_direct();
/* Lookup PCI hosts */
maple_pci_init();
#ifdef CONFIG_DUMMY_CONSOLE
conswitchp = &dummy_con;
#endif
}
/*
* Early initialization.
*/
static void __init maple_init_early(void)
{
unsigned int default_speed;
DBG(" -> maple_init_early\n");
/* Initialize hash table, from now on, we can take hash faults
* and call ioremap
*/
hpte_init_native();
/* Find the serial port */
generic_find_legacy_serial_ports(&default_speed);
DBG("naca->serialPortAddr: %lx\n", (long)naca->serialPortAddr);
if (naca->serialPortAddr) {
void *comport;
/* Map the uart for udbg. */
comport = (void *)__ioremap(naca->serialPortAddr, 16, _PAGE_NO_CACHE);
udbg_init_uart(comport, default_speed);
ppc_md.udbg_putc = udbg_putc;
ppc_md.udbg_getc = udbg_getc;
ppc_md.udbg_getc_poll = udbg_getc_poll;
DBG("Hello World !\n");
}
/* Setup interrupt mapping options */
naca->interrupt_controller = IC_OPEN_PIC;
DBG(" <- maple_init_early\n");
}
static __init void maple_init_IRQ(void)
{
struct device_node *root;
unsigned int *opprop;
unsigned long opic_addr;
struct mpic *mpic;
unsigned char senses[128];
int n;
DBG(" -> maple_init_IRQ\n");
/* XXX: Non standard, replace that with a proper openpic/mpic node
* in the device-tree. Find the Open PIC if present */
root = of_find_node_by_path("/");
opprop = (unsigned int *) get_property(root,
"platform-open-pic", NULL);
if (opprop == 0)
panic("OpenPIC not found !\n");
n = prom_n_addr_cells(root);
for (opic_addr = 0; n > 0; --n)
opic_addr = (opic_addr << 32) + *opprop++;
of_node_put(root);
/* Obtain sense values from device-tree */
prom_get_irq_senses(senses, 0, 128);
mpic = mpic_alloc(opic_addr,
MPIC_PRIMARY | MPIC_BIG_ENDIAN |
MPIC_BROKEN_U3 | MPIC_WANTS_RESET,
0, 0, 128, 128, senses, 128, "U3-MPIC");
BUG_ON(mpic == NULL);
mpic_init(mpic);
DBG(" <- maple_init_IRQ\n");
}
static void __init maple_progress(char *s, unsigned short hex)
{
printk("*** %04x : %s\n", hex, s ? s : "");
}
/*
* Called very early, MMU is off, device-tree isn't unflattened
*/
static int __init maple_probe(int platform)
{
if (platform != PLATFORM_MAPLE)
return 0;
/*
* On U3, the DART (iommu) must be allocated now since it
* has an impact on htab_initialize (due to the large page it
* occupies having to be broken up so the DART itself is not
* part of the cacheable linar mapping
*/
alloc_u3_dart_table();
return 1;
}
struct machdep_calls __initdata maple_md = {
.probe = maple_probe,
.setup_arch = maple_setup_arch,
.init_early = maple_init_early,
.init_IRQ = maple_init_IRQ,
.get_irq = mpic_get_irq,
.pcibios_fixup = maple_pcibios_fixup,
#if 0
.pci_get_legacy_ide_irq = maple_pci_get_legacy_ide_irq,
#endif
.restart = maple_restart,
.power_off = maple_power_off,
.halt = maple_halt,
.get_boot_time = maple_get_boot_time,
.set_rtc_time = maple_set_rtc_time,
.get_rtc_time = maple_get_rtc_time,
.calibrate_decr = maple_calibrate_decr,
.progress = maple_progress,
};
/*
* arch/ppc64/kernel/maple_time.c
*
* (c) Copyright 2004 Benjamin Herrenschmidt (benh@kernel.crashing.org),
* IBM Corp.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version
* 2 of the License, or (at your option) any later version.
*
*/
#undef DEBUG
#include <linux/config.h>
#include <linux/errno.h>
#include <linux/sched.h>
#include <linux/kernel.h>
#include <linux/param.h>
#include <linux/string.h>
#include <linux/mm.h>
#include <linux/init.h>
#include <linux/time.h>
#include <linux/adb.h>
#include <linux/pmu.h>
#include <linux/interrupt.h>
#include <linux/mc146818rtc.h>
#include <linux/bcd.h>
#include <asm/sections.h>
#include <asm/prom.h>
#include <asm/system.h>
#include <asm/io.h>
#include <asm/pgtable.h>
#include <asm/machdep.h>
#include <asm/time.h>
#ifdef DEBUG
#define DBG(x...) printk(x)
#else
#define DBG(x...)
#endif
extern void setup_default_decr(void);
extern void GregorianDay(struct rtc_time * tm);
extern unsigned long ppc_tb_freq;
extern unsigned long ppc_proc_freq;
static int maple_rtc_addr;
static int maple_clock_read(int addr)
{
outb_p(addr, maple_rtc_addr);
return inb_p(maple_rtc_addr+1);
}
static void maple_clock_write(unsigned long val, int addr)
{
outb_p(addr, maple_rtc_addr);
outb_p(val, maple_rtc_addr+1);
}
void maple_get_rtc_time(struct rtc_time *tm)
{
int uip, i;
/* The Linux interpretation of the CMOS clock register contents:
* When the Update-In-Progress (UIP) flag goes from 1 to 0, the
* RTC registers show the second which has precisely just started.
* Let's hope other operating systems interpret the RTC the same way.
*/
/* Since the UIP flag is set for about 2.2 ms and the clock
* is typically written with a precision of 1 jiffy, trying
* to obtain a precision better than a few milliseconds is
* an illusion. Only consistency is interesting, this also
* allows to use the routine for /dev/rtc without a potential
* 1 second kernel busy loop triggered by any reader of /dev/rtc.
*/
for (i = 0; i<1000000; i++) {
uip = maple_clock_read(RTC_FREQ_SELECT);
tm->tm_sec = maple_clock_read(RTC_SECONDS);
tm->tm_min = maple_clock_read(RTC_MINUTES);
tm->tm_hour = maple_clock_read(RTC_HOURS);
tm->tm_mday = maple_clock_read(RTC_DAY_OF_MONTH);
tm->tm_mon = maple_clock_read(RTC_MONTH);
tm->tm_year = maple_clock_read(RTC_YEAR);
uip |= maple_clock_read(RTC_FREQ_SELECT);
if ((uip & RTC_UIP)==0)
break;
}
if (!(maple_clock_read(RTC_CONTROL) & RTC_DM_BINARY)
|| RTC_ALWAYS_BCD) {
BCD_TO_BIN(tm->tm_sec);
BCD_TO_BIN(tm->tm_min);
BCD_TO_BIN(tm->tm_hour);
BCD_TO_BIN(tm->tm_mday);
BCD_TO_BIN(tm->tm_mon);
BCD_TO_BIN(tm->tm_year);
}
if ((tm->tm_year + 1900) < 1970)
tm->tm_year += 100;
GregorianDay(tm);
}
int maple_set_rtc_time(struct rtc_time *tm)
{
unsigned char save_control, save_freq_select;
int sec, min, hour, mon, mday, year;
spin_lock(&rtc_lock);
save_control = maple_clock_read(RTC_CONTROL); /* tell the clock it's being set */
maple_clock_write((save_control|RTC_SET), RTC_CONTROL);
save_freq_select = maple_clock_read(RTC_FREQ_SELECT); /* stop and reset prescaler */
maple_clock_write((save_freq_select|RTC_DIV_RESET2), RTC_FREQ_SELECT);
sec = tm->tm_sec;
min = tm->tm_min;
hour = tm->tm_hour;
mon = tm->tm_mon;
mday = tm->tm_mday;
year = tm->tm_year;
if (!(save_control & RTC_DM_BINARY) || RTC_ALWAYS_BCD) {
BIN_TO_BCD(sec);
BIN_TO_BCD(min);
BIN_TO_BCD(hour);
BIN_TO_BCD(mon);
BIN_TO_BCD(mday);
BIN_TO_BCD(year);
}
maple_clock_write(sec, RTC_SECONDS);
maple_clock_write(min, RTC_MINUTES);
maple_clock_write(hour, RTC_HOURS);
maple_clock_write(mon, RTC_MONTH);
maple_clock_write(mday, RTC_DAY_OF_MONTH);
maple_clock_write(year, RTC_YEAR);
/* The following flags have to be released exactly in this order,
* otherwise the DS12887 (popular MC146818A clone with integrated
* battery and quartz) will not reset the oscillator and will not
* update precisely 500 ms later. You won't find this mentioned in
* the Dallas Semiconductor data sheets, but who believes data
* sheets anyway ... -- Markus Kuhn
*/
maple_clock_write(save_control, RTC_CONTROL);
maple_clock_write(save_freq_select, RTC_FREQ_SELECT);
spin_unlock(&rtc_lock);
return 0;
}
void __init maple_get_boot_time(struct rtc_time *tm)
{
struct device_node *rtcs;
rtcs = find_compatible_devices("rtc", "pnpPNP,b00");
if (rtcs && rtcs->addrs) {
maple_rtc_addr = rtcs->addrs[0].address;
printk(KERN_INFO "Maple: Found RTC at 0x%x\n", maple_rtc_addr);
} else {
maple_rtc_addr = RTC_PORT(0); /* legacy address */
printk(KERN_INFO "Maple: No device node for RTC, assuming "
"legacy address (0x%x)\n", maple_rtc_addr);
}
maple_get_rtc_time(tm);
}
/* XXX FIXME: Some sane defaults: 125 MHz timebase, 1GHz processor */
#define DEFAULT_TB_FREQ 125000000UL
#define DEFAULT_PROC_FREQ (DEFAULT_TB_FREQ * 8)
void __init maple_calibrate_decr(void)
{
struct device_node *cpu;
struct div_result divres;
unsigned int *fp = NULL;
/*
* The cpu node should have a timebase-frequency property
* to tell us the rate at which the decrementer counts.
*/
cpu = of_find_node_by_type(NULL, "cpu");
ppc_tb_freq = DEFAULT_TB_FREQ;
if (cpu != 0)
fp = (unsigned int *)get_property(cpu, "timebase-frequency", NULL);
if (fp != NULL)
ppc_tb_freq = *fp;
else
printk(KERN_ERR "WARNING: Estimating decrementer frequency (not found)\n");
fp = NULL;
ppc_proc_freq = DEFAULT_PROC_FREQ;
if (cpu != 0)
fp = (unsigned int *)get_property(cpu, "clock-frequency", NULL);
if (fp != NULL)
ppc_proc_freq = *fp;
else
printk(KERN_ERR "WARNING: Estimating processor frequency (not found)\n");
of_node_put(cpu);
printk(KERN_INFO "time_init: decrementer frequency = %lu.%.6lu MHz\n",
ppc_tb_freq/1000000, ppc_tb_freq%1000000);
printk(KERN_INFO "time_init: processor frequency = %lu.%.6lu MHz\n",
ppc_proc_freq/1000000, ppc_proc_freq%1000000);
tb_ticks_per_jiffy = ppc_tb_freq / HZ;
tb_ticks_per_sec = tb_ticks_per_jiffy * HZ;
tb_ticks_per_usec = ppc_tb_freq / 1000000;
tb_to_us = mulhwu_scale_factor(ppc_tb_freq, 1000000);
div128_by_32(1024*1024, 0, tb_ticks_per_sec, &divres);
tb_to_xs = divres.result_low;
setup_default_decr();
}
......@@ -591,7 +591,7 @@ _GLOBAL(do_cpu_ftr_fixups)
isync
b 1b
#ifdef CONFIG_PPC_PMAC
#if defined(CONFIG_PPC_PMAC) || defined(CONFIG_PPC_MAPLE)
/*
* Do an IO access in real mode
*/
......@@ -653,7 +653,7 @@ _GLOBAL(real_writeb)
sync
isync
blr
#endif /* CONFIG_PPC_PMAC */
#endif /* defined(CONFIG_PPC_PMAC) || defined(CONFIG_PPC_MAPLE) */
/*
* Create a kernel thread
......
......@@ -580,11 +580,13 @@ struct mpic * __init mpic_alloc(unsigned long phys_addr,
void __init mpic_assign_isu(struct mpic *mpic, unsigned int isu_num,
unsigned long phys_addr)
{
unsigned int isu_first = isu_num * mpic->isu_size;
BUG_ON(isu_num >= MPIC_MAX_ISU);
mpic->isus[isu_num] = ioremap(phys_addr, MPIC_IRQ_STRIDE * mpic->isu_size);
if ((isu_num + mpic->isu_size) > mpic->num_sources)
mpic->num_sources = isu_num + mpic->isu_size;
if ((isu_first + mpic->isu_size) > mpic->num_sources)
mpic->num_sources = isu_first + mpic->isu_size;
}
void __init mpic_setup_cascade(unsigned int irq, mpic_cascade_t handler,
......
......@@ -711,7 +711,7 @@ int nvram_read_error_log(char * buff, int length, unsigned int * err_type)
/* This doesn't actually zero anything, but it sets the event_logged
* word to tell that this event is safely in syslog.
*/
int nvram_clear_error_log()
int nvram_clear_error_log(void)
{
loff_t tmp_index;
int clear_word = ERR_FLAG_ALREADY_LOGGED;
......
......@@ -154,8 +154,8 @@ struct pci_ops rtas_pci_ops = {
static void python_countermeasures(unsigned long addr)
{
void *chip_regs;
volatile u32 *tmp, i;
void __iomem *chip_regs;
volatile u32 val;
/* Python's register file is 1 MB in size. */
chip_regs = ioremap(addr & ~(0xfffffUL), 0x100000);
......@@ -167,17 +167,17 @@ static void python_countermeasures(unsigned long addr)
#define PRG_CL_RESET_VALID 0x00010000
tmp = (u32 *)((unsigned long)chip_regs + 0xf6030);
if (*tmp & PRG_CL_RESET_VALID) {
val = in_be32(chip_regs + 0xf6030);
if (val & PRG_CL_RESET_VALID) {
printk(KERN_INFO "Python workaround: ");
*tmp &= ~PRG_CL_RESET_VALID;
val &= ~PRG_CL_RESET_VALID;
out_be32(chip_regs + 0xf6030, val);
/*
* We must read it back for changes to
* take effect
*/
i = *tmp;
printk("reg0: %x\n", i);
val = in_be32(chip_regs + 0xf6030);
printk("reg0: %x\n", val);
}
iounmap(chip_regs);
......
......@@ -576,7 +576,7 @@ void pcibios_add_platform_entries(struct pci_dev *pdev)
static void __devinit pci_process_ISA_OF_ranges(struct device_node *isa_node,
unsigned long phb_io_base_phys,
void * phb_io_base_virt)
void __iomem * phb_io_base_virt)
{
struct isa_range *range;
unsigned long pci_addr;
......@@ -654,6 +654,8 @@ void __devinit pci_process_bridge_OF_ranges(struct pci_controller *hose,
cpu_phys_addr = cpu_phys_addr << 32 | ranges[4];
size = (unsigned long)ranges[na+3] << 32 | ranges[na+4];
if (size == 0)
continue;
switch ((ranges[0] >> 24) & 0x3) {
case 1: /* I/O space */
hose->io_base_phys = cpu_phys_addr;
......@@ -793,7 +795,7 @@ int unmap_bus_range(struct pci_bus *bus)
if (get_bus_io_range(bus, &start_phys, &start_virt, &size))
return 1;
if (iounmap_explicit((void *) start_virt, size))
if (iounmap_explicit((void __iomem *) start_virt, size))
return 1;
return 0;
......
......@@ -33,7 +33,8 @@
#include <asm/prom.h>
static loff_t page_map_seek( struct file *file, loff_t off, int whence);
static ssize_t page_map_read( struct file *file, char *buf, size_t nbytes, loff_t *ppos);
static ssize_t page_map_read( struct file *file, char __user *buf, size_t nbytes,
loff_t *ppos);
static int page_map_mmap( struct file *file, struct vm_area_struct *vma );
static struct file_operations page_map_fops = {
......@@ -161,7 +162,8 @@ static loff_t page_map_seek( struct file *file, loff_t off, int whence)
return (file->f_pos = new);
}
static ssize_t page_map_read( struct file *file, char __user *buf, size_t nbytes, loff_t *ppos)
static ssize_t page_map_read( struct file *file, char __user *buf, size_t nbytes,
loff_t *ppos)
{
struct proc_dir_entry *dp = PDE(file->f_dentry->d_inode);
return simple_read_from_buffer(buf, nbytes, ppos, dp->data, dp->size);
......@@ -208,7 +210,8 @@ static void proc_ppc64_create_ofdt(void)
* whole nodes along with their properties. Operations on individual
* properties are not implemented (yet).
*/
static ssize_t ofdt_write(struct file *file, const char __user *buf, size_t count, loff_t *off)
static ssize_t ofdt_write(struct file *file, const char __user *buf, size_t count,
loff_t *off)
{
int rv = 0;
char *kbuf;
......@@ -302,7 +305,8 @@ static int do_add_node(char *buf, size_t bufsize)
return rv;
}
static struct property *new_property(const char *name, const int length, const unsigned char *value, struct property *last)
static struct property *new_property(const char *name, const int length,
const unsigned char *value, struct property *last)
{
struct property *new = kmalloc(sizeof(*new), GFP_KERNEL);
......@@ -343,7 +347,8 @@ static struct property *new_property(const char *name, const int length, const u
* this function does no allocation or copying of the data. Return value
* is set to the next name in buf, or NULL on error.
*/
static char * parse_next_property(char *buf, char *end, char **name, int *length, unsigned char **value)
static char * parse_next_property(char *buf, char *end, char **name, int *length,
unsigned char **value)
{
char *tmp;
......@@ -351,13 +356,15 @@ static char * parse_next_property(char *buf, char *end, char **name, int *length
tmp = strchr(buf, ' ');
if (!tmp) {
printk(KERN_ERR "property parse failed in %s at line %d\n", __FUNCTION__, __LINE__);
printk(KERN_ERR "property parse failed in %s at line %d\n",
__FUNCTION__, __LINE__);
return NULL;
}
*tmp = '\0';
if (++tmp >= end) {
printk(KERN_ERR "property parse failed in %s at line %d\n", __FUNCTION__, __LINE__);
printk(KERN_ERR "property parse failed in %s at line %d\n",
__FUNCTION__, __LINE__);
return NULL;
}
......@@ -365,11 +372,13 @@ static char * parse_next_property(char *buf, char *end, char **name, int *length
*length = -1;
*length = simple_strtoul(tmp, &tmp, 10);
if (*length == -1) {
printk(KERN_ERR "property parse failed in %s at line %d\n", __FUNCTION__, __LINE__);
printk(KERN_ERR "property parse failed in %s at line %d\n",
__FUNCTION__, __LINE__);
return NULL;
}
if (*tmp != ' ' || ++tmp >= end) {
printk(KERN_ERR "property parse failed in %s at line %d\n", __FUNCTION__, __LINE__);
printk(KERN_ERR "property parse failed in %s at line %d\n",
__FUNCTION__, __LINE__);
return NULL;
}
......@@ -377,11 +386,13 @@ static char * parse_next_property(char *buf, char *end, char **name, int *length
*value = tmp;
tmp += *length;
if (tmp > end) {
printk(KERN_ERR "property parse failed in %s at line %d\n", __FUNCTION__, __LINE__);
printk(KERN_ERR "property parse failed in %s at line %d\n",
__FUNCTION__, __LINE__);
return NULL;
}
else if (tmp < end && *tmp != ' ' && *tmp != '\0') {
printk(KERN_ERR "property parse failed in %s at line %d\n", __FUNCTION__, __LINE__);
printk(KERN_ERR "property parse failed in %s at line %d\n",
__FUNCTION__, __LINE__);
return NULL;
}
tmp++;
......
......@@ -1818,8 +1818,13 @@ int of_remove_node(struct device_node *np)
return -EBUSY;
}
/* XXX This is a layering violation, should be moved to the caller
* --BenH.
*/
#ifdef CONFIG_PPC_PSERIES
if (np->iommu_table)
iommu_free_table(np);
#endif /* CONFIG_PPC_PSERIES */
write_lock(&devtree_lock);
OF_MARK_STALE(np);
......
......@@ -1132,6 +1132,8 @@ static int __init prom_find_machine_type(void)
if (strstr(p, RELOC("Power Macintosh")) ||
strstr(p, RELOC("MacRISC4")))
return PLATFORM_POWERMAC;
if (strstr(p, RELOC("Momentum,Maple")))
return PLATFORM_MAPLE;
i += sl + 1;
}
}
......
......@@ -275,7 +275,7 @@ static int rtas_log_release(struct inode * inode, struct file * file)
* know that we can safely clear the events in NVRAM.
* Next we'll sit and wait for something else to log.
*/
static ssize_t rtas_log_read(struct file * file, char * buf,
static ssize_t rtas_log_read(struct file * file, char __user * buf,
size_t count, loff_t *ppos)
{
int error;
......
......@@ -75,11 +75,14 @@ extern void udbg_init_debug_lpar(void);
extern void udbg_init_pmac_realmode(void);
/* That's RTAS panel debug */
extern void call_rtas_display_status_delay(unsigned char c);
/* Here's maple real mode debug */
extern void udbg_init_maple_realmode(void);
#define EARLY_DEBUG_INIT() do {} while(0)
#if 0
#define EARLY_DEBUG_INIT() udbg_init_debug_lpar()
#define EARLY_DEBUG_INIT() udbg_init_maple_realmode()
#define EARLY_DEBUG_INIT() udbg_init_pmac_realmode()
#define EARLY_DEBUG_INIT() \
do { ppc_md.udbg_putc = call_rtas_display_status_delay; } while(0)
......@@ -326,6 +329,7 @@ static void __init setup_cpu_maps(void)
extern struct machdep_calls pSeries_md;
extern struct machdep_calls pmac_md;
extern struct machdep_calls maple_md;
/* Ultimately, stuff them in an elf section like initcalls... */
static struct machdep_calls __initdata *machines[] = {
......@@ -335,6 +339,9 @@ static struct machdep_calls __initdata *machines[] = {
#ifdef CONFIG_PPC_PMAC
&pmac_md,
#endif /* CONFIG_PPC_PMAC */
#ifdef CONFIG_PPC_MAPLE
&maple_md,
#endif /* CONFIG_PPC_MAPLE */
NULL
};
......@@ -633,6 +640,7 @@ void __init setup_system(void)
printk("naca->debug_switch = 0x%lx\n", naca->debug_switch);
printk("naca->interrupt_controller = 0x%ld\n", naca->interrupt_controller);
printk("systemcfg = 0x%p\n", systemcfg);
printk("systemcfg->platform = 0x%x\n", systemcfg->platform);
printk("systemcfg->processorCount = 0x%lx\n", systemcfg->processorCount);
printk("systemcfg->physicalMemorySize = 0x%lx\n", systemcfg->physicalMemorySize);
printk("systemcfg->dCacheL1LineSize = 0x%x\n", systemcfg->dCacheL1LineSize);
......
......@@ -11,6 +11,8 @@
#include <stdarg.h>
#define WANT_PPCDBG_TAB /* Only defined here */
#include <linux/config.h>
#include <linux/types.h>
#include <asm/ppcdebug.h>
#include <asm/processor.h>
#include <asm/naca.h>
......@@ -20,6 +22,9 @@
#include <asm/prom.h>
#include <asm/pmac_feature.h>
extern u8 real_readb(volatile u8 __iomem *addr);
extern void real_writeb(u8 data, volatile u8 __iomem *addr);
struct NS16550 {
/* this struct must be packed */
unsigned char rbr; /* 0 */
......@@ -47,9 +52,9 @@ struct NS16550 {
#define LSR_TEMT 0x40 /* Xmitter empty */
#define LSR_ERR 0x80 /* Error */
static volatile struct NS16550 *udbg_comport;
static volatile struct NS16550 __iomem *udbg_comport;
void udbg_init_uart(void *comport, unsigned int speed)
void udbg_init_uart(void __iomem *comport, unsigned int speed)
{
u8 dll = 12;
......@@ -65,16 +70,18 @@ void udbg_init_uart(void *comport, unsigned int speed)
break;
}
if (comport) {
udbg_comport = (struct NS16550 *)comport;
udbg_comport->lcr = 0x00; eieio();
udbg_comport->ier = 0xFF; eieio();
udbg_comport->ier = 0x00; eieio();
udbg_comport->lcr = 0x80; eieio(); /* Access baud rate */
udbg_comport->dll = dll; eieio(); /* 1 = 115200, 2 = 57600, 3 = 38400, 12 = 9600 baud */
udbg_comport->dlm = 0; eieio(); /* dll >> 8 which should be zero for fast rates; */
udbg_comport->lcr = 0x03; eieio(); /* 8 data, 1 stop, no parity */
udbg_comport->mcr = 0x03; eieio(); /* RTS/DTR */
udbg_comport->fcr = 0x07; eieio(); /* Clear & enable FIFOs */
udbg_comport = (struct NS16550 __iomem *)comport;
out_8(&udbg_comport->lcr, 0x00);
out_8(&udbg_comport->ier, 0xff);
out_8(&udbg_comport->ier, 0x00);
out_8(&udbg_comport->lcr, 0x80); /* Access baud rate */
out_8(&udbg_comport->dll, dll); /* 1 = 115200, 2 = 57600,
3 = 38400, 12 = 9600 baud */
out_8(&udbg_comport->dlm, 0x00); /* dll >> 8 which should be zero
for fast rates; */
out_8(&udbg_comport->lcr, 0x03); /* 8 data, 1 stop, no parity */
out_8(&udbg_comport->mcr, 0x03); /* RTS/DTR */
out_8(&udbg_comport->fcr ,0x07); /* Clear & enable FIFOs */
}
}
......@@ -83,7 +90,8 @@ void udbg_init_uart(void *comport, unsigned int speed)
#define SCC_TXRDY 4
#define SCC_RXRDY 1
static volatile u8 *sccc, *sccd;
static volatile u8 __iomem *sccc;
static volatile u8 __iomem *sccd;
static unsigned char scc_inittab[] = {
13, 0, /* set baud rate divisor */
......@@ -122,7 +130,7 @@ void udbg_init_scc(struct device_node *np)
/* Setup for 57600 8N1 */
addr += 0x20;
sccc = (volatile u8 *) ioremap(addr & PAGE_MASK, PAGE_SIZE) ;
sccc = (volatile u8 * __iomem) ioremap(addr & PAGE_MASK, PAGE_SIZE) ;
sccc += addr & ~PAGE_MASK;
sccd = sccc + 0x10;
......@@ -130,13 +138,11 @@ void udbg_init_scc(struct device_node *np)
mb();
for (i = 20000; i != 0; --i)
x = *sccc; eieio();
*sccc = 9; eieio(); /* reset A or B side */
*sccc = 0xc0; eieio();
for (i = 0; i < sizeof(scc_inittab); ++i) {
*sccc = scc_inittab[i];
eieio();
}
x = in_8(sccc);
out_8(sccc, 0x09); /* reset A or B side */
out_8(sccc, 0xc0);
for (i = 0; i < sizeof(scc_inittab); ++i)
out_8(sccc, scc_inittab[i]);
ppc_md.udbg_putc = udbg_putc;
ppc_md.udbg_getc = udbg_getc;
......@@ -148,9 +154,6 @@ void udbg_init_scc(struct device_node *np)
#endif /* CONFIG_PPC_PMAC */
#if CONFIG_PPC_PMAC
extern u8 real_readb(volatile u8 *addr);
extern void real_writeb(u8 data, volatile u8 *addr);
static void udbg_real_putc(unsigned char c)
{
while ((real_readb(sccc) & SCC_TXRDY) == 0)
......@@ -162,8 +165,8 @@ static void udbg_real_putc(unsigned char c)
void udbg_init_pmac_realmode(void)
{
sccc = (volatile u8 *)0x80013020ul;
sccd = (volatile u8 *)0x80013030ul;
sccc = (volatile u8 __iomem *)0x80013020ul;
sccd = (volatile u8 __iomem *)0x80013030ul;
ppc_md.udbg_putc = udbg_real_putc;
ppc_md.udbg_getc = NULL;
......@@ -171,25 +174,50 @@ void udbg_init_pmac_realmode(void)
}
#endif /* CONFIG_PPC_PMAC */
void udbg_putc(unsigned char c)
#ifdef CONFIG_PPC_MAPLE
void udbg_maple_real_putc(unsigned char c)
{
if (udbg_comport) {
while ((udbg_comport->lsr & LSR_THRE) == 0)
while ((real_readb(&udbg_comport->lsr) & LSR_THRE) == 0)
/* wait for idle */;
udbg_comport->thr = c; eieio();
real_writeb(c, &udbg_comport->thr); eieio();
if (c == '\n') {
/* Also put a CR. This is for convenience. */
while ((udbg_comport->lsr & LSR_THRE) == 0)
while ((real_readb(&udbg_comport->lsr) & LSR_THRE) == 0)
/* wait for idle */;
udbg_comport->thr = '\r'; eieio();
real_writeb('\r', &udbg_comport->thr); eieio();
}
}
}
void udbg_init_maple_realmode(void)
{
udbg_comport = (volatile struct NS16550 __iomem *)0xf40003f8;
ppc_md.udbg_putc = udbg_maple_real_putc;
ppc_md.udbg_getc = NULL;
ppc_md.udbg_getc_poll = NULL;
}
#endif /* CONFIG_PPC_MAPLE */
void udbg_putc(unsigned char c)
{
if (udbg_comport) {
while ((in_8(&udbg_comport->lsr) & LSR_THRE) == 0)
/* wait for idle */;
out_8(&udbg_comport->thr, c);
if (c == '\n') {
/* Also put a CR. This is for convenience. */
while ((in_8(&udbg_comport->lsr) & LSR_THRE) == 0)
/* wait for idle */;
out_8(&udbg_comport->thr, '\r');
}
}
#ifdef CONFIG_PPC_PMAC
else if (sccc) {
while ((*sccc & SCC_TXRDY) == 0)
eieio();
*sccd = c;
eieio();
while ((in_8(sccc) & SCC_TXRDY) == 0)
;
out_8(sccd, c);
if (c == '\n')
udbg_putc('\r');
}
......@@ -199,16 +227,15 @@ void udbg_putc(unsigned char c)
int udbg_getc_poll(void)
{
if (udbg_comport) {
if ((udbg_comport->lsr & LSR_DR) != 0)
return udbg_comport->rbr;
if ((in_8(&udbg_comport->lsr) & LSR_DR) != 0)
return in_8(&udbg_comport->rbr);
else
return -1;
}
#ifdef CONFIG_PPC_PMAC
else if (sccc) {
eieio();
if ((*sccc & SCC_RXRDY) != 0)
return *sccd;
if ((in_8(sccc) & SCC_RXRDY) != 0)
return in_8(sccd);
else
return -1;
}
......@@ -219,16 +246,15 @@ int udbg_getc_poll(void)
unsigned char udbg_getc(void)
{
if (udbg_comport) {
while ((udbg_comport->lsr & LSR_DR) == 0)
while ((in_8(&udbg_comport->lsr) & LSR_DR) == 0)
/* wait for char */;
return udbg_comport->rbr;
return in_8(&udbg_comport->rbr);
}
#ifdef CONFIG_PPC_PMAC
else if (sccc) {
eieio();
while ((*sccc & SCC_RXRDY) == 0)
eieio();
return *sccd;
while ((in_8(sccc) & SCC_RXRDY) == 0)
;
return in_8(sccd);
}
#endif /* CONFIG_PPC_PMAC */
return 0;
......
......@@ -263,7 +263,7 @@ emulate_altivec(struct pt_regs *regs)
unsigned int va, vb, vc, vd;
vector128 *vrs;
if (get_user(instr, (unsigned int *) regs->nip))
if (get_user(instr, (unsigned int __user *) regs->nip))
return -EFAULT;
if ((instr >> 26) != 4)
return -EINVAL; /* not an altivec instruction */
......
......@@ -85,7 +85,7 @@ struct xics_ipl {
} qirr;
};
static struct xics_ipl *xics_per_cpu[NR_CPUS];
static struct xics_ipl __iomem *xics_per_cpu[NR_CPUS];
static int xics_irq_8259_cascade = 0;
static int xics_irq_8259_cascade_real = 0;
......@@ -116,22 +116,22 @@ typedef struct {
static int pSeries_xirr_info_get(int n_cpu)
{
return xics_per_cpu[n_cpu]->xirr.word;
return in_be32(&xics_per_cpu[n_cpu]->xirr.word);
}
static void pSeries_xirr_info_set(int n_cpu, int value)
{
xics_per_cpu[n_cpu]->xirr.word = value;
out_be32(&xics_per_cpu[n_cpu]->xirr.word, value);
}
static void pSeries_cppr_info(int n_cpu, u8 value)
{
xics_per_cpu[n_cpu]->xirr.bytes[0] = value;
out_8(&xics_per_cpu[n_cpu]->xirr.bytes[0], value);
}
static void pSeries_qirr_info(int n_cpu, u8 value)
{
xics_per_cpu[n_cpu]->qirr.bytes[0] = value;
out_8(&xics_per_cpu[n_cpu]->qirr.bytes[0], value);
}
static xics_ops pSeries_ops = {
......@@ -457,7 +457,7 @@ void xics_init_IRQ(void)
struct xics_interrupt_node {
unsigned long addr;
unsigned long size;
} inodes[NR_CPUS];
} intnodes[NR_CPUS];
ppc64_boot_msg(0x20, "XICS Init");
......@@ -484,13 +484,13 @@ void xics_init_IRQ(void)
panic("xics_init_IRQ: can't find interrupt reg property");
while (ilen) {
inodes[indx].addr = (unsigned long long)*ireg++ << 32;
intnodes[indx].addr = (unsigned long)*ireg++ << 32;
ilen -= sizeof(uint);
inodes[indx].addr |= *ireg++;
intnodes[indx].addr |= *ireg++;
ilen -= sizeof(uint);
inodes[indx].size = (unsigned long long)*ireg++ << 32;
intnodes[indx].size = (unsigned long)*ireg++ << 32;
ilen -= sizeof(uint);
inodes[indx].size |= *ireg++;
intnodes[indx].size |= *ireg++;
ilen -= sizeof(uint);
indx++;
if (indx >= NR_CPUS) break;
......@@ -505,7 +505,8 @@ void xics_init_IRQ(void)
np = of_find_node_by_type(np, "cpu")) {
ireg = (uint *)get_property(np, "reg", &ilen);
if (ireg && ireg[0] == hard_smp_processor_id()) {
ireg = (uint *)get_property(np, "ibm,ppc-interrupt-gserver#s", &ilen);
ireg = (uint *)get_property(np, "ibm,ppc-interrupt-gserver#s",
&ilen);
i = ilen / sizeof(int);
if (ireg && i > 0) {
default_server = ireg[0];
......@@ -516,8 +517,8 @@ void xics_init_IRQ(void)
}
of_node_put(np);
intr_base = inodes[0].addr;
intr_size = (ulong)inodes[0].size;
intr_base = intnodes[0].addr;
intr_size = intnodes[0].size;
np = of_find_node_by_type(NULL, "interrupt-controller");
if (!np) {
......@@ -538,16 +539,18 @@ void xics_init_IRQ(void)
if (systemcfg->platform == PLATFORM_PSERIES) {
#ifdef CONFIG_SMP
for_each_cpu(i) {
int hard_id;
/* FIXME: Do this dynamically! --RR */
if (!cpu_present(i))
continue;
xics_per_cpu[i] = __ioremap((ulong)inodes[get_hard_smp_processor_id(i)].addr,
(ulong)inodes[get_hard_smp_processor_id(i)].size,
_PAGE_NO_CACHE);
hard_id = get_hard_smp_processor_id(i);
xics_per_cpu[i] = ioremap(intnodes[hard_id].addr,
intnodes[hard_id].size);
}
#else
xics_per_cpu[0] = __ioremap((ulong)intr_base, intr_size,
_PAGE_NO_CACHE);
xics_per_cpu[0] = ioremap(intr_base, intr_size);
#endif /* CONFIG_SMP */
} else if (systemcfg->platform == PLATFORM_PSERIES_LPAR) {
ops = &pSeriesLP_ops;
......
......@@ -874,14 +874,14 @@ void update_mmu_cache(struct vm_area_struct *vma, unsigned long ea,
local_irq_restore(flags);
}
void * reserve_phb_iospace(unsigned long size)
void __iomem * reserve_phb_iospace(unsigned long size)
{
void *virt_addr;
void __iomem *virt_addr;
if (phbs_io_bot >= IMALLOC_BASE)
panic("reserve_phb_iospace(): phb io space overflow\n");
virt_addr = (void *) phbs_io_bot;
virt_addr = (void __iomem *) phbs_io_bot;
phbs_io_bot += size;
return virt_addr;
......
......@@ -2001,13 +2001,6 @@ serial8250_register_ports(struct uart_driver *drv, struct device *dev)
for (i = 0; i < UART_NR; i++) {
struct uart_8250_port *up = &serial8250_ports[i];
/* Don't register "empty" ports, setting "ops" on them
* makes the console driver "setup" routine to succeed,
* which is wrong. --BenH.
*/
if (!up->port.iobase)
continue;
up->port.line = i;
up->port.ops = &serial8250_pops;
up->port.dev = dev;
......
......@@ -205,7 +205,7 @@ extern void __iomem *ioremap(unsigned long address, unsigned long size);
#define ioremap_nocache(addr, size) ioremap((addr), (size))
extern int iounmap_explicit(volatile void __iomem *addr, unsigned long size);
extern void iounmap(volatile void __iomem *addr);
extern void * reserve_phb_iospace(unsigned long size);
extern void __iomem * reserve_phb_iospace(unsigned long size);
/**
* virt_to_phys - map virtual addresses to physical
......
......@@ -111,9 +111,17 @@ extern void iommu_setup_pSeries(void);
extern void iommu_setup_u3(void);
/* Creates table for an individual device node */
/* XXX: This isn't generic, please name it accordingly or add
* some ppc_md. hooks for iommu implementations to do what they
* need to do. --BenH.
*/
extern void iommu_devnode_init(struct device_node *dn);
/* Frees table for an individual device node */
/* XXX: This isn't generic, please name it accordingly or add
* some ppc_md. hooks for iommu implementations to do what they
* need to do. --BenH.
*/
extern void iommu_free_table(struct device_node *dn);
#endif /* CONFIG_PPC_MULTIPLATFORM */
......
......@@ -389,6 +389,7 @@
#define PLATFORM_ISERIES_LPAR 0x0201
#define PLATFORM_LPAR 0x0001
#define PLATFORM_POWERMAC 0x0400
#define PLATFORM_MAPLE 0x0500
/* Compatibility with drivers coming from PPC32 world */
#define _machine (systemcfg->platform)
......
#ifndef __UDBG_HDR
#define __UDBG_HDR
#include <linux/compiler.h>
/*
* c 2001 PPC 64 Team, IBM Corp
*
......@@ -10,7 +12,7 @@
* 2 of the License, or (at your option) any later version.
*/
void udbg_init_uart(void *comport, unsigned int speed);
void udbg_init_uart(void __iomem *comport, unsigned int speed);
void udbg_putc(unsigned char c);
unsigned char udbg_getc(void);
int udbg_getc_poll(void);
......
......@@ -38,6 +38,12 @@ void __ptrace_link(task_t *child, task_t *new_parent)
SET_LINKS(child);
}
static inline int pending_resume_signal(struct sigpending *pending)
{
#define M(sig) (1UL << ((sig)-1))
return sigtestsetmask(&pending->signal, M(SIGCONT) | M(SIGKILL));
}
/*
* unptrace a task: move it back to its original parent and
* remove it from the ptrace list.
......@@ -61,8 +67,16 @@ void __ptrace_unlink(task_t *child)
* Turn a tracing stop into a normal stop now,
* since with no tracer there would be no way
* to wake it up with SIGCONT or SIGKILL.
* If there was a signal sent that would resume the child,
* but didn't because it was in TASK_TRACED, resume it now.
*/
spin_lock(&child->sighand->siglock);
child->state = TASK_STOPPED;
if (pending_resume_signal(&child->pending) ||
pending_resume_signal(&child->signal->shared_pending)) {
signal_wake_up(child, 1);
}
spin_unlock(&child->sighand->siglock);
}
}
......
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