Skip to content

Commit

Permalink
Merge master.kernel.org:/pub/scm/linux/kernel/git/paulus/ppc64-2.6
Browse files Browse the repository at this point in the history
  • Loading branch information
Linus Torvalds committed Sep 9, 2005
2 parents 0b968d2 + b2ad7b5 commit 3aed77b
Show file tree
Hide file tree
Showing 65 changed files with 530 additions and 529 deletions.
4 changes: 0 additions & 4 deletions arch/ppc/kernel/syscalls.c
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,6 @@
#include <asm/ipc.h>
#include <asm/semaphore.h>

void
check_bugs(void)
{
}

/*
* sys_ipc() is the de-multiplexer for the SysV IPC calls..
Expand Down
21 changes: 12 additions & 9 deletions arch/ppc64/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -89,11 +89,12 @@ 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-$(CONFIG_PPC_BPA) := zImage zImage.initrd
$(boottarget-y): vmlinux
boottargets-$(CONFIG_PPC_PSERIES) += zImage zImage.initrd
boottargets-$(CONFIG_PPC_PMAC) += zImage.vmode zImage.initrd.vmode
boottargets-$(CONFIG_PPC_MAPLE) += zImage zImage.initrd
boottargets-$(CONFIG_PPC_ISERIES) += vmlinux.sminitrd vmlinux.initrd vmlinux.sm
boottargets-$(CONFIG_PPC_BPA) += zImage zImage.initrd
$(boottargets-y): vmlinux
$(Q)$(MAKE) $(build)=$(boot) $(boot)/$@

bootimage-$(CONFIG_PPC_PSERIES) := $(boot)/zImage
Expand Down Expand Up @@ -131,10 +132,12 @@ include3/asm:
$(Q)ln -fsn $(srctree)/include/asm-powerpc include3/asm

define archhelp
echo '* zImage - Compressed kernel image (arch/$(ARCH)/boot/zImage)'
echo ' zImage.initrd- Compressed kernel image with initrd attached,'
echo ' sourced from arch/$(ARCH)/boot/ramdisk.image.gz'
echo ' (arch/$(ARCH)/boot/zImage.initrd)'
echo ' zImage.vmode - Compressed kernel image (arch/$(ARCH)/boot/zImage.vmode)'
echo ' zImage.initrd.vmode - Compressed kernel image with initrd attached,'
echo ' sourced from arch/$(ARCH)/boot/ramdisk.image.gz'
echo ' (arch/$(ARCH)/boot/zImage.initrd.vmode)'
echo ' zImage - zImage for pSeries machines'
echo ' zImage.initrd - zImage with initrd for pSeries machines'
endef

CLEAN_FILES += include/asm-ppc64/offsets.h
53 changes: 33 additions & 20 deletions arch/ppc64/boot/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,9 @@ quiet_cmd_bootcc = BOOTCC $@
quiet_cmd_bootas = BOOTAS $@
cmd_bootas = $(CROSS32CC) -Wp,-MD,$(depfile) $(BOOTAFLAGS) -c -o $@ $<

quiet_cmd_bootld = BOOTLD $@
cmd_bootld = $(CROSS32LD) $(BOOTLFLAGS) -o $@ $(2)

$(patsubst %.c,%.o, $(filter %.c, $(src-boot))): %.o: %.c
$(call if_changed_dep,bootcc)
$(patsubst %.S,%.o, $(filter %.S, $(src-boot))): %.o: %.S
Expand All @@ -53,7 +56,7 @@ src-sec = $(foreach section, $(1), $(patsubst %,$(obj)/kernel-%.c, $(section)))
gz-sec = $(foreach section, $(1), $(patsubst %,$(obj)/kernel-%.gz, $(section)))

hostprogs-y := addnote addRamDisk
targets += zImage zImage.initrd imagesize.c \
targets += zImage.vmode zImage.initrd.vmode zImage zImage.initrd imagesize.c \
$(patsubst $(obj)/%,%, $(call obj-sec, $(required) $(initrd))) \
$(patsubst $(obj)/%,%, $(call src-sec, $(required) $(initrd))) \
$(patsubst $(obj)/%,%, $(call gz-sec, $(required) $(initrd))) \
Expand All @@ -63,20 +66,28 @@ extra-y := initrd.o
quiet_cmd_ramdisk = RAMDISK $@
cmd_ramdisk = $(obj)/addRamDisk $(obj)/ramdisk.image.gz $< $@

quiet_cmd_stripvm = STRIP $@
quiet_cmd_stripvm = STRIP $@
cmd_stripvm = $(STRIP) -s $< -o $@

vmlinux.strip: vmlinux FORCE
$(call if_changed,stripvm)
$(obj)/vmlinux.initrd: vmlinux.strip $(obj)/addRamDisk $(obj)/ramdisk.image.gz FORCE
$(call if_changed,ramdisk)

addsection = $(CROSS32OBJCOPY) $(1) \
--add-section=.kernel:$(strip $(patsubst $(obj)/kernel-%.o,%, $(1)))=$(patsubst %.o,%.gz, $(1)) \
--set-section-flags=.kernel:$(strip $(patsubst $(obj)/kernel-%.o,%, $(1)))=$(OBJCOPYFLAGS)
quiet_cmd_addsection = ADDSEC $@
cmd_addsection = $(CROSS32OBJCOPY) $@ \
--add-section=.kernel:$(strip $(patsubst $(obj)/kernel-%.o,%, $@))=$(patsubst %.o,%.gz, $@) \
--set-section-flags=.kernel:$(strip $(patsubst $(obj)/kernel-%.o,%, $@))=$(OBJCOPYFLAGS)

quiet_cmd_imagesize = GENSIZE $@
cmd_imagesize = ls -l vmlinux.strip | \
awk '{printf "/* generated -- do not edit! */\n" "unsigned long vmlinux_filesize = %d;\n", $$5}' \
> $(obj)/imagesize.c && \
$(CROSS_COMPILE)nm -n vmlinux | tail -n 1 | \
awk '{printf "unsigned long vmlinux_memsize = 0x%s;\n", substr($$1,8)}' >> $(obj)/imagesize.c

quiet_cmd_addnote = ADDNOTE $@
cmd_addnote = $(CROSS32LD) $(BOOTLFLAGS) -o $@ $(obj-boot) && $(obj)/addnote $@
quiet_cmd_addnote = ADDNOTE $@
cmd_addnote = $(obj)/addnote $@

$(call gz-sec, $(required)): $(obj)/kernel-%.gz: % FORCE
$(call if_changed,gzip)
Expand All @@ -85,28 +96,30 @@ $(obj)/kernel-initrd.gz: $(obj)/ramdisk.image.gz
cp -f $(obj)/ramdisk.image.gz $@

$(call src-sec, $(required) $(initrd)): $(obj)/kernel-%.c: $(obj)/kernel-%.gz FORCE
touch $@
@touch $@

$(call obj-sec, $(required) $(initrd)): $(obj)/kernel-%.o: $(obj)/kernel-%.c FORCE
$(call if_changed_dep,bootcc)
$(call addsection, $@)
$(call cmd,addsection)

$(obj)/zImage.vmode: obj-boot += $(call obj-sec, $(required))
$(obj)/zImage.vmode: $(call obj-sec, $(required)) $(obj-boot) FORCE
$(call cmd,bootld,$(obj-boot))

$(obj)/zImage.initrd.vmode: obj-boot += $(call obj-sec, $(required) $(initrd))
$(obj)/zImage.initrd.vmode: $(call obj-sec, $(required) $(initrd)) $(obj-boot) FORCE
$(call cmd,bootld,$(obj-boot))

$(obj)/zImage: obj-boot += $(call obj-sec, $(required))
$(obj)/zImage: $(call obj-sec, $(required)) $(obj-boot) $(obj)/addnote FORCE
$(obj)/zImage: $(obj)/zImage.vmode $(obj)/addnote FORCE
@cp -f $< $@
$(call if_changed,addnote)

$(obj)/zImage.initrd: obj-boot += $(call obj-sec, $(required) $(initrd))
$(obj)/zImage.initrd: $(call obj-sec, $(required) $(initrd)) $(obj-boot) $(obj)/addnote FORCE
$(obj)/zImage.initrd: $(obj)/zImage.initrd.vmode $(obj)/addnote FORCE
@cp -f $< $@
$(call if_changed,addnote)

$(obj)/imagesize.c: vmlinux.strip
@echo Generating $@
ls -l vmlinux.strip | \
awk '{printf "/* generated -- do not edit! */\n" \
"unsigned long vmlinux_filesize = %d;\n", $$5}' > $(obj)/imagesize.c
$(CROSS_COMPILE)nm -n vmlinux | tail -n 1 | \
awk '{printf "unsigned long vmlinux_memsize = 0x%s;\n", substr($$1,8)}' \
>> $(obj)/imagesize.c
$(call cmd,imagesize)

install: $(CONFIGURE) $(BOOTIMAGE)
sh -x $(srctree)/$(src)/install.sh "$(KERNELRELEASE)" vmlinux System.map "$(INSTALL_PATH)" "$(BOOTIMAGE)"
Expand Down
31 changes: 26 additions & 5 deletions arch/ppc64/boot/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ extern void flush_cache(void *, unsigned long);

/* Value picked to match that used by yaboot */
#define PROG_START 0x01400000
#define RAM_END (256<<20) // Fixme: use OF */
#define RAM_END (512<<20) // Fixme: use OF */
#define ONE_MB 0x100000

static char *avail_ram;
static char *begin_avail, *end_avail;
Expand All @@ -32,6 +33,7 @@ static unsigned int heap_use;
static unsigned int heap_max;

extern char _start[];
extern char _end[];
extern char _vmlinux_start[];
extern char _vmlinux_end[];
extern char _initrd_start[];
Expand All @@ -58,13 +60,13 @@ typedef void (*kernel_entry_t)( unsigned long,

#undef DEBUG

static unsigned long claim_base = PROG_START;
static unsigned long claim_base;

static unsigned long try_claim(unsigned long size)
{
unsigned long addr = 0;

for(; claim_base < RAM_END; claim_base += 0x100000) {
for(; claim_base < RAM_END; claim_base += ONE_MB) {
#ifdef DEBUG
printf(" trying: 0x%08lx\n\r", claim_base);
#endif
Expand Down Expand Up @@ -95,7 +97,26 @@ void start(unsigned long a1, unsigned long a2, void *promptr)
if (getprop(chosen_handle, "stdin", &stdin, sizeof(stdin)) != 4)
exit();

printf("\n\rzImage starting: loaded at 0x%x\n\r", (unsigned)_start);
printf("\n\rzImage starting: loaded at 0x%lx\n\r", (unsigned long) _start);

/*
* The first available claim_base must be above the end of the
* the loaded kernel wrapper file (_start to _end includes the
* initrd image if it is present) and rounded up to a nice
* 1 MB boundary for good measure.
*/

claim_base = _ALIGN_UP((unsigned long)_end, ONE_MB);

#if defined(PROG_START)
/*
* Maintain a "magic" minimum address. This keeps some older
* firmware platforms running.
*/

if (claim_base < PROG_START)
claim_base = PROG_START;
#endif

/*
* Now we try to claim some memory for the kernel itself
Expand All @@ -105,7 +126,7 @@ void start(unsigned long a1, unsigned long a2, void *promptr)
* size... In practice we add 1Mb, that is enough, but we should really
* consider fixing the Makefile to put a _raw_ kernel in there !
*/
vmlinux_memsize += 0x100000;
vmlinux_memsize += ONE_MB;
printf("Allocating 0x%lx bytes for kernel ...\n\r", vmlinux_memsize);
vmlinux.addr = try_claim(vmlinux_memsize);
if (vmlinux.addr == 0) {
Expand Down
28 changes: 21 additions & 7 deletions arch/ppc64/kernel/bpa_iic.c
Original file line number Diff line number Diff line change
Expand Up @@ -205,25 +205,39 @@ static struct iic_regs __iomem *find_iic(int cpu)
}

#ifdef CONFIG_SMP

/* Use the highest interrupt priorities for IPI */
static inline int iic_ipi_to_irq(int ipi)
{
return IIC_IPI_OFFSET + IIC_NUM_IPIS - 1 - ipi;
}

static inline int iic_irq_to_ipi(int irq)
{
return IIC_NUM_IPIS - 1 - (irq - IIC_IPI_OFFSET);
}

void iic_setup_cpu(void)
{
out_be64(&__get_cpu_var(iic).regs->prio, 0xff);
}

void iic_cause_IPI(int cpu, int mesg)
{
out_be64(&per_cpu(iic, cpu).regs->generate, mesg);
out_be64(&per_cpu(iic, cpu).regs->generate, (IIC_NUM_IPIS - 1 - mesg) << 4);
}

static irqreturn_t iic_ipi_action(int irq, void *dev_id, struct pt_regs *regs)
{

smp_message_recv(irq - IIC_IPI_OFFSET, regs);
smp_message_recv(iic_irq_to_ipi(irq), regs);
return IRQ_HANDLED;
}

static void iic_request_ipi(int irq, const char *name)
static void iic_request_ipi(int ipi, const char *name)
{
int irq;

irq = iic_ipi_to_irq(ipi);
/* IPIs are marked SA_INTERRUPT as they must run with irqs
* disabled */
get_irq_desc(irq)->handler = &iic_pic;
Expand All @@ -233,10 +247,10 @@ static void iic_request_ipi(int irq, const char *name)

void iic_request_IPIs(void)
{
iic_request_ipi(IIC_IPI_OFFSET + PPC_MSG_CALL_FUNCTION, "IPI-call");
iic_request_ipi(IIC_IPI_OFFSET + PPC_MSG_RESCHEDULE, "IPI-resched");
iic_request_ipi(PPC_MSG_CALL_FUNCTION, "IPI-call");
iic_request_ipi(PPC_MSG_RESCHEDULE, "IPI-resched");
#ifdef CONFIG_DEBUGGER
iic_request_ipi(IIC_IPI_OFFSET + PPC_MSG_DEBUGGER_BREAK, "IPI-debug");
iic_request_ipi(PPC_MSG_DEBUGGER_BREAK, "IPI-debug");
#endif /* CONFIG_DEBUGGER */
}
#endif /* CONFIG_SMP */
Expand Down
Loading

0 comments on commit 3aed77b

Please sign in to comment.