Commit de6639d2 authored by Linus Torvalds's avatar Linus Torvalds

Merge bk://ppc.bkbits.net/for-linus-ppc

into home.transmeta.com:/home/torvalds/v2.5/linux
parents 393a9572 69d423da
......@@ -64,7 +64,7 @@ drivers-$(CONFIG_8xx) += arch/ppc/8xx_io/
drivers-$(CONFIG_4xx) += arch/ppc/4xx_io/
drivers-$(CONFIG_8260) += arch/ppc/8260_io/
MAKEBOOT = $(MAKE) -C arch/$(ARCH)/boot
makeboot = $(call descend,arch/ppc/boot,$(1))
BOOT_TARGETS = zImage zImage.initrd znetboot znetboot.initrd pImage vmlinux.sm
......@@ -74,14 +74,14 @@ AFLAGS_vmlinux.lds.o := -Upowerpc
bzImage: zImage
$(BOOT_TARGETS): vmlinux
@$(MAKEBOOT) $@
+@$(call makeboot,$@)
%_config: arch/ppc/configs/%_defconfig
rm -f .config arch/ppc/defconfig
cp -f arch/ppc/configs/$(@:config=defconfig) .config
archclean:
@$(MAKEBOOT) clean
+@$(call makeboot,clean)
archmrproper:
......
......@@ -10,25 +10,16 @@
# modified by Cort (cort@cs.nmt.edu)
#
GZIP_FLAGS = -v9f
CFLAGS += -fno-builtin -D__BOOTER__ -I$(TOPDIR)/arch/$(ARCH)/boot/include
AFLAGS += -D__BOOTER__
OBJCOPY_ARGS = -O elf32-powerpc
MKIMAGE := ./utils/mkimage.wrapper
lib/lib.a: lib/zlib.c
$(MAKE) -C lib
subdir-y := simple
subdir-$(CONFIG_ALL_PPC) := openfirmware prep
images/vmlinux.gz: $(TOPDIR)/vmlinux
$(MAKE) -C images vmlinux.gz
HOSTCFLAGS += -Iarch/$(ARCH)/boot/include
# Subdirs and tools needed for each. Assume we always need to go into
# 'simple' unless told otherwise.
subdir-y := lib common simple
subdir-$(CONFIG_ALL_PPC) := openfirmware prep
tools-$(CONFIG_ALL_PPC) := addnote mknote hack-coff mkprep
tools-$(CONFIG_PPLUS) := mkbugboot mkprep
tools-$(CONFIG_4xx) := mktree
......@@ -40,49 +31,24 @@ tools-$(CONFIG_PRPMC750) := mkbugboot mkprep
tools-$(CONFIG_PRPMC800) := mkbugboot mkprep
tools-$(CONFIG_SPRUCE) := mktree
# These are dirs we don't want to go into on BOOT_TARGETS. We have them for
# the 'depend' stage.
NONBOOT := lib common
all-tools := addnote mknote hack-coff mkprep mkbugboot mktree
# These are the subdirs we want to use
BOOTDIRS = $(filter-out $(NONBOOT), $(subdir-y))
host-progs := $(addprefix utils/,$(tools-y))
makeof1275:
$(MAKE) -C of1275
# This will make the tools we need. We do it like this to ensure that we use
# HOSTCC. -- Tom
maketools:
$(MAKE) -C utils $(tools-y)
# The targets all boards support for boot images.
BOOT_TARGETS = zImage zImage.initrd znetboot znetboot.initrd
include $(TOPDIR)/Rules.make
$(BOOT_TARGETS): vmapus lib/lib.a images/vmlinux.gz makeof1275 maketools
ifneq ($(BOOTDIRS),)
for d in $(BOOTDIRS); do $(MAKE) -C $$d $@; done
endif
zImage zImage.initrd znetboot znetboot.initrd: $(subdir-y)
vmapus: $(TOPDIR)/vmlinux
ifdef CONFIG_APUS
$(STRIP) $(TOPDIR)/vmlinux -o images/vmapus
gzip $(GZIP_FLAGS) images/vmapus
endif
simple openfirmware prep: lib common images
openfirmware prep: of1275
# Make an image for PPCBoot
pImage: images/vmlinux.gz
$(MKIMAGE) -A ppc -O linux -T kernel -C gzip -a 00000000 -e 00000000 \
-n 'Linux-$(VERSION).$(PATCHLEVEL).$(SUBLEVEL)$(EXTRAVERSION)' \
-d $< images/vmlinux.PPCBoot
ln -sf vmlinux.PPCBoot images/pImage
lib common of1275 images: FORCE
+@$(call descend,$(obj)/$@,)
vmlinux.sm: $(TOPDIR)/vmlinux utils/addSystemMap
./utils/addSystemMap $(TOPDIR)/System.map $(TOPDIR)/vmlinux images/vmlinux.sm
openfirmware prep simple: FORCE
+@$(call descend,$(obj)/$@,$(MAKECMDGOALS))
# These are subdirs with files not normally rm'ed. -- Tom
clean:
$(MAKE) -C images clean
$(MAKE) -C utils clean
$(MAKE) -C openfirmware clean
CLEAN_FILES += $(addprefix $(obj)/utils,$(all-tools))
include $(TOPDIR)/Rules.make
clean: FORCE
+@$(call descend,$(obj)/images,clean)
......@@ -8,7 +8,12 @@
# Tom Rini January 2001
#
coffcrt0.o:
$(CC) $(AFLAGS) -DXCOFF -traditional -c -o coffcrt0.o crt0.S
L_TARGET := lib.a
obj-y := string.o util.o misc-common.o
obj-$(CONFIG_ALL_PPC) += mpc10x_memory.o
obj-$(CONFIG_LOPEC) += mpc10x_memory.o
obj-$(CONFIG_PAL4) += cpc700_memory.o
obj-$(CONFIG_SERIAL_8250_CONSOLE) += ns16550.o
include $(TOPDIR)/Rules.make
......@@ -2,11 +2,16 @@
# This dir holds all of the images for PPC machines.
# Tom Rini January 2001
all: $(obj)/vmlinux.gz
include $(TOPDIR)/Rules.make
vmlinux.gz: $(TOPDIR)/vmlinux
$(OBJCOPY) --strip-all -S -O binary $(TOPDIR)/vmlinux vmlinux
gzip -vf9 vmlinux
GZIP_FLAGS = -v9f
$(obj)/vmlinux.gz: vmlinux
$(OBJCOPY) -S -O binary vmlinux $(obj)/vmlinux
gzip $(GZIP_FLAGS) $(obj)/vmlinux
clean:
rm -f sImage vmapus vmlinux* miboot* zImage* zvmlinux*
rm -f $(obj)/sImage $(obj)/vmapus $(obj)/vmlinux* $(obj)/miboot*
rm -f $(obj)/zImage* z$(obj)/vmlinux*
......@@ -58,7 +58,7 @@
#define MPC10X_MCTLR_EXT_MEM_START_2 0x8c /* Banks 4-7 */
#define MPC10X_MCTLR_MEM_END_1 0x90 /* Banks 0-3 */
#define MPC10X_MCTLR_MEM_END_2i 0x94 /* Banks 4-7 */
#define MPC10X_MCTLR_MEM_END_2 0x94 /* Banks 4-7 */
#define MPC10X_MCTLR_EXT_MEM_END_1 0x98 /* Banks 0-3 */
#define MPC10X_MCTLR_EXT_MEM_END_2 0x9c /* Banks 4-7 */
......
......@@ -4,6 +4,6 @@
L_TARGET := lib.a
obj-y := zlib.o
obj-y := zlib.o div64.o
include $(TOPDIR)/Rules.make
/*
* Divide a 64-bit unsigned number by a 32-bit unsigned number.
* This routine assumes that the top 32 bits of the dividend are
* non-zero to start with.
* On entry, r3 points to the dividend, which get overwritten with
* the 64-bit quotient, and r4 contains the divisor.
* On exit, r3 contains the remainder.
*
* Copyright (C) 2002 Paul Mackerras, 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.
*/
#include <asm/ppc_asm.h>
#include <asm/processor.h>
_GLOBAL(__div64_32)
lwz r5,0(r3) # get the dividend into r5/r6
lwz r6,4(r3)
cmplw r5,r4
li r7,0
li r8,0
blt 1f
divwu r7,r5,r4 # if dividend.hi >= divisor,
mullw r0,r7,r4 # quotient.hi = dividend.hi / divisor
subf. r5,r0,r5 # dividend.hi %= divisor
beq 3f
1: mr r11,r5 # here dividend.hi != 0
andis. r0,r5,0xc000
bne 2f
cntlzw r0,r5 # we are shifting the dividend right
li r10,-1 # to make it < 2^32, and shifting
srw r10,r10,r0 # the divisor right the same amount,
add r9,r4,r10 # rounding up (so the estimate cannot
andc r11,r6,r10 # ever be too large, only too small)
andc r9,r9,r10
or r11,r5,r11
rotlw r9,r9,r0
rotlw r11,r11,r0
divwu r11,r11,r9 # then we divide the shifted quantities
2: mullw r10,r11,r4 # to get an estimate of the quotient,
mulhwu r9,r11,r4 # multiply the estimate by the divisor,
subfc r6,r10,r6 # take the product from the divisor,
add r8,r8,r11 # and add the estimate to the accumulated
subfe. r5,r9,r5 # quotient
bne 1b
3: cmplw r6,r4
blt 4f
divwu r0,r6,r4 # perform the remaining 32-bit division
mullw r10,r0,r4 # and get the remainder
add r8,r8,r0
subf r6,r10,r6
4: stw r7,0(r3) # return the quotient in *r3
stw r8,4(r3)
mr r3,r6 # return the remainder in r3
blr
......@@ -2,7 +2,7 @@
# Makefile of1275 stuff
#
L_TARGET := of1275.a
L_TARGET := lib.a
obj-y := claim.o enter.o exit.o finddevice.o getprop.o ofinit.o \
ofstdio.o read.o release.o write.o
......
......@@ -10,24 +10,37 @@
# Merged 'chrp' and 'pmac' into 'openfirmware', and cleaned up the
# rules.
EXTRA_TARGETS := start.o misc.o crt0.o coffcrt0.o coffmain.o chrpmain.o \
newworldmain.o common.o
boot: zImage
include $(TOPDIR)/Rules.make
boot := arch/ppc/boot
common := $(boot)/common
utils := $(boot)/utils
bootlib := $(boot)/lib
of1275 := $(boot)/of1275
images := $(boot)/images
OBJCOPY_ARGS = -O aixcoff-rs6000 -R .stab -R .stabstr -R .comment
COFF_LD_ARGS = -T ../ld.script -e _start -Ttext 0x00500000 -Bstatic
CHRP_LD_ARGS = -T ../ld.script -e _start -Ttext 0x00400000
NEWWORLD_LD_ARGS = -T ../ld.script -e _start -Ttext 0x01000000
COFF_LD_ARGS = -T $(boot)/ld.script -e _start -Ttext 0x00700000 -Bstatic
CHRP_LD_ARGS = -T $(boot)/ld.script -e _start -Ttext 0x00800000
NEWWORLD_LD_ARGS = -T $(boot)/ld.script -e _start -Ttext 0x01000000
COMMONOBJS = start.o misc.o ../common/string.o common.o
COFFOBJS = ../common/coffcrt0.o $(COMMONOBJS) coffmain.o
CHRPOBJS = ../common/crt0.o $(COMMONOBJS) chrpmain.o
NEWWORLDOBJS = ../common/crt0.o $(COMMONOBJS) newworldmain.o
COMMONOBJS = $(obj)/start.o $(obj)/misc.o $(obj)/common.o
COFFOBJS = $(obj)/coffcrt0.o $(COMMONOBJS) $(obj)/coffmain.o
CHRPOBJS = $(obj)/crt0.o $(COMMONOBJS) $(obj)/chrpmain.o
NEWWORLDOBJS = $(obj)/crt0.o $(COMMONOBJS) $(obj)/newworldmain.o
EXTRA_TARGETS := $(COFFOBJS) $(CHRPOBJS) $(NEWWORLDOBJS)
LIBS = $(TOPDIR)/lib/lib.a ../lib/lib.a ../of1275/of1275.a
LIBS = lib/lib.a $(bootlib)/lib.a $(of1275)/lib.a $(common)/lib.a
ADDNOTE := ../utils/addnote
MKNOTE := ../utils/mknote
SIZE := ../utils/size
OFFSET := ../utils/offset
HACKCOFF := ../utils/hack-coff
ADDNOTE := $(utils)/addnote
MKNOTE := $(utils)/mknote
SIZE := $(utils)/size
OFFSET := $(utils)/offset
HACKCOFF := $(utils)/hack-coff
ifdef CONFIG_SMP
END := .smp
......@@ -38,12 +51,12 @@ endif
TFTPIMAGE=/tftpboot/zImage.
../common/coffcrt0.o:
$(MAKE) -C ../common coffcrt0.o
$(obj)/dummy.o: $(common)/dummy.c
$(CC) -c -o $@ $(common)/dummy.c
image.o: ../images/vmlinux.gz ../common/dummy.o
$(OBJCOPY) ../common/dummy.o $@ -R .comment \
--add-section=.image=../images/vmlinux.gz \
$(obj)/image.o: $(images)/vmlinux.gz $(obj)/dummy.o
$(OBJCOPY) $(obj)/dummy.o $@ -R .comment \
--add-section=.image=$(images)/vmlinux.gz \
--set-section-flags=.image=contents,alloc,load,readonly,data
ifdef CONFIG_XMON
$(OBJCOPY) $@ $@ \
......@@ -52,86 +65,93 @@ ifdef CONFIG_XMON
endif
# Place the ramdisk in the initrd image.
image-initrd.o: image.o ../images/ramdisk.image.gz
$(OBJCOPY) image.o $@ \
--add-section=.ramdisk=../images/ramdisk.image.gz \
$(obj)/image-initrd.o: $(obj)/image.o $(images)/ramdisk.image.gz
$(OBJCOPY) $(obj)/image.o $@ \
--add-section=.ramdisk=$(images)/ramdisk.image.gz \
--set-section-flags=.ramdisk=contents,alloc,load,readonly,data
# Create the note section for New-World PowerMacs.
note: $(MKNOTE)
$(MKNOTE) > note
znetboot: vmlinux.coff vmlinux.elf-pmac zImage
cp ../images/vmlinux.coff $(TFTPIMAGE).pmac$(END)
cp ../images/vmlinux.elf-pmac $(TFTPIMAGE).pmac$(END)elf
cp ../images/zImage.chrp $(TFTPIMAGE).chrp$(END)
znetboot.initrd: vmlinux.initrd.coff vmlinux.initrd.elf-pmac
cp ../images/vmlinux.initrd.coff $(TFTPIMAGE).pmac$(END)
cp ../images/vmlinux.initrd.elf-pmac $(TFTPIMAGE).pmac$(END).elf
cp ../images/zImage.initrd.chrp $(TFTPIMAGE).chrp$(END)
$(obj)/note: $(MKNOTE)
$(MKNOTE) > $(obj)/note
znetboot: $(images)/vmlinux.coff $(images)/vmlinux.elf-pmac $(images)/zImage.chrp
cp $(images)/vmlinux.coff $(TFTPIMAGE).pmac$(END)
cp $(images)/vmlinux.elf-pmac $(TFTPIMAGE).pmac$(END)elf
cp $(images)/zImage.chrp $(TFTPIMAGE).chrp$(END)
znetboot.initrd: $(images)/vmlinux.initrd.coff \
$(images)/vmlinux.initrd.elf-pmac \
$(images)/zImage.initrd.chrp
cp $(images)/vmlinux.initrd.coff $(TFTPIMAGE).pmac$(END)
cp $(images)/vmlinux.initrd.elf-pmac $(TFTPIMAGE).pmac$(END).elf
cp $(images)/zImage.initrd.chrp $(TFTPIMAGE).chrp$(END)
$(images)/miboot.image: $(obj)/dummy.o $(images)/vmlinux.gz
$(OBJCOPY) $(OBJCOPY_ARGS) --add-section=image=$(images)/vmlinux.gz \
$(obj)/dummy.o $@
$(images)/miboot.initrd.image: $(images)/miboot.image $(images)/ramdisk.image.gz
$(OBJCOPY) $(OBJCOPY_ARGS) \
--add-section=initrd=$(images)/ramdisk.image.gz \
$(images)/miboot.image $@
miboot.image: ../common/dummy.o ../images/vmlinux.gz
$(OBJCOPY) $(OBJCOPY_ARGS) --add-section=image=../images/vmlinux.gz \
../common/dummy.o ../images/$@
$(obj)/coffcrt0.o: $(common)/crt0.S
$(CC) $(AFLAGS) -DXCOFF -traditional -c -o $@ $(common)/crt0.S
miboot.initrd.image: miboot.image ../images/ramdisk.image.gz
$(OBJCOPY) $(OBJCOPY_ARGS) \
--add-section=initrd=../images/ramdisk.image.gz \
../images/miboot.image ../images/$@
$(obj)/crt0.o: $(common)/crt0.S
$(CC) $(AFLAGS) -traditional -c -o $@ $(common)/crt0.S
coffboot: $(COFFOBJS) image.o $(LIBS)
$(obj)/coffboot: $(COFFOBJS) $(obj)/image.o $(LIBS)
$(LD) -o $@ $(COFF_LD_ARGS) $^
$(OBJCOPY) $@ $@ -R .comment -R .ramdisk
coffboot.initrd: $(COFFOBJS) image-initrd.o $(LIBS)
$(obj)/coffboot.initrd: $(COFFOBJS) $(obj)/image-initrd.o $(LIBS)
$(LD) -o $@ $(COFF_LD_ARGS) $^
$(OBJCOPY) $@ $@ -R .comment
vmlinux.coff: coffboot $(HACKCOFF)
$(OBJCOPY) $(OBJCOPY_ARGS) coffboot ../images/$@
$(HACKCOFF) ../images/$@
rm -f coffboot
ln -sf vmlinux.coff ../images/zImage.pmac
vmlinux.initrd.coff: coffboot.initrd $(HACKCOFF)
$(OBJCOPY) $(OBJCOPY_ARGS) coffboot.initrd ../images/$@
$(HACKCOFF) ../images/$@
rm -f coffboot.initrd
ln -sf vmlinux.initrd.coff ../images/zImage.initrd.pmac
vmlinux.elf-pmac: $(NEWWORLDOBJS) $(LIBS) image.o
$(LD) $(NEWWORLD_LD_ARGS) -o ../images/$@ $^
vmlinux.initrd.elf-pmac: $(NEWWORLDOBJS) $(LIBS) image-initrd.o
$(LD) $(NEWWORLD_LD_ARGS) -o ../images/$@ $^
zImage.chrp: $(CHRPOBJS) image.o $(LIBS)
$(LD) $(CHRP_LD_ARGS) -o ../images/$@ $^
zImage.initrd.chrp: $(CHRPOBJS) image-initrd.o $(LIBS)
$(LD) $(CHRP_LD_ARGS) -o ../images/$@ $^
zImage: vmlinux.coff vmlinux.elf-pmac zImage.chrp miboot.image $(ADDNOTE) \
note
$(OBJCOPY) ../images/vmlinux.elf-pmac ../images/vmlinux.elf-pmac \
--add-section=.note=note -R .comment -R .ramdisk
$(OBJCOPY) ../images/zImage.chrp ../images/zImage.chrp \
-R .comment -R .ramdisk
cp ../images/zImage.chrp ../images/zImage.chrp-rs6k
$(ADDNOTE) ../images/zImage.chrp-rs6k
zImage.initrd: vmlinux.initrd.coff vmlinux.initrd.elf-pmac zImage.initrd.chrp \
miboot.initrd.image $(ADDNOTE) note
$(OBJCOPY) ../images/vmlinux.initrd.elf-pmac \
../images/vmlinux.initrd.elf-pmac --add-section=.note=note \
-R .comment
$(OBJCOPY) ../images/zImage.initrd.chrp ../images/zImage.initrd.chrp \
-R .comment
cp ../images/zImage.initrd.chrp ../images/zImage.initrd.chrp-rs6k
$(ADDNOTE) ../images/zImage.initrd.chrp-rs6k
$(images)/vmlinux.coff: $(obj)/coffboot
$(OBJCOPY) $(OBJCOPY_ARGS) $(obj)/coffboot $@
$(HACKCOFF) $@
ln -sf vmlinux.coff $(images)/zImage.pmac
clean:
rm -f note
$(images)/vmlinux.initrd.coff: $(obj)/coffboot.initrd
$(OBJCOPY) $(OBJCOPY_ARGS) $(obj)/coffboot.initrd $@
$(HACKCOFF) $@
ln -sf vmlinux.initrd.coff $(images)/zImage.initrd.pmac
include $(TOPDIR)/Rules.make
$(images)/vmlinux.elf-pmac: $(NEWWORLDOBJS) $(LIBS) $(obj)/image.o $(obj)/note
$(LD) $(NEWWORLD_LD_ARGS) -o $@ $(NEWWORLDOBJS) $(LIBS) $(obj)/image.o
$(OBJCOPY) $@ $@ \
--add-section=.note=$(obj)/note -R .comment -R .ramdisk
$(images)/vmlinux.initrd.elf-pmac: $(NEWWORLDOBJS) $(LIBS) \
$(obj)/image-initrd.o $(obj)/note
$(LD) $(NEWWORLD_LD_ARGS) -o $@ $(NEWWORLDOBJS) $(LIBS) \
$(obj)/image-initrd.o
$(OBJCOPY) $@ $@ \
--add-section=.note=$(obj)/note -R .comment
$(images)/zImage.chrp: $(CHRPOBJS) $(obj)/image.o $(LIBS)
$(LD) $(CHRP_LD_ARGS) -o $@ $^
$(OBJCOPY) $@ $@ -R .comment -R .ramdisk
$(images)/zImage.initrd.chrp: $(CHRPOBJS) $(obj)/image-initrd.o $(LIBS)
$(LD) $(CHRP_LD_ARGS) -o $@ $^
$(OBJCOPY) $@ $@ -R .comment
$(images)/zImage.chrp-rs6k: $(images)/zImage.chrp
cp $(images)/zImage.chrp $@
$(ADDNOTE) $@
$(images)/zImage.initrd.chrp-rs6k: $(images)/zImage.initrd.chrp
cp $(images)/zImage.initrd.chrp $@
$(ADDNOTE) $@
zImage: $(images)/vmlinux.coff $(images)/vmlinux.elf-pmac \
$(images)/zImage.chrp $(images)/miboot.image
zImage.initrd: $(images)/vmlinux.initrd.coff $(images)/vmlinux.initrd.elf-pmac\
$(images)/zImage.initrd.chrp $(images)/miboot.initrd.image
clean:
rm -f $(obj)/note $(obj)/image.o $(obj)/coffboot $(obj)/coffboot.initrd
......@@ -13,65 +13,79 @@
# modified by Cort (cort@cs.nmt.edu)
#
boot: zImage
TFTPIMAGE = /tftpboot/zImage.prep
ifeq ($(CONFIG_SMP),y)
TFTPIMAGE = $(TFTPBOOT).smp
endif
LD_ARGS = -T ../ld.script -Ttext 0x00800000 -Bstatic
boot-y := head.o ../simple/legacy.o misc.o \
../common/util.o ../common/string.o \
../common/misc-common.o \
../common/mpc10x_memory.o
LD_ARGS = -T $(boot)/ld.script -Ttext 0x00800000 -Bstatic
OBJCOPY_ARGS = -O elf32-powerpc
LIBS = ../lib/lib.a
LIBS = $(common)/lib.a $(bootlib)/lib.a
boot-$(CONFIG_SERIAL_8250_CONSOLE) += ../common/ns16550.o
boot-y := head.o misc.o
boot-$(CONFIG_VGA_CONSOLE) += vreset.o kbd.o
EXTRA_TARGETS := $(boot-y)
EXTRA_TARGETS := $(boot-y) ../simple/legacy.o
include $(TOPDIR)/Rules.make
boot := arch/ppc/boot
common := $(boot)/common
utils := $(boot)/utils
bootlib := $(boot)/lib
of1275 := $(boot)/of1275
images := $(boot)/images
simple := $(boot)/simple
OBJS := $(addprefix $(obj)/,$(boot-y)) $(simple)/legacy.o
# Tools
MKPREP := ../utils/mkprep
SIZE := ../utils/size
OFFSET := ../utils/offset
MKPREP := $(utils)/mkprep
SIZE := $(utils)/size
OFFSET := $(utils)/offset
# Extra include search dirs
CFLAGS_kbd.o += -I$(TOPDIR)/drivers/char
CFLAGS_kbd.o += -Idrivers/char
all: zImage
zImage: $(images)/zImage.prep
zImage.initrd: $(images)/zImage.initrd.prep
zImage: $(boot-y) $(LIBS) ../ld.script ../images/vmlinux.gz ../common/dummy.o \
$(MKPREP)
$(obj)/dummy.o: $(common)/dummy.c
$(CC) -c -o $@ $(common)/dummy.c
$(images)/zImage.prep: $(OBJS) $(LIBS) $(boot)/ld.script \
$(images)/vmlinux.gz $(obj)/dummy.o
$(OBJCOPY) $(OBJCOPY_ARGS) -R .comment \
--add-section=.image=../images/vmlinux.gz \
--add-section=.image=$(images)/vmlinux.gz \
--set-section-flags=.image=contents,alloc,load,readonly,data \
../common/dummy.o image.o
$(LD) $(LD_ARGS) -o $@ $(boot-y) image.o $(LIBS)
$(OBJCOPY) $(OBJCOPY_ARGS) $@ $@ -R .comment -R .stab -R .stabstr
$(MKPREP) -pbp $@ ../images/$@.prep
rm -f $@
zImage.initrd: $(boot-y) $(LIBS) ../ld.script ../images/vmlinux.gz $(MKPREP) \
../common/dummy.o
$(obj)/dummy.o $(obj)/image.o
$(LD) $(LD_ARGS) -o $(obj)/zImage $(OBJS) $(obj)/image.o $(LIBS)
$(OBJCOPY) $(OBJCOPY_ARGS) $(obj)/zImage $(obj)/zImage \
-R .comment -R .stab -R .stabstr
$(MKPREP) -pbp $(obj)/zImage $@
rm -f $(obj)/zImage
$(images)/zImage.initrd.prep: $(OBJS) $(LIBS) $(boot)/ld.script \
$(images)/vmlinux.gz $(obj)/dummy.o
$(OBJCOPY) $(OBJCOPY_ARGS) -R .comment \
--add-section=.ramdisk=../images/ramdisk.image.gz \
--add-section=.ramdisk=$(images)/ramdisk.image.gz \
--set-section-flags=.ramdisk=contents,alloc,load,readonly,data \
--add-section=.image=../images/vmlinux.gz \
--add-section=.image=$(images)/vmlinux.gz \
--set-section-flags=.image=contents,alloc,load,readonly,data \
../common/dummy.o image.o
$(LD) $(LD_ARGS) -o $@ $(boot-y) image.o $(LIBS)
$(OBJCOPY) $(OBJCOPY_ARGS) $@ $@ -R .comment -R .stab -R .stabstr
$(MKPREP) -pbp $@ ../images/$@.prep
rm -f $@
$(obj)/dummy.o $(obj)/image.o
$(LD) $(LD_ARGS) -o $(obj)/zImage.initrd $(OBJS) $(obj)/image.o $(LIBS)
$(OBJCOPY) $(OBJCOPY_ARGS) $(obj)/zImage.initrd $(obj)/zImage.initrd \
-R .comment -R .stab -R .stabstr
$(MKPREP) -pbp $(obj)/zImage.initrd $@
rm -f $(obj)/zImage.initrd
floppy: zImage
dd if=../images/zImage.prep of=/dev/fd0H1440 bs=64b
dd if=$(images)/zImage.prep of=/dev/fd0H1440 bs=64b
znetboot : zImage
cp ../images/zImage.prep $(TFTPIMAGE)
cp $(images)/zImage.prep $(TFTPIMAGE)
znetboot.initrd : zImage.initrd
cp ../images/zImage.initrd.prep $(TFTPIMAGE)
include $(TOPDIR)/Rules.make
cp $(images)/zImage.initrd.prep $(TFTPIMAGE)
......@@ -132,11 +132,6 @@ decompress_kernel(unsigned long load_addr, int num_words, unsigned long cksum,
vga_init((unsigned char *)0xC0000000);
#endif /* CONFIG_VGA_CONSOLE */
/*
* Find out how much memory we have.
*/
TotalMemory = get_mem_size();
/*
* Tell the user where we were loaded at and where we were relocated
* to for debugging this process.
......@@ -215,6 +210,29 @@ decompress_kernel(unsigned long load_addr, int num_words, unsigned long cksum,
puts("No residual data found.\n");
}
/* First, figure out what kind of host bridge we are on. If it's
* an MPC10x, we can ask it directly how much memory it has.
* Otherwise, see if the residual data has anything. This isn't
* the best way, but it can be the only way. If there's nothing,
* assume 32MB. -- Tom.
*/
/* See what our host bridge is. */
pci_read_config_32(0x00, 0x00, &pci_viddid);
pci_did = (pci_viddid & 0xffff0000) >> 16;
/* See if we are on an MPC10x. */
if (((pci_viddid & 0xffff) == PCI_VENDOR_ID_MOTOROLA)
&& ((pci_did == PCI_DEVICE_ID_MOTOROLA_MPC105)
|| (pci_did == PCI_DEVICE_ID_MOTOROLA_MPC106)
|| (pci_did == PCI_DEVICE_ID_MOTOROLA_MPC107)))
TotalMemory = get_mem_size();
/* If it's not, see if we have anything in the residual data. */
else if (residual && residual->TotalMemory)
TotalMemory = residual->TotalMemory;
/* Fall back to hard-coding 32MB. */
else
TotalMemory = 32*1024*1024;
/* assume the chunk below 8M is free */
end_avail = (char *)0x00800000;
......
......@@ -24,9 +24,11 @@
# Free Software Foundation; either version 2 of the License, or (at your
# option) any later version.
# Normally, we use the 'misc-simple.c' file for decompress_kernel and
boot: zImage
# Normally, we use the 'misc.c' file for decompress_kernel and
# whatnot. Sometimes we need to override this however.
MISC := ../common/misc-simple.o
MISC := misc.o
ifeq ($(CONFIG_IBM_OPENBIOS),y)
ZIMAGE := zImage-TREE
ZIMAGEINITRD := zImage.initrd-TREE
......@@ -38,6 +40,14 @@ ifeq ($(CONFIG_EMBEDDEDBOOT),y)
TFTPIMAGE := /tftpboot/zImage.embedded
MISC := misc-embedded.o
endif
ifeq ($(CONFIG_EBONY),y)
ZIMAGE := zImage-TREE
ZIMAGEINITRD := zImage.initrd-TREE
EXTRA := direct.o
END := ebony
ENTRYPOINT := 0x01000000
TFTPIMAGE := /tftpboot/zImage.$(END)
endif
ifeq ($(CONFIG_EV64260),y)
EXTRA := direct.o misc-ev64260.o
TFTPIMAGE := /tftpboot/zImage.ev64260
......@@ -72,11 +82,8 @@ endif
ifeq ($(CONFIG_PPLUS),y)
EXTRA := legacy.o
endif
ifeq ($(CONFIG_LOPEC),y)
EXTRA += ../common/mpc10x_memory.o
endif
ifeq ($(CONFIG_PAL4),y)
EXTRA := direct.o ../common/cpc700_memory.o
EXTRA := direct.o
endif
ifeq ($(CONFIG_PCORE)$(CONFIG_POWERPMC250),y)
ZIMAGE := zImage-STRIPELF
......@@ -122,21 +129,25 @@ endif
# Default linker args. Link at 0x00800000 or 0x00400000 by default, but
# allow it to be overridden.
ifeq ($(CONFIG_BOOT_LOAD_BOOL),y)
LD_ARGS := -T ../ld.script -Ttext $(CONFIG_BOOT_LOAD) \
-Bstatic
LD_ARGS := -T $(boot)/ld.script \
-Ttext $(CONFIG_BOOT_LOAD) -Bstatic
else
LD_ARGS = -T ../ld.script -Ttext 0x00800000 -Bstatic
ifeq ($(CONFIG_8260)$(CONFIG_4xx)$(CONFIG_8xx),y)
LD_ARGS := -T ../ld.script -Ttext 0x00400000 -Bstatic
LD_ARGS = -T $(boot)/ld.script \
-Ttext 0x00800000 -Bstatic
ifeq ($(CONFIG_8260)$(CONFIG_40x)$(CONFIG_8xx),y)
LD_ARGS := -T $(boot)/ld.script -Ttext 0x00400000 \
-Bstatic
endif
ifeq ($(CONFIG_440),y)
LD_ARGS := -T $(boot)/ld.script -Ttext 0x01000000 \
-Bstatic
endif
endif
OBJCOPY_ARGS := -O elf32-powerpc
# head.o and ../common/relocate.o must be at the start.
boot-y := head.o ../common/relocate.o $(EXTRA) \
$(MISC) ../common/misc-common.o \
../common/string.o ../common/util.o
boot-$(CONFIG_4xx) += embed_config.o
# head.o and relocate.o must be at the start.
boot-y := head.o relocate.o $(EXTRA) $(MISC)
boot-$(CONFIG_40x) += embed_config.o
boot-$(CONFIG_8xx) += embed_config.o
boot-$(CONFIG_8260) += embed_config.o
boot-$(CONFIG_BSEIP) += iic.o
......@@ -149,84 +160,97 @@ boot-$(CONFIG_8xx) += m8xx_tty.o
boot-$(CONFIG_8260) += m8260_tty.o
boot-$(CONFIG_GT64260_CONSOLE) += gt64260_tty.o
endif
boot-$(CONFIG_SERIAL_8250_CONSOLE) += ../common/ns16550.o
boot := arch/ppc/boot
common := $(boot)/common
utils := $(boot)/utils
bootlib := $(boot)/lib
images := $(boot)/images
EXTRA_TARGETS := $(boot-y)
LIBS := ../lib/lib.a
LIBS := $(common)/lib.a $(bootlib)/lib.a
include $(TOPDIR)/Rules.make
OBJS := $(addprefix $(obj)/,$(boot-y))
# Tools
MKBUGBOOT := ../utils/mkbugboot
MKPREP := ../utils/mkprep
MKTREE := ../utils/mktree
MKBUGBOOT := $(utils)/mkbugboot
MKPREP := $(utils)/mkprep
MKTREE := $(utils)/mktree
$(obj)/dummy.o: $(common)/dummy.c
$(CC) -c -o $@ $(common)/dummy.c
zvmlinux: $(boot-y) $(LIBS) ../ld.script ../images/vmlinux.gz ../common/dummy.o
$(obj)/zvmlinux: $(OBJS) $(LIBS) $(boot)/ld.script $(images)/vmlinux.gz \
$(obj)/dummy.o
$(OBJCOPY) $(OBJCOPY_ARGS) \
--add-section=.image=../images/vmlinux.gz \
--add-section=.image=$(images)/vmlinux.gz \
--set-section-flags=.image=contents,alloc,load,readonly,data \
../common/dummy.o image.o
$(LD) $(LD_ARGS) -o $@ $(boot-y) image.o $(LIBS)
$(OBJCOPY) $(OBJCOPY_ARGS) $@ $@ -R .comment -R .stab -R .stabstr \
-R .ramdisk -R .sysmap
$(obj)/dummy.o $(obj)/image.o
$(LD) $(LD_ARGS) -o $@ $(OBJS) $(obj)/image.o $(LIBS)
$(OBJCOPY) $(OBJCOPY_ARGS) $@ $@ -R .comment -R .stab \
-R .stabstr -R .ramdisk -R .sysmap
zvmlinux.initrd: $(boot-y) $(LIBS) ../ld.script ../images/vmlinux.gz \
../common/dummy.o
$(obj)/zvmlinux.initrd: $(OBJS) $(LIBS) $(boot)/ld.script \
$(images)/vmlinux.gz $(obj)/dummy.o
$(OBJCOPY) $(OBJCOPY_ARGS) \
--add-section=.ramdisk=../images/ramdisk.image.gz \
--add-section=.ramdisk=$(images)/ramdisk.image.gz \
--set-section-flags=.ramdisk=contents,alloc,load,readonly,data \
--add-section=.image=../images/vmlinux.gz \
--add-section=.image=$(images)/vmlinux.gz \
--set-section-flags=.image=contents,alloc,load,readonly,data \
../common/dummy.o image.o
$(LD) $(LD_ARGS) -o $@ $(boot-y) image.o $(LIBS)
$(OBJCOPY) $(OBJCOPY_ARGS) $@ $@ -R .comment -R .stab -R .stabstr \
-R .sysmap
$(obj)/dummy.o $(obj)/image.o
$(LD) $(LD_ARGS) -o $@ $(OBJS) $(obj)/image.o $(LIBS)
$(OBJCOPY) $(OBJCOPY_ARGS) $@ $@ -R .comment -R .stab \
-R .stabstr -R .sysmap
# Sort-of dummy rules, that let us format the image we want.
zImage: $(ZIMAGE) zvmlinux
cp -f zvmlinux ../images/zImage.elf
rm -f zvmlinux
zImage: $(images)/$(ZIMAGE) $(obj)/zvmlinux
cp -f $(obj)/zvmlinux $(images)/zImage.elf
rm -f $(obj)/zvmlinux
zImage.initrd: $(ZIMAGEINITRD) zvmlinux.initrd
cp -f zvmlinux.initrd ../images/zImage.initrd.elf
rm -f zvmlinux.initrd
zImage.initrd: $(images)/$(ZIMAGEINITRD) $(obj)/zvmlinux.initrd
cp -f $(obj)/zvmlinux.initrd $(images)/zImage.initrd.elf
rm -f $(obj)/zvmlinux.initrd
znetboot: zImage
ifneq ($(ZNETBOOT),)
cp ../images/$(ZNETBOOT) $(TFTPIMAGE)
cp $(images)/$(ZNETBOOT) $(TFTPIMAGE)
else
cp ../images/zImage.* $(TFTPIMAGE)
cp $(images)/zImage.* $(TFTPIMAGE)
endif
znetboot.initrd: zImage.initrd
ifneq ($(ZNETBOOTRD),)
cp ../images/$(ZNETBOOTRD) $(TFTPIMAGE)
cp $(images)/$(ZNETBOOTRD) $(TFTPIMAGE)
else
cp ../images/zImage.* $(TFTPIMAGE)
cp $(images)/zImage.* $(TFTPIMAGE)
endif
zImage-STRIPELF: zvmlinux
dd if=zvmlinux of=../images/zImage.$(END) skip=64 bs=1k
$(images)/zImage-STRIPELF: $(obj)/zvmlinux
dd if=$(obj)/zvmlinux of=$(images)/zImage.$(END) skip=64 bs=1k
zImage.initrd-STRIPELF: zvmlinux.initrd
dd if=zvmlinux.initrd of=../images/zImage.initrd.$(END) skip=64 bs=1k
$(images)/zImage.initrd-STRIPELF: $(obj)/zvmlinux.initrd
dd if=$(obj)/zvmlinux.initrd of=$(images)/zImage.initrd.$(END) \
skip=64 bs=1k
zImage-TREE: zvmlinux
$(MKTREE) zvmlinux ../images/zImage.$(END) $(ENTRYPOINT)
$(images)/zImage-TREE: $(obj)/zvmlinux
$(MKTREE) $(obj)/zvmlinux $(images)/zImage.$(END) $(ENTRYPOINT)
zImage.initrd-TREE: zvmlinux.initrd
$(MKTREE) zvmlinux.initrd ../images/zImage.initrd.$(END) $(ENTRYPOINT)
$(images)/zImage.initrd-TREE: $(obj)/zvmlinux.initrd
$(MKTREE) $(obj)/zvmlinux.initrd $(images)/zImage.initrd.$(END) \
$(ENTRYPOINT)
zImage-MENF1: zvmlinux
$(MKPREP) -pbp zvmlinux ../images/zImage.menf1
$(images)/zImage-MENF1: $(obj)/zvmlinux
$(MKPREP) -pbp $(obj)/zvmlinux $(images)/zImage.menf1
zImage.initrd-MENF1: zvmlinux.initrd
$(MKPREP) -pbp zvmlinux.initrd ../images/zImage.initrd.menf1
$(images)/zImage.initrd-MENF1: $(obj)/zvmlinux.initrd
$(MKPREP) -pbp $(obj)/zvmlinux.initrd $(images)/zImage.initrd.menf1
zImage-PPLUS: zvmlinux $(MKPREP) $(MKBUGBOOT)
$(MKPREP) -pbp zvmlinux ../images/zImage.pplus
$(MKBUGBOOT) zvmlinux ../images/zImage.bugboot
$(images)/zImage-PPLUS: $(obj)/zvmlinux $(MKPREP) $(MKBUGBOOT)
$(MKPREP) -pbp $(obj)/zvmlinux $(images)/zImage.pplus
$(MKBUGBOOT) $(obj)/zvmlinux $(images)/zImage.bugboot
zImage.initrd-PPLUS: zvmlinux.initrd $(MKPREP) $(MKBUGBOOT)
$(MKPREP) -pbp zvmlinux.initrd ../images/zImage.initrd.pplus
$(MKBUGBOOT) zvmlinux.initrd ../images/zImage.initrd.bugboot
include $(TOPDIR)/Rules.make
$(images)/zImage.initrd-PPLUS: $(obj)/zvmlinux.initrd $(MKPREP) $(MKBUGBOOT)
$(MKPREP) -pbp $(obj)/zvmlinux.initrd $(images)/zImage.initrd.pplus
$(MKBUGBOOT) $(obj)/zvmlinux.initrd $(images)/zImage.initrd.bugboot
......@@ -131,6 +131,7 @@ if [ "$CONFIG_6xx" = "y" -a "$CONFIG_8260" = "n" ]; then
Motorola-Sandpoint CONFIG_SANDPOINT \
SBS-Adirondack CONFIG_ADIR \
SBS-K2 CONFIG_K2 \
SBS-Palomar4 CONFIG_PAL4 \
Synergy-Gemini CONFIG_GEMINI \
Zynx-ZX4500 CONFIG_ZX4500" CHRP/PowerMac/PReP
......@@ -584,23 +585,31 @@ source lib/Config.in
mainmenu_option next_comment
comment 'Kernel hacking'
bool 'Magic SysRq key' CONFIG_MAGIC_SYSRQ
bool 'Spinlock debugging' CONFIG_DEBUG_SPINLOCK
bool 'Include kgdb kernel debugger' CONFIG_KGDB
if [ "$CONFIG_KGDB" = "y" ]; then
choice 'Serial Port' \
"ttyS0 CONFIG_KGDB_TTYS0 \
ttyS1 CONFIG_KGDB_TTYS1 \
ttyS2 CONFIG_KGDB_TTYS2 \
ttyS3 CONFIG_KGDB_TTYS3" ttyS1
fi
bool 'Include xmon kernel debugger' CONFIG_XMON
bool 'Include BDI-2000 user context switcher' CONFIG_BDI_SWITCH
if [ "$CONFIG_KGDB" = "y" -o "$CONFIG_XMON" = "y" \
-o "$CONFIG_BDI_SWITCH" = "y" ]; then
bool 'Add any additional compile options' CONFIG_MORE_COMPILE_OPTIONS
if [ "$CONFIG_MORE_COMPILE_OPTIONS" = "y" ]; then
string 'Additional compile arguments' CONFIG_COMPILE_OPTIONS "-g -ggdb"
bool 'Kernel debugging' CONFIG_DEBUG_KERNEL
if [ "$CONFIG_DEBUG_KERNEL" = "y" ]; then
bool ' Debug memory allocations' CONFIG_DEBUG_SLAB
bool ' Magic SysRq key' CONFIG_MAGIC_SYSRQ
bool ' Spinlock debugging' CONFIG_DEBUG_SPINLOCK
if [ "$CONFIG_HIGHMEM" = "y" ]; then
bool ' Highmem debugging' CONFIG_DEBUG_HIGHMEM
fi
bool ' Load all symbols for debugging/kksymoops' CONFIG_KALLSYMS
bool ' Include kgdb kernel debugger' CONFIG_KGDB
if [ "$CONFIG_KGDB" = "y" ]; then
choice ' Serial Port' \
"ttyS0 CONFIG_KGDB_TTYS0 \
ttyS1 CONFIG_KGDB_TTYS1 \
ttyS2 CONFIG_KGDB_TTYS2 \
ttyS3 CONFIG_KGDB_TTYS3" ttyS1
fi
bool ' Include xmon kernel debugger' CONFIG_XMON
bool ' Include BDI-2000 user context switcher' CONFIG_BDI_SWITCH
if [ "$CONFIG_KGDB" = "y" -o "$CONFIG_XMON" = "y" \
-o "$CONFIG_BDI_SWITCH" = "y" ]; then
bool ' Add any additional compile options' CONFIG_MORE_COMPILE_OPTIONS
if [ "$CONFIG_MORE_COMPILE_OPTIONS" = "y" ]; then
string ' Additional compile arguments' CONFIG_COMPILE_OPTIONS "-g -ggdb"
fi
fi
fi
......
......@@ -27,13 +27,18 @@ indirect_read_config(struct pci_bus *bus, unsigned int devfn, int offset,
{
struct pci_controller *hose = bus->sysdata;
volatile unsigned char *cfg_data;
u8 cfg_type = 0;
if (ppc_md.pci_exclude_device)
if (ppc_md.pci_exclude_device(bus->number, devfn))
return PCIBIOS_DEVICE_NOT_FOUND;
if (hose->set_cfg_type)
if (bus->number != hose->first_busno)
cfg_type = 1;
out_be32(hose->cfg_addr,
((offset & 0xfc) << 24) | (devfn << 16)
(((offset & 0xfc) | cfg_type) << 24) | (devfn << 16)
| ((bus->number - hose->bus_offset) << 8) | 0x80);
/*
* Note: the caller has already checked that offset is
......@@ -60,13 +65,18 @@ indirect_write_config(struct pci_bus *bus, unsigned int devfn, int offset,
{
struct pci_controller *hose = bus->sysdata;
volatile unsigned char *cfg_data;
u8 cfg_type = 0;
if (ppc_md.pci_exclude_device)
if (ppc_md.pci_exclude_device(bus->number, devfn))
return PCIBIOS_DEVICE_NOT_FOUND;
if (hose->set_cfg_type)
if (bus->number != hose->first_busno)
cfg_type = 1;
out_be32(hose->cfg_addr,
((offset & 0xfc) << 24) | (devfn << 16)
(((offset & 0xfc) | cfg_type) << 24) | (devfn << 16)
| ((bus->number - hose->bus_offset) << 8) | 0x80);
/*
* Note: the caller has already checked that offset is
......
......@@ -751,21 +751,6 @@ _GLOBAL(copy_page)
blr
#endif /* CONFIG_PPC_ISERIES */
/*
* Atomic [test&set] exchange
*
* unsigned long xchg_u32(void *ptr, unsigned long val)
* Changes the memory location '*ptr' to be val and returns
* the previous value stored there.
*/
_GLOBAL(xchg_u32)
mr r5,r3 /* Save pointer */
10: lwarx r3,0,r5 /* Fetch old value & reserve */
PPC405_ERR77(0,r5)
stwcx. r4,0,r5 /* Update with new value */
bne- 10b /* Retry if "reservation" (i.e. lock) lost */
blr
/*
* void atomic_clear_mask(atomic_t mask, atomic_t *addr)
* void atomic_set_mask(atomic_t mask, atomic_t *addr);
......
......@@ -30,6 +30,8 @@
#include <linux/pmu.h>
#include <asm/prom.h>
#include <asm/system.h>
#define __KERNEL_SYSCALLS__
#include <asm/unistd.h>
#include <asm/pci-bridge.h>
#include <asm/irq.h>
#include <asm/pmac_feature.h>
......@@ -180,6 +182,10 @@ EXPORT_SYMBOL(consistent_free);
EXPORT_SYMBOL(consistent_sync);
#endif
EXPORT_SYMBOL(open);
EXPORT_SYMBOL(read);
EXPORT_SYMBOL(lseek);
EXPORT_SYMBOL(close);
EXPORT_SYMBOL(start_thread);
EXPORT_SYMBOL(kernel_thread);
......@@ -191,7 +197,6 @@ EXPORT_SYMBOL(flush_dcache_range);
EXPORT_SYMBOL(flush_icache_user_range);
EXPORT_SYMBOL(flush_icache_page);
EXPORT_SYMBOL(flush_dcache_page);
EXPORT_SYMBOL(xchg_u32);
#ifdef CONFIG_ALTIVEC
EXPORT_SYMBOL(last_task_used_altivec);
EXPORT_SYMBOL(giveup_altivec);
......
......@@ -4,7 +4,7 @@
export-objs := dec_and_lock.o
obj-y := checksum.o string.o strcase.o dec_and_lock.o
obj-y := checksum.o string.o strcase.o dec_and_lock.o div64.o
obj-$(CONFIG_SMP) += locks.o
......
/*
* Divide a 64-bit unsigned number by a 32-bit unsigned number.
* This routine assumes that the top 32 bits of the dividend are
* non-zero to start with.
* On entry, r3 points to the dividend, which get overwritten with
* the 64-bit quotient, and r4 contains the divisor.
* On exit, r3 contains the remainder.
*
* Copyright (C) 2002 Paul Mackerras, 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.
*/
#include <asm/ppc_asm.h>
#include <asm/processor.h>
_GLOBAL(__div64_32)
lwz r5,0(r3) # get the dividend into r5/r6
lwz r6,4(r3)
cmplw r5,r4
li r7,0
li r8,0
blt 1f
divwu r7,r5,r4 # if dividend.hi >= divisor,
mullw r0,r7,r4 # quotient.hi = dividend.hi / divisor
subf. r5,r0,r5 # dividend.hi %= divisor
beq 3f
1: mr r11,r5 # here dividend.hi != 0
andis. r0,r5,0xc000
bne 2f
cntlzw r0,r5 # we are shifting the dividend right
li r10,-1 # to make it < 2^32, and shifting
srw r10,r10,r0 # the divisor right the same amount,
add r9,r4,r10 # rounding up (so the estimate cannot
andc r11,r6,r10 # ever be too large, only too small)
andc r9,r9,r10
or r11,r5,r11
rotlw r9,r9,r0
rotlw r11,r11,r0
divwu r11,r11,r9 # then we divide the shifted quantities
2: mullw r10,r11,r4 # to get an estimate of the quotient,
mulhwu r9,r11,r4 # multiply the estimate by the divisor,
subfc r6,r10,r6 # take the product from the divisor,
add r8,r8,r11 # and add the estimate to the accumulated
subfe. r5,r9,r5 # quotient
bne 1b
3: cmplw r6,r4
blt 4f
divwu r0,r6,r4 # perform the remaining 32-bit division
mullw r10,r0,r4 # and get the remainder
add r8,r8,r0
subf r6,r10,r6
4: stw r7,0(r3) # return the quotient in *r3
stw r8,4(r3)
mr r3,r6 # return the remainder in r3
blr
......@@ -37,6 +37,7 @@ obj-$(CONFIG_LOPEC) += lopec_setup.o lopec_pci.o
obj-$(CONFIG_MCPN765) += mcpn765_setup.o mcpn765_pci.o
obj-$(CONFIG_MENF1) += menf1_setup.o menf1_pci.o
obj-$(CONFIG_MVME5100) += mvme5100_setup.o mvme5100_pci.o
obj-$(CONFIG_PAL4) += pal4_setup.o pal4_pci.o cpc700_pic.o
obj-$(CONFIG_PCORE) += pcore_setup.o pcore_pci.o
obj-$(CONFIG_POWERPMC250) += powerpmc250.o
obj-$(CONFIG_PPLUS) += pplus_pci.o pplus_setup.o
......
/*
* arch/ppc/platforms/pal4.h
*
* Definitions for SBS Palomar IV board
*
* Author: Dan Cox
*
* Copyright 2002 MontaVista Software Inc.
*
* 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.
*/
#ifndef __PPC_PLATFORMS_PAL4_H
#define __PPC_PLATFORMS_PAL4_H
#define PAL4_NVRAM 0xfffc0000
#define PAL4_NVRAM_SIZE 0x8000
#define PAL4_DRAM 0xfff80000
#define PAL4_DRAM_BR_MASK 0xc0
#define PAL4_DRAM_BR_SHIFT 6
#define PAL4_DRAM_RESET 0x10
#define PAL4_DRAM_EREADY 0x40
#define PAL4_MISC 0xfff80004
#define PAL4_MISC_FB_MASK 0xc0
#define PAL4_MISC_FLASH 0x20 /* StratFlash mapping: 1->0xff80, 0->0xfff0 */
#define PAL4_MISC_MISC 0x08
#define PAL4_MISC_BITF 0x02
#define PAL4_MISC_NVKS 0x01
#define PAL4_L2 0xfff80008
#define PAL4_L2_MASK 0x07
#define PAL4_PLDR 0xfff8000c
/* Only two Ethernet devices on the board... */
#define PAL4_ETH 31
#define PAL4_INTA 20
#endif /* __PPC_PLATFORMS_PAL4_H */
/*
* arch/ppc/platforms/pal4_pci.c
*
* PCI support for SBS Palomar IV
*
* Author: Dan Cox
*
* Copyright 2002 MontaVista Software Inc.
*
* 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.
*/
#include <linux/kernel.h>
#include <linux/init.h>
#include <linux/pci.h>
#include <asm/byteorder.h>
#include <asm/machdep.h>
#include <asm/io.h>
#include <asm/pci-bridge.h>
#include <asm/uaccess.h>
#include "cpc700.h"
#include "pal4.h"
/* not much to this.... */
static inline int __init
pal4_map_irq(struct pci_dev *dev, unsigned char idsel, unsigned char pin)
{
if (idsel == 9)
return PAL4_ETH;
else
return PAL4_INTA + (idsel - 3);
}
void __init
pal4_find_bridges(void)
{
struct pci_controller *hose;
hose = pcibios_alloc_controller();
if (!hose)
return;
hose->first_busno = 0;
hose->last_busno = 0xff;
hose->pci_mem_offset = 0;
/* Could snatch these from the CPC700.... */
pci_init_resource(&hose->io_resource,
0x0,
0x03ffffff,
IORESOURCE_IO,
"PCI host bridge");
pci_init_resource(&hose->mem_resources[0],
0x90000000,
0x9fffffff,
IORESOURCE_MEM,
"PCI host bridge");
hose->io_space.start = 0x00800000;
hose->io_space.end = 0x03ffffff;
hose->mem_space.start = 0x90000000;
hose->mem_space.end = 0x9fffffff;
hose->io_base_virt = (void *) 0xf8000000;
setup_indirect_pci(hose, CPC700_PCI_CONFIG_ADDR,
CPC700_PCI_CONFIG_DATA);
hose->last_busno = pciauto_bus_scan(hose, hose->first_busno);
ppc_md.pci_swizzle = common_swizzle;
ppc_md.pci_map_irq = pal4_map_irq;
}
/*
* arch/ppc/platforms/pal4_serial.h
*
* Definitions for SBS PalomarIV serial support
*
* Author: Dan Cox
*
* Copyright 2002 MontaVista Software Inc.
*
* 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.
*/
#ifndef __PPC_PAL4_SERIAL_H
#define __PPC_PAL4_SERIAL_H
#define CPC700_SERIAL_1 0xff600300
#define CPC700_SERIAL_2 0xff600400
#define RS_TABLE_SIZE 2
#define BASE_BAUD (33333333 / 4 / 16)
#ifdef CONFIG_SERIAL_DETECT_IRQ
#define STD_COM_FLAGS (ASYNC_BOOT_AUTOCONF|ASYNC_SKIP_TEST|ASYNC_AUTO_IRQ)
#define STD_COM4_FLAGS (ASYNC_BOOT_AUTOCONF|ASYNC_AUTO_IRQ)
#else
#define STD_COM_FLAGS (ASYNC_BOOT_AUTOCONF|ASYNC_SKIP_TEST)
#define STD_COM4_FLAGS (ASYNC_BOOT_AUTOCONF)
#endif
#define SERIAL_PORT_DFNS \
{0, BASE_BAUD, CPC700_SERIAL_1, 3, STD_COM_FLAGS, \
iomem_base: (unsigned char *) CPC700_SERIAL_1, \
io_type: SERIAL_IO_MEM}, /* ttyS0 */ \
{0, BASE_BAUD, CPC700_SERIAL_2, 4, STD_COM_FLAGS, \
iomem_base: (unsigned char *) CPC700_SERIAL_2, \
io_type: SERIAL_IO_MEM}
#endif
/*
* arch/ppc/platforms/pal4_setup.c
*
* Board setup routines for the SBS PalomarIV.
*
* Author: Dan Cox
*
* Copyright 2002 MontaVista Software Inc.
*
* 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.
*/
#include <linux/config.h>
#include <linux/kernel.h>
#include <linux/init.h>
#include <linux/types.h>
#include <linux/errno.h>
#include <linux/reboot.h>
#include <linux/time.h>
#include <linux/irq.h>
#include <linux/kdev_t.h>
#include <linux/blk.h>
#include <linux/console.h>
#include <linux/seq_file.h>
#include <linux/root_dev.h>
#include <asm/io.h>
#include <asm/todc.h>
#include <asm/bootinfo.h>
#include "cpc700.h"
#include "pal4.h"
extern void pal4_find_bridges(void);
unsigned int cpc700_irq_assigns[][2] = {
{1, 1}, /* IRQ 0: ECC correctable error */
{1, 1}, /* IRQ 1: PCI write to memory range */
{0, 1}, /* IRQ 2: PCI write to command register */
{0, 1}, /* IRQ 3: UART 0 */
{0, 1}, /* IRQ 4: UART 1 */
{0, 1}, /* IRQ 5: ICC 0 */
{0, 1}, /* IRQ 6: ICC 1 */
{0, 1}, /* IRQ 7: GPT compare 0 */
{0, 1}, /* IRQ 8: GPT compare 1 */
{0, 1}, /* IRQ 9: GPT compare 2 */
{0, 1}, /* IRQ 10: GPT compare 3 */
{0, 1}, /* IRQ 11: GPT compare 4 */
{0, 1}, /* IRQ 12: GPT capture 0 */
{0, 1}, /* IRQ 13: GPT capture 1 */
{0, 1}, /* IRQ 14: GPT capture 2 */
{0, 1}, /* IRQ 15: GPT capture 3 */
{0, 1}, /* IRQ 16: GPT capture 4 */
{0, 0}, /* IRQ 17: reserved */
{0, 0}, /* IRQ 18: reserved */
{0, 0}, /* IRQ 19: reserved */
{0, 0}, /* IRQ 20: reserved */
{0, 1}, /* IRQ 21: Ethernet */
{0, 0}, /* IRQ 22: reserved */
{0, 0}, /* IRQ 23: reserved */
{0, 0}, /* IRQ 24: resreved */
{0, 0}, /* IRQ 25: reserved */
{0, 0}, /* IRQ 26: reserved */
{0, 0}, /* IRQ 27: reserved */
{0, 0}, /* IRQ 28: reserved */
{0, 0}, /* IRQ 29: reserved */
{0, 0}, /* IRQ 30: reserved */
{0, 0}, /* IRQ 31: reserved */
};
static int
pal4_show_cpuinfo(struct seq_file *m)
{
seq_printf(m, "board\t\t: SBS Palomar IV\n");
return 0;
}
static void
pal4_restart(char *cmd)
{
__cli();
__asm__ __volatile__("lis 3,0xfff0\n \
ori 3,3,0x100\n \
mtspr 26,3\n \
li 3,0\n \
mtspr 27,3\n \
rfi");
for(;;);
}
static void
pal4_power_off(void)
{
__cli();
for(;;);
}
static void
pal4_halt(void)
{
pal4_power_off();
}
TODC_ALLOC();
static void __init
pal4_setup_arch(void)
{
unsigned long l2;
TODC_INIT(TODC_TYPE_MK48T37, 0, 0,
ioremap(PAL4_NVRAM, PAL4_NVRAM_SIZE), 8);
pal4_find_bridges();
#ifdef CONFIG_BLK_DEV_INITRD
if (initrd_start)
ROOT_DEV = Root_RAM0;
else
#endif
ROOT_DEV = Root_NFS;
/* The L2 gets disabled in the bootloader, but all the proper
bits should be present from the fw, so just re-enable it */
l2 = _get_L2CR();
if (!(l2 & L2CR_L2E)) {
/* presume that it was initially set if the size is
still present. */
if (l2 ^ L2CR_L2SIZ_MASK)
_set_L2CR(l2 | L2CR_L2E);
else
printk("L2 not set by firmware; left disabled.\n");
}
}
static void __init
pal4_map_io(void)
{
io_block_mapping(0xf0000000, 0xf0000000, 0x10000000, _PAGE_IO);
}
void __init
platform_init(unsigned long r3, unsigned long r4, unsigned long r5,
unsigned long r6, unsigned long r7)
{
parse_bootinfo(find_bootinfo());
isa_io_base = 0 /*PAL4_ISA_IO_BASE*/;
pci_dram_offset = 0 /*PAL4_PCI_SYS_MEM_BASE*/;
ppc_md.setup_arch = pal4_setup_arch;
ppc_md.show_cpuinfo = pal4_show_cpuinfo;
ppc_md.setup_io_mappings = pal4_map_io;
ppc_md.init_IRQ = cpc700_init_IRQ;
ppc_md.get_irq = cpc700_get_irq;
ppc_md.restart = pal4_restart;
ppc_md.halt = pal4_halt;
ppc_md.power_off = pal4_power_off;
ppc_md.time_init = todc_time_init;
ppc_md.set_rtc_time = todc_set_rtc_time;
ppc_md.get_rtc_time = todc_get_rtc_time;
ppc_md.calibrate_decr = todc_calibrate_decr;
ppc_md.nvram_read_val = todc_direct_read_val;
ppc_md.nvram_write_val = todc_direct_write_val;
}
......@@ -168,13 +168,7 @@ pcore_init_IRQ(void)
for ( i = 0 ; i < 16 ; i++ )
irq_desc[i].handler = &i8259_pic;
i8259_init(NULL);
}
static int
pcore_get_irq(struct pt_regs *regs)
{
return i8259_poll();
i8259_init(0);
}
/*
......@@ -184,22 +178,16 @@ static __inline__ void
pcore_set_bat(void)
{
unsigned long bat3u, bat3l;
static int mapping_set = 0;
if (!mapping_set) {
__asm__ __volatile__(
" lis %0,0xf000\n \
ori %1,%0,0x002a\n \
ori %0,%0,0x1ffe\n \
mtspr 0x21e,%0\n \
mtspr 0x21f,%1\n \
isync\n \
sync "
: "=r" (bat3u), "=r" (bat3l));
mapping_set = 1;
}
return;
__asm__ __volatile__(
" lis %0,0xf000\n \
ori %1,%0,0x002a\n \
ori %0,%0,0x1ffe\n \
mtspr 0x21e,%0\n \
mtspr 0x21f,%1\n \
isync\n \
sync "
: "=r" (bat3u), "=r" (bat3l));
}
static unsigned long __init
......@@ -233,7 +221,7 @@ platform_init(unsigned long r3, unsigned long r4, unsigned long r5,
ppc_md.setup_arch = pcore_setup_arch;
ppc_md.show_cpuinfo = pcore_show_cpuinfo;
ppc_md.init_IRQ = pcore_init_IRQ;
ppc_md.get_irq = pcore_get_irq;
ppc_md.get_irq = i8259_irq;
ppc_md.find_end_of_memory = pcore_find_end_of_memory;
ppc_md.setup_io_mappings = pcore_map_io;
......
......@@ -87,9 +87,9 @@ SECTIONS
. = ALIGN(4096);
__init_begin = .;
.text.init : { *(.text.init) }
.data.init : {
*(.data.init);
.init.text : { *(.init.text) }
.init.data : {
*(.init.data);
__vtop_table_begin = .;
*(.vtop_fixup);
__vtop_table_end = .;
......@@ -99,7 +99,7 @@ SECTIONS
}
. = ALIGN(16);
__setup_start = .;
.setup.init : { *(.setup.init) }
.init.setup : { *(.init.setup) }
__setup_end = .;
__initcall_start = .;
.initcall.init : {
......@@ -121,29 +121,29 @@ SECTIONS
. = ALIGN(4096);
__pmac_begin = .;
.text.pmac : { *(.text.pmac) }
.data.pmac : { *(.data.pmac) }
.pmac.text : { *(.pmac.text) }
.pmac.data : { *(.pmac.data) }
. = ALIGN(4096);
__pmac_end = .;
. = ALIGN(4096);
__prep_begin = .;
.text.prep : { *(.text.prep) }
.data.prep : { *(.data.prep) }
.prep.text : { *(.prep.text) }
.prep.data : { *(.prep.data) }
. = ALIGN(4096);
__prep_end = .;
. = ALIGN(4096);
__chrp_begin = .;
.text.chrp : { *(.text.chrp) }
.data.chrp : { *(.data.chrp) }
.chrp.text : { *(.chrp.text) }
.chrp.data : { *(.chrp.data) }
. = ALIGN(4096);
__chrp_end = .;
. = ALIGN(4096);
__openfirmware_begin = .;
.text.openfirmware : { *(.text.openfirmware) }
.data.openfirmware : { *(.data.openfirmware) }
.openfirmware.text : { *(.openfirmware.text) }
.openfirmware.data : { *(.openfirmware.data) }
. = ALIGN(4096);
__openfirmware_end = .;
......
#ifndef __PPC_DIV64
#define __PPC_DIV64
#define do_div(n,base) ({ \
int __res; \
__res = ((unsigned long) n) % (unsigned) base; \
n = ((unsigned long) n) / (unsigned) base; \
__res; })
#include <linux/types.h>
extern u32 __div64_32(u64 *dividend, u32 div);
#define do_div(n, div) ({ \
u64 __n = (n); \
u32 __d = (div); \
u32 __q, __r; \
if ((__n >> 32) == 0) { \
__q = (u32)__n / __d; \
__r = (u32)__n - __q * __d; \
(n) = __q; \
} else { \
__r = __div64_32(&__n, __d); \
(n) = __n; \
} \
__r; \
})
#endif
......@@ -68,6 +68,11 @@ struct pci_controller {
struct pci_ops *ops;
volatile unsigned int *cfg_addr;
volatile unsigned char *cfg_data;
/*
* If set, indirect method will set the cfg_type bit as
* needed to generate type 1 configuration transactions.
*/
int set_cfg_type;
/* Currently, we limit ourselves to 1 IO range and 3 mem
* ranges since the common pci_bus structure can't handle more
......
......@@ -2,27 +2,27 @@
#ifndef _PPC_SECTIONS_H
#define _PPC_SECTIONS_H
#define __pmac __attribute__ ((__section__ (".text.pmac")))
#define __pmacdata __attribute__ ((__section__ (".data.pmac")))
#define __pmac __attribute__ ((__section__ (".pmac.text")))
#define __pmacdata __attribute__ ((__section__ (".pmac.data")))
#define __pmacfunc(__argpmac) \
__argpmac __pmac; \
__argpmac
#define __prep __attribute__ ((__section__ (".text.prep")))
#define __prepdata __attribute__ ((__section__ (".data.prep")))
#define __prep __attribute__ ((__section__ (".prep.text")))
#define __prepdata __attribute__ ((__section__ (".prep.data")))
#define __prepfunc(__argprep) \
__argprep __prep; \
__argprep
#define __chrp __attribute__ ((__section__ (".text.chrp")))
#define __chrpdata __attribute__ ((__section__ (".data.chrp")))
#define __chrp __attribute__ ((__section__ (".chrp.text")))
#define __chrpdata __attribute__ ((__section__ (".chrp.data")))
#define __chrpfunc(__argchrp) \
__argchrp __chrp; \
__argchrp
/* this is actually just common chrp/pmac code, not OF code -- Cort */
#define __openfirmware __attribute__ ((__section__ (".text.openfirmware")))
#define __openfirmwaredata __attribute__ ((__section__ (".data.openfirmware")))
#define __openfirmware __attribute__ ((__section__ (".openfirmware.text")))
#define __openfirmwaredata __attribute__ ((__section__ (".openfirmware.data")))
#define __openfirmwarefunc(__argopenfirmware) \
__argopenfirmware __openfirmware; \
__argopenfirmware
......
......@@ -119,14 +119,14 @@ extern void __xchg_called_with_bad_pointer(void);
#define xchg(ptr,x) ((__typeof__(*(ptr)))__xchg((unsigned long)(x),(ptr),sizeof(*(ptr))))
#define tas(ptr) (xchg((ptr),1))
static inline unsigned long __xchg(unsigned long x, void * ptr, int size)
static inline unsigned long __xchg(unsigned long x, volatile void *ptr, int size)
{
switch (size) {
case 4:
return (unsigned long )xchg_u32(ptr, x);
return (unsigned long) xchg_u32(ptr, x);
#if 0 /* xchg_u64 doesn't exist on 32-bit PPC */
case 8:
return (unsigned long )xchg_u64(ptr, x);
return (unsigned long) xchg_u64(ptr, x);
#endif /* 0 */
}
__xchg_called_with_bad_pointer();
......
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