Commit fe691021 authored by Linus Torvalds's avatar Linus Torvalds
parents f30ac319 7d4d6154
......@@ -880,6 +880,10 @@ address which can extend beyond that limit.
- device_type : Should be "soc"
- ranges : Should be defined as specified in 1) to describe the
translation of SOC addresses for memory mapped SOC registers.
- bus-frequency: Contains the bus frequency for the SOC node.
Typically, the value of this field is filled in by the boot
loader.
Recommended properties:
......@@ -919,6 +923,7 @@ SOC.
device_type = "soc";
ranges = <00000000 e0000000 00100000>
reg = <e0000000 00003000>;
bus-frequency = <0>;
}
......@@ -1170,6 +1175,8 @@ platforms are moved over to use the flattened-device-tree model.
mdio@24520 {
reg = <24520 20>;
device_type = "mdio";
compatible = "gianfar";
ethernet-phy@0 {
......
......@@ -1317,6 +1324,7 @@ not necessary as they are usually the same as the root node.
device_type = "soc";
ranges = <00000000 e0000000 00100000>
reg = <e0000000 00003000>;
bus-frequency = <0>;
mdio@24520 {
reg = <24520 20>;
......
......@@ -66,7 +66,7 @@ _GLOBAL(load_up_fpu)
#else
ld r4,PACACURRENT(r13)
addi r5,r4,THREAD /* Get THREAD */
ld r4,THREAD_FPEXC_MODE(r5)
lwz r4,THREAD_FPEXC_MODE(r5)
ori r12,r12,MSR_FP
or r12,r12,r4
std r12,_MSR(r1)
......
......@@ -749,11 +749,12 @@ iSeries_secondary_smp_loop:
.globl decrementer_iSeries_masked
decrementer_iSeries_masked:
/* We may not have a valid TOC pointer in here. */
li r11,1
ld r12,PACALPPACAPTR(r13)
stb r11,LPPACADECRINT(r12)
LOAD_REG_ADDRBASE(r12,tb_ticks_per_jiffy)
lwz r12,ADDROFF(tb_ticks_per_jiffy)(r12)
LOAD_REG_IMMEDIATE(r12, tb_ticks_per_jiffy)
lwz r12,0(r12)
mtspr SPRN_DEC,r12
/* fall through */
......
......@@ -334,9 +334,6 @@ int iommu_map_sg(struct device *dev, struct iommu_table *tbl,
spin_unlock_irqrestore(&(tbl->it_lock), flags);
/* Make sure updates are seen by hardware */
mb();
DBG("mapped %d elements:\n", outcount);
/* For the sake of iommu_unmap_sg, we clear out the length in the
......@@ -347,6 +344,10 @@ int iommu_map_sg(struct device *dev, struct iommu_table *tbl,
outs->dma_address = DMA_ERROR_CODE;
outs->dma_length = 0;
}
/* Make sure updates are seen by hardware */
mb();
return outcount;
failure:
......@@ -358,6 +359,8 @@ int iommu_map_sg(struct device *dev, struct iommu_table *tbl,
npages = (PAGE_ALIGN(s->dma_address + s->dma_length) - vaddr)
>> PAGE_SHIFT;
__iommu_free(tbl, vaddr, npages);
s->dma_address = DMA_ERROR_CODE;
s->dma_length = 0;
}
}
spin_unlock_irqrestore(&(tbl->it_lock), flags);
......
......@@ -491,7 +491,12 @@ void __init finish_device_tree(void)
size = 16;
finish_node(allnodes, &size, 1);
size -= 16;
end = start = (unsigned long) __va(lmb_alloc(size, 128));
if (0 == size)
end = start = 0;
else
end = start = (unsigned long)__va(lmb_alloc(size, 128));
finish_node(allnodes, &end, 0);
BUG_ON(end != start + size);
......@@ -1398,8 +1403,8 @@ struct device_node *of_find_node_by_name(struct device_node *from,
read_lock(&devtree_lock);
np = from ? from->allnext : allnodes;
for (; np != 0; np = np->allnext)
if (np->name != 0 && strcasecmp(np->name, name) == 0
for (; np != NULL; np = np->allnext)
if (np->name != NULL && strcasecmp(np->name, name) == 0
&& of_node_get(np))
break;
if (from)
......@@ -1917,3 +1922,30 @@ int prom_update_property(struct device_node *np,
return 0;
}
#ifdef CONFIG_KEXEC
/* We may have allocated the flat device tree inside the crash kernel region
* in prom_init. If so we need to move it out into regular memory. */
void kdump_move_device_tree(void)
{
unsigned long start, end;
struct boot_param_header *new;
start = __pa((unsigned long)initial_boot_params);
end = start + initial_boot_params->totalsize;
if (end < crashk_res.start || start > crashk_res.end)
return;
new = (struct boot_param_header*)
__va(lmb_alloc(initial_boot_params->totalsize, PAGE_SIZE));
memcpy(new, initial_boot_params, initial_boot_params->totalsize);
initial_boot_params = new;
DBG("Flat device tree blob moved to %p\n", initial_boot_params);
/* XXX should we unreserve the old DT? */
}
#endif /* CONFIG_KEXEC */
......@@ -2098,6 +2098,10 @@ unsigned long __init prom_init(unsigned long r3, unsigned long r4,
*/
prom_init_stdout();
/* Bail if this is a kdump kernel. */
if (PHYSICAL_START > 0)
prom_panic("Error: You can't boot a kdump kernel from OF!\n");
/*
* Check for an initrd
*/
......
......@@ -465,8 +465,10 @@ u32 *of_get_pci_address(struct device_node *dev, int bar_no, u64 *size,
if (parent == NULL)
return NULL;
bus = of_match_bus(parent);
if (strcmp(bus->name, "pci"))
if (strcmp(bus->name, "pci")) {
of_node_put(parent);
return NULL;
}
bus->count_cells(dev, &na, &ns);
of_node_put(parent);
if (!OF_CHECK_COUNTS(na, ns))
......
......@@ -22,6 +22,7 @@
#include <asm/prom.h>
#include <asm/rtas.h>
#include <asm/hvcall.h>
#include <asm/semaphore.h>
#include <asm/machdep.h>
#include <asm/page.h>
......@@ -565,6 +566,7 @@ static int ibm_suspend_me_token = RTAS_UNKNOWN_SERVICE;
#ifdef CONFIG_PPC_PSERIES
static void rtas_percpu_suspend_me(void *info)
{
int i;
long rc;
long flags;
struct rtas_suspend_me_data *data =
......@@ -587,18 +589,16 @@ static void rtas_percpu_suspend_me(void *info)
if (rc == H_Continue) {
data->waiting = 0;
rtas_call(ibm_suspend_me_token, 0, 1,
data->args->args);
data->args->args[data->args->nargs] =
rtas_call(ibm_suspend_me_token, 0, 1, NULL);
for_each_cpu(i)
plpar_hcall_norets(H_PROD,i);
} else {
data->waiting = -EBUSY;
printk(KERN_ERR "Error on H_Join hypervisor call\n");
}
out:
/* before we restore interrupts, make sure we don't
* generate a spurious soft lockup errors
*/
touch_softlockup_watchdog();
local_irq_restore(flags);
return;
}
......
......@@ -672,7 +672,6 @@ static void rtas_flash_firmware(int reboot_type)
static void remove_flash_pde(struct proc_dir_entry *dp)
{
if (dp) {
if (dp->data != NULL)
kfree(dp->data);
dp->owner = NULL;
remove_proc_entry(dp->name, dp->parent);
......
......@@ -398,6 +398,9 @@ void __init setup_system(void)
{
DBG(" -> setup_system()\n");
#ifdef CONFIG_KEXEC
kdump_move_device_tree();
#endif
/*
* Unflatten the device-tree passed by prom_init or kexec
*/
......
......@@ -540,6 +540,9 @@ int __devinit start_secondary(void *unused)
if (smp_ops->take_timebase)
smp_ops->take_timebase();
if (system_state > SYSTEM_BOOTING)
per_cpu(last_jiffy, cpu) = get_tb();
spin_lock(&call_lock);
cpu_set(cpu, cpu_online_map);
spin_unlock(&call_lock);
......
......@@ -612,10 +612,10 @@ void __init generic_calibrate_decr(void)
ppc_tb_freq = DEFAULT_TB_FREQ; /* hardcoded default */
node_found = 0;
if (cpu != 0) {
if (cpu) {
fp = (unsigned int *)get_property(cpu, "timebase-frequency",
NULL);
if (fp != 0) {
if (fp) {
node_found = 1;
ppc_tb_freq = *fp;
}
......@@ -626,10 +626,10 @@ void __init generic_calibrate_decr(void)
ppc_proc_freq = DEFAULT_PROC_FREQ;
node_found = 0;
if (cpu != 0) {
if (cpu) {
fp = (unsigned int *)get_property(cpu, "clock-frequency",
NULL);
if (fp != 0) {
if (fp) {
node_found = 1;
ppc_proc_freq = *fp;
}
......
......@@ -144,7 +144,7 @@ unsigned int udbg_probe_uart_speed(void __iomem *comport, unsigned int clock)
}
#ifdef CONFIG_PPC_MAPLE
void udbg_maple_real_putc(unsigned char c)
void udbg_maple_real_putc(char c)
{
if (udbg_comport) {
while ((real_readb(&udbg_comport->lsr) & LSR_THRE) == 0)
......
......@@ -197,6 +197,8 @@ long __init lmb_reserve(unsigned long base, unsigned long size)
{
struct lmb_region *_rgn = &(lmb.reserved);
BUG_ON(0 == size);
return lmb_add_region(_rgn, base, size);
}
......@@ -227,6 +229,8 @@ unsigned long __init lmb_alloc_base(unsigned long size, unsigned long align,
long i, j;
unsigned long base = 0;
BUG_ON(0 == size);
#ifdef CONFIG_PPC32
/* On 32-bit, make sure we allocate lowmem */
if (max_addr == LMB_ALLOC_ANYWHERE)
......
......@@ -435,17 +435,12 @@ void clear_user_page(void *page, unsigned long vaddr, struct page *pg)
{
clear_page(page);
if (cpu_has_feature(CPU_FTR_COHERENT_ICACHE))
return;
/*
* We shouldnt have to do this, but some versions of glibc
* require it (ld.so assumes zero filled pages are icache clean)
* - Anton
*/
/* avoid an atomic op if possible */
if (test_bit(PG_arch_1, &pg->flags))
clear_bit(PG_arch_1, &pg->flags);
flush_dcache_page(pg);
}
EXPORT_SYMBOL(clear_user_page);
......@@ -469,12 +464,7 @@ void copy_user_page(void *vto, void *vfrom, unsigned long vaddr,
return;
#endif
if (cpu_has_feature(CPU_FTR_COHERENT_ICACHE))
return;
/* avoid an atomic op if possible */
if (test_bit(PG_arch_1, &pg->flags))
clear_bit(PG_arch_1, &pg->flags);
flush_dcache_page(pg);
}
void flush_icache_user_range(struct vm_area_struct *vma, struct page *page,
......
......@@ -2,7 +2,7 @@ obj-y += interrupt.o iommu.o setup.o spider-pic.o
obj-y += pervasive.o
obj-$(CONFIG_SMP) += smp.o
obj-$(CONFIG_SPU_FS) += spufs/ spu-base.o
obj-$(CONFIG_SPU_FS) += spu-base.o spufs/
spu-base-y += spu_base.o spu_priv1.o
......
......@@ -5,7 +5,6 @@
extern void chrp_nvram_init(void);
extern void chrp_get_rtc_time(struct rtc_time *);
extern int chrp_set_rtc_time(struct rtc_time *);
extern void chrp_calibrate_decr(void);
extern long chrp_time_init(void);
extern void chrp_find_bridges(void);
......
......@@ -204,9 +204,11 @@ static void __init setup_peg2(struct pci_controller *hose, struct device_node *d
struct device_node *root = find_path_device("/");
struct device_node *rtas;
of_node_get(root);
rtas = of_find_node_by_name (root, "rtas");
if (rtas) {
hose->ops = &rtas_pci_ops;
of_node_put(rtas);
} else {
printk ("RTAS supporting Pegasos OF not found, please upgrade"
" your firmware\n");
......
......@@ -506,7 +506,7 @@ void __init chrp_init(void)
ppc_md.halt = rtas_halt;
ppc_md.time_init = chrp_time_init;
ppc_md.calibrate_decr = chrp_calibrate_decr;
ppc_md.calibrate_decr = generic_calibrate_decr;
/* this may get overridden with rtas routines later... */
ppc_md.set_rtc_time = chrp_set_rtc_time;
......
......@@ -167,24 +167,3 @@ void chrp_get_rtc_time(struct rtc_time *tm)
tm->tm_mon = mon;
tm->tm_year = year;
}
void __init chrp_calibrate_decr(void)
{
struct device_node *cpu;
unsigned int freq, *fp;
/*
* The cpu node should have a timebase-frequency property
* to tell us the rate at which the decrementer counts.
*/
freq = 16666000; /* hardcoded default */
cpu = find_type_devices("cpu");
if (cpu != 0) {
fp = (unsigned int *)
get_property(cpu, "timebase-frequency", NULL);
if (fp != 0)
freq = *fp;
}
ppc_tb_freq = freq;
}
......@@ -585,7 +585,7 @@ static int pSeries_pci_probe_mode(struct pci_bus *bus)
static void pseries_kexec_cpu_down(int crash_shutdown, int secondary)
{
/* Don't risk a hypervisor call if we're crashing */
if (!crash_shutdown) {
if (firmware_has_feature(FW_FEATURE_SPLPAR) && !crash_shutdown) {
unsigned long vpa = __pa(get_lppaca());
if (unregister_vpa(hard_smp_processor_id(), vpa)) {
......
......@@ -810,13 +810,16 @@ initial_mmu:
mtspr SPRN_MD_TWC, r9
li r11, MI_BOOTINIT /* Create RPN for address 0 */
addis r11, r11, 0x0080 /* Add 8M */
mtspr SPRN_MD_RPN, r8
mtspr SPRN_MD_RPN, r11
addi r10, r10, 0x0100
mtspr SPRN_MD_CTR, r10
addis r8, r8, 0x0080 /* Add 8M */
mtspr SPRN_MD_EPN, r8
mtspr SPRN_MD_TWC, r9
addis r11, r11, 0x0080 /* Add 8M */
mtspr SPRN_MD_RPN, r8
mtspr SPRN_MD_RPN, r11
#endif
/* Since the cache is enabled according to the information we
......
......@@ -33,6 +33,7 @@
#include <linux/reboot.h>
#include <linux/device.h>
#include <linux/platform_device.h>
#include <linux/mutex.h>
#include "windfarm.h"
......@@ -48,7 +49,7 @@
static LIST_HEAD(wf_controls);
static LIST_HEAD(wf_sensors);
static DECLARE_MUTEX(wf_lock);
static DEFINE_MUTEX(wf_lock);
static struct notifier_block *wf_client_list;
static int wf_client_count;
static unsigned int wf_overtemp;
......@@ -160,12 +161,12 @@ int wf_register_control(struct wf_control *new_ct)
{
struct wf_control *ct;
down(&wf_lock);
mutex_lock(&wf_lock);
list_for_each_entry(ct, &wf_controls, link) {
if (!strcmp(ct->name, new_ct->name)) {
printk(KERN_WARNING "windfarm: trying to register"
" duplicate control %s\n", ct->name);
up(&wf_lock);
mutex_unlock(&wf_lock);
return -EEXIST;
}
}
......@@ -175,7 +176,7 @@ int wf_register_control(struct wf_control *new_ct)
DBG("wf: Registered control %s\n", new_ct->name);
wf_notify(WF_EVENT_NEW_CONTROL, new_ct);
up(&wf_lock);
mutex_unlock(&wf_lock);
return 0;
}
......@@ -183,9 +184,9 @@ EXPORT_SYMBOL_GPL(wf_register_control);
void wf_unregister_control(struct wf_control *ct)
{
down(&wf_lock);
mutex_lock(&wf_lock);
list_del(&ct->link);
up(&wf_lock);
mutex_unlock(&wf_lock);
DBG("wf: Unregistered control %s\n", ct->name);
......@@ -197,16 +198,16 @@ struct wf_control * wf_find_control(const char *name)
{
struct wf_control *ct;
down(&wf_lock);
mutex_lock(&wf_lock);
list_for_each_entry(ct, &wf_controls, link) {
if (!strcmp(ct->name, name)) {
if (wf_get_control(ct))
ct = NULL;
up(&wf_lock);
mutex_unlock(&wf_lock);
return ct;
}
}
up(&wf_lock);
mutex_unlock(&wf_lock);
return NULL;
}
EXPORT_SYMBOL_GPL(wf_find_control);
......@@ -250,12 +251,12 @@ int wf_register_sensor(struct wf_sensor *new_sr)
{
struct wf_sensor *sr;
down(&wf_lock);
mutex_lock(&wf_lock);
list_for_each_entry(sr, &wf_sensors, link) {
if (!strcmp(sr->name, new_sr->name)) {
printk(KERN_WARNING "windfarm: trying to register"
" duplicate sensor %s\n", sr->name);
up(&wf_lock);
mutex_unlock(&wf_lock);
return -EEXIST;
}
}
......@@ -265,7 +266,7 @@ int wf_register_sensor(struct wf_sensor *new_sr)
DBG("wf: Registered sensor %s\n", new_sr->name);
wf_notify(WF_EVENT_NEW_SENSOR, new_sr);
up(&wf_lock);
mutex_unlock(&wf_lock);
return 0;
}
......@@ -273,9 +274,9 @@ EXPORT_SYMBOL_GPL(wf_register_sensor);
void wf_unregister_sensor(struct wf_sensor *sr)
{
down(&wf_lock);
mutex_lock(&wf_lock);
list_del(&sr->link);
up(&wf_lock);
mutex_unlock(&wf_lock);
DBG("wf: Unregistered sensor %s\n", sr->name);
......@@ -287,16 +288,16 @@ struct wf_sensor * wf_find_sensor(const char *name)
{
struct wf_sensor *sr;
down(&wf_lock);
mutex_lock(&wf_lock);
list_for_each_entry(sr, &wf_sensors, link) {
if (!strcmp(sr->name, name)) {
if (wf_get_sensor(sr))
sr = NULL;
up(&wf_lock);
mutex_unlock(&wf_lock);
return sr;
}
}
up(&wf_lock);
mutex_unlock(&wf_lock);
return NULL;
}
EXPORT_SYMBOL_GPL(wf_find_sensor);
......@@ -329,7 +330,7 @@ int wf_register_client(struct notifier_block *nb)
struct wf_control *ct;
struct wf_sensor *sr;
down(&wf_lock);
mutex_lock(&wf_lock);
rc = notifier_chain_register(&wf_client_list, nb);
if (rc != 0)
goto bail;
......@@ -341,19 +342,19 @@ int wf_register_client(struct notifier_block *nb)
if (wf_client_count == 1)
wf_start_thread();
bail:
up(&wf_lock);
mutex_unlock(&wf_lock);
return rc;
}
EXPORT_SYMBOL_GPL(wf_register_client);
int wf_unregister_client(struct notifier_block *nb)
{
down(&wf_lock);
mutex_lock(&wf_lock);
notifier_chain_unregister(&wf_client_list, nb);
wf_client_count++;
if (wf_client_count == 0)
wf_stop_thread();
up(&wf_lock);
mutex_unlock(&wf_lock);
return 0;
}
......@@ -361,23 +362,23 @@ EXPORT_SYMBOL_GPL(wf_unregister_client);
void wf_set_overtemp(void)
{
down(&wf_lock);
mutex_lock(&wf_lock);
wf_overtemp++;
if (wf_overtemp == 1) {
printk(KERN_WARNING "windfarm: Overtemp condition detected !\n");
wf_overtemp_counter = 0;
wf_notify(WF_EVENT_OVERTEMP, NULL);
}
up(&wf_lock);
mutex_unlock(&wf_lock);
}
EXPORT_SYMBOL_GPL(wf_set_overtemp);
void wf_clear_overtemp(void)
{
down(&wf_lock);
mutex_lock(&wf_lock);
WARN_ON(wf_overtemp == 0);
if (wf_overtemp == 0) {
up(&wf_lock);
mutex_unlock(&wf_lock);
return;
}
wf_overtemp--;
......@@ -385,7 +386,7 @@ void wf_clear_overtemp(void)
printk(KERN_WARNING "windfarm: Overtemp condition cleared !\n");
wf_notify(WF_EVENT_NORMALTEMP, NULL);
}
up(&wf_lock);
mutex_unlock(&wf_lock);
}
EXPORT_SYMBOL_GPL(wf_clear_overtemp);
......
......@@ -222,5 +222,7 @@ extern int of_address_to_resource(struct device_node *dev, int index,
extern int of_pci_address_to_resource(struct device_node *dev, int bar,
struct resource *r);
extern void kdump_move_device_tree(void);
#endif /* __KERNEL__ */
#endif /* _POWERPC_PROM_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