Commit 4fc60fac authored by Linus Torvalds's avatar Linus Torvalds

Merge bk://bk.arm.linux.org.uk/linux-2.6-rmk

into ppc970.osdl.org:/home/torvalds/v2.6/linux
parents 9c733a5a 03631415
......@@ -422,7 +422,7 @@ static inline void do_trap(int trapnr, int signr, char *str, int vm86,
asmlinkage void do_##name(struct pt_regs * regs, long error_code) \
{ \
if (notify_die(DIE_TRAP, str, regs, error_code, trapnr, signr) \
== NOTIFY_OK) \
== NOTIFY_STOP) \
return; \
do_trap(trapnr, signr, str, 0, regs, error_code, NULL); \
}
......@@ -436,7 +436,7 @@ asmlinkage void do_##name(struct pt_regs * regs, long error_code) \
info.si_code = sicode; \
info.si_addr = (void __user *)siaddr; \
if (notify_die(DIE_TRAP, str, regs, error_code, trapnr, signr) \
== NOTIFY_BAD) \
== NOTIFY_STOP) \
return; \
do_trap(trapnr, signr, str, 0, regs, error_code, &info); \
}
......@@ -445,7 +445,7 @@ asmlinkage void do_##name(struct pt_regs * regs, long error_code) \
asmlinkage void do_##name(struct pt_regs * regs, long error_code) \
{ \
if (notify_die(DIE_TRAP, str, regs, error_code, trapnr, signr) \
== NOTIFY_OK) \
== NOTIFY_STOP) \
return; \
do_trap(trapnr, signr, str, 1, regs, error_code, NULL); \
}
......
......@@ -41,7 +41,7 @@ disable_6xx_mmu:
/* Test for a 601 */
mfpvr r10
srwi r10,r10,16
cmpi 0,r10,1 /* 601 ? */
cmpwi 0,r10,1 /* 601 ? */
beq .clearbats_601
/* Clear BATs */
......@@ -117,9 +117,9 @@ _setup_L2CR:
/* Wait for the invalidation to complete */
mfspr r8,PVR
srwi r8,r8,16
cmpli cr0,r8,0x8000 /* 7450 */
cmpli cr1,r8,0x8001 /* 7455 */
cmpli cr2,r8,0x8002 /* 7457 */
cmplwi cr0,r8,0x8000 /* 7450 */
cmplwi cr1,r8,0x8001 /* 7455 */
cmplwi cr2,r8,0x8002 /* 7457 */
cror 4*cr0+eq,4*cr0+eq,4*cr1+eq /* Now test if any are true. */
cror 4*cr0+eq,4*cr0+eq,4*cr2+eq
bne 2f
......@@ -190,7 +190,7 @@ timebase_period_ns:
udelay:
mfspr r4,PVR
srwi r4,r4,16
cmpi 0,r4,1 /* 601 ? */
cmpwi 0,r4,1 /* 601 ? */
bne .udelay_not_601
00: li r0,86 /* Instructions / microsecond? */
mtctr r0
......@@ -213,16 +213,16 @@ udelay:
1: mftbu r5
mftb r6
mftbu r7
cmp 0,r5,r7
cmpw 0,r5,r7
bne 1b /* Get [synced] base time */
addc r9,r6,r4 /* Compute end time */
addze r8,r5
2: mftbu r5
cmp 0,r5,r8
cmpw 0,r5,r8
blt 2b
bgt 3f
mftb r6
cmp 0,r6,r9
cmpw 0,r6,r9
blt 2b
3: blr
......
......@@ -16,7 +16,7 @@
setup_bats:
mfpvr 5
rlwinm 5,5,16,16,31 /* r3 = 1 for 601, 4 for 604 */
cmpi 0,5,1
cmpwi 0,5,1
li 0,0
bne 4f
mtibatl 3,0 /* invalidate BAT first */
......
......@@ -96,7 +96,7 @@ decompress_kernel(unsigned long load_addr, int num_words, unsigned long cksum)
#endif
char *cp;
struct bi_record *rec;
unsigned long initrd_loc, TotalMemory = 0;
unsigned long initrd_loc = 0, TotalMemory = 0;
#ifdef CONFIG_SERIAL_8250_CONSOLE
com_port = serial_init(0, NULL);
......
......@@ -50,7 +50,7 @@ relocate:
* Check if we need to relocate ourselves to the link addr or were
* we loaded there to begin with.
*/
cmp cr0,r3,r4
cmpw cr0,r3,r4
beq start_ldr /* If 0, we don't need to relocate */
/* Move this code somewhere safe. This is max(load + size, end)
......@@ -122,7 +122,7 @@ do_relocate:
GETSYM(r4, start)
mr r3,r8 /* Get the load addr */
cmp cr0,r4,r3 /* If we need to copy from the end, do so */
cmpw cr0,r4,r3 /* If we need to copy from the end, do so */
bgt do_relocate_from_end
do_relocate_from_start:
......@@ -165,7 +165,7 @@ start_ldr:
subi r4,r4,4
li r0,0
50: stwu r0,4(r3)
cmp cr0,r3,r4
cmpw cr0,r3,r4
bne 50b
90: mr r9,r1 /* Save old stack pointer (in case it matters) */
lis r1,.stack@h
......
......@@ -172,9 +172,9 @@ END_FTR_SECTION_IFCLR(CPU_FTR_NO_DPM)
setup_750cx:
mfspr r10, SPRN_HID1
rlwinm r10,r10,4,28,31
cmpi cr0,r10,7
cmpi cr1,r10,9
cmpi cr2,r10,11
cmpwi cr0,r10,7
cmpwi cr1,r10,9
cmpwi cr2,r10,11
cror 4*cr0+eq,4*cr0+eq,4*cr1+eq
cror 4*cr0+eq,4*cr0+eq,4*cr2+eq
bnelr
......@@ -287,12 +287,12 @@ _GLOBAL(__save_cpu_setup)
/* Now deal with CPU type dependent registers */
mfspr r3,PVR
srwi r3,r3,16
cmpli cr0,r3,0x8000 /* 7450 */
cmpli cr1,r3,0x000c /* 7400 */
cmpli cr2,r3,0x800c /* 7410 */
cmpli cr3,r3,0x8001 /* 7455 */
cmpli cr4,r3,0x8002 /* 7457 */
cmpli cr5,r3,0x7000 /* 750FX */
cmplwi cr0,r3,0x8000 /* 7450 */
cmplwi cr1,r3,0x000c /* 7400 */
cmplwi cr2,r3,0x800c /* 7410 */
cmplwi cr3,r3,0x8001 /* 7455 */
cmplwi cr4,r3,0x8002 /* 7457 */
cmplwi cr5,r3,0x7000 /* 750FX */
/* cr1 is 7400 || 7410 */
cror 4*cr1+eq,4*cr1+eq,4*cr2+eq
/* cr0 is 74xx */
......@@ -323,7 +323,7 @@ _GLOBAL(__save_cpu_setup)
/* If rev 2.x, backup HID2 */
mfspr r3,PVR
andi. r3,r3,0xff00
cmpi cr0,r3,0x0200
cmpwi cr0,r3,0x0200
bne 1f
mfspr r4,SPRN_HID2
stw r4,CS_HID2(r5)
......@@ -354,12 +354,12 @@ _GLOBAL(__restore_cpu_setup)
/* Now deal with CPU type dependent registers */
mfspr r3,PVR
srwi r3,r3,16
cmpli cr0,r3,0x8000 /* 7450 */
cmpli cr1,r3,0x000c /* 7400 */
cmpli cr2,r3,0x800c /* 7410 */
cmpli cr3,r3,0x8001 /* 7455 */
cmpli cr4,r3,0x8002 /* 7457 */
cmpli cr5,r3,0x7000 /* 750FX */
cmplwi cr0,r3,0x8000 /* 7450 */
cmplwi cr1,r3,0x000c /* 7400 */
cmplwi cr2,r3,0x800c /* 7410 */
cmplwi cr3,r3,0x8001 /* 7455 */
cmplwi cr4,r3,0x8002 /* 7457 */
cmplwi cr5,r3,0x7000 /* 750FX */
/* cr1 is 7400 || 7410 */
cror 4*cr1+eq,4*cr1+eq,4*cr2+eq
/* cr0 is 74xx */
......@@ -412,7 +412,7 @@ _GLOBAL(__restore_cpu_setup)
/* If rev 2.x, restore HID2 with low voltage bit cleared */
mfspr r3,PVR
andi. r3,r3,0xff00
cmpi cr0,r3,0x0200
cmpwi cr0,r3,0x0200
bne 4f
lwz r4,CS_HID2(r5)
rlwinm r4,r4,0,19,17
......@@ -426,7 +426,7 @@ _GLOBAL(__restore_cpu_setup)
mftbl r5
3: mftbl r6
sub r6,r6,r5
cmpli cr0,r6,10000
cmplwi cr0,r6,10000
ble 3b
/* Setup final PLL */
mtspr SPRN_HID1,r4
......
......@@ -206,7 +206,7 @@ _GLOBAL(DoSyscall)
andi. r11,r11,_TIF_SYSCALL_TRACE
bne- syscall_dotrace
syscall_dotrace_cont:
cmpli 0,r0,NR_syscalls
cmplwi 0,r0,NR_syscalls
lis r10,sys_call_table@h
ori r10,r10,sys_call_table@l
slwi r0,r0,2
......@@ -222,7 +222,7 @@ ret_from_syscall:
#endif
mr r6,r3
li r11,-_LAST_ERRNO
cmpl 0,r3,r11
cmplw 0,r3,r11
rlwinm r12,r1,0,0,18 /* current_thread_info() */
blt+ 30f
lwz r11,TI_LOCAL_FLAGS(r12)
......
......@@ -800,7 +800,7 @@ load_up_fpu:
tophys(r6,0) /* get __pa constant */
addis r3,r6,last_task_used_math@ha
lwz r4,last_task_used_math@l(r3)
cmpi 0,r4,0
cmpwi 0,r4,0
beq 1f
add r4,r4,r6
addi r4,r4,THREAD /* want last_task_used_math->thread */
......@@ -927,7 +927,7 @@ load_up_altivec:
tophys(r6,0)
addis r3,r6,last_task_used_altivec@ha
lwz r4,last_task_used_altivec@l(r3)
cmpi 0,r4,0
cmpwi 0,r4,0
beq 1f
add r4,r4,r6
addi r4,r4,THREAD /* want THREAD of last_task_used_altivec */
......@@ -992,11 +992,11 @@ giveup_altivec:
SYNC
MTMSRD(r5) /* enable use of AltiVec now */
isync
cmpi 0,r3,0
cmpwi 0,r3,0
beqlr- /* if no previous owner, done */
addi r3,r3,THREAD /* want THREAD of task */
lwz r5,PT_REGS(r3)
cmpi 0,r5,0
cmpwi 0,r5,0
SAVE_32VR(0, r4, r3)
mfvscr vr0
li r4,THREAD_VSCR
......@@ -1030,11 +1030,11 @@ giveup_fpu:
MTMSRD(r5) /* enable use of fpu now */
SYNC_601
isync
cmpi 0,r3,0
cmpwi 0,r3,0
beqlr- /* if no previous owner, done */
addi r3,r3,THREAD /* want THREAD of task */
lwz r5,PT_REGS(r3)
cmpi 0,r5,0
cmpwi 0,r5,0
SAVE_32FPRS(0, r3)
mffs fr0
stfd fr0,THREAD_FPSCR-4(r3)
......@@ -1539,7 +1539,7 @@ initial_bats:
#ifndef CONFIG_PPC64BRIDGE
mfspr r9,PVR
rlwinm r9,r9,16,16,31 /* r9 = 1 for 601, 4 for 604 */
cmpi 0,r9,1
cmpwi 0,r9,1
bne 4f
ori r11,r11,4 /* set up BAT registers for 601 */
li r8,0x7f /* valid, block length = 8MB */
......@@ -1591,7 +1591,7 @@ setup_disp_bat:
lwz r8,4(r8)
mfspr r9,PVR
rlwinm r9,r9,16,16,31 /* r9 = 1 for 601, 4 for 604 */
cmpi 0,r9,1
cmpwi 0,r9,1
beq 1f
mtspr DBAT3L,r8
mtspr DBAT3U,r11
......
......@@ -79,12 +79,12 @@ BEGIN_FTR_SECTION
/* Now check if user or arch enabled NAP mode */
lis r4,powersave_nap@ha
lwz r4,powersave_nap@l(r4)
cmpi 0,r4,0
cmpwi 0,r4,0
beq 1f
lis r3,HID0_NAP@h
1:
END_FTR_SECTION_IFSET(CPU_FTR_CAN_NAP)
cmpi 0,r3,0
cmpwi 0,r3,0
beqlr
/* Clear MSR:EE */
......@@ -133,7 +133,7 @@ BEGIN_FTR_SECTION
/* Go to low speed mode on some 750FX */
lis r4,powersave_lowspeed@ha
lwz r4,powersave_lowspeed@l(r4)
cmpi 0,r4,0
cmpwi 0,r4,0
beq 1f
mfspr r4,SPRN_HID1
oris r4,r4,0x0001
......
......@@ -56,7 +56,7 @@ END_FTR_SECTION_IFCLR(CPU_FTR_CAN_NAP)
/* Now check if user or arch enabled NAP mode */
lis r4,powersave_nap@ha
lwz r4,powersave_nap@l(r4)
cmpi 0,r4,0
cmpwi 0,r4,0
beqlr
/* Clear MSR:EE */
......
......@@ -214,7 +214,7 @@ _GLOBAL(low_choose_750fx_pll)
mtmsr r0
/* If switching to PLL1, disable HID0:BTIC */
cmpli cr0,r3,0
cmplwi cr0,r3,0
beq 1f
mfspr r5,HID0
rlwinm r5,r5,0,27,25
......@@ -239,7 +239,7 @@ _GLOBAL(low_choose_750fx_pll)
stw r4,nap_save_hid1@l(r6)
/* If switching to PLL0, enable HID0:BTIC */
cmpli cr0,r3,0
cmplwi cr0,r3,0
bne 1f
mfspr r5,HID0
ori r5,r5,HID0_BTIC
......@@ -470,7 +470,7 @@ _GLOBAL(_tlbia)
ori r9,r9,mmu_hash_lock@l
tophys(r9,r9)
10: lwarx r7,0,r9
cmpi 0,r7,0
cmpwi 0,r7,0
bne- 10b
stwcx. r8,0,r9
bne- 10b
......@@ -551,7 +551,7 @@ _GLOBAL(_tlbie)
ori r9,r9,mmu_hash_lock@l
tophys(r9,r9)
10: lwarx r7,0,r9
cmpi 0,r7,0
cmpwi 0,r7,0
bne- 10b
stwcx. r8,0,r9
bne- 10b
......@@ -599,7 +599,7 @@ _GLOBAL(flush_instruction_cache)
#else
mfspr r3,PVR
rlwinm r3,r3,16,16,31
cmpi 0,r3,1
cmpwi 0,r3,1
beqlr /* for 601, do nothing */
/* 603/604 processor - use invalidate-all bit in HID0 */
mfspr r3,HID0
......@@ -1141,7 +1141,7 @@ _GLOBAL(kernel_thread)
li r4,0 /* new sp (unused) */
li r0,__NR_clone
sc
cmpi 0,r3,0 /* parent or child? */
cmpwi 0,r3,0 /* parent or child? */
bne 1f /* return if parent */
li r0,0 /* make top-level stack frame */
stwu r0,-16(r1)
......
......@@ -80,13 +80,13 @@ _GLOBAL(csum_partial)
adde r0,r0,r5 /* be unnecessary to unroll this loop */
bdnz 2b
andi. r4,r4,3
3: cmpi 0,r4,2
3: cmpwi 0,r4,2
blt+ 4f
lhz r5,4(r3)
addi r3,r3,2
subi r4,r4,2
adde r0,r0,r5
4: cmpi 0,r4,1
4: cmpwi 0,r4,1
bne+ 5f
lbz r5,4(r3)
slwi r5,r5,8 /* Upper byte of word */
......@@ -143,7 +143,7 @@ _GLOBAL(csum_partial_copy_generic)
adde r0,r0,r9
bdnz 82b
13: andi. r5,r5,3
3: cmpi 0,r5,2
3: cmpwi 0,r5,2
blt+ 4f
83: lhz r6,4(r3)
addi r3,r3,2
......@@ -151,7 +151,7 @@ _GLOBAL(csum_partial_copy_generic)
93: sth r6,4(r4)
addi r4,r4,2
adde r0,r0,r6
4: cmpi 0,r5,1
4: cmpwi 0,r5,1
bne+ 5f
84: lbz r6,4(r3)
94: stb r6,4(r4)
......@@ -188,7 +188,7 @@ src_error_3:
97: stbu r6,1(r4)
bdnz 97b
src_error:
cmpi 0,r7,0
cmpwi 0,r7,0
beq 1f
li r6,-EFAULT
stw r6,0(r7)
......@@ -196,7 +196,7 @@ src_error:
blr
dst_error:
cmpi 0,r8,0
cmpwi 0,r8,0
beq 1f
li r6,-EFAULT
stw r6,0(r8)
......
......@@ -4,9 +4,11 @@
* Ebony board specific routines
*
* Matt Porter <mporter@mvista.com>
*
* Copyright 2002 MontaVista Software Inc.
*
* Eugene Surovegin <eugene.surovegin@zultys.com> or <ebs@ebshome.net>
* Copyright (c) 2003, 2004 Zultys Technologies
*
* 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
......@@ -118,7 +120,7 @@ static u_char ebony_IRQ_initsenses[] __initdata = {
(IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE), /* 63: EMAC 1 WOL */
};
extern void abort(void);
static struct ibm44x_clocks clocks __initdata;
static void __init
ebony_calibrate_decr(void)
......@@ -143,18 +145,7 @@ ebony_calibrate_decr(void)
break;
}
tb_ticks_per_jiffy = freq / HZ;
tb_to_us = mulhwu_scale_factor(freq, 1000000);
/* Set the time base to zero */
mtspr(SPRN_TBWL, 0);
mtspr(SPRN_TBWU, 0);
/* Clear any pending timer interrupts */
mtspr(SPRN_TSR, TSR_ENW | TSR_WIS | TSR_DIS | TSR_FIS);
/* Enable decrementer interrupt */
mtspr(SPRN_TCR, TCR_DIE);
ibm44x_calibrate_decr(freq);
}
static int
......@@ -283,7 +274,7 @@ ebony_early_serial_map(void)
memset(&port, 0, sizeof(port));
port.membase = ioremap64(PPC440GP_UART0_ADDR, 8);
port.irq = 0;
port.uartclk = BASE_BAUD * 16;
port.uartclk = clocks.uart0;
port.regshift = 0;
port.iotype = SERIAL_IO_MEM;
port.flags = ASYNC_BOOT_AUTOCONF | ASYNC_SKIP_TEST;
......@@ -306,7 +297,6 @@ static void __init
ebony_setup_arch(void)
{
unsigned char * vpd_base;
struct ibm44x_clocks clocks;
struct ocp_def *def;
struct ocp_func_emac_data *emacdata;
......@@ -370,152 +360,17 @@ ebony_setup_arch(void)
printk("IBM Ebony port (MontaVista Software, Inc. (source@mvista.com))\n");
}
static void
ebony_restart(char *cmd)
{
local_irq_disable();
abort();
}
static void
ebony_power_off(void)
{
local_irq_disable();
for(;;);
}
static void
ebony_halt(void)
{
local_irq_disable();
for(;;);
}
/*
* Read the 440GP memory controller to get size of system memory.
*/
static unsigned long __init
ebony_find_end_of_memory(void)
{
u32 i, bank_config;
u32 mem_size = 0;
for (i=0; i<4; i++)
{
switch (i)
{
case 0:
mtdcr(DCRN_SDRAM0_CFGADDR, SDRAM0_B0CR);
break;
case 1:
mtdcr(DCRN_SDRAM0_CFGADDR, SDRAM0_B1CR);
break;
case 2:
mtdcr(DCRN_SDRAM0_CFGADDR, SDRAM0_B2CR);
break;
case 3:
mtdcr(DCRN_SDRAM0_CFGADDR, SDRAM0_B3CR);
break;
}
bank_config = mfdcr(DCRN_SDRAM0_CFGDATA);
if (!(bank_config & SDRAM_CONFIG_BANK_ENABLE))
continue;
switch (SDRAM_CONFIG_BANK_SIZE(bank_config))
{
case SDRAM_CONFIG_SIZE_8M:
mem_size += PPC44x_MEM_SIZE_8M;
break;
case SDRAM_CONFIG_SIZE_16M:
mem_size += PPC44x_MEM_SIZE_16M;
break;
case SDRAM_CONFIG_SIZE_32M:
mem_size += PPC44x_MEM_SIZE_32M;
break;
case SDRAM_CONFIG_SIZE_64M:
mem_size += PPC44x_MEM_SIZE_64M;
break;
case SDRAM_CONFIG_SIZE_128M:
mem_size += PPC44x_MEM_SIZE_128M;
break;
case SDRAM_CONFIG_SIZE_256M:
mem_size += PPC44x_MEM_SIZE_256M;
break;
case SDRAM_CONFIG_SIZE_512M:
mem_size += PPC44x_MEM_SIZE_512M;
break;
}
}
return mem_size;
}
static void __init
ebony_init_irq(void)
{
int i;
ppc4xx_pic_init();
for (i = 0; i < NR_IRQS; i++)
irq_desc[i].handler = ppc4xx_pic;
}
#ifdef CONFIG_SERIAL_TEXT_DEBUG
#include <linux/serialP.h>
#include <linux/serial_reg.h>
#include <asm/serial.h>
static struct serial_state rs_table[RS_TABLE_SIZE] = {
SERIAL_PORT_DFNS /* Defined in <asm/serial.h> */
};
static void
ebony_progress(char *s, unsigned short hex)
{
volatile char c;
volatile unsigned long com_port;
u16 shift;
com_port = (unsigned long)rs_table[0].iomem_base;
shift = rs_table[0].iomem_reg_shift;
while ((c = *s++) != 0) {
while ((*((volatile unsigned char *)com_port +
(UART_LSR << shift)) & UART_LSR_THRE) == 0)
;
*(volatile unsigned char *)com_port = c;
}
/* Send LF/CR to pretty up output */
while ((*((volatile unsigned char *)com_port +
(UART_LSR << shift)) & UART_LSR_THRE) == 0)
;
*(volatile unsigned char *)com_port = '\r';
while ((*((volatile unsigned char *)com_port +
(UART_LSR << shift)) & UART_LSR_THRE) == 0)
;
*(volatile unsigned char *)com_port = '\n';
}
#endif /* CONFIG_SERIAL_TEXT_DEBUG */
void __init platform_init(unsigned long r3, unsigned long r4,
unsigned long r5, unsigned long r6, unsigned long r7)
{
parse_bootinfo((struct bi_record *) (r3 + KERNELBASE));
ibm44x_platform_init();
ppc_md.setup_arch = ebony_setup_arch;
ppc_md.show_cpuinfo = ebony_show_cpuinfo;
ppc_md.init_IRQ = ebony_init_irq;
ppc_md.get_irq = NULL; /* Set in ppc4xx_pic_init() */
ppc_md.find_end_of_memory = ebony_find_end_of_memory;
ppc_md.restart = ebony_restart;
ppc_md.power_off = ebony_power_off;
ppc_md.halt = ebony_halt;
ppc_md.calibrate_decr = ebony_calibrate_decr;
ppc_md.time_init = todc_time_init;
ppc_md.set_rtc_time = todc_set_rtc_time;
......@@ -524,9 +379,6 @@ void __init platform_init(unsigned long r3, unsigned long r4,
ppc_md.nvram_read_val = todc_direct_read_val;
ppc_md.nvram_write_val = todc_direct_write_val;
#ifdef CONFIG_SERIAL_TEXT_DEBUG
ppc_md.progress = ebony_progress;
#endif /* CONFIG_SERIAL_TEXT_DEBUG */
#ifdef CONFIG_KGDB
ppc_md.early_serial_map = ebony_early_serial_map;
#endif
......
......@@ -58,39 +58,21 @@
*/
#include "../../../../drivers/net/ibm_emac/ibm_emac_phy.h"
extern void abort(void);
bd_t __res;
static struct ibm44x_clocks clocks;
static int __init
ocotea_get_dec_freq(void)
{
if (mfspr(SPRN_CCR1) & CCR1_TCS)
return OCOTEA_TMR_CLK;
else
return clocks.cpu;
}
static struct ibm44x_clocks clocks __initdata;
static void __init
ocotea_calibrate_decr(void)
{
unsigned int freq;
freq = ocotea_get_dec_freq();
tb_ticks_per_jiffy = freq / HZ;
tb_to_us = mulhwu_scale_factor(freq, 1000000);
/* Set the time base to zero */
mtspr(SPRN_TBWL, 0);
mtspr(SPRN_TBWU, 0);
/* Clear any pending timer interrupts */
mtspr(SPRN_TSR, TSR_ENW | TSR_WIS | TSR_DIS | TSR_FIS);
if (mfspr(SPRN_CCR1) & CCR1_TCS)
freq = OCOTEA_TMR_CLK;
else
freq = clocks.cpu;
/* Enable decrementer interrupt */
mtspr(SPRN_TCR, TCR_DIE);
ibm44x_calibrate_decr(freq);
}
static int
......@@ -101,6 +83,7 @@ ocotea_show_cpuinfo(struct seq_file *m)
return 0;
}
static inline int
ocotea_map_irq(struct pci_dev *dev, unsigned char idsel, unsigned char pin)
{
......@@ -344,135 +327,6 @@ ocotea_setup_arch(void)
printk("IBM Ocotea port (MontaVista Software, Inc. <source@mvista.com>)\n");
}
static void
ocotea_restart(char *cmd)
{
local_irq_disable();
abort();
}
static void
ocotea_power_off(void)
{
local_irq_disable();
for(;;);
}
static void
ocotea_halt(void)
{
local_irq_disable();
for(;;);
}
/*
* Read the 440GX memory controller to get size of system memory.
*/
static unsigned long __init
ocotea_find_end_of_memory(void)
{
u32 i, bank_config;
u32 mem_size = 0;
for (i=0; i<4; i++)
{
switch (i)
{
case 0:
mtdcr(DCRN_SDRAM0_CFGADDR, SDRAM0_B0CR);
break;
case 1:
mtdcr(DCRN_SDRAM0_CFGADDR, SDRAM0_B1CR);
break;
case 2:
mtdcr(DCRN_SDRAM0_CFGADDR, SDRAM0_B2CR);
break;
case 3:
mtdcr(DCRN_SDRAM0_CFGADDR, SDRAM0_B3CR);
break;
}
bank_config = mfdcr(DCRN_SDRAM0_CFGDATA);
if (!(bank_config & SDRAM_CONFIG_BANK_ENABLE))
continue;
switch (SDRAM_CONFIG_BANK_SIZE(bank_config))
{
case SDRAM_CONFIG_SIZE_8M:
mem_size += PPC44x_MEM_SIZE_8M;
break;
case SDRAM_CONFIG_SIZE_16M:
mem_size += PPC44x_MEM_SIZE_16M;
break;
case SDRAM_CONFIG_SIZE_32M:
mem_size += PPC44x_MEM_SIZE_32M;
break;
case SDRAM_CONFIG_SIZE_64M:
mem_size += PPC44x_MEM_SIZE_64M;
break;
case SDRAM_CONFIG_SIZE_128M:
mem_size += PPC44x_MEM_SIZE_128M;
break;
case SDRAM_CONFIG_SIZE_256M:
mem_size += PPC44x_MEM_SIZE_256M;
break;
case SDRAM_CONFIG_SIZE_512M:
mem_size += PPC44x_MEM_SIZE_512M;
break;
}
}
return mem_size;
}
static void __init
ocotea_init_irq(void)
{
int i;
ppc4xx_pic_init();
for (i = 0; i < NR_IRQS; i++)
irq_desc[i].handler = ppc4xx_pic;
}
#ifdef CONFIG_SERIAL_TEXT_DEBUG
#include <linux/serialP.h>
#include <linux/serial_reg.h>
#include <asm/serial.h>
struct serial_state rs_table[RS_TABLE_SIZE] = {
SERIAL_PORT_DFNS /* Defined in <asm/serial.h> */
};
static void
ocotea_progress(char *s, unsigned short hex)
{
volatile char c;
volatile unsigned long com_port;
u16 shift;
com_port = (unsigned long)rs_table[0].iomem_base;
shift = rs_table[0].iomem_reg_shift;
while ((c = *s++) != 0) {
while ((*((volatile unsigned char *)com_port +
(UART_LSR << shift)) & UART_LSR_THRE) == 0)
;
*(volatile unsigned char *)com_port = c;
}
/* Send LF/CR to pretty up output */
while ((*((volatile unsigned char *)com_port +
(UART_LSR << shift)) & UART_LSR_THRE) == 0)
;
*(volatile unsigned char *)com_port = '\r';
while ((*((volatile unsigned char *)com_port +
(UART_LSR << shift)) & UART_LSR_THRE) == 0)
;
*(volatile unsigned char *)com_port = '\n';
}
#endif /* CONFIG_SERIAL_TEXT_DEBUG */
void __init platform_init(unsigned long r3, unsigned long r4,
unsigned long r5, unsigned long r6, unsigned long r7)
{
......@@ -488,17 +342,12 @@ void __init platform_init(unsigned long r3, unsigned long r4,
/* Disable L2-Cache due to hardware issues */
ibm440gx_l2c_disable();
ibm44x_platform_init();
ppc_md.setup_arch = ocotea_setup_arch;
ppc_md.show_cpuinfo = ocotea_show_cpuinfo;
ppc_md.init_IRQ = ocotea_init_irq;
ppc_md.get_irq = NULL; /* Set in ppc4xx_pic_init() */
ppc_md.find_end_of_memory = ocotea_find_end_of_memory;
ppc_md.restart = ocotea_restart;
ppc_md.power_off = ocotea_power_off;
ppc_md.halt = ocotea_halt;
ppc_md.calibrate_decr = ocotea_calibrate_decr;
ppc_md.time_init = todc_time_init;
ppc_md.set_rtc_time = todc_set_rtc_time;
......@@ -507,9 +356,6 @@ void __init platform_init(unsigned long r3, unsigned long r4,
ppc_md.nvram_read_val = todc_direct_read_val;
ppc_md.nvram_write_val = todc_direct_write_val;
#ifdef CONFIG_SERIAL_TEXT_DEBUG
ppc_md.progress = ocotea_progress;
#endif /* CONFIG_SERIAL_TEXT_DEBUG */
#ifdef CONFIG_KGDB
ppc_md.early_serial_map = ocotea_early_serial_map;
#endif
......
......@@ -6,6 +6,9 @@
* Matt Porter <mporter@mvista.com>
* Copyright 2002-2003 MontaVista Software Inc.
*
* Eugene Surovegin <eugene.surovegin@zultys.com> or <ebs@ebshome.net>
* Copyright (c) 2003, 2004 Zultys Technologies
*
* 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
......@@ -14,8 +17,14 @@
*/
#include <linux/config.h>
#include <linux/types.h>
#include <linux/serial.h>
#include <asm/param.h>
#include <asm/ibm44x.h>
#include <asm/mmu.h>
#include <asm/machdep.h>
#include <asm/time.h>
#include <asm/ppc4xx_pic.h>
phys_addr_t fixup_bigphys_addr(phys_addr_t addr, phys_addr_t size)
{
......@@ -35,3 +44,159 @@ phys_addr_t fixup_bigphys_addr(phys_addr_t addr, phys_addr_t size)
return (page_4gb | addr);
};
void __init ibm44x_calibrate_decr(unsigned int freq)
{
tb_ticks_per_jiffy = freq / HZ;
tb_to_us = mulhwu_scale_factor(freq, 1000000);
/* Set the time base to zero */
mtspr(SPRN_TBWL, 0);
mtspr(SPRN_TBWU, 0);
/* Clear any pending timer interrupts */
mtspr(SPRN_TSR, TSR_ENW | TSR_WIS | TSR_DIS | TSR_FIS);
/* Enable decrementer interrupt */
mtspr(SPRN_TCR, TCR_DIE);
}
extern void abort(void);
static void ibm44x_restart(char *cmd)
{
local_irq_disable();
abort();
}
static void ibm44x_power_off(void)
{
local_irq_disable();
for(;;);
}
static void ibm44x_halt(void)
{
local_irq_disable();
for(;;);
}
/*
* Read the 44x memory controller to get size of system memory.
*/
static unsigned long __init ibm44x_find_end_of_memory(void)
{
u32 i, bank_config;
u32 mem_size = 0;
for (i=0; i<4; i++)
{
switch (i)
{
case 0:
mtdcr(DCRN_SDRAM0_CFGADDR, SDRAM0_B0CR);
break;
case 1:
mtdcr(DCRN_SDRAM0_CFGADDR, SDRAM0_B1CR);
break;
case 2:
mtdcr(DCRN_SDRAM0_CFGADDR, SDRAM0_B2CR);
break;
case 3:
mtdcr(DCRN_SDRAM0_CFGADDR, SDRAM0_B3CR);
break;
}
bank_config = mfdcr(DCRN_SDRAM0_CFGDATA);
if (!(bank_config & SDRAM_CONFIG_BANK_ENABLE))
continue;
switch (SDRAM_CONFIG_BANK_SIZE(bank_config))
{
case SDRAM_CONFIG_SIZE_8M:
mem_size += PPC44x_MEM_SIZE_8M;
break;
case SDRAM_CONFIG_SIZE_16M:
mem_size += PPC44x_MEM_SIZE_16M;
break;
case SDRAM_CONFIG_SIZE_32M:
mem_size += PPC44x_MEM_SIZE_32M;
break;
case SDRAM_CONFIG_SIZE_64M:
mem_size += PPC44x_MEM_SIZE_64M;
break;
case SDRAM_CONFIG_SIZE_128M:
mem_size += PPC44x_MEM_SIZE_128M;
break;
case SDRAM_CONFIG_SIZE_256M:
mem_size += PPC44x_MEM_SIZE_256M;
break;
case SDRAM_CONFIG_SIZE_512M:
mem_size += PPC44x_MEM_SIZE_512M;
break;
}
}
return mem_size;
}
static void __init ibm44x_init_irq(void)
{
int i;
ppc4xx_pic_init();
for (i = 0; i < NR_IRQS; i++)
irq_desc[i].handler = ppc4xx_pic;
}
#ifdef CONFIG_SERIAL_TEXT_DEBUG
#include <linux/serialP.h>
#include <linux/serial_reg.h>
#include <asm/serial.h>
static struct serial_state rs_table[RS_TABLE_SIZE] = {
SERIAL_PORT_DFNS /* Defined in <asm/serial.h> */
};
static void ibm44x_progress(char *s, unsigned short hex)
{
volatile char c;
volatile unsigned long com_port;
u16 shift;
com_port = (unsigned long)rs_table[0].iomem_base;
shift = rs_table[0].iomem_reg_shift;
while ((c = *s++) != 0) {
while ((*((volatile unsigned char *)com_port +
(UART_LSR << shift)) & UART_LSR_THRE) == 0)
;
*(volatile unsigned char *)com_port = c;
}
/* Send LF/CR to pretty up output */
while ((*((volatile unsigned char *)com_port +
(UART_LSR << shift)) & UART_LSR_THRE) == 0)
;
*(volatile unsigned char *)com_port = '\r';
while ((*((volatile unsigned char *)com_port +
(UART_LSR << shift)) & UART_LSR_THRE) == 0)
;
*(volatile unsigned char *)com_port = '\n';
}
#endif /* CONFIG_SERIAL_TEXT_DEBUG */
void __init ibm44x_platform_init(void)
{
ppc_md.init_IRQ = ibm44x_init_irq;
ppc_md.find_end_of_memory = ibm44x_find_end_of_memory;
ppc_md.restart = ibm44x_restart;
ppc_md.power_off = ibm44x_power_off;
ppc_md.halt = ibm44x_halt;
#ifdef CONFIG_SERIAL_TEXT_DEBUG
ppc_md.progress = ibm44x_progress;
#endif /* CONFIG_SERIAL_TEXT_DEBUG */
}
......@@ -4,7 +4,7 @@
* PPC44x system library
*
* Eugene Surovegin <eugene.surovegin@zultys.com> or <ebs@ebshome.net>
* Copyright (c) 2003 Zultys Technologies
* Copyright (c) 2003, 2004 Zultys Technologies
*
* 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
......@@ -31,6 +31,12 @@ struct ibm44x_clocks {
unsigned int uart1;
};
/* common 44x platform init */
void ibm44x_platform_init(void) __init;
/* initialize decrementer and tick-related variables */
void ibm44x_calibrate_decr(unsigned int freq) __init;
#endif /* __ASSEMBLY__ */
#endif /* __PPC_SYSLIB_IBM44x_COMMON_H */
#endif /* __KERNEL__ */
......@@ -215,7 +215,7 @@ config MSCHUNKS
config PPC_RTAS
bool "Proc interface to RTAS"
depends on !PPC_ISERIES
depends on PPC_PSERIES
config RTAS_FLASH
tristate "Firmware flash interface"
......@@ -227,6 +227,7 @@ config SCANLOG
config LPARCFG
tristate "LPAR Configuration Data"
depends on PPC_PSERIES || PPC_ISERIES
help
Provide system capacity information via human readable
<key word>=<value> pairs through a /proc/ppc64/lparcfg interface.
......@@ -273,7 +274,7 @@ source "drivers/pci/Kconfig"
config HOTPLUG_CPU
bool "Support for hot-pluggable CPUs"
depends on SMP && HOTPLUG && EXPERIMENTAL
depends on SMP && HOTPLUG && EXPERIMENTAL && PPC_PSERIES
---help---
Say Y here to be able to turn CPUs off and on.
......
......@@ -25,7 +25,7 @@ static __inline__ int set_inUse( struct ItLpQueue * lpQueue )
__asm__ __volatile__("\n\
1: lwarx %0,0,%2 \n\
cmpi 0,%0,0 \n\
cmpwi 0,%0,0 \n\
li %0,0 \n\
bne- 2f \n\
addi %0,%0,1 \n\
......
......@@ -122,7 +122,7 @@ SystemCall_common:
andi. r11,r10,_TIF_SYSCALL_T_OR_A
bne- syscall_dotrace
syscall_dotrace_cont:
cmpli 0,r0,NR_syscalls
cmpldi 0,r0,NR_syscalls
bge- syscall_enosys
system_call: /* label this so stack traces look sane */
......@@ -204,7 +204,7 @@ syscall_enosys:
syscall_error:
lbz r11,TI_SC_NOERR(r12)
cmpi 0,r11,0
cmpwi 0,r11,0
bne- syscall_error_cont
neg r3,r3
oris r5,r5,0x1000 /* Set SO bit in CR */
......
......@@ -46,7 +46,7 @@ END_FTR_SECTION_IFCLR(CPU_FTR_CAN_NAP)
/* Now check if user or arch enabled NAP mode */
LOADBASE(r3,powersave_nap)
lwz r4,powersave_nap@l(r3)
cmpi 0,r4,0
cmpwi 0,r4,0
beqlr
/* Clear MSR:EE */
......
......@@ -670,7 +670,7 @@ _GLOBAL(kernel_thread)
li r4,0 /* new sp (unused) */
li r0,__NR_clone
sc
cmpi 0,r3,0 /* parent or child? */
cmpdi 0,r3,0 /* parent or child? */
bne 1f /* return if parent */
li r0,0
stdu r0,-STACK_FRAME_OVERHEAD(r1)
......
......@@ -136,7 +136,7 @@ EXPORT_SYMBOL(local_irq_restore);
EXPORT_SYMBOL(ppc_md);
#ifdef CONFIG_PPC_PSERIES
#ifdef CONFIG_PPC_MULTIPLATFORM
EXPORT_SYMBOL(find_devices);
EXPORT_SYMBOL(find_type_devices);
EXPORT_SYMBOL(find_compatible_devices);
......
......@@ -580,7 +580,7 @@ static void ppc_rtas_process_sensor(struct seq_file *m,
}
break;
case THERMAL_SENSOR:
seq_printf(m, "Temp. (C/F):\t");
seq_printf(m, "Temp. (C/F):\t");
temperature = 1;
break;
case LID_STATUS:
......
......@@ -92,19 +92,19 @@ _GLOBAL(csum_partial)
adde r5,r5,r6
bdnz 2b
andi. r4,r4,7 /* compute bytes left to sum after doublewords */
3: cmpi 0,r4,4 /* is at least a full word left? */
3: cmpwi 0,r4,4 /* is at least a full word left? */
blt 4f
lwz r6,8(r3) /* sum this word */
addi r3,r3,4
subi r4,r4,4
adde r5,r5,r6
4: cmpi 0,r4,2 /* is at least a halfword left? */
4: cmpwi 0,r4,2 /* is at least a halfword left? */
blt+ 5f
lhz r6,8(r3) /* sum this halfword */
addi r3,r3,2
subi r4,r4,2
adde r5,r5,r6
5: cmpi 0,r4,1 /* is at least a byte left? */
5: cmpwi 0,r4,1 /* is at least a byte left? */
bne+ 6f
lbz r6,8(r3) /* sum this byte */
slwi r6,r6,8 /* this byte is assumed to be the upper byte of a halfword */
......@@ -150,7 +150,7 @@ _GLOBAL(csum_partial_copy_generic)
adde r0,r0,r6
bdnz 82b
andi. r5,r5,3
3: cmpi 0,r5,2
3: cmpwi 0,r5,2
blt+ 4f
83: lhz r6,4(r3)
addi r3,r3,2
......@@ -158,7 +158,7 @@ _GLOBAL(csum_partial_copy_generic)
93: sth r6,4(r4)
addi r4,r4,2
adde r0,r0,r6
4: cmpi 0,r5,1
4: cmpwi 0,r5,1
bne+ 5f
84: lbz r6,4(r3)
94: stb r6,4(r4)
......@@ -198,7 +198,7 @@ src_error_3:
bdnz 97b
.globl src_error
src_error:
cmpi 0,r7,0
cmpdi 0,r7,0
beq 1f
li r6,-EFAULT
stw r6,0(r7)
......@@ -207,7 +207,7 @@ src_error:
.globl dst_error
dst_error:
cmpi 0,r8,0
cmpdi 0,r8,0
beq 1f
li r6,-EFAULT
stw r6,0(r8)
......
......@@ -172,9 +172,9 @@ htab_insert_pte:
li r9,0
_GLOBAL(htab_call_hpte_insert1)
bl . /* Will be patched by htab_finish_init() */
cmpi 0,r3,0
cmpdi 0,r3,0
bge htab_pte_insert_ok /* Insertion successful */
cmpi 0,r3,-2 /* Critical failure */
cmpdi 0,r3,-2 /* Critical failure */
beq- htab_pte_insert_failure
/* Now try secondary slot */
......@@ -194,9 +194,9 @@ _GLOBAL(htab_call_hpte_insert1)
li r9,0
_GLOBAL(htab_call_hpte_insert2)
bl . /* Will be patched by htab_finish_init() */
cmpi 0,r3,0
cmpdi 0,r3,0
bge+ htab_pte_insert_ok /* Insertion successful */
cmpi 0,r3,-2 /* Critical failure */
cmpdi 0,r3,-2 /* Critical failure */
beq- htab_pte_insert_failure
/* Both are full, we need to evict something */
......
......@@ -287,7 +287,7 @@ int sys_ptrace(long request, long pid, long addr, long data)
}
#endif
default:
ret = -EIO;
ret = ptrace_request(child, request, addr, data);
break;
}
out_tsk:
......
......@@ -47,7 +47,6 @@ extern syscall_handler_t sys_rt_sigaction;
extern syscall_handler_t sys_sigaltstack;
extern syscall_handler_t sys_vfork;
extern syscall_handler_t sys_mmap2;
extern syscall_handler_t sys_timer_create;
extern syscall_handler_t old_mmap_i386;
extern syscall_handler_t old_select;
extern syscall_handler_t sys_modify_ldt;
......
......@@ -88,7 +88,8 @@ static int __init init_syscall32(void)
__initcall(init_syscall32);
void __init syscall32_cpu_init(void)
/* May not be __init: called during resume */
void syscall32_cpu_init(void)
{
if (use_sysenter < 0)
use_sysenter = (boot_cpu_data.x86_vendor == X86_VENDOR_INTEL);
......
......@@ -195,7 +195,8 @@ void pda_init(int cpu)
char boot_exception_stacks[N_EXCEPTION_STACKS * EXCEPTION_STKSZ]
__attribute__((section(".bss.page_aligned")));
void __init syscall_init(void)
/* May not be marked __init: used by software suspend */
void syscall_init(void)
{
/*
* LSTAR and STAR live in a bit strange symbiosis.
......
......@@ -354,6 +354,19 @@ static void cdrom_sysctl_register(void);
#endif /* CONFIG_SYSCTL */
static struct cdrom_device_info *topCdromPtr;
static int cdrom_dummy_generic_packet(struct cdrom_device_info *cdi,
struct packet_command *cgc)
{
if (cgc->sense) {
cgc->sense->sense_key = 0x05;
cgc->sense->asc = 0x20;
cgc->sense->ascq = 0x00;
}
cgc->stat = -EIO;
return -EIO;
}
/* This macro makes sure we don't have to check on cdrom_device_ops
* existence in the run-time routines below. Change_capability is a
* hack to have the capability flags defined const, while we can still
......@@ -411,6 +424,9 @@ int register_cdrom(struct cdrom_device_info *cdi)
else
cdi->cdda_method = CDDA_OLD;
if (!cdo->generic_packet)
cdo->generic_packet = cdrom_dummy_generic_packet;
cdinfo(CD_REG_UNREG, "drive \"/dev/%s\" registered\n", cdi->name);
spin_lock(&cdrom_lock);
cdi->next = topCdromPtr;
......
......@@ -9,6 +9,8 @@
#include <linux/fcntl.h>
#include <linux/init.h>
#include <linux/delay.h>
#include <linux/fs.h>
#include <asm/uaccess.h>
#include <asm/sections.h>
#include <asm/prom.h>
......@@ -154,7 +156,7 @@ anslcd_init(void)
retval = misc_register(&anslcd_dev);
if(retval < 0){
printk(KERN_INFO "LCD: misc_register failed\n");
iounmap(anslcd_ptr);
iounmap((void *)anslcd_ptr);
return retval;
}
......@@ -177,7 +179,7 @@ static void __exit
anslcd_exit(void)
{
misc_deregister(&anslcd_dev);
iounmap(anslcd_ptr);
iounmap((void *)anslcd_ptr);
}
module_init(anslcd_init);
......
......@@ -38,7 +38,7 @@ extern int stat_file(const char *path, unsigned long long *inode_out,
int *blksize_out, unsigned long long *blocks_out);
extern int access_file(char *path, int r, int w, int x);
extern int open_file(char *path, int r, int w, int append);
extern int file_type(const char *path, int *rdev);
extern int file_type(const char *path, int *maj, int *min);
extern void *open_dir(char *path, int *err_out);
extern char *read_dir(void *stream, unsigned long long *pos,
unsigned long long *ino_out, int *len_out);
......
......@@ -18,6 +18,7 @@
#include <linux/buffer_head.h>
#include <linux/root_dev.h>
#include <linux/statfs.h>
#include <linux/kdev_t.h>
#include <asm/uaccess.h>
#include "hostfs.h"
#include "kern_util.h"
......@@ -230,7 +231,7 @@ static int read_inode(struct inode *ino)
if(name == NULL)
goto out;
if(file_type(name, NULL) == OS_TYPE_SYMLINK){
if(file_type(name, NULL, NULL) == OS_TYPE_SYMLINK){
name = follow_link(name);
if(IS_ERR(name)){
err = PTR_ERR(name);
......@@ -290,7 +291,6 @@ static void hostfs_delete_inode(struct inode *inode)
{
if(HOSTFS_I(inode)->fd != -1) {
close_file(&HOSTFS_I(inode)->fd);
printk("Closing host fd in .delete_inode\n");
HOSTFS_I(inode)->fd = -1;
}
clear_inode(inode);
......@@ -301,9 +301,11 @@ static void hostfs_destroy_inode(struct inode *inode)
if(HOSTFS_I(inode)->host_filename)
kfree(HOSTFS_I(inode)->host_filename);
/*XXX: This should not happen, probably. The check is here for
* additional safety.*/
if(HOSTFS_I(inode)->fd != -1) {
close_file(&HOSTFS_I(inode)->fd);
printk("Closing host fd in .destroy_inode\n");
printk(KERN_DEBUG "Closing host fd in .destroy_inode\n");
}
kfree(HOSTFS_I(inode));
......@@ -522,13 +524,17 @@ static struct address_space_operations hostfs_aops = {
static int init_inode(struct inode *inode, struct dentry *dentry)
{
char *name;
int type, err = -ENOMEM, rdev;
int type, err = -ENOMEM;
int maj, min;
dev_t rdev = 0;
if(dentry){
name = dentry_name(dentry, 0);
if(name == NULL)
goto out;
type = file_type(name, &rdev);
type = file_type(name, &maj, &min);
/*Reencode maj and min with the kernel encoding.*/
rdev = MKDEV(maj, min);
kfree(name);
}
else type = OS_TYPE_DIR;
......
......@@ -54,14 +54,18 @@ int stat_file(const char *path, unsigned long long *inode_out, int *mode_out,
return(0);
}
int file_type(const char *path, int *rdev)
int file_type(const char *path, int *maj, int *min)
{
struct stat64 buf;
if(lstat64(path, &buf) < 0)
return(-errno);
if(rdev != NULL)
*rdev = buf.st_rdev;
/*We cannot pass rdev as is because glibc and the kernel disagree
*about its definition.*/
if(maj != NULL)
*maj = major(buf.st_rdev);
if(min != NULL)
*min = minor(buf.st_rdev);
if(S_ISDIR(buf.st_mode)) return(OS_TYPE_DIR);
else if(S_ISLNK(buf.st_mode)) return(OS_TYPE_SYMLINK);
......
......@@ -55,7 +55,7 @@
#define get_user(x, ptr) \
({ \
const __typeof__((*ptr)) *private_ptr = (ptr); \
const __typeof__((*(ptr))) *private_ptr = (ptr); \
(access_ok(VERIFY_READ, private_ptr, sizeof(*private_ptr)) ? \
__get_user(x, private_ptr) : ((x) = 0, -EFAULT)); \
})
......
......@@ -388,7 +388,7 @@ struct sched_domain {
.max_interval = 4, \
.busy_factor = 64, \
.imbalance_pct = 125, \
.cache_hot_time = (5*1000000/2), \
.cache_hot_time = cache_decay_ticks*1000000 ? : (5*1000000/2),\
.cache_nice_tries = 1, \
.per_cpu_gain = 100, \
.flags = SD_BALANCE_NEWIDLE \
......
......@@ -851,6 +851,9 @@ shrink_caches(struct zone **zones, struct scan_control *sc)
for (i = 0; zones[i] != NULL; i++) {
struct zone *zone = zones[i];
if (zone->present_pages == 0)
continue;
zone->temp_priority = sc->priority;
if (zone->prev_priority > sc->priority)
zone->prev_priority = sc->priority;
......@@ -1004,6 +1007,9 @@ static int balance_pgdat(pg_data_t *pgdat, int nr_pages)
for (i = pgdat->nr_zones - 1; i >= 0; i--) {
struct zone *zone = pgdat->node_zones + i;
if (zone->present_pages == 0)
continue;
if (zone->all_unreclaimable &&
priority != DEF_PRIORITY)
continue;
......@@ -1036,6 +1042,9 @@ static int balance_pgdat(pg_data_t *pgdat, int nr_pages)
for (i = 0; i <= end_zone; i++) {
struct zone *zone = pgdat->node_zones + i;
if (zone->present_pages == 0)
continue;
if (zone->all_unreclaimable && priority != DEF_PRIORITY)
continue;
......@@ -1159,6 +1168,8 @@ static int kswapd(void *p)
*/
void wakeup_kswapd(struct zone *zone)
{
if (zone->present_pages == 0)
return;
if (zone->free_pages > zone->pages_low)
return;
if (!waitqueue_active(&zone->zone_pgdat->kswapd_wait))
......
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