Commit 429c7cd2 authored by Paul Mackerras's avatar Paul Mackerras Committed by Paul Mackerras

Update PPC for recent generic changes; in particular adapt to

having the thread_info struct at the base of the stack and
the task_struct elsewhere.
parent 9b3882db
......@@ -21,10 +21,6 @@ else
KERNELLOAD =0xc0000000
endif
ifeq ($(shell uname -m),ppc)
CHECKS = checks
endif
LINKFLAGS = -T arch/ppc/vmlinux.lds -Ttext $(KERNELLOAD) -Bstatic
CPPFLAGS := $(CPPFLAGS) -I$(TOPDIR)/arch/$(ARCH)
AFLAGS := $(AFLAGS) -I$(TOPDIR)/arch/$(ARCH)
......@@ -102,15 +98,12 @@ SUBDIRS += arch/ppc/iSeries
CORE_FILES += arch/ppc/iSeries/iSeries.o
endif
checks:
@$(MAKE) -C arch/$(ARCH)/kernel checks
BOOT_TARGETS = zImage zImage.initrd znetboot znetboot.initrd pImage vmlinux.sm
# All the instructions talk about "make bzImage".
bzImage: zImage
$(BOOT_TARGETS): $(CHECKS) vmlinux
$(BOOT_TARGETS): vmlinux
@$(MAKEBOOT) $@
%_config: arch/ppc/configs/%_defconfig
......@@ -118,7 +111,7 @@ $(BOOT_TARGETS): $(CHECKS) vmlinux
cp -f arch/ppc/configs/$(@:config=defconfig) arch/ppc/defconfig
archclean:
rm -f arch/ppc/kernel/{mk_defs,ppc_defs.h,find_name,checks}
rm -f arch/ppc/kernel/{mk_defs,ppc_defs.h,find_name}
rm -f arch/ppc/iSeries/ReleaseData.h
@$(MAKEBOOT) clean
......
......@@ -169,6 +169,7 @@ bool 'Symmetric multi-processing support' CONFIG_SMP
if [ "$CONFIG_SMP" = "y" ]; then
bool ' Distribute interrupts on all CPUs by default' CONFIG_IRQ_ALL_CPUS
fi
define_bool CONFIG_PREEMPT n
if [ "$CONFIG_6xx" = "y" -a "$CONFIG_8260" = "n" ];then
bool 'AltiVec Support' CONFIG_ALTIVEC
......
......@@ -123,7 +123,3 @@ ppc_defs.h: mk_defs.c ppc_defs.head \
find_name : find_name.c
$(HOSTCC) $(HOSTCFLAGS) -o find_name find_name.c
checks: checks.c
$(HOSTCC) -I$(HPATH) $(HOSTCFLAGS) -D__KERNEL__ -fno-builtin -o checks checks.c
./checks
/*
* BK Id: SCCS/s.checks.c 1.6 05/17/01 18:14:21 cort
*/
#include <linux/errno.h>
#include <linux/sched.h>
#include <linux/kernel.h>
#include <linux/mm.h>
#include <linux/smp.h>
#include <linux/smp_lock.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 <asm/pgtable.h>
#include <asm/uaccess.h>
#include <asm/system.h>
#include <asm/io.h>
/*
* Do various before compile checks of data structures
* -- Cort
*/
int main(void)
{
int ret = 0;
#if 0
if ( sizeof(struct thread_struct) % 16 )
{
printf("Thread struct is not modulo 16 bytes: "
"%d bytes total, %d bytes off\n",
sizeof(struct thread_struct),
sizeof(struct thread_struct)%16);
ret = -1;
}
#endif
if ( sizeof(struct pt_regs) % 16 )
{
printf("pt_regs struct is not modulo 16 bytes: "
"%d bytes total, %d bytes off\n",
sizeof(struct pt_regs),
sizeof(struct pt_regs)%16);
ret = -1;
}
printf("Task size : %d bytes\n"
"Tss size : %d bytes\n"
"pt_regs size : %d bytes\n"
"Kernel stack size: %d bytes\n",
sizeof(struct task_struct), sizeof(struct thread_struct),
sizeof(struct pt_regs),
sizeof(union task_union) - sizeof(struct task_struct));
return ret;
}
......@@ -31,6 +31,7 @@
#include <asm/page.h>
#include <asm/mmu.h>
#include <asm/cputable.h>
#include <asm/thread_info.h>
#include <asm/ppc_asm.h>
#include "ppc_defs.h"
#ifdef CONFIG_PPC_ISERIES
......@@ -95,8 +96,9 @@ _GLOBAL(DoSyscall)
beq- 10f
cmpi 0,r0,0x6666 /* Special case for 'sys_rt_sigreturn' */
beq- 16f
lbz r10,SYSCALL_TRACE(r2)
cmpwi r10,0
rlwinm r10,r1,0,0,18 /* current_thread_info() */
lwz r10,TI_FLAGS(r10)
andi. r10,r10,_TIF_SYSCALL_TRACE
bne- 50f
cmpli 0,r0,NR_syscalls
bge- 66f
......@@ -276,8 +278,9 @@ END_FTR_SECTION_IFSET(CPU_FTR_ALTIVEC)
.globl ret_from_fork
ret_from_fork:
bl schedule_tail
lbz r0,SYSCALL_TRACE(r2)
cmpwi r0,0
rlwinm r3,r1,0,0,18
lwz r3,TI_FLAGS(r3)
andi. r0,r3,_TIF_SYSCALL_TRACE
bnel- do_syscall_trace
b ret_from_except
......@@ -295,8 +298,9 @@ ret_from_except:
REST_8GPRS(23,r1)
REST_GPR(31,r1)
/* Hard-disable interrupts so that current->work can't change
* between when we test it and when we return from the interrupt. */
/* Hard-disable interrupts so that current_thread_info()->flags
* can't change between when we test it and when we return
* from the interrupt. */
recheck:
mfmsr r10
rlwinm r0,r10,0,17,15 /* clear MSR_EE in r0 */
......@@ -310,9 +314,10 @@ recheck:
andi. r3,r3,MSR_PR
beq+ restore /* if not, just restore regs and return */
/* Check current->work */
lwz r3,TASK_WORK(r2)
rlwinm. r0,r3,0,16,7 /* need_resched, sigpending, notify_resume */
/* Check current_thread_info()->flags */
rlwinm r3,r1,0,0,18
lwz r3,TI_FLAGS(r3)
andi. r0,r3,(_TIF_SIGPENDING|_TIF_NEED_RESCHED)
bne do_work
.globl ret_to_user_hook
......@@ -384,21 +389,19 @@ do_work:
ori r10,r10,MSR_EE
SYNC
mtmsr r10 /* hard-enable interrupts */
rlwinm. r0,r3,0,0,7 /* test need_resched */
andi. r0,r3,_TIF_NEED_RESCHED
beq 1f
bl schedule
b recheck
1:
rlwinm. r0,r3,0,16,23 /* test sigpending */
andi. r0,r3,_TIF_SIGPENDING
beq 2f
li r3,0
addi r4,r1,STACK_FRAME_OVERHEAD
bl do_signal
b recheck
2:
/* nobody uses work.notify_resume yet */
li r0,0
stb r0,NOTIFY_RESUME(r2)
/* nobody uses the TIF_NOTIFY_RESUME bit yet */
b recheck
/*
......
......@@ -32,6 +32,7 @@
#include <asm/pgtable.h>
#include <asm/cputable.h>
#include <asm/cache.h>
#include <asm/thread_info.h>
#include <asm/ppc_asm.h>
#include "ppc_defs.h"
......@@ -784,9 +785,9 @@ END_FTR_SECTION_IFSET(CPU_FTR_ALTIVEC)
*/
stack_ovf:
addi r3,r1,STACK_FRAME_OVERHEAD
lis r1,init_task_union@ha
addi r1,r1,init_task_union@l
addi r1,r1,TASK_UNION_SIZE-STACK_FRAME_OVERHEAD
lis r1,init_thread_union@ha
addi r1,r1,init_thread_union@l
addi r1,r1,THREAD_SIZE-STACK_FRAME_OVERHEAD
lis r24,StackOverflow@ha
addi r24,r24,StackOverflow@l
li r20,MSR_KERNEL
......@@ -1228,7 +1229,7 @@ __secondary_start:
lwzx r2,r2,r24
/* stack */
addi r1,r2,TASK_UNION_SIZE-STACK_FRAME_OVERHEAD
addi r1,r2,THREAD_SIZE-STACK_FRAME_OVERHEAD
li r0,0
tophys(r3,r1)
stw r0,0(r3)
......@@ -1437,8 +1438,8 @@ start_here:
bl call_setup_cpu
/* ptr to current */
lis r2,init_task_union@h
ori r2,r2,init_task_union@l
lis r2,init_task@h
ori r2,r2,init_task@l
/* Set up for using our exception vectors */
/* ptr to phys current thread */
tophys(r4,r2)
......@@ -1449,9 +1450,10 @@ start_here:
mtspr SPRG2,r3 /* 0 => r1 has kernel sp */
/* stack */
addi r1,r2,TASK_UNION_SIZE
lis r1,init_thread_union@ha
addi r1,r1,init_thread_union@l
li r0,0
stwu r0,-STACK_FRAME_OVERHEAD(r1)
stwu r0,THREAD_SIZE-STACK_FRAME_OVERHEAD(r1)
/*
* Do early bootinfo parsing, platform-specific initialization,
* and set up the MMU.
......@@ -1725,6 +1727,10 @@ m8260_gorom:
.data
.globl sdata
sdata:
.globl init_thread_union
init_thread_union:
.space 8192
.globl empty_zero_page
empty_zero_page:
.space 4096
......
......@@ -38,6 +38,7 @@
#include <asm/pgtable.h>
#include <asm/ibm4xx.h>
#include <asm/cputable.h>
#include <asm/thread_info.h>
#include <asm/ppc_asm.h>
#include "ppc_defs.h"
......@@ -895,9 +896,9 @@ _GLOBAL(transfer_to_handler)
stack_ovf:
addi r3,r1,STACK_FRAME_OVERHEAD
lis r1,init_task_union@ha
addi r1,r1,init_task_union@l
addi r1,r1,TASK_UNION_SIZE - STACK_FRAME_OVERHEAD
lis r1,init_thread_union@ha
addi r1,r1,init_thread_union@l
addi r1,r1,THREAD_SIZE - STACK_FRAME_OVERHEAD
lis r24,StackOverflow@ha
addi r24,r24,StackOverflow@l
li r20,MSR_KERNEL
......@@ -937,8 +938,8 @@ _GLOBAL(abort)
start_here:
/* ptr to current */
lis r2,init_task_union@h
ori r2,r2,init_task_union@l
lis r2,init_task@h
ori r2,r2,init_task@l
/* ptr to phys current thread */
tophys(r4,r2)
......@@ -948,9 +949,10 @@ start_here:
mtspr SPRG2,r3 /* 0 => r1 has kernel sp */
/* stack */
addi r1,r2,TASK_UNION_SIZE
lis r1,init_thread_union@ha
addi r1,r1,init_thread_union@l
li r0,0
stwu r0,-STACK_FRAME_OVERHEAD(r1)
stwu r0,THREAD_SIZE-STACK_FRAME_OVERHEAD(r1)
bl early_init /* We have to do this with MMU on */
......@@ -1080,6 +1082,8 @@ _GLOBAL(set_context)
*/
.data
_GLOBAL(sdata)
_GLOBAL(init_thread_union)
.space 8192
_GLOBAL(empty_zero_page)
.space 4096
_GLOBAL(swapper_pg_dir)
......
......@@ -31,6 +31,7 @@
#include <asm/cache.h>
#include <asm/pgtable.h>
#include <asm/cputable.h>
#include <asm/thread_info.h>
#include <asm/ppc_asm.h>
#include "ppc_defs.h"
......@@ -682,9 +683,9 @@ transfer_to_handler:
*/
stack_ovf:
addi r3,r1,STACK_FRAME_OVERHEAD
lis r1,init_task_union@ha
addi r1,r1,init_task_union@l
addi r1,r1,TASK_UNION_SIZE-STACK_FRAME_OVERHEAD
lis r1,init_thread_union@ha
addi r1,r1,init_thread_union@l
addi r1,r1,THREAD_SIZE-STACK_FRAME_OVERHEAD
lis r24,StackOverflow@ha
addi r24,r24,StackOverflow@l
li r20,MSR_KERNEL
......@@ -708,8 +709,8 @@ _GLOBAL(__setup_cpu_8xx)
start_here:
/* ptr to current */
lis r2,init_task_union@h
ori r2,r2,init_task_union@l
lis r2,init_task@h
ori r2,r2,init_task@l
/* ptr to phys current thread */
tophys(r4,r2)
......@@ -719,9 +720,10 @@ start_here:
mtspr SPRG2,r3 /* 0 => r1 has kernel sp */
/* stack */
addi r1,r2,TASK_UNION_SIZE
lis r1,init_thread_union@ha
addi r1,r1,init_thread_union@l
li r0,0
stwu r0,-STACK_FRAME_OVERHEAD(r1)
stwu r0,THREAD_SIZE-STACK_FRAME_OVERHEAD(r1)
bl early_init /* We have to do this with MMU on */
......@@ -969,6 +971,10 @@ set_dec_cpu6:
.data
.globl sdata
sdata:
.globl init_thread_union
init_thread_union:
.space 8192
.globl empty_zero_page
empty_zero_page:
.space 4096
......
......@@ -31,6 +31,7 @@
#include <asm/mmu.h>
#include <asm/pgtable.h>
#include <asm/ppc_asm.h>
#include <asm/thread_info.h>
#include "ppc_defs.h"
#include "iSeries_asm.h"
......@@ -565,9 +566,9 @@ transfer_to_handler:
*/
stack_ovf:
addi r3,r1,STACK_FRAME_OVERHEAD
lis r1,init_task_union@ha
addi r1,r1,init_task_union@l
addi r1,r1,TASK_UNION_SIZE-STACK_FRAME_OVERHEAD
lis r1,init_thread_union@ha
addi r1,r1,init_thread_union@l
addi r1,r1,THREAD_SIZE-STACK_FRAME_OVERHEAD
mfspr r24,SPRG1
li r20,0
stb r20,PACAPROCENABLED(r24) /* soft disable */
......@@ -706,7 +707,7 @@ secondary_start:
lwzx r2,r2,r24
/* stack */
addi r1,r2,TASK_UNION_SIZE-STACK_FRAME_OVERHEAD
addi r1,r2,THREAD_SIZE-STACK_FRAME_OVERHEAD
li r0,0
stw r0,0(r1)
......@@ -767,8 +768,8 @@ start_here:
/* ptr to current */
lis r2,init_task_union@h
ori r2,r2,init_task_union@l
lis r2,init_task@h
ori r2,r2,init_task@l
/* Set up for using our exception vectors */
......@@ -787,9 +788,10 @@ start_here:
stb r3,PACAPROCENABLED(r11) /* Soft disabled */
addi r1,r2,TASK_UNION_SIZE
lis r1,init_thread_union@ha
addi r1,r1,init_thread_union@l
li r0,0
stwu r0,-STACK_FRAME_OVERHEAD(r1)
stwu r0,THREAD_SIZE-STACK_FRAME_OVERHEAD(r1)
/* fix klimit for system map */
lis r6,embedded_sysmap_end@ha
......@@ -1495,6 +1497,10 @@ _GLOBAL(abort)
.globl sdata
sdata:
.globl init_thread_union
init_thread_union:
.space 8192
.globl empty_zero_page
empty_zero_page:
.space 4096
......
......@@ -78,16 +78,11 @@ int idled(void)
#endif
#ifdef CONFIG_SMP
if (!do_power_save) {
/*
* Deal with another CPU just having chosen a thread to
* run here:
*/
unsigned long oldval;
oldval = xchg(&current->work, 0xff000000);
if (!(oldval & 0xff000000)) {
while (current->work.need_resched == -1)
barrier(); /* Do Nothing */
if (!need_resched()) {
set_thread_flag(TIF_POLLING_NRFLAG);
while (!test_thread_flag(TIF_NEED_RESCHED))
barrier();
clear_thread_flag(TIF_POLLING_NRFLAG);
}
}
#endif
......
......@@ -27,6 +27,7 @@
#include <asm/pgtable.h>
#include <asm/processor.h>
#include <asm/cputable.h>
#include <asm/thread_info.h>
#ifdef CONFIG_PPC_ISERIES
#include <asm/iSeries/Paca.h>
......@@ -41,11 +42,11 @@
int
main(void)
{
/*DEFINE(KERNELBASE, KERNELBASE);*/
DEFINE(THREAD_SIZE, THREAD_SIZE);
DEFINE(TI_CPU, offsetof(struct thread_info, cpu));
DEFINE(TI_FLAGS, offsetof(struct thread_info, flags));
DEFINE(STATE, offsetof(struct task_struct, state));
DEFINE(NEXT_TASK, offsetof(struct task_struct, next_task));
DEFINE(THREAD, offsetof(struct task_struct, thread));
DEFINE(CPU, offsetof(struct task_struct, cpu));
DEFINE(MM, offsetof(struct task_struct, mm));
DEFINE(ACTIVE_MM, offsetof(struct task_struct, active_mm));
DEFINE(TASK_STRUCT_SIZE, sizeof(struct task_struct));
......@@ -54,11 +55,6 @@ main(void)
DEFINE(LAST_SYSCALL, offsetof(struct thread_struct, last_syscall));
DEFINE(PT_REGS, offsetof(struct thread_struct, regs));
DEFINE(TASK_FLAGS, offsetof(struct task_struct, flags));
DEFINE(TASK_WORK, offsetof(struct task_struct, work));
DEFINE(NEED_RESCHED, offsetof(struct task_struct, work.need_resched));
DEFINE(SYSCALL_TRACE, offsetof(struct task_struct, work.syscall_trace));
DEFINE(SIGPENDING, offsetof(struct task_struct, work.sigpending));
DEFINE(NOTIFY_RESUME, offsetof(struct task_struct, work.notify_resume));
DEFINE(THREAD_FPEXC_MODE, offsetof(struct thread_struct, fpexc_mode));
DEFINE(THREAD_FPR0, offsetof(struct thread_struct, fpr[0]));
DEFINE(THREAD_FPSCR, offsetof(struct thread_struct, fpscr));
......@@ -68,7 +64,6 @@ main(void)
DEFINE(THREAD_VSCR, offsetof(struct thread_struct, vscr));
#endif /* CONFIG_ALTIVEC */
/* Interrupt register frame */
DEFINE(TASK_UNION_SIZE, sizeof(union task_union));
DEFINE(STACK_FRAME_OVERHEAD, STACK_FRAME_OVERHEAD);
DEFINE(INT_FRAME_SIZE, STACK_FRAME_OVERHEAD + sizeof(struct pt_regs));
/* in fact we only use gpr0 - gpr9 and gpr20 - gpr23 */
......
......@@ -59,10 +59,8 @@ static struct files_struct init_files = INIT_FILES;
static struct signal_struct init_signals = INIT_SIGNALS;
struct mm_struct init_mm = INIT_MM(init_mm);
/* this is 16-byte aligned because it has a stack in it */
union task_union __attribute((aligned(16))) init_task_union = {
INIT_TASK(init_task_union.task)
};
/* initial task structure */
struct task_struct init_task = INIT_TASK(init_task);
/* only used to get secondary processor up */
struct task_struct *current_set[NR_CPUS] = {&init_task, };
......@@ -333,7 +331,7 @@ copy_thread(int nr, unsigned long clone_flags, unsigned long usp,
{
struct pt_regs *childregs, *kregs;
extern void ret_from_fork(void);
unsigned long sp = (unsigned long)p + sizeof(union task_union);
unsigned long sp = (unsigned long)p->thread_info + THREAD_SIZE;
unsigned long childframe;
/* Copy registers */
......@@ -503,7 +501,7 @@ print_backtrace(unsigned long *sp)
void show_trace_task(struct task_struct *tsk)
{
unsigned long stack_top = (unsigned long) tsk + THREAD_SIZE;
unsigned long stack_top = (unsigned long) tsk->thread_info + THREAD_SIZE;
unsigned long sp, prev_sp;
int count = 0;
......@@ -623,7 +621,7 @@ extern void scheduling_functions_end_here(void);
unsigned long get_wchan(struct task_struct *p)
{
unsigned long ip, sp;
unsigned long stack_page = (unsigned long) p;
unsigned long stack_page = (unsigned long) p->thread_info;
int count = 0;
if (!p || p == current || p->state == TASK_RUNNING)
return 0;
......
......@@ -273,15 +273,9 @@ int sys_ptrace(long request, long pid, long addr, long data)
if ((unsigned long) data > _NSIG)
break;
if (request == PTRACE_SYSCALL) {
if (!(child->ptrace & PT_SYSCALLTRACE)) {
child->ptrace |= PT_SYSCALLTRACE;
child->work.syscall_trace++;
}
set_tsk_thread_flag(child, TIF_SYSCALL_TRACE);
} else {
if (child->ptrace & PT_SYSCALLTRACE) {
child->ptrace &= ~PT_SYSCALLTRACE;
child->work.syscall_trace--;
}
clear_tsk_thread_flag(child, TIF_SYSCALL_TRACE);
}
child->exit_code = data;
/* make sure the single step bit is not set. */
......@@ -311,10 +305,7 @@ int sys_ptrace(long request, long pid, long addr, long data)
ret = -EIO;
if ((unsigned long) data > _NSIG)
break;
if (child->ptrace & PT_SYSCALLTRACE) {
child->ptrace &= ~PT_SYSCALLTRACE;
child->work.syscall_trace--;
}
clear_tsk_thread_flag(child, TIF_SYSCALL_TRACE);
set_single_step(child);
child->exit_code = data;
/* give it a chance to run. */
......@@ -350,7 +341,7 @@ int sys_ptrace(long request, long pid, long addr, long data)
break;
}
out_tsk:
free_task_struct(child);
put_task_struct(child);
out:
unlock_kernel();
return ret;
......@@ -358,8 +349,8 @@ int sys_ptrace(long request, long pid, long addr, long data)
void do_syscall_trace(void)
{
if ((current->ptrace & (PT_PTRACED|PT_SYSCALLTRACE))
!= (PT_PTRACED|PT_SYSCALLTRACE))
if (!test_thread_flag(TIF_SYSCALL_TRACE)
|| !(current->ptrace & PT_PTRACED))
return;
current->exit_code = SIGTRAP;
current->state = TASK_STOPPED;
......
......@@ -35,6 +35,7 @@
#include <asm/uaccess.h>
#include <asm/system.h>
#include <asm/pmac_feature.h>
#include <asm/thread_info.h>
#if defined CONFIG_KGDB
#include <asm/kgdb.h>
......@@ -536,11 +537,14 @@ int __init ppc_init(void)
if (ppc_md.init != NULL) {
ppc_md.init();
}
init_crc32();
return 0;
}
arch_initcall(ppc_init);
/* Initial thread_info struct, copied into init_task_union */
struct thread_info init_thread_values __initdata = INIT_THREAD_INFO(init_task);
/* Warning, IO base is not yet inited */
void __init setup_arch(char **cmdline_p)
{
......@@ -549,6 +553,9 @@ void __init setup_arch(char **cmdline_p)
extern char *klimit;
extern void do_init_bootmem(void);
/* initialize the thread_info for the init task */
init_thread_info = init_thread_values;
/* so udelay does something sensible, assume <= 1000 bogomips */
loops_per_jiffy = 500000000 / HZ;
......
......@@ -475,10 +475,10 @@ find_ide_boot(void)
kdev_t __init pmac_find_ide_boot(char *bootdevice, int n);
if (bootdevice == NULL)
return 0;
return NODEV;
p = strrchr(bootdevice, '/');
if (p == NULL)
return 0;
return NODEV;
n = p - bootdevice;
return pmac_find_ide_boot(bootdevice, n);
......@@ -500,6 +500,16 @@ find_boot_device(void)
#endif
}
static int initializing = 1;
static int pmac_late_init(void)
{
initializing = 0;
return 0;
}
late_initcall(pmac_late_init);
/* can't be __init - can be called whenever a disk is first accessed */
void __pmac
note_bootable_part(kdev_t dev, int part, int goodness)
......@@ -507,8 +517,7 @@ note_bootable_part(kdev_t dev, int part, int goodness)
static int found_boot = 0;
char *p;
/* Do nothing if the root has been mounted already. */
if (init_task.fs->rootmnt != NULL)
if (!initializing)
return;
if ((goodness <= current_root_goodness) &&
!kdev_same(ROOT_DEV, to_kdev_t(DEFAULT_ROOT_DEVICE)))
......
......@@ -44,6 +44,7 @@ typedef struct {
#define hardirq_exit(cpu) (local_irq_count(cpu)--)
#define synchronize_irq() do { } while (0)
#define release_irqlock(cpu) do { } while (0)
#else /* CONFIG_SMP */
......
......@@ -171,15 +171,9 @@ static inline int pci_map_sg(struct pci_dev *hwdev, struct scatterlist *sg,
* temporary 2.4 hack
*/
for (i = 0; i < nents; i++) {
if (sg[i].address && sg[i].page)
if (!sg[i].page)
BUG();
else if (!sg[i].address && !sg[i].page)
BUG();
if (sg[i].address)
sg[i].dma_address = virt_to_bus(sg[i].address);
else
sg[i].dma_address = page_to_bus(sg[i].page) + sg[i].offset;
sg[i].dma_address = page_to_bus(sg[i].page) + sg[i].offset;
}
return nents;
......
......@@ -12,6 +12,7 @@
#define current_text_addr() ({ __label__ _l; _l: &&_l;})
#include <linux/config.h>
#include <linux/stringify.h>
#include <asm/ptrace.h>
#include <asm/types.h>
......@@ -558,7 +559,6 @@
#define _CHRP_Motorola 0x04 /* motorola chrp, the cobra */
#define _CHRP_IBM 0x05 /* IBM chrp, the longtrail and longtrail 2 */
#define __stringify(a) #a
#define _GLOBAL(n)\
.stabs __stringify(n:F-1),N_FUN,0,0,n;\
.globl n;\
......@@ -743,22 +743,10 @@ static inline unsigned int __pack_fe01(unsigned int fpmode)
return ((fpmode << 10) & MSR_FE0) | ((fpmode << 8) & MSR_FE1);
}
/*
* NOTE! The task struct and the stack go together
*/
#define THREAD_SIZE (2*PAGE_SIZE)
#define alloc_task_struct() \
((struct task_struct *) __get_free_pages(GFP_KERNEL,1))
#define free_task_struct(p) free_pages((unsigned long)(p),1)
#define get_task_struct(tsk) atomic_inc(&virt_to_page(tsk)->count)
/* in process.c - for early bootup debug -- Cort */
int ll_printk(const char *, ...);
void ll_puts(const char *);
#define init_task (init_task_union.task)
#define init_stack (init_task_union.stack)
/* In misc.c */
void _nmask_and_or_msr(unsigned long nmask, unsigned long or_val);
......
/*
* BK Id: SCCS/s.scatterlist.h 1.9 10/15/01 22:51:33 paulus
* BK Id: %F% %I% %G% %U% %#%
*/
#ifdef __KERNEL__
#ifndef _PPC_SCATTERLIST_H
......@@ -8,11 +8,10 @@
#include <asm/dma.h>
struct scatterlist {
struct page * page;
unsigned int offset;
dma_addr_t dma_address; /* phys/bus dma address */
unsigned int length; /* length */
struct page *page;
unsigned int offset;
dma_addr_t dma_address;
unsigned int length;
};
/*
......
......@@ -48,7 +48,7 @@ extern void smp_local_timer_interrupt(struct pt_regs *);
#define cpu_logical_map(cpu) (cpu)
#define cpu_number_map(x) (x)
#define smp_processor_id() (current->cpu)
#define smp_processor_id() (current_thread_info()->cpu)
extern int smp_hw_index[NR_CPUS];
#define hard_smp_processor_id() (smp_hw_index[smp_processor_id()])
......
/* thread_info.h: PPC low-level thread information
* adapted from the i386 version by Paul Mackerras
*
* Copyright (C) 2002 David Howells (dhowells@redhat.com)
* - Incorporating suggestions made by Linus Torvalds and Dave Miller
*/
#ifndef _ASM_THREAD_INFO_H
#define _ASM_THREAD_INFO_H
#ifdef __KERNEL__
#ifndef __ASSEMBLY__
#include <asm/processor.h>
/*
* low level task data.
*/
struct thread_info {
struct task_struct *task; /* main task structure */
struct exec_domain *exec_domain; /* execution domain */
unsigned long flags; /* low level flags */
int cpu; /* cpu we're on */
};
/*
* macros/functions for gaining access to the thread information structure
*/
#define INIT_THREAD_INFO(tsk) \
{ \
task: &tsk, \
exec_domain: &default_exec_domain, \
flags: 0, \
cpu: 0, \
}
#define init_thread_info (init_thread_union.thread_info)
#define init_stack (init_thread_union.stack)
/* how to get the thread information struct from C */
static inline struct thread_info *current_thread_info(void)
{
struct thread_info *ti;
__asm__("rlwinm %0,1,0,0,18" : "=r"(ti));
return ti;
}
/* thread information allocation */
#define alloc_thread_info() ((struct thread_info *) \
__get_free_pages(GFP_KERNEL, 1))
#define free_thread_info(ti) free_pages((unsigned long) (ti), 1)
#define get_thread_info(ti) get_task_struct((ti)->task)
#define put_thread_info(ti) put_task_struct((ti)->task)
#define THREAD_SIZE (2*PAGE_SIZE)
#endif /* __ASSEMBLY__ */
/*
* thread information flag bit numbers
*/
#define TIF_SYSCALL_TRACE 0 /* syscall trace active */
#define TIF_NOTIFY_RESUME 1 /* resumption notification requested */
#define TIF_SIGPENDING 2 /* signal pending */
#define TIF_NEED_RESCHED 3 /* rescheduling necessary */
#define TIF_POLLING_NRFLAG 4 /* true if poll_idle() is polling
TIF_NEED_RESCHED */
/* as above, but as bit values */
#define _TIF_SYSCALL_TRACE (1<<TIF_SYSCALL_TRACE)
#define _TIF_NOTIFY_RESUME (1<<TIF_NOTIFY_RESUME)
#define _TIF_SIGPENDING (1<<TIF_SIGPENDING)
#define _TIF_NEED_RESCHED (1<<TIF_NEED_RESCHED)
#define _TIF_POLLING_NRFLAG (1<<TIF_POLLING_NRFLAG)
#endif /* __KERNEL__ */
#endif /* _ASM_THREAD_INFO_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